paneful 0.9.16 → 0.9.18

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.
@@ -0,0 +1,88 @@
1
+ var e,t,i,r,s,n,o,a,l;!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver(e=>{for(const i of e)if("childList"===i.type)for(const e of i.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)}).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();var c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function h(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var u={exports:{}},d={},f={exports:{}},p={},_=Symbol.for("react.element"),g=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),y=Symbol.for("react.provider"),S=Symbol.for("react.context"),w=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),C=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),E=Symbol.iterator;var L={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},R=Object.assign,T={};function M(e,t,i){this.props=e,this.context=t,this.refs=T,this.updater=i||L}function P(){}function A(e,t,i){this.props=e,this.context=t,this.refs=T,this.updater=i||L}M.prototype.isReactComponent={},M.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")},M.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},P.prototype=M.prototype;var D=A.prototype=new P;D.constructor=A,R(D,M.prototype),D.isPureReactComponent=!0;var N=Array.isArray,I=Object.prototype.hasOwnProperty,B={current:null},O={key:!0,ref:!0,__self:!0,__source:!0};function F(e,t,i){var r,s={},n=null,o=null;if(null!=t)for(r in void 0!==t.ref&&(o=t.ref),void 0!==t.key&&(n=""+t.key),t)I.call(t,r)&&!O.hasOwnProperty(r)&&(s[r]=t[r]);var a=arguments.length-2;if(1===a)s.children=i;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];s.children=l}if(e&&e.defaultProps)for(r in a=e.defaultProps)void 0===s[r]&&(s[r]=a[r]);return{$$typeof:_,type:e,key:n,ref:o,props:s,_owner:B.current}}function z(e){return"object"==typeof e&&null!==e&&e.$$typeof===_}var j=/\/+/g;function $(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 W(e,t,i,r,s){var n=typeof e;"undefined"!==n&&"boolean"!==n||(e=null);var o=!1;if(null===e)o=!0;else switch(n){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case _:case g:o=!0}}if(o)return s=s(o=e),e=""===r?"."+$(o,0):r,N(s)?(i="",null!=e&&(i=e.replace(j,"$&/")+"/"),W(s,t,i,"",function(e){return e})):null!=s&&(z(s)&&(s=function(e,t){return{$$typeof:_,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(s,i+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(j,"$&/")+"/")+e)),t.push(s)),1;if(o=0,r=""===r?".":r+":",N(e))for(var a=0;a<e.length;a++){var l=r+$(n=e[a],a);o+=W(n,t,i,l,s)}else if(l=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=E&&e[E]||e["@@iterator"])?e:null}(e),"function"==typeof l)for(e=l.call(e),a=0;!(n=e.next()).done;)o+=W(n=n.value,t,i,l=r+$(n,a++),s);else if("object"===n)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function H(e,t,i){if(null==e)return e;var r=[],s=0;return W(e,r,"","",function(e){return t.call(i,e,s++)}),r}function U(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 q={current:null},K={transition:null},V={ReactCurrentDispatcher:q,ReactCurrentBatchConfig:K,ReactCurrentOwner:B};function G(){throw Error("act(...) is not supported in production builds of React.")}p.Children={map:H,forEach:function(e,t,i){H(e,function(){t.apply(this,arguments)},i)},count:function(e){var t=0;return H(e,function(){t++}),t},toArray:function(e){return H(e,function(e){return e})||[]},only:function(e){if(!z(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},p.Component=M,p.Fragment=m,p.Profiler=b,p.PureComponent=A,p.StrictMode=v,p.Suspense=x,p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=V,p.act=G,p.cloneElement=function(e,t,i){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=R({},e.props),s=e.key,n=e.ref,o=e._owner;if(null!=t){if(void 0!==t.ref&&(n=t.ref,o=B.current),void 0!==t.key&&(s=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)I.call(t,l)&&!O.hasOwnProperty(l)&&(r[l]=void 0===t[l]&&void 0!==a?a[l]:t[l])}var l=arguments.length-2;if(1===l)r.children=i;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];r.children=a}return{$$typeof:_,type:e.type,key:s,ref:n,props:r,_owner:o}},p.createContext=function(e){return(e={$$typeof:S,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:y,_context:e},e.Consumer=e},p.createElement=F,p.createFactory=function(e){var t=F.bind(null,e);return t.type=e,t},p.createRef=function(){return{current:null}},p.forwardRef=function(e){return{$$typeof:w,render:e}},p.isValidElement=z,p.lazy=function(e){return{$$typeof:k,_payload:{_status:-1,_result:e},_init:U}},p.memo=function(e,t){return{$$typeof:C,type:e,compare:void 0===t?null:t}},p.startTransition=function(e){var t=K.transition;K.transition={};try{e()}finally{K.transition=t}},p.unstable_act=G,p.useCallback=function(e,t){return q.current.useCallback(e,t)},p.useContext=function(e){return q.current.useContext(e)},p.useDebugValue=function(){},p.useDeferredValue=function(e){return q.current.useDeferredValue(e)},p.useEffect=function(e,t){return q.current.useEffect(e,t)},p.useId=function(){return q.current.useId()},p.useImperativeHandle=function(e,t,i){return q.current.useImperativeHandle(e,t,i)},p.useInsertionEffect=function(e,t){return q.current.useInsertionEffect(e,t)},p.useLayoutEffect=function(e,t){return q.current.useLayoutEffect(e,t)},p.useMemo=function(e,t){return q.current.useMemo(e,t)},p.useReducer=function(e,t,i){return q.current.useReducer(e,t,i)},p.useRef=function(e){return q.current.useRef(e)},p.useState=function(e){return q.current.useState(e)},p.useSyncExternalStore=function(e,t,i){return q.current.useSyncExternalStore(e,t,i)},p.useTransition=function(){return q.current.useTransition()},p.version="18.3.1",f.exports=p;var Y=f.exports;const X=h(Y);
2
+ /**
3
+ * @license React
4
+ * react-jsx-runtime.production.min.js
5
+ *
6
+ * Copyright (c) Facebook, Inc. and its affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */var Z=Y,Q=Symbol.for("react.element"),J=Symbol.for("react.fragment"),ee=Object.prototype.hasOwnProperty,te=Z.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,ie={key:!0,ref:!0,__self:!0,__source:!0};function re(e,t,i){var r,s={},n=null,o=null;for(r in void 0!==i&&(n=""+i),void 0!==t.key&&(n=""+t.key),void 0!==t.ref&&(o=t.ref),t)ee.call(t,r)&&!ie.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===s[r]&&(s[r]=t[r]);return{$$typeof:Q,type:e,key:n,ref:o,props:s,_owner:te.current}}d.Fragment=J,d.jsx=re,d.jsxs=re,u.exports=d;var se=u.exports,ne={},oe={exports:{}},ae={},le={exports:{}},ce={};
11
+ /**
12
+ * @license React
13
+ * scheduler.production.min.js
14
+ *
15
+ * Copyright (c) Facebook, Inc. and its affiliates.
16
+ *
17
+ * This source code is licensed under the MIT license found in the
18
+ * LICENSE file in the root directory of this source tree.
19
+ */
20
+ !function(e){function t(e,t){var i=e.length;e.push(t);e:for(;0<i;){var r=i-1>>>1,n=e[r];if(!(0<s(n,t)))break e;e[r]=t,e[i]=n,i=r}}function i(e){return 0===e.length?null:e[0]}function r(e){if(0===e.length)return null;var t=e[0],i=e.pop();if(i!==t){e[0]=i;e:for(var r=0,n=e.length,o=n>>>1;r<o;){var a=2*(r+1)-1,l=e[a],c=a+1,h=e[c];if(0>s(l,i))c<n&&0>s(h,l)?(e[r]=h,e[c]=i,r=c):(e[r]=l,e[a]=i,r=a);else{if(!(c<n&&0>s(h,i)))break e;e[r]=h,e[c]=i,r=c}}}return t}function s(e,t){var i=e.sortIndex-t.sortIndex;return 0!==i?i:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var n=performance;e.unstable_now=function(){return n.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],c=[],h=1,u=null,d=3,f=!1,p=!1,_=!1,g="function"==typeof setTimeout?setTimeout:null,m="function"==typeof clearTimeout?clearTimeout:null,v="undefined"!=typeof setImmediate?setImmediate:null;function b(e){for(var s=i(c);null!==s;){if(null===s.callback)r(c);else{if(!(s.startTime<=e))break;r(c),s.sortIndex=s.expirationTime,t(l,s)}s=i(c)}}function y(e){if(_=!1,b(e),!p)if(null!==i(l))p=!0,A(S);else{var t=i(c);null!==t&&D(y,t.startTime-e)}}function S(t,s){p=!1,_&&(_=!1,m(k),k=-1),f=!0;var n=d;try{for(b(s),u=i(l);null!==u&&(!(u.expirationTime>s)||t&&!R());){var o=u.callback;if("function"==typeof o){u.callback=null,d=u.priorityLevel;var a=o(u.expirationTime<=s);s=e.unstable_now(),"function"==typeof a?u.callback=a:u===i(l)&&r(l),b(s)}else r(l);u=i(l)}if(null!==u)var h=!0;else{var g=i(c);null!==g&&D(y,g.startTime-s),h=!1}return h}finally{u=null,d=n,f=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var w,x=!1,C=null,k=-1,E=5,L=-1;function R(){return!(e.unstable_now()-L<E)}function T(){if(null!==C){var t=e.unstable_now();L=t;var i=!0;try{i=C(!0,t)}finally{i?w():(x=!1,C=null)}}else x=!1}if("function"==typeof v)w=function(){v(T)};else if("undefined"!=typeof MessageChannel){var M=new MessageChannel,P=M.port2;M.port1.onmessage=T,w=function(){P.postMessage(null)}}else w=function(){g(T,0)};function A(e){C=e,x||(x=!0,w())}function D(t,i){k=g(function(){t(e.unstable_now())},i)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){p||f||(p=!0,A(S))},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"):E=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return d},e.unstable_getFirstCallbackNode=function(){return i(l)},e.unstable_next=function(e){switch(d){case 1:case 2:case 3:var t=3;break;default:t=d}var i=d;d=t;try{return e()}finally{d=i}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var i=d;d=e;try{return t()}finally{d=i}},e.unstable_scheduleCallback=function(r,s,n){var o=e.unstable_now();switch("object"==typeof n&&null!==n?n="number"==typeof(n=n.delay)&&0<n?o+n:o:n=o,r){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 r={id:h++,callback:s,priorityLevel:r,startTime:n,expirationTime:a=n+a,sortIndex:-1},n>o?(r.sortIndex=n,t(c,r),null===i(l)&&r===i(c)&&(_?(m(k),k=-1):_=!0,D(y,n-o))):(r.sortIndex=a,t(l,r),p||f||(p=!0,A(S))),r},e.unstable_shouldYield=R,e.unstable_wrapCallback=function(e){var t=d;return function(){var i=d;d=t;try{return e.apply(this,arguments)}finally{d=i}}}}(ce),le.exports=ce;var he=le.exports,ue=Y,de=he;
21
+ /**
22
+ * @license React
23
+ * react-dom.production.min.js
24
+ *
25
+ * Copyright (c) Facebook, Inc. and its affiliates.
26
+ *
27
+ * This source code is licensed under the MIT license found in the
28
+ * LICENSE file in the root directory of this source tree.
29
+ */function fe(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,i=1;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var pe=new Set,_e={};function ge(e,t){me(e,t),me(e+"Capture",t)}function me(e,t){for(_e[e]=t,e=0;e<t.length;e++)pe.add(t[e])}var ve=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),be=Object.prototype.hasOwnProperty,ye=/^[: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]*$/,Se={},we={};function xe(e,t,i,r,s,n,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=i,this.propertyName=e,this.type=t,this.sanitizeURL=n,this.removeEmptyString=o}var Ce={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ce[e]=new xe(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ce[t]=new xe(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ce[e]=new xe(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ce[e]=new xe(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){Ce[e]=new xe(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){Ce[e]=new xe(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){Ce[e]=new xe(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){Ce[e]=new xe(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){Ce[e]=new xe(e,5,!1,e.toLowerCase(),null,!1,!1)});var ke=/[\-:]([a-z])/g;function Ee(e){return e[1].toUpperCase()}function Le(e,t,i,r){var s=Ce.hasOwnProperty(t)?Ce[t]:null;(null!==s?0!==s.type:r||!(2<t.length)||"o"!==t[0]&&"O"!==t[0]||"n"!==t[1]&&"N"!==t[1])&&(function(e,t,i,r){if(null==t||function(e,t,i,r){if(null!==i&&0===i.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==i?!i.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,i,r))return!0;if(r)return!1;if(null!==i)switch(i.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,i,s,r)&&(i=null),r||null===s?function(e){return!!be.call(we,e)||!be.call(Se,e)&&(ye.test(e)?we[e]=!0:(Se[e]=!0,!1))}(t)&&(null===i?e.removeAttribute(t):e.setAttribute(t,""+i)):s.mustUseProperty?e[s.propertyName]=null===i?3!==s.type&&"":i:(t=s.attributeName,r=s.attributeNamespace,null===i?e.removeAttribute(t):(i=3===(s=s.type)||4===s&&!0===i?"":""+i,r?e.setAttributeNS(r,t,i):e.setAttribute(t,i))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(ke,Ee);Ce[t]=new xe(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(ke,Ee);Ce[t]=new xe(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(ke,Ee);Ce[t]=new xe(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){Ce[e]=new xe(e,1,!1,e.toLowerCase(),null,!1,!1)}),Ce.xlinkHref=new xe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){Ce[e]=new xe(e,1,!1,e.toLowerCase(),null,!0,!0)});var Re=ue.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Te=Symbol.for("react.element"),Me=Symbol.for("react.portal"),Pe=Symbol.for("react.fragment"),Ae=Symbol.for("react.strict_mode"),De=Symbol.for("react.profiler"),Ne=Symbol.for("react.provider"),Ie=Symbol.for("react.context"),Be=Symbol.for("react.forward_ref"),Oe=Symbol.for("react.suspense"),Fe=Symbol.for("react.suspense_list"),ze=Symbol.for("react.memo"),je=Symbol.for("react.lazy"),$e=Symbol.for("react.offscreen"),We=Symbol.iterator;function He(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=We&&e[We]||e["@@iterator"])?e:null}var Ue,qe=Object.assign;function Ke(e){if(void 0===Ue)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);Ue=t&&t[1]||""}return"\n"+Ue+e}var Ve=!1;function Ge(e,t){if(!e||Ve)return"";Ve=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(bf){var r=bf}Reflect.construct(e,[],t)}else{try{t.call()}catch(bf){r=bf}e.call(t.prototype)}else{try{throw Error()}catch(bf){r=bf}e()}}catch(bf){if(bf&&r&&"string"==typeof bf.stack){for(var s=bf.stack.split("\n"),n=r.stack.split("\n"),o=s.length-1,a=n.length-1;1<=o&&0<=a&&s[o]!==n[a];)a--;for(;1<=o&&0<=a;o--,a--)if(s[o]!==n[a]){if(1!==o||1!==a)do{if(o--,0>--a||s[o]!==n[a]){var l="\n"+s[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{Ve=!1,Error.prepareStackTrace=i}return(e=e?e.displayName||e.name:"")?Ke(e):""}function Ye(e){switch(e.tag){case 5:return Ke(e.type);case 16:return Ke("Lazy");case 13:return Ke("Suspense");case 19:return Ke("SuspenseList");case 0:case 2:case 15:return e=Ge(e.type,!1);case 11:return e=Ge(e.type.render,!1);case 1:return e=Ge(e.type,!0);default:return""}}function Xe(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 Pe:return"Fragment";case Me:return"Portal";case De:return"Profiler";case Ae:return"StrictMode";case Oe:return"Suspense";case Fe:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case Ie:return(e.displayName||"Context")+".Consumer";case Ne:return(e._context.displayName||"Context")+".Provider";case Be:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case ze:return null!==(t=e.displayName||null)?t:Xe(e.type)||"Memo";case je:t=e._payload,e=e._init;try{return Xe(e(t))}catch(i){}}return null}function Ze(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 Xe(t);case 8:return t===Ae?"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 Qe(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function Je(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function et(e){e._valueTracker||(e._valueTracker=function(e){var t=Je(e)?"checked":"value",i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==i&&"function"==typeof i.get&&"function"==typeof i.set){var s=i.get,n=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(e){r=""+e,n.call(this,e)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function tt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),r="";return e&&(r=Je(e)?e.checked?"true":"false":e.value),(e=r)!==i&&(t.setValue(e),!0)}function it(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 rt(e,t){var i=t.checked;return qe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=i?i:e._wrapperState.initialChecked})}function st(e,t){var i=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;i=Qe(null!=t.value?t.value:i),e._wrapperState={initialChecked:r,initialValue:i,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function nt(e,t){null!=(t=t.checked)&&Le(e,"checked",t,!1)}function ot(e,t){nt(e,t);var i=Qe(t.value),r=t.type;if(null!=i)"number"===r?(0===i&&""===e.value||e.value!=i)&&(e.value=""+i):e.value!==""+i&&(e.value=""+i);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?lt(e,t.type,i):t.hasOwnProperty("defaultValue")&&lt(e,t.type,Qe(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function at(e,t,i){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,i||t===e.value||(e.value=t),e.defaultValue=t}""!==(i=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==i&&(e.name=i)}function lt(e,t,i){"number"===t&&it(e.ownerDocument)===e||(null==i?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+i&&(e.defaultValue=""+i))}var ct=Array.isArray;function ht(e,t,i,r){if(e=e.options,t){t={};for(var s=0;s<i.length;s++)t["$"+i[s]]=!0;for(i=0;i<e.length;i++)s=t.hasOwnProperty("$"+e[i].value),e[i].selected!==s&&(e[i].selected=s),s&&r&&(e[i].defaultSelected=!0)}else{for(i=""+Qe(i),t=null,s=0;s<e.length;s++){if(e[s].value===i)return e[s].selected=!0,void(r&&(e[s].defaultSelected=!0));null!==t||e[s].disabled||(t=e[s])}null!==t&&(t.selected=!0)}}function ut(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(fe(91));return qe({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function dt(e,t){var i=t.value;if(null==i){if(i=t.children,t=t.defaultValue,null!=i){if(null!=t)throw Error(fe(92));if(ct(i)){if(1<i.length)throw Error(fe(93));i=i[0]}t=i}null==t&&(t=""),i=t}e._wrapperState={initialValue:Qe(i)}}function ft(e,t){var i=Qe(t.value),r=Qe(t.defaultValue);null!=i&&((i=""+i)!==e.value&&(e.value=i),null==t.defaultValue&&e.defaultValue!==i&&(e.defaultValue=i)),null!=r&&(e.defaultValue=""+r)}function pt(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}function _t(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 gt(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?_t(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var mt,vt,bt=(vt=function(e,t){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=t;else{for((mt=mt||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=mt.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,i,r){MSApp.execUnsafeLocalFunction(function(){return vt(e,t)})}:vt);function yt(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&3===i.nodeType)return void(i.nodeValue=t)}e.textContent=t}var St={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},wt=["Webkit","ms","Moz","O"];function xt(e,t,i){return null==t||"boolean"==typeof t||""===t?"":i||"number"!=typeof t||0===t||St.hasOwnProperty(e)&&St[e]?(""+t).trim():t+"px"}function Ct(e,t){for(var i in e=e.style,t)if(t.hasOwnProperty(i)){var r=0===i.indexOf("--"),s=xt(i,t[i],r);"float"===i&&(i="cssFloat"),r?e.setProperty(i,s):e[i]=s}}Object.keys(St).forEach(function(e){wt.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),St[t]=St[e]})});var kt=qe({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 Et(e,t){if(t){if(kt[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(fe(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(fe(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(fe(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(fe(62))}}function Lt(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 Rt=null;function Tt(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var Mt=null,Pt=null,At=null;function Dt(e){if(e=Ln(e)){if("function"!=typeof Mt)throw Error(fe(280));var t=e.stateNode;t&&(t=Tn(t),Mt(e.stateNode,e.type,t))}}function Nt(e){Pt?At?At.push(e):At=[e]:Pt=e}function It(){if(Pt){var e=Pt,t=At;if(At=Pt=null,Dt(e),t)for(e=0;e<t.length;e++)Dt(t[e])}}function Bt(e,t){return e(t)}function Ot(){}var Ft=!1;function zt(e,t,i){if(Ft)return e(t,i);Ft=!0;try{return Bt(e,t,i)}finally{Ft=!1,(null!==Pt||null!==At)&&(Ot(),It())}}function jt(e,t){var i=e.stateNode;if(null===i)return null;var r=Tn(i);if(null===r)return null;i=r[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":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(i&&"function"!=typeof i)throw Error(fe(231,t,typeof i));return i}var $t=!1;if(ve)try{var Wt={};Object.defineProperty(Wt,"passive",{get:function(){$t=!0}}),window.addEventListener("test",Wt,Wt),window.removeEventListener("test",Wt,Wt)}catch(vt){$t=!1}function Ht(e,t,i,r,s,n,o,a,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(i,c)}catch(h){this.onError(h)}}var Ut=!1,qt=null,Kt=!1,Vt=null,Gt={onError:function(e){Ut=!0,qt=e}};function Yt(e,t,i,r,s,n,o,a,l){Ut=!1,qt=null,Ht.apply(Gt,arguments)}function Xt(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{!!(4098&(t=e).flags)&&(i=t.return),e=t.return}while(e)}return 3===t.tag?i:null}function Zt(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 Qt(e){if(Xt(e)!==e)throw Error(fe(188))}function Jt(e){return null!==(e=function(e){var t=e.alternate;if(!t){if(null===(t=Xt(e)))throw Error(fe(188));return t!==e?null:e}for(var i=e,r=t;;){var s=i.return;if(null===s)break;var n=s.alternate;if(null===n){if(null!==(r=s.return)){i=r;continue}break}if(s.child===n.child){for(n=s.child;n;){if(n===i)return Qt(s),e;if(n===r)return Qt(s),t;n=n.sibling}throw Error(fe(188))}if(i.return!==r.return)i=s,r=n;else{for(var o=!1,a=s.child;a;){if(a===i){o=!0,i=s,r=n;break}if(a===r){o=!0,r=s,i=n;break}a=a.sibling}if(!o){for(a=n.child;a;){if(a===i){o=!0,i=n,r=s;break}if(a===r){o=!0,r=n,i=s;break}a=a.sibling}if(!o)throw Error(fe(189))}}if(i.alternate!==r)throw Error(fe(190))}if(3!==i.tag)throw Error(fe(188));return i.stateNode.current===i?e:t}(e))?ei(e):null}function ei(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=ei(e);if(null!==t)return t;e=e.sibling}return null}var ti=de.unstable_scheduleCallback,ii=de.unstable_cancelCallback,ri=de.unstable_shouldYield,si=de.unstable_requestPaint,ni=de.unstable_now,oi=de.unstable_getCurrentPriorityLevel,ai=de.unstable_ImmediatePriority,li=de.unstable_UserBlockingPriority,ci=de.unstable_NormalPriority,hi=de.unstable_LowPriority,ui=de.unstable_IdlePriority,di=null,fi=null;var pi=Math.clz32?Math.clz32:function(e){return e>>>=0,0===e?32:31-(_i(e)/gi|0)|0},_i=Math.log,gi=Math.LN2;var mi=64,vi=4194304;function bi(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 yi(e,t){var i=e.pendingLanes;if(0===i)return 0;var r=0,s=e.suspendedLanes,n=e.pingedLanes,o=268435455&i;if(0!==o){var a=o&~s;0!==a?r=bi(a):0!==(n&=o)&&(r=bi(n))}else 0!==(o=i&~s)?r=bi(o):0!==n&&(r=bi(n));if(0===r)return 0;if(0!==t&&t!==r&&0===(t&s)&&((s=r&-r)>=(n=t&-t)||16===s&&4194240&n))return t;if(4&r&&(r|=16&i),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0<t;)s=1<<(i=31-pi(t)),r|=e[i],t&=~s;return r}function Si(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 wi(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function xi(){var e=mi;return!(4194240&(mi<<=1))&&(mi=64),e}function Ci(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function ki(e,t,i){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-pi(t)]=i}function Ei(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var r=31-pi(i),s=1<<r;s&t|e[r]&t&&(e[r]|=t),i&=~s}}var Li=0;function Ri(e){return 1<(e&=-e)?4<e?268435455&e?16:536870912:4:1}var Ti,Mi,Pi,Ai,Di,Ni=!1,Ii=[],Bi=null,Oi=null,Fi=null,zi=new Map,ji=new Map,$i=[],Wi="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 Hi(e,t){switch(e){case"focusin":case"focusout":Bi=null;break;case"dragenter":case"dragleave":Oi=null;break;case"mouseover":case"mouseout":Fi=null;break;case"pointerover":case"pointerout":zi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ji.delete(t.pointerId)}}function Ui(e,t,i,r,s,n){return null===e||e.nativeEvent!==n?(e={blockedOn:t,domEventName:i,eventSystemFlags:r,nativeEvent:n,targetContainers:[s]},null!==t&&(null!==(t=Ln(t))&&Mi(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,null!==s&&-1===t.indexOf(s)&&t.push(s),e)}function qi(e){var t=En(e.target);if(null!==t){var i=Xt(t);if(null!==i)if(13===(t=i.tag)){if(null!==(t=Zt(i)))return e.blockedOn=t,void Di(e.priority,function(){Pi(i)})}else if(3===t&&i.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===i.tag?i.stateNode.containerInfo:null)}e.blockedOn=null}function Ki(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var i=rr(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==i)return null!==(t=Ln(i))&&Mi(t),e.blockedOn=i,!1;var r=new(i=e.nativeEvent).constructor(i.type,i);Rt=r,i.target.dispatchEvent(r),Rt=null,t.shift()}return!0}function Vi(e,t,i){Ki(e)&&i.delete(t)}function Gi(){Ni=!1,null!==Bi&&Ki(Bi)&&(Bi=null),null!==Oi&&Ki(Oi)&&(Oi=null),null!==Fi&&Ki(Fi)&&(Fi=null),zi.forEach(Vi),ji.forEach(Vi)}function Yi(e,t){e.blockedOn===t&&(e.blockedOn=null,Ni||(Ni=!0,de.unstable_scheduleCallback(de.unstable_NormalPriority,Gi)))}function Xi(e){function t(t){return Yi(t,e)}if(0<Ii.length){Yi(Ii[0],e);for(var i=1;i<Ii.length;i++){var r=Ii[i];r.blockedOn===e&&(r.blockedOn=null)}}for(null!==Bi&&Yi(Bi,e),null!==Oi&&Yi(Oi,e),null!==Fi&&Yi(Fi,e),zi.forEach(t),ji.forEach(t),i=0;i<$i.length;i++)(r=$i[i]).blockedOn===e&&(r.blockedOn=null);for(;0<$i.length&&null===(i=$i[0]).blockedOn;)qi(i),null===i.blockedOn&&$i.shift()}var Zi=Re.ReactCurrentBatchConfig,Qi=!0;function Ji(e,t,i,r){var s=Li,n=Zi.transition;Zi.transition=null;try{Li=1,tr(e,t,i,r)}finally{Li=s,Zi.transition=n}}function er(e,t,i,r){var s=Li,n=Zi.transition;Zi.transition=null;try{Li=4,tr(e,t,i,r)}finally{Li=s,Zi.transition=n}}function tr(e,t,i,r){if(Qi){var s=rr(e,t,i,r);if(null===s)Zs(e,t,r,ir,i),Hi(e,r);else if(function(e,t,i,r,s){switch(t){case"focusin":return Bi=Ui(Bi,e,t,i,r,s),!0;case"dragenter":return Oi=Ui(Oi,e,t,i,r,s),!0;case"mouseover":return Fi=Ui(Fi,e,t,i,r,s),!0;case"pointerover":var n=s.pointerId;return zi.set(n,Ui(zi.get(n)||null,e,t,i,r,s)),!0;case"gotpointercapture":return n=s.pointerId,ji.set(n,Ui(ji.get(n)||null,e,t,i,r,s)),!0}return!1}(s,e,t,i,r))r.stopPropagation();else if(Hi(e,r),4&t&&-1<Wi.indexOf(e)){for(;null!==s;){var n=Ln(s);if(null!==n&&Ti(n),null===(n=rr(e,t,i,r))&&Zs(e,t,r,ir,i),n===s)break;s=n}null!==s&&r.stopPropagation()}else Zs(e,t,r,null,i)}}var ir=null;function rr(e,t,i,r){if(ir=null,null!==(e=En(e=Tt(r))))if(null===(t=Xt(e)))e=null;else if(13===(i=t.tag)){if(null!==(e=Zt(t)))return e;e=null}else if(3===i){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return ir=e,null}function sr(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(oi()){case ai:return 1;case li:return 4;case ci:case hi:return 16;case ui:return 536870912;default:return 16}default:return 16}}var nr=null,or=null,ar=null;function lr(){if(ar)return ar;var e,t,i=or,r=i.length,s="value"in nr?nr.value:nr.textContent,n=s.length;for(e=0;e<r&&i[e]===s[e];e++);var o=r-e;for(t=1;t<=o&&i[r-t]===s[n-t];t++);return ar=s.slice(e,1<t?1-t:void 0)}function cr(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 hr(){return!0}function ur(){return!1}function dr(e){function t(t,i,r,s,n){for(var o in this._reactName=t,this._targetInst=r,this.type=i,this.nativeEvent=s,this.target=n,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(s):s[o]);return this.isDefaultPrevented=(null!=s.defaultPrevented?s.defaultPrevented:!1===s.returnValue)?hr:ur,this.isPropagationStopped=ur,this}return qe(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=hr)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=hr)},persist:function(){},isPersistent:hr}),t}var fr,pr,_r,gr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},mr=dr(gr),vr=qe({},gr,{view:0,detail:0}),br=dr(vr),yr=qe({},vr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ar,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!==_r&&(_r&&"mousemove"===e.type?(fr=e.screenX-_r.screenX,pr=e.screenY-_r.screenY):pr=fr=0,_r=e),fr)},movementY:function(e){return"movementY"in e?e.movementY:pr}}),Sr=dr(yr),wr=dr(qe({},yr,{dataTransfer:0})),xr=dr(qe({},vr,{relatedTarget:0})),Cr=dr(qe({},gr,{animationName:0,elapsedTime:0,pseudoElement:0})),kr=qe({},gr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Er=dr(kr),Lr=dr(qe({},gr,{data:0})),Rr={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Tr={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"},Mr={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Pr(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=Mr[e])&&!!t[e]}function Ar(){return Pr}var Dr=qe({},vr,{key:function(e){if(e.key){var t=Rr[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=cr(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?Tr[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ar,charCode:function(e){return"keypress"===e.type?cr(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?cr(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),Nr=dr(Dr),Ir=dr(qe({},yr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Br=dr(qe({},vr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ar})),Or=dr(qe({},gr,{propertyName:0,elapsedTime:0,pseudoElement:0})),Fr=qe({},yr,{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}),zr=dr(Fr),jr=[9,13,27,32],$r=ve&&"CompositionEvent"in window,Wr=null;ve&&"documentMode"in document&&(Wr=document.documentMode);var Hr=ve&&"TextEvent"in window&&!Wr,Ur=ve&&(!$r||Wr&&8<Wr&&11>=Wr),qr=String.fromCharCode(32),Kr=!1;function Vr(e,t){switch(e){case"keyup":return-1!==jr.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Gr(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Yr=!1;var Xr={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 Zr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Xr[e.type]:"textarea"===t}function Qr(e,t,i,r){Nt(r),0<(t=Js(t,"onChange")).length&&(i=new mr("onChange","change",null,i,r),e.push({event:i,listeners:t}))}var Jr=null,es=null;function ts(e){qs(e,0)}function is(e){if(tt(Rn(e)))return e}function rs(e,t){if("change"===e)return t}var ss=!1;if(ve){var ns;if(ve){var os="oninput"in document;if(!os){var as=document.createElement("div");as.setAttribute("oninput","return;"),os="function"==typeof as.oninput}ns=os}else ns=!1;ss=ns&&(!document.documentMode||9<document.documentMode)}function ls(){Jr&&(Jr.detachEvent("onpropertychange",cs),es=Jr=null)}function cs(e){if("value"===e.propertyName&&is(es)){var t=[];Qr(t,es,e,Tt(e)),zt(ts,t)}}function hs(e,t,i){"focusin"===e?(ls(),es=i,(Jr=t).attachEvent("onpropertychange",cs)):"focusout"===e&&ls()}function us(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return is(es)}function ds(e,t){if("click"===e)return is(t)}function fs(e,t){if("input"===e||"change"===e)return is(t)}var ps="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function _s(e,t){if(ps(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length)return!1;for(r=0;r<i.length;r++){var s=i[r];if(!be.call(t,s)||!ps(e[s],t[s]))return!1}return!0}function gs(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ms(e,t){var i,r=gs(e);for(e=0;r;){if(3===r.nodeType){if(i=e+r.textContent.length,e<=t&&i>=t)return{node:r,offset:t-e};e=i}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=gs(r)}}function vs(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?vs(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function bs(){for(var e=window,t=it();t instanceof e.HTMLIFrameElement;){try{var i="string"==typeof t.contentWindow.location.href}catch(r){i=!1}if(!i)break;t=it((e=t.contentWindow).document)}return t}function ys(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 Ss(e){var t=bs(),i=e.focusedElem,r=e.selectionRange;if(t!==i&&i&&i.ownerDocument&&vs(i.ownerDocument.documentElement,i)){if(null!==r&&ys(i))if(t=r.start,void 0===(e=r.end)&&(e=t),"selectionStart"in i)i.selectionStart=t,i.selectionEnd=Math.min(e,i.value.length);else if((e=(t=i.ownerDocument||document)&&t.defaultView||window).getSelection){e=e.getSelection();var s=i.textContent.length,n=Math.min(r.start,s);r=void 0===r.end?n:Math.min(r.end,s),!e.extend&&n>r&&(s=r,r=n,n=s),s=ms(i,n);var o=ms(i,r);s&&o&&(1!==e.rangeCount||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&((t=t.createRange()).setStart(s.node,s.offset),e.removeAllRanges(),n>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}for(t=[],e=i;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"==typeof i.focus&&i.focus(),i=0;i<t.length;i++)(e=t[i]).element.scrollLeft=e.left,e.element.scrollTop=e.top}}var ws=ve&&"documentMode"in document&&11>=document.documentMode,xs=null,Cs=null,ks=null,Es=!1;function Ls(e,t,i){var r=i.window===i?i.document:9===i.nodeType?i:i.ownerDocument;Es||null==xs||xs!==it(r)||("selectionStart"in(r=xs)&&ys(r)?r={start:r.selectionStart,end:r.selectionEnd}:r={anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},ks&&_s(ks,r)||(ks=r,0<(r=Js(Cs,"onSelect")).length&&(t=new mr("onSelect","select",null,t,i),e.push({event:t,listeners:r}),t.target=xs)))}function Rs(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var Ts={animationend:Rs("Animation","AnimationEnd"),animationiteration:Rs("Animation","AnimationIteration"),animationstart:Rs("Animation","AnimationStart"),transitionend:Rs("Transition","TransitionEnd")},Ms={},Ps={};function As(e){if(Ms[e])return Ms[e];if(!Ts[e])return e;var t,i=Ts[e];for(t in i)if(i.hasOwnProperty(t)&&t in Ps)return Ms[e]=i[t];return e}ve&&(Ps=document.createElement("div").style,"AnimationEvent"in window||(delete Ts.animationend.animation,delete Ts.animationiteration.animation,delete Ts.animationstart.animation),"TransitionEvent"in window||delete Ts.transitionend.transition);var Ds=As("animationend"),Ns=As("animationiteration"),Is=As("animationstart"),Bs=As("transitionend"),Os=new Map,Fs="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 zs(e,t){Os.set(e,t),ge(t,[e])}for(var js=0;js<Fs.length;js++){var $s=Fs[js];zs($s.toLowerCase(),"on"+($s[0].toUpperCase()+$s.slice(1)))}zs(Ds,"onAnimationEnd"),zs(Ns,"onAnimationIteration"),zs(Is,"onAnimationStart"),zs("dblclick","onDoubleClick"),zs("focusin","onFocus"),zs("focusout","onBlur"),zs(Bs,"onTransitionEnd"),me("onMouseEnter",["mouseout","mouseover"]),me("onMouseLeave",["mouseout","mouseover"]),me("onPointerEnter",["pointerout","pointerover"]),me("onPointerLeave",["pointerout","pointerover"]),ge("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ge("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ge("onBeforeInput",["compositionend","keypress","textInput","paste"]),ge("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ge("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ge("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ws="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(" "),Hs=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ws));function Us(e,t,i){var r=e.type||"unknown-event";e.currentTarget=i,function(e,t,i,r,s,n,o,a,l){if(Yt.apply(this,arguments),Ut){if(!Ut)throw Error(fe(198));var c=qt;Ut=!1,qt=null,Kt||(Kt=!0,Vt=c)}}(r,t,void 0,e),e.currentTarget=null}function qs(e,t){t=!!(4&t);for(var i=0;i<e.length;i++){var r=e[i],s=r.event;r=r.listeners;e:{var n=void 0;if(t)for(var o=r.length-1;0<=o;o--){var a=r[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==n&&s.isPropagationStopped())break e;Us(s,a,c),n=l}else for(o=0;o<r.length;o++){if(l=(a=r[o]).instance,c=a.currentTarget,a=a.listener,l!==n&&s.isPropagationStopped())break e;Us(s,a,c),n=l}}}if(Kt)throw e=Vt,Kt=!1,Vt=null,e}function Ks(e,t){var i=t[xn];void 0===i&&(i=t[xn]=new Set);var r=e+"__bubble";i.has(r)||(Xs(t,e,2,!1),i.add(r))}function Vs(e,t,i){var r=0;t&&(r|=4),Xs(i,e,r,t)}var Gs="_reactListening"+Math.random().toString(36).slice(2);function Ys(e){if(!e[Gs]){e[Gs]=!0,pe.forEach(function(t){"selectionchange"!==t&&(Hs.has(t)||Vs(t,!1,e),Vs(t,!0,e))});var t=9===e.nodeType?e:e.ownerDocument;null===t||t[Gs]||(t[Gs]=!0,Vs("selectionchange",!1,t))}}function Xs(e,t,i,r){switch(sr(t)){case 1:var s=Ji;break;case 4:s=er;break;default:s=tr}i=s.bind(null,t,i,e),s=void 0,!$t||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(s=!0),r?void 0!==s?e.addEventListener(t,i,{capture:!0,passive:s}):e.addEventListener(t,i,!0):void 0!==s?e.addEventListener(t,i,{passive:s}):e.addEventListener(t,i,!1)}function Zs(e,t,i,r,s){var n=r;if(!(1&t||2&t||null===r))e:for(;;){if(null===r)return;var o=r.tag;if(3===o||4===o){var a=r.stateNode.containerInfo;if(a===s||8===a.nodeType&&a.parentNode===s)break;if(4===o)for(o=r.return;null!==o;){var l=o.tag;if((3===l||4===l)&&((l=o.stateNode.containerInfo)===s||8===l.nodeType&&l.parentNode===s))return;o=o.return}for(;null!==a;){if(null===(o=En(a)))return;if(5===(l=o.tag)||6===l){r=n=o;continue e}a=a.parentNode}}r=r.return}zt(function(){var r=n,s=Tt(i),o=[];e:{var a=Os.get(e);if(void 0!==a){var l=mr,c=e;switch(e){case"keypress":if(0===cr(i))break e;case"keydown":case"keyup":l=Nr;break;case"focusin":c="focus",l=xr;break;case"focusout":c="blur",l=xr;break;case"beforeblur":case"afterblur":l=xr;break;case"click":if(2===i.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":l=Sr;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":l=wr;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":l=Br;break;case Ds:case Ns:case Is:l=Cr;break;case Bs:l=Or;break;case"scroll":l=br;break;case"wheel":l=zr;break;case"copy":case"cut":case"paste":l=Er;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":l=Ir}var h=!!(4&t),u=!h&&"scroll"===e,d=h?null!==a?a+"Capture":null:a;h=[];for(var f,p=r;null!==p;){var _=(f=p).stateNode;if(5===f.tag&&null!==_&&(f=_,null!==d&&(null!=(_=jt(p,d))&&h.push(Qs(p,_,f)))),u)break;p=p.return}0<h.length&&(a=new l(a,c,null,i,s),o.push({event:a,listeners:h}))}}if(!(7&t)){if(l="mouseout"===e||"pointerout"===e,(!(a="mouseover"===e||"pointerover"===e)||i===Rt||!(c=i.relatedTarget||i.fromElement)||!En(c)&&!c[wn])&&(l||a)&&(a=s.window===s?s:(a=s.ownerDocument)?a.defaultView||a.parentWindow:window,l?(l=r,null!==(c=(c=i.relatedTarget||i.toElement)?En(c):null)&&(c!==(u=Xt(c))||5!==c.tag&&6!==c.tag)&&(c=null)):(l=null,c=r),l!==c)){if(h=Sr,_="onMouseLeave",d="onMouseEnter",p="mouse","pointerout"!==e&&"pointerover"!==e||(h=Ir,_="onPointerLeave",d="onPointerEnter",p="pointer"),u=null==l?a:Rn(l),f=null==c?a:Rn(c),(a=new h(_,p+"leave",l,i,s)).target=u,a.relatedTarget=f,_=null,En(s)===r&&((h=new h(d,p+"enter",c,i,s)).target=f,h.relatedTarget=u,_=h),u=_,l&&c)e:{for(d=c,p=0,f=h=l;f;f=en(f))p++;for(f=0,_=d;_;_=en(_))f++;for(;0<p-f;)h=en(h),p--;for(;0<f-p;)d=en(d),f--;for(;p--;){if(h===d||null!==d&&h===d.alternate)break e;h=en(h),d=en(d)}h=null}else h=null;null!==l&&tn(o,a,l,h,!1),null!==c&&null!==u&&tn(o,u,c,h,!0)}if("select"===(l=(a=r?Rn(r):window).nodeName&&a.nodeName.toLowerCase())||"input"===l&&"file"===a.type)var g=rs;else if(Zr(a))if(ss)g=fs;else{g=us;var m=hs}else(l=a.nodeName)&&"input"===l.toLowerCase()&&("checkbox"===a.type||"radio"===a.type)&&(g=ds);switch(g&&(g=g(e,r))?Qr(o,g,i,s):(m&&m(e,a,r),"focusout"===e&&(m=a._wrapperState)&&m.controlled&&"number"===a.type&&lt(a,"number",a.value)),m=r?Rn(r):window,e){case"focusin":(Zr(m)||"true"===m.contentEditable)&&(xs=m,Cs=r,ks=null);break;case"focusout":ks=Cs=xs=null;break;case"mousedown":Es=!0;break;case"contextmenu":case"mouseup":case"dragend":Es=!1,Ls(o,i,s);break;case"selectionchange":if(ws)break;case"keydown":case"keyup":Ls(o,i,s)}var v;if($r)e:{switch(e){case"compositionstart":var b="onCompositionStart";break e;case"compositionend":b="onCompositionEnd";break e;case"compositionupdate":b="onCompositionUpdate";break e}b=void 0}else Yr?Vr(e,i)&&(b="onCompositionEnd"):"keydown"===e&&229===i.keyCode&&(b="onCompositionStart");b&&(Ur&&"ko"!==i.locale&&(Yr||"onCompositionStart"!==b?"onCompositionEnd"===b&&Yr&&(v=lr()):(or="value"in(nr=s)?nr.value:nr.textContent,Yr=!0)),0<(m=Js(r,b)).length&&(b=new Lr(b,e,null,i,s),o.push({event:b,listeners:m}),v?b.data=v:null!==(v=Gr(i))&&(b.data=v))),(v=Hr?function(e,t){switch(e){case"compositionend":return Gr(t);case"keypress":return 32!==t.which?null:(Kr=!0,qr);case"textInput":return(e=t.data)===qr&&Kr?null:e;default:return null}}(e,i):function(e,t){if(Yr)return"compositionend"===e||!$r&&Vr(e,t)?(e=lr(),ar=or=nr=null,Yr=!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 Ur&&"ko"!==t.locale?null:t.data}}(e,i))&&(0<(r=Js(r,"onBeforeInput")).length&&(s=new Lr("onBeforeInput","beforeinput",null,i,s),o.push({event:s,listeners:r}),s.data=v))}qs(o,t)})}function Qs(e,t,i){return{instance:e,listener:t,currentTarget:i}}function Js(e,t){for(var i=t+"Capture",r=[];null!==e;){var s=e,n=s.stateNode;5===s.tag&&null!==n&&(s=n,null!=(n=jt(e,i))&&r.unshift(Qs(e,n,s)),null!=(n=jt(e,t))&&r.push(Qs(e,n,s))),e=e.return}return r}function en(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function tn(e,t,i,r,s){for(var n=t._reactName,o=[];null!==i&&i!==r;){var a=i,l=a.alternate,c=a.stateNode;if(null!==l&&l===r)break;5===a.tag&&null!==c&&(a=c,s?null!=(l=jt(i,n))&&o.unshift(Qs(i,l,a)):s||null!=(l=jt(i,n))&&o.push(Qs(i,l,a))),i=i.return}0!==o.length&&e.push({event:t,listeners:o})}var rn=/\r\n?/g,sn=/\u0000|\uFFFD/g;function nn(e){return("string"==typeof e?e:""+e).replace(rn,"\n").replace(sn,"")}function on(e,t,i){if(t=nn(t),nn(e)!==t&&i)throw Error(fe(425))}function an(){}var ln=null,cn=null;function hn(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 un="function"==typeof setTimeout?setTimeout:void 0,dn="function"==typeof clearTimeout?clearTimeout:void 0,fn="function"==typeof Promise?Promise:void 0,pn="function"==typeof queueMicrotask?queueMicrotask:void 0!==fn?function(e){return fn.resolve(null).then(e).catch(_n)}:un;function _n(e){setTimeout(function(){throw e})}function gn(e,t){var i=t,r=0;do{var s=i.nextSibling;if(e.removeChild(i),s&&8===s.nodeType)if("/$"===(i=s.data)){if(0===r)return e.removeChild(s),void Xi(t);r--}else"$"!==i&&"$?"!==i&&"$!"!==i||r++;i=s}while(i);Xi(t)}function mn(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 vn(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var i=e.data;if("$"===i||"$!"===i||"$?"===i){if(0===t)return e;t--}else"/$"===i&&t++}e=e.previousSibling}return null}var bn=Math.random().toString(36).slice(2),yn="__reactFiber$"+bn,Sn="__reactProps$"+bn,wn="__reactContainer$"+bn,xn="__reactEvents$"+bn,Cn="__reactListeners$"+bn,kn="__reactHandles$"+bn;function En(e){var t=e[yn];if(t)return t;for(var i=e.parentNode;i;){if(t=i[wn]||i[yn]){if(i=t.alternate,null!==t.child||null!==i&&null!==i.child)for(e=vn(e);null!==e;){if(i=e[yn])return i;e=vn(e)}return t}i=(e=i).parentNode}return null}function Ln(e){return!(e=e[yn]||e[wn])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function Rn(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(fe(33))}function Tn(e){return e[Sn]||null}var Mn=[],Pn=-1;function An(e){return{current:e}}function Dn(e){0>Pn||(e.current=Mn[Pn],Mn[Pn]=null,Pn--)}function Nn(e,t){Pn++,Mn[Pn]=e.current,e.current=t}var In={},Bn=An(In),On=An(!1),Fn=In;function zn(e,t){var i=e.type.contextTypes;if(!i)return In;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s,n={};for(s in i)n[s]=t[s];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=n),n}function jn(e){return null!=(e=e.childContextTypes)}function $n(){Dn(On),Dn(Bn)}function Wn(e,t,i){if(Bn.current!==In)throw Error(fe(168));Nn(Bn,t),Nn(On,i)}function Hn(e,t,i){var r=e.stateNode;if(t=t.childContextTypes,"function"!=typeof r.getChildContext)return i;for(var s in r=r.getChildContext())if(!(s in t))throw Error(fe(108,Ze(e)||"Unknown",s));return qe({},i,r)}function Un(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||In,Fn=Bn.current,Nn(Bn,e),Nn(On,On.current),!0}function qn(e,t,i){var r=e.stateNode;if(!r)throw Error(fe(169));i?(e=Hn(e,t,Fn),r.__reactInternalMemoizedMergedChildContext=e,Dn(On),Dn(Bn),Nn(Bn,e)):Dn(On),Nn(On,i)}var Kn=null,Vn=!1,Gn=!1;function Yn(e){null===Kn?Kn=[e]:Kn.push(e)}function Xn(){if(!Gn&&null!==Kn){Gn=!0;var e=0,t=Li;try{var i=Kn;for(Li=1;e<i.length;e++){var r=i[e];do{r=r(!0)}while(null!==r)}Kn=null,Vn=!1}catch(Up){throw null!==Kn&&(Kn=Kn.slice(e+1)),ti(ai,Xn),Up}finally{Li=t,Gn=!1}}return null}var Zn=[],Qn=0,Jn=null,eo=0,to=[],io=0,ro=null,so=1,no="";function oo(e,t){Zn[Qn++]=eo,Zn[Qn++]=Jn,Jn=e,eo=t}function ao(e,t,i){to[io++]=so,to[io++]=no,to[io++]=ro,ro=e;var r=so;e=no;var s=32-pi(r)-1;r&=~(1<<s),i+=1;var n=32-pi(t)+s;if(30<n){var o=s-s%5;n=(r&(1<<o)-1).toString(32),r>>=o,s-=o,so=1<<32-pi(t)+s|i<<s|r,no=n+e}else so=1<<n|i<<s|r,no=e}function lo(e){null!==e.return&&(oo(e,1),ao(e,1,0))}function co(e){for(;e===Jn;)Jn=Zn[--Qn],Zn[Qn]=null,eo=Zn[--Qn],Zn[Qn]=null;for(;e===ro;)ro=to[--io],to[io]=null,no=to[--io],to[io]=null,so=to[--io],to[io]=null}var ho=null,uo=null,fo=!1,po=null;function _o(e,t){var i=zh(5,null,null,0);i.elementType="DELETED",i.stateNode=t,i.return=e,null===(t=e.deletions)?(e.deletions=[i],e.flags|=16):t.push(i)}function go(e,t){switch(e.tag){case 5:var i=e.type;return null!==(t=1!==t.nodeType||i.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,ho=e,uo=mn(t.firstChild),!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,ho=e,uo=null,!0);case 13:return null!==(t=8!==t.nodeType?null:t)&&(i=null!==ro?{id:so,overflow:no}:null,e.memoizedState={dehydrated:t,treeContext:i,retryLane:1073741824},(i=zh(18,null,null,0)).stateNode=t,i.return=e,e.child=i,ho=e,uo=null,!0);default:return!1}}function mo(e){return!(!(1&e.mode)||128&e.flags)}function vo(e){if(fo){var t=uo;if(t){var i=t;if(!go(e,t)){if(mo(e))throw Error(fe(418));t=mn(i.nextSibling);var r=ho;t&&go(e,t)?_o(r,i):(e.flags=-4097&e.flags|2,fo=!1,ho=e)}}else{if(mo(e))throw Error(fe(418));e.flags=-4097&e.flags|2,fo=!1,ho=e}}}function bo(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;ho=e}function yo(e){if(e!==ho)return!1;if(!fo)return bo(e),fo=!0,!1;var t;if((t=3!==e.tag)&&!(t=5!==e.tag)&&(t="head"!==(t=e.type)&&"body"!==t&&!hn(e.type,e.memoizedProps)),t&&(t=uo)){if(mo(e))throw So(),Error(fe(418));for(;t;)_o(e,t),t=mn(t.nextSibling)}if(bo(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(fe(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var i=e.data;if("/$"===i){if(0===t){uo=mn(e.nextSibling);break e}t--}else"$"!==i&&"$!"!==i&&"$?"!==i||t++}e=e.nextSibling}uo=null}}else uo=ho?mn(e.stateNode.nextSibling):null;return!0}function So(){for(var e=uo;e;)e=mn(e.nextSibling)}function wo(){uo=ho=null,fo=!1}function xo(e){null===po?po=[e]:po.push(e)}var Co=Re.ReactCurrentBatchConfig;function ko(e,t,i){if(null!==(e=i.ref)&&"function"!=typeof e&&"object"!=typeof e){if(i._owner){if(i=i._owner){if(1!==i.tag)throw Error(fe(309));var r=i.stateNode}if(!r)throw Error(fe(147,e));var s=r,n=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===n?t.ref:((t=function(e){var t=s.refs;null===e?delete t[n]:t[n]=e})._stringRef=n,t)}if("string"!=typeof e)throw Error(fe(284));if(!i._owner)throw Error(fe(290,e))}return e}function Eo(e,t){throw e=Object.prototype.toString.call(t),Error(fe(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Lo(e){return(0,e._init)(e._payload)}function Ro(e){function t(t,i){if(e){var r=t.deletions;null===r?(t.deletions=[i],t.flags|=16):r.push(i)}}function i(i,r){if(!e)return null;for(;null!==r;)t(i,r),r=r.sibling;return null}function r(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 s(e,t){return(e=$h(e,t)).index=0,e.sibling=null,e}function n(t,i,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<i?(t.flags|=2,i):r:(t.flags|=2,i):(t.flags|=1048576,i)}function o(t){return e&&null===t.alternate&&(t.flags|=2),t}function a(e,t,i,r){return null===t||6!==t.tag?((t=qh(i,e.mode,r)).return=e,t):((t=s(t,i)).return=e,t)}function l(e,t,i,r){var n=i.type;return n===Pe?h(e,t,i.props.children,r,i.key):null!==t&&(t.elementType===n||"object"==typeof n&&null!==n&&n.$$typeof===je&&Lo(n)===t.type)?((r=s(t,i.props)).ref=ko(e,t,i),r.return=e,r):((r=Wh(i.type,i.key,i.props,null,e.mode,r)).ref=ko(e,t,i),r.return=e,r)}function c(e,t,i,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==i.containerInfo||t.stateNode.implementation!==i.implementation?((t=Kh(i,e.mode,r)).return=e,t):((t=s(t,i.children||[])).return=e,t)}function h(e,t,i,r,n){return null===t||7!==t.tag?((t=Hh(i,e.mode,r,n)).return=e,t):((t=s(t,i)).return=e,t)}function u(e,t,i){if("string"==typeof t&&""!==t||"number"==typeof t)return(t=qh(""+t,e.mode,i)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case Te:return(i=Wh(t.type,t.key,t.props,null,e.mode,i)).ref=ko(e,null,t),i.return=e,i;case Me:return(t=Kh(t,e.mode,i)).return=e,t;case je:return u(e,(0,t._init)(t._payload),i)}if(ct(t)||He(t))return(t=Hh(t,e.mode,i,null)).return=e,t;Eo(e,t)}return null}function d(e,t,i,r){var s=null!==t?t.key:null;if("string"==typeof i&&""!==i||"number"==typeof i)return null!==s?null:a(e,t,""+i,r);if("object"==typeof i&&null!==i){switch(i.$$typeof){case Te:return i.key===s?l(e,t,i,r):null;case Me:return i.key===s?c(e,t,i,r):null;case je:return d(e,t,(s=i._init)(i._payload),r)}if(ct(i)||He(i))return null!==s?null:h(e,t,i,r,null);Eo(e,i)}return null}function f(e,t,i,r,s){if("string"==typeof r&&""!==r||"number"==typeof r)return a(t,e=e.get(i)||null,""+r,s);if("object"==typeof r&&null!==r){switch(r.$$typeof){case Te:return l(t,e=e.get(null===r.key?i:r.key)||null,r,s);case Me:return c(t,e=e.get(null===r.key?i:r.key)||null,r,s);case je:return f(e,t,i,(0,r._init)(r._payload),s)}if(ct(r)||He(r))return h(t,e=e.get(i)||null,r,s,null);Eo(t,r)}return null}return function a(l,c,h,p){if("object"==typeof h&&null!==h&&h.type===Pe&&null===h.key&&(h=h.props.children),"object"==typeof h&&null!==h){switch(h.$$typeof){case Te:e:{for(var _=h.key,g=c;null!==g;){if(g.key===_){if((_=h.type)===Pe){if(7===g.tag){i(l,g.sibling),(c=s(g,h.props.children)).return=l,l=c;break e}}else if(g.elementType===_||"object"==typeof _&&null!==_&&_.$$typeof===je&&Lo(_)===g.type){i(l,g.sibling),(c=s(g,h.props)).ref=ko(l,g,h),c.return=l,l=c;break e}i(l,g);break}t(l,g),g=g.sibling}h.type===Pe?((c=Hh(h.props.children,l.mode,p,h.key)).return=l,l=c):((p=Wh(h.type,h.key,h.props,null,l.mode,p)).ref=ko(l,c,h),p.return=l,l=p)}return o(l);case Me: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){i(l,c.sibling),(c=s(c,h.children||[])).return=l,l=c;break e}i(l,c);break}t(l,c),c=c.sibling}(c=Kh(h,l.mode,p)).return=l,l=c}return o(l);case je:return a(l,c,(g=h._init)(h._payload),p)}if(ct(h))return function(s,o,a,l){for(var c=null,h=null,p=o,_=o=0,g=null;null!==p&&_<a.length;_++){p.index>_?(g=p,p=null):g=p.sibling;var m=d(s,p,a[_],l);if(null===m){null===p&&(p=g);break}e&&p&&null===m.alternate&&t(s,p),o=n(m,o,_),null===h?c=m:h.sibling=m,h=m,p=g}if(_===a.length)return i(s,p),fo&&oo(s,_),c;if(null===p){for(;_<a.length;_++)null!==(p=u(s,a[_],l))&&(o=n(p,o,_),null===h?c=p:h.sibling=p,h=p);return fo&&oo(s,_),c}for(p=r(s,p);_<a.length;_++)null!==(g=f(p,s,_,a[_],l))&&(e&&null!==g.alternate&&p.delete(null===g.key?_:g.key),o=n(g,o,_),null===h?c=g:h.sibling=g,h=g);return e&&p.forEach(function(e){return t(s,e)}),fo&&oo(s,_),c}(l,c,h,p);if(He(h))return function(s,o,a,l){var c=He(a);if("function"!=typeof c)throw Error(fe(150));if(null==(a=c.call(a)))throw Error(fe(151));for(var h=c=null,p=o,_=o=0,g=null,m=a.next();null!==p&&!m.done;_++,m=a.next()){p.index>_?(g=p,p=null):g=p.sibling;var v=d(s,p,m.value,l);if(null===v){null===p&&(p=g);break}e&&p&&null===v.alternate&&t(s,p),o=n(v,o,_),null===h?c=v:h.sibling=v,h=v,p=g}if(m.done)return i(s,p),fo&&oo(s,_),c;if(null===p){for(;!m.done;_++,m=a.next())null!==(m=u(s,m.value,l))&&(o=n(m,o,_),null===h?c=m:h.sibling=m,h=m);return fo&&oo(s,_),c}for(p=r(s,p);!m.done;_++,m=a.next())null!==(m=f(p,s,_,m.value,l))&&(e&&null!==m.alternate&&p.delete(null===m.key?_:m.key),o=n(m,o,_),null===h?c=m:h.sibling=m,h=m);return e&&p.forEach(function(e){return t(s,e)}),fo&&oo(s,_),c}(l,c,h,p);Eo(l,h)}return"string"==typeof h&&""!==h||"number"==typeof h?(h=""+h,null!==c&&6===c.tag?(i(l,c.sibling),(c=s(c,h)).return=l,l=c):(i(l,c),(c=qh(h,l.mode,p)).return=l,l=c),o(l)):i(l,c)}}var To=Ro(!0),Mo=Ro(!1),Po=An(null),Ao=null,Do=null,No=null;function Io(){No=Do=Ao=null}function Bo(e){var t=Po.current;Dn(Po),e._currentValue=t}function Oo(e,t,i){for(;null!==e;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==r&&(r.childLanes|=t)):null!==r&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===i)break;e=e.return}}function Fo(e,t){Ao=e,No=Do=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!==(e.lanes&t)&&(Ll=!0),e.firstContext=null)}function zo(e){var t=e._currentValue;if(No!==e)if(e={context:e,memoizedValue:t,next:null},null===Do){if(null===Ao)throw Error(fe(308));Do=e,Ao.dependencies={lanes:0,firstContext:e}}else Do=Do.next=e;return t}var jo=null;function $o(e){null===jo?jo=[e]:jo.push(e)}function Wo(e,t,i,r){var s=t.interleaved;return null===s?(i.next=i,$o(t)):(i.next=s.next,s.next=i),t.interleaved=i,Ho(e,r)}function Ho(e,t){e.lanes|=t;var i=e.alternate;for(null!==i&&(i.lanes|=t),i=e,e=e.return;null!==e;)e.childLanes|=t,null!==(i=e.alternate)&&(i.childLanes|=t),i=e,e=e.return;return 3===i.tag?i.stateNode:null}var Uo=!1;function qo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ko(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 Vo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Go(e,t,i){var r=e.updateQueue;if(null===r)return null;if(r=r.shared,2&Bc){var s=r.pending;return null===s?t.next=t:(t.next=s.next,s.next=t),r.pending=t,Ho(e,i)}return null===(s=r.interleaved)?(t.next=t,$o(r)):(t.next=s.next,s.next=t),r.interleaved=t,Ho(e,i)}function Yo(e,t,i){if(null!==(t=t.updateQueue)&&(t=t.shared,4194240&i)){var r=t.lanes;i|=r&=e.pendingLanes,t.lanes=i,Ei(e,i)}}function Xo(e,t){var i=e.updateQueue,r=e.alternate;if(null!==r&&i===(r=r.updateQueue)){var s=null,n=null;if(null!==(i=i.firstBaseUpdate)){do{var o={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};null===n?s=n=o:n=n.next=o,i=i.next}while(null!==i);null===n?s=n=t:n=n.next=t}else s=n=t;return i={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:n,shared:r.shared,effects:r.effects},void(e.updateQueue=i)}null===(e=i.lastBaseUpdate)?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}function Zo(e,t,i,r){var s=e.updateQueue;Uo=!1;var n=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(null!==a){s.shared.pending=null;var l=a,c=l.next;l.next=null,null===o?n=c:o.next=c,o=l;var h=e.alternate;null!==h&&((a=(h=h.updateQueue).lastBaseUpdate)!==o&&(null===a?h.firstBaseUpdate=c:a.next=c,h.lastBaseUpdate=l))}if(null!==n){var u=s.baseState;for(o=0,h=c=l=null,a=n;;){var d=a.lane,f=a.eventTime;if((r&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,_=a;switch(d=t,f=i,_.tag){case 1:if("function"==typeof(p=_.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=_.payload)?p.call(f,u,d):p))break e;u=qe({},u,d);break e;case 2:Uo=!0}}null!==a.callback&&0!==a.lane&&(e.flags|=64,null===(d=s.effects)?s.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=s.shared.pending))break;a=(d=a).next,d.next=null,s.lastBaseUpdate=d,s.shared.pending=null}}if(null===h&&(l=u),s.baseState=l,s.firstBaseUpdate=c,s.lastBaseUpdate=h,null!==(t=s.shared.interleaved)){s=t;do{o|=s.lane,s=s.next}while(s!==t)}else null===n&&(s.shared.lanes=0);Uc|=o,e.lanes=o,e.memoizedState=u}}function Qo(e,t,i){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var r=e[t],s=r.callback;if(null!==s){if(r.callback=null,r=i,"function"!=typeof s)throw Error(fe(191,s));s.call(r)}}}var Jo={},ea=An(Jo),ta=An(Jo),ia=An(Jo);function ra(e){if(e===Jo)throw Error(fe(174));return e}function sa(e,t){switch(Nn(ia,t),Nn(ta,e),Nn(ea,Jo),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:gt(null,"");break;default:t=gt(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}Dn(ea),Nn(ea,t)}function na(){Dn(ea),Dn(ta),Dn(ia)}function oa(e){ra(ia.current);var t=ra(ea.current),i=gt(t,e.type);t!==i&&(Nn(ta,e),Nn(ea,i))}function aa(e){ta.current===e&&(Dn(ea),Dn(ta))}var la=An(0);function ca(e){for(var t=e;null!==t;){if(13===t.tag){var i=t.memoizedState;if(null!==i&&(null===(i=i.dehydrated)||"$?"===i.data||"$!"===i.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(128&t.flags)return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ha=[];function ua(){for(var e=0;e<ha.length;e++)ha[e]._workInProgressVersionPrimary=null;ha.length=0}var da=Re.ReactCurrentDispatcher,fa=Re.ReactCurrentBatchConfig,pa=0,_a=null,ga=null,ma=null,va=!1,ba=!1,ya=0,Sa=0;function wa(){throw Error(fe(321))}function xa(e,t){if(null===t)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!ps(e[i],t[i]))return!1;return!0}function Ca(e,t,i,r,s,n){if(pa=n,_a=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,da.current=null===e||null===e.memoizedState?al:ll,e=i(r,s),ba){n=0;do{if(ba=!1,ya=0,25<=n)throw Error(fe(301));n+=1,ma=ga=null,t.updateQueue=null,da.current=cl,e=i(r,s)}while(ba)}if(da.current=ol,t=null!==ga&&null!==ga.next,pa=0,ma=ga=_a=null,va=!1,t)throw Error(fe(300));return e}function ka(){var e=0!==ya;return ya=0,e}function Ea(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===ma?_a.memoizedState=ma=e:ma=ma.next=e,ma}function La(){if(null===ga){var e=_a.alternate;e=null!==e?e.memoizedState:null}else e=ga.next;var t=null===ma?_a.memoizedState:ma.next;if(null!==t)ma=t,ga=e;else{if(null===e)throw Error(fe(310));e={memoizedState:(ga=e).memoizedState,baseState:ga.baseState,baseQueue:ga.baseQueue,queue:ga.queue,next:null},null===ma?_a.memoizedState=ma=e:ma=ma.next=e}return ma}function Ra(e,t){return"function"==typeof t?t(e):t}function Ta(e){var t=La(),i=t.queue;if(null===i)throw Error(fe(311));i.lastRenderedReducer=e;var r=ga,s=r.baseQueue,n=i.pending;if(null!==n){if(null!==s){var o=s.next;s.next=n.next,n.next=o}r.baseQueue=s=n,i.pending=null}if(null!==s){n=s.next,r=r.baseState;var a=o=null,l=null,c=n;do{var h=c.lane;if((pa&h)===h)null!==l&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var u={lane:h,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};null===l?(a=l=u,o=r):l=l.next=u,_a.lanes|=h,Uc|=h}c=c.next}while(null!==c&&c!==n);null===l?o=r:l.next=a,ps(r,t.memoizedState)||(Ll=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=l,i.lastRenderedState=r}if(null!==(e=i.interleaved)){s=e;do{n=s.lane,_a.lanes|=n,Uc|=n,s=s.next}while(s!==e)}else null===s&&(i.lanes=0);return[t.memoizedState,i.dispatch]}function Ma(e){var t=La(),i=t.queue;if(null===i)throw Error(fe(311));i.lastRenderedReducer=e;var r=i.dispatch,s=i.pending,n=t.memoizedState;if(null!==s){i.pending=null;var o=s=s.next;do{n=e(n,o.action),o=o.next}while(o!==s);ps(n,t.memoizedState)||(Ll=!0),t.memoizedState=n,null===t.baseQueue&&(t.baseState=n),i.lastRenderedState=n}return[n,r]}function Pa(){}function Aa(e,t){var i=_a,r=La(),s=t(),n=!ps(r.memoizedState,s);if(n&&(r.memoizedState=s,Ll=!0),r=r.queue,Ua(Ia.bind(null,i,r,e),[e]),r.getSnapshot!==t||n||null!==ma&&1&ma.memoizedState.tag){if(i.flags|=2048,za(9,Na.bind(null,i,r,s,t),void 0,null),null===Oc)throw Error(fe(349));30&pa||Da(i,t,s)}return s}function Da(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},null===(t=_a.updateQueue)?(t={lastEffect:null,stores:null},_a.updateQueue=t,t.stores=[e]):null===(i=t.stores)?t.stores=[e]:i.push(e)}function Na(e,t,i,r){t.value=i,t.getSnapshot=r,Ba(t)&&Oa(e)}function Ia(e,t,i){return i(function(){Ba(t)&&Oa(e)})}function Ba(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!ps(e,i)}catch(r){return!0}}function Oa(e){var t=Ho(e,1);null!==t&&hh(t,e,1,-1)}function Fa(e){var t=Ea();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ra,lastRenderedState:e},t.queue=e,e=e.dispatch=il.bind(null,_a,e),[t.memoizedState,e]}function za(e,t,i,r){return e={tag:e,create:t,destroy:i,deps:r,next:null},null===(t=_a.updateQueue)?(t={lastEffect:null,stores:null},_a.updateQueue=t,t.lastEffect=e.next=e):null===(i=t.lastEffect)?t.lastEffect=e.next=e:(r=i.next,i.next=e,e.next=r,t.lastEffect=e),e}function ja(){return La().memoizedState}function $a(e,t,i,r){var s=Ea();_a.flags|=e,s.memoizedState=za(1|t,i,void 0,void 0===r?null:r)}function Wa(e,t,i,r){var s=La();r=void 0===r?null:r;var n=void 0;if(null!==ga){var o=ga.memoizedState;if(n=o.destroy,null!==r&&xa(r,o.deps))return void(s.memoizedState=za(t,i,n,r))}_a.flags|=e,s.memoizedState=za(1|t,i,n,r)}function Ha(e,t){return $a(8390656,8,e,t)}function Ua(e,t){return Wa(2048,8,e,t)}function qa(e,t){return Wa(4,2,e,t)}function Ka(e,t){return Wa(4,4,e,t)}function Va(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 Ga(e,t,i){return i=null!=i?i.concat([e]):null,Wa(4,4,Va.bind(null,t,e),i)}function Ya(){}function Xa(e,t){var i=La();t=void 0===t?null:t;var r=i.memoizedState;return null!==r&&null!==t&&xa(t,r[1])?r[0]:(i.memoizedState=[e,t],e)}function Za(e,t){var i=La();t=void 0===t?null:t;var r=i.memoizedState;return null!==r&&null!==t&&xa(t,r[1])?r[0]:(e=e(),i.memoizedState=[e,t],e)}function Qa(e,t,i){return 21&pa?(ps(i,t)||(i=xi(),_a.lanes|=i,Uc|=i,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ll=!0),e.memoizedState=i)}function Ja(e,t){var i=Li;Li=0!==i&&4>i?i:4,e(!0);var r=fa.transition;fa.transition={};try{e(!1),t()}finally{Li=i,fa.transition=r}}function el(){return La().memoizedState}function tl(e,t,i){var r=ch(e);if(i={lane:r,action:i,hasEagerState:!1,eagerState:null,next:null},rl(e))sl(t,i);else if(null!==(i=Wo(e,t,i,r))){hh(i,e,r,lh()),nl(i,t,r)}}function il(e,t,i){var r=ch(e),s={lane:r,action:i,hasEagerState:!1,eagerState:null,next:null};if(rl(e))sl(t,s);else{var n=e.alternate;if(0===e.lanes&&(null===n||0===n.lanes)&&null!==(n=t.lastRenderedReducer))try{var o=t.lastRenderedState,a=n(o,i);if(s.hasEagerState=!0,s.eagerState=a,ps(a,o)){var l=t.interleaved;return null===l?(s.next=s,$o(t)):(s.next=l.next,l.next=s),void(t.interleaved=s)}}catch(bf){}null!==(i=Wo(e,t,s,r))&&(hh(i,e,r,s=lh()),nl(i,t,r))}}function rl(e){var t=e.alternate;return e===_a||null!==t&&t===_a}function sl(e,t){ba=va=!0;var i=e.pending;null===i?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function nl(e,t,i){if(4194240&i){var r=t.lanes;i|=r&=e.pendingLanes,t.lanes=i,Ei(e,i)}}var ol={readContext:zo,useCallback:wa,useContext:wa,useEffect:wa,useImperativeHandle:wa,useInsertionEffect:wa,useLayoutEffect:wa,useMemo:wa,useReducer:wa,useRef:wa,useState:wa,useDebugValue:wa,useDeferredValue:wa,useTransition:wa,useMutableSource:wa,useSyncExternalStore:wa,useId:wa,unstable_isNewReconciler:!1},al={readContext:zo,useCallback:function(e,t){return Ea().memoizedState=[e,void 0===t?null:t],e},useContext:zo,useEffect:Ha,useImperativeHandle:function(e,t,i){return i=null!=i?i.concat([e]):null,$a(4194308,4,Va.bind(null,t,e),i)},useLayoutEffect:function(e,t){return $a(4194308,4,e,t)},useInsertionEffect:function(e,t){return $a(4,2,e,t)},useMemo:function(e,t){var i=Ea();return t=void 0===t?null:t,e=e(),i.memoizedState=[e,t],e},useReducer:function(e,t,i){var r=Ea();return t=void 0!==i?i(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=tl.bind(null,_a,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},Ea().memoizedState=e},useState:Fa,useDebugValue:Ya,useDeferredValue:function(e){return Ea().memoizedState=e},useTransition:function(){var e=Fa(!1),t=e[0];return e=Ja.bind(null,e[1]),Ea().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,i){var r=_a,s=Ea();if(fo){if(void 0===i)throw Error(fe(407));i=i()}else{if(i=t(),null===Oc)throw Error(fe(349));30&pa||Da(r,t,i)}s.memoizedState=i;var n={value:i,getSnapshot:t};return s.queue=n,Ha(Ia.bind(null,r,n,e),[e]),r.flags|=2048,za(9,Na.bind(null,r,n,i,t),void 0,null),i},useId:function(){var e=Ea(),t=Oc.identifierPrefix;if(fo){var i=no;t=":"+t+"R"+(i=(so&~(1<<32-pi(so)-1)).toString(32)+i),0<(i=ya++)&&(t+="H"+i.toString(32)),t+=":"}else t=":"+t+"r"+(i=Sa++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},ll={readContext:zo,useCallback:Xa,useContext:zo,useEffect:Ua,useImperativeHandle:Ga,useInsertionEffect:qa,useLayoutEffect:Ka,useMemo:Za,useReducer:Ta,useRef:ja,useState:function(){return Ta(Ra)},useDebugValue:Ya,useDeferredValue:function(e){return Qa(La(),ga.memoizedState,e)},useTransition:function(){return[Ta(Ra)[0],La().memoizedState]},useMutableSource:Pa,useSyncExternalStore:Aa,useId:el,unstable_isNewReconciler:!1},cl={readContext:zo,useCallback:Xa,useContext:zo,useEffect:Ua,useImperativeHandle:Ga,useInsertionEffect:qa,useLayoutEffect:Ka,useMemo:Za,useReducer:Ma,useRef:ja,useState:function(){return Ma(Ra)},useDebugValue:Ya,useDeferredValue:function(e){var t=La();return null===ga?t.memoizedState=e:Qa(t,ga.memoizedState,e)},useTransition:function(){return[Ma(Ra)[0],La().memoizedState]},useMutableSource:Pa,useSyncExternalStore:Aa,useId:el,unstable_isNewReconciler:!1};function hl(e,t){if(e&&e.defaultProps){for(var i in t=qe({},t),e=e.defaultProps)void 0===t[i]&&(t[i]=e[i]);return t}return t}function ul(e,t,i,r){i=null==(i=i(r,t=e.memoizedState))?t:qe({},t,i),e.memoizedState=i,0===e.lanes&&(e.updateQueue.baseState=i)}var dl={isMounted:function(e){return!!(e=e._reactInternals)&&Xt(e)===e},enqueueSetState:function(e,t,i){e=e._reactInternals;var r=lh(),s=ch(e),n=Vo(r,s);n.payload=t,null!=i&&(n.callback=i),null!==(t=Go(e,n,s))&&(hh(t,e,s,r),Yo(t,e,s))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var r=lh(),s=ch(e),n=Vo(r,s);n.tag=1,n.payload=t,null!=i&&(n.callback=i),null!==(t=Go(e,n,s))&&(hh(t,e,s,r),Yo(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=lh(),r=ch(e),s=Vo(i,r);s.tag=2,null!=t&&(s.callback=t),null!==(t=Go(e,s,r))&&(hh(t,e,r,i),Yo(t,e,r))}};function fl(e,t,i,r,s,n,o){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,n,o):!t.prototype||!t.prototype.isPureReactComponent||(!_s(i,r)||!_s(s,n))}function pl(e,t,i){var r=!1,s=In,n=t.contextType;return"object"==typeof n&&null!==n?n=zo(n):(s=jn(t)?Fn:Bn.current,n=(r=null!=(r=t.contextTypes))?zn(e,s):In),t=new t(i,n),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=dl,e.stateNode=t,t._reactInternals=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=n),t}function _l(e,t,i,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(i,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(i,r),t.state!==e&&dl.enqueueReplaceState(t,t.state,null)}function gl(e,t,i,r){var s=e.stateNode;s.props=i,s.state=e.memoizedState,s.refs={},qo(e);var n=t.contextType;"object"==typeof n&&null!==n?s.context=zo(n):(n=jn(t)?Fn:Bn.current,s.context=zn(e,n)),s.state=e.memoizedState,"function"==typeof(n=t.getDerivedStateFromProps)&&(ul(e,t,n,i),s.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof s.getSnapshotBeforeUpdate||"function"!=typeof s.UNSAFE_componentWillMount&&"function"!=typeof s.componentWillMount||(t=s.state,"function"==typeof s.componentWillMount&&s.componentWillMount(),"function"==typeof s.UNSAFE_componentWillMount&&s.UNSAFE_componentWillMount(),t!==s.state&&dl.enqueueReplaceState(s,s.state,null),Zo(e,i,s,r),s.state=e.memoizedState),"function"==typeof s.componentDidMount&&(e.flags|=4194308)}function ml(e,t){try{var i="",r=t;do{i+=Ye(r),r=r.return}while(r);var s=i}catch(n){s="\nError generating stack: "+n.message+"\n"+n.stack}return{value:e,source:t,stack:s,digest:null}}function vl(e,t,i){return{value:e,source:null,stack:null!=i?i:null,digest:null!=t?t:null}}function bl(e,t){try{console.error(t.value)}catch(i){setTimeout(function(){throw i})}}var yl="function"==typeof WeakMap?WeakMap:Map;function Sl(e,t,i){(i=Vo(-1,i)).tag=3,i.payload={element:null};var r=t.value;return i.callback=function(){Qc||(Qc=!0,Jc=r),bl(0,t)},i}function wl(e,t,i){(i=Vo(-1,i)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var s=t.value;i.payload=function(){return r(s)},i.callback=function(){bl(0,t)}}var n=e.stateNode;return null!==n&&"function"==typeof n.componentDidCatch&&(i.callback=function(){bl(0,t),"function"!=typeof r&&(null===eh?eh=new Set([this]):eh.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),i}function xl(e,t,i){var r=e.pingCache;if(null===r){r=e.pingCache=new yl;var s=new Set;r.set(t,s)}else void 0===(s=r.get(t))&&(s=new Set,r.set(t,s));s.has(i)||(s.add(i),e=Dh.bind(null,e,t,i),t.then(e,e))}function Cl(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 kl(e,t,i,r,s){return 1&e.mode?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,i.flags|=131072,i.flags&=-52805,1===i.tag&&(null===i.alternate?i.tag=17:((t=Vo(-1,1)).tag=2,Go(i,t,1))),i.lanes|=1),e)}var El=Re.ReactCurrentOwner,Ll=!1;function Rl(e,t,i,r){t.child=null===e?Mo(t,null,i,r):To(t,e.child,i,r)}function Tl(e,t,i,r,s){i=i.render;var n=t.ref;return Fo(t,s),r=Ca(e,t,i,r,n,s),i=ka(),null===e||Ll?(fo&&i&&lo(t),t.flags|=1,Rl(e,t,r,s),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Ql(e,t,s))}function Ml(e,t,i,r,s){if(null===e){var n=i.type;return"function"!=typeof n||jh(n)||void 0!==n.defaultProps||null!==i.compare||void 0!==i.defaultProps?((e=Wh(i.type,null,r,t,t.mode,s)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=n,Pl(e,t,n,r,s))}if(n=e.child,0===(e.lanes&s)){var o=n.memoizedProps;if((i=null!==(i=i.compare)?i:_s)(o,r)&&e.ref===t.ref)return Ql(e,t,s)}return t.flags|=1,(e=$h(n,r)).ref=t.ref,e.return=t,t.child=e}function Pl(e,t,i,r,s){if(null!==e){var n=e.memoizedProps;if(_s(n,r)&&e.ref===t.ref){if(Ll=!1,t.pendingProps=r=n,0===(e.lanes&s))return t.lanes=e.lanes,Ql(e,t,s);131072&e.flags&&(Ll=!0)}}return Nl(e,t,i,r,s)}function Al(e,t,i){var r=t.pendingProps,s=r.children,n=null!==e?e.memoizedState:null;if("hidden"===r.mode)if(1&t.mode){if(!(1073741824&i))return e=null!==n?n.baseLanes|i:i,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Nn($c,jc),jc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=null!==n?n.baseLanes:i,Nn($c,jc),jc|=r}else t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Nn($c,jc),jc|=i;else null!==n?(r=n.baseLanes|i,t.memoizedState=null):r=i,Nn($c,jc),jc|=r;return Rl(e,t,s,i),t.child}function Dl(e,t){var i=t.ref;(null===e&&null!==i||null!==e&&e.ref!==i)&&(t.flags|=512,t.flags|=2097152)}function Nl(e,t,i,r,s){var n=jn(i)?Fn:Bn.current;return n=zn(t,n),Fo(t,s),i=Ca(e,t,i,r,n,s),r=ka(),null===e||Ll?(fo&&r&&lo(t),t.flags|=1,Rl(e,t,i,s),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Ql(e,t,s))}function Il(e,t,i,r,s){if(jn(i)){var n=!0;Un(t)}else n=!1;if(Fo(t,s),null===t.stateNode)Zl(e,t),pl(t,i,r),gl(t,i,r,s),r=!0;else if(null===e){var o=t.stateNode,a=t.memoizedProps;o.props=a;var l=o.context,c=i.contextType;"object"==typeof c&&null!==c?c=zo(c):c=zn(t,c=jn(i)?Fn:Bn.current);var h=i.getDerivedStateFromProps,u="function"==typeof h||"function"==typeof o.getSnapshotBeforeUpdate;u||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(a!==r||l!==c)&&_l(t,o,r,c),Uo=!1;var d=t.memoizedState;o.state=d,Zo(t,r,o,s),l=t.memoizedState,a!==r||d!==l||On.current||Uo?("function"==typeof h&&(ul(t,i,h,r),l=t.memoizedState),(a=Uo||fl(t,i,a,r,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=r,t.memoizedState=l),o.props=r,o.state=l,o.context=c,r=a):("function"==typeof o.componentDidMount&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,Ko(e,t),a=t.memoizedProps,c=t.type===t.elementType?a:hl(t.type,a),o.props=c,u=t.pendingProps,d=o.context,"object"==typeof(l=i.contextType)&&null!==l?l=zo(l):l=zn(t,l=jn(i)?Fn:Bn.current);var f=i.getDerivedStateFromProps;(h="function"==typeof f||"function"==typeof o.getSnapshotBeforeUpdate)||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(a!==u||d!==l)&&_l(t,o,r,l),Uo=!1,d=t.memoizedState,o.state=d,Zo(t,r,o,s);var p=t.memoizedState;a!==u||d!==p||On.current||Uo?("function"==typeof f&&(ul(t,i,f,r),p=t.memoizedState),(c=Uo||fl(t,i,c,r,d,p,l)||!1)?(h||"function"!=typeof o.UNSAFE_componentWillUpdate&&"function"!=typeof o.componentWillUpdate||("function"==typeof o.componentWillUpdate&&o.componentWillUpdate(r,p,l),"function"==typeof o.UNSAFE_componentWillUpdate&&o.UNSAFE_componentWillUpdate(r,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=r,t.memoizedState=p),o.props=r,o.state=p,o.context=l,r=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),r=!1)}return Bl(e,t,i,r,n,s)}function Bl(e,t,i,r,s,n){Dl(e,t);var o=!!(128&t.flags);if(!r&&!o)return s&&qn(t,i,!1),Ql(e,t,n);r=t.stateNode,El.current=t;var a=o&&"function"!=typeof i.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&o?(t.child=To(t,e.child,null,n),t.child=To(t,null,a,n)):Rl(e,t,a,n),t.memoizedState=r.state,s&&qn(t,i,!0),t.child}function Ol(e){var t=e.stateNode;t.pendingContext?Wn(0,t.pendingContext,t.pendingContext!==t.context):t.context&&Wn(0,t.context,!1),sa(e,t.containerInfo)}function Fl(e,t,i,r,s){return wo(),xo(s),t.flags|=256,Rl(e,t,i,r),t.child}var zl,jl,$l,Wl,Hl={dehydrated:null,treeContext:null,retryLane:0};function Ul(e){return{baseLanes:e,cachePool:null,transitions:null}}function ql(e,t,i){var r,s=t.pendingProps,n=la.current,o=!1,a=!!(128&t.flags);if((r=a)||(r=(null===e||null!==e.memoizedState)&&!!(2&n)),r?(o=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(n|=1),Nn(la,1&n),null===e)return vo(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=s.children,e=s.fallback,o?(s=t.mode,o=t.child,a={mode:"hidden",children:a},1&s||null===o?o=Uh(a,s,0,null):(o.childLanes=0,o.pendingProps=a),e=Hh(e,s,i,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=Ul(i),t.memoizedState=Hl,e):Kl(t,a));if(null!==(n=e.memoizedState)&&null!==(r=n.dehydrated))return function(e,t,i,r,s,n,o){if(i)return 256&t.flags?(t.flags&=-257,Vl(e,t,o,r=vl(Error(fe(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(n=r.fallback,s=t.mode,r=Uh({mode:"visible",children:r.children},s,0,null),(n=Hh(n,s,o,null)).flags|=2,r.return=t,n.return=t,r.sibling=n,t.child=r,1&t.mode&&To(t,e.child,null,o),t.child.memoizedState=Ul(o),t.memoizedState=Hl,n);if(!(1&t.mode))return Vl(e,t,o,null);if("$!"===s.data){if(r=s.nextSibling&&s.nextSibling.dataset)var a=r.dgst;return r=a,Vl(e,t,o,r=vl(n=Error(fe(419)),r,void 0))}if(a=0!==(o&e.childLanes),Ll||a){if(null!==(r=Oc)){switch(o&-o){case 4:s=2;break;case 16:s=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:s=32;break;case 536870912:s=268435456;break;default:s=0}0!==(s=0!==(s&(r.suspendedLanes|o))?0:s)&&s!==n.retryLane&&(n.retryLane=s,Ho(e,s),hh(r,e,s,-1))}return xh(),Vl(e,t,o,r=vl(Error(fe(421))))}return"$?"===s.data?(t.flags|=128,t.child=e.child,t=Ih.bind(null,e),s._reactRetry=t,null):(e=n.treeContext,uo=mn(s.nextSibling),ho=t,fo=!0,po=null,null!==e&&(to[io++]=so,to[io++]=no,to[io++]=ro,so=e.id,no=e.overflow,ro=t),t=Kl(t,r.children),t.flags|=4096,t)}(e,t,a,s,r,n,i);if(o){o=s.fallback,a=t.mode,r=(n=e.child).sibling;var l={mode:"hidden",children:s.children};return 1&a||t.child===n?(s=$h(n,l)).subtreeFlags=14680064&n.subtreeFlags:((s=t.child).childLanes=0,s.pendingProps=l,t.deletions=null),null!==r?o=$h(r,o):(o=Hh(o,a,i,null)).flags|=2,o.return=t,s.return=t,s.sibling=o,t.child=s,s=o,o=t.child,a=null===(a=e.child.memoizedState)?Ul(i):{baseLanes:a.baseLanes|i,cachePool:null,transitions:a.transitions},o.memoizedState=a,o.childLanes=e.childLanes&~i,t.memoizedState=Hl,s}return e=(o=e.child).sibling,s=$h(o,{mode:"visible",children:s.children}),!(1&t.mode)&&(s.lanes=i),s.return=t,s.sibling=null,null!==e&&(null===(i=t.deletions)?(t.deletions=[e],t.flags|=16):i.push(e)),t.child=s,t.memoizedState=null,s}function Kl(e,t){return(t=Uh({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function Vl(e,t,i,r){return null!==r&&xo(r),To(t,e.child,null,i),(e=Kl(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function Gl(e,t,i){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),Oo(e.return,t,i)}function Yl(e,t,i,r,s){var n=e.memoizedState;null===n?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:i,tailMode:s}:(n.isBackwards=t,n.rendering=null,n.renderingStartTime=0,n.last=r,n.tail=i,n.tailMode=s)}function Xl(e,t,i){var r=t.pendingProps,s=r.revealOrder,n=r.tail;if(Rl(e,t,r.children,i),2&(r=la.current))r=1&r|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&&Gl(e,i,t);else if(19===e.tag)Gl(e,i,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Nn(la,r),1&t.mode)switch(s){case"forwards":for(i=t.child,s=null;null!==i;)null!==(e=i.alternate)&&null===ca(e)&&(s=i),i=i.sibling;null===(i=s)?(s=t.child,t.child=null):(s=i.sibling,i.sibling=null),Yl(t,!1,s,i,n);break;case"backwards":for(i=null,s=t.child,t.child=null;null!==s;){if(null!==(e=s.alternate)&&null===ca(e)){t.child=s;break}e=s.sibling,s.sibling=i,i=s,s=e}Yl(t,!0,i,null,n);break;case"together":Yl(t,!1,null,null,void 0);break;default:t.memoizedState=null}else t.memoizedState=null;return t.child}function Zl(e,t){!(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Ql(e,t,i){if(null!==e&&(t.dependencies=e.dependencies),Uc|=t.lanes,0===(i&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(fe(153));if(null!==t.child){for(i=$h(e=t.child,e.pendingProps),t.child=i,i.return=t;null!==e.sibling;)e=e.sibling,(i=i.sibling=$h(e,e.pendingProps)).return=t;i.sibling=null}return t.child}function Jl(e,t){if(!fo)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;null!==t;)null!==t.alternate&&(i=t),t=t.sibling;null===i?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var r=null;null!==i;)null!==i.alternate&&(r=i),i=i.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function ec(e){var t=null!==e.alternate&&e.alternate.child===e.child,i=0,r=0;if(t)for(var s=e.child;null!==s;)i|=s.lanes|s.childLanes,r|=14680064&s.subtreeFlags,r|=14680064&s.flags,s.return=e,s=s.sibling;else for(s=e.child;null!==s;)i|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=i,t}function tc(e,t,i){var r=t.pendingProps;switch(co(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ec(t),null;case 1:case 17:return jn(t.type)&&$n(),ec(t),null;case 3:return r=t.stateNode,na(),Dn(On),Dn(Bn),ua(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),null!==e&&null!==e.child||(yo(t)?t.flags|=4:null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,null!==po&&(ph(po),po=null))),jl(e,t),ec(t),null;case 5:aa(t);var s=ra(ia.current);if(i=t.type,null!==e&&null!=t.stateNode)$l(e,t,i,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(null===t.stateNode)throw Error(fe(166));return ec(t),null}if(e=ra(ea.current),yo(t)){r=t.stateNode,i=t.type;var n=t.memoizedProps;switch(r[yn]=t,r[Sn]=n,e=!!(1&t.mode),i){case"dialog":Ks("cancel",r),Ks("close",r);break;case"iframe":case"object":case"embed":Ks("load",r);break;case"video":case"audio":for(s=0;s<Ws.length;s++)Ks(Ws[s],r);break;case"source":Ks("error",r);break;case"img":case"image":case"link":Ks("error",r),Ks("load",r);break;case"details":Ks("toggle",r);break;case"input":st(r,n),Ks("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!n.multiple},Ks("invalid",r);break;case"textarea":dt(r,n),Ks("invalid",r)}for(var o in Et(i,n),s=null,n)if(n.hasOwnProperty(o)){var a=n[o];"children"===o?"string"==typeof a?r.textContent!==a&&(!0!==n.suppressHydrationWarning&&on(r.textContent,a,e),s=["children",a]):"number"==typeof a&&r.textContent!==""+a&&(!0!==n.suppressHydrationWarning&&on(r.textContent,a,e),s=["children",""+a]):_e.hasOwnProperty(o)&&null!=a&&"onScroll"===o&&Ks("scroll",r)}switch(i){case"input":et(r),at(r,n,!0);break;case"textarea":et(r),pt(r);break;case"select":case"option":break;default:"function"==typeof n.onClick&&(r.onclick=an)}r=s,t.updateQueue=r,null!==r&&(t.flags|=4)}else{o=9===s.nodeType?s:s.ownerDocument,"http://www.w3.org/1999/xhtml"===e&&(e=_t(i)),"http://www.w3.org/1999/xhtml"===e?"script"===i?((e=o.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"==typeof r.is?e=o.createElement(i,{is:r.is}):(e=o.createElement(i),"select"===i&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,i),e[yn]=t,e[Sn]=r,zl(e,t,!1,!1),t.stateNode=e;e:{switch(o=Lt(i,r),i){case"dialog":Ks("cancel",e),Ks("close",e),s=r;break;case"iframe":case"object":case"embed":Ks("load",e),s=r;break;case"video":case"audio":for(s=0;s<Ws.length;s++)Ks(Ws[s],e);s=r;break;case"source":Ks("error",e),s=r;break;case"img":case"image":case"link":Ks("error",e),Ks("load",e),s=r;break;case"details":Ks("toggle",e),s=r;break;case"input":st(e,r),s=rt(e,r),Ks("invalid",e);break;case"option":default:s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=qe({},r,{value:void 0}),Ks("invalid",e);break;case"textarea":dt(e,r),s=ut(e,r),Ks("invalid",e)}for(n in Et(i,s),a=s)if(a.hasOwnProperty(n)){var l=a[n];"style"===n?Ct(e,l):"dangerouslySetInnerHTML"===n?null!=(l=l?l.__html:void 0)&&bt(e,l):"children"===n?"string"==typeof l?("textarea"!==i||""!==l)&&yt(e,l):"number"==typeof l&&yt(e,""+l):"suppressContentEditableWarning"!==n&&"suppressHydrationWarning"!==n&&"autoFocus"!==n&&(_e.hasOwnProperty(n)?null!=l&&"onScroll"===n&&Ks("scroll",e):null!=l&&Le(e,n,l,o))}switch(i){case"input":et(e),at(e,r,!1);break;case"textarea":et(e),pt(e);break;case"option":null!=r.value&&e.setAttribute("value",""+Qe(r.value));break;case"select":e.multiple=!!r.multiple,null!=(n=r.value)?ht(e,!!r.multiple,n,!1):null!=r.defaultValue&&ht(e,!!r.multiple,r.defaultValue,!0);break;default:"function"==typeof s.onClick&&(e.onclick=an)}switch(i){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return ec(t),null;case 6:if(e&&null!=t.stateNode)Wl(e,t,e.memoizedProps,r);else{if("string"!=typeof r&&null===t.stateNode)throw Error(fe(166));if(i=ra(ia.current),ra(ea.current),yo(t)){if(r=t.stateNode,i=t.memoizedProps,r[yn]=t,(n=r.nodeValue!==i)&&null!==(e=ho))switch(e.tag){case 3:on(r.nodeValue,i,!!(1&e.mode));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&on(r.nodeValue,i,!!(1&e.mode))}n&&(t.flags|=4)}else(r=(9===i.nodeType?i:i.ownerDocument).createTextNode(r))[yn]=t,t.stateNode=r}return ec(t),null;case 13:if(Dn(la),r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(fo&&null!==uo&&1&t.mode&&!(128&t.flags))So(),wo(),t.flags|=98560,n=!1;else if(n=yo(t),null!==r&&null!==r.dehydrated){if(null===e){if(!n)throw Error(fe(318));if(!(n=null!==(n=t.memoizedState)?n.dehydrated:null))throw Error(fe(317));n[yn]=t}else wo(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;ec(t),n=!1}else null!==po&&(ph(po),po=null),n=!0;if(!n)return 65536&t.flags?t:null}return 128&t.flags?(t.lanes=i,t):((r=null!==r)!==(null!==e&&null!==e.memoizedState)&&r&&(t.child.flags|=8192,1&t.mode&&(null===e||1&la.current?0===Wc&&(Wc=3):xh())),null!==t.updateQueue&&(t.flags|=4),ec(t),null);case 4:return na(),jl(e,t),null===e&&Ys(t.stateNode.containerInfo),ec(t),null;case 10:return Bo(t.type._context),ec(t),null;case 19:if(Dn(la),null===(n=t.memoizedState))return ec(t),null;if(r=!!(128&t.flags),null===(o=n.rendering))if(r)Jl(n,!1);else{if(0!==Wc||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(o=ca(e))){for(t.flags|=128,Jl(n,!1),null!==(r=o.updateQueue)&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=i,i=t.child;null!==i;)e=r,(n=i).flags&=14680066,null===(o=n.alternate)?(n.childLanes=0,n.lanes=e,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=o.childLanes,n.lanes=o.lanes,n.child=o.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=o.memoizedProps,n.memoizedState=o.memoizedState,n.updateQueue=o.updateQueue,n.type=o.type,e=o.dependencies,n.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),i=i.sibling;return Nn(la,1&la.current|2),t.child}e=e.sibling}null!==n.tail&&ni()>Xc&&(t.flags|=128,r=!0,Jl(n,!1),t.lanes=4194304)}else{if(!r)if(null!==(e=ca(o))){if(t.flags|=128,r=!0,null!==(i=e.updateQueue)&&(t.updateQueue=i,t.flags|=4),Jl(n,!0),null===n.tail&&"hidden"===n.tailMode&&!o.alternate&&!fo)return ec(t),null}else 2*ni()-n.renderingStartTime>Xc&&1073741824!==i&&(t.flags|=128,r=!0,Jl(n,!1),t.lanes=4194304);n.isBackwards?(o.sibling=t.child,t.child=o):(null!==(i=n.last)?i.sibling=o:t.child=o,n.last=o)}return null!==n.tail?(t=n.tail,n.rendering=t,n.tail=t.sibling,n.renderingStartTime=ni(),t.sibling=null,i=la.current,Nn(la,r?1&i|2:1&i),t):(ec(t),null);case 22:case 23:return bh(),r=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==r&&(t.flags|=8192),r&&1&t.mode?!!(1073741824&jc)&&(ec(t),6&t.subtreeFlags&&(t.flags|=8192)):ec(t),null;case 24:case 25:return null}throw Error(fe(156,t.tag))}function ic(e,t){switch(co(t),t.tag){case 1:return jn(t.type)&&$n(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return na(),Dn(On),Dn(Bn),ua(),65536&(e=t.flags)&&!(128&e)?(t.flags=-65537&e|128,t):null;case 5:return aa(t),null;case 13:if(Dn(la),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(fe(340));wo()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return Dn(la),null;case 4:return na(),null;case 10:return Bo(t.type._context),null;case 22:case 23:return bh(),null;default:return null}}zl=function(e,t){for(var i=t.child;null!==i;){if(5===i.tag||6===i.tag)e.appendChild(i.stateNode);else if(4!==i.tag&&null!==i.child){i.child.return=i,i=i.child;continue}if(i===t)break;for(;null===i.sibling;){if(null===i.return||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}},jl=function(){},$l=function(e,t,i,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,ra(ea.current);var n,o=null;switch(i){case"input":s=rt(e,s),r=rt(e,r),o=[];break;case"select":s=qe({},s,{value:void 0}),r=qe({},r,{value:void 0}),o=[];break;case"textarea":s=ut(e,s),r=ut(e,r),o=[];break;default:"function"!=typeof s.onClick&&"function"==typeof r.onClick&&(e.onclick=an)}for(c in Et(i,r),i=null,s)if(!r.hasOwnProperty(c)&&s.hasOwnProperty(c)&&null!=s[c])if("style"===c){var a=s[c];for(n in a)a.hasOwnProperty(n)&&(i||(i={}),i[n]="")}else"dangerouslySetInnerHTML"!==c&&"children"!==c&&"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&"autoFocus"!==c&&(_e.hasOwnProperty(c)?o||(o=[]):(o=o||[]).push(c,null));for(c in r){var l=r[c];if(a=null!=s?s[c]:void 0,r.hasOwnProperty(c)&&l!==a&&(null!=l||null!=a))if("style"===c)if(a){for(n in a)!a.hasOwnProperty(n)||l&&l.hasOwnProperty(n)||(i||(i={}),i[n]="");for(n in l)l.hasOwnProperty(n)&&a[n]!==l[n]&&(i||(i={}),i[n]=l[n])}else i||(o||(o=[]),o.push(c,i)),i=l;else"dangerouslySetInnerHTML"===c?(l=l?l.__html:void 0,a=a?a.__html:void 0,null!=l&&a!==l&&(o=o||[]).push(c,l)):"children"===c?"string"!=typeof l&&"number"!=typeof l||(o=o||[]).push(c,""+l):"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&(_e.hasOwnProperty(c)?(null!=l&&"onScroll"===c&&Ks("scroll",e),o||a===l||(o=[])):(o=o||[]).push(c,l))}i&&(o=o||[]).push("style",i);var c=o;(t.updateQueue=c)&&(t.flags|=4)}},Wl=function(e,t,i,r){i!==r&&(t.flags|=4)};var rc=!1,sc=!1,nc="function"==typeof WeakSet?WeakSet:Set,oc=null;function ac(e,t){var i=e.ref;if(null!==i)if("function"==typeof i)try{i(null)}catch(r){Ah(e,t,r)}else i.current=null}function lc(e,t,i){try{i()}catch(r){Ah(e,t,r)}}var cc=!1;function hc(e,t,i){var r=t.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var s=r=r.next;do{if((s.tag&e)===e){var n=s.destroy;s.destroy=void 0,void 0!==n&&lc(t,i,n)}s=s.next}while(s!==r)}}function uc(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var i=t=t.next;do{if((i.tag&e)===e){var r=i.create;i.destroy=r()}i=i.next}while(i!==t)}}function dc(e){var t=e.ref;if(null!==t){var i=e.stateNode;e.tag,e=i,"function"==typeof t?t(e):t.current=e}}function fc(e){var t=e.alternate;null!==t&&(e.alternate=null,fc(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&(delete t[yn],delete t[Sn],delete t[xn],delete t[Cn],delete t[kn])),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 pc(e){return 5===e.tag||3===e.tag||4===e.tag}function _c(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||pc(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 gc(e,t,i){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?8===i.nodeType?i.parentNode.insertBefore(e,t):i.insertBefore(e,t):(8===i.nodeType?(t=i.parentNode).insertBefore(e,i):(t=i).appendChild(e),null!=(i=i._reactRootContainer)||null!==t.onclick||(t.onclick=an));else if(4!==r&&null!==(e=e.child))for(gc(e,t,i),e=e.sibling;null!==e;)gc(e,t,i),e=e.sibling}function mc(e,t,i){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(4!==r&&null!==(e=e.child))for(mc(e,t,i),e=e.sibling;null!==e;)mc(e,t,i),e=e.sibling}var vc=null,bc=!1;function yc(e,t,i){for(i=i.child;null!==i;)Sc(e,t,i),i=i.sibling}function Sc(e,t,i){if(fi&&"function"==typeof fi.onCommitFiberUnmount)try{fi.onCommitFiberUnmount(di,i)}catch(tb){}switch(i.tag){case 5:sc||ac(i,t);case 6:var r=vc,s=bc;vc=null,yc(e,t,i),bc=s,null!==(vc=r)&&(bc?(e=vc,i=i.stateNode,8===e.nodeType?e.parentNode.removeChild(i):e.removeChild(i)):vc.removeChild(i.stateNode));break;case 18:null!==vc&&(bc?(e=vc,i=i.stateNode,8===e.nodeType?gn(e.parentNode,i):1===e.nodeType&&gn(e,i),Xi(e)):gn(vc,i.stateNode));break;case 4:r=vc,s=bc,vc=i.stateNode.containerInfo,bc=!0,yc(e,t,i),vc=r,bc=s;break;case 0:case 11:case 14:case 15:if(!sc&&(null!==(r=i.updateQueue)&&null!==(r=r.lastEffect))){s=r=r.next;do{var n=s,o=n.destroy;n=n.tag,void 0!==o&&(2&n||4&n)&&lc(i,t,o),s=s.next}while(s!==r)}yc(e,t,i);break;case 1:if(!sc&&(ac(i,t),"function"==typeof(r=i.stateNode).componentWillUnmount))try{r.props=i.memoizedProps,r.state=i.memoizedState,r.componentWillUnmount()}catch(tb){Ah(i,t,tb)}yc(e,t,i);break;case 21:yc(e,t,i);break;case 22:1&i.mode?(sc=(r=sc)||null!==i.memoizedState,yc(e,t,i),sc=r):yc(e,t,i);break;default:yc(e,t,i)}}function wc(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var i=e.stateNode;null===i&&(i=e.stateNode=new nc),t.forEach(function(t){var r=Bh.bind(null,e,t);i.has(t)||(i.add(t),t.then(r,r))})}}function xc(e,t){var i=t.deletions;if(null!==i)for(var r=0;r<i.length;r++){var s=i[r];try{var n=e,o=t,a=o;e:for(;null!==a;){switch(a.tag){case 5:vc=a.stateNode,bc=!1;break e;case 3:case 4:vc=a.stateNode.containerInfo,bc=!0;break e}a=a.return}if(null===vc)throw Error(fe(160));Sc(n,o,s),vc=null,bc=!1;var l=s.alternate;null!==l&&(l.return=null),s.return=null}catch(bf){Ah(s,t,bf)}}if(12854&t.subtreeFlags)for(t=t.child;null!==t;)Cc(t,e),t=t.sibling}function Cc(e,t){var i=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(xc(t,e),kc(e),4&r){try{hc(3,e,e.return),uc(3,e)}catch($b){Ah(e,e.return,$b)}try{hc(5,e,e.return)}catch($b){Ah(e,e.return,$b)}}break;case 1:xc(t,e),kc(e),512&r&&null!==i&&ac(i,i.return);break;case 5:if(xc(t,e),kc(e),512&r&&null!==i&&ac(i,i.return),32&e.flags){var s=e.stateNode;try{yt(s,"")}catch($b){Ah(e,e.return,$b)}}if(4&r&&null!=(s=e.stateNode)){var n=e.memoizedProps,o=null!==i?i.memoizedProps:n,a=e.type,l=e.updateQueue;if(e.updateQueue=null,null!==l)try{"input"===a&&"radio"===n.type&&null!=n.name&&nt(s,n),Lt(a,o);var c=Lt(a,n);for(o=0;o<l.length;o+=2){var h=l[o],u=l[o+1];"style"===h?Ct(s,u):"dangerouslySetInnerHTML"===h?bt(s,u):"children"===h?yt(s,u):Le(s,h,u,c)}switch(a){case"input":ot(s,n);break;case"textarea":ft(s,n);break;case"select":var d=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!n.multiple;var f=n.value;null!=f?ht(s,!!n.multiple,f,!1):d!==!!n.multiple&&(null!=n.defaultValue?ht(s,!!n.multiple,n.defaultValue,!0):ht(s,!!n.multiple,n.multiple?[]:"",!1))}s[Sn]=n}catch($b){Ah(e,e.return,$b)}}break;case 6:if(xc(t,e),kc(e),4&r){if(null===e.stateNode)throw Error(fe(162));s=e.stateNode,n=e.memoizedProps;try{s.nodeValue=n}catch($b){Ah(e,e.return,$b)}}break;case 3:if(xc(t,e),kc(e),4&r&&null!==i&&i.memoizedState.isDehydrated)try{Xi(t.containerInfo)}catch($b){Ah(e,e.return,$b)}break;case 4:default:xc(t,e),kc(e);break;case 13:xc(t,e),kc(e),8192&(s=e.child).flags&&(n=null!==s.memoizedState,s.stateNode.isHidden=n,!n||null!==s.alternate&&null!==s.alternate.memoizedState||(Yc=ni())),4&r&&wc(e);break;case 22:if(h=null!==i&&null!==i.memoizedState,1&e.mode?(sc=(c=sc)||h,xc(t,e),sc=c):xc(t,e),kc(e),8192&r){if(c=null!==e.memoizedState,(e.stateNode.isHidden=c)&&!h&&1&e.mode)for(oc=e,h=e.child;null!==h;){for(u=oc=h;null!==oc;){switch(f=(d=oc).child,d.tag){case 0:case 11:case 14:case 15:hc(4,d,d.return);break;case 1:ac(d,d.return);var p=d.stateNode;if("function"==typeof p.componentWillUnmount){r=d,i=d.return;try{t=r,p.props=t.memoizedProps,p.state=t.memoizedState,p.componentWillUnmount()}catch($b){Ah(r,i,$b)}}break;case 5:ac(d,d.return);break;case 22:if(null!==d.memoizedState){Tc(u);continue}}null!==f?(f.return=d,oc=f):Tc(u)}h=h.sibling}e:for(h=null,u=e;;){if(5===u.tag){if(null===h){h=u;try{s=u.stateNode,c?"function"==typeof(n=s.style).setProperty?n.setProperty("display","none","important"):n.display="none":(a=u.stateNode,o=null!=(l=u.memoizedProps.style)&&l.hasOwnProperty("display")?l.display:null,a.style.display=xt("display",o))}catch($b){Ah(e,e.return,$b)}}}else if(6===u.tag){if(null===h)try{u.stateNode.nodeValue=c?"":u.memoizedProps}catch($b){Ah(e,e.return,$b)}}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:xc(t,e),kc(e),4&r&&wc(e);case 21:}}function kc(e){var t=e.flags;if(2&t){try{e:{for(var i=e.return;null!==i;){if(pc(i)){var r=i;break e}i=i.return}throw Error(fe(160))}switch(r.tag){case 5:var s=r.stateNode;32&r.flags&&(yt(s,""),r.flags&=-33),mc(e,_c(e),s);break;case 3:case 4:var n=r.stateNode.containerInfo;gc(e,_c(e),n);break;default:throw Error(fe(161))}}catch(o){Ah(e,e.return,o)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function Ec(e,t,i){oc=e,Lc(e)}function Lc(e,t,i){for(var r=!!(1&e.mode);null!==oc;){var s=oc,n=s.child;if(22===s.tag&&r){var o=null!==s.memoizedState||rc;if(!o){var a=s.alternate,l=null!==a&&null!==a.memoizedState||sc;a=rc;var c=sc;if(rc=o,(sc=l)&&!c)for(oc=s;null!==oc;)l=(o=oc).child,22===o.tag&&null!==o.memoizedState?Mc(s):null!==l?(l.return=o,oc=l):Mc(s);for(;null!==n;)oc=n,Lc(n),n=n.sibling;oc=s,rc=a,sc=c}Rc(e)}else 8772&s.subtreeFlags&&null!==n?(n.return=s,oc=n):Rc(e)}}function Rc(e){for(;null!==oc;){var t=oc;if(8772&t.flags){var i=t.alternate;try{if(8772&t.flags)switch(t.tag){case 0:case 11:case 15:sc||uc(5,t);break;case 1:var r=t.stateNode;if(4&t.flags&&!sc)if(null===i)r.componentDidMount();else{var s=t.elementType===t.type?i.memoizedProps:hl(t.type,i.memoizedProps);r.componentDidUpdate(s,i.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var n=t.updateQueue;null!==n&&Qo(t,n,r);break;case 3:var o=t.updateQueue;if(null!==o){if(i=null,null!==t.child)switch(t.child.tag){case 5:case 1:i=t.child.stateNode}Qo(t,o,i)}break;case 5:var a=t.stateNode;if(null===i&&4&t.flags){i=a;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&i.focus();break;case"img":l.src&&(i.src=l.src)}}break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:case 25:break;case 13:if(null===t.memoizedState){var c=t.alternate;if(null!==c){var h=c.memoizedState;if(null!==h){var u=h.dehydrated;null!==u&&Xi(u)}}}break;default:throw Error(fe(163))}sc||512&t.flags&&dc(t)}catch(xw){Ah(t,t.return,xw)}}if(t===e){oc=null;break}if(null!==(i=t.sibling)){i.return=t.return,oc=i;break}oc=t.return}}function Tc(e){for(;null!==oc;){var t=oc;if(t===e){oc=null;break}var i=t.sibling;if(null!==i){i.return=t.return,oc=i;break}oc=t.return}}function Mc(e){for(;null!==oc;){var t=oc;try{switch(t.tag){case 0:case 11:case 15:var i=t.return;try{uc(4,t)}catch(l){Ah(t,i,l)}break;case 1:var r=t.stateNode;if("function"==typeof r.componentDidMount){var s=t.return;try{r.componentDidMount()}catch(l){Ah(t,s,l)}}var n=t.return;try{dc(t)}catch(l){Ah(t,n,l)}break;case 5:var o=t.return;try{dc(t)}catch(l){Ah(t,o,l)}}}catch(l){Ah(t,t.return,l)}if(t===e){oc=null;break}var a=t.sibling;if(null!==a){a.return=t.return,oc=a;break}oc=t.return}}var Pc,Ac=Math.ceil,Dc=Re.ReactCurrentDispatcher,Nc=Re.ReactCurrentOwner,Ic=Re.ReactCurrentBatchConfig,Bc=0,Oc=null,Fc=null,zc=0,jc=0,$c=An(0),Wc=0,Hc=null,Uc=0,qc=0,Kc=0,Vc=null,Gc=null,Yc=0,Xc=1/0,Zc=null,Qc=!1,Jc=null,eh=null,th=!1,ih=null,rh=0,sh=0,nh=null,oh=-1,ah=0;function lh(){return 6&Bc?ni():-1!==oh?oh:oh=ni()}function ch(e){return 1&e.mode?2&Bc&&0!==zc?zc&-zc:null!==Co.transition?(0===ah&&(ah=xi()),ah):0!==(e=Li)?e:e=void 0===(e=window.event)?16:sr(e.type):1}function hh(e,t,i,r){if(50<sh)throw sh=0,nh=null,Error(fe(185));ki(e,i,r),2&Bc&&e===Oc||(e===Oc&&(!(2&Bc)&&(qc|=i),4===Wc&&_h(e,zc)),uh(e,r),1===i&&0===Bc&&!(1&t.mode)&&(Xc=ni()+500,Vn&&Xn()))}function uh(e,t){var i=e.callbackNode;!function(e,t){for(var i=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,n=e.pendingLanes;0<n;){var o=31-pi(n),a=1<<o,l=s[o];-1===l?0!==(a&i)&&0===(a&r)||(s[o]=Si(a,t)):l<=t&&(e.expiredLanes|=a),n&=~a}}(e,t);var r=yi(e,e===Oc?zc:0);if(0===r)null!==i&&ii(i),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(null!=i&&ii(i),1===t)0===e.tag?function(e){Vn=!0,Yn(e)}(gh.bind(null,e)):Yn(gh.bind(null,e)),pn(function(){!(6&Bc)&&Xn()}),i=null;else{switch(Ri(r)){case 1:i=ai;break;case 4:i=li;break;case 16:default:i=ci;break;case 536870912:i=ui}i=Oh(i,dh.bind(null,e))}e.callbackPriority=t,e.callbackNode=i}}function dh(e,t){if(oh=-1,ah=0,6&Bc)throw Error(fe(327));var i=e.callbackNode;if(Mh()&&e.callbackNode!==i)return null;var r=yi(e,e===Oc?zc:0);if(0===r)return null;if(30&r||0!==(r&e.expiredLanes)||t)t=Ch(e,r);else{t=r;var s=Bc;Bc|=2;var n=wh();for(Oc===e&&zc===t||(Zc=null,Xc=ni()+500,yh(e,t));;)try{Eh();break}catch(tb){Sh(e,tb)}Io(),Dc.current=n,Bc=s,null!==Fc?t=0:(Oc=null,zc=0,t=Wc)}if(0!==t){if(2===t&&(0!==(s=wi(e))&&(r=s,t=fh(e,s))),1===t)throw i=Hc,yh(e,0),_h(e,r),uh(e,ni()),i;if(6===t)_h(e,r);else{if(s=e.current.alternate,!(30&r||function(e){for(var t=e;;){if(16384&t.flags){var i=t.updateQueue;if(null!==i&&null!==(i=i.stores))for(var r=0;r<i.length;r++){var s=i[r],n=s.getSnapshot;s=s.value;try{if(!ps(n(),s))return!1}catch(o){return!1}}}if(i=t.child,16384&t.subtreeFlags&&null!==i)i.return=t,t=i;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}(s)||(t=Ch(e,r),2===t&&(n=wi(e),0!==n&&(r=n,t=fh(e,n))),1!==t)))throw i=Hc,yh(e,0),_h(e,r),uh(e,ni()),i;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(fe(345));case 2:case 5:Th(e,Gc,Zc);break;case 3:if(_h(e,r),(130023424&r)===r&&10<(t=Yc+500-ni())){if(0!==yi(e,0))break;if(((s=e.suspendedLanes)&r)!==r){lh(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=un(Th.bind(null,e,Gc,Zc),t);break}Th(e,Gc,Zc);break;case 4:if(_h(e,r),(4194240&r)===r)break;for(t=e.eventTimes,s=-1;0<r;){var o=31-pi(r);n=1<<o,(o=t[o])>s&&(s=o),r&=~n}if(r=s,10<(r=(120>(r=ni()-r)?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Ac(r/1960))-r)){e.timeoutHandle=un(Th.bind(null,e,Gc,Zc),r);break}Th(e,Gc,Zc);break;default:throw Error(fe(329))}}}return uh(e,ni()),e.callbackNode===i?dh.bind(null,e):null}function fh(e,t){var i=Vc;return e.current.memoizedState.isDehydrated&&(yh(e,t).flags|=256),2!==(e=Ch(e,t))&&(t=Gc,Gc=i,null!==t&&ph(t)),e}function ph(e){null===Gc?Gc=e:Gc.push.apply(Gc,e)}function _h(e,t){for(t&=~Kc,t&=~qc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var i=31-pi(t),r=1<<i;e[i]=-1,t&=~r}}function gh(e){if(6&Bc)throw Error(fe(327));Mh();var t=yi(e,0);if(!(1&t))return uh(e,ni()),null;var i=Ch(e,t);if(0!==e.tag&&2===i){var r=wi(e);0!==r&&(t=r,i=fh(e,r))}if(1===i)throw i=Hc,yh(e,0),_h(e,t),uh(e,ni()),i;if(6===i)throw Error(fe(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Th(e,Gc,Zc),uh(e,ni()),null}function mh(e,t){var i=Bc;Bc|=1;try{return e(t)}finally{0===(Bc=i)&&(Xc=ni()+500,Vn&&Xn())}}function vh(e){null!==ih&&0===ih.tag&&!(6&Bc)&&Mh();var t=Bc;Bc|=1;var i=Ic.transition,r=Li;try{if(Ic.transition=null,Li=1,e)return e()}finally{Li=r,Ic.transition=i,!(6&(Bc=t))&&Xn()}}function bh(){jc=$c.current,Dn($c)}function yh(e,t){e.finishedWork=null,e.finishedLanes=0;var i=e.timeoutHandle;if(-1!==i&&(e.timeoutHandle=-1,dn(i)),null!==Fc)for(i=Fc.return;null!==i;){var r=i;switch(co(r),r.tag){case 1:null!=(r=r.type.childContextTypes)&&$n();break;case 3:na(),Dn(On),Dn(Bn),ua();break;case 5:aa(r);break;case 4:na();break;case 13:case 19:Dn(la);break;case 10:Bo(r.type._context);break;case 22:case 23:bh()}i=i.return}if(Oc=e,Fc=e=$h(e.current,null),zc=jc=t,Wc=0,Hc=null,Kc=qc=Uc=0,Gc=Vc=null,null!==jo){for(t=0;t<jo.length;t++)if(null!==(r=(i=jo[t]).interleaved)){i.interleaved=null;var s=r.next,n=i.pending;if(null!==n){var o=n.next;n.next=s,r.next=o}i.pending=r}jo=null}return e}function Sh(e,t){for(;;){var i=Fc;try{if(Io(),da.current=ol,va){for(var r=_a.memoizedState;null!==r;){var s=r.queue;null!==s&&(s.pending=null),r=r.next}va=!1}if(pa=0,ma=ga=_a=null,ba=!1,ya=0,Nc.current=null,null===i||null===i.return){Wc=1,Hc=t,Fc=null;break}e:{var n=e,o=i.return,a=i,l=t;if(t=zc,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=Cl(o);if(null!==f){f.flags&=-257,kl(f,o,a,0,t),1&f.mode&&xl(n,c,t),l=c;var p=(t=f).updateQueue;if(null===p){var _=new Set;_.add(l),t.updateQueue=_}else p.add(l);break e}if(!(1&t)){xl(n,c,t),xh();break e}l=Error(fe(426))}else if(fo&&1&a.mode){var g=Cl(o);if(null!==g){!(65536&g.flags)&&(g.flags|=256),kl(g,o,a,0,t),xo(ml(l,a));break e}}n=l=ml(l,a),4!==Wc&&(Wc=2),null===Vc?Vc=[n]:Vc.push(n),n=o;do{switch(n.tag){case 3:n.flags|=65536,t&=-t,n.lanes|=t,Xo(n,Sl(0,l,t));break e;case 1:a=l;var m=n.type,v=n.stateNode;if(!(128&n.flags||"function"!=typeof m.getDerivedStateFromError&&(null===v||"function"!=typeof v.componentDidCatch||null!==eh&&eh.has(v)))){n.flags|=65536,t&=-t,n.lanes|=t,Xo(n,wl(n,a,t));break e}}n=n.return}while(null!==n)}Rh(i)}catch(b){t=b,Fc===i&&null!==i&&(Fc=i=i.return);continue}break}}function wh(){var e=Dc.current;return Dc.current=ol,null===e?ol:e}function xh(){0!==Wc&&3!==Wc&&2!==Wc||(Wc=4),null===Oc||!(268435455&Uc)&&!(268435455&qc)||_h(Oc,zc)}function Ch(e,t){var i=Bc;Bc|=2;var r=wh();for(Oc===e&&zc===t||(Zc=null,yh(e,t));;)try{kh();break}catch(Up){Sh(e,Up)}if(Io(),Bc=i,Dc.current=r,null!==Fc)throw Error(fe(261));return Oc=null,zc=0,Wc}function kh(){for(;null!==Fc;)Lh(Fc)}function Eh(){for(;null!==Fc&&!ri();)Lh(Fc)}function Lh(e){var t=Pc(e.alternate,e,jc);e.memoizedProps=e.pendingProps,null===t?Rh(e):Fc=t,Nc.current=null}function Rh(e){var t=e;do{var i=t.alternate;if(e=t.return,32768&t.flags){if(null!==(i=ic(i,t)))return i.flags&=32767,void(Fc=i);if(null===e)return Wc=6,void(Fc=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}else if(null!==(i=tc(i,t,jc)))return void(Fc=i);if(null!==(t=t.sibling))return void(Fc=t);Fc=t=e}while(null!==t);0===Wc&&(Wc=5)}function Th(e,t,i){var r=Li,s=Ic.transition;try{Ic.transition=null,Li=1,function(e,t,i,r){do{Mh()}while(null!==ih);if(6&Bc)throw Error(fe(327));i=e.finishedWork;var s=e.finishedLanes;if(null===i)return null;if(e.finishedWork=null,e.finishedLanes=0,i===e.current)throw Error(fe(177));e.callbackNode=null,e.callbackPriority=0;var n=i.lanes|i.childLanes;if(function(e,t){var i=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<i;){var s=31-pi(i),n=1<<s;t[s]=0,r[s]=-1,e[s]=-1,i&=~n}}(e,n),e===Oc&&(Fc=Oc=null,zc=0),!(2064&i.subtreeFlags)&&!(2064&i.flags)||th||(th=!0,Oh(ci,function(){return Mh(),null})),n=!!(15990&i.flags),!!(15990&i.subtreeFlags)||n){n=Ic.transition,Ic.transition=null;var o=Li;Li=1;var a=Bc;Bc|=4,Nc.current=null,function(e,t){if(ln=Qi,ys(e=bs())){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{var r=(i=(i=e.ownerDocument)&&i.defaultView||window).getSelection&&i.getSelection();if(r&&0!==r.rangeCount){i=r.anchorNode;var s=r.anchorOffset,n=r.focusNode;r=r.focusOffset;try{i.nodeType,n.nodeType}catch(y){i=null;break e}var o=0,a=-1,l=-1,c=0,h=0,u=e,d=null;t:for(;;){for(var f;u!==i||0!==s&&3!==u.nodeType||(a=o+s),u!==n||0!==r&&3!==u.nodeType||(l=o+r),3===u.nodeType&&(o+=u.nodeValue.length),null!==(f=u.firstChild);)d=u,u=f;for(;;){if(u===e)break t;if(d===i&&++c===s&&(a=o),d===n&&++h===r&&(l=o),null!==(f=u.nextSibling))break;d=(u=d).parentNode}u=f}i=-1===a||-1===l?null:{start:a,end:l}}else i=null}i=i||{start:0,end:0}}else i=null;for(cn={focusedElem:e,selectionRange:i},Qi=!1,oc=t;null!==oc;)if(e=(t=oc).child,1028&t.subtreeFlags&&null!==e)e.return=t,oc=e;else for(;null!==oc;){t=oc;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 _=p.memoizedProps,g=p.memoizedState,m=t.stateNode,v=m.getSnapshotBeforeUpdate(t.elementType===t.type?_:hl(t.type,_),g);m.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var b=t.stateNode.containerInfo;1===b.nodeType?b.textContent="":9===b.nodeType&&b.documentElement&&b.removeChild(b.documentElement);break;default:throw Error(fe(163))}}catch(y){Ah(t,t.return,y)}if(null!==(e=t.sibling)){e.return=t.return,oc=e;break}oc=t.return}p=cc,cc=!1}(e,i),Cc(i,e),Ss(cn),Qi=!!ln,cn=ln=null,e.current=i,Ec(i),si(),Bc=a,Li=o,Ic.transition=n}else e.current=i;if(th&&(th=!1,ih=e,rh=s),n=e.pendingLanes,0===n&&(eh=null),function(e){if(fi&&"function"==typeof fi.onCommitFiberRoot)try{fi.onCommitFiberRoot(di,e,void 0,!(128&~e.current.flags))}catch(t){}}(i.stateNode),uh(e,ni()),null!==t)for(r=e.onRecoverableError,i=0;i<t.length;i++)s=t[i],r(s.value,{componentStack:s.stack,digest:s.digest});if(Qc)throw Qc=!1,e=Jc,Jc=null,e;!!(1&rh)&&0!==e.tag&&Mh(),n=e.pendingLanes,1&n?e===nh?sh++:(sh=0,nh=e):sh=0,Xn()}(e,t,i,r)}finally{Ic.transition=s,Li=r}return null}function Mh(){if(null!==ih){var e=Ri(rh),t=Ic.transition,i=Li;try{if(Ic.transition=null,Li=16>e?16:e,null===ih)var r=!1;else{if(e=ih,ih=null,rh=0,6&Bc)throw Error(fe(331));var s=Bc;for(Bc|=4,oc=e.current;null!==oc;){var n=oc,o=n.child;if(16&oc.flags){var a=n.deletions;if(null!==a){for(var l=0;l<a.length;l++){var c=a[l];for(oc=c;null!==oc;){var h=oc;switch(h.tag){case 0:case 11:case 15:hc(8,h,n)}var u=h.child;if(null!==u)u.return=h,oc=u;else for(;null!==oc;){var d=(h=oc).sibling,f=h.return;if(fc(h),h===c){oc=null;break}if(null!==d){d.return=f,oc=d;break}oc=f}}}var p=n.alternate;if(null!==p){var _=p.child;if(null!==_){p.child=null;do{var g=_.sibling;_.sibling=null,_=g}while(null!==_)}}oc=n}}if(2064&n.subtreeFlags&&null!==o)o.return=n,oc=o;else e:for(;null!==oc;){if(2048&(n=oc).flags)switch(n.tag){case 0:case 11:case 15:hc(9,n,n.return)}var m=n.sibling;if(null!==m){m.return=n.return,oc=m;break e}oc=n.return}}var v=e.current;for(oc=v;null!==oc;){var b=(o=oc).child;if(2064&o.subtreeFlags&&null!==b)b.return=o,oc=b;else e:for(o=v;null!==oc;){if(2048&(a=oc).flags)try{switch(a.tag){case 0:case 11:case 15:uc(9,a)}}catch(S){Ah(a,a.return,S)}if(a===o){oc=null;break e}var y=a.sibling;if(null!==y){y.return=a.return,oc=y;break e}oc=a.return}}if(Bc=s,Xn(),fi&&"function"==typeof fi.onPostCommitFiberRoot)try{fi.onPostCommitFiberRoot(di,e)}catch(S){}r=!0}return r}finally{Li=i,Ic.transition=t}}return!1}function Ph(e,t,i){e=Go(e,t=Sl(0,t=ml(i,t),1),1),t=lh(),null!==e&&(ki(e,1,t),uh(e,t))}function Ah(e,t,i){if(3===e.tag)Ph(e,e,i);else for(;null!==t;){if(3===t.tag){Ph(t,e,i);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===eh||!eh.has(r))){t=Go(t,e=wl(t,e=ml(i,e),1),1),e=lh(),null!==t&&(ki(t,1,e),uh(t,e));break}}t=t.return}}function Dh(e,t,i){var r=e.pingCache;null!==r&&r.delete(t),t=lh(),e.pingedLanes|=e.suspendedLanes&i,Oc===e&&(zc&i)===i&&(4===Wc||3===Wc&&(130023424&zc)===zc&&500>ni()-Yc?yh(e,0):Kc|=i),uh(e,t)}function Nh(e,t){0===t&&(1&e.mode?(t=vi,!(130023424&(vi<<=1))&&(vi=4194304)):t=1);var i=lh();null!==(e=Ho(e,t))&&(ki(e,t,i),uh(e,i))}function Ih(e){var t=e.memoizedState,i=0;null!==t&&(i=t.retryLane),Nh(e,i)}function Bh(e,t){var i=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;null!==s&&(i=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(fe(314))}null!==r&&r.delete(t),Nh(e,i)}function Oh(e,t){return ti(e,t)}function Fh(e,t,i,r){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function zh(e,t,i,r){return new Fh(e,t,i,r)}function jh(e){return!(!(e=e.prototype)||!e.isReactComponent)}function $h(e,t){var i=e.alternate;return null===i?((i=zh(e.tag,t,e.key,e.mode)).elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=14680064&e.flags,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i}function Wh(e,t,i,r,s,n){var o=2;if(r=e,"function"==typeof e)jh(e)&&(o=1);else if("string"==typeof e)o=5;else e:switch(e){case Pe:return Hh(i.children,s,n,t);case Ae:o=8,s|=8;break;case De:return(e=zh(12,i,t,2|s)).elementType=De,e.lanes=n,e;case Oe:return(e=zh(13,i,t,s)).elementType=Oe,e.lanes=n,e;case Fe:return(e=zh(19,i,t,s)).elementType=Fe,e.lanes=n,e;case $e:return Uh(i,s,n,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case Ne:o=10;break e;case Ie:o=9;break e;case Be:o=11;break e;case ze:o=14;break e;case je:o=16,r=null;break e}throw Error(fe(130,null==e?e:typeof e,""))}return(t=zh(o,i,t,s)).elementType=e,t.type=r,t.lanes=n,t}function Hh(e,t,i,r){return(e=zh(7,e,r,t)).lanes=i,e}function Uh(e,t,i,r){return(e=zh(22,e,r,t)).elementType=$e,e.lanes=i,e.stateNode={isHidden:!1},e}function qh(e,t,i){return(e=zh(6,e,null,t)).lanes=i,e}function Kh(e,t,i){return(t=zh(4,null!==e.children?e.children:[],e.key,t)).lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Vh(e,t,i,r,s){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=Ci(0),this.expirationTimes=Ci(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ci(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Gh(e,t,i,r,s,n,o,a,l){return e=new Vh(e,t,i,a,l),1===t?(t=1,!0===n&&(t|=8)):t=0,n=zh(3,null,null,t),e.current=n,n.stateNode=e,n.memoizedState={element:r,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},qo(n),e}function Yh(e){if(!e)return In;e:{if(Xt(e=e._reactInternals)!==e||1!==e.tag)throw Error(fe(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(jn(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(fe(171))}if(1===e.tag){var i=e.type;if(jn(i))return Hn(e,i,t)}return t}function Xh(e,t,i,r,s,n,o,a,l){return(e=Gh(i,r,!0,e,0,n,0,a,l)).context=Yh(null),i=e.current,(n=Vo(r=lh(),s=ch(i))).callback=null!=t?t:null,Go(i,n,s),e.current.lanes=s,ki(e,s,r),uh(e,r),e}function Zh(e,t,i,r){var s=t.current,n=lh(),o=ch(s);return i=Yh(i),null===t.context?t.context=i:t.pendingContext=i,(t=Vo(n,o)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),null!==(e=Go(s,t,o))&&(hh(e,s,o,n),Yo(e,s,o)),o}function Qh(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function Jh(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var i=e.retryLane;e.retryLane=0!==i&&i<t?i:t}}function eu(e,t){Jh(e,t),(e=e.alternate)&&Jh(e,t)}Pc=function(e,t,i){if(null!==e)if(e.memoizedProps!==t.pendingProps||On.current)Ll=!0;else{if(0===(e.lanes&i)&&!(128&t.flags))return Ll=!1,function(e,t,i){switch(t.tag){case 3:Ol(t),wo();break;case 5:oa(t);break;case 1:jn(t.type)&&Un(t);break;case 4:sa(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;Nn(Po,r._currentValue),r._currentValue=s;break;case 13:if(null!==(r=t.memoizedState))return null!==r.dehydrated?(Nn(la,1&la.current),t.flags|=128,null):0!==(i&t.child.childLanes)?ql(e,t,i):(Nn(la,1&la.current),null!==(e=Ql(e,t,i))?e.sibling:null);Nn(la,1&la.current);break;case 19:if(r=0!==(i&t.childLanes),128&e.flags){if(r)return Xl(e,t,i);t.flags|=128}if(null!==(s=t.memoizedState)&&(s.rendering=null,s.tail=null,s.lastEffect=null),Nn(la,la.current),r)break;return null;case 22:case 23:return t.lanes=0,Al(e,t,i)}return Ql(e,t,i)}(e,t,i);Ll=!!(131072&e.flags)}else Ll=!1,fo&&1048576&t.flags&&ao(t,eo,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Zl(e,t),e=t.pendingProps;var s=zn(t,Bn.current);Fo(t,i),s=Ca(null,t,r,e,s,i);var n=ka();return t.flags|=1,"object"==typeof s&&null!==s&&"function"==typeof s.render&&void 0===s.$$typeof?(t.tag=1,t.memoizedState=null,t.updateQueue=null,jn(r)?(n=!0,Un(t)):n=!1,t.memoizedState=null!==s.state&&void 0!==s.state?s.state:null,qo(t),s.updater=dl,t.stateNode=s,s._reactInternals=t,gl(t,r,e,i),t=Bl(null,t,r,!0,n,i)):(t.tag=0,fo&&n&&lo(t),Rl(null,t,s,i),t=t.child),t;case 16:r=t.elementType;e:{switch(Zl(e,t),e=t.pendingProps,r=(s=r._init)(r._payload),t.type=r,s=t.tag=function(e){if("function"==typeof e)return jh(e)?1:0;if(null!=e){if((e=e.$$typeof)===Be)return 11;if(e===ze)return 14}return 2}(r),e=hl(r,e),s){case 0:t=Nl(null,t,r,e,i);break e;case 1:t=Il(null,t,r,e,i);break e;case 11:t=Tl(null,t,r,e,i);break e;case 14:t=Ml(null,t,r,hl(r.type,e),i);break e}throw Error(fe(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,Nl(e,t,r,s=t.elementType===r?s:hl(r,s),i);case 1:return r=t.type,s=t.pendingProps,Il(e,t,r,s=t.elementType===r?s:hl(r,s),i);case 3:e:{if(Ol(t),null===e)throw Error(fe(387));r=t.pendingProps,s=(n=t.memoizedState).element,Ko(e,t),Zo(t,r,null,i);var o=t.memoizedState;if(r=o.element,n.isDehydrated){if(n={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=n,t.memoizedState=n,256&t.flags){t=Fl(e,t,r,i,s=ml(Error(fe(423)),t));break e}if(r!==s){t=Fl(e,t,r,i,s=ml(Error(fe(424)),t));break e}for(uo=mn(t.stateNode.containerInfo.firstChild),ho=t,fo=!0,po=null,i=Mo(t,null,r,i),t.child=i;i;)i.flags=-3&i.flags|4096,i=i.sibling}else{if(wo(),r===s){t=Ql(e,t,i);break e}Rl(e,t,r,i)}t=t.child}return t;case 5:return oa(t),null===e&&vo(t),r=t.type,s=t.pendingProps,n=null!==e?e.memoizedProps:null,o=s.children,hn(r,s)?o=null:null!==n&&hn(r,n)&&(t.flags|=32),Dl(e,t),Rl(e,t,o,i),t.child;case 6:return null===e&&vo(t),null;case 13:return ql(e,t,i);case 4:return sa(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=To(t,null,r,i):Rl(e,t,r,i),t.child;case 11:return r=t.type,s=t.pendingProps,Tl(e,t,r,s=t.elementType===r?s:hl(r,s),i);case 7:return Rl(e,t,t.pendingProps,i),t.child;case 8:case 12:return Rl(e,t,t.pendingProps.children,i),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,n=t.memoizedProps,o=s.value,Nn(Po,r._currentValue),r._currentValue=o,null!==n)if(ps(n.value,o)){if(n.children===s.children&&!On.current){t=Ql(e,t,i);break e}}else for(null!==(n=t.child)&&(n.return=t);null!==n;){var a=n.dependencies;if(null!==a){o=n.child;for(var l=a.firstContext;null!==l;){if(l.context===r){if(1===n.tag){(l=Vo(-1,i&-i)).tag=2;var c=n.updateQueue;if(null!==c){var h=(c=c.shared).pending;null===h?l.next=l:(l.next=h.next,h.next=l),c.pending=l}}n.lanes|=i,null!==(l=n.alternate)&&(l.lanes|=i),Oo(n.return,i,t),a.lanes|=i;break}l=l.next}}else if(10===n.tag)o=n.type===t.type?null:n.child;else if(18===n.tag){if(null===(o=n.return))throw Error(fe(341));o.lanes|=i,null!==(a=o.alternate)&&(a.lanes|=i),Oo(o,i,t),o=n.sibling}else o=n.child;if(null!==o)o.return=n;else for(o=n;null!==o;){if(o===t){o=null;break}if(null!==(n=o.sibling)){n.return=o.return,o=n;break}o=o.return}n=o}Rl(e,t,s.children,i),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Fo(t,i),r=r(s=zo(s)),t.flags|=1,Rl(e,t,r,i),t.child;case 14:return s=hl(r=t.type,t.pendingProps),Ml(e,t,r,s=hl(r.type,s),i);case 15:return Pl(e,t,t.type,t.pendingProps,i);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:hl(r,s),Zl(e,t),t.tag=1,jn(r)?(e=!0,Un(t)):e=!1,Fo(t,i),pl(t,r,s),gl(t,r,s,i),Bl(null,t,r,!0,e,i);case 19:return Xl(e,t,i);case 22:return Al(e,t,i)}throw Error(fe(156,t.tag))};var tu="function"==typeof reportError?reportError:function(e){console.error(e)};function iu(e){this._internalRoot=e}function ru(e){this._internalRoot=e}function su(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function nu(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function ou(){}function au(e,t,i,r,s){var n=i._reactRootContainer;if(n){var o=n;if("function"==typeof s){var a=s;s=function(){var e=Qh(o);a.call(e)}}Zh(t,o,e,s)}else o=function(e,t,i,r,s){if(s){if("function"==typeof r){var n=r;r=function(){var e=Qh(o);n.call(e)}}var o=Xh(t,r,e,0,null,!1,0,"",ou);return e._reactRootContainer=o,e[wn]=o.current,Ys(8===e.nodeType?e.parentNode:e),vh(),o}for(;s=e.lastChild;)e.removeChild(s);if("function"==typeof r){var a=r;r=function(){var e=Qh(l);a.call(e)}}var l=Gh(e,0,!1,null,0,!1,0,"",ou);return e._reactRootContainer=l,e[wn]=l.current,Ys(8===e.nodeType?e.parentNode:e),vh(function(){Zh(t,l,i,r)}),l}(i,t,e,s,r);return Qh(o)}ru.prototype.render=iu.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(fe(409));Zh(e,t,null,null)},ru.prototype.unmount=iu.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;vh(function(){Zh(null,e,null,null)}),t[wn]=null}},ru.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ai();e={blockedOn:null,target:e,priority:t};for(var i=0;i<$i.length&&0!==t&&t<$i[i].priority;i++);$i.splice(i,0,e),0===i&&qi(e)}},Ti=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var i=bi(t.pendingLanes);0!==i&&(Ei(t,1|i),uh(t,ni()),!(6&Bc)&&(Xc=ni()+500,Xn()))}break;case 13:vh(function(){var t=Ho(e,1);if(null!==t){var i=lh();hh(t,e,1,i)}}),eu(e,1)}},Mi=function(e){if(13===e.tag){var t=Ho(e,134217728);if(null!==t)hh(t,e,134217728,lh());eu(e,134217728)}},Pi=function(e){if(13===e.tag){var t=ch(e),i=Ho(e,t);if(null!==i)hh(i,e,t,lh());eu(e,t)}},Ai=function(){return Li},Di=function(e,t){var i=Li;try{return Li=e,t()}finally{Li=i}},Mt=function(e,t,i){switch(t){case"input":if(ot(e,i),t=i.name,"radio"===i.type&&null!=t){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<i.length;t++){var r=i[t];if(r!==e&&r.form===e.form){var s=Tn(r);if(!s)throw Error(fe(90));tt(r),ot(r,s)}}}break;case"textarea":ft(e,i);break;case"select":null!=(t=i.value)&&ht(e,!!i.multiple,t,!1)}},Bt=mh,Ot=vh;var lu={usingClientEntryPoint:!1,Events:[Ln,Rn,Tn,Nt,It,mh]},cu={findFiberByHostInstance:En,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},hu={bundleType:cu.bundleType,version:cu.version,rendererPackageName:cu.rendererPackageName,rendererConfig:cu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Re.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=Jt(e))?null:e.stateNode},findFiberByHostInstance:cu.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 uu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!uu.isDisabled&&uu.supportsFiber)try{di=uu.inject(hu),fi=uu}catch(vt){}}ae.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=lu,ae.createPortal=function(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!su(t))throw Error(fe(200));return function(e,t,i){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:Me,key:null==r?null:""+r,children:e,containerInfo:t,implementation:i}}(e,t,null,i)},ae.createRoot=function(e,t){if(!su(e))throw Error(fe(299));var i=!1,r="",s=tu;return null!=t&&(!0===t.unstable_strictMode&&(i=!0),void 0!==t.identifierPrefix&&(r=t.identifierPrefix),void 0!==t.onRecoverableError&&(s=t.onRecoverableError)),t=Gh(e,1,!1,null,0,i,0,r,s),e[wn]=t.current,Ys(8===e.nodeType?e.parentNode:e),new iu(t)},ae.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(fe(188));throw e=Object.keys(e).join(","),Error(fe(268,e))}return e=null===(e=Jt(t))?null:e.stateNode},ae.flushSync=function(e){return vh(e)},ae.hydrate=function(e,t,i){if(!nu(t))throw Error(fe(200));return au(null,e,t,!0,i)},ae.hydrateRoot=function(e,t,i){if(!su(e))throw Error(fe(405));var r=null!=i&&i.hydratedSources||null,s=!1,n="",o=tu;if(null!=i&&(!0===i.unstable_strictMode&&(s=!0),void 0!==i.identifierPrefix&&(n=i.identifierPrefix),void 0!==i.onRecoverableError&&(o=i.onRecoverableError)),t=Xh(t,null,e,1,null!=i?i:null,s,0,n,o),e[wn]=t.current,Ys(e),r)for(e=0;e<r.length;e++)s=(s=(i=r[e])._getVersion)(i._source),null==t.mutableSourceEagerHydrationData?t.mutableSourceEagerHydrationData=[i,s]:t.mutableSourceEagerHydrationData.push(i,s);return new ru(t)},ae.render=function(e,t,i){if(!nu(t))throw Error(fe(200));return au(null,e,t,!1,i)},ae.unmountComponentAtNode=function(e){if(!nu(e))throw Error(fe(40));return!!e._reactRootContainer&&(vh(function(){au(null,null,e,!1,function(){e._reactRootContainer=null,e[wn]=null})}),!0)},ae.unstable_batchedUpdates=mh,ae.unstable_renderSubtreeIntoContainer=function(e,t,i,r){if(!nu(i))throw Error(fe(200));if(null==e||void 0===e._reactInternals)throw Error(fe(38));return au(e,t,i,!1,r)},ae.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)}}(),oe.exports=ae;var du=oe.exports;ne.createRoot=du.createRoot,ne.hydrateRoot=du.hydrateRoot;const fu={},pu=e=>{let t;const i=new Set,r=(e,r)=>{const s="function"==typeof e?e(t):e;if(!Object.is(s,t)){const e=t;t=(null!=r?r:"object"!=typeof s||null===s)?s:Object.assign({},t,s),i.forEach(i=>i(t,e))}},s=()=>t,n={setState:r,getState:s,getInitialState:()=>o,subscribe:e=>(i.add(e),()=>i.delete(e)),destroy:()=>{"production"!==(fu?"production":void 0)&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),i.clear()}},o=t=e(r,s,n);return n};var _u={exports:{}},gu={},mu={exports:{}},vu={},bu=Y;var yu="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},Su=bu.useState,wu=bu.useEffect,xu=bu.useLayoutEffect,Cu=bu.useDebugValue;function ku(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!yu(e,i)}catch(r){return!0}}var Eu="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var i=t(),r=Su({inst:{value:i,getSnapshot:t}}),s=r[0].inst,n=r[1];return xu(function(){s.value=i,s.getSnapshot=t,ku(s)&&n({inst:s})},[e,i,t]),wu(function(){return ku(s)&&n({inst:s}),e(function(){ku(s)&&n({inst:s})})},[e]),Cu(i),i};vu.useSyncExternalStore=void 0!==bu.useSyncExternalStore?bu.useSyncExternalStore:Eu,mu.exports=vu;var Lu=mu.exports,Ru=Y,Tu=Lu;
30
+ /**
31
+ * @license React
32
+ * use-sync-external-store-shim/with-selector.production.js
33
+ *
34
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
35
+ *
36
+ * This source code is licensed under the MIT license found in the
37
+ * LICENSE file in the root directory of this source tree.
38
+ */var Mu="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},Pu=Tu.useSyncExternalStore,Au=Ru.useRef,Du=Ru.useEffect,Nu=Ru.useMemo,Iu=Ru.useDebugValue;gu.useSyncExternalStoreWithSelector=function(e,t,i,r,s){var n=Au(null);if(null===n.current){var o={hasValue:!1,value:null};n.current=o}else o=n.current;n=Nu(function(){function e(e){if(!l){if(l=!0,n=e,e=r(e),void 0!==s&&o.hasValue){var t=o.value;if(s(t,e))return a=t}return a=e}if(t=a,Mu(n,e))return t;var i=r(e);return void 0!==s&&s(t,i)?(n=e,t):(n=e,a=i)}var n,a,l=!1,c=void 0===i?null:i;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,i,r,s]);var a=Pu(e,n[0],n[1]);return Du(function(){o.hasValue=!0,o.value=a},[a]),Iu(a),a},_u.exports=gu;const Bu=h(_u.exports),Ou={},{useDebugValue:Fu}=X,{useSyncExternalStoreWithSelector:zu}=Bu;let ju=!1;const $u=e=>e;const Wu=e=>{"production"!==(Ou?"production":void 0)&&"function"!=typeof e&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t="function"==typeof e?(e=>e?pu(e):pu)(e):e,i=(e,i)=>function(e,t=$u,i){"production"!==(Ou?"production":void 0)&&i&&!ju&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),ju=!0);const r=zu(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,i);return Fu(r),r}(t,e,i);return Object.assign(i,t),i},Hu=e=>e?Wu(e):Wu,Uu=Hu((e,t)=>({sessions:{},activePorts:{},claudeStatus:{},gitBranches:{},editorNeedsAccessibility:!1,createSession:(t,i)=>e(e=>({sessions:{...e.sessions,[t]:{terminalId:t,projectId:i,terminal:null,title:"Terminal",alive:!0}}})),setTerminalInstance:(t,i)=>e(e=>{const r=e.sessions[t];return r?{sessions:{...e.sessions,[t]:{...r,terminal:i}}}:e}),setTitle:(t,i)=>e(e=>{const r=e.sessions[t];return r?{sessions:{...e.sessions,[t]:{...r,title:i}}}:e}),markDead:t=>e(e=>{const i=e.sessions[t];return i?{sessions:{...e.sessions,[t]:{...i,alive:!1}}}:e}),removeSession:t=>e(e=>{const{[t]:i,...r}=e.sessions;return{sessions:r}}),getSession:e=>t().sessions[e],getProjectSessions:e=>Object.values(t().sessions).filter(t=>t.projectId===e),setActivePorts:t=>e({activePorts:t}),setClaudeStatus:t=>e({claudeStatus:t}),setGitBranches:t=>e({gitBranches:t}),setEditorNeedsAccessibility:t=>e({editorNeedsAccessibility:t})}));let qu=null,Ku=null;function Vu(e){Ku=Ku?{...Ku,...e}:{...e},qu&&clearTimeout(qu),qu=setTimeout(()=>{const e=Ku;Ku=null,qu=null,fetch("/api/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).catch(()=>{})},300)}const Gu=Hu()((e,t)=>({projects:{},activeProjectId:null,setActiveProject:t=>{e({activeProjectId:t}),Vu({activeProjectId:t})},addProject:t=>e(e=>({projects:{...e.projects,[t.id]:t},activeProjectId:e.activeProjectId??t.id})),removeProject:t=>e(e=>{const{[t]:i,...r}=e.projects;return{projects:r,activeProjectId:e.activeProjectId===t?Object.keys(r)[0]??null:e.activeProjectId}}),addTerminalToProject:(t,i)=>e(e=>{const r=e.projects[t];return r?r.terminalIds.includes(i)?e:{projects:{...e.projects,[t]:{...r,terminalIds:[...r.terminalIds,i]}}}:e}),removeTerminalFromProject:(t,i)=>e(e=>{const r=e.projects[t];return r?{projects:{...e.projects,[t]:{...r,terminalIds:r.terminalIds.filter(e=>e!==i)}}}:e}),clearProjectTerminals:t=>e(e=>{const i=e.projects[t];return i?{projects:{...e.projects,[t]:{...i,terminalIds:[]}}}:e}),getActiveProject:()=>{const{projects:e,activeProjectId:i}=t();return i?e[i]??null:null},hydrateFromServer:async()=>{try{const[t,i]=await Promise.all([fetch("/api/projects"),fetch("/api/settings")]),r=await t.json(),s=await i.json(),n={};for(const e of r)n[e.id]={id:e.id,name:e.name,cwd:e.cwd,terminalIds:[]};const o=s.activeProjectId&&n[s.activeProjectId]?s.activeProjectId:Object.keys(n)[0]??null;e({projects:n,activeProjectId:o})}catch{}}})),Yu={background:"#0a0a0f",foreground:"#ececf1",cursor:"#ececf1",cursorAccent:"#0a0a0f",selectionBackground:"#5b5bd640",selectionForeground:"#ececf1",black:"#1a1a24",red:"#e5484d",green:"#30a46c",yellow:"#f5d90a",blue:"#5b5bd6",magenta:"#ab4aba",cyan:"#12a594",white:"#ececf1",brightBlack:"#6b6b80",brightRed:"#ff6369",brightGreen:"#3dd68c",brightYellow:"#ffef5c",brightBlue:"#849dff",brightMagenta:"#d19dff",brightCyan:"#0ac5b3",brightWhite:"#ffffff"},Xu={background:"#ffffff",foreground:"#1a1a2e",cursor:"#1a1a2e",cursorAccent:"#ffffff",selectionBackground:"#5b5bd630",selectionForeground:"#1a1a2e",black:"#1a1a2e",red:"#dc3545",green:"#1a8f5c",yellow:"#b58900",blue:"#5b5bd6",magenta:"#9b3bb0",cyan:"#0f8a7e",white:"#d0d0d8",brightBlack:"#8888a0",brightRed:"#e5484d",brightGreen:"#30a46c",brightYellow:"#d4a017",brightBlue:"#6e6ee6",brightMagenta:"#ab4aba",brightCyan:"#12a594",brightWhite:"#d0d0d8"};function Zu(e){return e?"leaf"===e.type?[e.terminalId]:[...Zu(e.first),...Zu(e.second)]:[]}function Qu(e,t){if("leaf"===e.type)return null;const i=Zu(e.first),r=Zu(e.second);return i.includes(t)||r.includes(t)?e.direction:Qu(e.first,t)??Qu(e.second,t)}function Ju(e,t,i,r){if(!e)return{type:"leaf",terminalId:i};return ed(e,t,i,r??("vertical"===Qu(e,t)?"horizontal":"vertical"))}function ed(e,t,i,r){return"leaf"===e.type?e.terminalId===t?{type:"split",direction:r,ratio:.5,first:e,second:{type:"leaf",terminalId:i}}:e:{...e,first:ed(e.first,t,i,r),second:ed(e.second,t,i,r)}}function td(e,t){if(!e)return null;if("leaf"===e.type)return e.terminalId===t?null:e;const i=Zu(e.first),r=Zu(e.second);if("leaf"===e.first.type&&e.first.terminalId===t)return e.second;if("leaf"===e.second.type&&e.second.terminalId===t)return e.first;if(i.includes(t)){const i=td(e.first,t);return i?{...e,first:i}:e.second}if(r.includes(t)){const i=td(e.second,t);return i?{...e,second:i}:e.first}return e}function id(e,t,i){const r=Math.max(.1,Math.min(.9,i));if(0===t.length)return"split"===e.type?{...e,ratio:r}:e;if("leaf"===e.type)return e;const[s,...n]=t;return 0===s?{...e,first:id(e.first,n,r)}:{...e,second:id(e.second,n,r)}}function rd(e,t,i){return"leaf"===e.type?e.terminalId===t?{...e,terminalId:i}:e.terminalId===i?{...e,terminalId:t}:e:{...e,first:rd(e.first,t,i),second:rd(e.second,t,i)}}function sd(e,t,i,r){const s=td(e,t);if(!s)return null;return nd(s,i,t,"left"===r||"right"===r?"vertical":"horizontal","left"===r||"top"===r)}function nd(e,t,i,r,s){if("leaf"===e.type){if(e.terminalId===t){const t={type:"leaf",terminalId:i};return{type:"split",direction:r,ratio:.5,first:s?t:e,second:s?e:t}}return e}return{...e,first:nd(e.first,t,i,r,s),second:nd(e.second,t,i,r,s)}}const od=["even-horizontal","even-vertical","main-left","main-top","grid"];function ad(e,t){if(0===e.length)return null;if(1===e.length)return{type:"leaf",terminalId:e[0]};switch(t){case"even-horizontal":return ld(e,"horizontal");case"even-vertical":return ld(e,"vertical");case"main-left":return cd(e,"vertical");case"main-top":return cd(e,"horizontal");case"grid":return function(e){if(e.length<=2)return ld(e,"vertical");const t=Math.ceil(e.length/2),i=e.slice(0,t),r=e.slice(t);return{type:"split",direction:"horizontal",ratio:.5,first:ld(i,"vertical"),second:r.length>0?ld(r,"vertical"):{type:"leaf",terminalId:i[i.length-1]}}}(e)}}function ld(e,t){if(1===e.length)return{type:"leaf",terminalId:e[0]};if(2===e.length)return{type:"split",direction:t,ratio:.5,first:{type:"leaf",terminalId:e[0]},second:{type:"leaf",terminalId:e[1]}};return{type:"split",direction:t,ratio:1/e.length,first:{type:"leaf",terminalId:e[0]},second:ld(e.slice(1),t)}}function cd(e,t,i){const[r,...s]=e;return{type:"split",direction:t,ratio:.6,first:{type:"leaf",terminalId:r},second:ld(s,"vertical"===t?"horizontal":"vertical")}}function hd(e,t,i){const r=Zu(e),s=r.indexOf(t);return-1===s?null:"left"===i||"up"===i?s>0?r[s-1]:null:s<r.length-1?r[s+1]:null}const ud=Hu((e,t)=>({layouts:{},currentPresetIndex:0,getLayout:e=>t().layouts[e]??null,setLayout:(t,i)=>e(e=>({layouts:{...e.layouts,[t]:i}})),addPaneToProject:(t,i,r,s)=>e(e=>{const n=Ju(e.layouts[t]??null,i,r,s);return{layouts:{...e.layouts,[t]:n}}}),removePaneFromProject:(t,i)=>e(e=>{const r=e.layouts[t];if(!r)return e;const s=td(r,i);return{layouts:{...e.layouts,[t]:s}}}),resizePaneInProject:(t,i,r)=>e(e=>{const s=e.layouts[t];if(!s)return e;const n=id(s,i,r);return{layouts:{...e.layouts,[t]:n}}}),swapPanesInProject:(t,i,r)=>e(e=>{const s=e.layouts[t];if(!s)return e;const n=rd(s,i,r);return{layouts:{...e.layouts,[t]:n}}}),movePaneInProject:(t,i,r,s)=>e(e=>{const n=e.layouts[t];if(!n)return e;const o=sd(n,i,r,s);return{layouts:{...e.layouts,[t]:o}}}),applyPresetToProject:(t,i)=>e(e=>{const r=od[e.currentPresetIndex],s=ad(i,r);return{layouts:{...e.layouts,[t]:s}}}),cyclePreset:(t,i)=>e(e=>{const r=(e.currentPresetIndex+1)%od.length,s=od[r],n=ad(i,s);return{currentPresetIndex:r,layouts:{...e.layouts,[t]:n}}}),removeProjectLayout:t=>e(e=>{const{[t]:i,...r}=e.layouts;return{layouts:r}})}));function dd(e){document.documentElement.setAttribute("data-theme",e)}function fd(e){return"system"===e?window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark":e}function pd(e){document.cookie=`paneful_theme=${e};path=/;max-age=31536000;SameSite=Lax`}const _d=function(){const e=document.cookie.match(/(?:^|; )paneful_theme=(system|dark|light)/);return(null==e?void 0:e[1])??"system"}();function gd(e){const{theme:t,sidebarWidth:i,editorSyncEnabled:r,gpuRendering:s}=e();Vu({ui:{theme:t,sidebarWidth:i,editorSyncEnabled:r,gpuRendering:s}})}dd(_d);const md=Hu((e,t)=>({focusedTerminalId:null,sidebarOpen:!0,sidebarWidth:224,draggingTerminalId:null,dropTarget:null,connectionStatus:"connecting",editorSyncEnabled:!0,gpuRendering:!0,theme:_d,syncToast:null,searchTerminalId:null,commandPaletteOpen:!1,pendingFavouriteLaunchId:null,setFocusedTerminal:t=>e({focusedTerminalId:t}),toggleSidebar:()=>e(e=>({sidebarOpen:!e.sidebarOpen})),setSidebarOpen:t=>e({sidebarOpen:t}),setSidebarWidth:i=>{const r=Math.min(700,Math.max(160,i));e({sidebarWidth:r}),gd(t)},setDragging:t=>e({draggingTerminalId:t}),setDropTarget:t=>e({dropTarget:t}),setConnectionStatus:t=>e({connectionStatus:t}),toggleEditorSync:()=>{e(e=>({editorSyncEnabled:!e.editorSyncEnabled})),gd(t)},toggleGpuRendering:()=>{e(e=>({gpuRendering:!e.gpuRendering})),gd(t)},setTheme:i=>{pd(i),dd(i),e({theme:i}),gd(t)},cycleTheme:()=>{const i=["system","light","dark"],r=t().theme,s=i[(i.indexOf(r)+1)%i.length];pd(s),dd(s),e({theme:s}),gd(t)},openSearch:t=>e({searchTerminalId:t}),closeSearch:()=>e({searchTerminalId:null}),toggleCommandPalette:()=>e(e=>({commandPaletteOpen:!e.commandPaletteOpen})),closeCommandPalette:()=>e({commandPaletteOpen:!1}),requestFavouriteLaunch:t=>e({pendingFavouriteLaunchId:t}),clearPendingFavouriteLaunch:()=>e({pendingFavouriteLaunchId:null}),showSyncToast:t=>{e({syncToast:{projectName:t,id:Date.now()}})},dismissSyncToast:()=>e({syncToast:null}),hydrateFromServer:async()=>{try{const t=await fetch("/api/settings"),i=await t.json();if(i.ui){const{theme:t,sidebarWidth:r,editorSyncEnabled:s,gpuRendering:n}=i.ui;t&&(pd(t),dd(t)),e({...t?{theme:t}:{},...void 0!==r?{sidebarWidth:r}:{},...void 0!==s?{editorSyncEnabled:s}:{},...void 0!==n?{gpuRendering:n}:{}})}}catch{}}}));function vd(e,t,i){return`${e}::${i}::${t}`}function bd(e){const t=Object.keys(e);if(t.length<=20)return e;const i={};for(let r=t.length-20;r<t.length;r++)i[t[r]]=e[t[r]];return i}function yd(e){const{panelOpen:t,panelWidth:i}=e();Vu({ui:{sourceControlOpen:t,sourceControlWidth:i}})}const Sd=Hu((e,t)=>({panelOpen:!1,panelWidth:360,statusByProject:{},selectedFile:null,selectedPaths:new Set,selectionAnchor:null,diffCache:{},commitDrafts:{},expanded:{staged:!0,changes:!0,untracked:!0,conflicted:!0,stash:!0},lastActionError:null,pendingDiscard:null,pendingStashCreate:!1,inFlight:new Set,togglePanel:()=>{e(e=>({panelOpen:!e.panelOpen,diffCache:e.panelOpen?{}:e.diffCache,selectedFile:e.panelOpen?null:e.selectedFile,selectedPaths:e.panelOpen?new Set:e.selectedPaths,selectionAnchor:e.panelOpen?null:e.selectionAnchor})),yd(t)},setPanelOpen:i=>{e(e=>({panelOpen:i,diffCache:i?e.diffCache:{},selectedFile:i?e.selectedFile:null,selectedPaths:i?e.selectedPaths:new Set,selectionAnchor:i?e.selectionAnchor:null})),yd(t)},setPanelWidth:i=>{const r=Math.min(800,Math.max(240,i));e({panelWidth:r}),yd(t)},setStatus:(t,i)=>{e(e=>({statusByProject:{...e.statusByProject,[t]:i}}))},selectFile:t=>e({selectedFile:t}),setMultiSelection:(t,i)=>e({selectedPaths:new Set(t),selectionAnchor:i}),toggleSelection:t=>e(e=>{const i=new Set(e.selectedPaths);return i.has(t)?i.delete(t):i.add(t),{selectedPaths:i,selectionAnchor:t}}),clearSelection:()=>e({selectedPaths:new Set,selectionAnchor:null}),setDiff:(t,i)=>e(e=>{const{[t]:r,...s}=e.diffCache;return{diffCache:bd({...s,[t]:i})}}),setCommitDraft:(t,i)=>e(e=>({commitDrafts:{...e.commitDrafts,[t]:i}})),toggleGroup:t=>e(e=>({expanded:{...e.expanded,[t]:!e.expanded[t]}})),setActionResult:(t,i,r)=>{e(e=>{const s=new Set(e.inFlight);return s.delete(t),!i&&r?{lastActionError:`${t}: ${r}`,inFlight:s}:{lastActionError:null,inFlight:s}})},setActionInFlight:(t,i)=>e(e=>{const r=new Set(e.inFlight);return i?r.add(t):r.delete(t),{inFlight:r}}),clearActionError:()=>e({lastActionError:null}),requestDiscard:(t,i)=>e({pendingDiscard:{trackedFiles:t,untrackedFiles:i}}),cancelDiscard:()=>e({pendingDiscard:null}),openStashCreate:()=>e({pendingStashCreate:!0}),closeStashCreate:()=>e({pendingStashCreate:!1}),hydrate:(t,i)=>e({panelOpen:t,panelWidth:i})}));
39
+ /**
40
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
41
+ * @license MIT
42
+ *
43
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
44
+ * @license MIT
45
+ *
46
+ * Originally forked from (with the author's permission):
47
+ * Fabrice Bellard's javascript vt100 for jslinux:
48
+ * http://bellard.org/jslinux/
49
+ * Copyright (c) 2011 Fabrice Bellard
50
+ */
51
+ var wd=Object.defineProperty,xd=Object.getOwnPropertyDescriptor,Cd=(e,t,i,r)=>{for(var s,n=r>1?void 0:r?xd(t,i):t,o=e.length-1;o>=0;o--)(s=e[o])&&(n=(r?s(t,i,n):s(n))||n);return r&&n&&wd(t,i,n),n},kd=(e,t)=>(i,r)=>t(i,r,e),Ed="Terminal input",Ld=()=>Ed,Rd=e=>Ed=e,Td="Too much output to announce, navigate to rows manually to read",Md=()=>Td,Pd=e=>Td=e;function Ad(e,t,i,r){e=function(e,t){return t?"[200~"+e+"[201~":e}(e=function(e){return e.replace(/\r?\n/g,"\r")}(e),i.decPrivateModes.bracketedPasteMode&&!0!==r.rawOptions.ignoreBracketedPasteMode),i.triggerDataEvent(e,!0),t.value=""}function Dd(e,t,i){let r=i.getBoundingClientRect(),s=e.clientX-r.left-10,n=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${s}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}function Nd(e,t,i,r,s){Dd(e,t,i),s&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Id(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Bd(e,t=0,i=e.length){let r="";for(let s=t;s<i;++s){let t=e[s];t>65535?(t-=65536,r+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var Od=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let r=0,s=0;if(this._interim){let i=e.charCodeAt(s++);56320<=i&&i<=57343?t[r++]=1024*(this._interim-55296)+i-56320+65536:(t[r++]=this._interim,t[r++]=i),this._interim=0}for(let n=s;n<i;++n){let s=e.charCodeAt(n);if(55296<=s&&s<=56319){if(++n>=i)return this._interim=s,r;let o=e.charCodeAt(n);56320<=o&&o<=57343?t[r++]=1024*(s-55296)+o-56320+65536:(t[r++]=s,t[r++]=o);continue}65279!==s&&(t[r++]=s)}return r}},Fd=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let r,s,n,o,a=0,l=0,c=0;if(this.interim[0]){let r=!1,s=this.interim[0];s&=192==(224&s)?31:224==(240&s)?15:7;let n,o=0;for(;(n=63&this.interim[++o])&&o<4;)s<<=6,s|=n;let l=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,h=l-o;for(;c<h;){if(c>=i)return 0;if(n=e[c++],128!=(192&n)){c--,r=!0;break}this.interim[o++]=n,s<<=6,s|=63&n}r||(2===l?s<128?c--:t[a++]=s:3===l?s<2048||s>=55296&&s<=57343||65279===s||(t[a++]=s):s<65536||s>1114111||(t[a++]=s)),this.interim.fill(0)}let h=i-4,u=c;for(;u<i;){for(;!(!(u<h)||128&(r=e[u])||128&(s=e[u+1])||128&(n=e[u+2])||128&(o=e[u+3]));)t[a++]=r,t[a++]=s,t[a++]=n,t[a++]=o,u+=4;if(r=e[u++],r<128)t[a++]=r;else if(192==(224&r)){if(u>=i)return this.interim[0]=r,a;if(s=e[u++],128!=(192&s)){u--;continue}if(l=(31&r)<<6|63&s,l<128){u--;continue}t[a++]=l}else if(224==(240&r)){if(u>=i)return this.interim[0]=r,a;if(s=e[u++],128!=(192&s)){u--;continue}if(u>=i)return this.interim[0]=r,this.interim[1]=s,a;if(n=e[u++],128!=(192&n)){u--;continue}if(l=(15&r)<<12|(63&s)<<6|63&n,l<2048||l>=55296&&l<=57343||65279===l)continue;t[a++]=l}else if(240==(248&r)){if(u>=i)return this.interim[0]=r,a;if(s=e[u++],128!=(192&s)){u--;continue}if(u>=i)return this.interim[0]=r,this.interim[1]=s,a;if(n=e[u++],128!=(192&n)){u--;continue}if(u>=i)return this.interim[0]=r,this.interim[1]=s,this.interim[2]=n,a;if(o=e[u++],128!=(192&o)){u--;continue}if(l=(7&r)<<18|(63&s)<<12|(63&n)<<6|63&o,l<65536||l>1114111)continue;t[a++]=l}}return a}},zd=" ",jd=class e{constructor(){this.fg=0,this.bg=0,this.extended=new $d}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}},$d=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}},Wd=class e extends jd{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new $d,this.combinedData=""}static fromCharData(t){let i=new e;return i.setFromCharData(t),i}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?Id(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(2===e[1].length){let i=e[1].charCodeAt(0);if(55296<=i&&i<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(i-55296)+r-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()]}},Hd="di$target",Ud="di$dependencies",qd=new Map;function Kd(e){if(qd.has(e))return qd.get(e);let t=function(e,i,r){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");!function(e,t,i){t[Hd]===t?t[Ud].push({id:e,index:i}):(t[Ud]=[{id:e,index:i}],t[Hd]=t)}(t,e,r)};return t._id=e,qd.set(e,t),t}var Vd=Kd("BufferService"),Gd=Kd("CoreMouseService"),Yd=Kd("CoreService"),Xd=Kd("CharsetService"),Zd=Kd("InstantiationService"),Qd=Kd("LogService"),Jd=Kd("OptionsService"),ef=Kd("OscLinkService"),tf=Kd("UnicodeService"),rf=Kd("DecorationService"),sf=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){var i;let r=this._bufferService.buffer.lines.get(e-1);if(!r)return void t(void 0);let s=[],n=this._optionsService.rawOptions.linkHandler,o=new Wd,a=r.getTrimmedLength(),l=-1,c=-1,h=!1;for(let u=0;u<a;u++)if(-1!==c||r.hasContent(u)){if(r.loadCell(u,o),o.hasExtendedAttrs()&&o.extended.urlId){if(-1===c){c=u,l=o.extended.urlId;continue}h=o.extended.urlId!==l}else-1!==c&&(h=!0);if(h||-1!==c&&u===a-1){let t=null==(i=this._oscLinkService.getLinkData(l))?void 0:i.uri;if(t){let i={start:{x:c+1,y:e},end:{x:u+(h||u!==a-1?0:1),y:e}},r=!1;if(!(null==n?void 0:n.allowNonHttpProtocols))try{let e=new URL(t);["http:","https:"].includes(e.protocol)||(r=!0)}catch{r=!0}r||s.push({text:t,range:i,activate:(e,t)=>n?n.activate(e,t,i):nf(e,t),hover:(e,t)=>{var r;return null==(r=null==n?void 0:n.hover)?void 0:r.call(n,e,t,i)},leave:(e,t)=>{var r;return null==(r=null==n?void 0:n.leave)?void 0:r.call(n,e,t,i)}})}h=!1,o.hasExtendedAttrs()&&o.extended.urlId?(c=u,l=o.extended.urlId):(c=-1,l=-1)}}t(s)}};function nf(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")}}sf=Cd([kd(0,Vd),kd(1,Jd),kd(2,ef)],sf);var of=Kd("CharSizeService"),af=Kd("CoreBrowserService"),lf=Kd("MouseService"),cf=Kd("RenderService"),hf=Kd("SelectionService"),uf=Kd("CharacterJoinerService"),df=Kd("ThemeService"),ff=Kd("LinkProviderService"),pf=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Sf.isErrorNoTelemetry(e)?new Sf(e.message+"\n\n"+e.stack):new Error(e.message+"\n\n"+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function _f(e){(function(e){return e instanceof mf||e instanceof Error&&e.name===gf&&e.message===gf})(e)||pf.onUnexpectedError(e)}var gf="Canceled";var mf=class extends Error{constructor(){super(gf),this.name=this.message}};var vf,bf,yf,Sf=class e extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(t){if(t instanceof e)return t;let i=new e;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(e){return"CodeExpectedError"===e.name}},wf=class e extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,e.prototype)}};function xf(e,t=0){return e[e.length-(1+t)]}function Cf(e,t){let i,r=this,s=!1;return function(){return s||(s=!0,t||(i=e.apply(r,arguments))),i}}function kf(e){if(yf.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(pp){t.push(pp)}if(1===t.length)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function Ef(e){return{dispose:Cf(()=>{e()})}}(bf=vf||(vf={})).isLessThan=function(e){return e<0},bf.isLessThanOrEqual=function(e){return e<=0},bf.isGreaterThan=function(e){return e>0},bf.isNeitherLessOrGreaterThan=function(e){return 0===e},bf.greaterThan=1,bf.lessThan=-1,bf.neitherLessOrGreaterThan=0,(e=>{function t(e){return e&&"object"==typeof e&&"function"==typeof e[Symbol.iterator]}e.is=t;let i=Object.freeze([]);function*r(e){yield e}e.empty=function(){return i},e.single=r,e.wrap=function(e){return t(e)?e:r(e)},e.from=function(e){return e||i},e.reverse=function*(e){for(let t=e.length-1;t>=0;t--)yield e[t]},e.isEmpty=function(e){return!e||!0===e[Symbol.iterator]().next().done},e.first=function(e){return e[Symbol.iterator]().next().value},e.some=function(e,t){let i=0;for(let r of e)if(t(r,i++))return!0;return!1},e.find=function(e,t){for(let i of e)if(t(i))return i},e.filter=function*(e,t){for(let i of e)t(i)&&(yield i)},e.map=function*(e,t){let i=0;for(let r of e)yield t(r,i++)},e.flatMap=function*(e,t){let i=0;for(let r of e)yield*t(r,i++)},e.concat=function*(...e){for(let t of e)yield*t},e.reduce=function(e,t,i){let r=i;for(let s of e)r=t(r,s);return r},e.slice=function*(e,t,i=e.length){for(t<0&&(t+=e.length),i<0?i+=e.length:i>e.length&&(i=e.length);t<i;t++)yield e[t]},e.consume=function(t,i=Number.POSITIVE_INFINITY){let r=[];if(0===i)return[r,t];let s=t[Symbol.iterator]();for(let n=0;n<i;n++){let t=s.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator]:()=>s}]},e.asyncToArray=async function(e){let t=[];for await(let i of e)t.push(i);return Promise.resolve(t)}})(yf||(yf={}));var Lf=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(0!==this._toDispose.size)try{kf(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&this._toDispose.delete(e)}};Lf.DISABLE_DISPOSED_WARNING=!1;var Rf=Lf,Tf=class{constructor(){this._store=new Rf,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Tf.None=Object.freeze({dispose(){}});var Mf=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}clearAndLeak(){let e=this._value;return this._value=void 0,e}},Pf="object"==typeof window?window:globalThis,Af=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};Af.Undefined=new Af(void 0);var Df,Nf=Af,If=class{constructor(){this._first=Nf.Undefined,this._last=Nf.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Nf.Undefined}clear(){let e=this._first;for(;e!==Nf.Undefined;){let t=e.next;e.prev=Nf.Undefined,e.next=Nf.Undefined,e=t}this._first=Nf.Undefined,this._last=Nf.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let i=new Nf(e);if(this._first===Nf.Undefined)this._first=i,this._last=i;else if(t){let e=this._last;this._last=i,i.prev=e,e.next=i}else{let e=this._first;this._first=i,i.next=e,e.prev=i}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(i))}}shift(){if(this._first!==Nf.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Nf.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Nf.Undefined&&e.next!==Nf.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Nf.Undefined&&e.next===Nf.Undefined?(this._first=Nf.Undefined,this._last=Nf.Undefined):e.next===Nf.Undefined?(this._last=this._last.prev,this._last.next=Nf.Undefined):e.prev===Nf.Undefined&&(this._first=this._first.next,this._first.prev=Nf.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Nf.Undefined;)yield e.element,e=e.next}},Bf=globalThis.performance&&"function"==typeof globalThis.performance.now,Of=class e{static create(t){return new e(t)}constructor(e){this._now=Bf&&!1===e?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return-1!==this._stopTime?this._stopTime-this._startTime:this._now()-this._startTime}};(e=>{function t(e){return(t,i=null,r)=>{let s,n=!1;return s=e(e=>{if(!n)return s?s.dispose():n=!0,t.call(i,e)},null,r),n&&s.dispose(),s}}function i(e,t,i){return s((i,r=null,s)=>e(e=>i.call(r,t(e)),null,s),i)}function r(e,t,i){return s((i,r=null,s)=>e(e=>t(e)&&i.call(r,e),null,s),i)}function s(e,t){let i,r=new Vf({onWillAddFirstListener(){i=e(r.fire,r)},onDidRemoveLastListener(){null==i||i.dispose()}});return null==t||t.add(r),r.event}function n(e,t,i=100,r=!1,s=!1,n,o){let a,l,c,h,u=0,d=new Vf({leakWarningThreshold:n,onWillAddFirstListener(){a=e(e=>{u++,l=t(l,e),r&&!c&&(d.fire(l),l=void 0),h=()=>{let e=l;l=void 0,c=void 0,(!r||u>1)&&d.fire(e),u=0},"number"==typeof i?(clearTimeout(c),c=setTimeout(h,i)):void 0===c&&(c=0,queueMicrotask(h))})},onWillRemoveListener(){s&&u>0&&(null==h||h())},onDidRemoveLastListener(){h=void 0,a.dispose()}});return null==o||o.add(d),d.event}e.None=()=>Tf.None,e.defer=function(e,t){return n(e,()=>{},0,void 0,!0,void 0,t)},e.once=t,e.map=i,e.forEach=function(e,t,i){return s((i,r=null,s)=>e(e=>{t(e),i.call(r,e)},null,s),i)},e.filter=r,e.signal=function(e){return e},e.any=function(...e){return(t,i=null,r)=>function(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}(function(...e){return Ef(()=>kf(e))}(...e.map(e=>e(e=>t.call(i,e)))),r)},e.reduce=function(e,t,r,s){let n=r;return i(e,e=>(n=t(n,e),n),s)},e.debounce=n,e.accumulate=function(t,i=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],i,void 0,!0,void 0,r)},e.latch=function(e,t=(e,t)=>e===t,i){let s,n=!0;return r(e,e=>{let i=n||!t(e,s);return n=!1,s=e,i},i)},e.split=function(t,i,r){return[e.filter(t,i,r),e.filter(t,e=>!i(e),r)]},e.buffer=function(e,t=!1,i=[],r){let s=i.slice(),n=e(e=>{s?s.push(e):a.fire(e)});r&&r.add(n);let o=()=>{null==s||s.forEach(e=>a.fire(e)),s=null},a=new Vf({onWillAddFirstListener(){n||(n=e(e=>a.fire(e)),r&&r.add(n))},onDidAddFirstListener(){s&&(t?setTimeout(o):o())},onDidRemoveLastListener(){n&&n.dispose(),n=null}});return r&&r.add(a),a.event},e.chain=function(e,t){return(i,r,s)=>{let n=t(new a);return e(function(e){let t=n.evaluate(e);t!==o&&i.call(r,t)},void 0,s)}};let o=Symbol("HaltChainable");class a{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:o),this}reduce(e,t){let i=t;return this.steps.push(t=>(i=e(i,t),i)),this}latch(e=(e,t)=>e===t){let t,i=!0;return this.steps.push(r=>{let s=i||!e(r,t);return i=!1,t=r,s?r:o}),this}evaluate(e){for(let t of this.steps)if((e=t(e))===o)break;return e}}e.fromNodeEventEmitter=function(e,t,i=e=>e){let r=(...e)=>s.fire(i(...e)),s=new Vf({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return s.event},e.fromDOMEventEmitter=function(e,t,i=e=>e){let r=(...e)=>s.fire(i(...e)),s=new Vf({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return s.event},e.toPromise=function(e){return new Promise(i=>t(e)(i))},e.fromPromise=function(e){let t=new Vf;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event},e.forward=function(e,t){return e(e=>t.fire(e))},e.runAndSubscribe=function(e,t,i){return t(i),e(e=>t(e))};class l{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let i={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new Vf(i),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,0===this._counter&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}e.fromObservable=function(e,t){return new l(e,t).emitter.event},e.fromObservableLight=function(e){return(t,i,r)=>{let s=0,n=!1,o={beginUpdate(){s++},endUpdate(){s--,0===s&&(e.reportChanges(),n&&(n=!1,t.call(i)))},handlePossibleChange(){},handleChange(){n=!0}};e.addObserver(o),e.reportChanges();let a={dispose(){e.removeObserver(o)}};return r instanceof Rf?r.add(a):Array.isArray(r)&&r.push(a),a}}})(Df||(Df={}));var Ff=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new Of,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};Ff.all=new Set,Ff._idPool=0;var zf=Ff,jf=class e{constructor(t,i,r=(e._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=r,this._warnCountdown=0}dispose(){var e;null==(e=this._stacks)||e.clear()}check(e,t){let i=this.threshold;if(i<=0||t<i)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=.5*i;let[e,r]=this.getMostFrequentStack(),s=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(s),console.warn(e);let n=new Hf(s,e);this._errorHandler(n)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[i,r]of this._stacks)(!e||t<r)&&(e=[i,r],t=r);return e}};jf._idPool=1;var $f=jf,Wf=class e{constructor(e){this.value=e}static create(){let t=new Error;return new e(t.stack??"")}print(){console.warn(this.value.split("\n").slice(2).join("\n"))}},Hf=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Uf=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},qf=0,Kf=class{constructor(e){this.value=e,this.id=qf++}},Vf=class{constructor(e){var t,i,r,s;this._size=0,this._options=e,this._leakageMon=(null==(t=this._options)?void 0:t.leakWarningThreshold)?new $f((null==e?void 0:e.onListenerError)??_f,(null==(i=this._options)?void 0:i.leakWarningThreshold)??-1):void 0,this._perfMon=(null==(r=this._options)?void 0:r._profName)?new zf(this._options._profName):void 0,this._deliveryQueue=null==(s=this._options)?void 0:s.deliveryQueue}dispose(){var e,t,i,r;this._disposed||(this._disposed=!0,(null==(e=this._deliveryQueue)?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),null==(i=null==(t=this._options)?void 0:t.onDidRemoveLastListener)||i.call(t),null==(r=this._leakageMon)||r.dispose())}get event(){return this._event??(this._event=(e,t,i)=>{var r,s,n,o,a;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],i=new Uf(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return((null==(r=this._options)?void 0:r.onListenerError)||_f)(i),Tf.None}if(this._disposed)return Tf.None;t&&(e=e.bind(t));let l,c=new Kf(e);this._leakageMon&&this._size>=Math.ceil(.2*this._leakageMon.threshold)&&(c.stack=Wf.create(),l=this._leakageMon.check(c.stack,this._size+1)),this._listeners?this._listeners instanceof Kf?(this._deliveryQueue??(this._deliveryQueue=new Gf),this._listeners=[this._listeners,c]):this._listeners.push(c):(null==(n=null==(s=this._options)?void 0:s.onWillAddFirstListener)||n.call(s,this),this._listeners=c,null==(a=null==(o=this._options)?void 0:o.onDidAddFirstListener)||a.call(o,this)),this._size++;let h=Ef(()=>{null==l||l(),this._removeListener(c)});return i instanceof Rf?i.add(h):Array.isArray(i)&&i.push(h),h}),this._event}_removeListener(e){var t,i,r,s;if(null==(i=null==(t=this._options)?void 0:t.onWillRemoveListener)||i.call(t,this),!this._listeners)return;if(1===this._size)return this._listeners=void 0,null==(s=null==(r=this._options)?void 0:r.onDidRemoveLastListener)||s.call(r,this),void(this._size=0);let n=this._listeners,o=n.indexOf(e);if(-1===o)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,n[o]=void 0;let a=this._deliveryQueue.current===this;if(2*this._size<=n.length){let e=0;for(let t=0;t<n.length;t++)n[t]?n[e++]=n[t]:a&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=e}}_deliver(e,t){var i;if(!e)return;let r=(null==(i=this._options)?void 0:i.onListenerError)||_f;if(r)try{e.value(t)}catch(xw){r(xw)}else e.value(t)}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,i,r,s;if((null==(t=this._deliveryQueue)?void 0:t.current)&&(this._deliverQueue(this._deliveryQueue),null==(i=this._perfMon)||i.stop()),null==(r=this._perfMon)||r.start(this._size),this._listeners)if(this._listeners instanceof Kf)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}null==(s=this._perfMon)||s.stop()}hasListeners(){return this._size>0}},Gf=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Yf=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Vf,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Vf,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let i=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(i,e),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let i=this.getWindowId(t);this.mapWindowIdToFullScreen.set(i,e),this._onDidChangeFullscreen.fire(i)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Yf.INSTANCE=new Yf;var Xf=Yf;Xf.INSTANCE.onDidChangeZoomLevel,Xf.INSTANCE.onDidChangeFullscreen;var Zf="object"==typeof navigator?navigator.userAgent:"",Qf=Zf.indexOf("Firefox")>=0,Jf=Zf.indexOf("AppleWebKit")>=0,ep=Zf.indexOf("Chrome")>=0,tp=!ep&&Zf.indexOf("Safari")>=0;Zf.indexOf("Electron/"),Zf.indexOf("Android");var ip=!1;if("function"==typeof Pf.matchMedia){let e=Pf.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Pf.matchMedia("(display-mode: fullscreen)");ip=e.matches,function(e,t,i){"string"==typeof t&&(t=e.matchMedia(t)),t.addEventListener("change",i)}(Pf,e,({matches:e})=>{ip&&t.matches||(ip=e)})}var rp,sp,np="en",op=!1,ap=!1,lp=!1,cp=!1,hp=np,up=globalThis;typeof up.vscode<"u"&&typeof up.vscode.process<"u"?sp=up.vscode.process:typeof process<"u"&&"string"==typeof(null==(e=null==process?void 0:process.versions)?void 0:e.node)&&(sp=process);var dp="string"==typeof(null==(t=null==sp?void 0:sp.versions)?void 0:t.electron)&&"renderer"===(null==sp?void 0:sp.type);if("object"==typeof sp){op="win32"===sp.platform,ap="darwin"===sp.platform,(lp="linux"===sp.platform)&&!!sp.env.SNAP&&sp.env.SNAP_REVISION,!!sp.env.CI||sp.env.BUILD_ARTIFACTSTAGINGDIRECTORY,hp=np;let e=sp.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,hp=t.resolvedLanguage||np,null==(i=t.languagePack)?void 0:i.translationsConfigFile}catch{}cp=!0}else"object"!=typeof navigator||dp?console.error("Unable to resolve platform."):(op=(rp=navigator.userAgent).indexOf("Windows")>=0,ap=rp.indexOf("Macintosh")>=0,(rp.indexOf("Macintosh")>=0||rp.indexOf("iPad")>=0||rp.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints,lp=rp.indexOf("Linux")>=0,null==rp||rp.indexOf("Mobi"),hp=globalThis._VSCODE_NLS_LANGUAGE||np,navigator.language.toLowerCase());var fp,pp,_p=op,gp=ap,mp=lp,vp=cp,bp=rp,yp=hp;(pp=fp||(fp={})).value=function(){return yp},pp.isDefaultVariant=function(){return 2===yp.length?"en"===yp:yp.length>=3&&"e"===yp[0]&&"n"===yp[1]&&"-"===yp[2]},pp.isDefault=function(){return"en"===yp};var Sp="function"==typeof up.postMessage&&!up.importScripts;(()=>{if(Sp){let e=[];up.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let i=0,r=e.length;i<r;i++){let r=e[i];if(r.id===t.data.vscodeScheduleAsyncWork)return e.splice(i,1),void r.callback()}});let t=0;return i=>{let r=++t;e.push({id:r,callback:i}),up.postMessage({vscodeScheduleAsyncWork:r},"*")}}})();var wp=!!(bp&&bp.indexOf("Chrome")>=0);bp&&bp.indexOf("Firefox"),!wp&&bp&&bp.indexOf("Safari"),bp&&bp.indexOf("Edg/"),bp&&bp.indexOf("Android");var xp="object"==typeof navigator?navigator:{};vp||document.queryCommandSupported&&document.queryCommandSupported("copy")||xp&&xp.clipboard&&xp.clipboard.writeText,vp||xp&&xp.clipboard&&xp.clipboard.readText;var Cp,kp,Ep=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Lp=new Ep,Rp=new Ep,Tp=new Ep,Mp=new Array(230);(kp=Cp||(Cp={})).toString=function(e){return Lp.keyCodeToStr(e)},kp.fromString=function(e){return Lp.strToKeyCode(e)},kp.toUserSettingsUS=function(e){return Rp.keyCodeToStr(e)},kp.toUserSettingsGeneral=function(e){return Tp.keyCodeToStr(e)},kp.fromUserSettings=function(e){return Rp.strToKeyCode(e)||Tp.strToKeyCode(e)},kp.toElectronAccelerator=function(e){if(e>=98&&e<=113)return null;switch(e){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Lp.keyCodeToStr(e)};var Pp=class e{constructor(e,t,i,r,s){this.ctrlKey=e,this.shiftKey=t,this.altKey=i,this.metaKey=r,this.keyCode=s}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?"1":"0"}${this.shiftKey?"1":"0"}${this.altKey?"1":"0"}${this.metaKey?"1":"0"}${this.keyCode}`}isModifierKey(){return 0===this.keyCode||5===this.keyCode||57===this.keyCode||6===this.keyCode||4===this.keyCode}toKeybinding(){return new Ap([this])}isDuplicateModifierCase(){return this.ctrlKey&&5===this.keyCode||this.shiftKey&&4===this.keyCode||this.altKey&&6===this.keyCode||this.metaKey&&57===this.keyCode}},Ap=class{constructor(e){if(0===e.length)throw new Error(`Illegal argument: ${"chords"}`);this.chords=e}getHashCode(){let e="";for(let t=0,i=this.chords.length;t<i;t++)0!==t&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(null===e||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};var Dp=gp?256:2048,Np=gp?2048:256,Ip=class{constructor(e){var t;this._standardKeyboardEventBrand=!0;let i=e;this.browserEvent=i,this.target=i.target,this.ctrlKey=i.ctrlKey,this.shiftKey=i.shiftKey,this.altKey=i.altKey,this.metaKey=i.metaKey,this.altGraphKey=null==(t=i.getModifierState)?void 0:t.call(i,"AltGraph"),this.keyCode=function(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return Cp.fromString(t)}let t=e.keyCode;if(3===t)return 7;if(Qf)switch(t){case 59:return 85;case 60:if(mp)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(gp)return 57}else if(Jf){if(gp&&93===t)return 57;if(!gp&&92===t)return 57}return Mp[t]||0}(i),this.code=i.code,this.ctrlKey=this.ctrlKey||5===this.keyCode,this.altKey=this.altKey||6===this.keyCode,this.shiftKey=this.shiftKey||4===this.keyCode,this.metaKey=this.metaKey||57===this.keyCode,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;5!==this.keyCode&&4!==this.keyCode&&6!==this.keyCode&&57!==this.keyCode&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=Dp),this.altKey&&(t|=512),this.shiftKey&&(t|=1024),this.metaKey&&(t|=Np),t|=e,t}_computeKeyCodeChord(){let e=0;return 5!==this.keyCode&&4!==this.keyCode&&6!==this.keyCode&&57!==this.keyCode&&(e=this.keyCode),new Pp(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Bp=new WeakMap;function Op(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,i=e.parent.location;if("null"!==t.origin&&"null"!==i.origin&&t.origin!==i.origin)return null}catch{return null}return e.parent}var Fp,zp=class{static getSameOriginWindowChain(e){let t=Bp.get(e);if(!t){t=[],Bp.set(e,t);let i,r=e;do{i=Op(r),i?t.push({window:new WeakRef(r),iframeElement:r.frameElement||null}):t.push({window:new WeakRef(r),iframeElement:null}),r=i}while(r)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let i=0,r=0,s=this.getSameOriginWindowChain(e);for(let n of s){let e=n.window.deref();if(i+=(null==e?void 0:e.scrollY)??0,r+=(null==e?void 0:e.scrollX)??0,e===t||!n.iframeElement)break;let s=n.iframeElement.getBoundingClientRect();i+=s.top,r+=s.left}return{top:i,left:r}}},jp=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=0===t.button,this.middleButton=1===t.button,this.rightButton=2===t.button,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,"dblclick"===t.type&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,"number"==typeof t.pageX?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let i=zp.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},$p=class{constructor(e,t=0,i=0){var r;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=i,this.deltaX=t;let s=!1;if(ep){let e=navigator.userAgent.match(/Chrome\/(\d+)/);s=(e?parseInt(e[1]):123)<=122}if(e){let t=e,i=e,n=(null==(r=e.view)?void 0:r.devicePixelRatio)||1;if(typeof t.wheelDeltaY<"u")this.deltaY=s?t.wheelDeltaY/(120*n):t.wheelDeltaY/120;else if(typeof i.VERTICAL_AXIS<"u"&&i.axis===i.VERTICAL_AXIS)this.deltaY=-i.detail/3;else if("wheel"===e.type){let t=e;t.deltaMode===t.DOM_DELTA_LINE?this.deltaY=Qf&&!gp?-e.deltaY/3:-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof t.wheelDeltaX<"u")this.deltaX=tp&&_p?-t.wheelDeltaX/120:s?t.wheelDeltaX/(120*n):t.wheelDeltaX/120;else if(typeof i.HORIZONTAL_AXIS<"u"&&i.axis===i.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if("wheel"===e.type){let t=e;t.deltaMode===t.DOM_DELTA_LINE?this.deltaX=Qf&&!gp?-e.deltaX/3:-e.deltaX:this.deltaX=-e.deltaX/40}0===this.deltaY&&0===this.deltaX&&e.wheelDelta&&(this.deltaY=s?e.wheelDelta/(120*n):e.wheelDelta/120)}}preventDefault(){var e;null==(e=this.browserEvent)||e.preventDefault()}stopPropagation(){var e;null==(e=this.browserEvent)||e.stopPropagation()}},Wp=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}});(e=>{e.isCancellationToken=function(t){return t===e.None||t===e.Cancelled||t instanceof qp||!(!t||"object"!=typeof t)&&("boolean"==typeof t.isCancellationRequested&&"function"==typeof t.onCancellationRequested)},e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Df.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Wp})})(Fp||(Fp={}));var Hp,Up,qp=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Wp:(this._emitter||(this._emitter=new Vf),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Kp=class{constructor(e,t){this._isDisposed=!1,this._token=-1,"function"==typeof e&&"number"==typeof t&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){-1!==this._token&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new wf("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new wf("Calling 'setIfNotSet' on a disposed TimeoutTimer");-1===this._token&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},Vp=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;null==(e=this.disposable)||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,i=globalThis){if(this.isDisposed)throw new wf("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=i.setInterval(()=>{e()},t);this.disposable=Ef(()=>{i.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(Up=Hp||(Hp={})).settled=async function(e){let t,i=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||(t=e)})));if(typeof t<"u")throw t;return i},Up.withAsyncBody=function(e){return new Promise(async(t,i)=>{try{await e(t,i)}catch(kp){i(kp)}})};var Gp=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let i of t)e.emitOne(i)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new Vf,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(xw){this.reject(xw)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{for(;;){if(2===this._state)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(1===this._state)return{done:!0,value:void 0};await Df.toPromise(this._onStateChanged.event)}},return:async()=>{var e;return null==(e=this._onReturn)||e.call(this),{done:!0,value:void 0}}}}static map(t,i){return new e(async e=>{for await(let r of t)e.emitOne(i(r))})}map(t){return e.map(this,t)}static filter(t,i){return new e(async e=>{for await(let r of t)i(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let i of e)t.push(i);return t}toPromise(){return e.toPromise(this)}emitOne(e){0===this._state&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){0===this._state&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){0===this._state&&(this._state=1,this._onStateChanged.fire())}reject(e){0===this._state&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Gp.EMPTY=Gp.fromArray([]);var{getWindow:Yp,getWindowId:Xp,onDidRegisterWindow:Zp}=function(){let e=new Map,t={window:Pf,disposables:new Rf};e.set(Pf.vscodeWindowId,t);let i=new Vf,r=new Vf,s=new Vf;return{onDidRegisterWindow:i.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return Tf.None;let n=new Rf,o={window:t,disposables:n.add(new Rf)};return e.set(t.vscodeWindowId,o),n.add(Ef(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),n.add(Jp(t,s_.BEFORE_UNLOAD,()=>{s.fire(t)})),i.fire(o),n},getWindows:()=>e.values(),getWindowsCount:()=>e.size,getWindowId:e=>e.vscodeWindowId,hasWindow:t=>e.has(t),getWindowById:function(i,r){return("number"==typeof i?e.get(i):void 0)??(r?t:void 0)},getWindow(e){var t;let i=e;if(null==(t=null==i?void 0:i.ownerDocument)?void 0:t.defaultView)return i.ownerDocument.defaultView.window;let r=e;return(null==r?void 0:r.view)?r.view.window:Pf},getDocument:e=>Yp(e).document}}(),Qp=class{constructor(e,t,i,r){this._node=e,this._type=t,this._handler=i,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Jp(e,t,i,r){return new Qp(e,t,i,r)}var e_,t_=function(e,t,i,r){return Jp(e,t,i,r)},i_=class extends Vp{constructor(e){super(),this.defaultTarget=e&&Yp(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}},r_=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch($b){_f($b)}}static sort(e,t){return t.priority-e.priority}};!function(){let e=new Map,t=new Map,i=new Map,r=new Map;e_=(s,n,o=0)=>{let a=Xp(s),l=new r_(n,o),c=e.get(a);return c||(c=[],e.set(a,c)),c.push(l),i.get(a)||(i.set(a,!0),s.requestAnimationFrame(()=>(s=>{i.set(s,!1);let n=e.get(s)??[];for(t.set(s,n),e.set(s,[]),r.set(s,!0);n.length>0;)n.sort(r_.sort),n.shift().execute();r.set(s,!1)})(a))),l}}();var s_={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},n_=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=o_(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=o_(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=o_(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=o_(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=o_(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=o_(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=o_(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=o_(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=o_(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=o_(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=o_(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=o_(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=o_(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=o_(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function o_(e){return"number"==typeof e?`${e}px`:e}function a_(e){return new n_(e)}var l_,c_,h_=class{constructor(){this._hooks=new Rf,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let i=this._onStopCallback;this._onStopCallback=null,e&&i&&i(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,i,r,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=s;let n=e;try{e.setPointerCapture(t),this._hooks.add(Ef(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{n=Yp(e)}this._hooks.add(Jp(n,s_.POINTER_MOVE,e=>{e.buttons===i?(e.preventDefault(),this._pointerMoveCallback(e)):this.stopMonitoring(!0)})),this._hooks.add(Jp(n,s_.POINTER_UP,e=>this.stopMonitoring(!0)))}};(c_=l_||(l_={})).Tap="-xterm-gesturetap",c_.Change="-xterm-gesturechange",c_.Start="-xterm-gesturestart",c_.End="-xterm-gesturesend",c_.Contextmenu="-xterm-gesturecontextmenu";var u_=class e extends Tf{constructor(){super(),this.dispatched=!1,this.targets=new If,this.ignoreTargets=new If,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Df.runAndSubscribe(Zp,({window:e,disposables:t})=>{t.add(Jp(e.document,"touchstart",e=>this.onTouchStart(e),{passive:!1})),t.add(Jp(e.document,"touchend",t=>this.onTouchEnd(e,t))),t.add(Jp(e.document,"touchmove",e=>this.onTouchMove(e),{passive:!1}))},{window:Pf,disposables:this._store}))}static addTarget(t){if(!e.isTouchDevice())return Tf.None;return e.INSTANCE||(e.INSTANCE=new e),Ef(e.INSTANCE.targets.push(t))}static ignoreTarget(t){if(!e.isTouchDevice())return Tf.None;return e.INSTANCE||(e.INSTANCE=new e),Ef(e.INSTANCE.ignoreTargets.push(t))}static isTouchDevice(){return"ontouchstart"in Pf||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,r=e.targetTouches.length;i<r;i++){let r=e.targetTouches.item(i);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:t,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[t],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let s=this.newGestureEvent(l_.Start,r.target);s.pageX=r.pageX,s.pageY=r.pageY,this.dispatchEvent(s)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,i){let r=Date.now(),s=Object.keys(this.activeTouches).length;for(let n=0,o=i.changedTouches.length;n<o;n++){let o=i.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn("move of an UNKNOWN touch",o);continue}let a=this.activeTouches[o.identifier],l=Date.now()-a.initialTimeStamp;if(l<e.HOLD_DELAY&&Math.abs(a.initialPageX-xf(a.rollingPageX))<30&&Math.abs(a.initialPageY-xf(a.rollingPageY))<30){let e=this.newGestureEvent(l_.Tap,a.initialTarget);e.pageX=xf(a.rollingPageX),e.pageY=xf(a.rollingPageY),this.dispatchEvent(e)}else if(l>=e.HOLD_DELAY&&Math.abs(a.initialPageX-xf(a.rollingPageX))<30&&Math.abs(a.initialPageY-xf(a.rollingPageY))<30){let e=this.newGestureEvent(l_.Contextmenu,a.initialTarget);e.pageX=xf(a.rollingPageX),e.pageY=xf(a.rollingPageY),this.dispatchEvent(e)}else if(1===s){let e=xf(a.rollingPageX),i=xf(a.rollingPageY),s=xf(a.rollingTimestamps)-a.rollingTimestamps[0],n=e-a.rollingPageX[0],o=i-a.rollingPageY[0],l=[...this.targets].filter(e=>a.initialTarget instanceof Node&&e.contains(a.initialTarget));this.inertia(t,l,r,Math.abs(n)/s,n>0?1:-1,e,Math.abs(o)/s,o>0?1:-1,i)}this.dispatchEvent(this.newGestureEvent(l_.End,a.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,t){let i=document.createEvent("CustomEvent");return i.initEvent(e,!1,!0),i.initialTarget=t,i.tapCount=0,i}dispatchEvent(t){if(t.type===l_.Tap){let i=(new Date).getTime(),r=0;r=i-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=i,t.tapCount=r}else(t.type===l_.Change||t.type===l_.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let i of this.ignoreTargets)if(i.contains(t.initialTarget))return;let e=[];for(let i of this.targets)if(i.contains(t.initialTarget)){let r=0,s=t.initialTarget;for(;s&&s!==i;)r++,s=s.parentElement;e.push([r,i])}e.sort((e,t)=>e[0]-t[0]);for(let[i,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,i,r,s,n,o,a,l,c){this.handle=e_(t,()=>{let h=Date.now(),u=h-r,d=0,f=0,p=!0;s+=e.SCROLL_FRICTION*u,a+=e.SCROLL_FRICTION*u,s>0&&(p=!1,d=n*s*u),a>0&&(p=!1,f=l*a*u);let _=this.newGestureEvent(l_.Change);_.translationX=d,_.translationY=f,i.forEach(e=>e.dispatchEvent(_)),p||this.inertia(t,i,h,s,n,o+d,a,l,c+f)})}onTouchMove(e){let t=Date.now();for(let i=0,r=e.changedTouches.length;i<r;i++){let r=e.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn("end of an UNKNOWN touch",r);continue}let s=this.activeTouches[r.identifier],n=this.newGestureEvent(l_.Change,s.initialTarget);n.translationX=r.pageX-xf(s.rollingPageX),n.translationY=r.pageY-xf(s.rollingPageY),n.pageX=r.pageX,n.pageY=r.pageY,this.dispatchEvent(n),s.rollingPageX.length>3&&(s.rollingPageX.shift(),s.rollingPageY.shift(),s.rollingTimestamps.shift()),s.rollingPageX.push(r.pageX),s.rollingPageY.push(r.pageY),s.rollingTimestamps.push(t)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};u_.SCROLL_FRICTION=-.005,u_.HOLD_DELAY=700,u_.CLEAR_TAP_COUNT_TIME=400,Cd([function(e,t,i){let r=null,s=null;if("function"==typeof i.value?(r="value",s=i.value,0!==s.length&&console.warn("Memoize should only be used in functions with zero parameters")):"function"==typeof i.get&&(r="get",s=i.get),!s)throw new Error("not supported");let n=`$memoize$${t}`;i[r]=function(...e){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,e)}),this[n]}}],u_,"isTouchDevice",1);var d_=u_,f_=class extends Tf{onclick(e,t){this._register(Jp(e,s_.CLICK,i=>t(new jp(Yp(e),i))))}onmousedown(e,t){this._register(Jp(e,s_.MOUSE_DOWN,i=>t(new jp(Yp(e),i))))}onmouseover(e,t){this._register(Jp(e,s_.MOUSE_OVER,i=>t(new jp(Yp(e),i))))}onmouseleave(e,t){this._register(Jp(e,s_.MOUSE_LEAVE,i=>t(new jp(Yp(e),i))))}onkeydown(e,t){this._register(Jp(e,s_.KEY_DOWN,e=>t(new Ip(e))))}onkeyup(e,t){this._register(Jp(e,s_.KEY_UP,e=>t(new Ip(e))))}oninput(e,t){this._register(Jp(e,s_.INPUT,t))}onblur(e,t){this._register(Jp(e,s_.BLUR,t))}onfocus(e,t){this._register(Jp(e,s_.FOCUS,t))}onchange(e,t){this._register(Jp(e,s_.CHANGE,t))}ignoreGesture(e){return d_.ignoreTarget(e)}},p_=class extends f_{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width="11px",this.domNode.style.height="11px",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 h_),this._register(t_(this.bgDomNode,s_.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(t_(this.domNode,s_.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new i_),this._pointerdownScheduleRepeatTimer=this._register(new Kp)}_arrowPointerDown(e){if(!(e.target&&e.target instanceof Element))return;this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Yp(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},__=class e{constructor(e,t,i,r,s,n,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,i|=0,r|=0,s|=0,n|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>i&&(r=i-t),r<0&&(r=0),s<0&&(s=0),o+s>n&&(o=n-s),o<0&&(o=0),this.width=t,this.scrollWidth=i,this.scrollLeft=r,this.height=s,this.scrollHeight=n,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,i){return new e(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let i=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,s=this.scrollLeft!==e.scrollLeft,n=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,a=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:r,scrollLeftChanged:s,heightChanged:n,scrollHeightChanged:o,scrollTopChanged:a}}},g_=class extends Tf{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Vf),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new __(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var i;let r=this._state.withScrollDimensions(e,t);this._setState(r,!!this._smoothScrolling),null==(i=this._smoothScrolling)||i.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(0===this._smoothScrollDuration)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let i,r=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===r.scrollLeft&&this._smoothScrolling.to.scrollTop===r.scrollTop)return;i=t?new b_(this._smoothScrolling.from,r,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,r,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=i}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=b_.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),this._smoothScrolling){if(e.isDone)return this._smoothScrolling.dispose(),void(this._smoothScrolling=null);this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}},m_=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};function v_(e,t){let i=t-e;return function(t){return e+i*function(e){return 1-function(e){return Math.pow(e,3)}(1-e)}(t)}}var b_=class e{constructor(e,t,i,r){this.from=e,this.to=t,this.duration=r,this.startTime=i,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,t,i){if(Math.abs(e-t)>2.5*i){let r,s;return e<t?(r=e+.75*i,s=t-.75*i):(r=e-.75*i,s=t+.75*i),function(e,t,i){return function(r){return r<i?e(r/i):t((r-i)/(1-i))}}(v_(e,r),v_(s,t),.33)}return v_(e,t)}dispose(){null!==this.animationFrameDisposable&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let t=(e-this.startTime)/this.duration;if(t<1){let e=this.scrollLeft(t),i=this.scrollTop(t);return new m_(e,i,!1)}return new m_(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,i,r){return e.start(t,i,r)}static start(t,i,r){r+=10;let s=Date.now()-10;return new e(t,i,s,r)}};var y_=class extends Tf{constructor(e,t,i){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Kp)}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?" fade":"")))}},S_=class extends f_{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 y_(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new h_),this._shouldRender=!0,this.domNode=a_(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(Jp(this.domNode.domNode,s_.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new p_(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,r){this.slider=a_(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),"number"==typeof i&&this.slider.setWidth(i),"number"==typeof r&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Jp(this.slider.domNode,s_.POINTER_DOWN,e=>{0===e.button&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,i=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(e);i<=s&&s<=r?0===e.button&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&"number"==typeof e.offsetX&&"number"==typeof e.offsetY)t=e.offsetX,i=e.offsetY;else{let r=function(e){let t=e.getBoundingClientRect(),i=Yp(e);return{left:t.left+i.scrollX,top:t.top+i.scrollY,width:t.width,height:t.height}}(this.domNode.domNode);t=e.pageX-r.left,i=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),0===e.button&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!(e.target&&e.target instanceof Element))return;let t=this._sliderPointerPosition(e),i=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let s=this._sliderOrthogonalPointerPosition(e),n=Math.abs(s-i);if(_p&&n>140)return void this._setDesiredScrollPositionNow(r.getScrollPosition());let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},w_=class e{constructor(e,t,i,r,s,n){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=s,this._scrollPosition=n,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t&&(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t&&(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t&&(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,i,r,s){let n=Math.max(0,i-e),o=Math.max(0,n-2*t),a=r>0&&r>i;if(!a)return{computedAvailableSize:Math.round(n),computedIsNeeded:a,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let l=Math.round(Math.max(20,Math.floor(i*o/r))),c=(o-l)/(r-i),h=s*c;return{computedAvailableSize:Math.round(n),computedIsNeeded:a,computedSliderSize:Math.round(l),computedSliderRatio:c,computedSliderPosition:Math.round(h)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,i=this._scrollPosition;return t<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},x_=class extends S_{constructor(e,t,i){let r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new w_(t.horizontalHasArrows?t.arrowSize:0,2===t.horizontal?0:t.horizontalScrollbarSize,2===t.vertical?0:t.verticalScrollbarSize,r.width,r.scrollWidth,s.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(2===e.horizontal?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(2===e.vertical?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},C_=class extends S_{constructor(e,t,i){let r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new w_(t.verticalHasArrows?t.arrowSize:0,2===t.vertical?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,s.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(2===e.vertical?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},k_=class{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}},E_=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(-1===this._front&&-1===this._rear)return!1;let e=1,t=0,i=1,r=this._rear;for(;;){let s=r===this._front?e:Math.pow(2,-i);if(e-=s,t+=this._memory[r].score*s,r===this._front)break;r=(this._capacity+r-1)%this._capacity,i++}return t<=.5}acceptStandardWheelEvent(e){if(ep){let i=Yp(e.browserEvent),r=(t=i,Xf.INSTANCE.getZoomFactor(t));this.accept(Date.now(),e.deltaX*r,e.deltaY*r)}else this.accept(Date.now(),e.deltaX,e.deltaY);var t}accept(e,t,i){let r=null,s=new k_(e,t,i);-1===this._front&&-1===this._rear?(this._memory[0]=s,this._front=0,this._rear=0):(r=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]=s),s.score=this._computeScore(s,r)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(i+=.25),t){let r=Math.abs(e.deltaX),s=Math.abs(e.deltaY),n=Math.abs(t.deltaX),o=Math.abs(t.deltaY),a=Math.max(Math.min(r,n),1),l=Math.max(Math.min(s,o),1),c=Math.max(r,n),h=Math.max(s,o);c%a===0&&h%l===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};E_.INSTANCE=new E_;var L_=E_,R_=class extends f_{constructor(e,t,i){super(),this._onScroll=this._register(new Vf),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Vf),this.onWillScroll=this._onWillScroll.event,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,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"&&e.horizontalHasArrows,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,gp&&(t.className+=" mac"),t}(t),this._scrollable=i,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new C_(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new x_(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=a_(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=a_(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=a_(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new Kp),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=kf(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,gp&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new $p(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=kf(this._mouseWheelToDispose),e)){let e=e=>{this._onMouseWheel(new $p(e))};this._mouseWheelToDispose.push(Jp(this._listenOnDomNode,s_.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(e){var t;if(null==(t=e.browserEvent)?void 0:t.defaultPrevented)return;let i=L_.INSTANCE;i.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let t=e.deltaY*this._options.mouseWheelScrollSensitivity,s=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&s+t===0?s=t=0:Math.abs(t)>=Math.abs(s)?s=0:t=0),this._options.flipAxes&&([t,s]=[s,t]);let n=!gp&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||n)&&!s&&(s=t,t=0),e.browserEvent&&e.browserEvent.altKey&&(s*=this._options.fastScrollSensitivity,t*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),a={};if(t){let e=50*t,i=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(a,i)}if(s){let e=50*s,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(a,t)}a=this._scrollable.validateScrollPosition(a),(o.scrollLeft!==a.scrollLeft||o.scrollTop!==a.scrollTop)&&(this._options.mouseWheelSmoothScroll&&i.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(a):this._scrollable.setScrollPositionNow(a),r=!0)}let s=r;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,i=e.scrollLeft>0,r=i?" left":"",s=t?" top":"",n=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${n}${s}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),500)}},T_=class extends R_{constructor(e,t,i){super(e,t,i)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};var M_=class extends Tf{constructor(e,t,i,r,s,n,o,a){super(),this._bufferService=i,this._optionsService=o,this._renderService=a,this._onRequestScrollLines=this._register(new Vf),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let l=this._register(new g_({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>e_(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{l.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new T_(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},l)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(s.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(16&e)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Df.runAndSubscribe(n.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=n.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Ef(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Ef(()=>this._styleElement.remove())),this._register(Df.runAndSubscribe(n.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${n.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${n.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${n.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._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;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:(null==(e=this._optionsService.rawOptions.overviewRuler)?void 0:e.width)||14}}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){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),i=t-this._bufferService.buffer.ydisp;0!==i&&(this._latestYDisp=t,this._onRequestScrollLines.fire(i)),this._isHandlingScroll=!1}};M_=Cd([kd(2,Vd),kd(3,af),kd(4,Gd),kd(5,df),kd(6,Jd),kd(7,cf)],M_);var P_=class extends Tf{constructor(e,t,i,r,s){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=i,this._decorationService=r,this._renderService=s,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(Ef(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){void 0===this._animationFrame&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var t;let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer","top"===(null==(t=null==e?void 0:e.options)?void 0:t.layer)),i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(e,i),i}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let i=this._decorationElements.get(e);i||(i=this._createElement(e),e.element=i,this._decorationElements.set(e,i),this._container.appendChild(i),e.onDispose(()=>{this._decorationElements.delete(e),i.remove()})),i.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=t*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(i)}}_refreshXPosition(e,t=e.element){if(!t)return;let i=e.options.x??0;"right"===(e.options.anchor||"left")?t.style.right=i?i*this._renderService.dimensions.css.cell.width+"px":"":t.style.left=i?i*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(e){var t;null==(t=this._decorationElements.get(e))||t.remove(),this._decorationElements.delete(e),e.dispose()}};P_=Cd([kd(1,Vd),kd(2,af),kd(3,rf),kd(4,cf)],P_);var A_,D_,N_,I_,B_,O_=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position))return void this._addLineToZone(t,e.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,i){return t>=e.startBufferLine-this._linePadding[i||"full"]&&t<=e.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},F_={full:0,left:0,center:0,right:0},z_={full:0,left:0,center:0,right:0},j_={full:0,left:0,center:0,right:0},$_=class extends Tf{constructor(e,t,i,r,s,n,o,a){var l;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=r,this._renderService=s,this._optionsService=n,this._themeService=o,this._coreBrowserService=a,this._colorZoneStore=new O_,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(Ef(()=>{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.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return(null==(e=this._optionsService.options.overviewRuler)?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);z_.full=this._canvas.width,z_.left=e,z_.center=t,z_.right=e,this._refreshDrawHeightConstants(),j_.full=1,j_.left=1,j_.center=1+z_.left,j_.right=1+z_.left+z_.center}_refreshDrawHeightConstants(){F_.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);F_.left=t,F_.center=t,F_.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*F_.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*F_.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*F_.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*F_.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)"full"!==t.position&&this._renderColorZone(t);for(let t of e)"full"===t.position&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(j_[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-F_[e.position||"full"]/2),z_[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+F_[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,void 0===this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};$_=Cd([kd(2,Vd),kd(3,rf),kd(4,cf),kd(5,Jd),kd(6,df),kd(7,af)],$_),(D_=A_||(A_={})).NUL="\0",D_.SOH="",D_.STX="",D_.ETX="",D_.EOT="",D_.ENQ="",D_.ACK="",D_.BEL="",D_.BS="\b",D_.HT="\t",D_.LF="\n",D_.VT="\v",D_.FF="\f",D_.CR="\r",D_.SO="",D_.SI="",D_.DLE="",D_.DC1="",D_.DC2="",D_.DC3="",D_.DC4="",D_.NAK="",D_.SYN="",D_.ETB="",D_.CAN="",D_.EM="",D_.SUB="",D_.ESC="",D_.FS="",D_.GS="",D_.RS="",D_.US="",D_.SP=" ",D_.DEL="",(I_=N_||(N_={})).PAD="€",I_.HOP="",I_.BPH="‚",I_.NBH="ƒ",I_.IND="„",I_.NEL="…",I_.SSA="†",I_.ESA="‡",I_.HTS="ˆ",I_.HTJ="‰",I_.VTS="Š",I_.PLD="‹",I_.PLU="Œ",I_.RI="",I_.SS2="Ž",I_.SS3="",I_.DCS="",I_.PU1="‘",I_.PU2="’",I_.STS="“",I_.CCH="”",I_.MW="•",I_.SPA="–",I_.EPA="—",I_.SOS="˜",I_.SGCI="™",I_.SCI="š",I_.CSI="›",I_.ST="œ",I_.OSC="",I_.PM="ž",I_.APC="Ÿ",(B_||(B_={})).ST=`${A_.ESC}\\`;var W_=class{constructor(e,t,i,r,s,n){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=r,this._coreService=s,this._renderService=n,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(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};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let t;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,i=t.replace(e,"");this._dataAlreadySent=i,t.length>e.length?this._coreService.triggerDataEvent(i,!0):t.length<e.length?this._coreService.triggerDataEvent(`${A_.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=t+"px",this._compositionView.style.lineHeight=t+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let s=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(s.width,1)+"px",this._textarea.style.height=Math.max(s.height,1)+"px",this._textarea.style.lineHeight=s.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};W_=Cd([kd(2,Vd),kd(3,Jd),kd(4,Yd),kd(5,cf)],W_);var H_,U_,q_,K_,V_,G_=0,Y_=0,X_=0,Z_=0,Q_={css:"#00000000",rgba:0};function J_(e){let t=e.toString(16);return t.length<2?"0"+t:t}function eg(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}(e=>{e.toCss=function(e,t,i,r){return void 0!==r?`#${J_(e)}${J_(t)}${J_(i)}${J_(r)}`:`#${J_(e)}${J_(t)}${J_(i)}`},e.toRgba=function(e,t,i,r=255){return(e<<24|t<<16|i<<8|r)>>>0},e.toColor=function(t,i,r,s){return{css:e.toCss(t,i,r,s),rgba:e.toRgba(t,i,r,s)}}})(H_||(H_={})),(e=>{function t(e,t){return Z_=Math.round(255*t),[G_,Y_,X_]=V_.toChannels(e.rgba),{css:H_.toCss(G_,Y_,X_,Z_),rgba:H_.toRgba(G_,Y_,X_,Z_)}}e.blend=function(e,t){if(1===(Z_=(255&t.rgba)/255))return{css:t.css,rgba:t.rgba};let i=t.rgba>>24&255,r=t.rgba>>16&255,s=t.rgba>>8&255,n=e.rgba>>24&255,o=e.rgba>>16&255,a=e.rgba>>8&255;return G_=n+Math.round((i-n)*Z_),Y_=o+Math.round((r-o)*Z_),X_=a+Math.round((s-a)*Z_),{css:H_.toCss(G_,Y_,X_),rgba:H_.toRgba(G_,Y_,X_)}},e.isOpaque=function(e){return!(255&~e.rgba)},e.ensureContrastRatio=function(e,t,i){let r=V_.ensureContrastRatio(e.rgba,t.rgba,i);if(r)return H_.toColor(r>>24&255,r>>16&255,r>>8&255)},e.opaque=function(e){let t=(255|e.rgba)>>>0;return[G_,Y_,X_]=V_.toChannels(t),{css:H_.toCss(G_,Y_,X_),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,i){return t(e,(Z_=255&e.rgba)*i/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}})(U_||(U_={})),(e=>{let t,i;try{let e=document.createElement("canvas");e.width=1,e.height=1;let r=e.getContext("2d",{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return G_=parseInt(e.slice(1,2).repeat(2),16),Y_=parseInt(e.slice(2,3).repeat(2),16),X_=parseInt(e.slice(3,4).repeat(2),16),H_.toColor(G_,Y_,X_);case 5:return G_=parseInt(e.slice(1,2).repeat(2),16),Y_=parseInt(e.slice(2,3).repeat(2),16),X_=parseInt(e.slice(3,4).repeat(2),16),Z_=parseInt(e.slice(4,5).repeat(2),16),H_.toColor(G_,Y_,X_,Z_);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 r=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(r)return G_=parseInt(r[1]),Y_=parseInt(r[2]),X_=parseInt(r[3]),Z_=Math.round(255*(void 0===r[5]?1:parseFloat(r[5]))),H_.toColor(G_,Y_,X_,Z_);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=e,"string"!=typeof t.fillStyle)throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[G_,Y_,X_,Z_]=t.getImageData(0,0,1,1).data,255!==Z_)throw new Error("css.toColor: Unsupported css format");return{rgba:H_.toRgba(G_,Y_,X_,Z_),css:e}}})(q_||(q_={})),(e=>{function t(e,t,i){let r=e/255,s=t/255,n=i/255;return.2126*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.7152*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t})(K_||(K_={})),(e=>{function t(e,t,i){let r=e>>24&255,s=e>>16&255,n=e>>8&255,o=t>>24&255,a=t>>16&255,l=t>>8&255,c=eg(K_.relativeLuminance2(o,a,l),K_.relativeLuminance2(r,s,n));for(;c<i&&(o>0||a>0||l>0);)o-=Math.max(0,Math.ceil(.1*o)),a-=Math.max(0,Math.ceil(.1*a)),l-=Math.max(0,Math.ceil(.1*l)),c=eg(K_.relativeLuminance2(o,a,l),K_.relativeLuminance2(r,s,n));return(o<<24|a<<16|l<<8|255)>>>0}function i(e,t,i){let r=e>>24&255,s=e>>16&255,n=e>>8&255,o=t>>24&255,a=t>>16&255,l=t>>8&255,c=eg(K_.relativeLuminance2(o,a,l),K_.relativeLuminance2(r,s,n));for(;c<i&&(o<255||a<255||l<255);)o=Math.min(255,o+Math.ceil(.1*(255-o))),a=Math.min(255,a+Math.ceil(.1*(255-a))),l=Math.min(255,l+Math.ceil(.1*(255-l))),c=eg(K_.relativeLuminance2(o,a,l),K_.relativeLuminance2(r,s,n));return(o<<24|a<<16|l<<8|255)>>>0}e.blend=function(e,t){if(1===(Z_=(255&t)/255))return t;let i=t>>24&255,r=t>>16&255,s=t>>8&255,n=e>>24&255,o=e>>16&255,a=e>>8&255;return G_=n+Math.round((i-n)*Z_),Y_=o+Math.round((r-o)*Z_),X_=a+Math.round((s-a)*Z_),H_.toRgba(G_,Y_,X_)},e.ensureContrastRatio=function(e,r,s){let n=K_.relativeLuminance(e>>8),o=K_.relativeLuminance(r>>8);if(eg(n,o)<s){if(o<n){let o=t(e,r,s),a=eg(n,K_.relativeLuminance(o>>8));if(a<s){let t=i(e,r,s);return a>eg(n,K_.relativeLuminance(t>>8))?o:t}return o}let a=i(e,r,s),l=eg(n,K_.relativeLuminance(a>>8));if(l<s){let i=t(e,r,s);return l>eg(n,K_.relativeLuminance(i>>8))?a:i}return a}},e.reduceLuminance=t,e.increaseLuminance=i,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}})(V_||(V_={}));var tg=class extends jd{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ig=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Wd}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(0===this._characterJoiners.length)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||0===t.length)return[];let i=[],r=t.translateToString(!0),s=0,n=0,o=0,a=t.getFg(0),l=t.getBg(0);for(let c=0;c<t.getTrimmedLength();c++)if(t.loadCell(c,this._workCell),0!==this._workCell.getWidth()){if(this._workCell.fg!==a||this._workCell.bg!==l){if(c-s>1){let e=this._getJoinedRanges(r,o,n,t,s);for(let t=0;t<e.length;t++)i.push(e[t])}s=c,o=n,a=this._workCell.fg,l=this._workCell.bg}n+=this._workCell.getChars().length||1}if(this._bufferService.cols-s>1){let e=this._getJoinedRanges(r,o,n,t,s);for(let t=0;t<e.length;t++)i.push(e[t])}return i}_getJoinedRanges(e,t,i,r,s){let n=e.substring(t,i),o=[];try{o=this._characterJoiners[0].handler(n)}catch(vt){console.error(vt)}for(let l=1;l<this._characterJoiners.length;l++)try{let e=this._characterJoiners[l].handler(n);for(let t=0;t<e.length;t++)ig._mergeRanges(o,e[t])}catch(a){console.error(a)}return this._stringRangesToCellRanges(o,r,s),o}_stringRangesToCellRanges(e,t,i){let r=0,s=!1,n=0,o=e[r];if(o){for(let a=i;a<this._bufferService.cols;a++){let i=t.getWidth(a),l=t.getString(a).length||1;if(0!==i){if(!s&&o[0]<=n&&(o[0]=a,s=!0),o[1]<=n){if(o[1]=a,o=e[++r],!o)break;o[0]<=n?(o[0]=a,s=!0):s=!1}n+=l}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let i=!1;for(let r=0;r<e.length;r++){let s=e[r];if(i){if(t[1]<=s[0])return e[r-1][1]=t[1],e;if(t[1]<=s[1])return e[r-1][1]=Math.max(t[1],s[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=s[0])return e.splice(r,0,t),e;if(t[1]<=s[1])return s[0]=Math.min(t[0],s[0]),e;t[0]<s[1]&&(s[0]=Math.min(t[0],s[0]),i=!0)}}return i?e[e.length-1][1]=t[1]:e.push(t),e}};ig=Cd([kd(0,Vd)],ig);var rg=class{constructor(e,t,i,r,s,n,o){this._document=e,this._characterJoinerService=t,this._optionsService=i,this._coreBrowserService=r,this._coreService=s,this._decorationService=n,this._themeService=o,this._workCell=new Wd,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,i){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=i}createRow(e,t,i,r,s,n,o,a,l,c,h){let u=[],d=this._characterJoinerService.getJoinedCharacters(t),f=this._themeService.colors,p=e.getNoBgTrimmedLength();i&&p<n+1&&(p=n+1);let _,g=0,m="",v=0,b=0,y=0,S=0,w=!1,x=0,C=!1,k=0,E=0,L=[],R=-1!==c&&-1!==h;for(let T=0;T<p;T++){e.loadCell(T,this._workCell);let p=this._workCell.getWidth();if(0===p)continue;let M=!1,P=T>=E,A=T,D=this._workCell;if(d.length>0&&T===d[0][0]&&P){let r=d.shift(),s=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)P&&(P=s===this._isCellInSelection(v,t));P&&(P=!i||n<r[0]||n>=r[1]),P?(M=!0,D=new tg(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),A=r[1]-1,p=D.getWidth()):E=r[1]}let N=this._isCellInSelection(T,t),I=i&&T===n,B=R&&T>=c&&T<=h,O=!1;this._decorationService.forEachDecorationAtCell(T,t,void 0,e=>{O=!0});let F=D.getChars()||zd;if(" "===F&&(D.isUnderline()||D.isOverline())&&(F=" "),k=p*a-l.get(F,D.isBold(),D.isItalic()),_){if(g&&(N&&C||!N&&!C&&D.bg===b)&&(N&&C&&f.selectionForeground||D.fg===y)&&D.extended.ext===S&&B===w&&k===x&&!I&&!M&&!O&&P){D.isInvisible()?m+=zd:m+=F,g++;continue}g&&(_.textContent=m),_=this._document.createElement("span"),g=0,m=""}else _=this._document.createElement("span");if(b=D.bg,y=D.fg,S=D.extended.ext,w=B,x=k,C=N,M&&n>=T&&n<=A&&(n=T),!this._coreService.isCursorHidden&&I&&this._coreService.isCursorInitialized)if(L.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&L.push("xterm-cursor-blink"),L.push("bar"===r?"xterm-cursor-bar":"underline"===r?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":L.push("xterm-cursor-outline");break;case"block":L.push("xterm-cursor-block");break;case"bar":L.push("xterm-cursor-bar");break;case"underline":L.push("xterm-cursor-underline")}if(D.isBold()&&L.push("xterm-bold"),D.isItalic()&&L.push("xterm-italic"),D.isDim()&&L.push("xterm-dim"),m=D.isInvisible()?zd:D.getChars()||zd,D.isUnderline()&&(L.push(`xterm-underline-${D.extended.underlineStyle}`)," "===m&&(m=" "),!D.isUnderlineColorDefault()))if(D.isUnderlineColorRGB())_.style.textDecorationColor=`rgb(${jd.toColorRGB(D.getUnderlineColor()).join(",")})`;else{let e=D.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&D.isBold()&&e<8&&(e+=8),_.style.textDecorationColor=f.ansi[e].css}D.isOverline()&&(L.push("xterm-overline")," "===m&&(m=" ")),D.isStrikethrough()&&L.push("xterm-strikethrough"),B&&(_.style.textDecoration="underline");let z=D.getFgColor(),j=D.getFgColorMode(),$=D.getBgColor(),W=D.getBgColorMode(),H=!!D.isInverse();if(H){let e=z;z=$,$=e;let t=j;j=W,W=t}let U,q,K,V=!1;switch(this._decorationService.forEachDecorationAtCell(T,t,void 0,e=>{"top"!==e.options.layer&&V||(e.backgroundColorRGB&&(W=50331648,$=e.backgroundColorRGB.rgba>>8&16777215,U=e.backgroundColorRGB),e.foregroundColorRGB&&(j=50331648,z=e.foregroundColorRGB.rgba>>8&16777215,q=e.foregroundColorRGB),V="top"===e.options.layer)}),!V&&N&&(U=this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque,$=U.rgba>>8&16777215,W=50331648,V=!0,f.selectionForeground&&(j=50331648,z=f.selectionForeground.rgba>>8&16777215,q=f.selectionForeground)),V&&L.push("xterm-decoration-top"),W){case 16777216:case 33554432:K=f.ansi[$],L.push(`xterm-bg-${$}`);break;case 50331648:K=H_.toColor($>>16,$>>8&255,255&$),this._addStyle(_,`background-color:#${sg(($>>>0).toString(16),"0",6)}`);break;default:H?(K=f.foreground,L.push("xterm-bg-257")):K=f.background}switch(U||D.isDim()&&(U=U_.multiplyOpacity(K,.5)),j){case 16777216:case 33554432:D.isBold()&&z<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(z+=8),this._applyMinimumContrast(_,K,f.ansi[z],D,U,void 0)||L.push(`xterm-fg-${z}`);break;case 50331648:let e=H_.toColor(z>>16&255,z>>8&255,255&z);this._applyMinimumContrast(_,K,e,D,U,q)||this._addStyle(_,`color:#${sg(z.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(_,K,f.foreground,D,U,q)||H&&L.push("xterm-fg-257")}L.length&&(_.className=L.join(" "),L.length=0),I||M||O||!P?_.textContent=m:g++,k!==this.defaultSpacing&&(_.style.letterSpacing=`${k}px`),u.push(_),T=A}return _&&g&&(_.textContent=m),u}_applyMinimumContrast(e,t,i,r,s,n){if(1===this._optionsService.rawOptions.minimumContrastRatio||(function(e){return 57508<=e&&e<=57558}(o=r.getCode())||function(e){return 9472<=e&&e<=9631}(o)))return!1;var o;let a,l=this._getContrastCache(r);if(!s&&!n&&(a=l.getColor(t.rgba,i.rgba)),void 0===a){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);a=U_.ensureContrastRatio(s||t,n||i,e),l.setColor((s||t).rgba,(n||i).rgba,a??null)}return!!a&&(this._addStyle(e,`color:${a.css}`),!0)}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let i=this._selectionStart,r=this._selectionEnd;return!(!i||!r)&&(this._columnSelectMode?i[0]<=r[0]?e>=i[0]&&t>=i[1]&&e<r[0]&&t<=r[1]:e<i[0]&&t>=i[1]&&e>=r[0]&&t<=r[1]:t>i[1]&&t<r[1]||i[1]===r[1]&&t===i[1]&&e>=i[0]&&e<r[0]||i[1]<r[1]&&t===r[1]&&e<r[0]||i[1]<r[1]&&t===i[1]&&e>=i[0])}};function sg(e,t,i){for(;e.length<i;)e=t+e;return e}rg=Cd([kd(1,uf),kd(2,Jd),kd(3,af),kd(4,Yd),kd(5,rf),kd(6,df)],rg);var ng=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let i=e.createElement("span");i.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontStyle="italic";let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold",n.style.fontStyle="italic",this._measureElements=[i,r,s,n],this._container.appendChild(i),this._container.appendChild(r),this._container.appendChild(s),this._container.appendChild(n),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,i,r){e===this._font&&t===this._fontSize&&i===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${i}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${i}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,i){let r=0;if(!t&&!i&&1===e.length&&(r=e.charCodeAt(0))<256){if(-9999!==this._flat[r])return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let s=e;t&&(s+="B"),i&&(s+="I");let n=this._holey.get(s);if(void 0===n){let r=0;t&&(r|=1),i&&(r|=2),n=this._measure(e,r),n>0&&this._holey.set(s,n)}return n}_measure(e,t){let i=this._measureElements[t];return i.textContent=e.repeat(32),i.offsetWidth/32}},og=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,i,r=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1])return void this.clear();let s=e.buffers.active.ydisp,n=t[1]-s,o=i[1]-s,a=Math.max(n,0),l=Math.min(o,e.rows-1);a>=e.rows||l<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=l,this.startCol=t[0],this.endCol=i[0])}isCellSelected(e,t,i){return!!this.hasSelection&&(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol)}};var ag="xterm-dom-renderer-owner-",lg="xterm-rows",cg="xterm-fg-",hg="xterm-bg-",ug="xterm-focus",dg="xterm-selection",fg=1,pg=class extends Tf{constructor(e,t,i,r,s,n,o,a,l,c,h,u,d,f){super(),this._terminal=e,this._document=t,this._element=i,this._screenElement=r,this._viewportElement=s,this._helperContainer=n,this._linkifier2=o,this._charSizeService=l,this._optionsService=c,this._bufferService=h,this._coreService=u,this._coreBrowserService=d,this._themeService=f,this._terminalClass=fg++,this._rowElements=[],this._selectionRenderModel=new og,this.onRequestRedraw=this._register(new Vf).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(lg),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(dg),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(rg,document),this._element.classList.add(ag+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._register(Ef(()=>{this._element.classList.remove(ag+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new ng(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let i of this._rowElements)i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${lg} 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} .${lg} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${lg} .xterm-dim { color: ${U_.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let i=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,s=`blink_block_${this._terminalClass}`;t+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${s} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${lg}.${ug} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${lg}.${ug} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${lg}.${ug} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${lg} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${lg} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${lg} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${lg} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${lg} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${dg} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${dg} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${dg} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,o]of e.ansi.entries())t+=`${this._terminalSelector} .${cg}${n} { color: ${o.css}; }${this._terminalSelector} .${cg}${n}.xterm-dim { color: ${U_.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${hg}${n} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${cg}257 { color: ${U_.opaque(e.background).css}; }${this._terminalSelector} .${cg}257.xterm-dim { color: ${U_.multiplyOpacity(U_.opaque(e.background),.5).css}; }${this._terminalSelector} .${hg}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let i=this._rowElements.length;i<=t;i++){let e=this._document.createElement("div");this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(ug),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(ug),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,i){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,i),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,i),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,s=this._selectionRenderModel.viewportEndRow,n=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,a=this._document.createDocumentFragment();if(i){let i=e[0]>t[0];a.appendChild(this._createSelectionElement(n,i?t[0]:e[0],i?e[0]:t[0],o-n+1))}else{let i=r===n?e[0]:0,l=n===s?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(n,i,l));let c=o-n-1;if(a.appendChild(this._createSelectionElement(n+1,0,this._bufferService.cols,c)),n!==o){let e=s===o?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(a)}_createSelectionElement(e,t,i,r=1){let s=this._document.createElement("div"),n=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(i-t);return n+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-n),s.style.height=r*this.dimensions.css.cell.height+"px",s.style.top=e*this.dimensions.css.cell.height+"px",s.style.left=`${n}px`,s.style.width=`${o}px`,s}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let i=this._bufferService.buffer,r=i.ybase+i.y,s=Math.min(i.x,this._bufferService.cols-1),n=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let l=e;l<=t;l++){let e=l+i.ydisp,t=this._rowElements[l],c=i.lines.get(e);if(!t||!c)break;t.replaceChildren(...this._rowFactory.createRow(c,e,e===r,o,a,s,n,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${ag}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,i,r,s,n){i<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;i=Math.max(Math.min(i,o),0),r=Math.max(Math.min(r,o),0),s=Math.min(s,this._bufferService.cols);let a=this._bufferService.buffer,l=a.ybase+a.y,c=Math.min(a.x,s-1),h=this._optionsService.rawOptions.cursorBlink,u=this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=i;f<=r;++f){let o=f+a.ydisp,p=this._rowElements[f],_=a.lines.get(o);if(!p||!_)break;p.replaceChildren(...this._rowFactory.createRow(_,o,o===l,u,d,c,h,this.dimensions.css.cell.width,this._widthCache,n?f===i?e:0:-1,n?(f===r?t:s)-1:-1))}}};pg=Cd([kd(7,Zd),kd(8,of),kd(9,Jd),kd(10,Vd),kd(11,Yd),kd(12,af),kd(13,df)],pg);var _g=class extends Tf{constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Vf),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new vg(this._optionsService))}catch{this._measureStrategy=this._register(new mg(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())}};_g=Cd([kd(2,Jd)],_g);var gg=class extends Tf{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)}},mg=class extends gg{constructor(e,t,i){super(),this._document=e,this._parentElement=t,this._optionsService=i,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},vg=class extends gg{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}},bg=class extends Tf{constructor(e,t,i){super(),this._textarea=e,this._window=t,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new yg(this._window)),this._onDprChange=this._register(new Vf),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Vf),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(Df.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Jp(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Jp(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}},yg=class extends Tf{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Mf),this._onDprChange=this._register(new Vf),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Ef(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Jp(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)}},Sg=class extends Tf{constructor(){super(),this.linkProviders=[],this._register(Ef(()=>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 wg(e,t,i){let r=i.getBoundingClientRect(),s=e.getComputedStyle(i),n=parseInt(s.getPropertyValue("padding-left")),o=parseInt(s.getPropertyValue("padding-top"));return[t.clientX-r.left-n,t.clientY-r.top-o]}var xg=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,r,s){return function(e,t,i,r,s,n,o,a,l){if(!n)return;let c=wg(e,t,i);return c?(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),r+(l?1:0)),c[1]=Math.min(Math.max(c[1],1),s),c):void 0}(window,e,t,i,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(e,t){let i=wg(window,e,t);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};xg=Cd([kd(0,cf),kd(1,of)],xg);var Cg=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,i){this._rowCount=i,e=void 0!==e?e:0,t=void 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,!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=[]}},kg={};((e,t)=>{for(var i in t)wd(e,i,{get:t[i],enumerable:!0})})(kg,{getSafariVersion:()=>Ag,isChromeOS:()=>Fg,isFirefox:()=>Tg,isIpad:()=>Ng,isIphone:()=>Ig,isLegacyEdge:()=>Mg,isLinux:()=>Og,isMac:()=>Dg,isNode:()=>Eg,isSafari:()=>Pg,isWindows:()=>Bg});var Eg=typeof process<"u"&&"title"in process,Lg=Eg?"node":navigator.userAgent,Rg=Eg?"node":navigator.platform,Tg=Lg.includes("Firefox"),Mg=Lg.includes("Edge"),Pg=/^((?!chrome|android).)*safari/i.test(Lg);function Ag(){if(!Pg)return 0;let e=Lg.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1])}var Dg=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Rg),Ng="iPad"===Rg,Ig="iPhone"===Rg,Bg=["Windows","Win16","Win32","WinCE"].includes(Rg),Og=Rg.indexOf("Linux")>=0,Fg=/\bCrOS\b/.test(Lg),zg=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,i=0,r=e.timeRemaining(),s=0;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 r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),void this._start();r=s}this.clear()}},jg=!Eg&&"requestIdleCallback"in window?class extends zg{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:class extends zg{_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())}}},$g=class{constructor(){this._queue=new jg}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Wg=class extends Tf{constructor(e,t,i,r,s,n,o,a,l){super(),this._rowCount=e,this._optionsService=i,this._charSizeService=r,this._coreService=s,this._coreBrowserService=a,this._renderer=this._register(new Mf),this._pausedResizeTask=new $g,this._observerDisposable=this._register(new Mf),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 Vf),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Vf),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Vf),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Vf),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Cg((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Hg(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Ef(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.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(n.onDecorationRegistered(()=>this._fullRefresh())),this._register(n.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(l.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let i=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});i.observe(t),this._observerDisposable.value=Ef(()=>i.disconnect())}}_handleIntersectionChange(e){this._isPaused=void 0===e.isIntersecting?0===e.intersectionRatio:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,i=!1){if(this._isPaused)return void(this._needsFullRefresh=!0);if(this._coreService.decPrivateModes.synchronizedOutput)return void this._syncOutputHandler.bufferRows(e,t);let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),i||(this._isNextRenderRedrawOnly=!1),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,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&(null==(t=(e=this._renderer.value).clearTextureAtlas)||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var i;return null==(i=this._renderer.value)?void 0:i.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;null==(e=this._renderer.value)||e.handleCharSizeChanged()}handleBlur(){var e;null==(e=this._renderer.value)||e.handleBlur()}handleFocus(){var e;null==(e=this._renderer.value)||e.handleFocus()}handleSelectionChanged(e,t,i){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,null==(r=this._renderer.value)||r.handleSelectionChanged(e,t,i)}handleCursorMove(){var e;null==(e=this._renderer.value)||e.handleCursorMove()}clear(){var e;null==(e=this._renderer.value)||e.clear()}};Wg=Cd([kd(2,Jd),kd(3,of),kd(4,Yd),kd(5,rf),kd(6,Vd),kd(7,af),kd(8,df)],Wg);var Hg=class{constructor(e,t,i){this._coreBrowserService=e,this._coreService=t,this._onTimeout=i,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),void 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 Ug(e,t,i,r){let s,n=i.buffer.x,o=i.buffer.y;if(!i.buffer.hasScrollback)return function(e,t,i,r,s,n){return 0===qg(t,r,s,n).length?"":Xg(Gg(e,t,e,t-Kg(t,s),!1,s).length,Yg("D",n))}(n,o,0,t,i,r)+qg(o,t,i,r)+function(e,t,i,r,s,n){let o;o=qg(t,r,s,n).length>0?r-Kg(r,s):t;let a=r,l=function(e,t,i,r,s,n){let o;return o=qg(i,r,s,n).length>0?r-Kg(r,s):t,e<i&&o<=r||e>=i&&o<r?"C":"D"}(e,t,i,r,s,n);return Xg(Gg(e,o,i,a,"C"===l,s).length,Yg(l,n))}(n,o,e,t,i,r);if(o===t)return s=n>e?"D":"C",Xg(Math.abs(n-e),Yg(s,r));s=o>t?"D":"C";let a=Math.abs(o-t),l=function(e,t){return t.cols-e}(o>t?e:n,i)+(a-1)*i.cols+1+function(e){return e-1}(o>t?n:e);return Xg(l,Yg(s,r))}function qg(e,t,i,r){let s=e-Kg(e,i),n=t-Kg(t,i),o=Math.abs(s-n)-function(e,t,i){var r;let s=0,n=e-Kg(e,i),o=t-Kg(t,i);for(let a=0;a<Math.abs(n-o);a++){let o="A"===Vg(e,t)?-1:1;(null==(r=i.buffer.lines.get(n+o*a))?void 0:r.isWrapped)&&s++}return s}(e,t,i);return Xg(o,Yg(Vg(e,t),r))}function Kg(e,t){let i=0,r=t.buffer.lines.get(e),s=null==r?void 0:r.isWrapped;for(;s&&e>=0&&e<t.rows;)i++,r=t.buffer.lines.get(--e),s=null==r?void 0:r.isWrapped;return i}function Vg(e,t){return e>t?"A":"B"}function Gg(e,t,i,r,s,n){let o=e,a=t,l="";for(;(o!==i||a!==r)&&a>=0&&a<n.buffer.lines.length;)o+=s?1:-1,s&&o>n.cols-1?(l+=n.buffer.translateBufferLineToString(a,!1,e,o),o=0,e=0,a++):!s&&o<0&&(l+=n.buffer.translateBufferLineToString(a,!1,0,e+1),o=n.cols-1,e=o,a--);return l+n.buffer.translateBufferLineToString(a,!1,e,o)}function Yg(e,t){let i=t?"O":"[";return A_.ESC+i+e}function Xg(e,t){e=Math.floor(e);let i="";for(let r=0;r<e;r++)i+=t;return i}var Zg=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[1]=0),!1)}};function Qg(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 Jg=new RegExp(" ","g"),em=class extends Tf{constructor(e,t,i,r,s,n,o,a,l){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=r,this._coreService=s,this._mouseService=n,this._optionsService=o,this._renderService=a,this._coreBrowserService=l,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Wd,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Vf),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Vf),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Vf),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Vf),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=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new Zg(this._bufferService),this._activeSelectionMode=0,this._register(Ef(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t)&&(e[0]!==t[0]||e[1]!==t[1])}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let i=this._bufferService.buffer,r=[];if(3===this._activeSelectionMode){if(e[0]===t[0])return"";let s=e[0]<t[0]?e[0]:t[0],n=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=i.translateBufferLineToString(o,!0,s,n);r.push(e)}}else{let s=e[1]===t[1]?t[0]:void 0;r.push(i.translateBufferLineToString(e[1],!0,e[0],s));for(let n=e[1]+1;n<=t[1]-1;n++){let e=i.lines.get(n),t=i.translateBufferLineToString(n,!0);(null==e?void 0:e.isWrapped)?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=i.lines.get(t[1]),s=i.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=s:r.push(s)}}return r.map(e=>e.replace(Jg," ")).join(Bg?"\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())),Og&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:3===this._activeSelectionMode})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),i=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!!(i&&r&&t)&&this._areCoordsInSelection(t,i,r)}isCellInSelection(e,t){let i=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!(!i||!r)&&this._areCoordsInSelection([e,t],i,r)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]<i[1]||t[1]===i[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<i[0]||t[1]<i[1]&&e[1]===i[1]&&e[0]<i[0]||t[1]<i[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var i,r;let s=null==(r=null==(i=this._linkifier.currentLink)?void 0:i.link)?void 0:r.range;if(s)return this._model.selectionStart=[s.start.x-1,s.start.y-1],this._model.selectionStartLength=Qg(s,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let n=this._getMouseBufferCoords(e);return!!n&&(this._selectWordAt(n,t),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=wg(this._coreBrowserService.window,e,this._screenElement)[1],i=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-50),50),t/=50,t/Math.abs(t)+Math.round(14*t))}shouldForceSelection(e){return Dg?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,(2!==e.button||!this.hasSelection)&&0===e.button){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){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&0===t.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 e.altKey&&!(Dg&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd)return void this.refresh(!0);2===this._activeSelectionMode?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:1===this._activeSelectionMode&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),3!==this._activeSelectionMode&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let i=this._bufferService.buffer;if(this._model.selectionEnd[1]<i.lines.length){let e=i.lines.get(this._model.selectionEnd[1]);e&&0===e.hasWidth(this._model.selectionEnd[0])&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,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._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&void 0!==t[0]&&void 0!==t[1]){let e=Ug(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,i=!(!e||!t||e[0]===t[0]&&e[1]===t[1]);i?!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,i):this._oldHasSelection&&this._fireOnSelectionChange(e,t,i)}_fireOnSelectionChange(e,t,i){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let r=0;t>=r;r++){let s=e.loadCell(r,this._workCell).getChars().length;0===this._workCell.getWidth()?i--:s>1&&t!==r&&(i+=s-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let s=this._bufferService.buffer,n=s.lines.get(e[1]);if(!n)return;let o=s.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(n,e[0]),l=a,c=e[0]-a,h=0,u=0,d=0,f=0;if(" "===o.charAt(a)){for(;a>0&&" "===o.charAt(a-1);)a--;for(;l<o.length&&" "===o.charAt(l+1);)l++}else{let t=e[0],i=e[0];0===n.getWidth(t)&&(h++,t--),2===n.getWidth(i)&&(u++,i++);let r=n.getString(i).length;for(r>1&&(f+=r-1,l+=r-1);t>0&&a>0&&!this._isCharWordSeparator(n.loadCell(t-1,this._workCell));){n.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;0===this._workCell.getWidth()?(h++,t--):e>1&&(d+=e-1,a-=e-1),a--,t--}for(;i<n.length&&l+1<o.length&&!this._isCharWordSeparator(n.loadCell(i+1,this._workCell));){n.loadCell(i+1,this._workCell);let e=this._workCell.getChars().length;2===this._workCell.getWidth()?(u++,i++):e>1&&(f+=e-1,l+=e-1),l++,i++}}l++;let p=a+c-h+d,_=Math.min(this._bufferService.cols,l-a+h+u-d-f);if(t||""!==o.slice(a,l).trim()){if(i&&0===p&&32!==n.getCodePoint(0)){let t=s.lines.get(e[1]-1);if(t&&n.isWrapped&&32!==t.getCodePoint(this._bufferService.cols-1)){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;p-=e,_+=e}}}if(r&&p+_===this._bufferService.cols&&32!==n.getCodePoint(this._bufferService.cols-1)){let t=s.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&&(_+=t.length)}}return{start:p,length:_}}}_selectWordAt(e,t){let i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return 0!==e.getWidth()&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),i={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Qg(i,this._bufferService.cols)}};em=Cd([kd(3,Vd),kd(4,Yd),kd(5,lf),kd(6,Jd),kd(7,cf),kd(8,af)],em);var tm=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},im=class{constructor(){this._color=new tm,this._css=new tm}setCss(e,t,i){this._css.set(e,t,i)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,i){this._color.set(e,t,i)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},rm=Object.freeze((()=>{let e=[q_.toColor("#2e3436"),q_.toColor("#cc0000"),q_.toColor("#4e9a06"),q_.toColor("#c4a000"),q_.toColor("#3465a4"),q_.toColor("#75507b"),q_.toColor("#06989a"),q_.toColor("#d3d7cf"),q_.toColor("#555753"),q_.toColor("#ef2929"),q_.toColor("#8ae234"),q_.toColor("#fce94f"),q_.toColor("#729fcf"),q_.toColor("#ad7fa8"),q_.toColor("#34e2e2"),q_.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){let r=t[i/36%6|0],s=t[i/6%6|0],n=t[i%6];e.push({css:H_.toCss(r,s,n),rgba:H_.toRgba(r,s,n)})}for(let i=0;i<24;i++){let t=8+10*i;e.push({css:H_.toCss(t,t,t),rgba:H_.toRgba(t,t,t)})}return e})()),sm=q_.toColor("#ffffff"),nm=q_.toColor("#000000"),om=q_.toColor("#ffffff"),am=nm,lm={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},cm=sm,hm=class extends Tf{constructor(e){super(),this._optionsService=e,this._contrastCache=new im,this._halfContrastCache=new im,this._onChangeColors=this._register(new Vf),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:sm,background:nm,cursor:om,cursorAccent:am,selectionForeground:void 0,selectionBackgroundTransparent:lm,selectionBackgroundOpaque:U_.blend(nm,lm),selectionInactiveBackgroundTransparent:lm,selectionInactiveBackgroundOpaque:U_.blend(nm,lm),scrollbarSliderBackground:U_.opacity(sm,.2),scrollbarSliderHoverBackground:U_.opacity(sm,.4),scrollbarSliderActiveBackground:U_.opacity(sm,.5),overviewRulerBorder:sm,ansi:rm.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=um(e.foreground,sm),t.background=um(e.background,nm),t.cursor=U_.blend(t.background,um(e.cursor,om)),t.cursorAccent=U_.blend(t.background,um(e.cursorAccent,am)),t.selectionBackgroundTransparent=um(e.selectionBackground,lm),t.selectionBackgroundOpaque=U_.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=um(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=U_.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?um(e.selectionForeground,Q_):void 0,t.selectionForeground===Q_&&(t.selectionForeground=void 0),U_.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=U_.opacity(t.selectionBackgroundTransparent,.3)),U_.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=U_.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=um(e.scrollbarSliderBackground,U_.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=um(e.scrollbarSliderHoverBackground,U_.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=um(e.scrollbarSliderActiveBackground,U_.opacity(t.foreground,.5)),t.overviewRulerBorder=um(e.overviewRulerBorder,cm),t.ansi=rm.slice(),t.ansi[0]=um(e.black,rm[0]),t.ansi[1]=um(e.red,rm[1]),t.ansi[2]=um(e.green,rm[2]),t.ansi[3]=um(e.yellow,rm[3]),t.ansi[4]=um(e.blue,rm[4]),t.ansi[5]=um(e.magenta,rm[5]),t.ansi[6]=um(e.cyan,rm[6]),t.ansi[7]=um(e.white,rm[7]),t.ansi[8]=um(e.brightBlack,rm[8]),t.ansi[9]=um(e.brightRed,rm[9]),t.ansi[10]=um(e.brightGreen,rm[10]),t.ansi[11]=um(e.brightYellow,rm[11]),t.ansi[12]=um(e.brightBlue,rm[12]),t.ansi[13]=um(e.brightMagenta,rm[13]),t.ansi[14]=um(e.brightCyan,rm[14]),t.ansi[15]=um(e.brightWhite,rm[15]),e.extendedAnsi){let i=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<i;r++)t.ansi[r+16]=um(e.extendedAnsi[r],rm[r+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 um(e,t){if(void 0!==e)try{return q_.toColor(e)}catch{}return t}hm=Cd([kd(0,Jd)],hm);var dm=class{constructor(...e){this._entries=new Map;for(let[t,i]of e)this.set(t,i)}set(e,t){let i=this._entries.get(e);return this._entries.set(e,t),i}forEach(e){for(let[t,i]of this._entries.entries())e(t,i)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},fm=class{constructor(){this._services=new dm,this._services.set(Zd,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let i=(s=e,s[Ud]||[]).sort((e,t)=>e.index-t.index),r=[];var s;for(let o of i){let t=this._services.get(o.id);if(!t)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);r.push(t)}let n=i.length>0?i[0].index:t.length;if(t.length!==n)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${n+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},pm={trace:0,debug:1,info:2,warn:3,error:4,off:5},_m=class extends Tf{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=pm[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)"function"==typeof e[t]&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+t,...i)}trace(e,...t){var i;this._logLevel<=0&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var i;this._logLevel<=1&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var i;this._logLevel<=2&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var i;this._logLevel<=3&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var i;this._logLevel<=4&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,t)}};_m=Cd([kd(0,Jd)],_m);var gm=class extends Tf{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Vf),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Vf),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Vf),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let i=0;i<Math.min(e,this.length);i++)t[i]=this._array[this._getCyclicIndex(i)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...i){if(t){for(let i=e;i<this._length-t;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+i.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<i.length;r++)this._array[this._getCyclicIndex(e+r)]=i[r];if(i.length&&this.onInsertEmitter.fire({index:e,amount:i.length}),this._length+i.length>this._maxLength){let e=this._length+i.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let s=t-1;s>=0;s--)this.set(e+s+i,this.get(e+s));let r=e+t+i-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+i,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},mm=Object.freeze(new jd),vm=0,bm=class e{constructor(e,t,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);let r=t||Wd.fromCharData([0,"",1,0]);for(let s=0;s<e;++s)this.setCell(s,r);this.length=e}get(e){let t=this._data[3*e+0],i=2097151&t;return[this._data[3*e+1],2097152&t?this._combined[e]:i?Id(i):"",t>>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):i]}set(e,t){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?Id(2097151&t):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,t){return vm=3*e,t.content=this._data[vm+0],t.fg=this._data[vm+1],t.bg=this._data[vm+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg}setCellFromCodepoint(e,t,i,r){268435456&r.bg&&(this._extendedAttrs[e]=r.extended),this._data[3*e+0]=t|i<<22,this._data[3*e+1]=r.fg,this._data[3*e+2]=r.bg}addCodepointToCell(e,t,i){let r=this._data[3*e+0];2097152&r?this._combined[e]+=Id(t):2097151&r?(this._combined[e]=Id(2097151&r)+Id(t),r&=-2097152,r|=2097152):r=t|1<<22,i&&(r&=-12582913,r|=i<<22),this._data[3*e+0]=r}insertCells(e,t,i){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),t<this.length-e){let r=new Wd;for(let i=this.length-e-t-1;i>=0;--i)this.setCell(e+t+i,this.loadCell(e+i,r));for(let s=0;s<t;++s)this.setCell(e+s,i)}else for(let r=e;r<this.length;++r)this.setCell(r,i);2===this.getWidth(this.length-1)&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(e,t,i){if(e%=this.length,t<this.length-e){let r=new Wd;for(let i=0;i<this.length-e-t;++i)this.setCell(e+i,this.loadCell(e+t+i,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,i)}else for(let r=e;r<this.length;++r)this.setCell(r,i);e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),0===this.getWidth(e)&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,i)}replaceCells(e,t,i,r=!1){if(r)for(e&&2===this.getWidth(e-1)&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),t<this.length&&2===this.getWidth(t-1)&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,i);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,i),e++;else for(e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),t<this.length&&2===this.getWidth(t-1)&&this.setCellFromCodepoint(t,0,1,i);e<t&&e<this.length;)this.setCell(e++,i)}resize(e,t){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let i=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*i)this._data=new Uint32Array(this._data.buffer,0,i);else{let e=new Uint32Array(i);e.set(this._data),this._data=e}for(let i=this.length;i<e;++i)this.setCell(i,t)}else{this._data=this._data.subarray(0,i);let t=Object.keys(this._combined);for(let i=0;i<t.length;i++){let r=parseInt(t[i],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let i=0;i<r.length;i++){let t=parseInt(r[i],10);t>=e&&delete this._extendedAttrs[t]}}return this.length=e,4*i*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t)for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,e);else{this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let t=new e(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let e in this._combined)t._combined[e]=this._combined[e];for(let e in this._extendedAttrs)t._extendedAttrs[e]=this._extendedAttrs[e];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,t,i,r,s){let n=e._data;if(s)for(let a=r-1;a>=0;a--){for(let e=0;e<3;e++)this._data[3*(i+a)+e]=n[3*(t+a)+e];268435456&n[3*(t+a)+2]&&(this._extendedAttrs[i+a]=e._extendedAttrs[t+a])}else for(let a=0;a<r;a++){for(let e=0;e<3;e++)this._data[3*(i+a)+e]=n[3*(t+a)+e];268435456&n[3*(t+a)+2]&&(this._extendedAttrs[i+a]=e._extendedAttrs[t+a])}let o=Object.keys(e._combined);for(let a=0;a<o.length;a++){let r=parseInt(o[a],10);r>=t&&(this._combined[r-t+i]=e._combined[r])}}translateToString(e,t,i,r){t=t??0,i=i??this.length,e&&(i=Math.min(i,this.getTrimmedLength())),r&&(r.length=0);let s="";for(;t<i;){let e=this._data[3*t+0],i=2097151&e,n=2097152&e?this._combined[t]:i?Id(i):zd;if(s+=n,r)for(let s=0;s<n.length;++s)r.push(t);t+=e>>22||1}return r&&r.push(t),s}};function ym(e,t,i){let r=[],s=e.map((i,r)=>Sm(e,r,t)).reduce((e,t)=>e+t),n=0,o=0,a=0;for(;a<s;){if(s-a<i){r.push(s-a);break}n+=i;let l=Sm(e,o,t);n>l&&(n-=l,o++);let c=2===e[o].getWidth(n-1);c&&n--;let h=c?i-1:i;r.push(h),a+=h}return r}function Sm(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(i-1)&&1===e[t].getWidth(i-1),s=2===e[t+1].getWidth(0);return r&&s?i-1:i}var wm=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new Vf),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),kf(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};wm._nextId=1;var xm=wm,Cm={},km=Cm.B;Cm[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:"≥","{":"π","|":"≠","}":"£","~":"·"},Cm.A={"#":"£"},Cm.B=void 0,Cm[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},Cm.C=Cm[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},Cm.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},Cm.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},Cm.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},Cm.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},Cm.E=Cm[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},Cm.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},Cm.H=Cm[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},Cm["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Em=4294967295,Lm=class{constructor(e,t,i){this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=mm.clone(),this.savedCharset=km,this.markers=[],this._nullCell=Wd.fromCharData([0,"",1,0]),this._whitespaceCell=Wd.fromCharData([0,zd,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new jg,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new gm(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new $d),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 $d),this._whitespaceCell}getBlankLine(e,t){return new bm(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>Em?Em:t}fillViewportRows(e){if(0===this.lines.length){void 0===e&&(e=mm);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new gm(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let i=this.getNullCell(mm),r=0,s=this._getCorrectBufferLength(t);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,i);let n=0;if(this._rows<t)for(let r=this._rows;r<t;r++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||void 0!==this._optionsService.rawOptions.windowsPty.backend||void 0!==this._optionsService.rawOptions.windowsPty.buildNumber?this.lines.push(new bm(e,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new bm(e,i)));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(s<this.lines.maxLength){let e=this.lines.length-s;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=s}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),n&&(this.y+=n),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let n=0;n<this.lines.length;n++)r+=+this.lines.get(n).resize(e,i);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.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&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,r=function(e,t,i,r,s,n){let o=[];for(let a=0;a<e.length-1;a++){let l=a,c=e.get(++l);if(!c.isWrapped)continue;let h=[e.get(a)];for(;l<e.length&&c.isWrapped;)h.push(c),c=e.get(++l);if(!n&&r>=a&&r<l){a+=h.length-1;continue}let u=0,d=Sm(h,u,t),f=1,p=0;for(;f<h.length;){let e=Sm(h,f,t),r=e-p,n=i-d,o=Math.min(r,n);h[u].copyCellsFrom(h[f],p,d,o,!1),d+=o,d===i&&(u++,d=0),p+=o,p===e&&(f++,p=0),0===d&&0!==u&&2===h[u-1].getWidth(i-1)&&(h[u].copyCellsFrom(h[u-1],i-1,d++,1,!1),h[u-1].setCell(i-1,s))}h[u].replaceCells(d,i,s);let _=0;for(let e=h.length-1;e>0&&(e>u||0===h[e].getTrimmedLength());e--)_++;_>0&&(o.push(a+h.length-_),o.push(_)),a+=h.length-1}return o}(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(mm),i);if(r.length>0){let i=function(e,t){let i=[],r=0,s=t[r],n=0;for(let o=0;o<e.length;o++)if(s===o){let i=t[++r];e.onDeleteEmitter.fire({index:o-n,amount:i}),o+=i-1,n+=i,s=t[++r]}else i.push(o);return{layout:i,countRemoved:n}}(this.lines,r);(function(e,t){let i=[];for(let r=0;r<t.length;r++)i.push(e.get(t[r]));for(let r=0;r<i.length;r++)e.set(r,i[r]);e.length=t.length})(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){let r=this.getNullCell(mm),s=i;for(;s-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new bm(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(mm),s=[],n=0;for(let o=this.lines.length-1;o>=0;o--){let a=this.lines.get(o);if(!a||!a.isWrapped&&a.getTrimmedLength()<=e)continue;let l=[a];for(;a.isWrapped&&o>0;)a=this.lines.get(--o),l.unshift(a);if(!i){let e=this.ybase+this.y;if(e>=o&&e<o+l.length)continue}let c,h=l[l.length-1].getTrimmedLength(),u=ym(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(mm,!0);f.push(e)}f.length>0&&(s.push({start:o+l.length+n,newLines:f}),n+=f.length),l.push(...f);let p=u.length-1,_=u[p];0===_&&(p--,_=u[p]);let g=l.length-d-1,m=h;for(;g>=0;){let e=Math.min(m,_);if(void 0===l[p])break;if(l[p].copyCellsFrom(l[g],m-e,_-e,e,!0),_-=e,0===_&&(p--,_=u[p]),m-=e,0===m){g--,m=Sm(l,Math.max(g,0),this._cols)}}for(let t=0;t<l.length;t++)u[t]<e&&l[t].setCell(u[t],r);let v=d-c;for(;v-- >0;)0===this.ybase?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+n)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(s.length>0){let e=[],t=[];for(let s=0;s<this.lines.length;s++)t.push(this.lines.get(s));let i=this.lines.length,r=i-1,o=0,a=s[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let l=0;for(let u=Math.min(this.lines.maxLength-1,i+n-1);u>=0;u--)if(a&&a.start>r+l){for(let e=a.newLines.length-1;e>=0;e--)this.lines.set(u--,a.newLines[e]);u++,e.push({index:r+1,amount:a.newLines.length}),l+=a.newLines.length,a=s[++o]}else this.lines.set(u,t[r--]);let c=0;for(let s=e.length-1;s>=0;s--)e[s].index+=c,this.lines.onInsertEmitter.fire(e[s]),c+=e[s].amount;let h=Math.max(0,i+n-this.lines.maxLength);h>0&&this.lines.onTrimEmitter.fire(h)}}translateBufferLineToString(e,t,i=0,r){let s=this.lines.get(e);return s?s.translateToString(t,i,r):""}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:t,last:i}}setupTabStops(e){for(null!=e?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(null==e&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(null==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 xm(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)}},Rm=class extends Tf{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Vf),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 Lm(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Lm(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},Tm=class extends Tf{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Vf),this.onResize=this._onResize.event,this._onScroll=this._register(new Vf),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 Rm(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let i=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:i,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let i,r=this.buffer;i=this._cachedBlankLine,(!i||i.length!==this.cols||i.getFg(0)!==e.fg||i.getBg(0)!==e.bg)&&(i=r.getBlankLine(e,t),this._cachedBlankLine=i),i.isWrapped=t;let s=r.ybase+r.scrollTop,n=r.ybase+r.scrollBottom;if(0===r.scrollTop){let e=r.lines.isFull;n===r.lines.length-1?e?r.lines.recycle().copyFrom(i):r.lines.push(i.clone()):r.lines.splice(n+1,0,i.clone()),e?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let e=n-s+1;r.lines.shiftElements(s+1,e-1,-1),r.lines.set(n,i.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,t){let i=this.buffer;if(e<0){if(0===i.ydisp)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let r=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),r!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))}};Tm=Cd([kd(0,Jd)],Tm);var Mm={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Dg,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},Pm=["normal","bold","100","200","300","400","500","600","700","800","900"],Am=class extends Tf{constructor(e){super(),this._onOptionChange=this._register(new Vf),this.onOptionChange=this._onOptionChange.event;let t={...Mm};for(let i in e)if(i in t)try{let r=e[i];t[i]=this._sanitizeAndValidateOption(i,r)}catch(c_){console.error(c_)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Ef(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(i=>{i===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(i=>{-1!==e.indexOf(i)&&t()})}_setupOptions(){let e=e=>{if(!(e in Mm))throw new Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in Mm))throw new Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let i in this.rawOptions){let r={get:e.bind(this,i),set:t.bind(this,i)};Object.defineProperty(this.options,i,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Mm[e]),"block"!==(i=t)&&"underline"!==i&&"bar"!==i)throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Mm[e]);break;case"fontWeight":case"fontWeightBold":if("number"==typeof t&&1<=t&&t<=1e3)break;t=Pm.includes(t)?t:Mm[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(10*t)/10));break;case"scrollback":if((t=Math.min(t,4294967295))<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&0!==t)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{}}var i;return t}};function Dm(e,t=5){if("object"!=typeof e)return e;let i=Array.isArray(e)?[]:{};for(let r in e)i[r]=t<=1?e[r]:e[r]&&Dm(e[r],t-1);return i}var Nm=Object.freeze({insertMode:!1}),Im=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Bm=class extends Tf{constructor(e,t,i){super(),this._bufferService=e,this._logService=t,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new Vf),this.onData=this._onData.event,this._onUserInput=this._register(new Vf),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Vf),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Vf),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Dm(Nm),this.decPrivateModes=Dm(Im)}reset(){this.modes=Dm(Nm),this.decPrivateModes=Dm(Im)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};Bm=Cd([kd(0,Vd),kd(1,Qd),kd(2,Jd)],Bm);var Om={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 Fm(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return 4===e.button?(i|=64,i|=e.action):(i|=3&e.button,4&e.button&&(i|=64),8&e.button&&(i|=128),32===e.action?i|=32:0===e.action&&!t&&(i|=3)),i}var zm=String.fromCharCode,jm={DEFAULT:e=>{let t=[Fm(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`${zm(t[0])}${zm(t[1])}${zm(t[2])}`},SGR:e=>{let t=0===e.action&&4!==e.button?"m":"M";return`[<${Fm(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=0===e.action&&4!==e.button?"m":"M";return`[<${Fm(e,!0)};${e.x};${e.y}${t}`}},$m=class extends Tf{constructor(e,t,i){super(),this._bufferService=e,this._coreService=t,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new Vf),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(Om))this.addProtocol(r,Om[r]);for(let r of Object.keys(jm))this.addEncoding(r,jm[r]);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",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,i){if(0===e.deltaY||e.shiftKey||void 0===t||void 0===i)return 0;let r=t/i,s=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=r+0,Math.abs(e.deltaY)<50&&(s*=.3),this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||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,"SGR_PIXELS"===this._activeEncoding))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,t,i){if(i){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};$m=Cd([kd(0,Vd),kd(1,Yd),kd(2,Jd)],$m);var Wm,Hm=[[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]],Um=[[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 qm=class{constructor(){if(this.version="6",!Wm){(Wm=new Uint8Array(65536)).fill(1),Wm[0]=0,Wm.fill(0,1,32),Wm.fill(0,127,160),Wm.fill(2,4352,4448),Wm[9001]=2,Wm[9002]=2,Wm.fill(2,11904,42192),Wm[12351]=1,Wm.fill(2,44032,55204),Wm.fill(2,63744,64256),Wm.fill(2,65040,65050),Wm.fill(2,65072,65136),Wm.fill(2,65280,65377),Wm.fill(2,65504,65511);for(let e=0;e<Hm.length;++e)Wm.fill(0,Hm[e][0],Hm[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Wm[e]:function(e,t){let i,r=0,s=t.length-1;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=r;)if(i=r+s>>1,e>t[i][1])r=i+1;else{if(!(e<t[i][0]))return!0;s=i-1}return!1}(e,Um)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),r=0===i&&0!==t;if(r){let e=Km.extractWidth(t);0===e?r=!1:e>i&&(i=e)}return Km.createPropertyValue(0,i,r)}},Km=class e{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Vf,this.onChange=this._onChange.event;let e=new qm;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return!!(1&e)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,i=!1){return(16777215&e)<<3|(3&t)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let i=0,r=0,s=t.length;for(let n=0;n<s;++n){let o=t.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=s)return i+this.wcwidth(o);let e=t.charCodeAt(n);56320<=e&&e<=57343?o=1024*(o-55296)+e-56320+65536:i+=this.wcwidth(e)}let a=this.charProperties(o,r),l=e.extractWidth(a);e.extractShouldJoin(a)&&(l-=e.extractWidth(r)),i+=l,r=a}return i}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},Vm=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function Gm(e){var t;let i=null==(t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))?void 0:t.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&i&&(r.isWrapped=0!==i[3]&&32!==i[3])}var Ym=2147483647,Xm=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let i=new e;if(!t.length)return i;for(let e=Array.isArray(t[0])?1:0;e<t.length;++e){let r=t[e];if(Array.isArray(r))for(let e=0;e<r.length;++e)i.addSubParam(r[e]);else i.addParam(r)}return i}clone(){let t=new e(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let i=this._subParamsIdx[t]>>8,r=255&this._subParamsIdx[t];r-i>0&&e.push(Array.prototype.slice.call(this._subParams,i,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>Ym?Ym: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 lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>Ym?Ym:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,i=255&this._subParamsIdx[e];return i-t>0?this._subParams.subarray(t,i):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let i=this._subParamsIdx[t]>>8,r=255&this._subParamsIdx[t];r-i>0&&(e[t]=this._subParams.slice(i,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,r=i[t-1];i[t-1]=~r?Math.min(10*r+e,Ym):e}},Zm=[],Qm=class{constructor(){this._state=0,this._active=Zm,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){void 0===this._handlers[e]&&(this._handlers[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=Zm}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=Zm,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Zm,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,"START")}_put(e,t,i){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,i);else this._handlerFb(this._id,"PUT",Bd(e,t,i))}start(){this.reset(),this._state=1}put(e,t,i){if(3!==this._state){if(1===this._state)for(;t<i;){let i=e[t++];if(59===i){this._state=2,this._start();break}if(i<48||57<i)return void(this._state=3);-1===this._id&&(this._id=0),this._id=10*this._id+i-48}2===this._state&&i-t>0&&this._put(e,t,i)}}end(e,t=!0){if(0!==this._state){if(3!==this._state)if(1===this._state&&this._start(),this._active.length){let i=!1,r=this._active.length-1,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&!1===i){for(;r>=0&&(i=this._active[r].end(e),!0!==i);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}else this._handlerFb(this._id,"END",e);this._active=Zm,this._id=-1,this._state=0}}},Jm=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=Bd(e,t,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data="",this._hitLimit=!1,e));return this._data="",this._hitLimit=!1,t}},ev=[],tv=class{constructor(){this._handlers=Object.create(null),this._active=ev,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=ev}registerHandler(e,t){void 0===this._handlers[e]&&(this._handlers[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=ev,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||ev,this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(t);else this._handlerFb(this._ident,"HOOK",t)}put(e,t,i){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,i);else this._handlerFb(this._ident,"PUT",Bd(e,t,i))}unhook(e,t=!0){if(this._active.length){let i=!1,r=this._active.length-1,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&!1===i){for(;r>=0&&(i=this._active[r].unhook(e),!0!==i);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"UNHOOK",e);this._active=ev,this._ident=0}},iv=new Xm;iv.addParam(0);var rv=class{constructor(e){this._handler=e,this._data="",this._params=iv,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():iv,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=Bd(e,t,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=iv,this._data="",this._hitLimit=!1,e));return this._params=iv,this._data="",this._hitLimit=!1,t}},sv=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,i,r){this.table[t<<8|e]=i<<4|r}addMany(e,t,i,r){for(let s=0;s<e.length;s++)this.table[t<<8|e[s]]=i<<4|r}},nv=160,ov=function(){let e=new sv(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),i=(e,i)=>t.slice(e,i),r=i(32,127),s=i(0,24);s.push(25),s.push.apply(s,i(28,32));let n,o=i(0,14);for(n in e.setDefault(1,0),e.addMany(r,0,2,0),o)e.addMany([24,26,153,154],n,3,0),e.addMany(i(128,144),n,3,0),e.addMany(i(144,152),n,3,0),e.add(156,n,0,0),e.add(27,n,11,1),e.add(157,n,4,8),e.addMany([152,158,159],n,0,7),e.add(155,n,11,3),e.add(144,n,11,9);return e.addMany(s,0,3,0),e.addMany(s,1,3,1),e.add(127,1,0,1),e.addMany(s,8,0,8),e.addMany(s,3,3,3),e.add(127,3,0,3),e.addMany(s,4,3,4),e.add(127,4,0,4),e.addMany(s,6,3,6),e.addMany(s,5,3,5),e.add(127,5,0,5),e.addMany(s,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(s,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(s,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(s,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(s,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(s,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(s,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(nv,0,2,0),e.add(nv,8,5,8),e.add(nv,6,0,6),e.add(nv,11,0,11),e.add(nv,13,13,13),e}(),av=class extends Tf{constructor(e=ov){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 Xm,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,i)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(Ef(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new Qm),this._dcsParser=this._register(new tv),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=e.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=r}}if(1!==e.final.length)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=r,i}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let i=this._identifier(e,[48,126]);void 0===this._escHandlers[i]&&(this._escHandlers[i]=[]);let r=this._escHandlers[i];return r.push(t),{dispose:()=>{let e=r.indexOf(t);-1!==e&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let i=this._identifier(e);void 0===this._csiHandlers[i]&&(this._csiHandlers[i]=[]);let r=this._csiHandlers[i];return r.push(t),{dispose:()=>{let e=r.indexOf(t);-1!==e&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,0!==this._parseStack.state&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,i,r,s){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=r,this._parseStack.chunkPos=s}parse(e,t,i){let r,s=0,n=0,o=0;if(this._parseStack.state)if(2===this._parseStack.state)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(void 0===i||1===this._parseStack.state)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let t=this._parseStack.handlers,n=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===i&&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===i&&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(s=e[this._parseStack.chunkPos],r=this._dcsParser.unhook(24!==s&&26!==s,i),r)return r;27===s&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],r=this._oscParser.end(24!==s&&26!==s,i),r)return r;27===s&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let a=o;a<t;++a){switch(s=e[a],n=this._transitions.table[this.currentState<<8|(s<160?s:nv)],n>>4){case 2:for(let r=a+1;;++r){if(r>=t||(s=e[r])<32||s>126&&s<nv){this._printHandler(e,a,r),a=r-1;break}if(++r>=t||(s=e[r])<32||s>126&&s<nv){this._printHandler(e,a,r),a=r-1;break}if(++r>=t||(s=e[r])<32||s>126&&s<nv){this._printHandler(e,a,r),a=r-1;break}if(++r>=t||(s=e[r])<32||s>126&&s<nv){this._printHandler(e,a,r),a=r-1;break}}break;case 3:this._executeHandlers[s]?this._executeHandlers[s]():this._executeHandlerFb(s),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:a,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let i=this._csiHandlers[this._collect<<8|s],o=i?i.length-1:-1;for(;o>=0&&(r=i[o](this._params),!0!==r);o--)if(r instanceof Promise)return this._preserveStack(3,i,o,n,a),r;o<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do{switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}}while(++a<t&&(s=e[a])>47&&s<60);a--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let l=this._escHandlers[this._collect<<8|s],c=l?l.length-1:-1;for(;c>=0&&(r=l[c](),!0!==r);c--)if(r instanceof Promise)return this._preserveStack(4,l,c,n,a),r;c<0&&this._escHandlerFb(this._collect<<8|s),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|s,this._params);break;case 13:for(let r=a+1;;++r)if(r>=t||24===(s=e[r])||26===s||27===s||s>127&&s<nv){this._dcsParser.put(e,a,r),a=r-1;break}break;case 14:if(r=this._dcsParser.unhook(24!==s&&26!==s),r)return this._preserveStack(6,[],0,n,a),r;27===s&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let r=a+1;;r++)if(r>=t||(s=e[r])<32||s>127&&s<nv){this._oscParser.put(e,a,r),a=r-1;break}break;case 6:if(r=this._oscParser.end(24!==s&&26!==s),r)return this._preserveStack(5,[],0,n,a),r;27===s&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&n}}},lv=/^([\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})$/,cv=/^[\da-f]+$/;function hv(e){if(!e)return;let t=e.toLowerCase();if(0===t.indexOf("rgb:")){t=t.slice(4);let e=lv.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(0===t.indexOf("#")&&(t=t.slice(1),cv.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,i=[0,0,0];for(let r=0;r<3;++r){let s=parseInt(t.slice(e*r,e*r+e),16);i[r]=1===e?s<<4:2===e?s:3===e?s>>4:s>>8}return i}}function uv(e,t){let i=e.toString(16),r=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function dv(e,t=16){let[i,r,s]=e;return`rgb:${uv(i,t)}/${uv(r,t)}/${uv(s,t)}`}var fv={"(":0,")":1,"*":2,"+":3,"-":1,".":2},pv=131072;function _v(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 gv=0,mv=class extends Tf{constructor(e,t,i,r,s,n,o,a,l=new av){super(),this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=r,this._optionsService=s,this._oscLinkService=n,this._coreMouseService=o,this._unicodeService=a,this._parser=l,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Od,this._utf8Decoder=new Fd,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=mm.clone(),this._eraseAttrDataInternal=mm.clone(),this._onRequestBell=this._register(new Vf),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Vf),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Vf),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Vf),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Vf),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Vf),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Vf),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Vf),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Vf),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Vf),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Vf),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Vf),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Vf),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new vv(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug("Unknown EXECUTE code: ",{code:e})}),this._parser.setOscHandlerFallback((e,t,i)=>{this._logService.debug("Unknown OSC code: ",{identifier:e,action:t,data:i})}),this._parser.setDcsHandlerFallback((e,t,i)=>{"HOOK"===t&&(i=i.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(e),action:t,payload:i})}),this._parser.setPrintHandler((e,t,i)=>this.print(e,t,i)),this._parser.registerCsiHandler({final:"@"},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:"A"},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:"B"},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:"C"},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:"D"},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:"E"},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:"F"},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:"G"},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:"H"},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:"I"},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:"J"},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:"K"},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:"L"},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:"M"},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:"P"},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:"S"},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:"T"},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:"X"},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:"Z"},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.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({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.setExecuteHandler(A_.BEL,()=>this.bell()),this._parser.setExecuteHandler(A_.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(A_.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(A_.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(A_.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(A_.BS,()=>this.backspace()),this._parser.setExecuteHandler(A_.HT,()=>this.tab()),this._parser.setExecuteHandler(A_.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(A_.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(N_.IND,()=>this.index()),this._parser.setExecuteHandler(N_.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(N_.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Jm(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new Jm(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new Jm(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new Jm(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new Jm(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new Jm(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new Jm(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new Jm(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new Jm(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new Jm(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new Jm(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new Jm(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 Cm)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 rv((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,i,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t("#SLOW_TIMEOUT"),5e3))]).catch(e=>{if("#SLOW_TIMEOUT"!==e)throw e;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,r=this._activeBuffer.x,s=this._activeBuffer.y,n=0,o=this._parseStack.paused;if(o){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(i),i;r=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>pv&&(n=this._parseStack.position+pv)}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<pv&&(this._parseBuffer=new Uint32Array(Math.min(e.length,pv))),o||this._dirtyRowTracker.clearRange(),e.length>pv)for(let c=n;c<e.length;c+=pv){let t=c+pv<e.length?c+pv:e.length,n="string"==typeof e?this._stringDecoder.decode(e.substring(c,t),this._parseBuffer):this._utf8Decoder.decode(e.subarray(c,t),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,n))return this._preserveStack(r,s,n,c),this._logSlowResolvingAsync(i),i}else if(!o){let t="string"==typeof e?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,s,t,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==r||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),l=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);l<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(l,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(e,t,i){let r,s,n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,l=this._coreService.decPrivateModes.wraparound,c=this._coreService.modes.insertMode,h=this._curAttrData,u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-t>0&&2===u.getWidth(this._activeBuffer.x-1)&&u.setCellFromCodepoint(this._activeBuffer.x-1,0,1,h);let d=this._parser.precedingJoinState;for(let f=t;f<i;++f){if(r=e[f],r<127&&n){let e=n[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,d);s=Km.extractWidth(t);let i=Km.extractShouldJoin(t),p=i?Km.extractWidth(d):0;if(d=t,o&&this._onA11yChar.fire(Id(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-p>a)if(l){let e=u,t=this._activeBuffer.x-p;for(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),p>0&&u instanceof bm&&u.copyCellsFrom(e,t,0,p,!1);t<a;)e.setCellFromCodepoint(t++,0,1,h)}else if(this._activeBuffer.x=a-1,2===s)continue;if(i&&this._activeBuffer.x){let e=u.getWidth(this._activeBuffer.x-1)?1:2;u.addCodepointToCell(this._activeBuffer.x-e,r,s);for(let t=s-p;--t>=0;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h);continue}if(c&&(u.insertCells(this._activeBuffer.x,s-p,this._activeBuffer.getNullCell(h)),2===u.getWidth(a-1)&&u.setCellFromCodepoint(a-1,0,1,h)),u.setCellFromCodepoint(this._activeBuffer.x++,r,s,h),s>0)for(;--s;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h)}this._parser.precedingJoinState=d,this._activeBuffer.x<a&&i-t>0&&0===u.getWidth(this._activeBuffer.x)&&!u.hasContent(this._activeBuffer.x)&&u.setCellFromCodepoint(this._activeBuffer.x,0,1,h),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return"t"!==e.final||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,t):this._parser.registerCsiHandler(e,e=>!_v(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e))}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new rv(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Jm(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(0===this._activeBuffer.x&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&(null==(e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))?void 0:e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return 0===t?delete this._activeBuffer.tabs[this._activeBuffer.x]:3===t&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return 1===t&&(this._curAttrData.bg|=536870912),(2===t||0===t)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,i,r=!1,s=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),s),r&&(n.isWrapped=!1)}_resetBufferLine(e,t=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){var i;let r;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,t);r<this._bufferService.rows;r++)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(r);break;case 1:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(r=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,r-1);r--&&!(null==(i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r))?void 0:i.getTrimmedLength()););for(;r>=0;r--)this._bufferService.scroll(this._eraseAttrData())}else{for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(s-1,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i,r=this._activeBuffer.ybase+this._activeBuffer.y;for(i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-i;t--;)this._activeBuffer.lines.splice(r,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(mm));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);e.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);e.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);e.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);e.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),e.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let i=e.params[0]||1,r=Km.extractWidth(t),s=this._activeBuffer.x-r,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),o=new Uint32Array(n.length*i),a=0;for(let c=0;c<n.length;){let e=n.codePointAt(c)||0;o[a++]=e,c+=e>65535?2:1}let l=a;for(let c=1;c<i;++c)o.copyWithin(l,0,a),l+=a;return this.print(o,0,l),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(A_.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(A_.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(A_.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(A_.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(A_.ESC+"[>83;40003;0c")),!0}_is(e){return 0===(this._optionsService.rawOptions.termName+"").indexOf(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){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,km),this._charsetService.setgCharset(1,km),this._charsetService.setgCharset(2,km),this._charsetService.setgCharset(3,km);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0}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){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),1049===e.params[t]&&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)}return!0}requestMode(e,t){let i;var r;(r=i||(i={}))[r.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",r[r.SET=1]="SET",r[r.RESET=2]="RESET",r[r.PERMANENTLY_SET=3]="PERMANENTLY_SET",r[r.PERMANENTLY_RESET=4]="PERMANENTLY_RESET";let s=this._coreService.decPrivateModes,{activeProtocol:n,activeEncoding:o}=this._coreMouseService,a=this._coreService,{buffers:l,cols:c}=this._bufferService,{active:h,alt:u}=l,d=this._optionsService.rawOptions,f=(e,i)=>(a.triggerDataEvent(`${A_.ESC}[${t?"":"?"}${e};${i}$y`),!0),p=e=>e?1:2,_=e.params[0];return f(_,t?2===_?4:4===_?p(a.modes.insertMode):12===_?3:20===_?p(d.convertEol):0:1===_?p(s.applicationCursorKeys):3===_?d.windowOptions.setWinLines?80===c?2:132===c?1:0:0:6===_?p(s.origin):7===_?p(s.wraparound):8===_?3:9===_?p("X10"===n):12===_?p(d.cursorBlink):25===_?p(!a.isCursorHidden):45===_?p(s.reverseWraparound):66===_?p(s.applicationKeypad):67===_?4:1e3===_?p("VT200"===n):1002===_?p("DRAG"===n):1003===_?p("ANY"===n):1004===_?p(s.sendFocus):1005===_?4:1006===_?p("SGR"===o):1015===_?4:1016===_?p("SGR_PIXELS"===o):1048===_?1:47===_||1047===_||1049===_?p(h===u):2004===_?p(s.bracketedPasteMode):2026===_?p(s.synchronizedOutput):0)}_updateAttrColor(e,t,i,r,s){return 2===t?(e|=50331648,e&=-16777216,e|=jd.fromColorRGB([i,r,s])):5===t&&(e&=-50331904,e|=33554432|255&i),e}_extractColor(e,t,i){let r=[0,0,-1,0,0,0],s=0,n=0;do{if(r[n+s]=e.params[t+n],e.hasSubParams(t+n)){let i=e.getSubParams(t+n),o=0;do{5===r[1]&&(s=1),r[n+o+1+s]=i[o]}while(++o<i.length&&o+n+1+s<r.length);break}if(5===r[1]&&n+s>=2||2===r[1]&&n+s>=5)break;r[1]&&(s=1)}while(++n+t<e.length&&n+s<r.length);for(let o=2;o<r.length;++o)-1===r[o]&&(r[o]=0);switch(r[0]){case 38:i.fg=this._updateAttrColor(i.fg,r[1],r[3],r[4],r[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,r[1],r[3],r[4],r[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,r[1],r[3],r[4],r[5])}return n}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,0===e&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=mm.fg,e.bg=mm.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(1===e.length&&0===e.params[0])return this._processSGR0(this._curAttrData),!0;let t,i=e.length,r=this._curAttrData;for(let s=0;s<i;s++)t=e.params[s],t>=30&&t<=37?(r.fg&=-50331904,r.fg|=16777216|t-30):t>=40&&t<=47?(r.bg&=-50331904,r.bg|=16777216|t-40):t>=90&&t<=97?(r.fg&=-50331904,r.fg|=16777224|t-90):t>=100&&t<=107?(r.bg&=-50331904,r.bg|=16777224|t-100):0===t?this._processSGR0(r):1===t?r.fg|=134217728:3===t?r.bg|=67108864:4===t?(r.fg|=268435456,this._processUnderline(e.hasSubParams(s)?e.getSubParams(s)[0]:1,r)):5===t?r.fg|=536870912:7===t?r.fg|=67108864:8===t?r.fg|=1073741824:9===t?r.fg|=2147483648:2===t?r.bg|=134217728:21===t?this._processUnderline(2,r):22===t?(r.fg&=-134217729,r.bg&=-134217729):23===t?r.bg&=-67108865:24===t?(r.fg&=-268435457,this._processUnderline(0,r)):25===t?r.fg&=-536870913:27===t?r.fg&=-67108865:28===t?r.fg&=-1073741825:29===t?r.fg&=2147483647:39===t?(r.fg&=-67108864,r.fg|=16777215&mm.fg):49===t?(r.bg&=-67108864,r.bg|=16777215&mm.bg):38===t||48===t||58===t?s+=this._extractColor(e,s,r):53===t?r.bg|=1073741824:55===t?r.bg&=-1073741825:59===t?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):100===t?(r.fg&=-67108864,r.fg|=16777215&mm.fg,r.bg&=-67108864,r.bg|=16777215&mm.bg):this._logService.debug("Unknown SGR attribute: %d.",t);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${A_.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${A_.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(6===e.params[0]){let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${A_.ESC}[?${e};${t}R`)}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=mm.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=0===e.length?1:e.params[0];if(0===t)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar"}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t,i=e.params[0]||1;return(e.length<2||(t=e.params[1])>this._bufferService.rows||0===t)&&(t=this._bufferService.rows),t>i&&(this._activeBuffer.scrollTop=i-1,this._activeBuffer.scrollBottom=t-1,this._setCursor(0,0)),!0}windowOptions(e){if(!_v(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(`${A_.ESC}[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,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],i=e.split(";");for(;i.length>1;){let e=i.shift(),r=i.shift();if(/^\d+$/.exec(e)){let i=parseInt(e);if(bv(i))if("?"===r)t.push({type:0,index:i});else{let e=hv(r);e&&t.push({type:1,index:i,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(-1===t)return!0;let i=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(i,r):!i.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let i,r=e.split(":"),s=r.findIndex(e=>e.startsWith("id="));return-1!==s&&(i=r[s].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:i,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let i=e.split(";");for(let r=0;r<i.length&&!(t>=this._specialColors.length);++r,++t)if("?"===i[r])this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let e=hv(i[r]);e&&this._onColor.fire([{type:1,index:this._specialColors[t],color:e}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],i=e.split(";");for(let r=0;r<i.length;++r)if(/^\d+$/.exec(i[r])){let e=parseInt(i[r]);bv(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,km),!0}selectCharset(e){return 2!==e.length?(this.selectDefaultCharset(),!0):("/"===e[0]||this._charsetService.setgCharset(fv[e[0]],Cm[e[1]]||km),!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=mm.clone(),this._eraseAttrDataInternal=mm.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 Wd;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let i=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(i);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let i=this._bufferService.buffer,r=this._optionsService.rawOptions;return(e=>(this._coreService.triggerDataEvent(`${A_.ESC}${e}${A_.ESC}\\`),!0))('"q'===e?`P1$r${this._curAttrData.isProtected()?1:0}"q`:'"p'===e?'P1$r61;1"p':"r"===e?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:"m"===e?"P1$r0m":" q"===e?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},vv=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(gv=e,e=t,t=gv),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function bv(e){return 0<=e&&e<256}vv=Cd([kd(0,Vd)],vv);var yv=class extends Tf{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new Vf),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(void 0!==t&&this._syncCalls>t)return void(this._syncCalls=0);if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let i;for(this._isSyncWriting=!0;i=this._writeBuffer.shift();){this._action(i);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._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();setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let i=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){let e=e=>performance.now()-i>=12?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(i,e);return void r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e)}let s=this._callbacks[this._bufferOffset];if(s&&s(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-i>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},Sv=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(void 0===e.id){let i=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[i]};return i.onDispose(()=>this._removeMarkerFromLink(r,i)),this._dataByLinkId.set(r.id,r),r.id}let i=e,r=this._getEntryIdKey(i),s=this._entriesWithId.get(r);if(s)return this.addLineToLink(s.id,t.ybase+t.y),s.id;let n=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(o,n)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let i=this._dataByLinkId.get(e);if(i&&i.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);i.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(i,e))}}getLinkData(e){var t;return null==(t=this._dataByLinkId.get(e))?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let i=e.lines.indexOf(t);-1!==i&&(e.lines.splice(i,1),0===e.lines.length&&(void 0!==e.data.id&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Sv=Cd([kd(0,Vd)],Sv);var wv=!1,xv=class extends Tf{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Mf),this._onBinary=this._register(new Vf),this.onBinary=this._onBinary.event,this._onData=this._register(new Vf),this.onData=this._onData.event,this._onLineFeed=this._register(new Vf),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Vf),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Vf),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Vf),this._instantiationService=new fm,this.optionsService=this._register(new Am(e)),this._instantiationService.setService(Jd,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Tm)),this._instantiationService.setService(Vd,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(_m)),this._instantiationService.setService(Qd,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Bm)),this._instantiationService.setService(Yd,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance($m)),this._instantiationService.setService(Gd,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Km)),this._instantiationService.setService(tf,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Vm),this._instantiationService.setService(Xd,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Sv),this._instantiationService.setService(ef,this._oscLinkService),this._inputHandler=this._register(new mv(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Df.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Df.forward(this._bufferService.onResize,this._onResize)),this._register(Df.forward(this.coreService.onData,this._onData)),this._register(Df.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new yv((e,t)=>this._inputHandler.parse(e,t))),this._register(Df.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Vf),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&&!wv&&(this._logService.warn("writeSync is unreliable and will be removed soon."),wv=!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._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)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&void 0!==t.buildNumber&&void 0!==t.buildNumber?e="conpty"===t.backend&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(Gm.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Gm(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Ef(()=>{for(let t of e)t.dispose()})}}},Cv={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 kv=0,Ev=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new jg,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new jg,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),0===this._insertedValues.length&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,i=0,r=new Array(this._array.length+this._insertedValues.length);for(let s=0;s<r.length;s++)i>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[i])?(r[s]=e[t],t++):r[s]=this._array[i++];this._array=r,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===(kv=this._search(t))||this._getKey(this._array[kv])!==t)return!1;do{if(this._array[kv]===e)return 0===this._deletedIndices.length&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(kv),!0}while(++kv<this._array.length&&this._getKey(this._array[kv])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,i=new Array(this._array.length-e.length),r=0;for(let s=0;s<this._array.length;s++)e[t]===s?t++:i[r++]=this._array[s];this._array=i,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&(!((kv=this._search(e))<0||kv>=this._array.length)&&this._getKey(this._array[kv])===e))do{yield this._array[kv]}while(++kv<this._array.length&&this._getKey(this._array[kv])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&(!((kv=this._search(e))<0||kv>=this._array.length)&&this._getKey(this._array[kv])===e))do{t(this._array[kv])}while(++kv<this._array.length&&this._getKey(this._array[kv])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,i=this._array.length-1;for(;i>=t;){let r=t+i>>1,s=this._getKey(this._array[r]);if(s>e)i=r-1;else{if(!(s<e)){for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}t=r+1}}return t}},Lv=0,Rv=0,Tv=class extends Tf{constructor(){super(),this._decorations=new Ev(e=>null==e?void 0:e.marker.line),this._onDecorationRegistered=this._register(new Vf),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Vf),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Ef(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new Mv(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),i=t.onDispose(()=>{i.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,i){let r=0,s=0;for(let n of this._decorations.getKeyIterator(t))r=n.options.x??0,s=r+(n.options.width??1),e>=r&&e<s&&(!i||(n.options.layer??"bottom")===i)&&(yield n)}forEachDecorationAtCell(e,t,i,r){this._decorations.forEachByKey(t,t=>{Lv=t.options.x??0,Rv=Lv+(t.options.width??1),e>=Lv&&e<Rv&&(!i||(t.options.layer??"bottom")===i)&&r(t)})}},Mv=class extends Rf{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Vf),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Vf),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return null===this._cachedBg&&(this.options.backgroundColor?this._cachedBg=q_.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return null===this._cachedFg&&(this.options.foregroundColor?this._cachedFg=q_.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},Pv=class{constructor(e,t=1e3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,i){this._rowCount=i,e=void 0!==e?e:0,t=void 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 r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-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)}},Av=class extends Tf{constructor(e,t,i,r){super(),this._terminal=e,this._coreBrowserService=i,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let s=this._coreBrowserService.mainDocument;this._accessibilityContainer=s.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=s.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=s.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new Pv(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(Jp(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Ef(()=>{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+=Md())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let i=this._terminal.buffer,r=i.lines.length.toString();for(let s=e;s<=t;s++){let e=i.lines.get(i.ydisp+s),t=[],n=(null==e?void 0:e.translateToString(!0,void 0,void 0,t))||"",o=(i.ydisp+s+1).toString(),a=this._rowElements[s];a&&(0===n.length?(a.textContent=" ",this._rowColumns.set(a,[0,1])):(a.textContent=n,this._rowColumns.set(a,t)),a.setAttribute("aria-posinset",o),a.setAttribute("aria-setsize",r),this._alignRowWidth(a))}this._announceCharacters()}_announceCharacters(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let i,r,s=e.target,n=this._rowElements[0===t?1:this._rowElements.length-2];if(s.getAttribute("aria-posinset")!==(0===t?"1":`${this._terminal.buffer.lines.length}`)&&e.relatedTarget===n){if(0===t?(i=s,r=this._rowElements.pop(),this._rowContainer.removeChild(r)):(i=this._rowElements.shift(),r=s,this._rowContainer.removeChild(i)),i.removeEventListener("focus",this._topBoundaryFocusListener),r.removeEventListener("focus",this._bottomBoundaryFocusListener),0===t){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement("afterbegin",e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(0===t?-1:1),this._rowElements[0===t?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}}_handleSelectionChange(){var e;if(0===this._rowElements.length)return;let t=this._coreBrowserService.mainDocument.getSelection();if(!t)return;if(t.isCollapsed)return void(this._rowContainer.contains(t.anchorNode)&&this._terminal.clearSelection());if(!t.anchorNode||!t.focusNode)return void console.error("anchorNode and/or focusNode are null");let i={node:t.anchorNode,offset:t.anchorOffset},r={node:t.focusNode,offset:t.focusOffset};if((i.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||i.node===r.node&&i.offset>r.offset)&&([i,r]=[r,i]),i.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(i={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(i.node))return;let s=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:s,offset:(null==(e=s.textContent)?void 0:e.length)??0}),!this._rowContainer.contains(r.node))return;let n=({node:e,offset:t})=>{let i=e instanceof Text?e.parentNode:e,r=parseInt(null==i?void 0:i.getAttribute("aria-posinset"),10)-1;if(isNaN(r))return console.warn("row is invalid. Race condition?"),null;let s=this._rowColumns.get(i);if(!s)return console.warn("columns is null. Race condition?"),null;let n=t<s.length?s[t]:s.slice(-1)[0]+1;return n>=this._terminal.cols&&(++r,n=0),{row:r,column:n}},o=n(i),a=n(r);if(o&&a){if(o.row>a.row||o.row===a.row&&o.column>=a.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(a.row-o.row)*this._terminal.cols-o.column+a.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var t,i;e.style.transform="";let r=e.getBoundingClientRect().width,s=null==(i=null==(t=this._rowColumns.get(e))?void 0:t.slice(-1))?void 0:i[0];if(!s)return;let n=s*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${n/r})`}};Av=Cd([kd(1,Zd),kd(2,af),kd(3,cf)],Av);var Dv=class extends Tf{constructor(e,t,i,r,s){super(),this._element=e,this._mouseService=t,this._renderService=i,this._bufferService=r,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Vf),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Vf),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Ef(()=>{var e;kf(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(Jp(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Jp(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Jp(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Jp(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let i=e.composedPath();for(let r=0;r<i.length;r++){let e=i[r];if(e.classList.contains("xterm"))break;if(e.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(e,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var i,r;(!this._activeProviderReplies||!t)&&(null==(i=this._activeProviderReplies)||i.forEach(e=>{null==e||e.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let s=!1;for(let[n,o]of this._linkProviderService.linkProviders.entries())t?(null==(r=this._activeProviderReplies)?void 0:r.get(n))&&(s=this._checkLinkProviderResult(n,e,s)):o.provideLinks(e.y,t=>{var i,r;if(this._isMouseOut)return;let o=null==t?void 0:t.map(e=>({link:e}));null==(i=this._activeProviderReplies)||i.set(n,o),s=this._checkLinkProviderResult(n,e,s),(null==(r=this._activeProviderReplies)?void 0:r.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let i=new Set;for(let r=0;r<t.size;r++){let s=t.get(r);if(s)for(let t=0;t<s.length;t++){let r=s[t],n=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=n;e<=o;e++){if(i.has(e)){s.splice(t--,1);break}i.add(e)}}}}_checkLinkProviderResult(e,t,i){var r;if(!this._activeProviderReplies)return i;let s=this._activeProviderReplies.get(e),n=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(n=!0);if(!n&&s){let e=s.find(e=>this._linkAtPosition(e.link,t));e&&(i=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let o=0;o<this._activeProviderReplies.size;o++){let e=null==(r=this._activeProviderReplies.get(o))?void 0:r.find(e=>this._linkAtPosition(e.link,t));if(e){i=!0,this._handleNewLink(e);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);var i,r;t&&this._mouseDownLink&&(i=this._mouseDownLink.link,r=this._currentLink.link,i.text===r.text&&i.range.start.x===r.range.start.x&&i.range.start.y===r.range.start.y&&i.range.end.x===r.range.end.x&&i.range.end.y===r.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,kf(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var e,t;return null==(t=null==(e=this._currentLink)?void 0:e.state)?void 0:t.decorations.pointerCursor},set:e=>{var t;(null==(t=this._currentLink)?void 0:t.state)&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",e))}},underline:{get:()=>{var e,t;return null==(t=null==(e=this._currentLink)?void 0:e.state)?void 0:t.decorations.underline},set:t=>{var i,r,s;(null==(i=this._currentLink)?void 0:i.state)&&(null==(s=null==(r=this._currentLink)?void 0:r.state)?void 0:s.decorations.underline)!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=0===e.start?0:e.start+1+this._bufferService.buffer.ydisp,i=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(t,i),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,i){var r;(null==(r=this._currentLink)?void 0:r.state)&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(i,t.text)}_fireUnderlineEvent(e,t){let i=e.range,r=this._bufferService.buffer.ydisp,s=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-r-1,i.end.x,i.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(s)}_linkLeave(e,t,i){var r;(null==(r=this._currentLink)?void 0:r.state)&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(i,t.text)}_linkAtPosition(e,t){let i=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,s=t.y*this._bufferService.cols+t.x;return i<=s&&s<=r}_positionFromMouseEvent(e,t,i){let r=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,i,r,s){return{x1:e,y1:t,x2:i,y2:r,cols:this._bufferService.cols,fg:s}}};Dv=Cd([kd(1,lf),kd(2,cf),kd(3,Vd),kd(4,ff)],Dv);var Nv=class extends xv{constructor(e={}){super(e),this._linkifier=this._register(new Mf),this.browser=kg,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Mf),this._onCursorMove=this._register(new Vf),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Vf),this.onKey=this._onKey.event,this._onRender=this._register(new Vf),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Vf),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Vf),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Vf),this.onBell=this._onBell.event,this._onFocus=this._register(new Vf),this._onBlur=this._register(new Vf),this._onA11yCharEmitter=this._register(new Vf),this._onA11yTabEmitter=this._register(new Vf),this._onWillOpen=this._register(new Vf),this._setup(),this._decorationService=this._instantiationService.createInstance(Tv),this._instantiationService.setService(rf,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Sg),this._instantiationService.setService(ff,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(sf)),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(Df.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Df.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Df.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Df.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(Ef(()=>{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}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,i="";switch(t.index){case 256:e="foreground",i="10";break;case 257:e="background",i="11";break;case 258:e="cursor",i="12";break;default:e="ansi",i="4;"+t.index}switch(t.type){case 0:let r=U_.toColorRGB("ansi"===e?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${A_.ESC}]${i};${dv(r)}${B_.ST}`);break;case 1:if("ansi"===e)this._themeService.modifyColors(e=>e.ansi[t.index]=H_.toColor(...t.color));else{let i=e;this._themeService.modifyColors(e=>e[i]=H_.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index)}}}_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(Av,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(A_.ESC+"[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(A_.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let i=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,s=t.getWidth(i),n=this._renderService.dimensions.css.cell.width*s,o=this.buffer.y*this._renderService.dimensions.css.cell.height,a=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=o+"px",this.textarea.style.width=n+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Jp(this.element,"copy",e=>{var t,i;this.hasSelection()&&(t=e,i=this._selectionService,t.clipboardData&&t.clipboardData.setData("text/plain",i.selectionText),t.preventDefault())}));let e=e=>function(e,t,i,r){e.stopPropagation(),e.clipboardData&&Ad(e.clipboardData.getData("text/plain"),t,i,r)}(e,this.textarea,this.coreService,this.optionsService);this._register(Jp(this.textarea,"paste",e)),this._register(Jp(this.element,"paste",e)),Tg?this._register(Jp(this.element,"mousedown",e=>{2===e.button&&Nd(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Jp(this.element,"contextmenu",e=>{Nd(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Og&&this._register(Jp(this.element,"auxclick",e=>{1===e.button&&Dd(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Jp(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Jp(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Jp(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Jp(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Jp(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Jp(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Jp(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var t;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"),e.appendChild(this.element);let i=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),i.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Jp(this.screenElement,"mousemove",e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),i.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Ld()),Fg||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(bg,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(af,this._coreBrowserService),this._register(Jp(this.textarea,"focus",e=>this._handleTextAreaFocus(e))),this._register(Jp(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(_g,this._document,this._helperContainer),this._instantiationService.setService(of,this._charSizeService),this._themeService=this._instantiationService.createInstance(hm),this._instantiationService.setService(df,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(ig),this._instantiationService.setService(uf,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Wg,this.rows,this.screenElement)),this._instantiationService.setService(cf,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(W_,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(xg),this._instantiationService.setService(lf,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(Dv,this.screenElement));this.element.appendChild(i);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(M_,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(em,this.element,this.screenElement,s)),this._instantiationService.setService(hf,this._selectionService),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(Df.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var e;this._selectionService.refresh(),null==(e=this._viewport)||e.queueSync()})),this._register(this._instantiationService.createInstance(P_,this.screenElement)),this._register(Jp(this.element,"mousedown",e=>this._selectionService.handleMouseDown(e))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Av,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance($_,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance($_,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(pg,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function i(t){var i,r,s,n,o;let a,l,c=e._mouseService.getMouseReportCoords(t,e.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(e._customWheelEventHandler&&!1===e._customWheelEventHandler(t))return!1;let c=t.deltaY;if(0===c||0===e.coreMouseService.consumeWheelEvent(t,null==(n=null==(s=null==(r=null==(i=e._renderService)?void 0:i.dimensions)?void 0:r.device)?void 0:s.cell)?void 0:n.height,null==(o=e._coreBrowserService)?void 0:o.dpr))return!1;l=c<0?0:1,a=4;break;default:return!1}return!(void 0===l||void 0===a||a>4)&&e.coreMouseService.triggerMouseEvent({col:c.col,row:c.row,x:c.x,y:c.y,button:a,action:l,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s={mouseup:e=>(i(e),e.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(e)),wheel:e=>(i(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&i(e)},mousemove:e=>{e.buttons||i(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?("debug"===this.optionsService.rawOptions.logLevel&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(e)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&e?r.mousemove||(t.addEventListener("mousemove",s.mousemove),r.mousemove=s.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),16&e?r.wheel||(t.addEventListener("wheel",s.wheel,{passive:!1}),r.wheel=s.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),2&e?r.mouseup||(r.mouseup=s.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),4&e?r.mousedrag||(r.mousedrag=s.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Jp(t,"mousedown",e=>{if(e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e))return i(e),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(e)})),this._register(Jp(t,"wheel",t=>{var i,s,n,o,a;if(!r.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(t))return!1;if(!this.buffer.hasScrollback){if(0===t.deltaY)return!1;if(0===e.coreMouseService.consumeWheelEvent(t,null==(o=null==(n=null==(s=null==(i=e._renderService)?void 0:i.dimensions)?void 0:s.device)?void 0:n.cell)?void 0:o.height,null==(a=e._coreBrowserService)?void 0:a.dpr))return this.cancel(t,!0);let r=A_.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(t.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(r,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){var i;null==(i=this._renderService)||i.refreshRows(e,t)}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){Ad(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(e,t,i){this._selectionService.setSelection(e,t,i)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;null==(e=this._selectionService)||e.clearSelection()}selectAll(){var e;null==(e=this._selectionService)||e.selectAll()}selectLines(e,t){var i;null==(i=this._selectionService)||i.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&("Dead"===e.key||"AltGraph"===e.key)&&(this._unprocessedDeadKey=!0);let i=function(e,t,i,r){var s;let n={type:0,cancel:!1,key:void 0},o=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:"UIKeyInputUpArrow"===e.key?n.key=t?A_.ESC+"OA":A_.ESC+"[A":"UIKeyInputLeftArrow"===e.key?n.key=t?A_.ESC+"OD":A_.ESC+"[D":"UIKeyInputRightArrow"===e.key?n.key=t?A_.ESC+"OC":A_.ESC+"[C":"UIKeyInputDownArrow"===e.key&&(n.key=t?A_.ESC+"OB":A_.ESC+"[B");break;case 8:n.key=e.ctrlKey?"\b":A_.DEL,e.altKey&&(n.key=A_.ESC+n.key);break;case 9:if(e.shiftKey){n.key=A_.ESC+"[Z";break}n.key=A_.HT,n.cancel=!0;break;case 13:n.key=e.altKey?A_.ESC+A_.CR:A_.CR,n.cancel=!0;break;case 27:n.key=A_.ESC,e.altKey&&(n.key=A_.ESC+A_.ESC),n.cancel=!0;break;case 37:if(e.metaKey)break;n.key=o?A_.ESC+"[1;"+(o+1)+"D":t?A_.ESC+"OD":A_.ESC+"[D";break;case 39:if(e.metaKey)break;n.key=o?A_.ESC+"[1;"+(o+1)+"C":t?A_.ESC+"OC":A_.ESC+"[C";break;case 38:if(e.metaKey)break;n.key=o?A_.ESC+"[1;"+(o+1)+"A":t?A_.ESC+"OA":A_.ESC+"[A";break;case 40:if(e.metaKey)break;n.key=o?A_.ESC+"[1;"+(o+1)+"B":t?A_.ESC+"OB":A_.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(n.key=A_.ESC+"[2~");break;case 46:n.key=o?A_.ESC+"[3;"+(o+1)+"~":A_.ESC+"[3~";break;case 36:n.key=o?A_.ESC+"[1;"+(o+1)+"H":t?A_.ESC+"OH":A_.ESC+"[H";break;case 35:n.key=o?A_.ESC+"[1;"+(o+1)+"F":t?A_.ESC+"OF":A_.ESC+"[F";break;case 33:e.shiftKey?n.type=2:e.ctrlKey?n.key=A_.ESC+"[5;"+(o+1)+"~":n.key=A_.ESC+"[5~";break;case 34:e.shiftKey?n.type=3:e.ctrlKey?n.key=A_.ESC+"[6;"+(o+1)+"~":n.key=A_.ESC+"[6~";break;case 112:n.key=o?A_.ESC+"[1;"+(o+1)+"P":A_.ESC+"OP";break;case 113:n.key=o?A_.ESC+"[1;"+(o+1)+"Q":A_.ESC+"OQ";break;case 114:n.key=o?A_.ESC+"[1;"+(o+1)+"R":A_.ESC+"OR";break;case 115:n.key=o?A_.ESC+"[1;"+(o+1)+"S":A_.ESC+"OS";break;case 116:n.key=o?A_.ESC+"[15;"+(o+1)+"~":A_.ESC+"[15~";break;case 117:n.key=o?A_.ESC+"[17;"+(o+1)+"~":A_.ESC+"[17~";break;case 118:n.key=o?A_.ESC+"[18;"+(o+1)+"~":A_.ESC+"[18~";break;case 119:n.key=o?A_.ESC+"[19;"+(o+1)+"~":A_.ESC+"[19~";break;case 120:n.key=o?A_.ESC+"[20;"+(o+1)+"~":A_.ESC+"[20~";break;case 121:n.key=o?A_.ESC+"[21;"+(o+1)+"~":A_.ESC+"[21~";break;case 122:n.key=o?A_.ESC+"[23;"+(o+1)+"~":A_.ESC+"[23~";break;case 123:n.key=o?A_.ESC+"[24;"+(o+1)+"~":A_.ESC+"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(i&&!r||!e.altKey||e.metaKey)!i||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&1===e.key.length?n.key=e.key:e.key&&e.ctrlKey&&("_"===e.key&&(n.key=A_.US),"@"===e.key&&(n.key=A_.NUL)):65===e.keyCode&&(n.type=1);else{let t=null==(s=Cv[e.keyCode])?void 0:s[e.shiftKey?1:0];if(t)n.key=A_.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,i=String.fromCharCode(t);e.shiftKey&&(i=i.toUpperCase()),n.key=A_.ESC+i}else if(32===e.keyCode)n.key=A_.ESC+(e.ctrlKey?A_.NUL:" ");else if("Dead"===e.key&&e.code.startsWith("Key")){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),n.key=A_.ESC+t,n.cancel=!0}}else e.keyCode>=65&&e.keyCode<=90?n.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?n.key=A_.NUL:e.keyCode>=51&&e.keyCode<=55?n.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?n.key=A_.DEL:219===e.keyCode?n.key=A_.ESC:220===e.keyCode?n.key=A_.FS:221===e.keyCode&&(n.key=A_.GS)}return n}(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),3===i.type||2===i.type){let t=this.rows-1;return this.scrollLines(2===i.type?-t:t),this.cancel(e,!0)}return 1===i.type&&this.selectAll(),!!(this._isThirdLevelShift(this.browser,e)||(i.cancel&&this.cancel(e,!0),!i.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&1===e.key.length&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):((i.key===A_.ETX||i.key===A_.CR)&&(this.textarea.value=""),this._onKey.fire({key:i.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey?this.cancel(e,!0):void(this._keyDownHandled=!0)))}_isThirdLevelShift(e,t){let i=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return"keypress"===t.type?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){var t;this._keyDownSeen=!1,(!this._customKeyEventHandler||!1!==this._customKeyEventHandler(e))&&(16===(t=e).keyCode||17===t.keyCode||18===t.keyCode||this.focus(),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(this.cancel(e),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),this.cancel(e),!0}return!1}resize(e,t){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){var i;null==(i=this._charSizeService)||i.measure()}clear(){if(0!==this.buffer.ybase||0!==this.buffer.y){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(mm));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var e;this.options.rows=this.rows,this.options.cols=this.cols;let t=this._customKeyEventHandler;this._setup(),super.reset(),null==(e=this._selectionService)||e.reset(),this._decorationService.reset(),this._customKeyEventHandler=t,this.refresh(0,this.rows-1)}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(A_.ESC+"[I"):this.coreService.triggerDataEvent(A_.ESC+"[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(`${A_.ESC}[4;${t};${e}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${A_.ESC}[6;${r};${i}t`)}}cancel(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1}};var Iv=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=()=>this._wrappedAddonDispose(i),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let i=0;i<this._addons.length;i++)if(this._addons[i]===e){t=i;break}if(-1===t)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},Bv=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 Wd)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}},Ov=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 Bv(t)}getNullCell(){return new Wd}},Fv=class extends Tf{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Vf),this.onBufferChange=this._onBufferChange.event,this._normal=new Ov(this._core.buffers.normal,"normal"),this._alternate=new Ov(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},zv=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,i)=>t(e,i.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},jv=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}},$v=["cols","rows"],Wv=0,Hv=class extends Tf{constructor(e){super(),this._core=this._register(new Nv(e)),this._addonManager=this._register(new Iv),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],i=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let r in this._core.options){let e={get:t.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this._publicOptions,r,e)}}_checkReadonlyOptions(e){if($v.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new zv(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new jv(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 Fv(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any"}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write("\r\n",t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Ld()},set promptLabel(e){Rd(e)},get tooMuchOutput(){return Md()},set tooMuchOutput(e){Pd(e)}}}_verifyIntegers(...e){for(Wv of e)if(Wv===1/0||isNaN(Wv)||Wv%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Wv of e)if(Wv&&(Wv===1/0||isNaN(Wv)||Wv%1!=0||Wv<0))throw new Error("This API only accepts positive integers")}},Uv=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var e;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let t=this._terminal._core._renderService.dimensions;if(0===t.css.cell.width||0===t.css.cell.height)return;let i=0===this._terminal.options.scrollback?0:(null==(e=this._terminal.options.overviewRuler)?void 0:e.width)||14,r=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(r.getPropertyValue("height")),n=Math.max(0,parseInt(r.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),a=s-(parseInt(o.getPropertyValue("padding-top"))+parseInt(o.getPropertyValue("padding-bottom"))),l=n-(parseInt(o.getPropertyValue("padding-right"))+parseInt(o.getPropertyValue("padding-left")))-i;return{cols:Math.max(2,Math.floor(l/t.css.cell.width)),rows:Math.max(1,Math.floor(a/t.css.cell.height))}}},qv=class{constructor(e,t,i,r={}){this._terminal=e,this._regex=t,this._handler=i,this._options=r}provideLinks(e,t){let i=Vv.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(i))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,i)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,i,r)}},e))}};function Kv(e){try{let t=new URL(e),i=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(i.toLocaleLowerCase())}catch{return!1}}var Vv=class e{static computeLink(t,i,r,s){let n,o=new RegExp(i.source,(i.flags||"")+"g"),[a,l]=e._getWindowedLineStrings(t-1,r),c=a.join(""),h=[];for(;n=o.exec(c);){let t=n[0];if(!Kv(t))continue;let[i,o]=e._mapStrIdx(r,l,0,n.index),[a,c]=e._mapStrIdx(r,i,o,t.length);if(-1===i||-1===o||-1===a||-1===c)continue;let u={start:{x:o+1,y:i+1},end:{x:c,y:a+1}};h.push({range:u,text:t,activate:s})}return h}static _getWindowedLineStrings(e,t){let i,r=e,s=e,n=0,o="",a=[];if(i=t.buffer.active.getLine(e)){let e=i.translateToString(!0);if(i.isWrapped&&" "!==e[0]){for(n=0;(i=t.buffer.active.getLine(--r))&&n<2048&&(o=i.translateToString(!0),n+=o.length,a.push(o),i.isWrapped&&-1===o.indexOf(" ")););a.reverse()}for(a.push(e),n=0;(i=t.buffer.active.getLine(++s))&&i.isWrapped&&n<2048&&(o=i.translateToString(!0),n+=o.length,a.push(o),-1===o.indexOf(" ")););}return[a,r]}static _mapStrIdx(e,t,i,r){let s=e.buffer.active,n=s.getNullCell(),o=i;for(;r;){let e=s.getLine(t);if(!e)return[-1,-1];for(let i=o;i<e.length;++i){e.getCell(i,n);let o=n.getChars();if(n.getWidth()&&(r-=o.length||1,i===e.length-1&&""===o)){let e=s.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,n),2===n.getWidth()&&(r+=1))}if(r<0)return[t,i]}t++,o=0}return[t,o]}},Gv=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function Yv(e,t){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var Xv=class{constructor(e=Yv,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,i=t.urlRegex||Gv;this._linkProvider=this._terminal.registerLinkProvider(new qv(this._terminal,i,this._handler,t))}dispose(){var e;null==(e=this._linkProvider)||e.dispose()}},Zv=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?sb.isErrorNoTelemetry(e)?new sb(e.message+"\n\n"+e.stack):new Error(e.message+"\n\n"+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};
52
+ /**
53
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
54
+ * @license MIT
55
+ *
56
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
57
+ * @license MIT
58
+ *
59
+ * Originally forked from (with the author's permission):
60
+ * Fabrice Bellard's javascript vt100 for jslinux:
61
+ * http://bellard.org/jslinux/
62
+ * Copyright (c) 2011 Fabrice Bellard
63
+ */function Qv(e){(function(e){return e instanceof rb||e instanceof Error&&e.name===Jv&&e.message===Jv})(e)||Zv.onUnexpectedError(e)}var Jv="Canceled";var eb,tb,ib,rb=class extends Error{constructor(){super(Jv),this.name=this.message}},sb=class e extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(t){if(t instanceof e)return t;let i=new e;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(e){return"CodeExpectedError"===e.name}};function nb(e,t){let i,r=this,s=!1;return function(){return s||(s=!0,t||(i=e.apply(r,arguments))),i}}function ob(e){if(ib.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(c_){t.push(c_)}if(1===t.length)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function ab(...e){return lb(()=>ob(e))}function lb(e){return{dispose:nb(()=>{e()})}}(tb=eb||(eb={})).isLessThan=function(e){return e<0},tb.isLessThanOrEqual=function(e){return e<=0},tb.isGreaterThan=function(e){return e>0},tb.isNeitherLessOrGreaterThan=function(e){return 0===e},tb.greaterThan=1,tb.lessThan=-1,tb.neitherLessOrGreaterThan=0,(e=>{function t(e){return e&&"object"==typeof e&&"function"==typeof e[Symbol.iterator]}e.is=t;let i=Object.freeze([]);function*r(e){yield e}e.empty=function(){return i},e.single=r,e.wrap=function(e){return t(e)?e:r(e)},e.from=function(e){return e||i},e.reverse=function*(e){for(let t=e.length-1;t>=0;t--)yield e[t]},e.isEmpty=function(e){return!e||!0===e[Symbol.iterator]().next().done},e.first=function(e){return e[Symbol.iterator]().next().value},e.some=function(e,t){let i=0;for(let r of e)if(t(r,i++))return!0;return!1},e.find=function(e,t){for(let i of e)if(t(i))return i},e.filter=function*(e,t){for(let i of e)t(i)&&(yield i)},e.map=function*(e,t){let i=0;for(let r of e)yield t(r,i++)},e.flatMap=function*(e,t){let i=0;for(let r of e)yield*t(r,i++)},e.concat=function*(...e){for(let t of e)yield*t},e.reduce=function(e,t,i){let r=i;for(let s of e)r=t(r,s);return r},e.slice=function*(e,t,i=e.length){for(t<0&&(t+=e.length),i<0?i+=e.length:i>e.length&&(i=e.length);t<i;t++)yield e[t]},e.consume=function(t,i=Number.POSITIVE_INFINITY){let r=[];if(0===i)return[r,t];let s=t[Symbol.iterator]();for(let n=0;n<i;n++){let t=s.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator]:()=>s}]},e.asyncToArray=async function(e){let t=[];for await(let i of e)t.push(i);return Promise.resolve(t)}})(ib||(ib={}));var cb=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(0!==this._toDispose.size)try{ob(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&this._toDispose.delete(e)}};cb.DISABLE_DISPOSED_WARNING=!1;var hb=cb,ub=class{constructor(){this._store=new hb,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};ub.None=Object.freeze({dispose(){}});var db,fb=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}clearAndLeak(){let e=this._value;return this._value=void 0,e}},pb=globalThis.performance&&"function"==typeof globalThis.performance.now,_b=class e{static create(t){return new e(t)}constructor(e){this._now=pb&&!1===e?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return-1!==this._stopTime?this._stopTime-this._startTime:this._now()-this._startTime}};(e=>{function t(e){return(t,i=null,r)=>{let s,n=!1;return s=e(e=>{if(!n)return s?s.dispose():n=!0,t.call(i,e)},null,r),n&&s.dispose(),s}}function i(e,t,i){return s((i,r=null,s)=>e(e=>i.call(r,t(e)),null,s),i)}function r(e,t,i){return s((i,r=null,s)=>e(e=>t(e)&&i.call(r,e),null,s),i)}function s(e,t){let i,r=new Eb({onWillAddFirstListener(){i=e(r.fire,r)},onDidRemoveLastListener(){null==i||i.dispose()}});return null==t||t.add(r),r.event}function n(e,t,i=100,r=!1,s=!1,n,o){let a,l,c,h,u=0,d=new Eb({leakWarningThreshold:n,onWillAddFirstListener(){a=e(e=>{u++,l=t(l,e),r&&!c&&(d.fire(l),l=void 0),h=()=>{let e=l;l=void 0,c=void 0,(!r||u>1)&&d.fire(e),u=0},"number"==typeof i?(clearTimeout(c),c=setTimeout(h,i)):void 0===c&&(c=0,queueMicrotask(h))})},onWillRemoveListener(){s&&u>0&&(null==h||h())},onDidRemoveLastListener(){h=void 0,a.dispose()}});return null==o||o.add(d),d.event}e.None=()=>ub.None,e.defer=function(e,t){return n(e,()=>{},0,void 0,!0,void 0,t)},e.once=t,e.map=i,e.forEach=function(e,t,i){return s((i,r=null,s)=>e(e=>{t(e),i.call(r,e)},null,s),i)},e.filter=r,e.signal=function(e){return e},e.any=function(...e){return(t,i=null,r)=>{let s=ab(...e.map(e=>e(e=>t.call(i,e))));return function(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}(s,r)}},e.reduce=function(e,t,r,s){let n=r;return i(e,e=>(n=t(n,e),n),s)},e.debounce=n,e.accumulate=function(t,i=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],i,void 0,!0,void 0,r)},e.latch=function(e,t=(e,t)=>e===t,i){let s,n=!0;return r(e,e=>{let i=n||!t(e,s);return n=!1,s=e,i},i)},e.split=function(t,i,r){return[e.filter(t,i,r),e.filter(t,e=>!i(e),r)]},e.buffer=function(e,t=!1,i=[],r){let s=i.slice(),n=e(e=>{s?s.push(e):a.fire(e)});r&&r.add(n);let o=()=>{null==s||s.forEach(e=>a.fire(e)),s=null},a=new Eb({onWillAddFirstListener(){n||(n=e(e=>a.fire(e)),r&&r.add(n))},onDidAddFirstListener(){s&&(t?setTimeout(o):o())},onDidRemoveLastListener(){n&&n.dispose(),n=null}});return r&&r.add(a),a.event},e.chain=function(e,t){return(i,r,s)=>{let n=t(new a);return e(function(e){let t=n.evaluate(e);t!==o&&i.call(r,t)},void 0,s)}};let o=Symbol("HaltChainable");class a{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:o),this}reduce(e,t){let i=t;return this.steps.push(t=>(i=e(i,t),i)),this}latch(e=(e,t)=>e===t){let t,i=!0;return this.steps.push(r=>{let s=i||!e(r,t);return i=!1,t=r,s?r:o}),this}evaluate(e){for(let t of this.steps)if((e=t(e))===o)break;return e}}e.fromNodeEventEmitter=function(e,t,i=e=>e){let r=(...e)=>s.fire(i(...e)),s=new Eb({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return s.event},e.fromDOMEventEmitter=function(e,t,i=e=>e){let r=(...e)=>s.fire(i(...e)),s=new Eb({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return s.event},e.toPromise=function(e){return new Promise(i=>t(e)(i))},e.fromPromise=function(e){let t=new Eb;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event},e.forward=function(e,t){return e(e=>t.fire(e))},e.runAndSubscribe=function(e,t,i){return t(i),e(e=>t(e))};class l{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let i={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new Eb(i),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,0===this._counter&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}e.fromObservable=function(e,t){return new l(e,t).emitter.event},e.fromObservableLight=function(e){return(t,i,r)=>{let s=0,n=!1,o={beginUpdate(){s++},endUpdate(){s--,0===s&&(e.reportChanges(),n&&(n=!1,t.call(i)))},handlePossibleChange(){},handleChange(){n=!0}};e.addObserver(o),e.reportChanges();let a={dispose(){e.removeObserver(o)}};return r instanceof hb?r.add(a):Array.isArray(r)&&r.push(a),a}}})(db||(db={}));var gb=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new _b,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};gb.all=new Set,gb._idPool=0;var mb=gb,vb=class e{constructor(t,i,r=(e._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=r,this._warnCountdown=0}dispose(){var e;null==(e=this._stacks)||e.clear()}check(e,t){let i=this.threshold;if(i<=0||t<i)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=.5*i;let[e,r]=this.getMostFrequentStack(),s=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(s),console.warn(e);let n=new wb(s,e);this._errorHandler(n)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[i,r]of this._stacks)(!e||t<r)&&(e=[i,r],t=r);return e}};vb._idPool=1;var bb,yb=vb,Sb=class e{constructor(e){this.value=e}static create(){let t=new Error;return new e(t.stack??"")}print(){console.warn(this.value.split("\n").slice(2).join("\n"))}},wb=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},xb=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Cb=0,kb=class{constructor(e){this.value=e,this.id=Cb++}},Eb=class{constructor(e){var t,i,r,s;this._size=0,this._options=e,this._leakageMon=(null==(t=this._options)?void 0:t.leakWarningThreshold)?new yb((null==e?void 0:e.onListenerError)??Qv,(null==(i=this._options)?void 0:i.leakWarningThreshold)??-1):void 0,this._perfMon=(null==(r=this._options)?void 0:r._profName)?new mb(this._options._profName):void 0,this._deliveryQueue=null==(s=this._options)?void 0:s.deliveryQueue}dispose(){var e,t,i,r;this._disposed||(this._disposed=!0,(null==(e=this._deliveryQueue)?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),null==(i=null==(t=this._options)?void 0:t.onDidRemoveLastListener)||i.call(t),null==(r=this._leakageMon)||r.dispose())}get event(){return this._event??(this._event=(e,t,i)=>{var r,s,n,o,a;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],i=new xb(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return((null==(r=this._options)?void 0:r.onListenerError)||Qv)(i),ub.None}if(this._disposed)return ub.None;t&&(e=e.bind(t));let l,c=new kb(e);this._leakageMon&&this._size>=Math.ceil(.2*this._leakageMon.threshold)&&(c.stack=Sb.create(),l=this._leakageMon.check(c.stack,this._size+1)),this._listeners?this._listeners instanceof kb?(this._deliveryQueue??(this._deliveryQueue=new Lb),this._listeners=[this._listeners,c]):this._listeners.push(c):(null==(n=null==(s=this._options)?void 0:s.onWillAddFirstListener)||n.call(s,this),this._listeners=c,null==(a=null==(o=this._options)?void 0:o.onDidAddFirstListener)||a.call(o,this)),this._size++;let h=lb(()=>{null==l||l(),this._removeListener(c)});return i instanceof hb?i.add(h):Array.isArray(i)&&i.push(h),h}),this._event}_removeListener(e){var t,i,r,s;if(null==(i=null==(t=this._options)?void 0:t.onWillRemoveListener)||i.call(t,this),!this._listeners)return;if(1===this._size)return this._listeners=void 0,null==(s=null==(r=this._options)?void 0:r.onDidRemoveLastListener)||s.call(r,this),void(this._size=0);let n=this._listeners,o=n.indexOf(e);if(-1===o)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,n[o]=void 0;let a=this._deliveryQueue.current===this;if(2*this._size<=n.length){let e=0;for(let t=0;t<n.length;t++)n[t]?n[e++]=n[t]:a&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=e}}_deliver(e,t){var i;if(!e)return;let r=(null==(i=this._options)?void 0:i.onListenerError)||Qv;if(r)try{e.value(t)}catch(pp){r(pp)}else e.value(t)}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,i,r,s;if((null==(t=this._deliveryQueue)?void 0:t.current)&&(this._deliverQueue(this._deliveryQueue),null==(i=this._perfMon)||i.stop()),null==(r=this._perfMon)||r.start(this._size),this._listeners)if(this._listeners instanceof kb)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}null==(s=this._perfMon)||s.stop()}hasListeners(){return this._size>0}},Lb=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Rb=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}});(e=>{e.isCancellationToken=function(t){return t===e.None||t===e.Cancelled||t instanceof Pb||!(!t||"object"!=typeof t)&&("boolean"==typeof t.isCancellationRequested&&"function"==typeof t.onCancellationRequested)},e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:db.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Rb})})(bb||(bb={}));var Tb,Mb,Pb=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Rb:(this._emitter||(this._emitter=new Eb),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Ab="en",Db=Ab,Nb=globalThis;typeof Nb.vscode<"u"&&typeof Nb.vscode.process<"u"?Mb=Nb.vscode.process:typeof process<"u"&&"string"==typeof(null==(r=null==process?void 0:process.versions)?void 0:r.node)&&(Mb=process);var Ib="string"==typeof(null==(s=null==Mb?void 0:Mb.versions)?void 0:s.electron)&&"renderer"===(null==Mb?void 0:Mb.type);if("object"==typeof Mb){Mb.platform,Mb.platform,"linux"===Mb.platform&&!!Mb.env.SNAP&&Mb.env.SNAP_REVISION,!!Mb.env.CI||Mb.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Db=Ab;let e=Mb.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,Db=t.resolvedLanguage||Ab,null==(n=t.languagePack)?void 0:n.translationsConfigFile}catch{}}else"object"!=typeof navigator||Ib?console.error("Unable to resolve platform."):((Tb=navigator.userAgent).indexOf("Windows"),Tb.indexOf("Macintosh"),(Tb.indexOf("Macintosh")>=0||Tb.indexOf("iPad")>=0||Tb.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints,Tb.indexOf("Linux")>=0,null==Tb||Tb.indexOf("Mobi"),Db=globalThis._VSCODE_NLS_LANGUAGE||Ab,navigator.language.toLowerCase());var Bb,Ob=Tb,Fb=Db;(e=>{e.value=function(){return Fb},e.isDefaultVariant=function(){return 2===Fb.length?"en"===Fb:Fb.length>=3&&("e"===Fb[0]&&"n"===Fb[1]&&"-"===Fb[2])},e.isDefault=function(){return"en"===Fb}})(Bb||(Bb={}));var zb="function"==typeof Nb.postMessage&&!Nb.importScripts;(()=>{if(zb){let e=[];Nb.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let i=0,r=e.length;i<r;i++){let r=e[i];if(r.id===t.data.vscodeScheduleAsyncWork)return e.splice(i,1),void r.callback()}});let t=0;return i=>{let r=++t;e.push({id:r,callback:i}),Nb.postMessage({vscodeScheduleAsyncWork:r},"*")}}})();var jb,$b,Wb=!!(Ob&&Ob.indexOf("Chrome")>=0);function Hb(e,t=0,i){let r=setTimeout(()=>{e()},t);return lb(()=>{clearTimeout(r)})}Ob&&Ob.indexOf("Firefox"),!Wb&&Ob&&Ob.indexOf("Safari"),Ob&&Ob.indexOf("Edg/"),Ob&&Ob.indexOf("Android"),($b=jb||(jb={})).settled=async function(e){let t,i=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||(t=e)})));if(typeof t<"u")throw t;return i},$b.withAsyncBody=function(e){return new Promise(async(t,i)=>{try{await e(t,i)}catch(vt){i(vt)}})};var Ub=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let i of t)e.emitOne(i)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new Eb,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(pp){this.reject(pp)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{for(;;){if(2===this._state)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(1===this._state)return{done:!0,value:void 0};await db.toPromise(this._onStateChanged.event)}},return:async()=>{var e;return null==(e=this._onReturn)||e.call(this),{done:!0,value:void 0}}}}static map(t,i){return new e(async e=>{for await(let r of t)e.emitOne(i(r))})}map(t){return e.map(this,t)}static filter(t,i){return new e(async e=>{for await(let r of t)i(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let i of e)t.push(i);return t}toPromise(){return e.toPromise(this)}emitOne(e){0===this._state&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){0===this._state&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){0===this._state&&(this._state=1,this._onStateChanged.fire())}reject(e){0===this._state&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Ub.EMPTY=Ub.fromArray([]);var qb=class extends ub{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new fb),this._linesCacheDisposables=this._register(new fb),this._register(lb(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=ab(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=Hb(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){var t;return null==(t=this._linesCache)?void 0:t[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){var i;let r=[],s=[0],n=this._terminal.buffer.active.getLine(e);for(;n;){let o=this._terminal.buffer.active.getLine(e+1),a=!!o&&o.isWrapped,l=n.translateToString(!a&&t);if(a&&o){let e=n.getCell(n.length-1);e&&0===e.getCode()&&1===e.getWidth()&&2===(null==(i=o.getCell(0))?void 0:i.getWidth())&&(l=l.slice(0,-1))}if(r.push(l),!a)break;s.push(s[s.length-1]+l.length),e++,n=o}return[r.join(""),s]}},Kb=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(e){this._cachedSearchTerm=e}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(e){this._lastSearchOptions=e}isValidSearchTerm(e){return!!(e&&e.length>0)}didOptionsChange(e){return!this._lastSearchOptions||!!e&&(this._lastSearchOptions.caseSensitive!==e.caseSensitive||this._lastSearchOptions.regex!==e.regex||this._lastSearchOptions.wholeWord!==e.wholeWord)}shouldUpdateHighlighting(e,t){return!!(null==t?void 0:t.decorations)&&(void 0===this._cachedSearchTerm||e!==this._cachedSearchTerm||this.didOptionsChange(t))}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},Vb=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,i,r){if(!e||0===e.length)return void this._terminal.clearSelection();if(i>this._terminal.cols)throw new Error(`Invalid col: ${i} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let s={startRow:t,startCol:i},n=this._findInLine(e,s,r);if(!n)for(let o=t+1;o<this._terminal.buffer.active.baseY+this._terminal.rows&&(s.startRow=o,s.startCol=0,n=this._findInLine(e,s,r),!n);o++);return n}findNextWithSelection(e,t,i){if(!e||0===e.length)return void this._terminal.clearSelection();let r=this._terminal.getSelectionPosition();this._terminal.clearSelection();let s=0,n=0;r&&(i===e?(s=r.end.x,n=r.end.y):(s=r.start.x,n=r.start.y)),this._lineCache.initLinesCache();let o={startRow:n,startCol:s},a=this._findInLine(e,o,t);if(!a)for(let l=n+1;l<this._terminal.buffer.active.baseY+this._terminal.rows&&(o.startRow=l,o.startCol=0,a=this._findInLine(e,o,t),!a);l++);if(!a&&0!==n)for(let l=0;l<n&&(o.startRow=l,o.startCol=0,a=this._findInLine(e,o,t),!a);l++);return!a&&r&&(o.startRow=r.start.y,o.startCol=0,a=this._findInLine(e,o,t)),a}findPreviousWithSelection(e,t,i){if(!e||0===e.length)return void this._terminal.clearSelection();let r=this._terminal.getSelectionPosition();this._terminal.clearSelection();let s=this._terminal.buffer.active.baseY+this._terminal.rows-1,n=this._terminal.cols,o=!0;this._lineCache.initLinesCache();let a,l={startRow:s,startCol:n};if(r&&(l.startRow=s=r.start.y,l.startCol=n=r.start.x,i!==e&&(a=this._findInLine(e,l,t,!1),a||(l.startRow=s=r.end.y,l.startCol=n=r.end.x))),a||(a=this._findInLine(e,l,t,o)),!a){l.startCol=Math.max(l.startCol,this._terminal.cols);for(let i=s-1;i>=0&&(l.startRow=i,a=this._findInLine(e,l,t,o),!a);i--);}if(!a&&s!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let c=this._terminal.buffer.active.baseY+this._terminal.rows-1;c>=s&&(l.startRow=c,a=this._findInLine(e,l,t,o),!a);c--);return a}_isWholeWord(e,t,i){return(0===e||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e-1]))&&(e+i.length===t.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e+i.length]))}_findInLine(e,t,i={},r=!1){var s;let n=t.startRow,o=t.startCol;if(null==(s=this._terminal.buffer.active.getLine(n))?void 0:s.isWrapped)return r?void(t.startCol+=this._terminal.cols):(t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,i));let a=this._lineCache.getLineFromCache(n);a||(a=this._lineCache.translateBufferLineToStringWithWrap(n,!0),this._lineCache.setLineInCache(n,a));let[l,c]=a,h=this._bufferColsToStringOffset(n,o),u=e,d=l;i.regex||(u=i.caseSensitive?e:e.toLowerCase(),d=i.caseSensitive?l:l.toLowerCase());let f=-1;if(i.regex){let t,s=RegExp(u,i.caseSensitive?"g":"gi");if(r)for(;t=s.exec(d.slice(0,h));)f=s.lastIndex-t[0].length,e=t[0],s.lastIndex-=e.length-1;else t=s.exec(d.slice(h)),t&&t[0].length>0&&(f=h+(s.lastIndex-t[0].length),e=t[0])}else r?h-u.length>=0&&(f=d.lastIndexOf(u,h-u.length)):f=d.indexOf(u,h);if(f>=0){if(i.wholeWord&&!this._isWholeWord(f,d,e))return;let t=0;for(;t<c.length-1&&f>=c[t+1];)t++;let r=t;for(;r<c.length-1&&f+e.length>=c[r+1];)r++;let s=f-c[t],o=f+e.length-c[r],a=this._stringLengthToBufferSize(n+t,s);return{term:e,col:a,row:n+t,size:this._stringLengthToBufferSize(n+r,o)-a+this._terminal.cols*(r-t)}}}_stringLengthToBufferSize(e,t){let i=this._terminal.buffer.active.getLine(e);if(!i)return 0;for(let r=0;r<t;r++){let e=i.getCell(r);if(!e)break;let s=e.getChars();s.length>1&&(t-=s.length-1);let n=i.getCell(r+1);n&&0===n.getWidth()&&t++}return t}_bufferColsToStringOffset(e,t){let i=e,r=0,s=this._terminal.buffer.active.getLine(i);for(;t>0&&s;){for(let e=0;e<t&&e<this._terminal.cols;e++){let t=s.getCell(e);if(!t)break;t.getWidth()&&(r+=0===t.getCode()?1:t.getChars().length)}if(i++,s=this._terminal.buffer.active.getLine(i),s&&!s.isWrapped)break;t-=this._terminal.cols}return r}},Gb=class extends ub{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(lb(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let i of e){let e=this._createResultDecorations(i,t,!1);if(e)for(let t of e)this._storeDecoration(t,i)}}createActiveDecoration(e,t){let i=this._createResultDecorations(e,t,!0);if(i)return{decorations:i,match:e,dispose(){ob(i)}}}clearHighlightDecorations(){ob(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,i){e.classList.contains("xterm-find-result-decoration")||(e.classList.add("xterm-find-result-decoration"),t&&(e.style.outline=`1px solid ${t}`)),i&&e.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(e,t,i){let r=[],s=e.col,n=e.size,o=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;n>0;){let e=Math.min(this._terminal.cols-s,n);r.push([o,s,e]),s=0,n-=e,o++}let a=[];for(let l of r){let e=this._terminal.registerMarker(l[0]),r=this._terminal.registerDecoration({marker:e,x:l[1],width:l[2],backgroundColor:i?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(e.line)?void 0:{color:i?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:"center"}});if(r){let s=[];s.push(e),s.push(r.onRender(e=>this._applyStyles(e,i?t.activeMatchBorder:t.matchBorder,!1))),s.push(r.onDispose(()=>ob(s))),a.push(r)}}return 0===a.length?void 0:a}},Yb=class extends ub{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new Eb)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(e){for(let t=0;t<this._searchResults.length;t++){let i=this._searchResults[t];if(i.row===e.row&&i.col===e.col&&i.size===e.size)return t}return-1}fireResultsChanged(e){if(!e)return;let t=-1;this._selectedDecoration&&(t=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:t,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},Xb=class extends ub{constructor(e){super(),this._highlightTimeout=this._register(new fb),this._lineCache=this._register(new fb),this._state=new Kb,this._resultTracker=this._register(new Yb),this._highlightLimit=(null==e?void 0:e.highlightLimit)??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new qb(e),this._engine=new Vb(e,this._lineCache.value),this._decorationManager=new Gb(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(lb(()=>this.clearDecorations()))}_updateMatches(){var e;this._highlightTimeout.clear(),this._state.cachedSearchTerm&&(null==(e=this._state.lastSearchOptions)?void 0:e.decorations)&&(this._highlightTimeout.value=Hb(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(e){var t;this._resultTracker.clearSelectedDecoration(),null==(t=this._decorationManager)||t.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,i){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findNextAndSelect(e,t,i);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_highlightAllMatches(e,t){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(e))return void this.clearDecorations();this.clearDecorations(!0);let i,r=[],s=this._engine.find(e,0,0,t);for(;s&&((null==i?void 0:i.row)!==s.row||(null==i?void 0:i.col)!==s.col)&&!(r.length>=this._highlightLimit);)i=s,r.push(i),s=this._engine.find(e,i.col+i.term.length>=this._terminal.cols?i.row+1:i.row,i.col+i.term.length>=this._terminal.cols?0:i.col+1,t);this._resultTracker.updateResults(r,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(r,t.decorations)}_findNextAndSelect(e,t,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,null==t?void 0:t.decorations,null==i?void 0:i.noScroll)}findPrevious(e,t,i){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findPreviousAndSelect(e,t,i);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_fireResults(e){this._resultTracker.fireResultsChanged(!!(null==e?void 0:e.decorations))}_findPreviousAndSelect(e,t,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,null==t?void 0:t.decorations,null==i?void 0:i.noScroll)}_selectResult(e,t,i){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!e)return this._terminal.clearSelection(),!1;if(this._terminal.select(e.col,e.row,e.size),t){let i=this._decorationManager.createActiveDecoration(e,t);i&&(this._resultTracker.selectedDecoration=i)}if(!i&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let t=e.row-this._terminal.buffer.active.viewportY;t-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(t)}return!0}},Zb=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?ry.isErrorNoTelemetry(e)?new ry(e.message+"\n\n"+e.stack):new Error(e.message+"\n\n"+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function Qb(e){(function(e){return e instanceof iy||e instanceof Error&&e.name===Jb&&e.message===Jb})(e)||Zb.onUnexpectedError(e)}var Jb="Canceled";var ey,ty,iy=class extends Error{constructor(){super(Jb),this.name=this.message}},ry=class e extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(t){if(t instanceof e)return t;let i=new e;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(e){return"CodeExpectedError"===e.name}};function sy(e,t){let i,r=this,s=!1;return function(){return s||(s=!0,t||(i=e.apply(r,arguments))),i}}function ny(e){if(ty.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(c_){t.push(c_)}if(1===t.length)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function oy(...e){return ay(()=>ny(e))}function ay(e){return{dispose:sy(()=>{e()})}}(e=>{e.isLessThan=function(e){return e<0},e.isLessThanOrEqual=function(e){return e<=0},e.isGreaterThan=function(e){return e>0},e.isNeitherLessOrGreaterThan=function(e){return 0===e},e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(ey||(ey={})),(e=>{function t(e){return e&&"object"==typeof e&&"function"==typeof e[Symbol.iterator]}e.is=t;let i=Object.freeze([]);function*r(e){yield e}e.empty=function(){return i},e.single=r,e.wrap=function(e){return t(e)?e:r(e)},e.from=function(e){return e||i},e.reverse=function*(e){for(let t=e.length-1;t>=0;t--)yield e[t]},e.isEmpty=function(e){return!e||!0===e[Symbol.iterator]().next().done},e.first=function(e){return e[Symbol.iterator]().next().value},e.some=function(e,t){let i=0;for(let r of e)if(t(r,i++))return!0;return!1},e.find=function(e,t){for(let i of e)if(t(i))return i},e.filter=function*(e,t){for(let i of e)t(i)&&(yield i)},e.map=function*(e,t){let i=0;for(let r of e)yield t(r,i++)},e.flatMap=function*(e,t){let i=0;for(let r of e)yield*t(r,i++)},e.concat=function*(...e){for(let t of e)yield*t},e.reduce=function(e,t,i){let r=i;for(let s of e)r=t(r,s);return r},e.slice=function*(e,t,i=e.length){for(t<0&&(t+=e.length),i<0?i+=e.length:i>e.length&&(i=e.length);t<i;t++)yield e[t]},e.consume=function(t,i=Number.POSITIVE_INFINITY){let r=[];if(0===i)return[r,t];let s=t[Symbol.iterator]();for(let n=0;n<i;n++){let t=s.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator]:()=>s}]},e.asyncToArray=async function(e){let t=[];for await(let i of e)t.push(i);return Promise.resolve(t)}})(ty||(ty={}));var ly=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(0!==this._toDispose.size)try{ny(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&this._toDispose.delete(e)}};ly.DISABLE_DISPOSED_WARNING=!1;var cy=ly,hy=class{constructor(){this._store=new cy,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};hy.None=Object.freeze({dispose(){}});var uy=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}clearAndLeak(){let e=this._value;return this._value=void 0,e}},dy=typeof process<"u"&&"title"in process,fy=dy?"node":navigator.userAgent,py=dy?"node":navigator.platform,_y=fy.includes("Firefox"),gy=fy.includes("Edge"),my=/^((?!chrome|android).)*safari/i.test(fy);py.indexOf("Linux");var vy,by,yy,Sy,wy,xy=0,Cy=0,ky=0,Ey=0,Ly={css:"#00000000",rgba:0};function Ry(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Ty(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function My(e){if(!e)throw new Error("value must not be falsy");return e}function Py(e){return 57508<=e&&e<=57558}function Ay(e){return Py(e)||function(e){return 9472<=e&&e<=9631}(e)}function Dy(e,t,i=0){return(e-(2*Math.round(t)-i))%(2*Math.round(t))}(e=>{e.toCss=function(e,t,i,r){return void 0!==r?`#${Ry(e)}${Ry(t)}${Ry(i)}${Ry(r)}`:`#${Ry(e)}${Ry(t)}${Ry(i)}`},e.toRgba=function(e,t,i,r=255){return(e<<24|t<<16|i<<8|r)>>>0},e.toColor=function(t,i,r,s){return{css:e.toCss(t,i,r,s),rgba:e.toRgba(t,i,r,s)}}})(vy||(vy={})),(e=>{function t(e,t){return Ey=Math.round(255*t),[xy,Cy,ky]=wy.toChannels(e.rgba),{css:vy.toCss(xy,Cy,ky,Ey),rgba:vy.toRgba(xy,Cy,ky,Ey)}}e.blend=function(e,t){if(1===(Ey=(255&t.rgba)/255))return{css:t.css,rgba:t.rgba};let i=t.rgba>>24&255,r=t.rgba>>16&255,s=t.rgba>>8&255,n=e.rgba>>24&255,o=e.rgba>>16&255,a=e.rgba>>8&255;return xy=n+Math.round((i-n)*Ey),Cy=o+Math.round((r-o)*Ey),ky=a+Math.round((s-a)*Ey),{css:vy.toCss(xy,Cy,ky),rgba:vy.toRgba(xy,Cy,ky)}},e.isOpaque=function(e){return!(255&~e.rgba)},e.ensureContrastRatio=function(e,t,i){let r=wy.ensureContrastRatio(e.rgba,t.rgba,i);if(r)return vy.toColor(r>>24&255,r>>16&255,r>>8&255)},e.opaque=function(e){let t=(255|e.rgba)>>>0;return[xy,Cy,ky]=wy.toChannels(t),{css:vy.toCss(xy,Cy,ky),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,i){return t(e,(Ey=255&e.rgba)*i/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}})(by||(by={})),(e=>{let t,i;try{let e=document.createElement("canvas");e.width=1,e.height=1;let r=e.getContext("2d",{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return xy=parseInt(e.slice(1,2).repeat(2),16),Cy=parseInt(e.slice(2,3).repeat(2),16),ky=parseInt(e.slice(3,4).repeat(2),16),vy.toColor(xy,Cy,ky);case 5:return xy=parseInt(e.slice(1,2).repeat(2),16),Cy=parseInt(e.slice(2,3).repeat(2),16),ky=parseInt(e.slice(3,4).repeat(2),16),Ey=parseInt(e.slice(4,5).repeat(2),16),vy.toColor(xy,Cy,ky,Ey);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 r=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(r)return xy=parseInt(r[1]),Cy=parseInt(r[2]),ky=parseInt(r[3]),Ey=Math.round(255*(void 0===r[5]?1:parseFloat(r[5]))),vy.toColor(xy,Cy,ky,Ey);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=e,"string"!=typeof t.fillStyle)throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[xy,Cy,ky,Ey]=t.getImageData(0,0,1,1).data,255!==Ey)throw new Error("css.toColor: Unsupported css format");return{rgba:vy.toRgba(xy,Cy,ky,Ey),css:e}}})(yy||(yy={})),(e=>{function t(e,t,i){let r=e/255,s=t/255,n=i/255;return.2126*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.7152*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t})(Sy||(Sy={})),(e=>{function t(e,t,i){let r=e>>24&255,s=e>>16&255,n=e>>8&255,o=t>>24&255,a=t>>16&255,l=t>>8&255,c=Ty(Sy.relativeLuminance2(o,a,l),Sy.relativeLuminance2(r,s,n));for(;c<i&&(o>0||a>0||l>0);)o-=Math.max(0,Math.ceil(.1*o)),a-=Math.max(0,Math.ceil(.1*a)),l-=Math.max(0,Math.ceil(.1*l)),c=Ty(Sy.relativeLuminance2(o,a,l),Sy.relativeLuminance2(r,s,n));return(o<<24|a<<16|l<<8|255)>>>0}function i(e,t,i){let r=e>>24&255,s=e>>16&255,n=e>>8&255,o=t>>24&255,a=t>>16&255,l=t>>8&255,c=Ty(Sy.relativeLuminance2(o,a,l),Sy.relativeLuminance2(r,s,n));for(;c<i&&(o<255||a<255||l<255);)o=Math.min(255,o+Math.ceil(.1*(255-o))),a=Math.min(255,a+Math.ceil(.1*(255-a))),l=Math.min(255,l+Math.ceil(.1*(255-l))),c=Ty(Sy.relativeLuminance2(o,a,l),Sy.relativeLuminance2(r,s,n));return(o<<24|a<<16|l<<8|255)>>>0}e.blend=function(e,t){if(1===(Ey=(255&t)/255))return t;let i=t>>24&255,r=t>>16&255,s=t>>8&255,n=e>>24&255,o=e>>16&255,a=e>>8&255;return xy=n+Math.round((i-n)*Ey),Cy=o+Math.round((r-o)*Ey),ky=a+Math.round((s-a)*Ey),vy.toRgba(xy,Cy,ky)},e.ensureContrastRatio=function(e,r,s){let n=Sy.relativeLuminance(e>>8),o=Sy.relativeLuminance(r>>8);if(Ty(n,o)<s){if(o<n){let o=t(e,r,s),a=Ty(n,Sy.relativeLuminance(o>>8));if(a<s){let t=i(e,r,s);return a>Ty(n,Sy.relativeLuminance(t>>8))?o:t}return o}let a=i(e,r,s),l=Ty(n,Sy.relativeLuminance(a>>8));if(l<s){let i=t(e,r,s);return l>Ty(n,Sy.relativeLuminance(i>>8))?a:i}return a}},e.reduceLuminance=t,e.increaseLuminance=i,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}})(wy||(wy={}));var Ny,Iy=0,By=0,Oy=!1,Fy=!1,zy=!1,jy=0,$y=class{constructor(e,t,i,r,s,n){this._terminal=e,this._optionService=t,this._selectionRenderModel=i,this._decorationService=r,this._coreBrowserService=s,this._themeService=n,this.result={fg:0,bg:0,ext:0}}resolve(e,t,i,r){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=268435456&e.bg?e.extended.ext:0,By=0,Iy=0,Fy=!1,Oy=!1,zy=!1,Ny=this._themeService.colors,jy=0,0!==e.getCode()&&4===e.extended.underlineStyle){let e=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));jy=t*r%(2*Math.round(e))}if(this._decorationService.forEachDecorationAtCell(t,i,"bottom",e=>{e.backgroundColorRGB&&(By=e.backgroundColorRGB.rgba>>8&16777215,Fy=!0),e.foregroundColorRGB&&(Iy=e.foregroundColorRGB.rgba>>8&16777215,Oy=!0)}),zy=this._selectionRenderModel.isCellSelected(this._terminal,t,i)){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:By=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:By=(16777215&this.result.fg)<<8|255;break;default:By=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:By=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:By=(16777215&this.result.bg)<<8|255}By=wy.blend(By,4294967040&(this._coreBrowserService.isFocused?Ny.selectionBackgroundOpaque:Ny.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else By=(this._coreBrowserService.isFocused?Ny.selectionBackgroundOpaque:Ny.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Fy=!0,Ny.selectionForeground&&(Iy=Ny.selectionForeground.rgba>>8&16777215,Oy=!0),Ay(e.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))Iy=(this._coreBrowserService.isFocused?Ny.selectionBackgroundOpaque:Ny.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:Iy=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:Iy=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:Iy=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:Iy=(16777215&this.result.fg)<<8|255;break;default:Iy=this._themeService.colors.foreground.rgba}Iy=wy.blend(Iy,4294967040&(this._coreBrowserService.isFocused?Ny.selectionBackgroundOpaque:Ny.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}Oy=!0}}this._decorationService.forEachDecorationAtCell(t,i,"top",e=>{e.backgroundColorRGB&&(By=e.backgroundColorRGB.rgba>>8&16777215,Fy=!0),e.foregroundColorRGB&&(Iy=e.foregroundColorRGB.rgba>>8&16777215,Oy=!0)}),Fy&&(By=zy?-16777216&e.bg&-134217729|By|50331648:-16777216&e.bg|By|50331648),Oy&&(Iy=-16777216&e.fg&-67108865|Iy|50331648),67108864&this.result.fg&&(Fy&&!Oy&&(Iy=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&Ny.background.rgba>>8|50331648,Oy=!0),!Fy&&Oy&&(By=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&Ny.foreground.rgba>>8|50331648,Fy=!0)),Ny=void 0,this.result.bg=Fy?By:this.result.bg,this.result.fg=Oy?Iy:this.result.fg,this.result.ext&=536870911,this.result.ext|=jy<<29&3758096384}},Wy=_y||gy?"bottom":"ideographic",Hy={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},Uy={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},qy={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},Ky={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};function Vy(e,t,i,r,s,n,o,a){let l=Hy[t];if(l)return function(e,t,i,r,s,n){for(let o=0;o<t.length;o++){let a=t[o],l=s/8,c=n/8;e.fillRect(i+a.x*l,r+a.y*c,a.w*l,a.h*c)}}(e,l,i,r,s,n),!0;let c=Uy[t];if(c)return function(e,t,i,r,s,n){let o=Gy.get(t);o||(o=new Map,Gy.set(t,o));let a=e.fillStyle;if("string"!=typeof a)throw new Error(`Unexpected fillStyle type "${a}"`);let l=o.get(a);if(!l){let i=t[0].length,r=t.length,s=e.canvas.ownerDocument.createElement("canvas");s.width=i,s.height=r;let n,c,h,u,d=My(s.getContext("2d")),f=new ImageData(i,r);if(a.startsWith("#"))n=parseInt(a.slice(1,3),16),c=parseInt(a.slice(3,5),16),h=parseInt(a.slice(5,7),16),u=a.length>7&&parseInt(a.slice(7,9),16)||1;else{if(!a.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${a}" when drawing pattern glyph`);[n,c,h,u]=a.substring(5,a.length-1).split(",").map(e=>parseFloat(e))}for(let e=0;e<r;e++)for(let r=0;r<i;r++)f.data[4*(e*i+r)]=n,f.data[4*(e*i+r)+1]=c,f.data[4*(e*i+r)+2]=h,f.data[4*(e*i+r)+3]=t[e][r]*(255*u);d.putImageData(f,0,0),l=My(e.createPattern(s,null)),o.set(a,l)}e.fillStyle=l,e.fillRect(i,r,s,n)}(e,c,i,r,s,n),!0;let h=qy[t];if(h)return function(e,t,i,r,s,n,o){e.strokeStyle=e.fillStyle;for(let[a,l]of Object.entries(t)){let t;if(e.beginPath(),e.lineWidth=o*Number.parseInt(a),"function"==typeof l){t=l(.15,.15/n*s)}else t=l;for(let a of t.split(" ")){let t=a[0],l=Xy[t];if(!l){console.error(`Could not find drawing instructions for "${t}"`);continue}let c=a.substring(1).split(",");!c[0]||!c[1]||l(e,Zy(c,s,n,i,r,!0,o))}e.stroke(),e.closePath()}}(e,h,i,r,s,n,a),!0;let u=Ky[t];return!!u&&(function(e,t,i,r,s,n,o,a){let l=new Path2D;l.rect(i,r,s,n),e.clip(l),e.beginPath();let c=o/12;e.lineWidth=a*c;for(let h of t.d.split(" ")){let o=h[0],l=Xy[o];if(!l){console.error(`Could not find drawing instructions for "${o}"`);continue}let u=h.substring(1).split(",");!u[0]||!u[1]||l(e,Zy(u,s,n,i,r,!1,a,(t.leftPadding??0)*(c/2),(t.rightPadding??0)*(c/2)))}1===t.type?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}(e,u,i,r,s,n,o,a),!0)}Ky[""]=Ky[""],Ky[""]=Ky[""];var Gy=new Map;function Yy(e,t,i=0){return Math.max(Math.min(e,t),i)}var Xy={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function Zy(e,t,i,r,s,n,o,a=0,l=0){let c=e.map(e=>parseFloat(e)||parseInt(e));if(c.length<2)throw new Error("Too few arguments for instruction");for(let h=0;h<c.length;h+=2)c[h]*=t-a*o-l*o,n&&0!==c[h]&&(c[h]=Yy(Math.round(c[h]+.5)-.5,t,0)),c[h]+=r+a*o;for(let h=1;h<c.length;h+=2)c[h]*=i,n&&0!==c[h]&&(c[h]=Yy(Math.round(c[h]+.5)-.5,i,0)),c[h]+=s;return c}var Qy,Jy=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},eS=class{constructor(){this._data=new Jy}set(e,t,i,r,s){this._data.get(e,t)||this._data.set(e,t,new Jy),this._data.get(e,t).set(i,r,s)}get(e,t,i,r){var s;return null==(s=this._data.get(e,t))?void 0:s.get(i,r)}clear(){this._data.clear()}},tS=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,i=0,r=e.timeRemaining(),s=0;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 r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),void this._start();r=s}this.clear()}},iS=!dy&&"requestIdleCallback"in window?class extends tS{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:class extends tS{_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())}}},rS=class e{constructor(){this.fg=0,this.bg=0,this.extended=new sS}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}},sS=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}},nS=globalThis.performance&&"function"==typeof globalThis.performance.now,oS=class e{static create(t){return new e(t)}constructor(e){this._now=nS&&!1===e?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return-1!==this._stopTime?this._stopTime-this._startTime:this._now()-this._startTime}};(e=>{function t(e){return(t,i=null,r)=>{let s,n=!1;return s=e(e=>{if(!n)return s?s.dispose():n=!0,t.call(i,e)},null,r),n&&s.dispose(),s}}function i(e,t,i){return s((i,r=null,s)=>e(e=>i.call(r,t(e)),null,s),i)}function r(e,t,i){return s((i,r=null,s)=>e(e=>t(e)&&i.call(r,e),null,s),i)}function s(e,t){let i,r=new mS({onWillAddFirstListener(){i=e(r.fire,r)},onDidRemoveLastListener(){null==i||i.dispose()}});return null==t||t.add(r),r.event}function n(e,t,i=100,r=!1,s=!1,n,o){let a,l,c,h,u=0,d=new mS({leakWarningThreshold:n,onWillAddFirstListener(){a=e(e=>{u++,l=t(l,e),r&&!c&&(d.fire(l),l=void 0),h=()=>{let e=l;l=void 0,c=void 0,(!r||u>1)&&d.fire(e),u=0},"number"==typeof i?(clearTimeout(c),c=setTimeout(h,i)):void 0===c&&(c=0,queueMicrotask(h))})},onWillRemoveListener(){s&&u>0&&(null==h||h())},onDidRemoveLastListener(){h=void 0,a.dispose()}});return null==o||o.add(d),d.event}e.None=()=>hy.None,e.defer=function(e,t){return n(e,()=>{},0,void 0,!0,void 0,t)},e.once=t,e.map=i,e.forEach=function(e,t,i){return s((i,r=null,s)=>e(e=>{t(e),i.call(r,e)},null,s),i)},e.filter=r,e.signal=function(e){return e},e.any=function(...e){return(t,i=null,r)=>function(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}(oy(...e.map(e=>e(e=>t.call(i,e)))),r)},e.reduce=function(e,t,r,s){let n=r;return i(e,e=>(n=t(n,e),n),s)},e.debounce=n,e.accumulate=function(t,i=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],i,void 0,!0,void 0,r)},e.latch=function(e,t=(e,t)=>e===t,i){let s,n=!0;return r(e,e=>{let i=n||!t(e,s);return n=!1,s=e,i},i)},e.split=function(t,i,r){return[e.filter(t,i,r),e.filter(t,e=>!i(e),r)]},e.buffer=function(e,t=!1,i=[],r){let s=i.slice(),n=e(e=>{s?s.push(e):a.fire(e)});r&&r.add(n);let o=()=>{null==s||s.forEach(e=>a.fire(e)),s=null},a=new mS({onWillAddFirstListener(){n||(n=e(e=>a.fire(e)),r&&r.add(n))},onDidAddFirstListener(){s&&(t?setTimeout(o):o())},onDidRemoveLastListener(){n&&n.dispose(),n=null}});return r&&r.add(a),a.event},e.chain=function(e,t){return(i,r,s)=>{let n=t(new a);return e(function(e){let t=n.evaluate(e);t!==o&&i.call(r,t)},void 0,s)}};let o=Symbol("HaltChainable");class a{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:o),this}reduce(e,t){let i=t;return this.steps.push(t=>(i=e(i,t),i)),this}latch(e=(e,t)=>e===t){let t,i=!0;return this.steps.push(r=>{let s=i||!e(r,t);return i=!1,t=r,s?r:o}),this}evaluate(e){for(let t of this.steps)if((e=t(e))===o)break;return e}}e.fromNodeEventEmitter=function(e,t,i=e=>e){let r=(...e)=>s.fire(i(...e)),s=new mS({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return s.event},e.fromDOMEventEmitter=function(e,t,i=e=>e){let r=(...e)=>s.fire(i(...e)),s=new mS({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return s.event},e.toPromise=function(e){return new Promise(i=>t(e)(i))},e.fromPromise=function(e){let t=new mS;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event},e.forward=function(e,t){return e(e=>t.fire(e))},e.runAndSubscribe=function(e,t,i){return t(i),e(e=>t(e))};class l{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let i={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new mS(i),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,0===this._counter&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}e.fromObservable=function(e,t){return new l(e,t).emitter.event},e.fromObservableLight=function(e){return(t,i,r)=>{let s=0,n=!1,o={beginUpdate(){s++},endUpdate(){s--,0===s&&(e.reportChanges(),n&&(n=!1,t.call(i)))},handlePossibleChange(){},handleChange(){n=!0}};e.addObserver(o),e.reportChanges();let a={dispose(){e.removeObserver(o)}};return r instanceof cy?r.add(a):Array.isArray(r)&&r.push(a),a}}})(Qy||(Qy={}));var aS=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new oS,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};aS.all=new Set,aS._idPool=0;var lS=aS,cS=class e{constructor(t,i,r=(e._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=r,this._warnCountdown=0}dispose(){var e;null==(e=this._stacks)||e.clear()}check(e,t){let i=this.threshold;if(i<=0||t<i)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=.5*i;let[e,r]=this.getMostFrequentStack(),s=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(s),console.warn(e);let n=new fS(s,e);this._errorHandler(n)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[i,r]of this._stacks)(!e||t<r)&&(e=[i,r],t=r);return e}};cS._idPool=1;var hS,uS=cS,dS=class e{constructor(e){this.value=e}static create(){let t=new Error;return new e(t.stack??"")}print(){console.warn(this.value.split("\n").slice(2).join("\n"))}},fS=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},pS=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},_S=0,gS=class{constructor(e){this.value=e,this.id=_S++}},mS=class{constructor(e){var t,i,r,s;this._size=0,this._options=e,this._leakageMon=(null==(t=this._options)?void 0:t.leakWarningThreshold)?new uS((null==e?void 0:e.onListenerError)??Qb,(null==(i=this._options)?void 0:i.leakWarningThreshold)??-1):void 0,this._perfMon=(null==(r=this._options)?void 0:r._profName)?new lS(this._options._profName):void 0,this._deliveryQueue=null==(s=this._options)?void 0:s.deliveryQueue}dispose(){var e,t,i,r;this._disposed||(this._disposed=!0,(null==(e=this._deliveryQueue)?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),null==(i=null==(t=this._options)?void 0:t.onDidRemoveLastListener)||i.call(t),null==(r=this._leakageMon)||r.dispose())}get event(){return this._event??(this._event=(e,t,i)=>{var r,s,n,o,a;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],i=new pS(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return((null==(r=this._options)?void 0:r.onListenerError)||Qb)(i),hy.None}if(this._disposed)return hy.None;t&&(e=e.bind(t));let l,c=new gS(e);this._leakageMon&&this._size>=Math.ceil(.2*this._leakageMon.threshold)&&(c.stack=dS.create(),l=this._leakageMon.check(c.stack,this._size+1)),this._listeners?this._listeners instanceof gS?(this._deliveryQueue??(this._deliveryQueue=new vS),this._listeners=[this._listeners,c]):this._listeners.push(c):(null==(n=null==(s=this._options)?void 0:s.onWillAddFirstListener)||n.call(s,this),this._listeners=c,null==(a=null==(o=this._options)?void 0:o.onDidAddFirstListener)||a.call(o,this)),this._size++;let h=ay(()=>{null==l||l(),this._removeListener(c)});return i instanceof cy?i.add(h):Array.isArray(i)&&i.push(h),h}),this._event}_removeListener(e){var t,i,r,s;if(null==(i=null==(t=this._options)?void 0:t.onWillRemoveListener)||i.call(t,this),!this._listeners)return;if(1===this._size)return this._listeners=void 0,null==(s=null==(r=this._options)?void 0:r.onDidRemoveLastListener)||s.call(r,this),void(this._size=0);let n=this._listeners,o=n.indexOf(e);if(-1===o)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,n[o]=void 0;let a=this._deliveryQueue.current===this;if(2*this._size<=n.length){let e=0;for(let t=0;t<n.length;t++)n[t]?n[e++]=n[t]:a&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=e}}_deliver(e,t){var i;if(!e)return;let r=(null==(i=this._options)?void 0:i.onListenerError)||Qb;if(r)try{e.value(t)}catch(s){r(s)}else e.value(t)}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,i,r,s;if((null==(t=this._deliveryQueue)?void 0:t.current)&&(this._deliverQueue(this._deliveryQueue),null==(i=this._perfMon)||i.stop()),null==(r=this._perfMon)||r.start(this._size),this._listeners)if(this._listeners instanceof gS)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}null==(s=this._perfMon)||s.stop()}hasListeners(){return this._size>0}},vS=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},bS={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},yS=class e{constructor(e,t,i){this._document=e,this._config=t,this._unicodeService=i,this._didWarmUp=!1,this._cacheMap=new eS,this._cacheMapCombined=new eS,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new rS,this._textureSize=512,this._onAddTextureAtlasCanvas=new mS,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new mS,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=xS(e,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=My(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let e=new iS;for(let t=33;t<126;t++)e.enqueue(()=>{if(!this._cacheMap.get(t,0,0,0)){let e=this._drawToCache(t,0,0,0,!1,void 0);this._cacheMap.set(t,0,0,0,e)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(0!==this._pages[0].currentRow.x||0!==this._pages[0].currentRow.y){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(e.maxAtlasPages&&this._pages.length>=Math.max(4,e.maxAtlasPages)){let t=this._pages.filter(t=>2*t.canvas.width<=(e.maxTextureSize||4096)).sort((e,t)=>t.canvas.width!==e.canvas.width?t.canvas.width-e.canvas.width:t.percentageUsed-e.percentageUsed),i=-1,r=0;for(let e=0;e<t.length;e++)if(t[e].canvas.width!==r)i=e,r=t[e].canvas.width;else if(e-i===3)break;let s=t.slice(i,i+4),n=s.map(e=>e.glyphs[0].texturePage).sort((e,t)=>e>t?1:-1),o=this.pages.length-s.length,a=this._mergePages(s,o);a.version++;for(let e=n.length-1;e>=0;e--)this._deletePage(n[e]);this.pages.push(a),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(a.canvas)}let t=new SS(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(e,t){let i=2*e[0].canvas.width,r=new SS(this._document,i,e);for(let[s,n]of e.entries()){let e=s*n.canvas.width%i,o=Math.floor(s/2)*n.canvas.height;r.ctx.drawImage(n.canvas,e,o);for(let r of n.glyphs)r.texturePage=t,r.sizeClipSpace.x=r.size.x/i,r.sizeClipSpace.y=r.size.y/i,r.texturePosition.x+=e,r.texturePosition.y+=o,r.texturePositionClipSpace.x=r.texturePosition.x/i,r.texturePositionClipSpace.y=r.texturePosition.y/i;this._onRemoveTextureAtlasCanvas.fire(n.canvas);let a=this._activePages.indexOf(n);-1!==a&&this._activePages.splice(a,1)}return r}_deletePage(e){this._pages.splice(e,1);for(let t=e;t<this._pages.length;t++){let e=this._pages[t];for(let t of e.glyphs)t.texturePage--;e.version++}}getRasterizedGlyphCombinedChar(e,t,i,r,s,n){return this._getFromCacheMap(this._cacheMapCombined,e,t,i,r,s,n)}getRasterizedGlyph(e,t,i,r,s,n){return this._getFromCacheMap(this._cacheMap,e,t,i,r,s,n)}_getFromCacheMap(e,t,i,r,s,n,o){return(hS=e.get(t,i,r,s))||(hS=this._drawToCache(t,i,r,s,n,o),e.set(t,i,r,s,hS)),hS}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw new Error("No color found for idx "+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,i,r){if(this._config.allowTransparency)return Ly;let s;switch(e){case 16777216:case 33554432:s=this._getColorFromAnsiIndex(t);break;case 50331648:let e=rS.toColorRGB(t);s=vy.toColor(e[0],e[1],e[2]);break;default:s=i?by.opaque(this._config.colors.foreground):this._config.colors.background}return this._config.allowTransparency||(s=by.opaque(s)),s}_getForegroundColor(e,t,i,r,s,n,o,a,l,c){let h,u=this._getMinimumContrastColor(e,t,i,r,s,n,o,l,a,c);if(u)return u;switch(s){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&l&&n<8&&(n+=8),h=this._getColorFromAnsiIndex(n);break;case 50331648:let e=rS.toColorRGB(n);h=vy.toColor(e[0],e[1],e[2]);break;default:h=o?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(h=by.opaque(h)),a&&(h=by.multiplyOpacity(h,.5)),h}_resolveBackgroundRgba(e,t,i){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return i?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,i,r){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return i?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,i,r,s,n,o,a,l,c){if(1===this._config.minimumContrastRatio||c)return;let h=this._getContrastCache(l),u=h.getColor(e,r);if(void 0!==u)return u||void 0;let d=this._resolveBackgroundRgba(t,i,o),f=this._resolveForegroundRgba(s,n,o,a),p=wy.ensureContrastRatio(d,f,this._config.minimumContrastRatio/(l?2:1));if(!p)return void h.setColor(e,r,null);let _=vy.toColor(p>>24&255,p>>16&255,p>>8&255);return h.setColor(e,r,_),_}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,i,r,s,n,o){let a="number"==typeof t?String.fromCharCode(t):t;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display="none",o.append(this._tmpCanvas));let l=Math.min(this._config.deviceCellWidth*Math.max(a.length,2)+4,this._config.deviceMaxTextureSize);this._tmpCanvas.width<l&&(this._tmpCanvas.width=l);let c=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<c&&(this._tmpCanvas.height=c),this._tmpCtx.save(),this._workAttributeData.fg=r,this._workAttributeData.bg=i,this._workAttributeData.extended.ext=s,this._workAttributeData.isInvisible())return bS;let h=!!this._workAttributeData.isBold(),u=!!this._workAttributeData.isInverse(),d=!!this._workAttributeData.isDim(),f=!!this._workAttributeData.isItalic(),p=!!this._workAttributeData.isUnderline(),_=!!this._workAttributeData.isStrikethrough(),g=!!this._workAttributeData.isOverline(),m=this._workAttributeData.getFgColor(),v=this._workAttributeData.getFgColorMode(),b=this._workAttributeData.getBgColor(),y=this._workAttributeData.getBgColorMode();if(u){let e=m;m=b,b=e;let t=v;v=y,y=t}let S=this._getBackgroundColor(y,b,u,d);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=S.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let w=h?this._config.fontWeightBold:this._config.fontWeight,x=f?"italic":"";this._tmpCtx.font=`${x} ${w} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=Wy;let C=1===a.length&&Py(a.charCodeAt(0)),k=1===a.length&&function(e){return 57520<=e&&e<=57527}(a.charCodeAt(0)),E=this._getForegroundColor(i,y,b,r,v,m,u,d,h,Ay(a.charCodeAt(0)));this._tmpCtx.fillStyle=E.css;let L=k?0:4,R=!1;!1!==this._config.customGlyphs&&(R=Vy(this._tmpCtx,a,L,L,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let T,M=!C;if(T="number"==typeof t?this._unicodeService.wcwidth(t):this._unicodeService.getStringCellWidth(t),p){this._tmpCtx.save();let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;if(this._tmpCtx.lineWidth=e,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())M=!1,this._tmpCtx.strokeStyle=`rgb(${rS.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{M=!1;let e=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&e<8&&(e+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(e).css}this._tmpCtx.beginPath();let i=L,r=Math.ceil(L+this._config.deviceCharHeight)-t-(n?2*e:0),s=r+e,o=r+2*e,l=this._workAttributeData.getUnderlineVariantOffset();for(let n=0;n<T;n++){this._tmpCtx.save();let a=i+n*this._config.deviceCellWidth,c=i+(n+1)*this._config.deviceCellWidth,h=a+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(a,r),this._tmpCtx.lineTo(c,r),this._tmpCtx.moveTo(a,o),this._tmpCtx.lineTo(c,o);break;case 3:let i=e<=1?o:Math.ceil(L+this._config.deviceCharHeight-e/2)-t,n=e<=1?r:Math.ceil(L+this._config.deviceCharHeight+e/2)-t,u=new Path2D;u.rect(a,r,this._config.deviceCellWidth,o-r),this._tmpCtx.clip(u),this._tmpCtx.moveTo(a-this._config.deviceCellWidth/2,s),this._tmpCtx.bezierCurveTo(a-this._config.deviceCellWidth/2,n,a,n,a,s),this._tmpCtx.bezierCurveTo(a,i,h,i,h,s),this._tmpCtx.bezierCurveTo(h,n,c,n,c,s),this._tmpCtx.bezierCurveTo(c,i,c+this._config.deviceCellWidth/2,i,c+this._config.deviceCellWidth/2,s);break;case 4:let d=0===l?0:l>=e?2*e-l:e-l;!1==!(l>=e)||0===d?(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(a+d,r),this._tmpCtx.lineTo(c,r)):(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(a,r),this._tmpCtx.lineTo(a+d,r),this._tmpCtx.moveTo(a+d+e,r),this._tmpCtx.lineTo(c,r)),l=Dy(c-a,e,l);break;case 5:let f=.6,p=.3,_=c-a,g=Math.floor(f*_),m=Math.floor(p*_),v=_-g-m;this._tmpCtx.setLineDash([g,m,v]),this._tmpCtx.moveTo(a,r),this._tmpCtx.lineTo(c,r);break;default:this._tmpCtx.moveTo(a,r),this._tmpCtx.lineTo(c,r)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!R&&this._config.fontSize>=12&&!this._config.allowTransparency&&" "!==a){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let t=this._tmpCtx.measureText(a);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in t&&t.actualBoundingBoxDescent>0){this._tmpCtx.save();let t=new Path2D;t.rect(i,r-Math.ceil(e/2),this._config.deviceCellWidth*T,o-r+Math.ceil(e/2)),this._tmpCtx.clip(t),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=S.css,this._tmpCtx.strokeText(a,L,L+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(g){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(L,L+t),this._tmpCtx.lineTo(L+this._config.deviceCharWidth*T,L+t),this._tmpCtx.stroke()}if(R||this._tmpCtx.fillText(a,L,L+this._config.deviceCharHeight),"_"===a&&!this._config.allowTransparency){let e=wS(this._tmpCtx.getImageData(L,L,this._config.deviceCellWidth,this._config.deviceCellHeight),S,E,M);if(e)for(let t=1;t<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=S.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(a,L,L+this._config.deviceCharHeight-t),e=wS(this._tmpCtx.getImageData(L,L,this._config.deviceCellWidth,this._config.deviceCellHeight),S,E,M),e);t++);}if(_){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),t=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(L,L+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.lineTo(L+this._config.deviceCharWidth*T,L+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.stroke()}this._tmpCtx.restore();let P,A=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);if(P=this._config.allowTransparency?function(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}(A):wS(A,S,E,M),P)return bS;let D,N,I=this._findGlyphBoundingBox(A,this._workBoundingBox,l,k,R,L);for(;;){if(0===this._activePages.length){let e=this._createNewPage();D=e,N=e.currentRow,N.height=I.size.y;break}D=this._activePages[this._activePages.length-1],N=D.currentRow;for(let e of this._activePages)I.size.y<=e.currentRow.height&&(D=e,N=e.currentRow);for(let e=this._activePages.length-1;e>=0;e--)for(let t of this._activePages[e].fixedRows)t.height<=N.height&&I.size.y<=t.height&&(D=this._activePages[e],N=t);if(I.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new SS(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),D=this._overflowSizePage,N=this._overflowSizePage.currentRow,N.x+I.size.x>=D.canvas.width&&(N.x=0,N.y+=N.height,N.height=0);break}if(N.y+I.size.y>=D.canvas.height||N.height>I.size.y+2){let t=!1;if(D.currentRow.y+D.currentRow.height+I.size.y>=D.canvas.height){let i;for(let e of this._activePages)if(e.currentRow.y+e.currentRow.height+I.size.y<e.canvas.height){i=e;break}if(i)D=i;else if(e.maxAtlasPages&&this._pages.length>=e.maxAtlasPages&&N.y+I.size.y<=D.canvas.height&&N.height>=I.size.y&&N.x+I.size.x<=D.canvas.width)t=!0;else{let e=this._createNewPage();D=e,N=e.currentRow,N.height=I.size.y,t=!0}}t||(D.currentRow.height>0&&D.fixedRows.push(D.currentRow),N={x:0,y:D.currentRow.y+D.currentRow.height,height:I.size.y},D.fixedRows.push(N),D.currentRow={x:0,y:N.y+N.height,height:0})}if(N.x+I.size.x<=D.canvas.width)break;N===D.currentRow?(N.x=0,N.y+=N.height,N.height=0):D.fixedRows.splice(D.fixedRows.indexOf(N),1)}return I.texturePage=this._pages.indexOf(D),I.texturePosition.x=N.x,I.texturePosition.y=N.y,I.texturePositionClipSpace.x=N.x/D.canvas.width,I.texturePositionClipSpace.y=N.y/D.canvas.height,I.sizeClipSpace.x/=D.canvas.width,I.sizeClipSpace.y/=D.canvas.height,N.height=Math.max(N.height,I.size.y),N.x+=I.size.x,D.ctx.putImageData(A,I.texturePosition.x-this._workBoundingBox.left,I.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,I.size.x,I.size.y),D.addGlyph(I),D.version++,I}_findGlyphBoundingBox(e,t,i,r,s,n){t.top=0;let o=r?this._config.deviceCellHeight:this._tmpCanvas.height,a=r?this._config.deviceCellWidth:i,l=!1;for(let c=0;c<o;c++){for(let i=0;i<a;i++){let r=c*this._tmpCanvas.width*4+4*i+3;if(0!==e.data[r]){t.top=c,l=!0;break}}if(l)break}t.left=0,l=!1;for(let c=0;c<n+a;c++){for(let i=0;i<o;i++){let r=i*this._tmpCanvas.width*4+4*c+3;if(0!==e.data[r]){t.left=c,l=!0;break}}if(l)break}t.right=a,l=!1;for(let c=n+a-1;c>=n;c--){for(let i=0;i<o;i++){let r=i*this._tmpCanvas.width*4+4*c+3;if(0!==e.data[r]){t.right=c,l=!0;break}}if(l)break}t.bottom=o,l=!1;for(let c=o-1;c>=0;c--){for(let i=0;i<a;i++){let r=c*this._tmpCanvas.width*4+4*i+3;if(0!==e.data[r]){t.bottom=c,l=!0;break}}if(l)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:t.right-t.left+1,y:t.bottom-t.top+1},sizeClipSpace:{x:t.right-t.left+1,y:t.bottom-t.top+1},offset:{x:-t.left+n+(r||s?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-t.top+n+(r||s?1===this._config.lineHeight?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},SS=class{constructor(e,t,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let r of i)this._glyphs.push(...r.glyphs),this._usedPixels+=r._usedPixels;this.canvas=xS(e,t,t),this.ctx=My(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(e){this._glyphs.push(e),this._usedPixels+=e.size.x*e.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function wS(e,t,i,r){let s=t.rgba>>>24,n=t.rgba>>>16&255,o=t.rgba>>>8&255,a=i.rgba>>>24,l=i.rgba>>>16&255,c=i.rgba>>>8&255,h=Math.floor((Math.abs(s-a)+Math.abs(n-l)+Math.abs(o-c))/12),u=!0;for(let d=0;d<e.data.length;d+=4)e.data[d]===s&&e.data[d+1]===n&&e.data[d+2]===o||r&&Math.abs(e.data[d]-s)+Math.abs(e.data[d+1]-n)+Math.abs(e.data[d+2]-o)<h?e.data[d+3]=0:u=!1;return u}function xS(e,t,i){let r=e.createElement("canvas");return r.width=t,r.height=i,r}function CS(e,t){for(let i=0;i<e.colors.ansi.length;i++)if(e.colors.ansi[i].rgba!==t.colors.ansi[i].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}var kS=[];function ES(e,t,i,r,s,n,o,a,l){let c=function(e,t,i,r,s,n,o,a){let l={foreground:n.foreground,background:n.background,cursor:Ly,cursorAccent:Ly,selectionForeground:Ly,selectionBackgroundTransparent:Ly,selectionBackgroundOpaque:Ly,selectionInactiveBackgroundTransparent:Ly,selectionInactiveBackgroundOpaque:Ly,overviewRulerBorder:Ly,scrollbarSliderBackground:Ly,scrollbarSliderHoverBackground:Ly,scrollbarSliderActiveBackground:Ly,ansi:n.ansi.slice(),contrastCache:n.contrastCache,halfContrastCache:n.halfContrastCache};return{customGlyphs:s.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:a,letterSpacing:s.letterSpacing,lineHeight:s.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:i,deviceCharHeight:r,fontFamily:s.fontFamily,fontSize:s.fontSize,fontWeight:s.fontWeight,fontWeightBold:s.fontWeightBold,allowTransparency:s.allowTransparency,drawBoldTextInBrightColors:s.drawBoldTextInBrightColors,minimumContrastRatio:s.minimumContrastRatio,colors:l}}(r,s,n,o,t,i,a,l);for(let d=0;d<kS.length;d++){let t=kS[d],i=t.ownedBy.indexOf(e);if(i>=0){if(CS(t.config,c))return t.atlas;1===t.ownedBy.length?(t.atlas.dispose(),kS.splice(d,1)):t.ownedBy.splice(i,1);break}}for(let d=0;d<kS.length;d++){let t=kS[d];if(CS(t.config,c))return t.ownedBy.push(e),t.atlas}let h=e._core,u={atlas:new yS(document,c,h.unicodeService),config:c,ownedBy:[e]};return kS.push(u),u.atlas}function LS(e){for(let t=0;t<kS.length;t++){let i=kS[t].ownedBy.indexOf(e);if(-1!==i){1===kS[t].ownedBy.length?(kS[t].atlas.dispose(),kS.splice(t,1)):kS[t].ownedBy.splice(i,1);break}}}var RS=600,TS=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let e=RS-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0)return void this._restartInterval(e)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let e=RS-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(e)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},RS)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function MS(e,t,i){let r=new t.ResizeObserver(t=>{let s=t.find(t=>t.target===e);if(!s)return;if(!("devicePixelContentBoxSize"in s))return null==r||r.disconnect(),void(r=void 0);let n=s.devicePixelContentBoxSize[0].inlineSize,o=s.devicePixelContentBoxSize[0].blockSize;n>0&&o>0&&i(n,o)});try{r.observe(e,{box:["device-pixel-content-box"]})}catch{r.disconnect(),r=void 0}return ay(()=>null==r?void 0:r.disconnect())}var PS=class e extends rS{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new sS,this.combinedData=""}static fromCharData(t){let i=new e;return i.setFromCharData(t),i}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(2===e[1].length){let i=e[1].charCodeAt(0);if(55296<=i&&i<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(i-55296)+r-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()]}},AS=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function DS(e,t,i){let r=My(e.createProgram());if(e.attachShader(r,My(NS(e,e.VERTEX_SHADER,t))),e.attachShader(r,My(NS(e,e.FRAGMENT_SHADER,i))),e.linkProgram(r),e.getProgramParameter(r,e.LINK_STATUS))return r;console.error(e.getProgramInfoLog(r)),e.deleteProgram(r)}function NS(e,t,i){let r=My(e.createShader(t));if(e.shaderSource(r,i),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS))return r;console.error(e.getShaderInfoLog(r)),e.deleteShader(r)}var IS=class{constructor(e){this.texture=e,this.version=-1}};var BS,OS=11,FS=OS*Float32Array.BYTES_PER_ELEMENT,zS=0,jS=0,$S=0,WS=class extends hy{constructor(e,t,i,r){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._optionsService=r,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let s=this._gl;void 0===yS.maxAtlasPages&&(yS.maxAtlasPages=Math.min(32,My(s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS))),yS.maxTextureSize=My(s.getParameter(s.MAX_TEXTURE_SIZE))),this._program=My(DS(s,"#version 300 es\nlayout (location = 0) in vec2 a_unitquad;\nlayout (location = 1) in vec2 a_cellpos;\nlayout (location = 2) in vec2 a_offset;\nlayout (location = 3) in vec2 a_size;\nlayout (location = 4) in float a_texpage;\nlayout (location = 5) in vec2 a_texcoord;\nlayout (location = 6) in vec2 a_texsize;\n\nuniform mat4 u_projection;\nuniform vec2 u_resolution;\n\nout vec2 v_texcoord;\nflat out int v_texpage;\n\nvoid main() {\n vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);\n gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);\n v_texpage = int(a_texpage);\n v_texcoord = a_texcoord + a_unitquad * a_texsize;\n}",function(e){let t="";for(let i=1;i<e;i++)t+=` else if (v_texpage == ${i}) { outColor = texture(u_texture[${i}], v_texcoord); }`;return`#version 300 es\nprecision lowp float;\n\nin vec2 v_texcoord;\nflat in int v_texpage;\n\nuniform sampler2D u_texture[${e}];\n\nout vec4 outColor;\n\nvoid main() {\n if (v_texpage == 0) {\n outColor = texture(u_texture[0], v_texcoord);\n } ${t}\n}`}(yS.maxAtlasPages))),this._register(ay(()=>s.deleteProgram(this._program))),this._projectionLocation=My(s.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=My(s.getUniformLocation(this._program,"u_resolution")),this._textureLocation=My(s.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=s.createVertexArray(),s.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=s.createBuffer();this._register(ay(()=>s.deleteBuffer(o))),s.bindBuffer(s.ARRAY_BUFFER,o),s.bufferData(s.ARRAY_BUFFER,n,s.STATIC_DRAW),s.enableVertexAttribArray(0),s.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),l=s.createBuffer();this._register(ay(()=>s.deleteBuffer(l))),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,l),s.bufferData(s.ELEMENT_ARRAY_BUFFER,a,s.STATIC_DRAW),this._attributesBuffer=My(s.createBuffer()),this._register(ay(()=>s.deleteBuffer(this._attributesBuffer))),s.bindBuffer(s.ARRAY_BUFFER,this._attributesBuffer),s.enableVertexAttribArray(2),s.vertexAttribPointer(2,2,s.FLOAT,!1,FS,0),s.vertexAttribDivisor(2,1),s.enableVertexAttribArray(3),s.vertexAttribPointer(3,2,s.FLOAT,!1,FS,2*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(3,1),s.enableVertexAttribArray(4),s.vertexAttribPointer(4,1,s.FLOAT,!1,FS,4*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(4,1),s.enableVertexAttribArray(5),s.vertexAttribPointer(5,2,s.FLOAT,!1,FS,5*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(5,1),s.enableVertexAttribArray(6),s.vertexAttribPointer(6,2,s.FLOAT,!1,FS,7*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(6,1),s.enableVertexAttribArray(1),s.vertexAttribPointer(1,2,s.FLOAT,!1,FS,9*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(1,1),s.useProgram(this._program);let c=new Int32Array(yS.maxAtlasPages);for(let h=0;h<yS.maxAtlasPages;h++)c[h]=h;s.uniform1iv(this._textureLocation,c),s.uniformMatrix4fv(this._projectionLocation,!1,AS),this._atlasTextures=[];for(let h=0;h<yS.maxAtlasPages;h++){let e=new IS(My(s.createTexture()));this._register(ay(()=>s.deleteTexture(e.texture))),s.activeTexture(s.TEXTURE0+h),s.bindTexture(s.TEXTURE_2D,e.texture),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,1,1,0,s.RGBA,s.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[h]=e}s.enable(s.BLEND),s.blendFunc(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(e,t,i,r,s,n,o,a,l){this._updateCell(this._vertices.attributes,e,t,i,r,s,n,o,a,l)}_updateCell(e,t,i,r,s,n,o,a,l,c){zS=(i*this._terminal.cols+t)*OS,0!==r&&void 0!==r?this._atlas&&(BS=a&&a.length>1?this._atlas.getRasterizedGlyphCombinedChar(a,s,n,o,!1,this._terminal.element):this._atlas.getRasterizedGlyph(r,s,n,o,!1,this._terminal.element),jS=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),s!==c&&BS.offset.x>jS?($S=BS.offset.x-jS,e[zS]=-(BS.offset.x-$S)+this._dimensions.device.char.left,e[zS+1]=-BS.offset.y+this._dimensions.device.char.top,e[zS+2]=(BS.size.x-$S)/this._dimensions.device.canvas.width,e[zS+3]=BS.size.y/this._dimensions.device.canvas.height,e[zS+4]=BS.texturePage,e[zS+5]=BS.texturePositionClipSpace.x+$S/this._atlas.pages[BS.texturePage].canvas.width,e[zS+6]=BS.texturePositionClipSpace.y,e[zS+7]=BS.sizeClipSpace.x-$S/this._atlas.pages[BS.texturePage].canvas.width,e[zS+8]=BS.sizeClipSpace.y):(e[zS]=-BS.offset.x+this._dimensions.device.char.left,e[zS+1]=-BS.offset.y+this._dimensions.device.char.top,e[zS+2]=BS.size.x/this._dimensions.device.canvas.width,e[zS+3]=BS.size.y/this._dimensions.device.canvas.height,e[zS+4]=BS.texturePage,e[zS+5]=BS.texturePositionClipSpace.x,e[zS+6]=BS.texturePositionClipSpace.y,e[zS+7]=BS.sizeClipSpace.x,e[zS+8]=BS.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&function(e,t,i,r){return 1===t&&i>Math.ceil(1.5*r)&&void 0!==e&&e>255&&!function(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}(e)&&!Py(e)&&!function(e){return 57344<=e&&e<=63743}(e)}(r,l,BS.size.x,this._dimensions.device.cell.width)&&(e[zS+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):e.fill(0,zS,zS+OS-1-2)}clear(){let e=this._terminal,t=e.cols*e.rows*OS;this._vertices.count!==t?this._vertices.attributes=new Float32Array(t):this._vertices.attributes.fill(0);let i=0;for(;i<this._vertices.attributesBuffers.length;i++)this._vertices.count!==t?this._vertices.attributesBuffers[i]=new Float32Array(t):this._vertices.attributesBuffers[i].fill(0);this._vertices.count=t,i=0;for(let r=0;r<e.rows;r++)for(let t=0;t<e.cols;t++)this._vertices.attributes[i+9]=t/e.cols,this._vertices.attributes[i+10]=r/e.rows,i+=OS}handleResize(){let e=this._gl;e.useProgram(this._program),e.viewport(0,0,e.canvas.width,e.canvas.height),e.uniform2f(this._resolutionLocation,e.canvas.width,e.canvas.height),this.clear()}render(e){if(!this._atlas)return;let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let i=this._vertices.attributesBuffers[this._activeBuffer],r=0;for(let s=0;s<e.lineLengths.length;s++){let t=s*this._terminal.cols*OS,n=this._vertices.attributes.subarray(t,t+e.lineLengths[s]*OS);i.set(n,r),r+=n.length}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,i.subarray(0,r),t.STREAM_DRAW);for(let s=0;s<this._atlas.pages.length;s++)this._atlas.pages[s].version!==this._atlasTextures[s].version&&this._bindAtlasPageTexture(t,this._atlas,s);t.drawElementsInstanced(t.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,r/OS)}setAtlas(e){this._atlas=e;for(let t of this._atlasTextures)t.version=-1}_bindAtlasPageTexture(e,t,i){e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,this._atlasTextures[i].texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t.pages[i].canvas),e.generateMipmap(e.TEXTURE_2D),this._atlasTextures[i].version=t.pages[i].version}setDimensions(e){this._dimensions=e}},HS=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,i,r=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1])return void this.clear();let s=e.buffers.active.ydisp,n=t[1]-s,o=i[1]-s,a=Math.max(n,0),l=Math.min(o,e.rows-1);a>=e.rows||l<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=l,this.startCol=t[0],this.endCol=i[0])}isCellSelected(e,t,i){return!!this.hasSelection&&(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol)}};var US=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=new HS}resize(e,t){let i=e*t*4;i!==this.cells.length&&(this.cells=new Uint32Array(i),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},qS=8*Float32Array.BYTES_PER_ELEMENT,KS=class{constructor(){this.attributes=new Float32Array(160),this.count=0}},VS=0,GS=0,YS=0,XS=0,ZS=0,QS=0,JS=0,ew=class extends hy{constructor(e,t,i,r){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._themeService=r,this._vertices=new KS,this._verticesCursor=new KS;let s=this._gl;this._program=My(DS(s,"#version 300 es\nlayout (location = 0) in vec2 a_position;\nlayout (location = 1) in vec2 a_size;\nlayout (location = 2) in vec4 a_color;\nlayout (location = 3) in vec2 a_unitquad;\n\nuniform mat4 u_projection;\n\nout vec4 v_color;\n\nvoid main() {\n vec2 zeroToOne = a_position + (a_unitquad * a_size);\n gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);\n v_color = a_color;\n}","#version 300 es\nprecision lowp float;\n\nin vec4 v_color;\n\nout vec4 outColor;\n\nvoid main() {\n outColor = v_color;\n}")),this._register(ay(()=>s.deleteProgram(this._program))),this._projectionLocation=My(s.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=s.createVertexArray(),s.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=s.createBuffer();this._register(ay(()=>s.deleteBuffer(o))),s.bindBuffer(s.ARRAY_BUFFER,o),s.bufferData(s.ARRAY_BUFFER,n,s.STATIC_DRAW),s.enableVertexAttribArray(3),s.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),l=s.createBuffer();this._register(ay(()=>s.deleteBuffer(l))),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,l),s.bufferData(s.ELEMENT_ARRAY_BUFFER,a,s.STATIC_DRAW),this._attributesBuffer=My(s.createBuffer()),this._register(ay(()=>s.deleteBuffer(this._attributesBuffer))),s.bindBuffer(s.ARRAY_BUFFER,this._attributesBuffer),s.enableVertexAttribArray(0),s.vertexAttribPointer(0,2,s.FLOAT,!1,qS,0),s.vertexAttribDivisor(0,1),s.enableVertexAttribArray(1),s.vertexAttribPointer(1,2,s.FLOAT,!1,qS,2*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(1,1),s.enableVertexAttribArray(2),s.vertexAttribPointer(2,4,s.FLOAT,!1,qS,4*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(e=>{this._updateCachedColors(e),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,AS),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t,i,r,s,n,o,a,l,c,h,u,d=this._terminal,f=this._vertices,p=1;for(t=0;t<d.rows;t++){for(r=-1,s=0,n=0,o=!1,i=0;i<d.cols;i++)a=4*(t*d.cols+i),l=e.cells[a+1],c=e.cells[a+2],h=!!(67108864&c),(l!==s||c!==n&&(o||h))&&((0!==s||o&&0!==n)&&(u=8*p++,this._updateRectangle(f,u,n,s,r,i,t)),r=i,s=l,n=c,o=h);(0!==s||o&&0!==n)&&(u=8*p++,this._updateRectangle(f,u,n,s,r,d.cols,t))}f.count=p}updateCursor(e){let t=this._verticesCursor,i=e.cursor;if(!i||"block"===i.style)return void(t.count=0);let r,s=0;("bar"===i.style||"outline"===i.style)&&(r=8*s++,this._addRectangleFloat(t.attributes,r,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,"bar"===i.style?i.dpr*i.cursorWidth:i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),("underline"===i.style||"outline"===i.style)&&(r=8*s++,this._addRectangleFloat(t.attributes,r,i.x*this._dimensions.device.cell.width,(i.y+1)*this._dimensions.device.cell.height-i.dpr,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat)),"outline"===i.style&&(r=8*s++,this._addRectangleFloat(t.attributes,r,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat),r=8*s++,this._addRectangleFloat(t.attributes,r,(i.x+i.width)*this._dimensions.device.cell.width-i.dpr,i.y*this._dimensions.device.cell.height,i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=s}_updateRectangle(e,t,i,r,s,n,o){if(67108864&i)switch(50331648&i){case 16777216:case 33554432:VS=this._themeService.colors.ansi[255&i].rgba;break;case 50331648:VS=(16777215&i)<<8;break;default:VS=this._themeService.colors.foreground.rgba}else switch(50331648&r){case 16777216:case 33554432:VS=this._themeService.colors.ansi[255&r].rgba;break;case 50331648:VS=(16777215&r)<<8;break;default:VS=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=function(e,t){let i=Math.min(2*e.length,t),r=new Float32Array(i);for(let s=0;s<e.length;s++)r[s]=e[s];return r}(e.attributes,this._terminal.rows*this._terminal.cols*8)),GS=s*this._dimensions.device.cell.width,YS=o*this._dimensions.device.cell.height,XS=(VS>>24&255)/255,ZS=(VS>>16&255)/255,QS=(VS>>8&255)/255,JS=1,this._addRectangle(e.attributes,t,GS,YS,(n-s)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,XS,ZS,QS,JS)}_addRectangle(e,t,i,r,s,n,o,a,l,c){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=s/this._dimensions.device.canvas.width,e[t+3]=n/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=a,e[t+6]=l,e[t+7]=c}_addRectangleFloat(e,t,i,r,s,n,o){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=s/this._dimensions.device.canvas.width,e[t+3]=n/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(255&e.rgba)/255])}},tw=class extends hy{constructor(e,t,i,r,s,n,o,a){super(),this._container=t,this._alpha=s,this._coreBrowserService=n,this._optionsService=o,this._themeService=a,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(t=>{this._refreshCharAtlas(e,t),this.reset(e)})),this._register(ay(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=My(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,i){}handleSelectionChanged(e,t,i,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let i=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=ES(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,i=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,i,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,i,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=Wy,this._clipCell(i,r,t.getWidth()),this._ctx.fillText(t.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,i){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,i){return`${i?"italic":""} ${t?e.options.fontWeightBold:e.options.fontWeight} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},iw=class extends tw{constructor(e,t,i,r,s,n,o){super(i,e,"link",t,!0,s,n,o),this._register(r.onShowLinkUnderline(e=>this._handleShowLinkUnderline(e))),this._register(r.onHideLinkUnderline(e=>this._handleHideLinkUnderline(e)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(257===e.fg?this._ctx.fillStyle=this._themeService.colors.background.css:void 0!==e.fg&&function(e){return 16777216==(50331648&e)||33554432==(50331648&e)}(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},rw="object"==typeof window?window:globalThis,sw=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new mS,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new mS,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let i=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(i,e),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let i=this.getWindowId(t);this.mapWindowIdToFullScreen.set(i,e),this._onDidChangeFullscreen.fire(i)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};sw.INSTANCE=new sw;var nw=sw;nw.INSTANCE.onDidChangeZoomLevel,nw.INSTANCE.onDidChangeFullscreen;var ow="object"==typeof navigator?navigator.userAgent:"";ow.indexOf("Firefox"),ow.indexOf("AppleWebKit"),!(ow.indexOf("Chrome")>=0)&&ow.indexOf("Safari"),ow.indexOf("Electron/"),ow.indexOf("Android");var aw=!1;if("function"==typeof rw.matchMedia){let e=rw.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=rw.matchMedia("(display-mode: fullscreen)");aw=e.matches,function(e,t,i){"string"==typeof t&&(t=e.matchMedia(t)),t.addEventListener("change",i)}(rw,e,({matches:e})=>{aw&&t.matches||(aw=e)})}var lw,cw,hw="en",uw=!1,dw=hw,fw=globalThis;typeof fw.vscode<"u"&&typeof fw.vscode.process<"u"?cw=fw.vscode.process:typeof process<"u"&&"string"==typeof(null==(o=null==process?void 0:process.versions)?void 0:o.node)&&(cw=process);var pw="string"==typeof(null==(a=null==cw?void 0:cw.versions)?void 0:a.electron)&&"renderer"===(null==cw?void 0:cw.type);if("object"==typeof cw){cw.platform,cw.platform,"linux"===cw.platform&&!!cw.env.SNAP&&cw.env.SNAP_REVISION,!!cw.env.CI||cw.env.BUILD_ARTIFACTSTAGINGDIRECTORY,dw=hw;let e=cw.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,dw=t.resolvedLanguage||hw,null==(l=t.languagePack)?void 0:l.translationsConfigFile}catch{}uw=!0}else"object"!=typeof navigator||pw?console.error("Unable to resolve platform."):((lw=navigator.userAgent).indexOf("Windows"),lw.indexOf("Macintosh"),(lw.indexOf("Macintosh")>=0||lw.indexOf("iPad")>=0||lw.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints,lw.indexOf("Linux")>=0,null==lw||lw.indexOf("Mobi"),dw=globalThis._VSCODE_NLS_LANGUAGE||hw,navigator.language.toLowerCase());var _w,gw=uw,mw=lw,vw=dw;(e=>{e.value=function(){return vw},e.isDefaultVariant=function(){return 2===vw.length?"en"===vw:vw.length>=3&&("e"===vw[0]&&"n"===vw[1]&&"-"===vw[2])},e.isDefault=function(){return"en"===vw}})(_w||(_w={}));var bw="function"==typeof fw.postMessage&&!fw.importScripts;(()=>{if(bw){let e=[];fw.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let i=0,r=e.length;i<r;i++){let r=e[i];if(r.id===t.data.vscodeScheduleAsyncWork)return e.splice(i,1),void r.callback()}});let t=0;return i=>{let r=++t;e.push({id:r,callback:i}),fw.postMessage({vscodeScheduleAsyncWork:r},"*")}}})();var yw=!!(mw&&mw.indexOf("Chrome")>=0);mw&&mw.indexOf("Firefox"),!yw&&mw&&mw.indexOf("Safari"),mw&&mw.indexOf("Edg/"),mw&&mw.indexOf("Android");var Sw="object"==typeof navigator?navigator:{};gw||document.queryCommandSupported&&document.queryCommandSupported("copy")||Sw&&Sw.clipboard&&Sw.clipboard.writeText,gw||Sw&&Sw.clipboard&&Sw.clipboard.readText;var ww,xw,Cw=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},kw=new Cw,Ew=new Cw,Lw=new Cw;new Array(230),(xw=ww||(ww={})).toString=function(e){return kw.keyCodeToStr(e)},xw.fromString=function(e){return kw.strToKeyCode(e)},xw.toUserSettingsUS=function(e){return Ew.keyCodeToStr(e)},xw.toUserSettingsGeneral=function(e){return Lw.keyCodeToStr(e)},xw.fromUserSettings=function(e){return Ew.strToKeyCode(e)||Lw.strToKeyCode(e)},xw.toElectronAccelerator=function(e){if(e>=98&&e<=113)return null;switch(e){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return kw.keyCodeToStr(e)};var Rw,Tw=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}});(e=>{e.isCancellationToken=function(t){return t===e.None||t===e.Cancelled||t instanceof Pw||!(!t||"object"!=typeof t)&&("boolean"==typeof t.isCancellationRequested&&"function"==typeof t.onCancellationRequested)},e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Qy.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Tw})})(Rw||(Rw={}));var Mw,Pw=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Tw:(this._emitter||(this._emitter=new mS),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};(e=>{e.settled=async function(e){let t,i=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||(t=e)})));if(typeof t<"u")throw t;return i},e.withAsyncBody=function(e){return new Promise(async(t,i)=>{try{await e(t,i)}catch(xw){i(xw)}})}})(Mw||(Mw={}));var Aw=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let i of t)e.emitOne(i)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new mS,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(i){this.reject(i)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{for(;;){if(2===this._state)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(1===this._state)return{done:!0,value:void 0};await Qy.toPromise(this._onStateChanged.event)}},return:async()=>{var e;return null==(e=this._onReturn)||e.call(this),{done:!0,value:void 0}}}}static map(t,i){return new e(async e=>{for await(let r of t)e.emitOne(i(r))})}map(t){return e.map(this,t)}static filter(t,i){return new e(async e=>{for await(let r of t)i(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let i of e)t.push(i);return t}toPromise(){return e.toPromise(this)}emitOne(e){0===this._state&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){0===this._state&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){0===this._state&&(this._state=1,this._onStateChanged.fire())}reject(e){0===this._state&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Aw.EMPTY=Aw.fromArray([]);var{getWindow:Dw}=function(){let e=new Map,t={window:rw,disposables:new cy};e.set(rw.vscodeWindowId,t);let i=new mS,r=new mS,s=new mS;return{onDidRegisterWindow:i.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return hy.None;let n=new cy,o={window:t,disposables:n.add(new cy)};return e.set(t.vscodeWindowId,o),n.add(ay(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),n.add(Iw(t,Bw.BEFORE_UNLOAD,()=>{s.fire(t)})),i.fire(o),n},getWindows:()=>e.values(),getWindowsCount:()=>e.size,getWindowId:e=>e.vscodeWindowId,hasWindow:t=>e.has(t),getWindowById:function(i,r){return("number"==typeof i?e.get(i):void 0)??(r?t:void 0)},getWindow(e){var t;let i=e;if(null==(t=null==i?void 0:i.ownerDocument)?void 0:t.defaultView)return i.ownerDocument.defaultView.window;let r=e;return(null==r?void 0:r.view)?r.view.window:rw},getDocument:e=>Dw(e).document}}(),Nw=class{constructor(e,t,i,r){this._node=e,this._type=t,this._handler=i,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Iw(e,t,i,r){return new Nw(e,t,i,r)}var Bw={BEFORE_UNLOAD:"beforeunload"},Ow=class extends hy{constructor(e,t,i,r,s,n,o,a,l){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=i,this._coreBrowserService=r,this._coreService=s,this._decorationService=n,this._optionsService=o,this._themeService=a,this._cursorBlinkStateManager=new uy,this._charAtlasDisposable=this._register(new uy),this._observerDisposable=this._register(new uy),this._model=new US,this._workCell=new PS,this._workCell2=new PS,this._rectangleRenderer=this._register(new uy),this._glyphRenderer=this._register(new uy),this._onChangeTextureAtlas=this._register(new mS),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new mS),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new mS),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new mS),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new mS),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let c={antialias:!1,depth:!1,preserveDrawingBuffer:l};if(this._gl=this._canvas.getContext("webgl2",c),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new $y(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new iw(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],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._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Iw(this._canvas,"webglcontextlost",e=>{console.log("webglcontextlost event received"),e.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(e)},3e3)})),this._register(Iw(this._canvas,"webglcontextrestored",e=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,LS(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=MS(this._canvas,this._coreBrowserService.window,(e,t)=>this._setCanvasDevicePixelDimensions(e,t)),this._register(this._coreBrowserService.onWindowChange(e=>{this._observerDisposable.value=MS(this._canvas,e,(e,t)=>this._setCanvasDevicePixelDimensions(e,t))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(ay(()=>{var e;for(let t of this._renderLayers)t.dispose();null==(e=this._canvas.parentElement)||e.removeChild(this._canvas),LS(this._terminal)}))}get textureAtlas(){var e;return null==(e=this._charAtlas)?void 0:e.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){var i,r,s,n;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let o of this._renderLayers)o.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,null==(i=this._rectangleRenderer.value)||i.setDimensions(this.dimensions),null==(r=this._rectangleRenderer.value)||r.handleResize(),null==(s=this._glyphRenderer.value)||s.setDimensions(this.dimensions),null==(n=this._glyphRenderer.value)||n.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var e;for(let t of this._renderLayers)t.handleBlur(this._terminal);null==(e=this._cursorBlinkStateManager.value)||e.pause(),this._requestRedrawViewport()}handleFocus(){var e;for(let t of this._renderLayers)t.handleFocus(this._terminal);null==(e=this._cursorBlinkStateManager.value)||e.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,i){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,i);this._model.selection.update(this._core,e,t,i),this._requestRedrawViewport()}handleCursorMove(){var e;for(let t of this._renderLayers)t.handleCursorMove(this._terminal);null==(e=this._cursorBlinkStateManager.value)||e.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new ew(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new WS(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var e;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);let t=ES(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==t&&(this._onChangeTextureAtlas.fire(t.pages[0].canvas),this._charAtlasDisposable.value=oy(Qy.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Qy.forward(t.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=t,this._charAtlas.warmUp(),null==(e=this._glyphRenderer.value)||e.setAtlas(this._charAtlas)}_clearModel(e){var t;this._model.clear(),e&&(null==(t=this._glyphRenderer.value)||t.clear())}clearTextureAtlas(){var e;null==(e=this._charAtlas)||e.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var e;this._clearModel(!0);for(let t of this._renderLayers)t.reset(this._terminal);null==(e=this._cursorBlinkStateManager.value)||e.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){var i;if(!this._isAttached){if(!((null==(i=this._core.screenElement)?void 0:i.isConnected)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(let r of this._renderLayers)r.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new TS(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let i,r,s,n,o,a,l,c,h,u,d,f,p,_,g,m=this._core,v=this._workCell,b=0,y=!0;e=zw(e,m.rows-1,0),t=zw(t,m.rows-1,0);let S=this._coreService.decPrivateModes.cursorStyle??m.options.cursorStyle??"block",w=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,x=w-m.buffer.ydisp,C=Math.min(this._terminal.buffer.active.cursorX,m.cols-1),k=-1,E=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let L=!1;for(r=e;r<=t;r++)for(s=r+m.buffer.ydisp,n=m.buffer.lines.get(s),this._model.lineLengths[r]=0,h=w===s,b=0,o=this._characterJoinerService.getJoinedCharacters(s),_=0;_<m.cols;_++){if(i=this._cellColorResolver.result.bg,n.loadCell(_,v),0===_&&(i=this._cellColorResolver.result.bg),a=!1,y=_>=b,l=_,o.length>0&&_===o[0][0]&&y){c=o.shift();let e=this._model.selection.isCellSelected(this._terminal,c[0],s);for(p=c[0]+1;p<c[1];p++)y&&(y=e===this._model.selection.isCellSelected(this._terminal,p,s));y&&(y=!h||C<c[0]||C>=c[1]),y?(a=!0,v=new Fw(v,n.translateToString(!0,c[0],c[1]),c[1]-c[0]),l=c[1]-1):b=c[1]}if(u=v.getChars(),d=v.getCode(),p=4*(r*m.cols+_),this._cellColorResolver.resolve(v,_,s,this.dimensions.device.cell.width),E&&s===w&&(_===C&&(this._model.cursor={x:C,y:x,width:v.getWidth(),style:this._coreBrowserService.isFocused?S:m.options.cursorInactiveStyle,cursorWidth:m.options.cursorWidth,dpr:this._devicePixelRatio},k=C+v.getWidth()-1),_>=C&&_<=k&&(this._coreBrowserService.isFocused&&"block"===S||!1===this._coreBrowserService.isFocused&&"block"===m.options.cursorInactiveStyle)&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),0!==d&&(this._model.lineLengths[r]=_+1),(this._model.cells[p]!==d||this._model.cells[p+1]!==this._cellColorResolver.result.bg||this._model.cells[p+2]!==this._cellColorResolver.result.fg||this._model.cells[p+3]!==this._cellColorResolver.result.ext)&&(L=!0,u.length>1&&(d|=2147483648),this._model.cells[p]=d,this._model.cells[p+1]=this._cellColorResolver.result.bg,this._model.cells[p+2]=this._cellColorResolver.result.fg,this._model.cells[p+3]=this._cellColorResolver.result.ext,f=v.getWidth(),this._glyphRenderer.value.updateCell(_,r,d,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,u,f,i),a)){for(v=this._workCell,_++;_<=l;_++)g=4*(r*m.cols+_),this._glyphRenderer.value.updateCell(_,r,0,0,0,0,"",0,0),this._model.cells[g]=0,this._model.cells[g+1]=this._cellColorResolver.result.bg,this._model.cells[g+2]=this._cellColorResolver.result.fg,this._model.cells[g+3]=this._cellColorResolver.result.ext;_--}}L&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=1===this._optionsService.rawOptions.lineHeight?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},Fw=class extends rS{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function zw(e,t,i=0){return Math.max(Math.min(e,t),i)}var jw="di$target",$w="di$dependencies",Ww=new Map;function Hw(e){if(Ww.has(e))return Ww.get(e);let t=function(e,i,r){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");!function(e,t,i){t[jw]===t?t[$w].push({id:e,index:i}):(t[$w]=[{id:e,index:i}],t[jw]=t)}(t,e,r)};return t._id=e,Ww.set(e,t),t}Hw("BufferService"),Hw("CoreMouseService"),Hw("CoreService"),Hw("CharsetService"),Hw("InstantiationService"),Hw("LogService");var Uw=Hw("OptionsService");Hw("OscLinkService"),Hw("UnicodeService"),Hw("DecorationService");var qw={trace:0,debug:1,info:2,warn:3,error:4,off:5},Kw=class extends hy{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=qw[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)"function"==typeof e[t]&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+t,...i)}trace(e,...t){var i;this._logLevel<=0&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var i;this._logLevel<=1&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var i;this._logLevel<=2&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var i;this._logLevel<=3&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var i;this._logLevel<=4&&this._log((null==(i=this._optionsService.options.logger)?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,t)}};Kw=((e,t)=>{for(var i,r=t,s=e.length-1;s>=0;s--)(i=e[s])&&(r=i(r)||r);return r})([((e,t)=>(i,r)=>t(i,r,e))(0,Uw)],Kw);var Vw=class extends hy{constructor(e){if(my&&function(){if(!my)return 0;let e=fy.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1])}()<16){let e={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",e))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new mS),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new mS),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new mS),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new mS),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element)return void this._register(t.onWillOpen(()=>this.activate(e)));this._terminal=e;let i=t.coreService,r=t.optionsService,s=t,n=s._renderService,o=s._characterJoinerService,a=s._charSizeService,l=s._coreBrowserService,c=s._decorationService;s._logService;let h=s._themeService;this._renderer=this._register(new Ow(e,o,a,l,i,c,r,h,this._preserveDrawingBuffer)),this._register(Qy.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Qy.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Qy.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Qy.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),n.setRenderer(this._renderer),this._register(ay(()=>{if(this._terminal._core._store._isDisposed)return;let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)}))}get textureAtlas(){var e;return null==(e=this._renderer)?void 0:e.textureAtlas}clearTextureAtlas(){var e;null==(e=this._renderer)||e.clearTextureAtlas()}};function Gw(){return"light"===fd(md.getState().theme)?Xu:Yu}const Yw=new Set,Xw=new Map,Zw=new Map,Qw=new Map,Jw=new Map,ex=new Map;function tx(e){const t="light"===fd(md.getState().theme);e.options.theme=Gw(),e.options.minimumContrastRatio=t?7:1}let ix=md.getState().theme;function rx(e,t){if(!Jw.has(e))try{const i=new Vw;i.onContextLoss(()=>{i.dispose(),Jw.delete(e)}),t.loadAddon(i),Jw.set(e,i)}catch{}}function sx(e){const t=Jw.get(e);t&&(t.dispose(),Jw.delete(e))}md.subscribe(e=>{if(e.theme!==ix){ix=e.theme;for(const e of ex.values())tx(e)}});let nx=md.getState().gpuRendering;function ox(e){return Zw.get(e)}md.subscribe(e=>{if(e.gpuRendering!==nx){nx=e.gpuRendering;for(const[t,i]of ex)e.gpuRendering?rx(t,i):sx(t)}});const ax=new Map;function lx({terminalId:e,projectId:t,cwd:i}){const r=Y.useRef(null),s=Y.useRef(null),n=Y.useRef(null),o=Y.useRef(null),a=Uu(e=>e.setTerminalInstance),l=Uu(e=>e.createSession),c=md(e=>e.setFocusedTerminal);Y.useEffect(()=>{var h,u;const d=r.current;if(!d)return;d.innerHTML="";const f=Uu.getState().sessions[e],p=Xw.get(e);if((null==f?void 0:f.terminal)&&p){const t=f.terminal;s.current=t,d.appendChild(p);let i=Qw.get(e);return i||(i=new Uv,t.loadAddon(i),Qw.set(e,i)),n.current=i,requestAnimationFrame(()=>{try{i.fit(),t.scrollToBottom();const{cols:r,rows:s}=t;o.current={cols:r,rows:s},ux({type:"pty:resize",terminalId:e,cols:r,rows:s})}catch{}}),()=>{}}const _=Gw(),g="light"===fd(md.getState().theme),m=new Hv({theme:_,fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', 'Menlo', monospace",fontSize:13,lineHeight:1.2,cursorBlink:!0,cursorStyle:"bar",allowProposedApi:!0,scrollback:1e4,minimumContrastRatio:g?7:1}),v=new Uv,b=new Xv((e,t)=>{(e.ctrlKey||e.metaKey)&&ux({type:"open:url",url:t})}),y=new Xb;m.loadAddon(v),m.loadAddon(b),m.loadAddon(y),m.open(d),Qw.set(e,v),Zw.set(e,y),s.current=m,n.current=v,m.element&&Xw.set(e,m.element),md.getState().gpuRendering&&rx(e,m);const S=null==(h=m.element)?void 0:h.querySelector(".xterm-screen");return S&&S.addEventListener("mouseup",t=>{const i=t;i.ctrlKey||i.metaKey||setTimeout(()=>{if(m.hasSelection())return;const t=m.buffer.active;if(t.viewportY!==t.baseY)return;const r=S.getBoundingClientRect(),s=Math.floor((i.clientX-r.left)/(r.width/m.cols));if(Math.floor((i.clientY-r.top)/(r.height/m.rows))!==t.cursorY)return;const n=t.getLine(t.baseY+t.cursorY);if(!n)return;const o=n.translateToString().trimEnd().length,a=Math.min(s,o)-t.cursorX;if(0===a)return;ux({type:"pty:input",terminalId:e,data:(a>0?"":"").repeat(Math.abs(a))})},0)}),null==(u=m.element)||u.addEventListener("copy",e=>{var t;const i=m.getSelection();if(i){const r=i.split("\n").map(e=>e.trimEnd()).join("\n");null==(t=e.clipboardData)||t.setData("text/plain",r),e.preventDefault()}}),l(e,t),a(e,m),m.attachCustomKeyEventHandler(t=>{if("Enter"===t.key&&t.shiftKey)return"keydown"===t.type&&ux({type:"pty:input",terminalId:e,data:"\n"}),!1;if(t.metaKey&&!t.altKey&&!t.ctrlKey&&!t.shiftKey&&"keydown"===t.type){if("ArrowLeft"===t.key)return ux({type:"pty:input",terminalId:e,data:""}),!1;if("ArrowRight"===t.key)return ux({type:"pty:input",terminalId:e,data:""}),!1;if("Backspace"===t.key)return ux({type:"pty:input",terminalId:e,data:""}),!1}return!(t.metaKey&&"f"===t.key&&!t.altKey&&!t.ctrlKey)&&(!(t.metaKey&&"p"===t.key&&!t.altKey&&!t.ctrlKey)&&(!(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(t.key)&&t.ctrlKey&&t.shiftKey&&!t.metaKey&&!t.altKey)&&(!(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(t.key)&&t.shiftKey&&!t.ctrlKey&&!t.metaKey&&!t.altKey)||"alternate"===m.buffer.active.type)))}),m.onData(t=>{ux({type:"pty:input",terminalId:e,data:t})}),m.onTitleChange(t=>{Uu.getState().setTitle(e,t)}),Yw.has(e)||(Yw.add(e),requestAnimationFrame(()=>{try{v.fit()}catch{}ux({type:"pty:spawn",terminalId:e,projectId:t,cwd:i}),ux({type:"pty:resize",terminalId:e,cols:m.cols,rows:m.rows}),o.current={cols:m.cols,rows:m.rows},m.focus(),c(e)})),()=>{}},[e,t,i,l,a]),Y.useEffect(()=>{const t=s.current;t&&(tx(t),function(e,t){ex.set(e,t)}(e,t));const i=window.matchMedia("(prefers-color-scheme: light)"),r=()=>{t&&"system"===md.getState().theme&&tx(t)};return i.addEventListener("change",r),()=>{var t;t=e,ex.delete(t),i.removeEventListener("change",r)}},[e]);const h=Y.useCallback(()=>{const t=n.current,i=s.current;if(t&&i)try{t.fit(),i.scrollToBottom();const{cols:r,rows:s}=i,n=o.current;n&&n.cols===r&&n.rows===s||(o.current={cols:r,rows:s},ux({type:"pty:resize",terminalId:e,cols:r,rows:s}))}catch{}},[e]),u=Y.useCallback(()=>{var t;null==(t=s.current)||t.focus(),c(e)},[e,c]);return{containerRef:r,fit:h,focus:u,terminalRef:s}}function cx(e){Yw.delete(e),Xw.delete(e),Qw.delete(e),Zw.delete(e),sx(e),ex.delete(e)}let hx=null;function ux(e){(null==hx?void 0:hx.readyState)===WebSocket.OPEN&&hx.send(JSON.stringify(e))}function dx(){const e=md(e=>e.setConnectionStatus),t=Gu(e=>e.addProject),i=Gu(e=>e.setActiveProject),r=Y.useRef(),s=Y.useCallback(()=>{if((null==hx?void 0:hx.readyState)===WebSocket.OPEN||(null==hx?void 0:hx.readyState)===WebSocket.CONNECTING)return;e("connecting");const n=new WebSocket(`${"https:"===window.location.protocol?"wss:":"ws:"}//${window.location.host}/ws`);hx=n,n.onopen=()=>{e("connected"),ux({type:"editor:sync",enabled:md.getState().editorSyncEnabled})},n.onmessage=e=>{var r,s;try{const n=JSON.parse(e.data);if("pty:output"===n.type){const e=Uu.getState().sessions[n.terminalId];if(null==e?void 0:e.terminal){const t=e.terminal,i=t.buffer.active,r=i.viewportY>=i.baseY-1;t.write(n.data,()=>{r&&t.scrollToBottom()})}const t=function(e){const t=ax.get(e);return void 0!==t?(ax.delete(e),t):null}(n.terminalId);return void(t&&ux({type:"pty:input",terminalId:n.terminalId,data:t}))}if("pty:exit"===n.type){const e=n.terminalId,t=Uu.getState().sessions[e],i=null==t?void 0:t.projectId;if(null==(r=null==t?void 0:t.terminal)||r.dispose(),Uu.getState().removeSession(e),cx(e),i){ud.getState().removePaneFromProject(i,e),Gu.getState().removeTerminalFromProject(i,e);const t=Zu(ud.getState().getLayout(i)),r=md.getState().focusedTerminalId;if(r===e&&t.length>0){const e=t[0];md.getState().setFocusedTerminal(e);const i=Uu.getState().sessions[e];null==(s=null==i?void 0:i.terminal)||s.focus()}else r===e&&md.getState().setFocusedTerminal(null)}return}if("project:spawned"===n.type){const e=Object.values(Gu.getState().projects).find(e=>e.cwd===n.cwd);return void(e?i(e.id):(t({id:n.projectId,name:n.name,cwd:n.cwd,terminalIds:[]}),i(n.projectId)))}if("port:status"===n.type)return void Uu.getState().setActivePorts(n.ports);if("claude:status"===n.type)return void Uu.getState().setClaudeStatus(n.statuses);if("git:branch"===n.type)return void Uu.getState().setGitBranches(n.branches);if("inbox:paste"===n.type){const e=md.getState().focusedTerminalId;if(e&&n.files.length>0){ux({type:"pty:input",terminalId:e,data:n.files.map(e=>"'"+e.replace(/'/g,"'\\''")+"'").join(" ")})}return}if("editor:status"===n.type)return void Uu.getState().setEditorNeedsAccessibility(n.needsAccessibility);if("sc:status"===n.type)return void Sd.getState().setStatus(n.projectId,n.status);if("sc:diff"===n.type){const e=vd(n.projectId,n.file,n.kind);return void Sd.getState().setDiff(e,{diff:n.diff,binary:n.binary,truncated:n.truncated})}if("sc:action:result"===n.type)return Sd.getState().setActionResult(n.action,n.ok,n.error),void(n.ok&&"commit"===n.action&&Sd.getState().setCommitDraft(n.projectId,""));if("editor:active"===n.type){if(!md.getState().editorSyncEnabled)return;const{projects:e,activeProjectId:t}=Gu.getState(),r=Object.values(e).find(e=>{const t=e.cwd.replace(/\/$/,"").split("/").pop();return e.name===n.projectName||t===n.projectName});r&&r.id!==t&&(md.getState().showSyncToast(r.name),i(r.id))}}catch{}},n.onclose=()=>{e("disconnected"),Uu.getState().setActivePorts({}),Uu.getState().setClaudeStatus({}),Uu.getState().setGitBranches({}),Uu.getState().setEditorNeedsAccessibility(!1),hx=null,r.current=setTimeout(s,2e3)},n.onerror=()=>{n.close()}},[e,t,i]);Y.useEffect(()=>(s(),()=>{clearTimeout(r.current)}),[s])}const fx=new Set(["n","w","t","d","r","f","p","g"]);const px=Hu()((e,t)=>({favourites:{},addFavourite:i=>{e(e=>({favourites:{...e.favourites,[i.id]:i}})),Vu({favourites:{...t().favourites}})},updateFavourite:(i,r)=>{e(e=>{const t=e.favourites[i];return t?{favourites:{...e.favourites,[i]:{...t,...r}}}:e}),Vu({favourites:{...t().favourites}})},removeFavourite:i=>{e(e=>{const{[i]:t,...r}=e.favourites;return{favourites:r}}),Vu({favourites:{...t().favourites}})},hydrateFromServer:async()=>{try{const t=await fetch("/api/settings"),i=await t.json();i.favourites&&e({favourites:i.favourites})}catch{}}})),_x=(...e)=>e.filter((e,t,i)=>Boolean(e)&&i.indexOf(e)===t).join(" ");
64
+ /**
65
+ * @license lucide-react v0.400.0 - ISC
66
+ *
67
+ * This source code is licensed under the ISC license.
68
+ * See the LICENSE file in the root directory of this source tree.
69
+ */
70
+ /**
71
+ * @license lucide-react v0.400.0 - ISC
72
+ *
73
+ * This source code is licensed under the ISC license.
74
+ * See the LICENSE file in the root directory of this source tree.
75
+ */
76
+ var gx={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};
77
+ /**
78
+ * @license lucide-react v0.400.0 - ISC
79
+ *
80
+ * This source code is licensed under the ISC license.
81
+ * See the LICENSE file in the root directory of this source tree.
82
+ */const mx=Y.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:i=2,absoluteStrokeWidth:r,className:s="",children:n,iconNode:o,...a},l)=>Y.createElement("svg",{ref:l,...gx,width:t,height:t,stroke:e,strokeWidth:r?24*Number(i)/Number(t):i,className:_x("lucide",s),...a},[...o.map(([e,t])=>Y.createElement(e,t)),...Array.isArray(n)?n:[n]])),vx=(e,t)=>{const i=Y.forwardRef(({className:i,...r},s)=>{return Y.createElement(mx,{ref:s,iconNode:t,className:_x(`lucide-${n=e,n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,i),...r});var n});return i.displayName=`${e}`,i},bx=vx("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]),yx=vx("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]),Sx=vx("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),wx=vx("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),xx=vx("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]),Cx=vx("Brush",[["path",{d:"m9.06 11.9 8.07-8.06a2.85 2.85 0 1 1 4.03 4.03l-8.06 8.08",key:"1styjt"}],["path",{d:"M7.07 14.94c-1.66 0-3 1.35-3 3.02 0 1.33-2.5 1.52-2 2.02 1.08 1.1 2.49 2.02 4 2.02 2.2 0 4-1.8 4-4.04a3.01 3.01 0 0 0-3-3.02z",key:"z0l1mu"}]]),kx=vx("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),Ex=vx("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),Lx=vx("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),Rx=vx("CircleArrowUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]),Tx=vx("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),Mx=vx("CloudDownload",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M12 12v9",key:"192myk"}],["path",{d:"m8 17 4 4 4-4",key:"1ul180"}]]),Px=vx("CloudUpload",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M12 12v9",key:"192myk"}],["path",{d:"m16 16-4-4-4 4",key:"119tzi"}]]),Ax=vx("Columns2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]),Dx=vx("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]),Nx=vx("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),Ix=vx("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]),Bx=vx("GitCommitHorizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]),Ox=vx("Grid2x2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M12 3v18",key:"108xh3"}]]),Fx=vx("GripHorizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]),zx=vx("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),jx=vx("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]),$x=vx("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]),Wx=vx("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),Hx=vx("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),Ux=vx("MonitorSmartphone",[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]]),qx=vx("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),Kx=vx("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]),Vx=vx("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]),Gx=vx("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]),Yx=vx("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Xx=vx("PanelRightClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]),Zx=vx("PanelRightOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]),Qx=vx("PanelTop",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]]),Jx=vx("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),eC=vx("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]),tC=vx("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),iC=vx("Rows2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]]),rC=vx("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),sC=vx("Star",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]]),nC=vx("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),oC=vx("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]),aC=vx("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),lC=vx("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),cC=vx("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),hC=vx("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),uC=vx("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);
83
+ /**
84
+ * @license lucide-react v0.400.0 - ISC
85
+ *
86
+ * This source code is licensed under the ISC license.
87
+ * See the LICENSE file in the root directory of this source tree.
88
+ */function dC(e){Zu(ud.getState().getLayout(e)).forEach(e=>{var t;const i=Uu.getState().sessions[e];null==(t=null==i?void 0:i.terminal)||t.dispose(),Uu.getState().removeSession(e),cx(e)}),ux({type:"project:kill",projectId:e}),ud.getState().setLayout(e,null),Gu.getState().clearProjectTerminals(e)}function fC(){const e=window.__panefulDropPaths;return Array.isArray(e)&&e.length>0?(window.__panefulDropPaths=null,e):null}function pC(e){return/[ ()'"]/.test(e)?`'${e.replace(/'/g,"'\\''")}'`:e}function _C(e){return e.split(/[\r\n]+/).map(e=>e.trim()).filter(e=>e.startsWith("file://")).map(e=>{try{return decodeURIComponent(new URL(e).pathname)}catch{return null}}).filter(e=>null!==e&&e.length>0)}const gC=X.memo(function({project:e,isActive:t,hasActivePorts:i,claudeStatus:r,gitStatus:s,onClick:n,onKill:o,onRemove:a}){const l=e.terminalIds.length,c=Y.useRef(null);return Y.useEffect(()=>{t&&c.current&&c.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[t]),se.jsxs("div",{ref:c,onClick:n,className:`\n group flex items-center gap-2 px-3 py-2 mx-2 mb-1 rounded-lg cursor-pointer scroll-my-8\n transition-colors duration-100\n ${t?"bg-[var(--surface-2)] text-[var(--text-primary)]":"text-[var(--text-secondary)] hover:bg-[var(--surface-2)] hover:text-[var(--text-primary)]"}\n `,children:[se.jsx(Nx,{size:14,className:t?"text-accent":"text-[var(--text-muted)]"}),se.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[se.jsxs("div",{className:"text-xs font-medium truncate flex items-center gap-1.5",children:[e.name,r&&se.jsx("span",{className:"shrink-0 text-[8px] font-bold leading-none px-1 py-0.5 rounded "+("active"===r?"bg-purple-500/20 text-purple-400 animate-pulse":"bg-purple-500/10 text-purple-400/50"),title:"active"===r?"Agent is working":"Agent session open",children:"AI"}),i&&se.jsx("span",{className:"shrink-0 w-1.5 h-1.5 rounded-full bg-[var(--success)]",title:"Dev server running"})]}),s&&se.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[se.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1 py-0 rounded bg-[var(--surface-3)] text-[var(--text-muted)] text-[10px] font-medium truncate max-w-full",children:[se.jsx(Ix,{size:8,className:"shrink-0"}),se.jsx("span",{className:"truncate",children:s.branch})]}),s.ahead>0&&se.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1 py-0 rounded bg-[var(--surface-3)] text-[10px] text-[var(--text-muted)]",title:`${s.ahead} ahead`,children:["↑",s.ahead]}),s.behind>0&&se.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1 py-0 rounded bg-[var(--surface-3)] text-[10px] text-[var(--text-muted)]",title:`${s.behind} behind`,children:["↓",s.behind]}),s.staged>0&&se.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1 py-0 rounded bg-[var(--surface-3)] text-[10px] text-[var(--text-muted)]",title:`${s.staged} staged`,children:["+ ",s.staged]}),s.modified>0&&se.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1 py-0 rounded bg-[var(--surface-3)] text-[10px] text-[var(--text-muted)]",title:`${s.modified} modified`,children:[se.jsx("span",{className:"text-[5px]",children:"●"})," ",s.modified]})]}),se.jsx("div",{className:"text-[10px] text-[var(--text-muted)] truncate font-mono",children:e.cwd})]}),l>0&&se.jsxs("span",{className:"text-[10px] tabular-nums px-1.5 py-0.5 rounded-full bg-[var(--surface-3)] text-[var(--text-muted)] flex items-center gap-0.5",children:[se.jsx(oC,{size:8}),l]}),se.jsxs("div",{className:"hidden group-hover:flex items-center gap-0.5",children:[l>0&&se.jsx("button",{onClick:e=>{e.stopPropagation(),o()},title:"Kill all terminals",className:"p-0.5 rounded text-[var(--text-muted)] hover:text-[var(--danger)] hover:bg-[var(--danger-dim)] transition-colors",children:se.jsx(Tx,{size:12})}),se.jsx("button",{onClick:e=>{e.stopPropagation(),a()},title:"Remove project",className:"p-0.5 rounded text-[var(--text-muted)] hover:text-[var(--danger)] hover:bg-[var(--danger-dim)] transition-colors",children:se.jsx(aC,{size:12})})]})]})});function mC({open:e,onClose:t,onCreate:i,initialName:r,initialCwd:s}){const[n,o]=Y.useState(""),[a,l]=Y.useState("~"),[c,h]=Y.useState(null),[u,d]=Y.useState(!1),f=Y.useRef(null);Y.useEffect(()=>{e&&(o(r??""),l(s??"~"),h(null),setTimeout(()=>{var e;return null==(e=f.current)?void 0:e.focus()},50))},[e,r,s]);const p=Y.useCallback(async e=>{if(e.preventDefault(),!n.trim())return;const r=a.trim()||"~",s=Object.values(Gu.getState().projects).find(e=>e.cwd===r);if(s)h(`Project "${s.name}" already uses this directory`);else{d(!0),h(null);try{const e=await fetch("/api/validate-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:r})}),{valid:t}=await e.json();if(!t)return h("Directory does not exist"),void d(!1)}catch{return h("Could not validate path"),void d(!1)}d(!1),i(n.trim(),r),t()}},[n,a,i,t]);return e?se.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:t,children:se.jsxs("div",{className:"bg-[var(--surface-1)] border border-[var(--border)] rounded-xl w-[400px] shadow-2xl animate-fade-in",onClick:e=>e.stopPropagation(),children:[se.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)]",children:[se.jsx("h3",{className:"text-sm font-medium text-[var(--text-primary)]",children:"New Project"}),se.jsx("button",{onClick:t,className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",children:se.jsx(hC,{size:14})})]}),se.jsxs("form",{onSubmit:p,className:"p-4 space-y-4",children:[se.jsxs("div",{children:[se.jsx("label",{className:"block text-xs text-[var(--text-secondary)] mb-1.5",children:"Project Name"}),se.jsx("input",{ref:f,value:n,onChange:e=>o(e.target.value),placeholder:"my-project",className:"\n w-full px-3 py-2 text-sm\n bg-[var(--surface-0)] border border-[var(--border)]\n text-[var(--text-primary)] placeholder:text-[var(--text-muted)]\n rounded-lg outline-none\n focus:border-accent focus:ring-1 focus:ring-accent/30\n transition-colors\n "})]}),se.jsxs("div",{children:[se.jsx("label",{className:"block text-xs text-[var(--text-secondary)] mb-1.5",children:"Working Directory"}),se.jsx("input",{value:a,onChange:e=>{l(e.target.value),h(null)},placeholder:"/path/to/project",className:`\n w-full px-3 py-2 text-sm font-mono\n bg-[var(--surface-0)] border\n text-[var(--text-primary)] placeholder:text-[var(--text-muted)]\n rounded-lg outline-none\n transition-colors\n ${c?"border-[var(--danger)] focus:border-[var(--danger)] focus:ring-1 focus:ring-[var(--danger)]/30":"border-[var(--border)] focus:border-accent focus:ring-1 focus:ring-accent/30"}\n `}),c&&se.jsx("p",{className:"mt-1.5 text-[11px] text-[var(--danger)]",children:c})]}),se.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[se.jsx("button",{type:"button",onClick:t,className:"\n px-3 py-1.5 text-xs text-[var(--text-secondary)]\n hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)]\n rounded-lg transition-colors\n ",children:"Cancel"}),se.jsx("button",{type:"submit",disabled:!n.trim()||u,className:"\n px-3 py-1.5 text-xs font-medium\n bg-accent hover:bg-accent/80\n disabled:opacity-40 disabled:cursor-not-allowed\n text-white rounded-lg transition-colors\n ",children:u?"Checking...":"Create"})]})]})]})}):null}const vC={"even-horizontal":"Rows","even-vertical":"Columns","main-left":"Main + Stack","main-top":"Main + Row",grid:"Grid"};function bC({favourite:e,onLaunch:t,onEdit:i,onDelete:r}){const s=`${vC[e.preset]??e.preset}, ${e.slots.length} terminal${1!==e.slots.length?"s":""}`;return se.jsxs("div",{className:"\n group flex items-center gap-2 px-3 py-2 mx-2 rounded-lg cursor-pointer\n text-[var(--text-secondary)] hover:bg-[var(--surface-2)] hover:text-[var(--text-primary)]\n transition-colors duration-100\n ",onClick:t,children:[se.jsx(sC,{size:14,className:"text-[var(--text-muted)] flex-shrink-0"}),se.jsxs("div",{className:"flex-1 min-w-0",children:[se.jsx("div",{className:"text-xs font-medium truncate",children:e.name}),se.jsxs("div",{className:"text-[10px] text-[var(--text-muted)] truncate flex items-center gap-0.5",children:[se.jsx(oC,{size:8}),s]})]}),se.jsxs("div",{className:"hidden group-hover:flex items-center gap-0.5",children:[se.jsx("button",{onClick:e=>{e.stopPropagation(),t()},title:"Launch",className:"p-0.5 rounded text-[var(--text-muted)] hover:text-[var(--success)] hover:bg-green-500/10 transition-colors",children:se.jsx(eC,{size:12})}),se.jsx("button",{onClick:e=>{e.stopPropagation(),i()},title:"Edit",className:"p-0.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",children:se.jsx(Jx,{size:12})}),se.jsx("button",{onClick:e=>{e.stopPropagation(),r()},title:"Delete",className:"p-0.5 rounded text-[var(--text-muted)] hover:text-[var(--danger)] hover:bg-[var(--danger-dim)] transition-colors",children:se.jsx(aC,{size:12})})]})]})}function yC({favourites:e,onLaunch:t,onEdit:i,onDelete:r}){const[s,n]=Y.useState(!1);return 0===e.length?null:se.jsxs("div",{children:[se.jsxs("button",{onClick:()=>n(!s),className:"\n flex items-center gap-1 w-full px-4 py-1.5\n text-[10px] font-semibold uppercase tracking-wider\n text-[var(--text-muted)] hover:text-[var(--text-secondary)]\n transition-colors\n ",children:[s?se.jsx(Ex,{size:10}):se.jsx(kx,{size:10}),"Favourites"]}),!s&&se.jsx("div",{children:e.map(e=>se.jsx(bC,{favourite:e,onLaunch:()=>t(e),onEdit:()=>i(e),onDelete:()=>r(e.id)},e.id))})]})}const SC={"even-horizontal":se.jsx(iC,{size:16}),"even-vertical":se.jsx(Ax,{size:16}),"main-left":se.jsx(Yx,{size:16}),"main-top":se.jsx(Qx,{size:16}),grid:se.jsx(Ox,{size:16})},wC={"even-horizontal":"Rows","even-vertical":"Columns","main-left":"Main + Stack","main-top":"Main + Row",grid:"Grid"};function xC({open:e,onClose:t,onSave:i,editingFavourite:r,defaultPreset:s,defaultSlotCount:n}){const[o,a]=Y.useState(""),[l,c]=Y.useState("even-horizontal"),[h,u]=Y.useState([{label:"",command:""}]),d=Y.useRef(null);if(Y.useEffect(()=>{if(e){if(r)a(r.name),c(r.preset),u(r.slots.map(e=>({...e})));else{a(""),c(s??"even-horizontal");const e=n??1;u(Array.from({length:e},()=>({label:"",command:""})))}setTimeout(()=>{var e;return null==(e=d.current)?void 0:e.focus()},50)}},[e,r,s,n]),!e)return null;const f=(e,t,i)=>{u(h.map((r,s)=>s===e?{...r,[t]:i}:r))};return se.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:t,children:se.jsxs("div",{className:"bg-[var(--surface-1)] border border-[var(--border)] rounded-xl w-[440px] shadow-2xl animate-fade-in max-h-[80vh] flex flex-col",onClick:e=>e.stopPropagation(),children:[se.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)]",children:[se.jsx("h3",{className:"text-sm font-medium text-[var(--text-primary)]",children:r?"Edit Favourite":"Save Favourite"}),se.jsx("button",{onClick:t,className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",children:se.jsx(hC,{size:14})})]}),se.jsxs("form",{onSubmit:e=>{e.preventDefault(),o.trim()&&0!==h.length&&(i(o.trim(),l,h),t())},className:"p-4 space-y-4 overflow-y-auto",children:[se.jsxs("div",{children:[se.jsx("label",{className:"block text-xs text-[var(--text-secondary)] mb-1.5",children:"Name"}),se.jsx("input",{ref:d,value:o,onChange:e=>a(e.target.value),placeholder:"My Workspace",className:"\n w-full px-3 py-2 text-sm\n bg-[var(--surface-0)] border border-[var(--border)]\n text-[var(--text-primary)] placeholder:text-[var(--text-muted)]\n rounded-lg outline-none\n focus:border-accent focus:ring-1 focus:ring-accent/30\n transition-colors\n "})]}),se.jsxs("div",{children:[se.jsx("label",{className:"block text-xs text-[var(--text-secondary)] mb-1.5",children:"Layout"}),se.jsx("div",{className:"flex gap-1",children:od.map(e=>se.jsxs("button",{type:"button",onClick:()=>c(e),className:`\n flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs transition-colors\n ${l===e?"bg-accent/15 text-accent border border-accent/30":"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] border border-transparent"}\n `,title:wC[e],children:[SC[e],se.jsx("span",{className:"hidden sm:inline",children:wC[e]})]},e))})]}),se.jsxs("div",{children:[se.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[se.jsx("label",{className:"text-xs text-[var(--text-secondary)]",children:"Terminal Slots"}),se.jsxs("button",{type:"button",onClick:()=>{u([...h,{label:"",command:""}])},className:"flex items-center gap-0.5 text-[10px] text-accent hover:text-accent/80 transition-colors",children:[se.jsx(tC,{size:10}),"Add"]})]}),se.jsx("div",{className:"space-y-2",children:h.map((e,t)=>se.jsxs("div",{className:"flex items-start gap-2 p-2 rounded-lg bg-[var(--surface-0)] border border-[var(--border)]",children:[se.jsxs("div",{className:"flex-1 space-y-1.5",children:[se.jsx("input",{value:e.label,onChange:e=>f(t,"label",e.target.value),placeholder:`Terminal ${t+1}`,className:"\n w-full px-2 py-1 text-xs\n bg-transparent border border-[var(--border)]\n text-[var(--text-primary)] placeholder:text-[var(--text-muted)]\n rounded outline-none\n focus:border-accent focus:ring-1 focus:ring-accent/30\n transition-colors\n "}),se.jsx("input",{value:e.command,onChange:e=>f(t,"command",e.target.value),placeholder:"Command (optional)",className:"\n w-full px-2 py-1 text-xs font-mono\n bg-transparent border border-[var(--border)]\n text-[var(--text-primary)] placeholder:text-[var(--text-muted)]\n rounded outline-none\n focus:border-accent focus:ring-1 focus:ring-accent/30\n transition-colors\n "})]}),h.length>1&&se.jsx("button",{type:"button",onClick:()=>{return e=t,void(h.length<=1||u(h.filter((t,i)=>i!==e)));var e},className:"p-1 mt-0.5 rounded text-[var(--text-muted)] hover:text-[var(--danger)] hover:bg-[var(--danger-dim)] transition-colors",children:se.jsx(aC,{size:12})})]},t))})]}),se.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[se.jsx("button",{type:"button",onClick:t,className:"\n px-3 py-1.5 text-xs text-[var(--text-secondary)]\n hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)]\n rounded-lg transition-colors\n ",children:"Cancel"}),se.jsx("button",{type:"submit",disabled:!o.trim()||0===h.length,className:"\n px-3 py-1.5 text-xs font-medium\n bg-accent hover:bg-accent/80\n disabled:opacity-40 disabled:cursor-not-allowed\n text-white rounded-lg transition-colors\n ",children:r?"Update":"Save"})]})]})]})})}function CC({open:e,onClose:t,onConfirm:i,terminalCount:r,favouriteName:s}){return e?se.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:t,children:se.jsxs("div",{className:"bg-[var(--surface-1)] border border-[var(--border)] rounded-xl w-[380px] shadow-2xl animate-fade-in",onClick:e=>e.stopPropagation(),children:[se.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)]",children:[se.jsx("h3",{className:"text-sm font-medium text-[var(--text-primary)]",children:"Launch Favourite"}),se.jsx("button",{onClick:t,className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",children:se.jsx(hC,{size:14})})]}),se.jsxs("div",{className:"p-4 space-y-4",children:[se.jsxs("div",{className:"flex items-start gap-3",children:[se.jsx("div",{className:"p-2 rounded-lg bg-yellow-500/10",children:se.jsx(lC,{size:16,className:"text-yellow-500"})}),se.jsxs("div",{className:"text-sm text-[var(--text-secondary)]",children:["Launching ",se.jsx("span",{className:"font-medium text-[var(--text-primary)]",children:s})," will close ",r," existing terminal",1!==r?"s":"",". Continue?"]})]}),se.jsxs("div",{className:"flex justify-end gap-2",children:[se.jsx("button",{onClick:t,className:"\n px-3 py-1.5 text-xs text-[var(--text-secondary)]\n hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)]\n rounded-lg transition-colors\n ",children:"Cancel"}),se.jsx("button",{onClick:()=>{i(),t()},className:"\n px-3 py-1.5 text-xs font-medium\n bg-accent hover:bg-accent/80\n text-white rounded-lg transition-colors\n ",children:"Launch"})]})]})]})}):null}function kC(){const[e,t]=Y.useState(!1),[i,r]=Y.useState(!1),[s,n]=Y.useState(!1),[o,a]=Y.useState(null),[l,c]=Y.useState(null),[h,u]=Y.useState(null),[d,f]=Y.useState(!1),[p,_]=Y.useState(null);Y.useEffect(()=>{fetch("/api/version").then(e=>e.json()).then(e=>{e.latest&&function(e,t){const i=e.split(".").map(Number),r=t.split(".").map(Number);for(let s=0;s<3;s++){if((i[s]||0)>(r[s]||0))return!0;if((i[s]||0)<(r[s]||0))return!1}return!1}(e.latest,e.current)&&_({current:e.current,latest:e.latest})}).catch(()=>{})},[]);const g=Gu(e=>e.projects),m=Gu(e=>e.activeProjectId),v=Gu(e=>e.setActiveProject),b=Gu(e=>e.addProject),y=Gu(e=>e.removeProject),S=Gu(e=>e.addTerminalToProject),w=md(e=>e.sidebarOpen),x=md(e=>e.sidebarWidth),C=md(e=>e.setSidebarWidth),k=md(e=>e.toggleSidebar),E=md(e=>e.connectionStatus),L=Y.useRef(!1),R=md(e=>e.editorSyncEnabled),T=md(e=>e.toggleEditorSync),M=md(e=>e.gpuRendering),P=md(e=>e.toggleGpuRendering),A=md(e=>e.theme),D=md(e=>e.cycleTheme),N=Uu(e=>e.activePorts),I=Uu(e=>e.claudeStatus),B=Uu(e=>e.gitBranches),O=Uu(e=>e.editorNeedsAccessibility),F=px(e=>e.favourites);px(e=>e.addFavourite);const z=px(e=>e.updateFavourite),j=px(e=>e.removeFavourite),$=md(e=>e.pendingFavouriteLaunchId),W=md(e=>e.clearPendingFavouriteLaunch),[H,U]=Y.useState(null),[q,K]=Y.useState(null),V=Y.useCallback(()=>{fetch("/api/cleanup-projects").then(e=>e.json()).then(e=>{0===e.stale.length?(U([]),setTimeout(()=>U(null),2e3)):U(e.stale)}).catch(()=>{})},[]),G=Y.useCallback(()=>{fetch("/api/cleanup-projects",{method:"POST"}).then(e=>e.json()).then(e=>{for(const t of Object.values(g))e.removed.includes(t.name)&&(ud.getState().removeProjectLayout(t.id),y(t.id));U(null)}).catch(()=>{})},[g,y]),X=e=>{dC(e)},Z=Y.useCallback(e=>{if(!m)return;if(!g[m])return;dC(m);const t=e.slots.map(()=>crypto.randomUUID());e.slots.forEach((e,i)=>{var r,s;e.command.trim()&&(r=t[i],s=e.command+"\n",ax.set(r,s))});const i=ad(t,e.preset);ud.getState().setLayout(m,i),t.forEach(e=>{S(m,e)}),t.length>0&&md.getState().setFocusedTerminal(t[0])},[m,g,S]),Q=Y.useCallback(e=>{if(!m)return;Zu(ud.getState().getLayout(m)).length>0?(c(e),n(!0)):Z(e)},[m,Z]);Y.useEffect(()=>{if(!$)return;const e=F[$];W(),e&&Q(e)},[$,F,W,Q]);const J=Y.useCallback(e=>{e.dataTransfer.types.includes("Files")&&(e.preventDefault(),e.dataTransfer.dropEffect="copy",f(!0))},[]),ee=Y.useCallback(e=>{e.currentTarget.contains(e.relatedTarget)||f(!1)},[]),te=Y.useCallback(e=>{e.preventDefault(),L.current=!0;const t=e=>{requestAnimationFrame(()=>C(e.clientX))},i=()=>{L.current=!1,window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",i),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",t),window.addEventListener("mouseup",i)},[C]),ie=Y.useCallback(e=>{if(f(!1),!e.dataTransfer.types.includes("Files")||0===e.dataTransfer.files.length)return;e.preventDefault(),e.stopPropagation();const i=fC();if(i&&i.length>0){const r=i[0],s=r.split("/").pop()||e.dataTransfer.files[0].name;return u({name:s,cwd:r}),void t(!0)}const r=e.dataTransfer.files[0];fetch("/api/resolve-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:r.name,size:r.size,lastModified:r.lastModified})}).then(e=>e.json()).then(e=>{if(!e.path||!e.isDirectory)return;const i=e.path,s=i.split("/").pop()||r.name;u({name:s,cwd:i}),t(!0)}).catch(()=>{})},[]);if(!w)return null;const re=Object.values(g),ne=Object.values(F),oe=(m?g[m]:null)?Zu(ud.getState().getLayout(m)).length:0;return se.jsxs("div",{className:"relative flex-shrink-0 bg-[var(--surface-1)] border-r border-[var(--border)] flex flex-col h-full "+(d?"ring-2 ring-inset ring-[var(--accent)]":""),style:{width:x},onDragOver:J,onDragLeave:ee,onDrop:ie,children:[se.jsx("div",{className:"absolute top-0 right-0 w-1 h-full cursor-col-resize z-10 hover:bg-[var(--accent)] active:bg-[var(--accent)] opacity-0 hover:opacity-40 active:opacity-60 transition-opacity",onMouseDown:te}),se.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)]",children:[se.jsxs("div",{className:"flex items-center gap-2",children:[se.jsx("span",{className:"text-sm font-semibold tracking-tight text-[var(--text-primary)]",children:"Paneful"}),se.jsx("span",{className:"w-1.5 h-1.5 rounded-full "+("connected"===E?"bg-[var(--success)]":"connecting"===E?"bg-yellow-500 animate-pulse":"bg-[var(--danger)]"),title:E})]}),se.jsxs("div",{className:"flex items-center gap-1",children:[se.jsx("button",{onClick:D,className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:`Theme: ${A}. Click to cycle.`,children:"light"===A?se.jsx(nC,{size:14}):"dark"===A?se.jsx(Kx,{size:14}):se.jsx(qx,{size:14})}),se.jsxs("button",{onClick:()=>{T(),ux({type:"editor:sync",enabled:!R})},className:"relative p-1 rounded transition-colors "+(R?"text-[var(--accent)] hover:bg-[var(--surface-3)]":"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)]"),title:R&&O?"Editor sync needs Accessibility permission. Go to System Settings → Privacy & Security → Accessibility and add the app you launched paneful from (e.g. Paneful, Terminal, iTerm, VS Code, Cursor). If already listed, try toggling it off and on, or removing and re-adding it.":R?"Editor sync ON — auto-switches project based on your active editor. Click to disable.":"Editor sync OFF — click to enable. Requires Accessibility permission for the app you launched paneful from (e.g. Paneful, Terminal, VS Code, Cursor) in System Settings → Privacy & Security → Accessibility. After updating, you may need to remove and re-add it.",children:[se.jsx(Ux,{size:14}),R&&O&&se.jsx("span",{className:"absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-yellow-500"})]}),se.jsx("button",{onClick:P,className:"p-1 rounded transition-colors "+(M?"text-[var(--accent)] hover:bg-[var(--surface-3)]":"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)]"),title:M?"GPU rendering ON — terminals use WebGL. Click to switch to DOM renderer.":"GPU rendering OFF — terminals use DOM renderer. Click to enable WebGL.",children:se.jsx(uC,{size:14})}),se.jsx("button",{onClick:V,className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Clean up stale projects",children:se.jsx(Cx,{size:14})}),se.jsx("button",{onClick:k,className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Hide sidebar",children:se.jsx(Vx,{size:14})})]})]}),se.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:0===re.length&&0===ne.length?se.jsx("div",{className:"px-4 py-8 text-center",children:se.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"No projects yet"})}):se.jsxs(se.Fragment,{children:[re.map(e=>{var t;return se.jsx(gC,{project:e,isActive:e.id===m,hasActivePorts:((null==(t=N[e.id])?void 0:t.length)??0)>0,claudeStatus:I[e.id]??null,gitStatus:B[e.id]??null,onClick:()=>v(e.id),onKill:()=>X(e.id),onRemove:()=>{return t=e.id,void K(t);var t}},e.id)}),se.jsx(yC,{favourites:ne,onLaunch:Q,onEdit:e=>{a(e),r(!0)},onDelete:j})]})}),se.jsxs("div",{className:"mx-3 mb-2 px-3 py-2.5 rounded-lg bg-[var(--surface-2)] text-[10px] text-[var(--text-muted)] leading-relaxed flex flex-col items-center gap-1.5 text-center",children:[se.jsx($x,{size:12,className:"text-yellow-500"}),"Drag a folder into this sidebar to create a project"]}),se.jsx("div",{className:"p-2 border-t border-[var(--border)]",children:se.jsxs("button",{onClick:()=>t(!0),className:"\n w-full flex items-center justify-center gap-1.5\n px-3 py-2 text-xs\n text-[var(--text-secondary)] hover:text-[var(--text-primary)]\n bg-[var(--surface-2)] hover:bg-[var(--surface-3)]\n rounded-lg transition-colors\n ",children:[se.jsx(tC,{size:14}),"New Project"]})}),p&&se.jsxs("div",{className:"px-4 py-3 border-t border-[var(--border)]",children:[se.jsxs("a",{href:"https://www.npmjs.com/package/paneful",onClick:e=>{e.preventDefault(),ux({type:"open:url",url:"https://www.npmjs.com/package/paneful"})},className:"flex items-center gap-2 text-xs text-[var(--accent)] hover:underline cursor-pointer",children:[se.jsx(Rx,{size:14}),se.jsxs("span",{children:["v",p.latest," available (current: v",p.current,")"]})]}),se.jsxs("p",{className:"text-[10px] text-[var(--text-muted)] mt-1",children:["paneful update · ",se.jsx("a",{href:"https://github.com/kplates/paneful/blob/master/CHANGELOG.md",onClick:e=>{e.preventDefault(),ux({type:"open:url",url:"https://github.com/kplates/paneful/blob/master/CHANGELOG.md"})},className:"underline cursor-pointer hover:text-[var(--text-secondary)]",children:"changelog"})]})]}),se.jsx(mC,{open:e,onClose:()=>{t(!1),u(null)},onCreate:(e,t)=>{const i=Object.values(g).find(e=>e.cwd===t);if(i)return void v(i.id);const r=crypto.randomUUID();b({id:r,name:e,cwd:t,terminalIds:[]}),ux({type:"project:create",projectId:r,name:e,cwd:t}),v(r)},initialName:null==h?void 0:h.name,initialCwd:null==h?void 0:h.cwd}),se.jsx(xC,{open:i,onClose:()=>{r(!1),a(null)},onSave:(e,t,i)=>{o&&z(o.id,{name:e,preset:t,slots:i}),a(null)},editingFavourite:o}),se.jsx(CC,{open:s,onClose:()=>{n(!1),c(null)},onConfirm:()=>{l&&Z(l)},terminalCount:oe,favouriteName:(null==l?void 0:l.name)??""}),null!==H&&se.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:()=>U(null),children:se.jsxs("div",{className:"bg-[var(--surface-1)] border border-[var(--border)] rounded-xl p-5 w-80 shadow-xl",onClick:e=>e.stopPropagation(),children:[se.jsx("h3",{className:"text-sm font-semibold text-[var(--text-primary)] mb-3",children:"Clean Up Projects"}),0===H.length?se.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"All projects have valid directories."}):se.jsxs(se.Fragment,{children:[se.jsxs("p",{className:"text-xs text-[var(--text-secondary)] mb-3",children:[H.length," project",H.length>1?"s":""," with missing directories:"]}),se.jsx("div",{className:"space-y-1.5 mb-4 max-h-40 overflow-y-auto",children:H.map(e=>se.jsxs("div",{className:"text-xs px-2 py-1.5 rounded bg-[var(--surface-2)]",children:[se.jsx("div",{className:"font-medium text-[var(--text-primary)]",children:e.name}),se.jsx("div",{className:"text-[10px] text-[var(--text-muted)] font-mono truncate",children:e.cwd})]},e.id))}),se.jsxs("div",{className:"flex gap-2 justify-end",children:[se.jsx("button",{onClick:()=>U(null),className:"px-3 py-1.5 text-xs rounded-lg text-[var(--text-secondary)] hover:bg-[var(--surface-2)] transition-colors",children:"Cancel"}),se.jsxs("button",{onClick:G,className:"px-3 py-1.5 text-xs rounded-lg bg-[var(--danger)] text-white hover:opacity-90 transition-opacity",children:["Remove ",H.length," project",H.length>1?"s":""]})]})]})]})}),q&&g[q]&&se.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:()=>K(null),children:se.jsxs("div",{className:"bg-[var(--surface-1)] border border-[var(--border)] rounded-xl p-5 w-80 shadow-xl",onClick:e=>e.stopPropagation(),children:[se.jsx("h3",{className:"text-sm font-semibold text-[var(--text-primary)] mb-3",children:"Remove Project"}),se.jsxs("p",{className:"text-xs text-[var(--text-secondary)] mb-4",children:["Remove ",se.jsx("strong",{children:g[q].name}),"? This will kill all its terminals."]}),se.jsxs("div",{className:"flex gap-2 justify-end",children:[se.jsx("button",{onClick:()=>K(null),className:"px-3 py-1.5 text-xs rounded-lg text-[var(--text-secondary)] hover:bg-[var(--surface-2)] transition-colors",children:"Cancel"}),se.jsx("button",{onClick:()=>{q&&(X(q),ux({type:"project:remove",projectId:q}),ud.getState().removeProjectLayout(q),y(q),K(null))},className:"px-3 py-1.5 text-xs rounded-lg bg-[var(--danger)] text-white hover:opacity-90 transition-opacity",children:"Remove"})]})]})})]})}const EC=[{keys:["⌘","P"],action:"Command palette"},{keys:["⌘","F"],action:"Search terminal"},{keys:["⌘","N"],action:"New pane (vertical)"},{keys:["⌘","⇧","N"],action:"New pane (horizontal)"},{keys:["⌘","W"],action:"Close pane"},{keys:["⌘","D"],action:"Toggle sidebar"},{keys:["⌘","⇧","G"],action:"Toggle source control"},{keys:["⌘","T"],action:"Cycle layout"},{keys:["⌘","R"],action:"Auto reorganize"},{keys:["⌘","1-9"],action:"Focus pane by number"},{keys:["⌘","←→↑↓"],action:"Move focus"},{keys:["⌘","⇧","←→↑↓"],action:"Swap panes"},{keys:["⌥","←→↑↓"],action:"Swap panes"},{keys:["Shift","Enter"],action:"Insert new line"}];function LC({open:e,onClose:t}){return e?se.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:t,children:se.jsxs("div",{className:"bg-[var(--surface-1)] border border-[var(--border)] rounded-xl w-[440px] shadow-2xl animate-fade-in",onClick:e=>e.stopPropagation(),children:[se.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)]",children:[se.jsx("h3",{className:"text-sm font-medium text-[var(--text-primary)]",children:"Keyboard Shortcuts"}),se.jsx("button",{onClick:t,className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",children:se.jsx(hC,{size:14})})]}),se.jsx("div",{className:"p-4 space-y-2",children:EC.map((e,t)=>se.jsxs("div",{className:"flex items-center justify-between py-1",children:[se.jsx("div",{className:"flex items-center gap-1",children:e.keys.map((e,t)=>se.jsx("kbd",{className:"border border-[var(--border)] rounded-md px-1.5 py-0.5 bg-[var(--surface-0)] text-[11px] font-mono min-w-[24px] text-center inline-flex items-center justify-center shadow-[0_1px_0_var(--border)]",children:e},t))}),se.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:e.action})]},t))})]})}):null}const RC={"even-horizontal":se.jsx(iC,{size:14}),"even-vertical":se.jsx(Ax,{size:14}),"main-left":se.jsx(Yx,{size:14}),"main-top":se.jsx(Qx,{size:14}),grid:se.jsx(Ox,{size:14})},TC={"even-horizontal":"Rows","even-vertical":"Columns","main-left":"Main + Stack","main-top":"Main + Row",grid:"Grid"};function MC({onNewPane:e}){const[t,i]=Y.useState(!1),[r,s]=Y.useState(!1),n=md(e=>e.sidebarOpen),o=md(e=>e.toggleSidebar),a=Gu(e=>e.activeProjectId),l=ud(e=>e.currentPresetIndex),c=ud(e=>e.cyclePreset),h=px(e=>e.addFavourite),u=od[l],d=a?Zu(ud.getState().getLayout(a)).length:0;return se.jsxs("div",{className:"h-9 flex-shrink-0 flex items-center px-2 gap-1 bg-[var(--surface-1)] border-b border-[var(--border)]",children:[!n&&se.jsx("button",{onClick:o,className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Show sidebar (Cmd+D)",children:se.jsx(Gx,{size:14})}),se.jsx("div",{className:"w-px h-4 bg-[var(--border)] mx-1"}),se.jsx("button",{onClick:()=>e("vertical"),className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Split vertical (Cmd+N)",children:se.jsx(Ax,{size:14})}),se.jsx("button",{onClick:()=>e("horizontal"),className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Split horizontal (Cmd+Shift+N)",children:se.jsx(iC,{size:14})}),se.jsx("div",{className:"w-px h-4 bg-[var(--border)] mx-1"}),se.jsxs("button",{onClick:()=>{if(!a)return;const e=Zu(ud.getState().getLayout(a));e.length>0&&c(a,e)},className:"flex items-center gap-1.5 px-2 py-1 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors text-xs",title:"Cycle layout (Cmd+T)",children:[RC[u],se.jsx("span",{className:"hidden sm:inline",children:TC[u]})]}),se.jsx("button",{onClick:()=>{if(!a)return;const e=Zu(ud.getState().getLayout(a));if(0===e.length)return;let t;t=e.length<=2?"even-vertical":3===e.length?"main-left":"grid";const i=ad(e,t);i&&ud.getState().setLayout(a,i)},className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Auto reorganize (Cmd+R)",children:se.jsx(jx,{size:14})}),se.jsx("div",{className:"w-px h-4 bg-[var(--border)] mx-1"}),se.jsx("button",{onClick:()=>i(!0),className:"p-1.5 rounded text-[var(--text-muted)] hover:text-yellow-400 hover:bg-[var(--surface-3)] transition-colors",title:"Save as favourite",children:se.jsx(sC,{size:14})}),se.jsx("div",{className:"flex-1"}),se.jsx(PC,{}),se.jsx("button",{onClick:()=>s(!0),className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Keyboard shortcuts",children:se.jsx(zx,{size:14})}),se.jsx(xC,{open:t,onClose:()=>i(!1),onSave:(e,t,i)=>{h({id:crypto.randomUUID(),name:e,preset:t,slots:i})},defaultPreset:u,defaultSlotCount:Math.max(d,1)}),se.jsx(LC,{open:r,onClose:()=>s(!1)})]})}function PC(){const e=Sd(e=>e.panelOpen),t=Sd(e=>e.togglePanel),i=Gu(e=>e.activeProjectId),r=Uu(e=>e.gitBranches),s=i?r[i]:null,n=s?s.staged+s.modified:0;return se.jsxs("button",{onClick:t,className:"p-1.5 rounded transition-colors flex items-center gap-1 "+(e?"text-[var(--accent)] bg-[var(--surface-3)]":"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)]"),title:"Source control (Cmd+Shift+G)",children:[e?se.jsx(Zx,{size:14}):se.jsx(Ix,{size:14}),n>0&&se.jsx("span",{className:"text-[10px] font-semibold leading-none",children:n})]})}function AC({terminalId:e,projectId:t,isFocused:i,onClose:r,dragProps:s}){const n=Uu(t=>t.sessions[e]),o=(null==n?void 0:n.title)??"Terminal",a=(null==n?void 0:n.alive)??!0,l=Zu(ud(e=>e.getLayout(t))).indexOf(e)+1;return se.jsxs("div",{draggable:!0,onDragStart:s.onDragStart,onDragEnd:s.onDragEnd,className:`\n flex items-center h-7 px-2 gap-1.5 flex-shrink-0\n border-b transition-colors duration-100\n select-none cursor-grab active:cursor-grabbing\n ${i?"bg-[var(--surface-3)] border-[var(--accent)]":"bg-[var(--surface-2)] border-[var(--border)]"}\n `,children:[se.jsx("div",{className:"text-[var(--text-muted)]",children:se.jsx(Fx,{size:12})}),se.jsx("span",{className:"text-[10px] font-medium text-[var(--text-muted)] tabular-nums",children:l}),se.jsx("span",{className:"text-xs text-[var(--text-secondary)] truncate flex-1",children:o}),!a&&se.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[var(--danger)]"}),se.jsx("button",{onClick:e=>{e.stopPropagation(),r()},onMouseDown:e=>e.stopPropagation(),draggable:!1,className:"\n p-0.5 rounded text-[var(--text-muted)]\n hover:text-[var(--danger)] hover:bg-[var(--danger-dim)]\n transition-colors\n ",children:se.jsx(hC,{size:12})})]})}const DC={matchBackground:void 0,matchBorder:"#facc15aa",matchOverviewRuler:"#facc15",activeMatchBackground:"#694d00",activeMatchBorder:"#fde047",activeMatchColorOverviewRuler:"#facc15"};function NC({terminalId:e,onClose:t}){const i=Y.useRef(null),[r,s]=Y.useState("");Y.useEffect(()=>{var e;null==(e=i.current)||e.focus()},[]);const n=Y.useCallback(()=>{const t=ox(e);t&&r&&t.findNext(r,{regex:!1,caseSensitive:!1,incremental:!1,decorations:DC})},[e,r]),o=Y.useCallback(()=>{const t=ox(e);t&&r&&t.findPrevious(r,{regex:!1,caseSensitive:!1,incremental:!1,decorations:DC})},[e,r]),a=Y.useCallback(()=>{const i=ox(e);null==i||i.clearDecorations(),t()},[e,t]);return se.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-[var(--surface-2)] border-b border-[var(--border)]",onClick:e=>e.stopPropagation(),children:[se.jsx("input",{ref:i,type:"text",value:r,onChange:t=>{const i=t.target.value;s(i);const r=ox(e);r&&(i?r.findNext(i,{regex:!1,caseSensitive:!1,incremental:!0,decorations:DC}):r.clearDecorations())},onKeyDown:e=>{if("Escape"===e.key)return e.stopPropagation(),void a();"Enter"===e.key&&(e.preventDefault(),e.shiftKey?o():n())},placeholder:"Search...",className:"flex-1 min-w-0 bg-[var(--surface-0)] text-[var(--text-primary)] text-sm px-3 py-1.5 rounded-md border border-[var(--border)] outline-none focus:border-[var(--accent)] placeholder:text-[var(--text-muted)]"}),se.jsx("button",{onClick:o,className:"p-1.5 rounded-md text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Previous match (Shift+Enter)",children:se.jsx(Lx,{size:16})}),se.jsx("button",{onClick:n,className:"p-1.5 rounded-md text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Next match (Enter)",children:se.jsx(kx,{size:16})}),se.jsx("button",{onClick:a,className:"p-1.5 rounded-md text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Close (Escape)",children:se.jsx(hC,{size:16})})]})}function IC({terminalId:e}){const t=md(e=>e.dropTarget);if(!t||t.terminalId!==e)return null;const i=t.edge,r="center"===i;return se.jsx("div",{className:`\n absolute ${{left:"left-0 top-0 bottom-0 w-1/2",right:"right-0 top-0 bottom-0 w-1/2",top:"left-0 right-0 top-0 h-1/2",bottom:"left-0 right-0 bottom-0 h-1/2",center:"inset-0"}[i]??"inset-0"}\n pointer-events-none z-20\n ${r?"bg-accent/15 border-2 border-accent/40":"bg-accent/20 border-2 border-accent/50"}\n rounded-sm transition-all duration-100\n `})}function BC({terminalId:e,projectId:t,cwd:i}){const r=md(t=>t.focusedTerminalId===e),s=md(t=>t.draggingTerminalId===e),n=md(t=>t.searchTerminalId===e),{containerRef:o,fit:a,focus:l}=lx({terminalId:e,projectId:t,cwd:i}),c=function(e,t){const i=md(e=>e.setDragging),r=md(e=>e.setDropTarget),s=md(e=>e.draggingTerminalId),n=ud(e=>e.movePaneInProject),o=ud(e=>e.swapPanesInProject),a=Y.useCallback(t=>{t.dataTransfer.setData("text/plain",e),t.dataTransfer.effectAllowed="move",i(e)},[e,i]),l=Y.useCallback(()=>{i(null),r(null)},[i,r]),c=Y.useCallback(t=>{if(t.preventDefault(),t.dataTransfer.dropEffect="move",!s||s===e)return void r(null);const i=t.currentTarget.getBoundingClientRect(),n=(t.clientX-i.left)/i.width,o=(t.clientY-i.top)/i.height;let a="center";const l=.2;n<l?a="left":n>.8?a="right":o<l?a="top":o>.8&&(a="bottom"),r({terminalId:e,edge:a})},[e,s,r]),h=Y.useCallback(()=>{r(null)},[r]),u=Y.useCallback(s=>{s.preventDefault();const a=s.dataTransfer.getData("text/plain");if(!a||a===e)return;const l=md.getState().dropTarget;l&&("center"===l.edge?o(t,a,e):n(t,a,e,l.edge),i(null),r(null))},[e,t,n,o,i,r]);return{onDragStart:a,onDragEnd:l,onDragOver:c,onDragLeave:h,onDrop:u}}(e,t);!function(e,t){const i=Y.useRef();Y.useEffect(()=>{const r=e.current;if(!r)return;const s=new ResizeObserver(()=>{clearTimeout(i.current),i.current=setTimeout(t,50)});return s.observe(r),()=>{s.disconnect(),clearTimeout(i.current)}},[e,t])}(o,a);const h=Y.useCallback(()=>{var i;ux({type:"pty:kill",terminalId:e}),ud.getState().removePaneFromProject(t,e),Gu.getState().removeTerminalFromProject(t,e);const r=Uu.getState().sessions[e];null==(i=null==r?void 0:r.terminal)||i.dispose(),Uu.getState().removeSession(e),cx(e);const s=Zu(ud.getState().getLayout(t));md.getState().setFocusedTerminal(s[0]??null)},[e,t]),u=Y.useCallback(t=>{if(!(null!=md.getState().draggingTerminalId)){const i=fC();if(i)return t.preventDefault(),t.stopPropagation(),ux({type:"pty:input",terminalId:e,data:i.map(pC).join(" ")}),void l();const r=function(e){const t=e.getData("codefiles");if(t)try{const e=JSON.parse(t);if(Array.isArray(e)&&e.length>0)return e}catch{}const i=e.getData("text/uri-list").trim();if(i){const e=_C(i);if(e.length>0)return e}const r=e.getData("text/plain").trim();if(r){const e=_C(r);if(e.length>0)return e;if(r.startsWith("/")){const e=r.split("\n").map(e=>e.trim()).filter(Boolean);if(e.length>0)return e}}return[]}(t.dataTransfer);if(r.length>0)return t.preventDefault(),t.stopPropagation(),ux({type:"pty:input",terminalId:e,data:r.map(pC).join(" ")}),void l()}if(t.dataTransfer.types.includes("Files")&&t.dataTransfer.files.length>0){t.preventDefault(),t.stopPropagation();const r=Array.from(t.dataTransfer.files);return void Promise.all(r.map(e=>fetch("/api/resolve-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name,size:e.size,lastModified:e.lastModified,cwd:i})}).then(e=>e.json()).then(e=>e.path).catch(()=>null))).then(t=>{const i=t.filter(Boolean);i.length>0&&(ux({type:"pty:input",terminalId:e,data:i.map(pC).join(" ")}),l())})}c.onDrop(t)},[e,c,l]),d=Y.useCallback(e=>{if(null==md.getState().draggingTerminalId)return e.dataTransfer.types.includes("Files")||e.dataTransfer.types.includes("codefiles")||e.dataTransfer.types.includes("text/uri-list")||e.dataTransfer.types.includes("text/plain")?(e.preventDefault(),void(e.dataTransfer.dropEffect="copy")):void c.onDragOver(e);c.onDragOver(e)},[c]);return se.jsxs("div",{"data-terminal-id":e,style:{borderColor:r?"var(--accent)":"transparent"},className:`\n flex flex-col h-full w-full relative border\n ${s?"opacity-40":""}\n transition-colors duration-100\n `,onMouseDown:l,onDragOver:d,onDragLeave:c.onDragLeave,onDrop:u,children:[se.jsx(AC,{terminalId:e,projectId:t,isFocused:r,onClose:h,dragProps:{onDragStart:c.onDragStart,onDragEnd:c.onDragEnd}}),n&&se.jsx(NC,{terminalId:e,onClose:()=>{md.getState().closeSearch(),l()}}),se.jsx("div",{ref:o,className:"flex-1 min-h-0 min-w-0 overflow-hidden"}),se.jsx(IC,{terminalId:e})]})}function OC({projectId:e,path:t,direction:i}){const{onMouseDown:r,containerRef:s}=function({projectId:e,path:t,direction:i}){const r=ud(e=>e.resizePaneInProject),s=Y.useRef(null),n=Y.useCallback(n=>{var o;n.preventDefault(),n.stopPropagation();const a=null==(o=s.current)?void 0:o.parentElement;if(!a)return;const l=a.getBoundingClientRect();"vertical"===i?n.clientX:n.clientY;const c="vertical"===i?l.width:l.height,h=s=>{const n="vertical"===i?s.clientX:s.clientY,o="vertical"===i?l.left:l.top;r(e,t,(n-o)/c)},u=()=>{document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",u),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",h),document.addEventListener("mouseup",u),document.body.style.cursor="vertical"===i?"col-resize":"row-resize",document.body.style.userSelect="none"},[e,t,i,r]);return{onMouseDown:n,containerRef:s}}({projectId:e,path:t,direction:i}),n="vertical"===i;return se.jsxs("div",{ref:s,className:`\n relative z-10 flex-shrink-0\n ${n?"w-[4px] cursor-col-resize":"h-[4px] cursor-row-resize"}\n group\n `,onMouseDown:r,children:[se.jsx("div",{className:`\n absolute\n ${n?"inset-y-0 -left-[2px] w-[8px]":"inset-x-0 -top-[2px] h-[8px]"}\n transition-colors duration-150\n hover:bg-accent/40\n group-active:bg-accent/60\n `}),se.jsx("div",{className:`\n ${n?"w-full h-full":"h-full w-full"}\n bg-[var(--border)]\n transition-colors duration-150\n group-hover:bg-accent/60\n group-active:bg-accent\n `})]})}function FC({node:e,projectId:t,cwd:i,path:r=[]}){if("leaf"===e.type)return se.jsx(BC,{terminalId:e.terminalId,projectId:t,cwd:i});const s="vertical"===e.direction,n=100*e.ratio+"%",o=100*(1-e.ratio)+"%";return se.jsxs("div",{className:`flex ${s?"flex-row":"flex-col"} h-full w-full`,children:[se.jsx("div",{style:{flexBasis:n,minWidth:0,minHeight:0,overflow:"hidden"},className:"flex",children:se.jsx(FC,{node:e.first,projectId:t,cwd:i,path:[...r,0]})}),se.jsx(OC,{projectId:t,path:r,direction:e.direction}),se.jsx("div",{style:{flexBasis:o,minWidth:0,minHeight:0,overflow:"hidden"},className:"flex",children:se.jsx(FC,{node:e.second,projectId:t,cwd:i,path:[...r,1]})})]})}function zC({onNewTerminal:e,projectName:t}){const i=function(){const[e,t]=Y.useState(null);return Y.useEffect(()=>{let e=!1;return Math.random()<.5?fetch("https://dummyjson.com/quotes/random").then(e=>e.json()).then(i=>{!e&&(null==i?void 0:i.quote)&&t({text:i.quote,attribution:i.author})}).catch(()=>{}):fetch("https://uselessfacts.jsph.pl/api/v2/facts/random?language=en").then(e=>e.json()).then(i=>{!e&&(null==i?void 0:i.text)&&t({text:i.text})}).catch(()=>{}),()=>{e=!0}},[]),e}(),r=px(e=>e.favourites),s=Object.values(r);return se.jsx("div",{className:"h-full w-full flex items-center justify-center bg-[var(--surface-0)]",children:se.jsxs("div",{className:"flex flex-col items-center gap-8 text-center max-w-md px-8",children:[se.jsxs("div",{className:"flex flex-col items-center gap-4",children:[se.jsx("div",{className:"w-16 h-16 rounded-2xl bg-[var(--surface-2)] border border-[var(--border)] flex items-center justify-center",children:se.jsx(oC,{size:28,className:"text-[var(--text-muted)]"})}),se.jsxs("div",{children:[se.jsx("h2",{className:"text-lg font-medium text-[var(--text-primary)] mb-1",children:t??"No project selected"}),se.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:t?"This project has no active terminals.":"Create a project to get started."})]}),t&&se.jsxs("button",{onClick:e,className:"\n flex items-center gap-2 px-5 py-2.5\n bg-accent hover:bg-accent/80\n text-white text-sm font-medium\n rounded-lg transition-colors\n ",children:[se.jsx(tC,{size:16}),"New Terminal"]})]}),t&&s.length>0&&se.jsxs("div",{className:"w-full rounded-xl bg-[var(--surface-1)] border border-[var(--border)] p-4",children:[se.jsxs("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-[var(--text-muted)] mb-3 text-left flex items-center gap-1.5",children:[se.jsx(sC,{size:11}),"Favourites"]}),se.jsx("div",{className:"space-y-1.5",children:s.map(e=>se.jsxs("button",{onClick:()=>md.getState().requestFavouriteLaunch(e.id),className:"\n group w-full flex items-center gap-2.5 px-3 py-2.5\n bg-[var(--surface-2)] hover:bg-[var(--surface-3)]\n text-sm text-[var(--text-secondary)] hover:text-[var(--text-primary)]\n rounded-lg transition-colors text-left\n ",children:[se.jsx(eC,{size:12,className:"text-[var(--text-muted)] group-hover:text-[var(--accent)] shrink-0 transition-colors"}),se.jsx("span",{className:"truncate font-medium",children:e.name}),se.jsxs("span",{className:"ml-auto text-[10px] text-[var(--text-muted)] tabular-nums shrink-0",children:[e.slots.length," pane",1!==e.slots.length?"s":""]})]},e.id))})]}),i&&se.jsxs("div",{className:"max-w-sm",children:[se.jsxs("p",{className:"text-sm italic text-[var(--text-muted)] leading-relaxed",children:['"',i.text,'"']}),i.attribution&&se.jsxs("p",{className:"text-xs text-[var(--text-muted)]/60 mt-2",children:["— ",i.attribution]})]})]})})}function jC(){const e=md(e=>e.syncToast),t=md(e=>e.dismissSyncToast),[i,r]=Y.useState(!1);return Y.useEffect(()=>{if(!e)return void r(!1);requestAnimationFrame(()=>r(!0));const i=setTimeout(()=>{r(!1),setTimeout(t,200)},3e3);return()=>clearTimeout(i)},[null==e?void 0:e.id]),e?se.jsxs("div",{onClick:()=>{r(!1),setTimeout(t,200)},style:{position:"absolute",top:16,left:"50%",zIndex:9999,display:"flex",alignItems:"center",gap:8,padding:"8px 14px",borderRadius:8,background:"#facc15",color:"#1a1a1a",border:"1px solid #eab308",fontSize:13,cursor:"pointer",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",opacity:i?1:0,transform:i?"translate(-50%, 0)":"translate(-50%, -8px)",transition:"opacity 200ms ease, transform 200ms ease",pointerEvents:i?"auto":"none"},children:[se.jsx(Ux,{size:15,style:{color:"#a16207",flexShrink:0}}),se.jsxs("span",{children:["Synced to ",se.jsx("strong",{children:e.projectName})]})]}):null}function $C(){const e=md(e=>e.commandPaletteOpen),t=md(e=>e.closeCommandPalette);return e?se.jsx(WC,{onClose:t}):null}function WC({onClose:e}){const[t,i]=Y.useState(""),[r,s]=Y.useState(0),n=Y.useRef(null),o=Y.useRef(null);Y.useEffect(()=>{var e;null==(e=n.current)||e.focus()},[]);const a=Y.useMemo(()=>function(){const e=[],t=Gu.getState().projects,i=px.getState().favourites,r=Gu.getState().activeProjectId;for(const n of Object.values(t))e.push({id:`project:${n.id}`,label:`Switch to ${n.name}`,category:"Project",icon:se.jsx(Nx,{size:14}),action:()=>{Gu.getState().setActiveProject(n.id)}});for(const n of Object.values(i))e.push({id:`fav:${n.id}`,label:`Launch ${n.name}`,category:"Favourite",icon:se.jsx(sC,{size:14}),action:()=>{md.getState().requestFavouriteLaunch(n.id)}});const s={"even-horizontal":{label:"Layout: Rows",icon:se.jsx(iC,{size:14})},"even-vertical":{label:"Layout: Columns",icon:se.jsx(Ax,{size:14})},"main-left":{label:"Layout: Main + Stack",icon:se.jsx(Yx,{size:14})},"main-top":{label:"Layout: Main + Row",icon:se.jsx(Qx,{size:14})},grid:{label:"Layout: Grid",icon:se.jsx(Ox,{size:14})}};for(const n of od){const t=s[n];e.push({id:`layout:${n}`,label:t.label,category:"Layout",icon:t.icon,action:()=>{if(!r)return;const e=Zu(ud.getState().getLayout(r));if(0===e.length)return;const t=ad(e,n);t&&ud.getState().setLayout(r,t)}})}return e.push({id:"action:new-pane-v",label:"New pane (vertical)",category:"Action",icon:se.jsx(tC,{size:14}),shortcut:"⌘N",action:()=>{if(!r)return;const e=Zu(ud.getState().getLayout(r)),t=md.getState().focusedTerminalId,i=crypto.randomUUID(),s=t??e[e.length-1];s?ud.getState().addPaneToProject(r,s,i,"vertical"):ud.getState().setLayout(r,{type:"leaf",terminalId:i}),Gu.getState().addTerminalToProject(r,i),md.getState().setFocusedTerminal(i)}}),e.push({id:"action:new-pane-h",label:"New pane (horizontal)",category:"Action",icon:se.jsx(tC,{size:14}),shortcut:"⌘⇧N",action:()=>{if(!r)return;const e=Zu(ud.getState().getLayout(r)),t=md.getState().focusedTerminalId,i=crypto.randomUUID(),s=t??e[e.length-1];s?ud.getState().addPaneToProject(r,s,i,"horizontal"):ud.getState().setLayout(r,{type:"leaf",terminalId:i}),Gu.getState().addTerminalToProject(r,i),md.getState().setFocusedTerminal(i)}}),e.push({id:"action:close-pane",label:"Close pane",category:"Action",icon:se.jsx(hC,{size:14}),shortcut:"⌘W",action:()=>{var e;if(!r)return;const t=md.getState().focusedTerminalId;if(!t)return;ux({type:"pty:kill",terminalId:t}),ud.getState().removePaneFromProject(r,t),Gu.getState().removeTerminalFromProject(r,t);const i=Uu.getState().sessions[t];null==(e=null==i?void 0:i.terminal)||e.dispose(),Uu.getState().removeSession(t),cx(t);const s=Zu(ud.getState().getLayout(r));md.getState().setFocusedTerminal(s[0]??null)}}),e.push({id:"action:toggle-sidebar",label:"Toggle sidebar",category:"Action",icon:se.jsx(Vx,{size:14}),shortcut:"⌘D",action:()=>{md.getState().toggleSidebar()}}),e.push({id:"action:cycle-theme",label:"Cycle theme",category:"Action",icon:se.jsx(Ux,{size:14}),action:()=>{md.getState().cycleTheme()}}),e.push({id:"action:toggle-editor-sync",label:"Toggle editor sync",category:"Action",icon:se.jsx(Ux,{size:14}),action:()=>{md.getState().toggleEditorSync()}}),e.push({id:"action:toggle-gpu-rendering",label:"Toggle GPU rendering",category:"Action",icon:se.jsx(uC,{size:14}),action:()=>{md.getState().toggleGpuRendering()}}),e.push({id:"action:auto-reorganize",label:"Auto reorganize",category:"Action",icon:se.jsx(jx,{size:14}),shortcut:"⌘R",action:()=>{if(!r)return;const e=Zu(ud.getState().getLayout(r));if(0===e.length)return;let t;t=e.length<=2?"even-vertical":3===e.length?"main-left":"grid";const i=ad(e,t);i&&ud.getState().setLayout(r,i)}}),e}(),[e]),l=Y.useMemo(()=>{if(!t.trim())return a;const e=t.toLowerCase();return a.filter(t=>t.label.toLowerCase().includes(e))},[a,t]);Y.useEffect(()=>{s(0)},[t]);const c=Y.useCallback(t=>{t.action(),e()},[e]);return Y.useEffect(()=>{const e=o.current;if(!e)return;const t=e.children[r];null==t||t.scrollIntoView({block:"nearest"})},[r]),se.jsx("div",{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm",onClick:e,children:se.jsxs("div",{className:"max-w-lg mx-auto mt-[20vh] bg-[var(--surface-1)] border border-[var(--border)] rounded-xl shadow-2xl overflow-hidden",onClick:e=>e.stopPropagation(),children:[se.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-[var(--border)]",children:[se.jsx(rC,{size:16,className:"text-[var(--text-muted)] shrink-0"}),se.jsx("input",{ref:n,type:"text",value:t,onChange:e=>i(e.target.value),onKeyDown:t=>"Escape"===t.key?(t.preventDefault(),t.stopPropagation(),void e()):"ArrowDown"===t.key?(t.preventDefault(),void s(e=>Math.min(e+1,l.length-1))):"ArrowUp"===t.key?(t.preventDefault(),void s(e=>Math.max(e-1,0))):"Enter"===t.key?(t.preventDefault(),void(l[r]&&c(l[r]))):void 0,placeholder:"Search commands...",className:"flex-1 bg-transparent text-sm text-[var(--text-primary)] outline-none placeholder:text-[var(--text-muted)]"}),se.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded bg-[var(--surface-3)] text-[10px] text-[var(--text-muted)] font-mono",children:"ESC"})]}),se.jsx("div",{ref:o,className:"max-h-72 overflow-y-auto py-1",children:0===l.length?se.jsx("div",{className:"px-4 py-6 text-center text-xs text-[var(--text-muted)]",children:"No matching commands"}):l.map((e,t)=>se.jsxs("button",{onClick:()=>c(e),onMouseEnter:()=>s(t),className:`\n w-full flex items-center gap-3 px-4 py-2 text-left transition-colors\n ${t===r?"bg-[var(--surface-2)] text-[var(--text-primary)]":"text-[var(--text-secondary)] hover:bg-[var(--surface-2)]"}\n `,children:[se.jsx("span",{className:"shrink-0 text-[var(--text-muted)]",children:e.icon}),se.jsx("span",{className:"flex-1 text-xs truncate",children:e.label}),se.jsx("span",{className:"shrink-0 text-[9px] px-1.5 py-0.5 rounded bg-[var(--surface-3)] text-[var(--text-muted)]",children:e.category}),e.shortcut&&se.jsx("kbd",{className:"shrink-0 text-[10px] px-1.5 py-0.5 rounded bg-[var(--surface-3)] text-[var(--text-muted)] font-mono",children:e.shortcut})]},e.id))})]})})}var HC,UC,qC={exports:{}};HC=qC,UC=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,i=0,r={},s={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof n?new n(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++i}),e.__id},clone:function e(t,i){var r,n;switch(i=i||{},s.util.type(t)){case"Object":if(n=s.util.objId(t),i[n])return i[n];for(var o in r={},i[n]=r,t)t.hasOwnProperty(o)&&(r[o]=e(t[o],i));return r;case"Array":return n=s.util.objId(t),i[n]?i[n]:(r=[],i[n]=r,t.forEach(function(t,s){r[s]=e(t,i)}),r);default:return t}},getLanguage:function(e){for(;e;){var i=t.exec(e.className);if(i)return i[1].toLowerCase();e=e.parentElement}return"none"},setLanguage:function(e,i){e.className=e.className.replace(RegExp(t,"gi"),""),e.classList.add("language-"+i)},currentScript:function(){if("undefined"==typeof document)return null;if(document.currentScript&&"SCRIPT"===document.currentScript.tagName)return document.currentScript;try{throw new Error}catch(r){var e=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(r.stack)||[])[1];if(e){var t=document.getElementsByTagName("script");for(var i in t)if(t[i].src==e)return t[i]}return null}},isActive:function(e,t,i){for(var r="no-"+t;e;){var s=e.classList;if(s.contains(t))return!0;if(s.contains(r))return!1;e=e.parentElement}return!!i}},languages:{plain:r,plaintext:r,text:r,txt:r,extend:function(e,t){var i=s.util.clone(s.languages[e]);for(var r in t)i[r]=t[r];return i},insertBefore:function(e,t,i,r){var n=(r=r||s.languages)[e],o={};for(var a in n)if(n.hasOwnProperty(a)){if(a==t)for(var l in i)i.hasOwnProperty(l)&&(o[l]=i[l]);i.hasOwnProperty(a)||(o[a]=n[a])}var c=r[e];return r[e]=o,s.languages.DFS(s.languages,function(t,i){i===c&&t!=e&&(this[t]=o)}),o},DFS:function e(t,i,r,n){n=n||{};var o=s.util.objId;for(var a in t)if(t.hasOwnProperty(a)){i.call(t,a,t[a],r||a);var l=t[a],c=s.util.type(l);"Object"!==c||n[o(l)]?"Array"!==c||n[o(l)]||(n[o(l)]=!0,e(l,i,a,n)):(n[o(l)]=!0,e(l,i,null,n))}}},plugins:{},highlightAll:function(e,t){s.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,i){var r={callback:i,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};s.hooks.run("before-highlightall",r),r.elements=Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)),s.hooks.run("before-all-elements-highlight",r);for(var n,o=0;n=r.elements[o++];)s.highlightElement(n,!0===t,r.callback)},highlightElement:function(t,i,r){var n=s.util.getLanguage(t),o=s.languages[n];s.util.setLanguage(t,n);var a=t.parentElement;a&&"pre"===a.nodeName.toLowerCase()&&s.util.setLanguage(a,n);var l={element:t,language:n,grammar:o,code:t.textContent};function c(e){l.highlightedCode=e,s.hooks.run("before-insert",l),l.element.innerHTML=l.highlightedCode,s.hooks.run("after-highlight",l),s.hooks.run("complete",l),r&&r.call(l.element)}if(s.hooks.run("before-sanity-check",l),(a=l.element.parentElement)&&"pre"===a.nodeName.toLowerCase()&&!a.hasAttribute("tabindex")&&a.setAttribute("tabindex","0"),!l.code)return s.hooks.run("complete",l),void(r&&r.call(l.element));if(s.hooks.run("before-highlight",l),l.grammar)if(i&&e.Worker){var h=new Worker(s.filename);h.onmessage=function(e){c(e.data)},h.postMessage(JSON.stringify({language:l.language,code:l.code,immediateClose:!0}))}else c(s.highlight(l.code,l.grammar,l.language));else c(s.util.encode(l.code))},highlight:function(e,t,i){var r={code:e,grammar:t,language:i};if(s.hooks.run("before-tokenize",r),!r.grammar)throw new Error('The language "'+r.language+'" has no grammar.');return r.tokens=s.tokenize(r.code,r.grammar),s.hooks.run("after-tokenize",r),n.stringify(s.util.encode(r.tokens),r.language)},tokenize:function(e,t){var i=t.rest;if(i){for(var r in i)t[r]=i[r];delete t.rest}var s=new l;return c(s,s.head,e),a(e,s,t,s.head,0),function(e){for(var t=[],i=e.head.next;i!==e.tail;)t.push(i.value),i=i.next;return t}(s)},hooks:{all:{},add:function(e,t){var i=s.hooks.all;i[e]=i[e]||[],i[e].push(t)},run:function(e,t){var i=s.hooks.all[e];if(i&&i.length)for(var r,n=0;r=i[n++];)r(t)}},Token:n};function n(e,t,i,r){this.type=e,this.content=t,this.alias=i,this.length=0|(r||"").length}function o(e,t,i,r){e.lastIndex=t;var s=e.exec(i);if(s&&r&&s[1]){var n=s[1].length;s.index+=n,s[0]=s[0].slice(n)}return s}function a(e,t,i,r,l,u){for(var d in i)if(i.hasOwnProperty(d)&&i[d]){var f=i[d];f=Array.isArray(f)?f:[f];for(var p=0;p<f.length;++p){if(u&&u.cause==d+","+p)return;var _=f[p],g=_.inside,m=!!_.lookbehind,v=!!_.greedy,b=_.alias;if(v&&!_.pattern.global){var y=_.pattern.toString().match(/[imsuy]*$/)[0];_.pattern=RegExp(_.pattern.source,y+"g")}for(var S=_.pattern||_,w=r.next,x=l;w!==t.tail&&!(u&&x>=u.reach);x+=w.value.length,w=w.next){var C=w.value;if(t.length>e.length)return;if(!(C instanceof n)){var k,E=1;if(v){if(!(k=o(S,x,e,m))||k.index>=e.length)break;var L=k.index,R=k.index+k[0].length,T=x;for(T+=w.value.length;L>=T;)T+=(w=w.next).value.length;if(x=T-=w.value.length,w.value instanceof n)continue;for(var M=w;M!==t.tail&&(T<R||"string"==typeof M.value);M=M.next)E++,T+=M.value.length;E--,C=e.slice(x,T),k.index-=x}else if(!(k=o(S,0,C,m)))continue;L=k.index;var P=k[0],A=C.slice(0,L),D=C.slice(L+P.length),N=x+C.length;u&&N>u.reach&&(u.reach=N);var I=w.prev;if(A&&(I=c(t,I,A),x+=A.length),h(t,I,E),w=c(t,I,new n(d,g?s.tokenize(P,g):P,b,P)),D&&c(t,w,D),E>1){var B={cause:d+","+p,reach:N};a(e,t,i,w.prev,x,B),u&&B.reach>u.reach&&(u.reach=B.reach)}}}}}}function l(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function c(e,t,i){var r=t.next,s={value:i,prev:t,next:r};return t.next=s,r.prev=s,e.length++,s}function h(e,t,i){for(var r=t.next,s=0;s<i&&r!==e.tail;s++)r=r.next;t.next=r,r.prev=t,e.length-=s}if(e.Prism=s,n.stringify=function e(t,i){if("string"==typeof t)return t;if(Array.isArray(t)){var r="";return t.forEach(function(t){r+=e(t,i)}),r}var n={type:t.type,content:e(t.content,i),tag:"span",classes:["token",t.type],attributes:{},language:i},o=t.alias;o&&(Array.isArray(o)?Array.prototype.push.apply(n.classes,o):n.classes.push(o)),s.hooks.run("wrap",n);var a="";for(var l in n.attributes)a+=" "+l+'="'+(n.attributes[l]||"").replace(/"/g,"&quot;")+'"';return"<"+n.tag+' class="'+n.classes.join(" ")+'"'+a+">"+n.content+"</"+n.tag+">"},!e.document)return e.addEventListener?(s.disableWorkerMessageHandler||e.addEventListener("message",function(t){var i=JSON.parse(t.data),r=i.language,n=i.code,o=i.immediateClose;e.postMessage(s.highlight(n,s.languages[r],r)),o&&e.close()},!1),s):s;var u=s.util.currentScript();function d(){s.manual||s.highlightAll()}if(u&&(s.filename=u.src,u.hasAttribute("data-manual")&&(s.manual=!0)),!s.manual){var f=document.readyState;"loading"===f||"interactive"===f&&u&&u.defer?document.addEventListener("DOMContentLoaded",d):window.requestAnimationFrame?window.requestAnimationFrame(d):window.setTimeout(d,16)}return s}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{}),HC.exports&&(HC.exports=UC),void 0!==c&&(c.Prism=UC),UC.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},UC.languages.markup.tag.inside["attr-value"].inside.entity=UC.languages.markup.entity,UC.languages.markup.doctype.inside["internal-subset"].inside=UC.languages.markup,UC.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&amp;/,"&"))}),Object.defineProperty(UC.languages.markup.tag,"addInlined",{value:function(e,t){var i={};i["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:UC.languages[t]},i.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:i}};r["language-"+t]={pattern:/[\s\S]+/,inside:UC.languages[t]};var s={};s[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:r},UC.languages.insertBefore("markup","cdata",s)}}),Object.defineProperty(UC.languages.markup.tag,"addAttribute",{value:function(e,t){UC.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:UC.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),UC.languages.html=UC.languages.markup,UC.languages.mathml=UC.languages.markup,UC.languages.svg=UC.languages.markup,UC.languages.xml=UC.languages.extend("markup",{}),UC.languages.ssml=UC.languages.xml,UC.languages.atom=UC.languages.xml,UC.languages.rss=UC.languages.xml,function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var i=e.languages.markup;i&&(i.tag.addInlined("style","css"),i.tag.addAttribute("style","css"))}(UC),UC.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},UC.languages.javascript=UC.languages.extend("clike",{"class-name":[UC.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),UC.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,UC.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:UC.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:UC.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:UC.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:UC.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:UC.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),UC.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:UC.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),UC.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),UC.languages.markup&&(UC.languages.markup.tag.addInlined("script","javascript"),UC.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),UC.languages.js=UC.languages.javascript,function(){if(void 0!==UC&&"undefined"!=typeof document){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var e={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},t="data-src-status",i="loading",r="loaded",s="pre[data-src]:not(["+t+'="'+r+'"]):not(['+t+'="'+i+'"])';UC.hooks.add("before-highlightall",function(e){e.selector+=", "+s}),UC.hooks.add("before-sanity-check",function(n){var o=n.element;if(o.matches(s)){n.code="",o.setAttribute(t,i);var a=o.appendChild(document.createElement("CODE"));a.textContent="Loading…";var l=o.getAttribute("data-src"),c=n.language;if("none"===c){var h=(/\.(\w+)$/.exec(l)||[,"none"])[1];c=e[h]||h}UC.util.setLanguage(a,c),UC.util.setLanguage(o,c);var u=UC.plugins.autoloader;u&&u.loadLanguages(c),function(e,t,i){var r=new XMLHttpRequest;r.open("GET",e,!0),r.onreadystatechange=function(){4==r.readyState&&(r.status<400&&r.responseText?t(r.responseText):r.status>=400?i("✖ Error "+r.status+" while fetching file: "+r.statusText):i("✖ Error: File does not exist or is empty"))},r.send(null)}(l,function(e){o.setAttribute(t,r);var i=function(e){var t=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(e||"");if(t){var i=Number(t[1]),r=t[2],s=t[3];return r?s?[i,Number(s)]:[i,void 0]:[i,i]}}(o.getAttribute("data-range"));if(i){var s=e.split(/\r\n?|\n/g),n=i[0],l=null==i[1]?s.length:i[1];n<0&&(n+=s.length),n=Math.max(0,Math.min(n-1,s.length)),l<0&&(l+=s.length),l=Math.max(0,Math.min(l,s.length)),e=s.slice(n,l).join("\n"),o.hasAttribute("data-start")||o.setAttribute("data-start",String(n+1))}a.textContent=e,UC.highlightElement(a)},function(e){o.setAttribute(t,"failed"),a.textContent=e})}}),UC.plugins.fileHighlight={highlight:function(e){for(var t,i=(e||document).querySelectorAll(s),r=0;t=i[r++];)UC.highlightElement(t)}};var n=!1;UC.fileHighlight=function(){n||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),n=!0),UC.plugins.fileHighlight.highlight.apply(this,arguments)}}}();const KC=h(qC.exports);Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},Prism.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&amp;/,"&"))}),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(e,t){var i={};i["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[t]},i.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:i}};r["language-"+t]={pattern:/[\s\S]+/,inside:Prism.languages[t]};var s={};s[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:r},Prism.languages.insertBefore("markup","cdata",s)}}),Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(e,t){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:Prism.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml,function(e){function t(e,t){return"___"+e.toUpperCase()+t+"___"}Object.defineProperties(e.languages["markup-templating"]={},{buildPlaceholders:{value:function(i,r,s,n){if(i.language===r){var o=i.tokenStack=[];i.code=i.code.replace(s,function(e){if("function"==typeof n&&!n(e))return e;for(var s,a=o.length;-1!==i.code.indexOf(s=t(r,a));)++a;return o[a]=e,s}),i.grammar=e.languages.markup}}},tokenizePlaceholders:{value:function(i,r){if(i.language===r&&i.tokenStack){i.grammar=e.languages[r];var s=0,n=Object.keys(i.tokenStack);!function o(a){for(var l=0;l<a.length&&!(s>=n.length);l++){var c=a[l];if("string"==typeof c||c.content&&"string"==typeof c.content){var h=n[s],u=i.tokenStack[h],d="string"==typeof c?c:c.content,f=t(r,h),p=d.indexOf(f);if(p>-1){++s;var _=d.substring(0,p),g=new e.Token(r,e.tokenize(u,i.grammar),"language-"+r,u),m=d.substring(p+f.length),v=[];_&&v.push.apply(v,o([_])),v.push(g),m&&v.push.apply(v,o([m])),"string"==typeof c?a.splice.apply(a,[l,1].concat(v)):c.content=v}}else c.content&&o(c.content)}return a}(i.tokens)}}}})}(Prism),Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),Prism.languages.js=Prism.languages.javascript,function(e){e.languages.typescript=e.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript}(Prism),function(e){var t=e.util.clone(e.languages.javascript),i=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,r=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,s=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function n(e,t){return e=e.replace(/<S>/g,function(){return i}).replace(/<BRACES>/g,function(){return r}).replace(/<SPREAD>/g,function(){return s}),RegExp(e,t)}s=n(s).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=n(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:n(/<SPREAD>/.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:n(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);var o=function(e){return e?"string"==typeof e?e:"string"==typeof e.content?e.content:e.content.map(o).join(""):""},a=function(t){for(var i=[],r=0;r<t.length;r++){var s=t[r],n=!1;if("string"!=typeof s&&("tag"===s.type&&s.content[0]&&"tag"===s.content[0].type?"</"===s.content[0].content[0].content?i.length>0&&i[i.length-1].tagName===o(s.content[0].content[1])&&i.pop():"/>"===s.content[s.content.length-1].content||i.push({tagName:o(s.content[0].content[1]),openedBraces:0}):i.length>0&&"punctuation"===s.type&&"{"===s.content?i[i.length-1].openedBraces++:i.length>0&&i[i.length-1].openedBraces>0&&"punctuation"===s.type&&"}"===s.content?i[i.length-1].openedBraces--:n=!0),(n||"string"==typeof s)&&i.length>0&&0===i[i.length-1].openedBraces){var l=o(s);r<t.length-1&&("string"==typeof t[r+1]||"plain-text"===t[r+1].type)&&(l+=o(t[r+1]),t.splice(r+1,1)),r>0&&("string"==typeof t[r-1]||"plain-text"===t[r-1].type)&&(l=o(t[r-1])+l,t.splice(r-1,1),r--),t[r]=new e.Token("plain-text",l,null,l)}s.content&&"string"!=typeof s.content&&a(s.content)}};e.hooks.add("after-tokenize",function(e){"jsx"!==e.language&&"tsx"!==e.language||a(e.tokens)})}(Prism),function(e){var t=e.util.clone(e.languages.typescript);e.languages.tsx=e.languages.extend("jsx",t),delete e.languages.tsx.parameter,delete e.languages.tsx["literal-property"];var i=e.languages.tsx.tag;i.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+i.pattern.source+")",i.pattern.flags),i.lookbehind=!0}(Prism),Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python,Prism.languages.go=Prism.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),Prism.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete Prism.languages.go["class-name"],function(e){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,i=0;i<2;i++)t=t.replace(/<self>/g,function(){return t});t=t.replace(/<self>/g,function(){return/[^\s\S]/.source}),e.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},e.languages.rust["closure-params"].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string}(Prism),function(e){e.languages.ruby=e.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),e.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var t={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:e.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete e.languages.ruby.function;var i="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",r=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;e.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+i+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:t,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:t,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+r),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+r+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),e.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+i),greedy:!0,inside:{interpolation:t,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:t,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:t,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+i),greedy:!0,inside:{interpolation:t,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:t,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete e.languages.ruby.string,e.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),e.languages.rb=e.languages.ruby}(Prism),Prism.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+/(?:elseif|if)\b/.source+"(?:[ \t]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},Prism.languages.swift["string-literal"].forEach(function(e){e.inside.interpolation.inside=Prism.languages.swift}),function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",i={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},r={bash:i,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:i}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},i.inside=e.languages.bash;for(var s=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],n=r.variable[1].inside,o=0;o<s.length;o++)n[s[o]]=e.languages.bash[s[o]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash}(Prism),function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function i(e){return e=e.replace(/<inner>/g,function(){return t}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,s=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return r}),n=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+s+n+"(?:"+s+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+s+n+")(?:"+s+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+s+")"+n+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+s+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:i(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:i(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:i(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:i(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(t){["url","bold","italic","strike","code-snippet"].forEach(function(i){t!==i&&(e.languages.markdown[t].inside.content.inside[i]=e.languages.markdown[i])})}),e.hooks.add("after-tokenize",function(e){"markdown"!==e.language&&"md"!==e.language||function e(t){if(t&&"string"!=typeof t)for(var i=0,r=t.length;i<r;i++){var s=t[i];if("code"===s.type){var n=s.content[1],o=s.content[3];if(n&&o&&"code-language"===n.type&&"code-block"===o.type&&"string"==typeof n.content){var a=n.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp"),l="language-"+(a=(/[a-z][\w-]*/i.exec(a)||[""])[0].toLowerCase());o.alias?"string"==typeof o.alias?o.alias=[o.alias,l]:o.alias.push(l):o.alias=[l]}}else e(s.content)}}(e.tokens)}),e.hooks.add("wrap",function(t){if("code-block"===t.type){for(var i="",r=0,s=t.classes.length;r<s;r++){var n=t.classes[r],c=/language-(.+)/.exec(n);if(c){i=c[1];break}}var h,u=e.languages[i];if(u)t.content=e.highlight((h=t.content,h.replace(o,"").replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(e,t){var i;if("#"===(t=t.toLowerCase())[0])return i="x"===t[1]?parseInt(t.slice(2),16):Number(t.slice(1)),l(i);var r=a[t];return r||e})),u,i);else if(i&&"none"!==i&&e.plugins.autoloader){var d="md-"+(new Date).valueOf()+"-"+Math.floor(1e16*Math.random());t.attributes.id=d,e.plugins.autoloader.loadLanguages(i,function(){var t=document.getElementById(d);t&&(t.innerHTML=e.highlight(t.textContent,e.languages[i],i))})}}});var o=RegExp(e.languages.markup.tag.pattern.source,"gi"),a={amp:"&",lt:"<",gt:">",quot:'"'},l=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(Prism),Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},Prism.languages.webmanifest=Prism.languages.json,function(e){var t=/[*&][^\s[\]{},]+/,i=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r="(?:"+i.source+"(?:[ \t]+"+t.source+")?|"+t.source+"(?:[ \t]+"+i.source+")?)",s=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),n=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function o(e,t){t=(t||"").replace(/m/g,"")+"m";var i=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<value>>/g,function(){return e});return RegExp(i,t)}e.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return r})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<key>>/g,function(){return"(?:"+s+"|"+n+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:o(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:o(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:o(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:o(n),lookbehind:!0,greedy:!0},number:{pattern:o(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:i,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml}(Prism),function(e){var t=/(?:[\w-]+|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*")/.source;function i(e){return e.replace(/__/g,function(){return t})}e.languages.toml={comment:{pattern:/#.*/,greedy:!0},table:{pattern:RegExp(i(/(^[\t ]*\[\s*(?:\[\s*)?)__(?:\s*\.\s*__)*(?=\s*\])/.source),"m"),lookbehind:!0,greedy:!0,alias:"class-name"},key:{pattern:RegExp(i(/(^[\t ]*|[{,]\s*)__(?:\s*\.\s*__)*(?=\s*=)/.source),"m"),lookbehind:!0,greedy:!0,alias:"property"},string:{pattern:/"""(?:\\[\s\S]|[^\\])*?"""|'''[\s\S]*?'''|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},date:[{pattern:/\b\d{4}-\d{2}-\d{2}(?:[T\s]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?\b/i,alias:"number"},{pattern:/\b\d{2}:\d{2}:\d{2}(?:\.\d+)?\b/,alias:"number"}],number:/(?:\b0(?:x[\da-zA-Z]+(?:_[\da-zA-Z]+)*|o[0-7]+(?:_[0-7]+)*|b[10]+(?:_[10]+)*))\b|[-+]?\b\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?\b|[-+]?\b(?:inf|nan)\b/,boolean:/\b(?:false|true)\b/,punctuation:/[.,=[\]{}]/}}(Prism),function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var i=e.languages.markup;i&&(i.tag.addInlined("style","css"),i.tag.addAttribute("style","css"))}(Prism),Prism.languages.scss=Prism.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),Prism.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),Prism.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),Prism.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),Prism.languages.scss.atrule.inside.rest=Prism.languages.scss,Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},function(e){var t=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,i=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,r={pattern:RegExp(/(^|[^\w.])/.source+i+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};e.languages.java=e.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[r,{pattern:RegExp(/(^|[^\w.])/.source+i+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:r.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+i+/[A-Z]\w*\b/.source),lookbehind:!0,inside:r.inside}],keyword:t,function:[e.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),e.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),e.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":r,keyword:t,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+i+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:r.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+i+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:r.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,function(){return t.source})),lookbehind:!0,inside:{punctuation:/\./}}})}(Prism),function(e){e.languages.kotlin=e.languages.extend("clike",{keyword:{pattern:/(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,lookbehind:!0},function:[{pattern:/(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,greedy:!0},{pattern:/(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,lookbehind:!0,greedy:!0}],number:/\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,operator:/\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/}),delete e.languages.kotlin["class-name"];var t={"interpolation-punctuation":{pattern:/^\$\{?|\}$/,alias:"punctuation"},expression:{pattern:/[\s\S]+/,inside:e.languages.kotlin}};e.languages.insertBefore("kotlin","string",{"string-literal":[{pattern:/"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,alias:"multiline",inside:{interpolation:{pattern:/\$(?:[a-z_]\w*|\{[^{}]*\})/i,inside:t},string:/[\s\S]+/}},{pattern:/"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,alias:"singleline",inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,lookbehind:!0,inside:t},string:/[\s\S]+/}}],char:{pattern:/'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,greedy:!0}}),delete e.languages.kotlin.string,e.languages.insertBefore("kotlin","keyword",{annotation:{pattern:/\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,alias:"builtin"}}),e.languages.insertBefore("kotlin","function",{label:{pattern:/\b\w+@|@\w+\b/,alias:"symbol"}}),e.languages.kt=e.languages.kotlin,e.languages.kts=e.languages.kotlin}(Prism),Prism.languages.c=Prism.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),Prism.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),Prism.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},Prism.languages.c.string],char:Prism.languages.c.char,comment:Prism.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:Prism.languages.c}}}}),Prism.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete Prism.languages.c.boolean,function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,i=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,function(){return t.source});e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,function(){return t.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,function(){return i})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),e.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e.languages.cpp}}}}),e.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),e.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend("cpp",{})}}),e.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp["base-clause"])}(Prism),Prism.languages.objectivec=Prism.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete Prism.languages.objectivec["class-name"],Prism.languages.objc=Prism.languages.objectivec,function(e){var t=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,i=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],r=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,s=/<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,n=/[{}\[\](),:;]/;e.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:t,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:i,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:r,operator:s,punctuation:n};var o={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:e.languages.php},a=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:o}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:o}}];e.languages.insertBefore("php","variable",{string:a,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:t,string:a,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:i,number:r,operator:s,punctuation:n}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),e.hooks.add("before-tokenize",function(t){if(/<\?/.test(t.code)){e.languages["markup-templating"].buildPlaceholders(t,"php",/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g)}}),e.hooks.add("after-tokenize",function(t){e.languages["markup-templating"].tokenizePlaceholders(t,"php")})}(Prism),function(e){e.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var t={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(t).forEach(function(i){var r=t[i],s=[];/^\w+$/.test(i)||s.push(/\w+/.exec(i)[0]),"diff"===i&&s.push("bold"),e.languages.diff[i]={pattern:RegExp("^(?:["+r+"].*(?:\r\n?|\n|(?![\\s\\S])))+","m"),alias:s,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(i)[0]}}}}),Object.defineProperty(e.languages.diff,"PREFIXES",{value:t})}(Prism);const VC={js:"javascript",mjs:"javascript",cjs:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",pyi:"python",go:"go",rs:"rust",rb:"ruby",swift:"swift",sh:"bash",bash:"bash",zsh:"bash",fish:"bash",md:"markdown",mdx:"markdown",json:"json",jsonc:"json",yaml:"yaml",yml:"yaml",toml:"toml",css:"css",scss:"scss",sass:"scss",html:"markup",htm:"markup",xml:"markup",svg:"markup",vue:"markup",sql:"sql",java:"java",kt:"kotlin",kts:"kotlin",c:"c",h:"c",cpp:"cpp",cc:"cpp",cxx:"cpp",hpp:"cpp",m:"objectivec",mm:"objectivec",php:"php",patch:"diff",diff:"diff"},GC={Dockerfile:"bash",Makefile:"bash",".gitignore":"bash",".env":"bash"};function YC(e,t){if(!t||!KC.languages[t])return XC(e);try{return KC.highlight(e,KC.languages[t],t)}catch{return XC(e)}}function XC(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function ZC(e){if(0===e.oldCount)return 1===e.newCount?`Line ${e.newStart}`:`Lines ${e.newStart}–${e.newStart+e.newCount-1}`;if(0===e.newCount)return 1===e.oldCount?`Line ${e.oldStart} (deleted)`:`Lines ${e.oldStart}–${e.oldStart+e.oldCount-1} (deleted)`;const t=e.newStart+e.newCount-1;return 1===e.newCount?`Line ${e.newStart}`:`Lines ${e.newStart}–${t}`}function QC(e){switch(e){case"add":return"bg-emerald-500/10 hover:bg-emerald-500/15";case"del":return"bg-rose-500/10 hover:bg-rose-500/15";case"hunk":return"bg-[var(--surface-2)]";default:return"hover:bg-[var(--surface-2)]"}}function JC(e){switch(e){case"add":return"text-emerald-500";case"del":return"text-rose-500";default:return"text-[var(--text-muted)]"}}function ek({data:e,filePath:t}){const[i,r]=Y.useState(!1),s=Y.useMemo(()=>function(e){const t=e.split("/"),i=t[t.length-1];if(GC[i])return GC[i];const r=i.lastIndexOf(".");if(r<=0)return null;const s=i.slice(r+1).toLowerCase();return VC[s]??null}(t),[t]),n=Y.useMemo(()=>e?function(e){const t=e.split("\n"),i=[];let r=0,s=0,n=!1;for(const o of t){if(o.startsWith("@@")){const e=o.match(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);if(e){const t=parseInt(e[1],10),n=e[2]?parseInt(e[2],10):1,o=parseInt(e[3],10),a=e[4]?parseInt(e[4],10):1;r=t,s=o,i.push({type:"hunk",oldNo:null,newNo:null,text:"",hunkRange:{oldStart:t,oldCount:n,newStart:o,newCount:a}})}n=!0;continue}n&&(o.startsWith("+")?(i.push({type:"add",oldNo:null,newNo:s,text:o.slice(1)}),s++):o.startsWith("-")?(i.push({type:"del",oldNo:r,newNo:null,text:o.slice(1)}),r++):o.startsWith(" ")?(i.push({type:"ctx",oldNo:r,newNo:s,text:o.slice(1)}),r++,s++):0===o.length&&(i.push({type:"ctx",oldNo:r,newNo:s,text:""}),r++,s++))}return i}(e.diff):[],[e]),o=Y.useMemo(()=>n.filter(e=>"hunk"===e.type).length,[n]),a=Y.useMemo(()=>o<=1?n.filter(e=>"hunk"!==e.type):n,[n,o]);if(!e)return se.jsx("div",{className:"text-xs text-[var(--text-muted)] px-4 py-6 text-center",children:"Loading diff…"});if(e.binary)return se.jsx("div",{className:"text-xs text-[var(--text-muted)] px-4 py-6 text-center",children:"Binary file — no preview available."});if(0===e.diff.length)return se.jsx("div",{className:"text-xs text-[var(--text-muted)] px-4 py-6 text-center",children:"No changes."});const l=i?a:a.slice(0,500),c=a.length>500&&!i;return se.jsxs("div",{className:"font-mono text-[11px] leading-[1.5]",children:[se.jsxs("table",{className:"w-full border-collapse",children:[se.jsxs("colgroup",{children:[se.jsx("col",{className:"w-10"}),se.jsx("col",{className:"w-10"}),se.jsx("col",{className:"w-4"}),se.jsx("col",{})]}),se.jsx("tbody",{children:l.map((e,t)=>{if("hunk"===e.type)return se.jsx("tr",{className:QC(e.type),children:se.jsx("td",{colSpan:4,className:"px-3 py-1 text-[10px] uppercase tracking-wide text-[var(--text-muted)] border-y border-[var(--border)]/60 text-center",children:e.hunkRange?`··· ${ZC(e.hunkRange)} ···`:"···"})},t);const i="add"===e.type?"+":"del"===e.type?"-":" ";return se.jsxs("tr",{className:QC(e.type),children:[se.jsx("td",{className:"select-none pl-2 pr-1 text-right text-[var(--text-muted)] align-top tabular-nums",children:e.oldNo??""}),se.jsx("td",{className:"select-none pr-2 pl-1 text-right text-[var(--text-muted)] align-top tabular-nums border-r border-[var(--border)]/40",children:e.newNo??""}),se.jsx("td",{className:`select-none px-1 align-top ${JC(e.type)}`,children:i}),se.jsx("td",{className:"pr-3 whitespace-pre align-top break-all",children:se.jsx("span",{className:"sc-code",dangerouslySetInnerHTML:{__html:YC(e.text,s)||" "}})})]},t)})})]}),c&&se.jsxs("button",{type:"button",onClick:()=>r(!0),className:"w-full px-3 py-2 text-xs text-[var(--accent)] hover:bg-[var(--surface-2)] border-t border-[var(--border)]",children:["Show ",n.length-500," more lines"]}),e.truncated&&se.jsx("div",{className:"px-3 py-2 text-xs text-[var(--text-muted)] border-t border-[var(--border)] text-center",children:"Diff truncated by server (too large)."})]})}function tk(){const e=Sd(e=>e.pendingDiscard),t=Sd(e=>e.cancelDiscard),i=Gu(e=>e.activeProjectId),r=Y.useRef(null);if(Y.useEffect(()=>{e&&r.current&&r.current.focus()},[e]),!e)return null;const s=e.trackedFiles.length,n=e.untrackedFiles.length,o=[...e.trackedFiles,...e.untrackedFiles];return se.jsx("div",{className:"fixed inset-0 z-50 bg-black/40 flex items-center justify-center",onClick:t,children:se.jsxs("div",{className:"bg-[var(--surface-1)] border border-[var(--border)] rounded-lg shadow-2xl p-5 w-[400px] max-w-[90vw]",onClick:e=>e.stopPropagation(),children:[se.jsx("h3",{className:"text-sm font-semibold text-[var(--text-primary)] mb-2",children:"Discard changes?"}),se.jsx("p",{className:"text-xs text-[var(--text-secondary)] mb-3",children:n>0&&0===s?se.jsxs(se.Fragment,{children:["The following untracked ",1===n?"file":"files"," will be"," ",se.jsx("span",{className:"text-[var(--danger)] font-medium",children:"permanently deleted"}),":"]}):se.jsxs(se.Fragment,{children:["The following ",1===o.length?"file":"files"," will be reset and your changes will be ",se.jsx("span",{className:"text-[var(--danger)] font-medium",children:"lost"}),":"]})}),se.jsx("ul",{className:"text-xs font-mono text-[var(--text-secondary)] bg-[var(--surface-0)] rounded p-2 max-h-40 overflow-auto mb-4",children:o.map(e=>se.jsx("li",{className:"truncate",children:e},e))}),se.jsxs("div",{className:"flex justify-end gap-2",children:[se.jsx("button",{type:"button",onClick:t,className:"px-3 py-1.5 text-xs rounded border border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-2)]",children:"Cancel"}),se.jsx("button",{type:"button",ref:r,onClick:()=>{i?(ux({type:"sc:discard",projectId:i,trackedFiles:e.trackedFiles,untrackedFiles:e.untrackedFiles}),t()):t()},className:"px-3 py-1.5 text-xs rounded bg-[var(--danger)] text-white font-medium hover:opacity-90",children:"Discard"})]})]})})}function ik(){const e=Sd(e=>e.pendingStashCreate),t=Sd(e=>e.closeStashCreate),i=Sd(e=>e.setActionInFlight),r=Gu(e=>e.activeProjectId),s=Y.useRef(null),[n,o]=Y.useState("");if(Y.useEffect(()=>{e&&(o(""),setTimeout(()=>{var e;return null==(e=s.current)?void 0:e.focus()},0))},[e]),!e)return null;return se.jsx("div",{className:"fixed inset-0 z-50 bg-black/40 flex items-center justify-center",onClick:t,children:se.jsxs("form",{onSubmit:e=>{e.preventDefault(),r?(i("stash:create",!0),ux({type:"sc:stash:create",projectId:r,message:n}),t()):t()},className:"bg-[var(--surface-1)] border border-[var(--border)] rounded-lg shadow-2xl p-5 w-[420px] max-w-[90vw]",onClick:e=>e.stopPropagation(),children:[se.jsx("h3",{className:"text-sm font-semibold text-[var(--text-primary)] mb-3",children:"Create stash"}),se.jsx("input",{ref:s,type:"text",value:n,onChange:e=>o(e.target.value),placeholder:"Optional message",className:"w-full px-2 py-1.5 text-xs rounded bg-[var(--surface-0)] border border-[var(--border)] text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)] mb-3"}),se.jsx("p",{className:"text-xs text-[var(--text-muted)] mb-4",children:"All tracked and untracked changes will be stashed. Your working tree returns to a clean state."}),se.jsxs("div",{className:"flex justify-end gap-2",children:[se.jsx("button",{type:"button",onClick:t,className:"px-3 py-1.5 text-xs rounded border border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-2)]",children:"Cancel"}),se.jsx("button",{type:"submit",className:"px-3 py-1.5 text-xs rounded bg-[var(--accent)] text-[var(--surface-0)] font-medium hover:opacity-90",children:"Stash"})]})]})})}const rk={M:"M",A:"A",D:"D",R:"R",C:"C",U:"U","?":"U"};function sk(e){switch(e){case"M":case"R":case"C":return"text-[var(--accent)] bg-[var(--accent)]/15";case"A":return"text-[var(--success)] bg-[var(--success)]/15";case"D":case"U":return"text-[var(--danger)] bg-[var(--danger)]/15";case"?":return"text-[var(--text-muted)] bg-[var(--surface-3)]"}}function nk(e){switch(e){case"M":return"Modified";case"A":return"Added";case"D":return"Deleted";case"R":return"Renamed";case"C":return"Copied";case"U":return"Conflict";case"?":return"Untracked"}}function ok(e,t){return`${e}::${t}`}function ak({entry:e,group:t,diffKind:i,index:r,groupEntries:s,isSelected:n,isFocused:o,onClick:a,onOpen:l,onPrimary:c,onSecondary:h,primaryIcon:u,primaryTitle:d,secondaryIcon:f,secondaryTitle:p}){return se.jsxs("div",{onClick:n=>a(n,e,t,r,s,i),className:"group flex items-center gap-2 px-3 py-1 text-xs cursor-pointer select-none "+(n?"bg-[var(--accent)]/20 text-[var(--text-primary)]":o?"bg-[var(--surface-2)] text-[var(--text-primary)]":"text-[var(--text-secondary)] hover:bg-[var(--surface-2)]"),children:[se.jsx("span",{className:`inline-flex items-center justify-center w-4 h-4 rounded text-[10px] font-semibold ${sk(e.status)}`,title:nk(e.status),children:rk[e.status]}),se.jsx("span",{className:"truncate flex-1",title:e.path,children:e.oldPath?se.jsxs(se.Fragment,{children:[se.jsx("span",{className:"text-[var(--text-muted)] line-through",children:e.oldPath}),se.jsx("span",{className:"mx-1 text-[var(--text-muted)]",children:"→"}),e.path]}):e.path}),se.jsxs("div",{className:"hidden group-hover:flex items-center gap-1",children:[se.jsx("button",{type:"button",onClick:t=>{t.stopPropagation(),l(e)},title:"Open in default editor",className:"p-0.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)]",children:se.jsx(Dx,{size:12})}),h&&f&&se.jsx("button",{type:"button",onClick:t=>{t.stopPropagation(),h(e)},title:p,className:"p-0.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)]",children:f}),c&&u&&se.jsx("button",{type:"button",onClick:t=>{t.stopPropagation(),c(e)},title:d,className:"p-0.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)]",children:u})]})]})}function lk({label:e,group:t,diffKind:i,entries:r,selectedPaths:s,focusedPath:n,onRowClick:o,onOpen:a,onPrimary:l,onSecondary:c,primaryIcon:h,primaryTitle:u,secondaryIcon:d,secondaryTitle:f}){const p=Sd(e=>e.expanded[t]),_=Sd(e=>e.toggleGroup);return 0===r.length?null:se.jsxs("div",{className:"flex flex-col",children:[se.jsxs("button",{type:"button",onClick:()=>_(t),className:"flex items-center gap-1.5 px-3 py-1.5 text-xs uppercase tracking-wide text-[var(--text-secondary)] hover:text-[var(--text-primary)]",children:[p?se.jsx(kx,{size:12}):se.jsx(Ex,{size:12}),se.jsx("span",{className:"font-medium",children:e}),se.jsx("span",{className:"ml-auto text-[var(--text-muted)]",children:r.length})]}),p&&se.jsx("div",{className:"flex flex-col",children:r.map((e,p)=>{const _=ok(t,e.path);return se.jsx(ak,{entry:e,group:t,diffKind:i,index:p,groupEntries:r,isSelected:s.has(_),isFocused:n===e.path&&0===s.size,onClick:o,onOpen:a,onPrimary:l,onSecondary:c,primaryIcon:h,primaryTitle:u,secondaryIcon:d,secondaryTitle:f},_)})})]})}function ck(){const e=Gu(e=>e.activeProjectId),t=Uu(e=>e.gitBranches),i=e?t[e]:null,r=Sd(e=>e.inFlight),s=Sd(e=>e.setActionInFlight);if(!e||!i)return null;const n=r.has("pull"),o=r.has("push");return se.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-[var(--border)] text-xs",children:[se.jsx(Ix,{size:12,className:"text-[var(--text-muted)] flex-shrink-0"}),se.jsx("span",{className:"text-[var(--text-secondary)] truncate",title:i.branch,children:i.branch}),i.behind>0&&se.jsxs("span",{className:"flex items-center text-[var(--text-muted)]",title:`${i.behind} commits behind`,children:[se.jsx(Sx,{size:10}),i.behind]}),i.ahead>0&&se.jsxs("span",{className:"flex items-center text-[var(--text-muted)]",title:`${i.ahead} commits ahead`,children:[se.jsx(xx,{size:10}),i.ahead]}),se.jsx("div",{className:"flex-1"}),se.jsx("button",{type:"button",onClick:()=>{e&&!n&&(s("pull",!0),ux({type:"sc:pull",projectId:e}))},disabled:n,title:"Pull (fast-forward only)",className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] disabled:opacity-40",children:n?se.jsx(Wx,{size:12,className:"animate-spin"}):se.jsx(Mx,{size:12})}),se.jsx("button",{type:"button",onClick:()=>{e&&!o&&(s("push",!0),ux({type:"sc:push",projectId:e}))},disabled:o,title:"Push",className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] disabled:opacity-40",children:o?se.jsx(Wx,{size:12,className:"animate-spin"}):se.jsx(Px,{size:12})})]})}function hk({stashes:e,projectId:t}){const i=Sd(e=>e.expanded.stash),r=Sd(e=>e.toggleGroup),s=Sd(e=>e.openStashCreate),n=Sd(e=>e.setActionInFlight),o=Sd(e=>e.inFlight),a=(e,i)=>{n(`stash:${e}`,!0),ux("pop"===e?{type:"sc:stash:pop",projectId:t,index:i}:"apply"===e?{type:"sc:stash:apply",projectId:t,index:i}:{type:"sc:stash:drop",projectId:t,index:i})};return se.jsxs("div",{className:"flex flex-col",children:[se.jsxs("div",{className:"flex items-center px-3 py-1.5 text-xs uppercase tracking-wide text-[var(--text-secondary)]",children:[se.jsxs("button",{type:"button",onClick:()=>r("stash"),className:"flex items-center gap-1.5 flex-1 hover:text-[var(--text-primary)]",children:[i?se.jsx(kx,{size:12}):se.jsx(Ex,{size:12}),se.jsx("span",{className:"font-medium",children:"Stash"}),se.jsx("span",{className:"text-[var(--text-muted)]",children:e.length})]}),se.jsx("button",{type:"button",onClick:s,title:"Stash current changes",className:"p-0.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)]",children:se.jsx(yx,{size:12})})]}),i&&0===e.length&&se.jsx("div",{className:"px-3 py-2 text-xs text-[var(--text-muted)]",children:"No stashes."}),i&&e.map(e=>{const t=o.has("stash:pop"),i=o.has("stash:apply"),r=o.has("stash:drop");return se.jsxs("div",{className:"group flex items-center gap-2 px-3 py-1 text-xs text-[var(--text-secondary)] hover:bg-[var(--surface-2)]",children:[se.jsxs("span",{className:"text-[var(--text-muted)] tabular-nums w-6",children:["#",e.index]}),se.jsxs("span",{className:"truncate flex-1",title:e.message,children:[se.jsx("span",{className:"text-[var(--text-muted)]",children:e.branch}),se.jsx("span",{className:"mx-1 text-[var(--text-muted)]",children:"·"}),e.message]}),se.jsxs("div",{className:"hidden group-hover:flex items-center gap-1",children:[se.jsx("button",{type:"button",onClick:()=>a("apply",e.index),disabled:i,title:"Apply (keep stash)",className:"p-0.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] disabled:opacity-40",children:se.jsx(bx,{size:12})}),se.jsx("button",{type:"button",onClick:()=>a("pop",e.index),disabled:t,title:"Pop (apply then drop)",className:"p-0.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] disabled:opacity-40",children:se.jsx(cC,{size:12})}),se.jsx("button",{type:"button",onClick:()=>a("drop",e.index),disabled:r,title:"Drop",className:"p-0.5 rounded text-[var(--text-muted)] hover:text-[var(--danger)] hover:bg-[var(--surface-3)] disabled:opacity-40",children:se.jsx(hC,{size:12})})]})]},e.index)})]})}function uk(){const e=Sd(e=>e.panelOpen),t=Sd(e=>e.panelWidth),i=Sd(e=>e.setPanelWidth),r=Sd(e=>e.togglePanel),s=Gu(e=>e.activeProjectId),n=Sd(e=>s?e.statusByProject[s]:null),o=Sd(e=>e.selectedFile),a=Sd(e=>e.selectFile),l=Sd(e=>e.selectedPaths),c=Sd(e=>e.selectionAnchor),h=Sd(e=>e.setMultiSelection),u=Sd(e=>e.toggleSelection),d=Sd(e=>e.clearSelection),f=Sd(e=>e.diffCache),p=Sd(e=>s?e.commitDrafts[s]??"":""),_=Sd(e=>e.setCommitDraft),g=Sd(e=>e.lastActionError),m=Sd(e=>e.clearActionError),v=Sd(e=>e.requestDiscard),b=Sd(e=>e.inFlight),y=Sd(e=>e.setActionInFlight),S=Y.useRef(!1),w=Y.useCallback(e=>{e.preventDefault(),S.current=!0;const t=e=>{requestAnimationFrame(()=>i(window.innerWidth-e.clientX))},r=()=>{S.current=!1,window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",r),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",t),window.addEventListener("mouseup",r)},[i]);Y.useEffect(()=>{o&&s&&ux({type:"sc:diff:request",projectId:s,file:o.path,kind:o.kind})},[o,s,n]);const x=Y.useCallback((e,t,i,r,s,n)=>{const l=ok(i,t.path),d=e.metaKey||e.ctrlKey;if(e.shiftKey&&c&&c.startsWith(i+"::")){const e=c.slice((i+"::").length),t=s.findIndex(t=>t.path===e);if(t>=0){const[e,n]=t<=r?[t,r]:[r,t],o=s.slice(e,n+1).map(e=>ok(i,e.path));return void h(o,c)}}if(d)return void u(l);h([l],l);const f={path:t.path,kind:n};o&&o.path===t.path&&o.kind===n?a(null):a(f)},[c,o,h,u,a]),C=Y.useCallback((e,t)=>{const i=ok(e,t.path);return l.size>1&&l.has(i)?function(e,t){const i=`${t}::`,r=[];for(const s of e)s.startsWith(i)&&r.push(s.slice(i.length));return r}(l,e):[t.path]},[l]),k=Y.useCallback((e,t)=>{if(!s)return;const i=C(e,t);ux({type:"sc:stage",projectId:s,files:i})},[s,C]),E=Y.useCallback((e,t)=>{if(!s)return;const i=C(e,t);ux({type:"sc:unstage",projectId:s,files:i})},[s,C]),L=Y.useCallback((e,t)=>{const i=C(e,t),r="untracked"===e;v(r?[]:i,r?i:[])},[v,C]),R=Y.useCallback(e=>{s&&ux({type:"open:file",projectId:s,path:e.path})},[s]),T=Y.useCallback(()=>{s&&p.trim()&&(y("commit",!0),ux({type:"sc:commit",projectId:s,message:p}))},[s,p,y]),M=Y.useCallback(()=>{if(!s||!n)return;const e=[...n.changes.map(e=>e.path),...n.untracked.map(e=>e.path)];0!==e.length&&ux({type:"sc:stage",projectId:s,files:e})},[s,n]),P=Y.useMemo(()=>o&&s?vd(s,o.path,o.kind):null,[o,s]);if(!e)return null;const A=(null==n?void 0:n.staged.length)??0,D=b.has("commit");return se.jsxs("div",{className:"relative flex-shrink-0 bg-[var(--surface-1)] border-l border-[var(--border)] flex flex-col h-full",style:{width:t},onClick:e=>{e.target.closest("[data-sc-row]")||l.size>0&&d()},children:[se.jsx("div",{className:"absolute top-0 left-0 w-1 h-full cursor-col-resize z-10 hover:bg-[var(--accent)] active:bg-[var(--accent)] opacity-0 hover:opacity-40 active:opacity-60 transition-opacity",onMouseDown:w}),se.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)]",children:[se.jsx("span",{className:"text-sm font-semibold tracking-tight text-[var(--text-primary)]",children:"Source Control"}),se.jsx("button",{type:"button",onClick:r,title:"Close panel (⌘⇧G)",className:"text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:se.jsx(Xx,{size:16})})]}),s?n?se.jsxs(se.Fragment,{children:[se.jsx(ck,{}),se.jsxs("div",{className:"px-3 py-3 border-b border-[var(--border)] flex flex-col gap-2",children:[se.jsx("textarea",{value:p,onChange:e=>_(s,e.target.value),placeholder:A>0?`Commit message (${A} staged ${1===A?"file":"files"})`:"Stage files to commit",rows:2,className:"resize-none w-full px-2 py-1.5 text-xs rounded bg-[var(--surface-0)] border border-[var(--border)] text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"}),se.jsxs("div",{className:"flex gap-2",children:[se.jsxs("button",{type:"button",onClick:T,disabled:0===A||!p.trim()||D,className:"flex-1 flex items-center justify-center gap-1.5 px-2 py-1.5 text-xs rounded bg-[var(--accent)] text-[var(--surface-0)] font-medium disabled:opacity-40 disabled:cursor-not-allowed hover:opacity-90",children:[D?se.jsx(Wx,{size:12,className:"animate-spin"}):se.jsx(Bx,{size:12}),"Commit"]}),(n.changes.length>0||n.untracked.length>0)&&se.jsx("button",{type:"button",onClick:M,title:"Stage all changes",className:"px-2 py-1.5 text-xs rounded border border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-2)]",children:"Stage all"})]}),l.size>1&&se.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-[var(--text-muted)]",children:[se.jsxs("span",{children:[l.size," selected"]}),se.jsx("button",{type:"button",onClick:d,className:"text-[var(--accent)] hover:underline",children:"Clear"})]})]}),o?se.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[se.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-[var(--border)] bg-[var(--surface-1)]",children:[se.jsx("button",{type:"button",onClick:()=>a(null),title:"Back to file list",className:"text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:se.jsx(wx,{size:14})}),se.jsx("span",{className:"text-xs text-[var(--text-secondary)] truncate flex-1",title:o.path,children:o.path}),se.jsx("button",{type:"button",onClick:()=>s&&ux({type:"open:file",projectId:s,path:o.path}),title:"Open in default editor",className:"p-0.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)]",children:se.jsx(Dx,{size:13})}),se.jsx("span",{className:"text-[10px] uppercase tracking-wide text-[var(--text-muted)]",children:o.kind})]}),se.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:se.jsx(ek,{data:P?f[P]:void 0,filePath:o.path})})]}):se.jsxs("div",{className:"flex-1 overflow-auto","data-sc-row":!0,children:[se.jsx(lk,{label:"Conflicted",group:"conflicted",diffKind:"conflicted",entries:n.conflicted,selectedPaths:l,focusedPath:null,onRowClick:x,onOpen:R}),se.jsx(lk,{label:"Staged Changes",group:"staged",diffKind:"staged",entries:n.staged,selectedPaths:l,focusedPath:null,onRowClick:x,onOpen:R,onPrimary:e=>E("staged",e),primaryIcon:se.jsx(Hx,{size:12}),primaryTitle:"Unstage"}),se.jsx(lk,{label:"Changes",group:"changes",diffKind:"unstaged",entries:n.changes,selectedPaths:l,focusedPath:null,onRowClick:x,onOpen:R,onPrimary:e=>k("changes",e),onSecondary:e=>L("changes",e),primaryIcon:se.jsx(tC,{size:12}),primaryTitle:"Stage",secondaryIcon:se.jsx(cC,{size:12}),secondaryTitle:"Discard changes"}),se.jsx(lk,{label:"Untracked",group:"untracked",diffKind:"untracked",entries:n.untracked,selectedPaths:l,focusedPath:null,onRowClick:x,onOpen:R,onPrimary:e=>k("untracked",e),onSecondary:e=>L("untracked",e),primaryIcon:se.jsx(tC,{size:12}),primaryTitle:"Stage",secondaryIcon:se.jsx(cC,{size:12}),secondaryTitle:"Delete file"}),se.jsx("div",{className:"border-t border-[var(--border)] mt-2",children:se.jsx(hk,{stashes:n.stashes,projectId:s})}),0===n.staged.length&&0===n.changes.length&&0===n.untracked.length&&0===n.conflicted.length&&0===n.stashes.length&&se.jsx("div",{className:"text-xs text-[var(--text-muted)] px-4 py-8 text-center",children:"Working tree clean."})]})]}):se.jsx("div",{className:"flex-1 flex items-center justify-center text-xs text-[var(--text-muted)] px-4 text-center",children:"Not a git repository, or no git available."}):se.jsx("div",{className:"flex-1 flex items-center justify-center text-xs text-[var(--text-muted)] px-4 text-center",children:"Open a project to view changes."}),g&&se.jsxs("div",{className:"absolute bottom-2 left-2 right-2 px-3 py-2 bg-[var(--danger)]/10 border border-[var(--danger)]/40 rounded text-xs text-[var(--danger)] flex items-start gap-2",children:[se.jsx("span",{className:"flex-1 break-all",children:g}),se.jsx("button",{onClick:m,className:"text-[var(--danger)] hover:opacity-70",children:se.jsx(hC,{size:12})})]}),se.jsx(tk,{}),se.jsx(ik,{})]})}function dk(){dx(),function(){const e=md(e=>e.toggleSidebar),t=md(e=>e.setFocusedTerminal);Y.useEffect(()=>{const i=i=>{var r,s,n,o;const a=i.key.toLowerCase();if(i.ctrlKey&&i.shiftKey&&!i.metaKey&&!i.altKey&&["arrowleft","arrowright","arrowup","arrowdown"].includes(a)){i.preventDefault(),i.stopPropagation();const e=Gu.getState().activeProjectId;if(!e)return;const s=ud.getState().getLayout(e),n=md.getState().focusedTerminalId;if(!n||!s)return;const o=hd(s,n,"arrowleft"===a?"left":"arrowright"===a?"right":"arrowup"===a?"up":"down");if(o){t(o);const e=Uu.getState().sessions[o];null==(r=null==e?void 0:e.terminal)||r.focus()}return}if(i.shiftKey&&!i.ctrlKey&&!i.metaKey&&!i.altKey&&["arrowleft","arrowright","arrowup","arrowdown"].includes(a)){const e=md.getState().focusedTerminalId,r=e?Uu.getState().sessions[e]:null;if("alternate"===(null==(s=null==r?void 0:r.terminal)?void 0:s.buffer.active.type))return;i.preventDefault(),i.stopPropagation();const n=Gu.getState().activeProjectId;if(!n)return;const o=ud.getState().getLayout(n);if(!e||!o)return;const l=hd(o,e,"arrowleft"===a?"left":"arrowright"===a?"right":"arrowup"===a?"up":"down");return void(l&&(ud.getState().swapPanesInProject(n,e,l),requestAnimationFrame(()=>{var i;t(e);const r=Uu.getState().sessions[e];null==(i=null==r?void 0:r.terminal)||i.focus()})))}if(!(navigator.platform.startsWith("Mac")?i.metaKey:i.ctrlKey))return;if(("="===a||"+"===a||"-"===a||"0"===a)&&!i.shiftKey&&!("chrome"in window)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent)){i.preventDefault(),i.stopPropagation();const e=parseFloat(document.documentElement.style.zoom||"1");return document.documentElement.style.zoom="="===a||"+"===a?String(Math.min(e+.1,2)):"-"===a?String(Math.max(e-.1,.5)):"1",void window.dispatchEvent(new Event("resize"))}(fx.has(a)||a>="1"&&a<="9")&&(i.preventDefault(),i.stopPropagation());const l=Gu.getState().activeProjectId;if(!l)return;const c=ud.getState().getLayout(l),h=md.getState().focusedTerminalId,u=Gu.getState().projects[l];if("p"===a&&!i.shiftKey)return void md.getState().toggleCommandPalette();if("f"===a&&!i.shiftKey)return void(h&&md.getState().openSearch(h));if("d"===a&&!i.shiftKey)return void e();if("g"===a&&i.shiftKey)return void Sd.getState().togglePanel();if("n"===a){if(!u)return;const e=crypto.randomUUID(),r=Zu(c);if(r.length>0){const t=h??r[r.length-1],s=i.shiftKey?"horizontal":"vertical";ud.getState().addPaneToProject(l,t,e,s)}else ud.getState().setLayout(l,{type:"leaf",terminalId:e});return Gu.getState().addTerminalToProject(l,e),void t(e)}if("w"===a&&!i.shiftKey){if(!h||!c)return;ux({type:"pty:kill",terminalId:h}),ud.getState().removePaneFromProject(l,h),Gu.getState().removeTerminalFromProject(l,h);const e=Uu.getState().sessions[h];null==(n=null==e?void 0:e.terminal)||n.dispose(),Uu.getState().removeSession(h),cx(h);const i=Zu(ud.getState().getLayout(l));return void t(i[0]??null)}if("t"===a&&!i.shiftKey){if(!u)return;const e=Zu(c);return void(e.length>0&&ud.getState().cyclePreset(l,e))}if("r"===a&&!i.shiftKey){const e=Zu(c);if(0===e.length)return;let t;t=e.length<=2?"even-vertical":3===e.length?"main-left":"grid";const i=ad(e,t);return void(i&&ud.getState().setLayout(l,i))}const d=parseInt(a);if(d>=1&&d<=9){const e=Zu(c)[d-1];if(e){t(e);const i=Uu.getState().sessions[e];null==(o=null==i?void 0:i.terminal)||o.focus()}return}};return window.addEventListener("keydown",i,{capture:!0}),()=>window.removeEventListener("keydown",i,{capture:!0})},[e,t])}(),function(){const e=Gu(e=>e.activeProjectId),t=Sd(e=>e.panelOpen);Y.useEffect(()=>{ux({type:"sc:set-active",projectId:t?e:null})},[e,t])}(),Y.useEffect(()=>{Gu.getState().hydrateFromServer(),px.getState().hydrateFromServer(),md.getState().hydrateFromServer(),async function(){try{const e=await fetch("/api/settings"),t=(await e.json()).ui??{};Sd.getState().hydrate(t.sourceControlOpen??!1,t.sourceControlWidth??360)}catch{}}()},[]);const e=Gu(e=>e.activeProjectId),t=Gu(e=>e.activeProjectId?e.projects[e.activeProjectId]:null),i=ud(t=>e?t.getLayout(e):null),r=md(e=>e.focusedTerminalId),s=md(e=>e.setFocusedTerminal),n=Gu(e=>e.addTerminalToProject),o=Y.useCallback(o=>{if(!e||!t)return;const a=crypto.randomUUID(),l=Zu(i),c=r??l[0];c?ud.getState().addPaneToProject(e,c,a,o):ud.getState().setLayout(e,{type:"leaf",terminalId:a}),n(e,a),s(a)},[e,t,i,r,n,s]),a=Y.useCallback(()=>{o("vertical")},[o]);return se.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-[var(--surface-0)]",children:[se.jsx(kC,{}),se.jsx($C,{}),se.jsxs("div",{className:"relative flex-1 flex flex-col min-w-0",children:[se.jsx(jC,{}),se.jsx(MC,{onNewPane:o}),se.jsx("div",{className:"flex-1 min-h-0 min-w-0",children:i?se.jsx(FC,{node:i,projectId:e,cwd:(null==t?void 0:t.cwd)??"/"},e):se.jsx(zC,{onNewTerminal:a,projectName:null==t?void 0:t.name})})]}),se.jsx(uk,{})]})}window.__panefulHandleDrop=(e,t,i)=>{var r;let s=md.getState().focusedTerminalId;if(null!=t&&null!=i){const e=null==(r=document.elementFromPoint(t,i))?void 0:r.closest("[data-terminal-id]");if(e){const t=e.dataset.terminalId;s=t,md.getState().setFocusedTerminal(t)}}s&&e.length>0&&ux({type:"pty:input",terminalId:s,data:e.map(pC).join(" ")})},ne.createRoot(document.getElementById("root")).render(se.jsx(X.StrictMode,{children:se.jsx(dk,{})}));