@unotest/viewer 0.36.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/server/main.js +1 -1
- package/dist/server/session.js +1 -1
- package/dist/server/snapshot.js +1 -1
- package/dist/server/wire.js +1 -1
- package/dist/web/assets/{DslEditor-DaxcTIeO.js → DslEditor-B0tEH4-i.js} +2 -2
- package/dist/web/assets/index-BiFjxXKe.js +55 -0
- package/dist/web/index.html +1 -1
- package/package.json +6 -6
- package/dist/web/assets/index-BVJFZDMP.js +0 -55
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DslEditor-DaxcTIeO.js","assets/DslEditor-DBQtlhBZ.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
var e,t,s,i,n,r,o,a,l,c,h,u,d,f,p,v,g,m,_,x,b,y,w,S,k,C,j,N,M,B,L,D,E,P,R,A,z,T,I,O,H,F,W,K,U,q,V,$,Y,G,X,Z,J,Q,ee,te,se,ie,ne,re,oe,ae,le,ce,he,ue,de,fe,pe,ve,ge,me,_e,xe,be,ye,we,Se,ke,Ce,je,Ne,Me,Be,Le,De,Ee,Pe,Re,Ae,ze,Te,Ie,Oe,He,Fe,We,Ke,Ue,qe,Ve,$e,Ye,Ge,Xe,Ze,Je,Qe,et,tt,st,it,nt,rt,ot,at,lt,ct,ht,ut,dt,ft,pt,vt,gt,mt,_t,xt,bt,yt,wt,St,kt,Ct,jt,Nt=Object.defineProperty,Mt=(e,t,s)=>((e,t,s)=>t in e?Nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s);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 s of e)if("childList"===s.type)for(const e of s.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 Lt={exports:{}},Dt={},Et={exports:{}},Pt={},Rt=Symbol.for("react.element"),At=Symbol.for("react.portal"),zt=Symbol.for("react.fragment"),Tt=Symbol.for("react.strict_mode"),It=Symbol.for("react.profiler"),Ot=Symbol.for("react.provider"),Ht=Symbol.for("react.context"),Ft=Symbol.for("react.forward_ref"),Wt=Symbol.for("react.suspense"),Kt=Symbol.for("react.memo"),Ut=Symbol.for("react.lazy"),qt=Symbol.iterator;var Vt={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},$t=Object.assign,Yt={};function Gt(e,t,s){this.props=e,this.context=t,this.refs=Yt,this.updater=s||Vt}function Xt(){}function Zt(e,t,s){this.props=e,this.context=t,this.refs=Yt,this.updater=s||Vt}Gt.prototype.isReactComponent={},Gt.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")},Gt.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},Xt.prototype=Gt.prototype;var Jt=Zt.prototype=new Xt;Jt.constructor=Zt,$t(Jt,Gt.prototype),Jt.isPureReactComponent=!0;var Qt=Array.isArray,es=Object.prototype.hasOwnProperty,ts={current:null},ss={key:!0,ref:!0,__self:!0,__source:!0};function is(e,t,s){var i,n={},r=null,o=null;if(null!=t)for(i in void 0!==t.ref&&(o=t.ref),void 0!==t.key&&(r=""+t.key),t)es.call(t,i)&&!ss.hasOwnProperty(i)&&(n[i]=t[i]);var a=arguments.length-2;if(1===a)n.children=s;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];n.children=l}if(e&&e.defaultProps)for(i in a=e.defaultProps)void 0===n[i]&&(n[i]=a[i]);return{$$typeof:Rt,type:e,key:r,ref:o,props:n,_owner:ts.current}}function ns(e){return"object"==typeof e&&null!==e&&e.$$typeof===Rt}var rs=/\/+/g;function os(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 as(e,t,s,i,n){var r=typeof e;"undefined"!==r&&"boolean"!==r||(e=null);var o=!1;if(null===e)o=!0;else switch(r){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case Rt:case At:o=!0}}if(o)return n=n(o=e),e=""===i?"."+os(o,0):i,Qt(n)?(s="",null!=e&&(s=e.replace(rs,"$&/")+"/"),as(n,t,s,"",function(e){return e})):null!=n&&(ns(n)&&(n=function(e,t){return{$$typeof:Rt,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(n,s+(!n.key||o&&o.key===n.key?"":(""+n.key).replace(rs,"$&/")+"/")+e)),t.push(n)),1;if(o=0,i=""===i?".":i+":",Qt(e))for(var a=0;a<e.length;a++){var l=i+os(r=e[a],a);o+=as(r,t,s,l,n)}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;!(r=e.next()).done;)o+=as(r=r.value,t,s,l=i+os(r,a++),n);else if("object"===r)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 ls(e,t,s){if(null==e)return e;var i=[],n=0;return as(e,i,"","",function(e){return t.call(s,e,n++)}),i}function cs(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 hs={current:null},us={transition:null},ds={ReactCurrentDispatcher:hs,ReactCurrentBatchConfig:us,ReactCurrentOwner:ts};function fs(){throw Error("act(...) is not supported in production builds of React.")}Pt.Children={map:ls,forEach:function(e,t,s){ls(e,function(){t.apply(this,arguments)},s)},count:function(e){var t=0;return ls(e,function(){t++}),t},toArray:function(e){return ls(e,function(e){return e})||[]},only:function(e){if(!ns(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},Pt.Component=Gt,Pt.Fragment=zt,Pt.Profiler=It,Pt.PureComponent=Zt,Pt.StrictMode=Tt,Pt.Suspense=Wt,Pt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ds,Pt.act=fs,Pt.cloneElement=function(e,t,s){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var i=$t({},e.props),n=e.key,r=e.ref,o=e._owner;if(null!=t){if(void 0!==t.ref&&(r=t.ref,o=ts.current),void 0!==t.key&&(n=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)es.call(t,l)&&!ss.hasOwnProperty(l)&&(i[l]=void 0===t[l]&&void 0!==a?a[l]:t[l])}var l=arguments.length-2;if(1===l)i.children=s;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];i.children=a}return{$$typeof:Rt,type:e.type,key:n,ref:r,props:i,_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:Ot,_context:e},e.Consumer=e},Pt.createElement=is,Pt.createFactory=function(e){var t=is.bind(null,e);return t.type=e,t},Pt.createRef=function(){return{current:null}},Pt.forwardRef=function(e){return{$$typeof:Ft,render:e}},Pt.isValidElement=ns,Pt.lazy=function(e){return{$$typeof:Ut,_payload:{_status:-1,_result:e},_init:cs}},Pt.memo=function(e,t){return{$$typeof:Kt,type:e,compare:void 0===t?null:t}},Pt.startTransition=function(e){var t=us.transition;us.transition={};try{e()}finally{us.transition=t}},Pt.unstable_act=fs,Pt.useCallback=function(e,t){return hs.current.useCallback(e,t)},Pt.useContext=function(e){return hs.current.useContext(e)},Pt.useDebugValue=function(){},Pt.useDeferredValue=function(e){return hs.current.useDeferredValue(e)},Pt.useEffect=function(e,t){return hs.current.useEffect(e,t)},Pt.useId=function(){return hs.current.useId()},Pt.useImperativeHandle=function(e,t,s){return hs.current.useImperativeHandle(e,t,s)},Pt.useInsertionEffect=function(e,t){return hs.current.useInsertionEffect(e,t)},Pt.useLayoutEffect=function(e,t){return hs.current.useLayoutEffect(e,t)},Pt.useMemo=function(e,t){return hs.current.useMemo(e,t)},Pt.useReducer=function(e,t,s){return hs.current.useReducer(e,t,s)},Pt.useRef=function(e){return hs.current.useRef(e)},Pt.useState=function(e){return hs.current.useState(e)},Pt.useSyncExternalStore=function(e,t,s){return hs.current.useSyncExternalStore(e,t,s)},Pt.useTransition=function(){return hs.current.useTransition()},Pt.version="18.3.1",Et.exports=Pt;var ps=Et.exports;const vs=Bt(ps);
|
|
3
|
-
/**
|
|
4
|
-
* @license React
|
|
5
|
-
* react-jsx-runtime.production.min.js
|
|
6
|
-
*
|
|
7
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the MIT license found in the
|
|
10
|
-
* LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/var gs=ps,ms=Symbol.for("react.element"),_s=Symbol.for("react.fragment"),xs=Object.prototype.hasOwnProperty,bs=gs.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,ys={key:!0,ref:!0,__self:!0,__source:!0};function ws(e,t,s){var i,n={},r=null,o=null;for(i in void 0!==s&&(r=""+s),void 0!==t.key&&(r=""+t.key),void 0!==t.ref&&(o=t.ref),t)xs.call(t,i)&&!ys.hasOwnProperty(i)&&(n[i]=t[i]);if(e&&e.defaultProps)for(i in t=e.defaultProps)void 0===n[i]&&(n[i]=t[i]);return{$$typeof:ms,type:e,key:r,ref:o,props:n,_owner:bs.current}}Dt.Fragment=_s,Dt.jsx=ws,Dt.jsxs=ws,Lt.exports=Dt;var Ss=Lt.exports;function ks(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),i=1;i<t;i++)s[i-1]=arguments[i];throw new Error("number"==typeof e?"[MobX] minified error nr: "+e+(s.length?" "+s.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var Cs={};function js(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:Cs}var Ns=Object.assign,Ms=Object.getOwnPropertyDescriptor,Bs=Object.defineProperty,Ls=Object.prototype,Ds=[];Object.freeze(Ds);var Es={};Object.freeze(Es);var Ps="undefined"!=typeof Proxy,Rs=Object.toString();function As(){Ps||ks("Proxy not available")}function zs(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var Ts=function(){};function Is(e){return"function"==typeof e}function Os(e){switch(typeof e){case"string":case"symbol":case"number":return!0}return!1}function Hs(e){return null!==e&&"object"==typeof e}function Fs(e){if(!Hs(e))return!1;var t=Object.getPrototypeOf(e);if(null==t)return!0;var s=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof s&&s.toString()===Rs}function Ws(e){var t=null==e?void 0:e.constructor;return!!t&&("GeneratorFunction"===t.name||"GeneratorFunction"===t.displayName)}function Ks(e,t,s){Bs(e,t,{enumerable:!1,writable:!0,configurable:!0,value:s})}function Us(e,t,s){Bs(e,t,{enumerable:!1,writable:!1,configurable:!0,value:s})}function qs(e,t){var s="isMobX"+e;return t.prototype[s]=!0,function(e){return Hs(e)&&!0===e[s]}}function Vs(e){return null!=e&&"[object Map]"===Object.prototype.toString.call(e)}function $s(e){return null!=e&&"[object Set]"===Object.prototype.toString.call(e)}var Ys=void 0!==Object.getOwnPropertySymbols;var Gs="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:Ys?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function Xs(e){return null===e?null:"object"==typeof e?""+e:e}function Zs(e,t){return Ls.hasOwnProperty.call(e,t)}var Js=Object.getOwnPropertyDescriptors||function(e){var t={};return Gs(e).forEach(function(s){t[s]=Ms(e,s)}),t};function Qs(e,t){return!!(e&t)}function ei(e,t,s){return s?e|=t:e&=~t,e}function ti(e,t){(null==t||t>e.length)&&(t=e.length);for(var s=0,i=Array(t);s<t;s++)i[s]=e[s];return i}function si(e,t,s){return t&&function(e,t){for(var s=0;s<t.length;s++){var i=t[s];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,ci(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ii(e,t){var s="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(s)return(s=s.call(e)).next.bind(s);if(Array.isArray(e)||(s=function(e,t){if(e){if("string"==typeof e)return ti(e,t);var s={}.toString.call(e).slice(8,-1);return"Object"===s&&e.constructor&&(s=e.constructor.name),"Map"===s||"Set"===s?Array.from(e):"Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?ti(e,t):void 0}}(e))||t){s&&(e=s);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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 ni(){return ni=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var i in s)({}).hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},ni.apply(null,arguments)}function ri(e){return(ri=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function oi(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,li(e,t)}function ai(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ai=function(){return!!e})()}function li(e,t){return(li=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function ci(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var i=s.call(e,t);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}function hi(e){var t="function"==typeof Map?new Map:void 0;return hi=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,s)}function s(){return function(e,t,s){if(ai())return Reflect.construct.apply(null,arguments);var i=[null];i.push.apply(i,t);var n=new(e.bind.apply(e,i));return s&&li(n,s.prototype),n}(e,arguments,ri(this).constructor)}return s.prototype=Object.create(e.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),li(s,e)},hi(e)}var ui=Symbol("mobx-stored-annotations");function di(e){return Object.assign(function(t,s){if(pi(s))return e.decorate_20223_(t,s);fi(t,s,e)},e)}function fi(e,t,s){Zs(e,ui)||Ks(e,ui,ni({},e[ui])),function(e){return e.annotationType_===wi}(s)||(e[ui][t]=s)}function pi(e){return"object"==typeof e&&"string"==typeof e.kind}var vi=Symbol("mobx administration"),gi=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_=bn.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 qn(this)},t.reportChanged=function(){Kn(),Vn(this),Un()},t.toString=function(){return this.name_},si(e,[{key:"isBeingObserved",get:function(){return Qs(this.flags_,e.isBeingObservedMask_)},set:function(t){this.flags_=ei(this.flags_,e.isBeingObservedMask_,t)}},{key:"isPendingUnobservation",get:function(){return Qs(this.flags_,e.isPendingUnobservationMask_)},set:function(t){this.flags_=ei(this.flags_,e.isPendingUnobservationMask_,t)}},{key:"diffValue",get:function(){return Qs(this.flags_,e.diffValueMask_)?1:0},set:function(t){this.flags_=ei(this.flags_,e.diffValueMask_,1===t)}}])}();gi.isBeingObservedMask_=1,gi.isPendingUnobservationMask_=2,gi.diffValueMask_=4;var mi=qs("Atom",gi);function _i(e,t,s){void 0===t&&(t=Ts),void 0===s&&(s=Ts);var i,n=new gi(e);return t!==Ts&&_r(vr,n,t,i),s!==Ts&&mr(n,s),n}var xi={structural:function(e,t){return Ao(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 bi(e,t,s){return Lr(e)?e:Array.isArray(e)?rn.array(e,{name:s}):Fs(e)?rn.object(e,void 0,{name:s}):Vs(e)?rn.map(e,{name:s}):$s(e)?rn.set(e,{name:s}):"function"!=typeof e||hr(e)||Br(e)?e:Ws(e)?Nr(e):lr(s,e)}function yi(e){return e}var wi="override";function Si(e,t){return{annotationType_:e,options_:t,make_:ki,extend_:Ci,decorate_20223_:ji}}function ki(e,t,s,i){var n;if(null!=(n=this.options_)&&n.bound)return null===this.extend_(e,t,s,!1)?0:1;if(i===e.target_)return null===this.extend_(e,t,s,!1)?0:2;if(hr(s.value))return 1;var r=Ni(e,this,t,s,!1);return Bs(i,t,r),2}function Ci(e,t,s,i){var n=Ni(e,this,t,s);return e.defineProperty_(t,n,i)}function ji(e,t){var s,i=t.kind,n=t.name,r=t.addInitializer,o=this,a=function(e){var t,s,i,r;return pn(null!=(t=null==(s=o.options_)?void 0:s.name)?t:n.toString(),e,null!=(i=null==(r=o.options_)?void 0:r.autoAction)&&i)};return"field"==i?function(e){var t,s=e;return hr(s)||(s=a(s)),null!=(t=o.options_)&&t.bound&&((s=s.bind(this)).isMobxAction=!0),s}:"method"==i?(hr(e)||(e=a(e)),null!=(s=this.options_)&&s.bound&&r(function(){var e=this,t=e[n].bind(e);t.isMobxAction=!0,e[n]=t}),e):void ks("Cannot apply '"+o.annotationType_+"' to '"+String(n)+"' (kind: "+i+"):\n'"+o.annotationType_+"' can only be used on properties with a function value.")}function Ni(e,t,s,i,n){var r,o,a,l,c,h,u,d;void 0===n&&(n=On.safeDescriptors),d=i,t.annotationType_,d.value;var f,p=i.value;null!=(r=t.options_)&&r.bound&&(p=p.bind(null!=(f=e.proxy_)?f:e.target_));return{value:pn(null!=(o=null==(a=t.options_)?void 0:a.name)?o:s.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:!n||e.isPlainObject_,enumerable:!1,writable:!n}}function Mi(e,t){return{annotationType_:e,options_:t,make_:Bi,extend_:Li,decorate_20223_:Di}}function Bi(e,t,s,i){var n;if(i===e.target_)return null===this.extend_(e,t,s,!1)?0:2;if(null!=(n=this.options_)&&n.bound&&(!Zs(e.target_,t)||!Br(e.target_[t]))&&null===this.extend_(e,t,s,!1))return 0;if(Br(s.value))return 1;var r=Ei(e,this,t,s,!1,!1);return Bs(i,t,r),2}function Li(e,t,s,i){var n,r=Ei(e,this,t,s,null==(n=this.options_)?void 0:n.bound);return e.defineProperty_(t,r,i)}function Di(e,t){var s,i=t.name,n=t.addInitializer;return Br(e)||(e=Nr(e)),null!=(s=this.options_)&&s.bound&&n(function(){var e=this,t=e[i].bind(e);t.isMobXFlow=!0,e[i]=t}),e}function Ei(e,t,s,i,n,r){var o;void 0===r&&(r=On.safeDescriptors),o=i,t.annotationType_,o.value;var a,l=i.value;(Br(l)||(l=Nr(l)),n)&&((l=l.bind(null!=(a=e.proxy_)?a:e.target_)).isMobXFlow=!0);return{value:l,configurable:!r||e.isPlainObject_,enumerable:!1,writable:!r}}function Pi(e,t){return{annotationType_:e,options_:t,make_:Ri,extend_:Ai,decorate_20223_:zi}}function Ri(e,t,s){return null===this.extend_(e,t,s,!1)?0:1}function Ai(e,t,s,i){var n;return n=s,this.annotationType_,n.get,e.defineComputedProperty_(t,ni({},this.options_,{get:s.get,set:s.set}),i)}function zi(e,t){var s,i=this,n=t.name;function r(t,s){var r=ni({},i.options_,{get:e,context:t});return r.name||(r.name="ObservableObject."+n.toString()),new xn(r)}return(0,t.addInitializer)(function(){var t,s=po(this)[vi],i=this,o=s.values_.get(n);o instanceof xn&&o.derivation!==e&&s.values_.delete(n),(null!=(t=s.lazyComputedKeys_)?t:s.lazyComputedKeys_=new Map).set(n,function(){return r(i)})}),function(){var t=this[vi],i=t.values_.get(n);if(i instanceof xn&&i.derivation!==e){var o,a,l=null==(o=s)?void 0:o.get(this);if(!l)l=r(this),(null!=(a=s)?a:s=new WeakMap).set(this,l);return l.get()}return t.getObservablePropValue_(n)}}function Ti(e,t){return{annotationType_:e,options_:t,make_:Ii,extend_:Oi,decorate_20223_:Hi}}function Ii(e,t,s){return null===this.extend_(e,t,s,!1)?0:1}function Oi(e,t,s,i){var n,r;return this.annotationType_,e.defineObservableProperty_(t,s.value,null!=(n=null==(r=this.options_)?void 0:r.enhancer)?n:bi,i)}function Hi(e,t){var s=this,i=t.kind,n=t.name;if("accessor"===i)return{get:function(){var t;return(null!=(t=this[vi])?t:r(this,e.get.call(this))).getObservablePropValue_(n)},set:function(e){var t;return(null!=(t=this[vi])?t:r(this,e)).setObservablePropValue_(n,e)},init:function(e){return r(this,e),e}};function r(e,t){var i,r=po(e)[vi];return(null!=(i=r.lazyObservableKeys_)?i:r.lazyObservableKeys_=new Map).set(n,function(){var e,i;return new _n(t,null!=(e=null==(i=s.options_)?void 0:i.enhancer)?e:bi,"ObservableObject."+n.toString(),!1)}),r}}var Fi="true",Wi=Ki();function Ki(e){return{annotationType_:Fi,options_:e,make_:Ui,extend_:qi,decorate_20223_:Vi}}function Ui(e,t,s,i){var n,r,o,a;if(s.get)return cn.make_(e,t,s,i);if(s.set){var l=hr(s.set)?s.set:pn(t.toString(),s.set);return i===e.target_?null===e.defineProperty_(t,{configurable:!On.safeDescriptors||e.isPlainObject_,set:l})?0:2:(Bs(i,t,{configurable:!0,set:l}),2)}if(i!==e.target_&&"function"==typeof s.value)return Ws(s.value)?(null!=(a=this.options_)&&a.autoBind?Nr.bound:Nr).make_(e,t,s,i):(null!=(o=this.options_)&&o.autoBind?lr.bound:lr).make_(e,t,s,i);var c,h=!1===(null==(n=this.options_)?void 0:n.deep)?rn.ref:rn;"function"==typeof s.value&&null!=(r=this.options_)&&r.autoBind&&(s.value=s.value.bind(null!=(c=e.proxy_)?c:e.target_));return h.make_(e,t,s,i)}function qi(e,t,s,i){var n,r,o;if(s.get)return cn.extend_(e,t,s,i);if(s.set)return e.defineProperty_(t,{configurable:!On.safeDescriptors||e.isPlainObject_,set:pn(t.toString(),s.set)},i);"function"==typeof s.value&&null!=(n=this.options_)&&n.autoBind&&(s.value=s.value.bind(null!=(o=e.proxy_)?o:e.target_));return(!1===(null==(r=this.options_)?void 0:r.deep)?rn.ref:rn).extend_(e,t,s,i)}function Vi(e,t){ks("'"+this.annotationType_+"' cannot be used as a decorator")}var $i={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};function Yi(e){return e||$i}Object.freeze($i);var Gi=Ti("observable"),Xi=Ti("observable.ref",{enhancer:yi}),Zi=Ti("observable.shallow",{enhancer:function(e,t,s){return null==e||mo(e)||Qr(e)||no(e)||lo(e)?e:Array.isArray(e)?rn.array(e,{name:s,deep:!1}):Fs(e)?rn.object(e,void 0,{name:s,deep:!1}):Vs(e)?rn.map(e,{name:s,deep:!1}):$s(e)?rn.set(e,{name:s,deep:!1}):void 0}}),Ji=Ti("observable.struct",{enhancer:function(e,t){return Ao(e,t)?t:e}}),Qi=di(Gi);function en(e){return!0===e.deep?bi:!1===e.deep?yi:(t=e.defaultDecorator)&&null!=(s=null==(i=t.options_)?void 0:i.enhancer)?s:bi;var t,s,i}function tn(e,t,s){return pi(t)?Gi.decorate_20223_(e,t):Os(t)?void fi(e,t,Gi):Lr(e)?e:Fs(e)?rn.object(e,t,s):Array.isArray(e)?rn.array(e,t):Vs(e)?rn.map(e,t):$s(e)?rn.set(e,t):"object"==typeof e&&null!==e?e:rn.box(e,t)}Ns(tn,Qi);var sn,nn,rn=Ns(tn,{box:function(e,t){var s=Yi(t);return new _n(e,en(s),s.name,!0,s.equals)},array:function(e,t){var s=Yi(t);return(!1===On.useProxies||!1===s.proxy?Bo:Vr)(e,en(s),s.name)},map:function(e,t){var s=Yi(t);return new io(e,en(s),s.name)},set:function(e,t){var s=Yi(t);return new ao(e,en(s),s.name)},object:function(e,t,s){return Eo(function(){return yr(!1===On.useProxies||!1===(null==s?void 0:s.proxy)?po({},s):function(e,t){var s,i;return As(),e=po(e,t),null!=(i=(s=e[vi]).proxy_)?i:s.proxy_=new Proxy(e,Pr)}({},s),e,t)})},ref:di(Xi),shallow:di(Zi),deep:Qi,struct:di(Ji)}),on="computed",an=Pi(on),ln=Pi("computed.struct",{equals:xi.structural}),cn=function(e,t){if(pi(t))return an.decorate_20223_(e,t);if(Os(t))return fi(e,t,an);if(Fs(e))return di(Pi(on,e));var s=Fs(t)?t:{};return s.get=e,s.name||(s.name=e.name||""),new xn(s)};Object.assign(cn,an),cn.struct=di(ln);var hn=0,un=1,dn=null!=(sn=null==(nn=Ms(function(){},"name"))?void 0:nn.configurable)&&sn,fn={value:"action",configurable:!0,writable:!1,enumerable:!1};function pn(e,t,s,i){function n(){return vn(e,s,t,i||this,arguments)}return void 0===s&&(s=!1),n.isMobxAction=!0,n.toString=function(){return t.toString()},dn&&(fn.value=e,Bs(n,"name",fn)),n}function vn(e,t,s,i,n){var r=function(e,t){var s=!1,i=0,n=On.trackingDerivation,r=!t||!n;Kn();var o=On.allowStateChanges;r&&(Dn(),o=gn(!0));var a=Pn(!0),l={runAsAction_:r,prevDerivation_:n,prevAllowStateChanges_:o,prevAllowStateReads_:a,notifySpy_:s,startTime_:i,actionId_:un++,parentActionId_:hn};return hn=l.actionId_,l}(0,t);try{return s.apply(i,n)}catch(o){throw r.error_=o,o}finally{!function(e){hn!==e.actionId_&&ks(30);hn=e.parentActionId_,void 0!==e.error_&&(On.suppressReactionErrors=!0);mn(e.prevAllowStateChanges_),Rn(e.prevAllowStateReads_),Un(),e.runAsAction_&&En(e.prevDerivation_);On.suppressReactionErrors=!1}(r)}}function gn(e){var t=On.allowStateChanges;return On.allowStateChanges=e,t}function mn(e){On.allowStateChanges=e}var _n=function(e){function t(t,s,i,n,r){var o;return void 0===i&&(i="ObservableValue"),void 0===r&&(r=xi.default),(o=e.call(this,i)||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=s,o.name_=i,o.equals=r,o.value_=s(t,void 0,i),o}oi(t,e);var s=t.prototype;return s.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},s.set=function(e){this.value_,(e=this.prepareNewValue_(e))!==On.UNCHANGED&&this.setNewValue_(e)},s.prepareNewValue_=function(e){if(Rr(this)){var t=zr(this,{object:this,type:Kr,newValue:e});if(!t)return On.UNCHANGED;e=t.newValue}return e=this.enhancer(e,this.value_,this.name_),this.equals(this.value_,e)?On.UNCHANGED:e},s.setNewValue_=function(e){var t=this.value_;this.value_=e,this.reportChanged(),Tr(this)&&Or(this,{type:Kr,object:this,newValue:e,oldValue:t})},s.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},s.intercept_=function(e){return Ar(this,e)},s.observe_=function(e,t){return t&&e({observableKind:"value",debugObjectName:this.name_,object:this,type:Kr,newValue:this.value_,oldValue:void 0}),Ir(this,e)},s.raw=function(){return this.value_},s.toJSON=function(){return this.get()},s.toString=function(){return this.name_+"["+this.value_+"]"},s.valueOf=function(){return Xs(this.get())},s[Symbol.toPrimitive]=function(){return this.valueOf()},t}(gi),xn=function(){function e(e){this.dependenciesState_=bn.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=bn.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new Cn(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=wn.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||ks(31),this.derivation=e.get,this.name_=e.name||"ComputedValue",e.set&&(this.setter_=pn("ComputedValue-setter",e.set)),this.equals_=e.equals||(e.compareStructural||e.struct?xi.structural:xi.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_!==bn.UP_TO_DATE_)return;e.lowestObserverState_=bn.POSSIBLY_STALE_,e.observers_.forEach(function(e){e.dependenciesState_===bn.UP_TO_DATE_&&(e.dependenciesState_=bn.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&&ks(32,this.name_,this.derivation),0!==On.inBatch||0!==this.observers_.size||this.keepAlive_){if(qn(this),Nn(this)){var e=On.trackingContext;this.keepAlive_&&!e&&(On.trackingContext=this),this.trackAndCompute()&&function(e){if(e.lowestObserverState_===bn.STALE_)return;e.lowestObserverState_=bn.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===bn.POSSIBLY_STALE_?t.dependenciesState_=bn.STALE_:t.dependenciesState_===bn.UP_TO_DATE_&&(e.lowestObserverState_=bn.UP_TO_DATE_)})}(this),On.trackingContext=e}}else Nn(this)&&(this.warnAboutUntrackedRead_(),Kn(),this.value_=this.computeValue_(!1),Un());var t=this.value_;if(jn(t))throw t.cause;return t},t.set=function(e){if(this.setter_){this.isRunningSetter&&ks(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,e)}finally{this.isRunningSetter=!1}}else ks(34,this.name_)},t.trackAndCompute=function(){var e=this.value_,t=this.dependenciesState_===bn.NOT_TRACKING_,s=this.computeValue_(!0),i=t||jn(e)||jn(s)||!this.equals_(e,s);return i&&(this.value_=s),i},t.computeValue_=function(e){this.isComputing=!0;var t,s=gn(!1);if(e)t=Mn(this,this.derivation,this.scope_);else if(!0===On.disableErrorBoundaries)t=this.derivation.call(this.scope_);else try{t=this.derivation.call(this.scope_)}catch(i){t=new Cn(i)}return mn(s),this.isComputing=!1,t},t.suspend_=function(){this.keepAlive_||(Bn(this),this.value_=void 0)},t.observe_=function(e,t){var s=this,i=!0,n=void 0;return ur(function(){var r=s.get();if(!i||t){var o=Dn();e({observableKind:"computed",debugObjectName:s.name_,type:Kr,object:s,newValue:r,oldValue:n}),En(o)}i=!1,n=r})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return Xs(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},si(e,[{key:"isComputing",get:function(){return Qs(this.flags_,e.isComputingMask_)},set:function(t){this.flags_=ei(this.flags_,e.isComputingMask_,t)}},{key:"isRunningSetter",get:function(){return Qs(this.flags_,e.isRunningSetterMask_)},set:function(t){this.flags_=ei(this.flags_,e.isRunningSetterMask_,t)}},{key:"isBeingObserved",get:function(){return Qs(this.flags_,e.isBeingObservedMask_)},set:function(t){this.flags_=ei(this.flags_,e.isBeingObservedMask_,t)}},{key:"isPendingUnobservation",get:function(){return Qs(this.flags_,e.isPendingUnobservationMask_)},set:function(t){this.flags_=ei(this.flags_,e.isPendingUnobservationMask_,t)}},{key:"diffValue",get:function(){return Qs(this.flags_,e.diffValueMask_)?1:0},set:function(t){this.flags_=ei(this.flags_,e.diffValueMask_,1===t)}}])}();xn.isComputingMask_=1,xn.isRunningSetterMask_=2,xn.isBeingObservedMask_=4,xn.isPendingUnobservationMask_=8,xn.diffValueMask_=16;var bn,yn,wn,Sn,kn=qs("ComputedValue",xn);(yn=bn||(bn={}))[yn.NOT_TRACKING_=-1]="NOT_TRACKING_",yn[yn.UP_TO_DATE_=0]="UP_TO_DATE_",yn[yn.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",yn[yn.STALE_=2]="STALE_",(Sn=wn||(wn={}))[Sn.NONE=0]="NONE",Sn[Sn.LOG=1]="LOG",Sn[Sn.BREAK=2]="BREAK";var Cn=function(e){this.cause=void 0,this.cause=e};function jn(e){return e instanceof Cn}function Nn(e){switch(e.dependenciesState_){case bn.UP_TO_DATE_:return!1;case bn.NOT_TRACKING_:case bn.STALE_:return!0;case bn.POSSIBLY_STALE_:for(var t=Pn(!0),s=Dn(),i=e.observing_,n=i.length,r=0;r<n;r++){var o=i[r];if(kn(o)){if(On.disableErrorBoundaries)o.get();else try{o.get()}catch(a){return En(s),Rn(t),!0}if(e.dependenciesState_===bn.STALE_)return En(s),Rn(t),!0}}return An(e),En(s),Rn(t),!1}}function Mn(e,t,s){var i=Pn(!0);An(e),e.newObserving_=new Array(0===e.runId_?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++On.runId;var n,r=On.trackingDerivation;if(On.trackingDerivation=e,On.inBatch++,!0===On.disableErrorBoundaries)n=t.call(s);else try{n=t.call(s)}catch(o){n=new Cn(o)}return On.inBatch--,On.trackingDerivation=r,function(e){for(var t=e.observing_,s=e.observing_=e.newObserving_,i=bn.UP_TO_DATE_,n=0,r=e.unboundDepsCount_,o=0;o<r;o++){var a=s[o];0===a.diffValue&&(a.diffValue=1,n!==o&&(s[n]=a),n++),a.dependenciesState_>i&&(i=a.dependenciesState_)}s.length=n,e.newObserving_=null,r=t.length;for(;r--;){var l=t[r];0===l.diffValue&&Fn(l,e),l.diffValue=0}for(;n--;){var c=s[n];1===c.diffValue&&(c.diffValue=0,Hn(c,e))}i!==bn.UP_TO_DATE_&&(e.dependenciesState_=i,e.onBecomeStale_())}(e),Rn(i),n}function Bn(e){var t=e.observing_;e.observing_=[];for(var s=t.length;s--;)Fn(t[s],e);e.dependenciesState_=bn.NOT_TRACKING_}function Ln(e){var t=Dn();try{return e()}finally{En(t)}}function Dn(){var e=On.trackingDerivation;return On.trackingDerivation=null,e}function En(e){On.trackingDerivation=e}function Pn(e){var t=On.allowStateReads;return On.allowStateReads=e,t}function Rn(e){On.allowStateReads=e}function An(e){if(e.dependenciesState_!==bn.UP_TO_DATE_){e.dependenciesState_=bn.UP_TO_DATE_;for(var t=e.observing_,s=t.length;s--;)t[s].lowestObserverState_=bn.UP_TO_DATE_}}var zn=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},Tn=!0,In=!1,On=function(){var e=js();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Tn=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new zn).version&&(Tn=!1),Tn?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new zn):(setTimeout(function(){In||ks(35)},1),new zn)}();function Hn(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Fn(e,t){e.observers_.delete(t),0===e.observers_.size&&Wn(e)}function Wn(e){!1===e.isPendingUnobservation&&(e.isPendingUnobservation=!0,On.pendingUnobservations.push(e))}function Kn(){On.inBatch++}function Un(){if(0===--On.inBatch){Xn();for(var e=On.pendingUnobservations,t=0;t<e.length;t++){var s=e[t];s.isPendingUnobservation=!1,0===s.observers_.size&&(s.isBeingObserved&&(s.isBeingObserved=!1,s.onBUO()),s instanceof xn&&s.suspend_())}On.pendingUnobservations=[]}}function qn(e){var t=On.trackingDerivation;return null!==t?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&On.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(0===e.observers_.size&&On.inBatch>0&&Wn(e),!1)}function Vn(e){e.lowestObserverState_!==bn.STALE_&&(e.lowestObserverState_=bn.STALE_,e.observers_.forEach(function(e){e.dependenciesState_===bn.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=bn.STALE_}))}var $n=function(){function e(e,t,s,i){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_=bn.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=wn.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=s,this.requiresObservable_=i}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,On.pendingReactions.push(this),Xn())},t.runReaction_=function(){if(!this.isDisposed){Kn(),this.isScheduled=!1;var e=On.trackingContext;if(On.trackingContext=this,Nn(this)){this.isTrackPending=!0;try{this.onInvalidate_()}catch(t){this.reportExceptionInDerivation_(t)}}On.trackingContext=e,Un()}},t.track=function(e){if(!this.isDisposed){Kn(),this.isRunning=!0;var t=On.trackingContext;On.trackingContext=this;var s=Mn(this,e,void 0);On.trackingContext=t,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Bn(this),jn(s)&&this.reportExceptionInDerivation_(s.cause),Un()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(On.disableErrorBoundaries)throw e;var s="[mobx] uncaught error in '"+this+"'";On.suppressReactionErrors||console.error(s,e),On.globalReactionErrorHandlers.forEach(function(s){return s(e,t)})}},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Kn(),Bn(this),Un()))},t.getDisposer_=function(e){var t=this,s=function s(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",s)};return null==e||null==e.addEventListener||e.addEventListener("abort",s),s[vi]=this,"dispose"in Symbol&&"symbol"==typeof Symbol.dispose&&(s[Symbol.dispose]=s),s},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){},si(e,[{key:"isDisposed",get:function(){return Qs(this.flags_,e.isDisposedMask_)},set:function(t){this.flags_=ei(this.flags_,e.isDisposedMask_,t)}},{key:"isScheduled",get:function(){return Qs(this.flags_,e.isScheduledMask_)},set:function(t){this.flags_=ei(this.flags_,e.isScheduledMask_,t)}},{key:"isTrackPending",get:function(){return Qs(this.flags_,e.isTrackPendingMask_)},set:function(t){this.flags_=ei(this.flags_,e.isTrackPendingMask_,t)}},{key:"isRunning",get:function(){return Qs(this.flags_,e.isRunningMask_)},set:function(t){this.flags_=ei(this.flags_,e.isRunningMask_,t)}},{key:"diffValue",get:function(){return Qs(this.flags_,e.diffValueMask_)?1:0},set:function(t){this.flags_=ei(this.flags_,e.diffValueMask_,1===t)}}])}();$n.isDisposedMask_=1,$n.isScheduledMask_=2,$n.isTrackPendingMask_=4,$n.isRunningMask_=8,$n.diffValueMask_=16;var Yn=100,Gn=function(e){return e()};function Xn(){On.inBatch>0||On.isRunningReactions||Gn(Zn)}function Zn(){On.isRunningReactions=!0;for(var e=On.pendingReactions,t=0;e.length>0;){++t===Yn&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var s=e.splice(0),i=0,n=s.length;i<n;i++)s[i].runReaction_()}On.isRunningReactions=!1}var Jn=qs("Reaction",$n);var Qn="action",er="autoAction",tr="<unnamed action>",sr=Si(Qn),ir=Si("action.bound",{bound:!0}),nr=Si(er,{autoAction:!0}),rr=Si("autoAction.bound",{autoAction:!0,bound:!0});function or(e){return function(t,s){return Is(t)?pn(t.name||tr,t,e):Is(s)?pn(t,s,e):pi(s)?(e?nr:sr).decorate_20223_(t,s):Os(s)?fi(t,s,e?nr:sr):Os(t)?di(Si(e?er:Qn,{name:t,autoAction:e})):void 0}}var ar=or(!1);Object.assign(ar,sr);var lr=or(!0);function cr(e){return vn(e.name,!1,e,this,void 0)}function hr(e){return Is(e)&&!0===e.isMobxAction}function ur(e,t){var s,i,n,r;void 0===t&&(t=Es);var o,a=null!=(s=null==(i=t)?void 0:i.name)?s:"Autorun";if(!t.scheduler&&!t.delay)o=new $n(a,function(){this.track(h)},t.onError,t.requiresObservable);else{var l=fr(t),c=!1;o=new $n(a,function(){c||(c=!0,l(function(){c=!1,o.isDisposed||o.track(h)}))},t.onError,t.requiresObservable)}function h(){e(o)}return null!=(n=t)&&null!=(n=n.signal)&&n.aborted||o.schedule_(),o.getDisposer_(null==(r=t)?void 0:r.signal)}Object.assign(lr,nr),ar.bound=di(ir),lr.bound=di(rr);var dr=function(e){return e()};function fr(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:dr}function pr(e,t,s){var i,n,r;void 0===s&&(s=Es);var o,a,l,c=null!=(i=s.name)?i:"Reaction",h=ar(c,s.onError?(o=s.onError,a=t,function(){try{return a.apply(this,arguments)}catch(e){o.call(this,e)}}):t),u=!s.scheduler&&!s.delay,d=fr(s),f=!0,p=!1,v=s.compareStructural?xi.structural:s.equals||xi.default,g=new $n(c,function(){f||u?m():p||(p=!0,d(m))},s.onError,s.requiresObservable);function m(){if(p=!1,!g.isDisposed){var t=!1,i=l;g.track(function(){var s=function(e,t){var s=gn(e);try{return t()}finally{mn(s)}}(!1,function(){return e(g)});t=f||!v(l,s),l=s}),(f&&s.fireImmediately||!f&&t)&&h(l,i,g),f=!1}}return null!=(n=s)&&null!=(n=n.signal)&&n.aborted||g.schedule_(),g.getDisposer_(null==(r=s)?void 0:r.signal)}var vr="onBO",gr="onBUO";function mr(e,t,s){return _r(gr,e,t,s)}function _r(e,t,s,i){var n=Lo(t),r=Is(i)?i:s,o=e+"L";return n[o]?n[o].add(r):n[o]=new Set([r]),function(){var e=n[o];e&&(e.delete(r),0===e.size&&delete n[o])}}var xr="always";function br(e){!0===e.isolateGlobalState&&function(){if((On.pendingReactions.length||On.inBatch||On.isRunningReactions)&&ks(36),In=!0,Tn){var e=js();0===--e.__mobxInstanceCount&&(e.__mobxGlobals=void 0),On=new zn}}();var t,s,i=e.useProxies,n=e.enforceActions;if(void 0!==i&&(On.useProxies=i===xr||"never"!==i&&"undefined"!=typeof Proxy),"ifavailable"===i&&(On.verifyProxies=!0),void 0!==n){var r=n===xr?xr:"observed"===n;On.enforceActions=r,On.allowStateChanges=!0!==r&&r!==xr}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(t){t in e&&(On[t]=!!e[t])}),On.allowStateReads=!On.observableRequiresReaction,e.reactionScheduler&&(t=e.reactionScheduler,s=Gn,Gn=function(e){return t(function(){return s(e)})})}function yr(e,t,s,i){var n=Js(t);return Eo(function(){var t=po(e,i)[vi];Gs(n).forEach(function(e){t.extend_(e,n[e],!s||(!(e in s)||s[e]))})}),e}function wr(e){var t,s={name:e.name_};return e.observing_&&e.observing_.length>0&&(s.dependencies=(t=e.observing_,Array.from(new Set(t))).map(wr)),s}var Sr=0,kr=function(e){function t(){var s;return s=e.call(this,"FLOW_CANCELLED")||this,Object.setPrototypeOf(s,(this instanceof t?this.constructor:void 0).prototype),s.name="FlowCancellationError",s}return oi(t,e),t.prototype.toString=function(){return"Error: "+this.message},t}(hi(Error)),Cr=Mi("flow"),jr=Mi("flow.bound",{bound:!0}),Nr=Object.assign(function(e,t){if(pi(t))return Cr.decorate_20223_(e,t);if(Os(t))return fi(e,t,Cr);var s=e,i=s.name||"<unnamed flow>",n=function(){var e,t=arguments,n=++Sr,r=ar(i+" - runid: "+n+" - init",s).apply(this,t),o=void 0,a=new Promise(function(t,s){var a=0;function l(e){var t;o=void 0;try{t=ar(i+" - runid: "+n+" - yield "+a++,r.next).call(r,e)}catch(l){return s(l)}h(t)}function c(e){var t;o=void 0;try{t=ar(i+" - runid: "+n+" - yield "+a++,r.throw).call(r,e)}catch(l){return s(l)}h(t)}function h(e){if(!Is(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(l,c);e.then(h,s)}e=s,l(void 0)});return a.cancel=ar(i+" - runid: "+n+" - cancel",function(){try{o&&Mr(o);var t=r.return(void 0),s=Promise.resolve(t.value);s.then(Ts,Ts),Mr(s),e(new kr)}catch(i){e(i)}}),a};return n.isMobXFlow=!0,n},Cr);function Mr(e){Is(e.cancel)&&e.cancel()}function Br(e){return!0===(null==e?void 0:e.isMobXFlow)}function Lr(e){return function(e){return!!e&&(mo(e)||!!e[vi]||mi(e)||Jn(e)||kn(e))}(e)}function Dr(e,t){void 0===t&&(t=void 0),Kn();try{return e.apply(t)}finally{Un()}}function Er(e){return e[vi]}Nr.bound=di(jr);var Pr={has:function(e,t){return Er(e).has_(t)},get:function(e,t){return Er(e).get_(t)},set:function(e,t,s){var i;return!!Os(t)&&(null==(i=Er(e).set_(t,s,!0))||i)},deleteProperty:function(e,t){var s;return!!Os(t)&&(null==(s=Er(e).delete_(t,!0))||s)},defineProperty:function(e,t,s){var i;return null==(i=Er(e).defineProperty_(t,s))||i},ownKeys:function(e){return Er(e).ownKeys_()},preventExtensions:function(e){ks(13)}};function Rr(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function Ar(e,t){var s=e.interceptors_||(e.interceptors_=[]);return s.push(t),zs(function(){var e=s.indexOf(t);-1!==e&&s.splice(e,1)})}function zr(e,t){var s=Dn();try{for(var i=[].concat(e.interceptors_||[]),n=0,r=i.length;n<r&&((t=i[n](t))&&!t.type&&ks(14),t);n++);return t}finally{En(s)}}function Tr(e){return void 0!==e.changeListeners_&&e.changeListeners_.length>0}function Ir(e,t){var s=e.changeListeners_||(e.changeListeners_=[]);return s.push(t),zs(function(){var e=s.indexOf(t);-1!==e&&s.splice(e,1)})}function Or(e,t){var s=Dn(),i=e.changeListeners_;if(i){for(var n=0,r=(i=i.slice()).length;n<r;n++)i[n](t);En(s)}}var Hr=Symbol("mobx-keys");function Fr(e,t,s){return Fs(e)?yr(e,e,t,s):(Eo(function(){var i=po(e,s)[vi];if(!e[Hr]){var n=Object.getPrototypeOf(e),r=new Set([].concat(Gs(e),Gs(n)));r.delete("constructor"),r.delete(vi),Ks(n,Hr,r)}e[Hr].forEach(function(e){return i.make_(e,!t||(!(e in t)||t[e]))})}),e)}var Wr="splice",Kr="update",Ur={get:function(e,t){var s=e[vi];return t===vi?s:"length"===t?s.getArrayLength_():"string"!=typeof t||isNaN(t)?Zs($r,t)?$r[t]:e[t]:s.get_(parseInt(t))},set:function(e,t,s){var i=e[vi];return"length"===t&&i.setArrayLength_(s),"symbol"==typeof t||isNaN(t)?e[t]=s:i.set_(parseInt(t),s),!0},preventExtensions:function(){ks(15)}},qr=function(){function e(e,t,s,i){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_=s,this.legacyMode_=i,this.atom_=new gi(e),this.enhancer_=function(e,s){return t(e,s,"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 Ar(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}),Ir(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&ks("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var s=new Array(e-t),i=0;i<e-t;i++)s[i]=void 0;this.spliceWithArray_(t,0,s)}else this.spliceWithArray_(e,t-e)},t.updateArrayLength_=function(e,t){e!==this.lastKnownLength_&&ks(16),this.lastKnownLength_+=t,this.legacyMode_&&t>0&&Mo(e+t+1)},t.spliceWithArray_=function(e,t,s){var i=this;this.atom_;var n=this.values_.length;if(void 0===e?e=0:e>n?e=n:e<0&&(e=Math.max(0,n+e)),t=1===arguments.length?n-e:null==t?0:Math.max(0,Math.min(t,n-e)),void 0===s&&(s=Ds),Rr(this)){var r=zr(this,{object:this.proxy_,type:Wr,index:e,removedCount:t,added:s});if(!r)return Ds;t=r.removedCount,s=r.added}if(s=0===s.length?s:s.map(function(e){return i.enhancer_(e,void 0)}),this.legacyMode_){var o=s.length-t;this.updateArrayLength_(n,o)}var a=this.spliceItemsIntoValues_(e,t,s);return 0===t&&0===s.length||this.notifyArraySplice_(e,s,a),this.dehanceValues_(a)},t.spliceItemsIntoValues_=function(e,t,s){var i;if(s.length<1e4)return(i=this.values_).splice.apply(i,[e,t].concat(s));var n=this.values_.slice(e,e+t),r=this.values_.slice(e+t);this.values_.length+=s.length-t;for(var o=0;o<s.length;o++)this.values_[e+o]=s[o];for(var a=0;a<r.length;a++)this.values_[e+s.length+a]=r[a];return n},t.notifyArrayChildUpdate_=function(e,t,s){var i=!this.owned_&&!1,n=Tr(this),r=n||i?{observableKind:"array",object:this.proxy_,type:Kr,debugObjectName:this.atom_.name_,index:e,newValue:t,oldValue:s}:null;this.atom_.reportChanged(),n&&Or(this,r)},t.notifyArraySplice_=function(e,t,s){var i=!this.owned_&&!1,n=Tr(this),r=n||i?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Wr,index:e,removed:s,added:t,removedCount:s.length,addedCount:t.length}:null;this.atom_.reportChanged(),n&&Or(this,r)},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 s=this.values_;if(this.legacyMode_&&e>s.length&&ks(17,e,s.length),e<s.length){this.atom_;var i=s[e];if(Rr(this)){var n=zr(this,{type:Kr,object:this.proxy_,index:e,newValue:t});if(!n)return;t=n.newValue}(t=this.enhancer_(t,i))!==i&&(s[e]=t,this.notifyArrayChildUpdate_(e,t,i))}else{for(var r=new Array(e+1-s.length),o=0;o<r.length-1;o++)r[o]=void 0;r[r.length-1]=t,this.spliceWithArray_(s.length,0,r)}},e}();function Vr(e,t,s,i){return void 0===s&&(s="ObservableArray"),void 0===i&&(i=!1),As(),Eo(function(){var n=new qr(s,t,i,!1);Us(n.values_,vi,n);var r=new Proxy(n.values_,Ur);return n.proxy_=r,e&&e.length&&n.spliceWithArray_(0,0,e),r})}var $r={clear:function(){return this.splice(0)},replace:function(e){var t=this[vi];return t.spliceWithArray_(0,t.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,t){for(var s=arguments.length,i=new Array(s>2?s-2:0),n=2;n<s;n++)i[n-2]=arguments[n];var r=this[vi];switch(arguments.length){case 0:return[];case 1:return r.spliceWithArray_(e);case 2:return r.spliceWithArray_(e,t)}return r.spliceWithArray_(e,t,i)},spliceWithArray:function(e,t,s){return this[vi].spliceWithArray_(e,t,s)},push:function(){for(var e=this[vi],t=arguments.length,s=new Array(t),i=0;i<t;i++)s[i]=arguments[i];return e.spliceWithArray_(e.values_.length,0,s),e.values_.length},pop:function(){return this.splice(Math.max(this[vi].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[vi],t=arguments.length,s=new Array(t),i=0;i<t;i++)s[i]=arguments[i];return e.spliceWithArray_(0,0,s),e.values_.length},reverse:function(){return On.trackingDerivation&&ks(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){On.trackingDerivation&&ks(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[vi],s=t.dehanceValues_(t.values_).indexOf(e);return s>-1&&(this.splice(s,1),!0)}};function Yr(e,t){"function"==typeof Array.prototype[e]&&($r[e]=t(e))}function Gr(e){return function(){var t=this[vi];t.atom_.reportObserved();var s=t.dehanceValues_(t.values_);return s[e].apply(s,arguments)}}function Xr(e){return function(t,s){var i=this,n=this[vi];return n.atom_.reportObserved(),n.dehanceValues_(n.values_)[e](function(e,n){return t.call(s,e,n,i)})}}function Zr(e){return function(){var t=this,s=this[vi];s.atom_.reportObserved();var i=s.dehanceValues_(s.values_),n=arguments[0];return arguments[0]=function(e,s,i){return n(e,s,i,t)},i[e].apply(i,arguments)}}Yr("at",Gr),Yr("concat",Gr),Yr("flat",Gr),Yr("includes",Gr),Yr("indexOf",Gr),Yr("join",Gr),Yr("lastIndexOf",Gr),Yr("slice",Gr),Yr("toString",Gr),Yr("toLocaleString",Gr),Yr("toSorted",Gr),Yr("toSpliced",Gr),Yr("with",Gr),Yr("every",Xr),Yr("filter",Xr),Yr("find",Xr),Yr("findIndex",Xr),Yr("findLast",Xr),Yr("findLastIndex",Xr),Yr("flatMap",Xr),Yr("forEach",Xr),Yr("map",Xr),Yr("some",Xr),Yr("toReversed",Xr),Yr("reduce",Zr),Yr("reduceRight",Zr);var Jr=qs("ObservableArrayAdministration",qr);function Qr(e){return Hs(e)&&Jr(e[vi])}var eo={},to="add",so="delete",io=function(){function e(e,t,s){var i=this;void 0===t&&(t=bi),void 0===s&&(s="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[vi]=eo,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_=s,Is(Map)||ks(18),Eo(function(){i.keysAtom_=_i("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)})}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!On.trackingDerivation)return this.has_(e);var s=this.hasMap_.get(e);if(!s){var i=s=new _n(this.has_(e),yi,"ObservableMap.key?",!1);this.hasMap_.set(e,i),mr(i,function(){return t.hasMap_.delete(e)})}return s.get()},t.set=function(e,t){var s=this.has_(e);if(Rr(this)){var i=zr(this,{type:s?Kr:to,object:this,newValue:t,name:e});if(!i)return this;t=i.newValue}return s?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if((this.keysAtom_,Rr(this))&&!zr(this,{type:so,object:this,name:e}))return!1;if(this.has_(e)){var s=Tr(this),i=s?{observableKind:"map",debugObjectName:this.name_,type:so,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return Dr(function(){var s;t.keysAtom_.reportChanged(),null==(s=t.hasMap_.get(e))||s.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)}),s&&Or(this,i),!0}return!1},t.updateValue_=function(e,t){var s=this.data_.get(e);if((t=s.prepareNewValue_(t))!==On.UNCHANGED){var i=Tr(this),n=i?{observableKind:"map",debugObjectName:this.name_,type:Kr,object:this,oldValue:s.value_,name:e,newValue:t}:null;s.setNewValue_(t),i&&Or(this,n)}},t.addValue_=function(e,t){var s=this;this.keysAtom_,Dr(function(){var i,n=new _n(t,s.enhancer_,"ObservableMap.key",!1);s.data_.set(e,n),t=n.value_,null==(i=s.hasMap_.get(e))||i.setNewValue_(!0),s.keysAtom_.reportChanged()});var i=Tr(this),n=i?{observableKind:"map",debugObjectName:this.name_,type:to,object:this,name:e,newValue:t}:null;i&&Or(this,n)},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 ro({next:function(){var s=t.next(),i=s.done,n=s.value;return{done:i,value:i?void 0:e.get(n)}}})},t.entries=function(){var e=this,t=this.keys();return ro({next:function(){var s=t.next(),i=s.done,n=s.value;return{done:i,value:i?void 0:[n,e.get(n)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(e,t){for(var s,i=ii(this);!(s=i()).done;){var n=s.value,r=n[0],o=n[1];e.call(t,o,r,this)}},t.merge=function(e){var t=this;return no(e)&&(e=new Map(e)),Dr(function(){var s,i,n;Fs(e)?function(e){var t=Object.keys(e);if(!Ys)return t;var s=Object.getOwnPropertySymbols(e);return s.length?[].concat(t,s.filter(function(t){return Ls.propertyIsEnumerable.call(e,t)})):t}(e).forEach(function(s){return t.set(s,e[s])}):Array.isArray(e)?e.forEach(function(e){var s=e[0],i=e[1];return t.set(s,i)}):Vs(e)?(s=e,i=Object.getPrototypeOf(s),n=Object.getPrototypeOf(i),null!==Object.getPrototypeOf(n)&&ks(19,e),e.forEach(function(e,s){return t.set(s,e)})):null!=e&&ks(20,e)}),this},t.clear=function(){var e=this;Dr(function(){Ln(function(){for(var t,s=ii(e.keys());!(t=s()).done;){var i=t.value;e.delete(i)}})})},t.replace=function(e){var t=this;return Dr(function(){for(var s,i=function(e){if(Vs(e)||no(e))return e;if(Array.isArray(e))return new Map(e);if(Fs(e)){var t=new Map;for(var s in e)t.set(s,e[s]);return t}return ks(21,e)}(e),n=new Map,r=!1,o=ii(t.data_.keys());!(s=o()).done;){var a=s.value;if(!i.has(a))if(t.delete(a))r=!0;else{var l=t.data_.get(a);n.set(a,l)}}for(var c,h=ii(i.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 v=t.data_.get(d);n.set(d,v),p||(r=!0)}}if(!r)if(t.data_.size!==n.size)t.keysAtom_.reportChanged();else for(var g=t.data_.keys(),m=n.keys(),_=g.next(),x=m.next();!_.done;){if(_.value!==x.value){t.keysAtom_.reportChanged();break}_=g.next(),x=m.next()}t.data_=n}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return Ir(this,e)},t.intercept_=function(e){return Ar(this,e)},si(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),no=qs("ObservableMap",io);function ro(e){return e[Symbol.toStringTag]="MapIterator",Oo(e)}var oo={},ao=function(){function e(e,t,s){var i=this;void 0===t&&(t=bi),void 0===s&&(s="ObservableSet"),this.name_=void 0,this[vi]=oo,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_=s,Is(Set)||ks(22),this.enhancer_=function(e,i){return t(e,i,s)},Eo(function(){i.atom_=_i(i.name_),e&&i.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;Dr(function(){Ln(function(){for(var t,s=ii(e.data_.values());!(t=s()).done;){var i=t.value;e.delete(i)}})})},t.forEach=function(e,t){for(var s,i=ii(this);!(s=i()).done;){var n=s.value;e.call(t,n,n,this)}},t.add=function(e){var t=this;if(this.atom_,Rr(this)){var s=zr(this,{type:to,object:this,newValue:e});if(!s)return this;e=s.newValue}if(!this.has(e)){Dr(function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()});var i=Tr(this),n=i?{observableKind:"set",debugObjectName:this.name_,type:to,object:this,newValue:e}:null;i&&Or(this,n)}return this},t.delete=function(e){var t=this;if(Rr(this)&&!zr(this,{type:so,object:this,oldValue:e}))return!1;if(this.has(e)){var s=Tr(this),i=s?{observableKind:"set",debugObjectName:this.name_,type:so,object:this,oldValue:e}:null;return Dr(function(){t.atom_.reportChanged(),t.data_.delete(e)}),s&&Or(this,i),!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 co({next:function(){var t=e.next(),s=t.value,i=t.done;return i?{value:void 0,done:i}:{value:[s,s],done:i}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var e=this,t=this.data_.values();return co({next:function(){var s=t.next(),i=s.value,n=s.done;return n?{value:void 0,done:n}:{value:e.dehanceValue_(i),done:n}}})},t.intersection=function(e){return $s(e)&&!lo(e)?e.intersection(this):new Set(this).intersection(e)},t.union=function(e){return $s(e)&&!lo(e)?e.union(this):new Set(this).union(e)},t.difference=function(e){return new Set(this).difference(e)},t.symmetricDifference=function(e){return $s(e)&&!lo(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 $s(e)&&!lo(e)?e.isDisjointFrom(this):new Set(this).isDisjointFrom(e)},t.replace=function(e){var t=this;return lo(e)&&(e=new Set(e)),Dr(function(){Array.isArray(e)||$s(e)?(t.clear(),e.forEach(function(e){return t.add(e)})):null!=e&&ks("Cannot initialize set from "+e)}),this},t.observe_=function(e,t){return Ir(this,e)},t.intercept_=function(e){return Ar(this,e)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},si(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),lo=qs("ObservableSet",ao);function co(e){return e[Symbol.toStringTag]="SetIterator",Oo(e)}var ho=Object.create(null),uo="remove",fo=function(){function e(e,t,s,i){void 0===t&&(t=new Map),void 0===i&&(i=Wi),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_=s,this.defaultAnnotation_=i,this.keysAtom_=new gi("ObservableObject.keys"),this.isPlainObject_=Fs(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(e){var t,s;return(null!=(t=null!=(s=this.values_.get(e))?s:this.materializeLazyComputed_(e))?t:this.materializeLazyObservable_(e)).get()},t.materializeLazyComputed_=function(e){var t,s=null==(t=this.lazyComputedKeys_)?void 0:t.get(e);if(s){this.lazyComputedKeys_.delete(e),0===this.lazyComputedKeys_.size&&(this.lazyComputedKeys_=void 0);var i=s();return this.values_.set(e,i),i}},t.materializeLazyObservable_=function(e){var t,s=null==(t=this.lazyObservableKeys_)?void 0:t.get(e);if(s){this.lazyObservableKeys_.delete(e),0===this.lazyObservableKeys_.size&&(this.lazyObservableKeys_=void 0);var i=s();return this.values_.set(e,i),i}},t.setObservablePropValue_=function(e,t){var s,i,n=null!=(s=null!=(i=this.values_.get(e))?i:this.materializeLazyComputed_(e))?s:this.materializeLazyObservable_(e);if(n instanceof xn)return n.set(t),!0;if(Rr(this)){var r=zr(this,{type:Kr,object:this.proxy_||this.target_,name:e,newValue:t});if(!r)return null;t=r.newValue}if((t=n.prepareNewValue_(t))!==On.UNCHANGED){var o=Tr(this),a=o?{type:Kr,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),o&&Or(this,a)}return!0},t.get_=function(e){return On.trackingDerivation&&!Zs(this.target_,e)&&this.has_(e),this.target_[e]},t.set_=function(e,t,s){return void 0===s&&(s=!1),Zs(this.target_,e)?this.values_.has(e)?this.setObservablePropValue_(e,t):s?Reflect.set(this.target_,e,t):(this.target_[e]=t,!0):this.extend_(e,{value:t,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,s)},t.has_=function(e){if(!On.trackingDerivation)return e in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var t=this.pendingKeys_.get(e);return t||(t=new _n(e in this.target_,yi,"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 s;if(null!=(s=this.target_[ui])&&s[e])return;ks(1,t.annotationType_,this.name_+"."+e.toString())}for(var i=this.target_;i&&i!==Ls;){var n=Ms(i,e);if(n){var r=t.make_(this,e,n,i);if(0===r)return;if(1===r)break}i=Object.getPrototypeOf(i)}_o(this,t,e)}},t.extend_=function(e,t,s,i){if(void 0===i&&(i=!1),!0===s&&(s=this.defaultAnnotation_),!1===s)return this.defineProperty_(e,t,i);var n=s.extend_(this,e,t,i);return n&&_o(this,s,e),n},t.defineProperty_=function(e,t,s){void 0===s&&(s=!1),this.keysAtom_;try{Kn();var i=this.delete_(e);if(!i)return i;if(Rr(this)){var n=zr(this,{object:this.proxy_||this.target_,name:e,type:to,newValue:t.value});if(!n)return null;var r=n.newValue;t.value!==r&&(t=ni({},t,{value:r}))}if(s){if(!Reflect.defineProperty(this.target_,e,t))return!1}else Bs(this.target_,e,t);this.notifyPropertyAddition_(e,t.value)}finally{Un()}return!0},t.defineObservableProperty_=function(e,t,s,i){void 0===i&&(i=!1),this.keysAtom_;try{Kn();var n=this.delete_(e);if(!n)return n;if(Rr(this)){var r=zr(this,{object:this.proxy_||this.target_,name:e,type:to,newValue:t});if(!r)return null;t=r.newValue}var o=go(e),a={configurable:!On.safeDescriptors||this.isPlainObject_,enumerable:!0,get:o.get,set:o.set};if(i){if(!Reflect.defineProperty(this.target_,e,a))return!1}else Bs(this.target_,e,a);var l=new _n(t,s,"ObservableObject.key",!1);this.values_.set(e,l),this.notifyPropertyAddition_(e,l.value_)}finally{Un()}return!0},t.defineComputedProperty_=function(e,t,s){void 0===s&&(s=!1),this.keysAtom_;try{Kn();var i=this.delete_(e);if(!i)return i;if(Rr(this))if(!zr(this,{object:this.proxy_||this.target_,name:e,type:to,newValue:void 0}))return null;t.name||(t.name="ObservableObject.key"),t.context=this.proxy_||this.target_;var n=go(e),r={configurable:!On.safeDescriptors||this.isPlainObject_,enumerable:!1,get:n.get,set:n.set};if(s){if(!Reflect.defineProperty(this.target_,e,r))return!1}else Bs(this.target_,e,r);this.values_.set(e,new xn(t)),this.notifyPropertyAddition_(e,void 0)}finally{Un()}return!0},t.delete_=function(e,t){if(void 0===t&&(t=!1),this.keysAtom_,!Zs(this.target_,e))return!0;if(Rr(this)&&!zr(this,{object:this.proxy_||this.target_,name:e,type:uo}))return null;try{var s;Kn();var i,n=Tr(this),r=this.values_.get(e),o=void 0;if(!r&&n)o=null==(i=Ms(this.target_,e))?void 0:i.value;if(t){if(!Reflect.deleteProperty(this.target_,e))return!1}else delete this.target_[e];if(r&&(this.values_.delete(e),r instanceof _n&&(o=r.value_),Vn(r)),this.keysAtom_.reportChanged(),null==(s=this.pendingKeys_)||null==(s=s.get(e))||s.set(e in this.target_),n){var a={type:uo,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:o,name:e};0,n&&Or(this,a)}}finally{Un()}return!0},t.observe_=function(e,t){return Ir(this,e)},t.intercept_=function(e){return Ar(this,e)},t.notifyPropertyAddition_=function(e,t){var s,i=Tr(this);if(i){var n=i?{type:to,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:e,newValue:t}:null;i&&Or(this,n)}null==(s=this.pendingKeys_)||null==(s=s.get(e))||s.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),Gs(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function po(e,t){var s;if(Zs(e,vi))return e;var i=null!=(s=null==t?void 0:t.name)?s:"ObservableObject",n=new fo(e,new Map,String(i),function(e){var t;return e?null!=(t=e.defaultDecorator)?t:Ki(e):void 0}(t));return Ks(e,vi,n),e}var vo=qs("ObservableObjectAdministration",fo);function go(e){return ho[e]||(ho[e]={get:function(){return this[vi].getObservablePropValue_(e)},set:function(t){return this[vi].setObservablePropValue_(e,t)}})}function mo(e){return!!Hs(e)&&vo(e[vi])}function _o(e,t,s){var i;null==(i=e.target_[ui])||delete i[s]}var xo,bo,yo=jo(0),wo=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,!1===e}(),So=0,ko=function(){};xo=ko,bo=Array.prototype,Object.setPrototypeOf?Object.setPrototypeOf(xo.prototype,bo):void 0!==xo.prototype.__proto__?xo.prototype.__proto__=bo:xo.prototype=bo;var Co=function(e){function t(t,s,i,n){var r;return void 0===i&&(i="ObservableArray"),void 0===n&&(n=!1),r=e.call(this)||this,Eo(function(){var e=new qr(i,s,n,!0);e.proxy_=r,Us(r,vi,e),t&&t.length&&r.spliceWithArray(0,0,t),wo&&Object.defineProperty(r,"0",yo)}),r}oi(t,e);var s=t.prototype;return s.concat=function(){this[vi].atom_.reportObserved();for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return Array.prototype.concat.apply(this.slice(),t.map(function(e){return Qr(e)?e.slice():e}))},s[Symbol.iterator]=function(){var e=this,t=0;return Oo({next:function(){return t<e.length?{value:e[t++],done:!1}:{done:!0,value:void 0}}})},si(t,[{key:"length",get:function(){return this[vi].getArrayLength_()},set:function(e){this[vi].setArrayLength_(e)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(ko);function jo(e){return{enumerable:!1,configurable:!0,get:function(){return this[vi].get_(e)},set:function(t){this[vi].set_(e,t)}}}function No(e){Bs(Co.prototype,""+e,jo(e))}function Mo(e){if(e>So){for(var t=So;t<e+100;t++)No(t);So=e}}function Bo(e,t,s){return new Co(e,t,s)}function Lo(e,t){if("object"==typeof e&&null!==e){if(Qr(e))return void 0!==t&&ks(23),e[vi].atom_;if(lo(e))return e.atom_;if(no(e)){if(void 0===t)return e.keysAtom_;var s=e.data_.get(t)||e.hasMap_.get(t);return s||ks(25,t,Do(e)),s}if(mo(e)){var i,n;if(!t)return ks(26);var r=e[vi],o=null!=(i=null!=(n=r.values_.get(t))?n:r.materializeLazyComputed_(t))?i:r.materializeLazyObservable_(t);return o||ks(27,t,Do(e)),o}if(mi(e)||kn(e)||Jn(e))return e}else if(Is(e)&&Jn(e[vi]))return e[vi];ks(28)}function Do(e,t){var s;if(void 0!==t)s=Lo(e,t);else{if(hr(e))return e.name;s=mo(e)||no(e)||lo(e)?function(e){return e||ks(29),mi(e)||kn(e)||Jn(e)||no(e)||lo(e)?e:e[vi]?e[vi]:void ks(24,e)}(e):Lo(e)}return s.name_}function Eo(e){var t=Dn(),s=gn(!0);Kn();try{return e()}finally{Un(),mn(s),En(t)}}Object.entries($r).forEach(function(e){var t=e[0],s=e[1];"concat"!==t&&Ks(Co.prototype,t,s)}),Mo(1e3);var Po,Ro=Ls.toString;function Ao(e,t,s){return void 0===s&&(s=-1),zo(e,t,s)}function zo(e,t,s,i,n){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return!1;if(e!=e)return t!=t;var r=typeof e;if("function"!==r&&"object"!==r&&"object"!=typeof t)return!1;var o=Ro.call(e);if(o!==Ro.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]":s>=0&&s++}e=To(e),t=To(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&&!(Is(l)&&l instanceof l&&Is(c)&&c instanceof c)&&"constructor"in e&&"constructor"in t)return!1}if(0===s)return!1;s<0&&(s=-1),n=n||[];for(var h=(i=i||[]).length;h--;)if(i[h]===e)return n[h]===t;if(i.push(e),n.push(t),a){if((h=e.length)!==t.length)return!1;for(;h--;)if(!zo(e[h],t[h],s-1,i,n))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(!Zs(t,p)||!zo(e[p],t[p],s-1,i,n))return!1}}return i.pop(),n.pop(),!0}function To(e){return Qr(e)?e.slice():Vs(e)||no(e)||$s(e)||lo(e)?Array.from(e.entries()):e}var Io=(null==(Po=js().Iterator)?void 0:Po.prototype)||{};function Oo(e){return e[Symbol.iterator]=Ho,Object.assign(Object.create(Io),e)}function Ho(){return this}["Symbol","Map","Set"].forEach(function(e){void 0===js()[e]&&ks("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:Do},$mobx:vi});var Fo={exports:{}},Wo={},Ko={exports:{}},Uo={};
|
|
12
|
-
/**
|
|
13
|
-
* @license React
|
|
14
|
-
* scheduler.production.min.js
|
|
15
|
-
*
|
|
16
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
17
|
-
*
|
|
18
|
-
* This source code is licensed under the MIT license found in the
|
|
19
|
-
* LICENSE file in the root directory of this source tree.
|
|
20
|
-
*/
|
|
21
|
-
!function(e){function t(e,t){var s=e.length;e.push(t);e:for(;0<s;){var i=s-1>>>1,r=e[i];if(!(0<n(r,t)))break e;e[i]=t,e[s]=r,s=i}}function s(e){return 0===e.length?null:e[0]}function i(e){if(0===e.length)return null;var t=e[0],s=e.pop();if(s!==t){e[0]=s;e:for(var i=0,r=e.length,o=r>>>1;i<o;){var a=2*(i+1)-1,l=e[a],c=a+1,h=e[c];if(0>n(l,s))c<r&&0>n(h,l)?(e[i]=h,e[c]=s,i=c):(e[i]=l,e[a]=s,i=a);else{if(!(c<r&&0>n(h,s)))break e;e[i]=h,e[c]=s,i=c}}}return t}function n(e,t){var s=e.sortIndex-t.sortIndex;return 0!==s?s:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var r=performance;e.unstable_now=function(){return r.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,v=!1,g="function"==typeof setTimeout?setTimeout:null,m="function"==typeof clearTimeout?clearTimeout:null,_="undefined"!=typeof setImmediate?setImmediate:null;function x(e){for(var n=s(c);null!==n;){if(null===n.callback)i(c);else{if(!(n.startTime<=e))break;i(c),n.sortIndex=n.expirationTime,t(l,n)}n=s(c)}}function b(e){if(v=!1,x(e),!p)if(null!==s(l))p=!0,E(y);else{var t=s(c);null!==t&&P(b,t.startTime-e)}}function y(t,n){p=!1,v&&(v=!1,m(C),C=-1),f=!0;var r=d;try{for(x(n),u=s(l);null!==u&&(!(u.expirationTime>n)||t&&!M());){var o=u.callback;if("function"==typeof o){u.callback=null,d=u.priorityLevel;var a=o(u.expirationTime<=n);n=e.unstable_now(),"function"==typeof a?u.callback=a:u===s(l)&&i(l),x(n)}else i(l);u=s(l)}if(null!==u)var h=!0;else{var g=s(c);null!==g&&P(b,g.startTime-n),h=!1}return h}finally{u=null,d=r,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 s=!0;try{s=k(!0,t)}finally{s?w():(S=!1,k=null)}}else S=!1}if("function"==typeof _)w=function(){_(B)};else if("undefined"!=typeof MessageChannel){var L=new MessageChannel,D=L.port2;L.port1.onmessage=B,w=function(){D.postMessage(null)}}else w=function(){g(B,0)};function E(e){k=e,S||(S=!0,w())}function P(t,s){C=g(function(){t(e.unstable_now())},s)}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,E(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 s(l)},e.unstable_next=function(e){switch(d){case 1:case 2:case 3:var t=3;break;default:t=d}var s=d;d=t;try{return e()}finally{d=s}},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 s=d;d=e;try{return t()}finally{d=s}},e.unstable_scheduleCallback=function(i,n,r){var o=e.unstable_now();switch("object"==typeof r&&null!==r?r="number"==typeof(r=r.delay)&&0<r?o+r:o:r=o,i){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 i={id:h++,callback:n,priorityLevel:i,startTime:r,expirationTime:a=r+a,sortIndex:-1},r>o?(i.sortIndex=r,t(c,i),null===s(l)&&i===s(c)&&(v?(m(C),C=-1):v=!0,P(b,r-o))):(i.sortIndex=a,t(l,i),p||f||(p=!0,E(y))),i},e.unstable_shouldYield=M,e.unstable_wrapCallback=function(e){var t=d;return function(){var s=d;d=t;try{return e.apply(this,arguments)}finally{d=s}}}}(Uo),Ko.exports=Uo;var qo=Ko.exports,Vo=ps,$o=qo;
|
|
22
|
-
/**
|
|
23
|
-
* @license React
|
|
24
|
-
* react-dom.production.min.js
|
|
25
|
-
*
|
|
26
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
27
|
-
*
|
|
28
|
-
* This source code is licensed under the MIT license found in the
|
|
29
|
-
* LICENSE file in the root directory of this source tree.
|
|
30
|
-
*/function Yo(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,s=1;s<arguments.length;s++)t+="&args[]="+encodeURIComponent(arguments[s]);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 Go=new Set,Xo={};function Zo(e,t){Jo(e,t),Jo(e+"Capture",t)}function Jo(e,t){for(Xo[e]=t,e=0;e<t.length;e++)Go.add(t[e])}var Qo=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),ea=Object.prototype.hasOwnProperty,ta=/^[: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={},ia={};function na(e,t,s,i,n,r,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=i,this.attributeNamespace=n,this.mustUseProperty=s,this.propertyName=e,this.type=t,this.sanitizeURL=r,this.removeEmptyString=o}var ra={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ra[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];ra[t]=new na(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){ra[e]=new na(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ra[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){ra[e]=new na(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){ra[e]=new na(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){ra[e]=new na(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){ra[e]=new na(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){ra[e]=new na(e,5,!1,e.toLowerCase(),null,!1,!1)});var oa=/[\-:]([a-z])/g;function aa(e){return e[1].toUpperCase()}function la(e,t,s,i){var n=ra.hasOwnProperty(t)?ra[t]:null;(null!==n?0!==n.type:i||!(2<t.length)||"o"!==t[0]&&"O"!==t[0]||"n"!==t[1]&&"N"!==t[1])&&(function(e,t,s,i){if(null==t||function(e,t,s,i){if(null!==s&&0===s.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!i&&(null!==s?!s.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,s,i))return!0;if(i)return!1;if(null!==s)switch(s.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,s,n,i)&&(s=null),i||null===n?function(e){return!!ea.call(ia,e)||!ea.call(sa,e)&&(ta.test(e)?ia[e]=!0:(sa[e]=!0,!1))}(t)&&(null===s?e.removeAttribute(t):e.setAttribute(t,""+s)):n.mustUseProperty?e[n.propertyName]=null===s?3!==n.type&&"":s:(t=n.attributeName,i=n.attributeNamespace,null===s?e.removeAttribute(t):(s=3===(n=n.type)||4===n&&!0===s?"":""+s,i?e.setAttributeNS(i,t,s):e.setAttribute(t,s))))}"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(oa,aa);ra[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(oa,aa);ra[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(oa,aa);ra[t]=new na(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){ra[e]=new na(e,1,!1,e.toLowerCase(),null,!1,!1)}),ra.xlinkHref=new na("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){ra[e]=new na(e,1,!1,e.toLowerCase(),null,!0,!0)});var ca=Vo.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ha=Symbol.for("react.element"),ua=Symbol.for("react.portal"),da=Symbol.for("react.fragment"),fa=Symbol.for("react.strict_mode"),pa=Symbol.for("react.profiler"),va=Symbol.for("react.provider"),ga=Symbol.for("react.context"),ma=Symbol.for("react.forward_ref"),_a=Symbol.for("react.suspense"),xa=Symbol.for("react.suspense_list"),ba=Symbol.for("react.memo"),ya=Symbol.for("react.lazy"),wa=Symbol.for("react.offscreen"),Sa=Symbol.iterator;function ka(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=Sa&&e[Sa]||e["@@iterator"])?e:null}var Ca,ja=Object.assign;function Na(e){if(void 0===Ca)try{throw Error()}catch(s){var t=s.stack.trim().match(/\n( *(at )?)/);Ca=t&&t[1]||""}return"\n"+Ca+e}var Ma=!1;function Ba(e,t){if(!e||Ma)return"";Ma=!0;var s=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 i=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){i=c}e.call(t.prototype)}else{try{throw Error()}catch(c){i=c}e()}}catch(c){if(c&&i&&"string"==typeof c.stack){for(var n=c.stack.split("\n"),r=i.stack.split("\n"),o=n.length-1,a=r.length-1;1<=o&&0<=a&&n[o]!==r[a];)a--;for(;1<=o&&0<=a;o--,a--)if(n[o]!==r[a]){if(1!==o||1!==a)do{if(o--,0>--a||n[o]!==r[a]){var l="\n"+n[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{Ma=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?Na(e):""}function La(e){switch(e.tag){case 5:return Na(e.type);case 16:return Na("Lazy");case 13:return Na("Suspense");case 19:return Na("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 Da(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 da:return"Fragment";case ua:return"Portal";case pa:return"Profiler";case fa:return"StrictMode";case _a:return"Suspense";case xa:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case ga:return(e.displayName||"Context")+".Consumer";case va:return(e._context.displayName||"Context")+".Provider";case ma:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case ba:return null!==(t=e.displayName||null)?t:Da(e.type)||"Memo";case ya:t=e._payload,e=e._init;try{return Da(e(t))}catch(s){}}return null}function Ea(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 Da(t);case 8:return t===fa?"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 Ra(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function Aa(e){e._valueTracker||(e._valueTracker=function(e){var t=Ra(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),i=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==s&&"function"==typeof s.get&&"function"==typeof s.set){var n=s.get,r=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return n.call(this)},set:function(e){i=""+e,r.call(this,e)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return i},setValue:function(e){i=""+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 s=t.getValue(),i="";return e&&(i=Ra(e)?e.checked?"true":"false":e.value),(e=i)!==s&&(t.setValue(e),!0)}function Ta(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 s=t.checked;return ja({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=s?s:e._wrapperState.initialChecked})}function Oa(e,t){var s=null==t.defaultValue?"":t.defaultValue,i=null!=t.checked?t.checked:t.defaultChecked;s=Pa(null!=t.value?t.value:s),e._wrapperState={initialChecked:i,initialValue:s,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function Ha(e,t){null!=(t=t.checked)&&la(e,"checked",t,!1)}function Fa(e,t){Ha(e,t);var s=Pa(t.value),i=t.type;if(null!=s)"number"===i?(0===s&&""===e.value||e.value!=s)&&(e.value=""+s):e.value!==""+s&&(e.value=""+s);else if("submit"===i||"reset"===i)return void e.removeAttribute("value");t.hasOwnProperty("value")?Ka(e,t.type,s):t.hasOwnProperty("defaultValue")&&Ka(e,t.type,Pa(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function Wa(e,t,s){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var i=t.type;if(!("submit"!==i&&"reset"!==i||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,s||t===e.value||(e.value=t),e.defaultValue=t}""!==(s=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==s&&(e.name=s)}function Ka(e,t,s){"number"===t&&Ta(e.ownerDocument)===e||(null==s?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var Ua=Array.isArray;function qa(e,t,s,i){if(e=e.options,t){t={};for(var n=0;n<s.length;n++)t["$"+s[n]]=!0;for(s=0;s<e.length;s++)n=t.hasOwnProperty("$"+e[s].value),e[s].selected!==n&&(e[s].selected=n),n&&i&&(e[s].defaultSelected=!0)}else{for(s=""+Pa(s),t=null,n=0;n<e.length;n++){if(e[n].value===s)return e[n].selected=!0,void(i&&(e[n].defaultSelected=!0));null!==t||e[n].disabled||(t=e[n])}null!==t&&(t.selected=!0)}}function Va(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(Yo(91));return ja({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function $a(e,t){var s=t.value;if(null==s){if(s=t.children,t=t.defaultValue,null!=s){if(null!=t)throw Error(Yo(92));if(Ua(s)){if(1<s.length)throw Error(Yo(93));s=s[0]}t=s}null==t&&(t=""),s=t}e._wrapperState={initialValue:Pa(s)}}function Ya(e,t){var s=Pa(t.value),i=Pa(t.defaultValue);null!=s&&((s=""+s)!==e.value&&(e.value=s),null==t.defaultValue&&e.defaultValue!==s&&(e.defaultValue=s)),null!=i&&(e.defaultValue=""+i)}function Ga(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}function Xa(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?Xa(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var Ja,Qa,el=(Qa=function(e,t){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=t;else{for((Ja=Ja||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Ja.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,s,i){MSApp.execUnsafeLocalFunction(function(){return Qa(e,t)})}:Qa);function tl(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&3===s.nodeType)return void(s.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},il=["Webkit","ms","Moz","O"];function nl(e,t,s){return null==t||"boolean"==typeof t||""===t?"":s||"number"!=typeof t||0===t||sl.hasOwnProperty(e)&&sl[e]?(""+t).trim():t+"px"}function rl(e,t){for(var s in e=e.style,t)if(t.hasOwnProperty(s)){var i=0===s.indexOf("--"),n=nl(s,t[s],i);"float"===s&&(s="cssFloat"),i?e.setProperty(s,n):e[s]=n}}Object.keys(sl).forEach(function(e){il.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),sl[t]=sl[e]})});var ol=ja({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 al(e,t){if(t){if(ol[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(Yo(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(Yo(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(Yo(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(Yo(62))}}function ll(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 cl=null;function hl(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var ul=null,dl=null,fl=null;function pl(e){if(e=ad(e)){if("function"!=typeof ul)throw Error(Yo(280));var t=e.stateNode;t&&(t=cd(t),ul(e.stateNode,e.type,t))}}function vl(e){dl?fl?fl.push(e):fl=[e]:dl=e}function gl(){if(dl){var e=dl,t=fl;if(fl=dl=null,pl(e),t)for(e=0;e<t.length;e++)pl(t[e])}}function ml(e,t){return e(t)}function _l(){}var xl=!1;function bl(e,t,s){if(xl)return e(t,s);xl=!0;try{return ml(e,t,s)}finally{xl=!1,(null!==dl||null!==fl)&&(_l(),gl())}}function yl(e,t){var s=e.stateNode;if(null===s)return null;var i=cd(s);if(null===i)return null;s=i[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":(i=!i.disabled)||(i=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!i;break e;default:e=!1}if(e)return null;if(s&&"function"!=typeof s)throw Error(Yo(231,t,typeof s));return s}var wl=!1;if(Qo)try{var Sl={};Object.defineProperty(Sl,"passive",{get:function(){wl=!0}}),window.addEventListener("test",Sl,Sl),window.removeEventListener("test",Sl,Sl)}catch(Qa){wl=!1}function kl(e,t,s,i,n,r,o,a,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(s,c)}catch(h){this.onError(h)}}var Cl=!1,jl=null,Nl=!1,Ml=null,Bl={onError:function(e){Cl=!0,jl=e}};function Ll(e,t,s,i,n,r,o,a,l){Cl=!1,jl=null,kl.apply(Bl,arguments)}function Dl(e){var t=e,s=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{!!(4098&(t=e).flags)&&(s=t.return),e=t.return}while(e)}return 3===t.tag?s:null}function El(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(Dl(e)!==e)throw Error(Yo(188))}function Rl(e){return null!==(e=function(e){var t=e.alternate;if(!t){if(null===(t=Dl(e)))throw Error(Yo(188));return t!==e?null:e}for(var s=e,i=t;;){var n=s.return;if(null===n)break;var r=n.alternate;if(null===r){if(null!==(i=n.return)){s=i;continue}break}if(n.child===r.child){for(r=n.child;r;){if(r===s)return Pl(n),e;if(r===i)return Pl(n),t;r=r.sibling}throw Error(Yo(188))}if(s.return!==i.return)s=n,i=r;else{for(var o=!1,a=n.child;a;){if(a===s){o=!0,s=n,i=r;break}if(a===i){o=!0,i=n,s=r;break}a=a.sibling}if(!o){for(a=r.child;a;){if(a===s){o=!0,s=r,i=n;break}if(a===i){o=!0,i=r,s=n;break}a=a.sibling}if(!o)throw Error(Yo(189))}}if(s.alternate!==i)throw Error(Yo(190))}if(3!==s.tag)throw Error(Yo(188));return s.stateNode.current===s?e:t}(e))?Al(e):null}function Al(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=Al(e);if(null!==t)return t;e=e.sibling}return null}var zl=$o.unstable_scheduleCallback,Tl=$o.unstable_cancelCallback,Il=$o.unstable_shouldYield,Ol=$o.unstable_requestPaint,Hl=$o.unstable_now,Fl=$o.unstable_getCurrentPriorityLevel,Wl=$o.unstable_ImmediatePriority,Kl=$o.unstable_UserBlockingPriority,Ul=$o.unstable_NormalPriority,ql=$o.unstable_LowPriority,Vl=$o.unstable_IdlePriority,$l=null,Yl=null;var Gl=Math.clz32?Math.clz32:function(e){return e>>>=0,0===e?32:31-(Xl(e)/Zl|0)|0},Xl=Math.log,Zl=Math.LN2;var Jl=64,Ql=4194304;function ec(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 tc(e,t){var s=e.pendingLanes;if(0===s)return 0;var i=0,n=e.suspendedLanes,r=e.pingedLanes,o=268435455&s;if(0!==o){var a=o&~n;0!==a?i=ec(a):0!==(r&=o)&&(i=ec(r))}else 0!==(o=s&~n)?i=ec(o):0!==r&&(i=ec(r));if(0===i)return 0;if(0!==t&&t!==i&&0===(t&n)&&((n=i&-i)>=(r=t&-t)||16===n&&4194240&r))return t;if(4&i&&(i|=16&s),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=i;0<t;)n=1<<(s=31-Gl(t)),i|=e[s],t&=~n;return i}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 ic(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function nc(){var e=Jl;return!(4194240&(Jl<<=1))&&(Jl=64),e}function rc(e){for(var t=[],s=0;31>s;s++)t.push(e);return t}function oc(e,t,s){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-Gl(t)]=s}function ac(e,t){var s=e.entangledLanes|=t;for(e=e.entanglements;s;){var i=31-Gl(s),n=1<<i;n&t|e[i]&t&&(e[i]|=t),s&=~n}}var lc=0;function cc(e){return 1<(e&=-e)?4<e?268435455&e?16:536870912:4:1}var hc,uc,dc,fc,pc,vc=!1,gc=[],mc=null,_c=null,xc=null,bc=new Map,yc=new Map,wc=[],Sc="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 kc(e,t){switch(e){case"focusin":case"focusout":mc=null;break;case"dragenter":case"dragleave":_c=null;break;case"mouseover":case"mouseout":xc=null;break;case"pointerover":case"pointerout":bc.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":yc.delete(t.pointerId)}}function Cc(e,t,s,i,n,r){return null===e||e.nativeEvent!==r?(e={blockedOn:t,domEventName:s,eventSystemFlags:i,nativeEvent:r,targetContainers:[n]},null!==t&&(null!==(t=ad(t))&&uc(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,null!==n&&-1===t.indexOf(n)&&t.push(n),e)}function jc(e){var t=od(e.target);if(null!==t){var s=Dl(t);if(null!==s)if(13===(t=s.tag)){if(null!==(t=El(s)))return e.blockedOn=t,void pc(e.priority,function(){dc(s)})}else if(3===t&&s.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===s.tag?s.stateNode.containerInfo:null)}e.blockedOn=null}function Nc(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var s=Ic(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==s)return null!==(t=ad(s))&&uc(t),e.blockedOn=s,!1;var i=new(s=e.nativeEvent).constructor(s.type,s);cl=i,s.target.dispatchEvent(i),cl=null,t.shift()}return!0}function Mc(e,t,s){Nc(e)&&s.delete(t)}function Bc(){vc=!1,null!==mc&&Nc(mc)&&(mc=null),null!==_c&&Nc(_c)&&(_c=null),null!==xc&&Nc(xc)&&(xc=null),bc.forEach(Mc),yc.forEach(Mc)}function Lc(e,t){e.blockedOn===t&&(e.blockedOn=null,vc||(vc=!0,$o.unstable_scheduleCallback($o.unstable_NormalPriority,Bc)))}function Dc(e){function t(t){return Lc(t,e)}if(0<gc.length){Lc(gc[0],e);for(var s=1;s<gc.length;s++){var i=gc[s];i.blockedOn===e&&(i.blockedOn=null)}}for(null!==mc&&Lc(mc,e),null!==_c&&Lc(_c,e),null!==xc&&Lc(xc,e),bc.forEach(t),yc.forEach(t),s=0;s<wc.length;s++)(i=wc[s]).blockedOn===e&&(i.blockedOn=null);for(;0<wc.length&&null===(s=wc[0]).blockedOn;)jc(s),null===s.blockedOn&&wc.shift()}var Ec=ca.ReactCurrentBatchConfig,Pc=!0;function Rc(e,t,s,i){var n=lc,r=Ec.transition;Ec.transition=null;try{lc=1,zc(e,t,s,i)}finally{lc=n,Ec.transition=r}}function Ac(e,t,s,i){var n=lc,r=Ec.transition;Ec.transition=null;try{lc=4,zc(e,t,s,i)}finally{lc=n,Ec.transition=r}}function zc(e,t,s,i){if(Pc){var n=Ic(e,t,s,i);if(null===n)Eu(e,t,i,Tc,s),kc(e,i);else if(function(e,t,s,i,n){switch(t){case"focusin":return mc=Cc(mc,e,t,s,i,n),!0;case"dragenter":return _c=Cc(_c,e,t,s,i,n),!0;case"mouseover":return xc=Cc(xc,e,t,s,i,n),!0;case"pointerover":var r=n.pointerId;return bc.set(r,Cc(bc.get(r)||null,e,t,s,i,n)),!0;case"gotpointercapture":return r=n.pointerId,yc.set(r,Cc(yc.get(r)||null,e,t,s,i,n)),!0}return!1}(n,e,t,s,i))i.stopPropagation();else if(kc(e,i),4&t&&-1<Sc.indexOf(e)){for(;null!==n;){var r=ad(n);if(null!==r&&hc(r),null===(r=Ic(e,t,s,i))&&Eu(e,t,i,Tc,s),r===n)break;n=r}null!==n&&i.stopPropagation()}else Eu(e,t,i,null,s)}}var Tc=null;function Ic(e,t,s,i){if(Tc=null,null!==(e=od(e=hl(i))))if(null===(t=Dl(e)))e=null;else if(13===(s=t.tag)){if(null!==(e=El(t)))return e;e=null}else if(3===s){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Tc=e,null}function Oc(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(Fl()){case Wl:return 1;case Kl:return 4;case Ul:case ql:return 16;case Vl:return 536870912;default:return 16}default:return 16}}var Hc=null,Fc=null,Wc=null;function Kc(){if(Wc)return Wc;var e,t,s=Fc,i=s.length,n="value"in Hc?Hc.value:Hc.textContent,r=n.length;for(e=0;e<i&&s[e]===n[e];e++);var o=i-e;for(t=1;t<=o&&s[i-t]===n[r-t];t++);return Wc=n.slice(e,1<t?1-t:void 0)}function Uc(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 $c(e){function t(t,s,i,n,r){for(var o in this._reactName=t,this._targetInst=i,this.type=s,this.nativeEvent=n,this.target=r,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(n):n[o]);return this.isDefaultPrevented=(null!=n.defaultPrevented?n.defaultPrevented:!1===n.returnValue)?qc:Vc,this.isPropagationStopped=Vc,this}return ja(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 Yc,Gc,Xc,Zc={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Jc=$c(Zc),Qc=ja({},Zc,{view:0,detail:0}),eh=$c(Qc),th=ja({},Qc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:fh,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!==Xc&&(Xc&&"mousemove"===e.type?(Yc=e.screenX-Xc.screenX,Gc=e.screenY-Xc.screenY):Gc=Yc=0,Xc=e),Yc)},movementY:function(e){return"movementY"in e?e.movementY:Gc}}),sh=$c(th),ih=$c(ja({},th,{dataTransfer:0})),nh=$c(ja({},Qc,{relatedTarget:0})),rh=$c(ja({},Zc,{animationName:0,elapsedTime:0,pseudoElement:0})),oh=ja({},Zc,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),ah=$c(oh),lh=$c(ja({},Zc,{data:0})),ch={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},hh={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"},uh={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function dh(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=uh[e])&&!!t[e]}function fh(){return dh}var ph=ja({},Qc,{key:function(e){if(e.key){var t=ch[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=Uc(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?hh[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:fh,charCode:function(e){return"keypress"===e.type?Uc(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?Uc(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),vh=$c(ph),gh=$c(ja({},th,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),mh=$c(ja({},Qc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:fh})),_h=$c(ja({},Zc,{propertyName:0,elapsedTime:0,pseudoElement:0})),xh=ja({},th,{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}),bh=$c(xh),yh=[9,13,27,32],wh=Qo&&"CompositionEvent"in window,Sh=null;Qo&&"documentMode"in document&&(Sh=document.documentMode);var kh=Qo&&"TextEvent"in window&&!Sh,Ch=Qo&&(!wh||Sh&&8<Sh&&11>=Sh),jh=String.fromCharCode(32),Nh=!1;function Mh(e,t){switch(e){case"keyup":return-1!==yh.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 Lh=!1;var Dh={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 Eh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Dh[e.type]:"textarea"===t}function Ph(e,t,s,i){vl(i),0<(t=Ru(t,"onChange")).length&&(s=new Jc("onChange","change",null,s,i),e.push({event:s,listeners:t}))}var Rh=null,Ah=null;function zh(e){ju(e,0)}function Th(e){if(za(ld(e)))return e}function Ih(e,t){if("change"===e)return t}var Oh=!1;if(Qo){var Hh;if(Qo){var Fh="oninput"in document;if(!Fh){var Wh=document.createElement("div");Wh.setAttribute("oninput","return;"),Fh="function"==typeof Wh.oninput}Hh=Fh}else Hh=!1;Oh=Hh&&(!document.documentMode||9<document.documentMode)}function Kh(){Rh&&(Rh.detachEvent("onpropertychange",Uh),Ah=Rh=null)}function Uh(e){if("value"===e.propertyName&&Th(Ah)){var t=[];Ph(t,Ah,e,hl(e)),bl(zh,t)}}function qh(e,t,s){"focusin"===e?(Kh(),Ah=s,(Rh=t).attachEvent("onpropertychange",Uh)):"focusout"===e&&Kh()}function Vh(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Th(Ah)}function $h(e,t){if("click"===e)return Th(t)}function Yh(e,t){if("input"===e||"change"===e)return Th(t)}var Gh="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function Xh(e,t){if(Gh(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var s=Object.keys(e),i=Object.keys(t);if(s.length!==i.length)return!1;for(i=0;i<s.length;i++){var n=s[i];if(!ea.call(t,n)||!Gh(e[n],t[n]))return!1}return!0}function Zh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Jh(e,t){var s,i=Zh(e);for(e=0;i;){if(3===i.nodeType){if(s=e+i.textContent.length,e<=t&&s>=t)return{node:i,offset:t-e};e=s}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Zh(i)}}function Qh(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?Qh(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function eu(){for(var e=window,t=Ta();t instanceof e.HTMLIFrameElement;){try{var s="string"==typeof t.contentWindow.location.href}catch(i){s=!1}if(!s)break;t=Ta((e=t.contentWindow).document)}return t}function tu(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=eu(),s=e.focusedElem,i=e.selectionRange;if(t!==s&&s&&s.ownerDocument&&Qh(s.ownerDocument.documentElement,s)){if(null!==i&&tu(s))if(t=i.start,void 0===(e=i.end)&&(e=t),"selectionStart"in s)s.selectionStart=t,s.selectionEnd=Math.min(e,s.value.length);else if((e=(t=s.ownerDocument||document)&&t.defaultView||window).getSelection){e=e.getSelection();var n=s.textContent.length,r=Math.min(i.start,n);i=void 0===i.end?r:Math.min(i.end,n),!e.extend&&r>i&&(n=i,i=r,r=n),n=Jh(s,r);var o=Jh(s,i);n&&o&&(1!==e.rangeCount||e.anchorNode!==n.node||e.anchorOffset!==n.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&((t=t.createRange()).setStart(n.node,n.offset),e.removeAllRanges(),r>i?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}for(t=[],e=s;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"==typeof s.focus&&s.focus(),s=0;s<t.length;s++)(e=t[s]).element.scrollLeft=e.left,e.element.scrollTop=e.top}}var iu=Qo&&"documentMode"in document&&11>=document.documentMode,nu=null,ru=null,ou=null,au=!1;function lu(e,t,s){var i=s.window===s?s.document:9===s.nodeType?s:s.ownerDocument;au||null==nu||nu!==Ta(i)||("selectionStart"in(i=nu)&&tu(i)?i={start:i.selectionStart,end:i.selectionEnd}:i={anchorNode:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset},ou&&Xh(ou,i)||(ou=i,0<(i=Ru(ru,"onSelect")).length&&(t=new Jc("onSelect","select",null,t,s),e.push({event:t,listeners:i}),t.target=nu)))}function cu(e,t){var s={};return s[e.toLowerCase()]=t.toLowerCase(),s["Webkit"+e]="webkit"+t,s["Moz"+e]="moz"+t,s}var hu={animationend:cu("Animation","AnimationEnd"),animationiteration:cu("Animation","AnimationIteration"),animationstart:cu("Animation","AnimationStart"),transitionend:cu("Transition","TransitionEnd")},uu={},du={};function fu(e){if(uu[e])return uu[e];if(!hu[e])return e;var t,s=hu[e];for(t in s)if(s.hasOwnProperty(t)&&t in du)return uu[e]=s[t];return e}Qo&&(du=document.createElement("div").style,"AnimationEvent"in window||(delete hu.animationend.animation,delete hu.animationiteration.animation,delete hu.animationstart.animation),"TransitionEvent"in window||delete hu.transitionend.transition);var pu=fu("animationend"),vu=fu("animationiteration"),gu=fu("animationstart"),mu=fu("transitionend"),_u=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 bu(e,t){_u.set(e,t),Zo(t,[e])}for(var yu=0;yu<xu.length;yu++){var wu=xu[yu];bu(wu.toLowerCase(),"on"+(wu[0].toUpperCase()+wu.slice(1)))}bu(pu,"onAnimationEnd"),bu(vu,"onAnimationIteration"),bu(gu,"onAnimationStart"),bu("dblclick","onDoubleClick"),bu("focusin","onFocus"),bu("focusout","onBlur"),bu(mu,"onTransitionEnd"),Jo("onMouseEnter",["mouseout","mouseover"]),Jo("onMouseLeave",["mouseout","mouseover"]),Jo("onPointerEnter",["pointerout","pointerover"]),Jo("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 Su="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(" "),ku=new Set("cancel close invalid load scroll toggle".split(" ").concat(Su));function Cu(e,t,s){var i=e.type||"unknown-event";e.currentTarget=s,function(e,t,s,i,n,r,o,a,l){if(Ll.apply(this,arguments),Cl){if(!Cl)throw Error(Yo(198));var c=jl;Cl=!1,jl=null,Nl||(Nl=!0,Ml=c)}}(i,t,void 0,e),e.currentTarget=null}function ju(e,t){t=!!(4&t);for(var s=0;s<e.length;s++){var i=e[s],n=i.event;i=i.listeners;e:{var r=void 0;if(t)for(var o=i.length-1;0<=o;o--){var a=i[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==r&&n.isPropagationStopped())break e;Cu(n,a,c),r=l}else for(o=0;o<i.length;o++){if(l=(a=i[o]).instance,c=a.currentTarget,a=a.listener,l!==r&&n.isPropagationStopped())break e;Cu(n,a,c),r=l}}}if(Nl)throw e=Ml,Nl=!1,Ml=null,e}function Nu(e,t){var s=t[id];void 0===s&&(s=t[id]=new Set);var i=e+"__bubble";s.has(i)||(Du(t,e,2,!1),s.add(i))}function Mu(e,t,s){var i=0;t&&(i|=4),Du(s,e,i,t)}var Bu="_reactListening"+Math.random().toString(36).slice(2);function Lu(e){if(!e[Bu]){e[Bu]=!0,Go.forEach(function(t){"selectionchange"!==t&&(ku.has(t)||Mu(t,!1,e),Mu(t,!0,e))});var t=9===e.nodeType?e:e.ownerDocument;null===t||t[Bu]||(t[Bu]=!0,Mu("selectionchange",!1,t))}}function Du(e,t,s,i){switch(Oc(t)){case 1:var n=Rc;break;case 4:n=Ac;break;default:n=zc}s=n.bind(null,t,s,e),n=void 0,!wl||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(n=!0),i?void 0!==n?e.addEventListener(t,s,{capture:!0,passive:n}):e.addEventListener(t,s,!0):void 0!==n?e.addEventListener(t,s,{passive:n}):e.addEventListener(t,s,!1)}function Eu(e,t,s,i,n){var r=i;if(!(1&t||2&t||null===i))e:for(;;){if(null===i)return;var o=i.tag;if(3===o||4===o){var a=i.stateNode.containerInfo;if(a===n||8===a.nodeType&&a.parentNode===n)break;if(4===o)for(o=i.return;null!==o;){var l=o.tag;if((3===l||4===l)&&((l=o.stateNode.containerInfo)===n||8===l.nodeType&&l.parentNode===n))return;o=o.return}for(;null!==a;){if(null===(o=od(a)))return;if(5===(l=o.tag)||6===l){i=r=o;continue e}a=a.parentNode}}i=i.return}bl(function(){var i=r,n=hl(s),o=[];e:{var a=_u.get(e);if(void 0!==a){var l=Jc,c=e;switch(e){case"keypress":if(0===Uc(s))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===s.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=ih;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":l=mh;break;case pu:case vu:case gu:l=rh;break;case mu:l=_h;break;case"scroll":l=eh;break;case"wheel":l=bh;break;case"copy":case"cut":case"paste":l=ah;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":l=gh}var h=!!(4&t),u=!h&&"scroll"===e,d=h?null!==a?a+"Capture":null:a;h=[];for(var f,p=i;null!==p;){var v=(f=p).stateNode;if(5===f.tag&&null!==v&&(f=v,null!==d&&(null!=(v=yl(p,d))&&h.push(Pu(p,v,f)))),u)break;p=p.return}0<h.length&&(a=new l(a,c,null,s,n),o.push({event:a,listeners:h}))}}if(!(7&t)){if(l="mouseout"===e||"pointerout"===e,(!(a="mouseover"===e||"pointerover"===e)||s===cl||!(c=s.relatedTarget||s.fromElement)||!od(c)&&!c[sd])&&(l||a)&&(a=n.window===n?n:(a=n.ownerDocument)?a.defaultView||a.parentWindow:window,l?(l=i,null!==(c=(c=s.relatedTarget||s.toElement)?od(c):null)&&(c!==(u=Dl(c))||5!==c.tag&&6!==c.tag)&&(c=null)):(l=null,c=i),l!==c)){if(h=sh,v="onMouseLeave",d="onMouseEnter",p="mouse","pointerout"!==e&&"pointerover"!==e||(h=gh,v="onPointerLeave",d="onPointerEnter",p="pointer"),u=null==l?a:ld(l),f=null==c?a:ld(c),(a=new h(v,p+"leave",l,s,n)).target=u,a.relatedTarget=f,v=null,od(n)===i&&((h=new h(d,p+"enter",c,s,n)).target=f,h.relatedTarget=u,v=h),u=v,l&&c)e:{for(d=c,p=0,f=h=l;f;f=Au(f))p++;for(f=0,v=d;v;v=Au(v))f++;for(;0<p-f;)h=Au(h),p--;for(;0<f-p;)d=Au(d),f--;for(;p--;){if(h===d||null!==d&&h===d.alternate)break e;h=Au(h),d=Au(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=i?ld(i):window).nodeName&&a.nodeName.toLowerCase())||"input"===l&&"file"===a.type)var g=Ih;else if(Eh(a))if(Oh)g=Yh;else{g=Vh;var m=qh}else(l=a.nodeName)&&"input"===l.toLowerCase()&&("checkbox"===a.type||"radio"===a.type)&&(g=$h);switch(g&&(g=g(e,i))?Ph(o,g,s,n):(m&&m(e,a,i),"focusout"===e&&(m=a._wrapperState)&&m.controlled&&"number"===a.type&&Ka(a,"number",a.value)),m=i?ld(i):window,e){case"focusin":(Eh(m)||"true"===m.contentEditable)&&(nu=m,ru=i,ou=null);break;case"focusout":ou=ru=nu=null;break;case"mousedown":au=!0;break;case"contextmenu":case"mouseup":case"dragend":au=!1,lu(o,s,n);break;case"selectionchange":if(iu)break;case"keydown":case"keyup":lu(o,s,n)}var _;if(wh)e:{switch(e){case"compositionstart":var x="onCompositionStart";break e;case"compositionend":x="onCompositionEnd";break e;case"compositionupdate":x="onCompositionUpdate";break e}x=void 0}else Lh?Mh(e,s)&&(x="onCompositionEnd"):"keydown"===e&&229===s.keyCode&&(x="onCompositionStart");x&&(Ch&&"ko"!==s.locale&&(Lh||"onCompositionStart"!==x?"onCompositionEnd"===x&&Lh&&(_=Kc()):(Fc="value"in(Hc=n)?Hc.value:Hc.textContent,Lh=!0)),0<(m=Ru(i,x)).length&&(x=new lh(x,e,null,s,n),o.push({event:x,listeners:m}),_?x.data=_:null!==(_=Bh(s))&&(x.data=_))),(_=kh?function(e,t){switch(e){case"compositionend":return Bh(t);case"keypress":return 32!==t.which?null:(Nh=!0,jh);case"textInput":return(e=t.data)===jh&&Nh?null:e;default:return null}}(e,s):function(e,t){if(Lh)return"compositionend"===e||!wh&&Mh(e,t)?(e=Kc(),Wc=Fc=Hc=null,Lh=!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 Ch&&"ko"!==t.locale?null:t.data}}(e,s))&&(0<(i=Ru(i,"onBeforeInput")).length&&(n=new lh("onBeforeInput","beforeinput",null,s,n),o.push({event:n,listeners:i}),n.data=_))}ju(o,t)})}function Pu(e,t,s){return{instance:e,listener:t,currentTarget:s}}function Ru(e,t){for(var s=t+"Capture",i=[];null!==e;){var n=e,r=n.stateNode;5===n.tag&&null!==r&&(n=r,null!=(r=yl(e,s))&&i.unshift(Pu(e,r,n)),null!=(r=yl(e,t))&&i.push(Pu(e,r,n))),e=e.return}return i}function Au(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function zu(e,t,s,i,n){for(var r=t._reactName,o=[];null!==s&&s!==i;){var a=s,l=a.alternate,c=a.stateNode;if(null!==l&&l===i)break;5===a.tag&&null!==c&&(a=c,n?null!=(l=yl(s,r))&&o.unshift(Pu(s,l,a)):n||null!=(l=yl(s,r))&&o.push(Pu(s,l,a))),s=s.return}0!==o.length&&e.push({event:t,listeners:o})}var Tu=/\r\n?/g,Iu=/\u0000|\uFFFD/g;function Ou(e){return("string"==typeof e?e:""+e).replace(Tu,"\n").replace(Iu,"")}function Hu(e,t,s){if(t=Ou(t),Ou(e)!==t&&s)throw Error(Yo(425))}function Fu(){}var Wu=null,Ku=null;function Uu(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,$u="function"==typeof Promise?Promise:void 0,Yu="function"==typeof queueMicrotask?queueMicrotask:void 0!==$u?function(e){return $u.resolve(null).then(e).catch(Gu)}:qu;function Gu(e){setTimeout(function(){throw e})}function Xu(e,t){var s=t,i=0;do{var n=s.nextSibling;if(e.removeChild(s),n&&8===n.nodeType)if("/$"===(s=n.data)){if(0===i)return e.removeChild(n),void Dc(t);i--}else"$"!==s&&"$?"!==s&&"$!"!==s||i++;s=n}while(s);Dc(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 Ju(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var s=e.data;if("$"===s||"$!"===s||"$?"===s){if(0===t)return e;t--}else"/$"===s&&t++}e=e.previousSibling}return null}var Qu=Math.random().toString(36).slice(2),ed="__reactFiber$"+Qu,td="__reactProps$"+Qu,sd="__reactContainer$"+Qu,id="__reactEvents$"+Qu,nd="__reactListeners$"+Qu,rd="__reactHandles$"+Qu;function od(e){var t=e[ed];if(t)return t;for(var s=e.parentNode;s;){if(t=s[sd]||s[ed]){if(s=t.alternate,null!==t.child||null!==s&&null!==s.child)for(e=Ju(e);null!==e;){if(s=e[ed])return s;e=Ju(e)}return t}s=(e=s).parentNode}return null}function ad(e){return!(e=e[ed]||e[sd])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function ld(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(Yo(33))}function cd(e){return e[td]||null}var hd=[],ud=-1;function dd(e){return{current:e}}function fd(e){0>ud||(e.current=hd[ud],hd[ud]=null,ud--)}function pd(e,t){ud++,hd[ud]=e.current,e.current=t}var vd={},gd=dd(vd),md=dd(!1),_d=vd;function xd(e,t){var s=e.type.contextTypes;if(!s)return vd;var i=e.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===t)return i.__reactInternalMemoizedMaskedChildContext;var n,r={};for(n in s)r[n]=t[n];return i&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=r),r}function bd(e){return null!=(e=e.childContextTypes)}function yd(){fd(md),fd(gd)}function wd(e,t,s){if(gd.current!==vd)throw Error(Yo(168));pd(gd,t),pd(md,s)}function Sd(e,t,s){var i=e.stateNode;if(t=t.childContextTypes,"function"!=typeof i.getChildContext)return s;for(var n in i=i.getChildContext())if(!(n in t))throw Error(Yo(108,Ea(e)||"Unknown",n));return ja({},s,i)}function kd(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||vd,_d=gd.current,pd(gd,e),pd(md,md.current),!0}function Cd(e,t,s){var i=e.stateNode;if(!i)throw Error(Yo(169));s?(e=Sd(e,t,_d),i.__reactInternalMemoizedMergedChildContext=e,fd(md),fd(gd),pd(gd,e)):fd(md),pd(md,s)}var jd=null,Nd=!1,Md=!1;function Bd(e){null===jd?jd=[e]:jd.push(e)}function Ld(){if(!Md&&null!==jd){Md=!0;var e=0,t=lc;try{var s=jd;for(lc=1;e<s.length;e++){var i=s[e];do{i=i(!0)}while(null!==i)}jd=null,Nd=!1}catch(n){throw null!==jd&&(jd=jd.slice(e+1)),zl(Wl,Ld),n}finally{lc=t,Md=!1}}return null}var Dd=[],Ed=0,Pd=null,Rd=0,Ad=[],zd=0,Td=null,Id=1,Od="";function Hd(e,t){Dd[Ed++]=Rd,Dd[Ed++]=Pd,Pd=e,Rd=t}function Fd(e,t,s){Ad[zd++]=Id,Ad[zd++]=Od,Ad[zd++]=Td,Td=e;var i=Id;e=Od;var n=32-Gl(i)-1;i&=~(1<<n),s+=1;var r=32-Gl(t)+n;if(30<r){var o=n-n%5;r=(i&(1<<o)-1).toString(32),i>>=o,n-=o,Id=1<<32-Gl(t)+n|s<<n|i,Od=r+e}else Id=1<<r|s<<n|i,Od=e}function Wd(e){null!==e.return&&(Hd(e,1),Fd(e,1,0))}function Kd(e){for(;e===Pd;)Pd=Dd[--Ed],Dd[Ed]=null,Rd=Dd[--Ed],Dd[Ed]=null;for(;e===Td;)Td=Ad[--zd],Ad[zd]=null,Od=Ad[--zd],Ad[zd]=null,Id=Ad[--zd],Ad[zd]=null}var Ud=null,qd=null,Vd=!1,$d=null;function Yd(e,t){var s=xm(5,null,null,0);s.elementType="DELETED",s.stateNode=t,s.return=e,null===(t=e.deletions)?(e.deletions=[s],e.flags|=16):t.push(s)}function Gd(e,t){switch(e.tag){case 5:var s=e.type;return null!==(t=1!==t.nodeType||s.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,Ud=e,qd=Zu(t.firstChild),!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,Ud=e,qd=null,!0);case 13:return null!==(t=8!==t.nodeType?null:t)&&(s=null!==Td?{id:Id,overflow:Od}:null,e.memoizedState={dehydrated:t,treeContext:s,retryLane:1073741824},(s=xm(18,null,null,0)).stateNode=t,s.return=e,e.child=s,Ud=e,qd=null,!0);default:return!1}}function Xd(e){return!(!(1&e.mode)||128&e.flags)}function Zd(e){if(Vd){var t=qd;if(t){var s=t;if(!Gd(e,t)){if(Xd(e))throw Error(Yo(418));t=Zu(s.nextSibling);var i=Ud;t&&Gd(e,t)?Yd(i,s):(e.flags=-4097&e.flags|2,Vd=!1,Ud=e)}}else{if(Xd(e))throw Error(Yo(418));e.flags=-4097&e.flags|2,Vd=!1,Ud=e}}}function Jd(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;Ud=e}function Qd(e){if(e!==Ud)return!1;if(!Vd)return Jd(e),Vd=!0,!1;var t;if((t=3!==e.tag)&&!(t=5!==e.tag)&&(t="head"!==(t=e.type)&&"body"!==t&&!Uu(e.type,e.memoizedProps)),t&&(t=qd)){if(Xd(e))throw ef(),Error(Yo(418));for(;t;)Yd(e,t),t=Zu(t.nextSibling)}if(Jd(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(Yo(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var s=e.data;if("/$"===s){if(0===t){qd=Zu(e.nextSibling);break e}t--}else"$"!==s&&"$!"!==s&&"$?"!==s||t++}e=e.nextSibling}qd=null}}else qd=Ud?Zu(e.stateNode.nextSibling):null;return!0}function ef(){for(var e=qd;e;)e=Zu(e.nextSibling)}function tf(){qd=Ud=null,Vd=!1}function sf(e){null===$d?$d=[e]:$d.push(e)}var nf=ca.ReactCurrentBatchConfig;function rf(e,t,s){if(null!==(e=s.ref)&&"function"!=typeof e&&"object"!=typeof e){if(s._owner){if(s=s._owner){if(1!==s.tag)throw Error(Yo(309));var i=s.stateNode}if(!i)throw Error(Yo(147,e));var n=i,r=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===r?t.ref:((t=function(e){var t=n.refs;null===e?delete t[r]:t[r]=e})._stringRef=r,t)}if("string"!=typeof e)throw Error(Yo(284));if(!s._owner)throw Error(Yo(290,e))}return e}function of(e,t){throw e=Object.prototype.toString.call(t),Error(Yo(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function af(e){return(0,e._init)(e._payload)}function lf(e){function t(t,s){if(e){var i=t.deletions;null===i?(t.deletions=[s],t.flags|=16):i.push(s)}}function s(s,i){if(!e)return null;for(;null!==i;)t(s,i),i=i.sibling;return null}function i(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 n(e,t){return(e=ym(e,t)).index=0,e.sibling=null,e}function r(t,s,i){return t.index=i,e?null!==(i=t.alternate)?(i=i.index)<s?(t.flags|=2,s):i:(t.flags|=2,s):(t.flags|=1048576,s)}function o(t){return e&&null===t.alternate&&(t.flags|=2),t}function a(e,t,s,i){return null===t||6!==t.tag?((t=Cm(s,e.mode,i)).return=e,t):((t=n(t,s)).return=e,t)}function l(e,t,s,i){var r=s.type;return r===da?h(e,t,s.props.children,i,s.key):null!==t&&(t.elementType===r||"object"==typeof r&&null!==r&&r.$$typeof===ya&&af(r)===t.type)?((i=n(t,s.props)).ref=rf(e,t,s),i.return=e,i):((i=wm(s.type,s.key,s.props,null,e.mode,i)).ref=rf(e,t,s),i.return=e,i)}function c(e,t,s,i){return null===t||4!==t.tag||t.stateNode.containerInfo!==s.containerInfo||t.stateNode.implementation!==s.implementation?((t=jm(s,e.mode,i)).return=e,t):((t=n(t,s.children||[])).return=e,t)}function h(e,t,s,i,r){return null===t||7!==t.tag?((t=Sm(s,e.mode,i,r)).return=e,t):((t=n(t,s)).return=e,t)}function u(e,t,s){if("string"==typeof t&&""!==t||"number"==typeof t)return(t=Cm(""+t,e.mode,s)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case ha:return(s=wm(t.type,t.key,t.props,null,e.mode,s)).ref=rf(e,null,t),s.return=e,s;case ua:return(t=jm(t,e.mode,s)).return=e,t;case ya:return u(e,(0,t._init)(t._payload),s)}if(Ua(t)||ka(t))return(t=Sm(t,e.mode,s,null)).return=e,t;of(e,t)}return null}function d(e,t,s,i){var n=null!==t?t.key:null;if("string"==typeof s&&""!==s||"number"==typeof s)return null!==n?null:a(e,t,""+s,i);if("object"==typeof s&&null!==s){switch(s.$$typeof){case ha:return s.key===n?l(e,t,s,i):null;case ua:return s.key===n?c(e,t,s,i):null;case ya:return d(e,t,(n=s._init)(s._payload),i)}if(Ua(s)||ka(s))return null!==n?null:h(e,t,s,i,null);of(e,s)}return null}function f(e,t,s,i,n){if("string"==typeof i&&""!==i||"number"==typeof i)return a(t,e=e.get(s)||null,""+i,n);if("object"==typeof i&&null!==i){switch(i.$$typeof){case ha:return l(t,e=e.get(null===i.key?s:i.key)||null,i,n);case ua:return c(t,e=e.get(null===i.key?s:i.key)||null,i,n);case ya:return f(e,t,s,(0,i._init)(i._payload),n)}if(Ua(i)||ka(i))return h(t,e=e.get(s)||null,i,n,null);of(t,i)}return null}return function a(l,c,h,p){if("object"==typeof h&&null!==h&&h.type===da&&null===h.key&&(h=h.props.children),"object"==typeof h&&null!==h){switch(h.$$typeof){case ha:e:{for(var v=h.key,g=c;null!==g;){if(g.key===v){if((v=h.type)===da){if(7===g.tag){s(l,g.sibling),(c=n(g,h.props.children)).return=l,l=c;break e}}else if(g.elementType===v||"object"==typeof v&&null!==v&&v.$$typeof===ya&&af(v)===g.type){s(l,g.sibling),(c=n(g,h.props)).ref=rf(l,g,h),c.return=l,l=c;break e}s(l,g);break}t(l,g),g=g.sibling}h.type===da?((c=Sm(h.props.children,l.mode,p,h.key)).return=l,l=c):((p=wm(h.type,h.key,h.props,null,l.mode,p)).ref=rf(l,c,h),p.return=l,l=p)}return o(l);case ua:e:{for(g=h.key;null!==c;){if(c.key===g){if(4===c.tag&&c.stateNode.containerInfo===h.containerInfo&&c.stateNode.implementation===h.implementation){s(l,c.sibling),(c=n(c,h.children||[])).return=l,l=c;break e}s(l,c);break}t(l,c),c=c.sibling}(c=jm(h,l.mode,p)).return=l,l=c}return o(l);case ya:return a(l,c,(g=h._init)(h._payload),p)}if(Ua(h))return function(n,o,a,l){for(var c=null,h=null,p=o,v=o=0,g=null;null!==p&&v<a.length;v++){p.index>v?(g=p,p=null):g=p.sibling;var m=d(n,p,a[v],l);if(null===m){null===p&&(p=g);break}e&&p&&null===m.alternate&&t(n,p),o=r(m,o,v),null===h?c=m:h.sibling=m,h=m,p=g}if(v===a.length)return s(n,p),Vd&&Hd(n,v),c;if(null===p){for(;v<a.length;v++)null!==(p=u(n,a[v],l))&&(o=r(p,o,v),null===h?c=p:h.sibling=p,h=p);return Vd&&Hd(n,v),c}for(p=i(n,p);v<a.length;v++)null!==(g=f(p,n,v,a[v],l))&&(e&&null!==g.alternate&&p.delete(null===g.key?v:g.key),o=r(g,o,v),null===h?c=g:h.sibling=g,h=g);return e&&p.forEach(function(e){return t(n,e)}),Vd&&Hd(n,v),c}(l,c,h,p);if(ka(h))return function(n,o,a,l){var c=ka(a);if("function"!=typeof c)throw Error(Yo(150));if(null==(a=c.call(a)))throw Error(Yo(151));for(var h=c=null,p=o,v=o=0,g=null,m=a.next();null!==p&&!m.done;v++,m=a.next()){p.index>v?(g=p,p=null):g=p.sibling;var _=d(n,p,m.value,l);if(null===_){null===p&&(p=g);break}e&&p&&null===_.alternate&&t(n,p),o=r(_,o,v),null===h?c=_:h.sibling=_,h=_,p=g}if(m.done)return s(n,p),Vd&&Hd(n,v),c;if(null===p){for(;!m.done;v++,m=a.next())null!==(m=u(n,m.value,l))&&(o=r(m,o,v),null===h?c=m:h.sibling=m,h=m);return Vd&&Hd(n,v),c}for(p=i(n,p);!m.done;v++,m=a.next())null!==(m=f(p,n,v,m.value,l))&&(e&&null!==m.alternate&&p.delete(null===m.key?v:m.key),o=r(m,o,v),null===h?c=m:h.sibling=m,h=m);return e&&p.forEach(function(e){return t(n,e)}),Vd&&Hd(n,v),c}(l,c,h,p);of(l,h)}return"string"==typeof h&&""!==h||"number"==typeof h?(h=""+h,null!==c&&6===c.tag?(s(l,c.sibling),(c=n(c,h)).return=l,l=c):(s(l,c),(c=Cm(h,l.mode,p)).return=l,l=c),o(l)):s(l,c)}}var cf=lf(!0),hf=lf(!1),uf=dd(null),df=null,ff=null,pf=null;function vf(){pf=ff=df=null}function gf(e){var t=uf.current;fd(uf),e._currentValue=t}function mf(e,t,s){for(;null!==e;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==i&&(i.childLanes|=t)):null!==i&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===s)break;e=e.return}}function _f(e,t){df=e,pf=ff=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!==(e.lanes&t)&&(av=!0),e.firstContext=null)}function xf(e){var t=e._currentValue;if(pf!==e)if(e={context:e,memoizedValue:t,next:null},null===ff){if(null===df)throw Error(Yo(308));ff=e,df.dependencies={lanes:0,firstContext:e}}else ff=ff.next=e;return t}var bf=null;function yf(e){null===bf?bf=[e]:bf.push(e)}function wf(e,t,s,i){var n=t.interleaved;return null===n?(s.next=s,yf(t)):(s.next=n.next,n.next=s),t.interleaved=s,Sf(e,i)}function Sf(e,t){e.lanes|=t;var s=e.alternate;for(null!==s&&(s.lanes|=t),s=e,e=e.return;null!==e;)e.childLanes|=t,null!==(s=e.alternate)&&(s.childLanes|=t),s=e,e=e.return;return 3===s.tag?s.stateNode:null}var kf=!1;function Cf(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function jf(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 Nf(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Mf(e,t,s){var i=e.updateQueue;if(null===i)return null;if(i=i.shared,2&gg){var n=i.pending;return null===n?t.next=t:(t.next=n.next,n.next=t),i.pending=t,Sf(e,s)}return null===(n=i.interleaved)?(t.next=t,yf(i)):(t.next=n.next,n.next=t),i.interleaved=t,Sf(e,s)}function Bf(e,t,s){if(null!==(t=t.updateQueue)&&(t=t.shared,4194240&s)){var i=t.lanes;s|=i&=e.pendingLanes,t.lanes=s,ac(e,s)}}function Lf(e,t){var s=e.updateQueue,i=e.alternate;if(null!==i&&s===(i=i.updateQueue)){var n=null,r=null;if(null!==(s=s.firstBaseUpdate)){do{var o={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};null===r?n=r=o:r=r.next=o,s=s.next}while(null!==s);null===r?n=r=t:r=r.next=t}else n=r=t;return s={baseState:i.baseState,firstBaseUpdate:n,lastBaseUpdate:r,shared:i.shared,effects:i.effects},void(e.updateQueue=s)}null===(e=s.lastBaseUpdate)?s.firstBaseUpdate=t:e.next=t,s.lastBaseUpdate=t}function Df(e,t,s,i){var n=e.updateQueue;kf=!1;var r=n.firstBaseUpdate,o=n.lastBaseUpdate,a=n.shared.pending;if(null!==a){n.shared.pending=null;var l=a,c=l.next;l.next=null,null===o?r=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!==r){var u=n.baseState;for(o=0,h=c=l=null,a=r;;){var d=a.lane,f=a.eventTime;if((i&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,v=a;switch(d=t,f=s,v.tag){case 1:if("function"==typeof(p=v.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=v.payload)?p.call(f,u,d):p))break e;u=ja({},u,d);break e;case 2:kf=!0}}null!==a.callback&&0!==a.lane&&(e.flags|=64,null===(d=n.effects)?n.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=n.shared.pending))break;a=(d=a).next,d.next=null,n.lastBaseUpdate=d,n.shared.pending=null}}if(null===h&&(l=u),n.baseState=l,n.firstBaseUpdate=c,n.lastBaseUpdate=h,null!==(t=n.shared.interleaved)){n=t;do{o|=n.lane,n=n.next}while(n!==t)}else null===r&&(n.shared.lanes=0);kg|=o,e.lanes=o,e.memoizedState=u}}function Ef(e,t,s){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var i=e[t],n=i.callback;if(null!==n){if(i.callback=null,i=s,"function"!=typeof n)throw Error(Yo(191,n));n.call(i)}}}var Pf={},Rf=dd(Pf),Af=dd(Pf),zf=dd(Pf);function Tf(e){if(e===Pf)throw Error(Yo(174));return e}function If(e,t){switch(pd(zf,t),pd(Af,e),pd(Rf,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)}fd(Rf),pd(Rf,t)}function Of(){fd(Rf),fd(Af),fd(zf)}function Hf(e){Tf(zf.current);var t=Tf(Rf.current),s=Za(t,e.type);t!==s&&(pd(Af,e),pd(Rf,s))}function Ff(e){Af.current===e&&(fd(Rf),fd(Af))}var Wf=dd(0);function Kf(e){for(var t=e;null!==t;){if(13===t.tag){var s=t.memoizedState;if(null!==s&&(null===(s=s.dehydrated)||"$?"===s.data||"$!"===s.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 Uf=[];function qf(){for(var e=0;e<Uf.length;e++)Uf[e]._workInProgressVersionPrimary=null;Uf.length=0}var Vf=ca.ReactCurrentDispatcher,$f=ca.ReactCurrentBatchConfig,Yf=0,Gf=null,Xf=null,Zf=null,Jf=!1,Qf=!1,ep=0,tp=0;function sp(){throw Error(Yo(321))}function ip(e,t){if(null===t)return!1;for(var s=0;s<t.length&&s<e.length;s++)if(!Gh(e[s],t[s]))return!1;return!0}function np(e,t,s,i,n,r){if(Yf=r,Gf=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Vf.current=null===e||null===e.memoizedState?Fp:Wp,e=s(i,n),Qf){r=0;do{if(Qf=!1,ep=0,25<=r)throw Error(Yo(301));r+=1,Zf=Xf=null,t.updateQueue=null,Vf.current=Kp,e=s(i,n)}while(Qf)}if(Vf.current=Hp,t=null!==Xf&&null!==Xf.next,Yf=0,Zf=Xf=Gf=null,Jf=!1,t)throw Error(Yo(300));return e}function rp(){var e=0!==ep;return ep=0,e}function op(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===Zf?Gf.memoizedState=Zf=e:Zf=Zf.next=e,Zf}function ap(){if(null===Xf){var e=Gf.alternate;e=null!==e?e.memoizedState:null}else e=Xf.next;var t=null===Zf?Gf.memoizedState:Zf.next;if(null!==t)Zf=t,Xf=e;else{if(null===e)throw Error(Yo(310));e={memoizedState:(Xf=e).memoizedState,baseState:Xf.baseState,baseQueue:Xf.baseQueue,queue:Xf.queue,next:null},null===Zf?Gf.memoizedState=Zf=e:Zf=Zf.next=e}return Zf}function lp(e,t){return"function"==typeof t?t(e):t}function cp(e){var t=ap(),s=t.queue;if(null===s)throw Error(Yo(311));s.lastRenderedReducer=e;var i=Xf,n=i.baseQueue,r=s.pending;if(null!==r){if(null!==n){var o=n.next;n.next=r.next,r.next=o}i.baseQueue=n=r,s.pending=null}if(null!==n){r=n.next,i=i.baseState;var a=o=null,l=null,c=r;do{var h=c.lane;if((Yf&h)===h)null!==l&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),i=c.hasEagerState?c.eagerState:e(i,c.action);else{var u={lane:h,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};null===l?(a=l=u,o=i):l=l.next=u,Gf.lanes|=h,kg|=h}c=c.next}while(null!==c&&c!==r);null===l?o=i:l.next=a,Gh(i,t.memoizedState)||(av=!0),t.memoizedState=i,t.baseState=o,t.baseQueue=l,s.lastRenderedState=i}if(null!==(e=s.interleaved)){n=e;do{r=n.lane,Gf.lanes|=r,kg|=r,n=n.next}while(n!==e)}else null===n&&(s.lanes=0);return[t.memoizedState,s.dispatch]}function hp(e){var t=ap(),s=t.queue;if(null===s)throw Error(Yo(311));s.lastRenderedReducer=e;var i=s.dispatch,n=s.pending,r=t.memoizedState;if(null!==n){s.pending=null;var o=n=n.next;do{r=e(r,o.action),o=o.next}while(o!==n);Gh(r,t.memoizedState)||(av=!0),t.memoizedState=r,null===t.baseQueue&&(t.baseState=r),s.lastRenderedState=r}return[r,i]}function up(){}function dp(e,t){var s=Gf,i=ap(),n=t(),r=!Gh(i.memoizedState,n);if(r&&(i.memoizedState=n,av=!0),i=i.queue,kp(vp.bind(null,s,i,e),[e]),i.getSnapshot!==t||r||null!==Zf&&1&Zf.memoizedState.tag){if(s.flags|=2048,xp(9,pp.bind(null,s,i,n,t),void 0,null),null===mg)throw Error(Yo(349));30&Yf||fp(s,t,n)}return n}function fp(e,t,s){e.flags|=16384,e={getSnapshot:t,value:s},null===(t=Gf.updateQueue)?(t={lastEffect:null,stores:null},Gf.updateQueue=t,t.stores=[e]):null===(s=t.stores)?t.stores=[e]:s.push(e)}function pp(e,t,s,i){t.value=s,t.getSnapshot=i,gp(t)&&mp(e)}function vp(e,t,s){return s(function(){gp(t)&&mp(e)})}function gp(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!Gh(e,s)}catch(i){return!0}}function mp(e){var t=Sf(e,1);null!==t&&Ug(t,e,1,-1)}function _p(e){var t=op();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:lp,lastRenderedState:e},t.queue=e,e=e.dispatch=zp.bind(null,Gf,e),[t.memoizedState,e]}function xp(e,t,s,i){return e={tag:e,create:t,destroy:s,deps:i,next:null},null===(t=Gf.updateQueue)?(t={lastEffect:null,stores:null},Gf.updateQueue=t,t.lastEffect=e.next=e):null===(s=t.lastEffect)?t.lastEffect=e.next=e:(i=s.next,s.next=e,e.next=i,t.lastEffect=e),e}function bp(){return ap().memoizedState}function yp(e,t,s,i){var n=op();Gf.flags|=e,n.memoizedState=xp(1|t,s,void 0,void 0===i?null:i)}function wp(e,t,s,i){var n=ap();i=void 0===i?null:i;var r=void 0;if(null!==Xf){var o=Xf.memoizedState;if(r=o.destroy,null!==i&&ip(i,o.deps))return void(n.memoizedState=xp(t,s,r,i))}Gf.flags|=e,n.memoizedState=xp(1|t,s,r,i)}function Sp(e,t){return yp(8390656,8,e,t)}function kp(e,t){return wp(2048,8,e,t)}function Cp(e,t){return wp(4,2,e,t)}function jp(e,t){return wp(4,4,e,t)}function Np(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 Mp(e,t,s){return s=null!=s?s.concat([e]):null,wp(4,4,Np.bind(null,t,e),s)}function Bp(){}function Lp(e,t){var s=ap();t=void 0===t?null:t;var i=s.memoizedState;return null!==i&&null!==t&&ip(t,i[1])?i[0]:(s.memoizedState=[e,t],e)}function Dp(e,t){var s=ap();t=void 0===t?null:t;var i=s.memoizedState;return null!==i&&null!==t&&ip(t,i[1])?i[0]:(e=e(),s.memoizedState=[e,t],e)}function Ep(e,t,s){return 21&Yf?(Gh(s,t)||(s=nc(),Gf.lanes|=s,kg|=s,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,av=!0),e.memoizedState=s)}function Pp(e,t){var s=lc;lc=0!==s&&4>s?s:4,e(!0);var i=$f.transition;$f.transition={};try{e(!1),t()}finally{lc=s,$f.transition=i}}function Rp(){return ap().memoizedState}function Ap(e,t,s){var i=Kg(e);if(s={lane:i,action:s,hasEagerState:!1,eagerState:null,next:null},Tp(e))Ip(t,s);else if(null!==(s=wf(e,t,s,i))){Ug(s,e,i,Wg()),Op(s,t,i)}}function zp(e,t,s){var i=Kg(e),n={lane:i,action:s,hasEagerState:!1,eagerState:null,next:null};if(Tp(e))Ip(t,n);else{var r=e.alternate;if(0===e.lanes&&(null===r||0===r.lanes)&&null!==(r=t.lastRenderedReducer))try{var o=t.lastRenderedState,a=r(o,s);if(n.hasEagerState=!0,n.eagerState=a,Gh(a,o)){var l=t.interleaved;return null===l?(n.next=n,yf(t)):(n.next=l.next,l.next=n),void(t.interleaved=n)}}catch(c){}null!==(s=wf(e,t,n,i))&&(Ug(s,e,i,n=Wg()),Op(s,t,i))}}function Tp(e){var t=e.alternate;return e===Gf||null!==t&&t===Gf}function Ip(e,t){Qf=Jf=!0;var s=e.pending;null===s?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function Op(e,t,s){if(4194240&s){var i=t.lanes;s|=i&=e.pendingLanes,t.lanes=s,ac(e,s)}}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},Fp={readContext:xf,useCallback:function(e,t){return op().memoizedState=[e,void 0===t?null:t],e},useContext:xf,useEffect:Sp,useImperativeHandle:function(e,t,s){return s=null!=s?s.concat([e]):null,yp(4194308,4,Np.bind(null,t,e),s)},useLayoutEffect:function(e,t){return yp(4194308,4,e,t)},useInsertionEffect:function(e,t){return yp(4,2,e,t)},useMemo:function(e,t){var s=op();return t=void 0===t?null:t,e=e(),s.memoizedState=[e,t],e},useReducer:function(e,t,s){var i=op();return t=void 0!==s?s(t):t,i.memoizedState=i.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},i.queue=e,e=e.dispatch=Ap.bind(null,Gf,e),[i.memoizedState,e]},useRef:function(e){return e={current:e},op().memoizedState=e},useState:_p,useDebugValue:Bp,useDeferredValue:function(e){return op().memoizedState=e},useTransition:function(){var e=_p(!1),t=e[0];return e=Pp.bind(null,e[1]),op().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,s){var i=Gf,n=op();if(Vd){if(void 0===s)throw Error(Yo(407));s=s()}else{if(s=t(),null===mg)throw Error(Yo(349));30&Yf||fp(i,t,s)}n.memoizedState=s;var r={value:s,getSnapshot:t};return n.queue=r,Sp(vp.bind(null,i,r,e),[e]),i.flags|=2048,xp(9,pp.bind(null,i,r,s,t),void 0,null),s},useId:function(){var e=op(),t=mg.identifierPrefix;if(Vd){var s=Od;t=":"+t+"R"+(s=(Id&~(1<<32-Gl(Id)-1)).toString(32)+s),0<(s=ep++)&&(t+="H"+s.toString(32)),t+=":"}else t=":"+t+"r"+(s=tp++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Wp={readContext:xf,useCallback:Lp,useContext:xf,useEffect:kp,useImperativeHandle:Mp,useInsertionEffect:Cp,useLayoutEffect:jp,useMemo:Dp,useReducer:cp,useRef:bp,useState:function(){return cp(lp)},useDebugValue:Bp,useDeferredValue:function(e){return Ep(ap(),Xf.memoizedState,e)},useTransition:function(){return[cp(lp)[0],ap().memoizedState]},useMutableSource:up,useSyncExternalStore:dp,useId:Rp,unstable_isNewReconciler:!1},Kp={readContext:xf,useCallback:Lp,useContext:xf,useEffect:kp,useImperativeHandle:Mp,useInsertionEffect:Cp,useLayoutEffect:jp,useMemo:Dp,useReducer:hp,useRef:bp,useState:function(){return hp(lp)},useDebugValue:Bp,useDeferredValue:function(e){var t=ap();return null===Xf?t.memoizedState=e:Ep(t,Xf.memoizedState,e)},useTransition:function(){return[hp(lp)[0],ap().memoizedState]},useMutableSource:up,useSyncExternalStore:dp,useId:Rp,unstable_isNewReconciler:!1};function Up(e,t){if(e&&e.defaultProps){for(var s in t=ja({},t),e=e.defaultProps)void 0===t[s]&&(t[s]=e[s]);return t}return t}function qp(e,t,s,i){s=null==(s=s(i,t=e.memoizedState))?t:ja({},t,s),e.memoizedState=s,0===e.lanes&&(e.updateQueue.baseState=s)}var Vp={isMounted:function(e){return!!(e=e._reactInternals)&&Dl(e)===e},enqueueSetState:function(e,t,s){e=e._reactInternals;var i=Wg(),n=Kg(e),r=Nf(i,n);r.payload=t,null!=s&&(r.callback=s),null!==(t=Mf(e,r,n))&&(Ug(t,e,n,i),Bf(t,e,n))},enqueueReplaceState:function(e,t,s){e=e._reactInternals;var i=Wg(),n=Kg(e),r=Nf(i,n);r.tag=1,r.payload=t,null!=s&&(r.callback=s),null!==(t=Mf(e,r,n))&&(Ug(t,e,n,i),Bf(t,e,n))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var s=Wg(),i=Kg(e),n=Nf(s,i);n.tag=2,null!=t&&(n.callback=t),null!==(t=Mf(e,n,i))&&(Ug(t,e,i,s),Bf(t,e,i))}};function $p(e,t,s,i,n,r,o){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(i,r,o):!t.prototype||!t.prototype.isPureReactComponent||(!Xh(s,i)||!Xh(n,r))}function Yp(e,t,s){var i=!1,n=vd,r=t.contextType;return"object"==typeof r&&null!==r?r=xf(r):(n=bd(t)?_d:gd.current,r=(i=null!=(i=t.contextTypes))?xd(e,n):vd),t=new t(s,r),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=Vp,e.stateNode=t,t._reactInternals=e,i&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=r),t}function Gp(e,t,s,i){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(s,i),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(s,i),t.state!==e&&Vp.enqueueReplaceState(t,t.state,null)}function Xp(e,t,s,i){var n=e.stateNode;n.props=s,n.state=e.memoizedState,n.refs={},Cf(e);var r=t.contextType;"object"==typeof r&&null!==r?n.context=xf(r):(r=bd(t)?_d:gd.current,n.context=xd(e,r)),n.state=e.memoizedState,"function"==typeof(r=t.getDerivedStateFromProps)&&(qp(e,t,r,s),n.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof n.getSnapshotBeforeUpdate||"function"!=typeof n.UNSAFE_componentWillMount&&"function"!=typeof n.componentWillMount||(t=n.state,"function"==typeof n.componentWillMount&&n.componentWillMount(),"function"==typeof n.UNSAFE_componentWillMount&&n.UNSAFE_componentWillMount(),t!==n.state&&Vp.enqueueReplaceState(n,n.state,null),Df(e,s,n,i),n.state=e.memoizedState),"function"==typeof n.componentDidMount&&(e.flags|=4194308)}function Zp(e,t){try{var s="",i=t;do{s+=La(i),i=i.return}while(i);var n=s}catch(r){n="\nError generating stack: "+r.message+"\n"+r.stack}return{value:e,source:t,stack:n,digest:null}}function Jp(e,t,s){return{value:e,source:null,stack:null!=s?s:null,digest:null!=t?t:null}}function Qp(e,t){try{console.error(t.value)}catch(s){setTimeout(function(){throw s})}}var ev="function"==typeof WeakMap?WeakMap:Map;function tv(e,t,s){(s=Nf(-1,s)).tag=3,s.payload={element:null};var i=t.value;return s.callback=function(){Eg||(Eg=!0,Pg=i),Qp(0,t)},s}function sv(e,t,s){(s=Nf(-1,s)).tag=3;var i=e.type.getDerivedStateFromError;if("function"==typeof i){var n=t.value;s.payload=function(){return i(n)},s.callback=function(){Qp(0,t)}}var r=e.stateNode;return null!==r&&"function"==typeof r.componentDidCatch&&(s.callback=function(){Qp(0,t),"function"!=typeof i&&(null===Rg?Rg=new Set([this]):Rg.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),s}function iv(e,t,s){var i=e.pingCache;if(null===i){i=e.pingCache=new ev;var n=new Set;i.set(t,n)}else void 0===(n=i.get(t))&&(n=new Set,i.set(t,n));n.has(s)||(n.add(s),e=fm.bind(null,e,t,s),t.then(e,e))}function nv(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 rv(e,t,s,i,n){return 1&e.mode?(e.flags|=65536,e.lanes=n,e):(e===t?e.flags|=65536:(e.flags|=128,s.flags|=131072,s.flags&=-52805,1===s.tag&&(null===s.alternate?s.tag=17:((t=Nf(-1,1)).tag=2,Mf(s,t,1))),s.lanes|=1),e)}var ov=ca.ReactCurrentOwner,av=!1;function lv(e,t,s,i){t.child=null===e?hf(t,null,s,i):cf(t,e.child,s,i)}function cv(e,t,s,i,n){s=s.render;var r=t.ref;return _f(t,n),i=np(e,t,s,i,r,n),s=rp(),null===e||av?(Vd&&s&&Wd(t),t.flags|=1,lv(e,t,i,n),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n,Ev(e,t,n))}function hv(e,t,s,i,n){if(null===e){var r=s.type;return"function"!=typeof r||bm(r)||void 0!==r.defaultProps||null!==s.compare||void 0!==s.defaultProps?((e=wm(s.type,null,i,t,t.mode,n)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=r,uv(e,t,r,i,n))}if(r=e.child,0===(e.lanes&n)){var o=r.memoizedProps;if((s=null!==(s=s.compare)?s:Xh)(o,i)&&e.ref===t.ref)return Ev(e,t,n)}return t.flags|=1,(e=ym(r,i)).ref=t.ref,e.return=t,t.child=e}function uv(e,t,s,i,n){if(null!==e){var r=e.memoizedProps;if(Xh(r,i)&&e.ref===t.ref){if(av=!1,t.pendingProps=i=r,0===(e.lanes&n))return t.lanes=e.lanes,Ev(e,t,n);131072&e.flags&&(av=!0)}}return pv(e,t,s,i,n)}function dv(e,t,s){var i=t.pendingProps,n=i.children,r=null!==e?e.memoizedState:null;if("hidden"===i.mode)if(1&t.mode){if(!(1073741824&s))return e=null!==r?r.baseLanes|s:s,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,pd(yg,bg),bg|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},i=null!==r?r.baseLanes:s,pd(yg,bg),bg|=i}else t.memoizedState={baseLanes:0,cachePool:null,transitions:null},pd(yg,bg),bg|=s;else null!==r?(i=r.baseLanes|s,t.memoizedState=null):i=s,pd(yg,bg),bg|=i;return lv(e,t,n,s),t.child}function fv(e,t){var s=t.ref;(null===e&&null!==s||null!==e&&e.ref!==s)&&(t.flags|=512,t.flags|=2097152)}function pv(e,t,s,i,n){var r=bd(s)?_d:gd.current;return r=xd(t,r),_f(t,n),s=np(e,t,s,i,r,n),i=rp(),null===e||av?(Vd&&i&&Wd(t),t.flags|=1,lv(e,t,s,n),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n,Ev(e,t,n))}function vv(e,t,s,i,n){if(bd(s)){var r=!0;kd(t)}else r=!1;if(_f(t,n),null===t.stateNode)Dv(e,t),Yp(t,s,i),Xp(t,s,i,n),i=!0;else if(null===e){var o=t.stateNode,a=t.memoizedProps;o.props=a;var l=o.context,c=s.contextType;"object"==typeof c&&null!==c?c=xf(c):c=xd(t,c=bd(s)?_d:gd.current);var h=s.getDerivedStateFromProps,u="function"==typeof h||"function"==typeof o.getSnapshotBeforeUpdate;u||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(a!==i||l!==c)&&Gp(t,o,i,c),kf=!1;var d=t.memoizedState;o.state=d,Df(t,i,o,n),l=t.memoizedState,a!==i||d!==l||md.current||kf?("function"==typeof h&&(qp(t,s,h,i),l=t.memoizedState),(a=kf||$p(t,s,a,i,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=i,t.memoizedState=l),o.props=i,o.state=l,o.context=c,i=a):("function"==typeof o.componentDidMount&&(t.flags|=4194308),i=!1)}else{o=t.stateNode,jf(e,t),a=t.memoizedProps,c=t.type===t.elementType?a:Up(t.type,a),o.props=c,u=t.pendingProps,d=o.context,"object"==typeof(l=s.contextType)&&null!==l?l=xf(l):l=xd(t,l=bd(s)?_d:gd.current);var f=s.getDerivedStateFromProps;(h="function"==typeof f||"function"==typeof o.getSnapshotBeforeUpdate)||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(a!==u||d!==l)&&Gp(t,o,i,l),kf=!1,d=t.memoizedState,o.state=d,Df(t,i,o,n);var p=t.memoizedState;a!==u||d!==p||md.current||kf?("function"==typeof f&&(qp(t,s,f,i),p=t.memoizedState),(c=kf||$p(t,s,c,i,d,p,l)||!1)?(h||"function"!=typeof o.UNSAFE_componentWillUpdate&&"function"!=typeof o.componentWillUpdate||("function"==typeof o.componentWillUpdate&&o.componentWillUpdate(i,p,l),"function"==typeof o.UNSAFE_componentWillUpdate&&o.UNSAFE_componentWillUpdate(i,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=i,t.memoizedState=p),o.props=i,o.state=p,o.context=l,i=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),i=!1)}return gv(e,t,s,i,r,n)}function gv(e,t,s,i,n,r){fv(e,t);var o=!!(128&t.flags);if(!i&&!o)return n&&Cd(t,s,!1),Ev(e,t,r);i=t.stateNode,ov.current=t;var a=o&&"function"!=typeof s.getDerivedStateFromError?null:i.render();return t.flags|=1,null!==e&&o?(t.child=cf(t,e.child,null,r),t.child=cf(t,null,a,r)):lv(e,t,a,r),t.memoizedState=i.state,n&&Cd(t,s,!0),t.child}function mv(e){var t=e.stateNode;t.pendingContext?wd(0,t.pendingContext,t.pendingContext!==t.context):t.context&&wd(0,t.context,!1),If(e,t.containerInfo)}function _v(e,t,s,i,n){return tf(),sf(n),t.flags|=256,lv(e,t,s,i),t.child}var xv,bv,yv,wv,Sv={dehydrated:null,treeContext:null,retryLane:0};function kv(e){return{baseLanes:e,cachePool:null,transitions:null}}function Cv(e,t,s){var i,n=t.pendingProps,r=Wf.current,o=!1,a=!!(128&t.flags);if((i=a)||(i=(null===e||null!==e.memoizedState)&&!!(2&r)),i?(o=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(r|=1),pd(Wf,1&r),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=n.children,e=n.fallback,o?(n=t.mode,o=t.child,a={mode:"hidden",children:a},1&n||null===o?o=km(a,n,0,null):(o.childLanes=0,o.pendingProps=a),e=Sm(e,n,s,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=kv(s),t.memoizedState=Sv,e):jv(t,a));if(null!==(r=e.memoizedState)&&null!==(i=r.dehydrated))return function(e,t,s,i,n,r,o){if(s)return 256&t.flags?(t.flags&=-257,Nv(e,t,o,i=Jp(Error(Yo(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(r=i.fallback,n=t.mode,i=km({mode:"visible",children:i.children},n,0,null),(r=Sm(r,n,o,null)).flags|=2,i.return=t,r.return=t,i.sibling=r,t.child=i,1&t.mode&&cf(t,e.child,null,o),t.child.memoizedState=kv(o),t.memoizedState=Sv,r);if(!(1&t.mode))return Nv(e,t,o,null);if("$!"===n.data){if(i=n.nextSibling&&n.nextSibling.dataset)var a=i.dgst;return i=a,Nv(e,t,o,i=Jp(r=Error(Yo(419)),i,void 0))}if(a=0!==(o&e.childLanes),av||a){if(null!==(i=mg)){switch(o&-o){case 4:n=2;break;case 16:n=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:n=32;break;case 536870912:n=268435456;break;default:n=0}0!==(n=0!==(n&(i.suspendedLanes|o))?0:n)&&n!==r.retryLane&&(r.retryLane=n,Sf(e,n),Ug(i,e,n,-1))}return im(),Nv(e,t,o,i=Jp(Error(Yo(421))))}return"$?"===n.data?(t.flags|=128,t.child=e.child,t=vm.bind(null,e),n._reactRetry=t,null):(e=r.treeContext,qd=Zu(n.nextSibling),Ud=t,Vd=!0,$d=null,null!==e&&(Ad[zd++]=Id,Ad[zd++]=Od,Ad[zd++]=Td,Id=e.id,Od=e.overflow,Td=t),t=jv(t,i.children),t.flags|=4096,t)}(e,t,a,n,i,r,s);if(o){o=n.fallback,a=t.mode,i=(r=e.child).sibling;var l={mode:"hidden",children:n.children};return 1&a||t.child===r?(n=ym(r,l)).subtreeFlags=14680064&r.subtreeFlags:((n=t.child).childLanes=0,n.pendingProps=l,t.deletions=null),null!==i?o=ym(i,o):(o=Sm(o,a,s,null)).flags|=2,o.return=t,n.return=t,n.sibling=o,t.child=n,n=o,o=t.child,a=null===(a=e.child.memoizedState)?kv(s):{baseLanes:a.baseLanes|s,cachePool:null,transitions:a.transitions},o.memoizedState=a,o.childLanes=e.childLanes&~s,t.memoizedState=Sv,n}return e=(o=e.child).sibling,n=ym(o,{mode:"visible",children:n.children}),!(1&t.mode)&&(n.lanes=s),n.return=t,n.sibling=null,null!==e&&(null===(s=t.deletions)?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n}function jv(e,t){return(t=km({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function Nv(e,t,s,i){return null!==i&&sf(i),cf(t,e.child,null,s),(e=jv(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function Mv(e,t,s){e.lanes|=t;var i=e.alternate;null!==i&&(i.lanes|=t),mf(e.return,t,s)}function Bv(e,t,s,i,n){var r=e.memoizedState;null===r?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:s,tailMode:n}:(r.isBackwards=t,r.rendering=null,r.renderingStartTime=0,r.last=i,r.tail=s,r.tailMode=n)}function Lv(e,t,s){var i=t.pendingProps,n=i.revealOrder,r=i.tail;if(lv(e,t,i.children,s),2&(i=Wf.current))i=1&i|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&&Mv(e,s,t);else if(19===e.tag)Mv(e,s,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}i&=1}if(pd(Wf,i),1&t.mode)switch(n){case"forwards":for(s=t.child,n=null;null!==s;)null!==(e=s.alternate)&&null===Kf(e)&&(n=s),s=s.sibling;null===(s=n)?(n=t.child,t.child=null):(n=s.sibling,s.sibling=null),Bv(t,!1,n,s,r);break;case"backwards":for(s=null,n=t.child,t.child=null;null!==n;){if(null!==(e=n.alternate)&&null===Kf(e)){t.child=n;break}e=n.sibling,n.sibling=s,s=n,n=e}Bv(t,!0,s,null,r);break;case"together":Bv(t,!1,null,null,void 0);break;default:t.memoizedState=null}else t.memoizedState=null;return t.child}function Dv(e,t){!(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Ev(e,t,s){if(null!==e&&(t.dependencies=e.dependencies),kg|=t.lanes,0===(s&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(Yo(153));if(null!==t.child){for(s=ym(e=t.child,e.pendingProps),t.child=s,s.return=t;null!==e.sibling;)e=e.sibling,(s=s.sibling=ym(e,e.pendingProps)).return=t;s.sibling=null}return t.child}function Pv(e,t){if(!Vd)switch(e.tailMode){case"hidden":t=e.tail;for(var s=null;null!==t;)null!==t.alternate&&(s=t),t=t.sibling;null===s?e.tail=null:s.sibling=null;break;case"collapsed":s=e.tail;for(var i=null;null!==s;)null!==s.alternate&&(i=s),s=s.sibling;null===i?t||null===e.tail?e.tail=null:e.tail.sibling=null:i.sibling=null}}function Rv(e){var t=null!==e.alternate&&e.alternate.child===e.child,s=0,i=0;if(t)for(var n=e.child;null!==n;)s|=n.lanes|n.childLanes,i|=14680064&n.subtreeFlags,i|=14680064&n.flags,n.return=e,n=n.sibling;else for(n=e.child;null!==n;)s|=n.lanes|n.childLanes,i|=n.subtreeFlags,i|=n.flags,n.return=e,n=n.sibling;return e.subtreeFlags|=i,e.childLanes=s,t}function Av(e,t,s){var i=t.pendingProps;switch(Kd(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Rv(t),null;case 1:case 17:return bd(t.type)&&yd(),Rv(t),null;case 3:return i=t.stateNode,Of(),fd(md),fd(gd),qf(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),null!==e&&null!==e.child||(Qd(t)?t.flags|=4:null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,null!==$d&&(Yg($d),$d=null))),bv(e,t),Rv(t),null;case 5:Ff(t);var n=Tf(zf.current);if(s=t.type,null!==e&&null!=t.stateNode)yv(e,t,s,i,n),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(null===t.stateNode)throw Error(Yo(166));return Rv(t),null}if(e=Tf(Rf.current),Qd(t)){i=t.stateNode,s=t.type;var r=t.memoizedProps;switch(i[ed]=t,i[td]=r,e=!!(1&t.mode),s){case"dialog":Nu("cancel",i),Nu("close",i);break;case"iframe":case"object":case"embed":Nu("load",i);break;case"video":case"audio":for(n=0;n<Su.length;n++)Nu(Su[n],i);break;case"source":Nu("error",i);break;case"img":case"image":case"link":Nu("error",i),Nu("load",i);break;case"details":Nu("toggle",i);break;case"input":Oa(i,r),Nu("invalid",i);break;case"select":i._wrapperState={wasMultiple:!!r.multiple},Nu("invalid",i);break;case"textarea":$a(i,r),Nu("invalid",i)}for(var o in al(s,r),n=null,r)if(r.hasOwnProperty(o)){var a=r[o];"children"===o?"string"==typeof a?i.textContent!==a&&(!0!==r.suppressHydrationWarning&&Hu(i.textContent,a,e),n=["children",a]):"number"==typeof a&&i.textContent!==""+a&&(!0!==r.suppressHydrationWarning&&Hu(i.textContent,a,e),n=["children",""+a]):Xo.hasOwnProperty(o)&&null!=a&&"onScroll"===o&&Nu("scroll",i)}switch(s){case"input":Aa(i),Wa(i,r,!0);break;case"textarea":Aa(i),Ga(i);break;case"select":case"option":break;default:"function"==typeof r.onClick&&(i.onclick=Fu)}i=n,t.updateQueue=i,null!==i&&(t.flags|=4)}else{o=9===n.nodeType?n:n.ownerDocument,"http://www.w3.org/1999/xhtml"===e&&(e=Xa(s)),"http://www.w3.org/1999/xhtml"===e?"script"===s?((e=o.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"==typeof i.is?e=o.createElement(s,{is:i.is}):(e=o.createElement(s),"select"===s&&(o=e,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):e=o.createElementNS(e,s),e[ed]=t,e[td]=i,xv(e,t,!1,!1),t.stateNode=e;e:{switch(o=ll(s,i),s){case"dialog":Nu("cancel",e),Nu("close",e),n=i;break;case"iframe":case"object":case"embed":Nu("load",e),n=i;break;case"video":case"audio":for(n=0;n<Su.length;n++)Nu(Su[n],e);n=i;break;case"source":Nu("error",e),n=i;break;case"img":case"image":case"link":Nu("error",e),Nu("load",e),n=i;break;case"details":Nu("toggle",e),n=i;break;case"input":Oa(e,i),n=Ia(e,i),Nu("invalid",e);break;case"option":default:n=i;break;case"select":e._wrapperState={wasMultiple:!!i.multiple},n=ja({},i,{value:void 0}),Nu("invalid",e);break;case"textarea":$a(e,i),n=Va(e,i),Nu("invalid",e)}for(r in al(s,n),a=n)if(a.hasOwnProperty(r)){var l=a[r];"style"===r?rl(e,l):"dangerouslySetInnerHTML"===r?null!=(l=l?l.__html:void 0)&&el(e,l):"children"===r?"string"==typeof l?("textarea"!==s||""!==l)&&tl(e,l):"number"==typeof l&&tl(e,""+l):"suppressContentEditableWarning"!==r&&"suppressHydrationWarning"!==r&&"autoFocus"!==r&&(Xo.hasOwnProperty(r)?null!=l&&"onScroll"===r&&Nu("scroll",e):null!=l&&la(e,r,l,o))}switch(s){case"input":Aa(e),Wa(e,i,!1);break;case"textarea":Aa(e),Ga(e);break;case"option":null!=i.value&&e.setAttribute("value",""+Pa(i.value));break;case"select":e.multiple=!!i.multiple,null!=(r=i.value)?qa(e,!!i.multiple,r,!1):null!=i.defaultValue&&qa(e,!!i.multiple,i.defaultValue,!0);break;default:"function"==typeof n.onClick&&(e.onclick=Fu)}switch(s){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}}i&&(t.flags|=4)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return Rv(t),null;case 6:if(e&&null!=t.stateNode)wv(e,t,e.memoizedProps,i);else{if("string"!=typeof i&&null===t.stateNode)throw Error(Yo(166));if(s=Tf(zf.current),Tf(Rf.current),Qd(t)){if(i=t.stateNode,s=t.memoizedProps,i[ed]=t,(r=i.nodeValue!==s)&&null!==(e=Ud))switch(e.tag){case 3:Hu(i.nodeValue,s,!!(1&e.mode));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&Hu(i.nodeValue,s,!!(1&e.mode))}r&&(t.flags|=4)}else(i=(9===s.nodeType?s:s.ownerDocument).createTextNode(i))[ed]=t,t.stateNode=i}return Rv(t),null;case 13:if(fd(Wf),i=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(Vd&&null!==qd&&1&t.mode&&!(128&t.flags))ef(),tf(),t.flags|=98560,r=!1;else if(r=Qd(t),null!==i&&null!==i.dehydrated){if(null===e){if(!r)throw Error(Yo(318));if(!(r=null!==(r=t.memoizedState)?r.dehydrated:null))throw Error(Yo(317));r[ed]=t}else tf(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;Rv(t),r=!1}else null!==$d&&(Yg($d),$d=null),r=!0;if(!r)return 65536&t.flags?t:null}return 128&t.flags?(t.lanes=s,t):((i=null!==i)!==(null!==e&&null!==e.memoizedState)&&i&&(t.child.flags|=8192,1&t.mode&&(null===e||1&Wf.current?0===wg&&(wg=3):im())),null!==t.updateQueue&&(t.flags|=4),Rv(t),null);case 4:return Of(),bv(e,t),null===e&&Lu(t.stateNode.containerInfo),Rv(t),null;case 10:return gf(t.type._context),Rv(t),null;case 19:if(fd(Wf),null===(r=t.memoizedState))return Rv(t),null;if(i=!!(128&t.flags),null===(o=r.rendering))if(i)Pv(r,!1);else{if(0!==wg||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(o=Kf(e))){for(t.flags|=128,Pv(r,!1),null!==(i=o.updateQueue)&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=s,s=t.child;null!==s;)e=i,(r=s).flags&=14680066,null===(o=r.alternate)?(r.childLanes=0,r.lanes=e,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=o.childLanes,r.lanes=o.lanes,r.child=o.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=o.memoizedProps,r.memoizedState=o.memoizedState,r.updateQueue=o.updateQueue,r.type=o.type,e=o.dependencies,r.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),s=s.sibling;return pd(Wf,1&Wf.current|2),t.child}e=e.sibling}null!==r.tail&&Hl()>Lg&&(t.flags|=128,i=!0,Pv(r,!1),t.lanes=4194304)}else{if(!i)if(null!==(e=Kf(o))){if(t.flags|=128,i=!0,null!==(s=e.updateQueue)&&(t.updateQueue=s,t.flags|=4),Pv(r,!0),null===r.tail&&"hidden"===r.tailMode&&!o.alternate&&!Vd)return Rv(t),null}else 2*Hl()-r.renderingStartTime>Lg&&1073741824!==s&&(t.flags|=128,i=!0,Pv(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(null!==(s=r.last)?s.sibling=o:t.child=o,r.last=o)}return null!==r.tail?(t=r.tail,r.rendering=t,r.tail=t.sibling,r.renderingStartTime=Hl(),t.sibling=null,s=Wf.current,pd(Wf,i?1&s|2:1&s),t):(Rv(t),null);case 22:case 23:return Qg(),i=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==i&&(t.flags|=8192),i&&1&t.mode?!!(1073741824&bg)&&(Rv(t),6&t.subtreeFlags&&(t.flags|=8192)):Rv(t),null;case 24:case 25:return null}throw Error(Yo(156,t.tag))}function zv(e,t){switch(Kd(t),t.tag){case 1:return bd(t.type)&&yd(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return Of(),fd(md),fd(gd),qf(),65536&(e=t.flags)&&!(128&e)?(t.flags=-65537&e|128,t):null;case 5:return Ff(t),null;case 13:if(fd(Wf),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(Yo(340));tf()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return fd(Wf),null;case 4:return Of(),null;case 10:return gf(t.type._context),null;case 22:case 23:return Qg(),null;default:return null}}xv=function(e,t){for(var s=t.child;null!==s;){if(5===s.tag||6===s.tag)e.appendChild(s.stateNode);else if(4!==s.tag&&null!==s.child){s.child.return=s,s=s.child;continue}if(s===t)break;for(;null===s.sibling;){if(null===s.return||s.return===t)return;s=s.return}s.sibling.return=s.return,s=s.sibling}},bv=function(){},yv=function(e,t,s,i){var n=e.memoizedProps;if(n!==i){e=t.stateNode,Tf(Rf.current);var r,o=null;switch(s){case"input":n=Ia(e,n),i=Ia(e,i),o=[];break;case"select":n=ja({},n,{value:void 0}),i=ja({},i,{value:void 0}),o=[];break;case"textarea":n=Va(e,n),i=Va(e,i),o=[];break;default:"function"!=typeof n.onClick&&"function"==typeof i.onClick&&(e.onclick=Fu)}for(c in al(s,i),s=null,n)if(!i.hasOwnProperty(c)&&n.hasOwnProperty(c)&&null!=n[c])if("style"===c){var a=n[c];for(r in a)a.hasOwnProperty(r)&&(s||(s={}),s[r]="")}else"dangerouslySetInnerHTML"!==c&&"children"!==c&&"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&"autoFocus"!==c&&(Xo.hasOwnProperty(c)?o||(o=[]):(o=o||[]).push(c,null));for(c in i){var l=i[c];if(a=null!=n?n[c]:void 0,i.hasOwnProperty(c)&&l!==a&&(null!=l||null!=a))if("style"===c)if(a){for(r in a)!a.hasOwnProperty(r)||l&&l.hasOwnProperty(r)||(s||(s={}),s[r]="");for(r in l)l.hasOwnProperty(r)&&a[r]!==l[r]&&(s||(s={}),s[r]=l[r])}else s||(o||(o=[]),o.push(c,s)),s=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&&(Xo.hasOwnProperty(c)?(null!=l&&"onScroll"===c&&Nu("scroll",e),o||a===l||(o=[])):(o=o||[]).push(c,l))}s&&(o=o||[]).push("style",s);var c=o;(t.updateQueue=c)&&(t.flags|=4)}},wv=function(e,t,s,i){s!==i&&(t.flags|=4)};var Tv=!1,Iv=!1,Ov="function"==typeof WeakSet?WeakSet:Set,Hv=null;function Fv(e,t){var s=e.ref;if(null!==s)if("function"==typeof s)try{s(null)}catch(i){dm(e,t,i)}else s.current=null}function Wv(e,t,s){try{s()}catch(i){dm(e,t,i)}}var Kv=!1;function Uv(e,t,s){var i=t.updateQueue;if(null!==(i=null!==i?i.lastEffect:null)){var n=i=i.next;do{if((n.tag&e)===e){var r=n.destroy;n.destroy=void 0,void 0!==r&&Wv(t,s,r)}n=n.next}while(n!==i)}}function qv(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var s=t=t.next;do{if((s.tag&e)===e){var i=s.create;s.destroy=i()}s=s.next}while(s!==t)}}function Vv(e){var t=e.ref;if(null!==t){var s=e.stateNode;e.tag,e=s,"function"==typeof t?t(e):t.current=e}}function $v(e){var t=e.alternate;null!==t&&(e.alternate=null,$v(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&(delete t[ed],delete t[td],delete t[id],delete t[nd],delete t[rd])),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 Yv(e){return 5===e.tag||3===e.tag||4===e.tag}function Gv(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||Yv(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 Xv(e,t,s){var i=e.tag;if(5===i||6===i)e=e.stateNode,t?8===s.nodeType?s.parentNode.insertBefore(e,t):s.insertBefore(e,t):(8===s.nodeType?(t=s.parentNode).insertBefore(e,s):(t=s).appendChild(e),null!=(s=s._reactRootContainer)||null!==t.onclick||(t.onclick=Fu));else if(4!==i&&null!==(e=e.child))for(Xv(e,t,s),e=e.sibling;null!==e;)Xv(e,t,s),e=e.sibling}function Zv(e,t,s){var i=e.tag;if(5===i||6===i)e=e.stateNode,t?s.insertBefore(e,t):s.appendChild(e);else if(4!==i&&null!==(e=e.child))for(Zv(e,t,s),e=e.sibling;null!==e;)Zv(e,t,s),e=e.sibling}var Jv=null,Qv=!1;function eg(e,t,s){for(s=s.child;null!==s;)tg(e,t,s),s=s.sibling}function tg(e,t,s){if(Yl&&"function"==typeof Yl.onCommitFiberUnmount)try{Yl.onCommitFiberUnmount($l,s)}catch(a){}switch(s.tag){case 5:Iv||Fv(s,t);case 6:var i=Jv,n=Qv;Jv=null,eg(e,t,s),Qv=n,null!==(Jv=i)&&(Qv?(e=Jv,s=s.stateNode,8===e.nodeType?e.parentNode.removeChild(s):e.removeChild(s)):Jv.removeChild(s.stateNode));break;case 18:null!==Jv&&(Qv?(e=Jv,s=s.stateNode,8===e.nodeType?Xu(e.parentNode,s):1===e.nodeType&&Xu(e,s),Dc(e)):Xu(Jv,s.stateNode));break;case 4:i=Jv,n=Qv,Jv=s.stateNode.containerInfo,Qv=!0,eg(e,t,s),Jv=i,Qv=n;break;case 0:case 11:case 14:case 15:if(!Iv&&(null!==(i=s.updateQueue)&&null!==(i=i.lastEffect))){n=i=i.next;do{var r=n,o=r.destroy;r=r.tag,void 0!==o&&(2&r||4&r)&&Wv(s,t,o),n=n.next}while(n!==i)}eg(e,t,s);break;case 1:if(!Iv&&(Fv(s,t),"function"==typeof(i=s.stateNode).componentWillUnmount))try{i.props=s.memoizedProps,i.state=s.memoizedState,i.componentWillUnmount()}catch(a){dm(s,t,a)}eg(e,t,s);break;case 21:eg(e,t,s);break;case 22:1&s.mode?(Iv=(i=Iv)||null!==s.memoizedState,eg(e,t,s),Iv=i):eg(e,t,s);break;default:eg(e,t,s)}}function sg(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var s=e.stateNode;null===s&&(s=e.stateNode=new Ov),t.forEach(function(t){var i=gm.bind(null,e,t);s.has(t)||(s.add(t),t.then(i,i))})}}function ig(e,t){var s=t.deletions;if(null!==s)for(var i=0;i<s.length;i++){var n=s[i];try{var r=e,o=t,a=o;e:for(;null!==a;){switch(a.tag){case 5:Jv=a.stateNode,Qv=!1;break e;case 3:case 4:Jv=a.stateNode.containerInfo,Qv=!0;break e}a=a.return}if(null===Jv)throw Error(Yo(160));tg(r,o,n),Jv=null,Qv=!1;var l=n.alternate;null!==l&&(l.return=null),n.return=null}catch(c){dm(n,t,c)}}if(12854&t.subtreeFlags)for(t=t.child;null!==t;)ng(t,e),t=t.sibling}function ng(e,t){var s=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(ig(t,e),rg(e),4&i){try{Uv(3,e,e.return),qv(3,e)}catch(FS){dm(e,e.return,FS)}try{Uv(5,e,e.return)}catch(FS){dm(e,e.return,FS)}}break;case 1:ig(t,e),rg(e),512&i&&null!==s&&Fv(s,s.return);break;case 5:if(ig(t,e),rg(e),512&i&&null!==s&&Fv(s,s.return),32&e.flags){var n=e.stateNode;try{tl(n,"")}catch(FS){dm(e,e.return,FS)}}if(4&i&&null!=(n=e.stateNode)){var r=e.memoizedProps,o=null!==s?s.memoizedProps:r,a=e.type,l=e.updateQueue;if(e.updateQueue=null,null!==l)try{"input"===a&&"radio"===r.type&&null!=r.name&&Ha(n,r),ll(a,o);var c=ll(a,r);for(o=0;o<l.length;o+=2){var h=l[o],u=l[o+1];"style"===h?rl(n,u):"dangerouslySetInnerHTML"===h?el(n,u):"children"===h?tl(n,u):la(n,h,u,c)}switch(a){case"input":Fa(n,r);break;case"textarea":Ya(n,r);break;case"select":var d=n._wrapperState.wasMultiple;n._wrapperState.wasMultiple=!!r.multiple;var f=r.value;null!=f?qa(n,!!r.multiple,f,!1):d!==!!r.multiple&&(null!=r.defaultValue?qa(n,!!r.multiple,r.defaultValue,!0):qa(n,!!r.multiple,r.multiple?[]:"",!1))}n[td]=r}catch(FS){dm(e,e.return,FS)}}break;case 6:if(ig(t,e),rg(e),4&i){if(null===e.stateNode)throw Error(Yo(162));n=e.stateNode,r=e.memoizedProps;try{n.nodeValue=r}catch(FS){dm(e,e.return,FS)}}break;case 3:if(ig(t,e),rg(e),4&i&&null!==s&&s.memoizedState.isDehydrated)try{Dc(t.containerInfo)}catch(FS){dm(e,e.return,FS)}break;case 4:default:ig(t,e),rg(e);break;case 13:ig(t,e),rg(e),8192&(n=e.child).flags&&(r=null!==n.memoizedState,n.stateNode.isHidden=r,!r||null!==n.alternate&&null!==n.alternate.memoizedState||(Bg=Hl())),4&i&&sg(e);break;case 22:if(h=null!==s&&null!==s.memoizedState,1&e.mode?(Iv=(c=Iv)||h,ig(t,e),Iv=c):ig(t,e),rg(e),8192&i){if(c=null!==e.memoizedState,(e.stateNode.isHidden=c)&&!h&&1&e.mode)for(Hv=e,h=e.child;null!==h;){for(u=Hv=h;null!==Hv;){switch(f=(d=Hv).child,d.tag){case 0:case 11:case 14:case 15:Uv(4,d,d.return);break;case 1:Fv(d,d.return);var p=d.stateNode;if("function"==typeof p.componentWillUnmount){i=d,s=d.return;try{t=i,p.props=t.memoizedProps,p.state=t.memoizedState,p.componentWillUnmount()}catch(FS){dm(i,s,FS)}}break;case 5:Fv(d,d.return);break;case 22:if(null!==d.memoizedState){cg(u);continue}}null!==f?(f.return=d,Hv=f):cg(u)}h=h.sibling}e:for(h=null,u=e;;){if(5===u.tag){if(null===h){h=u;try{n=u.stateNode,c?"function"==typeof(r=n.style).setProperty?r.setProperty("display","none","important"):r.display="none":(a=u.stateNode,o=null!=(l=u.memoizedProps.style)&&l.hasOwnProperty("display")?l.display:null,a.style.display=nl("display",o))}catch(FS){dm(e,e.return,FS)}}}else if(6===u.tag){if(null===h)try{u.stateNode.nodeValue=c?"":u.memoizedProps}catch(FS){dm(e,e.return,FS)}}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:ig(t,e),rg(e),4&i&&sg(e);case 21:}}function rg(e){var t=e.flags;if(2&t){try{e:{for(var s=e.return;null!==s;){if(Yv(s)){var i=s;break e}s=s.return}throw Error(Yo(160))}switch(i.tag){case 5:var n=i.stateNode;32&i.flags&&(tl(n,""),i.flags&=-33),Zv(e,Gv(e),n);break;case 3:case 4:var r=i.stateNode.containerInfo;Xv(e,Gv(e),r);break;default:throw Error(Yo(161))}}catch(o){dm(e,e.return,o)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function og(e,t,s){Hv=e,ag(e)}function ag(e,t,s){for(var i=!!(1&e.mode);null!==Hv;){var n=Hv,r=n.child;if(22===n.tag&&i){var o=null!==n.memoizedState||Tv;if(!o){var a=n.alternate,l=null!==a&&null!==a.memoizedState||Iv;a=Tv;var c=Iv;if(Tv=o,(Iv=l)&&!c)for(Hv=n;null!==Hv;)l=(o=Hv).child,22===o.tag&&null!==o.memoizedState?hg(n):null!==l?(l.return=o,Hv=l):hg(n);for(;null!==r;)Hv=r,ag(r),r=r.sibling;Hv=n,Tv=a,Iv=c}lg(e)}else 8772&n.subtreeFlags&&null!==r?(r.return=n,Hv=r):lg(e)}}function lg(e){for(;null!==Hv;){var t=Hv;if(8772&t.flags){var s=t.alternate;try{if(8772&t.flags)switch(t.tag){case 0:case 11:case 15:Iv||qv(5,t);break;case 1:var i=t.stateNode;if(4&t.flags&&!Iv)if(null===s)i.componentDidMount();else{var n=t.elementType===t.type?s.memoizedProps:Up(t.type,s.memoizedProps);i.componentDidUpdate(n,s.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var r=t.updateQueue;null!==r&&Ef(t,r,i);break;case 3:var o=t.updateQueue;if(null!==o){if(s=null,null!==t.child)switch(t.child.tag){case 5:case 1:s=t.child.stateNode}Ef(t,o,s)}break;case 5:var a=t.stateNode;if(null===s&&4&t.flags){s=a;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&s.focus();break;case"img":l.src&&(s.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&&Dc(u)}}}break;default:throw Error(Yo(163))}Iv||512&t.flags&&Vv(t)}catch(hS){dm(t,t.return,hS)}}if(t===e){Hv=null;break}if(null!==(s=t.sibling)){s.return=t.return,Hv=s;break}Hv=t.return}}function cg(e){for(;null!==Hv;){var t=Hv;if(t===e){Hv=null;break}var s=t.sibling;if(null!==s){s.return=t.return,Hv=s;break}Hv=t.return}}function hg(e){for(;null!==Hv;){var t=Hv;try{switch(t.tag){case 0:case 11:case 15:var s=t.return;try{qv(4,t)}catch(l){dm(t,s,l)}break;case 1:var i=t.stateNode;if("function"==typeof i.componentDidMount){var n=t.return;try{i.componentDidMount()}catch(l){dm(t,n,l)}}var r=t.return;try{Vv(t)}catch(l){dm(t,r,l)}break;case 5:var o=t.return;try{Vv(t)}catch(l){dm(t,o,l)}}}catch(l){dm(t,t.return,l)}if(t===e){Hv=null;break}var a=t.sibling;if(null!==a){a.return=t.return,Hv=a;break}Hv=t.return}}var ug,dg=Math.ceil,fg=ca.ReactCurrentDispatcher,pg=ca.ReactCurrentOwner,vg=ca.ReactCurrentBatchConfig,gg=0,mg=null,_g=null,xg=0,bg=0,yg=dd(0),wg=0,Sg=null,kg=0,Cg=0,jg=0,Ng=null,Mg=null,Bg=0,Lg=1/0,Dg=null,Eg=!1,Pg=null,Rg=null,Ag=!1,zg=null,Tg=0,Ig=0,Og=null,Hg=-1,Fg=0;function Wg(){return 6&gg?Hl():-1!==Hg?Hg:Hg=Hl()}function Kg(e){return 1&e.mode?2&gg&&0!==xg?xg&-xg:null!==nf.transition?(0===Fg&&(Fg=nc()),Fg):0!==(e=lc)?e:e=void 0===(e=window.event)?16:Oc(e.type):1}function Ug(e,t,s,i){if(50<Ig)throw Ig=0,Og=null,Error(Yo(185));oc(e,s,i),2&gg&&e===mg||(e===mg&&(!(2&gg)&&(Cg|=s),4===wg&&Gg(e,xg)),qg(e,i),1===s&&0===gg&&!(1&t.mode)&&(Lg=Hl()+500,Nd&&Ld()))}function qg(e,t){var s=e.callbackNode;!function(e,t){for(var s=e.suspendedLanes,i=e.pingedLanes,n=e.expirationTimes,r=e.pendingLanes;0<r;){var o=31-Gl(r),a=1<<o,l=n[o];-1===l?0!==(a&s)&&0===(a&i)||(n[o]=sc(a,t)):l<=t&&(e.expiredLanes|=a),r&=~a}}(e,t);var i=tc(e,e===mg?xg:0);if(0===i)null!==s&&Tl(s),e.callbackNode=null,e.callbackPriority=0;else if(t=i&-i,e.callbackPriority!==t){if(null!=s&&Tl(s),1===t)0===e.tag?function(e){Nd=!0,Bd(e)}(Xg.bind(null,e)):Bd(Xg.bind(null,e)),Yu(function(){!(6&gg)&&Ld()}),s=null;else{switch(cc(i)){case 1:s=Wl;break;case 4:s=Kl;break;case 16:default:s=Ul;break;case 536870912:s=Vl}s=mm(s,Vg.bind(null,e))}e.callbackPriority=t,e.callbackNode=s}}function Vg(e,t){if(Hg=-1,Fg=0,6&gg)throw Error(Yo(327));var s=e.callbackNode;if(hm()&&e.callbackNode!==s)return null;var i=tc(e,e===mg?xg:0);if(0===i)return null;if(30&i||0!==(i&e.expiredLanes)||t)t=nm(e,i);else{t=i;var n=gg;gg|=2;var r=sm();for(mg===e&&xg===t||(Dg=null,Lg=Hl()+500,em(e,t));;)try{om();break}catch(a){tm(e,a)}vf(),fg.current=r,gg=n,null!==_g?t=0:(mg=null,xg=0,t=wg)}if(0!==t){if(2===t&&(0!==(n=ic(e))&&(i=n,t=$g(e,n))),1===t)throw s=Sg,em(e,0),Gg(e,i),qg(e,Hl()),s;if(6===t)Gg(e,i);else{if(n=e.current.alternate,!(30&i||function(e){for(var t=e;;){if(16384&t.flags){var s=t.updateQueue;if(null!==s&&null!==(s=s.stores))for(var i=0;i<s.length;i++){var n=s[i],r=n.getSnapshot;n=n.value;try{if(!Gh(r(),n))return!1}catch(o){return!1}}}if(s=t.child,16384&t.subtreeFlags&&null!==s)s.return=t,t=s;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}(n)||(t=nm(e,i),2===t&&(r=ic(e),0!==r&&(i=r,t=$g(e,r))),1!==t)))throw s=Sg,em(e,0),Gg(e,i),qg(e,Hl()),s;switch(e.finishedWork=n,e.finishedLanes=i,t){case 0:case 1:throw Error(Yo(345));case 2:case 5:cm(e,Mg,Dg);break;case 3:if(Gg(e,i),(130023424&i)===i&&10<(t=Bg+500-Hl())){if(0!==tc(e,0))break;if(((n=e.suspendedLanes)&i)!==i){Wg(),e.pingedLanes|=e.suspendedLanes&n;break}e.timeoutHandle=qu(cm.bind(null,e,Mg,Dg),t);break}cm(e,Mg,Dg);break;case 4:if(Gg(e,i),(4194240&i)===i)break;for(t=e.eventTimes,n=-1;0<i;){var o=31-Gl(i);r=1<<o,(o=t[o])>n&&(n=o),i&=~r}if(i=n,10<(i=(120>(i=Hl()-i)?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*dg(i/1960))-i)){e.timeoutHandle=qu(cm.bind(null,e,Mg,Dg),i);break}cm(e,Mg,Dg);break;default:throw Error(Yo(329))}}}return qg(e,Hl()),e.callbackNode===s?Vg.bind(null,e):null}function $g(e,t){var s=Ng;return e.current.memoizedState.isDehydrated&&(em(e,t).flags|=256),2!==(e=nm(e,t))&&(t=Mg,Mg=s,null!==t&&Yg(t)),e}function Yg(e){null===Mg?Mg=e:Mg.push.apply(Mg,e)}function Gg(e,t){for(t&=~jg,t&=~Cg,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var s=31-Gl(t),i=1<<s;e[s]=-1,t&=~i}}function Xg(e){if(6&gg)throw Error(Yo(327));hm();var t=tc(e,0);if(!(1&t))return qg(e,Hl()),null;var s=nm(e,t);if(0!==e.tag&&2===s){var i=ic(e);0!==i&&(t=i,s=$g(e,i))}if(1===s)throw s=Sg,em(e,0),Gg(e,t),qg(e,Hl()),s;if(6===s)throw Error(Yo(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,cm(e,Mg,Dg),qg(e,Hl()),null}function Zg(e,t){var s=gg;gg|=1;try{return e(t)}finally{0===(gg=s)&&(Lg=Hl()+500,Nd&&Ld())}}function Jg(e){null!==zg&&0===zg.tag&&!(6&gg)&&hm();var t=gg;gg|=1;var s=vg.transition,i=lc;try{if(vg.transition=null,lc=1,e)return e()}finally{lc=i,vg.transition=s,!(6&(gg=t))&&Ld()}}function Qg(){bg=yg.current,fd(yg)}function em(e,t){e.finishedWork=null,e.finishedLanes=0;var s=e.timeoutHandle;if(-1!==s&&(e.timeoutHandle=-1,Vu(s)),null!==_g)for(s=_g.return;null!==s;){var i=s;switch(Kd(i),i.tag){case 1:null!=(i=i.type.childContextTypes)&&yd();break;case 3:Of(),fd(md),fd(gd),qf();break;case 5:Ff(i);break;case 4:Of();break;case 13:case 19:fd(Wf);break;case 10:gf(i.type._context);break;case 22:case 23:Qg()}s=s.return}if(mg=e,_g=e=ym(e.current,null),xg=bg=t,wg=0,Sg=null,jg=Cg=kg=0,Mg=Ng=null,null!==bf){for(t=0;t<bf.length;t++)if(null!==(i=(s=bf[t]).interleaved)){s.interleaved=null;var n=i.next,r=s.pending;if(null!==r){var o=r.next;r.next=n,i.next=o}s.pending=i}bf=null}return e}function tm(e,t){for(;;){var s=_g;try{if(vf(),Vf.current=Hp,Jf){for(var i=Gf.memoizedState;null!==i;){var n=i.queue;null!==n&&(n.pending=null),i=i.next}Jf=!1}if(Yf=0,Zf=Xf=Gf=null,Qf=!1,ep=0,pg.current=null,null===s||null===s.return){wg=1,Sg=t,_g=null;break}e:{var r=e,o=s.return,a=s,l=t;if(t=xg,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=nv(o);if(null!==f){f.flags&=-257,rv(f,o,a,0,t),1&f.mode&&iv(r,c,t),l=c;var p=(t=f).updateQueue;if(null===p){var v=new Set;v.add(l),t.updateQueue=v}else p.add(l);break e}if(!(1&t)){iv(r,c,t),im();break e}l=Error(Yo(426))}else if(Vd&&1&a.mode){var g=nv(o);if(null!==g){!(65536&g.flags)&&(g.flags|=256),rv(g,o,a,0,t),sf(Zp(l,a));break e}}r=l=Zp(l,a),4!==wg&&(wg=2),null===Ng?Ng=[r]:Ng.push(r),r=o;do{switch(r.tag){case 3:r.flags|=65536,t&=-t,r.lanes|=t,Lf(r,tv(0,l,t));break e;case 1:a=l;var m=r.type,_=r.stateNode;if(!(128&r.flags||"function"!=typeof m.getDerivedStateFromError&&(null===_||"function"!=typeof _.componentDidCatch||null!==Rg&&Rg.has(_)))){r.flags|=65536,t&=-t,r.lanes|=t,Lf(r,sv(r,a,t));break e}}r=r.return}while(null!==r)}lm(s)}catch(x){t=x,_g===s&&null!==s&&(_g=s=s.return);continue}break}}function sm(){var e=fg.current;return fg.current=Hp,null===e?Hp:e}function im(){0!==wg&&3!==wg&&2!==wg||(wg=4),null===mg||!(268435455&kg)&&!(268435455&Cg)||Gg(mg,xg)}function nm(e,t){var s=gg;gg|=2;var i=sm();for(mg===e&&xg===t||(Dg=null,em(e,t));;)try{rm();break}catch(n){tm(e,n)}if(vf(),gg=s,fg.current=i,null!==_g)throw Error(Yo(261));return mg=null,xg=0,wg}function rm(){for(;null!==_g;)am(_g)}function om(){for(;null!==_g&&!Il();)am(_g)}function am(e){var t=ug(e.alternate,e,bg);e.memoizedProps=e.pendingProps,null===t?lm(e):_g=t,pg.current=null}function lm(e){var t=e;do{var s=t.alternate;if(e=t.return,32768&t.flags){if(null!==(s=zv(s,t)))return s.flags&=32767,void(_g=s);if(null===e)return wg=6,void(_g=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}else if(null!==(s=Av(s,t,bg)))return void(_g=s);if(null!==(t=t.sibling))return void(_g=t);_g=t=e}while(null!==t);0===wg&&(wg=5)}function cm(e,t,s){var i=lc,n=vg.transition;try{vg.transition=null,lc=1,function(e,t,s,i){do{hm()}while(null!==zg);if(6&gg)throw Error(Yo(327));s=e.finishedWork;var n=e.finishedLanes;if(null===s)return null;if(e.finishedWork=null,e.finishedLanes=0,s===e.current)throw Error(Yo(177));e.callbackNode=null,e.callbackPriority=0;var r=s.lanes|s.childLanes;if(function(e,t){var s=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 i=e.eventTimes;for(e=e.expirationTimes;0<s;){var n=31-Gl(s),r=1<<n;t[n]=0,i[n]=-1,e[n]=-1,s&=~r}}(e,r),e===mg&&(_g=mg=null,xg=0),!(2064&s.subtreeFlags)&&!(2064&s.flags)||Ag||(Ag=!0,mm(Ul,function(){return hm(),null})),r=!!(15990&s.flags),!!(15990&s.subtreeFlags)||r){r=vg.transition,vg.transition=null;var o=lc;lc=1;var a=gg;gg|=4,pg.current=null,function(e,t){if(Wu=Pc,tu(e=eu())){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{var i=(s=(s=e.ownerDocument)&&s.defaultView||window).getSelection&&s.getSelection();if(i&&0!==i.rangeCount){s=i.anchorNode;var n=i.anchorOffset,r=i.focusNode;i=i.focusOffset;try{s.nodeType,r.nodeType}catch(b){s=null;break e}var o=0,a=-1,l=-1,c=0,h=0,u=e,d=null;t:for(;;){for(var f;u!==s||0!==n&&3!==u.nodeType||(a=o+n),u!==r||0!==i&&3!==u.nodeType||(l=o+i),3===u.nodeType&&(o+=u.nodeValue.length),null!==(f=u.firstChild);)d=u,u=f;for(;;){if(u===e)break t;if(d===s&&++c===n&&(a=o),d===r&&++h===i&&(l=o),null!==(f=u.nextSibling))break;d=(u=d).parentNode}u=f}s=-1===a||-1===l?null:{start:a,end:l}}else s=null}s=s||{start:0,end:0}}else s=null;for(Ku={focusedElem:e,selectionRange:s},Pc=!1,Hv=t;null!==Hv;)if(e=(t=Hv).child,1028&t.subtreeFlags&&null!==e)e.return=t,Hv=e;else for(;null!==Hv;){t=Hv;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 v=p.memoizedProps,g=p.memoizedState,m=t.stateNode,_=m.getSnapshotBeforeUpdate(t.elementType===t.type?v:Up(t.type,v),g);m.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var x=t.stateNode.containerInfo;1===x.nodeType?x.textContent="":9===x.nodeType&&x.documentElement&&x.removeChild(x.documentElement);break;default:throw Error(Yo(163))}}catch(b){dm(t,t.return,b)}if(null!==(e=t.sibling)){e.return=t.return,Hv=e;break}Hv=t.return}p=Kv,Kv=!1}(e,s),ng(s,e),su(Ku),Pc=!!Wu,Ku=Wu=null,e.current=s,og(s),Ol(),gg=a,lc=o,vg.transition=r}else e.current=s;if(Ag&&(Ag=!1,zg=e,Tg=n),r=e.pendingLanes,0===r&&(Rg=null),function(e){if(Yl&&"function"==typeof Yl.onCommitFiberRoot)try{Yl.onCommitFiberRoot($l,e,void 0,!(128&~e.current.flags))}catch(t){}}(s.stateNode),qg(e,Hl()),null!==t)for(i=e.onRecoverableError,s=0;s<t.length;s++)n=t[s],i(n.value,{componentStack:n.stack,digest:n.digest});if(Eg)throw Eg=!1,e=Pg,Pg=null,e;!!(1&Tg)&&0!==e.tag&&hm(),r=e.pendingLanes,1&r?e===Og?Ig++:(Ig=0,Og=e):Ig=0,Ld()}(e,t,s,i)}finally{vg.transition=n,lc=i}return null}function hm(){if(null!==zg){var e=cc(Tg),t=vg.transition,s=lc;try{if(vg.transition=null,lc=16>e?16:e,null===zg)var i=!1;else{if(e=zg,zg=null,Tg=0,6&gg)throw Error(Yo(331));var n=gg;for(gg|=4,Hv=e.current;null!==Hv;){var r=Hv,o=r.child;if(16&Hv.flags){var a=r.deletions;if(null!==a){for(var l=0;l<a.length;l++){var c=a[l];for(Hv=c;null!==Hv;){var h=Hv;switch(h.tag){case 0:case 11:case 15:Uv(8,h,r)}var u=h.child;if(null!==u)u.return=h,Hv=u;else for(;null!==Hv;){var d=(h=Hv).sibling,f=h.return;if($v(h),h===c){Hv=null;break}if(null!==d){d.return=f,Hv=d;break}Hv=f}}}var p=r.alternate;if(null!==p){var v=p.child;if(null!==v){p.child=null;do{var g=v.sibling;v.sibling=null,v=g}while(null!==v)}}Hv=r}}if(2064&r.subtreeFlags&&null!==o)o.return=r,Hv=o;else e:for(;null!==Hv;){if(2048&(r=Hv).flags)switch(r.tag){case 0:case 11:case 15:Uv(9,r,r.return)}var m=r.sibling;if(null!==m){m.return=r.return,Hv=m;break e}Hv=r.return}}var _=e.current;for(Hv=_;null!==Hv;){var x=(o=Hv).child;if(2064&o.subtreeFlags&&null!==x)x.return=o,Hv=x;else e:for(o=_;null!==Hv;){if(2048&(a=Hv).flags)try{switch(a.tag){case 0:case 11:case 15:qv(9,a)}}catch(y){dm(a,a.return,y)}if(a===o){Hv=null;break e}var b=a.sibling;if(null!==b){b.return=a.return,Hv=b;break e}Hv=a.return}}if(gg=n,Ld(),Yl&&"function"==typeof Yl.onPostCommitFiberRoot)try{Yl.onPostCommitFiberRoot($l,e)}catch(y){}i=!0}return i}finally{lc=s,vg.transition=t}}return!1}function um(e,t,s){e=Mf(e,t=tv(0,t=Zp(s,t),1),1),t=Wg(),null!==e&&(oc(e,1,t),qg(e,t))}function dm(e,t,s){if(3===e.tag)um(e,e,s);else for(;null!==t;){if(3===t.tag){um(t,e,s);break}if(1===t.tag){var i=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof i.componentDidCatch&&(null===Rg||!Rg.has(i))){t=Mf(t,e=sv(t,e=Zp(s,e),1),1),e=Wg(),null!==t&&(oc(t,1,e),qg(t,e));break}}t=t.return}}function fm(e,t,s){var i=e.pingCache;null!==i&&i.delete(t),t=Wg(),e.pingedLanes|=e.suspendedLanes&s,mg===e&&(xg&s)===s&&(4===wg||3===wg&&(130023424&xg)===xg&&500>Hl()-Bg?em(e,0):jg|=s),qg(e,t)}function pm(e,t){0===t&&(1&e.mode?(t=Ql,!(130023424&(Ql<<=1))&&(Ql=4194304)):t=1);var s=Wg();null!==(e=Sf(e,t))&&(oc(e,t,s),qg(e,s))}function vm(e){var t=e.memoizedState,s=0;null!==t&&(s=t.retryLane),pm(e,s)}function gm(e,t){var s=0;switch(e.tag){case 13:var i=e.stateNode,n=e.memoizedState;null!==n&&(s=n.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(Yo(314))}null!==i&&i.delete(t),pm(e,s)}function mm(e,t){return zl(e,t)}function _m(e,t,s,i){this.tag=e,this.key=s,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=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function xm(e,t,s,i){return new _m(e,t,s,i)}function bm(e){return!(!(e=e.prototype)||!e.isReactComponent)}function ym(e,t){var s=e.alternate;return null===s?((s=xm(e.tag,t,e.key,e.mode)).elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=t,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=14680064&e.flags,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,t=e.dependencies,s.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s}function wm(e,t,s,i,n,r){var o=2;if(i=e,"function"==typeof e)bm(e)&&(o=1);else if("string"==typeof e)o=5;else e:switch(e){case da:return Sm(s.children,n,r,t);case fa:o=8,n|=8;break;case pa:return(e=xm(12,s,t,2|n)).elementType=pa,e.lanes=r,e;case _a:return(e=xm(13,s,t,n)).elementType=_a,e.lanes=r,e;case xa:return(e=xm(19,s,t,n)).elementType=xa,e.lanes=r,e;case wa:return km(s,n,r,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case va:o=10;break e;case ga:o=9;break e;case ma:o=11;break e;case ba:o=14;break e;case ya:o=16,i=null;break e}throw Error(Yo(130,null==e?e:typeof e,""))}return(t=xm(o,s,t,n)).elementType=e,t.type=i,t.lanes=r,t}function Sm(e,t,s,i){return(e=xm(7,e,i,t)).lanes=s,e}function km(e,t,s,i){return(e=xm(22,e,i,t)).elementType=wa,e.lanes=s,e.stateNode={isHidden:!1},e}function Cm(e,t,s){return(e=xm(6,e,null,t)).lanes=s,e}function jm(e,t,s){return(t=xm(4,null!==e.children?e.children:[],e.key,t)).lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Nm(e,t,s,i,n){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=rc(0),this.expirationTimes=rc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=rc(0),this.identifierPrefix=i,this.onRecoverableError=n,this.mutableSourceEagerHydrationData=null}function Mm(e,t,s,i,n,r,o,a,l){return e=new Nm(e,t,s,a,l),1===t?(t=1,!0===r&&(t|=8)):t=0,r=xm(3,null,null,t),e.current=r,r.stateNode=e,r.memoizedState={element:i,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},Cf(r),e}function Bm(e){if(!e)return vd;e:{if(Dl(e=e._reactInternals)!==e||1!==e.tag)throw Error(Yo(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(bd(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(Yo(171))}if(1===e.tag){var s=e.type;if(bd(s))return Sd(e,s,t)}return t}function Lm(e,t,s,i,n,r,o,a,l){return(e=Mm(s,i,!0,e,0,r,0,a,l)).context=Bm(null),s=e.current,(r=Nf(i=Wg(),n=Kg(s))).callback=null!=t?t:null,Mf(s,r,n),e.current.lanes=n,oc(e,n,i),qg(e,i),e}function Dm(e,t,s,i){var n=t.current,r=Wg(),o=Kg(n);return s=Bm(s),null===t.context?t.context=s:t.pendingContext=s,(t=Nf(r,o)).payload={element:e},null!==(i=void 0===i?null:i)&&(t.callback=i),null!==(e=Mf(n,t,o))&&(Ug(e,n,o,r),Bf(e,n,o)),o}function Em(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 s=e.retryLane;e.retryLane=0!==s&&s<t?s:t}}function Rm(e,t){Pm(e,t),(e=e.alternate)&&Pm(e,t)}ug=function(e,t,s){if(null!==e)if(e.memoizedProps!==t.pendingProps||md.current)av=!0;else{if(0===(e.lanes&s)&&!(128&t.flags))return av=!1,function(e,t,s){switch(t.tag){case 3:mv(t),tf();break;case 5:Hf(t);break;case 1:bd(t.type)&&kd(t);break;case 4:If(t,t.stateNode.containerInfo);break;case 10:var i=t.type._context,n=t.memoizedProps.value;pd(uf,i._currentValue),i._currentValue=n;break;case 13:if(null!==(i=t.memoizedState))return null!==i.dehydrated?(pd(Wf,1&Wf.current),t.flags|=128,null):0!==(s&t.child.childLanes)?Cv(e,t,s):(pd(Wf,1&Wf.current),null!==(e=Ev(e,t,s))?e.sibling:null);pd(Wf,1&Wf.current);break;case 19:if(i=0!==(s&t.childLanes),128&e.flags){if(i)return Lv(e,t,s);t.flags|=128}if(null!==(n=t.memoizedState)&&(n.rendering=null,n.tail=null,n.lastEffect=null),pd(Wf,Wf.current),i)break;return null;case 22:case 23:return t.lanes=0,dv(e,t,s)}return Ev(e,t,s)}(e,t,s);av=!!(131072&e.flags)}else av=!1,Vd&&1048576&t.flags&&Fd(t,Rd,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;Dv(e,t),e=t.pendingProps;var n=xd(t,gd.current);_f(t,s),n=np(null,t,i,e,n,s);var r=rp();return t.flags|=1,"object"==typeof n&&null!==n&&"function"==typeof n.render&&void 0===n.$$typeof?(t.tag=1,t.memoizedState=null,t.updateQueue=null,bd(i)?(r=!0,kd(t)):r=!1,t.memoizedState=null!==n.state&&void 0!==n.state?n.state:null,Cf(t),n.updater=Vp,t.stateNode=n,n._reactInternals=t,Xp(t,i,e,s),t=gv(null,t,i,!0,r,s)):(t.tag=0,Vd&&r&&Wd(t),lv(null,t,n,s),t=t.child),t;case 16:i=t.elementType;e:{switch(Dv(e,t),e=t.pendingProps,i=(n=i._init)(i._payload),t.type=i,n=t.tag=function(e){if("function"==typeof e)return bm(e)?1:0;if(null!=e){if((e=e.$$typeof)===ma)return 11;if(e===ba)return 14}return 2}(i),e=Up(i,e),n){case 0:t=pv(null,t,i,e,s);break e;case 1:t=vv(null,t,i,e,s);break e;case 11:t=cv(null,t,i,e,s);break e;case 14:t=hv(null,t,i,Up(i.type,e),s);break e}throw Error(Yo(306,i,""))}return t;case 0:return i=t.type,n=t.pendingProps,pv(e,t,i,n=t.elementType===i?n:Up(i,n),s);case 1:return i=t.type,n=t.pendingProps,vv(e,t,i,n=t.elementType===i?n:Up(i,n),s);case 3:e:{if(mv(t),null===e)throw Error(Yo(387));i=t.pendingProps,n=(r=t.memoizedState).element,jf(e,t),Df(t,i,null,s);var o=t.memoizedState;if(i=o.element,r.isDehydrated){if(r={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=r,t.memoizedState=r,256&t.flags){t=_v(e,t,i,s,n=Zp(Error(Yo(423)),t));break e}if(i!==n){t=_v(e,t,i,s,n=Zp(Error(Yo(424)),t));break e}for(qd=Zu(t.stateNode.containerInfo.firstChild),Ud=t,Vd=!0,$d=null,s=hf(t,null,i,s),t.child=s;s;)s.flags=-3&s.flags|4096,s=s.sibling}else{if(tf(),i===n){t=Ev(e,t,s);break e}lv(e,t,i,s)}t=t.child}return t;case 5:return Hf(t),null===e&&Zd(t),i=t.type,n=t.pendingProps,r=null!==e?e.memoizedProps:null,o=n.children,Uu(i,n)?o=null:null!==r&&Uu(i,r)&&(t.flags|=32),fv(e,t),lv(e,t,o,s),t.child;case 6:return null===e&&Zd(t),null;case 13:return Cv(e,t,s);case 4:return If(t,t.stateNode.containerInfo),i=t.pendingProps,null===e?t.child=cf(t,null,i,s):lv(e,t,i,s),t.child;case 11:return i=t.type,n=t.pendingProps,cv(e,t,i,n=t.elementType===i?n:Up(i,n),s);case 7:return lv(e,t,t.pendingProps,s),t.child;case 8:case 12:return lv(e,t,t.pendingProps.children,s),t.child;case 10:e:{if(i=t.type._context,n=t.pendingProps,r=t.memoizedProps,o=n.value,pd(uf,i._currentValue),i._currentValue=o,null!==r)if(Gh(r.value,o)){if(r.children===n.children&&!md.current){t=Ev(e,t,s);break e}}else for(null!==(r=t.child)&&(r.return=t);null!==r;){var a=r.dependencies;if(null!==a){o=r.child;for(var l=a.firstContext;null!==l;){if(l.context===i){if(1===r.tag){(l=Nf(-1,s&-s)).tag=2;var c=r.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}}r.lanes|=s,null!==(l=r.alternate)&&(l.lanes|=s),mf(r.return,s,t),a.lanes|=s;break}l=l.next}}else if(10===r.tag)o=r.type===t.type?null:r.child;else if(18===r.tag){if(null===(o=r.return))throw Error(Yo(341));o.lanes|=s,null!==(a=o.alternate)&&(a.lanes|=s),mf(o,s,t),o=r.sibling}else o=r.child;if(null!==o)o.return=r;else for(o=r;null!==o;){if(o===t){o=null;break}if(null!==(r=o.sibling)){r.return=o.return,o=r;break}o=o.return}r=o}lv(e,t,n.children,s),t=t.child}return t;case 9:return n=t.type,i=t.pendingProps.children,_f(t,s),i=i(n=xf(n)),t.flags|=1,lv(e,t,i,s),t.child;case 14:return n=Up(i=t.type,t.pendingProps),hv(e,t,i,n=Up(i.type,n),s);case 15:return uv(e,t,t.type,t.pendingProps,s);case 17:return i=t.type,n=t.pendingProps,n=t.elementType===i?n:Up(i,n),Dv(e,t),t.tag=1,bd(i)?(e=!0,kd(t)):e=!1,_f(t,s),Yp(t,i,n),Xp(t,i,n,s),gv(null,t,i,!0,e,s);case 19:return Lv(e,t,s);case 22:return dv(e,t,s)}throw Error(Yo(156,t.tag))};var Am="function"==typeof reportError?reportError:function(e){console.error(e)};function zm(e){this._internalRoot=e}function Tm(e){this._internalRoot=e}function Im(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function Om(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function Hm(){}function Fm(e,t,s,i,n){var r=s._reactRootContainer;if(r){var o=r;if("function"==typeof n){var a=n;n=function(){var e=Em(o);a.call(e)}}Dm(t,o,e,n)}else o=function(e,t,s,i,n){if(n){if("function"==typeof i){var r=i;i=function(){var e=Em(o);r.call(e)}}var o=Lm(t,i,e,0,null,!1,0,"",Hm);return e._reactRootContainer=o,e[sd]=o.current,Lu(8===e.nodeType?e.parentNode:e),Jg(),o}for(;n=e.lastChild;)e.removeChild(n);if("function"==typeof i){var a=i;i=function(){var e=Em(l);a.call(e)}}var l=Mm(e,0,!1,null,0,!1,0,"",Hm);return e._reactRootContainer=l,e[sd]=l.current,Lu(8===e.nodeType?e.parentNode:e),Jg(function(){Dm(t,l,s,i)}),l}(s,t,e,n,i);return Em(o)}Tm.prototype.render=zm.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(Yo(409));Dm(e,t,null,null)},Tm.prototype.unmount=zm.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;Jg(function(){Dm(null,e,null,null)}),t[sd]=null}},Tm.prototype.unstable_scheduleHydration=function(e){if(e){var t=fc();e={blockedOn:null,target:e,priority:t};for(var s=0;s<wc.length&&0!==t&&t<wc[s].priority;s++);wc.splice(s,0,e),0===s&&jc(e)}},hc=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var s=ec(t.pendingLanes);0!==s&&(ac(t,1|s),qg(t,Hl()),!(6&gg)&&(Lg=Hl()+500,Ld()))}break;case 13:Jg(function(){var t=Sf(e,1);if(null!==t){var s=Wg();Ug(t,e,1,s)}}),Rm(e,1)}},uc=function(e){if(13===e.tag){var t=Sf(e,134217728);if(null!==t)Ug(t,e,134217728,Wg());Rm(e,134217728)}},dc=function(e){if(13===e.tag){var t=Kg(e),s=Sf(e,t);if(null!==s)Ug(s,e,t,Wg());Rm(e,t)}},fc=function(){return lc},pc=function(e,t){var s=lc;try{return lc=e,t()}finally{lc=s}},ul=function(e,t,s){switch(t){case"input":if(Fa(e,s),t=s.name,"radio"===s.type&&null!=t){for(s=e;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<s.length;t++){var i=s[t];if(i!==e&&i.form===e.form){var n=cd(i);if(!n)throw Error(Yo(90));za(i),Fa(i,n)}}}break;case"textarea":Ya(e,s);break;case"select":null!=(t=s.value)&&qa(e,!!s.multiple,t,!1)}},ml=Zg,_l=Jg;var Wm={usingClientEntryPoint:!1,Events:[ad,ld,cd,vl,gl,Zg]},Km={findFiberByHostInstance:od,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Um={bundleType:Km.bundleType,version:Km.version,rendererPackageName:Km.rendererPackageName,rendererConfig:Km.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ca.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=Rl(e))?null:e.stateNode},findFiberByHostInstance:Km.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{$l=qm.inject(Um),Yl=qm}catch(Qa){}}Wo.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Wm,Wo.createPortal=function(e,t){var s=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!Im(t))throw Error(Yo(200));return function(e,t,s){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:ua,key:null==i?null:""+i,children:e,containerInfo:t,implementation:s}}(e,t,null,s)},Wo.createRoot=function(e,t){if(!Im(e))throw Error(Yo(299));var s=!1,i="",n=Am;return null!=t&&(!0===t.unstable_strictMode&&(s=!0),void 0!==t.identifierPrefix&&(i=t.identifierPrefix),void 0!==t.onRecoverableError&&(n=t.onRecoverableError)),t=Mm(e,1,!1,null,0,s,0,i,n),e[sd]=t.current,Lu(8===e.nodeType?e.parentNode:e),new zm(t)},Wo.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(Yo(188));throw e=Object.keys(e).join(","),Error(Yo(268,e))}return e=null===(e=Rl(t))?null:e.stateNode},Wo.flushSync=function(e){return Jg(e)},Wo.hydrate=function(e,t,s){if(!Om(t))throw Error(Yo(200));return Fm(null,e,t,!0,s)},Wo.hydrateRoot=function(e,t,s){if(!Im(e))throw Error(Yo(405));var i=null!=s&&s.hydratedSources||null,n=!1,r="",o=Am;if(null!=s&&(!0===s.unstable_strictMode&&(n=!0),void 0!==s.identifierPrefix&&(r=s.identifierPrefix),void 0!==s.onRecoverableError&&(o=s.onRecoverableError)),t=Lm(t,null,e,1,null!=s?s:null,n,0,r,o),e[sd]=t.current,Lu(e),i)for(e=0;e<i.length;e++)n=(n=(s=i[e])._getVersion)(s._source),null==t.mutableSourceEagerHydrationData?t.mutableSourceEagerHydrationData=[s,n]:t.mutableSourceEagerHydrationData.push(s,n);return new Tm(t)},Wo.render=function(e,t,s){if(!Om(t))throw Error(Yo(200));return Fm(null,e,t,!1,s)},Wo.unmountComponentAtNode=function(e){if(!Om(e))throw Error(Yo(40));return!!e._reactRootContainer&&(Jg(function(){Fm(null,null,e,!1,function(){e._reactRootContainer=null,e[sd]=null})}),!0)},Wo.unstable_batchedUpdates=Zg,Wo.unstable_renderSubtreeIntoContainer=function(e,t,s,i){if(!Om(s))throw Error(Yo(200));if(null==e||void 0===e._reactInternals)throw Error(Yo(38));return Fm(e,t,s,!1,i)},Wo.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)}}(),Fo.exports=Wo;var Vm,$m=Fo.exports,Ym=$m;if(Vm=Ym.createRoot,Ym.hydrateRoot,!ps.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!function(e,t,s){return Eo(function(){var i=po(e,s)[vi];null!=t||(t=function(e){return Zs(e,ui)||Ks(e,ui,ni({},e[ui])),e[ui]}(e)),Gs(t).forEach(function(e){return i.make_(e,t[e])})}),e})throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function Gm(e){e()}function Xm(e){return wr(Lo(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 s=Date.now();t.registrations.forEach(function(i,n){s-i.registeredAt>=e&&(t.finalize(i.value),t.registrations.delete(n))}),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,s){this.registrations.set(s,{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}(),Jm=new("undefined"!=typeof FinalizationRegistry?FinalizationRegistry:Zm)(function(e){var t;null===(t=e.reaction)||void 0===t||t.dispose(),e.reaction=null}),Qm={exports:{}},e_={},t_=ps;var s_="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i_=t_.useState,n_=t_.useEffect,r_=t_.useLayoutEffect,o_=t_.useDebugValue;function a_(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!s_(e,s)}catch(i){return!0}}var l_="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var s=t(),i=i_({inst:{value:s,getSnapshot:t}}),n=i[0].inst,r=i[1];return r_(function(){n.value=s,n.getSnapshot=t,a_(n)&&r({inst:n})},[e,s,t]),n_(function(){return a_(n)&&r({inst:n}),e(function(){a_(n)&&r({inst:n})})},[e]),o_(s),s};e_.useSyncExternalStore=void 0!==t_.useSyncExternalStore?t_.useSyncExternalStore:l_,Qm.exports=e_;var c_,h_,u_=Qm.exports;function d_(e){e.reaction=new $n("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),null===(t=e.onStoreChange)||void 0===t||t.call(e)})}var f_="function"==typeof Symbol&&Symbol.for,p_=null!==(h_=null===(c_=Object.getOwnPropertyDescriptor(function(){},"name"))||void 0===c_?void 0:c_.configurable)&&void 0!==h_&&h_,v_=f_?Symbol.for("react.forward_ref"):"function"==typeof ps.forwardRef&&ps.forwardRef(function(e){return null}).$$typeof,g_=f_?Symbol.for("react.memo"):"function"==typeof ps.memo&&ps.memo(function(e){return null}).$$typeof;function m_(e,t){if(g_&&e.$$typeof===g_)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 s=!1,i=e,n=e.displayName||e.name;if(v_&&e.$$typeof===v_&&(s=!0,"function"!=typeof(i=e.render)))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var r,o,a=function(e,t){return function(e,t){void 0===t&&(t="observed");var s=vs.useRef(null);if(!s.current){var i={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(e){return Jm.unregister(i),i.onStoreChange=e,i.reaction||(d_(i),i.stateVersion=Symbol()),function(){var e;i.onStoreChange=null,null===(e=i.reaction)||void 0===e||e.dispose(),i.reaction=null}},getSnapshot:function(){return i.stateVersion}};s.current=i}var n,r,o=s.current;if(o.reaction||(d_(o),Jm.register(s,o,o)),vs.useDebugValue(o.reaction,Xm),u_.useSyncExternalStore(o.subscribe,o.getSnapshot,o.getSnapshot),o.reaction.track(function(){try{n=e()}catch(t){r=t}}),r)throw r;return n}(function(){return i(e,t)},n)};return a.displayName=e.displayName,p_&&Object.defineProperty(a,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(a.contextTypes=e.contextTypes),s&&(a=ps.forwardRef(a)),a=ps.memo(a),r=e,o=a,Object.keys(r).forEach(function(e){x_[e]||Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(r,e))}),a}var __,x_={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};(__=$m.unstable_batchedUpdates)||(__=Gm),br({reactionScheduler:__}),Jm.finalizeAllImmediately;const b_=ps.createContext(null);function y_(){const e=ps.useContext(b_);if(!e)throw new Error("useRootStore() called outside <StoreContext.Provider> — wrap the tree in main.tsx");return e}const w_=Db;!function(){const e=653,t=Db,s=Sb();for(;;)try{if(857442===-parseInt(t(586))/1*(-parseInt(t(550))/2)+-parseInt(t(743))/3+parseInt(t(e))/4*(-parseInt(t(504))/5)+-parseInt(t(503))/6*(parseInt(t(681))/7)+parseInt(t(364))/8+parseInt(t(663))/9+parseInt(t(703))/10*(parseInt(t(397))/11))break;s.push(s.shift())}catch(i){s.push(s.shift())}}();var S_=Object[w_(822)],k_=(e,t)=>S_(e,w_(545),{value:t,configurable:!0});function C_(e){return typeof e===w_(438)&&null!==e&&!Array.isArray(e)}k_(function(e){const t=790,s=406,i=w_,n=e[i(671)]();if(!n[i(547)]("{"))return null;try{const e=JSON[i(t)](n);return e[i(406)]===i(609)||e[i(406)]===i(572)||e[i(s)]===i(469)?e:null}catch{return null}},"parseAppServerEvent"),k_(C_,"isRecord");var j_=w_(618),N_=w_(638);w_(677);var M_=w_(813),B_=".runs";function L_(e,t){return""+B_+e+(t?"."+t:"")}w_(714),k_(function(e){return""+N_+e},w_(775)),k_(L_,w_(525)),k_(function(e){const t=w_;return e===B_||e[t(547)](B_+"-")||e[t(547)](B_+".")},w_(644)),k_(function(e){return w_(555)+e},w_(650)),k_(function(e){const t=w_;return j_+t(506)+e+t(603)},w_(721)),w_(823),w_(825),w_(482),w_(459),w_(416),w_(631),w_(581),w_(686),w_(417);var D_=w_(752),E_=w_(693),P_="unotest/.secrets";function R_(e,t,s){const i=585,n=w_,r=[e];return t&&r[n(585)](""+e+t),s&&(r[n(585)](e+"."+s),t&&r[n(i)](""+e+t+"."+s)),r}k_(function(e,t){return""+E_+e+(t?"."+t:"")},"envFileFor"),k_(function(e,t){return""+P_+e+(t?"."+t:"")},w_(421)),k_(function(e,t){return R_(E_,e,t)},w_(485)),k_(function(e,t){return R_(P_,e,t)},w_(394)),k_(R_,"layersFor");var A_=w_(427);k_(function(e,t){var s;const i=w_,n=null==(s=e[A_])?void 0:s[i(671)]();return n||t},w_(659));var z_=[w_(672),"failures"];function T_(e){const t=w_;return[e[t(595)](/\/+$/,""),...z_][t(708)]("/")}k_(T_,w_(709));var I_=w_(817);k_(function(e,t){var s;const i=w_,n=null==(s=e[I_])?void 0:s[i(671)]();return n||t},w_(753)),k_(function(e){var t;const s=w_,i=null==(t=e[s(557)])?void 0:t[s(671)]();return i||void 0},w_(509));var O_=new Set([w_(510),w_(596),w_(747)]);k_(function(e,t){const s=691,i=547,n=788,r=792,o=w_,a=[o(816),o(699)][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(i)](t))continue;const s=c.slice(t.length);s&&!s[o(n)]("/")&&(O_.has(s)||l.add(s))}return[...l][o(r)]()},w_(661)),k_(function(e){const t=406,s=684,i=w_;return typeof e===i(438)&&null!==e&&e[i(t)]===i(517)&&typeof e[i(s)]===i(562)&&typeof e[i(629)]===i(562)},"isRegexLiteral"),k_(function(e,t=""){return{kind:"regex",source:e,flags:t}},w_(654));function H_(e){const t=595,s=552,i=w_,n=e[i(595)](/[^a-zA-Z0-9_-]+/g,"-")[i(t)](/-+/g,"-").replace(/^-|-$/g,"");return n[i(s)]>0?n:i(739)}k_(function(e){const t=373,s=768,i=425,n=829,r=552,o=436,a=w_,l=H_(e),c=Date[a(t)]()[a(s)](36),h=new Uint8Array(6);globalThis[a(i)][a(n)](h);let u="";for(let d=0;d<h[a(r)];d++)u+=h[d][a(768)](16)[a(o)](2,"0");return l+"-"+c+"-"+u},"makeRunId"),k_(H_,w_(736));var F_=/^[0-9a-f]{6,}$/,W_=Date[w_(449)](2020,0,1),K_=Date.UTC(2100,0,1);function U_(e){const t=552,s=w_,i=e[s(511)]("-");if(i[s(t)]<3)return null;const n=i[i[s(t)]-1];if(!F_[s(365)](n))return null;const r=i[i[s(552)]-2];if(!/^[0-9a-z]+$/.test(r))return null;const o=parseInt(r,36);return Number[s(420)](o)?o<W_||o>=K_?null:o:null}function q_(e){const t=436,s=426,i=w_,n=new Date(e);return String(n.getUTCFullYear())[i(t)](4,"0")+"/"+String(n[i(508)]()+1)[i(436)](2,"0")+"/"+String(n[i(s)]())[i(436)](2,"0")}function V_(e){const t=U_(e);return null===t?null:q_(t)}function $_(e,t){const s=V_(t);return null===s?null:e+"/"+s+"/"+t}k_(U_,w_(463)),k_(q_,w_(536)),k_(V_,"shardPathForRunId"),k_($_,w_(448));var Y_=(k_(e=class extends Error{constructor(e){const t=w_;super(t(424)+e),this.name=t(728)}},"UnplaceableRunIdError"),e);function G_(e,t){const s=$_(e,t);if(null===s)throw new Y_(t);return s}function X_(e="",t){return j_+"/"+L_(e,t)}function Z_(e,t){return e+"/"+q_(t)}function J_(e){const t=w_;return e===t(830)||e===t(549)}k_(G_,"requireRunDirFor"),k_(X_,"projectRunsRoot"),k_(function(e,t){return T_(e[w_(595)](/\/+$/,"")+"/"+X_("",t))},"failuresRootIn"),k_(function(e,t="",s){return G_(X_(t,s),e)},w_(540)),k_(Z_,w_(711)),k_(function*(e,t,s){const i=864e5;let n=Math[w_(556)](t/i)*i;for(let r=0;r<s;r++)yield Z_(e,n),n-=i},w_(395)),k_(J_,w_(707)),k_(function(e,t){const s=569,i=567,n=762,r=569,o=w_,a={lastRunId:t.runId,lastStatus:t[o(778)],lastAt:t[o(s)],lastDurationMs:t[o(i)],recent:[...(null==e?void 0:e.recent)??[],t[o(778)]][o(n)](-12)};if(!J_(t.status))return{...a,failStreak:0,failingSince:null};const l=((null==e?void 0:e[o(480)])??0)+1;return{...a,failStreak:l,failingSince:1===l?t.startedAt:(null==e?void 0:e[o(391)])??t[o(r)]}},w_(423)),k_(function(e){const t=w_;return encodeURIComponent(e)+t(806)},w_(694)),k_(function(e){const t=762,s=552,i=w_;if(!e[i(648)](i(806)))return null;try{return decodeURIComponent(e[i(t)](0,-i(806)[i(s)]))}catch{return null}},w_(735));var Q_=[w_(716),"gitlab","api"],ex=["unauthorized",w_(466),w_(367),w_(827),w_(385),w_(471),w_(439),w_(759),"ambiguous-project",w_(627)];function tx(e){return Q_.includes(e)?e:null}k_(function(e){const t=552,s=562,i=552,n=568,r=766,o=562,a=w_;if(!C_(e))return null;const{bundleId:l,environment:c,collections:h,pr:u,branch:d,sha:f}=e;if("string"!=typeof l||0===l[a(t)])return null;if(typeof c!==a(s)||0===c[a(i)])return null;let p=null;if(void 0!==h){if(!Array[a(413)](h))return null;if(h[a(630)](e=>"string"!=typeof e||0===e[a(552)]))return null;p=h}if(void 0!==u&&(typeof u!==a(n)||!Number[a(r)](u)))return null;for(const v of[d,f])if(void 0!==v&&typeof v!==a(o))return null;return{bundleId:l,environment:c,...p?{collections:p}:{},...typeof u===a(568)?{pr:u}:{},..."string"==typeof d?{branch:d}:{},...typeof f===a(562)?{sha:f}:{}}},w_(643)),k_(function(e){const t=562,s=562,i=562,n=562,r=585,o=w_;if(!C_(e))return null;if(C_(e.error)){const{code:s,message:i}=e[o(696)];return ex.includes(s)?typeof i!==o(t)?null:{error:{code:s,message:i}}:null}const{status:a,bundleId:l,environment:c,runs:h,superseded:u}=e;if(a!==o(705))return null;if(typeof l!==o(s)||typeof c!==o(s))return null;if(!Array.isArray(h))return null;const d=[];for(const f of h){if(!C_(f))return null;const{runId:e,collection:t}=f;if(typeof e!==o(i)||typeof t!==o(n))return null;d[o(r)]({runId:e,collection:t})}return void 0!==u&&typeof u!==o(568)?null:{status:o(705),bundleId:l,environment:c,runs:d,..."number"==typeof u?{superseded:u}:{}}},w_(388)),k_(tx,"parseCiProvider");var sx=".queue";w_(782),w_(797),w_(514),w_(722),w_(646),w_(535),w_(776);function ix(e,t){return""+sx+e+(t?"."+t:"")}k_(ix,w_(520)),k_(function(e){return e===sx||e[w_(547)](sx+"-")||e.startsWith(sx+".")},w_(651)),k_(function(e="",t){return j_+"/"+ix(e,t)},w_(839));var nx=Object[w_(366)]({maintenance:0,interactive:1,ci:2,schedule:3}),rx=["maintenance",w_(632),"ci",w_(771)],ox=rx;function ax(e){return nx[e]}function lx(e){return rx[e]??null}function cx(e){const t=w_,s=e[t(404)]?"@"+e[t(404)].slice(0,7):"";return void 0!==e.pr?"PR #"+e.pr+s:void 0!==e[t(624)]?""+e.branch+s:s[t(552)]>0?s[t(762)](1):e[t(496)]}k_(ax,w_(647)),k_(lx,w_(690)),k_(cx,"describeTicketCi"),k_(function(e,t,s){const i=w_;return ax(e)+"-"+t[i(768)](36)+"-"+s+i(603)},w_(542));var hx=/^([0-3])-([0-9a-z]+)-([0-9a-f]+)\.json$/;function ux(e){const t=w_,s=hx[t(662)](e);if(!s)return null;const i=Number(s[1]),n=lx(i);if(null===n)return null;const r=parseInt(s[2],36);return Number[t(420)](r)?{rank:i,priority:n,createdAt:r,random:s[3]}:null}k_(ux,w_(531)),k_(function(e,t){const s=754,i=473,n=473,r=w_,o=ux(e),a=ux(t);return o&&a?o.rank!==a[r(s)]?o.rank-a.rank:o.createdAt!==a[r(626)]?o.createdAt-a[r(626)]:o[r(473)]<a[r(i)]?-1:o[r(n)]>a[r(473)]?1:0:e<t?-1:e>t?1:0},w_(692));var dx=[w_(546),w_(465),"authoring",w_(387)],fx=[w_(676),w_(784),w_(685),w_(771),"ci"];function px(e){const t=496,s=568,i=766,n=w_;if(!C_(e))return null;const r=tx(e[n(t)]);if(null===r)return null;const{repo:o,branch:a,sha:l,pr:c,checkId:h}=e;for(const u of[o,a,l,h])if(void 0!==u&&"string"!=typeof u)return null;return void 0===c||typeof c===n(s)&&Number[n(i)](c)?{provider:r,..."string"==typeof o?{repo:o}:{},...typeof a===n(562)?{branch:a}:{},..."string"==typeof l?{sha:l}:{},...typeof c===n(s)?{pr:c}:{},..."string"==typeof h?{checkId:h}:{}}:null}k_(function(e){const t=788,s=788,i=406,n=551,r=568,o=559,a=562,l=552,c=559,h=w_;if(!C_(e))return null;const{schemaVersion:u,runId:d,kind:f,ref:p,env:v,priority:g,weight:m,producer:_,source:x,ci:b,createdAt:y}=e;if(1!==u)return null;if(typeof d!==h(562)||0===d[h(552)])return null;if(typeof p!==h(562))return null;if(!dx[h(t)](f))return null;if(!ox[h(t)](g))return null;if(typeof m!==h(568)||!Number.isFinite(m)||m<1)return null;if(typeof y!==h(568)||!Number[h(420)](y))return null;if(!C_(_))return null;if(!fx[h(s)](_[h(i)]))return null;if(typeof _[h(n)]!==h(r)||typeof _[h(o)]!==h(562))return null;if(void 0!==v&&typeof v!==h(562))return null;let w=null;if(void 0!==x){if(!C_(x)||typeof x[h(689)]!==h(a)||0===x.bundleId[h(l)])return null;w={bundleId:x[h(689)]}}let S=null;return void 0!==b&&(S=px(b),null===S)?null:{schemaVersion:1,runId:d,kind:f,ref:p,priority:g,weight:m,producer:{kind:_[h(i)],pid:_[h(551)],host:_[h(c)]},createdAt:y,...typeof v===h(562)?{env:v}:{},...w?{source:w}:{},...S?{ci:S}:{}}},"parseQueueTicket"),k_(px,w_(383));function vx(e){const t=562,s=w_;if(!C_(e))return null;const{repo:i,branch:n,sha:r,dirty:o}=e;if("boolean"!=typeof o)return null;for(const a of[i,n,r])if(void 0!==a&&typeof a!==s(562))return null;return{dirty:o,...typeof i===s(t)?{repo:i}:{},..."string"==typeof n?{branch:n}:{},...typeof r===s(t)?{sha:r}:{}}}w_(701),w_(382),w_(452),w_(532),w_(580),w_(765),w_(783),k_(vx,w_(675)),k_(function(e){const t=562,s=552,i=562,n=552,r=420,o=562,a=562,l=562,c=552,h=w_;if(!C_(e))return null;const{schemaVersion:u,bundleId:d,sha256:f,createdAt:p,webVersion:v,author:g,git:m,fileCount:_,byteSize:x,declaredVariables:b,schedulesFingerprint:y}=e;if(1!==u)return null;if(typeof d!==h(t)||0===d[h(s)])return null;if(void 0!==f&&!/^[0-9a-f]{64}$/[h(365)](String(f)))return null;if(typeof v!==h(i)||0===v[h(n)])return null;if(typeof p!==h(568)||!Number[h(r)](p))return null;if("number"!=typeof _||!Number[h(766)](_))return null;if(typeof x!==h(568)||!Number[h(766)](x))return null;if(void 0!==g&&typeof g!==h(562))return null;let w=null;if(void 0!==m&&(w=vx(m),null===w))return null;const S=Array[h(413)](b)?b[h(584)](e=>typeof e===h(562)):[],k=typeof y===h(o)&&/^[0-9a-f]{64}$/[h(365)](y)?y:void 0;return{schemaVersion:1,bundleId:d,...typeof f===h(a)?{sha256:f}:{},createdAt:p,webVersion:v,fileCount:_,byteSize:x,...typeof g===h(l)?{author:g}:{},...w?{git:w}:{},...S[h(c)]>0?{declaredVariables:S}:{},...void 0!==k?{schedulesFingerprint:k}:{}}},w_(718)),k_(function(e){const t=689,s=588,i=w_,n=e.git;if(!n||void 0===n.branch&&void 0===n.sha)return e[i(t)];const r=n.sha?n.sha.slice(0,7):"?";return(n[i(624)]??"?")+"@"+r+(n[i(s)]?i(727):"")},w_(464));var gx=[w_(649),w_(733),w_(471),w_(770),w_(786),w_(466),w_(439),w_(759),w_(807),w_(627)];function mx(e){const t=562,s=413,i=584,n=552,r=w_;if(!Array.isArray(e))return null;const o=[];for(const a of e){if(!C_(a))continue;const{project:e,environment:l,missing:c}=a;if(typeof e!==r(t)||typeof l!==r(t))continue;if(!Array[r(s)](c))continue;const h=c[r(i)](e=>typeof e===r(562));h[r(n)]>0&&o[r(585)]({project:e,environment:l,missing:h})}return o[r(552)]>0?o:null}k_(function(e){const t=696,s=458,i=455,n=562,r=552,o=w_;if(!C_(e))return null;if(C_(e[o(696)])){const{code:s,message:i}=e[o(t)];return gx[o(788)](s)?typeof i!==o(562)?null:{error:{code:s,message:i}}:null}const{status:a,bundleId:l}=e;if(a!==o(s)&&a!==o(i))return null;if(typeof l!==o(n)||0===l[o(r)])return null;const c=mx(e.variableGaps);return null===c?{status:a,bundleId:l}:{status:a,bundleId:l,variableGaps:c}},w_(526)),k_(mx,w_(384)),w_(524),w_(445),w_(777),k_(function(e){return e[w_(708)](",")},"encodeNameList"),k_(function(e){const t=w_;return void 0===e?[]:e[t(511)](",").map(e=>e[t(671)]())[t(584)](e=>""!==e)},w_(576));var _x=/^[A-Za-z_][A-Za-z0-9_]*$/;function xx(e){return _x[w_(365)](e)&&"__proto__"!==e}function*bx(e){const t=671,s=547,i=483,n=762,r=w_;for(const o of e[r(511)](/\r?\n/)){const e=o[r(t)]();if(""===e||e[r(s)]("#"))continue;const a=e[r(i)]("=");if(a<=0)continue;const l=e[r(762)](0,a)[r(671)]();xx(l)&&(yield[l,e[r(n)](a+1)[r(671)]()])}}function yx(e){const t=w_;if(""===e)return"";if(/[\s#"'=\\]|^[`]/[t(365)](e)||/[\n\r]/[t(365)](e)){return'"'+e.replace(/\\/g,"\\\\")[t(595)](/"/g,'\\"')[t(595)](/\n/g,"\\n")[t(595)](/\r/g,"\\r")+'"'}return e}function wx(e){const t=w_,s=new Set;for(const[i]of bx(e))s[t(376)](i);return s}function Sx(e){const t=w_,s=e[t(671)]();return s.startsWith("#")&&/---/[t(365)](s)}function kx(e){const t=547,s=365,i=671,n=w_,r=e.trim();if(""===r||r[n(t)]("#"))return!1;const o=r[n(483)]("=");return o>0&&_x[n(s)](r[n(762)](0,o)[n(i)]())}function Cx(e,t){const s=483,i=671,n=w_,r=e[n(671)]();if(""===r||r[n(547)]("#"))return!1;const o=r[n(s)]("=");return!(o<=0)&&r[n(762)](0,o)[n(i)]()===t}function jx(e){const t=w_,s=e[t(648)]("\n"),i=s?e.slice(0,-1):e;return{lines:""===i?[]:i[t(511)]("\n"),trailingNewline:s}}function Nx(e,t){const s=e.join("\n");return t||""===s?s+"\n":s}k_(xx,w_(791)),k_(bx,w_(746)),k_(function(e){const t=w_,s={};for(const[i,n]of bx(e)){let e=n;if(e.length>=2){const s=e[0],i=e[e[t(552)]-1];('"'===s||"'"===s)&&s===i&&(e=e[t(762)](1,-1))}s[i]=e}return s},"parseEnvContent"),k_(yx,"serializeEnvValue"),k_(wx,w_(487)),k_(function(e){const t=w_,s=new Set;for(const i of e.split(/\r?\n/)){const e=/^\s*(?:#\s*)?([A-Za-z_][A-Za-z0-9_]*)\s*=/[t(662)](i);e&&s.add(e[1])}return s},w_(741)),k_(Sx,w_(796)),k_(kx,w_(669)),k_(Cx,w_(521)),k_(jx,"splitLines"),k_(Nx,w_(799)),k_(function(e,t,s,i){const n=821,r=481,o=552,a=585,l=585,c=w_,h=t+"="+yx(s),{lines:u,trailingNewline:d}=jx(e);if(i){const e=new RegExp("\\b"+i[c(802)]()+"\\b"),t=u[c(n)](t=>Sx(t)&&e.test(t[c(802)]()));if(-1!==t){let e=u.length;for(let r=t+1;r<u.length;r++)if(Sx(u[r])){e=r;break}let s=-1,i=-1;for(let r=t+1;r<e;r++)""!==u[r][c(671)]()&&(i=r),kx(u[r])&&(s=r);const n=s>=0?s:i,a=n>=0?n+1:t+1;return u[c(r)](a,0,h),Nx(u,d||u[c(o)]>0)}return u[c(552)]>0&&u[c(a)](""),u[c(585)](c(683)+i+c(433),h),Nx(u,!0)}return u[c(l)](h),Nx(u,!0)},"insertEnvVar"),k_(function(e,t){const s=584,i=552,n=w_,{lines:r,trailingNewline:o}=jx(e),a=r[n(s)](e=>!Cx(e,t)),l=a.length!==r[n(i)];return{content:Nx(a,o),removed:l}},"removeEnvVar"),k_(function(e,t,s){const i=w_,{lines:n,trailingNewline:r}=jx(e),o=n[i(821)](e=>Cx(e,t));return-1===o?{content:e,replaced:!1}:(n[o]=t+"="+yx(s),{content:Nx(n,r),replaced:!0})},w_(619));var Mx=w_(725),Bx=w_(655);k_(function(e){return e[w_(547)](Bx)},"isRunnerSetting");var Lx=w_(370),Dx={variable:w_(787),secret:w_(637)};function Ex(e){return"/api/box/values/"+encodeURIComponent(e)}function Px(e,t){return w_(554)+encodeURIComponent(e)+"/"+encodeURIComponent(t)+"/values"}function Rx(e,t,s,i){return Px(e,t)+"/"+Ax(s,i)}function Ax(e,t){const s=w_;if(e===s(785))return"target";if(void 0===t)throw new Error("a "+e+s(742));return Dx[e]+"/"+encodeURIComponent(t)}function zx(e,t){const s=w_;if(!C_(e))return null;const{target:i,variables:n,secrets:r}=e;if(void 0!==i&&"string"!=typeof i)return null;const o=Ix(n),a=t(r);return null===o||null===a?null:{...typeof i===s(562)?{target:i}:{},variables:o,secrets:a}}function Tx(e){const t=w_;return C_(e)&&"string"==typeof e[t(751)]?{value:e[t(751)]}:null}function Ix(e){return Hx(e,Fx)}function Ox(e){return Hx(e,e=>null===e||Fx(e))}function Hx(e,t){const s=561,i=w_;if(!C_(e))return null;const n={};for(const[r,o]of Object[i(s)](e)){if(!xx(r)||!t(o))return null;n[r]=o}return n}function Fx(e){return"string"==typeof e}k_(function(e){for(const[t,s]of Object.entries(Dx))if(s===e)return t;return null},w_(451)),k_(Ex,"boxValuesPath"),k_(function(e,t,s){return Ex(e)+"/"+Ax(t,s)},w_(497)),k_(Px,"boxEnvValuesPath"),k_(Rx,w_(571)),k_(function(e,t,s){return Rx(e,t,w_(811),s)+"/"+Lx},"boxEnvSecretRevealPath"),k_(function(e,t){return Px(e,t)+"/"+Lx},w_(761)),k_(Ax,"valueSuffix"),k_(function(e){return zx(e,Ix)},w_(620)),k_(function(e){return zx(e,Ox)},w_(440)),k_(function(e){return Tx(e)},w_(437)),k_(function(e){const t=w_;return[...Object[t(687)](e[t(787)]),...Object[t(687)](e[t(637)])].filter(e=>e===Mx)},w_(805)),k_(zx,"parseReplaceRequest"),k_(Tx,w_(579)),k_(Ix,"parseStringRecord"),k_(Ox,"parseKeepRecord"),k_(Hx,w_(553)),k_(Fx,w_(824));var Wx=[w_(649),"forbidden",w_(466),w_(367),w_(640),w_(577),w_(471),w_(439),w_(759),"ambiguous-project","storage"],Kx=[w_(785),w_(578),w_(811)];function Ux(e){const t=w_;return Array[t(413)](e)&&e[t(408)](e=>typeof e===t(562))?e:null}k_(function(e){const t=696,s=788,i=740,n=637,r=785,o=368,a=562,l=w_;if(!C_(e))return null;if(C_(e[l(696)])){const{code:i,message:n}=e[l(t)];return Wx[l(s)](i)?typeof n!==l(562)?null:{error:{code:i,message:n}}:null}const{status:c,environment:h}=e;if("string"!=typeof h)return null;if(c===l(i)){const{target:t,variables:s,secrets:i,removed:o}=e;if(typeof t!==l(719))return null;const a=Ux(s),u=Ux(i);if(null===a||null===u||!C_(o))return null;const d=Ux(o.variables),f=Ux(o[l(n)]);return typeof o[l(r)]!==l(719)||null===d||null===f?null:{status:c,environment:h,target:t,variables:a,secrets:u,removed:{target:o[l(785)],variables:d,secrets:f}}}if(c===l(o)||"removed"===c){const{kind:t,name:s}=e;return Kx.includes(t)?void 0!==s&&typeof s!==l(a)?null:{status:c,environment:h,kind:t,...typeof s===l(562)?{name:s}:{}}:null}return null},w_(793)),k_(Ux,w_(467)),k_(function(e){return Tx(e)},w_(444)),k_(function(e){return Ix(e)},w_(400));var qx=w_(674);function Vx(e){return qx+"/"+encodeURIComponent(e)}function $x(e,t){return Vx(e)+"/channels/"+encodeURIComponent(t)}function Yx(e){const t=w_;return Vx(e)+t(680)}k_(Vx,w_(474)),k_($x,w_(411)),k_(function(e,t){const s=w_;return $x(e,t)+s(403)},w_(812)),k_(function(e,t){const s=w_;return Vx(e)+s(575)+encodeURIComponent(t)},w_(566)),k_(function(e){const t=w_;return Vx(e)+t(642)},w_(590)),k_(Yx,w_(639)),k_(function(e,t){const s=w_;return Yx(e)+"/"+encodeURIComponent(t)+s(667)},"boxNotifySeriesResetPath"),k_(function(e,t){const s=w_;return Vx(e)+s(446)+encodeURIComponent(t)},w_(378)),k_(function(e,t,s){return Vx(e)+"/preview?rule="+encodeURIComponent(t)+"&state="+s},w_(377)),w_(625),w_(712),w_(538);var Gx=["schedule","ci","manual","cli"],Xx=["failed",w_(502),"not-run",w_(495)],Zx=[w_(830),"recovered",w_(789),"not-run",w_(495)],Jx=[w_(649),"unknown-project",w_(594),w_(589),w_(814),w_(392),w_(471),w_(627)];function Qx(e){const t=562,s=393,i=369,n=750,r=w_;if(!C_(e)||typeof e[r(750)]!==r(t))return null;const o=eb(e[r(s)],ib),a=eb(e[r(i)],rb),l=eb(e.mutes,ab);if(null===o||null===a||null===l)return null;const c=void 0===e[r(415)]?void 0:lb(e[r(415)]);return null===c?null:{project:e[r(n)],channels:o,rules:a,mutes:l,...void 0!==c?{quietHours:c}:{}}}function eb(e,t){const s=w_;if(!Array[s(413)](e))return null;const i=[];for(const n of e){const e=t(n);if(null===e)return null;i[s(585)](e)}return i}function tb(e){const t=w_;return C_(e)&&typeof e[t(368)]===t(719)?{set:e[t(368)]}:null}function sb(e){const t=568,s=615,i=696,n=696,r=w_;return C_(e)&&typeof e.at===r(t)?e[r(s)]!==r(729)&&e[r(615)]!==r(830)||void 0!==e.error&&"string"!=typeof e.error?null:{at:e.at,outcome:e[r(615)],...void 0!==e[r(i)]?{error:e[r(n)]}:{}}:null}function ib(e){const t=562,s=558,i=712,n=688,r=434,o=811,a=597,l=697,c=w_;if(!C_(e))return null;const{id:h,name:u,enabled:d,kind:f}=e;if(typeof h!==c(t)||typeof u!==c(t)||"boolean"!=typeof d)return null;const p=void 0===e[c(s)]?void 0:sb(e[c(558)]);if(null===p)return null;const v={id:h,name:u,enabled:d,...void 0!==p?{lastDelivery:p}:{}};switch(f){case c(625):{const t=tb(e[c(405)]);return null===t?null:{...v,kind:f,webhookUrl:t}}case c(i):{const s=tb(e[c(n)]);return null===s||typeof e[c(774)]!==c(562)||void 0!==e.threadId&&typeof e.threadId!==c(t)?null:{...v,kind:f,botToken:s,chatId:e[c(774)],...void 0!==e.threadId?{threadId:e[c(r)]}:{}}}case c(538):{const t=tb(e[c(o)]);if(null===t||"string"!=typeof e[c(697)])return null;const s=void 0===e[c(597)]?void 0:nb(e[c(a)]);return null===s?null:{...v,kind:f,url:e[c(l)],secret:t,...void 0!==s?{headers:s}:{}}}default:return null}}function nb(e){if(!C_(e))return null;const t={};for(const[s,i]of Object.entries(e)){const e=tb(i);if(null===e)return null;t[s]=e}return t}function rb(e){const t=562,s=545,i=523,n=408,r=476,o=408,a=409,l=468,c=568,h=545,u=468,d=w_;return C_(e)&&typeof e.id===d(t)&&"boolean"==typeof e[d(613)]?void 0!==e[d(s)]&&typeof e[d(s)]!==d(562)?null:(void 0===e[d(633)]||hb(e[d(633)]))&&hb(e.triggers)&&e[d(i)][d(n)](ub)&&hb(e[d(r)])&&e[d(476)][d(o)](db)&&hb(e[d(393)])&&"number"==typeof e[d(a)]?void 0!==e[d(l)]&&typeof e.repeatEvery!==d(c)?null:{id:e.id,...void 0!==e[d(h)]?{name:e.name}:{},enabled:e[d(613)],...void 0!==e.environments?{environments:e[d(633)]}:{},triggers:e.triggers,events:e.events,channels:e[d(393)],afterFailures:e[d(409)],...void 0!==e[d(u)]?{repeatEvery:e[d(468)]}:{}}:null:null}function ob(e){const t=750,s=562,i=w_;return C_(e)?!0===e[i(t)]?{project:!0}:typeof e.series===i(s)&&e.series.length>0?{series:e.series}:null:null}function ab(e){const t=562,s=380,i=568,n=562,r=706,o=w_;if(!C_(e)||typeof e.id!==o(t)||typeof e.by!==o(t))return null;const a=ob(e[o(s)]);return null===a||typeof e.at!==o(568)||void 0!==e[o(664)]&&typeof e[o(664)]!==o(i)||void 0!==e[o(706)]&&typeof e.reason!==o(n)?null:{id:e.id,scope:a,...void 0!==e.until?{until:e.until}:{},by:e.by,...void 0!==e[o(r)]?{reason:e.reason}:{},at:e.at}}function lb(e){const t=562,s=w_;if(!C_(e))return null;const{from:i,to:n,tz:r}=e;return typeof i!==s(562)||typeof n!==s(t)||typeof r!==s(t)?null:{from:i,to:n,tz:r}}function cb(e){const t=562,s=419,i=785,n=562,r=785,o=406,a=465,l=546,c=830,h=706,u=670,d=568,f=670,p=w_;if(!C_(e)||typeof e[p(819)]!==p(t)||typeof e[p(s)]!==p(562))return null;if(!C_(e[p(i)])||typeof e.target[p(545)]!==p(n))return null;if(e[p(r)][p(o)]!==p(a)&&e[p(i)].kind!==p(l))return null;if("ok"!==e.state&&e[p(658)]!==p(c))return null;if("string"!=typeof e[p(h)]||"number"!=typeof e[p(573)]||typeof e[p(u)]!==p(568))return null;if(void 0!==e[p(599)]&&typeof e[p(599)]!==p(d))return null;const v=void 0===e[p(695)]?void 0:ab(e[p(695)]);return null===v?null:{key:e.key,environment:e.environment,target:{kind:e[p(i)].kind,name:e[p(r)].name},state:e.state,reason:e[p(706)],since:e[p(573)],failures:e[p(f)],...void 0!==e.lastNotifiedAt?{lastNotifiedAt:e.lastNotifiedAt}:{},...void 0!==v?{mute:v}:{}}}function hb(e){const t=w_;return Array[t(413)](e)&&e[t(408)](e=>typeof e===t(562))}function ub(e){return Gx[w_(788)](e)}function db(e){return Xx[w_(788)](e)}function fb(e){const t=788,s=w_;return typeof e===s(562)&&Zx[s(t)](e)}k_(function(e){const t=413,s=700,i=w_;if(!C_(e)||!Array[i(t)](e[i(700)]))return null;const n=e[i(s)].map(Qx);return n.every(e=>null!==e)?{projects:n}:null},w_(636)),k_(Qx,w_(507)),k_(function(e){const t=750,s=562,i=w_;if(!C_(e)||typeof e[i(t)]!==i(s))return null;const n=eb(e.series,cb);return null===n?null:{project:e[i(750)],series:n}},w_(801)),k_(function(e){const t=658,s=697,i=697,n=562,r=574,o=w_;return C_(e)&&fb(e[o(t)])&&"string"==typeof e.title&&hb(e.lines)?void 0!==e[o(s)]&&typeof e[o(i)]!==o(n)?null:{state:e[o(658)],title:e[o(512)],lines:e[o(r)],...void 0!==e[o(697)]?{url:e[o(i)]}:{}}:null},w_(472)),k_(function(e){const t=450,s=781,i=778,n=830,r=602,o=w_;return C_(e)&&"string"==typeof e[o(t)]?e.status===o(729)?void 0!==e[o(s)]&&typeof e[o(781)]!==o(562)?null:{status:o(729),channel:e[o(t)],...void 0!==e[o(s)]?{note:e.note}:{}}:e[o(i)]===o(n)&&typeof e[o(r)]===o(562)?{status:o(830),channel:e[o(450)],message:e.message}:null:null},w_(592)),k_(function(e){const t=562,s=458,i=w_;if(!C_(e)||typeof e.id!==i(t))return null;const{status:n}=e;return n!==i(s)&&"updated"!==n&&n!==i(565)?null:{status:n,id:e.id}},"parseBoxNotifyChanged"),k_(function(e){const t=788,s=562,i=w_;if(!C_(e)||!C_(e.error))return null;const{code:n,message:r}=e[i(696)];return Jx[i(t)](n)&&typeof r===i(s)?{error:{code:n,message:r}}:null},w_(529)),k_(function(e){return fb(e)},"isBoxNotifyState"),k_(function(e){const t=407,s=676,i=w_;switch(e){case"schedule":return{kind:e};case"ci":return{kind:e,by:i(616)};case i(679):return{kind:e,by:i(t)};case i(s):return{kind:e}}},"boxNotifyPreviewTrigger"),k_(eb,w_(610)),k_(tb,w_(410)),k_(sb,w_(563)),k_(ib,"parseChannel"),k_(nb,"parseHeaderFlags"),k_(rb,w_(560)),k_(ob,"parseBoxNotifyMuteScope"),k_(ab,"parseMute"),k_(lb,"parseQuietHours"),k_(cb,w_(418)),k_(hb,"isStringArray"),k_(ub,w_(621)),k_(db,"isEvent"),k_(fb,w_(570)),w_(828),w_(374),w_(767),w_(494);var pb=[w_(649),w_(832),w_(367),w_(604),"rate-limited",w_(628),w_(493),w_(439),w_(759),"malformed"];k_(function(e){const t=w_;if(!C_(e)||!C_(e[t(696)]))return null;const{code:s,message:i,retryAfterSeconds:n}=e[t(696)];return pb[t(788)](s)?typeof i!==t(562)?null:{error:{code:s,message:i,...typeof n===t(568)?{retryAfterSeconds:n}:{}}}:null},w_(488)),k_(function(e){const t=562,s=562,i=w_;if(!Array.isArray(e))return null;const n=[];for(const r of e){if(!C_(r))return null;const{name:e,project:o,environment:a,note:l}=r;if(typeof e!==i(t)||"string"!=typeof a)return null;if(void 0!==o&&typeof o!==i(s))return null;if(void 0!==l&&typeof l!==i(562))return null;n[i(585)]({name:e,environment:a,...void 0!==o?{project:o}:{},...void 0!==l?{note:l}:{}})}return n},w_(460));function vb(e,t){return w_(554)+encodeURIComponent(e)+"/"+encodeURIComponent(t)+"/runs"}w_(760),k_(vb,w_(758)),k_(function(e,t,s){return vb(e,t)+"/"+encodeURIComponent(s)},w_(800)),k_(function(e){const t=465,s=562,i=552,n=w_;if(!C_(e))return null;const{kind:r,ref:o}=e;return r!==n(t)&&r!==n(546)||typeof o!==n(s)||0===o[n(i)]?null:{kind:r,ref:o}},w_(833)),k_(function(e){const t=562,s=552,i=w_;if(!C_(e))return null;const{runId:n,acceptedAt:r}=e;return typeof n!==i(t)||0===n[i(s)]||"number"!=typeof r?null:{runId:n,acceptedAt:r}},w_(757)),k_(function(e){const t=552,s=568,i=w_;if(!C_(e))return null;const{runId:n,state:r,exitCode:o,startedAt:a,finishedAt:l}=e;return typeof n!==i(562)||0===n[i(t)]||r!==i(705)&&"running"!==r&&"finished"!==r||null!=o&&typeof o!==i(568)||void 0!==a&&typeof a!==i(568)||void 0!==l&&typeof l!==i(s)?null:{runId:n,state:r,...void 0!==o?{exitCode:o}:{},...void 0!==a?{startedAt:a}:{},...void 0!==l?{finishedAt:l}:{}}},"parseBoxRunStatus");function gb(e){const t=w_;return Array[t(413)](e)?e[t(630)](e=>typeof e!==t(562))?null:e:null}function mb(e){const t=562,s=w_;if(!C_(e))return null;const{bundleId:i,label:n,branch:r,sha:o,dirty:a,author:l,createdAt:c,webVersion:h}=e;if(typeof i!==s(t)||0===i.length)return null;if(typeof n!==s(t)||"string"!=typeof h)return null;if(typeof a!==s(719))return null;if(typeof c!==s(568)||!Number[s(420)](c))return null;for(const u of[r,o,l])if(void 0!==u&&"string"!=typeof u)return null;return{bundleId:i,label:n,dirty:a,createdAt:c,webVersion:h,...typeof r===s(562)?{branch:r}:{},...typeof o===s(562)?{sha:o}:{},...typeof l===s(562)?{author:l}:{}}}function _b(e){const t=w_;return void 0!==e[t(465)]?{kind:t(465),name:e[t(465)]}:{kind:"scenario",name:e.scenario}}function xb(e){const t=465,s=568,i=530,n=w_;if(!C_(e))return null;const{collection:r,scenario:o,cron:a,env:l,prepare:c,workers:h,source:u}=e,d=typeof r===n(562)&&r[n(552)]>0?void 0===o?{collection:r}:null:typeof o===n(562)&&o.length>0&&void 0===r?{scenario:o}:null;if(null===d)return null;if(typeof a!==n(562)||0===a[n(671)]()[n(552)])return null;if(void 0!==l&&"string"!=typeof l)return null;if(void 0!==c&&"string"!=typeof c)return null;const f=n(t)in d&&typeof h===n(s)&&Number.isInteger(h)&&h>=1?h:void 0,p=u===n(i)||"file"===u?u:void 0;return{...d,cron:a,...void 0!==l?{env:l}:{},...void 0!==c?{prepare:c}:{},...void 0!==f?{workers:f}:{},...void 0!==p?{source:p}:{}}}k_(gb,"stringList"),k_(mb,w_(492)),k_(function(e){const t=562,s=562,i=w_;if(!C_(e))return null;if(1!==e.schemaVersion)return null;const{workspace:n,environment:r,allowSwitch:o,currentBundleId:a,switchedBy:l,switchedAt:c,bundles:h,variables:u,secrets:d,switchPath:f}=e;if(typeof n!==i(t)||typeof r!==i(s))return null;if(typeof o!==i(719))return null;if(!Array.isArray(h))return null;const p=[];for(const m of h){const e=mb(m);if(!e)return null;p[i(585)](e)}const v=gb(u),g=gb(d);if(!v||!g)return null;for(const m of[a,l,f])if(void 0!==m&&typeof m!==i(s))return null;return void 0!==c&&typeof c!==i(568)?null:{schemaVersion:1,workspace:n,environment:r,allowSwitch:o,bundles:p,variables:v,secrets:g,...typeof a===i(s)?{currentBundleId:a}:{},...typeof l===i(s)?{switchedBy:l}:{},...typeof c===i(568)?{switchedAt:c}:{},...typeof f===i(t)?{switchPath:f}:{}}},w_(498)),k_(_b,w_(748)),k_(xb,w_(548)),k_(function(e){const t=413,s=803,i=399,n=606,r=545,o=678,a=477,l=585,c=w_;if(null==e)return{entries:[]};if(!C_(e))return{error:"expected a mapping with a `schedules:` array"};const h=e[c(398)]??[];if(!Array[c(t)](h))return{error:c(s)};const u=[],d=new Set;for(const[f,p]of h[c(561)]()){const e=xb(p);if(!e)return{error:c(i)+f+c(n)};const t=_b(e),s=t[c(406)]+":"+t[c(r)];if(d[c(o)](s))return{error:"schedules["+f+c(484)+t[c(406)]+' "'+t.name+c(a)};d.add(s),u[c(l)](e)}return{entries:u}},w_(656)),k_(function(e,t){const s=678,i=545,n=w_,r=new Set(t.map(e=>{const t=Db,s=_b(e);return s[t(406)]+":"+s[t(i)]}));return[...e[n(584)](e=>{const t=n,i=_b(e);return!r[t(s)](i[t(406)]+":"+i[t(545)])})[n(815)](e=>({...e,source:n(530)})),...t.map(e=>({...e,source:n(723)}))]},w_(501)),k_(function(e){const t=428,s=430,i=430,n=453,r=447,o=447,a=w_,l=e[a(815)](e=>{const l=a,c=_b(e);return{kind:c[l(406)],name:c.name,cron:e[l(t)],...void 0!==e[l(s)]?{env:e[l(i)]}:{},...void 0!==e[l(453)]?{prepare:e[l(n)]}:{},...void 0!==e[l(r)]?{workers:e[l(o)]}:{}}})[a(792)]((e,t)=>{const s=a,i=e.kind+":"+e.name,n=t[s(406)]+":"+t[s(545)];return i<n?-1:i>n?1:0});return JSON.stringify(l)},w_(704)),k_(function(e){const t=w_;let s;try{s=JSON.parse(e)}catch{return null}if(!Array[t(413)](s))return null;const i=[];for(const n of s){const e=xb(n);e&&i[t(585)](e)}return i},w_(470));var bb={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}},yb={h2:2,h4:4,h6:6,h12:12};function wb(e){const t=738,s=798,i=412,n=587,r=666,o=457,a=537,l=w_,c=Ab(e[l(363)]);switch(e[l(t)]){case"m5":return"*/5 * * * *";case l(s):return l(i);case"h1":return c+l(422);case"h2":case"h4":case"h6":case"h12":return c+l(n)+yb[e.freq]+" * * *";case l(837):return c+" "+Ab(e[l(r)])+l(763);case l(o):return c+" "+Ab(e.hours)+" * * "+Ab(e[l(a)])}}function Sb(){const e=["vu5pvevtvf9mt0DFtevwruW","y2f0zwDVCML6zvzHCMLHyMXL","yxbWlxnLCNzLCJPYzwfKEq","CgfYC2vbBgW","yMXVyLbHDgHgB3i","C2v0twLUDxrLCW","zw5HyMXLza","vu5pvevtvf9huK9vtKrfuL9nt0rf","B3v0y29Tzq","ChvZAcbHmwiYyZnKicHTywLUkq","C2vJCMv0C0nVBNrLBNq","Dw5VDgvZDa","CMvWBgfJzuvUDLzHCG","CgfYC2vcB3HwywX1zxnszxbSywnLuMvXDwvZDa","AxnuCMLNz2vYs2LUza","vu5pvevtvf9cuK9xu0vs","vu5pvevtvf9erujvr19quKvwsuvxx0jzvevt","yNjHBMnO","C2XHy2S","y3jLyxrLzef0","C3rVCMfNzq","CNvUlwLUlxbYB2DYzxnZ","zMXHz3m","C29Tzq","x2XHDgvZDc5QC29U","Aw50zxjHy3rPDMu","zw52AxjVBM1LBNrZ","Bwf0y2G","zxzLCNKGmtuGBwLU","CgfYC2vcB3HoB3rPzNLwAwv3","C2vJCMv0CW","ztjL","yM94tM90Awz5u2vYAwvZugf0Aa","Dw5RBM93BI1ZzwnYzxq","iIbKB2vZig5VDcbZDxbWB3j0ihj1BIbRAw5Kici","l3f1Awv0lwHVDxjZ","CgfYC2vdAvj1BLjLCxvLC3q","AxnsDw5ZrgLYtMfTzq","BgLZDa","vu5pvevtvf9ot19rvuvvrq","CxvLDwvqCMLVCML0EvjHBMS","zw5KC1DPDgG","Dw5HDxrOB3jPEMvK","zgvIDwDeAxjgB3i","AxnrDwv1zurPCK5HBwu","z2v0twLUDxrLCW","nteWmtC4ogvVvuDjwq","CMvNzxHmAxrLCMfS","vu5pvevtvf8","CgfYC2vty2HLzhvSzxneB2m","AdeY","C3rHDgu","yxj0AwzHy3rZuM9VDezYB20","AxnbBM5VDgf0Aw9UtgLUzq","zw52tMfTzxngCM9TrgLYtgLZDgLUzW","zxHLyW","mtq3nta4mJLrsvD1AvO","Dw50AwW","CNvUBMvY","Ag91CNm","l3jLC2v0","z2v0vgLTzq","AxnbC3nPz25Tzw50tgLUzq","zMfPBhvYzxm","DhjPBq","lNvUB3rLC3q","sw52ywXPzejSB2jiyxnOrxjYB3i","l2fWAs9IB3GVBM90Awz5","CgfYC2vhAxrjBMzV","y2XP","x2HLBhbLCNm","AgfZ","BwfUDwfS","l3nLCMLLCW","ndmXouXqwuPzwq","vgH1","iYaTls0G","C291CMnL","BwnW","C3rKzxjYlMXVzW","A2v5CW","yM90vg9Rzw4","yNvUzgXLswq","CxvLDwvqCMLVCML0EuzYB21syw5R","zMXHDe1HCa","y29TCgfYzvf1zxvLvgLJA2v0tMfTzxm","Dw5VDgvZDc8Uzw52","C2nLBMfYAw9jBMrLEezPBgvoyw1L","Bxv0zq","zxjYB3i","DxjS","C3bLy0zYB21dCM9U","lNnLy3jLDhm","ChjVAMvJDhm","yNvUzgXLlMPZB24","v2vK","mJC4mtuWt0L3BNPb","y2fUB25Py2fSu2nOzwr1Bgvtzxq","CxvLDwvK","CMvHC29U","AxngywLSAw5Nu3rHDhvZ","AM9PBG","zMfPBhvYzxnsB290vw5Kzxi","igf0ia","C2HHCMreAxjgB3i","DgvSzwDYyw0","CgfK","lNnUyxbZAg90CW","DgvYBwLUywW","z2L0AhvI","vu5pvevtvf9kvurhrv9nt0rfta","CgfYC2vcDw5KBgvnyw5PzMvZDa","yM9VBgvHBG","vu5pvevtvf9kvurhrv9dquXmx1rjtuvpvvrFtvm","zgvIDwDNzxjgAwXLrM9Y","vu5pvevtvf9rvuvvrv9mruftrq","zMLSzq","vu5pvevtvf9kvurhrv9dtefvrevFqKLo","qvbqx0jbu0vFvvjm","CM91BMq","icH3AxaP","vw5WBgfJzwfIBgvsDw5jzevYCM9Y","C2vUDa","rNjP","BMv4DfrPy2TgCM9Tu3bLyW","BwfUAwzLC3ruCMLNz2vY","Dg9VlwXHCMDL","z2v0sg91CNm","C2nLBMfYAw9szwzgCM9TrMLSzu5HBwu","C2fUAxrPEMvsDw5jzfnLz21LBNq","zxHWzwn0lwzHAwW","zNjLCq","CNvU","CMvWBgfJzwq","zgvJBgfYzwrfBNzlzxLZ","ig5LzwrZigeGBMfTzq","ndeYnti0ouHMwurqra","y29TCgXLDgvK","vu5pvevtvf9kvurhrv9mt0DFtevwruW","yxnZAwDUBwvUDevUDhjPzxm","DgvTCgXHDgu","C2nOzwr1BgvuyxjNzxq","yxbW","ChjVAMvJDa","DMfSDwu","CgLJA2vYlxnUyxbZAg90lNr4Da","zMfPBhvYzxnsB290rNjVBq","CMfUAW","y2fUBM90igXVywqGCNvUBMvYigfKyxb0zxiGiG","yMXVyLjLBfbHDgHgB3i","CgfYC2vcB3HsDw5by2nLChrLza","yM94uNvUC1bHDgG","CMv2B2nHDgLVBI1SAxn0lxvUyxzHAwXHyMXL","Ec11BM90zxn0lwD1yxjKlxnLy3jLDa","yM94rw52u2vJCMv0C1jLDMvHBfbHDgG","C2XPy2u","icOGkIaQ","vu5pvevtvf9svu5Fqunut1i","Dw5VC18","AxnjBNrLz2vY","Ec11BM90zxn0lwvUDMLYB25Tzw50","Dg9tDhjPBMC","uNvUBMvY","AwqTBwLZBwf0y2G","C2nOzwr1Bgu","vu5pvevtvf9erujvrW","vu5pvevtvf9kvurhrv9it1nu","y2HHDeLK","DgvZDerPCKzVCG","vu5pvevtvf9rvuvvrv9hte9cquXFu0Xpvfm","vu5pvevtvf9ct1HFu0vduKvux05btuvt","C3rHDhvZ","zgvZy3jPyMvtCgvJ","vu5pvevtvf9erujvr19nqvHFqLLurvm","BM90zq","CNvUBMLUzW","vu5pvevtvf9tq0HfrfvmrvnFrKLor0vsufjjtLq","DMLLD2vY","DgfYz2v0","BwLUlxzLCNnPB24","DMfYAwfIBgvZ","Aw5JBhvKzxm","C3rPBgWTzMfPBgLUzW","CgfYC2u","AxnfBNzwyxjoyw1L","C29YDa","CgfYC2vcB3HwywX1zxnszxnWB25Zzq","iokaLcbWAwnRigeGzgLMzMvYzw50ig5HBwuGB3iGzwrPDcb0AguGzxHPC3rPBMCGDMfSDwuU","iI4G","Axntzwn0Aw9UrgL2AwrLCG","C2XVDhm","Bte1","AM9PBKXPBMvZ","yM94uNvUugf0Aa","CgfYC2vcB3HoB3rPzNLtzxjPzxnwAwv3","Dg9mB3DLCKnHC2u","yhnJAgvKDwXLCZPGig11C3qGyMuGyw4GyxjYyxK","igLZigfSC28GC2v0igLUihvUB3rLC3qVlNnLy3jLDhmG4OcuihrOzsbZzwnYzxqGDMfSDwuGC2HHzg93CYb0AgLZig9Uzs4","CMvZzxj2zwrcB3HwywX1zu5HBwvZ","lMPZB25S","yw1IAwD1B3vZlxbYB2PLy3q","zhvWBgLJyxrL","u2f0","vu5pvevtvf9kvurhrv9nt0rf","C2vJCMv0","yM94tM90Awz5vgvZDfbHDgG","x2nVBgXLy3rPB25Z","Dw5RBM93BI1TDxrL","BwfW","lMvUDG","vu5pvevtvf9gquLmvvjfu19st09u","vu5pvevtvf9tte9xx01p","A2v5","igLZigfSC28GC2v0igLUihvUB3rLC3qVlMvUDIdIGjqGDgHLihnLy3jLDcb2ywX1zsbUB3CGC2HHzg93CYbPDc4","zMLUzeLUzgv4","zgvMAw5LuhjVCgvYDhK","lNzPzxDLCI5SB2nR","AxntDhjPBMC","lNzPzxDLCI5SB2C","zgvZy3jPyMvdCM9U","Dw5RBM93BI1IDw5KBgu","vu5pvevtvf9ct1HFuKvbrf9ut0TftG","z2v0uMfUzg9TvMfSDwvZ","zMfPBgvK","AxnsDw5UzxjdB25MAwDlzxK","zM9YyMLKzgvU","CgfYC2vcB3HsDw5szxf1zxn0","BxvZDcbUB3qGyMuGiI4Iig9YiciUlIi","vu5pvevtvf9kvurhrv9usu1ft1vux01t","igLZigfSC28GC2v0igLUihLVDxiGC2HLBgWGzw52AxjVBM1LBNqG4OcuigL0ihDPBgWGA2vLCcbYzxnVBhzPBMCGzNjVBsb0AgvYzsaODgHLigvUDMLYB25Tzw50ihDPBNmGB3zLCIb0AguGzMLSzsKU","zgfPBhK","Dw5VDgvZDc8UC2vJCMv0CW","ChjVAMvJDff1zxvLuM9VDa","z2v0rgf5","uNvUBMvYtM90q29UzMLNDxjLzevYCM9Y","vu5pvevtvf9erujvr19lruvqx0nbteXt","yMXVyNnsB290rM9Y","BwLUDxrLCW","mtm0ntu4ng5RqvDuwG","DgvZDa","zNjLzxPL","Dw5RBM93BI1LBNzPCM9UBwvUDa","C2v0","CNvSzxm","CMv2zwfS","zw52q29UDgvUDa","rK9sq0vFq09mt1i","BM93","DwjYxW","ig11C3qGyMuGvvbqrvjFu05bs0uGkguUzY4Gqvbqx0jbu0vFvvjmksbZBYbHihnJzw5HCMLVignHBIbYzwzLCMvUy2uGAxqGyNKGBMfTzs4","ywrK","yM94tM90Awz5uhjLDMLLD1bHDgG","yM94tM90Awz5txv0zvbHDgG","BNvTyMvYCW","C2nVCgu","CNvUvhjPz2DLCKvUDG","l2fWAs9IB3GVyNvUzgXLCW","CgfYC2vuAwnRzxrdAq","CgfYC2vwyxjPywjSzuDHChm","BM8Ty29SBgvJDgLVBNm","vu5pvevtvf9kvurhrv9srvrssuvt","BwfPBNrLBMfUy2u","CgfYC2vdAvj1BLjLC3bVBNnL","vu5pvevtvf9huK9vtKrfuL9sru1pvevFvvjm","igfSCMvHzhKGzxHPC3rZigLUia","zMfPBgLUz1nPBMnL","Dw5RBM93BI1ZzxjPzxm","y2HHBM5LBhm","C2vJCMv0C0XHEwvYrMLSzxngB3i","C2HHCMreyxLZrgvZy2vUzgLUzW","CNvUvhjPz2DLCKzYB21fBNy","nJCXveH6A3rM","C2nOzwr1BgvZ","C2nOzwr1BgvZwW","CgfYC2vcB3HtzwnYzxrZuMv2zwfSuMvZCg9UC2u","C2v0u2vJB25KCW","DMfSAwrHDgvdB2XSzwn0Aw9UtMfTzq","l3rLC3q","C2HH","D2vIAg9VA1vYBa","A2LUza","AxzHBG","zxzLCNK","ywz0zxjgywLSDxjLCW","CgfYC2vtzwnYzxq","yM94tM90Awz5q2HHBM5LBfbHDgG","kI8XnsaQicOGkIaQ","AxnbCNjHEq","vu5pvevtvf9kvurhrv9bq0nfu1nFve9lru4","CxvPzxriB3vYCW","x3nJzw5HCMLVCW","y29TBwfUzhmUANnVBMW","CgfYC2vtzxjPzxnfBNrYEq","zw52AxjVBM1LBNq","AxngAw5PDgu","C2vJCMv0C0zPBgvgB3i","icOGkIaQicO","zM9SzfnJzw5HCMLVuNvU","CNvUswqGy2fYCMLLCYbUBYb0Aw1LC3rHBxaSignHBM5VDcbWBgfJzsbPDcbPBIbHihnOyxjKoIa","y3j5ChrV","z2v0vvrdrgf0zq","vu5pvevtvf9buLrjrKfdvfnFuK9pva","y3jVBG","CMvZzxj2zwrvBMrLCNnJB3jL","zw52","Dg9KyxKG","Ag91CMX5","ic0Tlq","DgHYzwfKswq","ywjVCNrLza","CgfKu3rHCNq","CgfYC2vcB3HwywX1zvnLDfjLCxvLC3q","B2jQzwn0","zxHWAxjLza","CgfYC2vcB3HfBNzwywX1zxnszxbSywnLuMvXDwvZDa","yxrnAw51DgvZ","vu5pvevtvf9erujvr19esvi","kI8Xnq","CgfYC2vcB3HtzwnYzxrszxzLywXszxnWB25Zzq","yNvUzgXLza","l211DgvZlW","D29YA2vYCW","CNvUrgLYrM9Y","vvrd","y2HHBM5LBa","yM94vMfSDwvlAw5Kt2ztzwDTzw50","vu5pvevtvf9ct1HFvvjm","ChjLCgfYzq","vu5pvevtvf9qt1bvuf9huKfdrv9nuW","zxHPC3rZ","qxbW","D2vLA2X5","y3jLyxrLza","AgvHCNrIzwf0","CgfYC2vcB3HszwfKrw52AxjVBM1LBNrZ","vu5pvevtvf9eruzbvuXux1rjtuvpvvrFtvm","vu5pvevtvf9kvurhrv9ut0TftG","CNvUswrtDgfYDgvKqxq","zgvZy3jPyMvcDw5KBgu","y29SBgvJDgLVBG","C2nVCguTBwLZBwf0y2G","CgfYC2voyw1LtgLZDa","CMvWzwf0rxzLCNK","yxbWlxnLCNzLCJPLCNjVCG","CgfYC2vty2HLzhvSzxnkC29U","BwfSzM9YBwvK","CgfYC2vcB3HoB3rPzNLqCMv2Awv3","CMfUzg9T","yM94tM90Awz5uhjVAMvJDfbHDgG","vu5pvevtvf9kvurhrv9wt1rf","zxzLBNrZ","iIdIGjqGB25LihnJAgvKDwXLihbLCIb0yxjNzxq","vhvL","CNvUBMvYici","zMfPBfn0CMvHAW","C3bSAwnL","C3rLChmUANnVBMW","Aw5KzxHpzG","xsbYzxbLyxrZia","zw52tgf5zxjgAwXLC0zVCG","vu5pvevtvf9kvurhrv9qt1ju","zw52s2v5CW","CgfYC2vcB3HszwfKrxjYB3i","zgfPBhKGyxqG","DMfSAwrHDgvgC1nHzMvoyw1L","C2v0sg91CNm","CgfYC2vcDw5KBgu","Dw5HDMfPBgfIBgu","l19NDwfYzc9HCgKVzw52CW","CgfZC2vK","ChjVDMLKzxi","yM94vMfSDwvqyxrO","CgfYC2vxB3jRC3bHy2vgAwXL","DMfSAwrHDgvtzwDTzw50tMfTzq","l2P1zgDL","BwvYz2vty2HLzhvSzxm","CMvJB3zLCMvK","mta0nhPcyMLSCq","nvr1BxfzDG","x2jSB2jZ","lY5Kzwj1z2DLCG","CgfYC2vcB3HoB3rPzNLqCM9Qzwn0vMLLDW","z2v0vvrdtw9UDgG","ywn0AxzLrw52tMfTzq","zxHHBxbSzq","C3bSAxq","DgL0Bgu","BwfUAwzLC3qUANnVBG","lM11Dgv4","l2HLywX0Aa","vu5pvevtvf9dt05tt0Xf","CMvNzxG","Dg9TB3jYB3CG","tK9Fq09mt1i","CxvLDwveAxjgB3i","AxnbC3nPz25Tzw50t2y","zxzLCNKGnsbTAw4","DhjPz2DLCNm","vu5pvevtvf9cuK9xu0vsx0niqu5oruW","CNvUC0rPCKzVCG","CgfYC2vcDw5KBgvvCgXVywrszxnWB25Zzq","yMXVyLjLBfnLz21LBNrZrM9Y","BxvZDcbUB3qGC3rHCNqGD2L0AcaNlIC","CgfYC2vcB3HoB3rPzNLfCNjVCG","y29UzMLN","CgfYC2vrDwv1zvrPy2TLDe5HBwu","vu5pvevtvf9ct1HFve9lru4","zM9YBwf0tMv4DfrPy2S","Dw5RBM93BI1YDw5UzxiTA2v5","vu5pvevtvf9rvuvvrv9hte9cquXFreLs","C2HHCMrqyxrOrM9YvgLTzxn0yw1W","zgf5CW","D2vIAg9VAW","C291CMnLCY5QC29U","ChjVAMvJDfj1BKrPCKzVCG","BxvZDcbUB3qGC3rHCNqGD2L0AcaNxYCGkhjLC2vYDMvKkq","BwfRzvf1zxvLvgLJA2v0tMfTzq","vu5pvevtvf9kvurhrv9vuKW","BxvZDcbIzsbHihn0CMLUzW","BMfTzq","C2nLBMfYAw8","C3rHCNrZv2L0Aa","CgfYC2vty2HLzhvSzuvUDhj5","Aw50zxjYDxb0zwq","ntu3mtHcyNzcrNC","CgLK","BgvUz3rO","CgfYC2voyw1LzfjLy29Yza","l2fWAs9IB3GVzw52CY8","lMrLyNvN","zMXVB3i","vu5pvevtvf9ftLy","BgfZDerLBgL2zxj5","Ag9ZDa","CgfYC2vsDwXL","zw50CMLLCW","C3rYAw5N","CgfYC2vmyxn0rgvSAxzLCNK","uNvUBMvYqwrHChrLCK5VDezVDw5KrxjYB3i","CMvTB3zLza","yM94tM90Awz5uNvSzvbHDgG","zhvYyxrPB25nCW","BNvTyMvY","C3rHCNrLzef0","AxntDgf0zq","yM94rw52vMfSDwvqyxrO","yxbWlxnLCNzLCJPYzxvZzwq","C2LUy2u","BgLUzxm","l3j1BgvZlW","zgvJB2rLtMfTzuXPC3q","CMvZzxj2zwq","DMfYAwfIBgu","CgfYC2vwywX1zuvUDMvSB3bL","Dw5VyL8","C3rKB3v0lMXVzW","CgfYC2vty2vUyxjPB0fUBM90yxrPB25Z","vu5pvevtvf9mt0nbteu","zMLSDgvY","ChvZAa","ne9ez0nxua","icOV","zgLYDhK","Dw5RBM93BI1YDwXL","yM94tM90Awz5uxvPzxriB3vYC1bHDgG","C3bLy01HDgnOzxm","CgfYC2vcB3HoB3rPzNLuzxn0uMvZDwX0","Aw52ywXPzc1Uyw1L","Dw5RBM93BI1JAgfUBMvS","CMvWBgfJzq","C2fTCgXL","AgvHzgvYCW","vu5pvevtvf9usu1fwK9orq","BgfZDe5VDgLMAwvKqxq","tw9U","AxnuzxjTAw5HBfj1BNrPBwvtDgf0zq","BwvZC2fNzq","lMPZB24","BM90lwzVDw5K","vu5pvevtvf9eruzbvuXux05bvKLhqvrjt05FveLnru9vvf9nuW","xsbPCYbUB3qGysb2ywXPzcbLBNrYEsdIGjqGAxqGBMvLzhmGzxHHy3rSEsbVBMuGB2yGygnVBgXLy3rPB246ycaVigbZy2vUyxjPBZPGihbSDxmGysbGy3jVBJPGihn0CMLUzW"];return(Sb=function(){return e})()}function kb(e){const t=443,s=w_,i=e[s(671)]().split(/\s+/);if(5!==i[s(552)])return null;const[n,r,o,a,l]=i;if("*"!==o||"*"!==a)return null;if("*"===r&&"*"===l){if("*/5"===n)return Rb("m5");if(n===s(t))return Rb("m15");const e=zb(n);return e&&Rb("h1",e)}const c=zb(n);if(!c)return null;const h=/^\*\/(\d+)$/.exec(r);if(h&&"*"===l){const e=Object.keys(yb).find(e=>yb[e]===Number(h[1]));return e?Rb(e,c):null}const u=zb(r);if(!u)return null;if("*"===l)return Rb(s(837),c,u);const d=zb(l);return d&&Rb(s(457),c,u,d)}function Cb(e){const t=kb(e);return t?jb(t):e}function jb(e){const t=522,s=798,i=635,n=432,r=837,o=815,a=w_;switch(e[a(738)]){case"m5":return a(t);case a(s):return a(i);case"h1":return a(n)+Ib(e[a(363)]);case"h2":case"h4":case"h6":case"h12":return"every "+yb[e[a(738)]]+"h"+Ib(e[a(363)]);case a(r):return a(489)+Ob(e);case a(457):return e[a(537)][a(o)](e=>Eb[e]??String(e))[a(708)](", ")+" at "+Ob(e)}}function Nb(e,t){const s=401,i=612,n=652,r=668,o=w_,a=new Date(t);a[o(s)](0,0);for(let l=0;l<11520;l++)if(a[o(i)](a[o(n)]()+1),Mb(e,a))return a[o(r)]();return a[o(668)]()}function Mb(e,t){const s=734,i=788,n=657,r=738,o=837,a=788,l=363,c=788,h=w_,u=t[h(652)](),d=t[h(s)]();switch(e.freq){case"m5":return u%5==0;case h(798):return u%15==0;case"h1":return e[h(363)][h(i)](u);case"h2":case"h4":case"h6":case h(n):return e[h(363)][h(788)](u)&&d%(yb[e[h(r)]]??1)===0;case h(o):return e.minutes[h(a)](u)&&e[h(666)][h(788)](d);case"weekly":return e[h(l)][h(788)](u)&&e.hours[h(i)](d)&&e.days[h(c)](t[h(840)]())}}function Bb(e,t){const s=734,i=652,n=518,r=w_,o=new Date(e),a=new Date(t),l=Tb(o[r(s)]())+":"+Tb(o[r(i)]()),c=Math[r(726)]((Lb(o)-Lb(a))/864e5);return 0===c?r(431)+l:1===c?r(n)+l:Eb[o[r(840)]()]+" "+l}function Lb(e){const t=w_,s=new Date(e);return s[t(491)](0,0,0,0),s[t(668)]()}function Db(e,t){e-=361;const s=Sb();let i=s[e];if(void 0===Db.qoxkEg){Db.ZYNkib=function(e){let t="",s="";for(let i,n,r=0,o=0;n=e.charAt(o++);~n&&(i=r%4?64*i+n:n,r++%4)?t+=String.fromCharCode(255&i>>(-2*r&6)):0)n="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=".indexOf(n);for(let i=0,n=t.length;i<n;i++)s+="%"+("00"+t.charCodeAt(i).toString(16)).slice(-2);return decodeURIComponent(s)},Db.VxSPhj={},Db.qoxkEg=!0}const n=e+s[0],r=Db.VxSPhj[n];return r?i=r:(i=Db.ZYNkib(i),Db.VxSPhj[n]=i),i}k_(wb,"cronFromSpec"),k_(kb,w_(698)),k_(Cb,w_(826)),k_(jb,w_(779)),k_(Nb,w_(731)),k_(Mb,w_(591)),k_(Bb,w_(533)),k_(Lb,"startOfDay");var Eb=["Sun",w_(600),w_(478),w_(702),w_(682),w_(730),w_(809)],Pb=[1,2,3,4,5,6,0];function Rb(e,t=[0],s=[3],i=[1]){return{freq:e,minutes:t,hours:s,days:i}}function Ab(e){const t=w_;return[...e].sort((e,t)=>e-t)[t(708)](",")}function zb(e){const t=w_;return/^\d+(,\d+)*$/.test(e)?e.split(",")[t(815)](Number):null}k_(Rb,"spec"),k_(Ab,w_(645)),k_(zb,w_(379));var Tb=k_(e=>String(e)[w_(436)](2,"0"),w_(713));function Ib(e){const t=w_;return 1===e[t(552)]&&0===e[0]?"":t(710)+[...e].sort((e,t)=>e-t).map(e=>":"+Tb(e))[t(708)](", ")}function Ob(e){const t=691,s=w_,i=[...e[s(666)]].sort((e,t)=>e-t)[s(t)](t=>[...e[s(363)]][s(792)]((e,t)=>e-t).map(e=>Tb(t)+":"+Tb(e))),n=i[s(762)](0,4),r=i[s(552)]-n[s(552)];return n.join(", ")+(r>0?" +"+r:"")}k_(Ib,w_(441)),k_(Ob,"times");var Hb=w_(505),Fb=/^[0-9a-f]{8,}$/,Wb=(k_(t=class extends Error{constructor(e){const t=w_;super("blob hash must be lowercase hex, got: "+e),this[t(545)]=t(673)}},"InvalidBlobHashError"),t);function Kb(e,t,s=0){const i=w_;if(!Fb[i(365)](e))throw new Wb(e);const n=s>0?"~"+s:"";return[Hb,e[i(762)](0,2),e.slice(2,4),""+e+n+"."+t]}function Ub(e,t,s=0){const i=w_;return Kb(e,t,s)[i(708)]("/")}k_(function(e,t,s,i=0){return e+"/"+Ub(t,s,i)},w_(611)),k_(Kb,w_(527)),k_(Ub,w_(756)),k_(function(e){return e+"/"+Hb},w_(362));var qb=/[\\/:*?"<>|\x00-\x1f]/;function Vb(e,t){const s=671,i=834,n=547,r=541,o=w_;if("string"!=typeof e)return o(544);const a=e[o(s)]();return 0===a.length?"must not be empty":"."===a||".."===a?o(i):a[o(n)](".")?o(528):(null==t?void 0:t[o(429)])&&a.startsWith("_")?o(r):qb[o(365)](a)?'must not contain \\ / : * ? " < > | or control characters':null}function $b(e){return Vb(e)}k_(Vb,w_(490)),k_($b,w_(402));var Yb=w_(513),Gb="UNOTEST_RUN_TRIGGER",Xb=w_(764),Zb=[w_(771),"ci",w_(679),w_(676)];k_(function(e){var t,s;const i=671,n=788,r=w_,o=null==(t=e[Gb])?void 0:t[r(i)]();if(!o||!Zb[r(n)](o))return;const a=null==(s=e[Xb])?void 0:s.trim();return{kind:o,...a?{by:a}:{}}},w_(396)),k_(function(e){const t=w_;return{[Gb]:e[t(406)],...void 0!==e.by?{[Xb]:e.by}:{}}},w_(381)),k_(function(e){return e.trigger??{kind:"cli"}},w_(732)),w_(539),k_(class extends Error{constructor(e,t){const s=w_;super(s(479)+t+s(641)+e+'"'),this.name="UnsupportedRunKindError"}},"UnsupportedRunKindError"),k_(class extends Error{constructor(e,t){const s=w_;super(s(755)+e+s(795)+t),this[s(545)]=s(564)}},w_(564)),k_(class extends Error{constructor(e){const t=w_;super(e),this[t(545)]="RunnerNotConfiguredError"}},w_(841));var Jb=w_(737),Qb=/^\s*\/\/\s*@([a-z0-9-]+)\s*$/;function ey(e){return Vb(e,{reservedUnderscore:!0})}k_(function(e){return Qb[w_(365)](e)},w_(660)),k_(function(e){const t=671,s=634,i=678,n=w_,r=new Set;for(const o of e[n(511)](/\r?\n/)){const e=o[n(t)]();if(""===e)continue;if(!e.startsWith("//"))break;const i=e[n(s)](Qb);i&&r.add(i[1])}return{expectFail:r[n(i)](Jb)}},w_(582)),k_(ey,w_(499));var ty=w_(715),sy=new Set([w_(622),w_(524),"UNOTEST_HEADED",w_(818),w_(461),w_(605),w_(454),w_(583),w_(598),w_(607),w_(772),w_(442),w_(780),w_(623),"UNOTEST_DEBUG_HTML_MAX_BYTES",w_(361),"UNOTEST_NETWORK",w_(516),"UNOTEST_STEP_SCREENSHOTS","UNOTEST_CACHE_DIR",w_(452),w_(614),w_(389),w_(519),w_(372),"DATABASE_URL"]);function iy(e){return sy[w_(678)](e)}function ny(e){return/^[A-Z][A-Z0-9_]*$/[w_(365)](e)}k_(iy,w_(831)),k_(function(e){const t=545,s=749,i=w_;return e[i(684)]===i(637)?"secret":iy(e[i(t)])?"runner":i(s)},w_(608)),k_(ny,"isExternalVarName");var ry={app:w_(456),runner:w_(769),secret:void 0};k_(function(e){const t=665,s=534,i=375,n=371,r=811,o=637,a=637,l=637,c=838,h=808,u=390,d=794,f=585,p=804,v=w_,{name:g,kind:m}=e;if(m===v(t)){if(!iy(g))return{ok:!1,code:v(s),message:g+" is not a known runner setting — choose one from the runner-config list."}}else if(!ny(g))return{ok:!1,code:v(593),message:g+v(i)};const _=wx(e[v(n)]).has(g),x=wx(e[v(617)])[v(678)](g),b=m===v(r)?v(o):v(430),y=b===v(a)?x:_,w=b===v(l)?v(c):"unotest/.env";if(y)return{ok:!1,code:v(h),message:g+v(u)+w+v(d)};const S=[];return m===v(811)&&_&&S[v(f)](g+v(820)),m!==v(811)&&x&&S[v(f)](g+v(p)),{ok:!0,target:b,sectionLabel:ry[m],warnings:S}},"planAddVariable"),k_(function(e,t,s){return void 0!==s&&s!==t?[e+w_(836)]:[]},"deleteShadowWarning");var oy=[w_(744),w_(830),w_(435)];function ay(...e){return e.filter(Boolean).join(" ")}k_(function(e){return oy[w_(788)](e)},w_(601)),w_(500),w_(515),w_(810),w_(543),w_(462),w_(835),w_(717),w_(720),w_(386),w_(475),w_(414),w_(724),w_(773),w_(486),w_(745);const ly={clock:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("circle",{cx:"12",cy:"12",r:"9"}),Ss.jsx("path",{d:"M12 7v5l3 2"})]}),user:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("circle",{cx:"12",cy:"8",r:"3.5"}),Ss.jsx("path",{d:"M5.5 20a6.5 6.5 0 0 1 13 0"})]}),search:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("circle",{cx:"11",cy:"11",r:"7"}),Ss.jsx("path",{d:"m20 20-3.5-3.5"})]}),refresh:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("path",{d:"M3 12a9 9 0 0 1 15.5-6.3L21 8"}),Ss.jsx("path",{d:"M21 3v5h-5"}),Ss.jsx("path",{d:"M21 12a9 9 0 0 1-15.5 6.3L3 16"}),Ss.jsx("path",{d:"M3 21v-5h5"})]}),sun:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("circle",{cx:"12",cy:"12",r:"4"}),Ss.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:Ss.jsx("path",{d:"M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8Z"}),monitor:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("rect",{x:"3",y:"4",width:"18",height:"12",rx:"2"}),Ss.jsx("path",{d:"M8 20h8M12 16v4"})]}),chevronR:Ss.jsx("path",{d:"m9 6 6 6-6 6"}),chevronD:Ss.jsx("path",{d:"m6 9 6 6 6-6"}),check:Ss.jsx("path",{d:"M5 12.5 10 17l9-10"}),x:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("path",{d:"M6 6l12 12"}),Ss.jsx("path",{d:"M18 6 6 18"})]}),alert:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("circle",{cx:"12",cy:"12",r:"9"}),Ss.jsx("path",{d:"M12 8v5"}),Ss.jsx("path",{d:"M12 16.5h.01"})]}),play:Ss.jsx("path",{d:"M7 5v14l12-7Z"}),pause:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("rect",{x:"6",y:"5",width:"4",height:"14",rx:"0.5"}),Ss.jsx("rect",{x:"14",y:"5",width:"4",height:"14",rx:"0.5"})]}),square:Ss.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"}),camera:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("path",{d:"M3 8h3l2-2.5h8L18 8h3v11H3Z"}),Ss.jsx("circle",{cx:"12",cy:"13",r:"3.5"})]}),terminal:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("path",{d:"m5 8 4 4-4 4"}),Ss.jsx("path",{d:"M12 18h7"})]}),network:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("circle",{cx:"12",cy:"6",r:"2"}),Ss.jsx("circle",{cx:"6",cy:"18",r:"2"}),Ss.jsx("circle",{cx:"18",cy:"18",r:"2"}),Ss.jsx("path",{d:"M12 8v3M6 16l5-5M18 16l-5-5"})]}),tree:Ss.jsx("path",{d:"M4 5h6M4 12h10M4 19h14"}),home:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("path",{d:"M4 10.5 12 4l8 6.5V19a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1Z"}),Ss.jsx("path",{d:"M9.5 20v-6h5v6"})]}),file:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("path",{d:"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8Z"}),Ss.jsx("path",{d:"M14 3v5h5"})]}),code:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("path",{d:"m9 8-5 4 5 4"}),Ss.jsx("path",{d:"m15 8 5 4-5 4"})]}),braces:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("path",{d:"M8 4H7a3 3 0 0 0-3 3v3l-1 2 1 2v3a3 3 0 0 0 3 3h1"}),Ss.jsx("path",{d:"M16 4h1a3 3 0 0 1 3 3v3l1 2-1 2v3a3 3 0 0 1-3 3h-1"})]}),variable:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("path",{d:"M5 5c-2 4-2 10 0 14"}),Ss.jsx("path",{d:"M19 5c2 4 2 10 0 14"}),Ss.jsx("path",{d:"m9 15 6-6"}),Ss.jsx("path",{d:"m9 9 6 6"})]}),layers:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("path",{d:"m12 3 9 5-9 5-9-5 9-5Z"}),Ss.jsx("path",{d:"m3 13 9 5 9-5"}),Ss.jsx("path",{d:"m3 18 9 5 9-5"})]}),list:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("path",{d:"M9 6h12M9 12h12M9 18h12"}),Ss.jsx("circle",{cx:"4",cy:"6",r:"1"}),Ss.jsx("circle",{cx:"4",cy:"12",r:"1"}),Ss.jsx("circle",{cx:"4",cy:"18",r:"1"})]}),history:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("path",{d:"M3 12a9 9 0 1 0 3-6.7L3 8"}),Ss.jsx("path",{d:"M3 3v5h5"}),Ss.jsx("path",{d:"M12 7v5l3 2"})]}),activity:Ss.jsx("path",{d:"M3 12h4l3-8 4 16 3-8h4"}),plus:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("path",{d:"M12 5v14"}),Ss.jsx("path",{d:"M5 12h14"})]}),trash:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("path",{d:"M4 7h16"}),Ss.jsx("path",{d:"M9 7V4h6v3"}),Ss.jsx("path",{d:"M6 7v13a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7"}),Ss.jsx("path",{d:"M10 11v7M14 11v7"})]}),grip:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("circle",{cx:"9",cy:"6",r:"1"}),Ss.jsx("circle",{cx:"9",cy:"12",r:"1"}),Ss.jsx("circle",{cx:"9",cy:"18",r:"1"}),Ss.jsx("circle",{cx:"15",cy:"6",r:"1"}),Ss.jsx("circle",{cx:"15",cy:"12",r:"1"}),Ss.jsx("circle",{cx:"15",cy:"18",r:"1"})]}),panel:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1.5"}),Ss.jsx("path",{d:"M9 4v16"})]}),panelRight:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1.5"}),Ss.jsx("path",{d:"M15 4v16"})]}),externalL:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("path",{d:"M14 4h6v6"}),Ss.jsx("path",{d:"m20 4-9 9"}),Ss.jsx("path",{d:"M19 14v5a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5"})]}),copy:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2"}),Ss.jsx("path",{d:"M5 15V5a2 2 0 0 1 2-2h10"})]}),folder:Ss.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:Ss.jsxs(Ss.Fragment,{children:[Ss.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"}),Ss.jsx("path",{d:"M12 10v6"}),Ss.jsx("path",{d:"M9 13h6"})]}),package:Ss.jsxs(Ss.Fragment,{children:[Ss.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"}),Ss.jsx("path",{d:"m3.3 7 8.7 5 8.7-5"}),Ss.jsx("path",{d:"M12 22V12"})]}),clipboard:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",ry:"1"}),Ss.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:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("path",{d:"M3 11V5a2 2 0 0 1 2-2h6"}),Ss.jsx("path",{d:"M21 13V5a2 2 0 0 0-2-2h-4"}),Ss.jsx("path",{d:"M3 13v6a2 2 0 0 0 2 2h6"}),Ss.jsx("path",{d:"m13 13 8 8"}),Ss.jsx("path",{d:"m17 13 4 4"})]}),more:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("circle",{cx:"5",cy:"12",r:"1.2"}),Ss.jsx("circle",{cx:"12",cy:"12",r:"1.2"}),Ss.jsx("circle",{cx:"19",cy:"12",r:"1.2"})]}),spinner:Ss.jsx("path",{d:"M21 12a9 9 0 1 1-6.2-8.55"}),edit:Ss.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:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("path",{d:"M9 8V6a3 3 0 1 1 6 0v2"}),Ss.jsx("rect",{x:"6",y:"8",width:"12",height:"11",rx:"6"}),Ss.jsx("path",{d:"M12 12v7M3 13h3M18 13h3M5 7l3 2M19 7l-3 2M5 19l3-2M19 19l-3-2"})]}),stepOver:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("path",{d:"M4 12a8 8 0 0 1 14-5"}),Ss.jsx("path",{d:"M18 3v5h-5"}),Ss.jsx("circle",{cx:"12",cy:"18",r:"1.6",fill:"currentColor",stroke:"none"})]}),bp:Ss.jsx("circle",{cx:"12",cy:"12",r:"5",fill:"currentColor",stroke:"none"}),arrowR:Ss.jsx("path",{d:"m9 6 8 6-8 6Z",fill:"currentColor",stroke:"none"}),minus:Ss.jsx("path",{d:"M5 12h14"}),claude:Ss.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:Ss.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:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("path",{d:"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z"}),Ss.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),eyeOff:Ss.jsxs(Ss.Fragment,{children:[Ss.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"}),Ss.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"}),Ss.jsx("path",{d:"M9.9 9.9a3 3 0 0 0 4.2 4.2"}),Ss.jsx("path",{d:"m2 2 20 20"})]}),target:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("circle",{cx:"12",cy:"12",r:"7"}),Ss.jsx("path",{d:"M12 2v3M12 19v3M2 12h3M19 12h3"}),Ss.jsx("circle",{cx:"12",cy:"12",r:"1.4",fill:"currentColor",stroke:"none"})]}),text:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("path",{d:"M5 19 11 5h2l6 14"}),Ss.jsx("path",{d:"M7.5 14.5h9"})]}),globe:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("circle",{cx:"12",cy:"12",r:"9"}),Ss.jsx("path",{d:"M3 12h18"}),Ss.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:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("rect",{x:"7",y:"3",width:"10",height:"18",rx:"2"}),Ss.jsx("path",{d:"M11 18h2"})]}),cube:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("path",{d:"m12 3 8 4.5v9L12 21l-8-4.5v-9Z"}),Ss.jsx("path",{d:"M12 12v9M4 7.5l8 4.5 8-4.5"})]})};function cy({name:e,className:t="h-4 w-4",strokeWidth:s=1.75}){return Ss.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:s,strokeLinecap:"round",strokeLinejoin:"round",className:t,"aria-hidden":"true",children:ly[e]})}const hy=[{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"}],uy=Array.from({length:12},(e,t)=>5*t),dy=Array.from({length:24},(e,t)=>t),fy=m_(function(){const e=y_(),t=e.schedules.editing;return t?e.schedules.readOnly?Ss.jsx(my,{target:t,deployed:!0},`${t.kind}:${t.name}`):"config"===e.schedules.sourceOf(t.kind,t.name)?Ss.jsx(my,{target:t},`${t.kind}:${t.name}`):Ss.jsx(_y,{target:t},`${t.kind}:${t.name}`):null});function py({target:e,onClose:t,children:s}){return ps.useEffect(()=>{const e=e=>{"Escape"===e.key&&t()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t]),Ss.jsx("div",{className:"fixed inset-0 z-50 grid place-items-center bg-black/30 backdrop-blur-[1px]",onMouseDown:t,children:Ss.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":`Schedule for ${e.name}`,onMouseDown:e=>e.stopPropagation(),className:ay("w-[min(440px,calc(100vw-2rem))] rounded-lg p-4","border border-edge-soft bg-overlay shadow-xl"),children:[Ss.jsxs("div",{className:"flex items-center gap-2",children:[Ss.jsx(cy,{name:"clock",className:"h-3.5 w-3.5 text-fg-4"}),Ss.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"schedule"}),Ss.jsx("span",{className:"min-w-0 flex-1 truncate text-right font-mono text-[12px] text-fg-2",children:e.name}),Ss.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"})]}),s]})})}function vy({spec:e,cron:t}){return Ss.jsxs("div",{className:"mt-1.5 font-mono text-[10.5px] text-fg-4",children:["next: ",Bb(Nb(e,Date.now()),Date.now())," ",Ss.jsx("span",{className:"text-fg-4/70",children:"· your clock"}),Ss.jsxs("span",{className:"float-right text-fg-4/70",children:["cron: ",t]})]})}function gy({children:e}){return Ss.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:[Ss.jsx(cy,{name:"alert",className:"mt-px h-3.5 w-3.5 shrink-0"}),Ss.jsx("span",{children:e})]})}const my=m_(function({target:e,deployed:t=!1}){const s=y_().schedules,i=s.get(e.kind,e.name),n=i?kb(i.cron):null;return Ss.jsxs(py,{target:e,onClose:s.closeEditor,children:[Ss.jsxs("div",{className:"mt-4 font-mono text-[12.5px] text-fg-2",children:[i?Cb(i.cron):"not scheduled",(null==i?void 0:i.env)&&Ss.jsxs("span",{className:"text-fg-4",children:[" · env ",i.env]})]}),i&&n&&Ss.jsx(vy,{spec:n,cron:i.cron}),Ss.jsx(gy,{children:t?Ss.jsxs(Ss.Fragment,{children:["Declared in the repo (",Ss.jsx("span",{className:"font-mono",children:"unotest/schedules.yaml"})," or"," ",Ss.jsx("span",{className:"font-mono",children:"unotest.config"}),") — edit it there and push. This box applies whatever the deployed bundle declares."]}):Ss.jsxs(Ss.Fragment,{children:["Declared in ",Ss.jsx("span",{className:"font-mono",children:"unotest.config"})," — edit it there. This popup edits only"," ",Ss.jsx("span",{className:"font-mono",children:"unotest/schedules.yaml"}),"."]})}),Ss.jsx("div",{className:"mt-4 flex items-center justify-end",children:Ss.jsx("button",{type:"button",onClick:s.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"})})]})}),_y=m_(function({target:e}){const t=y_(),s=t.schedules,i=s.get(e.kind,e.name),n=i?kb(i.cron):null,r=null!==i&&null===n,[o,a]=ps.useState((null==n?void 0:n.freq)??"off"),[l,c]=ps.useState((null==n?void 0:n.minutes)??[0]),[h,u]=ps.useState((null==n?void 0:n.hours)??[3]),[d,f]=ps.useState((null==n?void 0:n.days)??[1]),[p,v]=ps.useState((null==i?void 0:i.env)??""),[g,m]=ps.useState(null),_="off"===o?null:{freq:o,minutes:l,hours:h,days:d},x="off"===o?null:bb[o];return Ss.jsxs(py,{target:e,onClose:s.closeEditor,children:[Ss.jsxs("label",{className:"mt-4 block",children:[Ss.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"run"}),Ss.jsx("select",{value:o,autoFocus:!0,onChange:e=>a(e.target.value),className:ay("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:hy.map(e=>Ss.jsx("option",{value:e.value,children:e.label},e.value))})]}),r&&"off"===o&&Ss.jsxs("div",{className:"mt-2 font-mono text-[10.5px] text-warn",children:["current schedule is a custom cron: ",i.cron]}),(null==x?void 0:x.days)&&Ss.jsx(by,{label:"days",children:Pb.map(e=>Ss.jsx(yy,{label:Eb[e]??String(e),wide:!0,selected:d.includes(e),onToggle:()=>f(xy(d,e))},e))}),(null==x?void 0:x.hours)&&Ss.jsx(by,{label:"hours",children:dy.map(e=>Ss.jsx(yy,{label:wy(e),selected:h.includes(e),onToggle:()=>u(xy(h,e))},e))}),(null==x?void 0:x.minutes)&&Ss.jsx(by,{label:"minutes",children:uy.map(e=>Ss.jsx(yy,{label:wy(e),selected:l.includes(e),onToggle:()=>c(xy(l,e))},e))}),_&&Ss.jsx(vy,{spec:_,cron:wb(_)}),Ss.jsxs("label",{className:"mt-4 flex items-center gap-3",children:[Ss.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"env"}),Ss.jsxs("select",{value:p,onChange:e=>v(e.target.value),className:ay("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:[Ss.jsx("option",{value:"",children:"base"}),t.environments.names.map(e=>Ss.jsx("option",{value:e,children:e},e))]})]}),Ss.jsxs(gy,{children:["Saved to ",Ss.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."]}),g&&Ss.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:g}),Ss.jsxs("div",{className:"mt-4 flex items-center justify-end gap-2",children:[Ss.jsx("button",{type:"button",onClick:s.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"}),Ss.jsx("button",{type:"button",onClick:()=>{(async()=>{let e;if(null===_){if(!i)return void s.closeEditor();e=await s.remove()}else e=await s.save({cron:wb(_),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 xy(e,t){return e.includes(t)?1===e.length?e:e.filter(e=>e!==t):[...e,t]}function by({label:e,children:t}){return Ss.jsxs("div",{className:"mt-3",children:[Ss.jsx("div",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:e}),Ss.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:t})]})}function yy({label:e,selected:t,onToggle:s,wide:i=!1}){return Ss.jsx("button",{type:"button","aria-pressed":t,onClick:s,className:ay("h-6 rounded border font-mono text-[10.5px] tabular-nums",i?"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 wy=e=>String(e).padStart(2,"0");function Sy(e){return t=>{t.preventDefault();const s="x"===e.axis?t.clientX:t.clientY,i=e.value,n=t=>{const n="x"===e.axis?t.clientX:t.clientY;e.onChange(Math.min(e.max(),Math.max(e.min,i+(n-s)*e.dir)))},r=()=>{window.removeEventListener("pointermove",n),window.removeEventListener("pointerup",r),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",n),window.addEventListener("pointerup",r)}}function ky(e,t){ps.useEffect(()=>{const s=s=>{var i;(null==(i=e.current)?void 0:i.contains(s.target))||t()},i=e=>{"Escape"===e.key&&t()},n=()=>t();return window.addEventListener("mousedown",s,!0),window.addEventListener("contextmenu",s,!0),window.addEventListener("keydown",i),window.addEventListener("scroll",n,!0),()=>{window.removeEventListener("mousedown",s,!0),window.removeEventListener("contextmenu",s,!0),window.removeEventListener("keydown",i),window.removeEventListener("scroll",n,!0)}},[e,t])}function Cy({x:e,y:t,items:s,onClose:i}){const n=ps.useRef(null),{left:r,top:o,mounted:a}=function(e,t,s){const[i,n]=ps.useState({left:t,top:s}),[r,o]=ps.useState(!1);return ps.useEffect(()=>{const i=e.current;if(!i)return;const{innerWidth:r,innerHeight:a}=window,l=i.getBoundingClientRect();let c=t,h=s;c+l.width>r-6&&(c=Math.max(6,r-l.width-6)),h+l.height>a-6&&(h=Math.max(6,a-l.height-6)),n({left:c,top:h});const u=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(u)},[e,t,s]),{left:i.left,top:i.top,mounted:r}}(n,e,t);return ky(n,i),Ss.jsx("div",{ref:n,role:"menu",style:{left:r,top:o,opacity:a?1:0,transform:a?"translateY(0)":"translateY(-2px)",transitionProperty:"opacity, transform",transitionDuration:"90ms",transitionTimingFunction:"ease-out"},className:ay("fixed z-50 min-w-[208px] overflow-hidden rounded-lg p-1","border border-edge-soft bg-overlay/95 backdrop-blur","shadow-lg"),children:s.map((e,t)=>{if("separator"===e.kind)return Ss.jsx("div",{className:"my-1 h-px bg-edge-soft"},t);if("header"===e.kind)return Ss.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 s="danger"===e.tone;return Ss.jsxs("button",{type:"button",role:"menuitem",disabled:e.disabled,onClick:()=>{e.disabled||(e.onSelect(),i())},className:ay("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":s?"text-fg-2 hover:bg-fail/10 hover:text-fail":"text-fg-2 hover:bg-raised hover:text-fg"),children:[Ss.jsx("span",{className:ay("grid h-4 w-4 shrink-0 place-items-center",e.disabled?"text-fg-4":s?"text-fg-3 group-hover:text-fail":"text-fg-3"),children:e.icon&&Ss.jsx(cy,{name:e.icon,className:"h-3.5 w-3.5",strokeWidth:1.75})}),Ss.jsx("span",{className:"truncate",children:e.label}),e.shortcut&&Ss.jsx("span",{className:"ml-auto pl-4 font-mono text-[10.5px] tracking-wider text-fg-4",children:e.shortcut})]},t)})})}function jy({axis:e,onPointerDown:t,className:s}){return Ss.jsx("div",{onPointerDown:t,role:"separator","aria-orientation":"x"===e?"vertical":"horizontal",title:"Drag to resize",className:ay("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",s),children:Ss.jsx("span",{className:ay("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 Ny({leading:e,label:t,active:s,closable:i=!0,closeLabel:n,onActivate:r,onClose:o,onContextMenu:a}){return Ss.jsxs("div",{role:"tab","aria-selected":s,tabIndex:0,onClick:r,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),r())},onMouseDown:e=>{1===e.button&&i&&o&&(e.preventDefault(),o())},onContextMenu:a,className:ay("group flex h-7 max-w-[260px] shrink-0 cursor-default items-center gap-1.5 rounded-md px-2.5",s?"bg-selection text-fg":"text-fg-3 hover:bg-raised hover:text-fg-2"),children:[e,Ss.jsx("span",{className:"truncate font-mono text-[12px]",children:t}),i&&o&&Ss.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),o()},className:ay("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",s&&"opacity-100"),"aria-label":n??`Close ${t}`,children:Ss.jsx(cy,{name:"x",className:"h-3 w-3",strokeWidth:2.5})})]})}const My={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 By(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
|
-
/**
|
|
32
|
-
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
33
|
-
* @license MIT
|
|
34
|
-
*
|
|
35
|
-
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
36
|
-
* @license MIT
|
|
37
|
-
*
|
|
38
|
-
* Originally forked from (with the author's permission):
|
|
39
|
-
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
40
|
-
* http://bellard.org/jslinux/
|
|
41
|
-
* Copyright (c) 2011 Fabrice Bellard
|
|
42
|
-
*/var Ly=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 s=0===this._terminal.options.scrollback?0:(null==(e=this._terminal.options.overviewRuler)?void 0:e.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(i.getPropertyValue("height")),r=Math.max(0,parseInt(i.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),a=n-(parseInt(o.getPropertyValue("padding-top"))+parseInt(o.getPropertyValue("padding-bottom"))),l=r-(parseInt(o.getPropertyValue("padding-right"))+parseInt(o.getPropertyValue("padding-left")))-s;return{cols:Math.max(2,Math.floor(l/t.css.cell.width)),rows:Math.max(1,Math.floor(a/t.css.cell.height))}}},Dy=Object.defineProperty,Ey=Object.getOwnPropertyDescriptor,Py=(e,t,s,i)=>{for(var n,r=i>1?void 0:i?Ey(t,s):t,o=e.length-1;o>=0;o--)(n=e[o])&&(r=(i?n(t,s,r):n(r))||r);return i&&r&&Dy(t,s,r),r},Ry=(e,t)=>(s,i)=>t(s,i,e),Ay="Terminal input",zy=()=>Ay,Ty=e=>Ay=e,Iy="Too much output to announce, navigate to rows manually to read",Oy=()=>Iy,Hy=e=>Iy=e;
|
|
43
|
-
/**
|
|
44
|
-
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
45
|
-
* @license MIT
|
|
46
|
-
*
|
|
47
|
-
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
48
|
-
* @license MIT
|
|
49
|
-
*
|
|
50
|
-
* Originally forked from (with the author's permission):
|
|
51
|
-
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
52
|
-
* http://bellard.org/jslinux/
|
|
53
|
-
* Copyright (c) 2011 Fabrice Bellard
|
|
54
|
-
*/function Fy(e,t,s,i){e=function(e,t){return t?`[200~${e.replace(/\x1b/g,"␛")}[201~`:e}(e=function(e){return e.replace(/\r?\n/g,"\r")}(e),s.decPrivateModes.bracketedPasteMode&&!0!==i.rawOptions.ignoreBracketedPasteMode),s.triggerDataEvent(e,!0),t.value=""}function Wy(e,t,s){let i=s.getBoundingClientRect(),n=e.clientX-i.left-10,r=e.clientY-i.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${n}px`,t.style.top=`${r}px`,t.style.zIndex="1000",t.focus()}function Ky(e,t,s,i,n){Wy(e,t,s),n&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}function Uy(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function qy(e,t=0,s=e.length){let i="";for(let n=t;n<s;++n){let t=e[n];t>65535?(t-=65536,i+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):i+=String.fromCharCode(t)}return i}var Vy=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let s=e.length;if(!s)return 0;let i=0,n=0;if(this._interim){let s=e.charCodeAt(n++);56320<=s&&s<=57343?t[i++]=1024*(this._interim-55296)+s-56320+65536:(t[i++]=this._interim,t[i++]=s),this._interim=0}for(let r=n;r<s;++r){let n=e.charCodeAt(r);if(55296<=n&&n<=56319){if(++r>=s)return this._interim=n,i;let o=e.charCodeAt(r);56320<=o&&o<=57343?t[i++]=1024*(n-55296)+o-56320+65536:(t[i++]=n,t[i++]=o);continue}65279!==n&&(t[i++]=n)}return i}},$y=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let s=e.length;if(!s)return 0;let i,n,r,o,a,l=0,c=0;if(this.interim[0]){let i=!1,n=this.interim[0];n&=192==(224&n)?31:224==(240&n)?15:7;let r,o=0;for(;(r=this.interim[++o])&&o<4;)n<<=6,n|=63&r;let a=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,h=a-o;for(;c<h;){if(c>=s)return 0;if(r=e[c++],128!=(192&r)){c--,i=!0;break}this.interim[o++]=r,n<<=6,n|=63&r}i||(2===a?n<128?c--:t[l++]=n:3===a?n<2048||n>=55296&&n<=57343||65279===n||(t[l++]=n):n<65536||n>1114111||(t[l++]=n)),this.interim.fill(0)}let h=s-4,u=c;for(;u<s;){for(;!(!(u<h)||128&(i=e[u])||128&(n=e[u+1])||128&(r=e[u+2])||128&(o=e[u+3]));)t[l++]=i,t[l++]=n,t[l++]=r,t[l++]=o,u+=4;if(i=e[u++],i<128)t[l++]=i;else if(192==(224&i)){if(u>=s)return this.interim[0]=i,l;if(n=e[u++],128!=(192&n)){u--;continue}if(a=(31&i)<<6|63&n,a<128){u--;continue}t[l++]=a}else if(224==(240&i)){if(u>=s)return this.interim[0]=i,l;if(n=e[u++],128!=(192&n)){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=n,l;if(r=e[u++],128!=(192&r)){u--;continue}if(a=(15&i)<<12|(63&n)<<6|63&r,a<2048||a>=55296&&a<=57343||65279===a)continue;t[l++]=a}else if(240==(248&i)){if(u>=s)return this.interim[0]=i,l;if(n=e[u++],128!=(192&n)){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=n,l;if(r=e[u++],128!=(192&r)){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=n,this.interim[2]=r,l;if(o=e[u++],128!=(192&o)){u--;continue}if(a=(7&i)<<18|(63&n)<<12|(63&r)<<6|63&o,a<65536||a>1114111)continue;t[l++]=a}}return l}},Yy=class e{constructor(){this.fg=0,this.bg=0,this.extended=new Gy}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}},Gy=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}},Xy=class e extends Yy{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Gy,this.combinedData=""}static fromCharData(t){let s=new e;return s.setFromCharData(t),s}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?Uy(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 s=e[1].charCodeAt(0);if(55296<=s&&s<=56319){let i=e[1].charCodeAt(1);56320<=i&&i<=57343?this.content=1024*(s-55296)+i-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(),s=e.isUnderlineColorDefault();if(!(t&&s||t===s&&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())}},Zy=new Map;function Jy(e){if(Zy.has(e))return Zy.get(e);let t=function(e,s,i){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");!function(e,t,s){t.di$target===t?t.di$dependencies.push({id:e,index:s}):(t.di$dependencies=[{id:e,index:s}],t.di$target=t)}(t,e,i)};return t._id=e,Zy.set(e,t),t}var Qy=Jy("BufferService"),ew=Jy("MouseStateService"),tw=Jy("CoreService"),sw=Jy("CharsetService"),iw=Jy("InstantiationService"),nw=Jy("LogService"),rw=Jy("OptionsService"),ow=Jy("OscLinkService"),aw=Jy("UnicodeService"),lw=Jy("DecorationService"),cw=class{constructor(e,t,s){this._bufferService=e,this._optionsService=t,this._oscLinkService=s,this._workCell=new Xy}provideLinks(e,t){var s;let i=this._bufferService.buffer.lines.get(e-1);if(!i)return void t(void 0);let n=[],r=this._optionsService.rawOptions.linkHandler,o=this._workCell,a=i.getTrimmedLength(),l=-1,c=-1,h=!1;for(let u=0;u<a;u++)if(-1!==c||i.hasContent(u)){if(i.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==(s=this._oscLinkService.getLinkData(l))?void 0:s.uri;if(t){let s=u+(h||u!==a-1?0:1),i=this._getRangeWithLineWrap(e,c,s,l),o=!1;if(!(null==r?void 0:r.allowNonHttpProtocols))try{let e=new URL(t);["http:","https:"].includes(e.protocol)||(o=!0)}catch{o=!0}o||n.push({text:t,range:i,activate:(e,t)=>r?r.activate(e,t,i):hw(e,t),hover:(e,t)=>{var s;return null==(s=null==r?void 0:r.hover)?void 0:s.call(r,e,t,i)},leave:(e,t)=>{var s;return null==(s=null==r?void 0:r.leave)?void 0:s.call(r,e,t,i)}})}h=!1,o.hasExtendedAttrs()&&o.extended.urlId?(c=u,l=o.extended.urlId):(c=-1,l=-1)}}t(n)}_getRangeWithLineWrap(e,t,s,i){var n;let r=e,o=t,a=e,l=s;for(;0===o&&(null==(n=this._bufferService.buffer.lines.get(r-1))?void 0:n.isWrapped);){let e=this._bufferService.buffer.lines.get(r-2);if(!e)break;let t=e.getTrimmedLength();if(0===t||!this._hasUrlId(e,t-1,i))break;let s=t-1;for(;s>0&&this._hasUrlId(e,s-1,i);)s--;r--,o=s}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 s=t.getTrimmedLength();if(0===s||!this._hasUrlId(t,0,i))break;let n=1;for(;n<s&&this._hasUrlId(t,n,i);)n++;a++,l=n}return{start:{x:o+1,y:r},end:{x:l,y:a}}}_hasUrlId(e,t,s){let i=this._workCell;return e.loadCell(t,i),!!i.hasExtendedAttrs()&&i.extended.urlId===s}};function hw(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")}}cw=Py([Ry(0,Qy),Ry(1,rw),Ry(2,ow)],cw);var uw=Jy("CharSizeService"),dw=Jy("CoreBrowserService"),fw=Jy("MouseCoordsService"),pw=Jy("MouseService"),vw=Jy("RenderService"),gw=Jy("SelectionService"),mw=Jy("CharacterJoinerService"),_w=Jy("ThemeService"),xw=Jy("LinkProviderService"),bw=Jy("KeyboardService");function yw(e){return{dispose:e}}function ww(e){if(!e)return e;if(Array.isArray(e)){for(let t of e)t.dispose();return[]}return e.dispose(),e}var Sw=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()}},kw=class{constructor(){this._store=new Sw}dispose(){this._store.dispose()}_register(e){return this._store.add(e)}};kw.None=Object.freeze({dispose(){}});var Cw=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 jw=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))}},Nw=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())}))}},Mw=class{constructor(){this._isDisposed=!1}cancel(){var e;null==(e=this._disposable)||e.dispose(),this._disposable=void 0}cancelAndSet(e,t,s=globalThis){if(this._isDisposed)throw new Error("Calling cancelAndSet on a disposed IntervalTimer");this.cancel();let i=s.setInterval(()=>{e()},t);this._disposable={dispose:()=>{s.clearInterval(i),this._disposable=void 0}}}dispose(){this.cancel(),this._isDisposed=!0}};function Bw(e){var t;let s=e;if(null==(t=null==s?void 0:s.ownerDocument)?void 0:t.defaultView)return s.ownerDocument.defaultView;let i=e;return(null==i?void 0:i.view)?i.view:window}var Lw=class{constructor(e,t,s,i){this._node=e,this._type=t,this._handler=s,this._options=i,e.addEventListener(t,s,i)}dispose(){!this._node||!this._handler||(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Dw(e,t,s,i){return new Lw(e,t,s,i)}function Ew(e,t,s,i){return Dw(e,t,s,i)}var Pw="click",Rw="mouseover",Aw="mouseleave",zw="pointerdown",Tw="pointermove",Iw="pointerup",Ow="wheel";var Hw=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}},Fw=new Map;function Ww(e){let t=Fw.get(e);return t||(t={next:[],current:[],animFrameRequested:!1,inAnimationFrameRunner:!1},Fw.set(e,t)),t}function Kw(e,t,s=0){let i=Ww(e),n=new Hw(t,s);return i.next.push(n),i.animFrameRequested||(i.animFrameRequested=!0,e.requestAnimationFrame(()=>function(e){let t=Ww(e);for(t.animFrameRequested=!1,t.current=t.next,t.next=[],t.inAnimationFrameRunner=!0;t.current.length>0;)t.current.sort(Hw.sort),t.current.shift().execute();t.inAnimationFrameRunner=!1}(e))),n}var Uw=class extends Mw{constructor(e){super(),this._defaultTarget=e?Bw(e):void 0}cancelAndSet(e,t,s){super.cancelAndSet(e,t,s??this._defaultTarget??window)}},qw=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=Vw(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Vw(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Vw(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Vw(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Vw(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Vw(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 Vw(e){return"number"==typeof e?`${e}px`:e}var $w={};((e,t)=>{for(var s in t)Dy(e,s,{get:t[s],enumerable:!0})})($w,{getSafariVersion:()=>sS,getZoomFactor:()=>tS,isChrome:()=>Jw,isChromeOS:()=>oS,isFirefox:()=>Zw,isLegacyEdge:()=>Qw,isLinux:()=>rS,isMac:()=>iS,isNode:()=>Yw,isSafari:()=>eS,isWindows:()=>nS});var Yw=!!(typeof process<"u"&&"title"in process&&(typeof navigator>"u"||navigator.userAgent.startsWith("Node.js/"))),Gw=Yw?"node":navigator.userAgent,Xw=Yw?"node":navigator.platform,Zw=Gw.includes("Firefox"),Jw=Gw.includes("Chrome"),Qw=Gw.includes("Edge"),eS=/^((?!chrome|android).)*safari/i.test(Gw);function tS(e){return 1}function sS(){if(!eS)return 0;let e=Gw.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1],10)}var iS=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Xw),nS=["Windows","Win16","Win32","WinCE"].includes(Xw),rS=Xw.indexOf("Linux")>=0,oS=/\bCrOS\b/.test(Gw),aS=new WeakMap;function lS(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,s=e.parent.location;if("null"!==t.origin&&"null"!==s.origin&&t.origin!==s.origin)return null}catch{return null}return e.parent}var cS,hS,uS=class{static _getSameOriginWindowChain(e){let t=aS.get(e);if(!t){t=[],aS.set(e,t);let s,i=e;do{s=lS(i),s?t.push({window:new WeakRef(i),iframeElement:i.frameElement??null}):t.push({window:new WeakRef(i),iframeElement:null}),i=s}while(i)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let s=0,i=0,n=this._getSameOriginWindowChain(e);for(let r of n){let e=r.window.deref();if(s+=(null==e?void 0:e.scrollY)??0,i+=(null==e?void 0:e.scrollX)??0,e===t||!r.iframeElement)break;let n=r.iframeElement.getBoundingClientRect();s+=n.top,i+=n.left}return{top:s,left:i}}},dS=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 s=uS.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=s.left,this.posy-=s.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},fS=class{constructor(e,t=0,s=0){var i;this.browserEvent=e??null,this.target=e?e.target??e.targetNode??e.srcElement??null:null,this.deltaY=s,this.deltaX=t;let n=!1;if(Jw){let e=navigator.userAgent.match(/Chrome\/(\d+)/);n=(e?parseInt(e[1],10):123)<=122}if(e){let t=e,s=e,r=(null==(i=e.view)?void 0:i.devicePixelRatio)??1;if(typeof t.wheelDeltaY<"u")this.deltaY=n?t.wheelDeltaY/(120*r):t.wheelDeltaY/120;else if(typeof s.VERTICAL_AXIS<"u"&&s.axis===s.VERTICAL_AXIS)this.deltaY=-s.detail/3;else if("wheel"===e.type){let t=e;t.deltaMode===t.DOM_DELTA_LINE?this.deltaY=Zw&&!iS?-e.deltaY/3:-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof t.wheelDeltaX<"u")this.deltaX=eS&&nS?-t.wheelDeltaX/120:n?t.wheelDeltaX/(120*r):t.wheelDeltaX/120;else if(typeof s.HORIZONTAL_AXIS<"u"&&s.axis===s.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if("wheel"===e.type){let t=e;t.deltaMode===t.DOM_DELTA_LINE?this.deltaX=Zw&&!iS?-e.deltaX/3:-e.deltaX:this.deltaX=-e.deltaX/40}0===this.deltaY&&0===this.deltaX&&e.wheelDelta&&(this.deltaY=n?e.wheelDelta/(120*r):e.wheelDelta/120)}}preventDefault(){var e;null==(e=this.browserEvent)||e.preventDefault()}stopPropagation(){var e;null==(e=this.browserEvent)||e.stopPropagation()}},pS=class{constructor(){this._hooks=new Sw,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,s,i,n){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=i,this._onStopCallback=n;let r=e;try{e.setPointerCapture(t),this._hooks.add(yw(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{r=Bw(e)}this._hooks.add(Dw(r,Tw,e=>{e.buttons===s?(e.preventDefault(),this._pointerMoveCallback(e)):this.stopMonitoring(!0)})),this._hooks.add(Dw(r,Iw,e=>this.stopMonitoring(!0)))}},vS=class extends kw{_onclick(e,t){this._register(Dw(e,Pw,s=>t(new dS(Bw(e),s))))}_onmouseover(e,t){this._register(Dw(e,Rw,s=>t(new dS(Bw(e),s))))}_onmouseleave(e,t){this._register(Dw(e,Aw,s=>t(new dS(Bw(e),s))))}},gS=class extends vS{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 pS),this._register(Ew(this.bgDomNode,zw,e=>this._arrowPointerDown(e))),this._register(Ew(this.domNode,zw,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new Uw),this._pointerdownScheduleRepeatTimer=this._register(new jw)}_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,Bw(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},mS=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=(e,t,s)=>{if(this._disposed)return yw(()=>{});let i={fn:e,thisArgs:t};this._listeners.push(i);let n=yw(()=>{let e=this._listeners.indexOf(i);-1!==e&&this._listeners.splice(e,1)});return s&&(Array.isArray(s)?s.push(n):s.add(n)),n}),this._event}fire(e){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:t,thisArgs:s}=this._listeners[0];return void t.call(s,e)}default:{let t=this._listeners.slice();for(let{fn:s,thisArgs:i}of t)s.call(i,e)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}};(hS=cS||(cS={})).forward=function(e,t){return e(e=>t.fire(e))},hS.map=function(e,t){return(s,i,n)=>e(e=>s.call(i,t(e)),void 0,n)},hS.any=function(...e){return(t,s,i)=>{let n=new Sw;for(let r of e)n.add(r(e=>t.call(s,e)));return i&&(Array.isArray(i)?i.push(n):i.add(n)),n}},hS.runAndSubscribe=function(e,t,s){return t(s),e(e=>t(e))};var _S=class e{constructor(e,t,s,i,n,r,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,s|=0,i|=0,n|=0,r|=0,o|=0),this.rawScrollLeft=i,this.rawScrollTop=o,t<0&&(t=0),i+t>s&&(i=s-t),i<0&&(i=0),n<0&&(n=0),o+n>r&&(o=r-n),o<0&&(o=0),this.width=t,this.scrollWidth=s,this.scrollLeft=i,this.height=n,this.scrollHeight=r,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,s){return new e(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,s?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,s?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 s=this.width!==e.width,i=this.scrollWidth!==e.scrollWidth,n=this.scrollLeft!==e.scrollLeft,r=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:s,scrollWidthChanged:i,scrollLeftChanged:n,heightChanged:r,scrollHeightChanged:o,scrollTopChanged:a}}},xS=class extends kw{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new mS),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new _S(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var s;let i=this._state.withScrollDimensions(e,t);this._setState(i,!!this._smoothScrolling),null==(s=this._smoothScrolling)||s.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(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 s,i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;s=t?new wS(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):wS.start(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=s}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=wS.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 s=this._state;s.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(s,t)))}},bS=class{constructor(e,t,s){this.scrollLeft=e,this.scrollTop=t,this.isDone=s}};function yS(e,t){let s=t-e;return function(t){return e+s*function(e){return 1-function(e){return Math.pow(e,3)}(1-e)}(t)}}var wS=class e{constructor(e,t,s,i){this.from=e,this.to=t,this.duration=i,this.startTime=s,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this._scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this._scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,t,s){if(Math.abs(e-t)>2.5*s){let i,n;return e<t?(i=e+.75*s,n=t-.75*s):(i=e-.75*s,n=t+.75*s),function(e,t,s){return function(i){return i<s?e(i/s):t((i-s)/(1-s))}}(yS(e,i),yS(n,t),.33)}return yS(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),s=this._scrollTop(t);return new bS(e,s,!1)}return new bS(this.to.scrollLeft,this.to.scrollTop,!0)}static start(t,s,i){i+=10;let n=Date.now()-10;return new e(t,s,n,i)}};var SS=class extends kw{constructor(e,t,s){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=s,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new jw)}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":"")))}},kS=class extends vS{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 SS(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 pS),this._shouldRender=!0,this.domNode=new qw(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(Dw(this.domNode.domNode,zw,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new gS(e));return this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode),t}_createSlider(e,t,s,i){this.slider=new qw(document.createElement("div")),this.slider.setClassName("xterm-slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),"number"==typeof s&&this.slider.setWidth(s),"number"==typeof i&&this.slider.setHeight(i),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Dw(this.slider.domNode,zw,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,s=t+this._scrollbarState.getSliderPosition(),i=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),n=this._sliderPointerPosition(e);s<=n&&n<=i?0===e.button&&(e.preventDefault(),this._sliderPointerDown(e)):this._handlePointerDown(e)}_handlePointerDown(e){let t,s;if(e.target===this.domNode.domNode&&"number"==typeof e.offsetX&&"number"==typeof e.offsetY)t=e.offsetX,s=e.offsetY;else{let i=function(e){let t=e.getBoundingClientRect(),s=Bw(e);return{left:t.left+s.scrollX,top:t.top+s.scrollY,width:t.width,height:t.height}}(this.domNode.domNode);t=e.pageX-i.left,s=e.pageY-i.top}let i=this._pointerDownRelativePosition(t,s);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(i):this._scrollbarState.getDesiredScrollPositionFromOffset(i)),0===e.button&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!(e.target&&e.target instanceof Element))return;let t=this._sliderPointerPosition(e),s=this._sliderOrthogonalPointerPosition(e),i=this._scrollbarState.clone();this.slider.toggleClassName("xterm-active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let n=this._sliderOrthogonalPointerPosition(e),r=Math.abs(n-s);if(nS&&r>140)return void this._setDesiredScrollPositionNow(i.getScrollPosition());let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(i.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()}},CS=class e{constructor(e,t,s,i,n,r){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(s),this._arrowSize=Math.round(e),this._visibleSize=i,this._scrollSize=n,this._scrollPosition=r,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,s,i,n){let r=Math.max(0,s-e),o=Math.max(0,r-2*t),a=i>0&&i>s;if(!a)return{computedAvailableSize:Math.round(r),computedIsNeeded:a,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let l=Math.round(Math.max(20,Math.floor(s*o/i))),c=(o-l)/(i-s),h=n*c;return{computedAvailableSize:Math.round(r),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,s=this._scrollPosition;return t<this._computedSliderPosition?s-=this._visibleSize:s+=this._visibleSize,s}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},jS=class extends kS{constructor(e,t,s){let i=e.getScrollDimensions(),n=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new CS(t.horizontalHasArrows?t.horizontalScrollbarSize:0,2===t.horizontal?0:t.horizontalScrollbarSize,2===t.vertical?0:t.verticalScrollbarSize,i.width,i.scrollWidth,n.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}},NS=class extends kS{constructor(e,t,s){let i=e.getScrollDimensions(),n=e.getCurrentScrollPosition(),r=t.verticalHasArrows;super({lazyRender:t.lazyRender,host:s,scrollbarState:new CS(r?t.verticalScrollbarSize:0,2===t.vertical?0:t.verticalScrollbarSize,0,i.height,i.scrollHeight,n.scrollTop),visibility:t.vertical,extraScrollbarClassName:"xterm-vertical",scrollable:e,scrollByPage:t.scrollByPage}),this._arrowScrollDelta=0,this._setArrows(r,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 s=e?"":"none";this._arrowUp.bgDomNode.style.display=s,this._arrowUp.domNode.style.display=s,this._arrowDown.bgDomNode.style.display=s,this._arrowDown.domNode.style.display=s}_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}},MS=class{constructor(e,t,s){this.timestamp=e,this.deltaX=t,this.deltaY=s,this.score=0}},BS=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,s=1,i=this._rear;for(;-1!==i;){let n=i===this._front?e:Math.pow(2,-s);if(e-=n,t+=this._memory[i].score*n,i===this._front)break;i=(this._capacity+i-1)%this._capacity,s++}return t<=.5}acceptStandardWheelEvent(e){if(Jw){Bw(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,s){let i=null,n=new MS(e,t,s);-1===this._front&&-1===this._rear?(this._memory[0]=n,this._front=0,this._rear=0):(i=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]=n),n.score=this._computeScore(n,i)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let s=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(s+=.25),t){let i=Math.abs(e.deltaX),n=Math.abs(e.deltaY),r=Math.abs(t.deltaX),o=Math.abs(t.deltaY),a=Math.max(Math.min(i,r),1),l=Math.max(Math.min(n,o),1),c=Math.max(i,r),h=Math.max(n,o);c%a===0&&h%l===0&&(s-=.5)}return Math.min(Math.max(s,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};BS.INSTANCE=new BS;var LS=BS,DS=class extends vS{constructor(e,t,s){super(),this._onScroll=this._register(new mS),this.onScroll=this._onScroll.event,t=t??{};let i,n=!s;s?i=s:(t.mouseWheelSmoothScroll=!1,i=new xS({forceIntegerValues:!0,smoothScrollDuration:0,scheduleAtNextAnimationFrame:t=>Kw(Bw(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,iS&&(t.className+=" xterm-mac"),t}(t),this._scrollable=i,this._register(this._scrollable.onScroll(e=>{this._handleScroll(e),this._onScroll.fire(e)})),n&&this._register(this._scrollable);let r={handleMouseWheel:e=>this._handleMouseWheel(e),handleDragStart:()=>this._handleDragStart(),handleDragEnd:()=>this._handleDragEnd()};this._verticalScrollbar=this._register(new NS(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new jS(this._scrollable,this._options,r)),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 qw(document.createElement("div")),this._leftShadowDomNode.setClassName("xterm-shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=new qw(document.createElement("div")),this._topShadowDomNode.setClassName("xterm-shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=new qw(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 jw),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=ww(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,iS&&(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 fS(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=ww(this._mouseWheelToDispose),e)){let e=e=>{this._handleMouseWheel(new fS(e))};this._mouseWheelToDispose.push(Dw(this._listenOnDomNode,Ow,e,{passive:!1}))}}_handleMouseWheel(e){var t;if(null==(t=e.browserEvent)?void 0:t.defaultPrevented)return;let s=LS.INSTANCE;s.acceptStandardWheelEvent(e);let i=!1;if(e.deltaY||e.deltaX){let t=e.deltaY*this._options.mouseWheelScrollSensitivity,n=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&n+t===0?n=t=0:Math.abs(t)>=Math.abs(n)?n=0:t=0),this._options.flipAxes&&([t,n]=[n,t]);let r=!iS&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||r)&&!n&&(n=t,t=0),e.browserEvent&&e.browserEvent.altKey&&(n*=this._options.fastScrollSensitivity,t*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),a={};if(t){let e=50*t,s=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(a,s)}if(n){let e=50*n,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&&s.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(a):this._scrollable.setScrollPositionNow(a),i=!0)}let n=i;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(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,s=e.scrollLeft>0,i=s?" xterm-shadow-left":"",n=t?" xterm-shadow-top":"",r=s||t?" xterm-shadow-top-left-corner":"";this._leftShadowDomNode.setClassName(`xterm-shadow${i}`),this._topShadowDomNode.setClassName(`xterm-shadow${n}`),this._topLeftShadowDomNode.setClassName(`xterm-shadow${r}${n}${i}`)}}_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 ES=class extends kw{constructor(e,t,s,i,n,r,o,a,l){var c;super(),this._bufferService=s,this._coreService=n,this._optionsService=a,this._renderService=l,this._onRequestScrollLines=this._register(new mS),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1,this._needsSyncOnRender=!1;let h=this._register(new xS({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>Kw(i.window,e)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{h.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new DS(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(r.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(16&e)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(cS.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(yw(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(yw(()=>this._styleElement.remove())),this._register(cS.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,s;let i=(null==(e=this._optionsService.rawOptions.scrollbar)?void 0:e.showScrollbar)??!0,n=(null==(t=this._optionsService.rawOptions.scrollbar)?void 0:t.showArrows)??!1,r=i?(null==(s=this._optionsService.rawOptions.scrollbar)?void 0:s.width)??14:0;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,vertical:i?1:2,verticalScrollbarSize:r,verticalHasArrows:n}}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),s=t-this._bufferService.buffer.ydisp;0!==s&&(this._latestYDisp=t,this._onRequestScrollLines.fire(s)),this._isHandlingScroll=!1}handleTouchScroll(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({scrollTop:t.scrollTop-e})}};ES=Py([Ry(2,Qy),Ry(3,dw),Ry(4,tw),Ry(5,ew),Ry(6,_w),Ry(7,rw),Ry(8,vw)],ES);var PS=class extends kw{constructor(e,t,s,i,n){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=s,this._decorationService=i,this._renderService=n,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(yw(()=>{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 s=this._coreBrowserService.mainDocument.createElement("div");s.classList.add("xterm-decoration"),s.classList.toggle("xterm-decoration-top-layer","top"===(null==(t=null==e?void 0:e.options)?void 0:t.layer)),s.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,s.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+"px",s.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",s.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let i=e.options.x??0;return i&&i>this._bufferService.cols&&(s.style.display="none"),this._refreshXPosition(e,s),s}_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 s=this._decorationElements.get(e);s||(s=this._createElement(e),e.element=s,this._decorationElements.set(e,s),this._container.appendChild(s),e.onDispose(()=>{this._decorationElements.delete(e),s.remove()})),s.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(s.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,s.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+"px",s.style.top=t*this._renderService.dimensions.css.cell.height+"px",s.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(s)}}_refreshXPosition(e,t=e.element){if(!t)return;let s=e.options.x??0;"right"===(e.options.anchor||"left")?t.style.right=s?s*this._renderService.dimensions.css.cell.width+"px":"":t.style.left=s?s*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()}};PS=Py([Ry(1,Qy),Ry(2,dw),Ry(3,lw),Ry(4,vw)],PS);var RS=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,s){return t>=e.startBufferLine-this._linePadding[s||"full"]&&t<=e.endBufferLine+this._linePadding[s||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},AS={full:0,left:0,center:0,right:0},zS={full:0,left:0,center:0,right:0},TS={full:0,left:0,center:0,right:0},IS=class extends kw{constructor(e,t,s,i,n,r,o,a){var l;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=s,this._decorationService=i,this._renderService=n,this._optionsService=r,this._themeService=o,this._coreBrowserService=a,this._colorZoneStore=new RS,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(yw(()=>{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(yw(()=>{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);zS.full=this._canvas.width,zS.left=e,zS.center=t,zS.right=e,this._refreshDrawHeightConstants(),TS.full=1,TS.left=1,TS.center=1+zS.left,TS.right=1+zS.left+zS.center}_refreshDrawHeightConstants(){AS.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);AS.left=t,AS.center=t,AS.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*AS.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*AS.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*AS.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*AS.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,s,i;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==(i=null==(s=this._optionsService.rawOptions.scrollbar)?void 0:s.overviewRuler)?void 0:i.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(TS[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-AS[e.position||"full"]/2),zS[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+AS[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})))}};IS=Py([Ry(2,Qy),Ry(3,lw),Ry(4,vw),Ry(5,rw),Ry(6,_w),Ry(7,dw)],IS);var OS=class{constructor(e,t,s,i,n,r){this._textarea=e,this._compositionView=t,this._bufferService=s,this._optionsService=i,this._coreService=n,this._renderService=r,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 s;if(this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,this._isComposing)s=this._textarea.value.substring(e.start,this._compositionPosition.start);else{let i=this._textarea.value,n=t.length>0&&i.endsWith(t)?i.length-t.length:i.length;s=i.substring(e.start,Math.max(e.start,n))}s.length>0&&this._coreService.triggerDataEvent(s,!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,s=t.replace(e,"");this._dataAlreadySent=s,t.length>e.length?this._coreService.triggerDataEvent(s,!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,s=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,i=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=i+"px",this._compositionView.style.top=s+"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 n=this._bufferService.cols*this._renderService.dimensions.css.cell.width-i;this._compositionView.style.maxWidth=n+"px",this._compositionView.style.overflow="hidden",this._compositionView.style.direction="rtl";let r=this._compositionView.getBoundingClientRect();this._textarea.style.left=i+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(r.width,1)+"px",this._textarea.style.height=Math.max(r.height,1)+"px",this._textarea.style.lineHeight=r.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};OS=Py([Ry(2,Qy),Ry(3,rw),Ry(4,tw),Ry(5,vw)],OS);var HS,FS,WS,KS,US,qS,VS=0,$S=0,YS=0,GS=0,XS={css:"#00000000",rgba:0};function ZS(e){let t=e.toString(16);return t.length<2?"0"+t:t}function JS(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}(FS=HS||(HS={})).toCss=function(e,t,s,i){return void 0!==i?`#${ZS(e)}${ZS(t)}${ZS(s)}${ZS(i)}`:`#${ZS(e)}${ZS(t)}${ZS(s)}`},FS.toRgba=function(e,t,s,i=255){return(e<<24|t<<16|s<<8|i)>>>0},FS.toColor=function(e,t,s,i){return{css:FS.toCss(e,t,s,i),rgba:FS.toRgba(e,t,s,i)}},(e=>{function t(e,t){return GS=Math.round(255*t),[VS,$S,YS]=qS.toChannels(e.rgba),{css:HS.toCss(VS,$S,YS,GS),rgba:HS.toRgba(VS,$S,YS,GS)}}e.blend=function(e,t){if(1===(GS=(255&t.rgba)/255))return{css:t.css,rgba:t.rgba};let s=t.rgba>>24&255,i=t.rgba>>16&255,n=t.rgba>>8&255,r=e.rgba>>24&255,o=e.rgba>>16&255,a=e.rgba>>8&255;return VS=r+Math.round((s-r)*GS),$S=o+Math.round((i-o)*GS),YS=a+Math.round((n-a)*GS),{css:HS.toCss(VS,$S,YS),rgba:HS.toRgba(VS,$S,YS)}},e.isOpaque=function(e){return!(255&~e.rgba)},e.ensureContrastRatio=function(e,t,s){let i=qS.ensureContrastRatio(e.rgba,t.rgba,s);if(i)return HS.toColor(i>>24&255,i>>16&255,i>>8&255)},e.opaque=function(e){let t=(255|e.rgba)>>>0;return[VS,$S,YS]=qS.toChannels(t),{css:HS.toCss(VS,$S,YS),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,s){return t(e,(GS=255&e.rgba)*s/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}})(WS||(WS={})),(e=>{let t,s;try{let e=document.createElement("canvas");e.width=1,e.height=1;let i=e.getContext("2d",{willReadFrequently:!0});i&&(t=i,t.globalCompositeOperation="copy",s=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 VS=parseInt(e.slice(1,2).repeat(2),16),$S=parseInt(e.slice(2,3).repeat(2),16),YS=parseInt(e.slice(3,4).repeat(2),16),HS.toColor(VS,$S,YS);case 5:return VS=parseInt(e.slice(1,2).repeat(2),16),$S=parseInt(e.slice(2,3).repeat(2),16),YS=parseInt(e.slice(3,4).repeat(2),16),GS=parseInt(e.slice(4,5).repeat(2),16),HS.toColor(VS,$S,YS,GS);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 i=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(i)return VS=parseInt(i[1],10),$S=parseInt(i[2],10),YS=parseInt(i[3],10),GS=Math.round(255*(void 0===i[5]?1:parseFloat(i[5]))),HS.toColor(VS,$S,YS,GS);if("transparent"===e)return{css:"transparent",rgba:0};if(!t||!s)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=s,t.fillStyle=e,"string"!=typeof t.fillStyle)throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[VS,$S,YS,GS]=t.getImageData(0,0,1,1).data,255!==GS)throw new Error("css.toColor: Unsupported css format");return{rgba:HS.toRgba(VS,$S,YS,GS),css:e}}})(KS||(KS={})),(e=>{function t(e,t,s){let i=e/255,n=t/255,r=s/255;return.2126*(i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4))+.7152*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t})(US||(US={})),(e=>{function t(e,t,s){let i=e>>24&255,n=e>>16&255,r=e>>8&255,o=t>>24&255,a=t>>16&255,l=t>>8&255,c=JS(US.relativeLuminance2(o,a,l),US.relativeLuminance2(i,n,r));for(;c<s&&(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=JS(US.relativeLuminance2(o,a,l),US.relativeLuminance2(i,n,r));return(o<<24|a<<16|l<<8|255)>>>0}function s(e,t,s){let i=e>>24&255,n=e>>16&255,r=e>>8&255,o=t>>24&255,a=t>>16&255,l=t>>8&255,c=JS(US.relativeLuminance2(o,a,l),US.relativeLuminance2(i,n,r));for(;c<s&&(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=JS(US.relativeLuminance2(o,a,l),US.relativeLuminance2(i,n,r));return(o<<24|a<<16|l<<8|255)>>>0}e.blend=function(e,t){if(1===(GS=(255&t)/255))return t;let s=t>>24&255,i=t>>16&255,n=t>>8&255,r=e>>24&255,o=e>>16&255,a=e>>8&255;return VS=r+Math.round((s-r)*GS),$S=o+Math.round((i-o)*GS),YS=a+Math.round((n-a)*GS),HS.toRgba(VS,$S,YS)},e.ensureContrastRatio=function(e,i,n){let r=US.relativeLuminance(e>>8),o=US.relativeLuminance(i>>8);if(JS(r,o)<n){if(o<r){let o=t(e,i,n),a=JS(r,US.relativeLuminance(o>>8));if(a<n){let t=s(e,i,n);return a>JS(r,US.relativeLuminance(t>>8))?o:t}return o}let a=s(e,i,n),l=JS(r,US.relativeLuminance(a>>8));if(l<n){let s=t(e,i,n);return l>JS(r,US.relativeLuminance(s>>8))?a:s}return a}},e.reduceLuminance=t,e.increaseLuminance=s,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}})(qS||(qS={}));var QS=class extends Yy{constructor(e,t,s){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=s}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()]}},ek=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Xy}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 s=[],i=t.translateToString(!0),n=t.getTrimmedLength(),r=0,o=0,a=0,l=t.getFg(0),c=t.getBg(0);for(let h=0;h<n;h++)if(t.loadCell(h,this._workCell),0!==this._workCell.getWidth()){if(this._workCell.fg!==l||this._workCell.bg!==c){if(h-r>1){let e=this._getJoinedRanges(i,a,o,t,r);for(let t=0;t<e.length;t++)s.push(e[t])}r=h,a=o,l=this._workCell.fg,c=this._workCell.bg}o+=this._workCell.getChars().length||1}if(n-r>1){let e=this._getJoinedRanges(i,a,o,t,r);for(let t=0;t<e.length;t++)s.push(e[t])}return s}_getJoinedRanges(e,t,s,i,n){let r=e.substring(t,s),o=[];try{o=this._characterJoiners[0].handler(r)}catch(a){console.error(a)}for(let c=1;c<this._characterJoiners.length;c++)try{let e=this._characterJoiners[c].handler(r);for(let t=0;t<e.length;t++)ek._mergeRanges(o,e[t])}catch(l){console.error(l)}return this._stringRangesToCellRanges(o,i,n),o}_stringRangesToCellRanges(e,t,s){let i=0,n=!1,r=0,o=e[i];if(!o)return;let a=t.getTrimmedLength();for(let l=s;l<a;l++){let s=t.getWidth(l),a=t.getString(l).length||1;if(0!==s){if(!n&&o[0]<=r&&(o[0]=l,n=!0),o[1]<=r){if(o[1]=l,o=e[++i],!o)break;o[0]<=r?(o[0]=l,n=!0):n=!1}r+=a}}o&&(o[1]=a)}static _mergeRanges(e,t){let s=!1;for(let i=0;i<e.length;i++){let n=e[i];if(s){if(t[1]<=n[0])return e[i-1][1]=t[1],e;if(t[1]<=n[1])return e[i-1][1]=Math.max(t[1],n[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(t[1]<=n[0])return e.splice(i,0,t),e;if(t[1]<=n[1])return n[0]=Math.min(t[0],n[0]),e;t[0]<n[1]&&(n[0]=Math.min(t[0],n[0]),s=!0)}}return s?e[e.length-1][1]=t[1]:e.push(t),e}};function tk(e){if(!e)throw new Error("value must not be falsy");return e}ek=Py([Ry(0,Qy)],ek);var sk=class{constructor(e,t,s,i,n,r,o){this._document=e,this._characterJoinerService=t,this._optionsService=s,this._coreBrowserService=i,this._coreService=n,this._decorationService=r,this._themeService=o,this._workCell=new Xy,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,s){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=s}createRow(e,t,s,i,n,r,o,a,l,c,h,u,d){let f=[];d&&(d.hasBlinkingCells=!1);let p=this._characterJoinerService.getJoinedCharacters(t),v=this._themeService.colors,g=e.getNoBgTrimmedLength();s&&g<r+1&&(g=r+1);let m,_,x,b=0,y="",w=0,S=0,k=0,C=!1,j=0,N=!1,M=0,B=[],L=-1!==h&&-1!==u;for(let D=0;D<g;D++){e.loadCell(D,this._workCell);let g=this._workCell.getWidth();if(0===g)continue;let E=!1,P=D>=M,R=D,A=this._workCell;if(p.length>0&&D===p[0][0]&&P){let i=p.shift(),n=this._isCellInSelection(i[0],t);for(_=i[0]+1;_<i[1];_++)P&&(P=n===this._isCellInSelection(_,t));P&&(P=!s||r<i[0]||r>=i[1]),P?(E=!0,A=new QS(this._workCell,e.translateToString(!0,i[0],i[1]),i[1]-i[0]),R=i[1]-1,g=A.getWidth()):M=i[1]}let z=this._isCellInSelection(D,t),T=s&&D===r,I=L&&D>=h&&D<=u;d&&A.isBlink()&&(d.hasBlinkingCells=!0),!a&&A.isBlink()&&B.push("xterm-blink-hidden");let O=!1;this._decorationService.forEachDecorationAtCell(D,t,void 0,e=>{O=!0});let H=A.getChars()||" ";if(" "===H&&(A.isUnderline()||A.isOverline())&&(H=" "),x=g*l-c.get(H,A.isBold(),A.isItalic()),m){if(b&&(z&&N||!z&&!N&&A.bg===w)&&(z&&N&&v.selectionForeground||A.fg===S)&&A.extended.ext===k&&I===C&&x===j&&!T&&!E&&!O&&P){A.isInvisible()?y+=" ":y+=H,b++;continue}b&&(m.textContent=y),m=this._document.createElement("span"),b=0,y=""}else m=this._document.createElement("span");if(w=A.bg,S=A.fg,k=A.extended.ext,C=I,j=x,N=z,E&&r>=D&&r<=R&&(r=D),!this._coreService.isCursorHidden&&T&&this._coreService.isCursorInitialized)if(B.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&B.push("xterm-cursor-blink"),B.push("bar"===i?"xterm-cursor-bar":"underline"===i?"xterm-cursor-underline":"xterm-cursor-block");else if(n)switch(n){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(${Yy.toColorRGB(A.getUnderlineColor()).join(",")})`;else{let e=A.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&A.isBold()&&e<8&&(e+=8),m.style.textDecorationColor=v.ansi[e].css}A.isOverline()&&(B.push("xterm-overline")," "===y&&(y=" ")),A.isStrikethrough()&&B.push("xterm-strikethrough"),I&&(m.style.textDecoration="underline");let F=A.getFgColor(),W=A.getFgColorMode(),K=A.getBgColor(),U=A.getBgColorMode(),q=!!A.isInverse();if(q){let e=F;F=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,V=e.backgroundColorRGB),e.foregroundColorRGB&&(W=50331648,F=e.foregroundColorRGB.rgba>>8&16777215,$=e.foregroundColorRGB),G="top"===e.options.layer)}),!G&&z&&(V=this._coreBrowserService.isFocused?v.selectionBackgroundOpaque:v.selectionInactiveBackgroundOpaque,K=V.rgba>>8&16777215,U=50331648,G=!0,v.selectionForeground&&(W=50331648,F=v.selectionForeground.rgba>>8&16777215,$=v.selectionForeground)),G&&B.push("xterm-decoration-top"),U){case 16777216:case 33554432:Y=v.ansi[K],B.push(`xterm-bg-${K}`);break;case 50331648:Y=HS.toColor(K>>16,K>>8&255,255&K),this._addStyle(m,`background-color:#${(K>>>0).toString(16).padStart(6,"0")}`);break;default:q?(Y=v.foreground,B.push("xterm-bg-257")):Y=v.background}switch(V||A.isDim()&&(V=WS.multiplyOpacity(Y,.5)),W){case 16777216:case 33554432:A.isBold()&&F<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(F+=8),this._applyMinimumContrast(m,Y,v.ansi[F],A,V,void 0)||B.push(`xterm-fg-${F}`);break;case 50331648:let e=HS.toColor(F>>16&255,F>>8&255,255&F);this._applyMinimumContrast(m,Y,e,A,V,$)||this._addStyle(m,`color:#${F.toString(16).padStart(6,"0")}`);break;default:this._applyMinimumContrast(m,Y,v.foreground,A,V,$)||q&&B.push("xterm-fg-257")}B.length&&(m.className=B.join(" "),B.length=0),T||E||O||!P?m.textContent=y:b++,x!==this.defaultSpacing&&(m.style.letterSpacing=`${x}px`),f.push(m),D=R}return m&&b&&(m.textContent=y),f}_applyMinimumContrast(e,t,s,i,n,r){if(1===this._optionsService.rawOptions.minimumContrastRatio||(function(e){return 57508<=e&&e<=57558}(o=i.getCode())||function(e){return 9472<=e&&e<=9631}(o)))return!1;var o;let a,l=this._getContrastCache(i);if(!n&&!r&&(a=l.getColor(t.rgba,s.rgba)),void 0===a){let e=this._optionsService.rawOptions.minimumContrastRatio/(i.isDim()?2:1);a=WS.ensureContrastRatio(n??t,r??s,e),l.setColor((n??t).rgba,(r??s).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 s=this._selectionStart,i=this._selectionEnd;return!(!s||!i)&&(this._columnSelectMode?s[0]<=i[0]?e>=s[0]&&t>=s[1]&&e<i[0]&&t<=i[1]:e<s[0]&&t>=s[1]&&e>=i[0]&&t<=i[1]:t>s[1]&&t<i[1]||s[1]===i[1]&&t===s[1]&&e>=s[0]&&e<i[0]||s[1]<i[1]&&t===i[1]&&e<i[0]||s[1]<i[1]&&t===s[1]&&e>=s[0])}};sk=Py([Ry(1,mw),Ry(2,rw),Ry(3,dw),Ry(4,tw),Ry(5,lw),Ry(6,_w)],sk);var ik=class{constructor(e=()=>new nk){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,s,i){e===this._font&&t===this._fontSize&&s===this._weight&&i===this._weightBold||(this._font=e,this._fontSize=t,this._weight=s,this._weightBold=i,this._canvasElements[0].setFont(e,t,s,!1),this._canvasElements[1].setFont(e,t,i,!1),this._canvasElements[2].setFont(e,t,s,!0),this._canvasElements[3].setFont(e,t,i,!0),this.clear())}get(e,t,s){let i;if(!t&&!s&&1===e.length&&(i=e.charCodeAt(0))<256){if(-9999!==this._flat[i])return this._flat[i];let t=this._measure(e,0);return t>0&&(this._flat[i]=t),t}let n=e;t&&(n+="B"),s&&(n+="I");let r=this._holey.get(n);if(void 0===r){let i=0;t&&(i|=1),s&&(i|=2),r=this._measure(e,i),r>0&&this._holey.set(n,r)}return r}_measure(e,t){return this._canvasElements[t].measure(e)}},nk=class{constructor(){typeof OffscreenCanvas<"u"?(this._canvas=new OffscreenCanvas(1,1),this._ctx=tk(this._canvas.getContext("2d"))):(this._canvas=document.createElement("canvas"),this._canvas.width=1,this._canvas.height=1,this._ctx=tk(this._canvas.getContext("2d")))}setFont(e,t,s,i){let n=i?"italic":"";this._ctx.font=`${n} ${s} ${t}px ${e}`.trim()}measure(e){return this._ctx.measureText(e).width}},rk=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,s,i=!1){if(this.selectionStart=t,this.selectionEnd=s,!t||!s||t[0]===s[0]&&t[1]===s[1])return void this.clear();let n=e.buffers.active.ydisp,r=t[1]-n,o=s[1]-n,a=Math.max(r,0),l=Math.min(o,e.rows-1);a>=e.rows||l<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=r,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=l,this.startCol=t[0],this.endCol=s[0])}isCellSelected(e,t,s){return!!this.hasSelection&&(s-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&s>=this.viewportCappedStartRow&&t<this.endCol&&s<=this.viewportCappedEndRow:t<this.startCol&&s>=this.viewportCappedStartRow&&t>=this.endCol&&s<=this.viewportCappedEndRow:s>this.viewportStartRow&&s<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol)}};var ok=class extends kw{constructor(e,t,s){super(),this._renderCallback=e,this._coreBrowserService=t,this._optionsService=s,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(yw(()=>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)}},ak=1,lk=class extends kw{constructor(e,t,s,i,n,r,o,a,l,c,h,u,d,f){super(),this._terminal=e,this._document=t,this._element=s,this._screenElement=i,this._viewportElement=n,this._helperContainer=r,this._linkifier2=o,this._charSizeService=l,this._optionsService=c,this._bufferService=h,this._coreService=u,this._coreBrowserService=d,this._themeService=f,this._terminalClass=ak++,this._rowElements=[],this._selectionRenderModel=new rk,this._lastSelectionColumnMode=!1,this._rowHasBlinkingCells=[],this._rowHasBlinkingCellsCount=0,this._onRequestRedraw=this._register(new mS),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(sk,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 ck(this._rowContainer,this._coreBrowserService),this._register(Dw(this._document,"mousedown",()=>this._cursorBlinkStateManager.restartBlinkAnimation())),this._register(yw(()=>this._cursorBlinkStateManager.dispose())),this._textBlinkStateManager=this._register(new ok(()=>this._onRequestRedraw.fire({start:0,end:this._bufferService.rows-1}),this._coreBrowserService,this._optionsService)),this._register(yw(()=>{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 ik,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 s of this._rowElements)s.style.width=`${this.dimensions.css.canvas.width}px`,s.style.height=`${this.dimensions.css.cell.height}px`,s.style.lineHeight=`${this.dimensions.css.cell.height}px`,s.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: ${WS.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 s=`blink_underline_${this._terminalClass}`,i=`blink_bar_${this._terminalClass}`,n=`blink_block_${this._terminalClass}`;t+=`@keyframes ${s} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${i} { 50% { box-shadow: none; }}`,t+=`@keyframes ${n} { 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: ${s} 1s step-end infinite;}${this._terminalSelector} .xterm-rows.xterm-focus .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .xterm-rows.xterm-focus .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${n} 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[r,o]of e.ansi.entries())t+=`${this._terminalSelector} .xterm-fg-${r} { color: ${o.css}; }${this._terminalSelector} .xterm-fg-${r}.xterm-dim { color: ${WS.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .xterm-bg-${r} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .xterm-fg-257 { color: ${WS.opaque(e.background).css}; }${this._terminalSelector} .xterm-fg-257.xterm-dim { color: ${WS.multiplyOpacity(WS.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 s=this._rowElements.length;s<=t;s++){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,s){let i=this._bufferService.rows;this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,s);let n=0,r=-1;this._lastSelectionStart&&this._lastSelectionEnd&&(this._selectionRenderModel.update(this._terminal,this._lastSelectionStart,this._lastSelectionEnd,this._lastSelectionColumnMode),this._selectionRenderModel.hasSelection&&(n=this._selectionRenderModel.viewportCappedStartRow,r=this._selectionRenderModel.viewportCappedEndRow));let o=0,a=-1;if(!e||!t)return;if(this._selectionRenderModel.update(this._terminal,e,t,s),this._selectionRenderModel.hasSelection){let i=this._selectionRenderModel.viewportStartRow,n=this._selectionRenderModel.viewportEndRow,r=this._selectionRenderModel.viewportCappedStartRow,l=this._selectionRenderModel.viewportCappedEndRow;o=r,a=l;let c=this._document.createDocumentFragment();if(s){let s=e[0]>t[0];c.appendChild(this._createSelectionElement(r,s?t[0]:e[0],s?e[0]:t[0],l-r+1))}else{let s=i===r?e[0]:0,o=r===n?t[0]:this._bufferService.cols;c.appendChild(this._createSelectionElement(r,s,o));let a=l-r-1;if(c.appendChild(this._createSelectionElement(r+1,0,this._bufferService.cols,a)),r!==l){let e=n===l?t[0]:this._bufferService.cols;c.appendChild(this._createSelectionElement(l,0,e))}}this._selectionContainer.appendChild(c)}let l=Math.min(n,o),c=Math.max(r,a);if(c>=0){l=Math.max(l,0),c=Math.min(c,i-1);let e=this._bufferService.buffer.y;this._selectionRenderModel.hasSelection&&e>=0&&e<i&&(l=Math.min(l,e),c=Math.max(c,e)),this.renderRows(l,c)}this._lastSelectionStart=e,this._lastSelectionEnd=t,this._lastSelectionColumnMode=s}_createSelectionElement(e,t,s,i=1){let n=this._document.createElement("div"),r=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(s-t);return r+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-r),n.style.height=i*this.dimensions.css.cell.height+"px",n.style.top=e*this.dimensions.css.cell.height+"px",n.style.left=`${r}px`,n.style.width=`${o}px`,n}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 s=this._bufferService.buffer,i=s.ybase+s.y,n=Math.min(s.x,this._bufferService.cols-1),r=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+s.ydisp,t=this._rowElements[c];if(!t)continue;let h=s.lines.get(e);h?(t.replaceChildren(...this._rowFactory.createRow(h,e,e===i,o,a,n,r,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,s,i,n,r){s<0&&(e=0),i<0&&(t=0);let o=this._bufferService.rows-1;s=Math.max(Math.min(s,o),0),i=Math.max(Math.min(i,o),0),n=Math.min(n,this._bufferService.cols);let a=this._bufferService.buffer,l=a.ybase+a.y,c=Math.min(a.x,n-1),h=this._optionsService.rawOptions.cursorBlink,u=this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle,f={hasBlinkingCells:!1};for(let p=s;p<=i;++p){let o=p+a.ydisp,v=this._rowElements[p];if(!v)continue;let g=a.lines.get(o);g?(v.replaceChildren(...this._rowFactory.createRow(g,o,o===l,u,d,c,h,this._textBlinkStateManager.isBlinkOn,this.dimensions.css.cell.width,this._widthCache,r?p===s?e:0:-1,r?(p===i?t:n)-1:-1,f)),this._setRowBlinkState(p,f.hasBlinkingCells)):(v.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)}};lk=Py([Ry(7,iw),Ry(8,uw),Ry(9,rw),Ry(10,Qy),Ry(11,tw),Ry(12,dw),Ry(13,_w)],lk);var ck=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}},hk=class extends kw{constructor(e,t,s){super(),this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=this._register(new mS),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new fk(this._optionsService))}catch{this._measureStrategy=this._register(new dk(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())}};hk=Py([Ry(2,rw)],hk);var uk=class extends kw{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)}},dk=class extends uk{constructor(e,t,s){super(),this._document=e,this._parentElement=t,this._optionsService=s,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}},fk=class extends uk{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}},pk=class extends kw{constructor(e,t,s){super(),this._textarea=e,this._window=t,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._onDprChange=this._register(new mS),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new mS),this.onWindowChange=this._onWindowChange.event,this._screenDprMonitor=this._register(new vk(this._window)),this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(cS.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Dw(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Dw(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}},vk=class extends kw{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Cw),this._onDprChange=this._register(new mS),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(yw(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Dw(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)}},gk=class extends kw{constructor(){super(),this.linkProviders=[],this._register(yw(()=>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 mk(e,t,s){let i=s.getBoundingClientRect(),n=e.getComputedStyle(s),r=parseInt(n.getPropertyValue("padding-left"),10),o=parseInt(n.getPropertyValue("padding-top"),10);return[t.clientX-i.left-r,t.clientY-i.top-o]}var _k=class{constructor(e,t){this._charSizeService=e,this._renderService=t}getCoords(e,t,s,i,n){return function(e,t,s,i,n,r,o,a,l){if(!r)return;let c=mk(e,t,s);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),i+(l?1:0)),c[1]=Math.min(Math.max(c[1],1),n),c}(Bw(t),e,t,s,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,n)}getMouseReportCoords(e,t){let s=mk(Bw(t),e,t);if(this._charSizeService.hasValidSize)return s[0]=Math.min(Math.max(s[0],0),this._renderService.dimensions.css.canvas.width-1),s[1]=Math.min(Math.max(s[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(s[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(s[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(s[0]),y:Math.floor(s[1])}}};_k=Py([Ry(0,uw),Ry(1,vw)],_k);var xk="object"==typeof window?window:globalThis;function bk(e,t=0){return e[e.length-(1+t)]}var yk=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};yk.Undefined=new yk(void 0);var wk,Sk,kk=yk,Ck=class{constructor(){this._first=kk.Undefined,this._last=kk.Undefined}push(e){return this._insert(e,!0)}_insert(e,t){let s=new kk(e);if(this._first===kk.Undefined)this._first=s,this._last=s;else if(t){let e=this._last;this._last=s,s.prev=e,e.next=s}else{let e=this._first;this._first=s,s.next=e,e.prev=s}let i=!1;return()=>{i||(i=!0,this._remove(s))}}_remove(e){if(e.prev!==kk.Undefined&&e.next!==kk.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===kk.Undefined&&e.next===kk.Undefined?(this._first=kk.Undefined,this._last=kk.Undefined):e.next===kk.Undefined?(this._last=this._last.prev,this._last.next=kk.Undefined):e.prev===kk.Undefined&&(this._first=this._first.next,this._first.prev=kk.Undefined)}*[Symbol.iterator](){let e=this._first;for(;e!==kk.Undefined;)yield e.element,e=e.next}};(Sk=wk||(wk={})).TAP="-xterm-gesturetap",Sk.CHANGE="-xterm-gesturechange",Sk.START="-xterm-gesturestart",Sk.END="-xterm-gesturesend",Sk.CONTEXT_MENU="-xterm-gesturecontextmenu";var jk=class e extends kw{constructor(){super(),this._dispatched=!1,this._targets=new Ck,this._ignoreTargets=new Ck,this._activeTouches={},this._handle=null,this._lastSetTapCountTime=0;let e=xk;this._register(Dw(e.document,"touchstart",e=>this._handleTouchStart(e),{passive:!1})),this._register(Dw(e.document,"touchend",t=>this._handleTouchEnd(e,t))),this._register(Dw(e.document,"touchmove",e=>this._handleTouchMove(e),{passive:!1}))}static addTarget(t){if(!e.isTouchDevice())return kw.None;return e._instance||(e._instance=new e),yw(e._instance._targets.push(t))}static ignoreTarget(t){if(!e.isTouchDevice())return kw.None;return e._instance||(e._instance=new e),yw(e._instance._ignoreTargets.push(t))}static isTouchDevice(){return"ontouchstart"in xk||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 s=0,i=e.targetTouches.length;s<i;s++){let i=e.targetTouches.item(s);this._activeTouches[i.identifier]={id:i.identifier,initialTarget:i.target,initialTimeStamp:t,initialPageX:i.pageX,initialPageY:i.pageY,rollingTimestamps:[t],rollingPageX:[i.pageX],rollingPageY:[i.pageY]};let n=this._newGestureEvent(wk.START,i.target);n.pageX=i.pageX,n.pageY=i.pageY,this._dispatchEvent(n)}this._dispatched&&(e.preventDefault(),e.stopPropagation(),this._dispatched=!1)}_handleTouchEnd(t,s){let i=Date.now(),n=Object.keys(this._activeTouches).length;for(let r=0,o=s.changedTouches.length;r<o;r++){let o=s.changedTouches.item(r);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-bk(a.rollingPageX))<30&&Math.abs(a.initialPageY-bk(a.rollingPageY))<30){let e=this._newGestureEvent(wk.TAP,a.initialTarget);e.pageX=bk(a.rollingPageX),e.pageY=bk(a.rollingPageY),this._dispatchEvent(e)}else if(l>=e._holdDelay&&Math.abs(a.initialPageX-bk(a.rollingPageX))<30&&Math.abs(a.initialPageY-bk(a.rollingPageY))<30){let e=this._newGestureEvent(wk.CONTEXT_MENU,a.initialTarget);e.pageX=bk(a.rollingPageX),e.pageY=bk(a.rollingPageY),this._dispatchEvent(e)}else if(1===n){let e=bk(a.rollingPageX),s=bk(a.rollingPageY),n=bk(a.rollingTimestamps)-a.rollingTimestamps[0],r=e-a.rollingPageX[0],o=s-a.rollingPageY[0],l=[...this._targets].filter(e=>a.initialTarget instanceof Node&&e.contains(a.initialTarget));this._inertia(t,l,i,Math.abs(r)/n,r>0?1:-1,e,Math.abs(o)/n,o>0?1:-1,s)}this._dispatchEvent(this._newGestureEvent(wk.END,a.initialTarget)),delete this._activeTouches[o.identifier]}this._dispatched&&(s.preventDefault(),s.stopPropagation(),this._dispatched=!1)}_newGestureEvent(e,t){let s=document.createEvent("CustomEvent");return s.initEvent(e,!1,!0),s.initialTarget=t,s.tapCount=0,s}_dispatchEvent(t){if(t.type===wk.TAP){let s,i=(new Date).getTime();s=i-this._lastSetTapCountTime>e._clearTapCountTime?1:2,this._lastSetTapCountTime=i,t.tapCount=s}else(t.type===wk.CHANGE||t.type===wk.CONTEXT_MENU)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let s of this._ignoreTargets)if(s.contains(t.initialTarget))return;let e=[];for(let s of this._targets)if(s.contains(t.initialTarget)){let i=0,n=t.initialTarget;for(;n&&n!==s;)i++,n=n.parentElement;e.push([i,s])}e.sort((e,t)=>e[0]-t[0]);for(let[,s]of e)s.dispatchEvent(t),this._dispatched=!0}}_inertia(t,s,i,n,r,o,a,l,c){this._handle=Kw(t,()=>{let h=Date.now(),u=h-i,d=0,f=0,p=!0;n+=e._scrollFriction*u,a+=e._scrollFriction*u,n>0&&(p=!1,d=r*n*u),a>0&&(p=!1,f=l*a*u);let v=this._newGestureEvent(wk.CHANGE);v.translationX=d,v.translationY=f,s.forEach(e=>e.dispatchEvent(v)),p||this._inertia(t,s,h,n,r,o+d,a,l,c+f)})}_handleTouchMove(e){let t=Date.now();for(let s=0,i=e.changedTouches.length;s<i;s++){let i=e.changedTouches.item(s);if(!this._activeTouches.hasOwnProperty(String(i.identifier))){console.warn("end of an UNKNOWN touch",i);continue}let n=this._activeTouches[i.identifier],r=this._newGestureEvent(wk.CHANGE,n.initialTarget);r.translationX=i.pageX-bk(n.rollingPageX),r.translationY=i.pageY-bk(n.rollingPageY),r.pageX=i.pageX,r.pageY=i.pageY,r.clientX=i.clientX,r.clientY=i.clientY,this._dispatchEvent(r),n.rollingPageX.length>3&&(n.rollingPageX.shift(),n.rollingPageY.shift(),n.rollingTimestamps.shift()),n.rollingPageX.push(i.pageX),n.rollingPageY.push(i.pageY),n.rollingTimestamps.push(t)}this._dispatched&&(e.preventDefault(),e.stopPropagation(),this._dispatched=!1)}};jk._scrollFriction=-.005,jk._holdDelay=700,jk._clearTapCountTime=400,Py([function(e,t,s){let i=null,n=null;if("function"==typeof s.value?(i="value",n=s.value,0!==n.length&&console.warn("Memoize should only be used in functions with zero parameters")):"function"==typeof s.get&&(i="get",n=s.get),!n||!i)throw new Error("not supported");let r=`$memoize$${t}`;s[i]=function(...e){return this.hasOwnProperty(r)||Object.defineProperty(this,r,{configurable:!1,enumerable:!1,writable:!1,value:n.apply(this,e)}),this[r]}}],jk,"isTouchDevice",1);var Nk=jk,Mk=class{constructor(e,t,s,i,n,r,o,a,l){this._renderService=e,this._mouseCoordsService=t,this._mouseStateService=s,this._coreService=i,this._bufferService=n,this._optionsService=r,this._selectionService=o,this._logService=a,this._coreBrowserService=l,this._lastEvent=null,this._wheelPartialScroll=0,this._touchScrollAccumulator=0}bindMouse(e,t,s){let{element:i,document:n}=e,r=new Cw,o=new Cw;t(r),t(o);let a={target:e,focus:s,requestedEvents:{mouseup:null,wheel:null,mousedrag:null,mousemove:null},mouseupListener:r,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 Bk(i,n,()=>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(i),null==(e=this._altMouseCursor)||e.sync()})),this._mouseStateService.activeProtocol=this._mouseStateService.activeProtocol,t(Dw(i,"mousedown",e=>this._handleMouseDown(a,e))),t(Dw(i,"wheel",e=>this._handlePassiveWheel(a,e),{passive:!1})),t(Nk.addTarget(e.screenElement)),t(Dw(e.screenElement,wk.START,()=>this._handleTouchStart())),t(Dw(e.screenElement,wk.CHANGE,e=>this._handleTouchChange(a,e)))}_sendEvent(e,t){var s,i,n,r,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==(r=null==(n=null==(i=null==(s=this._renderService)?void 0:s.dimensions)?void 0:i.device)?void 0:n.cell)?void 0:r.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:s,document:i}=e.target,n=s.ownerDocument??i;e.requestedEvents.mouseup&&(e.mouseupListener.value=Dw(n,"mouseup",e.requestedEvents.mouseup)),e.requestedEvents.mousedrag&&(e.mousedragListener.value=Dw(n,"mousemove",e.requestedEvents.mousedrag))}_handlePassiveWheel(e,t){var s,i,n,r,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==(r=null==(n=null==(i=null==(s=this._renderService)?void 0:s.dimensions)?void 0:i.device)?void 0:n.cell)?void 0:r.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 s,i;t.preventDefault(),t.stopPropagation(),e.requestedEvents.wheel?this._handleTouchScrollAsWheel(e,t):this._bufferService.buffer.hasScrollback?null==(i=(s=e.target).handleTouchScroll)||i.call(s,t.translationY):this._handleTouchScrollAsKeys(t)}_handleTouchScrollAsKeys(e){var t;let s=null==(t=this._renderService)?void 0:t.dimensions.css.cell.height;if(!s)return;this._touchScrollAccumulator-=e.translationY;let i=Math.trunc(this._touchScrollAccumulator/s);if(0===i)return;this._touchScrollAccumulator-=i*s;let n=""+(this._coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(i<0?"A":"B");for(let r=0;r<Math.abs(i);r++)this._coreService.triggerDataEvent(n,!0)}_handleTouchScrollAsWheel(e,t){var s;let i=null==(s=this._renderService)?void 0:s.dimensions.css.cell.height;if(!i)return;this._touchScrollAccumulator-=t.translationY;let n=Math.trunc(this._touchScrollAccumulator/i);if(0===n)return;this._touchScrollAccumulator-=n*i;let r=this._mouseCoordsService.getMouseReportCoords(t,e.target.screenElement);if(r)for(let o=0;o<Math.abs(n);o++)this._triggerMouseEvent({col:r.col,row:r.row,x:r.x,y:r.y,button:4,action:n<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,s){var i;let{element:n}=e.target,{requestedEvents:r}=e;s?"debug"===this._optionsService.rawOptions.logLevel&&this._logService.debug("Binding to mouse events:",this._explainEvents(s)):this._logService.debug("Unbinding from mouse events."),this._syncMouseModeState(n),null==(i=this._altMouseCursor)||i.sync(),8&s?r.mousemove||(n.addEventListener("mousemove",t.mousemove),r.mousemove=t.mousemove):(r.mousemove&&n.removeEventListener("mousemove",r.mousemove),r.mousemove=null),16&s?r.wheel||(n.addEventListener("wheel",t.wheel,{passive:!1}),r.wheel=t.wheel):(r.wheel&&n.removeEventListener("wheel",r.wheel),r.wheel=null),2&s?r.mouseup??(r.mouseup=t.mouseup):(e.mouseupListener.clear(),r.mouseup=null),4&s?r.mousedrag??(r.mousedrag=t.mousedrag):(e.mousedragListener.clear(),r.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,s){if(0===e.deltaY||e.shiftKey||void 0===t||void 0===s)return 0;let i=t/s,n=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(n/=i+0,Math.abs(e.deltaY)<50&&(n*=.3),this._wheelPartialScroll+=n,n=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(n*=this._bufferService.rows),n}_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,s){if(s){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)}};Mk=Py([Ry(0,vw),Ry(1,fw),Ry(2,ew),Ry(3,tw),Ry(4,Qy),Ry(5,rw),Ry(6,gw),Ry(7,nw),Ry(8,dw)],Mk);var Bk=class{constructor(e,t,s){this._element=e,this._document=t,this._isActive=s,this._listeners=new Cw}dispose(){this._listeners.dispose()}sync(){var e;if(this._listeners.clear(),!this._isActive())return;let t=new Sw,s=e=>this.syncFromModifier(e);t.add(Dw(this._document,"keydown",s)),t.add(Dw(this._document,"keyup",s)),t.add(Dw(this._element,"mousemove",s));let i=null==(e=this._element.ownerDocument)?void 0:e.defaultView;i&&t.add(Dw(i,"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")}},Lk=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,s){this._rowCount=s,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=[]}},Dk=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,s,i=0,n=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),i=Math.max(t,i),s=e.timeRemaining(),1.5*i>s)return n-t<-20&&this._logService.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),void this._start();n=s}this.clear()}},Ek="requestIdleCallback"in globalThis?class extends Dk{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:class extends Dk{_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())}}},Pk=class{constructor(e){this._queue=new Ek(e)}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}dispose(){this._queue.clear()}},Rk=class extends kw{constructor(e,t,s,i,n,r,o,a,l,c){super(),this._rowCount=e,this._optionsService=s,this._logService=i,this._charSizeService=n,this._coreService=r,this._coreBrowserService=l,this._renderer=this._register(new Cw),this._observerDisposable=this._register(new Cw),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 mS),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new mS),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new mS),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new mS),this.onRefreshRequest=this._onRefreshRequest.event,this._pausedResizeTask=this._register(new Pk(this._logService)),this._renderDebouncer=new Lk((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Ak(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(yw(()=>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 s=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});this._observerDisposable.value=yw(()=>{var e;null==(e=this._intersectionObserver)||e.disconnect(),this._intersectionObserver=void 0}),this._intersectionObserver=s,s.observe(t)}}_handleIntersectionChange(e){var t,s;this._isPaused=void 0===e.isIntersecting?0===e.intersectionRatio:!e.isIntersecting,null==(s=null==(t=this._renderer.value)?void 0:t.handleViewportVisibilityChange)||s.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,s=!1,i=!1){if(this._isPaused)return void(this._needsFullRefresh=!0);if(this._coreService.decPrivateModes.synchronizedOutput)return void this._syncOutputHandler.bufferRows(e,t);let n=this._syncOutputHandler.flush();n&&(e=Math.min(e,n.start),t=Math.max(t,n.end)),i||(this._isNextRenderRedrawOnly=!1),s?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 s;return null==(s=this._renderer.value)?void 0:s.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,s){var i;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=s,null==(i=this._renderer.value)||i.handleSelectionChanged(e,t,s)}handleCursorMove(){var e;null==(e=this._renderer.value)||e.handleCursorMove()}clear(){var e;null==(e=this._renderer.value)||e.clear()}};Rk=Py([Ry(2,rw),Ry(3,nw),Ry(4,uw),Ry(5,tw),Ry(6,lw),Ry(7,Qy),Ry(8,dw),Ry(9,_w)],Rk);var Ak=class{constructor(e,t,s){this._coreBrowserService=e,this._coreService=t,this._onTimeout=s,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 zk(e,t,s,i){let n,r=s.buffer.x,o=s.buffer.y;if(!s.buffer.hasScrollback)return function(e,t,s,i,n,r){return 0===Tk(t,i,n,r).length?"":Wk(Hk(e,t,e,t-Ik(t,n),!1,n).length,Fk("D",r))}(r,o,0,t,s,i)+Tk(o,t,s,i)+function(e,t,s,i,n,r){let o;o=Tk(t,i,n,r).length>0?i-Ik(i,n):t;let a=i,l=function(e,t,s,i,n,r){let o;return o=Tk(t,i,n,r).length>0?i-Ik(i,n):t,e<s&&o<=i||e>=s&&o<i?"C":"D"}(e,t,s,i,n,r);return Wk(Hk(e,o,s,a,"C"===l,n).length,Fk(l,r))}(r,o,e,t,s,i);if(o===t)return n=r>e?"D":"C",Wk(Math.abs(r-e),Fk(n,i));n=o>t?"D":"C";let a=Math.abs(o-t),l=function(e,t){return t.cols-e}(o>t?e:r,s)+(a-1)*s.cols+1+function(e){return e-1}(o>t?r:e);return Wk(l,Fk(n,i))}function Tk(e,t,s,i){let n=e-Ik(e,s),r=t-Ik(t,s),o=Math.abs(n-r)-function(e,t,s){var i;let n=0,r=e-Ik(e,s),o=t-Ik(t,s);for(let a=0;a<Math.abs(r-o);a++){let o="A"===Ok(e,t)?-1:1;(null==(i=s.buffer.lines.get(r+o*a))?void 0:i.isWrapped)&&n++}return n}(e,t,s);return Wk(o,Fk(Ok(e,t),i))}function Ik(e,t){let s=0,i=t.buffer.lines.get(e),n=null==i?void 0:i.isWrapped;for(;n&&e>=0&&e<t.rows;)s++,i=t.buffer.lines.get(--e),n=null==i?void 0:i.isWrapped;return s}function Ok(e,t){return e>t?"A":"B"}function Hk(e,t,s,i,n,r){let o=e,a=t,l="";for(;(o!==s||a!==i)&&a>=0&&a<r.buffer.lines.length;)o+=n?1:-1,n&&o>r.cols-1?(l+=r.buffer.translateBufferLineToString(a,!1,e,o),o=0,e=0,a++):!n&&o<0&&(l+=r.buffer.translateBufferLineToString(a,!1,0,e+1),o=r.cols-1,e=o,a--);return l+r.buffer.translateBufferLineToString(a,!1,e,o)}function Fk(e,t){return""+(t?"O":"[")+e}function Wk(e,t){e=Math.floor(e);let s="";for(let i=0;i<e;i++)s+=t;return s}var Kk=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 Uk(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 qk=new RegExp(" ","g"),Vk=class extends kw{constructor(e,t,s,i,n,r,o,a,l,c){super(),this._element=e,this._screenElement=t,this._linkifier=s,this._bufferService=i,this._coreService=n,this._mouseCoordsService=r,this._optionsService=o,this._mouseStateService=a,this._renderService=l,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._trimListener=this._register(new Cw),this._workCell=new Xy,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new mS),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new mS),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new mS),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new mS),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 Kk(this._bufferService),this._activeSelectionMode=0,this._register(yw(()=>{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 s=this._bufferService.buffer,i=[];if(3===this._activeSelectionMode){if(e[0]===t[0])return"";let n=e[0]<t[0]?e[0]:t[0],r=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=s.translateBufferLineToString(o,!0,n,r);i.push(e)}}else{let n=e[1]===t[1]?t[0]:void 0;i.push(s.translateBufferLineToString(e[1],!0,e[0],n));for(let r=e[1]+1;r<=t[1]-1;r++){let e=s.lines.get(r),t=s.translateBufferLineToString(r,!0);(null==e?void 0:e.isWrapped)?i[i.length-1]+=t:i.push(t)}if(e[1]!==t[1]){let e=s.lines.get(t[1]),n=s.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?i[i.length-1]+=n:i.push(n)}}return i.map(e=>e.replace(qk," ")).join(nS?"\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())),rS&&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),s=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!!(s&&i&&t)&&this._areCoordsInSelection(t,s,i)}isCellInSelection(e,t){let s=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!(!s||!i)&&this._areCoordsInSelection([e,t],s,i)}_areCoordsInSelection(e,t,s){return e[1]>t[1]&&e[1]<s[1]||t[1]===s[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<s[0]||t[1]<s[1]&&e[1]===s[1]&&e[0]<s[0]||t[1]<s[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var s,i;let n=null==(i=null==(s=this._linkifier.currentLink)?void 0:s.link)?void 0:i.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=Uk(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return!!r&&(this._selectWordAt(r,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=mk(this._coreBrowserService.window,e,this._screenElement)[1],s=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=s?0:(t>s&&(t-=s),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:iS?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 s=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);s&&s.length!==this._model.selectionStart[0]&&0===s.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&&!(iS&&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 s=this._bufferService.buffer;if(this._model.selectionEnd[1]<s.lines.length){let e=s.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=zk(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,s=!(!e||!t||e[0]===t[0]&&e[1]===t[1]);s?!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,s):this._oldHasSelection&&this._fireOnSelectionChange(e,t,s)}_fireOnSelectionChange(e,t,s){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=s,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.value=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let s=t;for(let i=0;t>=i;i++){let n=e.loadCell(i,this._workCell).getChars().length;0===this._workCell.getWidth()?s--:n>1&&t!==i&&(s+=n-1)}return s}setSelection(e,t,s){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=s,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,s=!0,i=!0){if(e[0]>=this._bufferService.cols)return;let n=this._bufferService.buffer,r=n.lines.get(e[1]);if(!r)return;let o=n.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(r,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],s=e[0];0===r.getWidth(t)&&(h++,t--),2===r.getWidth(s)&&(u++,s++);let i=r.getString(s).length;for(i>1&&(f+=i-1,l+=i-1);t>0&&a>0&&!this._isCharWordSeparator(r.loadCell(t-1,this._workCell));){r.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(;s<r.length&&l+1<o.length&&!this._isCharWordSeparator(r.loadCell(s+1,this._workCell));){r.loadCell(s+1,this._workCell);let e=this._workCell.getChars().length;2===this._workCell.getWidth()?(u++,s++):e>1&&(f+=e-1,l+=e-1),l++,s++}}l++;let p=a+c-h+d,v=Math.min(this._bufferService.cols,l-a+h+u-d-f);if(t||""!==o.slice(a,l).trim()){if(s&&0===p&&32!==r.getCodePoint(0)){let t=n.lines.get(e[1]-1);if(t&&r.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,v+=e}}}if(i&&p+v===this._bufferService.cols&&32!==r.getCodePoint(this._bufferService.cols-1)){let t=n.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&&(v+=t.length)}}return{start:p,length:v}}}_selectWordAt(e,t){let s=this._getWordAt(e,t);if(s){for(;s.start<0;)s.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[s.start,e[1]],this._model.selectionStartLength=s.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let s=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,s--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,s++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,s]}}_isCharWordSeparator(e){return 0!==e.getWidth()&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),s={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=Uk(s,this._bufferService.cols)}};Vk=Py([Ry(3,Qy),Ry(4,tw),Ry(5,fw),Ry(6,rw),Ry(7,ew),Ry(8,vw),Ry(9,dw)],Vk);var $k=class{constructor(){this._data={}}set(e,t,s){this._data[e]||(this._data[e]={}),this._data[e][t]=s}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Yk=class{constructor(){this._color=new $k,this._css=new $k}setCss(e,t,s){this._css.set(e,t,s)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,s){this._color.set(e,t,s)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Gk=Object.freeze((()=>{let e=[KS.toColor("#2e3436"),KS.toColor("#cc0000"),KS.toColor("#4e9a06"),KS.toColor("#c4a000"),KS.toColor("#3465a4"),KS.toColor("#75507b"),KS.toColor("#06989a"),KS.toColor("#d3d7cf"),KS.toColor("#555753"),KS.toColor("#ef2929"),KS.toColor("#8ae234"),KS.toColor("#fce94f"),KS.toColor("#729fcf"),KS.toColor("#ad7fa8"),KS.toColor("#34e2e2"),KS.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let s=0;s<216;s++){let i=t[s/36%6|0],n=t[s/6%6|0],r=t[s%6];e.push({css:HS.toCss(i,n,r),rgba:HS.toRgba(i,n,r)})}for(let s=0;s<24;s++){let t=8+10*s;e.push({css:HS.toCss(t,t,t),rgba:HS.toRgba(t,t,t)})}return e})()),Xk=KS.toColor("#ffffff"),Zk=KS.toColor("#000000"),Jk=KS.toColor("#ffffff"),Qk=Zk,eC={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},tC=Xk,sC=class extends kw{constructor(e){super(),this._optionsService=e,this._contrastCache=new Yk,this._halfContrastCache=new Yk,this._onChangeColors=this._register(new mS),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Xk,background:Zk,cursor:Jk,cursorAccent:Qk,selectionForeground:void 0,selectionBackgroundTransparent:eC,selectionBackgroundOpaque:WS.blend(Zk,eC),selectionInactiveBackgroundTransparent:eC,selectionInactiveBackgroundOpaque:WS.blend(Zk,eC),scrollbarSliderBackground:WS.opacity(Xk,.2),scrollbarSliderHoverBackground:WS.opacity(Xk,.4),scrollbarSliderActiveBackground:WS.opacity(Xk,.5),overviewRulerBorder:Xk,ansi:Gk.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=iC(e.foreground,Xk),t.background=iC(e.background,Zk),t.cursor=WS.blend(t.background,iC(e.cursor,Jk)),t.cursorAccent=WS.blend(t.background,iC(e.cursorAccent,Qk)),t.selectionBackgroundTransparent=iC(e.selectionBackground,eC),t.selectionBackgroundOpaque=WS.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=iC(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=WS.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?iC(e.selectionForeground,XS):void 0,t.selectionForeground===XS&&(t.selectionForeground=void 0),WS.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=WS.opacity(t.selectionBackgroundTransparent,.3)),WS.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=WS.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=iC(e.scrollbarSliderBackground,WS.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=iC(e.scrollbarSliderHoverBackground,WS.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=iC(e.scrollbarSliderActiveBackground,WS.opacity(t.foreground,.5)),t.overviewRulerBorder=iC(e.overviewRulerBorder,tC),t.ansi=Gk.slice(),t.ansi[0]=iC(e.black,Gk[0]),t.ansi[1]=iC(e.red,Gk[1]),t.ansi[2]=iC(e.green,Gk[2]),t.ansi[3]=iC(e.yellow,Gk[3]),t.ansi[4]=iC(e.blue,Gk[4]),t.ansi[5]=iC(e.magenta,Gk[5]),t.ansi[6]=iC(e.cyan,Gk[6]),t.ansi[7]=iC(e.white,Gk[7]),t.ansi[8]=iC(e.brightBlack,Gk[8]),t.ansi[9]=iC(e.brightRed,Gk[9]),t.ansi[10]=iC(e.brightGreen,Gk[10]),t.ansi[11]=iC(e.brightYellow,Gk[11]),t.ansi[12]=iC(e.brightBlue,Gk[12]),t.ansi[13]=iC(e.brightMagenta,Gk[13]),t.ansi[14]=iC(e.brightCyan,Gk[14]),t.ansi[15]=iC(e.brightWhite,Gk[15]),e.extendedAnsi){let s=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<s;i++)t.ansi[i+16]=iC(e.extendedAnsi[i],Gk[i+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 iC(e,t){if(void 0!==e)try{return KS.toColor(e)}catch{}return t}sC=Py([Ry(0,rw)],sC);var nC={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 rC=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 s=this._getNumpadKeyCode(e);if(void 0!==s)return s;let i=this._getModifierKeyCode(e);if(void 0!==i)return i;let n=this._functionalKeyCodes[e.key];if(void 0!==n)return n;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,s,i){let n=i&&1!==s;if(t>0||n){let i="[1;"+(t>0?t:"1");return n&&(i+=":"+s),i+=e,i}return"["+e}_buildSs3Sequence(e,t,s,i){let n=i&&1!==s;if(t>0||n){let i="[1;"+(t>0?t:"1");return n&&(i+=":"+s),i+=e,i}return"O"+e}_buildCsiTildeSequence(e,t,s,i){let n=i&&1!==s,r="["+e;return(t>0||n)&&(r+=";"+(t>0?t:"1"),n&&(r+=":"+s)),r+="~",r}_buildCsiUSequence(e,t,s,i,n,r,o){let a,l=!!(2&n),c="["+t;!!(4&n)&&e.shiftKey&&1===e.key.length&&!r&&!o&&(a=e.key.codePointAt(0),c+=":"+a);let h=16&n&&3!==i&&1===e.key.length&&!r&&!o&&!e.ctrlKey?e.key.codePointAt(0):void 0,u=l&&1!==i&&(3===i||void 0===h);return(s>0||u||void 0!==h)&&(c+=";",s>0?c+=s:u&&(c+="1"),u&&(c+=":"+i)),void 0!==h&&(c+=";"+h),c+="u",c}evaluate(e,t,s=1,i=!1){let n={type:0,cancel:!1,key:void 0},r=this._encodeModifiers(e),o=this._isModifierKey(e),a=!!(2&t);if(!a&&3===s||o&&!(8&t)||this._isLockKey(e)&&!(8&t))return n;let l=this._csiLetterKeys[e.key];if(l)return n.key=this._buildCsiLetterSequence(l,r,s,a),n.cancel=!0,n;let c=this._ss3FunctionKeys[e.key];if(c)return n.key=this._buildSs3Sequence(c,r,s,a),n.cancel=!0,n;let h=this._csiTildeKeys[e.key];if(void 0!==h)return n.key=this._buildCsiTildeSequence(h,r,s,a),n.cancel=!0,n;let u=this._getKeyCode(e,i);if(void 0===u)return n;let d=13===u||9===u||127===u;if(d&&3===s&&!(8&t))return n;let f=void 0!==this._functionalKeyCodes[e.key]||void 0!==this._getNumpadKeyCode(e);if(8&t||a&&3===s||(1&t||a)&&(f&&!d||r>0&&1!==e.key.length||r-1>1))n.key=this._buildCsiUSequence(e,u,r,s,t,f,o),n.cancel=!0;else{let t=13===u?"\r":9===u?"\t":127===u?"":void 0;t?n.key=t:1===e.key.length&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&(n.key=e.key)}return n}static shouldUseProtocol(e){return e>0}},oC=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_`}}},aC=class{constructor(e,t){this._coreService=e,this._optionsService=t}_getWin32InputMode(){return this._win32InputMode??(this._win32InputMode=new oC),this._win32InputMode}_getKittyKeyboard(){return this._kittyKeyboard??(this._kittyKeyboard=new rC),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,iS&&this._optionsService.rawOptions.macOptionIsMeta):function(e,t,s,i){var n;let r={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?r.key=t?"OA":"[A":"UIKeyInputLeftArrow"===e.key?r.key=t?"OD":"[D":"UIKeyInputRightArrow"===e.key?r.key=t?"OC":"[C":"UIKeyInputDownArrow"===e.key&&(r.key=t?"OB":"[B");break;case 8:r.key=e.ctrlKey?"\b":"",e.altKey&&(r.key=""+r.key);break;case 9:if(e.shiftKey){r.key="[Z";break}r.key="\t",r.cancel=!0;break;case 13:"c"===e.key&&e.ctrlKey?r.key="":r.key=e.altKey?"\r":"\r",r.cancel=!0;break;case 27:r.key="",e.altKey&&(r.key=""),r.cancel=!0;break;case 37:if(e.metaKey)break;r.key=o?"[1;"+(o+1)+"D":t?"OD":"[D";break;case 39:if(e.metaKey)break;r.key=o?"[1;"+(o+1)+"C":t?"OC":"[C";break;case 38:if(e.metaKey)break;r.key=o?"[1;"+(o+1)+"A":t?"OA":"[A";break;case 40:if(e.metaKey)break;r.key=o?"[1;"+(o+1)+"B":t?"OB":"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(r.key="[2~");break;case 46:r.key=o?"[3;"+(o+1)+"~":"[3~";break;case 36:r.key=o?"[1;"+(o+1)+"H":t?"OH":"[H";break;case 35:r.key=o?"[1;"+(o+1)+"F":t?"OF":"[F";break;case 33:e.shiftKey?r.type=2:e.ctrlKey?r.key="[5;"+(o+1)+"~":r.key="[5~";break;case 34:e.shiftKey?r.type=3:e.ctrlKey?r.key="[6;"+(o+1)+"~":r.key="[6~";break;case 112:r.key=o?"[1;"+(o+1)+"P":"OP";break;case 113:r.key=o?"[1;"+(o+1)+"Q":"OQ";break;case 114:r.key=o?"[1;"+(o+1)+"R":"OR";break;case 115:r.key=o?"[1;"+(o+1)+"S":"OS";break;case 116:r.key=o?"[15;"+(o+1)+"~":"[15~";break;case 117:r.key=o?"[17;"+(o+1)+"~":"[17~";break;case 118:r.key=o?"[18;"+(o+1)+"~":"[18~";break;case 119:r.key=o?"[19;"+(o+1)+"~":"[19~";break;case 120:r.key=o?"[20;"+(o+1)+"~":"[20~";break;case 121:r.key=o?"[21;"+(o+1)+"~":"[21~";break;case 122:r.key=o?"[23;"+(o+1)+"~":"[23~";break;case 123:r.key=o?"[24;"+(o+1)+"~":"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(s&&!i||!e.altKey||e.metaKey)if(!s||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey){if(e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&1===e.key.length)r.key=e.key;else if(e.key&&e.ctrlKey&&e.shiftKey)switch(e.code){case"Minus":r.key="";break;case"Digit2":r.key="\0";break;case"Digit6":r.key=""}}else 65===e.keyCode&&(r.type=1);else{let t=null==(n=nC[e.keyCode])?void 0:n[e.shiftKey?1:0];if(t)r.key=""+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,s=String.fromCharCode(t);e.shiftKey&&(s=s.toUpperCase()),r.key=""+s}else if(32===e.keyCode)r.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()),r.key=""+t,r.cancel=!0}}else e.keyCode>=65&&e.keyCode<=90?r.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?r.key="\0":e.keyCode>=51&&e.keyCode<=55?r.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?r.key="":"/"===e.key?r.key="":219===e.keyCode?r.key="":220===e.keyCode?r.key="":221===e.keyCode&&(r.key="")}return r}(e,this._coreService.decPrivateModes.applicationCursorKeys,iS,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,iS&&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)||!rC.shouldUseProtocol(t))}get useWin32InputMode(){var e;return!(!(null==(e=this._optionsService.rawOptions.vtExtensions)?void 0:e.win32InputMode)||!this._coreService.decPrivateModes.win32InputMode)}};aC=Py([Ry(0,tw),Ry(1,rw)],aC);var lC=class{constructor(...e){this._entries=new Map;for(let[t,s]of e)this.set(t,s)}set(e,t){let s=this._entries.get(e);return this._entries.set(e,t),s}forEach(e){for(let[t,s]of this._entries.entries())e(t,s)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},cC=class{constructor(){this._services=new lC,this._services.set(iw,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let s=(n=e,n.di$dependencies||[]).sort((e,t)=>e.index-t.index),i=[];var n;for(let o of s){let t=this._services.get(o.id);if(!t)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);i.push(t)}let r=s.length>0?s[0].index:t.length;if(t.length!==r)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${r+1} conflicts with ${t.length} static arguments`);return new e(...t,...i)}},hC={trace:0,debug:1,info:2,warn:3,error:4,off:5},uC=class extends kw{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=hC[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,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+t,...s)}trace(e,...t){var s;this._logLevel<=0&&this._log((null==(s=this._optionsService.options.logger)?void 0:s.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var s;this._logLevel<=1&&this._log((null==(s=this._optionsService.options.logger)?void 0:s.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var s;this._logLevel<=2&&this._log((null==(s=this._optionsService.options.logger)?void 0:s.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var s;this._logLevel<=3&&this._log((null==(s=this._optionsService.options.logger)?void 0:s.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var s;this._logLevel<=4&&this._log((null==(s=this._optionsService.options.logger)?void 0:s.error.bind(this._optionsService.options.logger))??console.error,e,t)}};uC=Py([Ry(0,rw)],uC);var dC=class extends kw{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new mS),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new mS),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new mS),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 s=0;s<Math.min(e,this.length);s++)t[s]=this._array[this._getCyclicIndex(s)];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,...s){if(t){for(let s=e;s<this._length-t;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+s.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<s.length;i++)this._array[this._getCyclicIndex(e+i)]=s[i];if(s.length&&this.onInsertEmitter.fire({index:e,amount:s.length}),this._length+s.length>this._maxLength){let e=this._length+s.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=s.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,s){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+s<0)throw new Error("Cannot shift elements in list beyond index 0");if(s>0){for(let n=t-1;n>=0;n--)this.set(e+n+s,this.get(e+n));let i=e+t+s-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<t;i++)this.set(e+i+s,this.get(e+i))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},fC=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("")}},pC=class{constructor(e){this._limit=e,this._builder=new fC}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()}},vC=Object.freeze(new Yy),gC=0,mC=new Xy,_C=new fC,xC=class e{constructor(e,t,s,i=!1){this._stringCache=e,this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*t);let n=s??Xy.fromCharData([0,"",1,0]);for(let r=0;r<t;++r)this.setCell(r,n);this.length=t}get(e){let t=this._data[3*e+0],s=2097151&t;return[this._data[3*e+1],2097152&t?this._combined[e]:s?Uy(s):"",t>>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):s]}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?Uy(2097151&t):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,t){return gC=3*e,t.content=this._data[gC+0],t.fg=this._data[gC+1],t.bg=this._data[gC+2],2097152&t.content?t.combinedData=this._combined[e]:t.combinedData="",268435456&t.bg?t.extended=this._extendedAttrs[e]:t.extended=vC.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,s,i){this._invalidateStringCache(),268435456&i.bg&&(this._extendedAttrs[e]=i.extended),this._data[3*e+0]=t|s<<22,this._data[3*e+1]=i.fg,this._data[3*e+2]=i.bg}addCodepointToCell(e,t,s){this._invalidateStringCache();let i=this._data[3*e+0];2097152&i?this._combined[e]+=Uy(t):2097151&i?(this._combined[e]=Uy(2097151&i)+Uy(t),i&=-2097152,i|=2097152):i=t|1<<22,s&&(i&=-12582913,i|=s<<22),this._data[3*e+0]=i}insertCells(e,t,s){if(this._invalidateStringCache(),(e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,s),t<this.length-e){for(let s=this.length-e-t-1;s>=0;--s)this.setCell(e+t+s,this.loadCell(e+s,mC));for(let i=0;i<t;++i)this.setCell(e+i,s)}else for(let i=e;i<this.length;++i)this.setCell(i,s);2===this.getWidth(this.length-1)&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(e,t,s){if(this._invalidateStringCache(),e%=this.length,t<this.length-e){for(let s=0;s<this.length-e-t;++s)this.setCell(e+s,this.loadCell(e+t+s,mC));for(let e=this.length-t;e<this.length;++e)this.setCell(e,s)}else for(let i=e;i<this.length;++i)this.setCell(i,s);e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,s),0===this.getWidth(e)&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,s)}replaceCells(e,t,s,i=!1){if(this._invalidateStringCache(),i)for(e&&2===this.getWidth(e-1)&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,s),t<this.length&&2===this.getWidth(t-1)&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,s);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,s),e++;else for(e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,s),t<this.length&&2===this.getWidth(t-1)&&this.setCellFromCodepoint(t,0,1,s);e<t&&e<this.length;)this.setCell(e++,s)}resize(e,t){if(this._invalidateStringCache(),e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let s=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*s)this._data=new Uint32Array(this._data.buffer,0,s);else{let e=new Uint32Array(s);e.set(this._data),this._data=e}for(let s=this.length;s<e;++s)this.setCell(s,t)}else{this._data=this._data.subarray(0,s);let t=Object.keys(this._combined);for(let s=0;s<t.length;s++){let i=parseInt(t[s],10);i>=e&&delete this._combined[i]}let i=Object.keys(this._extendedAttrs);for(let s=0;s<i.length;s++){let t=parseInt(i[s],10);t>=e&&delete this._extendedAttrs[t]}}return this.length=e,4*s*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 s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,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,s,i,n){this._invalidateStringCache();let r=e._data;if(n)for(let o=i-1;o>=0;o--){for(let e=0;e<3;e++)this._data[3*(s+o)+e]=r[3*(t+o)+e];this._copyCellMapsFrom(e,t+o,s+o)}else for(let o=0;o<i;o++){for(let e=0;e<3;e++)this._data[3*(s+o)+e]=r[3*(t+o)+e];this._copyCellMapsFrom(e,t+o,s+o)}}translateToString(e,t,s,i){var n,r;let o=(void 0===t||0===t)&&void 0===s&&void 0===i;o&&(null==(r=(n=this._stringCache).touch)||r.call(n));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,s=s??this.length,e&&(s=Math.min(s,this.getTrimmedLength())),i&&(i.length=0),_C.reset();t<s;){let e=this._data[3*t+0],s=2097151&e,n=2097152&e?this._combined[t]:s?Uy(s):" ";if(_C.append(n),i)for(let r=0;r<n.length;++r)i.push(t);t+=e>>22||1}i&&i.push(t);let l=_C.toString();if(_C.reset(),o){let t=this._getStringCacheEntry(!0);t.value=l,t.isTrimmed=!!e}return l}_getStringCacheEntry(e){var t;let s=null==(t=this._stringCacheEntryRef)?void 0:t.deref();if(s&&s.generation===this._stringCache.generation)return s;if(!e)return;let i=this._stringCache.allocateEntry();return this._stringCacheEntryRef=new WeakRef(i),i}_invalidateStringCache(){let e=this._getStringCacheEntry(!1);e&&(e.value=void 0,e.isTrimmed=!1)}_copyCellMapsFrom(e,t,s){let i=3*t;2097152&e._data[i+0]&&(this._combined[s]=e._combined[t]),268435456&e._data[i+2]&&(this._extendedAttrs[s]=e._extendedAttrs[t])}_copySparseMapsFrom(e){this._combined={},this._extendedAttrs={};for(let t=0;t<e.length;t++)this._copyCellMapsFrom(e,t,t)}},bC=class extends kw{constructor(){super(),this.generation=0,this.entries=new Set,this._clearTimeout=this._register(new Cw),this._lastAccessTimestamp=0,this._register(yw(()=>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 s=setTimeout(()=>{e()},t);return yw(()=>{clearTimeout(s)})}(()=>{let e=Date.now()-this._lastAccessTimestamp;e>=15e3?this.clear():this._scheduleClearTimeout(15e3-e)},e)}};function yC(e,t,s){let i=[],n=0;for(let l=0;l<e.length;l++)n+=wC(e,l,t);let r=0,o=0,a=0;for(;a<n;){if(n-a<s){i.push(n-a);break}r+=s;let l=wC(e,o,t);r>l&&(r-=l,o++);let c=2===e[o].getWidth(r-1);c&&r--;let h=c?s-1:s;i.push(h),a+=h}return i}function wC(e,t,s){if(t===e.length-1)return e[t].getTrimmedLength();let i=!e[t].hasContent(s-1)&&1===e[t].getWidth(s-1),n=2===e[t+1].getWidth(0);return i&&n?s-1:s}var SC=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new mS),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ww(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};SC._nextId=1;var kC=SC,CC={},jC=CC.B;CC[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:"≥","{":"π","|":"≠","}":"£","~":"·"},CC.A={"#":"£"},CC.B=void 0,CC[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},CC.C=CC[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},CC.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},CC.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},CC.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},CC.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},CC.E=CC[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},CC.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},CC.H=CC[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},CC["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var NC=4294967295,MC=class extends kw{constructor(e,t,s,i){super(),this._hasScrollback=e,this._optionsService=t,this._bufferService=s,this._logService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=vC.clone(),this.savedCharset=jC,this.savedCharsets=[],this.savedGlevel=0,this.savedOriginMode=!1,this.savedWraparoundMode=!0,this.markers=[],this._nullCell=Xy.fromCharData([0,"",1,0]),this._whitespaceCell=Xy.fromCharData([0," ",1,32]),this._isClearing=!1,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new dC(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops(),this._memoryCleanupQueue=new Ek(this._logService),this._register(yw(()=>this._memoryCleanupQueue.clear())),this._register(yw(()=>this.clearAllMarkers())),this._stringCache=this._register(new bC)}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 Gy),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 Gy),this._whitespaceCell}getBlankLine(e,t){return new xC(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>NC?NC:t}fillViewportRows(e){if(0===this.lines.length){e??(e=vC);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 dC(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let s=this.getNullCell(vC);this._stringCache.clear();let i=0,n=this._getCorrectBufferLength(t);if(n>this.lines.maxLength&&(this.lines.maxLength=n),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)i+=+this.lines.get(t).resize(e,s);let r=0;if(this._rows<t)for(let i=this._rows;i<t;i++)this.lines.length<t+this.ybase&&(void 0!==this._optionsService.rawOptions.windowsPty.backend||void 0!==this._optionsService.rawOptions.windowsPty.buildNumber?this.lines.push(new xC(this._stringCache,e,s,!1)):this.ybase>0&&this.lines.length<=this.ybase+this.y+r+1?(this.ybase--,r++,this.ydisp>0&&this.ydisp--):this.lines.push(new xC(this._stringCache,e,s,!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(n<this.lines.maxLength){let e=this.lines.length-n;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=n}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),r&&(this.y+=r),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 r=0;r<this.lines.length;r++)i+=+this.lines.get(r).resize(e,s);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(),i>.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 s=this._optionsService.rawOptions.reflowCursorLine,i=function(e,t,s,i,n,r){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(!r&&i>=a&&i<l){a+=h.length-1;continue}let u=0,d=wC(h,u,t),f=1,p=0;for(;f<h.length;){let e=wC(h,f,t),i=e-p,r=s-d,o=Math.min(i,r);h[u].copyCellsFrom(h[f],p,d,o,!1),d+=o,d===s&&(u++,d=0),p+=o,p===e&&(f++,p=0),0===d&&0!==u&&2===h[u-1].getWidth(s-1)&&(h[u].copyCellsFrom(h[u-1],s-1,d++,1,!1),h[u-1].setCell(s-1,n))}h[u].replaceCells(d,s,n);let v=0;for(let e=h.length-1;e>0&&(e>u||0===h[e].getTrimmedLength());e--)v++;v>0&&(o.push(a+h.length-v),o.push(v)),a+=h.length-1}return o}(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(vC),s);if(i.length>0){let s=function(e,t){let s=[],i=0,n=t[i],r=0;for(let o=0;o<e.length;o++)if(n===o){let s=t[++i];e.onDeleteEmitter.fire({index:o-r,amount:s}),o+=s-1,r+=s,n=t[++i]}else s.push(o);return{layout:s,countRemoved:r}}(this.lines,i);(function(e,t){let s=[];for(let i=0;i<t.length;i++)s.push(e.get(t[i]));for(let i=0;i<s.length;i++)e.set(i,s[i]);e.length=t.length})(this.lines,s.layout),this._reflowLargerAdjustViewport(e,t,s.countRemoved)}}_reflowLargerAdjustViewport(e,t,s){let i=this.getNullCell(vC),n=s;for(;n-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new xC(this._stringCache,e,i,!1))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-s,0)}_reflowSmaller(e,t){let s=this._optionsService.rawOptions.reflowCursorLine,i=this.getNullCell(vC),n=[],r=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(!s){let e=this.ybase+this.y;if(e>=o&&e<o+l.length)continue}let c,h=l[l.length-1].getTrimmedLength(),u=yC(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(vC,!0);f.push(e)}f.length>0&&(n.push({start:o+l.length+r,newLines:f}),r+=f.length),l.push(...f);let p=u.length-1,v=u[p];0===v&&(p--,v=u[p]);let g=l.length-d-1,m=h;for(;g>=0;){let e=Math.min(m,v);if(void 0===l[p])break;if(l[p].copyCellsFrom(l[g],m-e,v-e,e,!0),v-=e,0===v&&(p--,v=u[p]),m-=e,0===m){g--,m=wC(l,Math.max(g,0),this._cols)}}for(let t=0;t<l.length;t++)u[t]<e&&l[t].setCell(u[t],i);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+r)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(n.length>0){let e=[],t=[];for(let n=0;n<this.lines.length;n++)t.push(this.lines.get(n));let s=this.lines.length,i=s-1,o=0,a=n[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+r);let l=0;for(let u=Math.min(this.lines.maxLength-1,s+r-1);u>=0;u--)if(a&&a.start>i+l){for(let e=a.newLines.length-1;e>=0;e--)this.lines.set(u--,a.newLines[e]);u++,e.push({index:i+1,amount:a.newLines.length}),l+=a.newLines.length,a=n[++o]}else this.lines.set(u,t[i--]);let c=0;for(let n=e.length-1;n>=0;n--)e[n].index+=c,this.lines.onInsertEmitter.fire(e[n]),c+=e[n].amount;let h=Math.max(0,s+r-this.lines.maxLength);h>0&&this.lines.onTrimEmitter.fire(h)}}translateBufferLineToString(e,t,s=0,i){let n=this.lines.get(e);return n?n.translateToString(t,s,i):""}getWrappedRangeForLine(e){let t=e,s=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;s+1<this.lines.length&&this.lines.get(s+1).isWrapped;)s++;return{first:t,last:s}}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 kC(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)}},BC=class extends kw{constructor(e,t,s){super(),this._optionsService=e,this._bufferService=t,this._logService=s,this._normalBuffer=this._register(new Cw),this._altBuffer=this._register(new Cw),this._onBufferActivate=this._register(new mS),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 MC(!0,this._optionsService,this._bufferService,this._logService),this._normalBuffer.value=this._normal,this._normal.fillViewportRows(),this._alt=new MC(!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)}},LC=class extends kw{constructor(e,t){super(),this.isUserScrolling=!1,this._onResize=this._register(new mS),this.onResize=this._onResize.event,this._onScroll=this._register(new mS),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 BC(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 s=this.cols!==e,i=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:s,rowsChanged:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let s,i=this.buffer;s=this._cachedBlankLine,(!s||s.length!==this.cols||s.getFg(0)!==e.fg||s.getBg(0)!==e.bg)&&(s=i.getBlankLine(e,t),this._cachedBlankLine=s),s.isWrapped=t;let n=i.ybase+i.scrollTop,r=i.ybase+i.scrollBottom;if(0===i.scrollTop){let e=i.lines.isFull;r===i.lines.length-1?e?i.lines.recycle().copyFrom(s):i.lines.push(s.clone()):i.lines.splice(r+1,0,s.clone()),e?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let e=r-n+1;i.lines.shiftElements(n+1,e-1,-1),i.lines.set(r,s.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,t){let s=this.buffer;if(e<0){if(0===s.ydisp)return;this.isUserScrolling=!0}else e+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);let i=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+e,s.ybase),0),i!==s.ydisp&&(t||this._onScroll.fire(s.ydisp))}};LC=Py([Ry(0,rw),Ry(1,nw)],LC);var DC={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:iS,windowOptions:{},windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",quirks:{},vtExtensions:{}},EC=["normal","bold","100","200","300","400","500","600","700","800","900"],PC=class extends kw{constructor(e){super(),this._onOptionChange=this._register(new mS),this.onOptionChange=this._onOptionChange.event;let t={...DC};for(let s in e)if(s in t)try{let i=e[s];t[s]=this._sanitizeAndValidateOption(s,i)}catch(Sk){console.error(Sk)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(yw(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(s=>{s===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(s=>{-1!==e.indexOf(s)&&t()})}_setupOptions(){let e=e=>{if(!(e in DC))throw new Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in DC))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 s in this.rawOptions){let i={get:e.bind(this,s),set:t.bind(this,s)};Object.defineProperty(this.options,s,i)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=DC[e]),"block"!==(s=t)&&"underline"!==s&&"bar"!==s)throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=DC[e]);break;case"fontWeight":case"fontWeightBold":if("number"==typeof t&&1<=t&&t<=1e3)break;t=EC.includes(t)?t:DC[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 s;return t}};var RC=Object.freeze({insertMode:!1}),AC=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}),zC=class extends kw{constructor(e,t,s){super(),this._bufferService=e,this._logService=t,this._optionsService=s,this.isCursorHidden=!1,this._onData=this._register(new mS),this.onData=this._onData.event,this._onUserInput=this._register(new mS),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new mS),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new mS),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.isCursorInitialized=s.rawOptions.showCursorImmediately??!1,this.modes=structuredClone(RC),this.decPrivateModes=structuredClone(AC),this.kittyKeyboard={flags:0,mainFlags:0,altFlags:0,mainStack:[],altStack:[]}}reset(){this.modes=structuredClone(RC),this.decPrivateModes=structuredClone(AC),this.kittyKeyboard={flags:0,mainFlags:0,altFlags:0,mainStack:[],altStack:[]}}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let s=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&s.ybase!==s.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))}};zC=Py([Ry(0,Qy),Ry(1,nw),Ry(2,rw)],zC);var TC={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 IC(e,t){let s=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return 4===e.button?(s|=64,s|=e.action):(s|=3&e.button,4&e.button&&(s|=64),8&e.button&&(s|=128),32===e.action?s|=32:0===e.action&&!t&&(s|=3)),s}var OC,HC=String.fromCharCode,FC={DEFAULT:e=>{let t=[IC(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`[M${HC(t[0])}${HC(t[1])}${HC(t[2])}`},SGR:e=>{let t=0===e.action&&4!==e.button?"m":"M";return`[<${IC(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=0===e.action&&4!==e.button?"m":"M";return`[<${IC(e,!0)};${e.x};${e.y}${t}`}},WC=class extends kw{constructor(){super(),this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._onProtocolChange=this._register(new mS),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(TC))this.addProtocol(e,TC[e]);for(let e of Object.keys(FC))this.addEncoding(e,FC[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}},KC=class e{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new mS,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,s=!1){return(16777215&e)<<3|(3&t)<<1|(s?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 s=0,i=0,n=t.length;for(let r=0;r<n;++r){let o=t.charCodeAt(r);if(55296<=o&&o<=56319){if(++r>=n)return s+this.wcwidth(o);let e=t.charCodeAt(r);56320<=e&&e<=57343?o=1024*(o-55296)+e-56320+65536:s+=this.wcwidth(e)}let a=this.charProperties(o,i),l=e.extractWidth(a);e.extractShouldJoin(a)&&(l-=e.extractWidth(i)),s+=l,i=a}return s}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},UC=[[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]],qC=[[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 VC=class{constructor(){if(this.version="6",!OC){(OC=new Uint8Array(65536)).fill(1),OC[0]=0,OC.fill(0,1,32),OC.fill(0,127,160),OC.fill(2,4352,4448),OC[9001]=2,OC[9002]=2,OC.fill(2,11904,42192),OC[12351]=1,OC.fill(2,44032,55204),OC.fill(2,63744,64256),OC.fill(2,65040,65050),OC.fill(2,65072,65136),OC.fill(2,65280,65377),OC.fill(2,65504,65511);for(let e=0;e<UC.length;++e)OC.fill(0,UC[e][0],UC[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?OC[e]:function(e,t){let s,i=0,n=t.length-1;if(e<t[0][0]||e>t[n][1])return!1;for(;n>=i;)if(s=i+n>>1,e>t[s][1])i=s+1;else{if(!(e<t[s][0]))return!0;n=s-1}return!1}(e,qC)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let s=this.wcwidth(e),i=0===s&&0!==t;if(i){let e=KC.extractWidth(t);0===e?i=!1:e>s&&(s=e)}return KC.createPropertyValue(0,s,i)}},$C=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 YC(e){var t;let s=null==(t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))?void 0:t.get(e.cols-1),i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);i&&s&&(i.isWrapped=0!==s[3]&&32!==s[3])}var GC=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 s=new e;if(!t.length)return s;for(let e=Array.isArray(t[0])?1:0;e<t.length;++e){let i=t[e];if(Array.isArray(i))for(let e=0;e<i.length;++e)s.addSubParam(i[e]);else s.addParam(i)}return s}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 s=this._subParamsIdx[t]>>8,i=255&this._subParamsIdx[t];i-s>0&&e.push(Array.prototype.slice.call(this._subParams,s,i))}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,s=255&this._subParamsIdx[e];return s-t>0?this._subParams.subarray(t,s):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let s=this._subParamsIdx[t]>>8,i=255&this._subParamsIdx[t];i-s>0&&(e[t]=this._subParams.slice(s,i))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,i=s[t-1];s[t-1]=~i?Math.min(10*i+e,2147483647):e}},XC=[],ZC=class{constructor(){this._state=0,this._active=XC,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){var s;(s=this._handlers)[e]??(s[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let e=i.indexOf(t);-1!==e&&i.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=XC}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=XC,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||XC,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,s){if(this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,s);else this._handlerFb(this._id,"PUT",qy(e,t,s))}start(){this.reset(),this._state=1}put(e,t,s){if(3!==this._state){if(1===this._state)for(;t<s;){let s=e[t++];if(59===s){this._state=2,this._start();break}if(s<48||57<s)return void(this._state=3);-1===this._id&&(this._id=0),this._id=10*this._id+s-48}2===this._state&&s-t>0&&this._put(e,t,s)}}end(e,t=!0){if(0!==this._state){if(3!==this._state)if(1===this._state&&this._start(),this._active.length){let s=!1,i=this._active.length-1,n=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,s=t,n=this._stack.fallThrough,this._stack.paused=!1),!n&&!1===s){for(;i>=0&&(s=this._active[i].end(e),!0!==s);i--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,s;i--}for(;i>=0;i--)if(s=this._active[i].end(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,s}else this._handlerFb(this._id,"END",e);this._active=XC,this._id=-1,this._state=0}}},JC=class e{constructor(t){this._handler=t,this._data=new pC(e._payloadLimit),this._hitLimit=!1}start(){this._data.reset(),this._hitLimit=!1}put(e,t,s){this._hitLimit||this._data.append(qy(e,t,s))&&(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}};JC._payloadLimit=1e7;var QC=JC,ej=[],tj=class{constructor(){this._handlers=Object.create(null),this._active=ej,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=ej}registerHandler(e,t){var s;(s=this._handlers)[e]??(s[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let e=i.indexOf(t);-1!==e&&i.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=ej,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||ej,this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].hook(t);else this._handlerFb(this._ident,"HOOK",t)}put(e,t,s){if(this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,s);else this._handlerFb(this._ident,"PUT",qy(e,t,s))}unhook(e,t=!0){if(this._active.length){let s=!1,i=this._active.length-1,n=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,s=t,n=this._stack.fallThrough,this._stack.paused=!1),!n&&!1===s){for(;i>=0&&(s=this._active[i].unhook(e),!0!==s);i--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,s;i--}for(;i>=0;i--)if(s=this._active[i].unhook(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,s}else this._handlerFb(this._ident,"UNHOOK",e);this._active=ej,this._ident=0}},sj=new GC;sj.addParam(0);var ij=class e{constructor(t){this._handler=t,this._data=new pC(e._payloadLimit),this._params=sj,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():sj,this._data.reset(),this._hitLimit=!1}put(e,t,s){this._hitLimit||this._data.append(qy(e,t,s))&&(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=sj,this._data.reset(),this._hitLimit=!1,e));return this._params=sj,this._data.reset(),this._hitLimit=!1,t}};ij._payloadLimit=1e7;var nj=ij,rj=[],oj=class{constructor(){this._handlers=Object.create(null),this._active=rj,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){var s;(s=this._handlers)[e]??(s[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let e=i.indexOf(t);-1!==e&&i.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=rj}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=rj,this._ident=0}start(e){if(this.reset(),this._ident=e,this._active=this._handlers[e]||rj,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,s){if(this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,s);else this._handlerFb(this._ident,"PUT",qy(e,t,s))}end(e,t=!0){if(this._active.length){let s=!1,i=this._active.length-1,n=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,s=t,n=this._stack.fallThrough,this._stack.paused=!1),!n&&!1===s){for(;i>=0&&(s=this._active[i].end(e),!0!==s);i--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,s;i--}for(;i>=0;i--)if(s=this._active[i].end(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,s}else this._handlerFb(this._ident,"END",e);this._active=rj,this._ident=0}},aj=class e{constructor(t){this._handler=t,this._data=new pC(e._payloadLimit),this._hitLimit=!1}start(){this._data.reset(),this._hitLimit=!1}put(e,t,s){this._hitLimit||this._data.append(qy(e,t,s))&&(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}};aj._payloadLimit=1e7;var lj=aj,cj=class{constructor(e){this.table=new Uint16Array(e)}setDefault(e,t){this.table.fill(e<<8|t)}add(e,t,s,i){this.table[t<<8|e]=s<<8|i}addMany(e,t,s,i){for(let n=0;n<e.length;n++)this.table[t<<8|e[n]]=s<<8|i}},hj=160,uj=function(){let e=new cj(4257),t=Array.apply(null,Array(256)).map((e,t)=>t),s=(e,s)=>t.slice(e,s),i=s(32,127),n=s(0,24);n.push(25),n.push.apply(n,s(28,32));let r=s(0,17);e.setDefault(1,0),e.addMany(i,0,2,0);for(let o of r)e.addMany([24,26,153,154],o,3,0),e.addMany(s(128,144),o,3,0),e.addMany(s(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(n,0,3,0),e.addMany(n,1,3,1),e.add(127,1,0,1),e.addMany(n,8,0,8),e.addMany(n,3,3,3),e.add(127,3,0,3),e.addMany(n,4,3,4),e.add(127,4,0,4),e.addMany(n,6,3,6),e.addMany(n,5,3,5),e.add(127,5,0,5),e.addMany(n,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(s(28,32),8,0,8),e.addMany([88,94],1,0,7),e.addMany(i,7,0,7),e.addMany(n,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(95,1,11,14),e.addMany(n,14,0,14),e.add(127,14,0,14),e.addMany(s(32,48),14,9,15),e.addMany(s(48,127),14,15,16),e.addMany(s(48,127),15,15,16),e.addMany(n,15,0,15),e.addMany(s(32,48),15,9,15),e.add(127,15,0,15),e.addMany(i,16,16,16),e.addMany(n,16,0,16),e.addMany(s(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(s(64,127),3,7,0),e.addMany(s(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(s(48,60),4,8,4),e.addMany(s(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(s(32,64),6,0,6),e.add(127,6,0,6),e.addMany(s(64,127),6,0,0),e.addMany(s(32,48),3,9,5),e.addMany(s(32,48),5,9,5),e.addMany(s(48,64),5,0,6),e.addMany(s(64,127),5,7,0),e.addMany(s(32,48),4,9,5),e.addMany(s(32,48),1,9,2),e.addMany(s(32,48),2,9,2),e.addMany(s(48,127),2,10,0),e.addMany(s(48,80),1,10,0),e.addMany(s(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(s(96,127),1,10,0),e.add(80,1,11,9),e.addMany(n,9,0,9),e.add(127,9,0,9),e.addMany(s(32,48),9,9,12),e.addMany(s(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(n,11,0,11),e.addMany(s(32,128),11,0,11),e.addMany(n,10,0,10),e.add(127,10,0,10),e.addMany(s(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(s(32,48),10,9,12),e.addMany(n,12,0,12),e.add(127,12,0,12),e.addMany(s(32,48),12,9,12),e.addMany(s(48,64),12,0,11),e.addMany(s(64,127),12,12,13),e.addMany(s(64,127),10,12,13),e.addMany(s(64,127),9,12,13),e.addMany(n,13,13,13),e.addMany(i,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(hj,0,2,0),e.add(hj,8,5,8),e.add(hj,6,0,6),e.add(hj,11,0,11),e.add(hj,13,13,13),e.add(hj,16,16,16),e}(),dj=class extends kw{constructor(e=uj){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 GC,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,s)=>{},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(yw(()=>{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 ZC),this._dcsParser=this._register(new tj),this._apcParser=this._register(new oj),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let s=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=e.prefix.charCodeAt(0),s<60||s>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 i=e.intermediates.charCodeAt(t);if(32>i||i>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=i}}if(1!==e.final.length)throw new Error("final must be a single byte");let i=e.final.charCodeAt(0);if(t[0]>i||i>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return s<<=8,s|=i,s}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 s;let i=this._identifier(e,[48,126]);(s=this._escHandlers)[i]??(s[i]=[]);let n=this._escHandlers[i];return n.push(t),{dispose:()=>{let e=n.indexOf(t);-1!==e&&n.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 s=e.charCodeAt(0);this._executeHandlers[s]=t,s<24&&(this._executeHandlersArr[s]=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 s;let i=this._identifier(e);(s=this._csiHandlers)[i]??(s[i]=[]);let n=this._csiHandlers[i];return n.push(t),{dispose:()=>{let e=n.indexOf(t);-1!==e&&n.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,s,i,n){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=s,this._parseStack.transition=i,this._parseStack.chunkPos=n}parse(e,t,s){let i,n,r,o=0;if(this._parseStack.state)if(2===this._parseStack.state)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(void 0===s||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,n=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===s&&n>-1)for(;n>=0&&(r=t[n](this._params),!0!==r);n--)if(r instanceof Promise)return this._parseStack.handlerPos=n,r;this._parseStack.handlers=[];break;case 4:if(!1===s&&n>-1)for(;n>=0&&(r=t[n](),!0!==r);n--)if(r instanceof Promise)return this._parseStack.handlerPos=n,r;this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],r=this._dcsParser.unhook(24!==i&&26!==i,s),r)return r;27===i&&(this._parseStack.transition|=1),this._params.resetZdm(),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],r=this._oscParser.end(24!==i&&26!==i,s),r)return r;27===i&&(this._parseStack.transition|=1),this._params.resetZdm(),this._collect=0;break;case 7:if(i=e[this._parseStack.chunkPos],r=this._apcParser.end(24!==i&&26!==i,s),r)return r;27===i&&(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(i=e[a],i<24&&this.currentState<=6)(this._executeHandlersArr[i]??this._executeHandlerFb)(i),this.precedingJoinState=0;else{if(27===i&&this.currentState<8&&a+2<t&&91===e[a+1]){this._params.resetZdm(),this._collect=0;let s=a+2,i=e[s];i>=60&&i<=63&&(this._collect=i,s++);let o=!1;for(;s<t;s++)if(i=e[s],i>=48&&i<=57)this._params.addDigit(i-48);else if(59===i)this._params.addParam(0);else{if(58!==i){if(i>=64&&i<=126){let e=this._csiHandlers[this._collect<<8|i],t=e?e.length-1:-1;for(;t>=0&&(r=e[t](this._params),!0!==r);t--)if(r instanceof Promise)return n=1792,this._preserveStack(3,e,t,n,s),r;t<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0,a=s,this.currentState=0,o=!0;break}break}this._params.addSubParam(-1)}o||(a=s-1,this.currentState=4);continue}switch(n=this._transitions.table[this.currentState<<8|(i<hj?i:hj)],n>>8){case 2:let s=a,o=t-4;for(;s<o&&e[++s]>=32&&(e[s]<=126||e[s]>=hj)&&e[++s]>=32&&(e[s]<=126||e[s]>=hj)&&e[++s]>=32&&(e[s]<=126||e[s]>=hj)&&e[++s]>=32&&(e[s]<=126||e[s]>=hj););if(s>=o)for(;s<t&&e[s]>=32&&(e[s]<=126||e[s]>=hj);)s++;this._printHandler(e,a,s),a=s-1;break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:a,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let l=this._csiHandlers[this._collect<<8|i],c=l?l.length-1:-1;for(;c>=0&&(r=l[c](this._params),!0!==r);c--)if(r instanceof Promise)return this._preserveStack(3,l,c,n,a),r;c<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do{switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}}while(++a<t&&(i=e[a])>47&&i<60);a--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let h=this._escHandlers[this._collect<<8|i],u=h?h.length-1:-1;for(;u>=0&&(r=h[u](),!0!==r);u--)if(r instanceof Promise)return this._preserveStack(4,h,u,n,a),r;u<0&&this._escHandlerFb(this._collect<<8|i),this.precedingJoinState=0;break;case 11:this._params.resetZdm(),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|i,this._params);break;case 13:for(let n=a+1;;++n)if(n>=t||24===(i=e[n])||26===i||27===i||i>127&&i<hj){this._dcsParser.put(e,a,n),a=n-1;break}break;case 14:if(r=this._dcsParser.unhook(24!==i&&26!==i),r)return this._preserveStack(6,[],0,n,a),r;27===i&&(n|=1),this._params.resetZdm(),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let n=a+1;;n++)if(n>=t||(i=e[n])<32||i>127&&i<hj){this._oscParser.put(e,a,n),a=n-1;break}break;case 6:if(r=this._oscParser.end(24!==i&&26!==i),r)return this._preserveStack(5,[],0,n,a),r;27===i&&(n|=1),this._params.resetZdm(),this._collect=0,this.precedingJoinState=0;break;case 15:this._apcParser.start(this._collect<<8|i);break;case 16:for(let i=a+1;;++i)if(!(i<t&&(e[i]>=32&&e[i]<127||e[i]>=8&&e[i]<14||e[i]>=hj))){this._apcParser.put(e,a,i),a=i-1;break}break;case 17:if(r=this._apcParser.end(24!==i&&26!==i),r)return this._preserveStack(7,[],0,n,a),r;27===i&&(n|=1),this._params.resetZdm(),this._collect=0,this.precedingJoinState=0}this.currentState=255&n}}},fj=/^([\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})$/,pj=/^[\da-f]+$/;function vj(e){if(!e)return;let t=e.toLowerCase();if(t.startsWith("rgb:")){t=t.slice(4);let e=fj.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),pj.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,s=[0,0,0];for(let i=0;i<3;++i){let n=parseInt(t.slice(e*i,e*i+e),16);s[i]=1===e?n<<4:2===e?n:3===e?n>>4:n>>8}return s}}function gj(e,t){let s=e.toString(16),i=s.length<2?"0"+s:s;switch(t){case 4:return s[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}function mj(e,t=16){let[s,i,n]=e;return`rgb:${gj(s,t)}/${gj(i,t)}/${gj(n,t)}`}var _j={"(":0,")":1,"*":2,"+":3,"-":1,".":2};function xj(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 bj=0,yj=class extends kw{constructor(e,t,s,i,n,r,o,a,l=new dj){super(),this._bufferService=e,this._charsetService=t,this._coreService=s,this._logService=i,this._optionsService=n,this._oscLinkService=r,this._mouseStateService=o,this._unicodeService=a,this._parser=l,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Vy,this._utf8Decoder=new $y,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=vC.clone(),this._eraseAttrDataInternal=vC.clone(),this._onRequestBell=this._register(new mS),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new mS),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new mS),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new mS),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new mS),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new mS),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new mS),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new mS),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new mS),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new mS),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new mS),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new mS),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new mS),this.onColor=this._onColor.event,this._onRequestColorSchemeQuery=this._register(new mS),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 wj(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,s)=>{this._logService.debug("Unknown OSC code: ",{identifier:e,action:t,data:s})}),this._parser.setDcsHandlerFallback((e,t,s)=>{"HOOK"===t&&(s=s.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(e),action:t,payload:s})}),this._parser.setApcHandlerFallback((e,t,s)=>{this._logService.debug("Unknown APC code: ",{identifier:this._parser.identToString(e),action:t,payload:s})}),this._parser.setPrintHandler((e,t,s)=>this.print(e,t,s)),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 QC(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new QC(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new QC(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new QC(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new QC(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new QC(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new QC(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new QC(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new QC(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new QC(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new QC(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new QC(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 CC)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 nj((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,s,i){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=s,this._parseStack.position=i}_logSlowResolvingAsync(e){if(this._logService.logLevel<=3){let t,s=new Promise((e,s)=>{t=setTimeout(()=>s("#SLOW_TIMEOUT"),5e3)});Promise.race([e,s]).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 s,i=this._activeBuffer.x,n=this._activeBuffer.y,r=0,o=this._parseStack.paused;if(o){if(s=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(s),s;i=this._parseStack.cursorStartX,n=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>131072&&(r=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=r;c<e.length;c+=131072){let t=c+131072<e.length?c+131072:e.length,r="string"==typeof e?this._stringDecoder.decode(e.substring(c,t),this._parseBuffer):this._utf8Decoder.decode(e.subarray(c,t),this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,r))return this._preserveStack(i,n,r,c),this._logSlowResolvingAsync(s),s}else if(!o){let t="string"==typeof e?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,t))return this._preserveStack(i,n,t,0),this._logSlowResolvingAsync(s),s}(this._activeBuffer.x!==i||this._activeBuffer.y!==n)&&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,s){let i,n,r=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&&s-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<s;++f){if(i=e[f],173===i)continue;if(i<127&&r){let e=r[String.fromCharCode(i)];e&&(i=e.charCodeAt(0))}let t=this._unicodeService.charProperties(i,d);n=KC.extractWidth(t);let s=KC.extractShouldJoin(t),p=s?KC.extractWidth(d):0;d=t,o&&this._onA11yChar.fire(Uy(i));let v=this._getCurrentLinkId();if(v&&this._oscLinkService.addLineToLink(v,this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+n-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 xC&&u.copyCellsFrom(e,t,0,p,!1);t<a;)e.setCellFromCodepoint(t++,0,1,h)}else if(this._activeBuffer.x=a-1,2===n)continue;if(s&&this._activeBuffer.x){let e=u.getWidth(this._activeBuffer.x-1)?1:2;u.addCodepointToCell(this._activeBuffer.x-e,i,n);for(let t=n-p;--t>=0;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h);continue}if(c&&(u.insertCells(this._activeBuffer.x,n-p,this._activeBuffer.getNullCell(h)),2===u.getWidth(a-1)&&u.setCellFromCodepoint(a-1,0,1,h)),u.setCellFromCodepoint(this._activeBuffer.x++,i,n,h),n>0)for(;--n;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h)}this._parser.precedingJoinState=d,this._activeBuffer.x<a&&s-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=>!xj(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e))}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new nj(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new QC(t))}registerApcHandler(e,t){return this._parser.registerApcHandler(e,new lj(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,s,i=!1,n=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.replaceCells(t,s,this._activeBuffer.getNullCell(this._eraseAttrData()),n),i&&(r.isWrapped=!1))}_resetBufferLine(e,t=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s&&(s.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),s.isWrapped=!1)}eraseInDisplay(e,t=!1){var s;let i;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,t);i<this._bufferService.rows;i++)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(i);break;case 1:if(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols){let e=this._activeBuffer.lines.get(i+1);e&&(e.isWrapped=!1)}for(;i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!(null==(s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i))?void 0:s.getTrimmedLength()););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,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 s=this._activeBuffer.ybase+this._activeBuffer.y,i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;for(;t--;)this._activeBuffer.lines.splice(n-1,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}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 s,i=this._activeBuffer.ybase+this._activeBuffer.y;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;t--;)this._activeBuffer.lines.splice(i,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(vC));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 s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);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 s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);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 s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);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 s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);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 s=e.params[0]||1,i=KC.extractWidth(t),n=this._activeBuffer.x-i,r=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(n),o=new Uint32Array(r.length*s),a=0;for(let c=0;c<r.length;){let e=r.codePointAt(c)||0;o[a++]=e,c+=e>65535?2:1}let l=a;for(let c=1;c<s;++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,s,i,n;for(let r=0;r<e.length;r++)switch(e.params[r]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,jC),this._charsetService.setgCharset(1,jC),this._charsetService.setgCharset(2,jC),this._charsetService.setgCharset(3,jC);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==(s=this._optionsService.rawOptions.vtExtensions)?void 0:s.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==(i=this._optionsService.rawOptions.vtExtensions)?void 0:i.colorSchemeQuery)??1)&&(this._coreService.decPrivateModes.colorSchemeUpdates=!0);break;case 9001:(null==(n=this._optionsService.rawOptions.vtExtensions)?void 0:n.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,s,i,n;for(let r=0;r<e.length;r++)switch(e.params[r]){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==(s=this._optionsService.rawOptions.vtExtensions)?void 0:s.kittyKeyboard){let e=this._coreService.kittyKeyboard;e.altFlags=e.flags,e.flags=e.mainFlags}this._bufferService.buffers.activateNormalBuffer(),1049===e.params[r]&&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==(i=this._optionsService.rawOptions.vtExtensions)?void 0:i.colorSchemeQuery)??1)&&(this._coreService.decPrivateModes.colorSchemeUpdates=!1);break;case 9001:(null==(n=this._optionsService.rawOptions.vtExtensions)?void 0:n.win32InputMode)&&(this._coreService.decPrivateModes.win32InputMode=!1)}return!0}requestMode(e,t){var s;let i;var n;(n=i||(i={}))[n.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",n[n.SET=1]="SET",n[n.RESET=2]="RESET",n[n.PERMANENTLY_SET=3]="PERMANENTLY_SET",n[n.PERMANENTLY_RESET=4]="PERMANENTLY_RESET";let r=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,s)=>(l.triggerDataEvent(`[${t?"":"?"}${e};${s}$y`),!0),v=e=>e?1:2,g=e.params[0];return t?p(g,2===g?4:4===g?v(l.modes.insertMode):12===g?3:20===g?v(f.convertEol):0):1===g?p(g,v(r.applicationCursorKeys)):3===g?p(g,f.windowOptions.setWinLines?80===h?2:132===h?1:0:0):6===g?p(g,v(r.origin)):7===g?p(g,v(r.wraparound)):8===g?p(g,3):9===g?p(g,v("X10"===o)):12===g?p(g,v(f.cursorBlink)):25===g?p(g,v(!l.isCursorHidden)):45===g?p(g,v(r.reverseWraparound)):66===g?p(g,v(r.applicationKeypad)):67===g?p(g,4):1e3===g?p(g,v("VT200"===o)):1002===g?p(g,v("DRAG"===o)):1003===g?p(g,v("ANY"===o)):1004===g?p(g,v(r.sendFocus)):1005===g?p(g,4):1006===g?p(g,v("SGR"===a)):1015===g?p(g,4):1016===g?p(g,v("SGR_PIXELS"===a)):1048===g?p(g,1):47===g||1047===g||1049===g?p(g,v(u===d)):2004===g?p(g,v(r.bracketedPasteMode)):2026===g?p(g,v(r.synchronizedOutput)):9001===g&&(null==(s=this._optionsService.rawOptions.vtExtensions)?void 0:s.win32InputMode)?p(g,v(r.win32InputMode)):p(g,0)}_updateAttrColor(e,t,s,i,n){return 2===t?(e|=50331648,e&=-16777216,e|=Yy.fromColorRGB([s,i,n])):5===t&&(e&=-67108864,e|=33554432|255&s),e}_extractColor(e,t,s){let i=[0,0,-1,0,0,0],n=0,r=0;do{if(i[r+n]=e.params[t+r],e.hasSubParams(t+r)){let s=e.getSubParams(t+r),o=0;do{5===i[1]&&(n=1),i[r+o+1+n]=s[o]}while(++o<s.length&&o+r+1+n<i.length);break}if(5===i[1]&&r+n>=2||2===i[1]&&r+n>=5)break;i[1]&&(n=1)}while(++r+t<e.length&&r+n<i.length);for(let o=2;o<i.length;++o)-1===i[o]&&(i[o]=0);switch(i[0]){case 38:s.fg=this._updateAttrColor(s.fg,i[1],i[3],i[4],i[5]);break;case 48:s.bg=this._updateAttrColor(s.bg,i[1],i[3],i[4],i[5]);break;case 58:s.extended=s.extended.clone(),s.extended.underlineColor=this._updateAttrColor(s.extended.underlineColor,i[1],i[3],i[4],i[5])}return r}_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=vC.fg,e.bg=vC.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){var t,s;if(1===e.length&&0===e.params[0])return this._processSGR0(this._curAttrData),!0;let i,n=e.length,r=this._curAttrData;for(let o=0;o<n;o++)i=e.params[o],i>=30&&i<=37?(r.fg&=-67108864,r.fg|=16777216|i-30):i>=40&&i<=47?(r.bg&=-67108864,r.bg|=16777216|i-40):i>=90&&i<=97?(r.fg&=-67108864,r.fg|=16777224|i-90):i>=100&&i<=107?(r.bg&=-67108864,r.bg|=16777224|i-100):0===i?this._processSGR0(r):1===i?r.fg|=134217728:3===i?r.bg|=67108864:4===i?(r.fg|=268435456,this._processUnderline(e.hasSubParams(o)?e.getSubParams(o)[0]:1,r)):5===i?r.fg|=536870912:7===i?r.fg|=67108864:8===i?r.fg|=1073741824:9===i?r.fg|=2147483648:2===i?r.bg|=134217728:21===i?this._processUnderline(2,r):22===i?(r.fg&=-134217729,r.bg&=-134217729):23===i?r.bg&=-67108865:24===i?(r.fg&=-268435457,this._processUnderline(0,r)):25===i?r.fg&=-536870913:27===i?r.fg&=-67108865:28===i?r.fg&=-1073741825:29===i?r.fg&=2147483647:39===i?(r.fg&=-67108864,r.fg|=16777215&vC.fg):49===i?(r.bg&=-67108864,r.bg|=16777215&vC.bg):38===i||48===i||58===i?o+=this._extractColor(e,o,r):53===i?r.bg|=1073741824:55===i?r.bg&=-1073741825:221===i&&((null==(t=this._optionsService.rawOptions.vtExtensions)?void 0:t.kittySgrBoldFaintControl)??1)?r.fg&=-134217729:222===i&&((null==(s=this._optionsService.rawOptions.vtExtensions)?void 0:s.kittySgrBoldFaintControl)??1)?r.bg&=-134217729:59===i?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent("[0n");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,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`[?${e};${s}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=vC.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,s=e.params[0]||1;return(e.length<2||(t=e.params[1])>this._bufferService.rows||0===t)&&(t=this._bufferService.rows),t>s&&(this._activeBuffer.scrollTop=s-1,this._activeBuffer.scrollBottom=t-1,this._setCursor(0,0)),!0}windowOptions(e){if(!xj(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=[],s=e.split(";");for(;s.length>1;){let e=s.shift(),i=s.shift();if(/^\d+$/.exec(e)){let s=parseInt(e,10);if(Sj(s))if("?"===i)t.push({type:0,index:s});else{let e=vj(i);e&&t.push({type:1,index:s,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(-1===t)return!0;let s=e.slice(0,t).trim(),i=e.slice(t+1);return i?this._createHyperlink(s,i):!s.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let s,i=e.split(":"),n=i.findIndex(e=>e.startsWith("id="));return-1!==n&&(s=i[n].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let s=e.split(";");for(let i=0;i<s.length&&!(t>=this._specialColors.length);++i,++t)if("?"===s[i])this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let e=vj(s[i]);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=[],s=e.split(";");for(let i=0;i<s.length;++i)if(/^\d+$/.exec(s[i])){let e=parseInt(s[i],10);Sj(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,jC),!0}selectCharset(e){return 2!==e.length?(this.selectDefaultCharset(),!0):("/"===e[0]||this._charsetService.setgCharset(_j[e[0]],CC[e[1]]??jC),!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=vC.clone(),this._eraseAttrDataInternal=vC.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 Xy;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 s=this._activeBuffer.ybase+this._activeBuffer.y+t,i=this._activeBuffer.lines.get(s);i&&(i.fill(e),i.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let s=this._bufferService.buffer,i=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${s.scrollTop+1};${s.scrollBottom+1}r`:"m"===e?"P1$r0m":" q"===e?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-(i.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 s=e.params[0]||0,i=e.length>1&&e.params[1]||1,n=this._coreService.kittyKeyboard;switch(i){case 1:n.flags=s;break;case 2:n.flags|=s;break;case 3:n.flags&=~s}return!0}kittyKeyboardQuery(e){var t;if(!(null==(t=this._optionsService.rawOptions.vtExtensions)?void 0:t.kittyKeyboard))return!0;let s=this._coreService.kittyKeyboard.flags;return this._coreService.triggerDataEvent(`[?${s}u`),!0}kittyKeyboardPush(e){var t;if(!(null==(t=this._optionsService.rawOptions.vtExtensions)?void 0:t.kittyKeyboard))return!0;let s=e.params[0]||0,i=this._coreService.kittyKeyboard,n=this._bufferService.buffer===this._bufferService.buffers.alt?i.altStack:i.mainStack;return n.length>=16&&n.shift(),n.push(i.flags),i.flags=s,!0}kittyKeyboardPop(e){var t;if(!(null==(t=this._optionsService.rawOptions.vtExtensions)?void 0:t.kittyKeyboard))return!0;let s=Math.max(1,e.params[0]||1),i=this._coreService.kittyKeyboard,n=this._bufferService.buffer===this._bufferService.buffers.alt?i.altStack:i.mainStack;for(let r=0;r<s&&n.length>0;r++)i.flags=n.pop();return 0===n.length&&s>0&&(i.flags=0),!0}},wj=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&&(bj=e,e=t,t=bj),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function Sj(e){return 0<=e&&e<256}wj=Py([Ry(0,Qy)],wj);var kj=class extends kw{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 jw),this._onWriteParsed=this._register(new mS),this.onWriteParsed=this._onWriteParsed.event,this._register(yw(()=>{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 s=this._callbacks.shift();s&&s()}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 s;for(this._isSyncWriting=!0;s=this._writeBuffer.shift();){this._action(s);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 s=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],i=this._action(e,t);if(i){let e=e=>{this._store.isDisposed||(performance.now()-s>=12?this._scheduleInnerWrite(0,e):this._innerWrite(s,e))};return void i.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e)}let n=this._callbacks[this._bufferOffset];if(n&&n(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-s>=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()}},Cj=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 s=t.addMarker(t.ybase+t.y),i={data:e,id:this._nextId++,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(i,s)),this._dataByLinkId.set(i.id,i),i.id}let s=e,i=this._getEntryIdKey(s),n=this._entriesWithId.get(i);if(n)return this.addLineToLink(n.id,t.ybase+t.y),n.id;let r=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(s),data:s,lines:[r]};return r.onDispose(()=>this._removeMarkerFromLink(o,r)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let s=this._dataByLinkId.get(e);if(s&&s.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);s.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(s,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 s=e.lines.indexOf(t);-1!==s&&(e.lines.splice(s,1),0===e.lines.length&&(void 0!==e.data.id&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Cj=Py([Ry(0,Qy)],Cj);var jj=!1,Nj=class extends kw{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Cw),this._onBinary=this._register(new mS),this.onBinary=this._onBinary.event,this._onData=this._register(new mS),this.onData=this._onData.event,this._onLineFeed=this._register(new mS),this.onLineFeed=this._onLineFeed.event,this._onRender=this._register(new mS),this.onRender=this._onRender.event,this._onResize=this._register(new mS),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new mS),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new mS),this._instantiationService=new cC,this.optionsService=this._register(new PC(e)),this._instantiationService.setService(rw,this.optionsService),this._logService=this._register(this._instantiationService.createInstance(uC)),this._instantiationService.setService(nw,this._logService),this._bufferService=this._register(this._instantiationService.createInstance(LC)),this._instantiationService.setService(Qy,this._bufferService),this.coreService=this._register(this._instantiationService.createInstance(zC)),this._instantiationService.setService(tw,this.coreService),this.mouseStateService=this._register(this._instantiationService.createInstance(WC)),this._instantiationService.setService(ew,this.mouseStateService),this.unicodeService=this._register(this._instantiationService.createInstance(KC)),this.unicodeService.register(new VC),this._instantiationService.setService(aw,this.unicodeService),this._charsetService=this._instantiationService.createInstance($C),this._instantiationService.setService(sw,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Cj),this._instantiationService.setService(ow,this._oscLinkService),this._inputHandler=this._register(new yj(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.mouseStateService,this.unicodeService)),this._register(cS.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(cS.forward(this._bufferService.onResize,this._onResize)),this._register(cS.forward(this.coreService.onData,this._onData)),this._register(cS.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 kj((e,t)=>this._inputHandler.parse(e,t))),this._register(cS.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new mS),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&&!jj&&(this._logService.warn("writeSync is unreliable and will be removed soon."),jj=!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(YC.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(YC(this._bufferService),!1))),this._windowsWrappingHeuristics.value=yw(()=>{for(let t of e)t.dispose()})}}},Mj=0,Bj=class{constructor(e,t){this._getKey=e,this._array=[],this._insertedValues=[],this._isFlushingInserted=!1,this._deletedIndices=[],this._isFlushingDeleted=!1,this._flushInsertedTask=new Ek(t),this._flushDeletedTask=new Ek(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,s=0,i=new Array(this._array.length+this._insertedValues.length);for(let n=0;n<i.length;n++)s>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[s])?(i[n]=e[t],t++):i[n]=this._array[s++];this._array=i,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===(Mj=this._search(t))||this._getKey(this._array[Mj])!==t)return!1;do{if(this._array[Mj]===e)return 0===this._deletedIndices.length&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Mj),!0}while(++Mj<this._array.length&&this._getKey(this._array[Mj])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,s=new Array(this._array.length-e.length),i=0;for(let n=0;n<this._array.length;n++)e[t]===n?t++:s[i++]=this._array[n];this._array=s,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&&(!((Mj=this._search(e))<0||Mj>=this._array.length)&&this._getKey(this._array[Mj])===e))do{yield this._array[Mj]}while(++Mj<this._array.length&&this._getKey(this._array[Mj])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&(!((Mj=this._search(e))<0||Mj>=this._array.length)&&this._getKey(this._array[Mj])===e))do{t(this._array[Mj])}while(++Mj<this._array.length&&this._getKey(this._array[Mj])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,s=this._array.length-1;for(;s>=t;){let i=t+s>>1,n=this._getKey(this._array[i]);if(n>e)s=i-1;else{if(!(n<e)){for(;i>0&&this._getKey(this._array[i-1])===e;)i--;return i}t=i+1}}return t}},Lj=0,Dj=0,Ej=class extends kw{constructor(e,t){super(),this._logService=e,this._bufferService=t,this._lineCache=this._register(new Pj),this._onDecorationRegistered=this._register(new mS),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new mS),this.onDecorationRemoved=this._onDecorationRemoved.event,this._decorations=new Bj(e=>null==e?void 0:e.marker.line,this._logService),this._register(yw(()=>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 Rj(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),s=t.onDispose(()=>{s.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,s){let i=this._lineCache.getDecorationsOnLine(t);if(i)for(let n of i)Lj=n.options.x??0,Dj=Lj+(n.options.width??1),e>=Lj&&e<Dj&&(!s||(n.options.layer??"bottom")===s)&&(yield n)}forEachDecorationAtCell(e,t,s,i){let n=this._lineCache.getDecorationsOnLine(t);if(n)for(let r of n)Lj=r.options.x??0,Dj=Lj+(r.options.width??1),e>=Lj&&e<Dj&&(!s||(r.options.layer??"bottom")===s)&&i(r)}};Ej=Py([Ry(0,nw),Ry(1,Qy)],Ej);var Pj=class extends kw{constructor(){super(...arguments),this._decorationsByLine=new Map,this._decorations=new Set,this._bufferLineListeners=this._register(new Cw),this._lineIndexSyncTimer=this._register(new Nw),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 Sw;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 s=this._getDecorationHeight(e);for(let i=t;i<t+s;i++){let t=this._decorationsByLine.get(i);t||(t=[],this._decorationsByLine.set(i,t)),t.push(e)}}_removeFromLineBuckets(e){let t=e._indexedStartLine,s=this._getDecorationHeight(e);for(let i=t;i<t+s;i++){let t=this._decorationsByLine.get(i);if(!t)continue;let s=t.indexOf(e);-1!==s&&t.splice(s,1),0===t.length&&this._decorationsByLine.delete(i)}}_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[s,i]of this._decorationsByLine){let n=s-e;n<0||this._mergeLineBucket(t,n,i)}this._decorationsByLine.clear();for(let[s,i]of t)this._decorationsByLine.set(s,i);for(let s of this._decorations)s.marker.isDisposed||(s._indexedStartLine-=e)}_handleBufferLinesInsert(e){this._scheduleLineIndexSync(()=>this._applyBufferLinesInsert(e))}_handleBufferLinesDelete(e){this._scheduleLineIndexSync(()=>this._applyBufferLinesDelete(e))}_mergeLineBucket(e,t,s){let i=e.get(t);if(i)for(let n=0,r=s.length;n<r;n++)i.push(s[n]);else e.set(t,s.slice())}_applyBufferLinesInsert(e){let{index:t,amount:s}=e,i=[];for(let r of this._decorations){if(r.marker.isDisposed)continue;let e=r._indexedStartLine;e<t&&e+this._getDecorationHeight(r)>t&&(i.push(r),this._removeFromLineBuckets(r))}let n=new Map;for(let[r,o]of this._decorationsByLine){let e=r>=t?r+s:r;this._mergeLineBucket(n,e,o)}this._decorationsByLine.clear();for(let[r,o]of n)this._decorationsByLine.set(r,o);for(let r of this._decorations)r.marker.isDisposed||r._indexedStartLine>=t&&(r._indexedStartLine=r.marker.line);for(let r of i)this._addToLineBuckets(r)}_applyBufferLinesDelete(e){let t=e.index+e.amount,s=new Map;for(let[n,r]of this._decorationsByLine){if(n>=e.index&&n<t)continue;let i=n>=t?n-e.amount:n;this._mergeLineBucket(s,i,r)}this._decorationsByLine.clear();for(let[n,r]of s)this._decorationsByLine.set(n,r);let i=[];for(let n of this._decorations){if(n.marker.isDisposed)continue;let s=n._indexedStartLine,r=this._getDecorationHeight(n);s>=t?n._indexedStartLine=n.marker.line:s<e.index&&s+r>t&&i.push(n)}for(let n of i)this._reindexDecoration(n)}},Rj=class extends Sw{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new mS),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new mS),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=KS.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return null===this._cachedFg&&(this.options.foregroundColor?this._cachedFg=KS.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},Aj=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,s){this._rowCount=s,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 i=performance.now();if(i-this._lastRefreshMs>=this._debounceThresholdMS)void 0!==this._refreshTimeoutID&&(clearTimeout(this._refreshTimeoutID),this._refreshTimeoutID=void 0,this._additionalRefreshRequested=!1),this._lastRefreshMs=i,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=i-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)}},zj=class extends kw{constructor(e,t,s,i){super(),this._terminal=e,this._coreBrowserService=s,this._renderService=i,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let n=this._coreBrowserService.mainDocument;this._accessibilityContainer=n.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=n.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let r=0;r<this._terminal.rows;r++)this._rowElements[r]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[r]);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=n.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new Aj(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(Dw(n,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(yw(()=>{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=Oy())))}_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 s=this._terminal.buffer,i=s.lines.length.toString();for(let n=e;n<=t;n++){let e=s.lines.get(s.ydisp+n),t=[],r=(null==e?void 0:e.translateToString(!0,void 0,void 0,t))||"",o=(s.ydisp+n+1).toString(),a=this._rowElements[n];a&&(0===r.length?(a.textContent=" ",this._rowColumns.set(a,[0,1])):(a.textContent=r,this._rowColumns.set(a,t)),a.setAttribute("aria-posinset",o),a.setAttribute("aria-setsize",i),this._alignRowWidth(a))}this._announceCharacters()}_announceCharacters(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent===Oy()&&this._clearLiveRegion(),this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let s,i,n=e.target,r=this._rowElements[0===t?1:this._rowElements.length-2];if(n.getAttribute("aria-posinset")!==(0===t?"1":`${this._terminal.buffer.lines.length}`)&&e.relatedTarget===r){if(0===t?(s=n,i=this._rowElements.pop(),this._rowContainer.removeChild(i)):(s=this._rowElements.shift(),i=n,this._rowContainer.removeChild(s)),s.removeEventListener("focus",this._topBoundaryFocusListener),i.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 s={node:t.anchorNode,offset:t.anchorOffset},i={node:t.focusNode,offset:t.focusOffset};if((s.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||s.node===i.node&&s.offset>i.offset)&&([s,i]=[i,s]),s.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(s={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(s.node))return;let n=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(n)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:n,offset:(null==(e=n.textContent)?void 0:e.length)??0}),!this._rowContainer.contains(i.node))return;let r=({node:e,offset:t})=>{let s=e instanceof Text?e.parentNode:e,i=parseInt(null==s?void 0:s.getAttribute("aria-posinset"),10)-1;if(isNaN(i))return console.warn("row is invalid. Race condition?"),null;let n=this._rowColumns.get(s);if(!n)return console.warn("columns is null. Race condition?"),null;let r=t<n.length?n[t]:n.slice(-1)[0]+1;return r>=this._terminal.cols&&(++i,r=0),{row:i,column:r}},o=r(s),a=r(i);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,s;e.style.transform="";let i=e.getBoundingClientRect().width,n=null==(s=null==(t=this._rowColumns.get(e))?void 0:t.slice(-1))?void 0:s[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/i})`}};zj=Py([Ry(1,iw),Ry(2,dw),Ry(3,vw)],zj);var Tj=class extends kw{constructor(e,t,s,i,n){super(),this._element=e,this._mouseCoordsService=t,this._renderService=s,this._bufferService=i,this._linkProviderService=n,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new mS),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new mS),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(yw(()=>{var e;ww(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(Dw(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Dw(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Dw(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Dw(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 s=e.composedPath();for(let i=0;i<s.length;i++){let e=s[i];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 s,i;(!this._activeProviderReplies||!t)&&(null==(s=this._activeProviderReplies)||s.forEach(e=>{null==e||e.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,o]of this._linkProviderService.linkProviders.entries())t?(null==(i=this._activeProviderReplies)?void 0:i.get(r))&&(n=this._checkLinkProviderResult(r,e,n)):o.provideLinks(e.y,t=>{var s,i;if(this._isMouseOut)return;let o=null==t?void 0:t.map(e=>({link:e}));null==(s=this._activeProviderReplies)||s.set(r,o),n=this._checkLinkProviderResult(r,e,n),(null==(i=this._activeProviderReplies)?void 0:i.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let s=new Set;for(let i=0;i<t.size;i++){let n=t.get(i);if(n)for(let t=0;t<n.length;t++){let i=n[t],r=i.link.range.start.y<e?0:i.link.range.start.x,o=i.link.range.end.y>e?this._bufferService.cols:i.link.range.end.x;for(let e=r;e<=o;e++){if(s.has(e)){n.splice(t--,1);break}s.add(e)}}}}_checkLinkProviderResult(e,t,s){var i;if(!this._activeProviderReplies)return s;let n=this._activeProviderReplies.get(e),r=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(r=!0);if(!r&&n){let e=n.find(e=>this._linkAtPosition(e.link,t));e&&(s=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let o=0;o<this._activeProviderReplies.size;o++){let e=null==(i=this._activeProviderReplies.get(o))?void 0:i.find(e=>this._linkAtPosition(e.link,t));if(e){s=!0,this._handleNewLink(e);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element);var s,i;t&&this._mouseDownLink&&(s=this._mouseDownLink.link,i=this._currentLink.link,s.text===i.text&&s.range.start.x===i.range.start.x&&s.range.start.y===i.range.start.y&&s.range.end.x===i.range.end.x&&s.range.end.y===i.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,ww(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 s,i,n;(null==(s=this._currentLink)?void 0:s.state)&&(null==(n=null==(i=this._currentLink)?void 0:i.state)?void 0:n.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,s=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=s&&(this._clearCurrentLink(t,s),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,s){var i;(null==(i=this._currentLink)?void 0:i.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(s,t.text)}_fireUnderlineEvent(e,t){let s=e.range,i=this._bufferService.buffer.ydisp,n=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-i-1,s.end.x,s.end.y-i-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(n)}_linkLeave(e,t,s){var i;(null==(i=this._currentLink)?void 0:i.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(s,t.text)}_linkAtPosition(e,t){let s=e.range.start.y*this._bufferService.cols+e.range.start.x,i=e.range.end.y*this._bufferService.cols+e.range.end.x,n=t.y*this._bufferService.cols+t.x;return s<=n&&n<=i}_positionFromMouseEvent(e,t){let s=this._mouseCoordsService.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,s,i,n){return{x1:e,y1:t,x2:s,y2:i,cols:this._bufferService.cols,fg:n}}};Tj=Py([Ry(1,fw),Ry(2,vw),Ry(3,Qy),Ry(4,xw)],Tj);var Ij=class extends Nj{constructor(e={}){super(e),this._linkifier=this._register(new Cw),this.browser=$w,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Cw),this._onCursorMove=this._register(new mS),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new mS),this.onKey=this._onKey.event,this._onSelectionChange=this._register(new mS),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new mS),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new mS),this.onBell=this._onBell.event,this._onFocus=this._register(new mS),this._onBlur=this._register(new mS),this._onA11yCharEmitter=this._register(new mS),this._onA11yTabEmitter=this._register(new mS),this._onWillOpen=this._register(new mS),this._onDimensionsChange=this._register(new mS),this.onDimensionsChange=this._onDimensionsChange.event,this._setup(),this._decorationService=this._instantiationService.createInstance(Ej),this._instantiationService.setService(lw,this._decorationService),this._keyboardService=this._instantiationService.createInstance(aC),this._instantiationService.setService(bw,this._keyboardService),this._linkProviderService=this._instantiationService.createInstance(gk),this._instantiationService.setService(xw,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(cw)),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(cS.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(cS.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(cS.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(cS.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(yw(()=>{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,s;switch(t.index){case 256:e="foreground",s="10";break;case 257:e="background",s="11";break;case 258:e="cursor",s="12";break;default:e="ansi",s="4;"+t.index}switch(t.type){case 0:let i=WS.toColorRGB("ansi"===e?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`]${s};${mj(i)}\\`);break;case 1:if("ansi"===e)this._themeService.modifyColors(e=>e.ansi[t.index]=HS.toColor(...t.color));else{let s=e;this._themeService.modifyColors(e=>e[s]=HS.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index)}}}_reportColorScheme(){if(!this._themeService)return;let e=US.relativeLuminance(this._themeService.colors.background.rgba>>8)<US.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(zj,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent("[I"),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("[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let s=Math.min(this.buffer.x,this.cols-1),i=this._renderService.dimensions.css.cell.height,n=t.getWidth(s),r=this._renderService.dimensions.css.cell.width*n,o=this.buffer.y*this._renderService.dimensions.css.cell.height,a=s*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=o+"px",this.textarea.style.width=r+"px",this.textarea.style.height=i+"px",this.textarea.style.lineHeight=i+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Dw(this.element,"copy",e=>{var t,s;this.hasSelection()&&(t=e,s=this._selectionService,t.clipboardData&&t.clipboardData.setData("text/plain",s.selectionText),t.preventDefault())}));let e=e=>function(e,t,s,i){e.stopPropagation(),e.clipboardData&&Fy(e.clipboardData.getData("text/plain"),t,s,i)}(e,this.textarea,this.coreService,this.optionsService);this._register(Dw(this.textarea,"paste",e)),this._register(Dw(this.element,"paste",e)),Zw?this._register(Dw(this.element,"mousedown",e=>{2===e.button&&Ky(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Dw(this.element,"contextmenu",e=>{Ky(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),rS&&this._register(Dw(this.element,"auxclick",e=>{1===e.button&&Wy(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Dw(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Dw(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Dw(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Dw(this.textarea,"compositionstart",()=>{this._syncTextArea(),this._compositionHelper.compositionstart(),this._compositionHelper.updateCompositionElements()})),this._register(Dw(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Dw(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Dw(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var t,s,i;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 n=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),n.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Dw(this.screenElement,"mousemove",e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),n.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",zy()),oS||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",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(pk,this.textarea,e.ownerDocument.defaultView??window,this._document??(typeof window<"u"?window.document:null))),this._instantiationService.setService(dw,this._coreBrowserService),this._register(Dw(this.textarea,"focus",e=>this._handleTextAreaFocus(e))),this._register(Dw(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(hk,this._document,this._helperContainer),this._instantiationService.setService(uw,this._charSizeService),this._themeService=this._instantiationService.createInstance(sC),this._instantiationService.setService(_w,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(ek),this._instantiationService.setService(mw,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Rk,this.rows,this.screenElement)),this._instantiationService.setService(vw,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(OS,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseCoordsService=this._instantiationService.createInstance(_k),this._instantiationService.setService(fw,this._mouseCoordsService);let o=this._linkifier.value=this._register(this._instantiationService.createInstance(Tj,this.screenElement));this.element.appendChild(n);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(ES,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(Vk,this.element,this.screenElement,o)),this._instantiationService.setService(gw,this._selectionService),this._mouseService=this._instantiationService.createInstance(Mk),this._instantiationService.setService(pw,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(cS.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var e;this._selectionService.refresh(),null==(e=this._viewport)||e.queueSync()})),this._register(this._instantiationService.createInstance(PS,this.screenElement)),this._register(Dw(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(zj,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",e=>this._handleScreenReaderModeOptionChange(e)));let a=(null==(s=this.options.scrollbar)?void 0:s.showScrollbar)??!0,l=null==(i=this.options.scrollbar)?void 0:i.width;a&&l&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(IS,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(IS,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(lk,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}refresh(e,t,s=!1){var i;null==(i=this._renderService)||i.refreshRows(e,t,s)}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){Fy(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,s){this._selectionService.setSelection(e,t,s)}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 s;null==(s=this._selectionService)||s.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 s=this._keyboardService.evaluateKeyDown(e);if(this.updateCursorStyle(e),3===s.type||2===s.type){let t=this.rows-1;return this.scrollLines(2===s.type?-t:t),e.preventDefault(),e.stopPropagation(),!1}if(1===s.type&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(s.cancel&&(e.preventDefault(),e.stopPropagation()),!s.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;(""===s.key||"\r"===s.key)&&(this.textarea.value="");let i=this._keyboardService.useWin32InputMode&&Oj(e);if(this._onKey.fire({key:s.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(s.key,!i),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return e.preventDefault(),e.stopPropagation(),!1;this._keyDownHandled=!0}_isThirdLevelShift(e,t){let s=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?s:s&&(!t.keyCode||t.keyCode>47)}_keyUp(e){if(this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return;Oj(e)||this.focus();let t=this._keyboardService.evaluateKeyUp(e);if(null==t?void 0:t.key){let s=this._keyboardService.useWin32InputMode&&Oj(e);this.coreService.triggerDataEvent(t.key,!s)}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 s;null==(s=this._charSizeService)||s.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(vC));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 s=this._customKeyEventHandler;this._setup(),super.reset(),null==(e=this._mouseService)||e.reset(),null==(t=this._selectionService)||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=s,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("[I"):this.coreService.triggerDataEvent("[O")}_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 s=this._renderService.dimensions.css.cell.width.toFixed(0),i=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`[6;${i};${s}t`)}}};function Oj(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 Hj=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let s={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(s),t.dispose=()=>this._wrappedAddonDispose(s),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let s=0;s<this._addons.length;s++)if(this._addons[s]===e){t=s;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)}},Fj=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 Xy)}translateToString(e,t,s){return this._line.translateToString(e,t,s)}},Wj=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 Fj(t)}getNullCell(){return new Xy}},Kj=class extends kw{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new mS),this.onBufferChange=this._onBufferChange.event,this._normal=new Wj(this._core.buffers.normal,"normal"),this._alternate=new Wj(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)}},Uj=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,s)=>t(e,s.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}registerApcHandler(e,t){return this._core.registerApcHandler(e,t)}},qj=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}},Vj=["cols","rows"],$j=0,Yj=class extends kw{constructor(e){super(),this._core=this._register(new Ij(e)),this._addonManager=this._register(new Hj),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],s=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let i in this._core.options){let e={get:t.bind(this,i),set:s.bind(this,i)};Object.defineProperty(this._publicOptions,i,e)}}_checkReadonlyOptions(e){if(Vj.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 Uj(this._core))}get unicode(){return this._checkProposedApi(),new qj(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 Kj(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,s){this._verifyIntegers(e,t,s),this._core.select(e,t,s)}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 zy()},set promptLabel(e){Ty(e)},get tooMuchOutput(){return Oy()},set tooMuchOutput(e){Hy(e)}}}_verifyIntegers(...e){for($j of e)if($j===1/0||isNaN($j)||$j%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for($j of e)if($j&&($j===1/0||isNaN($j)||$j%1!=0||$j<0))throw new Error("This API only accepts positive integers")}};function Gj({id:e,kind:t,theme:s,active:i,transport:n,register:r}){var o;const a=ps.useRef(null),l=ps.useRef(null),c=ps.useRef(null),[h,u]=ps.useState(null),d=ps.useCallback(()=>{var e;const t=null==(e=l.current)?void 0:e.getSelection();t&&navigator.clipboard.writeText(t).catch(()=>{})},[]),f=ps.useCallback(()=>{const e=l.current;e&&navigator.clipboard.readText().then(t=>{t&&e.paste(t)}).catch(()=>{})},[]);ps.useEffect(()=>{const i=a.current;if(!i)return;const o=new Yj({fontFamily:'"JetBrains Mono", ui-monospace, SFMono-Regular, monospace',fontSize:12.5,lineHeight:1.25,cursorBlink:!0,scrollback:5e3,theme:By(s),vtExtensions:{kittyKeyboard:!0}}),h=new Ly;o.loadAddon(h),o.open(i);try{h.fit()}catch{}l.current=o,c.current=h,r(o),n.spawn(e,t,o.cols,o.rows);const p=n.subscribe(e,e=>{if("output"===e.type)o.write(e.data);else if("error"===e.type)o.write(`\r\n[31m${e.message}[0m\r\n`);else if("exit"===e.type){const t=null===e.exitCode?"":` (${e.exitCode})`;o.write(`\r\n[2m[process exited${t}][0m\r\n`)}}),v=o.onData(t=>n.sendData(e,t)),g=/Mac|iPhone|iPad/i.test(navigator.platform||navigator.userAgent);o.attachCustomKeyEventHandler(e=>{if("keydown"!==e.type)return!0;const t=e.key.toLowerCase();return g&&e.metaKey&&!e.ctrlKey&&!e.altKey?"v"===t?(f(),!1):"c"!==t||!o.hasSelection()||(d(),!1):!(!g&&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})};i.addEventListener("contextmenu",m);const _=o.onResize(({cols:t,rows:s})=>n.resize(e,t,s));let x;const b=new ResizeObserver(()=>{void 0!==x&&window.clearTimeout(x),x=window.setTimeout(()=>{x=void 0,(()=>{const e=a.current;if(e&&0!==e.offsetWidth&&0!==e.offsetHeight)try{h.fit()}catch{}})()},120)});return b.observe(i),()=>{void 0!==x&&window.clearTimeout(x),b.disconnect(),i.removeEventListener("contextmenu",m),v.dispose(),_.dispose(),p(),n.close(e),r(null),o.dispose()}},[]),ps.useEffect(()=>{l.current&&(l.current.options.theme=By(s))},[s]),ps.useEffect(()=>{if(!i)return;const e=requestAnimationFrame(()=>{var e,t;try{null==(e=c.current)||e.fit(),null==(t=l.current)||t.focus()}catch{}});return()=>cancelAnimationFrame(e)},[i]);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 Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("div",{ref:a,className:"h-full w-full"}),h&&Ss.jsx(Cy,{x:h.x,y:h.y,onClose:()=>u(null),items:p})]})}const Xj=["local","claude","codex"],Zj=m_(function(){const e=y_(),t=e.terminal,s=e.theme.theme,i=ps.useRef(new Map),n=ps.useCallback((e,t)=>{t?i.current.set(e,t):i.current.delete(e)},[]),[r,o]=ps.useState(null),a=Sy({value:t.height,onChange:e=>t.setHeight(e),axis:"y",dir:-1,min:t.heightMin,max:()=>t.heightMax}),l=t.activeKind?My[t.activeKind]:null,c=[{kind:"header",label:"New session"},...Xj.map(e=>({kind:"item",icon:My[e].icon,label:My[e].label,onSelect:()=>t.newTerm(e)}))],h=[{kind:"item",icon:"refresh",label:"Clear buffer",disabled:!t.activeId,onSelect:()=>{var e;t.activeId&&(null==(e=i.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 Ss.jsxs("div",{className:ay("relative shrink-0",t.open?"flex":"hidden"),style:{height:t.height},children:[Ss.jsx(jy,{axis:"y",onPointerDown:a,className:"-top-[6px]"}),Ss.jsxs("div",{className:"uno-island flex min-h-0 flex-1 flex-col",children:[Ss.jsxs("div",{className:"flex h-9 shrink-0 items-stretch gap-1 border-b border-edge bg-panel pl-3 pr-1",children:[Ss.jsx("div",{className:"flex items-center pr-1 text-[12px] font-semibold text-fg-3",children:"Terminal"}),Ss.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 s=My[e.kind],i=e.id===t.activeId;return Ss.jsx(Ny,{label:s.label,active:i,closeLabel:`Close ${s.label} session`,onActivate:()=>t.activate(e.id),onClose:()=>t.closeTerm(e.id),leading:Ss.jsx(cy,{name:s.icon,className:ay("h-3.5 w-3.5 shrink-0",i?"":s.tint)})},e.id)}),Ss.jsxs("div",{className:"flex shrink-0 items-center self-center",children:[Ss.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:Ss.jsx(cy,{name:"plus",className:"h-4 w-4"})}),Ss.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:Ss.jsx(cy,{name:"chevronD",className:"h-3.5 w-3.5"})})]})]}),Ss.jsxs("div",{className:"flex items-center gap-0.5 self-center",children:[l&&Ss.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:[Ss.jsx(cy,{name:l.icon,className:ay("h-3.5 w-3.5",l.tint)}),Ss.jsx("span",{className:"font-mono text-[11.5px]",children:l.label}),Ss.jsx(cy,{name:"chevronD",className:"h-3.5 w-3.5 opacity-60"})]}),Ss.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:Ss.jsx(cy,{name:"more",className:"h-4 w-4"})}),Ss.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:Ss.jsx(cy,{name:"minus",className:"h-4 w-4"})})]})]}),Ss.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden bg-canvas px-2 pt-1",children:[0===t.tabs.length&&Ss.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(i=>Ss.jsx("div",{className:ay("absolute inset-0 px-2 pt-1",i.id===t.activeId?"block":"hidden"),children:Ss.jsx(Gj,{id:i.id,kind:i.kind,theme:s,active:t.open&&i.id===t.activeId,transport:e.terminalTransport,register:e=>n(i.id,e)})},i.id))]})]}),r&&Ss.jsx(Cy,{x:r.x,y:r.y,onClose:()=>o(null),items:"new"===r.mode?c:h})]})});function Jj({id:e}){return Ss.jsx("div",{className:"grid h-full place-items-center px-6",children:Ss.jsxs("div",{className:"text-center",children:[Ss.jsx(cy,{name:"alert",className:"mx-auto h-5 w-5 text-fg-4"}),Ss.jsxs("div",{className:"mt-2 font-mono text-[12.5px] text-fg-3",children:["not found: ",e]})]})})}const Qj={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 eN({children:e,tone:t="neutral",size:s="sm"}){return Ss.jsx("span",{className:ay("inline-flex items-center gap-1 rounded border font-mono font-medium uppercase tracking-wider","xs"===s?"h-[14px] px-1 text-[9.5px]":"h-5 px-1.5 text-[10.5px]",Qj[t]),children:e})}const tN={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"},sN={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 iN({status:e,large:t=!1,pulse:s=!0}){const i=t?"h-2.5 w-2.5":"h-2 w-2";return Ss.jsx("span",{className:ay("inline-block shrink-0 rounded-full ring-2",i,tN[e],"running"===e&&s&&"uno-pulse",sN[e])})}function nN(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 rN(e){if(null==e)return"never run";const t="string"==typeof e?new Date(e).getTime():e;if(!Number.isFinite(t))return"—";const s=Math.max(0,Math.round((Date.now()-t)/1e3));return s<60?`${s}s ago`:s<3600?`${Math.round(s/60)}m ago`:s<86400?`${Math.round(s/3600)}h ago`:s<604800?`${Math.round(s/86400)}d ago`:new Date(t).toISOString().slice(0,10)}function oN(e,t){return null===e?"never":J_(e)?t?"expected":"failed":t&&"passed"===e?"failed":lN(e)}function aN(e){return e?lN(e.status):"never"}function lN(e){switch(e){case"running":return"running";case"passed":return"passed";case"failed":return"failed";case"aborted":case"interrupted":return"aborted"}}function cN(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 hN=m_(function({runId:e}){const t=y_(),s=t.activeRuns.collectionByRunId.get(e),i=t.runs.items.find(t=>t.runId===e),n=!s&&i?t.historicRuns.get(e):null;ps.useEffect(()=>{!s&&i&&t.historicRuns.loadIfNeeded(e)},[e,s,i,t.historicRuns]);const r=function(e,t,s,i){if(s)return function(e,t){var s;const i=new Map,n=new Map;for(const u of t.events)"collection-run:scenario-started"===u.kind?i.set(u.scenario,u.t):"collection-run:scenario-finished"===u.kind&&n.set(u.scenario,u.t);const r=t.scenarios.map(s=>{const r=t.childRunIds.get(s)??null,o=t.childOutcomes.get(s)??null,a=r?e.activeRuns.byRunId.get(r):null,l=e.scenarios.items.find(e=>e.name===s),{status:c,skipReason:h}=uN({hasChildRunId:null!==r,childOutcome:o,childLiveStatus:(null==a?void 0:a.status)??null});return{scenario:s,status:c,durationMs:dN(i.get(s)??null,n.get(s)??null),childRunId:r,scenarioPath:(null==l?void 0:l.path)??null,skipReason:h}}),o=r.filter(e=>"passed"===e.status).length,a=r.filter(e=>"failed"===e.status).length,l=r.filter(e=>"running"===e.status||"paused"===e.status).length,c=t.startedAt,h=null!==t.outcome?(null==(s=t.events[t.events.length-1])?void 0:s.t)??null:null;return{headerStatus:fN(t),ref:t.collection||"—",durationMs:null!==h?h-c:null,rows:r,passed:o,failed:a,running:l,total:r.length||t.scenarios.length,abortable:"starting"===t.status||"running"===t.status}}(t,s);if(i&&"collection"===i.meta.kind)return function(e,t){let s=[];const i=new Map,n=new Map,r=new Map,o=new Map;for(const h of t.events)"collection-run:started"===h.kind?s=[...h.scenarios]:"collection-run:scenario-started"===h.kind?(i.set(h.scenario,h.scenarioRunId),r.set(h.scenario,h.t)):"collection-run:scenario-finished"===h.kind&&(n.set(h.scenario,h.outcome),o.set(h.scenario,h.t));const a=s.map(t=>{const s=i.get(t)??null,a=n.get(t)??null,l=e.scenarios.items.find(e=>e.name===t),{status:c,skipReason:h}=uN({hasChildRunId:null!==s,childOutcome:a,childLiveStatus:null});return{scenario:t,status:c,durationMs:dN(r.get(t)??null,o.get(t)??null),childRunId:s,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:lN(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:i.meta,events:i.events});const n=t.runs.items.find(t=>t.runId===e);if(n&&"collection"===n.kind)return{headerStatus:lN(n.status),ref:n.ref,durationMs:n.durationMs,rows:[],passed:0,failed:0,running:0,total:0,abortable:!1};return null}(e,t,s,n);if(!r)return Ss.jsx(Jj,{id:e});const{headerStatus:o,ref:a,durationMs:l,rows:c,passed:h,failed:u,running:d,total:f,abortable:p}=r;return Ss.jsxs("div",{className:"flex h-full min-w-0 flex-col",children:[Ss.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-3 border-b border-edge bg-canvas px-4",children:[Ss.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[Ss.jsx(cy,{name:"layers",className:"h-4 w-4 shrink-0 text-fg-3"}),Ss.jsx(iN,{status:o,large:!0}),Ss.jsx("span",{className:"truncate font-mono text-[13px] text-fg",children:a}),Ss.jsx(eN,{tone:cN(o),children:o}),Ss.jsx(eN,{tone:"info",children:"collection"})]}),Ss.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:[Ss.jsxs("span",{className:"hidden tabular-nums sm:inline",children:[h,"/",f," passed"]}),u>0&&Ss.jsxs("span",{className:"tabular-nums text-fail",children:[u," failed"]}),Ss.jsx("span",{className:"tabular-nums",children:nN(l)}),p&&t.session.capabilities.canRun&&Ss.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:[Ss.jsx(cy,{name:"square",className:"h-3 w-3",strokeWidth:2.5})," Stop"]})]})]}),Ss.jsxs("div",{className:"flex h-2 shrink-0 overflow-hidden bg-raised",children:[Ss.jsx("div",{className:"h-full bg-pass",style:{width:h/Math.max(1,f)*100+"%"}}),Ss.jsx("div",{className:"h-full bg-fail",style:{width:u/Math.max(1,f)*100+"%"}}),Ss.jsx("div",{className:ay("h-full bg-warn",d>0&&"uno-pulse"),style:{width:d/Math.max(1,f)*100+"%"}})]}),Ss.jsxs("div",{className:"flex-1 overflow-auto",children:[Ss.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:[Ss.jsx("span",{className:"w-4"}),Ss.jsx("span",{className:"flex-1",children:"scenario"}),Ss.jsx("span",{className:"w-20 text-right",children:"time"})]}),c.map(e=>Ss.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:[Ss.jsx(iN,{status:e.status,large:!0}),Ss.jsxs("div",{className:"min-w-0 flex-1",children:[Ss.jsx("div",{className:"truncate font-mono text-[12.5px] text-fg",children:e.scenario}),e.skipReason&&Ss.jsxs("div",{className:"mt-0.5 truncate font-mono text-[10px] text-fg-4",children:["skipped — ",e.skipReason]})]}),Ss.jsx("span",{className:"w-20 text-right font-mono text-[11px] tabular-nums text-fg-2",children:nN(e.durationMs)}),Ss.jsx(cy,{name:"chevronR",className:"h-3.5 w-3.5 text-fg-4 group-hover:text-fg-3"})]},e.scenario)),0===c.length&&Ss.jsx("div",{className:"px-4 py-6 text-center font-mono text-[11.5px] text-fg-4",children:"collection has no scenarios"})]})]})});function uN(e){return null!==e.childOutcome?{status:vN(e.childOutcome),skipReason:null}:null!==e.childLiveStatus?{status:pN(e.childLiveStatus),skipReason:null}:e.hasChildRunId?{status:"running",skipReason:null}:{status:"pending",skipReason:"skipped"}}function dN(e,t){return null===e||null===t?null:Math.max(0,t-e)}function fN(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 pN(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 vN(e){switch(e){case"completed":return"passed";case"failed":return"failed";case"aborted":case"interrupted":return"aborted"}}function gN({anchor:e,candidates:t,onPick:s,onClose:i}){const n=ps.useRef(null),r=ps.useRef(null),o=ps.useRef(null),[a,l]=ps.useState(""),[c,h]=ps.useState(0),[u,d]=ps.useState(!1),f=e.top-12,p=window.innerHeight-e.bottom-12,v=p>f?"down":"up",g=ps.useMemo(()=>{const e=a.trim().toLowerCase();return e?t.filter(t=>t.name.toLowerCase().includes(e)):t},[a,t]);ps.useEffect(()=>{h(0)},[a,g.length]),ps.useEffect(()=>{var e;null==(e=r.current)||e.focus();const t=requestAnimationFrame(()=>d(!0));return()=>cancelAnimationFrame(t)},[]),ps.useEffect(()=>{const e=e=>{var t;(null==(t=n.current)?void 0:t.contains(e.target))||i()},t=e=>{"Escape"===e.key&&i()},s=e=>{var t;(null==(t=n.current)?void 0:t.contains(e.target))||i()};return window.addEventListener("mousedown",e,!0),window.addEventListener("contextmenu",e,!0),window.addEventListener("keydown",t),window.addEventListener("scroll",s,!0),()=>{window.removeEventListener("mousedown",e,!0),window.removeEventListener("contextmenu",e,!0),window.removeEventListener("keydown",t),window.removeEventListener("scroll",s,!0)}},[i]),ps.useEffect(()=>{0===t.length&&i()},[t.length,i]);const m=e=>{var t;const s=null==(t=o.current)?void 0:t.children[e];null==s||s.scrollIntoView({block:"nearest"})},_=e=>{var t;const i=g[e];i&&(s(i.name),l(""),null==(t=r.current)||t.focus())},x={position:"fixed",left:e.left,width:e.width,maxHeight:Math.max(180,"up"===v?f:p),opacity:u?1:0,transform:u?"translateY(0)":"up"===v?"translateY(2px)":"translateY(-2px)",transitionProperty:"opacity, transform",transitionDuration:"90ms",transitionTimingFunction:"ease-out",..."up"===v?{bottom:window.innerHeight-e.top+6}:{top:e.bottom+6}};return Ss.jsxs("div",{ref:n,role:"dialog",style:x,className:ay("z-50 flex flex-col overflow-hidden rounded-lg p-1","border border-edge-soft bg-overlay/95 backdrop-blur","shadow-lg"),children:[Ss.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1.5 rounded-md px-2",children:[Ss.jsx(cy,{name:"search",className:"h-3.5 w-3.5 text-fg-3"}),Ss.jsx("input",{ref:r,value:a,onChange:e=>l(e.target.value),onKeyDown:e=>{if("ArrowDown"===e.key)e.preventDefault(),h(e=>{const t=Math.min(g.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=g.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"}),Ss.jsxs("span",{className:"font-mono text-[10px] tracking-wider text-fg-4",children:[g.length,"/",t.length]})]}),Ss.jsx("div",{className:"my-1 h-px shrink-0 bg-edge-soft"}),Ss.jsx("div",{ref:o,className:"min-h-0 flex-1 overflow-auto",children:0===g.length?Ss.jsxs("div",{className:"px-2 py-3 text-center font-mono text-[11.5px] text-fg-4",children:['no match for "',a.trim(),'"']}):g.map((e,t)=>{const s=t===c;return Ss.jsxs("button",{type:"button",onMouseEnter:()=>h(t),onMouseDown:e=>e.preventDefault(),onClick:()=>_(t),className:ay("flex h-7 w-full items-center gap-2 rounded-md px-2 text-left",s?"bg-selection text-fg":"text-fg-2 hover:bg-raised/60"),children:[Ss.jsx(cy,{name:"file",className:ay("h-3.5 w-3.5 shrink-0",s?"text-accent":"text-fg-4")}),Ss.jsx("span",{className:"truncate font-mono text-[12px]",children:e.name})]},e.name)})}),Ss.jsx("div",{className:"my-1 h-px shrink-0 bg-edge-soft"}),Ss.jsxs("div",{className:"flex shrink-0 items-center gap-2 px-2 py-0.5 font-mono text-[10px] text-fg-4",children:[Ss.jsx("span",{children:"↑↓ navigate"}),Ss.jsx("span",{children:"·"}),Ss.jsx("span",{children:"↵ add"}),Ss.jsx("span",{children:"·"}),Ss.jsx("span",{children:"esc done"})]})]})}const mN="Not available in a read-only session",_N="cursor-not-allowed opacity-40",xN=m_(function({path:e}){const t=y_(),[s,i]=ps.useState(null),[n,r]=ps.useState(null),[o,a]=ps.useState(null),[l,c]=ps.useState(!1),[h,u]=ps.useState(!1),[d,f]=ps.useState(!1),p=ps.useRef(null),v=ps.useRef([]),g=t.collections.byPath(e),m=ps.useMemo(()=>{if(!g)return[];const e=new Set(g.scenarios);return t.scenarios.items.filter(t=>!e.has(t.name))},[g,t.scenarios.items]);if(ps.useEffect(()=>{if(!n||!g)return;document.body.style.userSelect="none",document.body.style.cursor="grabbing";const s=g.scenarios.slice();a(s);const i=e=>{const t=e.clientY;let s=-1,i=1/0;for(let n=0;n<v.current.length;n++){const e=v.current[n];if(!e)continue;const r=e.getBoundingClientRect(),o=r.top+r.height/2,a=Math.abs(t-o);a<i&&(i=a,s=n)}a(e=>{if(!e)return e;const t=e.indexOf(n.name);if(t<0||s<0||s===t)return e;const i=e.slice();return i.splice(t,1),i.splice(s,0,n.name),i}),r(s=>s?{...s,pointerX:e.clientX,pointerY:t}:null)},o=i=>{r(null),a(n=>(i&&n&&!function(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!==t[s])return!1;return!0}(n,s)&&t.collections.reorderScenarios(e,n),null))},l=()=>o(!0),c=()=>o(!1),h=e=>{"Escape"===e.key&&o(!1)};return window.addEventListener("pointermove",i),window.addEventListener("pointerup",l),window.addEventListener("pointercancel",c),window.addEventListener("keydown",h),()=>{document.body.style.userSelect="",document.body.style.cursor="",window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",l),window.removeEventListener("pointercancel",c),window.removeEventListener("keydown",h)}},[null==n?void 0:n.name,g,e,t.collections]),!g)return Ss.jsx(Jj,{id:e});const _=t.runs.lastRunByRef("collection",g.name),x=(o??g.scenarios).map(e=>{const s=t.scenarios.items.find(t=>t.name===e),i=t.runs.lastRunByRef("scenario",e);return{name:e,found:s,last:i}}),b=(e,t)=>{if(0!==e.button)return;e.preventDefault();const s=e.currentTarget.closest("[data-scenario-row]");if(!s)return;const i=s.getBoundingClientRect();r({name:t,left:i.left,width:i.width,offsetY:e.clientY-i.top,pointerX:e.clientX,pointerY:e.clientY})},y=t.session.capabilities.canRun,w=!y||0===g.scenarios.length;return Ss.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[Ss.jsxs("header",{className:"flex shrink-0 items-start gap-4 border-b border-edge px-4 py-3",children:[Ss.jsxs("div",{className:"min-w-0 flex-1",children:[Ss.jsxs("div",{className:"flex items-center gap-2",children:[Ss.jsx(cy,{name:"layers",className:"h-4 w-4 text-fg-3"}),l?Ss.jsx(yN,{initial:g.name,duplicateCheck:s=>t.collections.nameTaken(s,e),onCommit:async s=>{const i=await t.collections.rename(e,s);i&&(i.path!==e&&t.tabs.renameCollectionTab(e,i.path),c(!1))},onCancel:()=>c(!1)}):Ss.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:[Ss.jsx("span",{className:"truncate",children:g.name}),Ss.jsx("span",{className:"text-fg-4 opacity-0 group-hover:opacity-100",children:Ss.jsx(cy,{name:"edit",className:"h-3 w-3"})})]}),Ss.jsx(eN,{tone:"info",children:"collection"})]}),h?Ss.jsx(SN,{initial:g.description??"",onCommit:s=>{t.collections.setDescription(e,0===s.trim().length?null:s.trim()),u(!1)},onCancel:()=>u(!1)}):Ss.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:g.description??Ss.jsx("span",{className:"italic text-fg-4",children:"+ add description"})}),Ss.jsxs("div",{className:"mt-1.5 flex items-center gap-3 font-mono text-[11px] text-fg-3",children:[Ss.jsxs("span",{children:[g.scenarios.length," scenarios"]}),Ss.jsx("span",{children:"·"}),d?Ss.jsx(wN,{initial:g.workers??1,onCommit:s=>{t.collections.setWorkers(e,s<=1?null:s),f(!1)},onCancel:()=>f(!1)}):Ss.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: ",g.workers??1]}),Ss.jsx("span",{children:"·"}),Ss.jsx("span",{children:_?`last run ${rN(_.startedAt)}`:"never run"})]})]}),Ss.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[Ss.jsx("button",{type:"button",onClick:async()=>{const s=`collection:${e}`;await t.collections.delete(e)&&t.tabs.close(s)},className:"grid h-7 w-7 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fail",title:"Delete collection",children:Ss.jsx(cy,{name:"trash",className:"h-3.5 w-3.5"})}),Ss.jsxs("button",{type:"button",disabled:w,onClick:w?void 0:async()=>{try{const e=await t.activeRuns.startCollection(g.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===g.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":(g.workers??1)>1?`Run every scenario in this collection, ${g.workers} in parallel`:"Run every scenario in this collection sequentially":mN,className:ay("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:[Ss.jsx(cy,{name:"play",className:"h-3.5 w-3.5",strokeWidth:2.5})," Run all"]})]})]}),t.collections.error&&Ss.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:[Ss.jsx(cy,{name:"alert",className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),Ss.jsx("span",{className:"flex-1",children:t.collections.error}),Ss.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:Ss.jsx(cy,{name:"x",className:"h-3 w-3",strokeWidth:2.25})})]}),Ss.jsxs("div",{className:"min-h-0 flex-1 overflow-auto",children:[Ss.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:[Ss.jsx("span",{className:"w-4"}),Ss.jsx("span",{className:"w-3"}),Ss.jsx("span",{className:"flex-1",children:"scenario"}),Ss.jsx("span",{className:"w-24 text-right",children:"last run"}),Ss.jsx("span",{className:"w-6"})]}),Ss.jsx("div",{className:"relative",children:x.map((s,i)=>{const r=e=>{v.current[i]=e};if((null==n?void 0:n.name)===s.name)return Ss.jsx("div",{ref:r,"data-scenario-row":!0,className:"h-9 px-4",children:Ss.jsx("div",{className:"h-full rounded border-2 border-dashed border-accent/50 bg-accent/10"})},s.name);if(!s.found)return Ss.jsxs("div",{ref:r,"data-scenario-row":!0,className:"group flex h-9 items-center gap-2 px-4 hover:bg-raised/60",children:[Ss.jsx(bN,{onPointerDown:e=>b(e,s.name)}),Ss.jsx(iN,{status:"never"}),Ss.jsx("span",{className:"flex-1 truncate font-mono text-[12.5px] text-fail line-through",title:"file not found",children:s.name}),Ss.jsx(eN,{tone:"fail",size:"xs",children:"orphan"}),Ss.jsx("button",{type:"button",onClick:()=>{t.collections.removeScenario(e,s.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:Ss.jsx(cy,{name:"x",className:"h-3.5 w-3.5",strokeWidth:2.5})})]},s.name);const o=s.found;return Ss.jsxs("div",{ref:r,"data-scenario-row":!0,className:"group flex h-9 items-center gap-2 px-4 hover:bg-raised/60",children:[Ss.jsx(bN,{onPointerDown:e=>b(e,s.name),hoverGroup:!0}),Ss.jsx(iN,{status:aN(s.last)}),Ss.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}),Ss.jsx("span",{className:"w-24 text-right font-mono text-[11px] text-fg-2",children:s.last?rN(s.last.startedAt):"—"}),Ss.jsx("button",{type:"button",onClick:()=>t.collections.removeScenario(e,s.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:Ss.jsx(cy,{name:"x",className:"h-3.5 w-3.5",strokeWidth:2.5})})]},s.name)})}),Ss.jsx("div",{className:"px-4 py-2",children:Ss.jsxs("button",{ref:p,type:"button",onClick:()=>{var e;const t=null==(e=p.current)?void 0:e.getBoundingClientRect();t&&i(t)},disabled:0===m.length,className:ay("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":s?"border-accent bg-accent/10 text-accent":"border-edge-soft text-fg-3 hover:border-accent hover:bg-accent/10 hover:text-accent"),children:[Ss.jsx(cy,{name:"plus",className:"h-3.5 w-3.5"}),0===m.length?"all scenarios added":"add scenario"]})})]}),s&&Ss.jsx(gN,{anchor:s,candidates:m,onPick:s=>{t.collections.addScenario(e,s)},onClose:()=>i(null)}),n&&(()=>{const e=x.find(e=>e.name===n.name);if(!e)return null;const t=Math.max(4,n.pointerY-n.offsetY);return Ss.jsxs("div",{style:{position:"fixed",left:n.left,width:n.width,top:t,zIndex:60,pointerEvents:"none",transform:"scale(1.01)",transformOrigin:"left center"},className:ay("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:[Ss.jsx(cy,{name:"grip",className:"h-3.5 w-3.5 text-accent"}),Ss.jsx(iN,{status:e.found?aN(e.last):"never"}),Ss.jsx("span",{className:ay("flex-1 truncate text-[12.5px]",e.found?"text-fg":"text-fail line-through"),children:e.name}),!e.found&&Ss.jsx(eN,{tone:"fail",size:"xs",children:"orphan"}),e.found&&Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("span",{className:"w-24 text-right text-[11px] text-fg-2",children:e.last?rN(e.last.startedAt):"—"}),Ss.jsx("span",{className:"w-6"})]})]})})()]})});function bN({onPointerDown:e,hoverGroup:t=!1}){return Ss.jsx("span",{onPointerDown:e,role:"button","aria-label":"Reorder",title:"Drag to reorder",className:ay("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:Ss.jsx(cy,{name:"grip",className:"h-3.5 w-3.5"})})}function yN({initial:e,duplicateCheck:t,onCommit:s,onCancel:i}){const[n,r]=ps.useState(e),o=ps.useRef(null);ps.useEffect(()=>{var e,t;null==(e=o.current)||e.focus(),null==(t=o.current)||t.select()},[]);const a=n.trim(),l=a.length>0&&a!==e?$b(a):null,c=a.length>0&&t(a),h=c||null!==l,u=a.length>0&&!h&&a!==e;return Ss.jsx("form",{onSubmit:t=>{t.preventDefault(),u?s(a):a===e&&i()},className:"min-w-0 flex-1",children:Ss.jsx("input",{ref:o,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),i())},onBlur:()=>{u?s(a):i()},spellCheck:!1,autoComplete:"off",className:ay("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 wN({initial:e,onCommit:t,onCancel:s}){const[i,n]=ps.useState(String(e)),r=ps.useRef(null);ps.useEffect(()=>{var e,t;null==(e=r.current)||e.focus(),null==(t=r.current)||t.select()},[]);const o=Number(i),a=Number.isInteger(o)&&o>=1,l=()=>{a?t(o):s()};return Ss.jsxs("span",{className:"flex items-center gap-1",children:[Ss.jsx("span",{children:"workers:"}),Ss.jsx("input",{ref:r,value:i,onChange:e=>n(e.target.value),onKeyDown:e=>{"Escape"===e.key?(e.preventDefault(),s()):"Enter"===e.key&&(e.preventDefault(),l())},onBlur:l,inputMode:"numeric",spellCheck:!1,autoComplete:"off",className:ay("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 SN({initial:e,onCommit:t,onCancel:s}){const[i,n]=ps.useState(e),r=ps.useRef(null);return ps.useEffect(()=>{var e,t;null==(e=r.current)||e.focus(),null==(t=r.current)||t.select()},[]),Ss.jsxs("form",{onSubmit:e=>{e.preventDefault(),t(i)},className:"mt-1 max-w-[640px]",children:[Ss.jsx("textarea",{ref:r,value:i,onChange:e=>n(e.target.value),onKeyDown:e=>{"Escape"===e.key?(e.preventDefault(),s()):"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),t(i))},onBlur:()=>t(i),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"}),Ss.jsx("div",{className:"mt-1 px-1 font-mono text-[10px] text-fg-4",children:"⌘↵ save · esc cancel"})]})}const kN={},CN=function(e,t,s){let i=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const e=document.querySelector("meta[property=csp-nonce]"),s=(null==e?void 0:e.nonce)||(null==e?void 0:e.getAttribute("nonce"));i=Promise.allSettled(t.map(e=>{if((e=function(e){return"/"+e}(e))in kN)return;kN[e]=!0;const t=e.endsWith(".css"),i=t?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${e}"]${i}`))return;const n=document.createElement("link");return n.rel=t?"stylesheet":"modulepreload",t||(n.as="script"),n.crossOrigin="",n.href=e,s&&n.setAttribute("nonce",s),document.head.appendChild(n),t?new Promise((t,s)=>{n.addEventListener("load",t),n.addEventListener("error",()=>s(new Error(`Unable to preload CSS for ${e}`)))}):void 0}))}function n(e){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return i.then(t=>{for(const e of t||[])"rejected"===e.status&&n(e.reason);return e().catch(n)})};function jN({label:e,hint:t,placement:s="bottom"}){return Ss.jsxs("span",{role:"tooltip",className:ay("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"}[s]),children:[e,t&&Ss.jsx("span",{className:"font-mono text-[9.5px] text-fg-3",children:t})]})}function NN({value:e,onChange:t,options:s}){return Ss.jsx("div",{className:"inline-flex rounded-md border border-edge-soft bg-raised p-0.5",children:s.map(s=>Ss.jsxs("button",{type:"button",onClick:()=>t(s.value),"aria-pressed":e===s.value,className:ay("group relative flex items-center gap-1 rounded px-2.5 py-1 font-mono text-[11px] transition-colors",e===s.value?"bg-canvas text-fg shadow-sm":"text-fg-3 hover:text-fg-2"),children:[s.icon&&Ss.jsx(cy,{name:s.icon,className:"h-3.5 w-3.5",strokeWidth:1.75}),Ss.jsx("span",{children:s.label}),s.title&&Ss.jsx(jN,{label:s.title})]},s.value))})}function MN(e){const t=[],s=/('[^']*'|"[^"]*"|`[^`]*`|\/\/[^\n]*|[A-Za-z_][\w$]*|\d+|[(){}[\],:.;]|\s+|[^A-Za-z0-9_'"`(){}\[\],:.;\s]+)/g,i=new Set(["true","false","null","undefined","await","async","const","let","var","return","export","import","from","if","else","function"]);let n;for(;n=s.exec(e);){const r=n[0];if(r.startsWith("//"))t.push({t:r,cls:"text-fg-4 italic"});else if(/^['"`]/.test(r))t.push({t:r,cls:"text-syn-string"});else if(/^\d+$/.test(r))t.push({t:r,cls:"text-syn-number"});else if(i.has(r))t.push({t:r,cls:"text-syn-keyword"});else if(/^[A-Za-z_][\w$]*$/.test(r)){const i=e.slice(s.lastIndex);/^\s*\(/.test(i)?t.push({t:r,cls:"text-accent"}):t.push({t:r,cls:"text-fg"})}else/^[(){}[\],:.;]/.test(r)?t.push({t:r,cls:"text-fg-4"}):t.push({t:r,cls:""})}return Ss.jsx(Ss.Fragment,{children:t.map((e,t)=>Ss.jsx(ps.Fragment,{children:Ss.jsx("span",{className:e.cls,children:e.t})},t))})}function BN({src:e,file:t,focusLine:s,focusSeq:i}){const n=e.split("\n"),r=ps.useRef(null);return ps.useEffect(()=>{var e,t;null!=s&&(null==(t=null==(e=r.current)?void 0:e.scrollIntoView)||t.call(e,{block:"center"}))},[s,i]),Ss.jsxs("div",{className:"flex h-full flex-col",children:[Ss.jsxs("div",{className:"flex h-8 shrink-0 items-center gap-2 border-b border-edge bg-panel px-3",children:[Ss.jsx(cy,{name:"file",className:"h-3.5 w-3.5 text-fg-4"}),Ss.jsx("span",{className:"font-mono text-[11.5px] text-fg-3",children:t}),Ss.jsx("span",{className:"font-mono text-[10.5px] text-fg-4",children:"· read-only"}),Ss.jsx("div",{className:"ml-auto flex items-center gap-1",children:Ss.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:Ss.jsx(cy,{name:"copy",className:"h-3.5 w-3.5"})})})]}),Ss.jsx("div",{className:"flex-1 overflow-auto bg-canvas",children:Ss.jsx("pre",{className:"grid grid-cols-[auto_1fr] font-mono text-[12.5px] leading-[1.55]",children:n.map((e,t)=>{const i=s===t+1;return Ss.jsxs(ps.Fragment,{children:[Ss.jsx("span",{className:"select-none border-r border-edge-soft px-3 text-right tabular-nums "+(i?"bg-accent/15 text-fg-2":"text-fg-4"),children:t+1}),Ss.jsx("span",{ref:i?r:void 0,className:"px-3 "+(i?"bg-accent/10":""),children:e?MN(e):" "})]},t)})})})]})}const LN=ps.lazy(()=>CN(()=>import("./DslEditor-DaxcTIeO.js"),__vite__mapDeps([0,1])).then(e=>({default:e.DslEditor}))),DN=m_(function({path:e}){const t=y_(),s=t.helpers.items.find(t=>t.path===e),[i,n]=ps.useState("view");ps.useEffect(()=>{s&&t.source.getOrLoad(s.path)},[t,s]);const r=t.editorBridge.pendingReveal(e),[o,a]=ps.useState(null);if(ps.useEffect(()=>{r&&(a(r),t.editorBridge.consumeReveal(e,r.seq))},[r,t,e]),!s)return Ss.jsx(Jj,{id:e});const l=t.source.get(s.path),c=l?l.split("\n").length:0;return Ss.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[Ss.jsxs("header",{className:"flex shrink-0 items-start gap-4 border-b border-edge px-4 py-3",children:[Ss.jsxs("div",{className:"min-w-0 flex-1",children:[Ss.jsxs("div",{className:"flex items-center gap-2",children:[Ss.jsx(cy,{name:"braces",className:"h-4 w-4 text-fg-3"}),Ss.jsxs("h1",{className:"truncate font-mono text-[15px] font-medium text-fg",children:[s.name,".js"]}),Ss.jsx(eN,{tone:"neutral",children:"helper"})]}),Ss.jsxs("div",{className:"mt-1 flex items-center gap-3 font-mono text-[11.5px] text-fg-2",children:[Ss.jsx("span",{className:"truncate",children:s.path}),c>0&&Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("span",{className:"text-fg-4",children:"·"}),Ss.jsxs("span",{children:[c," lines"]})]})]})]}),Ss.jsx(NN,{value:i,onChange:n,options:[{value:"view",label:"View"},{value:"edit",label:"Edit"}]})]}),Ss.jsx("div",{className:"min-h-0 flex-1",children:"edit"===i?Ss.jsx(ps.Suspense,{fallback:Ss.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading editor…"}),children:Ss.jsx(LN,{path:s.path,fileKind:"helper",highlightLine:null==o?void 0:o.line})}):void 0!==l?Ss.jsx(BN,{src:l,file:s.path,focusLine:null==o?void 0:o.line,focusSeq:null==o?void 0:o.seq}):Ss.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading source…"})})]})}),EN=36e5,PN=24*EN,RN={fresh:46,today:30,week:19,stale:11};function AN(e,t){if(null===e)return"fresh";const s=t-e;return s<EN?"fresh":s<PN?"today":s<7*PN?"week":"stale"}class zN{constructor(e){this.rest=e,this.records=[],this.editing=null,this.readOnly=!1,this.driftedFromPush=!1,this.loadError=null,Fr(this,{},{autoBind:!0})}async load(){try{this.apply(await this.rest.schedules())}catch(e){cr(()=>{this.loadError=e instanceof Error?e.message:String(e)})}}get(e,t){const s=this.records.find(s=>s.target.kind===e&&s.target.name===t);return s?{cron:s.cron,env:s.env}:null}sourceOf(e,t){const s=this.records.find(s=>s.target.kind===e&&s.target.name===t);return s?s.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,s=this.fileRecords().filter(e=>!TN(e.target,t)).concat([{target:t,cron:e.cron.trim(),env:e.env,source:"file"}]);return this.replace(s)}async remove(){if(!this.editing)return null;const e=this.editing;return this.replace(this.fileRecords().filter(t=>!TN(t.target,e)))}fileRecords(){return this.records.filter(e=>"file"===e.source)}async replace(e){try{const t=await this.rest.putSchedules(e.map(ON));return cr(()=>{this.apply(t),this.editing=null}),null}catch(t){return t instanceof Error?t.message:String(t)}}apply(e){cr(()=>{this.records=e.schedules.map(IN),this.readOnly=e.readOnly,this.driftedFromPush=e.driftedFromPush,this.loadError=null})}}function TN(e,t){return e.kind===t.kind&&e.name===t.name}function IN(e){return{target:_b(e),cron:e.cron,env:e.env??null,source:e.source??"file"}}function ON(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 HN(e){const t=Cb(e.cron);return e.env?`${t} · ${e.env}`:t}const FN=m_(function(){const e=y_(),[t,s]=ps.useState("all"),[i,n]=ps.useState("runs"),[r,o]=ps.useState({w:0,h:0}),[a,l]=ps.useState(null),[c,h]=ps.useState(()=>Date.now());ps.useEffect(()=>{const e=setInterval(()=>h(Date.now()),6e4);return()=>clearInterval(e)},[]),ps.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 s=new Map;for(const i of e){if("collection"!==i.target.kind)continue;const e=t.find(e=>e.name===i.target.name);for(const t of(null==e?void 0:e.scenarios)??[])s.set(t,{cron:i.cron,env:i.env,via:i.target.name})}for(const i of e)"scenario"===i.target.kind&&s.set(i.target.name,{cron:i.cron,env:i.env,via:null});return s}(e.schedules.list,e.collections.items),v=f.filter(e=>"all"===t||("scheduled"===t?p.has(e.ref):"unscheduled"===t?!p.has(e.ref):e.status===t)),g=function(e,t,s){let i={cols:1,size:0};for(let n=1;n<=e;n++){const r=Math.ceil(e/n),o=Math.min((t-XN*(n-1))/n,(s-XN*(r-1))/r);o>i.size&&(i={cols:n,size:o})}return{cols:i.cols,size:Math.min(i.size,QN)}}(f.length,r.w-2*ZN,r.h-2*ZN),m=Math.max(g.size,JN),_=r.w>0,x=Math.max(1,Math.min(g.cols,v.length)),b=g.cols*m+(g.cols-1)*XN,y={width:_?Math.max(b,Math.min(eM,r.w)):void 0};if(0===u.all)return Ss.jsx(VN,{});const w=f.filter(e=>p.has(e.ref)).length,S="runs"===i?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 Ss.jsxs("div",{className:"flex h-full flex-col overflow-hidden px-6 py-6",children:[Ss.jsxs("div",{className:ay("mx-auto w-full shrink-0",GN),style:y,children:[Ss.jsxs("div",{className:"mb-1.5 flex items-center gap-2",children:[Ss.jsx(cy,{name:"activity",className:"h-4 w-4 text-fg-4"}),Ss.jsx("span",{className:"font-mono text-[11px] uppercase tracking-wider text-fg-4",children:"overview"}),Ss.jsx("div",{className:"ml-auto",children:Ss.jsx(NN,{value:i,onChange:e=>{n(e),s("all")},options:[{value:"runs",label:"last run",icon:"activity"},{value:"schedule",label:"schedule",icon:"clock"}]})})]}),Ss.jsx("h1",{className:"mb-5 truncate font-mono text-[18px] font-medium tracking-tight text-fg-2",children:"runs"===i?qN(u.failed,d):WN(w,u.all)}),Ss.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=>Ss.jsx(mM,{label:e.label,name:e.name,value:e.value,dot:e.dot,icon:e.icon,active:t===e.filter,onClick:()=>s(e.filter)},e.filter))}),"schedule"===i&&Ss.jsxs("div",{className:"mt-2 flex items-center gap-1.5 truncate font-mono text-[10.5px] text-fg-4",children:[Ss.jsx(cy,{name:"package",className:"h-3 w-3 shrink-0"}),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"===i&&e.schedules.driftedFromPush&&Ss.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 truncate font-mono text-[10.5px] text-warn",children:[Ss.jsx(cy,{name:"alert",className:"h-3 w-3 shrink-0"}),"this set differs from the one recorded at push — the project's config likely computes schedules from this environment"]}),"schedule"===i&&e.schedules.list.length>0&&Ss.jsx(YN,{records:e.schedules.list,collections:e.collections.items,now:c})]}),Ss.jsx(iM,{tiles:v,attach:l,field:a,cols:x,size:m,ready:_,now:c,mode:i,schedules:p}),Ss.jsx("div",{className:ay("mx-auto mt-3 flex w-full shrink-0 items-center gap-4 whitespace-nowrap font-mono text-[10.5px] text-fg-4",GN),style:y,children:"runs"===i?Ss.jsxs(Ss.Fragment,{children:[Ss.jsxs("span",{className:"flex items-center gap-1.5",children:[Ss.jsx(iN,{status:"passed",pulse:!1})," passed"]}),Ss.jsxs("span",{className:"flex items-center gap-1.5",children:[Ss.jsx(iN,{status:"failed",pulse:!1})," failed"]}),u.expected>0&&Ss.jsxs("span",{className:"flex items-center gap-1.5",children:[Ss.jsx(iN,{status:"expected",pulse:!1})," failed on purpose"]}),Ss.jsxs("span",{className:"flex items-center gap-1.5",children:[Ss.jsx(iN,{status:"never",pulse:!1})," never run"]}),f.some(e=>e.live)&&Ss.jsxs("span",{className:"flex items-center gap-1.5",children:[Ss.jsx("span",{className:"uno-tile-live h-2 w-2 rounded-[2px] bg-warn/40"}),"running now"]}),Ss.jsx(KN,{}),Ss.jsx("span",{className:"ml-auto",children:d?"hover for history · click to open the last run":"reading run history…"})]}):Ss.jsxs(Ss.Fragment,{children:[Ss.jsx(UN,{}),Ss.jsx("span",{className:"ml-auto",children:"hover for the schedule · click to open the test"})]})})]})});function WN(e,t){return 0===e?"Nothing runs on a schedule.":`${e} of ${t} ${1===t?"test runs":"tests run"} on a schedule.`}function KN(){return Ss.jsxs("span",{className:"flex items-center gap-1.5","aria-label":"Colour fades as a result ages",children:[Ss.jsx("span",{className:"flex items-center gap-[2px]",children:["fresh","today","week","stale"].map(e=>Ss.jsx("span",{className:"h-2 w-2 rounded-[1px]",style:{background:`color-mix(in srgb, var(--u-fg-3) ${RN[e]}%, transparent)`}},e))}),"just ran → older"]})}function UN(){return Ss.jsxs(Ss.Fragment,{children:[Ss.jsxs("span",{className:"flex items-center gap-1.5","aria-label":"Brighter means the test runs more often",children:[Ss.jsx("span",{className:"flex items-center gap-[2px]",children:[95,65,38,22].map(e=>Ss.jsx("span",{className:"h-2 w-2 rounded-[1px]",style:{background:`color-mix(in srgb, var(--u-accent) ${e}%, transparent)`}},e))}),"often → rare"]}),Ss.jsxs("span",{className:"flex items-center gap-1.5",children:[Ss.jsx("span",{className:"h-2 w-2 rounded-[1px]",style:{background:`color-mix(in srgb, var(--u-fg-4) ${oM}%, transparent)`}}),"no schedule"]})]})}function qN(e,t){return t?0===e?"Everything is green.":`${e} ${1===e?"test is":"tests are"} failing.`:"Reading run history…"}function VN(){return Ss.jsx("div",{className:"grid h-full place-items-center px-6 py-10",children:Ss.jsxs("div",{className:"w-full max-w-[520px]",children:[Ss.jsxs("div",{className:"mb-6 flex items-center gap-2",children:[Ss.jsx(cy,{name:"inspect",className:"h-4 w-4 text-fg-4"}),Ss.jsx("span",{className:"font-mono text-[11px] uppercase tracking-wider text-fg-4",children:"workspace"})]}),Ss.jsx("h1",{className:"font-mono text-[18px] font-medium tracking-tight text-fg-2",children:"No scenarios yet."}),Ss.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."}),Ss.jsxs("div",{className:"mt-8 rounded border border-edge-soft bg-raised/50 p-3",children:[Ss.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-fg-4",children:[Ss.jsx(cy,{name:"terminal",className:"h-3.5 w-3.5"}),Ss.jsx("span",{children:"Run from CLI:"})]}),Ss.jsxs("pre",{className:"mt-2 overflow-x-auto rounded bg-canvas p-2.5 font-mono text-[12px] text-fg-2",children:[Ss.jsx("span",{className:"text-fg-4",children:"$ "}),Ss.jsx("span",{className:"text-accent",children:"npx @unotest/web"})," e2e"," ",Ss.jsx("span",{className:"text-fg-2",children:"<scenario>"})]})]})]})})}function $N(e,t){const s=kb(e);return s?Bb(Nb(s,t),t):"—"}function YN({records:e,collections:t,now:s}){const i=e.map(e=>{const t=kb(e.cron);return{rec:e,tick:t?Nb(t,s):null}}).sort((e,t)=>(e.tick??1/0)-(t.tick??1/0));return Ss.jsxs("div",{className:"mt-2 rounded border border-edge-soft bg-raised/40 px-3 py-2",children:[Ss.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-wider text-fg-4",children:[Ss.jsx(cy,{name:"clock",className:"h-3 w-3"}),"upcoming ",Ss.jsx("span",{className:"normal-case tracking-normal",children:"· your clock"})]}),Ss.jsx("div",{className:"mt-1.5 flex flex-col gap-1",children:i.map(({rec:e,tick:i})=>{var n;const r="collection"===e.target.kind?(null==(n=t.find(t=>t.name===e.target.name))?void 0:n.scenarios.length)??0:null;return Ss.jsxs("div",{className:"flex items-baseline gap-2 font-mono text-[11px]",children:[Ss.jsx("span",{className:"shrink-0 tabular-nums text-fg-2",children:null===i?"—":Bb(i,s)}),Ss.jsx("span",{className:"truncate text-fg-2",children:e.target.name}),Ss.jsxs("span",{className:"truncate text-fg-4",children:["collection"===e.target.kind?"collection":"test"," ·"," ",HN(e),null!==r&&Ss.jsxs(Ss.Fragment,{children:[" → ",r," tests"]})]})]},`${e.target.kind}:${e.target.name}`)})})]})}const GN="min-w-max",XN=8,ZN=3,JN=26,QN=104,eM=560,tM=250,sM=120;function iM({tiles:e,attach:t,field:s,cols:i,size:n,ready:r,now:o,mode:a,schedules:l}){const[c,h]=ps.useState(null),u=y_(),d=(e,t)=>{const i=e.currentTarget;if(!s)return;const n=tM/2,r=i.offsetLeft+i.offsetWidth/2,o=Math.max(n,s.clientWidth-n),a=i.offsetTop+i.offsetHeight,l=s.clientHeight-a<sM;h({row:t,x:Math.min(Math.max(r,n),o),y:l?s.clientHeight-i.offsetTop+XN:a+XN,above:l})};return Ss.jsxs("div",{ref:t,className:"relative mt-5 min-h-0 flex-1 overflow-y-auto",onMouseLeave:()=>h(null),children:[0===e.length?Ss.jsx("div",{className:"grid h-full place-items-center font-mono text-[11.5px] text-fg-4",children:"nothing matches"}):Ss.jsx("div",{className:"grid justify-center",style:{gridTemplateColumns:`repeat(${i}, ${n}px)`,gap:XN,padding:ZN,visibility:r?"visible":"hidden"},children:e.map(e=>{const t=l.get(e.ref)??null;return Ss.jsx("button",{type:"button","aria-label":"schedule"===a?`${e.ref} — ${t?HN(t):"no schedule"}`:e.live?`${e.ref} — ${e.status}, ${"paused"===e.live?"paused":"running now"}`:`${e.ref} — ${e.status}, ${rN(e.lastAt)}`,"data-age":null===e.lastAt?void 0:AN(e.lastAt,o),onMouseEnter:t=>d(t,e),onFocus:t=>d(t,e),onClick:()=>function(e,t,s){"runs"===s&&null!==t.lastRunId?e.open({kind:"scenario-run",runId:t.lastRunId,ref:t.ref}):e.openScenario(t.path)}(u.tabs,e,a),style:{height:n,..."schedule"===a?uM(t,(null==c?void 0:c.row.ref)===e.ref):lM(e.status,AN(e.lastAt,o),(null==c?void 0:c.row.ref)===e.ref)},className:ay("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&&Ss.jsx(pM,{hover:c,mode:a,now:o,schedule:l.get(c.row.ref)??null})]})}const nM={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"},rM=new Set(["never","pending","aborted"]),oM=12,aM=14;function lM(e,t,s){const i=rM.has(e)?oM:RN[t];return dM(nM[e],i,s)}const cM={m5:95,m15:85,h1:75,h2:65,h4:55,h6:45,h12:38,daily:30,weekly:22},hM=50;function uM(e,t){if(!e)return dM("--u-fg-4",oM,t);const s=kb(e.cron);return dM("--u-accent",s?cM[s.freq]:hM,t)}function dM(e,t,s){const i=Math.min(t+(s?aM:0),100);return{background:`color-mix(in srgb, var(${e}) ${i}%, transparent)`,borderColor:`color-mix(in srgb, var(${e}) ${Math.min(Math.round(1.7*i),75)}%, transparent)`}}function fM({recent:e,expectFail:t}){const s=e=>{const s=J_(e);return s||"passed"===e?s===t?t?"bg-expected":"bg-pass":"bg-fail":"bg-fg-4/30"};return Ss.jsx("span",{className:"flex h-3.5 items-end gap-[3px]",children:e.map((e,t)=>Ss.jsx("span",{className:ay("h-full w-[5px] shrink-0 rounded-[1px]",s(e))},t))})}function pM({hover:e,mode:t,now:s,schedule:i}){const{row:n}=e,r=n.ref.lastIndexOf("/"),o=-1===r?"":n.ref.slice(0,r+1),a=-1===r?n.ref:n.ref.slice(r+1),l="passed"===n.status&&n.recent.some(J_),c=n.expectFail&&"failed"===n.status;return Ss.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:tM,...e.above?{bottom:e.y}:{top:e.y}},children:[Ss.jsxs("div",{className:"flex items-center gap-1.5",children:["schedule"===t?Ss.jsx(cy,{name:"clock",className:"h-3 w-3 shrink-0 text-fg-4"}):Ss.jsx(iN,{status:n.status,pulse:!1}),Ss.jsxs("span",{className:"truncate font-mono text-[11.5px] text-fg",children:[Ss.jsx("span",{className:"text-fg-4",children:o}),a]})]}),"schedule"===t?Ss.jsx(vM,{schedule:i,now:s}):Ss.jsx(gM,{r:n,flaky:l,unexpectedPass:c,schedule:i,now:s})]})}function vM({schedule:e,now:t}){return e?Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("div",{className:"mt-1 font-mono text-[10px] text-fg-2",children:HN(e)}),Ss.jsxs("div",{className:"mt-0.5 font-mono text-[10px] text-fg-4",children:[e.via&&Ss.jsxs(Ss.Fragment,{children:["via ",e.via," · "]}),"next ",$N(e.cron,t)," · your clock"]})]}):Ss.jsx("div",{className:"mt-1 font-mono text-[10px] text-fg-4",children:"no schedule — right-click the test to add one"})}function gM({r:e,flaky:t,unexpectedPass:s,schedule:i,now:n}){return Ss.jsxs(Ss.Fragment,{children:[Ss.jsxs("div",{className:"mt-1 flex items-center gap-1.5 font-mono text-[10px] text-fg-4",children:[e.live?Ss.jsx("span",{className:"text-warn",children:"paused"===e.live?"paused":"running now"}):Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("span",{children:null===e.lastAt?"never run":rN(e.lastAt)}),Ss.jsx("span",{children:"·"}),Ss.jsx("span",{children:nN(e.durationMs)})]}),e.failStreak>0&&"expected"!==e.status&&Ss.jsxs("span",{className:"text-fail",children:["· red ",e.failStreak," ",1===e.failStreak?"run":"runs"]}),t&&Ss.jsx("span",{className:"text-warn",children:"· flaky"})]}),i&&Ss.jsxs("div",{className:"mt-1 flex items-center gap-1 font-mono text-[10px] text-fg-4",children:[Ss.jsx(cy,{name:"clock",className:"h-2.5 w-2.5"}),Ss.jsxs("span",{className:"truncate",children:[HN(i),i.via&&Ss.jsxs(Ss.Fragment,{children:[" · via ",i.via]}),` · next ${$N(i.cron,n)}`]})]}),"expected"===e.status&&Ss.jsx("div",{className:"mt-1 font-mono text-[10px] text-expected",children:"expected to fail · @expect-fail"}),s&&Ss.jsx("div",{className:"mt-1 font-mono text-[10px] text-fail",children:"passed, but it is marked @expect-fail"}),e.recent.length>0&&Ss.jsxs("div",{className:"mt-2 border-t border-edge-soft pt-2",children:[Ss.jsx(fM,{recent:e.recent,expectFail:e.expectFail}),Ss.jsxs("div",{className:"mt-1 font-mono text-[9.5px] text-fg-4",children:["last ",e.recent.length," runs · newest right"]})]})]})}function mM({label:e,name:t,value:s,dot:i,icon:n,active:r,onClick:o}){return Ss.jsxs("button",{type:"button",onClick:o,"aria-label":t,"aria-pressed":r,className:ay("px-4 py-3 text-left",r?"bg-selection/40":"bg-canvas hover:bg-raised/50"),children:[Ss.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:[i&&Ss.jsx(iN,{status:i,pulse:!1}),n&&Ss.jsx(cy,{name:n,className:"h-3 w-3"}),Ss.jsx("span",{children:e})]}),Ss.jsx("div",{className:"mt-1 font-mono text-[22px] font-medium tabular-nums text-fg-2",children:s})]})}class _M extends ps.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[viewer] ${this.props.label} failed to render`,e,t.componentStack)}componentDidUpdate(e){this.state.error&&e.resetKey!==this.props.resetKey&&this.setState({error:null})}render(){return this.state.error?Ss.jsxs("div",{className:"m-4 rounded border border-fail/30 bg-fail/5 px-3 py-2 font-mono text-[12px]","data-testid":"error-boundary",children:[Ss.jsxs("div",{className:"text-fail",children:[this.props.label," could not be shown"]}),Ss.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-words text-fg-2",children:this.state.error.message})]}):this.props.children}}const xM="unotest.viewer.";function bM(e,t){var s;try{const i=null==(s=globalThis.localStorage)?void 0:s.getItem(xM+e);return null==i?t:JSON.parse(i)}catch{return t}}function yM(e,t){return t?`${e}.${t}`:e}function wM(e,t){var s;try{null==(s=globalThis.localStorage)||s.setItem(xM+e,JSON.stringify(t))}catch{}}const SM="annotations";class kM{constructor(){this.storageKey=SM;const e=bM(SM,{});this.open="object"!=typeof e||null===e||Array.isArray(e)?{}:{...e},Fr(this,{storageKey:!1},{autoBind:!0})}isOpen(e){return this.open[e]}toggle(e,t){this.open={...this.open,[e]:!t}}toPersisted(){return{...this.open}}}function CM(e,t){return`${e}#${t}`}function jM(e){const t=[],s=e=>{for(const i of e)"step"===i.kind?t.push(i):"control"===i.kind?(t.push(i),s(i.children),i.elseChildren&&s(i.elseChildren)):s(i.children)};return s(e),t}function NM({annotations:e,depth:t,indentPx:s}){return Ss.jsx("div",{className:"border-l-2 border-edge-soft bg-raised/30 py-1 pr-4 font-mono text-[11.5px] leading-[1.5]",style:{marginLeft:s+14*Math.min(t,1),paddingLeft:10},"data-testid":"step-annotations",children:e.map((e,t)=>Ss.jsx(MM,{annotation:e},t))})}function MM({annotation:e}){return"note"===e.kind?Ss.jsxs("div",{className:"flex gap-2",children:[Ss.jsx("span",{className:"shrink-0 text-fg-3",children:e.label}),Ss.jsx("span",{className:"text-fg-4",children:"→"}),Ss.jsxs("span",{className:"min-w-0 whitespace-pre-wrap break-words text-fg",children:[e.text,e.truncated&&Ss.jsx("span",{className:"text-fg-4",children:" … (truncated)"})]})]}):"log"===e.kind?Ss.jsxs("div",{className:"flex gap-2",children:[Ss.jsx("span",{className:"shrink-0 text-fg-4",children:"log"}),Ss.jsxs("span",{className:"min-w-0 whitespace-pre-wrap break-words text-fg-2",children:[e.text,e.truncated&&Ss.jsx("span",{className:"text-fg-4",children:" … (truncated)"})]})]}):Ss.jsxs("div",{className:"flex gap-2","data-testid":"judge-verdict",children:[Ss.jsxs(eN,{tone:"pass"===e.verdict?"pass":"fail",size:"xs",children:["judge ","pass"===e.verdict?"✓":"✗"]}),Ss.jsx("span",{className:ay("min-w-0 truncate","fail"===e.verdict?"text-fail":"text-fg-2"),children:e.rubric}),Ss.jsx("span",{className:"text-fg-4",children:"·"}),Ss.jsx("span",{className:"min-w-0 truncate text-fg",title:e.reasoning,children:e.text})]})}function BM({status:e}){return"passed"===e?Ss.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full bg-pass/10 text-pass",children:Ss.jsx(cy,{name:"check",className:"h-3 w-3",strokeWidth:2.5})}):"failed"===e?Ss.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full bg-fail/10 text-fail",children:Ss.jsx(cy,{name:"x",className:"h-3 w-3",strokeWidth:2.5})}):"running"===e?Ss.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full bg-warn/10 text-warn",children:Ss.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current uno-pulse"})}):"aborted"===e?Ss.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full bg-fg-4/10 text-fg-4",children:Ss.jsx(cy,{name:"square",className:"h-3 w-3",strokeWidth:2.5})}):"paused"===e?Ss.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full bg-warn/10 text-warn",children:Ss.jsx(cy,{name:"pause",className:"h-2.5 w-2.5",strokeWidth:2.5})}):Ss.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center text-fg-4",children:Ss.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current"})})}const LM=22;function DM(e){return Ss.jsxs("div",{className:"min-h-full bg-canvas py-1",children:[Ss.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:[Ss.jsx("span",{className:"w-6 text-right",children:"#"}),Ss.jsx("span",{className:"w-4"}),Ss.jsx("span",{className:"flex-1",children:"step"}),Ss.jsx("span",{className:"w-12 text-right",children:"time"})]}),Ss.jsx("div",{className:"border-t border-edge-soft",children:e.body.map((t,s)=>Ss.jsx(EM,{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,blocks:e.blocks,annotations:e.annotations,annotationsOpen:e.annotationsOpen,onToggleAnnotations:e.onToggleAnnotations},s))})]})}function EM(e){return"step"===e.node.kind?Ss.jsx(PM,{...e,node:e.node}):"control"===e.node.kind?Ss.jsx(RM,{...e,node:e.node}):Ss.jsx(zM,{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,blocks:e.blocks,annotations:e.annotations,annotationsOpen:e.annotationsOpen,onToggleAnnotations:e.onToggleAnnotations})}function PM(e){var t,s,i,n;const r=e.node,o=null==(t=e.trace)?void 0:t[r.index],a=e.failedIndex===r.index,l=(null==(s=e.annotations)?void 0:s.get(r.index))??[],c=l.some(e=>"judge"===e.kind&&"fail"===e.verdict),h=a||c,[u,d]=ps.useState(h),f=(null==(i=e.annotationsOpen)?void 0:i.call(e,r.index))??(e.onToggleAnnotations?h:u);return Ss.jsxs(Ss.Fragment,{children:[Ss.jsx(TM,{step:r,depth:e.depth,status:(null==o?void 0:o.status)??(e.trace?"pending":void 0),durationMs:(null==o?void 0:o.durationMs)??null,isFailed:a,isPaused:e.pausedIndex===r.index,bpKeys:e.bpKeys,onToggleBp:e.onToggleBp,screenshotUrl:null==(n=e.screenshots)?void 0:n.get(r.index),onOpenScreenshot:e.onOpenScreenshot,isScreenshotActive:e.activeScreenshotIndex===r.index,annotationCount:l.length,annotationsOpen:f,onToggleAnnotations:()=>{e.onToggleAnnotations?e.onToggleAnnotations(r.index,f):d(e=>!e)}}),f&&l.length>0&&Ss.jsx(NM,{annotations:l,depth:e.depth,indentPx:34+14*e.depth}),a&&e.onFailedStepRender&&e.onFailedStepRender(r)]})}function RM({node:e,depth:t,trace:s,failedIndex:i,pausedIndex:n,onFailedStepRender:r,bpKeys:o,onToggleBp:a,screenshots:l,onOpenScreenshot:c,activeScreenshotIndex:h,blocks:u,annotations:d,annotationsOpen:f,onToggleAnnotations:p}){const v=null==s?void 0:s[e.index],g=e=>e.map((e,v)=>Ss.jsx(EM,{node:e,depth:t+1,trace:s,failedIndex:i,pausedIndex:n,onFailedStepRender:r,bpKeys:o,onToggleBp:a,screenshots:l,onOpenScreenshot:c,activeScreenshotIndex:h,blocks:u,annotations:d,annotationsOpen:f,onToggleAnnotations:p},v));return Ss.jsxs(Ss.Fragment,{children:[Ss.jsx(TM,{step:e,depth:t,status:(null==v?void 0:v.status)??(s?"pending":void 0),durationMs:(null==v?void 0:v.durationMs)??null,isFailed:i===e.index,isPaused:n===e.index,bpKeys:o,onToggleBp:a,screenshotUrl:null==l?void 0:l.get(e.index),onOpenScreenshot:c,isScreenshotActive:h===e.index}),i===e.index&&r&&r(e),g(e.children),e.elseChildren&&Ss.jsxs(Ss.Fragment,{children:[Ss.jsx(AM,{depth:t}),g(e.elseChildren)]})]})}function AM({depth:e}){return Ss.jsx("div",{className:"flex items-center py-1 font-mono text-[11px] italic text-fg-4",style:{paddingLeft:34+14*e},children:"else"})}function zM({block:e,depth:t,trace:s,failedIndex:i,pausedIndex:n,onFailedStepRender:r,bpKeys:o,onToggleBp:a,screenshots:l,onOpenScreenshot:c,activeScreenshotIndex:h,blocks:u,annotations:d,annotationsOpen:f,onToggleAnnotations:p}){const v=null==u?void 0:u.get(`${e.line}:${e.col}`),g=function(e,t){var s;if(!t)return"never";let i=!1,n=!1,r=!1,o=!1,a=!1;for(const l of jM(e)){const e=(null==(s=t[l.index])?void 0:s.status)??"pending";"failed"===e?i=!0:"running"===e?n=!0:"passed"===e?r=!0:"aborted"===e?a=!0:o=!0}return i?"failed":n?"running":a?"aborted":o&&r?"running":o?"pending":"passed"}(e.children,s),m="failed"!==(null==v?void 0:v.status)||"passed"!==g&&"pending"!==g?g:"failed",_=(null==v?void 0:v.durationMs)??function(e,t){var s;if(!t)return null;let i=0,n=!1;for(const r of jM(e)){const e=null==(s=t[r.index])?void 0:s.durationMs;null!=e&&(i+=e,n=!0)}return n?i:null}(e.children,s),x=(null==v?void 0:v.tag)??e.tagSource,b=!!s&&("failed"===m||"running"===m||"paused"===m),[y,w]=ps.useState(b),S=34+14*t;return Ss.jsxs(Ss.Fragment,{children:[Ss.jsxs("button",{type:"button",onClick:()=>w(e=>!e),className:ay("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"===m&&"bg-fail/5",("running"===m||"paused"===m)&&"bg-warn/5","failed"!==m&&"running"!==m&&"paused"!==m&&"hover:bg-raised/60"),style:{paddingLeft:S},children:[Ss.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 left-0 border-r border-edge-soft",style:{width:LM}}),Ss.jsx(IM,{depth:t,offset:LM}),Ss.jsx(cy,{name:y?"chevronD":"chevronR",className:"h-3.5 w-3.5 shrink-0 text-fg-4",strokeWidth:2}),Ss.jsx("span",{className:"w-4 shrink-0",children:s?Ss.jsx(BM,{status:m}):Ss.jsx("span",{className:"block h-1.5 w-1.5 rounded-full bg-fg-4"})}),Ss.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[Ss.jsx("span",{className:"truncate text-fg",children:e.title}),void 0!==x&&Ss.jsx(eN,{tone:"neutral",size:"xs",children:x}),e.soft&&Ss.jsx(eN,{tone:"failed"===m?"fail":"neutral",size:"xs",children:"soft"}),v&&v.softFailed>0&&Ss.jsxs("span",{className:"shrink-0 whitespace-nowrap text-[10.5px] tabular-nums text-fail","data-testid":"soft-rollup",children:[v.softFailed," of ",v.softTotal," soft failed"]})]}),Ss.jsx("span",{className:"w-12 shrink-0 text-right text-[11px] tabular-nums text-fg-2",children:nN(_)})]}),y&&e.children.map((e,v)=>Ss.jsx(EM,{node:e,depth:t+1,trace:s,failedIndex:i,pausedIndex:n,onFailedStepRender:r,bpKeys:o,onToggleBp:a,screenshots:l,onOpenScreenshot:c,activeScreenshotIndex:h,blocks:u,annotations:d,annotationsOpen:f,onToggleAnnotations:p},v))]})}function TM({step:e,depth:t,status:s,durationMs:i,isFailed:n,isPaused:r,bpKeys:o,onToggleBp:a,screenshotUrl:l,onOpenScreenshot:c,isScreenshotActive:h,annotationCount:u=0,annotationsOpen:d=!1,onToggleAnnotations:f,trailing:p}){const v="running"===s,g=34+14*t,m=`${e.line}:${e.col}`,_=!!(null==o?void 0:o.has(m)),x=!!a,b=ps.useRef(null);ps.useEffect(()=>{var e,t;h&&(null==(t=null==(e=b.current)?void 0:e.scrollIntoView)||t.call(e,{block:"nearest"}))},[h]);const y=!!l&&!!c;return Ss.jsx(Ss.Fragment,{children:Ss.jsxs("div",{ref:b,onClick:y?()=>c(e.index):void 0,className:ay("group relative flex items-center gap-3 py-1.5 pr-4 font-mono text-[12.5px] leading-[1.4]",y&&"cursor-pointer",h&&"bg-accent/10",v&&"bg-warn/10",r&&"bg-warn/15",n&&"bg-fail/10",!v&&!n&&!r&&"hover:bg-raised/60"),style:{paddingLeft:g},children:[Ss.jsx(IM,{depth:t,offset:LM}),Ss.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 left-0 border-r border-edge-soft",style:{width:LM}}),Ss.jsxs("button",{type:"button","aria-label":_?"Remove breakpoint":"Add breakpoint",disabled:!x,onClick:t=>{t.stopPropagation(),x&&a(e.line,e.col)},className:"absolute inset-y-0 left-0 grid place-items-center disabled:cursor-default",style:{width:LM},children:[r&&Ss.jsx(cy,{name:"arrowR",className:"absolute h-3 w-3 text-warn"}),_?Ss.jsx(cy,{name:"bp",className:ay("h-2.5 w-2.5",r?"text-fail/80":"text-fail")}):x&&!r&&Ss.jsx("span",{className:"hidden h-2.5 w-2.5 rounded-full ring-1 ring-fg-4 group-hover:block"})]}),Ss.jsx("span",{className:ay("absolute inset-y-0 w-[2px]",r||v?"bg-warn":n?"bg-fail":"bg-transparent"),style:{left:LM}}),Ss.jsxs("span",{className:"w-6 shrink-0 text-right text-[10.5px] tabular-nums text-fg-4",children:["#",e.index]}),Ss.jsx("span",{className:"w-4 shrink-0",children:s?Ss.jsx(BM,{status:s}):Ss.jsx("span",{className:"block h-1.5 w-1.5 rounded-full bg-fg-4"})}),Ss.jsxs("span",{className:"flex min-w-0 flex-1 items-baseline gap-2 overflow-hidden",children:[Ss.jsx("span",{className:"truncate",children:MN(e.source)}),Ss.jsxs("span",{className:"hidden shrink-0 text-[10.5px] tabular-nums text-fg-4 md:inline",children:["L",e.line]})]}),u>0&&Ss.jsxs("button",{type:"button","data-testid":"annotations-chip",title:d?"Hide notes":"Show notes",onClick:e=>{e.stopPropagation(),null==f||f()},className:ay("shrink-0 rounded border px-1 text-[10px] tabular-nums",d?"border-accent/40 bg-accent/10 text-accent":"border-edge-soft bg-raised text-fg-3 group-hover:text-fg-2"),children:["ⓘ ",u]}),p,l&&Ss.jsx(cy,{name:"camera",className:ay("h-3.5 w-3.5 shrink-0",h?"text-accent":"text-fg-4 group-hover:text-fg-2")}),Ss.jsx("span",{className:"w-12 shrink-0 text-right text-[11px] tabular-nums text-fg-2",children:nN(i)})]})})}function IM({depth:e,offset:t=0}){return 0===e?null:Ss.jsx(Ss.Fragment,{children:Array.from({length:e}).map((e,s)=>Ss.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 w-px bg-edge-soft",style:{left:t+18+14*s}},s))})}const OM=m_(function({store:e,scope:t,...s}){const i=e.open;return Ss.jsx(DM,{...s,annotationsOpen:e=>i[CM(t,e)],onToggleAnnotations:(s,i)=>e.toggle(CM(t,s),i)})});function HM(e,t){for(let s=e.length-1;s>=0;s--){const i=e[s],n=HM(i.children,t);if(n)return n;if("statement"===i.kind&&i.file===t.file&&i.line===t.line&&i.col===t.col)return i}return null}function FM(e,t,s){const i=null==e?void 0:e.files[t];return void 0===i?"":(i.split(/\r?\n/)[s-1]??"").trim()}function WM(e){for(let t=e.length-1;t>=0;t--){const s=e[t],i=WM(s.children);if(i)return i;if("statement"===s.kind&&"running"!==s.status)return s}return null}function KM(e){for(const t of e){if("failed"!==t.status)continue;const e=KM(t.children);if(e)return e;if("statement"===t.kind)return t}return null}function UM(e){return Ss.jsxs("div",{className:"min-h-full bg-canvas py-1",children:[Ss.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:[Ss.jsx("span",{className:"w-6 text-right",children:"#"}),Ss.jsx("span",{className:"w-4"}),Ss.jsx("span",{className:"flex-1",children:"trace"}),Ss.jsx("span",{className:"w-12 text-right",children:"time"})]}),Ss.jsx("div",{className:"border-t border-edge-soft",children:e.nodes.map(t=>Ss.jsx(qM,{node:t,depth:0,...e},t.id))})]})}function qM({node:e,depth:t,...s}){return"statement"===e.kind?Ss.jsx(VM,{node:e,depth:t,...s}):Ss.jsx($M,{node:e,depth:t,...s})}function VM({node:e,depth:t,...s}){var i;const n=function(e){return"statement"===e.kind&&e.children.some(t=>"iteration"!==t.kind&&t.file!==e.file)}(e),[r,o]=ps.useState("failed"===e.status||"running"===e.status),[a,l]=ps.useState("failed"===e.status||e.annotations.some(e=>"judge"===e.kind&&"fail"===e.verdict)),c=34+14*t,h={index:e.id,line:e.line,col:e.col,source:e.source||`${e.file}:${e.line}`};return Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("div",{className:"group","data-testid":"trace-statement",onDoubleClick:s.onOpenCode?()=>s.onOpenCode(e.file,e.line):void 0,title:s.onOpenCode?`${e.file}:${e.line} — double-click to open in Code`:void 0,children:Ss.jsx(TM,{step:h,depth:t,status:e.status,durationMs:e.durationMs,isFailed:s.failedId===e.id,screenshotUrl:null==(i=s.screenshots)?void 0:i.get(e.id),onOpenScreenshot:s.onOpenScreenshot,isScreenshotActive:s.activeScreenshotId===e.id,annotationCount:e.annotations.length,annotationsOpen:a,onToggleAnnotations:()=>l(e=>!e),trailing:Ss.jsxs(Ss.Fragment,{children:[n?Ss.jsxs("button",{type:"button","data-testid":"trace-fold",onClick:e=>{e.stopPropagation(),o(e=>!e)},className:"flex shrink-0 items-center gap-1 whitespace-nowrap rounded border border-edge-soft bg-raised px-1 font-mono text-[10px] text-fg-3 hover:text-fg",children:[Ss.jsx(cy,{name:r?"chevronD":"chevronR",className:"h-3 w-3"}),Ss.jsx(YM,{node:e})]}):e.children.length>0&&Ss.jsx(YM,{node:e}),!e.isEntry&&Ss.jsx("span",{className:"max-w-[10rem] shrink-0 truncate font-mono text-[9.5px] text-fg-4","data-testid":"trace-file",children:GM(e.file)})]})})}),a&&e.annotations.length>0&&Ss.jsx(NM,{annotations:e.annotations,depth:t,indentPx:c}),s.failedId===e.id&&s.onFailedRender&&s.onFailedRender(e),n&&r&&e.children.map(e=>Ss.jsx(qM,{node:e,depth:t+1,...s},e.id)),!n&&e.children.map(e=>Ss.jsx(qM,{node:e,depth:t+1,...s},e.id))]})}function $M({node:e,depth:t,...s}){const[i,n]=ps.useState("block"===e.kind||"failed"===e.status||"running"===e.status),r=34+14*t,o="block"===e.kind?e.label:`iteration ${e.index+1}`;return Ss.jsxs(Ss.Fragment,{children:[Ss.jsxs("button",{type:"button",onClick:()=>n(e=>!e),"data-testid":"block"===e.kind?"trace-block":"trace-iteration",className:ay("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"===e.status&&"bg-fail/5","running"===e.status&&"bg-warn/5","failed"!==e.status&&"running"!==e.status&&"hover:bg-raised/60"),style:{paddingLeft:r},children:[Ss.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 left-0 border-r border-edge-soft",style:{width:LM}}),Ss.jsx(IM,{depth:t,offset:LM}),Ss.jsx(cy,{name:i?"chevronD":"chevronR",className:"h-3.5 w-3.5 shrink-0 text-fg-4",strokeWidth:2}),Ss.jsx("span",{className:"w-4 shrink-0",children:Ss.jsx(BM,{status:e.status})}),Ss.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[Ss.jsx("span",{className:ay("truncate","iteration"===e.kind?"text-fg-2":"text-fg"),children:o}),"block"===e.kind&&void 0!==e.tag&&Ss.jsx(eN,{tone:"neutral",size:"xs",children:e.tag}),"block"===e.kind&&e.soft&&Ss.jsx(eN,{tone:"failed"===e.status?"fail":"neutral",size:"xs",children:"soft"}),!i&&Ss.jsx(YM,{node:e})]}),Ss.jsx("span",{className:"w-12 shrink-0 text-right text-[11px] tabular-nums text-fg-2",children:nN(e.durationMs)})]}),i&&e.children.map(e=>Ss.jsx(qM,{node:e,depth:t+1,...s},e.id))]})}function YM({node:e}){const{total:t,failed:s,unit:i}=function(e){const t=e.children.filter(e=>"iteration"===e.kind);if(t.length>0)return{total:t.length,failed:t.filter(e=>"failed"===e.status).length,unit:"iteration"};const s=e.children.filter(e=>"block"===e.kind),i=s.length>0?s:e.children;return{total:i.length,failed:i.filter(e=>"failed"===e.status).length,unit:s.length>0?"step":"statement"}}(e);return 0===t?null:Ss.jsxs("span",{className:ay("shrink-0 whitespace-nowrap text-[10.5px] tabular-nums",s>0?"text-fail":"text-fg-3"),"data-testid":"trace-summary",children:[t," ",i,1===t?"":"s",s>0?` · ${s} failed`:""]})}function GM(e){return e.split("/").slice(-2).join("/")}function XM({strip:e,position:t,onNavigate:s,onClose:i}){const n=e[t],r=t>0,o=t<e.length-1;return ps.useEffect(()=>{const e=e=>{if("Escape"===e.key)i();else if("ArrowLeft"===e.key&&r)s(t-1);else{if("ArrowRight"!==e.key||!o)return;s(t+1)}e.preventDefault()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[i,s,t,r,o]),n?Ss.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:i,children:[Ss.jsxs("div",{className:"flex shrink-0 items-center justify-between px-4 py-3",children:[Ss.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]}),Ss.jsx("button",{type:"button","aria-label":"Close",onMouseDown:e=>e.stopPropagation(),onClick:i,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:Ss.jsx(cy,{name:"x",className:"h-4 w-4"})})]}),Ss.jsxs("div",{className:"flex min-h-0 flex-1 items-center gap-3 px-3 sm:gap-5 sm:px-5",children:[Ss.jsx(ZM,{direction:"prev",disabled:!r,onClick:()=>s(t-1)}),Ss.jsxs("figure",{className:"flex min-h-0 flex-1 flex-col items-center gap-4",onMouseDown:e=>e.stopPropagation(),children:[Ss.jsx("img",{src:n.url,alt:`step #${n.stepIndex} screenshot`,className:"min-h-0 max-w-full flex-1 rounded-lg object-contain shadow-2xl ring-1 ring-white/25"}),Ss.jsxs("figcaption",{className:"w-full max-w-3xl shrink-0 rounded-lg bg-black/65 px-4 py-2 text-center",children:[n.blockTitle&&Ss.jsx("div",{className:"truncate text-[13px] font-medium text-white",children:n.blockTitle}),Ss.jsxs("div",{className:"mt-1 flex items-baseline justify-center gap-2 font-mono text-[12px] text-white/80",children:[Ss.jsx("span",{className:"truncate",children:n.source}),Ss.jsxs("span",{className:"shrink-0 text-[10.5px] tabular-nums text-white/55",children:["L",n.line]})]})]})]}),Ss.jsx(ZM,{direction:"next",disabled:!o,onClick:()=>s(t+1)})]}),Ss.jsx("div",{className:"shrink-0 pb-4 pt-3 text-center",children:Ss.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 ZM({direction:e,disabled:t,onClick:s}){return Ss.jsx("button",{type:"button","aria-label":"prev"===e?"Previous screenshot":"Next screenshot",disabled:t,onMouseDown:e=>e.stopPropagation(),onClick:s,className:ay("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:Ss.jsx(cy,{name:"chevronR",className:ay("h-5 w-5","prev"===e&&"rotate-180"),strokeWidth:2})})}async function JM(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 s=document.getSelection(),i=s&&s.rangeCount>0?s.getRangeAt(0):null;t.select();let n=!1;try{n=document.execCommand("copy")}catch{n=!1}document.body.removeChild(t),i&&s&&(s.removeAllRanges(),s.addRange(i));return n}(e)}function QM(e){const[t,s]=ps.useState("idle"),i=ps.useRef(void 0);ps.useEffect(()=>()=>clearTimeout(i.current),[]);return Ss.jsxs("div",{className:"mx-4 my-2 overflow-hidden rounded border border-fail/30 bg-fail/10",children:[Ss.jsxs("div",{className:"border-b border-fail/30 px-3 py-1.5",children:[Ss.jsxs("div",{className:"flex items-center gap-2",children:[Ss.jsx(cy,{name:"alert",className:"h-3.5 w-3.5 text-fail"}),Ss.jsx(eN,{tone:"fail",children:e.errorName.toUpperCase()}),Ss.jsxs("span",{className:"ml-auto font-mono text-[10.5px] text-fg-2",children:["step #",e.index]})]}),e.url&&Ss.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&&JM(t).then(e=>{s(e?"ok":"fail"),clearTimeout(i.current),i.current=setTimeout(()=>s("idle"),1600)})},children:[Ss.jsx(cy,{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"}),Ss.jsx("span",{className:"truncate",children:e.url}),"idle"!==t&&Ss.jsx("span",{className:"ok"===t?"shrink-0 text-pass no-underline":"shrink-0 text-fail no-underline",children:"ok"===t?"Copied!":"Copy failed"})]})]}),Ss.jsxs("div",{className:"px-3 py-2",children:[Ss.jsx("pre",{className:"whitespace-pre-wrap break-words font-mono text-[12px] leading-relaxed text-fg",children:e.message}),e.verdict&&Ss.jsxs("dl",{className:"mt-2 grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 font-mono text-[11.5px]","data-testid":"error-verdict",children:[Ss.jsx("dt",{className:"text-fg-3",children:"rubric"}),Ss.jsx("dd",{className:"whitespace-pre-wrap break-words text-fg",children:e.verdict.rubric}),Ss.jsx("dt",{className:"text-fg-3",children:"text"}),Ss.jsx("dd",{className:"whitespace-pre-wrap break-words text-fg",children:e.verdict.text}),Ss.jsx("dt",{className:"text-fg-3",children:"judge"}),Ss.jsx("dd",{className:"whitespace-pre-wrap break-words text-fail",children:e.verdict.reasoning}),Ss.jsx("dt",{className:"text-fg-3",children:"model"}),Ss.jsx("dd",{className:"text-fg-2",children:e.verdict.model})]}),Ss.jsxs("div",{className:"mt-2 flex items-center gap-2 truncate font-mono text-[11px] text-fg-2",children:[Ss.jsx(cy,{name:"file",className:"h-3.5 w-3.5"}),Ss.jsxs("span",{children:[e.file,":",e.line]}),Ss.jsx("span",{className:"text-fg-4",children:"·"}),Ss.jsx("span",{className:"truncate",children:e.source})]})]})]})}const eB=/\x1b\[[\d;]*[a-zA-Z]/g;class tB{constructor(e){this.rest=e,this.byRunId=new Map,this.collectionByRunId=new Map,Fr(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)}}async hydrateRunning(){let e;try{e=await this.rest.runsRunning()}catch{return}await Promise.all(e.map(e=>this.hydrateRun(e)))}isHydrated(e){if("collection"===e.kind){const t=this.collectionByRunId.get(e.runId);return void 0!==t&&""!==t.collection}const t=this.byRunId.get(e.runId);return void 0!==t&&""!==t.scenario}async hydrateRun(e){if(this.isHydrated(e))return;let t;try{t=await this.rest.runDetail(e.runId)}catch{return}cr(()=>{var s,i;if(this.isHydrated(e))return;const n=t.events,r=e=>n.some(t=>t.kind===e.kind&&t.t===e.t);if(function(e){return"collection"===e.meta.kind}(t)){const i=(null==(s=this.collectionByRunId.get(e.runId))?void 0:s.events)??[];this.collectionByRunId.delete(e.runId);for(const s of t.events)this.applyCollectionStep(e.runId,s);for(const t of i)r(t)||this.applyCollectionStep(e.runId,t);this.ensureCollection(e.runId,t.meta.ref).startedAt=e.startedAt}else{const s=(null==(i=this.byRunId.get(e.runId))?void 0:i.events)??[];this.byRunId.delete(e.runId);for(const i of t.events)this.applyStep(e.runId,i);for(const t of s)r(t)||this.applyStep(e.runId,t);this.ensure(e.runId,t.meta.ref).startedAt=e.startedAt}})}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,s){const i=(r=s,r.replace(eB,"")),n=Date.now();var r;if(""===i.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,i),a=e.logs[e.logs.length-1];if(a&&a.stream===t&&a.level===o&&n-a.receivedAt<100)return a.text+="\n"+i,void(a.receivedAt=n);e.logs.push({stream:t,level:o,text:i,at:sB(n),receivedAt:n})}(this.ensure(e.runId,""),e.stream,e.line);default:return}}async startScenario(e,t={}){const s=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}:{}}),i=this.ensure(s.runId,s.ref);return i.status="queued"===s.status?"queued":"starting",i.plainRun=!t.debug,{runId:s.runId,scenario:s.ref}}async startAuthoring(e){const t=await this.rest.startRun({kind:"authoring",scenario:e,headed:!0}),s=this.ensure(t.runId,t.ref);return s.status="queued"===t.status?"queued":"starting",s.mode="authoring",{runId:t.runId,scenario:t.ref}}async startCollection(e,t={}){const s=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(s.runId,s.ref).status="queued"===s.status?"queued":"starting",{runId:s.runId,collection:s.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 s=this.byRunId.get(e);(null==s?void 0:s.picker.active)&&s.picker.mode===t?await this.stopPicker(e):await this.startPicker(e,t)}async startPicker(e,t){const s=this.byRunId.get(e),i=(null==s?void 0:s.picker.execute)??!1;s&&(s.picker={active:!0,mode:t,execute:i}),await this.rest.dbgCommand(e,{cmd:"picker:start",mode:t,execute:i})}async setPickerExecute(e,t){const s=this.byRunId.get(e);s&&(s.picker={...s.picker,execute:t},s.picker.active&&await this.rest.dbgCommand(e,{cmd:"picker:start",mode:s.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 s=this.byRunId.get(e);s&&(s.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 s=this.byRunId.get(e);if(!s)return;const i=crypto.randomUUID();s.consoleEntries.push({id:i,at:sB(Date.now()),input:t,status:"pending"}),setTimeout(()=>this.markProbeStale(e,i),1e4);try{await this.rest.dbgCommand(e,{cmd:"probe",locator:t,id:i})}catch{this.markProbeStale(e,i)}}markProbeStale(e,t){var s;const i=null==(s=this.byRunId.get(e))?void 0:s.consoleEntries.find(e=>e.id===t);i&&"pending"===i.status&&(i.status="stale")}async setBreakpoint(e,t,s){await this.rest.dbgCommand(e,{cmd:"set-bp",line:t,col:s})}async clearBreakpoint(e,t,s){await this.rest.dbgCommand(e,{cmd:"clear-bp",line:t,col:s})}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}cr(()=>{var s;const i=this.ensure(e,t.scenario);if(i.vars=t.vars,i.callStack=t.callStack,i.wheel=t.wheel??"human",i.mode=t.mode??"debug",i.breakpoints=t.breakpoints??[],"completed"===(n=i.status)||"failed"===n||"aborted"===n)return;var n;const r=t.state;"paused-step"!==r&&"paused-failure"!==r&&"paused-breakpoint"!==r||(i.status="paused",t.current&&(i.pausedAt={reason:"paused-breakpoint"===r?"breakpoint":"paused-failure"===r?"failure":"step",file:(null==(s=t.callStack.at(-1))?void 0:s.file)??null,line:t.current.line,col:t.current.col}))})}ensureCollection(e,t){let s=this.collectionByRunId.get(e);if(s)t&&!s.collection&&(s.collection=t);else{this.byRunId.delete(e);const i={runId:e,collection:t,startedAt:Date.now(),status:"starting",scenarios:[],childRunIds:new Map,childOutcomes:new Map,outcome:null,events:[]};this.collectionByRunId.set(e,i),s=this.collectionByRunId.get(e)}return s}ensure(e,t){let s=this.byRunId.get(e);if(s)t&&!s.scenario&&(s.scenario=t);else{const i={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,i),s=this.byRunId.get(e)}return s}applyStep(e,t){const s=this.ensure(e,"");if("locator:picked"!==t.kind)if("wheel:changed"!==t.kind){if("probe:result"===t.kind){const e=s.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=s.toolCalls.find(e=>e.callId===t.callId),i={status:t.ok?"ok":"error",durationMs:t.durationMs,preview:t.preview,...t.error?{error:t.error}:{}};return void(e?Object.assign(e,i):s.toolCalls.push({callId:t.callId,at:sB(t.t),tool:t.tool,args:"",...i}))}s.events.push(t),"run:started"===t.kind?(s.status="running",t.scenario&&(s.scenario=t.scenario)):"run:finished"===t.kind?(s.status=this.statusFromOutcome(t.outcome),s.outcome=t.outcome,s.pausedAt=null,s.picker={active:!1,mode:s.picker.mode,execute:s.picker.execute}):"paused"===t.kind?(s.status="paused",s.pausedAt={reason:t.reason,file:t.file,line:t.line,col:t.col},t.snapshot&&(s.vars=t.snapshot.vars,s.callStack=t.snapshot.callStack)):"resumed"!==t.kind&&"step:started"!==t.kind||("paused"===s.status&&(s.status="running"),s.pausedAt=null)}else s.toolCalls.push({callId:t.callId,at:sB(t.t),tool:t.tool,args:t.args,status:"running"})}else s.wheel=t.owner}applyCollectionStep(e,t){cr(()=>{const s=this.ensureCollection(e,"");switch(s.events.push(t),t.kind){case"collection-run:started":return s.status="running",s.collection=t.collection,void(s.scenarios=[...t.scenarios]);case"collection-run:scenario-started":return void s.childRunIds.set(t.scenario,t.scenarioRunId);case"collection-run:scenario-finished":return void s.childOutcomes.set(t.scenario,t.outcome);case"collection-run:finished":return s.status=this.statusFromOutcome(t.outcome),void(s.outcome=t.outcome)}})}applyFinished(e,t){const s=this.collectionByRunId.get(e);if(s)return s.status=this.statusFromOutcome(t),void(s.outcome=t);const i=this.byRunId.get(e);i&&(i.status=this.statusFromOutcome(t),i.outcome=t)}statusFromOutcome(e){switch(e){case"completed":return"completed";case"failed":return"failed";case"aborted":case"interrupted":return"aborted"}}}function sB(e){return new Date(e).toISOString().slice(11,23)}function iB(e,t){for(let s=e.length-1;s>=0;s--){const i=e[s];if(i.kind===t)return i}return null}class nB{constructor(e){this.runId=e}url(e){const[t,s]="event"===e.kind?["path",e.path]:["file",e.file];return`/api/runs/${encodeURIComponent(this.runId)}/asset?${t}=${encodeURIComponent(s)}`}resolveUrl(e){return this.url(e)}async loadText(e){return rB(this.url(e))}}async function rB(e){try{const t=await fetch(e);return t.ok?{ok:!0,text:await t.text()}:{ok:!1}}catch{return{ok:!1}}}class oB{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 rB(this.url(e))}}const aB=ps.createContext(null);function lB(e){const t=ps.useContext(aB);return ps.useMemo(()=>t??new nB(e),[t,e])}function cB({children:e}){return Ss.jsx("div",{className:"px-3 py-6 text-center font-mono text-[11.5px] text-fg-4",children:e})}const hB=[{id:"screenshot",label:"Screenshot",icon:"camera"},{id:"dom",label:"Semantic DOM",icon:"tree"}],uB=m_(function({runId:e,active:t,events:s,isFailed:i,runFinished:n,varsOverride:r,fill:o=!1}){const a=y_(),l=iB(s,"failure-bundle:written"),c=null!=t&&("paused"===t.status||"running"===t.status||"starting"===t.status);ps.useEffect(()=>{c||r||a.runtimeSnapshots.loadIfNeeded(e)},[a,e,c,r]);const h=a.runtimeSnapshots.get(e),u=r??(c&&t?t.vars:(null==h?void 0:h.vars)??(null==t?void 0:t.vars)??{}),d=Object.keys(u).length>0,f=ps.useMemo(()=>{const e=[];if((null!=t||d)&&e.push({id:"vars",label:"Vars",icon:"variable"}),i?e.push(...hB):(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:"Events",icon:"code"}),!i&&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,i,t,null==t?void 0:t.callStack,a.breakpoints]),[p,v]=ps.useState(f[0].id);ps.useEffect(()=>{f.some(e=>e.id===p)||v(f[0].id)},[f,p]);const g=a.layout,m=Sy({value:g.inspectorWidth,onChange:g.setInspectorWidth,axis:"x",dir:-1,min:g.inspectorMin,max:()=>Math.round(.6*window.innerWidth)}),_=Ss.jsxs(Ss.Fragment,{children:[Ss.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 Ss.jsxs("button",{type:"button",onClick:()=>v(e.id),className:ay("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:[Ss.jsx(cy,{name:e.icon,className:"h-3.5 w-3.5"}),e.label,null!=e.count&&e.count>0&&Ss.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&&Ss.jsx("span",{className:"absolute inset-x-1.5 bottom-0 h-0.5 rounded-full bg-accent"})]},e.id)})}),Ss.jsxs("div",{className:"flex-1 overflow-y-auto bg-canvas",children:["vars"===p&&Ss.jsx(dB,{vars:u}),"callstack"===p&&t&&Ss.jsx(fB,{frames:t.callStack}),"breakpoints"===p&&Ss.jsx(pB,{}),"screenshot"===p&&Ss.jsx(_B,{runId:e,bundle:l}),"system"===p&&Ss.jsx(SB,{active:t,events:s}),"console"===p&&Ss.jsx(MB,{runId:e,runFinished:n}),"snapshot"===p&&Ss.jsx(DB,{runId:e}),"dom"===p&&Ss.jsx(LB,{runId:e,bundle:l}),"network"===p&&Ss.jsx(EB,{runId:e,runFinished:n}),"trace"===p&&Ss.jsx(IB,{events:s})]})]});return o?Ss.jsx("div",{className:"relative flex h-full min-w-0 flex-1 flex-col bg-panel",children:_}):Ss.jsxs("aside",{className:"relative flex shrink-0",style:{width:g.inspectorWidth},children:[Ss.jsx(jy,{axis:"x",onPointerDown:m,className:"-left-[6px]"}),Ss.jsx("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden rounded-l-lg bg-panel",children:_})]})});function dB({vars:e}){const t=Object.entries(e);return 0===t.length?Ss.jsx(cB,{children:"no vars in scope yet"}):Ss.jsxs("div",{className:"divide-y divide-edge-soft",children:[Ss.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",children:[Ss.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"runtime vars"}),Ss.jsx("span",{className:"font-mono text-[10.5px] text-fg-4",children:t.length})]}),t.map(([e,t])=>{const s=t.startsWith("<Locator")?"Locator":t.startsWith("{")?"Object":t.startsWith("[")?"Array":t.startsWith('"')?"string":/^-?\d/.test(t)?"number":"value";return Ss.jsxs("div",{className:"flex items-baseline gap-2 px-3 py-1.5",children:[Ss.jsx("span",{className:"shrink-0 font-mono text-[12.5px] text-fg",children:e}),Ss.jsx("span",{className:"min-w-0 flex-1 break-all font-mono text-[12px] text-fg-2",children:t}),Ss.jsx("span",{className:"shrink-0 font-mono text-[10.5px] text-fg-4",children:s})]},e)})]})}function fB({frames:e}){return 0===e.length?Ss.jsx(cB,{children:"not inside a helper · top-level frame"}):Ss.jsxs("div",{className:"divide-y divide-edge-soft",children:[Ss.jsxs("div",{className:"flex items-center justify-between border-b border-edge-soft px-3 py-1.5",children:[Ss.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"call stack"}),Ss.jsx("span",{className:"font-mono text-[10.5px] text-fg-4",children:e.length})]}),e.map((e,t)=>Ss.jsxs("div",{className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-raised/60",children:[Ss.jsx("span",{className:"grid h-4 w-4 shrink-0 place-items-center font-mono text-[10px] text-fg-4 tabular-nums",children:t}),Ss.jsx("span",{className:"flex-1 truncate font-mono text-[12px] text-fg",children:e.fn}),e.file&&Ss.jsxs("span",{className:"truncate font-mono text-[10.5px] text-fg-4",children:[e.file,":",e.line]})]},t))]})}const pB=m_(function(){const e=y_(),t=e.breakpoints.all().filter(e=>e.keys.length>0);return Ss.jsxs("div",{className:"flex h-full flex-col",children:[Ss.jsxs("div",{className:"flex items-center justify-between border-b border-edge-soft px-3 py-1.5",children:[Ss.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"breakpoints"}),t.length>0&&Ss.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?Ss.jsx(cB,{children:"no breakpoints set · click the gutter on any step to add one"}):Ss.jsx("div",{className:"divide-y divide-edge-soft",children:t.map(t=>Ss.jsxs("div",{children:[Ss.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",children:[Ss.jsx("span",{className:"truncate font-mono text-[11.5px] text-fg",children:t.scenario}),Ss.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(s=>{const[i,n]=s.split(":").map(Number);return Ss.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 hover:bg-raised/60",children:[Ss.jsx(cy,{name:"bp",className:"h-2.5 w-2.5 shrink-0 text-fail"}),Ss.jsx("span",{className:"min-w-0 flex-1 font-mono text-[11.5px] text-fg",children:s}),Ss.jsx("button",{type:"button",onClick:()=>e.breakpoints.remove(t.scenario,i,n),className:"grid h-4 w-4 shrink-0 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fail",title:"Remove",children:Ss.jsx(cy,{name:"x",className:"h-3 w-3",strokeWidth:2.5})})]},s)})]},t.scenario))})]})});function vB(e){return{kind:"runFile",file:e}}function gB(e){const t=lB(e),s=ps.useMemo(()=>vB(Yb),[]),[i,n]=ps.useState(void 0);return ps.useEffect(()=>{let e=!1;return n(void 0),t.loadText(s).then(t=>{if(!e)if(t.ok)try{const e=JSON.parse(t.text);n(e.capture??null)}catch{n(null)}else n(null)}),()=>{e=!0}},[t,s]),i}function mB(e,t,s){return!1===e?s.disabled:!0===e?t?s.emptyForRun:s.pending:t?s.disabled:`${s.pending} (opt-in via ${s.flag}=1)`}function _B({runId:e,bundle:t}){const s=lB(e),i=(null==t?void 0:t.screenshotPath)?s.resolveUrl({kind:"event",path:t.screenshotPath}):null;return i?Ss.jsxs("div",{className:"flex h-full flex-col",children:[Ss.jsx(OB,{label:"page snapshot"}),Ss.jsx("div",{className:"flex-1 overflow-auto bg-panel p-2",children:Ss.jsx("img",{alt:"page snapshot at failure",src:i,className:"max-w-full rounded border border-edge shadow-sm"})})]}):Ss.jsxs("div",{className:"flex h-full flex-col",children:[Ss.jsx(OB,{label:"page snapshot"}),Ss.jsx(cB,{children:"no screenshot captured"})]})}function xB({marker:e,tone:t,trailing:s,onClick:i,children:n}){const r=ay("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":"",i&&"hover:bg-raised/60"),o=Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("span",{className:"mt-[3px] flex h-3 w-3 shrink-0 items-center justify-center",children:e}),Ss.jsx("span",{className:"min-w-0 flex-1 break-all",children:n}),s&&Ss.jsx("span",{className:"flex shrink-0 items-center gap-1.5",children:s})]});return i?Ss.jsx("button",{type:"button",onClick:i,className:r,children:o}):Ss.jsx("div",{className:r,children:o})}function bB(e){return Ss.jsx("span",{className:ay("h-2 w-2 rounded-full","error"===e?"bg-fail":"warn"===e?"bg-warn":"bg-fg-4")})}function yB({level:e,text:t}){return Ss.jsx(xB,{marker:bB(e),tone:"error"===e?"error":"warn"===e?"warn":void 0,children:Ss.jsx("span",{className:ay("whitespace-pre-wrap","error"===e?"text-fail":"warn"===e?"text-warn":"text-fg"),children:t})})}function wB({rows:e,empty:t}){return 0===e.length?Ss.jsx(cB,{children:t}):Ss.jsx("div",{className:"divide-y divide-edge-soft font-mono text-[11.5px]",children:e.map((e,t)=>Ss.jsx(yB,{...e},t))})}const SB=m_(function({active:e,events:t}){const s=y_(),[i,n]=ps.useState(""),[r,o]=ps.useState([]),[a,l]=ps.useState(null),c=function(e){return!!e&&!e.plainRun&&"completed"!==e.status&&"failed"!==e.status&&"aborted"!==e.status}(e),h=[];e?(e.logs.forEach((e,t)=>{h.push({at:e.at,key:`log-${t}`,node:Ss.jsx(yB,{level:e.level,text:e.text})})}),e.consoleEntries.forEach(e=>{h.push({at:e.at,key:`probe-${e.id}`,node:Ss.jsx(kB,{entry:e})})}),e.toolCalls.forEach(e=>{h.push({at:e.at,key:`tool-${e.callId}`,node:Ss.jsx(CB,{entry:e})})}),h.sort((e,t)=>e.at<t.at?-1:e.at>t.at?1:0)):t.forEach((e,t)=>{"log"===e.kind&&h.push({at:sB(e.t),key:`journal-log-${t}`,node:Ss.jsx(yB,{level:"log",text:`${sB(e.t)} ${e.text}`})})});return Ss.jsxs("div",{className:"flex h-full flex-col",children:[Ss.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:0===h.length?Ss.jsx(cB,{children:"no system output"}):Ss.jsx("div",{className:"divide-y divide-edge-soft font-mono text-[11.5px]",children:h.map(e=>Ss.jsx("div",{children:e.node},e.key))})}),Ss.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-t border-edge-soft px-3 py-1.5",children:[Ss.jsx(cy,{name:"chevronR",className:"h-3.5 w-3.5 shrink-0 text-accent"}),Ss.jsx("input",{type:"text",value:i,onChange:e=>n(e.target.value),onKeyDown:t=>{if("Enter"===t.key)t.preventDefault(),(()=>{const t=i.trim();t&&c&&(s.activeRuns.probe(e.runId,t),o(e=>e[e.length-1]===t?e:[...e,t]),l(null),n(""))})();else if("ArrowUp"===t.key&&r.length>0){t.preventDefault();const e=null===a?r.length-1:Math.max(0,a-1);l(e),n(r[e])}else if("ArrowDown"===t.key&&null!==a){t.preventDefault();const e=a+1;e>=r.length?(l(null),n("")):(l(e),n(r[e]))}},disabled:!c,spellCheck:!1,autoComplete:"off",placeholder:c?"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"})]})]})}),kB=m_(function({entry:e}){const[t,s]=ps.useState(!1),i=e.result,n=i?1===i.count?"pass":"warn":"neutral";return Ss.jsxs("div",{className:"text-[11.5px]",children:[Ss.jsx(xB,{marker:Ss.jsx(cy,{name:"chevronR",className:"h-3 w-3 text-accent"}),children:Ss.jsx("span",{className:"text-fg",children:e.input})}),Ss.jsxs("div",{className:"pb-1.5 pl-8 pr-3 font-mono",children:["pending"===e.status&&Ss.jsx("span",{className:"text-fg-4",children:"probing…"}),"stale"===e.status&&Ss.jsx("span",{className:"text-warn",children:"no reply — page may be navigating, or this run has no debug session"}),"done"===e.status&&i&&Ss.jsxs("div",{className:"flex flex-col gap-1",children:[Ss.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[Ss.jsxs(eN,{tone:n,children:[i.count," match",1===i.count?"":"es"]}),i.pinned&&i.pinned.ofCount>1&&Ss.jsxs(eN,{tone:"warn",children:[".",i.pinned.op,"() of ",i.pinned.ofCount]}),i.matches.length>0&&Ss.jsxs("button",{type:"button",onClick:()=>s(e=>!e),className:"inline-flex items-center gap-1 text-fg-2 hover:text-fg",children:[Ss.jsx(cy,{name:t?"chevronD":"chevronR",className:"h-3 w-3"}),t?"hide":"show"," matches",i.truncated?` (first ${i.matches.length})`:""]})]}),Ss.jsx("span",{className:"break-all text-fg-4",children:i.chain}),i.warnings.map((e,t)=>Ss.jsxs("span",{className:"text-warn",children:["⚠ ",e]},t)),t&&Ss.jsx("div",{className:"mt-0.5 flex flex-col gap-0.5",children:i.matches.map(e=>Ss.jsxs("div",{className:"flex items-start gap-2",children:[Ss.jsxs("span",{className:"shrink-0 text-fg-4 tabular-nums",children:["#",e.index]}),Ss.jsxs("span",{className:"min-w-0 flex-1 break-all text-fg-2",children:[e.role&&Ss.jsx("span",{className:"text-fg",children:e.role}),e.name?` "${e.name}"`:e.text?` ${e.text}`:"",e.testId?` [testId=${e.testId}]`:"",!e.visible&&Ss.jsx("span",{className:"text-fg-4",children:" · hidden"})]})]},e.index))})]})]})]})}),CB=m_(function({entry:e}){var t;const[s,i]=ps.useState(!1),n=e.args.length>0||((null==(t=e.preview)?void 0:t.length)??0)>0;return Ss.jsxs("div",{className:"text-[11.5px]",children:[Ss.jsx(xB,{marker:Ss.jsx(cy,{name:"play",className:"h-3 w-3 text-fg-3"}),onClick:n?()=>i(e=>!e):void 0,trailing:"running"===e.status?Ss.jsx("span",{className:"text-fg-4",children:"running…"}):Ss.jsxs(Ss.Fragment,{children:[null!=e.durationMs&&Ss.jsxs("span",{className:"text-fg-4 tabular-nums",children:[e.durationMs,"ms"]}),"error"===e.status?Ss.jsx(eN,{tone:"fail",children:"err"}):Ss.jsx("span",{className:"text-pass",children:"ok"})]}),children:Ss.jsxs("span",{className:"flex min-w-0 items-baseline gap-2",children:[Ss.jsx("span",{className:"shrink-0 text-fg",children:e.tool}),Ss.jsx("span",{className:"min-w-0 flex-1 truncate text-fg-2",children:e.args})]})}),s&&Ss.jsxs("div",{className:"flex flex-col gap-1 pb-1.5 pl-8 pr-3 font-mono",children:[Ss.jsxs("div",{className:"text-fg-4",children:[e.at," · ",e.tool,"running"!==e.status&&` · ${e.status}`]}),e.args&&Ss.jsx(jB,{text:e.args,tone:"dim"}),e.error?Ss.jsxs("div",{className:"whitespace-pre-wrap break-all text-fail",children:[e.error.class,": ",e.error.message]}):e.preview&&Ss.jsx(jB,{text:e.preview,tone:"normal"})]})]})});function jB({text:e,tone:t}){let s;try{s=JSON.parse(e)}catch{s=void 0}return null===s||!Array.isArray(s)&&"object"!=typeof s?Ss.jsx("div",{className:ay("whitespace-pre-wrap break-all","dim"===t?"text-fg-2":"text-fg"),children:e}):Ss.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-all text-[11px] leading-snug",children:Ss.jsx(NB,{value:s,indent:0})})}function NB({value:e,indent:t}){const s=" ".repeat(t),i=" ".repeat(t+1);if(null===e)return Ss.jsx("span",{className:"text-syn-keyword",children:"null"});if("string"==typeof e)return Ss.jsx("span",{className:"text-syn-string",children:JSON.stringify(e)});if("number"==typeof e||"boolean"==typeof e)return Ss.jsx("span",{className:"text-syn-number",children:String(e)});if(Array.isArray(e))return 0===e.length?Ss.jsx("span",{children:"[]"}):Ss.jsxs(Ss.Fragment,{children:["[\n",e.map((s,n)=>Ss.jsxs("span",{children:[i,Ss.jsx(NB,{value:s,indent:t+1}),n<e.length-1?",":"","\n"]},n)),s,"]"]});if("object"==typeof e){const n=Object.entries(e);return 0===n.length?Ss.jsx("span",{children:"{}"}):Ss.jsxs(Ss.Fragment,{children:["{\n",n.map(([e,s],r)=>Ss.jsxs("span",{children:[i,Ss.jsx("span",{className:"text-syn-key",children:JSON.stringify(e)}),": ",Ss.jsx(NB,{value:s,indent:t+1}),r<n.length-1?",":"","\n"]},e)),s,"}"]})}return Ss.jsx("span",{children:String(e)})}function MB({runId:e,runFinished:t}){const[s,i]=ps.useState({kind:"loading"}),n=lB(e),r=ps.useMemo(()=>vB("console.json"),[]),o=gB(e);return ps.useEffect(()=>{let e=!1;return i({kind:"loading"}),n.loadText(r).then(t=>{if(!e)if(t.ok)try{const e=JSON.parse(t.text);i({kind:"loaded",rows:e.map(e=>({level:e.level,text:e.text}))})}catch{i({kind:"error",message:"could not parse console.json"})}else i({kind:"missing"})}),()=>{e=!0}},[n,r,t]),"loading"===s.kind?Ss.jsx("div",{className:"px-3 py-2 font-mono text-[11.5px] text-fg-4",children:"loading…"}):"error"===s.kind?Ss.jsx(cB,{children:s.message}):"missing"===s.kind?Ss.jsx(cB,{children:mB(null==o?void 0:o.console,t,BB)}):Ss.jsx(wB,{rows:s.rows,empty:"no console output"})}const BB={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 LB({runId:e,bundle:t}){return Ss.jsxs("div",{children:[Ss.jsx(OB,{label:"semantic dom"}),t?Ss.jsx(HB,{runId:e,asset:{kind:"event",path:`${t.bundlePath}/outline.txt`}}):Ss.jsx(cB,{children:"no failure bundle for this run"})]})}const DB=m_(function({runId:e}){const t=y_(),s=ps.useMemo(()=>vB(D_),[]),[i,n]=ps.useState(0),r=ps.useCallback(()=>{t.activeRuns.requestSnapshot(e);const s=setTimeout(()=>n(e=>e+1),600),i=setTimeout(()=>n(e=>e+1),1700);return()=>{clearTimeout(s),clearTimeout(i)}},[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 ps.useEffect(()=>{if(null!==a)return r()},[r,a]),Ss.jsxs("div",{children:[Ss.jsxs("div",{className:"flex items-center justify-between border-b border-edge-soft px-3 py-1.5",children:[Ss.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:"picker snapshot"}),Ss.jsx("button",{type:"button",onClick:r,className:"font-mono text-[10.5px] text-fg-4 hover:text-fg",title:"Recapture the page outline",children:"refresh"})]}),Ss.jsx(HB,{runId:e,asset:s,reloadKey:i})]})});function EB({runId:e,runFinished:t}){const[s,i]=ps.useState({kind:"loading"}),n=lB(e),r=ps.useMemo(()=>vB("network.json"),[]),o=gB(e);return ps.useEffect(()=>{let e=!1;return i({kind:"loading"}),n.loadText(r).then(t=>{if(!e)if(t.ok)try{i({kind:"loaded",rows:JSON.parse(t.text)})}catch{i({kind:"error",message:"could not parse network.json"})}else i({kind:"missing"})}),()=>{e=!0}},[n,r,t]),"loading"===s.kind?Ss.jsx("div",{className:"px-3 py-2 font-mono text-[11.5px] text-fg-4",children:"loading…"}):"error"===s.kind?Ss.jsx(cB,{children:s.message}):"missing"===s.kind?Ss.jsx(cB,{children:mB(null==o?void 0:o.network,t,PB)}):0===s.rows.length?Ss.jsx(cB,{children:"no requests captured"}):Ss.jsx(AB,{rows:s.rows})}const PB={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"},RB="grid-cols-[1fr_52px_84px_72px_60px]";function AB({rows:e}){return Ss.jsxs("div",{className:"font-mono text-[11px]",children:[Ss.jsxs("div",{className:ay("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",RB),children:[Ss.jsx("span",{children:"Name"}),Ss.jsx("span",{className:"text-right",children:"Status"}),Ss.jsx("span",{children:"Type"}),Ss.jsx("span",{className:"text-right",children:"Size"}),Ss.jsx("span",{className:"text-right",children:"Time"})]}),e.map((e,t)=>{const s=!!e.failureText||null!=e.status&&e.status>=400;return Ss.jsxs("div",{className:ay("grid items-center gap-2 border-b border-edge-soft px-3 py-1",s&&"bg-fail/10",RB),children:[Ss.jsxs("span",{className:"truncate",title:e.url,children:[Ss.jsxs("span",{className:"text-fg-4",children:[e.method," "]}),zB(e.url)]}),Ss.jsx("span",{className:ay("text-right tabular-nums",s?"text-fail":null!=e.status&&e.status>=200&&e.status<300?"text-pass":"text-fg"),children:e.failureText?"fail":e.status??"—"}),Ss.jsx("span",{className:"truncate text-fg-2",children:e.resourceType}),Ss.jsx("span",{className:"text-right tabular-nums text-fg-2",children:TB(e.sizeBytes)}),Ss.jsx("span",{className:"text-right tabular-nums text-fg-2",children:null!=e.durationMs?`${e.durationMs} ms`:"—"})]},t)})]})}function zB(e){try{const t=new URL(e);return t.pathname.split("/").filter(Boolean).pop()||t.host}catch{return e}}function TB(e){return null==e?"—":e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} kB`:`${(e/1048576).toFixed(1)} MB`}function IB({events:e}){return 0===e.length?Ss.jsx(cB,{children:"no trace events"}):Ss.jsx("div",{className:"divide-y divide-edge-soft font-mono text-[11.5px]",children:e.map((e,t)=>Ss.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5",children:[Ss.jsx("span",{className:"w-24 shrink-0 truncate text-fg-2",children:e.kind}),Ss.jsx("span",{className:"min-w-0 flex-1 truncate text-fg",children:KB(e)})]},t))})}function OB({label:e}){return Ss.jsx("div",{className:"flex items-center justify-between border-b border-edge-soft px-3 py-1.5",children:Ss.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fg-4",children:e})})}function HB({runId:e,asset:t,reloadKey:s}){return Ss.jsx(FB,{runId:e,asset:t,transform:WB,reloadKey:s})}function FB({runId:e,asset:t,transform:s,reloadKey:i=0}){const[n,r]=ps.useState({kind:"loading"});return function(e,t,s,i,n){const r=lB(e);ps.useEffect(()=>{let e=!1;return i({kind:"loading"}),r.loadText(t).then(t=>{e||(t.ok?i({kind:"loaded",text:s(t.text)}):i({kind:"error",message:"not available"}))}),()=>{e=!0}},[r,t,s,i,n])}(e,t,s,r,i),"loading"===n.kind?Ss.jsx("div",{className:"px-3 py-2 font-mono text-[11.5px] text-fg-4",children:"loading…"}):"error"===n.kind?Ss.jsx(cB,{children:n.message}):Ss.jsx("pre",{className:"overflow-auto whitespace-pre-wrap break-all p-3 font-mono text-[11.5px] text-fg",children:n.text})}function WB(e){return e}function KB(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;case"note":return`${e.label}: ${e.text}`;case"log":return e.text;case"judge:verdict":return`${e.verdict} · ${e.rubric}`;default:return""}}const UB={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 qB({children:e,onClick:t,icon:s,variant:i="default",tooltip:n,tooltipHint:r,tooltipPlacement:o="bottom-start",className:a}){return Ss.jsxs("button",{type:"button",onClick:t,className:ay("group relative flex h-6 items-center gap-1 rounded px-2 font-mono text-[11px] font-medium",UB[i],a),children:[s&&Ss.jsx(cy,{name:s,className:"h-3 w-3",strokeWidth:2.5}),e,n&&Ss.jsx(jN,{label:n,hint:r,placement:o})]})}function VB(e){return new Map(jM(e).map(e=>[`${e.line}:${e.col}`,e.index]))}function $B(e,t,s){const i=e.get(`${t}:${s}`);if(null!=i)return i;for(const[n,r]of e)if(n.startsWith(`${t}:`))return r;return null}function YB(e,t,s){const i=VB(t),n=[],r=new Map,o=[];for(const a of e)if("step:started"===a.kind){const e=a.file===s?$B(i,a.line,a.col):null;if(o.push({idx:e}),null==e)continue;const t=r.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};r.set(e,t),n.push(t)}}else if("step:ok"===a.kind){const e=o.pop();if(null!=(null==e?void 0:e.idx)){const t=r.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=r.get(e.idx);t&&(t.status="failed")}}else if("run:finished"===a.kind)for(const e of n)"running"===e.status&&(e.status="aborted");return function(e){const t={};for(const s of e)t[s.index]={status:s.status,durationMs:s.durationMs};return t}(n)}function GB(e,t){return e.file===t?`${e.line}:${e.col}`:null}function XB(e,t,s){var i;return(null==(i=ZB(e,t,s))?void 0:i.index)??null}function ZB(e,t,s){const i=VB(t),n=[];for(const r of e)if("step:started"===r.kind){const e=r.file===s?$B(i,r.line,r.col):null;n.push({idx:e})}else if("step:ok"===r.kind)n.pop();else if("step:fail"===r.kind){const e=n.pop();if(null!=(null==e?void 0:e.idx))return{index:e.idx,event:r}}return null}const JB=sL;!function(){const e=865,t=661,s=677,i=sL,n=nL();for(;;)try{if(551416===-parseInt(i(765))/1+parseInt(i(743))/2*(parseInt(i(578))/3)+parseInt(i(735))/4*(parseInt(i(563))/5)+-parseInt(i(784))/6+parseInt(i(840))/7*(-parseInt(i(617))/8)+-parseInt(i(e))/9+-parseInt(i(t))/10*(-parseInt(i(s))/11))break;n.push(n.shift())}catch(r){n.push(n.shift())}}();var QB=Object[JB(504)],eL=(e,t)=>QB(e,JB(644),{value:t,configurable:!0});function tL(e){const t=JB;return'"'+e[t(608)](/\\/g,"\\\\")[t(608)](/"/g,'\\"')+'"'}function sL(e,t){e-=490;const s=nL();let i=s[e];if(void 0===sL.IOyWpj){sL.pckHzK=function(e){let t="",s="";for(let i,n,r=0,o=0;n=e.charAt(o++);~n&&(i=r%4?64*i+n:n,r++%4)?t+=String.fromCharCode(255&i>>(-2*r&6)):0)n="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=".indexOf(n);for(let i=0,n=t.length;i<n;i++)s+="%"+("00"+t.charCodeAt(i).toString(16)).slice(-2);return decodeURIComponent(s)},sL.lxlCje={},sL.IOyWpj=!0}const n=e+s[0],r=sL.lxlCje[n];return r?i=r:(i=sL.pckHzK(i),sL.lxlCje[n]=i),i}function iL(e,t){const s=JB,i=e.replace(/\\/g,"\\\\")[s(608)](/'/g,"\\'");return void 0!==t?s(671)+i+"'), nth("+t+s(703):"toLocator([locator('"+i+s(710)}function nL(){const e=["ihWG","Dw5HCNK","BwLU","zw5K","zMLSBcG","Aw5JCMvTzw50","BxvSDgLWBgLJyxrL","Dg9Rzw5PEMvnDwX0AwXPBMvdB21Tzw50","yNvPBgrpCgvUvgfIrhnS","Dg9Rzw5PEMvoDw1Izxi","B2jQzwn0rxHWCMvZC2LVBG","AxnfEgLZDhm","zMLSBa","m0LZtw9nBW","tfrfuq","yNvPBgrbC3nLCNrvCMXdB250ywLUC0rZBa","t25LigfYz3vTzw50igv4CgvJDgvK","C2vSzwn0q29TyM9IB3HwywX1zsG","AM9PBG","uKvuvvjo","sw52ywXPzcbMBg9HDcbUDw1Izxi","zxzHBa","vw50zxjTAw5HDgvKihjLz2v4igXPDgvYywWGkgXPBMuGyNjLywSGAw5ZAwrLigjVzhKPlG","zwXLBwvUDefZC2vYDcGIq09ovefjtLmIlca","yNvPBgrbC3nLCNroB3rwAxnPyMXLrhnS","sw52ywXPzcb0B2TLBJOGDw5LEhbLy3rLzca","lcbLEhbLy3rLzca","ChjPBwfYEq","tLvnqKvs","yxnZzxj0vgfIBgvoB3rfBxb0EsG","zNvUy3rPB25HBev4ChjLC3nPB24","Bg9NAwnHBe9Y","vw5YzwnVz25PEMvKig9WzxjHDg9YigzVCIbZDhjPBMCGDMfSDwu","Aw5KzxG","tfbbuKvo","tuvuqv9cte9dsW","DgfNrxHWCMvZC2LVBG","yNvPBgrty3jVBgXuB0jVDhrVBurZBa","z2v0qxjNC0nVDw50","Dw5RBM93BIbYzwDLEcbMBgfNicC","uKvtrvjwrurFv09srfm","u3rLCfn0yxrLBwvUDa","qxjYyxKGzxHWzwn0zwq","CMvWBgfJzq","y2XVBMu","C3rLCa","yNvPBgrbC3nLCNrsB3v0zuLZrhnS","qu1qqu1q","q29UzgL0Aw9UywXfEhbYzxnZAw9U","DgHPCW","lcbJB2X1Bw4G","yxjNtMfTzxm","mtm2q09QCu1j","y29TBwvUDhm","Axnmzxr0zxjjBLDVCMq","rvHdtevr","cI8VqgvUzc0","C2nYB2XSvg9uB3aO","sw5KzxGGywnJzxnZig9UigeGBwvTyMvYigv4ChjLC3nPB24GkguUzY4Gyhn0yxrLlM1HDgnOzxnBmf1GksbPCYbUB3qGC3vWCg9YDgvKiokaLcbPBMrLEgLUzYb3B3jRCYbVBIbHigjHCMuGDMfYAwfIBguGB25SEs4GqxnZAwDUihrOzsbTzw1IzxiGDg8Gysb2yxjPywjSzsbMAxjZDdOGyg0GpsbZDgf0zs5TyxrJAgvZoYbSyxn0id0GBvTTlMXLBMD0AcaTidfDo2a","ufjfrKLyx0Loq1jftuvova","zwXZzq","B3bLBIG","z2v0uMvZDwX0","D2fPDezVCLrLEhqO","vg9Rzw4ODhLWztOG","yNvPBgrpCgvUrhnS","yxnZzxj0u2vJDgLVBLrPDgXLka","zwXLBwvUDev4ChjLC3nPB24","sw52ywXPzcbHCMD1BwvUDcbJB3vUDcbMB3iGzNvUy3rPB24G","tuLovvm","zM9YicG","zNvUy3rPB25ezwzPBMu","Aw5KzxHpzG","BgvUz3rO","DgvYBwLUyxrPB24","Aw5KzxHLCW","Bwv0yujSB2nR","kcKGpt4GEWO","qxjYyxLfEhbYzxnZAw9U","BMfTzq","rNvUy3rPB25HBev4ChjLC3nPB24","z2v0vhLWzq","Dg9Rzw5PEMvdB21Tzw50","uhjVCgvYDhKTCMvHzcbLEhbYzxnZAw9UihvZzwqGyxmGysbZDgf0zw1LBNqGkg5VihnPzguGzwzMzwn0ks4GrwL0AgvYigfZC2LNBIbPDcaOyhGGpsbYB3CUzM9VycKGB3iGy2fSBcbHig1LDgHVzcaOyhjVDY5MB28OkwaPlG","tvvmveLqtfK","yNvPBgrtzwXLy3rdB21IB2jVEfzHBhvLrhnS","AwztDgf0zw1LBNq","yMXVy2TnzxrHqMXVy2S","EwLLBgq","yxntDhjPBMC","u3rYAw5NvMfSDwu","B3bLCMf0Aw9U","y2f0y2G","y2fSBfDPDgHqB3n0zML4","ugfYC2vfCNjVCG","vw50zxjTAw5HDgvKihjLz2v4igXPDgvYywWGkgrHBMDSAw5NigjHy2TZBgfZAcKU","nteWruThuKP5","cN0P","vu5eruzjtKve","vevyva","z2v0t3bLCMf0B3joyw1L","C3DPDgnO","Aw5PDa","vw5LEhbLy3rLzcbUB24TyNjLywTPBMCGC3bHy2uGkfuRmdbbmcKG4OcuihjLCgXHy2uGAxqGD2L0AcbHihjLz3vSyxiGC3bHy2u","Dw5KzwzPBMvK","z2v0qxjNC05HBwu","Dg9mB2nHDg9YkfTSB2nHDg9YkcC","yNvPBgrbC3nLCNroB1zPC2LIBgvfCNjVCKrZBa","AxnbCNjHEq","AxnszwDLEefSBg93zwrbzNrLCG","zM9Y","zMXVD18","ntK4mda0Bxn0v0Lz","D2HPBgu","C2L6zq","ueXvuW","zM9YBwf0q29KzuzYyw1L","Dg9Rzw5PEMu","qvjst1C","BgfIzwW","ChjPBNqG","ugfYC2vY","twvTyMvYq2fSBev4ChjLC3nPB24UzxzHBcGPigLZig5VDcbPBxbSzw1LBNrLzcbPBIb0AguGAw4TChjVy2vZCYbPBNrLCNbYzxrLCIdIGjqGDxnLiefZDev4zwn1Dg9YicHZCMmVzhnSl2fZDc1LEgvJDxrVCI50CYKGAw5ZDgvHzc4","B3bLCMf0B3i","Bg9NAwnHBefUza","q2fUBM90igLUy3jLBwvUDc9KzwnYzw1LBNqGBM9Ulw51BwvYAwmGDMfSDwu","yNvPBgreCMfNqw5KrhjVCerZBa","rvHdtevrrve","CMvNzxHdB250zxH0qwXSB3DLza","zM9YBwf0ugfYC2vfCNjVCG","yxnoDw1Izxi","wKvstW","ica+ia","yM9KEq","vgvTCgXHDguGAw50zxjWB2XHDgLVBIbGjhSUlI59ycbPCYbUB3qGywXSB3DLzcbPBIb1BM90zxn0ierttcbZDhjPBMDZlIbvC2uGCg9ZAxrPB25HBcbHCMDZigLUC3rLywq6igv2ywX1yxrLkcDYzxr1CM4GyxjNlNGNlcb7yxjNoIb2ywX1zx0PlG","y29UC3vTzufYCMf5","Dg9Rzw5PEMvuzxH0","yxjYyxK","kv0P","rK9s","Dg9Rzw5PEMvszwDLEa","ChjLC3mO","yNvPBgrgB3jJzunSAwnRrhnS","zgvJBgfYyxrVCNm","C2nYB2XSsw50B1zPzxCO","jYLDkq","q2fUBM90ignHC3qGyxjYyxKGDg8GBNvTyMvY","B3bLBG","uhjPBNrtDgf0zw1LBNq","qxjYyxLby2nLC3nfEhbYzxnZAw9U","CMvNzxGGzMXHzYaN","yxjYyxLfEhbYzxnZAw9U","C3rHCNrZv2L0Aa","y2XHC3m","C3rLCfn0yxrLBwvUDa","yNvPBgrtD2L0y2HuB0zYyw1LrhnS","q29UDgLUDwvtDgf0zw1LBNq","Bg9VA01HDgnO","ywz0zxjcBg9JAW","CMv0DxjU","Cg9W","rvm2ihvUAwnVzgu","it09","yxnZzxj0uM91DgvjCYG","zxnJyxbLrhnSu3rYAw5N","twLZC2LUzYbJBg9Zzsb0ywCGAw4Gy29TBwvUDa","lcb0zxH0oIaI","z2v0","ChjPBNq","C3rLCc5ZB2z0","ngTIAurHra","u0vnsunpte9o","tejsqunlrvq","D2HPBgvtDgf0zw1LBNq","sw52ywXPzcb0B2TLBML6zu9WzxjHDg9YoIb1BMv4CgvJDgvKigvUzcbVzIbPBNb1Da","yNvPBgrdBgLJA0rZBa","C3rHDgvTzw50","y2XVC2veAwfSB2CO","mtq0nZrmEgHxD3K","ue9tvezjwf9jtKnsru1ftLq","yNvPBgrpCgvUtwvUDuL0zw1eC2W","q09ntue","C3rHDgvTzw50t3jcBg9JAW","zxHWCJi","qKfsqKfs","icaGia","ufjfrKLyx0rfq1jftuvova","C291CMnL","rLvoq1rjt04","D2L0Aa","Aw5WDxq","zw50CMLLCW","yNvPBgrty3jVBgXuB1rVCerZBa","tuLovvnnsu5vuW","uhjVCgvYDhLby2nLC3nfEhbYzxnZAw9U","t1bfuKfut1jt","zgvIDwDNzxi","zM9YrwfJAa","yNvPBgrbC3nLCNrvCMXfCxvHBhneC2W","lY9a","odK4mZu0wLLpvgzx","y2fZzq","y29UC3vTzq","Dg9Rzw5Z","CMvWzwf0","uKjsqunlrvq","yNvPBgrbC3nLCNrdB3vUDevXDwfSC0rZBa","dqOa","ueXvu1bmvvm","vw5LEhbLy3rLzca","t2jQzwn0rxHWCMvZC2LVBG","C29MDa","cN0kD2HPBguGka","z2v0qxjYyxK","u1rbuG","q29UC3rHBNqG","yNjLywS","q09mt04","y29UC3vTzvDVCMq","mJKWmtm0mM52v2vptW","DM9Pza","yM9VBgvHBG","vw5RBM93BIbZDgvWig1VzgLMAwvYici","zMXHz3m","zg9xAgLSzvn0yxrLBwvUDa","qxjYyxLwywX1zq","sw5JCMvTzw50u3rHDgvTzw50","BwfW","qKfs","DhLWzq","z2v0tMfTzq","uLbbuKvo","zwXZzvn0yxrLBwvUDa","yNvPBgruExbLvgv4DerZBa","jYbPCYbHihjLC2vYDMvKiePHDMfty3jPChqGA2v5D29Yzc4GvxnLigeGzgLMzMvYzw50ig5HBwuU","lcbJB2X1Bw46ia","Dg9Rzw5PEMvpCgvYyxrVCG","zM9Yy2vdBgLJAYG","Aw5KzxHfEhbYzxnZAw9UCW","vw50zxjTAw5HDgvKihjLz2v4igXPDgvYywWGkg1PC3nPBMCGy2XVC2LUzYaVks4","zNvUy3rPB25fEhbYzxnZAw9U","zMLSBezVCM0OiG","rvffuuvr","t2jQzwn0vMfSDwu","DMfSAwrHDgvfCZvgBgfNCW","C3vWzxi","C2v0","qMLUyxj5rxHWCMvZC2LVBG","yNvPBgrlzxLWCMvZC0rZBa","yNvPBgrbC3nLCNrjBNb1DfzHBhvLrhnS","qMXVy2TtDgf0zw1LBNq","vMfYAwfIBguGBMfTzsaN","yNvPBgrdBg9ZzurPywXVz0rZBa","C3DPDgnOvg9gCMfTzsG","vw5RBM93BIbMDw5JDgLVBJOG","yNvPBgrgAwXSrhnS","y2XPCgjVyxjKugfZDguO","yNvPBgrtyxzLrM9YBurZBa","uhjVCgvYDhLby2nLC3nfEhbYzxnZAw9UlMv2ywWOksbPCYbUB3qGAw1WBgvTzw50zwqGAw4GDgHLigLUlxbYB2nLC3mGAw50zxjWCMv0zxiG4OcuihvZzsbbC3rfEgvJDxrVCIaOC3jJl2rZBc9HC3qTzxHLy3v0B3iUDhmPigLUC3rLywqU","sw5JCMvTzw50rxHWCMvZC2LVBG","yNvPBgrxywL0rM9Yvgv4DerZBa","CMvJzwL2zxi","BMv4Da","u1rfua","rNvUy3rPB25ezwzPBMvtDgf0zw1LBNq","y2XPy2SO","v2HPBgvtDgf0zw1LBNq","B3b0Aw9UCW","DgvZDa","D2fPDezVCLvstcG","C3DPDgnOvg9nywLUrNjHBwuO","C3rYAw5NAwz5","vxnLCKrLzMLUzuz1BMn0Aw9U","qu1q","yNvPBgrxywL0rM9YsgLKzgvUrhnS","mJu5ndGZDhzTrLrb","DMfYu3rHDgvTzw50","Dg9Rzw5PEMvsyxDuzxH0","y2HHCKf0","zwXLBwvUDenVDw50qxnZzxj0kcjfuvvbtciSia","zwnOBW","swztDgf0zw1LBNq","ywrK","yNvPBgrmB2DPBKfZrhnS","C2f2zuzVCM0O","DMfYAwfIBgvZ","rg9xAgLSzvn0yxrLBwvUDa","qNjLywTtDgf0zw1LBNq","rvHdta","oYbUB3qGAw4Grvm1ihn1yNnLDc4Gu2vLigrVy3mVzhnSl3jLz2v4lwXPDgvYywWTzxm1lM1KigzVCIb0AguGC3vWCg9YDgvKigzSywCGC2v0lG","twLZC2LUzYbJBg9ZzsbXDw90zsbPBIbZDhjPBMCGBgL0zxjHBa","BwvZC2fNzq","ufjjtLq","DMfYAwfIBgvoyw1L","uMvNrxHWrMXHz0vYCM9Y","y29SDw1U","DMfYAwfIBgu","sw52ywXPzcb0B2TLBML6zu9WzxjHDg9Yia","Bwf0y2G","B3bLCMfUza","mZuWnJmYogzgtunUzW","DhLWzw9M","z2v0q29SDw1U","ChjVCgvYDgLLCW","t1bfuKfut1jFq0HbuLm","C3bSAxq","zwXLBwvUDefZC2vYDcGIsvmIlca","qxjYyxLbC3nPz25Tzw50u3rHDgvTzw50","y29UzgL0Aw9U","yNvPBgrtD2L0y2HuB01HAw5gCMfTzurZBa","kY0QlYGPE31Bxt08pIeMFcW6oY4","zwXLBwvUDfzPC2LIAwXPDhLbC3nLCNqOiK5pvf9wsvnjqKXfiIWG","tKvr","C2v0ugfNzq","yNvPBgrbC3nLCNreAwfSB2DpCgvUrhnS","yNvPBgrbC3nLCNruywjSzu5VDevTChr5rhnS","vKfs","AwzfBhnL","ChvZAa","DhjPBq","u3rYAw5N","yNvPBgrbC3nLCNrtzwn0Aw9UvgL0BgveC2W","C3rHDgvTzw50CW","uKvhrvG","vw5RBM93BIbZDgf0zw1LBNq6ihvUzxHWzwn0zwqG","ru9g","CgvLA0DYB3vW","Aw5PDgLHBgL6yxrPB24","r1rfuq","z2v0vgv4Da","zxHLy3v0zq","rNvUy3rPB25tDgf0zw1LBNq","y29Z","ywrKvg9Rzw4","uMvNrxHWvMfSDwu","zxHWCJe","DMfY","kqP7cG","vw5YzwnVz25PEMvKihzHBhvLlIa","yxjNDw1LBNrZ","yNvPBgrty3jVBgXjBNrVvMLLD0rZBa","Cg9Z","tNvTyMvYvMfSDwu","Bwf4","zNvUy3rPB25Z","Dgv4Da","AxnxB3jKu3rHCNq","oIbLEhbLy3rLzca","q0Xpu0vFtuvuqv9cte9dsW","rxHWzwn0zwqGChjVCgvYDhKGA2v5icH3B3jKig9Yihn0CMLUzYK","BgfZDeLUzgv4","BNvTyMvY","igrVzxmGBM90igv4Axn0iq","zM9Yu3rHDgvTzw50","tfrf","id0G","zgvMAw5LuhjVCgvYDhK","z2v0tgLUzq","zMLUywXSEq","jYbYzxf1AxjLCYa","C2XPy2u","yNvPBgrbC3nLCNruB2fZDfzPC2LIBgveC2W","zxHWCMvZC2LVBG","yMXVy2S","DMfSDwu","ywrKAxrPDMu","qLjfquS","yNvPBgrxywL0rM9YtMf2AwDHDgLVBKrZBa","CMvZDwX0","zMfSC2u","rvmYmdiYigHHC0LUzgLJzxm","yxnZAwDUBwvUDfn0yxrLBwvUDa","Dg9Rzw5PEMvnzxrHv29Yza","C3rHy2S","BgLUzq","yNvPBgrbC3nLCNrqywDLuMvHzhLeC2W","yNvPBgrgAwXSrM9YBurZBa","rvffuq","Bg9JyxrVCG","CgvLAW","zxf1ywXPDhK","Dg9Rzw4","ue9tvezjwf9erunsru1ftLq","iIWGBgLUztOG","zNjVBq","vw5LEhbLy3rLzcbJAgfYywn0zxiG","y29UzgL0Aw9UywW","yxnZzxj0rgLHBg9Nt3bLBIG","Dg9Rzw5PEMvxB3jK","ruXtrq","yxnZzxj0qxv0AgvUDgLJyxrLzcG","yxnZzxj0tgLZDe5VDevTChr5ka","zhjHz0fUzerYB3aO","pt09","u05fuq","D2fPDezVCK5HDMLNyxrPB24O","reLwsurf","AgfZ","yxDHAxq","y29UDgLUDwu","Bg9NAw5bCYG","DgfN","yNvPBgrxywL0rM9YvvjmrhnS","Dg9tDhjPBMC","D2fPDezVCKHPzgrLBIG","igvSC2uG","yNvPBgrxywL0rM9YrhnS","zhvWBgLJyxrLihjLz2v4igzSywCGjW","Bg9JywXLq29TCgfYzq","q09oveLovuu","zwXLBwvUDhm","BgfIzwXuzxH0","zxHWB3j0","re9u","v0Hjteu","ody2ndu1C2Dzzhju","vMfYAwfIBgvfEhbYzxnZAw9U"];return(nL=function(){return e})()}eL(tL,JB(729)),eL(iL,JB(526)),eL(function(e,t,s=""){return JB(830)+iL(e,t)+", "+tL(s)+");"},JB(740)),eL(function(e,t,s,i=""){return JB(569)+iL(e,s)+", "+tL(t)+", "+tL(i)+");"},JB(820)),eL(function(e,t,s=""){return"typeText("+iL(e)+", "+tL(t)+", "+tL(s)+");"},JB(798)),eL(function(e,t="0",s=""){return JB(626)+tL(e)+", "+tL(t)+", "+tL(s)+");"},JB(630)),eL(function(e,t=""){return'elementVisibilityAssert("VISIBLE", '+iL(e)+", "+tL(t)+");"},"buildAssertVisibleDsl"),eL(function(e,t=""){return'urlAssert("CONTAINS", '+tL(e)+", "+tL(t)+");"},JB(580)),eL(function(e=""){return"assertPageReady("+tL(e)+");"},JB(523)),eL(function(e=""){return JB(538)+tL(e)+");"},"buildAssertAuthenticatedDsl"),eL(function(e,t=""){return JB(594)+iL(e)+", "+tL(t)+");"},JB(880)),eL(function(e,t=""){return JB(539)+iL(e)+", "+tL(t)+");"},"buildAssertListNotEmptyDsl"),eL(function(e=""){return"assertNoVisibleError("+tL(e)+");"},JB(672)),eL(function(e,t=""){return JB(631)+tL(e)+", "+tL(t)+");"},JB(886)),eL(function(e,t=""){return"assertToastVisible("+tL(e)+", "+tL(t)+");"},JB(509)),eL(function(e,t=""){return JB(535)+tL(e)+", "+tL(t)+");"},JB(879)),eL(function(e,t=""){return JB(728)+tL(e)+", "+tL(t)+");"},JB(611)),eL(function(e,t,s=""){return JB(582)+iL(e)+", "+tL(t)+", "+tL(s)+");"},JB(650)),eL(function(e,t,s=""){return JB(548)+tL(e)+", "+tL(t)+", "+tL(s)+");"},JB(848)),eL(function(e,t=""){return"openMenuItem("+tL(e)+", "+tL(t)+");"},JB(745)),eL(function(e,t=""){return"openTab("+tL(e)+", "+tL(t)+");"},JB(573)),eL(function(e,t=""){return JB(742)+tL(e)+", "+tL(t)+");"},JB(817)),eL(function(e,t=""){const s=608,i=JB,n=JSON[i(836)](e)[i(608)](/\\/g,"\\\\")[i(s)](/"/g,'\\"');return i(806)+n+'", '+tL(t)+");"},JB(524)),eL(function(e,t=""){return JB(849)+tL(e)+", "+tL(t)+");"},JB(822)),eL(function(e,t="",s){const i=s?", "+s:"";return"waitFor("+iL(e)+", "+tL(t)+i+");"},JB(554)),eL(function(e,t,s="",i){const n=i?", "+i:"";return JB(628)+iL(e)+", "+tL(t)+", "+tL(s)+n+");"},JB(825)),eL(function(e,t="",s){const i=s?", "+s:"";return JB(552)+iL(e)+", "+tL(t)+i+");"},JB(839)),eL(function(e,t="",s){const i=s?", "+s:"";return JB(834)+tL(e)+", "+tL(t)+i+");"},JB(550)),eL(function(e="",t){const s=t?", "+t:"";return JB(543)+tL(e)+s+");"},JB(515)),eL(function(e,t,s="",i){const n=i&&"IS"!==i?", "+tL(i):"";return"assertInputValue("+iL(e)+", "+tL(t)+", "+tL(s)+n+");"},JB(814)),eL(function(e,t=""){return JB(709)+iL(e)+", "+tL(t)+");"},JB(905)),eL(function(e,t=""){return"scrollToBottom("+iL(e)+", "+tL(t)+");"},JB(602)),eL(function(e,t=""){return JB(622)+iL(e)+", "+tL(t)+");"},JB(757)),eL(function(e,t=""){return JB(802)+iL(e)+", "+tL(t)+");"},JB(707)),eL(function(e,t,s=""){return JB(540)+iL(e)+", "+iL(t)+", "+tL(s)+");"},JB(691)),eL(function(e,t,s=""){return JB(821)+iL(e)+", "+tL(t)+", "+tL(s)+");"},"buildClipboardPasteDsl"),eL(function(e,t=JB(698),s=""){return JB(706)+iL(t)+", "+tL(e)+", "+tL(s)+");"},JB(813)),eL(function(e,t=""){return JB(818)+iL(e)+", "+tL(t)+");"},JB(720)),eL(function(e=""){return JB(835)+tL(e)+");"},JB(874)),eL(function(e,t=""){return JB(876)+iL(e)+", "+tL(t)+");"},JB(589)),eL(function(e,t,s=""){return JB(588)+iL(e)+", "+tL(t)+", "+tL(s)+");"},"buildAssertTextContainsDsl"),eL(function(e,t,s=""){return JB(871)+iL(e)+", "+tL(t)+", "+tL(s)+");"},"buildAssertTextEqualsDsl"),eL(function(e,t=""){return'urlAssert("IS", '+tL(e)+", "+tL(t)+");"},JB(763)),eL(function(e,t,s=""){return JB(844)+iL(e)+", "+t+", "+tL(s)+");"},JB(771)),eL(function(e,t){const s=JB,i=e.replace(/-/g,"_");return s(676)+i+"("+tL(e)+", "+tL(t)+', "#66cccc");'},"buildFlowDsl");var rL=(eL(s=class{constructor(e){Mt(this,"elements");const t=673,s=558,i=558,n=JB;typeof e===n(499)?this.elements=new Array(e)[n(577)](void 0):Array[n(t)](e)?this[n(s)]=[...e]:this[n(558)]=[...e[n(i)]]}[JB(732)](e){return this[JB(558)][e]}[JB(811)](e,t){this[JB(558)][e]=t}[JB(695)](){throw new Error(JB(711))}clone(){const e=JB;return new s(this[e(558)][e(792)](t=>t[e(609)]()))}[JB(654)](){const e=792,t=583,s=JB;return"["+this[s(558)][s(e)](e=>e[s(654)]())[s(t)](", ")+"]"}[JB(551)](){return this[JB(654)]()}},JB(790)),s),oL=(eL(r=class{constructor(e){Mt(this,i);const t=JB;typeof e===t(786)?this[t(512)]=e?1:0:this[t(512)]=e}[(n=JB(696),i=JB(512),JB(609))](){return new r(this[JB(512)])}asNumber(){return this.value}[JB(654)](){const e=551,t=JB;return this[t(512)][t(e)]()}[JB(551)](){return this[JB(654)]()}},JB(490)),Mt(r,n,new r(0)),r),aL=(eL(a=class{static[(o=JB(492),JB(576))](e){const t=JB;return this[t(492)][t(545)](e)}static[JB(732)](e){const t=JB,s=this.functions.get(e);if(!s)throw new TypeError(t(819)+e);return s}static[JB(811)](e,t){const s=JB;this[s(492)][s(811)](e,t)}},"Functions"),Mt(a,o,new Map([[JB(897),{execute(...e){const t=JB;if(1!==e[t(638)])throw new Error(t(581));return new oL(Math[t(897)](e[0][t(695)]()))}}],[JB(845),{execute(...e){const t=654,s=JB;for(const i of e)console.log(i[s(t)]());return oL[s(696)]}}],["highlightBlock",{execute:(...e)=>oL.ZERO}],[JB(878),{execute:(...e)=>oL[JB(696)]}],[JB(723),{execute:(...e)=>oL[JB(696)]}],[JB(712),{execute:(...e)=>oL[JB(696)]}],[JB(885),{execute:(...e)=>oL.ZERO}]])),a),lL=(eL(l=class{constructor(e=new Map){Mt(this,"properties"),this.properties=e}[JB(732)](e){return this[JB(868)].get(e)}set(e,t){this[JB(868)].set(e,t)}[JB(695)](){return this.properties.size}[JB(654)](){const e=JB;return"{"+Array[e(532)](this.properties[e(756)]()).map(([e,t])=>e+": "+t.asString())[e(583)](", ")+"}"}[JB(609)](){const e=811,t=609,s=JB,i=new Map;return this[s(868)][s(762)]((n,r)=>{const o=s;i[o(e)](r,n[o(t)]())}),new l(i)}getProperties(){return this.properties}},JB(808)),l),cL=(eL(h=class{constructor(e,t){Mt(this,"source"),Mt(this,c);const s=752,i=788,n=JB;dL(t),this[n(s)]=e,this[n(i)]=t}[(c=JB(788),JB(609))](){return new h(this[JB(752)],this.flags)}[JB(695)](){return NaN}[JB(654)](){const e=JB;return"/"+this.source+"/"+this[e(788)]}[JB(551)](){return this[JB(654)]()}},JB(899)),h),hL=new Set(["g","i","m"]),uL={s:"ES2018 dotAll",u:JB(726),y:"ES6 sticky",d:JB(518),v:"ES2024 unicodeSets"};function dL(e){const t=507,s=854,i=545,n=604,r=545,o=JB,a=new Set;for(const l of e){if(uL[l])throw new fL(o(715)+l+o(t)+uL[l]+o(s));if(!hL[o(i)](l))throw new fL(o(n)+l+"'. ES5 allows g, i, m.");if(a[o(r)](l))throw new fL(o(555)+l+"'.");a[o(847)](l)}}eL(dL,JB(809));var fL=(eL(u=class extends Error{constructor(e){const t=JB;super(e),this[t(644)]=t(859)}},JB(859)),u),pL=(eL(f=class{constructor(e){Mt(this,d),this.value=e}[(d=JB(512),JB(609))](){return new f(this[JB(512)])}[JB(695)](){const e=512,t=JB;try{return parseFloat(this[t(e)])}catch(s){return 0}}[JB(654)](){return this[JB(512)]}[JB(551)](){return this.asString()}},JB(655)),f),vL=(eL(v=class{constructor(e,t){Mt(this,p),Mt(this,"body");const s=JB;this.argNames=e,this[s(698)]=t}[(p=JB(616),JB(603))](){const e=JB;return this[e(616)][e(638)]}getArgsName(e){const t=638,s=616,i=JB;return e<0||e>=this[i(616)][i(t)]?"":this[i(s)][e]}[JB(895)](...e){const t=698,s=696,i=JB;try{return this[i(t)][i(895)](),oL[i(s)]}catch(n){if(n instanceof WL)return n[i(627)]();throw n}}},JB(837)),v),gL=(eL(g=class{static[JB(883)](){const e=811,t=521,s=JB,i=new Map([]);for(const[n,r]of this.variables.entries())i[s(e)](n,r);this[s(t)].push(i)}static[JB(725)](){const e=850,t=JB,s=this[t(521)].pop();if(!s)throw new Error("Variables stack undefined");this[t(e)]=s}static[JB(576)](e){return this[JB(850)].has(e)}static[JB(732)](e){const t=732,s=696,i=JB;return this[i(850)][i(t)](e)||oL[i(s)]}static[JB(811)](e,t){const s=JB;this[s(850)][s(811)](e,t)}},"Variables"),Mt(g,"stack",[]),Mt(g,"variables",new Map([["PI",new oL(Math.PI)],["E",new oL(Math.E)]])),g),mL=(eL(b=class{constructor(e,t,s){Mt(this,x),Mt(this,_),Mt(this,m);const i=640,n=529,r=JB;this.variable=e,this[r(i)]=t,this[r(n)]=s}get[(x=JB(861),_=JB(640),m=JB(529),JB(858))](){return this[JB(861)]}get[JB(803)](){return this[JB(640)]}[JB(586)](){const e=JB,t=this.lastIndex();return this[e(778)]().get(t)}[JB(498)](){const e=JB;return this[e(598)](this.indexes[e(638)]-1)}[JB(598)](e){const t=695,s=JB;return this[s(640)][e][s(586)]()[s(t)]()}[JB(778)](){const e=732,t=861,s=640,i=700,n=598,r=JB;let o=this.consumeArray(gL[r(e)](this[r(t)]));const a=this[r(s)].length-1;for(let l=0;l<a;l++)o=this[r(i)](o.get(this[r(n)](l)));return o}[JB(700)](e){if(e instanceof rL)return e;throw new Error(JB(607))}[JB(551)](){return""+(this[JB(861)]+this.indexes)}},JB(714)),b),_L=(eL(k=class{constructor(e,t,s){Mt(this,S),Mt(this,w),Mt(this,y);const i=JB;this[i(702)]=e,this[i(510)]=t,this[i(529)]=s}[(S=JB(702),w=JB(510),y=JB(529),JB(895))](){const e=JB;this.array[e(778)]()[e(811)](this[e(702)].lastIndex(),this.expression.eval())}[JB(551)](){const e=JB;return this[e(702)]+" = "+this[e(510)]}},JB(872)),k),xL=(eL(C=class{constructor(e,t){Mt(this,"elements"),Mt(this,"token");const s=529,i=JB;this[i(558)]=e,this[i(s)]=t}[JB(586)](){const e=792,t=JB,s=this[t(558)][t(e)](e=>e.eval());return new rL(s)}[JB(551)](){const e=551,t=JB;return""+this[t(558)][t(e)]()}},JB(643)),C),bL=(eL(M=class{constructor(e,t,s){Mt(this,"variable"),Mt(this,N),Mt(this,j);const i=510,n=JB;this[n(861)]=e,this[n(i)]=t,this.token=s}execute(){const e=586,t=811,s=JB,i=this[s(510)][s(e)]();gL[s(t)](this[s(861)],i)}[(N=JB(510),j=JB(529),JB(551))](){const e=510,t=JB;return this[t(861)]+" = "+this[t(e)]}},"AssignmentStatement"),M),yL=(eL(P=class{constructor(e,t,s,i){Mt(this,E),Mt(this,D),Mt(this,L),Mt(this,B);const n=JB;this.operation=e,this[n(900)]=t,this[n(748)]=s,this[n(529)]=i}[(E=JB(656),D=JB(900),L=JB(748),B=JB(529),JB(586))](){const e=654,t=586,s=597,i=900,n=748,r=656,o=JB,a=this[o(900)][o(586)]();if(a instanceof pL||a instanceof rL){const i=a[o(e)](),n=this.expr2[o(t)]()[o(654)]();if("+"===this[o(656)])return new pL(i+n);throw new Error(o(s))}const l=this[o(i)].eval()[o(695)](),c=this[o(n)][o(586)]()[o(695)]();switch(this[o(r)]){case"-":return new oL(l-c);case"+":return new oL(l+c);case"/":return new oL(l/c);default:return new oL(l*c)}}[JB(551)](){const e=JB;return this[e(900)]+" "+this[e(656)]+" "+this.expr2}},JB(812)),P),wL=(eL(R=class{constructor(e){Mt(this,"statements",[]),Mt(this,"token");this[JB(529)]=e}[JB(847)](e){this[JB(887)].push(e)}[JB(895)](){const e=JB;for(const t of this[e(887)])t[e(895)]()}toString(){const e=JB;return""+this[e(887)][e(583)]("\n")}},JB(815)),R),SL=(eL(z=class extends Error{constructor(e){super("BreakStatement"),Mt(this,A),this.token=e}[(A=JB(529),JB(895))](){throw this}toString(){return"break"}},JB(852)),z),kL=(e=>{const t=544,s=542,i=502,n=JB;return e[n(680)]="+",e[n(634)]="-",e[n(649)]="*",e[n(t)]="/",e.EQ="==",e[n(877)]="!=",e.SEQ="===",e[n(s)]=n(727),e.LT="<",e[n(i)]="<=",e.GT=">",e.GTE=">=",e.AND="&&",e.OR="||",e})(kL||{});eL(function(e){const t=756,s=JB;for(const[i,n]of Object[s(t)](kL))if(n===e)return i;return"EQ"},JB(665));var CL=(eL(O=class{constructor(e,t,s,i){Mt(this,I),Mt(this,T),Mt(this,"expr2"),Mt(this,"token");const n=748,r=529,o=JB;this[o(656)]=e,this[o(900)]=t,this[o(n)]=s,this[o(r)]=i}[(I=JB(656),T=JB(900),JB(586))](){const e=586,t=586,s=656,i=695,n=654,r=748,o=586,a=JB,l=this[a(900)][a(e)](),c=this[a(748)][a(t)]();if(this[a(656)]===a(541)||this[a(s)]===a(727)){let e;return e=l instanceof pL&&c instanceof pL?l.asString()===c.asString():l instanceof oL&&c instanceof oL&&l[a(i)]()===c[a(695)](),new oL(this[a(s)]===a(541)?e:!e)}let h,u,d;switch(l instanceof pL?(h=h=l[a(654)]()[a(556)](c[a(n)]()),u=0):(h=this[a(900)].eval()[a(695)](),u=this[a(r)][a(o)]().asNumber()),this[a(656)]){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 oL(d)}[JB(551)](){const e=656,t=JB;return this[t(900)]+" "+this[t(e)]+" "+this[t(748)]}},JB(613)),O),jL=(eL(F=class extends Error{constructor(e){super(JB(721)),Mt(this,H),this.token=e}execute(){throw this}[(H=JB(529),JB(551))](){return JB(547)}},JB(721)),F),NL=(eL(q=class{constructor(e,t,s){Mt(this,U),Mt(this,K),Mt(this,W);const i=529,n=JB;this[n(873)]=e,this.statement=t,this[n(i)]=s}execute(){const e=895,t=586,s=695,i=JB;do{try{this[i(741)][i(e)]()}catch(n){if(n instanceof SL)break;if(!(n instanceof jL))throw n}}while(0!=this[i(873)][i(t)]()[i(s)]())}[(U=JB(873),K=JB(741),W=JB(529),JB(551))](){const e=777,t=873,s=JB;return"do {\n"+this[s(741)]+s(e)+this[s(t)]+")\n"}},JB(851)),q),ML=(eL(X=class{constructor(e,t,s,i,n){Mt(this,G),Mt(this,Y),Mt(this,$),Mt(this,"block"),Mt(this,V);const r=JB;this.initialization=e,this.termination=t,this[r(570)]=s,this.block=i,this[r(529)]=n}[(G=JB(892),Y=JB(639),$=JB(570),V=JB(529),JB(895))](){const e=570,t=JB;for(this[t(892)].execute();0!=this.termination.eval()[t(695)]();this[t(e)].execute())try{this[t(511)].execute()}catch(s){if(s instanceof SL)break;if(!(s instanceof jL))throw s}}toString(){const e=639,t=902,s=JB;return s(635)+this[s(892)]+"; "+this[s(e)]+"; "+this.increment+s(t)+this[s(511)]+"\n}"}},"ForStatement"),X),BL=(eL(ee=class{constructor(e,t,s,i){Mt(this,"name"),Mt(this,Q),Mt(this,J),Mt(this,Z);const n=JB;this.name=e,this[n(616)]=t,this[n(698)]=s,this.token=i}[(Q=JB(616),J=JB(698),Z=JB(529),JB(895))](){const e=JB;aL[e(811)](this.name,new vL(this[e(616)],this[e(698)]))}toString(){const e=583,t=644,s=JB,i=this[s(616)].map(e=>e[s(551)]())[s(e)](", ");return"function "+this[s(t)]+"("+i+")"}},JB(829)),ee),LL=(eL(te=class{constructor(e,t){Mt(this,"functionalExpression"),Mt(this,"token");const s=JB;this[s(595)]=e,this[s(529)]=t}[JB(895)](){const e=JB;this[e(595)][e(586)]()}[JB(551)](){return""+this[JB(595)].toString()}},JB(896)),te),DL=(eL(re=class{constructor(e,t,s){Mt(this,ne),Mt(this,ie),Mt(this,se);const i=JB;this[i(644)]=e,this[i(904)]=t,this[i(529)]=s}addArgument(e){const t=JB;return this[t(904)][t(883)](e)}[(ne=JB(644),ie=JB(904),se=JB(529),JB(586))](){const e=792,t=644,s=633,i=883,n=670,r=895,o=895,a=JB,l=this[a(904)][a(e)](e=>e.eval()),c=l[a(638)],h=aL[a(732)](this[a(t)]);if(h instanceof vL){const e=h;if(l.length!==e[a(603)]())throw new Error(a(s)+this[a(t)]+a(495)+c);gL[a(i)]();for(let t=0;t<c;t++)gL[a(811)](e[a(n)](t),l[t]);const o=e[a(r)](...l);return gL.pop(),o}return h[a(o)](...l)}[JB(551)](){const e=JB,t=this[e(904)][e(792)](e=>e.toString())[e(583)](", ");return this.name+"("+t+")"}},JB(645)),re),EL=(eL(ce=class{constructor(e,t,s,i){Mt(this,le),Mt(this,"ifStatement"),Mt(this,ae),Mt(this,oe);const n=797,r=JB;this[r(510)]=e,this[r(651)]=t,this[r(n)]=s,this[r(529)]=i}execute(){const e=695,t=797,s=895,i=JB;0!=this[i(510)][i(586)]()[i(e)]()?this[i(651)].execute():null!=this[i(t)]&&this[i(t)][i(s)]()}[(le=JB(510),ae=JB(797),oe=JB(529),JB(551))](){const e=651,t=797,s=JB;let i="if "+this[s(510)]+" "+this[s(e)];return null!=this[s(t)]&&(i+=s(553)+this[s(797)]),i[s(551)]()}},JB(846)),ce),PL=(e=>{const t=751,s=751,i=744,n=530,r=JB;return e[e[r(624)]=0]=r(624),e[e[r(t)]=1]=r(s),e[e[r(744)]=2]=r(i),e[e[r(n)]=3]=r(n),e})(PL||{}),RL=(eL(ue=class{constructor(e,t,s){Mt(this,he),Mt(this,"type"),Mt(this,"token");const i=JB;this[i(861)]=e,this[i(794)]=t,this[i(529)]=s}[(he=JB(861),JB(586))](){const e=690,t=695,s=794,i=JB,n=this[i(861)].getName(),r=gL[i(732)](n);if(!(r instanceof oL))throw new Error(i(e));const o=r[i(t)]();let a;switch(this[i(s)]){case 0:return a=o+1,gL.set(n,new oL(a)),new oL(a);case 1:return a=o-1,gL.set(n,new oL(a)),new oL(a);case 2:return gL.set(n,new oL(o+1)),new oL(o);case 3:return gL.set(n,new oL(o-1)),new oL(o)}}},JB(824)),ue),AL=(eL(de=class{constructor(e,t){Mt(this,"expression"),Mt(this,"token");const s=JB;this[s(510)]=e,this[s(529)]=t}[JB(895)](){const e=JB;this[e(510)][e(586)]()}},JB(791)),de),zL=(eL(me=class{constructor(e,t,s,i){Mt(this,ge),Mt(this,ve),Mt(this,pe),Mt(this,fe);const n=JB;this[n(826)]=e,this.name=t,this[n(904)]=s,this.token=i}[(ge=JB(826),ve=JB(644),pe=JB(904),fe=JB(529),JB(586))](){throw new Error(JB(687))}[JB(551)](){const e=583,t=JB,s=this[t(904)][t(792)](e=>e.toString())[t(e)](", ");return this.receiver[t(551)]()+"."+this.name+"("+s+")"}},"MemberCallExpression"),me),TL=(eL(we=class{constructor(e,t,s,i){Mt(this,ye),Mt(this,be),Mt(this,xe),Mt(this,_e);const n=JB;this.name=e,this[n(616)]=t,this.body=s,this[n(529)]=i}[(ye=JB(644),be=JB(616),xe=JB(698),_e=JB(529),JB(895))](){}[JB(551)](){const e=792,t=644,s=JB,i=this[s(616)][s(e)](e=>e[s(551)]())[s(583)](", ");return s(764)+this[s(644)]+"("+i+")\n"+this.body+s(621)+this[s(t)]}},"MetaBlockStatement"),we),IL=(eL(ke=class{constructor(e=new Map,t){Mt(this,Se),Mt(this,"token");const s=JB;this[s(868)]=e,this[s(529)]=t}[(Se=JB(868),JB(586))](){const e=868,t=762,s=JB,i=new Map;return this[s(e)][s(t)]((e,t)=>{i[s(811)](t,e.eval())}),new lL(i)}[JB(551)](){const e=868,t=792,s=JB;return"{"+Array.from(this[s(e)][s(756)]())[s(t)](([e,t])=>e+": "+t[s(551)]()).join(", ")+"}"}},JB(775)),ke),OL=(eL(Ne=class{constructor(e,t){Mt(this,je),Mt(this,Ce);const s=JB;this.expression=e,this[s(529)]=t}[(je=JB(510),Ce=JB(529),JB(895))](){const e=JB,t=this.expression[e(586)]()[e(654)]();console.log(""+t)}[JB(551)](){const e=JB;return e(685)+this[e(510)]}},JB(713)),Ne),HL=(eL(Be=class{constructor(e,t,s){Mt(this,Me),Mt(this,"name"),Mt(this,"token");this[JB(826)]=e,this.name=t,this.token=s}eval(){throw new Error(JB(823))}[(Me=JB(826),JB(551))](){const e=JB;return this[e(826)][e(551)]()+"."+this[e(644)]}},JB(759)),Be),FL=(eL(Re=class{constructor(e,t,s){Mt(this,Pe),Mt(this,Ee),Mt(this,De),Mt(this,Le);const i=512,n=JB;this[n(529)]=s,this[n(752)]=e,this[n(788)]=t,this[n(i)]=new cL(e,t)}eval(){return this[JB(512)]}[(Pe=JB(529),Ee=JB(752),De=JB(788),Le=JB(512),JB(551))](){const e=JB;return this[e(512)][e(654)]()}},"RegExpExpression"),Re),WL=(eL(Te=class extends Error{constructor(e,t){const s=JB;super(s(721)),Mt(this,ze),Mt(this,Ae),Mt(this,"token"),this[s(510)]=e,this[s(529)]=t}getResult(){const e=JB;if(!this[e(516)])throw new Error("Not execute ReturnStatement");return this[e(516)]}[(ze=JB(510),Ae=JB(516),JB(895))](){const e=JB;throw this[e(516)]=this[e(510)][e(586)](),this}[JB(551)](){return JB(724)}},"ReturnStatement"),Te),KL=(e=>{const t=888,s=857,i=537,n=704,r=514,o=557,a=753,l=680,c=773,h=634,u=634,d=758,f=779,p=525,v=853,g=620,m=692,_=893,x=793,b=749,y=838,w=838,S=599,k=796,C=737,j=770,N=746,M=782,B=561,L=683,D=JB;return e[e[D(593)]=0]=D(593),e[e.WORD=1]="WORD",e[e[D(664)]=2]=D(664),e[e[D(t)]=3]=D(888),e[e[D(881)]=4]="VAR",e[e[D(s)]=5]="PRINT",e[e.IF=6]="IF",e[e[D(537)]=7]=D(i),e[e[D(562)]=8]=D(562),e[e[D(704)]=9]=D(n),e[e.DO=10]="DO",e[e.BREAK=11]=D(r),e[e[D(o)]=12]="CONTINUE",e[e[D(a)]=13]=D(753),e[e[D(584)]=14]=D(584),e[e[D(828)]=15]="STEP",e[e[D(l)]=16]="PLUS",e[e[D(c)]=17]="PLUSPLUS",e[e[D(h)]=18]=D(u),e[e[D(d)]=19]="MINUSMINUS",e[e[D(f)]=20]=D(779),e[e.SLASH=21]="SLASH",e[e.EQ=22]="EQ",e[e.EQEQ=23]=D(p),e[e[D(807)]=24]=D(807),e[e[D(v)]=25]=D(853),e[e[D(g)]=26]=D(620),e[e[D(m)]=27]="EXCLEQEQ",e[e.LT=28]="LT",e[e[D(579)]=29]=D(579),e[e.GT=30]="GT",e[e[D(_)]=31]=D(_),e[e.BAR=32]=D(x),e[e[D(b)]=33]=D(749),e[e[D(y)]=34]=D(w),e[e[D(612)]=35]="AMPAMP",e[e.LPAREN=36]=D(S),e[e[D(796)]=37]=D(k),e[e.LBRACE=38]="LBRACE",e[e.RBRACE=39]="RBRACE",e[e[D(C)]=40]=D(737),e[e[D(j)]=41]=D(j),e[e.COMMA=42]=D(N),e[e[D(M)]=43]="COLON",e[e[D(736)]=44]="SEMICOLON",e[e[D(561)]=45]=D(B),e[e.ARROW=46]=D(L),e[e[D(600)]=47]="META_BLOCK",e[e[D(496)]=48]=D(496),e[e[D(890)]=49]="EOF",e})(KL||{}),UL=(eL(He=class{constructor(e,t){Mt(this,Oe),Mt(this,Ie);const s=JB;if(this.token=t,0!==t.getType()){if(2!==t[s(646)]())throw new Error(s(903)+t);this.value=new pL(e)}else this[s(512)]=new oL(parseFloat(e))}[(Oe=JB(512),Ie=JB(529),JB(586))](){return this[JB(512)]}[JB(551)](){const e=JB;return""+this.value[e(654)]()}},"ValueExpression"),He),qL=(eL(qe=class{constructor(e,t,s,i={}){Mt(this,Ue),Mt(this,Ke),Mt(this,We),Mt(this,Fe),Mt(this,"options");const n=776,r=JB;this[r(684)]=e,this.body=t,this[r(529)]=s,this[r(n)]=i[r(776)]??!1,this[r(832)]=i[r(832)]??null}[(Ue=JB(684),Ke=JB(698),We=JB(529),Fe=JB(776),JB(601))](){const e=JB;return this[e(832)]instanceof IL?this.options.properties[e(732)](e(549)):void 0}[JB(895)](){}[JB(559)](){const e=JB;return this[e(684)]instanceof UL?this[e(684)][e(512)][e(654)]():""}[JB(551)](){const e=734,t=832,s=684,i=642,n=698,r=662,o=JB,a=this[o(776)]?o(e):"step",l=this[o(t)]?this[o(832)]+", ":"";return a+"("+this[o(s)]+", "+l+o(i)+this[o(n)]+o(r)}},JB(606)),qe),VL=(eL(Ye=class{constructor(e,t,s){Mt(this,$e),Mt(this,Ve),Mt(this,"token");const i=JB;this[i(688)]=e,this[i(864)]=t,this[i(529)]=s}eval(){const e=586,t=695,s=JB;return"-"===this.operator?new oL(-this[s(864)][s(e)]()[s(t)]()):new oL(this[s(864)][s(586)]()[s(t)]())}[($e=JB(864),Ve=JB(688),JB(551))](){const e=JB;return""+this[e(688)]+this[e(864)]}},"UnaryExpression"),Ye),$L=(eL(Xe=class{[(Ge=JB(663),JB(609))](){return Xe.UNDEFINED}[JB(695)](){return NaN}[JB(654)](){return JB(669)}[JB(551)](){return this[JB(654)]()}},"UndefinedValue"),Mt(Xe,Ge,new Xe),Xe),YL=(eL(Je=class{constructor(e,t){Mt(this,"declarators"),Mt(this,Ze);const s=JB;this[s(708)]=e,this[s(529)]=t}[(Ze=JB(529),JB(895))](){const e=586,t=811,s=JB;for(const i of this.declarators)if(i[s(667)]){const t=i.init[s(e)]();gL.set(i.name,t)}else gL[s(t)](i.name,$L.UNDEFINED)}[JB(551)](){const e=583,t=JB;return"var "+this[t(708)][t(792)](e=>e[t(667)]?e.name+t(503)+e[t(667)]:e[t(644)])[t(e)](", ")}},"VarStatement"),Je),GL=(eL(et=class{constructor(e,t){Mt(this,"name"),Mt(this,Qe);const s=529,i=JB;this[i(644)]=e,this[i(s)]=t}[(Qe=JB(529),JB(586))](){const e=644,t=780,s=500,i=732,n=JB;if(!gL[n(576)](this[n(e)]))throw new Error(n(t)+this[n(e)]+n(s));return gL[n(i)](this.name)}[JB(795)](){return this[JB(644)]}toString(){return""+this[JB(644)]}},JB(564)),et),XL=(eL(it=class{constructor(e,t,s){Mt(this,st),Mt(this,"statement"),Mt(this,tt);const i=JB;this[i(873)]=e,this[i(741)]=t,this.token=s}[(st=JB(873),tt=JB(529),JB(895))](){const e=873,t=586,s=695,i=JB;for(;0!=this[i(e)][i(t)]()[i(s)]();)try{this[i(741)][i(895)]()}catch(n){if(n instanceof SL)break;if(!(n instanceof jL))throw n}}[JB(551)](){const e=902,t=741,s=JB;return"while ("+this[s(873)]+s(e)+this[s(t)]+"\n}"}},JB(831)),it),ZL=(eL(at=class extends(ot=Error,rt=JB(522),nt=JB(860),ot){constructor(e,t,s){const i=JB;super(e),Mt(this,rt),Mt(this,nt),this[i(644)]="ParseError",this[i(522)]=t,this.column=s}static at(e,t){const s=JB;return new at(t,e[s(505)](),e[s(867)]())}},JB(659)),at),JL=(eL(ut=class{constructor(e,t,s,i){Mt(this,ht),Mt(this,"type"),Mt(this,ct),Mt(this,lt);const n=JB;this.type=e,this[n(493)]=t,this[n(860)]=s,this.line=i}[(ht=JB(493),ct=JB(860),lt=JB(522),JB(894))](){return this[JB(493)]}[JB(646)](){return this[JB(794)]}[JB(505)](){return this.line}getColumn(){return this[JB(860)]}[JB(551)](){const e=794,t=800,s=JB;return s(629)+KL[this[s(e)]]+s(731)+this[s(493)]+s(531)+this.line+s(t)+this.column+")"}},"Token"),ut);function QL(e){const t=884,s=551,i=JB,n=Number(e);return!isNaN(n)&&e[i(t)]()===n[i(s)]()}function eD(e){return/^[a-zA-Zа-яА-ЯёЁ_$]$/[JB(833)](e)}function tD(e){return/^[a-zA-Zа-яА-ЯёЁ0-9_$]$/[JB(833)](e)}eL(QL,"isNumber"),eL(eD,JB(494)),eL(tD,JB(619));var sD=new Set([0,1,2,4,37,41,17,19]);function iD(e){return!sD[JB(545)](e)}eL(iD,JB(674));var nD=(eL(bt=class{constructor(e){Mt(this,xt,JB(875)),Mt(this,_t,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],[JB(541),24],["!=",26],[JB(727),27],["<=",29],[">=",31],["=>",46],["&&",35],["||",33]])),Mt(this,mt),Mt(this,gt),Mt(this,vt,[]),Mt(this,pt,0),Mt(this,ft,1),Mt(this,"line",1),Mt(this,dt,[]);const t=JB;this[t(755)]=e,this[t(638)]=e.length}[(xt=JB(869),_t=JB(760),mt=JB(755),gt=JB(638),vt=JB(768),pt=JB(906),ft=JB(860),dt=JB(618),JB(682))](){const e=527,t=574,s=842,i=520,n=801,r=668,o=533,a=768,l=JB;for(;this.pos<this.length;){const a=this[l(e)](0);if(QL(a))this[l(t)]();else if(eD(a))this[l(536)]();else if('"'===a||"'"===a)this[l(701)](a);else if("`"===a)this[l(s)]();else if("//@"===this[l(891)](3))this[l(i)]();else if("/"===a&&this[l(693)]())this.tokenizeRegex();else if(-1!==this[l(869)].indexOf(a))this[l(n)]();else{if(" "!==a&&"\t"!==a&&"\r"!==a&&"\n"!==a&&"\ufeff"!==a)throw new ZL(" "===a?l(r):l(o)+JSON.stringify(a),this[l(522)],this[l(860)]);this[l(827)]()}}return this[l(a)]}regexContextAllowed(){const e=JB;if("/"===this[e(527)](1)||"*"===this[e(527)](1))return!1;const t=0===this[e(768)][e(638)]?null:this.tokens[this.tokens.length-1];return null===t||iD(t[e(646)]())}[JB(705)](){const e=522,t=660,s=883,i=527,n=827,r=583,o=JB,a=this[o(860)],l=this[o(e)];this[o(827)]();const c=[];let h=!1,u=this[o(527)](0);for(;"\0"!==u;){if("\n"===u||"\r"===u)throw new ZL(o(587),l,a);if("\\"!==u)if("["!==u||h)if("]"===u&&h)h=!1,c[o(883)](u),u=this.next();else{if("/"===u&&!h)break;c[o(883)](u),u=this.next()}else h=!0,c[o(s)](u),u=this[o(827)]();else{if(c.push(u),u=this[o(827)](),"\0"===u||"\n"===u||"\r"===u)throw new ZL(o(t),l,a);c[o(883)](u),u=this[o(827)]()}}if("/"!==u)throw new ZL(o(804),l,a);this[o(827)]();const d=[];for(u=this[o(i)](0);"\0"!==u&&tD(u);)d[o(883)](u),u=this[o(n)]();this.addToken(3,c[o(583)]("")+"\0"+d[o(r)](""),a,l)}[JB(827)](){const e=843,t=522,s=527,i=JB,n=this[i(755)][i(e)](this[i(906)]);return this[i(906)]++,"\n"==n?(this[i(t)]++,this[i(860)]=1):this.column++,this[i(s)](0)}[JB(527)](e){const t=JB,s=this[t(906)]+e;return s>=this.length?"\0":this[t(755)][t(843)](s)}[JB(891)](e){const t=527,s=JB,i=[];for(let n=0;n<e;n++)i[s(883)](this[s(t)](n));return i[s(583)]("")}[JB(898)](e,t,s,i){const n=JB;this.tokens[n(883)](new JL(e,t,s,i))}[JB(574)](){const e=527,t=637,s=585,i=522,n=860,r=827,o=JB,a=this.column,l=this.line,c=[];let h=this[o(e)](0);for(;"\0"!==h;){if("."==h){if(-1!==c[o(t)]("."))throw new ZL(o(s),this[o(i)],this[o(n)])}else if(!QL(h))break;c.push(h),h=this[o(r)]()}this[o(898)](0,c[o(583)](""),a,l)}consumeWord(){const e=JB,t=[];let s=this[e(527)](0);for(;"\0"!==s&&tD(s);)t[e(883)](s),s=this[e(827)]();return t[e(583)]("")}[JB(520)](){const e=827,t=717,s=898,i=898,n=JB,r=this[n(860)],o=this[n(522)];this[n(e)](),this[n(827)](),this[n(827)]();const a=this[n(783)]();a[n(t)](n(568))?this[n(s)](48,a,r,o):this[n(i)](47,a,r,o)}[JB(536)](){const e=898,t=781,s=547,i=898,n=898,r=JB,o=this[r(860)],a=this[r(522)],l=this[r(783)]();switch(l){case r(901):this[r(898)](4,"",o,a);break;case r(733):this[r(e)](5,"",o,a);break;case"if":this.addToken(6,"",o,a);break;case r(625):this[r(e)](7,"",o,a);break;case r(675):this[r(e)](9,"",o,a);break;case r(678):this[r(e)](8,"",o,a);break;case"do":this[r(898)](10,"",o,a);break;case r(t):this[r(898)](11,"",o,a);break;case r(s):this[r(e)](12,"",o,a);break;case"function":this[r(i)](13,"",o,a);break;case"return":this[r(i)](14,"",o,a);break;case r(610):this.addToken(15,"",o,a);break;default:this[r(n)](1,l,o,a)}}tokenizeText(e){const t=883,s=827,i=883,n=827,r=JB,o=this[r(860)],a=this.line;this.next();const l=[];let c=this[r(527)](0);for(;"\0"!==c;)if("\\"!=c){if(c==e)break;l[r(i)](c),c=this[r(n)]()}else{switch(c=this[r(827)](),c){case e:c=this[r(827)](),l.push(e);continue;case"n":c=this.next(),l[r(t)]("\n");continue;case"t":c=this[r(827)](),l[r(883)]("\t");continue;case"\\":c=this[r(s)](),l[r(t)]("\\");continue}l.push("\\"),"\0"!==c&&(l[r(883)](c),c=this[r(827)]())}if("\0"===c)throw new ZL(r(855),a,o);this[r(827)]();const h=l[r(583)]("");this[r(898)](2,h,o,a)}[JB(842)](){const e=527,t=883,s=827,i=JB,n=this[i(860)],r=this[i(522)];this[i(827)]();const o=[];let a=this[i(527)](0);for(;"\0"!==a&&"`"!==a;){if("$"===a&&"{"===this[i(e)](1))throw new ZL(i(699),this.line,this.column);o[i(t)](a),a=this.next()}if("\0"===a)throw new ZL("Missing close backtick in raw string literal",r,n);this[i(s)](),this.addToken(2,o[i(583)](""),n,r)}[JB(647)](e,t){const s=772,i=637,n=JB,r=[];let o=this[n(527)](0);for(;-1==n(s)[n(i)](o);)r.push(o),o=this.next();this[n(618)][n(883)]({line:e,column:t,text:r[n(583)]("").trim()})}[JB(572)](e,t){const s=527,i=883,n=827,r=730,o=827,a=884,l=JB,c=[];let h=this[l(527)](0);for(;"\0"!=h&&("*"!=h||"/"!=this[l(s)](1));)c[l(i)](h),h=this[l(n)]();if("\0"==h)throw new ZL(l(r),e,t);this[l(o)](),this.next(),this.comments.push({line:e,column:t,text:c[l(583)]("")[l(a)]()})}[JB(801)](){const e=527,t=522,s=860,i=827,n=827,r=760,o=583,a=760,l=732,c=898,h=JB;let u=this[h(e)](0);if("/"==u){const r=this[h(t)],o=this[h(s)];if("/"==this[h(527)](1))return this[h(827)](),this[h(i)](),void this[h(647)](r,o);if("*"==this[h(e)](1))return this[h(n)](),this[h(n)](),void this[h(572)](r,o)}const d=this[h(860)],f=this.line,p=[];for(;"\0"!==u;){const e=p[h(583)]("");if(!this.OPERATORS.has(e+u)&&""!=e){const t=this[h(r)].get(e);if(!t)throw new ZL(h(862)+e,f,d);return void this[h(898)](t,"",d,f)}p[h(883)](u),u=this.next()}const v=p[h(o)]("");if(""!==v){const e=this[h(a)][h(l)](v);if(e)return void this[h(c)](e,"",d,f)}throw new ZL(h(739),f,d)}},"Lexer"),bt);function rD(e,t,s,i=2){const n=638,r=883,o=565,a=883,l=567,c=491,h=883,u=750,d=769,f=565,p=583,v=JB,g=e[v(870)](/\r\n|\n|\r/),m=Math[v(567)](Math.max(t,1),g.length),_=Math[v(491)](1,m-i),x=Math.min(g[v(n)],m+i),b=String(x)[v(n)],y=[];for(let w=_;w<=x;w++){const e=g[w-1]??"",t=String(w).padStart(b);if(w!==m){y[v(r)](" "+t+v(o)+e);continue}y[v(a)](v(697)+t+" | "+e);const i=Math[v(l)](Math[v(c)](s,1),e[v(638)]+1)-1;y[v(h)](v(u)+" "[v(d)](b)+v(f)+" "[v(769)](i)+"^")}return y[v(p)]("\n")}eL(rD,JB(681)),eL(function(e,t){const s=615,i=860,n=JB;return t[n(856)]+" (line "+t.line+n(s)+t[n(i)]+")\n"+rD(e,t.line,t.column)},JB(694));var oD=(eL(jt=class{constructor(e){Mt(this,Ct,new JL(49,"",-1,-1)),Mt(this,kt,[]),Mt(this,St,0),Mt(this,wt);const t=JB;this[t(768)]=e,this[t(679)]=e[t(638)]}parse(){const e=JB,t=this[e(732)](0),s=new wL(t);for(;!this[e(863)](49);)s[e(847)](this[e(741)]()),this[e(863)](44);return s}statementOrBlock(){const e=646,t=511,s=JB;return 38===this[s(732)](0)[s(e)]()?this[s(t)]():this[s(741)]()}[(Ct=JB(890),kt=JB(768),St=JB(906),wt=JB(679),JB(652))](e){const t=847,s=741,i=863,n=JB,r=this[n(732)](0),o=new wL(r);for(;!this[n(863)](48);)o[n(t)](this[n(s)]()),this[n(i)](44);return o}[JB(641)](){const e=767,t=894,s=863,i=883,n=JB,r=this[n(732)](0),o=this[n(e)](47)[n(t)]();this[n(767)](36);const a=[];for(;!this[n(s)](37);)a[n(i)](this[n(767)](2)[n(894)]()),this[n(863)](42);const l=this.blockMetaBlock(o);return new TL(o,a,l,r)}[JB(719)](e){const t=767,s=510,i=767,n=767,r=767,o=JB;let a=!1;if(this[o(863)](45)){const e=this.consume(1);if(e[o(894)]()!==o(776))throw ZL.at(e,o(787)+e[o(894)]()+'" — the only one is step.soft(...).');a=!0}this[o(t)](36);const l=this[o(s)]();this[o(i)](42);let c=null;this.lookMatch(0,38)&&(c=this[o(510)](),this.consume(42)),this.consume(36),this[o(n)](37),this[o(r)](46);const h=this[o(511)]();return this[o(767)](37),new qL(l,h,e,{soft:a,options:c})}block(){const e=767,t=863,s=741,i=863,n=JB,r=this.get(0),o=new wL(r);for(this[n(e)](38);!this[n(t)](39);)o[n(847)](this[n(s)]()),this[n(i)](44);return o}[JB(741)](){const e=841,t=510,s=863,i=863,n=863,r=501,o=722,a=722,l=658,c=805,h=658,u=648,d=767,f=894,p=863,v=JB,g=this.get(0);if(this.match(4))return this[v(e)](g);if(this[v(863)](5))return new OL(this[v(t)](),g);if(this[v(s)](6))return this.ifElse(g);if(this[v(s)](8))return this.whileStatement(g);if(this[v(i)](10))return this[v(789)](g);if(this[v(n)](11))return new SL(g);if(this.match(12))return new jL(g);if(this[v(863)](14))return new WL(this[v(510)](),g);if(this.match(9))return this[v(r)](g);if(this[v(n)](13))return this[v(636)](g);if(this[v(863)](15))return this[v(719)](g);if(this[v(o)](0,47))return this[v(641)]();if(this[v(722)](0,1)&&this[v(a)](1,36)){const e=this[v(l)](this[v(c)](g));return new LL(e,g)}if(this[v(722)](0,1)&&this.lookMatch(1,45)){const e=new GL(this.consume(1).getText(),g),t=this[v(h)](e);if(!(t instanceof zL))throw ZL.at(g,v(u));return new LL(t,g)}if(this.match(17)){const e=new GL(this[v(d)](1)[v(f)](),g);return new AL(new RL(e,0,g),g)}if(this[v(863)](19)){const e=new GL(this[v(767)](1).getText(),g);return new AL(new RL(e,1,g),g)}if(this.lookMatch(0,1)&&(this.lookMatch(1,17)||this[v(o)](1,19))){const e=this[v(767)](1),t=new GL(e.getText(),e);return this[v(p)](17)?new AL(new RL(t,2,e),e):(this[v(767)](19),new AL(new RL(t,3,e),e))}return this[v(519)]()}[(yt=JB(605),JB(841))](e){const t=894,s=816,i=799,n=JB,r=[];do{const e=this[n(767)](1),o=e[n(t)]();if(jt[n(605)].has(o))throw ZL.at(e,n(s)+o+n(i));let a=null;this[n(863)](22)&&(a=this.expression()),r[n(883)]({name:o,init:a})}while(this[n(863)](42));return new YL(r,e)}[JB(519)](){const e=722,t=722,s=767,i=894,n=722,r=632,o=889,a=646,l=JB,c=this[l(732)](0);if(this[l(e)](0,1)&&this[l(t)](1,22)){const e=this[l(s)](1)[l(i)]();return this.consume(22),new bL(e,this[l(510)](),c)}if(this[l(n)](0,1)&&this.lookMatch(1,40)){const e=this[l(r)](c);return this[l(767)](22),new _L(e,this[l(510)](),c)}throw ZL.at(this[l(732)](0),l(o)+KL[this.get(0)[l(a)]()])}[JB(882)](e){const t=747,s=863,i=747,n=JB,r=this[n(510)](),o=this[n(t)]();let a;return a=this[n(s)](7)?this[n(i)]():null,new EL(r,o,a,e)}doWhileStatement(e){const t=JB,s=this.statementOrBlock();this[t(767)](8);const i=this.expression();return new NL(i,s,e)}[JB(738)](e){const t=JB,s=this.expression(),i=this[t(747)]();return new XL(s,i,e)}forStatement(e){const t=732,s=JB;let i;if(this[s(767)](36),this[s(863)](4))throw ZL.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)'.");i=this[s(519)](),this.consume(44);const n=this[s(510)]();this[s(767)](44);const r=this[s(741)]();this[s(767)](37);const o=this.statementOrBlock();return new ML(i,n,r,o,e)}functionDefine(e){const t=767,s=894,i=863,n=JB,r=this[n(t)](1)[n(s)]();this[n(t)](36);const o=[];for(;!this[n(i)](37);)o[n(883)](this[n(767)](1)[n(s)]()),this[n(863)](42);const a=this.statementOrBlock();return new BL(r,o,a,e)}functionExpression(e){const t=767,s=863,i=JB,n=this[i(767)](1)[i(894)]();this[i(t)](36);const r=new DL(n,[],e);for(;!this[i(863)](37);)r.addArgument(this.expression()),this[i(s)](42);return r}[JB(632)](e){const t=894,s=722,i=JB,n=this[i(767)](1)[i(t)](),r=[];do{this[i(767)](40),r[i(883)](this[i(510)]()),this.consume(41)}while(this[i(s)](0,40));return new mL(n,r,e)}[JB(716)](e){const t=883,s=JB;this[s(767)](40);const i=[];for(;!this.match(41);)i[s(t)](this.expression()),this[s(863)](42);return new xL(i,e)}[JB(575)](e){const t=863,s=722,i=894,n=732,r=767,o=811,a=JB;this[a(767)](38);const l=new Map;for(;!this[a(t)](39);){let e;if(this[a(722)](0,1))e=this[a(767)](1).getText();else{if(!this[a(s)](0,2))throw ZL.at(this[a(n)](0),a(497));e=this.consume(2)[a(i)]()}this[a(r)](43);const c=this[a(510)]();l[a(o)](e,c),this[a(t)](42)}return new IL(l,e)}expression(){return this[JB(596)]()}[JB(596)](){const e=732,t=JB;let s=this[t(689)]();for(;this.match(33);){const i=this[t(e)](0);s=new CL("||",s,this.logicalAnd(),i)}return s}[JB(689)](){const e=732,t=528,s=JB;let i=this[s(528)]();for(;this[s(863)](35);){const n=this[s(e)](0);i=new CL("&&",i,this[s(t)](),n)}return i}[JB(528)](){const e=863,t=534,s=727,i=JB,n=this[i(732)](0),r=this[i(534)]();return this[i(e)](23)?new CL("==",r,this[i(t)](),n):this.match(24)?new CL(i(541),r,this[i(534)](),n):this[i(863)](26)?new CL("!=",r,this[i(534)](),n):this[i(863)](27)?new CL(i(s),r,this.conditional(),n):r}[JB(534)](){const e=722,t=863,s=513,i=513,n=JB;let r=this.additive();for(;this.lookMatch(0,28)||this.lookMatch(0,29)||this.lookMatch(0,30)||this[n(e)](0,31);){const e=this[n(732)](0);this[n(t)](28)?r=new CL("<",r,this[n(513)](),e):this.match(29)?r=new CL("<=",r,this[n(s)](),e):this.match(30)?r=new CL(">",r,this[n(i)](),e):this[n(863)](31)&&(r=new CL(">=",r,this.additive(),e))}return r}[JB(513)](){const e=722,t=863,s=732,i=571,n=767,r=JB;let o=this.multiplicate();for(;this[r(e)](0,16)||this.lookMatch(0,18);){if(this[r(t)](16)){const e=this[r(s)](-1);o=new yL("+",o,this[r(i)](),e);continue}this[r(n)](18);const e=this[r(s)](-1);o=new yL("-",o,this[r(571)](),e)}return o}multiplicate(){const e=566,t=722,s=767,i=JB;let n=this[i(e)]();for(;this[i(t)](0,20)||this.lookMatch(0,21);){if(this[i(863)](20)){const t=this[i(732)](-1);n=new yL("*",n,this[i(e)](),t);continue}this[i(s)](21);const t=this[i(732)](-1);n=new yL("/",n,this[i(566)](),t)}return n}[JB(566)](){const e=592,t=767,s=863,i=894,n=JB,r=this[n(732)](0);if(this[n(863)](18))return new VL("-",this[n(e)](),r);if(this.match(17)){const e=new GL(this[n(t)](1)[n(894)](),r);return new RL(e,0,r)}if(this[n(s)](19)){const e=new GL(this[n(767)](1)[n(i)](),r);return new RL(e,1,r)}return this[n(592)]()}primary(){const e=894,t=637,s=508,i=508,n=722,r=722,o=632,a=716,l=575,c=894,h=863,u=510,d=590,f=658,p=JB,v=this[p(732)](0);let g;if(this[p(863)](0))g=new UL(v.getText(),v);else if(this[p(863)](3)){const n=v[p(e)](),r=n[p(t)]("\0"),o=r<0?n:n[p(s)](0,r),a=r<0?"":n[p(i)](r+1);g=new FL(o,a,v)}else if(this[p(n)](0,1)&&this[p(r)](1,36))g=this[p(805)](v);else if(this[p(722)](0,1)&&this[p(722)](1,40))g=this[p(o)](v);else if(this[p(722)](0,40))g=this[p(a)](v);else if(this[p(r)](0,38))g=this[p(l)](v);else if(this.match(1)){const e=new GL(v[p(c)](),v);g=e,this[p(863)](17)?g=new RL(e,2,v):this[p(863)](19)&&(g=new RL(e,3,v))}else if(this[p(h)](2))g=new UL(v[p(894)](),v);else{if(!this[p(863)](36))throw ZL.at(v,p(d)+KL[v[p(646)]()]);g=this[p(u)](),this.match(37)}return this[p(f)](g)}callWithPostfix(e){const t=863,s=732,i=646,n=863,r=510,o=722,a=623,l=JB;let c=e;for(;this[l(t)](45);){const e=this[l(s)](0);if(1!==e[l(i)]())throw ZL.at(e,"Expected identifier after '.'");const o=this.consume(1)[l(894)]();if(this.match(36)){const s=[];for(;!this[l(n)](37);)s[l(883)](this[l(r)]()),this[l(t)](42);c=new zL(c,o,s,e)}else c=new HL(c,o,e)}if(this[l(o)](0,40)&&!(c instanceof GL))throw ZL.at(this[l(732)](0),l(a));return c}[JB(767)](e){const t=JB,s=this.get(0);if(e!=s[t(646)]())throw ZL.at(s,t(774)+KL[s[t(646)]()]+t(591)+KL[e]);return this.pos++,s}[JB(863)](e){const t=JB;return e==this.get(0).getType()&&(this[t(906)]++,!0)}[JB(722)](e,t){const s=JB;return this[s(732)](e)[s(646)]()==t}[JB(732)](e){const t=679,s=768,i=JB,n=this[i(906)]+e;return n>=this[i(t)]?this[i(890)]:this[i(s)][n]}},JB(686)),Mt(jt,yt,new Set(["true",JB(517),"null",JB(669),"let","const",JB(718),"new","delete",JB(866),"instanceof","in","of","import",JB(560),"default","extends",JB(810),JB(614),JB(785),"throw","try",JB(657),JB(506),JB(666),JB(766),JB(754),JB(761),JB(653),JB(546)])),jt);function aD(e,t){e-=440;var s=lD(),i=s[e];if(void 0===aD.GUfngE){aD.uXzIzF=function(e){for(var t,s,i="",n="",r=0,o=0;s=e.charAt(o++);~s&&(t=r%4?64*t+s:s,r++%4)?i+=String.fromCharCode(255&t>>(-2*r&6)):0)s="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=".indexOf(s);for(var a=0,l=i.length;a<l;a++)n+="%"+("00"+i.charCodeAt(a).toString(16)).slice(-2);return decodeURIComponent(n)},aD.mGAgrc={},aD.GUfngE=!0}var n=e+s[0],r=aD.mGAgrc[n];return r?i=r:(i=aD.uXzIzF(i),aD.mGAgrc[n]=i),i}function lD(){var e=["nJKZnhDsEwHgua","ogD5v01ksG","m2TgEe9ivW","mZLkq3vsv3i","otG1ndy4q1bnzwvz","mtvxBwzhyKu","mty2mZKXmuHoAercsa","n21xvNbHrq","mtffy3zIvLK","nZq1nZq1sMXMt1Dg","mty2nteWBurrsvj2","mtaXmZaZngLps2f2zq","ntqXmtC2reHcC3vk"];return(lD=function(){return e})()}!function(){for(var e=444,t=449,s=451,i=447,n=446,r=450,o=452,a=aD,l=lD();;)try{if(141738===-parseInt(a(445))/1*(parseInt(a(440))/2)+-parseInt(a(442))/3*(-parseInt(a(e))/4)+parseInt(a(t))/5+parseInt(a(s))/6*(-parseInt(a(i))/7)+parseInt(a(441))/8*(-parseInt(a(n))/9)+-parseInt(a(r))/10*(-parseInt(a(448))/11)+-parseInt(a(o))/12*(-parseInt(a(443))/13))break;l.push(l.shift())}catch(c){l.push(l.shift())}}();class cD extends Error{constructor(e){super(e),this.name="ScenarioBodyParseError"}}function hD(e){let t;try{t=new oD(new nD(e).tokenize()).parse()}catch(n){throw new cD(n instanceof Error?n.message:String(n))}const s=t.statements.find(e=>e instanceof BL&&(e.name.startsWith("test_")||e.name.startsWith("flow_")));if(!s)throw new cD("no 'function test_*()' declaration found");if(!(s.body instanceof wL))throw new cD("function body is not a block");const i=e.split(/\r?\n/);return uD(s.body.statements,i,{n:0})}function uD(e,t,s){const i=[];for(const n of e){if(n instanceof qL){const{line:e,col:r}=vD(n),o=n.tagExpression();i.push({kind:"block",title:dD(n.label),children:uD(n.body.statements,t,s),line:e,col:r,soft:n.soft,...void 0!==o?{tagSource:o.toString()}:{}});continue}if(n instanceof TL)i.push({kind:"block",title:n.argNames[0]??"",children:uD(fD(n.body),t,s),line:0,col:0,soft:!1});else{if(n instanceof EL){const e={kind:"control",...pD(n,t,s,n.ifStatement),children:uD(fD(n.ifStatement),t,s)};n.elseStatement&&(e.elseChildren=uD(fD(n.elseStatement),t,s)),i.push(e);continue}if(n instanceof ML||n instanceof XL||n instanceof NL){const e=n instanceof ML?n.block:n.statement;i.push({kind:"control",...pD(n,t,s,e),children:uD(fD(e),t,s)});continue}i.push({kind:"step",...pD(n,t,s)})}}return i}function dD(e){var t;const s=e.value;return(null==(t=null==s?void 0:s.asString)?void 0:t.call(s))??""}function fD(e){return e instanceof wL?e.statements:[e]}function pD(e,t,s,i){const{line:n,col:r}=vD(e),o=i instanceof wL?vD(i).line:n,a=t.slice(n-1,Math.max(n,o)).map(e=>e.trim()).filter(e=>e.length>0).join(" ");return{index:s.n++,line:n,col:r,source:a}}function vD(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 gD=ps.lazy(()=>CN(()=>import("./DslEditor-DaxcTIeO.js"),__vite__mapDeps([0,1])).then(e=>({default:e.DslEditor}))),mD=m_(function({runId:e}){var t,s,i;const n=y_(),r=n.activeRuns.byRunId.get(e)??null,o=n.historicRuns.get(e),a=n.layout.runViewMode,[l,c]=ps.useState(r&&!r.plainRun?"code":a??"steps"),h=ps.useCallback(e=>{c(e),n.layout.setRunViewMode(e)},[n.layout]),[u,d]=ps.useState(null),f=ps.useCallback((e,t)=>{d({path:e,line:t}),h("code")},[h]);ps.useEffect(()=>{r||n.historicRuns.loadIfNeeded(e)},[n,e,r]),ps.useEffect(()=>{let t,s=!1;const i=async()=>{if(s)return;if(await n.runSources.loadIfNeeded(e),s)return;void 0===n.runSources.get(e)&&n.activeRuns.byRunId.has(e)&&(t=setTimeout(()=>{i()},300))};return i(),()=>{s=!0,t&&clearTimeout(t)}},[n,e]),ps.useEffect(()=>{r&&n.activeRuns.syncRuntime(e)},[n,e,r]);const p=r?function(e){return{events:e.events,status:CD(e.status),scenario:e.scenario,startedAt:e.startedAt,durationMs:null,abortable:"starting"===e.status||"running"===e.status||"paused"===e.status,outcome:e.outcome}}(r):o?function(e){const t="scenario"===e.meta.kind?e.events:[];return{events:t,status:aN(e.meta),scenario:e.meta.ref,startedAt:e.meta.startedAt,durationMs:e.meta.durationMs,abortable:!1,outcome:e.meta.outcome}}(o):null,v=(null==p?void 0:p.scenario)||(null==o?void 0:o.meta.ref)||(null==r?void 0:r.scenario)||"",g=n.scenarios.items.find(e=>e.name===v),m=n.runSources.get(e),_="authoring"===(null==r?void 0:r.mode),x=_?(null==g?void 0:g.path)??(null==m?void 0:m.entry)??null:null;ps.useEffect(()=>{x&&n.source.getOrLoad(x)},[n,x]);const b=x?n.source.draft(x)??null:null,y=x??(null==m?void 0:m.entry)??"",w=_?b:m?m.files[m.entry]??null:null,S=_?null!==b:void 0!==m,k=ps.useMemo(()=>{if(null==w)return null;try{return hD(w)}catch{return null}},[w]),C=lB(e),j=ps.useMemo(()=>{if(!k||!p)return;const e=function(e,t,s){const i=VB(t),n=[];let r=null;const o=new Map;for(const a of e)if("step:started"===a.kind){const e=a.file===s?$B(i,a.line,a.col):null;n.push({idx:e})}else if("step:ok"===a.kind||"step:fail"===a.kind){const e=n.pop();null!=(null==e?void 0:e.idx)&&(r=e.idx)}else if("screenshot"===a.kind){if(null!=a.line&&null!=a.col&&(null==a.file||a.file===s)){const e=$B(i,a.line,a.col);if(null!=e){o.set(e,a.path);continue}}const e=[...n].reverse().find(e=>null!=e.idx),t=(null==e?void 0:e.idx)??r;null!=t&&o.set(t,a.path)}return o}(p.events,k,y);if(0===e.size)return;const t=new Map;for(const[s,i]of e){const e=C.resolveUrl({kind:"event",path:i});e&&t.set(s,e)}return t.size>0?t:void 0},[k,p,y,C]),N=ps.useMemo(()=>k&&j?function(e,t){const s=[],i=(e,n)=>{for(const r of e){if("block"===r.kind){i(r.children,r.title);continue}const e=t.get(r.index);null!=e&&s.push({stepIndex:r.index,url:e,blockTitle:n,source:r.source,line:r.line}),"control"===r.kind&&(i(r.children,n),r.elseChildren&&i(r.elseChildren,n))}};return i(e,null),s}(k,j):[],[k,j]),[M,B]=ps.useState(null),[L,D]=ps.useState(null),E=ps.useMemo(()=>p?function(e,t,s){const i=[],n=[];let r=0;const o=()=>0===n.length?i:n[n.length-1].children,a=()=>{for(let e=n.length-1;e>=0;e--){const t=n[e];if("statement"===t.kind)return t}return null},l=()=>{const e=n[n.length-1];if("iteration"===(null==e?void 0:e.kind)){e.status=function(e){let t="passed";for(const s of e){if("failed"===s.status)return"failed";"running"===s.status?t="running":"aborted"===s.status&&"running"!==t?t="aborted":"pending"===s.status&&"passed"===t&&(t="pending")}return 0===e.length?"pending":t}(e.children);const t=e.children.filter(e=>null!==e.durationMs);e.durationMs=t.length>0?t.reduce((e,t)=>e+(t.durationMs??0),0):null,n.pop()}},c=()=>{l();const e=n[n.length-1];return"statement"!==(null==e?void 0:e.kind)?null:(n.pop(),e)};for(const h of e)switch(h.kind){case"step:started":{const e={kind:"statement",id:r++,file:h.file,line:h.line,col:h.col,source:FM(t,h.file,h.line),isEntry:h.file===s,...void 0!==h.stepTag?{stepTag:h.stepTag}:{},status:"running",durationMs:null,children:[],annotations:[]};o().push(e),n.push(e);break}case"step:ok":{const e=c();e&&(e.status="passed",e.durationMs=h.durationMs);break}case"step:fail":{const e=c();e&&(e.status="failed",e.error={message:h.error,...void 0!==h.errorName?{name:h.errorName}:{}});break}case"step-block:started":{const e={kind:"block",id:r++,file:h.file,line:h.line,col:h.col,label:h.label,...void 0!==h.tag?{tag:h.tag}:{},soft:h.soft,status:"running",durationMs:null,children:[]};o().push(e),n.push(e);break}case"step-block:finished":{l();const e=n[n.length-1];"block"===(null==e?void 0:e.kind)&&(n.pop(),e.status=h.ok?"passed":"failed",e.durationMs=h.durationMs,h.ok||(e.error={message:h.error??"",...void 0!==h.errorName?{name:h.errorName}:{}}));break}case"loop:iteration":{l();const e={kind:"iteration",id:r++,index:h.index,status:"running",durationMs:null,children:[]};o().push(e),n.push(e);break}case"note":case"log":case"judge:verdict":{const e=a();if(!e)break;"note"===h.kind?e.annotations.push({kind:"note",t:h.t,label:h.label,text:h.text,...h.truncated?{truncated:!0}:{}}):"log"===h.kind?e.annotations.push({kind:"log",t:h.t,text:h.text,...h.truncated?{truncated:!0}:{}}):e.annotations.push({kind:"judge",t:h.t,verdict:h.verdict,rubric:h.rubric,...void 0!==h.preamble?{preamble:h.preamble}:{},text:h.text,reasoning:h.reasoning,model:h.model});break}case"screenshot":{const e=(void 0!==h.file&&void 0!==h.line&&void 0!==h.col?HM(i,{file:h.file,line:h.line,col:h.col}):null)??a()??WM(i);e&&(e.screenshot=h.path);break}case"run:finished":for(;n.length>0;){const e=n.pop();"running"===e.status&&(e.status="aborted")}}for(;n.length>0;)n.pop();return i}(p.events,m??null,y):[],[p,m,y]),P=ps.useMemo(()=>KM(E),[E]),R=ps.useMemo(()=>{const e=new Map,t=s=>{for(const i of s){if("statement"===i.kind&&i.screenshot){const t=C.resolveUrl({kind:"event",path:i.screenshot});t&&e.set(i.id,t)}t(i.children)}};return t(E),e.size>0?e:void 0},[E,C]),[A,z]=ps.useState(null),T=ps.useCallback(e=>{var t;B(e),z((null==(t=N[e])?void 0:t.stepIndex)??null)},[N]),I=ps.useCallback(e=>{const t=function(e,t){return e.findIndex(e=>e.stepIndex===t)}(N,e);t>=0&&T(t)},[N,T]);if(!p)return n.historicRuns.errors.has(e)?Ss.jsx(Jj,{id:e}):Ss.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading run…"});const O="failed"===p.status,H="passed"===p.status||"failed"===p.status||"aborted"===p.status,F=k?YB(p.events,k,y):null,W=function(e,t){const s=new Map,i=[],n=(e,t)=>{const i=s.get(e);if(i)return i;const n={status:"pending",durationMs:null,soft:t,softTotal:0,softFailed:0};return s.set(e,n),n};for(const r of e)if("step-block:started"===r.kind){const e=GB(r,t);if(i.push({key:e}),null===e)continue;const s=n(e,r.soft);s.status="running",s.durationMs=null,void 0!==r.tag&&(s.tag=r.tag)}else if("step-block:finished"===r.kind){i.pop();const e=GB(r,t);if(null!==e){const t=n(e,r.soft);t.status=r.ok?"passed":"failed",t.durationMs=r.durationMs,void 0!==r.tag&&(t.tag=r.tag)}if(r.soft)for(const t of i){if(null===t.key)continue;const e=s.get(t.key);e&&(e.softTotal++,r.ok||e.softFailed++)}}else if("run:finished"===r.kind)for(const e of s.values())"running"===e.status&&(e.status="aborted");for(const r of s.values())r.softFailed>0&&"passed"===r.status&&(r.status="failed");return s}(p.events,y),K=function(e){const t=[];for(const s of e)"step-block:finished"===s.kind&&s.soft&&!s.ok&&t.push({label:s.label,...void 0!==s.tag?{tag:s.tag}:{},file:s.file,line:s.line,col:s.col,error:s.error??"",...void 0!==s.errorName?{errorName:s.errorName}:{}});return t}(p.events),U=function(e){let t=0,s=0;for(const i of e)"step-block:finished"===i.kind&&i.soft&&(t++,i.ok||s++);return{total:t,failed:s}}(p.events),q=k?function(e,t,s){const i=VB(t),n=[];let r=null;const o=new Map,a=(e,t)=>{let a=null;if(null!=e.entryLine&&null!=e.entryCol?a=$B(i,e.entryLine,e.entryCol):null==e.line||null==e.col||null!=e.file&&e.file!==s||(a=$B(i,e.line,e.col)),null==a){const e=[...n].reverse().find(e=>null!=e.idx);a=(null==e?void 0:e.idx)??r}if(null==a)return;const l=o.get(a);l?l.push(t):o.set(a,[t])};for(const l of e)if("step:started"===l.kind){const e=l.file===s?$B(i,l.line,l.col):null;n.push({idx:e})}else if("step:ok"===l.kind||"step:fail"===l.kind){const e=n.pop();null!=(null==e?void 0:e.idx)&&(r=e.idx)}else"note"===l.kind?a(l,{kind:"note",t:l.t,label:l.label,text:l.text,...l.truncated?{truncated:!0}:{}}):"log"===l.kind?a(l,{kind:"log",t:l.t,text:l.text,...l.truncated?{truncated:!0}:{}}):"judge:verdict"===l.kind&&a(l,{kind:"judge",t:l.t,verdict:l.verdict,rubric:l.rubric,...void 0!==l.preamble?{preamble:l.preamble}:{},text:l.text,reasoning:l.reasoning,model:l.model});return o}(p.events,k,y):null,V=(null==g?void 0:g.name)??v??e,$=F?Object.values(F).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},Y="paused"===(null==r?void 0:r.status),G="starting"===(null==r?void 0:r.status)||"running"===(null==r?void 0:r.status),X=n.session.capabilities.canRun,Z=n.targets.activeDebugCaps,J=X&&Z.picker&&(Y||_&&G),Q=X&&Y&&("failure"!==(null==(t=null==r?void 0:r.pausedAt)?void 0:t.reason)||Z.resumeFromFailure),ee=null!=(null==r?void 0:r.pausedAt)&&(null===r.pausedAt.file||r.pausedAt.file===y),te=Y&&(null==r?void 0:r.pausedAt)&&ee?function(e,t,s){var i;if(!e)return;const n=jM(e),r=n.find(e=>e.line===t&&e.col===s);return r?r.index:null==(i=n.find(e=>e.line===t))?void 0:i.index}(k,r.pausedAt.line,r.pausedAt.col):void 0,se=(null==g?void 0:g.path)??y,ie=Y&&(null==(s=null==r?void 0:r.pausedAt)?void 0:s.file)?r.pausedAt.file:(null==u?void 0:u.path)??se,ne=ie===se||ie===y,re=O&&k?function(e,t){var s;return e&&null!=t?null==(s=jM(e).find(e=>e.index===t))?void 0:s.line:void 0}(k,XB(p.events,k,y)):void 0;let oe,ae;Y&&(null==r?void 0:r.pausedAt)?"failure"===r.pausedAt.reason?ae=r.pausedAt.line:oe=r.pausedAt.line:u?oe=u.line:ne&&(ae=re);const le=null==g?void 0:g.name,ce=le?n.breakpoints.get(le):void 0,he=new Set;if(ce)for(const pe of ce)he.add(Number(pe.split(":")[0]));if(ne&&r)for(const pe of r.breakpoints)he.add(Number(pe.split(":")[0]));const ue=(t,s)=>{if(!le)return;n.breakpoints.toggle(le,t,s)?n.activeRuns.setBreakpoint(e,t,s):n.activeRuns.clearBreakpoint(e,t,s)},de=(null==g?void 0:g.name)||v,fe=X&&!G&&!Y&&!p.abortable&&!!de?()=>{n.activeRuns.startScenario(de,{headed:!1,debug:!1}).then(e=>{n.tabs.open({kind:"scenario-run",runId:e.runId})})}:null;return Ss.jsxs("div",{className:"flex h-full min-w-0 gap-1.5 bg-shell",children:[Ss.jsxs("section",{className:ay("flex min-w-0 flex-1 flex-col overflow-hidden bg-canvas",n.layout.inspectorOpen&&"rounded-r-lg"),children:[Ss.jsx(xD,{title:(null==g?void 0:g.title)??v??e,onOpenScenario:g?()=>n.tabs.open({kind:"scenario",path:g.path}):null,color:(null==g?void 0:g.color)??null,status:p.status,softSummary:U,viewMode:l,onViewMode:h,onRunAgain:fe,onAbort:p.abortable&&X?()=>{n.activeRuns.abort(e)}:null,onContinue:Q?()=>{n.activeRuns.continueRun(e)}:null,onStep:Q?()=>{n.activeRuns.step(e)}:null,onPause:G&&!_&&X?()=>{n.activeRuns.pauseRun(e)}:null,picker:J?(null==r?void 0:r.picker)??null:null,onPick:J?t=>{n.activeRuns.togglePicker(e,t)}:null,execute:!!J&&((null==(i=null==r?void 0:r.picker)?void 0:i.execute)??!1),onSetExecute:J?t=>{n.activeRuns.setPickerExecute(e,t)}:null,wheel:(null==r?void 0:r.wheel)??"human",isAuthoring:_,onSetWheel:X&&Z.attach&&(G||Y)?t=>{n.activeRuns.setWheel(e,t)}:null,onExport:G?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:n.layout.inspectorOpen,onToggleInspector:n.layout.toggleInspector}),Y&&(null==r?void 0:r.pausedAt)&&Ss.jsx(SD,{reason:r.pausedAt.reason,stepIndex:te??-1,file:r.pausedAt.file??y??v??e,line:r.pausedAt.line,col:r.pausedAt.col}),Ss.jsx(kD,{counts:$}),Ss.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:Ss.jsx(_M,{label:"trace"===l?"Trace":"code"===l?"Code":"Steps",resetKey:`${e}:${l}`,children:"trace"===l?Ss.jsx("div",{className:"h-full overflow-y-auto",children:Ss.jsx(UM,{nodes:E,onOpenCode:f,...R?{screenshots:R,onOpenScreenshot:e=>{const t=R.get(e);t&&D({id:e,url:t})},...L?{activeScreenshotId:L.id}:{}}:{},...P?{failedId:P.id,onFailedRender:e=>{var t,s;return Ss.jsx(QM,{errorName:(null==(t=e.error)?void 0:t.name)??"Error",message:(null==(s=e.error)?void 0:s.message)??"",file:e.file,line:e.line,source:e.source,index:e.id})}}:{}})}):"code"===l?Ss.jsx(ps.Suspense,{fallback:Ss.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading editor…"}),children:Ss.jsx(gD,{path:ie,fileKind:ne?"scenario":"helper",...null!=oe?{highlightLine:oe}:{},...null!=ae?{errorLine:ae}:{},...ne&&le?{breakpointLines:he,onToggleBreakpoint:e=>{const t=k?jM(k).find(t=>t.line===e):void 0;t&&ue(e,t.col)}}:{}})}):Ss.jsxs("div",{className:"h-full overflow-y-auto",children:[K.length>0&&Ss.jsxs("div",{className:"mx-4 mt-3 rounded border border-fail/30 bg-fail/5 px-3 py-2 font-mono text-[12px]","data-testid":"soft-failures",children:[Ss.jsxs("div",{className:"mb-1 flex items-center gap-2 text-fail",children:[Ss.jsx(eN,{tone:"fail",size:"xs",children:"soft"}),Ss.jsxs("span",{children:[K.length," soft step",1===K.length?"":"s"," failed — the run went on past each one"]})]}),Ss.jsx("ul",{className:"space-y-0.5 text-fg-2",children:K.map((e,t)=>Ss.jsxs("li",{className:"truncate",children:[Ss.jsx("span",{className:"text-fg",children:e.label}),void 0!==e.tag&&Ss.jsxs("span",{className:"text-fg-3",children:[" [",e.tag,"]"]}),Ss.jsxs("span",{className:"text-fg-3",children:[" · L",e.line," · "]}),e.error]},t))})]}),k?Ss.jsx(OM,{store:n.annotations,scope:V,body:k,blocks:W,...q?{annotations:q}:{},...F?{trace:F}:{},...j?{screenshots:j,onOpenScreenshot:I,...null!=A?{activeScreenshotIndex:A}:{}}:{},...null!=te?{pausedIndex:te}:{},bpKeys:ce,onToggleBp:le?ue:void 0,...O?{failedIndex:XB(p.events,k,y)??void 0}:{},...O?{onFailedStepRender:t=>{var s,i;const n=(null==(s=ZB(p.events,k,y))?void 0:s.event)??null;if(!n)return null;const r=iB(p.events,"failure-bundle:written"),o=null==(i=null==q?void 0:q.get(t.index))?void 0:i.find(e=>"judge"===e.kind&&"fail"===e.verdict);return Ss.jsx(QM,{errorName:n.errorName??"Error",message:n.error,...o&&"judge"===o.kind?{verdict:{rubric:o.rubric,text:o.text,reasoning:o.reasoning,model:o.model}}:{},file:(null==g?void 0:g.path)??v??e,line:t.line,source:t.source,index:t.index,...(null==r?void 0:r.url)?{url:r.url}:{}})}}:{}}):Ss.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:S?null===m?"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…"})]})})})]}),L&&Ss.jsx(XM,{strip:[{stepIndex:L.id,url:L.url,blockTitle:null,source:"",line:0}],position:0,onNavigate:()=>{},onClose:()=>D(null)}),null!=M&&N[M]&&Ss.jsx(XM,{strip:N,position:M,onNavigate:T,onClose:()=>B(null)}),n.layout.inspectorOpen&&Ss.jsx(uB,{runId:e,active:r,events:p.events,isFailed:O,runFinished:H})]})});const _D={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 xD({title:e,color:t,status:s,viewMode:i,onViewMode:n,onRunAgain:r,onAbort:o,onContinue:a,onStep:l,onPause:c,picker:h,onPick:u,execute:d,onSetExecute:f,wheel:p,onSetWheel:v,isAuthoring:g,softSummary:m,onExport:_,inspectorOpen:x,onToggleInspector:b,onOpenScenario:y}){const w="paused"===s;return Ss.jsxs("div",{className:"shrink-0 border-b border-edge bg-canvas",children:[Ss.jsxs("div",{className:"flex h-10 items-center gap-3 px-4",children:[Ss.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[t&&Ss.jsx("span",{"aria-hidden":!0,className:"h-4 w-1 shrink-0 rounded-sm",style:{backgroundColor:t}}),Ss.jsx("div",{className:"truncate text-[13px] font-medium text-fg",children:e}),y&&Ss.jsxs("button",{type:"button","aria-label":"Open the test",onClick:y,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:[Ss.jsx(cy,{name:"file",className:"h-3.5 w-3.5"}),Ss.jsx(jN,{label:"Open the test"})]}),g?Ss.jsx(eN,{tone:"info",children:"authoring"}):!w&&Ss.jsx(eN,{tone:cN(s),children:s}),m.failed>0&&Ss.jsxs("span",{className:"shrink-0 whitespace-nowrap font-mono text-[11px] tabular-nums text-fail","data-testid":"soft-summary",children:[m.failed," of ",m.total," soft failed"]})]}),Ss.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[v&&Ss.jsx(bD,{wheel:p,onSet:v}),Ss.jsx(NN,{value:i,onChange:n,options:[{value:"steps",label:"Steps",icon:"list",title:"Show the step tree"},{value:"trace",label:"Trace",icon:"tree",title:"Show the execution tree — helper frames and loop iterations"},{value:"code",label:"Code",icon:"braces",title:"Show the test source"}]}),Ss.jsx("div",{className:"h-4 w-px bg-edge-soft"}),Ss.jsxs("button",{type:"button",onClick:b,"aria-pressed":x,className:ay("group relative grid h-6 w-6 place-items-center rounded",x?"bg-raised text-fg":"text-fg-4 hover:bg-raised hover:text-fg-2"),children:[Ss.jsx(cy,{name:"panelRight",className:"h-4 w-4"}),Ss.jsx(jN,{label:x?"Hide inspector":"Show inspector"})]})]})]}),Ss.jsxs("div",{className:"flex h-10 items-center gap-3 border-t border-edge-soft px-4",children:[Ss.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[r&&Ss.jsx(qB,{icon:"play",tooltip:"Run this scenario again",onClick:r,children:Ss.jsx("span",{className:"hidden sm:inline",children:"Run again"})}),a&&Ss.jsx(qB,{variant:"primary",icon:"play",tooltip:"Resume execution",tooltipHint:"F8",onClick:a,children:Ss.jsx("span",{className:"hidden sm:inline",children:"Continue"})}),l&&Ss.jsx(qB,{icon:"stepOver",tooltip:"Step over",tooltipHint:"F10",onClick:l,children:Ss.jsx("span",{className:"hidden sm:inline",children:"Step"})}),c&&Ss.jsx(qB,{icon:"pause",tooltip:"Pause the run",tooltipHint:"F6",onClick:c,children:Ss.jsx("span",{className:"hidden sm:inline",children:"Pause"})}),o&&Ss.jsx(qB,{variant:"danger",icon:"square",tooltip:w?"Stop the run":"Abort the run",onClick:o,children:Ss.jsx("span",{className:"hidden sm:inline",children:w?"Stop":"Abort"})})]}),Ss.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[u&&Ss.jsxs(Ss.Fragment,{children:[f&&Ss.jsx(yD,{execute:d,onChange:f}),Ss.jsx(wD,{picker:h,onPick:u})]}),_&&Ss.jsxs(Ss.Fragment,{children:[u&&Ss.jsx("div",{className:"h-4 w-px bg-edge-soft"}),Ss.jsx(qB,{icon:"externalL",tooltip:"Export this run as a portable .unotest.zip to share",tooltipPlacement:"bottom-end",onClick:_,children:Ss.jsx("span",{className:"hidden sm:inline",children:"Export"})})]})]})]})]})}function bD({wheel:e,onSet:t}){const s="agent"===e;return Ss.jsxs("button",{type:"button",onClick:()=>t(s?"human":"agent"),className:ay("group relative flex h-6 items-center gap-1.5 rounded border px-2 font-mono text-[11px]",s?"border-warn/40 bg-warn/10 text-warn hover:bg-warn/20":"border-edge-soft bg-canvas text-fg-2 hover:bg-raised"),children:[Ss.jsx("span",{"aria-hidden":!0,className:ay("h-1.5 w-1.5 rounded-full",s?"bg-warn uno-pulse":"bg-pass")}),s?"Agent driving":"You're driving",Ss.jsx(jN,{label:s?"Take control back from the agent":"Let the agent drive"})]})}function yD({execute:e,onChange:t}){return Ss.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(s=>{const i=s.v===e;return Ss.jsxs("button",{type:"button","aria-pressed":i,onClick:()=>t(s.v),className:ay("group relative h-5 rounded px-2 font-mono text-[11px] transition-colors",i?"bg-canvas text-fg shadow-sm":"text-fg-3 hover:text-fg"),children:[s.label,Ss.jsx(jN,{label:s.title})]},s.label)})})}function wD({picker:e,onPick:t}){return Ss.jsx("div",{className:"flex shrink-0 items-center gap-0.5",role:"group","aria-label":"Locator picker",children:Object.keys(_D).map(s=>{const i=_D[s],n=!0===(null==e?void 0:e.active)&&e.mode===s;return Ss.jsxs("button",{type:"button","aria-pressed":n,"aria-label":i.label,onClick:()=>t(s),className:ay("group relative grid h-6 w-7 place-items-center rounded border",n?"border-accent bg-accent text-on-accent":"border-accent/30 bg-canvas text-fg-3 hover:bg-raised hover:text-fg"),children:[Ss.jsx(cy,{name:i.icon,className:"h-3.5 w-3.5",strokeWidth:1.75}),Ss.jsx(jN,{label:i.label,hint:i.hint})]},s)})})}function SD({reason:e,stepIndex:t,file:s,line:i,col:n}){const r="breakpoint"===e?"breakpoint hit":"step"===e?"step pause":"paused on failure";return Ss.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-2 border-b border-warn/40 bg-warn/10 px-4",children:[Ss.jsx(cy,{name:"pause",className:"h-3 w-3 text-warn",strokeWidth:2.5}),Ss.jsx("span",{className:"font-mono text-[11px] uppercase tracking-wider text-warn",children:"paused"}),Ss.jsx("span",{className:"text-warn/40",children:"·"}),Ss.jsxs("span",{className:"font-mono text-[11.5px] text-warn",children:[t>=0?`#${t} `:"",Ss.jsxs("span",{className:"text-warn/70",children:["— ",r]})]}),Ss.jsxs("span",{className:"ml-auto truncate font-mono text-[11px] text-warn/70",children:[s,":",i,":",n]})]})}function kD({counts:e}){const t=e.passed+e.failed+e.running+e.pending;return 0===t?Ss.jsx("div",{className:"h-1 shrink-0 bg-raised"}):Ss.jsxs("div",{className:"flex h-1 shrink-0 overflow-hidden bg-raised",children:[Ss.jsx("div",{className:"h-full bg-pass",style:{width:e.passed/t*100+"%"}}),Ss.jsx("div",{className:"h-full bg-fail",style:{width:e.failed/t*100+"%"}}),Ss.jsx("div",{className:ay("h-full bg-warn",e.running>0&&"uno-pulse"),style:{width:e.running/t*100+"%"}})]})}function CD(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 jD({runId:e}){return Ss.jsx(_M,{label:`Run ${e}`,resetKey:e,children:Ss.jsx(mD,{runId:e})})}const ND=ps.lazy(()=>CN(()=>import("./DslEditor-DaxcTIeO.js"),__vite__mapDeps([0,1])).then(e=>({default:e.DslEditor}))),MD=m_(function({path:e}){const t=y_(),s=t.scenarios.items.find(t=>t.path===e),i=t.session.capabilities.canRun,[n,r]=ps.useState("steps");ps.useEffect(()=>{t.source.getOrLoad(e)},[t,e]);const o=t.source.draft(e),a=t.source.error(e),l=ps.useMemo(()=>{if(void 0===o)return null;try{return{ok:!0,body:hD(o)}}catch(e){return{ok:!1,message:e instanceof cD||e instanceof Error?e.message:String(e)}}},[o]),c=async e=>{if(!s)return;const i=await t.activeRuns.startScenario(s.name,{headed:e,debug:e});t.tabs.open({kind:"scenario-run",runId:i.runId})};if(!s)return Ss.jsx(Jj,{id:e});if(a)return Ss.jsx(BD,{children:Ss.jsx("div",{className:"p-4 font-mono text-[12px] text-fail",children:a})});const h=aN(t.runs.lastRunByRef("scenario",s.name)),u=t.breakpoints.get(s.name),d=new Set;for(const p of u)d.add(Number(p.split(":")[0]));const f=(e,i)=>{const n=t.breakpoints.toggle(s.name,e,i),r=t.activeRuns.findActiveByScenario(s.name);r&&(n?t.activeRuns.setBreakpoint(r.runId,e,i):t.activeRuns.clearBreakpoint(r.runId,e,i))};return Ss.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[Ss.jsxs("header",{className:"shrink-0 border-b border-edge",children:[Ss.jsxs("div",{className:"flex h-10 items-center gap-3 px-4",children:[Ss.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[Ss.jsx("span",{"aria-hidden":!0,className:"h-4 w-1 shrink-0 rounded-sm",style:{backgroundColor:s.color}}),Ss.jsx("h1",{className:"truncate text-[13px] font-medium text-fg",children:s.title}),Ss.jsx(eN,{tone:cN(h),children:h})]}),Ss.jsx("div",{className:"flex shrink-0 items-center",children:Ss.jsx(NN,{value:n,onChange:r,options:[{value:"steps",label:"Steps",icon:"list",title:"Show the step tree"},{value:"code",label:"Code",icon:"braces",title:"Edit the test source"}]})})]}),Ss.jsxs("div",{className:"flex h-10 items-center gap-1.5 border-t border-edge-soft px-4",children:[Ss.jsxs("button",{type:"button",disabled:!i,className:ay("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",i?"hover:bg-accent-hover":_N),onClick:()=>{c(!1)},children:[Ss.jsx(cy,{name:"play",className:"h-3.5 w-3.5",strokeWidth:2.5})," Run",Ss.jsx(jN,{label:i?"Run headless":mN})]}),Ss.jsxs("button",{type:"button",disabled:!i,className:ay("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",i?"hover:bg-warn/20":_N),onClick:()=>{c(!0)},children:[Ss.jsx(cy,{name:"bug",className:"h-3.5 w-3.5",strokeWidth:2})," Debug",Ss.jsx(jN,{label:i?"Headed browser · stop on breakpoints · pause on failure":mN})]}),Ss.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(s.name),children:[Ss.jsx(cy,{name:"history",className:"h-3.5 w-3.5",strokeWidth:2}),"History",Ss.jsx(jN,{label:`Past runs of ${s.name}`})]})]})]}),Ss.jsx("div",{className:"min-h-0 flex-1",children:"code"===n?Ss.jsx(ps.Suspense,{fallback:Ss.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading editor…"}),children:Ss.jsx(ND,{path:e,fileKind:"scenario",breakpointLines:d,onToggleBreakpoint:e=>{const t=(null==l?void 0:l.ok)?jM(l.body).find(t=>t.line===e):void 0;t&&f(e,t.col)}})}):Ss.jsxs("div",{className:"h-full overflow-y-auto",children:[null===l&&Ss.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading source…"}),!1===(null==l?void 0:l.ok)&&Ss.jsxs("div",{className:"px-4 py-3 font-mono text-[12px] text-fail",children:["parse error: ",l.message]}),(null==l?void 0:l.ok)&&Ss.jsx(DM,{body:l.body,bpKeys:u,onToggleBp:f})]})})]})});function BD({children:e}){return Ss.jsx("div",{className:"h-full",children:e})}const LD=m_(function({snapshotId:e}){var t;const s=y_(),i=s.snapshots.manifestOf(e),[n,r]=ps.useState("steps"),o=ps.useMemo(()=>new oB(e),[e]),[a,l]=ps.useState(null);ps.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,s,i])=>{e||l({events:t.ok?ED(t.text):[],vars:s.ok?PD(s.text):{},sources:i.ok?RD(i.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=ps.useMemo(()=>{if(null==h)return null;try{return hD(h)}catch{return null}},[h]);if(!i)return s.snapshots.loaded?Ss.jsx(Jj,{id:e}):Ss.jsx(DD,{});const d=function(e){return"interrupted"===e?"aborted":e}(i.status),f="failed"===i.status,p=(null==a?void 0:a.events)??[],v=u?YB(p,u,c):null,g=f&&u?XB(p,u,c)??void 0:void 0,m=function(e){for(let t=e.length-1;t>=0;t--){const s=e[t];if("step:fail"===s.kind)return s}return null}(p);return Ss.jsx(aB.Provider,{value:o,children:Ss.jsxs("div",{className:"flex h-full min-w-0 gap-1.5 bg-shell",children:[Ss.jsxs("section",{className:ay("flex min-w-0 flex-1 flex-col overflow-hidden bg-canvas",s.layout.inspectorOpen&&"rounded-r-lg"),children:[Ss.jsxs("div",{className:"shrink-0 border-b border-edge bg-canvas",children:[Ss.jsxs("div",{className:"flex h-10 items-center gap-3 px-4",children:[Ss.jsx("span",{"aria-hidden":!0,className:"h-4 w-1 shrink-0 rounded-sm bg-accent"}),Ss.jsx("div",{className:"truncate text-[13px] font-medium text-fg",children:i.scenario}),Ss.jsx(eN,{tone:cN(d),children:d}),Ss.jsx("div",{className:"flex-1"}),Ss.jsx(eN,{tone:"warn",children:"frozen · read-only"}),Ss.jsx(NN,{value:n,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"}]}),Ss.jsx("div",{className:"h-4 w-px bg-edge-soft"}),Ss.jsxs("button",{type:"button",onClick:s.layout.toggleInspector,"aria-pressed":s.layout.inspectorOpen,className:ay("group relative grid h-6 w-6 place-items-center rounded",s.layout.inspectorOpen?"bg-accent/10 text-accent":"text-fg-4 hover:bg-raised hover:text-fg-2"),children:[Ss.jsx(cy,{name:"panelRight",className:"h-4 w-4"}),Ss.jsx(jN,{label:s.layout.inspectorOpen?"Hide inspector":"Show inspector",placement:"bottom-end"})]})]}),Ss.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:[Ss.jsxs("span",{className:"flex items-center gap-1",children:[Ss.jsx(cy,{name:"camera",className:"h-3 w-3"})," snapshot"]}),Ss.jsx("span",{children:"·"}),Ss.jsxs("span",{children:["captured ",i.capturedAt.slice(0,16).replace("T"," ")]}),i.git.author&&Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("span",{children:"·"}),Ss.jsxs("span",{children:[i.git.author,i.git.branch&&` @ ${i.git.branch}`]})]})]})]}),Ss.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:null==a?Ss.jsx(DD,{}):"code"===n?Ss.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"}):Ss.jsx("div",{className:"h-full overflow-y-auto",children:u?Ss.jsx(DM,{body:u,...v?{trace:v}:{},...null!=g?{failedIndex:g}:{},...m?{onFailedStepRender:e=>Ss.jsx(QM,{errorName:m.errorName??"Error",message:m.error,file:c||i.scenario,line:e.line,source:e.source,index:e.index})}:{}}):Ss.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"})})})]}),s.layout.inspectorOpen&&Ss.jsx(uB,{runId:e,active:null,events:p,isFailed:f,runFinished:!0,varsOverride:(null==a?void 0:a.vars)??{}})]})})});function DD(){return Ss.jsx("div",{className:"px-4 py-3 font-mono text-[12px] text-fg-4",children:"loading snapshot…"})}function ED(e){const t=[];for(const s of e.split("\n")){const e=s.trim();if(e)try{t.push(JSON.parse(e))}catch{}}return t}function PD(e){try{return JSON.parse(e).vars??{}}catch{return{}}}function RD(e){try{return JSON.parse(e)}catch{return null}}const AD=m_(function(){const e=y_().tabs.activeTab;switch(e.kind){case"overview":return Ss.jsx(FN,{});case"scenario":return Ss.jsx(MD,{path:e.path});case"helper":return Ss.jsx(DN,{path:e.path});case"collection":return Ss.jsx(xN,{path:e.path});case"scenario-run":return Ss.jsx(jD,{runId:e.runId});case"collection-run":return Ss.jsx(hN,{runId:e.runId});case"snapshot":return Ss.jsx(LD,{snapshotId:e.snapshotId})}}),zD={overview:"home",scenario:"file",helper:"braces",collection:"layers","scenario-run":"play","collection-run":"play",snapshot:"camera"},TD=m_(function(){const e=y_(),[t,s]=ps.useState(null),i=e.tabs.tabs.map(t=>{const s=e.tabs.keyFor(t);return{key:s,tab:t,label:OD(e,t),status:HD(e,t),active:e.tabs.activeKey===s,closable:"overview"!==t.kind}});return Ss.jsxs("div",{className:"relative shrink-0 border-b border-edge bg-panel",children:[Ss.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:i.map(t=>Ss.jsx(Ny,{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(),s({x:e.clientX,y:e.clientY,key:t.key})},leading:"scenario-run"===t.tab.kind||"collection-run"===t.tab.kind?Ss.jsx(iN,{status:t.status??"pending"}):Ss.jsx(cy,{name:zD[t.tab.kind],className:ay("h-3.5 w-3.5 shrink-0",t.active?"text-fg-2":"text-fg-4")})},t.key))}),Ss.jsx("button",{type:"button",onClick:t=>{const i=t.currentTarget.getBoundingClientRect();s({x:Math.max(6,i.right-208),y:i.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:Ss.jsx(cy,{name:"more",className:"h-4 w-4 rotate-90"})}),t&&Ss.jsx(Cy,{x:t.x,y:t.y,onClose:()=>s(null),items:ID(i,t.key,e.tabs)})]})});function ID(e,t,s){const i=e.find(e=>e.key===t),n=e.filter(e=>e.key!==t&&e.closable),r=[];return i&&r.push({kind:"header",label:i.label}),r.push({kind:"item",icon:"x",label:"Close",shortcut:"⌘W",disabled:!(null==i?void 0:i.closable),onSelect:()=>s.close(t)}),r.push({kind:"item",icon:"x",label:"Close Others",disabled:0===n.length,onSelect:()=>s.closeOthers(t)}),r.push({kind:"separator"}),r.push({kind:"item",icon:"trash",label:"Close All",tone:"danger",disabled:e.every(e=>!e.closable),onSelect:()=>s.closeAll()}),r}function OD(e,t){var s;switch(t.kind){case"overview":return"Home";case"scenario":{const s=e.scenarios.items.find(e=>e.path===t.path);return(null==s?void 0:s.name)??t.path}case"helper":{const s=e.helpers.items.find(e=>e.path===t.path);return s?`${s.name}.js`:t.path}case"collection":{const s=e.collections.items.find(e=>e.path===t.path);return(null==s?void 0:s.name)??t.path}case"scenario-run":case"collection-run":{const s=e.runs.items.find(e=>e.runId===t.runId);if(s)return s.ref;const i=e.activeRuns.byRunId.get(t.runId);return(null==i?void 0:i.scenario)||("scenario-run"===t.kind?t.ref:void 0)||t.runId}case"snapshot":return(null==(s=e.snapshots.manifestOf(t.snapshotId))?void 0:s.scenario)??t.snapshotId}}function HD(e,t){if("scenario-run"===t.kind||"collection-run"===t.kind){const s=e.activeRuns.byRunId.get(t.runId);if(s)switch(s.status){case"starting":case"running":return"running";case"completed":return"passed";case"failed":return"failed";case"aborted":return"aborted"}const i=e.runs.items.find(e=>e.runId===t.runId);return aN(i??null)}return null}const FD="activityBar.section";class WD{constructor(){this.section=bM(FD,"scenarios"),Fr(this,{},{autoBind:!0})}setSection(e){this.section=e}get storageKey(){return FD}}const KD={fail:"bg-fail text-on-accent",run:"bg-warn text-on-accent",info:"bg-accent text-on-accent"};function UD({children:e,tone:t,pulse:s}){return Ss.jsx("span",{className:ay("inline-flex h-[14px] min-w-[14px] items-center justify-center rounded-full px-[3px] font-mono text-[9px] font-semibold tabular-nums",KD[t],s&&"uno-pulse"),children:e})}const qD=[{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"}],VD=m_(function(){const e=y_(),t=e.session.capabilities.canTerminal,s=e.overview.failing.length,i=e.activeRuns.activeList.length+e.queue.waiting.length;return Ss.jsxs("nav",{className:"relative z-30 flex w-[40px] shrink-0 flex-col items-stretch py-1",children:[qD.map(t=>{const n=t.id===e.activityBar.section&&e.layout.treeOpen,r="runs"===t.id&&s>0?Ss.jsx(UD,{tone:"fail",children:s}):"active"===t.id&&i>0?Ss.jsx(UD,{tone:"run",pulse:!0,children:i}):null;return Ss.jsxs("button",{type:"button","aria-label":"runs"===t.id&&s>0?`${t.label} — ${s} ${1===s?"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:ay("group relative mx-1 my-0.5 grid place-items-center rounded py-2",n?"bg-panel text-fg":"text-fg-3 hover:bg-panel/70 hover:text-fg-2"),children:[Ss.jsxs("span",{className:"relative",children:[Ss.jsx(cy,{name:t.icon,className:"h-[18px] w-[18px]"}),r&&Ss.jsx("span",{className:"absolute -right-2 -top-1.5",children:r})]}),Ss.jsx(jN,{label:t.label,hint:t.hint,placement:"right"})]},t.id)}),Ss.jsxs("button",{type:"button","aria-label":"Terminal",disabled:!t,onClick:()=>e.terminal.toggle(),className:ay("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":ay("text-fg-3",_N)),children:[Ss.jsx(cy,{name:"terminal",className:"h-[18px] w-[18px]"}),Ss.jsx(jN,{label:"Terminal",hint:t?"⌃`":mN,placement:"right"})]})]})}),$D=ps.createContext(()=>{});function YD({trigger:e,header:t,children:s,align:i="left",direction:n="up",disabled:r=!1,title:o,menuWidth:a="w-72",triggerClass:l,onOpen:c}){const[h,u]=ps.useState(!1),d=ps.useRef(null);return ky(d,()=>u(!1)),Ss.jsxs("div",{ref:d,className:"relative flex items-stretch",children:[Ss.jsx("button",{type:"button",onClick:()=>{r||u(e=>(e||null==c||c(),!e))},title:o,className:ay("flex min-w-0 items-center gap-1 rounded-sm px-1 font-mono text-[11px] transition-colors",!r&&"hover:bg-raised hover:text-fg",h&&"bg-raised text-fg",l),children:e}),h&&Ss.jsxs("div",{className:ay("absolute z-50 overflow-hidden rounded-md border border-edge-soft bg-overlay shadow-lg","up"===n?"bottom-full mb-1":"top-full mt-1","right"===i?"right-0":"left-0",a),children:[Ss.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}),Ss.jsx($D.Provider,{value:()=>u(!1),children:s})]})]})}function GD({icon:e,leadingDot:t,label:s,sublabel:i,note:n,active:r,disabled:o=!1,title:a,onSelect:l}){const c=ps.useContext($D);return Ss.jsxs("button",{type:"button",disabled:o,title:a,onClick:o?void 0:()=>{l(),c()},className:ay("flex w-full items-center gap-2.5 px-3 py-2 text-left transition-colors",o?"cursor-not-allowed opacity-60":r?"bg-raised/60":"hover:bg-raised/60"),children:[e&&Ss.jsx(cy,{name:e,className:"h-4 w-4 shrink-0 text-fg-3"}),Ss.jsxs("div",{className:"min-w-0 flex-1",children:[Ss.jsxs("div",{className:"flex items-center gap-1.5",children:[t&&Ss.jsx("span",{className:ay("h-1.5 w-1.5 rounded-full",t)}),Ss.jsx("span",{className:"font-mono text-[13px] text-fg",children:s})]}),i&&Ss.jsx("div",{className:"truncate text-[11px] text-fg-4",children:i}),n&&Ss.jsx("div",{className:"mt-1 text-[10.5px] leading-snug text-warn",children:n})]}),r&&!o&&Ss.jsx("span",{className:"font-mono text-[10px] uppercase tracking-wider text-accent",children:"current"})]})}const XD="gap-1.5 px-2",ZD={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 JD(e){return ZD[e]??{icon:"target",dot:"bg-fg-4",blurb:""}}const QD=m_(function(){return Ss.jsxs("div",{className:"flex h-5 shrink-0 items-stretch px-2 text-fg-3",children:[Ss.jsx(eE,{}),Ss.jsx(tE,{}),Ss.jsx(sE,{}),Ss.jsxs("div",{className:"ml-auto flex items-stretch gap-1",children:[Ss.jsx(iE,{}),Ss.jsx(oE,{}),Ss.jsxs("span",{className:"flex items-center px-1 font-mono text-[10px] text-fg-4",children:["v","0.36.0"]})]})]})}),eE=m_(function(){const{targets:e}=y_();if(0===e.available.length)return null;const t=e.active,s=JD(t);return Ss.jsx(YD,{header:"test target",align:"left",triggerClass:XD,disabled:!e.hasMultiple,title:s.blurb?`Target: ${t} — ${s.blurb}`:`Target: ${t}`,trigger:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("span",{className:ay("h-1.5 w-1.5 rounded-full",s.dot)}),Ss.jsx(cy,{name:s.icon,className:"h-3.5 w-3.5",strokeWidth:1.75}),Ss.jsx("span",{className:"truncate",children:t||"—"})]}),children:e.available.map(t=>Ss.jsx(nE,{info:t,active:t.target===e.active,onSelect:()=>{e.setActive(t.target)}},t.target))})}),tE=m_(function(){const{environments:e}=y_();if(!e.hasAny)return null;const t=e.active??"base";return Ss.jsxs(YD,{header:"env overlay",align:"left",triggerClass:XD,title:e.active?`Env overlay: ${e.active} — .env.${e.active} overlay + .runs.${e.active} history`:"Env overlay: base — unotest/.env, unotest/.runs",trigger:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx(cy,{name:"layers",className:"h-3.5 w-3.5",strokeWidth:1.75}),Ss.jsx("span",{className:"truncate",children:t})]}),children:[Ss.jsx(GD,{label:"base",sublabel:"unotest/.env — no overlay",active:null===e.active,onSelect:()=>{e.setActive(null)}}),e.names.map(t=>Ss.jsx(GD,{label:t,sublabel:`.env.${t} overlay · .runs.${t} history`,active:e.active===t,onSelect:()=>{e.setActive(t)}},t))]})}),sE=m_(function(){const{workspace:e}=y_(),t=e.file;if(!t)return null;const s=e.current,i=t.switchedBy?` · switched by ${t.switchedBy}`:"";return Ss.jsxs(YD,{header:"test bundle",align:"left",triggerClass:XD,menuWidth:"w-80",disabled:e.switching,title:s?`Bundle ${s.label} — pushed ${s.author?`by ${s.author}`:"to this box"}, running @unotest/web ${s.webVersion}${i}`:`${t.workspace}: nothing has been pushed to this environment yet`,trigger:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx(cy,{name:"package",className:"h-3.5 w-3.5",strokeWidth:1.75}),Ss.jsx("span",{className:"truncate",children:e.label}),(null==s?void 0:s.dirty)&&Ss.jsx("span",{className:"text-warn",children:"wip"}),e.switching&&Ss.jsx("span",{className:"text-fg-4",children:"switching…"})]}),children:[0===t.bundles.length&&Ss.jsxs("div",{className:"px-2 py-1.5 text-[11px] text-fg-4",children:["Nothing pushed yet — send this suite with",Ss.jsx("span",{className:"font-mono",children:" npx @unotest/web bundle push"}),"."]}),t.bundles.map(s=>Ss.jsx(GD,{label:s.label,sublabel:[s.author,`web ${s.webVersion}`,new Date(s.createdAt).toLocaleString()].filter(Boolean).join(" · "),active:s.bundleId===t.currentBundleId,onSelect:()=>{e.canSwitch&&e.switchTo(s.bundleId)}},s.bundleId)),!t.allowSwitch&&Ss.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&&Ss.jsx("div",{className:"px-2 py-1.5 text-[11px] text-danger",children:e.error})]})}),iE=m_(function(){const{session:e}=y_(),t=e.identity;if(!t)return null;const s=t.env?`${t.role} · ${t.env}`:t.role;return Ss.jsx(YD,{header:"session",align:"right",triggerClass:XD,menuWidth:"w-60",disabled:!t.logoutUrl,title:`Signed in as ${t.user} (${s})`,trigger:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx(cy,{name:"user",className:"h-3.5 w-3.5",strokeWidth:1.75}),Ss.jsx("span",{className:"truncate",children:t.user}),Ss.jsx("span",{className:"text-fg-4",children:s})]}),children:t.logoutUrl&&Ss.jsx(GD,{icon:"externalL",label:"log out",sublabel:"End this session and return to the login page",active:!1,onSelect:()=>e.logout()})})});function nE({info:e,active:t,onSelect:s}){var i,n;const r=JD(e.target),o=!!e.host&&!e.host.ok;return Ss.jsx(GD,{icon:r.icon,leadingDot:r.dot,label:e.target,sublabel:r.blurb||e.name,note:o?null==(i=e.host)?void 0:i.reason:void 0,active:t,disabled:o,title:o?null==(n=e.host)?void 0:n.reason:void 0,onSelect:s})}const rE=[{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"}],oE=m_(function(){const{theme:e}=y_(),t=rE.find(t=>t.mode===e.mode)??rE[2];return Ss.jsx(YD,{header:"theme",align:"right",triggerClass:XD,menuWidth:"w-60",title:`Theme: ${t.label}`,trigger:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx(cy,{name:t.icon,className:"h-3.5 w-3.5",strokeWidth:1.75}),Ss.jsx("span",{className:"truncate",children:t.label})]}),children:rE.map(t=>Ss.jsx(GD,{icon:t.icon,label:t.label,sublabel:t.blurb,active:t.mode===e.mode,onSelect:()=>e.set(t.mode)},t.mode))})}),aE=m_(function(){const e=y_(),t=e.targets.current,s=null==t?void 0:t.host;if(!t||!s)return null;if(!s.ok)return Ss.jsx(hE,{tone:"block",icon:"alert",title:`${t.target} isn’t available on this OS`,children:s.reason&&Ss.jsx("p",{className:"text-fg-2",children:s.reason})});const i=e.targetDoctor,n=i.checkedTarget===t.target?i.checks:null,r=null!==n&&!i.hasErrors;return Ss.jsxs(hE,{tone:r?"ok":"setup",icon:r?"check":"inspect",title:r?`${t.target} environment ready`:`Set up ${t.target}`,action:Ss.jsx("button",{type:"button",onClick:()=>{i.run(t.target)},disabled:i.busy,className:ay("shrink-0 rounded border px-3 py-1 font-mono text-[11px] transition-colors","border-edge-soft hover:bg-raised",i.busy&&"cursor-wait opacity-60"),children:i.busy?"Checking…":n?"Re-check":"Check"}),children:[Ss.jsx("p",{className:"text-fg-2",children:r?"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.`}),i.error&&Ss.jsx("p",{className:"mt-2 font-mono text-[11px] text-fail",children:i.error}),n&&n.length>0&&Ss.jsx("ul",{className:"mt-2 space-y-1.5",children:n.map(e=>Ss.jsxs("li",{className:"flex items-start gap-2 text-[12px]",children:[Ss.jsx("span",{className:ay("mt-[5px] h-1.5 w-1.5 shrink-0 rounded-full",lE(e.severity))}),Ss.jsxs("span",{className:"min-w-0",children:[Ss.jsx("span",{className:"text-fg",children:e.name}),Ss.jsxs("span",{className:"text-fg-2",children:[" — ",e.message]}),e.detail&&Ss.jsx("span",{className:"mt-0.5 block text-[11px] text-fg-3",children:e.detail})]})]},e.name))})]})});function lE(e){return"ok"===e?"bg-pass":"warning"===e?"bg-warn":"bg-fail"}const cE={setup:"border-warn/40 bg-warn/5",ok:"border-pass/40 bg-pass/5",block:"border-fail/40 bg-fail/5"};function hE({tone:e,icon:t,title:s,action:i,children:n}){return Ss.jsx("div",{className:ay("shrink-0 border-b px-4 py-3 text-[13px]",cE[e]),children:Ss.jsxs("div",{className:"flex items-start justify-between gap-3",children:[Ss.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[Ss.jsx(cy,{name:t,className:"mt-0.5 h-4 w-4 shrink-0 text-fg-2"}),Ss.jsxs("div",{className:"min-w-0",children:[Ss.jsx("div",{className:"font-medium text-fg",children:s}),n]})]}),i]})})}function uE({children:e}){return Ss.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})}const dE="text-[11.5px] text-fg-3",fE=m_(function(){var e,t;const{session:s}=y_();if(!s.canSwitchEnvironment)return null;const i=s.currentEnvironment,n=function(e){const t=[];for(const s of e)void 0===s.project||t.includes(s.project)||t.push(s.project);return t}(s.environments),r=null==i?void 0:i.project,o=s.environments.filter(e=>e.project===r);return Ss.jsxs("div",{className:"flex min-w-0 flex-1 items-center",children:[n.length>0&&Ss.jsxs(Ss.Fragment,{children:[Ss.jsx(YD,{header:"project",direction:"down",menuWidth:"w-64",triggerClass:dE,disabled:n.length<2,title:r?`Project: ${r}`:void 0,trigger:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("span",{className:"truncate",children:r??"—"}),Ss.jsx(pE,{hidden:n.length<2})]}),onOpen:()=>{s.loadEnvironments()},children:n.map(e=>Ss.jsx(GD,{label:e,sublabel:vE(s.environments,e),active:e===r,onSelect:()=>{const t=function(e,t,s){const i=e.filter(e=>e.project===t);return i.find(e=>e.environment===(null==s?void 0:s.environment))??i[0]}(s.environments,e,i);t&&s.switchEnvironment(t.name)}},e))}),Ss.jsx("span",{className:"shrink-0 text-fg-4",children:"/"})]}),Ss.jsxs(YD,{header:"environment",direction:"down",menuWidth:"w-64",triggerClass:dE,title:(null==i?void 0:i.note)?`Environment: ${i.environment} — running ${i.note}`:`Environment: ${(null==(e=s.identity)?void 0:e.env)??"—"}`,trigger:Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("span",{className:"truncate",children:(null==i?void 0:i.environment)??(null==(t=s.identity)?void 0:t.env)??"—"}),Ss.jsx(pE,{})]}),onOpen:()=>{s.loadEnvironments()},children:[0===o.length&&Ss.jsx("div",{className:"px-3 py-2 text-[11px] text-fg-4",children:s.loadingEnvironments?"Loading…":"This host serves no other environment right now."}),o.map(e=>{var t;return Ss.jsx(GD,{label:e.environment,sublabel:e.note??"nothing pushed yet",active:e.name===(null==(t=s.identity)?void 0:t.env),onSelect:()=>s.switchEnvironment(e.name)},e.name)})]})]})});function pE({hidden:e=!1}){return e?null:Ss.jsx(cy,{name:"chevronD",className:"h-3 w-3 shrink-0 opacity-0 transition-opacity group-hover/pane:opacity-100"})}function vE(e,t){return e.filter(e=>e.project===t).map(e=>e.environment).join(" · ")}function gE(e){return{paddingLeft:8+22*e}}function mE(e){return{paddingLeft:8+22*e+22}}function _E({children:e,onClick:t,onContextMenu:s,active:i,indent:n=!1,depth:r,leaf:o=!1,danger:a=!1,ariaLabel:l}){const c=void 0===r?void 0:o?mE(r):gE(r);return Ss.jsx("button",{type:"button","aria-label":l,onClick:t,onContextMenu:s,style:c,className:ay("flex w-full items-center gap-2 px-2 py-1 text-left",void 0===r&&n&&"pl-7",i?"bg-selection text-fg":"hover:bg-raised/60",a&&"text-fail"),children:e})}const xE=m_(function({query:e}){const t=y_(),s=ps.useMemo(()=>{const s=e.trim().toLowerCase(),i=(e,t)=>!s||e.toLowerCase().includes(s)||t.toLowerCase().includes(s),n=t.activeRuns.activeList.filter(e=>i(e.scenario,e.runId)).map(e=>{const t=e.events.filter(e=>"step:started"===e.kind).length,s=e.events.filter(e=>"step:ok"===e.kind||"step:fail"===e.kind).length,i=0===t?.05:Math.min(.95,s/Math.max(t,1));return{kind:"scenario",runId:e.runId,ref:e.scenario||e.runId,startedAt:e.startedAt,progress:i}}),r=t.activeRuns.activeCollectionList.filter(e=>i(e.collection,e.runId)).map(e=>{const t=e.scenarios.length||1,s=e.childOutcomes.size,i=Math.min(.95,s/t);return{kind:"collection",runId:e.runId,ref:e.collection||e.runId,startedAt:e.startedAt,progress:Math.max(.05,i),done:s,total:e.scenarios.length}});return r.sort((e,t)=>t.startedAt-e.startedAt),n.sort((e,t)=>t.startedAt-e.startedAt),[...r,...n]},[t.activeRuns.activeList,t.activeRuns.activeCollectionList,e]),i=t.queue.waiting.filter(t=>!e.trim()||t.ticket.ref.toLowerCase().includes(e.trim().toLowerCase()));return Ss.jsxs("div",{className:"py-1",children:[i.length>0&&Ss.jsxs("div",{className:"mb-1 border-b border-edge pb-1",children:[Ss.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"]}),i.map(e=>Ss.jsxs("div",{className:"flex w-full items-center gap-2 px-2 py-1 hover:bg-raised/60",children:[Ss.jsx(iN,{status:"pending"}),Ss.jsxs("div",{className:"min-w-0 flex-1",children:[Ss.jsx("div",{className:"truncate font-mono text-[12.5px] text-fg-2",children:e.ticket.ref}),Ss.jsxs("div",{className:"mt-0.5 truncate font-mono text-[10.5px] text-fg-4",children:["collection"===e.ticket.kind?"collection · ":"",e.ticket.ci?`${cx(e.ticket.ci)} · `:"",e.ticket.producer.kind," · waiting since"," ",rN(e.ticket.createdAt)]})]}),Ss.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:Ss.jsx(cy,{name:"x",className:"h-3.5 w-3.5"})})]},e.name))]}),s.map(e=>Ss.jsxs(_E,{onClick:()=>t.tabs.open("collection"===e.kind?{kind:"collection-run",runId:e.runId}:{kind:"scenario-run",runId:e.runId}),children:["collection"===e.kind?Ss.jsx(cy,{name:"layers",className:"h-3.5 w-3.5 text-fg-3"}):Ss.jsx(iN,{status:"running"}),Ss.jsxs("div",{className:"min-w-0 flex-1",children:[Ss.jsxs("div",{className:"flex items-center gap-1.5",children:[Ss.jsx("span",{className:"truncate font-mono text-[12.5px] text-fg-2",children:e.ref}),"collection"===e.kind&&Ss.jsx(eN,{size:"xs",tone:"info",children:"col"})]}),Ss.jsx("div",{className:ay("mt-1 h-1 overflow-hidden rounded bg-raised"),children:Ss.jsx("div",{className:"h-full bg-warn uno-pulse",style:{width:100*e.progress+"%"}})}),Ss.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 ${rN(e.startedAt)}`:`started ${rN(e.startedAt)}`})]})]},e.runId)),0===s.length&&0===i.length&&Ss.jsx(cB,{children:"nothing running"})]})}),bE=m_(function({title:e,extensions:t,onPick:s,onClose:i}){const n=y_(),[r,o]=ps.useState(null),[a,l]=ps.useState(null),c=e=>{n.appServer.browse(e,t).then(e=>{o(e),l(null)}).catch(e=>{l(e instanceof Error?e.message:String(e))})};ps.useEffect(()=>{c()},[]);return Ss.jsx("div",{className:"fixed inset-0 z-50 grid place-items-center bg-black/40",onClick:i,children:Ss.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:[Ss.jsxs("div",{className:"flex items-center gap-2 border-b border-edge-soft px-3 py-2",children:[Ss.jsx("span",{className:"font-mono text-[12px] text-fg",children:e}),Ss.jsx("span",{className:"truncate font-mono text-[10.5px] text-fg-4",children:(null==r?void 0:r.path)||"select a location"}),Ss.jsx("button",{type:"button",onClick:i,className:"ml-auto grid h-5 w-5 place-items-center rounded text-fg-4 hover:bg-raised hover:text-fg-2",children:Ss.jsx(cy,{name:"x",className:"h-3.5 w-3.5"})})]}),Ss.jsxs("div",{className:"flex-1 overflow-y-auto py-1",children:[a&&Ss.jsx("div",{className:"px-3 py-1 font-mono text-[11px] text-fail",children:a}),r&&""!==r.path&&Ss.jsxs("button",{type:"button",onClick:()=>c(r.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:[Ss.jsx(cy,{name:"chevronR",className:"h-3.5 w-3.5 rotate-180"}),".."]}),null==r?void 0:r.entries.map(e=>Ss.jsxs("button",{type:"button",onClick:()=>(e=>{"dir"===e.kind?c(e.path):s(e.path)})(e),className:ay("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:[Ss.jsx(cy,{name:"dir"===e.kind?"folder":"file",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),Ss.jsx("span",{className:"truncate",children:e.name}),"dir"!==e.kind&&Ss.jsx("span",{className:"ml-auto rounded bg-accent/10 px-1 font-mono text-[9px] uppercase text-accent",children:"select"})]},e.path)),r&&0===r.entries.length&&!a&&Ss.jsx("div",{className:"px-3 py-2 font-mono text-[11px] text-fg-4",children:"nothing matching here"})]})]})})}),yE={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"}},wE=m_(function({query:e}){var t;const s=y_(),i=s.appServer;ps.useEffect(()=>{i.load(),s.variables.load()},[i,s.variables]);const{status:n}=i;if(!n.available&&"stopped"===n.state)return Ss.jsxs(cB,{children:['target "',s.targets.active,'" has no app-server capability']});const r=yE[n.state],o=n.available&&("stopped"===n.state||"error"===n.state),a="running"===n.state||"starting"===n.state,l=s.session.capabilities.canRun,c=e.trim().toLowerCase(),h=c?n.log.filter(e=>e.toLowerCase().includes(c)):n.log;return Ss.jsxs("div",{className:"flex h-full flex-col",children:[Ss.jsxs("div",{className:"border-b border-edge-soft px-3 py-2",children:[Ss.jsxs("div",{className:"flex items-center gap-2",children:[Ss.jsx("span",{className:ay("h-2 w-2 shrink-0 rounded-full",r.dot)}),Ss.jsx("span",{className:"font-mono text-[11.5px] text-fg-2",children:r.label}),n.target&&n.target!==s.targets.active&&Ss.jsx("span",{className:"rounded bg-raised px-1 font-mono text-[9px] uppercase tracking-wide text-fg-3",children:n.target}),Ss.jsxs("span",{className:"ml-auto flex gap-1",children:[o&&l&&Ss.jsx("button",{type:"button",disabled:i.busy,onClick:()=>{i.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&&Ss.jsx("button",{type:"button",disabled:i.busy,onClick:()=>{i.stop()},className:"rounded bg-raised px-2 py-0.5 font-mono text-[11px] text-fg-2 hover:text-fg",children:"Stop"})]})]}),n.url&&Ss.jsx("a",{href:n.url,target:"_blank",rel:"noreferrer",className:"mt-1 block truncate font-mono text-[11px] text-accent hover:underline",children:n.url}),n.detail&&Ss.jsx("div",{className:"mt-1 font-mono text-[10.5px] text-fg-3",children:n.detail}),"external"===n.state&&Ss.jsx("div",{className:"mt-1 font-mono text-[10.5px] text-fg-4",children:"already served by another process — runs reuse it"}),(i.error??n.message)&&Ss.jsx("div",{className:"mt-1 font-mono text-[11px] text-fail",children:i.error??n.message}),null==(t=n.pickers)?void 0:t.map(e=>Ss.jsx(SE,{picker:e},e.envKey))]}),Ss.jsx("div",{className:"flex-1 overflow-y-auto px-3 py-1",children:0===h.length?Ss.jsx(cB,{children:"no output yet"}):h.map((e,t)=>Ss.jsx("div",{className:"whitespace-pre-wrap break-all font-mono text-[10.5px] leading-4 text-fg-2",children:e},t))})]})}),SE=m_(function({picker:e}){const t=y_().variables,s=t.rows.find(t=>"env"===t.source&&t.key===e.envKey),i=s?t.effectiveValue(s):"",[n,r]=ps.useState(null),[o,a]=ps.useState(!1),[l,c]=ps.useState(!1),h=n??i,u=null!==n&&n!==i,d=async()=>{if(u&&!l){c(!0);try{s?(t.setValue(s,h),await t.save()):await t.addVariable(e.envKey,h,"app"),r(null)}finally{c(!1)}}};return Ss.jsxs("div",{className:"mt-2",children:[Ss.jsxs("div",{className:"mb-0.5 flex items-center gap-1 font-mono text-[10.5px] text-fg-3",children:[e.label,Ss.jsx("span",{className:"text-fg-4",children:e.envKey})]}),Ss.jsxs("div",{className:"flex items-center gap-1",children:[Ss.jsx("input",{type:"text",value:h,spellCheck:!1,placeholder:`/path/to/your${e.extensions[0]??""}`,onChange:e=>r(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"}),Ss.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:Ss.jsx(cy,{name:"folder",className:"h-3.5 w-3.5"})}),u&&Ss.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&&Ss.jsx(bE,{title:e.label,extensions:e.extensions,onPick:e=>{r(e),a(!1)},onClose:()=>a(!1)})]})}),kE=m_(function({query:e}){const t=y_(),s=t.collections.items,[i,n]=ps.useState(!1),[r,o]=ps.useState(null),a=t.session.capabilities.canEditFiles,l=ps.useMemo(()=>{const t=e.trim().toLowerCase();return s.filter(e=>!t||e.name.toLowerCase().includes(t))},[s,e]);return Ss.jsxs("div",{className:"py-1",children:[i?Ss.jsx(CE,{existingNames:s.map(e=>e.name.toLowerCase()),onCommit:async e=>{const s=await t.collections.create(e);s&&(n(!1),t.tabs.open({kind:"collection",path:s.path}))},onCancel:()=>n(!1)}):a?Ss.jsxs("button",{type:"button",onClick:()=>n(!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:[Ss.jsx(cy,{name:"plus",className:"h-3.5 w-3.5"})," new collection"]}):null,l.map(e=>{const s=t.runs.lastRunByRef("collection",e.name),i=t.schedules.get("collection",e.name);return Ss.jsxs(_E,{onClick:()=>t.tabs.open({kind:"collection",path:e.path}),onContextMenu:t=>{t.preventDefault(),o({x:t.clientX,y:t.clientY,name:e.name})},children:[Ss.jsx(cy,{name:"layers",className:"h-3.5 w-3.5 text-fg-3"}),Ss.jsxs("div",{className:"min-w-0 flex-1",children:[Ss.jsxs("div",{className:"flex items-center gap-1.5",children:[Ss.jsx("span",{className:"truncate font-mono text-[12.5px] text-fg-2",children:e.name}),i&&Ss.jsx("span",{title:HN(i),children:Ss.jsx(cy,{name:"clock",className:"h-3 w-3 shrink-0 text-fg-4"})})]}),Ss.jsxs("div",{className:"mt-0.5 truncate font-mono text-[10.5px] text-fg-4",children:[e.scenarios.length," scenarios ·"," ",s?rN(s.startedAt):"never run"]})]})]},e.path)}),0===l.length&&!i&&Ss.jsx(cB,{children:"no collections match"}),r&&Ss.jsx(Cy,{x:r.x,y:r.y,items:[{kind:"header",label:r.name},{kind:"item",icon:"clock",label:(()=>{const e=t.schedules.get("collection",r.name);return e?`Schedule · ${Cb(e.cron)}`:"Schedule…"})(),disabled:!a,onSelect:()=>t.schedules.openEditor({kind:"collection",name:r.name})}],onClose:()=>o(null)})]})});function CE({existingNames:e,onCommit:t,onCancel:s}){const[i,n]=ps.useState(""),r=ps.useRef(null),o=ps.useRef(null);ps.useEffect(()=>{var e;null==(e=r.current)||e.focus()},[]);const a=i.trim(),l=a.length>0?$b(a):null,c=a.length>0&&e.includes(a.toLowerCase())?`"${a}" already exists`:l||null,h=a.length>0&&!c;return Ss.jsxs("form",{ref:o,onSubmit:e=>{e.preventDefault(),h&&t(a)},className:"mx-2 my-1",children:[Ss.jsxs("div",{className:ay("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:[Ss.jsx(cy,{name:"layers",className:"h-3.5 w-3.5 shrink-0 text-accent"}),Ss.jsx("input",{ref:r,value:i,onChange:e=>n(e.target.value),onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),s())},onBlur:e=>{o.current&&e.relatedTarget&&o.current.contains(e.relatedTarget)||a||s()},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"}),Ss.jsx("button",{type:"button",onMouseDown:e=>e.preventDefault(),onClick:s,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:Ss.jsx(cy,{name:"x",className:"h-3 w-3",strokeWidth:2.25})}),Ss.jsx("button",{type:"submit",disabled:!h,onMouseDown:e=>e.preventDefault(),title:"Create (↵)",className:ay("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:Ss.jsx(cy,{name:"check",className:"h-3.5 w-3.5",strokeWidth:2.5})})]}),Ss.jsx("div",{className:ay("mt-1 flex items-center gap-1 px-1 font-mono text-[10px]",c?"text-fail":"text-fg-4"),children:c?Ss.jsxs(Ss.Fragment,{children:[Ss.jsx(cy,{name:"alert",className:"h-3 w-3"})," ",c]}):Ss.jsx(Ss.Fragment,{children:"↵ create · esc cancel"})})]})}const jE=m_(function({query:e}){const t=y_(),s=t.helpers.items,i=ps.useMemo(()=>{const t=e.trim().toLowerCase();return s.filter(e=>!t||e.name.toLowerCase().includes(t))},[s,e]);return Ss.jsxs("div",{className:"py-1",children:[Ss.jsxs("div",{className:"flex h-7 items-center gap-1 px-2 text-fg-4",children:[Ss.jsx(cy,{name:"chevronD",className:"h-3.5 w-3.5 text-fg-4"}),Ss.jsx("span",{className:"font-mono text-[11px] uppercase tracking-wider",children:"_helpers"}),Ss.jsx("span",{className:"ml-auto font-mono text-[10.5px] text-fg-4",children:i.length})]}),i.map(e=>Ss.jsxs(_E,{indent:!0,onClick:()=>t.tabs.open({kind:"helper",path:e.path}),children:[Ss.jsx(cy,{name:"braces",className:"h-3.5 w-3.5 text-fg-3"}),Ss.jsxs("div",{className:"min-w-0 flex-1",children:[Ss.jsxs("div",{className:"truncate font-mono text-[12.5px] text-fg-2",children:[e.name,".js"]}),Ss.jsx("div",{className:"mt-0.5 truncate font-mono text-[10.5px] text-fg-4",children:e.path})]})]},e.path)),0===i.length&&Ss.jsx(cB,{children:"no helpers match"})]})});function NE(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 ME(e,t={}){const s=t.now??Date.now(),i=t.flat?e.map(e=>({kind:"run",run:e})):function(e){const t=new Map;for(const i of e)"collection"===i.kind&&t.set(i.runId,{kind:"collection",run:i,children:[],passed:0,failed:0});const s=[];for(const i of e){if("collection"===i.kind){s.push(t.get(i.runId));continue}const e=i.parentRunId?t.get(i.parentRunId):void 0;e?(e.children.push(i),"passed"===i.status?e.passed++:"failed"!==i.status&&"interrupted"!==i.status||e.failed++):s.push({kind:"run",run:i})}return s}(e),n=[];let r=null;for(const o of i){const{startedAt:e}=o.run,i=LE(e);r&&r.key===i||(r={key:i,label:DE(e,s),entries:[]},n.push(r)),BE(r.entries,o,!0===t.flat)}return n}function BE(e,t,s){if(s||"run"!==t.kind)return void e.push(t);const i=e[e.length-1];"repeats"!==(null==i?void 0:i.kind)||i.ref!==t.run.ref?"run"!==(null==i?void 0:i.kind)||i.run.ref!==t.run.ref?e.push(t):e[e.length-1]={kind:"repeats",ref:t.run.ref,runs:[i.run,t.run]}:i.runs.push(t.run)}function LE(e){const t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function DE(e,t){const s=LE(e);return s===LE(t)?"Today":s===LE(t-864e5)?"Yesterday":new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric",...new Date(e).getFullYear()===new Date(t).getFullYear()?{}:{year:"numeric"}})}const EE="scenario";function PE({chevron:e,status:t,icon:s}){return Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("span",{className:"flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:void 0!==e&&Ss.jsx(cy,{name:"open"===e?"chevronD":"chevronR",className:"h-3.5 w-3.5 text-fg-4"})}),Ss.jsx("span",{className:"flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:void 0!==t?Ss.jsx(iN,{status:t}):void 0!==s&&Ss.jsx(cy,{name:s,className:"h-3.5 w-3.5 text-fg-4"})})]})}const RE=m_(function(){const e=y_(),t=e.overview.failing;return 0===t.length?null:Ss.jsxs("div",{className:"mb-1 border-b border-edge-soft pb-1",children:[Ss.jsxs("div",{className:"flex items-center gap-1.5 px-3 pb-0.5 pt-2",children:[Ss.jsx("span",{className:"font-mono text-[10.5px] uppercase tracking-wider text-fail",children:"Failing now"}),Ss.jsxs("span",{className:"font-mono text-[10.5px] text-fg-4",children:["· ",t.length," ",1===t.length?"test":"tests"]})]}),t.map(t=>Ss.jsxs(_E,{depth:0,ariaLabel:`${t.ref} — failing, ${AE(t.failStreak)}, last run ${rN(t.lastAt)}`,onClick:()=>{e.runs.setScenarioFilter(t.ref)},children:[Ss.jsx(PE,{status:"failed"}),Ss.jsx("span",{className:"truncate font-mono text-[11px] text-fg-2",children:t.ref}),Ss.jsxs("span",{className:"ml-auto shrink-0 font-mono text-[10px] text-fg-4",children:[rN(t.lastAt)," · ",AE(t.failStreak)]})]},t.ref))]})});function AE(e){return 1===e?"red 1 run":`red ${e} runs`}function zE({runs:e}){const t=e.slice(0,20).slice().reverse();if(t.length<2)return null;const s=t.map(e=>e.durationMs??0),i=Math.max(...s,1),n=t.filter(e=>"failed"===e.status||"interrupted"===e.status).length;return Ss.jsxs("div",{className:"mx-2 mb-1 rounded border border-edge-soft px-2 py-1.5",children:[Ss.jsx("div",{className:"flex items-end gap-[2px]","aria-label":`Last ${t.length} runs: ${t.length-n} passed, ${n} failed`,role:"img",children:t.map(e=>Ss.jsx("span",{title:`${e.status} · ${nN(e.durationMs)}`,style:{height:`${Math.max(3,Math.round((e.durationMs??0)/i*18))}px`},className:ay("w-[5px] shrink-0 rounded-[1px]","passed"===e.status?"bg-pass":"failed"===e.status||"interrupted"===e.status?"bg-fail":"bg-fg-4")},e.runId))}),Ss.jsxs("div",{className:"mt-1 flex items-center justify-between font-mono text-[9.5px] text-fg-4",children:[Ss.jsxs("span",{children:["last ",t.length," · ",n," failed"]}),Ss.jsxs("span",{children:["up to ",nN(i)]})]})]})}const TE=m_(function({query:e}){var t;const s=y_(),[i,n]=ps.useState("all"),[r,o]=ps.useState(new Set),a=s.runs.scenarioFilter,l=ps.useRef(!1);ps.useEffect(()=>{const e=function(e){const t=new URLSearchParams(e).get(EE);return t&&""!==t.trim()?t:null}(window.location.search);e&&s.runs.setScenarioFilter(e),l.current=!0},[s]),ps.useEffect(()=>{l.current&&window.history.replaceState(null,"",function(e,t){const s=new URL(e,"http://localhost");return t?s.searchParams.set(EE,t):s.searchParams.delete(EE),`${s.pathname}${s.search}${s.hash}`}(`${window.location.pathname}${window.location.search}${window.location.hash}`,a))},[a]);const c=e=>{s.runs.setScenarioFilter(e)},h=s.workspace.hosted?(null==(t=s.workspace.file)?void 0:t.currentBundleId)??null:null,[u,d]=ps.useState(!1),f=ps.useMemo(()=>{const t=e.trim().toLowerCase();return s.runs.items.filter(e=>("failed"!==i||"failed"===e.status)&&(("passed"!==i||"passed"===e.status)&&((!u||null===h||e.bundleId===h)&&(!t||e.ref.toLowerCase().includes(t)))))},[s.runs.items,e,i,u,h]),p=ps.useMemo(()=>ME(f,{flat:null!==a}),[f,a]),v=e=>s.tabs.open("collection"===e.kind?{kind:"collection-run",runId:e.runId}:{kind:"scenario-run",runId:e.runId});return Ss.jsxs("div",{className:"py-1",children:[a?Ss.jsx(IE,{ref_:a,onClear:()=>c(null)}):Ss.jsx("div",{className:"mx-2 mb-1 grid grid-cols-3 overflow-hidden rounded border border-edge-soft",children:["all","failed","passed"].map(e=>Ss.jsx("button",{type:"button",onClick:()=>n(e),className:ay("py-1 font-mono text-[10.5px] uppercase tracking-wider",i===e?"bg-raised text-fg":"text-fg-3 hover:bg-raised/60"),children:"failed"===e?"failed runs":e},e))}),null!==h&&Ss.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:ay("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?Ss.jsx(zE,{runs:f}):Ss.jsx(RE,{}),p.map(e=>Ss.jsxs("div",{children:[Ss.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=>Ss.jsx(OE,{entry:e,expanded:r.has(NE(e)),onToggle:()=>{return t=NE(e),o(e=>{const s=new Set(e);return s.delete(t)||s.add(t),s});var t},onOpen:v,onScenario:c,showRef:null===a},NE(e)))]},e.key)),0===f.length&&(s.runs.indexReady?Ss.jsx(cB,{children:"no runs match"}):Ss.jsx(cB,{children:"history is still loading…"})),s.runs.hasMore&&Ss.jsx("button",{type:"button",onClick:()=>{s.runs.loadMore()},disabled:s.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:s.runs.loadingMore?"loading…":"load older runs"})]})});function IE({ref_:e,onClear:t}){return Ss.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:[Ss.jsx("span",{className:"shrink-0 font-mono text-[9.5px] uppercase tracking-wider text-fg-4",children:"test"}),Ss.jsx("span",{className:"truncate font-mono text-[11px] text-fg-2",children:e}),Ss.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:Ss.jsx(cy,{name:"x",className:"h-3 w-3"})})]})}function OE({entry:e,expanded:t,onToggle:s,onOpen:i,onScenario:n,showRef:r}){if("run"===e.kind)return Ss.jsx(HE,{run:e.run,showRef:r,onOpen:i,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 Ss.jsxs(Ss.Fragment,{children:[Ss.jsxs(_E,{depth:0,ariaLabel:"collection"===e.kind?`Collection ${a} — ${e.passed} passed, ${e.failed} failed, ${rN(o.startedAt)}`:`${a} — ${l} runs, ${rN(o.startedAt)}`,onClick:s,children:[Ss.jsx(PE,{chevron:t?"open":"closed",status:lN(o.status)}),Ss.jsx("span",{className:"truncate font-mono text-[11px] text-fg-2",onClick:t=>{t.stopPropagation(),"repeats"===e.kind&&n(a)},children:a}),"collection"===e.kind&&Ss.jsx(eN,{size:"xs",tone:"info",children:"col"}),Ss.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}),Ss.jsx("span",{className:"shrink-0 font-mono text-[10px] text-fg-4",children:rN(o.startedAt)})]}),t&&("collection"===e.kind?Ss.jsxs(Ss.Fragment,{children:[Ss.jsxs(_E,{depth:1,ariaLabel:`Open collection run ${a}`,onClick:()=>i(e.run),children:[Ss.jsx(PE,{icon:"layers"}),Ss.jsx("span",{className:"truncate font-mono text-[10.5px] text-fg-3",children:"open collection run"})]}),e.children.map(e=>Ss.jsx(HE,{run:e,showRef:!0,onOpen:i,depth:1},e.runId))]}):e.runs.map(e=>Ss.jsx(HE,{run:e,showRef:!1,onOpen:i,depth:1},e.runId)))]})}function HE({run:e,showRef:t,onOpen:s,depth:i}){var n;const{workspace:r}=y_(),o=r.hosted&&void 0!==e.bundleId&&e.bundleId!==(null==(n=r.file)?void 0:n.currentBundleId)?e.bundleId:null;return Ss.jsxs(_E,{depth:i,ariaLabel:`${"collection"===e.kind?"Collection":"Run"} ${e.ref} — ${e.status}, ${rN(e.startedAt)}`,onClick:()=>s(e),children:[Ss.jsx(PE,{status:lN(e.status)}),t?Ss.jsx("span",{className:"truncate font-mono text-[11px] text-fg-3",children:e.ref}):Ss.jsx("span",{className:"truncate font-mono text-[11px] text-fg-3",children:rN(e.startedAt)}),t&&Ss.jsx("span",{className:"shrink-0 font-mono text-[10px] text-fg-4",children:rN(e.startedAt)}),o&&Ss.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&&Ss.jsx("span",{className:"ml-auto shrink-0 font-mono text-[10.5px] text-fg-4",children:nN(e.durationMs)})]})}function FE(e){const t=e.lastIndexOf("/");return t<0?e:e.slice(t+1)}function WE(e){const t=e.lastIndexOf("/");return t<0?"":e.slice(0,t)}function KE(e){return e.endsWith(".js")?e.slice(0,-3):e}function UE({title:e,message:t,confirmLabel:s="Delete",cancelLabel:i="Cancel",danger:n=!0,onConfirm:r,onCancel:o}){const a=ps.useRef(null);return ps.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]),Ss.jsx("div",{className:"fixed inset-0 z-50 grid place-items-center bg-black/30 backdrop-blur-[1px]",onMouseDown:o,children:Ss.jsxs("div",{role:"dialog","aria-modal":"true",onMouseDown:e=>e.stopPropagation(),className:ay("w-[min(380px,calc(100vw-2rem))] rounded-lg p-4","border border-edge-soft bg-overlay shadow-xl"),children:[Ss.jsx("div",{className:"text-[13px] font-medium text-fg",children:e}),Ss.jsx("div",{className:"mt-1.5 text-[12px] leading-relaxed text-fg-2",children:t}),Ss.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[Ss.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:i}),Ss.jsx("button",{ref:a,type:"button",onClick:r,className:ay("h-7 rounded px-3 font-mono text-[11.5px] font-medium text-on-accent",n?"bg-fail hover:bg-fail/80":"bg-accent hover:bg-accent-hover"),children:s})]})]})})}function qE(e,{validate:t,onCommit:s,onCancel:i}){const[n,r]=ps.useState(e),o=ps.useRef(null),a=ps.useRef(!1);ps.useEffect(()=>{var e,t;null==(e=o.current)||e.focus(),null==(t=o.current)||t.select()},[]);const l=n.trim(),c=l?(null==t?void 0:t(l))??null:null,h=l.length>0&&!c,u=()=>{a.current||(a.current=!0,h?s(l):i())};return{err:c,ringClass:c?"ring-1 ring-fail":"ring-1 ring-accent",onSubmit:e=>{e.preventDefault(),u()},inputProps:{ref:o,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),a.current||(a.current=!0,i()))},onBlur:u,spellCheck:!1,autoComplete:"off"}}}const VE=m_(function({query:e}){var t;const s=y_(),i=s.scenarios,n=s.session.capabilities.canEditFiles,r=i.buildTree(e),o=0===r.folders.length&&0===r.scenarios.length&&null===i.creating;return Ss.jsxs("div",{className:"min-h-full py-1",onContextMenu:e=>{e.preventDefault(),i.openMenu(e.clientX,e.clientY,{kind:"blank"})},onKeyDown:e=>function(e,t,s){if("INPUT"===e.target.tagName)return;const i=t.selected,n=e.metaKey||e.ctrlKey,r=!!i&&"blank"!==i.kind;"F2"===e.key&&r&&s?(e.preventDefault(),t.startRename(i)):n&&("c"===e.key||"C"===e.key)&&r?(e.preventDefault(),t.copy(i)):n&&("v"===e.key||"V"===e.key)&&s&&(e.preventDefault(),t.paste(JE(i)))}(e,i,n),children:[i.actionError&&Ss.jsx("button",{type:"button",onClick:()=>i.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:i.actionError}),""===(null==(t=i.creating)?void 0:t.parent)&&Ss.jsx(ZE,{store:i,depth:0,kind:i.creating.kind}),r.folders.map(e=>Ss.jsx($E,{node:e,depth:0},e.rel)),r.scenarios.map(e=>Ss.jsx(YE,{s:e,depth:0},e.path)),o&&Ss.jsx(cB,{children:"no scenarios match"}),i.menu&&Ss.jsx(Cy,{x:i.menu.x,y:i.menu.y,items:QE(i,s.schedules,i.menu.target,n),onClose:()=>i.closeMenu()}),i.pendingDelete&&"blank"!==i.pendingDelete.kind&&Ss.jsx(UE,{title:"folder"===i.pendingDelete.kind?`Delete folder "${FE(i.pendingDelete.rel)}"?`:`Delete "${KE(FE(i.pendingDelete.rel))}"?`,message:"folder"===i.pendingDelete.kind?"This permanently deletes the folder and everything inside it.":"This permanently deletes the scenario file.",onConfirm:()=>{i.confirmDelete()},onCancel:()=>i.cancelDelete()})]})}),$E=m_(function e({node:t,depth:s}){var i,n;const r=y_().scenarios,o=r.isExpanded(t.rel);if("folder"===(null==(i=r.renaming)?void 0:i.kind)&&r.renaming.rel===t.rel)return Ss.jsx(GE,{depth:s,initial:t.name,open:o,onCommit:e=>{r.commitRename(e)},onCancel:()=>r.cancelRename()});return Ss.jsxs("div",{children:[Ss.jsxs("button",{type:"button",onClick:()=>{r.select({kind:"folder",rel:t.rel}),r.toggle(t.rel)},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),r.openMenu(e.clientX,e.clientY,{kind:"folder",rel:t.rel})},style:gE(s),className:"flex h-7 w-full items-center gap-2 pr-2 text-left text-fg-2 hover:text-fg",children:[Ss.jsx(cy,{name:o?"chevronD":"chevronR",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),Ss.jsx(cy,{name:"folder",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),Ss.jsx("span",{className:"truncate font-mono text-[12.5px]",children:t.name}),Ss.jsx("span",{className:"ml-auto shrink-0 font-mono text-[10.5px] text-fg-4",children:t.scenarios.length})]}),o&&Ss.jsxs(Ss.Fragment,{children:[(null==(n=r.creating)?void 0:n.parent)===t.rel&&Ss.jsx(ZE,{store:r,depth:s+1,kind:r.creating.kind}),t.folders.map(t=>Ss.jsx(e,{node:t,depth:s+1},t.rel)),t.scenarios.map(e=>Ss.jsx(YE,{s:e,depth:s+1},e.path))]})]})}),YE=m_(function({s:e,depth:t}){var s;const i=y_(),n=i.scenarios,r=i.runs.lastRunByRef("scenario",e.name),o=i.schedules.get("scenario",e.name),a=`${e.name}.js`,l={kind:"scenario",rel:a},c=i.tabs.activeTab,h="scenario"===(null==c?void 0:c.kind)&&c.path===e.path;return"scenario"===(null==(s=n.renaming)?void 0:s.kind)&&n.renaming.rel===a?Ss.jsx(XE,{depth:t,initial:FE(e.name),onCommit:e=>{n.commitRename(e)},onCancel:()=>n.cancelRename()}):Ss.jsx(_E,{depth:t,leaf:!0,active:h,onClick:()=>{n.select(l),i.tabs.open({kind:"scenario",path:e.path})},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),n.openMenu(e.clientX,e.clientY,l)},children:Ss.jsxs("span",{className:"flex min-w-0 items-center gap-[5px]",children:[Ss.jsx("span",{className:"grid h-3.5 w-3.5 shrink-0 place-items-center",children:Ss.jsx(iN,{status:oN((null==r?void 0:r.status)??null,e.expectFail)})}),Ss.jsx("span",{className:"truncate font-mono text-[12.5px] text-fg-2",children:FE(e.name)}),o&&Ss.jsx("span",{title:HN(o),children:Ss.jsx(cy,{name:"clock",className:"h-3 w-3 shrink-0 text-fg-4"})})]})})});function GE({depth:e,initial:t,open:s=!0,onCommit:i,onCancel:n}){const{ringClass:r,onSubmit:o,inputProps:a}=qE(t,{validate:ey,onCommit:i,onCancel:n});return Ss.jsxs("form",{onSubmit:o,style:gE(e),className:"flex h-7 w-full items-center gap-2 pr-2",children:[Ss.jsx(cy,{name:s?"chevronD":"chevronR",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),Ss.jsx(cy,{name:"folder",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),Ss.jsx("input",{...a,className:ay("min-w-0 flex-1 rounded-sm bg-canvas px-1 font-mono text-[12.5px] text-fg outline-none",r)})]})}function XE({depth:e,initial:t,onCommit:s,onCancel:i}){const{ringClass:n,onSubmit:r,inputProps:o}=qE(t,{validate:ey,onCommit:s,onCancel:i});return Ss.jsx("form",{onSubmit:r,style:mE(e),className:"flex w-full items-center py-1 pr-2",children:Ss.jsx("input",{...o,placeholder:"scenario-name",className:ay("min-w-0 flex-1 rounded-sm bg-canvas px-1 font-mono text-[12.5px] leading-[1.5] text-fg outline-none",n)})})}function ZE({store:e,depth:t,kind:s}){const i=t=>{e.commitCreate(t)},n=()=>e.cancelCreate();return"folder"===s?Ss.jsx(GE,{depth:t,initial:"",onCommit:i,onCancel:n}):Ss.jsx(XE,{depth:t,initial:"",onCommit:i,onCancel:n})}function JE(e){return e?"folder"===e.kind?e.rel:"scenario"===e.kind?WE(e.rel):"":""}function QE(e,t,s,i){const n=e.clipboard,r=n?"folder"===n.kind?`Paste folder "${n.label}"`:`Paste "${n.label}"`:"Paste",o=JE(s),a={kind:"item",icon:"file",label:"New scenario",disabled:!i,onSelect:()=>e.startCreate(o,"scenario")},l={kind:"item",icon:"folderPlus",label:"New folder",disabled:!i,onSelect:()=>e.startCreate(o,"folder")},c={kind:"item",icon:"clipboard",label:r,disabled:!n||!i,onSelect:()=>{e.paste(o)}};if("blank"===s.kind)return[a,l,c];return[{kind:"header",label:"folder"===s.kind?FE(s.rel):KE(FE(s.rel))},a,l,{kind:"item",icon:"copy",label:"Copy",onSelect:()=>e.copy(s)},{kind:"item",icon:"externalL",label:"Copy link",onSelect:()=>e.copyPath(s)},c,{kind:"item",icon:"edit",label:"Rename",shortcut:"F2",disabled:!i,onSelect:()=>e.startRename(s)},...eP(t,s,i),{kind:"separator"},{kind:"item",icon:"trash",label:"Delete",tone:"danger",disabled:!i,onSelect:()=>e.requestDelete(s)}]}function eP(e,t,s){if("scenario"!==t.kind)return[];const i=KE(t.rel),n=e.get("scenario",i);return[{kind:"item",icon:"clock",label:n?`Schedule · ${Cb(n.cron)}`:"Schedule…",disabled:!s,onSelect:()=>e.openEditor({kind:"scenario",name:i})}]}const tP=m_(function({query:e}){const t=y_(),[s,i]=ps.useState(!1),[n,r]=ps.useState(null),o=ps.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 Ss.jsxs("div",{onDragOver:e=>{e.preventDefault(),i(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||i(!1)},onDrop:e=>{e.preventDefault(),i(!1),h(e.dataTransfer.files[0])},className:ay("relative flex min-h-full flex-col py-1",s&&"bg-accent/10 ring-2 ring-inset ring-accent/60"),children:[Ss.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=""}}),Ss.jsx("div",{className:"px-2 pb-2",children:Ss.jsx(qB,{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?Ss.jsx(cB,{children:"no snapshots — open or drop a .unotest.zip"}):c.map(e=>{return Ss.jsxs(_E,{active:t.tabs.activeKey===`snapshot:${e.snapshotId}`,onClick:()=>t.tabs.open({kind:"snapshot",snapshotId:e.snapshotId}),onContextMenu:t=>{t.preventDefault(),r({x:t.clientX,y:t.clientY,id:e.snapshotId,label:e.manifest.scenario})},children:[Ss.jsx(iN,{status:(s=e.manifest.status,"interrupted"===s?"aborted":s)}),Ss.jsxs("span",{className:"min-w-0 flex-1",children:[Ss.jsx("span",{className:"block truncate font-mono text-[12px] text-fg-2",children:e.manifest.scenario}),Ss.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 s}),s&&Ss.jsx("div",{className:"pointer-events-none absolute inset-0 grid place-items-center",children:Ss.jsxs("div",{className:"flex flex-col items-center gap-1 text-accent",children:[Ss.jsx(cy,{name:"camera",className:"h-5 w-5"}),Ss.jsx("span",{className:"font-mono text-[11px]",children:"Drop to open snapshot"})]})}),n&&Ss.jsx(Cy,{x:n.x,y:n.y,onClose:()=>r(null),items:(u=n.label,d=()=>{return e=n.id,s=n.label,void(a&&window.confirm(`Delete snapshot "${s}"?`)&&(t.tabs.close(`snapshot:${e}`),t.snapshots.remove(e).catch(e=>window.alert(`Delete failed: ${(null==e?void 0:e.message)??e}`))));var e,s},[{kind:"header",label:u},{kind:"item",icon:"trash",label:"Delete snapshot",tone:"danger",onSelect:d}])})]});var u,d});const sP={secret:{label:"Secrets",file:".secrets",badge:!0},app:{label:"App variables",file:".env"},runner:{label:"Runner config",file:".env"}},iP=["app","secret","runner"];function nP({on:e,onChange:t,title:s}){return Ss.jsx("button",{type:"button",role:"switch","aria-checked":e,onClick:t,title:s,className:ay("relative inline-flex h-[18px] w-[30px] shrink-0 items-center rounded-full",e?"bg-accent":"bg-raised"),children:Ss.jsx("span",{className:ay("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 rP=m_(function({query:e}){const t=y_().variables;ps.useEffect(()=>{t.load()},[t]);const s=t.filtered(e),i=e.trim().length>0,[n,r]=ps.useState({secret:!1,app:!1,runner:!0}),[o,a]=ps.useState(null),l=t.edits.size+t.activated.size;return Ss.jsxs("div",{className:"flex h-full flex-col",children:[Ss.jsx(oP,{}),t.dirty&&Ss.jsxs("div",{className:"flex items-center gap-2 border-b border-accent/30 bg-accent/10 px-3 py-1.5",children:[Ss.jsxs("span",{className:"font-mono text-[11px] text-accent",children:[l," change",1===l?"":"s"]}),Ss.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"}),Ss.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&&Ss.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&&Ss.jsxs("div",{className:"flex items-start gap-2 border-b border-warn/30 bg-warn/10 px-3 py-1.5",children:[Ss.jsx("div",{className:"flex-1 space-y-0.5 font-mono text-[11px] text-warn",children:t.warnings.map((e,t)=>Ss.jsxs("div",{children:["⚠ ",e]},t))}),Ss.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:Ss.jsx(cy,{name:"x",className:"h-3 w-3"})})]}),Ss.jsxs("div",{className:"flex-1 overflow-y-auto py-1",children:[iP.map(e=>{const t=s.filter(t=>t.category===e),l=sP[e],c=o===e;if(0===t.length&&!c&&!i)return Ss.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:[Ss.jsx(cy,{name:"plus",className:"h-3.5 w-3.5"}),"Add ",l.label.toLowerCase()]},e);const h=n[e]&&!i;return Ss.jsxs("div",{className:"mb-1",children:[Ss.jsxs("div",{className:"group/header flex h-7 w-full items-center gap-1 px-2 text-fg-4",children:[Ss.jsxs("button",{type:"button",onClick:()=>r(t=>({...t,[e]:!t[e]})),className:"flex flex-1 items-center gap-1 truncate hover:text-fg-2",children:[Ss.jsx(cy,{name:h?"chevronR":"chevronD",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),Ss.jsx("span",{className:"font-mono text-[11px] uppercase tracking-wider",children:l.label}),l.badge&&Ss.jsx("span",{className:"rounded bg-warn/15 px-1 font-mono text-[9px] uppercase tracking-wide text-warn",children:"secret"}),Ss.jsx("span",{className:"font-mono text-[10px] text-fg-4",children:l.file})]}),Ss.jsx("button",{type:"button",title:`Add ${l.label.toLowerCase()}`,onClick:()=>{a(e),r(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:Ss.jsx(cy,{name:"plus",className:"h-3.5 w-3.5"})}),Ss.jsx("span",{className:"font-mono text-[10.5px] text-fg-4",children:t.length})]}),!h&&Ss.jsxs(Ss.Fragment,{children:[c&&Ss.jsx(aP,{category:e,onClose:()=>a(null)}),t.map(e=>Ss.jsx(lP,{v:e},`${e.source} ${e.key}`))]})]},e)}),0===s.length&&i&&Ss.jsx(cB,{children:"no variables match"})]})]})}),oP=m_(function(){const e=y_(),{environments:t,variables:s}=e;if(!t.hasAny)return null;const i=s.dirty,n=[{label:"base",value:null},...t.names.map(e=>({label:e,value:e}))];return Ss.jsxs("div",{className:"flex flex-wrap items-center gap-1 border-b border-edge-soft px-3 py-1.5",title:i?"Save or discard changes before switching environments":void 0,children:[Ss.jsx("span",{className:"mr-1 font-mono text-[10px] uppercase tracking-wider text-fg-4",children:"env"}),n.map(e=>{const s=t.active===e.value;return Ss.jsx("button",{type:"button",disabled:i&&!s,onClick:()=>{t.setActive(e.value)},className:ay("rounded px-1.5 py-0.5 font-mono text-[11px] transition-colors",s?"bg-accent text-on-accent":"text-fg-3 hover:bg-raised hover:text-fg",i&&!s&&"opacity-40 hover:bg-transparent"),children:e.label},e.label)})]})}),aP=m_(function({category:e,onClose:t}){const s=y_().variables,i=ps.useMemo(()=>new Set(s.rows.map(e=>e.key)),[s.rows]),n=ps.useMemo(()=>[...sy].filter(e=>!i.has(e)).sort(),[i]),[r,o]=ps.useState("runner"===e?n[0]??"":""),[a,l]=ps.useState(""),c=r.trim().length>0&&!s.saving,h=async()=>{if(!c)return;await s.addVariable(r.trim(),a,e)&&t()};return Ss.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?Ss.jsxs("select",{value:r,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===n.length&&Ss.jsx("option",{value:"",children:"all runner keys set"}),n.map(e=>Ss.jsx("option",{value:e,children:e},e))]}):Ss.jsx("input",{type:"text",value:r,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"}),Ss.jsxs("div",{className:"flex items-center gap-1",children:[Ss.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"}),Ss.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"}),Ss.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"})]})]})}),lP=m_(function({v:e}){const t=y_().variables,s=e.commented&&!t.isActivated(e),i="1"===t.effectiveValue(e),n=e.secret&&!t.isRevealed(e),r=t.isEdited(e)||t.isActivated(e);return Ss.jsxs("div",{className:ay("group/row flex h-[44px] flex-col justify-center gap-0.5 px-3",s&&"opacity-45 hover:opacity-70 dark:opacity-70 dark:hover:opacity-100"),children:[Ss.jsxs("div",{className:"flex items-center gap-1 truncate font-mono text-[11.5px]",children:[s&&Ss.jsx("span",{className:"text-fg-4",children:"#"}),Ss.jsx("span",{className:ay("truncate",s?"text-fg-3":"text-fg-2"),title:e.key,children:e.key}),e.shared&&Ss.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&&Ss.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}),e.boxInjected&&Ss.jsx("span",{className:"shrink-0 rounded bg-raised px-1 font-mono text-[9px] uppercase tracking-wide text-fg-3",title:e.secret?"a secret the box holds for this environment — set with `unotest-web env set --secret` or on the admin page; the value never leaves the box":"set by the box for every run in this environment (its config, or `unotest-web env push`) — read-only here",children:"box"}),r&&Ss.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-accent",title:"edited"}),!e.boxInjected&&Ss.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:Ss.jsx(cy,{name:"trash",className:"h-3.5 w-3.5"})})]}),Ss.jsx("div",{className:"flex h-6 items-center gap-1",children:e.boxInjected?Ss.jsx("span",{className:"w-full truncate rounded px-1.5 font-mono text-[11.5px] leading-6 text-fg-3",title:e.secret?"value held by the box":e.value,children:e.secret?"••••••••••":e.value||Ss.jsx("span",{className:"text-fg-4",children:"empty"})}):s?Ss.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?Ss.jsxs(Ss.Fragment,{children:[Ss.jsx(nP,{on:i,onChange:()=>t.toggleBool(e),title:i?"On (1) — click to set 0":"Off (0) — click to set 1"}),Ss.jsx("span",{className:ay("font-mono text-[11px] tabular-nums",i?"text-accent":"text-fg-4"),children:i?"1":"0"})]}):Ss.jsxs(Ss.Fragment,{children:[Ss.jsx("input",{type:n?"password":"text",value:t.effectiveValue(e),spellCheck:!1,autoFocus:t.isActivated(e),placeholder:"empty",onChange:s=>t.setValue(e,s.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&&Ss.jsx("button",{type:"button",title:n?"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:Ss.jsx(cy,{name:n?"eye":"eyeOff",className:"h-3.5 w-3.5"})})]})})]})}),cP={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 hP({section:e}){return Ss.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:cP[e].map((e,t)=>Ss.jsxs("span",{className:"flex items-center gap-1",children:[e.keys.map(e=>Ss.jsx(uE,{children:e},e)),Ss.jsx("span",{className:"font-mono text-[10px] text-fg-4",children:e.label})]},t))})}const uP={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…"},dP={scenarios:"scenarios",helpers:"helpers",collections:"collections",runs:"history",active:"active",variables:"variables",app:"app under test",snapshots:"snapshots"},fP=m_(function(){const e=y_(),t=e.layout,s=e.activityBar.section,[i,n]=ps.useState(""),[r,o]=ps.useState(!1),a=ps.useRef(null),l=e.session.canSwitchEnvironment,c=e.targets.projectRoot,h=c.split("/").filter(Boolean).pop()??"",u=Sy({value:t.treeWidth,onChange:t.setTreeWidth,axis:"x",dir:1,min:t.treeMin,max:()=>Math.round(.5*window.innerWidth)});return ps.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)},[]),Ss.jsxs("aside",{className:"group/pane relative flex shrink-0",style:{width:t.treeWidth},children:[Ss.jsx(jy,{axis:"x",onPointerDown:u,className:"-right-[6px]"}),Ss.jsxs("div",{className:"uno-island flex min-w-0 flex-1 flex-col",children:[Ss.jsxs("div",{className:"flex h-[33px] items-center gap-2 border-b border-edge-soft px-3",children:[Ss.jsx(cy,{name:"folder",className:"h-3.5 w-3.5 shrink-0 text-fg-4"}),l?Ss.jsx(fE,{}):Ss.jsxs("span",{className:"group relative flex min-w-0 flex-1",children:[Ss.jsx("span",{className:"truncate font-mono text-[11.5px] text-fg-3",children:h||"loading…"}),c&&Ss.jsx(jN,{label:c,placement:"bottom-start"})]}),Ss.jsx("button",{type:"button",disabled:r,className:ay("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",r&&"opacity-100"),title:"Refresh",onClick:()=>{(async()=>{if(!r){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:Ss.jsx(cy,{name:"refresh",className:ay("h-3.5 w-3.5",r&&"animate-spin")})})]}),Ss.jsxs("div",{className:"flex h-7 items-center gap-2 px-3 pt-1",children:[Ss.jsx("span",{className:"font-mono text-[10px] uppercase tracking-wider text-fg-4",children:dP[s]}),"scenarios"===s&&e.session.capabilities.canRun&&Ss.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):"),s=null==t?void 0:t.trim();s&&e.activeRuns.startAuthoring(s).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:[Ss.jsx(cy,{name:"plus",className:"h-3 w-3"})," author"]})]}),Ss.jsx("div",{className:"px-2 pb-2",children:Ss.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:[Ss.jsx(cy,{name:"search",className:"h-3.5 w-3.5 text-fg-4"}),Ss.jsx("input",{ref:a,value:i,onChange:e=>n(e.target.value),placeholder:uP[s],className:"h-full w-full bg-transparent text-[12.5px] text-fg placeholder:text-fg-4 focus:outline-none"}),Ss.jsx(uE,{children:"⌘K"})]})}),Ss.jsxs("div",{className:"flex-1 overflow-y-auto",children:["scenarios"===s&&Ss.jsx(VE,{query:i}),"helpers"===s&&Ss.jsx(jE,{query:i}),"collections"===s&&Ss.jsx(kE,{query:i}),"runs"===s&&Ss.jsx(TE,{query:i}),"active"===s&&Ss.jsx(xE,{query:i}),"variables"===s&&Ss.jsx(rP,{query:i}),"app"===s&&Ss.jsx(wE,{query:i}),"snapshots"===s&&Ss.jsx(tP,{query:i})]}),Ss.jsx(hP,{section:s})]})]})}),pP=m_(function(){const e=y_();return ps.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 s={1:"scenarios",2:"helpers",3:"collections",4:"runs",5:"active",6:"variables",7:"app",8:"snapshots"}[t.key];if(s)return t.preventDefault(),e.activityBar.setSection(s),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]),Ss.jsxs("div",{className:"flex h-full flex-col bg-shell pb-[3px] text-fg",children:[Ss.jsxs("div",{className:"flex min-h-0 flex-1",children:[Ss.jsx(VD,{}),Ss.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5 p-1.5 pb-[3px] pl-0",children:[Ss.jsxs("div",{className:"flex min-h-0 flex-1 gap-1.5",children:[e.layout.treeOpen&&Ss.jsx(fP,{}),Ss.jsxs("main",{className:"uno-island flex min-w-0 flex-1 flex-col",children:[Ss.jsx(aE,{}),Ss.jsx(TD,{}),Ss.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:Ss.jsx(AD,{})})]})]}),Ss.jsx(Zj,{})]})]}),Ss.jsx(QD,{}),Ss.jsx(fy,{})]})});class vP{constructor(e){this.rest=e,this.status={available:!1,state:"stopped",log:[]},this.error=null,this.busy=!1,this.pollTimer=null,Fr(this,{},{autoBind:!0})}async load(){try{const e=await this.rest.appServerStatus();cr(()=>{this.status=e,this.error=null}),this.syncPolling()}catch(e){cr(()=>{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();cr(()=>{this.status=t}),this.syncPolling()}catch(t){cr(()=>{this.error=t instanceof Error?t.message:String(t)})}finally{cr(()=>{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 gP{constructor(e,t={}){this.rest=e,this.byScenario=new Map,this.saveTimer=null,this.saveDebounceMs=t.saveDebounceMs??200,Fr(this,{},{autoBind:!0})}async load(){let e;try{e=await this.rest.getBreakpoints()}catch{e={version:1,scenarios:{}}}cr(()=>{this.byScenario.clear();for(const[t,s]of Object.entries(e.scenarios))this.byScenario.set(t,new Set(s.map(mP)))})}get(e){return this.byScenario.get(e)??new Set}has(e,t,s){var i;return(null==(i=this.byScenario.get(e))?void 0:i.has(`${t}:${s}`))??!1}toggle(e,t,s){const i=`${t}:${s}`;this.byScenario.has(e)||this.byScenario.set(e,new Set);const n=this.byScenario.get(e),r=n.has(i);return r?n.delete(i):n.add(i),0===n.size&&this.byScenario.delete(e),this.scheduleSave(),!r}remove(e,t,s){const i=this.byScenario.get(e);i&&(i.delete(`${t}:${s}`),0===i.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(_P)]))};try{await this.rest.putBreakpoints(e)}catch{console.warn("[breakpoints] save failed")}}}function mP(e){return`${e.line}:${e.col}`}function _P(e){const[t,s]=e.split(":");return{line:Number(t),col:Number(s)}}function xP(e){return`${e.source}\0${e.key}`}class bP{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,Fr(this,{},{autoBind:!0})}async load(){this.loading=!0,this.error=null;try{const e=await this.rest.getVariables();cr(()=>{this.base=e.vars,this.edits.clear(),this.activated.clear(),this.warnings=[]})}catch(e){cr(()=>{this.error=e instanceof Error?e.message:String(e),this.base=[]})}finally{cr(()=>{this.loading=!1})}}get count(){return this.base.length}get rows(){return this.base.map(e=>{const t=xP(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 s=xP(e);return this.edits.has(s)?this.edits.get(s):(null==(t=this.base.find(e=>xP(e)===s))?void 0:t.value)??""}setValue(e,t){var s;const i=xP(e);t===((null==(s=this.base.find(e=>xP(e)===i))?void 0:s.value)??"")?this.edits.delete(i):this.edits.set(i,t)}toggleBool(e){this.setValue(e,"1"===this.effectiveValue(e)?"0":"1")}toggleReveal(e){const t=xP(e);this.revealed.has(t)?this.revealed.delete(t):this.revealed.add(t)}isRevealed(e){return this.revealed.has(xP(e))}isEdited(e){return this.edits.has(xP(e))}activate(e){e.commented&&this.activated.add(xP(e))}isActivated(e){return this.activated.has(xP(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 s=xP(t);(this.edits.has(s)||this.activated.has(s))&&(e[t.source][t.key]=this.effectiveValue(t))}for(const t of["env","secrets"]){const s=e[t];0!==Object.keys(s).length&&await this.rest.putVariables({version:1,source:t,values:s})}await this.load()}catch(e){cr(()=>{this.error=e instanceof Error?e.message:String(e)})}finally{cr(()=>{this.saving=!1})}}}dismissWarnings(){this.warnings=[]}async addVariable(e,t,s){this.saving=!0,this.error=null;try{const i=await this.rest.addVariable({version:1,name:e,value:t,kind:s});return await this.load(),cr(()=>{this.warnings=i.warnings}),!0}catch(i){return cr(()=>{this.error=i instanceof Error?i.message:String(i)}),!1}finally{cr(()=>{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(),cr(()=>{this.warnings=t.warnings})}catch(t){cr(()=>{this.error=t instanceof Error?t.message:String(t)})}finally{cr(()=>{this.saving=!1})}}}class yP{constructor(e,t){this.rest=e,this.active=t,this.items=[],this.loading=!1,this.error=null,Fr(this,{},{autoBind:!0})}pathFor(e){return`${j_}/${this.active.activeTestDir}/${M_}/${e}.yaml`}get count(){return this.items.length}async load(){this.loading=!0,this.error=null;try{const e=await this.rest.collections();cr(()=>{this.items=e,this.loading=!1})}catch(e){cr(()=>{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 s=e.toLowerCase();return this.items.some(e=>e.name.toLowerCase()===s&&e.path!==t)}async create(e,t=null){const s=e.trim();if(!s||this.nameTaken(s))return null;const i=this.items,n={name:s,path:this.pathFor(s),description:t,scenarios:[],workers:null,prepare:null};this.items=[n,...i],this.error=null;try{const e=await this.rest.createCollection({name:s,description:t});return cr(()=>{this.items=this.items.map(t=>t.path===n.path?e:t)}),e}catch(r){return cr(()=>{this.items=i,this.error=wP(r)}),null}}async rename(e,t){const s=t.trim();if(!s)return null;if(this.nameTaken(s,e))return null;const i=this.byPath(e);if(!i)return null;if(i.name===s)return i;const n=this.items,r={...i,name:s,path:this.pathFor(s)};this.items=n.map(t=>t.path===e?r:t),this.error=null;try{const e=await this.rest.renameCollection(i.name,s);return cr(()=>{this.items=this.items.map(t=>t.path===r.path?e:t)}),e}catch(o){return cr(()=>{this.items=n,this.error=wP(o)}),null}}async delete(e){const t=this.byPath(e);if(!t)return!1;const s=this.items;this.items=s.filter(t=>t.path!==e),this.error=null;try{return await this.rest.deleteCollection(t.name),!0}catch(i){return cr(()=>{this.items=s,this.error=wP(i)}),!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 s=this.byPath(e);s&&!s.scenarios.includes(t)&&await this.patch(e,{scenarios:[...s.scenarios,t]})}async removeScenario(e,t){const s=this.byPath(e);s&&await this.patch(e,{scenarios:s.scenarios.filter(e=>e!==t)})}async reorderScenarios(e,t){await this.patch(e,{scenarios:[...t]})}async patch(e,t){const s=this.byPath(e);if(!s)return;const i=this.items,n={...s,description:void 0===t.description?s.description:t.description,scenarios:void 0===t.scenarios?s.scenarios:t.scenarios,workers:void 0===t.workers?s.workers:t.workers};this.items=i.map(t=>t.path===e?n:t),this.error=null;try{const i=await this.rest.patchCollection(s.name,t);cr(()=>{this.items=this.items.map(t=>t.path===e?i:t)})}catch(r){cr(()=>{this.items=i,this.error=wP(r)})}}}function wP(e){return e instanceof Error?e.message:String(e)}class SP{constructor(e){this.rest=e,this.vocab=[],this.helpers=[],this.loaded=!1,Fr(this,{},{autoBind:!0})}async load(){if(!this.loaded){this.loaded=!0;try{const[e,t]=await Promise.all([this.rest.dslVocab(),this.rest.dslHelpers()]);cr(()=>{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();cr(()=>{this.helpers=e})}catch{}}get entries(){return[...this.vocab,...this.helpers]}validate(e,t){return this.rest.validateDsl(e,t)}}class kP{constructor(){this.handles=new Map,this.reveals=rn.map(),this.revealSeq=0}requestReveal(e,t){cr(()=>this.reveals.set(e,{line:t,seq:++this.revealSeq}))}pendingReveal(e){return this.reveals.get(e)}consumeReveal(e,t){cr(()=>{var s;(null==(s=this.reveals.get(e))?void 0:s.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 s=this.handles.get(e);return!!s&&(s.insertAtCursor(t),!0)}}class CP{constructor(e,t){this.rest=e,this.onSwitched=t,this.names=[],this.active=null,this.switching=!1,Fr(this,{},{autoBind:!0})}async load(){try{const e=await this.rest.environments();cr(()=>{this.names=e.names,this.active=e.active})}catch{}}async setActive(e){if(e!==this.active&&!this.switching){cr(()=>{this.switching=!0});try{const t=await this.rest.setActiveEnvironment(e);cr(()=>{this.names=t.names,this.active=t.active}),this.onSwitched()}catch{}finally{cr(()=>{this.switching=!1})}}}get hasAny(){return this.names.length>0}}class jP{constructor(e){this.rest=e,this.items=[],this.loading=!1,this.error=null,Fr(this,{},{autoBind:!0})}get count(){return this.items.length}async load(){this.loading=!0,this.error=null;try{const e=await this.rest.helpers();cr(()=>{this.items=e,this.loading=!1})}catch(e){cr(()=>{this.error=e instanceof Error?e.message:String(e),this.loading=!1})}}}class NP{constructor(e){this.rest=e,this.byRunId=new Map,this.pending=new Set,this.errors=new Map,Fr(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);cr(()=>{this.byRunId.set(e,t),this.pending.delete(e)})}catch(t){cr(()=>{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 MP="layout",BP={treeOpen:!0,treeWidth:280,inspectorOpen:!0,inspectorWidth:380,runViewMode:null},LP=["steps","trace","code"];class DP{constructor(){const e=bM(MP,BP);this.treeOpen=e.treeOpen,this.treeWidth=Math.max(200,e.treeWidth),this.inspectorOpen=e.inspectorOpen,this.inspectorWidth=Math.max(240,e.inspectorWidth),this.runViewMode=LP.includes(e.runViewMode)?e.runViewMode:null,Fr(this,{},{autoBind:!0})}setRunViewMode(e){this.runViewMode=e}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 MP}toPersisted(){return{runViewMode:this.runViewMode,treeOpen:this.treeOpen,treeWidth:this.treeWidth,inspectorOpen:this.inspectorOpen,inspectorWidth:this.inspectorWidth}}}class EP{constructor(e,t,s){this.scenarios=e,this.runs=t,this.active=s,Fr(this,{},{autoBind:!0})}get rows(){const e=this.active.liveRefs;return this.scenarios.items.map(t=>{const s=this.runs.latest[t.name];return s?{ref:t.name,path:t.path,status:oN(s.lastStatus,t.expectFail),live:e.get(t.name)??null,expectFail:t.expectFail,lastRunId:s.lastRunId,lastAt:s.lastAt,durationMs:s.lastDurationMs,failStreak:s.failStreak,recent:s.recent}:{ref:t.name,path:t.path,status:"never",live:e.get(t.name)??null,expectFail:t.expectFail,lastRunId:null,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 PP{constructor(e){this.rest=e,this.waiting=[],this.running=[],this.slots={total:0,used:0},this.enabled=!0,this.loading=!1,Fr(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 cr(()=>{this.loading=!1})}cr(()=>{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 RP=[500,1e3,2e3,5e3,1e4,3e4];class AP{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,Fr(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 s=null;for(const i of this.items)i.kind===e&&i.ref===t&&(!s||i.startedAt>s.startedAt)&&(s=i);return s}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()]);cr(()=>{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){cr(()=>{this.error=e instanceof Error?e.message:String(e),this.loading=!1})}}scheduleIndexRetry(){const e=RP[Math.min(this.indexRetryStep,RP.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}:{}});cr(()=>{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){cr(()=>{this.error=t instanceof Error?t.message:String(t),this.loadingMore=!1})}}}async loadLatest(){try{return await this.rest.runsLatest()}catch{return{}}}}class zP{constructor(e){this.rest=e,this.byRunId=new Map,this.pending=new Set,Fr(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),s="sources"in t?t.sources:null;cr(()=>{this.byRunId.set(e,s),this.pending.delete(e)})}catch{cr(()=>{this.pending.delete(e)})}}}}class TP{constructor(e){this.rest=e,this.byRunId=new Map,this.pending=new Set,Fr(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);cr(()=>{this.byRunId.set(e,t),this.pending.delete(e)})}catch{cr(()=>{this.byRunId.set(e,null),this.pending.delete(e)})}}}invalidate(e){this.byRunId.delete(e)}}const IP="scenarios.expanded";class OP{constructor(e,t,s,i=""){this.rest=e,this.tabs=t,this.active=s,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=i,this.expanded=bM(yM(IP,i),{}),Fr(this,{},{autoBind:!0})}setScope(e){e!==this.scope&&(this.scope=e,this.expanded=bM(this.storageKey,{}))}get storageKey(){return yM(IP,this.scope)}get count(){return this.items.length}async load(){this.loading=!0,this.error=null;try{const e=await this.rest.scenarios();cr(()=>{this.items=e.scenarios,this.folders=e.folders,this.loading=!1})}catch(e){cr(()=>{this.error=e instanceof Error?e.message:String(e),this.loading=!1})}}buildTree(e){var t,s;const i=e.trim().toLowerCase(),n=new Set(this.folders);for(const a of this.items){let e=WE(a.name);for(;e;)n.add(e),e=WE(e)}const r=new Map;for(const a of n)r.set(a,{rel:a,name:FE(a),folders:[],scenarios:[]});const o={folders:[],scenarios:[]};for(const a of[...n].sort()){const e=r.get(a),s=WE(a);""===s?o.folders.push(e):null==(t=r.get(s))||t.folders.push(e)}for(const a of this.items){const e=WE(a.name),t=""===e?o.scenarios:null==(s=r.get(e))?void 0:s.scenarios;null==t||t.push(a)}return function(e,t,s){const i=e=>{const n=e.folders.map(i).filter(e=>null!==e).sort((e,t)=>e.name.localeCompare(t.name)),r=!!t&&e.name.toLowerCase().includes(t),o=(r?e.scenarios:e.scenarios.filter(s)).slice().sort((e,t)=>e.name.localeCompare(t.name));return t&&0===n.length&&0===o.length&&!r?null:{...e,folders:n,scenarios:o}};return{folders:e.folders.map(i).filter(e=>null!==e).sort((e,t)=>e.name.localeCompare(t.name)),scenarios:e.scenarios.filter(s).slice().sort((e,t)=>e.name.localeCompare(t.name))}}(o,i,e=>!i||e.name.toLowerCase().includes(i)||e.path.toLowerCase().includes(i)||e.title.toLowerCase().includes(i))}isExpanded(e){return this.expanded[e]??!0}toggle(e){this.expanded[e]=!this.isExpanded(e)}select(e){this.selected=e}openMenu(e,t,s){this.selected=s,this.menu={x:e,y:t,target:s}}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:KE(FE(e.rel))}:"folder"===e.kind&&(this.clipboard={kind:"folder",rel:e.rel,label:FE(e.rel)}),this.closeMenu()}copyPath(e){var t;if("blank"===e.kind)return;const s=`${j_}/${N_}/${e.rel}`;null==(t=navigator.clipboard)||t.writeText(s),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:s}=await this.rest.createFolder(t.parent,e);cr(()=>{this.expanded[s]=!0}),await this.load()}else{const{scenario:s}=await this.rest.createScenario(t.parent,e);await this.load(),this.tabs.openScenario(this.proj(s)),cr(()=>{this.selected={kind:"scenario",rel:s}})}})}async commitRename(e){const t=this.renaming;this.renaming=null,t&&"blank"!==t.kind&&await this.run(async()=>{const{from:s,to:i}=await this.rest.renameScenarioNode(t.rel,e);"scenario"===t.kind?this.tabs.retargetScenarioPath(this.proj(s),this.proj(i)):(this.tabs.retargetScenarioPrefix(this.proj(s),this.proj(i)),cr(()=>{this.expanded[i]=this.expanded[s]??!0,delete this.expanded[s]})),await this.load()})}async paste(e){const t=this.clipboard;this.closeMenu(),t&&await this.run(async()=>{const{created:s}=await this.rest.copyScenarioNode(t.rel,e);cr(()=>{""!==e&&(this.expanded[e]=!0)}),await this.load(),cr(()=>{this.renaming="folder"===t.kind?{kind:"folder",rel:s}:{kind:"scenario",rel:s},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){cr(()=>{this.actionError=t instanceof Error?t.message:String(t)})}}proj(e){return`${j_}/${this.active.activeTestDir}/${e}`}}const HP={canRun:!0,canEditFiles:!0,canTerminal:!0,canBrowseFs:!0};class FP{constructor(e){this.rest=e,this.capabilities=HP,this.identity=null,this.environments=[],this.loadingEnvironments=!1,Fr(this,{},{autoBind:!0})}async load(){try{const e=await this.rest.session();cr(()=>{this.capabilities=e.capabilities,this.identity=e.identity})}catch{}}get restricted(){const e=this.capabilities;return!(e.canRun&&e.canEditFiles&&e.canTerminal&&e.canBrowseFs)}get canSwitchEnvironment(){var e;return void 0!==(null==(e=this.identity)?void 0:e.environmentsUrl)&&void 0!==this.identity.switchEnvUrl}get currentEnvironment(){var e;const t=null==(e=this.identity)?void 0:e.env;return void 0===t?null:this.environments.find(e=>e.name===t)??null}async loadEnvironments(){var e;const t=null==(e=this.identity)?void 0:e.environmentsUrl;if(void 0!==t){cr(()=>{this.loadingEnvironments=!0});try{const e=await this.rest.hostedEnvironments(t);cr(()=>{this.environments=e})}catch{}finally{cr(()=>{this.loadingEnvironments=!1})}}}switchEnvironment(e){var t;const s=null==(t=this.identity)?void 0:t.switchEnvUrl;void 0!==s&&WP(s,{env:e})}logout(){var e;const t=null==(e=this.identity)?void 0:e.logoutUrl;void 0!==t&&WP(t)}}function WP(e,t={}){const s=document.createElement("form");s.method="post",s.action=e;for(const[i,n]of Object.entries(t)){const e=document.createElement("input");e.type="hidden",e.name=i,e.value=n,s.appendChild(e)}document.body.appendChild(s),s.submit()}class KP{constructor(e){this.rest=e,this.list=[],this.loaded=!1,Fr(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();cr(()=>{this.list=e})}catch{}finally{cr(()=>{this.loaded=!0})}}async importFile(e){const t=await this.rest.importSnapshot(e);return cr(()=>{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),cr(()=>{this.list=this.list.filter(t=>t.snapshotId!==e)})}}class UP{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,Fr(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,s){var i;const n=this.draft(e);if(void 0===n)return;const r=n.split("\n"),o=Math.max(0,Math.min(t,r.length)),a=r[o-1]??r[r.length-1]??"",l=(null==(i=/^[ \t]*/.exec(a))?void 0:i[0])??"";r.splice(o,0,`${l}${s}`),this.setDraft(e,r.join("\n"))}insertBeforeLastLine(e,t){var s;const i=this.draft(e);if(void 0===i)return;const n=i.split("\n");let r=n.length;for(;r>0&&""===n[r-1].trim();)r--;const o=Math.max(0,r-1),a=(null==(s=/^[ \t]*/.exec(n[o]??""))?void 0:s[0])??"";n.splice(o,0,`${a} ${t}`),this.setDraft(e,n.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){cr(()=>{const t=new Set(this.saving);t.add(e),this.saving=t});try{await this.rest.writeSource(e,t),cr(()=>{this.cache.set(e,t),this.drafts.delete(e);const s=new Set(this.conflicts);s.delete(e),this.conflicts=s,this.errors.delete(e)})}catch(s){throw cr(()=>{this.errors.set(e,s instanceof Error?s.message:String(s))}),s}finally{cr(()=>{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 s=this.inflight.get(e);if(s)return s;const i=this.fetch(e);this.inflight.set(e,i),cr(()=>{const t=new Set(this.loading);t.add(e),this.loading=t});try{return await i}finally{this.inflight.delete(e),cr(()=>{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 s of t)this.errors.delete(s),this.refresh(s)}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:s}=await this.rest.source(e);return cr(()=>{this.cache.set(e,s),this.errors.delete(e);const i=this.drafts.get(e);if(void 0!==i&&i!==s&&t!==s){const t=new Set(this.conflicts);t.add(e),this.conflicts=t}}),s}catch(t){const s=t instanceof Error?t.message:String(t);throw cr(()=>{this.errors.set(e,s),this.cache.delete(e)}),t}}}const qP="tabs.openTabs",VP="overview";class $P{constructor(e=""){this.scope=e;const t=bM(yM(qP,e),{tabs:[],activeKey:null});this.hydrate(t),Fr(this,{},{autoBind:!0})}hydrate(e){const t=e.tabs.filter(e=>"overview"!==e.kind);this.tabs=[{kind:"overview"},...t];const s=e.activeKey,i=null!=s&&this.tabs.some(e=>this.keyFor(e)===s);this.activeKey=i?s:t.length?this.keyFor(t[t.length-1]):VP}setScope(e){if(e===this.scope)return;this.scope=e;const t=bM(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===VP)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 s=this.tabs[0];this.tabs=t===s?[s]:[s,t],this.activeKey=e}closeAll(){this.tabs=[this.tabs[0]],this.activeKey=VP}renameCollectionTab(e,t){this.swapPath("collection",e,t)}retargetScenarioPath(e,t){this.swapPath("scenario",e,t)}retargetScenarioPrefix(e,t){const s=YP(e),i=YP(t);let n=null;this.tabs=this.tabs.map(e=>{if("scenario"===e.kind&&e.path.startsWith(s)){const t=i+e.path.slice(s.length);return this.activeKey===`scenario:${e.path}`&&(n=t),{kind:"scenario",path:t}}return e}),n&&(this.activeKey=`scenario:${n}`)}closeScenarioPath(e){this.close(`scenario:${e}`)}closeScenarioPrefix(e){const t=YP(e);for(const s of[...this.tabs])"scenario"===s.kind&&s.path.startsWith(t)&&this.close(`scenario:${s.path}`)}openScenario(e){this.open({kind:"scenario",path:e})}swapPath(e,t,s){if(t===s)return;const i=this.tabs.findIndex(s=>s.kind===e&&s.path===t);if(i<0)return;const n=this.activeKey===`${e}:${t}`;this.tabs.splice(i,1,{kind:e,path:s}),n&&(this.activeKey=`${e}:${s}`)}get activeTab(){return this.tabs.find(e=>this.keyFor(e)===this.activeKey)??this.tabs[0]}keyFor(e){switch(e.kind){case"overview":return VP;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 yM(qP,this.scope)}}function YP(e){return e.endsWith("/")?e:`${e}/`}class GP{constructor(e){this.rest=e,this.checks=null,this.error=null,this.busy=!1,this.checkedTarget=null,Fr(this,{},{autoBind:!0})}async run(e){this.busy=!0,this.error=null;try{const{checks:t}=await this.rest.targetDoctor(e);cr(()=>{this.checks=t,this.checkedTarget=e})}catch(t){cr(()=>{this.error=t instanceof Error?t.message:String(t),this.checks=null,this.checkedTarget=null})}finally{cr(()=>{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 XP="target.active";class ZP{constructor(e,t){this.rest=e,this.onSwitched=t,this.available=[],this.active="",this.projectRoot="",this.switching=!1,Fr(this,{},{autoBind:!0})}async load(){try{const e=await this.rest.targets(),t=bM(XP,null),s=e.targets.find(e=>e.target===t);if(t&&t!==e.active&&s&&(!s.host||s.host.ok)){const e=await this.rest.setActiveTarget(t);return cr(()=>{this.available=e.targets,this.active=e.active,this.projectRoot=e.projectRoot??""}),void this.onSwitched()}cr(()=>{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){cr(()=>{this.switching=!0});try{const t=await this.rest.setActiveTarget(e);cr(()=>{this.available=t.targets,this.active=t.active,this.projectRoot=t.projectRoot??""}),wM(XP,this.active),this.onSwitched()}catch{}finally{cr(()=>{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)??N_}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 JP{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,Fr(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();cr(()=>{this.file=e,null!==this.pendingBundleId&&(null==e?void 0:e.currentBundleId)===this.pendingBundleId&&(this.pendingBundleId=null,this.stopFastPoll(),this.onSwitched())})}catch{cr(()=>{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 s=null==(t=this.file)?void 0:t.switchPath;if(void 0!==s&&!this.switching){cr(()=>{this.posting=!0,this.error=null});try{if("switching"===await this.rest.switchBundle(s,e))return cr(()=>{this.pendingBundleId=e}),void this.startFastPoll();await this.load(),this.onSwitched()}catch(i){cr(()=>{this.error=i instanceof Error?i.message:String(i)})}finally{cr(()=>{this.posting=!1})}}}startFastPoll(){null===this.fastTimer&&(this.fastTimer=setInterval(()=>{this.load()},QP))}stopFastPoll(){null!==this.fastTimer&&clearInterval(this.fastTimer),this.fastTimer=null}}const QP=3e3,eR="terminal",tR={open:!1,height:300},sR=()=>Math.round(.75*("undefined"!=typeof window?window.innerHeight:900));class iR{constructor(){this.tabs=[],this.activeId=null,this.seq=0;const e=bM(eR,tR);this.open=e.open,this.height=Math.max(140,e.height),Fr(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(sR(),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 sR()}get activeKind(){var e;return(null==(e=this.tabs.find(e=>e.id===this.activeId))?void 0:e.kind)??null}get storageKey(){return eR}toPersisted(){return{open:this.open,height:this.height}}}const nR="theme.theme";class rR{constructor(){this.system=this.systemPreference(),this.mode=bM(nR,"system"),Fr(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 nR}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 oR extends Error{constructor(e,t,s){super(e),this.status=t,this.body=s,this.name="RestClientError"}}br({enforceActions:"observed",computedRequiresReaction:!1,reactionRequiresObservable:!0,observableRequiresReaction:!1});const aR=document.getElementById("root");if(!aR)throw new Error("missing #root");const lR=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 s=await this.postJson(e,{bundleId:t});return"switching"===(null==s?void 0:s.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 s=t.toString();return this.getJson("/api/runs"+(s?`?${s}`:""))}runsRunning(){return this.getJson("/api/runs/running")}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 s=new URLSearchParams;e&&s.set("path",e),t&&t.length>0&&s.set("exts",t.join(","));const i=s.toString();return this.getJson("/api/fs/browse"+(i?`?${i}`:""))}session(){return this.getJson("/api/session")}hostedEnvironments(e){return this.getJson(e)}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,s){const i=await fetch(this.base+t,{method:e,headers:void 0===s?void 0:{"content-type":"application/json"},body:void 0===s?void 0:JSON.stringify(s)});return this.parseOrThrow(i)}async parseOrThrow(e){let t=null;const s=await e.text();try{t=s?JSON.parse(s):null}catch{t=s}if(!e.ok)throw new oR(function(e){if(!e||"object"!=typeof e)return null;const t=e.message;if("string"==typeof t&&t.length>0)return t;const s=e.error;if(s&&"object"==typeof s){const e=s.message;if("string"==typeof e&&e.length>0)return e}return null}(t)??`HTTP ${e.status}`,e.status,t);return t}},cR=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 s of this.handlers)s(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)}},hR=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,s,i){this.send({type:"spawn",id:e,kind:t,cols:s,rows:i})}sendData(e,t){this.send({type:"data",id:e,data:t})}resize(e,t,s){this.send({type:"resize",id:e,cols:t,rows:s})}close(e){this.send({type:"close",id:e})}subscribe(e,t){let s=this.subscribers.get(e);return s||(s=new Set,this.subscribers.set(e,s)),s.add(t),()=>{const s=this.subscribers.get(e);s&&(s.delete(t),0===s.size&&this.subscribers.delete(e))}}send(e){const t=JSON.stringify({event:ty,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 s=function(e){if(!e||"object"!=typeof e)return null;const t=e;if(t.event===ty&&t.data&&"object"==typeof t.data)return t.data;if("string"==typeof t.type&&"string"==typeof t.id)return t;return null}(t);if(!s)return;const i=this.subscribers.get(s.id);if(i)for(const n of i)n(s)}notifyAllExited(){for(const[e,t]of this.subscribers)for(const s of t)s({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)}},uR=new class{constructor(e,t,s){this.rest=e,this.ws=t,this.terminalTransport=s,this.wsUnsubscribe=null,this.persistDisposers=[],this.appendCursor=new Map;const i=bM(XP,null)??"";this.tabs=new $P(i),this.targets=new ZP(e,()=>this.refreshAfterTargetSwitch()),this.environments=new CP(e,()=>this.refreshAfterEnvSwitch()),this.workspace=new JP(e,()=>this.refreshAfterBundleSwitch()),this.scenarios=new OP(e,this.tabs,this.targets,i),this.helpers=new jP(e),this.collections=new yP(e,this.targets),this.runs=new AP(e),this.historicRuns=new NP(e),this.runSources=new zP(e),this.runtimeSnapshots=new TP(e),this.activeRuns=new tB(e),this.queue=new PP(e),this.source=new UP(e),this.editorBridge=new kP,this.dsl=new SP(e),this.activityBar=new WD,this.theme=new rR,this.layout=new DP,this.annotations=new kM,this.terminal=new iR,this.breakpoints=new gP(e),this.variables=new bP(e),this.appServer=new vP(e),this.targetDoctor=new GP(e),this.snapshots=new KP(e),this.session=new FP(e),this.schedules=new zN(e),this.overview=new EP(this.scenarios,this.runs,this.activeRuns),Fr(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.activeRuns.hydrateRunning(),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.activeRuns.hydrateRunning(),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.activeRuns.hydrateRunning(),this.breakpoints.load(),this.variables.load(),this.environments.load(),this.snapshots.load(),this.session.load().then(()=>this.session.loadEnvironments()),this.queue.load(),this.schedules.load(),this.workspace.start(),this.persistDisposers.push(ur(()=>{this.activeRuns.reconcileWithRuns(this.runs.items)}),ur(()=>{wM(this.activityBar.storageKey,this.activityBar.section)}),ur(()=>{wM(this.tabs.storageKey,this.tabs.toPersisted())}),ur(()=>{wM(this.scenarios.storageKey,{...this.scenarios.expanded})}),ur(()=>{wM(this.theme.storageKey,this.theme.mode)}),ur(()=>{wM(this.layout.storageKey,this.layout.toPersisted())}),ur(()=>{wM(this.annotations.storageKey,this.annotations.toPersisted())}),ur(()=>{wM(this.terminal.storageKey,this.terminal.toPersisted())}),ur(()=>{"undefined"!=typeof document&&document.documentElement.classList.toggle("dark","dark"===this.theme.theme)}))}insertPickedSnippet(e,t){const s=this.activeRuns.byRunId.get(e),i=null==s?void 0:s.pausedAt;let n,r;if(i&&null!==i.file)n=i.file,r=i.line;else{if("authoring"!==(null==s?void 0:s.mode)||!s.scenario)return;n=`${j_}/${this.targets.activeTestDir}/${s.scenario}.js`,r=null}this.source.getOrLoad(n).then(()=>{if(null===r)return void(this.editorBridge.insertAtCursor(n,t.snippet)||this.source.insertBeforeLastLine(n,t.snippet));if("cursor"===t.placement){if(this.editorBridge.insertAtCursor(n,t.snippet))return;return void this.source.insertAfterLine(n,r,t.snippet)}const e=this.appendCursor.get(n)??r;this.source.insertAfterLine(n,e,t.snippet),this.appendCursor.set(n,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)}}}(lR,cR,hR);uR.init(),Vm(aR).render(Ss.jsx(b_.Provider,{value:uR,children:Ss.jsx(pP,{})}));export{cy as I,mN as R,CN as _,pr as a,Ss as j,m_ as o,ps as r,y_ as u};
|
|
55
|
-
//# sourceMappingURL=index-BVJFZDMP.js.map
|