@unotest/viewer 0.27.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DslEditor-CV43IwH6.js","assets/DslEditor-DBQtlhBZ.css"])))=>i.map(i=>d[i]);
2
- var e,t,i,s,r,n,o,a,l,c,h,u,d,f,p,g,v,m,_,b,x,y,w,S,k,C,j,N,M,E,B,D,L,R,P,A,T,z,O,I,F,H,W,K,U,q,$,V,Y,G,X,J,Z,Q,ee,te,ie,se,re,ne,oe,ae,le,ce,he,ue,de,fe,pe,ge,ve,me,_e,be,xe,ye,we,Se,ke,Ce,je,Ne,Me,Ee,Be,De,Le,Re,Pe,Ae,Te,ze,Oe,Ie,Fe,He,We,Ke,Ue,qe,$e,Ve,Ye,Ge,Xe,Je,Ze,Qe,et,tt,it,st,rt,nt,ot,at,lt,ct,ht,ut,dt,ft,pt,gt,vt,mt,_t,bt,xt,yt,wt,St,kt,Ct,jt,Nt,Mt=Object.defineProperty,Et=(e,t,i)=>((e,t,i)=>t in e?Mt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i)(e,"symbol"!=typeof t?t+"":t,i);function Bt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver(e=>{for(const i of e)if("childList"===i.type)for(const e of i.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)}).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();var Dt={exports:{}},Lt={},Rt={exports:{}},Pt={},At=Symbol.for("react.element"),Tt=Symbol.for("react.portal"),zt=Symbol.for("react.fragment"),Ot=Symbol.for("react.strict_mode"),It=Symbol.for("react.profiler"),Ft=Symbol.for("react.provider"),Ht=Symbol.for("react.context"),Wt=Symbol.for("react.forward_ref"),Kt=Symbol.for("react.suspense"),Ut=Symbol.for("react.memo"),qt=Symbol.for("react.lazy"),$t=Symbol.iterator;var Vt={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Yt=Object.assign,Gt={};function Xt(e,t,i){this.props=e,this.context=t,this.refs=Gt,this.updater=i||Vt}function Jt(){}function Zt(e,t,i){this.props=e,this.context=t,this.refs=Gt,this.updater=i||Vt}Xt.prototype.isReactComponent={},Xt.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},Xt.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},Jt.prototype=Xt.prototype;var Qt=Zt.prototype=new Jt;Qt.constructor=Zt,Yt(Qt,Xt.prototype),Qt.isPureReactComponent=!0;var ei=Array.isArray,ti=Object.prototype.hasOwnProperty,ii={current:null},si={key:!0,ref:!0,__self:!0,__source:!0};function ri(e,t,i){var s,r={},n=null,o=null;if(null!=t)for(s in void 0!==t.ref&&(o=t.ref),void 0!==t.key&&(n=""+t.key),t)ti.call(t,s)&&!si.hasOwnProperty(s)&&(r[s]=t[s]);var a=arguments.length-2;if(1===a)r.children=i;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];r.children=l}if(e&&e.defaultProps)for(s in a=e.defaultProps)void 0===r[s]&&(r[s]=a[s]);return{$$typeof:At,type:e,key:n,ref:o,props:r,_owner:ii.current}}function ni(e){return"object"==typeof e&&null!==e&&e.$$typeof===At}var oi=/\/+/g;function ai(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function li(e,t,i,s,r){var n=typeof e;"undefined"!==n&&"boolean"!==n||(e=null);var o=!1;if(null===e)o=!0;else switch(n){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case At:case Tt:o=!0}}if(o)return r=r(o=e),e=""===s?"."+ai(o,0):s,ei(r)?(i="",null!=e&&(i=e.replace(oi,"$&/")+"/"),li(r,t,i,"",function(e){return e})):null!=r&&(ni(r)&&(r=function(e,t){return{$$typeof:At,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(r,i+(!r.key||o&&o.key===r.key?"":(""+r.key).replace(oi,"$&/")+"/")+e)),t.push(r)),1;if(o=0,s=""===s?".":s+":",ei(e))for(var a=0;a<e.length;a++){var l=s+ai(n=e[a],a);o+=li(n,t,i,l,r)}else if(l=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=$t&&e[$t]||e["@@iterator"])?e:null}(e),"function"==typeof l)for(e=l.call(e),a=0;!(n=e.next()).done;)o+=li(n=n.value,t,i,l=s+ai(n,a++),r);else if("object"===n)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function ci(e,t,i){if(null==e)return e;var s=[],r=0;return li(e,s,"","",function(e){return t.call(i,e,r++)}),s}function hi(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var ui={current:null},di={transition:null},fi={ReactCurrentDispatcher:ui,ReactCurrentBatchConfig:di,ReactCurrentOwner:ii};function pi(){throw Error("act(...) is not supported in production builds of React.")}Pt.Children={map:ci,forEach:function(e,t,i){ci(e,function(){t.apply(this,arguments)},i)},count:function(e){var t=0;return ci(e,function(){t++}),t},toArray:function(e){return ci(e,function(e){return e})||[]},only:function(e){if(!ni(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},Pt.Component=Xt,Pt.Fragment=zt,Pt.Profiler=It,Pt.PureComponent=Zt,Pt.StrictMode=Ot,Pt.Suspense=Kt,Pt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=fi,Pt.act=pi,Pt.cloneElement=function(e,t,i){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var s=Yt({},e.props),r=e.key,n=e.ref,o=e._owner;if(null!=t){if(void 0!==t.ref&&(n=t.ref,o=ii.current),void 0!==t.key&&(r=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)ti.call(t,l)&&!si.hasOwnProperty(l)&&(s[l]=void 0===t[l]&&void 0!==a?a[l]:t[l])}var l=arguments.length-2;if(1===l)s.children=i;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];s.children=a}return{$$typeof:At,type:e.type,key:r,ref:n,props:s,_owner:o}},Pt.createContext=function(e){return(e={$$typeof:Ht,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:Ft,_context:e},e.Consumer=e},Pt.createElement=ri,Pt.createFactory=function(e){var t=ri.bind(null,e);return t.type=e,t},Pt.createRef=function(){return{current:null}},Pt.forwardRef=function(e){return{$$typeof:Wt,render:e}},Pt.isValidElement=ni,Pt.lazy=function(e){return{$$typeof:qt,_payload:{_status:-1,_result:e},_init:hi}},Pt.memo=function(e,t){return{$$typeof:Ut,type:e,compare:void 0===t?null:t}},Pt.startTransition=function(e){var t=di.transition;di.transition={};try{e()}finally{di.transition=t}},Pt.unstable_act=pi,Pt.useCallback=function(e,t){return ui.current.useCallback(e,t)},Pt.useContext=function(e){return ui.current.useContext(e)},Pt.useDebugValue=function(){},Pt.useDeferredValue=function(e){return ui.current.useDeferredValue(e)},Pt.useEffect=function(e,t){return ui.current.useEffect(e,t)},Pt.useId=function(){return ui.current.useId()},Pt.useImperativeHandle=function(e,t,i){return ui.current.useImperativeHandle(e,t,i)},Pt.useInsertionEffect=function(e,t){return ui.current.useInsertionEffect(e,t)},Pt.useLayoutEffect=function(e,t){return ui.current.useLayoutEffect(e,t)},Pt.useMemo=function(e,t){return ui.current.useMemo(e,t)},Pt.useReducer=function(e,t,i){return ui.current.useReducer(e,t,i)},Pt.useRef=function(e){return ui.current.useRef(e)},Pt.useState=function(e){return ui.current.useState(e)},Pt.useSyncExternalStore=function(e,t,i){return ui.current.useSyncExternalStore(e,t,i)},Pt.useTransition=function(){return ui.current.useTransition()},Pt.version="18.3.1",Rt.exports=Pt;var gi=Rt.exports;const vi=Bt(gi);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DslEditor-CvL23vIm.js","assets/DslEditor-DBQtlhBZ.css"])))=>i.map(i=>d[i]);
2
+ var e,t,i,s,r,n,o,a,l,c,h,u,d,f,p,g,v,m,_,b,x,y,w,S,k,C,j,N,M,B,E,D,L,P,R,A,T,z,O,I,F,H,W,K,U,$,q,V,Y,G,X,Z,J,Q,ee,te,ie,se,re,ne,oe,ae,le,ce,he,ue,de,fe,pe,ge,ve,me,_e,be,xe,ye,we,Se,ke,Ce,je,Ne,Me,Be,Ee,De,Le,Pe,Re,Ae,Te,ze,Oe,Ie,Fe,He,We,Ke,Ue,$e,qe,Ve,Ye,Ge,Xe,Ze,Je,Qe,et,tt,it,st,rt,nt,ot,at,lt,ct,ht,ut,dt,ft,pt,gt,vt,mt,_t,bt,xt,yt,wt,St,kt,Ct,jt,Nt,Mt=Object.defineProperty,Bt=(e,t,i)=>((e,t,i)=>t in e?Mt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i)(e,"symbol"!=typeof t?t+"":t,i);function Et(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver(e=>{for(const i of e)if("childList"===i.type)for(const e of i.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)}).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();var Dt={exports:{}},Lt={},Pt={exports:{}},Rt={},At=Symbol.for("react.element"),Tt=Symbol.for("react.portal"),zt=Symbol.for("react.fragment"),Ot=Symbol.for("react.strict_mode"),It=Symbol.for("react.profiler"),Ft=Symbol.for("react.provider"),Ht=Symbol.for("react.context"),Wt=Symbol.for("react.forward_ref"),Kt=Symbol.for("react.suspense"),Ut=Symbol.for("react.memo"),$t=Symbol.for("react.lazy"),qt=Symbol.iterator;var Vt={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Yt=Object.assign,Gt={};function Xt(e,t,i){this.props=e,this.context=t,this.refs=Gt,this.updater=i||Vt}function Zt(){}function Jt(e,t,i){this.props=e,this.context=t,this.refs=Gt,this.updater=i||Vt}Xt.prototype.isReactComponent={},Xt.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},Xt.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},Zt.prototype=Xt.prototype;var Qt=Jt.prototype=new Zt;Qt.constructor=Jt,Yt(Qt,Xt.prototype),Qt.isPureReactComponent=!0;var ei=Array.isArray,ti=Object.prototype.hasOwnProperty,ii={current:null},si={key:!0,ref:!0,__self:!0,__source:!0};function ri(e,t,i){var s,r={},n=null,o=null;if(null!=t)for(s in void 0!==t.ref&&(o=t.ref),void 0!==t.key&&(n=""+t.key),t)ti.call(t,s)&&!si.hasOwnProperty(s)&&(r[s]=t[s]);var a=arguments.length-2;if(1===a)r.children=i;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];r.children=l}if(e&&e.defaultProps)for(s in a=e.defaultProps)void 0===r[s]&&(r[s]=a[s]);return{$$typeof:At,type:e,key:n,ref:o,props:r,_owner:ii.current}}function ni(e){return"object"==typeof e&&null!==e&&e.$$typeof===At}var oi=/\/+/g;function ai(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function li(e,t,i,s,r){var n=typeof e;"undefined"!==n&&"boolean"!==n||(e=null);var o=!1;if(null===e)o=!0;else switch(n){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case At:case Tt:o=!0}}if(o)return r=r(o=e),e=""===s?"."+ai(o,0):s,ei(r)?(i="",null!=e&&(i=e.replace(oi,"$&/")+"/"),li(r,t,i,"",function(e){return e})):null!=r&&(ni(r)&&(r=function(e,t){return{$$typeof:At,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(r,i+(!r.key||o&&o.key===r.key?"":(""+r.key).replace(oi,"$&/")+"/")+e)),t.push(r)),1;if(o=0,s=""===s?".":s+":",ei(e))for(var a=0;a<e.length;a++){var l=s+ai(n=e[a],a);o+=li(n,t,i,l,r)}else if(l=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=qt&&e[qt]||e["@@iterator"])?e:null}(e),"function"==typeof l)for(e=l.call(e),a=0;!(n=e.next()).done;)o+=li(n=n.value,t,i,l=s+ai(n,a++),r);else if("object"===n)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function ci(e,t,i){if(null==e)return e;var s=[],r=0;return li(e,s,"","",function(e){return t.call(i,e,r++)}),s}function hi(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var ui={current:null},di={transition:null},fi={ReactCurrentDispatcher:ui,ReactCurrentBatchConfig:di,ReactCurrentOwner:ii};function pi(){throw Error("act(...) is not supported in production builds of React.")}Rt.Children={map:ci,forEach:function(e,t,i){ci(e,function(){t.apply(this,arguments)},i)},count:function(e){var t=0;return ci(e,function(){t++}),t},toArray:function(e){return ci(e,function(e){return e})||[]},only:function(e){if(!ni(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},Rt.Component=Xt,Rt.Fragment=zt,Rt.Profiler=It,Rt.PureComponent=Jt,Rt.StrictMode=Ot,Rt.Suspense=Kt,Rt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=fi,Rt.act=pi,Rt.cloneElement=function(e,t,i){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var s=Yt({},e.props),r=e.key,n=e.ref,o=e._owner;if(null!=t){if(void 0!==t.ref&&(n=t.ref,o=ii.current),void 0!==t.key&&(r=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)ti.call(t,l)&&!si.hasOwnProperty(l)&&(s[l]=void 0===t[l]&&void 0!==a?a[l]:t[l])}var l=arguments.length-2;if(1===l)s.children=i;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];s.children=a}return{$$typeof:At,type:e.type,key:r,ref:n,props:s,_owner:o}},Rt.createContext=function(e){return(e={$$typeof:Ht,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:Ft,_context:e},e.Consumer=e},Rt.createElement=ri,Rt.createFactory=function(e){var t=ri.bind(null,e);return t.type=e,t},Rt.createRef=function(){return{current:null}},Rt.forwardRef=function(e){return{$$typeof:Wt,render:e}},Rt.isValidElement=ni,Rt.lazy=function(e){return{$$typeof:$t,_payload:{_status:-1,_result:e},_init:hi}},Rt.memo=function(e,t){return{$$typeof:Ut,type:e,compare:void 0===t?null:t}},Rt.startTransition=function(e){var t=di.transition;di.transition={};try{e()}finally{di.transition=t}},Rt.unstable_act=pi,Rt.useCallback=function(e,t){return ui.current.useCallback(e,t)},Rt.useContext=function(e){return ui.current.useContext(e)},Rt.useDebugValue=function(){},Rt.useDeferredValue=function(e){return ui.current.useDeferredValue(e)},Rt.useEffect=function(e,t){return ui.current.useEffect(e,t)},Rt.useId=function(){return ui.current.useId()},Rt.useImperativeHandle=function(e,t,i){return ui.current.useImperativeHandle(e,t,i)},Rt.useInsertionEffect=function(e,t){return ui.current.useInsertionEffect(e,t)},Rt.useLayoutEffect=function(e,t){return ui.current.useLayoutEffect(e,t)},Rt.useMemo=function(e,t){return ui.current.useMemo(e,t)},Rt.useReducer=function(e,t,i){return ui.current.useReducer(e,t,i)},Rt.useRef=function(e){return ui.current.useRef(e)},Rt.useState=function(e){return ui.current.useState(e)},Rt.useSyncExternalStore=function(e,t,i){return ui.current.useSyncExternalStore(e,t,i)},Rt.useTransition=function(){return ui.current.useTransition()},Rt.version="18.3.1",Pt.exports=Rt;var gi=Pt.exports;const vi=Et(gi);
3
3
  /**
4
4
  * @license React
5
5
  * react-jsx-runtime.production.min.js
@@ -8,7 +8,7 @@ var e,t,i,s,r,n,o,a,l,c,h,u,d,f,p,g,v,m,_,b,x,y,w,S,k,C,j,N,M,E,B,D,L,R,P,A,T,z,
8
8
  *
9
9
  * This source code is licensed under the MIT license found in the
10
10
  * LICENSE file in the root directory of this source tree.
11
- */var mi=gi,_i=Symbol.for("react.element"),bi=Symbol.for("react.fragment"),xi=Object.prototype.hasOwnProperty,yi=mi.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,wi={key:!0,ref:!0,__self:!0,__source:!0};function Si(e,t,i){var s,r={},n=null,o=null;for(s in void 0!==i&&(n=""+i),void 0!==t.key&&(n=""+t.key),void 0!==t.ref&&(o=t.ref),t)xi.call(t,s)&&!wi.hasOwnProperty(s)&&(r[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps)void 0===r[s]&&(r[s]=t[s]);return{$$typeof:_i,type:e,key:n,ref:o,props:r,_owner:yi.current}}Lt.Fragment=bi,Lt.jsx=Si,Lt.jsxs=Si,Dt.exports=Lt;var ki=Dt.exports;function Ci(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];throw new Error("number"==typeof e?"[MobX] minified error nr: "+e+(i.length?" "+i.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var ji={};function Ni(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:ji}var Mi=Object.assign,Ei=Object.getOwnPropertyDescriptor,Bi=Object.defineProperty,Di=Object.prototype,Li=[];Object.freeze(Li);var Ri={};Object.freeze(Ri);var Pi="undefined"!=typeof Proxy,Ai=Object.toString();function Ti(){Pi||Ci("Proxy not available")}function zi(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var Oi=function(){};function Ii(e){return"function"==typeof e}function Fi(e){switch(typeof e){case"string":case"symbol":case"number":return!0}return!1}function Hi(e){return null!==e&&"object"==typeof e}function Wi(e){if(!Hi(e))return!1;var t=Object.getPrototypeOf(e);if(null==t)return!0;var i=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i.toString()===Ai}function Ki(e){var t=null==e?void 0:e.constructor;return!!t&&("GeneratorFunction"===t.name||"GeneratorFunction"===t.displayName)}function Ui(e,t,i){Bi(e,t,{enumerable:!1,writable:!0,configurable:!0,value:i})}function qi(e,t,i){Bi(e,t,{enumerable:!1,writable:!1,configurable:!0,value:i})}function $i(e,t){var i="isMobX"+e;return t.prototype[i]=!0,function(e){return Hi(e)&&!0===e[i]}}function Vi(e){return null!=e&&"[object Map]"===Object.prototype.toString.call(e)}function Yi(e){return null!=e&&"[object Set]"===Object.prototype.toString.call(e)}var Gi=void 0!==Object.getOwnPropertySymbols;var Xi="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:Gi?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function Ji(e){return null===e?null:"object"==typeof e?""+e:e}function Zi(e,t){return Di.hasOwnProperty.call(e,t)}var Qi=Object.getOwnPropertyDescriptors||function(e){var t={};return Xi(e).forEach(function(i){t[i]=Ei(e,i)}),t};function es(e,t){return!!(e&t)}function ts(e,t,i){return i?e|=t:e&=~t,e}function is(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,s=Array(t);i<t;i++)s[i]=e[i];return s}function ss(e,t,i){return t&&function(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,hs(s.key),s)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function rs(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(i)return(i=i.call(e)).next.bind(i);if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return is(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?is(e,t):void 0}}(e))||t){i&&(e=i);var s=0;return function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ns(){return ns=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},ns.apply(null,arguments)}function os(e){return(os=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function as(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,cs(e,t)}function ls(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ls=function(){return!!e})()}function cs(e,t){return(cs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function hs(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var s=i.call(e,t);if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}function us(e){var t="function"==typeof Map?new Map:void 0;return us=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return function(e,t,i){if(ls())return Reflect.construct.apply(null,arguments);var s=[null];s.push.apply(s,t);var r=new(e.bind.apply(e,s));return i&&cs(r,i.prototype),r}(e,arguments,os(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),cs(i,e)},us(e)}var ds=Symbol("mobx-stored-annotations");function fs(e){return Object.assign(function(t,i){if(gs(i))return e.decorate_20223_(t,i);ps(t,i,e)},e)}function ps(e,t,i){Zi(e,ds)||Ui(e,ds,ns({},e[ds])),function(e){return e.annotationType_===Ss}(i)||(e[ds][t]=i)}function gs(e){return"object"==typeof e&&"string"==typeof e.kind}var vs=Symbol("mobx administration"),ms=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=xr.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(e){return e()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(e){return e()})},t.reportObserved=function(){return qr(this)},t.reportChanged=function(){Kr(),$r(this),Ur()},t.toString=function(){return this.name_},ss(e,[{key:"isBeingObserved",get:function(){return es(this.flags_,e.isBeingObservedMask_)},set:function(t){this.flags_=ts(this.flags_,e.isBeingObservedMask_,t)}},{key:"isPendingUnobservation",get:function(){return es(this.flags_,e.isPendingUnobservationMask_)},set:function(t){this.flags_=ts(this.flags_,e.isPendingUnobservationMask_,t)}},{key:"diffValue",get:function(){return es(this.flags_,e.diffValueMask_)?1:0},set:function(t){this.flags_=ts(this.flags_,e.diffValueMask_,1===t)}}])}();ms.isBeingObservedMask_=1,ms.isPendingUnobservationMask_=2,ms.diffValueMask_=4;var _s=$i("Atom",ms);function bs(e,t,i){void 0===t&&(t=Oi),void 0===i&&(i=Oi);var s,r=new ms(e);return t!==Oi&&bn(vn,r,t,s),i!==Oi&&_n(r,i),r}var xs={structural:function(e,t){return To(e,t)},default:function(e,t){return Object.is?Object.is(e,t):e===t?0!==e||1/e==1/t:e!=e&&t!=t}};function ys(e,t,i){return Dn(e)?e:Array.isArray(e)?nr.array(e,{name:i}):Wi(e)?nr.object(e,void 0,{name:i}):Vi(e)?nr.map(e,{name:i}):Yi(e)?nr.set(e,{name:i}):"function"!=typeof e||un(e)||Bn(e)?e:Ki(e)?Mn(e):cn(i,e)}function ws(e){return e}var Ss="override";function ks(e,t){return{annotationType_:e,options_:t,make_:Cs,extend_:js,decorate_20223_:Ns}}function Cs(e,t,i,s){var r;if(null!=(r=this.options_)&&r.bound)return null===this.extend_(e,t,i,!1)?0:1;if(s===e.target_)return null===this.extend_(e,t,i,!1)?0:2;if(un(i.value))return 1;var n=Ms(e,this,t,i,!1);return Bi(s,t,n),2}function js(e,t,i,s){var r=Ms(e,this,t,i);return e.defineProperty_(t,r,s)}function Ns(e,t){var i,s=t.kind,r=t.name,n=t.addInitializer,o=this,a=function(e){var t,i,s,n;return pr(null!=(t=null==(i=o.options_)?void 0:i.name)?t:r.toString(),e,null!=(s=null==(n=o.options_)?void 0:n.autoAction)&&s)};return"field"==s?function(e){var t,i=e;return un(i)||(i=a(i)),null!=(t=o.options_)&&t.bound&&((i=i.bind(this)).isMobxAction=!0),i}:"method"==s?(un(e)||(e=a(e)),null!=(i=this.options_)&&i.bound&&n(function(){var e=this,t=e[r].bind(e);t.isMobxAction=!0,e[r]=t}),e):void Ci("Cannot apply '"+o.annotationType_+"' to '"+String(r)+"' (kind: "+s+"):\n'"+o.annotationType_+"' can only be used on properties with a function value.")}function Ms(e,t,i,s,r){var n,o,a,l,c,h,u,d;void 0===r&&(r=Ir.safeDescriptors),d=s,t.annotationType_,d.value;var f,p=s.value;null!=(n=t.options_)&&n.bound&&(p=p.bind(null!=(f=e.proxy_)?f:e.target_));return{value:pr(null!=(o=null==(a=t.options_)?void 0:a.name)?o:i.toString(),p,null!=(l=null==(c=t.options_)?void 0:c.autoAction)&&l,null!=(h=t.options_)&&h.bound?null!=(u=e.proxy_)?u:e.target_:void 0),configurable:!r||e.isPlainObject_,enumerable:!1,writable:!r}}function Es(e,t){return{annotationType_:e,options_:t,make_:Bs,extend_:Ds,decorate_20223_:Ls}}function Bs(e,t,i,s){var r;if(s===e.target_)return null===this.extend_(e,t,i,!1)?0:2;if(null!=(r=this.options_)&&r.bound&&(!Zi(e.target_,t)||!Bn(e.target_[t]))&&null===this.extend_(e,t,i,!1))return 0;if(Bn(i.value))return 1;var n=Rs(e,this,t,i,!1,!1);return Bi(s,t,n),2}function Ds(e,t,i,s){var r,n=Rs(e,this,t,i,null==(r=this.options_)?void 0:r.bound);return e.defineProperty_(t,n,s)}function Ls(e,t){var i,s=t.name,r=t.addInitializer;return Bn(e)||(e=Mn(e)),null!=(i=this.options_)&&i.bound&&r(function(){var e=this,t=e[s].bind(e);t.isMobXFlow=!0,e[s]=t}),e}function Rs(e,t,i,s,r,n){var o;void 0===n&&(n=Ir.safeDescriptors),o=s,t.annotationType_,o.value;var a,l=s.value;(Bn(l)||(l=Mn(l)),r)&&((l=l.bind(null!=(a=e.proxy_)?a:e.target_)).isMobXFlow=!0);return{value:l,configurable:!n||e.isPlainObject_,enumerable:!1,writable:!n}}function Ps(e,t){return{annotationType_:e,options_:t,make_:As,extend_:Ts,decorate_20223_:zs}}function As(e,t,i){return null===this.extend_(e,t,i,!1)?0:1}function Ts(e,t,i,s){var r;return r=i,this.annotationType_,r.get,e.defineComputedProperty_(t,ns({},this.options_,{get:i.get,set:i.set}),s)}function zs(e,t){var i,s=this,r=t.name;function n(t,i){var n=ns({},s.options_,{get:e,context:t});return n.name||(n.name="ObservableObject."+r.toString()),new br(n)}return(0,t.addInitializer)(function(){var t,i=go(this)[vs],s=this,o=i.values_.get(r);o instanceof br&&o.derivation!==e&&i.values_.delete(r),(null!=(t=i.lazyComputedKeys_)?t:i.lazyComputedKeys_=new Map).set(r,function(){return n(s)})}),function(){var t=this[vs],s=t.values_.get(r);if(s instanceof br&&s.derivation!==e){var o,a,l=null==(o=i)?void 0:o.get(this);if(!l)l=n(this),(null!=(a=i)?a:i=new WeakMap).set(this,l);return l.get()}return t.getObservablePropValue_(r)}}function Os(e,t){return{annotationType_:e,options_:t,make_:Is,extend_:Fs,decorate_20223_:Hs}}function Is(e,t,i){return null===this.extend_(e,t,i,!1)?0:1}function Fs(e,t,i,s){var r,n;return this.annotationType_,e.defineObservableProperty_(t,i.value,null!=(r=null==(n=this.options_)?void 0:n.enhancer)?r:ys,s)}function Hs(e,t){var i=this,s=t.kind,r=t.name;if("accessor"===s)return{get:function(){var t;return(null!=(t=this[vs])?t:n(this,e.get.call(this))).getObservablePropValue_(r)},set:function(e){var t;return(null!=(t=this[vs])?t:n(this,e)).setObservablePropValue_(r,e)},init:function(e){return n(this,e),e}};function n(e,t){var s,n=go(e)[vs];return(null!=(s=n.lazyObservableKeys_)?s:n.lazyObservableKeys_=new Map).set(r,function(){var e,s;return new _r(t,null!=(e=null==(s=i.options_)?void 0:s.enhancer)?e:ys,"ObservableObject."+r.toString(),!1)}),n}}var Ws="true",Ks=Us();function Us(e){return{annotationType_:Ws,options_:e,make_:qs,extend_:$s,decorate_20223_:Vs}}function qs(e,t,i,s){var r,n,o,a;if(i.get)return cr.make_(e,t,i,s);if(i.set){var l=un(i.set)?i.set:pr(t.toString(),i.set);return s===e.target_?null===e.defineProperty_(t,{configurable:!Ir.safeDescriptors||e.isPlainObject_,set:l})?0:2:(Bi(s,t,{configurable:!0,set:l}),2)}if(s!==e.target_&&"function"==typeof i.value)return Ki(i.value)?(null!=(a=this.options_)&&a.autoBind?Mn.bound:Mn).make_(e,t,i,s):(null!=(o=this.options_)&&o.autoBind?cn.bound:cn).make_(e,t,i,s);var c,h=!1===(null==(r=this.options_)?void 0:r.deep)?nr.ref:nr;"function"==typeof i.value&&null!=(n=this.options_)&&n.autoBind&&(i.value=i.value.bind(null!=(c=e.proxy_)?c:e.target_));return h.make_(e,t,i,s)}function $s(e,t,i,s){var r,n,o;if(i.get)return cr.extend_(e,t,i,s);if(i.set)return e.defineProperty_(t,{configurable:!Ir.safeDescriptors||e.isPlainObject_,set:pr(t.toString(),i.set)},s);"function"==typeof i.value&&null!=(r=this.options_)&&r.autoBind&&(i.value=i.value.bind(null!=(o=e.proxy_)?o:e.target_));return(!1===(null==(n=this.options_)?void 0:n.deep)?nr.ref:nr).extend_(e,t,i,s)}function Vs(e,t){Ci("'"+this.annotationType_+"' cannot be used as a decorator")}var Ys={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};function Gs(e){return e||Ys}Object.freeze(Ys);var Xs=Os("observable"),Js=Os("observable.ref",{enhancer:ws}),Zs=Os("observable.shallow",{enhancer:function(e,t,i){return null==e||_o(e)||eo(e)||no(e)||co(e)?e:Array.isArray(e)?nr.array(e,{name:i,deep:!1}):Wi(e)?nr.object(e,void 0,{name:i,deep:!1}):Vi(e)?nr.map(e,{name:i,deep:!1}):Yi(e)?nr.set(e,{name:i,deep:!1}):void 0}}),Qs=Os("observable.struct",{enhancer:function(e,t){return To(e,t)?t:e}}),er=fs(Xs);function tr(e){return!0===e.deep?ys:!1===e.deep?ws:(t=e.defaultDecorator)&&null!=(i=null==(s=t.options_)?void 0:s.enhancer)?i:ys;var t,i,s}function ir(e,t,i){return gs(t)?Xs.decorate_20223_(e,t):Fi(t)?void ps(e,t,Xs):Dn(e)?e:Wi(e)?nr.object(e,t,i):Array.isArray(e)?nr.array(e,t):Vi(e)?nr.map(e,t):Yi(e)?nr.set(e,t):"object"==typeof e&&null!==e?e:nr.box(e,t)}Mi(ir,er);var sr,rr,nr=Mi(ir,{box:function(e,t){var i=Gs(t);return new _r(e,tr(i),i.name,!0,i.equals)},array:function(e,t){var i=Gs(t);return(!1===Ir.useProxies||!1===i.proxy?Bo:Vn)(e,tr(i),i.name)},map:function(e,t){var i=Gs(t);return new ro(e,tr(i),i.name)},set:function(e,t){var i=Gs(t);return new lo(e,tr(i),i.name)},object:function(e,t,i){return Ro(function(){return wn(!1===Ir.useProxies||!1===(null==i?void 0:i.proxy)?go({},i):function(e,t){var i,s;return Ti(),e=go(e,t),null!=(s=(i=e[vs]).proxy_)?s:i.proxy_=new Proxy(e,Pn)}({},i),e,t)})},ref:fs(Js),shallow:fs(Zs),deep:er,struct:fs(Qs)}),or="computed",ar=Ps(or),lr=Ps("computed.struct",{equals:xs.structural}),cr=function(e,t){if(gs(t))return ar.decorate_20223_(e,t);if(Fi(t))return ps(e,t,ar);if(Wi(e))return fs(Ps(or,e));var i=Wi(t)?t:{};return i.get=e,i.name||(i.name=e.name||""),new br(i)};Object.assign(cr,ar),cr.struct=fs(lr);var hr=0,ur=1,dr=null!=(sr=null==(rr=Ei(function(){},"name"))?void 0:rr.configurable)&&sr,fr={value:"action",configurable:!0,writable:!1,enumerable:!1};function pr(e,t,i,s){function r(){return gr(e,i,t,s||this,arguments)}return void 0===i&&(i=!1),r.isMobxAction=!0,r.toString=function(){return t.toString()},dr&&(fr.value=e,Bi(r,"name",fr)),r}function gr(e,t,i,s,r){var n=function(e,t){var i=!1,s=0,r=Ir.trackingDerivation,n=!t||!r;Kr();var o=Ir.allowStateChanges;n&&(Dr(),o=vr(!0));var a=Rr(!0),l={runAsAction_:n,prevDerivation_:r,prevAllowStateChanges_:o,prevAllowStateReads_:a,notifySpy_:i,startTime_:s,actionId_:ur++,parentActionId_:hr};return hr=l.actionId_,l}(0,t);try{return i.apply(s,r)}catch(o){throw n.error_=o,o}finally{!function(e){hr!==e.actionId_&&Ci(30);hr=e.parentActionId_,void 0!==e.error_&&(Ir.suppressReactionErrors=!0);mr(e.prevAllowStateChanges_),Pr(e.prevAllowStateReads_),Ur(),e.runAsAction_&&Lr(e.prevDerivation_);Ir.suppressReactionErrors=!1}(n)}}function vr(e){var t=Ir.allowStateChanges;return Ir.allowStateChanges=e,t}function mr(e){Ir.allowStateChanges=e}var _r=function(e){function t(t,i,s,r,n){var o;return void 0===s&&(s="ObservableValue"),void 0===n&&(n=xs.default),(o=e.call(this,s)||this).enhancer=void 0,o.name_=void 0,o.equals=void 0,o.hasUnreportedChange_=!1,o.interceptors_=void 0,o.changeListeners_=void 0,o.value_=void 0,o.dehancer=void 0,o.enhancer=i,o.name_=s,o.equals=n,o.value_=i(t,void 0,s),o}as(t,e);var i=t.prototype;return i.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},i.set=function(e){this.value_,(e=this.prepareNewValue_(e))!==Ir.UNCHANGED&&this.setNewValue_(e)},i.prepareNewValue_=function(e){if(An(this)){var t=zn(this,{object:this,type:Un,newValue:e});if(!t)return Ir.UNCHANGED;e=t.newValue}return e=this.enhancer(e,this.value_,this.name_),this.equals(this.value_,e)?Ir.UNCHANGED:e},i.setNewValue_=function(e){var t=this.value_;this.value_=e,this.reportChanged(),On(this)&&Fn(this,{type:Un,object:this,newValue:e,oldValue:t})},i.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},i.intercept_=function(e){return Tn(this,e)},i.observe_=function(e,t){return t&&e({observableKind:"value",debugObjectName:this.name_,object:this,type:Un,newValue:this.value_,oldValue:void 0}),In(this,e)},i.raw=function(){return this.value_},i.toJSON=function(){return this.get()},i.toString=function(){return this.name_+"["+this.value_+"]"},i.valueOf=function(){return Ji(this.get())},i[Symbol.toPrimitive]=function(){return this.valueOf()},t}(ms),br=function(){function e(e){this.dependenciesState_=xr.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=xr.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new Cr(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=wr.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,e.get||Ci(31),this.derivation=e.get,this.name_=e.name||"ComputedValue",e.set&&(this.setter_=pr("ComputedValue-setter",e.set)),this.equals_=e.equals||(e.compareStructural||e.struct?xs.structural:xs.default),this.scope_=e.context,this.requiresReaction_=e.requiresReaction,this.keepAlive_=!!e.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){!function(e){if(e.lowestObserverState_!==xr.UP_TO_DATE_)return;e.lowestObserverState_=xr.POSSIBLY_STALE_,e.observers_.forEach(function(e){e.dependenciesState_===xr.UP_TO_DATE_&&(e.dependenciesState_=xr.POSSIBLY_STALE_,e.onBecomeStale_())})}(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(e){return e()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(e){return e()})},t.get=function(){if(this.isComputing&&Ci(32,this.name_,this.derivation),0!==Ir.inBatch||0!==this.observers_.size||this.keepAlive_){if(qr(this),Nr(this)){var e=Ir.trackingContext;this.keepAlive_&&!e&&(Ir.trackingContext=this),this.trackAndCompute()&&function(e){if(e.lowestObserverState_===xr.STALE_)return;e.lowestObserverState_=xr.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===xr.POSSIBLY_STALE_?t.dependenciesState_=xr.STALE_:t.dependenciesState_===xr.UP_TO_DATE_&&(e.lowestObserverState_=xr.UP_TO_DATE_)})}(this),Ir.trackingContext=e}}else Nr(this)&&(this.warnAboutUntrackedRead_(),Kr(),this.value_=this.computeValue_(!1),Ur());var t=this.value_;if(jr(t))throw t.cause;return t},t.set=function(e){if(this.setter_){this.isRunningSetter&&Ci(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,e)}finally{this.isRunningSetter=!1}}else Ci(34,this.name_)},t.trackAndCompute=function(){var e=this.value_,t=this.dependenciesState_===xr.NOT_TRACKING_,i=this.computeValue_(!0),s=t||jr(e)||jr(i)||!this.equals_(e,i);return s&&(this.value_=i),s},t.computeValue_=function(e){this.isComputing=!0;var t,i=vr(!1);if(e)t=Mr(this,this.derivation,this.scope_);else if(!0===Ir.disableErrorBoundaries)t=this.derivation.call(this.scope_);else try{t=this.derivation.call(this.scope_)}catch(s){t=new Cr(s)}return mr(i),this.isComputing=!1,t},t.suspend_=function(){this.keepAlive_||(Er(this),this.value_=void 0)},t.observe_=function(e,t){var i=this,s=!0,r=void 0;return dn(function(){var n=i.get();if(!s||t){var o=Dr();e({observableKind:"computed",debugObjectName:i.name_,type:Un,object:i,newValue:n,oldValue:r}),Lr(o)}s=!1,r=n})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return Ji(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},ss(e,[{key:"isComputing",get:function(){return es(this.flags_,e.isComputingMask_)},set:function(t){this.flags_=ts(this.flags_,e.isComputingMask_,t)}},{key:"isRunningSetter",get:function(){return es(this.flags_,e.isRunningSetterMask_)},set:function(t){this.flags_=ts(this.flags_,e.isRunningSetterMask_,t)}},{key:"isBeingObserved",get:function(){return es(this.flags_,e.isBeingObservedMask_)},set:function(t){this.flags_=ts(this.flags_,e.isBeingObservedMask_,t)}},{key:"isPendingUnobservation",get:function(){return es(this.flags_,e.isPendingUnobservationMask_)},set:function(t){this.flags_=ts(this.flags_,e.isPendingUnobservationMask_,t)}},{key:"diffValue",get:function(){return es(this.flags_,e.diffValueMask_)?1:0},set:function(t){this.flags_=ts(this.flags_,e.diffValueMask_,1===t)}}])}();br.isComputingMask_=1,br.isRunningSetterMask_=2,br.isBeingObservedMask_=4,br.isPendingUnobservationMask_=8,br.diffValueMask_=16;var xr,yr,wr,Sr,kr=$i("ComputedValue",br);(yr=xr||(xr={}))[yr.NOT_TRACKING_=-1]="NOT_TRACKING_",yr[yr.UP_TO_DATE_=0]="UP_TO_DATE_",yr[yr.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",yr[yr.STALE_=2]="STALE_",(Sr=wr||(wr={}))[Sr.NONE=0]="NONE",Sr[Sr.LOG=1]="LOG",Sr[Sr.BREAK=2]="BREAK";var Cr=function(e){this.cause=void 0,this.cause=e};function jr(e){return e instanceof Cr}function Nr(e){switch(e.dependenciesState_){case xr.UP_TO_DATE_:return!1;case xr.NOT_TRACKING_:case xr.STALE_:return!0;case xr.POSSIBLY_STALE_:for(var t=Rr(!0),i=Dr(),s=e.observing_,r=s.length,n=0;n<r;n++){var o=s[n];if(kr(o)){if(Ir.disableErrorBoundaries)o.get();else try{o.get()}catch(a){return Lr(i),Pr(t),!0}if(e.dependenciesState_===xr.STALE_)return Lr(i),Pr(t),!0}}return Ar(e),Lr(i),Pr(t),!1}}function Mr(e,t,i){var s=Rr(!0);Ar(e),e.newObserving_=new Array(0===e.runId_?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++Ir.runId;var r,n=Ir.trackingDerivation;if(Ir.trackingDerivation=e,Ir.inBatch++,!0===Ir.disableErrorBoundaries)r=t.call(i);else try{r=t.call(i)}catch(o){r=new Cr(o)}return Ir.inBatch--,Ir.trackingDerivation=n,function(e){for(var t=e.observing_,i=e.observing_=e.newObserving_,s=xr.UP_TO_DATE_,r=0,n=e.unboundDepsCount_,o=0;o<n;o++){var a=i[o];0===a.diffValue&&(a.diffValue=1,r!==o&&(i[r]=a),r++),a.dependenciesState_>s&&(s=a.dependenciesState_)}i.length=r,e.newObserving_=null,n=t.length;for(;n--;){var l=t[n];0===l.diffValue&&Hr(l,e),l.diffValue=0}for(;r--;){var c=i[r];1===c.diffValue&&(c.diffValue=0,Fr(c,e))}s!==xr.UP_TO_DATE_&&(e.dependenciesState_=s,e.onBecomeStale_())}(e),Pr(s),r}function Er(e){var t=e.observing_;e.observing_=[];for(var i=t.length;i--;)Hr(t[i],e);e.dependenciesState_=xr.NOT_TRACKING_}function Br(e){var t=Dr();try{return e()}finally{Lr(t)}}function Dr(){var e=Ir.trackingDerivation;return Ir.trackingDerivation=null,e}function Lr(e){Ir.trackingDerivation=e}function Rr(e){var t=Ir.allowStateReads;return Ir.allowStateReads=e,t}function Pr(e){Ir.allowStateReads=e}function Ar(e){if(e.dependenciesState_!==xr.UP_TO_DATE_){e.dependenciesState_=xr.UP_TO_DATE_;for(var t=e.observing_,i=t.length;i--;)t[i].lowestObserverState_=xr.UP_TO_DATE_}}var Tr=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},zr=!0,Or=!1,Ir=function(){var e=Ni();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(zr=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new Tr).version&&(zr=!1),zr?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Tr):(setTimeout(function(){Or||Ci(35)},1),new Tr)}();function Fr(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Hr(e,t){e.observers_.delete(t),0===e.observers_.size&&Wr(e)}function Wr(e){!1===e.isPendingUnobservation&&(e.isPendingUnobservation=!0,Ir.pendingUnobservations.push(e))}function Kr(){Ir.inBatch++}function Ur(){if(0===--Ir.inBatch){Xr();for(var e=Ir.pendingUnobservations,t=0;t<e.length;t++){var i=e[t];i.isPendingUnobservation=!1,0===i.observers_.size&&(i.isBeingObserved&&(i.isBeingObserved=!1,i.onBUO()),i instanceof br&&i.suspend_())}Ir.pendingUnobservations=[]}}function qr(e){var t=Ir.trackingDerivation;return null!==t?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&Ir.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(0===e.observers_.size&&Ir.inBatch>0&&Wr(e),!1)}function $r(e){e.lowestObserverState_!==xr.STALE_&&(e.lowestObserverState_=xr.STALE_,e.observers_.forEach(function(e){e.dependenciesState_===xr.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=xr.STALE_}))}var Vr=function(){function e(e,t,i,s){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=xr.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=wr.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=i,this.requiresObservable_=s}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,Ir.pendingReactions.push(this),Xr())},t.runReaction_=function(){if(!this.isDisposed){Kr(),this.isScheduled=!1;var e=Ir.trackingContext;if(Ir.trackingContext=this,Nr(this)){this.isTrackPending=!0;try{this.onInvalidate_()}catch(t){this.reportExceptionInDerivation_(t)}}Ir.trackingContext=e,Ur()}},t.track=function(e){if(!this.isDisposed){Kr(),this.isRunning=!0;var t=Ir.trackingContext;Ir.trackingContext=this;var i=Mr(this,e,void 0);Ir.trackingContext=t,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Er(this),jr(i)&&this.reportExceptionInDerivation_(i.cause),Ur()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(Ir.disableErrorBoundaries)throw e;var i="[mobx] uncaught error in '"+this+"'";Ir.suppressReactionErrors||console.error(i,e),Ir.globalReactionErrorHandlers.forEach(function(i){return i(e,t)})}},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Kr(),Er(this),Ur()))},t.getDisposer_=function(e){var t=this,i=function i(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",i)};return null==e||null==e.addEventListener||e.addEventListener("abort",i),i[vs]=this,"dispose"in Symbol&&"symbol"==typeof Symbol.dispose&&(i[Symbol.dispose]=i),i},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){},ss(e,[{key:"isDisposed",get:function(){return es(this.flags_,e.isDisposedMask_)},set:function(t){this.flags_=ts(this.flags_,e.isDisposedMask_,t)}},{key:"isScheduled",get:function(){return es(this.flags_,e.isScheduledMask_)},set:function(t){this.flags_=ts(this.flags_,e.isScheduledMask_,t)}},{key:"isTrackPending",get:function(){return es(this.flags_,e.isTrackPendingMask_)},set:function(t){this.flags_=ts(this.flags_,e.isTrackPendingMask_,t)}},{key:"isRunning",get:function(){return es(this.flags_,e.isRunningMask_)},set:function(t){this.flags_=ts(this.flags_,e.isRunningMask_,t)}},{key:"diffValue",get:function(){return es(this.flags_,e.diffValueMask_)?1:0},set:function(t){this.flags_=ts(this.flags_,e.diffValueMask_,1===t)}}])}();Vr.isDisposedMask_=1,Vr.isScheduledMask_=2,Vr.isTrackPendingMask_=4,Vr.isRunningMask_=8,Vr.diffValueMask_=16;var Yr=100,Gr=function(e){return e()};function Xr(){Ir.inBatch>0||Ir.isRunningReactions||Gr(Jr)}function Jr(){Ir.isRunningReactions=!0;for(var e=Ir.pendingReactions,t=0;e.length>0;){++t===Yr&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var i=e.splice(0),s=0,r=i.length;s<r;s++)i[s].runReaction_()}Ir.isRunningReactions=!1}var Zr=$i("Reaction",Vr);var Qr="action",en="autoAction",tn="<unnamed action>",sn=ks(Qr),rn=ks("action.bound",{bound:!0}),nn=ks(en,{autoAction:!0}),on=ks("autoAction.bound",{autoAction:!0,bound:!0});function an(e){return function(t,i){return Ii(t)?pr(t.name||tn,t,e):Ii(i)?pr(t,i,e):gs(i)?(e?nn:sn).decorate_20223_(t,i):Fi(i)?ps(t,i,e?nn:sn):Fi(t)?fs(ks(e?en:Qr,{name:t,autoAction:e})):void 0}}var ln=an(!1);Object.assign(ln,sn);var cn=an(!0);function hn(e){return gr(e.name,!1,e,this,void 0)}function un(e){return Ii(e)&&!0===e.isMobxAction}function dn(e,t){var i,s,r,n;void 0===t&&(t=Ri);var o,a=null!=(i=null==(s=t)?void 0:s.name)?i:"Autorun";if(!t.scheduler&&!t.delay)o=new Vr(a,function(){this.track(h)},t.onError,t.requiresObservable);else{var l=pn(t),c=!1;o=new Vr(a,function(){c||(c=!0,l(function(){c=!1,o.isDisposed||o.track(h)}))},t.onError,t.requiresObservable)}function h(){e(o)}return null!=(r=t)&&null!=(r=r.signal)&&r.aborted||o.schedule_(),o.getDisposer_(null==(n=t)?void 0:n.signal)}Object.assign(cn,nn),ln.bound=fs(rn),cn.bound=fs(on);var fn=function(e){return e()};function pn(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:fn}function gn(e,t,i){var s,r,n;void 0===i&&(i=Ri);var o,a,l,c=null!=(s=i.name)?s:"Reaction",h=ln(c,i.onError?(o=i.onError,a=t,function(){try{return a.apply(this,arguments)}catch(e){o.call(this,e)}}):t),u=!i.scheduler&&!i.delay,d=pn(i),f=!0,p=!1,g=i.compareStructural?xs.structural:i.equals||xs.default,v=new Vr(c,function(){f||u?m():p||(p=!0,d(m))},i.onError,i.requiresObservable);function m(){if(p=!1,!v.isDisposed){var t=!1,s=l;v.track(function(){var i=function(e,t){var i=vr(e);try{return t()}finally{mr(i)}}(!1,function(){return e(v)});t=f||!g(l,i),l=i}),(f&&i.fireImmediately||!f&&t)&&h(l,s,v),f=!1}}return null!=(r=i)&&null!=(r=r.signal)&&r.aborted||v.schedule_(),v.getDisposer_(null==(n=i)?void 0:n.signal)}var vn="onBO",mn="onBUO";function _n(e,t,i){return bn(mn,e,t,i)}function bn(e,t,i,s){var r=Do(t),n=Ii(s)?s:i,o=e+"L";return r[o]?r[o].add(n):r[o]=new Set([n]),function(){var e=r[o];e&&(e.delete(n),0===e.size&&delete r[o])}}var xn="always";function yn(e){!0===e.isolateGlobalState&&function(){if((Ir.pendingReactions.length||Ir.inBatch||Ir.isRunningReactions)&&Ci(36),Or=!0,zr){var e=Ni();0===--e.__mobxInstanceCount&&(e.__mobxGlobals=void 0),Ir=new Tr}}();var t,i,s=e.useProxies,r=e.enforceActions;if(void 0!==s&&(Ir.useProxies=s===xn||"never"!==s&&"undefined"!=typeof Proxy),"ifavailable"===s&&(Ir.verifyProxies=!0),void 0!==r){var n=r===xn?xn:"observed"===r;Ir.enforceActions=n,Ir.allowStateChanges=!0!==n&&n!==xn}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(t){t in e&&(Ir[t]=!!e[t])}),Ir.allowStateReads=!Ir.observableRequiresReaction,e.reactionScheduler&&(t=e.reactionScheduler,i=Gr,Gr=function(e){return t(function(){return i(e)})})}function wn(e,t,i,s){var r=Qi(t);return Ro(function(){var t=go(e,s)[vs];Xi(r).forEach(function(e){t.extend_(e,r[e],!i||(!(e in i)||i[e]))})}),e}function Sn(e){var t,i={name:e.name_};return e.observing_&&e.observing_.length>0&&(i.dependencies=(t=e.observing_,Array.from(new Set(t))).map(Sn)),i}var kn=0,Cn=function(e){function t(){var i;return i=e.call(this,"FLOW_CANCELLED")||this,Object.setPrototypeOf(i,(this instanceof t?this.constructor:void 0).prototype),i.name="FlowCancellationError",i}return as(t,e),t.prototype.toString=function(){return"Error: "+this.message},t}(us(Error)),jn=Es("flow"),Nn=Es("flow.bound",{bound:!0}),Mn=Object.assign(function(e,t){if(gs(t))return jn.decorate_20223_(e,t);if(Fi(t))return ps(e,t,jn);var i=e,s=i.name||"<unnamed flow>",r=function(){var e,t=arguments,r=++kn,n=ln(s+" - runid: "+r+" - init",i).apply(this,t),o=void 0,a=new Promise(function(t,i){var a=0;function l(e){var t;o=void 0;try{t=ln(s+" - runid: "+r+" - yield "+a++,n.next).call(n,e)}catch(l){return i(l)}h(t)}function c(e){var t;o=void 0;try{t=ln(s+" - runid: "+r+" - yield "+a++,n.throw).call(n,e)}catch(l){return i(l)}h(t)}function h(e){if(!Ii(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(l,c);e.then(h,i)}e=i,l(void 0)});return a.cancel=ln(s+" - runid: "+r+" - cancel",function(){try{o&&En(o);var t=n.return(void 0),i=Promise.resolve(t.value);i.then(Oi,Oi),En(i),e(new Cn)}catch(s){e(s)}}),a};return r.isMobXFlow=!0,r},jn);function En(e){Ii(e.cancel)&&e.cancel()}function Bn(e){return!0===(null==e?void 0:e.isMobXFlow)}function Dn(e){return function(e){return!!e&&(_o(e)||!!e[vs]||_s(e)||Zr(e)||kr(e))}(e)}function Ln(e,t){void 0===t&&(t=void 0),Kr();try{return e.apply(t)}finally{Ur()}}function Rn(e){return e[vs]}Mn.bound=fs(Nn);var Pn={has:function(e,t){return Rn(e).has_(t)},get:function(e,t){return Rn(e).get_(t)},set:function(e,t,i){var s;return!!Fi(t)&&(null==(s=Rn(e).set_(t,i,!0))||s)},deleteProperty:function(e,t){var i;return!!Fi(t)&&(null==(i=Rn(e).delete_(t,!0))||i)},defineProperty:function(e,t,i){var s;return null==(s=Rn(e).defineProperty_(t,i))||s},ownKeys:function(e){return Rn(e).ownKeys_()},preventExtensions:function(e){Ci(13)}};function An(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function Tn(e,t){var i=e.interceptors_||(e.interceptors_=[]);return i.push(t),zi(function(){var e=i.indexOf(t);-1!==e&&i.splice(e,1)})}function zn(e,t){var i=Dr();try{for(var s=[].concat(e.interceptors_||[]),r=0,n=s.length;r<n&&((t=s[r](t))&&!t.type&&Ci(14),t);r++);return t}finally{Lr(i)}}function On(e){return void 0!==e.changeListeners_&&e.changeListeners_.length>0}function In(e,t){var i=e.changeListeners_||(e.changeListeners_=[]);return i.push(t),zi(function(){var e=i.indexOf(t);-1!==e&&i.splice(e,1)})}function Fn(e,t){var i=Dr(),s=e.changeListeners_;if(s){for(var r=0,n=(s=s.slice()).length;r<n;r++)s[r](t);Lr(i)}}var Hn=Symbol("mobx-keys");function Wn(e,t,i){return Wi(e)?wn(e,e,t,i):(Ro(function(){var s=go(e,i)[vs];if(!e[Hn]){var r=Object.getPrototypeOf(e),n=new Set([].concat(Xi(e),Xi(r)));n.delete("constructor"),n.delete(vs),Ui(r,Hn,n)}e[Hn].forEach(function(e){return s.make_(e,!t||(!(e in t)||t[e]))})}),e)}var Kn="splice",Un="update",qn={get:function(e,t){var i=e[vs];return t===vs?i:"length"===t?i.getArrayLength_():"string"!=typeof t||isNaN(t)?Zi(Yn,t)?Yn[t]:e[t]:i.get_(parseInt(t))},set:function(e,t,i){var s=e[vs];return"length"===t&&s.setArrayLength_(i),"symbol"==typeof t||isNaN(t)?e[t]=i:s.set_(parseInt(t),i),!0},preventExtensions:function(){Ci(15)}},$n=function(){function e(e,t,i,s){void 0===e&&(e="ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=i,this.legacyMode_=s,this.atom_=new ms(e),this.enhancer_=function(e,i){return t(e,i,"ObservableArray[..]")}}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.dehanceValues_=function(e){return void 0!==this.dehancer&&e.length>0?e.map(this.dehancer):e},t.intercept_=function(e){return Tn(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),In(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&Ci("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var i=new Array(e-t),s=0;s<e-t;s++)i[s]=void 0;this.spliceWithArray_(t,0,i)}else this.spliceWithArray_(e,t-e)},t.updateArrayLength_=function(e,t){e!==this.lastKnownLength_&&Ci(16),this.lastKnownLength_+=t,this.legacyMode_&&t>0&&Eo(e+t+1)},t.spliceWithArray_=function(e,t,i){var s=this;this.atom_;var r=this.values_.length;if(void 0===e?e=0:e>r?e=r:e<0&&(e=Math.max(0,r+e)),t=1===arguments.length?r-e:null==t?0:Math.max(0,Math.min(t,r-e)),void 0===i&&(i=Li),An(this)){var n=zn(this,{object:this.proxy_,type:Kn,index:e,removedCount:t,added:i});if(!n)return Li;t=n.removedCount,i=n.added}if(i=0===i.length?i:i.map(function(e){return s.enhancer_(e,void 0)}),this.legacyMode_){var o=i.length-t;this.updateArrayLength_(r,o)}var a=this.spliceItemsIntoValues_(e,t,i);return 0===t&&0===i.length||this.notifyArraySplice_(e,i,a),this.dehanceValues_(a)},t.spliceItemsIntoValues_=function(e,t,i){var s;if(i.length<1e4)return(s=this.values_).splice.apply(s,[e,t].concat(i));var r=this.values_.slice(e,e+t),n=this.values_.slice(e+t);this.values_.length+=i.length-t;for(var o=0;o<i.length;o++)this.values_[e+o]=i[o];for(var a=0;a<n.length;a++)this.values_[e+i.length+a]=n[a];return r},t.notifyArrayChildUpdate_=function(e,t,i){var s=!this.owned_&&!1,r=On(this),n=r||s?{observableKind:"array",object:this.proxy_,type:Un,debugObjectName:this.atom_.name_,index:e,newValue:t,oldValue:i}:null;this.atom_.reportChanged(),r&&Fn(this,n)},t.notifyArraySplice_=function(e,t,i){var s=!this.owned_&&!1,r=On(this),n=r||s?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Kn,index:e,removed:i,added:t,removedCount:i.length,addedCount:t.length}:null;this.atom_.reportChanged(),r&&Fn(this,n)},t.get_=function(e){if(!(this.legacyMode_&&e>=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var i=this.values_;if(this.legacyMode_&&e>i.length&&Ci(17,e,i.length),e<i.length){this.atom_;var s=i[e];if(An(this)){var r=zn(this,{type:Un,object:this.proxy_,index:e,newValue:t});if(!r)return;t=r.newValue}(t=this.enhancer_(t,s))!==s&&(i[e]=t,this.notifyArrayChildUpdate_(e,t,s))}else{for(var n=new Array(e+1-i.length),o=0;o<n.length-1;o++)n[o]=void 0;n[n.length-1]=t,this.spliceWithArray_(i.length,0,n)}},e}();function Vn(e,t,i,s){return void 0===i&&(i="ObservableArray"),void 0===s&&(s=!1),Ti(),Ro(function(){var r=new $n(i,t,s,!1);qi(r.values_,vs,r);var n=new Proxy(r.values_,qn);return r.proxy_=n,e&&e.length&&r.spliceWithArray_(0,0,e),n})}var Yn={clear:function(){return this.splice(0)},replace:function(e){var t=this[vs];return t.spliceWithArray_(0,t.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,t){for(var i=arguments.length,s=new Array(i>2?i-2:0),r=2;r<i;r++)s[r-2]=arguments[r];var n=this[vs];switch(arguments.length){case 0:return[];case 1:return n.spliceWithArray_(e);case 2:return n.spliceWithArray_(e,t)}return n.spliceWithArray_(e,t,s)},spliceWithArray:function(e,t,i){return this[vs].spliceWithArray_(e,t,i)},push:function(){for(var e=this[vs],t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];return e.spliceWithArray_(e.values_.length,0,i),e.values_.length},pop:function(){return this.splice(Math.max(this[vs].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[vs],t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];return e.spliceWithArray_(0,0,i),e.values_.length},reverse:function(){return Ir.trackingDerivation&&Ci(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){Ir.trackingDerivation&&Ci(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[vs],i=t.dehanceValues_(t.values_).indexOf(e);return i>-1&&(this.splice(i,1),!0)}};function Gn(e,t){"function"==typeof Array.prototype[e]&&(Yn[e]=t(e))}function Xn(e){return function(){var t=this[vs];t.atom_.reportObserved();var i=t.dehanceValues_(t.values_);return i[e].apply(i,arguments)}}function Jn(e){return function(t,i){var s=this,r=this[vs];return r.atom_.reportObserved(),r.dehanceValues_(r.values_)[e](function(e,r){return t.call(i,e,r,s)})}}function Zn(e){return function(){var t=this,i=this[vs];i.atom_.reportObserved();var s=i.dehanceValues_(i.values_),r=arguments[0];return arguments[0]=function(e,i,s){return r(e,i,s,t)},s[e].apply(s,arguments)}}Gn("at",Xn),Gn("concat",Xn),Gn("flat",Xn),Gn("includes",Xn),Gn("indexOf",Xn),Gn("join",Xn),Gn("lastIndexOf",Xn),Gn("slice",Xn),Gn("toString",Xn),Gn("toLocaleString",Xn),Gn("toSorted",Xn),Gn("toSpliced",Xn),Gn("with",Xn),Gn("every",Jn),Gn("filter",Jn),Gn("find",Jn),Gn("findIndex",Jn),Gn("findLast",Jn),Gn("findLastIndex",Jn),Gn("flatMap",Jn),Gn("forEach",Jn),Gn("map",Jn),Gn("some",Jn),Gn("toReversed",Jn),Gn("reduce",Zn),Gn("reduceRight",Zn);var Qn=$i("ObservableArrayAdministration",$n);function eo(e){return Hi(e)&&Qn(e[vs])}var to={},io="add",so="delete",ro=function(){function e(e,t,i){var s=this;void 0===t&&(t=ys),void 0===i&&(i="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[vs]=to,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=i,Ii(Map)||Ci(18),Ro(function(){s.keysAtom_=bs("ObservableMap.keys()"),s.data_=new Map,s.hasMap_=new Map,e&&s.merge(e)})}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!Ir.trackingDerivation)return this.has_(e);var i=this.hasMap_.get(e);if(!i){var s=i=new _r(this.has_(e),ws,"ObservableMap.key?",!1);this.hasMap_.set(e,s),_n(s,function(){return t.hasMap_.delete(e)})}return i.get()},t.set=function(e,t){var i=this.has_(e);if(An(this)){var s=zn(this,{type:i?Un:io,object:this,newValue:t,name:e});if(!s)return this;t=s.newValue}return i?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if((this.keysAtom_,An(this))&&!zn(this,{type:so,object:this,name:e}))return!1;if(this.has_(e)){var i=On(this),s=i?{observableKind:"map",debugObjectName:this.name_,type:so,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return Ln(function(){var i;t.keysAtom_.reportChanged(),null==(i=t.hasMap_.get(e))||i.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)}),i&&Fn(this,s),!0}return!1},t.updateValue_=function(e,t){var i=this.data_.get(e);if((t=i.prepareNewValue_(t))!==Ir.UNCHANGED){var s=On(this),r=s?{observableKind:"map",debugObjectName:this.name_,type:Un,object:this,oldValue:i.value_,name:e,newValue:t}:null;i.setNewValue_(t),s&&Fn(this,r)}},t.addValue_=function(e,t){var i=this;this.keysAtom_,Ln(function(){var s,r=new _r(t,i.enhancer_,"ObservableMap.key",!1);i.data_.set(e,r),t=r.value_,null==(s=i.hasMap_.get(e))||s.setNewValue_(!0),i.keysAtom_.reportChanged()});var s=On(this),r=s?{observableKind:"map",debugObjectName:this.name_,type:io,object:this,name:e,newValue:t}:null;s&&Fn(this,r)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.getOrInsert=function(e,t){return this.has(e)||this.set(e,t),this.get(e)},t.getOrInsertComputed=function(e,t){return this.has(e)||this.set(e,t(e)),this.get(e)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return oo({next:function(){var i=t.next(),s=i.done,r=i.value;return{done:s,value:s?void 0:e.get(r)}}})},t.entries=function(){var e=this,t=this.keys();return oo({next:function(){var i=t.next(),s=i.done,r=i.value;return{done:s,value:s?void 0:[r,e.get(r)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(e,t){for(var i,s=rs(this);!(i=s()).done;){var r=i.value,n=r[0],o=r[1];e.call(t,o,n,this)}},t.merge=function(e){var t=this;return no(e)&&(e=new Map(e)),Ln(function(){var i,s,r;Wi(e)?function(e){var t=Object.keys(e);if(!Gi)return t;var i=Object.getOwnPropertySymbols(e);return i.length?[].concat(t,i.filter(function(t){return Di.propertyIsEnumerable.call(e,t)})):t}(e).forEach(function(i){return t.set(i,e[i])}):Array.isArray(e)?e.forEach(function(e){var i=e[0],s=e[1];return t.set(i,s)}):Vi(e)?(i=e,s=Object.getPrototypeOf(i),r=Object.getPrototypeOf(s),null!==Object.getPrototypeOf(r)&&Ci(19,e),e.forEach(function(e,i){return t.set(i,e)})):null!=e&&Ci(20,e)}),this},t.clear=function(){var e=this;Ln(function(){Br(function(){for(var t,i=rs(e.keys());!(t=i()).done;){var s=t.value;e.delete(s)}})})},t.replace=function(e){var t=this;return Ln(function(){for(var i,s=function(e){if(Vi(e)||no(e))return e;if(Array.isArray(e))return new Map(e);if(Wi(e)){var t=new Map;for(var i in e)t.set(i,e[i]);return t}return Ci(21,e)}(e),r=new Map,n=!1,o=rs(t.data_.keys());!(i=o()).done;){var a=i.value;if(!s.has(a))if(t.delete(a))n=!0;else{var l=t.data_.get(a);r.set(a,l)}}for(var c,h=rs(s.entries());!(c=h()).done;){var u=c.value,d=u[0],f=u[1],p=t.data_.has(d);if(t.set(d,f),t.data_.has(d)){var g=t.data_.get(d);r.set(d,g),p||(n=!0)}}if(!n)if(t.data_.size!==r.size)t.keysAtom_.reportChanged();else for(var v=t.data_.keys(),m=r.keys(),_=v.next(),b=m.next();!_.done;){if(_.value!==b.value){t.keysAtom_.reportChanged();break}_=v.next(),b=m.next()}t.data_=r}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return In(this,e)},t.intercept_=function(e){return Tn(this,e)},ss(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),no=$i("ObservableMap",ro);function oo(e){return e[Symbol.toStringTag]="MapIterator",Fo(e)}var ao={},lo=function(){function e(e,t,i){var s=this;void 0===t&&(t=ys),void 0===i&&(i="ObservableSet"),this.name_=void 0,this[vs]=ao,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=i,Ii(Set)||Ci(22),this.enhancer_=function(e,s){return t(e,s,i)},Ro(function(){s.atom_=bs(s.name_),e&&s.replace(e)})}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;Ln(function(){Br(function(){for(var t,i=rs(e.data_.values());!(t=i()).done;){var s=t.value;e.delete(s)}})})},t.forEach=function(e,t){for(var i,s=rs(this);!(i=s()).done;){var r=i.value;e.call(t,r,r,this)}},t.add=function(e){var t=this;if(this.atom_,An(this)){var i=zn(this,{type:io,object:this,newValue:e});if(!i)return this;e=i.newValue}if(!this.has(e)){Ln(function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()});var s=On(this),r=s?{observableKind:"set",debugObjectName:this.name_,type:io,object:this,newValue:e}:null;s&&Fn(this,r)}return this},t.delete=function(e){var t=this;if(An(this)&&!zn(this,{type:so,object:this,oldValue:e}))return!1;if(this.has(e)){var i=On(this),s=i?{observableKind:"set",debugObjectName:this.name_,type:so,object:this,oldValue:e}:null;return Ln(function(){t.atom_.reportChanged(),t.data_.delete(e)}),i&&Fn(this,s),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=this.values();return ho({next:function(){var t=e.next(),i=t.value,s=t.done;return s?{value:void 0,done:s}:{value:[i,i],done:s}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var e=this,t=this.data_.values();return ho({next:function(){var i=t.next(),s=i.value,r=i.done;return r?{value:void 0,done:r}:{value:e.dehanceValue_(s),done:r}}})},t.intersection=function(e){return Yi(e)&&!co(e)?e.intersection(this):new Set(this).intersection(e)},t.union=function(e){return Yi(e)&&!co(e)?e.union(this):new Set(this).union(e)},t.difference=function(e){return new Set(this).difference(e)},t.symmetricDifference=function(e){return Yi(e)&&!co(e)?e.symmetricDifference(this):new Set(this).symmetricDifference(e)},t.isSubsetOf=function(e){return new Set(this).isSubsetOf(e)},t.isSupersetOf=function(e){return new Set(this).isSupersetOf(e)},t.isDisjointFrom=function(e){return Yi(e)&&!co(e)?e.isDisjointFrom(this):new Set(this).isDisjointFrom(e)},t.replace=function(e){var t=this;return co(e)&&(e=new Set(e)),Ln(function(){Array.isArray(e)||Yi(e)?(t.clear(),e.forEach(function(e){return t.add(e)})):null!=e&&Ci("Cannot initialize set from "+e)}),this},t.observe_=function(e,t){return In(this,e)},t.intercept_=function(e){return Tn(this,e)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},ss(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),co=$i("ObservableSet",lo);function ho(e){return e[Symbol.toStringTag]="SetIterator",Fo(e)}var uo=Object.create(null),fo="remove",po=function(){function e(e,t,i,s){void 0===t&&(t=new Map),void 0===s&&(s=Ks),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.lazyComputedKeys_=void 0,this.lazyObservableKeys_=void 0,this.target_=e,this.values_=t,this.name_=i,this.defaultAnnotation_=s,this.keysAtom_=new ms("ObservableObject.keys"),this.isPlainObject_=Wi(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(e){var t,i;return(null!=(t=null!=(i=this.values_.get(e))?i:this.materializeLazyComputed_(e))?t:this.materializeLazyObservable_(e)).get()},t.materializeLazyComputed_=function(e){var t,i=null==(t=this.lazyComputedKeys_)?void 0:t.get(e);if(i){this.lazyComputedKeys_.delete(e),0===this.lazyComputedKeys_.size&&(this.lazyComputedKeys_=void 0);var s=i();return this.values_.set(e,s),s}},t.materializeLazyObservable_=function(e){var t,i=null==(t=this.lazyObservableKeys_)?void 0:t.get(e);if(i){this.lazyObservableKeys_.delete(e),0===this.lazyObservableKeys_.size&&(this.lazyObservableKeys_=void 0);var s=i();return this.values_.set(e,s),s}},t.setObservablePropValue_=function(e,t){var i,s,r=null!=(i=null!=(s=this.values_.get(e))?s:this.materializeLazyComputed_(e))?i:this.materializeLazyObservable_(e);if(r instanceof br)return r.set(t),!0;if(An(this)){var n=zn(this,{type:Un,object:this.proxy_||this.target_,name:e,newValue:t});if(!n)return null;t=n.newValue}if((t=r.prepareNewValue_(t))!==Ir.UNCHANGED){var o=On(this),a=o?{type:Un,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),o&&Fn(this,a)}return!0},t.get_=function(e){return Ir.trackingDerivation&&!Zi(this.target_,e)&&this.has_(e),this.target_[e]},t.set_=function(e,t,i){return void 0===i&&(i=!1),Zi(this.target_,e)?this.values_.has(e)?this.setObservablePropValue_(e,t):i?Reflect.set(this.target_,e,t):(this.target_[e]=t,!0):this.extend_(e,{value:t,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,i)},t.has_=function(e){if(!Ir.trackingDerivation)return e in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var t=this.pendingKeys_.get(e);return t||(t=new _r(e in this.target_,ws,"ObservableObject.key?",!1),this.pendingKeys_.set(e,t)),t.get()},t.make_=function(e,t){if(!0===t&&(t=this.defaultAnnotation_),!1!==t){if(!(e in this.target_)){var i;if(null!=(i=this.target_[ds])&&i[e])return;Ci(1,t.annotationType_,this.name_+"."+e.toString())}for(var s=this.target_;s&&s!==Di;){var r=Ei(s,e);if(r){var n=t.make_(this,e,r,s);if(0===n)return;if(1===n)break}s=Object.getPrototypeOf(s)}bo(this,t,e)}},t.extend_=function(e,t,i,s){if(void 0===s&&(s=!1),!0===i&&(i=this.defaultAnnotation_),!1===i)return this.defineProperty_(e,t,s);var r=i.extend_(this,e,t,s);return r&&bo(this,i,e),r},t.defineProperty_=function(e,t,i){void 0===i&&(i=!1),this.keysAtom_;try{Kr();var s=this.delete_(e);if(!s)return s;if(An(this)){var r=zn(this,{object:this.proxy_||this.target_,name:e,type:io,newValue:t.value});if(!r)return null;var n=r.newValue;t.value!==n&&(t=ns({},t,{value:n}))}if(i){if(!Reflect.defineProperty(this.target_,e,t))return!1}else Bi(this.target_,e,t);this.notifyPropertyAddition_(e,t.value)}finally{Ur()}return!0},t.defineObservableProperty_=function(e,t,i,s){void 0===s&&(s=!1),this.keysAtom_;try{Kr();var r=this.delete_(e);if(!r)return r;if(An(this)){var n=zn(this,{object:this.proxy_||this.target_,name:e,type:io,newValue:t});if(!n)return null;t=n.newValue}var o=mo(e),a={configurable:!Ir.safeDescriptors||this.isPlainObject_,enumerable:!0,get:o.get,set:o.set};if(s){if(!Reflect.defineProperty(this.target_,e,a))return!1}else Bi(this.target_,e,a);var l=new _r(t,i,"ObservableObject.key",!1);this.values_.set(e,l),this.notifyPropertyAddition_(e,l.value_)}finally{Ur()}return!0},t.defineComputedProperty_=function(e,t,i){void 0===i&&(i=!1),this.keysAtom_;try{Kr();var s=this.delete_(e);if(!s)return s;if(An(this))if(!zn(this,{object:this.proxy_||this.target_,name:e,type:io,newValue:void 0}))return null;t.name||(t.name="ObservableObject.key"),t.context=this.proxy_||this.target_;var r=mo(e),n={configurable:!Ir.safeDescriptors||this.isPlainObject_,enumerable:!1,get:r.get,set:r.set};if(i){if(!Reflect.defineProperty(this.target_,e,n))return!1}else Bi(this.target_,e,n);this.values_.set(e,new br(t)),this.notifyPropertyAddition_(e,void 0)}finally{Ur()}return!0},t.delete_=function(e,t){if(void 0===t&&(t=!1),this.keysAtom_,!Zi(this.target_,e))return!0;if(An(this)&&!zn(this,{object:this.proxy_||this.target_,name:e,type:fo}))return null;try{var i;Kr();var s,r=On(this),n=this.values_.get(e),o=void 0;if(!n&&r)o=null==(s=Ei(this.target_,e))?void 0:s.value;if(t){if(!Reflect.deleteProperty(this.target_,e))return!1}else delete this.target_[e];if(n&&(this.values_.delete(e),n instanceof _r&&(o=n.value_),$r(n)),this.keysAtom_.reportChanged(),null==(i=this.pendingKeys_)||null==(i=i.get(e))||i.set(e in this.target_),r){var a={type:fo,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:o,name:e};0,r&&Fn(this,a)}}finally{Ur()}return!0},t.observe_=function(e,t){return In(this,e)},t.intercept_=function(e){return Tn(this,e)},t.notifyPropertyAddition_=function(e,t){var i,s=On(this);if(s){var r=s?{type:io,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:e,newValue:t}:null;s&&Fn(this,r)}null==(i=this.pendingKeys_)||null==(i=i.get(e))||i.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),Xi(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function go(e,t){var i;if(Zi(e,vs))return e;var s=null!=(i=null==t?void 0:t.name)?i:"ObservableObject",r=new po(e,new Map,String(s),function(e){var t;return e?null!=(t=e.defaultDecorator)?t:Us(e):void 0}(t));return Ui(e,vs,r),e}var vo=$i("ObservableObjectAdministration",po);function mo(e){return uo[e]||(uo[e]={get:function(){return this[vs].getObservablePropValue_(e)},set:function(t){return this[vs].setObservablePropValue_(e,t)}})}function _o(e){return!!Hi(e)&&vo(e[vs])}function bo(e,t,i){var s;null==(s=e.target_[ds])||delete s[i]}var xo,yo,wo=No(0),So=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,!1===e}(),ko=0,Co=function(){};xo=Co,yo=Array.prototype,Object.setPrototypeOf?Object.setPrototypeOf(xo.prototype,yo):void 0!==xo.prototype.__proto__?xo.prototype.__proto__=yo:xo.prototype=yo;var jo=function(e){function t(t,i,s,r){var n;return void 0===s&&(s="ObservableArray"),void 0===r&&(r=!1),n=e.call(this)||this,Ro(function(){var e=new $n(s,i,r,!0);e.proxy_=n,qi(n,vs,e),t&&t.length&&n.spliceWithArray(0,0,t),So&&Object.defineProperty(n,"0",wo)}),n}as(t,e);var i=t.prototype;return i.concat=function(){this[vs].atom_.reportObserved();for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return Array.prototype.concat.apply(this.slice(),t.map(function(e){return eo(e)?e.slice():e}))},i[Symbol.iterator]=function(){var e=this,t=0;return Fo({next:function(){return t<e.length?{value:e[t++],done:!1}:{done:!0,value:void 0}}})},ss(t,[{key:"length",get:function(){return this[vs].getArrayLength_()},set:function(e){this[vs].setArrayLength_(e)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(Co);function No(e){return{enumerable:!1,configurable:!0,get:function(){return this[vs].get_(e)},set:function(t){this[vs].set_(e,t)}}}function Mo(e){Bi(jo.prototype,""+e,No(e))}function Eo(e){if(e>ko){for(var t=ko;t<e+100;t++)Mo(t);ko=e}}function Bo(e,t,i){return new jo(e,t,i)}function Do(e,t){if("object"==typeof e&&null!==e){if(eo(e))return void 0!==t&&Ci(23),e[vs].atom_;if(co(e))return e.atom_;if(no(e)){if(void 0===t)return e.keysAtom_;var i=e.data_.get(t)||e.hasMap_.get(t);return i||Ci(25,t,Lo(e)),i}if(_o(e)){var s,r;if(!t)return Ci(26);var n=e[vs],o=null!=(s=null!=(r=n.values_.get(t))?r:n.materializeLazyComputed_(t))?s:n.materializeLazyObservable_(t);return o||Ci(27,t,Lo(e)),o}if(_s(e)||kr(e)||Zr(e))return e}else if(Ii(e)&&Zr(e[vs]))return e[vs];Ci(28)}function Lo(e,t){var i;if(void 0!==t)i=Do(e,t);else{if(un(e))return e.name;i=_o(e)||no(e)||co(e)?function(e){return e||Ci(29),_s(e)||kr(e)||Zr(e)||no(e)||co(e)?e:e[vs]?e[vs]:void Ci(24,e)}(e):Do(e)}return i.name_}function Ro(e){var t=Dr(),i=vr(!0);Kr();try{return e()}finally{Ur(),mr(i),Lr(t)}}Object.entries(Yn).forEach(function(e){var t=e[0],i=e[1];"concat"!==t&&Ui(jo.prototype,t,i)}),Eo(1e3);var Po,Ao=Di.toString;function To(e,t,i){return void 0===i&&(i=-1),zo(e,t,i)}function zo(e,t,i,s,r){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return!1;if(e!=e)return t!=t;var n=typeof e;if("function"!==n&&"object"!==n&&"object"!=typeof t)return!1;var o=Ao.call(e);if(o!==Ao.call(t))return!1;switch(o){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:0===+e?1/+e==1/t:+e===+t;case"[object Date]":case"[object Boolean]":return+e===+t;case"[object Symbol]":return"undefined"!=typeof Symbol&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":i>=0&&i++}e=Oo(e),t=Oo(t);var a="[object Array]"===o;if(!a){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,c=t.constructor;if(l!==c&&!(Ii(l)&&l instanceof l&&Ii(c)&&c instanceof c)&&"constructor"in e&&"constructor"in t)return!1}if(0===i)return!1;i<0&&(i=-1),r=r||[];for(var h=(s=s||[]).length;h--;)if(s[h]===e)return r[h]===t;if(s.push(e),r.push(t),a){if((h=e.length)!==t.length)return!1;for(;h--;)if(!zo(e[h],t[h],i-1,s,r))return!1}else{var u=Object.keys(e),d=u.length;if(Object.keys(t).length!==d)return!1;for(var f=0;f<d;f++){var p=u[f];if(!Zi(t,p)||!zo(e[p],t[p],i-1,s,r))return!1}}return s.pop(),r.pop(),!0}function Oo(e){return eo(e)?e.slice():Vi(e)||no(e)||Yi(e)||co(e)?Array.from(e.entries()):e}var Io=(null==(Po=Ni().Iterator)?void 0:Po.prototype)||{};function Fo(e){return e[Symbol.iterator]=Ho,Object.assign(Object.create(Io),e)}function Ho(){return this}["Symbol","Map","Set"].forEach(function(e){void 0===Ni()[e]&&Ci("MobX requires global '"+e+"' to be available or polyfilled")}),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:Lo},$mobx:vs});var Wo={exports:{}},Ko={},Uo={exports:{}},qo={};
11
+ */var mi=gi,_i=Symbol.for("react.element"),bi=Symbol.for("react.fragment"),xi=Object.prototype.hasOwnProperty,yi=mi.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,wi={key:!0,ref:!0,__self:!0,__source:!0};function Si(e,t,i){var s,r={},n=null,o=null;for(s in void 0!==i&&(n=""+i),void 0!==t.key&&(n=""+t.key),void 0!==t.ref&&(o=t.ref),t)xi.call(t,s)&&!wi.hasOwnProperty(s)&&(r[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps)void 0===r[s]&&(r[s]=t[s]);return{$$typeof:_i,type:e,key:n,ref:o,props:r,_owner:yi.current}}Lt.Fragment=bi,Lt.jsx=Si,Lt.jsxs=Si,Dt.exports=Lt;var ki=Dt.exports;function Ci(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];throw new Error("number"==typeof e?"[MobX] minified error nr: "+e+(i.length?" "+i.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var ji={};function Ni(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:ji}var Mi=Object.assign,Bi=Object.getOwnPropertyDescriptor,Ei=Object.defineProperty,Di=Object.prototype,Li=[];Object.freeze(Li);var Pi={};Object.freeze(Pi);var Ri="undefined"!=typeof Proxy,Ai=Object.toString();function Ti(){Ri||Ci("Proxy not available")}function zi(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var Oi=function(){};function Ii(e){return"function"==typeof e}function Fi(e){switch(typeof e){case"string":case"symbol":case"number":return!0}return!1}function Hi(e){return null!==e&&"object"==typeof e}function Wi(e){if(!Hi(e))return!1;var t=Object.getPrototypeOf(e);if(null==t)return!0;var i=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i.toString()===Ai}function Ki(e){var t=null==e?void 0:e.constructor;return!!t&&("GeneratorFunction"===t.name||"GeneratorFunction"===t.displayName)}function Ui(e,t,i){Ei(e,t,{enumerable:!1,writable:!0,configurable:!0,value:i})}function $i(e,t,i){Ei(e,t,{enumerable:!1,writable:!1,configurable:!0,value:i})}function qi(e,t){var i="isMobX"+e;return t.prototype[i]=!0,function(e){return Hi(e)&&!0===e[i]}}function Vi(e){return null!=e&&"[object Map]"===Object.prototype.toString.call(e)}function Yi(e){return null!=e&&"[object Set]"===Object.prototype.toString.call(e)}var Gi=void 0!==Object.getOwnPropertySymbols;var Xi="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:Gi?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function Zi(e){return null===e?null:"object"==typeof e?""+e:e}function Ji(e,t){return Di.hasOwnProperty.call(e,t)}var Qi=Object.getOwnPropertyDescriptors||function(e){var t={};return Xi(e).forEach(function(i){t[i]=Bi(e,i)}),t};function es(e,t){return!!(e&t)}function ts(e,t,i){return i?e|=t:e&=~t,e}function is(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,s=Array(t);i<t;i++)s[i]=e[i];return s}function ss(e,t,i){return t&&function(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,hs(s.key),s)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function rs(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(i)return(i=i.call(e)).next.bind(i);if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return is(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?is(e,t):void 0}}(e))||t){i&&(e=i);var s=0;return function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ns(){return ns=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},ns.apply(null,arguments)}function os(e){return(os=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function as(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,cs(e,t)}function ls(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ls=function(){return!!e})()}function cs(e,t){return(cs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function hs(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var s=i.call(e,t);if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}function us(e){var t="function"==typeof Map?new Map:void 0;return us=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return function(e,t,i){if(ls())return Reflect.construct.apply(null,arguments);var s=[null];s.push.apply(s,t);var r=new(e.bind.apply(e,s));return i&&cs(r,i.prototype),r}(e,arguments,os(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),cs(i,e)},us(e)}var ds=Symbol("mobx-stored-annotations");function fs(e){return Object.assign(function(t,i){if(gs(i))return e.decorate_20223_(t,i);ps(t,i,e)},e)}function ps(e,t,i){Ji(e,ds)||Ui(e,ds,ns({},e[ds])),function(e){return e.annotationType_===Ss}(i)||(e[ds][t]=i)}function gs(e){return"object"==typeof e&&"string"==typeof e.kind}var vs=Symbol("mobx administration"),ms=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=xr.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(e){return e()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(e){return e()})},t.reportObserved=function(){return $r(this)},t.reportChanged=function(){Kr(),qr(this),Ur()},t.toString=function(){return this.name_},ss(e,[{key:"isBeingObserved",get:function(){return es(this.flags_,e.isBeingObservedMask_)},set:function(t){this.flags_=ts(this.flags_,e.isBeingObservedMask_,t)}},{key:"isPendingUnobservation",get:function(){return es(this.flags_,e.isPendingUnobservationMask_)},set:function(t){this.flags_=ts(this.flags_,e.isPendingUnobservationMask_,t)}},{key:"diffValue",get:function(){return es(this.flags_,e.diffValueMask_)?1:0},set:function(t){this.flags_=ts(this.flags_,e.diffValueMask_,1===t)}}])}();ms.isBeingObservedMask_=1,ms.isPendingUnobservationMask_=2,ms.diffValueMask_=4;var _s=qi("Atom",ms);function bs(e,t,i){void 0===t&&(t=Oi),void 0===i&&(i=Oi);var s,r=new ms(e);return t!==Oi&&bn(vn,r,t,s),i!==Oi&&_n(r,i),r}var xs={structural:function(e,t){return To(e,t)},default:function(e,t){return Object.is?Object.is(e,t):e===t?0!==e||1/e==1/t:e!=e&&t!=t}};function ys(e,t,i){return Dn(e)?e:Array.isArray(e)?nr.array(e,{name:i}):Wi(e)?nr.object(e,void 0,{name:i}):Vi(e)?nr.map(e,{name:i}):Yi(e)?nr.set(e,{name:i}):"function"!=typeof e||un(e)||En(e)?e:Ki(e)?Mn(e):cn(i,e)}function ws(e){return e}var Ss="override";function ks(e,t){return{annotationType_:e,options_:t,make_:Cs,extend_:js,decorate_20223_:Ns}}function Cs(e,t,i,s){var r;if(null!=(r=this.options_)&&r.bound)return null===this.extend_(e,t,i,!1)?0:1;if(s===e.target_)return null===this.extend_(e,t,i,!1)?0:2;if(un(i.value))return 1;var n=Ms(e,this,t,i,!1);return Ei(s,t,n),2}function js(e,t,i,s){var r=Ms(e,this,t,i);return e.defineProperty_(t,r,s)}function Ns(e,t){var i,s=t.kind,r=t.name,n=t.addInitializer,o=this,a=function(e){var t,i,s,n;return pr(null!=(t=null==(i=o.options_)?void 0:i.name)?t:r.toString(),e,null!=(s=null==(n=o.options_)?void 0:n.autoAction)&&s)};return"field"==s?function(e){var t,i=e;return un(i)||(i=a(i)),null!=(t=o.options_)&&t.bound&&((i=i.bind(this)).isMobxAction=!0),i}:"method"==s?(un(e)||(e=a(e)),null!=(i=this.options_)&&i.bound&&n(function(){var e=this,t=e[r].bind(e);t.isMobxAction=!0,e[r]=t}),e):void Ci("Cannot apply '"+o.annotationType_+"' to '"+String(r)+"' (kind: "+s+"):\n'"+o.annotationType_+"' can only be used on properties with a function value.")}function Ms(e,t,i,s,r){var n,o,a,l,c,h,u,d;void 0===r&&(r=Ir.safeDescriptors),d=s,t.annotationType_,d.value;var f,p=s.value;null!=(n=t.options_)&&n.bound&&(p=p.bind(null!=(f=e.proxy_)?f:e.target_));return{value:pr(null!=(o=null==(a=t.options_)?void 0:a.name)?o:i.toString(),p,null!=(l=null==(c=t.options_)?void 0:c.autoAction)&&l,null!=(h=t.options_)&&h.bound?null!=(u=e.proxy_)?u:e.target_:void 0),configurable:!r||e.isPlainObject_,enumerable:!1,writable:!r}}function Bs(e,t){return{annotationType_:e,options_:t,make_:Es,extend_:Ds,decorate_20223_:Ls}}function Es(e,t,i,s){var r;if(s===e.target_)return null===this.extend_(e,t,i,!1)?0:2;if(null!=(r=this.options_)&&r.bound&&(!Ji(e.target_,t)||!En(e.target_[t]))&&null===this.extend_(e,t,i,!1))return 0;if(En(i.value))return 1;var n=Ps(e,this,t,i,!1,!1);return Ei(s,t,n),2}function Ds(e,t,i,s){var r,n=Ps(e,this,t,i,null==(r=this.options_)?void 0:r.bound);return e.defineProperty_(t,n,s)}function Ls(e,t){var i,s=t.name,r=t.addInitializer;return En(e)||(e=Mn(e)),null!=(i=this.options_)&&i.bound&&r(function(){var e=this,t=e[s].bind(e);t.isMobXFlow=!0,e[s]=t}),e}function Ps(e,t,i,s,r,n){var o;void 0===n&&(n=Ir.safeDescriptors),o=s,t.annotationType_,o.value;var a,l=s.value;(En(l)||(l=Mn(l)),r)&&((l=l.bind(null!=(a=e.proxy_)?a:e.target_)).isMobXFlow=!0);return{value:l,configurable:!n||e.isPlainObject_,enumerable:!1,writable:!n}}function Rs(e,t){return{annotationType_:e,options_:t,make_:As,extend_:Ts,decorate_20223_:zs}}function As(e,t,i){return null===this.extend_(e,t,i,!1)?0:1}function Ts(e,t,i,s){var r;return r=i,this.annotationType_,r.get,e.defineComputedProperty_(t,ns({},this.options_,{get:i.get,set:i.set}),s)}function zs(e,t){var i,s=this,r=t.name;function n(t,i){var n=ns({},s.options_,{get:e,context:t});return n.name||(n.name="ObservableObject."+r.toString()),new br(n)}return(0,t.addInitializer)(function(){var t,i=go(this)[vs],s=this,o=i.values_.get(r);o instanceof br&&o.derivation!==e&&i.values_.delete(r),(null!=(t=i.lazyComputedKeys_)?t:i.lazyComputedKeys_=new Map).set(r,function(){return n(s)})}),function(){var t=this[vs],s=t.values_.get(r);if(s instanceof br&&s.derivation!==e){var o,a,l=null==(o=i)?void 0:o.get(this);if(!l)l=n(this),(null!=(a=i)?a:i=new WeakMap).set(this,l);return l.get()}return t.getObservablePropValue_(r)}}function Os(e,t){return{annotationType_:e,options_:t,make_:Is,extend_:Fs,decorate_20223_:Hs}}function Is(e,t,i){return null===this.extend_(e,t,i,!1)?0:1}function Fs(e,t,i,s){var r,n;return this.annotationType_,e.defineObservableProperty_(t,i.value,null!=(r=null==(n=this.options_)?void 0:n.enhancer)?r:ys,s)}function Hs(e,t){var i=this,s=t.kind,r=t.name;if("accessor"===s)return{get:function(){var t;return(null!=(t=this[vs])?t:n(this,e.get.call(this))).getObservablePropValue_(r)},set:function(e){var t;return(null!=(t=this[vs])?t:n(this,e)).setObservablePropValue_(r,e)},init:function(e){return n(this,e),e}};function n(e,t){var s,n=go(e)[vs];return(null!=(s=n.lazyObservableKeys_)?s:n.lazyObservableKeys_=new Map).set(r,function(){var e,s;return new _r(t,null!=(e=null==(s=i.options_)?void 0:s.enhancer)?e:ys,"ObservableObject."+r.toString(),!1)}),n}}var Ws="true",Ks=Us();function Us(e){return{annotationType_:Ws,options_:e,make_:$s,extend_:qs,decorate_20223_:Vs}}function $s(e,t,i,s){var r,n,o,a;if(i.get)return cr.make_(e,t,i,s);if(i.set){var l=un(i.set)?i.set:pr(t.toString(),i.set);return s===e.target_?null===e.defineProperty_(t,{configurable:!Ir.safeDescriptors||e.isPlainObject_,set:l})?0:2:(Ei(s,t,{configurable:!0,set:l}),2)}if(s!==e.target_&&"function"==typeof i.value)return Ki(i.value)?(null!=(a=this.options_)&&a.autoBind?Mn.bound:Mn).make_(e,t,i,s):(null!=(o=this.options_)&&o.autoBind?cn.bound:cn).make_(e,t,i,s);var c,h=!1===(null==(r=this.options_)?void 0:r.deep)?nr.ref:nr;"function"==typeof i.value&&null!=(n=this.options_)&&n.autoBind&&(i.value=i.value.bind(null!=(c=e.proxy_)?c:e.target_));return h.make_(e,t,i,s)}function qs(e,t,i,s){var r,n,o;if(i.get)return cr.extend_(e,t,i,s);if(i.set)return e.defineProperty_(t,{configurable:!Ir.safeDescriptors||e.isPlainObject_,set:pr(t.toString(),i.set)},s);"function"==typeof i.value&&null!=(r=this.options_)&&r.autoBind&&(i.value=i.value.bind(null!=(o=e.proxy_)?o:e.target_));return(!1===(null==(n=this.options_)?void 0:n.deep)?nr.ref:nr).extend_(e,t,i,s)}function Vs(e,t){Ci("'"+this.annotationType_+"' cannot be used as a decorator")}var Ys={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};function Gs(e){return e||Ys}Object.freeze(Ys);var Xs=Os("observable"),Zs=Os("observable.ref",{enhancer:ws}),Js=Os("observable.shallow",{enhancer:function(e,t,i){return null==e||_o(e)||eo(e)||no(e)||co(e)?e:Array.isArray(e)?nr.array(e,{name:i,deep:!1}):Wi(e)?nr.object(e,void 0,{name:i,deep:!1}):Vi(e)?nr.map(e,{name:i,deep:!1}):Yi(e)?nr.set(e,{name:i,deep:!1}):void 0}}),Qs=Os("observable.struct",{enhancer:function(e,t){return To(e,t)?t:e}}),er=fs(Xs);function tr(e){return!0===e.deep?ys:!1===e.deep?ws:(t=e.defaultDecorator)&&null!=(i=null==(s=t.options_)?void 0:s.enhancer)?i:ys;var t,i,s}function ir(e,t,i){return gs(t)?Xs.decorate_20223_(e,t):Fi(t)?void ps(e,t,Xs):Dn(e)?e:Wi(e)?nr.object(e,t,i):Array.isArray(e)?nr.array(e,t):Vi(e)?nr.map(e,t):Yi(e)?nr.set(e,t):"object"==typeof e&&null!==e?e:nr.box(e,t)}Mi(ir,er);var sr,rr,nr=Mi(ir,{box:function(e,t){var i=Gs(t);return new _r(e,tr(i),i.name,!0,i.equals)},array:function(e,t){var i=Gs(t);return(!1===Ir.useProxies||!1===i.proxy?Eo:Vn)(e,tr(i),i.name)},map:function(e,t){var i=Gs(t);return new ro(e,tr(i),i.name)},set:function(e,t){var i=Gs(t);return new lo(e,tr(i),i.name)},object:function(e,t,i){return Po(function(){return wn(!1===Ir.useProxies||!1===(null==i?void 0:i.proxy)?go({},i):function(e,t){var i,s;return Ti(),e=go(e,t),null!=(s=(i=e[vs]).proxy_)?s:i.proxy_=new Proxy(e,Rn)}({},i),e,t)})},ref:fs(Zs),shallow:fs(Js),deep:er,struct:fs(Qs)}),or="computed",ar=Rs(or),lr=Rs("computed.struct",{equals:xs.structural}),cr=function(e,t){if(gs(t))return ar.decorate_20223_(e,t);if(Fi(t))return ps(e,t,ar);if(Wi(e))return fs(Rs(or,e));var i=Wi(t)?t:{};return i.get=e,i.name||(i.name=e.name||""),new br(i)};Object.assign(cr,ar),cr.struct=fs(lr);var hr=0,ur=1,dr=null!=(sr=null==(rr=Bi(function(){},"name"))?void 0:rr.configurable)&&sr,fr={value:"action",configurable:!0,writable:!1,enumerable:!1};function pr(e,t,i,s){function r(){return gr(e,i,t,s||this,arguments)}return void 0===i&&(i=!1),r.isMobxAction=!0,r.toString=function(){return t.toString()},dr&&(fr.value=e,Ei(r,"name",fr)),r}function gr(e,t,i,s,r){var n=function(e,t){var i=!1,s=0,r=Ir.trackingDerivation,n=!t||!r;Kr();var o=Ir.allowStateChanges;n&&(Dr(),o=vr(!0));var a=Pr(!0),l={runAsAction_:n,prevDerivation_:r,prevAllowStateChanges_:o,prevAllowStateReads_:a,notifySpy_:i,startTime_:s,actionId_:ur++,parentActionId_:hr};return hr=l.actionId_,l}(0,t);try{return i.apply(s,r)}catch(o){throw n.error_=o,o}finally{!function(e){hr!==e.actionId_&&Ci(30);hr=e.parentActionId_,void 0!==e.error_&&(Ir.suppressReactionErrors=!0);mr(e.prevAllowStateChanges_),Rr(e.prevAllowStateReads_),Ur(),e.runAsAction_&&Lr(e.prevDerivation_);Ir.suppressReactionErrors=!1}(n)}}function vr(e){var t=Ir.allowStateChanges;return Ir.allowStateChanges=e,t}function mr(e){Ir.allowStateChanges=e}var _r=function(e){function t(t,i,s,r,n){var o;return void 0===s&&(s="ObservableValue"),void 0===n&&(n=xs.default),(o=e.call(this,s)||this).enhancer=void 0,o.name_=void 0,o.equals=void 0,o.hasUnreportedChange_=!1,o.interceptors_=void 0,o.changeListeners_=void 0,o.value_=void 0,o.dehancer=void 0,o.enhancer=i,o.name_=s,o.equals=n,o.value_=i(t,void 0,s),o}as(t,e);var i=t.prototype;return i.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},i.set=function(e){this.value_,(e=this.prepareNewValue_(e))!==Ir.UNCHANGED&&this.setNewValue_(e)},i.prepareNewValue_=function(e){if(An(this)){var t=zn(this,{object:this,type:Un,newValue:e});if(!t)return Ir.UNCHANGED;e=t.newValue}return e=this.enhancer(e,this.value_,this.name_),this.equals(this.value_,e)?Ir.UNCHANGED:e},i.setNewValue_=function(e){var t=this.value_;this.value_=e,this.reportChanged(),On(this)&&Fn(this,{type:Un,object:this,newValue:e,oldValue:t})},i.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},i.intercept_=function(e){return Tn(this,e)},i.observe_=function(e,t){return t&&e({observableKind:"value",debugObjectName:this.name_,object:this,type:Un,newValue:this.value_,oldValue:void 0}),In(this,e)},i.raw=function(){return this.value_},i.toJSON=function(){return this.get()},i.toString=function(){return this.name_+"["+this.value_+"]"},i.valueOf=function(){return Zi(this.get())},i[Symbol.toPrimitive]=function(){return this.valueOf()},t}(ms),br=function(){function e(e){this.dependenciesState_=xr.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=xr.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new Cr(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=wr.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,e.get||Ci(31),this.derivation=e.get,this.name_=e.name||"ComputedValue",e.set&&(this.setter_=pr("ComputedValue-setter",e.set)),this.equals_=e.equals||(e.compareStructural||e.struct?xs.structural:xs.default),this.scope_=e.context,this.requiresReaction_=e.requiresReaction,this.keepAlive_=!!e.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){!function(e){if(e.lowestObserverState_!==xr.UP_TO_DATE_)return;e.lowestObserverState_=xr.POSSIBLY_STALE_,e.observers_.forEach(function(e){e.dependenciesState_===xr.UP_TO_DATE_&&(e.dependenciesState_=xr.POSSIBLY_STALE_,e.onBecomeStale_())})}(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(e){return e()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(e){return e()})},t.get=function(){if(this.isComputing&&Ci(32,this.name_,this.derivation),0!==Ir.inBatch||0!==this.observers_.size||this.keepAlive_){if($r(this),Nr(this)){var e=Ir.trackingContext;this.keepAlive_&&!e&&(Ir.trackingContext=this),this.trackAndCompute()&&function(e){if(e.lowestObserverState_===xr.STALE_)return;e.lowestObserverState_=xr.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===xr.POSSIBLY_STALE_?t.dependenciesState_=xr.STALE_:t.dependenciesState_===xr.UP_TO_DATE_&&(e.lowestObserverState_=xr.UP_TO_DATE_)})}(this),Ir.trackingContext=e}}else Nr(this)&&(this.warnAboutUntrackedRead_(),Kr(),this.value_=this.computeValue_(!1),Ur());var t=this.value_;if(jr(t))throw t.cause;return t},t.set=function(e){if(this.setter_){this.isRunningSetter&&Ci(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,e)}finally{this.isRunningSetter=!1}}else Ci(34,this.name_)},t.trackAndCompute=function(){var e=this.value_,t=this.dependenciesState_===xr.NOT_TRACKING_,i=this.computeValue_(!0),s=t||jr(e)||jr(i)||!this.equals_(e,i);return s&&(this.value_=i),s},t.computeValue_=function(e){this.isComputing=!0;var t,i=vr(!1);if(e)t=Mr(this,this.derivation,this.scope_);else if(!0===Ir.disableErrorBoundaries)t=this.derivation.call(this.scope_);else try{t=this.derivation.call(this.scope_)}catch(s){t=new Cr(s)}return mr(i),this.isComputing=!1,t},t.suspend_=function(){this.keepAlive_||(Br(this),this.value_=void 0)},t.observe_=function(e,t){var i=this,s=!0,r=void 0;return dn(function(){var n=i.get();if(!s||t){var o=Dr();e({observableKind:"computed",debugObjectName:i.name_,type:Un,object:i,newValue:n,oldValue:r}),Lr(o)}s=!1,r=n})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return Zi(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},ss(e,[{key:"isComputing",get:function(){return es(this.flags_,e.isComputingMask_)},set:function(t){this.flags_=ts(this.flags_,e.isComputingMask_,t)}},{key:"isRunningSetter",get:function(){return es(this.flags_,e.isRunningSetterMask_)},set:function(t){this.flags_=ts(this.flags_,e.isRunningSetterMask_,t)}},{key:"isBeingObserved",get:function(){return es(this.flags_,e.isBeingObservedMask_)},set:function(t){this.flags_=ts(this.flags_,e.isBeingObservedMask_,t)}},{key:"isPendingUnobservation",get:function(){return es(this.flags_,e.isPendingUnobservationMask_)},set:function(t){this.flags_=ts(this.flags_,e.isPendingUnobservationMask_,t)}},{key:"diffValue",get:function(){return es(this.flags_,e.diffValueMask_)?1:0},set:function(t){this.flags_=ts(this.flags_,e.diffValueMask_,1===t)}}])}();br.isComputingMask_=1,br.isRunningSetterMask_=2,br.isBeingObservedMask_=4,br.isPendingUnobservationMask_=8,br.diffValueMask_=16;var xr,yr,wr,Sr,kr=qi("ComputedValue",br);(yr=xr||(xr={}))[yr.NOT_TRACKING_=-1]="NOT_TRACKING_",yr[yr.UP_TO_DATE_=0]="UP_TO_DATE_",yr[yr.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",yr[yr.STALE_=2]="STALE_",(Sr=wr||(wr={}))[Sr.NONE=0]="NONE",Sr[Sr.LOG=1]="LOG",Sr[Sr.BREAK=2]="BREAK";var Cr=function(e){this.cause=void 0,this.cause=e};function jr(e){return e instanceof Cr}function Nr(e){switch(e.dependenciesState_){case xr.UP_TO_DATE_:return!1;case xr.NOT_TRACKING_:case xr.STALE_:return!0;case xr.POSSIBLY_STALE_:for(var t=Pr(!0),i=Dr(),s=e.observing_,r=s.length,n=0;n<r;n++){var o=s[n];if(kr(o)){if(Ir.disableErrorBoundaries)o.get();else try{o.get()}catch(a){return Lr(i),Rr(t),!0}if(e.dependenciesState_===xr.STALE_)return Lr(i),Rr(t),!0}}return Ar(e),Lr(i),Rr(t),!1}}function Mr(e,t,i){var s=Pr(!0);Ar(e),e.newObserving_=new Array(0===e.runId_?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++Ir.runId;var r,n=Ir.trackingDerivation;if(Ir.trackingDerivation=e,Ir.inBatch++,!0===Ir.disableErrorBoundaries)r=t.call(i);else try{r=t.call(i)}catch(o){r=new Cr(o)}return Ir.inBatch--,Ir.trackingDerivation=n,function(e){for(var t=e.observing_,i=e.observing_=e.newObserving_,s=xr.UP_TO_DATE_,r=0,n=e.unboundDepsCount_,o=0;o<n;o++){var a=i[o];0===a.diffValue&&(a.diffValue=1,r!==o&&(i[r]=a),r++),a.dependenciesState_>s&&(s=a.dependenciesState_)}i.length=r,e.newObserving_=null,n=t.length;for(;n--;){var l=t[n];0===l.diffValue&&Hr(l,e),l.diffValue=0}for(;r--;){var c=i[r];1===c.diffValue&&(c.diffValue=0,Fr(c,e))}s!==xr.UP_TO_DATE_&&(e.dependenciesState_=s,e.onBecomeStale_())}(e),Rr(s),r}function Br(e){var t=e.observing_;e.observing_=[];for(var i=t.length;i--;)Hr(t[i],e);e.dependenciesState_=xr.NOT_TRACKING_}function Er(e){var t=Dr();try{return e()}finally{Lr(t)}}function Dr(){var e=Ir.trackingDerivation;return Ir.trackingDerivation=null,e}function Lr(e){Ir.trackingDerivation=e}function Pr(e){var t=Ir.allowStateReads;return Ir.allowStateReads=e,t}function Rr(e){Ir.allowStateReads=e}function Ar(e){if(e.dependenciesState_!==xr.UP_TO_DATE_){e.dependenciesState_=xr.UP_TO_DATE_;for(var t=e.observing_,i=t.length;i--;)t[i].lowestObserverState_=xr.UP_TO_DATE_}}var Tr=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},zr=!0,Or=!1,Ir=function(){var e=Ni();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(zr=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new Tr).version&&(zr=!1),zr?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Tr):(setTimeout(function(){Or||Ci(35)},1),new Tr)}();function Fr(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Hr(e,t){e.observers_.delete(t),0===e.observers_.size&&Wr(e)}function Wr(e){!1===e.isPendingUnobservation&&(e.isPendingUnobservation=!0,Ir.pendingUnobservations.push(e))}function Kr(){Ir.inBatch++}function Ur(){if(0===--Ir.inBatch){Xr();for(var e=Ir.pendingUnobservations,t=0;t<e.length;t++){var i=e[t];i.isPendingUnobservation=!1,0===i.observers_.size&&(i.isBeingObserved&&(i.isBeingObserved=!1,i.onBUO()),i instanceof br&&i.suspend_())}Ir.pendingUnobservations=[]}}function $r(e){var t=Ir.trackingDerivation;return null!==t?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&Ir.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(0===e.observers_.size&&Ir.inBatch>0&&Wr(e),!1)}function qr(e){e.lowestObserverState_!==xr.STALE_&&(e.lowestObserverState_=xr.STALE_,e.observers_.forEach(function(e){e.dependenciesState_===xr.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=xr.STALE_}))}var Vr=function(){function e(e,t,i,s){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=xr.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=wr.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=i,this.requiresObservable_=s}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,Ir.pendingReactions.push(this),Xr())},t.runReaction_=function(){if(!this.isDisposed){Kr(),this.isScheduled=!1;var e=Ir.trackingContext;if(Ir.trackingContext=this,Nr(this)){this.isTrackPending=!0;try{this.onInvalidate_()}catch(t){this.reportExceptionInDerivation_(t)}}Ir.trackingContext=e,Ur()}},t.track=function(e){if(!this.isDisposed){Kr(),this.isRunning=!0;var t=Ir.trackingContext;Ir.trackingContext=this;var i=Mr(this,e,void 0);Ir.trackingContext=t,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Br(this),jr(i)&&this.reportExceptionInDerivation_(i.cause),Ur()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(Ir.disableErrorBoundaries)throw e;var i="[mobx] uncaught error in '"+this+"'";Ir.suppressReactionErrors||console.error(i,e),Ir.globalReactionErrorHandlers.forEach(function(i){return i(e,t)})}},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Kr(),Br(this),Ur()))},t.getDisposer_=function(e){var t=this,i=function i(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",i)};return null==e||null==e.addEventListener||e.addEventListener("abort",i),i[vs]=this,"dispose"in Symbol&&"symbol"==typeof Symbol.dispose&&(i[Symbol.dispose]=i),i},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){},ss(e,[{key:"isDisposed",get:function(){return es(this.flags_,e.isDisposedMask_)},set:function(t){this.flags_=ts(this.flags_,e.isDisposedMask_,t)}},{key:"isScheduled",get:function(){return es(this.flags_,e.isScheduledMask_)},set:function(t){this.flags_=ts(this.flags_,e.isScheduledMask_,t)}},{key:"isTrackPending",get:function(){return es(this.flags_,e.isTrackPendingMask_)},set:function(t){this.flags_=ts(this.flags_,e.isTrackPendingMask_,t)}},{key:"isRunning",get:function(){return es(this.flags_,e.isRunningMask_)},set:function(t){this.flags_=ts(this.flags_,e.isRunningMask_,t)}},{key:"diffValue",get:function(){return es(this.flags_,e.diffValueMask_)?1:0},set:function(t){this.flags_=ts(this.flags_,e.diffValueMask_,1===t)}}])}();Vr.isDisposedMask_=1,Vr.isScheduledMask_=2,Vr.isTrackPendingMask_=4,Vr.isRunningMask_=8,Vr.diffValueMask_=16;var Yr=100,Gr=function(e){return e()};function Xr(){Ir.inBatch>0||Ir.isRunningReactions||Gr(Zr)}function Zr(){Ir.isRunningReactions=!0;for(var e=Ir.pendingReactions,t=0;e.length>0;){++t===Yr&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var i=e.splice(0),s=0,r=i.length;s<r;s++)i[s].runReaction_()}Ir.isRunningReactions=!1}var Jr=qi("Reaction",Vr);var Qr="action",en="autoAction",tn="<unnamed action>",sn=ks(Qr),rn=ks("action.bound",{bound:!0}),nn=ks(en,{autoAction:!0}),on=ks("autoAction.bound",{autoAction:!0,bound:!0});function an(e){return function(t,i){return Ii(t)?pr(t.name||tn,t,e):Ii(i)?pr(t,i,e):gs(i)?(e?nn:sn).decorate_20223_(t,i):Fi(i)?ps(t,i,e?nn:sn):Fi(t)?fs(ks(e?en:Qr,{name:t,autoAction:e})):void 0}}var ln=an(!1);Object.assign(ln,sn);var cn=an(!0);function hn(e){return gr(e.name,!1,e,this,void 0)}function un(e){return Ii(e)&&!0===e.isMobxAction}function dn(e,t){var i,s,r,n;void 0===t&&(t=Pi);var o,a=null!=(i=null==(s=t)?void 0:s.name)?i:"Autorun";if(!t.scheduler&&!t.delay)o=new Vr(a,function(){this.track(h)},t.onError,t.requiresObservable);else{var l=pn(t),c=!1;o=new Vr(a,function(){c||(c=!0,l(function(){c=!1,o.isDisposed||o.track(h)}))},t.onError,t.requiresObservable)}function h(){e(o)}return null!=(r=t)&&null!=(r=r.signal)&&r.aborted||o.schedule_(),o.getDisposer_(null==(n=t)?void 0:n.signal)}Object.assign(cn,nn),ln.bound=fs(rn),cn.bound=fs(on);var fn=function(e){return e()};function pn(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:fn}function gn(e,t,i){var s,r,n;void 0===i&&(i=Pi);var o,a,l,c=null!=(s=i.name)?s:"Reaction",h=ln(c,i.onError?(o=i.onError,a=t,function(){try{return a.apply(this,arguments)}catch(e){o.call(this,e)}}):t),u=!i.scheduler&&!i.delay,d=pn(i),f=!0,p=!1,g=i.compareStructural?xs.structural:i.equals||xs.default,v=new Vr(c,function(){f||u?m():p||(p=!0,d(m))},i.onError,i.requiresObservable);function m(){if(p=!1,!v.isDisposed){var t=!1,s=l;v.track(function(){var i=function(e,t){var i=vr(e);try{return t()}finally{mr(i)}}(!1,function(){return e(v)});t=f||!g(l,i),l=i}),(f&&i.fireImmediately||!f&&t)&&h(l,s,v),f=!1}}return null!=(r=i)&&null!=(r=r.signal)&&r.aborted||v.schedule_(),v.getDisposer_(null==(n=i)?void 0:n.signal)}var vn="onBO",mn="onBUO";function _n(e,t,i){return bn(mn,e,t,i)}function bn(e,t,i,s){var r=Do(t),n=Ii(s)?s:i,o=e+"L";return r[o]?r[o].add(n):r[o]=new Set([n]),function(){var e=r[o];e&&(e.delete(n),0===e.size&&delete r[o])}}var xn="always";function yn(e){!0===e.isolateGlobalState&&function(){if((Ir.pendingReactions.length||Ir.inBatch||Ir.isRunningReactions)&&Ci(36),Or=!0,zr){var e=Ni();0===--e.__mobxInstanceCount&&(e.__mobxGlobals=void 0),Ir=new Tr}}();var t,i,s=e.useProxies,r=e.enforceActions;if(void 0!==s&&(Ir.useProxies=s===xn||"never"!==s&&"undefined"!=typeof Proxy),"ifavailable"===s&&(Ir.verifyProxies=!0),void 0!==r){var n=r===xn?xn:"observed"===r;Ir.enforceActions=n,Ir.allowStateChanges=!0!==n&&n!==xn}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(t){t in e&&(Ir[t]=!!e[t])}),Ir.allowStateReads=!Ir.observableRequiresReaction,e.reactionScheduler&&(t=e.reactionScheduler,i=Gr,Gr=function(e){return t(function(){return i(e)})})}function wn(e,t,i,s){var r=Qi(t);return Po(function(){var t=go(e,s)[vs];Xi(r).forEach(function(e){t.extend_(e,r[e],!i||(!(e in i)||i[e]))})}),e}function Sn(e){var t,i={name:e.name_};return e.observing_&&e.observing_.length>0&&(i.dependencies=(t=e.observing_,Array.from(new Set(t))).map(Sn)),i}var kn=0,Cn=function(e){function t(){var i;return i=e.call(this,"FLOW_CANCELLED")||this,Object.setPrototypeOf(i,(this instanceof t?this.constructor:void 0).prototype),i.name="FlowCancellationError",i}return as(t,e),t.prototype.toString=function(){return"Error: "+this.message},t}(us(Error)),jn=Bs("flow"),Nn=Bs("flow.bound",{bound:!0}),Mn=Object.assign(function(e,t){if(gs(t))return jn.decorate_20223_(e,t);if(Fi(t))return ps(e,t,jn);var i=e,s=i.name||"<unnamed flow>",r=function(){var e,t=arguments,r=++kn,n=ln(s+" - runid: "+r+" - init",i).apply(this,t),o=void 0,a=new Promise(function(t,i){var a=0;function l(e){var t;o=void 0;try{t=ln(s+" - runid: "+r+" - yield "+a++,n.next).call(n,e)}catch(l){return i(l)}h(t)}function c(e){var t;o=void 0;try{t=ln(s+" - runid: "+r+" - yield "+a++,n.throw).call(n,e)}catch(l){return i(l)}h(t)}function h(e){if(!Ii(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(l,c);e.then(h,i)}e=i,l(void 0)});return a.cancel=ln(s+" - runid: "+r+" - cancel",function(){try{o&&Bn(o);var t=n.return(void 0),i=Promise.resolve(t.value);i.then(Oi,Oi),Bn(i),e(new Cn)}catch(s){e(s)}}),a};return r.isMobXFlow=!0,r},jn);function Bn(e){Ii(e.cancel)&&e.cancel()}function En(e){return!0===(null==e?void 0:e.isMobXFlow)}function Dn(e){return function(e){return!!e&&(_o(e)||!!e[vs]||_s(e)||Jr(e)||kr(e))}(e)}function Ln(e,t){void 0===t&&(t=void 0),Kr();try{return e.apply(t)}finally{Ur()}}function Pn(e){return e[vs]}Mn.bound=fs(Nn);var Rn={has:function(e,t){return Pn(e).has_(t)},get:function(e,t){return Pn(e).get_(t)},set:function(e,t,i){var s;return!!Fi(t)&&(null==(s=Pn(e).set_(t,i,!0))||s)},deleteProperty:function(e,t){var i;return!!Fi(t)&&(null==(i=Pn(e).delete_(t,!0))||i)},defineProperty:function(e,t,i){var s;return null==(s=Pn(e).defineProperty_(t,i))||s},ownKeys:function(e){return Pn(e).ownKeys_()},preventExtensions:function(e){Ci(13)}};function An(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function Tn(e,t){var i=e.interceptors_||(e.interceptors_=[]);return i.push(t),zi(function(){var e=i.indexOf(t);-1!==e&&i.splice(e,1)})}function zn(e,t){var i=Dr();try{for(var s=[].concat(e.interceptors_||[]),r=0,n=s.length;r<n&&((t=s[r](t))&&!t.type&&Ci(14),t);r++);return t}finally{Lr(i)}}function On(e){return void 0!==e.changeListeners_&&e.changeListeners_.length>0}function In(e,t){var i=e.changeListeners_||(e.changeListeners_=[]);return i.push(t),zi(function(){var e=i.indexOf(t);-1!==e&&i.splice(e,1)})}function Fn(e,t){var i=Dr(),s=e.changeListeners_;if(s){for(var r=0,n=(s=s.slice()).length;r<n;r++)s[r](t);Lr(i)}}var Hn=Symbol("mobx-keys");function Wn(e,t,i){return Wi(e)?wn(e,e,t,i):(Po(function(){var s=go(e,i)[vs];if(!e[Hn]){var r=Object.getPrototypeOf(e),n=new Set([].concat(Xi(e),Xi(r)));n.delete("constructor"),n.delete(vs),Ui(r,Hn,n)}e[Hn].forEach(function(e){return s.make_(e,!t||(!(e in t)||t[e]))})}),e)}var Kn="splice",Un="update",$n={get:function(e,t){var i=e[vs];return t===vs?i:"length"===t?i.getArrayLength_():"string"!=typeof t||isNaN(t)?Ji(Yn,t)?Yn[t]:e[t]:i.get_(parseInt(t))},set:function(e,t,i){var s=e[vs];return"length"===t&&s.setArrayLength_(i),"symbol"==typeof t||isNaN(t)?e[t]=i:s.set_(parseInt(t),i),!0},preventExtensions:function(){Ci(15)}},qn=function(){function e(e,t,i,s){void 0===e&&(e="ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=i,this.legacyMode_=s,this.atom_=new ms(e),this.enhancer_=function(e,i){return t(e,i,"ObservableArray[..]")}}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.dehanceValues_=function(e){return void 0!==this.dehancer&&e.length>0?e.map(this.dehancer):e},t.intercept_=function(e){return Tn(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),In(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&Ci("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var i=new Array(e-t),s=0;s<e-t;s++)i[s]=void 0;this.spliceWithArray_(t,0,i)}else this.spliceWithArray_(e,t-e)},t.updateArrayLength_=function(e,t){e!==this.lastKnownLength_&&Ci(16),this.lastKnownLength_+=t,this.legacyMode_&&t>0&&Bo(e+t+1)},t.spliceWithArray_=function(e,t,i){var s=this;this.atom_;var r=this.values_.length;if(void 0===e?e=0:e>r?e=r:e<0&&(e=Math.max(0,r+e)),t=1===arguments.length?r-e:null==t?0:Math.max(0,Math.min(t,r-e)),void 0===i&&(i=Li),An(this)){var n=zn(this,{object:this.proxy_,type:Kn,index:e,removedCount:t,added:i});if(!n)return Li;t=n.removedCount,i=n.added}if(i=0===i.length?i:i.map(function(e){return s.enhancer_(e,void 0)}),this.legacyMode_){var o=i.length-t;this.updateArrayLength_(r,o)}var a=this.spliceItemsIntoValues_(e,t,i);return 0===t&&0===i.length||this.notifyArraySplice_(e,i,a),this.dehanceValues_(a)},t.spliceItemsIntoValues_=function(e,t,i){var s;if(i.length<1e4)return(s=this.values_).splice.apply(s,[e,t].concat(i));var r=this.values_.slice(e,e+t),n=this.values_.slice(e+t);this.values_.length+=i.length-t;for(var o=0;o<i.length;o++)this.values_[e+o]=i[o];for(var a=0;a<n.length;a++)this.values_[e+i.length+a]=n[a];return r},t.notifyArrayChildUpdate_=function(e,t,i){var s=!this.owned_&&!1,r=On(this),n=r||s?{observableKind:"array",object:this.proxy_,type:Un,debugObjectName:this.atom_.name_,index:e,newValue:t,oldValue:i}:null;this.atom_.reportChanged(),r&&Fn(this,n)},t.notifyArraySplice_=function(e,t,i){var s=!this.owned_&&!1,r=On(this),n=r||s?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Kn,index:e,removed:i,added:t,removedCount:i.length,addedCount:t.length}:null;this.atom_.reportChanged(),r&&Fn(this,n)},t.get_=function(e){if(!(this.legacyMode_&&e>=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var i=this.values_;if(this.legacyMode_&&e>i.length&&Ci(17,e,i.length),e<i.length){this.atom_;var s=i[e];if(An(this)){var r=zn(this,{type:Un,object:this.proxy_,index:e,newValue:t});if(!r)return;t=r.newValue}(t=this.enhancer_(t,s))!==s&&(i[e]=t,this.notifyArrayChildUpdate_(e,t,s))}else{for(var n=new Array(e+1-i.length),o=0;o<n.length-1;o++)n[o]=void 0;n[n.length-1]=t,this.spliceWithArray_(i.length,0,n)}},e}();function Vn(e,t,i,s){return void 0===i&&(i="ObservableArray"),void 0===s&&(s=!1),Ti(),Po(function(){var r=new qn(i,t,s,!1);$i(r.values_,vs,r);var n=new Proxy(r.values_,$n);return r.proxy_=n,e&&e.length&&r.spliceWithArray_(0,0,e),n})}var Yn={clear:function(){return this.splice(0)},replace:function(e){var t=this[vs];return t.spliceWithArray_(0,t.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,t){for(var i=arguments.length,s=new Array(i>2?i-2:0),r=2;r<i;r++)s[r-2]=arguments[r];var n=this[vs];switch(arguments.length){case 0:return[];case 1:return n.spliceWithArray_(e);case 2:return n.spliceWithArray_(e,t)}return n.spliceWithArray_(e,t,s)},spliceWithArray:function(e,t,i){return this[vs].spliceWithArray_(e,t,i)},push:function(){for(var e=this[vs],t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];return e.spliceWithArray_(e.values_.length,0,i),e.values_.length},pop:function(){return this.splice(Math.max(this[vs].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[vs],t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];return e.spliceWithArray_(0,0,i),e.values_.length},reverse:function(){return Ir.trackingDerivation&&Ci(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){Ir.trackingDerivation&&Ci(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[vs],i=t.dehanceValues_(t.values_).indexOf(e);return i>-1&&(this.splice(i,1),!0)}};function Gn(e,t){"function"==typeof Array.prototype[e]&&(Yn[e]=t(e))}function Xn(e){return function(){var t=this[vs];t.atom_.reportObserved();var i=t.dehanceValues_(t.values_);return i[e].apply(i,arguments)}}function Zn(e){return function(t,i){var s=this,r=this[vs];return r.atom_.reportObserved(),r.dehanceValues_(r.values_)[e](function(e,r){return t.call(i,e,r,s)})}}function Jn(e){return function(){var t=this,i=this[vs];i.atom_.reportObserved();var s=i.dehanceValues_(i.values_),r=arguments[0];return arguments[0]=function(e,i,s){return r(e,i,s,t)},s[e].apply(s,arguments)}}Gn("at",Xn),Gn("concat",Xn),Gn("flat",Xn),Gn("includes",Xn),Gn("indexOf",Xn),Gn("join",Xn),Gn("lastIndexOf",Xn),Gn("slice",Xn),Gn("toString",Xn),Gn("toLocaleString",Xn),Gn("toSorted",Xn),Gn("toSpliced",Xn),Gn("with",Xn),Gn("every",Zn),Gn("filter",Zn),Gn("find",Zn),Gn("findIndex",Zn),Gn("findLast",Zn),Gn("findLastIndex",Zn),Gn("flatMap",Zn),Gn("forEach",Zn),Gn("map",Zn),Gn("some",Zn),Gn("toReversed",Zn),Gn("reduce",Jn),Gn("reduceRight",Jn);var Qn=qi("ObservableArrayAdministration",qn);function eo(e){return Hi(e)&&Qn(e[vs])}var to={},io="add",so="delete",ro=function(){function e(e,t,i){var s=this;void 0===t&&(t=ys),void 0===i&&(i="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[vs]=to,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=i,Ii(Map)||Ci(18),Po(function(){s.keysAtom_=bs("ObservableMap.keys()"),s.data_=new Map,s.hasMap_=new Map,e&&s.merge(e)})}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!Ir.trackingDerivation)return this.has_(e);var i=this.hasMap_.get(e);if(!i){var s=i=new _r(this.has_(e),ws,"ObservableMap.key?",!1);this.hasMap_.set(e,s),_n(s,function(){return t.hasMap_.delete(e)})}return i.get()},t.set=function(e,t){var i=this.has_(e);if(An(this)){var s=zn(this,{type:i?Un:io,object:this,newValue:t,name:e});if(!s)return this;t=s.newValue}return i?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if((this.keysAtom_,An(this))&&!zn(this,{type:so,object:this,name:e}))return!1;if(this.has_(e)){var i=On(this),s=i?{observableKind:"map",debugObjectName:this.name_,type:so,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return Ln(function(){var i;t.keysAtom_.reportChanged(),null==(i=t.hasMap_.get(e))||i.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)}),i&&Fn(this,s),!0}return!1},t.updateValue_=function(e,t){var i=this.data_.get(e);if((t=i.prepareNewValue_(t))!==Ir.UNCHANGED){var s=On(this),r=s?{observableKind:"map",debugObjectName:this.name_,type:Un,object:this,oldValue:i.value_,name:e,newValue:t}:null;i.setNewValue_(t),s&&Fn(this,r)}},t.addValue_=function(e,t){var i=this;this.keysAtom_,Ln(function(){var s,r=new _r(t,i.enhancer_,"ObservableMap.key",!1);i.data_.set(e,r),t=r.value_,null==(s=i.hasMap_.get(e))||s.setNewValue_(!0),i.keysAtom_.reportChanged()});var s=On(this),r=s?{observableKind:"map",debugObjectName:this.name_,type:io,object:this,name:e,newValue:t}:null;s&&Fn(this,r)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.getOrInsert=function(e,t){return this.has(e)||this.set(e,t),this.get(e)},t.getOrInsertComputed=function(e,t){return this.has(e)||this.set(e,t(e)),this.get(e)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return oo({next:function(){var i=t.next(),s=i.done,r=i.value;return{done:s,value:s?void 0:e.get(r)}}})},t.entries=function(){var e=this,t=this.keys();return oo({next:function(){var i=t.next(),s=i.done,r=i.value;return{done:s,value:s?void 0:[r,e.get(r)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(e,t){for(var i,s=rs(this);!(i=s()).done;){var r=i.value,n=r[0],o=r[1];e.call(t,o,n,this)}},t.merge=function(e){var t=this;return no(e)&&(e=new Map(e)),Ln(function(){var i,s,r;Wi(e)?function(e){var t=Object.keys(e);if(!Gi)return t;var i=Object.getOwnPropertySymbols(e);return i.length?[].concat(t,i.filter(function(t){return Di.propertyIsEnumerable.call(e,t)})):t}(e).forEach(function(i){return t.set(i,e[i])}):Array.isArray(e)?e.forEach(function(e){var i=e[0],s=e[1];return t.set(i,s)}):Vi(e)?(i=e,s=Object.getPrototypeOf(i),r=Object.getPrototypeOf(s),null!==Object.getPrototypeOf(r)&&Ci(19,e),e.forEach(function(e,i){return t.set(i,e)})):null!=e&&Ci(20,e)}),this},t.clear=function(){var e=this;Ln(function(){Er(function(){for(var t,i=rs(e.keys());!(t=i()).done;){var s=t.value;e.delete(s)}})})},t.replace=function(e){var t=this;return Ln(function(){for(var i,s=function(e){if(Vi(e)||no(e))return e;if(Array.isArray(e))return new Map(e);if(Wi(e)){var t=new Map;for(var i in e)t.set(i,e[i]);return t}return Ci(21,e)}(e),r=new Map,n=!1,o=rs(t.data_.keys());!(i=o()).done;){var a=i.value;if(!s.has(a))if(t.delete(a))n=!0;else{var l=t.data_.get(a);r.set(a,l)}}for(var c,h=rs(s.entries());!(c=h()).done;){var u=c.value,d=u[0],f=u[1],p=t.data_.has(d);if(t.set(d,f),t.data_.has(d)){var g=t.data_.get(d);r.set(d,g),p||(n=!0)}}if(!n)if(t.data_.size!==r.size)t.keysAtom_.reportChanged();else for(var v=t.data_.keys(),m=r.keys(),_=v.next(),b=m.next();!_.done;){if(_.value!==b.value){t.keysAtom_.reportChanged();break}_=v.next(),b=m.next()}t.data_=r}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return In(this,e)},t.intercept_=function(e){return Tn(this,e)},ss(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),no=qi("ObservableMap",ro);function oo(e){return e[Symbol.toStringTag]="MapIterator",Fo(e)}var ao={},lo=function(){function e(e,t,i){var s=this;void 0===t&&(t=ys),void 0===i&&(i="ObservableSet"),this.name_=void 0,this[vs]=ao,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=i,Ii(Set)||Ci(22),this.enhancer_=function(e,s){return t(e,s,i)},Po(function(){s.atom_=bs(s.name_),e&&s.replace(e)})}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;Ln(function(){Er(function(){for(var t,i=rs(e.data_.values());!(t=i()).done;){var s=t.value;e.delete(s)}})})},t.forEach=function(e,t){for(var i,s=rs(this);!(i=s()).done;){var r=i.value;e.call(t,r,r,this)}},t.add=function(e){var t=this;if(this.atom_,An(this)){var i=zn(this,{type:io,object:this,newValue:e});if(!i)return this;e=i.newValue}if(!this.has(e)){Ln(function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()});var s=On(this),r=s?{observableKind:"set",debugObjectName:this.name_,type:io,object:this,newValue:e}:null;s&&Fn(this,r)}return this},t.delete=function(e){var t=this;if(An(this)&&!zn(this,{type:so,object:this,oldValue:e}))return!1;if(this.has(e)){var i=On(this),s=i?{observableKind:"set",debugObjectName:this.name_,type:so,object:this,oldValue:e}:null;return Ln(function(){t.atom_.reportChanged(),t.data_.delete(e)}),i&&Fn(this,s),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=this.values();return ho({next:function(){var t=e.next(),i=t.value,s=t.done;return s?{value:void 0,done:s}:{value:[i,i],done:s}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var e=this,t=this.data_.values();return ho({next:function(){var i=t.next(),s=i.value,r=i.done;return r?{value:void 0,done:r}:{value:e.dehanceValue_(s),done:r}}})},t.intersection=function(e){return Yi(e)&&!co(e)?e.intersection(this):new Set(this).intersection(e)},t.union=function(e){return Yi(e)&&!co(e)?e.union(this):new Set(this).union(e)},t.difference=function(e){return new Set(this).difference(e)},t.symmetricDifference=function(e){return Yi(e)&&!co(e)?e.symmetricDifference(this):new Set(this).symmetricDifference(e)},t.isSubsetOf=function(e){return new Set(this).isSubsetOf(e)},t.isSupersetOf=function(e){return new Set(this).isSupersetOf(e)},t.isDisjointFrom=function(e){return Yi(e)&&!co(e)?e.isDisjointFrom(this):new Set(this).isDisjointFrom(e)},t.replace=function(e){var t=this;return co(e)&&(e=new Set(e)),Ln(function(){Array.isArray(e)||Yi(e)?(t.clear(),e.forEach(function(e){return t.add(e)})):null!=e&&Ci("Cannot initialize set from "+e)}),this},t.observe_=function(e,t){return In(this,e)},t.intercept_=function(e){return Tn(this,e)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},ss(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),co=qi("ObservableSet",lo);function ho(e){return e[Symbol.toStringTag]="SetIterator",Fo(e)}var uo=Object.create(null),fo="remove",po=function(){function e(e,t,i,s){void 0===t&&(t=new Map),void 0===s&&(s=Ks),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.lazyComputedKeys_=void 0,this.lazyObservableKeys_=void 0,this.target_=e,this.values_=t,this.name_=i,this.defaultAnnotation_=s,this.keysAtom_=new ms("ObservableObject.keys"),this.isPlainObject_=Wi(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(e){var t,i;return(null!=(t=null!=(i=this.values_.get(e))?i:this.materializeLazyComputed_(e))?t:this.materializeLazyObservable_(e)).get()},t.materializeLazyComputed_=function(e){var t,i=null==(t=this.lazyComputedKeys_)?void 0:t.get(e);if(i){this.lazyComputedKeys_.delete(e),0===this.lazyComputedKeys_.size&&(this.lazyComputedKeys_=void 0);var s=i();return this.values_.set(e,s),s}},t.materializeLazyObservable_=function(e){var t,i=null==(t=this.lazyObservableKeys_)?void 0:t.get(e);if(i){this.lazyObservableKeys_.delete(e),0===this.lazyObservableKeys_.size&&(this.lazyObservableKeys_=void 0);var s=i();return this.values_.set(e,s),s}},t.setObservablePropValue_=function(e,t){var i,s,r=null!=(i=null!=(s=this.values_.get(e))?s:this.materializeLazyComputed_(e))?i:this.materializeLazyObservable_(e);if(r instanceof br)return r.set(t),!0;if(An(this)){var n=zn(this,{type:Un,object:this.proxy_||this.target_,name:e,newValue:t});if(!n)return null;t=n.newValue}if((t=r.prepareNewValue_(t))!==Ir.UNCHANGED){var o=On(this),a=o?{type:Un,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),o&&Fn(this,a)}return!0},t.get_=function(e){return Ir.trackingDerivation&&!Ji(this.target_,e)&&this.has_(e),this.target_[e]},t.set_=function(e,t,i){return void 0===i&&(i=!1),Ji(this.target_,e)?this.values_.has(e)?this.setObservablePropValue_(e,t):i?Reflect.set(this.target_,e,t):(this.target_[e]=t,!0):this.extend_(e,{value:t,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,i)},t.has_=function(e){if(!Ir.trackingDerivation)return e in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var t=this.pendingKeys_.get(e);return t||(t=new _r(e in this.target_,ws,"ObservableObject.key?",!1),this.pendingKeys_.set(e,t)),t.get()},t.make_=function(e,t){if(!0===t&&(t=this.defaultAnnotation_),!1!==t){if(!(e in this.target_)){var i;if(null!=(i=this.target_[ds])&&i[e])return;Ci(1,t.annotationType_,this.name_+"."+e.toString())}for(var s=this.target_;s&&s!==Di;){var r=Bi(s,e);if(r){var n=t.make_(this,e,r,s);if(0===n)return;if(1===n)break}s=Object.getPrototypeOf(s)}bo(this,t,e)}},t.extend_=function(e,t,i,s){if(void 0===s&&(s=!1),!0===i&&(i=this.defaultAnnotation_),!1===i)return this.defineProperty_(e,t,s);var r=i.extend_(this,e,t,s);return r&&bo(this,i,e),r},t.defineProperty_=function(e,t,i){void 0===i&&(i=!1),this.keysAtom_;try{Kr();var s=this.delete_(e);if(!s)return s;if(An(this)){var r=zn(this,{object:this.proxy_||this.target_,name:e,type:io,newValue:t.value});if(!r)return null;var n=r.newValue;t.value!==n&&(t=ns({},t,{value:n}))}if(i){if(!Reflect.defineProperty(this.target_,e,t))return!1}else Ei(this.target_,e,t);this.notifyPropertyAddition_(e,t.value)}finally{Ur()}return!0},t.defineObservableProperty_=function(e,t,i,s){void 0===s&&(s=!1),this.keysAtom_;try{Kr();var r=this.delete_(e);if(!r)return r;if(An(this)){var n=zn(this,{object:this.proxy_||this.target_,name:e,type:io,newValue:t});if(!n)return null;t=n.newValue}var o=mo(e),a={configurable:!Ir.safeDescriptors||this.isPlainObject_,enumerable:!0,get:o.get,set:o.set};if(s){if(!Reflect.defineProperty(this.target_,e,a))return!1}else Ei(this.target_,e,a);var l=new _r(t,i,"ObservableObject.key",!1);this.values_.set(e,l),this.notifyPropertyAddition_(e,l.value_)}finally{Ur()}return!0},t.defineComputedProperty_=function(e,t,i){void 0===i&&(i=!1),this.keysAtom_;try{Kr();var s=this.delete_(e);if(!s)return s;if(An(this))if(!zn(this,{object:this.proxy_||this.target_,name:e,type:io,newValue:void 0}))return null;t.name||(t.name="ObservableObject.key"),t.context=this.proxy_||this.target_;var r=mo(e),n={configurable:!Ir.safeDescriptors||this.isPlainObject_,enumerable:!1,get:r.get,set:r.set};if(i){if(!Reflect.defineProperty(this.target_,e,n))return!1}else Ei(this.target_,e,n);this.values_.set(e,new br(t)),this.notifyPropertyAddition_(e,void 0)}finally{Ur()}return!0},t.delete_=function(e,t){if(void 0===t&&(t=!1),this.keysAtom_,!Ji(this.target_,e))return!0;if(An(this)&&!zn(this,{object:this.proxy_||this.target_,name:e,type:fo}))return null;try{var i;Kr();var s,r=On(this),n=this.values_.get(e),o=void 0;if(!n&&r)o=null==(s=Bi(this.target_,e))?void 0:s.value;if(t){if(!Reflect.deleteProperty(this.target_,e))return!1}else delete this.target_[e];if(n&&(this.values_.delete(e),n instanceof _r&&(o=n.value_),qr(n)),this.keysAtom_.reportChanged(),null==(i=this.pendingKeys_)||null==(i=i.get(e))||i.set(e in this.target_),r){var a={type:fo,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:o,name:e};0,r&&Fn(this,a)}}finally{Ur()}return!0},t.observe_=function(e,t){return In(this,e)},t.intercept_=function(e){return Tn(this,e)},t.notifyPropertyAddition_=function(e,t){var i,s=On(this);if(s){var r=s?{type:io,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:e,newValue:t}:null;s&&Fn(this,r)}null==(i=this.pendingKeys_)||null==(i=i.get(e))||i.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),Xi(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function go(e,t){var i;if(Ji(e,vs))return e;var s=null!=(i=null==t?void 0:t.name)?i:"ObservableObject",r=new po(e,new Map,String(s),function(e){var t;return e?null!=(t=e.defaultDecorator)?t:Us(e):void 0}(t));return Ui(e,vs,r),e}var vo=qi("ObservableObjectAdministration",po);function mo(e){return uo[e]||(uo[e]={get:function(){return this[vs].getObservablePropValue_(e)},set:function(t){return this[vs].setObservablePropValue_(e,t)}})}function _o(e){return!!Hi(e)&&vo(e[vs])}function bo(e,t,i){var s;null==(s=e.target_[ds])||delete s[i]}var xo,yo,wo=No(0),So=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,!1===e}(),ko=0,Co=function(){};xo=Co,yo=Array.prototype,Object.setPrototypeOf?Object.setPrototypeOf(xo.prototype,yo):void 0!==xo.prototype.__proto__?xo.prototype.__proto__=yo:xo.prototype=yo;var jo=function(e){function t(t,i,s,r){var n;return void 0===s&&(s="ObservableArray"),void 0===r&&(r=!1),n=e.call(this)||this,Po(function(){var e=new qn(s,i,r,!0);e.proxy_=n,$i(n,vs,e),t&&t.length&&n.spliceWithArray(0,0,t),So&&Object.defineProperty(n,"0",wo)}),n}as(t,e);var i=t.prototype;return i.concat=function(){this[vs].atom_.reportObserved();for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return Array.prototype.concat.apply(this.slice(),t.map(function(e){return eo(e)?e.slice():e}))},i[Symbol.iterator]=function(){var e=this,t=0;return Fo({next:function(){return t<e.length?{value:e[t++],done:!1}:{done:!0,value:void 0}}})},ss(t,[{key:"length",get:function(){return this[vs].getArrayLength_()},set:function(e){this[vs].setArrayLength_(e)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(Co);function No(e){return{enumerable:!1,configurable:!0,get:function(){return this[vs].get_(e)},set:function(t){this[vs].set_(e,t)}}}function Mo(e){Ei(jo.prototype,""+e,No(e))}function Bo(e){if(e>ko){for(var t=ko;t<e+100;t++)Mo(t);ko=e}}function Eo(e,t,i){return new jo(e,t,i)}function Do(e,t){if("object"==typeof e&&null!==e){if(eo(e))return void 0!==t&&Ci(23),e[vs].atom_;if(co(e))return e.atom_;if(no(e)){if(void 0===t)return e.keysAtom_;var i=e.data_.get(t)||e.hasMap_.get(t);return i||Ci(25,t,Lo(e)),i}if(_o(e)){var s,r;if(!t)return Ci(26);var n=e[vs],o=null!=(s=null!=(r=n.values_.get(t))?r:n.materializeLazyComputed_(t))?s:n.materializeLazyObservable_(t);return o||Ci(27,t,Lo(e)),o}if(_s(e)||kr(e)||Jr(e))return e}else if(Ii(e)&&Jr(e[vs]))return e[vs];Ci(28)}function Lo(e,t){var i;if(void 0!==t)i=Do(e,t);else{if(un(e))return e.name;i=_o(e)||no(e)||co(e)?function(e){return e||Ci(29),_s(e)||kr(e)||Jr(e)||no(e)||co(e)?e:e[vs]?e[vs]:void Ci(24,e)}(e):Do(e)}return i.name_}function Po(e){var t=Dr(),i=vr(!0);Kr();try{return e()}finally{Ur(),mr(i),Lr(t)}}Object.entries(Yn).forEach(function(e){var t=e[0],i=e[1];"concat"!==t&&Ui(jo.prototype,t,i)}),Bo(1e3);var Ro,Ao=Di.toString;function To(e,t,i){return void 0===i&&(i=-1),zo(e,t,i)}function zo(e,t,i,s,r){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return!1;if(e!=e)return t!=t;var n=typeof e;if("function"!==n&&"object"!==n&&"object"!=typeof t)return!1;var o=Ao.call(e);if(o!==Ao.call(t))return!1;switch(o){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:0===+e?1/+e==1/t:+e===+t;case"[object Date]":case"[object Boolean]":return+e===+t;case"[object Symbol]":return"undefined"!=typeof Symbol&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":i>=0&&i++}e=Oo(e),t=Oo(t);var a="[object Array]"===o;if(!a){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,c=t.constructor;if(l!==c&&!(Ii(l)&&l instanceof l&&Ii(c)&&c instanceof c)&&"constructor"in e&&"constructor"in t)return!1}if(0===i)return!1;i<0&&(i=-1),r=r||[];for(var h=(s=s||[]).length;h--;)if(s[h]===e)return r[h]===t;if(s.push(e),r.push(t),a){if((h=e.length)!==t.length)return!1;for(;h--;)if(!zo(e[h],t[h],i-1,s,r))return!1}else{var u=Object.keys(e),d=u.length;if(Object.keys(t).length!==d)return!1;for(var f=0;f<d;f++){var p=u[f];if(!Ji(t,p)||!zo(e[p],t[p],i-1,s,r))return!1}}return s.pop(),r.pop(),!0}function Oo(e){return eo(e)?e.slice():Vi(e)||no(e)||Yi(e)||co(e)?Array.from(e.entries()):e}var Io=(null==(Ro=Ni().Iterator)?void 0:Ro.prototype)||{};function Fo(e){return e[Symbol.iterator]=Ho,Object.assign(Object.create(Io),e)}function Ho(){return this}["Symbol","Map","Set"].forEach(function(e){void 0===Ni()[e]&&Ci("MobX requires global '"+e+"' to be available or polyfilled")}),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:Lo},$mobx:vs});var Wo={exports:{}},Ko={},Uo={exports:{}},$o={};
12
12
  /**
13
13
  * @license React
14
14
  * scheduler.production.min.js
@@ -18,7 +18,7 @@ var e,t,i,s,r,n,o,a,l,c,h,u,d,f,p,g,v,m,_,b,x,y,w,S,k,C,j,N,M,E,B,D,L,R,P,A,T,z,
18
18
  * This source code is licensed under the MIT license found in the
19
19
  * LICENSE file in the root directory of this source tree.
20
20
  */
21
- !function(e){function t(e,t){var i=e.length;e.push(t);e:for(;0<i;){var s=i-1>>>1,n=e[s];if(!(0<r(n,t)))break e;e[s]=t,e[i]=n,i=s}}function i(e){return 0===e.length?null:e[0]}function s(e){if(0===e.length)return null;var t=e[0],i=e.pop();if(i!==t){e[0]=i;e:for(var s=0,n=e.length,o=n>>>1;s<o;){var a=2*(s+1)-1,l=e[a],c=a+1,h=e[c];if(0>r(l,i))c<n&&0>r(h,l)?(e[s]=h,e[c]=i,s=c):(e[s]=l,e[a]=i,s=a);else{if(!(c<n&&0>r(h,i)))break e;e[s]=h,e[c]=i,s=c}}}return t}function r(e,t){var i=e.sortIndex-t.sortIndex;return 0!==i?i:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var n=performance;e.unstable_now=function(){return n.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],c=[],h=1,u=null,d=3,f=!1,p=!1,g=!1,v="function"==typeof setTimeout?setTimeout:null,m="function"==typeof clearTimeout?clearTimeout:null,_="undefined"!=typeof setImmediate?setImmediate:null;function b(e){for(var r=i(c);null!==r;){if(null===r.callback)s(c);else{if(!(r.startTime<=e))break;s(c),r.sortIndex=r.expirationTime,t(l,r)}r=i(c)}}function x(e){if(g=!1,b(e),!p)if(null!==i(l))p=!0,L(y);else{var t=i(c);null!==t&&R(x,t.startTime-e)}}function y(t,r){p=!1,g&&(g=!1,m(C),C=-1),f=!0;var n=d;try{for(b(r),u=i(l);null!==u&&(!(u.expirationTime>r)||t&&!M());){var o=u.callback;if("function"==typeof o){u.callback=null,d=u.priorityLevel;var a=o(u.expirationTime<=r);r=e.unstable_now(),"function"==typeof a?u.callback=a:u===i(l)&&s(l),b(r)}else s(l);u=i(l)}if(null!==u)var h=!0;else{var v=i(c);null!==v&&R(x,v.startTime-r),h=!1}return h}finally{u=null,d=n,f=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var w,S=!1,k=null,C=-1,j=5,N=-1;function M(){return!(e.unstable_now()-N<j)}function E(){if(null!==k){var t=e.unstable_now();N=t;var i=!0;try{i=k(!0,t)}finally{i?w():(S=!1,k=null)}}else S=!1}if("function"==typeof _)w=function(){_(E)};else if("undefined"!=typeof MessageChannel){var B=new MessageChannel,D=B.port2;B.port1.onmessage=E,w=function(){D.postMessage(null)}}else w=function(){v(E,0)};function L(e){k=e,S||(S=!0,w())}function R(t,i){C=v(function(){t(e.unstable_now())},i)}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(e){e.callback=null},e.unstable_continueExecution=function(){p||f||(p=!0,L(y))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return d},e.unstable_getFirstCallbackNode=function(){return i(l)},e.unstable_next=function(e){switch(d){case 1:case 2:case 3:var t=3;break;default:t=d}var i=d;d=t;try{return e()}finally{d=i}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var i=d;d=e;try{return t()}finally{d=i}},e.unstable_scheduleCallback=function(s,r,n){var o=e.unstable_now();switch("object"==typeof n&&null!==n?n="number"==typeof(n=n.delay)&&0<n?o+n:o:n=o,s){case 1:var a=-1;break;case 2:a=250;break;case 5:a=1073741823;break;case 4:a=1e4;break;default:a=5e3}return s={id:h++,callback:r,priorityLevel:s,startTime:n,expirationTime:a=n+a,sortIndex:-1},n>o?(s.sortIndex=n,t(c,s),null===i(l)&&s===i(c)&&(g?(m(C),C=-1):g=!0,R(x,n-o))):(s.sortIndex=a,t(l,s),p||f||(p=!0,L(y))),s},e.unstable_shouldYield=M,e.unstable_wrapCallback=function(e){var t=d;return function(){var i=d;d=t;try{return e.apply(this,arguments)}finally{d=i}}}}(qo),Uo.exports=qo;var $o=Uo.exports,Vo=gi,Yo=$o;
21
+ !function(e){function t(e,t){var i=e.length;e.push(t);e:for(;0<i;){var s=i-1>>>1,n=e[s];if(!(0<r(n,t)))break e;e[s]=t,e[i]=n,i=s}}function i(e){return 0===e.length?null:e[0]}function s(e){if(0===e.length)return null;var t=e[0],i=e.pop();if(i!==t){e[0]=i;e:for(var s=0,n=e.length,o=n>>>1;s<o;){var a=2*(s+1)-1,l=e[a],c=a+1,h=e[c];if(0>r(l,i))c<n&&0>r(h,l)?(e[s]=h,e[c]=i,s=c):(e[s]=l,e[a]=i,s=a);else{if(!(c<n&&0>r(h,i)))break e;e[s]=h,e[c]=i,s=c}}}return t}function r(e,t){var i=e.sortIndex-t.sortIndex;return 0!==i?i:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var n=performance;e.unstable_now=function(){return n.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],c=[],h=1,u=null,d=3,f=!1,p=!1,g=!1,v="function"==typeof setTimeout?setTimeout:null,m="function"==typeof clearTimeout?clearTimeout:null,_="undefined"!=typeof setImmediate?setImmediate:null;function b(e){for(var r=i(c);null!==r;){if(null===r.callback)s(c);else{if(!(r.startTime<=e))break;s(c),r.sortIndex=r.expirationTime,t(l,r)}r=i(c)}}function x(e){if(g=!1,b(e),!p)if(null!==i(l))p=!0,L(y);else{var t=i(c);null!==t&&P(x,t.startTime-e)}}function y(t,r){p=!1,g&&(g=!1,m(C),C=-1),f=!0;var n=d;try{for(b(r),u=i(l);null!==u&&(!(u.expirationTime>r)||t&&!M());){var o=u.callback;if("function"==typeof o){u.callback=null,d=u.priorityLevel;var a=o(u.expirationTime<=r);r=e.unstable_now(),"function"==typeof a?u.callback=a:u===i(l)&&s(l),b(r)}else s(l);u=i(l)}if(null!==u)var h=!0;else{var v=i(c);null!==v&&P(x,v.startTime-r),h=!1}return h}finally{u=null,d=n,f=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var w,S=!1,k=null,C=-1,j=5,N=-1;function M(){return!(e.unstable_now()-N<j)}function B(){if(null!==k){var t=e.unstable_now();N=t;var i=!0;try{i=k(!0,t)}finally{i?w():(S=!1,k=null)}}else S=!1}if("function"==typeof _)w=function(){_(B)};else if("undefined"!=typeof MessageChannel){var E=new MessageChannel,D=E.port2;E.port1.onmessage=B,w=function(){D.postMessage(null)}}else w=function(){v(B,0)};function L(e){k=e,S||(S=!0,w())}function P(t,i){C=v(function(){t(e.unstable_now())},i)}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(e){e.callback=null},e.unstable_continueExecution=function(){p||f||(p=!0,L(y))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return d},e.unstable_getFirstCallbackNode=function(){return i(l)},e.unstable_next=function(e){switch(d){case 1:case 2:case 3:var t=3;break;default:t=d}var i=d;d=t;try{return e()}finally{d=i}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var i=d;d=e;try{return t()}finally{d=i}},e.unstable_scheduleCallback=function(s,r,n){var o=e.unstable_now();switch("object"==typeof n&&null!==n?n="number"==typeof(n=n.delay)&&0<n?o+n:o:n=o,s){case 1:var a=-1;break;case 2:a=250;break;case 5:a=1073741823;break;case 4:a=1e4;break;default:a=5e3}return s={id:h++,callback:r,priorityLevel:s,startTime:n,expirationTime:a=n+a,sortIndex:-1},n>o?(s.sortIndex=n,t(c,s),null===i(l)&&s===i(c)&&(g?(m(C),C=-1):g=!0,P(x,n-o))):(s.sortIndex=a,t(l,s),p||f||(p=!0,L(y))),s},e.unstable_shouldYield=M,e.unstable_wrapCallback=function(e){var t=d;return function(){var i=d;d=t;try{return e.apply(this,arguments)}finally{d=i}}}}($o),Uo.exports=$o;var qo=Uo.exports,Vo=gi,Yo=qo;
22
22
  /**
23
23
  * @license React
24
24
  * react-dom.production.min.js
@@ -27,7 +27,7 @@ var e,t,i,s,r,n,o,a,l,c,h,u,d,f,p,g,v,m,_,b,x,y,w,S,k,C,j,N,M,E,B,D,L,R,P,A,T,z,
27
27
  *
28
28
  * This source code is licensed under the MIT license found in the
29
29
  * LICENSE file in the root directory of this source tree.
30
- */function Go(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,i=1;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Xo=new Set,Jo={};function Zo(e,t){Qo(e,t),Qo(e+"Capture",t)}function Qo(e,t){for(Jo[e]=t,e=0;e<t.length;e++)Xo.add(t[e])}var ea=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),ta=Object.prototype.hasOwnProperty,ia=/^[: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]*$/,sa={},ra={};function na(e,t,i,s,r,n,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=s,this.attributeNamespace=r,this.mustUseProperty=i,this.propertyName=e,this.type=t,this.sanitizeURL=n,this.removeEmptyString=o}var oa={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){oa[e]=new na(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];oa[t]=new na(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){oa[e]=new na(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){oa[e]=new na(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){oa[e]=new na(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){oa[e]=new na(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){oa[e]=new na(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){oa[e]=new na(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){oa[e]=new na(e,5,!1,e.toLowerCase(),null,!1,!1)});var aa=/[\-:]([a-z])/g;function la(e){return e[1].toUpperCase()}function ca(e,t,i,s){var r=oa.hasOwnProperty(t)?oa[t]:null;(null!==r?0!==r.type:s||!(2<t.length)||"o"!==t[0]&&"O"!==t[0]||"n"!==t[1]&&"N"!==t[1])&&(function(e,t,i,s){if(null==t||function(e,t,i,s){if(null!==i&&0===i.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!s&&(null!==i?!i.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,i,s))return!0;if(s)return!1;if(null!==i)switch(i.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,i,r,s)&&(i=null),s||null===r?function(e){return!!ta.call(ra,e)||!ta.call(sa,e)&&(ia.test(e)?ra[e]=!0:(sa[e]=!0,!1))}(t)&&(null===i?e.removeAttribute(t):e.setAttribute(t,""+i)):r.mustUseProperty?e[r.propertyName]=null===i?3!==r.type&&"":i:(t=r.attributeName,s=r.attributeNamespace,null===i?e.removeAttribute(t):(i=3===(r=r.type)||4===r&&!0===i?"":""+i,s?e.setAttributeNS(s,t,i):e.setAttribute(t,i))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(aa,la);oa[t]=new na(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(aa,la);oa[t]=new na(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(aa,la);oa[t]=new na(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){oa[e]=new na(e,1,!1,e.toLowerCase(),null,!1,!1)}),oa.xlinkHref=new na("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){oa[e]=new na(e,1,!1,e.toLowerCase(),null,!0,!0)});var ha=Vo.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ua=Symbol.for("react.element"),da=Symbol.for("react.portal"),fa=Symbol.for("react.fragment"),pa=Symbol.for("react.strict_mode"),ga=Symbol.for("react.profiler"),va=Symbol.for("react.provider"),ma=Symbol.for("react.context"),_a=Symbol.for("react.forward_ref"),ba=Symbol.for("react.suspense"),xa=Symbol.for("react.suspense_list"),ya=Symbol.for("react.memo"),wa=Symbol.for("react.lazy"),Sa=Symbol.for("react.offscreen"),ka=Symbol.iterator;function Ca(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=ka&&e[ka]||e["@@iterator"])?e:null}var ja,Na=Object.assign;function Ma(e){if(void 0===ja)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);ja=t&&t[1]||""}return"\n"+ja+e}var Ea=!1;function Ba(e,t){if(!e||Ea)return"";Ea=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var s=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){s=c}e.call(t.prototype)}else{try{throw Error()}catch(c){s=c}e()}}catch(c){if(c&&s&&"string"==typeof c.stack){for(var r=c.stack.split("\n"),n=s.stack.split("\n"),o=r.length-1,a=n.length-1;1<=o&&0<=a&&r[o]!==n[a];)a--;for(;1<=o&&0<=a;o--,a--)if(r[o]!==n[a]){if(1!==o||1!==a)do{if(o--,0>--a||r[o]!==n[a]){var l="\n"+r[o].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}}while(1<=o&&0<=a);break}}}finally{Ea=!1,Error.prepareStackTrace=i}return(e=e?e.displayName||e.name:"")?Ma(e):""}function Da(e){switch(e.tag){case 5:return Ma(e.type);case 16:return Ma("Lazy");case 13:return Ma("Suspense");case 19:return Ma("SuspenseList");case 0:case 2:case 15:return e=Ba(e.type,!1);case 11:return e=Ba(e.type.render,!1);case 1:return e=Ba(e.type,!0);default:return""}}function La(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case fa:return"Fragment";case da:return"Portal";case ga:return"Profiler";case pa:return"StrictMode";case ba:return"Suspense";case xa:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case ma:return(e.displayName||"Context")+".Consumer";case va:return(e._context.displayName||"Context")+".Provider";case _a:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case ya:return null!==(t=e.displayName||null)?t:La(e.type)||"Memo";case wa:t=e._payload,e=e._init;try{return La(e(t))}catch(i){}}return null}function Ra(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return La(t);case 8:return t===pa?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t}return null}function Pa(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function Aa(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function Ta(e){e._valueTracker||(e._valueTracker=function(e){var t=Aa(e)?"checked":"value",i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),s=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==i&&"function"==typeof i.get&&"function"==typeof i.set){var r=i.get,n=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(e){s=""+e,n.call(this,e)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return s},setValue:function(e){s=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function za(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),s="";return e&&(s=Aa(e)?e.checked?"true":"false":e.value),(e=s)!==i&&(t.setValue(e),!0)}function Oa(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function Ia(e,t){var i=t.checked;return Na({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=i?i:e._wrapperState.initialChecked})}function Fa(e,t){var i=null==t.defaultValue?"":t.defaultValue,s=null!=t.checked?t.checked:t.defaultChecked;i=Pa(null!=t.value?t.value:i),e._wrapperState={initialChecked:s,initialValue:i,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function Ha(e,t){null!=(t=t.checked)&&ca(e,"checked",t,!1)}function Wa(e,t){Ha(e,t);var i=Pa(t.value),s=t.type;if(null!=i)"number"===s?(0===i&&""===e.value||e.value!=i)&&(e.value=""+i):e.value!==""+i&&(e.value=""+i);else if("submit"===s||"reset"===s)return void e.removeAttribute("value");t.hasOwnProperty("value")?Ua(e,t.type,i):t.hasOwnProperty("defaultValue")&&Ua(e,t.type,Pa(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function Ka(e,t,i){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var s=t.type;if(!("submit"!==s&&"reset"!==s||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,i||t===e.value||(e.value=t),e.defaultValue=t}""!==(i=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==i&&(e.name=i)}function Ua(e,t,i){"number"===t&&Oa(e.ownerDocument)===e||(null==i?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+i&&(e.defaultValue=""+i))}var qa=Array.isArray;function $a(e,t,i,s){if(e=e.options,t){t={};for(var r=0;r<i.length;r++)t["$"+i[r]]=!0;for(i=0;i<e.length;i++)r=t.hasOwnProperty("$"+e[i].value),e[i].selected!==r&&(e[i].selected=r),r&&s&&(e[i].defaultSelected=!0)}else{for(i=""+Pa(i),t=null,r=0;r<e.length;r++){if(e[r].value===i)return e[r].selected=!0,void(s&&(e[r].defaultSelected=!0));null!==t||e[r].disabled||(t=e[r])}null!==t&&(t.selected=!0)}}function Va(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(Go(91));return Na({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Ya(e,t){var i=t.value;if(null==i){if(i=t.children,t=t.defaultValue,null!=i){if(null!=t)throw Error(Go(92));if(qa(i)){if(1<i.length)throw Error(Go(93));i=i[0]}t=i}null==t&&(t=""),i=t}e._wrapperState={initialValue:Pa(i)}}function Ga(e,t){var i=Pa(t.value),s=Pa(t.defaultValue);null!=i&&((i=""+i)!==e.value&&(e.value=i),null==t.defaultValue&&e.defaultValue!==i&&(e.defaultValue=i)),null!=s&&(e.defaultValue=""+s)}function Xa(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}function Ja(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Za(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?Ja(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var Qa,el,tl=(el=function(e,t){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=t;else{for((Qa=Qa||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Qa.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,i,s){MSApp.execUnsafeLocalFunction(function(){return el(e,t)})}:el);function il(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&3===i.nodeType)return void(i.nodeValue=t)}e.textContent=t}var sl={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},rl=["Webkit","ms","Moz","O"];function nl(e,t,i){return null==t||"boolean"==typeof t||""===t?"":i||"number"!=typeof t||0===t||sl.hasOwnProperty(e)&&sl[e]?(""+t).trim():t+"px"}function ol(e,t){for(var i in e=e.style,t)if(t.hasOwnProperty(i)){var s=0===i.indexOf("--"),r=nl(i,t[i],s);"float"===i&&(i="cssFloat"),s?e.setProperty(i,r):e[i]=r}}Object.keys(sl).forEach(function(e){rl.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),sl[t]=sl[e]})});var al=Na({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ll(e,t){if(t){if(al[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(Go(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(Go(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(Go(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(Go(62))}}function cl(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){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 hl=null;function ul(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var dl=null,fl=null,pl=null;function gl(e){if(e=ld(e)){if("function"!=typeof dl)throw Error(Go(280));var t=e.stateNode;t&&(t=hd(t),dl(e.stateNode,e.type,t))}}function vl(e){fl?pl?pl.push(e):pl=[e]:fl=e}function ml(){if(fl){var e=fl,t=pl;if(pl=fl=null,gl(e),t)for(e=0;e<t.length;e++)gl(t[e])}}function _l(e,t){return e(t)}function bl(){}var xl=!1;function yl(e,t,i){if(xl)return e(t,i);xl=!0;try{return _l(e,t,i)}finally{xl=!1,(null!==fl||null!==pl)&&(bl(),ml())}}function wl(e,t){var i=e.stateNode;if(null===i)return null;var s=hd(i);if(null===s)return null;i=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(s=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!s;break e;default:e=!1}if(e)return null;if(i&&"function"!=typeof i)throw Error(Go(231,t,typeof i));return i}var Sl=!1;if(ea)try{var kl={};Object.defineProperty(kl,"passive",{get:function(){Sl=!0}}),window.addEventListener("test",kl,kl),window.removeEventListener("test",kl,kl)}catch(el){Sl=!1}function Cl(e,t,i,s,r,n,o,a,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(i,c)}catch(h){this.onError(h)}}var jl=!1,Nl=null,Ml=!1,El=null,Bl={onError:function(e){jl=!0,Nl=e}};function Dl(e,t,i,s,r,n,o,a,l){jl=!1,Nl=null,Cl.apply(Bl,arguments)}function Ll(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{!!(4098&(t=e).flags)&&(i=t.return),e=t.return}while(e)}return 3===t.tag?i:null}function Rl(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function Pl(e){if(Ll(e)!==e)throw Error(Go(188))}function Al(e){return null!==(e=function(e){var t=e.alternate;if(!t){if(null===(t=Ll(e)))throw Error(Go(188));return t!==e?null:e}for(var i=e,s=t;;){var r=i.return;if(null===r)break;var n=r.alternate;if(null===n){if(null!==(s=r.return)){i=s;continue}break}if(r.child===n.child){for(n=r.child;n;){if(n===i)return Pl(r),e;if(n===s)return Pl(r),t;n=n.sibling}throw Error(Go(188))}if(i.return!==s.return)i=r,s=n;else{for(var o=!1,a=r.child;a;){if(a===i){o=!0,i=r,s=n;break}if(a===s){o=!0,s=r,i=n;break}a=a.sibling}if(!o){for(a=n.child;a;){if(a===i){o=!0,i=n,s=r;break}if(a===s){o=!0,s=n,i=r;break}a=a.sibling}if(!o)throw Error(Go(189))}}if(i.alternate!==s)throw Error(Go(190))}if(3!==i.tag)throw Error(Go(188));return i.stateNode.current===i?e:t}(e))?Tl(e):null}function Tl(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=Tl(e);if(null!==t)return t;e=e.sibling}return null}var zl=Yo.unstable_scheduleCallback,Ol=Yo.unstable_cancelCallback,Il=Yo.unstable_shouldYield,Fl=Yo.unstable_requestPaint,Hl=Yo.unstable_now,Wl=Yo.unstable_getCurrentPriorityLevel,Kl=Yo.unstable_ImmediatePriority,Ul=Yo.unstable_UserBlockingPriority,ql=Yo.unstable_NormalPriority,$l=Yo.unstable_LowPriority,Vl=Yo.unstable_IdlePriority,Yl=null,Gl=null;var Xl=Math.clz32?Math.clz32:function(e){return e>>>=0,0===e?32:31-(Jl(e)/Zl|0)|0},Jl=Math.log,Zl=Math.LN2;var Ql=64,ec=4194304;function tc(e){switch(e&-e){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: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 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ic(e,t){var i=e.pendingLanes;if(0===i)return 0;var s=0,r=e.suspendedLanes,n=e.pingedLanes,o=268435455&i;if(0!==o){var a=o&~r;0!==a?s=tc(a):0!==(n&=o)&&(s=tc(n))}else 0!==(o=i&~r)?s=tc(o):0!==n&&(s=tc(n));if(0===s)return 0;if(0!==t&&t!==s&&0===(t&r)&&((r=s&-s)>=(n=t&-t)||16===r&&4194240&n))return t;if(4&s&&(s|=16&i),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=s;0<t;)r=1<<(i=31-Xl(t)),s|=e[i],t&=~r;return s}function sc(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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 t+5e3;default:return-1}}function rc(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function nc(){var e=Ql;return!(4194240&(Ql<<=1))&&(Ql=64),e}function oc(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function ac(e,t,i){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-Xl(t)]=i}function lc(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var s=31-Xl(i),r=1<<s;r&t|e[s]&t&&(e[s]|=t),i&=~r}}var cc=0;function hc(e){return 1<(e&=-e)?4<e?268435455&e?16:536870912:4:1}var uc,dc,fc,pc,gc,vc=!1,mc=[],_c=null,bc=null,xc=null,yc=new Map,wc=new Map,Sc=[],kc="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 submit".split(" ");function Cc(e,t){switch(e){case"focusin":case"focusout":_c=null;break;case"dragenter":case"dragleave":bc=null;break;case"mouseover":case"mouseout":xc=null;break;case"pointerover":case"pointerout":yc.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":wc.delete(t.pointerId)}}function jc(e,t,i,s,r,n){return null===e||e.nativeEvent!==n?(e={blockedOn:t,domEventName:i,eventSystemFlags:s,nativeEvent:n,targetContainers:[r]},null!==t&&(null!==(t=ld(t))&&dc(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,null!==r&&-1===t.indexOf(r)&&t.push(r),e)}function Nc(e){var t=ad(e.target);if(null!==t){var i=Ll(t);if(null!==i)if(13===(t=i.tag)){if(null!==(t=Rl(i)))return e.blockedOn=t,void gc(e.priority,function(){fc(i)})}else if(3===t&&i.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===i.tag?i.stateNode.containerInfo:null)}e.blockedOn=null}function Mc(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var i=Ic(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==i)return null!==(t=ld(i))&&dc(t),e.blockedOn=i,!1;var s=new(i=e.nativeEvent).constructor(i.type,i);hl=s,i.target.dispatchEvent(s),hl=null,t.shift()}return!0}function Ec(e,t,i){Mc(e)&&i.delete(t)}function Bc(){vc=!1,null!==_c&&Mc(_c)&&(_c=null),null!==bc&&Mc(bc)&&(bc=null),null!==xc&&Mc(xc)&&(xc=null),yc.forEach(Ec),wc.forEach(Ec)}function Dc(e,t){e.blockedOn===t&&(e.blockedOn=null,vc||(vc=!0,Yo.unstable_scheduleCallback(Yo.unstable_NormalPriority,Bc)))}function Lc(e){function t(t){return Dc(t,e)}if(0<mc.length){Dc(mc[0],e);for(var i=1;i<mc.length;i++){var s=mc[i];s.blockedOn===e&&(s.blockedOn=null)}}for(null!==_c&&Dc(_c,e),null!==bc&&Dc(bc,e),null!==xc&&Dc(xc,e),yc.forEach(t),wc.forEach(t),i=0;i<Sc.length;i++)(s=Sc[i]).blockedOn===e&&(s.blockedOn=null);for(;0<Sc.length&&null===(i=Sc[0]).blockedOn;)Nc(i),null===i.blockedOn&&Sc.shift()}var Rc=ha.ReactCurrentBatchConfig,Pc=!0;function Ac(e,t,i,s){var r=cc,n=Rc.transition;Rc.transition=null;try{cc=1,zc(e,t,i,s)}finally{cc=r,Rc.transition=n}}function Tc(e,t,i,s){var r=cc,n=Rc.transition;Rc.transition=null;try{cc=4,zc(e,t,i,s)}finally{cc=r,Rc.transition=n}}function zc(e,t,i,s){if(Pc){var r=Ic(e,t,i,s);if(null===r)Ru(e,t,s,Oc,i),Cc(e,s);else if(function(e,t,i,s,r){switch(t){case"focusin":return _c=jc(_c,e,t,i,s,r),!0;case"dragenter":return bc=jc(bc,e,t,i,s,r),!0;case"mouseover":return xc=jc(xc,e,t,i,s,r),!0;case"pointerover":var n=r.pointerId;return yc.set(n,jc(yc.get(n)||null,e,t,i,s,r)),!0;case"gotpointercapture":return n=r.pointerId,wc.set(n,jc(wc.get(n)||null,e,t,i,s,r)),!0}return!1}(r,e,t,i,s))s.stopPropagation();else if(Cc(e,s),4&t&&-1<kc.indexOf(e)){for(;null!==r;){var n=ld(r);if(null!==n&&uc(n),null===(n=Ic(e,t,i,s))&&Ru(e,t,s,Oc,i),n===r)break;r=n}null!==r&&s.stopPropagation()}else Ru(e,t,s,null,i)}}var Oc=null;function Ic(e,t,i,s){if(Oc=null,null!==(e=ad(e=ul(s))))if(null===(t=Ll(e)))e=null;else if(13===(i=t.tag)){if(null!==(e=Rl(t)))return e;e=null}else if(3===i){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Oc=e,null}function Fc(e){switch(e){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Wl()){case Kl:return 1;case Ul:return 4;case ql:case $l:return 16;case Vl:return 536870912;default:return 16}default:return 16}}var Hc=null,Wc=null,Kc=null;function Uc(){if(Kc)return Kc;var e,t,i=Wc,s=i.length,r="value"in Hc?Hc.value:Hc.textContent,n=r.length;for(e=0;e<s&&i[e]===r[e];e++);var o=s-e;for(t=1;t<=o&&i[s-t]===r[n-t];t++);return Kc=r.slice(e,1<t?1-t:void 0)}function qc(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function $c(){return!0}function Vc(){return!1}function Yc(e){function t(t,i,s,r,n){for(var o in this._reactName=t,this._targetInst=s,this.type=i,this.nativeEvent=r,this.target=n,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(r):r[o]);return this.isDefaultPrevented=(null!=r.defaultPrevented?r.defaultPrevented:!1===r.returnValue)?$c:Vc,this.isPropagationStopped=Vc,this}return Na(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=$c)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=$c)},persist:function(){},isPersistent:$c}),t}var Gc,Xc,Jc,Zc={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Qc=Yc(Zc),eh=Na({},Zc,{view:0,detail:0}),th=Yc(eh),ih=Na({},eh,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ph,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Jc&&(Jc&&"mousemove"===e.type?(Gc=e.screenX-Jc.screenX,Xc=e.screenY-Jc.screenY):Xc=Gc=0,Jc=e),Gc)},movementY:function(e){return"movementY"in e?e.movementY:Xc}}),sh=Yc(ih),rh=Yc(Na({},ih,{dataTransfer:0})),nh=Yc(Na({},eh,{relatedTarget:0})),oh=Yc(Na({},Zc,{animationName:0,elapsedTime:0,pseudoElement:0})),ah=Na({},Zc,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),lh=Yc(ah),ch=Yc(Na({},Zc,{data:0})),hh={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},uh={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"},dh={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function fh(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=dh[e])&&!!t[e]}function ph(){return fh}var gh=Na({},eh,{key:function(e){if(e.key){var t=hh[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=qc(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?uh[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ph,charCode:function(e){return"keypress"===e.type?qc(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?qc(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),vh=Yc(gh),mh=Yc(Na({},ih,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),_h=Yc(Na({},eh,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ph})),bh=Yc(Na({},Zc,{propertyName:0,elapsedTime:0,pseudoElement:0})),xh=Na({},ih,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),yh=Yc(xh),wh=[9,13,27,32],Sh=ea&&"CompositionEvent"in window,kh=null;ea&&"documentMode"in document&&(kh=document.documentMode);var Ch=ea&&"TextEvent"in window&&!kh,jh=ea&&(!Sh||kh&&8<kh&&11>=kh),Nh=String.fromCharCode(32),Mh=!1;function Eh(e,t){switch(e){case"keyup":return-1!==wh.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bh(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Dh=!1;var Lh={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 Rh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Lh[e.type]:"textarea"===t}function Ph(e,t,i,s){vl(s),0<(t=Au(t,"onChange")).length&&(i=new Qc("onChange","change",null,i,s),e.push({event:i,listeners:t}))}var Ah=null,Th=null;function zh(e){Nu(e,0)}function Oh(e){if(za(cd(e)))return e}function Ih(e,t){if("change"===e)return t}var Fh=!1;if(ea){var Hh;if(ea){var Wh="oninput"in document;if(!Wh){var Kh=document.createElement("div");Kh.setAttribute("oninput","return;"),Wh="function"==typeof Kh.oninput}Hh=Wh}else Hh=!1;Fh=Hh&&(!document.documentMode||9<document.documentMode)}function Uh(){Ah&&(Ah.detachEvent("onpropertychange",qh),Th=Ah=null)}function qh(e){if("value"===e.propertyName&&Oh(Th)){var t=[];Ph(t,Th,e,ul(e)),yl(zh,t)}}function $h(e,t,i){"focusin"===e?(Uh(),Th=i,(Ah=t).attachEvent("onpropertychange",qh)):"focusout"===e&&Uh()}function Vh(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Oh(Th)}function Yh(e,t){if("click"===e)return Oh(t)}function Gh(e,t){if("input"===e||"change"===e)return Oh(t)}var Xh="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function Jh(e,t){if(Xh(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var i=Object.keys(e),s=Object.keys(t);if(i.length!==s.length)return!1;for(s=0;s<i.length;s++){var r=i[s];if(!ta.call(t,r)||!Xh(e[r],t[r]))return!1}return!0}function Zh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Qh(e,t){var i,s=Zh(e);for(e=0;s;){if(3===s.nodeType){if(i=e+s.textContent.length,e<=t&&i>=t)return{node:s,offset:t-e};e=i}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Zh(s)}}function eu(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?eu(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function tu(){for(var e=window,t=Oa();t instanceof e.HTMLIFrameElement;){try{var i="string"==typeof t.contentWindow.location.href}catch(s){i=!1}if(!i)break;t=Oa((e=t.contentWindow).document)}return t}function iu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}function su(e){var t=tu(),i=e.focusedElem,s=e.selectionRange;if(t!==i&&i&&i.ownerDocument&&eu(i.ownerDocument.documentElement,i)){if(null!==s&&iu(i))if(t=s.start,void 0===(e=s.end)&&(e=t),"selectionStart"in i)i.selectionStart=t,i.selectionEnd=Math.min(e,i.value.length);else if((e=(t=i.ownerDocument||document)&&t.defaultView||window).getSelection){e=e.getSelection();var r=i.textContent.length,n=Math.min(s.start,r);s=void 0===s.end?n:Math.min(s.end,r),!e.extend&&n>s&&(r=s,s=n,n=r),r=Qh(i,n);var o=Qh(i,s);r&&o&&(1!==e.rangeCount||e.anchorNode!==r.node||e.anchorOffset!==r.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&((t=t.createRange()).setStart(r.node,r.offset),e.removeAllRanges(),n>s?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}for(t=[],e=i;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"==typeof i.focus&&i.focus(),i=0;i<t.length;i++)(e=t[i]).element.scrollLeft=e.left,e.element.scrollTop=e.top}}var ru=ea&&"documentMode"in document&&11>=document.documentMode,nu=null,ou=null,au=null,lu=!1;function cu(e,t,i){var s=i.window===i?i.document:9===i.nodeType?i:i.ownerDocument;lu||null==nu||nu!==Oa(s)||("selectionStart"in(s=nu)&&iu(s)?s={start:s.selectionStart,end:s.selectionEnd}:s={anchorNode:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset},au&&Jh(au,s)||(au=s,0<(s=Au(ou,"onSelect")).length&&(t=new Qc("onSelect","select",null,t,i),e.push({event:t,listeners:s}),t.target=nu)))}function hu(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var uu={animationend:hu("Animation","AnimationEnd"),animationiteration:hu("Animation","AnimationIteration"),animationstart:hu("Animation","AnimationStart"),transitionend:hu("Transition","TransitionEnd")},du={},fu={};function pu(e){if(du[e])return du[e];if(!uu[e])return e;var t,i=uu[e];for(t in i)if(i.hasOwnProperty(t)&&t in fu)return du[e]=i[t];return e}ea&&(fu=document.createElement("div").style,"AnimationEvent"in window||(delete uu.animationend.animation,delete uu.animationiteration.animation,delete uu.animationstart.animation),"TransitionEvent"in window||delete uu.transitionend.transition);var gu=pu("animationend"),vu=pu("animationiteration"),mu=pu("animationstart"),_u=pu("transitionend"),bu=new Map,xu="abort auxClick 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(" ");function yu(e,t){bu.set(e,t),Zo(t,[e])}for(var wu=0;wu<xu.length;wu++){var Su=xu[wu];yu(Su.toLowerCase(),"on"+(Su[0].toUpperCase()+Su.slice(1)))}yu(gu,"onAnimationEnd"),yu(vu,"onAnimationIteration"),yu(mu,"onAnimationStart"),yu("dblclick","onDoubleClick"),yu("focusin","onFocus"),yu("focusout","onBlur"),yu(_u,"onTransitionEnd"),Qo("onMouseEnter",["mouseout","mouseover"]),Qo("onMouseLeave",["mouseout","mouseover"]),Qo("onPointerEnter",["pointerout","pointerover"]),Qo("onPointerLeave",["pointerout","pointerover"]),Zo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Zo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Zo("onBeforeInput",["compositionend","keypress","textInput","paste"]),Zo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Zo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Zo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ku="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(" "),Cu=new Set("cancel close invalid load scroll toggle".split(" ").concat(ku));function ju(e,t,i){var s=e.type||"unknown-event";e.currentTarget=i,function(e,t,i,s,r,n,o,a,l){if(Dl.apply(this,arguments),jl){if(!jl)throw Error(Go(198));var c=Nl;jl=!1,Nl=null,Ml||(Ml=!0,El=c)}}(s,t,void 0,e),e.currentTarget=null}function Nu(e,t){t=!!(4&t);for(var i=0;i<e.length;i++){var s=e[i],r=s.event;s=s.listeners;e:{var n=void 0;if(t)for(var o=s.length-1;0<=o;o--){var a=s[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==n&&r.isPropagationStopped())break e;ju(r,a,c),n=l}else for(o=0;o<s.length;o++){if(l=(a=s[o]).instance,c=a.currentTarget,a=a.listener,l!==n&&r.isPropagationStopped())break e;ju(r,a,c),n=l}}}if(Ml)throw e=El,Ml=!1,El=null,e}function Mu(e,t){var i=t[rd];void 0===i&&(i=t[rd]=new Set);var s=e+"__bubble";i.has(s)||(Lu(t,e,2,!1),i.add(s))}function Eu(e,t,i){var s=0;t&&(s|=4),Lu(i,e,s,t)}var Bu="_reactListening"+Math.random().toString(36).slice(2);function Du(e){if(!e[Bu]){e[Bu]=!0,Xo.forEach(function(t){"selectionchange"!==t&&(Cu.has(t)||Eu(t,!1,e),Eu(t,!0,e))});var t=9===e.nodeType?e:e.ownerDocument;null===t||t[Bu]||(t[Bu]=!0,Eu("selectionchange",!1,t))}}function Lu(e,t,i,s){switch(Fc(t)){case 1:var r=Ac;break;case 4:r=Tc;break;default:r=zc}i=r.bind(null,t,i,e),r=void 0,!Sl||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(r=!0),s?void 0!==r?e.addEventListener(t,i,{capture:!0,passive:r}):e.addEventListener(t,i,!0):void 0!==r?e.addEventListener(t,i,{passive:r}):e.addEventListener(t,i,!1)}function Ru(e,t,i,s,r){var n=s;if(!(1&t||2&t||null===s))e:for(;;){if(null===s)return;var o=s.tag;if(3===o||4===o){var a=s.stateNode.containerInfo;if(a===r||8===a.nodeType&&a.parentNode===r)break;if(4===o)for(o=s.return;null!==o;){var l=o.tag;if((3===l||4===l)&&((l=o.stateNode.containerInfo)===r||8===l.nodeType&&l.parentNode===r))return;o=o.return}for(;null!==a;){if(null===(o=ad(a)))return;if(5===(l=o.tag)||6===l){s=n=o;continue e}a=a.parentNode}}s=s.return}yl(function(){var s=n,r=ul(i),o=[];e:{var a=bu.get(e);if(void 0!==a){var l=Qc,c=e;switch(e){case"keypress":if(0===qc(i))break e;case"keydown":case"keyup":l=vh;break;case"focusin":c="focus",l=nh;break;case"focusout":c="blur",l=nh;break;case"beforeblur":case"afterblur":l=nh;break;case"click":if(2===i.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":l=sh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":l=rh;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":l=_h;break;case gu:case vu:case mu:l=oh;break;case _u:l=bh;break;case"scroll":l=th;break;case"wheel":l=yh;break;case"copy":case"cut":case"paste":l=lh;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":l=mh}var h=!!(4&t),u=!h&&"scroll"===e,d=h?null!==a?a+"Capture":null:a;h=[];for(var f,p=s;null!==p;){var g=(f=p).stateNode;if(5===f.tag&&null!==g&&(f=g,null!==d&&(null!=(g=wl(p,d))&&h.push(Pu(p,g,f)))),u)break;p=p.return}0<h.length&&(a=new l(a,c,null,i,r),o.push({event:a,listeners:h}))}}if(!(7&t)){if(l="mouseout"===e||"pointerout"===e,(!(a="mouseover"===e||"pointerover"===e)||i===hl||!(c=i.relatedTarget||i.fromElement)||!ad(c)&&!c[sd])&&(l||a)&&(a=r.window===r?r:(a=r.ownerDocument)?a.defaultView||a.parentWindow:window,l?(l=s,null!==(c=(c=i.relatedTarget||i.toElement)?ad(c):null)&&(c!==(u=Ll(c))||5!==c.tag&&6!==c.tag)&&(c=null)):(l=null,c=s),l!==c)){if(h=sh,g="onMouseLeave",d="onMouseEnter",p="mouse","pointerout"!==e&&"pointerover"!==e||(h=mh,g="onPointerLeave",d="onPointerEnter",p="pointer"),u=null==l?a:cd(l),f=null==c?a:cd(c),(a=new h(g,p+"leave",l,i,r)).target=u,a.relatedTarget=f,g=null,ad(r)===s&&((h=new h(d,p+"enter",c,i,r)).target=f,h.relatedTarget=u,g=h),u=g,l&&c)e:{for(d=c,p=0,f=h=l;f;f=Tu(f))p++;for(f=0,g=d;g;g=Tu(g))f++;for(;0<p-f;)h=Tu(h),p--;for(;0<f-p;)d=Tu(d),f--;for(;p--;){if(h===d||null!==d&&h===d.alternate)break e;h=Tu(h),d=Tu(d)}h=null}else h=null;null!==l&&zu(o,a,l,h,!1),null!==c&&null!==u&&zu(o,u,c,h,!0)}if("select"===(l=(a=s?cd(s):window).nodeName&&a.nodeName.toLowerCase())||"input"===l&&"file"===a.type)var v=Ih;else if(Rh(a))if(Fh)v=Gh;else{v=Vh;var m=$h}else(l=a.nodeName)&&"input"===l.toLowerCase()&&("checkbox"===a.type||"radio"===a.type)&&(v=Yh);switch(v&&(v=v(e,s))?Ph(o,v,i,r):(m&&m(e,a,s),"focusout"===e&&(m=a._wrapperState)&&m.controlled&&"number"===a.type&&Ua(a,"number",a.value)),m=s?cd(s):window,e){case"focusin":(Rh(m)||"true"===m.contentEditable)&&(nu=m,ou=s,au=null);break;case"focusout":au=ou=nu=null;break;case"mousedown":lu=!0;break;case"contextmenu":case"mouseup":case"dragend":lu=!1,cu(o,i,r);break;case"selectionchange":if(ru)break;case"keydown":case"keyup":cu(o,i,r)}var _;if(Sh)e:{switch(e){case"compositionstart":var b="onCompositionStart";break e;case"compositionend":b="onCompositionEnd";break e;case"compositionupdate":b="onCompositionUpdate";break e}b=void 0}else Dh?Eh(e,i)&&(b="onCompositionEnd"):"keydown"===e&&229===i.keyCode&&(b="onCompositionStart");b&&(jh&&"ko"!==i.locale&&(Dh||"onCompositionStart"!==b?"onCompositionEnd"===b&&Dh&&(_=Uc()):(Wc="value"in(Hc=r)?Hc.value:Hc.textContent,Dh=!0)),0<(m=Au(s,b)).length&&(b=new ch(b,e,null,i,r),o.push({event:b,listeners:m}),_?b.data=_:null!==(_=Bh(i))&&(b.data=_))),(_=Ch?function(e,t){switch(e){case"compositionend":return Bh(t);case"keypress":return 32!==t.which?null:(Mh=!0,Nh);case"textInput":return(e=t.data)===Nh&&Mh?null:e;default:return null}}(e,i):function(e,t){if(Dh)return"compositionend"===e||!Sh&&Eh(e,t)?(e=Uc(),Kc=Wc=Hc=null,Dh=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return jh&&"ko"!==t.locale?null:t.data}}(e,i))&&(0<(s=Au(s,"onBeforeInput")).length&&(r=new ch("onBeforeInput","beforeinput",null,i,r),o.push({event:r,listeners:s}),r.data=_))}Nu(o,t)})}function Pu(e,t,i){return{instance:e,listener:t,currentTarget:i}}function Au(e,t){for(var i=t+"Capture",s=[];null!==e;){var r=e,n=r.stateNode;5===r.tag&&null!==n&&(r=n,null!=(n=wl(e,i))&&s.unshift(Pu(e,n,r)),null!=(n=wl(e,t))&&s.push(Pu(e,n,r))),e=e.return}return s}function Tu(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function zu(e,t,i,s,r){for(var n=t._reactName,o=[];null!==i&&i!==s;){var a=i,l=a.alternate,c=a.stateNode;if(null!==l&&l===s)break;5===a.tag&&null!==c&&(a=c,r?null!=(l=wl(i,n))&&o.unshift(Pu(i,l,a)):r||null!=(l=wl(i,n))&&o.push(Pu(i,l,a))),i=i.return}0!==o.length&&e.push({event:t,listeners:o})}var Ou=/\r\n?/g,Iu=/\u0000|\uFFFD/g;function Fu(e){return("string"==typeof e?e:""+e).replace(Ou,"\n").replace(Iu,"")}function Hu(e,t,i){if(t=Fu(t),Fu(e)!==t&&i)throw Error(Go(425))}function Wu(){}var Ku=null,Uu=null;function qu(e,t){return"textarea"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var $u="function"==typeof setTimeout?setTimeout:void 0,Vu="function"==typeof clearTimeout?clearTimeout:void 0,Yu="function"==typeof Promise?Promise:void 0,Gu="function"==typeof queueMicrotask?queueMicrotask:void 0!==Yu?function(e){return Yu.resolve(null).then(e).catch(Xu)}:$u;function Xu(e){setTimeout(function(){throw e})}function Ju(e,t){var i=t,s=0;do{var r=i.nextSibling;if(e.removeChild(i),r&&8===r.nodeType)if("/$"===(i=r.data)){if(0===s)return e.removeChild(r),void Lc(t);s--}else"$"!==i&&"$?"!==i&&"$!"!==i||s++;i=r}while(i);Lc(t)}function Zu(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t)break;if("/$"===t)return null}}return e}function Qu(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var i=e.data;if("$"===i||"$!"===i||"$?"===i){if(0===t)return e;t--}else"/$"===i&&t++}e=e.previousSibling}return null}var ed=Math.random().toString(36).slice(2),td="__reactFiber$"+ed,id="__reactProps$"+ed,sd="__reactContainer$"+ed,rd="__reactEvents$"+ed,nd="__reactListeners$"+ed,od="__reactHandles$"+ed;function ad(e){var t=e[td];if(t)return t;for(var i=e.parentNode;i;){if(t=i[sd]||i[td]){if(i=t.alternate,null!==t.child||null!==i&&null!==i.child)for(e=Qu(e);null!==e;){if(i=e[td])return i;e=Qu(e)}return t}i=(e=i).parentNode}return null}function ld(e){return!(e=e[td]||e[sd])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function cd(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(Go(33))}function hd(e){return e[id]||null}var ud=[],dd=-1;function fd(e){return{current:e}}function pd(e){0>dd||(e.current=ud[dd],ud[dd]=null,dd--)}function gd(e,t){dd++,ud[dd]=e.current,e.current=t}var vd={},md=fd(vd),_d=fd(!1),bd=vd;function xd(e,t){var i=e.type.contextTypes;if(!i)return vd;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===t)return s.__reactInternalMemoizedMaskedChildContext;var r,n={};for(r in i)n[r]=t[r];return s&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=n),n}function yd(e){return null!=(e=e.childContextTypes)}function wd(){pd(_d),pd(md)}function Sd(e,t,i){if(md.current!==vd)throw Error(Go(168));gd(md,t),gd(_d,i)}function kd(e,t,i){var s=e.stateNode;if(t=t.childContextTypes,"function"!=typeof s.getChildContext)return i;for(var r in s=s.getChildContext())if(!(r in t))throw Error(Go(108,Ra(e)||"Unknown",r));return Na({},i,s)}function Cd(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||vd,bd=md.current,gd(md,e),gd(_d,_d.current),!0}function jd(e,t,i){var s=e.stateNode;if(!s)throw Error(Go(169));i?(e=kd(e,t,bd),s.__reactInternalMemoizedMergedChildContext=e,pd(_d),pd(md),gd(md,e)):pd(_d),gd(_d,i)}var Nd=null,Md=!1,Ed=!1;function Bd(e){null===Nd?Nd=[e]:Nd.push(e)}function Dd(){if(!Ed&&null!==Nd){Ed=!0;var e=0,t=cc;try{var i=Nd;for(cc=1;e<i.length;e++){var s=i[e];do{s=s(!0)}while(null!==s)}Nd=null,Md=!1}catch(r){throw null!==Nd&&(Nd=Nd.slice(e+1)),zl(Kl,Dd),r}finally{cc=t,Ed=!1}}return null}var Ld=[],Rd=0,Pd=null,Ad=0,Td=[],zd=0,Od=null,Id=1,Fd="";function Hd(e,t){Ld[Rd++]=Ad,Ld[Rd++]=Pd,Pd=e,Ad=t}function Wd(e,t,i){Td[zd++]=Id,Td[zd++]=Fd,Td[zd++]=Od,Od=e;var s=Id;e=Fd;var r=32-Xl(s)-1;s&=~(1<<r),i+=1;var n=32-Xl(t)+r;if(30<n){var o=r-r%5;n=(s&(1<<o)-1).toString(32),s>>=o,r-=o,Id=1<<32-Xl(t)+r|i<<r|s,Fd=n+e}else Id=1<<n|i<<r|s,Fd=e}function Kd(e){null!==e.return&&(Hd(e,1),Wd(e,1,0))}function Ud(e){for(;e===Pd;)Pd=Ld[--Rd],Ld[Rd]=null,Ad=Ld[--Rd],Ld[Rd]=null;for(;e===Od;)Od=Td[--zd],Td[zd]=null,Fd=Td[--zd],Td[zd]=null,Id=Td[--zd],Td[zd]=null}var qd=null,$d=null,Vd=!1,Yd=null;function Gd(e,t){var i=xm(5,null,null,0);i.elementType="DELETED",i.stateNode=t,i.return=e,null===(t=e.deletions)?(e.deletions=[i],e.flags|=16):t.push(i)}function Xd(e,t){switch(e.tag){case 5:var i=e.type;return null!==(t=1!==t.nodeType||i.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,qd=e,$d=Zu(t.firstChild),!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,qd=e,$d=null,!0);case 13:return null!==(t=8!==t.nodeType?null:t)&&(i=null!==Od?{id:Id,overflow:Fd}:null,e.memoizedState={dehydrated:t,treeContext:i,retryLane:1073741824},(i=xm(18,null,null,0)).stateNode=t,i.return=e,e.child=i,qd=e,$d=null,!0);default:return!1}}function Jd(e){return!(!(1&e.mode)||128&e.flags)}function Zd(e){if(Vd){var t=$d;if(t){var i=t;if(!Xd(e,t)){if(Jd(e))throw Error(Go(418));t=Zu(i.nextSibling);var s=qd;t&&Xd(e,t)?Gd(s,i):(e.flags=-4097&e.flags|2,Vd=!1,qd=e)}}else{if(Jd(e))throw Error(Go(418));e.flags=-4097&e.flags|2,Vd=!1,qd=e}}}function Qd(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;qd=e}function ef(e){if(e!==qd)return!1;if(!Vd)return Qd(e),Vd=!0,!1;var t;if((t=3!==e.tag)&&!(t=5!==e.tag)&&(t="head"!==(t=e.type)&&"body"!==t&&!qu(e.type,e.memoizedProps)),t&&(t=$d)){if(Jd(e))throw tf(),Error(Go(418));for(;t;)Gd(e,t),t=Zu(t.nextSibling)}if(Qd(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(Go(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var i=e.data;if("/$"===i){if(0===t){$d=Zu(e.nextSibling);break e}t--}else"$"!==i&&"$!"!==i&&"$?"!==i||t++}e=e.nextSibling}$d=null}}else $d=qd?Zu(e.stateNode.nextSibling):null;return!0}function tf(){for(var e=$d;e;)e=Zu(e.nextSibling)}function sf(){$d=qd=null,Vd=!1}function rf(e){null===Yd?Yd=[e]:Yd.push(e)}var nf=ha.ReactCurrentBatchConfig;function of(e,t,i){if(null!==(e=i.ref)&&"function"!=typeof e&&"object"!=typeof e){if(i._owner){if(i=i._owner){if(1!==i.tag)throw Error(Go(309));var s=i.stateNode}if(!s)throw Error(Go(147,e));var r=s,n=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===n?t.ref:((t=function(e){var t=r.refs;null===e?delete t[n]:t[n]=e})._stringRef=n,t)}if("string"!=typeof e)throw Error(Go(284));if(!i._owner)throw Error(Go(290,e))}return e}function af(e,t){throw e=Object.prototype.toString.call(t),Error(Go(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function lf(e){return(0,e._init)(e._payload)}function cf(e){function t(t,i){if(e){var s=t.deletions;null===s?(t.deletions=[i],t.flags|=16):s.push(i)}}function i(i,s){if(!e)return null;for(;null!==s;)t(i,s),s=s.sibling;return null}function s(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function r(e,t){return(e=wm(e,t)).index=0,e.sibling=null,e}function n(t,i,s){return t.index=s,e?null!==(s=t.alternate)?(s=s.index)<i?(t.flags|=2,i):s:(t.flags|=2,i):(t.flags|=1048576,i)}function o(t){return e&&null===t.alternate&&(t.flags|=2),t}function a(e,t,i,s){return null===t||6!==t.tag?((t=jm(i,e.mode,s)).return=e,t):((t=r(t,i)).return=e,t)}function l(e,t,i,s){var n=i.type;return n===fa?h(e,t,i.props.children,s,i.key):null!==t&&(t.elementType===n||"object"==typeof n&&null!==n&&n.$$typeof===wa&&lf(n)===t.type)?((s=r(t,i.props)).ref=of(e,t,i),s.return=e,s):((s=Sm(i.type,i.key,i.props,null,e.mode,s)).ref=of(e,t,i),s.return=e,s)}function c(e,t,i,s){return null===t||4!==t.tag||t.stateNode.containerInfo!==i.containerInfo||t.stateNode.implementation!==i.implementation?((t=Nm(i,e.mode,s)).return=e,t):((t=r(t,i.children||[])).return=e,t)}function h(e,t,i,s,n){return null===t||7!==t.tag?((t=km(i,e.mode,s,n)).return=e,t):((t=r(t,i)).return=e,t)}function u(e,t,i){if("string"==typeof t&&""!==t||"number"==typeof t)return(t=jm(""+t,e.mode,i)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case ua:return(i=Sm(t.type,t.key,t.props,null,e.mode,i)).ref=of(e,null,t),i.return=e,i;case da:return(t=Nm(t,e.mode,i)).return=e,t;case wa:return u(e,(0,t._init)(t._payload),i)}if(qa(t)||Ca(t))return(t=km(t,e.mode,i,null)).return=e,t;af(e,t)}return null}function d(e,t,i,s){var r=null!==t?t.key:null;if("string"==typeof i&&""!==i||"number"==typeof i)return null!==r?null:a(e,t,""+i,s);if("object"==typeof i&&null!==i){switch(i.$$typeof){case ua:return i.key===r?l(e,t,i,s):null;case da:return i.key===r?c(e,t,i,s):null;case wa:return d(e,t,(r=i._init)(i._payload),s)}if(qa(i)||Ca(i))return null!==r?null:h(e,t,i,s,null);af(e,i)}return null}function f(e,t,i,s,r){if("string"==typeof s&&""!==s||"number"==typeof s)return a(t,e=e.get(i)||null,""+s,r);if("object"==typeof s&&null!==s){switch(s.$$typeof){case ua:return l(t,e=e.get(null===s.key?i:s.key)||null,s,r);case da:return c(t,e=e.get(null===s.key?i:s.key)||null,s,r);case wa:return f(e,t,i,(0,s._init)(s._payload),r)}if(qa(s)||Ca(s))return h(t,e=e.get(i)||null,s,r,null);af(t,s)}return null}return function a(l,c,h,p){if("object"==typeof h&&null!==h&&h.type===fa&&null===h.key&&(h=h.props.children),"object"==typeof h&&null!==h){switch(h.$$typeof){case ua:e:{for(var g=h.key,v=c;null!==v;){if(v.key===g){if((g=h.type)===fa){if(7===v.tag){i(l,v.sibling),(c=r(v,h.props.children)).return=l,l=c;break e}}else if(v.elementType===g||"object"==typeof g&&null!==g&&g.$$typeof===wa&&lf(g)===v.type){i(l,v.sibling),(c=r(v,h.props)).ref=of(l,v,h),c.return=l,l=c;break e}i(l,v);break}t(l,v),v=v.sibling}h.type===fa?((c=km(h.props.children,l.mode,p,h.key)).return=l,l=c):((p=Sm(h.type,h.key,h.props,null,l.mode,p)).ref=of(l,c,h),p.return=l,l=p)}return o(l);case da:e:{for(v=h.key;null!==c;){if(c.key===v){if(4===c.tag&&c.stateNode.containerInfo===h.containerInfo&&c.stateNode.implementation===h.implementation){i(l,c.sibling),(c=r(c,h.children||[])).return=l,l=c;break e}i(l,c);break}t(l,c),c=c.sibling}(c=Nm(h,l.mode,p)).return=l,l=c}return o(l);case wa:return a(l,c,(v=h._init)(h._payload),p)}if(qa(h))return function(r,o,a,l){for(var c=null,h=null,p=o,g=o=0,v=null;null!==p&&g<a.length;g++){p.index>g?(v=p,p=null):v=p.sibling;var m=d(r,p,a[g],l);if(null===m){null===p&&(p=v);break}e&&p&&null===m.alternate&&t(r,p),o=n(m,o,g),null===h?c=m:h.sibling=m,h=m,p=v}if(g===a.length)return i(r,p),Vd&&Hd(r,g),c;if(null===p){for(;g<a.length;g++)null!==(p=u(r,a[g],l))&&(o=n(p,o,g),null===h?c=p:h.sibling=p,h=p);return Vd&&Hd(r,g),c}for(p=s(r,p);g<a.length;g++)null!==(v=f(p,r,g,a[g],l))&&(e&&null!==v.alternate&&p.delete(null===v.key?g:v.key),o=n(v,o,g),null===h?c=v:h.sibling=v,h=v);return e&&p.forEach(function(e){return t(r,e)}),Vd&&Hd(r,g),c}(l,c,h,p);if(Ca(h))return function(r,o,a,l){var c=Ca(a);if("function"!=typeof c)throw Error(Go(150));if(null==(a=c.call(a)))throw Error(Go(151));for(var h=c=null,p=o,g=o=0,v=null,m=a.next();null!==p&&!m.done;g++,m=a.next()){p.index>g?(v=p,p=null):v=p.sibling;var _=d(r,p,m.value,l);if(null===_){null===p&&(p=v);break}e&&p&&null===_.alternate&&t(r,p),o=n(_,o,g),null===h?c=_:h.sibling=_,h=_,p=v}if(m.done)return i(r,p),Vd&&Hd(r,g),c;if(null===p){for(;!m.done;g++,m=a.next())null!==(m=u(r,m.value,l))&&(o=n(m,o,g),null===h?c=m:h.sibling=m,h=m);return Vd&&Hd(r,g),c}for(p=s(r,p);!m.done;g++,m=a.next())null!==(m=f(p,r,g,m.value,l))&&(e&&null!==m.alternate&&p.delete(null===m.key?g:m.key),o=n(m,o,g),null===h?c=m:h.sibling=m,h=m);return e&&p.forEach(function(e){return t(r,e)}),Vd&&Hd(r,g),c}(l,c,h,p);af(l,h)}return"string"==typeof h&&""!==h||"number"==typeof h?(h=""+h,null!==c&&6===c.tag?(i(l,c.sibling),(c=r(c,h)).return=l,l=c):(i(l,c),(c=jm(h,l.mode,p)).return=l,l=c),o(l)):i(l,c)}}var hf=cf(!0),uf=cf(!1),df=fd(null),ff=null,pf=null,gf=null;function vf(){gf=pf=ff=null}function mf(e){var t=df.current;pd(df),e._currentValue=t}function _f(e,t,i){for(;null!==e;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==s&&(s.childLanes|=t)):null!==s&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===i)break;e=e.return}}function bf(e,t){ff=e,gf=pf=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!==(e.lanes&t)&&(lg=!0),e.firstContext=null)}function xf(e){var t=e._currentValue;if(gf!==e)if(e={context:e,memoizedValue:t,next:null},null===pf){if(null===ff)throw Error(Go(308));pf=e,ff.dependencies={lanes:0,firstContext:e}}else pf=pf.next=e;return t}var yf=null;function wf(e){null===yf?yf=[e]:yf.push(e)}function Sf(e,t,i,s){var r=t.interleaved;return null===r?(i.next=i,wf(t)):(i.next=r.next,r.next=i),t.interleaved=i,kf(e,s)}function kf(e,t){e.lanes|=t;var i=e.alternate;for(null!==i&&(i.lanes|=t),i=e,e=e.return;null!==e;)e.childLanes|=t,null!==(i=e.alternate)&&(i.childLanes|=t),i=e,e=e.return;return 3===i.tag?i.stateNode:null}var Cf=!1;function jf(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Nf(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Mf(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ef(e,t,i){var s=e.updateQueue;if(null===s)return null;if(s=s.shared,2&mv){var r=s.pending;return null===r?t.next=t:(t.next=r.next,r.next=t),s.pending=t,kf(e,i)}return null===(r=s.interleaved)?(t.next=t,wf(s)):(t.next=r.next,r.next=t),s.interleaved=t,kf(e,i)}function Bf(e,t,i){if(null!==(t=t.updateQueue)&&(t=t.shared,4194240&i)){var s=t.lanes;i|=s&=e.pendingLanes,t.lanes=i,lc(e,i)}}function Df(e,t){var i=e.updateQueue,s=e.alternate;if(null!==s&&i===(s=s.updateQueue)){var r=null,n=null;if(null!==(i=i.firstBaseUpdate)){do{var o={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};null===n?r=n=o:n=n.next=o,i=i.next}while(null!==i);null===n?r=n=t:n=n.next=t}else r=n=t;return i={baseState:s.baseState,firstBaseUpdate:r,lastBaseUpdate:n,shared:s.shared,effects:s.effects},void(e.updateQueue=i)}null===(e=i.lastBaseUpdate)?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}function Lf(e,t,i,s){var r=e.updateQueue;Cf=!1;var n=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(null!==a){r.shared.pending=null;var l=a,c=l.next;l.next=null,null===o?n=c:o.next=c,o=l;var h=e.alternate;null!==h&&((a=(h=h.updateQueue).lastBaseUpdate)!==o&&(null===a?h.firstBaseUpdate=c:a.next=c,h.lastBaseUpdate=l))}if(null!==n){var u=r.baseState;for(o=0,h=c=l=null,a=n;;){var d=a.lane,f=a.eventTime;if((s&d)===d){null!==h&&(h=h.next={eventTime:f,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var p=e,g=a;switch(d=t,f=i,g.tag){case 1:if("function"==typeof(p=g.payload)){u=p.call(f,u,d);break e}u=p;break e;case 3:p.flags=-65537&p.flags|128;case 0:if(null==(d="function"==typeof(p=g.payload)?p.call(f,u,d):p))break e;u=Na({},u,d);break e;case 2:Cf=!0}}null!==a.callback&&0!==a.lane&&(e.flags|=64,null===(d=r.effects)?r.effects=[a]:d.push(a))}else f={eventTime:f,lane:d,tag:a.tag,payload:a.payload,callback:a.callback,next:null},null===h?(c=h=f,l=u):h=h.next=f,o|=d;if(null===(a=a.next)){if(null===(a=r.shared.pending))break;a=(d=a).next,d.next=null,r.lastBaseUpdate=d,r.shared.pending=null}}if(null===h&&(l=u),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=h,null!==(t=r.shared.interleaved)){r=t;do{o|=r.lane,r=r.next}while(r!==t)}else null===n&&(r.shared.lanes=0);Cv|=o,e.lanes=o,e.memoizedState=u}}function Rf(e,t,i){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var s=e[t],r=s.callback;if(null!==r){if(s.callback=null,s=i,"function"!=typeof r)throw Error(Go(191,r));r.call(s)}}}var Pf={},Af=fd(Pf),Tf=fd(Pf),zf=fd(Pf);function Of(e){if(e===Pf)throw Error(Go(174));return e}function If(e,t){switch(gd(zf,t),gd(Tf,e),gd(Af,Pf),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Za(null,"");break;default:t=Za(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}pd(Af),gd(Af,t)}function Ff(){pd(Af),pd(Tf),pd(zf)}function Hf(e){Of(zf.current);var t=Of(Af.current),i=Za(t,e.type);t!==i&&(gd(Tf,e),gd(Af,i))}function Wf(e){Tf.current===e&&(pd(Af),pd(Tf))}var Kf=fd(0);function Uf(e){for(var t=e;null!==t;){if(13===t.tag){var i=t.memoizedState;if(null!==i&&(null===(i=i.dehydrated)||"$?"===i.data||"$!"===i.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(128&t.flags)return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var qf=[];function $f(){for(var e=0;e<qf.length;e++)qf[e]._workInProgressVersionPrimary=null;qf.length=0}var Vf=ha.ReactCurrentDispatcher,Yf=ha.ReactCurrentBatchConfig,Gf=0,Xf=null,Jf=null,Zf=null,Qf=!1,ep=!1,tp=0,ip=0;function sp(){throw Error(Go(321))}function rp(e,t){if(null===t)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Xh(e[i],t[i]))return!1;return!0}function np(e,t,i,s,r,n){if(Gf=n,Xf=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Vf.current=null===e||null===e.memoizedState?Wp:Kp,e=i(s,r),ep){n=0;do{if(ep=!1,tp=0,25<=n)throw Error(Go(301));n+=1,Zf=Jf=null,t.updateQueue=null,Vf.current=Up,e=i(s,r)}while(ep)}if(Vf.current=Hp,t=null!==Jf&&null!==Jf.next,Gf=0,Zf=Jf=Xf=null,Qf=!1,t)throw Error(Go(300));return e}function op(){var e=0!==tp;return tp=0,e}function ap(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===Zf?Xf.memoizedState=Zf=e:Zf=Zf.next=e,Zf}function lp(){if(null===Jf){var e=Xf.alternate;e=null!==e?e.memoizedState:null}else e=Jf.next;var t=null===Zf?Xf.memoizedState:Zf.next;if(null!==t)Zf=t,Jf=e;else{if(null===e)throw Error(Go(310));e={memoizedState:(Jf=e).memoizedState,baseState:Jf.baseState,baseQueue:Jf.baseQueue,queue:Jf.queue,next:null},null===Zf?Xf.memoizedState=Zf=e:Zf=Zf.next=e}return Zf}function cp(e,t){return"function"==typeof t?t(e):t}function hp(e){var t=lp(),i=t.queue;if(null===i)throw Error(Go(311));i.lastRenderedReducer=e;var s=Jf,r=s.baseQueue,n=i.pending;if(null!==n){if(null!==r){var o=r.next;r.next=n.next,n.next=o}s.baseQueue=r=n,i.pending=null}if(null!==r){n=r.next,s=s.baseState;var a=o=null,l=null,c=n;do{var h=c.lane;if((Gf&h)===h)null!==l&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),s=c.hasEagerState?c.eagerState:e(s,c.action);else{var u={lane:h,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};null===l?(a=l=u,o=s):l=l.next=u,Xf.lanes|=h,Cv|=h}c=c.next}while(null!==c&&c!==n);null===l?o=s:l.next=a,Xh(s,t.memoizedState)||(lg=!0),t.memoizedState=s,t.baseState=o,t.baseQueue=l,i.lastRenderedState=s}if(null!==(e=i.interleaved)){r=e;do{n=r.lane,Xf.lanes|=n,Cv|=n,r=r.next}while(r!==e)}else null===r&&(i.lanes=0);return[t.memoizedState,i.dispatch]}function up(e){var t=lp(),i=t.queue;if(null===i)throw Error(Go(311));i.lastRenderedReducer=e;var s=i.dispatch,r=i.pending,n=t.memoizedState;if(null!==r){i.pending=null;var o=r=r.next;do{n=e(n,o.action),o=o.next}while(o!==r);Xh(n,t.memoizedState)||(lg=!0),t.memoizedState=n,null===t.baseQueue&&(t.baseState=n),i.lastRenderedState=n}return[n,s]}function dp(){}function fp(e,t){var i=Xf,s=lp(),r=t(),n=!Xh(s.memoizedState,r);if(n&&(s.memoizedState=r,lg=!0),s=s.queue,Cp(vp.bind(null,i,s,e),[e]),s.getSnapshot!==t||n||null!==Zf&&1&Zf.memoizedState.tag){if(i.flags|=2048,xp(9,gp.bind(null,i,s,r,t),void 0,null),null===_v)throw Error(Go(349));30&Gf||pp(i,t,r)}return r}function pp(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},null===(t=Xf.updateQueue)?(t={lastEffect:null,stores:null},Xf.updateQueue=t,t.stores=[e]):null===(i=t.stores)?t.stores=[e]:i.push(e)}function gp(e,t,i,s){t.value=i,t.getSnapshot=s,mp(t)&&_p(e)}function vp(e,t,i){return i(function(){mp(t)&&_p(e)})}function mp(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Xh(e,i)}catch(s){return!0}}function _p(e){var t=kf(e,1);null!==t&&qv(t,e,1,-1)}function bp(e){var t=ap();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:cp,lastRenderedState:e},t.queue=e,e=e.dispatch=zp.bind(null,Xf,e),[t.memoizedState,e]}function xp(e,t,i,s){return e={tag:e,create:t,destroy:i,deps:s,next:null},null===(t=Xf.updateQueue)?(t={lastEffect:null,stores:null},Xf.updateQueue=t,t.lastEffect=e.next=e):null===(i=t.lastEffect)?t.lastEffect=e.next=e:(s=i.next,i.next=e,e.next=s,t.lastEffect=e),e}function yp(){return lp().memoizedState}function wp(e,t,i,s){var r=ap();Xf.flags|=e,r.memoizedState=xp(1|t,i,void 0,void 0===s?null:s)}function Sp(e,t,i,s){var r=lp();s=void 0===s?null:s;var n=void 0;if(null!==Jf){var o=Jf.memoizedState;if(n=o.destroy,null!==s&&rp(s,o.deps))return void(r.memoizedState=xp(t,i,n,s))}Xf.flags|=e,r.memoizedState=xp(1|t,i,n,s)}function kp(e,t){return wp(8390656,8,e,t)}function Cp(e,t){return Sp(2048,8,e,t)}function jp(e,t){return Sp(4,2,e,t)}function Np(e,t){return Sp(4,4,e,t)}function Mp(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function Ep(e,t,i){return i=null!=i?i.concat([e]):null,Sp(4,4,Mp.bind(null,t,e),i)}function Bp(){}function Dp(e,t){var i=lp();t=void 0===t?null:t;var s=i.memoizedState;return null!==s&&null!==t&&rp(t,s[1])?s[0]:(i.memoizedState=[e,t],e)}function Lp(e,t){var i=lp();t=void 0===t?null:t;var s=i.memoizedState;return null!==s&&null!==t&&rp(t,s[1])?s[0]:(e=e(),i.memoizedState=[e,t],e)}function Rp(e,t,i){return 21&Gf?(Xh(i,t)||(i=nc(),Xf.lanes|=i,Cv|=i,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,lg=!0),e.memoizedState=i)}function Pp(e,t){var i=cc;cc=0!==i&&4>i?i:4,e(!0);var s=Yf.transition;Yf.transition={};try{e(!1),t()}finally{cc=i,Yf.transition=s}}function Ap(){return lp().memoizedState}function Tp(e,t,i){var s=Uv(e);if(i={lane:s,action:i,hasEagerState:!1,eagerState:null,next:null},Op(e))Ip(t,i);else if(null!==(i=Sf(e,t,i,s))){qv(i,e,s,Kv()),Fp(i,t,s)}}function zp(e,t,i){var s=Uv(e),r={lane:s,action:i,hasEagerState:!1,eagerState:null,next:null};if(Op(e))Ip(t,r);else{var n=e.alternate;if(0===e.lanes&&(null===n||0===n.lanes)&&null!==(n=t.lastRenderedReducer))try{var o=t.lastRenderedState,a=n(o,i);if(r.hasEagerState=!0,r.eagerState=a,Xh(a,o)){var l=t.interleaved;return null===l?(r.next=r,wf(t)):(r.next=l.next,l.next=r),void(t.interleaved=r)}}catch(c){}null!==(i=Sf(e,t,r,s))&&(qv(i,e,s,r=Kv()),Fp(i,t,s))}}function Op(e){var t=e.alternate;return e===Xf||null!==t&&t===Xf}function Ip(e,t){ep=Qf=!0;var i=e.pending;null===i?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function Fp(e,t,i){if(4194240&i){var s=t.lanes;i|=s&=e.pendingLanes,t.lanes=i,lc(e,i)}}var Hp={readContext:xf,useCallback:sp,useContext:sp,useEffect:sp,useImperativeHandle:sp,useInsertionEffect:sp,useLayoutEffect:sp,useMemo:sp,useReducer:sp,useRef:sp,useState:sp,useDebugValue:sp,useDeferredValue:sp,useTransition:sp,useMutableSource:sp,useSyncExternalStore:sp,useId:sp,unstable_isNewReconciler:!1},Wp={readContext:xf,useCallback:function(e,t){return ap().memoizedState=[e,void 0===t?null:t],e},useContext:xf,useEffect:kp,useImperativeHandle:function(e,t,i){return i=null!=i?i.concat([e]):null,wp(4194308,4,Mp.bind(null,t,e),i)},useLayoutEffect:function(e,t){return wp(4194308,4,e,t)},useInsertionEffect:function(e,t){return wp(4,2,e,t)},useMemo:function(e,t){var i=ap();return t=void 0===t?null:t,e=e(),i.memoizedState=[e,t],e},useReducer:function(e,t,i){var s=ap();return t=void 0!==i?i(t):t,s.memoizedState=s.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},s.queue=e,e=e.dispatch=Tp.bind(null,Xf,e),[s.memoizedState,e]},useRef:function(e){return e={current:e},ap().memoizedState=e},useState:bp,useDebugValue:Bp,useDeferredValue:function(e){return ap().memoizedState=e},useTransition:function(){var e=bp(!1),t=e[0];return e=Pp.bind(null,e[1]),ap().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,i){var s=Xf,r=ap();if(Vd){if(void 0===i)throw Error(Go(407));i=i()}else{if(i=t(),null===_v)throw Error(Go(349));30&Gf||pp(s,t,i)}r.memoizedState=i;var n={value:i,getSnapshot:t};return r.queue=n,kp(vp.bind(null,s,n,e),[e]),s.flags|=2048,xp(9,gp.bind(null,s,n,i,t),void 0,null),i},useId:function(){var e=ap(),t=_v.identifierPrefix;if(Vd){var i=Fd;t=":"+t+"R"+(i=(Id&~(1<<32-Xl(Id)-1)).toString(32)+i),0<(i=tp++)&&(t+="H"+i.toString(32)),t+=":"}else t=":"+t+"r"+(i=ip++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Kp={readContext:xf,useCallback:Dp,useContext:xf,useEffect:Cp,useImperativeHandle:Ep,useInsertionEffect:jp,useLayoutEffect:Np,useMemo:Lp,useReducer:hp,useRef:yp,useState:function(){return hp(cp)},useDebugValue:Bp,useDeferredValue:function(e){return Rp(lp(),Jf.memoizedState,e)},useTransition:function(){return[hp(cp)[0],lp().memoizedState]},useMutableSource:dp,useSyncExternalStore:fp,useId:Ap,unstable_isNewReconciler:!1},Up={readContext:xf,useCallback:Dp,useContext:xf,useEffect:Cp,useImperativeHandle:Ep,useInsertionEffect:jp,useLayoutEffect:Np,useMemo:Lp,useReducer:up,useRef:yp,useState:function(){return up(cp)},useDebugValue:Bp,useDeferredValue:function(e){var t=lp();return null===Jf?t.memoizedState=e:Rp(t,Jf.memoizedState,e)},useTransition:function(){return[up(cp)[0],lp().memoizedState]},useMutableSource:dp,useSyncExternalStore:fp,useId:Ap,unstable_isNewReconciler:!1};function qp(e,t){if(e&&e.defaultProps){for(var i in t=Na({},t),e=e.defaultProps)void 0===t[i]&&(t[i]=e[i]);return t}return t}function $p(e,t,i,s){i=null==(i=i(s,t=e.memoizedState))?t:Na({},t,i),e.memoizedState=i,0===e.lanes&&(e.updateQueue.baseState=i)}var Vp={isMounted:function(e){return!!(e=e._reactInternals)&&Ll(e)===e},enqueueSetState:function(e,t,i){e=e._reactInternals;var s=Kv(),r=Uv(e),n=Mf(s,r);n.payload=t,null!=i&&(n.callback=i),null!==(t=Ef(e,n,r))&&(qv(t,e,r,s),Bf(t,e,r))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var s=Kv(),r=Uv(e),n=Mf(s,r);n.tag=1,n.payload=t,null!=i&&(n.callback=i),null!==(t=Ef(e,n,r))&&(qv(t,e,r,s),Bf(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Kv(),s=Uv(e),r=Mf(i,s);r.tag=2,null!=t&&(r.callback=t),null!==(t=Ef(e,r,s))&&(qv(t,e,s,i),Bf(t,e,s))}};function Yp(e,t,i,s,r,n,o){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(s,n,o):!t.prototype||!t.prototype.isPureReactComponent||(!Jh(i,s)||!Jh(r,n))}function Gp(e,t,i){var s=!1,r=vd,n=t.contextType;return"object"==typeof n&&null!==n?n=xf(n):(r=yd(t)?bd:md.current,n=(s=null!=(s=t.contextTypes))?xd(e,r):vd),t=new t(i,n),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=Vp,e.stateNode=t,t._reactInternals=e,s&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=r,e.__reactInternalMemoizedMaskedChildContext=n),t}function Xp(e,t,i,s){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(i,s),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(i,s),t.state!==e&&Vp.enqueueReplaceState(t,t.state,null)}function Jp(e,t,i,s){var r=e.stateNode;r.props=i,r.state=e.memoizedState,r.refs={},jf(e);var n=t.contextType;"object"==typeof n&&null!==n?r.context=xf(n):(n=yd(t)?bd:md.current,r.context=xd(e,n)),r.state=e.memoizedState,"function"==typeof(n=t.getDerivedStateFromProps)&&($p(e,t,n,i),r.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof r.getSnapshotBeforeUpdate||"function"!=typeof r.UNSAFE_componentWillMount&&"function"!=typeof r.componentWillMount||(t=r.state,"function"==typeof r.componentWillMount&&r.componentWillMount(),"function"==typeof r.UNSAFE_componentWillMount&&r.UNSAFE_componentWillMount(),t!==r.state&&Vp.enqueueReplaceState(r,r.state,null),Lf(e,i,r,s),r.state=e.memoizedState),"function"==typeof r.componentDidMount&&(e.flags|=4194308)}function Zp(e,t){try{var i="",s=t;do{i+=Da(s),s=s.return}while(s);var r=i}catch(n){r="\nError generating stack: "+n.message+"\n"+n.stack}return{value:e,source:t,stack:r,digest:null}}function Qp(e,t,i){return{value:e,source:null,stack:null!=i?i:null,digest:null!=t?t:null}}function eg(e,t){try{console.error(t.value)}catch(i){setTimeout(function(){throw i})}}var tg="function"==typeof WeakMap?WeakMap:Map;function ig(e,t,i){(i=Mf(-1,i)).tag=3,i.payload={element:null};var s=t.value;return i.callback=function(){Rv||(Rv=!0,Pv=s),eg(0,t)},i}function sg(e,t,i){(i=Mf(-1,i)).tag=3;var s=e.type.getDerivedStateFromError;if("function"==typeof s){var r=t.value;i.payload=function(){return s(r)},i.callback=function(){eg(0,t)}}var n=e.stateNode;return null!==n&&"function"==typeof n.componentDidCatch&&(i.callback=function(){eg(0,t),"function"!=typeof s&&(null===Av?Av=new Set([this]):Av.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),i}function rg(e,t,i){var s=e.pingCache;if(null===s){s=e.pingCache=new tg;var r=new Set;s.set(t,r)}else void 0===(r=s.get(t))&&(r=new Set,s.set(t,r));r.has(i)||(r.add(i),e=pm.bind(null,e,t,i),t.then(e,e))}function ng(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function og(e,t,i,s,r){return 1&e.mode?(e.flags|=65536,e.lanes=r,e):(e===t?e.flags|=65536:(e.flags|=128,i.flags|=131072,i.flags&=-52805,1===i.tag&&(null===i.alternate?i.tag=17:((t=Mf(-1,1)).tag=2,Ef(i,t,1))),i.lanes|=1),e)}var ag=ha.ReactCurrentOwner,lg=!1;function cg(e,t,i,s){t.child=null===e?uf(t,null,i,s):hf(t,e.child,i,s)}function hg(e,t,i,s,r){i=i.render;var n=t.ref;return bf(t,r),s=np(e,t,i,s,n,r),i=op(),null===e||lg?(Vd&&i&&Kd(t),t.flags|=1,cg(e,t,s,r),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r,Rg(e,t,r))}function ug(e,t,i,s,r){if(null===e){var n=i.type;return"function"!=typeof n||ym(n)||void 0!==n.defaultProps||null!==i.compare||void 0!==i.defaultProps?((e=Sm(i.type,null,s,t,t.mode,r)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=n,dg(e,t,n,s,r))}if(n=e.child,0===(e.lanes&r)){var o=n.memoizedProps;if((i=null!==(i=i.compare)?i:Jh)(o,s)&&e.ref===t.ref)return Rg(e,t,r)}return t.flags|=1,(e=wm(n,s)).ref=t.ref,e.return=t,t.child=e}function dg(e,t,i,s,r){if(null!==e){var n=e.memoizedProps;if(Jh(n,s)&&e.ref===t.ref){if(lg=!1,t.pendingProps=s=n,0===(e.lanes&r))return t.lanes=e.lanes,Rg(e,t,r);131072&e.flags&&(lg=!0)}}return gg(e,t,i,s,r)}function fg(e,t,i){var s=t.pendingProps,r=s.children,n=null!==e?e.memoizedState:null;if("hidden"===s.mode)if(1&t.mode){if(!(1073741824&i))return e=null!==n?n.baseLanes|i:i,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,gd(wv,yv),yv|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=null!==n?n.baseLanes:i,gd(wv,yv),yv|=s}else t.memoizedState={baseLanes:0,cachePool:null,transitions:null},gd(wv,yv),yv|=i;else null!==n?(s=n.baseLanes|i,t.memoizedState=null):s=i,gd(wv,yv),yv|=s;return cg(e,t,r,i),t.child}function pg(e,t){var i=t.ref;(null===e&&null!==i||null!==e&&e.ref!==i)&&(t.flags|=512,t.flags|=2097152)}function gg(e,t,i,s,r){var n=yd(i)?bd:md.current;return n=xd(t,n),bf(t,r),i=np(e,t,i,s,n,r),s=op(),null===e||lg?(Vd&&s&&Kd(t),t.flags|=1,cg(e,t,i,r),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r,Rg(e,t,r))}function vg(e,t,i,s,r){if(yd(i)){var n=!0;Cd(t)}else n=!1;if(bf(t,r),null===t.stateNode)Lg(e,t),Gp(t,i,s),Jp(t,i,s,r),s=!0;else if(null===e){var o=t.stateNode,a=t.memoizedProps;o.props=a;var l=o.context,c=i.contextType;"object"==typeof c&&null!==c?c=xf(c):c=xd(t,c=yd(i)?bd:md.current);var h=i.getDerivedStateFromProps,u="function"==typeof h||"function"==typeof o.getSnapshotBeforeUpdate;u||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(a!==s||l!==c)&&Xp(t,o,s,c),Cf=!1;var d=t.memoizedState;o.state=d,Lf(t,s,o,r),l=t.memoizedState,a!==s||d!==l||_d.current||Cf?("function"==typeof h&&($p(t,i,h,s),l=t.memoizedState),(a=Cf||Yp(t,i,a,s,d,l,c))?(u||"function"!=typeof o.UNSAFE_componentWillMount&&"function"!=typeof o.componentWillMount||("function"==typeof o.componentWillMount&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount()),"function"==typeof o.componentDidMount&&(t.flags|=4194308)):("function"==typeof o.componentDidMount&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=l),o.props=s,o.state=l,o.context=c,s=a):("function"==typeof o.componentDidMount&&(t.flags|=4194308),s=!1)}else{o=t.stateNode,Nf(e,t),a=t.memoizedProps,c=t.type===t.elementType?a:qp(t.type,a),o.props=c,u=t.pendingProps,d=o.context,"object"==typeof(l=i.contextType)&&null!==l?l=xf(l):l=xd(t,l=yd(i)?bd:md.current);var f=i.getDerivedStateFromProps;(h="function"==typeof f||"function"==typeof o.getSnapshotBeforeUpdate)||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(a!==u||d!==l)&&Xp(t,o,s,l),Cf=!1,d=t.memoizedState,o.state=d,Lf(t,s,o,r);var p=t.memoizedState;a!==u||d!==p||_d.current||Cf?("function"==typeof f&&($p(t,i,f,s),p=t.memoizedState),(c=Cf||Yp(t,i,c,s,d,p,l)||!1)?(h||"function"!=typeof o.UNSAFE_componentWillUpdate&&"function"!=typeof o.componentWillUpdate||("function"==typeof o.componentWillUpdate&&o.componentWillUpdate(s,p,l),"function"==typeof o.UNSAFE_componentWillUpdate&&o.UNSAFE_componentWillUpdate(s,p,l)),"function"==typeof o.componentDidUpdate&&(t.flags|=4),"function"==typeof o.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof o.componentDidUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!=typeof o.getSnapshotBeforeUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=p),o.props=s,o.state=p,o.context=l,s=c):("function"!=typeof o.componentDidUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!=typeof o.getSnapshotBeforeUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),s=!1)}return mg(e,t,i,s,n,r)}function mg(e,t,i,s,r,n){pg(e,t);var o=!!(128&t.flags);if(!s&&!o)return r&&jd(t,i,!1),Rg(e,t,n);s=t.stateNode,ag.current=t;var a=o&&"function"!=typeof i.getDerivedStateFromError?null:s.render();return t.flags|=1,null!==e&&o?(t.child=hf(t,e.child,null,n),t.child=hf(t,null,a,n)):cg(e,t,a,n),t.memoizedState=s.state,r&&jd(t,i,!0),t.child}function _g(e){var t=e.stateNode;t.pendingContext?Sd(0,t.pendingContext,t.pendingContext!==t.context):t.context&&Sd(0,t.context,!1),If(e,t.containerInfo)}function bg(e,t,i,s,r){return sf(),rf(r),t.flags|=256,cg(e,t,i,s),t.child}var xg,yg,wg,Sg,kg={dehydrated:null,treeContext:null,retryLane:0};function Cg(e){return{baseLanes:e,cachePool:null,transitions:null}}function jg(e,t,i){var s,r=t.pendingProps,n=Kf.current,o=!1,a=!!(128&t.flags);if((s=a)||(s=(null===e||null!==e.memoizedState)&&!!(2&n)),s?(o=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(n|=1),gd(Kf,1&n),null===e)return Zd(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(1&t.mode?"$!"===e.data?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=r.children,e=r.fallback,o?(r=t.mode,o=t.child,a={mode:"hidden",children:a},1&r||null===o?o=Cm(a,r,0,null):(o.childLanes=0,o.pendingProps=a),e=km(e,r,i,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=Cg(i),t.memoizedState=kg,e):Ng(t,a));if(null!==(n=e.memoizedState)&&null!==(s=n.dehydrated))return function(e,t,i,s,r,n,o){if(i)return 256&t.flags?(t.flags&=-257,Mg(e,t,o,s=Qp(Error(Go(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(n=s.fallback,r=t.mode,s=Cm({mode:"visible",children:s.children},r,0,null),(n=km(n,r,o,null)).flags|=2,s.return=t,n.return=t,s.sibling=n,t.child=s,1&t.mode&&hf(t,e.child,null,o),t.child.memoizedState=Cg(o),t.memoizedState=kg,n);if(!(1&t.mode))return Mg(e,t,o,null);if("$!"===r.data){if(s=r.nextSibling&&r.nextSibling.dataset)var a=s.dgst;return s=a,Mg(e,t,o,s=Qp(n=Error(Go(419)),s,void 0))}if(a=0!==(o&e.childLanes),lg||a){if(null!==(s=_v)){switch(o&-o){case 4:r=2;break;case 16:r=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:r=32;break;case 536870912:r=268435456;break;default:r=0}0!==(r=0!==(r&(s.suspendedLanes|o))?0:r)&&r!==n.retryLane&&(n.retryLane=r,kf(e,r),qv(s,e,r,-1))}return rm(),Mg(e,t,o,s=Qp(Error(Go(421))))}return"$?"===r.data?(t.flags|=128,t.child=e.child,t=vm.bind(null,e),r._reactRetry=t,null):(e=n.treeContext,$d=Zu(r.nextSibling),qd=t,Vd=!0,Yd=null,null!==e&&(Td[zd++]=Id,Td[zd++]=Fd,Td[zd++]=Od,Id=e.id,Fd=e.overflow,Od=t),t=Ng(t,s.children),t.flags|=4096,t)}(e,t,a,r,s,n,i);if(o){o=r.fallback,a=t.mode,s=(n=e.child).sibling;var l={mode:"hidden",children:r.children};return 1&a||t.child===n?(r=wm(n,l)).subtreeFlags=14680064&n.subtreeFlags:((r=t.child).childLanes=0,r.pendingProps=l,t.deletions=null),null!==s?o=wm(s,o):(o=km(o,a,i,null)).flags|=2,o.return=t,r.return=t,r.sibling=o,t.child=r,r=o,o=t.child,a=null===(a=e.child.memoizedState)?Cg(i):{baseLanes:a.baseLanes|i,cachePool:null,transitions:a.transitions},o.memoizedState=a,o.childLanes=e.childLanes&~i,t.memoizedState=kg,r}return e=(o=e.child).sibling,r=wm(o,{mode:"visible",children:r.children}),!(1&t.mode)&&(r.lanes=i),r.return=t,r.sibling=null,null!==e&&(null===(i=t.deletions)?(t.deletions=[e],t.flags|=16):i.push(e)),t.child=r,t.memoizedState=null,r}function Ng(e,t){return(t=Cm({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function Mg(e,t,i,s){return null!==s&&rf(s),hf(t,e.child,null,i),(e=Ng(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function Eg(e,t,i){e.lanes|=t;var s=e.alternate;null!==s&&(s.lanes|=t),_f(e.return,t,i)}function Bg(e,t,i,s,r){var n=e.memoizedState;null===n?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:i,tailMode:r}:(n.isBackwards=t,n.rendering=null,n.renderingStartTime=0,n.last=s,n.tail=i,n.tailMode=r)}function Dg(e,t,i){var s=t.pendingProps,r=s.revealOrder,n=s.tail;if(cg(e,t,s.children,i),2&(s=Kf.current))s=1&s|2,t.flags|=128;else{if(null!==e&&128&e.flags)e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&Eg(e,i,t);else if(19===e.tag)Eg(e,i,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}s&=1}if(gd(Kf,s),1&t.mode)switch(r){case"forwards":for(i=t.child,r=null;null!==i;)null!==(e=i.alternate)&&null===Uf(e)&&(r=i),i=i.sibling;null===(i=r)?(r=t.child,t.child=null):(r=i.sibling,i.sibling=null),Bg(t,!1,r,i,n);break;case"backwards":for(i=null,r=t.child,t.child=null;null!==r;){if(null!==(e=r.alternate)&&null===Uf(e)){t.child=r;break}e=r.sibling,r.sibling=i,i=r,r=e}Bg(t,!0,i,null,n);break;case"together":Bg(t,!1,null,null,void 0);break;default:t.memoizedState=null}else t.memoizedState=null;return t.child}function Lg(e,t){!(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Rg(e,t,i){if(null!==e&&(t.dependencies=e.dependencies),Cv|=t.lanes,0===(i&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(Go(153));if(null!==t.child){for(i=wm(e=t.child,e.pendingProps),t.child=i,i.return=t;null!==e.sibling;)e=e.sibling,(i=i.sibling=wm(e,e.pendingProps)).return=t;i.sibling=null}return t.child}function Pg(e,t){if(!Vd)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;null!==t;)null!==t.alternate&&(i=t),t=t.sibling;null===i?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var s=null;null!==i;)null!==i.alternate&&(s=i),i=i.sibling;null===s?t||null===e.tail?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Ag(e){var t=null!==e.alternate&&e.alternate.child===e.child,i=0,s=0;if(t)for(var r=e.child;null!==r;)i|=r.lanes|r.childLanes,s|=14680064&r.subtreeFlags,s|=14680064&r.flags,r.return=e,r=r.sibling;else for(r=e.child;null!==r;)i|=r.lanes|r.childLanes,s|=r.subtreeFlags,s|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=s,e.childLanes=i,t}function Tg(e,t,i){var s=t.pendingProps;switch(Ud(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ag(t),null;case 1:case 17:return yd(t.type)&&wd(),Ag(t),null;case 3:return s=t.stateNode,Ff(),pd(_d),pd(md),$f(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),null!==e&&null!==e.child||(ef(t)?t.flags|=4:null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,null!==Yd&&(Gv(Yd),Yd=null))),yg(e,t),Ag(t),null;case 5:Wf(t);var r=Of(zf.current);if(i=t.type,null!==e&&null!=t.stateNode)wg(e,t,i,s,r),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!s){if(null===t.stateNode)throw Error(Go(166));return Ag(t),null}if(e=Of(Af.current),ef(t)){s=t.stateNode,i=t.type;var n=t.memoizedProps;switch(s[td]=t,s[id]=n,e=!!(1&t.mode),i){case"dialog":Mu("cancel",s),Mu("close",s);break;case"iframe":case"object":case"embed":Mu("load",s);break;case"video":case"audio":for(r=0;r<ku.length;r++)Mu(ku[r],s);break;case"source":Mu("error",s);break;case"img":case"image":case"link":Mu("error",s),Mu("load",s);break;case"details":Mu("toggle",s);break;case"input":Fa(s,n),Mu("invalid",s);break;case"select":s._wrapperState={wasMultiple:!!n.multiple},Mu("invalid",s);break;case"textarea":Ya(s,n),Mu("invalid",s)}for(var o in ll(i,n),r=null,n)if(n.hasOwnProperty(o)){var a=n[o];"children"===o?"string"==typeof a?s.textContent!==a&&(!0!==n.suppressHydrationWarning&&Hu(s.textContent,a,e),r=["children",a]):"number"==typeof a&&s.textContent!==""+a&&(!0!==n.suppressHydrationWarning&&Hu(s.textContent,a,e),r=["children",""+a]):Jo.hasOwnProperty(o)&&null!=a&&"onScroll"===o&&Mu("scroll",s)}switch(i){case"input":Ta(s),Ka(s,n,!0);break;case"textarea":Ta(s),Xa(s);break;case"select":case"option":break;default:"function"==typeof n.onClick&&(s.onclick=Wu)}s=r,t.updateQueue=s,null!==s&&(t.flags|=4)}else{o=9===r.nodeType?r:r.ownerDocument,"http://www.w3.org/1999/xhtml"===e&&(e=Ja(i)),"http://www.w3.org/1999/xhtml"===e?"script"===i?((e=o.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"==typeof s.is?e=o.createElement(i,{is:s.is}):(e=o.createElement(i),"select"===i&&(o=e,s.multiple?o.multiple=!0:s.size&&(o.size=s.size))):e=o.createElementNS(e,i),e[td]=t,e[id]=s,xg(e,t,!1,!1),t.stateNode=e;e:{switch(o=cl(i,s),i){case"dialog":Mu("cancel",e),Mu("close",e),r=s;break;case"iframe":case"object":case"embed":Mu("load",e),r=s;break;case"video":case"audio":for(r=0;r<ku.length;r++)Mu(ku[r],e);r=s;break;case"source":Mu("error",e),r=s;break;case"img":case"image":case"link":Mu("error",e),Mu("load",e),r=s;break;case"details":Mu("toggle",e),r=s;break;case"input":Fa(e,s),r=Ia(e,s),Mu("invalid",e);break;case"option":default:r=s;break;case"select":e._wrapperState={wasMultiple:!!s.multiple},r=Na({},s,{value:void 0}),Mu("invalid",e);break;case"textarea":Ya(e,s),r=Va(e,s),Mu("invalid",e)}for(n in ll(i,r),a=r)if(a.hasOwnProperty(n)){var l=a[n];"style"===n?ol(e,l):"dangerouslySetInnerHTML"===n?null!=(l=l?l.__html:void 0)&&tl(e,l):"children"===n?"string"==typeof l?("textarea"!==i||""!==l)&&il(e,l):"number"==typeof l&&il(e,""+l):"suppressContentEditableWarning"!==n&&"suppressHydrationWarning"!==n&&"autoFocus"!==n&&(Jo.hasOwnProperty(n)?null!=l&&"onScroll"===n&&Mu("scroll",e):null!=l&&ca(e,n,l,o))}switch(i){case"input":Ta(e),Ka(e,s,!1);break;case"textarea":Ta(e),Xa(e);break;case"option":null!=s.value&&e.setAttribute("value",""+Pa(s.value));break;case"select":e.multiple=!!s.multiple,null!=(n=s.value)?$a(e,!!s.multiple,n,!1):null!=s.defaultValue&&$a(e,!!s.multiple,s.defaultValue,!0);break;default:"function"==typeof r.onClick&&(e.onclick=Wu)}switch(i){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}}s&&(t.flags|=4)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return Ag(t),null;case 6:if(e&&null!=t.stateNode)Sg(e,t,e.memoizedProps,s);else{if("string"!=typeof s&&null===t.stateNode)throw Error(Go(166));if(i=Of(zf.current),Of(Af.current),ef(t)){if(s=t.stateNode,i=t.memoizedProps,s[td]=t,(n=s.nodeValue!==i)&&null!==(e=qd))switch(e.tag){case 3:Hu(s.nodeValue,i,!!(1&e.mode));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&Hu(s.nodeValue,i,!!(1&e.mode))}n&&(t.flags|=4)}else(s=(9===i.nodeType?i:i.ownerDocument).createTextNode(s))[td]=t,t.stateNode=s}return Ag(t),null;case 13:if(pd(Kf),s=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(Vd&&null!==$d&&1&t.mode&&!(128&t.flags))tf(),sf(),t.flags|=98560,n=!1;else if(n=ef(t),null!==s&&null!==s.dehydrated){if(null===e){if(!n)throw Error(Go(318));if(!(n=null!==(n=t.memoizedState)?n.dehydrated:null))throw Error(Go(317));n[td]=t}else sf(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;Ag(t),n=!1}else null!==Yd&&(Gv(Yd),Yd=null),n=!0;if(!n)return 65536&t.flags?t:null}return 128&t.flags?(t.lanes=i,t):((s=null!==s)!==(null!==e&&null!==e.memoizedState)&&s&&(t.child.flags|=8192,1&t.mode&&(null===e||1&Kf.current?0===Sv&&(Sv=3):rm())),null!==t.updateQueue&&(t.flags|=4),Ag(t),null);case 4:return Ff(),yg(e,t),null===e&&Du(t.stateNode.containerInfo),Ag(t),null;case 10:return mf(t.type._context),Ag(t),null;case 19:if(pd(Kf),null===(n=t.memoizedState))return Ag(t),null;if(s=!!(128&t.flags),null===(o=n.rendering))if(s)Pg(n,!1);else{if(0!==Sv||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(o=Uf(e))){for(t.flags|=128,Pg(n,!1),null!==(s=o.updateQueue)&&(t.updateQueue=s,t.flags|=4),t.subtreeFlags=0,s=i,i=t.child;null!==i;)e=s,(n=i).flags&=14680066,null===(o=n.alternate)?(n.childLanes=0,n.lanes=e,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=o.childLanes,n.lanes=o.lanes,n.child=o.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=o.memoizedProps,n.memoizedState=o.memoizedState,n.updateQueue=o.updateQueue,n.type=o.type,e=o.dependencies,n.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),i=i.sibling;return gd(Kf,1&Kf.current|2),t.child}e=e.sibling}null!==n.tail&&Hl()>Dv&&(t.flags|=128,s=!0,Pg(n,!1),t.lanes=4194304)}else{if(!s)if(null!==(e=Uf(o))){if(t.flags|=128,s=!0,null!==(i=e.updateQueue)&&(t.updateQueue=i,t.flags|=4),Pg(n,!0),null===n.tail&&"hidden"===n.tailMode&&!o.alternate&&!Vd)return Ag(t),null}else 2*Hl()-n.renderingStartTime>Dv&&1073741824!==i&&(t.flags|=128,s=!0,Pg(n,!1),t.lanes=4194304);n.isBackwards?(o.sibling=t.child,t.child=o):(null!==(i=n.last)?i.sibling=o:t.child=o,n.last=o)}return null!==n.tail?(t=n.tail,n.rendering=t,n.tail=t.sibling,n.renderingStartTime=Hl(),t.sibling=null,i=Kf.current,gd(Kf,s?1&i|2:1&i),t):(Ag(t),null);case 22:case 23:return em(),s=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==s&&(t.flags|=8192),s&&1&t.mode?!!(1073741824&yv)&&(Ag(t),6&t.subtreeFlags&&(t.flags|=8192)):Ag(t),null;case 24:case 25:return null}throw Error(Go(156,t.tag))}function zg(e,t){switch(Ud(t),t.tag){case 1:return yd(t.type)&&wd(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return Ff(),pd(_d),pd(md),$f(),65536&(e=t.flags)&&!(128&e)?(t.flags=-65537&e|128,t):null;case 5:return Wf(t),null;case 13:if(pd(Kf),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(Go(340));sf()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return pd(Kf),null;case 4:return Ff(),null;case 10:return mf(t.type._context),null;case 22:case 23:return em(),null;default:return null}}xg=function(e,t){for(var i=t.child;null!==i;){if(5===i.tag||6===i.tag)e.appendChild(i.stateNode);else if(4!==i.tag&&null!==i.child){i.child.return=i,i=i.child;continue}if(i===t)break;for(;null===i.sibling;){if(null===i.return||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}},yg=function(){},wg=function(e,t,i,s){var r=e.memoizedProps;if(r!==s){e=t.stateNode,Of(Af.current);var n,o=null;switch(i){case"input":r=Ia(e,r),s=Ia(e,s),o=[];break;case"select":r=Na({},r,{value:void 0}),s=Na({},s,{value:void 0}),o=[];break;case"textarea":r=Va(e,r),s=Va(e,s),o=[];break;default:"function"!=typeof r.onClick&&"function"==typeof s.onClick&&(e.onclick=Wu)}for(c in ll(i,s),i=null,r)if(!s.hasOwnProperty(c)&&r.hasOwnProperty(c)&&null!=r[c])if("style"===c){var a=r[c];for(n in a)a.hasOwnProperty(n)&&(i||(i={}),i[n]="")}else"dangerouslySetInnerHTML"!==c&&"children"!==c&&"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&"autoFocus"!==c&&(Jo.hasOwnProperty(c)?o||(o=[]):(o=o||[]).push(c,null));for(c in s){var l=s[c];if(a=null!=r?r[c]:void 0,s.hasOwnProperty(c)&&l!==a&&(null!=l||null!=a))if("style"===c)if(a){for(n in a)!a.hasOwnProperty(n)||l&&l.hasOwnProperty(n)||(i||(i={}),i[n]="");for(n in l)l.hasOwnProperty(n)&&a[n]!==l[n]&&(i||(i={}),i[n]=l[n])}else i||(o||(o=[]),o.push(c,i)),i=l;else"dangerouslySetInnerHTML"===c?(l=l?l.__html:void 0,a=a?a.__html:void 0,null!=l&&a!==l&&(o=o||[]).push(c,l)):"children"===c?"string"!=typeof l&&"number"!=typeof l||(o=o||[]).push(c,""+l):"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&(Jo.hasOwnProperty(c)?(null!=l&&"onScroll"===c&&Mu("scroll",e),o||a===l||(o=[])):(o=o||[]).push(c,l))}i&&(o=o||[]).push("style",i);var c=o;(t.updateQueue=c)&&(t.flags|=4)}},Sg=function(e,t,i,s){i!==s&&(t.flags|=4)};var Og=!1,Ig=!1,Fg="function"==typeof WeakSet?WeakSet:Set,Hg=null;function Wg(e,t){var i=e.ref;if(null!==i)if("function"==typeof i)try{i(null)}catch(s){fm(e,t,s)}else i.current=null}function Kg(e,t,i){try{i()}catch(s){fm(e,t,s)}}var Ug=!1;function qg(e,t,i){var s=t.updateQueue;if(null!==(s=null!==s?s.lastEffect:null)){var r=s=s.next;do{if((r.tag&e)===e){var n=r.destroy;r.destroy=void 0,void 0!==n&&Kg(t,i,n)}r=r.next}while(r!==s)}}function $g(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var i=t=t.next;do{if((i.tag&e)===e){var s=i.create;i.destroy=s()}i=i.next}while(i!==t)}}function Vg(e){var t=e.ref;if(null!==t){var i=e.stateNode;e.tag,e=i,"function"==typeof t?t(e):t.current=e}}function Yg(e){var t=e.alternate;null!==t&&(e.alternate=null,Yg(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&(delete t[td],delete t[id],delete t[rd],delete t[nd],delete t[od])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Gg(e){return 5===e.tag||3===e.tag||4===e.tag}function Xg(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||Gg(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function Jg(e,t,i){var s=e.tag;if(5===s||6===s)e=e.stateNode,t?8===i.nodeType?i.parentNode.insertBefore(e,t):i.insertBefore(e,t):(8===i.nodeType?(t=i.parentNode).insertBefore(e,i):(t=i).appendChild(e),null!=(i=i._reactRootContainer)||null!==t.onclick||(t.onclick=Wu));else if(4!==s&&null!==(e=e.child))for(Jg(e,t,i),e=e.sibling;null!==e;)Jg(e,t,i),e=e.sibling}function Zg(e,t,i){var s=e.tag;if(5===s||6===s)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(4!==s&&null!==(e=e.child))for(Zg(e,t,i),e=e.sibling;null!==e;)Zg(e,t,i),e=e.sibling}var Qg=null,ev=!1;function tv(e,t,i){for(i=i.child;null!==i;)iv(e,t,i),i=i.sibling}function iv(e,t,i){if(Gl&&"function"==typeof Gl.onCommitFiberUnmount)try{Gl.onCommitFiberUnmount(Yl,i)}catch(a){}switch(i.tag){case 5:Ig||Wg(i,t);case 6:var s=Qg,r=ev;Qg=null,tv(e,t,i),ev=r,null!==(Qg=s)&&(ev?(e=Qg,i=i.stateNode,8===e.nodeType?e.parentNode.removeChild(i):e.removeChild(i)):Qg.removeChild(i.stateNode));break;case 18:null!==Qg&&(ev?(e=Qg,i=i.stateNode,8===e.nodeType?Ju(e.parentNode,i):1===e.nodeType&&Ju(e,i),Lc(e)):Ju(Qg,i.stateNode));break;case 4:s=Qg,r=ev,Qg=i.stateNode.containerInfo,ev=!0,tv(e,t,i),Qg=s,ev=r;break;case 0:case 11:case 14:case 15:if(!Ig&&(null!==(s=i.updateQueue)&&null!==(s=s.lastEffect))){r=s=s.next;do{var n=r,o=n.destroy;n=n.tag,void 0!==o&&(2&n||4&n)&&Kg(i,t,o),r=r.next}while(r!==s)}tv(e,t,i);break;case 1:if(!Ig&&(Wg(i,t),"function"==typeof(s=i.stateNode).componentWillUnmount))try{s.props=i.memoizedProps,s.state=i.memoizedState,s.componentWillUnmount()}catch(a){fm(i,t,a)}tv(e,t,i);break;case 21:tv(e,t,i);break;case 22:1&i.mode?(Ig=(s=Ig)||null!==i.memoizedState,tv(e,t,i),Ig=s):tv(e,t,i);break;default:tv(e,t,i)}}function sv(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var i=e.stateNode;null===i&&(i=e.stateNode=new Fg),t.forEach(function(t){var s=mm.bind(null,e,t);i.has(t)||(i.add(t),t.then(s,s))})}}function rv(e,t){var i=t.deletions;if(null!==i)for(var s=0;s<i.length;s++){var r=i[s];try{var n=e,o=t,a=o;e:for(;null!==a;){switch(a.tag){case 5:Qg=a.stateNode,ev=!1;break e;case 3:case 4:Qg=a.stateNode.containerInfo,ev=!0;break e}a=a.return}if(null===Qg)throw Error(Go(160));iv(n,o,r),Qg=null,ev=!1;var l=r.alternate;null!==l&&(l.return=null),r.return=null}catch(c){fm(r,t,c)}}if(12854&t.subtreeFlags)for(t=t.child;null!==t;)nv(t,e),t=t.sibling}function nv(e,t){var i=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(rv(t,e),ov(e),4&s){try{qg(3,e,e.return),$g(3,e)}catch(Kw){fm(e,e.return,Kw)}try{qg(5,e,e.return)}catch(Kw){fm(e,e.return,Kw)}}break;case 1:rv(t,e),ov(e),512&s&&null!==i&&Wg(i,i.return);break;case 5:if(rv(t,e),ov(e),512&s&&null!==i&&Wg(i,i.return),32&e.flags){var r=e.stateNode;try{il(r,"")}catch(Kw){fm(e,e.return,Kw)}}if(4&s&&null!=(r=e.stateNode)){var n=e.memoizedProps,o=null!==i?i.memoizedProps:n,a=e.type,l=e.updateQueue;if(e.updateQueue=null,null!==l)try{"input"===a&&"radio"===n.type&&null!=n.name&&Ha(r,n),cl(a,o);var c=cl(a,n);for(o=0;o<l.length;o+=2){var h=l[o],u=l[o+1];"style"===h?ol(r,u):"dangerouslySetInnerHTML"===h?tl(r,u):"children"===h?il(r,u):ca(r,h,u,c)}switch(a){case"input":Wa(r,n);break;case"textarea":Ga(r,n);break;case"select":var d=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!n.multiple;var f=n.value;null!=f?$a(r,!!n.multiple,f,!1):d!==!!n.multiple&&(null!=n.defaultValue?$a(r,!!n.multiple,n.defaultValue,!0):$a(r,!!n.multiple,n.multiple?[]:"",!1))}r[id]=n}catch(Kw){fm(e,e.return,Kw)}}break;case 6:if(rv(t,e),ov(e),4&s){if(null===e.stateNode)throw Error(Go(162));r=e.stateNode,n=e.memoizedProps;try{r.nodeValue=n}catch(Kw){fm(e,e.return,Kw)}}break;case 3:if(rv(t,e),ov(e),4&s&&null!==i&&i.memoizedState.isDehydrated)try{Lc(t.containerInfo)}catch(Kw){fm(e,e.return,Kw)}break;case 4:default:rv(t,e),ov(e);break;case 13:rv(t,e),ov(e),8192&(r=e.child).flags&&(n=null!==r.memoizedState,r.stateNode.isHidden=n,!n||null!==r.alternate&&null!==r.alternate.memoizedState||(Bv=Hl())),4&s&&sv(e);break;case 22:if(h=null!==i&&null!==i.memoizedState,1&e.mode?(Ig=(c=Ig)||h,rv(t,e),Ig=c):rv(t,e),ov(e),8192&s){if(c=null!==e.memoizedState,(e.stateNode.isHidden=c)&&!h&&1&e.mode)for(Hg=e,h=e.child;null!==h;){for(u=Hg=h;null!==Hg;){switch(f=(d=Hg).child,d.tag){case 0:case 11:case 14:case 15:qg(4,d,d.return);break;case 1:Wg(d,d.return);var p=d.stateNode;if("function"==typeof p.componentWillUnmount){s=d,i=d.return;try{t=s,p.props=t.memoizedProps,p.state=t.memoizedState,p.componentWillUnmount()}catch(Kw){fm(s,i,Kw)}}break;case 5:Wg(d,d.return);break;case 22:if(null!==d.memoizedState){hv(u);continue}}null!==f?(f.return=d,Hg=f):hv(u)}h=h.sibling}e:for(h=null,u=e;;){if(5===u.tag){if(null===h){h=u;try{r=u.stateNode,c?"function"==typeof(n=r.style).setProperty?n.setProperty("display","none","important"):n.display="none":(a=u.stateNode,o=null!=(l=u.memoizedProps.style)&&l.hasOwnProperty("display")?l.display:null,a.style.display=nl("display",o))}catch(Kw){fm(e,e.return,Kw)}}}else if(6===u.tag){if(null===h)try{u.stateNode.nodeValue=c?"":u.memoizedProps}catch(Kw){fm(e,e.return,Kw)}}else if((22!==u.tag&&23!==u.tag||null===u.memoizedState||u===e)&&null!==u.child){u.child.return=u,u=u.child;continue}if(u===e)break e;for(;null===u.sibling;){if(null===u.return||u.return===e)break e;h===u&&(h=null),u=u.return}h===u&&(h=null),u.sibling.return=u.return,u=u.sibling}}break;case 19:rv(t,e),ov(e),4&s&&sv(e);case 21:}}function ov(e){var t=e.flags;if(2&t){try{e:{for(var i=e.return;null!==i;){if(Gg(i)){var s=i;break e}i=i.return}throw Error(Go(160))}switch(s.tag){case 5:var r=s.stateNode;32&s.flags&&(il(r,""),s.flags&=-33),Zg(e,Xg(e),r);break;case 3:case 4:var n=s.stateNode.containerInfo;Jg(e,Xg(e),n);break;default:throw Error(Go(161))}}catch(o){fm(e,e.return,o)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function av(e,t,i){Hg=e,lv(e)}function lv(e,t,i){for(var s=!!(1&e.mode);null!==Hg;){var r=Hg,n=r.child;if(22===r.tag&&s){var o=null!==r.memoizedState||Og;if(!o){var a=r.alternate,l=null!==a&&null!==a.memoizedState||Ig;a=Og;var c=Ig;if(Og=o,(Ig=l)&&!c)for(Hg=r;null!==Hg;)l=(o=Hg).child,22===o.tag&&null!==o.memoizedState?uv(r):null!==l?(l.return=o,Hg=l):uv(r);for(;null!==n;)Hg=n,lv(n),n=n.sibling;Hg=r,Og=a,Ig=c}cv(e)}else 8772&r.subtreeFlags&&null!==n?(n.return=r,Hg=n):cv(e)}}function cv(e){for(;null!==Hg;){var t=Hg;if(8772&t.flags){var i=t.alternate;try{if(8772&t.flags)switch(t.tag){case 0:case 11:case 15:Ig||$g(5,t);break;case 1:var s=t.stateNode;if(4&t.flags&&!Ig)if(null===i)s.componentDidMount();else{var r=t.elementType===t.type?i.memoizedProps:qp(t.type,i.memoizedProps);s.componentDidUpdate(r,i.memoizedState,s.__reactInternalSnapshotBeforeUpdate)}var n=t.updateQueue;null!==n&&Rf(t,n,s);break;case 3:var o=t.updateQueue;if(null!==o){if(i=null,null!==t.child)switch(t.child.tag){case 5:case 1:i=t.child.stateNode}Rf(t,o,i)}break;case 5:var a=t.stateNode;if(null===i&&4&t.flags){i=a;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&i.focus();break;case"img":l.src&&(i.src=l.src)}}break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:case 25:break;case 13:if(null===t.memoizedState){var c=t.alternate;if(null!==c){var h=c.memoizedState;if(null!==h){var u=h.dehydrated;null!==u&&Lc(u)}}}break;default:throw Error(Go(163))}Ig||512&t.flags&&Vg(t)}catch(dw){fm(t,t.return,dw)}}if(t===e){Hg=null;break}if(null!==(i=t.sibling)){i.return=t.return,Hg=i;break}Hg=t.return}}function hv(e){for(;null!==Hg;){var t=Hg;if(t===e){Hg=null;break}var i=t.sibling;if(null!==i){i.return=t.return,Hg=i;break}Hg=t.return}}function uv(e){for(;null!==Hg;){var t=Hg;try{switch(t.tag){case 0:case 11:case 15:var i=t.return;try{$g(4,t)}catch(l){fm(t,i,l)}break;case 1:var s=t.stateNode;if("function"==typeof s.componentDidMount){var r=t.return;try{s.componentDidMount()}catch(l){fm(t,r,l)}}var n=t.return;try{Vg(t)}catch(l){fm(t,n,l)}break;case 5:var o=t.return;try{Vg(t)}catch(l){fm(t,o,l)}}}catch(l){fm(t,t.return,l)}if(t===e){Hg=null;break}var a=t.sibling;if(null!==a){a.return=t.return,Hg=a;break}Hg=t.return}}var dv,fv=Math.ceil,pv=ha.ReactCurrentDispatcher,gv=ha.ReactCurrentOwner,vv=ha.ReactCurrentBatchConfig,mv=0,_v=null,bv=null,xv=0,yv=0,wv=fd(0),Sv=0,kv=null,Cv=0,jv=0,Nv=0,Mv=null,Ev=null,Bv=0,Dv=1/0,Lv=null,Rv=!1,Pv=null,Av=null,Tv=!1,zv=null,Ov=0,Iv=0,Fv=null,Hv=-1,Wv=0;function Kv(){return 6&mv?Hl():-1!==Hv?Hv:Hv=Hl()}function Uv(e){return 1&e.mode?2&mv&&0!==xv?xv&-xv:null!==nf.transition?(0===Wv&&(Wv=nc()),Wv):0!==(e=cc)?e:e=void 0===(e=window.event)?16:Fc(e.type):1}function qv(e,t,i,s){if(50<Iv)throw Iv=0,Fv=null,Error(Go(185));ac(e,i,s),2&mv&&e===_v||(e===_v&&(!(2&mv)&&(jv|=i),4===Sv&&Xv(e,xv)),$v(e,s),1===i&&0===mv&&!(1&t.mode)&&(Dv=Hl()+500,Md&&Dd()))}function $v(e,t){var i=e.callbackNode;!function(e,t){for(var i=e.suspendedLanes,s=e.pingedLanes,r=e.expirationTimes,n=e.pendingLanes;0<n;){var o=31-Xl(n),a=1<<o,l=r[o];-1===l?0!==(a&i)&&0===(a&s)||(r[o]=sc(a,t)):l<=t&&(e.expiredLanes|=a),n&=~a}}(e,t);var s=ic(e,e===_v?xv:0);if(0===s)null!==i&&Ol(i),e.callbackNode=null,e.callbackPriority=0;else if(t=s&-s,e.callbackPriority!==t){if(null!=i&&Ol(i),1===t)0===e.tag?function(e){Md=!0,Bd(e)}(Jv.bind(null,e)):Bd(Jv.bind(null,e)),Gu(function(){!(6&mv)&&Dd()}),i=null;else{switch(hc(s)){case 1:i=Kl;break;case 4:i=Ul;break;case 16:default:i=ql;break;case 536870912:i=Vl}i=_m(i,Vv.bind(null,e))}e.callbackPriority=t,e.callbackNode=i}}function Vv(e,t){if(Hv=-1,Wv=0,6&mv)throw Error(Go(327));var i=e.callbackNode;if(um()&&e.callbackNode!==i)return null;var s=ic(e,e===_v?xv:0);if(0===s)return null;if(30&s||0!==(s&e.expiredLanes)||t)t=nm(e,s);else{t=s;var r=mv;mv|=2;var n=sm();for(_v===e&&xv===t||(Lv=null,Dv=Hl()+500,tm(e,t));;)try{am();break}catch(a){im(e,a)}vf(),pv.current=n,mv=r,null!==bv?t=0:(_v=null,xv=0,t=Sv)}if(0!==t){if(2===t&&(0!==(r=rc(e))&&(s=r,t=Yv(e,r))),1===t)throw i=kv,tm(e,0),Xv(e,s),$v(e,Hl()),i;if(6===t)Xv(e,s);else{if(r=e.current.alternate,!(30&s||function(e){for(var t=e;;){if(16384&t.flags){var i=t.updateQueue;if(null!==i&&null!==(i=i.stores))for(var s=0;s<i.length;s++){var r=i[s],n=r.getSnapshot;r=r.value;try{if(!Xh(n(),r))return!1}catch(o){return!1}}}if(i=t.child,16384&t.subtreeFlags&&null!==i)i.return=t,t=i;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}(r)||(t=nm(e,s),2===t&&(n=rc(e),0!==n&&(s=n,t=Yv(e,n))),1!==t)))throw i=kv,tm(e,0),Xv(e,s),$v(e,Hl()),i;switch(e.finishedWork=r,e.finishedLanes=s,t){case 0:case 1:throw Error(Go(345));case 2:case 5:hm(e,Ev,Lv);break;case 3:if(Xv(e,s),(130023424&s)===s&&10<(t=Bv+500-Hl())){if(0!==ic(e,0))break;if(((r=e.suspendedLanes)&s)!==s){Kv(),e.pingedLanes|=e.suspendedLanes&r;break}e.timeoutHandle=$u(hm.bind(null,e,Ev,Lv),t);break}hm(e,Ev,Lv);break;case 4:if(Xv(e,s),(4194240&s)===s)break;for(t=e.eventTimes,r=-1;0<s;){var o=31-Xl(s);n=1<<o,(o=t[o])>r&&(r=o),s&=~n}if(s=r,10<(s=(120>(s=Hl()-s)?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*fv(s/1960))-s)){e.timeoutHandle=$u(hm.bind(null,e,Ev,Lv),s);break}hm(e,Ev,Lv);break;default:throw Error(Go(329))}}}return $v(e,Hl()),e.callbackNode===i?Vv.bind(null,e):null}function Yv(e,t){var i=Mv;return e.current.memoizedState.isDehydrated&&(tm(e,t).flags|=256),2!==(e=nm(e,t))&&(t=Ev,Ev=i,null!==t&&Gv(t)),e}function Gv(e){null===Ev?Ev=e:Ev.push.apply(Ev,e)}function Xv(e,t){for(t&=~Nv,t&=~jv,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var i=31-Xl(t),s=1<<i;e[i]=-1,t&=~s}}function Jv(e){if(6&mv)throw Error(Go(327));um();var t=ic(e,0);if(!(1&t))return $v(e,Hl()),null;var i=nm(e,t);if(0!==e.tag&&2===i){var s=rc(e);0!==s&&(t=s,i=Yv(e,s))}if(1===i)throw i=kv,tm(e,0),Xv(e,t),$v(e,Hl()),i;if(6===i)throw Error(Go(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,hm(e,Ev,Lv),$v(e,Hl()),null}function Zv(e,t){var i=mv;mv|=1;try{return e(t)}finally{0===(mv=i)&&(Dv=Hl()+500,Md&&Dd())}}function Qv(e){null!==zv&&0===zv.tag&&!(6&mv)&&um();var t=mv;mv|=1;var i=vv.transition,s=cc;try{if(vv.transition=null,cc=1,e)return e()}finally{cc=s,vv.transition=i,!(6&(mv=t))&&Dd()}}function em(){yv=wv.current,pd(wv)}function tm(e,t){e.finishedWork=null,e.finishedLanes=0;var i=e.timeoutHandle;if(-1!==i&&(e.timeoutHandle=-1,Vu(i)),null!==bv)for(i=bv.return;null!==i;){var s=i;switch(Ud(s),s.tag){case 1:null!=(s=s.type.childContextTypes)&&wd();break;case 3:Ff(),pd(_d),pd(md),$f();break;case 5:Wf(s);break;case 4:Ff();break;case 13:case 19:pd(Kf);break;case 10:mf(s.type._context);break;case 22:case 23:em()}i=i.return}if(_v=e,bv=e=wm(e.current,null),xv=yv=t,Sv=0,kv=null,Nv=jv=Cv=0,Ev=Mv=null,null!==yf){for(t=0;t<yf.length;t++)if(null!==(s=(i=yf[t]).interleaved)){i.interleaved=null;var r=s.next,n=i.pending;if(null!==n){var o=n.next;n.next=r,s.next=o}i.pending=s}yf=null}return e}function im(e,t){for(;;){var i=bv;try{if(vf(),Vf.current=Hp,Qf){for(var s=Xf.memoizedState;null!==s;){var r=s.queue;null!==r&&(r.pending=null),s=s.next}Qf=!1}if(Gf=0,Zf=Jf=Xf=null,ep=!1,tp=0,gv.current=null,null===i||null===i.return){Sv=1,kv=t,bv=null;break}e:{var n=e,o=i.return,a=i,l=t;if(t=xv,a.flags|=32768,null!==l&&"object"==typeof l&&"function"==typeof l.then){var c=l,h=a,u=h.tag;if(!(1&h.mode||0!==u&&11!==u&&15!==u)){var d=h.alternate;d?(h.updateQueue=d.updateQueue,h.memoizedState=d.memoizedState,h.lanes=d.lanes):(h.updateQueue=null,h.memoizedState=null)}var f=ng(o);if(null!==f){f.flags&=-257,og(f,o,a,0,t),1&f.mode&&rg(n,c,t),l=c;var p=(t=f).updateQueue;if(null===p){var g=new Set;g.add(l),t.updateQueue=g}else p.add(l);break e}if(!(1&t)){rg(n,c,t),rm();break e}l=Error(Go(426))}else if(Vd&&1&a.mode){var v=ng(o);if(null!==v){!(65536&v.flags)&&(v.flags|=256),og(v,o,a,0,t),rf(Zp(l,a));break e}}n=l=Zp(l,a),4!==Sv&&(Sv=2),null===Mv?Mv=[n]:Mv.push(n),n=o;do{switch(n.tag){case 3:n.flags|=65536,t&=-t,n.lanes|=t,Df(n,ig(0,l,t));break e;case 1:a=l;var m=n.type,_=n.stateNode;if(!(128&n.flags||"function"!=typeof m.getDerivedStateFromError&&(null===_||"function"!=typeof _.componentDidCatch||null!==Av&&Av.has(_)))){n.flags|=65536,t&=-t,n.lanes|=t,Df(n,sg(n,a,t));break e}}n=n.return}while(null!==n)}cm(i)}catch(b){t=b,bv===i&&null!==i&&(bv=i=i.return);continue}break}}function sm(){var e=pv.current;return pv.current=Hp,null===e?Hp:e}function rm(){0!==Sv&&3!==Sv&&2!==Sv||(Sv=4),null===_v||!(268435455&Cv)&&!(268435455&jv)||Xv(_v,xv)}function nm(e,t){var i=mv;mv|=2;var s=sm();for(_v===e&&xv===t||(Lv=null,tm(e,t));;)try{om();break}catch(r){im(e,r)}if(vf(),mv=i,pv.current=s,null!==bv)throw Error(Go(261));return _v=null,xv=0,Sv}function om(){for(;null!==bv;)lm(bv)}function am(){for(;null!==bv&&!Il();)lm(bv)}function lm(e){var t=dv(e.alternate,e,yv);e.memoizedProps=e.pendingProps,null===t?cm(e):bv=t,gv.current=null}function cm(e){var t=e;do{var i=t.alternate;if(e=t.return,32768&t.flags){if(null!==(i=zg(i,t)))return i.flags&=32767,void(bv=i);if(null===e)return Sv=6,void(bv=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}else if(null!==(i=Tg(i,t,yv)))return void(bv=i);if(null!==(t=t.sibling))return void(bv=t);bv=t=e}while(null!==t);0===Sv&&(Sv=5)}function hm(e,t,i){var s=cc,r=vv.transition;try{vv.transition=null,cc=1,function(e,t,i,s){do{um()}while(null!==zv);if(6&mv)throw Error(Go(327));i=e.finishedWork;var r=e.finishedLanes;if(null===i)return null;if(e.finishedWork=null,e.finishedLanes=0,i===e.current)throw Error(Go(177));e.callbackNode=null,e.callbackPriority=0;var n=i.lanes|i.childLanes;if(function(e,t){var i=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var s=e.eventTimes;for(e=e.expirationTimes;0<i;){var r=31-Xl(i),n=1<<r;t[r]=0,s[r]=-1,e[r]=-1,i&=~n}}(e,n),e===_v&&(bv=_v=null,xv=0),!(2064&i.subtreeFlags)&&!(2064&i.flags)||Tv||(Tv=!0,_m(ql,function(){return um(),null})),n=!!(15990&i.flags),!!(15990&i.subtreeFlags)||n){n=vv.transition,vv.transition=null;var o=cc;cc=1;var a=mv;mv|=4,gv.current=null,function(e,t){if(Ku=Pc,iu(e=tu())){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{var s=(i=(i=e.ownerDocument)&&i.defaultView||window).getSelection&&i.getSelection();if(s&&0!==s.rangeCount){i=s.anchorNode;var r=s.anchorOffset,n=s.focusNode;s=s.focusOffset;try{i.nodeType,n.nodeType}catch(x){i=null;break e}var o=0,a=-1,l=-1,c=0,h=0,u=e,d=null;t:for(;;){for(var f;u!==i||0!==r&&3!==u.nodeType||(a=o+r),u!==n||0!==s&&3!==u.nodeType||(l=o+s),3===u.nodeType&&(o+=u.nodeValue.length),null!==(f=u.firstChild);)d=u,u=f;for(;;){if(u===e)break t;if(d===i&&++c===r&&(a=o),d===n&&++h===s&&(l=o),null!==(f=u.nextSibling))break;d=(u=d).parentNode}u=f}i=-1===a||-1===l?null:{start:a,end:l}}else i=null}i=i||{start:0,end:0}}else i=null;for(Uu={focusedElem:e,selectionRange:i},Pc=!1,Hg=t;null!==Hg;)if(e=(t=Hg).child,1028&t.subtreeFlags&&null!==e)e.return=t,Hg=e;else for(;null!==Hg;){t=Hg;try{var p=t.alternate;if(1024&t.flags)switch(t.tag){case 0:case 11:case 15:case 5:case 6:case 4:case 17:break;case 1:if(null!==p){var g=p.memoizedProps,v=p.memoizedState,m=t.stateNode,_=m.getSnapshotBeforeUpdate(t.elementType===t.type?g:qp(t.type,g),v);m.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var b=t.stateNode.containerInfo;1===b.nodeType?b.textContent="":9===b.nodeType&&b.documentElement&&b.removeChild(b.documentElement);break;default:throw Error(Go(163))}}catch(x){fm(t,t.return,x)}if(null!==(e=t.sibling)){e.return=t.return,Hg=e;break}Hg=t.return}p=Ug,Ug=!1}(e,i),nv(i,e),su(Uu),Pc=!!Ku,Uu=Ku=null,e.current=i,av(i),Fl(),mv=a,cc=o,vv.transition=n}else e.current=i;if(Tv&&(Tv=!1,zv=e,Ov=r),n=e.pendingLanes,0===n&&(Av=null),function(e){if(Gl&&"function"==typeof Gl.onCommitFiberRoot)try{Gl.onCommitFiberRoot(Yl,e,void 0,!(128&~e.current.flags))}catch(t){}}(i.stateNode),$v(e,Hl()),null!==t)for(s=e.onRecoverableError,i=0;i<t.length;i++)r=t[i],s(r.value,{componentStack:r.stack,digest:r.digest});if(Rv)throw Rv=!1,e=Pv,Pv=null,e;!!(1&Ov)&&0!==e.tag&&um(),n=e.pendingLanes,1&n?e===Fv?Iv++:(Iv=0,Fv=e):Iv=0,Dd()}(e,t,i,s)}finally{vv.transition=r,cc=s}return null}function um(){if(null!==zv){var e=hc(Ov),t=vv.transition,i=cc;try{if(vv.transition=null,cc=16>e?16:e,null===zv)var s=!1;else{if(e=zv,zv=null,Ov=0,6&mv)throw Error(Go(331));var r=mv;for(mv|=4,Hg=e.current;null!==Hg;){var n=Hg,o=n.child;if(16&Hg.flags){var a=n.deletions;if(null!==a){for(var l=0;l<a.length;l++){var c=a[l];for(Hg=c;null!==Hg;){var h=Hg;switch(h.tag){case 0:case 11:case 15:qg(8,h,n)}var u=h.child;if(null!==u)u.return=h,Hg=u;else for(;null!==Hg;){var d=(h=Hg).sibling,f=h.return;if(Yg(h),h===c){Hg=null;break}if(null!==d){d.return=f,Hg=d;break}Hg=f}}}var p=n.alternate;if(null!==p){var g=p.child;if(null!==g){p.child=null;do{var v=g.sibling;g.sibling=null,g=v}while(null!==g)}}Hg=n}}if(2064&n.subtreeFlags&&null!==o)o.return=n,Hg=o;else e:for(;null!==Hg;){if(2048&(n=Hg).flags)switch(n.tag){case 0:case 11:case 15:qg(9,n,n.return)}var m=n.sibling;if(null!==m){m.return=n.return,Hg=m;break e}Hg=n.return}}var _=e.current;for(Hg=_;null!==Hg;){var b=(o=Hg).child;if(2064&o.subtreeFlags&&null!==b)b.return=o,Hg=b;else e:for(o=_;null!==Hg;){if(2048&(a=Hg).flags)try{switch(a.tag){case 0:case 11:case 15:$g(9,a)}}catch(y){fm(a,a.return,y)}if(a===o){Hg=null;break e}var x=a.sibling;if(null!==x){x.return=a.return,Hg=x;break e}Hg=a.return}}if(mv=r,Dd(),Gl&&"function"==typeof Gl.onPostCommitFiberRoot)try{Gl.onPostCommitFiberRoot(Yl,e)}catch(y){}s=!0}return s}finally{cc=i,vv.transition=t}}return!1}function dm(e,t,i){e=Ef(e,t=ig(0,t=Zp(i,t),1),1),t=Kv(),null!==e&&(ac(e,1,t),$v(e,t))}function fm(e,t,i){if(3===e.tag)dm(e,e,i);else for(;null!==t;){if(3===t.tag){dm(t,e,i);break}if(1===t.tag){var s=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof s.componentDidCatch&&(null===Av||!Av.has(s))){t=Ef(t,e=sg(t,e=Zp(i,e),1),1),e=Kv(),null!==t&&(ac(t,1,e),$v(t,e));break}}t=t.return}}function pm(e,t,i){var s=e.pingCache;null!==s&&s.delete(t),t=Kv(),e.pingedLanes|=e.suspendedLanes&i,_v===e&&(xv&i)===i&&(4===Sv||3===Sv&&(130023424&xv)===xv&&500>Hl()-Bv?tm(e,0):Nv|=i),$v(e,t)}function gm(e,t){0===t&&(1&e.mode?(t=ec,!(130023424&(ec<<=1))&&(ec=4194304)):t=1);var i=Kv();null!==(e=kf(e,t))&&(ac(e,t,i),$v(e,i))}function vm(e){var t=e.memoizedState,i=0;null!==t&&(i=t.retryLane),gm(e,i)}function mm(e,t){var i=0;switch(e.tag){case 13:var s=e.stateNode,r=e.memoizedState;null!==r&&(i=r.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(Go(314))}null!==s&&s.delete(t),gm(e,i)}function _m(e,t){return zl(e,t)}function bm(e,t,i,s){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function xm(e,t,i,s){return new bm(e,t,i,s)}function ym(e){return!(!(e=e.prototype)||!e.isReactComponent)}function wm(e,t){var i=e.alternate;return null===i?((i=xm(e.tag,t,e.key,e.mode)).elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=14680064&e.flags,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i}function Sm(e,t,i,s,r,n){var o=2;if(s=e,"function"==typeof e)ym(e)&&(o=1);else if("string"==typeof e)o=5;else e:switch(e){case fa:return km(i.children,r,n,t);case pa:o=8,r|=8;break;case ga:return(e=xm(12,i,t,2|r)).elementType=ga,e.lanes=n,e;case ba:return(e=xm(13,i,t,r)).elementType=ba,e.lanes=n,e;case xa:return(e=xm(19,i,t,r)).elementType=xa,e.lanes=n,e;case Sa:return Cm(i,r,n,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case va:o=10;break e;case ma:o=9;break e;case _a:o=11;break e;case ya:o=14;break e;case wa:o=16,s=null;break e}throw Error(Go(130,null==e?e:typeof e,""))}return(t=xm(o,i,t,r)).elementType=e,t.type=s,t.lanes=n,t}function km(e,t,i,s){return(e=xm(7,e,s,t)).lanes=i,e}function Cm(e,t,i,s){return(e=xm(22,e,s,t)).elementType=Sa,e.lanes=i,e.stateNode={isHidden:!1},e}function jm(e,t,i){return(e=xm(6,e,null,t)).lanes=i,e}function Nm(e,t,i){return(t=xm(4,null!==e.children?e.children:[],e.key,t)).lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Mm(e,t,i,s,r){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=oc(0),this.expirationTimes=oc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=oc(0),this.identifierPrefix=s,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function Em(e,t,i,s,r,n,o,a,l){return e=new Mm(e,t,i,a,l),1===t?(t=1,!0===n&&(t|=8)):t=0,n=xm(3,null,null,t),e.current=n,n.stateNode=e,n.memoizedState={element:s,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},jf(n),e}function Bm(e){if(!e)return vd;e:{if(Ll(e=e._reactInternals)!==e||1!==e.tag)throw Error(Go(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(yd(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(Go(171))}if(1===e.tag){var i=e.type;if(yd(i))return kd(e,i,t)}return t}function Dm(e,t,i,s,r,n,o,a,l){return(e=Em(i,s,!0,e,0,n,0,a,l)).context=Bm(null),i=e.current,(n=Mf(s=Kv(),r=Uv(i))).callback=null!=t?t:null,Ef(i,n,r),e.current.lanes=r,ac(e,r,s),$v(e,s),e}function Lm(e,t,i,s){var r=t.current,n=Kv(),o=Uv(r);return i=Bm(i),null===t.context?t.context=i:t.pendingContext=i,(t=Mf(n,o)).payload={element:e},null!==(s=void 0===s?null:s)&&(t.callback=s),null!==(e=Ef(r,t,o))&&(qv(e,r,o,n),Bf(e,r,o)),o}function Rm(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function Pm(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var i=e.retryLane;e.retryLane=0!==i&&i<t?i:t}}function Am(e,t){Pm(e,t),(e=e.alternate)&&Pm(e,t)}dv=function(e,t,i){if(null!==e)if(e.memoizedProps!==t.pendingProps||_d.current)lg=!0;else{if(0===(e.lanes&i)&&!(128&t.flags))return lg=!1,function(e,t,i){switch(t.tag){case 3:_g(t),sf();break;case 5:Hf(t);break;case 1:yd(t.type)&&Cd(t);break;case 4:If(t,t.stateNode.containerInfo);break;case 10:var s=t.type._context,r=t.memoizedProps.value;gd(df,s._currentValue),s._currentValue=r;break;case 13:if(null!==(s=t.memoizedState))return null!==s.dehydrated?(gd(Kf,1&Kf.current),t.flags|=128,null):0!==(i&t.child.childLanes)?jg(e,t,i):(gd(Kf,1&Kf.current),null!==(e=Rg(e,t,i))?e.sibling:null);gd(Kf,1&Kf.current);break;case 19:if(s=0!==(i&t.childLanes),128&e.flags){if(s)return Dg(e,t,i);t.flags|=128}if(null!==(r=t.memoizedState)&&(r.rendering=null,r.tail=null,r.lastEffect=null),gd(Kf,Kf.current),s)break;return null;case 22:case 23:return t.lanes=0,fg(e,t,i)}return Rg(e,t,i)}(e,t,i);lg=!!(131072&e.flags)}else lg=!1,Vd&&1048576&t.flags&&Wd(t,Ad,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;Lg(e,t),e=t.pendingProps;var r=xd(t,md.current);bf(t,i),r=np(null,t,s,e,r,i);var n=op();return t.flags|=1,"object"==typeof r&&null!==r&&"function"==typeof r.render&&void 0===r.$$typeof?(t.tag=1,t.memoizedState=null,t.updateQueue=null,yd(s)?(n=!0,Cd(t)):n=!1,t.memoizedState=null!==r.state&&void 0!==r.state?r.state:null,jf(t),r.updater=Vp,t.stateNode=r,r._reactInternals=t,Jp(t,s,e,i),t=mg(null,t,s,!0,n,i)):(t.tag=0,Vd&&n&&Kd(t),cg(null,t,r,i),t=t.child),t;case 16:s=t.elementType;e:{switch(Lg(e,t),e=t.pendingProps,s=(r=s._init)(s._payload),t.type=s,r=t.tag=function(e){if("function"==typeof e)return ym(e)?1:0;if(null!=e){if((e=e.$$typeof)===_a)return 11;if(e===ya)return 14}return 2}(s),e=qp(s,e),r){case 0:t=gg(null,t,s,e,i);break e;case 1:t=vg(null,t,s,e,i);break e;case 11:t=hg(null,t,s,e,i);break e;case 14:t=ug(null,t,s,qp(s.type,e),i);break e}throw Error(Go(306,s,""))}return t;case 0:return s=t.type,r=t.pendingProps,gg(e,t,s,r=t.elementType===s?r:qp(s,r),i);case 1:return s=t.type,r=t.pendingProps,vg(e,t,s,r=t.elementType===s?r:qp(s,r),i);case 3:e:{if(_g(t),null===e)throw Error(Go(387));s=t.pendingProps,r=(n=t.memoizedState).element,Nf(e,t),Lf(t,s,null,i);var o=t.memoizedState;if(s=o.element,n.isDehydrated){if(n={element:s,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=n,t.memoizedState=n,256&t.flags){t=bg(e,t,s,i,r=Zp(Error(Go(423)),t));break e}if(s!==r){t=bg(e,t,s,i,r=Zp(Error(Go(424)),t));break e}for($d=Zu(t.stateNode.containerInfo.firstChild),qd=t,Vd=!0,Yd=null,i=uf(t,null,s,i),t.child=i;i;)i.flags=-3&i.flags|4096,i=i.sibling}else{if(sf(),s===r){t=Rg(e,t,i);break e}cg(e,t,s,i)}t=t.child}return t;case 5:return Hf(t),null===e&&Zd(t),s=t.type,r=t.pendingProps,n=null!==e?e.memoizedProps:null,o=r.children,qu(s,r)?o=null:null!==n&&qu(s,n)&&(t.flags|=32),pg(e,t),cg(e,t,o,i),t.child;case 6:return null===e&&Zd(t),null;case 13:return jg(e,t,i);case 4:return If(t,t.stateNode.containerInfo),s=t.pendingProps,null===e?t.child=hf(t,null,s,i):cg(e,t,s,i),t.child;case 11:return s=t.type,r=t.pendingProps,hg(e,t,s,r=t.elementType===s?r:qp(s,r),i);case 7:return cg(e,t,t.pendingProps,i),t.child;case 8:case 12:return cg(e,t,t.pendingProps.children,i),t.child;case 10:e:{if(s=t.type._context,r=t.pendingProps,n=t.memoizedProps,o=r.value,gd(df,s._currentValue),s._currentValue=o,null!==n)if(Xh(n.value,o)){if(n.children===r.children&&!_d.current){t=Rg(e,t,i);break e}}else for(null!==(n=t.child)&&(n.return=t);null!==n;){var a=n.dependencies;if(null!==a){o=n.child;for(var l=a.firstContext;null!==l;){if(l.context===s){if(1===n.tag){(l=Mf(-1,i&-i)).tag=2;var c=n.updateQueue;if(null!==c){var h=(c=c.shared).pending;null===h?l.next=l:(l.next=h.next,h.next=l),c.pending=l}}n.lanes|=i,null!==(l=n.alternate)&&(l.lanes|=i),_f(n.return,i,t),a.lanes|=i;break}l=l.next}}else if(10===n.tag)o=n.type===t.type?null:n.child;else if(18===n.tag){if(null===(o=n.return))throw Error(Go(341));o.lanes|=i,null!==(a=o.alternate)&&(a.lanes|=i),_f(o,i,t),o=n.sibling}else o=n.child;if(null!==o)o.return=n;else for(o=n;null!==o;){if(o===t){o=null;break}if(null!==(n=o.sibling)){n.return=o.return,o=n;break}o=o.return}n=o}cg(e,t,r.children,i),t=t.child}return t;case 9:return r=t.type,s=t.pendingProps.children,bf(t,i),s=s(r=xf(r)),t.flags|=1,cg(e,t,s,i),t.child;case 14:return r=qp(s=t.type,t.pendingProps),ug(e,t,s,r=qp(s.type,r),i);case 15:return dg(e,t,t.type,t.pendingProps,i);case 17:return s=t.type,r=t.pendingProps,r=t.elementType===s?r:qp(s,r),Lg(e,t),t.tag=1,yd(s)?(e=!0,Cd(t)):e=!1,bf(t,i),Gp(t,s,r),Jp(t,s,r,i),mg(null,t,s,!0,e,i);case 19:return Dg(e,t,i);case 22:return fg(e,t,i)}throw Error(Go(156,t.tag))};var Tm="function"==typeof reportError?reportError:function(e){console.error(e)};function zm(e){this._internalRoot=e}function Om(e){this._internalRoot=e}function Im(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function Fm(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function Hm(){}function Wm(e,t,i,s,r){var n=i._reactRootContainer;if(n){var o=n;if("function"==typeof r){var a=r;r=function(){var e=Rm(o);a.call(e)}}Lm(t,o,e,r)}else o=function(e,t,i,s,r){if(r){if("function"==typeof s){var n=s;s=function(){var e=Rm(o);n.call(e)}}var o=Dm(t,s,e,0,null,!1,0,"",Hm);return e._reactRootContainer=o,e[sd]=o.current,Du(8===e.nodeType?e.parentNode:e),Qv(),o}for(;r=e.lastChild;)e.removeChild(r);if("function"==typeof s){var a=s;s=function(){var e=Rm(l);a.call(e)}}var l=Em(e,0,!1,null,0,!1,0,"",Hm);return e._reactRootContainer=l,e[sd]=l.current,Du(8===e.nodeType?e.parentNode:e),Qv(function(){Lm(t,l,i,s)}),l}(i,t,e,r,s);return Rm(o)}Om.prototype.render=zm.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(Go(409));Lm(e,t,null,null)},Om.prototype.unmount=zm.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;Qv(function(){Lm(null,e,null,null)}),t[sd]=null}},Om.prototype.unstable_scheduleHydration=function(e){if(e){var t=pc();e={blockedOn:null,target:e,priority:t};for(var i=0;i<Sc.length&&0!==t&&t<Sc[i].priority;i++);Sc.splice(i,0,e),0===i&&Nc(e)}},uc=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var i=tc(t.pendingLanes);0!==i&&(lc(t,1|i),$v(t,Hl()),!(6&mv)&&(Dv=Hl()+500,Dd()))}break;case 13:Qv(function(){var t=kf(e,1);if(null!==t){var i=Kv();qv(t,e,1,i)}}),Am(e,1)}},dc=function(e){if(13===e.tag){var t=kf(e,134217728);if(null!==t)qv(t,e,134217728,Kv());Am(e,134217728)}},fc=function(e){if(13===e.tag){var t=Uv(e),i=kf(e,t);if(null!==i)qv(i,e,t,Kv());Am(e,t)}},pc=function(){return cc},gc=function(e,t){var i=cc;try{return cc=e,t()}finally{cc=i}},dl=function(e,t,i){switch(t){case"input":if(Wa(e,i),t=i.name,"radio"===i.type&&null!=t){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<i.length;t++){var s=i[t];if(s!==e&&s.form===e.form){var r=hd(s);if(!r)throw Error(Go(90));za(s),Wa(s,r)}}}break;case"textarea":Ga(e,i);break;case"select":null!=(t=i.value)&&$a(e,!!i.multiple,t,!1)}},_l=Zv,bl=Qv;var Km={usingClientEntryPoint:!1,Events:[ld,cd,hd,vl,ml,Zv]},Um={findFiberByHostInstance:ad,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},qm={bundleType:Um.bundleType,version:Um.version,rendererPackageName:Um.rendererPackageName,rendererConfig:Um.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ha.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=Al(e))?null:e.stateNode},findFiberByHostInstance:Um.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var $m=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!$m.isDisabled&&$m.supportsFiber)try{Yl=$m.inject(qm),Gl=$m}catch(el){}}Ko.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Km,Ko.createPortal=function(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!Im(t))throw Error(Go(200));return function(e,t,i){var s=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:da,key:null==s?null:""+s,children:e,containerInfo:t,implementation:i}}(e,t,null,i)},Ko.createRoot=function(e,t){if(!Im(e))throw Error(Go(299));var i=!1,s="",r=Tm;return null!=t&&(!0===t.unstable_strictMode&&(i=!0),void 0!==t.identifierPrefix&&(s=t.identifierPrefix),void 0!==t.onRecoverableError&&(r=t.onRecoverableError)),t=Em(e,1,!1,null,0,i,0,s,r),e[sd]=t.current,Du(8===e.nodeType?e.parentNode:e),new zm(t)},Ko.findDOMNode=function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(Go(188));throw e=Object.keys(e).join(","),Error(Go(268,e))}return e=null===(e=Al(t))?null:e.stateNode},Ko.flushSync=function(e){return Qv(e)},Ko.hydrate=function(e,t,i){if(!Fm(t))throw Error(Go(200));return Wm(null,e,t,!0,i)},Ko.hydrateRoot=function(e,t,i){if(!Im(e))throw Error(Go(405));var s=null!=i&&i.hydratedSources||null,r=!1,n="",o=Tm;if(null!=i&&(!0===i.unstable_strictMode&&(r=!0),void 0!==i.identifierPrefix&&(n=i.identifierPrefix),void 0!==i.onRecoverableError&&(o=i.onRecoverableError)),t=Dm(t,null,e,1,null!=i?i:null,r,0,n,o),e[sd]=t.current,Du(e),s)for(e=0;e<s.length;e++)r=(r=(i=s[e])._getVersion)(i._source),null==t.mutableSourceEagerHydrationData?t.mutableSourceEagerHydrationData=[i,r]:t.mutableSourceEagerHydrationData.push(i,r);return new Om(t)},Ko.render=function(e,t,i){if(!Fm(t))throw Error(Go(200));return Wm(null,e,t,!1,i)},Ko.unmountComponentAtNode=function(e){if(!Fm(e))throw Error(Go(40));return!!e._reactRootContainer&&(Qv(function(){Wm(null,null,e,!1,function(){e._reactRootContainer=null,e[sd]=null})}),!0)},Ko.unstable_batchedUpdates=Zv,Ko.unstable_renderSubtreeIntoContainer=function(e,t,i,s){if(!Fm(i))throw Error(Go(200));if(null==e||void 0===e._reactInternals)throw Error(Go(38));return Wm(e,t,i,!1,s)},Ko.version="18.3.1-next-f1338f8080-20240426",function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),Wo.exports=Ko;var Vm,Ym=Wo.exports,Gm=Ym;if(Vm=Gm.createRoot,Gm.hydrateRoot,!gi.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!function(e,t,i){return Ro(function(){var s=go(e,i)[vs];null!=t||(t=function(e){return Zi(e,ds)||Ui(e,ds,ns({},e[ds])),e[ds]}(e)),Xi(t).forEach(function(e){return s.make_(e,t[e])})}),e})throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function Xm(e){e()}function Jm(e){return Sn(Do(e,t));var t}var Zm=function(){function e(e){var t=this;Object.defineProperty(this,"finalize",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"registrations",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"sweepTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sweep",{enumerable:!0,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=1e4),clearTimeout(t.sweepTimeout),t.sweepTimeout=void 0;var i=Date.now();t.registrations.forEach(function(s,r){i-s.registeredAt>=e&&(t.finalize(s.value),t.registrations.delete(r))}),t.registrations.size>0&&t.scheduleSweep()}}),Object.defineProperty(this,"finalizeAllImmediately",{enumerable:!0,configurable:!0,writable:!0,value:function(){t.sweep(0)}})}return Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i){this.registrations.set(i,{value:t,registeredAt:Date.now()}),this.scheduleSweep()}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.registrations.delete(e)}}),Object.defineProperty(e.prototype,"scheduleSweep",{enumerable:!1,configurable:!0,writable:!0,value:function(){void 0===this.sweepTimeout&&(this.sweepTimeout=setTimeout(this.sweep,1e4))}}),e}(),Qm=new("undefined"!=typeof FinalizationRegistry?FinalizationRegistry:Zm)(function(e){var t;null===(t=e.reaction)||void 0===t||t.dispose(),e.reaction=null}),e_={exports:{}},t_={},i_=gi;var s_="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r_=i_.useState,n_=i_.useEffect,o_=i_.useLayoutEffect,a_=i_.useDebugValue;function l_(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!s_(e,i)}catch(s){return!0}}var c_="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var i=t(),s=r_({inst:{value:i,getSnapshot:t}}),r=s[0].inst,n=s[1];return o_(function(){r.value=i,r.getSnapshot=t,l_(r)&&n({inst:r})},[e,i,t]),n_(function(){return l_(r)&&n({inst:r}),e(function(){l_(r)&&n({inst:r})})},[e]),a_(i),i};t_.useSyncExternalStore=void 0!==i_.useSyncExternalStore?i_.useSyncExternalStore:c_,e_.exports=t_;var h_,u_,d_=e_.exports;function f_(e){e.reaction=new Vr("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),null===(t=e.onStoreChange)||void 0===t||t.call(e)})}var p_="function"==typeof Symbol&&Symbol.for,g_=null!==(u_=null===(h_=Object.getOwnPropertyDescriptor(function(){},"name"))||void 0===h_?void 0:h_.configurable)&&void 0!==u_&&u_,v_=p_?Symbol.for("react.forward_ref"):"function"==typeof gi.forwardRef&&gi.forwardRef(function(e){return null}).$$typeof,m_=p_?Symbol.for("react.memo"):"function"==typeof gi.memo&&gi.memo(function(e){return null}).$$typeof;function __(e,t){if(m_&&e.$$typeof===m_)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");var i=!1,s=e,r=e.displayName||e.name;if(v_&&e.$$typeof===v_&&(i=!0,"function"!=typeof(s=e.render)))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var n,o,a=function(e,t){return function(e,t){void 0===t&&(t="observed");var i=vi.useRef(null);if(!i.current){var s={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(e){return Qm.unregister(s),s.onStoreChange=e,s.reaction||(f_(s),s.stateVersion=Symbol()),function(){var e;s.onStoreChange=null,null===(e=s.reaction)||void 0===e||e.dispose(),s.reaction=null}},getSnapshot:function(){return s.stateVersion}};i.current=s}var r,n,o=i.current;if(o.reaction||(f_(o),Qm.register(i,o,o)),vi.useDebugValue(o.reaction,Jm),d_.useSyncExternalStore(o.subscribe,o.getSnapshot,o.getSnapshot),o.reaction.track(function(){try{r=e()}catch(t){n=t}}),n)throw n;return r}(function(){return s(e,t)},r)};return a.displayName=e.displayName,g_&&Object.defineProperty(a,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(a.contextTypes=e.contextTypes),i&&(a=gi.forwardRef(a)),a=gi.memo(a),n=e,o=a,Object.keys(n).forEach(function(e){x_[e]||Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(n,e))}),a}var b_,x_={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};(b_=Ym.unstable_batchedUpdates)||(b_=Xm),yn({reactionScheduler:b_}),Qm.finalizeAllImmediately;const y_=gi.createContext(null);function w_(){const e=gi.useContext(y_);if(!e)throw new Error("useRootStore() called outside <StoreContext.Provider> — wrap the tree in main.tsx");return e}const S_=gb;!function(){const e=638,t=652,i=380,s=427,r=505,n=397,o=439,a=gb,l=Fb();for(;;)try{if(509169===parseInt(a(e))/1+parseInt(a(381))/2+-parseInt(a(t))/3*(parseInt(a(i))/4)+-parseInt(a(s))/5*(-parseInt(a(r))/6)+-parseInt(a(658))/7+parseInt(a(n))/8+-parseInt(a(o))/9)break;l.push(l.shift())}catch(c){l.push(l.shift())}}();var k_=Object[S_(418)],C_=(e,t)=>k_(e,S_(489),{value:t,configurable:!0});function j_(e){const t=469,i=S_;return typeof e===i(609)&&null!==e&&!Array[i(t)](e)}C_(function(e){const t=500,i=586,s=643,r=625,n=473,o=S_,a=e[o(460)]();if(!a[o(t)]("{"))return null;try{const e=JSON[o(i)](a);return"app-server:ready"===e[o(s)]||e[o(643)]===o(r)||e[o(643)]===o(n)?e:null}catch{return null}},S_(435)),C_(j_,S_(523));var N_="unotest",M_=S_(603);S_(623);var E_=".runs";function B_(e,t){return""+E_+e+(t?"."+t:"")}C_(function(e){return""+M_+e},S_(497)),C_(B_,S_(533)),C_(function(e){const t=S_;return e===E_||e[t(500)](E_+"-")||e[t(500)](E_+".")},S_(667)),C_(function(e){return S_(546)+e},"debugDirFor"),C_(function(e){const t=S_;return N_+t(560)+e+t(587)},"debuggerFileFor"),S_(482),S_(538),S_(441),S_(602),S_(553),S_(646),S_(374),S_(488),S_(568);var D_=S_(420),L_=S_(565);function R_(e,t,i){const s=[e];return t&&s[S_(485)](""+e+t),i&&(s.push(e+"."+i),t&&s.push(""+e+t+"."+i)),s}C_(function(e,t){return""+D_+e+(t?"."+t:"")},S_(543)),C_(function(e,t){return""+L_+e+(t?"."+t:"")},S_(597)),C_(function(e,t){return R_(D_,e,t)},S_(592)),C_(function(e,t){return R_(L_,e,t)},S_(392)),C_(R_,S_(375));C_(function(e,t){var i;const s=S_,r=null==(i=e.UNOTEST_ARTIFACTS_ROOT)?void 0:i[s(460)]();return r||t},S_(595)),C_(function(e){var t;const i=S_,s=null==(t=e.UNOTEST_ENV)?void 0:t[i(460)]();return s||void 0},S_(527));var P_=new Set(["example","sample",S_(413)]);C_(function(e,t){const i=608,s=516,r=432,n=604,o=S_,a=[o(629),o(i)][o(s)](e=>t?[e,""+e+t]:[e]),l=new Set;for(const c of e)for(const e of a){const t=e+".";if(!c[o(500)](t))continue;const i=c[o(474)](t[o(r)]);i&&!i.includes("/")&&(P_[o(579)](i)||l[o(611)](i))}return[...l][o(n)]()},S_(503)),C_(function(e){const t=643,i=S_;return typeof e===i(609)&&null!==e&&e[i(t)]===i(563)&&typeof e[i(520)]===i(626)&&typeof e.flags===i(626)},S_(656)),C_(function(e,t=""){return{kind:S_(563),source:e,flags:t}},S_(456));function A_(e){const t=432,i=S_,s=e[i(668)](/[^a-zA-Z0-9_-]+/g,"-").replace(/-+/g,"-")[i(668)](/^-|-$/g,"");return s[i(t)]>0?s:"run"}C_(function(e){const t=451,i=448,s=529,r=662,n=432,o=377,a=S_,l=A_(e),c=Date[a(t)]()[a(i)](36),h=new Uint8Array(6);globalThis[a(s)][a(r)](h);let u="";for(let d=0;d<h[a(n)];d++)u+=h[d].toString(16)[a(o)](2,"0");return l+"-"+c+"-"+u},"makeRunId"),C_(A_,S_(368));var T_=/^[0-9a-f]{6,}$/,z_=Date[S_(483)](2020,0,1),O_=Date[S_(483)](2100,0,1);function I_(e){const t=432,i=S_,s=e[i(396)]("-");if(s[i(432)]<3)return null;const r=s[s.length-1];if(!T_.test(r))return null;const n=s[s[i(t)]-2];if(!/^[0-9a-z]+$/.test(n))return null;const o=parseInt(n,36);return Number.isFinite(o)?o<z_||o>=O_?null:o:null}function F_(e){const t=391,i=467,s=377,r=S_,n=new Date(e);return String(n[r(t)]())[r(377)](4,"0")+"/"+String(n.getUTCMonth()+1)[r(377)](2,"0")+"/"+String(n[r(i)]())[r(s)](2,"0")}function H_(e){const t=I_(e);return null===t?null:F_(t)}function W_(e,t){const i=H_(t);return null===i?null:e+"/"+i+"/"+t}C_(I_,S_(404)),C_(F_,S_(428)),C_(H_,"shardPathForRunId"),C_(W_,S_(443));var K_=(C_(e=class extends Error{constructor(e){super(S_(632)+e),this.name="UnplaceableRunIdError"}},S_(476)),e);function U_(e,t){const i=W_(e,t);if(null===i)throw new K_(t);return i}function q_(e="",t){return N_+"/"+B_(e,t)}function $_(e,t){return e+"/"+F_(t)}function V_(e){return e===S_(457)||"interrupted"===e}C_(U_,S_(558)),C_(q_,S_(423)),C_(function(e,t="",i){return U_(q_(t,i),e)},S_(532)),C_($_,S_(371)),C_(function*(e,t,i){const s=864e5;let r=Math[S_(379)](t/s)*s;for(let n=0;n<i;n++)yield $_(e,r),r-=s},"shardDaysDescending"),C_(V_,S_(624)),C_(function(e,t){const i=564,s=454,r=S_,n={lastRunId:t.runId,lastStatus:t[r(570)],lastAt:t[r(i)],lastDurationMs:t[r(514)],recent:[...(null==e?void 0:e[r(s)])??[],t[r(570)]][r(474)](-12)};if(!V_(t[r(570)]))return{...n,failStreak:0,failingSince:null};const o=((null==e?void 0:e[r(411)])??0)+1;return{...n,failStreak:o,failingSince:1===o?t[r(i)]:(null==e?void 0:e.failingSince)??t[r(564)]}},S_(541)),C_(function(e){const t=S_;return encodeURIComponent(e)+t(487)},"scenarioIndexFileName"),C_(function(e){const t=487,i=432,s=S_;if(!e[s(426)](s(t)))return null;try{return decodeURIComponent(e[s(474)](0,-s(487)[s(i)]))}catch{return null}},S_(365));var Y_=["github",S_(446),"api"],G_=["unauthorized",S_(655),"unknown-environment",S_(545),"no-collections",S_(494),S_(431)];function X_(e){return Y_[S_(536)](e)?e:null}C_(function(e){const t=626,i=432,s=469,r=386,n=619,o=S_;if(!j_(e))return null;const{bundleId:a,environment:l,collections:c,pr:h,branch:u,sha:d}=e;if("string"!=typeof a||0===a.length)return null;if(typeof l!==o(t)||0===l[o(i)])return null;let f=null;if(void 0!==c){if(!Array[o(s)](c))return null;if(c[o(r)](e=>typeof e!==o(626)||0===e[o(432)]))return null;f=c}if(void 0!==h&&(typeof h!==o(n)||!Number[o(464)](h)))return null;for(const p of[u,d])if(void 0!==p&&typeof p!==o(t))return null;return{bundleId:a,environment:l,...f?{collections:f}:{},..."number"==typeof h?{pr:h}:{},...typeof u===o(626)?{branch:u}:{},..."string"==typeof d?{sha:d}:{}}},S_(612)),C_(function(e){const t=534,i=626,s=485,r=619,n=S_;if(!j_(e))return null;if(j_(e[n(534)])){const{code:i,message:s}=e[n(t)];return G_.includes(i)?"string"!=typeof s?null:{error:{code:i,message:s}}:null}const{status:o,bundleId:a,environment:l,runs:c,superseded:h}=e;if(o!==n(409))return null;if(typeof a!==n(626)||typeof l!==n(626))return null;if(!Array.isArray(c))return null;const u=[];for(const d of c){if(!j_(d))return null;const{runId:e,collection:t}=d;if(typeof e!==n(i)||"string"!=typeof t)return null;u[n(s)]({runId:e,collection:t})}return void 0!==h&&"number"!=typeof h?null:{status:"queued",bundleId:a,environment:l,runs:u,...typeof h===n(r)?{superseded:h}:{}}},S_(401)),C_(X_,S_(424));var J_=S_(572);S_(438),S_(468),S_(389),S_(509),S_(665);function Z_(e,t){return""+J_+e+(t?"."+t:"")}C_(Z_,"queueDirFor"),C_(function(e){const t=S_;return e===J_||e.startsWith(J_+"-")||e[t(500)](J_+".")},S_(660)),C_(function(e="",t){return N_+"/"+Z_(e,t)},"projectQueueRoot");var Q_=Object[S_(519)]({maintenance:0,interactive:1,ci:2,schedule:3}),eb=[S_(449),S_(382),"ci","schedule"],tb=eb;function ib(e){return Q_[e]}function sb(e){return eb[e]??null}function rb(e){const t=605,i=496,s=474,r=S_,n=e[r(486)]?"@"+e.sha[r(474)](0,7):"";return void 0!==e.pr?r(t)+e.pr+n:void 0!==e[r(i)]?""+e.branch+n:n[r(432)]>0?n[r(s)](1):e[r(559)]}C_(ib,"queuePriorityRank"),C_(sb,"queuePriorityFromRank"),C_(rb,S_(554)),C_(function(e,t,i){return ib(e)+"-"+t.toString(36)+"-"+i+".json"},"makeQueueTicketName");var nb=/^([0-3])-([0-9a-z]+)-([0-9a-f]+)\.json$/;function ob(e){const t=388,i=S_,s=nb[i(659)](e);if(!s)return null;const r=Number(s[1]),n=sb(r);if(null===n)return null;const o=parseInt(s[2],36);return Number[i(t)](o)?{rank:r,priority:n,createdAt:o,random:s[3]}:null}C_(ob,"parseQueueTicketName"),C_(function(e,t){const i=666,s=366,r=366,n=S_,o=ob(e),a=ob(t);return o&&a?o[n(666)]!==a.rank?o.rank-a[n(i)]:o.createdAt!==a[n(440)]?o[n(440)]-a.createdAt:o.random<a[n(s)]?-1:o[n(r)]>a[n(366)]?1:0:e<t?-1:e>t?1:0},"compareQueueTicketNames");var ab=[S_(610),S_(425),S_(412),S_(449)],lb=[S_(548),S_(437),S_(462),"schedule","ci"];function cb(e){const t=626,i=619,s=626,r=626,n=S_;if(!j_(e))return null;const o=X_(e.provider);if(null===o)return null;const{repo:a,branch:l,sha:c,pr:h,checkId:u}=e;for(const d of[a,l,c,u])if(void 0!==d&&typeof d!==n(t))return null;return void 0===h||typeof h===n(i)&&Number.isInteger(h)?{provider:o,...typeof a===n(s)?{repo:a}:{},...typeof l===n(r)?{branch:l}:{},..."string"==typeof c?{sha:c}:{},...typeof h===n(619)?{pr:h}:{},..."string"==typeof u?{checkId:u}:{}}:null}C_(function(e){const t=626,i=536,s=619,r=619,n=626,o=458,a=403,l=S_;if(!j_(e))return null;const{schemaVersion:c,runId:h,kind:u,ref:d,env:f,priority:p,weight:g,producer:v,source:m,ci:_,createdAt:b}=e;if(1!==c)return null;if("string"!=typeof h||0===h[l(432)])return null;if(typeof d!==l(t))return null;if(!ab.includes(u))return null;if(!tb[l(i)](p))return null;if(typeof g!==l(s)||!Number[l(388)](g)||g<1)return null;if(typeof b!==l(r)||!Number[l(388)](b))return null;if(!j_(v))return null;if(!lb[l(536)](v[l(643)]))return null;if("number"!=typeof v.pid||typeof v[l(403)]!==l(n))return null;if(void 0!==f&&"string"!=typeof f)return null;let x=null;if(void 0!==m){if(!j_(m)||typeof m[l(o)]!==l(t)||0===m[l(o)].length)return null;x={bundleId:m[l(o)]}}let y=null;return void 0!==_&&(y=cb(_),null===y)?null:{schemaVersion:1,runId:h,kind:u,ref:d,priority:p,weight:g,producer:{kind:v.kind,pid:v[l(616)],host:v[l(a)]},createdAt:b,...typeof f===l(626)?{env:f}:{},...x?{source:x}:{},...y?{ci:y}:{}}},S_(463)),C_(cb,S_(606));function hb(e){const t=S_;if(!j_(e))return null;const{repo:i,branch:s,sha:r,dirty:n}=e;if(typeof n!==t(644))return null;for(const o of[i,s,r])if(void 0!==o&&typeof o!==t(626))return null;return{dirty:n,...typeof i===t(626)?{repo:i}:{},..."string"==typeof s?{branch:s}:{},...typeof r===t(626)?{sha:r}:{}}}S_(582),S_(551),S_(581),C_(hb,S_(648)),C_(function(e){const t=432,i=619,s=388,r=626,n=S_;if(!j_(e))return null;const{schemaVersion:o,bundleId:a,sha256:l,createdAt:c,webVersion:h,author:u,git:d,fileCount:f,byteSize:p,declaredVariables:g,schedulesFingerprint:v}=e;if(1!==o)return null;if(typeof a!==n(626)||0===a[n(t)])return null;if(void 0!==l&&!/^[0-9a-f]{64}$/[n(484)](String(l)))return null;if(typeof h!==n(626)||0===h[n(432)])return null;if(typeof c!==n(i)||!Number[n(s)](c))return null;if("number"!=typeof f||!Number[n(464)](f))return null;if(typeof p!==n(619)||!Number.isInteger(p))return null;if(void 0!==u&&typeof u!==n(r))return null;let m=null;if(void 0!==d&&(m=hb(d),null===m))return null;const _=Array.isArray(g)?g.filter(e=>typeof e===n(626)):[],b=typeof v===n(r)&&/^[0-9a-f]{64}$/[n(484)](v)?v:void 0;return{schemaVersion:1,bundleId:a,..."string"==typeof l?{sha256:l}:{},createdAt:c,webVersion:h,fileCount:f,byteSize:p,..."string"==typeof u?{author:u}:{},...m?{git:m}:{},..._[n(432)]>0?{declaredVariables:_}:{},...void 0!==b?{schedulesFingerprint:b}:{}}},"parseBundleManifest"),C_(function(e){const t=496,i=S_,s=e[i(433)];if(!s||void 0===s[i(t)]&&void 0===s.sha)return e.bundleId;const r=s[i(486)]?s[i(486)][i(474)](0,7):"?";return(s[i(496)]??"?")+"@"+r+(s[i(650)]?i(585):"")},"describeBundle");var ub=[S_(399),S_(622),"malformed","id-mismatch",S_(607),S_(655),S_(431)];function db(e){const t=626,i=469,s=S_;if(!Array[s(469)](e))return null;const r=[];for(const n of e){if(!j_(n))continue;const{project:e,environment:o,missing:a}=n;if(typeof e!==s(626)||typeof o!==s(t))continue;if(!Array[s(i)](a))continue;const l=a.filter(e=>typeof e===s(626));l[s(432)]>0&&r.push({project:e,environment:o,missing:l})}return r[s(432)]>0?r:null}C_(function(e){const t=536,i=627,s=542,r=432,n=408,o=S_;if(!j_(e))return null;if(j_(e.error)){const{code:i,message:s}=e.error;return ub[o(t)](i)?"string"!=typeof s?null:{error:{code:i,message:s}}:null}const{status:a,bundleId:l}=e;if(a!==o(i)&&a!==o(s))return null;if(typeof l!==o(626)||0===l[o(r)])return null;const c=db(e[o(n)]);return null===c?{status:a,bundleId:l}:{status:a,bundleId:l,variableGaps:c}},"parseBundleUploadResponse"),C_(db,S_(384));function fb(e){return Array[S_(469)](e)?e.some(e=>"string"!=typeof e)?null:e:null}function pb(e){const t=432,i=626,s=619,r=388,n=626,o=S_;if(!j_(e))return null;const{bundleId:a,label:l,branch:c,sha:h,dirty:u,author:d,createdAt:f,webVersion:p}=e;if("string"!=typeof a||0===a[o(t)])return null;if(typeof l!==o(626)||typeof p!==o(i))return null;if("boolean"!=typeof u)return null;if(typeof f!==o(s)||!Number[o(r)](f))return null;for(const g of[c,h,d])if(void 0!==g&&typeof g!==o(i))return null;return{bundleId:a,label:l,dirty:u,createdAt:f,webVersion:p,..."string"==typeof c?{branch:c}:{},...typeof h===o(i)?{sha:h}:{},...typeof d===o(n)?{author:d}:{}}}function gb(e,t){e-=363;const i=Fb();let s=i[e];if(void 0===gb.lqQmgP){gb.QfKXhD=function(e){let t="",i="";for(let s,r,n=0,o=0;r=e.charAt(o++);~r&&(s=n%4?64*s+r:r,n++%4)?t+=String.fromCharCode(255&s>>(-2*n&6)):0)r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=".indexOf(r);for(let s=0,r=t.length;s<r;s++)i+="%"+("00"+t.charCodeAt(s).toString(16)).slice(-2);return decodeURIComponent(i)},gb.QvakRK={},gb.lqQmgP=!0}const r=e+i[0],n=gb.QvakRK[r];return n?s=n:(s=gb.QfKXhD(s),gb.QvakRK[r]=s),s}function vb(e){const t=425,i=S_;return void 0!==e[i(425)]?{kind:i(t),name:e[i(425)]}:{kind:i(610),name:e.scenario}}function mb(e){const t=626,i=432,s=432,r=619,n=596,o=S_;if(!j_(e))return null;const{collection:a,scenario:l,cron:c,env:h,prepare:u,workers:d,source:f}=e,p=typeof a===o(t)&&a[o(i)]>0?void 0===l?{collection:a}:null:typeof l===o(t)&&l[o(s)]>0&&void 0===a?{scenario:l}:null;if(null===p)return null;if("string"!=typeof c||0===c.trim()[o(432)])return null;if(void 0!==h&&typeof h!==o(626))return null;if(void 0!==u&&typeof u!==o(626))return null;const g="collection"in p&&typeof d===o(r)&&Number[o(464)](d)&&d>=1?d:void 0,v=f===o(n)||f===o(480)?f:void 0;return{...p,cron:c,...void 0!==h?{env:h}:{},...void 0!==u?{prepare:u}:{},...void 0!==g?{workers:g}:{},...void 0!==v?{source:v}:{}}}S_(370),C_(fb,S_(574)),C_(pb,"parseBundle"),C_(function(e){const t=478,i=626,s=626,r=S_;if(!j_(e))return null;if(1!==e[r(t)])return null;const{workspace:n,environment:o,allowSwitch:a,currentBundleId:l,switchedBy:c,switchedAt:h,bundles:u,variables:d,secrets:f,switchPath:p}=e;if(typeof n!==r(626)||"string"!=typeof o)return null;if("boolean"!=typeof a)return null;if(!Array[r(469)](u))return null;const g=[];for(const _ of u){const e=pb(_);if(!e)return null;g.push(e)}const v=fb(d),m=fb(f);if(!v||!m)return null;for(const _ of[l,c,p])if(void 0!==_&&typeof _!==r(i))return null;return void 0!==h&&typeof h!==r(619)?null:{schemaVersion:1,workspace:n,environment:o,allowSwitch:a,bundles:g,variables:v,secrets:m,...typeof l===r(626)?{currentBundleId:l}:{},..."string"==typeof c?{switchedBy:c}:{},...typeof h===r(619)?{switchedAt:h}:{},...typeof p===r(s)?{switchPath:p}:{}}},S_(591)),C_(vb,S_(647)),C_(mb,"parseScheduleEntry"),C_(function(e){const t=628,i=643,s=489,r=579,n=S_;if(null==e)return{entries:[]};if(!j_(e))return{error:n(589)};const o=e.schedules??[];if(!Array.isArray(o))return{error:"`schedules:` must be an array"};const a=[],l=new Set;for(const[c,h]of o[n(t)]()){const e=mb(h);if(!e)return{error:n(663)+c+"] is not a valid entry — it needs exactly one of `collection:` / `scenario:` plus a `cron:` string"};const t=vb(e),o=t[n(i)]+":"+t[n(s)];if(l[n(r)](o))return{error:"schedules["+c+n(654)+t.kind+' "'+t.name+n(481)};l[n(611)](o),a[n(485)](e)}return{entries:a}},S_(531)),C_(function(e,t){const i=436,s=367,r=579,n=S_,o=new Set(t[n(367)](e=>{const t=vb(e);return t.kind+":"+t.name}));return[...e[n(i)](e=>{const t=n,i=vb(e);return!o[t(r)](i[t(643)]+":"+i.name)})[n(367)](e=>({...e,source:n(596)})),...t[n(s)](e=>({...e,source:n(480)}))]},S_(594)),C_(function(e){const t=489,i=643,s=643,r=489,n=510,o=472,a=507,l=S_,c=e[l(367)](e=>{const t=l,i=vb(e);return{kind:i[t(s)],name:i[t(r)],cron:e[t(n)],...void 0!==e.env?{env:e[t(o)]}:{},...void 0!==e[t(507)]?{prepare:e[t(a)]}:{},...void 0!==e[t(490)]?{workers:e[t(490)]}:{}}})[l(604)]((e,s)=>{const r=l,n=e[r(643)]+":"+e[r(t)],o=s[r(i)]+":"+s[r(t)];return n<o?-1:n>o?1:0});return JSON.stringify(c)},S_(387)),C_(function(e){const t=586,i=469,s=S_;let r;try{r=JSON[s(t)](e)}catch{return null}if(!Array[s(i)](r))return null;const n=[];for(const o of r){const e=mb(o);e&&n.push(e)}return n},S_(557));var _b={m5:{minutes:!1,hours:!1,days:!1},m15:{minutes:!1,hours:!1,days:!1},h1:{minutes:!0,hours:!1,days:!1},h2:{minutes:!0,hours:!1,days:!1},h4:{minutes:!0,hours:!1,days:!1},h6:{minutes:!0,hours:!1,days:!1},h12:{minutes:!0,hours:!1,days:!1},daily:{minutes:!0,hours:!0,days:!1},weekly:{minutes:!0,hours:!0,days:!0}},bb={h2:2,h4:4,h6:6,h12:12};function xb(e){const t=540,i=470,s=600,r=S_,n=Db(e[r(406)]);switch(e[r(434)]){case"m5":return r(513);case"m15":return r(t);case"h1":return n+" * * * *";case"h2":case"h4":case"h6":case"h12":return n+" */"+bb[e.freq]+r(470);case"daily":return n+" "+Db(e.hours)+r(i);case"weekly":return n+" "+Db(e[r(525)])+r(584)+Db(e[r(s)])}}function yb(e){const t=396,i=414,s=S_,r=e.trim()[s(t)](/\s+/);if(5!==r[s(432)])return null;const[n,o,a,l,c]=r;if("*"!==a||"*"!==l)return null;if("*"===o&&"*"===c){if(n===s(515))return Bb("m5");if(n===s(i))return Bb(s(442));const e=Lb(n);return e&&Bb("h1",e)}const h=Lb(n);if(!h)return null;const u=/^\*\/(\d+)$/[s(659)](o);if(u&&"*"===c){const e=Object.keys(bb)[s(407)](e=>bb[e]===Number(u[1]));return e?Bb(e,h):null}const d=Lb(o);if(!d)return null;if("*"===c)return Bb(s(547),h,d);const f=Lb(c);return f&&Bb(s(518),h,d,f)}function wb(e){const t=yb(e);return t?Sb(t):e}function Sb(e){const t=651,i=400,s=637,r=547,n=578,o=367,a=376,l=S_;switch(e.freq){case"m5":return l(t);case"m15":return l(636);case"h1":return l(i)+Pb(e[l(406)]);case"h2":case"h4":case"h6":case l(s):return"every "+bb[e.freq]+"h"+Pb(e[l(406)]);case l(r):return l(n)+Ab(e);case l(518):return e[l(600)][l(o)](e=>Mb[e]??String(e))[l(a)](", ")+l(664)+Ab(e)}}function kb(e,t){const i=416,s=S_,r=new Date(t);r.setSeconds(0,0);for(let n=0;n<11520;n++)if(r[s(i)](r[s(499)]()+1),Cb(e,r))return r[s(465)]();return r[s(465)]()}function Cb(e,t){const i=434,s=525,r=536,n=525,o=S_,a=t.getMinutes(),l=t[o(364)]();switch(e.freq){case"m5":return a%5==0;case o(442):return a%15==0;case"h1":return e[o(406)][o(536)](a);case"h2":case"h4":case"h6":case"h12":return e[o(406)][o(536)](a)&&l%(bb[e[o(i)]]??1)===0;case o(547):return e.minutes[o(536)](a)&&e[o(s)][o(536)](l);case o(518):return e.minutes[o(r)](a)&&e[o(n)][o(r)](l)&&e.days.includes(t.getDay())}}function jb(e,t){const i=364,s=452,r=S_,n=new Date(e),o=new Date(t),a=Rb(n[r(i)]())+":"+Rb(n[r(499)]()),l=Math[r(598)]((Nb(n)-Nb(o))/864e5);return 0===l?r(561)+a:1===l?"tomorrow "+a:Mb[n[r(s)]()]+" "+a}function Nb(e){const t=S_,i=new Date(e);return i[t(385)](0,0,0,0),i.getTime()}C_(xb,S_(363)),C_(yb,S_(567)),C_(wb,S_(614)),C_(Sb,"describeSpec"),C_(kb,"nextTickFromSpec"),C_(Cb,S_(501)),C_(jb,S_(539)),C_(Nb,S_(492));var Mb=["Sun",S_(634),S_(601),"Wed",S_(620),"Fri",S_(555)],Eb=[1,2,3,4,5,6,0];function Bb(e,t=[0],i=[3],s=[1]){return{freq:e,minutes:t,hours:i,days:s}}function Db(e){const t=S_;return[...e].sort((e,t)=>e-t)[t(376)](",")}function Lb(e){const t=S_;return/^\d+(,\d+)*$/[t(484)](e)?e.split(",")[t(367)](Number):null}C_(Bb,"spec"),C_(Db,S_(566)),C_(Lb,S_(615));var Rb=C_(e=>String(e)[S_(377)](2,"0"),S_(577));function Pb(e){const t=664,i=376,s=S_;return 1===e.length&&0===e[0]?"":s(t)+[...e][s(604)]((e,t)=>e-t)[s(367)](e=>":"+Rb(e))[s(i)](", ")}function Ab(e){const t=604,i=S_,s=[...e[i(525)]][i(t)]((e,t)=>e-t)[i(516)](t=>[...e[i(406)]].sort((e,t)=>e-t)[i(367)](e=>Rb(t)+":"+Rb(e))),r=s.slice(0,4),n=s.length-r.length;return r[i(376)](", ")+(n>0?" +"+n:"")}C_(Pb,"atMinutes"),C_(Ab,"times");var Tb=S_(511),zb=/^[0-9a-f]{8,}$/,Ob=(C_(t=class extends Error{constructor(e){const t=S_;super(t(621)+e),this.name=t(498)}},"InvalidBlobHashError"),t);function Ib(e,t,i=0){const s=474,r=S_;if(!zb[r(484)](e))throw new Ob(e);const n=i>0?"~"+i:"";return[Tb,e[r(s)](0,2),e[r(s)](2,4),""+e+n+"."+t]}function Fb(){const e=["AxnbCNjHEq","icOGkIaQ","y29TCgXLDgvK","zw52","yxbWlxnLCNzLCJPLCNjVCG","C2XPy2u","vu5pvevtvf9kvurhrv9srvrssuvt","vw5WBgfJzwfIBgvsDw5jzevYCM9Y","C3bSAxrmAw5LCW","C2nOzw1HvMvYC2LVBG","refuqujbu0vFvvjm","zMLSzq","iIdIGjqGB25LihnJAgvKDwXLihbLCIb0yxjNzxq","lNzPzxDLCI5SB2nR","vvrd","DgvZDa","ChvZAa","C2HH","lMPZB25S","C3rKzxjYlMXVzW","BMfTzq","D29YA2vYCW","vu5pvevtvf9erujvr19esvi","C3rHCNrpzKrHEq","yMXVyNnsB290rM9Y","BwfSzM9YBwvK","AxnfEhrLCM5HBfzHCK5HBwu","yNjHBMnO","DgvZDerPCKzVCG","sw52ywXPzejSB2jiyxnOrxjYB3i","z2v0twLUDxrLCW","C3rHCNrZv2L0Aa","C3bLy01HDgnOzxm","iokaLcbWAwnRigeGzgLMzMvYzw50ig5HBwuGB3iGzwrPDcb0AguGzxHPC3rPBMCGDMfSDwuU","zw52tMfTzxngCM9TrgLYtgLZDgLUzW","BxvZDcbUB3qGyMuGzw1WDhK","mtjKr2vkug8","vu5pvevtvf9kvurhrv9usu1ft1vux01t","ChjLCgfYzq","BxvZDcbIzsbHihn0CMLUzW","vu5pvevtvf9rvuvvrv9mruftrq","y3jVBG","x2jSB2jZ","vu5pvevtvf9erujvr19ive1mx01bwf9cwvrfuW","kI81icOGkIaQicO","zhvYyxrPB25nCW","kI81","zMXHDe1HCa","ig11C3qGyMuGvvbqrvjFu05bs0uGkguUzY4Gqvbqx0jbu0vFvvjmksbZBYbHihnJzw5HCMLVignHBIbYzwzLCMvUy2uGAxqGyNKGBMfTzs4","D2vLA2X5","zNjLzxPL","C291CMnL","zMLUzeLUzgv4","vu5pvevtvf9tte9xx01p","AxnszwnVCMq","CNvUBMvY","Ag91CNm","vu5pvevtvf9kvurhrv9dtefvrevFqKLo","ywn0AxzLrw52tMfTzq","zhvWBgLJyxrL","y3j5ChrV","iYaTls0G","CgfYC2vty2HLzhvSzxneB2m","ChjVAMvJDfj1BKrPCKzVCG","CNvUC0rPCKzVCG","zxjYB3i","uNvUBMvYtM90q29UzMLNDxjLzevYCM9Y","Aw5JBhvKzxm","vu5pvevtvf9erujvr19quKvwsuvxx0jzvevt","lNzPzxDLCI5SB2C","zM9YBwf0tMv4DfrPy2S","kI8XnsaQicOGkIaQ","zM9SzfnJzw5HCMLVuNvU","zxHPC3rZ","zw52rMLSzuzVCG","Dg9mB3DLCKnHC2u","Dw5RBM93BI1IDw5KBgu","lMrLyNvN","zgfPBhK","y2XP","yMXVyLbHDgHgB3i","C2vJCMv0CW","vu5pvevtvf9cvu5etevFsuq","l2HLywX0Aa","x3nJzw5HCMLVCW","zgvZy3jPyMvuAwnRzxrdAq","u2f0","iI4G","CgfYC2vty2HLzhvSzxnkC29U","CMvXDwLYzvj1BKrPCKzVCG","ChjVDMLKzxi","lY5Kzwj1z2DLCG","Dg9KyxKG","DMfSAwrHDgvtzwDTzw50tMfTzq","CMvNzxG","C3rHCNrLzef0","Dw5VDgvZDc8UC2vJCMv0CW","BgLZDa","C3bLy0zYB21dCM9U","y29TBwfUzhmUANnVBMW","vu5pvevtvf9kvurhrv9vuKW","C3rHDhvZ","C2vYAwfSAxPLrw52vMfSDwu","lNf1zxvL","tK9Fq09mt1i","C3rYAw5NtgLZDa","yMXVyLjLBfbHDgHgB3i","yxbW","CgfK","zgfPBhKGyxqG","AgfZ","C2vJCMv0C0nVBNrLBNq","vu5pvevtvf9tq0HfrfvmrvnFrKLor0vsufjjtLq","yNvUzgXLlMPZB24","ic0Tlq","icOGkIa","icH3AxaP","CgfYC2u","lMPZB24","vu5pvevtvf9dqunirv9esvi","zxHWzwn0zwqGysbTyxbWAw5NihDPDgGGysbGC2nOzwr1BgvZoMaGyxjYyxK","AxnbC3nPz25Tzw50tgLUzq","CgfYC2vxB3jRC3bHy2vgAwXL","zw52tgf5zxjgAwXLC0zVCG","Axntzwn0Aw9UrgL2AwrLCG","BwvYz2vty2HLzhvSzxm","yxj0AwzHy3rZuM9VDezYB20","y29UzMLN","C2vJCMv0C0zPBgvgB3i","CM91BMq","C2vJCMv0","zgf5CW","vhvL","x2rHEs5QC29UBa","ztjL","C29YDa","ufiGiW","CgfYC2vuAwnRzxrdAq","BwLUlxzLCNnPB24","lNnLy3jLDhm","B2jQzwn0","C2nLBMfYAw8","ywrK","CgfYC2vdAvj1BLjLCxvLC3q","igLZigfSC28GC2v0igLUihvUB3rLC3qVlMvUDIdIGjqGDgHLihnLy3jLDcb2ywX1zsbUB3CGC2HHzg93CYbPDc4","zgvZy3jPyMvdCM9U","BNvTyMvYCW","CgLK","vu5pvevtvf9erujvr19nqvHFqLLurvm","vu5pvevtvf9kvurhrv9nt0rfta","BNvTyMvY","vgH1","yMXVyIbOyxnOig11C3qGyMuGBg93zxjJyxnLigHLEcWGz290oIa","Dg9VlwXHCMDL","x2HLBhbLCNm","AxngywLSAw5Nu3rHDhvZ","yxbWlxnLCNzLCJPYzxvZzwq","C3rYAw5N","y3jLyxrLza","zw50CMLLCW","lMvUDG","igfSCMvHzhKGzxHPC3rZigLUia","ywjVCNrLza","CNvUswqGy2fYCMLLCYbUBYb0Aw1LC3rHBxaSignHBM5VDcbWBgfJzsbPDcbPBIbHihnOyxjKoIa","Aw5KzxHpzG","tw9U","vu5pvevtvf9orvrxt1jl","zxzLCNKGmtuGBwLU","AdeY","ntm4mdmYsuzvzwjY","vu5pvevtvf9eruzbvuXux05bvKLhqvrjt05FveLnru9vvf9nuW","vw5ZDxbWB3j0zwrsDw5lAw5KrxjYB3i","vu5pvevtvf9kvurhrv9mt0DFtevwruW","uNvUBMvY","A2LUza","yM9VBgvHBG","BxvZDcbUB3qGyMuGiI4Iig9YiciUlIi","x2XHDgvZDc5QC29U","C2nOzwr1BgvuyxjNzxq","CgfYC2vhAxrjBMzV","zxHWzwn0lwzHAwW","zgLYDhK","zxzLCNKGnsbTAw4","mtjKsg54s2m","vu5pvevtvf9kvurhrv9wt1rf","xsbYzxbLyxrZia","C2nVCguTBwLZBwf0y2G","AxnszwDLEeXPDgvYywW","CMvZzxj2zwrvBMrLCNnJB3jL","mJG3mZGWmu5iugnjvq","zxHLyW","AxnrDwv1zurPCK5HBwu","BxvZDcbUB3qGy29UDgfPBIbCic8GoIaQid8GiIa8id4GFcbVCIbJB250CM9SignOyxjHy3rLCNm","z2v0uMfUzg9TvMfSDwvZ","C2nOzwr1BgvZwW","igf0ia","vu5pvevtvf9rvuvvrv9hte9cquXFreLs","CMfUAW","AxnsDw5ZrgLYtMfTzq","CMvWBgfJzq","AxnsDw5UzxjdB25MAwDlzxK","y3jVBKzYB21tCgvJ","z2v0sg91CNm","C2nLBMfYAw9szwzgCM9TrMLSzu5HBwu","CMfUzg9T","BwfW","C2fUAxrPEMvsDw5jzfnLz21LBNq","C291CMnLCY5QC29U","lNDVCMTZCgfJzs5QC29U","C2HHCMreAxjgB3i","vu5pvevtvf9dt05tt0Xf","rK9sq0vFq09mt1i","C3rKB3v0lMXVzW","Bgf5zxjZrM9Y","AM9PBG","CgfKu3rHCNq","AxnbBM5VDgf0Aw9UtgLUzq","zMXVB3i","nJi3nJGWDLrWANfN","mtq1mJi2ngX2wLLJrG","Aw50zxjHy3rPDMu","zw52q29UDgvUDa","CgfYC2vwyxjPywjSzuDHChm","C2v0sg91CNm","C29Tzq","y2fUB25Py2fSu2nOzwr1Bgvtzxq","AxngAw5PDgu","lM11Dgv4","vu5pvevtvf9mt0nbteu","z2v0vvrdrNvSBfLLyxi","C2vJCMv0C0XHEwvYrMLSzxngB3i","igLZigfSC28GC2v0igLUihvUB3rLC3qVlNnLy3jLDhmG4OcuihrOzsbZzwnYzxqGDMfSDwuGC2HHzg93CYb0AgLZig9Uzs4","vu5pvevtvf9erujvrW","yMXVyLjLBfnLz21LBNrZrM9Y","C3bSAxq","mZC3nJa0mgH5BuDuBW","zw52s2v5CW","Dw5HDxrOB3jPEMvK","Ag91CMX5","CgfYC2vdAvj1BLjLC3bVBNnL","vu5pvevtvf9kvurhrv9ut0TftG","Ag9ZDa","CNvUswrtDgfYDgvKqxq","uNvUBMvYqwrHChrLCK5VDezVDw5KrxjYB3i","BwLUDxrLCW","zMLUza","DMfYAwfIBgvhyxbZ","CxvLDwvK","vu5pvevtvf9erujvr19lruvqx0nbteXt","zMfPBfn0CMvHAW","yxv0Ag9YAw5N","DgvTCgXHDgu","kI8Xnq","vu5pvevtvf9iruferuq","C2v0twLUDxrLCW","vu5pvevtvf9kvurhrv9quKvbtujmrq","zgvMAw5LuhjVCgvYDhK","CgXHBKfKzfzHCMLHyMXL","Dw5VDgvZDc8Uzw52","vu5pvevtvf9kvurhrv9quK9wsurfuG","vu5pvevtvf9qt1bvuf9huKfdrv9nuW","ChjVAMvJDfj1BNnsB290","CgfYC2vdAvbYB3zPzgvY","y29SBgvJDgLVBG","zw5KC1DPDgG","mJeZotKXnwLWqK11va","C2HHCMrqyxrOrM9YvgLTzxn0yw1W","vu5pvevtvf9kvurhrv9dquXmx1rjtuvpvvrFtvm","CMvTB3zLrw52vMfY","C3rVCMfNzq","BgvUz3rO","z2L0","zNjLCq","CgfYC2vbChbtzxj2zxjfDMvUDa","zMLSDgvY","DMLLD2vY","DgLJA2v0CW","otqWmJy4n0vtBw1MDG","y3jLyxrLzef0","AgvHCNrIzwf0","Bte1","CNvUrgLYrM9Y","vu5pvevtvf9kvurhrv9nt0rf","vu5pvevtvf9kvurhrv9ts0Lqx1bsruzmsuDiva","z2L0BgfI","y2fUBM90igXVywqGCNvUBMvYigfKyxb0zxiGiG","Dg9tDhjPBMC","BwfPBNrLBMfUy2u","vu5pvevtvf9kvurhrv9bq0nfu1nFve9lru4","BM93","z2v0rgf5","AxnbC3nPz25Tzw50t2y","CMvJzw50","Aw52ywXPzc1Uyw1L","CMvNzxHmAxrLCMfS","zMfPBgvK","yNvUzgXLswq","yxnZAwDUBwvUDevUDhjPzxm","DhjPBq","zgvSzxrLu2HHzg93v2fYBMLUzW","BwnW","CgfYC2vrDwv1zvrPy2TLDa","AxnjBNrLz2vY","z2v0vgLTzq","DMfSAwrHDgvgC1nHzMvoyw1L","z2v0vvrdrgf0zq","CNvUBMLUzW"];return(Fb=function(){return e})()}function Hb(e,t,i=0){return Ib(e,t,i).join("/")}C_(function(e,t,i,s=0){return e+"/"+Hb(t,i,s)},S_(549)),C_(Ib,S_(395)),C_(Hb,S_(575)),C_(function(e){return e+"/"+Tb},S_(493));var Wb=/[\\/:*?"<>|\x00-\x1f]/;function Kb(e,t){const i=460,s=657,r=484,n=S_;if(typeof e!==n(626))return n(508);const o=e[n(i)]();return 0===o[n(432)]?n(504):"."===o||".."===o?n(645):o.startsWith(".")?"must not start with '.'":(null==t?void 0:t[n(s)])&&o[n(500)]("_")?"must not start with '_' (reserved)":Wb[n(r)](o)?n(661):null}function Ub(e){return Kb(e)}C_(Kb,S_(466)),C_(Ub,"validateCollectionName");S_(369),C_(class extends Error{constructor(e,t){const i=S_;super('runner "'+t+'" does not support run kind "'+e+'"'),this[i(489)]=i(640)}},"UnsupportedRunKindError"),C_(class extends Error{constructor(e,t){const i=556,s=405,r=S_;super(r(447)+e+r(i)+t),this[r(489)]=r(s)}},S_(405)),C_(class extends Error{constructor(e){const t=S_;super(e),this.name=t(535)}},S_(535));var qb=S_(649),$b=/^\s*\/\/\s*@([a-z0-9-]+)\s*$/;function Vb(e){return Kb(e,{reservedUnderscore:!0})}C_(function(e){return $b[S_(484)](e)},S_(378)),C_(function(e){const t=396,i=579,s=S_,r=new Set;for(const n of e[s(t)](/\r?\n/)){const e=n.trim();if(""===e)continue;if(!e.startsWith("//"))break;const t=e.match($b);t&&r[s(611)](t[1])}return{expectFail:r[s(i)](qb)}},"parseScenarioAnnotations"),C_(Vb,S_(562));var Yb="terminal",Gb=new Set(["UNOTEST_BROWSER",S_(415),S_(522),"UNOTEST_DEFAULT_TIMEOUT_MS",S_(639),S_(422),S_(390),"UNOTEST_TIMEZONE","UNOTEST_LOG_LEVEL",S_(394),S_(491),S_(617),S_(537),S_(512),S_(410),S_(635),S_(372),S_(588),S_(573),S_(373),S_(479)]);function Xb(e){return Gb[S_(579)](e)}function Jb(e){return/^[A-Z][A-Z0-9_]*$/[S_(484)](e)}C_(Xb,S_(669)),C_(function(e){const t=S_;return e[t(520)]===t(550)?t(599):Xb(e.name)?"runner":t(576)},"categorizeVariable"),C_(Jb,S_(495));var Zb=/^[A-Za-z_][A-Za-z0-9_]*$/;function*Qb(e){const t=500,i=633,s=474,r=S_;for(const n of e.split(/\r?\n/)){const e=n[r(460)]();if(""===e||e[r(t)]("#"))continue;const o=e[r(i)]("=");if(o<=0)continue;const a=e[r(s)](0,o).trim();Zb[r(484)](a)&&(yield[a,e[r(474)](o+1).trim()])}}function ex(e){const t=S_;if(""===e)return"";if(/[\s#"'=\\]|^[`]/.test(e)||/[\n\r]/.test(e)){return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n")[t(668)](/\r/g,"\\r")+'"'}return e}function tx(e){const t=new Set;for(const[i]of Qb(e))t.add(i);return t}function ix(e){const t=S_,i=e[t(460)]();return i[t(500)]("#")&&/---/[t(484)](i)}function sx(e){const t=500,i=460,s=S_,r=e.trim();if(""===r||r[s(t)]("#"))return!1;const n=r[s(633)]("=");return n>0&&Zb[s(484)](r[s(474)](0,n)[s(i)]())}function rx(e,t){const i=460,s=S_,r=e[s(460)]();if(""===r||r[s(500)]("#"))return!1;const n=r[s(633)]("=");return!(n<=0)&&r[s(474)](0,n)[s(i)]()===t}function nx(e){const t=474,i=S_,s=e[i(426)]("\n"),r=s?e[i(t)](0,-1):e;return{lines:""===r?[]:r.split("\n"),trailingNewline:s}}function ox(e,t){const i=e.join("\n");return t||""===i?i+"\n":i}C_(Qb,S_(459)),C_(function(e){const t=432,i=432,s=S_,r={};for(const[n,o]of Qb(e)){let e=o;if(e[s(t)]>=2){const t=e[0],r=e[e[s(i)]-1];('"'===t||"'"===t)&&t===r&&(e=e.slice(1,-1))}r[n]=e}return r},"parseEnvContent"),C_(ex,S_(571)),C_(tx,S_(398)),C_(ix,S_(593)),C_(sx,S_(590)),C_(rx,S_(453)),C_(nx,S_(477)),C_(ox,"joinLines"),C_(function(e,t,i,s){const r=521,n=432,o=530,a=583,l=S_,c=t+"="+ex(i),{lines:h,trailingNewline:u}=nx(e);if(s){const e=new RegExp("\\b"+s[l(544)]()+"\\b"),t=h[l(r)](t=>ix(t)&&e[l(484)](t[l(544)]()));if(-1!==t){let e=h.length;for(let a=t+1;a<h[l(n)];a++)if(ix(h[a])){e=a;break}let i=-1,s=-1;for(let n=t+1;n<e;n++)""!==h[n][l(460)]()&&(s=n),sx(h[n])&&(i=n);const r=i>=0?i:s,o=r>=0?r+1:t+1;return h.splice(o,0,c),ox(h,u||h[l(n)]>0)}return h[l(432)]>0&&h.push(""),h[l(485)](l(o)+s+l(a),c),ox(h,!0)}return h[l(485)](c),ox(h,!0)},"insertEnvVar"),C_(function(e,t){const i=S_,{lines:s,trailingNewline:r}=nx(e),n=s[i(436)](e=>!rx(e,t)),o=n[i(432)]!==s[i(432)];return{content:ox(n,r),removed:o}},S_(430));var ax={app:"App",runner:S_(642),secret:void 0};C_(function(e){const t=579,i=472,s=528,r=502,n=S_,{name:o,kind:a}=e;if(a===n(524)){if(!Xb(o))return{ok:!1,code:"unknown-runner-key",message:o+" is not a known runner setting — choose one from the runner-config list."}}else if(!Jb(o))return{ok:!1,code:n(455),message:o+n(517)};const l=tx(e[n(383)])[n(579)](o),c=tx(e[n(580)])[n(t)](o),h=a===n(599)?n(550):n(i),u=h===n(550)?c:l,d="secrets"===h?"unotest/.secrets":n(420);if(u)return{ok:!1,code:n(s),message:o+n(630)+d+n(r)};const f=[];return"secret"===a&&l&&f.push(o+n(613)),"secret"!==a&&c&&f[n(485)](o+n(393)),{ok:!0,target:h,sectionLabel:ax[a],warnings:f}},S_(419)),C_(function(e,t,i){return void 0!==i&&i!==t?[e+" is also set in your shell environment — it will keep resolving from there (the environment wins over the file)."]:[]},S_(461));var lx=[S_(471),S_(457),S_(631)];function cx(...e){return e.filter(Boolean).join(" ")}C_(function(e){return lx[S_(536)](e)},"isTerminalRuntimeState"),S_(552),S_(444),S_(569),S_(402),S_(506),S_(417),S_(421),S_(618),S_(429),S_(475),S_(653),S_(450),S_(526),S_(641),S_(445);const hx={clock:ki.jsxs(ki.Fragment,{children:[ki.jsx("circle",{cx:"12",cy:"12",r:"9"}),ki.jsx("path",{d:"M12 7v5l3 2"})]}),user:ki.jsxs(ki.Fragment,{children:[ki.jsx("circle",{cx:"12",cy:"8",r:"3.5"}),ki.jsx("path",{d:"M5.5 20a6.5 6.5 0 0 1 13 0"})]}),search:ki.jsxs(ki.Fragment,{children:[ki.jsx("circle",{cx:"11",cy:"11",r:"7"}),ki.jsx("path",{d:"m20 20-3.5-3.5"})]}),refresh:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M3 12a9 9 0 0 1 15.5-6.3L21 8"}),ki.jsx("path",{d:"M21 3v5h-5"}),ki.jsx("path",{d:"M21 12a9 9 0 0 1-15.5 6.3L3 16"}),ki.jsx("path",{d:"M3 21v-5h5"})]}),sun:ki.jsxs(ki.Fragment,{children:[ki.jsx("circle",{cx:"12",cy:"12",r:"4"}),ki.jsx("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}),moon:ki.jsx("path",{d:"M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8Z"}),monitor:ki.jsxs(ki.Fragment,{children:[ki.jsx("rect",{x:"3",y:"4",width:"18",height:"12",rx:"2"}),ki.jsx("path",{d:"M8 20h8M12 16v4"})]}),chevronR:ki.jsx("path",{d:"m9 6 6 6-6 6"}),chevronD:ki.jsx("path",{d:"m6 9 6 6 6-6"}),check:ki.jsx("path",{d:"M5 12.5 10 17l9-10"}),x:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M6 6l12 12"}),ki.jsx("path",{d:"M18 6 6 18"})]}),alert:ki.jsxs(ki.Fragment,{children:[ki.jsx("circle",{cx:"12",cy:"12",r:"9"}),ki.jsx("path",{d:"M12 8v5"}),ki.jsx("path",{d:"M12 16.5h.01"})]}),play:ki.jsx("path",{d:"M7 5v14l12-7Z"}),pause:ki.jsxs(ki.Fragment,{children:[ki.jsx("rect",{x:"6",y:"5",width:"4",height:"14",rx:"0.5"}),ki.jsx("rect",{x:"14",y:"5",width:"4",height:"14",rx:"0.5"})]}),square:ki.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"}),camera:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M3 8h3l2-2.5h8L18 8h3v11H3Z"}),ki.jsx("circle",{cx:"12",cy:"13",r:"3.5"})]}),terminal:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"m5 8 4 4-4 4"}),ki.jsx("path",{d:"M12 18h7"})]}),network:ki.jsxs(ki.Fragment,{children:[ki.jsx("circle",{cx:"12",cy:"6",r:"2"}),ki.jsx("circle",{cx:"6",cy:"18",r:"2"}),ki.jsx("circle",{cx:"18",cy:"18",r:"2"}),ki.jsx("path",{d:"M12 8v3M6 16l5-5M18 16l-5-5"})]}),tree:ki.jsx("path",{d:"M4 5h6M4 12h10M4 19h14"}),home:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M4 10.5 12 4l8 6.5V19a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1Z"}),ki.jsx("path",{d:"M9.5 20v-6h5v6"})]}),file:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8Z"}),ki.jsx("path",{d:"M14 3v5h5"})]}),code:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"m9 8-5 4 5 4"}),ki.jsx("path",{d:"m15 8 5 4-5 4"})]}),braces:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M8 4H7a3 3 0 0 0-3 3v3l-1 2 1 2v3a3 3 0 0 0 3 3h1"}),ki.jsx("path",{d:"M16 4h1a3 3 0 0 1 3 3v3l1 2-1 2v3a3 3 0 0 1-3 3h-1"})]}),variable:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M5 5c-2 4-2 10 0 14"}),ki.jsx("path",{d:"M19 5c2 4 2 10 0 14"}),ki.jsx("path",{d:"m9 15 6-6"}),ki.jsx("path",{d:"m9 9 6 6"})]}),layers:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"m12 3 9 5-9 5-9-5 9-5Z"}),ki.jsx("path",{d:"m3 13 9 5 9-5"}),ki.jsx("path",{d:"m3 18 9 5 9-5"})]}),list:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M9 6h12M9 12h12M9 18h12"}),ki.jsx("circle",{cx:"4",cy:"6",r:"1"}),ki.jsx("circle",{cx:"4",cy:"12",r:"1"}),ki.jsx("circle",{cx:"4",cy:"18",r:"1"})]}),history:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M3 12a9 9 0 1 0 3-6.7L3 8"}),ki.jsx("path",{d:"M3 3v5h5"}),ki.jsx("path",{d:"M12 7v5l3 2"})]}),activity:ki.jsx("path",{d:"M3 12h4l3-8 4 16 3-8h4"}),plus:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M12 5v14"}),ki.jsx("path",{d:"M5 12h14"})]}),trash:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M4 7h16"}),ki.jsx("path",{d:"M9 7V4h6v3"}),ki.jsx("path",{d:"M6 7v13a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7"}),ki.jsx("path",{d:"M10 11v7M14 11v7"})]}),grip:ki.jsxs(ki.Fragment,{children:[ki.jsx("circle",{cx:"9",cy:"6",r:"1"}),ki.jsx("circle",{cx:"9",cy:"12",r:"1"}),ki.jsx("circle",{cx:"9",cy:"18",r:"1"}),ki.jsx("circle",{cx:"15",cy:"6",r:"1"}),ki.jsx("circle",{cx:"15",cy:"12",r:"1"}),ki.jsx("circle",{cx:"15",cy:"18",r:"1"})]}),panel:ki.jsxs(ki.Fragment,{children:[ki.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1.5"}),ki.jsx("path",{d:"M9 4v16"})]}),panelRight:ki.jsxs(ki.Fragment,{children:[ki.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1.5"}),ki.jsx("path",{d:"M15 4v16"})]}),externalL:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M14 4h6v6"}),ki.jsx("path",{d:"m20 4-9 9"}),ki.jsx("path",{d:"M19 14v5a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5"})]}),copy:ki.jsxs(ki.Fragment,{children:[ki.jsx("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2"}),ki.jsx("path",{d:"M5 15V5a2 2 0 0 1 2-2h10"})]}),folder:ki.jsx("path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"}),folderPlus:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"}),ki.jsx("path",{d:"M12 10v6"}),ki.jsx("path",{d:"M9 13h6"})]}),package:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M21 8v8a2 2 0 0 1-1 1.73l-7 4a2 2 0 0 1-2 0l-7-4A2 2 0 0 1 3 16V8a2 2 0 0 1 1-1.73l7-4a2 2 0 0 1 2 0l7 4A2 2 0 0 1 21 8Z"}),ki.jsx("path",{d:"m3.3 7 8.7 5 8.7-5"}),ki.jsx("path",{d:"M12 22V12"})]}),clipboard:ki.jsxs(ki.Fragment,{children:[ki.jsx("rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",ry:"1"}),ki.jsx("path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"})]}),inspect:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M3 11V5a2 2 0 0 1 2-2h6"}),ki.jsx("path",{d:"M21 13V5a2 2 0 0 0-2-2h-4"}),ki.jsx("path",{d:"M3 13v6a2 2 0 0 0 2 2h6"}),ki.jsx("path",{d:"m13 13 8 8"}),ki.jsx("path",{d:"m17 13 4 4"})]}),more:ki.jsxs(ki.Fragment,{children:[ki.jsx("circle",{cx:"5",cy:"12",r:"1.2"}),ki.jsx("circle",{cx:"12",cy:"12",r:"1.2"}),ki.jsx("circle",{cx:"19",cy:"12",r:"1.2"})]}),spinner:ki.jsx("path",{d:"M21 12a9 9 0 1 1-6.2-8.55"}),edit:ki.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 1 1 3 3L7 19l-4 1 1-4 12.5-12.5Z"}),bug:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M9 8V6a3 3 0 1 1 6 0v2"}),ki.jsx("rect",{x:"6",y:"8",width:"12",height:"11",rx:"6"}),ki.jsx("path",{d:"M12 12v7M3 13h3M18 13h3M5 7l3 2M19 7l-3 2M5 19l3-2M19 19l-3-2"})]}),stepOver:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M4 12a8 8 0 0 1 14-5"}),ki.jsx("path",{d:"M18 3v5h-5"}),ki.jsx("circle",{cx:"12",cy:"18",r:"1.6",fill:"currentColor",stroke:"none"})]}),bp:ki.jsx("circle",{cx:"12",cy:"12",r:"5",fill:"currentColor",stroke:"none"}),arrowR:ki.jsx("path",{d:"m9 6 8 6-8 6Z",fill:"currentColor",stroke:"none"}),minus:ki.jsx("path",{d:"M5 12h14"}),claude:ki.jsx("path",{fill:"currentColor",stroke:"none",d:"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z"}),codex:ki.jsx("path",{fill:"currentColor",stroke:"none",d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"}),eye:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z"}),ki.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),eyeOff:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M9.9 4.24A9.1 9.1 0 0 1 12 4c6.5 0 10 7 10 7a13.2 13.2 0 0 1-2.16 2.92"}),ki.jsx("path",{d:"M6.6 6.6A13.3 13.3 0 0 0 2 11s3.5 7 10 7a9.2 9.2 0 0 0 4.4-1.1"}),ki.jsx("path",{d:"M9.9 9.9a3 3 0 0 0 4.2 4.2"}),ki.jsx("path",{d:"m2 2 20 20"})]}),target:ki.jsxs(ki.Fragment,{children:[ki.jsx("circle",{cx:"12",cy:"12",r:"7"}),ki.jsx("path",{d:"M12 2v3M12 19v3M2 12h3M19 12h3"}),ki.jsx("circle",{cx:"12",cy:"12",r:"1.4",fill:"currentColor",stroke:"none"})]}),text:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M5 19 11 5h2l6 14"}),ki.jsx("path",{d:"M7.5 14.5h9"})]}),globe:ki.jsxs(ki.Fragment,{children:[ki.jsx("circle",{cx:"12",cy:"12",r:"9"}),ki.jsx("path",{d:"M3 12h18"}),ki.jsx("path",{d:"M12 3c2.5 2.6 2.5 15.4 0 18M12 3c-2.5 2.6-2.5 15.4 0 18"})]}),phone:ki.jsxs(ki.Fragment,{children:[ki.jsx("rect",{x:"7",y:"3",width:"10",height:"18",rx:"2"}),ki.jsx("path",{d:"M11 18h2"})]}),cube:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"m12 3 8 4.5v9L12 21l-8-4.5v-9Z"}),ki.jsx("path",{d:"M12 12v9M4 7.5l8 4.5 8-4.5"})]})};function ux({name:e,className:t="h-4 w-4",strokeWidth:i=1.75}){return ki.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:i,strokeLinecap:"round",strokeLinejoin:"round",className:t,"aria-hidden":"true",children:hx[e]})}const dx=[{value:"off",label:"not set"},{value:"m5",label:"every 5 minutes"},{value:"m15",label:"every 15 minutes"},{value:"h1",label:"every hour"},{value:"h2",label:"every 2 hours"},{value:"h4",label:"every 4 hours"},{value:"h6",label:"every 6 hours"},{value:"h12",label:"every 12 hours"},{value:"daily",label:"every day"},{value:"weekly",label:"every week"}],fx=Array.from({length:12},(e,t)=>5*t),px=Array.from({length:24},(e,t)=>t),gx=__(function(){const e=w_(),t=e.schedules.editing;return t?e.schedules.readOnly?ki.jsx(bx,{target:t,deployed:!0},`${t.kind}:${t.name}`):"config"===e.schedules.sourceOf(t.kind,t.name)?ki.jsx(bx,{target:t},`${t.kind}:${t.name}`):ki.jsx(xx,{target:t},`${t.kind}:${t.name}`):null});function vx({target:e,onClose:t,children:i}){return gi.useEffect(()=>{const e=e=>{"Escape"===e.key&&t()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t]),ki.jsx("div",{className:"fixed inset-0 z-50 grid place-items-center bg-black/30 backdrop-blur-[1px]",onMouseDown:t,children:ki.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":`Schedule for ${e.name}`,onMouseDown:e=>e.stopPropagation(),className:cx("w-[min(440px,calc(100vw-2rem))] rounded-lg p-4","border border-edge-soft bg-overlay shadow-xl"),children:[ki.jsxs("div",{className:"flex items-center gap-2",children:[ki.jsx(ux,{name:"clock",className:"h-3.5 w-3.5 text-fg-4"}),ki.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"schedule"}),ki.jsx("span",{className:"min-w-0 flex-1 truncate text-right font-mono text-[12px] text-fg-2",children:e.name}),ki.jsx("span",{className:"rounded border border-edge-soft px-1.5 py-px font-mono text-[9.5px] uppercase tracking-wider text-fg-4",children:"scenario"===e.kind?"test":"collection"})]}),i]})})}function mx({spec:e,cron:t}){return ki.jsxs("div",{className:"mt-1.5 font-mono text-[10.5px] text-fg-4",children:["next: ",jb(kb(e,Date.now()),Date.now())," ",ki.jsx("span",{className:"text-fg-4/70",children:"· your clock"}),ki.jsxs("span",{className:"float-right text-fg-4/70",children:["cron: ",t]})]})}function _x({children:e}){return ki.jsxs("div",{className:"mt-4 flex items-start gap-2 rounded border border-edge-soft bg-raised/50 px-2.5 py-2 text-[11px] leading-relaxed text-fg-4",children:[ki.jsx(ux,{name:"alert",className:"mt-px h-3.5 w-3.5 shrink-0"}),ki.jsx("span",{children:e})]})}const bx=__(function({target:e,deployed:t=!1}){const i=w_().schedules,s=i.get(e.kind,e.name),r=s?yb(s.cron):null;return ki.jsxs(vx,{target:e,onClose:i.closeEditor,children:[ki.jsxs("div",{className:"mt-4 font-mono text-[12.5px] text-fg-2",children:[s?wb(s.cron):"not scheduled",(null==s?void 0:s.env)&&ki.jsxs("span",{className:"text-fg-4",children:[" · env ",s.env]})]}),s&&r&&ki.jsx(mx,{spec:r,cron:s.cron}),ki.jsx(_x,{children:t?ki.jsxs(ki.Fragment,{children:["Declared in the repo (",ki.jsx("span",{className:"font-mono",children:"unotest/schedules.yaml"})," or"," ",ki.jsx("span",{className:"font-mono",children:"unotest.config"}),") — edit it there and push. This box applies whatever the deployed bundle declares."]}):ki.jsxs(ki.Fragment,{children:["Declared in ",ki.jsx("span",{className:"font-mono",children:"unotest.config"})," — edit it there. This popup edits only"," ",ki.jsx("span",{className:"font-mono",children:"unotest/schedules.yaml"}),"."]})}),ki.jsx("div",{className:"mt-4 flex items-center justify-end",children:ki.jsx("button",{type:"button",onClick:i.closeEditor,className:"h-7 rounded border border-edge-soft bg-canvas px-3 font-mono text-[11.5px] text-fg-2 hover:bg-raised",children:"Close"})})]})}),xx=__(function({target:e}){const t=w_(),i=t.schedules,s=i.get(e.kind,e.name),r=s?yb(s.cron):null,n=null!==s&&null===r,[o,a]=gi.useState((null==r?void 0:r.freq)??"off"),[l,c]=gi.useState((null==r?void 0:r.minutes)??[0]),[h,u]=gi.useState((null==r?void 0:r.hours)??[3]),[d,f]=gi.useState((null==r?void 0:r.days)??[1]),[p,g]=gi.useState((null==s?void 0:s.env)??""),[v,m]=gi.useState(null),_="off"===o?null:{freq:o,minutes:l,hours:h,days:d},b="off"===o?null:_b[o];return ki.jsxs(vx,{target:e,onClose:i.closeEditor,children:[ki.jsxs("label",{className:"mt-4 block",children:[ki.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"run"}),ki.jsx("select",{value:o,autoFocus:!0,onChange:e=>a(e.target.value),className:cx("mt-1 h-8 w-full rounded border border-edge-soft bg-canvas px-2","font-mono text-[12.5px] text-fg focus:border-accent focus:outline-none"),children:dx.map(e=>ki.jsx("option",{value:e.value,children:e.label},e.value))})]}),n&&"off"===o&&ki.jsxs("div",{className:"mt-2 font-mono text-[10.5px] text-warn",children:["current schedule is a custom cron: ",s.cron]}),(null==b?void 0:b.days)&&ki.jsx(wx,{label:"days",children:Eb.map(e=>ki.jsx(Sx,{label:Mb[e]??String(e),wide:!0,selected:d.includes(e),onToggle:()=>f(yx(d,e))},e))}),(null==b?void 0:b.hours)&&ki.jsx(wx,{label:"hours",children:px.map(e=>ki.jsx(Sx,{label:kx(e),selected:h.includes(e),onToggle:()=>u(yx(h,e))},e))}),(null==b?void 0:b.minutes)&&ki.jsx(wx,{label:"minutes",children:fx.map(e=>ki.jsx(Sx,{label:kx(e),selected:l.includes(e),onToggle:()=>c(yx(l,e))},e))}),_&&ki.jsx(mx,{spec:_,cron:xb(_)}),ki.jsxs("label",{className:"mt-4 flex items-center gap-3",children:[ki.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"env"}),ki.jsxs("select",{value:p,onChange:e=>g(e.target.value),className:cx("h-7 flex-1 rounded border border-edge-soft bg-canvas px-2","font-mono text-[12px] text-fg-2 focus:border-accent focus:outline-none"),children:[ki.jsx("option",{value:"",children:"base"}),t.environments.names.map(e=>ki.jsx("option",{value:e,children:e},e))]})]}),ki.jsxs(_x,{children:["Saved to ",ki.jsx("span",{className:"font-mono",children:"unotest/schedules.yaml"})," — declared here, and a box runs what you push: the schedule travels with the bundle 1:1."]}),v&&ki.jsx("div",{className:"mt-3 rounded border border-fail/30 bg-fail/10 px-2.5 py-1.5 font-mono text-[10.5px] text-fail",children:v}),ki.jsxs("div",{className:"mt-4 flex items-center justify-end gap-2",children:[ki.jsx("button",{type:"button",onClick:i.closeEditor,className:"h-7 rounded border border-edge-soft bg-canvas px-3 font-mono text-[11.5px] text-fg-2 hover:bg-raised",children:"Cancel"}),ki.jsx("button",{type:"button",onClick:()=>{(async()=>{let e;if(null===_){if(!s)return void i.closeEditor();e=await i.remove()}else e=await i.save({cron:xb(_),env:""===p?null:p});null!==e&&m(e)})()},className:"h-7 rounded bg-accent px-3 font-mono text-[11.5px] font-medium text-on-accent hover:bg-accent-hover",children:"Save"})]})]})});function yx(e,t){return e.includes(t)?1===e.length?e:e.filter(e=>e!==t):[...e,t]}function wx({label:e,children:t}){return ki.jsxs("div",{className:"mt-3",children:[ki.jsx("div",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:e}),ki.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:t})]})}function Sx({label:e,selected:t,onToggle:i,wide:s=!1}){return ki.jsx("button",{type:"button","aria-pressed":t,onClick:i,className:cx("h-6 rounded border font-mono text-[10.5px] tabular-nums",s?"px-2.5":"w-8",t?"border-accent/40 bg-accent/15 text-accent":"border-edge-soft bg-canvas text-fg-4 hover:bg-raised hover:text-fg-2"),children:e})}const kx=e=>String(e).padStart(2,"0");function Cx(e){return t=>{t.preventDefault();const i="x"===e.axis?t.clientX:t.clientY,s=e.value,r=t=>{const r="x"===e.axis?t.clientX:t.clientY;e.onChange(Math.min(e.max(),Math.max(e.min,s+(r-i)*e.dir)))},n=()=>{window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",n),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="x"===e.axis?"ew-resize":"ns-resize",document.body.style.userSelect="none",window.addEventListener("pointermove",r),window.addEventListener("pointerup",n)}}function jx(e,t){gi.useEffect(()=>{const i=i=>{var s;(null==(s=e.current)?void 0:s.contains(i.target))||t()},s=e=>{"Escape"===e.key&&t()},r=()=>t();return window.addEventListener("mousedown",i,!0),window.addEventListener("contextmenu",i,!0),window.addEventListener("keydown",s),window.addEventListener("scroll",r,!0),()=>{window.removeEventListener("mousedown",i,!0),window.removeEventListener("contextmenu",i,!0),window.removeEventListener("keydown",s),window.removeEventListener("scroll",r,!0)}},[e,t])}function Nx({x:e,y:t,items:i,onClose:s}){const r=gi.useRef(null),{left:n,top:o,mounted:a}=function(e,t,i){const[s,r]=gi.useState({left:t,top:i}),[n,o]=gi.useState(!1);return gi.useEffect(()=>{const s=e.current;if(!s)return;const{innerWidth:n,innerHeight:a}=window,l=s.getBoundingClientRect();let c=t,h=i;c+l.width>n-6&&(c=Math.max(6,n-l.width-6)),h+l.height>a-6&&(h=Math.max(6,a-l.height-6)),r({left:c,top:h});const u=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(u)},[e,t,i]),{left:s.left,top:s.top,mounted:n}}(r,e,t);return jx(r,s),ki.jsx("div",{ref:r,role:"menu",style:{left:n,top:o,opacity:a?1:0,transform:a?"translateY(0)":"translateY(-2px)",transitionProperty:"opacity, transform",transitionDuration:"90ms",transitionTimingFunction:"ease-out"},className:cx("fixed z-50 min-w-[208px] overflow-hidden rounded-lg p-1","border border-edge-soft bg-overlay/95 backdrop-blur","shadow-lg"),children:i.map((e,t)=>{if("separator"===e.kind)return ki.jsx("div",{className:"my-1 h-px bg-edge-soft"},t);if("header"===e.kind)return ki.jsx("div",{className:"select-none truncate px-2 pb-1 pt-1 font-mono text-[10px] font-medium uppercase tracking-wider text-fg-4",children:e.label},t);const i="danger"===e.tone;return ki.jsxs("button",{type:"button",role:"menuitem",disabled:e.disabled,onClick:()=>{e.disabled||(e.onSelect(),s())},className:cx("group flex h-7 w-full items-center gap-2 rounded-md px-2 text-left font-mono text-[12px]",e.disabled?"cursor-default text-fg-4":i?"text-fg-2 hover:bg-fail/10 hover:text-fail":"text-fg-2 hover:bg-raised hover:text-fg"),children:[ki.jsx("span",{className:cx("grid h-4 w-4 shrink-0 place-items-center",e.disabled?"text-fg-4":i?"text-fg-3 group-hover:text-fail":"text-fg-3"),children:e.icon&&ki.jsx(ux,{name:e.icon,className:"h-3.5 w-3.5",strokeWidth:1.75})}),ki.jsx("span",{className:"truncate",children:e.label}),e.shortcut&&ki.jsx("span",{className:"ml-auto pl-4 font-mono text-[10.5px] tracking-wider text-fg-4",children:e.shortcut})]},t)})})}function Mx({axis:e,onPointerDown:t,className:i}){return ki.jsx("div",{onPointerDown:t,role:"separator","aria-orientation":"x"===e?"vertical":"horizontal",title:"Drag to resize",className:cx("group/resize absolute z-20 touch-none","x"===e?"inset-y-0 w-[7px] cursor-ew-resize":"inset-x-0 h-[7px] cursor-ns-resize",i),children:ki.jsx("span",{className:cx("absolute bg-transparent group-hover/resize:bg-accent/60 group-active/resize:bg-accent","x"===e?"inset-y-0 left-1/2 w-[2px] -translate-x-1/2":"inset-x-0 top-1/2 h-[2px] -translate-y-1/2")})})}function Ex({leading:e,label:t,active:i,closable:s=!0,closeLabel:r,onActivate:n,onClose:o,onContextMenu:a}){return ki.jsxs("div",{role:"tab","aria-selected":i,tabIndex:0,onClick:n,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n())},onMouseDown:e=>{1===e.button&&s&&o&&(e.preventDefault(),o())},onContextMenu:a,className:cx("group flex h-7 max-w-[260px] shrink-0 cursor-default items-center gap-1.5 rounded-md px-2.5",i?"bg-selection text-fg":"text-fg-3 hover:bg-raised hover:text-fg-2"),children:[e,ki.jsx("span",{className:"truncate font-mono text-[12px]",children:t}),s&&o&&ki.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),o()},className:cx("grid h-4 w-4 shrink-0 place-items-center rounded-sm text-fg-4 opacity-0 hover:bg-fg/10 hover:text-fg group-hover:opacity-100",i&&"opacity-100"),"aria-label":r??`Close ${t}`,children:ki.jsx(ux,{name:"x",className:"h-3 w-3",strokeWidth:2.5})})]})}const Bx={local:{kind:"local",label:"Local",icon:"terminal",tint:"text-fg-4"},claude:{kind:"claude",label:"Claude Code",icon:"claude",tint:"text-orange-500 dark:text-orange-400"},codex:{kind:"codex",label:"Codex",icon:"codex",tint:"text-emerald-500 dark:text-emerald-400"}};function Dx(e){return"dark"===e?{background:"#1e1f22",foreground:"#e4e4e7",cursor:"#a5b4fc",cursorAccent:"#1e1f22",selectionBackground:"#3f3f46",black:"#27272a",red:"#f87171",green:"#4ade80",yellow:"#fbbf24",blue:"#60a5fa",magenta:"#c084fc",cyan:"#22d3ee",white:"#e4e4e7",brightBlack:"#52525b",brightWhite:"#fafafa"}:{background:"#ffffff",foreground:"#3f3f46",cursor:"#6366f1",cursorAccent:"#ffffff",selectionBackground:"#e4e4e7",black:"#3f3f46",red:"#dc2626",green:"#16a34a",yellow:"#d97706",blue:"#2563eb",magenta:"#9333ea",cyan:"#0891b2",white:"#3f3f46",brightBlack:"#a1a1aa",brightWhite:"#18181b"}}
30
+ */function Go(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,i=1;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Xo=new Set,Zo={};function Jo(e,t){Qo(e,t),Qo(e+"Capture",t)}function Qo(e,t){for(Zo[e]=t,e=0;e<t.length;e++)Xo.add(t[e])}var ea=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),ta=Object.prototype.hasOwnProperty,ia=/^[: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]*$/,sa={},ra={};function na(e,t,i,s,r,n,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=s,this.attributeNamespace=r,this.mustUseProperty=i,this.propertyName=e,this.type=t,this.sanitizeURL=n,this.removeEmptyString=o}var oa={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){oa[e]=new na(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];oa[t]=new na(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){oa[e]=new na(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){oa[e]=new na(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){oa[e]=new na(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){oa[e]=new na(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){oa[e]=new na(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){oa[e]=new na(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){oa[e]=new na(e,5,!1,e.toLowerCase(),null,!1,!1)});var aa=/[\-:]([a-z])/g;function la(e){return e[1].toUpperCase()}function ca(e,t,i,s){var r=oa.hasOwnProperty(t)?oa[t]:null;(null!==r?0!==r.type:s||!(2<t.length)||"o"!==t[0]&&"O"!==t[0]||"n"!==t[1]&&"N"!==t[1])&&(function(e,t,i,s){if(null==t||function(e,t,i,s){if(null!==i&&0===i.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!s&&(null!==i?!i.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,i,s))return!0;if(s)return!1;if(null!==i)switch(i.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,i,r,s)&&(i=null),s||null===r?function(e){return!!ta.call(ra,e)||!ta.call(sa,e)&&(ia.test(e)?ra[e]=!0:(sa[e]=!0,!1))}(t)&&(null===i?e.removeAttribute(t):e.setAttribute(t,""+i)):r.mustUseProperty?e[r.propertyName]=null===i?3!==r.type&&"":i:(t=r.attributeName,s=r.attributeNamespace,null===i?e.removeAttribute(t):(i=3===(r=r.type)||4===r&&!0===i?"":""+i,s?e.setAttributeNS(s,t,i):e.setAttribute(t,i))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(aa,la);oa[t]=new na(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(aa,la);oa[t]=new na(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(aa,la);oa[t]=new na(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){oa[e]=new na(e,1,!1,e.toLowerCase(),null,!1,!1)}),oa.xlinkHref=new na("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){oa[e]=new na(e,1,!1,e.toLowerCase(),null,!0,!0)});var ha=Vo.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ua=Symbol.for("react.element"),da=Symbol.for("react.portal"),fa=Symbol.for("react.fragment"),pa=Symbol.for("react.strict_mode"),ga=Symbol.for("react.profiler"),va=Symbol.for("react.provider"),ma=Symbol.for("react.context"),_a=Symbol.for("react.forward_ref"),ba=Symbol.for("react.suspense"),xa=Symbol.for("react.suspense_list"),ya=Symbol.for("react.memo"),wa=Symbol.for("react.lazy"),Sa=Symbol.for("react.offscreen"),ka=Symbol.iterator;function Ca(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=ka&&e[ka]||e["@@iterator"])?e:null}var ja,Na=Object.assign;function Ma(e){if(void 0===ja)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);ja=t&&t[1]||""}return"\n"+ja+e}var Ba=!1;function Ea(e,t){if(!e||Ba)return"";Ba=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var s=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){s=c}e.call(t.prototype)}else{try{throw Error()}catch(c){s=c}e()}}catch(c){if(c&&s&&"string"==typeof c.stack){for(var r=c.stack.split("\n"),n=s.stack.split("\n"),o=r.length-1,a=n.length-1;1<=o&&0<=a&&r[o]!==n[a];)a--;for(;1<=o&&0<=a;o--,a--)if(r[o]!==n[a]){if(1!==o||1!==a)do{if(o--,0>--a||r[o]!==n[a]){var l="\n"+r[o].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}}while(1<=o&&0<=a);break}}}finally{Ba=!1,Error.prepareStackTrace=i}return(e=e?e.displayName||e.name:"")?Ma(e):""}function Da(e){switch(e.tag){case 5:return Ma(e.type);case 16:return Ma("Lazy");case 13:return Ma("Suspense");case 19:return Ma("SuspenseList");case 0:case 2:case 15:return e=Ea(e.type,!1);case 11:return e=Ea(e.type.render,!1);case 1:return e=Ea(e.type,!0);default:return""}}function La(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case fa:return"Fragment";case da:return"Portal";case ga:return"Profiler";case pa:return"StrictMode";case ba:return"Suspense";case xa:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case ma:return(e.displayName||"Context")+".Consumer";case va:return(e._context.displayName||"Context")+".Provider";case _a:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case ya:return null!==(t=e.displayName||null)?t:La(e.type)||"Memo";case wa:t=e._payload,e=e._init;try{return La(e(t))}catch(i){}}return null}function Pa(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return La(t);case 8:return t===pa?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t}return null}function Ra(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function Aa(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function Ta(e){e._valueTracker||(e._valueTracker=function(e){var t=Aa(e)?"checked":"value",i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),s=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==i&&"function"==typeof i.get&&"function"==typeof i.set){var r=i.get,n=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(e){s=""+e,n.call(this,e)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return s},setValue:function(e){s=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function za(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),s="";return e&&(s=Aa(e)?e.checked?"true":"false":e.value),(e=s)!==i&&(t.setValue(e),!0)}function Oa(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function Ia(e,t){var i=t.checked;return Na({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=i?i:e._wrapperState.initialChecked})}function Fa(e,t){var i=null==t.defaultValue?"":t.defaultValue,s=null!=t.checked?t.checked:t.defaultChecked;i=Ra(null!=t.value?t.value:i),e._wrapperState={initialChecked:s,initialValue:i,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function Ha(e,t){null!=(t=t.checked)&&ca(e,"checked",t,!1)}function Wa(e,t){Ha(e,t);var i=Ra(t.value),s=t.type;if(null!=i)"number"===s?(0===i&&""===e.value||e.value!=i)&&(e.value=""+i):e.value!==""+i&&(e.value=""+i);else if("submit"===s||"reset"===s)return void e.removeAttribute("value");t.hasOwnProperty("value")?Ua(e,t.type,i):t.hasOwnProperty("defaultValue")&&Ua(e,t.type,Ra(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function Ka(e,t,i){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var s=t.type;if(!("submit"!==s&&"reset"!==s||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,i||t===e.value||(e.value=t),e.defaultValue=t}""!==(i=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==i&&(e.name=i)}function Ua(e,t,i){"number"===t&&Oa(e.ownerDocument)===e||(null==i?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+i&&(e.defaultValue=""+i))}var $a=Array.isArray;function qa(e,t,i,s){if(e=e.options,t){t={};for(var r=0;r<i.length;r++)t["$"+i[r]]=!0;for(i=0;i<e.length;i++)r=t.hasOwnProperty("$"+e[i].value),e[i].selected!==r&&(e[i].selected=r),r&&s&&(e[i].defaultSelected=!0)}else{for(i=""+Ra(i),t=null,r=0;r<e.length;r++){if(e[r].value===i)return e[r].selected=!0,void(s&&(e[r].defaultSelected=!0));null!==t||e[r].disabled||(t=e[r])}null!==t&&(t.selected=!0)}}function Va(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(Go(91));return Na({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Ya(e,t){var i=t.value;if(null==i){if(i=t.children,t=t.defaultValue,null!=i){if(null!=t)throw Error(Go(92));if($a(i)){if(1<i.length)throw Error(Go(93));i=i[0]}t=i}null==t&&(t=""),i=t}e._wrapperState={initialValue:Ra(i)}}function Ga(e,t){var i=Ra(t.value),s=Ra(t.defaultValue);null!=i&&((i=""+i)!==e.value&&(e.value=i),null==t.defaultValue&&e.defaultValue!==i&&(e.defaultValue=i)),null!=s&&(e.defaultValue=""+s)}function Xa(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}function Za(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Ja(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?Za(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var Qa,el,tl=(el=function(e,t){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=t;else{for((Qa=Qa||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Qa.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,i,s){MSApp.execUnsafeLocalFunction(function(){return el(e,t)})}:el);function il(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&3===i.nodeType)return void(i.nodeValue=t)}e.textContent=t}var sl={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},rl=["Webkit","ms","Moz","O"];function nl(e,t,i){return null==t||"boolean"==typeof t||""===t?"":i||"number"!=typeof t||0===t||sl.hasOwnProperty(e)&&sl[e]?(""+t).trim():t+"px"}function ol(e,t){for(var i in e=e.style,t)if(t.hasOwnProperty(i)){var s=0===i.indexOf("--"),r=nl(i,t[i],s);"float"===i&&(i="cssFloat"),s?e.setProperty(i,r):e[i]=r}}Object.keys(sl).forEach(function(e){rl.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),sl[t]=sl[e]})});var al=Na({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ll(e,t){if(t){if(al[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(Go(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(Go(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(Go(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(Go(62))}}function cl(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){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 hl=null;function ul(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var dl=null,fl=null,pl=null;function gl(e){if(e=ld(e)){if("function"!=typeof dl)throw Error(Go(280));var t=e.stateNode;t&&(t=hd(t),dl(e.stateNode,e.type,t))}}function vl(e){fl?pl?pl.push(e):pl=[e]:fl=e}function ml(){if(fl){var e=fl,t=pl;if(pl=fl=null,gl(e),t)for(e=0;e<t.length;e++)gl(t[e])}}function _l(e,t){return e(t)}function bl(){}var xl=!1;function yl(e,t,i){if(xl)return e(t,i);xl=!0;try{return _l(e,t,i)}finally{xl=!1,(null!==fl||null!==pl)&&(bl(),ml())}}function wl(e,t){var i=e.stateNode;if(null===i)return null;var s=hd(i);if(null===s)return null;i=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(s=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!s;break e;default:e=!1}if(e)return null;if(i&&"function"!=typeof i)throw Error(Go(231,t,typeof i));return i}var Sl=!1;if(ea)try{var kl={};Object.defineProperty(kl,"passive",{get:function(){Sl=!0}}),window.addEventListener("test",kl,kl),window.removeEventListener("test",kl,kl)}catch(el){Sl=!1}function Cl(e,t,i,s,r,n,o,a,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(i,c)}catch(h){this.onError(h)}}var jl=!1,Nl=null,Ml=!1,Bl=null,El={onError:function(e){jl=!0,Nl=e}};function Dl(e,t,i,s,r,n,o,a,l){jl=!1,Nl=null,Cl.apply(El,arguments)}function Ll(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{!!(4098&(t=e).flags)&&(i=t.return),e=t.return}while(e)}return 3===t.tag?i:null}function Pl(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function Rl(e){if(Ll(e)!==e)throw Error(Go(188))}function Al(e){return null!==(e=function(e){var t=e.alternate;if(!t){if(null===(t=Ll(e)))throw Error(Go(188));return t!==e?null:e}for(var i=e,s=t;;){var r=i.return;if(null===r)break;var n=r.alternate;if(null===n){if(null!==(s=r.return)){i=s;continue}break}if(r.child===n.child){for(n=r.child;n;){if(n===i)return Rl(r),e;if(n===s)return Rl(r),t;n=n.sibling}throw Error(Go(188))}if(i.return!==s.return)i=r,s=n;else{for(var o=!1,a=r.child;a;){if(a===i){o=!0,i=r,s=n;break}if(a===s){o=!0,s=r,i=n;break}a=a.sibling}if(!o){for(a=n.child;a;){if(a===i){o=!0,i=n,s=r;break}if(a===s){o=!0,s=n,i=r;break}a=a.sibling}if(!o)throw Error(Go(189))}}if(i.alternate!==s)throw Error(Go(190))}if(3!==i.tag)throw Error(Go(188));return i.stateNode.current===i?e:t}(e))?Tl(e):null}function Tl(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=Tl(e);if(null!==t)return t;e=e.sibling}return null}var zl=Yo.unstable_scheduleCallback,Ol=Yo.unstable_cancelCallback,Il=Yo.unstable_shouldYield,Fl=Yo.unstable_requestPaint,Hl=Yo.unstable_now,Wl=Yo.unstable_getCurrentPriorityLevel,Kl=Yo.unstable_ImmediatePriority,Ul=Yo.unstable_UserBlockingPriority,$l=Yo.unstable_NormalPriority,ql=Yo.unstable_LowPriority,Vl=Yo.unstable_IdlePriority,Yl=null,Gl=null;var Xl=Math.clz32?Math.clz32:function(e){return e>>>=0,0===e?32:31-(Zl(e)/Jl|0)|0},Zl=Math.log,Jl=Math.LN2;var Ql=64,ec=4194304;function tc(e){switch(e&-e){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: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 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ic(e,t){var i=e.pendingLanes;if(0===i)return 0;var s=0,r=e.suspendedLanes,n=e.pingedLanes,o=268435455&i;if(0!==o){var a=o&~r;0!==a?s=tc(a):0!==(n&=o)&&(s=tc(n))}else 0!==(o=i&~r)?s=tc(o):0!==n&&(s=tc(n));if(0===s)return 0;if(0!==t&&t!==s&&0===(t&r)&&((r=s&-s)>=(n=t&-t)||16===r&&4194240&n))return t;if(4&s&&(s|=16&i),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=s;0<t;)r=1<<(i=31-Xl(t)),s|=e[i],t&=~r;return s}function sc(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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 t+5e3;default:return-1}}function rc(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function nc(){var e=Ql;return!(4194240&(Ql<<=1))&&(Ql=64),e}function oc(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function ac(e,t,i){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-Xl(t)]=i}function lc(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var s=31-Xl(i),r=1<<s;r&t|e[s]&t&&(e[s]|=t),i&=~r}}var cc=0;function hc(e){return 1<(e&=-e)?4<e?268435455&e?16:536870912:4:1}var uc,dc,fc,pc,gc,vc=!1,mc=[],_c=null,bc=null,xc=null,yc=new Map,wc=new Map,Sc=[],kc="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 submit".split(" ");function Cc(e,t){switch(e){case"focusin":case"focusout":_c=null;break;case"dragenter":case"dragleave":bc=null;break;case"mouseover":case"mouseout":xc=null;break;case"pointerover":case"pointerout":yc.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":wc.delete(t.pointerId)}}function jc(e,t,i,s,r,n){return null===e||e.nativeEvent!==n?(e={blockedOn:t,domEventName:i,eventSystemFlags:s,nativeEvent:n,targetContainers:[r]},null!==t&&(null!==(t=ld(t))&&dc(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,null!==r&&-1===t.indexOf(r)&&t.push(r),e)}function Nc(e){var t=ad(e.target);if(null!==t){var i=Ll(t);if(null!==i)if(13===(t=i.tag)){if(null!==(t=Pl(i)))return e.blockedOn=t,void gc(e.priority,function(){fc(i)})}else if(3===t&&i.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===i.tag?i.stateNode.containerInfo:null)}e.blockedOn=null}function Mc(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var i=Ic(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==i)return null!==(t=ld(i))&&dc(t),e.blockedOn=i,!1;var s=new(i=e.nativeEvent).constructor(i.type,i);hl=s,i.target.dispatchEvent(s),hl=null,t.shift()}return!0}function Bc(e,t,i){Mc(e)&&i.delete(t)}function Ec(){vc=!1,null!==_c&&Mc(_c)&&(_c=null),null!==bc&&Mc(bc)&&(bc=null),null!==xc&&Mc(xc)&&(xc=null),yc.forEach(Bc),wc.forEach(Bc)}function Dc(e,t){e.blockedOn===t&&(e.blockedOn=null,vc||(vc=!0,Yo.unstable_scheduleCallback(Yo.unstable_NormalPriority,Ec)))}function Lc(e){function t(t){return Dc(t,e)}if(0<mc.length){Dc(mc[0],e);for(var i=1;i<mc.length;i++){var s=mc[i];s.blockedOn===e&&(s.blockedOn=null)}}for(null!==_c&&Dc(_c,e),null!==bc&&Dc(bc,e),null!==xc&&Dc(xc,e),yc.forEach(t),wc.forEach(t),i=0;i<Sc.length;i++)(s=Sc[i]).blockedOn===e&&(s.blockedOn=null);for(;0<Sc.length&&null===(i=Sc[0]).blockedOn;)Nc(i),null===i.blockedOn&&Sc.shift()}var Pc=ha.ReactCurrentBatchConfig,Rc=!0;function Ac(e,t,i,s){var r=cc,n=Pc.transition;Pc.transition=null;try{cc=1,zc(e,t,i,s)}finally{cc=r,Pc.transition=n}}function Tc(e,t,i,s){var r=cc,n=Pc.transition;Pc.transition=null;try{cc=4,zc(e,t,i,s)}finally{cc=r,Pc.transition=n}}function zc(e,t,i,s){if(Rc){var r=Ic(e,t,i,s);if(null===r)Pu(e,t,s,Oc,i),Cc(e,s);else if(function(e,t,i,s,r){switch(t){case"focusin":return _c=jc(_c,e,t,i,s,r),!0;case"dragenter":return bc=jc(bc,e,t,i,s,r),!0;case"mouseover":return xc=jc(xc,e,t,i,s,r),!0;case"pointerover":var n=r.pointerId;return yc.set(n,jc(yc.get(n)||null,e,t,i,s,r)),!0;case"gotpointercapture":return n=r.pointerId,wc.set(n,jc(wc.get(n)||null,e,t,i,s,r)),!0}return!1}(r,e,t,i,s))s.stopPropagation();else if(Cc(e,s),4&t&&-1<kc.indexOf(e)){for(;null!==r;){var n=ld(r);if(null!==n&&uc(n),null===(n=Ic(e,t,i,s))&&Pu(e,t,s,Oc,i),n===r)break;r=n}null!==r&&s.stopPropagation()}else Pu(e,t,s,null,i)}}var Oc=null;function Ic(e,t,i,s){if(Oc=null,null!==(e=ad(e=ul(s))))if(null===(t=Ll(e)))e=null;else if(13===(i=t.tag)){if(null!==(e=Pl(t)))return e;e=null}else if(3===i){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Oc=e,null}function Fc(e){switch(e){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Wl()){case Kl:return 1;case Ul:return 4;case $l:case ql:return 16;case Vl:return 536870912;default:return 16}default:return 16}}var Hc=null,Wc=null,Kc=null;function Uc(){if(Kc)return Kc;var e,t,i=Wc,s=i.length,r="value"in Hc?Hc.value:Hc.textContent,n=r.length;for(e=0;e<s&&i[e]===r[e];e++);var o=s-e;for(t=1;t<=o&&i[s-t]===r[n-t];t++);return Kc=r.slice(e,1<t?1-t:void 0)}function $c(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function qc(){return!0}function Vc(){return!1}function Yc(e){function t(t,i,s,r,n){for(var o in this._reactName=t,this._targetInst=s,this.type=i,this.nativeEvent=r,this.target=n,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(r):r[o]);return this.isDefaultPrevented=(null!=r.defaultPrevented?r.defaultPrevented:!1===r.returnValue)?qc:Vc,this.isPropagationStopped=Vc,this}return Na(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=qc)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=qc)},persist:function(){},isPersistent:qc}),t}var Gc,Xc,Zc,Jc={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Qc=Yc(Jc),eh=Na({},Jc,{view:0,detail:0}),th=Yc(eh),ih=Na({},eh,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ph,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Zc&&(Zc&&"mousemove"===e.type?(Gc=e.screenX-Zc.screenX,Xc=e.screenY-Zc.screenY):Xc=Gc=0,Zc=e),Gc)},movementY:function(e){return"movementY"in e?e.movementY:Xc}}),sh=Yc(ih),rh=Yc(Na({},ih,{dataTransfer:0})),nh=Yc(Na({},eh,{relatedTarget:0})),oh=Yc(Na({},Jc,{animationName:0,elapsedTime:0,pseudoElement:0})),ah=Na({},Jc,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),lh=Yc(ah),ch=Yc(Na({},Jc,{data:0})),hh={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},uh={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"},dh={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function fh(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=dh[e])&&!!t[e]}function ph(){return fh}var gh=Na({},eh,{key:function(e){if(e.key){var t=hh[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=$c(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?uh[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ph,charCode:function(e){return"keypress"===e.type?$c(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?$c(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),vh=Yc(gh),mh=Yc(Na({},ih,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),_h=Yc(Na({},eh,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ph})),bh=Yc(Na({},Jc,{propertyName:0,elapsedTime:0,pseudoElement:0})),xh=Na({},ih,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),yh=Yc(xh),wh=[9,13,27,32],Sh=ea&&"CompositionEvent"in window,kh=null;ea&&"documentMode"in document&&(kh=document.documentMode);var Ch=ea&&"TextEvent"in window&&!kh,jh=ea&&(!Sh||kh&&8<kh&&11>=kh),Nh=String.fromCharCode(32),Mh=!1;function Bh(e,t){switch(e){case"keyup":return-1!==wh.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Eh(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Dh=!1;var Lh={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 Ph(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Lh[e.type]:"textarea"===t}function Rh(e,t,i,s){vl(s),0<(t=Au(t,"onChange")).length&&(i=new Qc("onChange","change",null,i,s),e.push({event:i,listeners:t}))}var Ah=null,Th=null;function zh(e){Nu(e,0)}function Oh(e){if(za(cd(e)))return e}function Ih(e,t){if("change"===e)return t}var Fh=!1;if(ea){var Hh;if(ea){var Wh="oninput"in document;if(!Wh){var Kh=document.createElement("div");Kh.setAttribute("oninput","return;"),Wh="function"==typeof Kh.oninput}Hh=Wh}else Hh=!1;Fh=Hh&&(!document.documentMode||9<document.documentMode)}function Uh(){Ah&&(Ah.detachEvent("onpropertychange",$h),Th=Ah=null)}function $h(e){if("value"===e.propertyName&&Oh(Th)){var t=[];Rh(t,Th,e,ul(e)),yl(zh,t)}}function qh(e,t,i){"focusin"===e?(Uh(),Th=i,(Ah=t).attachEvent("onpropertychange",$h)):"focusout"===e&&Uh()}function Vh(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Oh(Th)}function Yh(e,t){if("click"===e)return Oh(t)}function Gh(e,t){if("input"===e||"change"===e)return Oh(t)}var Xh="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function Zh(e,t){if(Xh(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var i=Object.keys(e),s=Object.keys(t);if(i.length!==s.length)return!1;for(s=0;s<i.length;s++){var r=i[s];if(!ta.call(t,r)||!Xh(e[r],t[r]))return!1}return!0}function Jh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Qh(e,t){var i,s=Jh(e);for(e=0;s;){if(3===s.nodeType){if(i=e+s.textContent.length,e<=t&&i>=t)return{node:s,offset:t-e};e=i}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Jh(s)}}function eu(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?eu(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function tu(){for(var e=window,t=Oa();t instanceof e.HTMLIFrameElement;){try{var i="string"==typeof t.contentWindow.location.href}catch(s){i=!1}if(!i)break;t=Oa((e=t.contentWindow).document)}return t}function iu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}function su(e){var t=tu(),i=e.focusedElem,s=e.selectionRange;if(t!==i&&i&&i.ownerDocument&&eu(i.ownerDocument.documentElement,i)){if(null!==s&&iu(i))if(t=s.start,void 0===(e=s.end)&&(e=t),"selectionStart"in i)i.selectionStart=t,i.selectionEnd=Math.min(e,i.value.length);else if((e=(t=i.ownerDocument||document)&&t.defaultView||window).getSelection){e=e.getSelection();var r=i.textContent.length,n=Math.min(s.start,r);s=void 0===s.end?n:Math.min(s.end,r),!e.extend&&n>s&&(r=s,s=n,n=r),r=Qh(i,n);var o=Qh(i,s);r&&o&&(1!==e.rangeCount||e.anchorNode!==r.node||e.anchorOffset!==r.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&((t=t.createRange()).setStart(r.node,r.offset),e.removeAllRanges(),n>s?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}for(t=[],e=i;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"==typeof i.focus&&i.focus(),i=0;i<t.length;i++)(e=t[i]).element.scrollLeft=e.left,e.element.scrollTop=e.top}}var ru=ea&&"documentMode"in document&&11>=document.documentMode,nu=null,ou=null,au=null,lu=!1;function cu(e,t,i){var s=i.window===i?i.document:9===i.nodeType?i:i.ownerDocument;lu||null==nu||nu!==Oa(s)||("selectionStart"in(s=nu)&&iu(s)?s={start:s.selectionStart,end:s.selectionEnd}:s={anchorNode:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset},au&&Zh(au,s)||(au=s,0<(s=Au(ou,"onSelect")).length&&(t=new Qc("onSelect","select",null,t,i),e.push({event:t,listeners:s}),t.target=nu)))}function hu(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var uu={animationend:hu("Animation","AnimationEnd"),animationiteration:hu("Animation","AnimationIteration"),animationstart:hu("Animation","AnimationStart"),transitionend:hu("Transition","TransitionEnd")},du={},fu={};function pu(e){if(du[e])return du[e];if(!uu[e])return e;var t,i=uu[e];for(t in i)if(i.hasOwnProperty(t)&&t in fu)return du[e]=i[t];return e}ea&&(fu=document.createElement("div").style,"AnimationEvent"in window||(delete uu.animationend.animation,delete uu.animationiteration.animation,delete uu.animationstart.animation),"TransitionEvent"in window||delete uu.transitionend.transition);var gu=pu("animationend"),vu=pu("animationiteration"),mu=pu("animationstart"),_u=pu("transitionend"),bu=new Map,xu="abort auxClick 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(" ");function yu(e,t){bu.set(e,t),Jo(t,[e])}for(var wu=0;wu<xu.length;wu++){var Su=xu[wu];yu(Su.toLowerCase(),"on"+(Su[0].toUpperCase()+Su.slice(1)))}yu(gu,"onAnimationEnd"),yu(vu,"onAnimationIteration"),yu(mu,"onAnimationStart"),yu("dblclick","onDoubleClick"),yu("focusin","onFocus"),yu("focusout","onBlur"),yu(_u,"onTransitionEnd"),Qo("onMouseEnter",["mouseout","mouseover"]),Qo("onMouseLeave",["mouseout","mouseover"]),Qo("onPointerEnter",["pointerout","pointerover"]),Qo("onPointerLeave",["pointerout","pointerover"]),Jo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Jo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Jo("onBeforeInput",["compositionend","keypress","textInput","paste"]),Jo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Jo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Jo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ku="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(" "),Cu=new Set("cancel close invalid load scroll toggle".split(" ").concat(ku));function ju(e,t,i){var s=e.type||"unknown-event";e.currentTarget=i,function(e,t,i,s,r,n,o,a,l){if(Dl.apply(this,arguments),jl){if(!jl)throw Error(Go(198));var c=Nl;jl=!1,Nl=null,Ml||(Ml=!0,Bl=c)}}(s,t,void 0,e),e.currentTarget=null}function Nu(e,t){t=!!(4&t);for(var i=0;i<e.length;i++){var s=e[i],r=s.event;s=s.listeners;e:{var n=void 0;if(t)for(var o=s.length-1;0<=o;o--){var a=s[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==n&&r.isPropagationStopped())break e;ju(r,a,c),n=l}else for(o=0;o<s.length;o++){if(l=(a=s[o]).instance,c=a.currentTarget,a=a.listener,l!==n&&r.isPropagationStopped())break e;ju(r,a,c),n=l}}}if(Ml)throw e=Bl,Ml=!1,Bl=null,e}function Mu(e,t){var i=t[rd];void 0===i&&(i=t[rd]=new Set);var s=e+"__bubble";i.has(s)||(Lu(t,e,2,!1),i.add(s))}function Bu(e,t,i){var s=0;t&&(s|=4),Lu(i,e,s,t)}var Eu="_reactListening"+Math.random().toString(36).slice(2);function Du(e){if(!e[Eu]){e[Eu]=!0,Xo.forEach(function(t){"selectionchange"!==t&&(Cu.has(t)||Bu(t,!1,e),Bu(t,!0,e))});var t=9===e.nodeType?e:e.ownerDocument;null===t||t[Eu]||(t[Eu]=!0,Bu("selectionchange",!1,t))}}function Lu(e,t,i,s){switch(Fc(t)){case 1:var r=Ac;break;case 4:r=Tc;break;default:r=zc}i=r.bind(null,t,i,e),r=void 0,!Sl||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(r=!0),s?void 0!==r?e.addEventListener(t,i,{capture:!0,passive:r}):e.addEventListener(t,i,!0):void 0!==r?e.addEventListener(t,i,{passive:r}):e.addEventListener(t,i,!1)}function Pu(e,t,i,s,r){var n=s;if(!(1&t||2&t||null===s))e:for(;;){if(null===s)return;var o=s.tag;if(3===o||4===o){var a=s.stateNode.containerInfo;if(a===r||8===a.nodeType&&a.parentNode===r)break;if(4===o)for(o=s.return;null!==o;){var l=o.tag;if((3===l||4===l)&&((l=o.stateNode.containerInfo)===r||8===l.nodeType&&l.parentNode===r))return;o=o.return}for(;null!==a;){if(null===(o=ad(a)))return;if(5===(l=o.tag)||6===l){s=n=o;continue e}a=a.parentNode}}s=s.return}yl(function(){var s=n,r=ul(i),o=[];e:{var a=bu.get(e);if(void 0!==a){var l=Qc,c=e;switch(e){case"keypress":if(0===$c(i))break e;case"keydown":case"keyup":l=vh;break;case"focusin":c="focus",l=nh;break;case"focusout":c="blur",l=nh;break;case"beforeblur":case"afterblur":l=nh;break;case"click":if(2===i.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":l=sh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":l=rh;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":l=_h;break;case gu:case vu:case mu:l=oh;break;case _u:l=bh;break;case"scroll":l=th;break;case"wheel":l=yh;break;case"copy":case"cut":case"paste":l=lh;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":l=mh}var h=!!(4&t),u=!h&&"scroll"===e,d=h?null!==a?a+"Capture":null:a;h=[];for(var f,p=s;null!==p;){var g=(f=p).stateNode;if(5===f.tag&&null!==g&&(f=g,null!==d&&(null!=(g=wl(p,d))&&h.push(Ru(p,g,f)))),u)break;p=p.return}0<h.length&&(a=new l(a,c,null,i,r),o.push({event:a,listeners:h}))}}if(!(7&t)){if(l="mouseout"===e||"pointerout"===e,(!(a="mouseover"===e||"pointerover"===e)||i===hl||!(c=i.relatedTarget||i.fromElement)||!ad(c)&&!c[sd])&&(l||a)&&(a=r.window===r?r:(a=r.ownerDocument)?a.defaultView||a.parentWindow:window,l?(l=s,null!==(c=(c=i.relatedTarget||i.toElement)?ad(c):null)&&(c!==(u=Ll(c))||5!==c.tag&&6!==c.tag)&&(c=null)):(l=null,c=s),l!==c)){if(h=sh,g="onMouseLeave",d="onMouseEnter",p="mouse","pointerout"!==e&&"pointerover"!==e||(h=mh,g="onPointerLeave",d="onPointerEnter",p="pointer"),u=null==l?a:cd(l),f=null==c?a:cd(c),(a=new h(g,p+"leave",l,i,r)).target=u,a.relatedTarget=f,g=null,ad(r)===s&&((h=new h(d,p+"enter",c,i,r)).target=f,h.relatedTarget=u,g=h),u=g,l&&c)e:{for(d=c,p=0,f=h=l;f;f=Tu(f))p++;for(f=0,g=d;g;g=Tu(g))f++;for(;0<p-f;)h=Tu(h),p--;for(;0<f-p;)d=Tu(d),f--;for(;p--;){if(h===d||null!==d&&h===d.alternate)break e;h=Tu(h),d=Tu(d)}h=null}else h=null;null!==l&&zu(o,a,l,h,!1),null!==c&&null!==u&&zu(o,u,c,h,!0)}if("select"===(l=(a=s?cd(s):window).nodeName&&a.nodeName.toLowerCase())||"input"===l&&"file"===a.type)var v=Ih;else if(Ph(a))if(Fh)v=Gh;else{v=Vh;var m=qh}else(l=a.nodeName)&&"input"===l.toLowerCase()&&("checkbox"===a.type||"radio"===a.type)&&(v=Yh);switch(v&&(v=v(e,s))?Rh(o,v,i,r):(m&&m(e,a,s),"focusout"===e&&(m=a._wrapperState)&&m.controlled&&"number"===a.type&&Ua(a,"number",a.value)),m=s?cd(s):window,e){case"focusin":(Ph(m)||"true"===m.contentEditable)&&(nu=m,ou=s,au=null);break;case"focusout":au=ou=nu=null;break;case"mousedown":lu=!0;break;case"contextmenu":case"mouseup":case"dragend":lu=!1,cu(o,i,r);break;case"selectionchange":if(ru)break;case"keydown":case"keyup":cu(o,i,r)}var _;if(Sh)e:{switch(e){case"compositionstart":var b="onCompositionStart";break e;case"compositionend":b="onCompositionEnd";break e;case"compositionupdate":b="onCompositionUpdate";break e}b=void 0}else Dh?Bh(e,i)&&(b="onCompositionEnd"):"keydown"===e&&229===i.keyCode&&(b="onCompositionStart");b&&(jh&&"ko"!==i.locale&&(Dh||"onCompositionStart"!==b?"onCompositionEnd"===b&&Dh&&(_=Uc()):(Wc="value"in(Hc=r)?Hc.value:Hc.textContent,Dh=!0)),0<(m=Au(s,b)).length&&(b=new ch(b,e,null,i,r),o.push({event:b,listeners:m}),_?b.data=_:null!==(_=Eh(i))&&(b.data=_))),(_=Ch?function(e,t){switch(e){case"compositionend":return Eh(t);case"keypress":return 32!==t.which?null:(Mh=!0,Nh);case"textInput":return(e=t.data)===Nh&&Mh?null:e;default:return null}}(e,i):function(e,t){if(Dh)return"compositionend"===e||!Sh&&Bh(e,t)?(e=Uc(),Kc=Wc=Hc=null,Dh=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return jh&&"ko"!==t.locale?null:t.data}}(e,i))&&(0<(s=Au(s,"onBeforeInput")).length&&(r=new ch("onBeforeInput","beforeinput",null,i,r),o.push({event:r,listeners:s}),r.data=_))}Nu(o,t)})}function Ru(e,t,i){return{instance:e,listener:t,currentTarget:i}}function Au(e,t){for(var i=t+"Capture",s=[];null!==e;){var r=e,n=r.stateNode;5===r.tag&&null!==n&&(r=n,null!=(n=wl(e,i))&&s.unshift(Ru(e,n,r)),null!=(n=wl(e,t))&&s.push(Ru(e,n,r))),e=e.return}return s}function Tu(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function zu(e,t,i,s,r){for(var n=t._reactName,o=[];null!==i&&i!==s;){var a=i,l=a.alternate,c=a.stateNode;if(null!==l&&l===s)break;5===a.tag&&null!==c&&(a=c,r?null!=(l=wl(i,n))&&o.unshift(Ru(i,l,a)):r||null!=(l=wl(i,n))&&o.push(Ru(i,l,a))),i=i.return}0!==o.length&&e.push({event:t,listeners:o})}var Ou=/\r\n?/g,Iu=/\u0000|\uFFFD/g;function Fu(e){return("string"==typeof e?e:""+e).replace(Ou,"\n").replace(Iu,"")}function Hu(e,t,i){if(t=Fu(t),Fu(e)!==t&&i)throw Error(Go(425))}function Wu(){}var Ku=null,Uu=null;function $u(e,t){return"textarea"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var qu="function"==typeof setTimeout?setTimeout:void 0,Vu="function"==typeof clearTimeout?clearTimeout:void 0,Yu="function"==typeof Promise?Promise:void 0,Gu="function"==typeof queueMicrotask?queueMicrotask:void 0!==Yu?function(e){return Yu.resolve(null).then(e).catch(Xu)}:qu;function Xu(e){setTimeout(function(){throw e})}function Zu(e,t){var i=t,s=0;do{var r=i.nextSibling;if(e.removeChild(i),r&&8===r.nodeType)if("/$"===(i=r.data)){if(0===s)return e.removeChild(r),void Lc(t);s--}else"$"!==i&&"$?"!==i&&"$!"!==i||s++;i=r}while(i);Lc(t)}function Ju(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t)break;if("/$"===t)return null}}return e}function Qu(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var i=e.data;if("$"===i||"$!"===i||"$?"===i){if(0===t)return e;t--}else"/$"===i&&t++}e=e.previousSibling}return null}var ed=Math.random().toString(36).slice(2),td="__reactFiber$"+ed,id="__reactProps$"+ed,sd="__reactContainer$"+ed,rd="__reactEvents$"+ed,nd="__reactListeners$"+ed,od="__reactHandles$"+ed;function ad(e){var t=e[td];if(t)return t;for(var i=e.parentNode;i;){if(t=i[sd]||i[td]){if(i=t.alternate,null!==t.child||null!==i&&null!==i.child)for(e=Qu(e);null!==e;){if(i=e[td])return i;e=Qu(e)}return t}i=(e=i).parentNode}return null}function ld(e){return!(e=e[td]||e[sd])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function cd(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(Go(33))}function hd(e){return e[id]||null}var ud=[],dd=-1;function fd(e){return{current:e}}function pd(e){0>dd||(e.current=ud[dd],ud[dd]=null,dd--)}function gd(e,t){dd++,ud[dd]=e.current,e.current=t}var vd={},md=fd(vd),_d=fd(!1),bd=vd;function xd(e,t){var i=e.type.contextTypes;if(!i)return vd;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===t)return s.__reactInternalMemoizedMaskedChildContext;var r,n={};for(r in i)n[r]=t[r];return s&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=n),n}function yd(e){return null!=(e=e.childContextTypes)}function wd(){pd(_d),pd(md)}function Sd(e,t,i){if(md.current!==vd)throw Error(Go(168));gd(md,t),gd(_d,i)}function kd(e,t,i){var s=e.stateNode;if(t=t.childContextTypes,"function"!=typeof s.getChildContext)return i;for(var r in s=s.getChildContext())if(!(r in t))throw Error(Go(108,Pa(e)||"Unknown",r));return Na({},i,s)}function Cd(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||vd,bd=md.current,gd(md,e),gd(_d,_d.current),!0}function jd(e,t,i){var s=e.stateNode;if(!s)throw Error(Go(169));i?(e=kd(e,t,bd),s.__reactInternalMemoizedMergedChildContext=e,pd(_d),pd(md),gd(md,e)):pd(_d),gd(_d,i)}var Nd=null,Md=!1,Bd=!1;function Ed(e){null===Nd?Nd=[e]:Nd.push(e)}function Dd(){if(!Bd&&null!==Nd){Bd=!0;var e=0,t=cc;try{var i=Nd;for(cc=1;e<i.length;e++){var s=i[e];do{s=s(!0)}while(null!==s)}Nd=null,Md=!1}catch(r){throw null!==Nd&&(Nd=Nd.slice(e+1)),zl(Kl,Dd),r}finally{cc=t,Bd=!1}}return null}var Ld=[],Pd=0,Rd=null,Ad=0,Td=[],zd=0,Od=null,Id=1,Fd="";function Hd(e,t){Ld[Pd++]=Ad,Ld[Pd++]=Rd,Rd=e,Ad=t}function Wd(e,t,i){Td[zd++]=Id,Td[zd++]=Fd,Td[zd++]=Od,Od=e;var s=Id;e=Fd;var r=32-Xl(s)-1;s&=~(1<<r),i+=1;var n=32-Xl(t)+r;if(30<n){var o=r-r%5;n=(s&(1<<o)-1).toString(32),s>>=o,r-=o,Id=1<<32-Xl(t)+r|i<<r|s,Fd=n+e}else Id=1<<n|i<<r|s,Fd=e}function Kd(e){null!==e.return&&(Hd(e,1),Wd(e,1,0))}function Ud(e){for(;e===Rd;)Rd=Ld[--Pd],Ld[Pd]=null,Ad=Ld[--Pd],Ld[Pd]=null;for(;e===Od;)Od=Td[--zd],Td[zd]=null,Fd=Td[--zd],Td[zd]=null,Id=Td[--zd],Td[zd]=null}var $d=null,qd=null,Vd=!1,Yd=null;function Gd(e,t){var i=xm(5,null,null,0);i.elementType="DELETED",i.stateNode=t,i.return=e,null===(t=e.deletions)?(e.deletions=[i],e.flags|=16):t.push(i)}function Xd(e,t){switch(e.tag){case 5:var i=e.type;return null!==(t=1!==t.nodeType||i.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,$d=e,qd=Ju(t.firstChild),!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,$d=e,qd=null,!0);case 13:return null!==(t=8!==t.nodeType?null:t)&&(i=null!==Od?{id:Id,overflow:Fd}:null,e.memoizedState={dehydrated:t,treeContext:i,retryLane:1073741824},(i=xm(18,null,null,0)).stateNode=t,i.return=e,e.child=i,$d=e,qd=null,!0);default:return!1}}function Zd(e){return!(!(1&e.mode)||128&e.flags)}function Jd(e){if(Vd){var t=qd;if(t){var i=t;if(!Xd(e,t)){if(Zd(e))throw Error(Go(418));t=Ju(i.nextSibling);var s=$d;t&&Xd(e,t)?Gd(s,i):(e.flags=-4097&e.flags|2,Vd=!1,$d=e)}}else{if(Zd(e))throw Error(Go(418));e.flags=-4097&e.flags|2,Vd=!1,$d=e}}}function Qd(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;$d=e}function ef(e){if(e!==$d)return!1;if(!Vd)return Qd(e),Vd=!0,!1;var t;if((t=3!==e.tag)&&!(t=5!==e.tag)&&(t="head"!==(t=e.type)&&"body"!==t&&!$u(e.type,e.memoizedProps)),t&&(t=qd)){if(Zd(e))throw tf(),Error(Go(418));for(;t;)Gd(e,t),t=Ju(t.nextSibling)}if(Qd(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(Go(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var i=e.data;if("/$"===i){if(0===t){qd=Ju(e.nextSibling);break e}t--}else"$"!==i&&"$!"!==i&&"$?"!==i||t++}e=e.nextSibling}qd=null}}else qd=$d?Ju(e.stateNode.nextSibling):null;return!0}function tf(){for(var e=qd;e;)e=Ju(e.nextSibling)}function sf(){qd=$d=null,Vd=!1}function rf(e){null===Yd?Yd=[e]:Yd.push(e)}var nf=ha.ReactCurrentBatchConfig;function of(e,t,i){if(null!==(e=i.ref)&&"function"!=typeof e&&"object"!=typeof e){if(i._owner){if(i=i._owner){if(1!==i.tag)throw Error(Go(309));var s=i.stateNode}if(!s)throw Error(Go(147,e));var r=s,n=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===n?t.ref:((t=function(e){var t=r.refs;null===e?delete t[n]:t[n]=e})._stringRef=n,t)}if("string"!=typeof e)throw Error(Go(284));if(!i._owner)throw Error(Go(290,e))}return e}function af(e,t){throw e=Object.prototype.toString.call(t),Error(Go(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function lf(e){return(0,e._init)(e._payload)}function cf(e){function t(t,i){if(e){var s=t.deletions;null===s?(t.deletions=[i],t.flags|=16):s.push(i)}}function i(i,s){if(!e)return null;for(;null!==s;)t(i,s),s=s.sibling;return null}function s(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function r(e,t){return(e=wm(e,t)).index=0,e.sibling=null,e}function n(t,i,s){return t.index=s,e?null!==(s=t.alternate)?(s=s.index)<i?(t.flags|=2,i):s:(t.flags|=2,i):(t.flags|=1048576,i)}function o(t){return e&&null===t.alternate&&(t.flags|=2),t}function a(e,t,i,s){return null===t||6!==t.tag?((t=jm(i,e.mode,s)).return=e,t):((t=r(t,i)).return=e,t)}function l(e,t,i,s){var n=i.type;return n===fa?h(e,t,i.props.children,s,i.key):null!==t&&(t.elementType===n||"object"==typeof n&&null!==n&&n.$$typeof===wa&&lf(n)===t.type)?((s=r(t,i.props)).ref=of(e,t,i),s.return=e,s):((s=Sm(i.type,i.key,i.props,null,e.mode,s)).ref=of(e,t,i),s.return=e,s)}function c(e,t,i,s){return null===t||4!==t.tag||t.stateNode.containerInfo!==i.containerInfo||t.stateNode.implementation!==i.implementation?((t=Nm(i,e.mode,s)).return=e,t):((t=r(t,i.children||[])).return=e,t)}function h(e,t,i,s,n){return null===t||7!==t.tag?((t=km(i,e.mode,s,n)).return=e,t):((t=r(t,i)).return=e,t)}function u(e,t,i){if("string"==typeof t&&""!==t||"number"==typeof t)return(t=jm(""+t,e.mode,i)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case ua:return(i=Sm(t.type,t.key,t.props,null,e.mode,i)).ref=of(e,null,t),i.return=e,i;case da:return(t=Nm(t,e.mode,i)).return=e,t;case wa:return u(e,(0,t._init)(t._payload),i)}if($a(t)||Ca(t))return(t=km(t,e.mode,i,null)).return=e,t;af(e,t)}return null}function d(e,t,i,s){var r=null!==t?t.key:null;if("string"==typeof i&&""!==i||"number"==typeof i)return null!==r?null:a(e,t,""+i,s);if("object"==typeof i&&null!==i){switch(i.$$typeof){case ua:return i.key===r?l(e,t,i,s):null;case da:return i.key===r?c(e,t,i,s):null;case wa:return d(e,t,(r=i._init)(i._payload),s)}if($a(i)||Ca(i))return null!==r?null:h(e,t,i,s,null);af(e,i)}return null}function f(e,t,i,s,r){if("string"==typeof s&&""!==s||"number"==typeof s)return a(t,e=e.get(i)||null,""+s,r);if("object"==typeof s&&null!==s){switch(s.$$typeof){case ua:return l(t,e=e.get(null===s.key?i:s.key)||null,s,r);case da:return c(t,e=e.get(null===s.key?i:s.key)||null,s,r);case wa:return f(e,t,i,(0,s._init)(s._payload),r)}if($a(s)||Ca(s))return h(t,e=e.get(i)||null,s,r,null);af(t,s)}return null}return function a(l,c,h,p){if("object"==typeof h&&null!==h&&h.type===fa&&null===h.key&&(h=h.props.children),"object"==typeof h&&null!==h){switch(h.$$typeof){case ua:e:{for(var g=h.key,v=c;null!==v;){if(v.key===g){if((g=h.type)===fa){if(7===v.tag){i(l,v.sibling),(c=r(v,h.props.children)).return=l,l=c;break e}}else if(v.elementType===g||"object"==typeof g&&null!==g&&g.$$typeof===wa&&lf(g)===v.type){i(l,v.sibling),(c=r(v,h.props)).ref=of(l,v,h),c.return=l,l=c;break e}i(l,v);break}t(l,v),v=v.sibling}h.type===fa?((c=km(h.props.children,l.mode,p,h.key)).return=l,l=c):((p=Sm(h.type,h.key,h.props,null,l.mode,p)).ref=of(l,c,h),p.return=l,l=p)}return o(l);case da:e:{for(v=h.key;null!==c;){if(c.key===v){if(4===c.tag&&c.stateNode.containerInfo===h.containerInfo&&c.stateNode.implementation===h.implementation){i(l,c.sibling),(c=r(c,h.children||[])).return=l,l=c;break e}i(l,c);break}t(l,c),c=c.sibling}(c=Nm(h,l.mode,p)).return=l,l=c}return o(l);case wa:return a(l,c,(v=h._init)(h._payload),p)}if($a(h))return function(r,o,a,l){for(var c=null,h=null,p=o,g=o=0,v=null;null!==p&&g<a.length;g++){p.index>g?(v=p,p=null):v=p.sibling;var m=d(r,p,a[g],l);if(null===m){null===p&&(p=v);break}e&&p&&null===m.alternate&&t(r,p),o=n(m,o,g),null===h?c=m:h.sibling=m,h=m,p=v}if(g===a.length)return i(r,p),Vd&&Hd(r,g),c;if(null===p){for(;g<a.length;g++)null!==(p=u(r,a[g],l))&&(o=n(p,o,g),null===h?c=p:h.sibling=p,h=p);return Vd&&Hd(r,g),c}for(p=s(r,p);g<a.length;g++)null!==(v=f(p,r,g,a[g],l))&&(e&&null!==v.alternate&&p.delete(null===v.key?g:v.key),o=n(v,o,g),null===h?c=v:h.sibling=v,h=v);return e&&p.forEach(function(e){return t(r,e)}),Vd&&Hd(r,g),c}(l,c,h,p);if(Ca(h))return function(r,o,a,l){var c=Ca(a);if("function"!=typeof c)throw Error(Go(150));if(null==(a=c.call(a)))throw Error(Go(151));for(var h=c=null,p=o,g=o=0,v=null,m=a.next();null!==p&&!m.done;g++,m=a.next()){p.index>g?(v=p,p=null):v=p.sibling;var _=d(r,p,m.value,l);if(null===_){null===p&&(p=v);break}e&&p&&null===_.alternate&&t(r,p),o=n(_,o,g),null===h?c=_:h.sibling=_,h=_,p=v}if(m.done)return i(r,p),Vd&&Hd(r,g),c;if(null===p){for(;!m.done;g++,m=a.next())null!==(m=u(r,m.value,l))&&(o=n(m,o,g),null===h?c=m:h.sibling=m,h=m);return Vd&&Hd(r,g),c}for(p=s(r,p);!m.done;g++,m=a.next())null!==(m=f(p,r,g,m.value,l))&&(e&&null!==m.alternate&&p.delete(null===m.key?g:m.key),o=n(m,o,g),null===h?c=m:h.sibling=m,h=m);return e&&p.forEach(function(e){return t(r,e)}),Vd&&Hd(r,g),c}(l,c,h,p);af(l,h)}return"string"==typeof h&&""!==h||"number"==typeof h?(h=""+h,null!==c&&6===c.tag?(i(l,c.sibling),(c=r(c,h)).return=l,l=c):(i(l,c),(c=jm(h,l.mode,p)).return=l,l=c),o(l)):i(l,c)}}var hf=cf(!0),uf=cf(!1),df=fd(null),ff=null,pf=null,gf=null;function vf(){gf=pf=ff=null}function mf(e){var t=df.current;pd(df),e._currentValue=t}function _f(e,t,i){for(;null!==e;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==s&&(s.childLanes|=t)):null!==s&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===i)break;e=e.return}}function bf(e,t){ff=e,gf=pf=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!==(e.lanes&t)&&(lg=!0),e.firstContext=null)}function xf(e){var t=e._currentValue;if(gf!==e)if(e={context:e,memoizedValue:t,next:null},null===pf){if(null===ff)throw Error(Go(308));pf=e,ff.dependencies={lanes:0,firstContext:e}}else pf=pf.next=e;return t}var yf=null;function wf(e){null===yf?yf=[e]:yf.push(e)}function Sf(e,t,i,s){var r=t.interleaved;return null===r?(i.next=i,wf(t)):(i.next=r.next,r.next=i),t.interleaved=i,kf(e,s)}function kf(e,t){e.lanes|=t;var i=e.alternate;for(null!==i&&(i.lanes|=t),i=e,e=e.return;null!==e;)e.childLanes|=t,null!==(i=e.alternate)&&(i.childLanes|=t),i=e,e=e.return;return 3===i.tag?i.stateNode:null}var Cf=!1;function jf(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Nf(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Mf(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Bf(e,t,i){var s=e.updateQueue;if(null===s)return null;if(s=s.shared,2&mv){var r=s.pending;return null===r?t.next=t:(t.next=r.next,r.next=t),s.pending=t,kf(e,i)}return null===(r=s.interleaved)?(t.next=t,wf(s)):(t.next=r.next,r.next=t),s.interleaved=t,kf(e,i)}function Ef(e,t,i){if(null!==(t=t.updateQueue)&&(t=t.shared,4194240&i)){var s=t.lanes;i|=s&=e.pendingLanes,t.lanes=i,lc(e,i)}}function Df(e,t){var i=e.updateQueue,s=e.alternate;if(null!==s&&i===(s=s.updateQueue)){var r=null,n=null;if(null!==(i=i.firstBaseUpdate)){do{var o={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};null===n?r=n=o:n=n.next=o,i=i.next}while(null!==i);null===n?r=n=t:n=n.next=t}else r=n=t;return i={baseState:s.baseState,firstBaseUpdate:r,lastBaseUpdate:n,shared:s.shared,effects:s.effects},void(e.updateQueue=i)}null===(e=i.lastBaseUpdate)?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}function Lf(e,t,i,s){var r=e.updateQueue;Cf=!1;var n=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(null!==a){r.shared.pending=null;var l=a,c=l.next;l.next=null,null===o?n=c:o.next=c,o=l;var h=e.alternate;null!==h&&((a=(h=h.updateQueue).lastBaseUpdate)!==o&&(null===a?h.firstBaseUpdate=c:a.next=c,h.lastBaseUpdate=l))}if(null!==n){var u=r.baseState;for(o=0,h=c=l=null,a=n;;){var d=a.lane,f=a.eventTime;if((s&d)===d){null!==h&&(h=h.next={eventTime:f,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var p=e,g=a;switch(d=t,f=i,g.tag){case 1:if("function"==typeof(p=g.payload)){u=p.call(f,u,d);break e}u=p;break e;case 3:p.flags=-65537&p.flags|128;case 0:if(null==(d="function"==typeof(p=g.payload)?p.call(f,u,d):p))break e;u=Na({},u,d);break e;case 2:Cf=!0}}null!==a.callback&&0!==a.lane&&(e.flags|=64,null===(d=r.effects)?r.effects=[a]:d.push(a))}else f={eventTime:f,lane:d,tag:a.tag,payload:a.payload,callback:a.callback,next:null},null===h?(c=h=f,l=u):h=h.next=f,o|=d;if(null===(a=a.next)){if(null===(a=r.shared.pending))break;a=(d=a).next,d.next=null,r.lastBaseUpdate=d,r.shared.pending=null}}if(null===h&&(l=u),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=h,null!==(t=r.shared.interleaved)){r=t;do{o|=r.lane,r=r.next}while(r!==t)}else null===n&&(r.shared.lanes=0);Cv|=o,e.lanes=o,e.memoizedState=u}}function Pf(e,t,i){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var s=e[t],r=s.callback;if(null!==r){if(s.callback=null,s=i,"function"!=typeof r)throw Error(Go(191,r));r.call(s)}}}var Rf={},Af=fd(Rf),Tf=fd(Rf),zf=fd(Rf);function Of(e){if(e===Rf)throw Error(Go(174));return e}function If(e,t){switch(gd(zf,t),gd(Tf,e),gd(Af,Rf),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Ja(null,"");break;default:t=Ja(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}pd(Af),gd(Af,t)}function Ff(){pd(Af),pd(Tf),pd(zf)}function Hf(e){Of(zf.current);var t=Of(Af.current),i=Ja(t,e.type);t!==i&&(gd(Tf,e),gd(Af,i))}function Wf(e){Tf.current===e&&(pd(Af),pd(Tf))}var Kf=fd(0);function Uf(e){for(var t=e;null!==t;){if(13===t.tag){var i=t.memoizedState;if(null!==i&&(null===(i=i.dehydrated)||"$?"===i.data||"$!"===i.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(128&t.flags)return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var $f=[];function qf(){for(var e=0;e<$f.length;e++)$f[e]._workInProgressVersionPrimary=null;$f.length=0}var Vf=ha.ReactCurrentDispatcher,Yf=ha.ReactCurrentBatchConfig,Gf=0,Xf=null,Zf=null,Jf=null,Qf=!1,ep=!1,tp=0,ip=0;function sp(){throw Error(Go(321))}function rp(e,t){if(null===t)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Xh(e[i],t[i]))return!1;return!0}function np(e,t,i,s,r,n){if(Gf=n,Xf=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Vf.current=null===e||null===e.memoizedState?Wp:Kp,e=i(s,r),ep){n=0;do{if(ep=!1,tp=0,25<=n)throw Error(Go(301));n+=1,Jf=Zf=null,t.updateQueue=null,Vf.current=Up,e=i(s,r)}while(ep)}if(Vf.current=Hp,t=null!==Zf&&null!==Zf.next,Gf=0,Jf=Zf=Xf=null,Qf=!1,t)throw Error(Go(300));return e}function op(){var e=0!==tp;return tp=0,e}function ap(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===Jf?Xf.memoizedState=Jf=e:Jf=Jf.next=e,Jf}function lp(){if(null===Zf){var e=Xf.alternate;e=null!==e?e.memoizedState:null}else e=Zf.next;var t=null===Jf?Xf.memoizedState:Jf.next;if(null!==t)Jf=t,Zf=e;else{if(null===e)throw Error(Go(310));e={memoizedState:(Zf=e).memoizedState,baseState:Zf.baseState,baseQueue:Zf.baseQueue,queue:Zf.queue,next:null},null===Jf?Xf.memoizedState=Jf=e:Jf=Jf.next=e}return Jf}function cp(e,t){return"function"==typeof t?t(e):t}function hp(e){var t=lp(),i=t.queue;if(null===i)throw Error(Go(311));i.lastRenderedReducer=e;var s=Zf,r=s.baseQueue,n=i.pending;if(null!==n){if(null!==r){var o=r.next;r.next=n.next,n.next=o}s.baseQueue=r=n,i.pending=null}if(null!==r){n=r.next,s=s.baseState;var a=o=null,l=null,c=n;do{var h=c.lane;if((Gf&h)===h)null!==l&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),s=c.hasEagerState?c.eagerState:e(s,c.action);else{var u={lane:h,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};null===l?(a=l=u,o=s):l=l.next=u,Xf.lanes|=h,Cv|=h}c=c.next}while(null!==c&&c!==n);null===l?o=s:l.next=a,Xh(s,t.memoizedState)||(lg=!0),t.memoizedState=s,t.baseState=o,t.baseQueue=l,i.lastRenderedState=s}if(null!==(e=i.interleaved)){r=e;do{n=r.lane,Xf.lanes|=n,Cv|=n,r=r.next}while(r!==e)}else null===r&&(i.lanes=0);return[t.memoizedState,i.dispatch]}function up(e){var t=lp(),i=t.queue;if(null===i)throw Error(Go(311));i.lastRenderedReducer=e;var s=i.dispatch,r=i.pending,n=t.memoizedState;if(null!==r){i.pending=null;var o=r=r.next;do{n=e(n,o.action),o=o.next}while(o!==r);Xh(n,t.memoizedState)||(lg=!0),t.memoizedState=n,null===t.baseQueue&&(t.baseState=n),i.lastRenderedState=n}return[n,s]}function dp(){}function fp(e,t){var i=Xf,s=lp(),r=t(),n=!Xh(s.memoizedState,r);if(n&&(s.memoizedState=r,lg=!0),s=s.queue,Cp(vp.bind(null,i,s,e),[e]),s.getSnapshot!==t||n||null!==Jf&&1&Jf.memoizedState.tag){if(i.flags|=2048,xp(9,gp.bind(null,i,s,r,t),void 0,null),null===_v)throw Error(Go(349));30&Gf||pp(i,t,r)}return r}function pp(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},null===(t=Xf.updateQueue)?(t={lastEffect:null,stores:null},Xf.updateQueue=t,t.stores=[e]):null===(i=t.stores)?t.stores=[e]:i.push(e)}function gp(e,t,i,s){t.value=i,t.getSnapshot=s,mp(t)&&_p(e)}function vp(e,t,i){return i(function(){mp(t)&&_p(e)})}function mp(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Xh(e,i)}catch(s){return!0}}function _p(e){var t=kf(e,1);null!==t&&$v(t,e,1,-1)}function bp(e){var t=ap();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:cp,lastRenderedState:e},t.queue=e,e=e.dispatch=zp.bind(null,Xf,e),[t.memoizedState,e]}function xp(e,t,i,s){return e={tag:e,create:t,destroy:i,deps:s,next:null},null===(t=Xf.updateQueue)?(t={lastEffect:null,stores:null},Xf.updateQueue=t,t.lastEffect=e.next=e):null===(i=t.lastEffect)?t.lastEffect=e.next=e:(s=i.next,i.next=e,e.next=s,t.lastEffect=e),e}function yp(){return lp().memoizedState}function wp(e,t,i,s){var r=ap();Xf.flags|=e,r.memoizedState=xp(1|t,i,void 0,void 0===s?null:s)}function Sp(e,t,i,s){var r=lp();s=void 0===s?null:s;var n=void 0;if(null!==Zf){var o=Zf.memoizedState;if(n=o.destroy,null!==s&&rp(s,o.deps))return void(r.memoizedState=xp(t,i,n,s))}Xf.flags|=e,r.memoizedState=xp(1|t,i,n,s)}function kp(e,t){return wp(8390656,8,e,t)}function Cp(e,t){return Sp(2048,8,e,t)}function jp(e,t){return Sp(4,2,e,t)}function Np(e,t){return Sp(4,4,e,t)}function Mp(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function Bp(e,t,i){return i=null!=i?i.concat([e]):null,Sp(4,4,Mp.bind(null,t,e),i)}function Ep(){}function Dp(e,t){var i=lp();t=void 0===t?null:t;var s=i.memoizedState;return null!==s&&null!==t&&rp(t,s[1])?s[0]:(i.memoizedState=[e,t],e)}function Lp(e,t){var i=lp();t=void 0===t?null:t;var s=i.memoizedState;return null!==s&&null!==t&&rp(t,s[1])?s[0]:(e=e(),i.memoizedState=[e,t],e)}function Pp(e,t,i){return 21&Gf?(Xh(i,t)||(i=nc(),Xf.lanes|=i,Cv|=i,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,lg=!0),e.memoizedState=i)}function Rp(e,t){var i=cc;cc=0!==i&&4>i?i:4,e(!0);var s=Yf.transition;Yf.transition={};try{e(!1),t()}finally{cc=i,Yf.transition=s}}function Ap(){return lp().memoizedState}function Tp(e,t,i){var s=Uv(e);if(i={lane:s,action:i,hasEagerState:!1,eagerState:null,next:null},Op(e))Ip(t,i);else if(null!==(i=Sf(e,t,i,s))){$v(i,e,s,Kv()),Fp(i,t,s)}}function zp(e,t,i){var s=Uv(e),r={lane:s,action:i,hasEagerState:!1,eagerState:null,next:null};if(Op(e))Ip(t,r);else{var n=e.alternate;if(0===e.lanes&&(null===n||0===n.lanes)&&null!==(n=t.lastRenderedReducer))try{var o=t.lastRenderedState,a=n(o,i);if(r.hasEagerState=!0,r.eagerState=a,Xh(a,o)){var l=t.interleaved;return null===l?(r.next=r,wf(t)):(r.next=l.next,l.next=r),void(t.interleaved=r)}}catch(c){}null!==(i=Sf(e,t,r,s))&&($v(i,e,s,r=Kv()),Fp(i,t,s))}}function Op(e){var t=e.alternate;return e===Xf||null!==t&&t===Xf}function Ip(e,t){ep=Qf=!0;var i=e.pending;null===i?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function Fp(e,t,i){if(4194240&i){var s=t.lanes;i|=s&=e.pendingLanes,t.lanes=i,lc(e,i)}}var Hp={readContext:xf,useCallback:sp,useContext:sp,useEffect:sp,useImperativeHandle:sp,useInsertionEffect:sp,useLayoutEffect:sp,useMemo:sp,useReducer:sp,useRef:sp,useState:sp,useDebugValue:sp,useDeferredValue:sp,useTransition:sp,useMutableSource:sp,useSyncExternalStore:sp,useId:sp,unstable_isNewReconciler:!1},Wp={readContext:xf,useCallback:function(e,t){return ap().memoizedState=[e,void 0===t?null:t],e},useContext:xf,useEffect:kp,useImperativeHandle:function(e,t,i){return i=null!=i?i.concat([e]):null,wp(4194308,4,Mp.bind(null,t,e),i)},useLayoutEffect:function(e,t){return wp(4194308,4,e,t)},useInsertionEffect:function(e,t){return wp(4,2,e,t)},useMemo:function(e,t){var i=ap();return t=void 0===t?null:t,e=e(),i.memoizedState=[e,t],e},useReducer:function(e,t,i){var s=ap();return t=void 0!==i?i(t):t,s.memoizedState=s.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},s.queue=e,e=e.dispatch=Tp.bind(null,Xf,e),[s.memoizedState,e]},useRef:function(e){return e={current:e},ap().memoizedState=e},useState:bp,useDebugValue:Ep,useDeferredValue:function(e){return ap().memoizedState=e},useTransition:function(){var e=bp(!1),t=e[0];return e=Rp.bind(null,e[1]),ap().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,i){var s=Xf,r=ap();if(Vd){if(void 0===i)throw Error(Go(407));i=i()}else{if(i=t(),null===_v)throw Error(Go(349));30&Gf||pp(s,t,i)}r.memoizedState=i;var n={value:i,getSnapshot:t};return r.queue=n,kp(vp.bind(null,s,n,e),[e]),s.flags|=2048,xp(9,gp.bind(null,s,n,i,t),void 0,null),i},useId:function(){var e=ap(),t=_v.identifierPrefix;if(Vd){var i=Fd;t=":"+t+"R"+(i=(Id&~(1<<32-Xl(Id)-1)).toString(32)+i),0<(i=tp++)&&(t+="H"+i.toString(32)),t+=":"}else t=":"+t+"r"+(i=ip++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Kp={readContext:xf,useCallback:Dp,useContext:xf,useEffect:Cp,useImperativeHandle:Bp,useInsertionEffect:jp,useLayoutEffect:Np,useMemo:Lp,useReducer:hp,useRef:yp,useState:function(){return hp(cp)},useDebugValue:Ep,useDeferredValue:function(e){return Pp(lp(),Zf.memoizedState,e)},useTransition:function(){return[hp(cp)[0],lp().memoizedState]},useMutableSource:dp,useSyncExternalStore:fp,useId:Ap,unstable_isNewReconciler:!1},Up={readContext:xf,useCallback:Dp,useContext:xf,useEffect:Cp,useImperativeHandle:Bp,useInsertionEffect:jp,useLayoutEffect:Np,useMemo:Lp,useReducer:up,useRef:yp,useState:function(){return up(cp)},useDebugValue:Ep,useDeferredValue:function(e){var t=lp();return null===Zf?t.memoizedState=e:Pp(t,Zf.memoizedState,e)},useTransition:function(){return[up(cp)[0],lp().memoizedState]},useMutableSource:dp,useSyncExternalStore:fp,useId:Ap,unstable_isNewReconciler:!1};function $p(e,t){if(e&&e.defaultProps){for(var i in t=Na({},t),e=e.defaultProps)void 0===t[i]&&(t[i]=e[i]);return t}return t}function qp(e,t,i,s){i=null==(i=i(s,t=e.memoizedState))?t:Na({},t,i),e.memoizedState=i,0===e.lanes&&(e.updateQueue.baseState=i)}var Vp={isMounted:function(e){return!!(e=e._reactInternals)&&Ll(e)===e},enqueueSetState:function(e,t,i){e=e._reactInternals;var s=Kv(),r=Uv(e),n=Mf(s,r);n.payload=t,null!=i&&(n.callback=i),null!==(t=Bf(e,n,r))&&($v(t,e,r,s),Ef(t,e,r))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var s=Kv(),r=Uv(e),n=Mf(s,r);n.tag=1,n.payload=t,null!=i&&(n.callback=i),null!==(t=Bf(e,n,r))&&($v(t,e,r,s),Ef(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Kv(),s=Uv(e),r=Mf(i,s);r.tag=2,null!=t&&(r.callback=t),null!==(t=Bf(e,r,s))&&($v(t,e,s,i),Ef(t,e,s))}};function Yp(e,t,i,s,r,n,o){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(s,n,o):!t.prototype||!t.prototype.isPureReactComponent||(!Zh(i,s)||!Zh(r,n))}function Gp(e,t,i){var s=!1,r=vd,n=t.contextType;return"object"==typeof n&&null!==n?n=xf(n):(r=yd(t)?bd:md.current,n=(s=null!=(s=t.contextTypes))?xd(e,r):vd),t=new t(i,n),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=Vp,e.stateNode=t,t._reactInternals=e,s&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=r,e.__reactInternalMemoizedMaskedChildContext=n),t}function Xp(e,t,i,s){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(i,s),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(i,s),t.state!==e&&Vp.enqueueReplaceState(t,t.state,null)}function Zp(e,t,i,s){var r=e.stateNode;r.props=i,r.state=e.memoizedState,r.refs={},jf(e);var n=t.contextType;"object"==typeof n&&null!==n?r.context=xf(n):(n=yd(t)?bd:md.current,r.context=xd(e,n)),r.state=e.memoizedState,"function"==typeof(n=t.getDerivedStateFromProps)&&(qp(e,t,n,i),r.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof r.getSnapshotBeforeUpdate||"function"!=typeof r.UNSAFE_componentWillMount&&"function"!=typeof r.componentWillMount||(t=r.state,"function"==typeof r.componentWillMount&&r.componentWillMount(),"function"==typeof r.UNSAFE_componentWillMount&&r.UNSAFE_componentWillMount(),t!==r.state&&Vp.enqueueReplaceState(r,r.state,null),Lf(e,i,r,s),r.state=e.memoizedState),"function"==typeof r.componentDidMount&&(e.flags|=4194308)}function Jp(e,t){try{var i="",s=t;do{i+=Da(s),s=s.return}while(s);var r=i}catch(n){r="\nError generating stack: "+n.message+"\n"+n.stack}return{value:e,source:t,stack:r,digest:null}}function Qp(e,t,i){return{value:e,source:null,stack:null!=i?i:null,digest:null!=t?t:null}}function eg(e,t){try{console.error(t.value)}catch(i){setTimeout(function(){throw i})}}var tg="function"==typeof WeakMap?WeakMap:Map;function ig(e,t,i){(i=Mf(-1,i)).tag=3,i.payload={element:null};var s=t.value;return i.callback=function(){Pv||(Pv=!0,Rv=s),eg(0,t)},i}function sg(e,t,i){(i=Mf(-1,i)).tag=3;var s=e.type.getDerivedStateFromError;if("function"==typeof s){var r=t.value;i.payload=function(){return s(r)},i.callback=function(){eg(0,t)}}var n=e.stateNode;return null!==n&&"function"==typeof n.componentDidCatch&&(i.callback=function(){eg(0,t),"function"!=typeof s&&(null===Av?Av=new Set([this]):Av.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),i}function rg(e,t,i){var s=e.pingCache;if(null===s){s=e.pingCache=new tg;var r=new Set;s.set(t,r)}else void 0===(r=s.get(t))&&(r=new Set,s.set(t,r));r.has(i)||(r.add(i),e=pm.bind(null,e,t,i),t.then(e,e))}function ng(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function og(e,t,i,s,r){return 1&e.mode?(e.flags|=65536,e.lanes=r,e):(e===t?e.flags|=65536:(e.flags|=128,i.flags|=131072,i.flags&=-52805,1===i.tag&&(null===i.alternate?i.tag=17:((t=Mf(-1,1)).tag=2,Bf(i,t,1))),i.lanes|=1),e)}var ag=ha.ReactCurrentOwner,lg=!1;function cg(e,t,i,s){t.child=null===e?uf(t,null,i,s):hf(t,e.child,i,s)}function hg(e,t,i,s,r){i=i.render;var n=t.ref;return bf(t,r),s=np(e,t,i,s,n,r),i=op(),null===e||lg?(Vd&&i&&Kd(t),t.flags|=1,cg(e,t,s,r),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r,Pg(e,t,r))}function ug(e,t,i,s,r){if(null===e){var n=i.type;return"function"!=typeof n||ym(n)||void 0!==n.defaultProps||null!==i.compare||void 0!==i.defaultProps?((e=Sm(i.type,null,s,t,t.mode,r)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=n,dg(e,t,n,s,r))}if(n=e.child,0===(e.lanes&r)){var o=n.memoizedProps;if((i=null!==(i=i.compare)?i:Zh)(o,s)&&e.ref===t.ref)return Pg(e,t,r)}return t.flags|=1,(e=wm(n,s)).ref=t.ref,e.return=t,t.child=e}function dg(e,t,i,s,r){if(null!==e){var n=e.memoizedProps;if(Zh(n,s)&&e.ref===t.ref){if(lg=!1,t.pendingProps=s=n,0===(e.lanes&r))return t.lanes=e.lanes,Pg(e,t,r);131072&e.flags&&(lg=!0)}}return gg(e,t,i,s,r)}function fg(e,t,i){var s=t.pendingProps,r=s.children,n=null!==e?e.memoizedState:null;if("hidden"===s.mode)if(1&t.mode){if(!(1073741824&i))return e=null!==n?n.baseLanes|i:i,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,gd(wv,yv),yv|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=null!==n?n.baseLanes:i,gd(wv,yv),yv|=s}else t.memoizedState={baseLanes:0,cachePool:null,transitions:null},gd(wv,yv),yv|=i;else null!==n?(s=n.baseLanes|i,t.memoizedState=null):s=i,gd(wv,yv),yv|=s;return cg(e,t,r,i),t.child}function pg(e,t){var i=t.ref;(null===e&&null!==i||null!==e&&e.ref!==i)&&(t.flags|=512,t.flags|=2097152)}function gg(e,t,i,s,r){var n=yd(i)?bd:md.current;return n=xd(t,n),bf(t,r),i=np(e,t,i,s,n,r),s=op(),null===e||lg?(Vd&&s&&Kd(t),t.flags|=1,cg(e,t,i,r),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r,Pg(e,t,r))}function vg(e,t,i,s,r){if(yd(i)){var n=!0;Cd(t)}else n=!1;if(bf(t,r),null===t.stateNode)Lg(e,t),Gp(t,i,s),Zp(t,i,s,r),s=!0;else if(null===e){var o=t.stateNode,a=t.memoizedProps;o.props=a;var l=o.context,c=i.contextType;"object"==typeof c&&null!==c?c=xf(c):c=xd(t,c=yd(i)?bd:md.current);var h=i.getDerivedStateFromProps,u="function"==typeof h||"function"==typeof o.getSnapshotBeforeUpdate;u||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(a!==s||l!==c)&&Xp(t,o,s,c),Cf=!1;var d=t.memoizedState;o.state=d,Lf(t,s,o,r),l=t.memoizedState,a!==s||d!==l||_d.current||Cf?("function"==typeof h&&(qp(t,i,h,s),l=t.memoizedState),(a=Cf||Yp(t,i,a,s,d,l,c))?(u||"function"!=typeof o.UNSAFE_componentWillMount&&"function"!=typeof o.componentWillMount||("function"==typeof o.componentWillMount&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount()),"function"==typeof o.componentDidMount&&(t.flags|=4194308)):("function"==typeof o.componentDidMount&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=l),o.props=s,o.state=l,o.context=c,s=a):("function"==typeof o.componentDidMount&&(t.flags|=4194308),s=!1)}else{o=t.stateNode,Nf(e,t),a=t.memoizedProps,c=t.type===t.elementType?a:$p(t.type,a),o.props=c,u=t.pendingProps,d=o.context,"object"==typeof(l=i.contextType)&&null!==l?l=xf(l):l=xd(t,l=yd(i)?bd:md.current);var f=i.getDerivedStateFromProps;(h="function"==typeof f||"function"==typeof o.getSnapshotBeforeUpdate)||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(a!==u||d!==l)&&Xp(t,o,s,l),Cf=!1,d=t.memoizedState,o.state=d,Lf(t,s,o,r);var p=t.memoizedState;a!==u||d!==p||_d.current||Cf?("function"==typeof f&&(qp(t,i,f,s),p=t.memoizedState),(c=Cf||Yp(t,i,c,s,d,p,l)||!1)?(h||"function"!=typeof o.UNSAFE_componentWillUpdate&&"function"!=typeof o.componentWillUpdate||("function"==typeof o.componentWillUpdate&&o.componentWillUpdate(s,p,l),"function"==typeof o.UNSAFE_componentWillUpdate&&o.UNSAFE_componentWillUpdate(s,p,l)),"function"==typeof o.componentDidUpdate&&(t.flags|=4),"function"==typeof o.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof o.componentDidUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!=typeof o.getSnapshotBeforeUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=p),o.props=s,o.state=p,o.context=l,s=c):("function"!=typeof o.componentDidUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!=typeof o.getSnapshotBeforeUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),s=!1)}return mg(e,t,i,s,n,r)}function mg(e,t,i,s,r,n){pg(e,t);var o=!!(128&t.flags);if(!s&&!o)return r&&jd(t,i,!1),Pg(e,t,n);s=t.stateNode,ag.current=t;var a=o&&"function"!=typeof i.getDerivedStateFromError?null:s.render();return t.flags|=1,null!==e&&o?(t.child=hf(t,e.child,null,n),t.child=hf(t,null,a,n)):cg(e,t,a,n),t.memoizedState=s.state,r&&jd(t,i,!0),t.child}function _g(e){var t=e.stateNode;t.pendingContext?Sd(0,t.pendingContext,t.pendingContext!==t.context):t.context&&Sd(0,t.context,!1),If(e,t.containerInfo)}function bg(e,t,i,s,r){return sf(),rf(r),t.flags|=256,cg(e,t,i,s),t.child}var xg,yg,wg,Sg,kg={dehydrated:null,treeContext:null,retryLane:0};function Cg(e){return{baseLanes:e,cachePool:null,transitions:null}}function jg(e,t,i){var s,r=t.pendingProps,n=Kf.current,o=!1,a=!!(128&t.flags);if((s=a)||(s=(null===e||null!==e.memoizedState)&&!!(2&n)),s?(o=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(n|=1),gd(Kf,1&n),null===e)return Jd(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(1&t.mode?"$!"===e.data?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=r.children,e=r.fallback,o?(r=t.mode,o=t.child,a={mode:"hidden",children:a},1&r||null===o?o=Cm(a,r,0,null):(o.childLanes=0,o.pendingProps=a),e=km(e,r,i,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=Cg(i),t.memoizedState=kg,e):Ng(t,a));if(null!==(n=e.memoizedState)&&null!==(s=n.dehydrated))return function(e,t,i,s,r,n,o){if(i)return 256&t.flags?(t.flags&=-257,Mg(e,t,o,s=Qp(Error(Go(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(n=s.fallback,r=t.mode,s=Cm({mode:"visible",children:s.children},r,0,null),(n=km(n,r,o,null)).flags|=2,s.return=t,n.return=t,s.sibling=n,t.child=s,1&t.mode&&hf(t,e.child,null,o),t.child.memoizedState=Cg(o),t.memoizedState=kg,n);if(!(1&t.mode))return Mg(e,t,o,null);if("$!"===r.data){if(s=r.nextSibling&&r.nextSibling.dataset)var a=s.dgst;return s=a,Mg(e,t,o,s=Qp(n=Error(Go(419)),s,void 0))}if(a=0!==(o&e.childLanes),lg||a){if(null!==(s=_v)){switch(o&-o){case 4:r=2;break;case 16:r=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:r=32;break;case 536870912:r=268435456;break;default:r=0}0!==(r=0!==(r&(s.suspendedLanes|o))?0:r)&&r!==n.retryLane&&(n.retryLane=r,kf(e,r),$v(s,e,r,-1))}return rm(),Mg(e,t,o,s=Qp(Error(Go(421))))}return"$?"===r.data?(t.flags|=128,t.child=e.child,t=vm.bind(null,e),r._reactRetry=t,null):(e=n.treeContext,qd=Ju(r.nextSibling),$d=t,Vd=!0,Yd=null,null!==e&&(Td[zd++]=Id,Td[zd++]=Fd,Td[zd++]=Od,Id=e.id,Fd=e.overflow,Od=t),t=Ng(t,s.children),t.flags|=4096,t)}(e,t,a,r,s,n,i);if(o){o=r.fallback,a=t.mode,s=(n=e.child).sibling;var l={mode:"hidden",children:r.children};return 1&a||t.child===n?(r=wm(n,l)).subtreeFlags=14680064&n.subtreeFlags:((r=t.child).childLanes=0,r.pendingProps=l,t.deletions=null),null!==s?o=wm(s,o):(o=km(o,a,i,null)).flags|=2,o.return=t,r.return=t,r.sibling=o,t.child=r,r=o,o=t.child,a=null===(a=e.child.memoizedState)?Cg(i):{baseLanes:a.baseLanes|i,cachePool:null,transitions:a.transitions},o.memoizedState=a,o.childLanes=e.childLanes&~i,t.memoizedState=kg,r}return e=(o=e.child).sibling,r=wm(o,{mode:"visible",children:r.children}),!(1&t.mode)&&(r.lanes=i),r.return=t,r.sibling=null,null!==e&&(null===(i=t.deletions)?(t.deletions=[e],t.flags|=16):i.push(e)),t.child=r,t.memoizedState=null,r}function Ng(e,t){return(t=Cm({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function Mg(e,t,i,s){return null!==s&&rf(s),hf(t,e.child,null,i),(e=Ng(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function Bg(e,t,i){e.lanes|=t;var s=e.alternate;null!==s&&(s.lanes|=t),_f(e.return,t,i)}function Eg(e,t,i,s,r){var n=e.memoizedState;null===n?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:i,tailMode:r}:(n.isBackwards=t,n.rendering=null,n.renderingStartTime=0,n.last=s,n.tail=i,n.tailMode=r)}function Dg(e,t,i){var s=t.pendingProps,r=s.revealOrder,n=s.tail;if(cg(e,t,s.children,i),2&(s=Kf.current))s=1&s|2,t.flags|=128;else{if(null!==e&&128&e.flags)e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&Bg(e,i,t);else if(19===e.tag)Bg(e,i,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}s&=1}if(gd(Kf,s),1&t.mode)switch(r){case"forwards":for(i=t.child,r=null;null!==i;)null!==(e=i.alternate)&&null===Uf(e)&&(r=i),i=i.sibling;null===(i=r)?(r=t.child,t.child=null):(r=i.sibling,i.sibling=null),Eg(t,!1,r,i,n);break;case"backwards":for(i=null,r=t.child,t.child=null;null!==r;){if(null!==(e=r.alternate)&&null===Uf(e)){t.child=r;break}e=r.sibling,r.sibling=i,i=r,r=e}Eg(t,!0,i,null,n);break;case"together":Eg(t,!1,null,null,void 0);break;default:t.memoizedState=null}else t.memoizedState=null;return t.child}function Lg(e,t){!(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Pg(e,t,i){if(null!==e&&(t.dependencies=e.dependencies),Cv|=t.lanes,0===(i&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(Go(153));if(null!==t.child){for(i=wm(e=t.child,e.pendingProps),t.child=i,i.return=t;null!==e.sibling;)e=e.sibling,(i=i.sibling=wm(e,e.pendingProps)).return=t;i.sibling=null}return t.child}function Rg(e,t){if(!Vd)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;null!==t;)null!==t.alternate&&(i=t),t=t.sibling;null===i?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var s=null;null!==i;)null!==i.alternate&&(s=i),i=i.sibling;null===s?t||null===e.tail?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Ag(e){var t=null!==e.alternate&&e.alternate.child===e.child,i=0,s=0;if(t)for(var r=e.child;null!==r;)i|=r.lanes|r.childLanes,s|=14680064&r.subtreeFlags,s|=14680064&r.flags,r.return=e,r=r.sibling;else for(r=e.child;null!==r;)i|=r.lanes|r.childLanes,s|=r.subtreeFlags,s|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=s,e.childLanes=i,t}function Tg(e,t,i){var s=t.pendingProps;switch(Ud(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ag(t),null;case 1:case 17:return yd(t.type)&&wd(),Ag(t),null;case 3:return s=t.stateNode,Ff(),pd(_d),pd(md),qf(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),null!==e&&null!==e.child||(ef(t)?t.flags|=4:null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,null!==Yd&&(Gv(Yd),Yd=null))),yg(e,t),Ag(t),null;case 5:Wf(t);var r=Of(zf.current);if(i=t.type,null!==e&&null!=t.stateNode)wg(e,t,i,s,r),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!s){if(null===t.stateNode)throw Error(Go(166));return Ag(t),null}if(e=Of(Af.current),ef(t)){s=t.stateNode,i=t.type;var n=t.memoizedProps;switch(s[td]=t,s[id]=n,e=!!(1&t.mode),i){case"dialog":Mu("cancel",s),Mu("close",s);break;case"iframe":case"object":case"embed":Mu("load",s);break;case"video":case"audio":for(r=0;r<ku.length;r++)Mu(ku[r],s);break;case"source":Mu("error",s);break;case"img":case"image":case"link":Mu("error",s),Mu("load",s);break;case"details":Mu("toggle",s);break;case"input":Fa(s,n),Mu("invalid",s);break;case"select":s._wrapperState={wasMultiple:!!n.multiple},Mu("invalid",s);break;case"textarea":Ya(s,n),Mu("invalid",s)}for(var o in ll(i,n),r=null,n)if(n.hasOwnProperty(o)){var a=n[o];"children"===o?"string"==typeof a?s.textContent!==a&&(!0!==n.suppressHydrationWarning&&Hu(s.textContent,a,e),r=["children",a]):"number"==typeof a&&s.textContent!==""+a&&(!0!==n.suppressHydrationWarning&&Hu(s.textContent,a,e),r=["children",""+a]):Zo.hasOwnProperty(o)&&null!=a&&"onScroll"===o&&Mu("scroll",s)}switch(i){case"input":Ta(s),Ka(s,n,!0);break;case"textarea":Ta(s),Xa(s);break;case"select":case"option":break;default:"function"==typeof n.onClick&&(s.onclick=Wu)}s=r,t.updateQueue=s,null!==s&&(t.flags|=4)}else{o=9===r.nodeType?r:r.ownerDocument,"http://www.w3.org/1999/xhtml"===e&&(e=Za(i)),"http://www.w3.org/1999/xhtml"===e?"script"===i?((e=o.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"==typeof s.is?e=o.createElement(i,{is:s.is}):(e=o.createElement(i),"select"===i&&(o=e,s.multiple?o.multiple=!0:s.size&&(o.size=s.size))):e=o.createElementNS(e,i),e[td]=t,e[id]=s,xg(e,t,!1,!1),t.stateNode=e;e:{switch(o=cl(i,s),i){case"dialog":Mu("cancel",e),Mu("close",e),r=s;break;case"iframe":case"object":case"embed":Mu("load",e),r=s;break;case"video":case"audio":for(r=0;r<ku.length;r++)Mu(ku[r],e);r=s;break;case"source":Mu("error",e),r=s;break;case"img":case"image":case"link":Mu("error",e),Mu("load",e),r=s;break;case"details":Mu("toggle",e),r=s;break;case"input":Fa(e,s),r=Ia(e,s),Mu("invalid",e);break;case"option":default:r=s;break;case"select":e._wrapperState={wasMultiple:!!s.multiple},r=Na({},s,{value:void 0}),Mu("invalid",e);break;case"textarea":Ya(e,s),r=Va(e,s),Mu("invalid",e)}for(n in ll(i,r),a=r)if(a.hasOwnProperty(n)){var l=a[n];"style"===n?ol(e,l):"dangerouslySetInnerHTML"===n?null!=(l=l?l.__html:void 0)&&tl(e,l):"children"===n?"string"==typeof l?("textarea"!==i||""!==l)&&il(e,l):"number"==typeof l&&il(e,""+l):"suppressContentEditableWarning"!==n&&"suppressHydrationWarning"!==n&&"autoFocus"!==n&&(Zo.hasOwnProperty(n)?null!=l&&"onScroll"===n&&Mu("scroll",e):null!=l&&ca(e,n,l,o))}switch(i){case"input":Ta(e),Ka(e,s,!1);break;case"textarea":Ta(e),Xa(e);break;case"option":null!=s.value&&e.setAttribute("value",""+Ra(s.value));break;case"select":e.multiple=!!s.multiple,null!=(n=s.value)?qa(e,!!s.multiple,n,!1):null!=s.defaultValue&&qa(e,!!s.multiple,s.defaultValue,!0);break;default:"function"==typeof r.onClick&&(e.onclick=Wu)}switch(i){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}}s&&(t.flags|=4)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return Ag(t),null;case 6:if(e&&null!=t.stateNode)Sg(e,t,e.memoizedProps,s);else{if("string"!=typeof s&&null===t.stateNode)throw Error(Go(166));if(i=Of(zf.current),Of(Af.current),ef(t)){if(s=t.stateNode,i=t.memoizedProps,s[td]=t,(n=s.nodeValue!==i)&&null!==(e=$d))switch(e.tag){case 3:Hu(s.nodeValue,i,!!(1&e.mode));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&Hu(s.nodeValue,i,!!(1&e.mode))}n&&(t.flags|=4)}else(s=(9===i.nodeType?i:i.ownerDocument).createTextNode(s))[td]=t,t.stateNode=s}return Ag(t),null;case 13:if(pd(Kf),s=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(Vd&&null!==qd&&1&t.mode&&!(128&t.flags))tf(),sf(),t.flags|=98560,n=!1;else if(n=ef(t),null!==s&&null!==s.dehydrated){if(null===e){if(!n)throw Error(Go(318));if(!(n=null!==(n=t.memoizedState)?n.dehydrated:null))throw Error(Go(317));n[td]=t}else sf(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;Ag(t),n=!1}else null!==Yd&&(Gv(Yd),Yd=null),n=!0;if(!n)return 65536&t.flags?t:null}return 128&t.flags?(t.lanes=i,t):((s=null!==s)!==(null!==e&&null!==e.memoizedState)&&s&&(t.child.flags|=8192,1&t.mode&&(null===e||1&Kf.current?0===Sv&&(Sv=3):rm())),null!==t.updateQueue&&(t.flags|=4),Ag(t),null);case 4:return Ff(),yg(e,t),null===e&&Du(t.stateNode.containerInfo),Ag(t),null;case 10:return mf(t.type._context),Ag(t),null;case 19:if(pd(Kf),null===(n=t.memoizedState))return Ag(t),null;if(s=!!(128&t.flags),null===(o=n.rendering))if(s)Rg(n,!1);else{if(0!==Sv||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(o=Uf(e))){for(t.flags|=128,Rg(n,!1),null!==(s=o.updateQueue)&&(t.updateQueue=s,t.flags|=4),t.subtreeFlags=0,s=i,i=t.child;null!==i;)e=s,(n=i).flags&=14680066,null===(o=n.alternate)?(n.childLanes=0,n.lanes=e,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=o.childLanes,n.lanes=o.lanes,n.child=o.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=o.memoizedProps,n.memoizedState=o.memoizedState,n.updateQueue=o.updateQueue,n.type=o.type,e=o.dependencies,n.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),i=i.sibling;return gd(Kf,1&Kf.current|2),t.child}e=e.sibling}null!==n.tail&&Hl()>Dv&&(t.flags|=128,s=!0,Rg(n,!1),t.lanes=4194304)}else{if(!s)if(null!==(e=Uf(o))){if(t.flags|=128,s=!0,null!==(i=e.updateQueue)&&(t.updateQueue=i,t.flags|=4),Rg(n,!0),null===n.tail&&"hidden"===n.tailMode&&!o.alternate&&!Vd)return Ag(t),null}else 2*Hl()-n.renderingStartTime>Dv&&1073741824!==i&&(t.flags|=128,s=!0,Rg(n,!1),t.lanes=4194304);n.isBackwards?(o.sibling=t.child,t.child=o):(null!==(i=n.last)?i.sibling=o:t.child=o,n.last=o)}return null!==n.tail?(t=n.tail,n.rendering=t,n.tail=t.sibling,n.renderingStartTime=Hl(),t.sibling=null,i=Kf.current,gd(Kf,s?1&i|2:1&i),t):(Ag(t),null);case 22:case 23:return em(),s=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==s&&(t.flags|=8192),s&&1&t.mode?!!(1073741824&yv)&&(Ag(t),6&t.subtreeFlags&&(t.flags|=8192)):Ag(t),null;case 24:case 25:return null}throw Error(Go(156,t.tag))}function zg(e,t){switch(Ud(t),t.tag){case 1:return yd(t.type)&&wd(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return Ff(),pd(_d),pd(md),qf(),65536&(e=t.flags)&&!(128&e)?(t.flags=-65537&e|128,t):null;case 5:return Wf(t),null;case 13:if(pd(Kf),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(Go(340));sf()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return pd(Kf),null;case 4:return Ff(),null;case 10:return mf(t.type._context),null;case 22:case 23:return em(),null;default:return null}}xg=function(e,t){for(var i=t.child;null!==i;){if(5===i.tag||6===i.tag)e.appendChild(i.stateNode);else if(4!==i.tag&&null!==i.child){i.child.return=i,i=i.child;continue}if(i===t)break;for(;null===i.sibling;){if(null===i.return||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}},yg=function(){},wg=function(e,t,i,s){var r=e.memoizedProps;if(r!==s){e=t.stateNode,Of(Af.current);var n,o=null;switch(i){case"input":r=Ia(e,r),s=Ia(e,s),o=[];break;case"select":r=Na({},r,{value:void 0}),s=Na({},s,{value:void 0}),o=[];break;case"textarea":r=Va(e,r),s=Va(e,s),o=[];break;default:"function"!=typeof r.onClick&&"function"==typeof s.onClick&&(e.onclick=Wu)}for(c in ll(i,s),i=null,r)if(!s.hasOwnProperty(c)&&r.hasOwnProperty(c)&&null!=r[c])if("style"===c){var a=r[c];for(n in a)a.hasOwnProperty(n)&&(i||(i={}),i[n]="")}else"dangerouslySetInnerHTML"!==c&&"children"!==c&&"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&"autoFocus"!==c&&(Zo.hasOwnProperty(c)?o||(o=[]):(o=o||[]).push(c,null));for(c in s){var l=s[c];if(a=null!=r?r[c]:void 0,s.hasOwnProperty(c)&&l!==a&&(null!=l||null!=a))if("style"===c)if(a){for(n in a)!a.hasOwnProperty(n)||l&&l.hasOwnProperty(n)||(i||(i={}),i[n]="");for(n in l)l.hasOwnProperty(n)&&a[n]!==l[n]&&(i||(i={}),i[n]=l[n])}else i||(o||(o=[]),o.push(c,i)),i=l;else"dangerouslySetInnerHTML"===c?(l=l?l.__html:void 0,a=a?a.__html:void 0,null!=l&&a!==l&&(o=o||[]).push(c,l)):"children"===c?"string"!=typeof l&&"number"!=typeof l||(o=o||[]).push(c,""+l):"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&(Zo.hasOwnProperty(c)?(null!=l&&"onScroll"===c&&Mu("scroll",e),o||a===l||(o=[])):(o=o||[]).push(c,l))}i&&(o=o||[]).push("style",i);var c=o;(t.updateQueue=c)&&(t.flags|=4)}},Sg=function(e,t,i,s){i!==s&&(t.flags|=4)};var Og=!1,Ig=!1,Fg="function"==typeof WeakSet?WeakSet:Set,Hg=null;function Wg(e,t){var i=e.ref;if(null!==i)if("function"==typeof i)try{i(null)}catch(s){fm(e,t,s)}else i.current=null}function Kg(e,t,i){try{i()}catch(s){fm(e,t,s)}}var Ug=!1;function $g(e,t,i){var s=t.updateQueue;if(null!==(s=null!==s?s.lastEffect:null)){var r=s=s.next;do{if((r.tag&e)===e){var n=r.destroy;r.destroy=void 0,void 0!==n&&Kg(t,i,n)}r=r.next}while(r!==s)}}function qg(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var i=t=t.next;do{if((i.tag&e)===e){var s=i.create;i.destroy=s()}i=i.next}while(i!==t)}}function Vg(e){var t=e.ref;if(null!==t){var i=e.stateNode;e.tag,e=i,"function"==typeof t?t(e):t.current=e}}function Yg(e){var t=e.alternate;null!==t&&(e.alternate=null,Yg(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&(delete t[td],delete t[id],delete t[rd],delete t[nd],delete t[od])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Gg(e){return 5===e.tag||3===e.tag||4===e.tag}function Xg(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||Gg(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function Zg(e,t,i){var s=e.tag;if(5===s||6===s)e=e.stateNode,t?8===i.nodeType?i.parentNode.insertBefore(e,t):i.insertBefore(e,t):(8===i.nodeType?(t=i.parentNode).insertBefore(e,i):(t=i).appendChild(e),null!=(i=i._reactRootContainer)||null!==t.onclick||(t.onclick=Wu));else if(4!==s&&null!==(e=e.child))for(Zg(e,t,i),e=e.sibling;null!==e;)Zg(e,t,i),e=e.sibling}function Jg(e,t,i){var s=e.tag;if(5===s||6===s)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(4!==s&&null!==(e=e.child))for(Jg(e,t,i),e=e.sibling;null!==e;)Jg(e,t,i),e=e.sibling}var Qg=null,ev=!1;function tv(e,t,i){for(i=i.child;null!==i;)iv(e,t,i),i=i.sibling}function iv(e,t,i){if(Gl&&"function"==typeof Gl.onCommitFiberUnmount)try{Gl.onCommitFiberUnmount(Yl,i)}catch(a){}switch(i.tag){case 5:Ig||Wg(i,t);case 6:var s=Qg,r=ev;Qg=null,tv(e,t,i),ev=r,null!==(Qg=s)&&(ev?(e=Qg,i=i.stateNode,8===e.nodeType?e.parentNode.removeChild(i):e.removeChild(i)):Qg.removeChild(i.stateNode));break;case 18:null!==Qg&&(ev?(e=Qg,i=i.stateNode,8===e.nodeType?Zu(e.parentNode,i):1===e.nodeType&&Zu(e,i),Lc(e)):Zu(Qg,i.stateNode));break;case 4:s=Qg,r=ev,Qg=i.stateNode.containerInfo,ev=!0,tv(e,t,i),Qg=s,ev=r;break;case 0:case 11:case 14:case 15:if(!Ig&&(null!==(s=i.updateQueue)&&null!==(s=s.lastEffect))){r=s=s.next;do{var n=r,o=n.destroy;n=n.tag,void 0!==o&&(2&n||4&n)&&Kg(i,t,o),r=r.next}while(r!==s)}tv(e,t,i);break;case 1:if(!Ig&&(Wg(i,t),"function"==typeof(s=i.stateNode).componentWillUnmount))try{s.props=i.memoizedProps,s.state=i.memoizedState,s.componentWillUnmount()}catch(a){fm(i,t,a)}tv(e,t,i);break;case 21:tv(e,t,i);break;case 22:1&i.mode?(Ig=(s=Ig)||null!==i.memoizedState,tv(e,t,i),Ig=s):tv(e,t,i);break;default:tv(e,t,i)}}function sv(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var i=e.stateNode;null===i&&(i=e.stateNode=new Fg),t.forEach(function(t){var s=mm.bind(null,e,t);i.has(t)||(i.add(t),t.then(s,s))})}}function rv(e,t){var i=t.deletions;if(null!==i)for(var s=0;s<i.length;s++){var r=i[s];try{var n=e,o=t,a=o;e:for(;null!==a;){switch(a.tag){case 5:Qg=a.stateNode,ev=!1;break e;case 3:case 4:Qg=a.stateNode.containerInfo,ev=!0;break e}a=a.return}if(null===Qg)throw Error(Go(160));iv(n,o,r),Qg=null,ev=!1;var l=r.alternate;null!==l&&(l.return=null),r.return=null}catch(c){fm(r,t,c)}}if(12854&t.subtreeFlags)for(t=t.child;null!==t;)nv(t,e),t=t.sibling}function nv(e,t){var i=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(rv(t,e),ov(e),4&s){try{$g(3,e,e.return),qg(3,e)}catch(Vw){fm(e,e.return,Vw)}try{$g(5,e,e.return)}catch(Vw){fm(e,e.return,Vw)}}break;case 1:rv(t,e),ov(e),512&s&&null!==i&&Wg(i,i.return);break;case 5:if(rv(t,e),ov(e),512&s&&null!==i&&Wg(i,i.return),32&e.flags){var r=e.stateNode;try{il(r,"")}catch(Vw){fm(e,e.return,Vw)}}if(4&s&&null!=(r=e.stateNode)){var n=e.memoizedProps,o=null!==i?i.memoizedProps:n,a=e.type,l=e.updateQueue;if(e.updateQueue=null,null!==l)try{"input"===a&&"radio"===n.type&&null!=n.name&&Ha(r,n),cl(a,o);var c=cl(a,n);for(o=0;o<l.length;o+=2){var h=l[o],u=l[o+1];"style"===h?ol(r,u):"dangerouslySetInnerHTML"===h?tl(r,u):"children"===h?il(r,u):ca(r,h,u,c)}switch(a){case"input":Wa(r,n);break;case"textarea":Ga(r,n);break;case"select":var d=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!n.multiple;var f=n.value;null!=f?qa(r,!!n.multiple,f,!1):d!==!!n.multiple&&(null!=n.defaultValue?qa(r,!!n.multiple,n.defaultValue,!0):qa(r,!!n.multiple,n.multiple?[]:"",!1))}r[id]=n}catch(Vw){fm(e,e.return,Vw)}}break;case 6:if(rv(t,e),ov(e),4&s){if(null===e.stateNode)throw Error(Go(162));r=e.stateNode,n=e.memoizedProps;try{r.nodeValue=n}catch(Vw){fm(e,e.return,Vw)}}break;case 3:if(rv(t,e),ov(e),4&s&&null!==i&&i.memoizedState.isDehydrated)try{Lc(t.containerInfo)}catch(Vw){fm(e,e.return,Vw)}break;case 4:default:rv(t,e),ov(e);break;case 13:rv(t,e),ov(e),8192&(r=e.child).flags&&(n=null!==r.memoizedState,r.stateNode.isHidden=n,!n||null!==r.alternate&&null!==r.alternate.memoizedState||(Ev=Hl())),4&s&&sv(e);break;case 22:if(h=null!==i&&null!==i.memoizedState,1&e.mode?(Ig=(c=Ig)||h,rv(t,e),Ig=c):rv(t,e),ov(e),8192&s){if(c=null!==e.memoizedState,(e.stateNode.isHidden=c)&&!h&&1&e.mode)for(Hg=e,h=e.child;null!==h;){for(u=Hg=h;null!==Hg;){switch(f=(d=Hg).child,d.tag){case 0:case 11:case 14:case 15:$g(4,d,d.return);break;case 1:Wg(d,d.return);var p=d.stateNode;if("function"==typeof p.componentWillUnmount){s=d,i=d.return;try{t=s,p.props=t.memoizedProps,p.state=t.memoizedState,p.componentWillUnmount()}catch(Vw){fm(s,i,Vw)}}break;case 5:Wg(d,d.return);break;case 22:if(null!==d.memoizedState){hv(u);continue}}null!==f?(f.return=d,Hg=f):hv(u)}h=h.sibling}e:for(h=null,u=e;;){if(5===u.tag){if(null===h){h=u;try{r=u.stateNode,c?"function"==typeof(n=r.style).setProperty?n.setProperty("display","none","important"):n.display="none":(a=u.stateNode,o=null!=(l=u.memoizedProps.style)&&l.hasOwnProperty("display")?l.display:null,a.style.display=nl("display",o))}catch(Vw){fm(e,e.return,Vw)}}}else if(6===u.tag){if(null===h)try{u.stateNode.nodeValue=c?"":u.memoizedProps}catch(Vw){fm(e,e.return,Vw)}}else if((22!==u.tag&&23!==u.tag||null===u.memoizedState||u===e)&&null!==u.child){u.child.return=u,u=u.child;continue}if(u===e)break e;for(;null===u.sibling;){if(null===u.return||u.return===e)break e;h===u&&(h=null),u=u.return}h===u&&(h=null),u.sibling.return=u.return,u=u.sibling}}break;case 19:rv(t,e),ov(e),4&s&&sv(e);case 21:}}function ov(e){var t=e.flags;if(2&t){try{e:{for(var i=e.return;null!==i;){if(Gg(i)){var s=i;break e}i=i.return}throw Error(Go(160))}switch(s.tag){case 5:var r=s.stateNode;32&s.flags&&(il(r,""),s.flags&=-33),Jg(e,Xg(e),r);break;case 3:case 4:var n=s.stateNode.containerInfo;Zg(e,Xg(e),n);break;default:throw Error(Go(161))}}catch(o){fm(e,e.return,o)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function av(e,t,i){Hg=e,lv(e)}function lv(e,t,i){for(var s=!!(1&e.mode);null!==Hg;){var r=Hg,n=r.child;if(22===r.tag&&s){var o=null!==r.memoizedState||Og;if(!o){var a=r.alternate,l=null!==a&&null!==a.memoizedState||Ig;a=Og;var c=Ig;if(Og=o,(Ig=l)&&!c)for(Hg=r;null!==Hg;)l=(o=Hg).child,22===o.tag&&null!==o.memoizedState?uv(r):null!==l?(l.return=o,Hg=l):uv(r);for(;null!==n;)Hg=n,lv(n),n=n.sibling;Hg=r,Og=a,Ig=c}cv(e)}else 8772&r.subtreeFlags&&null!==n?(n.return=r,Hg=n):cv(e)}}function cv(e){for(;null!==Hg;){var t=Hg;if(8772&t.flags){var i=t.alternate;try{if(8772&t.flags)switch(t.tag){case 0:case 11:case 15:Ig||qg(5,t);break;case 1:var s=t.stateNode;if(4&t.flags&&!Ig)if(null===i)s.componentDidMount();else{var r=t.elementType===t.type?i.memoizedProps:$p(t.type,i.memoizedProps);s.componentDidUpdate(r,i.memoizedState,s.__reactInternalSnapshotBeforeUpdate)}var n=t.updateQueue;null!==n&&Pf(t,n,s);break;case 3:var o=t.updateQueue;if(null!==o){if(i=null,null!==t.child)switch(t.child.tag){case 5:case 1:i=t.child.stateNode}Pf(t,o,i)}break;case 5:var a=t.stateNode;if(null===i&&4&t.flags){i=a;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&i.focus();break;case"img":l.src&&(i.src=l.src)}}break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:case 25:break;case 13:if(null===t.memoizedState){var c=t.alternate;if(null!==c){var h=c.memoizedState;if(null!==h){var u=h.dehydrated;null!==u&&Lc(u)}}}break;default:throw Error(Go(163))}Ig||512&t.flags&&Vg(t)}catch(vw){fm(t,t.return,vw)}}if(t===e){Hg=null;break}if(null!==(i=t.sibling)){i.return=t.return,Hg=i;break}Hg=t.return}}function hv(e){for(;null!==Hg;){var t=Hg;if(t===e){Hg=null;break}var i=t.sibling;if(null!==i){i.return=t.return,Hg=i;break}Hg=t.return}}function uv(e){for(;null!==Hg;){var t=Hg;try{switch(t.tag){case 0:case 11:case 15:var i=t.return;try{qg(4,t)}catch(l){fm(t,i,l)}break;case 1:var s=t.stateNode;if("function"==typeof s.componentDidMount){var r=t.return;try{s.componentDidMount()}catch(l){fm(t,r,l)}}var n=t.return;try{Vg(t)}catch(l){fm(t,n,l)}break;case 5:var o=t.return;try{Vg(t)}catch(l){fm(t,o,l)}}}catch(l){fm(t,t.return,l)}if(t===e){Hg=null;break}var a=t.sibling;if(null!==a){a.return=t.return,Hg=a;break}Hg=t.return}}var dv,fv=Math.ceil,pv=ha.ReactCurrentDispatcher,gv=ha.ReactCurrentOwner,vv=ha.ReactCurrentBatchConfig,mv=0,_v=null,bv=null,xv=0,yv=0,wv=fd(0),Sv=0,kv=null,Cv=0,jv=0,Nv=0,Mv=null,Bv=null,Ev=0,Dv=1/0,Lv=null,Pv=!1,Rv=null,Av=null,Tv=!1,zv=null,Ov=0,Iv=0,Fv=null,Hv=-1,Wv=0;function Kv(){return 6&mv?Hl():-1!==Hv?Hv:Hv=Hl()}function Uv(e){return 1&e.mode?2&mv&&0!==xv?xv&-xv:null!==nf.transition?(0===Wv&&(Wv=nc()),Wv):0!==(e=cc)?e:e=void 0===(e=window.event)?16:Fc(e.type):1}function $v(e,t,i,s){if(50<Iv)throw Iv=0,Fv=null,Error(Go(185));ac(e,i,s),2&mv&&e===_v||(e===_v&&(!(2&mv)&&(jv|=i),4===Sv&&Xv(e,xv)),qv(e,s),1===i&&0===mv&&!(1&t.mode)&&(Dv=Hl()+500,Md&&Dd()))}function qv(e,t){var i=e.callbackNode;!function(e,t){for(var i=e.suspendedLanes,s=e.pingedLanes,r=e.expirationTimes,n=e.pendingLanes;0<n;){var o=31-Xl(n),a=1<<o,l=r[o];-1===l?0!==(a&i)&&0===(a&s)||(r[o]=sc(a,t)):l<=t&&(e.expiredLanes|=a),n&=~a}}(e,t);var s=ic(e,e===_v?xv:0);if(0===s)null!==i&&Ol(i),e.callbackNode=null,e.callbackPriority=0;else if(t=s&-s,e.callbackPriority!==t){if(null!=i&&Ol(i),1===t)0===e.tag?function(e){Md=!0,Ed(e)}(Zv.bind(null,e)):Ed(Zv.bind(null,e)),Gu(function(){!(6&mv)&&Dd()}),i=null;else{switch(hc(s)){case 1:i=Kl;break;case 4:i=Ul;break;case 16:default:i=$l;break;case 536870912:i=Vl}i=_m(i,Vv.bind(null,e))}e.callbackPriority=t,e.callbackNode=i}}function Vv(e,t){if(Hv=-1,Wv=0,6&mv)throw Error(Go(327));var i=e.callbackNode;if(um()&&e.callbackNode!==i)return null;var s=ic(e,e===_v?xv:0);if(0===s)return null;if(30&s||0!==(s&e.expiredLanes)||t)t=nm(e,s);else{t=s;var r=mv;mv|=2;var n=sm();for(_v===e&&xv===t||(Lv=null,Dv=Hl()+500,tm(e,t));;)try{am();break}catch(a){im(e,a)}vf(),pv.current=n,mv=r,null!==bv?t=0:(_v=null,xv=0,t=Sv)}if(0!==t){if(2===t&&(0!==(r=rc(e))&&(s=r,t=Yv(e,r))),1===t)throw i=kv,tm(e,0),Xv(e,s),qv(e,Hl()),i;if(6===t)Xv(e,s);else{if(r=e.current.alternate,!(30&s||function(e){for(var t=e;;){if(16384&t.flags){var i=t.updateQueue;if(null!==i&&null!==(i=i.stores))for(var s=0;s<i.length;s++){var r=i[s],n=r.getSnapshot;r=r.value;try{if(!Xh(n(),r))return!1}catch(o){return!1}}}if(i=t.child,16384&t.subtreeFlags&&null!==i)i.return=t,t=i;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}(r)||(t=nm(e,s),2===t&&(n=rc(e),0!==n&&(s=n,t=Yv(e,n))),1!==t)))throw i=kv,tm(e,0),Xv(e,s),qv(e,Hl()),i;switch(e.finishedWork=r,e.finishedLanes=s,t){case 0:case 1:throw Error(Go(345));case 2:case 5:hm(e,Bv,Lv);break;case 3:if(Xv(e,s),(130023424&s)===s&&10<(t=Ev+500-Hl())){if(0!==ic(e,0))break;if(((r=e.suspendedLanes)&s)!==s){Kv(),e.pingedLanes|=e.suspendedLanes&r;break}e.timeoutHandle=qu(hm.bind(null,e,Bv,Lv),t);break}hm(e,Bv,Lv);break;case 4:if(Xv(e,s),(4194240&s)===s)break;for(t=e.eventTimes,r=-1;0<s;){var o=31-Xl(s);n=1<<o,(o=t[o])>r&&(r=o),s&=~n}if(s=r,10<(s=(120>(s=Hl()-s)?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*fv(s/1960))-s)){e.timeoutHandle=qu(hm.bind(null,e,Bv,Lv),s);break}hm(e,Bv,Lv);break;default:throw Error(Go(329))}}}return qv(e,Hl()),e.callbackNode===i?Vv.bind(null,e):null}function Yv(e,t){var i=Mv;return e.current.memoizedState.isDehydrated&&(tm(e,t).flags|=256),2!==(e=nm(e,t))&&(t=Bv,Bv=i,null!==t&&Gv(t)),e}function Gv(e){null===Bv?Bv=e:Bv.push.apply(Bv,e)}function Xv(e,t){for(t&=~Nv,t&=~jv,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var i=31-Xl(t),s=1<<i;e[i]=-1,t&=~s}}function Zv(e){if(6&mv)throw Error(Go(327));um();var t=ic(e,0);if(!(1&t))return qv(e,Hl()),null;var i=nm(e,t);if(0!==e.tag&&2===i){var s=rc(e);0!==s&&(t=s,i=Yv(e,s))}if(1===i)throw i=kv,tm(e,0),Xv(e,t),qv(e,Hl()),i;if(6===i)throw Error(Go(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,hm(e,Bv,Lv),qv(e,Hl()),null}function Jv(e,t){var i=mv;mv|=1;try{return e(t)}finally{0===(mv=i)&&(Dv=Hl()+500,Md&&Dd())}}function Qv(e){null!==zv&&0===zv.tag&&!(6&mv)&&um();var t=mv;mv|=1;var i=vv.transition,s=cc;try{if(vv.transition=null,cc=1,e)return e()}finally{cc=s,vv.transition=i,!(6&(mv=t))&&Dd()}}function em(){yv=wv.current,pd(wv)}function tm(e,t){e.finishedWork=null,e.finishedLanes=0;var i=e.timeoutHandle;if(-1!==i&&(e.timeoutHandle=-1,Vu(i)),null!==bv)for(i=bv.return;null!==i;){var s=i;switch(Ud(s),s.tag){case 1:null!=(s=s.type.childContextTypes)&&wd();break;case 3:Ff(),pd(_d),pd(md),qf();break;case 5:Wf(s);break;case 4:Ff();break;case 13:case 19:pd(Kf);break;case 10:mf(s.type._context);break;case 22:case 23:em()}i=i.return}if(_v=e,bv=e=wm(e.current,null),xv=yv=t,Sv=0,kv=null,Nv=jv=Cv=0,Bv=Mv=null,null!==yf){for(t=0;t<yf.length;t++)if(null!==(s=(i=yf[t]).interleaved)){i.interleaved=null;var r=s.next,n=i.pending;if(null!==n){var o=n.next;n.next=r,s.next=o}i.pending=s}yf=null}return e}function im(e,t){for(;;){var i=bv;try{if(vf(),Vf.current=Hp,Qf){for(var s=Xf.memoizedState;null!==s;){var r=s.queue;null!==r&&(r.pending=null),s=s.next}Qf=!1}if(Gf=0,Jf=Zf=Xf=null,ep=!1,tp=0,gv.current=null,null===i||null===i.return){Sv=1,kv=t,bv=null;break}e:{var n=e,o=i.return,a=i,l=t;if(t=xv,a.flags|=32768,null!==l&&"object"==typeof l&&"function"==typeof l.then){var c=l,h=a,u=h.tag;if(!(1&h.mode||0!==u&&11!==u&&15!==u)){var d=h.alternate;d?(h.updateQueue=d.updateQueue,h.memoizedState=d.memoizedState,h.lanes=d.lanes):(h.updateQueue=null,h.memoizedState=null)}var f=ng(o);if(null!==f){f.flags&=-257,og(f,o,a,0,t),1&f.mode&&rg(n,c,t),l=c;var p=(t=f).updateQueue;if(null===p){var g=new Set;g.add(l),t.updateQueue=g}else p.add(l);break e}if(!(1&t)){rg(n,c,t),rm();break e}l=Error(Go(426))}else if(Vd&&1&a.mode){var v=ng(o);if(null!==v){!(65536&v.flags)&&(v.flags|=256),og(v,o,a,0,t),rf(Jp(l,a));break e}}n=l=Jp(l,a),4!==Sv&&(Sv=2),null===Mv?Mv=[n]:Mv.push(n),n=o;do{switch(n.tag){case 3:n.flags|=65536,t&=-t,n.lanes|=t,Df(n,ig(0,l,t));break e;case 1:a=l;var m=n.type,_=n.stateNode;if(!(128&n.flags||"function"!=typeof m.getDerivedStateFromError&&(null===_||"function"!=typeof _.componentDidCatch||null!==Av&&Av.has(_)))){n.flags|=65536,t&=-t,n.lanes|=t,Df(n,sg(n,a,t));break e}}n=n.return}while(null!==n)}cm(i)}catch(b){t=b,bv===i&&null!==i&&(bv=i=i.return);continue}break}}function sm(){var e=pv.current;return pv.current=Hp,null===e?Hp:e}function rm(){0!==Sv&&3!==Sv&&2!==Sv||(Sv=4),null===_v||!(268435455&Cv)&&!(268435455&jv)||Xv(_v,xv)}function nm(e,t){var i=mv;mv|=2;var s=sm();for(_v===e&&xv===t||(Lv=null,tm(e,t));;)try{om();break}catch(r){im(e,r)}if(vf(),mv=i,pv.current=s,null!==bv)throw Error(Go(261));return _v=null,xv=0,Sv}function om(){for(;null!==bv;)lm(bv)}function am(){for(;null!==bv&&!Il();)lm(bv)}function lm(e){var t=dv(e.alternate,e,yv);e.memoizedProps=e.pendingProps,null===t?cm(e):bv=t,gv.current=null}function cm(e){var t=e;do{var i=t.alternate;if(e=t.return,32768&t.flags){if(null!==(i=zg(i,t)))return i.flags&=32767,void(bv=i);if(null===e)return Sv=6,void(bv=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}else if(null!==(i=Tg(i,t,yv)))return void(bv=i);if(null!==(t=t.sibling))return void(bv=t);bv=t=e}while(null!==t);0===Sv&&(Sv=5)}function hm(e,t,i){var s=cc,r=vv.transition;try{vv.transition=null,cc=1,function(e,t,i,s){do{um()}while(null!==zv);if(6&mv)throw Error(Go(327));i=e.finishedWork;var r=e.finishedLanes;if(null===i)return null;if(e.finishedWork=null,e.finishedLanes=0,i===e.current)throw Error(Go(177));e.callbackNode=null,e.callbackPriority=0;var n=i.lanes|i.childLanes;if(function(e,t){var i=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var s=e.eventTimes;for(e=e.expirationTimes;0<i;){var r=31-Xl(i),n=1<<r;t[r]=0,s[r]=-1,e[r]=-1,i&=~n}}(e,n),e===_v&&(bv=_v=null,xv=0),!(2064&i.subtreeFlags)&&!(2064&i.flags)||Tv||(Tv=!0,_m($l,function(){return um(),null})),n=!!(15990&i.flags),!!(15990&i.subtreeFlags)||n){n=vv.transition,vv.transition=null;var o=cc;cc=1;var a=mv;mv|=4,gv.current=null,function(e,t){if(Ku=Rc,iu(e=tu())){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{var s=(i=(i=e.ownerDocument)&&i.defaultView||window).getSelection&&i.getSelection();if(s&&0!==s.rangeCount){i=s.anchorNode;var r=s.anchorOffset,n=s.focusNode;s=s.focusOffset;try{i.nodeType,n.nodeType}catch(x){i=null;break e}var o=0,a=-1,l=-1,c=0,h=0,u=e,d=null;t:for(;;){for(var f;u!==i||0!==r&&3!==u.nodeType||(a=o+r),u!==n||0!==s&&3!==u.nodeType||(l=o+s),3===u.nodeType&&(o+=u.nodeValue.length),null!==(f=u.firstChild);)d=u,u=f;for(;;){if(u===e)break t;if(d===i&&++c===r&&(a=o),d===n&&++h===s&&(l=o),null!==(f=u.nextSibling))break;d=(u=d).parentNode}u=f}i=-1===a||-1===l?null:{start:a,end:l}}else i=null}i=i||{start:0,end:0}}else i=null;for(Uu={focusedElem:e,selectionRange:i},Rc=!1,Hg=t;null!==Hg;)if(e=(t=Hg).child,1028&t.subtreeFlags&&null!==e)e.return=t,Hg=e;else for(;null!==Hg;){t=Hg;try{var p=t.alternate;if(1024&t.flags)switch(t.tag){case 0:case 11:case 15:case 5:case 6:case 4:case 17:break;case 1:if(null!==p){var g=p.memoizedProps,v=p.memoizedState,m=t.stateNode,_=m.getSnapshotBeforeUpdate(t.elementType===t.type?g:$p(t.type,g),v);m.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var b=t.stateNode.containerInfo;1===b.nodeType?b.textContent="":9===b.nodeType&&b.documentElement&&b.removeChild(b.documentElement);break;default:throw Error(Go(163))}}catch(x){fm(t,t.return,x)}if(null!==(e=t.sibling)){e.return=t.return,Hg=e;break}Hg=t.return}p=Ug,Ug=!1}(e,i),nv(i,e),su(Uu),Rc=!!Ku,Uu=Ku=null,e.current=i,av(i),Fl(),mv=a,cc=o,vv.transition=n}else e.current=i;if(Tv&&(Tv=!1,zv=e,Ov=r),n=e.pendingLanes,0===n&&(Av=null),function(e){if(Gl&&"function"==typeof Gl.onCommitFiberRoot)try{Gl.onCommitFiberRoot(Yl,e,void 0,!(128&~e.current.flags))}catch(t){}}(i.stateNode),qv(e,Hl()),null!==t)for(s=e.onRecoverableError,i=0;i<t.length;i++)r=t[i],s(r.value,{componentStack:r.stack,digest:r.digest});if(Pv)throw Pv=!1,e=Rv,Rv=null,e;!!(1&Ov)&&0!==e.tag&&um(),n=e.pendingLanes,1&n?e===Fv?Iv++:(Iv=0,Fv=e):Iv=0,Dd()}(e,t,i,s)}finally{vv.transition=r,cc=s}return null}function um(){if(null!==zv){var e=hc(Ov),t=vv.transition,i=cc;try{if(vv.transition=null,cc=16>e?16:e,null===zv)var s=!1;else{if(e=zv,zv=null,Ov=0,6&mv)throw Error(Go(331));var r=mv;for(mv|=4,Hg=e.current;null!==Hg;){var n=Hg,o=n.child;if(16&Hg.flags){var a=n.deletions;if(null!==a){for(var l=0;l<a.length;l++){var c=a[l];for(Hg=c;null!==Hg;){var h=Hg;switch(h.tag){case 0:case 11:case 15:$g(8,h,n)}var u=h.child;if(null!==u)u.return=h,Hg=u;else for(;null!==Hg;){var d=(h=Hg).sibling,f=h.return;if(Yg(h),h===c){Hg=null;break}if(null!==d){d.return=f,Hg=d;break}Hg=f}}}var p=n.alternate;if(null!==p){var g=p.child;if(null!==g){p.child=null;do{var v=g.sibling;g.sibling=null,g=v}while(null!==g)}}Hg=n}}if(2064&n.subtreeFlags&&null!==o)o.return=n,Hg=o;else e:for(;null!==Hg;){if(2048&(n=Hg).flags)switch(n.tag){case 0:case 11:case 15:$g(9,n,n.return)}var m=n.sibling;if(null!==m){m.return=n.return,Hg=m;break e}Hg=n.return}}var _=e.current;for(Hg=_;null!==Hg;){var b=(o=Hg).child;if(2064&o.subtreeFlags&&null!==b)b.return=o,Hg=b;else e:for(o=_;null!==Hg;){if(2048&(a=Hg).flags)try{switch(a.tag){case 0:case 11:case 15:qg(9,a)}}catch(y){fm(a,a.return,y)}if(a===o){Hg=null;break e}var x=a.sibling;if(null!==x){x.return=a.return,Hg=x;break e}Hg=a.return}}if(mv=r,Dd(),Gl&&"function"==typeof Gl.onPostCommitFiberRoot)try{Gl.onPostCommitFiberRoot(Yl,e)}catch(y){}s=!0}return s}finally{cc=i,vv.transition=t}}return!1}function dm(e,t,i){e=Bf(e,t=ig(0,t=Jp(i,t),1),1),t=Kv(),null!==e&&(ac(e,1,t),qv(e,t))}function fm(e,t,i){if(3===e.tag)dm(e,e,i);else for(;null!==t;){if(3===t.tag){dm(t,e,i);break}if(1===t.tag){var s=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof s.componentDidCatch&&(null===Av||!Av.has(s))){t=Bf(t,e=sg(t,e=Jp(i,e),1),1),e=Kv(),null!==t&&(ac(t,1,e),qv(t,e));break}}t=t.return}}function pm(e,t,i){var s=e.pingCache;null!==s&&s.delete(t),t=Kv(),e.pingedLanes|=e.suspendedLanes&i,_v===e&&(xv&i)===i&&(4===Sv||3===Sv&&(130023424&xv)===xv&&500>Hl()-Ev?tm(e,0):Nv|=i),qv(e,t)}function gm(e,t){0===t&&(1&e.mode?(t=ec,!(130023424&(ec<<=1))&&(ec=4194304)):t=1);var i=Kv();null!==(e=kf(e,t))&&(ac(e,t,i),qv(e,i))}function vm(e){var t=e.memoizedState,i=0;null!==t&&(i=t.retryLane),gm(e,i)}function mm(e,t){var i=0;switch(e.tag){case 13:var s=e.stateNode,r=e.memoizedState;null!==r&&(i=r.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(Go(314))}null!==s&&s.delete(t),gm(e,i)}function _m(e,t){return zl(e,t)}function bm(e,t,i,s){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function xm(e,t,i,s){return new bm(e,t,i,s)}function ym(e){return!(!(e=e.prototype)||!e.isReactComponent)}function wm(e,t){var i=e.alternate;return null===i?((i=xm(e.tag,t,e.key,e.mode)).elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=14680064&e.flags,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i}function Sm(e,t,i,s,r,n){var o=2;if(s=e,"function"==typeof e)ym(e)&&(o=1);else if("string"==typeof e)o=5;else e:switch(e){case fa:return km(i.children,r,n,t);case pa:o=8,r|=8;break;case ga:return(e=xm(12,i,t,2|r)).elementType=ga,e.lanes=n,e;case ba:return(e=xm(13,i,t,r)).elementType=ba,e.lanes=n,e;case xa:return(e=xm(19,i,t,r)).elementType=xa,e.lanes=n,e;case Sa:return Cm(i,r,n,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case va:o=10;break e;case ma:o=9;break e;case _a:o=11;break e;case ya:o=14;break e;case wa:o=16,s=null;break e}throw Error(Go(130,null==e?e:typeof e,""))}return(t=xm(o,i,t,r)).elementType=e,t.type=s,t.lanes=n,t}function km(e,t,i,s){return(e=xm(7,e,s,t)).lanes=i,e}function Cm(e,t,i,s){return(e=xm(22,e,s,t)).elementType=Sa,e.lanes=i,e.stateNode={isHidden:!1},e}function jm(e,t,i){return(e=xm(6,e,null,t)).lanes=i,e}function Nm(e,t,i){return(t=xm(4,null!==e.children?e.children:[],e.key,t)).lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Mm(e,t,i,s,r){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=oc(0),this.expirationTimes=oc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=oc(0),this.identifierPrefix=s,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function Bm(e,t,i,s,r,n,o,a,l){return e=new Mm(e,t,i,a,l),1===t?(t=1,!0===n&&(t|=8)):t=0,n=xm(3,null,null,t),e.current=n,n.stateNode=e,n.memoizedState={element:s,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},jf(n),e}function Em(e){if(!e)return vd;e:{if(Ll(e=e._reactInternals)!==e||1!==e.tag)throw Error(Go(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(yd(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(Go(171))}if(1===e.tag){var i=e.type;if(yd(i))return kd(e,i,t)}return t}function Dm(e,t,i,s,r,n,o,a,l){return(e=Bm(i,s,!0,e,0,n,0,a,l)).context=Em(null),i=e.current,(n=Mf(s=Kv(),r=Uv(i))).callback=null!=t?t:null,Bf(i,n,r),e.current.lanes=r,ac(e,r,s),qv(e,s),e}function Lm(e,t,i,s){var r=t.current,n=Kv(),o=Uv(r);return i=Em(i),null===t.context?t.context=i:t.pendingContext=i,(t=Mf(n,o)).payload={element:e},null!==(s=void 0===s?null:s)&&(t.callback=s),null!==(e=Bf(r,t,o))&&($v(e,r,o,n),Ef(e,r,o)),o}function Pm(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function Rm(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var i=e.retryLane;e.retryLane=0!==i&&i<t?i:t}}function Am(e,t){Rm(e,t),(e=e.alternate)&&Rm(e,t)}dv=function(e,t,i){if(null!==e)if(e.memoizedProps!==t.pendingProps||_d.current)lg=!0;else{if(0===(e.lanes&i)&&!(128&t.flags))return lg=!1,function(e,t,i){switch(t.tag){case 3:_g(t),sf();break;case 5:Hf(t);break;case 1:yd(t.type)&&Cd(t);break;case 4:If(t,t.stateNode.containerInfo);break;case 10:var s=t.type._context,r=t.memoizedProps.value;gd(df,s._currentValue),s._currentValue=r;break;case 13:if(null!==(s=t.memoizedState))return null!==s.dehydrated?(gd(Kf,1&Kf.current),t.flags|=128,null):0!==(i&t.child.childLanes)?jg(e,t,i):(gd(Kf,1&Kf.current),null!==(e=Pg(e,t,i))?e.sibling:null);gd(Kf,1&Kf.current);break;case 19:if(s=0!==(i&t.childLanes),128&e.flags){if(s)return Dg(e,t,i);t.flags|=128}if(null!==(r=t.memoizedState)&&(r.rendering=null,r.tail=null,r.lastEffect=null),gd(Kf,Kf.current),s)break;return null;case 22:case 23:return t.lanes=0,fg(e,t,i)}return Pg(e,t,i)}(e,t,i);lg=!!(131072&e.flags)}else lg=!1,Vd&&1048576&t.flags&&Wd(t,Ad,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;Lg(e,t),e=t.pendingProps;var r=xd(t,md.current);bf(t,i),r=np(null,t,s,e,r,i);var n=op();return t.flags|=1,"object"==typeof r&&null!==r&&"function"==typeof r.render&&void 0===r.$$typeof?(t.tag=1,t.memoizedState=null,t.updateQueue=null,yd(s)?(n=!0,Cd(t)):n=!1,t.memoizedState=null!==r.state&&void 0!==r.state?r.state:null,jf(t),r.updater=Vp,t.stateNode=r,r._reactInternals=t,Zp(t,s,e,i),t=mg(null,t,s,!0,n,i)):(t.tag=0,Vd&&n&&Kd(t),cg(null,t,r,i),t=t.child),t;case 16:s=t.elementType;e:{switch(Lg(e,t),e=t.pendingProps,s=(r=s._init)(s._payload),t.type=s,r=t.tag=function(e){if("function"==typeof e)return ym(e)?1:0;if(null!=e){if((e=e.$$typeof)===_a)return 11;if(e===ya)return 14}return 2}(s),e=$p(s,e),r){case 0:t=gg(null,t,s,e,i);break e;case 1:t=vg(null,t,s,e,i);break e;case 11:t=hg(null,t,s,e,i);break e;case 14:t=ug(null,t,s,$p(s.type,e),i);break e}throw Error(Go(306,s,""))}return t;case 0:return s=t.type,r=t.pendingProps,gg(e,t,s,r=t.elementType===s?r:$p(s,r),i);case 1:return s=t.type,r=t.pendingProps,vg(e,t,s,r=t.elementType===s?r:$p(s,r),i);case 3:e:{if(_g(t),null===e)throw Error(Go(387));s=t.pendingProps,r=(n=t.memoizedState).element,Nf(e,t),Lf(t,s,null,i);var o=t.memoizedState;if(s=o.element,n.isDehydrated){if(n={element:s,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=n,t.memoizedState=n,256&t.flags){t=bg(e,t,s,i,r=Jp(Error(Go(423)),t));break e}if(s!==r){t=bg(e,t,s,i,r=Jp(Error(Go(424)),t));break e}for(qd=Ju(t.stateNode.containerInfo.firstChild),$d=t,Vd=!0,Yd=null,i=uf(t,null,s,i),t.child=i;i;)i.flags=-3&i.flags|4096,i=i.sibling}else{if(sf(),s===r){t=Pg(e,t,i);break e}cg(e,t,s,i)}t=t.child}return t;case 5:return Hf(t),null===e&&Jd(t),s=t.type,r=t.pendingProps,n=null!==e?e.memoizedProps:null,o=r.children,$u(s,r)?o=null:null!==n&&$u(s,n)&&(t.flags|=32),pg(e,t),cg(e,t,o,i),t.child;case 6:return null===e&&Jd(t),null;case 13:return jg(e,t,i);case 4:return If(t,t.stateNode.containerInfo),s=t.pendingProps,null===e?t.child=hf(t,null,s,i):cg(e,t,s,i),t.child;case 11:return s=t.type,r=t.pendingProps,hg(e,t,s,r=t.elementType===s?r:$p(s,r),i);case 7:return cg(e,t,t.pendingProps,i),t.child;case 8:case 12:return cg(e,t,t.pendingProps.children,i),t.child;case 10:e:{if(s=t.type._context,r=t.pendingProps,n=t.memoizedProps,o=r.value,gd(df,s._currentValue),s._currentValue=o,null!==n)if(Xh(n.value,o)){if(n.children===r.children&&!_d.current){t=Pg(e,t,i);break e}}else for(null!==(n=t.child)&&(n.return=t);null!==n;){var a=n.dependencies;if(null!==a){o=n.child;for(var l=a.firstContext;null!==l;){if(l.context===s){if(1===n.tag){(l=Mf(-1,i&-i)).tag=2;var c=n.updateQueue;if(null!==c){var h=(c=c.shared).pending;null===h?l.next=l:(l.next=h.next,h.next=l),c.pending=l}}n.lanes|=i,null!==(l=n.alternate)&&(l.lanes|=i),_f(n.return,i,t),a.lanes|=i;break}l=l.next}}else if(10===n.tag)o=n.type===t.type?null:n.child;else if(18===n.tag){if(null===(o=n.return))throw Error(Go(341));o.lanes|=i,null!==(a=o.alternate)&&(a.lanes|=i),_f(o,i,t),o=n.sibling}else o=n.child;if(null!==o)o.return=n;else for(o=n;null!==o;){if(o===t){o=null;break}if(null!==(n=o.sibling)){n.return=o.return,o=n;break}o=o.return}n=o}cg(e,t,r.children,i),t=t.child}return t;case 9:return r=t.type,s=t.pendingProps.children,bf(t,i),s=s(r=xf(r)),t.flags|=1,cg(e,t,s,i),t.child;case 14:return r=$p(s=t.type,t.pendingProps),ug(e,t,s,r=$p(s.type,r),i);case 15:return dg(e,t,t.type,t.pendingProps,i);case 17:return s=t.type,r=t.pendingProps,r=t.elementType===s?r:$p(s,r),Lg(e,t),t.tag=1,yd(s)?(e=!0,Cd(t)):e=!1,bf(t,i),Gp(t,s,r),Zp(t,s,r,i),mg(null,t,s,!0,e,i);case 19:return Dg(e,t,i);case 22:return fg(e,t,i)}throw Error(Go(156,t.tag))};var Tm="function"==typeof reportError?reportError:function(e){console.error(e)};function zm(e){this._internalRoot=e}function Om(e){this._internalRoot=e}function Im(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function Fm(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function Hm(){}function Wm(e,t,i,s,r){var n=i._reactRootContainer;if(n){var o=n;if("function"==typeof r){var a=r;r=function(){var e=Pm(o);a.call(e)}}Lm(t,o,e,r)}else o=function(e,t,i,s,r){if(r){if("function"==typeof s){var n=s;s=function(){var e=Pm(o);n.call(e)}}var o=Dm(t,s,e,0,null,!1,0,"",Hm);return e._reactRootContainer=o,e[sd]=o.current,Du(8===e.nodeType?e.parentNode:e),Qv(),o}for(;r=e.lastChild;)e.removeChild(r);if("function"==typeof s){var a=s;s=function(){var e=Pm(l);a.call(e)}}var l=Bm(e,0,!1,null,0,!1,0,"",Hm);return e._reactRootContainer=l,e[sd]=l.current,Du(8===e.nodeType?e.parentNode:e),Qv(function(){Lm(t,l,i,s)}),l}(i,t,e,r,s);return Pm(o)}Om.prototype.render=zm.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(Go(409));Lm(e,t,null,null)},Om.prototype.unmount=zm.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;Qv(function(){Lm(null,e,null,null)}),t[sd]=null}},Om.prototype.unstable_scheduleHydration=function(e){if(e){var t=pc();e={blockedOn:null,target:e,priority:t};for(var i=0;i<Sc.length&&0!==t&&t<Sc[i].priority;i++);Sc.splice(i,0,e),0===i&&Nc(e)}},uc=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var i=tc(t.pendingLanes);0!==i&&(lc(t,1|i),qv(t,Hl()),!(6&mv)&&(Dv=Hl()+500,Dd()))}break;case 13:Qv(function(){var t=kf(e,1);if(null!==t){var i=Kv();$v(t,e,1,i)}}),Am(e,1)}},dc=function(e){if(13===e.tag){var t=kf(e,134217728);if(null!==t)$v(t,e,134217728,Kv());Am(e,134217728)}},fc=function(e){if(13===e.tag){var t=Uv(e),i=kf(e,t);if(null!==i)$v(i,e,t,Kv());Am(e,t)}},pc=function(){return cc},gc=function(e,t){var i=cc;try{return cc=e,t()}finally{cc=i}},dl=function(e,t,i){switch(t){case"input":if(Wa(e,i),t=i.name,"radio"===i.type&&null!=t){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<i.length;t++){var s=i[t];if(s!==e&&s.form===e.form){var r=hd(s);if(!r)throw Error(Go(90));za(s),Wa(s,r)}}}break;case"textarea":Ga(e,i);break;case"select":null!=(t=i.value)&&qa(e,!!i.multiple,t,!1)}},_l=Jv,bl=Qv;var Km={usingClientEntryPoint:!1,Events:[ld,cd,hd,vl,ml,Jv]},Um={findFiberByHostInstance:ad,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},$m={bundleType:Um.bundleType,version:Um.version,rendererPackageName:Um.rendererPackageName,rendererConfig:Um.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ha.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=Al(e))?null:e.stateNode},findFiberByHostInstance:Um.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var qm=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!qm.isDisabled&&qm.supportsFiber)try{Yl=qm.inject($m),Gl=qm}catch(el){}}Ko.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Km,Ko.createPortal=function(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!Im(t))throw Error(Go(200));return function(e,t,i){var s=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:da,key:null==s?null:""+s,children:e,containerInfo:t,implementation:i}}(e,t,null,i)},Ko.createRoot=function(e,t){if(!Im(e))throw Error(Go(299));var i=!1,s="",r=Tm;return null!=t&&(!0===t.unstable_strictMode&&(i=!0),void 0!==t.identifierPrefix&&(s=t.identifierPrefix),void 0!==t.onRecoverableError&&(r=t.onRecoverableError)),t=Bm(e,1,!1,null,0,i,0,s,r),e[sd]=t.current,Du(8===e.nodeType?e.parentNode:e),new zm(t)},Ko.findDOMNode=function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(Go(188));throw e=Object.keys(e).join(","),Error(Go(268,e))}return e=null===(e=Al(t))?null:e.stateNode},Ko.flushSync=function(e){return Qv(e)},Ko.hydrate=function(e,t,i){if(!Fm(t))throw Error(Go(200));return Wm(null,e,t,!0,i)},Ko.hydrateRoot=function(e,t,i){if(!Im(e))throw Error(Go(405));var s=null!=i&&i.hydratedSources||null,r=!1,n="",o=Tm;if(null!=i&&(!0===i.unstable_strictMode&&(r=!0),void 0!==i.identifierPrefix&&(n=i.identifierPrefix),void 0!==i.onRecoverableError&&(o=i.onRecoverableError)),t=Dm(t,null,e,1,null!=i?i:null,r,0,n,o),e[sd]=t.current,Du(e),s)for(e=0;e<s.length;e++)r=(r=(i=s[e])._getVersion)(i._source),null==t.mutableSourceEagerHydrationData?t.mutableSourceEagerHydrationData=[i,r]:t.mutableSourceEagerHydrationData.push(i,r);return new Om(t)},Ko.render=function(e,t,i){if(!Fm(t))throw Error(Go(200));return Wm(null,e,t,!1,i)},Ko.unmountComponentAtNode=function(e){if(!Fm(e))throw Error(Go(40));return!!e._reactRootContainer&&(Qv(function(){Wm(null,null,e,!1,function(){e._reactRootContainer=null,e[sd]=null})}),!0)},Ko.unstable_batchedUpdates=Jv,Ko.unstable_renderSubtreeIntoContainer=function(e,t,i,s){if(!Fm(i))throw Error(Go(200));if(null==e||void 0===e._reactInternals)throw Error(Go(38));return Wm(e,t,i,!1,s)},Ko.version="18.3.1-next-f1338f8080-20240426",function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),Wo.exports=Ko;var Vm,Ym=Wo.exports,Gm=Ym;if(Vm=Gm.createRoot,Gm.hydrateRoot,!gi.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!function(e,t,i){return Po(function(){var s=go(e,i)[vs];null!=t||(t=function(e){return Ji(e,ds)||Ui(e,ds,ns({},e[ds])),e[ds]}(e)),Xi(t).forEach(function(e){return s.make_(e,t[e])})}),e})throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function Xm(e){e()}function Zm(e){return Sn(Do(e,t));var t}var Jm=function(){function e(e){var t=this;Object.defineProperty(this,"finalize",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"registrations",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"sweepTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sweep",{enumerable:!0,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=1e4),clearTimeout(t.sweepTimeout),t.sweepTimeout=void 0;var i=Date.now();t.registrations.forEach(function(s,r){i-s.registeredAt>=e&&(t.finalize(s.value),t.registrations.delete(r))}),t.registrations.size>0&&t.scheduleSweep()}}),Object.defineProperty(this,"finalizeAllImmediately",{enumerable:!0,configurable:!0,writable:!0,value:function(){t.sweep(0)}})}return Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i){this.registrations.set(i,{value:t,registeredAt:Date.now()}),this.scheduleSweep()}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.registrations.delete(e)}}),Object.defineProperty(e.prototype,"scheduleSweep",{enumerable:!1,configurable:!0,writable:!0,value:function(){void 0===this.sweepTimeout&&(this.sweepTimeout=setTimeout(this.sweep,1e4))}}),e}(),Qm=new("undefined"!=typeof FinalizationRegistry?FinalizationRegistry:Jm)(function(e){var t;null===(t=e.reaction)||void 0===t||t.dispose(),e.reaction=null}),e_={exports:{}},t_={},i_=gi;var s_="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r_=i_.useState,n_=i_.useEffect,o_=i_.useLayoutEffect,a_=i_.useDebugValue;function l_(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!s_(e,i)}catch(s){return!0}}var c_="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var i=t(),s=r_({inst:{value:i,getSnapshot:t}}),r=s[0].inst,n=s[1];return o_(function(){r.value=i,r.getSnapshot=t,l_(r)&&n({inst:r})},[e,i,t]),n_(function(){return l_(r)&&n({inst:r}),e(function(){l_(r)&&n({inst:r})})},[e]),a_(i),i};t_.useSyncExternalStore=void 0!==i_.useSyncExternalStore?i_.useSyncExternalStore:c_,e_.exports=t_;var h_,u_,d_=e_.exports;function f_(e){e.reaction=new Vr("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),null===(t=e.onStoreChange)||void 0===t||t.call(e)})}var p_="function"==typeof Symbol&&Symbol.for,g_=null!==(u_=null===(h_=Object.getOwnPropertyDescriptor(function(){},"name"))||void 0===h_?void 0:h_.configurable)&&void 0!==u_&&u_,v_=p_?Symbol.for("react.forward_ref"):"function"==typeof gi.forwardRef&&gi.forwardRef(function(e){return null}).$$typeof,m_=p_?Symbol.for("react.memo"):"function"==typeof gi.memo&&gi.memo(function(e){return null}).$$typeof;function __(e,t){if(m_&&e.$$typeof===m_)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");var i=!1,s=e,r=e.displayName||e.name;if(v_&&e.$$typeof===v_&&(i=!0,"function"!=typeof(s=e.render)))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var n,o,a=function(e,t){return function(e,t){void 0===t&&(t="observed");var i=vi.useRef(null);if(!i.current){var s={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(e){return Qm.unregister(s),s.onStoreChange=e,s.reaction||(f_(s),s.stateVersion=Symbol()),function(){var e;s.onStoreChange=null,null===(e=s.reaction)||void 0===e||e.dispose(),s.reaction=null}},getSnapshot:function(){return s.stateVersion}};i.current=s}var r,n,o=i.current;if(o.reaction||(f_(o),Qm.register(i,o,o)),vi.useDebugValue(o.reaction,Zm),d_.useSyncExternalStore(o.subscribe,o.getSnapshot,o.getSnapshot),o.reaction.track(function(){try{r=e()}catch(t){n=t}}),n)throw n;return r}(function(){return s(e,t)},r)};return a.displayName=e.displayName,g_&&Object.defineProperty(a,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(a.contextTypes=e.contextTypes),i&&(a=gi.forwardRef(a)),a=gi.memo(a),n=e,o=a,Object.keys(n).forEach(function(e){x_[e]||Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(n,e))}),a}var b_,x_={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};(b_=Ym.unstable_batchedUpdates)||(b_=Xm),yn({reactionScheduler:b_}),Qm.finalizeAllImmediately;const y_=gi.createContext(null);function w_(){const e=gi.useContext(y_);if(!e)throw new Error("useRootStore() called outside <StoreContext.Provider> — wrap the tree in main.tsx");return e}const S_=O_;!function(){const e=353,t=538,i=443,s=381,r=401,n=542,o=O_,a=lx();for(;;)try{if(778227===-parseInt(o(545))/1+parseInt(o(561))/2+parseInt(o(e))/3*(-parseInt(o(t))/4)+parseInt(o(511))/5+-parseInt(o(i))/6+parseInt(o(483))/7*(-parseInt(o(s))/8)+-parseInt(o(r))/9*(-parseInt(o(n))/10))break;a.push(a.shift())}catch(l){a.push(a.shift())}}();var k_=Object[S_(510)],C_=(e,t)=>k_(e,S_(634),{value:t,configurable:!0});function j_(e){return typeof e===S_(391)&&null!==e&&!Array.isArray(e)}C_(function(e){const t=512,i=537,s=415,r=S_,n=e[r(555)]();if(!n[r(t)]("{"))return null;try{const e=JSON[r(487)](n);return e[r(537)]===r(568)||e[r(i)]===r(609)||e[r(537)]===r(s)?e:null}catch{return null}},S_(367)),C_(j_,S_(517));var N_=S_(333),M_=S_(566);S_(403);var B_=S_(585),E_=S_(488);function D_(e,t){return""+E_+e+(t?"."+t:"")}S_(582),C_(function(e){return""+M_+e},S_(434)),C_(D_,S_(540)),C_(function(e){const t=S_;return e===E_||e[t(512)](E_+"-")||e[t(512)](E_+".")},S_(624)),C_(function(e){return S_(608)+e},S_(377)),C_(function(e){const t=S_;return N_+t(496)+e+t(355)},"debuggerFileFor"),S_(351),S_(461),S_(610),S_(605),S_(611),S_(573),S_(598);var L_=S_(544),P_=S_(489),R_=S_(392);function A_(e,t,i){const s=600,r=S_,n=[e];return t&&n[r(600)](""+e+t),i&&(n[r(s)](e+"."+i),t&&n[r(600)](""+e+t+"."+i)),n}S_(454),C_(function(e,t){return""+P_+e+(t?"."+t:"")},"envFileFor"),C_(function(e,t){return""+R_+e+(t?"."+t:"")},"secretsFileFor"),C_(function(e,t){return A_(P_,e,t)},"envLayerFilesFor"),C_(function(e,t){return A_(R_,e,t)},S_(603)),C_(A_,S_(557));var T_=S_(321);C_(function(e,t){var i;const s=null==(i=e[T_])?void 0:i.trim();return s||t},S_(547)),C_(function(e){var t;const i=555,s=S_,r=null==(t=e[s(412)])?void 0:t[s(i)]();return r||void 0},S_(569));var z_=new Set([S_(323),"sample","template"]);C_(function(e,t){const i=486,s=620,r=453,n=459,o=S_,a=[o(363),".secrets"][o(i)](e=>t?[e,""+e+t]:[e]),l=new Set;for(const c of e)for(const e of a){const t=e+".";if(!c.startsWith(t))continue;const i=c[o(s)](t[o(578)]);i&&!i[o(565)]("/")&&(z_.has(i)||l[o(r)](i))}return[...l][o(n)]()},S_(584)),C_(function(e){const t=470,i=586,s=S_;return typeof e===s(391)&&null!==e&&e[s(537)]===s(t)&&typeof e[s(347)]===s(513)&&typeof e[s(i)]===s(513)},"isRegexLiteral"),C_(function(e,t=""){return{kind:S_(470),source:e,flags:t}},S_(406));function O_(e,t){e-=314;const i=lx();let s=i[e];if(void 0===O_.XGvXBH){O_.liVsGr=function(e){let t="",i="";for(let s,r,n=0,o=0;r=e.charAt(o++);~r&&(s=n%4?64*s+r:r,n++%4)?t+=String.fromCharCode(255&s>>(-2*n&6)):0)r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=".indexOf(r);for(let s=0,r=t.length;s<r;s++)i+="%"+("00"+t.charCodeAt(s).toString(16)).slice(-2);return decodeURIComponent(i)},O_.OPQzpl={},O_.XGvXBH=!0}const r=e+i[0],n=O_.OPQzpl[r];return n?s=n:(s=O_.liVsGr(s),O_.OPQzpl[r]=s),s}function I_(e){const t=431,i=S_,s=e.replace(/[^a-zA-Z0-9_-]+/g,"-")[i(t)](/-+/g,"-")[i(t)](/^-|-$/g,"");return s[i(578)]>0?s:"run"}C_(function(e){const t=371,i=571,s=578,r=S_,n=I_(e),o=Date.now()[r(t)](36),a=new Uint8Array(6);globalThis[r(i)][r(408)](a);let l="";for(let c=0;c<a[r(s)];c++)l+=a[c][r(371)](16)[r(497)](2,"0");return n+"-"+o+"-"+l},S_(549)),C_(I_,S_(633));var F_=/^[0-9a-f]{6,}$/,H_=Date[S_(383)](2020,0,1),W_=Date[S_(383)](2100,0,1);function K_(e){const t=578,i=576,s=S_,r=e.split("-");if(r[s(t)]<3)return null;const n=r[r.length-1];if(!F_[s(i)](n))return null;const o=r[r[s(578)]-2];if(!/^[0-9a-z]+$/[s(i)](o))return null;const a=parseInt(o,36);return Number.isFinite(a)?a<H_||a>=W_?null:a:null}function U_(e){const t=497,i=410,s=S_,r=new Date(e);return String(r[s(423)]())[s(t)](4,"0")+"/"+String(r[s(i)]()+1).padStart(2,"0")+"/"+String(r[s(625)]())[s(497)](2,"0")}function $_(e){const t=K_(e);return null===t?null:U_(t)}function q_(e,t){const i=$_(t);return null===i?null:e+"/"+i+"/"+t}C_(K_,S_(507)),C_(U_,S_(414)),C_($_,"shardPathForRunId"),C_(q_,"runDirFor");var V_=(C_(e=class extends Error{constructor(e){const t=S_;super("runId carries no timestamp, cannot place it in a shard: "+e),this[t(634)]="UnplaceableRunIdError"}},"UnplaceableRunIdError"),e);function Y_(e,t){const i=q_(e,t);if(null===i)throw new V_(t);return i}function G_(e="",t){return N_+"/"+D_(e,t)}function X_(e,t){return e+"/"+U_(t)}function Z_(e){const t=S_;return e===t(329)||e===t(469)}C_(Y_,S_(399)),C_(G_,S_(590)),C_(function(e,t="",i){return Y_(G_(t,i),e)},S_(527)),C_(X_,S_(339)),C_(function*(e,t,i){const s=864e5;let r=Math.floor(t/s)*s;for(let n=0;n<i;n++)yield X_(e,r),r-=s},S_(498)),C_(Z_,"isFailingStatus"),C_(function(e,t){const i=384,s=318,r=471,n=318,o=361,a=S_,l={lastRunId:t[a(374)],lastStatus:t[a(i)],lastAt:t[a(s)],lastDurationMs:t[a(444)],recent:[...(null==e?void 0:e.recent)??[],t[a(i)]][a(620)](-12)};if(!Z_(t[a(i)]))return{...l,failStreak:0,failingSince:null};const c=((null==e?void 0:e[a(r)])??0)+1;return{...l,failStreak:c,failingSince:1===c?t[a(n)]:(null==e?void 0:e[a(o)])??t[a(318)]}},S_(382)),C_(function(e){const t=S_;return encodeURIComponent(e)+t(515)},"scenarioIndexFileName"),C_(function(e){const t=515,i=515,s=S_;if(!e.endsWith(s(t)))return null;try{return decodeURIComponent(e.slice(0,-s(i).length))}catch{return null}},S_(425));var J_=[S_(450),"gitlab",S_(464)],Q_=[S_(417),S_(440),S_(349),"unknown-bundle",S_(422),S_(601),S_(359)];function eb(e){return J_[S_(565)](e)?e:null}C_(function(e){const t=578,i=447,s=526,r=513,n=S_;if(!j_(e))return null;const{bundleId:o,environment:a,collections:l,pr:c,branch:h,sha:u}=e;if(typeof o!==n(513)||0===o[n(578)])return null;if(typeof a!==n(513)||0===a[n(t)])return null;let d=null;if(void 0!==l){if(!Array.isArray(l))return null;if(l.some(e=>"string"!=typeof e||0===e[n(578)]))return null;d=l}if(void 0!==c&&(typeof c!==n(i)||!Number[n(s)](c)))return null;for(const f of[h,u])if(void 0!==f&&typeof f!==n(r))return null;return{bundleId:o,environment:a,...d?{collections:d}:{},...typeof c===n(i)?{pr:c}:{},...typeof h===n(r)?{branch:h}:{},...typeof u===n(r)?{sha:u}:{}}},S_(346)),C_(function(e){const t=522,i=340,s=513,r=513,n=447,o=S_;if(!j_(e))return null;if(j_(e[o(522)])){const{code:i,message:s}=e[o(t)];return Q_[o(565)](i)?"string"!=typeof s?null:{error:{code:i,message:s}}:null}const{status:a,bundleId:l,environment:c,runs:h,superseded:u}=e;if(a!==o(i))return null;if(typeof l!==o(s)||"string"!=typeof c)return null;if(!Array.isArray(h))return null;const d=[];for(const f of h){if(!j_(f))return null;const{runId:e,collection:t}=f;if(typeof e!==o(513)||typeof t!==o(r))return null;d[o(600)]({runId:e,collection:t})}return void 0!==u&&typeof u!==o(n)?null:{status:o(340),bundleId:l,environment:c,runs:d,...typeof u===o(447)?{superseded:u}:{}}},S_(428)),C_(eb,S_(462));var tb=S_(338);S_(473),S_(433),S_(317),S_(463),S_(336);function ib(e,t){return""+tb+e+(t?"."+t:"")}C_(ib,S_(429)),C_(function(e){const t=S_;return e===tb||e.startsWith(tb+"-")||e[t(512)](tb+".")},S_(532)),C_(function(e="",t){return N_+"/"+ib(e,t)},S_(543));var sb=Object[S_(350)]({maintenance:0,interactive:1,ci:2,schedule:3}),rb=[S_(595),S_(360),"ci",S_(523)],nb=rb;function ob(e){return sb[e]}function ab(e){return rb[e]??null}function lb(e){const t=364,i=322,s=520,r=S_,n=e[r(364)]?"@"+e[r(t)][r(620)](0,7):"";return void 0!==e.pr?r(442)+e.pr+n:void 0!==e[r(i)]?""+e.branch+n:n.length>0?n[r(620)](1):e[r(s)]}C_(ob,S_(466)),C_(ab,"queuePriorityFromRank"),C_(lb,S_(494)),C_(function(e,t,i){const s=S_;return ob(e)+"-"+t.toString(36)+"-"+i+s(355)},"makeQueueTicketName");var cb=/^([0-3])-([0-9a-z]+)-([0-9a-f]+)\.json$/;function hb(e){const t=cb.exec(e);if(!t)return null;const i=Number(t[1]),s=ab(i);if(null===s)return null;const r=parseInt(t[2],36);return Number.isFinite(r)?{rank:i,priority:s,createdAt:r,random:t[3]}:null}C_(hb,S_(448)),C_(function(e,t){const i=535,s=424,r=394,n=S_,o=hb(e),a=hb(t);return o&&a?o[n(535)]!==a[n(535)]?o.rank-a[n(i)]:o.createdAt!==a[n(s)]?o.createdAt-a.createdAt:o.random<a[n(394)]?-1:o[n(394)]>a[n(r)]?1:0:e<t?-1:e>t?1:0},S_(621));var ub=[S_(617),"collection",S_(534),S_(595)],db=[S_(345),S_(420),S_(467),S_(523),"ci"];function fb(e){const t=447,i=513,s=S_;if(!j_(e))return null;const r=eb(e[s(520)]);if(null===r)return null;const{repo:n,branch:o,sha:a,pr:l,checkId:c}=e;for(const h of[n,o,a,c])if(void 0!==h&&typeof h!==s(513))return null;return void 0===l||typeof l===s(t)&&Number.isInteger(l)?{provider:r,...typeof n===s(513)?{repo:n}:{},...typeof o===s(513)?{branch:o}:{},...typeof a===s(513)?{sha:a}:{},..."number"==typeof l?{pr:l}:{},...typeof c===s(i)?{checkId:c}:{}}:null}C_(function(e){const t=513,i=513,s=537,r=578,n=354,o=S_;if(!j_(e))return null;const{schemaVersion:a,runId:l,kind:c,ref:h,env:u,priority:d,weight:f,producer:p,source:g,ci:v,createdAt:m}=e;if(1!==a)return null;if(typeof l!==o(t)||0===l[o(578)])return null;if(typeof h!==o(i))return null;if(!ub[o(565)](c))return null;if(!nb.includes(d))return null;if(typeof f!==o(447)||!Number.isFinite(f)||f<1)return null;if(typeof m!==o(447)||!Number[o(441)](m))return null;if(!j_(p))return null;if(!db.includes(p[o(s)]))return null;if("number"!=typeof p[o(599)]||typeof p[o(354)]!==o(513))return null;if(void 0!==u&&typeof u!==o(513))return null;let _=null;if(void 0!==g){if(!j_(g)||"string"!=typeof g[o(325)]||0===g.bundleId[o(r)])return null;_={bundleId:g[o(325)]}}let b=null;return void 0!==v&&(b=fb(v),null===b)?null:{schemaVersion:1,runId:l,kind:c,ref:h,priority:d,weight:f,producer:{kind:p[o(537)],pid:p[o(599)],host:p[o(n)]},createdAt:m,...typeof u===o(513)?{env:u}:{},..._?{source:_}:{},...b?{ci:b}:{}}},"parseQueueTicket"),C_(fb,S_(341));function pb(e){const t=407,i=513,s=S_;if(!j_(e))return null;const{repo:r,branch:n,sha:o,dirty:a}=e;if(typeof a!==s(t))return null;for(const l of[r,n,o])if(void 0!==l&&"string"!=typeof l)return null;return{dirty:a,...typeof r===s(i)?{repo:r}:{},...typeof n===s(513)?{branch:n}:{},...typeof o===s(i)?{sha:o}:{}}}S_(556),S_(490),S_(331),C_(pb,S_(419)),C_(function(e){const t=513,i=578,s=526,r=526,n=S_;if(!j_(e))return null;const{schemaVersion:o,bundleId:a,sha256:l,createdAt:c,webVersion:h,author:u,git:d,fileCount:f,byteSize:p,declaredVariables:g,schedulesFingerprint:v}=e;if(1!==o)return null;if(typeof a!==n(t)||0===a[n(i)])return null;if(void 0!==l&&!/^[0-9a-f]{64}$/[n(576)](String(l)))return null;if(typeof h!==n(513)||0===h.length)return null;if(typeof c!==n(447)||!Number.isFinite(c))return null;if("number"!=typeof f||!Number[n(s)](f))return null;if("number"!=typeof p||!Number[n(r)](p))return null;if(void 0!==u&&"string"!=typeof u)return null;let m=null;if(void 0!==d&&(m=pb(d),null===m))return null;const _=Array.isArray(g)?g.filter(e=>"string"==typeof e):[],b=typeof v===n(513)&&/^[0-9a-f]{64}$/[n(576)](v)?v:void 0;return{schemaVersion:1,bundleId:a,...typeof l===n(513)?{sha256:l}:{},createdAt:c,webVersion:h,fileCount:f,byteSize:p,..."string"==typeof u?{author:u}:{},...m?{git:m}:{},..._[n(578)]>0?{declaredVariables:_}:{},...void 0!==b?{schedulesFingerprint:b}:{}}},S_(405)),C_(function(e){const t=364,i=S_,s=e[i(357)];if(!s||void 0===s[i(322)]&&void 0===s.sha)return e.bundleId;const r=s[i(t)]?s[i(t)][i(620)](0,7):"?";return(s.branch??"?")+"@"+r+(s[i(635)]?i(514):"")},S_(588));var gb=[S_(417),S_(554),S_(601),S_(550),S_(493),S_(440),S_(359)];function vb(e){const t=513,i=600,s=S_;if(!Array[s(607)](e))return null;const r=[];for(const n of e){if(!j_(n))continue;const{project:e,environment:o,missing:a}=n;if(typeof e!==s(t)||typeof o!==s(513))continue;if(!Array.isArray(a))continue;const l=a[s(388)](e=>"string"==typeof e);l.length>0&&r[s(i)]({project:e,environment:o,missing:l})}return r[s(578)]>0?r:null}C_(function(e){const t=522,i=451,s=513,r=591,n=S_;if(!j_(e))return null;if(j_(e[n(t)])){const{code:t,message:i}=e[n(522)];return gb.includes(t)?typeof i!==n(513)?null:{error:{code:t,message:i}}:null}const{status:o,bundleId:a}=e;if(o!==n(i)&&o!==n(484))return null;if(typeof a!==n(s)||0===a.length)return null;const l=vb(e[n(r)]);return null===l?{status:o,bundleId:a}:{status:o,bundleId:a,variableGaps:l}},"parseBundleUploadResponse"),C_(vb,S_(551));function mb(e){const t=S_;return Array.isArray(e)?e[t(636)](e=>typeof e!==t(513))?null:e:null}function _b(e){const t=513,i=407,s=447,r=441,n=513,o=513,a=S_;if(!j_(e))return null;const{bundleId:l,label:c,branch:h,sha:u,dirty:d,author:f,createdAt:p,webVersion:g}=e;if("string"!=typeof l||0===l[a(578)])return null;if(typeof c!==a(t)||"string"!=typeof g)return null;if(typeof d!==a(i))return null;if(typeof p!==a(s)||!Number[a(r)](p))return null;for(const v of[h,u,f])if(void 0!==v&&"string"!=typeof v)return null;return{bundleId:l,label:c,dirty:d,createdAt:p,webVersion:g,...typeof h===a(n)?{branch:h}:{},..."string"==typeof u?{sha:u}:{},...typeof f===a(o)?{author:f}:{}}}function bb(e){const t=S_;return void 0!==e[t(558)]?{kind:t(558),name:e[t(558)]}:{kind:"scenario",name:e[t(617)]}}function xb(e){const t=578,i=555,s=578,r=513,n=447,o=480,a=397,l=S_;if(!j_(e))return null;const{collection:c,scenario:h,cron:u,env:d,prepare:f,workers:p,source:g}=e,v="string"==typeof c&&c.length>0?void 0===h?{collection:c}:null:"string"==typeof h&&h[l(t)]>0&&void 0===c?{scenario:h}:null;if(null===v)return null;if(typeof u!==l(513)||0===u[l(i)]()[l(s)])return null;if(void 0!==d&&typeof d!==l(513))return null;if(void 0!==f&&typeof f!==l(r))return null;const m="collection"in v&&typeof p===l(n)&&Number[l(526)](p)&&p>=1?p:void 0,_=g===l(o)||g===l(a)?g:void 0;return{...v,cron:u,...void 0!==d?{env:d}:{},...void 0!==f?{prepare:f}:{},...void 0!==m?{workers:m}:{},...void 0!==_?{source:_}:{}}}S_(446),C_(mb,S_(332)),C_(_b,S_(579)),C_(function(e){const t=513,i=600,s=513,r=513,n=S_;if(!j_(e))return null;if(1!==e[n(315)])return null;const{workspace:o,environment:a,allowSwitch:l,currentBundleId:c,switchedBy:h,switchedAt:u,bundles:d,variables:f,secrets:p,switchPath:g}=e;if(typeof o!==n(t)||"string"!=typeof a)return null;if(typeof l!==n(407))return null;if(!Array[n(607)](d))return null;const v=[];for(const b of d){const e=_b(b);if(!e)return null;v[n(i)](e)}const m=mb(f),_=mb(p);if(!m||!_)return null;for(const b of[c,h,g])if(void 0!==b&&typeof b!==n(s))return null;return void 0!==u&&"number"!=typeof u?null:{schemaVersion:1,workspace:o,environment:a,allowSwitch:l,bundles:v,variables:m,secrets:_,...typeof c===n(513)?{currentBundleId:c}:{},...typeof h===n(r)?{switchedBy:h}:{},..."number"==typeof u?{switchedAt:u}:{},..."string"==typeof g?{switchPath:g}:{}}},S_(481)),C_(bb,S_(366)),C_(xb,S_(627)),C_(function(e){const t=623,i=537,s=634,r=376,n=457,o=537,a=518,l=453,c=S_;if(null==e)return{entries:[]};if(!j_(e))return{error:c(630)};const h=e.schedules??[];if(!Array.isArray(h))return{error:c(t)};const u=[],d=new Set;for(const[f,p]of h.entries()){const e=xb(p);if(!e)return{error:c(593)+f+c(393)};const t=bb(e),h=t[c(i)]+":"+t[c(s)];if(d[c(r)](h))return{error:c(593)+f+c(n)+t[c(o)]+' "'+t[c(634)]+c(a)};d[c(l)](h),u.push(e)}return{entries:u}},"parseSchedulesDoc"),C_(function(e,t){const i=626,s=634,r=537,n=S_,o=new Set(t[n(626)](e=>{const t=n,i=bb(e);return i[t(r)]+":"+i.name}));return[...e[n(388)](e=>{const t=n,i=bb(e);return!o[t(376)](i[t(537)]+":"+i[t(s)])})[n(626)](e=>({...e,source:"config"})),...t[n(i)](e=>({...e,source:n(397)}))]},S_(539)),C_(function(e){const t=592,i=634,s=634,r=343,n=594,o=S_,a=e[o(626)](e=>{const t=o,i=bb(e);return{kind:i[t(537)],name:i[t(s)],cron:e[t(479)],...void 0!==e[t(r)]?{env:e[t(r)]}:{},...void 0!==e[t(368)]?{prepare:e[t(368)]}:{},...void 0!==e.workers?{workers:e[t(n)]}:{}}}).sort((e,t)=>{const s=o,r=e[s(537)]+":"+e[s(634)],n=t.kind+":"+t[s(i)];return r<n?-1:r>n?1:0});return JSON[o(t)](a)},S_(426)),C_(function(e){const t=S_;let i;try{i=JSON.parse(e)}catch{return null}if(!Array[t(607)](i))return null;const s=[];for(const r of i){const e=xb(r);e&&s[t(600)](e)}return s},S_(622));var yb={m5:{minutes:!1,hours:!1,days:!1},m15:{minutes:!1,hours:!1,days:!1},h1:{minutes:!0,hours:!1,days:!1},h2:{minutes:!0,hours:!1,days:!1},h4:{minutes:!0,hours:!1,days:!1},h6:{minutes:!0,hours:!1,days:!1},h12:{minutes:!0,hours:!1,days:!1},daily:{minutes:!0,hours:!0,days:!1},weekly:{minutes:!0,hours:!0,days:!0}},wb={h2:2,h4:4,h6:6,h12:12};function Sb(e){const t=615,i=472,s=395,r=559,n=S_,o=Rb(e.minutes);switch(e.freq){case"m5":return n(460);case"m15":return n(499);case"h1":return o+n(365);case"h2":case"h4":case"h6":case n(319):return o+n(t)+wb[e[n(i)]]+n(529);case n(s):return o+" "+Rb(e.hours)+" * * *";case n(320):return o+" "+Rb(e.hours)+" * * "+Rb(e[n(r)])}}function kb(e){const t=578,i=436,s=548,r=395,n=320,o=S_,a=e[o(555)]()[o(546)](/\s+/);if(5!==a[o(t)])return null;const[l,c,h,u,d]=a;if("*"!==h||"*"!==u)return null;if("*"===c&&"*"===d){if(l===o(495))return Pb("m5");if("*/15"===l)return Pb(o(i));const e=Ab(l);return e&&Pb("h1",e)}const f=Ab(l);if(!f)return null;const p=/^\*\/(\d+)$/.exec(c);if(p&&"*"===d){const e=Object[o(s)](wb)[o(476)](e=>wb[e]===Number(p[1]));return e?Pb(e,f):null}const g=Ab(c);if(!g)return null;if("*"===d)return Pb(o(r),f,g);const v=Ab(d);return v&&Pb(o(n),f,g,v)}function Cb(e){const t=kb(e);return t?jb(t):e}function jb(e){const t=436,i=505,s=580,r=472,n=439,o=559,a=626,l=S_;switch(e.freq){case"m5":return l(413);case l(t):return"every 15 min";case"h1":return l(i)+zb(e[l(386)]);case"h2":case"h4":case"h6":case"h12":return l(s)+wb[e[l(r)]]+"h"+zb(e[l(386)]);case l(395):return l(n)+Ob(e);case l(320):return e[l(o)][l(a)](e=>Db[e]??String(e)).join(", ")+l(637)+Ob(e)}}function Nb(e,t){const i=380,s=577,r=500,n=616,o=S_,a=new Date(t);a[o(i)](0,0);for(let l=0;l<11520;l++)if(a[o(s)](a[o(r)]()+1),Mb(e,a))return a[o(n)]();return a[o(616)]()}function Mb(e,t){const i=565,s=472,r=395,n=386,o=565,a=S_,l=t[a(500)](),c=t[a(516)]();switch(e.freq){case"m5":return l%5==0;case a(436):return l%15==0;case"h1":return e[a(386)][a(i)](l);case"h2":case"h4":case"h6":case"h12":return e[a(386)][a(565)](l)&&c%(wb[e[a(s)]]??1)===0;case a(r):return e[a(386)][a(565)](l)&&e[a(398)][a(i)](c);case a(320):return e[a(n)][a(565)](l)&&e[a(398)][a(565)](c)&&e[a(559)][a(o)](t[a(314)]())}}function Bb(e,t){const i=500,s=314,r=S_,n=new Date(e),o=new Date(t),a=Tb(n.getHours())+":"+Tb(n[r(i)]()),l=Math[r(387)]((Eb(n)-Eb(o))/864e5);return 0===l?"today "+a:1===l?r(432)+a:Db[n[r(s)]()]+" "+a}function Eb(e){const t=S_,i=new Date(e);return i.setHours(0,0,0,0),i[t(616)]()}C_(Sb,S_(330)),C_(kb,"specFromCron"),C_(Cb,S_(375)),C_(jb,"describeSpec"),C_(Nb,"nextTickFromSpec"),C_(Mb,S_(574)),C_(Bb,S_(528)),C_(Eb,"startOfDay");var Db=[S_(328),S_(614),S_(589),S_(570),S_(352),S_(326),S_(402)],Lb=[1,2,3,4,5,6,0];function Pb(e,t=[0],i=[3],s=[1]){return{freq:e,minutes:t,hours:i,days:s}}function Rb(e){const t=S_;return[...e].sort((e,t)=>e-t)[t(390)](",")}function Ab(e){const t=626,i=S_;return/^\d+(,\d+)*$/[i(576)](e)?e[i(546)](",")[i(t)](Number):null}C_(Pb,S_(602)),C_(Rb,S_(632)),C_(Ab,"numbers");var Tb=C_(e=>String(e)[S_(497)](2,"0"),S_(335));function zb(e){const t=637,i=459,s=390,r=S_;return 1===e[r(578)]&&0===e[0]?"":r(t)+[...e][r(i)]((e,t)=>e-t)[r(626)](e=>":"+Tb(e))[r(s)](", ")}function Ob(e){const t=459,i=578,s=390,r=S_,n=[...e[r(398)]][r(t)]((e,t)=>e-t)[r(486)](t=>[...e[r(386)]][r(459)]((e,t)=>e-t)[r(626)](e=>Tb(t)+":"+Tb(e))),o=n[r(620)](0,4),a=n[r(i)]-o.length;return o[r(s)](", ")+(a>0?" +"+a:"")}C_(zb,"atMinutes"),C_(Ob,S_(612));var Ib="_blobs",Fb=/^[0-9a-f]{8,}$/,Hb=(C_(t=class extends Error{constructor(e){const t=634,i=S_;super(i(370)+e),this[i(t)]="InvalidBlobHashError"}},S_(468)),t);function Wb(e,t,i=0){const s=S_;if(!Fb[s(576)](e))throw new Hb(e);const r=i>0?"~"+i:"";return[Ib,e[s(620)](0,2),e[s(620)](2,4),""+e+r+"."+t]}function Kb(e,t,i=0){return Wb(e,t,i).join("/")}C_(function(e,t,i,s=0){return e+"/"+Kb(t,i,s)},"blobPathFor"),C_(Wb,S_(531)),C_(Kb,S_(430)),C_(function(e){return e+"/"+Ib},S_(427));var Ub=/[\\/:*?"<>|\x00-\x1f]/;function $b(e,t){const i=578,s=458,r=512,n=572,o=576,a=613,l=S_;if(typeof e!==l(513))return"must be a string";const c=e.trim();return 0===c[l(i)]?l(452):"."===c||".."===c?l(s):c[l(r)](".")?l(564):(null==t?void 0:t[l(596)])&&c[l(r)]("_")?l(n):Ub[l(o)](c)?l(a):null}function qb(e){return $b(e)}C_($b,S_(552)),C_(qb,"validateCollectionName");var Vb=S_(337);S_(541),C_(class extends Error{constructor(e,t){const i=S_;super('runner "'+t+i(639)+e+'"'),this.name=i(618)}},S_(618)),C_(class extends Error{constructor(e,t){const i=316,s=634,r=S_;super(r(575)+e+r(i)+t),this[r(s)]="RunnerAdapterNotFoundError"}},S_(404)),C_(class extends Error{constructor(e){const t=S_;super(e),this[t(634)]=t(587)}},S_(587));var Yb=S_(327),Gb=/^\s*\/\/\s*@([a-z0-9-]+)\s*$/;function Xb(e){return $b(e,{reservedUnderscore:!0})}C_(function(e){return Gb[S_(576)](e)},S_(521)),C_(function(e){const t=491,i=453,s=376,r=S_,n=new Set;for(const o of e.split(/\r?\n/)){const e=o[r(555)]();if(""===e)continue;if(!e[r(512)]("//"))break;const s=e[r(t)](Gb);s&&n[r(i)](s[1])}return{expectFail:n[r(s)](Yb)}},S_(519)),C_(Xb,S_(503));var Zb=S_(411),Jb=new Set([S_(482),S_(445),S_(628),S_(583),S_(525),S_(597),S_(478),S_(456),S_(475),S_(369),"UNOTEST_DEBUG_DIR","UNOTEST_DEBUG_MAX_BYTES",S_(524),S_(385),"UNOTEST_DEBUG_KEEP_CALLS",S_(563),S_(604),"UNOTEST_CACHE_DIR",S_(344),S_(567),"DATABASE_URL"]);function Qb(e){return Jb[S_(376)](e)}function ex(e){return/^[A-Z][A-Z0-9_]*$/[S_(576)](e)}C_(Qb,S_(492)),C_(function(e){const t=S_;return"secrets"===e.source?t(435):Qb(e.name)?"runner":t(504)},S_(421)),C_(ex,S_(358));var tx=/^[A-Za-z_][A-Za-z0-9_]*$/;function*ix(e){const t=546,i=555,s=512,r=620,n=S_;for(const o of e[n(t)](/\r?\n/)){const e=o[n(i)]();if(""===e||e[n(s)]("#"))continue;const t=e[n(416)]("=");if(t<=0)continue;const a=e[n(620)](0,t).trim();tx.test(a)&&(yield[a,e[n(r)](t+1).trim()])}}function sx(e){const t=576,i=431,s=431,r=431,n=S_;if(""===e)return"";if(/[\s#"'=\\]|^[`]/[n(t)](e)||/[\n\r]/[n(t)](e)){return'"'+e[n(i)](/\\/g,"\\\\")[n(s)](/"/g,'\\"')[n(s)](/\n/g,"\\n")[n(r)](/\r/g,"\\r")+'"'}return e}function rx(e){const t=S_,i=new Set;for(const[s]of ix(e))i[t(453)](s);return i}function nx(e){const t=S_,i=e[t(555)]();return i[t(512)]("#")&&/---/.test(i)}function ox(e){const t=512,i=576,s=555,r=S_,n=e.trim();if(""===n||n[r(t)]("#"))return!1;const o=n[r(416)]("=");return o>0&&tx[r(i)](n.slice(0,o)[r(s)]())}function ax(e,t){const i=512,s=620,r=S_,n=e[r(555)]();if(""===n||n[r(i)]("#"))return!1;const o=n.indexOf("=");return!(o<=0)&&n[r(s)](0,o).trim()===t}function lx(){const e=["tK9Fq09mt1i","y2XP","CgfYC2vdAvj1BLjLCxvLC3q","C291CMnL","y29TCgXLDgvK","Dw5RBM93BI1LBNzPCM9UBwvUDa","zNjLzxPL","lNzPzxDLCI5SB2nR","vgH1","mZu5mtnQsu9Jv0e","Ag9ZDa","lMPZB24","qxbW","z2L0","AxnfEhrLCM5HBfzHCK5HBwu","C3rVCMfNzq","Aw50zxjHy3rPDMu","zMfPBgLUz1nPBMnL","vu5pvevtvf9kvurhrv9mt0DFtevwruW","lMvUDG","C2HH","icOGkIaQicO","C2nOzwr1BgvuyxjNzxq","CgfYC2vbChbtzxj2zxjfDMvUDa","ChjLCgfYzq","vu5pvevtvf9erujvrW","yMXVyIbOyxnOig11C3qGyMuGBg93zxjJyxnLigHLEcWGz290oIa","Dg9tDhjPBMC","vu5pvevtvf9kvurhrv9bq0nfu1nFve9lru4","uNvUBMvY","CNvUswq","zgvZy3jPyMvdCM9U","AgfZ","zgvIDwDeAxjgB3i","Dg9mB3DLCKnHC2u","vu5pvevtvf9kvurhrv9ut0TftG","C2v0u2vJB25KCW","mtuYEuf3vhfR","zM9SzfnJzw5HCMLVuNvU","vvrd","C3rHDhvZ","vu5pvevtvf9erujvr19ive1mx01bwf9cwvrfuW","BwLUDxrLCW","CM91BMq","zMLSDgvY","Dw5RBM93BI1YDw5UzxiTA2v5","AM9PBG","B2jQzwn0","Dw5VDgvZDc8UC2vJCMv0CW","xsbPCYbUB3qGysb2ywXPzcbLBNrYEsdIGjqGAxqGBMvLzhmGzxHHy3rSEsbVBMuGB2yGygnVBgXLy3rPB246ycaVigbZy2vUyxjPBZPGihbSDxmGysbGy3jVBJPGihn0CMLUzW","CMfUzg9T","zgfPBhK","vu5pvevtvf9kvurhrv9qt1ju","zMLSzq","Ag91CNm","CMvXDwLYzvj1BKrPCKzVCG","igLZigfSC28GC2v0igLUihLVDxiGC2HLBgWGzw52AxjVBM1LBNqG4OcuigL0ihDPBgWGA2vLCcbYzxnVBhzPBMCGzNjVBsb0AgvYzsaODgHLigvUDMLYB25Tzw50ihDPBNmGB3zLCIb0AguGzMLSzsKU","ouLPu1nurG","u2f0","x2HLBhbLCNm","uNvUBMvYqwrHChrLCK5VDezVDw5KrxjYB3i","CgfYC2vcDw5KBgvnyw5PzMvZDa","CMvNzxHmAxrLCMfS","yM9VBgvHBG","z2v0uMfUzg9TvMfSDwvZ","Aw5Zzxj0rw52vMfY","z2v0vvrdtw9UDgG","DgvYBwLUywW","vu5pvevtvf9ftLy","zxzLCNKGnsbTAw4","C2HHCMrqyxrOrM9YvgLTzxn0yw1W","yxbWlxnLCNzLCJPLCNjVCG","Aw5KzxHpzG","Dw5HDxrOB3jPEMvK","C2vJCMv0CW","CgfYC2vhAxrjBMzV","DMLLD2vY","y2f0zwDVCML6zvzHCMLHyMXL","BM8Ty29SBgvJDgLVBNm","z2v0vvrdrNvSBfLLyxi","y3jLyxrLzef0","C2nLBMfYAw9szwzgCM9TrMLSzu5HBwu","y2fUB25Py2fSu2nOzwr1Bgvtzxq","yMXVyNnsB290rM9Y","CgfYC2vdAvj1BLjLC3bVBNnL","CxvLDwveAxjgB3i","yMXVyLjLBfbHDgHgB3i","CMvWBgfJzq","Dg9TB3jYB3CG","C2XVDhm","DgvZDerPCKzVCG","C2vJCMv0","Bte1","vu5pvevtvf9kvurhrv9quK9wsurfuG","AxnbC3nPz25Tzw50tgLUzq","zgfPBhKGyxqG","C2nVCguTBwLZBwf0y2G","AxngAw5PDgu","ufiGiW","ntG1mtmWoe1uDxPyvG","zhvYyxrPB25nCW","vu5pvevtvf9iruferuq","lNDVCMTZCgfJzs5QC29U","BNvTyMvY","CgfYC2vrDwv1zvrPy2TLDe5HBwu","vu5pvevtvf9kvurhrv9quKvbtujmrq","z2L0AhvI","y3jLyxrLza","BxvZDcbUB3qGyMuGzw1WDhK","ywrK","Dw5VDgvZDc9Zy2HLzhvSzxmUEwfTBa","igLZigfSC28GC2v0igLUihvUB3rLC3qVlNnLy3jLDhmG4OcuihrOzsbZzwnYzxqGDMfSDwuGC2HHzg93CYb0AgLZig9Uzs4","vu5pvevtvf9usu1fwK9orq","xsbYzxbLyxrZia","BxvZDcbUB3qGyMuGiI4Iig9YiciUlIi","C29YDa","kI81icOGkIaQicO","x2rHEs5QC29UBa","CgfYC2vdAvbYB3zPzgvY","vu5pvevtvf9rvuvvrv9mruftrq","yxbP","vu5pvevtvf9kvurhrv9it1nu","CxvLDwvqCMLVCML0EvjHBMS","BwnW","sw52ywXPzejSB2jiyxnOrxjYB3i","Aw50zxjYDxb0zwq","CMvNzxG","zMfPBfn0CMvHAW","zNjLCq","DgLJA2v0CW","CgXHBKfKzfzHCMLHyMXL","vu5pvevtvf9mt0DFtevwruW","zMLUza","vu5pvevtvf9kvurhrv9ts0Lqx1bsruzmsuDiva","vu5pvevtvf9mt0nbteu","y3jVBG","y29UzMLN","CgfYC2vxB3jRC3bHy2vgAwXL","vu5pvevtvf9cuK9xu0vs","mZKZodi3D2HxrwfO","zxHPC3rZ","CNvUBMvY","zMXHDe1HCa","CgfYC2u","lNj1BNm","Dw5VDgvZDc8Uzw52","l2fWAs9IB3GVyNvUzgXLCW","Bwf0y2G","AxnsDw5UzxjdB25MAwDlzxK","BwLUlxzLCNnPB24","zgvZy3jPyMvuAwnRzxrdAq","kI81","lY5Kzwj1z2DLCG","CgfKu3rHCNq","C2HHCMreyxLZrgvZy2vUzgLUzW","kI8XnsaQicOGkIaQ","z2v0twLUDxrLCW","zw5KC1DPDgG","AxnuzxjTAw5HBfj1BNrPBwvtDgf0zq","DMfSAwrHDgvtzwDTzw50tMfTzq","yxbW","Ag91CMX5","AxnbC3nPz25Tzw50t2y","CNvUswrtDgfYDgvKqxq","AM9PBKXPBMvZ","CMvTB3zLrw52vMfY","zgvMAw5LuhjVCgvYDhK","mJGZodGWmfbIBgjdCa","C3rHCNrZv2L0Aa","C3rYAw5N","icH3AxaP","lMPZB25S","z2v0sg91CNm","AxnszwnVCMq","iIdIGjqGB25LihnJAgvKDwXLihbLCIb0yxjNzxq","CgfYC2vty2vUyxjPB0fUBM90yxrPB25Z","ChjVDMLKzxi","AxnbBM5VDgf0Aw9UtgLUzq","zxjYB3i","C2nOzwr1Bgu","vu5pvevtvf9erujvr19quKvwsuvxx0jzvevt","vu5pvevtvf9eruzbvuXux05bvKLhqvrjt05FveLnru9vvf9nuW","AxnjBNrLz2vY","ChjVAMvJDfj1BKrPCKzVCG","zM9YBwf0tMv4DfrPy2S","icOGkIaQ","Axntzwn0Aw9UrgL2AwrLCG","yMXVyLjLBfnLz21LBNrZrM9Y","AxnrDwv1zurPCK5HBwu","vu5pvevtvf9kvurhrv9nt0rfta","yxv0Ag9YAw5N","CMfUAW","iYaTls0G","A2LUza","nJH0y1PhvKW","BwvYz2vty2HLzhvSzxm","CNvUC0rPCKzVCG","C291CMnLCY5QC29U","mZm4mJK3mdbgrxLQAgu","ChjVAMvJDff1zxvLuM9VDa","CgLJA2vYlxnUyxbZAg90lNr4Da","mtaWnZi0nw5gAMzqyW","C3bSAxq","yxj0AwzHy3rZuM9VDezYB20","A2v5CW","BwfRzvj1BKLK","AwqTBwLZBwf0y2G","CgfYC2vwyxjPywjSzuDHChm","DMfSAwrHDgvgC1nHzMvoyw1L","zMLUzeLUzgv4","Dg9VlwXHCMDL","DhjPBq","yNvUzgXLlMPZB24","Bgf5zxjZrM9Y","y29SBgvJDgLVBG","zgf5CW","l2P1zgDL","mty0oduYwgP1zKPd","vu5pvevtvf9kvurhrv9vuKW","vu5pvevtvf9orvrxt1jl","BxvZDcbUB3qGC3rHCNqGD2L0AcaNlIC","Aw5JBhvKzxm","ztjL","rK9sq0vFq09mt1i","yxbWlxnLCNzLCJPYzwfKEq","ywn0AxzLrw52tMfTzq","v2vK","y3j5ChrV","BxvZDcbUB3qGC3rHCNqGD2L0AcaNxYCGkhjLC2vYDMvKkq","y29TBwfUzhmUANnVBMW","C3bLy01HDgnOzxm","y2fUBM90igXVywqGCNvUBMvYigfKyxb0zxiGiG","DgvZDa","C2v0twLUDxrLCW","BgvUz3rO","CgfYC2vcDw5KBgu","zxzLCNKG","iokaLcbWAwnRigeGzgLMzMvYzw50ig5HBwuGB3iGzwrPDcb0AguGzxHPC3rPBMCGDMfSDwuU","lNnUyxbZAg90CW","vu5pvevtvf9eruzbvuXux1rjtuvpvvrFtvm","zw52tMfTzxngCM9TrgLYtgLZDgLUzW","x2nVBgXLy3rPB25Z","zMXHz3m","uNvUBMvYtM90q29UzMLNDxjLzevYCM9Y","zgvZy3jPyMvcDw5KBgu","vhvL","ChjVAMvJDfj1BNnsB290","DMfYAwfIBgvhyxbZ","C3rYAw5NAwz5","C2nOzwr1BgvZwW","D29YA2vYCW","BwfPBNrLBMfUy2u","CMvZzxj2zwrvBMrLCNnJB3jL","vu5pvevtvf9qt1bvuf9huKfdrv9nuW","CNvUDgLTzs5QC29U","CgLK","ChvZAa","BwfSzM9YBwvK","C3bLyW","C2vJCMv0C0XHEwvYrMLSzxngB3i","vu5pvevtvf9dt05tt0Xf","C3rKB3v0lMXVzW","C3bSAwnL","AxnbCNjHEq","lMrLyNvN","yxbWlxnLCNzLCJPYzxvZzwq","x3nJzw5HCMLVCW","C3rKzxjYlMXVzW","DgLTzxm","BxvZDcbUB3qGy29UDgfPBIbCic8GoIaQid8GiIa8id4GFcbVCIbJB250CM9SignOyxjHy3rLCNm","tw9U","icOV","z2v0vgLTzq","C2nLBMfYAw8","vw5ZDxbWB3j0zwrsDw5lAw5KrxjYB3i","vu5pvevtvf9kvurhrv9usu1ft1vux01t","C2XPy2u","y29TCgfYzvf1zxvLvgLJA2v0tMfTzxm","CgfYC2vty2HLzhvSzxnkC29U","yhnJAgvKDwXLCZPGig11C3qGyMuGyw4GyxjYyxK","AxnsDw5ZrgLYtMfTzq","z2v0vvrdrgf0zq","BwfW","CgfYC2vty2HLzhvSzuvUDhj5","vu5pvevtvf9tte9xx01p","igLZigfSC28GC2v0igLUihvUB3rLC3qVlMvUDIdIGjqGDgHLihnLy3jLDcb2ywX1zsbUB3CGC2HHzg93CYbPDc4","zxHWzwn0zwqGysbTyxbWAw5NihDPDgGGysbGC2nOzwr1BgvZoMaGyxjYyxK","vu5pvevtvf9kvurhrv9nt0rf","BgLZDa","C2fUAxrPEMvsDw5jzfnLz21LBNq","BMfTzq","zgLYDhK","C29Tzq","igf0ia","zw52q29UDgvUDa","iIbKB2vZig5VDcbZDxbWB3j0ihj1BIbRAw5Kici","z2v0rgf5","C2nOzw1HvMvYC2LVBG","iI4G","lM11Dgv4","C3rHCNrLzef0","AdeY","D2vLA2X5","vu5pvevtvf9buLrjrKfdvfnFuK9pva","yNjHBMnO","zxHHBxbSzq","C2vJCMv0C0nVBNrLBNq","yNvUzgXLswq","rNjP","zxHWzwn0lwzHAwW","u3vU","zMfPBgvK","y3jVBKzYB21tCgvJ","vu5pvevtvf9cvu5etevFsuq","C3rYAw5NtgLZDa","Dw5VDgvZDa","igfSCMvHzhKGzxHPC3rZigLUia","CgfK","vu5pvevtvf9ot19rvuvvrq","BwfUAwzLC3qUANnVBG","lNf1zxvL","C2HHCMreAxjgB3i","CxvLDwvK","CgfYC2vuAwnRzxrdAq","ywjVCNrLza","zw52"];return(lx=function(){return e})()}function cx(e){const t=S_,i=e[t(501)]("\n"),s=i?e[t(620)](0,-1):e;return{lines:""===s?[]:s[t(546)]("\n"),trailingNewline:i}}function hx(e,t){const i=e[S_(390)]("\n");return t||""===i?i+"\n":i}C_(ix,"assignmentEntries"),C_(function(e){const t=578,i=S_,s={};for(const[r,n]of ix(e)){let e=n;if(e[i(578)]>=2){const s=e[0],r=e[e[i(t)]-1];('"'===s||"'"===s)&&s===r&&(e=e[i(620)](1,-1))}s[r]=e}return s},"parseEnvContent"),C_(sx,"serializeEnvValue"),C_(rx,"envKeys"),C_(nx,S_(530)),C_(ox,S_(438)),C_(ax,S_(506)),C_(cx,"splitLines"),C_(hx,S_(508)),C_(function(e,t,i,s){const r=553,n=555,o=578,a=578,l=S_,c=t+"="+sx(i),{lines:h,trailingNewline:u}=cx(e);if(s){const e=new RegExp("\\b"+s[l(378)]()+"\\b"),t=h[l(r)](t=>nx(t)&&e[l(576)](t[l(378)]()));if(-1!==t){let e=h[l(578)];for(let n=t+1;n<h.length;n++)if(nx(h[n])){e=n;break}let i=-1,s=-1;for(let o=t+1;o<e;o++)""!==h[o][l(n)]()&&(s=o),ox(h[o])&&(i=o);const r=i>=0?i:s,a=r>=0?r+1:t+1;return h[l(606)](a,0,c),hx(h,u||h[l(o)]>0)}return h[l(a)]>0&&h[l(600)](""),h.push(l(536)+s+" ---",c),hx(h,!0)}return h.push(c),hx(h,!0)},S_(409)),C_(function(e,t){const i=S_,{lines:s,trailingNewline:r}=cx(e),n=s[i(388)](e=>!ax(e,t)),o=n[i(578)]!==s.length;return{content:hx(n,r),removed:o}},S_(509));var ux={app:S_(356),runner:S_(373),secret:void 0};C_(function(e){const t=485,i=638,s=376,r=418,n=435,o=S_,{name:a,kind:l}=e;if(l===o(t)){if(!Qb(a))return{ok:!1,code:o(389),message:a+" is not a known runner setting — choose one from the runner-config list."}}else if(!ex(a))return{ok:!1,code:"invalid-name",message:a+" must be UPPER_SNAKE (e.g. APP_BASE_URL) so a scenario can reference it by name."};const c=rx(e[o(i)])[o(s)](a),h=rx(e[o(324)])[o(376)](a),u=l===o(435)?o(r):o(343),d=u===o(r)?h:c,f=u===o(418)?"unotest/.secrets":"unotest/.env";if(d)return{ok:!1,code:"duplicate",message:a+o(334)+f+o(581)};const p=[];return l===o(n)&&c&&p.push(a+o(629)),l!==o(n)&&h&&p.push(a+o(455)),{ok:!0,target:u,sectionLabel:ux[l],warnings:p}},S_(474)),C_(function(e,t,i){return void 0!==i&&i!==t?[e+S_(400)]:[]},"deleteShadowWarning");var dx=[S_(348),S_(329),S_(342)];function fx(...e){return e.filter(Boolean).join(" ")}C_(function(e){return dx[S_(565)](e)},S_(502)),S_(560),S_(631),S_(562),S_(379),S_(619),S_(449),S_(437),S_(533),S_(372),S_(465),S_(396),S_(362),S_(477);const px={clock:ki.jsxs(ki.Fragment,{children:[ki.jsx("circle",{cx:"12",cy:"12",r:"9"}),ki.jsx("path",{d:"M12 7v5l3 2"})]}),user:ki.jsxs(ki.Fragment,{children:[ki.jsx("circle",{cx:"12",cy:"8",r:"3.5"}),ki.jsx("path",{d:"M5.5 20a6.5 6.5 0 0 1 13 0"})]}),search:ki.jsxs(ki.Fragment,{children:[ki.jsx("circle",{cx:"11",cy:"11",r:"7"}),ki.jsx("path",{d:"m20 20-3.5-3.5"})]}),refresh:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M3 12a9 9 0 0 1 15.5-6.3L21 8"}),ki.jsx("path",{d:"M21 3v5h-5"}),ki.jsx("path",{d:"M21 12a9 9 0 0 1-15.5 6.3L3 16"}),ki.jsx("path",{d:"M3 21v-5h5"})]}),sun:ki.jsxs(ki.Fragment,{children:[ki.jsx("circle",{cx:"12",cy:"12",r:"4"}),ki.jsx("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}),moon:ki.jsx("path",{d:"M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8Z"}),monitor:ki.jsxs(ki.Fragment,{children:[ki.jsx("rect",{x:"3",y:"4",width:"18",height:"12",rx:"2"}),ki.jsx("path",{d:"M8 20h8M12 16v4"})]}),chevronR:ki.jsx("path",{d:"m9 6 6 6-6 6"}),chevronD:ki.jsx("path",{d:"m6 9 6 6 6-6"}),check:ki.jsx("path",{d:"M5 12.5 10 17l9-10"}),x:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M6 6l12 12"}),ki.jsx("path",{d:"M18 6 6 18"})]}),alert:ki.jsxs(ki.Fragment,{children:[ki.jsx("circle",{cx:"12",cy:"12",r:"9"}),ki.jsx("path",{d:"M12 8v5"}),ki.jsx("path",{d:"M12 16.5h.01"})]}),play:ki.jsx("path",{d:"M7 5v14l12-7Z"}),pause:ki.jsxs(ki.Fragment,{children:[ki.jsx("rect",{x:"6",y:"5",width:"4",height:"14",rx:"0.5"}),ki.jsx("rect",{x:"14",y:"5",width:"4",height:"14",rx:"0.5"})]}),square:ki.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"}),camera:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M3 8h3l2-2.5h8L18 8h3v11H3Z"}),ki.jsx("circle",{cx:"12",cy:"13",r:"3.5"})]}),terminal:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"m5 8 4 4-4 4"}),ki.jsx("path",{d:"M12 18h7"})]}),network:ki.jsxs(ki.Fragment,{children:[ki.jsx("circle",{cx:"12",cy:"6",r:"2"}),ki.jsx("circle",{cx:"6",cy:"18",r:"2"}),ki.jsx("circle",{cx:"18",cy:"18",r:"2"}),ki.jsx("path",{d:"M12 8v3M6 16l5-5M18 16l-5-5"})]}),tree:ki.jsx("path",{d:"M4 5h6M4 12h10M4 19h14"}),home:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M4 10.5 12 4l8 6.5V19a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1Z"}),ki.jsx("path",{d:"M9.5 20v-6h5v6"})]}),file:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8Z"}),ki.jsx("path",{d:"M14 3v5h5"})]}),code:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"m9 8-5 4 5 4"}),ki.jsx("path",{d:"m15 8 5 4-5 4"})]}),braces:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M8 4H7a3 3 0 0 0-3 3v3l-1 2 1 2v3a3 3 0 0 0 3 3h1"}),ki.jsx("path",{d:"M16 4h1a3 3 0 0 1 3 3v3l1 2-1 2v3a3 3 0 0 1-3 3h-1"})]}),variable:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M5 5c-2 4-2 10 0 14"}),ki.jsx("path",{d:"M19 5c2 4 2 10 0 14"}),ki.jsx("path",{d:"m9 15 6-6"}),ki.jsx("path",{d:"m9 9 6 6"})]}),layers:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"m12 3 9 5-9 5-9-5 9-5Z"}),ki.jsx("path",{d:"m3 13 9 5 9-5"}),ki.jsx("path",{d:"m3 18 9 5 9-5"})]}),list:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M9 6h12M9 12h12M9 18h12"}),ki.jsx("circle",{cx:"4",cy:"6",r:"1"}),ki.jsx("circle",{cx:"4",cy:"12",r:"1"}),ki.jsx("circle",{cx:"4",cy:"18",r:"1"})]}),history:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M3 12a9 9 0 1 0 3-6.7L3 8"}),ki.jsx("path",{d:"M3 3v5h5"}),ki.jsx("path",{d:"M12 7v5l3 2"})]}),activity:ki.jsx("path",{d:"M3 12h4l3-8 4 16 3-8h4"}),plus:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M12 5v14"}),ki.jsx("path",{d:"M5 12h14"})]}),trash:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M4 7h16"}),ki.jsx("path",{d:"M9 7V4h6v3"}),ki.jsx("path",{d:"M6 7v13a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7"}),ki.jsx("path",{d:"M10 11v7M14 11v7"})]}),grip:ki.jsxs(ki.Fragment,{children:[ki.jsx("circle",{cx:"9",cy:"6",r:"1"}),ki.jsx("circle",{cx:"9",cy:"12",r:"1"}),ki.jsx("circle",{cx:"9",cy:"18",r:"1"}),ki.jsx("circle",{cx:"15",cy:"6",r:"1"}),ki.jsx("circle",{cx:"15",cy:"12",r:"1"}),ki.jsx("circle",{cx:"15",cy:"18",r:"1"})]}),panel:ki.jsxs(ki.Fragment,{children:[ki.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1.5"}),ki.jsx("path",{d:"M9 4v16"})]}),panelRight:ki.jsxs(ki.Fragment,{children:[ki.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1.5"}),ki.jsx("path",{d:"M15 4v16"})]}),externalL:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M14 4h6v6"}),ki.jsx("path",{d:"m20 4-9 9"}),ki.jsx("path",{d:"M19 14v5a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5"})]}),copy:ki.jsxs(ki.Fragment,{children:[ki.jsx("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2"}),ki.jsx("path",{d:"M5 15V5a2 2 0 0 1 2-2h10"})]}),folder:ki.jsx("path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"}),folderPlus:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"}),ki.jsx("path",{d:"M12 10v6"}),ki.jsx("path",{d:"M9 13h6"})]}),package:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M21 8v8a2 2 0 0 1-1 1.73l-7 4a2 2 0 0 1-2 0l-7-4A2 2 0 0 1 3 16V8a2 2 0 0 1 1-1.73l7-4a2 2 0 0 1 2 0l7 4A2 2 0 0 1 21 8Z"}),ki.jsx("path",{d:"m3.3 7 8.7 5 8.7-5"}),ki.jsx("path",{d:"M12 22V12"})]}),clipboard:ki.jsxs(ki.Fragment,{children:[ki.jsx("rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",ry:"1"}),ki.jsx("path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"})]}),inspect:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M3 11V5a2 2 0 0 1 2-2h6"}),ki.jsx("path",{d:"M21 13V5a2 2 0 0 0-2-2h-4"}),ki.jsx("path",{d:"M3 13v6a2 2 0 0 0 2 2h6"}),ki.jsx("path",{d:"m13 13 8 8"}),ki.jsx("path",{d:"m17 13 4 4"})]}),more:ki.jsxs(ki.Fragment,{children:[ki.jsx("circle",{cx:"5",cy:"12",r:"1.2"}),ki.jsx("circle",{cx:"12",cy:"12",r:"1.2"}),ki.jsx("circle",{cx:"19",cy:"12",r:"1.2"})]}),spinner:ki.jsx("path",{d:"M21 12a9 9 0 1 1-6.2-8.55"}),edit:ki.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 1 1 3 3L7 19l-4 1 1-4 12.5-12.5Z"}),bug:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M9 8V6a3 3 0 1 1 6 0v2"}),ki.jsx("rect",{x:"6",y:"8",width:"12",height:"11",rx:"6"}),ki.jsx("path",{d:"M12 12v7M3 13h3M18 13h3M5 7l3 2M19 7l-3 2M5 19l3-2M19 19l-3-2"})]}),stepOver:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M4 12a8 8 0 0 1 14-5"}),ki.jsx("path",{d:"M18 3v5h-5"}),ki.jsx("circle",{cx:"12",cy:"18",r:"1.6",fill:"currentColor",stroke:"none"})]}),bp:ki.jsx("circle",{cx:"12",cy:"12",r:"5",fill:"currentColor",stroke:"none"}),arrowR:ki.jsx("path",{d:"m9 6 8 6-8 6Z",fill:"currentColor",stroke:"none"}),minus:ki.jsx("path",{d:"M5 12h14"}),claude:ki.jsx("path",{fill:"currentColor",stroke:"none",d:"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z"}),codex:ki.jsx("path",{fill:"currentColor",stroke:"none",d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"}),eye:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z"}),ki.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),eyeOff:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M9.9 4.24A9.1 9.1 0 0 1 12 4c6.5 0 10 7 10 7a13.2 13.2 0 0 1-2.16 2.92"}),ki.jsx("path",{d:"M6.6 6.6A13.3 13.3 0 0 0 2 11s3.5 7 10 7a9.2 9.2 0 0 0 4.4-1.1"}),ki.jsx("path",{d:"M9.9 9.9a3 3 0 0 0 4.2 4.2"}),ki.jsx("path",{d:"m2 2 20 20"})]}),target:ki.jsxs(ki.Fragment,{children:[ki.jsx("circle",{cx:"12",cy:"12",r:"7"}),ki.jsx("path",{d:"M12 2v3M12 19v3M2 12h3M19 12h3"}),ki.jsx("circle",{cx:"12",cy:"12",r:"1.4",fill:"currentColor",stroke:"none"})]}),text:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"M5 19 11 5h2l6 14"}),ki.jsx("path",{d:"M7.5 14.5h9"})]}),globe:ki.jsxs(ki.Fragment,{children:[ki.jsx("circle",{cx:"12",cy:"12",r:"9"}),ki.jsx("path",{d:"M3 12h18"}),ki.jsx("path",{d:"M12 3c2.5 2.6 2.5 15.4 0 18M12 3c-2.5 2.6-2.5 15.4 0 18"})]}),phone:ki.jsxs(ki.Fragment,{children:[ki.jsx("rect",{x:"7",y:"3",width:"10",height:"18",rx:"2"}),ki.jsx("path",{d:"M11 18h2"})]}),cube:ki.jsxs(ki.Fragment,{children:[ki.jsx("path",{d:"m12 3 8 4.5v9L12 21l-8-4.5v-9Z"}),ki.jsx("path",{d:"M12 12v9M4 7.5l8 4.5 8-4.5"})]})};function gx({name:e,className:t="h-4 w-4",strokeWidth:i=1.75}){return ki.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:i,strokeLinecap:"round",strokeLinejoin:"round",className:t,"aria-hidden":"true",children:px[e]})}const vx=[{value:"off",label:"not set"},{value:"m5",label:"every 5 minutes"},{value:"m15",label:"every 15 minutes"},{value:"h1",label:"every hour"},{value:"h2",label:"every 2 hours"},{value:"h4",label:"every 4 hours"},{value:"h6",label:"every 6 hours"},{value:"h12",label:"every 12 hours"},{value:"daily",label:"every day"},{value:"weekly",label:"every week"}],mx=Array.from({length:12},(e,t)=>5*t),_x=Array.from({length:24},(e,t)=>t),bx=__(function(){const e=w_(),t=e.schedules.editing;return t?e.schedules.readOnly?ki.jsx(Sx,{target:t,deployed:!0},`${t.kind}:${t.name}`):"config"===e.schedules.sourceOf(t.kind,t.name)?ki.jsx(Sx,{target:t},`${t.kind}:${t.name}`):ki.jsx(kx,{target:t},`${t.kind}:${t.name}`):null});function xx({target:e,onClose:t,children:i}){return gi.useEffect(()=>{const e=e=>{"Escape"===e.key&&t()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t]),ki.jsx("div",{className:"fixed inset-0 z-50 grid place-items-center bg-black/30 backdrop-blur-[1px]",onMouseDown:t,children:ki.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":`Schedule for ${e.name}`,onMouseDown:e=>e.stopPropagation(),className:fx("w-[min(440px,calc(100vw-2rem))] rounded-lg p-4","border border-edge-soft bg-overlay shadow-xl"),children:[ki.jsxs("div",{className:"flex items-center gap-2",children:[ki.jsx(gx,{name:"clock",className:"h-3.5 w-3.5 text-fg-4"}),ki.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"schedule"}),ki.jsx("span",{className:"min-w-0 flex-1 truncate text-right font-mono text-[12px] text-fg-2",children:e.name}),ki.jsx("span",{className:"rounded border border-edge-soft px-1.5 py-px font-mono text-[9.5px] uppercase tracking-wider text-fg-4",children:"scenario"===e.kind?"test":"collection"})]}),i]})})}function yx({spec:e,cron:t}){return ki.jsxs("div",{className:"mt-1.5 font-mono text-[10.5px] text-fg-4",children:["next: ",Bb(Nb(e,Date.now()),Date.now())," ",ki.jsx("span",{className:"text-fg-4/70",children:"· your clock"}),ki.jsxs("span",{className:"float-right text-fg-4/70",children:["cron: ",t]})]})}function wx({children:e}){return ki.jsxs("div",{className:"mt-4 flex items-start gap-2 rounded border border-edge-soft bg-raised/50 px-2.5 py-2 text-[11px] leading-relaxed text-fg-4",children:[ki.jsx(gx,{name:"alert",className:"mt-px h-3.5 w-3.5 shrink-0"}),ki.jsx("span",{children:e})]})}const Sx=__(function({target:e,deployed:t=!1}){const i=w_().schedules,s=i.get(e.kind,e.name),r=s?kb(s.cron):null;return ki.jsxs(xx,{target:e,onClose:i.closeEditor,children:[ki.jsxs("div",{className:"mt-4 font-mono text-[12.5px] text-fg-2",children:[s?Cb(s.cron):"not scheduled",(null==s?void 0:s.env)&&ki.jsxs("span",{className:"text-fg-4",children:[" · env ",s.env]})]}),s&&r&&ki.jsx(yx,{spec:r,cron:s.cron}),ki.jsx(wx,{children:t?ki.jsxs(ki.Fragment,{children:["Declared in the repo (",ki.jsx("span",{className:"font-mono",children:"unotest/schedules.yaml"})," or"," ",ki.jsx("span",{className:"font-mono",children:"unotest.config"}),") — edit it there and push. This box applies whatever the deployed bundle declares."]}):ki.jsxs(ki.Fragment,{children:["Declared in ",ki.jsx("span",{className:"font-mono",children:"unotest.config"})," — edit it there. This popup edits only"," ",ki.jsx("span",{className:"font-mono",children:"unotest/schedules.yaml"}),"."]})}),ki.jsx("div",{className:"mt-4 flex items-center justify-end",children:ki.jsx("button",{type:"button",onClick:i.closeEditor,className:"h-7 rounded border border-edge-soft bg-canvas px-3 font-mono text-[11.5px] text-fg-2 hover:bg-raised",children:"Close"})})]})}),kx=__(function({target:e}){const t=w_(),i=t.schedules,s=i.get(e.kind,e.name),r=s?kb(s.cron):null,n=null!==s&&null===r,[o,a]=gi.useState((null==r?void 0:r.freq)??"off"),[l,c]=gi.useState((null==r?void 0:r.minutes)??[0]),[h,u]=gi.useState((null==r?void 0:r.hours)??[3]),[d,f]=gi.useState((null==r?void 0:r.days)??[1]),[p,g]=gi.useState((null==s?void 0:s.env)??""),[v,m]=gi.useState(null),_="off"===o?null:{freq:o,minutes:l,hours:h,days:d},b="off"===o?null:yb[o];return ki.jsxs(xx,{target:e,onClose:i.closeEditor,children:[ki.jsxs("label",{className:"mt-4 block",children:[ki.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"run"}),ki.jsx("select",{value:o,autoFocus:!0,onChange:e=>a(e.target.value),className:fx("mt-1 h-8 w-full rounded border border-edge-soft bg-canvas px-2","font-mono text-[12.5px] text-fg focus:border-accent focus:outline-none"),children:vx.map(e=>ki.jsx("option",{value:e.value,children:e.label},e.value))})]}),n&&"off"===o&&ki.jsxs("div",{className:"mt-2 font-mono text-[10.5px] text-warn",children:["current schedule is a custom cron: ",s.cron]}),(null==b?void 0:b.days)&&ki.jsx(jx,{label:"days",children:Lb.map(e=>ki.jsx(Nx,{label:Db[e]??String(e),wide:!0,selected:d.includes(e),onToggle:()=>f(Cx(d,e))},e))}),(null==b?void 0:b.hours)&&ki.jsx(jx,{label:"hours",children:_x.map(e=>ki.jsx(Nx,{label:Mx(e),selected:h.includes(e),onToggle:()=>u(Cx(h,e))},e))}),(null==b?void 0:b.minutes)&&ki.jsx(jx,{label:"minutes",children:mx.map(e=>ki.jsx(Nx,{label:Mx(e),selected:l.includes(e),onToggle:()=>c(Cx(l,e))},e))}),_&&ki.jsx(yx,{spec:_,cron:Sb(_)}),ki.jsxs("label",{className:"mt-4 flex items-center gap-3",children:[ki.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"env"}),ki.jsxs("select",{value:p,onChange:e=>g(e.target.value),className:fx("h-7 flex-1 rounded border border-edge-soft bg-canvas px-2","font-mono text-[12px] text-fg-2 focus:border-accent focus:outline-none"),children:[ki.jsx("option",{value:"",children:"base"}),t.environments.names.map(e=>ki.jsx("option",{value:e,children:e},e))]})]}),ki.jsxs(wx,{children:["Saved to ",ki.jsx("span",{className:"font-mono",children:"unotest/schedules.yaml"})," — declared here, and a box runs what you push: the schedule travels with the bundle 1:1."]}),v&&ki.jsx("div",{className:"mt-3 rounded border border-fail/30 bg-fail/10 px-2.5 py-1.5 font-mono text-[10.5px] text-fail",children:v}),ki.jsxs("div",{className:"mt-4 flex items-center justify-end gap-2",children:[ki.jsx("button",{type:"button",onClick:i.closeEditor,className:"h-7 rounded border border-edge-soft bg-canvas px-3 font-mono text-[11.5px] text-fg-2 hover:bg-raised",children:"Cancel"}),ki.jsx("button",{type:"button",onClick:()=>{(async()=>{let e;if(null===_){if(!s)return void i.closeEditor();e=await i.remove()}else e=await i.save({cron:Sb(_),env:""===p?null:p});null!==e&&m(e)})()},className:"h-7 rounded bg-accent px-3 font-mono text-[11.5px] font-medium text-on-accent hover:bg-accent-hover",children:"Save"})]})]})});function Cx(e,t){return e.includes(t)?1===e.length?e:e.filter(e=>e!==t):[...e,t]}function jx({label:e,children:t}){return ki.jsxs("div",{className:"mt-3",children:[ki.jsx("div",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:e}),ki.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:t})]})}function Nx({label:e,selected:t,onToggle:i,wide:s=!1}){return ki.jsx("button",{type:"button","aria-pressed":t,onClick:i,className:fx("h-6 rounded border font-mono text-[10.5px] tabular-nums",s?"px-2.5":"w-8",t?"border-accent/40 bg-accent/15 text-accent":"border-edge-soft bg-canvas text-fg-4 hover:bg-raised hover:text-fg-2"),children:e})}const Mx=e=>String(e).padStart(2,"0");function Bx(e){return t=>{t.preventDefault();const i="x"===e.axis?t.clientX:t.clientY,s=e.value,r=t=>{const r="x"===e.axis?t.clientX:t.clientY;e.onChange(Math.min(e.max(),Math.max(e.min,s+(r-i)*e.dir)))},n=()=>{window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",n),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="x"===e.axis?"ew-resize":"ns-resize",document.body.style.userSelect="none",window.addEventListener("pointermove",r),window.addEventListener("pointerup",n)}}function Ex(e,t){gi.useEffect(()=>{const i=i=>{var s;(null==(s=e.current)?void 0:s.contains(i.target))||t()},s=e=>{"Escape"===e.key&&t()},r=()=>t();return window.addEventListener("mousedown",i,!0),window.addEventListener("contextmenu",i,!0),window.addEventListener("keydown",s),window.addEventListener("scroll",r,!0),()=>{window.removeEventListener("mousedown",i,!0),window.removeEventListener("contextmenu",i,!0),window.removeEventListener("keydown",s),window.removeEventListener("scroll",r,!0)}},[e,t])}function Dx({x:e,y:t,items:i,onClose:s}){const r=gi.useRef(null),{left:n,top:o,mounted:a}=function(e,t,i){const[s,r]=gi.useState({left:t,top:i}),[n,o]=gi.useState(!1);return gi.useEffect(()=>{const s=e.current;if(!s)return;const{innerWidth:n,innerHeight:a}=window,l=s.getBoundingClientRect();let c=t,h=i;c+l.width>n-6&&(c=Math.max(6,n-l.width-6)),h+l.height>a-6&&(h=Math.max(6,a-l.height-6)),r({left:c,top:h});const u=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(u)},[e,t,i]),{left:s.left,top:s.top,mounted:n}}(r,e,t);return Ex(r,s),ki.jsx("div",{ref:r,role:"menu",style:{left:n,top:o,opacity:a?1:0,transform:a?"translateY(0)":"translateY(-2px)",transitionProperty:"opacity, transform",transitionDuration:"90ms",transitionTimingFunction:"ease-out"},className:fx("fixed z-50 min-w-[208px] overflow-hidden rounded-lg p-1","border border-edge-soft bg-overlay/95 backdrop-blur","shadow-lg"),children:i.map((e,t)=>{if("separator"===e.kind)return ki.jsx("div",{className:"my-1 h-px bg-edge-soft"},t);if("header"===e.kind)return ki.jsx("div",{className:"select-none truncate px-2 pb-1 pt-1 font-mono text-[10px] font-medium uppercase tracking-wider text-fg-4",children:e.label},t);const i="danger"===e.tone;return ki.jsxs("button",{type:"button",role:"menuitem",disabled:e.disabled,onClick:()=>{e.disabled||(e.onSelect(),s())},className:fx("group flex h-7 w-full items-center gap-2 rounded-md px-2 text-left font-mono text-[12px]",e.disabled?"cursor-default text-fg-4":i?"text-fg-2 hover:bg-fail/10 hover:text-fail":"text-fg-2 hover:bg-raised hover:text-fg"),children:[ki.jsx("span",{className:fx("grid h-4 w-4 shrink-0 place-items-center",e.disabled?"text-fg-4":i?"text-fg-3 group-hover:text-fail":"text-fg-3"),children:e.icon&&ki.jsx(gx,{name:e.icon,className:"h-3.5 w-3.5",strokeWidth:1.75})}),ki.jsx("span",{className:"truncate",children:e.label}),e.shortcut&&ki.jsx("span",{className:"ml-auto pl-4 font-mono text-[10.5px] tracking-wider text-fg-4",children:e.shortcut})]},t)})})}function Lx({axis:e,onPointerDown:t,className:i}){return ki.jsx("div",{onPointerDown:t,role:"separator","aria-orientation":"x"===e?"vertical":"horizontal",title:"Drag to resize",className:fx("group/resize absolute z-20 touch-none","x"===e?"inset-y-0 w-[7px] cursor-ew-resize":"inset-x-0 h-[7px] cursor-ns-resize",i),children:ki.jsx("span",{className:fx("absolute bg-transparent group-hover/resize:bg-accent/60 group-active/resize:bg-accent","x"===e?"inset-y-0 left-1/2 w-[2px] -translate-x-1/2":"inset-x-0 top-1/2 h-[2px] -translate-y-1/2")})})}function Px({leading:e,label:t,active:i,closable:s=!0,closeLabel:r,onActivate:n,onClose:o,onContextMenu:a}){return ki.jsxs("div",{role:"tab","aria-selected":i,tabIndex:0,onClick:n,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n())},onMouseDown:e=>{1===e.button&&s&&o&&(e.preventDefault(),o())},onContextMenu:a,className:fx("group flex h-7 max-w-[260px] shrink-0 cursor-default items-center gap-1.5 rounded-md px-2.5",i?"bg-selection text-fg":"text-fg-3 hover:bg-raised hover:text-fg-2"),children:[e,ki.jsx("span",{className:"truncate font-mono text-[12px]",children:t}),s&&o&&ki.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),o()},className:fx("grid h-4 w-4 shrink-0 place-items-center rounded-sm text-fg-4 opacity-0 hover:bg-fg/10 hover:text-fg group-hover:opacity-100",i&&"opacity-100"),"aria-label":r??`Close ${t}`,children:ki.jsx(gx,{name:"x",className:"h-3 w-3",strokeWidth:2.5})})]})}const Rx={local:{kind:"local",label:"Local",icon:"terminal",tint:"text-fg-4"},claude:{kind:"claude",label:"Claude Code",icon:"claude",tint:"text-orange-500 dark:text-orange-400"},codex:{kind:"codex",label:"Codex",icon:"codex",tint:"text-emerald-500 dark:text-emerald-400"}};function Ax(e){return"dark"===e?{background:"#1e1f22",foreground:"#e4e4e7",cursor:"#a5b4fc",cursorAccent:"#1e1f22",selectionBackground:"#3f3f46",black:"#27272a",red:"#f87171",green:"#4ade80",yellow:"#fbbf24",blue:"#60a5fa",magenta:"#c084fc",cyan:"#22d3ee",white:"#e4e4e7",brightBlack:"#52525b",brightWhite:"#fafafa"}:{background:"#ffffff",foreground:"#3f3f46",cursor:"#6366f1",cursorAccent:"#ffffff",selectionBackground:"#e4e4e7",black:"#3f3f46",red:"#dc2626",green:"#16a34a",yellow:"#d97706",blue:"#2563eb",magenta:"#9333ea",cyan:"#0891b2",white:"#3f3f46",brightBlack:"#a1a1aa",brightWhite:"#18181b"}}
31
31
  /**
32
32
  * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
33
33
  * @license MIT
@@ -39,7 +39,7 @@ var e,t,i,s,r,n,o,a,l,c,h,u,d,f,p,g,v,m,_,b,x,y,w,S,k,C,j,N,M,E,B,D,L,R,P,A,T,z,
39
39
  * Fabrice Bellard's javascript vt100 for jslinux:
40
40
  * http://bellard.org/jslinux/
41
41
  * Copyright (c) 2011 Fabrice Bellard
42
- */var Lx=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 e;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let t=this._terminal._core._renderService.dimensions;if(0===t.css.cell.width||0===t.css.cell.height)return;let i=0===this._terminal.options.scrollback?0:(null==(e=this._terminal.options.overviewRuler)?void 0:e.width)||14,s=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(s.getPropertyValue("height")),n=Math.max(0,parseInt(s.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),a=r-(parseInt(o.getPropertyValue("padding-top"))+parseInt(o.getPropertyValue("padding-bottom"))),l=n-(parseInt(o.getPropertyValue("padding-right"))+parseInt(o.getPropertyValue("padding-left")))-i;return{cols:Math.max(2,Math.floor(l/t.css.cell.width)),rows:Math.max(1,Math.floor(a/t.css.cell.height))}}},Rx=Object.defineProperty,Px=Object.getOwnPropertyDescriptor,Ax=(e,t,i,s)=>{for(var r,n=s>1?void 0:s?Px(t,i):t,o=e.length-1;o>=0;o--)(r=e[o])&&(n=(s?r(t,i,n):r(n))||n);return s&&n&&Rx(t,i,n),n},Tx=(e,t)=>(i,s)=>t(i,s,e),zx="Terminal input",Ox=()=>zx,Ix=e=>zx=e,Fx="Too much output to announce, navigate to rows manually to read",Hx=()=>Fx,Wx=e=>Fx=e;
42
+ */var Tx=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 e;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let t=this._terminal._core._renderService.dimensions;if(0===t.css.cell.width||0===t.css.cell.height)return;let i=0===this._terminal.options.scrollback?0:(null==(e=this._terminal.options.overviewRuler)?void 0:e.width)||14,s=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(s.getPropertyValue("height")),n=Math.max(0,parseInt(s.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),a=r-(parseInt(o.getPropertyValue("padding-top"))+parseInt(o.getPropertyValue("padding-bottom"))),l=n-(parseInt(o.getPropertyValue("padding-right"))+parseInt(o.getPropertyValue("padding-left")))-i;return{cols:Math.max(2,Math.floor(l/t.css.cell.width)),rows:Math.max(1,Math.floor(a/t.css.cell.height))}}},zx=Object.defineProperty,Ox=Object.getOwnPropertyDescriptor,Ix=(e,t,i,s)=>{for(var r,n=s>1?void 0:s?Ox(t,i):t,o=e.length-1;o>=0;o--)(r=e[o])&&(n=(s?r(t,i,n):r(n))||n);return s&&n&&zx(t,i,n),n},Fx=(e,t)=>(i,s)=>t(i,s,e),Hx="Terminal input",Wx=()=>Hx,Kx=e=>Hx=e,Ux="Too much output to announce, navigate to rows manually to read",$x=()=>Ux,qx=e=>Ux=e;
43
43
  /**
44
44
  * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
45
45
  * @license MIT
@@ -51,5 +51,5 @@ var e,t,i,s,r,n,o,a,l,c,h,u,d,f,p,g,v,m,_,b,x,y,w,S,k,C,j,N,M,E,B,D,L,R,P,A,T,z,
51
51
  * Fabrice Bellard's javascript vt100 for jslinux:
52
52
  * http://bellard.org/jslinux/
53
53
  * Copyright (c) 2011 Fabrice Bellard
54
- */function Kx(e,t,i,s){e=function(e,t){return t?`[200~${e.replace(/\x1b/g,"␛")}[201~`:e}(e=function(e){return e.replace(/\r?\n/g,"\r")}(e),i.decPrivateModes.bracketedPasteMode&&!0!==s.rawOptions.ignoreBracketedPasteMode),i.triggerDataEvent(e,!0),t.value=""}function Ux(e,t,i){let s=i.getBoundingClientRect(),r=e.clientX-s.left-10,n=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}function qx(e,t,i,s,r){Ux(e,t,i),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function $x(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Vx(e,t=0,i=e.length){let s="";for(let r=t;r<i;++r){let t=e[r];t>65535?(t-=65536,s+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):s+=String.fromCharCode(t)}return s}var Yx=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r=0;if(this._interim){let i=e.charCodeAt(r++);56320<=i&&i<=57343?t[s++]=1024*(this._interim-55296)+i-56320+65536:(t[s++]=this._interim,t[s++]=i),this._interim=0}for(let n=r;n<i;++n){let r=e.charCodeAt(n);if(55296<=r&&r<=56319){if(++n>=i)return this._interim=r,s;let o=e.charCodeAt(n);56320<=o&&o<=57343?t[s++]=1024*(r-55296)+o-56320+65536:(t[s++]=r,t[s++]=o);continue}65279!==r&&(t[s++]=r)}return s}},Gx=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let s,r,n,o,a,l=0,c=0;if(this.interim[0]){let s=!1,r=this.interim[0];r&=192==(224&r)?31:224==(240&r)?15:7;let n,o=0;for(;(n=this.interim[++o])&&o<4;)r<<=6,r|=63&n;let a=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,h=a-o;for(;c<h;){if(c>=i)return 0;if(n=e[c++],128!=(192&n)){c--,s=!0;break}this.interim[o++]=n,r<<=6,r|=63&n}s||(2===a?r<128?c--:t[l++]=r:3===a?r<2048||r>=55296&&r<=57343||65279===r||(t[l++]=r):r<65536||r>1114111||(t[l++]=r)),this.interim.fill(0)}let h=i-4,u=c;for(;u<i;){for(;!(!(u<h)||128&(s=e[u])||128&(r=e[u+1])||128&(n=e[u+2])||128&(o=e[u+3]));)t[l++]=s,t[l++]=r,t[l++]=n,t[l++]=o,u+=4;if(s=e[u++],s<128)t[l++]=s;else if(192==(224&s)){if(u>=i)return this.interim[0]=s,l;if(r=e[u++],128!=(192&r)){u--;continue}if(a=(31&s)<<6|63&r,a<128){u--;continue}t[l++]=a}else if(224==(240&s)){if(u>=i)return this.interim[0]=s,l;if(r=e[u++],128!=(192&r)){u--;continue}if(u>=i)return this.interim[0]=s,this.interim[1]=r,l;if(n=e[u++],128!=(192&n)){u--;continue}if(a=(15&s)<<12|(63&r)<<6|63&n,a<2048||a>=55296&&a<=57343||65279===a)continue;t[l++]=a}else if(240==(248&s)){if(u>=i)return this.interim[0]=s,l;if(r=e[u++],128!=(192&r)){u--;continue}if(u>=i)return this.interim[0]=s,this.interim[1]=r,l;if(n=e[u++],128!=(192&n)){u--;continue}if(u>=i)return this.interim[0]=s,this.interim[1]=r,this.interim[2]=n,l;if(o=e[u++],128!=(192&o)){u--;continue}if(a=(7&s)<<18|(63&r)<<12|(63&n)<<6|63&o,a<65536||a>1114111)continue;t[l++]=a}}return l}},Xx=class e{constructor(){this.fg=0,this.bg=0,this.extended=new Jx}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&0!==this.extended.underlineStyle?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return!(50331648&~this.fg)}isBgRGB(){return!(50331648&~this.bg)}isFgPalette(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)}isBgPalette(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)}isFgDefault(){return!(50331648&this.fg)}isBgDefault(){return!(50331648&this.bg)}isAttributeDefault(){return 0===this.fg&&0===this.bg}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&~this.extended.underlineColor):this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?16777216==(50331648&this.extended.underlineColor)||33554432==(50331648&this.extended.underlineColor):this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Jx=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(3758096384&this._ext)>>29;return e<0?4294967288^e:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}},Zx=class e extends Xx{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Jx,this.combinedData=""}static fromCharData(t){let i=new e;return i.setFromCharData(t),i}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?$x(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(2===e[1].length){let i=e[1].charCodeAt(0);if(55296<=i&&i<=56319){let s=e[1].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(i-55296)+s-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}attributesEquals(e){if(this.getFgColorMode()!==e.getFgColorMode()||this.getFgColor()!==e.getFgColor()||this.getBgColorMode()!==e.getBgColorMode()||this.getBgColor()!==e.getBgColor()||this.isInverse()!==e.isInverse()||this.isBold()!==e.isBold()||this.isUnderline()!==e.isUnderline())return!1;if(this.isUnderline()){if(this.getUnderlineStyle()!==e.getUnderlineStyle())return!1;let t=this.isUnderlineColorDefault(),i=e.isUnderlineColorDefault();if(!(t&&i||t===i&&this.getUnderlineColor()===e.getUnderlineColor()&&this.getUnderlineColorMode()===e.getUnderlineColorMode()))return!1}return!(this.isOverline()!==e.isOverline()||this.isBlink()!==e.isBlink()||this.isInvisible()!==e.isInvisible()||this.isItalic()!==e.isItalic()||this.isDim()!==e.isDim()||this.isStrikethrough()!==e.isStrikethrough())}},Qx=new Map;function ey(e){if(Qx.has(e))return Qx.get(e);let t=function(e,i,s){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");!function(e,t,i){t.di$target===t?t.di$dependencies.push({id:e,index:i}):(t.di$dependencies=[{id:e,index:i}],t.di$target=t)}(t,e,s)};return t._id=e,Qx.set(e,t),t}var ty=ey("BufferService"),iy=ey("MouseStateService"),sy=ey("CoreService"),ry=ey("CharsetService"),ny=ey("InstantiationService"),oy=ey("LogService"),ay=ey("OptionsService"),ly=ey("OscLinkService"),cy=ey("UnicodeService"),hy=ey("DecorationService"),uy=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i,this._workCell=new Zx}provideLinks(e,t){var i;let s=this._bufferService.buffer.lines.get(e-1);if(!s)return void t(void 0);let r=[],n=this._optionsService.rawOptions.linkHandler,o=this._workCell,a=s.getTrimmedLength(),l=-1,c=-1,h=!1;for(let u=0;u<a;u++)if(-1!==c||s.hasContent(u)){if(s.loadCell(u,o),o.hasExtendedAttrs()&&o.extended.urlId){if(-1===c){c=u,l=o.extended.urlId;continue}h=o.extended.urlId!==l}else-1!==c&&(h=!0);if(h||-1!==c&&u===a-1){let t=null==(i=this._oscLinkService.getLinkData(l))?void 0:i.uri;if(t){let i=u+(h||u!==a-1?0:1),s=this._getRangeWithLineWrap(e,c,i,l),o=!1;if(!(null==n?void 0:n.allowNonHttpProtocols))try{let e=new URL(t);["http:","https:"].includes(e.protocol)||(o=!0)}catch{o=!0}o||r.push({text:t,range:s,activate:(e,t)=>n?n.activate(e,t,s):dy(e,t),hover:(e,t)=>{var i;return null==(i=null==n?void 0:n.hover)?void 0:i.call(n,e,t,s)},leave:(e,t)=>{var i;return null==(i=null==n?void 0:n.leave)?void 0:i.call(n,e,t,s)}})}h=!1,o.hasExtendedAttrs()&&o.extended.urlId?(c=u,l=o.extended.urlId):(c=-1,l=-1)}}t(r)}_getRangeWithLineWrap(e,t,i,s){var r;let n=e,o=t,a=e,l=i;for(;0===o&&(null==(r=this._bufferService.buffer.lines.get(n-1))?void 0:r.isWrapped);){let e=this._bufferService.buffer.lines.get(n-2);if(!e)break;let t=e.getTrimmedLength();if(0===t||!this._hasUrlId(e,t-1,s))break;let i=t-1;for(;i>0&&this._hasUrlId(e,i-1,s);)i--;n--,o=i}for(;;){let e=this._bufferService.buffer.lines.get(a-1);if(!e)break;if(l!==e.getTrimmedLength())break;let t=this._bufferService.buffer.lines.get(a);if(!(null==t?void 0:t.isWrapped))break;let i=t.getTrimmedLength();if(0===i||!this._hasUrlId(t,0,s))break;let r=1;for(;r<i&&this._hasUrlId(t,r,s);)r++;a++,l=r}return{start:{x:o+1,y:n},end:{x:l,y:a}}}_hasUrlId(e,t,i){let s=this._workCell;return e.loadCell(t,s),!!s.hasExtendedAttrs()&&s.extended.urlId===i}};function dy(e,t){if(confirm(`Do you want to navigate to ${t}?\n\nWARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}uy=Ax([Tx(0,ty),Tx(1,ay),Tx(2,ly)],uy);var fy=ey("CharSizeService"),py=ey("CoreBrowserService"),gy=ey("MouseCoordsService"),vy=ey("MouseService"),my=ey("RenderService"),_y=ey("SelectionService"),by=ey("CharacterJoinerService"),xy=ey("ThemeService"),yy=ey("LinkProviderService"),wy=ey("KeyboardService");function Sy(e){return{dispose:e}}function ky(e){if(!e)return e;if(Array.isArray(e)){for(let t of e)t.dispose();return[]}return e.dispose(),e}var Cy=class{constructor(){this._disposables=new Set,this._isDisposed=!1}get isDisposed(){return this._isDisposed}add(e){return this._isDisposed?e.dispose():this._disposables.add(e),e}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.clear()}}clear(){for(let e of this._disposables)e.dispose();this._disposables.clear()}},jy=class{constructor(){this._store=new Cy}dispose(){this._store.dispose()}_register(e){return this._store.add(e)}};jy.None=Object.freeze({dispose(){}});var Ny=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||(null==(t=this._value)||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,null==(e=this._value)||e.dispose(),this._value=void 0}};var My=class{constructor(){this._token=-1,this._isDisposed=!1}dispose(){this.cancel(),this._isDisposed=!0}cancel(){-1!==this._token&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Error("Calling cancelAndSet on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Error("Calling setIfNotSet on a disposed TimeoutTimer");-1===this._token&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},Ey=class{constructor(){this._isScheduled=!1,this._isDisposed=!1}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._isScheduled=!1}set(e){if(this._isDisposed)throw new Error("Calling set on a disposed MicrotaskTimer");this._isScheduled||(this._isScheduled=!0,queueMicrotask(()=>{this._isScheduled&&(this._isScheduled=!1,e())}))}},By=class{constructor(){this._isDisposed=!1}cancel(){var e;null==(e=this._disposable)||e.dispose(),this._disposable=void 0}cancelAndSet(e,t,i=globalThis){if(this._isDisposed)throw new Error("Calling cancelAndSet on a disposed IntervalTimer");this.cancel();let s=i.setInterval(()=>{e()},t);this._disposable={dispose:()=>{i.clearInterval(s),this._disposable=void 0}}}dispose(){this.cancel(),this._isDisposed=!0}};function Dy(e){var t;let i=e;if(null==(t=null==i?void 0:i.ownerDocument)?void 0:t.defaultView)return i.ownerDocument.defaultView;let s=e;return(null==s?void 0:s.view)?s.view:window}var Ly=class{constructor(e,t,i,s){this._node=e,this._type=t,this._handler=i,this._options=s,e.addEventListener(t,i,s)}dispose(){!this._node||!this._handler||(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Ry(e,t,i,s){return new Ly(e,t,i,s)}function Py(e,t,i,s){return Ry(e,t,i,s)}var Ay="click",Ty="mouseover",zy="mouseleave",Oy="pointerdown",Iy="pointermove",Fy="pointerup",Hy="wheel";var Wy=class{constructor(e,t){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){console.error(e)}}static sort(e,t){return t.priority-e.priority}},Ky=new Map;function Uy(e){let t=Ky.get(e);return t||(t={next:[],current:[],animFrameRequested:!1,inAnimationFrameRunner:!1},Ky.set(e,t)),t}function qy(e,t,i=0){let s=Uy(e),r=new Wy(t,i);return s.next.push(r),s.animFrameRequested||(s.animFrameRequested=!0,e.requestAnimationFrame(()=>function(e){let t=Uy(e);for(t.animFrameRequested=!1,t.current=t.next,t.next=[],t.inAnimationFrameRunner=!0;t.current.length>0;)t.current.sort(Wy.sort),t.current.shift().execute();t.inAnimationFrameRunner=!1}(e))),r}var $y=class extends By{constructor(e){super(),this._defaultTarget=e?Dy(e):void 0}cancelAndSet(e,t,i){super.cancelAndSet(e,t,i??this._defaultTarget??window)}},Vy=class{constructor(e){this.domNode=e,this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._className="",this._position="",this._layerHint=!1,this._contain="none"}setWidth(e){let t=Yy(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Yy(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Yy(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Yy(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Yy(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Yy(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}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}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=e?"translate3d(0px, 0px, 0px)":"")}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}};function Yy(e){return"number"==typeof e?`${e}px`:e}var Gy={};((e,t)=>{for(var i in t)Rx(e,i,{get:t[i],enumerable:!0})})(Gy,{getSafariVersion:()=>rw,getZoomFactor:()=>sw,isChrome:()=>ew,isChromeOS:()=>lw,isFirefox:()=>Qy,isLegacyEdge:()=>tw,isLinux:()=>aw,isMac:()=>nw,isNode:()=>Xy,isSafari:()=>iw,isWindows:()=>ow});var Xy=!!(typeof process<"u"&&"title"in process&&(typeof navigator>"u"||navigator.userAgent.startsWith("Node.js/"))),Jy=Xy?"node":navigator.userAgent,Zy=Xy?"node":navigator.platform,Qy=Jy.includes("Firefox"),ew=Jy.includes("Chrome"),tw=Jy.includes("Edge"),iw=/^((?!chrome|android).)*safari/i.test(Jy);function sw(e){return 1}function rw(){if(!iw)return 0;let e=Jy.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1],10)}var nw=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Zy),ow=["Windows","Win16","Win32","WinCE"].includes(Zy),aw=Zy.indexOf("Linux")>=0,lw=/\bCrOS\b/.test(Jy),cw=new WeakMap;function hw(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,i=e.parent.location;if("null"!==t.origin&&"null"!==i.origin&&t.origin!==i.origin)return null}catch{return null}return e.parent}var uw,dw,fw=class{static _getSameOriginWindowChain(e){let t=cw.get(e);if(!t){t=[],cw.set(e,t);let i,s=e;do{i=hw(s),i?t.push({window:new WeakRef(s),iframeElement:s.frameElement??null}):t.push({window:new WeakRef(s),iframeElement:null}),s=i}while(s)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let i=0,s=0,r=this._getSameOriginWindowChain(e);for(let n of r){let e=n.window.deref();if(i+=(null==e?void 0:e.scrollY)??0,s+=(null==e?void 0:e.scrollX)??0,e===t||!n.iframeElement)break;let r=n.iframeElement.getBoundingClientRect();i+=r.top,s+=r.left}return{top:i,left:s}}},pw=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=0===t.button,this.middleButton=1===t.button,this.rightButton=2===t.button,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail??1,"dblclick"===t.type&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,"number"==typeof t.pageX?(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 i=fw.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},gw=class{constructor(e,t=0,i=0){var s;this.browserEvent=e??null,this.target=e?e.target??e.targetNode??e.srcElement??null:null,this.deltaY=i,this.deltaX=t;let r=!1;if(ew){let e=navigator.userAgent.match(/Chrome\/(\d+)/);r=(e?parseInt(e[1],10):123)<=122}if(e){let t=e,i=e,n=(null==(s=e.view)?void 0:s.devicePixelRatio)??1;if(typeof t.wheelDeltaY<"u")this.deltaY=r?t.wheelDeltaY/(120*n):t.wheelDeltaY/120;else if(typeof i.VERTICAL_AXIS<"u"&&i.axis===i.VERTICAL_AXIS)this.deltaY=-i.detail/3;else if("wheel"===e.type){let t=e;t.deltaMode===t.DOM_DELTA_LINE?this.deltaY=Qy&&!nw?-e.deltaY/3:-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof t.wheelDeltaX<"u")this.deltaX=iw&&ow?-t.wheelDeltaX/120:r?t.wheelDeltaX/(120*n):t.wheelDeltaX/120;else if(typeof i.HORIZONTAL_AXIS<"u"&&i.axis===i.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if("wheel"===e.type){let t=e;t.deltaMode===t.DOM_DELTA_LINE?this.deltaX=Qy&&!nw?-e.deltaX/3:-e.deltaX:this.deltaX=-e.deltaX/40}0===this.deltaY&&0===this.deltaX&&e.wheelDelta&&(this.deltaY=r?e.wheelDelta/(120*n):e.wheelDelta/120)}}preventDefault(){var e;null==(e=this.browserEvent)||e.preventDefault()}stopPropagation(){var e;null==(e=this.browserEvent)||e.stopPropagation()}},vw=class{constructor(){this._hooks=new Cy,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let t=this._onStopCallback;this._onStopCallback=null,e&&t&&t()}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,i,s,r){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=s,this._onStopCallback=r;let n=e;try{e.setPointerCapture(t),this._hooks.add(Sy(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{n=Dy(e)}this._hooks.add(Ry(n,Iy,e=>{e.buttons===i?(e.preventDefault(),this._pointerMoveCallback(e)):this.stopMonitoring(!0)})),this._hooks.add(Ry(n,Fy,e=>this.stopMonitoring(!0)))}},mw=class extends jy{_onclick(e,t){this._register(Ry(e,Ay,i=>t(new pw(Dy(e),i))))}_onmouseover(e,t){this._register(Ry(e,Ty,i=>t(new pw(Dy(e),i))))}_onmouseleave(e,t){this._register(Ry(e,zy,i=>t(new pw(Dy(e),i))))}},_w=class extends mw{constructor(e){super(),this._handleActivate=e.handleActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="xterm-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";let t=Math.min(e.bgWidth,e.bgHeight);this.domNode.style.width=t+"px",this.domNode.style.height=t+"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 vw),this._register(Py(this.bgDomNode,Oy,e=>this._arrowPointerDown(e))),this._register(Py(this.domNode,Oy,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new $y),this._pointerdownScheduleRepeatTimer=this._register(new My)}_arrowPointerDown(e){if(!(e.target&&e.target instanceof Element))return;this._handleActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._handleActivate(),1e3/24,Dy(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},bw=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=(e,t,i)=>{if(this._disposed)return Sy(()=>{});let s={fn:e,thisArgs:t};this._listeners.push(s);let r=Sy(()=>{let e=this._listeners.indexOf(s);-1!==e&&this._listeners.splice(e,1)});return i&&(Array.isArray(i)?i.push(r):i.add(r)),r}),this._event}fire(e){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:t,thisArgs:i}=this._listeners[0];return void t.call(i,e)}default:{let t=this._listeners.slice();for(let{fn:i,thisArgs:s}of t)i.call(s,e)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}};(dw=uw||(uw={})).forward=function(e,t){return e(e=>t.fire(e))},dw.map=function(e,t){return(i,s,r)=>e(e=>i.call(s,t(e)),void 0,r)},dw.any=function(...e){return(t,i,s)=>{let r=new Cy;for(let n of e)r.add(n(e=>t.call(i,e)));return s&&(Array.isArray(s)?s.push(r):s.add(r)),r}},dw.runAndSubscribe=function(e,t,i){return t(i),e(e=>t(e))};var xw=class e{constructor(e,t,i,s,r,n,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,i|=0,s|=0,r|=0,n|=0,o|=0),this.rawScrollLeft=s,this.rawScrollTop=o,t<0&&(t=0),s+t>i&&(s=i-t),s<0&&(s=0),r<0&&(r=0),o+r>n&&(o=n-r),o<0&&(o=0),this.width=t,this.scrollWidth=i,this.scrollLeft=s,this.height=r,this.scrollHeight=n,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,i){return new e(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(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(e,t){let i=this.width!==e.width,s=this.scrollWidth!==e.scrollWidth,r=this.scrollLeft!==e.scrollLeft,n=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,a=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:s,scrollLeftChanged:r,heightChanged:n,scrollHeightChanged:o,scrollTopChanged:a}}},yw=class extends jy{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new bw),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new xw(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 i;let s=this._state.withScrollDimensions(e,t);this._setState(s,!!this._smoothScrolling),null==(i=this._smoothScrolling)||i.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(0!==this._smoothScrollDuration){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 i,s=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===s.scrollLeft&&this._smoothScrolling.to.scrollTop===s.scrollTop)return;i=t?new kw(this._smoothScrolling.from,s,this._smoothScrolling.startTime,this._smoothScrolling.duration):kw.start(this._state,s,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=i}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=kw.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}else this.setScrollPositionNow(e)}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)return this._smoothScrolling.dispose(),void(this._smoothScrolling=null);this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}},ww=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};function Sw(e,t){let i=t-e;return function(t){return e+i*function(e){return 1-function(e){return Math.pow(e,3)}(1-e)}(t)}}var kw=class e{constructor(e,t,i,s){this.from=e,this.to=t,this.duration=s,this.startTime=i,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(e,t,i){if(Math.abs(e-t)>2.5*i){let s,r;return e<t?(s=e+.75*i,r=t-.75*i):(s=e-.75*i,r=t+.75*i),function(e,t,i){return function(s){return s<i?e(s/i):t((s-i)/(1-i))}}(Sw(e,s),Sw(r,t),.33)}return Sw(e,t)}dispose(){null!==this.animationFrameDisposable&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let t=(e-this.startTime)/this.duration;if(t<1){let e=this._scrollLeft(t),i=this._scrollTop(t);return new ww(e,i,!1)}return new ww(this.to.scrollLeft,this.to.scrollTop,!0)}static start(t,i,s){s+=10;let r=Date.now()-10;return new e(t,i,r,s)}};var Cw=class extends jy{constructor(e,t,i){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new My)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return 2!==this._visibility&&(3===this._visibility||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(){this._isNeeded?this._shouldBeVisible?this._reveal():this._hide(!0):this._hide(!1)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;null==(e=this._domNode)||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,null==(t=this._domNode)||t.setClassName(this._invisibleClassName+(e?" xterm-fade":"")))}},jw=class extends mw{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 Cw(e.visibility,"xterm-visible xterm-scrollbar "+e.extraScrollbarClassName,"xterm-invisible xterm-scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new vw),this._shouldRender=!0,this.domNode=new Vy(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(Ry(this.domNode.domNode,Oy,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new _w(e));return this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode),t}_createSlider(e,t,i,s){this.slider=new Vy(document.createElement("div")),this.slider.setClassName("xterm-slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),"number"==typeof i&&this.slider.setWidth(i),"number"==typeof s&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Ry(this.slider.domNode,Oy,e=>{0===e.button&&(e.preventDefault(),this._sliderPointerDown(e))})),this._onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_handleElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_handleElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_handleElementScrollPosition(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._handlePointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,i=t+this._scrollbarState.getSliderPosition(),s=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),r=this._sliderPointerPosition(e);i<=r&&r<=s?0===e.button&&(e.preventDefault(),this._sliderPointerDown(e)):this._handlePointerDown(e)}_handlePointerDown(e){let t,i;if(e.target===this.domNode.domNode&&"number"==typeof e.offsetX&&"number"==typeof e.offsetY)t=e.offsetX,i=e.offsetY;else{let s=function(e){let t=e.getBoundingClientRect(),i=Dy(e);return{left:t.left+i.scrollX,top:t.top+i.scrollY,width:t.width,height:t.height}}(this.domNode.domNode);t=e.pageX-s.left,i=e.pageY-s.top}let s=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),0===e.button&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!(e.target&&e.target instanceof Element))return;let t=this._sliderPointerPosition(e),i=this._sliderOrthogonalPointerPosition(e),s=this._scrollbarState.clone();this.slider.toggleClassName("xterm-active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let r=this._sliderOrthogonalPointerPosition(e),n=Math.abs(r-i);if(ow&&n>140)return void this._setDesiredScrollPositionNow(s.getScrollPosition());let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(s.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName("xterm-active",!1),this._host.handleDragEnd()}),this._host.handleDragStart()}_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()}},Nw=class e{constructor(e,t,i,s,r,n){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(e),this._visibleSize=s,this._scrollSize=r,this._scrollPosition=n,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t&&(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t&&(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t&&(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setArrowSize(e){let t=Math.round(e);this._arrowSize!==t&&(this._arrowSize=t,this._refreshComputedValues())}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,i,s,r){let n=Math.max(0,i-e),o=Math.max(0,n-2*t),a=s>0&&s>i;if(!a)return{computedAvailableSize:Math.round(n),computedIsNeeded:a,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let l=Math.round(Math.max(20,Math.floor(i*o/s))),c=(o-l)/(s-i),h=r*c;return{computedAvailableSize:Math.round(n),computedIsNeeded:a,computedSliderSize:Math.round(l),computedSliderRatio:c,computedSliderPosition:Math.round(h)}}_refreshComputedValues(){let t=e._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(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,i=this._scrollPosition;return t<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},Mw=class extends jw{constructor(e,t,i){let s=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new Nw(t.horizontalHasArrows?t.horizontalScrollbarSize:0,2===t.horizontal?0:t.horizontalScrollbarSize,2===t.vertical?0:t.verticalScrollbarSize,s.width,s.scrollWidth,r.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"xterm-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)}handleScroll(e){return this._shouldRender=this._handleElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._handleElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._handleElementSize(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(2===e.horizontal?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(2===e.vertical?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},Ew=class extends jw{constructor(e,t,i){let s=e.getScrollDimensions(),r=e.getCurrentScrollPosition(),n=t.verticalHasArrows;super({lazyRender:t.lazyRender,host:i,scrollbarState:new Nw(n?t.verticalScrollbarSize:0,2===t.vertical?0:t.verticalScrollbarSize,0,s.height,s.scrollHeight,r.scrollTop),visibility:t.vertical,extraScrollbarClassName:"xterm-vertical",scrollable:e,scrollByPage:t.scrollByPage}),this._arrowScrollDelta=0,this._setArrows(n,t.verticalScrollbarSize),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)}handleScroll(e){return this._shouldRender=this._handleElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._handleElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._handleElementSize(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}_arrowScroll(e){let t=this._scrollable.getCurrentScrollPosition();this._scrollable.setScrollPositionNow({scrollTop:t.scrollTop+e})}_setArrows(e,t){if(this._arrowScrollDelta=t,(!this._arrowUp||!this._arrowDown)&&(this._arrowUp=this._createArrow({className:"xterm-scra xterm-arrow-up",top:0,left:0,bgWidth:t,bgHeight:t,handleActivate:()=>this._arrowScroll(-this._arrowScrollDelta)}),this._arrowDown=this._createArrow({className:"xterm-scra xterm-arrow-down",bottom:0,left:0,bgWidth:t,bgHeight:t,handleActivate:()=>this._arrowScroll(this._arrowScrollDelta)})),this._updateArrowSize(this._arrowUp,t),this._updateArrowSize(this._arrowDown,t),!this._arrowUp||!this._arrowDown)return;let i=e?"":"none";this._arrowUp.bgDomNode.style.display=i,this._arrowUp.domNode.style.display=i,this._arrowDown.bgDomNode.style.display=i,this._arrowDown.domNode.style.display=i}_updateArrowSize(e,t){e&&(e.bgDomNode.style.width=`${t}px`,e.bgDomNode.style.height=`${t}px`,e.domNode.style.width=`${t}px`,e.domNode.style.height=`${t}px`)}updateOptions(e){let t=e.verticalHasArrows?e.verticalScrollbarSize:0;this._scrollbarState.setArrowSize(t),this._setArrows(e.verticalHasArrows,e.verticalScrollbarSize),this.updateScrollbarSize(2===e.vertical?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},Bw=class{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}},Dw=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(-1===this._front&&-1===this._rear)return!1;let e=1,t=0,i=1,s=this._rear;for(;-1!==s;){let r=s===this._front?e:Math.pow(2,-i);if(e-=r,t+=this._memory[s].score*r,s===this._front)break;s=(this._capacity+s-1)%this._capacity,i++}return t<=.5}acceptStandardWheelEvent(e){if(ew){Dy(e.browserEvent);let t=1;this.accept(Date.now(),e.deltaX*t,e.deltaY*t)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,i){let s=null,r=new Bw(e,t,i);-1===this._front&&-1===this._rear?(this._memory[0]=r,this._front=0,this._rear=0):(s=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]=r),r.score=this._computeScore(r,s)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(i+=.25),t){let s=Math.abs(e.deltaX),r=Math.abs(e.deltaY),n=Math.abs(t.deltaX),o=Math.abs(t.deltaY),a=Math.max(Math.min(s,n),1),l=Math.max(Math.min(r,o),1),c=Math.max(s,n),h=Math.max(r,o);c%a===0&&h%l===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};Dw.INSTANCE=new Dw;var Lw=Dw,Rw=class extends mw{constructor(e,t,i){super(),this._onScroll=this._register(new bw),this.onScroll=this._onScroll.event,t=t??{};let s,r=!i;i?s=i:(t.mouseWheelSmoothScroll=!1,s=new yw({forceIntegerValues:!0,smoothScrollDuration:0,scheduleAtNextAnimationFrame:t=>qy(Dy(e),t)})),this._options=function(e){let t={lazyRender:typeof e.lazyRender<"u"&&e.lazyRender,className:typeof e.className<"u"?e.className:"",useShadows:!(typeof e.useShadows<"u")||e.useShadows,handleMouseWheel:!(typeof e.handleMouseWheel<"u")||e.handleMouseWheel,flipAxes:typeof e.flipAxes<"u"&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"&&e.alwaysConsumeMouseWheel,scrollYToX:typeof e.scrollYToX<"u"&&e.scrollYToX,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:!(typeof e.scrollPredominantAxis<"u")||e.scrollPredominantAxis,mouseWheelSmoothScroll:!(typeof e.mouseWheelSmoothScroll<"u")||e.mouseWheelSmoothScroll,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,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"&&e.verticalHasArrows,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"&&e.scrollByPage};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,nw&&(t.className+=" xterm-mac"),t}(t),this._scrollable=s,this._register(this._scrollable.onScroll(e=>{this._handleScroll(e),this._onScroll.fire(e)})),r&&this._register(this._scrollable);let n={handleMouseWheel:e=>this._handleMouseWheel(e),handleDragStart:()=>this._handleDragStart(),handleDragEnd:()=>this._handleDragEnd()};this._verticalScrollbar=this._register(new Ew(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new Mw(this._scrollable,this._options,n)),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=new Vy(document.createElement("div")),this._leftShadowDomNode.setClassName("xterm-shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=new Vy(document.createElement("div")),this._topShadowDomNode.setClassName("xterm-shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=new Vy(document.createElement("div")),this._topLeftShadowDomNode.setClassName("xterm-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,e=>this._handleMouseOver(e)),this._onmouseleave(this._listenOnDomNode,e=>this._handleMouseLeave(e)),this._hideTimeout=this._register(new My),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=ky(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}updateClassName(e){this._options.className=e,nw&&(this._options.className+=" xterm-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.horizontalHasArrows<"u"&&(this._options.horizontalHasArrows=e.horizontalHasArrows),typeof e.verticalHasArrows<"u"&&(this._options.verticalHasArrows=e.verticalHasArrows),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()}delegateScrollFromMouseWheelEvent(e){this._handleMouseWheel(new gw(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=ky(this._mouseWheelToDispose),e)){let e=e=>{this._handleMouseWheel(new gw(e))};this._mouseWheelToDispose.push(Ry(this._listenOnDomNode,Hy,e,{passive:!1}))}}_handleMouseWheel(e){var t;if(null==(t=e.browserEvent)?void 0:t.defaultPrevented)return;let i=Lw.INSTANCE;i.acceptStandardWheelEvent(e);let s=!1;if(e.deltaY||e.deltaX){let t=e.deltaY*this._options.mouseWheelScrollSensitivity,r=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&r+t===0?r=t=0:Math.abs(t)>=Math.abs(r)?r=0:t=0),this._options.flipAxes&&([t,r]=[r,t]);let n=!nw&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||n)&&!r&&(r=t,t=0),e.browserEvent&&e.browserEvent.altKey&&(r*=this._options.fastScrollSensitivity,t*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),a={};if(t){let e=50*t,i=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(a,i)}if(r){let e=50*r,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(a,t)}a=this._scrollable.validateScrollPosition(a),(o.scrollLeft!==a.scrollLeft||o.scrollTop!==a.scrollTop)&&(this._options.mouseWheelSmoothScroll&&i.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(a):this._scrollable.setScrollPositionNow(a),s=!0)}let r=s;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_handleScroll(e){this._shouldRender=this._horizontalScrollbar.handleScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.handleScroll(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,i=e.scrollLeft>0,s=i?" xterm-shadow-left":"",r=t?" xterm-shadow-top":"",n=i||t?" xterm-shadow-top-left-corner":"";this._leftShadowDomNode.setClassName(`xterm-shadow${s}`),this._topShadowDomNode.setClassName(`xterm-shadow${r}`),this._topLeftShadowDomNode.setClassName(`xterm-shadow${n}${r}${s}`)}}_handleDragStart(){this._isDragging=!0,this._reveal()}_handleDragEnd(){this._isDragging=!1,this._hide()}_handleMouseLeave(e){this._mouseIsOver=!1,this._hide()}_handleMouseOver(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(),500)}};var Pw=class extends jy{constructor(e,t,i,s,r,n,o,a,l){var c;super(),this._bufferService=i,this._coreService=r,this._optionsService=a,this._renderService=l,this._onRequestScrollLines=this._register(new bw),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1,this._needsSyncOnRender=!1;let h=this._register(new yw({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>qy(s.window,e)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{h.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Rw(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,verticalHasArrows:(null==(c=this._optionsService.rawOptions.scrollbar)?void 0:c.showArrows)??!1,...this._getChangeOptions()},h)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","scrollbar"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(n.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(16&e)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(uw.runAndSubscribe(o.onChangeColors,()=>{e.style.backgroundColor=o.colors.background.css,this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Sy(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Sy(()=>this._styleElement.remove())),this._register(uw.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .xterm-scrollbar > .xterm-slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .xterm-scrollbar > .xterm-slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .xterm-scrollbar > .xterm-slider.xterm-active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join("\n")})),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._renderService.onRender(()=>{this._needsSyncOnRender&&(this._needsSyncOnRender=!1,this._sync())})),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}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,t,i;let s=(null==(e=this._optionsService.rawOptions.scrollbar)?void 0:e.showScrollbar)??!0,r=(null==(t=this._optionsService.rawOptions.scrollbar)?void 0:t.showArrows)??!1,n=s?(null==(i=this._optionsService.rawOptions.scrollbar)?void 0:i.width)??14:0;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,vertical:s?1:2,verticalScrollbarSize:n,verticalHasArrows:r}}queueSync(e){void 0!==e&&(this._latestYDisp=e),void 0===this._queuedAnimationFrame&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){if(this._renderService&&!this._isSyncing){if(this._coreService.decPrivateModes.synchronizedOutput)return void(this._needsSyncOnRender=!0);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),i=t-this._bufferService.buffer.ydisp;0!==i&&(this._latestYDisp=t,this._onRequestScrollLines.fire(i)),this._isHandlingScroll=!1}handleTouchScroll(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({scrollTop:t.scrollTop-e})}};Pw=Ax([Tx(2,ty),Tx(3,py),Tx(4,sy),Tx(5,iy),Tx(6,xy),Tx(7,ay),Tx(8,my)],Pw);var Aw=class extends jy{constructor(e,t,i,s,r){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=i,this._decorationService=s,this._renderService=r,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(Sy(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){void 0===this._animationFrame&&(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 t;let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer","top"===(null==(t=null==e?void 0:e.options)?void 0:t.layer)),i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let s=e.options.x??0;return s&&s>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(e,i),i}_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 i=this._decorationElements.get(e);i||(i=this._createElement(e),e.element=i,this._decorationElements.set(e,i),this._container.appendChild(i),e.onDispose(()=>{this._decorationElements.delete(e),i.remove()})),i.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=t*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(i)}}_refreshXPosition(e,t=e.element){if(!t)return;let i=e.options.x??0;"right"===(e.options.anchor||"left")?t.style.right=i?i*this._renderService.dimensions.css.cell.width+"px":"":t.style.left=i?i*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(e){var t;null==(t=this._decorationElements.get(e))||t.remove(),this._decorationElements.delete(e),e.dispose()}};Aw=Ax([Tx(1,ty),Tx(2,py),Tx(3,hy),Tx(4,my)],Aw);var Tw=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))return void this._addLineToZone(t,e.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return 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,void this._zones.push(this._zonePool[this._zonePoolIndex++]);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,i){return t>=e.startBufferLine-this._linePadding[i||"full"]&&t<=e.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},zw={full:0,left:0,center:0,right:0},Ow={full:0,left:0,center:0,right:0},Iw={full:0,left:0,center:0,right:0},Fw=class extends jy{constructor(e,t,i,s,r,n,o,a){var l;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=s,this._renderService=r,this._optionsService=n,this._themeService=o,this._coreBrowserService=a,this._colorZoneStore=new Tw,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(),null==(l=this._viewportElement.parentElement)||l.insertBefore(this._canvas,this._viewportElement),this._register(Sy(()=>{var e;return null==(e=this._canvas)?void 0:e.remove()}));let c=this._canvas.getContext("2d");if(!c)throw new Error("Ctx cannot be null");this._ctx=c,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.onDimensionsChange(()=>this._queueRefresh(!0))),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("scrollbar",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._register(Sy(()=>{void 0!==this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)})),this._queueRefresh(!0)}get _width(){let e=this._optionsService.rawOptions.scrollbar;return(null==e?void 0:e.showScrollbar)??1?(null==e?void 0:e.width)??0:0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Ow.full=this._canvas.width,Ow.left=e,Ow.center=t,Ow.right=e,this._refreshDrawHeightConstants(),Iw.full=1,Iw.left=1,Iw.center=1+Ow.left,Iw.right=1+Ow.left+Ow.center}_refreshDrawHeightConstants(){zw.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);zw.left=t,zw.center=t,zw.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*zw.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*zw.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*zw.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*zw.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){if(this._store.isDisposed||!this._renderService.hasRenderer())return;let e=this._renderService.dimensions.css.canvas.height,t=this._renderService.dimensions.device.canvas.height;this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${e}px`,this._canvas.height=t,this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){if(this._store.isDisposed||!this._renderService.hasRenderer())return;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)"full"!==t.position&&this._renderColorZone(t);for(let t of e)"full"===t.position&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){var e,t,i,s;this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),(null==(t=null==(e=this._optionsService.rawOptions.scrollbar)?void 0:e.overviewRuler)?void 0:t.showTopBorder)&&this._ctx.fillRect(1,0,this._canvas.width-1,1),(null==(s=null==(i=this._optionsService.rawOptions.scrollbar)?void 0:i.overviewRuler)?void 0:s.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(Iw[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-zw[e.position||"full"]/2),Ow[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+zw[e.position||"full"]))}_queueRefresh(e,t){this._store.isDisposed||(this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,void 0===this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._store.isDisposed||this._refreshDecorations(),this._animationFrame=void 0})))}};Fw=Ax([Tx(2,ty),Tx(3,hy),Tx(4,my),Tx(5,ay),Tx(6,xy),Tx(7,py)],Fw);var Hw=class{constructor(e,t,i,s,r,n){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=s,this._coreService=r,this._renderService=n,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._compositionSuffix="",this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0;let e=this._textarea.selectionStart??this._textarea.value.length,t=this._textarea.selectionEnd??e;this._compositionPosition.start=Math.min(e,t),this._compositionPosition.end=Math.max(e,t),this._compositionSuffix=this._textarea.value.substring(this._compositionPosition.end),this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=`‎${e.data}‎`,this.updateCompositionElements(),setTimeout(()=>{let e=this._textarea.selectionEnd??this._textarea.value.length;this._compositionPosition.end=Math.max(this._compositionPosition.start,e)},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(20===e.keyCode||229===e.keyCode||16===e.keyCode||17===e.keyCode||18===e.keyCode)return!1;this._finalizeComposition(!1)}return 229!==e.keyCode||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end},t=this._compositionSuffix;this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let i;if(this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,this._isComposing)i=this._textarea.value.substring(e.start,this._compositionPosition.start);else{let s=this._textarea.value,r=t.length>0&&s.endsWith(t)?s.length-t.length:s.length;i=s.substring(e.start,Math.max(e.start,r))}i.length>0&&this._coreService.triggerDataEvent(i,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){if(this._textareaChangeTimer)return;let e=this._textarea.value;this._textareaChangeTimer=window.setTimeout(()=>{if(this._textareaChangeTimer=void 0,!this._isComposing){let t=this._textarea.value,i=t.replace(e,"");this._dataAlreadySent=i,t.length>e.length?this._coreService.triggerDataEvent(i,!0):t.length<e.length?this._coreService.triggerDataEvent("",!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=t+"px",this._compositionView.style.lineHeight=t+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let r=this._bufferService.cols*this._renderService.dimensions.css.cell.width-s;this._compositionView.style.maxWidth=r+"px",this._compositionView.style.overflow="hidden",this._compositionView.style.direction="rtl";let n=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(n.width,1)+"px",this._textarea.style.height=Math.max(n.height,1)+"px",this._textarea.style.lineHeight=n.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Hw=Ax([Tx(2,ty),Tx(3,ay),Tx(4,sy),Tx(5,my)],Hw);var Ww,Kw,Uw,qw,$w,Vw,Yw=0,Gw=0,Xw=0,Jw=0,Zw={css:"#00000000",rgba:0};function Qw(e){let t=e.toString(16);return t.length<2?"0"+t:t}function eS(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}(Kw=Ww||(Ww={})).toCss=function(e,t,i,s){return void 0!==s?`#${Qw(e)}${Qw(t)}${Qw(i)}${Qw(s)}`:`#${Qw(e)}${Qw(t)}${Qw(i)}`},Kw.toRgba=function(e,t,i,s=255){return(e<<24|t<<16|i<<8|s)>>>0},Kw.toColor=function(e,t,i,s){return{css:Kw.toCss(e,t,i,s),rgba:Kw.toRgba(e,t,i,s)}},(e=>{function t(e,t){return Jw=Math.round(255*t),[Yw,Gw,Xw]=Vw.toChannels(e.rgba),{css:Ww.toCss(Yw,Gw,Xw,Jw),rgba:Ww.toRgba(Yw,Gw,Xw,Jw)}}e.blend=function(e,t){if(1===(Jw=(255&t.rgba)/255))return{css:t.css,rgba:t.rgba};let i=t.rgba>>24&255,s=t.rgba>>16&255,r=t.rgba>>8&255,n=e.rgba>>24&255,o=e.rgba>>16&255,a=e.rgba>>8&255;return Yw=n+Math.round((i-n)*Jw),Gw=o+Math.round((s-o)*Jw),Xw=a+Math.round((r-a)*Jw),{css:Ww.toCss(Yw,Gw,Xw),rgba:Ww.toRgba(Yw,Gw,Xw)}},e.isOpaque=function(e){return!(255&~e.rgba)},e.ensureContrastRatio=function(e,t,i){let s=Vw.ensureContrastRatio(e.rgba,t.rgba,i);if(s)return Ww.toColor(s>>24&255,s>>16&255,s>>8&255)},e.opaque=function(e){let t=(255|e.rgba)>>>0;return[Yw,Gw,Xw]=Vw.toChannels(t),{css:Ww.toCss(Yw,Gw,Xw),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,i){return t(e,(Jw=255&e.rgba)*i/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}})(Uw||(Uw={})),(e=>{let t,i;try{let e=document.createElement("canvas");e.width=1,e.height=1;let s=e.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return Yw=parseInt(e.slice(1,2).repeat(2),16),Gw=parseInt(e.slice(2,3).repeat(2),16),Xw=parseInt(e.slice(3,4).repeat(2),16),Ww.toColor(Yw,Gw,Xw);case 5:return Yw=parseInt(e.slice(1,2).repeat(2),16),Gw=parseInt(e.slice(2,3).repeat(2),16),Xw=parseInt(e.slice(3,4).repeat(2),16),Jw=parseInt(e.slice(4,5).repeat(2),16),Ww.toColor(Yw,Gw,Xw,Jw);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let s=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return Yw=parseInt(s[1],10),Gw=parseInt(s[2],10),Xw=parseInt(s[3],10),Jw=Math.round(255*(void 0===s[5]?1:parseFloat(s[5]))),Ww.toColor(Yw,Gw,Xw,Jw);if("transparent"===e)return{css:"transparent",rgba:0};if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=e,"string"!=typeof t.fillStyle)throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Yw,Gw,Xw,Jw]=t.getImageData(0,0,1,1).data,255!==Jw)throw new Error("css.toColor: Unsupported css format");return{rgba:Ww.toRgba(Yw,Gw,Xw,Jw),css:e}}})(qw||(qw={})),(e=>{function t(e,t,i){let s=e/255,r=t/255,n=i/255;return.2126*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t})($w||($w={})),(e=>{function t(e,t,i){let s=e>>24&255,r=e>>16&255,n=e>>8&255,o=t>>24&255,a=t>>16&255,l=t>>8&255,c=eS($w.relativeLuminance2(o,a,l),$w.relativeLuminance2(s,r,n));for(;c<i&&(o>0||a>0||l>0);)o-=Math.max(0,Math.ceil(.1*o)),a-=Math.max(0,Math.ceil(.1*a)),l-=Math.max(0,Math.ceil(.1*l)),c=eS($w.relativeLuminance2(o,a,l),$w.relativeLuminance2(s,r,n));return(o<<24|a<<16|l<<8|255)>>>0}function i(e,t,i){let s=e>>24&255,r=e>>16&255,n=e>>8&255,o=t>>24&255,a=t>>16&255,l=t>>8&255,c=eS($w.relativeLuminance2(o,a,l),$w.relativeLuminance2(s,r,n));for(;c<i&&(o<255||a<255||l<255);)o=Math.min(255,o+Math.ceil(.1*(255-o))),a=Math.min(255,a+Math.ceil(.1*(255-a))),l=Math.min(255,l+Math.ceil(.1*(255-l))),c=eS($w.relativeLuminance2(o,a,l),$w.relativeLuminance2(s,r,n));return(o<<24|a<<16|l<<8|255)>>>0}e.blend=function(e,t){if(1===(Jw=(255&t)/255))return t;let i=t>>24&255,s=t>>16&255,r=t>>8&255,n=e>>24&255,o=e>>16&255,a=e>>8&255;return Yw=n+Math.round((i-n)*Jw),Gw=o+Math.round((s-o)*Jw),Xw=a+Math.round((r-a)*Jw),Ww.toRgba(Yw,Gw,Xw)},e.ensureContrastRatio=function(e,s,r){let n=$w.relativeLuminance(e>>8),o=$w.relativeLuminance(s>>8);if(eS(n,o)<r){if(o<n){let o=t(e,s,r),a=eS(n,$w.relativeLuminance(o>>8));if(a<r){let t=i(e,s,r);return a>eS(n,$w.relativeLuminance(t>>8))?o:t}return o}let a=i(e,s,r),l=eS(n,$w.relativeLuminance(a>>8));if(l<r){let i=t(e,s,r);return l>eS(n,$w.relativeLuminance(i>>8))?a:i}return a}},e.reduceLuminance=t,e.increaseLuminance=i,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}})(Vw||(Vw={}));var tS=class extends Xx{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}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()]}},iS=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Zx}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(0===this._characterJoiners.length)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||0===t.length)return[];let i=[],s=t.translateToString(!0),r=t.getTrimmedLength(),n=0,o=0,a=0,l=t.getFg(0),c=t.getBg(0);for(let h=0;h<r;h++)if(t.loadCell(h,this._workCell),0!==this._workCell.getWidth()){if(this._workCell.fg!==l||this._workCell.bg!==c){if(h-n>1){let e=this._getJoinedRanges(s,a,o,t,n);for(let t=0;t<e.length;t++)i.push(e[t])}n=h,a=o,l=this._workCell.fg,c=this._workCell.bg}o+=this._workCell.getChars().length||1}if(r-n>1){let e=this._getJoinedRanges(s,a,o,t,n);for(let t=0;t<e.length;t++)i.push(e[t])}return i}_getJoinedRanges(e,t,i,s,r){let n=e.substring(t,i),o=[];try{o=this._characterJoiners[0].handler(n)}catch(a){console.error(a)}for(let c=1;c<this._characterJoiners.length;c++)try{let e=this._characterJoiners[c].handler(n);for(let t=0;t<e.length;t++)iS._mergeRanges(o,e[t])}catch(l){console.error(l)}return this._stringRangesToCellRanges(o,s,r),o}_stringRangesToCellRanges(e,t,i){let s=0,r=!1,n=0,o=e[s];if(!o)return;let a=t.getTrimmedLength();for(let l=i;l<a;l++){let i=t.getWidth(l),a=t.getString(l).length||1;if(0!==i){if(!r&&o[0]<=n&&(o[0]=l,r=!0),o[1]<=n){if(o[1]=l,o=e[++s],!o)break;o[0]<=n?(o[0]=l,r=!0):r=!1}n+=a}}o&&(o[1]=a)}static _mergeRanges(e,t){let i=!1;for(let s=0;s<e.length;s++){let r=e[s];if(i){if(t[1]<=r[0])return e[s-1][1]=t[1],e;if(t[1]<=r[1])return e[s-1][1]=Math.max(t[1],r[1]),e.splice(s,1),e;e.splice(s,1),s--}else{if(t[1]<=r[0])return e.splice(s,0,t),e;if(t[1]<=r[1])return r[0]=Math.min(t[0],r[0]),e;t[0]<r[1]&&(r[0]=Math.min(t[0],r[0]),i=!0)}}return i?e[e.length-1][1]=t[1]:e.push(t),e}};function sS(e){if(!e)throw new Error("value must not be falsy");return e}iS=Ax([Tx(0,ty)],iS);var rS=class{constructor(e,t,i,s,r,n,o){this._document=e,this._characterJoinerService=t,this._optionsService=i,this._coreBrowserService=s,this._coreService=r,this._decorationService=n,this._themeService=o,this._workCell=new Zx,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,i){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=i}createRow(e,t,i,s,r,n,o,a,l,c,h,u,d){let f=[];d&&(d.hasBlinkingCells=!1);let p=this._characterJoinerService.getJoinedCharacters(t),g=this._themeService.colors,v=e.getNoBgTrimmedLength();i&&v<n+1&&(v=n+1);let m,_,b,x=0,y="",w=0,S=0,k=0,C=!1,j=0,N=!1,M=0,E=[],B=-1!==h&&-1!==u;for(let D=0;D<v;D++){e.loadCell(D,this._workCell);let v=this._workCell.getWidth();if(0===v)continue;let L=!1,R=D>=M,P=D,A=this._workCell;if(p.length>0&&D===p[0][0]&&R){let s=p.shift(),r=this._isCellInSelection(s[0],t);for(_=s[0]+1;_<s[1];_++)R&&(R=r===this._isCellInSelection(_,t));R&&(R=!i||n<s[0]||n>=s[1]),R?(L=!0,A=new tS(this._workCell,e.translateToString(!0,s[0],s[1]),s[1]-s[0]),P=s[1]-1,v=A.getWidth()):M=s[1]}let T=this._isCellInSelection(D,t),z=i&&D===n,O=B&&D>=h&&D<=u;d&&A.isBlink()&&(d.hasBlinkingCells=!0),!a&&A.isBlink()&&E.push("xterm-blink-hidden");let I=!1;this._decorationService.forEachDecorationAtCell(D,t,void 0,e=>{I=!0});let F=A.getChars()||" ";if(" "===F&&(A.isUnderline()||A.isOverline())&&(F=" "),b=v*l-c.get(F,A.isBold(),A.isItalic()),m){if(x&&(T&&N||!T&&!N&&A.bg===w)&&(T&&N&&g.selectionForeground||A.fg===S)&&A.extended.ext===k&&O===C&&b===j&&!z&&!L&&!I&&R){A.isInvisible()?y+=" ":y+=F,x++;continue}x&&(m.textContent=y),m=this._document.createElement("span"),x=0,y=""}else m=this._document.createElement("span");if(w=A.bg,S=A.fg,k=A.extended.ext,C=O,j=b,N=T,L&&n>=D&&n<=P&&(n=D),!this._coreService.isCursorHidden&&z&&this._coreService.isCursorInitialized)if(E.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&E.push("xterm-cursor-blink"),E.push("bar"===s?"xterm-cursor-bar":"underline"===s?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":E.push("xterm-cursor-outline");break;case"block":E.push("xterm-cursor-block");break;case"bar":E.push("xterm-cursor-bar");break;case"underline":E.push("xterm-cursor-underline")}if(A.isBold()&&E.push("xterm-bold"),A.isItalic()&&E.push("xterm-italic"),A.isDim()&&E.push("xterm-dim"),y=A.isInvisible()?" ":A.getChars()||" ",A.isUnderline()&&(E.push(`xterm-underline-${A.extended.underlineStyle}`)," "===y&&(y=" "),!A.isUnderlineColorDefault()))if(A.isUnderlineColorRGB())m.style.textDecorationColor=`rgb(${Xx.toColorRGB(A.getUnderlineColor()).join(",")})`;else{let e=A.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&A.isBold()&&e<8&&(e+=8),m.style.textDecorationColor=g.ansi[e].css}A.isOverline()&&(E.push("xterm-overline")," "===y&&(y=" ")),A.isStrikethrough()&&E.push("xterm-strikethrough"),O&&(m.style.textDecoration="underline");let H=A.getFgColor(),W=A.getFgColorMode(),K=A.getBgColor(),U=A.getBgColorMode(),q=!!A.isInverse();if(q){let e=H;H=K,K=e;let t=W;W=U,U=t}let $,V,Y,G=!1;switch(this._decorationService.forEachDecorationAtCell(D,t,void 0,e=>{"top"!==e.options.layer&&G||(e.backgroundColorRGB&&(U=50331648,K=e.backgroundColorRGB.rgba>>8&16777215,$=e.backgroundColorRGB),e.foregroundColorRGB&&(W=50331648,H=e.foregroundColorRGB.rgba>>8&16777215,V=e.foregroundColorRGB),G="top"===e.options.layer)}),!G&&T&&($=this._coreBrowserService.isFocused?g.selectionBackgroundOpaque:g.selectionInactiveBackgroundOpaque,K=$.rgba>>8&16777215,U=50331648,G=!0,g.selectionForeground&&(W=50331648,H=g.selectionForeground.rgba>>8&16777215,V=g.selectionForeground)),G&&E.push("xterm-decoration-top"),U){case 16777216:case 33554432:Y=g.ansi[K],E.push(`xterm-bg-${K}`);break;case 50331648:Y=Ww.toColor(K>>16,K>>8&255,255&K),this._addStyle(m,`background-color:#${(K>>>0).toString(16).padStart(6,"0")}`);break;default:q?(Y=g.foreground,E.push("xterm-bg-257")):Y=g.background}switch($||A.isDim()&&($=Uw.multiplyOpacity(Y,.5)),W){case 16777216:case 33554432:A.isBold()&&H<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(H+=8),this._applyMinimumContrast(m,Y,g.ansi[H],A,$,void 0)||E.push(`xterm-fg-${H}`);break;case 50331648:let e=Ww.toColor(H>>16&255,H>>8&255,255&H);this._applyMinimumContrast(m,Y,e,A,$,V)||this._addStyle(m,`color:#${H.toString(16).padStart(6,"0")}`);break;default:this._applyMinimumContrast(m,Y,g.foreground,A,$,V)||q&&E.push("xterm-fg-257")}E.length&&(m.className=E.join(" "),E.length=0),z||L||I||!R?m.textContent=y:x++,b!==this.defaultSpacing&&(m.style.letterSpacing=`${b}px`),f.push(m),D=P}return m&&x&&(m.textContent=y),f}_applyMinimumContrast(e,t,i,s,r,n){if(1===this._optionsService.rawOptions.minimumContrastRatio||(function(e){return 57508<=e&&e<=57558}(o=s.getCode())||function(e){return 9472<=e&&e<=9631}(o)))return!1;var o;let a,l=this._getContrastCache(s);if(!r&&!n&&(a=l.getColor(t.rgba,i.rgba)),void 0===a){let e=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);a=Uw.ensureContrastRatio(r??t,n??i,e),l.setColor((r??t).rgba,(n??i).rgba,a??null)}return!!a&&(this._addStyle(e,`color:${a.css}`),!0)}_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 i=this._selectionStart,s=this._selectionEnd;return!(!i||!s)&&(this._columnSelectMode?i[0]<=s[0]?e>=i[0]&&t>=i[1]&&e<s[0]&&t<=s[1]:e<i[0]&&t>=i[1]&&e>=s[0]&&t<=s[1]:t>i[1]&&t<s[1]||i[1]===s[1]&&t===i[1]&&e>=i[0]&&e<s[0]||i[1]<s[1]&&t===s[1]&&e<s[0]||i[1]<s[1]&&t===i[1]&&e>=i[0])}};rS=Ax([Tx(1,by),Tx(2,ay),Tx(3,py),Tx(4,sy),Tx(5,hy),Tx(6,xy)],rS);var nS=class{constructor(e=()=>new oS){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._canvasElements=[],this._canvasElements=[e(),e(),e(),e()],this.clear()}dispose(){this._canvasElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,i,s){e===this._font&&t===this._fontSize&&i===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=s,this._canvasElements[0].setFont(e,t,i,!1),this._canvasElements[1].setFont(e,t,s,!1),this._canvasElements[2].setFont(e,t,i,!0),this._canvasElements[3].setFont(e,t,s,!0),this.clear())}get(e,t,i){let s;if(!t&&!i&&1===e.length&&(s=e.charCodeAt(0))<256){if(-9999!==this._flat[s])return this._flat[s];let t=this._measure(e,0);return t>0&&(this._flat[s]=t),t}let r=e;t&&(r+="B"),i&&(r+="I");let n=this._holey.get(r);if(void 0===n){let s=0;t&&(s|=1),i&&(s|=2),n=this._measure(e,s),n>0&&this._holey.set(r,n)}return n}_measure(e,t){return this._canvasElements[t].measure(e)}},oS=class{constructor(){typeof OffscreenCanvas<"u"?(this._canvas=new OffscreenCanvas(1,1),this._ctx=sS(this._canvas.getContext("2d"))):(this._canvas=document.createElement("canvas"),this._canvas.width=1,this._canvas.height=1,this._ctx=sS(this._canvas.getContext("2d")))}setFont(e,t,i,s){let r=s?"italic":"";this._ctx.font=`${r} ${i} ${t}px ${e}`.trim()}measure(e){return this._ctx.measureText(e).width}},aS=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,i,s=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1])return void this.clear();let r=e.buffers.active.ydisp,n=t[1]-r,o=i[1]-r,a=Math.max(n,0),l=Math.min(o,e.rows-1);a>=e.rows||l<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=l,this.startCol=t[0],this.endCol=i[0])}isCellSelected(e,t,i){return!!this.hasSelection&&(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol)}};var lS=class extends jy{constructor(e,t,i){super(),this._renderCallback=e,this._coreBrowserService=t,this._optionsService=i,this._intervalDuration=0,this._blinkOn=!0,this._needsBlinkInViewport=!1,this._isViewportVisible=!0,this._register(this._optionsService.onSpecificOptionChange("blinkIntervalDuration",e=>{this.setIntervalDuration(e)})),this.setIntervalDuration(this._optionsService.rawOptions.blinkIntervalDuration),this._register(Sy(()=>this._clearInterval()))}get isBlinkOn(){return this._blinkOn}get isEnabled(){return this._intervalDuration>0}setNeedsBlinkInViewport(e){this._needsBlinkInViewport!==e&&(this._needsBlinkInViewport=e,this._updateIntervalState())}setViewportVisible(e){this._isViewportVisible!==e&&(this._isViewportVisible=e,this._updateIntervalState())}setIntervalDuration(e){e!==this._intervalDuration&&(this._intervalDuration=e,this._clearInterval(),this._updateIntervalState())}_updateIntervalState(){if(this._intervalDuration>0&&this._needsBlinkInViewport&&this._isViewportVisible){if(void 0!==this._interval)return;let e=this._blinkOn;return this._blinkOn=!0,this._interval=this._coreBrowserService.window.setInterval(()=>{this._blinkOn=!this._blinkOn,this._renderCallback()},this._intervalDuration),void(e||this._renderCallback())}this._clearInterval(),this._blinkOn||(this._blinkOn=!0,this._renderCallback())}_clearInterval(){void 0!==this._interval&&(this._coreBrowserService.window.clearInterval(this._interval),this._interval=void 0)}},cS=1,hS=class extends jy{constructor(e,t,i,s,r,n,o,a,l,c,h,u,d,f){super(),this._terminal=e,this._document=t,this._element=i,this._screenElement=s,this._viewportElement=r,this._helperContainer=n,this._linkifier2=o,this._charSizeService=l,this._optionsService=c,this._bufferService=h,this._coreService=u,this._coreBrowserService=d,this._themeService=f,this._terminalClass=cS++,this._rowElements=[],this._selectionRenderModel=new aS,this._lastSelectionColumnMode=!1,this._rowHasBlinkingCells=[],this._rowHasBlinkingCellsCount=0,this._onRequestRedraw=this._register(new bw),this.onRequestRedraw=this._onRequestRedraw.event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add("xterm-rows"),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("xterm-selection"),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions={css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}},this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=a.createInstance(rS,document),this._element.classList.add("xterm-dom-renderer-owner-"+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._cursorBlinkStateManager=new uS(this._rowContainer,this._coreBrowserService),this._register(Ry(this._document,"mousedown",()=>this._cursorBlinkStateManager.restartBlinkAnimation())),this._register(Sy(()=>this._cursorBlinkStateManager.dispose())),this._textBlinkStateManager=this._register(new lS(()=>this._onRequestRedraw.fire({start:0,end:this._bufferService.rows-1}),this._coreBrowserService,this._optionsService)),this._register(Sy(()=>{this._element.classList.remove("xterm-dom-renderer-owner-"+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new nS,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 i of this._rowElements)i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .xterm-rows 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} .xterm-rows { pointer-events: none; color: ${e.foreground.css};}`;t+=`${this._terminalSelector} .xterm-rows, ${this._terminalSelector} .xterm-rows span { font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`,t+=`${this._terminalSelector} .xterm-rows .xterm-dim { color: ${Uw.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;}${this._terminalSelector} span.xterm-blink-hidden { visibility: hidden;}`;let i=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;t+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${s} { 50% { box-shadow: none; }}`,t+=`@keyframes ${r} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .xterm-rows.xterm-focus .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .xterm-rows.xterm-focus .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .xterm-rows.xterm-focus .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .xterm-rows.xterm-cursor-blink-idle .xterm-cursor.xterm-cursor-blink { animation: none !important;}${this._terminalSelector} .xterm-rows .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .xterm-rows .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .xterm-rows .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .xterm-rows .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .xterm-rows .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .xterm-selection { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .xterm-selection div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .xterm-selection div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,o]of e.ansi.entries())t+=`${this._terminalSelector} .xterm-fg-${n} { color: ${o.css}; }${this._terminalSelector} .xterm-fg-${n}.xterm-dim { color: ${Uw.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .xterm-bg-${n} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .xterm-fg-257 { color: ${Uw.opaque(e.background).css}; }${this._terminalSelector} .xterm-fg-257.xterm-dim { color: ${Uw.multiplyOpacity(Uw.opaque(e.background),.5).css}; }${this._terminalSelector} .xterm-bg-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 i=this._rowElements.length;i<=t;i++){let e=this._document.createElement("div");this._rowContainer.appendChild(e),this._rowElements.push(e),this._rowHasBlinkingCells.push(!1)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop()),this._rowHasBlinkingCells.pop()&&this._rowHasBlinkingCellsCount--}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("xterm-focus"),this._cursorBlinkStateManager.pause(),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add("xterm-focus"),this._cursorBlinkStateManager.resume(),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleViewportVisibilityChange(e){this._textBlinkStateManager.setViewportVisible(e)}handleSelectionChanged(e,t,i){let s=this._bufferService.rows;this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,i);let r=0,n=-1;this._lastSelectionStart&&this._lastSelectionEnd&&(this._selectionRenderModel.update(this._terminal,this._lastSelectionStart,this._lastSelectionEnd,this._lastSelectionColumnMode),this._selectionRenderModel.hasSelection&&(r=this._selectionRenderModel.viewportCappedStartRow,n=this._selectionRenderModel.viewportCappedEndRow));let o=0,a=-1;if(!e||!t)return;if(this._selectionRenderModel.update(this._terminal,e,t,i),this._selectionRenderModel.hasSelection){let s=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,n=this._selectionRenderModel.viewportCappedStartRow,l=this._selectionRenderModel.viewportCappedEndRow;o=n,a=l;let c=this._document.createDocumentFragment();if(i){let i=e[0]>t[0];c.appendChild(this._createSelectionElement(n,i?t[0]:e[0],i?e[0]:t[0],l-n+1))}else{let i=s===n?e[0]:0,o=n===r?t[0]:this._bufferService.cols;c.appendChild(this._createSelectionElement(n,i,o));let a=l-n-1;if(c.appendChild(this._createSelectionElement(n+1,0,this._bufferService.cols,a)),n!==l){let e=r===l?t[0]:this._bufferService.cols;c.appendChild(this._createSelectionElement(l,0,e))}}this._selectionContainer.appendChild(c)}let l=Math.min(r,o),c=Math.max(n,a);if(c>=0){l=Math.max(l,0),c=Math.min(c,s-1);let e=this._bufferService.buffer.y;this._selectionRenderModel.hasSelection&&e>=0&&e<s&&(l=Math.min(l,e),c=Math.max(c,e)),this.renderRows(l,c)}this._lastSelectionStart=e,this._lastSelectionEnd=t,this._lastSelectionColumnMode=i}_createSelectionElement(e,t,i,s=1){let r=this._document.createElement("div"),n=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(i-t);return n+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-n),r.style.height=s*this.dimensions.css.cell.height+"px",r.style.top=e*this.dimensions.css.cell.height+"px",r.style.left=`${n}px`,r.style.width=`${o}px`,r}handleCursorMove(){this._cursorBlinkStateManager.restartBlinkAnimation()}_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();this._rowHasBlinkingCellsCount>0&&(this._rowHasBlinkingCells.fill(!1),this._rowHasBlinkingCellsCount=0,this._textBlinkStateManager.setNeedsBlinkInViewport(!1))}renderRows(e,t){let i=this._bufferService.buffer,s=i.ybase+i.y,r=Math.min(i.x,this._bufferService.cols-1),n=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle,l={hasBlinkingCells:!1};for(let c=e;c<=t;c++){let e=c+i.ydisp,t=this._rowElements[c];if(!t)continue;let h=i.lines.get(e);h?(t.replaceChildren(...this._rowFactory.createRow(h,e,e===s,o,a,r,n,this._textBlinkStateManager.isBlinkOn,this.dimensions.css.cell.width,this._widthCache,-1,-1,l)),this._setRowBlinkState(c,l.hasBlinkingCells)):(t.replaceChildren(),this._setRowBlinkState(c,!1))}this._updateTextBlinkState()}get _terminalSelector(){return`.xterm-dom-renderer-owner-${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,i,s,r,n){i<0&&(e=0),s<0&&(t=0);let o=this._bufferService.rows-1;i=Math.max(Math.min(i,o),0),s=Math.max(Math.min(s,o),0),r=Math.min(r,this._bufferService.cols);let a=this._bufferService.buffer,l=a.ybase+a.y,c=Math.min(a.x,r-1),h=this._optionsService.rawOptions.cursorBlink,u=this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle,f={hasBlinkingCells:!1};for(let p=i;p<=s;++p){let o=p+a.ydisp,g=this._rowElements[p];if(!g)continue;let v=a.lines.get(o);v?(g.replaceChildren(...this._rowFactory.createRow(v,o,o===l,u,d,c,h,this._textBlinkStateManager.isBlinkOn,this.dimensions.css.cell.width,this._widthCache,n?p===i?e:0:-1,n?(p===s?t:r)-1:-1,f)),this._setRowBlinkState(p,f.hasBlinkingCells)):(g.replaceChildren(),this._setRowBlinkState(p,!1))}this._updateTextBlinkState()}_setRowBlinkState(e,t){this._rowHasBlinkingCells[e]!==t&&(this._rowHasBlinkingCells[e]=t,this._rowHasBlinkingCellsCount+=t?1:-1)}_updateTextBlinkState(){this._textBlinkStateManager.setNeedsBlinkInViewport(this._rowHasBlinkingCellsCount>0)}};hS=Ax([Tx(7,ny),Tx(8,fy),Tx(9,ay),Tx(10,ty),Tx(11,sy),Tx(12,py),Tx(13,xy)],hS);var uS=class{constructor(e,t){this._rowContainer=e,this._coreBrowserService=t,this._isIdlePaused=!1,this._coreBrowserService.isFocused&&this._resetIdleTimer()}dispose(){this._clearIdleTimer()}restartBlinkAnimation(){this._isIdlePaused&&this._rowContainer.classList.remove("xterm-cursor-blink-idle"),this._resetIdleTimer()}pause(){this._isIdlePaused=!1,this._clearIdleTimer()}resume(){this._isIdlePaused=!1,this._rowContainer.classList.remove("xterm-cursor-blink-idle"),this._resetIdleTimer()}_resetIdleTimer(){this._isIdlePaused=!1,this._clearIdleTimer(),this._idleTimeout=this._coreBrowserService.window.setTimeout(()=>{this._stopBlinkingDueToIdle()},3e5)}_clearIdleTimer(){void 0!==this._idleTimeout&&(this._coreBrowserService.window.clearTimeout(this._idleTimeout),this._idleTimeout=void 0)}_stopBlinkingDueToIdle(){this._rowContainer.classList.add("xterm-cursor-blink-idle"),this._isIdlePaused=!0,this._idleTimeout=void 0}},dS=class extends jy{constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new bw),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new gS(this._optionsService))}catch{this._measureStrategy=this._register(new pS(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())}};dS=Ax([Tx(2,ay)],dS);var fS=class extends jy{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){void 0!==e&&e>0&&void 0!==t&&t>0&&(this._result.width=e,this._result.height=t)}},pS=class extends fS{constructor(e,t,i){super(),this._document=e,this._parentElement=t,this._optionsService=i,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}},gS=class extends fS{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}},vS=class extends jy{constructor(e,t,i){super(),this._textarea=e,this._window=t,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._onDprChange=this._register(new bw),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new bw),this.onWindowChange=this._onWindowChange.event,this._screenDprMonitor=this._register(new mS(this._window)),this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(uw.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Ry(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Ry(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 void 0===this._cachedIsFocused&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},mS=class extends jy{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Ny),this._onDprChange=this._register(new bw),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Sy(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Ry(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&(null==(e=this._resolutionMediaMatchList)||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)}},_S=class extends jy{constructor(){super(),this.linkProviders=[],this._register(Sy(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);-1!==t&&this.linkProviders.splice(t,1)}}}};function bS(e,t,i){let s=i.getBoundingClientRect(),r=e.getComputedStyle(i),n=parseInt(r.getPropertyValue("padding-left"),10),o=parseInt(r.getPropertyValue("padding-top"),10);return[t.clientX-s.left-n,t.clientY-s.top-o]}var xS=class{constructor(e,t){this._charSizeService=e,this._renderService=t}getCoords(e,t,i,s,r){return function(e,t,i,s,r,n,o,a,l){if(!n)return;let c=bS(e,t,i);return c[0]=Math.ceil((c[0]+(l?o/2:0))/o),c[1]=Math.ceil(c[1]/a),c[0]=Math.min(Math.max(c[0],1),s+(l?1:0)),c[1]=Math.min(Math.max(c[1],1),r),c}(Dy(t),e,t,i,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(e,t){let i=bS(Dy(t),e,t);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};xS=Ax([Tx(0,fy),Tx(1,my)],xS);var yS="object"==typeof window?window:globalThis;function wS(e,t=0){return e[e.length-(1+t)]}var SS=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};SS.Undefined=new SS(void 0);var kS,CS,jS=SS,NS=class{constructor(){this._first=jS.Undefined,this._last=jS.Undefined}push(e){return this._insert(e,!0)}_insert(e,t){let i=new jS(e);if(this._first===jS.Undefined)this._first=i,this._last=i;else if(t){let e=this._last;this._last=i,i.prev=e,e.next=i}else{let e=this._first;this._first=i,i.next=e,e.prev=i}let s=!1;return()=>{s||(s=!0,this._remove(i))}}_remove(e){if(e.prev!==jS.Undefined&&e.next!==jS.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===jS.Undefined&&e.next===jS.Undefined?(this._first=jS.Undefined,this._last=jS.Undefined):e.next===jS.Undefined?(this._last=this._last.prev,this._last.next=jS.Undefined):e.prev===jS.Undefined&&(this._first=this._first.next,this._first.prev=jS.Undefined)}*[Symbol.iterator](){let e=this._first;for(;e!==jS.Undefined;)yield e.element,e=e.next}};(CS=kS||(kS={})).TAP="-xterm-gesturetap",CS.CHANGE="-xterm-gesturechange",CS.START="-xterm-gesturestart",CS.END="-xterm-gesturesend",CS.CONTEXT_MENU="-xterm-gesturecontextmenu";var MS=class e extends jy{constructor(){super(),this._dispatched=!1,this._targets=new NS,this._ignoreTargets=new NS,this._activeTouches={},this._handle=null,this._lastSetTapCountTime=0;let e=yS;this._register(Ry(e.document,"touchstart",e=>this._handleTouchStart(e),{passive:!1})),this._register(Ry(e.document,"touchend",t=>this._handleTouchEnd(e,t))),this._register(Ry(e.document,"touchmove",e=>this._handleTouchMove(e),{passive:!1}))}static addTarget(t){if(!e.isTouchDevice())return jy.None;return e._instance||(e._instance=new e),Sy(e._instance._targets.push(t))}static ignoreTarget(t){if(!e.isTouchDevice())return jy.None;return e._instance||(e._instance=new e),Sy(e._instance._ignoreTargets.push(t))}static isTouchDevice(){return"ontouchstart"in yS||navigator.maxTouchPoints>0}dispose(){this._handle&&(this._handle.dispose(),this._handle=null),super.dispose()}_handleTouchStart(e){let t=Date.now();this._handle&&(this._handle.dispose(),this._handle=null);for(let i=0,s=e.targetTouches.length;i<s;i++){let s=e.targetTouches.item(i);this._activeTouches[s.identifier]={id:s.identifier,initialTarget:s.target,initialTimeStamp:t,initialPageX:s.pageX,initialPageY:s.pageY,rollingTimestamps:[t],rollingPageX:[s.pageX],rollingPageY:[s.pageY]};let r=this._newGestureEvent(kS.START,s.target);r.pageX=s.pageX,r.pageY=s.pageY,this._dispatchEvent(r)}this._dispatched&&(e.preventDefault(),e.stopPropagation(),this._dispatched=!1)}_handleTouchEnd(t,i){let s=Date.now(),r=Object.keys(this._activeTouches).length;for(let n=0,o=i.changedTouches.length;n<o;n++){let o=i.changedTouches.item(n);if(!this._activeTouches.hasOwnProperty(String(o.identifier))){console.warn("move of an UNKNOWN touch",o);continue}let a=this._activeTouches[o.identifier],l=Date.now()-a.initialTimeStamp;if(l<e._holdDelay&&Math.abs(a.initialPageX-wS(a.rollingPageX))<30&&Math.abs(a.initialPageY-wS(a.rollingPageY))<30){let e=this._newGestureEvent(kS.TAP,a.initialTarget);e.pageX=wS(a.rollingPageX),e.pageY=wS(a.rollingPageY),this._dispatchEvent(e)}else if(l>=e._holdDelay&&Math.abs(a.initialPageX-wS(a.rollingPageX))<30&&Math.abs(a.initialPageY-wS(a.rollingPageY))<30){let e=this._newGestureEvent(kS.CONTEXT_MENU,a.initialTarget);e.pageX=wS(a.rollingPageX),e.pageY=wS(a.rollingPageY),this._dispatchEvent(e)}else if(1===r){let e=wS(a.rollingPageX),i=wS(a.rollingPageY),r=wS(a.rollingTimestamps)-a.rollingTimestamps[0],n=e-a.rollingPageX[0],o=i-a.rollingPageY[0],l=[...this._targets].filter(e=>a.initialTarget instanceof Node&&e.contains(a.initialTarget));this._inertia(t,l,s,Math.abs(n)/r,n>0?1:-1,e,Math.abs(o)/r,o>0?1:-1,i)}this._dispatchEvent(this._newGestureEvent(kS.END,a.initialTarget)),delete this._activeTouches[o.identifier]}this._dispatched&&(i.preventDefault(),i.stopPropagation(),this._dispatched=!1)}_newGestureEvent(e,t){let i=document.createEvent("CustomEvent");return i.initEvent(e,!1,!0),i.initialTarget=t,i.tapCount=0,i}_dispatchEvent(t){if(t.type===kS.TAP){let i,s=(new Date).getTime();i=s-this._lastSetTapCountTime>e._clearTapCountTime?1:2,this._lastSetTapCountTime=s,t.tapCount=i}else(t.type===kS.CHANGE||t.type===kS.CONTEXT_MENU)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let i of this._ignoreTargets)if(i.contains(t.initialTarget))return;let e=[];for(let i of this._targets)if(i.contains(t.initialTarget)){let s=0,r=t.initialTarget;for(;r&&r!==i;)s++,r=r.parentElement;e.push([s,i])}e.sort((e,t)=>e[0]-t[0]);for(let[,i]of e)i.dispatchEvent(t),this._dispatched=!0}}_inertia(t,i,s,r,n,o,a,l,c){this._handle=qy(t,()=>{let h=Date.now(),u=h-s,d=0,f=0,p=!0;r+=e._scrollFriction*u,a+=e._scrollFriction*u,r>0&&(p=!1,d=n*r*u),a>0&&(p=!1,f=l*a*u);let g=this._newGestureEvent(kS.CHANGE);g.translationX=d,g.translationY=f,i.forEach(e=>e.dispatchEvent(g)),p||this._inertia(t,i,h,r,n,o+d,a,l,c+f)})}_handleTouchMove(e){let t=Date.now();for(let i=0,s=e.changedTouches.length;i<s;i++){let s=e.changedTouches.item(i);if(!this._activeTouches.hasOwnProperty(String(s.identifier))){console.warn("end of an UNKNOWN touch",s);continue}let r=this._activeTouches[s.identifier],n=this._newGestureEvent(kS.CHANGE,r.initialTarget);n.translationX=s.pageX-wS(r.rollingPageX),n.translationY=s.pageY-wS(r.rollingPageY),n.pageX=s.pageX,n.pageY=s.pageY,n.clientX=s.clientX,n.clientY=s.clientY,this._dispatchEvent(n),r.rollingPageX.length>3&&(r.rollingPageX.shift(),r.rollingPageY.shift(),r.rollingTimestamps.shift()),r.rollingPageX.push(s.pageX),r.rollingPageY.push(s.pageY),r.rollingTimestamps.push(t)}this._dispatched&&(e.preventDefault(),e.stopPropagation(),this._dispatched=!1)}};MS._scrollFriction=-.005,MS._holdDelay=700,MS._clearTapCountTime=400,Ax([function(e,t,i){let s=null,r=null;if("function"==typeof i.value?(s="value",r=i.value,0!==r.length&&console.warn("Memoize should only be used in functions with zero parameters")):"function"==typeof i.get&&(s="get",r=i.get),!r||!s)throw new Error("not supported");let n=`$memoize$${t}`;i[s]=function(...e){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,e)}),this[n]}}],MS,"isTouchDevice",1);var ES=MS,BS=class{constructor(e,t,i,s,r,n,o,a,l){this._renderService=e,this._mouseCoordsService=t,this._mouseStateService=i,this._coreService=s,this._bufferService=r,this._optionsService=n,this._selectionService=o,this._logService=a,this._coreBrowserService=l,this._lastEvent=null,this._wheelPartialScroll=0,this._touchScrollAccumulator=0}bindMouse(e,t,i){let{element:s,document:r}=e,n=new Ny,o=new Ny;t(n),t(o);let a={target:e,focus:i,requestedEvents:{mouseup:null,wheel:null,mousedrag:null,mousemove:null},mouseupListener:n,mousedragListener:o},l={mouseup:e=>this._handleMouseUp(a,e),wheel:e=>this._handleWheel(a,e),mousedrag:e=>this._handleMouseDrag(a,e),mousemove:e=>this._handleMouseMove(a,e)};this._altMouseCursor=new DS(s,r,()=>this._mouseStateService.areMouseEventsActive&&!!this._optionsService.rawOptions.mouseEventsRequireAlt),t(this._altMouseCursor),t(this._mouseStateService.onProtocolChange(e=>{this._handleProtocolChange(a,l,e)})),t(this._optionsService.onSpecificOptionChange("mouseEventsRequireAlt",()=>{var e;this._syncMouseModeState(s),null==(e=this._altMouseCursor)||e.sync()})),this._mouseStateService.activeProtocol=this._mouseStateService.activeProtocol,t(Ry(s,"mousedown",e=>this._handleMouseDown(a,e))),t(Ry(s,"wheel",e=>this._handlePassiveWheel(a,e),{passive:!1})),t(ES.addTarget(e.screenElement)),t(Ry(e.screenElement,kS.START,()=>this._handleTouchStart())),t(Ry(e.screenElement,kS.CHANGE,e=>this._handleTouchChange(a,e)))}_sendEvent(e,t){var i,s,r,n,o;let a,l,c=this._mouseCoordsService.getMouseReportCoords(t,e.target.screenElement);if(!c)return!1;switch(t.overrideType||t.type){case"mousemove":l=32,void 0===t.buttons?(a=3,void 0!==t.button&&(a=t.button<3?t.button:3)):a=1&t.buttons?0:4&t.buttons?1:2&t.buttons?2:3;break;case"mouseup":l=0,a=t.button<3?t.button:3;break;case"mousedown":l=1,a=t.button<3?t.button:3;break;case"wheel":if(!this._mouseStateService.allowCustomWheelEvent(t))return!1;let e=t.deltaY;if(0===e||0===this._consumeWheelEvent(t,null==(n=null==(r=null==(s=null==(i=this._renderService)?void 0:i.dimensions)?void 0:s.device)?void 0:r.cell)?void 0:n.height,null==(o=this._coreBrowserService)?void 0:o.dpr))return!1;l=e<0?0:1,a=4;break;default:return!1}if(void 0===l||void 0===a||a>4||4!==a&&this._optionsService.rawOptions.mouseEventsRequireAlt&&this._mouseStateService.areMouseEventsActive&&!t.altKey)return!1;let h=4!==a&&this._optionsService.rawOptions.mouseEventsRequireAlt&&this._mouseStateService.areMouseEventsActive;return this._triggerMouseEvent({col:c.col,row:c.row,x:c.x,y:c.y,button:a,action:l,ctrl:t.ctrlKey,alt:!h&&t.altKey,shift:t.shiftKey})}_handleMouseUp(e,t){this._sendEvent(e,t),t.buttons||(e.mouseupListener.clear(),e.mousedragListener.clear())}_handleWheel(e,t){return this._sendEvent(e,t),t.preventDefault(),t.stopPropagation(),!1}_handleMouseDrag(e,t){t.buttons&&this._sendEvent(e,t)}_handleMouseMove(e,t){t.buttons||this._sendEvent(e,t)}_handleMouseDown(e,t){if(t.preventDefault(),e.focus(),!this._mouseStateService.areMouseEventsActive||this._selectionService.shouldForceSelection(t))return;this._sendEvent(e,t);let{element:i,document:s}=e.target,r=i.ownerDocument??s;e.requestedEvents.mouseup&&(e.mouseupListener.value=Ry(r,"mouseup",e.requestedEvents.mouseup)),e.requestedEvents.mousedrag&&(e.mousedragListener.value=Ry(r,"mousemove",e.requestedEvents.mousedrag))}_handlePassiveWheel(e,t){var i,s,r,n,o;if(!e.requestedEvents.wheel){if(!this._mouseStateService.allowCustomWheelEvent(t))return!1;if(!this._bufferService.buffer.hasScrollback){if(0===t.deltaY)return!1;if(0===this._consumeWheelEvent(t,null==(n=null==(r=null==(s=null==(i=this._renderService)?void 0:i.dimensions)?void 0:s.device)?void 0:r.cell)?void 0:n.height,null==(o=this._coreBrowserService)?void 0:o.dpr))return t.preventDefault(),t.stopPropagation(),!1;let e=""+(this._coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(t.deltaY<0?"A":"B");return this._coreService.triggerDataEvent(e,!0),t.preventDefault(),t.stopPropagation(),!1}}}_handleTouchStart(){this._touchScrollAccumulator=0}_handleTouchChange(e,t){var i,s;t.preventDefault(),t.stopPropagation(),e.requestedEvents.wheel?this._handleTouchScrollAsWheel(e,t):this._bufferService.buffer.hasScrollback?null==(s=(i=e.target).handleTouchScroll)||s.call(i,t.translationY):this._handleTouchScrollAsKeys(t)}_handleTouchScrollAsKeys(e){var t;let i=null==(t=this._renderService)?void 0:t.dimensions.css.cell.height;if(!i)return;this._touchScrollAccumulator-=e.translationY;let s=Math.trunc(this._touchScrollAccumulator/i);if(0===s)return;this._touchScrollAccumulator-=s*i;let r=""+(this._coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(s<0?"A":"B");for(let n=0;n<Math.abs(s);n++)this._coreService.triggerDataEvent(r,!0)}_handleTouchScrollAsWheel(e,t){var i;let s=null==(i=this._renderService)?void 0:i.dimensions.css.cell.height;if(!s)return;this._touchScrollAccumulator-=t.translationY;let r=Math.trunc(this._touchScrollAccumulator/s);if(0===r)return;this._touchScrollAccumulator-=r*s;let n=this._mouseCoordsService.getMouseReportCoords(t,e.target.screenElement);if(n)for(let o=0;o<Math.abs(r);o++)this._triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:4,action:r<0?0:1,ctrl:!1,alt:!1,shift:!1})}reset(){this._lastEvent=null,this._wheelPartialScroll=0,this._touchScrollAccumulator=0}_syncMouseModeState(e){var t;this._mouseStateService.areMouseEventsActive?this._optionsService.rawOptions.mouseEventsRequireAlt?(null==(t=this._altMouseCursor)||t.resetClass(),this._selectionService.enable()):(e.classList.add("enable-mouse-events"),this._selectionService.disable()):(e.classList.remove("enable-mouse-events"),this._selectionService.enable())}_handleProtocolChange(e,t,i){var s;let{element:r}=e.target,{requestedEvents:n}=e;i?"debug"===this._optionsService.rawOptions.logLevel&&this._logService.debug("Binding to mouse events:",this._explainEvents(i)):this._logService.debug("Unbinding from mouse events."),this._syncMouseModeState(r),null==(s=this._altMouseCursor)||s.sync(),8&i?n.mousemove||(r.addEventListener("mousemove",t.mousemove),n.mousemove=t.mousemove):(n.mousemove&&r.removeEventListener("mousemove",n.mousemove),n.mousemove=null),16&i?n.wheel||(r.addEventListener("wheel",t.wheel,{passive:!1}),n.wheel=t.wheel):(n.wheel&&r.removeEventListener("wheel",n.wheel),n.wheel=null),2&i?n.mouseup??(n.mouseup=t.mouseup):(e.mouseupListener.clear(),n.mouseup=null),4&i?n.mousedrag??(n.mousedrag=t.mousedrag):(e.mousedragListener.clear(),n.mousedrag=null)}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}_consumeWheelEvent(e,t,i){if(0===e.deltaY||e.shiftKey||void 0===t||void 0===i)return 0;let s=t/i,r=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=s+0,Math.abs(e.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||4===e.button&&32===e.action||3===e.button&&32!==e.action||4!==e.button&&(2===e.action||3===e.action)||(e.col++,e.row++,32===e.action&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._mouseStateService.isPixelEncoding))||!this._mouseStateService.restrictMouseEvent(e))return!1;let t=this._mouseStateService.encodeMouseEvent(e);return t&&(this._mouseStateService.isDefaultEncoding?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}_explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,t,i){if(i){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)}};BS=Ax([Tx(0,my),Tx(1,gy),Tx(2,iy),Tx(3,sy),Tx(4,ty),Tx(5,ay),Tx(6,_y),Tx(7,oy),Tx(8,py)],BS);var DS=class{constructor(e,t,i){this._element=e,this._document=t,this._isActive=i,this._listeners=new Ny}dispose(){this._listeners.dispose()}sync(){var e;if(this._listeners.clear(),!this._isActive())return;let t=new Cy,i=e=>this.syncFromModifier(e);t.add(Ry(this._document,"keydown",i)),t.add(Ry(this._document,"keyup",i)),t.add(Ry(this._element,"mousemove",i));let s=null==(e=this._element.ownerDocument)?void 0:e.defaultView;s&&t.add(Ry(s,"blur",()=>{this._isActive()&&this.resetClass()})),this._listeners.value=t}resetClass(){this._updateClass(!1)}syncFromModifier(e){this._isActive()&&this._updateClass(e.getModifierState("Alt"))}_updateClass(e){e?this._element.classList.add("enable-mouse-events"):this._element.classList.remove("enable-mouse-events")}},LS=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){void 0!==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,i){this._rowCount=i,e=e??0,t=t??this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t,void 0===this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return void this._runRefreshCallbacks();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=[]}},RS=class{constructor(e){this._tasks=[],this._i=0,this._logService=e}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,i,s=0,r=e.timeRemaining();for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),s=Math.max(t,s),i=e.timeRemaining(),1.5*s>i)return r-t<-20&&this._logService.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),void this._start();r=i}this.clear()}},PS="requestIdleCallback"in globalThis?class extends RS{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:class extends RS{_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())}}},AS=class{constructor(e){this._queue=new PS(e)}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}dispose(){this._queue.clear()}},TS=class extends jy{constructor(e,t,i,s,r,n,o,a,l,c){super(),this._rowCount=e,this._optionsService=i,this._logService=s,this._charSizeService=r,this._coreService=n,this._coreBrowserService=l,this._renderer=this._register(new Ny),this._observerDisposable=this._register(new Ny),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 bw),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new bw),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new bw),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new bw),this.onRefreshRequest=this._onRefreshRequest.event,this._pausedResizeTask=this._register(new AS(this._logService)),this._renderDebouncer=new LS((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new zS(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Sy(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(a.onResize(()=>this._fullRefresh())),this._register(a.buffers.onBufferActivate(()=>{var e;return null==(e=this._renderer.value)?void 0:e.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(["drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(a.cols,a.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(a.buffer.y,a.buffer.y,void 0,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let i=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});this._observerDisposable.value=Sy(()=>{var e;null==(e=this._intersectionObserver)||e.disconnect(),this._intersectionObserver=void 0}),this._intersectionObserver=i,i.observe(t)}}_handleIntersectionChange(e){var t,i;this._isPaused=void 0===e.isIntersecting?0===e.intersectionRatio:!e.isIntersecting,null==(i=null==(t=this._renderer.value)?void 0:t.handleViewportVisibilityChange)||i.call(t,!this._isPaused),!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,i=!1,s=!1){if(this._isPaused)return void(this._needsFullRefresh=!0);if(this._coreService.decPrivateModes.synchronizedOutput)return void this._syncOutputHandler.bufferRows(e,t);let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),s||(this._isNextRenderRedrawOnly=!1),i?this._renderRows(e,t):this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput)return void this._syncOutputHandler.bufferRows(e,t);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(e=>this.refreshRows(e.start,e.end,e.sync,!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&&(null==(t=(e=this._renderer.value).clearTextureAtlas)||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 i;return null==(i=this._renderer.value)?void 0:i.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;null==(e=this._renderer.value)||e.handleCharSizeChanged()}handleBlur(){var e;null==(e=this._renderer.value)||e.handleBlur()}handleFocus(){var e;null==(e=this._renderer.value)||e.handleFocus()}handleSelectionChanged(e,t,i){var s;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,null==(s=this._renderer.value)||s.handleSelectionChanged(e,t,i)}handleCursorMove(){var e;null==(e=this._renderer.value)||e.handleCursorMove()}clear(){var e;null==(e=this._renderer.value)||e.clear()}};TS=Ax([Tx(2,ay),Tx(3,oy),Tx(4,fy),Tx(5,sy),Tx(6,hy),Tx(7,ty),Tx(8,py),Tx(9,xy)],TS);var zS=class{constructor(e,t,i){this._coreBrowserService=e,this._coreService=t,this._onTimeout=i,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??(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(void 0!==this._timeout&&(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(){void 0!==this._timeout&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function OS(e,t,i,s){let r,n=i.buffer.x,o=i.buffer.y;if(!i.buffer.hasScrollback)return function(e,t,i,s,r,n){return 0===IS(t,s,r,n).length?"":US(WS(e,t,e,t-FS(t,r),!1,r).length,KS("D",n))}(n,o,0,t,i,s)+IS(o,t,i,s)+function(e,t,i,s,r,n){let o;o=IS(t,s,r,n).length>0?s-FS(s,r):t;let a=s,l=function(e,t,i,s,r,n){let o;return o=IS(t,s,r,n).length>0?s-FS(s,r):t,e<i&&o<=s||e>=i&&o<s?"C":"D"}(e,t,i,s,r,n);return US(WS(e,o,i,a,"C"===l,r).length,KS(l,n))}(n,o,e,t,i,s);if(o===t)return r=n>e?"D":"C",US(Math.abs(n-e),KS(r,s));r=o>t?"D":"C";let a=Math.abs(o-t),l=function(e,t){return t.cols-e}(o>t?e:n,i)+(a-1)*i.cols+1+function(e){return e-1}(o>t?n:e);return US(l,KS(r,s))}function IS(e,t,i,s){let r=e-FS(e,i),n=t-FS(t,i),o=Math.abs(r-n)-function(e,t,i){var s;let r=0,n=e-FS(e,i),o=t-FS(t,i);for(let a=0;a<Math.abs(n-o);a++){let o="A"===HS(e,t)?-1:1;(null==(s=i.buffer.lines.get(n+o*a))?void 0:s.isWrapped)&&r++}return r}(e,t,i);return US(o,KS(HS(e,t),s))}function FS(e,t){let i=0,s=t.buffer.lines.get(e),r=null==s?void 0:s.isWrapped;for(;r&&e>=0&&e<t.rows;)i++,s=t.buffer.lines.get(--e),r=null==s?void 0:s.isWrapped;return i}function HS(e,t){return e>t?"A":"B"}function WS(e,t,i,s,r,n){let o=e,a=t,l="";for(;(o!==i||a!==s)&&a>=0&&a<n.buffer.lines.length;)o+=r?1:-1,r&&o>n.cols-1?(l+=n.buffer.translateBufferLineToString(a,!1,e,o),o=0,e=0,a++):!r&&o<0&&(l+=n.buffer.translateBufferLineToString(a,!1,0,e+1),o=n.cols-1,e=o,a--);return l+n.buffer.translateBufferLineToString(a,!1,e,o)}function KS(e,t){return""+(t?"O":"[")+e}function US(e,t){e=Math.floor(e);let i="";for(let s=0;s<e;s++)i+=t;return i}var qS=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.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)&&(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=[0,0],!0)}};function $S(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 VS=new RegExp(" ","g"),YS=class extends jy{constructor(e,t,i,s,r,n,o,a,l,c){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=s,this._coreService=r,this._mouseCoordsService=n,this._optionsService=o,this._mouseStateService=a,this._renderService=l,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._trimListener=this._register(new Ny),this._workCell=new Zx,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new bw),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new bw),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new bw),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new bw),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener.value=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new qS(this._bufferService),this._activeSelectionMode=0,this._register(Sy(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.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)&&(e[0]!==t[0]||e[1]!==t[1])}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let i=this._bufferService.buffer,s=[];if(3===this._activeSelectionMode){if(e[0]===t[0])return"";let r=e[0]<t[0]?e[0]:t[0],n=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=i.translateBufferLineToString(o,!0,r,n);s.push(e)}}else{let r=e[1]===t[1]?t[0]:void 0;s.push(i.translateBufferLineToString(e[1],!0,e[0],r));for(let n=e[1]+1;n<=t[1]-1;n++){let e=i.lines.get(n),t=i.translateBufferLineToString(n,!0);(null==e?void 0:e.isWrapped)?s[s.length-1]+=t:s.push(t)}if(e[1]!==t[1]){let e=i.lines.get(t[1]),r=i.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?s[s.length-1]+=r:s.push(r)}}return s.map(e=>e.replace(VS," ")).join(ow?"\r\n":"\n")}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),aw&&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:3===this._activeSelectionMode})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!!(i&&s&&t)&&this._areCoordsInSelection(t,i,s)}isCellInSelection(e,t){let i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!(!i||!s)&&this._areCoordsInSelection([e,t],i,s)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]<i[1]||t[1]===i[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<i[0]||t[1]<i[1]&&e[1]===i[1]&&e[0]<i[0]||t[1]<i[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var i,s;let r=null==(s=null==(i=this._linkifier.currentLink)?void 0:i.link)?void 0:s.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=$S(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let n=this._getMouseBufferCoords(e);return!!n&&(this._selectWordAt(n,t),this._model.selectionEnd=void 0,!0)}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._mouseCoordsService.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=bS(this._coreBrowserService.window,e,this._screenElement)[1],i=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-50),50),t/=50,t/Math.abs(t)+Math.round(14*t))}shouldForceSelection(e){return this._optionsService.rawOptions.mouseEventsRequireAlt&&this._mouseStateService.areMouseEventsActive?!e.altKey:nw?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(2===e.button&&this.hasSelection||0!==e.button||this._optionsService.rawOptions.mouseEventsRequireAlt&&this._mouseStateService.areMouseEventsActive&&e.altKey)){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):1===e.detail?this._handleSingleClick(e):2===e.detail?this._handleDoubleClick(e):3===e.detail&&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(),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){let t=this.hasSelection;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,t&&this._fireOnSelectionChange(this._model.finalSelectionStart,this._model.finalSelectionEnd,!1);let i=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);i&&i.length!==this._model.selectionStart[0]&&0===i.hasWidth(this._model.selectionStart[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(!this._optionsService.rawOptions.mouseEventsRequireAlt||!this._mouseStateService.areMouseEventsActive)&&(e.altKey&&!(nw&&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)return void this.refresh(!0);2===this._activeSelectionMode?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:1===this._activeSelectionMode&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),3!==this._activeSelectionMode&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let i=this._bufferService.buffer;if(this._model.selectionEnd[1]<i.lines.length){let e=i.lines.get(this._model.selectionEnd[1]);e&&0===e.hasWidth(this._model.selectionEnd[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?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows-1,e.lines.length-1)):(3!==this._activeSelectionMode&&(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<500&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseCoordsService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&void 0!==t[0]&&void 0!==t[1]){let e=OS(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,i=!(!e||!t||e[0]===t[0]&&e[1]===t[1]);i?!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,i):this._oldHasSelection&&this._fireOnSelectionChange(e,t,i)}_fireOnSelectionChange(e,t,i){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.value=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let s=0;t>=s;s++){let r=e.loadCell(s,this._workCell).getChars().length;0===this._workCell.getWidth()?i--:r>1&&t!==s&&(i+=r-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,s=!0){if(e[0]>=this._bufferService.cols)return;let r=this._bufferService.buffer,n=r.lines.get(e[1]);if(!n)return;let o=r.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(n,e[0]),l=a,c=e[0]-a,h=0,u=0,d=0,f=0;if(" "===o.charAt(a)){for(;a>0&&" "===o.charAt(a-1);)a--;for(;l<o.length&&" "===o.charAt(l+1);)l++}else{let t=e[0],i=e[0];0===n.getWidth(t)&&(h++,t--),2===n.getWidth(i)&&(u++,i++);let s=n.getString(i).length;for(s>1&&(f+=s-1,l+=s-1);t>0&&a>0&&!this._isCharWordSeparator(n.loadCell(t-1,this._workCell));){n.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;0===this._workCell.getWidth()?(h++,t--):e>1&&(d+=e-1,a-=e-1),a--,t--}for(;i<n.length&&l+1<o.length&&!this._isCharWordSeparator(n.loadCell(i+1,this._workCell));){n.loadCell(i+1,this._workCell);let e=this._workCell.getChars().length;2===this._workCell.getWidth()?(u++,i++):e>1&&(f+=e-1,l+=e-1),l++,i++}}l++;let p=a+c-h+d,g=Math.min(this._bufferService.cols,l-a+h+u-d-f);if(t||""!==o.slice(a,l).trim()){if(i&&0===p&&32!==n.getCodePoint(0)){let t=r.lines.get(e[1]-1);if(t&&n.isWrapped&&32!==t.getCodePoint(this._bufferService.cols-1)){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;p-=e,g+=e}}}if(s&&p+g===this._bufferService.cols&&32!==n.getCodePoint(this._bufferService.cols-1)){let t=r.lines.get(e[1]+1);if((null==t?void 0:t.isWrapped)&&32!==t.getCodePoint(0)){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(g+=t.length)}}return{start:p,length:g}}}_selectWordAt(e,t){let i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return 0!==e.getWidth()&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),i={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=$S(i,this._bufferService.cols)}};YS=Ax([Tx(3,ty),Tx(4,sy),Tx(5,gy),Tx(6,ay),Tx(7,iy),Tx(8,my),Tx(9,py)],YS);var GS=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},XS=class{constructor(){this._color=new GS,this._css=new GS}setCss(e,t,i){this._css.set(e,t,i)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,i){this._color.set(e,t,i)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},JS=Object.freeze((()=>{let e=[qw.toColor("#2e3436"),qw.toColor("#cc0000"),qw.toColor("#4e9a06"),qw.toColor("#c4a000"),qw.toColor("#3465a4"),qw.toColor("#75507b"),qw.toColor("#06989a"),qw.toColor("#d3d7cf"),qw.toColor("#555753"),qw.toColor("#ef2929"),qw.toColor("#8ae234"),qw.toColor("#fce94f"),qw.toColor("#729fcf"),qw.toColor("#ad7fa8"),qw.toColor("#34e2e2"),qw.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){let s=t[i/36%6|0],r=t[i/6%6|0],n=t[i%6];e.push({css:Ww.toCss(s,r,n),rgba:Ww.toRgba(s,r,n)})}for(let i=0;i<24;i++){let t=8+10*i;e.push({css:Ww.toCss(t,t,t),rgba:Ww.toRgba(t,t,t)})}return e})()),ZS=qw.toColor("#ffffff"),QS=qw.toColor("#000000"),ek=qw.toColor("#ffffff"),tk=QS,ik={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},sk=ZS,rk=class extends jy{constructor(e){super(),this._optionsService=e,this._contrastCache=new XS,this._halfContrastCache=new XS,this._onChangeColors=this._register(new bw),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:ZS,background:QS,cursor:ek,cursorAccent:tk,selectionForeground:void 0,selectionBackgroundTransparent:ik,selectionBackgroundOpaque:Uw.blend(QS,ik),selectionInactiveBackgroundTransparent:ik,selectionInactiveBackgroundOpaque:Uw.blend(QS,ik),scrollbarSliderBackground:Uw.opacity(ZS,.2),scrollbarSliderHoverBackground:Uw.opacity(ZS,.4),scrollbarSliderActiveBackground:Uw.opacity(ZS,.5),overviewRulerBorder:ZS,ansi:JS.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=nk(e.foreground,ZS),t.background=nk(e.background,QS),t.cursor=Uw.blend(t.background,nk(e.cursor,ek)),t.cursorAccent=Uw.blend(t.background,nk(e.cursorAccent,tk)),t.selectionBackgroundTransparent=nk(e.selectionBackground,ik),t.selectionBackgroundOpaque=Uw.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=nk(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Uw.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?nk(e.selectionForeground,Zw):void 0,t.selectionForeground===Zw&&(t.selectionForeground=void 0),Uw.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Uw.opacity(t.selectionBackgroundTransparent,.3)),Uw.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Uw.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=nk(e.scrollbarSliderBackground,Uw.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=nk(e.scrollbarSliderHoverBackground,Uw.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=nk(e.scrollbarSliderActiveBackground,Uw.opacity(t.foreground,.5)),t.overviewRulerBorder=nk(e.overviewRulerBorder,sk),t.ansi=JS.slice(),t.ansi[0]=nk(e.black,JS[0]),t.ansi[1]=nk(e.red,JS[1]),t.ansi[2]=nk(e.green,JS[2]),t.ansi[3]=nk(e.yellow,JS[3]),t.ansi[4]=nk(e.blue,JS[4]),t.ansi[5]=nk(e.magenta,JS[5]),t.ansi[6]=nk(e.cyan,JS[6]),t.ansi[7]=nk(e.white,JS[7]),t.ansi[8]=nk(e.brightBlack,JS[8]),t.ansi[9]=nk(e.brightRed,JS[9]),t.ansi[10]=nk(e.brightGreen,JS[10]),t.ansi[11]=nk(e.brightYellow,JS[11]),t.ansi[12]=nk(e.brightBlue,JS[12]),t.ansi[13]=nk(e.brightMagenta,JS[13]),t.ansi[14]=nk(e.brightCyan,JS[14]),t.ansi[15]=nk(e.brightWhite,JS[15]),e.extendedAnsi){let i=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<i;s++)t.ansi[s+16]=nk(e.extendedAnsi[s],JS[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(void 0!==e)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]}else for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t]}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()}}};function nk(e,t){if(void 0!==e)try{return qw.toColor(e)}catch{}return t}rk=Ax([Tx(0,ay)],rk);var ok={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:["'",'"']};var ak=class{constructor(){this._functionalKeyCodes={Escape:27,Enter:13,Tab:9,Backspace:127,CapsLock:57358,ScrollLock:57359,NumLock:57360,PrintScreen:57361,Pause:57362,ContextMenu:57363,F13:57376,F14:57377,F15:57378,F16:57379,F17:57380,F18:57381,F19:57382,F20:57383,F21:57384,F22:57385,F23:57386,F24:57387,F25:57388,KP_0:57399,KP_1:57400,KP_2:57401,KP_3:57402,KP_4:57403,KP_5:57404,KP_6:57405,KP_7:57406,KP_8:57407,KP_9:57408,KP_Decimal:57409,KP_Divide:57410,KP_Multiply:57411,KP_Subtract:57412,KP_Add:57413,KP_Enter:57414,KP_Equal:57415,ShiftLeft:57441,ShiftRight:57447,ControlLeft:57442,ControlRight:57448,AltLeft:57443,AltRight:57449,MetaLeft:57444,MetaRight:57450,MediaPlayPause:57430,MediaStop:57432,MediaTrackNext:57435,MediaTrackPrevious:57436,AudioVolumeDown:57438,AudioVolumeUp:57439,AudioVolumeMute:57440},this._csiTildeKeys={Insert:2,Delete:3,PageUp:5,PageDown:6,F5:15,F6:17,F7:18,F8:19,F9:20,F10:21,F11:23,F12:24},this._csiLetterKeys={ArrowUp:"A",ArrowDown:"B",ArrowRight:"C",ArrowLeft:"D",Home:"H",End:"F"},this._ss3FunctionKeys={F1:"P",F2:"Q",F3:"R",F4:"S"}}_getNumpadKeyCode(e){if(e.code.startsWith("Numpad")){let t=e.code.slice(6);if(t>="0"&&t<="9")return 57399+parseInt(t,10);switch(t){case"Decimal":return 57409;case"Divide":return 57410;case"Multiply":return 57411;case"Subtract":return 57412;case"Add":return 57413;case"Enter":return 57414;case"Equal":return 57415}}}_getModifierKeyCode(e){switch(e.code){case"ShiftLeft":return 57441;case"ShiftRight":return 57447;case"ControlLeft":return 57442;case"ControlRight":return 57448;case"AltLeft":return 57443;case"AltRight":return 57449;case"MetaLeft":return 57444;case"MetaRight":return 57450}}_encodeModifiers(e){let t=0;return e.shiftKey&&(t|=1),e.altKey&&(t|=2),e.ctrlKey&&(t|=4),e.metaKey&&(t|=8),t>0?t+1:0}_getKeyCode(e,t){let i=this._getNumpadKeyCode(e);if(void 0!==i)return i;let s=this._getModifierKeyCode(e);if(void 0!==s)return s;let r=this._functionalKeyCodes[e.key];if(void 0!==r)return r;if((e.shiftKey||t&&e.altKey)&&e.code){if(e.code.startsWith("Digit")&&6===e.code.length){let t=e.code.charAt(5);if(t>="0"&&t<="9")return t.charCodeAt(0)}if(e.code.startsWith("Key")&&4===e.code.length)return e.code.charAt(3).toLowerCase().charCodeAt(0)}if(1===e.key.length){let t=e.key.codePointAt(0);return t>=65&&t<=90?t+32:t}}_isModifierKey(e){return"Shift"===e.key||"Control"===e.key||"Alt"===e.key||"Meta"===e.key}_isLockKey(e){return"CapsLock"===e.key||"NumLock"===e.key||"ScrollLock"===e.key}_buildCsiLetterSequence(e,t,i,s){let r=s&&1!==i;if(t>0||r){let s="[1;"+(t>0?t:"1");return r&&(s+=":"+i),s+=e,s}return"["+e}_buildSs3Sequence(e,t,i,s){let r=s&&1!==i;if(t>0||r){let s="[1;"+(t>0?t:"1");return r&&(s+=":"+i),s+=e,s}return"O"+e}_buildCsiTildeSequence(e,t,i,s){let r=s&&1!==i,n="["+e;return(t>0||r)&&(n+=";"+(t>0?t:"1"),r&&(n+=":"+i)),n+="~",n}_buildCsiUSequence(e,t,i,s,r,n,o){let a,l=!!(2&r),c="["+t;!!(4&r)&&e.shiftKey&&1===e.key.length&&!n&&!o&&(a=e.key.codePointAt(0),c+=":"+a);let h=16&r&&3!==s&&1===e.key.length&&!n&&!o&&!e.ctrlKey?e.key.codePointAt(0):void 0,u=l&&1!==s&&(3===s||void 0===h);return(i>0||u||void 0!==h)&&(c+=";",i>0?c+=i:u&&(c+="1"),u&&(c+=":"+s)),void 0!==h&&(c+=";"+h),c+="u",c}evaluate(e,t,i=1,s=!1){let r={type:0,cancel:!1,key:void 0},n=this._encodeModifiers(e),o=this._isModifierKey(e),a=!!(2&t);if(!a&&3===i||o&&!(8&t)||this._isLockKey(e)&&!(8&t))return r;let l=this._csiLetterKeys[e.key];if(l)return r.key=this._buildCsiLetterSequence(l,n,i,a),r.cancel=!0,r;let c=this._ss3FunctionKeys[e.key];if(c)return r.key=this._buildSs3Sequence(c,n,i,a),r.cancel=!0,r;let h=this._csiTildeKeys[e.key];if(void 0!==h)return r.key=this._buildCsiTildeSequence(h,n,i,a),r.cancel=!0,r;let u=this._getKeyCode(e,s);if(void 0===u)return r;let d=13===u||9===u||127===u;if(d&&3===i&&!(8&t))return r;let f=void 0!==this._functionalKeyCodes[e.key]||void 0!==this._getNumpadKeyCode(e);if(8&t||a&&3===i||(1&t||a)&&(f&&!d||n>0&&1!==e.key.length||n-1>1))r.key=this._buildCsiUSequence(e,u,n,i,t,f,o),r.cancel=!0;else{let t=13===u?"\r":9===u?"\t":127===u?"":void 0;t?r.key=t:1===e.key.length&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&(r.key=e.key)}return r}static shouldUseProtocol(e){return e>0}},lk=class{constructor(){this._codeToVk={KeyA:65,KeyB:66,KeyC:67,KeyD:68,KeyE:69,KeyF:70,KeyG:71,KeyH:72,KeyI:73,KeyJ:74,KeyK:75,KeyL:76,KeyM:77,KeyN:78,KeyO:79,KeyP:80,KeyQ:81,KeyR:82,KeyS:83,KeyT:84,KeyU:85,KeyV:86,KeyW:87,KeyX:88,KeyY:89,KeyZ:90,Digit0:48,Digit1:49,Digit2:50,Digit3:51,Digit4:52,Digit5:53,Digit6:54,Digit7:55,Digit8:56,Digit9:57,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,F13:124,F14:125,F15:126,F16:127,F17:128,F18:129,F19:130,F20:131,F21:132,F22:133,F23:134,F24:135,Numpad0:96,Numpad1:97,Numpad2:98,Numpad3:99,Numpad4:100,Numpad5:101,Numpad6:102,Numpad7:103,Numpad8:104,Numpad9:105,NumpadMultiply:106,NumpadAdd:107,NumpadSeparator:108,NumpadSubtract:109,NumpadDecimal:110,NumpadDivide:111,NumpadEnter:13,NumLock:144,ArrowUp:38,ArrowDown:40,ArrowLeft:37,ArrowRight:39,Home:36,End:35,PageUp:33,PageDown:34,Insert:45,Delete:46,ShiftLeft:16,ShiftRight:16,ControlLeft:17,ControlRight:17,AltLeft:18,AltRight:18,MetaLeft:91,MetaRight:92,CapsLock:20,ScrollLock:145,Escape:27,Enter:13,Tab:9,Space:32,Backspace:8,Pause:19,ContextMenu:93,PrintScreen:44,Semicolon:186,Equal:187,Comma:188,Minus:189,Period:190,Slash:191,Backquote:192,BracketLeft:219,Backslash:220,BracketRight:221,Quote:222,IntlBackslash:226},this._codeToScancode={KeyQ:16,KeyW:17,KeyE:18,KeyR:19,KeyT:20,KeyY:21,KeyU:22,KeyI:23,KeyO:24,KeyP:25,KeyA:30,KeyS:31,KeyD:32,KeyF:33,KeyG:34,KeyH:35,KeyJ:36,KeyK:37,KeyL:38,KeyZ:44,KeyX:45,KeyC:46,KeyV:47,KeyB:48,KeyN:49,KeyM:50,Digit1:2,Digit2:3,Digit3:4,Digit4:5,Digit5:6,Digit6:7,Digit7:8,Digit8:9,Digit9:10,Digit0:11,F1:59,F2:60,F3:61,F4:62,F5:63,F6:64,F7:65,F8:66,F9:67,F10:68,F11:87,F12:88,Numpad0:82,Numpad1:79,Numpad2:80,Numpad3:81,Numpad4:75,Numpad5:76,Numpad6:77,Numpad7:71,Numpad8:72,Numpad9:73,NumpadMultiply:55,NumpadAdd:78,NumpadSubtract:74,NumpadDecimal:83,NumpadDivide:53,NumpadEnter:28,NumLock:69,ArrowUp:72,ArrowDown:80,ArrowLeft:75,ArrowRight:77,Home:71,End:79,PageUp:73,PageDown:81,Insert:82,Delete:83,ShiftLeft:42,ShiftRight:54,ControlLeft:29,ControlRight:29,AltLeft:56,AltRight:56,CapsLock:58,ScrollLock:70,Escape:1,Enter:28,Tab:15,Space:57,Backspace:14,Pause:69,Semicolon:39,Equal:13,Comma:51,Minus:12,Period:52,Slash:53,Backquote:41,BracketLeft:26,Backslash:43,BracketRight:27,Quote:40},this._enhancedKeyCodes=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown","Insert","Delete","NumpadEnter","NumpadDivide","ControlRight","AltRight","PrintScreen","Pause","ContextMenu","MetaLeft","MetaRight"]),this._keyToControlChar={Enter:13,Backspace:8,Tab:9,Escape:27}}_getVirtualKeyCode(e){let t=this._codeToVk[e.code];return void 0!==t?t:e.keyCode||0}_getScanCode(e){return this._codeToScancode[e.code]||0}_getUnicodeChar(e){if(e.ctrlKey&&!e.altKey&&!e.metaKey){if("Enter"===e.key)return 10;if("Backspace"===e.key)return 127}let t=this._keyToControlChar[e.key];if(void 0!==t)return t;if(1===e.key.length){let t=e.key.codePointAt(0)||0;if(e.ctrlKey&&!e.altKey&&!e.metaKey){if(t>=65&&t<=90)return t-64;if(t>=97&&t<=122)return t-96}return t}return 0}_getControlKeyState(e){let t=0;return e.shiftKey&&(t|=16),e.ctrlKey&&("ControlRight"===e.code?t|=4:t|=8),e.altKey&&("AltRight"===e.code?t|=1:t|=2),this._enhancedKeyCodes.has(e.code)&&(t|=256),t}evaluateKeyboardEvent(e,t){return{type:0,cancel:!0,key:`[${this._getVirtualKeyCode(e)};${this._getScanCode(e)};${this._getUnicodeChar(e)};${t?1:0};${this._getControlKeyState(e)};1_`}}},ck=class{constructor(e,t){this._coreService=e,this._optionsService=t}_getWin32InputMode(){return this._win32InputMode??(this._win32InputMode=new lk),this._win32InputMode}_getKittyKeyboard(){return this._kittyKeyboard??(this._kittyKeyboard=new ak),this._kittyKeyboard}evaluateKeyDown(e){if(this.useWin32InputMode)return this._getWin32InputMode().evaluateKeyboardEvent(e,!0);let t=this._coreService.kittyKeyboard.flags;return this.useKitty?this._getKittyKeyboard().evaluate(e,t,e.repeat?2:1,nw&&this._optionsService.rawOptions.macOptionIsMeta):function(e,t,i,s){var r;let n={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:"UIKeyInputUpArrow"===e.key?n.key=t?"OA":"":"UIKeyInputLeftArrow"===e.key?n.key=t?"OD":"":"UIKeyInputRightArrow"===e.key?n.key=t?"OC":"":"UIKeyInputDownArrow"===e.key&&(n.key=t?"OB":"");break;case 8:n.key=e.ctrlKey?"\b":"",e.altKey&&(n.key=""+n.key);break;case 9:if(e.shiftKey){n.key="";break}n.key="\t",n.cancel=!0;break;case 13:"c"===e.key&&e.ctrlKey?n.key="":n.key=e.altKey?"\r":"\r",n.cancel=!0;break;case 27:n.key="",e.altKey&&(n.key=""),n.cancel=!0;break;case 37:if(e.metaKey)break;n.key=o?"[1;"+(o+1)+"D":t?"OD":"";break;case 39:if(e.metaKey)break;n.key=o?"[1;"+(o+1)+"C":t?"OC":"";break;case 38:if(e.metaKey)break;n.key=o?"[1;"+(o+1)+"A":t?"OA":"";break;case 40:if(e.metaKey)break;n.key=o?"[1;"+(o+1)+"B":t?"OB":"";break;case 45:!e.shiftKey&&!e.ctrlKey&&(n.key="[2~");break;case 46:n.key=o?"[3;"+(o+1)+"~":"[3~";break;case 36:n.key=o?"[1;"+(o+1)+"H":t?"OH":"";break;case 35:n.key=o?"[1;"+(o+1)+"F":t?"OF":"";break;case 33:e.shiftKey?n.type=2:e.ctrlKey?n.key="[5;"+(o+1)+"~":n.key="[5~";break;case 34:e.shiftKey?n.type=3:e.ctrlKey?n.key="[6;"+(o+1)+"~":n.key="[6~";break;case 112:n.key=o?"[1;"+(o+1)+"P":"OP";break;case 113:n.key=o?"[1;"+(o+1)+"Q":"OQ";break;case 114:n.key=o?"[1;"+(o+1)+"R":"OR";break;case 115:n.key=o?"[1;"+(o+1)+"S":"OS";break;case 116:n.key=o?"[15;"+(o+1)+"~":"[15~";break;case 117:n.key=o?"[17;"+(o+1)+"~":"[17~";break;case 118:n.key=o?"[18;"+(o+1)+"~":"[18~";break;case 119:n.key=o?"[19;"+(o+1)+"~":"[19~";break;case 120:n.key=o?"[20;"+(o+1)+"~":"[20~";break;case 121:n.key=o?"[21;"+(o+1)+"~":"[21~";break;case 122:n.key=o?"[23;"+(o+1)+"~":"[23~";break;case 123:n.key=o?"[24;"+(o+1)+"~":"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(i&&!s||!e.altKey||e.metaKey)if(!i||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey){if(e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&1===e.key.length)n.key=e.key;else if(e.key&&e.ctrlKey&&e.shiftKey)switch(e.code){case"Minus":n.key="";break;case"Digit2":n.key="\0";break;case"Digit6":n.key=""}}else 65===e.keyCode&&(n.type=1);else{let t=null==(r=ok[e.keyCode])?void 0:r[e.shiftKey?1:0];if(t)n.key=""+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,i=String.fromCharCode(t);e.shiftKey&&(i=i.toUpperCase()),n.key=""+i}else if(32===e.keyCode)n.key=""+(e.ctrlKey?"\0":" ");else if("Dead"===e.key&&e.code.startsWith("Key")){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),n.key=""+t,n.cancel=!0}}else e.keyCode>=65&&e.keyCode<=90?n.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?n.key="\0":e.keyCode>=51&&e.keyCode<=55?n.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?n.key="":"/"===e.key?n.key="":219===e.keyCode?n.key="":220===e.keyCode?n.key="":221===e.keyCode&&(n.key="")}return n}(e,this._coreService.decPrivateModes.applicationCursorKeys,nw,this._optionsService.rawOptions.macOptionIsMeta)}evaluateKeyUp(e){if(this.useWin32InputMode)return this._getWin32InputMode().evaluateKeyboardEvent(e,!1);let t=this._coreService.kittyKeyboard.flags;return this.useKitty&&2&t?this._getKittyKeyboard().evaluate(e,t,3,nw&&this._optionsService.rawOptions.macOptionIsMeta):void 0}get useKitty(){var e;let t=this._coreService.kittyKeyboard.flags;return!(!(null==(e=this._optionsService.rawOptions.vtExtensions)?void 0:e.kittyKeyboard)||!ak.shouldUseProtocol(t))}get useWin32InputMode(){var e;return!(!(null==(e=this._optionsService.rawOptions.vtExtensions)?void 0:e.win32InputMode)||!this._coreService.decPrivateModes.win32InputMode)}};ck=Ax([Tx(0,sy),Tx(1,ay)],ck);var hk=class{constructor(...e){this._entries=new Map;for(let[t,i]of e)this.set(t,i)}set(e,t){let i=this._entries.get(e);return this._entries.set(e,t),i}forEach(e){for(let[t,i]of this._entries.entries())e(t,i)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},uk=class{constructor(){this._services=new hk,this._services.set(ny,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let i=(r=e,r.di$dependencies||[]).sort((e,t)=>e.index-t.index),s=[];var r;for(let o of i){let t=this._services.get(o.id);if(!t)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);s.push(t)}let n=i.length>0?i[0].index:t.length;if(t.length!==n)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${n+1} conflicts with ${t.length} static arguments`);return new e(...t,...s)}},dk={trace:0,debug:1,info:2,warn:3,error:4,off:5},fk=class extends jy{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=dk[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)"function"==typeof e[t]&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+t,...i)}trace(e,...t){var i;this._logLevel<=0&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var i;this._logLevel<=1&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var i;this._logLevel<=2&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var i;this._logLevel<=3&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var i;this._logLevel<=4&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,t)}};fk=Ax([Tx(0,ay)],fk);var pk=class extends jy{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new bw),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new bw),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new bw),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 i=0;i<Math.min(e,this.length);i++)t[i]=this._array[this._getCyclicIndex(i)];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,...i){if(t){for(let i=e;i<this._length-t;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+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+i.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<i.length;s++)this._array[this._getCyclicIndex(e+s)]=i[s];if(i.length&&this.onInsertEmitter.fire({index:e,amount:i.length}),this._length+i.length>this._maxLength){let e=this._length+i.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let r=t-1;r>=0;r--)this.set(e+r+i,this.get(e+r));let s=e+t+i-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+i,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},gk=class{constructor(){this._chunks=[],this._length=0}get length(){return this._length}reset(){this._chunks.length=0,this._length=0}append(e){this._chunks.push(e),this._length+=e.length}toString(){return this._chunks.join("")}},vk=class{constructor(e){this._limit=e,this._builder=new gk}get length(){return this._builder.length}get limit(){return this._limit}reset(){this._builder.reset()}append(e){return this._builder.append(e),this._builder.length>this._limit&&(this._builder.reset(),!0)}toString(){return this._builder.toString()}},mk=Object.freeze(new Xx),_k=0,bk=new Zx,xk=new gk,yk=class e{constructor(e,t,i,s=!1){this._stringCache=e,this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*t);let r=i??Zx.fromCharData([0,"",1,0]);for(let n=0;n<t;++n)this.setCell(n,r);this.length=t}get(e){let t=this._data[3*e+0],i=2097151&t;return[this._data[3*e+1],2097152&t?this._combined[e]:i?$x(i):"",t>>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):i]}set(e,t){this._invalidateStringCache(),this._data[3*e+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[2]<<22):this._data[3*e+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?$x(2097151&t):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,t){return _k=3*e,t.content=this._data[_k+0],t.fg=this._data[_k+1],t.bg=this._data[_k+2],2097152&t.content?t.combinedData=this._combined[e]:t.combinedData="",268435456&t.bg?t.extended=this._extendedAttrs[e]:t.extended=mk.extended.clone(),t}setCell(e,t){this._invalidateStringCache(),2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg}setCellFromCodepoint(e,t,i,s){this._invalidateStringCache(),268435456&s.bg&&(this._extendedAttrs[e]=s.extended),this._data[3*e+0]=t|i<<22,this._data[3*e+1]=s.fg,this._data[3*e+2]=s.bg}addCodepointToCell(e,t,i){this._invalidateStringCache();let s=this._data[3*e+0];2097152&s?this._combined[e]+=$x(t):2097151&s?(this._combined[e]=$x(2097151&s)+$x(t),s&=-2097152,s|=2097152):s=t|1<<22,i&&(s&=-12582913,s|=i<<22),this._data[3*e+0]=s}insertCells(e,t,i){if(this._invalidateStringCache(),(e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),t<this.length-e){for(let i=this.length-e-t-1;i>=0;--i)this.setCell(e+t+i,this.loadCell(e+i,bk));for(let s=0;s<t;++s)this.setCell(e+s,i)}else for(let s=e;s<this.length;++s)this.setCell(s,i);2===this.getWidth(this.length-1)&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(e,t,i){if(this._invalidateStringCache(),e%=this.length,t<this.length-e){for(let i=0;i<this.length-e-t;++i)this.setCell(e+i,this.loadCell(e+t+i,bk));for(let e=this.length-t;e<this.length;++e)this.setCell(e,i)}else for(let s=e;s<this.length;++s)this.setCell(s,i);e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),0===this.getWidth(e)&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,i)}replaceCells(e,t,i,s=!1){if(this._invalidateStringCache(),s)for(e&&2===this.getWidth(e-1)&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),t<this.length&&2===this.getWidth(t-1)&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,i);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,i),e++;else for(e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),t<this.length&&2===this.getWidth(t-1)&&this.setCellFromCodepoint(t,0,1,i);e<t&&e<this.length;)this.setCell(e++,i)}resize(e,t){if(this._invalidateStringCache(),e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let i=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*i)this._data=new Uint32Array(this._data.buffer,0,i);else{let e=new Uint32Array(i);e.set(this._data),this._data=e}for(let i=this.length;i<e;++i)this.setCell(i,t)}else{this._data=this._data.subarray(0,i);let t=Object.keys(this._combined);for(let i=0;i<t.length;i++){let s=parseInt(t[i],10);s>=e&&delete this._combined[s]}let s=Object.keys(this._extendedAttrs);for(let i=0;i<s.length;i++){let t=parseInt(s[i],10);t>=e&&delete this._extendedAttrs[t]}}return this.length=e,4*i*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(this._invalidateStringCache(),t)for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,e);else{this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}}copyFrom(e){this._invalidateStringCache(),this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._copySparseMapsFrom(e),this.isWrapped=e.isWrapped}clone(){let t=new e(this._stringCache,0,void 0,!1);return t._data=new Uint32Array(this._data),t.length=this.length,t._copySparseMapsFrom(this),t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,t,i,s,r){this._invalidateStringCache();let n=e._data;if(r)for(let o=s-1;o>=0;o--){for(let e=0;e<3;e++)this._data[3*(i+o)+e]=n[3*(t+o)+e];this._copyCellMapsFrom(e,t+o,i+o)}else for(let o=0;o<s;o++){for(let e=0;e<3;e++)this._data[3*(i+o)+e]=n[3*(t+o)+e];this._copyCellMapsFrom(e,t+o,i+o)}}translateToString(e,t,i,s){var r,n;let o=(void 0===t||0===t)&&void 0===i&&void 0===s;o&&(null==(n=(r=this._stringCache).touch)||n.call(r));let a=o?this._getStringCacheEntry(!1):void 0;if(o&&void 0!==(null==a?void 0:a.value)){if(e)return a.isTrimmed?a.value:a.value.trimEnd();if(!a.isTrimmed)return a.value}for(t=t??0,i=i??this.length,e&&(i=Math.min(i,this.getTrimmedLength())),s&&(s.length=0),xk.reset();t<i;){let e=this._data[3*t+0],i=2097151&e,r=2097152&e?this._combined[t]:i?$x(i):" ";if(xk.append(r),s)for(let n=0;n<r.length;++n)s.push(t);t+=e>>22||1}s&&s.push(t);let l=xk.toString();if(xk.reset(),o){let t=this._getStringCacheEntry(!0);t.value=l,t.isTrimmed=!!e}return l}_getStringCacheEntry(e){var t;let i=null==(t=this._stringCacheEntryRef)?void 0:t.deref();if(i&&i.generation===this._stringCache.generation)return i;if(!e)return;let s=this._stringCache.allocateEntry();return this._stringCacheEntryRef=new WeakRef(s),s}_invalidateStringCache(){let e=this._getStringCacheEntry(!1);e&&(e.value=void 0,e.isTrimmed=!1)}_copyCellMapsFrom(e,t,i){let s=3*t;2097152&e._data[s+0]&&(this._combined[i]=e._combined[t]),268435456&e._data[s+2]&&(this._extendedAttrs[i]=e._extendedAttrs[t])}_copySparseMapsFrom(e){this._combined={},this._extendedAttrs={};for(let t=0;t<e.length;t++)this._copyCellMapsFrom(e,t,t)}},wk=class extends jy{constructor(){super(),this.generation=0,this.entries=new Set,this._clearTimeout=this._register(new Ny),this._lastAccessTimestamp=0,this._register(Sy(()=>this.entries.clear()))}touch(){this._scheduleClear()}allocateEntry(){let e={value:void 0,isTrimmed:!1,generation:this.generation};return this.entries.add(e),this._scheduleClear(),e}clear(){this._clearTimeout.clear(),this._lastAccessTimestamp=0,this.generation++;for(let e of this.entries)e.value=void 0,e.isTrimmed=!1;this.entries.clear()}_scheduleClear(){this._lastAccessTimestamp=Date.now(),!this._clearTimeout.value&&this._scheduleClearTimeout(15e3)}_scheduleClearTimeout(e){this._clearTimeout.value=function(e,t=0){let i=setTimeout(()=>{e()},t);return Sy(()=>{clearTimeout(i)})}(()=>{let e=Date.now()-this._lastAccessTimestamp;e>=15e3?this.clear():this._scheduleClearTimeout(15e3-e)},e)}};function Sk(e,t,i){let s=[],r=0;for(let l=0;l<e.length;l++)r+=kk(e,l,t);let n=0,o=0,a=0;for(;a<r;){if(r-a<i){s.push(r-a);break}n+=i;let l=kk(e,o,t);n>l&&(n-=l,o++);let c=2===e[o].getWidth(n-1);c&&n--;let h=c?i-1:i;s.push(h),a+=h}return s}function kk(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();let s=!e[t].hasContent(i-1)&&1===e[t].getWidth(i-1),r=2===e[t+1].getWidth(0);return s&&r?i-1:i}var Ck=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new bw),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ky(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};Ck._nextId=1;var jk=Ck,Nk={},Mk=Nk.B;Nk[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:"≥","{":"π","|":"≠","}":"£","~":"·"},Nk.A={"#":"£"},Nk.B=void 0,Nk[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},Nk.C=Nk[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},Nk.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},Nk.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},Nk.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},Nk.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},Nk.E=Nk[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},Nk.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},Nk.H=Nk[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},Nk["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Ek=4294967295,Bk=class extends jy{constructor(e,t,i,s){super(),this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this._logService=s,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=mk.clone(),this.savedCharset=Mk,this.savedCharsets=[],this.savedGlevel=0,this.savedOriginMode=!1,this.savedWraparoundMode=!0,this.markers=[],this._nullCell=Zx.fromCharData([0,"",1,0]),this._whitespaceCell=Zx.fromCharData([0," ",1,32]),this._isClearing=!1,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new pk(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops(),this._memoryCleanupQueue=new PS(this._logService),this._register(Sy(()=>this._memoryCleanupQueue.clear())),this._register(Sy(()=>this.clearAllMarkers())),this._stringCache=this._register(new wk)}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 Jx),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 Jx),this._whitespaceCell}getBlankLine(e,t){return new yk(this._stringCache,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>Ek?Ek:t}fillViewportRows(e){if(0===this.lines.length){e??(e=mk);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this._stringCache.clear(),this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new pk(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let i=this.getNullCell(mk);this._stringCache.clear();let s=0,r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)s+=+this.lines.get(t).resize(e,i);let n=0;if(this._rows<t)for(let s=this._rows;s<t;s++)this.lines.length<t+this.ybase&&(void 0!==this._optionsService.rawOptions.windowsPty.backend||void 0!==this._optionsService.rawOptions.windowsPty.buildNumber?this.lines.push(new yk(this._stringCache,e,i,!1)):this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new yk(this._stringCache,e,i,!1)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r<this.lines.maxLength){let e=this.lines.length-r;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),n&&(this.y+=n),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 n=0;n<this.lines.length;n++)s+=+this.lines.get(n).resize(e,i);if(this._cols=e,this._rows=t,this.lines.length>0){let e=Math.max(0,this.lines.length-this.ybase-1);this.y=Math.min(this.y,e)}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&&"conpty"===e.backend&&e.buildNumber>=21376:this._hasScrollback}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,s=function(e,t,i,s,r,n){let o=[];for(let a=0;a<e.length-1;a++){let l=a,c=e.get(++l);if(!c.isWrapped)continue;let h=[e.get(a)];for(;l<e.length&&c.isWrapped;)h.push(c),c=e.get(++l);if(!n&&s>=a&&s<l){a+=h.length-1;continue}let u=0,d=kk(h,u,t),f=1,p=0;for(;f<h.length;){let e=kk(h,f,t),s=e-p,n=i-d,o=Math.min(s,n);h[u].copyCellsFrom(h[f],p,d,o,!1),d+=o,d===i&&(u++,d=0),p+=o,p===e&&(f++,p=0),0===d&&0!==u&&2===h[u-1].getWidth(i-1)&&(h[u].copyCellsFrom(h[u-1],i-1,d++,1,!1),h[u-1].setCell(i-1,r))}h[u].replaceCells(d,i,r);let g=0;for(let e=h.length-1;e>0&&(e>u||0===h[e].getTrimmedLength());e--)g++;g>0&&(o.push(a+h.length-g),o.push(g)),a+=h.length-1}return o}(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(mk),i);if(s.length>0){let i=function(e,t){let i=[],s=0,r=t[s],n=0;for(let o=0;o<e.length;o++)if(r===o){let i=t[++s];e.onDeleteEmitter.fire({index:o-n,amount:i}),o+=i-1,n+=i,r=t[++s]}else i.push(o);return{layout:i,countRemoved:n}}(this.lines,s);(function(e,t){let i=[];for(let s=0;s<t.length;s++)i.push(e.get(t[s]));for(let s=0;s<i.length;s++)e.set(s,i[s]);e.length=t.length})(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){let s=this.getNullCell(mk),r=i;for(;r-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new yk(this._stringCache,e,s,!1))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,s=this.getNullCell(mk),r=[],n=0;for(let o=this.lines.length-1;o>=0;o--){let a=this.lines.get(o);if(!a||!a.isWrapped&&a.getTrimmedLength()<=e)continue;let l=[a];for(;a.isWrapped&&o>0;)a=this.lines.get(--o),l.unshift(a);if(!i){let e=this.ybase+this.y;if(e>=o&&e<o+l.length)continue}let c,h=l[l.length-1].getTrimmedLength(),u=Sk(l,this._cols,e),d=u.length-l.length;c=0===this.ybase&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);let f=[];for(let e=0;e<d;e++){let e=this.getBlankLine(mk,!0);f.push(e)}f.length>0&&(r.push({start:o+l.length+n,newLines:f}),n+=f.length),l.push(...f);let p=u.length-1,g=u[p];0===g&&(p--,g=u[p]);let v=l.length-d-1,m=h;for(;v>=0;){let e=Math.min(m,g);if(void 0===l[p])break;if(l[p].copyCellsFrom(l[v],m-e,g-e,e,!0),g-=e,0===g&&(p--,g=u[p]),m-=e,0===m){v--,m=kk(l,Math.max(v,0),this._cols)}}for(let t=0;t<l.length;t++)u[t]<e&&l[t].setCell(u[t],s);let _=d-c;for(;_-- >0;)0===this.ybase?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+n)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(r.length>0){let e=[],t=[];for(let r=0;r<this.lines.length;r++)t.push(this.lines.get(r));let i=this.lines.length,s=i-1,o=0,a=r[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let l=0;for(let u=Math.min(this.lines.maxLength-1,i+n-1);u>=0;u--)if(a&&a.start>s+l){for(let e=a.newLines.length-1;e>=0;e--)this.lines.set(u--,a.newLines[e]);u++,e.push({index:s+1,amount:a.newLines.length}),l+=a.newLines.length,a=r[++o]}else this.lines.set(u,t[s--]);let c=0;for(let r=e.length-1;r>=0;r--)e[r].index+=c,this.lines.onInsertEmitter.fire(e[r]),c+=e[r].amount;let h=Math.max(0,i+n-this.lines.maxLength);h>0&&this.lines.onTrimEmitter.fire(h)}}translateBufferLineToString(e,t,i=0,s){let r=this.lines.get(e);return r?r.translateToString(t,i,s):""}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:t,last:i}}setupTabStops(e){for(null!=e?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??(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??(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 jk(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},Dk=class extends jy{constructor(e,t,i){super(),this._optionsService=e,this._bufferService=t,this._logService=i,this._normalBuffer=this._register(new Ny),this._altBuffer=this._register(new Ny),this._onBufferActivate=this._register(new bw),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 Bk(!0,this._optionsService,this._bufferService,this._logService),this._normalBuffer.value=this._normal,this._normal.fillViewportRows(),this._alt=new Bk(!1,this._optionsService,this._bufferService,this._logService),this._altBuffer.value=this._alt,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)}},Lk=class extends jy{constructor(e,t){super(),this.isUserScrolling=!1,this._onResize=this._register(new bw),this.onResize=this._onResize.event,this._onScroll=this._register(new bw),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,2),this.rows=Math.max(e.rawOptions.rows||0,1),this.buffers=this._register(new Dk(e,this,t)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let i=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:i,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let i,s=this.buffer;i=this._cachedBlankLine,(!i||i.length!==this.cols||i.getFg(0)!==e.fg||i.getBg(0)!==e.bg)&&(i=s.getBlankLine(e,t),this._cachedBlankLine=i),i.isWrapped=t;let r=s.ybase+s.scrollTop,n=s.ybase+s.scrollBottom;if(0===s.scrollTop){let e=s.lines.isFull;n===s.lines.length-1?e?s.lines.recycle().copyFrom(i):s.lines.push(i.clone()):s.lines.splice(n+1,0,i.clone()),e?this.isUserScrolling&&(s.ydisp=Math.max(s.ydisp-1,0)):(s.ybase++,this.isUserScrolling||s.ydisp++)}else{let e=n-r+1;s.lines.shiftElements(r+1,e-1,-1),s.lines.set(n,i.clone())}this.isUserScrolling||(s.ydisp=s.ybase),this._onScroll.fire(s.ydisp)}scrollLines(e,t){let i=this.buffer;if(e<0){if(0===i.ydisp)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let s=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),s!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))}};Lk=Ax([Tx(0,ay),Tx(1,oy)],Lk);var Rk={cols:80,rows:24,showCursorImmediately:!1,cursorBlink:!1,blinkIntervalDuration:0,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollbar:{showScrollbar:!0},scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,mouseEventsRequireAlt:!1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:nw,windowOptions:{},windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",quirks:{},vtExtensions:{}},Pk=["normal","bold","100","200","300","400","500","600","700","800","900"],Ak=class extends jy{constructor(e){super(),this._onOptionChange=this._register(new bw),this.onOptionChange=this._onOptionChange.event;let t={...Rk};for(let i in e)if(i in t)try{let s=e[i];t[i]=this._sanitizeAndValidateOption(i,s)}catch(CS){console.error(CS)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Sy(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(i=>{i===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(i=>{-1!==e.indexOf(i)&&t()})}_setupOptions(){let e=e=>{if(!(e in Rk))throw new Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in Rk))throw new Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let i in this.rawOptions){let s={get:e.bind(this,i),set:t.bind(this,i)};Object.defineProperty(this.options,i,s)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Rk[e]),"block"!==(i=t)&&"underline"!==i&&"bar"!==i)throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Rk[e]);break;case"fontWeight":case"fontWeightBold":if("number"==typeof t&&1<=t&&t<=1e3)break;t=Pk.includes(t)?t:Rk[e];break;case"blinkIntervalDuration":if((t=Math.floor(t))<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);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(10*t)/10));break;case"scrollback":if((t=Math.min(t,4294967295))<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&&0!==t)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{}}var i;return t}};var Tk=Object.freeze({insertMode:!1}),zk=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,colorSchemeUpdates:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,win32InputMode:!1,wraparound:!0}),Ok=class extends jy{constructor(e,t,i){super(),this._bufferService=e,this._logService=t,this._optionsService=i,this.isCursorHidden=!1,this._onData=this._register(new bw),this.onData=this._onData.event,this._onUserInput=this._register(new bw),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new bw),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new bw),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.isCursorInitialized=i.rawOptions.showCursorImmediately??!1,this.modes=structuredClone(Tk),this.decPrivateModes=structuredClone(zk),this.kittyKeyboard={flags:0,mainFlags:0,altFlags:0,mainStack:[],altStack:[]}}reset(){this.modes=structuredClone(Tk),this.decPrivateModes=structuredClone(zk),this.kittyKeyboard={flags:0,mainFlags:0,altFlags:0,mainStack:[],altStack:[]}}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(e=>e.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(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};Ok=Ax([Tx(0,ty),Tx(1,oy),Tx(2,ay)],Ok);var Ik={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>32!==e.action},DRAG:{events:23,restrict:e=>!(32===e.action&&3===e.button)},ANY:{events:31,restrict:e=>!0}};function Fk(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return 4===e.button?(i|=64,i|=e.action):(i|=3&e.button,4&e.button&&(i|=64),8&e.button&&(i|=128),32===e.action?i|=32:0===e.action&&!t&&(i|=3)),i}var Hk,Wk=String.fromCharCode,Kk={DEFAULT:e=>{let t=[Fk(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`${Wk(t[0])}${Wk(t[1])}${Wk(t[2])}`},SGR:e=>{let t=0===e.action&&4!==e.button?"m":"M";return`[<${Fk(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=0===e.action&&4!==e.button?"m":"M";return`[<${Fk(e,!0)};${e.x};${e.y}${t}`}},Uk=class extends jy{constructor(){super(),this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._onProtocolChange=this._register(new bw),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(Ik))this.addProtocol(e,Ik[e]);for(let e of Object.keys(Kk))this.addEncoding(e,Kk[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return 0!==this._protocols[this._activeProtocol].events}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"}setCustomWheelEventHandler(e){this._customWheelEventHandler=e}allowCustomWheelEvent(e){return!this._customWheelEventHandler||!1!==this._customWheelEventHandler(e)}restrictMouseEvent(e){return this._protocols[this._activeProtocol].restrict(e)}encodeMouseEvent(e){return this._encodings[this._activeEncoding](e)}get isDefaultEncoding(){return"DEFAULT"===this._activeEncoding}get isPixelEncoding(){return"SGR_PIXELS"===this._activeEncoding}},qk=class e{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new bw,this.onChange=this._onChange.event}static extractShouldJoin(e){return!!(1&e)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,i=!1){return(16777215&e)<<3|(3&t)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e,this._active||(this.activeVersion=e.version)}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let i=0,s=0,r=t.length;for(let n=0;n<r;++n){let o=t.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=r)return i+this.wcwidth(o);let e=t.charCodeAt(n);56320<=e&&e<=57343?o=1024*(o-55296)+e-56320+65536:i+=this.wcwidth(e)}let a=this.charProperties(o,s),l=e.extractWidth(a);e.extractShouldJoin(a)&&(l-=e.extractWidth(s)),i+=l,s=a}return i}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},$k=[[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]],Vk=[[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]];var Yk=class{constructor(){if(this.version="6",!Hk){(Hk=new Uint8Array(65536)).fill(1),Hk[0]=0,Hk.fill(0,1,32),Hk.fill(0,127,160),Hk.fill(2,4352,4448),Hk[9001]=2,Hk[9002]=2,Hk.fill(2,11904,42192),Hk[12351]=1,Hk.fill(2,44032,55204),Hk.fill(2,63744,64256),Hk.fill(2,65040,65050),Hk.fill(2,65072,65136),Hk.fill(2,65280,65377),Hk.fill(2,65504,65511);for(let e=0;e<$k.length;++e)Hk.fill(0,$k[e][0],$k[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Hk[e]:function(e,t){let i,s=0,r=t.length-1;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=s;)if(i=s+r>>1,e>t[i][1])s=i+1;else{if(!(e<t[i][0]))return!0;r=i-1}return!1}(e,Vk)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),s=0===i&&0!==t;if(s){let e=qk.extractWidth(t);0===e?s=!1:e>i&&(i=e)}return qk.createPropertyValue(0,i,s)}},Gk=class{constructor(){this.glevel=0,this._charsets=[]}get charsets(){return 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 Xk(e){var t;let i=null==(t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))?void 0:t.get(e.cols-1),s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);s&&i&&(s.isWrapped=0!==i[3]&&32!==i[3])}var Jk=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let i=new e;if(!t.length)return i;for(let e=Array.isArray(t[0])?1:0;e<t.length;++e){let s=t[e];if(Array.isArray(s))for(let e=0;e<s.length;++e)i.addSubParam(s[e]);else i.addParam(s)}return i}clone(){let t=new e(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 e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let i=this._subParamsIdx[t]>>8,s=255&this._subParamsIdx[t];s-i>0&&e.push(Array.prototype.slice.call(this._subParams,i,s))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}resetZdm(){this.length=1,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1,this._subParamsIdx[0]=0,this.params[0]=0}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw new Error("values less than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>2147483647?2147483647:e}}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)return void(this._rejectSubDigits=!0);if(e<-1)throw new Error("values less than -1 are not allowed");this._subParams[this._subParamsLength++]=e>2147483647?2147483647:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,i=255&this._subParamsIdx[e];return i-t>0?this._subParams.subarray(t,i):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let i=this._subParamsIdx[t]>>8,s=255&this._subParamsIdx[t];s-i>0&&(e[t]=this._subParams.slice(i,s))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,s=i[t-1];i[t-1]=~s?Math.min(10*s+e,2147483647):e}},Zk=[],Qk=class{constructor(){this._state=0,this._active=Zk,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){var i;(i=this._handlers)[e]??(i[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let e=s.indexOf(t);-1!==e&&s.splice(e,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=Zk}reset(){if(2===this._state)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=Zk,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Zk,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,"START")}_put(e,t,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i);else this._handlerFb(this._id,"PUT",Vx(e,t,i))}start(){this.reset(),this._state=1}put(e,t,i){if(3!==this._state){if(1===this._state)for(;t<i;){let i=e[t++];if(59===i){this._state=2,this._start();break}if(i<48||57<i)return void(this._state=3);-1===this._id&&(this._id=0),this._id=10*this._id+i-48}2===this._state&&i-t>0&&this._put(e,t,i)}}end(e,t=!0){if(0!==this._state){if(3!==this._state)if(1===this._state&&this._start(),this._active.length){let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&!1===i){for(;s>=0&&(i=this._active[s].end(e),!0!==i);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._id,"END",e);this._active=Zk,this._id=-1,this._state=0}}},eC=class e{constructor(t){this._handler=t,this._data=new vk(e._payloadLimit),this._hitLimit=!1}start(){this._data.reset(),this._hitLimit=!1}put(e,t,i){this._hitLimit||this._data.append(Vx(e,t,i))&&(this._hitLimit=!0)}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data.toString()),t instanceof Promise))return t.then(e=>(this._data.reset(),this._hitLimit=!1,e));return this._data.reset(),this._hitLimit=!1,t}};eC._payloadLimit=1e7;var tC=eC,iC=[],sC=class{constructor(){this._handlers=Object.create(null),this._active=iC,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=iC}registerHandler(e,t){var i;(i=this._handlers)[e]??(i[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let e=s.indexOf(t);-1!==e&&s.splice(e,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=iC,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||iC,this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(t);else this._handlerFb(this._ident,"HOOK",t)}put(e,t,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i);else this._handlerFb(this._ident,"PUT",Vx(e,t,i))}unhook(e,t=!0){if(this._active.length){let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&!1===i){for(;s>=0&&(i=this._active[s].unhook(e),!0!==i);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"UNHOOK",e);this._active=iC,this._ident=0}},rC=new Jk;rC.addParam(0);var nC=class e{constructor(t){this._handler=t,this._data=new vk(e._payloadLimit),this._params=rC,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():rC,this._data.reset(),this._hitLimit=!1}put(e,t,i){this._hitLimit||this._data.append(Vx(e,t,i))&&(this._hitLimit=!0)}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data.toString(),this._params),t instanceof Promise))return t.then(e=>(this._params=rC,this._data.reset(),this._hitLimit=!1,e));return this._params=rC,this._data.reset(),this._hitLimit=!1,t}};nC._payloadLimit=1e7;var oC=nC,aC=[],lC=class{constructor(){this._handlers=Object.create(null),this._active=aC,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){var i;(i=this._handlers)[e]??(i[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let e=s.indexOf(t);-1!==e&&s.splice(e,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=aC}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].end(!1);this._stack.paused=!1,this._active=aC,this._ident=0}start(e){if(this.reset(),this._ident=e,this._active=this._handlers[e]||aC,this._active.length)for(let t=this._active.length-1;t>=0;t--)this._active[t].start();else this._handlerFb(this._ident,"START")}put(e,t,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i);else this._handlerFb(this._ident,"PUT",Vx(e,t,i))}end(e,t=!0){if(this._active.length){let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&!1===i){for(;s>=0&&(i=this._active[s].end(e),!0!==i);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"END",e);this._active=aC,this._ident=0}},cC=class e{constructor(t){this._handler=t,this._data=new vk(e._payloadLimit),this._hitLimit=!1}start(){this._data.reset(),this._hitLimit=!1}put(e,t,i){this._hitLimit||this._data.append(Vx(e,t,i))&&(this._hitLimit=!0)}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data.toString()),t instanceof Promise))return t.then(e=>(this._data.reset(),this._hitLimit=!1,e));return this._data.reset(),this._hitLimit=!1,t}};cC._payloadLimit=1e7;var hC=cC,uC=class{constructor(e){this.table=new Uint16Array(e)}setDefault(e,t){this.table.fill(e<<8|t)}add(e,t,i,s){this.table[t<<8|e]=i<<8|s}addMany(e,t,i,s){for(let r=0;r<e.length;r++)this.table[t<<8|e[r]]=i<<8|s}},dC=160,fC=function(){let e=new uC(4257),t=Array.apply(null,Array(256)).map((e,t)=>t),i=(e,i)=>t.slice(e,i),s=i(32,127),r=i(0,24);r.push(25),r.push.apply(r,i(28,32));let n=i(0,17);e.setDefault(1,0),e.addMany(s,0,2,0);for(let o of n)e.addMany([24,26,153,154],o,3,0),e.addMany(i(128,144),o,3,0),e.addMany(i(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158],o,0,7),e.add(159,o,11,14),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,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(i(28,32),8,0,8),e.addMany([88,94],1,0,7),e.addMany(s,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(95,1,11,14),e.addMany(r,14,0,14),e.add(127,14,0,14),e.addMany(i(32,48),14,9,15),e.addMany(i(48,127),14,15,16),e.addMany(i(48,127),15,15,16),e.addMany(r,15,0,15),e.addMany(i(32,48),15,9,15),e.add(127,15,0,15),e.addMany(s,16,16,16),e.addMany(r,16,0,16),e.addMany(i(8,14),16,16,16),e.add(127,16,0,16),e.addMany([27,156,24,26],16,17,0),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(r,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(dC,0,2,0),e.add(dC,8,5,8),e.add(dC,6,0,6),e.add(dC,11,0,11),e.add(dC,13,13,13),e.add(dC,16,16,16),e}(),pC=class extends jy{constructor(e=fC){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 Jk,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,i)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._executeHandlersArr=new Array(24).fill(void 0),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(Sy(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._executeHandlersArr=new Array(24).fill(void 0),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new Qk),this._dcsParser=this._register(new sC),this._apcParser=this._register(new lC),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=e.prefix.charCodeAt(0),i<60||i>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 t=0;t<e.intermediates.length;++t){let s=e.intermediates.charCodeAt(t);if(32>s||s>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=s}}if(1!==e.final.length)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 i<<=8,i|=s,i}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){var i;let s=this._identifier(e,[48,126]);(i=this._escHandlers)[s]??(i[s]=[]);let r=this._escHandlers[s];return r.push(t),{dispose:()=>{let e=r.indexOf(t);-1!==e&&r.splice(e,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){let i=e.charCodeAt(0);this._executeHandlers[i]=t,i<24&&(this._executeHandlersArr[i]=t)}clearExecuteHandler(e){let t=e.charCodeAt(0);this._executeHandlers[t]&&delete this._executeHandlers[t],t<24&&(this._executeHandlersArr[t]=void 0)}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){var i;let s=this._identifier(e);(i=this._csiHandlers)[s]??(i[s]=[]);let r=this._csiHandlers[s];return r.push(t),{dispose:()=>{let e=r.indexOf(t);-1!==e&&r.splice(e,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)}registerApcHandler(e,t){return e.prefix=void 0,this._apcParser.registerHandler(this._identifier(e,[48,126]),t)}clearApcHandler(e){e.prefix=void 0,this._apcParser.clearHandler(this._identifier(e,[48,126]))}setApcHandlerFallback(e){this._apcParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._apcParser.reset(),this._params.resetZdm(),this._collect=0,this.precedingJoinState=0,0!==this._parseStack.state&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,i,s,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=s,this._parseStack.chunkPos=r}parse(e,t,i){let s,r,n,o=0;if(this._parseStack.state)if(2===this._parseStack.state)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(void 0===i||1===this._parseStack.state)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let t=this._parseStack.handlers,r=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===i&&r>-1)for(;r>=0&&(n=t[r](this._params),!0!==n);r--)if(n instanceof Promise)return this._parseStack.handlerPos=r,n;this._parseStack.handlers=[];break;case 4:if(!1===i&&r>-1)for(;r>=0&&(n=t[r](),!0!==n);r--)if(n instanceof Promise)return this._parseStack.handlerPos=r,n;this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],n=this._dcsParser.unhook(24!==s&&26!==s,i),n)return n;27===s&&(this._parseStack.transition|=1),this._params.resetZdm(),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],n=this._oscParser.end(24!==s&&26!==s,i),n)return n;27===s&&(this._parseStack.transition|=1),this._params.resetZdm(),this._collect=0;break;case 7:if(s=e[this._parseStack.chunkPos],n=this._apcParser.end(24!==s&&26!==s,i),n)return n;27===s&&(this._parseStack.transition|=1),this._params.resetZdm(),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=255&this._parseStack.transition}for(let a=o;a<t;++a)if(s=e[a],s<24&&this.currentState<=6)(this._executeHandlersArr[s]??this._executeHandlerFb)(s),this.precedingJoinState=0;else{if(27===s&&this.currentState<8&&a+2<t&&91===e[a+1]){this._params.resetZdm(),this._collect=0;let i=a+2,s=e[i];s>=60&&s<=63&&(this._collect=s,i++);let o=!1;for(;i<t;i++)if(s=e[i],s>=48&&s<=57)this._params.addDigit(s-48);else if(59===s)this._params.addParam(0);else{if(58!==s){if(s>=64&&s<=126){let e=this._csiHandlers[this._collect<<8|s],t=e?e.length-1:-1;for(;t>=0&&(n=e[t](this._params),!0!==n);t--)if(n instanceof Promise)return r=1792,this._preserveStack(3,e,t,r,i),n;t<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0,a=i,this.currentState=0,o=!0;break}break}this._params.addSubParam(-1)}o||(a=i-1,this.currentState=4);continue}switch(r=this._transitions.table[this.currentState<<8|(s<dC?s:dC)],r>>8){case 2:let i=a,o=t-4;for(;i<o&&e[++i]>=32&&(e[i]<=126||e[i]>=dC)&&e[++i]>=32&&(e[i]<=126||e[i]>=dC)&&e[++i]>=32&&(e[i]<=126||e[i]>=dC)&&e[++i]>=32&&(e[i]<=126||e[i]>=dC););if(i>=o)for(;i<t&&e[i]>=32&&(e[i]<=126||e[i]>=dC);)i++;this._printHandler(e,a,i),a=i-1;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:a,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let l=this._csiHandlers[this._collect<<8|s],c=l?l.length-1:-1;for(;c>=0&&(n=l[c](this._params),!0!==n);c--)if(n instanceof Promise)return this._preserveStack(3,l,c,r,a),n;c<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(++a<t&&(s=e[a])>47&&s<60);a--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let h=this._escHandlers[this._collect<<8|s],u=h?h.length-1:-1;for(;u>=0&&(n=h[u](),!0!==n);u--)if(n instanceof Promise)return this._preserveStack(4,h,u,r,a),n;u<0&&this._escHandlerFb(this._collect<<8|s),this.precedingJoinState=0;break;case 11:this._params.resetZdm(),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|s,this._params);break;case 13:for(let r=a+1;;++r)if(r>=t||24===(s=e[r])||26===s||27===s||s>127&&s<dC){this._dcsParser.put(e,a,r),a=r-1;break}break;case 14:if(n=this._dcsParser.unhook(24!==s&&26!==s),n)return this._preserveStack(6,[],0,r,a),n;27===s&&(r|=1),this._params.resetZdm(),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let r=a+1;;r++)if(r>=t||(s=e[r])<32||s>127&&s<dC){this._oscParser.put(e,a,r),a=r-1;break}break;case 6:if(n=this._oscParser.end(24!==s&&26!==s),n)return this._preserveStack(5,[],0,r,a),n;27===s&&(r|=1),this._params.resetZdm(),this._collect=0,this.precedingJoinState=0;break;case 15:this._apcParser.start(this._collect<<8|s);break;case 16:for(let s=a+1;;++s)if(!(s<t&&(e[s]>=32&&e[s]<127||e[s]>=8&&e[s]<14||e[s]>=dC))){this._apcParser.put(e,a,s),a=s-1;break}break;case 17:if(n=this._apcParser.end(24!==s&&26!==s),n)return this._preserveStack(7,[],0,r,a),n;27===s&&(r|=1),this._params.resetZdm(),this._collect=0,this.precedingJoinState=0}this.currentState=255&r}}},gC=/^([\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})$/,vC=/^[\da-f]+$/;function mC(e){if(!e)return;let t=e.toLowerCase();if(t.startsWith("rgb:")){t=t.slice(4);let e=gC.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.startsWith("#")&&(t=t.slice(1),vC.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,i=[0,0,0];for(let s=0;s<3;++s){let r=parseInt(t.slice(e*s,e*s+e),16);i[s]=1===e?r<<4:2===e?r:3===e?r>>4:r>>8}return i}}function _C(e,t){let i=e.toString(16),s=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function bC(e,t=16){let[i,s,r]=e;return`rgb:${_C(i,t)}/${_C(s,t)}/${_C(r,t)}`}var xC={"(":0,")":1,"*":2,"+":3,"-":1,".":2};function yC(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 wC=0,SC=class extends jy{constructor(e,t,i,s,r,n,o,a,l=new pC){super(),this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=s,this._optionsService=r,this._oscLinkService=n,this._mouseStateService=o,this._unicodeService=a,this._parser=l,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Yx,this._utf8Decoder=new Gx,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=mk.clone(),this._eraseAttrDataInternal=mk.clone(),this._onRequestBell=this._register(new bw),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new bw),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new bw),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new bw),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new bw),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new bw),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new bw),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new bw),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new bw),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new bw),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new bw),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new bw),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new bw),this.onColor=this._onColor.event,this._onRequestColorSchemeQuery=this._register(new bw),this.onRequestColorSchemeQuery=this._onRequestColorSchemeQuery.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 kC(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug("Unknown EXECUTE code: ",{code:e})}),this._parser.setOscHandlerFallback((e,t,i)=>{this._logService.debug("Unknown OSC code: ",{identifier:e,action:t,data:i})}),this._parser.setDcsHandlerFallback((e,t,i)=>{"HOOK"===t&&(i=i.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(e),action:t,payload:i})}),this._parser.setApcHandlerFallback((e,t,i)=>{this._logService.debug("Unknown APC code: ",{identifier:this._parser.identToString(e),action:t,payload:i})}),this._parser.setPrintHandler((e,t,i)=>this.print(e,t,i)),this._parser.registerCsiHandler({final:"@"},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:"A"},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:"B"},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:"C"},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:"D"},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:"E"},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:"F"},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:"G"},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:"H"},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:"I"},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:"J"},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:"K"},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:"L"},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:"M"},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:"P"},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:"S"},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:"T"},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:"X"},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:"Z"},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"^"},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:"a"},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:"b"},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:"c"},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:">",final:"c"},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:"d"},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:"e"},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:"f"},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:"g"},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:"h"},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"h"},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:"l"},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"l"},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:"m"},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:"n"},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:"?",final:"n"},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},e=>this.softReset(e)),this._parser.registerCsiHandler({prefix:">",final:"q"},e=>this.sendXtVersion(e)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:"r"},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:"s"},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:"t"},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:"u"},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},e=>this.requestMode(e,!1)),this._parser.registerCsiHandler({prefix:"=",final:"u"},e=>this.kittyKeyboardSet(e)),this._parser.registerCsiHandler({prefix:"?",final:"u"},e=>this.kittyKeyboardQuery(e)),this._parser.registerCsiHandler({prefix:">",final:"u"},e=>this.kittyKeyboardPush(e)),this._parser.registerCsiHandler({prefix:"<",final:"u"},e=>this.kittyKeyboardPop(e)),this._parser.setExecuteHandler("",()=>this.bell()),this._parser.setExecuteHandler("\n",()=>this.lineFeed()),this._parser.setExecuteHandler("\v",()=>this.lineFeed()),this._parser.setExecuteHandler("\f",()=>this.lineFeed()),this._parser.setExecuteHandler("\r",()=>this.carriageReturn()),this._parser.setExecuteHandler("\b",()=>this.backspace()),this._parser.setExecuteHandler("\t",()=>this.tab()),this._parser.setExecuteHandler("",()=>this.shiftOut()),this._parser.setExecuteHandler("",()=>this.shiftIn()),this._parser.setExecuteHandler("„",()=>this.index()),this._parser.setExecuteHandler("…",()=>this.nextLine()),this._parser.setExecuteHandler("ˆ",()=>this.tabSet()),this._parser.registerOscHandler(0,new tC(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new tC(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new tC(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new tC(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new tC(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new tC(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new tC(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new tC(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new tC(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new tC(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new tC(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new tC(e=>this.restoreCursorColor(e))),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 c in Nk)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error("Parsing error: ",e),e)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new oC((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,i,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=s}_logSlowResolvingAsync(e){if(this._logService.logLevel<=3){let t,i=new Promise((e,i)=>{t=setTimeout(()=>i("#SLOW_TIMEOUT"),5e3)});Promise.race([e,i]).then(()=>{void 0!==t&&clearTimeout(t)},e=>{if(void 0!==t&&clearTimeout(t),"#SLOW_TIMEOUT"!==e)throw e;console.warn("async parser handler taking longer than 5000 ms")})}}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,s=this._activeBuffer.x,r=this._activeBuffer.y,n=0,o=this._parseStack.paused;if(o){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(i),i;s=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>131072&&(n=this._parseStack.position+131072)}if(this._logService.logLevel<=1&&this._logService.debug("parsing data "+("string"==typeof e?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join("")}"`)),0===this._logService.logLevel&&this._logService.trace("parsing data (codes)","string"==typeof e?e.split("").map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<131072&&(this._parseBuffer=new Uint32Array(Math.min(e.length,131072))),o||this._dirtyRowTracker.clearRange(),e.length>131072)for(let c=n;c<e.length;c+=131072){let t=c+131072<e.length?c+131072:e.length,n="string"==typeof e?this._stringDecoder.decode(e.substring(c,t),this._parseBuffer):this._utf8Decoder.decode(e.subarray(c,t),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,n))return this._preserveStack(s,r,n,c),this._logSlowResolvingAsync(i),i}else if(!o){let t="string"==typeof e?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,t))return this._preserveStack(s,r,t,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==s||this._activeBuffer.y!==r)&&this._onCursorMove.fire();let a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),l=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);l<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(l,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(e,t,i){let s,r,n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,l=this._coreService.decPrivateModes.wraparound,c=this._coreService.modes.insertMode,h=this._curAttrData,u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);if(!u)return;this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-t>0&&2===u.getWidth(this._activeBuffer.x-1)&&u.setCellFromCodepoint(this._activeBuffer.x-1,0,1,h);let d=this._parser.precedingJoinState;for(let f=t;f<i;++f){if(s=e[f],173===s)continue;if(s<127&&n){let e=n[String.fromCharCode(s)];e&&(s=e.charCodeAt(0))}let t=this._unicodeService.charProperties(s,d);r=qk.extractWidth(t);let i=qk.extractShouldJoin(t),p=i?qk.extractWidth(d):0;d=t,o&&this._onA11yChar.fire($x(s));let g=this._getCurrentLinkId();if(g&&this._oscLinkService.addLineToLink(g,this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-p>a)if(l){let e=u,t=this._activeBuffer.x-p;if(this._activeBuffer.x=p,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),u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),!u)return;for(p>0&&u instanceof yk&&u.copyCellsFrom(e,t,0,p,!1);t<a;)e.setCellFromCodepoint(t++,0,1,h)}else if(this._activeBuffer.x=a-1,2===r)continue;if(i&&this._activeBuffer.x){let e=u.getWidth(this._activeBuffer.x-1)?1:2;u.addCodepointToCell(this._activeBuffer.x-e,s,r);for(let t=r-p;--t>=0;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h);continue}if(c&&(u.insertCells(this._activeBuffer.x,r-p,this._activeBuffer.getNullCell(h)),2===u.getWidth(a-1)&&u.setCellFromCodepoint(a-1,0,1,h)),u.setCellFromCodepoint(this._activeBuffer.x++,s,r,h),r>0)for(;--r;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h)}this._parser.precedingJoinState=d,this._activeBuffer.x<a&&i-t>0&&0===u.getWidth(this._activeBuffer.x)&&!u.hasContent(this._activeBuffer.x)&&u.setCellFromCodepoint(this._activeBuffer.x,0,1,h),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return"t"!==e.final||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,t):this._parser.registerCsiHandler(e,e=>!yC(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e))}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new oC(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new tC(t))}registerApcHandler(e,t){return this._parser.registerApcHandler(e,new hC(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(0===this._activeBuffer.x&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&(null==(e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))?void 0: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 e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.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 0===t?delete this._activeBuffer.tabs[this._activeBuffer.x]:3===t&&(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 1===t&&(this._curAttrData.bg|=536870912),(2===t||0===t)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,i,s=!1,r=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),r),s&&(n.isWrapped=!1))}_resetBufferLine(e,t=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){var i;let s;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s++,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,t);s<this._bufferService.rows;s++)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(s);break;case 1:if(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols){let e=this._activeBuffer.lines.get(s+1);e&&(e.isWrapped=!1)}for(;s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(s=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,s-1);s--&&!(null==(i=this._activeBuffer.lines.get(this._activeBuffer.ybase+s))?void 0:i.getTrimmedLength()););for(;s>=0;s--)this._bufferService.scroll(this._eraseAttrData())}else{for(s=this._bufferService.rows,this._dirtyRowTracker.markDirty(s-1);s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}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,0===this._activeBuffer.x,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)}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 i=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;t--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(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 i,s=this._activeBuffer.ybase+this._activeBuffer.y;for(i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-i;t--;)this._activeBuffer.lines.splice(s,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}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(mk));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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);e.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);e.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);e.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);e.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.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 i=e.params[0]||1,s=qk.extractWidth(t),r=this._activeBuffer.x-s,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),o=new Uint32Array(n.length*i),a=0;for(let c=0;c<n.length;){let e=n.codePointAt(c)||0;o[a++]=e,c+=e>65535?2:1}let l=a;for(let c=1;c<i;++c)o.copyWithin(l,0,a),l+=a;return this.print(o,0,l),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent("[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent("[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent("[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent("[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent("[>83;40003;0c")),!0}sendXtVersion(e){return e.params[0]>0||this._coreService.triggerDataEvent("P>|xterm.js(6.1.0-beta.290)\\"),!0}_is(e){return(this._optionsService.rawOptions.termName+"").startsWith(e)}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}return!0}setModePrivate(e){var t,i,s,r;for(let n=0;n<e.length;n++)switch(e.params[n]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Mk),this._charsetService.setgCharset(1,Mk),this._charsetService.setgCharset(2,Mk),this._charsetService.setgCharset(3,Mk);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:(null==(t=this._optionsService.rawOptions.quirks)?void 0:t.allowSetCursorBlink)&&(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._mouseStateService.activeProtocol="X10";break;case 1e3:this._mouseStateService.activeProtocol="VT200";break;case 1002:this._mouseStateService.activeProtocol="DRAG";break;case 1003:this._mouseStateService.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._mouseStateService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._mouseStateService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:if(null==(i=this._optionsService.rawOptions.vtExtensions)?void 0:i.kittyKeyboard){let e=this._coreService.kittyKeyboard;e.mainFlags=e.flags,e.flags=e.altFlags}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;case 2031:((null==(s=this._optionsService.rawOptions.vtExtensions)?void 0:s.colorSchemeQuery)??1)&&(this._coreService.decPrivateModes.colorSchemeUpdates=!0);break;case 9001:(null==(r=this._optionsService.rawOptions.vtExtensions)?void 0:r.win32InputMode)&&(this._coreService.decPrivateModes.win32InputMode=!0)}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}return!0}resetModePrivate(e){var t,i,s,r;for(let n=0;n<e.length;n++)switch(e.params[n]){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:(null==(t=this._optionsService.rawOptions.quirks)?void 0:t.allowSetCursorBlink)&&(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._mouseStateService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._mouseStateService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:if(null==(i=this._optionsService.rawOptions.vtExtensions)?void 0:i.kittyKeyboard){let e=this._coreService.kittyKeyboard;e.altFlags=e.flags,e.flags=e.mainFlags}this._bufferService.buffers.activateNormalBuffer(),1049===e.params[n]&&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;case 2031:((null==(s=this._optionsService.rawOptions.vtExtensions)?void 0:s.colorSchemeQuery)??1)&&(this._coreService.decPrivateModes.colorSchemeUpdates=!1);break;case 9001:(null==(r=this._optionsService.rawOptions.vtExtensions)?void 0:r.win32InputMode)&&(this._coreService.decPrivateModes.win32InputMode=!1)}return!0}requestMode(e,t){var i;let s;var r;(r=s||(s={}))[r.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",r[r.SET=1]="SET",r[r.RESET=2]="RESET",r[r.PERMANENTLY_SET=3]="PERMANENTLY_SET",r[r.PERMANENTLY_RESET=4]="PERMANENTLY_RESET";let n=this._coreService.decPrivateModes,{activeProtocol:o,activeEncoding:a}=this._mouseStateService,l=this._coreService,{buffers:c,cols:h}=this._bufferService,{active:u,alt:d}=c,f=this._optionsService.rawOptions,p=(e,i)=>(l.triggerDataEvent(`[${t?"":"?"}${e};${i}$y`),!0),g=e=>e?1:2,v=e.params[0];return t?p(v,2===v?4:4===v?g(l.modes.insertMode):12===v?3:20===v?g(f.convertEol):0):1===v?p(v,g(n.applicationCursorKeys)):3===v?p(v,f.windowOptions.setWinLines?80===h?2:132===h?1:0:0):6===v?p(v,g(n.origin)):7===v?p(v,g(n.wraparound)):8===v?p(v,3):9===v?p(v,g("X10"===o)):12===v?p(v,g(f.cursorBlink)):25===v?p(v,g(!l.isCursorHidden)):45===v?p(v,g(n.reverseWraparound)):66===v?p(v,g(n.applicationKeypad)):67===v?p(v,4):1e3===v?p(v,g("VT200"===o)):1002===v?p(v,g("DRAG"===o)):1003===v?p(v,g("ANY"===o)):1004===v?p(v,g(n.sendFocus)):1005===v?p(v,4):1006===v?p(v,g("SGR"===a)):1015===v?p(v,4):1016===v?p(v,g("SGR_PIXELS"===a)):1048===v?p(v,1):47===v||1047===v||1049===v?p(v,g(u===d)):2004===v?p(v,g(n.bracketedPasteMode)):2026===v?p(v,g(n.synchronizedOutput)):9001===v&&(null==(i=this._optionsService.rawOptions.vtExtensions)?void 0:i.win32InputMode)?p(v,g(n.win32InputMode)):p(v,0)}_updateAttrColor(e,t,i,s,r){return 2===t?(e|=50331648,e&=-16777216,e|=Xx.fromColorRGB([i,s,r])):5===t&&(e&=-67108864,e|=33554432|255&i),e}_extractColor(e,t,i){let s=[0,0,-1,0,0,0],r=0,n=0;do{if(s[n+r]=e.params[t+n],e.hasSubParams(t+n)){let i=e.getSubParams(t+n),o=0;do{5===s[1]&&(r=1),s[n+o+1+r]=i[o]}while(++o<i.length&&o+n+1+r<s.length);break}if(5===s[1]&&n+r>=2||2===s[1]&&n+r>=5)break;s[1]&&(r=1)}while(++n+t<e.length&&n+r<s.length);for(let o=2;o<s.length;++o)-1===s[o]&&(s[o]=0);switch(s[0]){case 38:i.fg=this._updateAttrColor(i.fg,s[1],s[3],s[4],s[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,s[1],s[3],s[4],s[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,s[1],s[3],s[4],s[5])}return n}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,0===e&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=mk.fg,e.bg=mk.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){var t,i;if(1===e.length&&0===e.params[0])return this._processSGR0(this._curAttrData),!0;let s,r=e.length,n=this._curAttrData;for(let o=0;o<r;o++)s=e.params[o],s>=30&&s<=37?(n.fg&=-67108864,n.fg|=16777216|s-30):s>=40&&s<=47?(n.bg&=-67108864,n.bg|=16777216|s-40):s>=90&&s<=97?(n.fg&=-67108864,n.fg|=16777224|s-90):s>=100&&s<=107?(n.bg&=-67108864,n.bg|=16777224|s-100):0===s?this._processSGR0(n):1===s?n.fg|=134217728:3===s?n.bg|=67108864:4===s?(n.fg|=268435456,this._processUnderline(e.hasSubParams(o)?e.getSubParams(o)[0]:1,n)):5===s?n.fg|=536870912:7===s?n.fg|=67108864:8===s?n.fg|=1073741824:9===s?n.fg|=2147483648:2===s?n.bg|=134217728:21===s?this._processUnderline(2,n):22===s?(n.fg&=-134217729,n.bg&=-134217729):23===s?n.bg&=-67108865:24===s?(n.fg&=-268435457,this._processUnderline(0,n)):25===s?n.fg&=-536870913:27===s?n.fg&=-67108865:28===s?n.fg&=-1073741825:29===s?n.fg&=2147483647:39===s?(n.fg&=-67108864,n.fg|=16777215&mk.fg):49===s?(n.bg&=-67108864,n.bg|=16777215&mk.bg):38===s||48===s||58===s?o+=this._extractColor(e,o,n):53===s?n.bg|=1073741824:55===s?n.bg&=-1073741825:221===s&&((null==(t=this._optionsService.rawOptions.vtExtensions)?void 0:t.kittySgrBoldFaintControl)??1)?n.fg&=-134217729:222===s&&((null==(i=this._optionsService.rawOptions.vtExtensions)?void 0:i.kittySgrBoldFaintControl)??1)?n.bg&=-134217729:59===s?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):this._logService.debug("Unknown SGR attribute: %d.",s);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent("");break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`[${e};${t}R`)}return!0}deviceStatusPrivate(e){var t;switch(e.params[0]){case 6:let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`[?${e};${i}R`);break;case 15:case 25:case 26:case 53:break;case 996:((null==(t=this._optionsService.rawOptions.vtExtensions)?void 0:t.colorSchemeQuery)??1)&&this._onRequestColorSchemeQuery.fire()}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=mk.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=0===e.length?1:e.params[0];if(0===t)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"}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t,i=e.params[0]||1;return(e.length<2||(t=e.params[1])>this._bufferService.rows||0===t)&&(t=this._bufferService.rows),t>i&&(this._activeBuffer.scrollTop=i-1,this._activeBuffer.scrollBottom=t-1,this._setCursor(0,0)),!0}windowOptions(e){if(!yC(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==t&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(0===t||2===t)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),(0===t||1===t)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:(0===t||2===t)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(0===t||1===t)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}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,this._activeBuffer.savedCharsets=this._charsetService.charsets.slice(),this._activeBuffer.savedGlevel=this._charsetService.glevel,this._activeBuffer.savedOriginMode=this._coreService.decPrivateModes.origin,this._activeBuffer.savedWraparoundMode=this._coreService.decPrivateModes.wraparound,!0}restoreCursor(e){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;for(let t=0;t<this._activeBuffer.savedCharsets.length;t++)this._charsetService.setgCharset(t,this._activeBuffer.savedCharsets[t]);return this._charsetService.setgLevel(this._activeBuffer.savedGlevel),this._coreService.decPrivateModes.origin=this._activeBuffer.savedOriginMode,this._coreService.decPrivateModes.wraparound=this._activeBuffer.savedWraparoundMode,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=[],i=e.split(";");for(;i.length>1;){let e=i.shift(),s=i.shift();if(/^\d+$/.exec(e)){let i=parseInt(e,10);if(CC(i))if("?"===s)t.push({type:0,index:i});else{let e=mC(s);e&&t.push({type:1,index:i,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(-1===t)return!0;let i=e.slice(0,t).trim(),s=e.slice(t+1);return s?this._createHyperlink(i,s):!i.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let i,s=e.split(":"),r=s.findIndex(e=>e.startsWith("id="));return-1!==r&&(i=s[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:i,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 i=e.split(";");for(let s=0;s<i.length&&!(t>=this._specialColors.length);++s,++t)if("?"===i[s])this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let e=mC(i[s]);e&&this._onColor.fire([{type:1,index:this._specialColors[t],color:e}])}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=[],i=e.split(";");for(let s=0;s<i.length;++s)if(/^\d+$/.exec(i[s])){let e=parseInt(i[s],10);CC(e)&&t.push({type:2,index:e})}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,Mk),!0}selectCharset(e){return 2!==e.length?(this.selectDefaultCharset(),!0):("/"===e[0]||this._charsetService.setgCharset(xC[e[0]],Nk[e[1]]??Mk),!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=mk.clone(),this._eraseAttrDataInternal=mk.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Zx;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let i=this._activeBuffer.ybase+this._activeBuffer.y+t,s=this._activeBuffer.lines.get(i);s&&(s.fill(e),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let i=this._bufferService.buffer,s=this._optionsService.rawOptions;return(e=>(this._coreService.triggerDataEvent(`${e}\\`),!0))('"q'===e?`P1$r${this._curAttrData.isProtected()?1:0}"q`:'"p'===e?'P1$r61;1"p':"r"===e?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:"m"===e?"P1$r0m":" q"===e?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}kittyKeyboardSet(e){var t;if(!(null==(t=this._optionsService.rawOptions.vtExtensions)?void 0:t.kittyKeyboard))return!0;let i=e.params[0]||0,s=e.length>1&&e.params[1]||1,r=this._coreService.kittyKeyboard;switch(s){case 1:r.flags=i;break;case 2:r.flags|=i;break;case 3:r.flags&=~i}return!0}kittyKeyboardQuery(e){var t;if(!(null==(t=this._optionsService.rawOptions.vtExtensions)?void 0:t.kittyKeyboard))return!0;let i=this._coreService.kittyKeyboard.flags;return this._coreService.triggerDataEvent(`[?${i}u`),!0}kittyKeyboardPush(e){var t;if(!(null==(t=this._optionsService.rawOptions.vtExtensions)?void 0:t.kittyKeyboard))return!0;let i=e.params[0]||0,s=this._coreService.kittyKeyboard,r=this._bufferService.buffer===this._bufferService.buffers.alt?s.altStack:s.mainStack;return r.length>=16&&r.shift(),r.push(s.flags),s.flags=i,!0}kittyKeyboardPop(e){var t;if(!(null==(t=this._optionsService.rawOptions.vtExtensions)?void 0:t.kittyKeyboard))return!0;let i=Math.max(1,e.params[0]||1),s=this._coreService.kittyKeyboard,r=this._bufferService.buffer===this._bufferService.buffers.alt?s.altStack:s.mainStack;for(let n=0;n<i&&r.length>0;n++)s.flags=r.pop();return 0===r.length&&i>0&&(s.flags=0),!0}},kC=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&&(wC=e,e=t,t=wC),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function CC(e){return 0<=e&&e<256}kC=Ax([Tx(0,ty)],kC);var jC=class extends jy{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._innerWriteTimer=this._register(new My),this._onWriteParsed=this._register(new bw),this.onWriteParsed=this._onWriteParsed.event,this._register(Sy(()=>{this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0}))}handleUserInput(){this._didUserInput=!0}flushSync(){if(this._store.isDisposed||this._isSyncWriting)return;this._isSyncWriting=!0;let e,t=!1;for(;e=this._writeBuffer.shift();){t=!0,this._action(e);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._writeBuffer.length=0,this._callbacks.length=0,this._isSyncWriting=!1,t&&this._onWriteParsed.fire()}writeSync(e,t){if(this._store.isDisposed)return;if(void 0!==t&&this._syncCalls>t)return void(this._syncCalls=0);if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let i;for(this._isSyncWriting=!0;i=this._writeBuffer.shift();){this._action(i);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(!this._store.isDisposed){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),void this._innerWrite();this._scheduleInnerWrite()}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}}_scheduleInnerWrite(e=0,t=!0){this._store.isDisposed||this._innerWriteTimer.cancelAndSet(()=>this._innerWrite(e,t),0)}_innerWrite(e=0,t=!0){if(this._store.isDisposed)return;let i=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],s=this._action(e,t);if(s){let e=e=>{this._store.isDisposed||(performance.now()-i>=12?this._scheduleInnerWrite(0,e):this._innerWrite(i,e))};return void s.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e)}let r=this._callbacks[this._bufferOffset];if(r&&r(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-i>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),this._scheduleInnerWrite()):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},NC=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(void 0===e.id){let i=t.addMarker(t.ybase+t.y),s={data:e,id:this._nextId++,lines:[i]};return i.onDispose(()=>this._removeMarkerFromLink(s,i)),this._dataByLinkId.set(s.id,s),s.id}let i=e,s=this._getEntryIdKey(i),r=this._entriesWithId.get(s);if(r)return this.addLineToLink(r.id,t.ybase+t.y),r.id;let n=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(o,n)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let i=this._dataByLinkId.get(e);if(i&&i.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);i.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(i,e))}}getLinkData(e){var t;return null==(t=this._dataByLinkId.get(e))?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let i=e.lines.indexOf(t);-1!==i&&(e.lines.splice(i,1),0===e.lines.length&&(void 0!==e.data.id&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};NC=Ax([Tx(0,ty)],NC);var MC=!1,EC=class extends jy{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Ny),this._onBinary=this._register(new bw),this.onBinary=this._onBinary.event,this._onData=this._register(new bw),this.onData=this._onData.event,this._onLineFeed=this._register(new bw),this.onLineFeed=this._onLineFeed.event,this._onRender=this._register(new bw),this.onRender=this._onRender.event,this._onResize=this._register(new bw),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new bw),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new bw),this._instantiationService=new uk,this.optionsService=this._register(new Ak(e)),this._instantiationService.setService(ay,this.optionsService),this._logService=this._register(this._instantiationService.createInstance(fk)),this._instantiationService.setService(oy,this._logService),this._bufferService=this._register(this._instantiationService.createInstance(Lk)),this._instantiationService.setService(ty,this._bufferService),this.coreService=this._register(this._instantiationService.createInstance(Ok)),this._instantiationService.setService(sy,this.coreService),this.mouseStateService=this._register(this._instantiationService.createInstance(Uk)),this._instantiationService.setService(iy,this.mouseStateService),this.unicodeService=this._register(this._instantiationService.createInstance(qk)),this.unicodeService.register(new Yk),this._instantiationService.setService(cy,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Gk),this._instantiationService.setService(ry,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(NC),this._instantiationService.setService(ly,this._oscLinkService),this._inputHandler=this._register(new SC(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.mouseStateService,this.unicodeService)),this._register(uw.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(uw.forward(this._bufferService.onResize,this._onResize)),this._register(uw.forward(this.coreService.onData,this._onData)),this._register(uw.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(["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 jC((e,t)=>this._inputHandler.parse(e,t))),this._register(uw.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new bw),this._onScroll.event(e=>{var t;null==(t=this._onScrollApi)||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&&!MC&&(this._logService.warn("writeSync is unreliable and will be removed soon."),MC=!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,2),t=Math.max(t,1),this._writeBuffer.flushSync(),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;0!==t&&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)}registerApcHandler(e,t){return this._inputHandler.registerApcHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.mouseStateService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&void 0!==t.backend&&void 0!==t.buildNumber&&(e="conpty"===t.backend&&t.buildNumber<21376),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(Xk.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Xk(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Sy(()=>{for(let t of e)t.dispose()})}}},BC=0,DC=class{constructor(e,t){this._getKey=e,this._array=[],this._insertedValues=[],this._isFlushingInserted=!1,this._deletedIndices=[],this._isFlushingDeleted=!1,this._flushInsertedTask=new PS(t),this._flushDeletedTask=new PS(t)}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(),0===this._insertedValues.length&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,i=0,s=new Array(this._array.length+this._insertedValues.length);for(let r=0;r<s.length;r++)i>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[i])?(s[r]=e[t],t++):s[r]=this._array[i++];this._array=s,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),0===this._array.length)return!1;let t=this._getKey(e);if(void 0===t||-1===(BC=this._search(t))||this._getKey(this._array[BC])!==t)return!1;do{if(this._array[BC]===e)return 0===this._deletedIndices.length&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(BC),!0}while(++BC<this._array.length&&this._getKey(this._array[BC])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,i=new Array(this._array.length-e.length),s=0;for(let r=0;r<this._array.length;r++)e[t]===r?t++:i[s++]=this._array[r];this._array=i,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&(!((BC=this._search(e))<0||BC>=this._array.length)&&this._getKey(this._array[BC])===e))do{yield this._array[BC]}while(++BC<this._array.length&&this._getKey(this._array[BC])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&(!((BC=this._search(e))<0||BC>=this._array.length)&&this._getKey(this._array[BC])===e))do{t(this._array[BC])}while(++BC<this._array.length&&this._getKey(this._array[BC])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,i=this._array.length-1;for(;i>=t;){let s=t+i>>1,r=this._getKey(this._array[s]);if(r>e)i=s-1;else{if(!(r<e)){for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}t=s+1}}return t}},LC=0,RC=0,PC=class extends jy{constructor(e,t){super(),this._logService=e,this._bufferService=t,this._lineCache=this._register(new AC),this._onDecorationRegistered=this._register(new bw),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new bw),this.onDecorationRemoved=this._onDecorationRemoved.event,this._decorations=new DC(e=>null==e?void 0:e.marker.line,this._logService),this._register(Sy(()=>this.reset())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._lineCache.attachToBufferLines(this._bufferService.buffer.lines)})),this._lineCache.attachToBufferLines(this._bufferService.buffer.lines)}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new TC(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),i=t.onDispose(()=>{i.dispose(),t&&(this._decorations.delete(t)&&(this._lineCache.remove(t),this._onDecorationRemoved.fire(t)),e.dispose())});this._decorations.insert(t),this._lineCache.add(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear(),this._lineCache.clear()}*getDecorationsAtCell(e,t,i){let s=this._lineCache.getDecorationsOnLine(t);if(s)for(let r of s)LC=r.options.x??0,RC=LC+(r.options.width??1),e>=LC&&e<RC&&(!i||(r.options.layer??"bottom")===i)&&(yield r)}forEachDecorationAtCell(e,t,i,s){let r=this._lineCache.getDecorationsOnLine(t);if(r)for(let n of r)LC=n.options.x??0,RC=LC+(n.options.width??1),e>=LC&&e<RC&&(!i||(n.options.layer??"bottom")===i)&&s(n)}};PC=Ax([Tx(0,oy),Tx(1,ty)],PC);var AC=class extends jy{constructor(){super(...arguments),this._decorationsByLine=new Map,this._decorations=new Set,this._bufferLineListeners=this._register(new Ny),this._lineIndexSyncTimer=this._register(new Ey),this._lineIndexSyncCallbacks=[]}clear(){this._lineIndexSyncCallbacks.length=0,this._lineIndexSyncTimer.cancel(),this._decorationsByLine.clear(),this._decorations.clear()}add(e){this._decorations.add(e),this._addToLineBuckets(e)}remove(e){this._decorations.delete(e),this._removeFromLineBuckets(e)}getDecorationsOnLine(e){return this._decorationsByLine.get(e)}attachToBufferLines(e){let t=new Cy;this._bufferLineListeners.value=t,t.add(e.onTrim(e=>this._handleBufferLinesTrim(e))),t.add(e.onInsert(e=>this._handleBufferLinesInsert(e))),t.add(e.onDelete(e=>this._handleBufferLinesDelete(e)))}_getDecorationHeight(e){return e.options.height??1}_addToLineBuckets(e){let t=e.marker.line;if(t<0)return;e._indexedStartLine=t;let i=this._getDecorationHeight(e);for(let s=t;s<t+i;s++){let t=this._decorationsByLine.get(s);t||(t=[],this._decorationsByLine.set(s,t)),t.push(e)}}_removeFromLineBuckets(e){let t=e._indexedStartLine,i=this._getDecorationHeight(e);for(let s=t;s<t+i;s++){let t=this._decorationsByLine.get(s);if(!t)continue;let i=t.indexOf(e);-1!==i&&t.splice(i,1),0===t.length&&this._decorationsByLine.delete(s)}}_reindexDecoration(e){this._removeFromLineBuckets(e),!e.marker.isDisposed&&e.marker.line>=0&&this._addToLineBuckets(e)}_scheduleLineIndexSync(e){this._lineIndexSyncCallbacks.push(e),this._lineIndexSyncTimer.set(()=>{let e=this._lineIndexSyncCallbacks;this._lineIndexSyncCallbacks=[];for(let t of e)t()})}_handleBufferLinesTrim(e){if(e<=0)return;let t=new Map;for(let[i,s]of this._decorationsByLine){let r=i-e;r<0||this._mergeLineBucket(t,r,s)}this._decorationsByLine.clear();for(let[i,s]of t)this._decorationsByLine.set(i,s);for(let i of this._decorations)i.marker.isDisposed||(i._indexedStartLine-=e)}_handleBufferLinesInsert(e){this._scheduleLineIndexSync(()=>this._applyBufferLinesInsert(e))}_handleBufferLinesDelete(e){this._scheduleLineIndexSync(()=>this._applyBufferLinesDelete(e))}_mergeLineBucket(e,t,i){let s=e.get(t);if(s)for(let r=0,n=i.length;r<n;r++)s.push(i[r]);else e.set(t,i.slice())}_applyBufferLinesInsert(e){let{index:t,amount:i}=e,s=[];for(let n of this._decorations){if(n.marker.isDisposed)continue;let e=n._indexedStartLine;e<t&&e+this._getDecorationHeight(n)>t&&(s.push(n),this._removeFromLineBuckets(n))}let r=new Map;for(let[n,o]of this._decorationsByLine){let e=n>=t?n+i:n;this._mergeLineBucket(r,e,o)}this._decorationsByLine.clear();for(let[n,o]of r)this._decorationsByLine.set(n,o);for(let n of this._decorations)n.marker.isDisposed||n._indexedStartLine>=t&&(n._indexedStartLine=n.marker.line);for(let n of s)this._addToLineBuckets(n)}_applyBufferLinesDelete(e){let t=e.index+e.amount,i=new Map;for(let[r,n]of this._decorationsByLine){if(r>=e.index&&r<t)continue;let s=r>=t?r-e.amount:r;this._mergeLineBucket(i,s,n)}this._decorationsByLine.clear();for(let[r,n]of i)this._decorationsByLine.set(r,n);let s=[];for(let r of this._decorations){if(r.marker.isDisposed)continue;let i=r._indexedStartLine,n=this._getDecorationHeight(r);i>=t?r._indexedStartLine=r.marker.line:i<e.index&&i+n>t&&s.push(r)}for(let r of s)this._reindexDecoration(r)}},TC=class extends Cy{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new bw),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new bw),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this._indexedStartLine=e.marker.line,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return null===this._cachedBg&&(this.options.backgroundColor?this._cachedBg=qw.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return null===this._cachedFg&&(this.options.foregroundColor?this._cachedFg=qw.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},zC=class{constructor(e,t=1e3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&(clearTimeout(this._refreshTimeoutID),this._refreshTimeoutID=void 0),this._additionalRefreshRequested=!1}refresh(e,t,i){this._rowCount=i,e=e??0,t=t??this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t;let s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)void 0!==this._refreshTimeoutID&&(clearTimeout(this._refreshTimeoutID),this._refreshTimeoutID=void 0,this._additionalRefreshRequested=!1),this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=s-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)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)}},OC=class extends jy{constructor(e,t,i,s){super(),this._terminal=e,this._coreBrowserService=i,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,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=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new zC(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(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar("\n"))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Ry(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Sy(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,"\n"===e&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent=Hx())))}_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 i=this._terminal.buffer,s=i.lines.length.toString();for(let r=e;r<=t;r++){let e=i.lines.get(i.ydisp+r),t=[],n=(null==e?void 0:e.translateToString(!0,void 0,void 0,t))||"",o=(i.ydisp+r+1).toString(),a=this._rowElements[r];a&&(0===n.length?(a.textContent=" ",this._rowColumns.set(a,[0,1])):(a.textContent=n,this._rowColumns.set(a,t)),a.setAttribute("aria-posinset",o),a.setAttribute("aria-setsize",s),this._alignRowWidth(a))}this._announceCharacters()}_announceCharacters(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent===Hx()&&this._clearLiveRegion(),this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let i,s,r=e.target,n=this._rowElements[0===t?1:this._rowElements.length-2];if(r.getAttribute("aria-posinset")!==(0===t?"1":`${this._terminal.buffer.lines.length}`)&&e.relatedTarget===n){if(0===t?(i=r,s=this._rowElements.pop(),this._rowContainer.removeChild(s)):(i=this._rowElements.shift(),s=r,this._rowContainer.removeChild(i)),i.removeEventListener("focus",this._topBoundaryFocusListener),s.removeEventListener("focus",this._bottomBoundaryFocusListener),0===t){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement("afterbegin",e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(0===t?-1:1),this._rowElements[0===t?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}}_handleSelectionChange(){var e;if(0===this._rowElements.length)return;let t=this._coreBrowserService.mainDocument.getSelection();if(!t)return;if(t.isCollapsed)return void(this._rowContainer.contains(t.anchorNode)&&this._terminal.clearSelection());if(!t.anchorNode||!t.focusNode)return void console.error("anchorNode and/or focusNode are null");let i={node:t.anchorNode,offset:t.anchorOffset},s={node:t.focusNode,offset:t.focusOffset};if((i.node.compareDocumentPosition(s.node)&Node.DOCUMENT_POSITION_PRECEDING||i.node===s.node&&i.offset>s.offset)&&([i,s]=[s,i]),i.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(i={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(i.node))return;let r=this._rowElements.slice(-1)[0];if(s.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(s={node:r,offset:(null==(e=r.textContent)?void 0:e.length)??0}),!this._rowContainer.contains(s.node))return;let n=({node:e,offset:t})=>{let i=e instanceof Text?e.parentNode:e,s=parseInt(null==i?void 0:i.getAttribute("aria-posinset"),10)-1;if(isNaN(s))return console.warn("row is invalid. Race condition?"),null;let r=this._rowColumns.get(i);if(!r)return console.warn("columns is null. Race condition?"),null;let n=t<r.length?r[t]:r.slice(-1)[0]+1;return n>=this._terminal.cols&&(++s,n=0),{row:s,column:n}},o=n(i),a=n(s);if(o&&a){if(o.row>a.row||o.row===a.row&&o.column>=a.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(a.row-o.row)*this._terminal.cols-o.column+a.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 t,i;e.style.transform="";let s=e.getBoundingClientRect().width,r=null==(i=null==(t=this._rowColumns.get(e))?void 0:t.slice(-1))?void 0:i[0];if(!r)return;let n=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${n/s})`}};OC=Ax([Tx(1,ny),Tx(2,py),Tx(3,my)],OC);var IC=class extends jy{constructor(e,t,i,s,r){super(),this._element=e,this._mouseCoordsService=t,this._renderService=i,this._bufferService=s,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new bw),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new bw),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Sy(()=>{var e;ky(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,null==(e=this._activeProviderReplies)||e.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Ry(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Ry(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Ry(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Ry(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element);if(!t)return;this._isMouseOut=!1;let i=e.composedPath();for(let s=0;s<i.length;s++){let e=i[s];if(e.classList.contains("xterm"))break;if(e.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)return this._clearCurrentLink(),this._askForLink(e,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var i,s;(!this._activeProviderReplies||!t)&&(null==(i=this._activeProviderReplies)||i.forEach(e=>{null==e||e.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[n,o]of this._linkProviderService.linkProviders.entries())t?(null==(s=this._activeProviderReplies)?void 0:s.get(n))&&(r=this._checkLinkProviderResult(n,e,r)):o.provideLinks(e.y,t=>{var i,s;if(this._isMouseOut)return;let o=null==t?void 0:t.map(e=>({link:e}));null==(i=this._activeProviderReplies)||i.set(n,o),r=this._checkLinkProviderResult(n,e,r),(null==(s=this._activeProviderReplies)?void 0:s.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let i=new Set;for(let s=0;s<t.size;s++){let r=t.get(s);if(r)for(let t=0;t<r.length;t++){let s=r[t],n=s.link.range.start.y<e?0:s.link.range.start.x,o=s.link.range.end.y>e?this._bufferService.cols:s.link.range.end.x;for(let e=n;e<=o;e++){if(i.has(e)){r.splice(t--,1);break}i.add(e)}}}}_checkLinkProviderResult(e,t,i){var s;if(!this._activeProviderReplies)return i;let r=this._activeProviderReplies.get(e),n=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(n=!0);if(!n&&r){let e=r.find(e=>this._linkAtPosition(e.link,t));e&&(i=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let o=0;o<this._activeProviderReplies.size;o++){let e=null==(s=this._activeProviderReplies.get(o))?void 0:s.find(e=>this._linkAtPosition(e.link,t));if(e){i=!0,this._handleNewLink(e);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element);var i,s;t&&this._mouseDownLink&&(i=this._mouseDownLink.link,s=this._currentLink.link,i.text===s.text&&i.range.start.x===s.range.start.x&&i.range.start.y===s.range.start.y&&i.range.end.x===s.range.end.x&&i.range.end.y===s.range.end.y)&&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,ky(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||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 e,t;return null==(t=null==(e=this._currentLink)?void 0:e.state)?void 0:t.decorations.pointerCursor},set:e=>{var t;(null==(t=this._currentLink)?void 0:t.state)&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",e))}},underline:{get:()=>{var e,t;return null==(t=null==(e=this._currentLink)?void 0:e.state)?void 0:t.decorations.underline},set:t=>{var i,s,r;(null==(i=this._currentLink)?void 0:i.state)&&(null==(r=null==(s=this._currentLink)?void 0:s.state)?void 0:r.decorations.underline)!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=0===e.start?0:e.start+1+this._bufferService.buffer.ydisp,i=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(t,i),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,i){var s;(null==(s=this._currentLink)?void 0: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(i,t.text)}_fireUnderlineEvent(e,t){let i=e.range,s=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-s-1,i.end.x,i.end.y-s-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,i){var s;(null==(s=this._currentLink)?void 0: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(i,t.text)}_linkAtPosition(e,t){let i=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return i<=r&&r<=s}_positionFromMouseEvent(e,t){let i=this._mouseCoordsService.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,i,s,r){return{x1:e,y1:t,x2:i,y2:s,cols:this._bufferService.cols,fg:r}}};IC=Ax([Tx(1,gy),Tx(2,my),Tx(3,ty),Tx(4,yy)],IC);var FC=class extends EC{constructor(e={}){super(e),this._linkifier=this._register(new Ny),this.browser=Gy,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Ny),this._onCursorMove=this._register(new bw),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new bw),this.onKey=this._onKey.event,this._onSelectionChange=this._register(new bw),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new bw),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new bw),this.onBell=this._onBell.event,this._onFocus=this._register(new bw),this._onBlur=this._register(new bw),this._onA11yCharEmitter=this._register(new bw),this._onA11yTabEmitter=this._register(new bw),this._onWillOpen=this._register(new bw),this._onDimensionsChange=this._register(new bw),this.onDimensionsChange=this._onDimensionsChange.event,this._setup(),this._decorationService=this._instantiationService.createInstance(PC),this._instantiationService.setService(hy,this._decorationService),this._keyboardService=this._instantiationService.createInstance(ck),this._instantiationService.setService(wy,this._keyboardService),this._linkProviderService=this._instantiationService.createInstance(_S),this._instantiationService.setService(yy,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(uy)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh((null==e?void 0:e.start)??0,(null==e?void 0:e.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(uw.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(uw.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(uw.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(uw.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(Sy(()=>{var e,t;this._customKeyEventHandler=void 0,null==(t=null==(e=this.element)?void 0:e.parentNode)||t.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}get dimensions(){if(!this._renderService)return;let e=this._renderService.dimensions;return{css:{canvas:{...e.css.canvas},cell:{...e.css.cell}},device:{canvas:{...e.device.canvas},cell:{...e.device.cell},char:{...e.device.char}}}}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,i;switch(t.index){case 256:e="foreground",i="10";break;case 257:e="background",i="11";break;case 258:e="cursor",i="12";break;default:e="ansi",i="4;"+t.index}switch(t.type){case 0:let s=Uw.toColorRGB("ansi"===e?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`]${i};${bC(s)}\\`);break;case 1:if("ansi"===e)this._themeService.modifyColors(e=>e.ansi[t.index]=Ww.toColor(...t.color));else{let i=e;this._themeService.modifyColors(e=>e[i]=Ww.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index)}}}_reportColorScheme(){if(!this._themeService)return;let e=$w.relativeLuminance(this._themeService.colors.background.rgba>>8)<$w.relativeLuminance(this._themeService.colors.foreground.rgba>>8)?1:2;this.coreService.triggerDataEvent(`[?997;${e}n`)}_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(OC,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(""),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return null==(e=this.textarea)?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(""),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 i=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,r=t.getWidth(i),n=this._renderService.dimensions.css.cell.width*r,o=this.buffer.y*this._renderService.dimensions.css.cell.height,a=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=o+"px",this.textarea.style.width=n+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Ry(this.element,"copy",e=>{var t,i;this.hasSelection()&&(t=e,i=this._selectionService,t.clipboardData&&t.clipboardData.setData("text/plain",i.selectionText),t.preventDefault())}));let e=e=>function(e,t,i,s){e.stopPropagation(),e.clipboardData&&Kx(e.clipboardData.getData("text/plain"),t,i,s)}(e,this.textarea,this.coreService,this.optionsService);this._register(Ry(this.textarea,"paste",e)),this._register(Ry(this.element,"paste",e)),Qy?this._register(Ry(this.element,"mousedown",e=>{2===e.button&&qx(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Ry(this.element,"contextmenu",e=>{qx(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),aw&&this._register(Ry(this.element,"auxclick",e=>{1===e.button&&Ux(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Ry(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Ry(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Ry(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Ry(this.textarea,"compositionstart",()=>{this._syncTextArea(),this._compositionHelper.compositionstart(),this._compositionHelper.updateCompositionElements()})),this._register(Ry(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Ry(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Ry(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var t,i,s;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"),(null==(t=this.element)?void 0:t.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));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"),this.element.classList.toggle("allow-transparency",this.options.allowTransparency),this._register(this.optionsService.onSpecificOptionChange("allowTransparency",e=>this.element.classList.toggle("allow-transparency",e))),e.appendChild(this.element);let r=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),r.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Ry(this.screenElement,"mousemove",e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),r.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Ox()),lw||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(vS,this.textarea,e.ownerDocument.defaultView??window,this._document??(typeof window<"u"?window.document:null))),this._instantiationService.setService(py,this._coreBrowserService),this._register(Ry(this.textarea,"focus",e=>this._handleTextAreaFocus(e))),this._register(Ry(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(dS,this._document,this._helperContainer),this._instantiationService.setService(fy,this._charSizeService),this._themeService=this._instantiationService.createInstance(rk),this._instantiationService.setService(xy,this._themeService),this._register(this._inputHandler.onRequestColorSchemeQuery(()=>this._reportColorScheme())),this._register(this._themeService.onChangeColors(()=>{this.coreService.decPrivateModes.colorSchemeUpdates&&this._reportColorScheme()})),this._characterJoinerService=this._instantiationService.createInstance(iS),this._instantiationService.setService(by,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(TS,this.rows,this.screenElement)),this._instantiationService.setService(my,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this._register(this._renderService.onDimensionsChange(e=>this._onDimensionsChange.fire({css:{canvas:{...e.css.canvas},cell:{...e.css.cell}},device:{canvas:{...e.device.canvas},cell:{...e.device.cell},char:{...e.device.char}}}))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Hw,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseCoordsService=this._instantiationService.createInstance(xS),this._instantiationService.setService(gy,this._mouseCoordsService);let o=this._linkifier.value=this._register(this._instantiationService.createInstance(IC,this.screenElement));this.element.appendChild(r);try{this._onWillOpen.fire(this.element)}catch(c){this._logService.error("onWillOpen handler threw an exception",c)}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._syncTextArea()})),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(Pw,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(YS,this.element,this.screenElement,o)),this._instantiationService.setService(_y,this._selectionService),this._mouseService=this._instantiationService.createInstance(BS),this._instantiationService.setService(vy,this._mouseService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(uw.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var e;this._selectionService.refresh(),null==(e=this._viewport)||e.queueSync()})),this._register(this._instantiationService.createInstance(Aw,this.screenElement)),this._register(Ry(this.element,"mousedown",e=>this._selectionService.handleMouseDown(e))),this.mouseStateService.areMouseEventsActive&&!this.options.mouseEventsRequireAlt?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):(this._selectionService.enable(),this.element.classList.remove("enable-mouse-events")),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(OC,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",e=>this._handleScreenReaderModeOptionChange(e)));let a=(null==(i=this.options.scrollbar)?void 0:i.showScrollbar)??!0,l=null==(s=this.options.scrollbar)?void 0:s.width;a&&l&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Fw,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("scrollbar",e=>{let t=((null==e?void 0:e.showScrollbar)??!0)&&!!(null==e?void 0:e.width);!this._overviewRulerRenderer&&t&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Fw,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this._mouseService.bindMouse({element:this.element,screenElement:this.screenElement,document:this._document,handleTouchScroll:e=>{var t;return null==(t=this._viewport)?void 0:t.handleTouchScroll(e)}},e=>this._register(e),()=>this.focus())}_createRenderer(){return this._instantiationService.createInstance(hS,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}refresh(e,t,i=!1){var s;null==(s=this._renderService)||s.refreshRows(e,t,i)}updateCursorStyle(e){var t;(null==(t=this._selectionService)?void 0: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;0!==t&&this.scrollLines(t)}paste(e){Kx(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this.mouseStateService.setCustomWheelEventHandler(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}select(e,t,i){this._selectionService.setSelection(e,t,i)}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;null==(e=this._selectionService)||e.clearSelection()}selectAll(){var e;null==(e=this._selectionService)||e.selectAll()}selectLines(e,t){var i;null==(i=this._selectionService)||i.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))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&&("Dead"===e.key||"AltGraph"===e.key)&&(this._unprocessedDeadKey=!0);let i=this._keyboardService.evaluateKeyDown(e);if(this.updateCursorStyle(e),3===i.type||2===i.type){let t=this.rows-1;return this.scrollLines(2===i.type?-t:t),e.preventDefault(),e.stopPropagation(),!1}if(1===i.type&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(i.cancel&&(e.preventDefault(),e.stopPropagation()),!i.key)||!this._keyboardService.useKitty&&!this._keyboardService.useWin32InputMode&&e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&1===e.key.length&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;(""===i.key||"\r"===i.key)&&(this.textarea.value="");let s=this._keyboardService.useWin32InputMode&&HC(e);if(this._onKey.fire({key:i.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!s),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return e.preventDefault(),e.stopPropagation(),!1;this._keyDownHandled=!0}_isThirdLevelShift(e,t){let i=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"keypress"===t.type?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){if(this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return;HC(e)||this.focus();let t=this._keyboardService.evaluateKeyUp(e);if(null==t?void 0:t.key){let i=this._keyboardService.useWin32InputMode&&HC(e);this.coreService.triggerDataEvent(t.key,!i)}this.updateCursorStyle(e),this._keyPressHandled=!1}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(e.charCode)t=e.charCode;else if(null===e.which||void 0===e.which)t=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e))&&(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&&"insertText"===e.inputType&&(!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),!0}return!1}resize(e,t){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){var i;null==(i=this._charSizeService)||i.measure()}clear(){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(mk));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}reset(){var e,t;this.options.rows=this.rows,this.options.cols=this.cols;let i=this._customKeyEventHandler;this._setup(),super.reset(),null==(e=this._mouseService)||e.reset(),null==(t=this._selectionService)||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=i,this.refresh(0,this.rows-1,!0)}clearTextureAtlas(){var e;null==(e=this._renderService)||e.clearTextureAtlas()}_reportFocus(){var e;(null==(e=this.element)?void 0:e.classList.contains("focus"))?this.coreService.triggerDataEvent(""):this.coreService.triggerDataEvent("")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`[4;${t};${e}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`[6;${s};${i}t`)}}};function HC(e){return 16===e.keyCode||17===e.keyCode||18===e.keyCode||91===e.keyCode||92===e.keyCode||93===e.keyCode||224===e.keyCode||"Meta"===e.key}var WC=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=()=>this._wrappedAddonDispose(i),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let i=0;i<this._addons.length;i++)if(this._addons[i]===e){t=i;break}if(-1===t)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)}},KC=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 Zx)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}},UC=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 KC(t)}getNullCell(){return new Zx}},qC=class extends jy{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new bw),this.onBufferChange=this._onBufferChange.event,this._normal=new UC(this._core.buffers.normal,"normal"),this._alternate=new UC(this._core.buffers.alt,"alternate"),this._register(this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},$C=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,i)=>t(e,i.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)}registerApcHandler(e,t){return this._core.registerApcHandler(e,t)}},VC=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}},YC=["cols","rows"],GC=0,XC=class extends jy{constructor(e){super(),this._core=this._register(new FC(e)),this._addonManager=this._register(new WC),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],i=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let s in this._core.options){let e={get:t.bind(this,s),set:i.bind(this,s)};Object.defineProperty(this._publicOptions,s,e)}}_checkReadonlyOptions(e){if(YC.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 onDimensionsChange(){return this._core.onDimensionsChange}get element(){return this._core.element}get screenElement(){return this._core.screenElement}get parser(){return this._parser??(this._parser=new $C(this._core))}get unicode(){return this._checkProposedApi(),new VC(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 qC(this._core)))}get markers(){return this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.mouseStateService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any"}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,showCursor:!this._core.coreService.isCursorHidden,synchronizedOutputMode:e.synchronizedOutput,win32InputMode:e.win32InputMode,wraparoundMode:e.wraparound}}get dimensions(){return this._core.dimensions}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._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)}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\n",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 Ox()},set promptLabel(e){Ix(e)},get tooMuchOutput(){return Hx()},set tooMuchOutput(e){Wx(e)}}}_verifyIntegers(...e){for(GC of e)if(GC===1/0||isNaN(GC)||GC%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(GC of e)if(GC&&(GC===1/0||isNaN(GC)||GC%1!=0||GC<0))throw new Error("This API only accepts positive integers")}};function JC({id:e,kind:t,theme:i,active:s,transport:r,register:n}){var o;const a=gi.useRef(null),l=gi.useRef(null),c=gi.useRef(null),[h,u]=gi.useState(null),d=gi.useCallback(()=>{var e;const t=null==(e=l.current)?void 0:e.getSelection();t&&navigator.clipboard.writeText(t).catch(()=>{})},[]),f=gi.useCallback(()=>{const e=l.current;e&&navigator.clipboard.readText().then(t=>{t&&e.paste(t)}).catch(()=>{})},[]);gi.useEffect(()=>{const s=a.current;if(!s)return;const o=new XC({fontFamily:'"JetBrains Mono", ui-monospace, SFMono-Regular, monospace',fontSize:12.5,lineHeight:1.25,cursorBlink:!0,scrollback:5e3,theme:Dx(i),vtExtensions:{kittyKeyboard:!0}}),h=new Lx;o.loadAddon(h),o.open(s);try{h.fit()}catch{}l.current=o,c.current=h,n(o),r.spawn(e,t,o.cols,o.rows);const p=r.subscribe(e,e=>{if("output"===e.type)o.write(e.data);else if("error"===e.type)o.write(`\r\n${e.message}\r\n`);else if("exit"===e.type){const t=null===e.exitCode?"":` (${e.exitCode})`;o.write(`\r\n[process exited${t}]\r\n`)}}),g=o.onData(t=>r.sendData(e,t)),v=/Mac|iPhone|iPad/i.test(navigator.platform||navigator.userAgent);o.attachCustomKeyEventHandler(e=>{if("keydown"!==e.type)return!0;const t=e.key.toLowerCase();return v&&e.metaKey&&!e.ctrlKey&&!e.altKey?"v"===t?(f(),!1):"c"!==t||!o.hasSelection()||(d(),!1):!(!v&&e.ctrlKey&&!e.metaKey&&!e.altKey)||("v"===t?(f(),!1):"c"!==t||!e.shiftKey&&!o.hasSelection()||(d(),!1))});const m=e=>{e.preventDefault(),u({x:e.clientX,y:e.clientY})};s.addEventListener("contextmenu",m);const _=o.onResize(({cols:t,rows:i})=>r.resize(e,t,i));let b;const x=new ResizeObserver(()=>{void 0!==b&&window.clearTimeout(b),b=window.setTimeout(()=>{b=void 0,(()=>{const e=a.current;if(e&&0!==e.offsetWidth&&0!==e.offsetHeight)try{h.fit()}catch{}})()},120)});return x.observe(s),()=>{void 0!==b&&window.clearTimeout(b),x.disconnect(),s.removeEventListener("contextmenu",m),g.dispose(),_.dispose(),p(),r.close(e),n(null),o.dispose()}},[]),gi.useEffect(()=>{l.current&&(l.current.options.theme=Dx(i))},[i]),gi.useEffect(()=>{if(!s)return;const e=requestAnimationFrame(()=>{var e,t;try{null==(e=c.current)||e.fit(),null==(t=l.current)||t.focus()}catch{}});return()=>cancelAnimationFrame(e)},[s]);const p=[{kind:"item",icon:"copy",label:"Copy",disabled:!(null==(o=l.current)?void 0:o.hasSelection()),onSelect:d},{kind:"item",label:"Paste",onSelect:f},{kind:"separator"},{kind:"item",label:"Select all",onSelect:()=>{var e;return null==(e=l.current)?void 0:e.selectAll()}},{kind:"item",label:"Clear",onSelect:()=>{var e;return null==(e=l.current)?void 0:e.clear()}}];return ki.jsxs(ki.Fragment,{children:[ki.jsx("div",{ref:a,className:"h-full w-full"}),h&&ki.jsx(Nx,{x:h.x,y:h.y,onClose:()=>u(null),items:p})]})}const ZC=["local","claude","codex"],QC=__(function(){const e=w_(),t=e.terminal,i=e.theme.theme,s=gi.useRef(new Map),r=gi.useCallback((e,t)=>{t?s.current.set(e,t):s.current.delete(e)},[]),[n,o]=gi.useState(null),a=Cx({value:t.height,onChange:e=>t.setHeight(e),axis:"y",dir:-1,min:t.heightMin,max:()=>t.heightMax}),l=t.activeKind?Bx[t.activeKind]:null,c=[{kind:"header",label:"New session"},...ZC.map(e=>({kind:"item",icon:Bx[e].icon,label:Bx[e].label,onSelect:()=>t.newTerm(e)}))],h=[{kind:"item",icon:"refresh",label:"Clear buffer",disabled:!t.activeId,onSelect:()=>{var e;t.activeId&&(null==(e=s.current.get(t.activeId))||e.clear())}},{kind:"separator"},{kind:"item",icon:"x",label:"Close session",tone:"danger",disabled:!t.activeId,onSelect:()=>{t.activeId&&t.closeTerm(t.activeId)}}];return ki.jsxs("div",{className:cx("relative shrink-0",t.open?"flex":"hidden"),style:{height:t.height},children:[ki.jsx(Mx,{axis:"y",onPointerDown:a,className:"-top-[6px]"}),ki.jsxs("div",{className:"uno-island flex min-h-0 flex-1 flex-col",children:[ki.jsxs("div",{className:"flex h-9 shrink-0 items-stretch gap-1 border-b border-edge bg-panel pl-3 pr-1",children:[ki.jsx("div",{className:"flex items-center pr-1 text-[12px] font-semibold text-fg-3",children:"Terminal"}),ki.jsxs("div",{className:"uno-thin-scroll flex min-w-0 flex-1 items-stretch gap-1 overflow-x-auto py-1",children:[t.tabs.map(e=>{const i=Bx[e.kind],s=e.id===t.activeId;return ki.jsx(Ex,{label:i.label,active:s,closeLabel:`Close ${i.label} session`,onActivate:()=>t.activate(e.id),onClose:()=>t.closeTerm(e.id),leading:ki.jsx(ux,{name:i.icon,className:cx("h-3.5 w-3.5 shrink-0",s?"":i.tint)})},e.id)}),ki.jsxs("div",{className:"flex shrink-0 items-center self-center",children:[ki.jsx("button",{type:"button",onClick:()=>t.newTerm("local"),title:"New Local terminal",className:"grid h-7 w-7 place-items-center rounded-md text-fg-3 hover:bg-raised hover:text-fg",children:ki.jsx(ux,{name:"plus",className:"h-4 w-4"})}),ki.jsx("button",{type:"button",onClick:e=>{const t=e.currentTarget.getBoundingClientRect();o({x:t.left,y:t.bottom+4,mode:"new"})},title:"New session…",className:"grid h-7 w-5 place-items-center rounded-md text-fg-4 hover:bg-raised hover:text-fg-2",children:ki.jsx(ux,{name:"chevronD",className:"h-3.5 w-3.5"})})]})]}),ki.jsxs("div",{className:"flex items-center gap-0.5 self-center",children:[l&&ki.jsxs("button",{type:"button",onClick:e=>{const t=e.currentTarget.getBoundingClientRect();o({x:Math.max(6,t.right-208),y:t.bottom+4,mode:"new"})},className:"flex h-7 items-center gap-1.5 rounded-md px-2 text-fg-3 hover:bg-raised hover:text-fg",title:"Start a new session",children:[ki.jsx(ux,{name:l.icon,className:cx("h-3.5 w-3.5",l.tint)}),ki.jsx("span",{className:"font-mono text-[11.5px]",children:l.label}),ki.jsx(ux,{name:"chevronD",className:"h-3.5 w-3.5 opacity-60"})]}),ki.jsx("button",{type:"button",onClick:e=>{const t=e.currentTarget.getBoundingClientRect();o({x:Math.max(6,t.right-208),y:t.bottom+4,mode:"more"})},title:"More",className:"grid h-7 w-7 place-items-center rounded-md text-fg-3 hover:bg-raised hover:text-fg",children:ki.jsx(ux,{name:"more",className:"h-4 w-4"})}),ki.jsx("button",{type:"button",onClick:()=>t.hide(),title:"Hide terminal (⌃`)",className:"grid h-7 w-7 place-items-center rounded-md text-fg-3 hover:bg-raised hover:text-fg",children:ki.jsx(ux,{name:"minus",className:"h-4 w-4"})})]})]}),ki.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden bg-canvas px-2 pt-1",children:[0===t.tabs.length&&ki.jsx("div",{className:"flex h-full items-center justify-center font-mono text-[11.5px] text-fg-4",children:"no sessions · click + to start one"}),t.tabs.map(s=>ki.jsx("div",{className:cx("absolute inset-0 px-2 pt-1",s.id===t.activeId?"block":"hidden"),children:ki.jsx(JC,{id:s.id,kind:s.kind,theme:i,active:t.open&&s.id===t.activeId,transport:e.terminalTransport,register:e=>r(s.id,e)})},s.id))]})]}),n&&ki.jsx(Nx,{x:n.x,y:n.y,onClose:()=>o(null),items:"new"===n.mode?c:h})]})});function ej({id:e}){return ki.jsx("div",{className:"grid h-full place-items-center px-6",children:ki.jsxs("div",{className:"text-center",children:[ki.jsx(ux,{name:"alert",className:"mx-auto h-5 w-5 text-fg-4"}),ki.jsxs("div",{className:"mt-2 font-mono text-[12.5px] text-fg-3",children:["not found: ",e]})]})})}const tj={neutral:"border-edge-soft bg-raised text-fg-3",pass:"border-pass/30 bg-pass/10 text-pass",fail:"border-fail/30 bg-fail/10 text-fail",run:"border-warn/30 bg-warn/10 text-warn",warn:"border-warn/30 bg-warn/10 text-warn",info:"border-accent/30 bg-accent/10 text-accent",purple:"border-accent/30 bg-accent/10 text-accent"};function ij({children:e,tone:t="neutral",size:i="sm"}){return ki.jsx("span",{className:cx("inline-flex items-center gap-1 rounded border font-mono font-medium uppercase tracking-wider","xs"===i?"h-[14px] px-1 text-[9.5px]":"h-5 px-1.5 text-[10.5px]",tj[t]),children:e})}const sj={passed:"bg-pass",failed:"bg-fail",running:"bg-warn",paused:"bg-warn",pending:"bg-fg-4",aborted:"bg-fg-4",expected:"bg-expected",never:"border border-fg-4"},rj={passed:"ring-pass/15",failed:"ring-fail/15",running:"ring-warn/15",paused:"ring-warn/25",pending:"ring-fg-4/10",aborted:"ring-fg-4/10",expected:"ring-expected/15",never:"ring-transparent"};function nj({status:e,large:t=!1,pulse:i=!0}){const s=t?"h-2.5 w-2.5":"h-2 w-2";return ki.jsx("span",{className:cx("inline-block shrink-0 rounded-full ring-2",s,sj[e],"running"===e&&i&&"uno-pulse",rj[e])})}function oj(e){return null==e?"—":e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(2)}s`:`${Math.floor(e/6e4)}m ${Math.round(e%6e4/1e3)}s`}function aj(e){if(null==e)return"never run";const t="string"==typeof e?new Date(e).getTime():e;if(!Number.isFinite(t))return"—";const i=Math.max(0,Math.round((Date.now()-t)/1e3));return i<60?`${i}s ago`:i<3600?`${Math.round(i/60)}m ago`:i<86400?`${Math.round(i/3600)}h ago`:i<604800?`${Math.round(i/86400)}d ago`:new Date(t).toISOString().slice(0,10)}function lj(e,t){return null===e?"never":V_(e)?t?"expected":"failed":t&&"passed"===e?"failed":hj(e)}function cj(e){return e?hj(e.status):"never"}function hj(e){switch(e){case"running":return"running";case"passed":return"passed";case"failed":return"failed";case"aborted":case"interrupted":return"aborted"}}function uj(e){switch(e){case"passed":return"pass";case"failed":return"fail";case"running":return"run";case"paused":case"aborted":return"warn";default:return"neutral"}}const dj=__(function({runId:e}){const t=w_(),i=t.activeRuns.collectionByRunId.get(e),s=t.runs.items.find(t=>t.runId===e),r=!i&&s?t.historicRuns.get(e):null;gi.useEffect(()=>{!i&&s&&t.historicRuns.loadIfNeeded(e)},[e,i,s,t.historicRuns]);const n=function(e,t,i,s){if(i)return function(e,t){var i;const s=new Map,r=new Map;for(const u of t.events)"collection-run:scenario-started"===u.kind?s.set(u.scenario,u.t):"collection-run:scenario-finished"===u.kind&&r.set(u.scenario,u.t);const n=t.scenarios.map(i=>{const n=t.childRunIds.get(i)??null,o=t.childOutcomes.get(i)??null,a=n?e.activeRuns.byRunId.get(n):null,l=e.scenarios.items.find(e=>e.name===i),{status:c,skipReason:h}=fj({hasChildRunId:null!==n,childOutcome:o,childLiveStatus:(null==a?void 0:a.status)??null});return{scenario:i,status:c,durationMs:pj(s.get(i)??null,r.get(i)??null),childRunId:n,scenarioPath:(null==l?void 0:l.path)??null,skipReason:h}}),o=n.filter(e=>"passed"===e.status).length,a=n.filter(e=>"failed"===e.status).length,l=n.filter(e=>"running"===e.status||"paused"===e.status).length,c=t.startedAt,h=null!==t.outcome?(null==(i=t.events[t.events.length-1])?void 0:i.t)??null:null;return{headerStatus:gj(t),ref:t.collection||"—",durationMs:null!==h?h-c:null,rows:n,passed:o,failed:a,running:l,total:n.length||t.scenarios.length,abortable:"starting"===t.status||"running"===t.status}}(t,i);if(s&&"collection"===s.meta.kind)return function(e,t){let i=[];const s=new Map,r=new Map,n=new Map,o=new Map;for(const h of t.events)"collection-run:started"===h.kind?i=[...h.scenarios]:"collection-run:scenario-started"===h.kind?(s.set(h.scenario,h.scenarioRunId),n.set(h.scenario,h.t)):"collection-run:scenario-finished"===h.kind&&(r.set(h.scenario,h.outcome),o.set(h.scenario,h.t));const a=i.map(t=>{const i=s.get(t)??null,a=r.get(t)??null,l=e.scenarios.items.find(e=>e.name===t),{status:c,skipReason:h}=fj({hasChildRunId:null!==i,childOutcome:a,childLiveStatus:null});return{scenario:t,status:c,durationMs:pj(n.get(t)??null,o.get(t)??null),childRunId:i,scenarioPath:(null==l?void 0:l.path)??null,skipReason:h}}),l=a.filter(e=>"passed"===e.status).length,c=a.filter(e=>"failed"===e.status).length;return{headerStatus:hj(t.meta.status),ref:t.meta.ref,durationMs:t.meta.durationMs,rows:a,passed:l,failed:c,running:0,total:a.length,abortable:!1}}(t,{meta:s.meta,events:s.events});const r=t.runs.items.find(t=>t.runId===e);if(r&&"collection"===r.kind)return{headerStatus:hj(r.status),ref:r.ref,durationMs:r.durationMs,rows:[],passed:0,failed:0,running:0,total:0,abortable:!1};return null}(e,t,i,r);if(!n)return ki.jsx(ej,{id:e});const{headerStatus:o,ref:a,durationMs:l,rows:c,passed:h,failed:u,running:d,total:f,abortable:p}=n;return ki.jsxs("div",{className:"flex h-full min-w-0 flex-col",children:[ki.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-3 border-b border-edge bg-canvas px-4",children:[ki.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[ki.jsx(ux,{name:"layers",className:"h-4 w-4 shrink-0 text-fg-3"}),ki.jsx(nj,{status:o,large:!0}),ki.jsx("span",{className:"truncate font-mono text-[13px] text-fg",children:a}),ki.jsx(ij,{tone:uj(o),children:o}),ki.jsx(ij,{tone:"info",children:"collection"})]}),ki.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-2 whitespace-nowrap font-mono text-[11.5px] text-fg-2 sm:gap-3",children:[ki.jsxs("span",{className:"hidden tabular-nums sm:inline",children:[h,"/",f," passed"]}),u>0&&ki.jsxs("span",{className:"tabular-nums text-fail",children:[u," failed"]}),ki.jsx("span",{className:"tabular-nums",children:oj(l)}),p&&t.session.capabilities.canRun&&ki.jsxs("button",{type:"button",onClick:()=>{t.activeRuns.abort(e)},title:"Stop the collection — sends SIGTERM to all in-flight scenarios",className:"flex h-6 items-center gap-1 rounded border border-fail/40 px-2 font-mono text-[11px] text-fail hover:bg-fail/10",children:[ki.jsx(ux,{name:"square",className:"h-3 w-3",strokeWidth:2.5})," Stop"]})]})]}),ki.jsxs("div",{className:"flex h-2 shrink-0 overflow-hidden bg-raised",children:[ki.jsx("div",{className:"h-full bg-pass",style:{width:h/Math.max(1,f)*100+"%"}}),ki.jsx("div",{className:"h-full bg-fail",style:{width:u/Math.max(1,f)*100+"%"}}),ki.jsx("div",{className:cx("h-full bg-warn",d>0&&"uno-pulse"),style:{width:d/Math.max(1,f)*100+"%"}})]}),ki.jsxs("div",{className:"flex-1 overflow-auto",children:[ki.jsxs("div",{className:"flex h-7 items-center gap-2 border-b border-edge-soft px-4 font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:[ki.jsx("span",{className:"w-4"}),ki.jsx("span",{className:"flex-1",children:"scenario"}),ki.jsx("span",{className:"w-20 text-right",children:"time"})]}),c.map(e=>ki.jsxs("button",{type:"button",onClick:()=>{e.childRunId?t.tabs.open({kind:"scenario-run",runId:e.childRunId}):e.scenarioPath&&t.tabs.open({kind:"scenario",path:e.scenarioPath})},className:"group flex h-10 w-full items-center gap-2 border-b border-edge-soft px-4 text-left hover:bg-raised/60",children:[ki.jsx(nj,{status:e.status,large:!0}),ki.jsxs("div",{className:"min-w-0 flex-1",children:[ki.jsx("div",{className:"truncate font-mono text-[12.5px] text-fg",children:e.scenario}),e.skipReason&&ki.jsxs("div",{className:"mt-0.5 truncate font-mono text-[10px] text-fg-4",children:["skipped — ",e.skipReason]})]}),ki.jsx("span",{className:"w-20 text-right font-mono text-[11px] tabular-nums text-fg-2",children:oj(e.durationMs)}),ki.jsx(ux,{name:"chevronR",className:"h-3.5 w-3.5 text-fg-4 group-hover:text-fg-3"})]},e.scenario)),0===c.length&&ki.jsx("div",{className:"px-4 py-6 text-center font-mono text-[11.5px] text-fg-4",children:"collection has no scenarios"})]})]})});function fj(e){return null!==e.childOutcome?{status:mj(e.childOutcome),skipReason:null}:null!==e.childLiveStatus?{status:vj(e.childLiveStatus),skipReason:null}:e.hasChildRunId?{status:"running",skipReason:null}:{status:"pending",skipReason:"skipped"}}function pj(e,t){return null===e||null===t?null:Math.max(0,t-e)}function gj(e){switch(e.status){case"queued":return"pending";case"starting":case"running":return"running";case"completed":return"passed";case"failed":return"failed";case"aborted":return"aborted"}}function vj(e){switch(e){case"queued":return"pending";case"starting":case"running":return"running";case"paused":return"paused";case"completed":return"passed";case"failed":return"failed";case"aborted":return"aborted"}}function mj(e){switch(e){case"completed":return"passed";case"failed":return"failed";case"aborted":case"interrupted":return"aborted"}}function _j({anchor:e,candidates:t,onPick:i,onClose:s}){const r=gi.useRef(null),n=gi.useRef(null),o=gi.useRef(null),[a,l]=gi.useState(""),[c,h]=gi.useState(0),[u,d]=gi.useState(!1),f=e.top-12,p=window.innerHeight-e.bottom-12,g=p>f?"down":"up",v=gi.useMemo(()=>{const e=a.trim().toLowerCase();return e?t.filter(t=>t.name.toLowerCase().includes(e)):t},[a,t]);gi.useEffect(()=>{h(0)},[a,v.length]),gi.useEffect(()=>{var e;null==(e=n.current)||e.focus();const t=requestAnimationFrame(()=>d(!0));return()=>cancelAnimationFrame(t)},[]),gi.useEffect(()=>{const e=e=>{var t;(null==(t=r.current)?void 0:t.contains(e.target))||s()},t=e=>{"Escape"===e.key&&s()},i=e=>{var t;(null==(t=r.current)?void 0:t.contains(e.target))||s()};return window.addEventListener("mousedown",e,!0),window.addEventListener("contextmenu",e,!0),window.addEventListener("keydown",t),window.addEventListener("scroll",i,!0),()=>{window.removeEventListener("mousedown",e,!0),window.removeEventListener("contextmenu",e,!0),window.removeEventListener("keydown",t),window.removeEventListener("scroll",i,!0)}},[s]),gi.useEffect(()=>{0===t.length&&s()},[t.length,s]);const m=e=>{var t;const i=null==(t=o.current)?void 0:t.children[e];null==i||i.scrollIntoView({block:"nearest"})},_=e=>{var t;const s=v[e];s&&(i(s.name),l(""),null==(t=n.current)||t.focus())},b={position:"fixed",left:e.left,width:e.width,maxHeight:Math.max(180,"up"===g?f:p),opacity:u?1:0,transform:u?"translateY(0)":"up"===g?"translateY(2px)":"translateY(-2px)",transitionProperty:"opacity, transform",transitionDuration:"90ms",transitionTimingFunction:"ease-out",..."up"===g?{bottom:window.innerHeight-e.top+6}:{top:e.bottom+6}};return ki.jsxs("div",{ref:r,role:"dialog",style:b,className:cx("z-50 flex flex-col overflow-hidden rounded-lg p-1","border border-edge-soft bg-overlay/95 backdrop-blur","shadow-lg"),children:[ki.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1.5 rounded-md px-2",children:[ki.jsx(ux,{name:"search",className:"h-3.5 w-3.5 text-fg-3"}),ki.jsx("input",{ref:n,value:a,onChange:e=>l(e.target.value),onKeyDown:e=>{if("ArrowDown"===e.key)e.preventDefault(),h(e=>{const t=Math.min(v.length-1,e+1);return m(t),t});else if("ArrowUp"===e.key)e.preventDefault(),h(e=>{const t=Math.max(0,e-1);return m(t),t});else if("Enter"===e.key)e.preventDefault(),_(c);else if("Home"===e.key)e.preventDefault(),h(0),m(0);else if("End"===e.key){e.preventDefault();const t=v.length-1;h(t),m(t)}},spellCheck:!1,autoComplete:"off",placeholder:"filter scenarios…",className:"min-w-0 flex-1 bg-transparent font-mono text-[12px] text-fg placeholder-fg-4 outline-none"}),ki.jsxs("span",{className:"font-mono text-[10px] tracking-wider text-fg-4",children:[v.length,"/",t.length]})]}),ki.jsx("div",{className:"my-1 h-px shrink-0 bg-edge-soft"}),ki.jsx("div",{ref:o,className:"min-h-0 flex-1 overflow-auto",children:0===v.length?ki.jsxs("div",{className:"px-2 py-3 text-center font-mono text-[11.5px] text-fg-4",children:['no match for "',a.trim(),'"']}):v.map((e,t)=>{const i=t===c;return ki.jsxs("button",{type:"button",onMouseEnter:()=>h(t),onMouseDown:e=>e.preventDefault(),onClick:()=>_(t),className:cx("flex h-7 w-full items-center gap-2 rounded-md px-2 text-left",i?"bg-selection text-fg":"text-fg-2 hover:bg-raised/60"),children:[ki.jsx(ux,{name:"file",className:cx("h-3.5 w-3.5 shrink-0",i?"text-accent":"text-fg-4")}),ki.jsx("span",{className:"truncate font-mono text-[12px]",children:e.name})]},e.name)})}),ki.jsx("div",{className:"my-1 h-px shrink-0 bg-edge-soft"}),ki.jsxs("div",{className:"flex shrink-0 items-center gap-2 px-2 py-0.5 font-mono text-[10px] text-fg-4",children:[ki.jsx("span",{children:"↑↓ navigate"}),ki.jsx("span",{children:"·"}),ki.jsx("span",{children:"↵ add"}),ki.jsx("span",{children:"·"}),ki.jsx("span",{children:"esc done"})]})]})}const bj="Not available in a read-only session",xj="cursor-not-allowed opacity-40",yj=__(function({path:e}){const t=w_(),[i,s]=gi.useState(null),[r,n]=gi.useState(null),[o,a]=gi.useState(null),[l,c]=gi.useState(!1),[h,u]=gi.useState(!1),[d,f]=gi.useState(!1),p=gi.useRef(null),g=gi.useRef([]),v=t.collections.byPath(e),m=gi.useMemo(()=>{if(!v)return[];const e=new Set(v.scenarios);return t.scenarios.items.filter(t=>!e.has(t.name))},[v,t.scenarios.items]);if(gi.useEffect(()=>{if(!r||!v)return;document.body.style.userSelect="none",document.body.style.cursor="grabbing";const i=v.scenarios.slice();a(i);const s=e=>{const t=e.clientY;let i=-1,s=1/0;for(let r=0;r<g.current.length;r++){const e=g.current[r];if(!e)continue;const n=e.getBoundingClientRect(),o=n.top+n.height/2,a=Math.abs(t-o);a<s&&(s=a,i=r)}a(e=>{if(!e)return e;const t=e.indexOf(r.name);if(t<0||i<0||i===t)return e;const s=e.slice();return s.splice(t,1),s.splice(i,0,r.name),s}),n(i=>i?{...i,pointerX:e.clientX,pointerY:t}:null)},o=s=>{n(null),a(r=>(s&&r&&!function(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}(r,i)&&t.collections.reorderScenarios(e,r),null))},l=()=>o(!0),c=()=>o(!1),h=e=>{"Escape"===e.key&&o(!1)};return window.addEventListener("pointermove",s),window.addEventListener("pointerup",l),window.addEventListener("pointercancel",c),window.addEventListener("keydown",h),()=>{document.body.style.userSelect="",document.body.style.cursor="",window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",l),window.removeEventListener("pointercancel",c),window.removeEventListener("keydown",h)}},[null==r?void 0:r.name,v,e,t.collections]),!v)return ki.jsx(ej,{id:e});const _=t.runs.lastRunByRef("collection",v.name),b=(o??v.scenarios).map(e=>{const i=t.scenarios.items.find(t=>t.name===e),s=t.runs.lastRunByRef("scenario",e);return{name:e,found:i,last:s}}),x=(e,t)=>{if(0!==e.button)return;e.preventDefault();const i=e.currentTarget.closest("[data-scenario-row]");if(!i)return;const s=i.getBoundingClientRect();n({name:t,left:s.left,width:s.width,offsetY:e.clientY-s.top,pointerX:e.clientX,pointerY:e.clientY})},y=t.session.capabilities.canRun,w=!y||0===v.scenarios.length;return ki.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[ki.jsxs("header",{className:"flex shrink-0 items-start gap-4 border-b border-edge px-4 py-3",children:[ki.jsxs("div",{className:"min-w-0 flex-1",children:[ki.jsxs("div",{className:"flex items-center gap-2",children:[ki.jsx(ux,{name:"layers",className:"h-4 w-4 text-fg-3"}),l?ki.jsx(Sj,{initial:v.name,duplicateCheck:i=>t.collections.nameTaken(i,e),onCommit:async i=>{const s=await t.collections.rename(e,i);s&&(s.path!==e&&t.tabs.renameCollectionTab(e,s.path),c(!1))},onCancel:()=>c(!1)}):ki.jsxs("button",{type:"button",onClick:()=>c(!0),className:"group flex min-w-0 items-center gap-1.5 truncate font-mono text-[15px] font-medium text-fg",title:"Rename",children:[ki.jsx("span",{className:"truncate",children:v.name}),ki.jsx("span",{className:"text-fg-4 opacity-0 group-hover:opacity-100",children:ki.jsx(ux,{name:"edit",className:"h-3 w-3"})})]}),ki.jsx(ij,{tone:"info",children:"collection"})]}),h?ki.jsx(Cj,{initial:v.description??"",onCommit:i=>{t.collections.setDescription(e,0===i.trim().length?null:i.trim()),u(!1)},onCancel:()=>u(!1)}):ki.jsx("button",{type:"button",onClick:()=>u(!0),className:"mt-1 block max-w-[640px] text-left text-[12.5px] leading-relaxed text-fg-2 hover:text-fg",title:"Edit description",children:v.description??ki.jsx("span",{className:"italic text-fg-4",children:"+ add description"})}),ki.jsxs("div",{className:"mt-1.5 flex items-center gap-3 font-mono text-[11px] text-fg-3",children:[ki.jsxs("span",{children:[v.scenarios.length," scenarios"]}),ki.jsx("span",{children:"·"}),d?ki.jsx(kj,{initial:v.workers??1,onCommit:i=>{t.collections.setWorkers(e,i<=1?null:i),f(!1)},onCancel:()=>f(!1)}):ki.jsxs("button",{type:"button",onClick:()=>f(!0),className:"hover:text-fg",title:"How many scenarios of this collection run concurrently (1 = sequential). Click to edit",children:["workers: ",v.workers??1]}),ki.jsx("span",{children:"·"}),ki.jsx("span",{children:_?`last run ${aj(_.startedAt)}`:"never run"})]})]}),ki.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[ki.jsx("button",{type:"button",onClick:async()=>{const i=`collection:${e}`;await t.collections.delete(e)&&t.tabs.close(i)},className:"grid h-7 w-7 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fail",title:"Delete collection",children:ki.jsx(ux,{name:"trash",className:"h-3.5 w-3.5"})}),ki.jsxs("button",{type:"button",disabled:w,onClick:w?void 0:async()=>{try{const e=await t.activeRuns.startCollection(v.name);t.tabs.open({kind:"collection-run",runId:e.runId})}catch(e){t.collections.setError(e instanceof Error?e.message:String(e))}},title:y?0===v.scenarios.length?"add at least one scenario before running":t.queue.waitingCount>0||t.queue.running.length>0?"the machine is busy — this run joins the queue":(v.workers??1)>1?`Run every scenario in this collection, ${v.workers} in parallel`:"Run every scenario in this collection sequentially":bj,className:cx("flex h-7 items-center gap-1.5 rounded px-2.5 font-mono text-[11.5px] font-medium",w?"cursor-not-allowed bg-raised text-fg-4":"bg-accent text-on-accent hover:bg-accent-hover"),children:[ki.jsx(ux,{name:"play",className:"h-3.5 w-3.5",strokeWidth:2.5})," Run all"]})]})]}),t.collections.error&&ki.jsxs("div",{className:"flex shrink-0 items-start gap-2 border-b border-fail/30 bg-fail/10 px-4 py-2 font-mono text-[11.5px] text-fail",children:[ki.jsx(ux,{name:"alert",className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),ki.jsx("span",{className:"flex-1",children:t.collections.error}),ki.jsx("button",{type:"button",onClick:()=>t.collections.clearError(),title:"Dismiss",className:"grid h-4 w-4 shrink-0 place-items-center rounded hover:bg-fail/20",children:ki.jsx(ux,{name:"x",className:"h-3 w-3",strokeWidth:2.25})})]}),ki.jsxs("div",{className:"min-h-0 flex-1 overflow-auto",children:[ki.jsxs("div",{className:"flex h-7 items-center gap-2 border-b border-edge-soft px-4 font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:[ki.jsx("span",{className:"w-4"}),ki.jsx("span",{className:"w-3"}),ki.jsx("span",{className:"flex-1",children:"scenario"}),ki.jsx("span",{className:"w-24 text-right",children:"last run"}),ki.jsx("span",{className:"w-6"})]}),ki.jsx("div",{className:"relative",children:b.map((i,s)=>{const n=e=>{g.current[s]=e};if((null==r?void 0:r.name)===i.name)return ki.jsx("div",{ref:n,"data-scenario-row":!0,className:"h-9 px-4",children:ki.jsx("div",{className:"h-full rounded border-2 border-dashed border-accent/50 bg-accent/10"})},i.name);if(!i.found)return ki.jsxs("div",{ref:n,"data-scenario-row":!0,className:"group flex h-9 items-center gap-2 px-4 hover:bg-raised/60",children:[ki.jsx(wj,{onPointerDown:e=>x(e,i.name)}),ki.jsx(nj,{status:"never"}),ki.jsx("span",{className:"flex-1 truncate font-mono text-[12.5px] text-fail line-through",title:"file not found",children:i.name}),ki.jsx(ij,{tone:"fail",size:"xs",children:"orphan"}),ki.jsx("button",{type:"button",onClick:()=>{t.collections.removeScenario(e,i.name)},className:"grid h-6 w-6 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fail",title:"Remove from collection",children:ki.jsx(ux,{name:"x",className:"h-3.5 w-3.5",strokeWidth:2.5})})]},i.name);const o=i.found;return ki.jsxs("div",{ref:n,"data-scenario-row":!0,className:"group flex h-9 items-center gap-2 px-4 hover:bg-raised/60",children:[ki.jsx(wj,{onPointerDown:e=>x(e,i.name),hoverGroup:!0}),ki.jsx(nj,{status:cj(i.last)}),ki.jsx("button",{type:"button",onClick:()=>t.tabs.open({kind:"scenario",path:o.path}),className:"flex-1 truncate text-left font-mono text-[12.5px] text-fg hover:text-accent",children:o.name}),ki.jsx("span",{className:"w-24 text-right font-mono text-[11px] text-fg-2",children:i.last?aj(i.last.startedAt):"—"}),ki.jsx("button",{type:"button",onClick:()=>t.collections.removeScenario(e,i.name),className:"grid h-6 w-6 place-items-center rounded text-fg-4 opacity-0 hover:bg-raised hover:text-fail group-hover:opacity-100",title:"Remove",children:ki.jsx(ux,{name:"x",className:"h-3.5 w-3.5",strokeWidth:2.5})})]},i.name)})}),ki.jsx("div",{className:"px-4 py-2",children:ki.jsxs("button",{ref:p,type:"button",onClick:()=>{var e;const t=null==(e=p.current)?void 0:e.getBoundingClientRect();t&&s(t)},disabled:0===m.length,className:cx("flex w-full items-center justify-center gap-1.5 rounded border border-dashed px-2 py-1.5 font-mono text-[11.5px]",0===m.length?"cursor-default border-edge-soft text-fg-4":i?"border-accent bg-accent/10 text-accent":"border-edge-soft text-fg-3 hover:border-accent hover:bg-accent/10 hover:text-accent"),children:[ki.jsx(ux,{name:"plus",className:"h-3.5 w-3.5"}),0===m.length?"all scenarios added":"add scenario"]})})]}),i&&ki.jsx(_j,{anchor:i,candidates:m,onPick:i=>{t.collections.addScenario(e,i)},onClose:()=>s(null)}),r&&(()=>{const e=b.find(e=>e.name===r.name);if(!e)return null;const t=Math.max(4,r.pointerY-r.offsetY);return ki.jsxs("div",{style:{position:"fixed",left:r.left,width:r.width,top:t,zIndex:60,pointerEvents:"none",transform:"scale(1.01)",transformOrigin:"left center"},className:cx("flex h-9 items-center gap-2 rounded-md px-4 font-mono","border border-accent/50 bg-overlay/95 backdrop-blur ring-1 ring-accent/15","shadow-[0_14px_36px_-10px_rgba(15,15,20,0.28),0_4px_10px_-3px_rgba(15,15,20,0.12)]","dark:shadow-[0_14px_36px_-10px_rgba(0,0,0,0.7),0_4px_10px_-3px_rgba(0,0,0,0.5)]"),children:[ki.jsx(ux,{name:"grip",className:"h-3.5 w-3.5 text-accent"}),ki.jsx(nj,{status:e.found?cj(e.last):"never"}),ki.jsx("span",{className:cx("flex-1 truncate text-[12.5px]",e.found?"text-fg":"text-fail line-through"),children:e.name}),!e.found&&ki.jsx(ij,{tone:"fail",size:"xs",children:"orphan"}),e.found&&ki.jsxs(ki.Fragment,{children:[ki.jsx("span",{className:"w-24 text-right text-[11px] text-fg-2",children:e.last?aj(e.last.startedAt):"—"}),ki.jsx("span",{className:"w-6"})]})]})})()]})});function wj({onPointerDown:e,hoverGroup:t=!1}){return ki.jsx("span",{onPointerDown:e,role:"button","aria-label":"Reorder",title:"Drag to reorder",className:cx("grid h-5 w-3.5 shrink-0 cursor-grab touch-none place-items-center text-fg-4 active:cursor-grabbing",t&&"group-hover:text-fg-3"),children:ki.jsx(ux,{name:"grip",className:"h-3.5 w-3.5"})})}function Sj({initial:e,duplicateCheck:t,onCommit:i,onCancel:s}){const[r,n]=gi.useState(e),o=gi.useRef(null);gi.useEffect(()=>{var e,t;null==(e=o.current)||e.focus(),null==(t=o.current)||t.select()},[]);const a=r.trim(),l=a.length>0&&a!==e?Ub(a):null,c=a.length>0&&t(a),h=c||null!==l,u=a.length>0&&!h&&a!==e;return ki.jsx("form",{onSubmit:t=>{t.preventDefault(),u?i(a):a===e&&s()},className:"min-w-0 flex-1",children:ki.jsx("input",{ref:o,value:r,onChange:e=>n(e.target.value),onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),s())},onBlur:()=>{u?i(a):s()},spellCheck:!1,autoComplete:"off",className:cx("w-full min-w-0 rounded border bg-canvas px-1.5 py-0.5 font-mono text-[15px] font-medium text-fg outline-none ring-2",h?"border-fail ring-fail/20":"border-accent ring-accent/20"),title:c?`"${a}" already exists`:l??void 0})})}function kj({initial:e,onCommit:t,onCancel:i}){const[s,r]=gi.useState(String(e)),n=gi.useRef(null);gi.useEffect(()=>{var e,t;null==(e=n.current)||e.focus(),null==(t=n.current)||t.select()},[]);const o=Number(s),a=Number.isInteger(o)&&o>=1,l=()=>{a?t(o):i()};return ki.jsxs("span",{className:"flex items-center gap-1",children:[ki.jsx("span",{children:"workers:"}),ki.jsx("input",{ref:n,value:s,onChange:e=>r(e.target.value),onKeyDown:e=>{"Escape"===e.key?(e.preventDefault(),i()):"Enter"===e.key&&(e.preventDefault(),l())},onBlur:l,inputMode:"numeric",spellCheck:!1,autoComplete:"off",className:cx("w-10 rounded border bg-canvas px-1 py-0 font-mono text-[11px] text-fg outline-none ring-2",a?"border-accent ring-accent/20":"border-fail ring-fail/20"),title:a?void 0:"integer >= 1"})]})}function Cj({initial:e,onCommit:t,onCancel:i}){const[s,r]=gi.useState(e),n=gi.useRef(null);return gi.useEffect(()=>{var e,t;null==(e=n.current)||e.focus(),null==(t=n.current)||t.select()},[]),ki.jsxs("form",{onSubmit:e=>{e.preventDefault(),t(s)},className:"mt-1 max-w-[640px]",children:[ki.jsx("textarea",{ref:n,value:s,onChange:e=>r(e.target.value),onKeyDown:e=>{"Escape"===e.key?(e.preventDefault(),i()):"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),t(s))},onBlur:()=>t(s),rows:2,placeholder:"describe what this collection covers…",className:"w-full resize-none rounded border border-accent bg-canvas px-1.5 py-0.5 text-[12.5px] leading-relaxed text-fg-2 outline-none ring-2 ring-accent/20 placeholder:text-fg-4"}),ki.jsx("div",{className:"mt-1 px-1 font-mono text-[10px] text-fg-4",children:"⌘↵ save · esc cancel"})]})}const jj={},Nj=function(e,t,i){let s=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const e=document.querySelector("meta[property=csp-nonce]"),i=(null==e?void 0:e.nonce)||(null==e?void 0:e.getAttribute("nonce"));s=Promise.allSettled(t.map(e=>{if((e=function(e){return"/"+e}(e))in jj)return;jj[e]=!0;const t=e.endsWith(".css"),s=t?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${e}"]${s}`))return;const r=document.createElement("link");return r.rel=t?"stylesheet":"modulepreload",t||(r.as="script"),r.crossOrigin="",r.href=e,i&&r.setAttribute("nonce",i),document.head.appendChild(r),t?new Promise((t,i)=>{r.addEventListener("load",t),r.addEventListener("error",()=>i(new Error(`Unable to preload CSS for ${e}`)))}):void 0}))}function r(e){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return s.then(t=>{for(const e of t||[])"rejected"===e.status&&r(e.reason);return e().catch(r)})};function Mj({label:e,hint:t,placement:i="bottom"}){return ki.jsxs("span",{role:"tooltip",className:cx("pointer-events-none absolute z-50 hidden items-center gap-1.5 whitespace-nowrap rounded-md border border-edge-soft bg-overlay px-2 py-1 font-mono text-[10.5px] font-normal normal-case tracking-normal text-fg-2 shadow-md group-hover:flex",{right:"left-full top-1/2 ml-2 -translate-y-1/2",bottom:"left-1/2 top-full mt-1.5 -translate-x-1/2","bottom-start":"left-0 top-full mt-1.5","bottom-end":"right-0 top-full mt-1.5"}[i]),children:[e,t&&ki.jsx("span",{className:"font-mono text-[9.5px] text-fg-3",children:t})]})}function Ej({value:e,onChange:t,options:i}){return ki.jsx("div",{className:"inline-flex rounded-md border border-edge-soft bg-raised p-0.5",children:i.map(i=>ki.jsxs("button",{type:"button",onClick:()=>t(i.value),"aria-pressed":e===i.value,className:cx("group relative flex items-center gap-1 rounded px-2.5 py-1 font-mono text-[11px] transition-colors",e===i.value?"bg-canvas text-fg shadow-sm":"text-fg-3 hover:text-fg-2"),children:[i.icon&&ki.jsx(ux,{name:i.icon,className:"h-3.5 w-3.5",strokeWidth:1.75}),ki.jsx("span",{children:i.label}),i.title&&ki.jsx(Mj,{label:i.title})]},i.value))})}function Bj(e){const t=[],i=/('[^']*'|"[^"]*"|`[^`]*`|\/\/[^\n]*|[A-Za-z_][\w$]*|\d+|[(){}[\],:.;]|\s+|[^A-Za-z0-9_'"`(){}\[\],:.;\s]+)/g,s=new Set(["true","false","null","undefined","await","async","const","let","var","return","export","import","from","if","else","function"]);let r;for(;r=i.exec(e);){const n=r[0];if(n.startsWith("//"))t.push({t:n,cls:"text-fg-4 italic"});else if(/^['"`]/.test(n))t.push({t:n,cls:"text-syn-string"});else if(/^\d+$/.test(n))t.push({t:n,cls:"text-syn-number"});else if(s.has(n))t.push({t:n,cls:"text-syn-keyword"});else if(/^[A-Za-z_][\w$]*$/.test(n)){const s=e.slice(i.lastIndex);/^\s*\(/.test(s)?t.push({t:n,cls:"text-accent"}):t.push({t:n,cls:"text-fg"})}else/^[(){}[\],:.;]/.test(n)?t.push({t:n,cls:"text-fg-4"}):t.push({t:n,cls:""})}return ki.jsx(ki.Fragment,{children:t.map((e,t)=>ki.jsx(gi.Fragment,{children:ki.jsx("span",{className:e.cls,children:e.t})},t))})}function Dj({src:e,file:t,focusLine:i,focusSeq:s}){const r=e.split("\n"),n=gi.useRef(null);return gi.useEffect(()=>{var e,t;null!=i&&(null==(t=null==(e=n.current)?void 0:e.scrollIntoView)||t.call(e,{block:"center"}))},[i,s]),ki.jsxs("div",{className:"flex h-full flex-col",children:[ki.jsxs("div",{className:"flex h-8 shrink-0 items-center gap-2 border-b border-edge bg-panel px-3",children:[ki.jsx(ux,{name:"file",className:"h-3.5 w-3.5 text-fg-4"}),ki.jsx("span",{className:"font-mono text-[11.5px] text-fg-3",children:t}),ki.jsx("span",{className:"font-mono text-[10.5px] text-fg-4",children:"· read-only"}),ki.jsx("div",{className:"ml-auto flex items-center gap-1",children:ki.jsx("button",{type:"button",className:"grid h-6 w-6 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fg-2",title:"Copy",onClick:()=>{var t;null==(t=navigator.clipboard)||t.writeText(e)},children:ki.jsx(ux,{name:"copy",className:"h-3.5 w-3.5"})})})]}),ki.jsx("div",{className:"flex-1 overflow-auto bg-canvas",children:ki.jsx("pre",{className:"grid grid-cols-[auto_1fr] font-mono text-[12.5px] leading-[1.55]",children:r.map((e,t)=>{const s=i===t+1;return ki.jsxs(gi.Fragment,{children:[ki.jsx("span",{className:"select-none border-r border-edge-soft px-3 text-right tabular-nums "+(s?"bg-accent/15 text-fg-2":"text-fg-4"),children:t+1}),ki.jsx("span",{ref:s?n:void 0,className:"px-3 "+(s?"bg-accent/10":""),children:e?Bj(e):" "})]},t)})})})]})}const Lj=gi.lazy(()=>Nj(()=>import("./DslEditor-CV43IwH6.js"),__vite__mapDeps([0,1])).then(e=>({default:e.DslEditor}))),Rj=__(function({path:e}){const t=w_(),i=t.helpers.items.find(t=>t.path===e),[s,r]=gi.useState("view");gi.useEffect(()=>{i&&t.source.getOrLoad(i.path)},[t,i]);const n=t.editorBridge.pendingReveal(e),[o,a]=gi.useState(null);if(gi.useEffect(()=>{n&&(a(n),t.editorBridge.consumeReveal(e,n.seq))},[n,t,e]),!i)return ki.jsx(ej,{id:e});const l=t.source.get(i.path),c=l?l.split("\n").length:0;return ki.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[ki.jsxs("header",{className:"flex shrink-0 items-start gap-4 border-b border-edge px-4 py-3",children:[ki.jsxs("div",{className:"min-w-0 flex-1",children:[ki.jsxs("div",{className:"flex items-center gap-2",children:[ki.jsx(ux,{name:"braces",className:"h-4 w-4 text-fg-3"}),ki.jsxs("h1",{className:"truncate font-mono text-[15px] font-medium text-fg",children:[i.name,".js"]}),ki.jsx(ij,{tone:"neutral",children:"helper"})]}),ki.jsxs("div",{className:"mt-1 flex items-center gap-3 font-mono text-[11.5px] text-fg-2",children:[ki.jsx("span",{className:"truncate",children:i.path}),c>0&&ki.jsxs(ki.Fragment,{children:[ki.jsx("span",{className:"text-fg-4",children:"·"}),ki.jsxs("span",{children:[c," lines"]})]})]})]}),ki.jsx(Ej,{value:s,onChange:r,options:[{value:"view",label:"View"},{value:"edit",label:"Edit"}]})]}),ki.jsx("div",{className:"min-h-0 flex-1",children:"edit"===s?ki.jsx(gi.Suspense,{fallback:ki.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading editor…"}),children:ki.jsx(Lj,{path:i.path,fileKind:"helper",highlightLine:null==o?void 0:o.line})}):void 0!==l?ki.jsx(Dj,{src:l,file:i.path,focusLine:null==o?void 0:o.line,focusSeq:null==o?void 0:o.seq}):ki.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading source…"})})]})}),Pj=36e5,Aj=24*Pj,Tj={fresh:46,today:30,week:19,stale:11};function zj(e,t){if(null===e)return"fresh";const i=t-e;return i<Pj?"fresh":i<Aj?"today":i<7*Aj?"week":"stale"}class Oj{constructor(e){this.rest=e,this.records=[],this.editing=null,this.readOnly=!1,this.driftedFromPush=!1,this.loadError=null,Wn(this,{},{autoBind:!0})}async load(){try{this.apply(await this.rest.schedules())}catch(e){hn(()=>{this.loadError=e instanceof Error?e.message:String(e)})}}get(e,t){const i=this.records.find(i=>i.target.kind===e&&i.target.name===t);return i?{cron:i.cron,env:i.env}:null}sourceOf(e,t){const i=this.records.find(i=>i.target.kind===e&&i.target.name===t);return i?i.source:null}get list(){return this.records}openEditor(e){this.editing=e}closeEditor(){this.editing=null}async save(e){if(!this.editing)return null;const t=this.editing,i=this.fileRecords().filter(e=>!Ij(e.target,t)).concat([{target:t,cron:e.cron.trim(),env:e.env,source:"file"}]);return this.replace(i)}async remove(){if(!this.editing)return null;const e=this.editing;return this.replace(this.fileRecords().filter(t=>!Ij(t.target,e)))}fileRecords(){return this.records.filter(e=>"file"===e.source)}async replace(e){try{const t=await this.rest.putSchedules(e.map(Hj));return hn(()=>{this.apply(t),this.editing=null}),null}catch(t){return t instanceof Error?t.message:String(t)}}apply(e){hn(()=>{this.records=e.schedules.map(Fj),this.readOnly=e.readOnly,this.driftedFromPush=e.driftedFromPush,this.loadError=null})}}function Ij(e,t){return e.kind===t.kind&&e.name===t.name}function Fj(e){return{target:vb(e),cron:e.cron,env:e.env??null,source:e.source??"file"}}function Hj(e){const t={cron:e.cron,...null!==e.env?{env:e.env}:{}};return"collection"===e.target.kind?{collection:e.target.name,...t}:{scenario:e.target.name,...t}}function Wj(e){const t=wb(e.cron);return e.env?`${t} · ${e.env}`:t}const Kj=__(function(){const e=w_(),[t,i]=gi.useState("all"),[s,r]=gi.useState("runs"),[n,o]=gi.useState({w:0,h:0}),[a,l]=gi.useState(null),[c,h]=gi.useState(()=>Date.now());gi.useEffect(()=>{const e=setInterval(()=>h(Date.now()),6e4);return()=>clearInterval(e)},[]),gi.useLayoutEffect(()=>{if(!a)return;const e=new ResizeObserver(()=>{o({w:a.clientWidth,h:a.clientHeight})});return e.observe(a),()=>e.disconnect()},[a]);const u=e.overview.counts,d=e.overview.indexReady,f=e.overview.rows,p=function(e,t){const i=new Map;for(const s of e){if("collection"!==s.target.kind)continue;const e=t.find(e=>e.name===s.target.name);for(const t of(null==e?void 0:e.scenarios)??[])i.set(t,{cron:s.cron,env:s.env,via:s.target.name})}for(const s of e)"scenario"===s.target.kind&&i.set(s.target.name,{cron:s.cron,env:s.env,via:null});return i}(e.schedules.list,e.collections.items),g=f.filter(e=>"all"===t||("scheduled"===t?p.has(e.ref):"unscheduled"===t?!p.has(e.ref):e.status===t)),v=function(e,t,i){let s={cols:1,size:0};for(let r=1;r<=e;r++){const n=Math.ceil(e/r),o=Math.min((t-Jj*(r-1))/r,(i-Jj*(n-1))/n);o>s.size&&(s={cols:r,size:o})}return{cols:s.cols,size:Math.min(s.size,eN)}}(f.length,n.w-2*Zj,n.h-2*Zj),m=Math.max(v.size,Qj),_=n.w>0,b=Math.max(1,Math.min(v.cols,g.length)),x=v.cols*m+(v.cols-1)*Jj,y={width:_?Math.max(x,Math.min(tN,n.w)):void 0};if(0===u.all)return ki.jsx(Yj,{});const w=f.filter(e=>p.has(e.ref)).length,S="runs"===s?function(e){const t=[{filter:"all",label:"scenarios",name:"Show all tests",value:e.all,dot:null},{filter:"passed",label:"passed",name:"Show passing tests",value:e.passed,dot:"passed"},{filter:"failed",label:"failed",name:"Show failing tests",value:e.failed,dot:"failed"}];e.expected>0&&t.push({filter:"expected",label:"expected",name:"Show tests that failed on purpose",value:e.expected,dot:"expected"});return t.push({filter:"never",label:"never run",name:"Show tests that never ran",value:e.never,dot:"never"}),t}(u):[{filter:"all",label:"scenarios",name:"Show all tests",value:k=u.all,dot:null},{filter:"scheduled",label:"scheduled",name:"Show tests that run on a schedule",value:C=w,dot:null,icon:"clock"},{filter:"unscheduled",label:"no schedule",name:"Show tests no schedule covers",value:k-C,dot:null}];var k,C;return ki.jsxs("div",{className:"flex h-full flex-col overflow-hidden px-6 py-6",children:[ki.jsxs("div",{className:"mx-auto w-full shrink-0",style:y,children:[ki.jsxs("div",{className:"mb-1.5 flex items-center gap-2",children:[ki.jsx(ux,{name:"activity",className:"h-4 w-4 text-fg-4"}),ki.jsx("span",{className:"font-mono text-[11px] uppercase tracking-wider text-fg-4",children:"overview"}),ki.jsx("div",{className:"ml-auto",children:ki.jsx(Ej,{value:s,onChange:e=>{r(e),i("all")},options:[{value:"runs",label:"last run",icon:"activity"},{value:"schedule",label:"schedule",icon:"clock"}]})})]}),ki.jsx("h1",{className:"mb-5 font-mono text-[18px] font-medium tracking-tight text-fg-2",children:"runs"===s?Vj(u.failed,d):Uj(w,u.all)}),ki.jsx("div",{className:"grid gap-px overflow-hidden rounded border border-edge-soft bg-edge-soft",style:{gridTemplateColumns:`repeat(${S.length}, minmax(0, 1fr))`},children:S.map(e=>ki.jsx(_N,{label:e.label,name:e.name,value:e.value,dot:e.dot,icon:e.icon,active:t===e.filter,onClick:()=>i(e.filter)},e.filter))}),"schedule"===s&&ki.jsxs("div",{className:"mt-2 flex items-center gap-1.5 font-mono text-[10.5px] text-fg-4",children:[ki.jsx(ux,{name:"package",className:"h-3 w-3"}),e.schedules.readOnly?"declared in the repo — this box runs whatever the deployed bundle declares; edit there and push":"declared here — a box runs what you push"]}),"schedule"===s&&e.schedules.driftedFromPush&&ki.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 font-mono text-[10.5px] text-warn",children:[ki.jsx(ux,{name:"alert",className:"h-3 w-3"}),"this set differs from the one recorded at push — the project's config likely computes schedules from this environment"]}),"schedule"===s&&e.schedules.list.length>0&&ki.jsx(Xj,{records:e.schedules.list,collections:e.collections.items,now:c})]}),ki.jsx(rN,{tiles:g,attach:l,field:a,cols:b,size:m,ready:_,now:c,mode:s,schedules:p}),ki.jsx("div",{className:"mx-auto mt-3 flex w-full shrink-0 items-center gap-4 font-mono text-[10.5px] text-fg-4",style:y,children:"runs"===s?ki.jsxs(ki.Fragment,{children:[ki.jsxs("span",{className:"flex items-center gap-1.5",children:[ki.jsx(nj,{status:"passed",pulse:!1})," passed"]}),ki.jsxs("span",{className:"flex items-center gap-1.5",children:[ki.jsx(nj,{status:"failed",pulse:!1})," failed"]}),u.expected>0&&ki.jsxs("span",{className:"flex items-center gap-1.5",children:[ki.jsx(nj,{status:"expected",pulse:!1})," failed on purpose"]}),ki.jsxs("span",{className:"flex items-center gap-1.5",children:[ki.jsx(nj,{status:"never",pulse:!1})," never run"]}),f.some(e=>e.live)&&ki.jsxs("span",{className:"flex items-center gap-1.5",children:[ki.jsx("span",{className:"uno-tile-live h-2 w-2 rounded-[2px] bg-warn/40"}),"running now"]}),ki.jsx(qj,{}),ki.jsx("span",{className:"ml-auto",children:d?"hover for history · click to open the test":"reading run history…"})]}):ki.jsxs(ki.Fragment,{children:[ki.jsx($j,{}),ki.jsx("span",{className:"ml-auto",children:"hover for the schedule · click to open the test"})]})})]})});function Uj(e,t){return 0===e?"Nothing runs on a schedule.":`${e} of ${t} ${1===t?"test runs":"tests run"} on a schedule.`}function qj(){return ki.jsxs("span",{className:"flex items-center gap-1.5","aria-label":"Colour fades as a result ages",children:[ki.jsx("span",{className:"flex items-center gap-[2px]",children:["fresh","today","week","stale"].map(e=>ki.jsx("span",{className:"h-2 w-2 rounded-[1px]",style:{background:`color-mix(in srgb, var(--u-fg-3) ${Tj[e]}%, transparent)`}},e))}),"just ran → older"]})}function $j(){return ki.jsxs(ki.Fragment,{children:[ki.jsxs("span",{className:"flex items-center gap-1.5","aria-label":"Brighter means the test runs more often",children:[ki.jsx("span",{className:"flex items-center gap-[2px]",children:[95,65,38,22].map(e=>ki.jsx("span",{className:"h-2 w-2 rounded-[1px]",style:{background:`color-mix(in srgb, var(--u-accent) ${e}%, transparent)`}},e))}),"often → rare"]}),ki.jsxs("span",{className:"flex items-center gap-1.5",children:[ki.jsx("span",{className:"h-2 w-2 rounded-[1px]",style:{background:`color-mix(in srgb, var(--u-fg-4) ${aN}%, transparent)`}}),"no schedule"]})]})}function Vj(e,t){return t?0===e?"Everything is green.":`${e} ${1===e?"test is":"tests are"} failing.`:"Reading run history…"}function Yj(){return ki.jsx("div",{className:"grid h-full place-items-center px-6 py-10",children:ki.jsxs("div",{className:"w-full max-w-[520px]",children:[ki.jsxs("div",{className:"mb-6 flex items-center gap-2",children:[ki.jsx(ux,{name:"inspect",className:"h-4 w-4 text-fg-4"}),ki.jsx("span",{className:"font-mono text-[11px] uppercase tracking-wider text-fg-4",children:"workspace"})]}),ki.jsx("h1",{className:"font-mono text-[18px] font-medium tracking-tight text-fg-2",children:"No scenarios yet."}),ki.jsx("p",{className:"mt-2 text-[13px] leading-relaxed text-fg-4",children:"Add one under the scenarios tree on the left, or record it from the command line. Every test you add shows up here as a tile."}),ki.jsxs("div",{className:"mt-8 rounded border border-edge-soft bg-raised/50 p-3",children:[ki.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-fg-4",children:[ki.jsx(ux,{name:"terminal",className:"h-3.5 w-3.5"}),ki.jsx("span",{children:"Run from CLI:"})]}),ki.jsxs("pre",{className:"mt-2 overflow-x-auto rounded bg-canvas p-2.5 font-mono text-[12px] text-fg-2",children:[ki.jsx("span",{className:"text-fg-4",children:"$ "}),ki.jsx("span",{className:"text-accent",children:"npx @unotest/web"})," e2e"," ",ki.jsx("span",{className:"text-fg-2",children:"<scenario>"})]})]})]})})}function Gj(e,t){const i=yb(e);return i?jb(kb(i,t),t):"—"}function Xj({records:e,collections:t,now:i}){const s=e.map(e=>{const t=yb(e.cron);return{rec:e,tick:t?kb(t,i):null}}).sort((e,t)=>(e.tick??1/0)-(t.tick??1/0));return ki.jsxs("div",{className:"mt-2 rounded border border-edge-soft bg-raised/40 px-3 py-2",children:[ki.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-wider text-fg-4",children:[ki.jsx(ux,{name:"clock",className:"h-3 w-3"}),"upcoming ",ki.jsx("span",{className:"normal-case tracking-normal",children:"· your clock"})]}),ki.jsx("div",{className:"mt-1.5 flex flex-col gap-1",children:s.map(({rec:e,tick:s})=>{var r;const n="collection"===e.target.kind?(null==(r=t.find(t=>t.name===e.target.name))?void 0:r.scenarios.length)??0:null;return ki.jsxs("div",{className:"flex items-baseline gap-2 font-mono text-[11px]",children:[ki.jsx("span",{className:"shrink-0 tabular-nums text-fg-2",children:null===s?"—":jb(s,i)}),ki.jsx("span",{className:"truncate text-fg-2",children:e.target.name}),ki.jsxs("span",{className:"truncate text-fg-4",children:["collection"===e.target.kind?"collection":"test"," ·"," ",Wj(e),null!==n&&ki.jsxs(ki.Fragment,{children:[" → ",n," tests"]})]})]},`${e.target.kind}:${e.target.name}`)})})]})}const Jj=8,Zj=3,Qj=26,eN=104,tN=560,iN=250,sN=120;function rN({tiles:e,attach:t,field:i,cols:s,size:r,ready:n,now:o,mode:a,schedules:l}){const[c,h]=gi.useState(null),u=w_(),d=(e,t)=>{const s=e.currentTarget;if(!i)return;const r=iN/2,n=s.offsetLeft+s.offsetWidth/2,o=Math.max(r,i.clientWidth-r),a=s.offsetTop+s.offsetHeight,l=i.clientHeight-a<sN;h({row:t,x:Math.min(Math.max(n,r),o),y:l?i.clientHeight-s.offsetTop+Jj:a+Jj,above:l})};return ki.jsxs("div",{ref:t,className:"relative mt-5 min-h-0 flex-1 overflow-y-auto",onMouseLeave:()=>h(null),children:[0===e.length?ki.jsx("div",{className:"grid h-full place-items-center font-mono text-[11.5px] text-fg-4",children:"nothing matches"}):ki.jsx("div",{className:"grid justify-center",style:{gridTemplateColumns:`repeat(${s}, ${r}px)`,gap:Jj,padding:Zj,visibility:n?"visible":"hidden"},children:e.map(e=>{const t=l.get(e.ref)??null;return ki.jsx("button",{type:"button","aria-label":"schedule"===a?`${e.ref} — ${t?Wj(t):"no schedule"}`:e.live?`${e.ref} — ${e.status}, ${"paused"===e.live?"paused":"running now"}`:`${e.ref} — ${e.status}, ${aj(e.lastAt)}`,"data-age":zj(e.lastAt,o),onMouseEnter:t=>d(t,e),onFocus:t=>d(t,e),onClick:()=>u.tabs.openScenario(e.path),style:{height:r,..."schedule"===a?dN(t,(null==c?void 0:c.row.ref)===e.ref):cN(e.status,zj(e.lastAt,o),(null==c?void 0:c.row.ref)===e.ref)},className:cx("rounded-md border transition-colors focus:outline-none","runs"===a&&"running"===e.live&&"uno-tile-live","runs"===a&&"paused"===e.live&&"uno-tile-still",(null==c?void 0:c.row.ref)===e.ref&&"ring-2 ring-accent")},e.ref)})}),c&&ki.jsx(gN,{hover:c,mode:a,now:o,schedule:l.get(c.row.ref)??null})]})}const nN={passed:"--u-pass",failed:"--u-fail",expected:"--u-expected",running:"--u-warn",paused:"--u-warn",aborted:"--u-fg-4",pending:"--u-fg-4",never:"--u-fg-4"},oN=new Set(["never","pending","aborted"]),aN=12,lN=14;function cN(e,t,i){const s=oN.has(e)?aN:Tj[t];return fN(nN[e],s,i)}const hN={m5:95,m15:85,h1:75,h2:65,h4:55,h6:45,h12:38,daily:30,weekly:22},uN=50;function dN(e,t){if(!e)return fN("--u-fg-4",aN,t);const i=yb(e.cron);return fN("--u-accent",i?hN[i.freq]:uN,t)}function fN(e,t,i){const s=Math.min(t+(i?lN:0),100);return{background:`color-mix(in srgb, var(${e}) ${s}%, transparent)`,borderColor:`color-mix(in srgb, var(${e}) ${Math.min(Math.round(1.7*s),75)}%, transparent)`}}function pN({recent:e,expectFail:t}){const i=e=>{const i=V_(e);return i||"passed"===e?i===t?t?"bg-expected":"bg-pass":"bg-fail":"bg-fg-4/30"};return ki.jsx("span",{className:"flex h-3.5 items-end gap-[3px]",children:e.map((e,t)=>ki.jsx("span",{className:cx("h-full w-[5px] shrink-0 rounded-[1px]",i(e))},t))})}function gN({hover:e,mode:t,now:i,schedule:s}){const{row:r}=e,n=r.ref.lastIndexOf("/"),o=-1===n?"":r.ref.slice(0,n+1),a=-1===n?r.ref:r.ref.slice(n+1),l="passed"===r.status&&r.recent.some(V_),c=r.expectFail&&"failed"===r.status;return ki.jsxs("div",{className:"pointer-events-none absolute z-20 -translate-x-1/2 rounded-md border border-edge-soft bg-overlay px-2.5 py-2 shadow-md",style:{left:e.x,width:iN,...e.above?{bottom:e.y}:{top:e.y}},children:[ki.jsxs("div",{className:"flex items-center gap-1.5",children:["schedule"===t?ki.jsx(ux,{name:"clock",className:"h-3 w-3 shrink-0 text-fg-4"}):ki.jsx(nj,{status:r.status,pulse:!1}),ki.jsxs("span",{className:"truncate font-mono text-[11.5px] text-fg",children:[ki.jsx("span",{className:"text-fg-4",children:o}),a]})]}),"schedule"===t?ki.jsx(vN,{schedule:s,now:i}):ki.jsx(mN,{r:r,flaky:l,unexpectedPass:c,schedule:s,now:i})]})}function vN({schedule:e,now:t}){return e?ki.jsxs(ki.Fragment,{children:[ki.jsx("div",{className:"mt-1 font-mono text-[10px] text-fg-2",children:Wj(e)}),ki.jsxs("div",{className:"mt-0.5 font-mono text-[10px] text-fg-4",children:[e.via&&ki.jsxs(ki.Fragment,{children:["via ",e.via," · "]}),"next ",Gj(e.cron,t)," · your clock"]})]}):ki.jsx("div",{className:"mt-1 font-mono text-[10px] text-fg-4",children:"no schedule — right-click the test to add one"})}function mN({r:e,flaky:t,unexpectedPass:i,schedule:s,now:r}){return ki.jsxs(ki.Fragment,{children:[ki.jsxs("div",{className:"mt-1 flex items-center gap-1.5 font-mono text-[10px] text-fg-4",children:[e.live?ki.jsx("span",{className:"text-warn",children:"paused"===e.live?"paused":"running now"}):ki.jsxs(ki.Fragment,{children:[ki.jsx("span",{children:null===e.lastAt?"never run":aj(e.lastAt)}),ki.jsx("span",{children:"·"}),ki.jsx("span",{children:oj(e.durationMs)})]}),e.failStreak>0&&"expected"!==e.status&&ki.jsxs("span",{className:"text-fail",children:["· red ",e.failStreak," ",1===e.failStreak?"run":"runs"]}),t&&ki.jsx("span",{className:"text-warn",children:"· flaky"})]}),s&&ki.jsxs("div",{className:"mt-1 flex items-center gap-1 font-mono text-[10px] text-fg-4",children:[ki.jsx(ux,{name:"clock",className:"h-2.5 w-2.5"}),ki.jsxs("span",{className:"truncate",children:[Wj(s),s.via&&ki.jsxs(ki.Fragment,{children:[" · via ",s.via]}),` · next ${Gj(s.cron,r)}`]})]}),"expected"===e.status&&ki.jsx("div",{className:"mt-1 font-mono text-[10px] text-expected",children:"expected to fail · @expect-fail"}),i&&ki.jsx("div",{className:"mt-1 font-mono text-[10px] text-fail",children:"passed, but it is marked @expect-fail"}),e.recent.length>0&&ki.jsxs("div",{className:"mt-2 border-t border-edge-soft pt-2",children:[ki.jsx(pN,{recent:e.recent,expectFail:e.expectFail}),ki.jsxs("div",{className:"mt-1 font-mono text-[9.5px] text-fg-4",children:["last ",e.recent.length," runs · newest right"]})]})]})}function _N({label:e,name:t,value:i,dot:s,icon:r,active:n,onClick:o}){return ki.jsxs("button",{type:"button",onClick:o,"aria-label":t,"aria-pressed":n,className:cx("px-4 py-3 text-left",n?"bg-selection/40":"bg-canvas hover:bg-raised/50"),children:[ki.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:[s&&ki.jsx(nj,{status:s,pulse:!1}),r&&ki.jsx(ux,{name:r,className:"h-3 w-3"}),ki.jsx("span",{children:e})]}),ki.jsx("div",{className:"mt-1 font-mono text-[22px] font-medium tabular-nums text-fg-2",children:i})]})}function bN(e){const t=[],i=e=>{for(const s of e)"step"===s.kind?t.push(s):"control"===s.kind?(t.push(s),i(s.children),s.elseChildren&&i(s.elseChildren)):i(s.children)};return i(e),t}function xN({status:e}){return"passed"===e?ki.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full bg-pass/10 text-pass",children:ki.jsx(ux,{name:"check",className:"h-3 w-3",strokeWidth:2.5})}):"failed"===e?ki.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full bg-fail/10 text-fail",children:ki.jsx(ux,{name:"x",className:"h-3 w-3",strokeWidth:2.5})}):"running"===e?ki.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full bg-warn/10 text-warn",children:ki.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current uno-pulse"})}):"aborted"===e?ki.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full bg-fg-4/10 text-fg-4",children:ki.jsx(ux,{name:"square",className:"h-3 w-3",strokeWidth:2.5})}):"paused"===e?ki.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full bg-warn/10 text-warn",children:ki.jsx(ux,{name:"pause",className:"h-2.5 w-2.5",strokeWidth:2.5})}):ki.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center text-fg-4",children:ki.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current"})})}const yN=22;function wN(e){return ki.jsxs("div",{className:"min-h-full bg-canvas py-1",children:[ki.jsxs("div",{className:"flex items-center gap-3 py-1.5 pr-4 font-mono text-[10.5px] uppercase tracking-wider text-fg-4",style:{paddingLeft:34},children:[ki.jsx("span",{className:"w-6 text-right",children:"#"}),ki.jsx("span",{className:"w-4"}),ki.jsx("span",{className:"flex-1",children:"step"}),ki.jsx("span",{className:"w-12 text-right",children:"time"})]}),ki.jsx("div",{className:"border-t border-edge-soft",children:e.body.map((t,i)=>ki.jsx(SN,{node:t,depth:0,trace:e.trace,failedIndex:e.failedIndex,pausedIndex:e.pausedIndex,onFailedStepRender:e.onFailedStepRender,bpKeys:e.bpKeys,onToggleBp:e.onToggleBp,screenshots:e.screenshots,onOpenScreenshot:e.onOpenScreenshot,activeScreenshotIndex:e.activeScreenshotIndex},i))})]})}function SN(e){var t,i;if("step"===e.node.kind){const s=e.node,r=null==(t=e.trace)?void 0:t[s.index];return ki.jsxs(ki.Fragment,{children:[ki.jsx(NN,{step:s,depth:e.depth,status:(null==r?void 0:r.status)??(e.trace?"pending":void 0),durationMs:(null==r?void 0:r.durationMs)??null,isFailed:e.failedIndex===s.index,isPaused:e.pausedIndex===s.index,bpKeys:e.bpKeys,onToggleBp:e.onToggleBp,screenshotUrl:null==(i=e.screenshots)?void 0:i.get(s.index),onOpenScreenshot:e.onOpenScreenshot,isScreenshotActive:e.activeScreenshotIndex===s.index}),e.failedIndex===s.index&&e.onFailedStepRender&&e.onFailedStepRender(s)]})}return"control"===e.node.kind?ki.jsx(kN,{...e,node:e.node}):ki.jsx(jN,{block:e.node,depth:e.depth,trace:e.trace,failedIndex:e.failedIndex,pausedIndex:e.pausedIndex,onFailedStepRender:e.onFailedStepRender,bpKeys:e.bpKeys,onToggleBp:e.onToggleBp,screenshots:e.screenshots,onOpenScreenshot:e.onOpenScreenshot,activeScreenshotIndex:e.activeScreenshotIndex})}function kN({node:e,depth:t,trace:i,failedIndex:s,pausedIndex:r,onFailedStepRender:n,bpKeys:o,onToggleBp:a,screenshots:l,onOpenScreenshot:c,activeScreenshotIndex:h}){const u=null==i?void 0:i[e.index],d=e=>e.map((e,u)=>ki.jsx(SN,{node:e,depth:t+1,trace:i,failedIndex:s,pausedIndex:r,onFailedStepRender:n,bpKeys:o,onToggleBp:a,screenshots:l,onOpenScreenshot:c,activeScreenshotIndex:h},u));return ki.jsxs(ki.Fragment,{children:[ki.jsx(NN,{step:e,depth:t,status:(null==u?void 0:u.status)??(i?"pending":void 0),durationMs:(null==u?void 0:u.durationMs)??null,isFailed:s===e.index,isPaused:r===e.index,bpKeys:o,onToggleBp:a,screenshotUrl:null==l?void 0:l.get(e.index),onOpenScreenshot:c,isScreenshotActive:h===e.index}),s===e.index&&n&&n(e),d(e.children),e.elseChildren&&ki.jsxs(ki.Fragment,{children:[ki.jsx(CN,{depth:t}),d(e.elseChildren)]})]})}function CN({depth:e}){return ki.jsx("div",{className:"flex items-center py-1 font-mono text-[11px] italic text-fg-4",style:{paddingLeft:34+14*e},children:"else"})}function jN({block:e,depth:t,trace:i,failedIndex:s,pausedIndex:r,onFailedStepRender:n,bpKeys:o,onToggleBp:a,screenshots:l,onOpenScreenshot:c,activeScreenshotIndex:h}){const u=function(e,t){var i;if(!t)return"never";let s=!1,r=!1,n=!1,o=!1,a=!1;for(const l of bN(e)){const e=(null==(i=t[l.index])?void 0:i.status)??"pending";"failed"===e?s=!0:"running"===e?r=!0:"passed"===e?n=!0:"aborted"===e?a=!0:o=!0}return s?"failed":r?"running":a?"aborted":o&&n?"running":o?"pending":"passed"}(e.children,i),d=function(e,t){var i;if(!t)return null;let s=0,r=!1;for(const n of bN(e)){const e=null==(i=t[n.index])?void 0:i.durationMs;null!=e&&(s+=e,r=!0)}return r?s:null}(e.children,i),f=!!i&&("failed"===u||"running"===u||"paused"===u),[p,g]=gi.useState(f),v=34+14*t;return ki.jsxs(ki.Fragment,{children:[ki.jsxs("button",{type:"button",onClick:()=>g(e=>!e),className:cx("group relative flex w-full items-center gap-3 py-1.5 pr-4 text-left font-mono text-[12.5px] leading-[1.4]","failed"===u&&"bg-fail/5",("running"===u||"paused"===u)&&"bg-warn/5","failed"!==u&&"running"!==u&&"paused"!==u&&"hover:bg-raised/60"),style:{paddingLeft:v},children:[ki.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 left-0 border-r border-edge-soft",style:{width:yN}}),ki.jsx(MN,{depth:t,offset:yN}),ki.jsx(ux,{name:p?"chevronD":"chevronR",className:"h-3.5 w-3.5 shrink-0 text-fg-4",strokeWidth:2}),ki.jsx("span",{className:"w-4 shrink-0",children:i?ki.jsx(xN,{status:u}):ki.jsx("span",{className:"block h-1.5 w-1.5 rounded-full bg-fg-4"})}),ki.jsx("span",{className:"flex-1 truncate text-fg",children:e.title}),ki.jsx("span",{className:"w-12 shrink-0 text-right text-[11px] tabular-nums text-fg-2",children:oj(d)})]}),p&&e.children.map((e,u)=>ki.jsx(SN,{node:e,depth:t+1,trace:i,failedIndex:s,pausedIndex:r,onFailedStepRender:n,bpKeys:o,onToggleBp:a,screenshots:l,onOpenScreenshot:c,activeScreenshotIndex:h},u))]})}function NN({step:e,depth:t,status:i,durationMs:s,isFailed:r,isPaused:n,bpKeys:o,onToggleBp:a,screenshotUrl:l,onOpenScreenshot:c,isScreenshotActive:h}){const u="running"===i,d=34+14*t,f=`${e.line}:${e.col}`,p=!!(null==o?void 0:o.has(f)),g=!!a,v=gi.useRef(null);gi.useEffect(()=>{var e,t;h&&(null==(t=null==(e=v.current)?void 0:e.scrollIntoView)||t.call(e,{block:"nearest"}))},[h]);const m=!!l&&!!c;return ki.jsx(ki.Fragment,{children:ki.jsxs("div",{ref:v,onClick:m?()=>c(e.index):void 0,className:cx("group relative flex items-center gap-3 py-1.5 pr-4 font-mono text-[12.5px] leading-[1.4]",m&&"cursor-pointer",h&&"bg-accent/10",u&&"bg-warn/10",n&&"bg-warn/15",r&&"bg-fail/10",!u&&!r&&!n&&"hover:bg-raised/60"),style:{paddingLeft:d},children:[ki.jsx(MN,{depth:t,offset:yN}),ki.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 left-0 border-r border-edge-soft",style:{width:yN}}),ki.jsxs("button",{type:"button","aria-label":p?"Remove breakpoint":"Add breakpoint",disabled:!g,onClick:t=>{t.stopPropagation(),g&&a(e.line,e.col)},className:"absolute inset-y-0 left-0 grid place-items-center disabled:cursor-default",style:{width:yN},children:[n&&ki.jsx(ux,{name:"arrowR",className:"absolute h-3 w-3 text-warn"}),p?ki.jsx(ux,{name:"bp",className:cx("h-2.5 w-2.5",n?"text-fail/80":"text-fail")}):g&&!n&&ki.jsx("span",{className:"hidden h-2.5 w-2.5 rounded-full ring-1 ring-fg-4 group-hover:block"})]}),ki.jsx("span",{className:cx("absolute inset-y-0 w-[2px]",n||u?"bg-warn":r?"bg-fail":"bg-transparent"),style:{left:yN}}),ki.jsxs("span",{className:"w-6 shrink-0 text-right text-[10.5px] tabular-nums text-fg-4",children:["#",e.index]}),ki.jsx("span",{className:"w-4 shrink-0",children:i?ki.jsx(xN,{status:i}):ki.jsx("span",{className:"block h-1.5 w-1.5 rounded-full bg-fg-4"})}),ki.jsxs("span",{className:"flex min-w-0 flex-1 items-baseline gap-2 overflow-hidden",children:[ki.jsx("span",{className:"truncate",children:Bj(e.source)}),ki.jsxs("span",{className:"hidden shrink-0 text-[10.5px] tabular-nums text-fg-4 md:inline",children:["L",e.line]})]}),l&&ki.jsx(ux,{name:"camera",className:cx("h-3.5 w-3.5 shrink-0",h?"text-accent":"text-fg-4 group-hover:text-fg-2")}),ki.jsx("span",{className:"w-12 shrink-0 text-right text-[11px] tabular-nums text-fg-2",children:oj(s)})]})})}function MN({depth:e,offset:t=0}){return 0===e?null:ki.jsx(ki.Fragment,{children:Array.from({length:e}).map((e,i)=>ki.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 w-px bg-edge-soft",style:{left:t+18+14*i}},i))})}function EN({strip:e,position:t,onNavigate:i,onClose:s}){const r=e[t],n=t>0,o=t<e.length-1;return gi.useEffect(()=>{const e=e=>{if("Escape"===e.key)s();else if("ArrowLeft"===e.key&&n)i(t-1);else{if("ArrowRight"!==e.key||!o)return;i(t+1)}e.preventDefault()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[s,i,t,n,o]),r?ki.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Step screenshot",className:"fixed inset-0 z-50 flex flex-col bg-black/30 backdrop-blur-[3px]",onMouseDown:s,children:[ki.jsxs("div",{className:"flex shrink-0 items-center justify-between px-4 py-3",children:[ki.jsxs("span",{className:"rounded-full bg-black/60 px-2.5 py-1 font-mono text-[11.5px] tabular-nums text-white/80",children:[t+1," / ",e.length]}),ki.jsx("button",{type:"button","aria-label":"Close",onMouseDown:e=>e.stopPropagation(),onClick:s,className:"grid h-8 w-8 place-items-center rounded-full bg-black/60 text-white/80 hover:bg-black/80 hover:text-white",children:ki.jsx(ux,{name:"x",className:"h-4 w-4"})})]}),ki.jsxs("div",{className:"flex min-h-0 flex-1 items-center gap-3 px-3 sm:gap-5 sm:px-5",children:[ki.jsx(BN,{direction:"prev",disabled:!n,onClick:()=>i(t-1)}),ki.jsxs("figure",{className:"flex min-h-0 flex-1 flex-col items-center gap-4",onMouseDown:e=>e.stopPropagation(),children:[ki.jsx("img",{src:r.url,alt:`step #${r.stepIndex} screenshot`,className:"min-h-0 max-w-full flex-1 rounded-lg object-contain shadow-2xl ring-1 ring-white/25"}),ki.jsxs("figcaption",{className:"w-full max-w-3xl shrink-0 rounded-lg bg-black/65 px-4 py-2 text-center",children:[r.blockTitle&&ki.jsx("div",{className:"truncate text-[13px] font-medium text-white",children:r.blockTitle}),ki.jsxs("div",{className:"mt-1 flex items-baseline justify-center gap-2 font-mono text-[12px] text-white/80",children:[ki.jsx("span",{className:"truncate",children:r.source}),ki.jsxs("span",{className:"shrink-0 text-[10.5px] tabular-nums text-white/55",children:["L",r.line]})]})]})]}),ki.jsx(BN,{direction:"next",disabled:!o,onClick:()=>i(t+1)})]}),ki.jsx("div",{className:"shrink-0 pb-4 pt-3 text-center",children:ki.jsx("span",{className:"rounded-full bg-black/60 px-3 py-1 font-mono text-[10.5px] uppercase tracking-wider text-white/70",children:"← → to move · esc to close"})})]}):null}function BN({direction:e,disabled:t,onClick:i}){return ki.jsx("button",{type:"button","aria-label":"prev"===e?"Previous screenshot":"Next screenshot",disabled:t,onMouseDown:e=>e.stopPropagation(),onClick:i,className:cx("grid h-11 w-11 shrink-0 place-items-center rounded-full transition",t?"cursor-default bg-black/25 text-white/30":"bg-black/60 text-white/90 hover:bg-black/85 hover:text-white"),children:ki.jsx(ux,{name:"chevronR",className:cx("h-5 w-5","prev"===e&&"rotate-180"),strokeWidth:2})})}async function DN(e){var t;try{if(null==(t=navigator.clipboard)?void 0:t.writeText)return await navigator.clipboard.writeText(e),!0}catch{}return function(e){const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.opacity="0",document.body.appendChild(t);const i=document.getSelection(),s=i&&i.rangeCount>0?i.getRangeAt(0):null;t.select();let r=!1;try{r=document.execCommand("copy")}catch{r=!1}document.body.removeChild(t),s&&i&&(i.removeAllRanges(),i.addRange(s));return r}(e)}function LN(e){const[t,i]=gi.useState("idle"),s=gi.useRef(void 0);gi.useEffect(()=>()=>clearTimeout(s.current),[]);return ki.jsxs("div",{className:"mx-4 my-2 overflow-hidden rounded border border-fail/30 bg-fail/10",children:[ki.jsxs("div",{className:"border-b border-fail/30 px-3 py-1.5",children:[ki.jsxs("div",{className:"flex items-center gap-2",children:[ki.jsx(ux,{name:"alert",className:"h-3.5 w-3.5 text-fail"}),ki.jsx(ij,{tone:"fail",children:e.errorName.toUpperCase()}),ki.jsxs("span",{className:"ml-auto font-mono text-[10.5px] text-fg-2",children:["step #",e.index]})]}),e.url&&ki.jsxs("button",{type:"button",title:"fail"===t?"Copy failed":"Copy URL",className:"mt-1 flex max-w-full cursor-pointer items-center gap-1.5 truncate font-mono text-[11.5px] font-medium text-fg underline decoration-fail/50 decoration-dotted hover:decoration-fail",onClick:()=>{const t=e.url;t&&DN(t).then(e=>{i(e?"ok":"fail"),clearTimeout(s.current),s.current=setTimeout(()=>i("idle"),1600)})},children:[ki.jsx(ux,{name:"ok"===t?"check":"fail"===t?"alert":"copy",className:"ok"===t?"h-3.5 w-3.5 shrink-0 text-pass":"h-3.5 w-3.5 shrink-0"}),ki.jsx("span",{className:"truncate",children:e.url}),"idle"!==t&&ki.jsx("span",{className:"ok"===t?"shrink-0 text-pass no-underline":"shrink-0 text-fail no-underline",children:"ok"===t?"Copied!":"Copy failed"})]})]}),ki.jsxs("div",{className:"px-3 py-2",children:[ki.jsx("pre",{className:"whitespace-pre-wrap break-words font-mono text-[12px] leading-relaxed text-fg",children:e.message}),ki.jsxs("div",{className:"mt-2 flex items-center gap-2 truncate font-mono text-[11px] text-fg-2",children:[ki.jsx(ux,{name:"file",className:"h-3.5 w-3.5"}),ki.jsxs("span",{children:[e.file,":",e.line]}),ki.jsx("span",{className:"text-fg-4",children:"·"}),ki.jsx("span",{className:"truncate",children:e.source})]})]})]})}function RN(e,t){for(let i=e.length-1;i>=0;i--){const s=e[i];if(s.kind===t)return s}return null}class PN{constructor(e){this.runId=e}url(e){const[t,i]="event"===e.kind?["path",e.path]:["file",e.file];return`/api/runs/${encodeURIComponent(this.runId)}/asset?${t}=${encodeURIComponent(i)}`}resolveUrl(e){return this.url(e)}async loadText(e){return AN(this.url(e))}}async function AN(e){try{const t=await fetch(e);return t.ok?{ok:!0,text:await t.text()}:{ok:!1}}catch{return{ok:!1}}}class TN{constructor(e){this.snapshotId=e}url(e){return`/api/snapshots/${encodeURIComponent(this.snapshotId)}/asset?key=${encodeURIComponent(function(e){const t="event"===e.kind?e.path:e.file;return t.split("/").pop()??t}(e))}`}resolveUrl(e){return this.url(e)}async loadText(e){return AN(this.url(e))}}const zN=gi.createContext(null);function ON(e){const t=gi.useContext(zN);return gi.useMemo(()=>t??new PN(e),[t,e])}function IN({children:e}){return ki.jsx("div",{className:"px-3 py-6 text-center font-mono text-[11.5px] text-fg-4",children:e})}const FN=[{id:"screenshot",label:"Screenshot",icon:"camera"},{id:"dom",label:"Semantic DOM",icon:"tree"}],HN=__(function({runId:e,active:t,events:i,isFailed:s,runFinished:r,varsOverride:n,fill:o=!1}){const a=w_(),l=RN(i,"failure-bundle:written"),c=null!=t&&("paused"===t.status||"running"===t.status||"starting"===t.status);gi.useEffect(()=>{c||n||a.runtimeSnapshots.loadIfNeeded(e)},[a,e,c,n]);const h=a.runtimeSnapshots.get(e),u=n??(c&&t?t.vars:(null==h?void 0:h.vars)??(null==t?void 0:t.vars)??{}),d=Object.keys(u).length>0,f=gi.useMemo(()=>{const e=[];if((null!=t||d)&&e.push({id:"vars",label:"Vars",icon:"variable"}),s?e.push(...FN):(t&&t.callStack.length>0&&e.push({id:"callstack",label:"Call stack",icon:"layers"}),null!=t&&e.push({id:"snapshot",label:"Snapshot",icon:"tree"})),e.push({id:"system",label:"System",icon:"activity"}),e.push({id:"console",label:"Console",icon:"terminal"}),e.push({id:"network",label:"Network",icon:"network"}),e.push({id:"trace",label:"Trace",icon:"code"}),!s&&null!=t){const t=a.breakpoints.all().reduce((e,t)=>e+t.keys.length,0);e.push({id:"breakpoints",label:"Breakpoints",icon:"bp",count:t})}return e},[d,s,t,null==t?void 0:t.callStack,a.breakpoints]),[p,g]=gi.useState(f[0].id);gi.useEffect(()=>{f.some(e=>e.id===p)||g(f[0].id)},[f,p]);const v=a.layout,m=Cx({value:v.inspectorWidth,onChange:v.setInspectorWidth,axis:"x",dir:-1,min:v.inspectorMin,max:()=>Math.round(.6*window.innerWidth)}),_=ki.jsxs(ki.Fragment,{children:[ki.jsx("div",{className:"uno-thin-scroll flex h-9 shrink-0 items-center gap-0.5 overflow-x-auto border-b border-edge px-1",children:f.map(e=>{const t=e.id===p;return ki.jsxs("button",{type:"button",onClick:()=>g(e.id),className:cx("relative flex h-8 shrink-0 items-center gap-1.5 rounded px-2 text-[12px]",t?"text-fg":"text-fg-3 hover:bg-raised/60 hover:text-fg"),children:[ki.jsx(ux,{name:e.icon,className:"h-3.5 w-3.5"}),e.label,null!=e.count&&e.count>0&&ki.jsx("span",{className:"grid h-[15px] min-w-[15px] place-items-center rounded-full bg-raised px-1 font-mono text-[9.5px] text-fg-3",children:e.count}),t&&ki.jsx("span",{className:"absolute inset-x-1.5 bottom-0 h-0.5 rounded-full bg-accent"})]},e.id)})}),ki.jsxs("div",{className:"flex-1 overflow-y-auto bg-canvas",children:["vars"===p&&ki.jsx(WN,{vars:u}),"callstack"===p&&t&&ki.jsx(KN,{frames:t.callStack}),"breakpoints"===p&&ki.jsx(UN,{}),"screenshot"===p&&ki.jsx(YN,{runId:e,bundle:l}),"system"===p&&ki.jsx(QN,{active:t}),"console"===p&&ki.jsx(rM,{runId:e,runFinished:r}),"snapshot"===p&&ki.jsx(aM,{runId:e}),"dom"===p&&ki.jsx(oM,{runId:e,bundle:l}),"network"===p&&ki.jsx(lM,{runId:e,runFinished:r}),"trace"===p&&ki.jsx(pM,{events:i})]})]});return o?ki.jsx("div",{className:"relative flex h-full min-w-0 flex-1 flex-col bg-panel",children:_}):ki.jsxs("aside",{className:"relative flex shrink-0",style:{width:v.inspectorWidth},children:[ki.jsx(Mx,{axis:"x",onPointerDown:m,className:"-left-[6px]"}),ki.jsx("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden rounded-l-lg bg-panel",children:_})]})});function WN({vars:e}){const t=Object.entries(e);return 0===t.length?ki.jsx(IN,{children:"no vars in scope yet"}):ki.jsxs("div",{className:"divide-y divide-edge-soft",children:[ki.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",children:[ki.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"runtime vars"}),ki.jsx("span",{className:"font-mono text-[10.5px] text-fg-4",children:t.length})]}),t.map(([e,t])=>{const i=t.startsWith("<Locator")?"Locator":t.startsWith("{")?"Object":t.startsWith("[")?"Array":t.startsWith('"')?"string":/^-?\d/.test(t)?"number":"value";return ki.jsxs("div",{className:"flex items-baseline gap-2 px-3 py-1.5",children:[ki.jsx("span",{className:"shrink-0 font-mono text-[12.5px] text-fg",children:e}),ki.jsx("span",{className:"min-w-0 flex-1 break-all font-mono text-[12px] text-fg-2",children:t}),ki.jsx("span",{className:"shrink-0 font-mono text-[10.5px] text-fg-4",children:i})]},e)})]})}function KN({frames:e}){return 0===e.length?ki.jsx(IN,{children:"not inside a helper · top-level frame"}):ki.jsxs("div",{className:"divide-y divide-edge-soft",children:[ki.jsxs("div",{className:"flex items-center justify-between border-b border-edge-soft px-3 py-1.5",children:[ki.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"call stack"}),ki.jsx("span",{className:"font-mono text-[10.5px] text-fg-4",children:e.length})]}),e.map((e,t)=>ki.jsxs("div",{className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-raised/60",children:[ki.jsx("span",{className:"grid h-4 w-4 shrink-0 place-items-center font-mono text-[10px] text-fg-4 tabular-nums",children:t}),ki.jsx("span",{className:"flex-1 truncate font-mono text-[12px] text-fg",children:e.fn}),e.file&&ki.jsxs("span",{className:"truncate font-mono text-[10.5px] text-fg-4",children:[e.file,":",e.line]})]},t))]})}const UN=__(function(){const e=w_(),t=e.breakpoints.all().filter(e=>e.keys.length>0);return ki.jsxs("div",{className:"flex h-full flex-col",children:[ki.jsxs("div",{className:"flex items-center justify-between border-b border-edge-soft px-3 py-1.5",children:[ki.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"breakpoints"}),t.length>0&&ki.jsx("button",{type:"button",onClick:()=>e.breakpoints.clear(),className:"font-mono text-[10.5px] text-fg-4 hover:text-fail",title:"Clear all",children:"clear all"})]}),0===t.length?ki.jsx(IN,{children:"no breakpoints set · click the gutter on any step to add one"}):ki.jsx("div",{className:"divide-y divide-edge-soft",children:t.map(t=>ki.jsxs("div",{children:[ki.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",children:[ki.jsx("span",{className:"truncate font-mono text-[11.5px] text-fg",children:t.scenario}),ki.jsx("button",{type:"button",onClick:()=>e.breakpoints.clear(t.scenario),className:"font-mono text-[10px] text-fg-4 hover:text-fail",title:"Clear in this scenario",children:"clear"})]}),t.keys.slice().sort().map(i=>{const[s,r]=i.split(":").map(Number);return ki.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 hover:bg-raised/60",children:[ki.jsx(ux,{name:"bp",className:"h-2.5 w-2.5 shrink-0 text-fail"}),ki.jsx("span",{className:"min-w-0 flex-1 font-mono text-[11.5px] text-fg",children:i}),ki.jsx("button",{type:"button",onClick:()=>e.breakpoints.remove(t.scenario,s,r),className:"grid h-4 w-4 shrink-0 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fail",title:"Remove",children:ki.jsx(ux,{name:"x",className:"h-3 w-3",strokeWidth:2.5})})]},i)})]},t.scenario))})]})});function qN(e){return{kind:"runFile",file:e}}function $N(e){const t=ON(e),i=gi.useMemo(()=>qN("manifest.json"),[]),[s,r]=gi.useState(void 0);return gi.useEffect(()=>{let e=!1;return r(void 0),t.loadText(i).then(t=>{if(!e)if(t.ok)try{const e=JSON.parse(t.text);r(e.capture??null)}catch{r(null)}else r(null)}),()=>{e=!0}},[t,i]),s}function VN(e,t,i){return!1===e?i.disabled:!0===e?t?i.emptyForRun:i.pending:t?i.disabled:`${i.pending} (opt-in via ${i.flag}=1)`}function YN({runId:e,bundle:t}){const i=ON(e),s=(null==t?void 0:t.screenshotPath)?i.resolveUrl({kind:"event",path:t.screenshotPath}):null;return s?ki.jsxs("div",{className:"flex h-full flex-col",children:[ki.jsx(gM,{label:"page snapshot"}),ki.jsx("div",{className:"flex-1 overflow-auto bg-panel p-2",children:ki.jsx("img",{alt:"page snapshot at failure",src:s,className:"max-w-full rounded border border-edge shadow-sm"})})]}):ki.jsxs("div",{className:"flex h-full flex-col",children:[ki.jsx(gM,{label:"page snapshot"}),ki.jsx(IN,{children:"no screenshot captured"})]})}function GN({marker:e,tone:t,trailing:i,onClick:s,children:r}){const n=cx("flex w-full items-start gap-2 px-3 py-1.5 text-left font-mono","error"===t?"bg-fail/10":"warn"===t?"bg-warn/10":"",s&&"hover:bg-raised/60"),o=ki.jsxs(ki.Fragment,{children:[ki.jsx("span",{className:"mt-[3px] flex h-3 w-3 shrink-0 items-center justify-center",children:e}),ki.jsx("span",{className:"min-w-0 flex-1 break-all",children:r}),i&&ki.jsx("span",{className:"flex shrink-0 items-center gap-1.5",children:i})]});return s?ki.jsx("button",{type:"button",onClick:s,className:n,children:o}):ki.jsx("div",{className:n,children:o})}function XN(e){return ki.jsx("span",{className:cx("h-2 w-2 rounded-full","error"===e?"bg-fail":"warn"===e?"bg-warn":"bg-fg-4")})}function JN({level:e,text:t}){return ki.jsx(GN,{marker:XN(e),tone:"error"===e?"error":"warn"===e?"warn":void 0,children:ki.jsx("span",{className:cx("whitespace-pre-wrap","error"===e?"text-fail":"warn"===e?"text-warn":"text-fg"),children:t})})}function ZN({rows:e,empty:t}){return 0===e.length?ki.jsx(IN,{children:t}):ki.jsx("div",{className:"divide-y divide-edge-soft font-mono text-[11.5px]",children:e.map((e,t)=>ki.jsx(JN,{...e},t))})}const QN=__(function({active:e}){const t=w_(),[i,s]=gi.useState(""),[r,n]=gi.useState([]),[o,a]=gi.useState(null),l=function(e){return!!e&&!e.plainRun&&"completed"!==e.status&&"failed"!==e.status&&"aborted"!==e.status}(e),c=[];e&&(e.logs.forEach((e,t)=>{c.push({at:e.at,key:`log-${t}`,node:ki.jsx(JN,{level:e.level,text:e.text})})}),e.consoleEntries.forEach(e=>{c.push({at:e.at,key:`probe-${e.id}`,node:ki.jsx(eM,{entry:e})})}),e.toolCalls.forEach(e=>{c.push({at:e.at,key:`tool-${e.callId}`,node:ki.jsx(tM,{entry:e})})}),c.sort((e,t)=>e.at<t.at?-1:e.at>t.at?1:0));return ki.jsxs("div",{className:"flex h-full flex-col",children:[ki.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:0===c.length?ki.jsx(IN,{children:"no system output"}):ki.jsx("div",{className:"divide-y divide-edge-soft font-mono text-[11.5px]",children:c.map(e=>ki.jsx("div",{children:e.node},e.key))})}),ki.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-t border-edge-soft px-3 py-1.5",children:[ki.jsx(ux,{name:"chevronR",className:"h-3.5 w-3.5 shrink-0 text-accent"}),ki.jsx("input",{type:"text",value:i,onChange:e=>s(e.target.value),onKeyDown:c=>{if("Enter"===c.key)c.preventDefault(),(()=>{const r=i.trim();r&&l&&(t.activeRuns.probe(e.runId,r),n(e=>e[e.length-1]===r?e:[...e,r]),a(null),s(""))})();else if("ArrowUp"===c.key&&r.length>0){c.preventDefault();const e=null===o?r.length-1:Math.max(0,o-1);a(e),s(r[e])}else if("ArrowDown"===c.key&&null!==o){c.preventDefault();const e=o+1;e>=r.length?(a(null),s("")):(a(e),s(r[e]))}},disabled:!l,spellCheck:!1,autoComplete:"off",placeholder:l?"probe a locator — e.g. getByRole('row').first()":"probe needs a live debug session",className:"min-w-0 flex-1 bg-transparent font-mono text-[11.5px] text-fg placeholder:text-fg-4 focus:outline-none disabled:cursor-not-allowed"})]})]})}),eM=__(function({entry:e}){const[t,i]=gi.useState(!1),s=e.result,r=s?1===s.count?"pass":"warn":"neutral";return ki.jsxs("div",{className:"text-[11.5px]",children:[ki.jsx(GN,{marker:ki.jsx(ux,{name:"chevronR",className:"h-3 w-3 text-accent"}),children:ki.jsx("span",{className:"text-fg",children:e.input})}),ki.jsxs("div",{className:"pb-1.5 pl-8 pr-3 font-mono",children:["pending"===e.status&&ki.jsx("span",{className:"text-fg-4",children:"probing…"}),"stale"===e.status&&ki.jsx("span",{className:"text-warn",children:"no reply — page may be navigating, or this run has no debug session"}),"done"===e.status&&s&&ki.jsxs("div",{className:"flex flex-col gap-1",children:[ki.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[ki.jsxs(ij,{tone:r,children:[s.count," match",1===s.count?"":"es"]}),s.pinned&&s.pinned.ofCount>1&&ki.jsxs(ij,{tone:"warn",children:[".",s.pinned.op,"() of ",s.pinned.ofCount]}),s.matches.length>0&&ki.jsxs("button",{type:"button",onClick:()=>i(e=>!e),className:"inline-flex items-center gap-1 text-fg-2 hover:text-fg",children:[ki.jsx(ux,{name:t?"chevronD":"chevronR",className:"h-3 w-3"}),t?"hide":"show"," matches",s.truncated?` (first ${s.matches.length})`:""]})]}),ki.jsx("span",{className:"break-all text-fg-4",children:s.chain}),s.warnings.map((e,t)=>ki.jsxs("span",{className:"text-warn",children:["⚠ ",e]},t)),t&&ki.jsx("div",{className:"mt-0.5 flex flex-col gap-0.5",children:s.matches.map(e=>ki.jsxs("div",{className:"flex items-start gap-2",children:[ki.jsxs("span",{className:"shrink-0 text-fg-4 tabular-nums",children:["#",e.index]}),ki.jsxs("span",{className:"min-w-0 flex-1 break-all text-fg-2",children:[e.role&&ki.jsx("span",{className:"text-fg",children:e.role}),e.name?` "${e.name}"`:e.text?` ${e.text}`:"",e.testId?` [testId=${e.testId}]`:"",!e.visible&&ki.jsx("span",{className:"text-fg-4",children:" · hidden"})]})]},e.index))})]})]})]})}),tM=__(function({entry:e}){var t;const[i,s]=gi.useState(!1),r=e.args.length>0||((null==(t=e.preview)?void 0:t.length)??0)>0;return ki.jsxs("div",{className:"text-[11.5px]",children:[ki.jsx(GN,{marker:ki.jsx(ux,{name:"play",className:"h-3 w-3 text-fg-3"}),onClick:r?()=>s(e=>!e):void 0,trailing:"running"===e.status?ki.jsx("span",{className:"text-fg-4",children:"running…"}):ki.jsxs(ki.Fragment,{children:[null!=e.durationMs&&ki.jsxs("span",{className:"text-fg-4 tabular-nums",children:[e.durationMs,"ms"]}),"error"===e.status?ki.jsx(ij,{tone:"fail",children:"err"}):ki.jsx("span",{className:"text-pass",children:"ok"})]}),children:ki.jsxs("span",{className:"flex min-w-0 items-baseline gap-2",children:[ki.jsx("span",{className:"shrink-0 text-fg",children:e.tool}),ki.jsx("span",{className:"min-w-0 flex-1 truncate text-fg-2",children:e.args})]})}),i&&ki.jsxs("div",{className:"flex flex-col gap-1 pb-1.5 pl-8 pr-3 font-mono",children:[ki.jsxs("div",{className:"text-fg-4",children:[e.at," · ",e.tool,"running"!==e.status&&` · ${e.status}`]}),e.args&&ki.jsx(iM,{text:e.args,tone:"dim"}),e.error?ki.jsxs("div",{className:"whitespace-pre-wrap break-all text-fail",children:[e.error.class,": ",e.error.message]}):e.preview&&ki.jsx(iM,{text:e.preview,tone:"normal"})]})]})});function iM({text:e,tone:t}){let i;try{i=JSON.parse(e)}catch{i=void 0}return null===i||!Array.isArray(i)&&"object"!=typeof i?ki.jsx("div",{className:cx("whitespace-pre-wrap break-all","dim"===t?"text-fg-2":"text-fg"),children:e}):ki.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-all text-[11px] leading-snug",children:ki.jsx(sM,{value:i,indent:0})})}function sM({value:e,indent:t}){const i=" ".repeat(t),s=" ".repeat(t+1);if(null===e)return ki.jsx("span",{className:"text-syn-keyword",children:"null"});if("string"==typeof e)return ki.jsx("span",{className:"text-syn-string",children:JSON.stringify(e)});if("number"==typeof e||"boolean"==typeof e)return ki.jsx("span",{className:"text-syn-number",children:String(e)});if(Array.isArray(e))return 0===e.length?ki.jsx("span",{children:"[]"}):ki.jsxs(ki.Fragment,{children:["[\n",e.map((i,r)=>ki.jsxs("span",{children:[s,ki.jsx(sM,{value:i,indent:t+1}),r<e.length-1?",":"","\n"]},r)),i,"]"]});if("object"==typeof e){const r=Object.entries(e);return 0===r.length?ki.jsx("span",{children:"{}"}):ki.jsxs(ki.Fragment,{children:["{\n",r.map(([e,i],n)=>ki.jsxs("span",{children:[s,ki.jsx("span",{className:"text-syn-key",children:JSON.stringify(e)}),": ",ki.jsx(sM,{value:i,indent:t+1}),n<r.length-1?",":"","\n"]},e)),i,"}"]})}return ki.jsx("span",{children:String(e)})}function rM({runId:e,runFinished:t}){const[i,s]=gi.useState({kind:"loading"}),r=ON(e),n=gi.useMemo(()=>qN("console.json"),[]),o=$N(e);return gi.useEffect(()=>{let e=!1;return s({kind:"loading"}),r.loadText(n).then(t=>{if(!e)if(t.ok)try{const e=JSON.parse(t.text);s({kind:"loaded",rows:e.map(e=>({level:e.level,text:e.text}))})}catch{s({kind:"error",message:"could not parse console.json"})}else s({kind:"missing"})}),()=>{e=!0}},[r,n,t]),"loading"===i.kind?ki.jsx("div",{className:"px-3 py-2 font-mono text-[11.5px] text-fg-4",children:"loading…"}):"error"===i.kind?ki.jsx(IN,{children:i.message}):"missing"===i.kind?ki.jsx(IN,{children:VN(null==o?void 0:o.console,t,nM)}):ki.jsx(ZN,{rows:i.rows,empty:"no console output"})}const nM={flag:"UNOTEST_CONSOLE",disabled:"no console captured — set UNOTEST_CONSOLE=1 to record the browser console",emptyForRun:"no console captured for this run",pending:"browser console appears here when the run finishes"};function oM({runId:e,bundle:t}){return ki.jsxs("div",{children:[ki.jsx(gM,{label:"semantic dom"}),t?ki.jsx(vM,{runId:e,asset:{kind:"event",path:`${t.bundlePath}/outline.txt`}}):ki.jsx(IN,{children:"no failure bundle for this run"})]})}const aM=__(function({runId:e}){const t=w_(),i=gi.useMemo(()=>qN("picker-snapshot.txt"),[]),[s,r]=gi.useState(0),n=gi.useCallback(()=>{t.activeRuns.requestSnapshot(e);const i=setTimeout(()=>r(e=>e+1),600),s=setTimeout(()=>r(e=>e+1),1700);return()=>{clearTimeout(i),clearTimeout(s)}},[t,e]),o=t.activeRuns.byRunId.get(e),a="paused"===(null==o?void 0:o.status)&&o.pausedAt?`${o.pausedAt.file}:${o.pausedAt.line}:${o.pausedAt.col}`:null;return gi.useEffect(()=>{if(null!==a)return n()},[n,a]),ki.jsxs("div",{children:[ki.jsxs("div",{className:"flex items-center justify-between border-b border-edge-soft px-3 py-1.5",children:[ki.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"picker snapshot"}),ki.jsx("button",{type:"button",onClick:n,className:"font-mono text-[10.5px] text-fg-4 hover:text-fg",title:"Recapture the page outline",children:"refresh"})]}),ki.jsx(vM,{runId:e,asset:i,reloadKey:s})]})});function lM({runId:e,runFinished:t}){const[i,s]=gi.useState({kind:"loading"}),r=ON(e),n=gi.useMemo(()=>qN("network.json"),[]),o=$N(e);return gi.useEffect(()=>{let e=!1;return s({kind:"loading"}),r.loadText(n).then(t=>{if(!e)if(t.ok)try{s({kind:"loaded",rows:JSON.parse(t.text)})}catch{s({kind:"error",message:"could not parse network.json"})}else s({kind:"missing"})}),()=>{e=!0}},[r,n,t]),"loading"===i.kind?ki.jsx("div",{className:"px-3 py-2 font-mono text-[11.5px] text-fg-4",children:"loading…"}):"error"===i.kind?ki.jsx(IN,{children:i.message}):"missing"===i.kind?ki.jsx(IN,{children:VN(null==o?void 0:o.network,t,cM)}):0===i.rows.length?ki.jsx(IN,{children:"no requests captured"}):ki.jsx(uM,{rows:i.rows})}const cM={flag:"UNOTEST_NETWORK",disabled:"no network captured — set UNOTEST_NETWORK=1 to capture",emptyForRun:"no network captured for this run",pending:"network requests appear here when the run finishes"},hM="grid-cols-[1fr_52px_84px_72px_60px]";function uM({rows:e}){return ki.jsxs("div",{className:"font-mono text-[11px]",children:[ki.jsxs("div",{className:cx("sticky top-0 grid gap-2 border-b border-edge-soft bg-panel px-3 py-1.5 text-[10px] uppercase tracking-wider text-fg-4",hM),children:[ki.jsx("span",{children:"Name"}),ki.jsx("span",{className:"text-right",children:"Status"}),ki.jsx("span",{children:"Type"}),ki.jsx("span",{className:"text-right",children:"Size"}),ki.jsx("span",{className:"text-right",children:"Time"})]}),e.map((e,t)=>{const i=!!e.failureText||null!=e.status&&e.status>=400;return ki.jsxs("div",{className:cx("grid items-center gap-2 border-b border-edge-soft px-3 py-1",i&&"bg-fail/10",hM),children:[ki.jsxs("span",{className:"truncate",title:e.url,children:[ki.jsxs("span",{className:"text-fg-4",children:[e.method," "]}),dM(e.url)]}),ki.jsx("span",{className:cx("text-right tabular-nums",i?"text-fail":null!=e.status&&e.status>=200&&e.status<300?"text-pass":"text-fg"),children:e.failureText?"fail":e.status??"—"}),ki.jsx("span",{className:"truncate text-fg-2",children:e.resourceType}),ki.jsx("span",{className:"text-right tabular-nums text-fg-2",children:fM(e.sizeBytes)}),ki.jsx("span",{className:"text-right tabular-nums text-fg-2",children:null!=e.durationMs?`${e.durationMs} ms`:"—"})]},t)})]})}function dM(e){try{const t=new URL(e);return t.pathname.split("/").filter(Boolean).pop()||t.host}catch{return e}}function fM(e){return null==e?"—":e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} kB`:`${(e/1048576).toFixed(1)} MB`}function pM({events:e}){return 0===e.length?ki.jsx(IN,{children:"no trace events"}):ki.jsx("div",{className:"divide-y divide-edge-soft font-mono text-[11.5px]",children:e.map((e,t)=>ki.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5",children:[ki.jsx("span",{className:"w-24 shrink-0 truncate text-fg-2",children:e.kind}),ki.jsx("span",{className:"min-w-0 flex-1 truncate text-fg",children:bM(e)})]},t))})}function gM({label:e}){return ki.jsx("div",{className:"flex items-center justify-between border-b border-edge-soft px-3 py-1.5",children:ki.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:e})})}function vM({runId:e,asset:t,reloadKey:i}){return ki.jsx(mM,{runId:e,asset:t,transform:_M,reloadKey:i})}function mM({runId:e,asset:t,transform:i,reloadKey:s=0}){const[r,n]=gi.useState({kind:"loading"});return function(e,t,i,s,r){const n=ON(e);gi.useEffect(()=>{let e=!1;return s({kind:"loading"}),n.loadText(t).then(t=>{e||(t.ok?s({kind:"loaded",text:i(t.text)}):s({kind:"error",message:"not available"}))}),()=>{e=!0}},[n,t,i,s,r])}(e,t,i,n,s),"loading"===r.kind?ki.jsx("div",{className:"px-3 py-2 font-mono text-[11.5px] text-fg-4",children:"loading…"}):"error"===r.kind?ki.jsx(IN,{children:r.message}):ki.jsx("pre",{className:"overflow-auto whitespace-pre-wrap break-all p-3 font-mono text-[11.5px] text-fg",children:r.text})}function _M(e){return e}function bM(e){switch(e.kind){case"step:started":return`${e.file}:${e.line}:${e.col}`;case"step:ok":return`${e.durationMs}ms`;case"step:fail":return e.error;case"screenshot":return e.path;case"failure-bundle:written":return e.bundlePath;case"run:started":return e.scenario;case"run:finished":return e.outcome;default:return""}}const xM={default:"border border-edge-soft bg-canvas text-fg-2 hover:bg-raised",primary:"bg-accent text-on-accent hover:bg-accent-hover",accent:"border border-accent/30 bg-accent/10 text-accent hover:bg-accent/20",danger:"border border-fail/30 bg-fail/10 text-fail hover:bg-fail/20"};function yM({children:e,onClick:t,icon:i,variant:s="default",tooltip:r,tooltipHint:n,tooltipPlacement:o="bottom-start",className:a}){return ki.jsxs("button",{type:"button",onClick:t,className:cx("group relative flex h-6 items-center gap-1 rounded px-2 font-mono text-[11px] font-medium",xM[s],a),children:[i&&ki.jsx(ux,{name:i,className:"h-3 w-3",strokeWidth:2.5}),e,r&&ki.jsx(Mj,{label:r,hint:n,placement:o})]})}function wM(e){return new Map(bN(e).map(e=>[`${e.line}:${e.col}`,e.index]))}function SM(e,t,i){const s=e.get(`${t}:${i}`);if(null!=s)return s;for(const[r,n]of e)if(r.startsWith(`${t}:`))return n;return null}function kM(e,t,i){const s=wM(t),r=[],n=new Map,o=[];for(const a of e)if("step:started"===a.kind){const e=a.file===i?SM(s,a.line,a.col):null;if(o.push({idx:e}),null==e)continue;const t=n.get(e);if(t)t.status="running",t.durationMs=null;else{const t={index:e,line:a.line,col:a.col,status:"running",durationMs:null};n.set(e,t),r.push(t)}}else if("step:ok"===a.kind){const e=o.pop();if(null!=(null==e?void 0:e.idx)){const t=n.get(e.idx);t&&(t.status="passed",t.durationMs=a.durationMs)}}else if("step:fail"===a.kind){const e=o.pop();if(null!=(null==e?void 0:e.idx)){const t=n.get(e.idx);t&&(t.status="failed")}}else if("run:finished"===a.kind)for(const e of r)"running"===e.status&&(e.status="aborted");return function(e){const t={};for(const i of e)t[i.index]={status:i.status,durationMs:i.durationMs};return t}(r)}function CM(e,t,i){const s=wM(t),r=[];for(const n of e)if("step:started"===n.kind){const e=n.file===i?SM(s,n.line,n.col):null;r.push({idx:e})}else if("step:ok"===n.kind)r.pop();else if("step:fail"===n.kind){const e=r.pop();if(null!=(null==e?void 0:e.idx))return e.idx}return null}const jM=IM;!function(){const e=687,t=596,i=311,s=IM,r=DM();for(;;)try{if(566477===parseInt(s(598))/1+-parseInt(s(e))/2+parseInt(s(624))/3*(-parseInt(s(524))/4)+parseInt(s(333))/5*(-parseInt(s(485))/6)+parseInt(s(382))/7*(-parseInt(s(500))/8)+parseInt(s(t))/9*(-parseInt(s(i))/10)+parseInt(s(559))/11)break;r.push(r.shift())}catch(n){r.push(r.shift())}}();var NM=Object[jM(303)],MM=(e,t)=>NM(e,"name",{value:t,configurable:!0});function EM(e){const t=701,i=jM;return'"'+e[i(t)](/\\/g,"\\\\")[i(t)](/"/g,'\\"')+'"'}function BM(e,t){const i=701,s=439,r=jM,n=e.replace(/\\/g,"\\\\")[r(i)](/'/g,"\\'");return void 0!==t?"toLocator([locator('"+n+r(461)+t+r(444):r(s)+n+r(328)}function DM(){const e=["rK9s","y29Z","Bg9JywXLq29TCgfYzq","q29UDgLUDwvtDgf0zw1LBNq","yxjNDw1LBNrZ","BMfTzq","t1bfuKfut1jt","lcbLEhbLy3rLzca","D2HPBgvtDgf0zw1LBNq","zMLSBa","z2v0uMvZDwX0","zNjVBq","sw52ywXPzcb0B2TLBML6zu9WzxjHDg9Yia","yNvPBgrxywL0rM9YsgLKzgvUrhnS","uKjsqunlrvq","u0Xbu0G","kY0QlYGPE31Bxt08pIeMFcW6oY4","zMXHz3m","yxnZzxj0vg9HC3rwAxnPyMXLka","ChjLC3mO","zxHWCMvZC2LVBG","C3rHDgvTzw50CW","D2HPBgu","zNvUy3rPB25HBev4ChjLC3nPB24","rLvoq1rjt04","mJaWndy5nMfTv2jxzW","zMLSBcG","nJe0ntmXy2TqweLs","zNvUy3rPB24","rNvUy3rPB25ezwzPBMvtDgf0zw1LBNq","Dhj1zq","ywrK","BwLU","qxjYyxLwywX1zq","B2jQzwn0rxHWCMvZC2LVBG","vevyva","yxntDhjPBMC","C291CMnL","yNvPBgrgBg93rhnS","vMfYAwfIBgvfEhbYzxnZAw9U","z2v0qxjNC0nVDw50","q2fUBM90ignHC3qGyxjYyxKGDg8GBNvTyMvY","yxnZzxj0uM91DgvjCYG","zNvUy3rPB24G","AxnszwDLEefSBg93zwrbzNrLCG","tuLovvnnsu5vuW","u1rfua","BNvSBa","yxDHAxq","Dg9Rzw5PEMvpCgvYyxrVCG","qNjLywTtDgf0zw1LBNq","BgfIzwW","D2fPDezVCIG","ntiZnZa3svLczhju","vgvTCgXHDguGAw50zxjWB2XHDgLVBIbGjhSUlI59ycbPCYbUB3qGywXSB3DLzcbPBIb1BM90zxn0ierttcbZDhjPBMDZlIbvC2uGCg9ZAxrPB25HBcbHCMDZigLUC3rLywq6igv2ywX1yxrLkcDYzxr1CM4GyxjNlNGNlcb7yxjNoIb2ywX1zx0PlG","ChvZAa","Dg9tDhjPBMC","yNvPBgrxywL0rM9YtMf2AwDHDgLVBKrZBa","yNvPBgrlzxLWCMvZC0rZBa","CMvNzxHdB250zxH0qwXSB3DLza","id0G","yNjLywS","AwyG","BwvZC2fNzq","AxnfEgLZDhm","B3bLBG","reLwsurf","C3rHy2S","zw5K","AgfZ","zM9Yu3rHDgvTzw50","Bg9NAwnHBefUza","Dw5RBM93BIbYzwDLEcbMBgfNicC","vMfYAwfIBguGBMfTzsaN","C2v0ugfNzq","y29TBwvUDhm","ica+ia","C2L6zq","z2v0tMfTzq","q2fUBM90igLUy3jLBwvUDc9KzwnYzw1LBNqGBM9Ulw51BwvYAwmGDMfSDwu","swztDgf0zw1LBNq","qKfs","zwXLBwvUDhm","v2HPBgvtDgf0zw1LBNq","igvSC2uG","yNvPBgrtzwXLy3rdB21IB2jVEfzHBhvLrhnS","cN0kD2HPBguGka","yNvPBgrpCgvUrhnS","vw5KzwzPBMvKvMfSDwu","uMvNrxHWrMXHz0vYCM9Y","t2jQzwn0vMfSDwu","twvTyMvYq2fSBev4ChjLC3nPB24UzxzHBcGPigLZig5VDcbPBxbSzw1LBNrLzcbPBIb0AguGAw4TChjVy2vZCYbPBNrLCNbYzxrLCIdIGjqGDxnLiefZDev4zwn1Dg9YicHZCMmVzhnSl2fZDc1LEgvJDxrVCI50CYKGAw5ZDgvHzc4","tfbbuKvo","AM9PBG","rvHdta","ueXvuW","zxzHBa","tfrf","yxjNtMfTzxm","CgfKu3rHCNq","zM9YBwf0q29KzuzYyw1L","yxnZzxj0qxv0AgvUDgLJyxrLzcG","qxjYyxLby2nLC3nfEhbYzxnZAw9U","zg9xAgLSzvn0yxrLBwvUDa","ufjfrKLyx0Loq1jftuvova","u0vnsunpte9o","y2XVC2veAwfSB2CO","yxnZAwDUBwvUDfn0yxrLBwvUDa","rxHWzwn0zwqGAwrLBNrPzMLLCIbHzNrLCIaNlIC","jYbYzxf1AxjLCYa","zgvIDwDNzxi","DgHPCW","zg8GEWO","C2nYB2XSvg9cB3r0B20O","AwzfBhnL","re9u","odiWmJu4ugzTzu9M","yNvPBgrbC3nLCNrbDxrOzw50AwnHDgvKrhnS","zxHWCJi","zNvUy3rPB25Z","yMXVy2TnzxrHqMXVy2S","igrVzxmGBM90igv4Axn0iq","AxnoDw1Izxi","Bg9VA01HDgnO","B3bLCMf0B3i","it09","y29UDgLUDwu","DMfYia","y2HHCKf0","uLbbuKvo","CMvWBgfJzq","ugfYC2vfCNjVCG","CMvJzwL2zxi","CgvLAW","DgvYBwLUyxrPB24","CMvNzxGGzMXHzYaN","iIWGBgLUztOG","vw50zxjTAw5HDgvKihjLz2v4igXPDgvYywWGkg1PC3nPBMCGy2XVC2LUzYaVks4","rvmYmdiYigHHC0LUzgLJzxm","y2fZzq","yNvPBgrbC3nLCNrjBNb1DfzHBhvLrhnS","C2vSzwn0q29TyM9IB3HwywX1zsG","DMfYAwfIBgu","DhLWzq","lcaIiZy2y2nJyYiPoW","Bgv0","AgLNAgXPz2H0qMXVy2S","Dg9Rzw5PEMvdB21Tzw50","DMfYAwfIBgvoyw1L","zgvMyxvSDa","Aw5PDgLHBgL6yxrPB24","zgvMAw5LuhjVCgvYDhK","C2XPy2u","uKvuvvjo","DMfYu3rHDgvTzw50","tuvuqv9cte9dsW","Bwv0yujSB2nR","zNvUy3rPB25fEhbYzxnZAw9U","Dg9Rzw5PEMu","ntb5BMHgzxm","rNvUy3rPB25HBev4ChjLC3nPB24","Aw5KzxHLCW","yxnZzxj0sw5WDxrwywX1zsG","vMfYu3rHDgvTzw50","Dg9Rzw5PEMvnzxrHv29Yza","ChjPBNqG","Aw5JCMvTzw50","vw5RBM93BIbMDw5JDgLVBJOG","vu5eruzjtKve","yNvPBgrty3jVBgXuB1rVCerZBa","BMv3","C2nYB2XSvg9uB3aO","ChjPBNq","sw5JCMvTzw50rxHWCMvZC2LVBG","icaGia","yNvPBgrbC3nLCNrmAxn0tM90rw1WDhLeC2W","jYLDkq","rvm2ihn0AwnREq","yNvPBgrxywL0rM9YrhnS","B3bLBLrHyIG","DxjSqxnZzxj0kcjdt05uquLouYiSia","mJvTvMDPDui","zwXLBwvUDenVDw50qxnZzxj0kcjfuvvbtciSia","q09mt04","tejsqunf","qu1q","sw52ywXPzcb0B2TLBML6zu9WzxjHDg9YoIb1BMv4CgvJDgvKigvUzcbVzIbPBNb1Da","zMLSBezVCM0OiG","Dg9Rzw5PEMvxB3jK","yNvPBgrbC3nLCNrtzwn0Aw9UvgL0BgveC2W","D2HPBguGka","y29UzgL0Aw9U","C2nYB2XSsw50B1zPzxCO","z2v0vgv4Da","z2v0t3bLCMf0B3joyw1L","sw5KzxGGywnJzxnZig9UigeGBwvTyMvYigv4ChjLC3nPB24GkguUzY4Gyhn0yxrLlM1HDgnOzxnBmf1GksbPCYbUB3qGC3vWCg9YDgvKiokaLcbPBMrLEgLUzYb3B3jRCYbVBIbHigjHCMuGDMfYAwfIBguGB25SEs4GqxnZAwDUihrOzsbTzw1IzxiGDg8Gysb2yxjPywjSzsbMAxjZDdOGyg0GpsbZDgf0zs5TyxrJAgvZoYbSyxn0id0GBvTTlMXLBMD0AcaTidfDo2a","y29UC3vTzvDVCMq","ue9tvezjwf9jtKnsru1ftLq","zxf1ywXPDhK","BxvSDgLWBgLJyxrL","C3rHCNrZv2L0Aa","yxnoDw1Izxi","t25LigfYz3vTzw50igv4CgvJDgvK","y2XPy2SO","zwXLBwvUDfzPC2LIAwXPDhLbC3nLCNqOiLzju0LcteuIlca","zxH0zw5KCW","zwXLBwvUDefZC2vYDcGIq09ovefjtLmIlca","Bwf0y2G","vw5LEhbLy3rLzca","u3rYAw5NvMfSDwu","C3rLCfn0yxrLBwvUDa","y29UC3vTzq","DgvZDa","rvffuuvr","yNvPBgrdBg9ZzurPywXVz0rZBa","zM9YrwfJAa","AxnbCNjHEq","y2XHC3m","Cg9Z","D2fPDezVCK5HDMLNyxrPB24O","C3rHDgvTzw50t3jcBg9JAW","lcbJB2X1Bw46ia","CMvZDwX0","Aw5KzxHfEhbYzxnZAw9UCW","yNvPBgrtyxzLrM9YBurZBa","y2XVBMu","ufjfrKLyx0rfq1jftuvova","y2XPCgjVyxjKugfZDguO","Dw5KzwzPBMvK","vMfYAwfIBgvZ","ntm2odC2ou1Xq29pAG","C2v0","yNvPBgrbC3nLCNroB3rwAxnPyMXLrhnS","Dhj5","j3zHCICGAw4GzM9YlwXVB3aGAw5PDgLHBgL6yxrPB24GAxmGBM90ihn1ChbVCNrLzcbIEsb0AguGqMXVy2TSEsbJB252zxj0zxiUifvZzsbWBgfPBIbHC3nPz25Tzw50oIaNzM9YicHRid0GmtSGAYa8psbooYbRid0GAYaRidePjY4","rNvUy3rPB25Z","yNvPBgrbC3nLCNreAwfSB2DpCgvUrhnS","Bg9NAw5bCYG","zwXLBwvUDev4ChjLC3nPB24","BgvUz3rO","rvmYmdi0ihvUAwnVzgvtzxrZ","lcbJB2X1Bw4G","ufjjtLq","tuLovvm","v09sra","zxHLy3v0zq","zMfSC2u","sw52ywXPzcbMBg9HDcbUDw1Izxi","BMv4Da","r1rf","C3DPDgnO","twLZC2LUzYbJBg9ZzsbXDw90zsbPBIbZDhjPBMCGBgL0zxjHBa","rvHdtevr","ChjVCgvYDgLLCW","tNvTyMvYvMfSDwu","ugfYC2vY","C3vWzxi","B3bLCMf0Aw9U","Dg9Rzw5PEMvszwDLEa","Aw5WDxq","yxnZzxj0u2vJDgLVBLrPDgXLka","B3bLBK1LBNvjDgvTka","uhjVCgvYDhLby2nLC3nfEhbYzxnZAw9UlMv2ywWOksbPCYbUB3qGAw1WBgvTzw50zwqGAw4GDgHLigLUlxbYB2nLC3mGAw50zxjWCMv0zxiG4OcuihvZzsbbC3rfEgvJDxrVCIaOC3jJl2rZBc9HC3qTzxHLy3v0B3iUDhmPigLUC3rLywqU","Dg9Rzw5Z","EwLLBgq","y29UC3vTzufYCMf5","ywz0zxjcBg9JAW","yNvPBgreCMfNqw5KrhjVCerZBa","qxjYyxLbC3nPz25Tzw50u3rHDgvTzw50","zwXZzq","y29UC3q","z2v0qxjNC05HBwu","yNvPBgrbC3nLCNruywjSzu5VDevTChr5rhnS","qvjst1C","ru9g","BwfW","qxjYyxKGzxHWzwn0zwq","yNvPBgrtD2L0y2HuB0zYyw1LrhnS","rxHWzwn0zwqGChjVCgvYDhKGA2v5icH3B3jKig9Yihn0CMLUzYK","qMLUyxj5rxHWCMvZC2LVBG","yNvPBgrbC3nLCNruzxH0q29UDgfPBNneC2W","yxjYyxK","yxnZzxj0tM9wAxnPyMXLrxjYB3iO","yMXVy2S","Aw5ZDgfUy2vVzG","sw5JCMvTzw50u3rHDgvTzw50","yxjYyxLfEhbYzxnZAw9U","Dg9mB2nHDg9YkfTSB2nHDg9YkcC","D2fPDezVCLrLEhqO","v0Hjteu","zM9Yy2vdBgLJAYG","tLvnqKvs","kv0P","C3DPDgnOvg9nywLUrNjHBwuO","ueXvu1bmvvm","oIbLEhbLy3rLzca","yNvPBgrdBgLWyM9HCMrqyxn0zurZBa","sw52ywXPzcb0B2TLBJOGDw5LEhbLy3rLzca","zxnJyxbLrhnSu3rYAw5N","rvHdtevrrve","Cg9W","DhLWzw9M","D2fPDezVCLvstcG","DgHYB3C","z2v0","BgLUzq","CMv0DxjU","zxHWCJe","ywrKvg9Rzw4","jYKSig50AcG","ihWG","kqP7cG","q29UzgL0Aw9UywXfEhbYzxnZAw9U","Bwf4","zw50CMLLCW","z2v0qxjYyxK","zNvUy3rPB25ezwzPBMu","Bg9N","Aw5KzxHpzG","t1bfuKfut1jFq0HbuLm","yM9VBgvHBG","vKfs","tKvr","wKvstW","y2fSBfDPDgHqB3n0zML4","y2f0y2G","icHSAw5Lia","z2v0tgLUzq","Bg9NAwnHBe9Y","q0Xpu0vFtuvuqv9cte9dsW","uhjVCgvYDhLby2nLC3nfEhbYzxnZAw9U","Dg9Rzw5PEMvsyxDuzxH0","BNvTyMvY","odu1mJu4u3Pvy1jc","qxjYyxLfEhbYzxnZAw9U","twLZC2LUzYbJBg9ZzsbIywnRDgLJAYbPBIbYyxCGC3rYAw5NigXPDgvYywW","yNvPBgrdBgLJA0rZBa","B3bLCMfUza","yM9KEq","twv0yujSB2nRu3rHDgvTzw50","u05fuq","vg9Rzw4ODhLWztOG","zxHWB3j0","yNvPBgrmB2DPBKfZrhnS","lcb0zxH0oIaI","z2v0uhjVCgvYDgLLCW","C2f2zuzVCM0O","y29UzgL0Aw9UywW","oePgwvDZAa","yNvPBgrbC3nLCNrvCMXfCxvHBhneC2W","lY9a","Dgv4Da","qLjfquS","sw52ywXPzcbHCMD1BwvUDcbJB3vUDcbMB3iGzNvUy3rPB24G","qu1qqu1q","z2v0vhLWzq","DhjPBq","uKvtrvjwrurFv09srfm","q09ntue","ue9tvezjwf9erunsru1ftLq","u1rbuG","z2v0q29SDw1U","zwXZzvn0yxrLBwvUDa","rg9xAgLSzvn0yxrLBwvUDa","qKfsqKfs","r1rfuq","ChjPBwfYEq","vw50zxjTAw5HDgvKihjLz2v4igXPDgvYywWGkgXPBMuGyNjLywSGAw5ZAwrLigjVzhKPlG","yxnZzxj0rgLHBg9Nt3bLBIG","CgvLA0DYB3vW","Dg9Rzw5PEMvuzxH0","BgfZDeLUzgv4","mJrit3vJENe","yNvPBgrpCgvUvgfIrhnS","vw5LEhbLy3rLzcbUB24TyNjLywTPBMCGC3bHy2uGkfuRmdbbmcKG4OcuihjLCgXHy2uGAxqGD2L0AcbHihjLz3vSyxiGC3bHy2u","yNvPBgrbC3nLCNrsB3v0zuLZrhnS","C3rLCcG","dqOa","Dg9Rzw4","Aw5KzxG","yNvPBgrty3jVBgXjBNrVvMLLD0rZBa","DMfSDwu","C3bSAxq","DMfYAwfIBgvZ","Bg9JyxrVCG","Dw5HCNK","ywrKqxjNDw1LBNq","u3rLCfn0yxrLBwvUDa","rvm2ihvUAwnVzgu","vMfSDwvfEhbYzxnZAw9U","y29SDw1U","Axnmzxr0zxjjBLDVCMq","yNvPBgrgB3jJzunSAwnRrhnS","uKjsqunf","q09oveLovuu","zgvJBgfYyxrVCNm","cN0P","pt09","uMv0DxjUu3rHDgvTzw50","C3rYAw5NAwz5","AwztDgf0zw1LBNq","qxnZAwDUBwvUDfn0yxrLBwvUDa","zM9Y","zhjHz0fUzerYB3aO","zhvWBgLJyxrLihjLz2v4igzSywCGjW","Aw5PDa","rNvUy3rPB25tDgf0zw1LBNq","ndqWmZe4mdfUrxDqDey","C3rHDgvTzw50","rvffuq","uKvhrvG","zM9YBwf0ugfYC2vfCNjVCG","DxjSqxnZzxj0kcjjuYiSia","ywrKAxrPDMu","tgv4zxi","vw50zxjTAw5HDgvKihjLz2v4igXPDgvYywWGkgrHBMDSAw5NigjHy2TZBgfZAcKU","Dg9Rzw5PEMvoDw1Izxi","AxnxB3jKu3rHCNq","tejsqunlrvq"];return(DM=function(){return e})()}MM(EM,jM(450)),MM(BM,jM(536)),MM(function(e,t,i=""){return jM(355)+BM(e,t)+", "+EM(i)+");"},jM(488)),MM(function(e,t,i,s=""){return jM(597)+BM(e,i)+", "+EM(t)+", "+EM(s)+");"},"buildFillDsl"),MM(function(e,t,i=""){return"typeText("+BM(e)+", "+EM(t)+", "+EM(i)+");"},"buildTypeTextDsl"),MM(function(e,t="0",i=""){return"open("+EM(e)+", "+EM(t)+", "+EM(i)+");"},jM(658)),MM(function(e,t=""){return jM(356)+BM(e)+", "+EM(t)+");"},"buildAssertVisibleDsl"),MM(function(e,t=""){return jM(332)+EM(e)+", "+EM(t)+");"},"buildAssertUrlContainsDsl"),MM(function(e=""){return"assertPageReady("+EM(e)+");"},"buildAssertPageReadyDsl"),MM(function(e=""){return jM(672)+EM(e)+");"},jM(688)),MM(function(e,t=""){return"assertTableNotEmpty("+BM(e)+", "+EM(t)+");"},jM(424)),MM(function(e,t=""){return"assertListNotEmpty("+BM(e)+", "+EM(t)+");"},jM(327)),MM(function(e=""){return jM(434)+EM(e)+");"},"buildAssertNoVisibleErrorDsl"),MM(function(e,t=""){return jM(412)+EM(e)+", "+EM(t)+");"},jM(341)),MM(function(e,t=""){return jM(589)+EM(e)+", "+EM(t)+");"},"buildAssertToastVisibleDsl"),MM(function(e,t=""){return jM(520)+EM(e)+", "+EM(t)+");"},jM(388)),MM(function(e,t=""){return jM(613)+EM(e)+", "+EM(t)+");"},jM(527)),MM(function(e,t,i=""){return jM(712)+BM(e)+", "+EM(t)+", "+EM(i)+");"},jM(656)),MM(function(e,t,i=""){return jM(389)+EM(e)+", "+EM(t)+", "+EM(i)+");"},jM(495)),MM(function(e,t=""){return jM(413)+EM(e)+", "+EM(t)+");"},"buildOpenMenuItemDsl"),MM(function(e,t=""){return jM(331)+EM(e)+", "+EM(t)+");"},jM(525)),MM(function(e,t=""){return jM(677)+EM(e)+", "+EM(t)+");"},jM(366)),MM(function(e,t=""){const i=701,s=701,r=jM,n=JSON[r(551)](e)[r(i)](/\\/g,"\\\\")[r(s)](/"/g,'\\"');return r(339)+n+'", '+EM(t)+");"},"buildFillFormDsl"),MM(function(e,t=""){return jM(498)+EM(e)+", "+EM(t)+");"},jM(376)),MM(function(e,t="",i){const s=i?", "+i:"";return jM(623)+BM(e)+", "+EM(t)+s+");"},jM(330)),MM(function(e,t,i="",s){const r=s?", "+s:"";return jM(440)+BM(e)+", "+EM(t)+", "+EM(i)+r+");"},"buildWaitForTextDsl"),MM(function(e,t="",i){const s=i?", "+i:"";return"waitForHidden("+BM(e)+", "+EM(t)+s+");"},jM(584)),MM(function(e,t="",i){const s=i?", "+i:"";return jM(454)+EM(e)+", "+EM(t)+s+");"},"buildWaitForURLDsl"),MM(function(e="",t){const i=t?", "+t:"";return jM(371)+EM(e)+i+");"},jM(628)),MM(function(e,t,i="",s){const r=jM,n=s&&"IS"!==s?", "+EM(s):"";return r(314)+BM(e)+", "+EM(t)+", "+EM(i)+n+");"},jM(711)),MM(function(e,t=""){return jM(344)+BM(e)+", "+EM(t)+");"},jM(532)),MM(function(e,t=""){return jM(684)+BM(e)+", "+EM(t)+");"},"buildScrollToBottomDsl"),MM(function(e,t=""){return jM(323)+BM(e)+", "+EM(t)+");"},jM(321)),MM(function(e,t=""){return jM(442)+BM(e)+", "+EM(t)+");"},jM(544)),MM(function(e,t,i=""){return jM(555)+BM(e)+", "+BM(t)+", "+EM(i)+");"},jM(419)),MM(function(e,t,i=""){return jM(379)+BM(e)+", "+EM(t)+", "+EM(i)+");"},jM(448)),MM(function(e,t=jM(490),i=""){return jM(590)+BM(t)+", "+EM(e)+", "+EM(i)+");"},jM(629)),MM(function(e,t=""){return"switchToFrame("+BM(e)+", "+EM(t)+");"},jM(429)),MM(function(e=""){return jM(445)+EM(e)+");"},"buildSwitchToMainFrameDsl"),MM(function(e,t=""){return'elementVisibilityAssert("NOT_VISIBLE", '+BM(e)+", "+EM(t)+");"},jM(384)),MM(function(e,t,i=""){return jM(358)+BM(e)+", "+EM(t)+", "+EM(i)+");"},jM(432)),MM(function(e,t,i=""){return'elementAssert("IS", '+BM(e)+", "+EM(t)+", "+EM(i)+");"},"buildAssertTextEqualsDsl"),MM(function(e,t=""){return jM(564)+EM(e)+", "+EM(t)+");"},jM(501)),MM(function(e,t,i=""){return jM(334)+BM(e)+", "+t+", "+EM(i)+");"},"buildAssertCountEqualsDsl"),MM(function(e,t){const i=jM;return"flow_"+e.replace(/-/g,"_")+"("+EM(e)+", "+EM(t)+i(296)},jM(609));var LM=(MM(s=class{constructor(e){Et(this,i);const t=580,s=653,r=jM;typeof e===r(484)?this[r(653)]=new Array(e)[r(t)](void 0):Array[r(368)](e)?this.elements=[...e]:this[r(s)]=[...e[r(s)]]}[(i=jM(653),jM(456))](e){return this[jM(653)][e]}[jM(383)](e,t){this[jM(653)][e]=t}[jM(353)](){throw new Error(jM(612))}[jM(377)](){const e=427,t=jM;return new s(this[t(653)][t(e)](e=>e[t(377)]()))}[jM(607)](){const e=jM;return"["+this[e(653)].map(t=>t[e(607)]())[e(664)](", ")+"]"}[jM(627)](){return this[jM(607)]()}},jM(604)),s),RM=(MM(n=class{constructor(e){Et(this,r);const t=533,i=jM;typeof e===i(472)?this.value=e?1:0:this[i(t)]=e}[(r=jM(533),jM(377))](){return new n(this[jM(533)])}[jM(353)](){return this[jM(533)]}[jM(607)](){const e=jM;return this[e(533)][e(627)]()}[jM(627)](){return this.asString()}},jM(406)),Et(n,"ZERO",new n(0)),n),PM=(MM(o=class{static[jM(635)](e){return this[jM(690)].has(e)}static[jM(456)](e){const t=jM,i=this.functions.get(e);if(!i)throw new TypeError(t(319)+e);return i}static[jM(383)](e,t){this[jM(690)].set(e,t)}},jM(387)),Et(o,"functions",new Map([[jM(572),{execute(...e){const t=jM;if(1!==e[t(391)])throw new Error(t(354));return new RM(Math[t(572)](e[0].asNumber()))}}],["echo",{execute(...e){const t=jM;for(const i of e)console.log(i.asString());return RM[t(475)]}}],[jM(298),{execute:(...e)=>RM[jM(475)]}],[jM(645),{execute:(...e)=>RM.ZERO}],[jM(418),{execute:(...e)=>RM.ZERO}],[jM(636),{execute:(...e)=>RM[jM(475)]}],["String",{execute:(...e)=>RM.ZERO}]])),o),AM=(MM(l=class{constructor(e=new Map){Et(this,a);this[jM(405)]=e}get(e){return this.properties.get(e)}[(a=jM(405),jM(383))](e,t){this.properties.set(e,t)}[jM(353)](){const e=jM;return this[e(405)][e(648)]}[jM(607)](){const e=405,t=664,i=jM;return"{"+Array[i(582)](this[i(e)][i(466)]())[i(427)](([e,t])=>e+": "+t[i(607)]())[i(t)](", ")+"}"}[jM(377)](){const e=377,t=jM,i=new Map;return this[t(405)].forEach((s,r)=>{const n=t;i.set(r,s[n(e)]())}),new l(i)}[jM(497)](){return this[jM(405)]}},jM(661)),l),TM=(MM(h=class{constructor(e,t){Et(this,"source"),Et(this,c);const i=jM;FM(t),this[i(608)]=e,this.flags=t}[(c=jM(588),jM(377))](){return new h(this[jM(608)],this.flags)}[jM(353)](){return NaN}[jM(607)](){const e=jM;return"/"+this.source+"/"+this[e(588)]}[jM(627)](){return this[jM(607)]()}},"RegExpValue"),h),zM=new Set(["g","i","m"]),OM={s:"ES2018 dotAll",u:jM(540),y:jM(329),d:jM(709),v:jM(392)};function IM(e,t){e-=296;const i=DM();let s=i[e];if(void 0===IM.vlSrjQ){IM.JfeDyn=function(e){let t="",i="";for(let s,r,n=0,o=0;r=e.charAt(o++);~r&&(s=n%4?64*s+r:r,n++%4)?t+=String.fromCharCode(255&s>>(-2*n&6)):0)r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=".indexOf(r);for(let s=0,r=t.length;s<r;s++)i+="%"+("00"+t.charCodeAt(s).toString(16)).slice(-2);return decodeURIComponent(i)},IM.lopxJn={},IM.vlSrjQ=!0}const r=e+i[0],n=IM.lopxJn[r];return n?s=n:(s=IM.JfeDyn(s),IM.lopxJn[r]=s),s}function FM(e){const t=640,i=640,s=jM,r=new Set;for(const n of e){if(OM[n])throw new HM(s(706)+n+s(680)+OM[n]+"; not in ES5 subset. See docs/dsl/regex-literal-es5.md for the supported flag set.");if(!zM[s(t)](n))throw new HM(s(643)+n+"'. ES5 allows g, i, m.");if(r[s(i)](n))throw new HM(s(556)+n+"'.");r[s(602)](n)}}MM(FM,"validateEs5Flags");var HM=(MM(u=class extends Error{constructor(e){const t=jM;super(e),this.name=t(660)}},jM(660)),u),WM=(MM(f=class{constructor(e){Et(this,d);this[jM(533)]=e}[(d=jM(533),jM(377))](){return new f(this[jM(533)])}[jM(353)](){const e=533,t=jM;try{return parseFloat(this[t(e)])}catch(i){return 0}}[jM(607)](){return this[jM(533)]}[jM(627)](){return this[jM(607)]()}},jM(361)),f),KM=(MM(g=class{constructor(e,t){Et(this,"argNames"),Et(this,p);const i=490,s=jM;this[s(669)]=e,this[s(i)]=t}[(p=jM(490),jM(611))](){const e=jM;return this.argNames[e(391)]}[jM(423)](e){const t=jM;return e<0||e>=this[t(669)][t(391)]?"":this[t(669)][e]}[jM(397)](...e){const t=397,i=475,s=jM;try{return this.body[s(t)](),RM[s(i)]}catch(r){if(r instanceof vE)return r[s(581)]();throw r}}},"UserDefineFunction"),g),UM=(MM(v=class{static push(){const e=466,t=jM,i=new Map([]);for(const[s,r]of this[t(535)][t(e)]())i[t(383)](s,r);this[t(638)][t(626)](i)}static pop(){const e=jM,t=this[e(638)][e(452)]();if(!t)throw new Error("Variables stack undefined");this.variables=t}static[jM(635)](e){const t=jM;return this[t(535)][t(640)](e)}static[jM(456)](e){const t=475,i=jM;return this[i(535)][i(456)](e)||RM[i(t)]}static[jM(383)](e,t){const i=jM;this[i(535)][i(383)](e,t)}},jM(381)),Et(v,"stack",[]),Et(v,"variables",new Map([["PI",new RM(Math.PI)],["E",new RM(Math.E)]])),v),qM=(MM(x=class{constructor(e,t,i){Et(this,b),Et(this,_),Et(this,m);const s=313,r=jM;this[r(713)]=e,this[r(s)]=t,this.token=i}get[(b=jM(713),_=jM(313),m=jM(530),jM(300))](){return this[jM(713)]}get[jM(375)](){return this[jM(313)]}[jM(667)](){const e=456,t=jM,i=this[t(523)]();return this[t(467)]()[t(e)](i)}[jM(523)](){const e=391,t=jM;return this[t(531)](this[t(313)][t(e)]-1)}[jM(531)](e){const t=jM;return this[t(313)][e][t(667)]()[t(353)]()}[jM(467)](){const e=456,t=313,i=531,s=jM;let r=this[s(417)](UM[s(e)](this.variable));const n=this[s(t)].length-1;for(let o=0;o<n;o++)r=this[s(417)](r[s(e)](this[s(i)](o)));return r}consumeArray(e){if(e instanceof LM)return e;throw new Error(jM(428))}[jM(627)](){const e=jM;return""+(this[e(713)]+this[e(313)])}},jM(673)),x),$M=(MM(k=class{constructor(e,t,i){Et(this,S),Et(this,w),Et(this,y);const s=591,r=jM;this[r(433)]=e,this[r(s)]=t,this[r(530)]=i}[(S=jM(433),w=jM(591),y=jM(530),jM(397))](){const e=433,t=523,i=591,s=jM;this[s(433)][s(467)]().set(this[s(e)][s(t)](),this[s(i)][s(667)]())}toString(){const e=jM;return this[e(433)]+e(631)+this[e(591)]}},jM(420)),k),VM=(MM(N=class{constructor(e,t){Et(this,j),Et(this,C);this[jM(653)]=e,this.token=t}[(j=jM(653),C=jM(530),jM(667))](){const e=jM,t=this[e(653)].map(t=>t[e(667)]());return new LM(t)}[jM(627)](){return""+this[jM(653)].toString()}},jM(486)),N),YM=(MM(E=class{constructor(e,t,i){Et(this,M),Et(this,"expression"),Et(this,"token");const s=591,r=530,n=jM;this[n(713)]=e,this[n(s)]=t,this[n(r)]=i}[(M=jM(713),jM(397))](){const e=jM,t=this[e(591)].eval();UM[e(383)](this[e(713)],t)}toString(){const e=jM;return this[e(713)]+e(631)+this.expression}},jM(553)),E),GM=(MM(L=class{constructor(e,t,i,s){Et(this,D),Et(this,B),Et(this,"expr2"),Et(this,"token");this[jM(409)]=e,this.expr1=t,this.expr2=i,this.token=s}[(D=jM(409),B=jM(459),jM(667))](){const e=667,t=689,i=607,s=409,r=667,n=353,o=jM,a=this[o(459)][o(e)]();if(a instanceof WM||a instanceof LM){const r=a.asString(),n=this[o(t)][o(e)]()[o(i)]();if("+"===this[o(s)])return new WM(r+n);throw new Error("Unrecognized operator for string value")}const l=this[o(459)][o(r)]()[o(n)](),c=this[o(t)].eval().asNumber();switch(this.operation){case"-":return new RM(l-c);case"+":return new RM(l+c);case"/":return new RM(l/c);default:return new RM(l*c)}}[jM(627)](){const e=jM;return this.expr1+" "+this[e(409)]+" "+this[e(689)]}},jM(431)),L),XM=(MM(P=class{constructor(e){Et(this,"statements",[]),Et(this,R);this[jM(530)]=e}[(R=jM(530),jM(602))](e){this.statements.push(e)}[jM(397)](){const e=jM;for(const t of this[e(592)])t.execute()}toString(){const e=664,t=jM;return""+this[t(592)][t(e)]("\n")}},"BlockStatement"),P),JM=(MM(T=class extends Error{constructor(e){super(jM(621)),Et(this,A),this.token=e}[(A=jM(530),jM(397))](){throw this}[jM(627)](){return jM(632)}},jM(621)),T),ZM=(e=>{const t=696,i=jM;return e[i(666)]="+",e[i(395)]="-",e.MULTIPLY="*",e[i(637)]="/",e.EQ="==",e[i(474)]="!=",e.SEQ=i(549),e[i(492)]=i(t),e.LT="<",e[i(668)]="<=",e.GT=">",e[i(401)]=">=",e.AND="&&",e.OR="||",e})(ZM||{});MM(function(e){const t=466,i=jM;for(const[s,r]of Object[i(t)](ZM))if(r===e)return s;return"EQ"},jM(346));var QM=(MM(F=class{constructor(e,t,i,s){Et(this,I),Et(this,O),Et(this,z),Et(this,"token");const r=jM;this.operation=e,this[r(459)]=t,this[r(689)]=i,this.token=s}[(I=jM(409),O=jM(459),z=jM(689),jM(667))](){const e=689,t=667,i=409,s=696,r=607,n=667,o=353,a=jM,l=this.expr1.eval(),c=this[a(e)][a(t)]();if(this[a(i)]===a(549)||this.operation===a(s)){let e;return e=l instanceof WM&&c instanceof WM?l.asString()===c[a(r)]():l instanceof RM&&c instanceof RM&&l.asNumber()===c[a(353)](),new RM("==="===this.operation?e:!e)}let h,u,d;switch(l instanceof WM?(h=h=l[a(r)]()[a(573)](c[a(607)]()),u=0):(h=this[a(459)][a(n)]().asNumber(),u=this.expr2[a(667)]()[a(o)]()),this.operation){case"<":d=h<u;break;case"<=":d=h<=u;break;case">":d=h>u;break;case">=":d=h>=u;break;case"!=":d=h!=u;break;case"&&":d=0!=h&&0!=u;break;case"||":d=0!=h||0!=u;break;default:d=h===u}return new RM(d)}[jM(627)](){const e=jM;return this.expr1+" "+this.operation+" "+this[e(689)]}},jM(464)),F),eE=(MM(W=class extends Error{constructor(e){const t=jM;super(t(574)),Et(this,H),this[t(530)]=e}[(H=jM(530),jM(397))](){throw this}[jM(627)](){return jM(697)}},jM(574)),W),tE=(MM($=class{constructor(e,t,i){Et(this,q),Et(this,U),Et(this,K);const s=530,r=jM;this[r(343)]=e,this[r(560)]=t,this[r(s)]=i}[(q=jM(343),U=jM(560),K=jM(530),jM(397))](){const e=397,t=343,i=667,s=353,r=jM;do{try{this[r(560)][r(e)]()}catch(n){if(n instanceof JM)break;if(!(n instanceof eE))throw n}}while(0!=this[r(t)][r(i)]()[r(s)]())}[jM(627)](){const e=jM;return e(683)+this.statement+e(657)+this.condition+")\n"}},jM(515)),$),iE=(MM(Z=class{constructor(e,t,i,s,r){Et(this,J),Et(this,X),Et(this,G),Et(this,Y),Et(this,V);const n=318,o=jM;this[o(302)]=e,this.termination=t,this[o(n)]=i,this.block=s,this[o(530)]=r}[(J=jM(302),X=jM(705),G=jM(318),Y=jM(435),V=jM(530),jM(397))](){const e=705,t=318,i=jM;for(this[i(302)].execute();0!=this[i(e)][i(667)]()[i(353)]();this[i(t)][i(397)]())try{this[i(435)].execute()}catch(s){if(s instanceof JM)break;if(!(s instanceof eE))throw s}}toString(){const e=jM;return"for ("+this.initialization+"; "+this[e(705)]+"; "+this[e(318)]+e(463)+this[e(435)]+"\n}"}},"ForStatement"),Z),sE=(MM(se=class{constructor(e,t,i,s){Et(this,ie),Et(this,te),Et(this,ee),Et(this,Q);const r=jM;this.name=e,this[r(669)]=t,this.body=i,this.token=s}execute(){PM[jM(383)](this.name,new KM(this.argNames,this.body))}[(ie=jM(576),te=jM(669),ee=jM(490),Q=jM(530),jM(627))](){const e=427,t=664,i=614,s=jM,r=this[s(669)][s(e)](e=>e[s(627)]())[s(t)](", ");return s(i)+this.name+"("+r+")"}},jM(600)),se),rE=(MM(ne=class{constructor(e,t){Et(this,"functionalExpression"),Et(this,re);this[jM(594)]=e,this.token=t}[(re=jM(530),jM(397))](){this[jM(594)].eval()}[jM(627)](){const e=jM;return""+this[e(594)][e(627)]()}},jM(558)),ne),nE=(MM(ce=class{constructor(e,t,i){Et(this,le),Et(this,ae),Et(this,oe);const s=jM;this[s(576)]=e,this[s(575)]=t,this.token=i}addArgument(e){const t=jM;return this[t(575)][t(626)](e)}eval(){const e=576,t=391,i=447,s=383,r=423,n=397,o=jM,a=this[o(575)][o(427)](e=>e[o(667)]()),l=a[o(391)],c=PM[o(456)](this[o(e)]);if(c instanceof KM){const e=c;if(a[o(t)]!==e[o(611)]())throw new Error(o(505)+this[o(576)]+o(i)+l);UM[o(626)]();for(let t=0;t<l;t++)UM[o(s)](e[o(r)](t),a[t]);const h=e[o(n)](...a);return UM[o(452)](),h}return c[o(397)](...a)}[(le=jM(576),ae=jM(575),oe=jM(530),jM(627))](){const e=427,t=664,i=jM,s=this[i(575)][i(e)](e=>e.toString())[i(t)](", ");return this.name+"("+s+")"}},jM(312)),ce),oE=(MM(pe=class{constructor(e,t,i,s){Et(this,fe),Et(this,de),Et(this,ue),Et(this,he);const r=jM;this.expression=e,this[r(552)]=t,this[r(514)]=i,this.token=s}execute(){const e=514,t=jM;0!=this[t(591)].eval().asNumber()?this.ifStatement[t(397)]():null!=this[t(e)]&&this[t(e)].execute()}[(fe=jM(591),de=jM(552),ue=jM(514),he=jM(530),jM(627))](){const e=552,t=655,i=627,s=jM;let r=s(633)+this[s(591)]+" "+this[s(e)];return null!=this[s(514)]&&(r+=s(t)+this.elseStatement),r[s(i)]()}},jM(651)),pe),aE=(e=>{const t=378,i=511,s=jM;return e[e[s(675)]=0]=s(675),e[e[s(t)]=1]="PREFIX_DECREMENT",e[e.POSTFIX_INCREMENT=2]=s(349),e[e[s(i)]=3]=s(511),e})(aE||{}),lE=(me=jM(713),ve=jM(714),ge=jM(530),MM(_e=class{constructor(e,t,i){Et(this,me),Et(this,ve),Et(this,ge),this.variable=e,this.type=t,this.token=i}eval(){const e=jM,t=this.variable[e(649)](),i=UM[e(456)](t);if(!(i instanceof RM))throw new Error(e(650));const s=i[e(353)]();let r;switch(this.type){case 0:return r=s+1,UM[e(383)](t,new RM(r)),new RM(r);case 1:return r=s-1,UM.set(t,new RM(r)),new RM(r);case 2:return UM.set(t,new RM(s+1)),new RM(s);case 3:return UM[e(383)](t,new RM(s-1)),new RM(s)}}},jM(325)),_e),cE=(MM(xe=class{constructor(e,t){Et(this,be),Et(this,"token");const i=jM;this[i(591)]=e,this[i(530)]=t}[(be=jM(591),jM(397))](){const e=667,t=jM;this[t(591)][t(e)]()}},jM(437)),xe),hE=(MM(ke=class{constructor(e,t,i,s){Et(this,Se),Et(this,we),Et(this,"arguments"),Et(this,ye);const r=576,n=575,o=jM;this[o(703)]=e,this[o(r)]=t,this[o(n)]=i,this[o(530)]=s}eval(){throw new Error(jM(662))}[(Se=jM(703),we=jM(576),ye=jM(530),jM(627))](){const e=427,t=576,i=jM,s=this[i(575)][i(e)](e=>e[i(627)]())[i(664)](", ");return this.receiver.toString()+"."+this[i(t)]+"("+s+")"}},"MemberCallExpression"),ke),uE=(MM(Me=class{constructor(e,t,i,s){Et(this,Ne),Et(this,"argNames"),Et(this,je),Et(this,Ce);const r=jM;this[r(576)]=e,this[r(669)]=t,this[r(490)]=i,this[r(530)]=s}[(Ne=jM(576),je=jM(490),Ce=jM(530),jM(397))](){}[jM(627)](){const e=427,t=576,i=jM,s=this[i(669)][i(e)](e=>e[i(627)]()).join(", ");return"//@"+this[i(t)]+"("+s+")\n"+this[i(490)]+"\n//@end-"+this[i(576)]}},jM(491)),Me),dE=(MM(Be=class{constructor(e=new Map,t){Et(this,Ee),Et(this,"token");const i=jM;this[i(405)]=e,this[i(530)]=t}[(Ee=jM(405),jM(667))](){const e=667,t=jM,i=new Map;return this[t(405)][t(367)]((s,r)=>{const n=t;i[n(383)](r,s[n(e)]())}),new AM(i)}[jM(627)](){const e=405,t=466,i=jM;return"{"+Array[i(582)](this[i(e)][i(t)]())[i(427)](([e,t])=>e+": "+t[i(627)]())[i(664)](", ")+"}"}},"ObjectExpression"),Be),fE=(MM(Le=class{constructor(e,t){Et(this,"expression"),Et(this,De);const i=jM;this.expression=e,this[i(530)]=t}[(De=jM(530),jM(397))](){const e=jM,t=this[e(591)][e(667)]()[e(607)]();console[e(469)](""+t)}[jM(627)](){const e=591,t=jM;return t(317)+this[t(e)]}},"PrintStatement"),Le),pE=(MM(Ae=class{constructor(e,t,i){Et(this,Pe),Et(this,"name"),Et(this,Re);const s=576,r=jM;this[r(703)]=e,this[r(s)]=t,this.token=i}[(Pe=jM(703),Re=jM(530),jM(667))](){throw new Error(jM(414))}toString(){const e=jM;return this[e(703)].toString()+"."+this[e(576)]}},jM(482)),Ae),gE=(MM(Fe=class{constructor(e,t,i){Et(this,Ie),Et(this,Oe),Et(this,ze),Et(this,Te);const s=jM;this[s(530)]=i,this.source=e,this[s(588)]=t,this.value=new TM(e,t)}[(Ie=jM(530),Oe=jM(608),ze=jM(588),Te=jM(533),jM(667))](){return this[jM(533)]}[jM(627)](){const e=607,t=jM;return this[t(533)][t(e)]()}},"RegExpExpression"),Fe),vE=(MM(Ke=class extends(We=Error,He=jM(530),We){constructor(e,t){const i=591,s=530,r=jM;super(r(574)),Et(this,"expression"),Et(this,"result"),Et(this,He),this[r(i)]=e,this[r(s)]=t}getResult(){const e=jM;if(!this[e(374)])throw new Error("Not execute ReturnStatement");return this[e(374)]}execute(){const e=667,t=jM;throw this[t(374)]=this[t(591)][t(e)](),this}toString(){return jM(458)}},jM(550)),Ke),mE=(e=>{const t=396,i=562,s=441,r=504,n=504,o=546,a=305,l=617,c=666,h=446,u=395,d=616,f=616,p=512,g=561,v=365,m=451,_=652,b=506,x=506,y=663,w=336,S=545,k=570,C=585,j=510,N=510,M=335,E=676,B=425,D=307,L=481,R=jM;return e[e[R(443)]=0]=R(443),e[e[R(t)]=1]=R(t),e[e.TEXT=2]=R(606),e[e.REGEX=3]=R(i),e[e.VAR=4]=R(473),e[e[R(394)]=5]="PRINT",e[e.IF=6]="IF",e[e.ELSE=7]="ELSE",e[e.WHILE=8]=R(s),e[e[R(571)]=9]=R(571),e[e.DO=10]="DO",e[e[R(r)]=11]=R(n),e[e[R(o)]=12]="CONTINUE",e[e[R(595)]=13]="FUNCTION",e[e.RETURN=14]=R(a),e[e[R(l)]=15]=R(l),e[e[R(c)]=16]=R(666),e[e[R(446)]=17]=R(h),e[e[R(u)]=18]=R(395),e[e[R(d)]=19]=R(f),e[e[R(p)]=20]=R(512),e[e[R(586)]=21]=R(586),e[e.EQ=22]="EQ",e[e[R(561)]=23]=R(g),e[e[R(v)]=24]="EQEQEQ",e[e[R(665)]=25]=R(665),e[e[R(404)]=26]=R(404),e[e.EXCLEQEQ=27]=R(m),e[e.LT=28]="LT",e[e.LTEQ=29]="LTEQ",e[e.GT=30]="GT",e[e[R(517)]=31]=R(517),e[e.BAR=32]=R(_),e[e.BARBAR=33]=R(516),e[e[R(337)]=34]="AMP",e[e[R(b)]=35]=R(x),e[e[R(y)]=36]="LPAREN",e[e[R(700)]=37]=R(700),e[e[R(w)]=38]=R(336),e[e.RBRACE=39]=R(S),e[e[R(570)]=40]=R(k),e[e[R(C)]=41]=R(585),e[e[R(j)]=42]=R(N),e[e.COLON=43]=R(M),e[e[R(E)]=44]="SEMICOLON",e[e[R(686)]=45]=R(686),e[e.ARROW=46]=R(B),e[e[R(307)]=47]=R(D),e[e[R(481)]=48]=R(L),e[e[R(426)]=49]=R(426),e})(mE||{}),_E=(MM($e=class{constructor(e,t){Et(this,qe),Et(this,Ue);const i=533,s=jM;if(this[s(530)]=t,0!==t[s(507)]()){if(2!==t[s(507)]())throw new Error("Unrecognized value. "+t);this[s(i)]=new WM(e)}else this.value=new RM(parseFloat(e))}[(qe=jM(533),Ue=jM(530),jM(667))](){return this[jM(533)]}[jM(627)](){const e=jM;return""+this[e(533)][e(607)]()}},jM(541)),$e),bE=(MM(Ge=class{constructor(e,t,i){Et(this,Ye),Et(this,Ve),Et(this,"token");const s=jM;this.label=e,this[s(490)]=t,this.token=i}[(Ye=jM(622),Ve=jM(490),jM(397))](){}labelText(){const e=jM;return this[e(622)]instanceof _E?this[e(622)][e(533)][e(607)]():""}[jM(627)](){const e=622,t=jM;return t(528)+this[t(e)]+", () => {\n"+this[t(490)]+t(548)}},jM(539)),Ge),xE=(MM(Qe=class{constructor(e,t,i){Et(this,Ze),Et(this,Je),Et(this,Xe);const s=jM;this[s(695)]=e,this[s(489)]=t,this.token=i}[(Ze=jM(489),Je=jM(695),Xe=jM(530),jM(667))](){const e=489,t=667,i=jM;return"-"===this[i(695)]?new RM(-this[i(e)][i(t)]()[i(353)]()):new RM(this.operand[i(667)]().asNumber())}[jM(627)](){const e=jM;return""+this[e(695)]+this[e(489)]}},"UnaryExpression"),Qe),yE=(MM(et=class{[jM(377)](){return et[jM(320)]}[jM(353)](){return NaN}[jM(607)](){return jM(380)}[jM(627)](){return this[jM(607)]()}},jM(659)),Et(et,"UNDEFINED",new et),et),wE=(MM(it=class{constructor(e,t){Et(this,tt),Et(this,"token");const i=jM;this[i(547)]=e,this[i(530)]=t}[(tt=jM(547),jM(397))](){const e=557,t=383,i=383,s=jM;for(const r of this.declarators)if(r[s(e)]){const i=r[s(e)].eval();UM[s(t)](r[s(576)],i)}else UM[s(i)](r[s(576)],yE[s(320)])}[jM(627)](){const e=jM,t=this.declarators[e(427)](t=>t[e(557)]?t[e(576)]+e(631)+t[e(557)]:t[e(576)])[e(664)](", ");return e(698)+t}},jM(315)),it),SE=(MM(rt=class{constructor(e,t){Et(this,st),Et(this,"token");this[jM(576)]=e,this.token=t}[(st=jM(576),jM(667))](){const e=576,t=692,i=jM;if(!UM[i(635)](this[i(576)]))throw new Error("Constant "+this[i(e)]+i(t));return UM[i(456)](this[i(576)])}getName(){return this.name}[jM(627)](){return""+this[jM(576)]}},jM(610)),rt),kE=(MM(at=class{constructor(e,t,i){Et(this,"condition"),Et(this,ot),Et(this,nt);this[jM(343)]=e,this.statement=t,this.token=i}[(ot=jM(560),nt=jM(530),jM(397))](){const e=343,t=jM;for(;0!=this[t(e)].eval()[t(353)]();)try{this[t(560)][t(397)]()}catch(i){if(i instanceof JM)break;if(!(i instanceof eE))throw i}}toString(){const e=jM;return e(342)+this.condition+e(463)+this.statement+"\n}"}},jM(654)),at),CE=(MM(ht=class extends(ct=Error,lt=jM(457),ct){constructor(e,t,i){const s=jM;super(e),Et(this,lt),Et(this,"column"),this[s(576)]=s(702),this[s(457)]=t,this[s(542)]=i}static at(e,t){const i=513,s=jM;return new ht(t,e[s(479)](),e[s(i)]())}},"ParseError"),ht),jE=(MM(pt=class{constructor(e,t,i,s){Et(this,"text"),Et(this,ft),Et(this,dt),Et(this,ut);const r=jM;this.type=e,this.text=t,this.column=i,this[r(457)]=s}[(ft=jM(714),dt=jM(542),ut=jM(457),jM(345))](){return this[jM(503)]}[jM(507)](){return this[jM(714)]}[jM(479)](){return this[jM(457)]}[jM(513)](){return this[jM(542)]}toString(){const e=496,t=503,i=457,s=542,r=jM;return r(493)+mE[this.type]+r(e)+this[r(t)]+r(707)+this[r(i)]+r(373)+this[r(s)]+")"}},"Token"),pt);function NE(e){const t=jM,i=Number(e);return!isNaN(i)&&e[t(508)]()===i.toString()}function ME(e){return/^[a-zA-Zа-яА-ЯёЁ_$]$/[jM(364)](e)}function EE(e){return/^[a-zA-Zа-яА-ЯёЁ0-9_$]$/[jM(364)](e)}MM(NE,jM(693)),MM(ME,jM(569)),MM(EE,jM(543));var BE=new Set([0,1,2,4,37,41,17,19]);function DE(e){return!BE[jM(640)](e)}MM(DE,jM(615));var LE=(MM(wt=class{constructor(e){Et(this,yt,jM(587)),Et(this,xt,new Map([["+",16],["++",17],["-",18],["--",19],["*",20],["/",21],["(",36],[")",37],["{",38],["}",39],["[",40],["]",41],["=",22],["<",28],[">",30],[",",42],[":",43],[";",44],[".",45],["!",25],["&",34],["|",32],["==",23],[jM(549),24],["!=",26],[jM(696),27],["<=",29],[">=",31],["=>",46],["&&",35],["||",33]])),Et(this,"input"),Et(this,bt),Et(this,_t,[]),Et(this,mt,0),Et(this,vt,1),Et(this,gt,1),Et(this,"comments",[]);const t=391,i=jM;this[i(411)]=e,this.length=e[i(t)]}[(yt=jM(471),xt=jM(577),bt=jM(391),_t=jM(415),mt=jM(370),vt=jM(542),gt=jM(457),jM(310))](){const e=704,t=568,i=522,s=521,r=502,n=620,o=400,a=542,l=457,c=jM;for(;this.pos<this.length;){const h=this[c(e)](0);if(NE(h))this[c(t)]();else if(ME(h))this[c(340)]();else if('"'===h||"'"===h)this[c(i)](h);else if("`"===h)this[c(483)]();else if(this[c(s)](3)===c(r))this[c(316)]();else if("/"===h&&this[c(630)]())this.tokenizeRegex();else if(-1!==this[c(471)].indexOf(h))this[c(n)]();else{if(" "!==h&&"\t"!==h&&"\r"!==h&&"\n"!==h&&"\ufeff"!==h)throw" "===h?new CE(c(526),this.line,this[c(a)]):new CE("Unexpected character "+JSON.stringify(h),this[c(l)],this[c(542)]);this[c(o)]()}}return this[c(415)]}[jM(630)](){const e=415,t=391,i=jM;if("/"===this[i(704)](1)||"*"===this[i(704)](1))return!1;const s=0===this.tokens[i(391)]?null:this[i(e)][this[i(e)][i(t)]-1];return null===s||DE(s[i(507)]())}[jM(410)](){const e=457,t=519,i=626,s=567,r=400,n=708,o=704,a=664,l=jM,c=this[l(542)],h=this[l(e)];this[l(400)]();const u=[];let d=!1,f=this[l(704)](0);for(;"\0"!==f;){if("\n"===f||"\r"===f)throw new CE(l(t),h,c);if("\\"!==f)if("["!==f||d)if("]"===f&&d)d=!1,u[l(626)](f),f=this[l(400)]();else{if("/"===f&&!d)break;u[l(i)](f),f=this[l(r)]()}else d=!0,u.push(f),f=this[l(400)]();else{if(u[l(i)](f),f=this[l(400)](),"\0"===f||"\n"===f||"\r"===f)throw new CE(l(s),h,c);u[l(i)](f),f=this[l(r)]()}}if("/"!==f)throw new CE(l(n),h,c);this.next();const p=[];for(f=this[l(o)](0);"\0"!==f&&EE(f);)p.push(f),f=this[l(400)]();this[l(460)](3,u[l(a)]("")+"\0"+p.join(""),c,h)}next(){const e=699,t=457,i=jM,s=this[i(411)][i(e)](this[i(370)]);return this[i(370)]++,"\n"==s?(this[i(t)]++,this.column=1):this.column++,this[i(704)](0)}[jM(704)](e){const t=391,i=699,s=jM,r=this[s(370)]+e;return r>=this[s(t)]?"\0":this[s(411)][s(i)](r)}[jM(521)](e){const t=704,i=jM,s=[];for(let r=0;r<e;r++)s[i(626)](this[i(t)](r));return s[i(664)]("")}[jM(460)](e,t,i,s){const r=jM;this[r(415)][r(626)](new jE(e,t,i,s))}[jM(568)](){const e=457,t=542,i=jM,s=this[i(542)],r=this[i(e)],n=[];let o=this[i(704)](0);for(;"\0"!==o;){if("."==o){if(-1!==n.indexOf("."))throw new CE(i(399),this[i(457)],this[i(t)])}else if(!NE(o))break;n.push(o),o=this[i(400)]()}this[i(460)](0,n.join(""),s,r)}consumeWord(){const e=626,t=400,i=664,s=jM,r=[];let n=this[s(704)](0);for(;"\0"!==n&&EE(n);)r[s(e)](n),n=this[s(t)]();return r[s(i)]("")}[jM(316)](){const e=457,t=400,i=352,s=639,r=jM,n=this[r(542)],o=this[r(e)];this.next(),this[r(t)](),this[r(400)]();const a=this[r(348)]();a[r(i)](r(s))?this[r(460)](48,a,n,o):this[r(460)](47,a,n,o)}[jM(340)](){const e=348,t=460,i=324,s=460,r=421,n=460,o=554,a=593,l=460,c=460,h=jM,u=this[h(542)],d=this[h(457)],f=this[h(e)]();switch(f){case"var":this[h(t)](4,"",u,d);break;case h(i):this[h(s)](5,"",u,d);break;case"if":this.addToken(6,"",u,d);break;case h(r):this[h(n)](7,"",u,d);break;case h(o):this[h(s)](9,"",u,d);break;case h(a):this.addToken(8,"",u,d);break;case"do":this[h(460)](10,"",u,d);break;case"break":this[h(460)](11,"",u,d);break;case"continue":this.addToken(12,"",u,d);break;case h(599):this[h(l)](13,"",u,d);break;case h(458):this[h(c)](14,"",u,d);break;case"step":this[h(460)](15,"",u,d);break;default:this[h(460)](1,f,u,d)}}tokenizeText(e){const t=457,i=400,s=626,r=403,n=jM,o=this[n(542)],a=this[n(t)];this[n(400)]();const l=[];let c=this.peek(0);for(;"\0"!==c;)if("\\"!=c){if(c==e)break;l.push(c),c=this.next()}else{switch(c=this[n(i)](),c){case e:c=this[n(400)](),l.push(e);continue;case"n":c=this[n(400)](),l[n(s)]("\n");continue;case"t":c=this[n(400)](),l[n(626)]("\t");continue;case"\\":c=this.next(),l[n(s)]("\\");continue}l[n(626)]("\\"),"\0"!==c&&(l[n(626)](c),c=this[n(400)]())}if("\0"===c)throw new CE(n(r),a,o);this.next();const h=l.join("");this[n(460)](2,h,o,a)}[jM(483)](){const e=704,t=457,i=626,s=400,r=487,n=jM,o=this[n(542)],a=this.line;this[n(400)]();const l=[];let c=this[n(e)](0);for(;"\0"!==c&&"`"!==c;){if("$"===c&&"{"===this.peek(1))throw new CE(n(625),this[n(t)],this[n(542)]);l[n(i)](c),c=this[n(s)]()}if("\0"===c)throw new CE(n(r),a,o);this[n(s)](),this.addToken(2,l.join(""),o,a)}tokenizeComment(e,t){const i=529,s=470,r=626,n=646,o=508,a=jM,l=[];let c=this[a(704)](0);for(;-1==a(i)[a(s)](c);)l[a(r)](c),c=this.next();this[a(n)][a(r)]({line:e,column:t,text:l.join("")[a(o)]()})}tokenizeMultilineComment(e,t){const i=400,s=626,r=508,n=jM,o=[];let a=this[n(704)](0);for(;"\0"!=a&&("*"!=a||"/"!=this[n(704)](1));)o.push(a),a=this.next();if("\0"==a)throw new CE("Missing close tag in comment",e,t);this[n(i)](),this[n(400)](),this.comments[n(s)]({line:e,column:t,text:o.join("")[n(r)]()})}tokenizeOperator(){const e=457,t=400,i=704,s=542,r=664,n=577,o=400,a=338,l=jM;let c=this[l(704)](0);if("/"==c){const s=this[l(e)],r=this[l(542)];if("/"==this[l(704)](1))return this[l(t)](),this[l(t)](),void this[l(299)](s,r);if("*"==this[l(i)](1))return this.next(),this[l(400)](),void this.tokenizeMultilineComment(s,r)}const h=this[l(s)],u=this[l(457)],d=[];for(;"\0"!==c;){const e=d[l(r)]("");if(!this[l(n)][l(640)](e+c)&&""!=e){const t=this.OPERATORS[l(456)](e);if(!t)throw new CE(l(583)+e,u,h);return void this.addToken(t,"",h,u)}d[l(626)](c),c=this[l(o)]()}const f=d[l(664)]("");if(""!==f){const e=this[l(577)].get(f);if(e)return void this[l(460)](e,"",h,u)}throw new CE(l(a),u,h)}},jM(566)),wt);function RE(e,t,i,s=2){const r=603,n=465,o=603,a=391,l=670,c=326,h=626,u=603,d=462,f=664,p=jM,g=e[p(534)](/\r\n|\n|\r/),v=Math[p(r)](Math[p(n)](t,1),g.length),m=Math[p(465)](1,v-s),_=Math[p(o)](g.length,v+s),b=String(_)[p(a)],x=[];for(let y=m;y<=_;y++){const e=g[y-1]??"",t=String(y)[p(l)](b);if(y!==v){x[p(626)](p(c)+t+" | "+e);continue}x[p(h)](p(647)+t+p(462)+e);const s=Math[p(u)](Math.max(i,1),e.length+1)-1;x[p(626)](p(c)+" ".repeat(b)+p(d)+" ".repeat(s)+"^")}return x[p(f)]("\n")}MM(RE,jM(671)),MM(function(e,t){const i=457,s=393,r=542,n=jM;return t[n(634)]+n(478)+t[n(i)]+n(s)+t[n(r)]+")\n"+RE(e,t[n(i)],t[n(542)])},jM(563));var PE=(MM(Nt=class{constructor(e){Et(this,"EOF",new jE(49,"",-1,-1)),Et(this,jt,[]),Et(this,Ct,0),Et(this,kt);const t=jM;this[t(415)]=e,this[t(648)]=e[t(391)]}parse(){const e=359,t=359,i=jM,s=this[i(456)](0),r=new XM(s);for(;!this[i(e)](49);)r[i(602)](this[i(560)]()),this[i(t)](44);return r}[(jt=jM(415),Ct=jM(370),kt=jM(648),jM(372))](){const e=507,t=560,i=jM;return 38===this[i(456)](0)[i(e)]()?this[i(435)]():this[i(t)]()}[jM(691)](e){const t=560,i=jM,s=this[i(456)](0),r=new XM(s);for(;!this.match(48);)r.add(this[i(t)]()),this[i(359)](44);return r}[jM(308)](){const e=345,t=363,i=345,s=691,r=jM,n=this[r(456)](0),o=this.consume(47)[r(e)]();this[r(363)](36);const a=[];for(;!this[r(359)](37);)a.push(this[r(t)](2)[r(i)]()),this[r(359)](42);const l=this[r(s)](o);return new uE(o,a,l,n)}[jM(362)](e){const t=591,i=363,s=jM;this.consume(36);const r=this[s(t)]();this[s(363)](42),this[s(i)](36),this[s(363)](37),this[s(363)](46);const n=this[s(435)]();return this.consume(37),new bE(r,n,e)}[jM(435)](){const e=363,t=359,i=jM,s=this[i(456)](0),r=new XM(s);for(this[i(e)](38);!this[i(359)](39);)r[i(602)](this[i(560)]()),this[i(t)](44);return r}[jM(560)](){const e=306,t=591,i=359,s=685,r=579,n=468,o=694,a=309,l=694,c=363,h=jM,u=this.get(0);if(this.match(4))return this[h(e)](u);if(this.match(5))return new fE(this[h(t)](),u);if(this[h(i)](6))return this[h(s)](u);if(this[h(359)](8))return this[h(r)](u);if(this[h(359)](10))return this[h(674)](u);if(this[h(i)](11))return new JM(u);if(this[h(i)](12))return new eE(u);if(this[h(359)](14))return new vE(this.expression(),u);if(this.match(9))return this.forStatement(u);if(this[h(i)](13))return this[h(n)](u);if(this.match(15))return this[h(362)](u);if(this[h(o)](0,47))return this[h(308)]();if(this.lookMatch(0,1)&&this[h(694)](1,36)){const e=this[h(476)](this[h(a)](u));return new rE(e,u)}if(this[h(o)](0,1)&&this[h(694)](1,45)){const e=new SE(this.consume(1).getText(),u),t=this.callWithPostfix(e);if(!(t instanceof hE))throw CE.at(u,"Property-read expression used as a statement (no side effect). Either assign it (`x = row.foo`) or call a method (`row.foo()`).");return new rE(t,u)}if(this.match(17)){const e=new SE(this[h(363)](1).getText(),u);return new cE(new lE(e,0,u),u)}if(this[h(359)](19)){const e=new SE(this[h(363)](1).getText(),u);return new cE(new lE(e,1,u),u)}if(this[h(694)](0,1)&&(this[h(l)](1,17)||this.lookMatch(1,19))){const e=this[h(c)](1),t=new SE(e.getText(),e);return this[h(i)](17)?new cE(new lE(t,2,e),e):(this.consume(19),new cE(new lE(t,3,e),e))}return this[h(678)]()}varStatement(e){const t=509,i=644,s=626,r=jM,n=[];do{const e=this.consume(1),o=e.getText();if(Nt[r(t)].has(o))throw CE.at(e,r(i)+o+"' is a reserved JavaScript keyword. Use a different name.");let a=null;this.match(22)&&(a=this.expression()),n[r(s)]({name:o,init:a})}while(this[r(359)](42));return new wE(n,e)}[(St=jM(509),jM(678))](){const e=694,t=591,i=694,s=390,r=456,n=jM,o=this.get(0);if(this[n(e)](0,1)&&this.lookMatch(1,22)){const e=this.consume(1)[n(345)]();return this[n(363)](22),new YM(e,this[n(t)](),o)}if(this[n(694)](0,1)&&this[n(i)](1,40)){const e=this[n(s)](o);return this.consume(22),new $M(e,this[n(591)](),o)}throw CE.at(this[n(r)](0),"Unknown statement: unexpected "+mE[this[n(r)](0).getType()])}[jM(685)](e){const t=372,i=359,s=jM,r=this[s(591)](),n=this[s(t)]();let o;return o=this[s(i)](7)?this[s(372)]():null,new oE(r,n,o,e)}doWhileStatement(e){const t=jM,i=this[t(372)]();this[t(363)](8);const s=this.expression();return new tE(s,i,e)}[jM(579)](e){const t=jM,i=this[t(591)](),s=this[t(372)]();return new kE(i,s,e)}[jM(641)](e){const t=456,i=386,s=678,r=560,n=jM;let o;if(this[n(363)](36),this.match(4))throw CE.at(this[n(t)](-1),n(i));o=this[n(s)](),this.consume(44);const a=this[n(591)]();this[n(363)](44);const l=this[n(r)]();this[n(363)](37);const c=this[n(372)]();return new iE(o,a,l,c,e)}[jM(468)](e){const t=363,i=359,s=jM,r=this[s(363)](1)[s(345)]();this[s(363)](36);const n=[];for(;!this.match(37);)n[s(626)](this[s(t)](1).getText()),this[s(i)](42);const o=this.statementOrBlock();return new sE(r,n,o,e)}[jM(309)](e){const t=363,i=345,s=538,r=jM,n=this[r(t)](1)[r(i)]();this[r(t)](36);const o=new nE(n,[],e);for(;!this[r(359)](37);)o[r(s)](this.expression()),this.match(42);return o}[jM(390)](e){const t=363,i=626,s=jM,r=this.consume(1)[s(345)](),n=[];do{this[s(t)](40),n[s(i)](this[s(591)]()),this[s(363)](41)}while(this.lookMatch(0,40));return new qM(r,n,e)}[jM(438)](e){const t=359,i=626,s=jM;this[s(363)](40);const r=[];for(;!this[s(t)](41);)r[s(i)](this.expression()),this[s(359)](42);return new VM(r,e)}[jM(605)](e){const t=359,i=363,s=345,r=694,n=363,o=430,a=359,l=jM;this.consume(38);const c=new Map;for(;!this[l(t)](39);){let e;if(this[l(694)](0,1))e=this[l(i)](1)[l(s)]();else{if(!this[l(r)](0,2))throw CE.at(this[l(456)](0),l(o));e=this[l(n)](2)[l(345)]()}this[l(i)](43);const t=this[l(591)]();c[l(383)](e,t),this[l(a)](42)}return new dE(c,e)}expression(){return this[jM(480)]()}[jM(480)](){const e=jM;let t=this[e(642)]();for(;this[e(359)](33);){const e=this.get(0);t=new QM("||",t,this.logicalAnd(),e)}return t}[jM(642)](){const e=jM;let t=this[e(350)]();for(;this[e(359)](35);){const i=this.get(0);t=new QM("&&",t,this[e(350)](),i)}return t}[jM(350)](){const e=359,t=499,i=696,s=jM,r=this[s(456)](0),n=this.conditional();return this[s(e)](23)?new QM("==",n,this.conditional(),r):this.match(24)?new QM(s(549),n,this[s(t)](),r):this[s(359)](26)?new QM("!=",n,this[s(499)](),r):this[s(359)](27)?new QM(s(i),n,this[s(499)](),r):n}conditional(){const e=565,t=359,i=565,s=jM;let r=this[s(e)]();for(;this[s(694)](0,28)||this[s(694)](0,29)||this[s(694)](0,30)||this[s(694)](0,31);){const n=this.get(0);this[s(t)](28)?r=new QM("<",r,this[s(e)](),n):this[s(t)](29)?r=new QM("<=",r,this[s(i)](),n):this[s(t)](30)?r=new QM(">",r,this.additive(),n):this[s(359)](31)&&(r=new QM(">=",r,this[s(565)](),n))}return r}[jM(565)](){const e=694,t=694,i=359,s=456,r=351,n=jM;let o=this[n(351)]();for(;this[n(e)](0,16)||this[n(t)](0,18);){if(this[n(i)](16)){const e=this[n(s)](-1);o=new GM("+",o,this.multiplicate(),e);continue}this[n(363)](18);const e=this[n(456)](-1);o=new GM("-",o,this[n(r)](),e)}return o}[jM(351)](){const e=694,t=363,i=jM;let s=this.unary();for(;this.lookMatch(0,20)||this[i(e)](0,21);){if(this.match(20)){const e=this.get(-1);s=new GM("*",s,this.unary(),e);continue}this[i(t)](21);const e=this.get(-1);s=new GM("/",s,this[i(537)](),e)}return s}[jM(537)](){const e=359,t=359,i=345,s=345,r=jM,n=this[r(456)](0);if(this[r(e)](18))return new xE("-",this.primary(),n);if(this[r(t)](17)){const e=new SE(this[r(363)](1)[r(i)](),n);return new lE(e,0,n)}if(this[r(359)](19)){const e=new SE(this[r(363)](1)[r(s)](),n);return new lE(e,1,n)}return this[r(518)]()}[jM(518)](){const e=359,t=345,i=470,s=304,r=694,n=390,o=359,a=591,l=359,c=jM,h=this[c(456)](0);let u;if(this.match(0))u=new _E(h.getText(),h);else if(this[c(e)](3)){const e=h[c(t)](),r=e[c(i)]("\0"),n=r<0?e:e[c(s)](0,r),o=r<0?"":e[c(s)](r+1);u=new gE(n,o,h)}else if(this[c(694)](0,1)&&this[c(r)](1,36))u=this.functionExpression(h);else if(this.lookMatch(0,1)&&this[c(694)](1,40))u=this[c(n)](h);else if(this[c(r)](0,40))u=this[c(438)](h);else if(this.lookMatch(0,38))u=this.objectExpression(h);else if(this.match(1)){const e=new SE(h[c(345)](),h);u=e,this[c(359)](17)?u=new lE(e,2,h):this.match(19)&&(u=new lE(e,3,h))}else if(this[c(o)](2))u=new _E(h[c(345)](),h);else{if(!this.match(36))throw CE.at(h,c(449)+mE[h[c(507)]()]);u=this[c(a)](),this[c(l)](37)}return this.callWithPostfix(u)}[jM(476)](e){const t=456,i=363,s=345,r=359,n=626,o=jM;let a=e;for(;this.match(45);){const e=this[o(t)](0);if(1!==e[o(507)]())throw CE.at(e,o(679));const l=this[o(i)](1)[o(s)]();if(this[o(r)](36)){const t=[];for(;!this[o(359)](37);)t[o(n)](this[o(591)]()),this.match(42);a=new hE(a,l,t,e)}else a=new pE(a,l,e)}if(this[o(694)](0,40)&&!(a instanceof SE))throw CE.at(this[o(456)](0),o(347));return a}[jM(363)](e){const t=jM,i=this[t(456)](0);if(e!=i[t(507)]())throw CE.at(i,t(360)+mE[i[t(507)]()]+t(578)+mE[e]);return this.pos++,i}[jM(359)](e){const t=jM;return e==this[t(456)](0)[t(507)]()&&(this[t(370)]++,!0)}[jM(694)](e,t){const i=jM;return this[i(456)](e)[i(507)]()==t}[jM(456)](e){const t=648,i=jM,s=this[i(370)]+e;return s>=this[i(t)]?this.EOF:this.tokens[s]}},jM(407)),Et(Nt,St,new Set([jM(601),jM(398),jM(618),jM(380),jM(297),jM(422),jM(369),jM(322),"delete",jM(453),jM(436),"in","of","import",jM(494),jM(301),jM(357),jM(408),jM(682),"void",jM(455),jM(385),jM(477),"finally",jM(402),jM(710),"with",jM(681),jM(416),jM(619)])),Nt);function AE(e,t){e-=158;var i=TE(),s=i[e];if(void 0===AE.BwtHlJ){AE.JLrfEE=function(e){for(var t,i,s="",r="",n=0,o=0;i=e.charAt(o++);~i&&(t=n%4?64*t+i:i,n++%4)?s+=String.fromCharCode(255&t>>(-2*n&6)):0)i="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=".indexOf(i);for(var a=0,l=s.length;a<l;a++)r+="%"+("00"+s.charCodeAt(a).toString(16)).slice(-2);return decodeURIComponent(r)},AE.pkWOIh={},AE.BwtHlJ=!0}var r=e+i[0],n=AE.pkWOIh[r];return n?s=n:(s=AE.JLrfEE(s),AE.pkWOIh[r]=s),s}function TE(){var e=["ntCZnJeYnNHxyvDLyW","ndq0otm2nxbpELjvCa","mJG3mdKXrvjPvMXY","nJG1nJu2ohL0CuTvzW","odDpq1b5u0m","odqYndHJwwDSEKW","nty2odG4zwfzBxno","ntCWnZjfwwLMsgW"];return(TE=function(){return e})()}!function(){for(var e=161,t=158,i=163,s=AE,r=TE();;)try{if(563384===-parseInt(s(e))/1+parseInt(s(160))/2+-parseInt(s(t))/3*(parseInt(s(159))/4)+parseInt(s(i))/5+parseInt(s(162))/6+-parseInt(s(164))/7+-parseInt(s(165))/8)break;r.push(r.shift())}catch(n){r.push(r.shift())}}();class zE extends Error{constructor(e){super(e),this.name="ScenarioBodyParseError"}}function OE(e){let t;try{t=new PE(new LE(e).tokenize()).parse()}catch(r){throw new zE(r instanceof Error?r.message:String(r))}const i=t.statements.find(e=>e instanceof sE&&(e.name.startsWith("test_")||e.name.startsWith("flow_")));if(!i)throw new zE("no 'function test_*()' declaration found");if(!(i.body instanceof XM))throw new zE("function body is not a block");const s=e.split(/\r?\n/);return IE(i.body.statements,s,{n:0})}function IE(e,t,i){const s=[];for(const r of e)if(r instanceof bE)s.push({kind:"block",title:FE(r.label),children:IE(r.body.statements,t,i)});else if(r instanceof uE)s.push({kind:"block",title:r.argNames[0]??"",children:IE(HE(r.body),t,i)});else{if(r instanceof oE){const e={kind:"control",...WE(r,t,i,r.ifStatement),children:IE(HE(r.ifStatement),t,i)};r.elseStatement&&(e.elseChildren=IE(HE(r.elseStatement),t,i)),s.push(e);continue}if(r instanceof iE||r instanceof kE||r instanceof tE){const e=r instanceof iE?r.block:r.statement;s.push({kind:"control",...WE(r,t,i,e),children:IE(HE(e),t,i)});continue}s.push({kind:"step",...WE(r,t,i)})}return s}function FE(e){var t;const i=e.value;return(null==(t=null==i?void 0:i.asString)?void 0:t.call(i))??""}function HE(e){return e instanceof XM?e.statements:[e]}function WE(e,t,i,s){const{line:r,col:n}=KE(e),o=s instanceof XM?KE(s).line:r,a=t.slice(r-1,Math.max(r,o)).map(e=>e.trim()).filter(e=>e.length>0).join(" ");return{index:i.n++,line:r,col:n,source:a}}function KE(e){const t=e.token;return{line:(null==t?void 0:t.getLine)?t.getLine():0,col:(null==t?void 0:t.getColumn)?t.getColumn():0}}const UE=gi.lazy(()=>Nj(()=>import("./DslEditor-CV43IwH6.js"),__vite__mapDeps([0,1])).then(e=>({default:e.DslEditor}))),qE=__(function({runId:e}){var t,i,s;const r=w_(),n=r.activeRuns.byRunId.get(e)??null,o=r.historicRuns.get(e),[a,l]=gi.useState(n?n.plainRun?"steps":"code":"steps");gi.useEffect(()=>{n||r.historicRuns.loadIfNeeded(e)},[r,e,n]),gi.useEffect(()=>{let t,i=!1;const s=async()=>{if(i)return;if(await r.runSources.loadIfNeeded(e),i)return;void 0===r.runSources.get(e)&&r.activeRuns.byRunId.has(e)&&(t=setTimeout(()=>{s()},300))};return s(),()=>{i=!0,t&&clearTimeout(t)}},[r,e]),gi.useEffect(()=>{n&&r.activeRuns.syncRuntime(e)},[r,e,n]);const c=n?function(e){return{events:e.events,status:QE(e.status),scenario:e.scenario,startedAt:e.startedAt,durationMs:null,abortable:"starting"===e.status||"running"===e.status||"paused"===e.status,outcome:e.outcome}}(n):o?function(e){const t="scenario"===e.meta.kind?e.events:[];return{events:t,status:cj(e.meta),scenario:e.meta.ref,startedAt:e.meta.startedAt,durationMs:e.meta.durationMs,abortable:!1,outcome:e.meta.outcome}}(o):null,h=(null==c?void 0:c.scenario)||(null==o?void 0:o.meta.ref)||(null==n?void 0:n.scenario)||"",u=r.scenarios.items.find(e=>e.name===h),d=r.runSources.get(e),f="authoring"===(null==n?void 0:n.mode),p=f?(null==u?void 0:u.path)??(null==d?void 0:d.entry)??null:null;gi.useEffect(()=>{p&&r.source.getOrLoad(p)},[r,p]);const g=p?r.source.draft(p)??null:null,v=p??(null==d?void 0:d.entry)??"",m=f?g:d?d.files[d.entry]??null:null,_=f?null!==g:void 0!==d,b=gi.useMemo(()=>{if(null==m)return null;try{return OE(m)}catch{return null}},[m]),x=ON(e),y=gi.useMemo(()=>{if(!b||!c)return;const e=function(e,t,i){const s=wM(t),r=[];let n=null;const o=new Map;for(const a of e)if("step:started"===a.kind){const e=a.file===i?SM(s,a.line,a.col):null;r.push({idx:e})}else if("step:ok"===a.kind||"step:fail"===a.kind){const e=r.pop();null!=(null==e?void 0:e.idx)&&(n=e.idx)}else if("screenshot"===a.kind){if(null!=a.line&&null!=a.col&&(null==a.file||a.file===i)){const e=SM(s,a.line,a.col);if(null!=e){o.set(e,a.path);continue}}const e=[...r].reverse().find(e=>null!=e.idx),t=(null==e?void 0:e.idx)??n;null!=t&&o.set(t,a.path)}return o}(c.events,b,v);if(0===e.size)return;const t=new Map;for(const[i,s]of e){const e=x.resolveUrl({kind:"event",path:s});e&&t.set(i,e)}return t.size>0?t:void 0},[b,c,v,x]),w=gi.useMemo(()=>b&&y?function(e,t){const i=[],s=(e,r)=>{for(const n of e){if("block"===n.kind){s(n.children,n.title);continue}const e=t.get(n.index);null!=e&&i.push({stepIndex:n.index,url:e,blockTitle:r,source:n.source,line:n.line}),"control"===n.kind&&(s(n.children,r),n.elseChildren&&s(n.elseChildren,r))}};return s(e,null),i}(b,y):[],[b,y]),[S,k]=gi.useState(null),[C,j]=gi.useState(null),N=gi.useCallback(e=>{var t;k(e),j((null==(t=w[e])?void 0:t.stepIndex)??null)},[w]),M=gi.useCallback(e=>{const t=function(e,t){return e.findIndex(e=>e.stepIndex===t)}(w,e);t>=0&&N(t)},[w,N]);if(!c)return r.historicRuns.errors.has(e)?ki.jsx(ej,{id:e}):ki.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading run…"});const E="failed"===c.status,B="passed"===c.status||"failed"===c.status||"aborted"===c.status,D=b?kM(c.events,b,v):null,L=D?Object.values(D).reduce((e,t)=>("passed"===t.status?e.passed++:"failed"===t.status?e.failed++:"running"===t.status?e.running++:e.pending++,e),{passed:0,failed:0,running:0,pending:0}):{passed:0,failed:0,running:0,pending:0},R="paused"===(null==n?void 0:n.status),P="starting"===(null==n?void 0:n.status)||"running"===(null==n?void 0:n.status),A=r.session.capabilities.canRun,T=r.targets.activeDebugCaps,z=A&&T.picker&&(R||f&&P),O=A&&R&&("failure"!==(null==(t=null==n?void 0:n.pausedAt)?void 0:t.reason)||T.resumeFromFailure),I=null!=(null==n?void 0:n.pausedAt)&&(null===n.pausedAt.file||n.pausedAt.file===v),F=R&&(null==n?void 0:n.pausedAt)&&I?function(e,t,i){var s;if(!e)return;const r=bN(e),n=r.find(e=>e.line===t&&e.col===i);return n?n.index:null==(s=r.find(e=>e.line===t))?void 0:s.index}(b,n.pausedAt.line,n.pausedAt.col):void 0,H=(null==u?void 0:u.path)??v,W=R&&(null==(i=null==n?void 0:n.pausedAt)?void 0:i.file)?n.pausedAt.file:H,K=W===H||W===v,U=E&&b?function(e,t){var i;return e&&null!=t?null==(i=bN(e).find(e=>e.index===t))?void 0:i.line:void 0}(b,CM(c.events,b,v)):void 0;let q,$;R&&(null==n?void 0:n.pausedAt)?"failure"===n.pausedAt.reason?$=n.pausedAt.line:q=n.pausedAt.line:K&&($=U);const V=null==u?void 0:u.name,Y=V?r.breakpoints.get(V):void 0,G=new Set;if(Y)for(const Q of Y)G.add(Number(Q.split(":")[0]));if(K&&n)for(const Q of n.breakpoints)G.add(Number(Q.split(":")[0]));const X=(t,i)=>{if(!V)return;r.breakpoints.toggle(V,t,i)?r.activeRuns.setBreakpoint(e,t,i):r.activeRuns.clearBreakpoint(e,t,i)},J=(null==u?void 0:u.name)||h,Z=A&&!P&&!R&&!c.abortable&&!!J?()=>{r.activeRuns.startScenario(J,{headed:!1,debug:!1}).then(e=>{r.tabs.open({kind:"scenario-run",runId:e.runId})})}:null;return ki.jsxs("div",{className:"flex h-full min-w-0 gap-1.5 bg-shell",children:[ki.jsxs("section",{className:cx("flex min-w-0 flex-1 flex-col overflow-hidden bg-canvas",r.layout.inspectorOpen&&"rounded-r-lg"),children:[ki.jsx(VE,{title:(null==u?void 0:u.title)??h??e,onOpenScenario:u?()=>r.tabs.open({kind:"scenario",path:u.path}):null,color:(null==u?void 0:u.color)??null,status:c.status,viewMode:a,onViewMode:l,onRunAgain:Z,onAbort:c.abortable&&A?()=>{r.activeRuns.abort(e)}:null,onContinue:O?()=>{r.activeRuns.continueRun(e)}:null,onStep:O?()=>{r.activeRuns.step(e)}:null,onPause:P&&!f&&A?()=>{r.activeRuns.pauseRun(e)}:null,picker:z?(null==n?void 0:n.picker)??null:null,onPick:z?t=>{r.activeRuns.togglePicker(e,t)}:null,execute:!!z&&((null==(s=null==n?void 0:n.picker)?void 0:s.execute)??!1),onSetExecute:z?t=>{r.activeRuns.setPickerExecute(e,t)}:null,wheel:(null==n?void 0:n.wheel)??"human",isAuthoring:f,onSetWheel:A&&T.attach&&(P||R)?t=>{r.activeRuns.setWheel(e,t)}:null,onExport:P?null:()=>function(e){if(!window.confirm("Export this run as a .unotest.zip snapshot?\n\nThe bundle is a verbatim capture — it can include secrets from fill() values, console output and network request headers. Share it only with people you trust."))return;const t=document.createElement("a");t.href=`/api/runs/${encodeURIComponent(e)}/export`,t.rel="noopener",document.body.appendChild(t),t.click(),t.remove()}(e),inspectorOpen:r.layout.inspectorOpen,onToggleInspector:r.layout.toggleInspector}),R&&(null==n?void 0:n.pausedAt)&&ki.jsx(JE,{reason:n.pausedAt.reason,stepIndex:F??-1,file:n.pausedAt.file??v??h??e,line:n.pausedAt.line,col:n.pausedAt.col}),ki.jsx(ZE,{counts:L}),ki.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:"code"===a?ki.jsx(gi.Suspense,{fallback:ki.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading editor…"}),children:ki.jsx(UE,{path:W,fileKind:K?"scenario":"helper",...null!=q?{highlightLine:q}:{},...null!=$?{errorLine:$}:{},...K&&V?{breakpointLines:G,onToggleBreakpoint:e=>{const t=b?bN(b).find(t=>t.line===e):void 0;t&&X(e,t.col)}}:{}})}):ki.jsx("div",{className:"h-full overflow-y-auto",children:b?ki.jsx(wN,{body:b,...D?{trace:D}:{},...y?{screenshots:y,onOpenScreenshot:M,...null!=C?{activeScreenshotIndex:C}:{}}:{},...null!=F?{pausedIndex:F}:{},bpKeys:Y,onToggleBp:V?X:void 0,...E?{failedIndex:CM(c.events,b,v)??void 0}:{},...E?{onFailedStepRender:t=>{const i=RN(c.events,"step:fail");if(!i)return null;const s=RN(c.events,"failure-bundle:written");return ki.jsx(LN,{errorName:i.errorName??"Error",message:i.error,file:(null==u?void 0:u.path)??h??e,line:t.line,source:t.source,index:t.index,...(null==s?void 0:s.url)?{url:s.url}:{}})}}:{}}):ki.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:_?null===d?"No source snapshot for this run — a collection keeps them on its scenarios, and a run that never started a step has none.":"could not parse source snapshot":"loading run…"})})})]}),null!=S&&w[S]&&ki.jsx(EN,{strip:w,position:S,onNavigate:N,onClose:()=>k(null)}),r.layout.inspectorOpen&&ki.jsx(HN,{runId:e,active:n,events:c.events,isFailed:E,runFinished:B})]})});const $E={locator:{icon:"target",label:"Locator",hint:"click an element to insert its locator"},text:{icon:"text",label:"Text",hint:"click an element to insert a text assertion"},visibility:{icon:"eye",label:"Visibility",hint:"click an element to insert a visibility assertion"}};function VE({title:e,color:t,status:i,viewMode:s,onViewMode:r,onRunAgain:n,onAbort:o,onContinue:a,onStep:l,onPause:c,picker:h,onPick:u,execute:d,onSetExecute:f,wheel:p,onSetWheel:g,isAuthoring:v,onExport:m,inspectorOpen:_,onToggleInspector:b,onOpenScenario:x}){const y="paused"===i;return ki.jsxs("div",{className:"shrink-0 border-b border-edge bg-canvas",children:[ki.jsxs("div",{className:"flex h-10 items-center gap-3 px-4",children:[ki.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[t&&ki.jsx("span",{"aria-hidden":!0,className:"h-4 w-1 shrink-0 rounded-sm",style:{backgroundColor:t}}),ki.jsx("div",{className:"truncate text-[13px] font-medium text-fg",children:e}),x&&ki.jsxs("button",{type:"button","aria-label":"Open the test",onClick:x,className:"group relative grid h-5 w-5 shrink-0 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fg-2",children:[ki.jsx(ux,{name:"file",className:"h-3.5 w-3.5"}),ki.jsx(Mj,{label:"Open the test"})]}),v?ki.jsx(ij,{tone:"info",children:"authoring"}):!y&&ki.jsx(ij,{tone:uj(i),children:i})]}),ki.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[g&&ki.jsx(YE,{wheel:p,onSet:g}),ki.jsx(Ej,{value:s,onChange:r,options:[{value:"steps",label:"Steps",icon:"list",title:"Show the step tree"},{value:"code",label:"Code",icon:"braces",title:"Show the test source"}]}),ki.jsx("div",{className:"h-4 w-px bg-edge-soft"}),ki.jsxs("button",{type:"button",onClick:b,"aria-pressed":_,className:cx("group relative grid h-6 w-6 place-items-center rounded",_?"bg-raised text-fg":"text-fg-4 hover:bg-raised hover:text-fg-2"),children:[ki.jsx(ux,{name:"panelRight",className:"h-4 w-4"}),ki.jsx(Mj,{label:_?"Hide inspector":"Show inspector"})]})]})]}),ki.jsxs("div",{className:"flex h-10 items-center gap-3 border-t border-edge-soft px-4",children:[ki.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[n&&ki.jsx(yM,{icon:"play",tooltip:"Run this scenario again",onClick:n,children:ki.jsx("span",{className:"hidden sm:inline",children:"Run again"})}),a&&ki.jsx(yM,{variant:"primary",icon:"play",tooltip:"Resume execution",tooltipHint:"F8",onClick:a,children:ki.jsx("span",{className:"hidden sm:inline",children:"Continue"})}),l&&ki.jsx(yM,{icon:"stepOver",tooltip:"Step over",tooltipHint:"F10",onClick:l,children:ki.jsx("span",{className:"hidden sm:inline",children:"Step"})}),c&&ki.jsx(yM,{icon:"pause",tooltip:"Pause the run",tooltipHint:"F6",onClick:c,children:ki.jsx("span",{className:"hidden sm:inline",children:"Pause"})}),o&&ki.jsx(yM,{variant:"danger",icon:"square",tooltip:y?"Stop the run":"Abort the run",onClick:o,children:ki.jsx("span",{className:"hidden sm:inline",children:y?"Stop":"Abort"})})]}),ki.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[u&&ki.jsxs(ki.Fragment,{children:[f&&ki.jsx(GE,{execute:d,onChange:f}),ki.jsx(XE,{picker:h,onPick:u})]}),m&&ki.jsxs(ki.Fragment,{children:[u&&ki.jsx("div",{className:"h-4 w-px bg-edge-soft"}),ki.jsx(yM,{icon:"externalL",tooltip:"Export this run as a portable .unotest.zip to share",tooltipPlacement:"bottom-end",onClick:m,children:ki.jsx("span",{className:"hidden sm:inline",children:"Export"})})]})]})]})]})}function YE({wheel:e,onSet:t}){const i="agent"===e;return ki.jsxs("button",{type:"button",onClick:()=>t(i?"human":"agent"),className:cx("group relative flex h-6 items-center gap-1.5 rounded border px-2 font-mono text-[11px]",i?"border-warn/40 bg-warn/10 text-warn hover:bg-warn/20":"border-edge-soft bg-canvas text-fg-2 hover:bg-raised"),children:[ki.jsx("span",{"aria-hidden":!0,className:cx("h-1.5 w-1.5 rounded-full",i?"bg-warn uno-pulse":"bg-pass")}),i?"Agent driving":"You're driving",ki.jsx(Mj,{label:i?"Take control back from the agent":"Let the agent drive"})]})}function GE({execute:e,onChange:t}){return ki.jsx("div",{className:"flex items-center rounded-md border border-edge-soft bg-panel p-0.5",children:[{v:!1,label:"Capture",title:"Capture-only — record a locator/assertion, don't touch the page"},{v:!0,label:"Execute",title:"Execute — run actions on the page and record them"}].map(i=>{const s=i.v===e;return ki.jsxs("button",{type:"button","aria-pressed":s,onClick:()=>t(i.v),className:cx("group relative h-5 rounded px-2 font-mono text-[11px] transition-colors",s?"bg-canvas text-fg shadow-sm":"text-fg-3 hover:text-fg"),children:[i.label,ki.jsx(Mj,{label:i.title})]},i.label)})})}function XE({picker:e,onPick:t}){return ki.jsx("div",{className:"flex shrink-0 items-center gap-0.5",role:"group","aria-label":"Locator picker",children:Object.keys($E).map(i=>{const s=$E[i],r=!0===(null==e?void 0:e.active)&&e.mode===i;return ki.jsxs("button",{type:"button","aria-pressed":r,"aria-label":s.label,onClick:()=>t(i),className:cx("group relative grid h-6 w-7 place-items-center rounded border",r?"border-accent bg-accent text-on-accent":"border-accent/30 bg-canvas text-fg-3 hover:bg-raised hover:text-fg"),children:[ki.jsx(ux,{name:s.icon,className:"h-3.5 w-3.5",strokeWidth:1.75}),ki.jsx(Mj,{label:s.label,hint:s.hint})]},i)})})}function JE({reason:e,stepIndex:t,file:i,line:s,col:r}){const n="breakpoint"===e?"breakpoint hit":"step"===e?"step pause":"paused on failure";return ki.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-2 border-b border-warn/40 bg-warn/10 px-4",children:[ki.jsx(ux,{name:"pause",className:"h-3 w-3 text-warn",strokeWidth:2.5}),ki.jsx("span",{className:"font-mono text-[11px] uppercase tracking-wider text-warn",children:"paused"}),ki.jsx("span",{className:"text-warn/40",children:"·"}),ki.jsxs("span",{className:"font-mono text-[11.5px] text-warn",children:[t>=0?`#${t} `:"",ki.jsxs("span",{className:"text-warn/70",children:["— ",n]})]}),ki.jsxs("span",{className:"ml-auto truncate font-mono text-[11px] text-warn/70",children:[i,":",s,":",r]})]})}function ZE({counts:e}){const t=e.passed+e.failed+e.running+e.pending;return 0===t?ki.jsx("div",{className:"h-1 shrink-0 bg-raised"}):ki.jsxs("div",{className:"flex h-1 shrink-0 overflow-hidden bg-raised",children:[ki.jsx("div",{className:"h-full bg-pass",style:{width:e.passed/t*100+"%"}}),ki.jsx("div",{className:"h-full bg-fail",style:{width:e.failed/t*100+"%"}}),ki.jsx("div",{className:cx("h-full bg-warn",e.running>0&&"uno-pulse"),style:{width:e.running/t*100+"%"}})]})}function QE(e){switch(e){case"queued":return"pending";case"starting":case"running":return"running";case"paused":return"paused";case"completed":return"passed";case"failed":return"failed";case"aborted":return"aborted"}}const eB=gi.lazy(()=>Nj(()=>import("./DslEditor-CV43IwH6.js"),__vite__mapDeps([0,1])).then(e=>({default:e.DslEditor}))),tB=__(function({path:e}){const t=w_(),i=t.scenarios.items.find(t=>t.path===e),s=t.session.capabilities.canRun,[r,n]=gi.useState("steps");gi.useEffect(()=>{t.source.getOrLoad(e)},[t,e]);const o=t.source.draft(e),a=t.source.error(e),l=gi.useMemo(()=>{if(void 0===o)return null;try{return{ok:!0,body:OE(o)}}catch(e){return{ok:!1,message:e instanceof zE||e instanceof Error?e.message:String(e)}}},[o]),c=async e=>{if(!i)return;const s=await t.activeRuns.startScenario(i.name,{headed:e,debug:e});t.tabs.open({kind:"scenario-run",runId:s.runId})};if(!i)return ki.jsx(ej,{id:e});if(a)return ki.jsx(iB,{children:ki.jsx("div",{className:"p-4 font-mono text-[12px] text-fail",children:a})});const h=cj(t.runs.lastRunByRef("scenario",i.name)),u=t.breakpoints.get(i.name),d=new Set;for(const p of u)d.add(Number(p.split(":")[0]));const f=(e,s)=>{const r=t.breakpoints.toggle(i.name,e,s),n=t.activeRuns.findActiveByScenario(i.name);n&&(r?t.activeRuns.setBreakpoint(n.runId,e,s):t.activeRuns.clearBreakpoint(n.runId,e,s))};return ki.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[ki.jsxs("header",{className:"shrink-0 border-b border-edge",children:[ki.jsxs("div",{className:"flex h-10 items-center gap-3 px-4",children:[ki.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[ki.jsx("span",{"aria-hidden":!0,className:"h-4 w-1 shrink-0 rounded-sm",style:{backgroundColor:i.color}}),ki.jsx("h1",{className:"truncate text-[13px] font-medium text-fg",children:i.title}),ki.jsx(ij,{tone:uj(h),children:h})]}),ki.jsx("div",{className:"flex shrink-0 items-center",children:ki.jsx(Ej,{value:r,onChange:n,options:[{value:"steps",label:"Steps",icon:"list",title:"Show the step tree"},{value:"code",label:"Code",icon:"braces",title:"Edit the test source"}]})})]}),ki.jsxs("div",{className:"flex h-10 items-center gap-1.5 border-t border-edge-soft px-4",children:[ki.jsxs("button",{type:"button",disabled:!s,className:cx("group relative flex h-6 items-center gap-1.5 rounded bg-accent px-2.5 font-mono text-[11px] font-medium text-on-accent",s?"hover:bg-accent-hover":xj),onClick:()=>{c(!1)},children:[ki.jsx(ux,{name:"play",className:"h-3.5 w-3.5",strokeWidth:2.5})," Run",ki.jsx(Mj,{label:s?"Run headless":bj})]}),ki.jsxs("button",{type:"button",disabled:!s,className:cx("group relative flex h-6 items-center gap-1.5 rounded border border-warn/40 bg-warn/10 px-2.5 font-mono text-[11px] text-warn",s?"hover:bg-warn/20":xj),onClick:()=>{c(!0)},children:[ki.jsx(ux,{name:"bug",className:"h-3.5 w-3.5",strokeWidth:2})," Debug",ki.jsx(Mj,{label:s?"Headed browser · stop on breakpoints · pause on failure":bj})]}),ki.jsxs("button",{type:"button",className:"group relative ml-auto flex h-6 items-center gap-1.5 rounded border border-edge-soft px-2.5 font-mono text-[11px] text-fg-3 hover:bg-raised/60 hover:text-fg-2",onClick:()=>t.showScenarioHistory(i.name),children:[ki.jsx(ux,{name:"history",className:"h-3.5 w-3.5",strokeWidth:2}),"History",ki.jsx(Mj,{label:`Past runs of ${i.name}`})]})]})]}),ki.jsx("div",{className:"min-h-0 flex-1",children:"code"===r?ki.jsx(gi.Suspense,{fallback:ki.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading editor…"}),children:ki.jsx(eB,{path:e,fileKind:"scenario",breakpointLines:d,onToggleBreakpoint:e=>{const t=(null==l?void 0:l.ok)?bN(l.body).find(t=>t.line===e):void 0;t&&f(e,t.col)}})}):ki.jsxs("div",{className:"h-full overflow-y-auto",children:[null===l&&ki.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading source…"}),!1===(null==l?void 0:l.ok)&&ki.jsxs("div",{className:"px-4 py-3 font-mono text-[12px] text-fail",children:["parse error: ",l.message]}),(null==l?void 0:l.ok)&&ki.jsx(wN,{body:l.body,bpKeys:u,onToggleBp:f})]})})]})});function iB({children:e}){return ki.jsx("div",{className:"h-full",children:e})}const sB=__(function({snapshotId:e}){var t;const i=w_(),s=i.snapshots.manifestOf(e),[r,n]=gi.useState("steps"),o=gi.useMemo(()=>new TN(e),[e]),[a,l]=gi.useState(null);gi.useEffect(()=>{let e=!1;return l(null),Promise.all([o.loadText({kind:"runFile",file:"steps.jsonl"}),o.loadText({kind:"runFile",file:"runtime.json"}),o.loadText({kind:"runFile",file:"sources.json"})]).then(([t,i,s])=>{e||l({events:t.ok?nB(t.text):[],vars:i.ok?oB(i.text):{},sources:s.ok?aB(s.text):null})}),()=>{e=!0}},[o]);const c=(null==(t=null==a?void 0:a.sources)?void 0:t.entry)??"",h=(null==a?void 0:a.sources)?a.sources.files[a.sources.entry]??null:null,u=gi.useMemo(()=>{if(null==h)return null;try{return OE(h)}catch{return null}},[h]);if(!s)return i.snapshots.loaded?ki.jsx(ej,{id:e}):ki.jsx(rB,{});const d=function(e){return"interrupted"===e?"aborted":e}(s.status),f="failed"===s.status,p=(null==a?void 0:a.events)??[],g=u?kM(p,u,c):null,v=f&&u?CM(p,u,c)??void 0:void 0,m=function(e){for(let t=e.length-1;t>=0;t--){const i=e[t];if("step:fail"===i.kind)return i}return null}(p);return ki.jsx(zN.Provider,{value:o,children:ki.jsxs("div",{className:"flex h-full min-w-0 gap-1.5 bg-shell",children:[ki.jsxs("section",{className:cx("flex min-w-0 flex-1 flex-col overflow-hidden bg-canvas",i.layout.inspectorOpen&&"rounded-r-lg"),children:[ki.jsxs("div",{className:"shrink-0 border-b border-edge bg-canvas",children:[ki.jsxs("div",{className:"flex h-10 items-center gap-3 px-4",children:[ki.jsx("span",{"aria-hidden":!0,className:"h-4 w-1 shrink-0 rounded-sm bg-accent"}),ki.jsx("div",{className:"truncate text-[13px] font-medium text-fg",children:s.scenario}),ki.jsx(ij,{tone:uj(d),children:d}),ki.jsx("div",{className:"flex-1"}),ki.jsx(ij,{tone:"warn",children:"frozen · read-only"}),ki.jsx(Ej,{value:r,onChange:n,options:[{value:"steps",label:"Steps",icon:"list",title:"Show the step tree"},{value:"code",label:"Code",icon:"braces",title:"Show the test source"}]}),ki.jsx("div",{className:"h-4 w-px bg-edge-soft"}),ki.jsxs("button",{type:"button",onClick:i.layout.toggleInspector,"aria-pressed":i.layout.inspectorOpen,className:cx("group relative grid h-6 w-6 place-items-center rounded",i.layout.inspectorOpen?"bg-accent/10 text-accent":"text-fg-4 hover:bg-raised hover:text-fg-2"),children:[ki.jsx(ux,{name:"panelRight",className:"h-4 w-4"}),ki.jsx(Mj,{label:i.layout.inspectorOpen?"Hide inspector":"Show inspector",placement:"bottom-end"})]})]}),ki.jsxs("div",{className:"flex h-8 items-center gap-3 border-t border-edge-soft px-4 font-mono text-[11px] text-fg-3",children:[ki.jsxs("span",{className:"flex items-center gap-1",children:[ki.jsx(ux,{name:"camera",className:"h-3 w-3"})," snapshot"]}),ki.jsx("span",{children:"·"}),ki.jsxs("span",{children:["captured ",s.capturedAt.slice(0,16).replace("T"," ")]}),s.git.author&&ki.jsxs(ki.Fragment,{children:[ki.jsx("span",{children:"·"}),ki.jsxs("span",{children:[s.git.author,s.git.branch&&` @ ${s.git.branch}`]})]})]})]}),ki.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:null==a?ki.jsx(rB,{}):"code"===r?ki.jsx("pre",{className:"h-full overflow-auto whitespace-pre bg-canvas p-4 font-mono text-[12px] leading-relaxed text-fg",children:h??"no source snapshot in this bundle"}):ki.jsx("div",{className:"h-full overflow-y-auto",children:u?ki.jsx(wN,{body:u,...g?{trace:g}:{},...null!=v?{failedIndex:v}:{},...m?{onFailedStepRender:e=>ki.jsx(LN,{errorName:m.errorName??"Error",message:m.error,file:c||s.scenario,line:e.line,source:e.source,index:e.index})}:{}}):ki.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"no source snapshot in this bundle — steps can't be rendered"})})})]}),i.layout.inspectorOpen&&ki.jsx(HN,{runId:e,active:null,events:p,isFailed:f,runFinished:!0,varsOverride:(null==a?void 0:a.vars)??{}})]})})});function rB(){return ki.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading snapshot…"})}function nB(e){const t=[];for(const i of e.split("\n")){const e=i.trim();if(e)try{t.push(JSON.parse(e))}catch{}}return t}function oB(e){try{return JSON.parse(e).vars??{}}catch{return{}}}function aB(e){try{return JSON.parse(e)}catch{return null}}const lB=__(function(){const e=w_().tabs.activeTab;switch(e.kind){case"overview":return ki.jsx(Kj,{});case"scenario":return ki.jsx(tB,{path:e.path});case"helper":return ki.jsx(Rj,{path:e.path});case"collection":return ki.jsx(yj,{path:e.path});case"scenario-run":return ki.jsx(qE,{runId:e.runId});case"collection-run":return ki.jsx(dj,{runId:e.runId});case"snapshot":return ki.jsx(sB,{snapshotId:e.snapshotId})}}),cB={overview:"home",scenario:"file",helper:"braces",collection:"layers","scenario-run":"play","collection-run":"play",snapshot:"camera"},hB=__(function(){const e=w_(),[t,i]=gi.useState(null),s=e.tabs.tabs.map(t=>{const i=e.tabs.keyFor(t);return{key:i,tab:t,label:dB(e,t),status:fB(e,t),active:e.tabs.activeKey===i,closable:"overview"!==t.kind}});return ki.jsxs("div",{className:"relative shrink-0 border-b border-edge bg-panel",children:[ki.jsx("div",{role:"tablist",className:"uno-tab-rows uno-thin-scroll flex flex-wrap content-start gap-x-1 gap-y-1 overflow-y-auto py-0.5 pl-0.5 pr-8",style:{maxHeight:96},children:s.map(t=>ki.jsx(Ex,{label:t.label,active:t.active,closable:t.closable,closeLabel:`Close ${t.label}`,onActivate:()=>e.tabs.activate(t.key),onClose:()=>e.tabs.close(t.key),onContextMenu:e=>{e.preventDefault(),i({x:e.clientX,y:e.clientY,key:t.key})},leading:"scenario-run"===t.tab.kind||"collection-run"===t.tab.kind?ki.jsx(nj,{status:t.status??"pending"}):ki.jsx(ux,{name:cB[t.tab.kind],className:cx("h-3.5 w-3.5 shrink-0",t.active?"text-fg-2":"text-fg-4")})},t.key))}),ki.jsx("button",{type:"button",onClick:t=>{const s=t.currentTarget.getBoundingClientRect();i({x:Math.max(6,s.right-208),y:s.bottom+4,key:e.tabs.activeKey})},"aria-label":"Tab actions",className:"absolute right-1 top-0.5 grid h-7 w-6 place-items-center rounded-md text-fg-4 hover:bg-raised hover:text-fg-2",children:ki.jsx(ux,{name:"more",className:"h-4 w-4 rotate-90"})}),t&&ki.jsx(Nx,{x:t.x,y:t.y,onClose:()=>i(null),items:uB(s,t.key,e.tabs)})]})});function uB(e,t,i){const s=e.find(e=>e.key===t),r=e.filter(e=>e.key!==t&&e.closable),n=[];return s&&n.push({kind:"header",label:s.label}),n.push({kind:"item",icon:"x",label:"Close",shortcut:"⌘W",disabled:!(null==s?void 0:s.closable),onSelect:()=>i.close(t)}),n.push({kind:"item",icon:"x",label:"Close Others",disabled:0===r.length,onSelect:()=>i.closeOthers(t)}),n.push({kind:"separator"}),n.push({kind:"item",icon:"trash",label:"Close All",tone:"danger",disabled:e.every(e=>!e.closable),onSelect:()=>i.closeAll()}),n}function dB(e,t){var i;switch(t.kind){case"overview":return"Home";case"scenario":{const i=e.scenarios.items.find(e=>e.path===t.path);return(null==i?void 0:i.name)??t.path}case"helper":{const i=e.helpers.items.find(e=>e.path===t.path);return i?`${i.name}.js`:t.path}case"collection":{const i=e.collections.items.find(e=>e.path===t.path);return(null==i?void 0:i.name)??t.path}case"scenario-run":case"collection-run":{const i=e.runs.items.find(e=>e.runId===t.runId);if(i)return i.ref;const s=e.activeRuns.byRunId.get(t.runId);return(null==s?void 0:s.scenario)||t.runId}case"snapshot":return(null==(i=e.snapshots.manifestOf(t.snapshotId))?void 0:i.scenario)??t.snapshotId}}function fB(e,t){if("scenario-run"===t.kind||"collection-run"===t.kind){const i=e.activeRuns.byRunId.get(t.runId);if(i)switch(i.status){case"starting":case"running":return"running";case"completed":return"passed";case"failed":return"failed";case"aborted":return"aborted"}const s=e.runs.items.find(e=>e.runId===t.runId);return cj(s??null)}return null}const pB="unotest.viewer.";function gB(e,t){var i;try{const s=null==(i=globalThis.localStorage)?void 0:i.getItem(pB+e);return null==s?t:JSON.parse(s)}catch{return t}}function vB(e,t){return t?`${e}.${t}`:e}function mB(e,t){var i;try{null==(i=globalThis.localStorage)||i.setItem(pB+e,JSON.stringify(t))}catch{}}const _B="activityBar.section";class bB{constructor(){this.section=gB(_B,"scenarios"),Wn(this,{},{autoBind:!0})}setSection(e){this.section=e}get storageKey(){return _B}}const xB={fail:"bg-fail text-on-accent",run:"bg-warn text-on-accent",info:"bg-accent text-on-accent"};function yB({children:e,tone:t,pulse:i}){return ki.jsx("span",{className:cx("inline-flex h-[14px] min-w-[14px] items-center justify-center rounded-full px-[3px] font-mono text-[9px] font-semibold tabular-nums",xB[t],i&&"uno-pulse"),children:e})}const wB=[{id:"scenarios",icon:"file",label:"Scenarios",hint:"⌘1"},{id:"helpers",icon:"braces",label:"Helpers",hint:"⌘2"},{id:"collections",icon:"layers",label:"Collections",hint:"⌘3"},{id:"runs",icon:"history",label:"Runs",hint:"⌘4"},{id:"active",icon:"activity",label:"Active",hint:"⌘5"},{id:"variables",icon:"variable",label:"Variables",hint:"⌘6"},{id:"app",icon:"play",label:"App",hint:"⌘7"},{id:"snapshots",icon:"camera",label:"Snapshots",hint:"⌘8"}],SB=__(function(){const e=w_(),t=e.session.capabilities.canTerminal,i=e.overview.failing.length,s=e.activeRuns.activeList.length+e.queue.waiting.length;return ki.jsxs("nav",{className:"relative z-30 flex w-[40px] shrink-0 flex-col items-stretch py-1",children:[wB.map(t=>{const r=t.id===e.activityBar.section&&e.layout.treeOpen,n="runs"===t.id&&i>0?ki.jsx(yB,{tone:"fail",children:i}):"active"===t.id&&s>0?ki.jsx(yB,{tone:"run",pulse:!0,children:s}):null;return ki.jsxs("button",{type:"button","aria-label":"runs"===t.id&&i>0?`${t.label} — ${i} ${1===i?"test":"tests"} failing now`:t.label,onClick:()=>{t.id===e.activityBar.section&&e.layout.treeOpen?e.layout.toggleTree():(e.activityBar.setSection(t.id),e.layout.openTree())},className:cx("group relative mx-1 my-0.5 grid place-items-center rounded py-2",r?"bg-panel text-fg":"text-fg-3 hover:bg-panel/70 hover:text-fg-2"),children:[ki.jsxs("span",{className:"relative",children:[ki.jsx(ux,{name:t.icon,className:"h-[18px] w-[18px]"}),n&&ki.jsx("span",{className:"absolute -right-2 -top-1.5",children:n})]}),ki.jsx(Mj,{label:t.label,hint:t.hint,placement:"right"})]},t.id)}),ki.jsxs("button",{type:"button","aria-label":"Terminal",disabled:!t,onClick:()=>e.terminal.toggle(),className:cx("group relative mx-1 mt-auto my-0.5 grid place-items-center rounded py-2",t?e.terminal.open?"bg-panel text-fg":"text-fg-3 hover:bg-panel/70 hover:text-fg-2":cx("text-fg-3",xj)),children:[ki.jsx(ux,{name:"terminal",className:"h-[18px] w-[18px]"}),ki.jsx(Mj,{label:"Terminal",hint:t?"⌃`":bj,placement:"right"})]})]})}),kB=gi.createContext(()=>{});function CB({trigger:e,header:t,children:i,align:s="left",disabled:r=!1,title:n,menuWidth:o="w-72"}){const[a,l]=gi.useState(!1),c=gi.useRef(null);return jx(c,()=>l(!1)),ki.jsxs("div",{ref:c,className:"relative flex items-stretch",children:[ki.jsx("button",{type:"button",onClick:()=>!r&&l(e=>!e),title:n,className:cx("flex items-center gap-1.5 rounded-sm px-2 font-mono text-[11px] transition-colors",!r&&"hover:bg-raised hover:text-fg",a&&"bg-raised text-fg"),children:e}),a&&ki.jsxs("div",{className:cx("absolute bottom-full z-50 mb-1 overflow-hidden rounded-md border border-edge-soft bg-overlay shadow-lg","right"===s?"right-0":"left-0",o),children:[ki.jsx("div",{className:"border-b border-edge-soft px-3 py-1.5 font-mono text-[10px] uppercase tracking-wider text-fg-4",children:t}),ki.jsx(kB.Provider,{value:()=>l(!1),children:i})]})]})}function jB({icon:e,leadingDot:t,label:i,sublabel:s,note:r,active:n,disabled:o=!1,title:a,onSelect:l}){const c=gi.useContext(kB);return ki.jsxs("button",{type:"button",disabled:o,title:a,onClick:o?void 0:()=>{l(),c()},className:cx("flex w-full items-center gap-2.5 px-3 py-2 text-left transition-colors",o?"cursor-not-allowed opacity-60":n?"bg-raised/60":"hover:bg-raised/60"),children:[e&&ki.jsx(ux,{name:e,className:"h-4 w-4 shrink-0 text-fg-3"}),ki.jsxs("div",{className:"min-w-0 flex-1",children:[ki.jsxs("div",{className:"flex items-center gap-1.5",children:[t&&ki.jsx("span",{className:cx("h-1.5 w-1.5 rounded-full",t)}),ki.jsx("span",{className:"font-mono text-[13px] text-fg",children:i})]}),s&&ki.jsx("div",{className:"truncate text-[11px] text-fg-4",children:s}),r&&ki.jsx("div",{className:"mt-1 text-[10.5px] leading-snug text-warn",children:r})]}),n&&!o&&ki.jsx("span",{className:"font-mono text-[10px] uppercase tracking-wider text-accent",children:"current"})]})}const NB={web:{icon:"globe",dot:"bg-accent",blurb:"Playwright via @unotest/web"},mobile:{icon:"phone",dot:"bg-accent",blurb:"iOS + Android via @unotest/mobile"},unity:{icon:"cube",dot:"bg-accent",blurb:"Unity in-editor via @unotest/unity"}};function MB(e){return NB[e]??{icon:"target",dot:"bg-fg-4",blurb:""}}const EB=__(function(){return ki.jsxs("div",{className:"flex h-5 shrink-0 items-stretch px-2 text-fg-3",children:[ki.jsx(BB,{}),ki.jsx(DB,{}),ki.jsx(LB,{}),ki.jsxs("div",{className:"ml-auto flex items-stretch gap-1",children:[ki.jsx(RB,{}),ki.jsx(TB,{}),ki.jsxs("span",{className:"flex items-center px-1 font-mono text-[10px] text-fg-4",children:["v","0.27.0"]})]})]})}),BB=__(function(){const{targets:e}=w_();if(0===e.available.length)return null;const t=e.active,i=MB(t);return ki.jsx(CB,{header:"test target",align:"left",disabled:!e.hasMultiple,title:i.blurb?`Target: ${t} — ${i.blurb}`:`Target: ${t}`,trigger:ki.jsxs(ki.Fragment,{children:[ki.jsx("span",{className:cx("h-1.5 w-1.5 rounded-full",i.dot)}),ki.jsx(ux,{name:i.icon,className:"h-3.5 w-3.5",strokeWidth:1.75}),ki.jsx("span",{className:"truncate",children:t||"—"})]}),children:e.available.map(t=>ki.jsx(PB,{info:t,active:t.target===e.active,onSelect:()=>{e.setActive(t.target)}},t.target))})}),DB=__(function(){const{environments:e}=w_();if(!e.hasAny)return null;const t=e.active??"base";return ki.jsxs(CB,{header:"environment",align:"left",title:e.active?`Environment: ${e.active} — .env.${e.active} overlay + .runs.${e.active} history`:"Environment: base — unotest/.env, unotest/.runs",trigger:ki.jsxs(ki.Fragment,{children:[ki.jsx(ux,{name:"layers",className:"h-3.5 w-3.5",strokeWidth:1.75}),ki.jsx("span",{className:"truncate",children:t})]}),children:[ki.jsx(jB,{label:"base",sublabel:"unotest/.env — no overlay",active:null===e.active,onSelect:()=>{e.setActive(null)}}),e.names.map(t=>ki.jsx(jB,{label:t,sublabel:`.env.${t} overlay · .runs.${t} history`,active:e.active===t,onSelect:()=>{e.setActive(t)}},t))]})}),LB=__(function(){const{workspace:e}=w_(),t=e.file;if(!t)return null;const i=e.current,s=t.switchedBy?` · switched by ${t.switchedBy}`:"";return ki.jsxs(CB,{header:"test bundle",align:"left",menuWidth:"w-80",disabled:e.switching,title:i?`Bundle ${i.label} — pushed ${i.author?`by ${i.author}`:"to this box"}, running @unotest/web ${i.webVersion}${s}`:`${t.workspace}: nothing has been pushed to this environment yet`,trigger:ki.jsxs(ki.Fragment,{children:[ki.jsx(ux,{name:"package",className:"h-3.5 w-3.5",strokeWidth:1.75}),ki.jsx("span",{className:"truncate",children:e.label}),(null==i?void 0:i.dirty)&&ki.jsx("span",{className:"text-warn",children:"wip"}),e.switching&&ki.jsx("span",{className:"text-fg-4",children:"switching…"})]}),children:[0===t.bundles.length&&ki.jsxs("div",{className:"px-2 py-1.5 text-[11px] text-fg-4",children:["Nothing pushed yet — send this suite with",ki.jsx("span",{className:"font-mono",children:" npx @unotest/web bundle push"}),"."]}),t.bundles.map(i=>ki.jsx(jB,{label:i.label,sublabel:[i.author,`web ${i.webVersion}`,new Date(i.createdAt).toLocaleString()].filter(Boolean).join(" · "),active:i.bundleId===t.currentBundleId,onSelect:()=>{e.canSwitch&&e.switchTo(i.bundleId)}},i.bundleId)),!t.allowSwitch&&ki.jsx("div",{className:"px-2 py-1.5 text-[11px] text-fg-4",children:"This environment follows its branch — switching is disabled for it."}),e.error&&ki.jsx("div",{className:"px-2 py-1.5 text-[11px] text-danger",children:e.error})]})}),RB=__(function(){const{session:e}=w_(),t=e.identity;if(!t)return null;const i=t.env?`${t.role} · ${t.env}`:t.role;return ki.jsx(CB,{header:"session",align:"right",menuWidth:"w-60",disabled:!t.logoutUrl,title:`Signed in as ${t.user} (${i})`,trigger:ki.jsxs(ki.Fragment,{children:[ki.jsx(ux,{name:"user",className:"h-3.5 w-3.5",strokeWidth:1.75}),ki.jsx("span",{className:"truncate",children:t.user}),ki.jsx("span",{className:"text-fg-4",children:i})]}),children:t.logoutUrl&&ki.jsx(jB,{icon:"externalL",label:"log out",sublabel:"End this session and return to the login page",active:!1,onSelect:()=>function(e){const t=document.createElement("form");t.method="post",t.action=e,document.body.appendChild(t),t.submit()}(t.logoutUrl)})})});function PB({info:e,active:t,onSelect:i}){var s,r;const n=MB(e.target),o=!!e.host&&!e.host.ok;return ki.jsx(jB,{icon:n.icon,leadingDot:n.dot,label:e.target,sublabel:n.blurb||e.name,note:o?null==(s=e.host)?void 0:s.reason:void 0,active:t,disabled:o,title:o?null==(r=e.host)?void 0:r.reason:void 0,onSelect:i})}const AB=[{mode:"light",icon:"sun",label:"light",blurb:"Always light"},{mode:"dark",icon:"moon",label:"dark",blurb:"Always dark"},{mode:"system",icon:"monitor",label:"system",blurb:"Follow OS appearance"}],TB=__(function(){const{theme:e}=w_(),t=AB.find(t=>t.mode===e.mode)??AB[2];return ki.jsx(CB,{header:"theme",align:"right",menuWidth:"w-60",title:`Theme: ${t.label}`,trigger:ki.jsxs(ki.Fragment,{children:[ki.jsx(ux,{name:t.icon,className:"h-3.5 w-3.5",strokeWidth:1.75}),ki.jsx("span",{className:"truncate",children:t.label})]}),children:AB.map(t=>ki.jsx(jB,{icon:t.icon,label:t.label,sublabel:t.blurb,active:t.mode===e.mode,onSelect:()=>e.set(t.mode)},t.mode))})}),zB=__(function(){const e=w_(),t=e.targets.current,i=null==t?void 0:t.host;if(!t||!i)return null;if(!i.ok)return ki.jsx(FB,{tone:"block",icon:"alert",title:`${t.target} isn’t available on this OS`,children:i.reason&&ki.jsx("p",{className:"text-fg-2",children:i.reason})});const s=e.targetDoctor,r=s.checkedTarget===t.target?s.checks:null,n=null!==r&&!s.hasErrors;return ki.jsxs(FB,{tone:n?"ok":"setup",icon:n?"check":"inspect",title:n?`${t.target} environment ready`:`Set up ${t.target}`,action:ki.jsx("button",{type:"button",onClick:()=>{s.run(t.target)},disabled:s.busy,className:cx("shrink-0 rounded border px-3 py-1 font-mono text-[11px] transition-colors","border-edge-soft hover:bg-raised",s.busy&&"cursor-wait opacity-60"),children:s.busy?"Checking…":r?"Re-check":"Check"}),children:[ki.jsx("p",{className:"text-fg-2",children:n?"All checks passed — you can run scenarios for this target.":`${t.name} needs a local toolchain it can't bundle. Install it, then verify here.`}),s.error&&ki.jsx("p",{className:"mt-2 font-mono text-[11px] text-fail",children:s.error}),r&&r.length>0&&ki.jsx("ul",{className:"mt-2 space-y-1.5",children:r.map(e=>ki.jsxs("li",{className:"flex items-start gap-2 text-[12px]",children:[ki.jsx("span",{className:cx("mt-[5px] h-1.5 w-1.5 shrink-0 rounded-full",OB(e.severity))}),ki.jsxs("span",{className:"min-w-0",children:[ki.jsx("span",{className:"text-fg",children:e.name}),ki.jsxs("span",{className:"text-fg-2",children:[" — ",e.message]}),e.detail&&ki.jsx("span",{className:"mt-0.5 block text-[11px] text-fg-3",children:e.detail})]})]},e.name))})]})});function OB(e){return"ok"===e?"bg-pass":"warning"===e?"bg-warn":"bg-fail"}const IB={setup:"border-warn/40 bg-warn/5",ok:"border-pass/40 bg-pass/5",block:"border-fail/40 bg-fail/5"};function FB({tone:e,icon:t,title:i,action:s,children:r}){return ki.jsx("div",{className:cx("shrink-0 border-b px-4 py-3 text-[13px]",IB[e]),children:ki.jsxs("div",{className:"flex items-start justify-between gap-3",children:[ki.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[ki.jsx(ux,{name:t,className:"mt-0.5 h-4 w-4 shrink-0 text-fg-2"}),ki.jsxs("div",{className:"min-w-0",children:[ki.jsx("div",{className:"font-medium text-fg",children:i}),r]})]}),s]})})}function HB({children:e}){return ki.jsx("kbd",{className:"inline-flex h-[18px] min-w-[18px] items-center justify-center rounded border border-edge-soft bg-raised px-1 font-mono text-[10px] font-medium uppercase tracking-wider text-fg-3",children:e})}function WB(e){return{paddingLeft:8+22*e}}function KB(e){return{paddingLeft:8+22*e+22}}function UB({children:e,onClick:t,onContextMenu:i,active:s,indent:r=!1,depth:n,leaf:o=!1,danger:a=!1,ariaLabel:l}){const c=void 0===n?void 0:o?KB(n):WB(n);return ki.jsx("button",{type:"button","aria-label":l,onClick:t,onContextMenu:i,style:c,className:cx("flex w-full items-center gap-2 px-2 py-1 text-left",void 0===n&&r&&"pl-7",s?"bg-selection text-fg":"hover:bg-raised/60",a&&"text-fail"),children:e})}const qB=__(function({query:e}){const t=w_(),i=gi.useMemo(()=>{const i=e.trim().toLowerCase(),s=(e,t)=>!i||e.toLowerCase().includes(i)||t.toLowerCase().includes(i),r=t.activeRuns.activeList.filter(e=>s(e.scenario,e.runId)).map(e=>{const t=e.events.filter(e=>"step:started"===e.kind).length,i=e.events.filter(e=>"step:ok"===e.kind||"step:fail"===e.kind).length,s=0===t?.05:Math.min(.95,i/Math.max(t,1));return{kind:"scenario",runId:e.runId,ref:e.scenario||e.runId,startedAt:e.startedAt,progress:s}}),n=t.activeRuns.activeCollectionList.filter(e=>s(e.collection,e.runId)).map(e=>{const t=e.scenarios.length||1,i=e.childOutcomes.size,s=Math.min(.95,i/t);return{kind:"collection",runId:e.runId,ref:e.collection||e.runId,startedAt:e.startedAt,progress:Math.max(.05,s),done:i,total:e.scenarios.length}});return n.sort((e,t)=>t.startedAt-e.startedAt),r.sort((e,t)=>t.startedAt-e.startedAt),[...n,...r]},[t.activeRuns.activeList,t.activeRuns.activeCollectionList,e]),s=t.queue.waiting.filter(t=>!e.trim()||t.ticket.ref.toLowerCase().includes(e.trim().toLowerCase()));return ki.jsxs("div",{className:"py-1",children:[s.length>0&&ki.jsxs("div",{className:"mb-1 border-b border-edge pb-1",children:[ki.jsxs("div",{className:"px-2 py-1 font-mono text-[10.5px] uppercase tracking-wide text-fg-4",children:["queued · ",t.queue.slots.used,"/",t.queue.slots.total," slot",1===t.queue.slots.total?"":"s"," busy"]}),s.map(e=>ki.jsxs("div",{className:"flex w-full items-center gap-2 px-2 py-1 hover:bg-raised/60",children:[ki.jsx(nj,{status:"pending"}),ki.jsxs("div",{className:"min-w-0 flex-1",children:[ki.jsx("div",{className:"truncate font-mono text-[12.5px] text-fg-2",children:e.ticket.ref}),ki.jsxs("div",{className:"mt-0.5 truncate font-mono text-[10.5px] text-fg-4",children:["collection"===e.ticket.kind?"collection · ":"",e.ticket.ci?`${rb(e.ticket.ci)} · `:"",e.ticket.producer.kind," · waiting since"," ",aj(e.ticket.createdAt)]})]}),ki.jsx("button",{type:"button",title:"take this run out of the queue","aria-label":`cancel queued ${e.ticket.ref}`,onClick:()=>{t.queue.cancel(e.name)},className:"rounded p-1 text-fg-4 hover:bg-raised hover:text-fail",children:ki.jsx(ux,{name:"x",className:"h-3.5 w-3.5"})})]},e.name))]}),i.map(e=>ki.jsxs(UB,{onClick:()=>t.tabs.open("collection"===e.kind?{kind:"collection-run",runId:e.runId}:{kind:"scenario-run",runId:e.runId}),children:["collection"===e.kind?ki.jsx(ux,{name:"layers",className:"h-3.5 w-3.5 text-fg-3"}):ki.jsx(nj,{status:"running"}),ki.jsxs("div",{className:"min-w-0 flex-1",children:[ki.jsxs("div",{className:"flex items-center gap-1.5",children:[ki.jsx("span",{className:"truncate font-mono text-[12.5px] text-fg-2",children:e.ref}),"collection"===e.kind&&ki.jsx(ij,{size:"xs",tone:"info",children:"col"})]}),ki.jsx("div",{className:cx("mt-1 h-1 overflow-hidden rounded bg-raised"),children:ki.jsx("div",{className:"h-full bg-warn uno-pulse",style:{width:100*e.progress+"%"}})}),ki.jsx("div",{className:"mt-0.5 truncate font-mono text-[10.5px] text-fg-4",children:"collection"===e.kind?`${e.done}/${e.total} done · started ${aj(e.startedAt)}`:`started ${aj(e.startedAt)}`})]})]},e.runId)),0===i.length&&0===s.length&&ki.jsx(IN,{children:"nothing running"})]})}),$B=__(function({title:e,extensions:t,onPick:i,onClose:s}){const r=w_(),[n,o]=gi.useState(null),[a,l]=gi.useState(null),c=e=>{r.appServer.browse(e,t).then(e=>{o(e),l(null)}).catch(e=>{l(e instanceof Error?e.message:String(e))})};gi.useEffect(()=>{c()},[]);return ki.jsx("div",{className:"fixed inset-0 z-50 grid place-items-center bg-black/40",onClick:s,children:ki.jsxs("div",{className:"flex h-[420px] w-[520px] flex-col rounded-lg border border-edge-soft bg-overlay shadow-xl",onClick:e=>e.stopPropagation(),children:[ki.jsxs("div",{className:"flex items-center gap-2 border-b border-edge-soft px-3 py-2",children:[ki.jsx("span",{className:"font-mono text-[12px] text-fg",children:e}),ki.jsx("span",{className:"truncate font-mono text-[10.5px] text-fg-4",children:(null==n?void 0:n.path)||"select a location"}),ki.jsx("button",{type:"button",onClick:s,className:"ml-auto grid h-5 w-5 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fg-2",children:ki.jsx(ux,{name:"x",className:"h-3.5 w-3.5"})})]}),ki.jsxs("div",{className:"flex-1 overflow-y-auto py-1",children:[a&&ki.jsx("div",{className:"px-3 py-1 font-mono text-[11px] text-fail",children:a}),n&&""!==n.path&&ki.jsxs("button",{type:"button",onClick:()=>c(n.parent??void 0),className:"flex h-7 w-full items-center gap-2 px-3 font-mono text-[11.5px] text-fg-3 hover:bg-raised/60",children:[ki.jsx(ux,{name:"chevronR",className:"h-3.5 w-3.5 rotate-180"}),".."]}),null==n?void 0:n.entries.map(e=>ki.jsxs("button",{type:"button",onClick:()=>(e=>{"dir"===e.kind?c(e.path):i(e.path)})(e),className:cx("flex h-7 w-full items-center gap-2 truncate px-3 font-mono text-[11.5px] hover:bg-raised/60","dir"===e.kind?"text-fg":"text-accent"),children:[ki.jsx(ux,{name:"dir"===e.kind?"folder":"file",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),ki.jsx("span",{className:"truncate",children:e.name}),"dir"!==e.kind&&ki.jsx("span",{className:"ml-auto rounded bg-accent/10 px-1 font-mono text-[9px] uppercase text-accent",children:"select"})]},e.path)),n&&0===n.entries.length&&!a&&ki.jsx("div",{className:"px-3 py-2 font-mono text-[11px] text-fg-4",children:"nothing matching here"})]})]})})}),VB={stopped:{label:"stopped",dot:"bg-fg-4"},starting:{label:"starting…",dot:"bg-warn animate-pulse"},running:{label:"running",dot:"bg-pass"},external:{label:"running (external)",dot:"bg-pass"},error:{label:"error",dot:"bg-fail"}},YB=__(function({query:e}){var t;const i=w_(),s=i.appServer;gi.useEffect(()=>{s.load(),i.variables.load()},[s,i.variables]);const{status:r}=s;if(!r.available&&"stopped"===r.state)return ki.jsxs(IN,{children:['target "',i.targets.active,'" has no app-server capability']});const n=VB[r.state],o=r.available&&("stopped"===r.state||"error"===r.state),a="running"===r.state||"starting"===r.state,l=i.session.capabilities.canRun,c=e.trim().toLowerCase(),h=c?r.log.filter(e=>e.toLowerCase().includes(c)):r.log;return ki.jsxs("div",{className:"flex h-full flex-col",children:[ki.jsxs("div",{className:"border-b border-edge-soft px-3 py-2",children:[ki.jsxs("div",{className:"flex items-center gap-2",children:[ki.jsx("span",{className:cx("h-2 w-2 shrink-0 rounded-full",n.dot)}),ki.jsx("span",{className:"font-mono text-[11.5px] text-fg-2",children:n.label}),r.target&&r.target!==i.targets.active&&ki.jsx("span",{className:"rounded bg-raised px-1 font-mono text-[9px] uppercase tracking-wide text-fg-3",children:r.target}),ki.jsxs("span",{className:"ml-auto flex gap-1",children:[o&&l&&ki.jsx("button",{type:"button",disabled:s.busy,onClick:()=>{s.start()},className:"rounded bg-accent px-2 py-0.5 font-mono text-[11px] text-on-accent hover:bg-accent-hover disabled:opacity-50",children:"Start"}),a&&l&&ki.jsx("button",{type:"button",disabled:s.busy,onClick:()=>{s.stop()},className:"rounded bg-raised px-2 py-0.5 font-mono text-[11px] text-fg-2 hover:text-fg",children:"Stop"})]})]}),r.url&&ki.jsx("a",{href:r.url,target:"_blank",rel:"noreferrer",className:"mt-1 block truncate font-mono text-[11px] text-accent hover:underline",children:r.url}),r.detail&&ki.jsx("div",{className:"mt-1 font-mono text-[10.5px] text-fg-3",children:r.detail}),"external"===r.state&&ki.jsx("div",{className:"mt-1 font-mono text-[10.5px] text-fg-4",children:"already served by another process — runs reuse it"}),(s.error??r.message)&&ki.jsx("div",{className:"mt-1 font-mono text-[11px] text-fail",children:s.error??r.message}),null==(t=r.pickers)?void 0:t.map(e=>ki.jsx(GB,{picker:e},e.envKey))]}),ki.jsx("div",{className:"flex-1 overflow-y-auto px-3 py-1",children:0===h.length?ki.jsx(IN,{children:"no output yet"}):h.map((e,t)=>ki.jsx("div",{className:"whitespace-pre-wrap break-all font-mono text-[10.5px] leading-4 text-fg-2",children:e},t))})]})}),GB=__(function({picker:e}){const t=w_().variables,i=t.rows.find(t=>"env"===t.source&&t.key===e.envKey),s=i?t.effectiveValue(i):"",[r,n]=gi.useState(null),[o,a]=gi.useState(!1),[l,c]=gi.useState(!1),h=r??s,u=null!==r&&r!==s,d=async()=>{if(u&&!l){c(!0);try{i?(t.setValue(i,h),await t.save()):await t.addVariable(e.envKey,h,"app"),n(null)}finally{c(!1)}}};return ki.jsxs("div",{className:"mt-2",children:[ki.jsxs("div",{className:"mb-0.5 flex items-center gap-1 font-mono text-[10.5px] text-fg-3",children:[e.label,ki.jsx("span",{className:"text-fg-4",children:e.envKey})]}),ki.jsxs("div",{className:"flex items-center gap-1",children:[ki.jsx("input",{type:"text",value:h,spellCheck:!1,placeholder:`/path/to/your${e.extensions[0]??""}`,onChange:e=>n(e.target.value),onKeyDown:e=>"Enter"===e.key&&void d(),className:"h-6 w-full rounded border border-edge-soft bg-canvas px-1.5 font-mono text-[11px] text-fg placeholder:text-fg-4 focus:border-accent focus:outline-none focus:ring-2 focus:ring-accent/20"}),ki.jsx("button",{type:"button",title:"Browse…",onClick:()=>a(!0),className:"grid h-6 w-7 shrink-0 place-items-center rounded border border-edge-soft text-fg-4 hover:bg-raised hover:text-fg",children:ki.jsx(ux,{name:"folder",className:"h-3.5 w-3.5"})}),u&&ki.jsx("button",{type:"button",disabled:l,onClick:()=>{d()},className:"rounded bg-accent px-2 py-0.5 font-mono text-[11px] text-on-accent hover:bg-accent-hover disabled:opacity-50",children:"Save"})]}),o&&ki.jsx($B,{title:e.label,extensions:e.extensions,onPick:e=>{n(e),a(!1)},onClose:()=>a(!1)})]})}),XB=__(function({query:e}){const t=w_(),i=t.collections.items,[s,r]=gi.useState(!1),[n,o]=gi.useState(null),a=t.session.capabilities.canEditFiles,l=gi.useMemo(()=>{const t=e.trim().toLowerCase();return i.filter(e=>!t||e.name.toLowerCase().includes(t))},[i,e]);return ki.jsxs("div",{className:"py-1",children:[s?ki.jsx(JB,{existingNames:i.map(e=>e.name.toLowerCase()),onCommit:async e=>{const i=await t.collections.create(e);i&&(r(!1),t.tabs.open({kind:"collection",path:i.path}))},onCancel:()=>r(!1)}):a?ki.jsxs("button",{type:"button",onClick:()=>r(!0),className:"mx-2 my-1 flex w-[calc(100%-1rem)] items-center justify-center gap-1.5 rounded border border-dashed border-edge-soft px-2 py-1.5 font-mono text-[11.5px] text-fg-4 hover:border-accent hover:bg-accent/10 hover:text-accent",children:[ki.jsx(ux,{name:"plus",className:"h-3.5 w-3.5"})," new collection"]}):null,l.map(e=>{const i=t.runs.lastRunByRef("collection",e.name),s=t.schedules.get("collection",e.name);return ki.jsxs(UB,{onClick:()=>t.tabs.open({kind:"collection",path:e.path}),onContextMenu:t=>{t.preventDefault(),o({x:t.clientX,y:t.clientY,name:e.name})},children:[ki.jsx(ux,{name:"layers",className:"h-3.5 w-3.5 text-fg-3"}),ki.jsxs("div",{className:"min-w-0 flex-1",children:[ki.jsxs("div",{className:"flex items-center gap-1.5",children:[ki.jsx("span",{className:"truncate font-mono text-[12.5px] text-fg-2",children:e.name}),s&&ki.jsx("span",{title:Wj(s),children:ki.jsx(ux,{name:"clock",className:"h-3 w-3 shrink-0 text-fg-4"})})]}),ki.jsxs("div",{className:"mt-0.5 truncate font-mono text-[10.5px] text-fg-4",children:[e.scenarios.length," scenarios ·"," ",i?aj(i.startedAt):"never run"]})]})]},e.path)}),0===l.length&&!s&&ki.jsx(IN,{children:"no collections match"}),n&&ki.jsx(Nx,{x:n.x,y:n.y,items:[{kind:"header",label:n.name},{kind:"item",icon:"clock",label:(()=>{const e=t.schedules.get("collection",n.name);return e?`Schedule · ${wb(e.cron)}`:"Schedule…"})(),disabled:!a,onSelect:()=>t.schedules.openEditor({kind:"collection",name:n.name})}],onClose:()=>o(null)})]})});function JB({existingNames:e,onCommit:t,onCancel:i}){const[s,r]=gi.useState(""),n=gi.useRef(null),o=gi.useRef(null);gi.useEffect(()=>{var e;null==(e=n.current)||e.focus()},[]);const a=s.trim(),l=a.length>0?Ub(a):null,c=a.length>0&&e.includes(a.toLowerCase())?`"${a}" already exists`:l||null,h=a.length>0&&!c;return ki.jsxs("form",{ref:o,onSubmit:e=>{e.preventDefault(),h&&t(a)},className:"mx-2 my-1",children:[ki.jsxs("div",{className:cx("flex h-[30px] items-center gap-1.5 rounded border bg-canvas px-2 ring-2",c?"border-fail ring-fail/20":"border-accent ring-accent/20"),children:[ki.jsx(ux,{name:"layers",className:"h-3.5 w-3.5 shrink-0 text-accent"}),ki.jsx("input",{ref:n,value:s,onChange:e=>r(e.target.value),onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),i())},onBlur:e=>{o.current&&e.relatedTarget&&o.current.contains(e.relatedTarget)||a||i()},spellCheck:!1,autoComplete:"off",placeholder:"collection name…",className:"min-w-0 flex-1 bg-transparent font-mono text-[12.5px] text-fg placeholder-fg-4 outline-none"}),ki.jsx("button",{type:"button",onMouseDown:e=>e.preventDefault(),onClick:i,title:"Cancel (esc)",className:"grid h-5 w-5 shrink-0 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fg-2",children:ki.jsx(ux,{name:"x",className:"h-3 w-3",strokeWidth:2.25})}),ki.jsx("button",{type:"submit",disabled:!h,onMouseDown:e=>e.preventDefault(),title:"Create (↵)",className:cx("grid h-5 w-5 shrink-0 place-items-center rounded",h?"text-accent hover:bg-accent/10 hover:text-accent-hover":"cursor-default text-fg-4"),children:ki.jsx(ux,{name:"check",className:"h-3.5 w-3.5",strokeWidth:2.5})})]}),ki.jsx("div",{className:cx("mt-1 flex items-center gap-1 px-1 font-mono text-[10px]",c?"text-fail":"text-fg-4"),children:c?ki.jsxs(ki.Fragment,{children:[ki.jsx(ux,{name:"alert",className:"h-3 w-3"})," ",c]}):ki.jsx(ki.Fragment,{children:"↵ create · esc cancel"})})]})}const ZB=__(function({query:e}){const t=w_(),i=t.helpers.items,s=gi.useMemo(()=>{const t=e.trim().toLowerCase();return i.filter(e=>!t||e.name.toLowerCase().includes(t))},[i,e]);return ki.jsxs("div",{className:"py-1",children:[ki.jsxs("div",{className:"flex h-7 items-center gap-1 px-2 text-fg-4",children:[ki.jsx(ux,{name:"chevronD",className:"h-3.5 w-3.5 text-fg-4"}),ki.jsx("span",{className:"font-mono text-[11px] uppercase tracking-wider",children:"_helpers"}),ki.jsx("span",{className:"ml-auto font-mono text-[10.5px] text-fg-4",children:s.length})]}),s.map(e=>ki.jsxs(UB,{indent:!0,onClick:()=>t.tabs.open({kind:"helper",path:e.path}),children:[ki.jsx(ux,{name:"braces",className:"h-3.5 w-3.5 text-fg-3"}),ki.jsxs("div",{className:"min-w-0 flex-1",children:[ki.jsxs("div",{className:"truncate font-mono text-[12.5px] text-fg-2",children:[e.name,".js"]}),ki.jsx("div",{className:"mt-0.5 truncate font-mono text-[10.5px] text-fg-4",children:e.path})]})]},e.path)),0===s.length&&ki.jsx(IN,{children:"no helpers match"})]})});function QB(e){switch(e.kind){case"collection":return`col:${e.run.runId}`;case"repeats":return`rep:${e.runs[0].runId}`;case"run":return`run:${e.run.runId}`}}function eD(e,t={}){const i=t.now??Date.now(),s=t.flat?e.map(e=>({kind:"run",run:e})):function(e){const t=new Map;for(const s of e)"collection"===s.kind&&t.set(s.runId,{kind:"collection",run:s,children:[],passed:0,failed:0});const i=[];for(const s of e){if("collection"===s.kind){i.push(t.get(s.runId));continue}const e=s.parentRunId?t.get(s.parentRunId):void 0;e?(e.children.push(s),"passed"===s.status?e.passed++:"failed"!==s.status&&"interrupted"!==s.status||e.failed++):i.push({kind:"run",run:s})}return i}(e),r=[];let n=null;for(const o of s){const{startedAt:e}=o.run,s=iD(e);n&&n.key===s||(n={key:s,label:sD(e,i),entries:[]},r.push(n)),tD(n.entries,o,!0===t.flat)}return r}function tD(e,t,i){if(i||"run"!==t.kind)return void e.push(t);const s=e[e.length-1];"repeats"!==(null==s?void 0:s.kind)||s.ref!==t.run.ref?"run"!==(null==s?void 0:s.kind)||s.run.ref!==t.run.ref?e.push(t):e[e.length-1]={kind:"repeats",ref:t.run.ref,runs:[s.run,t.run]}:s.runs.push(t.run)}function iD(e){const t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function sD(e,t){const i=iD(e);return i===iD(t)?"Today":i===iD(t-864e5)?"Yesterday":new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric",...new Date(e).getFullYear()===new Date(t).getFullYear()?{}:{year:"numeric"}})}const rD="scenario";function nD({chevron:e,status:t,icon:i}){return ki.jsxs(ki.Fragment,{children:[ki.jsx("span",{className:"flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:void 0!==e&&ki.jsx(ux,{name:"open"===e?"chevronD":"chevronR",className:"h-3.5 w-3.5 text-fg-4"})}),ki.jsx("span",{className:"flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:void 0!==t?ki.jsx(nj,{status:t}):void 0!==i&&ki.jsx(ux,{name:i,className:"h-3.5 w-3.5 text-fg-4"})})]})}const oD=__(function(){const e=w_(),t=e.overview.failing;return 0===t.length?null:ki.jsxs("div",{className:"mb-1 border-b border-edge-soft pb-1",children:[ki.jsxs("div",{className:"flex items-center gap-1.5 px-3 pb-0.5 pt-2",children:[ki.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fail",children:"Failing now"}),ki.jsxs("span",{className:"font-mono text-[10.5px] text-fg-4",children:["· ",t.length," ",1===t.length?"test":"tests"]})]}),t.map(t=>ki.jsxs(UB,{depth:0,ariaLabel:`${t.ref} — failing, ${aD(t.failStreak)}, last run ${aj(t.lastAt)}`,onClick:()=>{e.runs.setScenarioFilter(t.ref)},children:[ki.jsx(nD,{status:"failed"}),ki.jsx("span",{className:"truncate font-mono text-[11px] text-fg-2",children:t.ref}),ki.jsxs("span",{className:"ml-auto shrink-0 font-mono text-[10px] text-fg-4",children:[aj(t.lastAt)," · ",aD(t.failStreak)]})]},t.ref))]})});function aD(e){return 1===e?"red 1 run":`red ${e} runs`}function lD({runs:e}){const t=e.slice(0,20).slice().reverse();if(t.length<2)return null;const i=t.map(e=>e.durationMs??0),s=Math.max(...i,1),r=t.filter(e=>"failed"===e.status||"interrupted"===e.status).length;return ki.jsxs("div",{className:"mx-2 mb-1 rounded border border-edge-soft px-2 py-1.5",children:[ki.jsx("div",{className:"flex items-end gap-[2px]","aria-label":`Last ${t.length} runs: ${t.length-r} passed, ${r} failed`,role:"img",children:t.map(e=>ki.jsx("span",{title:`${e.status} · ${oj(e.durationMs)}`,style:{height:`${Math.max(3,Math.round((e.durationMs??0)/s*18))}px`},className:cx("w-[5px] shrink-0 rounded-[1px]","passed"===e.status?"bg-pass":"failed"===e.status||"interrupted"===e.status?"bg-fail":"bg-fg-4")},e.runId))}),ki.jsxs("div",{className:"mt-1 flex items-center justify-between font-mono text-[9.5px] text-fg-4",children:[ki.jsxs("span",{children:["last ",t.length," · ",r," failed"]}),ki.jsxs("span",{children:["up to ",oj(s)]})]})]})}const cD=__(function({query:e}){var t;const i=w_(),[s,r]=gi.useState("all"),[n,o]=gi.useState(new Set),a=i.runs.scenarioFilter,l=gi.useRef(!1);gi.useEffect(()=>{const e=function(e){const t=new URLSearchParams(e).get(rD);return t&&""!==t.trim()?t:null}(window.location.search);e&&i.runs.setScenarioFilter(e),l.current=!0},[i]),gi.useEffect(()=>{l.current&&window.history.replaceState(null,"",function(e,t){const i=new URL(e,"http://localhost");return t?i.searchParams.set(rD,t):i.searchParams.delete(rD),`${i.pathname}${i.search}${i.hash}`}(`${window.location.pathname}${window.location.search}${window.location.hash}`,a))},[a]);const c=e=>{i.runs.setScenarioFilter(e)},h=i.workspace.hosted?(null==(t=i.workspace.file)?void 0:t.currentBundleId)??null:null,[u,d]=gi.useState(!1),f=gi.useMemo(()=>{const t=e.trim().toLowerCase();return i.runs.items.filter(e=>("failed"!==s||"failed"===e.status)&&(("passed"!==s||"passed"===e.status)&&((!u||null===h||e.bundleId===h)&&(!t||e.ref.toLowerCase().includes(t)))))},[i.runs.items,e,s,u,h]),p=gi.useMemo(()=>eD(f,{flat:null!==a}),[f,a]),g=e=>i.tabs.open("collection"===e.kind?{kind:"collection-run",runId:e.runId}:{kind:"scenario-run",runId:e.runId});return ki.jsxs("div",{className:"py-1",children:[a?ki.jsx(hD,{ref_:a,onClear:()=>c(null)}):ki.jsx("div",{className:"mx-2 mb-1 grid grid-cols-3 overflow-hidden rounded border border-edge-soft",children:["all","failed","passed"].map(e=>ki.jsx("button",{type:"button",onClick:()=>r(e),className:cx("py-1 font-mono text-[10.5px] uppercase tracking-wider",s===e?"bg-raised text-fg":"text-fg-3 hover:bg-raised/60"),children:"failed"===e?"failed runs":e},e))}),null!==h&&ki.jsx("button",{type:"button",onClick:()=>d(e=>!e),"aria-pressed":u,title:`Show only runs of bundle ${h}, the one this environment is on now`,className:cx("mx-2 mb-1 w-[calc(100%-1rem)] rounded border px-2 py-1 font-mono text-[10.5px] uppercase tracking-wider",u?"border-edge bg-raised text-fg":"border-edge-soft text-fg-3 hover:bg-raised/60"),children:"this bundle only"}),a?ki.jsx(lD,{runs:f}):ki.jsx(oD,{}),p.map(e=>ki.jsxs("div",{children:[ki.jsx("div",{className:"px-3 pb-0.5 pt-2 font-mono text-[10px] uppercase tracking-wider text-fg-4",children:e.label}),e.entries.map(e=>ki.jsx(uD,{entry:e,expanded:n.has(QB(e)),onToggle:()=>{return t=QB(e),o(e=>{const i=new Set(e);return i.delete(t)||i.add(t),i});var t},onOpen:g,onScenario:c,showRef:null===a},QB(e)))]},e.key)),0===f.length&&(i.runs.indexReady?ki.jsx(IN,{children:"no runs match"}):ki.jsx(IN,{children:"history is still loading…"})),i.runs.hasMore&&ki.jsx("button",{type:"button",onClick:()=>{i.runs.loadMore()},disabled:i.runs.loadingMore,className:"mx-2 mt-1 w-[calc(100%-1rem)] rounded border border-edge-soft py-1 font-mono text-[10.5px] text-fg-3 hover:bg-raised/60 disabled:opacity-50",children:i.runs.loadingMore?"loading…":"load older runs"})]})});function hD({ref_:e,onClear:t}){return ki.jsxs("div",{className:"mx-2 mb-1 flex items-center gap-1 rounded border border-accent/30 bg-accent/10 px-1.5 py-1",children:[ki.jsx("span",{className:"shrink-0 font-mono text-[9.5px] uppercase tracking-wider text-fg-4",children:"test"}),ki.jsx("span",{className:"truncate font-mono text-[11px] text-fg-2",children:e}),ki.jsx("button",{type:"button","aria-label":"Clear test filter",onClick:t,className:"ml-auto shrink-0 rounded p-0.5 text-fg-3 hover:bg-raised/60 hover:text-fg",children:ki.jsx(ux,{name:"x",className:"h-3 w-3"})})]})}function uD({entry:e,expanded:t,onToggle:i,onOpen:s,onScenario:r,showRef:n}){if("run"===e.kind)return ki.jsx(dD,{run:e.run,showRef:n,onOpen:s,depth:0});const o="collection"===e.kind?e.run:e.runs[0],a="collection"===e.kind?e.run.ref:e.ref,l=function(e){switch(e.kind){case"collection":return e.children.length;case"repeats":return e.runs.length;case"run":return 1}}(e);return ki.jsxs(ki.Fragment,{children:[ki.jsxs(UB,{depth:0,ariaLabel:"collection"===e.kind?`Collection ${a} — ${e.passed} passed, ${e.failed} failed, ${aj(o.startedAt)}`:`${a} — ${l} runs, ${aj(o.startedAt)}`,onClick:i,children:[ki.jsx(nD,{chevron:t?"open":"closed",status:hj(o.status)}),ki.jsx("span",{className:"truncate font-mono text-[11px] text-fg-2",onClick:t=>{t.stopPropagation(),"repeats"===e.kind&&r(a)},children:a}),"collection"===e.kind&&ki.jsx(ij,{size:"xs",tone:"info",children:"col"}),ki.jsx("span",{className:"ml-auto shrink-0 font-mono text-[10px] text-fg-4",children:"collection"===e.kind?`${e.passed} ✓${e.failed?` ${e.failed} ✗`:""}`:l}),ki.jsx("span",{className:"shrink-0 font-mono text-[10px] text-fg-4",children:aj(o.startedAt)})]}),t&&("collection"===e.kind?ki.jsxs(ki.Fragment,{children:[ki.jsxs(UB,{depth:1,ariaLabel:`Open collection run ${a}`,onClick:()=>s(e.run),children:[ki.jsx(nD,{icon:"layers"}),ki.jsx("span",{className:"truncate font-mono text-[10.5px] text-fg-3",children:"open collection run"})]}),e.children.map(e=>ki.jsx(dD,{run:e,showRef:!0,onOpen:s,depth:1},e.runId))]}):e.runs.map(e=>ki.jsx(dD,{run:e,showRef:!1,onOpen:s,depth:1},e.runId)))]})}function dD({run:e,showRef:t,onOpen:i,depth:s}){var r;const{workspace:n}=w_(),o=n.hosted&&void 0!==e.bundleId&&e.bundleId!==(null==(r=n.file)?void 0:r.currentBundleId)?e.bundleId:null;return ki.jsxs(UB,{depth:s,ariaLabel:`${"collection"===e.kind?"Collection":"Run"} ${e.ref} — ${e.status}, ${aj(e.startedAt)}`,onClick:()=>i(e),children:[ki.jsx(nD,{status:hj(e.status)}),t?ki.jsx("span",{className:"truncate font-mono text-[11px] text-fg-3",children:e.ref}):ki.jsx("span",{className:"truncate font-mono text-[11px] text-fg-3",children:aj(e.startedAt)}),t&&ki.jsx("span",{className:"shrink-0 font-mono text-[10px] text-fg-4",children:aj(e.startedAt)}),o&&ki.jsx("span",{className:"shrink-0 font-mono text-[10px] text-fg-4",title:`Ran on another test bundle (${o}), not the one this environment is on now`,children:"other bundle"}),null!=e.durationMs&&ki.jsx("span",{className:"ml-auto shrink-0 font-mono text-[10.5px] text-fg-4",children:oj(e.durationMs)})]})}function fD(e){const t=e.lastIndexOf("/");return t<0?e:e.slice(t+1)}function pD(e){const t=e.lastIndexOf("/");return t<0?"":e.slice(0,t)}function gD(e){return e.endsWith(".js")?e.slice(0,-3):e}function vD({title:e,message:t,confirmLabel:i="Delete",cancelLabel:s="Cancel",danger:r=!0,onConfirm:n,onCancel:o}){const a=gi.useRef(null);return gi.useEffect(()=>{var e;null==(e=a.current)||e.focus();const t=e=>{"Escape"===e.key&&o()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[o]),ki.jsx("div",{className:"fixed inset-0 z-50 grid place-items-center bg-black/30 backdrop-blur-[1px]",onMouseDown:o,children:ki.jsxs("div",{role:"dialog","aria-modal":"true",onMouseDown:e=>e.stopPropagation(),className:cx("w-[min(380px,calc(100vw-2rem))] rounded-lg p-4","border border-edge-soft bg-overlay shadow-xl"),children:[ki.jsx("div",{className:"text-[13px] font-medium text-fg",children:e}),ki.jsx("div",{className:"mt-1.5 text-[12px] leading-relaxed text-fg-2",children:t}),ki.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[ki.jsx("button",{type:"button",onClick:o,className:"h-7 rounded border border-edge-soft bg-canvas px-3 font-mono text-[11.5px] text-fg-2 hover:bg-raised",children:s}),ki.jsx("button",{ref:a,type:"button",onClick:n,className:cx("h-7 rounded px-3 font-mono text-[11.5px] font-medium text-on-accent",r?"bg-fail hover:bg-fail/80":"bg-accent hover:bg-accent-hover"),children:i})]})]})})}function mD(e,{validate:t,onCommit:i,onCancel:s}){const[r,n]=gi.useState(e),o=gi.useRef(null),a=gi.useRef(!1);gi.useEffect(()=>{var e,t;null==(e=o.current)||e.focus(),null==(t=o.current)||t.select()},[]);const l=r.trim(),c=l?(null==t?void 0:t(l))??null:null,h=l.length>0&&!c,u=()=>{a.current||(a.current=!0,h?i(l):s())};return{err:c,ringClass:c?"ring-1 ring-fail":"ring-1 ring-accent",onSubmit:e=>{e.preventDefault(),u()},inputProps:{ref:o,value:r,onChange:e=>n(e.target.value),onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),a.current||(a.current=!0,s()))},onBlur:u,spellCheck:!1,autoComplete:"off"}}}const _D=__(function({query:e}){var t;const i=w_(),s=i.scenarios,r=i.session.capabilities.canEditFiles,n=s.buildTree(e),o=0===n.folders.length&&0===n.scenarios.length&&null===s.creating;return ki.jsxs("div",{className:"min-h-full py-1",onContextMenu:e=>{e.preventDefault(),s.openMenu(e.clientX,e.clientY,{kind:"blank"})},onKeyDown:e=>function(e,t,i){if("INPUT"===e.target.tagName)return;const s=t.selected,r=e.metaKey||e.ctrlKey,n=!!s&&"blank"!==s.kind;"F2"===e.key&&n&&i?(e.preventDefault(),t.startRename(s)):r&&("c"===e.key||"C"===e.key)&&n?(e.preventDefault(),t.copy(s)):r&&("v"===e.key||"V"===e.key)&&i&&(e.preventDefault(),t.paste(kD(s)))}(e,s,r),children:[s.actionError&&ki.jsx("button",{type:"button",onClick:()=>s.clearActionError(),className:"mx-2 my-1 block w-[calc(100%-1rem)] truncate rounded border border-fail/30 bg-fail/10 px-2 py-1 text-left font-mono text-[11px] text-fail",children:s.actionError}),""===(null==(t=s.creating)?void 0:t.parent)&&ki.jsx(SD,{store:s,depth:0,kind:s.creating.kind}),n.folders.map(e=>ki.jsx(bD,{node:e,depth:0},e.rel)),n.scenarios.map(e=>ki.jsx(xD,{s:e,depth:0},e.path)),o&&ki.jsx(IN,{children:"no scenarios match"}),s.menu&&ki.jsx(Nx,{x:s.menu.x,y:s.menu.y,items:CD(s,i.schedules,s.menu.target,r),onClose:()=>s.closeMenu()}),s.pendingDelete&&"blank"!==s.pendingDelete.kind&&ki.jsx(vD,{title:"folder"===s.pendingDelete.kind?`Delete folder "${fD(s.pendingDelete.rel)}"?`:`Delete "${gD(fD(s.pendingDelete.rel))}"?`,message:"folder"===s.pendingDelete.kind?"This permanently deletes the folder and everything inside it.":"This permanently deletes the scenario file.",onConfirm:()=>{s.confirmDelete()},onCancel:()=>s.cancelDelete()})]})}),bD=__(function e({node:t,depth:i}){var s,r;const n=w_().scenarios,o=n.isExpanded(t.rel);if("folder"===(null==(s=n.renaming)?void 0:s.kind)&&n.renaming.rel===t.rel)return ki.jsx(yD,{depth:i,initial:t.name,open:o,onCommit:e=>{n.commitRename(e)},onCancel:()=>n.cancelRename()});return ki.jsxs("div",{children:[ki.jsxs("button",{type:"button",onClick:()=>{n.select({kind:"folder",rel:t.rel}),n.toggle(t.rel)},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),n.openMenu(e.clientX,e.clientY,{kind:"folder",rel:t.rel})},style:WB(i),className:"flex h-7 w-full items-center gap-2 pr-2 text-left text-fg-2 hover:text-fg",children:[ki.jsx(ux,{name:o?"chevronD":"chevronR",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),ki.jsx(ux,{name:"folder",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),ki.jsx("span",{className:"truncate font-mono text-[12.5px]",children:t.name}),ki.jsx("span",{className:"ml-auto shrink-0 font-mono text-[10.5px] text-fg-4",children:t.scenarios.length})]}),o&&ki.jsxs(ki.Fragment,{children:[(null==(r=n.creating)?void 0:r.parent)===t.rel&&ki.jsx(SD,{store:n,depth:i+1,kind:n.creating.kind}),t.folders.map(t=>ki.jsx(e,{node:t,depth:i+1},t.rel)),t.scenarios.map(e=>ki.jsx(xD,{s:e,depth:i+1},e.path))]})]})}),xD=__(function({s:e,depth:t}){var i;const s=w_(),r=s.scenarios,n=s.runs.lastRunByRef("scenario",e.name),o=s.schedules.get("scenario",e.name),a=`${e.name}.js`,l={kind:"scenario",rel:a},c=s.tabs.activeTab,h="scenario"===(null==c?void 0:c.kind)&&c.path===e.path;return"scenario"===(null==(i=r.renaming)?void 0:i.kind)&&r.renaming.rel===a?ki.jsx(wD,{depth:t,initial:fD(e.name),onCommit:e=>{r.commitRename(e)},onCancel:()=>r.cancelRename()}):ki.jsx(UB,{depth:t,leaf:!0,active:h,onClick:()=>{r.select(l),s.tabs.open({kind:"scenario",path:e.path})},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),r.openMenu(e.clientX,e.clientY,l)},children:ki.jsxs("span",{className:"flex min-w-0 items-center gap-[5px]",children:[ki.jsx("span",{className:"grid h-3.5 w-3.5 shrink-0 place-items-center",children:ki.jsx(nj,{status:lj((null==n?void 0:n.status)??null,e.expectFail)})}),ki.jsx("span",{className:"truncate font-mono text-[12.5px] text-fg-2",children:fD(e.name)}),o&&ki.jsx("span",{title:Wj(o),children:ki.jsx(ux,{name:"clock",className:"h-3 w-3 shrink-0 text-fg-4"})})]})})});function yD({depth:e,initial:t,open:i=!0,onCommit:s,onCancel:r}){const{ringClass:n,onSubmit:o,inputProps:a}=mD(t,{validate:Vb,onCommit:s,onCancel:r});return ki.jsxs("form",{onSubmit:o,style:WB(e),className:"flex h-7 w-full items-center gap-2 pr-2",children:[ki.jsx(ux,{name:i?"chevronD":"chevronR",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),ki.jsx(ux,{name:"folder",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),ki.jsx("input",{...a,className:cx("min-w-0 flex-1 rounded-sm bg-canvas px-1 font-mono text-[12.5px] text-fg outline-none",n)})]})}function wD({depth:e,initial:t,onCommit:i,onCancel:s}){const{ringClass:r,onSubmit:n,inputProps:o}=mD(t,{validate:Vb,onCommit:i,onCancel:s});return ki.jsx("form",{onSubmit:n,style:KB(e),className:"flex w-full items-center py-1 pr-2",children:ki.jsx("input",{...o,placeholder:"scenario-name",className:cx("min-w-0 flex-1 rounded-sm bg-canvas px-1 font-mono text-[12.5px] leading-[1.5] text-fg outline-none",r)})})}function SD({store:e,depth:t,kind:i}){const s=t=>{e.commitCreate(t)},r=()=>e.cancelCreate();return"folder"===i?ki.jsx(yD,{depth:t,initial:"",onCommit:s,onCancel:r}):ki.jsx(wD,{depth:t,initial:"",onCommit:s,onCancel:r})}function kD(e){return e?"folder"===e.kind?e.rel:"scenario"===e.kind?pD(e.rel):"":""}function CD(e,t,i,s){const r=e.clipboard,n=r?"folder"===r.kind?`Paste folder "${r.label}"`:`Paste "${r.label}"`:"Paste",o=kD(i),a={kind:"item",icon:"file",label:"New scenario",disabled:!s,onSelect:()=>e.startCreate(o,"scenario")},l={kind:"item",icon:"folderPlus",label:"New folder",disabled:!s,onSelect:()=>e.startCreate(o,"folder")},c={kind:"item",icon:"clipboard",label:n,disabled:!r||!s,onSelect:()=>{e.paste(o)}};if("blank"===i.kind)return[a,l,c];return[{kind:"header",label:"folder"===i.kind?fD(i.rel):gD(fD(i.rel))},a,l,{kind:"item",icon:"copy",label:"Copy",onSelect:()=>e.copy(i)},{kind:"item",icon:"externalL",label:"Copy link",onSelect:()=>e.copyPath(i)},c,{kind:"item",icon:"edit",label:"Rename",shortcut:"F2",disabled:!s,onSelect:()=>e.startRename(i)},...jD(t,i,s),{kind:"separator"},{kind:"item",icon:"trash",label:"Delete",tone:"danger",disabled:!s,onSelect:()=>e.requestDelete(i)}]}function jD(e,t,i){if("scenario"!==t.kind)return[];const s=gD(t.rel),r=e.get("scenario",s);return[{kind:"item",icon:"clock",label:r?`Schedule · ${wb(r.cron)}`:"Schedule…",disabled:!i,onSelect:()=>e.openEditor({kind:"scenario",name:s})}]}const ND=__(function({query:e}){const t=w_(),[i,s]=gi.useState(!1),[r,n]=gi.useState(null),o=gi.useRef(null),a=t.session.capabilities.canEditFiles,l=e.trim().toLowerCase(),c=t.snapshots.list.filter(e=>!l||e.manifest.scenario.toLowerCase().includes(l)),h=e=>{e&&a&&t.snapshots.importFile(e).then(e=>t.tabs.open({kind:"snapshot",snapshotId:e})).catch(e=>window.alert(`Import failed: ${(null==e?void 0:e.message)??e}`))};return ki.jsxs("div",{onDragOver:e=>{e.preventDefault(),s(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||s(!1)},onDrop:e=>{e.preventDefault(),s(!1),h(e.dataTransfer.files[0])},className:cx("relative flex min-h-full flex-col py-1",i&&"bg-accent/10 ring-2 ring-inset ring-accent/60"),children:[ki.jsx("input",{ref:o,type:"file",accept:".zip,.unotest.zip",className:"hidden",onChange:e=>{var t;h(null==(t=e.target.files)?void 0:t[0]),e.target.value=""}}),ki.jsx("div",{className:"px-2 pb-2",children:ki.jsx(yM,{icon:"camera",tooltip:"Open a teammate's .unotest.zip snapshot",onClick:()=>{var e;return null==(e=o.current)?void 0:e.click()},className:"w-full justify-center",children:"Open .unotest.zip"})}),0===c.length?ki.jsx(IN,{children:"no snapshots — open or drop a .unotest.zip"}):c.map(e=>{return ki.jsxs(UB,{active:t.tabs.activeKey===`snapshot:${e.snapshotId}`,onClick:()=>t.tabs.open({kind:"snapshot",snapshotId:e.snapshotId}),onContextMenu:t=>{t.preventDefault(),n({x:t.clientX,y:t.clientY,id:e.snapshotId,label:e.manifest.scenario})},children:[ki.jsx(nj,{status:(i=e.manifest.status,"interrupted"===i?"aborted":i)}),ki.jsxs("span",{className:"min-w-0 flex-1",children:[ki.jsx("span",{className:"block truncate font-mono text-[12px] text-fg-2",children:e.manifest.scenario}),ki.jsxs("span",{className:"block truncate font-mono text-[10px] text-fg-4",children:[e.manifest.capturedAt.slice(0,16).replace("T"," "),e.manifest.git.author&&` · ${e.manifest.git.author}`]})]})]},e.snapshotId);var i}),i&&ki.jsx("div",{className:"pointer-events-none absolute inset-0 grid place-items-center",children:ki.jsxs("div",{className:"flex flex-col items-center gap-1 text-accent",children:[ki.jsx(ux,{name:"camera",className:"h-5 w-5"}),ki.jsx("span",{className:"font-mono text-[11px]",children:"Drop to open snapshot"})]})}),r&&ki.jsx(Nx,{x:r.x,y:r.y,onClose:()=>n(null),items:(u=r.label,d=()=>{return e=r.id,i=r.label,void(a&&window.confirm(`Delete snapshot "${i}"?`)&&(t.tabs.close(`snapshot:${e}`),t.snapshots.remove(e).catch(e=>window.alert(`Delete failed: ${(null==e?void 0:e.message)??e}`))));var e,i},[{kind:"header",label:u},{kind:"item",icon:"trash",label:"Delete snapshot",tone:"danger",onSelect:d}])})]});var u,d});const MD={secret:{label:"Secrets",file:".secrets",badge:!0},app:{label:"App variables",file:".env"},runner:{label:"Runner config",file:".env"}},ED=["app","secret","runner"];function BD({on:e,onChange:t,title:i}){return ki.jsx("button",{type:"button",role:"switch","aria-checked":e,onClick:t,title:i,className:cx("relative inline-flex h-[18px] w-[30px] shrink-0 items-center rounded-full",e?"bg-accent":"bg-raised"),children:ki.jsx("span",{className:cx("inline-block h-[14px] w-[14px] rounded-full bg-on-accent shadow-sm transition-transform duration-150",e?"translate-x-[14px]":"translate-x-[2px]")})})}const DD=__(function({query:e}){const t=w_().variables;gi.useEffect(()=>{t.load()},[t]);const i=t.filtered(e),s=e.trim().length>0,[r,n]=gi.useState({secret:!1,app:!1,runner:!0}),[o,a]=gi.useState(null),l=t.edits.size+t.activated.size;return ki.jsxs("div",{className:"flex h-full flex-col",children:[ki.jsx(LD,{}),t.dirty&&ki.jsxs("div",{className:"flex items-center gap-2 border-b border-accent/30 bg-accent/10 px-3 py-1.5",children:[ki.jsxs("span",{className:"font-mono text-[11px] text-accent",children:[l," change",1===l?"":"s"]}),ki.jsx("button",{type:"button",disabled:t.saving,onClick:()=>{t.save()},className:"ml-auto rounded bg-accent px-2 py-0.5 font-mono text-[11px] text-on-accent hover:bg-accent-hover disabled:opacity-50",children:t.saving?"Saving…":"Save"}),ki.jsx("button",{type:"button",disabled:t.saving,onClick:()=>{t.load()},className:"rounded px-2 py-0.5 font-mono text-[11px] text-fg-3 hover:bg-raised",children:"Discard"})]}),t.error&&ki.jsx("div",{className:"border-b border-fail/30 bg-fail/10 px-3 py-1.5 font-mono text-[11px] text-fail",children:t.error}),t.warnings.length>0&&ki.jsxs("div",{className:"flex items-start gap-2 border-b border-warn/30 bg-warn/10 px-3 py-1.5",children:[ki.jsx("div",{className:"flex-1 space-y-0.5 font-mono text-[11px] text-warn",children:t.warnings.map((e,t)=>ki.jsxs("div",{children:["⚠ ",e]},t))}),ki.jsx("button",{type:"button",title:"Dismiss",onClick:()=>t.dismissWarnings(),className:"grid h-4 w-4 shrink-0 place-items-center rounded text-warn hover:bg-warn/20",children:ki.jsx(ux,{name:"x",className:"h-3 w-3"})})]}),ki.jsxs("div",{className:"flex-1 overflow-y-auto py-1",children:[ED.map(e=>{const t=i.filter(t=>t.category===e),l=MD[e],c=o===e;if(0===t.length&&!c&&!s)return ki.jsxs("button",{type:"button",onClick:()=>a(e),className:"flex h-7 w-full items-center gap-1 px-2 font-mono text-[11px] text-fg-4 hover:text-fg-2",children:[ki.jsx(ux,{name:"plus",className:"h-3.5 w-3.5"}),"Add ",l.label.toLowerCase()]},e);const h=r[e]&&!s;return ki.jsxs("div",{className:"mb-1",children:[ki.jsxs("div",{className:"group/header flex h-7 w-full items-center gap-1 px-2 text-fg-4",children:[ki.jsxs("button",{type:"button",onClick:()=>n(t=>({...t,[e]:!t[e]})),className:"flex flex-1 items-center gap-1 truncate hover:text-fg-2",children:[ki.jsx(ux,{name:h?"chevronR":"chevronD",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),ki.jsx("span",{className:"font-mono text-[11px] uppercase tracking-wider",children:l.label}),l.badge&&ki.jsx("span",{className:"rounded bg-warn/15 px-1 font-mono text-[9px] uppercase tracking-wide text-warn",children:"secret"}),ki.jsx("span",{className:"font-mono text-[10px] text-fg-4",children:l.file})]}),ki.jsx("button",{type:"button",title:`Add ${l.label.toLowerCase()}`,onClick:()=>{a(e),n(t=>({...t,[e]:!1}))},className:"grid h-5 w-5 place-items-center rounded text-fg-4 opacity-0 hover:bg-raised hover:text-fg group-hover/header:opacity-100",children:ki.jsx(ux,{name:"plus",className:"h-3.5 w-3.5"})}),ki.jsx("span",{className:"font-mono text-[10.5px] text-fg-4",children:t.length})]}),!h&&ki.jsxs(ki.Fragment,{children:[c&&ki.jsx(RD,{category:e,onClose:()=>a(null)}),t.map(e=>ki.jsx(PD,{v:e},`${e.source} ${e.key}`))]})]},e)}),0===i.length&&s&&ki.jsx(IN,{children:"no variables match"})]})]})}),LD=__(function(){const e=w_(),{environments:t,variables:i}=e;if(!t.hasAny)return null;const s=i.dirty,r=[{label:"base",value:null},...t.names.map(e=>({label:e,value:e}))];return ki.jsxs("div",{className:"flex flex-wrap items-center gap-1 border-b border-edge-soft px-3 py-1.5",title:s?"Save or discard changes before switching environments":void 0,children:[ki.jsx("span",{className:"mr-1 font-mono text-[10px] uppercase tracking-wider text-fg-4",children:"env"}),r.map(e=>{const i=t.active===e.value;return ki.jsx("button",{type:"button",disabled:s&&!i,onClick:()=>{t.setActive(e.value)},className:cx("rounded px-1.5 py-0.5 font-mono text-[11px] transition-colors",i?"bg-accent text-on-accent":"text-fg-3 hover:bg-raised hover:text-fg",s&&!i&&"opacity-40 hover:bg-transparent"),children:e.label},e.label)})]})}),RD=__(function({category:e,onClose:t}){const i=w_().variables,s=gi.useMemo(()=>new Set(i.rows.map(e=>e.key)),[i.rows]),r=gi.useMemo(()=>[...Gb].filter(e=>!s.has(e)).sort(),[s]),[n,o]=gi.useState("runner"===e?r[0]??"":""),[a,l]=gi.useState(""),c=n.trim().length>0&&!i.saving,h=async()=>{if(!c)return;await i.addVariable(n.trim(),a,e)&&t()};return ki.jsxs("div",{className:"mx-3 mb-1 flex flex-col gap-1 rounded border border-accent/30 bg-accent/10 p-2",children:["runner"===e?ki.jsxs("select",{value:n,onChange:e=>o(e.target.value),className:"h-6 rounded border border-edge-soft bg-canvas px-1 font-mono text-[11.5px] text-fg",children:[0===r.length&&ki.jsx("option",{value:"",children:"all runner keys set"}),r.map(e=>ki.jsx("option",{value:e,children:e},e))]}):ki.jsx("input",{type:"text",value:n,autoFocus:!0,spellCheck:!1,placeholder:"NAME (UPPER_SNAKE)",onChange:e=>o(e.target.value.toUpperCase()),onKeyDown:e=>"Enter"===e.key&&void h(),className:"h-6 rounded border border-edge-soft bg-canvas px-1.5 font-mono text-[11.5px] text-fg placeholder:text-fg-4"}),ki.jsxs("div",{className:"flex items-center gap-1",children:[ki.jsx("input",{type:"secret"===e?"password":"text",value:a,spellCheck:!1,placeholder:"value",onChange:e=>l(e.target.value),onKeyDown:e=>"Enter"===e.key&&void h(),className:"h-6 flex-1 rounded border border-edge-soft bg-canvas px-1.5 font-mono text-[11.5px] text-fg placeholder:text-fg-4"}),ki.jsx("button",{type:"button",disabled:!c,onClick:()=>{h()},className:"rounded bg-accent px-2 py-0.5 font-mono text-[11px] text-on-accent hover:bg-accent-hover disabled:opacity-50",children:"Add"}),ki.jsx("button",{type:"button",onClick:t,className:"rounded px-1.5 py-0.5 font-mono text-[11px] text-fg-3 hover:bg-raised",children:"Cancel"})]})]})}),PD=__(function({v:e}){const t=w_().variables,i=e.commented&&!t.isActivated(e),s="1"===t.effectiveValue(e),r=e.secret&&!t.isRevealed(e),n=t.isEdited(e)||t.isActivated(e);return ki.jsxs("div",{className:cx("group/row flex h-[44px] flex-col justify-center gap-0.5 px-3",i&&"opacity-45 hover:opacity-70 dark:opacity-70 dark:hover:opacity-100"),children:[ki.jsxs("div",{className:"flex items-center gap-1 truncate font-mono text-[11.5px]",children:[i&&ki.jsx("span",{className:"text-fg-4",children:"#"}),ki.jsx("span",{className:cx("truncate",i?"text-fg-3":"text-fg-2"),title:e.key,children:e.key}),e.shared&&ki.jsx("span",{className:"shrink-0 rounded bg-raised px-1 font-mono text-[9px] uppercase tracking-wide text-fg-3",title:"from the shared base file — value applies to every target",children:"shared"}),e.envOverlay&&ki.jsx("span",{className:"shrink-0 rounded bg-accent/15 px-1 font-mono text-[9px] uppercase tracking-wide text-accent",title:`from the .${"secrets"===e.source?"secrets":"env"}.${e.envOverlay} overlay — value applies in this environment only`,children:e.envOverlay}),n&&ki.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-accent",title:"edited"}),ki.jsx("button",{type:"button",title:"Delete variable",onClick:()=>{t.deleteVariable(e)},className:"ml-auto grid h-5 w-5 shrink-0 place-items-center rounded text-fg-4 opacity-0 hover:bg-fail/10 hover:text-fail group-hover/row:opacity-100",children:ki.jsx(ux,{name:"trash",className:"h-3.5 w-3.5"})})]}),ki.jsx("div",{className:"flex h-6 items-center gap-1",children:i?ki.jsx("button",{type:"button",onClick:()=>t.activate(e),title:"commented out — click to enable & edit",className:"w-full cursor-text truncate rounded px-1.5 text-left font-mono text-[11.5px] leading-6 text-fg-3 line-through decoration-fg-4 hover:bg-raised/60 hover:no-underline",children:e.secret?"••••••••••":e.value||" "}):e.bool?ki.jsxs(ki.Fragment,{children:[ki.jsx(BD,{on:s,onChange:()=>t.toggleBool(e),title:s?"On (1) — click to set 0":"Off (0) — click to set 1"}),ki.jsx("span",{className:cx("font-mono text-[11px] tabular-nums",s?"text-accent":"text-fg-4"),children:s?"1":"0"})]}):ki.jsxs(ki.Fragment,{children:[ki.jsx("input",{type:r?"password":"text",value:t.effectiveValue(e),spellCheck:!1,autoFocus:t.isActivated(e),placeholder:"empty",onChange:i=>t.setValue(e,i.target.value),className:"h-6 w-full rounded border border-edge-soft bg-canvas px-1.5 font-mono text-[11.5px] text-fg placeholder:text-fg-4 focus:border-accent focus:outline-none focus:ring-2 focus:ring-accent/20"}),e.secret&&ki.jsx("button",{type:"button",title:r?"Reveal":"Hide",onClick:()=>t.toggleReveal(e),className:"grid h-6 w-6 shrink-0 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fg-2",children:ki.jsx(ux,{name:r?"eye":"eyeOff",className:"h-3.5 w-3.5"})})]})})]})}),AD={scenarios:[{keys:["↑","↓"],label:"navigate"},{keys:["↵"],label:"open"},{keys:["R"],label:"run"}],helpers:[{keys:["↑","↓"],label:"navigate"},{keys:["↵"],label:"open"}],collections:[{keys:["↑","↓"],label:"navigate"},{keys:["↵"],label:"open"},{keys:["N"],label:"new collection"}],runs:[{keys:["↑","↓"],label:"navigate"},{keys:["↵"],label:"inspect"}],active:[{keys:["↵"],label:"attach"},{keys:["⌃C"],label:"abort"}],variables:[{keys:["↵"],label:"save"},{keys:["⌥"],label:"reveal secret"}],app:[{keys:["⌘K"],label:"filter log"}],snapshots:[{keys:["↵"],label:"open"},{keys:["O"],label:"open .zip"}]};function TD({section:e}){return ki.jsx("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-t border-edge-soft px-3 py-1.5 opacity-0 transition-opacity group-hover/pane:opacity-100",children:AD[e].map((e,t)=>ki.jsxs("span",{className:"flex items-center gap-1",children:[e.keys.map(e=>ki.jsx(HB,{children:e},e)),ki.jsx("span",{className:"font-mono text-[10px] text-fg-4",children:e.label})]},t))})}const zD={scenarios:"Filter scenarios…",helpers:"Filter helpers…",collections:"Filter collections…",runs:"Filter runs…",active:"Filter active runs…",variables:"Filter variables…",app:"Filter app log…",snapshots:"Filter snapshots…"},OD={scenarios:"scenarios",helpers:"helpers",collections:"collections",runs:"history",active:"active",variables:"variables",app:"app under test",snapshots:"snapshots"},ID=__(function(){const e=w_(),t=e.layout,i=e.activityBar.section,[s,r]=gi.useState(""),[n,o]=gi.useState(!1),a=gi.useRef(null),l=e.targets.projectRoot,c=l.split("/").filter(Boolean).pop()??"",h=Cx({value:t.treeWidth,onChange:t.setTreeWidth,axis:"x",dir:1,min:t.treeMin,max:()=>Math.round(.5*window.innerWidth)});return gi.useEffect(()=>{const e=e=>{var t;(e.metaKey||e.ctrlKey)&&"k"===e.key.toLowerCase()&&(e.preventDefault(),null==(t=a.current)||t.focus())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),ki.jsxs("aside",{className:"group/pane relative flex shrink-0",style:{width:t.treeWidth},children:[ki.jsx(Mx,{axis:"x",onPointerDown:h,className:"-right-[6px]"}),ki.jsxs("div",{className:"uno-island flex min-w-0 flex-1 flex-col",children:[ki.jsxs("div",{className:"flex h-[33px] items-center gap-2 border-b border-edge-soft px-3",children:[ki.jsx(ux,{name:"folder",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),ki.jsxs("span",{className:"group relative flex min-w-0 flex-1",children:[ki.jsx("span",{className:"truncate font-mono text-[11.5px] text-fg-3",children:c||"loading…"}),l&&ki.jsx(Mj,{label:l,placement:"bottom-start"})]}),ki.jsx("button",{type:"button",disabled:n,className:cx("ml-auto grid h-6 w-6 shrink-0 place-items-center rounded text-fg-4 opacity-0 transition-opacity hover:bg-raised hover:text-fg-2 focus-visible:opacity-100 disabled:hover:bg-transparent group-hover/pane:opacity-100",n&&"opacity-100"),title:"Refresh",onClick:()=>{(async()=>{if(!n){o(!0);try{await Promise.all([e.scenarios.load(),e.helpers.load(),e.collections.load(),e.runs.load(),new Promise(e=>setTimeout(e,500))])}finally{o(!1)}}})()},children:ki.jsx(ux,{name:"refresh",className:cx("h-3.5 w-3.5",n&&"animate-spin")})})]}),ki.jsxs("div",{className:"flex h-7 items-center gap-2 px-3 pt-1",children:[ki.jsx("span",{className:"font-mono text-[10px] uppercase tracking-wider text-fg-4",children:OD[i]}),"scenarios"===i&&e.session.capabilities.canRun&&ki.jsxs("button",{type:"button",title:"New test — open a live authoring session (you + the agent co-author)",onClick:()=>{const t=window.prompt("New test to author live (feature/name, e.g. auth/login):"),i=null==t?void 0:t.trim();i&&e.activeRuns.startAuthoring(i).then(t=>{e.tabs.open({kind:"scenario-run",runId:t.runId})})},className:"ml-auto flex h-5 items-center gap-1 rounded px-1.5 font-mono text-[10px] text-fg-3 opacity-0 transition-opacity hover:bg-raised hover:text-fg focus-visible:opacity-100 group-hover/pane:opacity-100",children:[ki.jsx(ux,{name:"plus",className:"h-3 w-3"})," author"]})]}),ki.jsx("div",{className:"px-2 pb-2",children:ki.jsxs("label",{className:"flex h-7 items-center gap-1.5 rounded border border-edge-soft bg-canvas px-2 focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20",children:[ki.jsx(ux,{name:"search",className:"h-3.5 w-3.5 text-fg-4"}),ki.jsx("input",{ref:a,value:s,onChange:e=>r(e.target.value),placeholder:zD[i],className:"h-full w-full bg-transparent text-[12.5px] text-fg placeholder:text-fg-4 focus:outline-none"}),ki.jsx(HB,{children:"⌘K"})]})}),ki.jsxs("div",{className:"flex-1 overflow-y-auto",children:["scenarios"===i&&ki.jsx(_D,{query:s}),"helpers"===i&&ki.jsx(ZB,{query:s}),"collections"===i&&ki.jsx(XB,{query:s}),"runs"===i&&ki.jsx(cD,{query:s}),"active"===i&&ki.jsx(qB,{query:s}),"variables"===i&&ki.jsx(DD,{query:s}),"app"===i&&ki.jsx(YB,{query:s}),"snapshots"===i&&ki.jsx(ND,{query:s})]}),ki.jsx(TD,{section:i})]})]})}),FD=__(function(){const e=w_();return gi.useEffect(()=>{const t=t=>{if(t.ctrlKey&&!t.metaKey&&!t.altKey&&("`"===t.key||"Backquote"===t.code))return t.preventDefault(),void(e.session.capabilities.canTerminal&&e.terminal.toggle());if(!t.metaKey&&!t.ctrlKey)return;const i={1:"scenarios",2:"helpers",3:"collections",4:"runs",5:"active",6:"variables",7:"app",8:"snapshots"}[t.key];if(i)return t.preventDefault(),e.activityBar.setSection(i),void e.layout.openTree();"w"===t.key.toLowerCase()&&(t.preventDefault(),e.tabs.close(e.tabs.activeKey))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e]),ki.jsxs("div",{className:"flex h-full flex-col bg-shell pb-[3px] text-fg",children:[ki.jsxs("div",{className:"flex min-h-0 flex-1",children:[ki.jsx(SB,{}),ki.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5 p-1.5 pb-[3px] pl-0",children:[ki.jsxs("div",{className:"flex min-h-0 flex-1 gap-1.5",children:[e.layout.treeOpen&&ki.jsx(ID,{}),ki.jsxs("main",{className:"uno-island flex min-w-0 flex-1 flex-col",children:[ki.jsx(zB,{}),ki.jsx(hB,{}),ki.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:ki.jsx(lB,{})})]})]}),ki.jsx(QC,{})]})]}),ki.jsx(EB,{}),ki.jsx(gx,{})]})}),HD=/\x1b\[[\d;]*[a-zA-Z]/g;class WD{constructor(e){this.rest=e,this.byRunId=new Map,this.collectionByRunId=new Map,Wn(this,{},{autoBind:!0})}get list(){return[...this.byRunId.values()]}get activeList(){return[...this.byRunId.values()].filter(e=>"starting"===e.status||"running"===e.status||"paused"===e.status)}get queuedList(){return[...this.byRunId.values()].filter(e=>"queued"===e.status)}get liveRefs(){const e=new Map;for(const t of this.activeList)t.scenario&&("paused"===t.status?e.set(t.scenario,"paused"):e.has(t.scenario)||e.set(t.scenario,"running"));return e}get activeCollectionList(){return[...this.collectionByRunId.values()].filter(e=>"starting"===e.status||"running"===e.status)}get queuedCollectionList(){return[...this.collectionByRunId.values()].filter(e=>"queued"===e.status)}get hasActive(){return this.activeList.length>0||this.activeCollectionList.length>0}reconcileWithRuns(e){for(const t of e)if("running"!==t.status&&null!==t.outcome)if("collection"===t.kind){const e=this.collectionByRunId.get(t.runId);!e||"queued"!==e.status&&"starting"!==e.status&&"running"!==e.status||(e.status=this.statusFromOutcome(t.outcome),e.outcome=t.outcome)}else{const e=this.byRunId.get(t.runId);!e||"queued"!==e.status&&"starting"!==e.status&&"running"!==e.status||(e.status=this.statusFromOutcome(t.outcome),e.outcome=t.outcome)}}applyWsMessage(e){switch(e.kind){case"fs:run-started":if(this.collectionByRunId.has(e.runId))return;return void this.ensure(e.runId,e.scenario);case"fs:run-step":return void this.applyStep(e.runId,e.event);case"fs:collection-run-step":return void this.applyCollectionStep(e.runId,e.event);case"fs:run-finished":return void this.applyFinished(e.runId,e.outcome);case"log:line":if(this.collectionByRunId.has(e.runId))return;return void function(e,t,i){const s=(n=i,n.replace(HD,"")),r=Date.now();var n;if(""===s.trim())return void(e.logs.length>0&&(e.logs[e.logs.length-1].receivedAt=0));const o=function(e,t){return"stderr"===e?"error":/^(warn|warning|⚠)\b/i.test(t)?"warn":"log"}(t,s),a=e.logs[e.logs.length-1];if(a&&a.stream===t&&a.level===o&&r-a.receivedAt<100)return a.text+="\n"+s,void(a.receivedAt=r);e.logs.push({stream:t,level:o,text:s,at:KD(r),receivedAt:r})}(this.ensure(e.runId,""),e.stream,e.line);default:return}}async startScenario(e,t={}){const i=await this.rest.startRun({kind:"scenario",scenario:e,...void 0!==t.headed?{headed:t.headed}:{},...void 0!==t.debug?{debug:t.debug}:{},...t.breakpoints&&t.breakpoints.length>0?{breakpoints:t.breakpoints}:{}}),s=this.ensure(i.runId,i.ref);return s.status="queued"===i.status?"queued":"starting",s.plainRun=!t.debug,{runId:i.runId,scenario:i.ref}}async startAuthoring(e){const t=await this.rest.startRun({kind:"authoring",scenario:e,headed:!0}),i=this.ensure(t.runId,t.ref);return i.status="queued"===t.status?"queued":"starting",i.mode="authoring",{runId:t.runId,scenario:t.ref}}async startCollection(e,t={}){const i=await this.rest.startRun({kind:"collection",collection:e,...void 0!==t.headed?{headed:t.headed}:{},...void 0!==t.workers?{workers:t.workers}:{},...void 0!==t.bail?{bail:t.bail}:{}});return this.ensureCollection(i.runId,i.ref).status="queued"===i.status?"queued":"starting",{runId:i.runId,collection:i.ref}}async abort(e){try{await this.rest.abortRun(e)}catch{try{await this.rest.dbgCommand(e,{cmd:"abort"})}catch{}}}async step(e){await this.rest.dbgCommand(e,{cmd:"step"})}async continueRun(e){await this.stopPicker(e),await this.rest.dbgCommand(e,{cmd:"continue"})}async togglePicker(e,t){const i=this.byRunId.get(e);(null==i?void 0:i.picker.active)&&i.picker.mode===t?await this.stopPicker(e):await this.startPicker(e,t)}async startPicker(e,t){const i=this.byRunId.get(e),s=(null==i?void 0:i.picker.execute)??!1;i&&(i.picker={active:!0,mode:t,execute:s}),await this.rest.dbgCommand(e,{cmd:"picker:start",mode:t,execute:s})}async setPickerExecute(e,t){const i=this.byRunId.get(e);i&&(i.picker={...i.picker,execute:t},i.picker.active&&await this.rest.dbgCommand(e,{cmd:"picker:start",mode:i.picker.mode,execute:t}))}async stopPicker(e){const t=this.byRunId.get(e);t&&t.picker.active&&(t.picker={active:!1,mode:t.picker.mode,execute:t.picker.execute},await this.rest.dbgCommand(e,{cmd:"picker:stop"}))}async pauseRun(e){await this.rest.dbgCommand(e,{cmd:"pause"})}async setWheel(e,t){const i=this.byRunId.get(e);i&&(i.wheel=t),await this.rest.dbgCommand(e,{cmd:"wheel",owner:t})}async requestSnapshot(e){await this.rest.dbgCommand(e,{cmd:"snapshot"})}async probe(e,t){const i=this.byRunId.get(e);if(!i)return;const s=crypto.randomUUID();i.consoleEntries.push({id:s,at:KD(Date.now()),input:t,status:"pending"}),setTimeout(()=>this.markProbeStale(e,s),1e4);try{await this.rest.dbgCommand(e,{cmd:"probe",locator:t,id:s})}catch{this.markProbeStale(e,s)}}markProbeStale(e,t){var i;const s=null==(i=this.byRunId.get(e))?void 0:i.consoleEntries.find(e=>e.id===t);s&&"pending"===s.status&&(s.status="stale")}async setBreakpoint(e,t,i){await this.rest.dbgCommand(e,{cmd:"set-bp",line:t,col:i})}async clearBreakpoint(e,t,i){await this.rest.dbgCommand(e,{cmd:"clear-bp",line:t,col:i})}findActiveByScenario(e){for(const t of this.byRunId.values())if(t.scenario===e&&("starting"===t.status||"running"===t.status||"paused"===t.status))return t;return null}async syncRuntime(e){let t=null;try{t=await this.rest.runtime(e)}catch{return}hn(()=>{var i;const s=this.ensure(e,t.scenario);if(s.vars=t.vars,s.callStack=t.callStack,s.wheel=t.wheel??"human",s.mode=t.mode??"debug",s.breakpoints=t.breakpoints??[],"completed"===(r=s.status)||"failed"===r||"aborted"===r)return;var r;const n=t.state;"paused-step"!==n&&"paused-failure"!==n&&"paused-breakpoint"!==n||(s.status="paused",t.current&&(s.pausedAt={reason:"paused-breakpoint"===n?"breakpoint":"paused-failure"===n?"failure":"step",file:(null==(i=t.callStack.at(-1))?void 0:i.file)??null,line:t.current.line,col:t.current.col}))})}ensureCollection(e,t){let i=this.collectionByRunId.get(e);if(i)t&&!i.collection&&(i.collection=t);else{this.byRunId.delete(e);const s={runId:e,collection:t,startedAt:Date.now(),status:"starting",scenarios:[],childRunIds:new Map,childOutcomes:new Map,outcome:null,events:[]};this.collectionByRunId.set(e,s),i=this.collectionByRunId.get(e)}return i}ensure(e,t){let i=this.byRunId.get(e);if(i)t&&!i.scenario&&(i.scenario=t);else{const s={runId:e,scenario:t,startedAt:Date.now(),status:"starting",events:[],logs:[],outcome:null,pausedAt:null,vars:{},callStack:[],picker:{active:!1,mode:"locator",execute:!1},wheel:"human",mode:"debug",breakpoints:[],plainRun:!1,consoleEntries:[],toolCalls:[]};this.byRunId.set(e,s),i=this.byRunId.get(e)}return i}applyStep(e,t){const i=this.ensure(e,"");if("locator:picked"!==t.kind)if("wheel:changed"!==t.kind){if("probe:result"===t.kind){const e=i.consoleEntries.find(e=>e.id===t.id);return void(e&&(e.status="done",e.result=t.result))}if("tool:call"!==t.kind){if("tool:result"===t.kind){const e=i.toolCalls.find(e=>e.callId===t.callId),s={status:t.ok?"ok":"error",durationMs:t.durationMs,preview:t.preview,...t.error?{error:t.error}:{}};return void(e?Object.assign(e,s):i.toolCalls.push({callId:t.callId,at:KD(t.t),tool:t.tool,args:"",...s}))}i.events.push(t),"run:started"===t.kind?(i.status="running",t.scenario&&(i.scenario=t.scenario)):"run:finished"===t.kind?(i.status=this.statusFromOutcome(t.outcome),i.outcome=t.outcome,i.pausedAt=null,i.picker={active:!1,mode:i.picker.mode,execute:i.picker.execute}):"paused"===t.kind?(i.status="paused",i.pausedAt={reason:t.reason,file:t.file,line:t.line,col:t.col},t.snapshot&&(i.vars=t.snapshot.vars,i.callStack=t.snapshot.callStack)):"resumed"!==t.kind&&"step:started"!==t.kind||("paused"===i.status&&(i.status="running"),i.pausedAt=null)}else i.toolCalls.push({callId:t.callId,at:KD(t.t),tool:t.tool,args:t.args,status:"running"})}else i.wheel=t.owner}applyCollectionStep(e,t){hn(()=>{const i=this.ensureCollection(e,"");switch(i.events.push(t),t.kind){case"collection-run:started":return i.status="running",i.collection=t.collection,void(i.scenarios=[...t.scenarios]);case"collection-run:scenario-started":return void i.childRunIds.set(t.scenario,t.scenarioRunId);case"collection-run:scenario-finished":return void i.childOutcomes.set(t.scenario,t.outcome);case"collection-run:finished":return i.status=this.statusFromOutcome(t.outcome),void(i.outcome=t.outcome)}})}applyFinished(e,t){const i=this.collectionByRunId.get(e);if(i)return i.status=this.statusFromOutcome(t),void(i.outcome=t);const s=this.byRunId.get(e);s&&(s.status=this.statusFromOutcome(t),s.outcome=t)}statusFromOutcome(e){switch(e){case"completed":return"completed";case"failed":return"failed";case"aborted":case"interrupted":return"aborted"}}}function KD(e){return new Date(e).toISOString().slice(11,23)}class UD{constructor(e){this.rest=e,this.status={available:!1,state:"stopped",log:[]},this.error=null,this.busy=!1,this.pollTimer=null,Wn(this,{},{autoBind:!0})}async load(){try{const e=await this.rest.appServerStatus();hn(()=>{this.status=e,this.error=null}),this.syncPolling()}catch(e){hn(()=>{this.error=e instanceof Error?e.message:String(e)})}}async start(){await this.act(()=>this.rest.appServerStart())}async stop(){await this.act(()=>this.rest.appServerStop())}browse(e,t){return this.rest.fsBrowse(e,t)}async act(e){this.busy=!0,this.error=null;try{const t=await e();hn(()=>{this.status=t}),this.syncPolling()}catch(t){hn(()=>{this.error=t instanceof Error?t.message:String(t)})}finally{hn(()=>{this.busy=!1})}}syncPolling(){const e="starting"===this.status.state;e&&null===this.pollTimer?this.pollTimer=setInterval(()=>{this.load()},1e3):e||null===this.pollTimer||(clearInterval(this.pollTimer),this.pollTimer=null)}destroy(){null!==this.pollTimer&&clearInterval(this.pollTimer),this.pollTimer=null}}class qD{constructor(e,t={}){this.rest=e,this.byScenario=new Map,this.saveTimer=null,this.saveDebounceMs=t.saveDebounceMs??200,Wn(this,{},{autoBind:!0})}async load(){let e;try{e=await this.rest.getBreakpoints()}catch{e={version:1,scenarios:{}}}hn(()=>{this.byScenario.clear();for(const[t,i]of Object.entries(e.scenarios))this.byScenario.set(t,new Set(i.map($D)))})}get(e){return this.byScenario.get(e)??new Set}has(e,t,i){var s;return(null==(s=this.byScenario.get(e))?void 0:s.has(`${t}:${i}`))??!1}toggle(e,t,i){const s=`${t}:${i}`;this.byScenario.has(e)||this.byScenario.set(e,new Set);const r=this.byScenario.get(e),n=r.has(s);return n?r.delete(s):r.add(s),0===r.size&&this.byScenario.delete(e),this.scheduleSave(),!n}remove(e,t,i){const s=this.byScenario.get(e);s&&(s.delete(`${t}:${i}`),0===s.size&&this.byScenario.delete(e),this.scheduleSave())}clear(e){e?this.byScenario.delete(e):this.byScenario.clear(),this.scheduleSave()}all(){return[...this.byScenario.entries()].map(([e,t])=>({scenario:e,keys:[...t].sort()}))}scheduleSave(){var e,t;this.saveTimer&&clearTimeout(this.saveTimer),this.saveTimer=setTimeout(()=>{this.saveTimer=null,this.save()},this.saveDebounceMs),null==(t=(e=this.saveTimer).unref)||t.call(e)}async save(){const e={version:1,scenarios:Object.fromEntries([...this.byScenario.entries()].map(([e,t])=>[e,[...t].map(VD)]))};try{await this.rest.putBreakpoints(e)}catch{console.warn("[breakpoints] save failed")}}}function $D(e){return`${e.line}:${e.col}`}function VD(e){const[t,i]=e.split(":");return{line:Number(t),col:Number(i)}}function YD(e){return`${e.source}\0${e.key}`}class GD{constructor(e){this.rest=e,this.loading=!1,this.saving=!1,this.error=null,this.warnings=[],this.base=[],this.edits=new Map,this.revealed=new Set,this.activated=new Set,Wn(this,{},{autoBind:!0})}async load(){this.loading=!0,this.error=null;try{const e=await this.rest.getVariables();hn(()=>{this.base=e.vars,this.edits.clear(),this.activated.clear(),this.warnings=[]})}catch(e){hn(()=>{this.error=e instanceof Error?e.message:String(e),this.base=[]})}finally{hn(()=>{this.loading=!1})}}get count(){return this.base.length}get rows(){return this.base.map(e=>{const t=YD(e);return this.edits.has(t)?{...e,value:this.edits.get(t)}:e})}filtered(e){const t=e.trim().toLowerCase();return t?this.rows.filter(e=>e.key.toLowerCase().includes(t)):this.rows}effectiveValue(e){var t;const i=YD(e);return this.edits.has(i)?this.edits.get(i):(null==(t=this.base.find(e=>YD(e)===i))?void 0:t.value)??""}setValue(e,t){var i;const s=YD(e);t===((null==(i=this.base.find(e=>YD(e)===s))?void 0:i.value)??"")?this.edits.delete(s):this.edits.set(s,t)}toggleBool(e){this.setValue(e,"1"===this.effectiveValue(e)?"0":"1")}toggleReveal(e){const t=YD(e);this.revealed.has(t)?this.revealed.delete(t):this.revealed.add(t)}isRevealed(e){return this.revealed.has(YD(e))}isEdited(e){return this.edits.has(YD(e))}activate(e){e.commented&&this.activated.add(YD(e))}isActivated(e){return this.activated.has(YD(e))}get dirty(){return this.edits.size>0||this.activated.size>0}async save(){if(this.dirty&&!this.saving){this.saving=!0,this.error=null;try{const e={env:{},secrets:{}};for(const t of this.base){const i=YD(t);(this.edits.has(i)||this.activated.has(i))&&(e[t.source][t.key]=this.effectiveValue(t))}for(const t of["env","secrets"]){const i=e[t];0!==Object.keys(i).length&&await this.rest.putVariables({version:1,source:t,values:i})}await this.load()}catch(e){hn(()=>{this.error=e instanceof Error?e.message:String(e)})}finally{hn(()=>{this.saving=!1})}}}dismissWarnings(){this.warnings=[]}async addVariable(e,t,i){this.saving=!0,this.error=null;try{const s=await this.rest.addVariable({version:1,name:e,value:t,kind:i});return await this.load(),hn(()=>{this.warnings=s.warnings}),!0}catch(s){return hn(()=>{this.error=s instanceof Error?s.message:String(s)}),!1}finally{hn(()=>{this.saving=!1})}}async deleteVariable(e){this.saving=!0,this.error=null;try{const t=await this.rest.deleteVariable({version:1,name:e.key,source:e.source});await this.load(),hn(()=>{this.warnings=t.warnings})}catch(t){hn(()=>{this.error=t instanceof Error?t.message:String(t)})}finally{hn(()=>{this.saving=!1})}}}class XD{constructor(e,t){this.rest=e,this.active=t,this.items=[],this.loading=!1,this.error=null,Wn(this,{},{autoBind:!0})}pathFor(e){return`${N_}/${this.active.activeTestDir}/_collections/${e}.yaml`}get count(){return this.items.length}async load(){this.loading=!0,this.error=null;try{const e=await this.rest.collections();hn(()=>{this.items=e,this.loading=!1})}catch(e){hn(()=>{this.error=e instanceof Error?e.message:String(e),this.loading=!1})}}clearError(){this.error=null}setError(e){this.error=e}byPath(e){return this.items.find(t=>t.path===e)}nameTaken(e,t){const i=e.toLowerCase();return this.items.some(e=>e.name.toLowerCase()===i&&e.path!==t)}async create(e,t=null){const i=e.trim();if(!i||this.nameTaken(i))return null;const s=this.items,r={name:i,path:this.pathFor(i),description:t,scenarios:[],workers:null,prepare:null};this.items=[r,...s],this.error=null;try{const e=await this.rest.createCollection({name:i,description:t});return hn(()=>{this.items=this.items.map(t=>t.path===r.path?e:t)}),e}catch(n){return hn(()=>{this.items=s,this.error=JD(n)}),null}}async rename(e,t){const i=t.trim();if(!i)return null;if(this.nameTaken(i,e))return null;const s=this.byPath(e);if(!s)return null;if(s.name===i)return s;const r=this.items,n={...s,name:i,path:this.pathFor(i)};this.items=r.map(t=>t.path===e?n:t),this.error=null;try{const e=await this.rest.renameCollection(s.name,i);return hn(()=>{this.items=this.items.map(t=>t.path===n.path?e:t)}),e}catch(o){return hn(()=>{this.items=r,this.error=JD(o)}),null}}async delete(e){const t=this.byPath(e);if(!t)return!1;const i=this.items;this.items=i.filter(t=>t.path!==e),this.error=null;try{return await this.rest.deleteCollection(t.name),!0}catch(s){return hn(()=>{this.items=i,this.error=JD(s)}),!1}}async setDescription(e,t){await this.patch(e,{description:t})}async setWorkers(e,t){await this.patch(e,{workers:t})}async addScenario(e,t){const i=this.byPath(e);i&&!i.scenarios.includes(t)&&await this.patch(e,{scenarios:[...i.scenarios,t]})}async removeScenario(e,t){const i=this.byPath(e);i&&await this.patch(e,{scenarios:i.scenarios.filter(e=>e!==t)})}async reorderScenarios(e,t){await this.patch(e,{scenarios:[...t]})}async patch(e,t){const i=this.byPath(e);if(!i)return;const s=this.items,r={...i,description:void 0===t.description?i.description:t.description,scenarios:void 0===t.scenarios?i.scenarios:t.scenarios,workers:void 0===t.workers?i.workers:t.workers};this.items=s.map(t=>t.path===e?r:t),this.error=null;try{const s=await this.rest.patchCollection(i.name,t);hn(()=>{this.items=this.items.map(t=>t.path===e?s:t)})}catch(n){hn(()=>{this.items=s,this.error=JD(n)})}}}function JD(e){return e instanceof Error?e.message:String(e)}class ZD{constructor(e){this.rest=e,this.vocab=[],this.helpers=[],this.loaded=!1,Wn(this,{},{autoBind:!0})}async load(){if(!this.loaded){this.loaded=!0;try{const[e,t]=await Promise.all([this.rest.dslVocab(),this.rest.dslHelpers()]);hn(()=>{this.vocab=e,this.helpers=t})}catch{this.loaded=!1}}}async reload(){this.loaded=!1,await this.load()}async refreshHelpers(){if(this.loaded)try{const e=await this.rest.dslHelpers();hn(()=>{this.helpers=e})}catch{}}get entries(){return[...this.vocab,...this.helpers]}validate(e,t){return this.rest.validateDsl(e,t)}}class QD{constructor(){this.handles=new Map,this.reveals=nr.map(),this.revealSeq=0}requestReveal(e,t){hn(()=>this.reveals.set(e,{line:t,seq:++this.revealSeq}))}pendingReveal(e){return this.reveals.get(e)}consumeReveal(e,t){hn(()=>{var i;(null==(i=this.reveals.get(e))?void 0:i.seq)===t&&this.reveals.delete(e)})}register(e,t){return this.handles.set(e,t),()=>{this.handles.get(e)===t&&this.handles.delete(e)}}insertAtCursor(e,t){const i=this.handles.get(e);return!!i&&(i.insertAtCursor(t),!0)}}class eL{constructor(e,t){this.rest=e,this.onSwitched=t,this.names=[],this.active=null,this.switching=!1,Wn(this,{},{autoBind:!0})}async load(){try{const e=await this.rest.environments();hn(()=>{this.names=e.names,this.active=e.active})}catch{}}async setActive(e){if(e!==this.active&&!this.switching){hn(()=>{this.switching=!0});try{const t=await this.rest.setActiveEnvironment(e);hn(()=>{this.names=t.names,this.active=t.active}),this.onSwitched()}catch{}finally{hn(()=>{this.switching=!1})}}}get hasAny(){return this.names.length>0}}class tL{constructor(e){this.rest=e,this.items=[],this.loading=!1,this.error=null,Wn(this,{},{autoBind:!0})}get count(){return this.items.length}async load(){this.loading=!0,this.error=null;try{const e=await this.rest.helpers();hn(()=>{this.items=e,this.loading=!1})}catch(e){hn(()=>{this.error=e instanceof Error?e.message:String(e),this.loading=!1})}}}class iL{constructor(e){this.rest=e,this.byRunId=new Map,this.pending=new Set,this.errors=new Map,Wn(this,{},{autoBind:!0})}get(e){return this.byRunId.get(e)??null}async loadIfNeeded(e){if(!this.byRunId.has(e)&&!this.pending.has(e)){this.pending.add(e),this.errors.delete(e);try{const t=await this.rest.runDetail(e);hn(()=>{this.byRunId.set(e,t),this.pending.delete(e)})}catch(t){hn(()=>{this.errors.set(e,t instanceof Error?t.message:String(t)),this.pending.delete(e)})}}}invalidate(e){this.byRunId.delete(e),this.errors.delete(e)}}const sL="layout",rL={treeOpen:!0,treeWidth:280,inspectorOpen:!0,inspectorWidth:380};class nL{constructor(){const e=gB(sL,rL);this.treeOpen=e.treeOpen,this.treeWidth=Math.max(200,e.treeWidth),this.inspectorOpen=e.inspectorOpen,this.inspectorWidth=Math.max(240,e.inspectorWidth),Wn(this,{},{autoBind:!0})}toggleTree(){this.treeOpen=!this.treeOpen}openTree(){this.treeOpen=!0}setTreeWidth(e){this.treeWidth=Math.max(200,e)}toggleInspector(){this.inspectorOpen=!this.inspectorOpen}setInspectorWidth(e){this.inspectorWidth=Math.max(240,e)}get treeMin(){return 200}get inspectorMin(){return 240}get storageKey(){return sL}toPersisted(){return{treeOpen:this.treeOpen,treeWidth:this.treeWidth,inspectorOpen:this.inspectorOpen,inspectorWidth:this.inspectorWidth}}}class oL{constructor(e,t,i){this.scenarios=e,this.runs=t,this.active=i,Wn(this,{},{autoBind:!0})}get rows(){const e=this.active.liveRefs;return this.scenarios.items.map(t=>{const i=this.runs.latest[t.name];return i?{ref:t.name,path:t.path,status:lj(i.lastStatus,t.expectFail),live:e.get(t.name)??null,expectFail:t.expectFail,lastAt:i.lastAt,durationMs:i.lastDurationMs,failStreak:i.failStreak,recent:i.recent}:{ref:t.name,path:t.path,status:"never",live:e.get(t.name)??null,expectFail:t.expectFail,lastAt:null,durationMs:null,failStreak:0,recent:[]}}).sort((e,t)=>e.ref.localeCompare(t.ref))}get counts(){const e=this.rows;return{all:e.length,passed:e.filter(e=>"passed"===e.status).length,failed:e.filter(e=>"failed"===e.status).length,expected:e.filter(e=>"expected"===e.status).length,never:e.filter(e=>"never"===e.status).length}}get failing(){return this.rows.filter(e=>"failed"===e.status).sort((e,t)=>(t.lastAt??0)-(e.lastAt??0))}get indexReady(){return this.runs.indexReady}}class aL{constructor(e){this.rest=e,this.waiting=[],this.running=[],this.slots={total:0,used:0},this.enabled=!0,this.loading=!1,Wn(this,{},{autoBind:!0})}get waitingCount(){return this.waiting.length}async load(){let e;this.loading=!0;try{e=await this.rest.queue()}catch{return void hn(()=>{this.loading=!1})}hn(()=>{this.waiting=e.waiting,this.running=e.running,this.slots=e.slots,this.enabled=e.enabled,this.loading=!1})}async cancel(e){try{await this.rest.cancelQueued(e)}finally{await this.load()}}}const lL=[500,1e3,2e3,5e3,1e4,3e4];class cL{constructor(e){this.rest=e,this.items=[],this.latest={},this.loading=!1,this.loadingMore=!1,this.error=null,this.indexReady=!0,this.exhausted=!1,this.scenarioFilter=null,this.indexRetryStep=0,this.indexRetryTimer=null,Wn(this,{},{autoBind:!0})}lastRunByRef(e,t){if("scenario"===e){const e=this.latest[t];if(e)return function(e,t){return{runId:t.lastRunId,kind:"scenario",ref:e,startedAt:t.lastAt,finishedAt:null,durationMs:t.lastDurationMs,status:t.lastStatus,outcome:null}}(t,e)}let i=null;for(const s of this.items)s.kind===e&&s.ref===t&&(!i||s.startedAt>i.startedAt)&&(i=s);return i}get failed(){return this.items.filter(e=>"failed"===e.status)}get passed(){return this.items.filter(e=>"passed"===e.status)}get running(){return this.items.filter(e=>"running"===e.status)}get hasMore(){return!this.exhausted&&this.items.length>0}async setScenarioFilter(e){this.scenarioFilter!==e&&(this.scenarioFilter=e,await this.load())}async load(){this.clearIndexRetry(),this.loading=!0,this.error=null;try{const[e,t]=await Promise.all([this.rest.runs({limit:50,...this.scenarioFilter?{scenario:this.scenarioFilter}:{}}),this.loadLatest()]);hn(()=>{this.items=e.runs,this.exhausted=e.exhausted,this.indexReady=e.indexReady,this.latest=t,this.loading=!1}),e.indexReady?this.indexRetryStep=0:this.scheduleIndexRetry()}catch(e){hn(()=>{this.error=e instanceof Error?e.message:String(e),this.loading=!1})}}scheduleIndexRetry(){const e=lL[Math.min(this.indexRetryStep,lL.length-1)];this.indexRetryStep++,this.indexRetryTimer=setTimeout(()=>{this.indexRetryTimer=null,this.load()},e)}clearIndexRetry(){null!==this.indexRetryTimer&&(clearTimeout(this.indexRetryTimer),this.indexRetryTimer=null)}async loadMore(){if(this.loadingMore||this.loading||this.exhausted)return;const e=this.items[this.items.length-1];if(e){this.loadingMore=!0;try{const t=await this.rest.runs({limit:50,before:e.startedAt,...this.scenarioFilter?{scenario:this.scenarioFilter}:{}});hn(()=>{const e=new Set(this.items.map(e=>e.runId));this.items=[...this.items,...t.runs.filter(t=>!e.has(t.runId))],this.exhausted=t.exhausted,this.indexReady=t.indexReady,this.loadingMore=!1})}catch(t){hn(()=>{this.error=t instanceof Error?t.message:String(t),this.loadingMore=!1})}}}async loadLatest(){try{return await this.rest.runsLatest()}catch{return{}}}}class hL{constructor(e){this.rest=e,this.byRunId=new Map,this.pending=new Set,Wn(this,{},{autoBind:!0})}get(e){return this.byRunId.get(e)}async loadIfNeeded(e){if(!this.byRunId.has(e)&&!this.pending.has(e)){this.pending.add(e);try{const t=await this.rest.runDetail(e),i="sources"in t?t.sources:null;hn(()=>{this.byRunId.set(e,i),this.pending.delete(e)})}catch{hn(()=>{this.pending.delete(e)})}}}}class uL{constructor(e){this.rest=e,this.byRunId=new Map,this.pending=new Set,Wn(this,{},{autoBind:!0})}get(e){return this.byRunId.get(e)}async loadIfNeeded(e){if(!this.byRunId.has(e)&&!this.pending.has(e)){this.pending.add(e);try{const t=await this.rest.runtime(e);hn(()=>{this.byRunId.set(e,t),this.pending.delete(e)})}catch{hn(()=>{this.byRunId.set(e,null),this.pending.delete(e)})}}}invalidate(e){this.byRunId.delete(e)}}const dL="scenarios.expanded";class fL{constructor(e,t,i,s=""){this.rest=e,this.tabs=t,this.active=i,this.items=[],this.folders=[],this.loading=!1,this.error=null,this.clipboard=null,this.creating=null,this.renaming=null,this.menu=null,this.selected=null,this.pendingDelete=null,this.actionError=null,this.scope=s,this.expanded=gB(vB(dL,s),{}),Wn(this,{},{autoBind:!0})}setScope(e){e!==this.scope&&(this.scope=e,this.expanded=gB(this.storageKey,{}))}get storageKey(){return vB(dL,this.scope)}get count(){return this.items.length}async load(){this.loading=!0,this.error=null;try{const e=await this.rest.scenarios();hn(()=>{this.items=e.scenarios,this.folders=e.folders,this.loading=!1})}catch(e){hn(()=>{this.error=e instanceof Error?e.message:String(e),this.loading=!1})}}buildTree(e){var t,i;const s=e.trim().toLowerCase(),r=new Set(this.folders);for(const a of this.items){let e=pD(a.name);for(;e;)r.add(e),e=pD(e)}const n=new Map;for(const a of r)n.set(a,{rel:a,name:fD(a),folders:[],scenarios:[]});const o={folders:[],scenarios:[]};for(const a of[...r].sort()){const e=n.get(a),i=pD(a);""===i?o.folders.push(e):null==(t=n.get(i))||t.folders.push(e)}for(const a of this.items){const e=pD(a.name),t=""===e?o.scenarios:null==(i=n.get(e))?void 0:i.scenarios;null==t||t.push(a)}return function(e,t,i){const s=e=>{const r=e.folders.map(s).filter(e=>null!==e).sort((e,t)=>e.name.localeCompare(t.name)),n=!!t&&e.name.toLowerCase().includes(t),o=(n?e.scenarios:e.scenarios.filter(i)).slice().sort((e,t)=>e.name.localeCompare(t.name));return t&&0===r.length&&0===o.length&&!n?null:{...e,folders:r,scenarios:o}};return{folders:e.folders.map(s).filter(e=>null!==e).sort((e,t)=>e.name.localeCompare(t.name)),scenarios:e.scenarios.filter(i).slice().sort((e,t)=>e.name.localeCompare(t.name))}}(o,s,e=>!s||e.name.toLowerCase().includes(s)||e.path.toLowerCase().includes(s)||e.title.toLowerCase().includes(s))}isExpanded(e){return this.expanded[e]??!0}toggle(e){this.expanded[e]=!this.isExpanded(e)}select(e){this.selected=e}openMenu(e,t,i){this.selected=i,this.menu={x:e,y:t,target:i}}closeMenu(){this.menu=null}startCreate(e,t){this.creating={parent:e,kind:t},""!==e&&(this.expanded[e]=!0),this.closeMenu()}cancelCreate(){this.creating=null}startRename(e){"blank"!==e.kind&&(this.renaming=e),this.closeMenu()}cancelRename(){this.renaming=null}copy(e){"scenario"===e.kind?this.clipboard={kind:"scenario",rel:e.rel,label:gD(fD(e.rel))}:"folder"===e.kind&&(this.clipboard={kind:"folder",rel:e.rel,label:fD(e.rel)}),this.closeMenu()}copyPath(e){var t;if("blank"===e.kind)return;const i=`${N_}/${M_}/${e.rel}`;null==(t=navigator.clipboard)||t.writeText(i),this.closeMenu()}requestDelete(e){"blank"!==e.kind&&(this.pendingDelete=e),this.closeMenu()}cancelDelete(){this.pendingDelete=null}clearActionError(){this.actionError=null}async commitCreate(e){const t=this.creating;this.creating=null,t&&await this.run(async()=>{if("folder"===t.kind){const{folder:i}=await this.rest.createFolder(t.parent,e);hn(()=>{this.expanded[i]=!0}),await this.load()}else{const{scenario:i}=await this.rest.createScenario(t.parent,e);await this.load(),this.tabs.openScenario(this.proj(i)),hn(()=>{this.selected={kind:"scenario",rel:i}})}})}async commitRename(e){const t=this.renaming;this.renaming=null,t&&"blank"!==t.kind&&await this.run(async()=>{const{from:i,to:s}=await this.rest.renameScenarioNode(t.rel,e);"scenario"===t.kind?this.tabs.retargetScenarioPath(this.proj(i),this.proj(s)):(this.tabs.retargetScenarioPrefix(this.proj(i),this.proj(s)),hn(()=>{this.expanded[s]=this.expanded[i]??!0,delete this.expanded[i]})),await this.load()})}async paste(e){const t=this.clipboard;this.closeMenu(),t&&await this.run(async()=>{const{created:i}=await this.rest.copyScenarioNode(t.rel,e);hn(()=>{""!==e&&(this.expanded[e]=!0)}),await this.load(),hn(()=>{this.renaming="folder"===t.kind?{kind:"folder",rel:i}:{kind:"scenario",rel:i},this.selected=this.renaming})})}async confirmDelete(){const e=this.pendingDelete;this.pendingDelete=null,e&&"blank"!==e.kind&&await this.run(async()=>{await this.rest.deleteScenarioNode(e.rel),"scenario"===e.kind?this.tabs.closeScenarioPath(this.proj(e.rel)):this.tabs.closeScenarioPrefix(this.proj(e.rel)),await this.load()})}async run(e){this.actionError=null;try{await e()}catch(t){hn(()=>{this.actionError=t instanceof Error?t.message:String(t)})}}proj(e){return`${N_}/${this.active.activeTestDir}/${e}`}}const pL={canRun:!0,canEditFiles:!0,canTerminal:!0,canBrowseFs:!0};class gL{constructor(e){this.rest=e,this.capabilities=pL,this.identity=null,Wn(this,{},{autoBind:!0})}async load(){try{const e=await this.rest.session();hn(()=>{this.capabilities=e.capabilities,this.identity=e.identity})}catch{}}get restricted(){const e=this.capabilities;return!(e.canRun&&e.canEditFiles&&e.canTerminal&&e.canBrowseFs)}}class vL{constructor(e){this.rest=e,this.list=[],this.loaded=!1,Wn(this,{},{autoBind:!0})}manifestOf(e){var t;return null==(t=this.list.find(t=>t.snapshotId===e))?void 0:t.manifest}async load(){try{const e=await this.rest.snapshots();hn(()=>{this.list=e})}catch{}finally{hn(()=>{this.loaded=!0})}}async importFile(e){const t=await this.rest.importSnapshot(e);return hn(()=>{const e=this.list.findIndex(e=>e.snapshotId===t.snapshotId);e>=0?this.list[e]=t:this.list.unshift(t)}),t.snapshotId}async remove(e){await this.rest.deleteSnapshot(e),hn(()=>{this.list=this.list.filter(t=>t.snapshotId!==e)})}}class mL{constructor(e){this.rest=e,this.cache=new Map,this.inflight=new Map,this.loading=new Set,this.errors=new Map,this.drafts=new Map,this.conflicts=new Set,this.saving=new Set,Wn(this,{},{autoBind:!0})}get(e){return this.cache.get(e)}draft(e){return this.drafts.has(e)?this.drafts.get(e):this.cache.get(e)}setDraft(e,t){if(this.cache.get(e)===t?this.drafts.delete(e):this.drafts.set(e,t),this.conflicts.has(e)){const t=new Set(this.conflicts);t.delete(e),this.conflicts=t}}insertAfterLine(e,t,i){var s;const r=this.draft(e);if(void 0===r)return;const n=r.split("\n"),o=Math.max(0,Math.min(t,n.length)),a=n[o-1]??n[n.length-1]??"",l=(null==(s=/^[ \t]*/.exec(a))?void 0:s[0])??"";n.splice(o,0,`${l}${i}`),this.setDraft(e,n.join("\n"))}insertBeforeLastLine(e,t){var i;const s=this.draft(e);if(void 0===s)return;const r=s.split("\n");let n=r.length;for(;n>0&&""===r[n-1].trim();)n--;const o=Math.max(0,n-1),a=(null==(i=/^[ \t]*/.exec(r[o]??""))?void 0:i[0])??"";r.splice(o,0,`${a} ${t}`),this.setDraft(e,r.join("\n"))}isDirty(e){return this.drafts.has(e)}isSaving(e){return this.saving.has(e)}hasConflict(e){return this.conflicts.has(e)}discardDraft(e){this.drafts.delete(e);const t=new Set(this.conflicts);t.delete(e),this.conflicts=t}async save(e){const t=this.drafts.get(e);if(void 0!==t){hn(()=>{const t=new Set(this.saving);t.add(e),this.saving=t});try{await this.rest.writeSource(e,t),hn(()=>{this.cache.set(e,t),this.drafts.delete(e);const i=new Set(this.conflicts);i.delete(e),this.conflicts=i,this.errors.delete(e)})}catch(i){throw hn(()=>{this.errors.set(e,i instanceof Error?i.message:String(i))}),i}finally{hn(()=>{const t=new Set(this.saving);t.delete(e),this.saving=t})}}}isLoading(e){return this.loading.has(e)}error(e){return this.errors.get(e)??null}async getOrLoad(e){const t=this.cache.get(e);if(void 0!==t)return t;const i=this.inflight.get(e);if(i)return i;const s=this.fetch(e);this.inflight.set(e,s),hn(()=>{const t=new Set(this.loading);t.add(e),this.loading=t});try{return await s}finally{this.inflight.delete(e),hn(()=>{const t=new Set(this.loading);t.delete(e),this.loading=t})}}invalidate(e){const t=void 0!==e?[e]:Array.from(this.cache.keys());for(const i of t)this.errors.delete(i),this.refresh(i)}async refresh(e){if(this.inflight.has(e))return;const t=this.fetch(e);this.inflight.set(e,t);try{await t}catch{}finally{this.inflight.delete(e)}}async fetch(e){try{const t=this.cache.get(e),{content:i}=await this.rest.source(e);return hn(()=>{this.cache.set(e,i),this.errors.delete(e);const s=this.drafts.get(e);if(void 0!==s&&s!==i&&t!==i){const t=new Set(this.conflicts);t.add(e),this.conflicts=t}}),i}catch(t){const i=t instanceof Error?t.message:String(t);throw hn(()=>{this.errors.set(e,i),this.cache.delete(e)}),t}}}const _L="tabs.openTabs",bL="overview";class xL{constructor(e=""){this.scope=e;const t=gB(vB(_L,e),{tabs:[],activeKey:null});this.hydrate(t),Wn(this,{},{autoBind:!0})}hydrate(e){const t=e.tabs.filter(e=>"overview"!==e.kind);this.tabs=[{kind:"overview"},...t];const i=e.activeKey,s=null!=i&&this.tabs.some(e=>this.keyFor(e)===i);this.activeKey=s?i:t.length?this.keyFor(t[t.length-1]):bL}setScope(e){if(e===this.scope)return;this.scope=e;const t=gB(this.storageKey,{tabs:[],activeKey:null});this.hydrate(t)}open(e){const t=this.keyFor(e);this.tabs.some(e=>this.keyFor(e)===t)||this.tabs.push(e),this.activeKey=t}close(e){if(e===bL)return;const t=this.tabs.findIndex(t=>this.keyFor(t)===e);if(!(t<0)&&(this.tabs.splice(t,1),this.activeKey===e)){const e=this.tabs[t]??this.tabs[t-1]??this.tabs[0];this.activeKey=this.keyFor(e)}}activate(e){this.tabs.some(t=>this.keyFor(t)===e)&&(this.activeKey=e)}closeOthers(e){const t=this.tabs.find(t=>this.keyFor(t)===e);if(!t)return;const i=this.tabs[0];this.tabs=t===i?[i]:[i,t],this.activeKey=e}closeAll(){this.tabs=[this.tabs[0]],this.activeKey=bL}renameCollectionTab(e,t){this.swapPath("collection",e,t)}retargetScenarioPath(e,t){this.swapPath("scenario",e,t)}retargetScenarioPrefix(e,t){const i=yL(e),s=yL(t);let r=null;this.tabs=this.tabs.map(e=>{if("scenario"===e.kind&&e.path.startsWith(i)){const t=s+e.path.slice(i.length);return this.activeKey===`scenario:${e.path}`&&(r=t),{kind:"scenario",path:t}}return e}),r&&(this.activeKey=`scenario:${r}`)}closeScenarioPath(e){this.close(`scenario:${e}`)}closeScenarioPrefix(e){const t=yL(e);for(const i of[...this.tabs])"scenario"===i.kind&&i.path.startsWith(t)&&this.close(`scenario:${i.path}`)}openScenario(e){this.open({kind:"scenario",path:e})}swapPath(e,t,i){if(t===i)return;const s=this.tabs.findIndex(i=>i.kind===e&&i.path===t);if(s<0)return;const r=this.activeKey===`${e}:${t}`;this.tabs.splice(s,1,{kind:e,path:i}),r&&(this.activeKey=`${e}:${i}`)}get activeTab(){return this.tabs.find(e=>this.keyFor(e)===this.activeKey)??this.tabs[0]}keyFor(e){switch(e.kind){case"overview":return bL;case"scenario":case"helper":case"collection":return`${e.kind}:${e.path}`;case"scenario-run":case"collection-run":return`${e.kind}:${e.runId}`;case"snapshot":return`snapshot:${e.snapshotId}`}}toPersisted(){return{tabs:this.tabs.filter(e=>"overview"!==e.kind),activeKey:this.activeKey}}get storageKey(){return vB(_L,this.scope)}}function yL(e){return e.endsWith("/")?e:`${e}/`}class wL{constructor(e){this.rest=e,this.checks=null,this.error=null,this.busy=!1,this.checkedTarget=null,Wn(this,{},{autoBind:!0})}async run(e){this.busy=!0,this.error=null;try{const{checks:t}=await this.rest.targetDoctor(e);hn(()=>{this.checks=t,this.checkedTarget=e})}catch(t){hn(()=>{this.error=t instanceof Error?t.message:String(t),this.checks=null,this.checkedTarget=null})}finally{hn(()=>{this.busy=!1})}}reset(){this.checks=null,this.error=null,this.checkedTarget=null}get hasErrors(){var e;return(null==(e=this.checks)?void 0:e.some(e=>"error"===e.severity))??!1}}const SL="target.active";class kL{constructor(e,t){this.rest=e,this.onSwitched=t,this.available=[],this.active="",this.projectRoot="",this.switching=!1,Wn(this,{},{autoBind:!0})}async load(){try{const e=await this.rest.targets(),t=gB(SL,null),i=e.targets.find(e=>e.target===t);if(t&&t!==e.active&&i&&(!i.host||i.host.ok)){const e=await this.rest.setActiveTarget(t);return hn(()=>{this.available=e.targets,this.active=e.active,this.projectRoot=e.projectRoot}),void this.onSwitched()}hn(()=>{this.available=e.targets,this.active=e.active,this.projectRoot=e.projectRoot})}catch{}}async setActive(e){if(e===this.active||this.switching)return;const t=this.available.find(t=>t.target===e);if(!(null==t?void 0:t.host)||t.host.ok){hn(()=>{this.switching=!0});try{const t=await this.rest.setActiveTarget(e);hn(()=>{this.available=t.targets,this.active=t.active,this.projectRoot=t.projectRoot}),mB(SL,this.active),this.onSwitched()}catch{}finally{hn(()=>{this.switching=!1})}}}get current(){return this.available.find(e=>e.target===this.active)}get activeTestDir(){var e;return(null==(e=this.current)?void 0:e.testDir)??M_}get activeSuffix(){var e;return(null==(e=this.current)?void 0:e.suffix)??""}get activeDebugCaps(){var e;return(null==(e=this.current)?void 0:e.debug)??{picker:!0,attach:!0,resumeFromFailure:!1}}get hasMultiple(){return this.available.length>1}}class CL{constructor(e,t){this.rest=e,this.onSwitched=t,this.file=null,this.posting=!1,this.pendingBundleId=null,this.error=null,this.timer=null,this.fastTimer=null,Wn(this,{},{autoBind:!0})}get switching(){return this.posting||null!==this.pendingBundleId}get hosted(){return null!==this.file}get current(){const e=this.file;return(null==e?void 0:e.currentBundleId)?e.bundles.find(t=>t.bundleId===e.currentBundleId)??null:null}get label(){var e;return this.file?(null==(e=this.current)?void 0:e.label)??"no bundle yet":null}get canSwitch(){return null!==this.file&&this.file.allowSwitch&&void 0!==this.file.switchPath&&this.file.bundles.length>0}async load(){try{const e=await this.rest.workspace();hn(()=>{this.file=e,null!==this.pendingBundleId&&(null==e?void 0:e.currentBundleId)===this.pendingBundleId&&(this.pendingBundleId=null,this.stopFastPoll(),this.onSwitched())})}catch{hn(()=>{this.file=null})}}start(){this.load(),null===this.timer&&(this.timer=setInterval(()=>{this.load()},3e4))}stop(){null!==this.timer&&clearInterval(this.timer),this.timer=null,this.stopFastPoll()}async switchTo(e){var t;const i=null==(t=this.file)?void 0:t.switchPath;if(void 0!==i&&!this.switching){hn(()=>{this.posting=!0,this.error=null});try{if("switching"===await this.rest.switchBundle(i,e))return hn(()=>{this.pendingBundleId=e}),void this.startFastPoll();await this.load(),this.onSwitched()}catch(s){hn(()=>{this.error=s instanceof Error?s.message:String(s)})}finally{hn(()=>{this.posting=!1})}}}startFastPoll(){null===this.fastTimer&&(this.fastTimer=setInterval(()=>{this.load()},jL))}stopFastPoll(){null!==this.fastTimer&&clearInterval(this.fastTimer),this.fastTimer=null}}const jL=3e3,NL="terminal",ML={open:!1,height:300},EL=()=>Math.round(.75*("undefined"!=typeof window?window.innerHeight:900));class BL{constructor(){this.tabs=[],this.activeId=null,this.seq=0;const e=gB(NL,ML);this.open=e.open,this.height=Math.max(140,e.height),Wn(this,{},{autoBind:!0}),this.open&&this.newTerm("local")}toggle(){this.open?this.open=!1:this.show()}show(){this.open=!0,0===this.tabs.length&&this.newTerm("local")}hide(){this.open=!1}setHeight(e){this.height=Math.min(EL(),Math.max(140,e))}newTerm(e){this.seq+=1;const t=`term_${this.seq}`;return this.tabs.push({id:t,kind:e}),this.activeId=t,this.open=!0,t}activate(e){this.tabs.some(t=>t.id===e)&&(this.activeId=e)}closeTerm(e){const t=this.tabs.findIndex(t=>t.id===e);t<0||(this.tabs.splice(t,1),this.activeId===e&&(this.activeId=this.tabs.length?this.tabs[Math.min(t,this.tabs.length-1)].id:null))}get heightMin(){return 140}get heightMax(){return EL()}get activeKind(){var e;return(null==(e=this.tabs.find(e=>e.id===this.activeId))?void 0:e.kind)??null}get storageKey(){return NL}toPersisted(){return{open:this.open,height:this.height}}}const DL="theme.theme";class LL{constructor(){this.system=this.systemPreference(),this.mode=gB(DL,"system"),Wn(this,{},{autoBind:!0}),this.watchSystem()}get theme(){return"system"===this.mode?this.system:this.mode}cycle(){this.mode="light"===this.mode?"dark":"dark"===this.mode?"system":"light"}set(e){this.mode=e}get storageKey(){return DL}setSystem(e){this.system=e}watchSystem(){if("undefined"==typeof window||!window.matchMedia)return;window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",e=>{this.setSystem(e.matches?"dark":"light")})}systemPreference(){return"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}}class RL extends Error{constructor(e,t,i){super(e),this.status=t,this.body=i,this.name="RestClientError"}}yn({enforceActions:"observed",computedRequiresReaction:!1,reactionRequiresObservable:!0,observableRequiresReaction:!1});const PL=document.getElementById("root");if(!PL)throw new Error("missing #root");const AL=new class{constructor(e=""){this.base=e}targets(){return this.getJson("/api/targets")}setActiveTarget(e){return this.postJson("/api/targets/active",{target:e})}targetDoctor(e){return this.postJson(`/api/targets/${encodeURIComponent(e)}/doctor`,{})}environments(){return this.getJson("/api/environments")}setActiveEnvironment(e){return this.postJson("/api/environments/active",{env:e})}schedules(){return this.getJson("/api/schedules")}putSchedules(e){return this.putJson("/api/schedules",{schedules:e})}workspace(){return this.getJson("/api/workspace")}async switchBundle(e,t){const i=await this.postJson(e,{bundleId:t});return"switching"===(null==i?void 0:i.status)?"switching":"done"}scenarios(){return this.getJson("/api/scenarios")}createFolder(e,t){return this.postJson("/api/scenarios/folder",{parent:e,name:t})}createScenario(e,t){return this.postJson("/api/scenarios/scenario",{parent:e,name:t})}renameScenarioNode(e,t){return this.postJson("/api/scenarios/rename",{path:e,newName:t})}copyScenarioNode(e,t){return this.postJson("/api/scenarios/copy",{from:e,destParent:t})}async deleteScenarioNode(e){await this.postJson("/api/scenarios/delete",{path:e})}helpers(){return this.getJson("/api/helpers")}collections(){return this.getJson("/api/collections")}createCollection(e){return this.postJson("/api/collections",e)}patchCollection(e,t){return this.sendJson("PATCH",`/api/collections/${encodeURIComponent(e)}`,t)}renameCollection(e,t){return this.postJson(`/api/collections/${encodeURIComponent(e)}/rename`,{newName:t})}async deleteCollection(e){await this.sendJson("DELETE",`/api/collections/${encodeURIComponent(e)}`,void 0)}runs(e={}){const t=new URLSearchParams;void 0!==e.limit&&t.set("limit",String(e.limit)),void 0!==e.before&&t.set("before",String(e.before)),e.scenario&&t.set("scenario",e.scenario);const i=t.toString();return this.getJson("/api/runs"+(i?`?${i}`:""))}runsLatest(){return this.getJson("/api/runs/latest")}runDetail(e){return this.getJson(`/api/runs/${encodeURIComponent(e)}`)}runChildren(e){return this.getJson(`/api/runs/${encodeURIComponent(e)}/children`)}source(e){return this.getJson(`/api/source?path=${encodeURIComponent(e)}`)}async writeSource(e,t){await this.putJson("/api/source",{path:e,content:t})}dslVocab(){return this.getJson("/api/dsl/vocab")}dslHelpers(){return this.getJson("/api/dsl/helpers")}validateDsl(e,t){return this.postJson("/api/dsl/validate",{source:e,fileKind:t})}startRun(e){return this.postJson("/api/run",e)}async abortRun(e){await this.postJson(`/api/runs/${encodeURIComponent(e)}/abort`,{})}queue(){return this.getJson("/api/queue")}cancelQueued(e){return this.sendJson("DELETE",`/api/queue/${encodeURIComponent(e)}`,void 0)}dbgCommand(e,t){return this.postJson(`/api/runs/${encodeURIComponent(e)}/dbg/command`,t)}runtime(e){return this.getJson(`/api/runs/${encodeURIComponent(e)}/runtime`)}getBreakpoints(){return this.getJson("/api/breakpoints")}async putBreakpoints(e){await this.putJson("/api/breakpoints",e)}getVariables(){return this.getJson("/api/variables")}async putVariables(e){await this.putJson("/api/variables",e)}addVariable(e){return this.postJson("/api/variables",e)}deleteVariable(e){return this.sendJson("DELETE","/api/variables",e)}appServerStatus(){return this.getJson("/api/app-server")}appServerStart(){return this.postJson("/api/app-server/start",{})}appServerStop(){return this.postJson("/api/app-server/stop",{})}fsBrowse(e,t){const i=new URLSearchParams;e&&i.set("path",e),t&&t.length>0&&i.set("exts",t.join(","));const s=i.toString();return this.getJson("/api/fs/browse"+(s?`?${s}`:""))}session(){return this.getJson("/api/session")}snapshots(){return this.getJson("/api/snapshots")}async importSnapshot(e){const t=await fetch(this.base+"/api/snapshots/import",{method:"POST",headers:{"content-type":"application/zip"},body:e});return this.parseOrThrow(t)}async deleteSnapshot(e){const t=await fetch(this.base+`/api/snapshots/${encodeURIComponent(e)}`,{method:"DELETE"});await this.parseOrThrow(t)}async getJson(e){const t=await fetch(this.base+e);return this.parseOrThrow(t)}postJson(e,t){return this.sendJson("POST",e,t)}putJson(e,t){return this.sendJson("PUT",e,t)}async sendJson(e,t,i){const s=await fetch(this.base+t,{method:e,headers:void 0===i?void 0:{"content-type":"application/json"},body:void 0===i?void 0:JSON.stringify(i)});return this.parseOrThrow(s)}async parseOrThrow(e){let t=null;const i=await e.text();try{t=i?JSON.parse(i):null}catch{t=i}if(!e.ok)throw new RL(function(e){if(!e||"object"!=typeof e)return null;const t=e.message;if("string"==typeof t&&t.length>0)return t;const i=e.error;if(i&&"object"==typeof i){const e=i.message;if("string"==typeof e&&e.length>0)return e}return null}(t)??`HTTP ${e.status}`,e.status,t);return t}},TL=new class{constructor(e={}){this.state="idle",this.socket=null,this.handlers=new Set,this.reconnectTimer=null,this.explicitlyClosed=!1,this.url=e.url??function(){const e="https:"===window.location.protocol?"wss:":"ws:";return`${e}//${window.location.host}/ws`}(),this.minBackoff=e.minBackoffMs??500,this.maxBackoff=e.maxBackoffMs??3e4,this.currentBackoff=this.minBackoff}connect(){this.socket&&this.socket.readyState<=WebSocket.OPEN||(this.explicitlyClosed=!1,this.openSocket())}disconnect(){this.explicitlyClosed=!0,null!==this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.socket&&(this.socket.close(),this.socket=null),this.state="closed"}onMessage(e){return this.handlers.add(e),()=>{this.handlers.delete(e)}}openSocket(){this.state="connecting";const e=new WebSocket(this.url);this.socket=e,e.addEventListener("open",()=>{this.state="open",this.currentBackoff=this.minBackoff}),e.addEventListener("message",e=>{this.deliver(e.data)}),e.addEventListener("close",()=>{this.state="closed",this.socket=null,this.explicitlyClosed||this.scheduleReconnect()}),e.addEventListener("error",()=>{})}deliver(e){if("string"!=typeof e)return;let t;try{t=JSON.parse(e)}catch{return}for(const i of this.handlers)i(t)}scheduleReconnect(){if(null!==this.reconnectTimer)return;const e=this.currentBackoff;this.currentBackoff=Math.min(this.maxBackoff,2*this.currentBackoff),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.explicitlyClosed||this.openSocket()},e)}},zL=new class{constructor(e={}){this.socket=null,this.outbox=[],this.subscribers=new Map,this.reconnectTimer=null,this.url=e.url??function(){const e="https:"===window.location.protocol?"wss:":"ws:";return`${e}//${window.location.host}/ws/terminal`}(),this.minBackoff=e.minBackoffMs??500,this.maxBackoff=e.maxBackoffMs??1e4,this.currentBackoff=this.minBackoff}spawn(e,t,i,s){this.send({type:"spawn",id:e,kind:t,cols:i,rows:s})}sendData(e,t){this.send({type:"data",id:e,data:t})}resize(e,t,i){this.send({type:"resize",id:e,cols:t,rows:i})}close(e){this.send({type:"close",id:e})}subscribe(e,t){let i=this.subscribers.get(e);return i||(i=new Set,this.subscribers.set(e,i)),i.add(t),()=>{const i=this.subscribers.get(e);i&&(i.delete(t),0===i.size&&this.subscribers.delete(e))}}send(e){const t=JSON.stringify({event:Yb,data:e});this.ensureSocket(),this.socket&&this.socket.readyState===WebSocket.OPEN?this.socket.send(t):this.outbox.push(t)}ensureSocket(){if(this.socket&&this.socket.readyState<=WebSocket.OPEN)return;const e=new WebSocket(this.url);this.socket=e,e.addEventListener("open",()=>{for(this.currentBackoff=this.minBackoff;this.outbox.length>0&&e.readyState===WebSocket.OPEN;)e.send(this.outbox.shift())}),e.addEventListener("message",e=>this.deliver(e.data)),e.addEventListener("close",()=>{this.socket=null,this.notifyAllExited(),this.scheduleReconnect()}),e.addEventListener("error",()=>{})}deliver(e){if("string"!=typeof e)return;let t;try{t=JSON.parse(e)}catch{return}const i=function(e){if(!e||"object"!=typeof e)return null;const t=e;if(t.event===Yb&&t.data&&"object"==typeof t.data)return t.data;if("string"==typeof t.type&&"string"==typeof t.id)return t;return null}(t);if(!i)return;const s=this.subscribers.get(i.id);if(s)for(const r of s)r(i)}notifyAllExited(){for(const[e,t]of this.subscribers)for(const i of t)i({type:"exit",id:e,exitCode:null})}scheduleReconnect(){if(null!==this.reconnectTimer||0===this.subscribers.size)return;const e=this.currentBackoff;this.currentBackoff=Math.min(this.maxBackoff,2*this.currentBackoff),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.subscribers.size>0&&this.ensureSocket()},e)}},OL=new class{constructor(e,t,i){this.rest=e,this.ws=t,this.terminalTransport=i,this.wsUnsubscribe=null,this.persistDisposers=[],this.appendCursor=new Map;const s=gB(SL,null)??"";this.tabs=new xL(s),this.targets=new kL(e,()=>this.refreshAfterTargetSwitch()),this.environments=new eL(e,()=>this.refreshAfterEnvSwitch()),this.workspace=new CL(e,()=>this.refreshAfterBundleSwitch()),this.scenarios=new fL(e,this.tabs,this.targets,s),this.helpers=new tL(e),this.collections=new XD(e,this.targets),this.runs=new cL(e),this.historicRuns=new iL(e),this.runSources=new hL(e),this.runtimeSnapshots=new uL(e),this.activeRuns=new WD(e),this.queue=new aL(e),this.source=new mL(e),this.editorBridge=new QD,this.dsl=new ZD(e),this.activityBar=new bB,this.theme=new LL,this.layout=new nL,this.terminal=new BL,this.breakpoints=new qD(e),this.variables=new GD(e),this.appServer=new UD(e),this.targetDoctor=new wL(e),this.snapshots=new vL(e),this.session=new gL(e),this.schedules=new Oj(e),this.overview=new oL(this.scenarios,this.runs,this.activeRuns),Wn(this,{},{autoBind:!0})}applyWorkspaceScope(){this.tabs.setScope(this.targets.active),this.scenarios.setScope(this.targets.active)}refreshAfterTargetSwitch(){this.applyWorkspaceScope(),this.source.invalidate(),this.scenarios.load(),this.helpers.load(),this.collections.load(),this.runs.load(),this.breakpoints.load(),this.variables.load(),this.appServer.load(),this.dsl.reload(),this.targetDoctor.reset(),this.environments.load(),this.queue.load()}refreshAfterEnvSwitch(){this.variables.load(),this.runs.load(),this.queue.load()}refreshAfterBundleSwitch(){this.scenarios.load(),this.helpers.load(),this.collections.load(),this.runs.load()}showScenarioHistory(e){this.activityBar.setSection("runs"),this.layout.openTree(),this.runs.setScenarioFilter(e)}init(){this.wsUnsubscribe=this.ws.onMessage(e=>this.dispatchWsMessage(e)),this.ws.connect(),this.targets.load().then(()=>this.applyWorkspaceScope()),this.scenarios.load(),this.helpers.load(),this.collections.load(),this.runs.load(),this.breakpoints.load(),this.variables.load(),this.environments.load(),this.snapshots.load(),this.session.load(),this.queue.load(),this.schedules.load(),this.workspace.start(),this.persistDisposers.push(dn(()=>{this.activeRuns.reconcileWithRuns(this.runs.items)}),dn(()=>{mB(this.activityBar.storageKey,this.activityBar.section)}),dn(()=>{mB(this.tabs.storageKey,this.tabs.toPersisted())}),dn(()=>{mB(this.scenarios.storageKey,{...this.scenarios.expanded})}),dn(()=>{mB(this.theme.storageKey,this.theme.mode)}),dn(()=>{mB(this.layout.storageKey,this.layout.toPersisted())}),dn(()=>{mB(this.terminal.storageKey,this.terminal.toPersisted())}),dn(()=>{"undefined"!=typeof document&&document.documentElement.classList.toggle("dark","dark"===this.theme.theme)}))}insertPickedSnippet(e,t){const i=this.activeRuns.byRunId.get(e),s=null==i?void 0:i.pausedAt;let r,n;if(s&&null!==s.file)r=s.file,n=s.line;else{if("authoring"!==(null==i?void 0:i.mode)||!i.scenario)return;r=`${N_}/${this.targets.activeTestDir}/${i.scenario}.js`,n=null}this.source.getOrLoad(r).then(()=>{if(null===n)return void(this.editorBridge.insertAtCursor(r,t.snippet)||this.source.insertBeforeLastLine(r,t.snippet));if("cursor"===t.placement){if(this.editorBridge.insertAtCursor(r,t.snippet))return;return void this.source.insertAfterLine(r,n,t.snippet)}const e=this.appendCursor.get(r)??n;this.source.insertAfterLine(r,e,t.snippet),this.appendCursor.set(r,e+1)})}destroy(){var e;null==(e=this.wsUnsubscribe)||e.call(this),this.wsUnsubscribe=null,this.ws.disconnect(),this.appServer.destroy();for(const t of this.persistDisposers)t();this.persistDisposers=[]}dispatchWsMessage(e){switch(e.kind){case"fs:scenarios-changed":return this.source.invalidate(),void this.scenarios.load();case"fs:helpers-changed":return this.source.invalidate(),this.helpers.load(),void this.dsl.refreshHelpers();case"fs:collections-changed":return void this.collections.load();case"fs:bp-changed":return void this.breakpoints.load();case"queue:changed":return void this.queue.load();case"env:changed":return this.environments.load(),void this.refreshAfterEnvSwitch();case"fs:run-started":return this.activeRuns.applyWsMessage(e),void this.runs.load();case"fs:run-finished":return this.activeRuns.applyWsMessage(e),this.historicRuns.invalidate(e.runId),this.runtimeSnapshots.invalidate(e.runId),void this.runs.load();case"fs:run-step":return this.activeRuns.applyWsMessage(e),void("locator:picked"===e.event.kind&&this.insertPickedSnippet(e.runId,e.event));case"fs:collection-run-step":case"log:line":return void this.activeRuns.applyWsMessage(e);case"error":return void console.error("[viewer] server error:",e.message)}}}(AL,TL,zL);OL.init(),Vm(PL).render(ki.jsx(y_.Provider,{value:OL,children:ki.jsx(FD,{})}));export{ux as I,bj as R,Nj as _,gn as a,ki as j,__ as o,gi as r,w_ as u};
55
- //# sourceMappingURL=index-LOIsj_xr.js.map
54
+ */function Vx(e,t,i,s){e=function(e,t){return t?`[200~${e.replace(/\x1b/g,"␛")}[201~`:e}(e=function(e){return e.replace(/\r?\n/g,"\r")}(e),i.decPrivateModes.bracketedPasteMode&&!0!==s.rawOptions.ignoreBracketedPasteMode),i.triggerDataEvent(e,!0),t.value=""}function Yx(e,t,i){let s=i.getBoundingClientRect(),r=e.clientX-s.left-10,n=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}function Gx(e,t,i,s,r){Yx(e,t,i),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function Xx(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Zx(e,t=0,i=e.length){let s="";for(let r=t;r<i;++r){let t=e[r];t>65535?(t-=65536,s+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):s+=String.fromCharCode(t)}return s}var Jx=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r=0;if(this._interim){let i=e.charCodeAt(r++);56320<=i&&i<=57343?t[s++]=1024*(this._interim-55296)+i-56320+65536:(t[s++]=this._interim,t[s++]=i),this._interim=0}for(let n=r;n<i;++n){let r=e.charCodeAt(n);if(55296<=r&&r<=56319){if(++n>=i)return this._interim=r,s;let o=e.charCodeAt(n);56320<=o&&o<=57343?t[s++]=1024*(r-55296)+o-56320+65536:(t[s++]=r,t[s++]=o);continue}65279!==r&&(t[s++]=r)}return s}},Qx=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let s,r,n,o,a,l=0,c=0;if(this.interim[0]){let s=!1,r=this.interim[0];r&=192==(224&r)?31:224==(240&r)?15:7;let n,o=0;for(;(n=this.interim[++o])&&o<4;)r<<=6,r|=63&n;let a=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,h=a-o;for(;c<h;){if(c>=i)return 0;if(n=e[c++],128!=(192&n)){c--,s=!0;break}this.interim[o++]=n,r<<=6,r|=63&n}s||(2===a?r<128?c--:t[l++]=r:3===a?r<2048||r>=55296&&r<=57343||65279===r||(t[l++]=r):r<65536||r>1114111||(t[l++]=r)),this.interim.fill(0)}let h=i-4,u=c;for(;u<i;){for(;!(!(u<h)||128&(s=e[u])||128&(r=e[u+1])||128&(n=e[u+2])||128&(o=e[u+3]));)t[l++]=s,t[l++]=r,t[l++]=n,t[l++]=o,u+=4;if(s=e[u++],s<128)t[l++]=s;else if(192==(224&s)){if(u>=i)return this.interim[0]=s,l;if(r=e[u++],128!=(192&r)){u--;continue}if(a=(31&s)<<6|63&r,a<128){u--;continue}t[l++]=a}else if(224==(240&s)){if(u>=i)return this.interim[0]=s,l;if(r=e[u++],128!=(192&r)){u--;continue}if(u>=i)return this.interim[0]=s,this.interim[1]=r,l;if(n=e[u++],128!=(192&n)){u--;continue}if(a=(15&s)<<12|(63&r)<<6|63&n,a<2048||a>=55296&&a<=57343||65279===a)continue;t[l++]=a}else if(240==(248&s)){if(u>=i)return this.interim[0]=s,l;if(r=e[u++],128!=(192&r)){u--;continue}if(u>=i)return this.interim[0]=s,this.interim[1]=r,l;if(n=e[u++],128!=(192&n)){u--;continue}if(u>=i)return this.interim[0]=s,this.interim[1]=r,this.interim[2]=n,l;if(o=e[u++],128!=(192&o)){u--;continue}if(a=(7&s)<<18|(63&r)<<12|(63&n)<<6|63&o,a<65536||a>1114111)continue;t[l++]=a}}return l}},ey=class e{constructor(){this.fg=0,this.bg=0,this.extended=new ty}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&0!==this.extended.underlineStyle?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return!(50331648&~this.fg)}isBgRGB(){return!(50331648&~this.bg)}isFgPalette(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)}isBgPalette(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)}isFgDefault(){return!(50331648&this.fg)}isBgDefault(){return!(50331648&this.bg)}isAttributeDefault(){return 0===this.fg&&0===this.bg}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&~this.extended.underlineColor):this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?16777216==(50331648&this.extended.underlineColor)||33554432==(50331648&this.extended.underlineColor):this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},ty=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(3758096384&this._ext)>>29;return e<0?4294967288^e:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}},iy=class e extends ey{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ty,this.combinedData=""}static fromCharData(t){let i=new e;return i.setFromCharData(t),i}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?Xx(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(2===e[1].length){let i=e[1].charCodeAt(0);if(55296<=i&&i<=56319){let s=e[1].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(i-55296)+s-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}attributesEquals(e){if(this.getFgColorMode()!==e.getFgColorMode()||this.getFgColor()!==e.getFgColor()||this.getBgColorMode()!==e.getBgColorMode()||this.getBgColor()!==e.getBgColor()||this.isInverse()!==e.isInverse()||this.isBold()!==e.isBold()||this.isUnderline()!==e.isUnderline())return!1;if(this.isUnderline()){if(this.getUnderlineStyle()!==e.getUnderlineStyle())return!1;let t=this.isUnderlineColorDefault(),i=e.isUnderlineColorDefault();if(!(t&&i||t===i&&this.getUnderlineColor()===e.getUnderlineColor()&&this.getUnderlineColorMode()===e.getUnderlineColorMode()))return!1}return!(this.isOverline()!==e.isOverline()||this.isBlink()!==e.isBlink()||this.isInvisible()!==e.isInvisible()||this.isItalic()!==e.isItalic()||this.isDim()!==e.isDim()||this.isStrikethrough()!==e.isStrikethrough())}},sy=new Map;function ry(e){if(sy.has(e))return sy.get(e);let t=function(e,i,s){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");!function(e,t,i){t.di$target===t?t.di$dependencies.push({id:e,index:i}):(t.di$dependencies=[{id:e,index:i}],t.di$target=t)}(t,e,s)};return t._id=e,sy.set(e,t),t}var ny=ry("BufferService"),oy=ry("MouseStateService"),ay=ry("CoreService"),ly=ry("CharsetService"),cy=ry("InstantiationService"),hy=ry("LogService"),uy=ry("OptionsService"),dy=ry("OscLinkService"),fy=ry("UnicodeService"),py=ry("DecorationService"),gy=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i,this._workCell=new iy}provideLinks(e,t){var i;let s=this._bufferService.buffer.lines.get(e-1);if(!s)return void t(void 0);let r=[],n=this._optionsService.rawOptions.linkHandler,o=this._workCell,a=s.getTrimmedLength(),l=-1,c=-1,h=!1;for(let u=0;u<a;u++)if(-1!==c||s.hasContent(u)){if(s.loadCell(u,o),o.hasExtendedAttrs()&&o.extended.urlId){if(-1===c){c=u,l=o.extended.urlId;continue}h=o.extended.urlId!==l}else-1!==c&&(h=!0);if(h||-1!==c&&u===a-1){let t=null==(i=this._oscLinkService.getLinkData(l))?void 0:i.uri;if(t){let i=u+(h||u!==a-1?0:1),s=this._getRangeWithLineWrap(e,c,i,l),o=!1;if(!(null==n?void 0:n.allowNonHttpProtocols))try{let e=new URL(t);["http:","https:"].includes(e.protocol)||(o=!0)}catch{o=!0}o||r.push({text:t,range:s,activate:(e,t)=>n?n.activate(e,t,s):vy(e,t),hover:(e,t)=>{var i;return null==(i=null==n?void 0:n.hover)?void 0:i.call(n,e,t,s)},leave:(e,t)=>{var i;return null==(i=null==n?void 0:n.leave)?void 0:i.call(n,e,t,s)}})}h=!1,o.hasExtendedAttrs()&&o.extended.urlId?(c=u,l=o.extended.urlId):(c=-1,l=-1)}}t(r)}_getRangeWithLineWrap(e,t,i,s){var r;let n=e,o=t,a=e,l=i;for(;0===o&&(null==(r=this._bufferService.buffer.lines.get(n-1))?void 0:r.isWrapped);){let e=this._bufferService.buffer.lines.get(n-2);if(!e)break;let t=e.getTrimmedLength();if(0===t||!this._hasUrlId(e,t-1,s))break;let i=t-1;for(;i>0&&this._hasUrlId(e,i-1,s);)i--;n--,o=i}for(;;){let e=this._bufferService.buffer.lines.get(a-1);if(!e)break;if(l!==e.getTrimmedLength())break;let t=this._bufferService.buffer.lines.get(a);if(!(null==t?void 0:t.isWrapped))break;let i=t.getTrimmedLength();if(0===i||!this._hasUrlId(t,0,s))break;let r=1;for(;r<i&&this._hasUrlId(t,r,s);)r++;a++,l=r}return{start:{x:o+1,y:n},end:{x:l,y:a}}}_hasUrlId(e,t,i){let s=this._workCell;return e.loadCell(t,s),!!s.hasExtendedAttrs()&&s.extended.urlId===i}};function vy(e,t){if(confirm(`Do you want to navigate to ${t}?\n\nWARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}gy=Ix([Fx(0,ny),Fx(1,uy),Fx(2,dy)],gy);var my=ry("CharSizeService"),_y=ry("CoreBrowserService"),by=ry("MouseCoordsService"),xy=ry("MouseService"),yy=ry("RenderService"),wy=ry("SelectionService"),Sy=ry("CharacterJoinerService"),ky=ry("ThemeService"),Cy=ry("LinkProviderService"),jy=ry("KeyboardService");function Ny(e){return{dispose:e}}function My(e){if(!e)return e;if(Array.isArray(e)){for(let t of e)t.dispose();return[]}return e.dispose(),e}var By=class{constructor(){this._disposables=new Set,this._isDisposed=!1}get isDisposed(){return this._isDisposed}add(e){return this._isDisposed?e.dispose():this._disposables.add(e),e}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.clear()}}clear(){for(let e of this._disposables)e.dispose();this._disposables.clear()}},Ey=class{constructor(){this._store=new By}dispose(){this._store.dispose()}_register(e){return this._store.add(e)}};Ey.None=Object.freeze({dispose(){}});var Dy=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||(null==(t=this._value)||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,null==(e=this._value)||e.dispose(),this._value=void 0}};var Ly=class{constructor(){this._token=-1,this._isDisposed=!1}dispose(){this.cancel(),this._isDisposed=!0}cancel(){-1!==this._token&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Error("Calling cancelAndSet on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Error("Calling setIfNotSet on a disposed TimeoutTimer");-1===this._token&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},Py=class{constructor(){this._isScheduled=!1,this._isDisposed=!1}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._isScheduled=!1}set(e){if(this._isDisposed)throw new Error("Calling set on a disposed MicrotaskTimer");this._isScheduled||(this._isScheduled=!0,queueMicrotask(()=>{this._isScheduled&&(this._isScheduled=!1,e())}))}},Ry=class{constructor(){this._isDisposed=!1}cancel(){var e;null==(e=this._disposable)||e.dispose(),this._disposable=void 0}cancelAndSet(e,t,i=globalThis){if(this._isDisposed)throw new Error("Calling cancelAndSet on a disposed IntervalTimer");this.cancel();let s=i.setInterval(()=>{e()},t);this._disposable={dispose:()=>{i.clearInterval(s),this._disposable=void 0}}}dispose(){this.cancel(),this._isDisposed=!0}};function Ay(e){var t;let i=e;if(null==(t=null==i?void 0:i.ownerDocument)?void 0:t.defaultView)return i.ownerDocument.defaultView;let s=e;return(null==s?void 0:s.view)?s.view:window}var Ty=class{constructor(e,t,i,s){this._node=e,this._type=t,this._handler=i,this._options=s,e.addEventListener(t,i,s)}dispose(){!this._node||!this._handler||(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function zy(e,t,i,s){return new Ty(e,t,i,s)}function Oy(e,t,i,s){return zy(e,t,i,s)}var Iy="click",Fy="mouseover",Hy="mouseleave",Wy="pointerdown",Ky="pointermove",Uy="pointerup",$y="wheel";var qy=class{constructor(e,t){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){console.error(e)}}static sort(e,t){return t.priority-e.priority}},Vy=new Map;function Yy(e){let t=Vy.get(e);return t||(t={next:[],current:[],animFrameRequested:!1,inAnimationFrameRunner:!1},Vy.set(e,t)),t}function Gy(e,t,i=0){let s=Yy(e),r=new qy(t,i);return s.next.push(r),s.animFrameRequested||(s.animFrameRequested=!0,e.requestAnimationFrame(()=>function(e){let t=Yy(e);for(t.animFrameRequested=!1,t.current=t.next,t.next=[],t.inAnimationFrameRunner=!0;t.current.length>0;)t.current.sort(qy.sort),t.current.shift().execute();t.inAnimationFrameRunner=!1}(e))),r}var Xy=class extends Ry{constructor(e){super(),this._defaultTarget=e?Ay(e):void 0}cancelAndSet(e,t,i){super.cancelAndSet(e,t,i??this._defaultTarget??window)}},Zy=class{constructor(e){this.domNode=e,this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._className="",this._position="",this._layerHint=!1,this._contain="none"}setWidth(e){let t=Jy(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Jy(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Jy(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Jy(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Jy(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Jy(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}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}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=e?"translate3d(0px, 0px, 0px)":"")}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}};function Jy(e){return"number"==typeof e?`${e}px`:e}var Qy={};((e,t)=>{for(var i in t)zx(e,i,{get:t[i],enumerable:!0})})(Qy,{getSafariVersion:()=>lw,getZoomFactor:()=>aw,isChrome:()=>rw,isChromeOS:()=>dw,isFirefox:()=>sw,isLegacyEdge:()=>nw,isLinux:()=>uw,isMac:()=>cw,isNode:()=>ew,isSafari:()=>ow,isWindows:()=>hw});var ew=!!(typeof process<"u"&&"title"in process&&(typeof navigator>"u"||navigator.userAgent.startsWith("Node.js/"))),tw=ew?"node":navigator.userAgent,iw=ew?"node":navigator.platform,sw=tw.includes("Firefox"),rw=tw.includes("Chrome"),nw=tw.includes("Edge"),ow=/^((?!chrome|android).)*safari/i.test(tw);function aw(e){return 1}function lw(){if(!ow)return 0;let e=tw.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1],10)}var cw=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(iw),hw=["Windows","Win16","Win32","WinCE"].includes(iw),uw=iw.indexOf("Linux")>=0,dw=/\bCrOS\b/.test(tw),fw=new WeakMap;function pw(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,i=e.parent.location;if("null"!==t.origin&&"null"!==i.origin&&t.origin!==i.origin)return null}catch{return null}return e.parent}var gw,vw,mw=class{static _getSameOriginWindowChain(e){let t=fw.get(e);if(!t){t=[],fw.set(e,t);let i,s=e;do{i=pw(s),i?t.push({window:new WeakRef(s),iframeElement:s.frameElement??null}):t.push({window:new WeakRef(s),iframeElement:null}),s=i}while(s)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let i=0,s=0,r=this._getSameOriginWindowChain(e);for(let n of r){let e=n.window.deref();if(i+=(null==e?void 0:e.scrollY)??0,s+=(null==e?void 0:e.scrollX)??0,e===t||!n.iframeElement)break;let r=n.iframeElement.getBoundingClientRect();i+=r.top,s+=r.left}return{top:i,left:s}}},_w=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=0===t.button,this.middleButton=1===t.button,this.rightButton=2===t.button,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail??1,"dblclick"===t.type&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,"number"==typeof t.pageX?(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 i=mw.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},bw=class{constructor(e,t=0,i=0){var s;this.browserEvent=e??null,this.target=e?e.target??e.targetNode??e.srcElement??null:null,this.deltaY=i,this.deltaX=t;let r=!1;if(rw){let e=navigator.userAgent.match(/Chrome\/(\d+)/);r=(e?parseInt(e[1],10):123)<=122}if(e){let t=e,i=e,n=(null==(s=e.view)?void 0:s.devicePixelRatio)??1;if(typeof t.wheelDeltaY<"u")this.deltaY=r?t.wheelDeltaY/(120*n):t.wheelDeltaY/120;else if(typeof i.VERTICAL_AXIS<"u"&&i.axis===i.VERTICAL_AXIS)this.deltaY=-i.detail/3;else if("wheel"===e.type){let t=e;t.deltaMode===t.DOM_DELTA_LINE?this.deltaY=sw&&!cw?-e.deltaY/3:-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof t.wheelDeltaX<"u")this.deltaX=ow&&hw?-t.wheelDeltaX/120:r?t.wheelDeltaX/(120*n):t.wheelDeltaX/120;else if(typeof i.HORIZONTAL_AXIS<"u"&&i.axis===i.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if("wheel"===e.type){let t=e;t.deltaMode===t.DOM_DELTA_LINE?this.deltaX=sw&&!cw?-e.deltaX/3:-e.deltaX:this.deltaX=-e.deltaX/40}0===this.deltaY&&0===this.deltaX&&e.wheelDelta&&(this.deltaY=r?e.wheelDelta/(120*n):e.wheelDelta/120)}}preventDefault(){var e;null==(e=this.browserEvent)||e.preventDefault()}stopPropagation(){var e;null==(e=this.browserEvent)||e.stopPropagation()}},xw=class{constructor(){this._hooks=new By,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let t=this._onStopCallback;this._onStopCallback=null,e&&t&&t()}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,i,s,r){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=s,this._onStopCallback=r;let n=e;try{e.setPointerCapture(t),this._hooks.add(Ny(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{n=Ay(e)}this._hooks.add(zy(n,Ky,e=>{e.buttons===i?(e.preventDefault(),this._pointerMoveCallback(e)):this.stopMonitoring(!0)})),this._hooks.add(zy(n,Uy,e=>this.stopMonitoring(!0)))}},yw=class extends Ey{_onclick(e,t){this._register(zy(e,Iy,i=>t(new _w(Ay(e),i))))}_onmouseover(e,t){this._register(zy(e,Fy,i=>t(new _w(Ay(e),i))))}_onmouseleave(e,t){this._register(zy(e,Hy,i=>t(new _w(Ay(e),i))))}},ww=class extends yw{constructor(e){super(),this._handleActivate=e.handleActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="xterm-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";let t=Math.min(e.bgWidth,e.bgHeight);this.domNode.style.width=t+"px",this.domNode.style.height=t+"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 xw),this._register(Oy(this.bgDomNode,Wy,e=>this._arrowPointerDown(e))),this._register(Oy(this.domNode,Wy,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new Xy),this._pointerdownScheduleRepeatTimer=this._register(new Ly)}_arrowPointerDown(e){if(!(e.target&&e.target instanceof Element))return;this._handleActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._handleActivate(),1e3/24,Ay(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},Sw=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=(e,t,i)=>{if(this._disposed)return Ny(()=>{});let s={fn:e,thisArgs:t};this._listeners.push(s);let r=Ny(()=>{let e=this._listeners.indexOf(s);-1!==e&&this._listeners.splice(e,1)});return i&&(Array.isArray(i)?i.push(r):i.add(r)),r}),this._event}fire(e){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:t,thisArgs:i}=this._listeners[0];return void t.call(i,e)}default:{let t=this._listeners.slice();for(let{fn:i,thisArgs:s}of t)i.call(s,e)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}};(vw=gw||(gw={})).forward=function(e,t){return e(e=>t.fire(e))},vw.map=function(e,t){return(i,s,r)=>e(e=>i.call(s,t(e)),void 0,r)},vw.any=function(...e){return(t,i,s)=>{let r=new By;for(let n of e)r.add(n(e=>t.call(i,e)));return s&&(Array.isArray(s)?s.push(r):s.add(r)),r}},vw.runAndSubscribe=function(e,t,i){return t(i),e(e=>t(e))};var kw=class e{constructor(e,t,i,s,r,n,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,i|=0,s|=0,r|=0,n|=0,o|=0),this.rawScrollLeft=s,this.rawScrollTop=o,t<0&&(t=0),s+t>i&&(s=i-t),s<0&&(s=0),r<0&&(r=0),o+r>n&&(o=n-r),o<0&&(o=0),this.width=t,this.scrollWidth=i,this.scrollLeft=s,this.height=r,this.scrollHeight=n,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,i){return new e(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(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(e,t){let i=this.width!==e.width,s=this.scrollWidth!==e.scrollWidth,r=this.scrollLeft!==e.scrollLeft,n=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,a=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:s,scrollLeftChanged:r,heightChanged:n,scrollHeightChanged:o,scrollTopChanged:a}}},Cw=class extends Ey{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Sw),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new kw(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 i;let s=this._state.withScrollDimensions(e,t);this._setState(s,!!this._smoothScrolling),null==(i=this._smoothScrolling)||i.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(0!==this._smoothScrollDuration){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 i,s=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===s.scrollLeft&&this._smoothScrolling.to.scrollTop===s.scrollTop)return;i=t?new Mw(this._smoothScrolling.from,s,this._smoothScrolling.startTime,this._smoothScrolling.duration):Mw.start(this._state,s,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=i}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=Mw.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}else this.setScrollPositionNow(e)}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)return this._smoothScrolling.dispose(),void(this._smoothScrolling=null);this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}},jw=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};function Nw(e,t){let i=t-e;return function(t){return e+i*function(e){return 1-function(e){return Math.pow(e,3)}(1-e)}(t)}}var Mw=class e{constructor(e,t,i,s){this.from=e,this.to=t,this.duration=s,this.startTime=i,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(e,t,i){if(Math.abs(e-t)>2.5*i){let s,r;return e<t?(s=e+.75*i,r=t-.75*i):(s=e-.75*i,r=t+.75*i),function(e,t,i){return function(s){return s<i?e(s/i):t((s-i)/(1-i))}}(Nw(e,s),Nw(r,t),.33)}return Nw(e,t)}dispose(){null!==this.animationFrameDisposable&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let t=(e-this.startTime)/this.duration;if(t<1){let e=this._scrollLeft(t),i=this._scrollTop(t);return new jw(e,i,!1)}return new jw(this.to.scrollLeft,this.to.scrollTop,!0)}static start(t,i,s){s+=10;let r=Date.now()-10;return new e(t,i,r,s)}};var Bw=class extends Ey{constructor(e,t,i){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Ly)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return 2!==this._visibility&&(3===this._visibility||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(){this._isNeeded?this._shouldBeVisible?this._reveal():this._hide(!0):this._hide(!1)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;null==(e=this._domNode)||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,null==(t=this._domNode)||t.setClassName(this._invisibleClassName+(e?" xterm-fade":"")))}},Ew=class extends yw{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 Bw(e.visibility,"xterm-visible xterm-scrollbar "+e.extraScrollbarClassName,"xterm-invisible xterm-scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new xw),this._shouldRender=!0,this.domNode=new Zy(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(zy(this.domNode.domNode,Wy,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new ww(e));return this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode),t}_createSlider(e,t,i,s){this.slider=new Zy(document.createElement("div")),this.slider.setClassName("xterm-slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),"number"==typeof i&&this.slider.setWidth(i),"number"==typeof s&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(zy(this.slider.domNode,Wy,e=>{0===e.button&&(e.preventDefault(),this._sliderPointerDown(e))})),this._onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_handleElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_handleElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_handleElementScrollPosition(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._handlePointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,i=t+this._scrollbarState.getSliderPosition(),s=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),r=this._sliderPointerPosition(e);i<=r&&r<=s?0===e.button&&(e.preventDefault(),this._sliderPointerDown(e)):this._handlePointerDown(e)}_handlePointerDown(e){let t,i;if(e.target===this.domNode.domNode&&"number"==typeof e.offsetX&&"number"==typeof e.offsetY)t=e.offsetX,i=e.offsetY;else{let s=function(e){let t=e.getBoundingClientRect(),i=Ay(e);return{left:t.left+i.scrollX,top:t.top+i.scrollY,width:t.width,height:t.height}}(this.domNode.domNode);t=e.pageX-s.left,i=e.pageY-s.top}let s=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),0===e.button&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!(e.target&&e.target instanceof Element))return;let t=this._sliderPointerPosition(e),i=this._sliderOrthogonalPointerPosition(e),s=this._scrollbarState.clone();this.slider.toggleClassName("xterm-active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let r=this._sliderOrthogonalPointerPosition(e),n=Math.abs(r-i);if(hw&&n>140)return void this._setDesiredScrollPositionNow(s.getScrollPosition());let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(s.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName("xterm-active",!1),this._host.handleDragEnd()}),this._host.handleDragStart()}_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()}},Dw=class e{constructor(e,t,i,s,r,n){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(e),this._visibleSize=s,this._scrollSize=r,this._scrollPosition=n,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t&&(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t&&(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t&&(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setArrowSize(e){let t=Math.round(e);this._arrowSize!==t&&(this._arrowSize=t,this._refreshComputedValues())}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,i,s,r){let n=Math.max(0,i-e),o=Math.max(0,n-2*t),a=s>0&&s>i;if(!a)return{computedAvailableSize:Math.round(n),computedIsNeeded:a,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let l=Math.round(Math.max(20,Math.floor(i*o/s))),c=(o-l)/(s-i),h=r*c;return{computedAvailableSize:Math.round(n),computedIsNeeded:a,computedSliderSize:Math.round(l),computedSliderRatio:c,computedSliderPosition:Math.round(h)}}_refreshComputedValues(){let t=e._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(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,i=this._scrollPosition;return t<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},Lw=class extends Ew{constructor(e,t,i){let s=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new Dw(t.horizontalHasArrows?t.horizontalScrollbarSize:0,2===t.horizontal?0:t.horizontalScrollbarSize,2===t.vertical?0:t.verticalScrollbarSize,s.width,s.scrollWidth,r.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"xterm-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)}handleScroll(e){return this._shouldRender=this._handleElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._handleElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._handleElementSize(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(2===e.horizontal?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(2===e.vertical?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},Pw=class extends Ew{constructor(e,t,i){let s=e.getScrollDimensions(),r=e.getCurrentScrollPosition(),n=t.verticalHasArrows;super({lazyRender:t.lazyRender,host:i,scrollbarState:new Dw(n?t.verticalScrollbarSize:0,2===t.vertical?0:t.verticalScrollbarSize,0,s.height,s.scrollHeight,r.scrollTop),visibility:t.vertical,extraScrollbarClassName:"xterm-vertical",scrollable:e,scrollByPage:t.scrollByPage}),this._arrowScrollDelta=0,this._setArrows(n,t.verticalScrollbarSize),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)}handleScroll(e){return this._shouldRender=this._handleElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._handleElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._handleElementSize(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}_arrowScroll(e){let t=this._scrollable.getCurrentScrollPosition();this._scrollable.setScrollPositionNow({scrollTop:t.scrollTop+e})}_setArrows(e,t){if(this._arrowScrollDelta=t,(!this._arrowUp||!this._arrowDown)&&(this._arrowUp=this._createArrow({className:"xterm-scra xterm-arrow-up",top:0,left:0,bgWidth:t,bgHeight:t,handleActivate:()=>this._arrowScroll(-this._arrowScrollDelta)}),this._arrowDown=this._createArrow({className:"xterm-scra xterm-arrow-down",bottom:0,left:0,bgWidth:t,bgHeight:t,handleActivate:()=>this._arrowScroll(this._arrowScrollDelta)})),this._updateArrowSize(this._arrowUp,t),this._updateArrowSize(this._arrowDown,t),!this._arrowUp||!this._arrowDown)return;let i=e?"":"none";this._arrowUp.bgDomNode.style.display=i,this._arrowUp.domNode.style.display=i,this._arrowDown.bgDomNode.style.display=i,this._arrowDown.domNode.style.display=i}_updateArrowSize(e,t){e&&(e.bgDomNode.style.width=`${t}px`,e.bgDomNode.style.height=`${t}px`,e.domNode.style.width=`${t}px`,e.domNode.style.height=`${t}px`)}updateOptions(e){let t=e.verticalHasArrows?e.verticalScrollbarSize:0;this._scrollbarState.setArrowSize(t),this._setArrows(e.verticalHasArrows,e.verticalScrollbarSize),this.updateScrollbarSize(2===e.vertical?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},Rw=class{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}},Aw=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(-1===this._front&&-1===this._rear)return!1;let e=1,t=0,i=1,s=this._rear;for(;-1!==s;){let r=s===this._front?e:Math.pow(2,-i);if(e-=r,t+=this._memory[s].score*r,s===this._front)break;s=(this._capacity+s-1)%this._capacity,i++}return t<=.5}acceptStandardWheelEvent(e){if(rw){Ay(e.browserEvent);let t=1;this.accept(Date.now(),e.deltaX*t,e.deltaY*t)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,i){let s=null,r=new Rw(e,t,i);-1===this._front&&-1===this._rear?(this._memory[0]=r,this._front=0,this._rear=0):(s=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]=r),r.score=this._computeScore(r,s)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(i+=.25),t){let s=Math.abs(e.deltaX),r=Math.abs(e.deltaY),n=Math.abs(t.deltaX),o=Math.abs(t.deltaY),a=Math.max(Math.min(s,n),1),l=Math.max(Math.min(r,o),1),c=Math.max(s,n),h=Math.max(r,o);c%a===0&&h%l===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};Aw.INSTANCE=new Aw;var Tw=Aw,zw=class extends yw{constructor(e,t,i){super(),this._onScroll=this._register(new Sw),this.onScroll=this._onScroll.event,t=t??{};let s,r=!i;i?s=i:(t.mouseWheelSmoothScroll=!1,s=new Cw({forceIntegerValues:!0,smoothScrollDuration:0,scheduleAtNextAnimationFrame:t=>Gy(Ay(e),t)})),this._options=function(e){let t={lazyRender:typeof e.lazyRender<"u"&&e.lazyRender,className:typeof e.className<"u"?e.className:"",useShadows:!(typeof e.useShadows<"u")||e.useShadows,handleMouseWheel:!(typeof e.handleMouseWheel<"u")||e.handleMouseWheel,flipAxes:typeof e.flipAxes<"u"&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"&&e.alwaysConsumeMouseWheel,scrollYToX:typeof e.scrollYToX<"u"&&e.scrollYToX,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:!(typeof e.scrollPredominantAxis<"u")||e.scrollPredominantAxis,mouseWheelSmoothScroll:!(typeof e.mouseWheelSmoothScroll<"u")||e.mouseWheelSmoothScroll,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,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"&&e.verticalHasArrows,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"&&e.scrollByPage};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,cw&&(t.className+=" xterm-mac"),t}(t),this._scrollable=s,this._register(this._scrollable.onScroll(e=>{this._handleScroll(e),this._onScroll.fire(e)})),r&&this._register(this._scrollable);let n={handleMouseWheel:e=>this._handleMouseWheel(e),handleDragStart:()=>this._handleDragStart(),handleDragEnd:()=>this._handleDragEnd()};this._verticalScrollbar=this._register(new Pw(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new Lw(this._scrollable,this._options,n)),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=new Zy(document.createElement("div")),this._leftShadowDomNode.setClassName("xterm-shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=new Zy(document.createElement("div")),this._topShadowDomNode.setClassName("xterm-shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=new Zy(document.createElement("div")),this._topLeftShadowDomNode.setClassName("xterm-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,e=>this._handleMouseOver(e)),this._onmouseleave(this._listenOnDomNode,e=>this._handleMouseLeave(e)),this._hideTimeout=this._register(new Ly),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=My(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}updateClassName(e){this._options.className=e,cw&&(this._options.className+=" xterm-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.horizontalHasArrows<"u"&&(this._options.horizontalHasArrows=e.horizontalHasArrows),typeof e.verticalHasArrows<"u"&&(this._options.verticalHasArrows=e.verticalHasArrows),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()}delegateScrollFromMouseWheelEvent(e){this._handleMouseWheel(new bw(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=My(this._mouseWheelToDispose),e)){let e=e=>{this._handleMouseWheel(new bw(e))};this._mouseWheelToDispose.push(zy(this._listenOnDomNode,$y,e,{passive:!1}))}}_handleMouseWheel(e){var t;if(null==(t=e.browserEvent)?void 0:t.defaultPrevented)return;let i=Tw.INSTANCE;i.acceptStandardWheelEvent(e);let s=!1;if(e.deltaY||e.deltaX){let t=e.deltaY*this._options.mouseWheelScrollSensitivity,r=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&r+t===0?r=t=0:Math.abs(t)>=Math.abs(r)?r=0:t=0),this._options.flipAxes&&([t,r]=[r,t]);let n=!cw&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||n)&&!r&&(r=t,t=0),e.browserEvent&&e.browserEvent.altKey&&(r*=this._options.fastScrollSensitivity,t*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),a={};if(t){let e=50*t,i=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(a,i)}if(r){let e=50*r,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(a,t)}a=this._scrollable.validateScrollPosition(a),(o.scrollLeft!==a.scrollLeft||o.scrollTop!==a.scrollTop)&&(this._options.mouseWheelSmoothScroll&&i.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(a):this._scrollable.setScrollPositionNow(a),s=!0)}let r=s;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_handleScroll(e){this._shouldRender=this._horizontalScrollbar.handleScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.handleScroll(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,i=e.scrollLeft>0,s=i?" xterm-shadow-left":"",r=t?" xterm-shadow-top":"",n=i||t?" xterm-shadow-top-left-corner":"";this._leftShadowDomNode.setClassName(`xterm-shadow${s}`),this._topShadowDomNode.setClassName(`xterm-shadow${r}`),this._topLeftShadowDomNode.setClassName(`xterm-shadow${n}${r}${s}`)}}_handleDragStart(){this._isDragging=!0,this._reveal()}_handleDragEnd(){this._isDragging=!1,this._hide()}_handleMouseLeave(e){this._mouseIsOver=!1,this._hide()}_handleMouseOver(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(),500)}};var Ow=class extends Ey{constructor(e,t,i,s,r,n,o,a,l){var c;super(),this._bufferService=i,this._coreService=r,this._optionsService=a,this._renderService=l,this._onRequestScrollLines=this._register(new Sw),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1,this._needsSyncOnRender=!1;let h=this._register(new Cw({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>Gy(s.window,e)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{h.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new zw(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,verticalHasArrows:(null==(c=this._optionsService.rawOptions.scrollbar)?void 0:c.showArrows)??!1,...this._getChangeOptions()},h)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","scrollbar"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(n.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(16&e)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(gw.runAndSubscribe(o.onChangeColors,()=>{e.style.backgroundColor=o.colors.background.css,this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Ny(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Ny(()=>this._styleElement.remove())),this._register(gw.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .xterm-scrollbar > .xterm-slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .xterm-scrollbar > .xterm-slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .xterm-scrollbar > .xterm-slider.xterm-active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join("\n")})),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._renderService.onRender(()=>{this._needsSyncOnRender&&(this._needsSyncOnRender=!1,this._sync())})),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}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,t,i;let s=(null==(e=this._optionsService.rawOptions.scrollbar)?void 0:e.showScrollbar)??!0,r=(null==(t=this._optionsService.rawOptions.scrollbar)?void 0:t.showArrows)??!1,n=s?(null==(i=this._optionsService.rawOptions.scrollbar)?void 0:i.width)??14:0;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,vertical:s?1:2,verticalScrollbarSize:n,verticalHasArrows:r}}queueSync(e){void 0!==e&&(this._latestYDisp=e),void 0===this._queuedAnimationFrame&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){if(this._renderService&&!this._isSyncing){if(this._coreService.decPrivateModes.synchronizedOutput)return void(this._needsSyncOnRender=!0);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),i=t-this._bufferService.buffer.ydisp;0!==i&&(this._latestYDisp=t,this._onRequestScrollLines.fire(i)),this._isHandlingScroll=!1}handleTouchScroll(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({scrollTop:t.scrollTop-e})}};Ow=Ix([Fx(2,ny),Fx(3,_y),Fx(4,ay),Fx(5,oy),Fx(6,ky),Fx(7,uy),Fx(8,yy)],Ow);var Iw=class extends Ey{constructor(e,t,i,s,r){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=i,this._decorationService=s,this._renderService=r,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(Ny(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){void 0===this._animationFrame&&(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 t;let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer","top"===(null==(t=null==e?void 0:e.options)?void 0:t.layer)),i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let s=e.options.x??0;return s&&s>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(e,i),i}_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 i=this._decorationElements.get(e);i||(i=this._createElement(e),e.element=i,this._decorationElements.set(e,i),this._container.appendChild(i),e.onDispose(()=>{this._decorationElements.delete(e),i.remove()})),i.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=t*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(i)}}_refreshXPosition(e,t=e.element){if(!t)return;let i=e.options.x??0;"right"===(e.options.anchor||"left")?t.style.right=i?i*this._renderService.dimensions.css.cell.width+"px":"":t.style.left=i?i*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(e){var t;null==(t=this._decorationElements.get(e))||t.remove(),this._decorationElements.delete(e),e.dispose()}};Iw=Ix([Fx(1,ny),Fx(2,_y),Fx(3,py),Fx(4,yy)],Iw);var Fw=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))return void this._addLineToZone(t,e.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return 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,void this._zones.push(this._zonePool[this._zonePoolIndex++]);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,i){return t>=e.startBufferLine-this._linePadding[i||"full"]&&t<=e.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Hw={full:0,left:0,center:0,right:0},Ww={full:0,left:0,center:0,right:0},Kw={full:0,left:0,center:0,right:0},Uw=class extends Ey{constructor(e,t,i,s,r,n,o,a){var l;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=s,this._renderService=r,this._optionsService=n,this._themeService=o,this._coreBrowserService=a,this._colorZoneStore=new Fw,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(),null==(l=this._viewportElement.parentElement)||l.insertBefore(this._canvas,this._viewportElement),this._register(Ny(()=>{var e;return null==(e=this._canvas)?void 0:e.remove()}));let c=this._canvas.getContext("2d");if(!c)throw new Error("Ctx cannot be null");this._ctx=c,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.onDimensionsChange(()=>this._queueRefresh(!0))),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("scrollbar",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._register(Ny(()=>{void 0!==this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)})),this._queueRefresh(!0)}get _width(){let e=this._optionsService.rawOptions.scrollbar;return(null==e?void 0:e.showScrollbar)??1?(null==e?void 0:e.width)??0:0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Ww.full=this._canvas.width,Ww.left=e,Ww.center=t,Ww.right=e,this._refreshDrawHeightConstants(),Kw.full=1,Kw.left=1,Kw.center=1+Ww.left,Kw.right=1+Ww.left+Ww.center}_refreshDrawHeightConstants(){Hw.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);Hw.left=t,Hw.center=t,Hw.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Hw.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Hw.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Hw.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Hw.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){if(this._store.isDisposed||!this._renderService.hasRenderer())return;let e=this._renderService.dimensions.css.canvas.height,t=this._renderService.dimensions.device.canvas.height;this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${e}px`,this._canvas.height=t,this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){if(this._store.isDisposed||!this._renderService.hasRenderer())return;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)"full"!==t.position&&this._renderColorZone(t);for(let t of e)"full"===t.position&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){var e,t,i,s;this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),(null==(t=null==(e=this._optionsService.rawOptions.scrollbar)?void 0:e.overviewRuler)?void 0:t.showTopBorder)&&this._ctx.fillRect(1,0,this._canvas.width-1,1),(null==(s=null==(i=this._optionsService.rawOptions.scrollbar)?void 0:i.overviewRuler)?void 0:s.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(Kw[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Hw[e.position||"full"]/2),Ww[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Hw[e.position||"full"]))}_queueRefresh(e,t){this._store.isDisposed||(this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,void 0===this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._store.isDisposed||this._refreshDecorations(),this._animationFrame=void 0})))}};Uw=Ix([Fx(2,ny),Fx(3,py),Fx(4,yy),Fx(5,uy),Fx(6,ky),Fx(7,_y)],Uw);var $w=class{constructor(e,t,i,s,r,n){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=s,this._coreService=r,this._renderService=n,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._compositionSuffix="",this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0;let e=this._textarea.selectionStart??this._textarea.value.length,t=this._textarea.selectionEnd??e;this._compositionPosition.start=Math.min(e,t),this._compositionPosition.end=Math.max(e,t),this._compositionSuffix=this._textarea.value.substring(this._compositionPosition.end),this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=`‎${e.data}‎`,this.updateCompositionElements(),setTimeout(()=>{let e=this._textarea.selectionEnd??this._textarea.value.length;this._compositionPosition.end=Math.max(this._compositionPosition.start,e)},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(20===e.keyCode||229===e.keyCode||16===e.keyCode||17===e.keyCode||18===e.keyCode)return!1;this._finalizeComposition(!1)}return 229!==e.keyCode||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end},t=this._compositionSuffix;this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let i;if(this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,this._isComposing)i=this._textarea.value.substring(e.start,this._compositionPosition.start);else{let s=this._textarea.value,r=t.length>0&&s.endsWith(t)?s.length-t.length:s.length;i=s.substring(e.start,Math.max(e.start,r))}i.length>0&&this._coreService.triggerDataEvent(i,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){if(this._textareaChangeTimer)return;let e=this._textarea.value;this._textareaChangeTimer=window.setTimeout(()=>{if(this._textareaChangeTimer=void 0,!this._isComposing){let t=this._textarea.value,i=t.replace(e,"");this._dataAlreadySent=i,t.length>e.length?this._coreService.triggerDataEvent(i,!0):t.length<e.length?this._coreService.triggerDataEvent("",!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=t+"px",this._compositionView.style.lineHeight=t+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let r=this._bufferService.cols*this._renderService.dimensions.css.cell.width-s;this._compositionView.style.maxWidth=r+"px",this._compositionView.style.overflow="hidden",this._compositionView.style.direction="rtl";let n=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(n.width,1)+"px",this._textarea.style.height=Math.max(n.height,1)+"px",this._textarea.style.lineHeight=n.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};$w=Ix([Fx(2,ny),Fx(3,uy),Fx(4,ay),Fx(5,yy)],$w);var qw,Vw,Yw,Gw,Xw,Zw,Jw=0,Qw=0,eS=0,tS=0,iS={css:"#00000000",rgba:0};function sS(e){let t=e.toString(16);return t.length<2?"0"+t:t}function rS(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}(Vw=qw||(qw={})).toCss=function(e,t,i,s){return void 0!==s?`#${sS(e)}${sS(t)}${sS(i)}${sS(s)}`:`#${sS(e)}${sS(t)}${sS(i)}`},Vw.toRgba=function(e,t,i,s=255){return(e<<24|t<<16|i<<8|s)>>>0},Vw.toColor=function(e,t,i,s){return{css:Vw.toCss(e,t,i,s),rgba:Vw.toRgba(e,t,i,s)}},(e=>{function t(e,t){return tS=Math.round(255*t),[Jw,Qw,eS]=Zw.toChannels(e.rgba),{css:qw.toCss(Jw,Qw,eS,tS),rgba:qw.toRgba(Jw,Qw,eS,tS)}}e.blend=function(e,t){if(1===(tS=(255&t.rgba)/255))return{css:t.css,rgba:t.rgba};let i=t.rgba>>24&255,s=t.rgba>>16&255,r=t.rgba>>8&255,n=e.rgba>>24&255,o=e.rgba>>16&255,a=e.rgba>>8&255;return Jw=n+Math.round((i-n)*tS),Qw=o+Math.round((s-o)*tS),eS=a+Math.round((r-a)*tS),{css:qw.toCss(Jw,Qw,eS),rgba:qw.toRgba(Jw,Qw,eS)}},e.isOpaque=function(e){return!(255&~e.rgba)},e.ensureContrastRatio=function(e,t,i){let s=Zw.ensureContrastRatio(e.rgba,t.rgba,i);if(s)return qw.toColor(s>>24&255,s>>16&255,s>>8&255)},e.opaque=function(e){let t=(255|e.rgba)>>>0;return[Jw,Qw,eS]=Zw.toChannels(t),{css:qw.toCss(Jw,Qw,eS),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,i){return t(e,(tS=255&e.rgba)*i/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}})(Yw||(Yw={})),(e=>{let t,i;try{let e=document.createElement("canvas");e.width=1,e.height=1;let s=e.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return Jw=parseInt(e.slice(1,2).repeat(2),16),Qw=parseInt(e.slice(2,3).repeat(2),16),eS=parseInt(e.slice(3,4).repeat(2),16),qw.toColor(Jw,Qw,eS);case 5:return Jw=parseInt(e.slice(1,2).repeat(2),16),Qw=parseInt(e.slice(2,3).repeat(2),16),eS=parseInt(e.slice(3,4).repeat(2),16),tS=parseInt(e.slice(4,5).repeat(2),16),qw.toColor(Jw,Qw,eS,tS);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let s=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return Jw=parseInt(s[1],10),Qw=parseInt(s[2],10),eS=parseInt(s[3],10),tS=Math.round(255*(void 0===s[5]?1:parseFloat(s[5]))),qw.toColor(Jw,Qw,eS,tS);if("transparent"===e)return{css:"transparent",rgba:0};if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=e,"string"!=typeof t.fillStyle)throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Jw,Qw,eS,tS]=t.getImageData(0,0,1,1).data,255!==tS)throw new Error("css.toColor: Unsupported css format");return{rgba:qw.toRgba(Jw,Qw,eS,tS),css:e}}})(Gw||(Gw={})),(e=>{function t(e,t,i){let s=e/255,r=t/255,n=i/255;return.2126*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t})(Xw||(Xw={})),(e=>{function t(e,t,i){let s=e>>24&255,r=e>>16&255,n=e>>8&255,o=t>>24&255,a=t>>16&255,l=t>>8&255,c=rS(Xw.relativeLuminance2(o,a,l),Xw.relativeLuminance2(s,r,n));for(;c<i&&(o>0||a>0||l>0);)o-=Math.max(0,Math.ceil(.1*o)),a-=Math.max(0,Math.ceil(.1*a)),l-=Math.max(0,Math.ceil(.1*l)),c=rS(Xw.relativeLuminance2(o,a,l),Xw.relativeLuminance2(s,r,n));return(o<<24|a<<16|l<<8|255)>>>0}function i(e,t,i){let s=e>>24&255,r=e>>16&255,n=e>>8&255,o=t>>24&255,a=t>>16&255,l=t>>8&255,c=rS(Xw.relativeLuminance2(o,a,l),Xw.relativeLuminance2(s,r,n));for(;c<i&&(o<255||a<255||l<255);)o=Math.min(255,o+Math.ceil(.1*(255-o))),a=Math.min(255,a+Math.ceil(.1*(255-a))),l=Math.min(255,l+Math.ceil(.1*(255-l))),c=rS(Xw.relativeLuminance2(o,a,l),Xw.relativeLuminance2(s,r,n));return(o<<24|a<<16|l<<8|255)>>>0}e.blend=function(e,t){if(1===(tS=(255&t)/255))return t;let i=t>>24&255,s=t>>16&255,r=t>>8&255,n=e>>24&255,o=e>>16&255,a=e>>8&255;return Jw=n+Math.round((i-n)*tS),Qw=o+Math.round((s-o)*tS),eS=a+Math.round((r-a)*tS),qw.toRgba(Jw,Qw,eS)},e.ensureContrastRatio=function(e,s,r){let n=Xw.relativeLuminance(e>>8),o=Xw.relativeLuminance(s>>8);if(rS(n,o)<r){if(o<n){let o=t(e,s,r),a=rS(n,Xw.relativeLuminance(o>>8));if(a<r){let t=i(e,s,r);return a>rS(n,Xw.relativeLuminance(t>>8))?o:t}return o}let a=i(e,s,r),l=rS(n,Xw.relativeLuminance(a>>8));if(l<r){let i=t(e,s,r);return l>rS(n,Xw.relativeLuminance(i>>8))?a:i}return a}},e.reduceLuminance=t,e.increaseLuminance=i,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}})(Zw||(Zw={}));var nS=class extends ey{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}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()]}},oS=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new iy}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(0===this._characterJoiners.length)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||0===t.length)return[];let i=[],s=t.translateToString(!0),r=t.getTrimmedLength(),n=0,o=0,a=0,l=t.getFg(0),c=t.getBg(0);for(let h=0;h<r;h++)if(t.loadCell(h,this._workCell),0!==this._workCell.getWidth()){if(this._workCell.fg!==l||this._workCell.bg!==c){if(h-n>1){let e=this._getJoinedRanges(s,a,o,t,n);for(let t=0;t<e.length;t++)i.push(e[t])}n=h,a=o,l=this._workCell.fg,c=this._workCell.bg}o+=this._workCell.getChars().length||1}if(r-n>1){let e=this._getJoinedRanges(s,a,o,t,n);for(let t=0;t<e.length;t++)i.push(e[t])}return i}_getJoinedRanges(e,t,i,s,r){let n=e.substring(t,i),o=[];try{o=this._characterJoiners[0].handler(n)}catch(a){console.error(a)}for(let c=1;c<this._characterJoiners.length;c++)try{let e=this._characterJoiners[c].handler(n);for(let t=0;t<e.length;t++)oS._mergeRanges(o,e[t])}catch(l){console.error(l)}return this._stringRangesToCellRanges(o,s,r),o}_stringRangesToCellRanges(e,t,i){let s=0,r=!1,n=0,o=e[s];if(!o)return;let a=t.getTrimmedLength();for(let l=i;l<a;l++){let i=t.getWidth(l),a=t.getString(l).length||1;if(0!==i){if(!r&&o[0]<=n&&(o[0]=l,r=!0),o[1]<=n){if(o[1]=l,o=e[++s],!o)break;o[0]<=n?(o[0]=l,r=!0):r=!1}n+=a}}o&&(o[1]=a)}static _mergeRanges(e,t){let i=!1;for(let s=0;s<e.length;s++){let r=e[s];if(i){if(t[1]<=r[0])return e[s-1][1]=t[1],e;if(t[1]<=r[1])return e[s-1][1]=Math.max(t[1],r[1]),e.splice(s,1),e;e.splice(s,1),s--}else{if(t[1]<=r[0])return e.splice(s,0,t),e;if(t[1]<=r[1])return r[0]=Math.min(t[0],r[0]),e;t[0]<r[1]&&(r[0]=Math.min(t[0],r[0]),i=!0)}}return i?e[e.length-1][1]=t[1]:e.push(t),e}};function aS(e){if(!e)throw new Error("value must not be falsy");return e}oS=Ix([Fx(0,ny)],oS);var lS=class{constructor(e,t,i,s,r,n,o){this._document=e,this._characterJoinerService=t,this._optionsService=i,this._coreBrowserService=s,this._coreService=r,this._decorationService=n,this._themeService=o,this._workCell=new iy,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,i){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=i}createRow(e,t,i,s,r,n,o,a,l,c,h,u,d){let f=[];d&&(d.hasBlinkingCells=!1);let p=this._characterJoinerService.getJoinedCharacters(t),g=this._themeService.colors,v=e.getNoBgTrimmedLength();i&&v<n+1&&(v=n+1);let m,_,b,x=0,y="",w=0,S=0,k=0,C=!1,j=0,N=!1,M=0,B=[],E=-1!==h&&-1!==u;for(let D=0;D<v;D++){e.loadCell(D,this._workCell);let v=this._workCell.getWidth();if(0===v)continue;let L=!1,P=D>=M,R=D,A=this._workCell;if(p.length>0&&D===p[0][0]&&P){let s=p.shift(),r=this._isCellInSelection(s[0],t);for(_=s[0]+1;_<s[1];_++)P&&(P=r===this._isCellInSelection(_,t));P&&(P=!i||n<s[0]||n>=s[1]),P?(L=!0,A=new nS(this._workCell,e.translateToString(!0,s[0],s[1]),s[1]-s[0]),R=s[1]-1,v=A.getWidth()):M=s[1]}let T=this._isCellInSelection(D,t),z=i&&D===n,O=E&&D>=h&&D<=u;d&&A.isBlink()&&(d.hasBlinkingCells=!0),!a&&A.isBlink()&&B.push("xterm-blink-hidden");let I=!1;this._decorationService.forEachDecorationAtCell(D,t,void 0,e=>{I=!0});let F=A.getChars()||" ";if(" "===F&&(A.isUnderline()||A.isOverline())&&(F=" "),b=v*l-c.get(F,A.isBold(),A.isItalic()),m){if(x&&(T&&N||!T&&!N&&A.bg===w)&&(T&&N&&g.selectionForeground||A.fg===S)&&A.extended.ext===k&&O===C&&b===j&&!z&&!L&&!I&&P){A.isInvisible()?y+=" ":y+=F,x++;continue}x&&(m.textContent=y),m=this._document.createElement("span"),x=0,y=""}else m=this._document.createElement("span");if(w=A.bg,S=A.fg,k=A.extended.ext,C=O,j=b,N=T,L&&n>=D&&n<=R&&(n=D),!this._coreService.isCursorHidden&&z&&this._coreService.isCursorInitialized)if(B.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&B.push("xterm-cursor-blink"),B.push("bar"===s?"xterm-cursor-bar":"underline"===s?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":B.push("xterm-cursor-outline");break;case"block":B.push("xterm-cursor-block");break;case"bar":B.push("xterm-cursor-bar");break;case"underline":B.push("xterm-cursor-underline")}if(A.isBold()&&B.push("xterm-bold"),A.isItalic()&&B.push("xterm-italic"),A.isDim()&&B.push("xterm-dim"),y=A.isInvisible()?" ":A.getChars()||" ",A.isUnderline()&&(B.push(`xterm-underline-${A.extended.underlineStyle}`)," "===y&&(y=" "),!A.isUnderlineColorDefault()))if(A.isUnderlineColorRGB())m.style.textDecorationColor=`rgb(${ey.toColorRGB(A.getUnderlineColor()).join(",")})`;else{let e=A.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&A.isBold()&&e<8&&(e+=8),m.style.textDecorationColor=g.ansi[e].css}A.isOverline()&&(B.push("xterm-overline")," "===y&&(y=" ")),A.isStrikethrough()&&B.push("xterm-strikethrough"),O&&(m.style.textDecoration="underline");let H=A.getFgColor(),W=A.getFgColorMode(),K=A.getBgColor(),U=A.getBgColorMode(),$=!!A.isInverse();if($){let e=H;H=K,K=e;let t=W;W=U,U=t}let q,V,Y,G=!1;switch(this._decorationService.forEachDecorationAtCell(D,t,void 0,e=>{"top"!==e.options.layer&&G||(e.backgroundColorRGB&&(U=50331648,K=e.backgroundColorRGB.rgba>>8&16777215,q=e.backgroundColorRGB),e.foregroundColorRGB&&(W=50331648,H=e.foregroundColorRGB.rgba>>8&16777215,V=e.foregroundColorRGB),G="top"===e.options.layer)}),!G&&T&&(q=this._coreBrowserService.isFocused?g.selectionBackgroundOpaque:g.selectionInactiveBackgroundOpaque,K=q.rgba>>8&16777215,U=50331648,G=!0,g.selectionForeground&&(W=50331648,H=g.selectionForeground.rgba>>8&16777215,V=g.selectionForeground)),G&&B.push("xterm-decoration-top"),U){case 16777216:case 33554432:Y=g.ansi[K],B.push(`xterm-bg-${K}`);break;case 50331648:Y=qw.toColor(K>>16,K>>8&255,255&K),this._addStyle(m,`background-color:#${(K>>>0).toString(16).padStart(6,"0")}`);break;default:$?(Y=g.foreground,B.push("xterm-bg-257")):Y=g.background}switch(q||A.isDim()&&(q=Yw.multiplyOpacity(Y,.5)),W){case 16777216:case 33554432:A.isBold()&&H<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(H+=8),this._applyMinimumContrast(m,Y,g.ansi[H],A,q,void 0)||B.push(`xterm-fg-${H}`);break;case 50331648:let e=qw.toColor(H>>16&255,H>>8&255,255&H);this._applyMinimumContrast(m,Y,e,A,q,V)||this._addStyle(m,`color:#${H.toString(16).padStart(6,"0")}`);break;default:this._applyMinimumContrast(m,Y,g.foreground,A,q,V)||$&&B.push("xterm-fg-257")}B.length&&(m.className=B.join(" "),B.length=0),z||L||I||!P?m.textContent=y:x++,b!==this.defaultSpacing&&(m.style.letterSpacing=`${b}px`),f.push(m),D=R}return m&&x&&(m.textContent=y),f}_applyMinimumContrast(e,t,i,s,r,n){if(1===this._optionsService.rawOptions.minimumContrastRatio||(function(e){return 57508<=e&&e<=57558}(o=s.getCode())||function(e){return 9472<=e&&e<=9631}(o)))return!1;var o;let a,l=this._getContrastCache(s);if(!r&&!n&&(a=l.getColor(t.rgba,i.rgba)),void 0===a){let e=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);a=Yw.ensureContrastRatio(r??t,n??i,e),l.setColor((r??t).rgba,(n??i).rgba,a??null)}return!!a&&(this._addStyle(e,`color:${a.css}`),!0)}_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 i=this._selectionStart,s=this._selectionEnd;return!(!i||!s)&&(this._columnSelectMode?i[0]<=s[0]?e>=i[0]&&t>=i[1]&&e<s[0]&&t<=s[1]:e<i[0]&&t>=i[1]&&e>=s[0]&&t<=s[1]:t>i[1]&&t<s[1]||i[1]===s[1]&&t===i[1]&&e>=i[0]&&e<s[0]||i[1]<s[1]&&t===s[1]&&e<s[0]||i[1]<s[1]&&t===i[1]&&e>=i[0])}};lS=Ix([Fx(1,Sy),Fx(2,uy),Fx(3,_y),Fx(4,ay),Fx(5,py),Fx(6,ky)],lS);var cS=class{constructor(e=()=>new hS){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._canvasElements=[],this._canvasElements=[e(),e(),e(),e()],this.clear()}dispose(){this._canvasElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,i,s){e===this._font&&t===this._fontSize&&i===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=s,this._canvasElements[0].setFont(e,t,i,!1),this._canvasElements[1].setFont(e,t,s,!1),this._canvasElements[2].setFont(e,t,i,!0),this._canvasElements[3].setFont(e,t,s,!0),this.clear())}get(e,t,i){let s;if(!t&&!i&&1===e.length&&(s=e.charCodeAt(0))<256){if(-9999!==this._flat[s])return this._flat[s];let t=this._measure(e,0);return t>0&&(this._flat[s]=t),t}let r=e;t&&(r+="B"),i&&(r+="I");let n=this._holey.get(r);if(void 0===n){let s=0;t&&(s|=1),i&&(s|=2),n=this._measure(e,s),n>0&&this._holey.set(r,n)}return n}_measure(e,t){return this._canvasElements[t].measure(e)}},hS=class{constructor(){typeof OffscreenCanvas<"u"?(this._canvas=new OffscreenCanvas(1,1),this._ctx=aS(this._canvas.getContext("2d"))):(this._canvas=document.createElement("canvas"),this._canvas.width=1,this._canvas.height=1,this._ctx=aS(this._canvas.getContext("2d")))}setFont(e,t,i,s){let r=s?"italic":"";this._ctx.font=`${r} ${i} ${t}px ${e}`.trim()}measure(e){return this._ctx.measureText(e).width}},uS=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,i,s=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1])return void this.clear();let r=e.buffers.active.ydisp,n=t[1]-r,o=i[1]-r,a=Math.max(n,0),l=Math.min(o,e.rows-1);a>=e.rows||l<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=l,this.startCol=t[0],this.endCol=i[0])}isCellSelected(e,t,i){return!!this.hasSelection&&(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol)}};var dS=class extends Ey{constructor(e,t,i){super(),this._renderCallback=e,this._coreBrowserService=t,this._optionsService=i,this._intervalDuration=0,this._blinkOn=!0,this._needsBlinkInViewport=!1,this._isViewportVisible=!0,this._register(this._optionsService.onSpecificOptionChange("blinkIntervalDuration",e=>{this.setIntervalDuration(e)})),this.setIntervalDuration(this._optionsService.rawOptions.blinkIntervalDuration),this._register(Ny(()=>this._clearInterval()))}get isBlinkOn(){return this._blinkOn}get isEnabled(){return this._intervalDuration>0}setNeedsBlinkInViewport(e){this._needsBlinkInViewport!==e&&(this._needsBlinkInViewport=e,this._updateIntervalState())}setViewportVisible(e){this._isViewportVisible!==e&&(this._isViewportVisible=e,this._updateIntervalState())}setIntervalDuration(e){e!==this._intervalDuration&&(this._intervalDuration=e,this._clearInterval(),this._updateIntervalState())}_updateIntervalState(){if(this._intervalDuration>0&&this._needsBlinkInViewport&&this._isViewportVisible){if(void 0!==this._interval)return;let e=this._blinkOn;return this._blinkOn=!0,this._interval=this._coreBrowserService.window.setInterval(()=>{this._blinkOn=!this._blinkOn,this._renderCallback()},this._intervalDuration),void(e||this._renderCallback())}this._clearInterval(),this._blinkOn||(this._blinkOn=!0,this._renderCallback())}_clearInterval(){void 0!==this._interval&&(this._coreBrowserService.window.clearInterval(this._interval),this._interval=void 0)}},fS=1,pS=class extends Ey{constructor(e,t,i,s,r,n,o,a,l,c,h,u,d,f){super(),this._terminal=e,this._document=t,this._element=i,this._screenElement=s,this._viewportElement=r,this._helperContainer=n,this._linkifier2=o,this._charSizeService=l,this._optionsService=c,this._bufferService=h,this._coreService=u,this._coreBrowserService=d,this._themeService=f,this._terminalClass=fS++,this._rowElements=[],this._selectionRenderModel=new uS,this._lastSelectionColumnMode=!1,this._rowHasBlinkingCells=[],this._rowHasBlinkingCellsCount=0,this._onRequestRedraw=this._register(new Sw),this.onRequestRedraw=this._onRequestRedraw.event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add("xterm-rows"),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("xterm-selection"),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions={css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}},this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=a.createInstance(lS,document),this._element.classList.add("xterm-dom-renderer-owner-"+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._cursorBlinkStateManager=new gS(this._rowContainer,this._coreBrowserService),this._register(zy(this._document,"mousedown",()=>this._cursorBlinkStateManager.restartBlinkAnimation())),this._register(Ny(()=>this._cursorBlinkStateManager.dispose())),this._textBlinkStateManager=this._register(new dS(()=>this._onRequestRedraw.fire({start:0,end:this._bufferService.rows-1}),this._coreBrowserService,this._optionsService)),this._register(Ny(()=>{this._element.classList.remove("xterm-dom-renderer-owner-"+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new cS,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 i of this._rowElements)i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .xterm-rows 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} .xterm-rows { pointer-events: none; color: ${e.foreground.css};}`;t+=`${this._terminalSelector} .xterm-rows, ${this._terminalSelector} .xterm-rows span { font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`,t+=`${this._terminalSelector} .xterm-rows .xterm-dim { color: ${Yw.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;}${this._terminalSelector} span.xterm-blink-hidden { visibility: hidden;}`;let i=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;t+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${s} { 50% { box-shadow: none; }}`,t+=`@keyframes ${r} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .xterm-rows.xterm-focus .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .xterm-rows.xterm-focus .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .xterm-rows.xterm-focus .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .xterm-rows.xterm-cursor-blink-idle .xterm-cursor.xterm-cursor-blink { animation: none !important;}${this._terminalSelector} .xterm-rows .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .xterm-rows .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .xterm-rows .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .xterm-rows .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .xterm-rows .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .xterm-selection { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .xterm-selection div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .xterm-selection div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,o]of e.ansi.entries())t+=`${this._terminalSelector} .xterm-fg-${n} { color: ${o.css}; }${this._terminalSelector} .xterm-fg-${n}.xterm-dim { color: ${Yw.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .xterm-bg-${n} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .xterm-fg-257 { color: ${Yw.opaque(e.background).css}; }${this._terminalSelector} .xterm-fg-257.xterm-dim { color: ${Yw.multiplyOpacity(Yw.opaque(e.background),.5).css}; }${this._terminalSelector} .xterm-bg-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 i=this._rowElements.length;i<=t;i++){let e=this._document.createElement("div");this._rowContainer.appendChild(e),this._rowElements.push(e),this._rowHasBlinkingCells.push(!1)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop()),this._rowHasBlinkingCells.pop()&&this._rowHasBlinkingCellsCount--}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("xterm-focus"),this._cursorBlinkStateManager.pause(),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add("xterm-focus"),this._cursorBlinkStateManager.resume(),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleViewportVisibilityChange(e){this._textBlinkStateManager.setViewportVisible(e)}handleSelectionChanged(e,t,i){let s=this._bufferService.rows;this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,i);let r=0,n=-1;this._lastSelectionStart&&this._lastSelectionEnd&&(this._selectionRenderModel.update(this._terminal,this._lastSelectionStart,this._lastSelectionEnd,this._lastSelectionColumnMode),this._selectionRenderModel.hasSelection&&(r=this._selectionRenderModel.viewportCappedStartRow,n=this._selectionRenderModel.viewportCappedEndRow));let o=0,a=-1;if(!e||!t)return;if(this._selectionRenderModel.update(this._terminal,e,t,i),this._selectionRenderModel.hasSelection){let s=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,n=this._selectionRenderModel.viewportCappedStartRow,l=this._selectionRenderModel.viewportCappedEndRow;o=n,a=l;let c=this._document.createDocumentFragment();if(i){let i=e[0]>t[0];c.appendChild(this._createSelectionElement(n,i?t[0]:e[0],i?e[0]:t[0],l-n+1))}else{let i=s===n?e[0]:0,o=n===r?t[0]:this._bufferService.cols;c.appendChild(this._createSelectionElement(n,i,o));let a=l-n-1;if(c.appendChild(this._createSelectionElement(n+1,0,this._bufferService.cols,a)),n!==l){let e=r===l?t[0]:this._bufferService.cols;c.appendChild(this._createSelectionElement(l,0,e))}}this._selectionContainer.appendChild(c)}let l=Math.min(r,o),c=Math.max(n,a);if(c>=0){l=Math.max(l,0),c=Math.min(c,s-1);let e=this._bufferService.buffer.y;this._selectionRenderModel.hasSelection&&e>=0&&e<s&&(l=Math.min(l,e),c=Math.max(c,e)),this.renderRows(l,c)}this._lastSelectionStart=e,this._lastSelectionEnd=t,this._lastSelectionColumnMode=i}_createSelectionElement(e,t,i,s=1){let r=this._document.createElement("div"),n=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(i-t);return n+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-n),r.style.height=s*this.dimensions.css.cell.height+"px",r.style.top=e*this.dimensions.css.cell.height+"px",r.style.left=`${n}px`,r.style.width=`${o}px`,r}handleCursorMove(){this._cursorBlinkStateManager.restartBlinkAnimation()}_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();this._rowHasBlinkingCellsCount>0&&(this._rowHasBlinkingCells.fill(!1),this._rowHasBlinkingCellsCount=0,this._textBlinkStateManager.setNeedsBlinkInViewport(!1))}renderRows(e,t){let i=this._bufferService.buffer,s=i.ybase+i.y,r=Math.min(i.x,this._bufferService.cols-1),n=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle,l={hasBlinkingCells:!1};for(let c=e;c<=t;c++){let e=c+i.ydisp,t=this._rowElements[c];if(!t)continue;let h=i.lines.get(e);h?(t.replaceChildren(...this._rowFactory.createRow(h,e,e===s,o,a,r,n,this._textBlinkStateManager.isBlinkOn,this.dimensions.css.cell.width,this._widthCache,-1,-1,l)),this._setRowBlinkState(c,l.hasBlinkingCells)):(t.replaceChildren(),this._setRowBlinkState(c,!1))}this._updateTextBlinkState()}get _terminalSelector(){return`.xterm-dom-renderer-owner-${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,i,s,r,n){i<0&&(e=0),s<0&&(t=0);let o=this._bufferService.rows-1;i=Math.max(Math.min(i,o),0),s=Math.max(Math.min(s,o),0),r=Math.min(r,this._bufferService.cols);let a=this._bufferService.buffer,l=a.ybase+a.y,c=Math.min(a.x,r-1),h=this._optionsService.rawOptions.cursorBlink,u=this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle,f={hasBlinkingCells:!1};for(let p=i;p<=s;++p){let o=p+a.ydisp,g=this._rowElements[p];if(!g)continue;let v=a.lines.get(o);v?(g.replaceChildren(...this._rowFactory.createRow(v,o,o===l,u,d,c,h,this._textBlinkStateManager.isBlinkOn,this.dimensions.css.cell.width,this._widthCache,n?p===i?e:0:-1,n?(p===s?t:r)-1:-1,f)),this._setRowBlinkState(p,f.hasBlinkingCells)):(g.replaceChildren(),this._setRowBlinkState(p,!1))}this._updateTextBlinkState()}_setRowBlinkState(e,t){this._rowHasBlinkingCells[e]!==t&&(this._rowHasBlinkingCells[e]=t,this._rowHasBlinkingCellsCount+=t?1:-1)}_updateTextBlinkState(){this._textBlinkStateManager.setNeedsBlinkInViewport(this._rowHasBlinkingCellsCount>0)}};pS=Ix([Fx(7,cy),Fx(8,my),Fx(9,uy),Fx(10,ny),Fx(11,ay),Fx(12,_y),Fx(13,ky)],pS);var gS=class{constructor(e,t){this._rowContainer=e,this._coreBrowserService=t,this._isIdlePaused=!1,this._coreBrowserService.isFocused&&this._resetIdleTimer()}dispose(){this._clearIdleTimer()}restartBlinkAnimation(){this._isIdlePaused&&this._rowContainer.classList.remove("xterm-cursor-blink-idle"),this._resetIdleTimer()}pause(){this._isIdlePaused=!1,this._clearIdleTimer()}resume(){this._isIdlePaused=!1,this._rowContainer.classList.remove("xterm-cursor-blink-idle"),this._resetIdleTimer()}_resetIdleTimer(){this._isIdlePaused=!1,this._clearIdleTimer(),this._idleTimeout=this._coreBrowserService.window.setTimeout(()=>{this._stopBlinkingDueToIdle()},3e5)}_clearIdleTimer(){void 0!==this._idleTimeout&&(this._coreBrowserService.window.clearTimeout(this._idleTimeout),this._idleTimeout=void 0)}_stopBlinkingDueToIdle(){this._rowContainer.classList.add("xterm-cursor-blink-idle"),this._isIdlePaused=!0,this._idleTimeout=void 0}},vS=class extends Ey{constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Sw),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new bS(this._optionsService))}catch{this._measureStrategy=this._register(new _S(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())}};vS=Ix([Fx(2,uy)],vS);var mS=class extends Ey{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){void 0!==e&&e>0&&void 0!==t&&t>0&&(this._result.width=e,this._result.height=t)}},_S=class extends mS{constructor(e,t,i){super(),this._document=e,this._parentElement=t,this._optionsService=i,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}},bS=class extends mS{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}},xS=class extends Ey{constructor(e,t,i){super(),this._textarea=e,this._window=t,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._onDprChange=this._register(new Sw),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Sw),this.onWindowChange=this._onWindowChange.event,this._screenDprMonitor=this._register(new yS(this._window)),this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(gw.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(zy(this._textarea,"focus",()=>this._isFocused=!0)),this._register(zy(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 void 0===this._cachedIsFocused&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},yS=class extends Ey{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Dy),this._onDprChange=this._register(new Sw),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Ny(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=zy(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&(null==(e=this._resolutionMediaMatchList)||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)}},wS=class extends Ey{constructor(){super(),this.linkProviders=[],this._register(Ny(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);-1!==t&&this.linkProviders.splice(t,1)}}}};function SS(e,t,i){let s=i.getBoundingClientRect(),r=e.getComputedStyle(i),n=parseInt(r.getPropertyValue("padding-left"),10),o=parseInt(r.getPropertyValue("padding-top"),10);return[t.clientX-s.left-n,t.clientY-s.top-o]}var kS=class{constructor(e,t){this._charSizeService=e,this._renderService=t}getCoords(e,t,i,s,r){return function(e,t,i,s,r,n,o,a,l){if(!n)return;let c=SS(e,t,i);return c[0]=Math.ceil((c[0]+(l?o/2:0))/o),c[1]=Math.ceil(c[1]/a),c[0]=Math.min(Math.max(c[0],1),s+(l?1:0)),c[1]=Math.min(Math.max(c[1],1),r),c}(Ay(t),e,t,i,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(e,t){let i=SS(Ay(t),e,t);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};kS=Ix([Fx(0,my),Fx(1,yy)],kS);var CS="object"==typeof window?window:globalThis;function jS(e,t=0){return e[e.length-(1+t)]}var NS=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};NS.Undefined=new NS(void 0);var MS,BS,ES=NS,DS=class{constructor(){this._first=ES.Undefined,this._last=ES.Undefined}push(e){return this._insert(e,!0)}_insert(e,t){let i=new ES(e);if(this._first===ES.Undefined)this._first=i,this._last=i;else if(t){let e=this._last;this._last=i,i.prev=e,e.next=i}else{let e=this._first;this._first=i,i.next=e,e.prev=i}let s=!1;return()=>{s||(s=!0,this._remove(i))}}_remove(e){if(e.prev!==ES.Undefined&&e.next!==ES.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ES.Undefined&&e.next===ES.Undefined?(this._first=ES.Undefined,this._last=ES.Undefined):e.next===ES.Undefined?(this._last=this._last.prev,this._last.next=ES.Undefined):e.prev===ES.Undefined&&(this._first=this._first.next,this._first.prev=ES.Undefined)}*[Symbol.iterator](){let e=this._first;for(;e!==ES.Undefined;)yield e.element,e=e.next}};(BS=MS||(MS={})).TAP="-xterm-gesturetap",BS.CHANGE="-xterm-gesturechange",BS.START="-xterm-gesturestart",BS.END="-xterm-gesturesend",BS.CONTEXT_MENU="-xterm-gesturecontextmenu";var LS=class e extends Ey{constructor(){super(),this._dispatched=!1,this._targets=new DS,this._ignoreTargets=new DS,this._activeTouches={},this._handle=null,this._lastSetTapCountTime=0;let e=CS;this._register(zy(e.document,"touchstart",e=>this._handleTouchStart(e),{passive:!1})),this._register(zy(e.document,"touchend",t=>this._handleTouchEnd(e,t))),this._register(zy(e.document,"touchmove",e=>this._handleTouchMove(e),{passive:!1}))}static addTarget(t){if(!e.isTouchDevice())return Ey.None;return e._instance||(e._instance=new e),Ny(e._instance._targets.push(t))}static ignoreTarget(t){if(!e.isTouchDevice())return Ey.None;return e._instance||(e._instance=new e),Ny(e._instance._ignoreTargets.push(t))}static isTouchDevice(){return"ontouchstart"in CS||navigator.maxTouchPoints>0}dispose(){this._handle&&(this._handle.dispose(),this._handle=null),super.dispose()}_handleTouchStart(e){let t=Date.now();this._handle&&(this._handle.dispose(),this._handle=null);for(let i=0,s=e.targetTouches.length;i<s;i++){let s=e.targetTouches.item(i);this._activeTouches[s.identifier]={id:s.identifier,initialTarget:s.target,initialTimeStamp:t,initialPageX:s.pageX,initialPageY:s.pageY,rollingTimestamps:[t],rollingPageX:[s.pageX],rollingPageY:[s.pageY]};let r=this._newGestureEvent(MS.START,s.target);r.pageX=s.pageX,r.pageY=s.pageY,this._dispatchEvent(r)}this._dispatched&&(e.preventDefault(),e.stopPropagation(),this._dispatched=!1)}_handleTouchEnd(t,i){let s=Date.now(),r=Object.keys(this._activeTouches).length;for(let n=0,o=i.changedTouches.length;n<o;n++){let o=i.changedTouches.item(n);if(!this._activeTouches.hasOwnProperty(String(o.identifier))){console.warn("move of an UNKNOWN touch",o);continue}let a=this._activeTouches[o.identifier],l=Date.now()-a.initialTimeStamp;if(l<e._holdDelay&&Math.abs(a.initialPageX-jS(a.rollingPageX))<30&&Math.abs(a.initialPageY-jS(a.rollingPageY))<30){let e=this._newGestureEvent(MS.TAP,a.initialTarget);e.pageX=jS(a.rollingPageX),e.pageY=jS(a.rollingPageY),this._dispatchEvent(e)}else if(l>=e._holdDelay&&Math.abs(a.initialPageX-jS(a.rollingPageX))<30&&Math.abs(a.initialPageY-jS(a.rollingPageY))<30){let e=this._newGestureEvent(MS.CONTEXT_MENU,a.initialTarget);e.pageX=jS(a.rollingPageX),e.pageY=jS(a.rollingPageY),this._dispatchEvent(e)}else if(1===r){let e=jS(a.rollingPageX),i=jS(a.rollingPageY),r=jS(a.rollingTimestamps)-a.rollingTimestamps[0],n=e-a.rollingPageX[0],o=i-a.rollingPageY[0],l=[...this._targets].filter(e=>a.initialTarget instanceof Node&&e.contains(a.initialTarget));this._inertia(t,l,s,Math.abs(n)/r,n>0?1:-1,e,Math.abs(o)/r,o>0?1:-1,i)}this._dispatchEvent(this._newGestureEvent(MS.END,a.initialTarget)),delete this._activeTouches[o.identifier]}this._dispatched&&(i.preventDefault(),i.stopPropagation(),this._dispatched=!1)}_newGestureEvent(e,t){let i=document.createEvent("CustomEvent");return i.initEvent(e,!1,!0),i.initialTarget=t,i.tapCount=0,i}_dispatchEvent(t){if(t.type===MS.TAP){let i,s=(new Date).getTime();i=s-this._lastSetTapCountTime>e._clearTapCountTime?1:2,this._lastSetTapCountTime=s,t.tapCount=i}else(t.type===MS.CHANGE||t.type===MS.CONTEXT_MENU)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let i of this._ignoreTargets)if(i.contains(t.initialTarget))return;let e=[];for(let i of this._targets)if(i.contains(t.initialTarget)){let s=0,r=t.initialTarget;for(;r&&r!==i;)s++,r=r.parentElement;e.push([s,i])}e.sort((e,t)=>e[0]-t[0]);for(let[,i]of e)i.dispatchEvent(t),this._dispatched=!0}}_inertia(t,i,s,r,n,o,a,l,c){this._handle=Gy(t,()=>{let h=Date.now(),u=h-s,d=0,f=0,p=!0;r+=e._scrollFriction*u,a+=e._scrollFriction*u,r>0&&(p=!1,d=n*r*u),a>0&&(p=!1,f=l*a*u);let g=this._newGestureEvent(MS.CHANGE);g.translationX=d,g.translationY=f,i.forEach(e=>e.dispatchEvent(g)),p||this._inertia(t,i,h,r,n,o+d,a,l,c+f)})}_handleTouchMove(e){let t=Date.now();for(let i=0,s=e.changedTouches.length;i<s;i++){let s=e.changedTouches.item(i);if(!this._activeTouches.hasOwnProperty(String(s.identifier))){console.warn("end of an UNKNOWN touch",s);continue}let r=this._activeTouches[s.identifier],n=this._newGestureEvent(MS.CHANGE,r.initialTarget);n.translationX=s.pageX-jS(r.rollingPageX),n.translationY=s.pageY-jS(r.rollingPageY),n.pageX=s.pageX,n.pageY=s.pageY,n.clientX=s.clientX,n.clientY=s.clientY,this._dispatchEvent(n),r.rollingPageX.length>3&&(r.rollingPageX.shift(),r.rollingPageY.shift(),r.rollingTimestamps.shift()),r.rollingPageX.push(s.pageX),r.rollingPageY.push(s.pageY),r.rollingTimestamps.push(t)}this._dispatched&&(e.preventDefault(),e.stopPropagation(),this._dispatched=!1)}};LS._scrollFriction=-.005,LS._holdDelay=700,LS._clearTapCountTime=400,Ix([function(e,t,i){let s=null,r=null;if("function"==typeof i.value?(s="value",r=i.value,0!==r.length&&console.warn("Memoize should only be used in functions with zero parameters")):"function"==typeof i.get&&(s="get",r=i.get),!r||!s)throw new Error("not supported");let n=`$memoize$${t}`;i[s]=function(...e){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,e)}),this[n]}}],LS,"isTouchDevice",1);var PS=LS,RS=class{constructor(e,t,i,s,r,n,o,a,l){this._renderService=e,this._mouseCoordsService=t,this._mouseStateService=i,this._coreService=s,this._bufferService=r,this._optionsService=n,this._selectionService=o,this._logService=a,this._coreBrowserService=l,this._lastEvent=null,this._wheelPartialScroll=0,this._touchScrollAccumulator=0}bindMouse(e,t,i){let{element:s,document:r}=e,n=new Dy,o=new Dy;t(n),t(o);let a={target:e,focus:i,requestedEvents:{mouseup:null,wheel:null,mousedrag:null,mousemove:null},mouseupListener:n,mousedragListener:o},l={mouseup:e=>this._handleMouseUp(a,e),wheel:e=>this._handleWheel(a,e),mousedrag:e=>this._handleMouseDrag(a,e),mousemove:e=>this._handleMouseMove(a,e)};this._altMouseCursor=new AS(s,r,()=>this._mouseStateService.areMouseEventsActive&&!!this._optionsService.rawOptions.mouseEventsRequireAlt),t(this._altMouseCursor),t(this._mouseStateService.onProtocolChange(e=>{this._handleProtocolChange(a,l,e)})),t(this._optionsService.onSpecificOptionChange("mouseEventsRequireAlt",()=>{var e;this._syncMouseModeState(s),null==(e=this._altMouseCursor)||e.sync()})),this._mouseStateService.activeProtocol=this._mouseStateService.activeProtocol,t(zy(s,"mousedown",e=>this._handleMouseDown(a,e))),t(zy(s,"wheel",e=>this._handlePassiveWheel(a,e),{passive:!1})),t(PS.addTarget(e.screenElement)),t(zy(e.screenElement,MS.START,()=>this._handleTouchStart())),t(zy(e.screenElement,MS.CHANGE,e=>this._handleTouchChange(a,e)))}_sendEvent(e,t){var i,s,r,n,o;let a,l,c=this._mouseCoordsService.getMouseReportCoords(t,e.target.screenElement);if(!c)return!1;switch(t.overrideType||t.type){case"mousemove":l=32,void 0===t.buttons?(a=3,void 0!==t.button&&(a=t.button<3?t.button:3)):a=1&t.buttons?0:4&t.buttons?1:2&t.buttons?2:3;break;case"mouseup":l=0,a=t.button<3?t.button:3;break;case"mousedown":l=1,a=t.button<3?t.button:3;break;case"wheel":if(!this._mouseStateService.allowCustomWheelEvent(t))return!1;let e=t.deltaY;if(0===e||0===this._consumeWheelEvent(t,null==(n=null==(r=null==(s=null==(i=this._renderService)?void 0:i.dimensions)?void 0:s.device)?void 0:r.cell)?void 0:n.height,null==(o=this._coreBrowserService)?void 0:o.dpr))return!1;l=e<0?0:1,a=4;break;default:return!1}if(void 0===l||void 0===a||a>4||4!==a&&this._optionsService.rawOptions.mouseEventsRequireAlt&&this._mouseStateService.areMouseEventsActive&&!t.altKey)return!1;let h=4!==a&&this._optionsService.rawOptions.mouseEventsRequireAlt&&this._mouseStateService.areMouseEventsActive;return this._triggerMouseEvent({col:c.col,row:c.row,x:c.x,y:c.y,button:a,action:l,ctrl:t.ctrlKey,alt:!h&&t.altKey,shift:t.shiftKey})}_handleMouseUp(e,t){this._sendEvent(e,t),t.buttons||(e.mouseupListener.clear(),e.mousedragListener.clear())}_handleWheel(e,t){return this._sendEvent(e,t),t.preventDefault(),t.stopPropagation(),!1}_handleMouseDrag(e,t){t.buttons&&this._sendEvent(e,t)}_handleMouseMove(e,t){t.buttons||this._sendEvent(e,t)}_handleMouseDown(e,t){if(t.preventDefault(),e.focus(),!this._mouseStateService.areMouseEventsActive||this._selectionService.shouldForceSelection(t))return;this._sendEvent(e,t);let{element:i,document:s}=e.target,r=i.ownerDocument??s;e.requestedEvents.mouseup&&(e.mouseupListener.value=zy(r,"mouseup",e.requestedEvents.mouseup)),e.requestedEvents.mousedrag&&(e.mousedragListener.value=zy(r,"mousemove",e.requestedEvents.mousedrag))}_handlePassiveWheel(e,t){var i,s,r,n,o;if(!e.requestedEvents.wheel){if(!this._mouseStateService.allowCustomWheelEvent(t))return!1;if(!this._bufferService.buffer.hasScrollback){if(0===t.deltaY)return!1;if(0===this._consumeWheelEvent(t,null==(n=null==(r=null==(s=null==(i=this._renderService)?void 0:i.dimensions)?void 0:s.device)?void 0:r.cell)?void 0:n.height,null==(o=this._coreBrowserService)?void 0:o.dpr))return t.preventDefault(),t.stopPropagation(),!1;let e=""+(this._coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(t.deltaY<0?"A":"B");return this._coreService.triggerDataEvent(e,!0),t.preventDefault(),t.stopPropagation(),!1}}}_handleTouchStart(){this._touchScrollAccumulator=0}_handleTouchChange(e,t){var i,s;t.preventDefault(),t.stopPropagation(),e.requestedEvents.wheel?this._handleTouchScrollAsWheel(e,t):this._bufferService.buffer.hasScrollback?null==(s=(i=e.target).handleTouchScroll)||s.call(i,t.translationY):this._handleTouchScrollAsKeys(t)}_handleTouchScrollAsKeys(e){var t;let i=null==(t=this._renderService)?void 0:t.dimensions.css.cell.height;if(!i)return;this._touchScrollAccumulator-=e.translationY;let s=Math.trunc(this._touchScrollAccumulator/i);if(0===s)return;this._touchScrollAccumulator-=s*i;let r=""+(this._coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(s<0?"A":"B");for(let n=0;n<Math.abs(s);n++)this._coreService.triggerDataEvent(r,!0)}_handleTouchScrollAsWheel(e,t){var i;let s=null==(i=this._renderService)?void 0:i.dimensions.css.cell.height;if(!s)return;this._touchScrollAccumulator-=t.translationY;let r=Math.trunc(this._touchScrollAccumulator/s);if(0===r)return;this._touchScrollAccumulator-=r*s;let n=this._mouseCoordsService.getMouseReportCoords(t,e.target.screenElement);if(n)for(let o=0;o<Math.abs(r);o++)this._triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:4,action:r<0?0:1,ctrl:!1,alt:!1,shift:!1})}reset(){this._lastEvent=null,this._wheelPartialScroll=0,this._touchScrollAccumulator=0}_syncMouseModeState(e){var t;this._mouseStateService.areMouseEventsActive?this._optionsService.rawOptions.mouseEventsRequireAlt?(null==(t=this._altMouseCursor)||t.resetClass(),this._selectionService.enable()):(e.classList.add("enable-mouse-events"),this._selectionService.disable()):(e.classList.remove("enable-mouse-events"),this._selectionService.enable())}_handleProtocolChange(e,t,i){var s;let{element:r}=e.target,{requestedEvents:n}=e;i?"debug"===this._optionsService.rawOptions.logLevel&&this._logService.debug("Binding to mouse events:",this._explainEvents(i)):this._logService.debug("Unbinding from mouse events."),this._syncMouseModeState(r),null==(s=this._altMouseCursor)||s.sync(),8&i?n.mousemove||(r.addEventListener("mousemove",t.mousemove),n.mousemove=t.mousemove):(n.mousemove&&r.removeEventListener("mousemove",n.mousemove),n.mousemove=null),16&i?n.wheel||(r.addEventListener("wheel",t.wheel,{passive:!1}),n.wheel=t.wheel):(n.wheel&&r.removeEventListener("wheel",n.wheel),n.wheel=null),2&i?n.mouseup??(n.mouseup=t.mouseup):(e.mouseupListener.clear(),n.mouseup=null),4&i?n.mousedrag??(n.mousedrag=t.mousedrag):(e.mousedragListener.clear(),n.mousedrag=null)}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}_consumeWheelEvent(e,t,i){if(0===e.deltaY||e.shiftKey||void 0===t||void 0===i)return 0;let s=t/i,r=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=s+0,Math.abs(e.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||4===e.button&&32===e.action||3===e.button&&32!==e.action||4!==e.button&&(2===e.action||3===e.action)||(e.col++,e.row++,32===e.action&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._mouseStateService.isPixelEncoding))||!this._mouseStateService.restrictMouseEvent(e))return!1;let t=this._mouseStateService.encodeMouseEvent(e);return t&&(this._mouseStateService.isDefaultEncoding?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}_explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,t,i){if(i){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)}};RS=Ix([Fx(0,yy),Fx(1,by),Fx(2,oy),Fx(3,ay),Fx(4,ny),Fx(5,uy),Fx(6,wy),Fx(7,hy),Fx(8,_y)],RS);var AS=class{constructor(e,t,i){this._element=e,this._document=t,this._isActive=i,this._listeners=new Dy}dispose(){this._listeners.dispose()}sync(){var e;if(this._listeners.clear(),!this._isActive())return;let t=new By,i=e=>this.syncFromModifier(e);t.add(zy(this._document,"keydown",i)),t.add(zy(this._document,"keyup",i)),t.add(zy(this._element,"mousemove",i));let s=null==(e=this._element.ownerDocument)?void 0:e.defaultView;s&&t.add(zy(s,"blur",()=>{this._isActive()&&this.resetClass()})),this._listeners.value=t}resetClass(){this._updateClass(!1)}syncFromModifier(e){this._isActive()&&this._updateClass(e.getModifierState("Alt"))}_updateClass(e){e?this._element.classList.add("enable-mouse-events"):this._element.classList.remove("enable-mouse-events")}},TS=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){void 0!==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,i){this._rowCount=i,e=e??0,t=t??this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t,void 0===this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return void this._runRefreshCallbacks();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=[]}},zS=class{constructor(e){this._tasks=[],this._i=0,this._logService=e}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,i,s=0,r=e.timeRemaining();for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),s=Math.max(t,s),i=e.timeRemaining(),1.5*s>i)return r-t<-20&&this._logService.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),void this._start();r=i}this.clear()}},OS="requestIdleCallback"in globalThis?class extends zS{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:class extends zS{_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())}}},IS=class{constructor(e){this._queue=new OS(e)}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}dispose(){this._queue.clear()}},FS=class extends Ey{constructor(e,t,i,s,r,n,o,a,l,c){super(),this._rowCount=e,this._optionsService=i,this._logService=s,this._charSizeService=r,this._coreService=n,this._coreBrowserService=l,this._renderer=this._register(new Dy),this._observerDisposable=this._register(new Dy),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 Sw),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Sw),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Sw),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Sw),this.onRefreshRequest=this._onRefreshRequest.event,this._pausedResizeTask=this._register(new IS(this._logService)),this._renderDebouncer=new TS((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new HS(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Ny(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(a.onResize(()=>this._fullRefresh())),this._register(a.buffers.onBufferActivate(()=>{var e;return null==(e=this._renderer.value)?void 0:e.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(["drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(a.cols,a.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(a.buffer.y,a.buffer.y,void 0,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let i=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});this._observerDisposable.value=Ny(()=>{var e;null==(e=this._intersectionObserver)||e.disconnect(),this._intersectionObserver=void 0}),this._intersectionObserver=i,i.observe(t)}}_handleIntersectionChange(e){var t,i;this._isPaused=void 0===e.isIntersecting?0===e.intersectionRatio:!e.isIntersecting,null==(i=null==(t=this._renderer.value)?void 0:t.handleViewportVisibilityChange)||i.call(t,!this._isPaused),!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,i=!1,s=!1){if(this._isPaused)return void(this._needsFullRefresh=!0);if(this._coreService.decPrivateModes.synchronizedOutput)return void this._syncOutputHandler.bufferRows(e,t);let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),s||(this._isNextRenderRedrawOnly=!1),i?this._renderRows(e,t):this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput)return void this._syncOutputHandler.bufferRows(e,t);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(e=>this.refreshRows(e.start,e.end,e.sync,!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&&(null==(t=(e=this._renderer.value).clearTextureAtlas)||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 i;return null==(i=this._renderer.value)?void 0:i.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;null==(e=this._renderer.value)||e.handleCharSizeChanged()}handleBlur(){var e;null==(e=this._renderer.value)||e.handleBlur()}handleFocus(){var e;null==(e=this._renderer.value)||e.handleFocus()}handleSelectionChanged(e,t,i){var s;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,null==(s=this._renderer.value)||s.handleSelectionChanged(e,t,i)}handleCursorMove(){var e;null==(e=this._renderer.value)||e.handleCursorMove()}clear(){var e;null==(e=this._renderer.value)||e.clear()}};FS=Ix([Fx(2,uy),Fx(3,hy),Fx(4,my),Fx(5,ay),Fx(6,py),Fx(7,ny),Fx(8,_y),Fx(9,ky)],FS);var HS=class{constructor(e,t,i){this._coreBrowserService=e,this._coreService=t,this._onTimeout=i,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??(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(void 0!==this._timeout&&(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(){void 0!==this._timeout&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function WS(e,t,i,s){let r,n=i.buffer.x,o=i.buffer.y;if(!i.buffer.hasScrollback)return function(e,t,i,s,r,n){return 0===KS(t,s,r,n).length?"":YS(qS(e,t,e,t-US(t,r),!1,r).length,VS("D",n))}(n,o,0,t,i,s)+KS(o,t,i,s)+function(e,t,i,s,r,n){let o;o=KS(t,s,r,n).length>0?s-US(s,r):t;let a=s,l=function(e,t,i,s,r,n){let o;return o=KS(t,s,r,n).length>0?s-US(s,r):t,e<i&&o<=s||e>=i&&o<s?"C":"D"}(e,t,i,s,r,n);return YS(qS(e,o,i,a,"C"===l,r).length,VS(l,n))}(n,o,e,t,i,s);if(o===t)return r=n>e?"D":"C",YS(Math.abs(n-e),VS(r,s));r=o>t?"D":"C";let a=Math.abs(o-t),l=function(e,t){return t.cols-e}(o>t?e:n,i)+(a-1)*i.cols+1+function(e){return e-1}(o>t?n:e);return YS(l,VS(r,s))}function KS(e,t,i,s){let r=e-US(e,i),n=t-US(t,i),o=Math.abs(r-n)-function(e,t,i){var s;let r=0,n=e-US(e,i),o=t-US(t,i);for(let a=0;a<Math.abs(n-o);a++){let o="A"===$S(e,t)?-1:1;(null==(s=i.buffer.lines.get(n+o*a))?void 0:s.isWrapped)&&r++}return r}(e,t,i);return YS(o,VS($S(e,t),s))}function US(e,t){let i=0,s=t.buffer.lines.get(e),r=null==s?void 0:s.isWrapped;for(;r&&e>=0&&e<t.rows;)i++,s=t.buffer.lines.get(--e),r=null==s?void 0:s.isWrapped;return i}function $S(e,t){return e>t?"A":"B"}function qS(e,t,i,s,r,n){let o=e,a=t,l="";for(;(o!==i||a!==s)&&a>=0&&a<n.buffer.lines.length;)o+=r?1:-1,r&&o>n.cols-1?(l+=n.buffer.translateBufferLineToString(a,!1,e,o),o=0,e=0,a++):!r&&o<0&&(l+=n.buffer.translateBufferLineToString(a,!1,0,e+1),o=n.cols-1,e=o,a--);return l+n.buffer.translateBufferLineToString(a,!1,e,o)}function VS(e,t){return""+(t?"O":"[")+e}function YS(e,t){e=Math.floor(e);let i="";for(let s=0;s<e;s++)i+=t;return i}var GS=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.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)&&(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=[0,0],!0)}};function XS(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 ZS=new RegExp(" ","g"),JS=class extends Ey{constructor(e,t,i,s,r,n,o,a,l,c){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=s,this._coreService=r,this._mouseCoordsService=n,this._optionsService=o,this._mouseStateService=a,this._renderService=l,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._trimListener=this._register(new Dy),this._workCell=new iy,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Sw),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Sw),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Sw),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Sw),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener.value=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new GS(this._bufferService),this._activeSelectionMode=0,this._register(Ny(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.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)&&(e[0]!==t[0]||e[1]!==t[1])}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let i=this._bufferService.buffer,s=[];if(3===this._activeSelectionMode){if(e[0]===t[0])return"";let r=e[0]<t[0]?e[0]:t[0],n=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=i.translateBufferLineToString(o,!0,r,n);s.push(e)}}else{let r=e[1]===t[1]?t[0]:void 0;s.push(i.translateBufferLineToString(e[1],!0,e[0],r));for(let n=e[1]+1;n<=t[1]-1;n++){let e=i.lines.get(n),t=i.translateBufferLineToString(n,!0);(null==e?void 0:e.isWrapped)?s[s.length-1]+=t:s.push(t)}if(e[1]!==t[1]){let e=i.lines.get(t[1]),r=i.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?s[s.length-1]+=r:s.push(r)}}return s.map(e=>e.replace(ZS," ")).join(hw?"\r\n":"\n")}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),uw&&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:3===this._activeSelectionMode})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!!(i&&s&&t)&&this._areCoordsInSelection(t,i,s)}isCellInSelection(e,t){let i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!(!i||!s)&&this._areCoordsInSelection([e,t],i,s)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]<i[1]||t[1]===i[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<i[0]||t[1]<i[1]&&e[1]===i[1]&&e[0]<i[0]||t[1]<i[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var i,s;let r=null==(s=null==(i=this._linkifier.currentLink)?void 0:i.link)?void 0:s.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=XS(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let n=this._getMouseBufferCoords(e);return!!n&&(this._selectWordAt(n,t),this._model.selectionEnd=void 0,!0)}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._mouseCoordsService.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=SS(this._coreBrowserService.window,e,this._screenElement)[1],i=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-50),50),t/=50,t/Math.abs(t)+Math.round(14*t))}shouldForceSelection(e){return this._optionsService.rawOptions.mouseEventsRequireAlt&&this._mouseStateService.areMouseEventsActive?!e.altKey:cw?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(2===e.button&&this.hasSelection||0!==e.button||this._optionsService.rawOptions.mouseEventsRequireAlt&&this._mouseStateService.areMouseEventsActive&&e.altKey)){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):1===e.detail?this._handleSingleClick(e):2===e.detail?this._handleDoubleClick(e):3===e.detail&&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(),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){let t=this.hasSelection;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,t&&this._fireOnSelectionChange(this._model.finalSelectionStart,this._model.finalSelectionEnd,!1);let i=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);i&&i.length!==this._model.selectionStart[0]&&0===i.hasWidth(this._model.selectionStart[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(!this._optionsService.rawOptions.mouseEventsRequireAlt||!this._mouseStateService.areMouseEventsActive)&&(e.altKey&&!(cw&&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)return void this.refresh(!0);2===this._activeSelectionMode?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:1===this._activeSelectionMode&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),3!==this._activeSelectionMode&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let i=this._bufferService.buffer;if(this._model.selectionEnd[1]<i.lines.length){let e=i.lines.get(this._model.selectionEnd[1]);e&&0===e.hasWidth(this._model.selectionEnd[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?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows-1,e.lines.length-1)):(3!==this._activeSelectionMode&&(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<500&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseCoordsService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&void 0!==t[0]&&void 0!==t[1]){let e=WS(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,i=!(!e||!t||e[0]===t[0]&&e[1]===t[1]);i?!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,i):this._oldHasSelection&&this._fireOnSelectionChange(e,t,i)}_fireOnSelectionChange(e,t,i){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.value=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let s=0;t>=s;s++){let r=e.loadCell(s,this._workCell).getChars().length;0===this._workCell.getWidth()?i--:r>1&&t!==s&&(i+=r-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,s=!0){if(e[0]>=this._bufferService.cols)return;let r=this._bufferService.buffer,n=r.lines.get(e[1]);if(!n)return;let o=r.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(n,e[0]),l=a,c=e[0]-a,h=0,u=0,d=0,f=0;if(" "===o.charAt(a)){for(;a>0&&" "===o.charAt(a-1);)a--;for(;l<o.length&&" "===o.charAt(l+1);)l++}else{let t=e[0],i=e[0];0===n.getWidth(t)&&(h++,t--),2===n.getWidth(i)&&(u++,i++);let s=n.getString(i).length;for(s>1&&(f+=s-1,l+=s-1);t>0&&a>0&&!this._isCharWordSeparator(n.loadCell(t-1,this._workCell));){n.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;0===this._workCell.getWidth()?(h++,t--):e>1&&(d+=e-1,a-=e-1),a--,t--}for(;i<n.length&&l+1<o.length&&!this._isCharWordSeparator(n.loadCell(i+1,this._workCell));){n.loadCell(i+1,this._workCell);let e=this._workCell.getChars().length;2===this._workCell.getWidth()?(u++,i++):e>1&&(f+=e-1,l+=e-1),l++,i++}}l++;let p=a+c-h+d,g=Math.min(this._bufferService.cols,l-a+h+u-d-f);if(t||""!==o.slice(a,l).trim()){if(i&&0===p&&32!==n.getCodePoint(0)){let t=r.lines.get(e[1]-1);if(t&&n.isWrapped&&32!==t.getCodePoint(this._bufferService.cols-1)){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;p-=e,g+=e}}}if(s&&p+g===this._bufferService.cols&&32!==n.getCodePoint(this._bufferService.cols-1)){let t=r.lines.get(e[1]+1);if((null==t?void 0:t.isWrapped)&&32!==t.getCodePoint(0)){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(g+=t.length)}}return{start:p,length:g}}}_selectWordAt(e,t){let i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return 0!==e.getWidth()&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),i={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=XS(i,this._bufferService.cols)}};JS=Ix([Fx(3,ny),Fx(4,ay),Fx(5,by),Fx(6,uy),Fx(7,oy),Fx(8,yy),Fx(9,_y)],JS);var QS=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},ek=class{constructor(){this._color=new QS,this._css=new QS}setCss(e,t,i){this._css.set(e,t,i)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,i){this._color.set(e,t,i)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},tk=Object.freeze((()=>{let e=[Gw.toColor("#2e3436"),Gw.toColor("#cc0000"),Gw.toColor("#4e9a06"),Gw.toColor("#c4a000"),Gw.toColor("#3465a4"),Gw.toColor("#75507b"),Gw.toColor("#06989a"),Gw.toColor("#d3d7cf"),Gw.toColor("#555753"),Gw.toColor("#ef2929"),Gw.toColor("#8ae234"),Gw.toColor("#fce94f"),Gw.toColor("#729fcf"),Gw.toColor("#ad7fa8"),Gw.toColor("#34e2e2"),Gw.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){let s=t[i/36%6|0],r=t[i/6%6|0],n=t[i%6];e.push({css:qw.toCss(s,r,n),rgba:qw.toRgba(s,r,n)})}for(let i=0;i<24;i++){let t=8+10*i;e.push({css:qw.toCss(t,t,t),rgba:qw.toRgba(t,t,t)})}return e})()),ik=Gw.toColor("#ffffff"),sk=Gw.toColor("#000000"),rk=Gw.toColor("#ffffff"),nk=sk,ok={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},ak=ik,lk=class extends Ey{constructor(e){super(),this._optionsService=e,this._contrastCache=new ek,this._halfContrastCache=new ek,this._onChangeColors=this._register(new Sw),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:ik,background:sk,cursor:rk,cursorAccent:nk,selectionForeground:void 0,selectionBackgroundTransparent:ok,selectionBackgroundOpaque:Yw.blend(sk,ok),selectionInactiveBackgroundTransparent:ok,selectionInactiveBackgroundOpaque:Yw.blend(sk,ok),scrollbarSliderBackground:Yw.opacity(ik,.2),scrollbarSliderHoverBackground:Yw.opacity(ik,.4),scrollbarSliderActiveBackground:Yw.opacity(ik,.5),overviewRulerBorder:ik,ansi:tk.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=ck(e.foreground,ik),t.background=ck(e.background,sk),t.cursor=Yw.blend(t.background,ck(e.cursor,rk)),t.cursorAccent=Yw.blend(t.background,ck(e.cursorAccent,nk)),t.selectionBackgroundTransparent=ck(e.selectionBackground,ok),t.selectionBackgroundOpaque=Yw.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=ck(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Yw.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?ck(e.selectionForeground,iS):void 0,t.selectionForeground===iS&&(t.selectionForeground=void 0),Yw.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Yw.opacity(t.selectionBackgroundTransparent,.3)),Yw.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Yw.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=ck(e.scrollbarSliderBackground,Yw.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=ck(e.scrollbarSliderHoverBackground,Yw.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=ck(e.scrollbarSliderActiveBackground,Yw.opacity(t.foreground,.5)),t.overviewRulerBorder=ck(e.overviewRulerBorder,ak),t.ansi=tk.slice(),t.ansi[0]=ck(e.black,tk[0]),t.ansi[1]=ck(e.red,tk[1]),t.ansi[2]=ck(e.green,tk[2]),t.ansi[3]=ck(e.yellow,tk[3]),t.ansi[4]=ck(e.blue,tk[4]),t.ansi[5]=ck(e.magenta,tk[5]),t.ansi[6]=ck(e.cyan,tk[6]),t.ansi[7]=ck(e.white,tk[7]),t.ansi[8]=ck(e.brightBlack,tk[8]),t.ansi[9]=ck(e.brightRed,tk[9]),t.ansi[10]=ck(e.brightGreen,tk[10]),t.ansi[11]=ck(e.brightYellow,tk[11]),t.ansi[12]=ck(e.brightBlue,tk[12]),t.ansi[13]=ck(e.brightMagenta,tk[13]),t.ansi[14]=ck(e.brightCyan,tk[14]),t.ansi[15]=ck(e.brightWhite,tk[15]),e.extendedAnsi){let i=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<i;s++)t.ansi[s+16]=ck(e.extendedAnsi[s],tk[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(void 0!==e)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]}else for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t]}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()}}};function ck(e,t){if(void 0!==e)try{return Gw.toColor(e)}catch{}return t}lk=Ix([Fx(0,uy)],lk);var hk={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:["'",'"']};var uk=class{constructor(){this._functionalKeyCodes={Escape:27,Enter:13,Tab:9,Backspace:127,CapsLock:57358,ScrollLock:57359,NumLock:57360,PrintScreen:57361,Pause:57362,ContextMenu:57363,F13:57376,F14:57377,F15:57378,F16:57379,F17:57380,F18:57381,F19:57382,F20:57383,F21:57384,F22:57385,F23:57386,F24:57387,F25:57388,KP_0:57399,KP_1:57400,KP_2:57401,KP_3:57402,KP_4:57403,KP_5:57404,KP_6:57405,KP_7:57406,KP_8:57407,KP_9:57408,KP_Decimal:57409,KP_Divide:57410,KP_Multiply:57411,KP_Subtract:57412,KP_Add:57413,KP_Enter:57414,KP_Equal:57415,ShiftLeft:57441,ShiftRight:57447,ControlLeft:57442,ControlRight:57448,AltLeft:57443,AltRight:57449,MetaLeft:57444,MetaRight:57450,MediaPlayPause:57430,MediaStop:57432,MediaTrackNext:57435,MediaTrackPrevious:57436,AudioVolumeDown:57438,AudioVolumeUp:57439,AudioVolumeMute:57440},this._csiTildeKeys={Insert:2,Delete:3,PageUp:5,PageDown:6,F5:15,F6:17,F7:18,F8:19,F9:20,F10:21,F11:23,F12:24},this._csiLetterKeys={ArrowUp:"A",ArrowDown:"B",ArrowRight:"C",ArrowLeft:"D",Home:"H",End:"F"},this._ss3FunctionKeys={F1:"P",F2:"Q",F3:"R",F4:"S"}}_getNumpadKeyCode(e){if(e.code.startsWith("Numpad")){let t=e.code.slice(6);if(t>="0"&&t<="9")return 57399+parseInt(t,10);switch(t){case"Decimal":return 57409;case"Divide":return 57410;case"Multiply":return 57411;case"Subtract":return 57412;case"Add":return 57413;case"Enter":return 57414;case"Equal":return 57415}}}_getModifierKeyCode(e){switch(e.code){case"ShiftLeft":return 57441;case"ShiftRight":return 57447;case"ControlLeft":return 57442;case"ControlRight":return 57448;case"AltLeft":return 57443;case"AltRight":return 57449;case"MetaLeft":return 57444;case"MetaRight":return 57450}}_encodeModifiers(e){let t=0;return e.shiftKey&&(t|=1),e.altKey&&(t|=2),e.ctrlKey&&(t|=4),e.metaKey&&(t|=8),t>0?t+1:0}_getKeyCode(e,t){let i=this._getNumpadKeyCode(e);if(void 0!==i)return i;let s=this._getModifierKeyCode(e);if(void 0!==s)return s;let r=this._functionalKeyCodes[e.key];if(void 0!==r)return r;if((e.shiftKey||t&&e.altKey)&&e.code){if(e.code.startsWith("Digit")&&6===e.code.length){let t=e.code.charAt(5);if(t>="0"&&t<="9")return t.charCodeAt(0)}if(e.code.startsWith("Key")&&4===e.code.length)return e.code.charAt(3).toLowerCase().charCodeAt(0)}if(1===e.key.length){let t=e.key.codePointAt(0);return t>=65&&t<=90?t+32:t}}_isModifierKey(e){return"Shift"===e.key||"Control"===e.key||"Alt"===e.key||"Meta"===e.key}_isLockKey(e){return"CapsLock"===e.key||"NumLock"===e.key||"ScrollLock"===e.key}_buildCsiLetterSequence(e,t,i,s){let r=s&&1!==i;if(t>0||r){let s="[1;"+(t>0?t:"1");return r&&(s+=":"+i),s+=e,s}return"["+e}_buildSs3Sequence(e,t,i,s){let r=s&&1!==i;if(t>0||r){let s="[1;"+(t>0?t:"1");return r&&(s+=":"+i),s+=e,s}return"O"+e}_buildCsiTildeSequence(e,t,i,s){let r=s&&1!==i,n="["+e;return(t>0||r)&&(n+=";"+(t>0?t:"1"),r&&(n+=":"+i)),n+="~",n}_buildCsiUSequence(e,t,i,s,r,n,o){let a,l=!!(2&r),c="["+t;!!(4&r)&&e.shiftKey&&1===e.key.length&&!n&&!o&&(a=e.key.codePointAt(0),c+=":"+a);let h=16&r&&3!==s&&1===e.key.length&&!n&&!o&&!e.ctrlKey?e.key.codePointAt(0):void 0,u=l&&1!==s&&(3===s||void 0===h);return(i>0||u||void 0!==h)&&(c+=";",i>0?c+=i:u&&(c+="1"),u&&(c+=":"+s)),void 0!==h&&(c+=";"+h),c+="u",c}evaluate(e,t,i=1,s=!1){let r={type:0,cancel:!1,key:void 0},n=this._encodeModifiers(e),o=this._isModifierKey(e),a=!!(2&t);if(!a&&3===i||o&&!(8&t)||this._isLockKey(e)&&!(8&t))return r;let l=this._csiLetterKeys[e.key];if(l)return r.key=this._buildCsiLetterSequence(l,n,i,a),r.cancel=!0,r;let c=this._ss3FunctionKeys[e.key];if(c)return r.key=this._buildSs3Sequence(c,n,i,a),r.cancel=!0,r;let h=this._csiTildeKeys[e.key];if(void 0!==h)return r.key=this._buildCsiTildeSequence(h,n,i,a),r.cancel=!0,r;let u=this._getKeyCode(e,s);if(void 0===u)return r;let d=13===u||9===u||127===u;if(d&&3===i&&!(8&t))return r;let f=void 0!==this._functionalKeyCodes[e.key]||void 0!==this._getNumpadKeyCode(e);if(8&t||a&&3===i||(1&t||a)&&(f&&!d||n>0&&1!==e.key.length||n-1>1))r.key=this._buildCsiUSequence(e,u,n,i,t,f,o),r.cancel=!0;else{let t=13===u?"\r":9===u?"\t":127===u?"":void 0;t?r.key=t:1===e.key.length&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&(r.key=e.key)}return r}static shouldUseProtocol(e){return e>0}},dk=class{constructor(){this._codeToVk={KeyA:65,KeyB:66,KeyC:67,KeyD:68,KeyE:69,KeyF:70,KeyG:71,KeyH:72,KeyI:73,KeyJ:74,KeyK:75,KeyL:76,KeyM:77,KeyN:78,KeyO:79,KeyP:80,KeyQ:81,KeyR:82,KeyS:83,KeyT:84,KeyU:85,KeyV:86,KeyW:87,KeyX:88,KeyY:89,KeyZ:90,Digit0:48,Digit1:49,Digit2:50,Digit3:51,Digit4:52,Digit5:53,Digit6:54,Digit7:55,Digit8:56,Digit9:57,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,F13:124,F14:125,F15:126,F16:127,F17:128,F18:129,F19:130,F20:131,F21:132,F22:133,F23:134,F24:135,Numpad0:96,Numpad1:97,Numpad2:98,Numpad3:99,Numpad4:100,Numpad5:101,Numpad6:102,Numpad7:103,Numpad8:104,Numpad9:105,NumpadMultiply:106,NumpadAdd:107,NumpadSeparator:108,NumpadSubtract:109,NumpadDecimal:110,NumpadDivide:111,NumpadEnter:13,NumLock:144,ArrowUp:38,ArrowDown:40,ArrowLeft:37,ArrowRight:39,Home:36,End:35,PageUp:33,PageDown:34,Insert:45,Delete:46,ShiftLeft:16,ShiftRight:16,ControlLeft:17,ControlRight:17,AltLeft:18,AltRight:18,MetaLeft:91,MetaRight:92,CapsLock:20,ScrollLock:145,Escape:27,Enter:13,Tab:9,Space:32,Backspace:8,Pause:19,ContextMenu:93,PrintScreen:44,Semicolon:186,Equal:187,Comma:188,Minus:189,Period:190,Slash:191,Backquote:192,BracketLeft:219,Backslash:220,BracketRight:221,Quote:222,IntlBackslash:226},this._codeToScancode={KeyQ:16,KeyW:17,KeyE:18,KeyR:19,KeyT:20,KeyY:21,KeyU:22,KeyI:23,KeyO:24,KeyP:25,KeyA:30,KeyS:31,KeyD:32,KeyF:33,KeyG:34,KeyH:35,KeyJ:36,KeyK:37,KeyL:38,KeyZ:44,KeyX:45,KeyC:46,KeyV:47,KeyB:48,KeyN:49,KeyM:50,Digit1:2,Digit2:3,Digit3:4,Digit4:5,Digit5:6,Digit6:7,Digit7:8,Digit8:9,Digit9:10,Digit0:11,F1:59,F2:60,F3:61,F4:62,F5:63,F6:64,F7:65,F8:66,F9:67,F10:68,F11:87,F12:88,Numpad0:82,Numpad1:79,Numpad2:80,Numpad3:81,Numpad4:75,Numpad5:76,Numpad6:77,Numpad7:71,Numpad8:72,Numpad9:73,NumpadMultiply:55,NumpadAdd:78,NumpadSubtract:74,NumpadDecimal:83,NumpadDivide:53,NumpadEnter:28,NumLock:69,ArrowUp:72,ArrowDown:80,ArrowLeft:75,ArrowRight:77,Home:71,End:79,PageUp:73,PageDown:81,Insert:82,Delete:83,ShiftLeft:42,ShiftRight:54,ControlLeft:29,ControlRight:29,AltLeft:56,AltRight:56,CapsLock:58,ScrollLock:70,Escape:1,Enter:28,Tab:15,Space:57,Backspace:14,Pause:69,Semicolon:39,Equal:13,Comma:51,Minus:12,Period:52,Slash:53,Backquote:41,BracketLeft:26,Backslash:43,BracketRight:27,Quote:40},this._enhancedKeyCodes=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown","Insert","Delete","NumpadEnter","NumpadDivide","ControlRight","AltRight","PrintScreen","Pause","ContextMenu","MetaLeft","MetaRight"]),this._keyToControlChar={Enter:13,Backspace:8,Tab:9,Escape:27}}_getVirtualKeyCode(e){let t=this._codeToVk[e.code];return void 0!==t?t:e.keyCode||0}_getScanCode(e){return this._codeToScancode[e.code]||0}_getUnicodeChar(e){if(e.ctrlKey&&!e.altKey&&!e.metaKey){if("Enter"===e.key)return 10;if("Backspace"===e.key)return 127}let t=this._keyToControlChar[e.key];if(void 0!==t)return t;if(1===e.key.length){let t=e.key.codePointAt(0)||0;if(e.ctrlKey&&!e.altKey&&!e.metaKey){if(t>=65&&t<=90)return t-64;if(t>=97&&t<=122)return t-96}return t}return 0}_getControlKeyState(e){let t=0;return e.shiftKey&&(t|=16),e.ctrlKey&&("ControlRight"===e.code?t|=4:t|=8),e.altKey&&("AltRight"===e.code?t|=1:t|=2),this._enhancedKeyCodes.has(e.code)&&(t|=256),t}evaluateKeyboardEvent(e,t){return{type:0,cancel:!0,key:`[${this._getVirtualKeyCode(e)};${this._getScanCode(e)};${this._getUnicodeChar(e)};${t?1:0};${this._getControlKeyState(e)};1_`}}},fk=class{constructor(e,t){this._coreService=e,this._optionsService=t}_getWin32InputMode(){return this._win32InputMode??(this._win32InputMode=new dk),this._win32InputMode}_getKittyKeyboard(){return this._kittyKeyboard??(this._kittyKeyboard=new uk),this._kittyKeyboard}evaluateKeyDown(e){if(this.useWin32InputMode)return this._getWin32InputMode().evaluateKeyboardEvent(e,!0);let t=this._coreService.kittyKeyboard.flags;return this.useKitty?this._getKittyKeyboard().evaluate(e,t,e.repeat?2:1,cw&&this._optionsService.rawOptions.macOptionIsMeta):function(e,t,i,s){var r;let n={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:"UIKeyInputUpArrow"===e.key?n.key=t?"OA":"":"UIKeyInputLeftArrow"===e.key?n.key=t?"OD":"":"UIKeyInputRightArrow"===e.key?n.key=t?"OC":"":"UIKeyInputDownArrow"===e.key&&(n.key=t?"OB":"");break;case 8:n.key=e.ctrlKey?"\b":"",e.altKey&&(n.key=""+n.key);break;case 9:if(e.shiftKey){n.key="";break}n.key="\t",n.cancel=!0;break;case 13:"c"===e.key&&e.ctrlKey?n.key="":n.key=e.altKey?"\r":"\r",n.cancel=!0;break;case 27:n.key="",e.altKey&&(n.key=""),n.cancel=!0;break;case 37:if(e.metaKey)break;n.key=o?"[1;"+(o+1)+"D":t?"OD":"";break;case 39:if(e.metaKey)break;n.key=o?"[1;"+(o+1)+"C":t?"OC":"";break;case 38:if(e.metaKey)break;n.key=o?"[1;"+(o+1)+"A":t?"OA":"";break;case 40:if(e.metaKey)break;n.key=o?"[1;"+(o+1)+"B":t?"OB":"";break;case 45:!e.shiftKey&&!e.ctrlKey&&(n.key="[2~");break;case 46:n.key=o?"[3;"+(o+1)+"~":"[3~";break;case 36:n.key=o?"[1;"+(o+1)+"H":t?"OH":"";break;case 35:n.key=o?"[1;"+(o+1)+"F":t?"OF":"";break;case 33:e.shiftKey?n.type=2:e.ctrlKey?n.key="[5;"+(o+1)+"~":n.key="[5~";break;case 34:e.shiftKey?n.type=3:e.ctrlKey?n.key="[6;"+(o+1)+"~":n.key="[6~";break;case 112:n.key=o?"[1;"+(o+1)+"P":"OP";break;case 113:n.key=o?"[1;"+(o+1)+"Q":"OQ";break;case 114:n.key=o?"[1;"+(o+1)+"R":"OR";break;case 115:n.key=o?"[1;"+(o+1)+"S":"OS";break;case 116:n.key=o?"[15;"+(o+1)+"~":"[15~";break;case 117:n.key=o?"[17;"+(o+1)+"~":"[17~";break;case 118:n.key=o?"[18;"+(o+1)+"~":"[18~";break;case 119:n.key=o?"[19;"+(o+1)+"~":"[19~";break;case 120:n.key=o?"[20;"+(o+1)+"~":"[20~";break;case 121:n.key=o?"[21;"+(o+1)+"~":"[21~";break;case 122:n.key=o?"[23;"+(o+1)+"~":"[23~";break;case 123:n.key=o?"[24;"+(o+1)+"~":"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(i&&!s||!e.altKey||e.metaKey)if(!i||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey){if(e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&1===e.key.length)n.key=e.key;else if(e.key&&e.ctrlKey&&e.shiftKey)switch(e.code){case"Minus":n.key="";break;case"Digit2":n.key="\0";break;case"Digit6":n.key=""}}else 65===e.keyCode&&(n.type=1);else{let t=null==(r=hk[e.keyCode])?void 0:r[e.shiftKey?1:0];if(t)n.key=""+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,i=String.fromCharCode(t);e.shiftKey&&(i=i.toUpperCase()),n.key=""+i}else if(32===e.keyCode)n.key=""+(e.ctrlKey?"\0":" ");else if("Dead"===e.key&&e.code.startsWith("Key")){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),n.key=""+t,n.cancel=!0}}else e.keyCode>=65&&e.keyCode<=90?n.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?n.key="\0":e.keyCode>=51&&e.keyCode<=55?n.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?n.key="":"/"===e.key?n.key="":219===e.keyCode?n.key="":220===e.keyCode?n.key="":221===e.keyCode&&(n.key="")}return n}(e,this._coreService.decPrivateModes.applicationCursorKeys,cw,this._optionsService.rawOptions.macOptionIsMeta)}evaluateKeyUp(e){if(this.useWin32InputMode)return this._getWin32InputMode().evaluateKeyboardEvent(e,!1);let t=this._coreService.kittyKeyboard.flags;return this.useKitty&&2&t?this._getKittyKeyboard().evaluate(e,t,3,cw&&this._optionsService.rawOptions.macOptionIsMeta):void 0}get useKitty(){var e;let t=this._coreService.kittyKeyboard.flags;return!(!(null==(e=this._optionsService.rawOptions.vtExtensions)?void 0:e.kittyKeyboard)||!uk.shouldUseProtocol(t))}get useWin32InputMode(){var e;return!(!(null==(e=this._optionsService.rawOptions.vtExtensions)?void 0:e.win32InputMode)||!this._coreService.decPrivateModes.win32InputMode)}};fk=Ix([Fx(0,ay),Fx(1,uy)],fk);var pk=class{constructor(...e){this._entries=new Map;for(let[t,i]of e)this.set(t,i)}set(e,t){let i=this._entries.get(e);return this._entries.set(e,t),i}forEach(e){for(let[t,i]of this._entries.entries())e(t,i)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},gk=class{constructor(){this._services=new pk,this._services.set(cy,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let i=(r=e,r.di$dependencies||[]).sort((e,t)=>e.index-t.index),s=[];var r;for(let o of i){let t=this._services.get(o.id);if(!t)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);s.push(t)}let n=i.length>0?i[0].index:t.length;if(t.length!==n)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${n+1} conflicts with ${t.length} static arguments`);return new e(...t,...s)}},vk={trace:0,debug:1,info:2,warn:3,error:4,off:5},mk=class extends Ey{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=vk[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)"function"==typeof e[t]&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+t,...i)}trace(e,...t){var i;this._logLevel<=0&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var i;this._logLevel<=1&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var i;this._logLevel<=2&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var i;this._logLevel<=3&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var i;this._logLevel<=4&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,t)}};mk=Ix([Fx(0,uy)],mk);var _k=class extends Ey{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Sw),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Sw),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Sw),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 i=0;i<Math.min(e,this.length);i++)t[i]=this._array[this._getCyclicIndex(i)];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,...i){if(t){for(let i=e;i<this._length-t;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+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+i.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<i.length;s++)this._array[this._getCyclicIndex(e+s)]=i[s];if(i.length&&this.onInsertEmitter.fire({index:e,amount:i.length}),this._length+i.length>this._maxLength){let e=this._length+i.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let r=t-1;r>=0;r--)this.set(e+r+i,this.get(e+r));let s=e+t+i-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+i,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},bk=class{constructor(){this._chunks=[],this._length=0}get length(){return this._length}reset(){this._chunks.length=0,this._length=0}append(e){this._chunks.push(e),this._length+=e.length}toString(){return this._chunks.join("")}},xk=class{constructor(e){this._limit=e,this._builder=new bk}get length(){return this._builder.length}get limit(){return this._limit}reset(){this._builder.reset()}append(e){return this._builder.append(e),this._builder.length>this._limit&&(this._builder.reset(),!0)}toString(){return this._builder.toString()}},yk=Object.freeze(new ey),wk=0,Sk=new iy,kk=new bk,Ck=class e{constructor(e,t,i,s=!1){this._stringCache=e,this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*t);let r=i??iy.fromCharData([0,"",1,0]);for(let n=0;n<t;++n)this.setCell(n,r);this.length=t}get(e){let t=this._data[3*e+0],i=2097151&t;return[this._data[3*e+1],2097152&t?this._combined[e]:i?Xx(i):"",t>>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):i]}set(e,t){this._invalidateStringCache(),this._data[3*e+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[2]<<22):this._data[3*e+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?Xx(2097151&t):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,t){return wk=3*e,t.content=this._data[wk+0],t.fg=this._data[wk+1],t.bg=this._data[wk+2],2097152&t.content?t.combinedData=this._combined[e]:t.combinedData="",268435456&t.bg?t.extended=this._extendedAttrs[e]:t.extended=yk.extended.clone(),t}setCell(e,t){this._invalidateStringCache(),2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg}setCellFromCodepoint(e,t,i,s){this._invalidateStringCache(),268435456&s.bg&&(this._extendedAttrs[e]=s.extended),this._data[3*e+0]=t|i<<22,this._data[3*e+1]=s.fg,this._data[3*e+2]=s.bg}addCodepointToCell(e,t,i){this._invalidateStringCache();let s=this._data[3*e+0];2097152&s?this._combined[e]+=Xx(t):2097151&s?(this._combined[e]=Xx(2097151&s)+Xx(t),s&=-2097152,s|=2097152):s=t|1<<22,i&&(s&=-12582913,s|=i<<22),this._data[3*e+0]=s}insertCells(e,t,i){if(this._invalidateStringCache(),(e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),t<this.length-e){for(let i=this.length-e-t-1;i>=0;--i)this.setCell(e+t+i,this.loadCell(e+i,Sk));for(let s=0;s<t;++s)this.setCell(e+s,i)}else for(let s=e;s<this.length;++s)this.setCell(s,i);2===this.getWidth(this.length-1)&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(e,t,i){if(this._invalidateStringCache(),e%=this.length,t<this.length-e){for(let i=0;i<this.length-e-t;++i)this.setCell(e+i,this.loadCell(e+t+i,Sk));for(let e=this.length-t;e<this.length;++e)this.setCell(e,i)}else for(let s=e;s<this.length;++s)this.setCell(s,i);e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),0===this.getWidth(e)&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,i)}replaceCells(e,t,i,s=!1){if(this._invalidateStringCache(),s)for(e&&2===this.getWidth(e-1)&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),t<this.length&&2===this.getWidth(t-1)&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,i);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,i),e++;else for(e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),t<this.length&&2===this.getWidth(t-1)&&this.setCellFromCodepoint(t,0,1,i);e<t&&e<this.length;)this.setCell(e++,i)}resize(e,t){if(this._invalidateStringCache(),e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let i=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*i)this._data=new Uint32Array(this._data.buffer,0,i);else{let e=new Uint32Array(i);e.set(this._data),this._data=e}for(let i=this.length;i<e;++i)this.setCell(i,t)}else{this._data=this._data.subarray(0,i);let t=Object.keys(this._combined);for(let i=0;i<t.length;i++){let s=parseInt(t[i],10);s>=e&&delete this._combined[s]}let s=Object.keys(this._extendedAttrs);for(let i=0;i<s.length;i++){let t=parseInt(s[i],10);t>=e&&delete this._extendedAttrs[t]}}return this.length=e,4*i*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(this._invalidateStringCache(),t)for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,e);else{this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}}copyFrom(e){this._invalidateStringCache(),this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._copySparseMapsFrom(e),this.isWrapped=e.isWrapped}clone(){let t=new e(this._stringCache,0,void 0,!1);return t._data=new Uint32Array(this._data),t.length=this.length,t._copySparseMapsFrom(this),t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,t,i,s,r){this._invalidateStringCache();let n=e._data;if(r)for(let o=s-1;o>=0;o--){for(let e=0;e<3;e++)this._data[3*(i+o)+e]=n[3*(t+o)+e];this._copyCellMapsFrom(e,t+o,i+o)}else for(let o=0;o<s;o++){for(let e=0;e<3;e++)this._data[3*(i+o)+e]=n[3*(t+o)+e];this._copyCellMapsFrom(e,t+o,i+o)}}translateToString(e,t,i,s){var r,n;let o=(void 0===t||0===t)&&void 0===i&&void 0===s;o&&(null==(n=(r=this._stringCache).touch)||n.call(r));let a=o?this._getStringCacheEntry(!1):void 0;if(o&&void 0!==(null==a?void 0:a.value)){if(e)return a.isTrimmed?a.value:a.value.trimEnd();if(!a.isTrimmed)return a.value}for(t=t??0,i=i??this.length,e&&(i=Math.min(i,this.getTrimmedLength())),s&&(s.length=0),kk.reset();t<i;){let e=this._data[3*t+0],i=2097151&e,r=2097152&e?this._combined[t]:i?Xx(i):" ";if(kk.append(r),s)for(let n=0;n<r.length;++n)s.push(t);t+=e>>22||1}s&&s.push(t);let l=kk.toString();if(kk.reset(),o){let t=this._getStringCacheEntry(!0);t.value=l,t.isTrimmed=!!e}return l}_getStringCacheEntry(e){var t;let i=null==(t=this._stringCacheEntryRef)?void 0:t.deref();if(i&&i.generation===this._stringCache.generation)return i;if(!e)return;let s=this._stringCache.allocateEntry();return this._stringCacheEntryRef=new WeakRef(s),s}_invalidateStringCache(){let e=this._getStringCacheEntry(!1);e&&(e.value=void 0,e.isTrimmed=!1)}_copyCellMapsFrom(e,t,i){let s=3*t;2097152&e._data[s+0]&&(this._combined[i]=e._combined[t]),268435456&e._data[s+2]&&(this._extendedAttrs[i]=e._extendedAttrs[t])}_copySparseMapsFrom(e){this._combined={},this._extendedAttrs={};for(let t=0;t<e.length;t++)this._copyCellMapsFrom(e,t,t)}},jk=class extends Ey{constructor(){super(),this.generation=0,this.entries=new Set,this._clearTimeout=this._register(new Dy),this._lastAccessTimestamp=0,this._register(Ny(()=>this.entries.clear()))}touch(){this._scheduleClear()}allocateEntry(){let e={value:void 0,isTrimmed:!1,generation:this.generation};return this.entries.add(e),this._scheduleClear(),e}clear(){this._clearTimeout.clear(),this._lastAccessTimestamp=0,this.generation++;for(let e of this.entries)e.value=void 0,e.isTrimmed=!1;this.entries.clear()}_scheduleClear(){this._lastAccessTimestamp=Date.now(),!this._clearTimeout.value&&this._scheduleClearTimeout(15e3)}_scheduleClearTimeout(e){this._clearTimeout.value=function(e,t=0){let i=setTimeout(()=>{e()},t);return Ny(()=>{clearTimeout(i)})}(()=>{let e=Date.now()-this._lastAccessTimestamp;e>=15e3?this.clear():this._scheduleClearTimeout(15e3-e)},e)}};function Nk(e,t,i){let s=[],r=0;for(let l=0;l<e.length;l++)r+=Mk(e,l,t);let n=0,o=0,a=0;for(;a<r;){if(r-a<i){s.push(r-a);break}n+=i;let l=Mk(e,o,t);n>l&&(n-=l,o++);let c=2===e[o].getWidth(n-1);c&&n--;let h=c?i-1:i;s.push(h),a+=h}return s}function Mk(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();let s=!e[t].hasContent(i-1)&&1===e[t].getWidth(i-1),r=2===e[t+1].getWidth(0);return s&&r?i-1:i}var Bk=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new Sw),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),My(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};Bk._nextId=1;var Ek=Bk,Dk={},Lk=Dk.B;Dk[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:"≥","{":"π","|":"≠","}":"£","~":"·"},Dk.A={"#":"£"},Dk.B=void 0,Dk[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},Dk.C=Dk[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},Dk.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},Dk.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},Dk.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},Dk.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},Dk.E=Dk[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},Dk.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},Dk.H=Dk[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},Dk["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Pk=4294967295,Rk=class extends Ey{constructor(e,t,i,s){super(),this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this._logService=s,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=yk.clone(),this.savedCharset=Lk,this.savedCharsets=[],this.savedGlevel=0,this.savedOriginMode=!1,this.savedWraparoundMode=!0,this.markers=[],this._nullCell=iy.fromCharData([0,"",1,0]),this._whitespaceCell=iy.fromCharData([0," ",1,32]),this._isClearing=!1,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new _k(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops(),this._memoryCleanupQueue=new OS(this._logService),this._register(Ny(()=>this._memoryCleanupQueue.clear())),this._register(Ny(()=>this.clearAllMarkers())),this._stringCache=this._register(new jk)}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 ty),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 ty),this._whitespaceCell}getBlankLine(e,t){return new Ck(this._stringCache,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>Pk?Pk:t}fillViewportRows(e){if(0===this.lines.length){e??(e=yk);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this._stringCache.clear(),this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new _k(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let i=this.getNullCell(yk);this._stringCache.clear();let s=0,r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)s+=+this.lines.get(t).resize(e,i);let n=0;if(this._rows<t)for(let s=this._rows;s<t;s++)this.lines.length<t+this.ybase&&(void 0!==this._optionsService.rawOptions.windowsPty.backend||void 0!==this._optionsService.rawOptions.windowsPty.buildNumber?this.lines.push(new Ck(this._stringCache,e,i,!1)):this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new Ck(this._stringCache,e,i,!1)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r<this.lines.maxLength){let e=this.lines.length-r;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),n&&(this.y+=n),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 n=0;n<this.lines.length;n++)s+=+this.lines.get(n).resize(e,i);if(this._cols=e,this._rows=t,this.lines.length>0){let e=Math.max(0,this.lines.length-this.ybase-1);this.y=Math.min(this.y,e)}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&&"conpty"===e.backend&&e.buildNumber>=21376:this._hasScrollback}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,s=function(e,t,i,s,r,n){let o=[];for(let a=0;a<e.length-1;a++){let l=a,c=e.get(++l);if(!c.isWrapped)continue;let h=[e.get(a)];for(;l<e.length&&c.isWrapped;)h.push(c),c=e.get(++l);if(!n&&s>=a&&s<l){a+=h.length-1;continue}let u=0,d=Mk(h,u,t),f=1,p=0;for(;f<h.length;){let e=Mk(h,f,t),s=e-p,n=i-d,o=Math.min(s,n);h[u].copyCellsFrom(h[f],p,d,o,!1),d+=o,d===i&&(u++,d=0),p+=o,p===e&&(f++,p=0),0===d&&0!==u&&2===h[u-1].getWidth(i-1)&&(h[u].copyCellsFrom(h[u-1],i-1,d++,1,!1),h[u-1].setCell(i-1,r))}h[u].replaceCells(d,i,r);let g=0;for(let e=h.length-1;e>0&&(e>u||0===h[e].getTrimmedLength());e--)g++;g>0&&(o.push(a+h.length-g),o.push(g)),a+=h.length-1}return o}(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(yk),i);if(s.length>0){let i=function(e,t){let i=[],s=0,r=t[s],n=0;for(let o=0;o<e.length;o++)if(r===o){let i=t[++s];e.onDeleteEmitter.fire({index:o-n,amount:i}),o+=i-1,n+=i,r=t[++s]}else i.push(o);return{layout:i,countRemoved:n}}(this.lines,s);(function(e,t){let i=[];for(let s=0;s<t.length;s++)i.push(e.get(t[s]));for(let s=0;s<i.length;s++)e.set(s,i[s]);e.length=t.length})(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){let s=this.getNullCell(yk),r=i;for(;r-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Ck(this._stringCache,e,s,!1))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,s=this.getNullCell(yk),r=[],n=0;for(let o=this.lines.length-1;o>=0;o--){let a=this.lines.get(o);if(!a||!a.isWrapped&&a.getTrimmedLength()<=e)continue;let l=[a];for(;a.isWrapped&&o>0;)a=this.lines.get(--o),l.unshift(a);if(!i){let e=this.ybase+this.y;if(e>=o&&e<o+l.length)continue}let c,h=l[l.length-1].getTrimmedLength(),u=Nk(l,this._cols,e),d=u.length-l.length;c=0===this.ybase&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);let f=[];for(let e=0;e<d;e++){let e=this.getBlankLine(yk,!0);f.push(e)}f.length>0&&(r.push({start:o+l.length+n,newLines:f}),n+=f.length),l.push(...f);let p=u.length-1,g=u[p];0===g&&(p--,g=u[p]);let v=l.length-d-1,m=h;for(;v>=0;){let e=Math.min(m,g);if(void 0===l[p])break;if(l[p].copyCellsFrom(l[v],m-e,g-e,e,!0),g-=e,0===g&&(p--,g=u[p]),m-=e,0===m){v--,m=Mk(l,Math.max(v,0),this._cols)}}for(let t=0;t<l.length;t++)u[t]<e&&l[t].setCell(u[t],s);let _=d-c;for(;_-- >0;)0===this.ybase?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+n)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(r.length>0){let e=[],t=[];for(let r=0;r<this.lines.length;r++)t.push(this.lines.get(r));let i=this.lines.length,s=i-1,o=0,a=r[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let l=0;for(let u=Math.min(this.lines.maxLength-1,i+n-1);u>=0;u--)if(a&&a.start>s+l){for(let e=a.newLines.length-1;e>=0;e--)this.lines.set(u--,a.newLines[e]);u++,e.push({index:s+1,amount:a.newLines.length}),l+=a.newLines.length,a=r[++o]}else this.lines.set(u,t[s--]);let c=0;for(let r=e.length-1;r>=0;r--)e[r].index+=c,this.lines.onInsertEmitter.fire(e[r]),c+=e[r].amount;let h=Math.max(0,i+n-this.lines.maxLength);h>0&&this.lines.onTrimEmitter.fire(h)}}translateBufferLineToString(e,t,i=0,s){let r=this.lines.get(e);return r?r.translateToString(t,i,s):""}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:t,last:i}}setupTabStops(e){for(null!=e?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??(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??(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 Ek(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},Ak=class extends Ey{constructor(e,t,i){super(),this._optionsService=e,this._bufferService=t,this._logService=i,this._normalBuffer=this._register(new Dy),this._altBuffer=this._register(new Dy),this._onBufferActivate=this._register(new Sw),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 Rk(!0,this._optionsService,this._bufferService,this._logService),this._normalBuffer.value=this._normal,this._normal.fillViewportRows(),this._alt=new Rk(!1,this._optionsService,this._bufferService,this._logService),this._altBuffer.value=this._alt,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)}},Tk=class extends Ey{constructor(e,t){super(),this.isUserScrolling=!1,this._onResize=this._register(new Sw),this.onResize=this._onResize.event,this._onScroll=this._register(new Sw),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,2),this.rows=Math.max(e.rawOptions.rows||0,1),this.buffers=this._register(new Ak(e,this,t)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let i=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:i,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let i,s=this.buffer;i=this._cachedBlankLine,(!i||i.length!==this.cols||i.getFg(0)!==e.fg||i.getBg(0)!==e.bg)&&(i=s.getBlankLine(e,t),this._cachedBlankLine=i),i.isWrapped=t;let r=s.ybase+s.scrollTop,n=s.ybase+s.scrollBottom;if(0===s.scrollTop){let e=s.lines.isFull;n===s.lines.length-1?e?s.lines.recycle().copyFrom(i):s.lines.push(i.clone()):s.lines.splice(n+1,0,i.clone()),e?this.isUserScrolling&&(s.ydisp=Math.max(s.ydisp-1,0)):(s.ybase++,this.isUserScrolling||s.ydisp++)}else{let e=n-r+1;s.lines.shiftElements(r+1,e-1,-1),s.lines.set(n,i.clone())}this.isUserScrolling||(s.ydisp=s.ybase),this._onScroll.fire(s.ydisp)}scrollLines(e,t){let i=this.buffer;if(e<0){if(0===i.ydisp)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let s=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),s!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))}};Tk=Ix([Fx(0,uy),Fx(1,hy)],Tk);var zk={cols:80,rows:24,showCursorImmediately:!1,cursorBlink:!1,blinkIntervalDuration:0,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollbar:{showScrollbar:!0},scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,mouseEventsRequireAlt:!1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:cw,windowOptions:{},windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",quirks:{},vtExtensions:{}},Ok=["normal","bold","100","200","300","400","500","600","700","800","900"],Ik=class extends Ey{constructor(e){super(),this._onOptionChange=this._register(new Sw),this.onOptionChange=this._onOptionChange.event;let t={...zk};for(let i in e)if(i in t)try{let s=e[i];t[i]=this._sanitizeAndValidateOption(i,s)}catch(BS){console.error(BS)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Ny(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(i=>{i===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(i=>{-1!==e.indexOf(i)&&t()})}_setupOptions(){let e=e=>{if(!(e in zk))throw new Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in zk))throw new Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let i in this.rawOptions){let s={get:e.bind(this,i),set:t.bind(this,i)};Object.defineProperty(this.options,i,s)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=zk[e]),"block"!==(i=t)&&"underline"!==i&&"bar"!==i)throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=zk[e]);break;case"fontWeight":case"fontWeightBold":if("number"==typeof t&&1<=t&&t<=1e3)break;t=Ok.includes(t)?t:zk[e];break;case"blinkIntervalDuration":if((t=Math.floor(t))<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);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(10*t)/10));break;case"scrollback":if((t=Math.min(t,4294967295))<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&&0!==t)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{}}var i;return t}};var Fk=Object.freeze({insertMode:!1}),Hk=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,colorSchemeUpdates:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,win32InputMode:!1,wraparound:!0}),Wk=class extends Ey{constructor(e,t,i){super(),this._bufferService=e,this._logService=t,this._optionsService=i,this.isCursorHidden=!1,this._onData=this._register(new Sw),this.onData=this._onData.event,this._onUserInput=this._register(new Sw),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Sw),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Sw),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.isCursorInitialized=i.rawOptions.showCursorImmediately??!1,this.modes=structuredClone(Fk),this.decPrivateModes=structuredClone(Hk),this.kittyKeyboard={flags:0,mainFlags:0,altFlags:0,mainStack:[],altStack:[]}}reset(){this.modes=structuredClone(Fk),this.decPrivateModes=structuredClone(Hk),this.kittyKeyboard={flags:0,mainFlags:0,altFlags:0,mainStack:[],altStack:[]}}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(e=>e.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(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};Wk=Ix([Fx(0,ny),Fx(1,hy),Fx(2,uy)],Wk);var Kk={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>32!==e.action},DRAG:{events:23,restrict:e=>!(32===e.action&&3===e.button)},ANY:{events:31,restrict:e=>!0}};function Uk(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return 4===e.button?(i|=64,i|=e.action):(i|=3&e.button,4&e.button&&(i|=64),8&e.button&&(i|=128),32===e.action?i|=32:0===e.action&&!t&&(i|=3)),i}var $k,qk=String.fromCharCode,Vk={DEFAULT:e=>{let t=[Uk(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`${qk(t[0])}${qk(t[1])}${qk(t[2])}`},SGR:e=>{let t=0===e.action&&4!==e.button?"m":"M";return`[<${Uk(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=0===e.action&&4!==e.button?"m":"M";return`[<${Uk(e,!0)};${e.x};${e.y}${t}`}},Yk=class extends Ey{constructor(){super(),this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._onProtocolChange=this._register(new Sw),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(Kk))this.addProtocol(e,Kk[e]);for(let e of Object.keys(Vk))this.addEncoding(e,Vk[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return 0!==this._protocols[this._activeProtocol].events}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"}setCustomWheelEventHandler(e){this._customWheelEventHandler=e}allowCustomWheelEvent(e){return!this._customWheelEventHandler||!1!==this._customWheelEventHandler(e)}restrictMouseEvent(e){return this._protocols[this._activeProtocol].restrict(e)}encodeMouseEvent(e){return this._encodings[this._activeEncoding](e)}get isDefaultEncoding(){return"DEFAULT"===this._activeEncoding}get isPixelEncoding(){return"SGR_PIXELS"===this._activeEncoding}},Gk=class e{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Sw,this.onChange=this._onChange.event}static extractShouldJoin(e){return!!(1&e)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,i=!1){return(16777215&e)<<3|(3&t)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e,this._active||(this.activeVersion=e.version)}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let i=0,s=0,r=t.length;for(let n=0;n<r;++n){let o=t.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=r)return i+this.wcwidth(o);let e=t.charCodeAt(n);56320<=e&&e<=57343?o=1024*(o-55296)+e-56320+65536:i+=this.wcwidth(e)}let a=this.charProperties(o,s),l=e.extractWidth(a);e.extractShouldJoin(a)&&(l-=e.extractWidth(s)),i+=l,s=a}return i}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},Xk=[[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]],Zk=[[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]];var Jk=class{constructor(){if(this.version="6",!$k){($k=new Uint8Array(65536)).fill(1),$k[0]=0,$k.fill(0,1,32),$k.fill(0,127,160),$k.fill(2,4352,4448),$k[9001]=2,$k[9002]=2,$k.fill(2,11904,42192),$k[12351]=1,$k.fill(2,44032,55204),$k.fill(2,63744,64256),$k.fill(2,65040,65050),$k.fill(2,65072,65136),$k.fill(2,65280,65377),$k.fill(2,65504,65511);for(let e=0;e<Xk.length;++e)$k.fill(0,Xk[e][0],Xk[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?$k[e]:function(e,t){let i,s=0,r=t.length-1;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=s;)if(i=s+r>>1,e>t[i][1])s=i+1;else{if(!(e<t[i][0]))return!0;r=i-1}return!1}(e,Zk)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),s=0===i&&0!==t;if(s){let e=Gk.extractWidth(t);0===e?s=!1:e>i&&(i=e)}return Gk.createPropertyValue(0,i,s)}},Qk=class{constructor(){this.glevel=0,this._charsets=[]}get charsets(){return 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 eC(e){var t;let i=null==(t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))?void 0:t.get(e.cols-1),s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);s&&i&&(s.isWrapped=0!==i[3]&&32!==i[3])}var tC=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let i=new e;if(!t.length)return i;for(let e=Array.isArray(t[0])?1:0;e<t.length;++e){let s=t[e];if(Array.isArray(s))for(let e=0;e<s.length;++e)i.addSubParam(s[e]);else i.addParam(s)}return i}clone(){let t=new e(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 e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let i=this._subParamsIdx[t]>>8,s=255&this._subParamsIdx[t];s-i>0&&e.push(Array.prototype.slice.call(this._subParams,i,s))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}resetZdm(){this.length=1,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1,this._subParamsIdx[0]=0,this.params[0]=0}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw new Error("values less than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>2147483647?2147483647:e}}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)return void(this._rejectSubDigits=!0);if(e<-1)throw new Error("values less than -1 are not allowed");this._subParams[this._subParamsLength++]=e>2147483647?2147483647:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,i=255&this._subParamsIdx[e];return i-t>0?this._subParams.subarray(t,i):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let i=this._subParamsIdx[t]>>8,s=255&this._subParamsIdx[t];s-i>0&&(e[t]=this._subParams.slice(i,s))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,s=i[t-1];i[t-1]=~s?Math.min(10*s+e,2147483647):e}},iC=[],sC=class{constructor(){this._state=0,this._active=iC,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){var i;(i=this._handlers)[e]??(i[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let e=s.indexOf(t);-1!==e&&s.splice(e,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=iC}reset(){if(2===this._state)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=iC,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||iC,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,"START")}_put(e,t,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i);else this._handlerFb(this._id,"PUT",Zx(e,t,i))}start(){this.reset(),this._state=1}put(e,t,i){if(3!==this._state){if(1===this._state)for(;t<i;){let i=e[t++];if(59===i){this._state=2,this._start();break}if(i<48||57<i)return void(this._state=3);-1===this._id&&(this._id=0),this._id=10*this._id+i-48}2===this._state&&i-t>0&&this._put(e,t,i)}}end(e,t=!0){if(0!==this._state){if(3!==this._state)if(1===this._state&&this._start(),this._active.length){let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&!1===i){for(;s>=0&&(i=this._active[s].end(e),!0!==i);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._id,"END",e);this._active=iC,this._id=-1,this._state=0}}},rC=class e{constructor(t){this._handler=t,this._data=new xk(e._payloadLimit),this._hitLimit=!1}start(){this._data.reset(),this._hitLimit=!1}put(e,t,i){this._hitLimit||this._data.append(Zx(e,t,i))&&(this._hitLimit=!0)}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data.toString()),t instanceof Promise))return t.then(e=>(this._data.reset(),this._hitLimit=!1,e));return this._data.reset(),this._hitLimit=!1,t}};rC._payloadLimit=1e7;var nC=rC,oC=[],aC=class{constructor(){this._handlers=Object.create(null),this._active=oC,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=oC}registerHandler(e,t){var i;(i=this._handlers)[e]??(i[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let e=s.indexOf(t);-1!==e&&s.splice(e,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=oC,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||oC,this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(t);else this._handlerFb(this._ident,"HOOK",t)}put(e,t,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i);else this._handlerFb(this._ident,"PUT",Zx(e,t,i))}unhook(e,t=!0){if(this._active.length){let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&!1===i){for(;s>=0&&(i=this._active[s].unhook(e),!0!==i);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"UNHOOK",e);this._active=oC,this._ident=0}},lC=new tC;lC.addParam(0);var cC=class e{constructor(t){this._handler=t,this._data=new xk(e._payloadLimit),this._params=lC,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():lC,this._data.reset(),this._hitLimit=!1}put(e,t,i){this._hitLimit||this._data.append(Zx(e,t,i))&&(this._hitLimit=!0)}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data.toString(),this._params),t instanceof Promise))return t.then(e=>(this._params=lC,this._data.reset(),this._hitLimit=!1,e));return this._params=lC,this._data.reset(),this._hitLimit=!1,t}};cC._payloadLimit=1e7;var hC=cC,uC=[],dC=class{constructor(){this._handlers=Object.create(null),this._active=uC,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){var i;(i=this._handlers)[e]??(i[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let e=s.indexOf(t);-1!==e&&s.splice(e,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=uC}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].end(!1);this._stack.paused=!1,this._active=uC,this._ident=0}start(e){if(this.reset(),this._ident=e,this._active=this._handlers[e]||uC,this._active.length)for(let t=this._active.length-1;t>=0;t--)this._active[t].start();else this._handlerFb(this._ident,"START")}put(e,t,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i);else this._handlerFb(this._ident,"PUT",Zx(e,t,i))}end(e,t=!0){if(this._active.length){let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&!1===i){for(;s>=0&&(i=this._active[s].end(e),!0!==i);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"END",e);this._active=uC,this._ident=0}},fC=class e{constructor(t){this._handler=t,this._data=new xk(e._payloadLimit),this._hitLimit=!1}start(){this._data.reset(),this._hitLimit=!1}put(e,t,i){this._hitLimit||this._data.append(Zx(e,t,i))&&(this._hitLimit=!0)}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data.toString()),t instanceof Promise))return t.then(e=>(this._data.reset(),this._hitLimit=!1,e));return this._data.reset(),this._hitLimit=!1,t}};fC._payloadLimit=1e7;var pC=fC,gC=class{constructor(e){this.table=new Uint16Array(e)}setDefault(e,t){this.table.fill(e<<8|t)}add(e,t,i,s){this.table[t<<8|e]=i<<8|s}addMany(e,t,i,s){for(let r=0;r<e.length;r++)this.table[t<<8|e[r]]=i<<8|s}},vC=160,mC=function(){let e=new gC(4257),t=Array.apply(null,Array(256)).map((e,t)=>t),i=(e,i)=>t.slice(e,i),s=i(32,127),r=i(0,24);r.push(25),r.push.apply(r,i(28,32));let n=i(0,17);e.setDefault(1,0),e.addMany(s,0,2,0);for(let o of n)e.addMany([24,26,153,154],o,3,0),e.addMany(i(128,144),o,3,0),e.addMany(i(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158],o,0,7),e.add(159,o,11,14),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,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(i(28,32),8,0,8),e.addMany([88,94],1,0,7),e.addMany(s,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(95,1,11,14),e.addMany(r,14,0,14),e.add(127,14,0,14),e.addMany(i(32,48),14,9,15),e.addMany(i(48,127),14,15,16),e.addMany(i(48,127),15,15,16),e.addMany(r,15,0,15),e.addMany(i(32,48),15,9,15),e.add(127,15,0,15),e.addMany(s,16,16,16),e.addMany(r,16,0,16),e.addMany(i(8,14),16,16,16),e.add(127,16,0,16),e.addMany([27,156,24,26],16,17,0),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(r,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(vC,0,2,0),e.add(vC,8,5,8),e.add(vC,6,0,6),e.add(vC,11,0,11),e.add(vC,13,13,13),e.add(vC,16,16,16),e}(),_C=class extends Ey{constructor(e=mC){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 tC,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,i)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._executeHandlersArr=new Array(24).fill(void 0),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(Ny(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._executeHandlersArr=new Array(24).fill(void 0),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new sC),this._dcsParser=this._register(new aC),this._apcParser=this._register(new dC),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=e.prefix.charCodeAt(0),i<60||i>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 t=0;t<e.intermediates.length;++t){let s=e.intermediates.charCodeAt(t);if(32>s||s>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=s}}if(1!==e.final.length)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 i<<=8,i|=s,i}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){var i;let s=this._identifier(e,[48,126]);(i=this._escHandlers)[s]??(i[s]=[]);let r=this._escHandlers[s];return r.push(t),{dispose:()=>{let e=r.indexOf(t);-1!==e&&r.splice(e,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){let i=e.charCodeAt(0);this._executeHandlers[i]=t,i<24&&(this._executeHandlersArr[i]=t)}clearExecuteHandler(e){let t=e.charCodeAt(0);this._executeHandlers[t]&&delete this._executeHandlers[t],t<24&&(this._executeHandlersArr[t]=void 0)}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){var i;let s=this._identifier(e);(i=this._csiHandlers)[s]??(i[s]=[]);let r=this._csiHandlers[s];return r.push(t),{dispose:()=>{let e=r.indexOf(t);-1!==e&&r.splice(e,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)}registerApcHandler(e,t){return e.prefix=void 0,this._apcParser.registerHandler(this._identifier(e,[48,126]),t)}clearApcHandler(e){e.prefix=void 0,this._apcParser.clearHandler(this._identifier(e,[48,126]))}setApcHandlerFallback(e){this._apcParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._apcParser.reset(),this._params.resetZdm(),this._collect=0,this.precedingJoinState=0,0!==this._parseStack.state&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,i,s,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=s,this._parseStack.chunkPos=r}parse(e,t,i){let s,r,n,o=0;if(this._parseStack.state)if(2===this._parseStack.state)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(void 0===i||1===this._parseStack.state)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let t=this._parseStack.handlers,r=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===i&&r>-1)for(;r>=0&&(n=t[r](this._params),!0!==n);r--)if(n instanceof Promise)return this._parseStack.handlerPos=r,n;this._parseStack.handlers=[];break;case 4:if(!1===i&&r>-1)for(;r>=0&&(n=t[r](),!0!==n);r--)if(n instanceof Promise)return this._parseStack.handlerPos=r,n;this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],n=this._dcsParser.unhook(24!==s&&26!==s,i),n)return n;27===s&&(this._parseStack.transition|=1),this._params.resetZdm(),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],n=this._oscParser.end(24!==s&&26!==s,i),n)return n;27===s&&(this._parseStack.transition|=1),this._params.resetZdm(),this._collect=0;break;case 7:if(s=e[this._parseStack.chunkPos],n=this._apcParser.end(24!==s&&26!==s,i),n)return n;27===s&&(this._parseStack.transition|=1),this._params.resetZdm(),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=255&this._parseStack.transition}for(let a=o;a<t;++a)if(s=e[a],s<24&&this.currentState<=6)(this._executeHandlersArr[s]??this._executeHandlerFb)(s),this.precedingJoinState=0;else{if(27===s&&this.currentState<8&&a+2<t&&91===e[a+1]){this._params.resetZdm(),this._collect=0;let i=a+2,s=e[i];s>=60&&s<=63&&(this._collect=s,i++);let o=!1;for(;i<t;i++)if(s=e[i],s>=48&&s<=57)this._params.addDigit(s-48);else if(59===s)this._params.addParam(0);else{if(58!==s){if(s>=64&&s<=126){let e=this._csiHandlers[this._collect<<8|s],t=e?e.length-1:-1;for(;t>=0&&(n=e[t](this._params),!0!==n);t--)if(n instanceof Promise)return r=1792,this._preserveStack(3,e,t,r,i),n;t<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0,a=i,this.currentState=0,o=!0;break}break}this._params.addSubParam(-1)}o||(a=i-1,this.currentState=4);continue}switch(r=this._transitions.table[this.currentState<<8|(s<vC?s:vC)],r>>8){case 2:let i=a,o=t-4;for(;i<o&&e[++i]>=32&&(e[i]<=126||e[i]>=vC)&&e[++i]>=32&&(e[i]<=126||e[i]>=vC)&&e[++i]>=32&&(e[i]<=126||e[i]>=vC)&&e[++i]>=32&&(e[i]<=126||e[i]>=vC););if(i>=o)for(;i<t&&e[i]>=32&&(e[i]<=126||e[i]>=vC);)i++;this._printHandler(e,a,i),a=i-1;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:a,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let l=this._csiHandlers[this._collect<<8|s],c=l?l.length-1:-1;for(;c>=0&&(n=l[c](this._params),!0!==n);c--)if(n instanceof Promise)return this._preserveStack(3,l,c,r,a),n;c<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(++a<t&&(s=e[a])>47&&s<60);a--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let h=this._escHandlers[this._collect<<8|s],u=h?h.length-1:-1;for(;u>=0&&(n=h[u](),!0!==n);u--)if(n instanceof Promise)return this._preserveStack(4,h,u,r,a),n;u<0&&this._escHandlerFb(this._collect<<8|s),this.precedingJoinState=0;break;case 11:this._params.resetZdm(),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|s,this._params);break;case 13:for(let r=a+1;;++r)if(r>=t||24===(s=e[r])||26===s||27===s||s>127&&s<vC){this._dcsParser.put(e,a,r),a=r-1;break}break;case 14:if(n=this._dcsParser.unhook(24!==s&&26!==s),n)return this._preserveStack(6,[],0,r,a),n;27===s&&(r|=1),this._params.resetZdm(),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let r=a+1;;r++)if(r>=t||(s=e[r])<32||s>127&&s<vC){this._oscParser.put(e,a,r),a=r-1;break}break;case 6:if(n=this._oscParser.end(24!==s&&26!==s),n)return this._preserveStack(5,[],0,r,a),n;27===s&&(r|=1),this._params.resetZdm(),this._collect=0,this.precedingJoinState=0;break;case 15:this._apcParser.start(this._collect<<8|s);break;case 16:for(let s=a+1;;++s)if(!(s<t&&(e[s]>=32&&e[s]<127||e[s]>=8&&e[s]<14||e[s]>=vC))){this._apcParser.put(e,a,s),a=s-1;break}break;case 17:if(n=this._apcParser.end(24!==s&&26!==s),n)return this._preserveStack(7,[],0,r,a),n;27===s&&(r|=1),this._params.resetZdm(),this._collect=0,this.precedingJoinState=0}this.currentState=255&r}}},bC=/^([\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})$/,xC=/^[\da-f]+$/;function yC(e){if(!e)return;let t=e.toLowerCase();if(t.startsWith("rgb:")){t=t.slice(4);let e=bC.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.startsWith("#")&&(t=t.slice(1),xC.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,i=[0,0,0];for(let s=0;s<3;++s){let r=parseInt(t.slice(e*s,e*s+e),16);i[s]=1===e?r<<4:2===e?r:3===e?r>>4:r>>8}return i}}function wC(e,t){let i=e.toString(16),s=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function SC(e,t=16){let[i,s,r]=e;return`rgb:${wC(i,t)}/${wC(s,t)}/${wC(r,t)}`}var kC={"(":0,")":1,"*":2,"+":3,"-":1,".":2};function CC(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 jC=0,NC=class extends Ey{constructor(e,t,i,s,r,n,o,a,l=new _C){super(),this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=s,this._optionsService=r,this._oscLinkService=n,this._mouseStateService=o,this._unicodeService=a,this._parser=l,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Jx,this._utf8Decoder=new Qx,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=yk.clone(),this._eraseAttrDataInternal=yk.clone(),this._onRequestBell=this._register(new Sw),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Sw),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Sw),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Sw),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Sw),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Sw),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Sw),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Sw),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Sw),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Sw),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Sw),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Sw),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Sw),this.onColor=this._onColor.event,this._onRequestColorSchemeQuery=this._register(new Sw),this.onRequestColorSchemeQuery=this._onRequestColorSchemeQuery.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 MC(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug("Unknown EXECUTE code: ",{code:e})}),this._parser.setOscHandlerFallback((e,t,i)=>{this._logService.debug("Unknown OSC code: ",{identifier:e,action:t,data:i})}),this._parser.setDcsHandlerFallback((e,t,i)=>{"HOOK"===t&&(i=i.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(e),action:t,payload:i})}),this._parser.setApcHandlerFallback((e,t,i)=>{this._logService.debug("Unknown APC code: ",{identifier:this._parser.identToString(e),action:t,payload:i})}),this._parser.setPrintHandler((e,t,i)=>this.print(e,t,i)),this._parser.registerCsiHandler({final:"@"},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:"A"},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:"B"},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:"C"},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:"D"},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:"E"},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:"F"},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:"G"},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:"H"},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:"I"},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:"J"},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:"K"},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:"L"},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:"M"},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:"P"},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:"S"},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:"T"},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:"X"},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:"Z"},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"^"},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:"a"},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:"b"},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:"c"},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:">",final:"c"},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:"d"},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:"e"},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:"f"},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:"g"},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:"h"},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"h"},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:"l"},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"l"},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:"m"},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:"n"},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:"?",final:"n"},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},e=>this.softReset(e)),this._parser.registerCsiHandler({prefix:">",final:"q"},e=>this.sendXtVersion(e)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:"r"},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:"s"},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:"t"},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:"u"},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},e=>this.requestMode(e,!1)),this._parser.registerCsiHandler({prefix:"=",final:"u"},e=>this.kittyKeyboardSet(e)),this._parser.registerCsiHandler({prefix:"?",final:"u"},e=>this.kittyKeyboardQuery(e)),this._parser.registerCsiHandler({prefix:">",final:"u"},e=>this.kittyKeyboardPush(e)),this._parser.registerCsiHandler({prefix:"<",final:"u"},e=>this.kittyKeyboardPop(e)),this._parser.setExecuteHandler("",()=>this.bell()),this._parser.setExecuteHandler("\n",()=>this.lineFeed()),this._parser.setExecuteHandler("\v",()=>this.lineFeed()),this._parser.setExecuteHandler("\f",()=>this.lineFeed()),this._parser.setExecuteHandler("\r",()=>this.carriageReturn()),this._parser.setExecuteHandler("\b",()=>this.backspace()),this._parser.setExecuteHandler("\t",()=>this.tab()),this._parser.setExecuteHandler("",()=>this.shiftOut()),this._parser.setExecuteHandler("",()=>this.shiftIn()),this._parser.setExecuteHandler("„",()=>this.index()),this._parser.setExecuteHandler("…",()=>this.nextLine()),this._parser.setExecuteHandler("ˆ",()=>this.tabSet()),this._parser.registerOscHandler(0,new nC(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new nC(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new nC(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new nC(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new nC(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new nC(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new nC(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new nC(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new nC(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new nC(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new nC(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new nC(e=>this.restoreCursorColor(e))),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 c in Dk)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error("Parsing error: ",e),e)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new hC((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,i,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=s}_logSlowResolvingAsync(e){if(this._logService.logLevel<=3){let t,i=new Promise((e,i)=>{t=setTimeout(()=>i("#SLOW_TIMEOUT"),5e3)});Promise.race([e,i]).then(()=>{void 0!==t&&clearTimeout(t)},e=>{if(void 0!==t&&clearTimeout(t),"#SLOW_TIMEOUT"!==e)throw e;console.warn("async parser handler taking longer than 5000 ms")})}}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,s=this._activeBuffer.x,r=this._activeBuffer.y,n=0,o=this._parseStack.paused;if(o){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(i),i;s=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>131072&&(n=this._parseStack.position+131072)}if(this._logService.logLevel<=1&&this._logService.debug("parsing data "+("string"==typeof e?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join("")}"`)),0===this._logService.logLevel&&this._logService.trace("parsing data (codes)","string"==typeof e?e.split("").map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<131072&&(this._parseBuffer=new Uint32Array(Math.min(e.length,131072))),o||this._dirtyRowTracker.clearRange(),e.length>131072)for(let c=n;c<e.length;c+=131072){let t=c+131072<e.length?c+131072:e.length,n="string"==typeof e?this._stringDecoder.decode(e.substring(c,t),this._parseBuffer):this._utf8Decoder.decode(e.subarray(c,t),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,n))return this._preserveStack(s,r,n,c),this._logSlowResolvingAsync(i),i}else if(!o){let t="string"==typeof e?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,t))return this._preserveStack(s,r,t,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==s||this._activeBuffer.y!==r)&&this._onCursorMove.fire();let a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),l=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);l<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(l,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(e,t,i){let s,r,n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,l=this._coreService.decPrivateModes.wraparound,c=this._coreService.modes.insertMode,h=this._curAttrData,u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);if(!u)return;this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-t>0&&2===u.getWidth(this._activeBuffer.x-1)&&u.setCellFromCodepoint(this._activeBuffer.x-1,0,1,h);let d=this._parser.precedingJoinState;for(let f=t;f<i;++f){if(s=e[f],173===s)continue;if(s<127&&n){let e=n[String.fromCharCode(s)];e&&(s=e.charCodeAt(0))}let t=this._unicodeService.charProperties(s,d);r=Gk.extractWidth(t);let i=Gk.extractShouldJoin(t),p=i?Gk.extractWidth(d):0;d=t,o&&this._onA11yChar.fire(Xx(s));let g=this._getCurrentLinkId();if(g&&this._oscLinkService.addLineToLink(g,this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-p>a)if(l){let e=u,t=this._activeBuffer.x-p;if(this._activeBuffer.x=p,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),u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),!u)return;for(p>0&&u instanceof Ck&&u.copyCellsFrom(e,t,0,p,!1);t<a;)e.setCellFromCodepoint(t++,0,1,h)}else if(this._activeBuffer.x=a-1,2===r)continue;if(i&&this._activeBuffer.x){let e=u.getWidth(this._activeBuffer.x-1)?1:2;u.addCodepointToCell(this._activeBuffer.x-e,s,r);for(let t=r-p;--t>=0;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h);continue}if(c&&(u.insertCells(this._activeBuffer.x,r-p,this._activeBuffer.getNullCell(h)),2===u.getWidth(a-1)&&u.setCellFromCodepoint(a-1,0,1,h)),u.setCellFromCodepoint(this._activeBuffer.x++,s,r,h),r>0)for(;--r;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h)}this._parser.precedingJoinState=d,this._activeBuffer.x<a&&i-t>0&&0===u.getWidth(this._activeBuffer.x)&&!u.hasContent(this._activeBuffer.x)&&u.setCellFromCodepoint(this._activeBuffer.x,0,1,h),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return"t"!==e.final||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,t):this._parser.registerCsiHandler(e,e=>!CC(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e))}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new hC(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new nC(t))}registerApcHandler(e,t){return this._parser.registerApcHandler(e,new pC(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(0===this._activeBuffer.x&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&(null==(e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))?void 0: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 e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.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 0===t?delete this._activeBuffer.tabs[this._activeBuffer.x]:3===t&&(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 1===t&&(this._curAttrData.bg|=536870912),(2===t||0===t)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,i,s=!1,r=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),r),s&&(n.isWrapped=!1))}_resetBufferLine(e,t=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){var i;let s;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s++,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,t);s<this._bufferService.rows;s++)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(s);break;case 1:if(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols){let e=this._activeBuffer.lines.get(s+1);e&&(e.isWrapped=!1)}for(;s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(s=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,s-1);s--&&!(null==(i=this._activeBuffer.lines.get(this._activeBuffer.ybase+s))?void 0:i.getTrimmedLength()););for(;s>=0;s--)this._bufferService.scroll(this._eraseAttrData())}else{for(s=this._bufferService.rows,this._dirtyRowTracker.markDirty(s-1);s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}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,0===this._activeBuffer.x,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)}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 i=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;t--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(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 i,s=this._activeBuffer.ybase+this._activeBuffer.y;for(i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-i;t--;)this._activeBuffer.lines.splice(s,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}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(yk));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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);e.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);e.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);e.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);e.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.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 i=e.params[0]||1,s=Gk.extractWidth(t),r=this._activeBuffer.x-s,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),o=new Uint32Array(n.length*i),a=0;for(let c=0;c<n.length;){let e=n.codePointAt(c)||0;o[a++]=e,c+=e>65535?2:1}let l=a;for(let c=1;c<i;++c)o.copyWithin(l,0,a),l+=a;return this.print(o,0,l),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent("[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent("[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent("[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent("[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent("[>83;40003;0c")),!0}sendXtVersion(e){return e.params[0]>0||this._coreService.triggerDataEvent("P>|xterm.js(6.1.0-beta.290)\\"),!0}_is(e){return(this._optionsService.rawOptions.termName+"").startsWith(e)}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}return!0}setModePrivate(e){var t,i,s,r;for(let n=0;n<e.length;n++)switch(e.params[n]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Lk),this._charsetService.setgCharset(1,Lk),this._charsetService.setgCharset(2,Lk),this._charsetService.setgCharset(3,Lk);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:(null==(t=this._optionsService.rawOptions.quirks)?void 0:t.allowSetCursorBlink)&&(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._mouseStateService.activeProtocol="X10";break;case 1e3:this._mouseStateService.activeProtocol="VT200";break;case 1002:this._mouseStateService.activeProtocol="DRAG";break;case 1003:this._mouseStateService.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._mouseStateService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._mouseStateService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:if(null==(i=this._optionsService.rawOptions.vtExtensions)?void 0:i.kittyKeyboard){let e=this._coreService.kittyKeyboard;e.mainFlags=e.flags,e.flags=e.altFlags}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;case 2031:((null==(s=this._optionsService.rawOptions.vtExtensions)?void 0:s.colorSchemeQuery)??1)&&(this._coreService.decPrivateModes.colorSchemeUpdates=!0);break;case 9001:(null==(r=this._optionsService.rawOptions.vtExtensions)?void 0:r.win32InputMode)&&(this._coreService.decPrivateModes.win32InputMode=!0)}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}return!0}resetModePrivate(e){var t,i,s,r;for(let n=0;n<e.length;n++)switch(e.params[n]){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:(null==(t=this._optionsService.rawOptions.quirks)?void 0:t.allowSetCursorBlink)&&(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._mouseStateService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._mouseStateService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:if(null==(i=this._optionsService.rawOptions.vtExtensions)?void 0:i.kittyKeyboard){let e=this._coreService.kittyKeyboard;e.altFlags=e.flags,e.flags=e.mainFlags}this._bufferService.buffers.activateNormalBuffer(),1049===e.params[n]&&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;case 2031:((null==(s=this._optionsService.rawOptions.vtExtensions)?void 0:s.colorSchemeQuery)??1)&&(this._coreService.decPrivateModes.colorSchemeUpdates=!1);break;case 9001:(null==(r=this._optionsService.rawOptions.vtExtensions)?void 0:r.win32InputMode)&&(this._coreService.decPrivateModes.win32InputMode=!1)}return!0}requestMode(e,t){var i;let s;var r;(r=s||(s={}))[r.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",r[r.SET=1]="SET",r[r.RESET=2]="RESET",r[r.PERMANENTLY_SET=3]="PERMANENTLY_SET",r[r.PERMANENTLY_RESET=4]="PERMANENTLY_RESET";let n=this._coreService.decPrivateModes,{activeProtocol:o,activeEncoding:a}=this._mouseStateService,l=this._coreService,{buffers:c,cols:h}=this._bufferService,{active:u,alt:d}=c,f=this._optionsService.rawOptions,p=(e,i)=>(l.triggerDataEvent(`[${t?"":"?"}${e};${i}$y`),!0),g=e=>e?1:2,v=e.params[0];return t?p(v,2===v?4:4===v?g(l.modes.insertMode):12===v?3:20===v?g(f.convertEol):0):1===v?p(v,g(n.applicationCursorKeys)):3===v?p(v,f.windowOptions.setWinLines?80===h?2:132===h?1:0:0):6===v?p(v,g(n.origin)):7===v?p(v,g(n.wraparound)):8===v?p(v,3):9===v?p(v,g("X10"===o)):12===v?p(v,g(f.cursorBlink)):25===v?p(v,g(!l.isCursorHidden)):45===v?p(v,g(n.reverseWraparound)):66===v?p(v,g(n.applicationKeypad)):67===v?p(v,4):1e3===v?p(v,g("VT200"===o)):1002===v?p(v,g("DRAG"===o)):1003===v?p(v,g("ANY"===o)):1004===v?p(v,g(n.sendFocus)):1005===v?p(v,4):1006===v?p(v,g("SGR"===a)):1015===v?p(v,4):1016===v?p(v,g("SGR_PIXELS"===a)):1048===v?p(v,1):47===v||1047===v||1049===v?p(v,g(u===d)):2004===v?p(v,g(n.bracketedPasteMode)):2026===v?p(v,g(n.synchronizedOutput)):9001===v&&(null==(i=this._optionsService.rawOptions.vtExtensions)?void 0:i.win32InputMode)?p(v,g(n.win32InputMode)):p(v,0)}_updateAttrColor(e,t,i,s,r){return 2===t?(e|=50331648,e&=-16777216,e|=ey.fromColorRGB([i,s,r])):5===t&&(e&=-67108864,e|=33554432|255&i),e}_extractColor(e,t,i){let s=[0,0,-1,0,0,0],r=0,n=0;do{if(s[n+r]=e.params[t+n],e.hasSubParams(t+n)){let i=e.getSubParams(t+n),o=0;do{5===s[1]&&(r=1),s[n+o+1+r]=i[o]}while(++o<i.length&&o+n+1+r<s.length);break}if(5===s[1]&&n+r>=2||2===s[1]&&n+r>=5)break;s[1]&&(r=1)}while(++n+t<e.length&&n+r<s.length);for(let o=2;o<s.length;++o)-1===s[o]&&(s[o]=0);switch(s[0]){case 38:i.fg=this._updateAttrColor(i.fg,s[1],s[3],s[4],s[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,s[1],s[3],s[4],s[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,s[1],s[3],s[4],s[5])}return n}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,0===e&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=yk.fg,e.bg=yk.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){var t,i;if(1===e.length&&0===e.params[0])return this._processSGR0(this._curAttrData),!0;let s,r=e.length,n=this._curAttrData;for(let o=0;o<r;o++)s=e.params[o],s>=30&&s<=37?(n.fg&=-67108864,n.fg|=16777216|s-30):s>=40&&s<=47?(n.bg&=-67108864,n.bg|=16777216|s-40):s>=90&&s<=97?(n.fg&=-67108864,n.fg|=16777224|s-90):s>=100&&s<=107?(n.bg&=-67108864,n.bg|=16777224|s-100):0===s?this._processSGR0(n):1===s?n.fg|=134217728:3===s?n.bg|=67108864:4===s?(n.fg|=268435456,this._processUnderline(e.hasSubParams(o)?e.getSubParams(o)[0]:1,n)):5===s?n.fg|=536870912:7===s?n.fg|=67108864:8===s?n.fg|=1073741824:9===s?n.fg|=2147483648:2===s?n.bg|=134217728:21===s?this._processUnderline(2,n):22===s?(n.fg&=-134217729,n.bg&=-134217729):23===s?n.bg&=-67108865:24===s?(n.fg&=-268435457,this._processUnderline(0,n)):25===s?n.fg&=-536870913:27===s?n.fg&=-67108865:28===s?n.fg&=-1073741825:29===s?n.fg&=2147483647:39===s?(n.fg&=-67108864,n.fg|=16777215&yk.fg):49===s?(n.bg&=-67108864,n.bg|=16777215&yk.bg):38===s||48===s||58===s?o+=this._extractColor(e,o,n):53===s?n.bg|=1073741824:55===s?n.bg&=-1073741825:221===s&&((null==(t=this._optionsService.rawOptions.vtExtensions)?void 0:t.kittySgrBoldFaintControl)??1)?n.fg&=-134217729:222===s&&((null==(i=this._optionsService.rawOptions.vtExtensions)?void 0:i.kittySgrBoldFaintControl)??1)?n.bg&=-134217729:59===s?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):this._logService.debug("Unknown SGR attribute: %d.",s);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent("");break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`[${e};${t}R`)}return!0}deviceStatusPrivate(e){var t;switch(e.params[0]){case 6:let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`[?${e};${i}R`);break;case 15:case 25:case 26:case 53:break;case 996:((null==(t=this._optionsService.rawOptions.vtExtensions)?void 0:t.colorSchemeQuery)??1)&&this._onRequestColorSchemeQuery.fire()}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=yk.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=0===e.length?1:e.params[0];if(0===t)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"}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t,i=e.params[0]||1;return(e.length<2||(t=e.params[1])>this._bufferService.rows||0===t)&&(t=this._bufferService.rows),t>i&&(this._activeBuffer.scrollTop=i-1,this._activeBuffer.scrollBottom=t-1,this._setCursor(0,0)),!0}windowOptions(e){if(!CC(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==t&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(0===t||2===t)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),(0===t||1===t)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:(0===t||2===t)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(0===t||1===t)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}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,this._activeBuffer.savedCharsets=this._charsetService.charsets.slice(),this._activeBuffer.savedGlevel=this._charsetService.glevel,this._activeBuffer.savedOriginMode=this._coreService.decPrivateModes.origin,this._activeBuffer.savedWraparoundMode=this._coreService.decPrivateModes.wraparound,!0}restoreCursor(e){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;for(let t=0;t<this._activeBuffer.savedCharsets.length;t++)this._charsetService.setgCharset(t,this._activeBuffer.savedCharsets[t]);return this._charsetService.setgLevel(this._activeBuffer.savedGlevel),this._coreService.decPrivateModes.origin=this._activeBuffer.savedOriginMode,this._coreService.decPrivateModes.wraparound=this._activeBuffer.savedWraparoundMode,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=[],i=e.split(";");for(;i.length>1;){let e=i.shift(),s=i.shift();if(/^\d+$/.exec(e)){let i=parseInt(e,10);if(BC(i))if("?"===s)t.push({type:0,index:i});else{let e=yC(s);e&&t.push({type:1,index:i,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(-1===t)return!0;let i=e.slice(0,t).trim(),s=e.slice(t+1);return s?this._createHyperlink(i,s):!i.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let i,s=e.split(":"),r=s.findIndex(e=>e.startsWith("id="));return-1!==r&&(i=s[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:i,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 i=e.split(";");for(let s=0;s<i.length&&!(t>=this._specialColors.length);++s,++t)if("?"===i[s])this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let e=yC(i[s]);e&&this._onColor.fire([{type:1,index:this._specialColors[t],color:e}])}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=[],i=e.split(";");for(let s=0;s<i.length;++s)if(/^\d+$/.exec(i[s])){let e=parseInt(i[s],10);BC(e)&&t.push({type:2,index:e})}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,Lk),!0}selectCharset(e){return 2!==e.length?(this.selectDefaultCharset(),!0):("/"===e[0]||this._charsetService.setgCharset(kC[e[0]],Dk[e[1]]??Lk),!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=yk.clone(),this._eraseAttrDataInternal=yk.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new iy;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let i=this._activeBuffer.ybase+this._activeBuffer.y+t,s=this._activeBuffer.lines.get(i);s&&(s.fill(e),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let i=this._bufferService.buffer,s=this._optionsService.rawOptions;return(e=>(this._coreService.triggerDataEvent(`${e}\\`),!0))('"q'===e?`P1$r${this._curAttrData.isProtected()?1:0}"q`:'"p'===e?'P1$r61;1"p':"r"===e?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:"m"===e?"P1$r0m":" q"===e?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}kittyKeyboardSet(e){var t;if(!(null==(t=this._optionsService.rawOptions.vtExtensions)?void 0:t.kittyKeyboard))return!0;let i=e.params[0]||0,s=e.length>1&&e.params[1]||1,r=this._coreService.kittyKeyboard;switch(s){case 1:r.flags=i;break;case 2:r.flags|=i;break;case 3:r.flags&=~i}return!0}kittyKeyboardQuery(e){var t;if(!(null==(t=this._optionsService.rawOptions.vtExtensions)?void 0:t.kittyKeyboard))return!0;let i=this._coreService.kittyKeyboard.flags;return this._coreService.triggerDataEvent(`[?${i}u`),!0}kittyKeyboardPush(e){var t;if(!(null==(t=this._optionsService.rawOptions.vtExtensions)?void 0:t.kittyKeyboard))return!0;let i=e.params[0]||0,s=this._coreService.kittyKeyboard,r=this._bufferService.buffer===this._bufferService.buffers.alt?s.altStack:s.mainStack;return r.length>=16&&r.shift(),r.push(s.flags),s.flags=i,!0}kittyKeyboardPop(e){var t;if(!(null==(t=this._optionsService.rawOptions.vtExtensions)?void 0:t.kittyKeyboard))return!0;let i=Math.max(1,e.params[0]||1),s=this._coreService.kittyKeyboard,r=this._bufferService.buffer===this._bufferService.buffers.alt?s.altStack:s.mainStack;for(let n=0;n<i&&r.length>0;n++)s.flags=r.pop();return 0===r.length&&i>0&&(s.flags=0),!0}},MC=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&&(jC=e,e=t,t=jC),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function BC(e){return 0<=e&&e<256}MC=Ix([Fx(0,ny)],MC);var EC=class extends Ey{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._innerWriteTimer=this._register(new Ly),this._onWriteParsed=this._register(new Sw),this.onWriteParsed=this._onWriteParsed.event,this._register(Ny(()=>{this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0}))}handleUserInput(){this._didUserInput=!0}flushSync(){if(this._store.isDisposed||this._isSyncWriting)return;this._isSyncWriting=!0;let e,t=!1;for(;e=this._writeBuffer.shift();){t=!0,this._action(e);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._writeBuffer.length=0,this._callbacks.length=0,this._isSyncWriting=!1,t&&this._onWriteParsed.fire()}writeSync(e,t){if(this._store.isDisposed)return;if(void 0!==t&&this._syncCalls>t)return void(this._syncCalls=0);if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let i;for(this._isSyncWriting=!0;i=this._writeBuffer.shift();){this._action(i);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(!this._store.isDisposed){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),void this._innerWrite();this._scheduleInnerWrite()}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}}_scheduleInnerWrite(e=0,t=!0){this._store.isDisposed||this._innerWriteTimer.cancelAndSet(()=>this._innerWrite(e,t),0)}_innerWrite(e=0,t=!0){if(this._store.isDisposed)return;let i=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],s=this._action(e,t);if(s){let e=e=>{this._store.isDisposed||(performance.now()-i>=12?this._scheduleInnerWrite(0,e):this._innerWrite(i,e))};return void s.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e)}let r=this._callbacks[this._bufferOffset];if(r&&r(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-i>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),this._scheduleInnerWrite()):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},DC=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(void 0===e.id){let i=t.addMarker(t.ybase+t.y),s={data:e,id:this._nextId++,lines:[i]};return i.onDispose(()=>this._removeMarkerFromLink(s,i)),this._dataByLinkId.set(s.id,s),s.id}let i=e,s=this._getEntryIdKey(i),r=this._entriesWithId.get(s);if(r)return this.addLineToLink(r.id,t.ybase+t.y),r.id;let n=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(o,n)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let i=this._dataByLinkId.get(e);if(i&&i.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);i.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(i,e))}}getLinkData(e){var t;return null==(t=this._dataByLinkId.get(e))?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let i=e.lines.indexOf(t);-1!==i&&(e.lines.splice(i,1),0===e.lines.length&&(void 0!==e.data.id&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};DC=Ix([Fx(0,ny)],DC);var LC=!1,PC=class extends Ey{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Dy),this._onBinary=this._register(new Sw),this.onBinary=this._onBinary.event,this._onData=this._register(new Sw),this.onData=this._onData.event,this._onLineFeed=this._register(new Sw),this.onLineFeed=this._onLineFeed.event,this._onRender=this._register(new Sw),this.onRender=this._onRender.event,this._onResize=this._register(new Sw),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Sw),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Sw),this._instantiationService=new gk,this.optionsService=this._register(new Ik(e)),this._instantiationService.setService(uy,this.optionsService),this._logService=this._register(this._instantiationService.createInstance(mk)),this._instantiationService.setService(hy,this._logService),this._bufferService=this._register(this._instantiationService.createInstance(Tk)),this._instantiationService.setService(ny,this._bufferService),this.coreService=this._register(this._instantiationService.createInstance(Wk)),this._instantiationService.setService(ay,this.coreService),this.mouseStateService=this._register(this._instantiationService.createInstance(Yk)),this._instantiationService.setService(oy,this.mouseStateService),this.unicodeService=this._register(this._instantiationService.createInstance(Gk)),this.unicodeService.register(new Jk),this._instantiationService.setService(fy,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Qk),this._instantiationService.setService(ly,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(DC),this._instantiationService.setService(dy,this._oscLinkService),this._inputHandler=this._register(new NC(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.mouseStateService,this.unicodeService)),this._register(gw.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(gw.forward(this._bufferService.onResize,this._onResize)),this._register(gw.forward(this.coreService.onData,this._onData)),this._register(gw.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(["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 EC((e,t)=>this._inputHandler.parse(e,t))),this._register(gw.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Sw),this._onScroll.event(e=>{var t;null==(t=this._onScrollApi)||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&&!LC&&(this._logService.warn("writeSync is unreliable and will be removed soon."),LC=!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,2),t=Math.max(t,1),this._writeBuffer.flushSync(),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;0!==t&&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)}registerApcHandler(e,t){return this._inputHandler.registerApcHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.mouseStateService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&void 0!==t.backend&&void 0!==t.buildNumber&&(e="conpty"===t.backend&&t.buildNumber<21376),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(eC.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(eC(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Ny(()=>{for(let t of e)t.dispose()})}}},RC=0,AC=class{constructor(e,t){this._getKey=e,this._array=[],this._insertedValues=[],this._isFlushingInserted=!1,this._deletedIndices=[],this._isFlushingDeleted=!1,this._flushInsertedTask=new OS(t),this._flushDeletedTask=new OS(t)}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(),0===this._insertedValues.length&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,i=0,s=new Array(this._array.length+this._insertedValues.length);for(let r=0;r<s.length;r++)i>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[i])?(s[r]=e[t],t++):s[r]=this._array[i++];this._array=s,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),0===this._array.length)return!1;let t=this._getKey(e);if(void 0===t||-1===(RC=this._search(t))||this._getKey(this._array[RC])!==t)return!1;do{if(this._array[RC]===e)return 0===this._deletedIndices.length&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(RC),!0}while(++RC<this._array.length&&this._getKey(this._array[RC])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,i=new Array(this._array.length-e.length),s=0;for(let r=0;r<this._array.length;r++)e[t]===r?t++:i[s++]=this._array[r];this._array=i,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&(!((RC=this._search(e))<0||RC>=this._array.length)&&this._getKey(this._array[RC])===e))do{yield this._array[RC]}while(++RC<this._array.length&&this._getKey(this._array[RC])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&(!((RC=this._search(e))<0||RC>=this._array.length)&&this._getKey(this._array[RC])===e))do{t(this._array[RC])}while(++RC<this._array.length&&this._getKey(this._array[RC])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,i=this._array.length-1;for(;i>=t;){let s=t+i>>1,r=this._getKey(this._array[s]);if(r>e)i=s-1;else{if(!(r<e)){for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}t=s+1}}return t}},TC=0,zC=0,OC=class extends Ey{constructor(e,t){super(),this._logService=e,this._bufferService=t,this._lineCache=this._register(new IC),this._onDecorationRegistered=this._register(new Sw),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Sw),this.onDecorationRemoved=this._onDecorationRemoved.event,this._decorations=new AC(e=>null==e?void 0:e.marker.line,this._logService),this._register(Ny(()=>this.reset())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._lineCache.attachToBufferLines(this._bufferService.buffer.lines)})),this._lineCache.attachToBufferLines(this._bufferService.buffer.lines)}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new FC(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),i=t.onDispose(()=>{i.dispose(),t&&(this._decorations.delete(t)&&(this._lineCache.remove(t),this._onDecorationRemoved.fire(t)),e.dispose())});this._decorations.insert(t),this._lineCache.add(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear(),this._lineCache.clear()}*getDecorationsAtCell(e,t,i){let s=this._lineCache.getDecorationsOnLine(t);if(s)for(let r of s)TC=r.options.x??0,zC=TC+(r.options.width??1),e>=TC&&e<zC&&(!i||(r.options.layer??"bottom")===i)&&(yield r)}forEachDecorationAtCell(e,t,i,s){let r=this._lineCache.getDecorationsOnLine(t);if(r)for(let n of r)TC=n.options.x??0,zC=TC+(n.options.width??1),e>=TC&&e<zC&&(!i||(n.options.layer??"bottom")===i)&&s(n)}};OC=Ix([Fx(0,hy),Fx(1,ny)],OC);var IC=class extends Ey{constructor(){super(...arguments),this._decorationsByLine=new Map,this._decorations=new Set,this._bufferLineListeners=this._register(new Dy),this._lineIndexSyncTimer=this._register(new Py),this._lineIndexSyncCallbacks=[]}clear(){this._lineIndexSyncCallbacks.length=0,this._lineIndexSyncTimer.cancel(),this._decorationsByLine.clear(),this._decorations.clear()}add(e){this._decorations.add(e),this._addToLineBuckets(e)}remove(e){this._decorations.delete(e),this._removeFromLineBuckets(e)}getDecorationsOnLine(e){return this._decorationsByLine.get(e)}attachToBufferLines(e){let t=new By;this._bufferLineListeners.value=t,t.add(e.onTrim(e=>this._handleBufferLinesTrim(e))),t.add(e.onInsert(e=>this._handleBufferLinesInsert(e))),t.add(e.onDelete(e=>this._handleBufferLinesDelete(e)))}_getDecorationHeight(e){return e.options.height??1}_addToLineBuckets(e){let t=e.marker.line;if(t<0)return;e._indexedStartLine=t;let i=this._getDecorationHeight(e);for(let s=t;s<t+i;s++){let t=this._decorationsByLine.get(s);t||(t=[],this._decorationsByLine.set(s,t)),t.push(e)}}_removeFromLineBuckets(e){let t=e._indexedStartLine,i=this._getDecorationHeight(e);for(let s=t;s<t+i;s++){let t=this._decorationsByLine.get(s);if(!t)continue;let i=t.indexOf(e);-1!==i&&t.splice(i,1),0===t.length&&this._decorationsByLine.delete(s)}}_reindexDecoration(e){this._removeFromLineBuckets(e),!e.marker.isDisposed&&e.marker.line>=0&&this._addToLineBuckets(e)}_scheduleLineIndexSync(e){this._lineIndexSyncCallbacks.push(e),this._lineIndexSyncTimer.set(()=>{let e=this._lineIndexSyncCallbacks;this._lineIndexSyncCallbacks=[];for(let t of e)t()})}_handleBufferLinesTrim(e){if(e<=0)return;let t=new Map;for(let[i,s]of this._decorationsByLine){let r=i-e;r<0||this._mergeLineBucket(t,r,s)}this._decorationsByLine.clear();for(let[i,s]of t)this._decorationsByLine.set(i,s);for(let i of this._decorations)i.marker.isDisposed||(i._indexedStartLine-=e)}_handleBufferLinesInsert(e){this._scheduleLineIndexSync(()=>this._applyBufferLinesInsert(e))}_handleBufferLinesDelete(e){this._scheduleLineIndexSync(()=>this._applyBufferLinesDelete(e))}_mergeLineBucket(e,t,i){let s=e.get(t);if(s)for(let r=0,n=i.length;r<n;r++)s.push(i[r]);else e.set(t,i.slice())}_applyBufferLinesInsert(e){let{index:t,amount:i}=e,s=[];for(let n of this._decorations){if(n.marker.isDisposed)continue;let e=n._indexedStartLine;e<t&&e+this._getDecorationHeight(n)>t&&(s.push(n),this._removeFromLineBuckets(n))}let r=new Map;for(let[n,o]of this._decorationsByLine){let e=n>=t?n+i:n;this._mergeLineBucket(r,e,o)}this._decorationsByLine.clear();for(let[n,o]of r)this._decorationsByLine.set(n,o);for(let n of this._decorations)n.marker.isDisposed||n._indexedStartLine>=t&&(n._indexedStartLine=n.marker.line);for(let n of s)this._addToLineBuckets(n)}_applyBufferLinesDelete(e){let t=e.index+e.amount,i=new Map;for(let[r,n]of this._decorationsByLine){if(r>=e.index&&r<t)continue;let s=r>=t?r-e.amount:r;this._mergeLineBucket(i,s,n)}this._decorationsByLine.clear();for(let[r,n]of i)this._decorationsByLine.set(r,n);let s=[];for(let r of this._decorations){if(r.marker.isDisposed)continue;let i=r._indexedStartLine,n=this._getDecorationHeight(r);i>=t?r._indexedStartLine=r.marker.line:i<e.index&&i+n>t&&s.push(r)}for(let r of s)this._reindexDecoration(r)}},FC=class extends By{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Sw),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Sw),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this._indexedStartLine=e.marker.line,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return null===this._cachedBg&&(this.options.backgroundColor?this._cachedBg=Gw.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return null===this._cachedFg&&(this.options.foregroundColor?this._cachedFg=Gw.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},HC=class{constructor(e,t=1e3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&(clearTimeout(this._refreshTimeoutID),this._refreshTimeoutID=void 0),this._additionalRefreshRequested=!1}refresh(e,t,i){this._rowCount=i,e=e??0,t=t??this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t;let s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)void 0!==this._refreshTimeoutID&&(clearTimeout(this._refreshTimeoutID),this._refreshTimeoutID=void 0,this._additionalRefreshRequested=!1),this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=s-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)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)}},WC=class extends Ey{constructor(e,t,i,s){super(),this._terminal=e,this._coreBrowserService=i,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,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=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new HC(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(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar("\n"))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(zy(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Ny(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,"\n"===e&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent=$x())))}_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 i=this._terminal.buffer,s=i.lines.length.toString();for(let r=e;r<=t;r++){let e=i.lines.get(i.ydisp+r),t=[],n=(null==e?void 0:e.translateToString(!0,void 0,void 0,t))||"",o=(i.ydisp+r+1).toString(),a=this._rowElements[r];a&&(0===n.length?(a.textContent=" ",this._rowColumns.set(a,[0,1])):(a.textContent=n,this._rowColumns.set(a,t)),a.setAttribute("aria-posinset",o),a.setAttribute("aria-setsize",s),this._alignRowWidth(a))}this._announceCharacters()}_announceCharacters(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent===$x()&&this._clearLiveRegion(),this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let i,s,r=e.target,n=this._rowElements[0===t?1:this._rowElements.length-2];if(r.getAttribute("aria-posinset")!==(0===t?"1":`${this._terminal.buffer.lines.length}`)&&e.relatedTarget===n){if(0===t?(i=r,s=this._rowElements.pop(),this._rowContainer.removeChild(s)):(i=this._rowElements.shift(),s=r,this._rowContainer.removeChild(i)),i.removeEventListener("focus",this._topBoundaryFocusListener),s.removeEventListener("focus",this._bottomBoundaryFocusListener),0===t){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement("afterbegin",e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(0===t?-1:1),this._rowElements[0===t?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}}_handleSelectionChange(){var e;if(0===this._rowElements.length)return;let t=this._coreBrowserService.mainDocument.getSelection();if(!t)return;if(t.isCollapsed)return void(this._rowContainer.contains(t.anchorNode)&&this._terminal.clearSelection());if(!t.anchorNode||!t.focusNode)return void console.error("anchorNode and/or focusNode are null");let i={node:t.anchorNode,offset:t.anchorOffset},s={node:t.focusNode,offset:t.focusOffset};if((i.node.compareDocumentPosition(s.node)&Node.DOCUMENT_POSITION_PRECEDING||i.node===s.node&&i.offset>s.offset)&&([i,s]=[s,i]),i.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(i={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(i.node))return;let r=this._rowElements.slice(-1)[0];if(s.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(s={node:r,offset:(null==(e=r.textContent)?void 0:e.length)??0}),!this._rowContainer.contains(s.node))return;let n=({node:e,offset:t})=>{let i=e instanceof Text?e.parentNode:e,s=parseInt(null==i?void 0:i.getAttribute("aria-posinset"),10)-1;if(isNaN(s))return console.warn("row is invalid. Race condition?"),null;let r=this._rowColumns.get(i);if(!r)return console.warn("columns is null. Race condition?"),null;let n=t<r.length?r[t]:r.slice(-1)[0]+1;return n>=this._terminal.cols&&(++s,n=0),{row:s,column:n}},o=n(i),a=n(s);if(o&&a){if(o.row>a.row||o.row===a.row&&o.column>=a.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(a.row-o.row)*this._terminal.cols-o.column+a.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 t,i;e.style.transform="";let s=e.getBoundingClientRect().width,r=null==(i=null==(t=this._rowColumns.get(e))?void 0:t.slice(-1))?void 0:i[0];if(!r)return;let n=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${n/s})`}};WC=Ix([Fx(1,cy),Fx(2,_y),Fx(3,yy)],WC);var KC=class extends Ey{constructor(e,t,i,s,r){super(),this._element=e,this._mouseCoordsService=t,this._renderService=i,this._bufferService=s,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Sw),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Sw),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Ny(()=>{var e;My(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,null==(e=this._activeProviderReplies)||e.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(zy(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(zy(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(zy(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(zy(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element);if(!t)return;this._isMouseOut=!1;let i=e.composedPath();for(let s=0;s<i.length;s++){let e=i[s];if(e.classList.contains("xterm"))break;if(e.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)return this._clearCurrentLink(),this._askForLink(e,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var i,s;(!this._activeProviderReplies||!t)&&(null==(i=this._activeProviderReplies)||i.forEach(e=>{null==e||e.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[n,o]of this._linkProviderService.linkProviders.entries())t?(null==(s=this._activeProviderReplies)?void 0:s.get(n))&&(r=this._checkLinkProviderResult(n,e,r)):o.provideLinks(e.y,t=>{var i,s;if(this._isMouseOut)return;let o=null==t?void 0:t.map(e=>({link:e}));null==(i=this._activeProviderReplies)||i.set(n,o),r=this._checkLinkProviderResult(n,e,r),(null==(s=this._activeProviderReplies)?void 0:s.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let i=new Set;for(let s=0;s<t.size;s++){let r=t.get(s);if(r)for(let t=0;t<r.length;t++){let s=r[t],n=s.link.range.start.y<e?0:s.link.range.start.x,o=s.link.range.end.y>e?this._bufferService.cols:s.link.range.end.x;for(let e=n;e<=o;e++){if(i.has(e)){r.splice(t--,1);break}i.add(e)}}}}_checkLinkProviderResult(e,t,i){var s;if(!this._activeProviderReplies)return i;let r=this._activeProviderReplies.get(e),n=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(n=!0);if(!n&&r){let e=r.find(e=>this._linkAtPosition(e.link,t));e&&(i=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let o=0;o<this._activeProviderReplies.size;o++){let e=null==(s=this._activeProviderReplies.get(o))?void 0:s.find(e=>this._linkAtPosition(e.link,t));if(e){i=!0,this._handleNewLink(e);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element);var i,s;t&&this._mouseDownLink&&(i=this._mouseDownLink.link,s=this._currentLink.link,i.text===s.text&&i.range.start.x===s.range.start.x&&i.range.start.y===s.range.start.y&&i.range.end.x===s.range.end.x&&i.range.end.y===s.range.end.y)&&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,My(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||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 e,t;return null==(t=null==(e=this._currentLink)?void 0:e.state)?void 0:t.decorations.pointerCursor},set:e=>{var t;(null==(t=this._currentLink)?void 0:t.state)&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",e))}},underline:{get:()=>{var e,t;return null==(t=null==(e=this._currentLink)?void 0:e.state)?void 0:t.decorations.underline},set:t=>{var i,s,r;(null==(i=this._currentLink)?void 0:i.state)&&(null==(r=null==(s=this._currentLink)?void 0:s.state)?void 0:r.decorations.underline)!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=0===e.start?0:e.start+1+this._bufferService.buffer.ydisp,i=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(t,i),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,i){var s;(null==(s=this._currentLink)?void 0: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(i,t.text)}_fireUnderlineEvent(e,t){let i=e.range,s=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-s-1,i.end.x,i.end.y-s-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,i){var s;(null==(s=this._currentLink)?void 0: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(i,t.text)}_linkAtPosition(e,t){let i=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return i<=r&&r<=s}_positionFromMouseEvent(e,t){let i=this._mouseCoordsService.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,i,s,r){return{x1:e,y1:t,x2:i,y2:s,cols:this._bufferService.cols,fg:r}}};KC=Ix([Fx(1,by),Fx(2,yy),Fx(3,ny),Fx(4,Cy)],KC);var UC=class extends PC{constructor(e={}){super(e),this._linkifier=this._register(new Dy),this.browser=Qy,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Dy),this._onCursorMove=this._register(new Sw),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Sw),this.onKey=this._onKey.event,this._onSelectionChange=this._register(new Sw),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Sw),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Sw),this.onBell=this._onBell.event,this._onFocus=this._register(new Sw),this._onBlur=this._register(new Sw),this._onA11yCharEmitter=this._register(new Sw),this._onA11yTabEmitter=this._register(new Sw),this._onWillOpen=this._register(new Sw),this._onDimensionsChange=this._register(new Sw),this.onDimensionsChange=this._onDimensionsChange.event,this._setup(),this._decorationService=this._instantiationService.createInstance(OC),this._instantiationService.setService(py,this._decorationService),this._keyboardService=this._instantiationService.createInstance(fk),this._instantiationService.setService(jy,this._keyboardService),this._linkProviderService=this._instantiationService.createInstance(wS),this._instantiationService.setService(Cy,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(gy)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh((null==e?void 0:e.start)??0,(null==e?void 0:e.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(gw.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(gw.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(gw.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(gw.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(Ny(()=>{var e,t;this._customKeyEventHandler=void 0,null==(t=null==(e=this.element)?void 0:e.parentNode)||t.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}get dimensions(){if(!this._renderService)return;let e=this._renderService.dimensions;return{css:{canvas:{...e.css.canvas},cell:{...e.css.cell}},device:{canvas:{...e.device.canvas},cell:{...e.device.cell},char:{...e.device.char}}}}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,i;switch(t.index){case 256:e="foreground",i="10";break;case 257:e="background",i="11";break;case 258:e="cursor",i="12";break;default:e="ansi",i="4;"+t.index}switch(t.type){case 0:let s=Yw.toColorRGB("ansi"===e?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`]${i};${SC(s)}\\`);break;case 1:if("ansi"===e)this._themeService.modifyColors(e=>e.ansi[t.index]=qw.toColor(...t.color));else{let i=e;this._themeService.modifyColors(e=>e[i]=qw.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index)}}}_reportColorScheme(){if(!this._themeService)return;let e=Xw.relativeLuminance(this._themeService.colors.background.rgba>>8)<Xw.relativeLuminance(this._themeService.colors.foreground.rgba>>8)?1:2;this.coreService.triggerDataEvent(`[?997;${e}n`)}_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(WC,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(""),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return null==(e=this.textarea)?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(""),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 i=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,r=t.getWidth(i),n=this._renderService.dimensions.css.cell.width*r,o=this.buffer.y*this._renderService.dimensions.css.cell.height,a=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=o+"px",this.textarea.style.width=n+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(zy(this.element,"copy",e=>{var t,i;this.hasSelection()&&(t=e,i=this._selectionService,t.clipboardData&&t.clipboardData.setData("text/plain",i.selectionText),t.preventDefault())}));let e=e=>function(e,t,i,s){e.stopPropagation(),e.clipboardData&&Vx(e.clipboardData.getData("text/plain"),t,i,s)}(e,this.textarea,this.coreService,this.optionsService);this._register(zy(this.textarea,"paste",e)),this._register(zy(this.element,"paste",e)),sw?this._register(zy(this.element,"mousedown",e=>{2===e.button&&Gx(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(zy(this.element,"contextmenu",e=>{Gx(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),uw&&this._register(zy(this.element,"auxclick",e=>{1===e.button&&Yx(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(zy(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(zy(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(zy(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(zy(this.textarea,"compositionstart",()=>{this._syncTextArea(),this._compositionHelper.compositionstart(),this._compositionHelper.updateCompositionElements()})),this._register(zy(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(zy(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(zy(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var t,i,s;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"),(null==(t=this.element)?void 0:t.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));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"),this.element.classList.toggle("allow-transparency",this.options.allowTransparency),this._register(this.optionsService.onSpecificOptionChange("allowTransparency",e=>this.element.classList.toggle("allow-transparency",e))),e.appendChild(this.element);let r=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),r.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(zy(this.screenElement,"mousemove",e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),r.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Wx()),dw||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(xS,this.textarea,e.ownerDocument.defaultView??window,this._document??(typeof window<"u"?window.document:null))),this._instantiationService.setService(_y,this._coreBrowserService),this._register(zy(this.textarea,"focus",e=>this._handleTextAreaFocus(e))),this._register(zy(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(vS,this._document,this._helperContainer),this._instantiationService.setService(my,this._charSizeService),this._themeService=this._instantiationService.createInstance(lk),this._instantiationService.setService(ky,this._themeService),this._register(this._inputHandler.onRequestColorSchemeQuery(()=>this._reportColorScheme())),this._register(this._themeService.onChangeColors(()=>{this.coreService.decPrivateModes.colorSchemeUpdates&&this._reportColorScheme()})),this._characterJoinerService=this._instantiationService.createInstance(oS),this._instantiationService.setService(Sy,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(FS,this.rows,this.screenElement)),this._instantiationService.setService(yy,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this._register(this._renderService.onDimensionsChange(e=>this._onDimensionsChange.fire({css:{canvas:{...e.css.canvas},cell:{...e.css.cell}},device:{canvas:{...e.device.canvas},cell:{...e.device.cell},char:{...e.device.char}}}))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance($w,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseCoordsService=this._instantiationService.createInstance(kS),this._instantiationService.setService(by,this._mouseCoordsService);let o=this._linkifier.value=this._register(this._instantiationService.createInstance(KC,this.screenElement));this.element.appendChild(r);try{this._onWillOpen.fire(this.element)}catch(c){this._logService.error("onWillOpen handler threw an exception",c)}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._syncTextArea()})),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(Ow,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(JS,this.element,this.screenElement,o)),this._instantiationService.setService(wy,this._selectionService),this._mouseService=this._instantiationService.createInstance(RS),this._instantiationService.setService(xy,this._mouseService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(gw.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var e;this._selectionService.refresh(),null==(e=this._viewport)||e.queueSync()})),this._register(this._instantiationService.createInstance(Iw,this.screenElement)),this._register(zy(this.element,"mousedown",e=>this._selectionService.handleMouseDown(e))),this.mouseStateService.areMouseEventsActive&&!this.options.mouseEventsRequireAlt?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):(this._selectionService.enable(),this.element.classList.remove("enable-mouse-events")),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(WC,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",e=>this._handleScreenReaderModeOptionChange(e)));let a=(null==(i=this.options.scrollbar)?void 0:i.showScrollbar)??!0,l=null==(s=this.options.scrollbar)?void 0:s.width;a&&l&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Uw,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("scrollbar",e=>{let t=((null==e?void 0:e.showScrollbar)??!0)&&!!(null==e?void 0:e.width);!this._overviewRulerRenderer&&t&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Uw,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this._mouseService.bindMouse({element:this.element,screenElement:this.screenElement,document:this._document,handleTouchScroll:e=>{var t;return null==(t=this._viewport)?void 0:t.handleTouchScroll(e)}},e=>this._register(e),()=>this.focus())}_createRenderer(){return this._instantiationService.createInstance(pS,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}refresh(e,t,i=!1){var s;null==(s=this._renderService)||s.refreshRows(e,t,i)}updateCursorStyle(e){var t;(null==(t=this._selectionService)?void 0: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;0!==t&&this.scrollLines(t)}paste(e){Vx(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this.mouseStateService.setCustomWheelEventHandler(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}select(e,t,i){this._selectionService.setSelection(e,t,i)}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;null==(e=this._selectionService)||e.clearSelection()}selectAll(){var e;null==(e=this._selectionService)||e.selectAll()}selectLines(e,t){var i;null==(i=this._selectionService)||i.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))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&&("Dead"===e.key||"AltGraph"===e.key)&&(this._unprocessedDeadKey=!0);let i=this._keyboardService.evaluateKeyDown(e);if(this.updateCursorStyle(e),3===i.type||2===i.type){let t=this.rows-1;return this.scrollLines(2===i.type?-t:t),e.preventDefault(),e.stopPropagation(),!1}if(1===i.type&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(i.cancel&&(e.preventDefault(),e.stopPropagation()),!i.key)||!this._keyboardService.useKitty&&!this._keyboardService.useWin32InputMode&&e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&1===e.key.length&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;(""===i.key||"\r"===i.key)&&(this.textarea.value="");let s=this._keyboardService.useWin32InputMode&&$C(e);if(this._onKey.fire({key:i.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!s),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return e.preventDefault(),e.stopPropagation(),!1;this._keyDownHandled=!0}_isThirdLevelShift(e,t){let i=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"keypress"===t.type?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){if(this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return;$C(e)||this.focus();let t=this._keyboardService.evaluateKeyUp(e);if(null==t?void 0:t.key){let i=this._keyboardService.useWin32InputMode&&$C(e);this.coreService.triggerDataEvent(t.key,!i)}this.updateCursorStyle(e),this._keyPressHandled=!1}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(e.charCode)t=e.charCode;else if(null===e.which||void 0===e.which)t=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e))&&(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&&"insertText"===e.inputType&&(!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),!0}return!1}resize(e,t){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){var i;null==(i=this._charSizeService)||i.measure()}clear(){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(yk));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}reset(){var e,t;this.options.rows=this.rows,this.options.cols=this.cols;let i=this._customKeyEventHandler;this._setup(),super.reset(),null==(e=this._mouseService)||e.reset(),null==(t=this._selectionService)||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=i,this.refresh(0,this.rows-1,!0)}clearTextureAtlas(){var e;null==(e=this._renderService)||e.clearTextureAtlas()}_reportFocus(){var e;(null==(e=this.element)?void 0:e.classList.contains("focus"))?this.coreService.triggerDataEvent(""):this.coreService.triggerDataEvent("")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`[4;${t};${e}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`[6;${s};${i}t`)}}};function $C(e){return 16===e.keyCode||17===e.keyCode||18===e.keyCode||91===e.keyCode||92===e.keyCode||93===e.keyCode||224===e.keyCode||"Meta"===e.key}var qC=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=()=>this._wrappedAddonDispose(i),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let i=0;i<this._addons.length;i++)if(this._addons[i]===e){t=i;break}if(-1===t)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)}},VC=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 iy)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}},YC=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 VC(t)}getNullCell(){return new iy}},GC=class extends Ey{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Sw),this.onBufferChange=this._onBufferChange.event,this._normal=new YC(this._core.buffers.normal,"normal"),this._alternate=new YC(this._core.buffers.alt,"alternate"),this._register(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)}},XC=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,i)=>t(e,i.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)}registerApcHandler(e,t){return this._core.registerApcHandler(e,t)}},ZC=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}},JC=["cols","rows"],QC=0,ej=class extends Ey{constructor(e){super(),this._core=this._register(new UC(e)),this._addonManager=this._register(new qC),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],i=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let s in this._core.options){let e={get:t.bind(this,s),set:i.bind(this,s)};Object.defineProperty(this._publicOptions,s,e)}}_checkReadonlyOptions(e){if(JC.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 onDimensionsChange(){return this._core.onDimensionsChange}get element(){return this._core.element}get screenElement(){return this._core.screenElement}get parser(){return this._parser??(this._parser=new XC(this._core))}get unicode(){return this._checkProposedApi(),new ZC(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 GC(this._core)))}get markers(){return this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.mouseStateService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any"}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,showCursor:!this._core.coreService.isCursorHidden,synchronizedOutputMode:e.synchronizedOutput,win32InputMode:e.win32InputMode,wraparoundMode:e.wraparound}}get dimensions(){return this._core.dimensions}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._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)}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\n",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 Wx()},set promptLabel(e){Kx(e)},get tooMuchOutput(){return $x()},set tooMuchOutput(e){qx(e)}}}_verifyIntegers(...e){for(QC of e)if(QC===1/0||isNaN(QC)||QC%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(QC of e)if(QC&&(QC===1/0||isNaN(QC)||QC%1!=0||QC<0))throw new Error("This API only accepts positive integers")}};function tj({id:e,kind:t,theme:i,active:s,transport:r,register:n}){var o;const a=gi.useRef(null),l=gi.useRef(null),c=gi.useRef(null),[h,u]=gi.useState(null),d=gi.useCallback(()=>{var e;const t=null==(e=l.current)?void 0:e.getSelection();t&&navigator.clipboard.writeText(t).catch(()=>{})},[]),f=gi.useCallback(()=>{const e=l.current;e&&navigator.clipboard.readText().then(t=>{t&&e.paste(t)}).catch(()=>{})},[]);gi.useEffect(()=>{const s=a.current;if(!s)return;const o=new ej({fontFamily:'"JetBrains Mono", ui-monospace, SFMono-Regular, monospace',fontSize:12.5,lineHeight:1.25,cursorBlink:!0,scrollback:5e3,theme:Ax(i),vtExtensions:{kittyKeyboard:!0}}),h=new Tx;o.loadAddon(h),o.open(s);try{h.fit()}catch{}l.current=o,c.current=h,n(o),r.spawn(e,t,o.cols,o.rows);const p=r.subscribe(e,e=>{if("output"===e.type)o.write(e.data);else if("error"===e.type)o.write(`\r\n${e.message}\r\n`);else if("exit"===e.type){const t=null===e.exitCode?"":` (${e.exitCode})`;o.write(`\r\n[process exited${t}]\r\n`)}}),g=o.onData(t=>r.sendData(e,t)),v=/Mac|iPhone|iPad/i.test(navigator.platform||navigator.userAgent);o.attachCustomKeyEventHandler(e=>{if("keydown"!==e.type)return!0;const t=e.key.toLowerCase();return v&&e.metaKey&&!e.ctrlKey&&!e.altKey?"v"===t?(f(),!1):"c"!==t||!o.hasSelection()||(d(),!1):!(!v&&e.ctrlKey&&!e.metaKey&&!e.altKey)||("v"===t?(f(),!1):"c"!==t||!e.shiftKey&&!o.hasSelection()||(d(),!1))});const m=e=>{e.preventDefault(),u({x:e.clientX,y:e.clientY})};s.addEventListener("contextmenu",m);const _=o.onResize(({cols:t,rows:i})=>r.resize(e,t,i));let b;const x=new ResizeObserver(()=>{void 0!==b&&window.clearTimeout(b),b=window.setTimeout(()=>{b=void 0,(()=>{const e=a.current;if(e&&0!==e.offsetWidth&&0!==e.offsetHeight)try{h.fit()}catch{}})()},120)});return x.observe(s),()=>{void 0!==b&&window.clearTimeout(b),x.disconnect(),s.removeEventListener("contextmenu",m),g.dispose(),_.dispose(),p(),r.close(e),n(null),o.dispose()}},[]),gi.useEffect(()=>{l.current&&(l.current.options.theme=Ax(i))},[i]),gi.useEffect(()=>{if(!s)return;const e=requestAnimationFrame(()=>{var e,t;try{null==(e=c.current)||e.fit(),null==(t=l.current)||t.focus()}catch{}});return()=>cancelAnimationFrame(e)},[s]);const p=[{kind:"item",icon:"copy",label:"Copy",disabled:!(null==(o=l.current)?void 0:o.hasSelection()),onSelect:d},{kind:"item",label:"Paste",onSelect:f},{kind:"separator"},{kind:"item",label:"Select all",onSelect:()=>{var e;return null==(e=l.current)?void 0:e.selectAll()}},{kind:"item",label:"Clear",onSelect:()=>{var e;return null==(e=l.current)?void 0:e.clear()}}];return ki.jsxs(ki.Fragment,{children:[ki.jsx("div",{ref:a,className:"h-full w-full"}),h&&ki.jsx(Dx,{x:h.x,y:h.y,onClose:()=>u(null),items:p})]})}const ij=["local","claude","codex"],sj=__(function(){const e=w_(),t=e.terminal,i=e.theme.theme,s=gi.useRef(new Map),r=gi.useCallback((e,t)=>{t?s.current.set(e,t):s.current.delete(e)},[]),[n,o]=gi.useState(null),a=Bx({value:t.height,onChange:e=>t.setHeight(e),axis:"y",dir:-1,min:t.heightMin,max:()=>t.heightMax}),l=t.activeKind?Rx[t.activeKind]:null,c=[{kind:"header",label:"New session"},...ij.map(e=>({kind:"item",icon:Rx[e].icon,label:Rx[e].label,onSelect:()=>t.newTerm(e)}))],h=[{kind:"item",icon:"refresh",label:"Clear buffer",disabled:!t.activeId,onSelect:()=>{var e;t.activeId&&(null==(e=s.current.get(t.activeId))||e.clear())}},{kind:"separator"},{kind:"item",icon:"x",label:"Close session",tone:"danger",disabled:!t.activeId,onSelect:()=>{t.activeId&&t.closeTerm(t.activeId)}}];return ki.jsxs("div",{className:fx("relative shrink-0",t.open?"flex":"hidden"),style:{height:t.height},children:[ki.jsx(Lx,{axis:"y",onPointerDown:a,className:"-top-[6px]"}),ki.jsxs("div",{className:"uno-island flex min-h-0 flex-1 flex-col",children:[ki.jsxs("div",{className:"flex h-9 shrink-0 items-stretch gap-1 border-b border-edge bg-panel pl-3 pr-1",children:[ki.jsx("div",{className:"flex items-center pr-1 text-[12px] font-semibold text-fg-3",children:"Terminal"}),ki.jsxs("div",{className:"uno-thin-scroll flex min-w-0 flex-1 items-stretch gap-1 overflow-x-auto py-1",children:[t.tabs.map(e=>{const i=Rx[e.kind],s=e.id===t.activeId;return ki.jsx(Px,{label:i.label,active:s,closeLabel:`Close ${i.label} session`,onActivate:()=>t.activate(e.id),onClose:()=>t.closeTerm(e.id),leading:ki.jsx(gx,{name:i.icon,className:fx("h-3.5 w-3.5 shrink-0",s?"":i.tint)})},e.id)}),ki.jsxs("div",{className:"flex shrink-0 items-center self-center",children:[ki.jsx("button",{type:"button",onClick:()=>t.newTerm("local"),title:"New Local terminal",className:"grid h-7 w-7 place-items-center rounded-md text-fg-3 hover:bg-raised hover:text-fg",children:ki.jsx(gx,{name:"plus",className:"h-4 w-4"})}),ki.jsx("button",{type:"button",onClick:e=>{const t=e.currentTarget.getBoundingClientRect();o({x:t.left,y:t.bottom+4,mode:"new"})},title:"New session…",className:"grid h-7 w-5 place-items-center rounded-md text-fg-4 hover:bg-raised hover:text-fg-2",children:ki.jsx(gx,{name:"chevronD",className:"h-3.5 w-3.5"})})]})]}),ki.jsxs("div",{className:"flex items-center gap-0.5 self-center",children:[l&&ki.jsxs("button",{type:"button",onClick:e=>{const t=e.currentTarget.getBoundingClientRect();o({x:Math.max(6,t.right-208),y:t.bottom+4,mode:"new"})},className:"flex h-7 items-center gap-1.5 rounded-md px-2 text-fg-3 hover:bg-raised hover:text-fg",title:"Start a new session",children:[ki.jsx(gx,{name:l.icon,className:fx("h-3.5 w-3.5",l.tint)}),ki.jsx("span",{className:"font-mono text-[11.5px]",children:l.label}),ki.jsx(gx,{name:"chevronD",className:"h-3.5 w-3.5 opacity-60"})]}),ki.jsx("button",{type:"button",onClick:e=>{const t=e.currentTarget.getBoundingClientRect();o({x:Math.max(6,t.right-208),y:t.bottom+4,mode:"more"})},title:"More",className:"grid h-7 w-7 place-items-center rounded-md text-fg-3 hover:bg-raised hover:text-fg",children:ki.jsx(gx,{name:"more",className:"h-4 w-4"})}),ki.jsx("button",{type:"button",onClick:()=>t.hide(),title:"Hide terminal (⌃`)",className:"grid h-7 w-7 place-items-center rounded-md text-fg-3 hover:bg-raised hover:text-fg",children:ki.jsx(gx,{name:"minus",className:"h-4 w-4"})})]})]}),ki.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden bg-canvas px-2 pt-1",children:[0===t.tabs.length&&ki.jsx("div",{className:"flex h-full items-center justify-center font-mono text-[11.5px] text-fg-4",children:"no sessions · click + to start one"}),t.tabs.map(s=>ki.jsx("div",{className:fx("absolute inset-0 px-2 pt-1",s.id===t.activeId?"block":"hidden"),children:ki.jsx(tj,{id:s.id,kind:s.kind,theme:i,active:t.open&&s.id===t.activeId,transport:e.terminalTransport,register:e=>r(s.id,e)})},s.id))]})]}),n&&ki.jsx(Dx,{x:n.x,y:n.y,onClose:()=>o(null),items:"new"===n.mode?c:h})]})});function rj({id:e}){return ki.jsx("div",{className:"grid h-full place-items-center px-6",children:ki.jsxs("div",{className:"text-center",children:[ki.jsx(gx,{name:"alert",className:"mx-auto h-5 w-5 text-fg-4"}),ki.jsxs("div",{className:"mt-2 font-mono text-[12.5px] text-fg-3",children:["not found: ",e]})]})})}const nj={neutral:"border-edge-soft bg-raised text-fg-3",pass:"border-pass/30 bg-pass/10 text-pass",fail:"border-fail/30 bg-fail/10 text-fail",run:"border-warn/30 bg-warn/10 text-warn",warn:"border-warn/30 bg-warn/10 text-warn",info:"border-accent/30 bg-accent/10 text-accent",purple:"border-accent/30 bg-accent/10 text-accent"};function oj({children:e,tone:t="neutral",size:i="sm"}){return ki.jsx("span",{className:fx("inline-flex items-center gap-1 rounded border font-mono font-medium uppercase tracking-wider","xs"===i?"h-[14px] px-1 text-[9.5px]":"h-5 px-1.5 text-[10.5px]",nj[t]),children:e})}const aj={passed:"bg-pass",failed:"bg-fail",running:"bg-warn",paused:"bg-warn",pending:"bg-fg-4",aborted:"bg-fg-4",expected:"bg-expected",never:"border border-fg-4"},lj={passed:"ring-pass/15",failed:"ring-fail/15",running:"ring-warn/15",paused:"ring-warn/25",pending:"ring-fg-4/10",aborted:"ring-fg-4/10",expected:"ring-expected/15",never:"ring-transparent"};function cj({status:e,large:t=!1,pulse:i=!0}){const s=t?"h-2.5 w-2.5":"h-2 w-2";return ki.jsx("span",{className:fx("inline-block shrink-0 rounded-full ring-2",s,aj[e],"running"===e&&i&&"uno-pulse",lj[e])})}function hj(e){return null==e?"—":e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(2)}s`:`${Math.floor(e/6e4)}m ${Math.round(e%6e4/1e3)}s`}function uj(e){if(null==e)return"never run";const t="string"==typeof e?new Date(e).getTime():e;if(!Number.isFinite(t))return"—";const i=Math.max(0,Math.round((Date.now()-t)/1e3));return i<60?`${i}s ago`:i<3600?`${Math.round(i/60)}m ago`:i<86400?`${Math.round(i/3600)}h ago`:i<604800?`${Math.round(i/86400)}d ago`:new Date(t).toISOString().slice(0,10)}function dj(e,t){return null===e?"never":Z_(e)?t?"expected":"failed":t&&"passed"===e?"failed":pj(e)}function fj(e){return e?pj(e.status):"never"}function pj(e){switch(e){case"running":return"running";case"passed":return"passed";case"failed":return"failed";case"aborted":case"interrupted":return"aborted"}}function gj(e){switch(e){case"passed":return"pass";case"failed":return"fail";case"running":return"run";case"paused":case"aborted":return"warn";default:return"neutral"}}const vj=__(function({runId:e}){const t=w_(),i=t.activeRuns.collectionByRunId.get(e),s=t.runs.items.find(t=>t.runId===e),r=!i&&s?t.historicRuns.get(e):null;gi.useEffect(()=>{!i&&s&&t.historicRuns.loadIfNeeded(e)},[e,i,s,t.historicRuns]);const n=function(e,t,i,s){if(i)return function(e,t){var i;const s=new Map,r=new Map;for(const u of t.events)"collection-run:scenario-started"===u.kind?s.set(u.scenario,u.t):"collection-run:scenario-finished"===u.kind&&r.set(u.scenario,u.t);const n=t.scenarios.map(i=>{const n=t.childRunIds.get(i)??null,o=t.childOutcomes.get(i)??null,a=n?e.activeRuns.byRunId.get(n):null,l=e.scenarios.items.find(e=>e.name===i),{status:c,skipReason:h}=mj({hasChildRunId:null!==n,childOutcome:o,childLiveStatus:(null==a?void 0:a.status)??null});return{scenario:i,status:c,durationMs:_j(s.get(i)??null,r.get(i)??null),childRunId:n,scenarioPath:(null==l?void 0:l.path)??null,skipReason:h}}),o=n.filter(e=>"passed"===e.status).length,a=n.filter(e=>"failed"===e.status).length,l=n.filter(e=>"running"===e.status||"paused"===e.status).length,c=t.startedAt,h=null!==t.outcome?(null==(i=t.events[t.events.length-1])?void 0:i.t)??null:null;return{headerStatus:bj(t),ref:t.collection||"—",durationMs:null!==h?h-c:null,rows:n,passed:o,failed:a,running:l,total:n.length||t.scenarios.length,abortable:"starting"===t.status||"running"===t.status}}(t,i);if(s&&"collection"===s.meta.kind)return function(e,t){let i=[];const s=new Map,r=new Map,n=new Map,o=new Map;for(const h of t.events)"collection-run:started"===h.kind?i=[...h.scenarios]:"collection-run:scenario-started"===h.kind?(s.set(h.scenario,h.scenarioRunId),n.set(h.scenario,h.t)):"collection-run:scenario-finished"===h.kind&&(r.set(h.scenario,h.outcome),o.set(h.scenario,h.t));const a=i.map(t=>{const i=s.get(t)??null,a=r.get(t)??null,l=e.scenarios.items.find(e=>e.name===t),{status:c,skipReason:h}=mj({hasChildRunId:null!==i,childOutcome:a,childLiveStatus:null});return{scenario:t,status:c,durationMs:_j(n.get(t)??null,o.get(t)??null),childRunId:i,scenarioPath:(null==l?void 0:l.path)??null,skipReason:h}}),l=a.filter(e=>"passed"===e.status).length,c=a.filter(e=>"failed"===e.status).length;return{headerStatus:pj(t.meta.status),ref:t.meta.ref,durationMs:t.meta.durationMs,rows:a,passed:l,failed:c,running:0,total:a.length,abortable:!1}}(t,{meta:s.meta,events:s.events});const r=t.runs.items.find(t=>t.runId===e);if(r&&"collection"===r.kind)return{headerStatus:pj(r.status),ref:r.ref,durationMs:r.durationMs,rows:[],passed:0,failed:0,running:0,total:0,abortable:!1};return null}(e,t,i,r);if(!n)return ki.jsx(rj,{id:e});const{headerStatus:o,ref:a,durationMs:l,rows:c,passed:h,failed:u,running:d,total:f,abortable:p}=n;return ki.jsxs("div",{className:"flex h-full min-w-0 flex-col",children:[ki.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-3 border-b border-edge bg-canvas px-4",children:[ki.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[ki.jsx(gx,{name:"layers",className:"h-4 w-4 shrink-0 text-fg-3"}),ki.jsx(cj,{status:o,large:!0}),ki.jsx("span",{className:"truncate font-mono text-[13px] text-fg",children:a}),ki.jsx(oj,{tone:gj(o),children:o}),ki.jsx(oj,{tone:"info",children:"collection"})]}),ki.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-2 whitespace-nowrap font-mono text-[11.5px] text-fg-2 sm:gap-3",children:[ki.jsxs("span",{className:"hidden tabular-nums sm:inline",children:[h,"/",f," passed"]}),u>0&&ki.jsxs("span",{className:"tabular-nums text-fail",children:[u," failed"]}),ki.jsx("span",{className:"tabular-nums",children:hj(l)}),p&&t.session.capabilities.canRun&&ki.jsxs("button",{type:"button",onClick:()=>{t.activeRuns.abort(e)},title:"Stop the collection — sends SIGTERM to all in-flight scenarios",className:"flex h-6 items-center gap-1 rounded border border-fail/40 px-2 font-mono text-[11px] text-fail hover:bg-fail/10",children:[ki.jsx(gx,{name:"square",className:"h-3 w-3",strokeWidth:2.5})," Stop"]})]})]}),ki.jsxs("div",{className:"flex h-2 shrink-0 overflow-hidden bg-raised",children:[ki.jsx("div",{className:"h-full bg-pass",style:{width:h/Math.max(1,f)*100+"%"}}),ki.jsx("div",{className:"h-full bg-fail",style:{width:u/Math.max(1,f)*100+"%"}}),ki.jsx("div",{className:fx("h-full bg-warn",d>0&&"uno-pulse"),style:{width:d/Math.max(1,f)*100+"%"}})]}),ki.jsxs("div",{className:"flex-1 overflow-auto",children:[ki.jsxs("div",{className:"flex h-7 items-center gap-2 border-b border-edge-soft px-4 font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:[ki.jsx("span",{className:"w-4"}),ki.jsx("span",{className:"flex-1",children:"scenario"}),ki.jsx("span",{className:"w-20 text-right",children:"time"})]}),c.map(e=>ki.jsxs("button",{type:"button",onClick:()=>{e.childRunId?t.tabs.open({kind:"scenario-run",runId:e.childRunId}):e.scenarioPath&&t.tabs.open({kind:"scenario",path:e.scenarioPath})},className:"group flex h-10 w-full items-center gap-2 border-b border-edge-soft px-4 text-left hover:bg-raised/60",children:[ki.jsx(cj,{status:e.status,large:!0}),ki.jsxs("div",{className:"min-w-0 flex-1",children:[ki.jsx("div",{className:"truncate font-mono text-[12.5px] text-fg",children:e.scenario}),e.skipReason&&ki.jsxs("div",{className:"mt-0.5 truncate font-mono text-[10px] text-fg-4",children:["skipped — ",e.skipReason]})]}),ki.jsx("span",{className:"w-20 text-right font-mono text-[11px] tabular-nums text-fg-2",children:hj(e.durationMs)}),ki.jsx(gx,{name:"chevronR",className:"h-3.5 w-3.5 text-fg-4 group-hover:text-fg-3"})]},e.scenario)),0===c.length&&ki.jsx("div",{className:"px-4 py-6 text-center font-mono text-[11.5px] text-fg-4",children:"collection has no scenarios"})]})]})});function mj(e){return null!==e.childOutcome?{status:yj(e.childOutcome),skipReason:null}:null!==e.childLiveStatus?{status:xj(e.childLiveStatus),skipReason:null}:e.hasChildRunId?{status:"running",skipReason:null}:{status:"pending",skipReason:"skipped"}}function _j(e,t){return null===e||null===t?null:Math.max(0,t-e)}function bj(e){switch(e.status){case"queued":return"pending";case"starting":case"running":return"running";case"completed":return"passed";case"failed":return"failed";case"aborted":return"aborted"}}function xj(e){switch(e){case"queued":return"pending";case"starting":case"running":return"running";case"paused":return"paused";case"completed":return"passed";case"failed":return"failed";case"aborted":return"aborted"}}function yj(e){switch(e){case"completed":return"passed";case"failed":return"failed";case"aborted":case"interrupted":return"aborted"}}function wj({anchor:e,candidates:t,onPick:i,onClose:s}){const r=gi.useRef(null),n=gi.useRef(null),o=gi.useRef(null),[a,l]=gi.useState(""),[c,h]=gi.useState(0),[u,d]=gi.useState(!1),f=e.top-12,p=window.innerHeight-e.bottom-12,g=p>f?"down":"up",v=gi.useMemo(()=>{const e=a.trim().toLowerCase();return e?t.filter(t=>t.name.toLowerCase().includes(e)):t},[a,t]);gi.useEffect(()=>{h(0)},[a,v.length]),gi.useEffect(()=>{var e;null==(e=n.current)||e.focus();const t=requestAnimationFrame(()=>d(!0));return()=>cancelAnimationFrame(t)},[]),gi.useEffect(()=>{const e=e=>{var t;(null==(t=r.current)?void 0:t.contains(e.target))||s()},t=e=>{"Escape"===e.key&&s()},i=e=>{var t;(null==(t=r.current)?void 0:t.contains(e.target))||s()};return window.addEventListener("mousedown",e,!0),window.addEventListener("contextmenu",e,!0),window.addEventListener("keydown",t),window.addEventListener("scroll",i,!0),()=>{window.removeEventListener("mousedown",e,!0),window.removeEventListener("contextmenu",e,!0),window.removeEventListener("keydown",t),window.removeEventListener("scroll",i,!0)}},[s]),gi.useEffect(()=>{0===t.length&&s()},[t.length,s]);const m=e=>{var t;const i=null==(t=o.current)?void 0:t.children[e];null==i||i.scrollIntoView({block:"nearest"})},_=e=>{var t;const s=v[e];s&&(i(s.name),l(""),null==(t=n.current)||t.focus())},b={position:"fixed",left:e.left,width:e.width,maxHeight:Math.max(180,"up"===g?f:p),opacity:u?1:0,transform:u?"translateY(0)":"up"===g?"translateY(2px)":"translateY(-2px)",transitionProperty:"opacity, transform",transitionDuration:"90ms",transitionTimingFunction:"ease-out",..."up"===g?{bottom:window.innerHeight-e.top+6}:{top:e.bottom+6}};return ki.jsxs("div",{ref:r,role:"dialog",style:b,className:fx("z-50 flex flex-col overflow-hidden rounded-lg p-1","border border-edge-soft bg-overlay/95 backdrop-blur","shadow-lg"),children:[ki.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1.5 rounded-md px-2",children:[ki.jsx(gx,{name:"search",className:"h-3.5 w-3.5 text-fg-3"}),ki.jsx("input",{ref:n,value:a,onChange:e=>l(e.target.value),onKeyDown:e=>{if("ArrowDown"===e.key)e.preventDefault(),h(e=>{const t=Math.min(v.length-1,e+1);return m(t),t});else if("ArrowUp"===e.key)e.preventDefault(),h(e=>{const t=Math.max(0,e-1);return m(t),t});else if("Enter"===e.key)e.preventDefault(),_(c);else if("Home"===e.key)e.preventDefault(),h(0),m(0);else if("End"===e.key){e.preventDefault();const t=v.length-1;h(t),m(t)}},spellCheck:!1,autoComplete:"off",placeholder:"filter scenarios…",className:"min-w-0 flex-1 bg-transparent font-mono text-[12px] text-fg placeholder-fg-4 outline-none"}),ki.jsxs("span",{className:"font-mono text-[10px] tracking-wider text-fg-4",children:[v.length,"/",t.length]})]}),ki.jsx("div",{className:"my-1 h-px shrink-0 bg-edge-soft"}),ki.jsx("div",{ref:o,className:"min-h-0 flex-1 overflow-auto",children:0===v.length?ki.jsxs("div",{className:"px-2 py-3 text-center font-mono text-[11.5px] text-fg-4",children:['no match for "',a.trim(),'"']}):v.map((e,t)=>{const i=t===c;return ki.jsxs("button",{type:"button",onMouseEnter:()=>h(t),onMouseDown:e=>e.preventDefault(),onClick:()=>_(t),className:fx("flex h-7 w-full items-center gap-2 rounded-md px-2 text-left",i?"bg-selection text-fg":"text-fg-2 hover:bg-raised/60"),children:[ki.jsx(gx,{name:"file",className:fx("h-3.5 w-3.5 shrink-0",i?"text-accent":"text-fg-4")}),ki.jsx("span",{className:"truncate font-mono text-[12px]",children:e.name})]},e.name)})}),ki.jsx("div",{className:"my-1 h-px shrink-0 bg-edge-soft"}),ki.jsxs("div",{className:"flex shrink-0 items-center gap-2 px-2 py-0.5 font-mono text-[10px] text-fg-4",children:[ki.jsx("span",{children:"↑↓ navigate"}),ki.jsx("span",{children:"·"}),ki.jsx("span",{children:"↵ add"}),ki.jsx("span",{children:"·"}),ki.jsx("span",{children:"esc done"})]})]})}const Sj="Not available in a read-only session",kj="cursor-not-allowed opacity-40",Cj=__(function({path:e}){const t=w_(),[i,s]=gi.useState(null),[r,n]=gi.useState(null),[o,a]=gi.useState(null),[l,c]=gi.useState(!1),[h,u]=gi.useState(!1),[d,f]=gi.useState(!1),p=gi.useRef(null),g=gi.useRef([]),v=t.collections.byPath(e),m=gi.useMemo(()=>{if(!v)return[];const e=new Set(v.scenarios);return t.scenarios.items.filter(t=>!e.has(t.name))},[v,t.scenarios.items]);if(gi.useEffect(()=>{if(!r||!v)return;document.body.style.userSelect="none",document.body.style.cursor="grabbing";const i=v.scenarios.slice();a(i);const s=e=>{const t=e.clientY;let i=-1,s=1/0;for(let r=0;r<g.current.length;r++){const e=g.current[r];if(!e)continue;const n=e.getBoundingClientRect(),o=n.top+n.height/2,a=Math.abs(t-o);a<s&&(s=a,i=r)}a(e=>{if(!e)return e;const t=e.indexOf(r.name);if(t<0||i<0||i===t)return e;const s=e.slice();return s.splice(t,1),s.splice(i,0,r.name),s}),n(i=>i?{...i,pointerX:e.clientX,pointerY:t}:null)},o=s=>{n(null),a(r=>(s&&r&&!function(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}(r,i)&&t.collections.reorderScenarios(e,r),null))},l=()=>o(!0),c=()=>o(!1),h=e=>{"Escape"===e.key&&o(!1)};return window.addEventListener("pointermove",s),window.addEventListener("pointerup",l),window.addEventListener("pointercancel",c),window.addEventListener("keydown",h),()=>{document.body.style.userSelect="",document.body.style.cursor="",window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",l),window.removeEventListener("pointercancel",c),window.removeEventListener("keydown",h)}},[null==r?void 0:r.name,v,e,t.collections]),!v)return ki.jsx(rj,{id:e});const _=t.runs.lastRunByRef("collection",v.name),b=(o??v.scenarios).map(e=>{const i=t.scenarios.items.find(t=>t.name===e),s=t.runs.lastRunByRef("scenario",e);return{name:e,found:i,last:s}}),x=(e,t)=>{if(0!==e.button)return;e.preventDefault();const i=e.currentTarget.closest("[data-scenario-row]");if(!i)return;const s=i.getBoundingClientRect();n({name:t,left:s.left,width:s.width,offsetY:e.clientY-s.top,pointerX:e.clientX,pointerY:e.clientY})},y=t.session.capabilities.canRun,w=!y||0===v.scenarios.length;return ki.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[ki.jsxs("header",{className:"flex shrink-0 items-start gap-4 border-b border-edge px-4 py-3",children:[ki.jsxs("div",{className:"min-w-0 flex-1",children:[ki.jsxs("div",{className:"flex items-center gap-2",children:[ki.jsx(gx,{name:"layers",className:"h-4 w-4 text-fg-3"}),l?ki.jsx(Nj,{initial:v.name,duplicateCheck:i=>t.collections.nameTaken(i,e),onCommit:async i=>{const s=await t.collections.rename(e,i);s&&(s.path!==e&&t.tabs.renameCollectionTab(e,s.path),c(!1))},onCancel:()=>c(!1)}):ki.jsxs("button",{type:"button",onClick:()=>c(!0),className:"group flex min-w-0 items-center gap-1.5 truncate font-mono text-[15px] font-medium text-fg",title:"Rename",children:[ki.jsx("span",{className:"truncate",children:v.name}),ki.jsx("span",{className:"text-fg-4 opacity-0 group-hover:opacity-100",children:ki.jsx(gx,{name:"edit",className:"h-3 w-3"})})]}),ki.jsx(oj,{tone:"info",children:"collection"})]}),h?ki.jsx(Bj,{initial:v.description??"",onCommit:i=>{t.collections.setDescription(e,0===i.trim().length?null:i.trim()),u(!1)},onCancel:()=>u(!1)}):ki.jsx("button",{type:"button",onClick:()=>u(!0),className:"mt-1 block max-w-[640px] text-left text-[12.5px] leading-relaxed text-fg-2 hover:text-fg",title:"Edit description",children:v.description??ki.jsx("span",{className:"italic text-fg-4",children:"+ add description"})}),ki.jsxs("div",{className:"mt-1.5 flex items-center gap-3 font-mono text-[11px] text-fg-3",children:[ki.jsxs("span",{children:[v.scenarios.length," scenarios"]}),ki.jsx("span",{children:"·"}),d?ki.jsx(Mj,{initial:v.workers??1,onCommit:i=>{t.collections.setWorkers(e,i<=1?null:i),f(!1)},onCancel:()=>f(!1)}):ki.jsxs("button",{type:"button",onClick:()=>f(!0),className:"hover:text-fg",title:"How many scenarios of this collection run concurrently (1 = sequential). Click to edit",children:["workers: ",v.workers??1]}),ki.jsx("span",{children:"·"}),ki.jsx("span",{children:_?`last run ${uj(_.startedAt)}`:"never run"})]})]}),ki.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[ki.jsx("button",{type:"button",onClick:async()=>{const i=`collection:${e}`;await t.collections.delete(e)&&t.tabs.close(i)},className:"grid h-7 w-7 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fail",title:"Delete collection",children:ki.jsx(gx,{name:"trash",className:"h-3.5 w-3.5"})}),ki.jsxs("button",{type:"button",disabled:w,onClick:w?void 0:async()=>{try{const e=await t.activeRuns.startCollection(v.name);t.tabs.open({kind:"collection-run",runId:e.runId})}catch(e){t.collections.setError(e instanceof Error?e.message:String(e))}},title:y?0===v.scenarios.length?"add at least one scenario before running":t.queue.waitingCount>0||t.queue.running.length>0?"the machine is busy — this run joins the queue":(v.workers??1)>1?`Run every scenario in this collection, ${v.workers} in parallel`:"Run every scenario in this collection sequentially":Sj,className:fx("flex h-7 items-center gap-1.5 rounded px-2.5 font-mono text-[11.5px] font-medium",w?"cursor-not-allowed bg-raised text-fg-4":"bg-accent text-on-accent hover:bg-accent-hover"),children:[ki.jsx(gx,{name:"play",className:"h-3.5 w-3.5",strokeWidth:2.5})," Run all"]})]})]}),t.collections.error&&ki.jsxs("div",{className:"flex shrink-0 items-start gap-2 border-b border-fail/30 bg-fail/10 px-4 py-2 font-mono text-[11.5px] text-fail",children:[ki.jsx(gx,{name:"alert",className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),ki.jsx("span",{className:"flex-1",children:t.collections.error}),ki.jsx("button",{type:"button",onClick:()=>t.collections.clearError(),title:"Dismiss",className:"grid h-4 w-4 shrink-0 place-items-center rounded hover:bg-fail/20",children:ki.jsx(gx,{name:"x",className:"h-3 w-3",strokeWidth:2.25})})]}),ki.jsxs("div",{className:"min-h-0 flex-1 overflow-auto",children:[ki.jsxs("div",{className:"flex h-7 items-center gap-2 border-b border-edge-soft px-4 font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:[ki.jsx("span",{className:"w-4"}),ki.jsx("span",{className:"w-3"}),ki.jsx("span",{className:"flex-1",children:"scenario"}),ki.jsx("span",{className:"w-24 text-right",children:"last run"}),ki.jsx("span",{className:"w-6"})]}),ki.jsx("div",{className:"relative",children:b.map((i,s)=>{const n=e=>{g.current[s]=e};if((null==r?void 0:r.name)===i.name)return ki.jsx("div",{ref:n,"data-scenario-row":!0,className:"h-9 px-4",children:ki.jsx("div",{className:"h-full rounded border-2 border-dashed border-accent/50 bg-accent/10"})},i.name);if(!i.found)return ki.jsxs("div",{ref:n,"data-scenario-row":!0,className:"group flex h-9 items-center gap-2 px-4 hover:bg-raised/60",children:[ki.jsx(jj,{onPointerDown:e=>x(e,i.name)}),ki.jsx(cj,{status:"never"}),ki.jsx("span",{className:"flex-1 truncate font-mono text-[12.5px] text-fail line-through",title:"file not found",children:i.name}),ki.jsx(oj,{tone:"fail",size:"xs",children:"orphan"}),ki.jsx("button",{type:"button",onClick:()=>{t.collections.removeScenario(e,i.name)},className:"grid h-6 w-6 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fail",title:"Remove from collection",children:ki.jsx(gx,{name:"x",className:"h-3.5 w-3.5",strokeWidth:2.5})})]},i.name);const o=i.found;return ki.jsxs("div",{ref:n,"data-scenario-row":!0,className:"group flex h-9 items-center gap-2 px-4 hover:bg-raised/60",children:[ki.jsx(jj,{onPointerDown:e=>x(e,i.name),hoverGroup:!0}),ki.jsx(cj,{status:fj(i.last)}),ki.jsx("button",{type:"button",onClick:()=>t.tabs.open({kind:"scenario",path:o.path}),className:"flex-1 truncate text-left font-mono text-[12.5px] text-fg hover:text-accent",children:o.name}),ki.jsx("span",{className:"w-24 text-right font-mono text-[11px] text-fg-2",children:i.last?uj(i.last.startedAt):"—"}),ki.jsx("button",{type:"button",onClick:()=>t.collections.removeScenario(e,i.name),className:"grid h-6 w-6 place-items-center rounded text-fg-4 opacity-0 hover:bg-raised hover:text-fail group-hover:opacity-100",title:"Remove",children:ki.jsx(gx,{name:"x",className:"h-3.5 w-3.5",strokeWidth:2.5})})]},i.name)})}),ki.jsx("div",{className:"px-4 py-2",children:ki.jsxs("button",{ref:p,type:"button",onClick:()=>{var e;const t=null==(e=p.current)?void 0:e.getBoundingClientRect();t&&s(t)},disabled:0===m.length,className:fx("flex w-full items-center justify-center gap-1.5 rounded border border-dashed px-2 py-1.5 font-mono text-[11.5px]",0===m.length?"cursor-default border-edge-soft text-fg-4":i?"border-accent bg-accent/10 text-accent":"border-edge-soft text-fg-3 hover:border-accent hover:bg-accent/10 hover:text-accent"),children:[ki.jsx(gx,{name:"plus",className:"h-3.5 w-3.5"}),0===m.length?"all scenarios added":"add scenario"]})})]}),i&&ki.jsx(wj,{anchor:i,candidates:m,onPick:i=>{t.collections.addScenario(e,i)},onClose:()=>s(null)}),r&&(()=>{const e=b.find(e=>e.name===r.name);if(!e)return null;const t=Math.max(4,r.pointerY-r.offsetY);return ki.jsxs("div",{style:{position:"fixed",left:r.left,width:r.width,top:t,zIndex:60,pointerEvents:"none",transform:"scale(1.01)",transformOrigin:"left center"},className:fx("flex h-9 items-center gap-2 rounded-md px-4 font-mono","border border-accent/50 bg-overlay/95 backdrop-blur ring-1 ring-accent/15","shadow-[0_14px_36px_-10px_rgba(15,15,20,0.28),0_4px_10px_-3px_rgba(15,15,20,0.12)]","dark:shadow-[0_14px_36px_-10px_rgba(0,0,0,0.7),0_4px_10px_-3px_rgba(0,0,0,0.5)]"),children:[ki.jsx(gx,{name:"grip",className:"h-3.5 w-3.5 text-accent"}),ki.jsx(cj,{status:e.found?fj(e.last):"never"}),ki.jsx("span",{className:fx("flex-1 truncate text-[12.5px]",e.found?"text-fg":"text-fail line-through"),children:e.name}),!e.found&&ki.jsx(oj,{tone:"fail",size:"xs",children:"orphan"}),e.found&&ki.jsxs(ki.Fragment,{children:[ki.jsx("span",{className:"w-24 text-right text-[11px] text-fg-2",children:e.last?uj(e.last.startedAt):"—"}),ki.jsx("span",{className:"w-6"})]})]})})()]})});function jj({onPointerDown:e,hoverGroup:t=!1}){return ki.jsx("span",{onPointerDown:e,role:"button","aria-label":"Reorder",title:"Drag to reorder",className:fx("grid h-5 w-3.5 shrink-0 cursor-grab touch-none place-items-center text-fg-4 active:cursor-grabbing",t&&"group-hover:text-fg-3"),children:ki.jsx(gx,{name:"grip",className:"h-3.5 w-3.5"})})}function Nj({initial:e,duplicateCheck:t,onCommit:i,onCancel:s}){const[r,n]=gi.useState(e),o=gi.useRef(null);gi.useEffect(()=>{var e,t;null==(e=o.current)||e.focus(),null==(t=o.current)||t.select()},[]);const a=r.trim(),l=a.length>0&&a!==e?qb(a):null,c=a.length>0&&t(a),h=c||null!==l,u=a.length>0&&!h&&a!==e;return ki.jsx("form",{onSubmit:t=>{t.preventDefault(),u?i(a):a===e&&s()},className:"min-w-0 flex-1",children:ki.jsx("input",{ref:o,value:r,onChange:e=>n(e.target.value),onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),s())},onBlur:()=>{u?i(a):s()},spellCheck:!1,autoComplete:"off",className:fx("w-full min-w-0 rounded border bg-canvas px-1.5 py-0.5 font-mono text-[15px] font-medium text-fg outline-none ring-2",h?"border-fail ring-fail/20":"border-accent ring-accent/20"),title:c?`"${a}" already exists`:l??void 0})})}function Mj({initial:e,onCommit:t,onCancel:i}){const[s,r]=gi.useState(String(e)),n=gi.useRef(null);gi.useEffect(()=>{var e,t;null==(e=n.current)||e.focus(),null==(t=n.current)||t.select()},[]);const o=Number(s),a=Number.isInteger(o)&&o>=1,l=()=>{a?t(o):i()};return ki.jsxs("span",{className:"flex items-center gap-1",children:[ki.jsx("span",{children:"workers:"}),ki.jsx("input",{ref:n,value:s,onChange:e=>r(e.target.value),onKeyDown:e=>{"Escape"===e.key?(e.preventDefault(),i()):"Enter"===e.key&&(e.preventDefault(),l())},onBlur:l,inputMode:"numeric",spellCheck:!1,autoComplete:"off",className:fx("w-10 rounded border bg-canvas px-1 py-0 font-mono text-[11px] text-fg outline-none ring-2",a?"border-accent ring-accent/20":"border-fail ring-fail/20"),title:a?void 0:"integer >= 1"})]})}function Bj({initial:e,onCommit:t,onCancel:i}){const[s,r]=gi.useState(e),n=gi.useRef(null);return gi.useEffect(()=>{var e,t;null==(e=n.current)||e.focus(),null==(t=n.current)||t.select()},[]),ki.jsxs("form",{onSubmit:e=>{e.preventDefault(),t(s)},className:"mt-1 max-w-[640px]",children:[ki.jsx("textarea",{ref:n,value:s,onChange:e=>r(e.target.value),onKeyDown:e=>{"Escape"===e.key?(e.preventDefault(),i()):"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),t(s))},onBlur:()=>t(s),rows:2,placeholder:"describe what this collection covers…",className:"w-full resize-none rounded border border-accent bg-canvas px-1.5 py-0.5 text-[12.5px] leading-relaxed text-fg-2 outline-none ring-2 ring-accent/20 placeholder:text-fg-4"}),ki.jsx("div",{className:"mt-1 px-1 font-mono text-[10px] text-fg-4",children:"⌘↵ save · esc cancel"})]})}const Ej={},Dj=function(e,t,i){let s=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const e=document.querySelector("meta[property=csp-nonce]"),i=(null==e?void 0:e.nonce)||(null==e?void 0:e.getAttribute("nonce"));s=Promise.allSettled(t.map(e=>{if((e=function(e){return"/"+e}(e))in Ej)return;Ej[e]=!0;const t=e.endsWith(".css"),s=t?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${e}"]${s}`))return;const r=document.createElement("link");return r.rel=t?"stylesheet":"modulepreload",t||(r.as="script"),r.crossOrigin="",r.href=e,i&&r.setAttribute("nonce",i),document.head.appendChild(r),t?new Promise((t,i)=>{r.addEventListener("load",t),r.addEventListener("error",()=>i(new Error(`Unable to preload CSS for ${e}`)))}):void 0}))}function r(e){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return s.then(t=>{for(const e of t||[])"rejected"===e.status&&r(e.reason);return e().catch(r)})};function Lj({label:e,hint:t,placement:i="bottom"}){return ki.jsxs("span",{role:"tooltip",className:fx("pointer-events-none absolute z-50 hidden items-center gap-1.5 whitespace-nowrap rounded-md border border-edge-soft bg-overlay px-2 py-1 font-mono text-[10.5px] font-normal normal-case tracking-normal text-fg-2 shadow-md group-hover:flex",{right:"left-full top-1/2 ml-2 -translate-y-1/2",bottom:"left-1/2 top-full mt-1.5 -translate-x-1/2","bottom-start":"left-0 top-full mt-1.5","bottom-end":"right-0 top-full mt-1.5"}[i]),children:[e,t&&ki.jsx("span",{className:"font-mono text-[9.5px] text-fg-3",children:t})]})}function Pj({value:e,onChange:t,options:i}){return ki.jsx("div",{className:"inline-flex rounded-md border border-edge-soft bg-raised p-0.5",children:i.map(i=>ki.jsxs("button",{type:"button",onClick:()=>t(i.value),"aria-pressed":e===i.value,className:fx("group relative flex items-center gap-1 rounded px-2.5 py-1 font-mono text-[11px] transition-colors",e===i.value?"bg-canvas text-fg shadow-sm":"text-fg-3 hover:text-fg-2"),children:[i.icon&&ki.jsx(gx,{name:i.icon,className:"h-3.5 w-3.5",strokeWidth:1.75}),ki.jsx("span",{children:i.label}),i.title&&ki.jsx(Lj,{label:i.title})]},i.value))})}function Rj(e){const t=[],i=/('[^']*'|"[^"]*"|`[^`]*`|\/\/[^\n]*|[A-Za-z_][\w$]*|\d+|[(){}[\],:.;]|\s+|[^A-Za-z0-9_'"`(){}\[\],:.;\s]+)/g,s=new Set(["true","false","null","undefined","await","async","const","let","var","return","export","import","from","if","else","function"]);let r;for(;r=i.exec(e);){const n=r[0];if(n.startsWith("//"))t.push({t:n,cls:"text-fg-4 italic"});else if(/^['"`]/.test(n))t.push({t:n,cls:"text-syn-string"});else if(/^\d+$/.test(n))t.push({t:n,cls:"text-syn-number"});else if(s.has(n))t.push({t:n,cls:"text-syn-keyword"});else if(/^[A-Za-z_][\w$]*$/.test(n)){const s=e.slice(i.lastIndex);/^\s*\(/.test(s)?t.push({t:n,cls:"text-accent"}):t.push({t:n,cls:"text-fg"})}else/^[(){}[\],:.;]/.test(n)?t.push({t:n,cls:"text-fg-4"}):t.push({t:n,cls:""})}return ki.jsx(ki.Fragment,{children:t.map((e,t)=>ki.jsx(gi.Fragment,{children:ki.jsx("span",{className:e.cls,children:e.t})},t))})}function Aj({src:e,file:t,focusLine:i,focusSeq:s}){const r=e.split("\n"),n=gi.useRef(null);return gi.useEffect(()=>{var e,t;null!=i&&(null==(t=null==(e=n.current)?void 0:e.scrollIntoView)||t.call(e,{block:"center"}))},[i,s]),ki.jsxs("div",{className:"flex h-full flex-col",children:[ki.jsxs("div",{className:"flex h-8 shrink-0 items-center gap-2 border-b border-edge bg-panel px-3",children:[ki.jsx(gx,{name:"file",className:"h-3.5 w-3.5 text-fg-4"}),ki.jsx("span",{className:"font-mono text-[11.5px] text-fg-3",children:t}),ki.jsx("span",{className:"font-mono text-[10.5px] text-fg-4",children:"· read-only"}),ki.jsx("div",{className:"ml-auto flex items-center gap-1",children:ki.jsx("button",{type:"button",className:"grid h-6 w-6 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fg-2",title:"Copy",onClick:()=>{var t;null==(t=navigator.clipboard)||t.writeText(e)},children:ki.jsx(gx,{name:"copy",className:"h-3.5 w-3.5"})})})]}),ki.jsx("div",{className:"flex-1 overflow-auto bg-canvas",children:ki.jsx("pre",{className:"grid grid-cols-[auto_1fr] font-mono text-[12.5px] leading-[1.55]",children:r.map((e,t)=>{const s=i===t+1;return ki.jsxs(gi.Fragment,{children:[ki.jsx("span",{className:"select-none border-r border-edge-soft px-3 text-right tabular-nums "+(s?"bg-accent/15 text-fg-2":"text-fg-4"),children:t+1}),ki.jsx("span",{ref:s?n:void 0,className:"px-3 "+(s?"bg-accent/10":""),children:e?Rj(e):" "})]},t)})})})]})}const Tj=gi.lazy(()=>Dj(()=>import("./DslEditor-CvL23vIm.js"),__vite__mapDeps([0,1])).then(e=>({default:e.DslEditor}))),zj=__(function({path:e}){const t=w_(),i=t.helpers.items.find(t=>t.path===e),[s,r]=gi.useState("view");gi.useEffect(()=>{i&&t.source.getOrLoad(i.path)},[t,i]);const n=t.editorBridge.pendingReveal(e),[o,a]=gi.useState(null);if(gi.useEffect(()=>{n&&(a(n),t.editorBridge.consumeReveal(e,n.seq))},[n,t,e]),!i)return ki.jsx(rj,{id:e});const l=t.source.get(i.path),c=l?l.split("\n").length:0;return ki.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[ki.jsxs("header",{className:"flex shrink-0 items-start gap-4 border-b border-edge px-4 py-3",children:[ki.jsxs("div",{className:"min-w-0 flex-1",children:[ki.jsxs("div",{className:"flex items-center gap-2",children:[ki.jsx(gx,{name:"braces",className:"h-4 w-4 text-fg-3"}),ki.jsxs("h1",{className:"truncate font-mono text-[15px] font-medium text-fg",children:[i.name,".js"]}),ki.jsx(oj,{tone:"neutral",children:"helper"})]}),ki.jsxs("div",{className:"mt-1 flex items-center gap-3 font-mono text-[11.5px] text-fg-2",children:[ki.jsx("span",{className:"truncate",children:i.path}),c>0&&ki.jsxs(ki.Fragment,{children:[ki.jsx("span",{className:"text-fg-4",children:"·"}),ki.jsxs("span",{children:[c," lines"]})]})]})]}),ki.jsx(Pj,{value:s,onChange:r,options:[{value:"view",label:"View"},{value:"edit",label:"Edit"}]})]}),ki.jsx("div",{className:"min-h-0 flex-1",children:"edit"===s?ki.jsx(gi.Suspense,{fallback:ki.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading editor…"}),children:ki.jsx(Tj,{path:i.path,fileKind:"helper",highlightLine:null==o?void 0:o.line})}):void 0!==l?ki.jsx(Aj,{src:l,file:i.path,focusLine:null==o?void 0:o.line,focusSeq:null==o?void 0:o.seq}):ki.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading source…"})})]})}),Oj=36e5,Ij=24*Oj,Fj={fresh:46,today:30,week:19,stale:11};function Hj(e,t){if(null===e)return"fresh";const i=t-e;return i<Oj?"fresh":i<Ij?"today":i<7*Ij?"week":"stale"}class Wj{constructor(e){this.rest=e,this.records=[],this.editing=null,this.readOnly=!1,this.driftedFromPush=!1,this.loadError=null,Wn(this,{},{autoBind:!0})}async load(){try{this.apply(await this.rest.schedules())}catch(e){hn(()=>{this.loadError=e instanceof Error?e.message:String(e)})}}get(e,t){const i=this.records.find(i=>i.target.kind===e&&i.target.name===t);return i?{cron:i.cron,env:i.env}:null}sourceOf(e,t){const i=this.records.find(i=>i.target.kind===e&&i.target.name===t);return i?i.source:null}get list(){return this.records}openEditor(e){this.editing=e}closeEditor(){this.editing=null}async save(e){if(!this.editing)return null;const t=this.editing,i=this.fileRecords().filter(e=>!Kj(e.target,t)).concat([{target:t,cron:e.cron.trim(),env:e.env,source:"file"}]);return this.replace(i)}async remove(){if(!this.editing)return null;const e=this.editing;return this.replace(this.fileRecords().filter(t=>!Kj(t.target,e)))}fileRecords(){return this.records.filter(e=>"file"===e.source)}async replace(e){try{const t=await this.rest.putSchedules(e.map($j));return hn(()=>{this.apply(t),this.editing=null}),null}catch(t){return t instanceof Error?t.message:String(t)}}apply(e){hn(()=>{this.records=e.schedules.map(Uj),this.readOnly=e.readOnly,this.driftedFromPush=e.driftedFromPush,this.loadError=null})}}function Kj(e,t){return e.kind===t.kind&&e.name===t.name}function Uj(e){return{target:bb(e),cron:e.cron,env:e.env??null,source:e.source??"file"}}function $j(e){const t={cron:e.cron,...null!==e.env?{env:e.env}:{}};return"collection"===e.target.kind?{collection:e.target.name,...t}:{scenario:e.target.name,...t}}function qj(e){const t=Cb(e.cron);return e.env?`${t} · ${e.env}`:t}const Vj=__(function(){const e=w_(),[t,i]=gi.useState("all"),[s,r]=gi.useState("runs"),[n,o]=gi.useState({w:0,h:0}),[a,l]=gi.useState(null),[c,h]=gi.useState(()=>Date.now());gi.useEffect(()=>{const e=setInterval(()=>h(Date.now()),6e4);return()=>clearInterval(e)},[]),gi.useLayoutEffect(()=>{if(!a)return;const e=new ResizeObserver(()=>{o({w:a.clientWidth,h:a.clientHeight})});return e.observe(a),()=>e.disconnect()},[a]);const u=e.overview.counts,d=e.overview.indexReady,f=e.overview.rows,p=function(e,t){const i=new Map;for(const s of e){if("collection"!==s.target.kind)continue;const e=t.find(e=>e.name===s.target.name);for(const t of(null==e?void 0:e.scenarios)??[])i.set(t,{cron:s.cron,env:s.env,via:s.target.name})}for(const s of e)"scenario"===s.target.kind&&i.set(s.target.name,{cron:s.cron,env:s.env,via:null});return i}(e.schedules.list,e.collections.items),g=f.filter(e=>"all"===t||("scheduled"===t?p.has(e.ref):"unscheduled"===t?!p.has(e.ref):e.status===t)),v=function(e,t,i){let s={cols:1,size:0};for(let r=1;r<=e;r++){const n=Math.ceil(e/r),o=Math.min((t-tN*(r-1))/r,(i-tN*(n-1))/n);o>s.size&&(s={cols:r,size:o})}return{cols:s.cols,size:Math.min(s.size,rN)}}(f.length,n.w-2*iN,n.h-2*iN),m=Math.max(v.size,sN),_=n.w>0,b=Math.max(1,Math.min(v.cols,g.length)),x=v.cols*m+(v.cols-1)*tN,y={width:_?Math.max(x,Math.min(nN,n.w)):void 0};if(0===u.all)return ki.jsx(Jj,{});const w=f.filter(e=>p.has(e.ref)).length,S="runs"===s?function(e){const t=[{filter:"all",label:"scenarios",name:"Show all tests",value:e.all,dot:null},{filter:"passed",label:"passed",name:"Show passing tests",value:e.passed,dot:"passed"},{filter:"failed",label:"failed",name:"Show failing tests",value:e.failed,dot:"failed"}];e.expected>0&&t.push({filter:"expected",label:"expected",name:"Show tests that failed on purpose",value:e.expected,dot:"expected"});return t.push({filter:"never",label:"never run",name:"Show tests that never ran",value:e.never,dot:"never"}),t}(u):[{filter:"all",label:"scenarios",name:"Show all tests",value:k=u.all,dot:null},{filter:"scheduled",label:"scheduled",name:"Show tests that run on a schedule",value:C=w,dot:null,icon:"clock"},{filter:"unscheduled",label:"no schedule",name:"Show tests no schedule covers",value:k-C,dot:null}];var k,C;return ki.jsxs("div",{className:"flex h-full flex-col overflow-hidden px-6 py-6",children:[ki.jsxs("div",{className:"mx-auto w-full shrink-0",style:y,children:[ki.jsxs("div",{className:"mb-1.5 flex items-center gap-2",children:[ki.jsx(gx,{name:"activity",className:"h-4 w-4 text-fg-4"}),ki.jsx("span",{className:"font-mono text-[11px] uppercase tracking-wider text-fg-4",children:"overview"}),ki.jsx("div",{className:"ml-auto",children:ki.jsx(Pj,{value:s,onChange:e=>{r(e),i("all")},options:[{value:"runs",label:"last run",icon:"activity"},{value:"schedule",label:"schedule",icon:"clock"}]})})]}),ki.jsx("h1",{className:"mb-5 font-mono text-[18px] font-medium tracking-tight text-fg-2",children:"runs"===s?Zj(u.failed,d):Yj(w,u.all)}),ki.jsx("div",{className:"grid gap-px overflow-hidden rounded border border-edge-soft bg-edge-soft",style:{gridTemplateColumns:`repeat(${S.length}, minmax(0, 1fr))`},children:S.map(e=>ki.jsx(wN,{label:e.label,name:e.name,value:e.value,dot:e.dot,icon:e.icon,active:t===e.filter,onClick:()=>i(e.filter)},e.filter))}),"schedule"===s&&ki.jsxs("div",{className:"mt-2 flex items-center gap-1.5 font-mono text-[10.5px] text-fg-4",children:[ki.jsx(gx,{name:"package",className:"h-3 w-3"}),e.schedules.readOnly?"declared in the repo — this box runs whatever the deployed bundle declares; edit there and push":"declared here — a box runs what you push"]}),"schedule"===s&&e.schedules.driftedFromPush&&ki.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 font-mono text-[10.5px] text-warn",children:[ki.jsx(gx,{name:"alert",className:"h-3 w-3"}),"this set differs from the one recorded at push — the project's config likely computes schedules from this environment"]}),"schedule"===s&&e.schedules.list.length>0&&ki.jsx(eN,{records:e.schedules.list,collections:e.collections.items,now:c})]}),ki.jsx(lN,{tiles:g,attach:l,field:a,cols:b,size:m,ready:_,now:c,mode:s,schedules:p}),ki.jsx("div",{className:"mx-auto mt-3 flex w-full shrink-0 items-center gap-4 font-mono text-[10.5px] text-fg-4",style:y,children:"runs"===s?ki.jsxs(ki.Fragment,{children:[ki.jsxs("span",{className:"flex items-center gap-1.5",children:[ki.jsx(cj,{status:"passed",pulse:!1})," passed"]}),ki.jsxs("span",{className:"flex items-center gap-1.5",children:[ki.jsx(cj,{status:"failed",pulse:!1})," failed"]}),u.expected>0&&ki.jsxs("span",{className:"flex items-center gap-1.5",children:[ki.jsx(cj,{status:"expected",pulse:!1})," failed on purpose"]}),ki.jsxs("span",{className:"flex items-center gap-1.5",children:[ki.jsx(cj,{status:"never",pulse:!1})," never run"]}),f.some(e=>e.live)&&ki.jsxs("span",{className:"flex items-center gap-1.5",children:[ki.jsx("span",{className:"uno-tile-live h-2 w-2 rounded-[2px] bg-warn/40"}),"running now"]}),ki.jsx(Gj,{}),ki.jsx("span",{className:"ml-auto",children:d?"hover for history · click to open the test":"reading run history…"})]}):ki.jsxs(ki.Fragment,{children:[ki.jsx(Xj,{}),ki.jsx("span",{className:"ml-auto",children:"hover for the schedule · click to open the test"})]})})]})});function Yj(e,t){return 0===e?"Nothing runs on a schedule.":`${e} of ${t} ${1===t?"test runs":"tests run"} on a schedule.`}function Gj(){return ki.jsxs("span",{className:"flex items-center gap-1.5","aria-label":"Colour fades as a result ages",children:[ki.jsx("span",{className:"flex items-center gap-[2px]",children:["fresh","today","week","stale"].map(e=>ki.jsx("span",{className:"h-2 w-2 rounded-[1px]",style:{background:`color-mix(in srgb, var(--u-fg-3) ${Fj[e]}%, transparent)`}},e))}),"just ran → older"]})}function Xj(){return ki.jsxs(ki.Fragment,{children:[ki.jsxs("span",{className:"flex items-center gap-1.5","aria-label":"Brighter means the test runs more often",children:[ki.jsx("span",{className:"flex items-center gap-[2px]",children:[95,65,38,22].map(e=>ki.jsx("span",{className:"h-2 w-2 rounded-[1px]",style:{background:`color-mix(in srgb, var(--u-accent) ${e}%, transparent)`}},e))}),"often → rare"]}),ki.jsxs("span",{className:"flex items-center gap-1.5",children:[ki.jsx("span",{className:"h-2 w-2 rounded-[1px]",style:{background:`color-mix(in srgb, var(--u-fg-4) ${uN}%, transparent)`}}),"no schedule"]})]})}function Zj(e,t){return t?0===e?"Everything is green.":`${e} ${1===e?"test is":"tests are"} failing.`:"Reading run history…"}function Jj(){return ki.jsx("div",{className:"grid h-full place-items-center px-6 py-10",children:ki.jsxs("div",{className:"w-full max-w-[520px]",children:[ki.jsxs("div",{className:"mb-6 flex items-center gap-2",children:[ki.jsx(gx,{name:"inspect",className:"h-4 w-4 text-fg-4"}),ki.jsx("span",{className:"font-mono text-[11px] uppercase tracking-wider text-fg-4",children:"workspace"})]}),ki.jsx("h1",{className:"font-mono text-[18px] font-medium tracking-tight text-fg-2",children:"No scenarios yet."}),ki.jsx("p",{className:"mt-2 text-[13px] leading-relaxed text-fg-4",children:"Add one under the scenarios tree on the left, or record it from the command line. Every test you add shows up here as a tile."}),ki.jsxs("div",{className:"mt-8 rounded border border-edge-soft bg-raised/50 p-3",children:[ki.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-fg-4",children:[ki.jsx(gx,{name:"terminal",className:"h-3.5 w-3.5"}),ki.jsx("span",{children:"Run from CLI:"})]}),ki.jsxs("pre",{className:"mt-2 overflow-x-auto rounded bg-canvas p-2.5 font-mono text-[12px] text-fg-2",children:[ki.jsx("span",{className:"text-fg-4",children:"$ "}),ki.jsx("span",{className:"text-accent",children:"npx @unotest/web"})," e2e"," ",ki.jsx("span",{className:"text-fg-2",children:"<scenario>"})]})]})]})})}function Qj(e,t){const i=kb(e);return i?Bb(Nb(i,t),t):"—"}function eN({records:e,collections:t,now:i}){const s=e.map(e=>{const t=kb(e.cron);return{rec:e,tick:t?Nb(t,i):null}}).sort((e,t)=>(e.tick??1/0)-(t.tick??1/0));return ki.jsxs("div",{className:"mt-2 rounded border border-edge-soft bg-raised/40 px-3 py-2",children:[ki.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-wider text-fg-4",children:[ki.jsx(gx,{name:"clock",className:"h-3 w-3"}),"upcoming ",ki.jsx("span",{className:"normal-case tracking-normal",children:"· your clock"})]}),ki.jsx("div",{className:"mt-1.5 flex flex-col gap-1",children:s.map(({rec:e,tick:s})=>{var r;const n="collection"===e.target.kind?(null==(r=t.find(t=>t.name===e.target.name))?void 0:r.scenarios.length)??0:null;return ki.jsxs("div",{className:"flex items-baseline gap-2 font-mono text-[11px]",children:[ki.jsx("span",{className:"shrink-0 tabular-nums text-fg-2",children:null===s?"—":Bb(s,i)}),ki.jsx("span",{className:"truncate text-fg-2",children:e.target.name}),ki.jsxs("span",{className:"truncate text-fg-4",children:["collection"===e.target.kind?"collection":"test"," ·"," ",qj(e),null!==n&&ki.jsxs(ki.Fragment,{children:[" → ",n," tests"]})]})]},`${e.target.kind}:${e.target.name}`)})})]})}const tN=8,iN=3,sN=26,rN=104,nN=560,oN=250,aN=120;function lN({tiles:e,attach:t,field:i,cols:s,size:r,ready:n,now:o,mode:a,schedules:l}){const[c,h]=gi.useState(null),u=w_(),d=(e,t)=>{const s=e.currentTarget;if(!i)return;const r=oN/2,n=s.offsetLeft+s.offsetWidth/2,o=Math.max(r,i.clientWidth-r),a=s.offsetTop+s.offsetHeight,l=i.clientHeight-a<aN;h({row:t,x:Math.min(Math.max(n,r),o),y:l?i.clientHeight-s.offsetTop+tN:a+tN,above:l})};return ki.jsxs("div",{ref:t,className:"relative mt-5 min-h-0 flex-1 overflow-y-auto",onMouseLeave:()=>h(null),children:[0===e.length?ki.jsx("div",{className:"grid h-full place-items-center font-mono text-[11.5px] text-fg-4",children:"nothing matches"}):ki.jsx("div",{className:"grid justify-center",style:{gridTemplateColumns:`repeat(${s}, ${r}px)`,gap:tN,padding:iN,visibility:n?"visible":"hidden"},children:e.map(e=>{const t=l.get(e.ref)??null;return ki.jsx("button",{type:"button","aria-label":"schedule"===a?`${e.ref} — ${t?qj(t):"no schedule"}`:e.live?`${e.ref} — ${e.status}, ${"paused"===e.live?"paused":"running now"}`:`${e.ref} — ${e.status}, ${uj(e.lastAt)}`,"data-age":Hj(e.lastAt,o),onMouseEnter:t=>d(t,e),onFocus:t=>d(t,e),onClick:()=>u.tabs.openScenario(e.path),style:{height:r,..."schedule"===a?vN(t,(null==c?void 0:c.row.ref)===e.ref):fN(e.status,Hj(e.lastAt,o),(null==c?void 0:c.row.ref)===e.ref)},className:fx("rounded-md border transition-colors focus:outline-none","runs"===a&&"running"===e.live&&"uno-tile-live","runs"===a&&"paused"===e.live&&"uno-tile-still",(null==c?void 0:c.row.ref)===e.ref&&"ring-2 ring-accent")},e.ref)})}),c&&ki.jsx(bN,{hover:c,mode:a,now:o,schedule:l.get(c.row.ref)??null})]})}const cN={passed:"--u-pass",failed:"--u-fail",expected:"--u-expected",running:"--u-warn",paused:"--u-warn",aborted:"--u-fg-4",pending:"--u-fg-4",never:"--u-fg-4"},hN=new Set(["never","pending","aborted"]),uN=12,dN=14;function fN(e,t,i){const s=hN.has(e)?uN:Fj[t];return mN(cN[e],s,i)}const pN={m5:95,m15:85,h1:75,h2:65,h4:55,h6:45,h12:38,daily:30,weekly:22},gN=50;function vN(e,t){if(!e)return mN("--u-fg-4",uN,t);const i=kb(e.cron);return mN("--u-accent",i?pN[i.freq]:gN,t)}function mN(e,t,i){const s=Math.min(t+(i?dN:0),100);return{background:`color-mix(in srgb, var(${e}) ${s}%, transparent)`,borderColor:`color-mix(in srgb, var(${e}) ${Math.min(Math.round(1.7*s),75)}%, transparent)`}}function _N({recent:e,expectFail:t}){const i=e=>{const i=Z_(e);return i||"passed"===e?i===t?t?"bg-expected":"bg-pass":"bg-fail":"bg-fg-4/30"};return ki.jsx("span",{className:"flex h-3.5 items-end gap-[3px]",children:e.map((e,t)=>ki.jsx("span",{className:fx("h-full w-[5px] shrink-0 rounded-[1px]",i(e))},t))})}function bN({hover:e,mode:t,now:i,schedule:s}){const{row:r}=e,n=r.ref.lastIndexOf("/"),o=-1===n?"":r.ref.slice(0,n+1),a=-1===n?r.ref:r.ref.slice(n+1),l="passed"===r.status&&r.recent.some(Z_),c=r.expectFail&&"failed"===r.status;return ki.jsxs("div",{className:"pointer-events-none absolute z-20 -translate-x-1/2 rounded-md border border-edge-soft bg-overlay px-2.5 py-2 shadow-md",style:{left:e.x,width:oN,...e.above?{bottom:e.y}:{top:e.y}},children:[ki.jsxs("div",{className:"flex items-center gap-1.5",children:["schedule"===t?ki.jsx(gx,{name:"clock",className:"h-3 w-3 shrink-0 text-fg-4"}):ki.jsx(cj,{status:r.status,pulse:!1}),ki.jsxs("span",{className:"truncate font-mono text-[11.5px] text-fg",children:[ki.jsx("span",{className:"text-fg-4",children:o}),a]})]}),"schedule"===t?ki.jsx(xN,{schedule:s,now:i}):ki.jsx(yN,{r:r,flaky:l,unexpectedPass:c,schedule:s,now:i})]})}function xN({schedule:e,now:t}){return e?ki.jsxs(ki.Fragment,{children:[ki.jsx("div",{className:"mt-1 font-mono text-[10px] text-fg-2",children:qj(e)}),ki.jsxs("div",{className:"mt-0.5 font-mono text-[10px] text-fg-4",children:[e.via&&ki.jsxs(ki.Fragment,{children:["via ",e.via," · "]}),"next ",Qj(e.cron,t)," · your clock"]})]}):ki.jsx("div",{className:"mt-1 font-mono text-[10px] text-fg-4",children:"no schedule — right-click the test to add one"})}function yN({r:e,flaky:t,unexpectedPass:i,schedule:s,now:r}){return ki.jsxs(ki.Fragment,{children:[ki.jsxs("div",{className:"mt-1 flex items-center gap-1.5 font-mono text-[10px] text-fg-4",children:[e.live?ki.jsx("span",{className:"text-warn",children:"paused"===e.live?"paused":"running now"}):ki.jsxs(ki.Fragment,{children:[ki.jsx("span",{children:null===e.lastAt?"never run":uj(e.lastAt)}),ki.jsx("span",{children:"·"}),ki.jsx("span",{children:hj(e.durationMs)})]}),e.failStreak>0&&"expected"!==e.status&&ki.jsxs("span",{className:"text-fail",children:["· red ",e.failStreak," ",1===e.failStreak?"run":"runs"]}),t&&ki.jsx("span",{className:"text-warn",children:"· flaky"})]}),s&&ki.jsxs("div",{className:"mt-1 flex items-center gap-1 font-mono text-[10px] text-fg-4",children:[ki.jsx(gx,{name:"clock",className:"h-2.5 w-2.5"}),ki.jsxs("span",{className:"truncate",children:[qj(s),s.via&&ki.jsxs(ki.Fragment,{children:[" · via ",s.via]}),` · next ${Qj(s.cron,r)}`]})]}),"expected"===e.status&&ki.jsx("div",{className:"mt-1 font-mono text-[10px] text-expected",children:"expected to fail · @expect-fail"}),i&&ki.jsx("div",{className:"mt-1 font-mono text-[10px] text-fail",children:"passed, but it is marked @expect-fail"}),e.recent.length>0&&ki.jsxs("div",{className:"mt-2 border-t border-edge-soft pt-2",children:[ki.jsx(_N,{recent:e.recent,expectFail:e.expectFail}),ki.jsxs("div",{className:"mt-1 font-mono text-[9.5px] text-fg-4",children:["last ",e.recent.length," runs · newest right"]})]})]})}function wN({label:e,name:t,value:i,dot:s,icon:r,active:n,onClick:o}){return ki.jsxs("button",{type:"button",onClick:o,"aria-label":t,"aria-pressed":n,className:fx("px-4 py-3 text-left",n?"bg-selection/40":"bg-canvas hover:bg-raised/50"),children:[ki.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:[s&&ki.jsx(cj,{status:s,pulse:!1}),r&&ki.jsx(gx,{name:r,className:"h-3 w-3"}),ki.jsx("span",{children:e})]}),ki.jsx("div",{className:"mt-1 font-mono text-[22px] font-medium tabular-nums text-fg-2",children:i})]})}function SN(e){const t=[],i=e=>{for(const s of e)"step"===s.kind?t.push(s):"control"===s.kind?(t.push(s),i(s.children),s.elseChildren&&i(s.elseChildren)):i(s.children)};return i(e),t}function kN({status:e}){return"passed"===e?ki.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full bg-pass/10 text-pass",children:ki.jsx(gx,{name:"check",className:"h-3 w-3",strokeWidth:2.5})}):"failed"===e?ki.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full bg-fail/10 text-fail",children:ki.jsx(gx,{name:"x",className:"h-3 w-3",strokeWidth:2.5})}):"running"===e?ki.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full bg-warn/10 text-warn",children:ki.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current uno-pulse"})}):"aborted"===e?ki.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full bg-fg-4/10 text-fg-4",children:ki.jsx(gx,{name:"square",className:"h-3 w-3",strokeWidth:2.5})}):"paused"===e?ki.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full bg-warn/10 text-warn",children:ki.jsx(gx,{name:"pause",className:"h-2.5 w-2.5",strokeWidth:2.5})}):ki.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center text-fg-4",children:ki.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current"})})}const CN=22;function jN(e){return ki.jsxs("div",{className:"min-h-full bg-canvas py-1",children:[ki.jsxs("div",{className:"flex items-center gap-3 py-1.5 pr-4 font-mono text-[10.5px] uppercase tracking-wider text-fg-4",style:{paddingLeft:34},children:[ki.jsx("span",{className:"w-6 text-right",children:"#"}),ki.jsx("span",{className:"w-4"}),ki.jsx("span",{className:"flex-1",children:"step"}),ki.jsx("span",{className:"w-12 text-right",children:"time"})]}),ki.jsx("div",{className:"border-t border-edge-soft",children:e.body.map((t,i)=>ki.jsx(NN,{node:t,depth:0,trace:e.trace,failedIndex:e.failedIndex,pausedIndex:e.pausedIndex,onFailedStepRender:e.onFailedStepRender,bpKeys:e.bpKeys,onToggleBp:e.onToggleBp,screenshots:e.screenshots,onOpenScreenshot:e.onOpenScreenshot,activeScreenshotIndex:e.activeScreenshotIndex},i))})]})}function NN(e){var t,i;if("step"===e.node.kind){const s=e.node,r=null==(t=e.trace)?void 0:t[s.index];return ki.jsxs(ki.Fragment,{children:[ki.jsx(DN,{step:s,depth:e.depth,status:(null==r?void 0:r.status)??(e.trace?"pending":void 0),durationMs:(null==r?void 0:r.durationMs)??null,isFailed:e.failedIndex===s.index,isPaused:e.pausedIndex===s.index,bpKeys:e.bpKeys,onToggleBp:e.onToggleBp,screenshotUrl:null==(i=e.screenshots)?void 0:i.get(s.index),onOpenScreenshot:e.onOpenScreenshot,isScreenshotActive:e.activeScreenshotIndex===s.index}),e.failedIndex===s.index&&e.onFailedStepRender&&e.onFailedStepRender(s)]})}return"control"===e.node.kind?ki.jsx(MN,{...e,node:e.node}):ki.jsx(EN,{block:e.node,depth:e.depth,trace:e.trace,failedIndex:e.failedIndex,pausedIndex:e.pausedIndex,onFailedStepRender:e.onFailedStepRender,bpKeys:e.bpKeys,onToggleBp:e.onToggleBp,screenshots:e.screenshots,onOpenScreenshot:e.onOpenScreenshot,activeScreenshotIndex:e.activeScreenshotIndex})}function MN({node:e,depth:t,trace:i,failedIndex:s,pausedIndex:r,onFailedStepRender:n,bpKeys:o,onToggleBp:a,screenshots:l,onOpenScreenshot:c,activeScreenshotIndex:h}){const u=null==i?void 0:i[e.index],d=e=>e.map((e,u)=>ki.jsx(NN,{node:e,depth:t+1,trace:i,failedIndex:s,pausedIndex:r,onFailedStepRender:n,bpKeys:o,onToggleBp:a,screenshots:l,onOpenScreenshot:c,activeScreenshotIndex:h},u));return ki.jsxs(ki.Fragment,{children:[ki.jsx(DN,{step:e,depth:t,status:(null==u?void 0:u.status)??(i?"pending":void 0),durationMs:(null==u?void 0:u.durationMs)??null,isFailed:s===e.index,isPaused:r===e.index,bpKeys:o,onToggleBp:a,screenshotUrl:null==l?void 0:l.get(e.index),onOpenScreenshot:c,isScreenshotActive:h===e.index}),s===e.index&&n&&n(e),d(e.children),e.elseChildren&&ki.jsxs(ki.Fragment,{children:[ki.jsx(BN,{depth:t}),d(e.elseChildren)]})]})}function BN({depth:e}){return ki.jsx("div",{className:"flex items-center py-1 font-mono text-[11px] italic text-fg-4",style:{paddingLeft:34+14*e},children:"else"})}function EN({block:e,depth:t,trace:i,failedIndex:s,pausedIndex:r,onFailedStepRender:n,bpKeys:o,onToggleBp:a,screenshots:l,onOpenScreenshot:c,activeScreenshotIndex:h}){const u=function(e,t){var i;if(!t)return"never";let s=!1,r=!1,n=!1,o=!1,a=!1;for(const l of SN(e)){const e=(null==(i=t[l.index])?void 0:i.status)??"pending";"failed"===e?s=!0:"running"===e?r=!0:"passed"===e?n=!0:"aborted"===e?a=!0:o=!0}return s?"failed":r?"running":a?"aborted":o&&n?"running":o?"pending":"passed"}(e.children,i),d=function(e,t){var i;if(!t)return null;let s=0,r=!1;for(const n of SN(e)){const e=null==(i=t[n.index])?void 0:i.durationMs;null!=e&&(s+=e,r=!0)}return r?s:null}(e.children,i),f=!!i&&("failed"===u||"running"===u||"paused"===u),[p,g]=gi.useState(f),v=34+14*t;return ki.jsxs(ki.Fragment,{children:[ki.jsxs("button",{type:"button",onClick:()=>g(e=>!e),className:fx("group relative flex w-full items-center gap-3 py-1.5 pr-4 text-left font-mono text-[12.5px] leading-[1.4]","failed"===u&&"bg-fail/5",("running"===u||"paused"===u)&&"bg-warn/5","failed"!==u&&"running"!==u&&"paused"!==u&&"hover:bg-raised/60"),style:{paddingLeft:v},children:[ki.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 left-0 border-r border-edge-soft",style:{width:CN}}),ki.jsx(LN,{depth:t,offset:CN}),ki.jsx(gx,{name:p?"chevronD":"chevronR",className:"h-3.5 w-3.5 shrink-0 text-fg-4",strokeWidth:2}),ki.jsx("span",{className:"w-4 shrink-0",children:i?ki.jsx(kN,{status:u}):ki.jsx("span",{className:"block h-1.5 w-1.5 rounded-full bg-fg-4"})}),ki.jsx("span",{className:"flex-1 truncate text-fg",children:e.title}),ki.jsx("span",{className:"w-12 shrink-0 text-right text-[11px] tabular-nums text-fg-2",children:hj(d)})]}),p&&e.children.map((e,u)=>ki.jsx(NN,{node:e,depth:t+1,trace:i,failedIndex:s,pausedIndex:r,onFailedStepRender:n,bpKeys:o,onToggleBp:a,screenshots:l,onOpenScreenshot:c,activeScreenshotIndex:h},u))]})}function DN({step:e,depth:t,status:i,durationMs:s,isFailed:r,isPaused:n,bpKeys:o,onToggleBp:a,screenshotUrl:l,onOpenScreenshot:c,isScreenshotActive:h}){const u="running"===i,d=34+14*t,f=`${e.line}:${e.col}`,p=!!(null==o?void 0:o.has(f)),g=!!a,v=gi.useRef(null);gi.useEffect(()=>{var e,t;h&&(null==(t=null==(e=v.current)?void 0:e.scrollIntoView)||t.call(e,{block:"nearest"}))},[h]);const m=!!l&&!!c;return ki.jsx(ki.Fragment,{children:ki.jsxs("div",{ref:v,onClick:m?()=>c(e.index):void 0,className:fx("group relative flex items-center gap-3 py-1.5 pr-4 font-mono text-[12.5px] leading-[1.4]",m&&"cursor-pointer",h&&"bg-accent/10",u&&"bg-warn/10",n&&"bg-warn/15",r&&"bg-fail/10",!u&&!r&&!n&&"hover:bg-raised/60"),style:{paddingLeft:d},children:[ki.jsx(LN,{depth:t,offset:CN}),ki.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 left-0 border-r border-edge-soft",style:{width:CN}}),ki.jsxs("button",{type:"button","aria-label":p?"Remove breakpoint":"Add breakpoint",disabled:!g,onClick:t=>{t.stopPropagation(),g&&a(e.line,e.col)},className:"absolute inset-y-0 left-0 grid place-items-center disabled:cursor-default",style:{width:CN},children:[n&&ki.jsx(gx,{name:"arrowR",className:"absolute h-3 w-3 text-warn"}),p?ki.jsx(gx,{name:"bp",className:fx("h-2.5 w-2.5",n?"text-fail/80":"text-fail")}):g&&!n&&ki.jsx("span",{className:"hidden h-2.5 w-2.5 rounded-full ring-1 ring-fg-4 group-hover:block"})]}),ki.jsx("span",{className:fx("absolute inset-y-0 w-[2px]",n||u?"bg-warn":r?"bg-fail":"bg-transparent"),style:{left:CN}}),ki.jsxs("span",{className:"w-6 shrink-0 text-right text-[10.5px] tabular-nums text-fg-4",children:["#",e.index]}),ki.jsx("span",{className:"w-4 shrink-0",children:i?ki.jsx(kN,{status:i}):ki.jsx("span",{className:"block h-1.5 w-1.5 rounded-full bg-fg-4"})}),ki.jsxs("span",{className:"flex min-w-0 flex-1 items-baseline gap-2 overflow-hidden",children:[ki.jsx("span",{className:"truncate",children:Rj(e.source)}),ki.jsxs("span",{className:"hidden shrink-0 text-[10.5px] tabular-nums text-fg-4 md:inline",children:["L",e.line]})]}),l&&ki.jsx(gx,{name:"camera",className:fx("h-3.5 w-3.5 shrink-0",h?"text-accent":"text-fg-4 group-hover:text-fg-2")}),ki.jsx("span",{className:"w-12 shrink-0 text-right text-[11px] tabular-nums text-fg-2",children:hj(s)})]})})}function LN({depth:e,offset:t=0}){return 0===e?null:ki.jsx(ki.Fragment,{children:Array.from({length:e}).map((e,i)=>ki.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 w-px bg-edge-soft",style:{left:t+18+14*i}},i))})}function PN({strip:e,position:t,onNavigate:i,onClose:s}){const r=e[t],n=t>0,o=t<e.length-1;return gi.useEffect(()=>{const e=e=>{if("Escape"===e.key)s();else if("ArrowLeft"===e.key&&n)i(t-1);else{if("ArrowRight"!==e.key||!o)return;i(t+1)}e.preventDefault()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[s,i,t,n,o]),r?ki.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Step screenshot",className:"fixed inset-0 z-50 flex flex-col bg-black/30 backdrop-blur-[3px]",onMouseDown:s,children:[ki.jsxs("div",{className:"flex shrink-0 items-center justify-between px-4 py-3",children:[ki.jsxs("span",{className:"rounded-full bg-black/60 px-2.5 py-1 font-mono text-[11.5px] tabular-nums text-white/80",children:[t+1," / ",e.length]}),ki.jsx("button",{type:"button","aria-label":"Close",onMouseDown:e=>e.stopPropagation(),onClick:s,className:"grid h-8 w-8 place-items-center rounded-full bg-black/60 text-white/80 hover:bg-black/80 hover:text-white",children:ki.jsx(gx,{name:"x",className:"h-4 w-4"})})]}),ki.jsxs("div",{className:"flex min-h-0 flex-1 items-center gap-3 px-3 sm:gap-5 sm:px-5",children:[ki.jsx(RN,{direction:"prev",disabled:!n,onClick:()=>i(t-1)}),ki.jsxs("figure",{className:"flex min-h-0 flex-1 flex-col items-center gap-4",onMouseDown:e=>e.stopPropagation(),children:[ki.jsx("img",{src:r.url,alt:`step #${r.stepIndex} screenshot`,className:"min-h-0 max-w-full flex-1 rounded-lg object-contain shadow-2xl ring-1 ring-white/25"}),ki.jsxs("figcaption",{className:"w-full max-w-3xl shrink-0 rounded-lg bg-black/65 px-4 py-2 text-center",children:[r.blockTitle&&ki.jsx("div",{className:"truncate text-[13px] font-medium text-white",children:r.blockTitle}),ki.jsxs("div",{className:"mt-1 flex items-baseline justify-center gap-2 font-mono text-[12px] text-white/80",children:[ki.jsx("span",{className:"truncate",children:r.source}),ki.jsxs("span",{className:"shrink-0 text-[10.5px] tabular-nums text-white/55",children:["L",r.line]})]})]})]}),ki.jsx(RN,{direction:"next",disabled:!o,onClick:()=>i(t+1)})]}),ki.jsx("div",{className:"shrink-0 pb-4 pt-3 text-center",children:ki.jsx("span",{className:"rounded-full bg-black/60 px-3 py-1 font-mono text-[10.5px] uppercase tracking-wider text-white/70",children:"← → to move · esc to close"})})]}):null}function RN({direction:e,disabled:t,onClick:i}){return ki.jsx("button",{type:"button","aria-label":"prev"===e?"Previous screenshot":"Next screenshot",disabled:t,onMouseDown:e=>e.stopPropagation(),onClick:i,className:fx("grid h-11 w-11 shrink-0 place-items-center rounded-full transition",t?"cursor-default bg-black/25 text-white/30":"bg-black/60 text-white/90 hover:bg-black/85 hover:text-white"),children:ki.jsx(gx,{name:"chevronR",className:fx("h-5 w-5","prev"===e&&"rotate-180"),strokeWidth:2})})}async function AN(e){var t;try{if(null==(t=navigator.clipboard)?void 0:t.writeText)return await navigator.clipboard.writeText(e),!0}catch{}return function(e){const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.opacity="0",document.body.appendChild(t);const i=document.getSelection(),s=i&&i.rangeCount>0?i.getRangeAt(0):null;t.select();let r=!1;try{r=document.execCommand("copy")}catch{r=!1}document.body.removeChild(t),s&&i&&(i.removeAllRanges(),i.addRange(s));return r}(e)}function TN(e){const[t,i]=gi.useState("idle"),s=gi.useRef(void 0);gi.useEffect(()=>()=>clearTimeout(s.current),[]);return ki.jsxs("div",{className:"mx-4 my-2 overflow-hidden rounded border border-fail/30 bg-fail/10",children:[ki.jsxs("div",{className:"border-b border-fail/30 px-3 py-1.5",children:[ki.jsxs("div",{className:"flex items-center gap-2",children:[ki.jsx(gx,{name:"alert",className:"h-3.5 w-3.5 text-fail"}),ki.jsx(oj,{tone:"fail",children:e.errorName.toUpperCase()}),ki.jsxs("span",{className:"ml-auto font-mono text-[10.5px] text-fg-2",children:["step #",e.index]})]}),e.url&&ki.jsxs("button",{type:"button",title:"fail"===t?"Copy failed":"Copy URL",className:"mt-1 flex max-w-full cursor-pointer items-center gap-1.5 truncate font-mono text-[11.5px] font-medium text-fg underline decoration-fail/50 decoration-dotted hover:decoration-fail",onClick:()=>{const t=e.url;t&&AN(t).then(e=>{i(e?"ok":"fail"),clearTimeout(s.current),s.current=setTimeout(()=>i("idle"),1600)})},children:[ki.jsx(gx,{name:"ok"===t?"check":"fail"===t?"alert":"copy",className:"ok"===t?"h-3.5 w-3.5 shrink-0 text-pass":"h-3.5 w-3.5 shrink-0"}),ki.jsx("span",{className:"truncate",children:e.url}),"idle"!==t&&ki.jsx("span",{className:"ok"===t?"shrink-0 text-pass no-underline":"shrink-0 text-fail no-underline",children:"ok"===t?"Copied!":"Copy failed"})]})]}),ki.jsxs("div",{className:"px-3 py-2",children:[ki.jsx("pre",{className:"whitespace-pre-wrap break-words font-mono text-[12px] leading-relaxed text-fg",children:e.message}),ki.jsxs("div",{className:"mt-2 flex items-center gap-2 truncate font-mono text-[11px] text-fg-2",children:[ki.jsx(gx,{name:"file",className:"h-3.5 w-3.5"}),ki.jsxs("span",{children:[e.file,":",e.line]}),ki.jsx("span",{className:"text-fg-4",children:"·"}),ki.jsx("span",{className:"truncate",children:e.source})]})]})]})}function zN(e,t){for(let i=e.length-1;i>=0;i--){const s=e[i];if(s.kind===t)return s}return null}class ON{constructor(e){this.runId=e}url(e){const[t,i]="event"===e.kind?["path",e.path]:["file",e.file];return`/api/runs/${encodeURIComponent(this.runId)}/asset?${t}=${encodeURIComponent(i)}`}resolveUrl(e){return this.url(e)}async loadText(e){return IN(this.url(e))}}async function IN(e){try{const t=await fetch(e);return t.ok?{ok:!0,text:await t.text()}:{ok:!1}}catch{return{ok:!1}}}class FN{constructor(e){this.snapshotId=e}url(e){return`/api/snapshots/${encodeURIComponent(this.snapshotId)}/asset?key=${encodeURIComponent(function(e){const t="event"===e.kind?e.path:e.file;return t.split("/").pop()??t}(e))}`}resolveUrl(e){return this.url(e)}async loadText(e){return IN(this.url(e))}}const HN=gi.createContext(null);function WN(e){const t=gi.useContext(HN);return gi.useMemo(()=>t??new ON(e),[t,e])}function KN({children:e}){return ki.jsx("div",{className:"px-3 py-6 text-center font-mono text-[11.5px] text-fg-4",children:e})}const UN=[{id:"screenshot",label:"Screenshot",icon:"camera"},{id:"dom",label:"Semantic DOM",icon:"tree"}],$N=__(function({runId:e,active:t,events:i,isFailed:s,runFinished:r,varsOverride:n,fill:o=!1}){const a=w_(),l=zN(i,"failure-bundle:written"),c=null!=t&&("paused"===t.status||"running"===t.status||"starting"===t.status);gi.useEffect(()=>{c||n||a.runtimeSnapshots.loadIfNeeded(e)},[a,e,c,n]);const h=a.runtimeSnapshots.get(e),u=n??(c&&t?t.vars:(null==h?void 0:h.vars)??(null==t?void 0:t.vars)??{}),d=Object.keys(u).length>0,f=gi.useMemo(()=>{const e=[];if((null!=t||d)&&e.push({id:"vars",label:"Vars",icon:"variable"}),s?e.push(...UN):(t&&t.callStack.length>0&&e.push({id:"callstack",label:"Call stack",icon:"layers"}),null!=t&&e.push({id:"snapshot",label:"Snapshot",icon:"tree"})),e.push({id:"system",label:"System",icon:"activity"}),e.push({id:"console",label:"Console",icon:"terminal"}),e.push({id:"network",label:"Network",icon:"network"}),e.push({id:"trace",label:"Trace",icon:"code"}),!s&&null!=t){const t=a.breakpoints.all().reduce((e,t)=>e+t.keys.length,0);e.push({id:"breakpoints",label:"Breakpoints",icon:"bp",count:t})}return e},[d,s,t,null==t?void 0:t.callStack,a.breakpoints]),[p,g]=gi.useState(f[0].id);gi.useEffect(()=>{f.some(e=>e.id===p)||g(f[0].id)},[f,p]);const v=a.layout,m=Bx({value:v.inspectorWidth,onChange:v.setInspectorWidth,axis:"x",dir:-1,min:v.inspectorMin,max:()=>Math.round(.6*window.innerWidth)}),_=ki.jsxs(ki.Fragment,{children:[ki.jsx("div",{className:"uno-thin-scroll flex h-9 shrink-0 items-center gap-0.5 overflow-x-auto border-b border-edge px-1",children:f.map(e=>{const t=e.id===p;return ki.jsxs("button",{type:"button",onClick:()=>g(e.id),className:fx("relative flex h-8 shrink-0 items-center gap-1.5 rounded px-2 text-[12px]",t?"text-fg":"text-fg-3 hover:bg-raised/60 hover:text-fg"),children:[ki.jsx(gx,{name:e.icon,className:"h-3.5 w-3.5"}),e.label,null!=e.count&&e.count>0&&ki.jsx("span",{className:"grid h-[15px] min-w-[15px] place-items-center rounded-full bg-raised px-1 font-mono text-[9.5px] text-fg-3",children:e.count}),t&&ki.jsx("span",{className:"absolute inset-x-1.5 bottom-0 h-0.5 rounded-full bg-accent"})]},e.id)})}),ki.jsxs("div",{className:"flex-1 overflow-y-auto bg-canvas",children:["vars"===p&&ki.jsx(qN,{vars:u}),"callstack"===p&&t&&ki.jsx(VN,{frames:t.callStack}),"breakpoints"===p&&ki.jsx(YN,{}),"screenshot"===p&&ki.jsx(JN,{runId:e,bundle:l}),"system"===p&&ki.jsx(sM,{active:t}),"console"===p&&ki.jsx(lM,{runId:e,runFinished:r}),"snapshot"===p&&ki.jsx(uM,{runId:e}),"dom"===p&&ki.jsx(hM,{runId:e,bundle:l}),"network"===p&&ki.jsx(dM,{runId:e,runFinished:r}),"trace"===p&&ki.jsx(_M,{events:i})]})]});return o?ki.jsx("div",{className:"relative flex h-full min-w-0 flex-1 flex-col bg-panel",children:_}):ki.jsxs("aside",{className:"relative flex shrink-0",style:{width:v.inspectorWidth},children:[ki.jsx(Lx,{axis:"x",onPointerDown:m,className:"-left-[6px]"}),ki.jsx("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden rounded-l-lg bg-panel",children:_})]})});function qN({vars:e}){const t=Object.entries(e);return 0===t.length?ki.jsx(KN,{children:"no vars in scope yet"}):ki.jsxs("div",{className:"divide-y divide-edge-soft",children:[ki.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",children:[ki.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"runtime vars"}),ki.jsx("span",{className:"font-mono text-[10.5px] text-fg-4",children:t.length})]}),t.map(([e,t])=>{const i=t.startsWith("<Locator")?"Locator":t.startsWith("{")?"Object":t.startsWith("[")?"Array":t.startsWith('"')?"string":/^-?\d/.test(t)?"number":"value";return ki.jsxs("div",{className:"flex items-baseline gap-2 px-3 py-1.5",children:[ki.jsx("span",{className:"shrink-0 font-mono text-[12.5px] text-fg",children:e}),ki.jsx("span",{className:"min-w-0 flex-1 break-all font-mono text-[12px] text-fg-2",children:t}),ki.jsx("span",{className:"shrink-0 font-mono text-[10.5px] text-fg-4",children:i})]},e)})]})}function VN({frames:e}){return 0===e.length?ki.jsx(KN,{children:"not inside a helper · top-level frame"}):ki.jsxs("div",{className:"divide-y divide-edge-soft",children:[ki.jsxs("div",{className:"flex items-center justify-between border-b border-edge-soft px-3 py-1.5",children:[ki.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"call stack"}),ki.jsx("span",{className:"font-mono text-[10.5px] text-fg-4",children:e.length})]}),e.map((e,t)=>ki.jsxs("div",{className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-raised/60",children:[ki.jsx("span",{className:"grid h-4 w-4 shrink-0 place-items-center font-mono text-[10px] text-fg-4 tabular-nums",children:t}),ki.jsx("span",{className:"flex-1 truncate font-mono text-[12px] text-fg",children:e.fn}),e.file&&ki.jsxs("span",{className:"truncate font-mono text-[10.5px] text-fg-4",children:[e.file,":",e.line]})]},t))]})}const YN=__(function(){const e=w_(),t=e.breakpoints.all().filter(e=>e.keys.length>0);return ki.jsxs("div",{className:"flex h-full flex-col",children:[ki.jsxs("div",{className:"flex items-center justify-between border-b border-edge-soft px-3 py-1.5",children:[ki.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"breakpoints"}),t.length>0&&ki.jsx("button",{type:"button",onClick:()=>e.breakpoints.clear(),className:"font-mono text-[10.5px] text-fg-4 hover:text-fail",title:"Clear all",children:"clear all"})]}),0===t.length?ki.jsx(KN,{children:"no breakpoints set · click the gutter on any step to add one"}):ki.jsx("div",{className:"divide-y divide-edge-soft",children:t.map(t=>ki.jsxs("div",{children:[ki.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",children:[ki.jsx("span",{className:"truncate font-mono text-[11.5px] text-fg",children:t.scenario}),ki.jsx("button",{type:"button",onClick:()=>e.breakpoints.clear(t.scenario),className:"font-mono text-[10px] text-fg-4 hover:text-fail",title:"Clear in this scenario",children:"clear"})]}),t.keys.slice().sort().map(i=>{const[s,r]=i.split(":").map(Number);return ki.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 hover:bg-raised/60",children:[ki.jsx(gx,{name:"bp",className:"h-2.5 w-2.5 shrink-0 text-fail"}),ki.jsx("span",{className:"min-w-0 flex-1 font-mono text-[11.5px] text-fg",children:i}),ki.jsx("button",{type:"button",onClick:()=>e.breakpoints.remove(t.scenario,s,r),className:"grid h-4 w-4 shrink-0 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fail",title:"Remove",children:ki.jsx(gx,{name:"x",className:"h-3 w-3",strokeWidth:2.5})})]},i)})]},t.scenario))})]})});function GN(e){return{kind:"runFile",file:e}}function XN(e){const t=WN(e),i=gi.useMemo(()=>GN(Vb),[]),[s,r]=gi.useState(void 0);return gi.useEffect(()=>{let e=!1;return r(void 0),t.loadText(i).then(t=>{if(!e)if(t.ok)try{const e=JSON.parse(t.text);r(e.capture??null)}catch{r(null)}else r(null)}),()=>{e=!0}},[t,i]),s}function ZN(e,t,i){return!1===e?i.disabled:!0===e?t?i.emptyForRun:i.pending:t?i.disabled:`${i.pending} (opt-in via ${i.flag}=1)`}function JN({runId:e,bundle:t}){const i=WN(e),s=(null==t?void 0:t.screenshotPath)?i.resolveUrl({kind:"event",path:t.screenshotPath}):null;return s?ki.jsxs("div",{className:"flex h-full flex-col",children:[ki.jsx(bM,{label:"page snapshot"}),ki.jsx("div",{className:"flex-1 overflow-auto bg-panel p-2",children:ki.jsx("img",{alt:"page snapshot at failure",src:s,className:"max-w-full rounded border border-edge shadow-sm"})})]}):ki.jsxs("div",{className:"flex h-full flex-col",children:[ki.jsx(bM,{label:"page snapshot"}),ki.jsx(KN,{children:"no screenshot captured"})]})}function QN({marker:e,tone:t,trailing:i,onClick:s,children:r}){const n=fx("flex w-full items-start gap-2 px-3 py-1.5 text-left font-mono","error"===t?"bg-fail/10":"warn"===t?"bg-warn/10":"",s&&"hover:bg-raised/60"),o=ki.jsxs(ki.Fragment,{children:[ki.jsx("span",{className:"mt-[3px] flex h-3 w-3 shrink-0 items-center justify-center",children:e}),ki.jsx("span",{className:"min-w-0 flex-1 break-all",children:r}),i&&ki.jsx("span",{className:"flex shrink-0 items-center gap-1.5",children:i})]});return s?ki.jsx("button",{type:"button",onClick:s,className:n,children:o}):ki.jsx("div",{className:n,children:o})}function eM(e){return ki.jsx("span",{className:fx("h-2 w-2 rounded-full","error"===e?"bg-fail":"warn"===e?"bg-warn":"bg-fg-4")})}function tM({level:e,text:t}){return ki.jsx(QN,{marker:eM(e),tone:"error"===e?"error":"warn"===e?"warn":void 0,children:ki.jsx("span",{className:fx("whitespace-pre-wrap","error"===e?"text-fail":"warn"===e?"text-warn":"text-fg"),children:t})})}function iM({rows:e,empty:t}){return 0===e.length?ki.jsx(KN,{children:t}):ki.jsx("div",{className:"divide-y divide-edge-soft font-mono text-[11.5px]",children:e.map((e,t)=>ki.jsx(tM,{...e},t))})}const sM=__(function({active:e}){const t=w_(),[i,s]=gi.useState(""),[r,n]=gi.useState([]),[o,a]=gi.useState(null),l=function(e){return!!e&&!e.plainRun&&"completed"!==e.status&&"failed"!==e.status&&"aborted"!==e.status}(e),c=[];e&&(e.logs.forEach((e,t)=>{c.push({at:e.at,key:`log-${t}`,node:ki.jsx(tM,{level:e.level,text:e.text})})}),e.consoleEntries.forEach(e=>{c.push({at:e.at,key:`probe-${e.id}`,node:ki.jsx(rM,{entry:e})})}),e.toolCalls.forEach(e=>{c.push({at:e.at,key:`tool-${e.callId}`,node:ki.jsx(nM,{entry:e})})}),c.sort((e,t)=>e.at<t.at?-1:e.at>t.at?1:0));return ki.jsxs("div",{className:"flex h-full flex-col",children:[ki.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:0===c.length?ki.jsx(KN,{children:"no system output"}):ki.jsx("div",{className:"divide-y divide-edge-soft font-mono text-[11.5px]",children:c.map(e=>ki.jsx("div",{children:e.node},e.key))})}),ki.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-t border-edge-soft px-3 py-1.5",children:[ki.jsx(gx,{name:"chevronR",className:"h-3.5 w-3.5 shrink-0 text-accent"}),ki.jsx("input",{type:"text",value:i,onChange:e=>s(e.target.value),onKeyDown:c=>{if("Enter"===c.key)c.preventDefault(),(()=>{const r=i.trim();r&&l&&(t.activeRuns.probe(e.runId,r),n(e=>e[e.length-1]===r?e:[...e,r]),a(null),s(""))})();else if("ArrowUp"===c.key&&r.length>0){c.preventDefault();const e=null===o?r.length-1:Math.max(0,o-1);a(e),s(r[e])}else if("ArrowDown"===c.key&&null!==o){c.preventDefault();const e=o+1;e>=r.length?(a(null),s("")):(a(e),s(r[e]))}},disabled:!l,spellCheck:!1,autoComplete:"off",placeholder:l?"probe a locator — e.g. getByRole('row').first()":"probe needs a live debug session",className:"min-w-0 flex-1 bg-transparent font-mono text-[11.5px] text-fg placeholder:text-fg-4 focus:outline-none disabled:cursor-not-allowed"})]})]})}),rM=__(function({entry:e}){const[t,i]=gi.useState(!1),s=e.result,r=s?1===s.count?"pass":"warn":"neutral";return ki.jsxs("div",{className:"text-[11.5px]",children:[ki.jsx(QN,{marker:ki.jsx(gx,{name:"chevronR",className:"h-3 w-3 text-accent"}),children:ki.jsx("span",{className:"text-fg",children:e.input})}),ki.jsxs("div",{className:"pb-1.5 pl-8 pr-3 font-mono",children:["pending"===e.status&&ki.jsx("span",{className:"text-fg-4",children:"probing…"}),"stale"===e.status&&ki.jsx("span",{className:"text-warn",children:"no reply — page may be navigating, or this run has no debug session"}),"done"===e.status&&s&&ki.jsxs("div",{className:"flex flex-col gap-1",children:[ki.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[ki.jsxs(oj,{tone:r,children:[s.count," match",1===s.count?"":"es"]}),s.pinned&&s.pinned.ofCount>1&&ki.jsxs(oj,{tone:"warn",children:[".",s.pinned.op,"() of ",s.pinned.ofCount]}),s.matches.length>0&&ki.jsxs("button",{type:"button",onClick:()=>i(e=>!e),className:"inline-flex items-center gap-1 text-fg-2 hover:text-fg",children:[ki.jsx(gx,{name:t?"chevronD":"chevronR",className:"h-3 w-3"}),t?"hide":"show"," matches",s.truncated?` (first ${s.matches.length})`:""]})]}),ki.jsx("span",{className:"break-all text-fg-4",children:s.chain}),s.warnings.map((e,t)=>ki.jsxs("span",{className:"text-warn",children:["⚠ ",e]},t)),t&&ki.jsx("div",{className:"mt-0.5 flex flex-col gap-0.5",children:s.matches.map(e=>ki.jsxs("div",{className:"flex items-start gap-2",children:[ki.jsxs("span",{className:"shrink-0 text-fg-4 tabular-nums",children:["#",e.index]}),ki.jsxs("span",{className:"min-w-0 flex-1 break-all text-fg-2",children:[e.role&&ki.jsx("span",{className:"text-fg",children:e.role}),e.name?` "${e.name}"`:e.text?` ${e.text}`:"",e.testId?` [testId=${e.testId}]`:"",!e.visible&&ki.jsx("span",{className:"text-fg-4",children:" · hidden"})]})]},e.index))})]})]})]})}),nM=__(function({entry:e}){var t;const[i,s]=gi.useState(!1),r=e.args.length>0||((null==(t=e.preview)?void 0:t.length)??0)>0;return ki.jsxs("div",{className:"text-[11.5px]",children:[ki.jsx(QN,{marker:ki.jsx(gx,{name:"play",className:"h-3 w-3 text-fg-3"}),onClick:r?()=>s(e=>!e):void 0,trailing:"running"===e.status?ki.jsx("span",{className:"text-fg-4",children:"running…"}):ki.jsxs(ki.Fragment,{children:[null!=e.durationMs&&ki.jsxs("span",{className:"text-fg-4 tabular-nums",children:[e.durationMs,"ms"]}),"error"===e.status?ki.jsx(oj,{tone:"fail",children:"err"}):ki.jsx("span",{className:"text-pass",children:"ok"})]}),children:ki.jsxs("span",{className:"flex min-w-0 items-baseline gap-2",children:[ki.jsx("span",{className:"shrink-0 text-fg",children:e.tool}),ki.jsx("span",{className:"min-w-0 flex-1 truncate text-fg-2",children:e.args})]})}),i&&ki.jsxs("div",{className:"flex flex-col gap-1 pb-1.5 pl-8 pr-3 font-mono",children:[ki.jsxs("div",{className:"text-fg-4",children:[e.at," · ",e.tool,"running"!==e.status&&` · ${e.status}`]}),e.args&&ki.jsx(oM,{text:e.args,tone:"dim"}),e.error?ki.jsxs("div",{className:"whitespace-pre-wrap break-all text-fail",children:[e.error.class,": ",e.error.message]}):e.preview&&ki.jsx(oM,{text:e.preview,tone:"normal"})]})]})});function oM({text:e,tone:t}){let i;try{i=JSON.parse(e)}catch{i=void 0}return null===i||!Array.isArray(i)&&"object"!=typeof i?ki.jsx("div",{className:fx("whitespace-pre-wrap break-all","dim"===t?"text-fg-2":"text-fg"),children:e}):ki.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-all text-[11px] leading-snug",children:ki.jsx(aM,{value:i,indent:0})})}function aM({value:e,indent:t}){const i=" ".repeat(t),s=" ".repeat(t+1);if(null===e)return ki.jsx("span",{className:"text-syn-keyword",children:"null"});if("string"==typeof e)return ki.jsx("span",{className:"text-syn-string",children:JSON.stringify(e)});if("number"==typeof e||"boolean"==typeof e)return ki.jsx("span",{className:"text-syn-number",children:String(e)});if(Array.isArray(e))return 0===e.length?ki.jsx("span",{children:"[]"}):ki.jsxs(ki.Fragment,{children:["[\n",e.map((i,r)=>ki.jsxs("span",{children:[s,ki.jsx(aM,{value:i,indent:t+1}),r<e.length-1?",":"","\n"]},r)),i,"]"]});if("object"==typeof e){const r=Object.entries(e);return 0===r.length?ki.jsx("span",{children:"{}"}):ki.jsxs(ki.Fragment,{children:["{\n",r.map(([e,i],n)=>ki.jsxs("span",{children:[s,ki.jsx("span",{className:"text-syn-key",children:JSON.stringify(e)}),": ",ki.jsx(aM,{value:i,indent:t+1}),n<r.length-1?",":"","\n"]},e)),i,"}"]})}return ki.jsx("span",{children:String(e)})}function lM({runId:e,runFinished:t}){const[i,s]=gi.useState({kind:"loading"}),r=WN(e),n=gi.useMemo(()=>GN("console.json"),[]),o=XN(e);return gi.useEffect(()=>{let e=!1;return s({kind:"loading"}),r.loadText(n).then(t=>{if(!e)if(t.ok)try{const e=JSON.parse(t.text);s({kind:"loaded",rows:e.map(e=>({level:e.level,text:e.text}))})}catch{s({kind:"error",message:"could not parse console.json"})}else s({kind:"missing"})}),()=>{e=!0}},[r,n,t]),"loading"===i.kind?ki.jsx("div",{className:"px-3 py-2 font-mono text-[11.5px] text-fg-4",children:"loading…"}):"error"===i.kind?ki.jsx(KN,{children:i.message}):"missing"===i.kind?ki.jsx(KN,{children:ZN(null==o?void 0:o.console,t,cM)}):ki.jsx(iM,{rows:i.rows,empty:"no console output"})}const cM={flag:"UNOTEST_CONSOLE",disabled:"no console captured — set UNOTEST_CONSOLE=1 to record the browser console",emptyForRun:"no console captured for this run",pending:"browser console appears here when the run finishes"};function hM({runId:e,bundle:t}){return ki.jsxs("div",{children:[ki.jsx(bM,{label:"semantic dom"}),t?ki.jsx(xM,{runId:e,asset:{kind:"event",path:`${t.bundlePath}/outline.txt`}}):ki.jsx(KN,{children:"no failure bundle for this run"})]})}const uM=__(function({runId:e}){const t=w_(),i=gi.useMemo(()=>GN(L_),[]),[s,r]=gi.useState(0),n=gi.useCallback(()=>{t.activeRuns.requestSnapshot(e);const i=setTimeout(()=>r(e=>e+1),600),s=setTimeout(()=>r(e=>e+1),1700);return()=>{clearTimeout(i),clearTimeout(s)}},[t,e]),o=t.activeRuns.byRunId.get(e),a="paused"===(null==o?void 0:o.status)&&o.pausedAt?`${o.pausedAt.file}:${o.pausedAt.line}:${o.pausedAt.col}`:null;return gi.useEffect(()=>{if(null!==a)return n()},[n,a]),ki.jsxs("div",{children:[ki.jsxs("div",{className:"flex items-center justify-between border-b border-edge-soft px-3 py-1.5",children:[ki.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"picker snapshot"}),ki.jsx("button",{type:"button",onClick:n,className:"font-mono text-[10.5px] text-fg-4 hover:text-fg",title:"Recapture the page outline",children:"refresh"})]}),ki.jsx(xM,{runId:e,asset:i,reloadKey:s})]})});function dM({runId:e,runFinished:t}){const[i,s]=gi.useState({kind:"loading"}),r=WN(e),n=gi.useMemo(()=>GN("network.json"),[]),o=XN(e);return gi.useEffect(()=>{let e=!1;return s({kind:"loading"}),r.loadText(n).then(t=>{if(!e)if(t.ok)try{s({kind:"loaded",rows:JSON.parse(t.text)})}catch{s({kind:"error",message:"could not parse network.json"})}else s({kind:"missing"})}),()=>{e=!0}},[r,n,t]),"loading"===i.kind?ki.jsx("div",{className:"px-3 py-2 font-mono text-[11.5px] text-fg-4",children:"loading…"}):"error"===i.kind?ki.jsx(KN,{children:i.message}):"missing"===i.kind?ki.jsx(KN,{children:ZN(null==o?void 0:o.network,t,fM)}):0===i.rows.length?ki.jsx(KN,{children:"no requests captured"}):ki.jsx(gM,{rows:i.rows})}const fM={flag:"UNOTEST_NETWORK",disabled:"no network captured — set UNOTEST_NETWORK=1 to capture",emptyForRun:"no network captured for this run",pending:"network requests appear here when the run finishes"},pM="grid-cols-[1fr_52px_84px_72px_60px]";function gM({rows:e}){return ki.jsxs("div",{className:"font-mono text-[11px]",children:[ki.jsxs("div",{className:fx("sticky top-0 grid gap-2 border-b border-edge-soft bg-panel px-3 py-1.5 text-[10px] uppercase tracking-wider text-fg-4",pM),children:[ki.jsx("span",{children:"Name"}),ki.jsx("span",{className:"text-right",children:"Status"}),ki.jsx("span",{children:"Type"}),ki.jsx("span",{className:"text-right",children:"Size"}),ki.jsx("span",{className:"text-right",children:"Time"})]}),e.map((e,t)=>{const i=!!e.failureText||null!=e.status&&e.status>=400;return ki.jsxs("div",{className:fx("grid items-center gap-2 border-b border-edge-soft px-3 py-1",i&&"bg-fail/10",pM),children:[ki.jsxs("span",{className:"truncate",title:e.url,children:[ki.jsxs("span",{className:"text-fg-4",children:[e.method," "]}),vM(e.url)]}),ki.jsx("span",{className:fx("text-right tabular-nums",i?"text-fail":null!=e.status&&e.status>=200&&e.status<300?"text-pass":"text-fg"),children:e.failureText?"fail":e.status??"—"}),ki.jsx("span",{className:"truncate text-fg-2",children:e.resourceType}),ki.jsx("span",{className:"text-right tabular-nums text-fg-2",children:mM(e.sizeBytes)}),ki.jsx("span",{className:"text-right tabular-nums text-fg-2",children:null!=e.durationMs?`${e.durationMs} ms`:"—"})]},t)})]})}function vM(e){try{const t=new URL(e);return t.pathname.split("/").filter(Boolean).pop()||t.host}catch{return e}}function mM(e){return null==e?"—":e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} kB`:`${(e/1048576).toFixed(1)} MB`}function _M({events:e}){return 0===e.length?ki.jsx(KN,{children:"no trace events"}):ki.jsx("div",{className:"divide-y divide-edge-soft font-mono text-[11.5px]",children:e.map((e,t)=>ki.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5",children:[ki.jsx("span",{className:"w-24 shrink-0 truncate text-fg-2",children:e.kind}),ki.jsx("span",{className:"min-w-0 flex-1 truncate text-fg",children:SM(e)})]},t))})}function bM({label:e}){return ki.jsx("div",{className:"flex items-center justify-between border-b border-edge-soft px-3 py-1.5",children:ki.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:e})})}function xM({runId:e,asset:t,reloadKey:i}){return ki.jsx(yM,{runId:e,asset:t,transform:wM,reloadKey:i})}function yM({runId:e,asset:t,transform:i,reloadKey:s=0}){const[r,n]=gi.useState({kind:"loading"});return function(e,t,i,s,r){const n=WN(e);gi.useEffect(()=>{let e=!1;return s({kind:"loading"}),n.loadText(t).then(t=>{e||(t.ok?s({kind:"loaded",text:i(t.text)}):s({kind:"error",message:"not available"}))}),()=>{e=!0}},[n,t,i,s,r])}(e,t,i,n,s),"loading"===r.kind?ki.jsx("div",{className:"px-3 py-2 font-mono text-[11.5px] text-fg-4",children:"loading…"}):"error"===r.kind?ki.jsx(KN,{children:r.message}):ki.jsx("pre",{className:"overflow-auto whitespace-pre-wrap break-all p-3 font-mono text-[11.5px] text-fg",children:r.text})}function wM(e){return e}function SM(e){switch(e.kind){case"step:started":return`${e.file}:${e.line}:${e.col}`;case"step:ok":return`${e.durationMs}ms`;case"step:fail":return e.error;case"screenshot":return e.path;case"failure-bundle:written":return e.bundlePath;case"run:started":return e.scenario;case"run:finished":return e.outcome;default:return""}}const kM={default:"border border-edge-soft bg-canvas text-fg-2 hover:bg-raised",primary:"bg-accent text-on-accent hover:bg-accent-hover",accent:"border border-accent/30 bg-accent/10 text-accent hover:bg-accent/20",danger:"border border-fail/30 bg-fail/10 text-fail hover:bg-fail/20"};function CM({children:e,onClick:t,icon:i,variant:s="default",tooltip:r,tooltipHint:n,tooltipPlacement:o="bottom-start",className:a}){return ki.jsxs("button",{type:"button",onClick:t,className:fx("group relative flex h-6 items-center gap-1 rounded px-2 font-mono text-[11px] font-medium",kM[s],a),children:[i&&ki.jsx(gx,{name:i,className:"h-3 w-3",strokeWidth:2.5}),e,r&&ki.jsx(Lj,{label:r,hint:n,placement:o})]})}function jM(e){return new Map(SN(e).map(e=>[`${e.line}:${e.col}`,e.index]))}function NM(e,t,i){const s=e.get(`${t}:${i}`);if(null!=s)return s;for(const[r,n]of e)if(r.startsWith(`${t}:`))return n;return null}function MM(e,t,i){const s=jM(t),r=[],n=new Map,o=[];for(const a of e)if("step:started"===a.kind){const e=a.file===i?NM(s,a.line,a.col):null;if(o.push({idx:e}),null==e)continue;const t=n.get(e);if(t)t.status="running",t.durationMs=null;else{const t={index:e,line:a.line,col:a.col,status:"running",durationMs:null};n.set(e,t),r.push(t)}}else if("step:ok"===a.kind){const e=o.pop();if(null!=(null==e?void 0:e.idx)){const t=n.get(e.idx);t&&(t.status="passed",t.durationMs=a.durationMs)}}else if("step:fail"===a.kind){const e=o.pop();if(null!=(null==e?void 0:e.idx)){const t=n.get(e.idx);t&&(t.status="failed")}}else if("run:finished"===a.kind)for(const e of r)"running"===e.status&&(e.status="aborted");return function(e){const t={};for(const i of e)t[i.index]={status:i.status,durationMs:i.durationMs};return t}(r)}function BM(e,t,i){const s=jM(t),r=[];for(const n of e)if("step:started"===n.kind){const e=n.file===i?NM(s,n.line,n.col):null;r.push({idx:e})}else if("step:ok"===n.kind)r.pop();else if("step:fail"===n.kind){const e=r.pop();if(null!=(null==e?void 0:e.idx))return e.idx}return null}const EM=RB;!function(){const e=405,t=387,i=172,s=506,r=415,n=RB,o=AM();for(;;)try{if(753289===-parseInt(n(181))/1*(-parseInt(n(406))/2)+-parseInt(n(e))/3*(parseInt(n(359))/4)+parseInt(n(468))/5*(parseInt(n(162))/6)+-parseInt(n(430))/7*(parseInt(n(t))/8)+parseInt(n(i))/9*(-parseInt(n(249))/10)+parseInt(n(240))/11*(parseInt(n(s))/12)+parseInt(n(299))/13*(parseInt(n(r))/14))break;o.push(o.shift())}catch(a){o.push(o.shift())}}();var DM=Object[EM(265)],LM=(e,t)=>DM(e,EM(266),{value:t,configurable:!0});function PM(e){const t=EM;return'"'+e[t(396)](/\\/g,"\\\\")[t(396)](/"/g,'\\"')+'"'}function RM(e,t){const i=EM,s=e.replace(/\\/g,"\\\\")[i(396)](/'/g,"\\'");return void 0!==t?i(475)+s+i(426)+t+")])":i(475)+s+"')])"}function AM(){const e=["yNvPBgrty3jVBgXuB1rVCerZBa","iIWGBgLUztOG","yxnZzxj0uM91DgvjCYG","zwnOBW","qLjfquS","zgvMyxvSDa","Bwv0yujSB2nR","zM9Y","yNvPBgrty3jVBgXjBNrVvMLLD0rZBa","Dg9Rzw4","oYbUB3qGAw4Grvm1ihn1yNnLDc4Gu2vLigrVy3mVzhnSl3jLz2v4lwXPDgvYywWTzxm1lM1KigzVCIb0AguGC3vWCg9YDgvKigzSywCGC2v0lG","rxHWzwn0zwqGChjVCgvYDhKGA2v5icH3B3jKig9Yihn0CMLUzYK","zgvJBgfYyxrVCNm","qMXVy2TtDgf0zw1LBNq","C2f2zuzVCM0O","y2XPCgjVyxjKugfZDguO","DMfSDwu","Bg9NAw5bCYG","zxHLy3v0zq","yNvPBgrlzxLWCMvZC0rZBa","Aw5KzxG","zNjVBq","Dhj1zq","ruXtrq","yNjLywS","vMfYAwfIBgvZihn0ywnRihvUzgvMAw5Lza","tfrfuq","sw52ywXPzcb0B2TLBML6zu9WzxjHDg9YoIb1BMv4CgvJDgvKigvUzcbVzIbPBNb1Da","z2v0qxjNC0nVDw50","zNvUy3rPB25HBev4ChjLC3nPB24","Aw1WB3j0","Dg9Rzw5PEMvnzxrHv29Yza","Dg9tDhjPBMC","lcbJB2X1Bw4G","C3DPDgnOvg9nywLUrNjHBwuO","sw52ywXPzcbHCMD1BwvUDcbJB3vUDcbMB3iGzNvUy3rPB24G","yxjNDw1LBNrZ","uKjsqunf","Aw5KzxHfEhbYzxnZAw9UCW","ihWG","zxnJyxbLrhnSu3rYAw5N","vu5eruzjtKve","B3bLBG","y29UC3vTzvDVCMq","yNvPBgrgAwXSrhnS","yNvPBgrbC3nLCNruzxH0rxf1ywXZrhnS","vw5KzwzPBMvKvMfSDwu","u3rYAw5N","uKvtrvjwrurFv09srfm","Dg9Rzw5PEMvszwDLEa","twv0yujSB2nRu3rHDgvTzw50","Aw5WDxq","nJzyAuvJrM4","DMfY","AwyG","ywrKvg9Rzw4","yxDHAxq","zxzHBa","yxnZzxj0vg9HC3rwAxnPyMXLka","yMXVy2TnzxrHqMXVy2S","tKvr","mJyZmdbAzNvjEvK","DxjSqxnZzxj0kcjjuYiSia","C3rLCcG","z2v0t3bLCMf0B3joyw1L","yNvPBgrtD2L0y2HuB01HAw5gCMfTzurZBa","B3bLBIG","yNvPBgrtyxzLrM9YBurZBa","jYbYzxf1AxjLCYa","z2v0qxjYyxK","AwzfBhnL","y29TBwvUDhm","rvm2ihn0AwnREq","zwXZzvn0yxrLBwvUDa","qxjYyxLbC3nPz25Tzw50u3rHDgvTzw50","zg8GEWO","Dg9Rzw5PEMvdB21Tzw50","zgvMAw5LuhjVCgvYDhK","BMfTzq","zMfSC2u","Dg9Rzw5PEMvnDwX0AwXPBMvdB21Tzw50","vKfs","zNvUy3rPB25ezwzPBMu","qKfsqKfs","ywrKAxrPDMu","y29UzgL0Aw9UywW","yNvPBgrbC3nLCNrwAxnPyMXLrhnS","Dhj5","D2fPDezVCIG","C2L6zq","BNvSBa","z2v0vhLWzq","lcbLEhbLy3rLzca","ywz0zxjcBg9JAW","y29UC3q","yNvPBgrty3jVBgXuB0jVDhrVBurZBa","Dg9Rzw5PEMvxB3jK","it09","ufjjtLq","zM9YBwf0ugfYC2vfCNjVCG","yNvPBgrdBg9ZzurPywXVz0rZBa","BwfW","twLZC2LUzYbJBg9ZzsbIywnRDgLJAYbPBIbYyxCGC3rYAw5NigXPDgvYywW","qxjYyxLby2nLC3nfEhbYzxnZAw9U","zgvSzxrL","vw5HCNLfEhbYzxnZAw9U","yNvPBgrxywL0rM9YvvjmrhnS","u3rYAw5NvMfSDwu","twLZC2LUzYbJBg9Zzsb0ywCGAw4Gy29TBwvUDa","u05fuq","icHSAw5Lia","mtnwyNLKu0S","qvjst1C","z2v0uhjVCgvYDgLLCW","z2v0vgv4Da","ue9tvezjwf9erunsru1ftLq","vxnLCKrLzMLUzuz1BMn0Aw9U","AM9PBG","zwXLBwvUDefZC2vYDcGIq09ovefjtLmIlca","EwLLBgq","yNvPBgrbC3nLCNrsB3v0zuLZrhnS","q29UC3rHBNqG","zMXHz3m","Dg9Rzw5PEMvoDw1Izxi","C2nYB2XSvg9uB3aO","qu1q","zMLSBa","AxnfEgLZDhm","Dg9Rzw5PEMu","Aw5KzxHpzG","tejsqunf","v2HPBgvtDgf0zw1LBNq","tNvTyMvYvMfSDwu","rNvUy3rPB25Z","zM9Yy2vdBgLJAYG","zMLSBcG","yNvPBgrbC3nLCNruB2fZDfzPC2LIBgveC2W","yNvPBgrdBgLWyM9HCMrqyxn0zurZBa","vg9Rzw4ODhLWztOG","vw5LEhbLy3rLzca","C2nYB2XSvg9cB3r0B20O","B2jQzwn0rxHWCMvZC2LVBG","D2HPBgvtDgf0zw1LBNq","Aw5PDa","zM9YBwf0q29KzuzYyw1L","vg9Rzw4","sw52ywXPzcb0B2TLBJOGDw5LEhbLy3rLzca","Bwf4","yNvPBgrbC3nLCNreAwfSB2DpCgvUrhnS","B3bLCMf0B3i","yNvPBgrbC3nLCNroB1zPC2LIBgvfCNjVCKrZBa","Dw5RBM93BIbYzwDLEcbMBgfNicC","Cg9W","ufjfrKLyx0rfq1jftuvova","BMv3","wKvstW","y29UzgL0Aw9U","u0Xbu0G","r1rfuq","kqP7cG","ChjPBwfYEq","C3rHy2S","DMfYu3rHDgvTzw50","Dg9Rzw5PEMvpCgvYyxrVCG","zwXLBwvUDhm","B3bLCMf0Aw9U","DM9Pza","BgvUz3rO","DMfYia","q0Xpu0vFtuvuqv9cte9dsW","yxnZzxj0qxv0AgvUDgLJyxrLzcG","mZaWDuDQuMH6","rNvUy3rPB25tDgf0zw1LBNq","z2v0tMfTzq","ChjPBNqG","lcaOksa9pIb7cG","rNvUy3rPB25HBev4ChjLC3nPB24","Bg9N","B3bLBLrHyIG","C3rLCa","y2XVBMu","z2v0q29SDw1U","zwXLBwvUDefZC2vYDcGIsvmIlca","zM9YrwfJAa","Axnmzxr0zxjjBLDVCMq","sw5JCMvTzw50u3rHDgvTzw50","yNvPBgrbC3nLCNrmAxn0tM90rw1WDhLeC2W","vw50zxjTAw5HDgvKihjLz2v4igXPDgvYywWGkgrHBMDSAw5NigjHy2TZBgfZAcKU","D2fPDezVCLrLEhqO","D2fPDezVCLvstcG","t1bfuKfut1jFq0HbuLm","vw5LEhbLy3rLzcbUB24TyNjLywTPBMCGC3bHy2uGkfuRmdbbmcKG4OcuihjLCgXHy2uGAxqGD2L0AcbHihjLz3vSyxiGC3bHy2u","ufjfrKLyx0Loq1jftuvova","BgfIzwXuzxH0","yNvPBgreCMfNqw5KrhjVCerZBa","zhvWBgLJyxrLihjLz2v4igzSywCGjW","vw50zxjTAw5HDgvKihjLz2v4igXPDgvYywWGkgXPBMuGyNjLywSGAw5ZAwrLigjVzhKPlG","y29Z","Aw5PDgLHBgL6yxrPB24","ntCZnKXnsgLAAG","AxnszwDLEefSBg93zwrbzNrLCG","tgv4zxi","DMfYAwfIBgvZ","yNvPBgrpCgvUvgfIrhnS","AgfZ","Dg9Rzw5Z","t1bfuKfut1jt","BxvSDgLWBgLJyxrL","CMvWBgfJzq","uhjVCgvYDhKTCMvHzcbLEhbYzxnZAw9UihvZzwqGyxmGysbZDgf0zw1LBNqGkg5VihnPzguGzwzMzwn0ks4GrwL0AgvYigfZC2LNBIbPDcaOyhGGpsbYB3CUzM9VycKGB3iGy2fSBcbHig1LDgHVzcaOyhjVDY5MB28OkwaPlG","vMfYAwfIBguGBMfTzsaN","ChjVCgvYDgLLCW","D2HPBguGka","tfrf","y29SDw1U","AgLNAgXPz2H0qMXVy2S","cI8VqgvUzc0","ntaYodbJD2DQv0G","ngX5u0X0CG","ywrKqxjNDw1LBNq","Dg9Rzw5PEMvuzxH0","Bg9NAwnHBefUza","pt09","zhjHz0fUzerYB3aO","CMvJzwL2zxi","zgvIDwDNzxi","yxnZAwDUBwvUDfn0yxrLBwvUDa","mZyXndm1mLzQzeDOEq","yNvPBgrbC3nLCNrvCMXdB250ywLUC0rZBa","yxntDhjPBMC","twvTyMvYq2fSBev4ChjLC3nPB24UzxzHBcGPigLZig5VDcbPBxbSzw1LBNrLzcbPBIb0AguGAw4TChjVy2vZCYbPBNrLCNbYzxrLCIdIGjqGDxnLiefZDev4zwn1Dg9YicHZCMmVzhnSl2fZDc1LEgvJDxrVCI50CYKGAw5ZDgvHzc4","rK9s","z2v0tgLUzq","yNvPBgrdBgLJA0rZBa","B3bLCMfUza","rvHdta","lcb0zxH0oIaI","zwXZzq","jYKSig50AcG","v0Hjteu","yxnZzxj0ugfNzvjLywr5ka","tejsqunlrvq","mJe3n3z1D0rYyq","z2v0qxjNC05HBwu","tfbbuKvo","rvHdtevr","kY0QlYGPE31Bxt08pIeMFcW6oY4","ywrK","id0G","yxjYyxK","yxjNtMfTzxm","yM9KEq","Bwf0y2G","uMvNrxHWrMXHz0vYCM9Y","ueXvuW","qu1qqu1q","qu5e","zNvUy3rPB25fEhbYzxnZAw9U","sw5JCMvTzw50rxHWCMvZC2LVBG","C2v0ugfNzq","CgvLAW","yNvPBgrxywL0rM9Yvgv4DerZBa","yNvPBgrbC3nLCNrqywDLuMvHzhLeC2W","Dw5KzwzPBMvK","DxjSqxnZzxj0kcjdt05uquLouYiSia","zMXVD18","DhjPBq","ue9tvezjwf9jtKnsru1ftLq","uKvuvvjo","zxHWCJe","q09ntue","cN0kD2HPBguGka","ugfYC2vfCNjVCG","Dgv4Da","ChvZAa","swztDgf0zw1LBNq","yxnoDw1Izxi","yMXVy2S","uMvNrxHWvMfSDwu","v09sra","nxr3BK5jvG","C3bSAxq","rLvoq1rjt04","y2fZzq","CgfKu3rHCNq","BMv4Da","AxnxB3jKu3rHCNq","Dg9mB2nHDg9YkfTSB2nHDg9YkcC","CMv0DxjU","y29UC3vTzufYCMf5","uLbbuKvo","ugfYC2vY","re9u","rvffuuvr","CMvZDwX0","uhjVCgvYDhLby2nLC3nfEhbYzxnZAw9U","yNvPBgrxywL0rM9YrhnS","Bg9VA01HDgnO","C3rHCNrZv2L0Aa","zwXLBwvUDfzPC2LIAwXPDhLbC3nLCNqOiLzju0LcteuIlca","rvHdtevrrve","qKfs","uhjVCgvYDhLby2nLC3nfEhbYzxnZAw9UlMv2ywWOksbPCYbUB3qGAw1WBgvTzw50zwqGAw4GDgHLigLUlxbYB2nLC3mGAw50zxjWCMv0zxiG4OcuihvZzsbbC3rfEgvJDxrVCIaOC3jJl2rZBc9HC3qTzxHLy3v0B3iUDhmPigLUC3rLywqU","q09mt04","igrVzxmGBM90igv4Axn0iq","C3rYAw5NAwz5","r1rf","C2XPy2u","y2HHCKf0","q09oveLovuu","zNvUy3rPB24G","qxjYyxKGzxHWzwn0zwq","yNvPBgrbC3nLCNrjBNb1DfzHBhvLrhnS","Bg9NAwnHBe9Y","zwXLBwvUDev4ChjLC3nPB24","rvmYmde4igrVDefSBa","C3rHDgvTzw50CW","Aw5JCMvTzw50","mJG1mJC3mNfnwM1HAq","q2fUBM90igLUy3jLBwvUDc9KzwnYzw1LBNqGBM9Ulw51BwvYAwmGDMfSDwu","yNvPBgrtD2L0y2HuB0zYyw1LrhnS","C3rHDgvTzw50","z2v0","C3DPDgnO","C3DPDgnOvg9gCMfTzsG","DMfYAwfIBgu","yNvPBgrgAwXSrM9YBurZBa","Bg9JywXLq29TCgfYzq","Cg9Z","rxHWzwn0zwqGAwrLBNrPzMLLCIbHzNrLCIaNlIC","yM9VBgvHBG","icaGia","C3rLCfn0yxrLBwvUDa","rvffuq","C3vWzxi","ru9g","vw5YzwnVz25PEMvKihzHBhvLlIa","q29UDgLUDwvtDgf0zw1LBNq","u1rbuG","zxH0zw5KCW","zNvUy3rPB24","twLZC2LUzYbJBg9ZzsbXDw90zsbPBIbZDhjPBMCGBgL0zxjHBa","yNvPBgruExbLvgv4DerZBa","qNjLywTtDgf0zw1LBNq","sw5KzxGGywnJzxnZig9UigeGBwvTyMvYigv4ChjLC3nPB24GkguUzY4Gyhn0yxrLlM1HDgnOzxnBmf1GksbPCYbUB3qGC3vWCg9YDgvKiokaLcbPBMrLEgLUzYb3B3jRCYbVBIbHigjHCMuGDMfYAwfIBguGB25SEs4GqxnZAwDUihrOzsbTzw1IzxiGDg8Gysb2yxjPywjSzsbMAxjZDdOGyg0GpsbZDgf0zs5TyxrJAgvZoYbSyxn0id0GBvTTlMXLBMD0AcaTidfDo2a","lcbJB2X1Bw46ia","C2v0","zw50CMLLCW","yNvPBgrbC3nLCNruzxH0q29UDgfPBNneC2W","ChjLC3mO","u0vnsunpte9o","BgfZDeLUzgv4","z2v0uMvZDwX0","CMvWzwf0","y29UDgLUDwu","BwLU","yxjYyxLfEhbYzxnZAw9U","BgLUzq","tuLovvnnsu5vuW","tLvnqKvs","qxjYyxLwywX1zq","yNvPBgrbC3nLCNrbDxrOzw50AwnHDgvKrhnS","y29UC3vTzq","zNvUy3rPB25Z","y2XHC3m","yNvPBgrmB2DPBKfZrhnS","DgHYB3C","BgfIzwW","tuvuqv9cte9dsW","sw52ywXPzcbMBg9HDcbUDw1Izxi","y2f0y2G","yxnZzxj0u2vJDgLVBLrPDgXLka","uKvhrvG","BNvTyMvY","u3rLCfn0yxrLBwvUDa","zxHWCMvZC2LVBG","y2fSBfDPDgHqB3n0zML4","CMvNzxGGzMXHzYaN","C3rHDgvTzw50t3jcBg9JAW","vw5RBM93BIbMDw5JDgLVBJOG","Dw5HCNK","y2XVC2veAwfSB2CO","yNvPBgrgB3jJzunSAwnRrhnS","ndmZmJq2ohrQzeHMza","AxnoDw1Izxi","Aw5KzxHLCW","yNvPBgrxywL0rM9YtMf2AwDHDgLVBKrZBa","lcaIiZy2y2nJyYiPoW","DhLWzvrLEhqO","AwztDgf0zw1LBNq","C291CMnL","DgvYBwLUyxrPB24","C2vSzwn0q29TyM9IB3HwywX1zsG","nZy1s3jpAhzH","zw5K","rvm2ihvUAwnVzgu","DhLWzq","dqOa","q2fUBM90ignHC3qGyxjYyxKGDg8GBNvTyMvY","Bgv0","zxHWCJi","zxf1ywXPDhK","mJuWotDpvM1rEMe","vevyva","tuLovvm","yNvPBgrpCgvUrhnS","twvTyMvYq2fSBev4ChjLC3nPB24","cN0P","Dg9Rzw5PEMvsyxDuzxH0"];return(AM=function(){return e})()}LM(PM,EM(228)),LM(RM,"locator"),LM(function(e,t,i=""){return"click("+RM(e,t)+", "+PM(i)+");"},EM(421)),LM(function(e,t,i,s=""){return EM(323)+RM(e,i)+", "+PM(t)+", "+PM(s)+");"},EM(232)),LM(function(e,t,i=""){return EM(167)+RM(e)+", "+PM(t)+", "+PM(i)+");"},EM(530)),LM(function(e,t="0",i=""){return EM(254)+PM(e)+", "+PM(t)+", "+PM(i)+");"},EM(184)),LM(function(e,t=""){return EM(487)+RM(e)+", "+PM(t)+");"},EM(274)),LM(function(e,t=""){return EM(452)+PM(e)+", "+PM(t)+");"},EM(416)),LM(function(e=""){return EM(428)+PM(e)+");"},EM(450)),LM(function(e=""){return EM(358)+PM(e)+");"},EM(140)),LM(function(e,t=""){return"assertTableNotEmpty("+RM(e)+", "+PM(t)+");"},"buildAssertTableNotEmptyDsl"),LM(function(e,t=""){return"assertListNotEmpty("+RM(e)+", "+PM(t)+");"},EM(374)),LM(function(e=""){return"assertNoVisibleError("+PM(e)+");"},EM(338)),LM(function(e,t=""){return EM(150)+PM(e)+", "+PM(t)+");"},"buildAssertSectionTitleDsl"),LM(function(e,t=""){return EM(246)+PM(e)+", "+PM(t)+");"},EM(324)),LM(function(e,t=""){return"assertDialogOpen("+PM(e)+", "+PM(t)+");"},EM(336)),LM(function(e,t=""){return EM(190)+PM(e)+", "+PM(t)+");"},EM(308)),LM(function(e,t,i=""){return EM(171)+RM(e)+", "+PM(t)+", "+PM(i)+");"},"buildSelectComboboxValueDsl"),LM(function(e,t,i=""){return EM(205)+PM(e)+", "+PM(t)+", "+PM(i)+");"},EM(144)),LM(function(e,t=""){return"openMenuItem("+PM(e)+", "+PM(t)+");"},"buildOpenMenuItemDsl"),LM(function(e,t=""){return EM(366)+PM(e)+", "+PM(t)+");"},EM(391)),LM(function(e,t=""){return EM(160)+PM(e)+", "+PM(t)+");"},EM(288)),LM(function(e,t=""){const i=EM;return'fillForm("'+JSON[i(493)](e).replace(/\\/g,"\\\\")[i(396)](/"/g,'\\"')+'", '+PM(t)+");"},EM(514)),LM(function(e,t=""){return EM(202)+PM(e)+", "+PM(t)+");"},EM(255)),LM(function(e,t="",i){const s=i?", "+i:"";return EM(276)+RM(e)+", "+PM(t)+s+");"},EM(484)),LM(function(e,t,i="",s){const r=s?", "+s:"";return EM(376)+RM(e)+", "+PM(t)+", "+PM(i)+r+");"},EM(449)),LM(function(e,t="",i){const s=i?", "+i:"";return"waitForHidden("+RM(e)+", "+PM(t)+s+");"},"buildWaitForHiddenDsl"),LM(function(e,t="",i){const s=i?", "+i:"";return EM(377)+PM(e)+", "+PM(t)+s+");"},EM(294)),LM(function(e="",t){const i=t?", "+t:"";return"waitForNavigation("+PM(e)+i+");"},EM(165)),LM(function(e,t,i="",s){const r=s&&"IS"!==s?", "+PM(s):"";return"assertInputValue("+RM(e)+", "+PM(t)+", "+PM(i)+r+");"},EM(500)),LM(function(e,t=""){return"scrollIntoView("+RM(e)+", "+PM(t)+");"},EM(196)),LM(function(e,t=""){return EM(328)+RM(e)+", "+PM(t)+");"},EM(283)),LM(function(e,t=""){return EM(312)+RM(e)+", "+PM(t)+");"},EM(188)),LM(function(e,t=""){return EM(322)+RM(e)+", "+PM(t)+");"},EM(161)),LM(function(e,t,i=""){return EM(411)+RM(e)+", "+RM(t)+", "+PM(i)+");"},EM(382)),LM(function(e,t,i=""){return EM(203)+RM(e)+", "+PM(t)+", "+PM(i)+");"},EM(325)),LM(function(e,t="body",i=""){return EM(537)+RM(t)+", "+PM(e)+", "+PM(i)+");"},EM(207)),LM(function(e,t=""){return EM(512)+RM(e)+", "+PM(t)+");"},EM(508)),LM(function(e=""){return EM(222)+PM(e)+");"},EM(253)),LM(function(e,t=""){return'elementVisibilityAssert("NOT_VISIBLE", '+RM(e)+", "+PM(t)+");"},"buildAssertNotVisibleDsl"),LM(function(e,t,i=""){return EM(306)+RM(e)+", "+PM(t)+", "+PM(i)+");"},EM(536)),LM(function(e,t,i=""){return EM(370)+RM(e)+", "+PM(t)+", "+PM(i)+");"},EM(233)),LM(function(e,t=""){return EM(250)+PM(e)+", "+PM(t)+");"},"buildAssertUrlEqualsDsl"),LM(function(e,t,i=""){return'elementCountAssert("EQUAL", '+RM(e)+", "+t+", "+PM(i)+");"},"buildAssertCountEqualsDsl"),LM(function(e,t){const i=453,s=EM,r=e[s(396)](/-/g,"_");return s(i)+r+"("+PM(e)+", "+PM(t)+s(166)},"buildFlowDsl");var TM=(LM(s=class{constructor(e){Bt(this,i);const t=314,s=EM;typeof e===s(152)?this[s(352)]=new Array(e)[s(t)](void 0):Array.isArray(e)?this.elements=[...e]:this[s(352)]=[...e[s(352)]]}[(i=EM(352),EM(510))](e){return this.elements[e]}[EM(534)](e,t){this.elements[e]=t}[EM(464)](){throw new Error(EM(177))}[EM(368)](){const e=EM;return new s(this[e(352)][e(289)](t=>t[e(368)]()))}[EM(417)](){const e=EM;return"["+this[e(352)].map(e=>e.asString())[e(305)](", ")+"]"}[EM(220)](){return this.asString()}},EM(139)),s),zM=(LM(o=class{constructor(e){Bt(this,r);const t=EM;typeof e===t(518)?this[t(204)]=e?1:0:this.value=e}clone(){return new o(this[EM(204)])}[(n=EM(343),r=EM(204),EM(464))](){return this[EM(204)]}asString(){const e=EM;return this.value[e(220)]()}[EM(220)](){return this[EM(417)]()}},EM(320)),Bt(o,n,new o(0)),o),OM=(LM(a=class{static[EM(315)](e){const t=EM;return this[t(142)][t(392)](e)}static[EM(510)](e){const t=510,i=EM,s=this[i(142)][i(t)](e);if(!s)throw new TypeError(i(158)+e);return s}static set(e,t){const i=EM;this[i(142)][i(534)](e,t)}},EM(321)),Bt(a,"functions",new Map([[EM(385),{execute(...e){const t=385,i=464,s=EM;if(1!==e[s(355)])throw new Error("One argument expected");return new zM(Math[s(t)](e[0][s(i)]()))}}],[EM(191),{execute(...e){const t=EM;for(const i of e)console[t(365)](i[t(417)]());return zM[t(343)]}}],[EM(403),{execute:(...e)=>zM[EM(343)]}],[EM(447),{execute:(...e)=>zM.ZERO}],[EM(281),{execute:(...e)=>zM.ZERO}],[EM(230),{execute:(...e)=>zM.ZERO}],[EM(235),{execute:(...e)=>zM[EM(343)]}]])),a),IM=(LM(l=class{constructor(e=new Map){Bt(this,"properties"),this.properties=e}[EM(510)](e){return this[EM(399)].get(e)}set(e,t){this[EM(399)].set(e,t)}asNumber(){const e=EM;return this[e(399)][e(277)]}[EM(417)](){const e=EM;return"{"+Array[e(209)](this[e(399)][e(535)]()).map(([t,i])=>t+": "+i[e(417)]()).join(", ")+"}"}clone(){const e=534,t=EM,i=new Map;return this[t(399)].forEach((s,r)=>{const n=t;i[n(e)](r,s[n(368)]())}),new l(i)}[EM(301)](){return this[EM(399)]}},"ObjectValue"),l),FM=(LM(u=class{constructor(e,t){Bt(this,h),Bt(this,c);const i=EM;KM(t),this[i(169)]=e,this[i(310)]=t}clone(){const e=EM;return new u(this[e(169)],this[e(310)])}[(h=EM(169),c=EM(310),EM(464))](){return NaN}[EM(417)](){const e=310,t=EM;return"/"+this[t(169)]+"/"+this[t(e)]}[EM(220)](){return this[EM(417)]()}},EM(466)),u),HM=new Set(["g","i","m"]),WM={s:EM(503),u:EM(174),y:EM(260),d:"ES2022 hasIndices",v:"ES2024 unicodeSets"};function KM(e){const t=256,i=435,s=EM,r=new Set;for(const n of e){if(WM[n])throw new UM(s(156)+n+s(t)+WM[n]+s(198));if(!HM[s(392)](n))throw new UM(s(339)+n+"'. ES5 allows g, i, m.");if(r[s(392)](n))throw new UM(s(383)+n+"'.");r[s(i)](n)}}LM(KM,"validateEs5Flags");var UM=(LM(d=class extends Error{constructor(e){const t=266,i=441,s=EM;super(e),this[s(t)]=s(i)}},EM(441)),d),$M=(LM(p=class{constructor(e){Bt(this,f),this.value=e}[(f=EM(204),EM(368))](){return new p(this[EM(204)])}[EM(464)](){const e=EM;try{return parseFloat(this[e(204)])}catch(t){return 0}}[EM(417)](){return this.value}[EM(220)](){return this[EM(417)]()}},EM(295)),p),qM=(LM(m=class{constructor(e,t){Bt(this,v),Bt(this,g);const i=EM;this[i(438)]=e,this[i(439)]=t}[(v=EM(438),g=EM(439),EM(216))](){const e=EM;return this[e(438)][e(355)]}[EM(431)](e){const t=438,i=355,s=EM;return e<0||e>=this[s(t)][s(i)]?"":this[s(t)][e]}[EM(206)](...e){const t=206,i=EM;try{return this[i(439)][i(t)](),zM[i(343)]}catch(s){if(s instanceof bB)return s[i(540)]();throw s}}},EM(304)),m),VM=(LM(x=class{static[(b=EM(349),_=EM(390),EM(462))](){const e=534,t=349,i=EM,s=new Map([]);for(const[r,n]of this[i(390)][i(535)]())s[i(e)](r,n);this[i(t)][i(462)](s)}static pop(){const e=EM,t=this[e(349)][e(340)]();if(!t)throw new Error(e(213));this.variables=t}static[EM(315)](e){return this[EM(390)].has(e)}static get(e){const t=EM;return this[t(390)][t(510)](e)||zM.ZERO}static[EM(534)](e,t){const i=EM;this[i(390)][i(534)](e,t)}},"Variables"),Bt(x,b,[]),Bt(x,_,new Map([["PI",new zM(Math.PI)],["E",new zM(Math.E)]])),x),YM=(LM(k=class{constructor(e,t,i){Bt(this,S),Bt(this,w),Bt(this,y);const s=164,r=EM;this[r(513)]=e,this[r(s)]=t,this[r(197)]=i}get variableName(){return this[EM(513)]}get[(S=EM(513),w=EM(164),y=EM(197),EM(226))](){return this[EM(164)]}eval(){const e=EM,t=this.lastIndex();return this[e(257)]()[e(510)](t)}[EM(539)](){const e=EM;return this[e(208)](this.indexes[e(355)]-1)}index(e){const t=245,i=464,s=EM;return this[s(164)][e][s(t)]()[s(i)]()}[EM(257)](){const e=510,t=EM;let i=this.consumeArray(VM[t(510)](this[t(513)]));const s=this[t(164)][t(355)]-1;for(let r=0;r<s;r++)i=this[t(477)](i[t(e)](this.index(r)));return i}[EM(477)](e){if(e instanceof TM)return e;throw new Error(EM(499))}[EM(220)](){return""+(this[EM(513)]+this.indexes)}},EM(291)),k),GM=(LM(N=class{constructor(e,t,i){Bt(this,"array"),Bt(this,j),Bt(this,C);const s=154,r=197,n=EM;this.array=e,this[n(s)]=t,this[n(r)]=i}execute(){const e=257,t=534,i=245,s=EM;this.array[s(e)]()[s(t)](this[s(437)][s(539)](),this.expression[s(i)]())}[(j=EM(154),C=EM(197),EM(220))](){const e=EM;return this.array+" = "+this[e(154)]}},EM(262)),N),XM=(LM(B=class{constructor(e,t){Bt(this,M),Bt(this,"token");const i=197,s=EM;this[s(352)]=e,this[s(i)]=t}eval(){const e=EM,t=this[e(352)].map(t=>t[e(245)]());return new TM(t)}[(M=EM(352),EM(220))](){return""+this[EM(352)].toString()}},"ArrayExpression"),B),ZM=(LM(P=class{constructor(e,t,i){Bt(this,L),Bt(this,D),Bt(this,E);const s=EM;this.variable=e,this[s(154)]=t,this[s(197)]=i}[(L=EM(513),D=EM(154),E=EM(197),EM(206))](){const e=EM,t=this.expression.eval();VM[e(534)](this[e(513)],t)}[EM(220)](){const e=154,t=EM;return this[t(513)]+t(436)+this[t(e)]}},"AssignmentStatement"),P),JM=(LM(O=class{constructor(e,t,i,s){Bt(this,z),Bt(this,T),Bt(this,A),Bt(this,R);const r=457,n=197,o=EM;this[o(353)]=e,this[o(r)]=t,this.expr2=i,this[o(n)]=s}[(z=EM(353),T=EM(457),A=EM(179),R=EM(197),EM(245))](){const e=245,t=353,i=353,s=EM,r=this[s(457)].eval();if(r instanceof $M||r instanceof TM){const i=r.asString(),n=this.expr2[s(e)]()[s(417)]();if("+"===this[s(t)])return new $M(i+n);throw new Error("Unrecognized operator for string value")}const n=this[s(457)][s(245)]()[s(464)](),o=this.expr2[s(245)]().asNumber();switch(this[s(i)]){case"-":return new zM(n-o);case"+":return new zM(n+o);case"/":return new zM(n/o);default:return new zM(n*o)}}[EM(220)](){const e=EM;return this.expr1+" "+this[e(353)]+" "+this.expr2}},"BinaryExpression"),O),QM=(LM(H=class{constructor(e){Bt(this,F,[]),Bt(this,I);this[EM(197)]=e}[(F=EM(504),I=EM(197),EM(435))](e){this[EM(504)].push(e)}[EM(206)](){const e=EM;for(const t of this[e(504)])t[e(206)]()}[EM(220)](){const e=EM;return""+this[e(504)][e(305)]("\n")}},EM(201)),H),eB=(LM(K=class extends Error{constructor(e){const t=EM;super(t(531)),Bt(this,W),this[t(197)]=e}[(W=EM(197),EM(206))](){throw this}[EM(220)](){return EM(212)}},"BreakStatement"),K),tB=(e=>{const t=183,i=248,s=297,r=444,n=EM;return e[n(442)]="+",e[n(t)]="-",e.MULTIPLY="*",e.DIVIDE="/",e.EQ="==",e[n(i)]="!=",e.SEQ=n(410),e[n(s)]="!==",e.LT="<",e[n(401)]="<=",e.GT=">",e[n(494)]=">=",e[n(r)]="&&",e.OR="||",e})(tB||{});LM(function(e){const t=535,i=EM;for(const[s,r]of Object[i(t)](tB))if(r===e)return s;return"EQ"},EM(252));var iB=(LM(Y=class{constructor(e,t,i,s){Bt(this,V),Bt(this,q),Bt(this,$),Bt(this,U);const r=EM;this[r(353)]=e,this[r(457)]=t,this[r(179)]=i,this[r(197)]=s}eval(){const e=245,t=410,i=417,s=464,r=353,n=410,o=515,a=245,l=464,c=EM,h=this[c(457)][c(e)](),u=this[c(179)][c(245)]();if(this[c(353)]===c(t)||this[c(353)]===c(285)){let e;return e=h instanceof $M&&u instanceof $M?h[c(417)]()===u[c(i)]():h instanceof zM&&u instanceof zM&&h[c(464)]()===u[c(s)](),new zM(this[c(r)]===c(n)?e:!e)}let d,f,p;switch(h instanceof $M?(d=d=h.asString()[c(o)](u.asString()),f=0):(d=this.expr1[c(a)]()[c(464)](),f=this.expr2.eval()[c(l)]()),this[c(353)]){case"<":p=d<f;break;case"<=":p=d<=f;break;case">":p=d>f;break;case">=":p=d>=f;break;case"!=":p=d!=f;break;case"&&":p=0!=d&&0!=f;break;case"||":p=0!=d||0!=f;break;default:p=d===f}return new zM(p)}[(V=EM(353),q=EM(457),$=EM(179),U=EM(197),EM(220))](){const e=179,t=EM;return this[t(457)]+" "+this[t(353)]+" "+this[t(e)]}},"ConditionalExpression"),Y),sB=(LM(X=class extends Error{constructor(e){super(EM(525)),Bt(this,G),this.token=e}[(G=EM(197),EM(206))](){throw this}toString(){return EM(542)}},"ContinueStatement"),X),rB=(LM(Q=class{constructor(e,t,i){Bt(this,"condition"),Bt(this,J),Bt(this,Z);const s=509,r=EM;this[r(344)]=e,this[r(s)]=t,this[r(197)]=i}[(J=EM(509),Z=EM(197),EM(206))](){const e=206,t=344,i=245,s=EM;do{try{this.statement[s(e)]()}catch(r){if(r instanceof eB)break;if(!(r instanceof sB))throw r}}while(0!=this[s(t)][s(i)]()[s(464)]())}toString(){const e=509,t=459,i=EM;return i(263)+this[i(e)]+i(t)+this[i(344)]+")\n"}},"DoWhileStatement"),Q),nB=(se=EM(386),ie=EM(505),te=EM(465),ee=EM(197),LM(re=class{constructor(e,t,i,s,r){Bt(this,se),Bt(this,"termination"),Bt(this,ie),Bt(this,te),Bt(this,ee);const n=EM;this[n(386)]=e,this[n(170)]=t,this[n(505)]=i,this[n(465)]=s,this[n(197)]=r}execute(){const e=206,t=245,i=464,s=505,r=206,n=206,o=EM;for(this[o(386)][o(e)]();0!=this.termination[o(t)]()[o(i)]();this[o(s)][o(r)]())try{this[o(465)][o(n)]()}catch(a){if(a instanceof eB)break;if(!(a instanceof sB))throw a}}toString(){const e=EM;return"for ("+this.initialization+"; "+this[e(170)]+"; "+this[e(505)]+")\n{\n"+this.block+"\n}"}},"ForStatement"),re),oB=(le=EM(266),ae=EM(438),oe=EM(439),ne=EM(197),LM(ce=class{constructor(e,t,i,s){Bt(this,le),Bt(this,ae),Bt(this,oe),Bt(this,ne);const r=EM;this[r(266)]=e,this[r(438)]=t,this[r(439)]=i,this.token=s}execute(){const e=EM;OM.set(this[e(266)],new qM(this[e(438)],this.body))}toString(){const e=EM,t=this[e(438)][e(289)](t=>t[e(220)]())[e(305)](", ");return e(498)+this[e(266)]+"("+t+")"}},"FunctionDefineStatement"),ce),aB=(LM(he=class{constructor(e,t){Bt(this,"functionalExpression"),Bt(this,"token");const i=EM;this.functionalExpression=e,this[i(197)]=t}[EM(206)](){const e=EM;this.functionalExpression[e(245)]()}[EM(220)](){const e=EM;return""+this[e(217)][e(220)]()}},EM(360)),he),lB=(LM(fe=class{constructor(e,t,i){Bt(this,"name"),Bt(this,de),Bt(this,ue);const s=224,r=EM;this[r(266)]=e,this[r(s)]=t,this[r(197)]=i}[(de=EM(224),ue=EM(197),EM(407))](e){const t=EM;return this[t(224)][t(462)](e)}eval(){const e=289,t=355,i=510,s=355,r=223,n=266,o=462,a=206,l=EM,c=this[l(224)][l(e)](e=>e.eval()),h=c[l(t)],u=OM[l(i)](this[l(266)]);if(u instanceof qM){const e=u;if(c[l(s)]!==e[l(216)]())throw new Error(l(r)+this[l(n)]+": expected "+h);VM[l(o)]();for(let i=0;i<h;i++)VM.set(e.getArgsName(i),c[i]);const t=e[l(a)](...c);return VM[l(340)](),t}return u[l(a)](...c)}toString(){const e=EM,t=this[e(224)][e(289)](t=>t[e(220)]()).join(", ");return this[e(266)]+"("+t+")"}},EM(364)),fe),cB=(LM(me=class{constructor(e,t,i,s){Bt(this,ve),Bt(this,"ifStatement"),Bt(this,ge),Bt(this,pe);const r=261,n=197,o=EM;this[o(154)]=e,this.ifStatement=t,this[o(r)]=i,this[o(n)]=s}[(ve=EM(154),ge=EM(261),pe=EM(197),EM(206))](){const e=168,t=206,i=206,s=EM;0!=this[s(154)][s(245)]()[s(464)]()?this[s(e)][s(t)]():null!=this[s(261)]&&this.elseStatement[s(i)]()}[EM(220)](){const e=154,t=261,i=EM;let s=i(242)+this[i(e)]+" "+this.ifStatement;return null!=this[i(261)]&&(s+=" else "+this[i(t)]),s[i(220)]()}},EM(463)),me),hB=(e=>{const t=EM;return e[e.PREFIX_INCREMENT=0]=t(380),e[e.PREFIX_DECREMENT=1]=t(341),e[e[t(455)]=2]="POSTFIX_INCREMENT",e[e[t(303)]=3]=t(303),e})(hB||{}),uB=(LM(be=class{constructor(e,t,i){Bt(this,"variable"),Bt(this,"type"),Bt(this,_e);const s=175,r=EM;this[r(513)]=e,this[r(s)]=t,this.token=i}[(_e=EM(197),EM(245))](){const e=510,t=175,i=534,s=EM,r=this[s(513)][s(361)](),n=VM[s(e)](r);if(!(n instanceof zM))throw new Error(s(507));const o=n.asNumber();let a;switch(this[s(t)]){case 0:return a=o+1,VM.set(r,new zM(a)),new zM(a);case 1:return a=o-1,VM[s(i)](r,new zM(a)),new zM(a);case 2:return VM[s(534)](r,new zM(o+1)),new zM(o);case 3:return VM.set(r,new zM(o-1)),new zM(o)}}},EM(446)),be),dB=(LM(ye=class{constructor(e,t){Bt(this,xe),Bt(this,"token");const i=EM;this.expression=e,this[i(197)]=t}[(xe=EM(154),EM(206))](){const e=EM;this[e(154)][e(245)]()}},EM(373)),ye),fB=(LM(Ce=class{constructor(e,t,i,s){Bt(this,ke),Bt(this,Se),Bt(this,"arguments"),Bt(this,we);const r=266,n=EM;this[n(412)]=e,this[n(r)]=t,this[n(224)]=i,this[n(197)]=s}[(ke=EM(412),Se=EM(266),we=EM(197),EM(245))](){throw new Error(EM(418))}[EM(220)](){const e=EM,t=this[e(224)].map(t=>t[e(220)]())[e(305)](", ");return this[e(412)][e(220)]()+"."+this[e(266)]+"("+t+")"}},EM(185)),Ce),pB=(LM(Ne=class{constructor(e,t,i,s){Bt(this,je),Bt(this,"argNames"),Bt(this,"body"),Bt(this,"token");const r=EM;this[r(266)]=e,this[r(438)]=t,this.body=i,this[r(197)]=s}[(je=EM(266),EM(206))](){}[EM(220)](){const e=289,t=404,i=266,s=EM,r=this.argNames[s(e)](e=>e[s(220)]())[s(305)](", ");return"//@"+this.name+"("+r+")\n"+this.body+s(t)+this[s(i)]}},EM(238)),Ne),gB=(LM(Be=class{constructor(e=new Map,t){Bt(this,Me),Bt(this,"token");const i=197,s=EM;this[s(399)]=e,this[s(i)]=t}[(Me=EM(399),EM(245))](){const e=399,t=371,i=EM,s=new Map;return this[i(e)][i(t)]((e,t)=>{const r=i;s[r(534)](t,e[r(245)]())}),new IM(s)}toString(){const e=289,t=305,i=EM;return"{"+Array[i(209)](this[i(399)].entries())[i(e)](([e,t])=>e+": "+t.toString())[i(t)](", ")+"}"}},"ObjectExpression"),Be),vB=(LM(De=class{constructor(e,t){Bt(this,"expression"),Bt(this,Ee);this[EM(154)]=e,this.token=t}[(Ee=EM(197),EM(206))](){const e=EM,t=this[e(154)][e(245)]().asString();console[e(365)](""+t)}[EM(220)](){return EM(362)+this.expression}},"PrintStatement"),De),mB=(LM(Pe=class{constructor(e,t,i){Bt(this,"receiver"),Bt(this,"name"),Bt(this,Le),this.receiver=e,this.name=t,this.token=i}eval(){throw new Error(EM(490))}[(Le=EM(197),EM(220))](){const e=220,t=EM;return this[t(412)][t(e)]()+"."+this.name}},EM(483)),Pe),_B=(LM(Oe=class{constructor(e,t,i){Bt(this,ze),Bt(this,Te),Bt(this,Ae),Bt(this,Re);const s=169,r=310,n=EM;this.token=i,this[n(s)]=e,this[n(r)]=t,this.value=new FM(e,t)}[(ze=EM(197),Te=EM(169),Ae=EM(310),Re=EM(204),EM(245))](){return this.value}toString(){const e=EM;return this[e(204)][e(417)]()}},"RegExpExpression"),Oe),bB=(LM(We=class extends Error{constructor(e,t){super(EM(525)),Bt(this,He),Bt(this,Fe),Bt(this,Ie),this.expression=e,this.token=t}getResult(){const e=EM;if(!this[e(482)])throw new Error("Not execute ReturnStatement");return this[e(482)]}[(He=EM(154),Fe=EM(482),Ie=EM(197),EM(206))](){const e=EM;throw this[e(482)]=this[e(154)].eval(),this}[EM(220)](){return EM(476)}},"ReturnStatement"),We),xB=(e=>{const t=138,i=182,s=151,r=269,n=286,o=427,a=419,l=419,c=497,h=497,u=470,d=442,f=183,p=183,g=546,v=526,m=526,_=345,b=481,x=433,y=433,w=488,S=214,k=346,C=489,j=489,N=271,M=443,B=432,E=318,D=225,L=429,P=458,R=491,A=480,T=300,z=147,O=357,I=EM;return e[e[I(138)]=0]=I(t),e[e[I(467)]=1]="WORD",e[e[I(i)]=2]="TEXT",e[e[I(151)]=3]=I(s),e[e[I(r)]=4]=I(r),e[e[I(286)]=5]=I(n),e[e.IF=6]="IF",e[e[I(211)]=7]=I(211),e[e[I(o)]=8]=I(427),e[e[I(a)]=9]=I(l),e[e.DO=10]="DO",e[e.BREAK=11]=I(192),e[e[I(c)]=12]=I(h),e[e[I(u)]=13]=I(470),e[e[I(456)]=14]=I(456),e[e.STEP=15]="STEP",e[e[I(d)]=16]=I(442),e[e.PLUSPLUS=17]="PLUSPLUS",e[e[I(f)]=18]=I(p),e[e[I(g)]=19]=I(546),e[e[I(v)]=20]=I(m),e[e[I(345)]=21]=I(_),e[e.EQ=22]="EQ",e[e[I(521)]=23]="EQEQ",e[e[I(481)]=24]=I(b),e[e[I(423)]=25]="EXCL",e[e[I(x)]=26]=I(y),e[e[I(488)]=27]=I(w),e[e.LT=28]="LT",e[e[I(214)]=29]=I(S),e[e.GT=30]="GT",e[e[I(k)]=31]=I(346),e[e[I(C)]=32]=I(j),e[e[I(N)]=33]=I(271),e[e.AMP=34]=I(313),e[e[I(443)]=35]=I(M),e[e[I(B)]=36]=I(B),e[e[I(478)]=37]=I(478),e[e.LBRACE=38]=I(E),e[e[I(225)]=39]=I(D),e[e.LBRACKET=40]=I(L),e[e.RBRACKET=41]="RBRACKET",e[e[I(458)]=42]=I(P),e[e[I(R)]=43]="COLON",e[e[I(538)]=44]=I(538),e[e[I(480)]=45]=I(A),e[e.ARROW=46]=I(T),e[e[I(147)]=47]=I(z),e[e[I(O)]=48]="CLOSE_META_BLOCK",e[e[I(523)]=49]=I(523),e})(xB||{}),yB=(LM(Ue=class{constructor(e,t){Bt(this,"value"),Bt(this,Ke);const i=279,s=204,r=EM;if(this[r(197)]=t,0!==t[r(i)]()){if(2!==t.getType())throw new Error(r(524)+t);this[r(s)]=new $M(e)}else this[r(204)]=new zM(parseFloat(e))}[(Ke=EM(197),EM(245))](){return this[EM(204)]}[EM(220)](){return""+this[EM(204)].asString()}},"ValueExpression"),Ue),wB=(LM(Ve=class{constructor(e,t,i){Bt(this,qe),Bt(this,$e),Bt(this,"token");this[EM(146)]=e,this.body=t,this.token=i}[(qe=EM(146),$e=EM(439),EM(206))](){}[EM(381)](){const e=204,t=EM;return this[t(146)]instanceof yB?this.label[t(e)].asString():""}[EM(220)](){const e=146,t=363,i=439,s=186,r=EM;return r(251)+this[r(e)]+r(t)+this[r(i)]+r(s)}},EM(153)),Ve),SB=(LM(Ge=class{constructor(e,t,i){Bt(this,Ye),Bt(this,"operator"),Bt(this,"token");const s=422,r=EM;this[r(337)]=e,this[r(s)]=t,this[r(197)]=i}[(Ye=EM(422),EM(245))](){const e=422,t=245,i=464,s=EM;return"-"===this[s(337)]?new zM(-this[s(e)][s(245)]()[s(464)]()):new zM(this[s(e)][s(t)]()[s(i)]())}[EM(220)](){const e=EM;return""+this[e(337)]+this[e(422)]}},EM(293)),Ge),kB=(LM(Ze=class{[(Xe=EM(229),EM(368))](){return Ze[EM(229)]}[EM(464)](){return NaN}[EM(417)](){return EM(451)}[EM(220)](){return this[EM(417)]()}},EM(234)),Bt(Ze,Xe,new Ze),Ze),CB=(LM(et=class{constructor(e,t){Bt(this,Qe),Bt(this,Je);const i=EM;this[i(200)]=e,this[i(197)]=t}[(Qe=EM(200),Je=EM(197),EM(206))](){const e=200,t=229,i=EM;for(const s of this[i(e)])if(s.init){const e=s[i(331)].eval();VM.set(s.name,e)}else VM[i(534)](s[i(266)],kB[i(t)])}[EM(220)](){const e=EM,t=this[e(200)].map(t=>t.init?t[e(266)]+e(436)+t[e(331)]:t.name).join(", ");return e(356)+t}},"VarStatement"),et),jB=(LM(st=class{constructor(e,t){Bt(this,it),Bt(this,tt);const i=EM;this.name=e,this[i(197)]=t}[(it=EM(266),tt=EM(197),EM(245))](){const e=266,t=510,i=EM;if(!VM[i(315)](this[i(e)]))throw new Error(i(309)+this[i(266)]+i(492));return VM[i(t)](this.name)}[EM(361)](){return this.name}toString(){return""+this[EM(266)]}},"VariableExpression"),st),NB=(LM(ot=class{constructor(e,t,i){Bt(this,"condition"),Bt(this,nt),Bt(this,rt),this.condition=e,this.statement=t,this.token=i}[(nt=EM(509),rt=EM(197),EM(206))](){const e=245,t=EM;for(;0!=this[t(344)][t(e)]().asNumber();)try{this.statement[t(206)]()}catch(i){if(i instanceof eB)break;if(!(i instanceof sB))throw i}}[EM(220)](){const e=344,t=347,i=509,s=EM;return s(400)+this[s(e)]+s(t)+this[s(i)]+"\n}"}},EM(319)),ot),MB=(LM(ht=class extends(ct=Error,lt=EM(545),at=EM(402),ct){constructor(e,t,i){const s=460,r=545,n=402,o=EM;super(e),Bt(this,lt),Bt(this,at),this.name=o(s),this[o(r)]=t,this[o(n)]=i}static at(e,t){const i=EM;return new ht(t,e[i(420)](),e[i(369)]())}},EM(460)),ht),BB=(LM(gt=class{constructor(e,t,i,s){Bt(this,pt),Bt(this,ft),Bt(this,dt),Bt(this,ut);const r=EM;this[r(175)]=e,this[r(461)]=t,this[r(402)]=i,this.line=s}getText(){return this[EM(461)]}getType(){return this[EM(175)]}getLine(){return this.line}[(pt=EM(461),ft=EM(175),dt=EM(402),ut=EM(545),EM(369))](){return this.column}toString(){const e=533,t=402,i=EM;return i(326)+xB[this.type]+i(424)+this.text+i(189)+this.line+i(e)+this[i(t)]+")"}},EM(333)),gt);function EB(e){const t=EM,i=Number(e);return!isNaN(i)&&e[t(454)]()===i[t(220)]()}function DB(e){return/^[a-zA-Zа-яА-ЯёЁ_$]$/.test(e)}function LB(e){return/^[a-zA-Zа-яА-ЯёЁ0-9_$]$/.test(e)}LM(EB,EM(163)),LM(DB,EM(474)),LM(LB,EM(372));var PB=new Set([0,1,2,4,37,41,17,19]);function RB(e,t){e-=138;const i=AM();let s=i[e];if(void 0===RB.DKyddV){RB.WxLmef=function(e){let t="",i="";for(let s,r,n=0,o=0;r=e.charAt(o++);~r&&(s=n%4?64*s+r:r,n++%4)?t+=String.fromCharCode(255&s>>(-2*n&6)):0)r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=".indexOf(r);for(let s=0,r=t.length;s<r;s++)i+="%"+("00"+t.charCodeAt(s).toString(16)).slice(-2);return decodeURIComponent(i)},RB.jZfeEv={},RB.DKyddV=!0}const r=e+i[0],n=RB.jZfeEv[r];return n?s=n:(s=RB.WxLmef(s),RB.jZfeEv[r]=s),s}function AB(e){return!PB[EM(392)](e)}LM(AB,EM(388));var TB=(LM(yt=class{constructor(e){Bt(this,xt,EM(434)),Bt(this,"OPERATORS",new Map([["+",16],["++",17],["-",18],["--",19],["*",20],["/",21],["(",36],[")",37],["{",38],["}",39],["[",40],["]",41],["=",22],["<",28],[">",30],[",",42],[":",43],[";",44],[".",45],["!",25],["&",34],["|",32],["==",23],[EM(410),24],["!=",26],[EM(285),27],["<=",29],[">=",31],["=>",46],["&&",35],["||",33]])),Bt(this,"input"),Bt(this,bt),Bt(this,_t,[]),Bt(this,"pos",0),Bt(this,"column",1),Bt(this,mt,1),Bt(this,vt,[]);const t=355,i=EM;this[i(239)]=e,this.length=e[i(t)]}[(xt=EM(378),bt=EM(355),_t=EM(393),mt=EM(545),vt=EM(259),EM(316))](){const e=355,t=284,i=408,s=317,r=473,n=379,o=545,a=402,l=493,c=EM;for(;this.pos<this[c(e)];){const e=this[c(448)](0);if(EB(e))this[c(311)]();else if(DB(e))this[c(t)]();else if('"'===e||"'"===e)this[c(i)](e);else if("`"===e)this[c(187)]();else if("//@"===this.peekGroup(3))this[c(219)]();else if("/"===e&&this.regexContextAllowed())this[c(237)]();else if(-1!==this[c(378)][c(s)](e))this.tokenizeOperator();else{if(" "!==e&&"\t"!==e&&"\r"!==e&&"\n"!==e&&"\ufeff"!==e)throw" "===e?new MB(c(n),this[c(o)],this[c(a)]):new MB("Unexpected character "+JSON[c(l)](e),this.line,this.column);this[c(r)]()}}return this[c(393)]}regexContextAllowed(){const e=393,t=393,i=EM;if("/"===this[i(448)](1)||"*"===this.peek(1))return!1;const s=0===this[i(393)].length?null:this[i(e)][this[i(t)][i(355)]-1];return null===s||AB(s[i(279)]())}[EM(237)](){const e=462,t=375,i=462,s=473,r=473,n=448,o=305,a=305,l=EM,c=this.column,h=this.line;this.next();const u=[];let d=!1,f=this[l(448)](0);for(;"\0"!==f;){if("\n"===f||"\r"===f)throw new MB(l(384),h,c);if("\\"!==f)if("["!==f||d)if("]"===f&&d)d=!1,u[l(462)](f),f=this.next();else{if("/"===f&&!d)break;u[l(462)](f),f=this.next()}else d=!0,u[l(i)](f),f=this[l(s)]();else{if(u[l(e)](f),f=this.next(),"\0"===f||"\n"===f||"\r"===f)throw new MB(l(t),h,c);u[l(e)](f),f=this[l(473)]()}}if("/"!==f)throw new MB("Unterminated regex literal (missing closing /).",h,c);this[l(r)]();const p=[];for(f=this[l(n)](0);"\0"!==f&&LB(f);)p[l(i)](f),f=this.next();this.addToken(3,u[l(o)]("")+"\0"+p[l(a)](""),c,h)}[EM(473)](){const e=516,t=402,i=402,s=EM,r=this[s(239)].charAt(this[s(e)]);return this[s(516)]++,"\n"==r?(this.line++,this[s(t)]=1):this[s(i)]++,this.peek(0)}[EM(448)](e){const t=355,i=239,s=EM,r=this.pos+e;return r>=this[s(t)]?"\0":this[s(i)][s(496)](r)}peekGroup(e){const t=448,i=EM,s=[];for(let r=0;r<e;r++)s.push(this[i(t)](r));return s[i(305)]("")}addToken(e,t,i,s){this[EM(393)].push(new BB(e,t,i,s))}tokenizeNumber(){const e=448,t=317,i=EM,s=this[i(402)],r=this[i(545)],n=[];let o=this[i(e)](0);for(;"\0"!==o;){if("."==o){if(-1!==n[i(t)]("."))throw new MB(i(148),this[i(545)],this[i(402)])}else if(!EB(o))break;n[i(462)](o),o=this.next()}this[i(243)](0,n.join(""),s,r)}[EM(231)](){const e=462,t=473,i=EM,s=[];let r=this.peek(0);for(;"\0"!==r&&LB(r);)s[i(e)](r),r=this[i(t)]();return s[i(305)]("")}[EM(219)](){const e=545,t=243,i=243,s=EM,r=this[s(402)],n=this[s(e)];this[s(473)](),this[s(473)](),this.next();const o=this[s(231)]();o[s(486)](s(173))?this[s(t)](48,o,r,n):this[s(i)](47,o,r,n)}tokenizeWord(){const e=241,t=425,i=195,s=243,r=243,n=528,o=243,a=367,l=243,c=EM,h=this[c(402)],u=this[c(545)],d=this[c(231)]();switch(d){case c(e):this.addToken(4,"",h,u);break;case"print":this.addToken(5,"",h,u);break;case"if":this[c(243)](6,"",h,u);break;case c(t):this[c(243)](7,"",h,u);break;case c(i):this[c(243)](9,"",h,u);break;case"while":this[c(s)](8,"",h,u);break;case"do":this[c(r)](10,"",h,u);break;case c(212):this[c(r)](11,"",h,u);break;case"continue":this[c(243)](12,"",h,u);break;case c(n):this[c(r)](13,"",h,u);break;case c(476):this[c(o)](14,"",h,u);break;case c(a):this[c(r)](15,"",h,u);break;default:this[c(l)](1,d,h,u)}}tokenizeText(e){const t=473,i=462,s=243,r=EM,n=this[r(402)],o=this.line;this[r(473)]();const a=[];let l=this[r(448)](0);for(;"\0"!==l;)if("\\"!=l){if(l==e)break;a[r(462)](l),l=this[r(t)]()}else{switch(l=this.next(),l){case e:l=this[r(t)](),a[r(462)](e);continue;case"n":l=this[r(473)](),a[r(i)]("\n");continue;case"t":l=this[r(473)](),a[r(462)]("\t");continue;case"\\":l=this.next(),a[r(i)]("\\");continue}a[r(462)]("\\"),"\0"!==l&&(a[r(i)](l),l=this.next())}if("\0"===l)throw new MB(r(529),o,n);this.next();const c=a[r(305)]("");this[r(s)](2,c,n,o)}[EM(187)](){const e=473,t=448,i=290,s=305,r=EM,n=this[r(402)],o=this[r(545)];this[r(e)]();const a=[];let l=this[r(t)](0);for(;"\0"!==l&&"`"!==l;){if("$"===l&&"{"===this.peek(1))throw new MB("Template interpolation `${...}` is not allowed in unotest DSL strings. Use positional args instead: evaluate('return arg.x', {arg: value}).",this.line,this[r(402)]);a[r(462)](l),l=this[r(473)]()}if("\0"===l)throw new MB(r(i),o,n);this.next(),this[r(243)](2,a[r(s)](""),n,o)}[EM(264)](e,t){const i=176,s=317,r=462,n=454,o=EM,a=[];let l=this[o(448)](0);for(;-1==o(i)[o(s)](l);)a[o(r)](l),l=this.next();this[o(259)].push({line:e,column:t,text:a[o(305)]("")[o(n)]()})}tokenizeMultilineComment(e,t){const i=448,s=473,r=296,n=259,o=305,a=EM,l=[];let c=this.peek(0);for(;"\0"!=c&&("*"!=c||"/"!=this[a(i)](1));)l[a(462)](c),c=this[a(s)]();if("\0"==c)throw new MB(a(r),e,t);this[a(473)](),this[a(473)](),this[a(n)].push({line:e,column:t,text:l[a(o)]("").trim()})}[EM(351)](){const e=473,t=473,i=264,s=448,r=268,n=402,o=392,a=510,l=243,c=462,h=473,u=215,d=EM;let f=this[d(448)](0);if("/"==f){const n=this[d(545)],o=this.column;if("/"==this[d(448)](1))return this[d(e)](),this[d(t)](),void this[d(i)](n,o);if("*"==this[d(s)](1))return this.next(),this[d(e)](),void this[d(r)](n,o)}const p=this[d(n)],g=this.line,v=[];for(;"\0"!==f;){const e=v[d(305)]("");if(!this[d(394)][d(o)](e+f)&&""!=e){const t=this.OPERATORS[d(a)](e);if(!t)throw new MB("Invalid tokenizeOperator "+e,g,p);return void this[d(l)](t,"",p,g)}v[d(c)](f),f=this[d(h)]()}const m=v[d(305)]("");if(""!==m){const e=this.OPERATORS[d(a)](m);if(e)return void this[d(243)](e,"",p,g)}throw new MB(d(u),g,p)}},EM(389)),yt);function zB(e,t,i,s=2){const r=335,n=543,o=355,a=227,l=541,c=EM,h=e[c(469)](/\r\n|\n|\r/),u=Math.min(Math[c(r)](t,1),h[c(355)]),d=Math[c(335)](1,u-s),f=Math[c(n)](h.length,u+s),p=String(f)[c(o)],g=[];for(let v=d;v<=f;v++){const e=h[v-1]??"",t=String(v)[c(472)](p);if(v!==u){g[c(462)](c(519)+t+c(a)+e);continue}g.push(" > "+t+" | "+e);const s=Math[c(n)](Math.max(i,1),e[c(355)]+1)-1;g[c(462)](c(519)+" "[c(541)](p)+" | "+" "[c(l)](s)+"^")}return g.join("\n")}LM(zB,EM(332)),LM(function(e,t){const i=298,s=402,r=EM;return t.message+r(i)+t[r(545)]+r(221)+t[r(402)]+")\n"+zB(e,t.line,t[r(s)])},EM(287));var OB=(LM(Nt=class{constructor(e){Bt(this,jt,new BB(49,"",-1,-1)),Bt(this,Ct,[]),Bt(this,kt,0),Bt(this,St);const t=EM;this.tokens=e,this.size=e[t(355)]}parse(){const e=509,t=EM,i=this.get(0),s=new QM(i);for(;!this[t(440)](49);)s.add(this[t(e)]()),this[t(440)](44);return s}statementOrBlock(){const e=EM;return 38===this[e(510)](0)[e(279)]()?this.block():this[e(509)]()}[(jt=EM(523),Ct=EM(393),kt=EM(516),St=EM(277),EM(247))](e){const t=EM,i=this[t(510)](0),s=new QM(i);for(;!this.match(48);)s.add(this[t(509)]()),this.match(44);return s}[EM(194)](){const e=141,t=141,i=247,s=EM,r=this[s(510)](0),n=this[s(e)](47)[s(302)]();this[s(t)](36);const o=[];for(;!this[s(440)](37);)o[s(462)](this[s(141)](2).getText()),this[s(440)](42);const a=this[s(i)](n);return new pB(n,o,a,r)}stepStatement(e){const t=141,i=465,s=EM;this.consume(36);const r=this[s(154)]();this[s(141)](42),this[s(t)](36),this[s(141)](37),this[s(141)](46);const n=this[s(i)]();return this.consume(37),new wB(r,n,e)}[EM(465)](){const e=EM,t=this[e(510)](0),i=new QM(t);for(this[e(141)](38);!this[e(440)](39);)i.add(this.statement()),this[e(440)](44);return i}[EM(509)](){const e=440,t=350,i=330,s=440,r=440,n=440,o=270,a=485,l=155,c=485,h=155,u=141,d=EM,f=this.get(0);if(this[d(e)](4))return this[d(t)](f);if(this[d(440)](5))return new vB(this[d(154)](),f);if(this.match(6))return this[d(258)](f);if(this[d(440)](8))return this[d(i)](f);if(this.match(10))return this.doWhileStatement(f);if(this[d(s)](11))return new eB(f);if(this[d(440)](12))return new sB(f);if(this[d(440)](14))return new bB(this.expression(),f);if(this[d(r)](9))return this.forStatement(f);if(this[d(n)](13))return this[d(o)](f);if(this[d(440)](15))return this[d(520)](f);if(this.lookMatch(0,47))return this.metaBlock();if(this[d(485)](0,1)&&this[d(a)](1,36)){const e=this[d(l)](this.functionExpression(f));return new aB(e,f)}if(this[d(485)](0,1)&&this[d(c)](1,45)){const e=new jB(this.consume(1)[d(302)](),f),t=this[d(h)](e);if(!(t instanceof fB))throw MB.at(f,d(397));return new aB(t,f)}if(this[d(440)](17)){const e=new jB(this[d(u)](1)[d(302)](),f);return new dB(new uB(e,0,f),f)}if(this.match(19)){const e=new jB(this.consume(1)[d(302)](),f);return new dB(new uB(e,1,f),f)}if(this[d(485)](0,1)&&(this[d(485)](1,17)||this.lookMatch(1,19))){const e=this[d(u)](1),t=new jB(e[d(302)](),e);return this[d(s)](17)?new dB(new uB(t,2,e),e):(this[d(141)](19),new dB(new uB(t,3,e),e))}return this.assignmentStatement()}varStatement(e){const t=141,i=392,s=398,r=440,n=EM,o=[];do{const e=this[n(t)](1),r=e[n(302)]();if(Nt.RESERVED_WORDS[n(i)](r))throw MB.at(e,n(s)+r+"' is a reserved JavaScript keyword. Use a different name.");let a=null;this.match(22)&&(a=this.expression()),o[n(462)]({name:r,init:a})}while(this[n(r)](42));return new CB(o,e)}assignmentStatement(){const e=485,t=302,i=510,s=279,r=EM,n=this.get(0);if(this[r(e)](0,1)&&this[r(485)](1,22)){const e=this[r(141)](1)[r(t)]();return this.consume(22),new ZM(e,this[r(154)](),n)}if(this[r(485)](0,1)&&this[r(485)](1,40)){const e=this[r(502)](n);return this[r(141)](22),new GM(e,this.expression(),n)}throw MB.at(this[r(i)](0),"Unknown statement: unexpected "+xB[this[r(510)](0)[r(s)]()])}[(wt=EM(236),EM(258))](e){const t=157,i=440,s=EM,r=this[s(154)](),n=this[s(t)]();let o;return o=this[s(i)](7)?this[s(t)]():null,new cB(r,n,o,e)}doWhileStatement(e){const t=EM,i=this.statementOrBlock();this[t(141)](8);const s=this.expression();return new rB(s,i,e)}whileStatement(e){const t=EM,i=this[t(154)](),s=this[t(157)]();return new NB(i,s,e)}forStatement(e){const t=510,i=414,s=EM;let r;if(this[s(141)](36),this.match(4))throw MB.at(this[s(t)](-1),"'var' in for-loop initialization is not supported by the Blockly converter. Use plain assignment: 'for (k = 1; k <= N; k = k + 1)'.");r=this[s(i)](),this.consume(44);const n=this.expression();this.consume(44);const o=this.statement();this.consume(37);const a=this[s(157)]();return new nB(r,n,o,a,e)}functionDefine(e){const t=EM,i=this[t(141)](1)[t(302)]();this[t(141)](36);const s=[];for(;!this.match(37);)s[t(462)](this.consume(1)[t(302)]()),this[t(440)](42);const r=this[t(157)]();return new oB(i,s,r,e)}[EM(445)](e){const t=141,i=440,s=154,r=EM,n=this.consume(1).getText();this[r(t)](36);const o=new lB(n,[],e);for(;!this[r(i)](37);)o[r(407)](this[r(s)]()),this.match(42);return o}elementExpression(e){const t=141,i=462,s=141,r=EM,n=this[r(141)](1)[r(302)](),o=[];do{this[r(t)](40),o[r(i)](this.expression()),this[r(s)](41)}while(this.lookMatch(0,40));return new YM(n,o,e)}[EM(544)](e){const t=462,i=154,s=EM;this[s(141)](40);const r=[];for(;!this.match(41);)r[s(t)](this[s(i)]()),this.match(42);return new XM(r,e)}[EM(329)](e){const t=485,i=154,s=EM;this[s(141)](38);const r=new Map;for(;!this[s(440)](39);){let e;if(this[s(t)](0,1))e=this.consume(1)[s(302)]();else{if(!this[s(485)](0,2))throw MB.at(this.get(0),s(199));e=this[s(141)](2)[s(302)]()}this.consume(43);const n=this[s(i)]();r.set(e,n),this[s(440)](42)}return new gB(r,e)}[EM(154)](){return this[EM(501)]()}[EM(501)](){const e=EM;let t=this[e(409)]();for(;this[e(440)](33);){const i=this[e(510)](0);t=new iB("||",t,this[e(409)](),i)}return t}[EM(409)](){const e=510,t=180,i=EM;let s=this.equality();for(;this.match(35);){const r=this[i(e)](0);s=new iB("&&",s,this[i(t)](),r)}return s}[EM(180)](){const e=440,t=285,i=273,s=EM,r=this.get(0),n=this[s(273)]();return this[s(e)](23)?new iB("==",n,this.conditional(),r):this[s(440)](24)?new iB(s(410),n,this.conditional(),r):this[s(440)](26)?new iB("!=",n,this[s(273)](),r):this[s(440)](27)?new iB(s(t),n,this[s(i)](),r):n}conditional(){const e=485,t=440,i=EM;let s=this[i(272)]();for(;this[i(e)](0,28)||this[i(485)](0,29)||this.lookMatch(0,30)||this.lookMatch(0,31);){const e=this[i(510)](0);this.match(28)?s=new iB("<",s,this.additive(),e):this[i(t)](29)?s=new iB("<=",s,this[i(272)](),e):this[i(t)](30)?s=new iB(">",s,this.additive(),e):this[i(440)](31)&&(s=new iB(">=",s,this.additive(),e))}return s}[EM(272)](){const e=440,t=395,i=EM;let s=this.multiplicate();for(;this[i(485)](0,16)||this[i(485)](0,18);){if(this[i(e)](16)){const e=this[i(510)](-1);s=new JM("+",s,this[i(t)](),e);continue}this[i(141)](18);const r=this.get(-1);s=new JM("-",s,this.multiplicate(),r)}return s}[EM(395)](){const e=485,t=485,i=440,s=510,r=159,n=EM;let o=this.unary();for(;this[n(e)](0,20)||this[n(t)](0,21);){if(this[n(i)](20)){const e=this[n(s)](-1);o=new JM("*",o,this[n(r)](),e);continue}this[n(141)](21);const e=this.get(-1);o=new JM("/",o,this.unary(),e)}return o}[EM(159)](){const e=EM,t=this.get(0);if(this[e(440)](18))return new SB("-",this[e(348)](),t);if(this.match(17)){const i=new jB(this[e(141)](1)[e(302)](),t);return new uB(i,0,t)}if(this[e(440)](19)){const i=new jB(this.consume(1)[e(302)](),t);return new uB(i,1,t)}return this[e(348)]()}[EM(348)](){const e=495,t=445,i=544,s=485,r=440,n=302,o=154,a=334,l=EM,c=this[l(510)](0);let h;if(this[l(440)](0))h=new yB(c[l(302)](),c);else if(this.match(3)){const t=c.getText(),i=t[l(317)]("\0"),s=i<0?t:t[l(495)](0,i),r=i<0?"":t[l(e)](i+1);h=new _B(s,r,c)}else if(this[l(485)](0,1)&&this[l(485)](1,36))h=this[l(t)](c);else if(this.lookMatch(0,1)&&this.lookMatch(1,40))h=this[l(502)](c);else if(this.lookMatch(0,40))h=this[l(i)](c);else if(this[l(s)](0,38))h=this[l(329)](c);else if(this.match(1)){const e=new jB(c[l(302)](),c);h=e,this[l(440)](17)?h=new uB(e,2,c):this.match(19)&&(h=new uB(e,3,c))}else if(this[l(r)](2))h=new yB(c[l(n)](),c);else{if(!this.match(36))throw MB.at(c,l(a)+xB[c[l(279)]()]);h=this[l(o)](),this.match(37)}return this.callWithPostfix(h)}callWithPostfix(e){const t=279,i=141,s=440,r=154,n=485,o=EM;let a=e;for(;this[o(440)](45);){const e=this[o(510)](0);if(1!==e[o(t)]())throw MB.at(e,o(517));const n=this[o(i)](1).getText();if(this[o(s)](36)){const t=[];for(;!this[o(s)](37);)t.push(this[o(r)]()),this[o(440)](42);a=new fB(a,n,t,e)}else a=new mB(a,n,e)}if(this[o(n)](0,40)&&!(a instanceof jB))throw MB.at(this[o(510)](0),o(532));return a}[EM(141)](e){const t=327,i=EM,s=this[i(510)](0);if(e!=s[i(279)]())throw MB.at(s,i(t)+xB[s[i(279)]()]+i(280)+xB[e]);return this.pos++,s}[EM(440)](e){const t=EM;return e==this[t(510)](0).getType()&&(this[t(516)]++,!0)}[EM(485)](e,t){const i=EM;return this[i(510)](e)[i(279)]()==t}[EM(510)](e){const t=EM,i=this[t(516)]+e;return i>=this[t(277)]?this[t(523)]:this.tokens[i]}},EM(479)),Bt(Nt,wt,new Set([EM(210),EM(267),EM(278),"undefined",EM(178),EM(282),EM(143),EM(342),EM(292),"typeof","instanceof","in","of",EM(218),"export",EM(193),EM(527),EM(522),"this",EM(354),EM(145),EM(275),EM(149),"finally",EM(511),EM(471),"with",EM(413),EM(307),EM(244)])),Nt);function IB(e,t){e-=303;var i=FB(),s=i[e];if(void 0===IB.vllYuV){IB.QwUsYm=function(e){for(var t,i,s="",r="",n=0,o=0;i=e.charAt(o++);~i&&(t=n%4?64*t+i:i,n++%4)?s+=String.fromCharCode(255&t>>(-2*n&6)):0)i="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=".indexOf(i);for(var a=0,l=s.length;a<l;a++)r+="%"+("00"+s.charCodeAt(a).toString(16)).slice(-2);return decodeURIComponent(r)},IB.GItnza={},IB.vllYuV=!0}var r=e+i[0],n=IB.GItnza[r];return n?s=n:(s=IB.QwUsYm(s),IB.GItnza[r]=s),s}function FB(){var e=["mJaYmda2zxHnCvrP","nte3nZeZyLvssvD2","mJbot1bhDey","nJC0mZqZtw9Oswnq","ndm5nJy1v0HcyLDS","ntmZmte1Dwf0y01r","nKLwAgDXuq","nJa4mJe4qMr3wLzZ","mJiWmtuZnKvKq2DUuq"];return(FB=function(){return e})()}!function(){for(var e=303,t=311,i=304,s=306,r=310,n=305,o=IB,a=FB();;)try{if(300329===-parseInt(o(309))/1+-parseInt(o(307))/2+parseInt(o(e))/3+parseInt(o(t))/4*(parseInt(o(i))/5)+parseInt(o(s))/6*(-parseInt(o(r))/7)+parseInt(o(308))/8+-parseInt(o(n))/9)break;a.push(a.shift())}catch(l){a.push(a.shift())}}();class HB extends Error{constructor(e){super(e),this.name="ScenarioBodyParseError"}}function WB(e){let t;try{t=new OB(new TB(e).tokenize()).parse()}catch(r){throw new HB(r instanceof Error?r.message:String(r))}const i=t.statements.find(e=>e instanceof oB&&(e.name.startsWith("test_")||e.name.startsWith("flow_")));if(!i)throw new HB("no 'function test_*()' declaration found");if(!(i.body instanceof QM))throw new HB("function body is not a block");const s=e.split(/\r?\n/);return KB(i.body.statements,s,{n:0})}function KB(e,t,i){const s=[];for(const r of e)if(r instanceof wB)s.push({kind:"block",title:UB(r.label),children:KB(r.body.statements,t,i)});else if(r instanceof pB)s.push({kind:"block",title:r.argNames[0]??"",children:KB($B(r.body),t,i)});else{if(r instanceof cB){const e={kind:"control",...qB(r,t,i,r.ifStatement),children:KB($B(r.ifStatement),t,i)};r.elseStatement&&(e.elseChildren=KB($B(r.elseStatement),t,i)),s.push(e);continue}if(r instanceof nB||r instanceof NB||r instanceof rB){const e=r instanceof nB?r.block:r.statement;s.push({kind:"control",...qB(r,t,i,e),children:KB($B(e),t,i)});continue}s.push({kind:"step",...qB(r,t,i)})}return s}function UB(e){var t;const i=e.value;return(null==(t=null==i?void 0:i.asString)?void 0:t.call(i))??""}function $B(e){return e instanceof QM?e.statements:[e]}function qB(e,t,i,s){const{line:r,col:n}=VB(e),o=s instanceof QM?VB(s).line:r,a=t.slice(r-1,Math.max(r,o)).map(e=>e.trim()).filter(e=>e.length>0).join(" ");return{index:i.n++,line:r,col:n,source:a}}function VB(e){const t=e.token;return{line:(null==t?void 0:t.getLine)?t.getLine():0,col:(null==t?void 0:t.getColumn)?t.getColumn():0}}const YB=gi.lazy(()=>Dj(()=>import("./DslEditor-CvL23vIm.js"),__vite__mapDeps([0,1])).then(e=>({default:e.DslEditor}))),GB=__(function({runId:e}){var t,i,s;const r=w_(),n=r.activeRuns.byRunId.get(e)??null,o=r.historicRuns.get(e),[a,l]=gi.useState(n?n.plainRun?"steps":"code":"steps");gi.useEffect(()=>{n||r.historicRuns.loadIfNeeded(e)},[r,e,n]),gi.useEffect(()=>{let t,i=!1;const s=async()=>{if(i)return;if(await r.runSources.loadIfNeeded(e),i)return;void 0===r.runSources.get(e)&&r.activeRuns.byRunId.has(e)&&(t=setTimeout(()=>{s()},300))};return s(),()=>{i=!0,t&&clearTimeout(t)}},[r,e]),gi.useEffect(()=>{n&&r.activeRuns.syncRuntime(e)},[r,e,n]);const c=n?function(e){return{events:e.events,status:sE(e.status),scenario:e.scenario,startedAt:e.startedAt,durationMs:null,abortable:"starting"===e.status||"running"===e.status||"paused"===e.status,outcome:e.outcome}}(n):o?function(e){const t="scenario"===e.meta.kind?e.events:[];return{events:t,status:fj(e.meta),scenario:e.meta.ref,startedAt:e.meta.startedAt,durationMs:e.meta.durationMs,abortable:!1,outcome:e.meta.outcome}}(o):null,h=(null==c?void 0:c.scenario)||(null==o?void 0:o.meta.ref)||(null==n?void 0:n.scenario)||"",u=r.scenarios.items.find(e=>e.name===h),d=r.runSources.get(e),f="authoring"===(null==n?void 0:n.mode),p=f?(null==u?void 0:u.path)??(null==d?void 0:d.entry)??null:null;gi.useEffect(()=>{p&&r.source.getOrLoad(p)},[r,p]);const g=p?r.source.draft(p)??null:null,v=p??(null==d?void 0:d.entry)??"",m=f?g:d?d.files[d.entry]??null:null,_=f?null!==g:void 0!==d,b=gi.useMemo(()=>{if(null==m)return null;try{return WB(m)}catch{return null}},[m]),x=WN(e),y=gi.useMemo(()=>{if(!b||!c)return;const e=function(e,t,i){const s=jM(t),r=[];let n=null;const o=new Map;for(const a of e)if("step:started"===a.kind){const e=a.file===i?NM(s,a.line,a.col):null;r.push({idx:e})}else if("step:ok"===a.kind||"step:fail"===a.kind){const e=r.pop();null!=(null==e?void 0:e.idx)&&(n=e.idx)}else if("screenshot"===a.kind){if(null!=a.line&&null!=a.col&&(null==a.file||a.file===i)){const e=NM(s,a.line,a.col);if(null!=e){o.set(e,a.path);continue}}const e=[...r].reverse().find(e=>null!=e.idx),t=(null==e?void 0:e.idx)??n;null!=t&&o.set(t,a.path)}return o}(c.events,b,v);if(0===e.size)return;const t=new Map;for(const[i,s]of e){const e=x.resolveUrl({kind:"event",path:s});e&&t.set(i,e)}return t.size>0?t:void 0},[b,c,v,x]),w=gi.useMemo(()=>b&&y?function(e,t){const i=[],s=(e,r)=>{for(const n of e){if("block"===n.kind){s(n.children,n.title);continue}const e=t.get(n.index);null!=e&&i.push({stepIndex:n.index,url:e,blockTitle:r,source:n.source,line:n.line}),"control"===n.kind&&(s(n.children,r),n.elseChildren&&s(n.elseChildren,r))}};return s(e,null),i}(b,y):[],[b,y]),[S,k]=gi.useState(null),[C,j]=gi.useState(null),N=gi.useCallback(e=>{var t;k(e),j((null==(t=w[e])?void 0:t.stepIndex)??null)},[w]),M=gi.useCallback(e=>{const t=function(e,t){return e.findIndex(e=>e.stepIndex===t)}(w,e);t>=0&&N(t)},[w,N]);if(!c)return r.historicRuns.errors.has(e)?ki.jsx(rj,{id:e}):ki.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading run…"});const B="failed"===c.status,E="passed"===c.status||"failed"===c.status||"aborted"===c.status,D=b?MM(c.events,b,v):null,L=D?Object.values(D).reduce((e,t)=>("passed"===t.status?e.passed++:"failed"===t.status?e.failed++:"running"===t.status?e.running++:e.pending++,e),{passed:0,failed:0,running:0,pending:0}):{passed:0,failed:0,running:0,pending:0},P="paused"===(null==n?void 0:n.status),R="starting"===(null==n?void 0:n.status)||"running"===(null==n?void 0:n.status),A=r.session.capabilities.canRun,T=r.targets.activeDebugCaps,z=A&&T.picker&&(P||f&&R),O=A&&P&&("failure"!==(null==(t=null==n?void 0:n.pausedAt)?void 0:t.reason)||T.resumeFromFailure),I=null!=(null==n?void 0:n.pausedAt)&&(null===n.pausedAt.file||n.pausedAt.file===v),F=P&&(null==n?void 0:n.pausedAt)&&I?function(e,t,i){var s;if(!e)return;const r=SN(e),n=r.find(e=>e.line===t&&e.col===i);return n?n.index:null==(s=r.find(e=>e.line===t))?void 0:s.index}(b,n.pausedAt.line,n.pausedAt.col):void 0,H=(null==u?void 0:u.path)??v,W=P&&(null==(i=null==n?void 0:n.pausedAt)?void 0:i.file)?n.pausedAt.file:H,K=W===H||W===v,U=B&&b?function(e,t){var i;return e&&null!=t?null==(i=SN(e).find(e=>e.index===t))?void 0:i.line:void 0}(b,BM(c.events,b,v)):void 0;let $,q;P&&(null==n?void 0:n.pausedAt)?"failure"===n.pausedAt.reason?q=n.pausedAt.line:$=n.pausedAt.line:K&&(q=U);const V=null==u?void 0:u.name,Y=V?r.breakpoints.get(V):void 0,G=new Set;if(Y)for(const Q of Y)G.add(Number(Q.split(":")[0]));if(K&&n)for(const Q of n.breakpoints)G.add(Number(Q.split(":")[0]));const X=(t,i)=>{if(!V)return;r.breakpoints.toggle(V,t,i)?r.activeRuns.setBreakpoint(e,t,i):r.activeRuns.clearBreakpoint(e,t,i)},Z=(null==u?void 0:u.name)||h,J=A&&!R&&!P&&!c.abortable&&!!Z?()=>{r.activeRuns.startScenario(Z,{headed:!1,debug:!1}).then(e=>{r.tabs.open({kind:"scenario-run",runId:e.runId})})}:null;return ki.jsxs("div",{className:"flex h-full min-w-0 gap-1.5 bg-shell",children:[ki.jsxs("section",{className:fx("flex min-w-0 flex-1 flex-col overflow-hidden bg-canvas",r.layout.inspectorOpen&&"rounded-r-lg"),children:[ki.jsx(ZB,{title:(null==u?void 0:u.title)??h??e,onOpenScenario:u?()=>r.tabs.open({kind:"scenario",path:u.path}):null,color:(null==u?void 0:u.color)??null,status:c.status,viewMode:a,onViewMode:l,onRunAgain:J,onAbort:c.abortable&&A?()=>{r.activeRuns.abort(e)}:null,onContinue:O?()=>{r.activeRuns.continueRun(e)}:null,onStep:O?()=>{r.activeRuns.step(e)}:null,onPause:R&&!f&&A?()=>{r.activeRuns.pauseRun(e)}:null,picker:z?(null==n?void 0:n.picker)??null:null,onPick:z?t=>{r.activeRuns.togglePicker(e,t)}:null,execute:!!z&&((null==(s=null==n?void 0:n.picker)?void 0:s.execute)??!1),onSetExecute:z?t=>{r.activeRuns.setPickerExecute(e,t)}:null,wheel:(null==n?void 0:n.wheel)??"human",isAuthoring:f,onSetWheel:A&&T.attach&&(R||P)?t=>{r.activeRuns.setWheel(e,t)}:null,onExport:R?null:()=>function(e){if(!window.confirm("Export this run as a .unotest.zip snapshot?\n\nThe bundle is a verbatim capture — it can include secrets from fill() values, console output and network request headers. Share it only with people you trust."))return;const t=document.createElement("a");t.href=`/api/runs/${encodeURIComponent(e)}/export`,t.rel="noopener",document.body.appendChild(t),t.click(),t.remove()}(e),inspectorOpen:r.layout.inspectorOpen,onToggleInspector:r.layout.toggleInspector}),P&&(null==n?void 0:n.pausedAt)&&ki.jsx(tE,{reason:n.pausedAt.reason,stepIndex:F??-1,file:n.pausedAt.file??v??h??e,line:n.pausedAt.line,col:n.pausedAt.col}),ki.jsx(iE,{counts:L}),ki.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:"code"===a?ki.jsx(gi.Suspense,{fallback:ki.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading editor…"}),children:ki.jsx(YB,{path:W,fileKind:K?"scenario":"helper",...null!=$?{highlightLine:$}:{},...null!=q?{errorLine:q}:{},...K&&V?{breakpointLines:G,onToggleBreakpoint:e=>{const t=b?SN(b).find(t=>t.line===e):void 0;t&&X(e,t.col)}}:{}})}):ki.jsx("div",{className:"h-full overflow-y-auto",children:b?ki.jsx(jN,{body:b,...D?{trace:D}:{},...y?{screenshots:y,onOpenScreenshot:M,...null!=C?{activeScreenshotIndex:C}:{}}:{},...null!=F?{pausedIndex:F}:{},bpKeys:Y,onToggleBp:V?X:void 0,...B?{failedIndex:BM(c.events,b,v)??void 0}:{},...B?{onFailedStepRender:t=>{const i=zN(c.events,"step:fail");if(!i)return null;const s=zN(c.events,"failure-bundle:written");return ki.jsx(TN,{errorName:i.errorName??"Error",message:i.error,file:(null==u?void 0:u.path)??h??e,line:t.line,source:t.source,index:t.index,...(null==s?void 0:s.url)?{url:s.url}:{}})}}:{}}):ki.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:_?null===d?"No source snapshot for this run — a collection keeps them on its scenarios, and a run that never started a step has none.":"could not parse source snapshot":"loading run…"})})})]}),null!=S&&w[S]&&ki.jsx(PN,{strip:w,position:S,onNavigate:N,onClose:()=>k(null)}),r.layout.inspectorOpen&&ki.jsx($N,{runId:e,active:n,events:c.events,isFailed:B,runFinished:E})]})});const XB={locator:{icon:"target",label:"Locator",hint:"click an element to insert its locator"},text:{icon:"text",label:"Text",hint:"click an element to insert a text assertion"},visibility:{icon:"eye",label:"Visibility",hint:"click an element to insert a visibility assertion"}};function ZB({title:e,color:t,status:i,viewMode:s,onViewMode:r,onRunAgain:n,onAbort:o,onContinue:a,onStep:l,onPause:c,picker:h,onPick:u,execute:d,onSetExecute:f,wheel:p,onSetWheel:g,isAuthoring:v,onExport:m,inspectorOpen:_,onToggleInspector:b,onOpenScenario:x}){const y="paused"===i;return ki.jsxs("div",{className:"shrink-0 border-b border-edge bg-canvas",children:[ki.jsxs("div",{className:"flex h-10 items-center gap-3 px-4",children:[ki.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[t&&ki.jsx("span",{"aria-hidden":!0,className:"h-4 w-1 shrink-0 rounded-sm",style:{backgroundColor:t}}),ki.jsx("div",{className:"truncate text-[13px] font-medium text-fg",children:e}),x&&ki.jsxs("button",{type:"button","aria-label":"Open the test",onClick:x,className:"group relative grid h-5 w-5 shrink-0 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fg-2",children:[ki.jsx(gx,{name:"file",className:"h-3.5 w-3.5"}),ki.jsx(Lj,{label:"Open the test"})]}),v?ki.jsx(oj,{tone:"info",children:"authoring"}):!y&&ki.jsx(oj,{tone:gj(i),children:i})]}),ki.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[g&&ki.jsx(JB,{wheel:p,onSet:g}),ki.jsx(Pj,{value:s,onChange:r,options:[{value:"steps",label:"Steps",icon:"list",title:"Show the step tree"},{value:"code",label:"Code",icon:"braces",title:"Show the test source"}]}),ki.jsx("div",{className:"h-4 w-px bg-edge-soft"}),ki.jsxs("button",{type:"button",onClick:b,"aria-pressed":_,className:fx("group relative grid h-6 w-6 place-items-center rounded",_?"bg-raised text-fg":"text-fg-4 hover:bg-raised hover:text-fg-2"),children:[ki.jsx(gx,{name:"panelRight",className:"h-4 w-4"}),ki.jsx(Lj,{label:_?"Hide inspector":"Show inspector"})]})]})]}),ki.jsxs("div",{className:"flex h-10 items-center gap-3 border-t border-edge-soft px-4",children:[ki.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[n&&ki.jsx(CM,{icon:"play",tooltip:"Run this scenario again",onClick:n,children:ki.jsx("span",{className:"hidden sm:inline",children:"Run again"})}),a&&ki.jsx(CM,{variant:"primary",icon:"play",tooltip:"Resume execution",tooltipHint:"F8",onClick:a,children:ki.jsx("span",{className:"hidden sm:inline",children:"Continue"})}),l&&ki.jsx(CM,{icon:"stepOver",tooltip:"Step over",tooltipHint:"F10",onClick:l,children:ki.jsx("span",{className:"hidden sm:inline",children:"Step"})}),c&&ki.jsx(CM,{icon:"pause",tooltip:"Pause the run",tooltipHint:"F6",onClick:c,children:ki.jsx("span",{className:"hidden sm:inline",children:"Pause"})}),o&&ki.jsx(CM,{variant:"danger",icon:"square",tooltip:y?"Stop the run":"Abort the run",onClick:o,children:ki.jsx("span",{className:"hidden sm:inline",children:y?"Stop":"Abort"})})]}),ki.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[u&&ki.jsxs(ki.Fragment,{children:[f&&ki.jsx(QB,{execute:d,onChange:f}),ki.jsx(eE,{picker:h,onPick:u})]}),m&&ki.jsxs(ki.Fragment,{children:[u&&ki.jsx("div",{className:"h-4 w-px bg-edge-soft"}),ki.jsx(CM,{icon:"externalL",tooltip:"Export this run as a portable .unotest.zip to share",tooltipPlacement:"bottom-end",onClick:m,children:ki.jsx("span",{className:"hidden sm:inline",children:"Export"})})]})]})]})]})}function JB({wheel:e,onSet:t}){const i="agent"===e;return ki.jsxs("button",{type:"button",onClick:()=>t(i?"human":"agent"),className:fx("group relative flex h-6 items-center gap-1.5 rounded border px-2 font-mono text-[11px]",i?"border-warn/40 bg-warn/10 text-warn hover:bg-warn/20":"border-edge-soft bg-canvas text-fg-2 hover:bg-raised"),children:[ki.jsx("span",{"aria-hidden":!0,className:fx("h-1.5 w-1.5 rounded-full",i?"bg-warn uno-pulse":"bg-pass")}),i?"Agent driving":"You're driving",ki.jsx(Lj,{label:i?"Take control back from the agent":"Let the agent drive"})]})}function QB({execute:e,onChange:t}){return ki.jsx("div",{className:"flex items-center rounded-md border border-edge-soft bg-panel p-0.5",children:[{v:!1,label:"Capture",title:"Capture-only — record a locator/assertion, don't touch the page"},{v:!0,label:"Execute",title:"Execute — run actions on the page and record them"}].map(i=>{const s=i.v===e;return ki.jsxs("button",{type:"button","aria-pressed":s,onClick:()=>t(i.v),className:fx("group relative h-5 rounded px-2 font-mono text-[11px] transition-colors",s?"bg-canvas text-fg shadow-sm":"text-fg-3 hover:text-fg"),children:[i.label,ki.jsx(Lj,{label:i.title})]},i.label)})})}function eE({picker:e,onPick:t}){return ki.jsx("div",{className:"flex shrink-0 items-center gap-0.5",role:"group","aria-label":"Locator picker",children:Object.keys(XB).map(i=>{const s=XB[i],r=!0===(null==e?void 0:e.active)&&e.mode===i;return ki.jsxs("button",{type:"button","aria-pressed":r,"aria-label":s.label,onClick:()=>t(i),className:fx("group relative grid h-6 w-7 place-items-center rounded border",r?"border-accent bg-accent text-on-accent":"border-accent/30 bg-canvas text-fg-3 hover:bg-raised hover:text-fg"),children:[ki.jsx(gx,{name:s.icon,className:"h-3.5 w-3.5",strokeWidth:1.75}),ki.jsx(Lj,{label:s.label,hint:s.hint})]},i)})})}function tE({reason:e,stepIndex:t,file:i,line:s,col:r}){const n="breakpoint"===e?"breakpoint hit":"step"===e?"step pause":"paused on failure";return ki.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-2 border-b border-warn/40 bg-warn/10 px-4",children:[ki.jsx(gx,{name:"pause",className:"h-3 w-3 text-warn",strokeWidth:2.5}),ki.jsx("span",{className:"font-mono text-[11px] uppercase tracking-wider text-warn",children:"paused"}),ki.jsx("span",{className:"text-warn/40",children:"·"}),ki.jsxs("span",{className:"font-mono text-[11.5px] text-warn",children:[t>=0?`#${t} `:"",ki.jsxs("span",{className:"text-warn/70",children:["— ",n]})]}),ki.jsxs("span",{className:"ml-auto truncate font-mono text-[11px] text-warn/70",children:[i,":",s,":",r]})]})}function iE({counts:e}){const t=e.passed+e.failed+e.running+e.pending;return 0===t?ki.jsx("div",{className:"h-1 shrink-0 bg-raised"}):ki.jsxs("div",{className:"flex h-1 shrink-0 overflow-hidden bg-raised",children:[ki.jsx("div",{className:"h-full bg-pass",style:{width:e.passed/t*100+"%"}}),ki.jsx("div",{className:"h-full bg-fail",style:{width:e.failed/t*100+"%"}}),ki.jsx("div",{className:fx("h-full bg-warn",e.running>0&&"uno-pulse"),style:{width:e.running/t*100+"%"}})]})}function sE(e){switch(e){case"queued":return"pending";case"starting":case"running":return"running";case"paused":return"paused";case"completed":return"passed";case"failed":return"failed";case"aborted":return"aborted"}}const rE=gi.lazy(()=>Dj(()=>import("./DslEditor-CvL23vIm.js"),__vite__mapDeps([0,1])).then(e=>({default:e.DslEditor}))),nE=__(function({path:e}){const t=w_(),i=t.scenarios.items.find(t=>t.path===e),s=t.session.capabilities.canRun,[r,n]=gi.useState("steps");gi.useEffect(()=>{t.source.getOrLoad(e)},[t,e]);const o=t.source.draft(e),a=t.source.error(e),l=gi.useMemo(()=>{if(void 0===o)return null;try{return{ok:!0,body:WB(o)}}catch(e){return{ok:!1,message:e instanceof HB||e instanceof Error?e.message:String(e)}}},[o]),c=async e=>{if(!i)return;const s=await t.activeRuns.startScenario(i.name,{headed:e,debug:e});t.tabs.open({kind:"scenario-run",runId:s.runId})};if(!i)return ki.jsx(rj,{id:e});if(a)return ki.jsx(oE,{children:ki.jsx("div",{className:"p-4 font-mono text-[12px] text-fail",children:a})});const h=fj(t.runs.lastRunByRef("scenario",i.name)),u=t.breakpoints.get(i.name),d=new Set;for(const p of u)d.add(Number(p.split(":")[0]));const f=(e,s)=>{const r=t.breakpoints.toggle(i.name,e,s),n=t.activeRuns.findActiveByScenario(i.name);n&&(r?t.activeRuns.setBreakpoint(n.runId,e,s):t.activeRuns.clearBreakpoint(n.runId,e,s))};return ki.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[ki.jsxs("header",{className:"shrink-0 border-b border-edge",children:[ki.jsxs("div",{className:"flex h-10 items-center gap-3 px-4",children:[ki.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[ki.jsx("span",{"aria-hidden":!0,className:"h-4 w-1 shrink-0 rounded-sm",style:{backgroundColor:i.color}}),ki.jsx("h1",{className:"truncate text-[13px] font-medium text-fg",children:i.title}),ki.jsx(oj,{tone:gj(h),children:h})]}),ki.jsx("div",{className:"flex shrink-0 items-center",children:ki.jsx(Pj,{value:r,onChange:n,options:[{value:"steps",label:"Steps",icon:"list",title:"Show the step tree"},{value:"code",label:"Code",icon:"braces",title:"Edit the test source"}]})})]}),ki.jsxs("div",{className:"flex h-10 items-center gap-1.5 border-t border-edge-soft px-4",children:[ki.jsxs("button",{type:"button",disabled:!s,className:fx("group relative flex h-6 items-center gap-1.5 rounded bg-accent px-2.5 font-mono text-[11px] font-medium text-on-accent",s?"hover:bg-accent-hover":kj),onClick:()=>{c(!1)},children:[ki.jsx(gx,{name:"play",className:"h-3.5 w-3.5",strokeWidth:2.5})," Run",ki.jsx(Lj,{label:s?"Run headless":Sj})]}),ki.jsxs("button",{type:"button",disabled:!s,className:fx("group relative flex h-6 items-center gap-1.5 rounded border border-warn/40 bg-warn/10 px-2.5 font-mono text-[11px] text-warn",s?"hover:bg-warn/20":kj),onClick:()=>{c(!0)},children:[ki.jsx(gx,{name:"bug",className:"h-3.5 w-3.5",strokeWidth:2})," Debug",ki.jsx(Lj,{label:s?"Headed browser · stop on breakpoints · pause on failure":Sj})]}),ki.jsxs("button",{type:"button",className:"group relative ml-auto flex h-6 items-center gap-1.5 rounded border border-edge-soft px-2.5 font-mono text-[11px] text-fg-3 hover:bg-raised/60 hover:text-fg-2",onClick:()=>t.showScenarioHistory(i.name),children:[ki.jsx(gx,{name:"history",className:"h-3.5 w-3.5",strokeWidth:2}),"History",ki.jsx(Lj,{label:`Past runs of ${i.name}`})]})]})]}),ki.jsx("div",{className:"min-h-0 flex-1",children:"code"===r?ki.jsx(gi.Suspense,{fallback:ki.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading editor…"}),children:ki.jsx(rE,{path:e,fileKind:"scenario",breakpointLines:d,onToggleBreakpoint:e=>{const t=(null==l?void 0:l.ok)?SN(l.body).find(t=>t.line===e):void 0;t&&f(e,t.col)}})}):ki.jsxs("div",{className:"h-full overflow-y-auto",children:[null===l&&ki.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading source…"}),!1===(null==l?void 0:l.ok)&&ki.jsxs("div",{className:"px-4 py-3 font-mono text-[12px] text-fail",children:["parse error: ",l.message]}),(null==l?void 0:l.ok)&&ki.jsx(jN,{body:l.body,bpKeys:u,onToggleBp:f})]})})]})});function oE({children:e}){return ki.jsx("div",{className:"h-full",children:e})}const aE=__(function({snapshotId:e}){var t;const i=w_(),s=i.snapshots.manifestOf(e),[r,n]=gi.useState("steps"),o=gi.useMemo(()=>new FN(e),[e]),[a,l]=gi.useState(null);gi.useEffect(()=>{let e=!1;return l(null),Promise.all([o.loadText({kind:"runFile",file:"steps.jsonl"}),o.loadText({kind:"runFile",file:"runtime.json"}),o.loadText({kind:"runFile",file:"sources.json"})]).then(([t,i,s])=>{e||l({events:t.ok?cE(t.text):[],vars:i.ok?hE(i.text):{},sources:s.ok?uE(s.text):null})}),()=>{e=!0}},[o]);const c=(null==(t=null==a?void 0:a.sources)?void 0:t.entry)??"",h=(null==a?void 0:a.sources)?a.sources.files[a.sources.entry]??null:null,u=gi.useMemo(()=>{if(null==h)return null;try{return WB(h)}catch{return null}},[h]);if(!s)return i.snapshots.loaded?ki.jsx(rj,{id:e}):ki.jsx(lE,{});const d=function(e){return"interrupted"===e?"aborted":e}(s.status),f="failed"===s.status,p=(null==a?void 0:a.events)??[],g=u?MM(p,u,c):null,v=f&&u?BM(p,u,c)??void 0:void 0,m=function(e){for(let t=e.length-1;t>=0;t--){const i=e[t];if("step:fail"===i.kind)return i}return null}(p);return ki.jsx(HN.Provider,{value:o,children:ki.jsxs("div",{className:"flex h-full min-w-0 gap-1.5 bg-shell",children:[ki.jsxs("section",{className:fx("flex min-w-0 flex-1 flex-col overflow-hidden bg-canvas",i.layout.inspectorOpen&&"rounded-r-lg"),children:[ki.jsxs("div",{className:"shrink-0 border-b border-edge bg-canvas",children:[ki.jsxs("div",{className:"flex h-10 items-center gap-3 px-4",children:[ki.jsx("span",{"aria-hidden":!0,className:"h-4 w-1 shrink-0 rounded-sm bg-accent"}),ki.jsx("div",{className:"truncate text-[13px] font-medium text-fg",children:s.scenario}),ki.jsx(oj,{tone:gj(d),children:d}),ki.jsx("div",{className:"flex-1"}),ki.jsx(oj,{tone:"warn",children:"frozen · read-only"}),ki.jsx(Pj,{value:r,onChange:n,options:[{value:"steps",label:"Steps",icon:"list",title:"Show the step tree"},{value:"code",label:"Code",icon:"braces",title:"Show the test source"}]}),ki.jsx("div",{className:"h-4 w-px bg-edge-soft"}),ki.jsxs("button",{type:"button",onClick:i.layout.toggleInspector,"aria-pressed":i.layout.inspectorOpen,className:fx("group relative grid h-6 w-6 place-items-center rounded",i.layout.inspectorOpen?"bg-accent/10 text-accent":"text-fg-4 hover:bg-raised hover:text-fg-2"),children:[ki.jsx(gx,{name:"panelRight",className:"h-4 w-4"}),ki.jsx(Lj,{label:i.layout.inspectorOpen?"Hide inspector":"Show inspector",placement:"bottom-end"})]})]}),ki.jsxs("div",{className:"flex h-8 items-center gap-3 border-t border-edge-soft px-4 font-mono text-[11px] text-fg-3",children:[ki.jsxs("span",{className:"flex items-center gap-1",children:[ki.jsx(gx,{name:"camera",className:"h-3 w-3"})," snapshot"]}),ki.jsx("span",{children:"·"}),ki.jsxs("span",{children:["captured ",s.capturedAt.slice(0,16).replace("T"," ")]}),s.git.author&&ki.jsxs(ki.Fragment,{children:[ki.jsx("span",{children:"·"}),ki.jsxs("span",{children:[s.git.author,s.git.branch&&` @ ${s.git.branch}`]})]})]})]}),ki.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:null==a?ki.jsx(lE,{}):"code"===r?ki.jsx("pre",{className:"h-full overflow-auto whitespace-pre bg-canvas p-4 font-mono text-[12px] leading-relaxed text-fg",children:h??"no source snapshot in this bundle"}):ki.jsx("div",{className:"h-full overflow-y-auto",children:u?ki.jsx(jN,{body:u,...g?{trace:g}:{},...null!=v?{failedIndex:v}:{},...m?{onFailedStepRender:e=>ki.jsx(TN,{errorName:m.errorName??"Error",message:m.error,file:c||s.scenario,line:e.line,source:e.source,index:e.index})}:{}}):ki.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"no source snapshot in this bundle — steps can't be rendered"})})})]}),i.layout.inspectorOpen&&ki.jsx($N,{runId:e,active:null,events:p,isFailed:f,runFinished:!0,varsOverride:(null==a?void 0:a.vars)??{}})]})})});function lE(){return ki.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading snapshot…"})}function cE(e){const t=[];for(const i of e.split("\n")){const e=i.trim();if(e)try{t.push(JSON.parse(e))}catch{}}return t}function hE(e){try{return JSON.parse(e).vars??{}}catch{return{}}}function uE(e){try{return JSON.parse(e)}catch{return null}}const dE=__(function(){const e=w_().tabs.activeTab;switch(e.kind){case"overview":return ki.jsx(Vj,{});case"scenario":return ki.jsx(nE,{path:e.path});case"helper":return ki.jsx(zj,{path:e.path});case"collection":return ki.jsx(Cj,{path:e.path});case"scenario-run":return ki.jsx(GB,{runId:e.runId});case"collection-run":return ki.jsx(vj,{runId:e.runId});case"snapshot":return ki.jsx(aE,{snapshotId:e.snapshotId})}}),fE={overview:"home",scenario:"file",helper:"braces",collection:"layers","scenario-run":"play","collection-run":"play",snapshot:"camera"},pE=__(function(){const e=w_(),[t,i]=gi.useState(null),s=e.tabs.tabs.map(t=>{const i=e.tabs.keyFor(t);return{key:i,tab:t,label:vE(e,t),status:mE(e,t),active:e.tabs.activeKey===i,closable:"overview"!==t.kind}});return ki.jsxs("div",{className:"relative shrink-0 border-b border-edge bg-panel",children:[ki.jsx("div",{role:"tablist",className:"uno-tab-rows uno-thin-scroll flex flex-wrap content-start gap-x-1 gap-y-1 overflow-y-auto py-0.5 pl-0.5 pr-8",style:{maxHeight:96},children:s.map(t=>ki.jsx(Px,{label:t.label,active:t.active,closable:t.closable,closeLabel:`Close ${t.label}`,onActivate:()=>e.tabs.activate(t.key),onClose:()=>e.tabs.close(t.key),onContextMenu:e=>{e.preventDefault(),i({x:e.clientX,y:e.clientY,key:t.key})},leading:"scenario-run"===t.tab.kind||"collection-run"===t.tab.kind?ki.jsx(cj,{status:t.status??"pending"}):ki.jsx(gx,{name:fE[t.tab.kind],className:fx("h-3.5 w-3.5 shrink-0",t.active?"text-fg-2":"text-fg-4")})},t.key))}),ki.jsx("button",{type:"button",onClick:t=>{const s=t.currentTarget.getBoundingClientRect();i({x:Math.max(6,s.right-208),y:s.bottom+4,key:e.tabs.activeKey})},"aria-label":"Tab actions",className:"absolute right-1 top-0.5 grid h-7 w-6 place-items-center rounded-md text-fg-4 hover:bg-raised hover:text-fg-2",children:ki.jsx(gx,{name:"more",className:"h-4 w-4 rotate-90"})}),t&&ki.jsx(Dx,{x:t.x,y:t.y,onClose:()=>i(null),items:gE(s,t.key,e.tabs)})]})});function gE(e,t,i){const s=e.find(e=>e.key===t),r=e.filter(e=>e.key!==t&&e.closable),n=[];return s&&n.push({kind:"header",label:s.label}),n.push({kind:"item",icon:"x",label:"Close",shortcut:"⌘W",disabled:!(null==s?void 0:s.closable),onSelect:()=>i.close(t)}),n.push({kind:"item",icon:"x",label:"Close Others",disabled:0===r.length,onSelect:()=>i.closeOthers(t)}),n.push({kind:"separator"}),n.push({kind:"item",icon:"trash",label:"Close All",tone:"danger",disabled:e.every(e=>!e.closable),onSelect:()=>i.closeAll()}),n}function vE(e,t){var i;switch(t.kind){case"overview":return"Home";case"scenario":{const i=e.scenarios.items.find(e=>e.path===t.path);return(null==i?void 0:i.name)??t.path}case"helper":{const i=e.helpers.items.find(e=>e.path===t.path);return i?`${i.name}.js`:t.path}case"collection":{const i=e.collections.items.find(e=>e.path===t.path);return(null==i?void 0:i.name)??t.path}case"scenario-run":case"collection-run":{const i=e.runs.items.find(e=>e.runId===t.runId);if(i)return i.ref;const s=e.activeRuns.byRunId.get(t.runId);return(null==s?void 0:s.scenario)||t.runId}case"snapshot":return(null==(i=e.snapshots.manifestOf(t.snapshotId))?void 0:i.scenario)??t.snapshotId}}function mE(e,t){if("scenario-run"===t.kind||"collection-run"===t.kind){const i=e.activeRuns.byRunId.get(t.runId);if(i)switch(i.status){case"starting":case"running":return"running";case"completed":return"passed";case"failed":return"failed";case"aborted":return"aborted"}const s=e.runs.items.find(e=>e.runId===t.runId);return fj(s??null)}return null}const _E="unotest.viewer.";function bE(e,t){var i;try{const s=null==(i=globalThis.localStorage)?void 0:i.getItem(_E+e);return null==s?t:JSON.parse(s)}catch{return t}}function xE(e,t){return t?`${e}.${t}`:e}function yE(e,t){var i;try{null==(i=globalThis.localStorage)||i.setItem(_E+e,JSON.stringify(t))}catch{}}const wE="activityBar.section";class SE{constructor(){this.section=bE(wE,"scenarios"),Wn(this,{},{autoBind:!0})}setSection(e){this.section=e}get storageKey(){return wE}}const kE={fail:"bg-fail text-on-accent",run:"bg-warn text-on-accent",info:"bg-accent text-on-accent"};function CE({children:e,tone:t,pulse:i}){return ki.jsx("span",{className:fx("inline-flex h-[14px] min-w-[14px] items-center justify-center rounded-full px-[3px] font-mono text-[9px] font-semibold tabular-nums",kE[t],i&&"uno-pulse"),children:e})}const jE=[{id:"scenarios",icon:"file",label:"Scenarios",hint:"⌘1"},{id:"helpers",icon:"braces",label:"Helpers",hint:"⌘2"},{id:"collections",icon:"layers",label:"Collections",hint:"⌘3"},{id:"runs",icon:"history",label:"Runs",hint:"⌘4"},{id:"active",icon:"activity",label:"Active",hint:"⌘5"},{id:"variables",icon:"variable",label:"Variables",hint:"⌘6"},{id:"app",icon:"play",label:"App",hint:"⌘7"},{id:"snapshots",icon:"camera",label:"Snapshots",hint:"⌘8"}],NE=__(function(){const e=w_(),t=e.session.capabilities.canTerminal,i=e.overview.failing.length,s=e.activeRuns.activeList.length+e.queue.waiting.length;return ki.jsxs("nav",{className:"relative z-30 flex w-[40px] shrink-0 flex-col items-stretch py-1",children:[jE.map(t=>{const r=t.id===e.activityBar.section&&e.layout.treeOpen,n="runs"===t.id&&i>0?ki.jsx(CE,{tone:"fail",children:i}):"active"===t.id&&s>0?ki.jsx(CE,{tone:"run",pulse:!0,children:s}):null;return ki.jsxs("button",{type:"button","aria-label":"runs"===t.id&&i>0?`${t.label} — ${i} ${1===i?"test":"tests"} failing now`:t.label,onClick:()=>{t.id===e.activityBar.section&&e.layout.treeOpen?e.layout.toggleTree():(e.activityBar.setSection(t.id),e.layout.openTree())},className:fx("group relative mx-1 my-0.5 grid place-items-center rounded py-2",r?"bg-panel text-fg":"text-fg-3 hover:bg-panel/70 hover:text-fg-2"),children:[ki.jsxs("span",{className:"relative",children:[ki.jsx(gx,{name:t.icon,className:"h-[18px] w-[18px]"}),n&&ki.jsx("span",{className:"absolute -right-2 -top-1.5",children:n})]}),ki.jsx(Lj,{label:t.label,hint:t.hint,placement:"right"})]},t.id)}),ki.jsxs("button",{type:"button","aria-label":"Terminal",disabled:!t,onClick:()=>e.terminal.toggle(),className:fx("group relative mx-1 mt-auto my-0.5 grid place-items-center rounded py-2",t?e.terminal.open?"bg-panel text-fg":"text-fg-3 hover:bg-panel/70 hover:text-fg-2":fx("text-fg-3",kj)),children:[ki.jsx(gx,{name:"terminal",className:"h-[18px] w-[18px]"}),ki.jsx(Lj,{label:"Terminal",hint:t?"⌃`":Sj,placement:"right"})]})]})}),ME=gi.createContext(()=>{});function BE({trigger:e,header:t,children:i,align:s="left",disabled:r=!1,title:n,menuWidth:o="w-72"}){const[a,l]=gi.useState(!1),c=gi.useRef(null);return Ex(c,()=>l(!1)),ki.jsxs("div",{ref:c,className:"relative flex items-stretch",children:[ki.jsx("button",{type:"button",onClick:()=>!r&&l(e=>!e),title:n,className:fx("flex items-center gap-1.5 rounded-sm px-2 font-mono text-[11px] transition-colors",!r&&"hover:bg-raised hover:text-fg",a&&"bg-raised text-fg"),children:e}),a&&ki.jsxs("div",{className:fx("absolute bottom-full z-50 mb-1 overflow-hidden rounded-md border border-edge-soft bg-overlay shadow-lg","right"===s?"right-0":"left-0",o),children:[ki.jsx("div",{className:"border-b border-edge-soft px-3 py-1.5 font-mono text-[10px] uppercase tracking-wider text-fg-4",children:t}),ki.jsx(ME.Provider,{value:()=>l(!1),children:i})]})]})}function EE({icon:e,leadingDot:t,label:i,sublabel:s,note:r,active:n,disabled:o=!1,title:a,onSelect:l}){const c=gi.useContext(ME);return ki.jsxs("button",{type:"button",disabled:o,title:a,onClick:o?void 0:()=>{l(),c()},className:fx("flex w-full items-center gap-2.5 px-3 py-2 text-left transition-colors",o?"cursor-not-allowed opacity-60":n?"bg-raised/60":"hover:bg-raised/60"),children:[e&&ki.jsx(gx,{name:e,className:"h-4 w-4 shrink-0 text-fg-3"}),ki.jsxs("div",{className:"min-w-0 flex-1",children:[ki.jsxs("div",{className:"flex items-center gap-1.5",children:[t&&ki.jsx("span",{className:fx("h-1.5 w-1.5 rounded-full",t)}),ki.jsx("span",{className:"font-mono text-[13px] text-fg",children:i})]}),s&&ki.jsx("div",{className:"truncate text-[11px] text-fg-4",children:s}),r&&ki.jsx("div",{className:"mt-1 text-[10.5px] leading-snug text-warn",children:r})]}),n&&!o&&ki.jsx("span",{className:"font-mono text-[10px] uppercase tracking-wider text-accent",children:"current"})]})}const DE={web:{icon:"globe",dot:"bg-accent",blurb:"Playwright via @unotest/web"},mobile:{icon:"phone",dot:"bg-accent",blurb:"iOS + Android via @unotest/mobile"},unity:{icon:"cube",dot:"bg-accent",blurb:"Unity in-editor via @unotest/unity"}};function LE(e){return DE[e]??{icon:"target",dot:"bg-fg-4",blurb:""}}const PE=__(function(){return ki.jsxs("div",{className:"flex h-5 shrink-0 items-stretch px-2 text-fg-3",children:[ki.jsx(RE,{}),ki.jsx(AE,{}),ki.jsx(TE,{}),ki.jsxs("div",{className:"ml-auto flex items-stretch gap-1",children:[ki.jsx(zE,{}),ki.jsx(FE,{}),ki.jsxs("span",{className:"flex items-center px-1 font-mono text-[10px] text-fg-4",children:["v","0.28.0"]})]})]})}),RE=__(function(){const{targets:e}=w_();if(0===e.available.length)return null;const t=e.active,i=LE(t);return ki.jsx(BE,{header:"test target",align:"left",disabled:!e.hasMultiple,title:i.blurb?`Target: ${t} — ${i.blurb}`:`Target: ${t}`,trigger:ki.jsxs(ki.Fragment,{children:[ki.jsx("span",{className:fx("h-1.5 w-1.5 rounded-full",i.dot)}),ki.jsx(gx,{name:i.icon,className:"h-3.5 w-3.5",strokeWidth:1.75}),ki.jsx("span",{className:"truncate",children:t||"—"})]}),children:e.available.map(t=>ki.jsx(OE,{info:t,active:t.target===e.active,onSelect:()=>{e.setActive(t.target)}},t.target))})}),AE=__(function(){const{environments:e}=w_();if(!e.hasAny)return null;const t=e.active??"base";return ki.jsxs(BE,{header:"environment",align:"left",title:e.active?`Environment: ${e.active} — .env.${e.active} overlay + .runs.${e.active} history`:"Environment: base — unotest/.env, unotest/.runs",trigger:ki.jsxs(ki.Fragment,{children:[ki.jsx(gx,{name:"layers",className:"h-3.5 w-3.5",strokeWidth:1.75}),ki.jsx("span",{className:"truncate",children:t})]}),children:[ki.jsx(EE,{label:"base",sublabel:"unotest/.env — no overlay",active:null===e.active,onSelect:()=>{e.setActive(null)}}),e.names.map(t=>ki.jsx(EE,{label:t,sublabel:`.env.${t} overlay · .runs.${t} history`,active:e.active===t,onSelect:()=>{e.setActive(t)}},t))]})}),TE=__(function(){const{workspace:e}=w_(),t=e.file;if(!t)return null;const i=e.current,s=t.switchedBy?` · switched by ${t.switchedBy}`:"";return ki.jsxs(BE,{header:"test bundle",align:"left",menuWidth:"w-80",disabled:e.switching,title:i?`Bundle ${i.label} — pushed ${i.author?`by ${i.author}`:"to this box"}, running @unotest/web ${i.webVersion}${s}`:`${t.workspace}: nothing has been pushed to this environment yet`,trigger:ki.jsxs(ki.Fragment,{children:[ki.jsx(gx,{name:"package",className:"h-3.5 w-3.5",strokeWidth:1.75}),ki.jsx("span",{className:"truncate",children:e.label}),(null==i?void 0:i.dirty)&&ki.jsx("span",{className:"text-warn",children:"wip"}),e.switching&&ki.jsx("span",{className:"text-fg-4",children:"switching…"})]}),children:[0===t.bundles.length&&ki.jsxs("div",{className:"px-2 py-1.5 text-[11px] text-fg-4",children:["Nothing pushed yet — send this suite with",ki.jsx("span",{className:"font-mono",children:" npx @unotest/web bundle push"}),"."]}),t.bundles.map(i=>ki.jsx(EE,{label:i.label,sublabel:[i.author,`web ${i.webVersion}`,new Date(i.createdAt).toLocaleString()].filter(Boolean).join(" · "),active:i.bundleId===t.currentBundleId,onSelect:()=>{e.canSwitch&&e.switchTo(i.bundleId)}},i.bundleId)),!t.allowSwitch&&ki.jsx("div",{className:"px-2 py-1.5 text-[11px] text-fg-4",children:"This environment follows its branch — switching is disabled for it."}),e.error&&ki.jsx("div",{className:"px-2 py-1.5 text-[11px] text-danger",children:e.error})]})}),zE=__(function(){const{session:e}=w_(),t=e.identity;if(!t)return null;const i=t.env?`${t.role} · ${t.env}`:t.role;return ki.jsx(BE,{header:"session",align:"right",menuWidth:"w-60",disabled:!t.logoutUrl,title:`Signed in as ${t.user} (${i})`,trigger:ki.jsxs(ki.Fragment,{children:[ki.jsx(gx,{name:"user",className:"h-3.5 w-3.5",strokeWidth:1.75}),ki.jsx("span",{className:"truncate",children:t.user}),ki.jsx("span",{className:"text-fg-4",children:i})]}),children:t.logoutUrl&&ki.jsx(EE,{icon:"externalL",label:"log out",sublabel:"End this session and return to the login page",active:!1,onSelect:()=>function(e){const t=document.createElement("form");t.method="post",t.action=e,document.body.appendChild(t),t.submit()}(t.logoutUrl)})})});function OE({info:e,active:t,onSelect:i}){var s,r;const n=LE(e.target),o=!!e.host&&!e.host.ok;return ki.jsx(EE,{icon:n.icon,leadingDot:n.dot,label:e.target,sublabel:n.blurb||e.name,note:o?null==(s=e.host)?void 0:s.reason:void 0,active:t,disabled:o,title:o?null==(r=e.host)?void 0:r.reason:void 0,onSelect:i})}const IE=[{mode:"light",icon:"sun",label:"light",blurb:"Always light"},{mode:"dark",icon:"moon",label:"dark",blurb:"Always dark"},{mode:"system",icon:"monitor",label:"system",blurb:"Follow OS appearance"}],FE=__(function(){const{theme:e}=w_(),t=IE.find(t=>t.mode===e.mode)??IE[2];return ki.jsx(BE,{header:"theme",align:"right",menuWidth:"w-60",title:`Theme: ${t.label}`,trigger:ki.jsxs(ki.Fragment,{children:[ki.jsx(gx,{name:t.icon,className:"h-3.5 w-3.5",strokeWidth:1.75}),ki.jsx("span",{className:"truncate",children:t.label})]}),children:IE.map(t=>ki.jsx(EE,{icon:t.icon,label:t.label,sublabel:t.blurb,active:t.mode===e.mode,onSelect:()=>e.set(t.mode)},t.mode))})}),HE=__(function(){const e=w_(),t=e.targets.current,i=null==t?void 0:t.host;if(!t||!i)return null;if(!i.ok)return ki.jsx(UE,{tone:"block",icon:"alert",title:`${t.target} isn’t available on this OS`,children:i.reason&&ki.jsx("p",{className:"text-fg-2",children:i.reason})});const s=e.targetDoctor,r=s.checkedTarget===t.target?s.checks:null,n=null!==r&&!s.hasErrors;return ki.jsxs(UE,{tone:n?"ok":"setup",icon:n?"check":"inspect",title:n?`${t.target} environment ready`:`Set up ${t.target}`,action:ki.jsx("button",{type:"button",onClick:()=>{s.run(t.target)},disabled:s.busy,className:fx("shrink-0 rounded border px-3 py-1 font-mono text-[11px] transition-colors","border-edge-soft hover:bg-raised",s.busy&&"cursor-wait opacity-60"),children:s.busy?"Checking…":r?"Re-check":"Check"}),children:[ki.jsx("p",{className:"text-fg-2",children:n?"All checks passed — you can run scenarios for this target.":`${t.name} needs a local toolchain it can't bundle. Install it, then verify here.`}),s.error&&ki.jsx("p",{className:"mt-2 font-mono text-[11px] text-fail",children:s.error}),r&&r.length>0&&ki.jsx("ul",{className:"mt-2 space-y-1.5",children:r.map(e=>ki.jsxs("li",{className:"flex items-start gap-2 text-[12px]",children:[ki.jsx("span",{className:fx("mt-[5px] h-1.5 w-1.5 shrink-0 rounded-full",WE(e.severity))}),ki.jsxs("span",{className:"min-w-0",children:[ki.jsx("span",{className:"text-fg",children:e.name}),ki.jsxs("span",{className:"text-fg-2",children:[" — ",e.message]}),e.detail&&ki.jsx("span",{className:"mt-0.5 block text-[11px] text-fg-3",children:e.detail})]})]},e.name))})]})});function WE(e){return"ok"===e?"bg-pass":"warning"===e?"bg-warn":"bg-fail"}const KE={setup:"border-warn/40 bg-warn/5",ok:"border-pass/40 bg-pass/5",block:"border-fail/40 bg-fail/5"};function UE({tone:e,icon:t,title:i,action:s,children:r}){return ki.jsx("div",{className:fx("shrink-0 border-b px-4 py-3 text-[13px]",KE[e]),children:ki.jsxs("div",{className:"flex items-start justify-between gap-3",children:[ki.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[ki.jsx(gx,{name:t,className:"mt-0.5 h-4 w-4 shrink-0 text-fg-2"}),ki.jsxs("div",{className:"min-w-0",children:[ki.jsx("div",{className:"font-medium text-fg",children:i}),r]})]}),s]})})}function $E({children:e}){return ki.jsx("kbd",{className:"inline-flex h-[18px] min-w-[18px] items-center justify-center rounded border border-edge-soft bg-raised px-1 font-mono text-[10px] font-medium uppercase tracking-wider text-fg-3",children:e})}function qE(e){return{paddingLeft:8+22*e}}function VE(e){return{paddingLeft:8+22*e+22}}function YE({children:e,onClick:t,onContextMenu:i,active:s,indent:r=!1,depth:n,leaf:o=!1,danger:a=!1,ariaLabel:l}){const c=void 0===n?void 0:o?VE(n):qE(n);return ki.jsx("button",{type:"button","aria-label":l,onClick:t,onContextMenu:i,style:c,className:fx("flex w-full items-center gap-2 px-2 py-1 text-left",void 0===n&&r&&"pl-7",s?"bg-selection text-fg":"hover:bg-raised/60",a&&"text-fail"),children:e})}const GE=__(function({query:e}){const t=w_(),i=gi.useMemo(()=>{const i=e.trim().toLowerCase(),s=(e,t)=>!i||e.toLowerCase().includes(i)||t.toLowerCase().includes(i),r=t.activeRuns.activeList.filter(e=>s(e.scenario,e.runId)).map(e=>{const t=e.events.filter(e=>"step:started"===e.kind).length,i=e.events.filter(e=>"step:ok"===e.kind||"step:fail"===e.kind).length,s=0===t?.05:Math.min(.95,i/Math.max(t,1));return{kind:"scenario",runId:e.runId,ref:e.scenario||e.runId,startedAt:e.startedAt,progress:s}}),n=t.activeRuns.activeCollectionList.filter(e=>s(e.collection,e.runId)).map(e=>{const t=e.scenarios.length||1,i=e.childOutcomes.size,s=Math.min(.95,i/t);return{kind:"collection",runId:e.runId,ref:e.collection||e.runId,startedAt:e.startedAt,progress:Math.max(.05,s),done:i,total:e.scenarios.length}});return n.sort((e,t)=>t.startedAt-e.startedAt),r.sort((e,t)=>t.startedAt-e.startedAt),[...n,...r]},[t.activeRuns.activeList,t.activeRuns.activeCollectionList,e]),s=t.queue.waiting.filter(t=>!e.trim()||t.ticket.ref.toLowerCase().includes(e.trim().toLowerCase()));return ki.jsxs("div",{className:"py-1",children:[s.length>0&&ki.jsxs("div",{className:"mb-1 border-b border-edge pb-1",children:[ki.jsxs("div",{className:"px-2 py-1 font-mono text-[10.5px] uppercase tracking-wide text-fg-4",children:["queued · ",t.queue.slots.used,"/",t.queue.slots.total," slot",1===t.queue.slots.total?"":"s"," busy"]}),s.map(e=>ki.jsxs("div",{className:"flex w-full items-center gap-2 px-2 py-1 hover:bg-raised/60",children:[ki.jsx(cj,{status:"pending"}),ki.jsxs("div",{className:"min-w-0 flex-1",children:[ki.jsx("div",{className:"truncate font-mono text-[12.5px] text-fg-2",children:e.ticket.ref}),ki.jsxs("div",{className:"mt-0.5 truncate font-mono text-[10.5px] text-fg-4",children:["collection"===e.ticket.kind?"collection · ":"",e.ticket.ci?`${lb(e.ticket.ci)} · `:"",e.ticket.producer.kind," · waiting since"," ",uj(e.ticket.createdAt)]})]}),ki.jsx("button",{type:"button",title:"take this run out of the queue","aria-label":`cancel queued ${e.ticket.ref}`,onClick:()=>{t.queue.cancel(e.name)},className:"rounded p-1 text-fg-4 hover:bg-raised hover:text-fail",children:ki.jsx(gx,{name:"x",className:"h-3.5 w-3.5"})})]},e.name))]}),i.map(e=>ki.jsxs(YE,{onClick:()=>t.tabs.open("collection"===e.kind?{kind:"collection-run",runId:e.runId}:{kind:"scenario-run",runId:e.runId}),children:["collection"===e.kind?ki.jsx(gx,{name:"layers",className:"h-3.5 w-3.5 text-fg-3"}):ki.jsx(cj,{status:"running"}),ki.jsxs("div",{className:"min-w-0 flex-1",children:[ki.jsxs("div",{className:"flex items-center gap-1.5",children:[ki.jsx("span",{className:"truncate font-mono text-[12.5px] text-fg-2",children:e.ref}),"collection"===e.kind&&ki.jsx(oj,{size:"xs",tone:"info",children:"col"})]}),ki.jsx("div",{className:fx("mt-1 h-1 overflow-hidden rounded bg-raised"),children:ki.jsx("div",{className:"h-full bg-warn uno-pulse",style:{width:100*e.progress+"%"}})}),ki.jsx("div",{className:"mt-0.5 truncate font-mono text-[10.5px] text-fg-4",children:"collection"===e.kind?`${e.done}/${e.total} done · started ${uj(e.startedAt)}`:`started ${uj(e.startedAt)}`})]})]},e.runId)),0===i.length&&0===s.length&&ki.jsx(KN,{children:"nothing running"})]})}),XE=__(function({title:e,extensions:t,onPick:i,onClose:s}){const r=w_(),[n,o]=gi.useState(null),[a,l]=gi.useState(null),c=e=>{r.appServer.browse(e,t).then(e=>{o(e),l(null)}).catch(e=>{l(e instanceof Error?e.message:String(e))})};gi.useEffect(()=>{c()},[]);return ki.jsx("div",{className:"fixed inset-0 z-50 grid place-items-center bg-black/40",onClick:s,children:ki.jsxs("div",{className:"flex h-[420px] w-[520px] flex-col rounded-lg border border-edge-soft bg-overlay shadow-xl",onClick:e=>e.stopPropagation(),children:[ki.jsxs("div",{className:"flex items-center gap-2 border-b border-edge-soft px-3 py-2",children:[ki.jsx("span",{className:"font-mono text-[12px] text-fg",children:e}),ki.jsx("span",{className:"truncate font-mono text-[10.5px] text-fg-4",children:(null==n?void 0:n.path)||"select a location"}),ki.jsx("button",{type:"button",onClick:s,className:"ml-auto grid h-5 w-5 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fg-2",children:ki.jsx(gx,{name:"x",className:"h-3.5 w-3.5"})})]}),ki.jsxs("div",{className:"flex-1 overflow-y-auto py-1",children:[a&&ki.jsx("div",{className:"px-3 py-1 font-mono text-[11px] text-fail",children:a}),n&&""!==n.path&&ki.jsxs("button",{type:"button",onClick:()=>c(n.parent??void 0),className:"flex h-7 w-full items-center gap-2 px-3 font-mono text-[11.5px] text-fg-3 hover:bg-raised/60",children:[ki.jsx(gx,{name:"chevronR",className:"h-3.5 w-3.5 rotate-180"}),".."]}),null==n?void 0:n.entries.map(e=>ki.jsxs("button",{type:"button",onClick:()=>(e=>{"dir"===e.kind?c(e.path):i(e.path)})(e),className:fx("flex h-7 w-full items-center gap-2 truncate px-3 font-mono text-[11.5px] hover:bg-raised/60","dir"===e.kind?"text-fg":"text-accent"),children:[ki.jsx(gx,{name:"dir"===e.kind?"folder":"file",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),ki.jsx("span",{className:"truncate",children:e.name}),"dir"!==e.kind&&ki.jsx("span",{className:"ml-auto rounded bg-accent/10 px-1 font-mono text-[9px] uppercase text-accent",children:"select"})]},e.path)),n&&0===n.entries.length&&!a&&ki.jsx("div",{className:"px-3 py-2 font-mono text-[11px] text-fg-4",children:"nothing matching here"})]})]})})}),ZE={stopped:{label:"stopped",dot:"bg-fg-4"},starting:{label:"starting…",dot:"bg-warn animate-pulse"},running:{label:"running",dot:"bg-pass"},external:{label:"running (external)",dot:"bg-pass"},error:{label:"error",dot:"bg-fail"}},JE=__(function({query:e}){var t;const i=w_(),s=i.appServer;gi.useEffect(()=>{s.load(),i.variables.load()},[s,i.variables]);const{status:r}=s;if(!r.available&&"stopped"===r.state)return ki.jsxs(KN,{children:['target "',i.targets.active,'" has no app-server capability']});const n=ZE[r.state],o=r.available&&("stopped"===r.state||"error"===r.state),a="running"===r.state||"starting"===r.state,l=i.session.capabilities.canRun,c=e.trim().toLowerCase(),h=c?r.log.filter(e=>e.toLowerCase().includes(c)):r.log;return ki.jsxs("div",{className:"flex h-full flex-col",children:[ki.jsxs("div",{className:"border-b border-edge-soft px-3 py-2",children:[ki.jsxs("div",{className:"flex items-center gap-2",children:[ki.jsx("span",{className:fx("h-2 w-2 shrink-0 rounded-full",n.dot)}),ki.jsx("span",{className:"font-mono text-[11.5px] text-fg-2",children:n.label}),r.target&&r.target!==i.targets.active&&ki.jsx("span",{className:"rounded bg-raised px-1 font-mono text-[9px] uppercase tracking-wide text-fg-3",children:r.target}),ki.jsxs("span",{className:"ml-auto flex gap-1",children:[o&&l&&ki.jsx("button",{type:"button",disabled:s.busy,onClick:()=>{s.start()},className:"rounded bg-accent px-2 py-0.5 font-mono text-[11px] text-on-accent hover:bg-accent-hover disabled:opacity-50",children:"Start"}),a&&l&&ki.jsx("button",{type:"button",disabled:s.busy,onClick:()=>{s.stop()},className:"rounded bg-raised px-2 py-0.5 font-mono text-[11px] text-fg-2 hover:text-fg",children:"Stop"})]})]}),r.url&&ki.jsx("a",{href:r.url,target:"_blank",rel:"noreferrer",className:"mt-1 block truncate font-mono text-[11px] text-accent hover:underline",children:r.url}),r.detail&&ki.jsx("div",{className:"mt-1 font-mono text-[10.5px] text-fg-3",children:r.detail}),"external"===r.state&&ki.jsx("div",{className:"mt-1 font-mono text-[10.5px] text-fg-4",children:"already served by another process — runs reuse it"}),(s.error??r.message)&&ki.jsx("div",{className:"mt-1 font-mono text-[11px] text-fail",children:s.error??r.message}),null==(t=r.pickers)?void 0:t.map(e=>ki.jsx(QE,{picker:e},e.envKey))]}),ki.jsx("div",{className:"flex-1 overflow-y-auto px-3 py-1",children:0===h.length?ki.jsx(KN,{children:"no output yet"}):h.map((e,t)=>ki.jsx("div",{className:"whitespace-pre-wrap break-all font-mono text-[10.5px] leading-4 text-fg-2",children:e},t))})]})}),QE=__(function({picker:e}){const t=w_().variables,i=t.rows.find(t=>"env"===t.source&&t.key===e.envKey),s=i?t.effectiveValue(i):"",[r,n]=gi.useState(null),[o,a]=gi.useState(!1),[l,c]=gi.useState(!1),h=r??s,u=null!==r&&r!==s,d=async()=>{if(u&&!l){c(!0);try{i?(t.setValue(i,h),await t.save()):await t.addVariable(e.envKey,h,"app"),n(null)}finally{c(!1)}}};return ki.jsxs("div",{className:"mt-2",children:[ki.jsxs("div",{className:"mb-0.5 flex items-center gap-1 font-mono text-[10.5px] text-fg-3",children:[e.label,ki.jsx("span",{className:"text-fg-4",children:e.envKey})]}),ki.jsxs("div",{className:"flex items-center gap-1",children:[ki.jsx("input",{type:"text",value:h,spellCheck:!1,placeholder:`/path/to/your${e.extensions[0]??""}`,onChange:e=>n(e.target.value),onKeyDown:e=>"Enter"===e.key&&void d(),className:"h-6 w-full rounded border border-edge-soft bg-canvas px-1.5 font-mono text-[11px] text-fg placeholder:text-fg-4 focus:border-accent focus:outline-none focus:ring-2 focus:ring-accent/20"}),ki.jsx("button",{type:"button",title:"Browse…",onClick:()=>a(!0),className:"grid h-6 w-7 shrink-0 place-items-center rounded border border-edge-soft text-fg-4 hover:bg-raised hover:text-fg",children:ki.jsx(gx,{name:"folder",className:"h-3.5 w-3.5"})}),u&&ki.jsx("button",{type:"button",disabled:l,onClick:()=>{d()},className:"rounded bg-accent px-2 py-0.5 font-mono text-[11px] text-on-accent hover:bg-accent-hover disabled:opacity-50",children:"Save"})]}),o&&ki.jsx(XE,{title:e.label,extensions:e.extensions,onPick:e=>{n(e),a(!1)},onClose:()=>a(!1)})]})}),eD=__(function({query:e}){const t=w_(),i=t.collections.items,[s,r]=gi.useState(!1),[n,o]=gi.useState(null),a=t.session.capabilities.canEditFiles,l=gi.useMemo(()=>{const t=e.trim().toLowerCase();return i.filter(e=>!t||e.name.toLowerCase().includes(t))},[i,e]);return ki.jsxs("div",{className:"py-1",children:[s?ki.jsx(tD,{existingNames:i.map(e=>e.name.toLowerCase()),onCommit:async e=>{const i=await t.collections.create(e);i&&(r(!1),t.tabs.open({kind:"collection",path:i.path}))},onCancel:()=>r(!1)}):a?ki.jsxs("button",{type:"button",onClick:()=>r(!0),className:"mx-2 my-1 flex w-[calc(100%-1rem)] items-center justify-center gap-1.5 rounded border border-dashed border-edge-soft px-2 py-1.5 font-mono text-[11.5px] text-fg-4 hover:border-accent hover:bg-accent/10 hover:text-accent",children:[ki.jsx(gx,{name:"plus",className:"h-3.5 w-3.5"})," new collection"]}):null,l.map(e=>{const i=t.runs.lastRunByRef("collection",e.name),s=t.schedules.get("collection",e.name);return ki.jsxs(YE,{onClick:()=>t.tabs.open({kind:"collection",path:e.path}),onContextMenu:t=>{t.preventDefault(),o({x:t.clientX,y:t.clientY,name:e.name})},children:[ki.jsx(gx,{name:"layers",className:"h-3.5 w-3.5 text-fg-3"}),ki.jsxs("div",{className:"min-w-0 flex-1",children:[ki.jsxs("div",{className:"flex items-center gap-1.5",children:[ki.jsx("span",{className:"truncate font-mono text-[12.5px] text-fg-2",children:e.name}),s&&ki.jsx("span",{title:qj(s),children:ki.jsx(gx,{name:"clock",className:"h-3 w-3 shrink-0 text-fg-4"})})]}),ki.jsxs("div",{className:"mt-0.5 truncate font-mono text-[10.5px] text-fg-4",children:[e.scenarios.length," scenarios ·"," ",i?uj(i.startedAt):"never run"]})]})]},e.path)}),0===l.length&&!s&&ki.jsx(KN,{children:"no collections match"}),n&&ki.jsx(Dx,{x:n.x,y:n.y,items:[{kind:"header",label:n.name},{kind:"item",icon:"clock",label:(()=>{const e=t.schedules.get("collection",n.name);return e?`Schedule · ${Cb(e.cron)}`:"Schedule…"})(),disabled:!a,onSelect:()=>t.schedules.openEditor({kind:"collection",name:n.name})}],onClose:()=>o(null)})]})});function tD({existingNames:e,onCommit:t,onCancel:i}){const[s,r]=gi.useState(""),n=gi.useRef(null),o=gi.useRef(null);gi.useEffect(()=>{var e;null==(e=n.current)||e.focus()},[]);const a=s.trim(),l=a.length>0?qb(a):null,c=a.length>0&&e.includes(a.toLowerCase())?`"${a}" already exists`:l||null,h=a.length>0&&!c;return ki.jsxs("form",{ref:o,onSubmit:e=>{e.preventDefault(),h&&t(a)},className:"mx-2 my-1",children:[ki.jsxs("div",{className:fx("flex h-[30px] items-center gap-1.5 rounded border bg-canvas px-2 ring-2",c?"border-fail ring-fail/20":"border-accent ring-accent/20"),children:[ki.jsx(gx,{name:"layers",className:"h-3.5 w-3.5 shrink-0 text-accent"}),ki.jsx("input",{ref:n,value:s,onChange:e=>r(e.target.value),onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),i())},onBlur:e=>{o.current&&e.relatedTarget&&o.current.contains(e.relatedTarget)||a||i()},spellCheck:!1,autoComplete:"off",placeholder:"collection name…",className:"min-w-0 flex-1 bg-transparent font-mono text-[12.5px] text-fg placeholder-fg-4 outline-none"}),ki.jsx("button",{type:"button",onMouseDown:e=>e.preventDefault(),onClick:i,title:"Cancel (esc)",className:"grid h-5 w-5 shrink-0 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fg-2",children:ki.jsx(gx,{name:"x",className:"h-3 w-3",strokeWidth:2.25})}),ki.jsx("button",{type:"submit",disabled:!h,onMouseDown:e=>e.preventDefault(),title:"Create (↵)",className:fx("grid h-5 w-5 shrink-0 place-items-center rounded",h?"text-accent hover:bg-accent/10 hover:text-accent-hover":"cursor-default text-fg-4"),children:ki.jsx(gx,{name:"check",className:"h-3.5 w-3.5",strokeWidth:2.5})})]}),ki.jsx("div",{className:fx("mt-1 flex items-center gap-1 px-1 font-mono text-[10px]",c?"text-fail":"text-fg-4"),children:c?ki.jsxs(ki.Fragment,{children:[ki.jsx(gx,{name:"alert",className:"h-3 w-3"})," ",c]}):ki.jsx(ki.Fragment,{children:"↵ create · esc cancel"})})]})}const iD=__(function({query:e}){const t=w_(),i=t.helpers.items,s=gi.useMemo(()=>{const t=e.trim().toLowerCase();return i.filter(e=>!t||e.name.toLowerCase().includes(t))},[i,e]);return ki.jsxs("div",{className:"py-1",children:[ki.jsxs("div",{className:"flex h-7 items-center gap-1 px-2 text-fg-4",children:[ki.jsx(gx,{name:"chevronD",className:"h-3.5 w-3.5 text-fg-4"}),ki.jsx("span",{className:"font-mono text-[11px] uppercase tracking-wider",children:"_helpers"}),ki.jsx("span",{className:"ml-auto font-mono text-[10.5px] text-fg-4",children:s.length})]}),s.map(e=>ki.jsxs(YE,{indent:!0,onClick:()=>t.tabs.open({kind:"helper",path:e.path}),children:[ki.jsx(gx,{name:"braces",className:"h-3.5 w-3.5 text-fg-3"}),ki.jsxs("div",{className:"min-w-0 flex-1",children:[ki.jsxs("div",{className:"truncate font-mono text-[12.5px] text-fg-2",children:[e.name,".js"]}),ki.jsx("div",{className:"mt-0.5 truncate font-mono text-[10.5px] text-fg-4",children:e.path})]})]},e.path)),0===s.length&&ki.jsx(KN,{children:"no helpers match"})]})});function sD(e){switch(e.kind){case"collection":return`col:${e.run.runId}`;case"repeats":return`rep:${e.runs[0].runId}`;case"run":return`run:${e.run.runId}`}}function rD(e,t={}){const i=t.now??Date.now(),s=t.flat?e.map(e=>({kind:"run",run:e})):function(e){const t=new Map;for(const s of e)"collection"===s.kind&&t.set(s.runId,{kind:"collection",run:s,children:[],passed:0,failed:0});const i=[];for(const s of e){if("collection"===s.kind){i.push(t.get(s.runId));continue}const e=s.parentRunId?t.get(s.parentRunId):void 0;e?(e.children.push(s),"passed"===s.status?e.passed++:"failed"!==s.status&&"interrupted"!==s.status||e.failed++):i.push({kind:"run",run:s})}return i}(e),r=[];let n=null;for(const o of s){const{startedAt:e}=o.run,s=oD(e);n&&n.key===s||(n={key:s,label:aD(e,i),entries:[]},r.push(n)),nD(n.entries,o,!0===t.flat)}return r}function nD(e,t,i){if(i||"run"!==t.kind)return void e.push(t);const s=e[e.length-1];"repeats"!==(null==s?void 0:s.kind)||s.ref!==t.run.ref?"run"!==(null==s?void 0:s.kind)||s.run.ref!==t.run.ref?e.push(t):e[e.length-1]={kind:"repeats",ref:t.run.ref,runs:[s.run,t.run]}:s.runs.push(t.run)}function oD(e){const t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function aD(e,t){const i=oD(e);return i===oD(t)?"Today":i===oD(t-864e5)?"Yesterday":new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric",...new Date(e).getFullYear()===new Date(t).getFullYear()?{}:{year:"numeric"}})}const lD="scenario";function cD({chevron:e,status:t,icon:i}){return ki.jsxs(ki.Fragment,{children:[ki.jsx("span",{className:"flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:void 0!==e&&ki.jsx(gx,{name:"open"===e?"chevronD":"chevronR",className:"h-3.5 w-3.5 text-fg-4"})}),ki.jsx("span",{className:"flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:void 0!==t?ki.jsx(cj,{status:t}):void 0!==i&&ki.jsx(gx,{name:i,className:"h-3.5 w-3.5 text-fg-4"})})]})}const hD=__(function(){const e=w_(),t=e.overview.failing;return 0===t.length?null:ki.jsxs("div",{className:"mb-1 border-b border-edge-soft pb-1",children:[ki.jsxs("div",{className:"flex items-center gap-1.5 px-3 pb-0.5 pt-2",children:[ki.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fail",children:"Failing now"}),ki.jsxs("span",{className:"font-mono text-[10.5px] text-fg-4",children:["· ",t.length," ",1===t.length?"test":"tests"]})]}),t.map(t=>ki.jsxs(YE,{depth:0,ariaLabel:`${t.ref} — failing, ${uD(t.failStreak)}, last run ${uj(t.lastAt)}`,onClick:()=>{e.runs.setScenarioFilter(t.ref)},children:[ki.jsx(cD,{status:"failed"}),ki.jsx("span",{className:"truncate font-mono text-[11px] text-fg-2",children:t.ref}),ki.jsxs("span",{className:"ml-auto shrink-0 font-mono text-[10px] text-fg-4",children:[uj(t.lastAt)," · ",uD(t.failStreak)]})]},t.ref))]})});function uD(e){return 1===e?"red 1 run":`red ${e} runs`}function dD({runs:e}){const t=e.slice(0,20).slice().reverse();if(t.length<2)return null;const i=t.map(e=>e.durationMs??0),s=Math.max(...i,1),r=t.filter(e=>"failed"===e.status||"interrupted"===e.status).length;return ki.jsxs("div",{className:"mx-2 mb-1 rounded border border-edge-soft px-2 py-1.5",children:[ki.jsx("div",{className:"flex items-end gap-[2px]","aria-label":`Last ${t.length} runs: ${t.length-r} passed, ${r} failed`,role:"img",children:t.map(e=>ki.jsx("span",{title:`${e.status} · ${hj(e.durationMs)}`,style:{height:`${Math.max(3,Math.round((e.durationMs??0)/s*18))}px`},className:fx("w-[5px] shrink-0 rounded-[1px]","passed"===e.status?"bg-pass":"failed"===e.status||"interrupted"===e.status?"bg-fail":"bg-fg-4")},e.runId))}),ki.jsxs("div",{className:"mt-1 flex items-center justify-between font-mono text-[9.5px] text-fg-4",children:[ki.jsxs("span",{children:["last ",t.length," · ",r," failed"]}),ki.jsxs("span",{children:["up to ",hj(s)]})]})]})}const fD=__(function({query:e}){var t;const i=w_(),[s,r]=gi.useState("all"),[n,o]=gi.useState(new Set),a=i.runs.scenarioFilter,l=gi.useRef(!1);gi.useEffect(()=>{const e=function(e){const t=new URLSearchParams(e).get(lD);return t&&""!==t.trim()?t:null}(window.location.search);e&&i.runs.setScenarioFilter(e),l.current=!0},[i]),gi.useEffect(()=>{l.current&&window.history.replaceState(null,"",function(e,t){const i=new URL(e,"http://localhost");return t?i.searchParams.set(lD,t):i.searchParams.delete(lD),`${i.pathname}${i.search}${i.hash}`}(`${window.location.pathname}${window.location.search}${window.location.hash}`,a))},[a]);const c=e=>{i.runs.setScenarioFilter(e)},h=i.workspace.hosted?(null==(t=i.workspace.file)?void 0:t.currentBundleId)??null:null,[u,d]=gi.useState(!1),f=gi.useMemo(()=>{const t=e.trim().toLowerCase();return i.runs.items.filter(e=>("failed"!==s||"failed"===e.status)&&(("passed"!==s||"passed"===e.status)&&((!u||null===h||e.bundleId===h)&&(!t||e.ref.toLowerCase().includes(t)))))},[i.runs.items,e,s,u,h]),p=gi.useMemo(()=>rD(f,{flat:null!==a}),[f,a]),g=e=>i.tabs.open("collection"===e.kind?{kind:"collection-run",runId:e.runId}:{kind:"scenario-run",runId:e.runId});return ki.jsxs("div",{className:"py-1",children:[a?ki.jsx(pD,{ref_:a,onClear:()=>c(null)}):ki.jsx("div",{className:"mx-2 mb-1 grid grid-cols-3 overflow-hidden rounded border border-edge-soft",children:["all","failed","passed"].map(e=>ki.jsx("button",{type:"button",onClick:()=>r(e),className:fx("py-1 font-mono text-[10.5px] uppercase tracking-wider",s===e?"bg-raised text-fg":"text-fg-3 hover:bg-raised/60"),children:"failed"===e?"failed runs":e},e))}),null!==h&&ki.jsx("button",{type:"button",onClick:()=>d(e=>!e),"aria-pressed":u,title:`Show only runs of bundle ${h}, the one this environment is on now`,className:fx("mx-2 mb-1 w-[calc(100%-1rem)] rounded border px-2 py-1 font-mono text-[10.5px] uppercase tracking-wider",u?"border-edge bg-raised text-fg":"border-edge-soft text-fg-3 hover:bg-raised/60"),children:"this bundle only"}),a?ki.jsx(dD,{runs:f}):ki.jsx(hD,{}),p.map(e=>ki.jsxs("div",{children:[ki.jsx("div",{className:"px-3 pb-0.5 pt-2 font-mono text-[10px] uppercase tracking-wider text-fg-4",children:e.label}),e.entries.map(e=>ki.jsx(gD,{entry:e,expanded:n.has(sD(e)),onToggle:()=>{return t=sD(e),o(e=>{const i=new Set(e);return i.delete(t)||i.add(t),i});var t},onOpen:g,onScenario:c,showRef:null===a},sD(e)))]},e.key)),0===f.length&&(i.runs.indexReady?ki.jsx(KN,{children:"no runs match"}):ki.jsx(KN,{children:"history is still loading…"})),i.runs.hasMore&&ki.jsx("button",{type:"button",onClick:()=>{i.runs.loadMore()},disabled:i.runs.loadingMore,className:"mx-2 mt-1 w-[calc(100%-1rem)] rounded border border-edge-soft py-1 font-mono text-[10.5px] text-fg-3 hover:bg-raised/60 disabled:opacity-50",children:i.runs.loadingMore?"loading…":"load older runs"})]})});function pD({ref_:e,onClear:t}){return ki.jsxs("div",{className:"mx-2 mb-1 flex items-center gap-1 rounded border border-accent/30 bg-accent/10 px-1.5 py-1",children:[ki.jsx("span",{className:"shrink-0 font-mono text-[9.5px] uppercase tracking-wider text-fg-4",children:"test"}),ki.jsx("span",{className:"truncate font-mono text-[11px] text-fg-2",children:e}),ki.jsx("button",{type:"button","aria-label":"Clear test filter",onClick:t,className:"ml-auto shrink-0 rounded p-0.5 text-fg-3 hover:bg-raised/60 hover:text-fg",children:ki.jsx(gx,{name:"x",className:"h-3 w-3"})})]})}function gD({entry:e,expanded:t,onToggle:i,onOpen:s,onScenario:r,showRef:n}){if("run"===e.kind)return ki.jsx(vD,{run:e.run,showRef:n,onOpen:s,depth:0});const o="collection"===e.kind?e.run:e.runs[0],a="collection"===e.kind?e.run.ref:e.ref,l=function(e){switch(e.kind){case"collection":return e.children.length;case"repeats":return e.runs.length;case"run":return 1}}(e);return ki.jsxs(ki.Fragment,{children:[ki.jsxs(YE,{depth:0,ariaLabel:"collection"===e.kind?`Collection ${a} — ${e.passed} passed, ${e.failed} failed, ${uj(o.startedAt)}`:`${a} — ${l} runs, ${uj(o.startedAt)}`,onClick:i,children:[ki.jsx(cD,{chevron:t?"open":"closed",status:pj(o.status)}),ki.jsx("span",{className:"truncate font-mono text-[11px] text-fg-2",onClick:t=>{t.stopPropagation(),"repeats"===e.kind&&r(a)},children:a}),"collection"===e.kind&&ki.jsx(oj,{size:"xs",tone:"info",children:"col"}),ki.jsx("span",{className:"ml-auto shrink-0 font-mono text-[10px] text-fg-4",children:"collection"===e.kind?`${e.passed} ✓${e.failed?` ${e.failed} ✗`:""}`:l}),ki.jsx("span",{className:"shrink-0 font-mono text-[10px] text-fg-4",children:uj(o.startedAt)})]}),t&&("collection"===e.kind?ki.jsxs(ki.Fragment,{children:[ki.jsxs(YE,{depth:1,ariaLabel:`Open collection run ${a}`,onClick:()=>s(e.run),children:[ki.jsx(cD,{icon:"layers"}),ki.jsx("span",{className:"truncate font-mono text-[10.5px] text-fg-3",children:"open collection run"})]}),e.children.map(e=>ki.jsx(vD,{run:e,showRef:!0,onOpen:s,depth:1},e.runId))]}):e.runs.map(e=>ki.jsx(vD,{run:e,showRef:!1,onOpen:s,depth:1},e.runId)))]})}function vD({run:e,showRef:t,onOpen:i,depth:s}){var r;const{workspace:n}=w_(),o=n.hosted&&void 0!==e.bundleId&&e.bundleId!==(null==(r=n.file)?void 0:r.currentBundleId)?e.bundleId:null;return ki.jsxs(YE,{depth:s,ariaLabel:`${"collection"===e.kind?"Collection":"Run"} ${e.ref} — ${e.status}, ${uj(e.startedAt)}`,onClick:()=>i(e),children:[ki.jsx(cD,{status:pj(e.status)}),t?ki.jsx("span",{className:"truncate font-mono text-[11px] text-fg-3",children:e.ref}):ki.jsx("span",{className:"truncate font-mono text-[11px] text-fg-3",children:uj(e.startedAt)}),t&&ki.jsx("span",{className:"shrink-0 font-mono text-[10px] text-fg-4",children:uj(e.startedAt)}),o&&ki.jsx("span",{className:"shrink-0 font-mono text-[10px] text-fg-4",title:`Ran on another test bundle (${o}), not the one this environment is on now`,children:"other bundle"}),null!=e.durationMs&&ki.jsx("span",{className:"ml-auto shrink-0 font-mono text-[10.5px] text-fg-4",children:hj(e.durationMs)})]})}function mD(e){const t=e.lastIndexOf("/");return t<0?e:e.slice(t+1)}function _D(e){const t=e.lastIndexOf("/");return t<0?"":e.slice(0,t)}function bD(e){return e.endsWith(".js")?e.slice(0,-3):e}function xD({title:e,message:t,confirmLabel:i="Delete",cancelLabel:s="Cancel",danger:r=!0,onConfirm:n,onCancel:o}){const a=gi.useRef(null);return gi.useEffect(()=>{var e;null==(e=a.current)||e.focus();const t=e=>{"Escape"===e.key&&o()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[o]),ki.jsx("div",{className:"fixed inset-0 z-50 grid place-items-center bg-black/30 backdrop-blur-[1px]",onMouseDown:o,children:ki.jsxs("div",{role:"dialog","aria-modal":"true",onMouseDown:e=>e.stopPropagation(),className:fx("w-[min(380px,calc(100vw-2rem))] rounded-lg p-4","border border-edge-soft bg-overlay shadow-xl"),children:[ki.jsx("div",{className:"text-[13px] font-medium text-fg",children:e}),ki.jsx("div",{className:"mt-1.5 text-[12px] leading-relaxed text-fg-2",children:t}),ki.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[ki.jsx("button",{type:"button",onClick:o,className:"h-7 rounded border border-edge-soft bg-canvas px-3 font-mono text-[11.5px] text-fg-2 hover:bg-raised",children:s}),ki.jsx("button",{ref:a,type:"button",onClick:n,className:fx("h-7 rounded px-3 font-mono text-[11.5px] font-medium text-on-accent",r?"bg-fail hover:bg-fail/80":"bg-accent hover:bg-accent-hover"),children:i})]})]})})}function yD(e,{validate:t,onCommit:i,onCancel:s}){const[r,n]=gi.useState(e),o=gi.useRef(null),a=gi.useRef(!1);gi.useEffect(()=>{var e,t;null==(e=o.current)||e.focus(),null==(t=o.current)||t.select()},[]);const l=r.trim(),c=l?(null==t?void 0:t(l))??null:null,h=l.length>0&&!c,u=()=>{a.current||(a.current=!0,h?i(l):s())};return{err:c,ringClass:c?"ring-1 ring-fail":"ring-1 ring-accent",onSubmit:e=>{e.preventDefault(),u()},inputProps:{ref:o,value:r,onChange:e=>n(e.target.value),onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),a.current||(a.current=!0,s()))},onBlur:u,spellCheck:!1,autoComplete:"off"}}}const wD=__(function({query:e}){var t;const i=w_(),s=i.scenarios,r=i.session.capabilities.canEditFiles,n=s.buildTree(e),o=0===n.folders.length&&0===n.scenarios.length&&null===s.creating;return ki.jsxs("div",{className:"min-h-full py-1",onContextMenu:e=>{e.preventDefault(),s.openMenu(e.clientX,e.clientY,{kind:"blank"})},onKeyDown:e=>function(e,t,i){if("INPUT"===e.target.tagName)return;const s=t.selected,r=e.metaKey||e.ctrlKey,n=!!s&&"blank"!==s.kind;"F2"===e.key&&n&&i?(e.preventDefault(),t.startRename(s)):r&&("c"===e.key||"C"===e.key)&&n?(e.preventDefault(),t.copy(s)):r&&("v"===e.key||"V"===e.key)&&i&&(e.preventDefault(),t.paste(MD(s)))}(e,s,r),children:[s.actionError&&ki.jsx("button",{type:"button",onClick:()=>s.clearActionError(),className:"mx-2 my-1 block w-[calc(100%-1rem)] truncate rounded border border-fail/30 bg-fail/10 px-2 py-1 text-left font-mono text-[11px] text-fail",children:s.actionError}),""===(null==(t=s.creating)?void 0:t.parent)&&ki.jsx(ND,{store:s,depth:0,kind:s.creating.kind}),n.folders.map(e=>ki.jsx(SD,{node:e,depth:0},e.rel)),n.scenarios.map(e=>ki.jsx(kD,{s:e,depth:0},e.path)),o&&ki.jsx(KN,{children:"no scenarios match"}),s.menu&&ki.jsx(Dx,{x:s.menu.x,y:s.menu.y,items:BD(s,i.schedules,s.menu.target,r),onClose:()=>s.closeMenu()}),s.pendingDelete&&"blank"!==s.pendingDelete.kind&&ki.jsx(xD,{title:"folder"===s.pendingDelete.kind?`Delete folder "${mD(s.pendingDelete.rel)}"?`:`Delete "${bD(mD(s.pendingDelete.rel))}"?`,message:"folder"===s.pendingDelete.kind?"This permanently deletes the folder and everything inside it.":"This permanently deletes the scenario file.",onConfirm:()=>{s.confirmDelete()},onCancel:()=>s.cancelDelete()})]})}),SD=__(function e({node:t,depth:i}){var s,r;const n=w_().scenarios,o=n.isExpanded(t.rel);if("folder"===(null==(s=n.renaming)?void 0:s.kind)&&n.renaming.rel===t.rel)return ki.jsx(CD,{depth:i,initial:t.name,open:o,onCommit:e=>{n.commitRename(e)},onCancel:()=>n.cancelRename()});return ki.jsxs("div",{children:[ki.jsxs("button",{type:"button",onClick:()=>{n.select({kind:"folder",rel:t.rel}),n.toggle(t.rel)},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),n.openMenu(e.clientX,e.clientY,{kind:"folder",rel:t.rel})},style:qE(i),className:"flex h-7 w-full items-center gap-2 pr-2 text-left text-fg-2 hover:text-fg",children:[ki.jsx(gx,{name:o?"chevronD":"chevronR",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),ki.jsx(gx,{name:"folder",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),ki.jsx("span",{className:"truncate font-mono text-[12.5px]",children:t.name}),ki.jsx("span",{className:"ml-auto shrink-0 font-mono text-[10.5px] text-fg-4",children:t.scenarios.length})]}),o&&ki.jsxs(ki.Fragment,{children:[(null==(r=n.creating)?void 0:r.parent)===t.rel&&ki.jsx(ND,{store:n,depth:i+1,kind:n.creating.kind}),t.folders.map(t=>ki.jsx(e,{node:t,depth:i+1},t.rel)),t.scenarios.map(e=>ki.jsx(kD,{s:e,depth:i+1},e.path))]})]})}),kD=__(function({s:e,depth:t}){var i;const s=w_(),r=s.scenarios,n=s.runs.lastRunByRef("scenario",e.name),o=s.schedules.get("scenario",e.name),a=`${e.name}.js`,l={kind:"scenario",rel:a},c=s.tabs.activeTab,h="scenario"===(null==c?void 0:c.kind)&&c.path===e.path;return"scenario"===(null==(i=r.renaming)?void 0:i.kind)&&r.renaming.rel===a?ki.jsx(jD,{depth:t,initial:mD(e.name),onCommit:e=>{r.commitRename(e)},onCancel:()=>r.cancelRename()}):ki.jsx(YE,{depth:t,leaf:!0,active:h,onClick:()=>{r.select(l),s.tabs.open({kind:"scenario",path:e.path})},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),r.openMenu(e.clientX,e.clientY,l)},children:ki.jsxs("span",{className:"flex min-w-0 items-center gap-[5px]",children:[ki.jsx("span",{className:"grid h-3.5 w-3.5 shrink-0 place-items-center",children:ki.jsx(cj,{status:dj((null==n?void 0:n.status)??null,e.expectFail)})}),ki.jsx("span",{className:"truncate font-mono text-[12.5px] text-fg-2",children:mD(e.name)}),o&&ki.jsx("span",{title:qj(o),children:ki.jsx(gx,{name:"clock",className:"h-3 w-3 shrink-0 text-fg-4"})})]})})});function CD({depth:e,initial:t,open:i=!0,onCommit:s,onCancel:r}){const{ringClass:n,onSubmit:o,inputProps:a}=yD(t,{validate:Xb,onCommit:s,onCancel:r});return ki.jsxs("form",{onSubmit:o,style:qE(e),className:"flex h-7 w-full items-center gap-2 pr-2",children:[ki.jsx(gx,{name:i?"chevronD":"chevronR",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),ki.jsx(gx,{name:"folder",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),ki.jsx("input",{...a,className:fx("min-w-0 flex-1 rounded-sm bg-canvas px-1 font-mono text-[12.5px] text-fg outline-none",n)})]})}function jD({depth:e,initial:t,onCommit:i,onCancel:s}){const{ringClass:r,onSubmit:n,inputProps:o}=yD(t,{validate:Xb,onCommit:i,onCancel:s});return ki.jsx("form",{onSubmit:n,style:VE(e),className:"flex w-full items-center py-1 pr-2",children:ki.jsx("input",{...o,placeholder:"scenario-name",className:fx("min-w-0 flex-1 rounded-sm bg-canvas px-1 font-mono text-[12.5px] leading-[1.5] text-fg outline-none",r)})})}function ND({store:e,depth:t,kind:i}){const s=t=>{e.commitCreate(t)},r=()=>e.cancelCreate();return"folder"===i?ki.jsx(CD,{depth:t,initial:"",onCommit:s,onCancel:r}):ki.jsx(jD,{depth:t,initial:"",onCommit:s,onCancel:r})}function MD(e){return e?"folder"===e.kind?e.rel:"scenario"===e.kind?_D(e.rel):"":""}function BD(e,t,i,s){const r=e.clipboard,n=r?"folder"===r.kind?`Paste folder "${r.label}"`:`Paste "${r.label}"`:"Paste",o=MD(i),a={kind:"item",icon:"file",label:"New scenario",disabled:!s,onSelect:()=>e.startCreate(o,"scenario")},l={kind:"item",icon:"folderPlus",label:"New folder",disabled:!s,onSelect:()=>e.startCreate(o,"folder")},c={kind:"item",icon:"clipboard",label:n,disabled:!r||!s,onSelect:()=>{e.paste(o)}};if("blank"===i.kind)return[a,l,c];return[{kind:"header",label:"folder"===i.kind?mD(i.rel):bD(mD(i.rel))},a,l,{kind:"item",icon:"copy",label:"Copy",onSelect:()=>e.copy(i)},{kind:"item",icon:"externalL",label:"Copy link",onSelect:()=>e.copyPath(i)},c,{kind:"item",icon:"edit",label:"Rename",shortcut:"F2",disabled:!s,onSelect:()=>e.startRename(i)},...ED(t,i,s),{kind:"separator"},{kind:"item",icon:"trash",label:"Delete",tone:"danger",disabled:!s,onSelect:()=>e.requestDelete(i)}]}function ED(e,t,i){if("scenario"!==t.kind)return[];const s=bD(t.rel),r=e.get("scenario",s);return[{kind:"item",icon:"clock",label:r?`Schedule · ${Cb(r.cron)}`:"Schedule…",disabled:!i,onSelect:()=>e.openEditor({kind:"scenario",name:s})}]}const DD=__(function({query:e}){const t=w_(),[i,s]=gi.useState(!1),[r,n]=gi.useState(null),o=gi.useRef(null),a=t.session.capabilities.canEditFiles,l=e.trim().toLowerCase(),c=t.snapshots.list.filter(e=>!l||e.manifest.scenario.toLowerCase().includes(l)),h=e=>{e&&a&&t.snapshots.importFile(e).then(e=>t.tabs.open({kind:"snapshot",snapshotId:e})).catch(e=>window.alert(`Import failed: ${(null==e?void 0:e.message)??e}`))};return ki.jsxs("div",{onDragOver:e=>{e.preventDefault(),s(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||s(!1)},onDrop:e=>{e.preventDefault(),s(!1),h(e.dataTransfer.files[0])},className:fx("relative flex min-h-full flex-col py-1",i&&"bg-accent/10 ring-2 ring-inset ring-accent/60"),children:[ki.jsx("input",{ref:o,type:"file",accept:".zip,.unotest.zip",className:"hidden",onChange:e=>{var t;h(null==(t=e.target.files)?void 0:t[0]),e.target.value=""}}),ki.jsx("div",{className:"px-2 pb-2",children:ki.jsx(CM,{icon:"camera",tooltip:"Open a teammate's .unotest.zip snapshot",onClick:()=>{var e;return null==(e=o.current)?void 0:e.click()},className:"w-full justify-center",children:"Open .unotest.zip"})}),0===c.length?ki.jsx(KN,{children:"no snapshots — open or drop a .unotest.zip"}):c.map(e=>{return ki.jsxs(YE,{active:t.tabs.activeKey===`snapshot:${e.snapshotId}`,onClick:()=>t.tabs.open({kind:"snapshot",snapshotId:e.snapshotId}),onContextMenu:t=>{t.preventDefault(),n({x:t.clientX,y:t.clientY,id:e.snapshotId,label:e.manifest.scenario})},children:[ki.jsx(cj,{status:(i=e.manifest.status,"interrupted"===i?"aborted":i)}),ki.jsxs("span",{className:"min-w-0 flex-1",children:[ki.jsx("span",{className:"block truncate font-mono text-[12px] text-fg-2",children:e.manifest.scenario}),ki.jsxs("span",{className:"block truncate font-mono text-[10px] text-fg-4",children:[e.manifest.capturedAt.slice(0,16).replace("T"," "),e.manifest.git.author&&` · ${e.manifest.git.author}`]})]})]},e.snapshotId);var i}),i&&ki.jsx("div",{className:"pointer-events-none absolute inset-0 grid place-items-center",children:ki.jsxs("div",{className:"flex flex-col items-center gap-1 text-accent",children:[ki.jsx(gx,{name:"camera",className:"h-5 w-5"}),ki.jsx("span",{className:"font-mono text-[11px]",children:"Drop to open snapshot"})]})}),r&&ki.jsx(Dx,{x:r.x,y:r.y,onClose:()=>n(null),items:(u=r.label,d=()=>{return e=r.id,i=r.label,void(a&&window.confirm(`Delete snapshot "${i}"?`)&&(t.tabs.close(`snapshot:${e}`),t.snapshots.remove(e).catch(e=>window.alert(`Delete failed: ${(null==e?void 0:e.message)??e}`))));var e,i},[{kind:"header",label:u},{kind:"item",icon:"trash",label:"Delete snapshot",tone:"danger",onSelect:d}])})]});var u,d});const LD={secret:{label:"Secrets",file:".secrets",badge:!0},app:{label:"App variables",file:".env"},runner:{label:"Runner config",file:".env"}},PD=["app","secret","runner"];function RD({on:e,onChange:t,title:i}){return ki.jsx("button",{type:"button",role:"switch","aria-checked":e,onClick:t,title:i,className:fx("relative inline-flex h-[18px] w-[30px] shrink-0 items-center rounded-full",e?"bg-accent":"bg-raised"),children:ki.jsx("span",{className:fx("inline-block h-[14px] w-[14px] rounded-full bg-on-accent shadow-sm transition-transform duration-150",e?"translate-x-[14px]":"translate-x-[2px]")})})}const AD=__(function({query:e}){const t=w_().variables;gi.useEffect(()=>{t.load()},[t]);const i=t.filtered(e),s=e.trim().length>0,[r,n]=gi.useState({secret:!1,app:!1,runner:!0}),[o,a]=gi.useState(null),l=t.edits.size+t.activated.size;return ki.jsxs("div",{className:"flex h-full flex-col",children:[ki.jsx(TD,{}),t.dirty&&ki.jsxs("div",{className:"flex items-center gap-2 border-b border-accent/30 bg-accent/10 px-3 py-1.5",children:[ki.jsxs("span",{className:"font-mono text-[11px] text-accent",children:[l," change",1===l?"":"s"]}),ki.jsx("button",{type:"button",disabled:t.saving,onClick:()=>{t.save()},className:"ml-auto rounded bg-accent px-2 py-0.5 font-mono text-[11px] text-on-accent hover:bg-accent-hover disabled:opacity-50",children:t.saving?"Saving…":"Save"}),ki.jsx("button",{type:"button",disabled:t.saving,onClick:()=>{t.load()},className:"rounded px-2 py-0.5 font-mono text-[11px] text-fg-3 hover:bg-raised",children:"Discard"})]}),t.error&&ki.jsx("div",{className:"border-b border-fail/30 bg-fail/10 px-3 py-1.5 font-mono text-[11px] text-fail",children:t.error}),t.warnings.length>0&&ki.jsxs("div",{className:"flex items-start gap-2 border-b border-warn/30 bg-warn/10 px-3 py-1.5",children:[ki.jsx("div",{className:"flex-1 space-y-0.5 font-mono text-[11px] text-warn",children:t.warnings.map((e,t)=>ki.jsxs("div",{children:["⚠ ",e]},t))}),ki.jsx("button",{type:"button",title:"Dismiss",onClick:()=>t.dismissWarnings(),className:"grid h-4 w-4 shrink-0 place-items-center rounded text-warn hover:bg-warn/20",children:ki.jsx(gx,{name:"x",className:"h-3 w-3"})})]}),ki.jsxs("div",{className:"flex-1 overflow-y-auto py-1",children:[PD.map(e=>{const t=i.filter(t=>t.category===e),l=LD[e],c=o===e;if(0===t.length&&!c&&!s)return ki.jsxs("button",{type:"button",onClick:()=>a(e),className:"flex h-7 w-full items-center gap-1 px-2 font-mono text-[11px] text-fg-4 hover:text-fg-2",children:[ki.jsx(gx,{name:"plus",className:"h-3.5 w-3.5"}),"Add ",l.label.toLowerCase()]},e);const h=r[e]&&!s;return ki.jsxs("div",{className:"mb-1",children:[ki.jsxs("div",{className:"group/header flex h-7 w-full items-center gap-1 px-2 text-fg-4",children:[ki.jsxs("button",{type:"button",onClick:()=>n(t=>({...t,[e]:!t[e]})),className:"flex flex-1 items-center gap-1 truncate hover:text-fg-2",children:[ki.jsx(gx,{name:h?"chevronR":"chevronD",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),ki.jsx("span",{className:"font-mono text-[11px] uppercase tracking-wider",children:l.label}),l.badge&&ki.jsx("span",{className:"rounded bg-warn/15 px-1 font-mono text-[9px] uppercase tracking-wide text-warn",children:"secret"}),ki.jsx("span",{className:"font-mono text-[10px] text-fg-4",children:l.file})]}),ki.jsx("button",{type:"button",title:`Add ${l.label.toLowerCase()}`,onClick:()=>{a(e),n(t=>({...t,[e]:!1}))},className:"grid h-5 w-5 place-items-center rounded text-fg-4 opacity-0 hover:bg-raised hover:text-fg group-hover/header:opacity-100",children:ki.jsx(gx,{name:"plus",className:"h-3.5 w-3.5"})}),ki.jsx("span",{className:"font-mono text-[10.5px] text-fg-4",children:t.length})]}),!h&&ki.jsxs(ki.Fragment,{children:[c&&ki.jsx(zD,{category:e,onClose:()=>a(null)}),t.map(e=>ki.jsx(OD,{v:e},`${e.source} ${e.key}`))]})]},e)}),0===i.length&&s&&ki.jsx(KN,{children:"no variables match"})]})]})}),TD=__(function(){const e=w_(),{environments:t,variables:i}=e;if(!t.hasAny)return null;const s=i.dirty,r=[{label:"base",value:null},...t.names.map(e=>({label:e,value:e}))];return ki.jsxs("div",{className:"flex flex-wrap items-center gap-1 border-b border-edge-soft px-3 py-1.5",title:s?"Save or discard changes before switching environments":void 0,children:[ki.jsx("span",{className:"mr-1 font-mono text-[10px] uppercase tracking-wider text-fg-4",children:"env"}),r.map(e=>{const i=t.active===e.value;return ki.jsx("button",{type:"button",disabled:s&&!i,onClick:()=>{t.setActive(e.value)},className:fx("rounded px-1.5 py-0.5 font-mono text-[11px] transition-colors",i?"bg-accent text-on-accent":"text-fg-3 hover:bg-raised hover:text-fg",s&&!i&&"opacity-40 hover:bg-transparent"),children:e.label},e.label)})]})}),zD=__(function({category:e,onClose:t}){const i=w_().variables,s=gi.useMemo(()=>new Set(i.rows.map(e=>e.key)),[i.rows]),r=gi.useMemo(()=>[...Jb].filter(e=>!s.has(e)).sort(),[s]),[n,o]=gi.useState("runner"===e?r[0]??"":""),[a,l]=gi.useState(""),c=n.trim().length>0&&!i.saving,h=async()=>{if(!c)return;await i.addVariable(n.trim(),a,e)&&t()};return ki.jsxs("div",{className:"mx-3 mb-1 flex flex-col gap-1 rounded border border-accent/30 bg-accent/10 p-2",children:["runner"===e?ki.jsxs("select",{value:n,onChange:e=>o(e.target.value),className:"h-6 rounded border border-edge-soft bg-canvas px-1 font-mono text-[11.5px] text-fg",children:[0===r.length&&ki.jsx("option",{value:"",children:"all runner keys set"}),r.map(e=>ki.jsx("option",{value:e,children:e},e))]}):ki.jsx("input",{type:"text",value:n,autoFocus:!0,spellCheck:!1,placeholder:"NAME (UPPER_SNAKE)",onChange:e=>o(e.target.value.toUpperCase()),onKeyDown:e=>"Enter"===e.key&&void h(),className:"h-6 rounded border border-edge-soft bg-canvas px-1.5 font-mono text-[11.5px] text-fg placeholder:text-fg-4"}),ki.jsxs("div",{className:"flex items-center gap-1",children:[ki.jsx("input",{type:"secret"===e?"password":"text",value:a,spellCheck:!1,placeholder:"value",onChange:e=>l(e.target.value),onKeyDown:e=>"Enter"===e.key&&void h(),className:"h-6 flex-1 rounded border border-edge-soft bg-canvas px-1.5 font-mono text-[11.5px] text-fg placeholder:text-fg-4"}),ki.jsx("button",{type:"button",disabled:!c,onClick:()=>{h()},className:"rounded bg-accent px-2 py-0.5 font-mono text-[11px] text-on-accent hover:bg-accent-hover disabled:opacity-50",children:"Add"}),ki.jsx("button",{type:"button",onClick:t,className:"rounded px-1.5 py-0.5 font-mono text-[11px] text-fg-3 hover:bg-raised",children:"Cancel"})]})]})}),OD=__(function({v:e}){const t=w_().variables,i=e.commented&&!t.isActivated(e),s="1"===t.effectiveValue(e),r=e.secret&&!t.isRevealed(e),n=t.isEdited(e)||t.isActivated(e);return ki.jsxs("div",{className:fx("group/row flex h-[44px] flex-col justify-center gap-0.5 px-3",i&&"opacity-45 hover:opacity-70 dark:opacity-70 dark:hover:opacity-100"),children:[ki.jsxs("div",{className:"flex items-center gap-1 truncate font-mono text-[11.5px]",children:[i&&ki.jsx("span",{className:"text-fg-4",children:"#"}),ki.jsx("span",{className:fx("truncate",i?"text-fg-3":"text-fg-2"),title:e.key,children:e.key}),e.shared&&ki.jsx("span",{className:"shrink-0 rounded bg-raised px-1 font-mono text-[9px] uppercase tracking-wide text-fg-3",title:"from the shared base file — value applies to every target",children:"shared"}),e.envOverlay&&ki.jsx("span",{className:"shrink-0 rounded bg-accent/15 px-1 font-mono text-[9px] uppercase tracking-wide text-accent",title:`from the .${"secrets"===e.source?"secrets":"env"}.${e.envOverlay} overlay — value applies in this environment only`,children:e.envOverlay}),n&&ki.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-accent",title:"edited"}),ki.jsx("button",{type:"button",title:"Delete variable",onClick:()=>{t.deleteVariable(e)},className:"ml-auto grid h-5 w-5 shrink-0 place-items-center rounded text-fg-4 opacity-0 hover:bg-fail/10 hover:text-fail group-hover/row:opacity-100",children:ki.jsx(gx,{name:"trash",className:"h-3.5 w-3.5"})})]}),ki.jsx("div",{className:"flex h-6 items-center gap-1",children:i?ki.jsx("button",{type:"button",onClick:()=>t.activate(e),title:"commented out — click to enable & edit",className:"w-full cursor-text truncate rounded px-1.5 text-left font-mono text-[11.5px] leading-6 text-fg-3 line-through decoration-fg-4 hover:bg-raised/60 hover:no-underline",children:e.secret?"••••••••••":e.value||" "}):e.bool?ki.jsxs(ki.Fragment,{children:[ki.jsx(RD,{on:s,onChange:()=>t.toggleBool(e),title:s?"On (1) — click to set 0":"Off (0) — click to set 1"}),ki.jsx("span",{className:fx("font-mono text-[11px] tabular-nums",s?"text-accent":"text-fg-4"),children:s?"1":"0"})]}):ki.jsxs(ki.Fragment,{children:[ki.jsx("input",{type:r?"password":"text",value:t.effectiveValue(e),spellCheck:!1,autoFocus:t.isActivated(e),placeholder:"empty",onChange:i=>t.setValue(e,i.target.value),className:"h-6 w-full rounded border border-edge-soft bg-canvas px-1.5 font-mono text-[11.5px] text-fg placeholder:text-fg-4 focus:border-accent focus:outline-none focus:ring-2 focus:ring-accent/20"}),e.secret&&ki.jsx("button",{type:"button",title:r?"Reveal":"Hide",onClick:()=>t.toggleReveal(e),className:"grid h-6 w-6 shrink-0 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fg-2",children:ki.jsx(gx,{name:r?"eye":"eyeOff",className:"h-3.5 w-3.5"})})]})})]})}),ID={scenarios:[{keys:["↑","↓"],label:"navigate"},{keys:["↵"],label:"open"},{keys:["R"],label:"run"}],helpers:[{keys:["↑","↓"],label:"navigate"},{keys:["↵"],label:"open"}],collections:[{keys:["↑","↓"],label:"navigate"},{keys:["↵"],label:"open"},{keys:["N"],label:"new collection"}],runs:[{keys:["↑","↓"],label:"navigate"},{keys:["↵"],label:"inspect"}],active:[{keys:["↵"],label:"attach"},{keys:["⌃C"],label:"abort"}],variables:[{keys:["↵"],label:"save"},{keys:["⌥"],label:"reveal secret"}],app:[{keys:["⌘K"],label:"filter log"}],snapshots:[{keys:["↵"],label:"open"},{keys:["O"],label:"open .zip"}]};function FD({section:e}){return ki.jsx("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-t border-edge-soft px-3 py-1.5 opacity-0 transition-opacity group-hover/pane:opacity-100",children:ID[e].map((e,t)=>ki.jsxs("span",{className:"flex items-center gap-1",children:[e.keys.map(e=>ki.jsx($E,{children:e},e)),ki.jsx("span",{className:"font-mono text-[10px] text-fg-4",children:e.label})]},t))})}const HD={scenarios:"Filter scenarios…",helpers:"Filter helpers…",collections:"Filter collections…",runs:"Filter runs…",active:"Filter active runs…",variables:"Filter variables…",app:"Filter app log…",snapshots:"Filter snapshots…"},WD={scenarios:"scenarios",helpers:"helpers",collections:"collections",runs:"history",active:"active",variables:"variables",app:"app under test",snapshots:"snapshots"},KD=__(function(){const e=w_(),t=e.layout,i=e.activityBar.section,[s,r]=gi.useState(""),[n,o]=gi.useState(!1),a=gi.useRef(null),l=e.targets.projectRoot,c=l.split("/").filter(Boolean).pop()??"",h=Bx({value:t.treeWidth,onChange:t.setTreeWidth,axis:"x",dir:1,min:t.treeMin,max:()=>Math.round(.5*window.innerWidth)});return gi.useEffect(()=>{const e=e=>{var t;(e.metaKey||e.ctrlKey)&&"k"===e.key.toLowerCase()&&(e.preventDefault(),null==(t=a.current)||t.focus())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),ki.jsxs("aside",{className:"group/pane relative flex shrink-0",style:{width:t.treeWidth},children:[ki.jsx(Lx,{axis:"x",onPointerDown:h,className:"-right-[6px]"}),ki.jsxs("div",{className:"uno-island flex min-w-0 flex-1 flex-col",children:[ki.jsxs("div",{className:"flex h-[33px] items-center gap-2 border-b border-edge-soft px-3",children:[ki.jsx(gx,{name:"folder",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),ki.jsxs("span",{className:"group relative flex min-w-0 flex-1",children:[ki.jsx("span",{className:"truncate font-mono text-[11.5px] text-fg-3",children:c||"loading…"}),l&&ki.jsx(Lj,{label:l,placement:"bottom-start"})]}),ki.jsx("button",{type:"button",disabled:n,className:fx("ml-auto grid h-6 w-6 shrink-0 place-items-center rounded text-fg-4 opacity-0 transition-opacity hover:bg-raised hover:text-fg-2 focus-visible:opacity-100 disabled:hover:bg-transparent group-hover/pane:opacity-100",n&&"opacity-100"),title:"Refresh",onClick:()=>{(async()=>{if(!n){o(!0);try{await Promise.all([e.scenarios.load(),e.helpers.load(),e.collections.load(),e.runs.load(),new Promise(e=>setTimeout(e,500))])}finally{o(!1)}}})()},children:ki.jsx(gx,{name:"refresh",className:fx("h-3.5 w-3.5",n&&"animate-spin")})})]}),ki.jsxs("div",{className:"flex h-7 items-center gap-2 px-3 pt-1",children:[ki.jsx("span",{className:"font-mono text-[10px] uppercase tracking-wider text-fg-4",children:WD[i]}),"scenarios"===i&&e.session.capabilities.canRun&&ki.jsxs("button",{type:"button",title:"New test — open a live authoring session (you + the agent co-author)",onClick:()=>{const t=window.prompt("New test to author live (feature/name, e.g. auth/login):"),i=null==t?void 0:t.trim();i&&e.activeRuns.startAuthoring(i).then(t=>{e.tabs.open({kind:"scenario-run",runId:t.runId})})},className:"ml-auto flex h-5 items-center gap-1 rounded px-1.5 font-mono text-[10px] text-fg-3 opacity-0 transition-opacity hover:bg-raised hover:text-fg focus-visible:opacity-100 group-hover/pane:opacity-100",children:[ki.jsx(gx,{name:"plus",className:"h-3 w-3"})," author"]})]}),ki.jsx("div",{className:"px-2 pb-2",children:ki.jsxs("label",{className:"flex h-7 items-center gap-1.5 rounded border border-edge-soft bg-canvas px-2 focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20",children:[ki.jsx(gx,{name:"search",className:"h-3.5 w-3.5 text-fg-4"}),ki.jsx("input",{ref:a,value:s,onChange:e=>r(e.target.value),placeholder:HD[i],className:"h-full w-full bg-transparent text-[12.5px] text-fg placeholder:text-fg-4 focus:outline-none"}),ki.jsx($E,{children:"⌘K"})]})}),ki.jsxs("div",{className:"flex-1 overflow-y-auto",children:["scenarios"===i&&ki.jsx(wD,{query:s}),"helpers"===i&&ki.jsx(iD,{query:s}),"collections"===i&&ki.jsx(eD,{query:s}),"runs"===i&&ki.jsx(fD,{query:s}),"active"===i&&ki.jsx(GE,{query:s}),"variables"===i&&ki.jsx(AD,{query:s}),"app"===i&&ki.jsx(JE,{query:s}),"snapshots"===i&&ki.jsx(DD,{query:s})]}),ki.jsx(FD,{section:i})]})]})}),UD=__(function(){const e=w_();return gi.useEffect(()=>{const t=t=>{if(t.ctrlKey&&!t.metaKey&&!t.altKey&&("`"===t.key||"Backquote"===t.code))return t.preventDefault(),void(e.session.capabilities.canTerminal&&e.terminal.toggle());if(!t.metaKey&&!t.ctrlKey)return;const i={1:"scenarios",2:"helpers",3:"collections",4:"runs",5:"active",6:"variables",7:"app",8:"snapshots"}[t.key];if(i)return t.preventDefault(),e.activityBar.setSection(i),void e.layout.openTree();"w"===t.key.toLowerCase()&&(t.preventDefault(),e.tabs.close(e.tabs.activeKey))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e]),ki.jsxs("div",{className:"flex h-full flex-col bg-shell pb-[3px] text-fg",children:[ki.jsxs("div",{className:"flex min-h-0 flex-1",children:[ki.jsx(NE,{}),ki.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5 p-1.5 pb-[3px] pl-0",children:[ki.jsxs("div",{className:"flex min-h-0 flex-1 gap-1.5",children:[e.layout.treeOpen&&ki.jsx(KD,{}),ki.jsxs("main",{className:"uno-island flex min-w-0 flex-1 flex-col",children:[ki.jsx(HE,{}),ki.jsx(pE,{}),ki.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:ki.jsx(dE,{})})]})]}),ki.jsx(sj,{})]})]}),ki.jsx(PE,{}),ki.jsx(bx,{})]})}),$D=/\x1b\[[\d;]*[a-zA-Z]/g;class qD{constructor(e){this.rest=e,this.byRunId=new Map,this.collectionByRunId=new Map,Wn(this,{},{autoBind:!0})}get list(){return[...this.byRunId.values()]}get activeList(){return[...this.byRunId.values()].filter(e=>"starting"===e.status||"running"===e.status||"paused"===e.status)}get queuedList(){return[...this.byRunId.values()].filter(e=>"queued"===e.status)}get liveRefs(){const e=new Map;for(const t of this.activeList)t.scenario&&("paused"===t.status?e.set(t.scenario,"paused"):e.has(t.scenario)||e.set(t.scenario,"running"));return e}get activeCollectionList(){return[...this.collectionByRunId.values()].filter(e=>"starting"===e.status||"running"===e.status)}get queuedCollectionList(){return[...this.collectionByRunId.values()].filter(e=>"queued"===e.status)}get hasActive(){return this.activeList.length>0||this.activeCollectionList.length>0}reconcileWithRuns(e){for(const t of e)if("running"!==t.status&&null!==t.outcome)if("collection"===t.kind){const e=this.collectionByRunId.get(t.runId);!e||"queued"!==e.status&&"starting"!==e.status&&"running"!==e.status||(e.status=this.statusFromOutcome(t.outcome),e.outcome=t.outcome)}else{const e=this.byRunId.get(t.runId);!e||"queued"!==e.status&&"starting"!==e.status&&"running"!==e.status||(e.status=this.statusFromOutcome(t.outcome),e.outcome=t.outcome)}}applyWsMessage(e){switch(e.kind){case"fs:run-started":if(this.collectionByRunId.has(e.runId))return;return void this.ensure(e.runId,e.scenario);case"fs:run-step":return void this.applyStep(e.runId,e.event);case"fs:collection-run-step":return void this.applyCollectionStep(e.runId,e.event);case"fs:run-finished":return void this.applyFinished(e.runId,e.outcome);case"log:line":if(this.collectionByRunId.has(e.runId))return;return void function(e,t,i){const s=(n=i,n.replace($D,"")),r=Date.now();var n;if(""===s.trim())return void(e.logs.length>0&&(e.logs[e.logs.length-1].receivedAt=0));const o=function(e,t){return"stderr"===e?"error":/^(warn|warning|⚠)\b/i.test(t)?"warn":"log"}(t,s),a=e.logs[e.logs.length-1];if(a&&a.stream===t&&a.level===o&&r-a.receivedAt<100)return a.text+="\n"+s,void(a.receivedAt=r);e.logs.push({stream:t,level:o,text:s,at:VD(r),receivedAt:r})}(this.ensure(e.runId,""),e.stream,e.line);default:return}}async startScenario(e,t={}){const i=await this.rest.startRun({kind:"scenario",scenario:e,...void 0!==t.headed?{headed:t.headed}:{},...void 0!==t.debug?{debug:t.debug}:{},...t.breakpoints&&t.breakpoints.length>0?{breakpoints:t.breakpoints}:{}}),s=this.ensure(i.runId,i.ref);return s.status="queued"===i.status?"queued":"starting",s.plainRun=!t.debug,{runId:i.runId,scenario:i.ref}}async startAuthoring(e){const t=await this.rest.startRun({kind:"authoring",scenario:e,headed:!0}),i=this.ensure(t.runId,t.ref);return i.status="queued"===t.status?"queued":"starting",i.mode="authoring",{runId:t.runId,scenario:t.ref}}async startCollection(e,t={}){const i=await this.rest.startRun({kind:"collection",collection:e,...void 0!==t.headed?{headed:t.headed}:{},...void 0!==t.workers?{workers:t.workers}:{},...void 0!==t.bail?{bail:t.bail}:{}});return this.ensureCollection(i.runId,i.ref).status="queued"===i.status?"queued":"starting",{runId:i.runId,collection:i.ref}}async abort(e){try{await this.rest.abortRun(e)}catch{try{await this.rest.dbgCommand(e,{cmd:"abort"})}catch{}}}async step(e){await this.rest.dbgCommand(e,{cmd:"step"})}async continueRun(e){await this.stopPicker(e),await this.rest.dbgCommand(e,{cmd:"continue"})}async togglePicker(e,t){const i=this.byRunId.get(e);(null==i?void 0:i.picker.active)&&i.picker.mode===t?await this.stopPicker(e):await this.startPicker(e,t)}async startPicker(e,t){const i=this.byRunId.get(e),s=(null==i?void 0:i.picker.execute)??!1;i&&(i.picker={active:!0,mode:t,execute:s}),await this.rest.dbgCommand(e,{cmd:"picker:start",mode:t,execute:s})}async setPickerExecute(e,t){const i=this.byRunId.get(e);i&&(i.picker={...i.picker,execute:t},i.picker.active&&await this.rest.dbgCommand(e,{cmd:"picker:start",mode:i.picker.mode,execute:t}))}async stopPicker(e){const t=this.byRunId.get(e);t&&t.picker.active&&(t.picker={active:!1,mode:t.picker.mode,execute:t.picker.execute},await this.rest.dbgCommand(e,{cmd:"picker:stop"}))}async pauseRun(e){await this.rest.dbgCommand(e,{cmd:"pause"})}async setWheel(e,t){const i=this.byRunId.get(e);i&&(i.wheel=t),await this.rest.dbgCommand(e,{cmd:"wheel",owner:t})}async requestSnapshot(e){await this.rest.dbgCommand(e,{cmd:"snapshot"})}async probe(e,t){const i=this.byRunId.get(e);if(!i)return;const s=crypto.randomUUID();i.consoleEntries.push({id:s,at:VD(Date.now()),input:t,status:"pending"}),setTimeout(()=>this.markProbeStale(e,s),1e4);try{await this.rest.dbgCommand(e,{cmd:"probe",locator:t,id:s})}catch{this.markProbeStale(e,s)}}markProbeStale(e,t){var i;const s=null==(i=this.byRunId.get(e))?void 0:i.consoleEntries.find(e=>e.id===t);s&&"pending"===s.status&&(s.status="stale")}async setBreakpoint(e,t,i){await this.rest.dbgCommand(e,{cmd:"set-bp",line:t,col:i})}async clearBreakpoint(e,t,i){await this.rest.dbgCommand(e,{cmd:"clear-bp",line:t,col:i})}findActiveByScenario(e){for(const t of this.byRunId.values())if(t.scenario===e&&("starting"===t.status||"running"===t.status||"paused"===t.status))return t;return null}async syncRuntime(e){let t=null;try{t=await this.rest.runtime(e)}catch{return}hn(()=>{var i;const s=this.ensure(e,t.scenario);if(s.vars=t.vars,s.callStack=t.callStack,s.wheel=t.wheel??"human",s.mode=t.mode??"debug",s.breakpoints=t.breakpoints??[],"completed"===(r=s.status)||"failed"===r||"aborted"===r)return;var r;const n=t.state;"paused-step"!==n&&"paused-failure"!==n&&"paused-breakpoint"!==n||(s.status="paused",t.current&&(s.pausedAt={reason:"paused-breakpoint"===n?"breakpoint":"paused-failure"===n?"failure":"step",file:(null==(i=t.callStack.at(-1))?void 0:i.file)??null,line:t.current.line,col:t.current.col}))})}ensureCollection(e,t){let i=this.collectionByRunId.get(e);if(i)t&&!i.collection&&(i.collection=t);else{this.byRunId.delete(e);const s={runId:e,collection:t,startedAt:Date.now(),status:"starting",scenarios:[],childRunIds:new Map,childOutcomes:new Map,outcome:null,events:[]};this.collectionByRunId.set(e,s),i=this.collectionByRunId.get(e)}return i}ensure(e,t){let i=this.byRunId.get(e);if(i)t&&!i.scenario&&(i.scenario=t);else{const s={runId:e,scenario:t,startedAt:Date.now(),status:"starting",events:[],logs:[],outcome:null,pausedAt:null,vars:{},callStack:[],picker:{active:!1,mode:"locator",execute:!1},wheel:"human",mode:"debug",breakpoints:[],plainRun:!1,consoleEntries:[],toolCalls:[]};this.byRunId.set(e,s),i=this.byRunId.get(e)}return i}applyStep(e,t){const i=this.ensure(e,"");if("locator:picked"!==t.kind)if("wheel:changed"!==t.kind){if("probe:result"===t.kind){const e=i.consoleEntries.find(e=>e.id===t.id);return void(e&&(e.status="done",e.result=t.result))}if("tool:call"!==t.kind){if("tool:result"===t.kind){const e=i.toolCalls.find(e=>e.callId===t.callId),s={status:t.ok?"ok":"error",durationMs:t.durationMs,preview:t.preview,...t.error?{error:t.error}:{}};return void(e?Object.assign(e,s):i.toolCalls.push({callId:t.callId,at:VD(t.t),tool:t.tool,args:"",...s}))}i.events.push(t),"run:started"===t.kind?(i.status="running",t.scenario&&(i.scenario=t.scenario)):"run:finished"===t.kind?(i.status=this.statusFromOutcome(t.outcome),i.outcome=t.outcome,i.pausedAt=null,i.picker={active:!1,mode:i.picker.mode,execute:i.picker.execute}):"paused"===t.kind?(i.status="paused",i.pausedAt={reason:t.reason,file:t.file,line:t.line,col:t.col},t.snapshot&&(i.vars=t.snapshot.vars,i.callStack=t.snapshot.callStack)):"resumed"!==t.kind&&"step:started"!==t.kind||("paused"===i.status&&(i.status="running"),i.pausedAt=null)}else i.toolCalls.push({callId:t.callId,at:VD(t.t),tool:t.tool,args:t.args,status:"running"})}else i.wheel=t.owner}applyCollectionStep(e,t){hn(()=>{const i=this.ensureCollection(e,"");switch(i.events.push(t),t.kind){case"collection-run:started":return i.status="running",i.collection=t.collection,void(i.scenarios=[...t.scenarios]);case"collection-run:scenario-started":return void i.childRunIds.set(t.scenario,t.scenarioRunId);case"collection-run:scenario-finished":return void i.childOutcomes.set(t.scenario,t.outcome);case"collection-run:finished":return i.status=this.statusFromOutcome(t.outcome),void(i.outcome=t.outcome)}})}applyFinished(e,t){const i=this.collectionByRunId.get(e);if(i)return i.status=this.statusFromOutcome(t),void(i.outcome=t);const s=this.byRunId.get(e);s&&(s.status=this.statusFromOutcome(t),s.outcome=t)}statusFromOutcome(e){switch(e){case"completed":return"completed";case"failed":return"failed";case"aborted":case"interrupted":return"aborted"}}}function VD(e){return new Date(e).toISOString().slice(11,23)}class YD{constructor(e){this.rest=e,this.status={available:!1,state:"stopped",log:[]},this.error=null,this.busy=!1,this.pollTimer=null,Wn(this,{},{autoBind:!0})}async load(){try{const e=await this.rest.appServerStatus();hn(()=>{this.status=e,this.error=null}),this.syncPolling()}catch(e){hn(()=>{this.error=e instanceof Error?e.message:String(e)})}}async start(){await this.act(()=>this.rest.appServerStart())}async stop(){await this.act(()=>this.rest.appServerStop())}browse(e,t){return this.rest.fsBrowse(e,t)}async act(e){this.busy=!0,this.error=null;try{const t=await e();hn(()=>{this.status=t}),this.syncPolling()}catch(t){hn(()=>{this.error=t instanceof Error?t.message:String(t)})}finally{hn(()=>{this.busy=!1})}}syncPolling(){const e="starting"===this.status.state;e&&null===this.pollTimer?this.pollTimer=setInterval(()=>{this.load()},1e3):e||null===this.pollTimer||(clearInterval(this.pollTimer),this.pollTimer=null)}destroy(){null!==this.pollTimer&&clearInterval(this.pollTimer),this.pollTimer=null}}class GD{constructor(e,t={}){this.rest=e,this.byScenario=new Map,this.saveTimer=null,this.saveDebounceMs=t.saveDebounceMs??200,Wn(this,{},{autoBind:!0})}async load(){let e;try{e=await this.rest.getBreakpoints()}catch{e={version:1,scenarios:{}}}hn(()=>{this.byScenario.clear();for(const[t,i]of Object.entries(e.scenarios))this.byScenario.set(t,new Set(i.map(XD)))})}get(e){return this.byScenario.get(e)??new Set}has(e,t,i){var s;return(null==(s=this.byScenario.get(e))?void 0:s.has(`${t}:${i}`))??!1}toggle(e,t,i){const s=`${t}:${i}`;this.byScenario.has(e)||this.byScenario.set(e,new Set);const r=this.byScenario.get(e),n=r.has(s);return n?r.delete(s):r.add(s),0===r.size&&this.byScenario.delete(e),this.scheduleSave(),!n}remove(e,t,i){const s=this.byScenario.get(e);s&&(s.delete(`${t}:${i}`),0===s.size&&this.byScenario.delete(e),this.scheduleSave())}clear(e){e?this.byScenario.delete(e):this.byScenario.clear(),this.scheduleSave()}all(){return[...this.byScenario.entries()].map(([e,t])=>({scenario:e,keys:[...t].sort()}))}scheduleSave(){var e,t;this.saveTimer&&clearTimeout(this.saveTimer),this.saveTimer=setTimeout(()=>{this.saveTimer=null,this.save()},this.saveDebounceMs),null==(t=(e=this.saveTimer).unref)||t.call(e)}async save(){const e={version:1,scenarios:Object.fromEntries([...this.byScenario.entries()].map(([e,t])=>[e,[...t].map(ZD)]))};try{await this.rest.putBreakpoints(e)}catch{console.warn("[breakpoints] save failed")}}}function XD(e){return`${e.line}:${e.col}`}function ZD(e){const[t,i]=e.split(":");return{line:Number(t),col:Number(i)}}function JD(e){return`${e.source}\0${e.key}`}class QD{constructor(e){this.rest=e,this.loading=!1,this.saving=!1,this.error=null,this.warnings=[],this.base=[],this.edits=new Map,this.revealed=new Set,this.activated=new Set,Wn(this,{},{autoBind:!0})}async load(){this.loading=!0,this.error=null;try{const e=await this.rest.getVariables();hn(()=>{this.base=e.vars,this.edits.clear(),this.activated.clear(),this.warnings=[]})}catch(e){hn(()=>{this.error=e instanceof Error?e.message:String(e),this.base=[]})}finally{hn(()=>{this.loading=!1})}}get count(){return this.base.length}get rows(){return this.base.map(e=>{const t=JD(e);return this.edits.has(t)?{...e,value:this.edits.get(t)}:e})}filtered(e){const t=e.trim().toLowerCase();return t?this.rows.filter(e=>e.key.toLowerCase().includes(t)):this.rows}effectiveValue(e){var t;const i=JD(e);return this.edits.has(i)?this.edits.get(i):(null==(t=this.base.find(e=>JD(e)===i))?void 0:t.value)??""}setValue(e,t){var i;const s=JD(e);t===((null==(i=this.base.find(e=>JD(e)===s))?void 0:i.value)??"")?this.edits.delete(s):this.edits.set(s,t)}toggleBool(e){this.setValue(e,"1"===this.effectiveValue(e)?"0":"1")}toggleReveal(e){const t=JD(e);this.revealed.has(t)?this.revealed.delete(t):this.revealed.add(t)}isRevealed(e){return this.revealed.has(JD(e))}isEdited(e){return this.edits.has(JD(e))}activate(e){e.commented&&this.activated.add(JD(e))}isActivated(e){return this.activated.has(JD(e))}get dirty(){return this.edits.size>0||this.activated.size>0}async save(){if(this.dirty&&!this.saving){this.saving=!0,this.error=null;try{const e={env:{},secrets:{}};for(const t of this.base){const i=JD(t);(this.edits.has(i)||this.activated.has(i))&&(e[t.source][t.key]=this.effectiveValue(t))}for(const t of["env","secrets"]){const i=e[t];0!==Object.keys(i).length&&await this.rest.putVariables({version:1,source:t,values:i})}await this.load()}catch(e){hn(()=>{this.error=e instanceof Error?e.message:String(e)})}finally{hn(()=>{this.saving=!1})}}}dismissWarnings(){this.warnings=[]}async addVariable(e,t,i){this.saving=!0,this.error=null;try{const s=await this.rest.addVariable({version:1,name:e,value:t,kind:i});return await this.load(),hn(()=>{this.warnings=s.warnings}),!0}catch(s){return hn(()=>{this.error=s instanceof Error?s.message:String(s)}),!1}finally{hn(()=>{this.saving=!1})}}async deleteVariable(e){this.saving=!0,this.error=null;try{const t=await this.rest.deleteVariable({version:1,name:e.key,source:e.source});await this.load(),hn(()=>{this.warnings=t.warnings})}catch(t){hn(()=>{this.error=t instanceof Error?t.message:String(t)})}finally{hn(()=>{this.saving=!1})}}}class eL{constructor(e,t){this.rest=e,this.active=t,this.items=[],this.loading=!1,this.error=null,Wn(this,{},{autoBind:!0})}pathFor(e){return`${N_}/${this.active.activeTestDir}/${B_}/${e}.yaml`}get count(){return this.items.length}async load(){this.loading=!0,this.error=null;try{const e=await this.rest.collections();hn(()=>{this.items=e,this.loading=!1})}catch(e){hn(()=>{this.error=e instanceof Error?e.message:String(e),this.loading=!1})}}clearError(){this.error=null}setError(e){this.error=e}byPath(e){return this.items.find(t=>t.path===e)}nameTaken(e,t){const i=e.toLowerCase();return this.items.some(e=>e.name.toLowerCase()===i&&e.path!==t)}async create(e,t=null){const i=e.trim();if(!i||this.nameTaken(i))return null;const s=this.items,r={name:i,path:this.pathFor(i),description:t,scenarios:[],workers:null,prepare:null};this.items=[r,...s],this.error=null;try{const e=await this.rest.createCollection({name:i,description:t});return hn(()=>{this.items=this.items.map(t=>t.path===r.path?e:t)}),e}catch(n){return hn(()=>{this.items=s,this.error=tL(n)}),null}}async rename(e,t){const i=t.trim();if(!i)return null;if(this.nameTaken(i,e))return null;const s=this.byPath(e);if(!s)return null;if(s.name===i)return s;const r=this.items,n={...s,name:i,path:this.pathFor(i)};this.items=r.map(t=>t.path===e?n:t),this.error=null;try{const e=await this.rest.renameCollection(s.name,i);return hn(()=>{this.items=this.items.map(t=>t.path===n.path?e:t)}),e}catch(o){return hn(()=>{this.items=r,this.error=tL(o)}),null}}async delete(e){const t=this.byPath(e);if(!t)return!1;const i=this.items;this.items=i.filter(t=>t.path!==e),this.error=null;try{return await this.rest.deleteCollection(t.name),!0}catch(s){return hn(()=>{this.items=i,this.error=tL(s)}),!1}}async setDescription(e,t){await this.patch(e,{description:t})}async setWorkers(e,t){await this.patch(e,{workers:t})}async addScenario(e,t){const i=this.byPath(e);i&&!i.scenarios.includes(t)&&await this.patch(e,{scenarios:[...i.scenarios,t]})}async removeScenario(e,t){const i=this.byPath(e);i&&await this.patch(e,{scenarios:i.scenarios.filter(e=>e!==t)})}async reorderScenarios(e,t){await this.patch(e,{scenarios:[...t]})}async patch(e,t){const i=this.byPath(e);if(!i)return;const s=this.items,r={...i,description:void 0===t.description?i.description:t.description,scenarios:void 0===t.scenarios?i.scenarios:t.scenarios,workers:void 0===t.workers?i.workers:t.workers};this.items=s.map(t=>t.path===e?r:t),this.error=null;try{const s=await this.rest.patchCollection(i.name,t);hn(()=>{this.items=this.items.map(t=>t.path===e?s:t)})}catch(n){hn(()=>{this.items=s,this.error=tL(n)})}}}function tL(e){return e instanceof Error?e.message:String(e)}class iL{constructor(e){this.rest=e,this.vocab=[],this.helpers=[],this.loaded=!1,Wn(this,{},{autoBind:!0})}async load(){if(!this.loaded){this.loaded=!0;try{const[e,t]=await Promise.all([this.rest.dslVocab(),this.rest.dslHelpers()]);hn(()=>{this.vocab=e,this.helpers=t})}catch{this.loaded=!1}}}async reload(){this.loaded=!1,await this.load()}async refreshHelpers(){if(this.loaded)try{const e=await this.rest.dslHelpers();hn(()=>{this.helpers=e})}catch{}}get entries(){return[...this.vocab,...this.helpers]}validate(e,t){return this.rest.validateDsl(e,t)}}class sL{constructor(){this.handles=new Map,this.reveals=nr.map(),this.revealSeq=0}requestReveal(e,t){hn(()=>this.reveals.set(e,{line:t,seq:++this.revealSeq}))}pendingReveal(e){return this.reveals.get(e)}consumeReveal(e,t){hn(()=>{var i;(null==(i=this.reveals.get(e))?void 0:i.seq)===t&&this.reveals.delete(e)})}register(e,t){return this.handles.set(e,t),()=>{this.handles.get(e)===t&&this.handles.delete(e)}}insertAtCursor(e,t){const i=this.handles.get(e);return!!i&&(i.insertAtCursor(t),!0)}}class rL{constructor(e,t){this.rest=e,this.onSwitched=t,this.names=[],this.active=null,this.switching=!1,Wn(this,{},{autoBind:!0})}async load(){try{const e=await this.rest.environments();hn(()=>{this.names=e.names,this.active=e.active})}catch{}}async setActive(e){if(e!==this.active&&!this.switching){hn(()=>{this.switching=!0});try{const t=await this.rest.setActiveEnvironment(e);hn(()=>{this.names=t.names,this.active=t.active}),this.onSwitched()}catch{}finally{hn(()=>{this.switching=!1})}}}get hasAny(){return this.names.length>0}}class nL{constructor(e){this.rest=e,this.items=[],this.loading=!1,this.error=null,Wn(this,{},{autoBind:!0})}get count(){return this.items.length}async load(){this.loading=!0,this.error=null;try{const e=await this.rest.helpers();hn(()=>{this.items=e,this.loading=!1})}catch(e){hn(()=>{this.error=e instanceof Error?e.message:String(e),this.loading=!1})}}}class oL{constructor(e){this.rest=e,this.byRunId=new Map,this.pending=new Set,this.errors=new Map,Wn(this,{},{autoBind:!0})}get(e){return this.byRunId.get(e)??null}async loadIfNeeded(e){if(!this.byRunId.has(e)&&!this.pending.has(e)){this.pending.add(e),this.errors.delete(e);try{const t=await this.rest.runDetail(e);hn(()=>{this.byRunId.set(e,t),this.pending.delete(e)})}catch(t){hn(()=>{this.errors.set(e,t instanceof Error?t.message:String(t)),this.pending.delete(e)})}}}invalidate(e){this.byRunId.delete(e),this.errors.delete(e)}}const aL="layout",lL={treeOpen:!0,treeWidth:280,inspectorOpen:!0,inspectorWidth:380};class cL{constructor(){const e=bE(aL,lL);this.treeOpen=e.treeOpen,this.treeWidth=Math.max(200,e.treeWidth),this.inspectorOpen=e.inspectorOpen,this.inspectorWidth=Math.max(240,e.inspectorWidth),Wn(this,{},{autoBind:!0})}toggleTree(){this.treeOpen=!this.treeOpen}openTree(){this.treeOpen=!0}setTreeWidth(e){this.treeWidth=Math.max(200,e)}toggleInspector(){this.inspectorOpen=!this.inspectorOpen}setInspectorWidth(e){this.inspectorWidth=Math.max(240,e)}get treeMin(){return 200}get inspectorMin(){return 240}get storageKey(){return aL}toPersisted(){return{treeOpen:this.treeOpen,treeWidth:this.treeWidth,inspectorOpen:this.inspectorOpen,inspectorWidth:this.inspectorWidth}}}class hL{constructor(e,t,i){this.scenarios=e,this.runs=t,this.active=i,Wn(this,{},{autoBind:!0})}get rows(){const e=this.active.liveRefs;return this.scenarios.items.map(t=>{const i=this.runs.latest[t.name];return i?{ref:t.name,path:t.path,status:dj(i.lastStatus,t.expectFail),live:e.get(t.name)??null,expectFail:t.expectFail,lastAt:i.lastAt,durationMs:i.lastDurationMs,failStreak:i.failStreak,recent:i.recent}:{ref:t.name,path:t.path,status:"never",live:e.get(t.name)??null,expectFail:t.expectFail,lastAt:null,durationMs:null,failStreak:0,recent:[]}}).sort((e,t)=>e.ref.localeCompare(t.ref))}get counts(){const e=this.rows;return{all:e.length,passed:e.filter(e=>"passed"===e.status).length,failed:e.filter(e=>"failed"===e.status).length,expected:e.filter(e=>"expected"===e.status).length,never:e.filter(e=>"never"===e.status).length}}get failing(){return this.rows.filter(e=>"failed"===e.status).sort((e,t)=>(t.lastAt??0)-(e.lastAt??0))}get indexReady(){return this.runs.indexReady}}class uL{constructor(e){this.rest=e,this.waiting=[],this.running=[],this.slots={total:0,used:0},this.enabled=!0,this.loading=!1,Wn(this,{},{autoBind:!0})}get waitingCount(){return this.waiting.length}async load(){let e;this.loading=!0;try{e=await this.rest.queue()}catch{return void hn(()=>{this.loading=!1})}hn(()=>{this.waiting=e.waiting,this.running=e.running,this.slots=e.slots,this.enabled=e.enabled,this.loading=!1})}async cancel(e){try{await this.rest.cancelQueued(e)}finally{await this.load()}}}const dL=[500,1e3,2e3,5e3,1e4,3e4];class fL{constructor(e){this.rest=e,this.items=[],this.latest={},this.loading=!1,this.loadingMore=!1,this.error=null,this.indexReady=!0,this.exhausted=!1,this.scenarioFilter=null,this.indexRetryStep=0,this.indexRetryTimer=null,Wn(this,{},{autoBind:!0})}lastRunByRef(e,t){if("scenario"===e){const e=this.latest[t];if(e)return function(e,t){return{runId:t.lastRunId,kind:"scenario",ref:e,startedAt:t.lastAt,finishedAt:null,durationMs:t.lastDurationMs,status:t.lastStatus,outcome:null}}(t,e)}let i=null;for(const s of this.items)s.kind===e&&s.ref===t&&(!i||s.startedAt>i.startedAt)&&(i=s);return i}get failed(){return this.items.filter(e=>"failed"===e.status)}get passed(){return this.items.filter(e=>"passed"===e.status)}get running(){return this.items.filter(e=>"running"===e.status)}get hasMore(){return!this.exhausted&&this.items.length>0}async setScenarioFilter(e){this.scenarioFilter!==e&&(this.scenarioFilter=e,await this.load())}async load(){this.clearIndexRetry(),this.loading=!0,this.error=null;try{const[e,t]=await Promise.all([this.rest.runs({limit:50,...this.scenarioFilter?{scenario:this.scenarioFilter}:{}}),this.loadLatest()]);hn(()=>{this.items=e.runs,this.exhausted=e.exhausted,this.indexReady=e.indexReady,this.latest=t,this.loading=!1}),e.indexReady?this.indexRetryStep=0:this.scheduleIndexRetry()}catch(e){hn(()=>{this.error=e instanceof Error?e.message:String(e),this.loading=!1})}}scheduleIndexRetry(){const e=dL[Math.min(this.indexRetryStep,dL.length-1)];this.indexRetryStep++,this.indexRetryTimer=setTimeout(()=>{this.indexRetryTimer=null,this.load()},e)}clearIndexRetry(){null!==this.indexRetryTimer&&(clearTimeout(this.indexRetryTimer),this.indexRetryTimer=null)}async loadMore(){if(this.loadingMore||this.loading||this.exhausted)return;const e=this.items[this.items.length-1];if(e){this.loadingMore=!0;try{const t=await this.rest.runs({limit:50,before:e.startedAt,...this.scenarioFilter?{scenario:this.scenarioFilter}:{}});hn(()=>{const e=new Set(this.items.map(e=>e.runId));this.items=[...this.items,...t.runs.filter(t=>!e.has(t.runId))],this.exhausted=t.exhausted,this.indexReady=t.indexReady,this.loadingMore=!1})}catch(t){hn(()=>{this.error=t instanceof Error?t.message:String(t),this.loadingMore=!1})}}}async loadLatest(){try{return await this.rest.runsLatest()}catch{return{}}}}class pL{constructor(e){this.rest=e,this.byRunId=new Map,this.pending=new Set,Wn(this,{},{autoBind:!0})}get(e){return this.byRunId.get(e)}async loadIfNeeded(e){if(!this.byRunId.has(e)&&!this.pending.has(e)){this.pending.add(e);try{const t=await this.rest.runDetail(e),i="sources"in t?t.sources:null;hn(()=>{this.byRunId.set(e,i),this.pending.delete(e)})}catch{hn(()=>{this.pending.delete(e)})}}}}class gL{constructor(e){this.rest=e,this.byRunId=new Map,this.pending=new Set,Wn(this,{},{autoBind:!0})}get(e){return this.byRunId.get(e)}async loadIfNeeded(e){if(!this.byRunId.has(e)&&!this.pending.has(e)){this.pending.add(e);try{const t=await this.rest.runtime(e);hn(()=>{this.byRunId.set(e,t),this.pending.delete(e)})}catch{hn(()=>{this.byRunId.set(e,null),this.pending.delete(e)})}}}invalidate(e){this.byRunId.delete(e)}}const vL="scenarios.expanded";class mL{constructor(e,t,i,s=""){this.rest=e,this.tabs=t,this.active=i,this.items=[],this.folders=[],this.loading=!1,this.error=null,this.clipboard=null,this.creating=null,this.renaming=null,this.menu=null,this.selected=null,this.pendingDelete=null,this.actionError=null,this.scope=s,this.expanded=bE(xE(vL,s),{}),Wn(this,{},{autoBind:!0})}setScope(e){e!==this.scope&&(this.scope=e,this.expanded=bE(this.storageKey,{}))}get storageKey(){return xE(vL,this.scope)}get count(){return this.items.length}async load(){this.loading=!0,this.error=null;try{const e=await this.rest.scenarios();hn(()=>{this.items=e.scenarios,this.folders=e.folders,this.loading=!1})}catch(e){hn(()=>{this.error=e instanceof Error?e.message:String(e),this.loading=!1})}}buildTree(e){var t,i;const s=e.trim().toLowerCase(),r=new Set(this.folders);for(const a of this.items){let e=_D(a.name);for(;e;)r.add(e),e=_D(e)}const n=new Map;for(const a of r)n.set(a,{rel:a,name:mD(a),folders:[],scenarios:[]});const o={folders:[],scenarios:[]};for(const a of[...r].sort()){const e=n.get(a),i=_D(a);""===i?o.folders.push(e):null==(t=n.get(i))||t.folders.push(e)}for(const a of this.items){const e=_D(a.name),t=""===e?o.scenarios:null==(i=n.get(e))?void 0:i.scenarios;null==t||t.push(a)}return function(e,t,i){const s=e=>{const r=e.folders.map(s).filter(e=>null!==e).sort((e,t)=>e.name.localeCompare(t.name)),n=!!t&&e.name.toLowerCase().includes(t),o=(n?e.scenarios:e.scenarios.filter(i)).slice().sort((e,t)=>e.name.localeCompare(t.name));return t&&0===r.length&&0===o.length&&!n?null:{...e,folders:r,scenarios:o}};return{folders:e.folders.map(s).filter(e=>null!==e).sort((e,t)=>e.name.localeCompare(t.name)),scenarios:e.scenarios.filter(i).slice().sort((e,t)=>e.name.localeCompare(t.name))}}(o,s,e=>!s||e.name.toLowerCase().includes(s)||e.path.toLowerCase().includes(s)||e.title.toLowerCase().includes(s))}isExpanded(e){return this.expanded[e]??!0}toggle(e){this.expanded[e]=!this.isExpanded(e)}select(e){this.selected=e}openMenu(e,t,i){this.selected=i,this.menu={x:e,y:t,target:i}}closeMenu(){this.menu=null}startCreate(e,t){this.creating={parent:e,kind:t},""!==e&&(this.expanded[e]=!0),this.closeMenu()}cancelCreate(){this.creating=null}startRename(e){"blank"!==e.kind&&(this.renaming=e),this.closeMenu()}cancelRename(){this.renaming=null}copy(e){"scenario"===e.kind?this.clipboard={kind:"scenario",rel:e.rel,label:bD(mD(e.rel))}:"folder"===e.kind&&(this.clipboard={kind:"folder",rel:e.rel,label:mD(e.rel)}),this.closeMenu()}copyPath(e){var t;if("blank"===e.kind)return;const i=`${N_}/${M_}/${e.rel}`;null==(t=navigator.clipboard)||t.writeText(i),this.closeMenu()}requestDelete(e){"blank"!==e.kind&&(this.pendingDelete=e),this.closeMenu()}cancelDelete(){this.pendingDelete=null}clearActionError(){this.actionError=null}async commitCreate(e){const t=this.creating;this.creating=null,t&&await this.run(async()=>{if("folder"===t.kind){const{folder:i}=await this.rest.createFolder(t.parent,e);hn(()=>{this.expanded[i]=!0}),await this.load()}else{const{scenario:i}=await this.rest.createScenario(t.parent,e);await this.load(),this.tabs.openScenario(this.proj(i)),hn(()=>{this.selected={kind:"scenario",rel:i}})}})}async commitRename(e){const t=this.renaming;this.renaming=null,t&&"blank"!==t.kind&&await this.run(async()=>{const{from:i,to:s}=await this.rest.renameScenarioNode(t.rel,e);"scenario"===t.kind?this.tabs.retargetScenarioPath(this.proj(i),this.proj(s)):(this.tabs.retargetScenarioPrefix(this.proj(i),this.proj(s)),hn(()=>{this.expanded[s]=this.expanded[i]??!0,delete this.expanded[i]})),await this.load()})}async paste(e){const t=this.clipboard;this.closeMenu(),t&&await this.run(async()=>{const{created:i}=await this.rest.copyScenarioNode(t.rel,e);hn(()=>{""!==e&&(this.expanded[e]=!0)}),await this.load(),hn(()=>{this.renaming="folder"===t.kind?{kind:"folder",rel:i}:{kind:"scenario",rel:i},this.selected=this.renaming})})}async confirmDelete(){const e=this.pendingDelete;this.pendingDelete=null,e&&"blank"!==e.kind&&await this.run(async()=>{await this.rest.deleteScenarioNode(e.rel),"scenario"===e.kind?this.tabs.closeScenarioPath(this.proj(e.rel)):this.tabs.closeScenarioPrefix(this.proj(e.rel)),await this.load()})}async run(e){this.actionError=null;try{await e()}catch(t){hn(()=>{this.actionError=t instanceof Error?t.message:String(t)})}}proj(e){return`${N_}/${this.active.activeTestDir}/${e}`}}const _L={canRun:!0,canEditFiles:!0,canTerminal:!0,canBrowseFs:!0};class bL{constructor(e){this.rest=e,this.capabilities=_L,this.identity=null,Wn(this,{},{autoBind:!0})}async load(){try{const e=await this.rest.session();hn(()=>{this.capabilities=e.capabilities,this.identity=e.identity})}catch{}}get restricted(){const e=this.capabilities;return!(e.canRun&&e.canEditFiles&&e.canTerminal&&e.canBrowseFs)}}class xL{constructor(e){this.rest=e,this.list=[],this.loaded=!1,Wn(this,{},{autoBind:!0})}manifestOf(e){var t;return null==(t=this.list.find(t=>t.snapshotId===e))?void 0:t.manifest}async load(){try{const e=await this.rest.snapshots();hn(()=>{this.list=e})}catch{}finally{hn(()=>{this.loaded=!0})}}async importFile(e){const t=await this.rest.importSnapshot(e);return hn(()=>{const e=this.list.findIndex(e=>e.snapshotId===t.snapshotId);e>=0?this.list[e]=t:this.list.unshift(t)}),t.snapshotId}async remove(e){await this.rest.deleteSnapshot(e),hn(()=>{this.list=this.list.filter(t=>t.snapshotId!==e)})}}class yL{constructor(e){this.rest=e,this.cache=new Map,this.inflight=new Map,this.loading=new Set,this.errors=new Map,this.drafts=new Map,this.conflicts=new Set,this.saving=new Set,Wn(this,{},{autoBind:!0})}get(e){return this.cache.get(e)}draft(e){return this.drafts.has(e)?this.drafts.get(e):this.cache.get(e)}setDraft(e,t){if(this.cache.get(e)===t?this.drafts.delete(e):this.drafts.set(e,t),this.conflicts.has(e)){const t=new Set(this.conflicts);t.delete(e),this.conflicts=t}}insertAfterLine(e,t,i){var s;const r=this.draft(e);if(void 0===r)return;const n=r.split("\n"),o=Math.max(0,Math.min(t,n.length)),a=n[o-1]??n[n.length-1]??"",l=(null==(s=/^[ \t]*/.exec(a))?void 0:s[0])??"";n.splice(o,0,`${l}${i}`),this.setDraft(e,n.join("\n"))}insertBeforeLastLine(e,t){var i;const s=this.draft(e);if(void 0===s)return;const r=s.split("\n");let n=r.length;for(;n>0&&""===r[n-1].trim();)n--;const o=Math.max(0,n-1),a=(null==(i=/^[ \t]*/.exec(r[o]??""))?void 0:i[0])??"";r.splice(o,0,`${a} ${t}`),this.setDraft(e,r.join("\n"))}isDirty(e){return this.drafts.has(e)}isSaving(e){return this.saving.has(e)}hasConflict(e){return this.conflicts.has(e)}discardDraft(e){this.drafts.delete(e);const t=new Set(this.conflicts);t.delete(e),this.conflicts=t}async save(e){const t=this.drafts.get(e);if(void 0!==t){hn(()=>{const t=new Set(this.saving);t.add(e),this.saving=t});try{await this.rest.writeSource(e,t),hn(()=>{this.cache.set(e,t),this.drafts.delete(e);const i=new Set(this.conflicts);i.delete(e),this.conflicts=i,this.errors.delete(e)})}catch(i){throw hn(()=>{this.errors.set(e,i instanceof Error?i.message:String(i))}),i}finally{hn(()=>{const t=new Set(this.saving);t.delete(e),this.saving=t})}}}isLoading(e){return this.loading.has(e)}error(e){return this.errors.get(e)??null}async getOrLoad(e){const t=this.cache.get(e);if(void 0!==t)return t;const i=this.inflight.get(e);if(i)return i;const s=this.fetch(e);this.inflight.set(e,s),hn(()=>{const t=new Set(this.loading);t.add(e),this.loading=t});try{return await s}finally{this.inflight.delete(e),hn(()=>{const t=new Set(this.loading);t.delete(e),this.loading=t})}}invalidate(e){const t=void 0!==e?[e]:Array.from(this.cache.keys());for(const i of t)this.errors.delete(i),this.refresh(i)}async refresh(e){if(this.inflight.has(e))return;const t=this.fetch(e);this.inflight.set(e,t);try{await t}catch{}finally{this.inflight.delete(e)}}async fetch(e){try{const t=this.cache.get(e),{content:i}=await this.rest.source(e);return hn(()=>{this.cache.set(e,i),this.errors.delete(e);const s=this.drafts.get(e);if(void 0!==s&&s!==i&&t!==i){const t=new Set(this.conflicts);t.add(e),this.conflicts=t}}),i}catch(t){const i=t instanceof Error?t.message:String(t);throw hn(()=>{this.errors.set(e,i),this.cache.delete(e)}),t}}}const wL="tabs.openTabs",SL="overview";class kL{constructor(e=""){this.scope=e;const t=bE(xE(wL,e),{tabs:[],activeKey:null});this.hydrate(t),Wn(this,{},{autoBind:!0})}hydrate(e){const t=e.tabs.filter(e=>"overview"!==e.kind);this.tabs=[{kind:"overview"},...t];const i=e.activeKey,s=null!=i&&this.tabs.some(e=>this.keyFor(e)===i);this.activeKey=s?i:t.length?this.keyFor(t[t.length-1]):SL}setScope(e){if(e===this.scope)return;this.scope=e;const t=bE(this.storageKey,{tabs:[],activeKey:null});this.hydrate(t)}open(e){const t=this.keyFor(e);this.tabs.some(e=>this.keyFor(e)===t)||this.tabs.push(e),this.activeKey=t}close(e){if(e===SL)return;const t=this.tabs.findIndex(t=>this.keyFor(t)===e);if(!(t<0)&&(this.tabs.splice(t,1),this.activeKey===e)){const e=this.tabs[t]??this.tabs[t-1]??this.tabs[0];this.activeKey=this.keyFor(e)}}activate(e){this.tabs.some(t=>this.keyFor(t)===e)&&(this.activeKey=e)}closeOthers(e){const t=this.tabs.find(t=>this.keyFor(t)===e);if(!t)return;const i=this.tabs[0];this.tabs=t===i?[i]:[i,t],this.activeKey=e}closeAll(){this.tabs=[this.tabs[0]],this.activeKey=SL}renameCollectionTab(e,t){this.swapPath("collection",e,t)}retargetScenarioPath(e,t){this.swapPath("scenario",e,t)}retargetScenarioPrefix(e,t){const i=CL(e),s=CL(t);let r=null;this.tabs=this.tabs.map(e=>{if("scenario"===e.kind&&e.path.startsWith(i)){const t=s+e.path.slice(i.length);return this.activeKey===`scenario:${e.path}`&&(r=t),{kind:"scenario",path:t}}return e}),r&&(this.activeKey=`scenario:${r}`)}closeScenarioPath(e){this.close(`scenario:${e}`)}closeScenarioPrefix(e){const t=CL(e);for(const i of[...this.tabs])"scenario"===i.kind&&i.path.startsWith(t)&&this.close(`scenario:${i.path}`)}openScenario(e){this.open({kind:"scenario",path:e})}swapPath(e,t,i){if(t===i)return;const s=this.tabs.findIndex(i=>i.kind===e&&i.path===t);if(s<0)return;const r=this.activeKey===`${e}:${t}`;this.tabs.splice(s,1,{kind:e,path:i}),r&&(this.activeKey=`${e}:${i}`)}get activeTab(){return this.tabs.find(e=>this.keyFor(e)===this.activeKey)??this.tabs[0]}keyFor(e){switch(e.kind){case"overview":return SL;case"scenario":case"helper":case"collection":return`${e.kind}:${e.path}`;case"scenario-run":case"collection-run":return`${e.kind}:${e.runId}`;case"snapshot":return`snapshot:${e.snapshotId}`}}toPersisted(){return{tabs:this.tabs.filter(e=>"overview"!==e.kind),activeKey:this.activeKey}}get storageKey(){return xE(wL,this.scope)}}function CL(e){return e.endsWith("/")?e:`${e}/`}class jL{constructor(e){this.rest=e,this.checks=null,this.error=null,this.busy=!1,this.checkedTarget=null,Wn(this,{},{autoBind:!0})}async run(e){this.busy=!0,this.error=null;try{const{checks:t}=await this.rest.targetDoctor(e);hn(()=>{this.checks=t,this.checkedTarget=e})}catch(t){hn(()=>{this.error=t instanceof Error?t.message:String(t),this.checks=null,this.checkedTarget=null})}finally{hn(()=>{this.busy=!1})}}reset(){this.checks=null,this.error=null,this.checkedTarget=null}get hasErrors(){var e;return(null==(e=this.checks)?void 0:e.some(e=>"error"===e.severity))??!1}}const NL="target.active";class ML{constructor(e,t){this.rest=e,this.onSwitched=t,this.available=[],this.active="",this.projectRoot="",this.switching=!1,Wn(this,{},{autoBind:!0})}async load(){try{const e=await this.rest.targets(),t=bE(NL,null),i=e.targets.find(e=>e.target===t);if(t&&t!==e.active&&i&&(!i.host||i.host.ok)){const e=await this.rest.setActiveTarget(t);return hn(()=>{this.available=e.targets,this.active=e.active,this.projectRoot=e.projectRoot}),void this.onSwitched()}hn(()=>{this.available=e.targets,this.active=e.active,this.projectRoot=e.projectRoot})}catch{}}async setActive(e){if(e===this.active||this.switching)return;const t=this.available.find(t=>t.target===e);if(!(null==t?void 0:t.host)||t.host.ok){hn(()=>{this.switching=!0});try{const t=await this.rest.setActiveTarget(e);hn(()=>{this.available=t.targets,this.active=t.active,this.projectRoot=t.projectRoot}),yE(NL,this.active),this.onSwitched()}catch{}finally{hn(()=>{this.switching=!1})}}}get current(){return this.available.find(e=>e.target===this.active)}get activeTestDir(){var e;return(null==(e=this.current)?void 0:e.testDir)??M_}get activeSuffix(){var e;return(null==(e=this.current)?void 0:e.suffix)??""}get activeDebugCaps(){var e;return(null==(e=this.current)?void 0:e.debug)??{picker:!0,attach:!0,resumeFromFailure:!1}}get hasMultiple(){return this.available.length>1}}class BL{constructor(e,t){this.rest=e,this.onSwitched=t,this.file=null,this.posting=!1,this.pendingBundleId=null,this.error=null,this.timer=null,this.fastTimer=null,Wn(this,{},{autoBind:!0})}get switching(){return this.posting||null!==this.pendingBundleId}get hosted(){return null!==this.file}get current(){const e=this.file;return(null==e?void 0:e.currentBundleId)?e.bundles.find(t=>t.bundleId===e.currentBundleId)??null:null}get label(){var e;return this.file?(null==(e=this.current)?void 0:e.label)??"no bundle yet":null}get canSwitch(){return null!==this.file&&this.file.allowSwitch&&void 0!==this.file.switchPath&&this.file.bundles.length>0}async load(){try{const e=await this.rest.workspace();hn(()=>{this.file=e,null!==this.pendingBundleId&&(null==e?void 0:e.currentBundleId)===this.pendingBundleId&&(this.pendingBundleId=null,this.stopFastPoll(),this.onSwitched())})}catch{hn(()=>{this.file=null})}}start(){this.load(),null===this.timer&&(this.timer=setInterval(()=>{this.load()},3e4))}stop(){null!==this.timer&&clearInterval(this.timer),this.timer=null,this.stopFastPoll()}async switchTo(e){var t;const i=null==(t=this.file)?void 0:t.switchPath;if(void 0!==i&&!this.switching){hn(()=>{this.posting=!0,this.error=null});try{if("switching"===await this.rest.switchBundle(i,e))return hn(()=>{this.pendingBundleId=e}),void this.startFastPoll();await this.load(),this.onSwitched()}catch(s){hn(()=>{this.error=s instanceof Error?s.message:String(s)})}finally{hn(()=>{this.posting=!1})}}}startFastPoll(){null===this.fastTimer&&(this.fastTimer=setInterval(()=>{this.load()},EL))}stopFastPoll(){null!==this.fastTimer&&clearInterval(this.fastTimer),this.fastTimer=null}}const EL=3e3,DL="terminal",LL={open:!1,height:300},PL=()=>Math.round(.75*("undefined"!=typeof window?window.innerHeight:900));class RL{constructor(){this.tabs=[],this.activeId=null,this.seq=0;const e=bE(DL,LL);this.open=e.open,this.height=Math.max(140,e.height),Wn(this,{},{autoBind:!0}),this.open&&this.newTerm("local")}toggle(){this.open?this.open=!1:this.show()}show(){this.open=!0,0===this.tabs.length&&this.newTerm("local")}hide(){this.open=!1}setHeight(e){this.height=Math.min(PL(),Math.max(140,e))}newTerm(e){this.seq+=1;const t=`term_${this.seq}`;return this.tabs.push({id:t,kind:e}),this.activeId=t,this.open=!0,t}activate(e){this.tabs.some(t=>t.id===e)&&(this.activeId=e)}closeTerm(e){const t=this.tabs.findIndex(t=>t.id===e);t<0||(this.tabs.splice(t,1),this.activeId===e&&(this.activeId=this.tabs.length?this.tabs[Math.min(t,this.tabs.length-1)].id:null))}get heightMin(){return 140}get heightMax(){return PL()}get activeKind(){var e;return(null==(e=this.tabs.find(e=>e.id===this.activeId))?void 0:e.kind)??null}get storageKey(){return DL}toPersisted(){return{open:this.open,height:this.height}}}const AL="theme.theme";class TL{constructor(){this.system=this.systemPreference(),this.mode=bE(AL,"system"),Wn(this,{},{autoBind:!0}),this.watchSystem()}get theme(){return"system"===this.mode?this.system:this.mode}cycle(){this.mode="light"===this.mode?"dark":"dark"===this.mode?"system":"light"}set(e){this.mode=e}get storageKey(){return AL}setSystem(e){this.system=e}watchSystem(){if("undefined"==typeof window||!window.matchMedia)return;window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",e=>{this.setSystem(e.matches?"dark":"light")})}systemPreference(){return"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}}class zL extends Error{constructor(e,t,i){super(e),this.status=t,this.body=i,this.name="RestClientError"}}yn({enforceActions:"observed",computedRequiresReaction:!1,reactionRequiresObservable:!0,observableRequiresReaction:!1});const OL=document.getElementById("root");if(!OL)throw new Error("missing #root");const IL=new class{constructor(e=""){this.base=e}targets(){return this.getJson("/api/targets")}setActiveTarget(e){return this.postJson("/api/targets/active",{target:e})}targetDoctor(e){return this.postJson(`/api/targets/${encodeURIComponent(e)}/doctor`,{})}environments(){return this.getJson("/api/environments")}setActiveEnvironment(e){return this.postJson("/api/environments/active",{env:e})}schedules(){return this.getJson("/api/schedules")}putSchedules(e){return this.putJson("/api/schedules",{schedules:e})}workspace(){return this.getJson("/api/workspace")}async switchBundle(e,t){const i=await this.postJson(e,{bundleId:t});return"switching"===(null==i?void 0:i.status)?"switching":"done"}scenarios(){return this.getJson("/api/scenarios")}createFolder(e,t){return this.postJson("/api/scenarios/folder",{parent:e,name:t})}createScenario(e,t){return this.postJson("/api/scenarios/scenario",{parent:e,name:t})}renameScenarioNode(e,t){return this.postJson("/api/scenarios/rename",{path:e,newName:t})}copyScenarioNode(e,t){return this.postJson("/api/scenarios/copy",{from:e,destParent:t})}async deleteScenarioNode(e){await this.postJson("/api/scenarios/delete",{path:e})}helpers(){return this.getJson("/api/helpers")}collections(){return this.getJson("/api/collections")}createCollection(e){return this.postJson("/api/collections",e)}patchCollection(e,t){return this.sendJson("PATCH",`/api/collections/${encodeURIComponent(e)}`,t)}renameCollection(e,t){return this.postJson(`/api/collections/${encodeURIComponent(e)}/rename`,{newName:t})}async deleteCollection(e){await this.sendJson("DELETE",`/api/collections/${encodeURIComponent(e)}`,void 0)}runs(e={}){const t=new URLSearchParams;void 0!==e.limit&&t.set("limit",String(e.limit)),void 0!==e.before&&t.set("before",String(e.before)),e.scenario&&t.set("scenario",e.scenario);const i=t.toString();return this.getJson("/api/runs"+(i?`?${i}`:""))}runsLatest(){return this.getJson("/api/runs/latest")}runDetail(e){return this.getJson(`/api/runs/${encodeURIComponent(e)}`)}runChildren(e){return this.getJson(`/api/runs/${encodeURIComponent(e)}/children`)}source(e){return this.getJson(`/api/source?path=${encodeURIComponent(e)}`)}async writeSource(e,t){await this.putJson("/api/source",{path:e,content:t})}dslVocab(){return this.getJson("/api/dsl/vocab")}dslHelpers(){return this.getJson("/api/dsl/helpers")}validateDsl(e,t){return this.postJson("/api/dsl/validate",{source:e,fileKind:t})}startRun(e){return this.postJson("/api/run",e)}async abortRun(e){await this.postJson(`/api/runs/${encodeURIComponent(e)}/abort`,{})}queue(){return this.getJson("/api/queue")}cancelQueued(e){return this.sendJson("DELETE",`/api/queue/${encodeURIComponent(e)}`,void 0)}dbgCommand(e,t){return this.postJson(`/api/runs/${encodeURIComponent(e)}/dbg/command`,t)}runtime(e){return this.getJson(`/api/runs/${encodeURIComponent(e)}/runtime`)}getBreakpoints(){return this.getJson("/api/breakpoints")}async putBreakpoints(e){await this.putJson("/api/breakpoints",e)}getVariables(){return this.getJson("/api/variables")}async putVariables(e){await this.putJson("/api/variables",e)}addVariable(e){return this.postJson("/api/variables",e)}deleteVariable(e){return this.sendJson("DELETE","/api/variables",e)}appServerStatus(){return this.getJson("/api/app-server")}appServerStart(){return this.postJson("/api/app-server/start",{})}appServerStop(){return this.postJson("/api/app-server/stop",{})}fsBrowse(e,t){const i=new URLSearchParams;e&&i.set("path",e),t&&t.length>0&&i.set("exts",t.join(","));const s=i.toString();return this.getJson("/api/fs/browse"+(s?`?${s}`:""))}session(){return this.getJson("/api/session")}snapshots(){return this.getJson("/api/snapshots")}async importSnapshot(e){const t=await fetch(this.base+"/api/snapshots/import",{method:"POST",headers:{"content-type":"application/zip"},body:e});return this.parseOrThrow(t)}async deleteSnapshot(e){const t=await fetch(this.base+`/api/snapshots/${encodeURIComponent(e)}`,{method:"DELETE"});await this.parseOrThrow(t)}async getJson(e){const t=await fetch(this.base+e);return this.parseOrThrow(t)}postJson(e,t){return this.sendJson("POST",e,t)}putJson(e,t){return this.sendJson("PUT",e,t)}async sendJson(e,t,i){const s=await fetch(this.base+t,{method:e,headers:void 0===i?void 0:{"content-type":"application/json"},body:void 0===i?void 0:JSON.stringify(i)});return this.parseOrThrow(s)}async parseOrThrow(e){let t=null;const i=await e.text();try{t=i?JSON.parse(i):null}catch{t=i}if(!e.ok)throw new zL(function(e){if(!e||"object"!=typeof e)return null;const t=e.message;if("string"==typeof t&&t.length>0)return t;const i=e.error;if(i&&"object"==typeof i){const e=i.message;if("string"==typeof e&&e.length>0)return e}return null}(t)??`HTTP ${e.status}`,e.status,t);return t}},FL=new class{constructor(e={}){this.state="idle",this.socket=null,this.handlers=new Set,this.reconnectTimer=null,this.explicitlyClosed=!1,this.url=e.url??function(){const e="https:"===window.location.protocol?"wss:":"ws:";return`${e}//${window.location.host}/ws`}(),this.minBackoff=e.minBackoffMs??500,this.maxBackoff=e.maxBackoffMs??3e4,this.currentBackoff=this.minBackoff}connect(){this.socket&&this.socket.readyState<=WebSocket.OPEN||(this.explicitlyClosed=!1,this.openSocket())}disconnect(){this.explicitlyClosed=!0,null!==this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.socket&&(this.socket.close(),this.socket=null),this.state="closed"}onMessage(e){return this.handlers.add(e),()=>{this.handlers.delete(e)}}openSocket(){this.state="connecting";const e=new WebSocket(this.url);this.socket=e,e.addEventListener("open",()=>{this.state="open",this.currentBackoff=this.minBackoff}),e.addEventListener("message",e=>{this.deliver(e.data)}),e.addEventListener("close",()=>{this.state="closed",this.socket=null,this.explicitlyClosed||this.scheduleReconnect()}),e.addEventListener("error",()=>{})}deliver(e){if("string"!=typeof e)return;let t;try{t=JSON.parse(e)}catch{return}for(const i of this.handlers)i(t)}scheduleReconnect(){if(null!==this.reconnectTimer)return;const e=this.currentBackoff;this.currentBackoff=Math.min(this.maxBackoff,2*this.currentBackoff),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.explicitlyClosed||this.openSocket()},e)}},HL=new class{constructor(e={}){this.socket=null,this.outbox=[],this.subscribers=new Map,this.reconnectTimer=null,this.url=e.url??function(){const e="https:"===window.location.protocol?"wss:":"ws:";return`${e}//${window.location.host}/ws/terminal`}(),this.minBackoff=e.minBackoffMs??500,this.maxBackoff=e.maxBackoffMs??1e4,this.currentBackoff=this.minBackoff}spawn(e,t,i,s){this.send({type:"spawn",id:e,kind:t,cols:i,rows:s})}sendData(e,t){this.send({type:"data",id:e,data:t})}resize(e,t,i){this.send({type:"resize",id:e,cols:t,rows:i})}close(e){this.send({type:"close",id:e})}subscribe(e,t){let i=this.subscribers.get(e);return i||(i=new Set,this.subscribers.set(e,i)),i.add(t),()=>{const i=this.subscribers.get(e);i&&(i.delete(t),0===i.size&&this.subscribers.delete(e))}}send(e){const t=JSON.stringify({event:Zb,data:e});this.ensureSocket(),this.socket&&this.socket.readyState===WebSocket.OPEN?this.socket.send(t):this.outbox.push(t)}ensureSocket(){if(this.socket&&this.socket.readyState<=WebSocket.OPEN)return;const e=new WebSocket(this.url);this.socket=e,e.addEventListener("open",()=>{for(this.currentBackoff=this.minBackoff;this.outbox.length>0&&e.readyState===WebSocket.OPEN;)e.send(this.outbox.shift())}),e.addEventListener("message",e=>this.deliver(e.data)),e.addEventListener("close",()=>{this.socket=null,this.notifyAllExited(),this.scheduleReconnect()}),e.addEventListener("error",()=>{})}deliver(e){if("string"!=typeof e)return;let t;try{t=JSON.parse(e)}catch{return}const i=function(e){if(!e||"object"!=typeof e)return null;const t=e;if(t.event===Zb&&t.data&&"object"==typeof t.data)return t.data;if("string"==typeof t.type&&"string"==typeof t.id)return t;return null}(t);if(!i)return;const s=this.subscribers.get(i.id);if(s)for(const r of s)r(i)}notifyAllExited(){for(const[e,t]of this.subscribers)for(const i of t)i({type:"exit",id:e,exitCode:null})}scheduleReconnect(){if(null!==this.reconnectTimer||0===this.subscribers.size)return;const e=this.currentBackoff;this.currentBackoff=Math.min(this.maxBackoff,2*this.currentBackoff),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.subscribers.size>0&&this.ensureSocket()},e)}},WL=new class{constructor(e,t,i){this.rest=e,this.ws=t,this.terminalTransport=i,this.wsUnsubscribe=null,this.persistDisposers=[],this.appendCursor=new Map;const s=bE(NL,null)??"";this.tabs=new kL(s),this.targets=new ML(e,()=>this.refreshAfterTargetSwitch()),this.environments=new rL(e,()=>this.refreshAfterEnvSwitch()),this.workspace=new BL(e,()=>this.refreshAfterBundleSwitch()),this.scenarios=new mL(e,this.tabs,this.targets,s),this.helpers=new nL(e),this.collections=new eL(e,this.targets),this.runs=new fL(e),this.historicRuns=new oL(e),this.runSources=new pL(e),this.runtimeSnapshots=new gL(e),this.activeRuns=new qD(e),this.queue=new uL(e),this.source=new yL(e),this.editorBridge=new sL,this.dsl=new iL(e),this.activityBar=new SE,this.theme=new TL,this.layout=new cL,this.terminal=new RL,this.breakpoints=new GD(e),this.variables=new QD(e),this.appServer=new YD(e),this.targetDoctor=new jL(e),this.snapshots=new xL(e),this.session=new bL(e),this.schedules=new Wj(e),this.overview=new hL(this.scenarios,this.runs,this.activeRuns),Wn(this,{},{autoBind:!0})}applyWorkspaceScope(){this.tabs.setScope(this.targets.active),this.scenarios.setScope(this.targets.active)}refreshAfterTargetSwitch(){this.applyWorkspaceScope(),this.source.invalidate(),this.scenarios.load(),this.helpers.load(),this.collections.load(),this.runs.load(),this.breakpoints.load(),this.variables.load(),this.appServer.load(),this.dsl.reload(),this.targetDoctor.reset(),this.environments.load(),this.queue.load()}refreshAfterEnvSwitch(){this.variables.load(),this.runs.load(),this.queue.load()}refreshAfterBundleSwitch(){this.scenarios.load(),this.helpers.load(),this.collections.load(),this.runs.load()}showScenarioHistory(e){this.activityBar.setSection("runs"),this.layout.openTree(),this.runs.setScenarioFilter(e)}init(){this.wsUnsubscribe=this.ws.onMessage(e=>this.dispatchWsMessage(e)),this.ws.connect(),this.targets.load().then(()=>this.applyWorkspaceScope()),this.scenarios.load(),this.helpers.load(),this.collections.load(),this.runs.load(),this.breakpoints.load(),this.variables.load(),this.environments.load(),this.snapshots.load(),this.session.load(),this.queue.load(),this.schedules.load(),this.workspace.start(),this.persistDisposers.push(dn(()=>{this.activeRuns.reconcileWithRuns(this.runs.items)}),dn(()=>{yE(this.activityBar.storageKey,this.activityBar.section)}),dn(()=>{yE(this.tabs.storageKey,this.tabs.toPersisted())}),dn(()=>{yE(this.scenarios.storageKey,{...this.scenarios.expanded})}),dn(()=>{yE(this.theme.storageKey,this.theme.mode)}),dn(()=>{yE(this.layout.storageKey,this.layout.toPersisted())}),dn(()=>{yE(this.terminal.storageKey,this.terminal.toPersisted())}),dn(()=>{"undefined"!=typeof document&&document.documentElement.classList.toggle("dark","dark"===this.theme.theme)}))}insertPickedSnippet(e,t){const i=this.activeRuns.byRunId.get(e),s=null==i?void 0:i.pausedAt;let r,n;if(s&&null!==s.file)r=s.file,n=s.line;else{if("authoring"!==(null==i?void 0:i.mode)||!i.scenario)return;r=`${N_}/${this.targets.activeTestDir}/${i.scenario}.js`,n=null}this.source.getOrLoad(r).then(()=>{if(null===n)return void(this.editorBridge.insertAtCursor(r,t.snippet)||this.source.insertBeforeLastLine(r,t.snippet));if("cursor"===t.placement){if(this.editorBridge.insertAtCursor(r,t.snippet))return;return void this.source.insertAfterLine(r,n,t.snippet)}const e=this.appendCursor.get(r)??n;this.source.insertAfterLine(r,e,t.snippet),this.appendCursor.set(r,e+1)})}destroy(){var e;null==(e=this.wsUnsubscribe)||e.call(this),this.wsUnsubscribe=null,this.ws.disconnect(),this.appServer.destroy();for(const t of this.persistDisposers)t();this.persistDisposers=[]}dispatchWsMessage(e){switch(e.kind){case"fs:scenarios-changed":return this.source.invalidate(),void this.scenarios.load();case"fs:helpers-changed":return this.source.invalidate(),this.helpers.load(),void this.dsl.refreshHelpers();case"fs:collections-changed":return void this.collections.load();case"fs:bp-changed":return void this.breakpoints.load();case"queue:changed":return void this.queue.load();case"env:changed":return this.environments.load(),void this.refreshAfterEnvSwitch();case"fs:run-started":return this.activeRuns.applyWsMessage(e),void this.runs.load();case"fs:run-finished":return this.activeRuns.applyWsMessage(e),this.historicRuns.invalidate(e.runId),this.runtimeSnapshots.invalidate(e.runId),void this.runs.load();case"fs:run-step":return this.activeRuns.applyWsMessage(e),void("locator:picked"===e.event.kind&&this.insertPickedSnippet(e.runId,e.event));case"fs:collection-run-step":case"log:line":return void this.activeRuns.applyWsMessage(e);case"error":return void console.error("[viewer] server error:",e.message)}}}(IL,FL,HL);WL.init(),Vm(OL).render(ki.jsx(y_.Provider,{value:WL,children:ki.jsx(UD,{})}));export{gx as I,Sj as R,Dj as _,gn as a,ki as j,__ as o,gi as r,w_ as u};
55
+ //# sourceMappingURL=index-B02T9gSK.js.map