An open-source, faster Devin alternative
TypeScript
remove accidentally-committed dashboard SPA bundle
Brian Reardon6705861e08b2
diff --git a/.gitignore b/.gitignoreindex 0d870b97..cd7580a2 100644--- a/.gitignore+++ b/.gitignore@@ -31,6 +31,9 @@ node_modules/# Build artifactsdist/+# Built dashboard SPA bundle served by the api-edge Worker — produced by+# `vite build` in web/, copied here by the deploy script. Never check in.+cloudflare-workers/api-edge/assets/# Compiled binariesbin/diff --git a/cloudflare-workers/api-edge/assets/assets/index-DquMJ_wD.js b/cloudflare-workers/api-edge/assets/assets/index-DquMJ_wD.jsdeleted file mode 100644index 1b8f4c17..00000000--- a/cloudflare-workers/api-edge/assets/assets/index-DquMJ_wD.js+++ /dev/null@@ -1,149 +0,0 @@-var Ry=e=>{throw TypeError(e)};var yf=(e,t,r)=>t.has(e)||Ry("Cannot "+r);var j=(e,t,r)=>(yf(e,t,"read from private field"),r?r.call(e):t.get(e)),be=(e,t,r)=>t.has(e)?Ry("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),ue=(e,t,r,i)=>(yf(e,t,"write to private field"),i?i.call(e,r):t.set(e,r),r),Me=(e,t,r)=>(yf(e,t,"access private method"),r);var oh=(e,t,r,i)=>({set _(o){ue(e,t,o,r)},get _(){return j(e,t,i)}});function lk(e,t){for(var r=0;r<t.length;r++){const i=t[r];if(typeof i!="string"&&!Array.isArray(i)){for(const o in i)if(o!=="default"&&!(o in e)){const a=Object.getOwnPropertyDescriptor(i,o);a&&Object.defineProperty(e,o,a.get?a:{enumerable:!0,get:()=>i[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const c of a.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&i(c)}).observe(document,{childList:!0,subtree:!0});function r(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(o){if(o.ep)return;o.ep=!0;const a=r(o);fetch(o.href,a)}})();function xx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xf={exports:{}},Ka={},Sf={exports:{}},Oe={};/**- * @license React- * react.production.min.js- *- * Copyright (c) Facebook, Inc. and its affiliates.- *- * This source code is licensed under the MIT license found in the- * LICENSE file in the root directory of this source tree.- */var jy;function ck(){if(jy)return Oe;jy=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),_=Symbol.iterator;function y(D){return D===null||typeof D!="object"?null:(D=_&&D[_]||D["@@iterator"],typeof D=="function"?D:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,w={};function C(D,V,ge){this.props=D,this.context=V,this.refs=w,this.updater=ge||x}C.prototype.isReactComponent={},C.prototype.setState=function(D,V){if(typeof D!="object"&&typeof D!="function"&&D!=null)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,D,V,"setState")},C.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function E(){}E.prototype=C.prototype;function I(D,V,ge){this.props=D,this.context=V,this.refs=w,this.updater=ge||x}var k=I.prototype=new E;k.constructor=I,S(k,C.prototype),k.isPureReactComponent=!0;var R=Array.isArray,M=Object.prototype.hasOwnProperty,F={current:null},W={key:!0,ref:!0,__self:!0,__source:!0};function H(D,V,ge){var _e,we={},Ce=null,De=null;if(V!=null)for(_e in V.ref!==void 0&&(De=V.ref),V.key!==void 0&&(Ce=""+V.key),V)M.call(V,_e)&&!W.hasOwnProperty(_e)&&(we[_e]=V[_e]);var je=arguments.length-2;if(je===1)we.children=ge;else if(1<je){for(var Le=Array(je),it=0;it<je;it++)Le[it]=arguments[it+2];we.children=Le}if(D&&D.defaultProps)for(_e in je=D.defaultProps,je)we[_e]===void 0&&(we[_e]=je[_e]);return{$$typeof:e,type:D,key:Ce,ref:De,props:we,_owner:F.current}}function K(D,V){return{$$typeof:e,type:D.type,key:V,ref:D.ref,props:D.props,_owner:D._owner}}function ie(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function oe(D){var V={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(ge){return V[ge]})}var Q=/\/+/g;function N(D,V){return typeof D=="object"&&D!==null&&D.key!=null?oe(""+D.key):V.toString(36)}function q(D,V,ge,_e,we){var Ce=typeof D;(Ce==="undefined"||Ce==="boolean")&&(D=null);var De=!1;if(D===null)De=!0;else switch(Ce){case"string":case"number":De=!0;break;case"object":switch(D.$$typeof){case e:case t:De=!0}}if(De)return De=D,we=we(De),D=_e===""?"."+N(De,0):_e,R(we)?(ge="",D!=null&&(ge=D.replace(Q,"$&/")+"/"),q(we,V,ge,"",function(it){return it})):we!=null&&(ie(we)&&(we=K(we,ge+(!we.key||De&&De.key===we.key?"":(""+we.key).replace(Q,"$&/")+"/")+D)),V.push(we)),1;if(De=0,_e=_e===""?".":_e+":",R(D))for(var je=0;je<D.length;je++){Ce=D[je];var Le=_e+N(Ce,je);De+=q(Ce,V,ge,Le,we)}else if(Le=y(D),typeof Le=="function")for(D=Le.call(D),je=0;!(Ce=D.next()).done;)Ce=Ce.value,Le=_e+N(Ce,je++),De+=q(Ce,V,ge,Le,we);else if(Ce==="object")throw V=String(D),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.");return De}function Y(D,V,ge){if(D==null)return D;var _e=[],we=0;return q(D,_e,"","",function(Ce){return V.call(ge,Ce,we++)}),_e}function re(D){if(D._status===-1){var V=D._result;V=V(),V.then(function(ge){(D._status===0||D._status===-1)&&(D._status=1,D._result=ge)},function(ge){(D._status===0||D._status===-1)&&(D._status=2,D._result=ge)}),D._status===-1&&(D._status=0,D._result=V)}if(D._status===1)return D._result.default;throw D._result}var le={current:null},$={transition:null},Z={ReactCurrentDispatcher:le,ReactCurrentBatchConfig:$,ReactCurrentOwner:F};function ee(){throw Error("act(...) is not supported in production builds of React.")}return Oe.Children={map:Y,forEach:function(D,V,ge){Y(D,function(){V.apply(this,arguments)},ge)},count:function(D){var V=0;return Y(D,function(){V++}),V},toArray:function(D){return Y(D,function(V){return V})||[]},only:function(D){if(!ie(D))throw Error("React.Children.only expected to receive a single React element child.");return D}},Oe.Component=C,Oe.Fragment=r,Oe.Profiler=o,Oe.PureComponent=I,Oe.StrictMode=i,Oe.Suspense=p,Oe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Z,Oe.act=ee,Oe.cloneElement=function(D,V,ge){if(D==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+D+".");var _e=S({},D.props),we=D.key,Ce=D.ref,De=D._owner;if(V!=null){if(V.ref!==void 0&&(Ce=V.ref,De=F.current),V.key!==void 0&&(we=""+V.key),D.type&&D.type.defaultProps)var je=D.type.defaultProps;for(Le in V)M.call(V,Le)&&!W.hasOwnProperty(Le)&&(_e[Le]=V[Le]===void 0&&je!==void 0?je[Le]:V[Le])}var Le=arguments.length-2;if(Le===1)_e.children=ge;else if(1<Le){je=Array(Le);for(var it=0;it<Le;it++)je[it]=arguments[it+2];_e.children=je}return{$$typeof:e,type:D.type,key:we,ref:Ce,props:_e,_owner:De}},Oe.createContext=function(D){return D={$$typeof:c,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},D.Provider={$$typeof:a,_context:D},D.Consumer=D},Oe.createElement=H,Oe.createFactory=function(D){var V=H.bind(null,D);return V.type=D,V},Oe.createRef=function(){return{current:null}},Oe.forwardRef=function(D){return{$$typeof:u,render:D}},Oe.isValidElement=ie,Oe.lazy=function(D){return{$$typeof:g,_payload:{_status:-1,_result:D},_init:re}},Oe.memo=function(D,V){return{$$typeof:f,type:D,compare:V===void 0?null:V}},Oe.startTransition=function(D){var V=$.transition;$.transition={};try{D()}finally{$.transition=V}},Oe.unstable_act=ee,Oe.useCallback=function(D,V){return le.current.useCallback(D,V)},Oe.useContext=function(D){return le.current.useContext(D)},Oe.useDebugValue=function(){},Oe.useDeferredValue=function(D){return le.current.useDeferredValue(D)},Oe.useEffect=function(D,V){return le.current.useEffect(D,V)},Oe.useId=function(){return le.current.useId()},Oe.useImperativeHandle=function(D,V,ge){return le.current.useImperativeHandle(D,V,ge)},Oe.useInsertionEffect=function(D,V){return le.current.useInsertionEffect(D,V)},Oe.useLayoutEffect=function(D,V){return le.current.useLayoutEffect(D,V)},Oe.useMemo=function(D,V){return le.current.useMemo(D,V)},Oe.useReducer=function(D,V,ge){return le.current.useReducer(D,V,ge)},Oe.useRef=function(D){return le.current.useRef(D)},Oe.useState=function(D){return le.current.useState(D)},Oe.useSyncExternalStore=function(D,V,ge){return le.current.useSyncExternalStore(D,V,ge)},Oe.useTransition=function(){return le.current.useTransition()},Oe.version="18.3.1",Oe}var Ty;function sv(){return Ty||(Ty=1,Sf.exports=ck()),Sf.exports}/**- * @license React- * react-jsx-runtime.production.min.js- *- * Copyright (c) Facebook, Inc. and its affiliates.- *- * This source code is licensed under the MIT license found in the- * LICENSE file in the root directory of this source tree.- */var Ly;function hk(){if(Ly)return Ka;Ly=1;var e=sv(),t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function c(u,p,f){var g,_={},y=null,x=null;f!==void 0&&(y=""+f),p.key!==void 0&&(y=""+p.key),p.ref!==void 0&&(x=p.ref);for(g in p)i.call(p,g)&&!a.hasOwnProperty(g)&&(_[g]=p[g]);if(u&&u.defaultProps)for(g in p=u.defaultProps,p)_[g]===void 0&&(_[g]=p[g]);return{$$typeof:t,type:u,key:y,ref:x,props:_,_owner:o.current}}return Ka.Fragment=r,Ka.jsx=c,Ka.jsxs=c,Ka}var My;function uk(){return My||(My=1,xf.exports=hk()),xf.exports}var h=uk(),L=sv();const Is=xx(L),dk=lk({__proto__:null,default:Is},[L]);var ah={},bf={exports:{}},mr={},wf={exports:{}},Cf={};/**- * @license React- * scheduler.production.min.js- *- * Copyright (c) Facebook, Inc. and its affiliates.- *- * This source code is licensed under the MIT license found in the- * LICENSE file in the root directory of this source tree.- */var Dy;function fk(){return Dy||(Dy=1,(function(e){function t($,Z){var ee=$.length;$.push(Z);e:for(;0<ee;){var D=ee-1>>>1,V=$[D];if(0<o(V,Z))$[D]=Z,$[ee]=V,ee=D;else break e}}function r($){return $.length===0?null:$[0]}function i($){if($.length===0)return null;var Z=$[0],ee=$.pop();if(ee!==Z){$[0]=ee;e:for(var D=0,V=$.length,ge=V>>>1;D<ge;){var _e=2*(D+1)-1,we=$[_e],Ce=_e+1,De=$[Ce];if(0>o(we,ee))Ce<V&&0>o(De,we)?($[D]=De,$[Ce]=ee,D=Ce):($[D]=we,$[_e]=ee,D=_e);else if(Ce<V&&0>o(De,ee))$[D]=De,$[Ce]=ee,D=Ce;else break e}}return Z}function o($,Z){var ee=$.sortIndex-Z.sortIndex;return ee!==0?ee:$.id-Z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var c=Date,u=c.now();e.unstable_now=function(){return c.now()-u}}var p=[],f=[],g=1,_=null,y=3,x=!1,S=!1,w=!1,C=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function k($){for(var Z=r(f);Z!==null;){if(Z.callback===null)i(f);else if(Z.startTime<=$)i(f),Z.sortIndex=Z.expirationTime,t(p,Z);else break;Z=r(f)}}function R($){if(w=!1,k($),!S)if(r(p)!==null)S=!0,re(M);else{var Z=r(f);Z!==null&&le(R,Z.startTime-$)}}function M($,Z){S=!1,w&&(w=!1,E(H),H=-1),x=!0;var ee=y;try{for(k(Z),_=r(p);_!==null&&(!(_.expirationTime>Z)||$&&!oe());){var D=_.callback;if(typeof D=="function"){_.callback=null,y=_.priorityLevel;var V=D(_.expirationTime<=Z);Z=e.unstable_now(),typeof V=="function"?_.callback=V:_===r(p)&&i(p),k(Z)}else i(p);_=r(p)}if(_!==null)var ge=!0;else{var _e=r(f);_e!==null&&le(R,_e.startTime-Z),ge=!1}return ge}finally{_=null,y=ee,x=!1}}var F=!1,W=null,H=-1,K=5,ie=-1;function oe(){return!(e.unstable_now()-ie<K)}function Q(){if(W!==null){var $=e.unstable_now();ie=$;var Z=!0;try{Z=W(!0,$)}finally{Z?N():(F=!1,W=null)}}else F=!1}var N;if(typeof I=="function")N=function(){I(Q)};else if(typeof MessageChannel<"u"){var q=new MessageChannel,Y=q.port2;q.port1.onmessage=Q,N=function(){Y.postMessage(null)}}else N=function(){C(Q,0)};function re($){W=$,F||(F=!0,N())}function le($,Z){H=C(function(){$(e.unstable_now())},Z)}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($){$.callback=null},e.unstable_continueExecution=function(){S||x||(S=!0,re(M))},e.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):K=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return r(p)},e.unstable_next=function($){switch(y){case 1:case 2:case 3:var Z=3;break;default:Z=y}var ee=y;y=Z;try{return $()}finally{y=ee}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function($,Z){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var ee=y;y=$;try{return Z()}finally{y=ee}},e.unstable_scheduleCallback=function($,Z,ee){var D=e.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?D+ee:D):ee=D,$){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=ee+V,$={id:g++,callback:Z,priorityLevel:$,startTime:ee,expirationTime:V,sortIndex:-1},ee>D?($.sortIndex=ee,t(f,$),r(p)===null&&$===r(f)&&(w?(E(H),H=-1):w=!0,le(R,ee-D))):($.sortIndex=V,t(p,$),S||x||(S=!0,re(M))),$},e.unstable_shouldYield=oe,e.unstable_wrapCallback=function($){var Z=y;return function(){var ee=y;y=Z;try{return $.apply(this,arguments)}finally{y=ee}}}})(Cf)),Cf}var By;function pk(){return By||(By=1,wf.exports=fk()),wf.exports}/**- * @license React- * react-dom.production.min.js- *- * Copyright (c) Facebook, Inc. and its affiliates.- *- * This source code is licensed under the MIT license found in the- * LICENSE file in the root directory of this source tree.- */var Iy;function gk(){if(Iy)return mr;Iy=1;var e=sv(),t=pk();function r(s){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+s,l=1;l<arguments.length;l++)n+="&args[]="+encodeURIComponent(arguments[l]);return"Minified React error #"+s+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var i=new Set,o={};function a(s,n){c(s,n),c(s+"Capture",n)}function c(s,n){for(o[s]=n,s=0;s<n.length;s++)i.add(n[s])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p=Object.prototype.hasOwnProperty,f=/^[: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]*$/,g={},_={};function y(s){return p.call(_,s)?!0:p.call(g,s)?!1:f.test(s)?_[s]=!0:(g[s]=!0,!1)}function x(s,n,l,d){if(l!==null&&l.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return d?!1:l!==null?!l.acceptsBooleans:(s=s.toLowerCase().slice(0,5),s!=="data-"&&s!=="aria-");default:return!1}}function S(s,n,l,d){if(n===null||typeof n>"u"||x(s,n,l,d))return!0;if(d)return!1;if(l!==null)switch(l.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function w(s,n,l,d,v,m,b){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=d,this.attributeNamespace=v,this.mustUseProperty=l,this.propertyName=s,this.type=n,this.sanitizeURL=m,this.removeEmptyString=b}var C={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(s){C[s]=new w(s,0,!1,s,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(s){var n=s[0];C[n]=new w(n,1,!1,s[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(s){C[s]=new w(s,2,!1,s.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(s){C[s]=new w(s,2,!1,s,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(s){C[s]=new w(s,3,!1,s.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(s){C[s]=new w(s,3,!0,s,null,!1,!1)}),["capture","download"].forEach(function(s){C[s]=new w(s,4,!1,s,null,!1,!1)}),["cols","rows","size","span"].forEach(function(s){C[s]=new w(s,6,!1,s,null,!1,!1)}),["rowSpan","start"].forEach(function(s){C[s]=new w(s,5,!1,s.toLowerCase(),null,!1,!1)});var E=/[\-:]([a-z])/g;function I(s){return s[1].toUpperCase()}"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(s){var n=s.replace(E,I);C[n]=new w(n,1,!1,s,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(s){var n=s.replace(E,I);C[n]=new w(n,1,!1,s,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(s){var n=s.replace(E,I);C[n]=new w(n,1,!1,s,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(s){C[s]=new w(s,1,!1,s.toLowerCase(),null,!1,!1)}),C.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(s){C[s]=new w(s,1,!1,s.toLowerCase(),null,!0,!0)});function k(s,n,l,d){var v=C.hasOwnProperty(n)?C[n]:null;(v!==null?v.type!==0:d||!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(S(n,l,v,d)&&(l=null),d||v===null?y(n)&&(l===null?s.removeAttribute(n):s.setAttribute(n,""+l)):v.mustUseProperty?s[v.propertyName]=l===null?v.type===3?!1:"":l:(n=v.attributeName,d=v.attributeNamespace,l===null?s.removeAttribute(n):(v=v.type,l=v===3||v===4&&l===!0?"":""+l,d?s.setAttributeNS(d,n,l):s.setAttribute(n,l))))}var R=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,M=Symbol.for("react.element"),F=Symbol.for("react.portal"),W=Symbol.for("react.fragment"),H=Symbol.for("react.strict_mode"),K=Symbol.for("react.profiler"),ie=Symbol.for("react.provider"),oe=Symbol.for("react.context"),Q=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),Y=Symbol.for("react.memo"),re=Symbol.for("react.lazy"),le=Symbol.for("react.offscreen"),$=Symbol.iterator;function Z(s){return s===null||typeof s!="object"?null:(s=$&&s[$]||s["@@iterator"],typeof s=="function"?s:null)}var ee=Object.assign,D;function V(s){if(D===void 0)try{throw Error()}catch(l){var n=l.stack.trim().match(/\n( *(at )?)/);D=n&&n[1]||""}return`-`+D+s}var ge=!1;function _e(s,n){if(!s||ge)return"";ge=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(n)if(n=function(){throw Error()},Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(n,[])}catch(z){var d=z}Reflect.construct(s,[],n)}else{try{n.call()}catch(z){d=z}s.call(n.prototype)}else{try{throw Error()}catch(z){d=z}s()}}catch(z){if(z&&d&&typeof z.stack=="string"){for(var v=z.stack.split(`-`),m=d.stack.split(`-`),b=v.length-1,P=m.length-1;1<=b&&0<=P&&v[b]!==m[P];)P--;for(;1<=b&&0<=P;b--,P--)if(v[b]!==m[P]){if(b!==1||P!==1)do if(b--,P--,0>P||v[b]!==m[P]){var T=`-`+v[b].replace(" at new "," at ");return s.displayName&&T.includes("<anonymous>")&&(T=T.replace("<anonymous>",s.displayName)),T}while(1<=b&&0<=P);break}}}finally{ge=!1,Error.prepareStackTrace=l}return(s=s?s.displayName||s.name:"")?V(s):""}function we(s){switch(s.tag){case 5:return V(s.type);case 16:return V("Lazy");case 13:return V("Suspense");case 19:return V("SuspenseList");case 0:case 2:case 15:return s=_e(s.type,!1),s;case 11:return s=_e(s.type.render,!1),s;case 1:return s=_e(s.type,!0),s;default:return""}}function Ce(s){if(s==null)return null;if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case W:return"Fragment";case F:return"Portal";case K:return"Profiler";case H:return"StrictMode";case N:return"Suspense";case q:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case oe:return(s.displayName||"Context")+".Consumer";case ie:return(s._context.displayName||"Context")+".Provider";case Q:var n=s.render;return s=s.displayName,s||(s=n.displayName||n.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case Y:return n=s.displayName||null,n!==null?n:Ce(s.type)||"Memo";case re:n=s._payload,s=s._init;try{return Ce(s(n))}catch{}}return null}function De(s){var n=s.type;switch(s.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return s=n.render,s=s.displayName||s.name||"",n.displayName||(s!==""?"ForwardRef("+s+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ce(n);case 8:return n===H?"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(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function je(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Le(s){var n=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function it(s){var n=Le(s)?"checked":"value",l=Object.getOwnPropertyDescriptor(s.constructor.prototype,n),d=""+s[n];if(!s.hasOwnProperty(n)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var v=l.get,m=l.set;return Object.defineProperty(s,n,{configurable:!0,get:function(){return v.call(this)},set:function(b){d=""+b,m.call(this,b)}}),Object.defineProperty(s,n,{enumerable:l.enumerable}),{getValue:function(){return d},setValue:function(b){d=""+b},stopTracking:function(){s._valueTracker=null,delete s[n]}}}}function Mr(s){s._valueTracker||(s._valueTracker=it(s))}function xt(s){if(!s)return!1;var n=s._valueTracker;if(!n)return!0;var l=n.getValue(),d="";return s&&(d=Le(s)?s.checked?"true":"false":s.value),s=d,s!==l?(n.setValue(s),!0):!1}function Ae(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}function Ti(s,n){var l=n.checked;return ee({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:l??s._wrapperState.initialChecked})}function Xl(s,n){var l=n.defaultValue==null?"":n.defaultValue,d=n.checked!=null?n.checked:n.defaultChecked;l=je(n.value!=null?n.value:l),s._wrapperState={initialChecked:d,initialValue:l,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function Yr(s,n){n=n.checked,n!=null&&k(s,"checked",n,!1)}function na(s,n){Yr(s,n);var l=je(n.value),d=n.type;if(l!=null)d==="number"?(l===0&&s.value===""||s.value!=l)&&(s.value=""+l):s.value!==""+l&&(s.value=""+l);else if(d==="submit"||d==="reset"){s.removeAttribute("value");return}n.hasOwnProperty("value")?Js(s,n.type,l):n.hasOwnProperty("defaultValue")&&Js(s,n.type,je(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(s.defaultChecked=!!n.defaultChecked)}function oa(s,n,l){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var d=n.type;if(!(d!=="submit"&&d!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+s._wrapperState.initialValue,l||n===s.value||(s.value=n),s.defaultValue=n}l=s.name,l!==""&&(s.name=""),s.defaultChecked=!!s._wrapperState.initialChecked,l!==""&&(s.name=l)}function Js(s,n,l){(n!=="number"||Ae(s.ownerDocument)!==s)&&(l==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+l&&(s.defaultValue=""+l))}var os=Array.isArray;function Li(s,n,l,d){if(s=s.options,n){n={};for(var v=0;v<l.length;v++)n["$"+l[v]]=!0;for(l=0;l<s.length;l++)v=n.hasOwnProperty("$"+s[l].value),s[l].selected!==v&&(s[l].selected=v),v&&d&&(s[l].defaultSelected=!0)}else{for(l=""+je(l),n=null,v=0;v<s.length;v++){if(s[v].value===l){s[v].selected=!0,d&&(s[v].defaultSelected=!0);return}n!==null||s[v].disabled||(n=s[v])}n!==null&&(n.selected=!0)}}function Wn(s,n){if(n.dangerouslySetInnerHTML!=null)throw Error(r(91));return ee({},n,{value:void 0,defaultValue:void 0,children:""+s._wrapperState.initialValue})}function Hn(s,n){var l=n.value;if(l==null){if(l=n.children,n=n.defaultValue,l!=null){if(n!=null)throw Error(r(92));if(os(l)){if(1<l.length)throw Error(r(93));l=l[0]}n=l}n==null&&(n=""),l=n}s._wrapperState={initialValue:je(l)}}function Av(s,n){var l=je(n.value),d=je(n.defaultValue);l!=null&&(l=""+l,l!==s.value&&(s.value=l),n.defaultValue==null&&s.defaultValue!==l&&(s.defaultValue=l)),d!=null&&(s.defaultValue=""+d)}function Nv(s){var n=s.textContent;n===s._wrapperState.initialValue&&n!==""&&n!==null&&(s.value=n)}function zv(s){switch(s){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 ju(s,n){return s==null||s==="http://www.w3.org/1999/xhtml"?zv(n):s==="http://www.w3.org/2000/svg"&&n==="foreignObject"?"http://www.w3.org/1999/xhtml":s}var Jl,Wv=(function(s){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(n,l,d,v){MSApp.execUnsafeLocalFunction(function(){return s(n,l,d,v)})}:s})(function(s,n){if(s.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in s)s.innerHTML=n;else{for(Jl=Jl||document.createElement("div"),Jl.innerHTML="<svg>"+n.valueOf().toString()+"</svg>",n=Jl.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;n.firstChild;)s.appendChild(n.firstChild)}});function aa(s,n){if(n){var l=s.firstChild;if(l&&l===s.lastChild&&l.nodeType===3){l.nodeValue=n;return}}s.textContent=n}var la={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},dw=["Webkit","ms","Moz","O"];Object.keys(la).forEach(function(s){dw.forEach(function(n){n=n+s.charAt(0).toUpperCase()+s.substring(1),la[n]=la[s]})});function Hv(s,n,l){return n==null||typeof n=="boolean"||n===""?"":l||typeof n!="number"||n===0||la.hasOwnProperty(s)&&la[s]?(""+n).trim():n+"px"}function Uv(s,n){s=s.style;for(var l in n)if(n.hasOwnProperty(l)){var d=l.indexOf("--")===0,v=Hv(l,n[l],d);l==="float"&&(l="cssFloat"),d?s.setProperty(l,v):s[l]=v}}var fw=ee({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 Tu(s,n){if(n){if(fw[s]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(r(137,s));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(r(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(r(61))}if(n.style!=null&&typeof n.style!="object")throw Error(r(62))}}function Lu(s,n){if(s.indexOf("-")===-1)return typeof n.is=="string";switch(s){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 Mu=null;function Du(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Bu=null,Un=null,Kn=null;function Kv(s){if(s=Ta(s)){if(typeof Bu!="function")throw Error(r(280));var n=s.stateNode;n&&(n=Sc(n),Bu(s.stateNode,s.type,n))}}function qv(s){Un?Kn?Kn.push(s):Kn=[s]:Un=s}function Vv(){if(Un){var s=Un,n=Kn;if(Kn=Un=null,Kv(s),n)for(s=0;s<n.length;s++)Kv(n[s])}}function Qv(s,n){return s(n)}function Gv(){}var Iu=!1;function Yv(s,n,l){if(Iu)return s(n,l);Iu=!0;try{return Qv(s,n,l)}finally{Iu=!1,(Un!==null||Kn!==null)&&(Gv(),Vv())}}function ca(s,n){var l=s.stateNode;if(l===null)return null;var d=Sc(l);if(d===null)return null;l=d[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(s=s.type,d=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!d;break e;default:s=!1}if(s)return null;if(l&&typeof l!="function")throw Error(r(231,n,typeof l));return l}var Ou=!1;if(u)try{var ha={};Object.defineProperty(ha,"passive",{get:function(){Ou=!0}}),window.addEventListener("test",ha,ha),window.removeEventListener("test",ha,ha)}catch{Ou=!1}function pw(s,n,l,d,v,m,b,P,T){var z=Array.prototype.slice.call(arguments,3);try{n.apply(l,z)}catch(J){this.onError(J)}}var ua=!1,Zl=null,ec=!1,Fu=null,gw={onError:function(s){ua=!0,Zl=s}};function vw(s,n,l,d,v,m,b,P,T){ua=!1,Zl=null,pw.apply(gw,arguments)}function _w(s,n,l,d,v,m,b,P,T){if(vw.apply(this,arguments),ua){if(ua){var z=Zl;ua=!1,Zl=null}else throw Error(r(198));ec||(ec=!0,Fu=z)}}function Zs(s){var n=s,l=s;if(s.alternate)for(;n.return;)n=n.return;else{s=n;do n=s,(n.flags&4098)!==0&&(l=n.return),s=n.return;while(s)}return n.tag===3?l:null}function Xv(s){if(s.tag===13){var n=s.memoizedState;if(n===null&&(s=s.alternate,s!==null&&(n=s.memoizedState)),n!==null)return n.dehydrated}return null}function Jv(s){if(Zs(s)!==s)throw Error(r(188))}function mw(s){var n=s.alternate;if(!n){if(n=Zs(s),n===null)throw Error(r(188));return n!==s?null:s}for(var l=s,d=n;;){var v=l.return;if(v===null)break;var m=v.alternate;if(m===null){if(d=v.return,d!==null){l=d;continue}break}if(v.child===m.child){for(m=v.child;m;){if(m===l)return Jv(v),s;if(m===d)return Jv(v),n;m=m.sibling}throw Error(r(188))}if(l.return!==d.return)l=v,d=m;else{for(var b=!1,P=v.child;P;){if(P===l){b=!0,l=v,d=m;break}if(P===d){b=!0,d=v,l=m;break}P=P.sibling}if(!b){for(P=m.child;P;){if(P===l){b=!0,l=m,d=v;break}if(P===d){b=!0,d=m,l=v;break}P=P.sibling}if(!b)throw Error(r(189))}}if(l.alternate!==d)throw Error(r(190))}if(l.tag!==3)throw Error(r(188));return l.stateNode.current===l?s:n}function Zv(s){return s=mw(s),s!==null?e_(s):null}function e_(s){if(s.tag===5||s.tag===6)return s;for(s=s.child;s!==null;){var n=e_(s);if(n!==null)return n;s=s.sibling}return null}var t_=t.unstable_scheduleCallback,r_=t.unstable_cancelCallback,yw=t.unstable_shouldYield,xw=t.unstable_requestPaint,vt=t.unstable_now,Sw=t.unstable_getCurrentPriorityLevel,$u=t.unstable_ImmediatePriority,i_=t.unstable_UserBlockingPriority,tc=t.unstable_NormalPriority,bw=t.unstable_LowPriority,s_=t.unstable_IdlePriority,rc=null,ci=null;function ww(s){if(ci&&typeof ci.onCommitFiberRoot=="function")try{ci.onCommitFiberRoot(rc,s,void 0,(s.current.flags&128)===128)}catch{}}var Xr=Math.clz32?Math.clz32:Ew,Cw=Math.log,kw=Math.LN2;function Ew(s){return s>>>=0,s===0?32:31-(Cw(s)/kw|0)|0}var ic=64,sc=4194304;function da(s){switch(s&-s){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 s&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return s&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return s}}function nc(s,n){var l=s.pendingLanes;if(l===0)return 0;var d=0,v=s.suspendedLanes,m=s.pingedLanes,b=l&268435455;if(b!==0){var P=b&~v;P!==0?d=da(P):(m&=b,m!==0&&(d=da(m)))}else b=l&~v,b!==0?d=da(b):m!==0&&(d=da(m));if(d===0)return 0;if(n!==0&&n!==d&&(n&v)===0&&(v=d&-d,m=n&-n,v>=m||v===16&&(m&4194240)!==0))return n;if((d&4)!==0&&(d|=l&16),n=s.entangledLanes,n!==0)for(s=s.entanglements,n&=d;0<n;)l=31-Xr(n),v=1<<l,d|=s[l],n&=~v;return d}function Pw(s,n){switch(s){case 1:case 2:case 4:return n+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 n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Rw(s,n){for(var l=s.suspendedLanes,d=s.pingedLanes,v=s.expirationTimes,m=s.pendingLanes;0<m;){var b=31-Xr(m),P=1<<b,T=v[b];T===-1?((P&l)===0||(P&d)!==0)&&(v[b]=Pw(P,n)):T<=n&&(s.expiredLanes|=P),m&=~P}}function Au(s){return s=s.pendingLanes&-1073741825,s!==0?s:s&1073741824?1073741824:0}function n_(){var s=ic;return ic<<=1,(ic&4194240)===0&&(ic=64),s}function Nu(s){for(var n=[],l=0;31>l;l++)n.push(s);return n}function fa(s,n,l){s.pendingLanes|=n,n!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,n=31-Xr(n),s[n]=l}function jw(s,n){var l=s.pendingLanes&~n;s.pendingLanes=n,s.suspendedLanes=0,s.pingedLanes=0,s.expiredLanes&=n,s.mutableReadLanes&=n,s.entangledLanes&=n,n=s.entanglements;var d=s.eventTimes;for(s=s.expirationTimes;0<l;){var v=31-Xr(l),m=1<<v;n[v]=0,d[v]=-1,s[v]=-1,l&=~m}}function zu(s,n){var l=s.entangledLanes|=n;for(s=s.entanglements;l;){var d=31-Xr(l),v=1<<d;v&n|s[d]&n&&(s[d]|=n),l&=~v}}var Ke=0;function o_(s){return s&=-s,1<s?4<s?(s&268435455)!==0?16:536870912:4:1}var a_,Wu,l_,c_,h_,Hu=!1,oc=[],as=null,ls=null,cs=null,pa=new Map,ga=new Map,hs=[],Tw="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 u_(s,n){switch(s){case"focusin":case"focusout":as=null;break;case"dragenter":case"dragleave":ls=null;break;case"mouseover":case"mouseout":cs=null;break;case"pointerover":case"pointerout":pa.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":ga.delete(n.pointerId)}}function va(s,n,l,d,v,m){return s===null||s.nativeEvent!==m?(s={blockedOn:n,domEventName:l,eventSystemFlags:d,nativeEvent:m,targetContainers:[v]},n!==null&&(n=Ta(n),n!==null&&Wu(n)),s):(s.eventSystemFlags|=d,n=s.targetContainers,v!==null&&n.indexOf(v)===-1&&n.push(v),s)}function Lw(s,n,l,d,v){switch(n){case"focusin":return as=va(as,s,n,l,d,v),!0;case"dragenter":return ls=va(ls,s,n,l,d,v),!0;case"mouseover":return cs=va(cs,s,n,l,d,v),!0;case"pointerover":var m=v.pointerId;return pa.set(m,va(pa.get(m)||null,s,n,l,d,v)),!0;case"gotpointercapture":return m=v.pointerId,ga.set(m,va(ga.get(m)||null,s,n,l,d,v)),!0}return!1}function d_(s){var n=en(s.target);if(n!==null){var l=Zs(n);if(l!==null){if(n=l.tag,n===13){if(n=Xv(l),n!==null){s.blockedOn=n,h_(s.priority,function(){l_(l)});return}}else if(n===3&&l.stateNode.current.memoizedState.isDehydrated){s.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}s.blockedOn=null}function ac(s){if(s.blockedOn!==null)return!1;for(var n=s.targetContainers;0<n.length;){var l=Ku(s.domEventName,s.eventSystemFlags,n[0],s.nativeEvent);if(l===null){l=s.nativeEvent;var d=new l.constructor(l.type,l);Mu=d,l.target.dispatchEvent(d),Mu=null}else return n=Ta(l),n!==null&&Wu(n),s.blockedOn=l,!1;n.shift()}return!0}function f_(s,n,l){ac(s)&&l.delete(n)}function Mw(){Hu=!1,as!==null&&ac(as)&&(as=null),ls!==null&&ac(ls)&&(ls=null),cs!==null&&ac(cs)&&(cs=null),pa.forEach(f_),ga.forEach(f_)}function _a(s,n){s.blockedOn===n&&(s.blockedOn=null,Hu||(Hu=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Mw)))}function ma(s){function n(v){return _a(v,s)}if(0<oc.length){_a(oc[0],s);for(var l=1;l<oc.length;l++){var d=oc[l];d.blockedOn===s&&(d.blockedOn=null)}}for(as!==null&&_a(as,s),ls!==null&&_a(ls,s),cs!==null&&_a(cs,s),pa.forEach(n),ga.forEach(n),l=0;l<hs.length;l++)d=hs[l],d.blockedOn===s&&(d.blockedOn=null);for(;0<hs.length&&(l=hs[0],l.blockedOn===null);)d_(l),l.blockedOn===null&&hs.shift()}var qn=R.ReactCurrentBatchConfig,lc=!0;function Dw(s,n,l,d){var v=Ke,m=qn.transition;qn.transition=null;try{Ke=1,Uu(s,n,l,d)}finally{Ke=v,qn.transition=m}}function Bw(s,n,l,d){var v=Ke,m=qn.transition;qn.transition=null;try{Ke=4,Uu(s,n,l,d)}finally{Ke=v,qn.transition=m}}function Uu(s,n,l,d){if(lc){var v=Ku(s,n,l,d);if(v===null)ld(s,n,d,cc,l),u_(s,d);else if(Lw(v,s,n,l,d))d.stopPropagation();else if(u_(s,d),n&4&&-1<Tw.indexOf(s)){for(;v!==null;){var m=Ta(v);if(m!==null&&a_(m),m=Ku(s,n,l,d),m===null&&ld(s,n,d,cc,l),m===v)break;v=m}v!==null&&d.stopPropagation()}else ld(s,n,d,null,l)}}var cc=null;function Ku(s,n,l,d){if(cc=null,s=Du(d),s=en(s),s!==null)if(n=Zs(s),n===null)s=null;else if(l=n.tag,l===13){if(s=Xv(n),s!==null)return s;s=null}else if(l===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;s=null}else n!==s&&(s=null);return cc=s,null}function p_(s){switch(s){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(Sw()){case $u:return 1;case i_:return 4;case tc:case bw:return 16;case s_:return 536870912;default:return 16}default:return 16}}var us=null,qu=null,hc=null;function g_(){if(hc)return hc;var s,n=qu,l=n.length,d,v="value"in us?us.value:us.textContent,m=v.length;for(s=0;s<l&&n[s]===v[s];s++);var b=l-s;for(d=1;d<=b&&n[l-d]===v[m-d];d++);return hc=v.slice(s,1<d?1-d:void 0)}function uc(s){var n=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&n===13&&(s=13)):s=n,s===10&&(s=13),32<=s||s===13?s:0}function dc(){return!0}function v_(){return!1}function Cr(s){function n(l,d,v,m,b){this._reactName=l,this._targetInst=v,this.type=d,this.nativeEvent=m,this.target=b,this.currentTarget=null;for(var P in s)s.hasOwnProperty(P)&&(l=s[P],this[P]=l?l(m):m[P]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?dc:v_,this.isPropagationStopped=v_,this}return ee(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=dc)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=dc)},persist:function(){},isPersistent:dc}),n}var Vn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Vu=Cr(Vn),ya=ee({},Vn,{view:0,detail:0}),Iw=Cr(ya),Qu,Gu,xa,fc=ee({},ya,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xu,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==xa&&(xa&&s.type==="mousemove"?(Qu=s.screenX-xa.screenX,Gu=s.screenY-xa.screenY):Gu=Qu=0,xa=s),Qu)},movementY:function(s){return"movementY"in s?s.movementY:Gu}}),__=Cr(fc),Ow=ee({},fc,{dataTransfer:0}),Fw=Cr(Ow),$w=ee({},ya,{relatedTarget:0}),Yu=Cr($w),Aw=ee({},Vn,{animationName:0,elapsedTime:0,pseudoElement:0}),Nw=Cr(Aw),zw=ee({},Vn,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),Ww=Cr(zw),Hw=ee({},Vn,{data:0}),m_=Cr(Hw),Uw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Kw={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"},qw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Vw(s){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(s):(s=qw[s])?!!n[s]:!1}function Xu(){return Vw}var Qw=ee({},ya,{key:function(s){if(s.key){var n=Uw[s.key]||s.key;if(n!=="Unidentified")return n}return s.type==="keypress"?(s=uc(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?Kw[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xu,charCode:function(s){return s.type==="keypress"?uc(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?uc(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),Gw=Cr(Qw),Yw=ee({},fc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),y_=Cr(Yw),Xw=ee({},ya,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xu}),Jw=Cr(Xw),Zw=ee({},Vn,{propertyName:0,elapsedTime:0,pseudoElement:0}),eC=Cr(Zw),tC=ee({},fc,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),rC=Cr(tC),iC=[9,13,27,32],Ju=u&&"CompositionEvent"in window,Sa=null;u&&"documentMode"in document&&(Sa=document.documentMode);var sC=u&&"TextEvent"in window&&!Sa,x_=u&&(!Ju||Sa&&8<Sa&&11>=Sa),S_=" ",b_=!1;function w_(s,n){switch(s){case"keyup":return iC.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function C_(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Qn=!1;function nC(s,n){switch(s){case"compositionend":return C_(n);case"keypress":return n.which!==32?null:(b_=!0,S_);case"textInput":return s=n.data,s===S_&&b_?null:s;default:return null}}function oC(s,n){if(Qn)return s==="compositionend"||!Ju&&w_(s,n)?(s=g_(),hc=qu=us=null,Qn=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return x_&&n.locale!=="ko"?null:n.data;default:return null}}var aC={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 k_(s){var n=s&&s.nodeName&&s.nodeName.toLowerCase();return n==="input"?!!aC[s.type]:n==="textarea"}function E_(s,n,l,d){qv(d),n=mc(n,"onChange"),0<n.length&&(l=new Vu("onChange","change",null,l,d),s.push({event:l,listeners:n}))}var ba=null,wa=null;function lC(s){U_(s,0)}function pc(s){var n=Zn(s);if(xt(n))return s}function cC(s,n){if(s==="change")return n}var P_=!1;if(u){var Zu;if(u){var ed="oninput"in document;if(!ed){var R_=document.createElement("div");R_.setAttribute("oninput","return;"),ed=typeof R_.oninput=="function"}Zu=ed}else Zu=!1;P_=Zu&&(!document.documentMode||9<document.documentMode)}function j_(){ba&&(ba.detachEvent("onpropertychange",T_),wa=ba=null)}function T_(s){if(s.propertyName==="value"&&pc(wa)){var n=[];E_(n,wa,s,Du(s)),Yv(lC,n)}}function hC(s,n,l){s==="focusin"?(j_(),ba=n,wa=l,ba.attachEvent("onpropertychange",T_)):s==="focusout"&&j_()}function uC(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return pc(wa)}function dC(s,n){if(s==="click")return pc(n)}function fC(s,n){if(s==="input"||s==="change")return pc(n)}function pC(s,n){return s===n&&(s!==0||1/s===1/n)||s!==s&&n!==n}var Jr=typeof Object.is=="function"?Object.is:pC;function Ca(s,n){if(Jr(s,n))return!0;if(typeof s!="object"||s===null||typeof n!="object"||n===null)return!1;var l=Object.keys(s),d=Object.keys(n);if(l.length!==d.length)return!1;for(d=0;d<l.length;d++){var v=l[d];if(!p.call(n,v)||!Jr(s[v],n[v]))return!1}return!0}function L_(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function M_(s,n){var l=L_(s);s=0;for(var d;l;){if(l.nodeType===3){if(d=s+l.textContent.length,s<=n&&d>=n)return{node:l,offset:n-s};s=d}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=L_(l)}}function D_(s,n){return s&&n?s===n?!0:s&&s.nodeType===3?!1:n&&n.nodeType===3?D_(s,n.parentNode):"contains"in s?s.contains(n):s.compareDocumentPosition?!!(s.compareDocumentPosition(n)&16):!1:!1}function B_(){for(var s=window,n=Ae();n instanceof s.HTMLIFrameElement;){try{var l=typeof n.contentWindow.location.href=="string"}catch{l=!1}if(l)s=n.contentWindow;else break;n=Ae(s.document)}return n}function td(s){var n=s&&s.nodeName&&s.nodeName.toLowerCase();return n&&(n==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||n==="textarea"||s.contentEditable==="true")}function gC(s){var n=B_(),l=s.focusedElem,d=s.selectionRange;if(n!==l&&l&&l.ownerDocument&&D_(l.ownerDocument.documentElement,l)){if(d!==null&&td(l)){if(n=d.start,s=d.end,s===void 0&&(s=n),"selectionStart"in l)l.selectionStart=n,l.selectionEnd=Math.min(s,l.value.length);else if(s=(n=l.ownerDocument||document)&&n.defaultView||window,s.getSelection){s=s.getSelection();var v=l.textContent.length,m=Math.min(d.start,v);d=d.end===void 0?m:Math.min(d.end,v),!s.extend&&m>d&&(v=d,d=m,m=v),v=M_(l,m);var b=M_(l,d);v&&b&&(s.rangeCount!==1||s.anchorNode!==v.node||s.anchorOffset!==v.offset||s.focusNode!==b.node||s.focusOffset!==b.offset)&&(n=n.createRange(),n.setStart(v.node,v.offset),s.removeAllRanges(),m>d?(s.addRange(n),s.extend(b.node,b.offset)):(n.setEnd(b.node,b.offset),s.addRange(n)))}}for(n=[],s=l;s=s.parentNode;)s.nodeType===1&&n.push({element:s,left:s.scrollLeft,top:s.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;l<n.length;l++)s=n[l],s.element.scrollLeft=s.left,s.element.scrollTop=s.top}}var vC=u&&"documentMode"in document&&11>=document.documentMode,Gn=null,rd=null,ka=null,id=!1;function I_(s,n,l){var d=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;id||Gn==null||Gn!==Ae(d)||(d=Gn,"selectionStart"in d&&td(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),ka&&Ca(ka,d)||(ka=d,d=mc(rd,"onSelect"),0<d.length&&(n=new Vu("onSelect","select",null,n,l),s.push({event:n,listeners:d}),n.target=Gn)))}function gc(s,n){var l={};return l[s.toLowerCase()]=n.toLowerCase(),l["Webkit"+s]="webkit"+n,l["Moz"+s]="moz"+n,l}var Yn={animationend:gc("Animation","AnimationEnd"),animationiteration:gc("Animation","AnimationIteration"),animationstart:gc("Animation","AnimationStart"),transitionend:gc("Transition","TransitionEnd")},sd={},O_={};u&&(O_=document.createElement("div").style,"AnimationEvent"in window||(delete Yn.animationend.animation,delete Yn.animationiteration.animation,delete Yn.animationstart.animation),"TransitionEvent"in window||delete Yn.transitionend.transition);function vc(s){if(sd[s])return sd[s];if(!Yn[s])return s;var n=Yn[s],l;for(l in n)if(n.hasOwnProperty(l)&&l in O_)return sd[s]=n[l];return s}var F_=vc("animationend"),$_=vc("animationiteration"),A_=vc("animationstart"),N_=vc("transitionend"),z_=new Map,W_="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 ds(s,n){z_.set(s,n),a(n,[s])}for(var nd=0;nd<W_.length;nd++){var od=W_[nd],_C=od.toLowerCase(),mC=od[0].toUpperCase()+od.slice(1);ds(_C,"on"+mC)}ds(F_,"onAnimationEnd"),ds($_,"onAnimationIteration"),ds(A_,"onAnimationStart"),ds("dblclick","onDoubleClick"),ds("focusin","onFocus"),ds("focusout","onBlur"),ds(N_,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),a("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),a("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),a("onBeforeInput",["compositionend","keypress","textInput","paste"]),a("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ea="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(" "),yC=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ea));function H_(s,n,l){var d=s.type||"unknown-event";s.currentTarget=l,_w(d,n,void 0,s),s.currentTarget=null}function U_(s,n){n=(n&4)!==0;for(var l=0;l<s.length;l++){var d=s[l],v=d.event;d=d.listeners;e:{var m=void 0;if(n)for(var b=d.length-1;0<=b;b--){var P=d[b],T=P.instance,z=P.currentTarget;if(P=P.listener,T!==m&&v.isPropagationStopped())break e;H_(v,P,z),m=T}else for(b=0;b<d.length;b++){if(P=d[b],T=P.instance,z=P.currentTarget,P=P.listener,T!==m&&v.isPropagationStopped())break e;H_(v,P,z),m=T}}}if(ec)throw s=Fu,ec=!1,Fu=null,s}function Ge(s,n){var l=n[pd];l===void 0&&(l=n[pd]=new Set);var d=s+"__bubble";l.has(d)||(K_(n,s,2,!1),l.add(d))}function ad(s,n,l){var d=0;n&&(d|=4),K_(l,s,d,n)}var _c="_reactListening"+Math.random().toString(36).slice(2);function Pa(s){if(!s[_c]){s[_c]=!0,i.forEach(function(l){l!=="selectionchange"&&(yC.has(l)||ad(l,!1,s),ad(l,!0,s))});var n=s.nodeType===9?s:s.ownerDocument;n===null||n[_c]||(n[_c]=!0,ad("selectionchange",!1,n))}}function K_(s,n,l,d){switch(p_(n)){case 1:var v=Dw;break;case 4:v=Bw;break;default:v=Uu}l=v.bind(null,n,l,s),v=void 0,!Ou||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(v=!0),d?v!==void 0?s.addEventListener(n,l,{capture:!0,passive:v}):s.addEventListener(n,l,!0):v!==void 0?s.addEventListener(n,l,{passive:v}):s.addEventListener(n,l,!1)}function ld(s,n,l,d,v){var m=d;if((n&1)===0&&(n&2)===0&&d!==null)e:for(;;){if(d===null)return;var b=d.tag;if(b===3||b===4){var P=d.stateNode.containerInfo;if(P===v||P.nodeType===8&&P.parentNode===v)break;if(b===4)for(b=d.return;b!==null;){var T=b.tag;if((T===3||T===4)&&(T=b.stateNode.containerInfo,T===v||T.nodeType===8&&T.parentNode===v))return;b=b.return}for(;P!==null;){if(b=en(P),b===null)return;if(T=b.tag,T===5||T===6){d=m=b;continue e}P=P.parentNode}}d=d.return}Yv(function(){var z=m,J=Du(l),te=[];e:{var X=z_.get(s);if(X!==void 0){var pe=Vu,me=s;switch(s){case"keypress":if(uc(l)===0)break e;case"keydown":case"keyup":pe=Gw;break;case"focusin":me="focus",pe=Yu;break;case"focusout":me="blur",pe=Yu;break;case"beforeblur":case"afterblur":pe=Yu;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":pe=__;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":pe=Fw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":pe=Jw;break;case F_:case $_:case A_:pe=Nw;break;case N_:pe=eC;break;case"scroll":pe=Iw;break;case"wheel":pe=rC;break;case"copy":case"cut":case"paste":pe=Ww;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":pe=y_}var ye=(n&4)!==0,_t=!ye&&s==="scroll",O=ye?X!==null?X+"Capture":null:X;ye=[];for(var B=z,A;B!==null;){A=B;var se=A.stateNode;if(A.tag===5&&se!==null&&(A=se,O!==null&&(se=ca(B,O),se!=null&&ye.push(Ra(B,se,A)))),_t)break;B=B.return}0<ye.length&&(X=new pe(X,me,null,l,J),te.push({event:X,listeners:ye}))}}if((n&7)===0){e:{if(X=s==="mouseover"||s==="pointerover",pe=s==="mouseout"||s==="pointerout",X&&l!==Mu&&(me=l.relatedTarget||l.fromElement)&&(en(me)||me[Mi]))break e;if((pe||X)&&(X=J.window===J?J:(X=J.ownerDocument)?X.defaultView||X.parentWindow:window,pe?(me=l.relatedTarget||l.toElement,pe=z,me=me?en(me):null,me!==null&&(_t=Zs(me),me!==_t||me.tag!==5&&me.tag!==6)&&(me=null)):(pe=null,me=z),pe!==me)){if(ye=__,se="onMouseLeave",O="onMouseEnter",B="mouse",(s==="pointerout"||s==="pointerover")&&(ye=y_,se="onPointerLeave",O="onPointerEnter",B="pointer"),_t=pe==null?X:Zn(pe),A=me==null?X:Zn(me),X=new ye(se,B+"leave",pe,l,J),X.target=_t,X.relatedTarget=A,se=null,en(J)===z&&(ye=new ye(O,B+"enter",me,l,J),ye.target=A,ye.relatedTarget=_t,se=ye),_t=se,pe&&me)t:{for(ye=pe,O=me,B=0,A=ye;A;A=Xn(A))B++;for(A=0,se=O;se;se=Xn(se))A++;for(;0<B-A;)ye=Xn(ye),B--;for(;0<A-B;)O=Xn(O),A--;for(;B--;){if(ye===O||O!==null&&ye===O.alternate)break t;ye=Xn(ye),O=Xn(O)}ye=null}else ye=null;pe!==null&&q_(te,X,pe,ye,!1),me!==null&&_t!==null&&q_(te,_t,me,ye,!0)}}e:{if(X=z?Zn(z):window,pe=X.nodeName&&X.nodeName.toLowerCase(),pe==="select"||pe==="input"&&X.type==="file")var xe=cC;else if(k_(X))if(P_)xe=fC;else{xe=uC;var ke=hC}else(pe=X.nodeName)&&pe.toLowerCase()==="input"&&(X.type==="checkbox"||X.type==="radio")&&(xe=dC);if(xe&&(xe=xe(s,z))){E_(te,xe,l,J);break e}ke&&ke(s,X,z),s==="focusout"&&(ke=X._wrapperState)&&ke.controlled&&X.type==="number"&&Js(X,"number",X.value)}switch(ke=z?Zn(z):window,s){case"focusin":(k_(ke)||ke.contentEditable==="true")&&(Gn=ke,rd=z,ka=null);break;case"focusout":ka=rd=Gn=null;break;case"mousedown":id=!0;break;case"contextmenu":case"mouseup":case"dragend":id=!1,I_(te,l,J);break;case"selectionchange":if(vC)break;case"keydown":case"keyup":I_(te,l,J)}var Ee;if(Ju)e:{switch(s){case"compositionstart":var Pe="onCompositionStart";break e;case"compositionend":Pe="onCompositionEnd";break e;case"compositionupdate":Pe="onCompositionUpdate";break e}Pe=void 0}else Qn?w_(s,l)&&(Pe="onCompositionEnd"):s==="keydown"&&l.keyCode===229&&(Pe="onCompositionStart");Pe&&(x_&&l.locale!=="ko"&&(Qn||Pe!=="onCompositionStart"?Pe==="onCompositionEnd"&&Qn&&(Ee=g_()):(us=J,qu="value"in us?us.value:us.textContent,Qn=!0)),ke=mc(z,Pe),0<ke.length&&(Pe=new m_(Pe,s,null,l,J),te.push({event:Pe,listeners:ke}),Ee?Pe.data=Ee:(Ee=C_(l),Ee!==null&&(Pe.data=Ee)))),(Ee=sC?nC(s,l):oC(s,l))&&(z=mc(z,"onBeforeInput"),0<z.length&&(J=new m_("onBeforeInput","beforeinput",null,l,J),te.push({event:J,listeners:z}),J.data=Ee))}U_(te,n)})}function Ra(s,n,l){return{instance:s,listener:n,currentTarget:l}}function mc(s,n){for(var l=n+"Capture",d=[];s!==null;){var v=s,m=v.stateNode;v.tag===5&&m!==null&&(v=m,m=ca(s,l),m!=null&&d.unshift(Ra(s,m,v)),m=ca(s,n),m!=null&&d.push(Ra(s,m,v))),s=s.return}return d}function Xn(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5);return s||null}function q_(s,n,l,d,v){for(var m=n._reactName,b=[];l!==null&&l!==d;){var P=l,T=P.alternate,z=P.stateNode;if(T!==null&&T===d)break;P.tag===5&&z!==null&&(P=z,v?(T=ca(l,m),T!=null&&b.unshift(Ra(l,T,P))):v||(T=ca(l,m),T!=null&&b.push(Ra(l,T,P)))),l=l.return}b.length!==0&&s.push({event:n,listeners:b})}var xC=/\r\n?/g,SC=/\u0000|\uFFFD/g;function V_(s){return(typeof s=="string"?s:""+s).replace(xC,`-`).replace(SC,"")}function yc(s,n,l){if(n=V_(n),V_(s)!==n&&l)throw Error(r(425))}function xc(){}var cd=null,hd=null;function ud(s,n){return s==="textarea"||s==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var dd=typeof setTimeout=="function"?setTimeout:void 0,bC=typeof clearTimeout=="function"?clearTimeout:void 0,Q_=typeof Promise=="function"?Promise:void 0,wC=typeof queueMicrotask=="function"?queueMicrotask:typeof Q_<"u"?function(s){return Q_.resolve(null).then(s).catch(CC)}:dd;function CC(s){setTimeout(function(){throw s})}function fd(s,n){var l=n,d=0;do{var v=l.nextSibling;if(s.removeChild(l),v&&v.nodeType===8)if(l=v.data,l==="/$"){if(d===0){s.removeChild(v),ma(n);return}d--}else l!=="$"&&l!=="$?"&&l!=="$!"||d++;l=v}while(l);ma(n)}function fs(s){for(;s!=null;s=s.nextSibling){var n=s.nodeType;if(n===1||n===3)break;if(n===8){if(n=s.data,n==="$"||n==="$!"||n==="$?")break;if(n==="/$")return null}}return s}function G_(s){s=s.previousSibling;for(var n=0;s;){if(s.nodeType===8){var l=s.data;if(l==="$"||l==="$!"||l==="$?"){if(n===0)return s;n--}else l==="/$"&&n++}s=s.previousSibling}return null}var Jn=Math.random().toString(36).slice(2),hi="__reactFiber$"+Jn,ja="__reactProps$"+Jn,Mi="__reactContainer$"+Jn,pd="__reactEvents$"+Jn,kC="__reactListeners$"+Jn,EC="__reactHandles$"+Jn;function en(s){var n=s[hi];if(n)return n;for(var l=s.parentNode;l;){if(n=l[Mi]||l[hi]){if(l=n.alternate,n.child!==null||l!==null&&l.child!==null)for(s=G_(s);s!==null;){if(l=s[hi])return l;s=G_(s)}return n}s=l,l=s.parentNode}return null}function Ta(s){return s=s[hi]||s[Mi],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function Zn(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(r(33))}function Sc(s){return s[ja]||null}var gd=[],eo=-1;function ps(s){return{current:s}}function Ye(s){0>eo||(s.current=gd[eo],gd[eo]=null,eo--)}function Qe(s,n){eo++,gd[eo]=s.current,s.current=n}var gs={},Qt=ps(gs),fr=ps(!1),tn=gs;function to(s,n){var l=s.type.contextTypes;if(!l)return gs;var d=s.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===n)return d.__reactInternalMemoizedMaskedChildContext;var v={},m;for(m in l)v[m]=n[m];return d&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=n,s.__reactInternalMemoizedMaskedChildContext=v),v}function pr(s){return s=s.childContextTypes,s!=null}function bc(){Ye(fr),Ye(Qt)}function Y_(s,n,l){if(Qt.current!==gs)throw Error(r(168));Qe(Qt,n),Qe(fr,l)}function X_(s,n,l){var d=s.stateNode;if(n=n.childContextTypes,typeof d.getChildContext!="function")return l;d=d.getChildContext();for(var v in d)if(!(v in n))throw Error(r(108,De(s)||"Unknown",v));return ee({},l,d)}function wc(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||gs,tn=Qt.current,Qe(Qt,s),Qe(fr,fr.current),!0}function J_(s,n,l){var d=s.stateNode;if(!d)throw Error(r(169));l?(s=X_(s,n,tn),d.__reactInternalMemoizedMergedChildContext=s,Ye(fr),Ye(Qt),Qe(Qt,s)):Ye(fr),Qe(fr,l)}var Di=null,Cc=!1,vd=!1;function Z_(s){Di===null?Di=[s]:Di.push(s)}function PC(s){Cc=!0,Z_(s)}function vs(){if(!vd&&Di!==null){vd=!0;var s=0,n=Ke;try{var l=Di;for(Ke=1;s<l.length;s++){var d=l[s];do d=d(!0);while(d!==null)}Di=null,Cc=!1}catch(v){throw Di!==null&&(Di=Di.slice(s+1)),t_($u,vs),v}finally{Ke=n,vd=!1}}return null}var ro=[],io=0,kc=null,Ec=0,Dr=[],Br=0,rn=null,Bi=1,Ii="";function sn(s,n){ro[io++]=Ec,ro[io++]=kc,kc=s,Ec=n}function em(s,n,l){Dr[Br++]=Bi,Dr[Br++]=Ii,Dr[Br++]=rn,rn=s;var d=Bi;s=Ii;var v=32-Xr(d)-1;d&=~(1<<v),l+=1;var m=32-Xr(n)+v;if(30<m){var b=v-v%5;m=(d&(1<<b)-1).toString(32),d>>=b,v-=b,Bi=1<<32-Xr(n)+v|l<<v|d,Ii=m+s}else Bi=1<<m|l<<v|d,Ii=s}function _d(s){s.return!==null&&(sn(s,1),em(s,1,0))}function md(s){for(;s===kc;)kc=ro[--io],ro[io]=null,Ec=ro[--io],ro[io]=null;for(;s===rn;)rn=Dr[--Br],Dr[Br]=null,Ii=Dr[--Br],Dr[Br]=null,Bi=Dr[--Br],Dr[Br]=null}var kr=null,Er=null,et=!1,Zr=null;function tm(s,n){var l=$r(5,null,null,0);l.elementType="DELETED",l.stateNode=n,l.return=s,n=s.deletions,n===null?(s.deletions=[l],s.flags|=16):n.push(l)}function rm(s,n){switch(s.tag){case 5:var l=s.type;return n=n.nodeType!==1||l.toLowerCase()!==n.nodeName.toLowerCase()?null:n,n!==null?(s.stateNode=n,kr=s,Er=fs(n.firstChild),!0):!1;case 6:return n=s.pendingProps===""||n.nodeType!==3?null:n,n!==null?(s.stateNode=n,kr=s,Er=null,!0):!1;case 13:return n=n.nodeType!==8?null:n,n!==null?(l=rn!==null?{id:Bi,overflow:Ii}:null,s.memoizedState={dehydrated:n,treeContext:l,retryLane:1073741824},l=$r(18,null,null,0),l.stateNode=n,l.return=s,s.child=l,kr=s,Er=null,!0):!1;default:return!1}}function yd(s){return(s.mode&1)!==0&&(s.flags&128)===0}function xd(s){if(et){var n=Er;if(n){var l=n;if(!rm(s,n)){if(yd(s))throw Error(r(418));n=fs(l.nextSibling);var d=kr;n&&rm(s,n)?tm(d,l):(s.flags=s.flags&-4097|2,et=!1,kr=s)}}else{if(yd(s))throw Error(r(418));s.flags=s.flags&-4097|2,et=!1,kr=s}}}function im(s){for(s=s.return;s!==null&&s.tag!==5&&s.tag!==3&&s.tag!==13;)s=s.return;kr=s}function Pc(s){if(s!==kr)return!1;if(!et)return im(s),et=!0,!1;var n;if((n=s.tag!==3)&&!(n=s.tag!==5)&&(n=s.type,n=n!=="head"&&n!=="body"&&!ud(s.type,s.memoizedProps)),n&&(n=Er)){if(yd(s))throw sm(),Error(r(418));for(;n;)tm(s,n),n=fs(n.nextSibling)}if(im(s),s.tag===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));e:{for(s=s.nextSibling,n=0;s;){if(s.nodeType===8){var l=s.data;if(l==="/$"){if(n===0){Er=fs(s.nextSibling);break e}n--}else l!=="$"&&l!=="$!"&&l!=="$?"||n++}s=s.nextSibling}Er=null}}else Er=kr?fs(s.stateNode.nextSibling):null;return!0}function sm(){for(var s=Er;s;)s=fs(s.nextSibling)}function so(){Er=kr=null,et=!1}function Sd(s){Zr===null?Zr=[s]:Zr.push(s)}var RC=R.ReactCurrentBatchConfig;function La(s,n,l){if(s=l.ref,s!==null&&typeof s!="function"&&typeof s!="object"){if(l._owner){if(l=l._owner,l){if(l.tag!==1)throw Error(r(309));var d=l.stateNode}if(!d)throw Error(r(147,s));var v=d,m=""+s;return n!==null&&n.ref!==null&&typeof n.ref=="function"&&n.ref._stringRef===m?n.ref:(n=function(b){var P=v.refs;b===null?delete P[m]:P[m]=b},n._stringRef=m,n)}if(typeof s!="string")throw Error(r(284));if(!l._owner)throw Error(r(290,s))}return s}function Rc(s,n){throw s=Object.prototype.toString.call(n),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":s))}function nm(s){var n=s._init;return n(s._payload)}function om(s){function n(O,B){if(s){var A=O.deletions;A===null?(O.deletions=[B],O.flags|=16):A.push(B)}}function l(O,B){if(!s)return null;for(;B!==null;)n(O,B),B=B.sibling;return null}function d(O,B){for(O=new Map;B!==null;)B.key!==null?O.set(B.key,B):O.set(B.index,B),B=B.sibling;return O}function v(O,B){return O=Cs(O,B),O.index=0,O.sibling=null,O}function m(O,B,A){return O.index=A,s?(A=O.alternate,A!==null?(A=A.index,A<B?(O.flags|=2,B):A):(O.flags|=2,B)):(O.flags|=1048576,B)}function b(O){return s&&O.alternate===null&&(O.flags|=2),O}function P(O,B,A,se){return B===null||B.tag!==6?(B=ff(A,O.mode,se),B.return=O,B):(B=v(B,A),B.return=O,B)}function T(O,B,A,se){var xe=A.type;return xe===W?J(O,B,A.props.children,se,A.key):B!==null&&(B.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===re&&nm(xe)===B.type)?(se=v(B,A.props),se.ref=La(O,B,A),se.return=O,se):(se=Jc(A.type,A.key,A.props,null,O.mode,se),se.ref=La(O,B,A),se.return=O,se)}function z(O,B,A,se){return B===null||B.tag!==4||B.stateNode.containerInfo!==A.containerInfo||B.stateNode.implementation!==A.implementation?(B=pf(A,O.mode,se),B.return=O,B):(B=v(B,A.children||[]),B.return=O,B)}function J(O,B,A,se,xe){return B===null||B.tag!==7?(B=dn(A,O.mode,se,xe),B.return=O,B):(B=v(B,A),B.return=O,B)}function te(O,B,A){if(typeof B=="string"&&B!==""||typeof B=="number")return B=ff(""+B,O.mode,A),B.return=O,B;if(typeof B=="object"&&B!==null){switch(B.$$typeof){case M:return A=Jc(B.type,B.key,B.props,null,O.mode,A),A.ref=La(O,null,B),A.return=O,A;case F:return B=pf(B,O.mode,A),B.return=O,B;case re:var se=B._init;return te(O,se(B._payload),A)}if(os(B)||Z(B))return B=dn(B,O.mode,A,null),B.return=O,B;Rc(O,B)}return null}function X(O,B,A,se){var xe=B!==null?B.key:null;if(typeof A=="string"&&A!==""||typeof A=="number")return xe!==null?null:P(O,B,""+A,se);if(typeof A=="object"&&A!==null){switch(A.$$typeof){case M:return A.key===xe?T(O,B,A,se):null;case F:return A.key===xe?z(O,B,A,se):null;case re:return xe=A._init,X(O,B,xe(A._payload),se)}if(os(A)||Z(A))return xe!==null?null:J(O,B,A,se,null);Rc(O,A)}return null}function pe(O,B,A,se,xe){if(typeof se=="string"&&se!==""||typeof se=="number")return O=O.get(A)||null,P(B,O,""+se,xe);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case M:return O=O.get(se.key===null?A:se.key)||null,T(B,O,se,xe);case F:return O=O.get(se.key===null?A:se.key)||null,z(B,O,se,xe);case re:var ke=se._init;return pe(O,B,A,ke(se._payload),xe)}if(os(se)||Z(se))return O=O.get(A)||null,J(B,O,se,xe,null);Rc(B,se)}return null}function me(O,B,A,se){for(var xe=null,ke=null,Ee=B,Pe=B=0,Bt=null;Ee!==null&&Pe<A.length;Pe++){Ee.index>Pe?(Bt=Ee,Ee=null):Bt=Ee.sibling;var He=X(O,Ee,A[Pe],se);if(He===null){Ee===null&&(Ee=Bt);break}s&&Ee&&He.alternate===null&&n(O,Ee),B=m(He,B,Pe),ke===null?xe=He:ke.sibling=He,ke=He,Ee=Bt}if(Pe===A.length)return l(O,Ee),et&&sn(O,Pe),xe;if(Ee===null){for(;Pe<A.length;Pe++)Ee=te(O,A[Pe],se),Ee!==null&&(B=m(Ee,B,Pe),ke===null?xe=Ee:ke.sibling=Ee,ke=Ee);return et&&sn(O,Pe),xe}for(Ee=d(O,Ee);Pe<A.length;Pe++)Bt=pe(Ee,O,Pe,A[Pe],se),Bt!==null&&(s&&Bt.alternate!==null&&Ee.delete(Bt.key===null?Pe:Bt.key),B=m(Bt,B,Pe),ke===null?xe=Bt:ke.sibling=Bt,ke=Bt);return s&&Ee.forEach(function(ks){return n(O,ks)}),et&&sn(O,Pe),xe}function ye(O,B,A,se){var xe=Z(A);if(typeof xe!="function")throw Error(r(150));if(A=xe.call(A),A==null)throw Error(r(151));for(var ke=xe=null,Ee=B,Pe=B=0,Bt=null,He=A.next();Ee!==null&&!He.done;Pe++,He=A.next()){Ee.index>Pe?(Bt=Ee,Ee=null):Bt=Ee.sibling;var ks=X(O,Ee,He.value,se);if(ks===null){Ee===null&&(Ee=Bt);break}s&&Ee&&ks.alternate===null&&n(O,Ee),B=m(ks,B,Pe),ke===null?xe=ks:ke.sibling=ks,ke=ks,Ee=Bt}if(He.done)return l(O,Ee),et&&sn(O,Pe),xe;if(Ee===null){for(;!He.done;Pe++,He=A.next())He=te(O,He.value,se),He!==null&&(B=m(He,B,Pe),ke===null?xe=He:ke.sibling=He,ke=He);return et&&sn(O,Pe),xe}for(Ee=d(O,Ee);!He.done;Pe++,He=A.next())He=pe(Ee,O,Pe,He.value,se),He!==null&&(s&&He.alternate!==null&&Ee.delete(He.key===null?Pe:He.key),B=m(He,B,Pe),ke===null?xe=He:ke.sibling=He,ke=He);return s&&Ee.forEach(function(ak){return n(O,ak)}),et&&sn(O,Pe),xe}function _t(O,B,A,se){if(typeof A=="object"&&A!==null&&A.type===W&&A.key===null&&(A=A.props.children),typeof A=="object"&&A!==null){switch(A.$$typeof){case M:e:{for(var xe=A.key,ke=B;ke!==null;){if(ke.key===xe){if(xe=A.type,xe===W){if(ke.tag===7){l(O,ke.sibling),B=v(ke,A.props.children),B.return=O,O=B;break e}}else if(ke.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===re&&nm(xe)===ke.type){l(O,ke.sibling),B=v(ke,A.props),B.ref=La(O,ke,A),B.return=O,O=B;break e}l(O,ke);break}else n(O,ke);ke=ke.sibling}A.type===W?(B=dn(A.props.children,O.mode,se,A.key),B.return=O,O=B):(se=Jc(A.type,A.key,A.props,null,O.mode,se),se.ref=La(O,B,A),se.return=O,O=se)}return b(O);case F:e:{for(ke=A.key;B!==null;){if(B.key===ke)if(B.tag===4&&B.stateNode.containerInfo===A.containerInfo&&B.stateNode.implementation===A.implementation){l(O,B.sibling),B=v(B,A.children||[]),B.return=O,O=B;break e}else{l(O,B);break}else n(O,B);B=B.sibling}B=pf(A,O.mode,se),B.return=O,O=B}return b(O);case re:return ke=A._init,_t(O,B,ke(A._payload),se)}if(os(A))return me(O,B,A,se);if(Z(A))return ye(O,B,A,se);Rc(O,A)}return typeof A=="string"&&A!==""||typeof A=="number"?(A=""+A,B!==null&&B.tag===6?(l(O,B.sibling),B=v(B,A),B.return=O,O=B):(l(O,B),B=ff(A,O.mode,se),B.return=O,O=B),b(O)):l(O,B)}return _t}var no=om(!0),am=om(!1),jc=ps(null),Tc=null,oo=null,bd=null;function wd(){bd=oo=Tc=null}function Cd(s){var n=jc.current;Ye(jc),s._currentValue=n}function kd(s,n,l){for(;s!==null;){var d=s.alternate;if((s.childLanes&n)!==n?(s.childLanes|=n,d!==null&&(d.childLanes|=n)):d!==null&&(d.childLanes&n)!==n&&(d.childLanes|=n),s===l)break;s=s.return}}function ao(s,n){Tc=s,bd=oo=null,s=s.dependencies,s!==null&&s.firstContext!==null&&((s.lanes&n)!==0&&(gr=!0),s.firstContext=null)}function Ir(s){var n=s._currentValue;if(bd!==s)if(s={context:s,memoizedValue:n,next:null},oo===null){if(Tc===null)throw Error(r(308));oo=s,Tc.dependencies={lanes:0,firstContext:s}}else oo=oo.next=s;return n}var nn=null;function Ed(s){nn===null?nn=[s]:nn.push(s)}function lm(s,n,l,d){var v=n.interleaved;return v===null?(l.next=l,Ed(n)):(l.next=v.next,v.next=l),n.interleaved=l,Oi(s,d)}function Oi(s,n){s.lanes|=n;var l=s.alternate;for(l!==null&&(l.lanes|=n),l=s,s=s.return;s!==null;)s.childLanes|=n,l=s.alternate,l!==null&&(l.childLanes|=n),l=s,s=s.return;return l.tag===3?l.stateNode:null}var _s=!1;function Pd(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function cm(s,n){s=s.updateQueue,n.updateQueue===s&&(n.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,effects:s.effects})}function Fi(s,n){return{eventTime:s,lane:n,tag:0,payload:null,callback:null,next:null}}function ms(s,n,l){var d=s.updateQueue;if(d===null)return null;if(d=d.shared,(ze&2)!==0){var v=d.pending;return v===null?n.next=n:(n.next=v.next,v.next=n),d.pending=n,Oi(s,l)}return v=d.interleaved,v===null?(n.next=n,Ed(d)):(n.next=v.next,v.next=n),d.interleaved=n,Oi(s,l)}function Lc(s,n,l){if(n=n.updateQueue,n!==null&&(n=n.shared,(l&4194240)!==0)){var d=n.lanes;d&=s.pendingLanes,l|=d,n.lanes=l,zu(s,l)}}function hm(s,n){var l=s.updateQueue,d=s.alternate;if(d!==null&&(d=d.updateQueue,l===d)){var v=null,m=null;if(l=l.firstBaseUpdate,l!==null){do{var b={eventTime:l.eventTime,lane:l.lane,tag:l.tag,payload:l.payload,callback:l.callback,next:null};m===null?v=m=b:m=m.next=b,l=l.next}while(l!==null);m===null?v=m=n:m=m.next=n}else v=m=n;l={baseState:d.baseState,firstBaseUpdate:v,lastBaseUpdate:m,shared:d.shared,effects:d.effects},s.updateQueue=l;return}s=l.lastBaseUpdate,s===null?l.firstBaseUpdate=n:s.next=n,l.lastBaseUpdate=n}function Mc(s,n,l,d){var v=s.updateQueue;_s=!1;var m=v.firstBaseUpdate,b=v.lastBaseUpdate,P=v.shared.pending;if(P!==null){v.shared.pending=null;var T=P,z=T.next;T.next=null,b===null?m=z:b.next=z,b=T;var J=s.alternate;J!==null&&(J=J.updateQueue,P=J.lastBaseUpdate,P!==b&&(P===null?J.firstBaseUpdate=z:P.next=z,J.lastBaseUpdate=T))}if(m!==null){var te=v.baseState;b=0,J=z=T=null,P=m;do{var X=P.lane,pe=P.eventTime;if((d&X)===X){J!==null&&(J=J.next={eventTime:pe,lane:0,tag:P.tag,payload:P.payload,callback:P.callback,next:null});e:{var me=s,ye=P;switch(X=n,pe=l,ye.tag){case 1:if(me=ye.payload,typeof me=="function"){te=me.call(pe,te,X);break e}te=me;break e;case 3:me.flags=me.flags&-65537|128;case 0:if(me=ye.payload,X=typeof me=="function"?me.call(pe,te,X):me,X==null)break e;te=ee({},te,X);break e;case 2:_s=!0}}P.callback!==null&&P.lane!==0&&(s.flags|=64,X=v.effects,X===null?v.effects=[P]:X.push(P))}else pe={eventTime:pe,lane:X,tag:P.tag,payload:P.payload,callback:P.callback,next:null},J===null?(z=J=pe,T=te):J=J.next=pe,b|=X;if(P=P.next,P===null){if(P=v.shared.pending,P===null)break;X=P,P=X.next,X.next=null,v.lastBaseUpdate=X,v.shared.pending=null}}while(!0);if(J===null&&(T=te),v.baseState=T,v.firstBaseUpdate=z,v.lastBaseUpdate=J,n=v.shared.interleaved,n!==null){v=n;do b|=v.lane,v=v.next;while(v!==n)}else m===null&&(v.shared.lanes=0);ln|=b,s.lanes=b,s.memoizedState=te}}function um(s,n,l){if(s=n.effects,n.effects=null,s!==null)for(n=0;n<s.length;n++){var d=s[n],v=d.callback;if(v!==null){if(d.callback=null,d=l,typeof v!="function")throw Error(r(191,v));v.call(d)}}}var Ma={},ui=ps(Ma),Da=ps(Ma),Ba=ps(Ma);function on(s){if(s===Ma)throw Error(r(174));return s}function Rd(s,n){switch(Qe(Ba,n),Qe(Da,s),Qe(ui,Ma),s=n.nodeType,s){case 9:case 11:n=(n=n.documentElement)?n.namespaceURI:ju(null,"");break;default:s=s===8?n.parentNode:n,n=s.namespaceURI||null,s=s.tagName,n=ju(n,s)}Ye(ui),Qe(ui,n)}function lo(){Ye(ui),Ye(Da),Ye(Ba)}function dm(s){on(Ba.current);var n=on(ui.current),l=ju(n,s.type);n!==l&&(Qe(Da,s),Qe(ui,l))}function jd(s){Da.current===s&&(Ye(ui),Ye(Da))}var st=ps(0);function Dc(s){for(var n=s;n!==null;){if(n.tag===13){var l=n.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||l.data==="$?"||l.data==="$!"))return n}else if(n.tag===19&&n.memoizedProps.revealOrder!==void 0){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===s)break;for(;n.sibling===null;){if(n.return===null||n.return===s)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Td=[];function Ld(){for(var s=0;s<Td.length;s++)Td[s]._workInProgressVersionPrimary=null;Td.length=0}var Bc=R.ReactCurrentDispatcher,Md=R.ReactCurrentBatchConfig,an=0,nt=null,kt=null,Mt=null,Ic=!1,Ia=!1,Oa=0,jC=0;function Gt(){throw Error(r(321))}function Dd(s,n){if(n===null)return!1;for(var l=0;l<n.length&&l<s.length;l++)if(!Jr(s[l],n[l]))return!1;return!0}function Bd(s,n,l,d,v,m){if(an=m,nt=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,Bc.current=s===null||s.memoizedState===null?DC:BC,s=l(d,v),Ia){m=0;do{if(Ia=!1,Oa=0,25<=m)throw Error(r(301));m+=1,Mt=kt=null,n.updateQueue=null,Bc.current=IC,s=l(d,v)}while(Ia)}if(Bc.current=$c,n=kt!==null&&kt.next!==null,an=0,Mt=kt=nt=null,Ic=!1,n)throw Error(r(300));return s}function Id(){var s=Oa!==0;return Oa=0,s}function di(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mt===null?nt.memoizedState=Mt=s:Mt=Mt.next=s,Mt}function Or(){if(kt===null){var s=nt.alternate;s=s!==null?s.memoizedState:null}else s=kt.next;var n=Mt===null?nt.memoizedState:Mt.next;if(n!==null)Mt=n,kt=s;else{if(s===null)throw Error(r(310));kt=s,s={memoizedState:kt.memoizedState,baseState:kt.baseState,baseQueue:kt.baseQueue,queue:kt.queue,next:null},Mt===null?nt.memoizedState=Mt=s:Mt=Mt.next=s}return Mt}function Fa(s,n){return typeof n=="function"?n(s):n}function Od(s){var n=Or(),l=n.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=s;var d=kt,v=d.baseQueue,m=l.pending;if(m!==null){if(v!==null){var b=v.next;v.next=m.next,m.next=b}d.baseQueue=v=m,l.pending=null}if(v!==null){m=v.next,d=d.baseState;var P=b=null,T=null,z=m;do{var J=z.lane;if((an&J)===J)T!==null&&(T=T.next={lane:0,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null}),d=z.hasEagerState?z.eagerState:s(d,z.action);else{var te={lane:J,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null};T===null?(P=T=te,b=d):T=T.next=te,nt.lanes|=J,ln|=J}z=z.next}while(z!==null&&z!==m);T===null?b=d:T.next=P,Jr(d,n.memoizedState)||(gr=!0),n.memoizedState=d,n.baseState=b,n.baseQueue=T,l.lastRenderedState=d}if(s=l.interleaved,s!==null){v=s;do m=v.lane,nt.lanes|=m,ln|=m,v=v.next;while(v!==s)}else v===null&&(l.lanes=0);return[n.memoizedState,l.dispatch]}function Fd(s){var n=Or(),l=n.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=s;var d=l.dispatch,v=l.pending,m=n.memoizedState;if(v!==null){l.pending=null;var b=v=v.next;do m=s(m,b.action),b=b.next;while(b!==v);Jr(m,n.memoizedState)||(gr=!0),n.memoizedState=m,n.baseQueue===null&&(n.baseState=m),l.lastRenderedState=m}return[m,d]}function fm(){}function pm(s,n){var l=nt,d=Or(),v=n(),m=!Jr(d.memoizedState,v);if(m&&(d.memoizedState=v,gr=!0),d=d.queue,$d(_m.bind(null,l,d,s),[s]),d.getSnapshot!==n||m||Mt!==null&&Mt.memoizedState.tag&1){if(l.flags|=2048,$a(9,vm.bind(null,l,d,v,n),void 0,null),Dt===null)throw Error(r(349));(an&30)!==0||gm(l,n,v)}return v}function gm(s,n,l){s.flags|=16384,s={getSnapshot:n,value:l},n=nt.updateQueue,n===null?(n={lastEffect:null,stores:null},nt.updateQueue=n,n.stores=[s]):(l=n.stores,l===null?n.stores=[s]:l.push(s))}function vm(s,n,l,d){n.value=l,n.getSnapshot=d,mm(n)&&ym(s)}function _m(s,n,l){return l(function(){mm(n)&&ym(s)})}function mm(s){var n=s.getSnapshot;s=s.value;try{var l=n();return!Jr(s,l)}catch{return!0}}function ym(s){var n=Oi(s,1);n!==null&&ii(n,s,1,-1)}function xm(s){var n=di();return typeof s=="function"&&(s=s()),n.memoizedState=n.baseState=s,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Fa,lastRenderedState:s},n.queue=s,s=s.dispatch=MC.bind(null,nt,s),[n.memoizedState,s]}function $a(s,n,l,d){return s={tag:s,create:n,destroy:l,deps:d,next:null},n=nt.updateQueue,n===null?(n={lastEffect:null,stores:null},nt.updateQueue=n,n.lastEffect=s.next=s):(l=n.lastEffect,l===null?n.lastEffect=s.next=s:(d=l.next,l.next=s,s.next=d,n.lastEffect=s)),s}function Sm(){return Or().memoizedState}function Oc(s,n,l,d){var v=di();nt.flags|=s,v.memoizedState=$a(1|n,l,void 0,d===void 0?null:d)}function Fc(s,n,l,d){var v=Or();d=d===void 0?null:d;var m=void 0;if(kt!==null){var b=kt.memoizedState;if(m=b.destroy,d!==null&&Dd(d,b.deps)){v.memoizedState=$a(n,l,m,d);return}}nt.flags|=s,v.memoizedState=$a(1|n,l,m,d)}function bm(s,n){return Oc(8390656,8,s,n)}function $d(s,n){return Fc(2048,8,s,n)}function wm(s,n){return Fc(4,2,s,n)}function Cm(s,n){return Fc(4,4,s,n)}function km(s,n){if(typeof n=="function")return s=s(),n(s),function(){n(null)};if(n!=null)return s=s(),n.current=s,function(){n.current=null}}function Em(s,n,l){return l=l!=null?l.concat([s]):null,Fc(4,4,km.bind(null,n,s),l)}function Ad(){}function Pm(s,n){var l=Or();n=n===void 0?null:n;var d=l.memoizedState;return d!==null&&n!==null&&Dd(n,d[1])?d[0]:(l.memoizedState=[s,n],s)}function Rm(s,n){var l=Or();n=n===void 0?null:n;var d=l.memoizedState;return d!==null&&n!==null&&Dd(n,d[1])?d[0]:(s=s(),l.memoizedState=[s,n],s)}function jm(s,n,l){return(an&21)===0?(s.baseState&&(s.baseState=!1,gr=!0),s.memoizedState=l):(Jr(l,n)||(l=n_(),nt.lanes|=l,ln|=l,s.baseState=!0),n)}function TC(s,n){var l=Ke;Ke=l!==0&&4>l?l:4,s(!0);var d=Md.transition;Md.transition={};try{s(!1),n()}finally{Ke=l,Md.transition=d}}function Tm(){return Or().memoizedState}function LC(s,n,l){var d=bs(s);if(l={lane:d,action:l,hasEagerState:!1,eagerState:null,next:null},Lm(s))Mm(n,l);else if(l=lm(s,n,l,d),l!==null){var v=rr();ii(l,s,d,v),Dm(l,n,d)}}function MC(s,n,l){var d=bs(s),v={lane:d,action:l,hasEagerState:!1,eagerState:null,next:null};if(Lm(s))Mm(n,v);else{var m=s.alternate;if(s.lanes===0&&(m===null||m.lanes===0)&&(m=n.lastRenderedReducer,m!==null))try{var b=n.lastRenderedState,P=m(b,l);if(v.hasEagerState=!0,v.eagerState=P,Jr(P,b)){var T=n.interleaved;T===null?(v.next=v,Ed(n)):(v.next=T.next,T.next=v),n.interleaved=v;return}}catch{}finally{}l=lm(s,n,v,d),l!==null&&(v=rr(),ii(l,s,d,v),Dm(l,n,d))}}function Lm(s){var n=s.alternate;return s===nt||n!==null&&n===nt}function Mm(s,n){Ia=Ic=!0;var l=s.pending;l===null?n.next=n:(n.next=l.next,l.next=n),s.pending=n}function Dm(s,n,l){if((l&4194240)!==0){var d=n.lanes;d&=s.pendingLanes,l|=d,n.lanes=l,zu(s,l)}}var $c={readContext:Ir,useCallback:Gt,useContext:Gt,useEffect:Gt,useImperativeHandle:Gt,useInsertionEffect:Gt,useLayoutEffect:Gt,useMemo:Gt,useReducer:Gt,useRef:Gt,useState:Gt,useDebugValue:Gt,useDeferredValue:Gt,useTransition:Gt,useMutableSource:Gt,useSyncExternalStore:Gt,useId:Gt,unstable_isNewReconciler:!1},DC={readContext:Ir,useCallback:function(s,n){return di().memoizedState=[s,n===void 0?null:n],s},useContext:Ir,useEffect:bm,useImperativeHandle:function(s,n,l){return l=l!=null?l.concat([s]):null,Oc(4194308,4,km.bind(null,n,s),l)},useLayoutEffect:function(s,n){return Oc(4194308,4,s,n)},useInsertionEffect:function(s,n){return Oc(4,2,s,n)},useMemo:function(s,n){var l=di();return n=n===void 0?null:n,s=s(),l.memoizedState=[s,n],s},useReducer:function(s,n,l){var d=di();return n=l!==void 0?l(n):n,d.memoizedState=d.baseState=n,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:n},d.queue=s,s=s.dispatch=LC.bind(null,nt,s),[d.memoizedState,s]},useRef:function(s){var n=di();return s={current:s},n.memoizedState=s},useState:xm,useDebugValue:Ad,useDeferredValue:function(s){return di().memoizedState=s},useTransition:function(){var s=xm(!1),n=s[0];return s=TC.bind(null,s[1]),di().memoizedState=s,[n,s]},useMutableSource:function(){},useSyncExternalStore:function(s,n,l){var d=nt,v=di();if(et){if(l===void 0)throw Error(r(407));l=l()}else{if(l=n(),Dt===null)throw Error(r(349));(an&30)!==0||gm(d,n,l)}v.memoizedState=l;var m={value:l,getSnapshot:n};return v.queue=m,bm(_m.bind(null,d,m,s),[s]),d.flags|=2048,$a(9,vm.bind(null,d,m,l,n),void 0,null),l},useId:function(){var s=di(),n=Dt.identifierPrefix;if(et){var l=Ii,d=Bi;l=(d&~(1<<32-Xr(d)-1)).toString(32)+l,n=":"+n+"R"+l,l=Oa++,0<l&&(n+="H"+l.toString(32)),n+=":"}else l=jC++,n=":"+n+"r"+l.toString(32)+":";return s.memoizedState=n},unstable_isNewReconciler:!1},BC={readContext:Ir,useCallback:Pm,useContext:Ir,useEffect:$d,useImperativeHandle:Em,useInsertionEffect:wm,useLayoutEffect:Cm,useMemo:Rm,useReducer:Od,useRef:Sm,useState:function(){return Od(Fa)},useDebugValue:Ad,useDeferredValue:function(s){var n=Or();return jm(n,kt.memoizedState,s)},useTransition:function(){var s=Od(Fa)[0],n=Or().memoizedState;return[s,n]},useMutableSource:fm,useSyncExternalStore:pm,useId:Tm,unstable_isNewReconciler:!1},IC={readContext:Ir,useCallback:Pm,useContext:Ir,useEffect:$d,useImperativeHandle:Em,useInsertionEffect:wm,useLayoutEffect:Cm,useMemo:Rm,useReducer:Fd,useRef:Sm,useState:function(){return Fd(Fa)},useDebugValue:Ad,useDeferredValue:function(s){var n=Or();return kt===null?n.memoizedState=s:jm(n,kt.memoizedState,s)},useTransition:function(){var s=Fd(Fa)[0],n=Or().memoizedState;return[s,n]},useMutableSource:fm,useSyncExternalStore:pm,useId:Tm,unstable_isNewReconciler:!1};function ei(s,n){if(s&&s.defaultProps){n=ee({},n),s=s.defaultProps;for(var l in s)n[l]===void 0&&(n[l]=s[l]);return n}return n}function Nd(s,n,l,d){n=s.memoizedState,l=l(d,n),l=l==null?n:ee({},n,l),s.memoizedState=l,s.lanes===0&&(s.updateQueue.baseState=l)}var Ac={isMounted:function(s){return(s=s._reactInternals)?Zs(s)===s:!1},enqueueSetState:function(s,n,l){s=s._reactInternals;var d=rr(),v=bs(s),m=Fi(d,v);m.payload=n,l!=null&&(m.callback=l),n=ms(s,m,v),n!==null&&(ii(n,s,v,d),Lc(n,s,v))},enqueueReplaceState:function(s,n,l){s=s._reactInternals;var d=rr(),v=bs(s),m=Fi(d,v);m.tag=1,m.payload=n,l!=null&&(m.callback=l),n=ms(s,m,v),n!==null&&(ii(n,s,v,d),Lc(n,s,v))},enqueueForceUpdate:function(s,n){s=s._reactInternals;var l=rr(),d=bs(s),v=Fi(l,d);v.tag=2,n!=null&&(v.callback=n),n=ms(s,v,d),n!==null&&(ii(n,s,d,l),Lc(n,s,d))}};function Bm(s,n,l,d,v,m,b){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,m,b):n.prototype&&n.prototype.isPureReactComponent?!Ca(l,d)||!Ca(v,m):!0}function Im(s,n,l){var d=!1,v=gs,m=n.contextType;return typeof m=="object"&&m!==null?m=Ir(m):(v=pr(n)?tn:Qt.current,d=n.contextTypes,m=(d=d!=null)?to(s,v):gs),n=new n(l,m),s.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,n.updater=Ac,s.stateNode=n,n._reactInternals=s,d&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=v,s.__reactInternalMemoizedMaskedChildContext=m),n}function Om(s,n,l,d){s=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(l,d),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(l,d),n.state!==s&&Ac.enqueueReplaceState(n,n.state,null)}function zd(s,n,l,d){var v=s.stateNode;v.props=l,v.state=s.memoizedState,v.refs={},Pd(s);var m=n.contextType;typeof m=="object"&&m!==null?v.context=Ir(m):(m=pr(n)?tn:Qt.current,v.context=to(s,m)),v.state=s.memoizedState,m=n.getDerivedStateFromProps,typeof m=="function"&&(Nd(s,n,m,l),v.state=s.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(n=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),n!==v.state&&Ac.enqueueReplaceState(v,v.state,null),Mc(s,l,v,d),v.state=s.memoizedState),typeof v.componentDidMount=="function"&&(s.flags|=4194308)}function co(s,n){try{var l="",d=n;do l+=we(d),d=d.return;while(d);var v=l}catch(m){v=`-Error generating stack: `+m.message+`-`+m.stack}return{value:s,source:n,stack:v,digest:null}}function Wd(s,n,l){return{value:s,source:null,stack:l??null,digest:n??null}}function Hd(s,n){try{console.error(n.value)}catch(l){setTimeout(function(){throw l})}}var OC=typeof WeakMap=="function"?WeakMap:Map;function Fm(s,n,l){l=Fi(-1,l),l.tag=3,l.payload={element:null};var d=n.value;return l.callback=function(){qc||(qc=!0,nf=d),Hd(s,n)},l}function $m(s,n,l){l=Fi(-1,l),l.tag=3;var d=s.type.getDerivedStateFromError;if(typeof d=="function"){var v=n.value;l.payload=function(){return d(v)},l.callback=function(){Hd(s,n)}}var m=s.stateNode;return m!==null&&typeof m.componentDidCatch=="function"&&(l.callback=function(){Hd(s,n),typeof d!="function"&&(xs===null?xs=new Set([this]):xs.add(this));var b=n.stack;this.componentDidCatch(n.value,{componentStack:b!==null?b:""})}),l}function Am(s,n,l){var d=s.pingCache;if(d===null){d=s.pingCache=new OC;var v=new Set;d.set(n,v)}else v=d.get(n),v===void 0&&(v=new Set,d.set(n,v));v.has(l)||(v.add(l),s=YC.bind(null,s,n,l),n.then(s,s))}function Nm(s){do{var n;if((n=s.tag===13)&&(n=s.memoizedState,n=n!==null?n.dehydrated!==null:!0),n)return s;s=s.return}while(s!==null);return null}function zm(s,n,l,d,v){return(s.mode&1)===0?(s===n?s.flags|=65536:(s.flags|=128,l.flags|=131072,l.flags&=-52805,l.tag===1&&(l.alternate===null?l.tag=17:(n=Fi(-1,1),n.tag=2,ms(l,n,1))),l.lanes|=1),s):(s.flags|=65536,s.lanes=v,s)}var FC=R.ReactCurrentOwner,gr=!1;function tr(s,n,l,d){n.child=s===null?am(n,null,l,d):no(n,s.child,l,d)}function Wm(s,n,l,d,v){l=l.render;var m=n.ref;return ao(n,v),d=Bd(s,n,l,d,m,v),l=Id(),s!==null&&!gr?(n.updateQueue=s.updateQueue,n.flags&=-2053,s.lanes&=~v,$i(s,n,v)):(et&&l&&_d(n),n.flags|=1,tr(s,n,d,v),n.child)}function Hm(s,n,l,d,v){if(s===null){var m=l.type;return typeof m=="function"&&!df(m)&&m.defaultProps===void 0&&l.compare===null&&l.defaultProps===void 0?(n.tag=15,n.type=m,Um(s,n,m,d,v)):(s=Jc(l.type,null,d,n,n.mode,v),s.ref=n.ref,s.return=n,n.child=s)}if(m=s.child,(s.lanes&v)===0){var b=m.memoizedProps;if(l=l.compare,l=l!==null?l:Ca,l(b,d)&&s.ref===n.ref)return $i(s,n,v)}return n.flags|=1,s=Cs(m,d),s.ref=n.ref,s.return=n,n.child=s}function Um(s,n,l,d,v){if(s!==null){var m=s.memoizedProps;if(Ca(m,d)&&s.ref===n.ref)if(gr=!1,n.pendingProps=d=m,(s.lanes&v)!==0)(s.flags&131072)!==0&&(gr=!0);else return n.lanes=s.lanes,$i(s,n,v)}return Ud(s,n,l,d,v)}function Km(s,n,l){var d=n.pendingProps,v=d.children,m=s!==null?s.memoizedState:null;if(d.mode==="hidden")if((n.mode&1)===0)n.memoizedState={baseLanes:0,cachePool:null,transitions:null},Qe(uo,Pr),Pr|=l;else{if((l&1073741824)===0)return s=m!==null?m.baseLanes|l:l,n.lanes=n.childLanes=1073741824,n.memoizedState={baseLanes:s,cachePool:null,transitions:null},n.updateQueue=null,Qe(uo,Pr),Pr|=s,null;n.memoizedState={baseLanes:0,cachePool:null,transitions:null},d=m!==null?m.baseLanes:l,Qe(uo,Pr),Pr|=d}else m!==null?(d=m.baseLanes|l,n.memoizedState=null):d=l,Qe(uo,Pr),Pr|=d;return tr(s,n,v,l),n.child}function qm(s,n){var l=n.ref;(s===null&&l!==null||s!==null&&s.ref!==l)&&(n.flags|=512,n.flags|=2097152)}function Ud(s,n,l,d,v){var m=pr(l)?tn:Qt.current;return m=to(n,m),ao(n,v),l=Bd(s,n,l,d,m,v),d=Id(),s!==null&&!gr?(n.updateQueue=s.updateQueue,n.flags&=-2053,s.lanes&=~v,$i(s,n,v)):(et&&d&&_d(n),n.flags|=1,tr(s,n,l,v),n.child)}function Vm(s,n,l,d,v){if(pr(l)){var m=!0;wc(n)}else m=!1;if(ao(n,v),n.stateNode===null)zc(s,n),Im(n,l,d),zd(n,l,d,v),d=!0;else if(s===null){var b=n.stateNode,P=n.memoizedProps;b.props=P;var T=b.context,z=l.contextType;typeof z=="object"&&z!==null?z=Ir(z):(z=pr(l)?tn:Qt.current,z=to(n,z));var J=l.getDerivedStateFromProps,te=typeof J=="function"||typeof b.getSnapshotBeforeUpdate=="function";te||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(P!==d||T!==z)&&Om(n,b,d,z),_s=!1;var X=n.memoizedState;b.state=X,Mc(n,d,b,v),T=n.memoizedState,P!==d||X!==T||fr.current||_s?(typeof J=="function"&&(Nd(n,l,J,d),T=n.memoizedState),(P=_s||Bm(n,l,P,d,X,T,z))?(te||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount()),typeof b.componentDidMount=="function"&&(n.flags|=4194308)):(typeof b.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=d,n.memoizedState=T),b.props=d,b.state=T,b.context=z,d=P):(typeof b.componentDidMount=="function"&&(n.flags|=4194308),d=!1)}else{b=n.stateNode,cm(s,n),P=n.memoizedProps,z=n.type===n.elementType?P:ei(n.type,P),b.props=z,te=n.pendingProps,X=b.context,T=l.contextType,typeof T=="object"&&T!==null?T=Ir(T):(T=pr(l)?tn:Qt.current,T=to(n,T));var pe=l.getDerivedStateFromProps;(J=typeof pe=="function"||typeof b.getSnapshotBeforeUpdate=="function")||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(P!==te||X!==T)&&Om(n,b,d,T),_s=!1,X=n.memoizedState,b.state=X,Mc(n,d,b,v);var me=n.memoizedState;P!==te||X!==me||fr.current||_s?(typeof pe=="function"&&(Nd(n,l,pe,d),me=n.memoizedState),(z=_s||Bm(n,l,z,d,X,me,T)||!1)?(J||typeof b.UNSAFE_componentWillUpdate!="function"&&typeof b.componentWillUpdate!="function"||(typeof b.componentWillUpdate=="function"&&b.componentWillUpdate(d,me,T),typeof b.UNSAFE_componentWillUpdate=="function"&&b.UNSAFE_componentWillUpdate(d,me,T)),typeof b.componentDidUpdate=="function"&&(n.flags|=4),typeof b.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof b.componentDidUpdate!="function"||P===s.memoizedProps&&X===s.memoizedState||(n.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||P===s.memoizedProps&&X===s.memoizedState||(n.flags|=1024),n.memoizedProps=d,n.memoizedState=me),b.props=d,b.state=me,b.context=T,d=z):(typeof b.componentDidUpdate!="function"||P===s.memoizedProps&&X===s.memoizedState||(n.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||P===s.memoizedProps&&X===s.memoizedState||(n.flags|=1024),d=!1)}return Kd(s,n,l,d,m,v)}function Kd(s,n,l,d,v,m){qm(s,n);var b=(n.flags&128)!==0;if(!d&&!b)return v&&J_(n,l,!1),$i(s,n,m);d=n.stateNode,FC.current=n;var P=b&&typeof l.getDerivedStateFromError!="function"?null:d.render();return n.flags|=1,s!==null&&b?(n.child=no(n,s.child,null,m),n.child=no(n,null,P,m)):tr(s,n,P,m),n.memoizedState=d.state,v&&J_(n,l,!0),n.child}function Qm(s){var n=s.stateNode;n.pendingContext?Y_(s,n.pendingContext,n.pendingContext!==n.context):n.context&&Y_(s,n.context,!1),Rd(s,n.containerInfo)}function Gm(s,n,l,d,v){return so(),Sd(v),n.flags|=256,tr(s,n,l,d),n.child}var qd={dehydrated:null,treeContext:null,retryLane:0};function Vd(s){return{baseLanes:s,cachePool:null,transitions:null}}function Ym(s,n,l){var d=n.pendingProps,v=st.current,m=!1,b=(n.flags&128)!==0,P;if((P=b)||(P=s!==null&&s.memoizedState===null?!1:(v&2)!==0),P?(m=!0,n.flags&=-129):(s===null||s.memoizedState!==null)&&(v|=1),Qe(st,v&1),s===null)return xd(n),s=n.memoizedState,s!==null&&(s=s.dehydrated,s!==null)?((n.mode&1)===0?n.lanes=1:s.data==="$!"?n.lanes=8:n.lanes=1073741824,null):(b=d.children,s=d.fallback,m?(d=n.mode,m=n.child,b={mode:"hidden",children:b},(d&1)===0&&m!==null?(m.childLanes=0,m.pendingProps=b):m=Zc(b,d,0,null),s=dn(s,d,l,null),m.return=n,s.return=n,m.sibling=s,n.child=m,n.child.memoizedState=Vd(l),n.memoizedState=qd,s):Qd(n,b));if(v=s.memoizedState,v!==null&&(P=v.dehydrated,P!==null))return $C(s,n,b,d,P,v,l);if(m){m=d.fallback,b=n.mode,v=s.child,P=v.sibling;var T={mode:"hidden",children:d.children};return(b&1)===0&&n.child!==v?(d=n.child,d.childLanes=0,d.pendingProps=T,n.deletions=null):(d=Cs(v,T),d.subtreeFlags=v.subtreeFlags&14680064),P!==null?m=Cs(P,m):(m=dn(m,b,l,null),m.flags|=2),m.return=n,d.return=n,d.sibling=m,n.child=d,d=m,m=n.child,b=s.child.memoizedState,b=b===null?Vd(l):{baseLanes:b.baseLanes|l,cachePool:null,transitions:b.transitions},m.memoizedState=b,m.childLanes=s.childLanes&~l,n.memoizedState=qd,d}return m=s.child,s=m.sibling,d=Cs(m,{mode:"visible",children:d.children}),(n.mode&1)===0&&(d.lanes=l),d.return=n,d.sibling=null,s!==null&&(l=n.deletions,l===null?(n.deletions=[s],n.flags|=16):l.push(s)),n.child=d,n.memoizedState=null,d}function Qd(s,n){return n=Zc({mode:"visible",children:n},s.mode,0,null),n.return=s,s.child=n}function Nc(s,n,l,d){return d!==null&&Sd(d),no(n,s.child,null,l),s=Qd(n,n.pendingProps.children),s.flags|=2,n.memoizedState=null,s}function $C(s,n,l,d,v,m,b){if(l)return n.flags&256?(n.flags&=-257,d=Wd(Error(r(422))),Nc(s,n,b,d)):n.memoizedState!==null?(n.child=s.child,n.flags|=128,null):(m=d.fallback,v=n.mode,d=Zc({mode:"visible",children:d.children},v,0,null),m=dn(m,v,b,null),m.flags|=2,d.return=n,m.return=n,d.sibling=m,n.child=d,(n.mode&1)!==0&&no(n,s.child,null,b),n.child.memoizedState=Vd(b),n.memoizedState=qd,m);if((n.mode&1)===0)return Nc(s,n,b,null);if(v.data==="$!"){if(d=v.nextSibling&&v.nextSibling.dataset,d)var P=d.dgst;return d=P,m=Error(r(419)),d=Wd(m,d,void 0),Nc(s,n,b,d)}if(P=(b&s.childLanes)!==0,gr||P){if(d=Dt,d!==null){switch(b&-b){case 4:v=2;break;case 16:v=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:v=32;break;case 536870912:v=268435456;break;default:v=0}v=(v&(d.suspendedLanes|b))!==0?0:v,v!==0&&v!==m.retryLane&&(m.retryLane=v,Oi(s,v),ii(d,s,v,-1))}return uf(),d=Wd(Error(r(421))),Nc(s,n,b,d)}return v.data==="$?"?(n.flags|=128,n.child=s.child,n=XC.bind(null,s),v._reactRetry=n,null):(s=m.treeContext,Er=fs(v.nextSibling),kr=n,et=!0,Zr=null,s!==null&&(Dr[Br++]=Bi,Dr[Br++]=Ii,Dr[Br++]=rn,Bi=s.id,Ii=s.overflow,rn=n),n=Qd(n,d.children),n.flags|=4096,n)}function Xm(s,n,l){s.lanes|=n;var d=s.alternate;d!==null&&(d.lanes|=n),kd(s.return,n,l)}function Gd(s,n,l,d,v){var m=s.memoizedState;m===null?s.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:d,tail:l,tailMode:v}:(m.isBackwards=n,m.rendering=null,m.renderingStartTime=0,m.last=d,m.tail=l,m.tailMode=v)}function Jm(s,n,l){var d=n.pendingProps,v=d.revealOrder,m=d.tail;if(tr(s,n,d.children,l),d=st.current,(d&2)!==0)d=d&1|2,n.flags|=128;else{if(s!==null&&(s.flags&128)!==0)e:for(s=n.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&Xm(s,l,n);else if(s.tag===19)Xm(s,l,n);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===n)break e;for(;s.sibling===null;){if(s.return===null||s.return===n)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}d&=1}if(Qe(st,d),(n.mode&1)===0)n.memoizedState=null;else switch(v){case"forwards":for(l=n.child,v=null;l!==null;)s=l.alternate,s!==null&&Dc(s)===null&&(v=l),l=l.sibling;l=v,l===null?(v=n.child,n.child=null):(v=l.sibling,l.sibling=null),Gd(n,!1,v,l,m);break;case"backwards":for(l=null,v=n.child,n.child=null;v!==null;){if(s=v.alternate,s!==null&&Dc(s)===null){n.child=v;break}s=v.sibling,v.sibling=l,l=v,v=s}Gd(n,!0,l,null,m);break;case"together":Gd(n,!1,null,null,void 0);break;default:n.memoizedState=null}return n.child}function zc(s,n){(n.mode&1)===0&&s!==null&&(s.alternate=null,n.alternate=null,n.flags|=2)}function $i(s,n,l){if(s!==null&&(n.dependencies=s.dependencies),ln|=n.lanes,(l&n.childLanes)===0)return null;if(s!==null&&n.child!==s.child)throw Error(r(153));if(n.child!==null){for(s=n.child,l=Cs(s,s.pendingProps),n.child=l,l.return=n;s.sibling!==null;)s=s.sibling,l=l.sibling=Cs(s,s.pendingProps),l.return=n;l.sibling=null}return n.child}function AC(s,n,l){switch(n.tag){case 3:Qm(n),so();break;case 5:dm(n);break;case 1:pr(n.type)&&wc(n);break;case 4:Rd(n,n.stateNode.containerInfo);break;case 10:var d=n.type._context,v=n.memoizedProps.value;Qe(jc,d._currentValue),d._currentValue=v;break;case 13:if(d=n.memoizedState,d!==null)return d.dehydrated!==null?(Qe(st,st.current&1),n.flags|=128,null):(l&n.child.childLanes)!==0?Ym(s,n,l):(Qe(st,st.current&1),s=$i(s,n,l),s!==null?s.sibling:null);Qe(st,st.current&1);break;case 19:if(d=(l&n.childLanes)!==0,(s.flags&128)!==0){if(d)return Jm(s,n,l);n.flags|=128}if(v=n.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),Qe(st,st.current),d)break;return null;case 22:case 23:return n.lanes=0,Km(s,n,l)}return $i(s,n,l)}var Zm,Yd,ey,ty;Zm=function(s,n){for(var l=n.child;l!==null;){if(l.tag===5||l.tag===6)s.appendChild(l.stateNode);else if(l.tag!==4&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===n)break;for(;l.sibling===null;){if(l.return===null||l.return===n)return;l=l.return}l.sibling.return=l.return,l=l.sibling}},Yd=function(){},ey=function(s,n,l,d){var v=s.memoizedProps;if(v!==d){s=n.stateNode,on(ui.current);var m=null;switch(l){case"input":v=Ti(s,v),d=Ti(s,d),m=[];break;case"select":v=ee({},v,{value:void 0}),d=ee({},d,{value:void 0}),m=[];break;case"textarea":v=Wn(s,v),d=Wn(s,d),m=[];break;default:typeof v.onClick!="function"&&typeof d.onClick=="function"&&(s.onclick=xc)}Tu(l,d);var b;l=null;for(z in v)if(!d.hasOwnProperty(z)&&v.hasOwnProperty(z)&&v[z]!=null)if(z==="style"){var P=v[z];for(b in P)P.hasOwnProperty(b)&&(l||(l={}),l[b]="")}else z!=="dangerouslySetInnerHTML"&&z!=="children"&&z!=="suppressContentEditableWarning"&&z!=="suppressHydrationWarning"&&z!=="autoFocus"&&(o.hasOwnProperty(z)?m||(m=[]):(m=m||[]).push(z,null));for(z in d){var T=d[z];if(P=v!=null?v[z]:void 0,d.hasOwnProperty(z)&&T!==P&&(T!=null||P!=null))if(z==="style")if(P){for(b in P)!P.hasOwnProperty(b)||T&&T.hasOwnProperty(b)||(l||(l={}),l[b]="");for(b in T)T.hasOwnProperty(b)&&P[b]!==T[b]&&(l||(l={}),l[b]=T[b])}else l||(m||(m=[]),m.push(z,l)),l=T;else z==="dangerouslySetInnerHTML"?(T=T?T.__html:void 0,P=P?P.__html:void 0,T!=null&&P!==T&&(m=m||[]).push(z,T)):z==="children"?typeof T!="string"&&typeof T!="number"||(m=m||[]).push(z,""+T):z!=="suppressContentEditableWarning"&&z!=="suppressHydrationWarning"&&(o.hasOwnProperty(z)?(T!=null&&z==="onScroll"&&Ge("scroll",s),m||P===T||(m=[])):(m=m||[]).push(z,T))}l&&(m=m||[]).push("style",l);var z=m;(n.updateQueue=z)&&(n.flags|=4)}},ty=function(s,n,l,d){l!==d&&(n.flags|=4)};function Aa(s,n){if(!et)switch(s.tailMode){case"hidden":n=s.tail;for(var l=null;n!==null;)n.alternate!==null&&(l=n),n=n.sibling;l===null?s.tail=null:l.sibling=null;break;case"collapsed":l=s.tail;for(var d=null;l!==null;)l.alternate!==null&&(d=l),l=l.sibling;d===null?n||s.tail===null?s.tail=null:s.tail.sibling=null:d.sibling=null}}function Yt(s){var n=s.alternate!==null&&s.alternate.child===s.child,l=0,d=0;if(n)for(var v=s.child;v!==null;)l|=v.lanes|v.childLanes,d|=v.subtreeFlags&14680064,d|=v.flags&14680064,v.return=s,v=v.sibling;else for(v=s.child;v!==null;)l|=v.lanes|v.childLanes,d|=v.subtreeFlags,d|=v.flags,v.return=s,v=v.sibling;return s.subtreeFlags|=d,s.childLanes=l,n}function NC(s,n,l){var d=n.pendingProps;switch(md(n),n.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Yt(n),null;case 1:return pr(n.type)&&bc(),Yt(n),null;case 3:return d=n.stateNode,lo(),Ye(fr),Ye(Qt),Ld(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(s===null||s.child===null)&&(Pc(n)?n.flags|=4:s===null||s.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Zr!==null&&(lf(Zr),Zr=null))),Yd(s,n),Yt(n),null;case 5:jd(n);var v=on(Ba.current);if(l=n.type,s!==null&&n.stateNode!=null)ey(s,n,l,d,v),s.ref!==n.ref&&(n.flags|=512,n.flags|=2097152);else{if(!d){if(n.stateNode===null)throw Error(r(166));return Yt(n),null}if(s=on(ui.current),Pc(n)){d=n.stateNode,l=n.type;var m=n.memoizedProps;switch(d[hi]=n,d[ja]=m,s=(n.mode&1)!==0,l){case"dialog":Ge("cancel",d),Ge("close",d);break;case"iframe":case"object":case"embed":Ge("load",d);break;case"video":case"audio":for(v=0;v<Ea.length;v++)Ge(Ea[v],d);break;case"source":Ge("error",d);break;case"img":case"image":case"link":Ge("error",d),Ge("load",d);break;case"details":Ge("toggle",d);break;case"input":Xl(d,m),Ge("invalid",d);break;case"select":d._wrapperState={wasMultiple:!!m.multiple},Ge("invalid",d);break;case"textarea":Hn(d,m),Ge("invalid",d)}Tu(l,m),v=null;for(var b in m)if(m.hasOwnProperty(b)){var P=m[b];b==="children"?typeof P=="string"?d.textContent!==P&&(m.suppressHydrationWarning!==!0&&yc(d.textContent,P,s),v=["children",P]):typeof P=="number"&&d.textContent!==""+P&&(m.suppressHydrationWarning!==!0&&yc(d.textContent,P,s),v=["children",""+P]):o.hasOwnProperty(b)&&P!=null&&b==="onScroll"&&Ge("scroll",d)}switch(l){case"input":Mr(d),oa(d,m,!0);break;case"textarea":Mr(d),Nv(d);break;case"select":case"option":break;default:typeof m.onClick=="function"&&(d.onclick=xc)}d=v,n.updateQueue=d,d!==null&&(n.flags|=4)}else{b=v.nodeType===9?v:v.ownerDocument,s==="http://www.w3.org/1999/xhtml"&&(s=zv(l)),s==="http://www.w3.org/1999/xhtml"?l==="script"?(s=b.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild)):typeof d.is=="string"?s=b.createElement(l,{is:d.is}):(s=b.createElement(l),l==="select"&&(b=s,d.multiple?b.multiple=!0:d.size&&(b.size=d.size))):s=b.createElementNS(s,l),s[hi]=n,s[ja]=d,Zm(s,n,!1,!1),n.stateNode=s;e:{switch(b=Lu(l,d),l){case"dialog":Ge("cancel",s),Ge("close",s),v=d;break;case"iframe":case"object":case"embed":Ge("load",s),v=d;break;case"video":case"audio":for(v=0;v<Ea.length;v++)Ge(Ea[v],s);v=d;break;case"source":Ge("error",s),v=d;break;case"img":case"image":case"link":Ge("error",s),Ge("load",s),v=d;break;case"details":Ge("toggle",s),v=d;break;case"input":Xl(s,d),v=Ti(s,d),Ge("invalid",s);break;case"option":v=d;break;case"select":s._wrapperState={wasMultiple:!!d.multiple},v=ee({},d,{value:void 0}),Ge("invalid",s);break;case"textarea":Hn(s,d),v=Wn(s,d),Ge("invalid",s);break;default:v=d}Tu(l,v),P=v;for(m in P)if(P.hasOwnProperty(m)){var T=P[m];m==="style"?Uv(s,T):m==="dangerouslySetInnerHTML"?(T=T?T.__html:void 0,T!=null&&Wv(s,T)):m==="children"?typeof T=="string"?(l!=="textarea"||T!=="")&&aa(s,T):typeof T=="number"&&aa(s,""+T):m!=="suppressContentEditableWarning"&&m!=="suppressHydrationWarning"&&m!=="autoFocus"&&(o.hasOwnProperty(m)?T!=null&&m==="onScroll"&&Ge("scroll",s):T!=null&&k(s,m,T,b))}switch(l){case"input":Mr(s),oa(s,d,!1);break;case"textarea":Mr(s),Nv(s);break;case"option":d.value!=null&&s.setAttribute("value",""+je(d.value));break;case"select":s.multiple=!!d.multiple,m=d.value,m!=null?Li(s,!!d.multiple,m,!1):d.defaultValue!=null&&Li(s,!!d.multiple,d.defaultValue,!0);break;default:typeof v.onClick=="function"&&(s.onclick=xc)}switch(l){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}}d&&(n.flags|=4)}n.ref!==null&&(n.flags|=512,n.flags|=2097152)}return Yt(n),null;case 6:if(s&&n.stateNode!=null)ty(s,n,s.memoizedProps,d);else{if(typeof d!="string"&&n.stateNode===null)throw Error(r(166));if(l=on(Ba.current),on(ui.current),Pc(n)){if(d=n.stateNode,l=n.memoizedProps,d[hi]=n,(m=d.nodeValue!==l)&&(s=kr,s!==null))switch(s.tag){case 3:yc(d.nodeValue,l,(s.mode&1)!==0);break;case 5:s.memoizedProps.suppressHydrationWarning!==!0&&yc(d.nodeValue,l,(s.mode&1)!==0)}m&&(n.flags|=4)}else d=(l.nodeType===9?l:l.ownerDocument).createTextNode(d),d[hi]=n,n.stateNode=d}return Yt(n),null;case 13:if(Ye(st),d=n.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(et&&Er!==null&&(n.mode&1)!==0&&(n.flags&128)===0)sm(),so(),n.flags|=98560,m=!1;else if(m=Pc(n),d!==null&&d.dehydrated!==null){if(s===null){if(!m)throw Error(r(318));if(m=n.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(r(317));m[hi]=n}else so(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Yt(n),m=!1}else Zr!==null&&(lf(Zr),Zr=null),m=!0;if(!m)return n.flags&65536?n:null}return(n.flags&128)!==0?(n.lanes=l,n):(d=d!==null,d!==(s!==null&&s.memoizedState!==null)&&d&&(n.child.flags|=8192,(n.mode&1)!==0&&(s===null||(st.current&1)!==0?Et===0&&(Et=3):uf())),n.updateQueue!==null&&(n.flags|=4),Yt(n),null);case 4:return lo(),Yd(s,n),s===null&&Pa(n.stateNode.containerInfo),Yt(n),null;case 10:return Cd(n.type._context),Yt(n),null;case 17:return pr(n.type)&&bc(),Yt(n),null;case 19:if(Ye(st),m=n.memoizedState,m===null)return Yt(n),null;if(d=(n.flags&128)!==0,b=m.rendering,b===null)if(d)Aa(m,!1);else{if(Et!==0||s!==null&&(s.flags&128)!==0)for(s=n.child;s!==null;){if(b=Dc(s),b!==null){for(n.flags|=128,Aa(m,!1),d=b.updateQueue,d!==null&&(n.updateQueue=d,n.flags|=4),n.subtreeFlags=0,d=l,l=n.child;l!==null;)m=l,s=d,m.flags&=14680066,b=m.alternate,b===null?(m.childLanes=0,m.lanes=s,m.child=null,m.subtreeFlags=0,m.memoizedProps=null,m.memoizedState=null,m.updateQueue=null,m.dependencies=null,m.stateNode=null):(m.childLanes=b.childLanes,m.lanes=b.lanes,m.child=b.child,m.subtreeFlags=0,m.deletions=null,m.memoizedProps=b.memoizedProps,m.memoizedState=b.memoizedState,m.updateQueue=b.updateQueue,m.type=b.type,s=b.dependencies,m.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),l=l.sibling;return Qe(st,st.current&1|2),n.child}s=s.sibling}m.tail!==null&&vt()>fo&&(n.flags|=128,d=!0,Aa(m,!1),n.lanes=4194304)}else{if(!d)if(s=Dc(b),s!==null){if(n.flags|=128,d=!0,l=s.updateQueue,l!==null&&(n.updateQueue=l,n.flags|=4),Aa(m,!0),m.tail===null&&m.tailMode==="hidden"&&!b.alternate&&!et)return Yt(n),null}else 2*vt()-m.renderingStartTime>fo&&l!==1073741824&&(n.flags|=128,d=!0,Aa(m,!1),n.lanes=4194304);m.isBackwards?(b.sibling=n.child,n.child=b):(l=m.last,l!==null?l.sibling=b:n.child=b,m.last=b)}return m.tail!==null?(n=m.tail,m.rendering=n,m.tail=n.sibling,m.renderingStartTime=vt(),n.sibling=null,l=st.current,Qe(st,d?l&1|2:l&1),n):(Yt(n),null);case 22:case 23:return hf(),d=n.memoizedState!==null,s!==null&&s.memoizedState!==null!==d&&(n.flags|=8192),d&&(n.mode&1)!==0?(Pr&1073741824)!==0&&(Yt(n),n.subtreeFlags&6&&(n.flags|=8192)):Yt(n),null;case 24:return null;case 25:return null}throw Error(r(156,n.tag))}function zC(s,n){switch(md(n),n.tag){case 1:return pr(n.type)&&bc(),s=n.flags,s&65536?(n.flags=s&-65537|128,n):null;case 3:return lo(),Ye(fr),Ye(Qt),Ld(),s=n.flags,(s&65536)!==0&&(s&128)===0?(n.flags=s&-65537|128,n):null;case 5:return jd(n),null;case 13:if(Ye(st),s=n.memoizedState,s!==null&&s.dehydrated!==null){if(n.alternate===null)throw Error(r(340));so()}return s=n.flags,s&65536?(n.flags=s&-65537|128,n):null;case 19:return Ye(st),null;case 4:return lo(),null;case 10:return Cd(n.type._context),null;case 22:case 23:return hf(),null;case 24:return null;default:return null}}var Wc=!1,Xt=!1,WC=typeof WeakSet=="function"?WeakSet:Set,ve=null;function ho(s,n){var l=s.ref;if(l!==null)if(typeof l=="function")try{l(null)}catch(d){ut(s,n,d)}else l.current=null}function Xd(s,n,l){try{l()}catch(d){ut(s,n,d)}}var ry=!1;function HC(s,n){if(cd=lc,s=B_(),td(s)){if("selectionStart"in s)var l={start:s.selectionStart,end:s.selectionEnd};else e:{l=(l=s.ownerDocument)&&l.defaultView||window;var d=l.getSelection&&l.getSelection();if(d&&d.rangeCount!==0){l=d.anchorNode;var v=d.anchorOffset,m=d.focusNode;d=d.focusOffset;try{l.nodeType,m.nodeType}catch{l=null;break e}var b=0,P=-1,T=-1,z=0,J=0,te=s,X=null;t:for(;;){for(var pe;te!==l||v!==0&&te.nodeType!==3||(P=b+v),te!==m||d!==0&&te.nodeType!==3||(T=b+d),te.nodeType===3&&(b+=te.nodeValue.length),(pe=te.firstChild)!==null;)X=te,te=pe;for(;;){if(te===s)break t;if(X===l&&++z===v&&(P=b),X===m&&++J===d&&(T=b),(pe=te.nextSibling)!==null)break;te=X,X=te.parentNode}te=pe}l=P===-1||T===-1?null:{start:P,end:T}}else l=null}l=l||{start:0,end:0}}else l=null;for(hd={focusedElem:s,selectionRange:l},lc=!1,ve=n;ve!==null;)if(n=ve,s=n.child,(n.subtreeFlags&1028)!==0&&s!==null)s.return=n,ve=s;else for(;ve!==null;){n=ve;try{var me=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(me!==null){var ye=me.memoizedProps,_t=me.memoizedState,O=n.stateNode,B=O.getSnapshotBeforeUpdate(n.elementType===n.type?ye:ei(n.type,ye),_t);O.__reactInternalSnapshotBeforeUpdate=B}break;case 3:var A=n.stateNode.containerInfo;A.nodeType===1?A.textContent="":A.nodeType===9&&A.documentElement&&A.removeChild(A.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(se){ut(n,n.return,se)}if(s=n.sibling,s!==null){s.return=n.return,ve=s;break}ve=n.return}return me=ry,ry=!1,me}function Na(s,n,l){var d=n.updateQueue;if(d=d!==null?d.lastEffect:null,d!==null){var v=d=d.next;do{if((v.tag&s)===s){var m=v.destroy;v.destroy=void 0,m!==void 0&&Xd(n,l,m)}v=v.next}while(v!==d)}}function Hc(s,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var l=n=n.next;do{if((l.tag&s)===s){var d=l.create;l.destroy=d()}l=l.next}while(l!==n)}}function Jd(s){var n=s.ref;if(n!==null){var l=s.stateNode;switch(s.tag){case 5:s=l;break;default:s=l}typeof n=="function"?n(s):n.current=s}}function iy(s){var n=s.alternate;n!==null&&(s.alternate=null,iy(n)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(n=s.stateNode,n!==null&&(delete n[hi],delete n[ja],delete n[pd],delete n[kC],delete n[EC])),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}function sy(s){return s.tag===5||s.tag===3||s.tag===4}function ny(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||sy(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Zd(s,n,l){var d=s.tag;if(d===5||d===6)s=s.stateNode,n?l.nodeType===8?l.parentNode.insertBefore(s,n):l.insertBefore(s,n):(l.nodeType===8?(n=l.parentNode,n.insertBefore(s,l)):(n=l,n.appendChild(s)),l=l._reactRootContainer,l!=null||n.onclick!==null||(n.onclick=xc));else if(d!==4&&(s=s.child,s!==null))for(Zd(s,n,l),s=s.sibling;s!==null;)Zd(s,n,l),s=s.sibling}function ef(s,n,l){var d=s.tag;if(d===5||d===6)s=s.stateNode,n?l.insertBefore(s,n):l.appendChild(s);else if(d!==4&&(s=s.child,s!==null))for(ef(s,n,l),s=s.sibling;s!==null;)ef(s,n,l),s=s.sibling}var Wt=null,ti=!1;function ys(s,n,l){for(l=l.child;l!==null;)oy(s,n,l),l=l.sibling}function oy(s,n,l){if(ci&&typeof ci.onCommitFiberUnmount=="function")try{ci.onCommitFiberUnmount(rc,l)}catch{}switch(l.tag){case 5:Xt||ho(l,n);case 6:var d=Wt,v=ti;Wt=null,ys(s,n,l),Wt=d,ti=v,Wt!==null&&(ti?(s=Wt,l=l.stateNode,s.nodeType===8?s.parentNode.removeChild(l):s.removeChild(l)):Wt.removeChild(l.stateNode));break;case 18:Wt!==null&&(ti?(s=Wt,l=l.stateNode,s.nodeType===8?fd(s.parentNode,l):s.nodeType===1&&fd(s,l),ma(s)):fd(Wt,l.stateNode));break;case 4:d=Wt,v=ti,Wt=l.stateNode.containerInfo,ti=!0,ys(s,n,l),Wt=d,ti=v;break;case 0:case 11:case 14:case 15:if(!Xt&&(d=l.updateQueue,d!==null&&(d=d.lastEffect,d!==null))){v=d=d.next;do{var m=v,b=m.destroy;m=m.tag,b!==void 0&&((m&2)!==0||(m&4)!==0)&&Xd(l,n,b),v=v.next}while(v!==d)}ys(s,n,l);break;case 1:if(!Xt&&(ho(l,n),d=l.stateNode,typeof d.componentWillUnmount=="function"))try{d.props=l.memoizedProps,d.state=l.memoizedState,d.componentWillUnmount()}catch(P){ut(l,n,P)}ys(s,n,l);break;case 21:ys(s,n,l);break;case 22:l.mode&1?(Xt=(d=Xt)||l.memoizedState!==null,ys(s,n,l),Xt=d):ys(s,n,l);break;default:ys(s,n,l)}}function ay(s){var n=s.updateQueue;if(n!==null){s.updateQueue=null;var l=s.stateNode;l===null&&(l=s.stateNode=new WC),n.forEach(function(d){var v=JC.bind(null,s,d);l.has(d)||(l.add(d),d.then(v,v))})}}function ri(s,n){var l=n.deletions;if(l!==null)for(var d=0;d<l.length;d++){var v=l[d];try{var m=s,b=n,P=b;e:for(;P!==null;){switch(P.tag){case 5:Wt=P.stateNode,ti=!1;break e;case 3:Wt=P.stateNode.containerInfo,ti=!0;break e;case 4:Wt=P.stateNode.containerInfo,ti=!0;break e}P=P.return}if(Wt===null)throw Error(r(160));oy(m,b,v),Wt=null,ti=!1;var T=v.alternate;T!==null&&(T.return=null),v.return=null}catch(z){ut(v,n,z)}}if(n.subtreeFlags&12854)for(n=n.child;n!==null;)ly(n,s),n=n.sibling}function ly(s,n){var l=s.alternate,d=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(ri(n,s),fi(s),d&4){try{Na(3,s,s.return),Hc(3,s)}catch(ye){ut(s,s.return,ye)}try{Na(5,s,s.return)}catch(ye){ut(s,s.return,ye)}}break;case 1:ri(n,s),fi(s),d&512&&l!==null&&ho(l,l.return);break;case 5:if(ri(n,s),fi(s),d&512&&l!==null&&ho(l,l.return),s.flags&32){var v=s.stateNode;try{aa(v,"")}catch(ye){ut(s,s.return,ye)}}if(d&4&&(v=s.stateNode,v!=null)){var m=s.memoizedProps,b=l!==null?l.memoizedProps:m,P=s.type,T=s.updateQueue;if(s.updateQueue=null,T!==null)try{P==="input"&&m.type==="radio"&&m.name!=null&&Yr(v,m),Lu(P,b);var z=Lu(P,m);for(b=0;b<T.length;b+=2){var J=T[b],te=T[b+1];J==="style"?Uv(v,te):J==="dangerouslySetInnerHTML"?Wv(v,te):J==="children"?aa(v,te):k(v,J,te,z)}switch(P){case"input":na(v,m);break;case"textarea":Av(v,m);break;case"select":var X=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!m.multiple;var pe=m.value;pe!=null?Li(v,!!m.multiple,pe,!1):X!==!!m.multiple&&(m.defaultValue!=null?Li(v,!!m.multiple,m.defaultValue,!0):Li(v,!!m.multiple,m.multiple?[]:"",!1))}v[ja]=m}catch(ye){ut(s,s.return,ye)}}break;case 6:if(ri(n,s),fi(s),d&4){if(s.stateNode===null)throw Error(r(162));v=s.stateNode,m=s.memoizedProps;try{v.nodeValue=m}catch(ye){ut(s,s.return,ye)}}break;case 3:if(ri(n,s),fi(s),d&4&&l!==null&&l.memoizedState.isDehydrated)try{ma(n.containerInfo)}catch(ye){ut(s,s.return,ye)}break;case 4:ri(n,s),fi(s);break;case 13:ri(n,s),fi(s),v=s.child,v.flags&8192&&(m=v.memoizedState!==null,v.stateNode.isHidden=m,!m||v.alternate!==null&&v.alternate.memoizedState!==null||(sf=vt())),d&4&&ay(s);break;case 22:if(J=l!==null&&l.memoizedState!==null,s.mode&1?(Xt=(z=Xt)||J,ri(n,s),Xt=z):ri(n,s),fi(s),d&8192){if(z=s.memoizedState!==null,(s.stateNode.isHidden=z)&&!J&&(s.mode&1)!==0)for(ve=s,J=s.child;J!==null;){for(te=ve=J;ve!==null;){switch(X=ve,pe=X.child,X.tag){case 0:case 11:case 14:case 15:Na(4,X,X.return);break;case 1:ho(X,X.return);var me=X.stateNode;if(typeof me.componentWillUnmount=="function"){d=X,l=X.return;try{n=d,me.props=n.memoizedProps,me.state=n.memoizedState,me.componentWillUnmount()}catch(ye){ut(d,l,ye)}}break;case 5:ho(X,X.return);break;case 22:if(X.memoizedState!==null){uy(te);continue}}pe!==null?(pe.return=X,ve=pe):uy(te)}J=J.sibling}e:for(J=null,te=s;;){if(te.tag===5){if(J===null){J=te;try{v=te.stateNode,z?(m=v.style,typeof m.setProperty=="function"?m.setProperty("display","none","important"):m.display="none"):(P=te.stateNode,T=te.memoizedProps.style,b=T!=null&&T.hasOwnProperty("display")?T.display:null,P.style.display=Hv("display",b))}catch(ye){ut(s,s.return,ye)}}}else if(te.tag===6){if(J===null)try{te.stateNode.nodeValue=z?"":te.memoizedProps}catch(ye){ut(s,s.return,ye)}}else if((te.tag!==22&&te.tag!==23||te.memoizedState===null||te===s)&&te.child!==null){te.child.return=te,te=te.child;continue}if(te===s)break e;for(;te.sibling===null;){if(te.return===null||te.return===s)break e;J===te&&(J=null),te=te.return}J===te&&(J=null),te.sibling.return=te.return,te=te.sibling}}break;case 19:ri(n,s),fi(s),d&4&&ay(s);break;case 21:break;default:ri(n,s),fi(s)}}function fi(s){var n=s.flags;if(n&2){try{e:{for(var l=s.return;l!==null;){if(sy(l)){var d=l;break e}l=l.return}throw Error(r(160))}switch(d.tag){case 5:var v=d.stateNode;d.flags&32&&(aa(v,""),d.flags&=-33);var m=ny(s);ef(s,m,v);break;case 3:case 4:var b=d.stateNode.containerInfo,P=ny(s);Zd(s,P,b);break;default:throw Error(r(161))}}catch(T){ut(s,s.return,T)}s.flags&=-3}n&4096&&(s.flags&=-4097)}function UC(s,n,l){ve=s,cy(s)}function cy(s,n,l){for(var d=(s.mode&1)!==0;ve!==null;){var v=ve,m=v.child;if(v.tag===22&&d){var b=v.memoizedState!==null||Wc;if(!b){var P=v.alternate,T=P!==null&&P.memoizedState!==null||Xt;P=Wc;var z=Xt;if(Wc=b,(Xt=T)&&!z)for(ve=v;ve!==null;)b=ve,T=b.child,b.tag===22&&b.memoizedState!==null?dy(v):T!==null?(T.return=b,ve=T):dy(v);for(;m!==null;)ve=m,cy(m),m=m.sibling;ve=v,Wc=P,Xt=z}hy(s)}else(v.subtreeFlags&8772)!==0&&m!==null?(m.return=v,ve=m):hy(s)}}function hy(s){for(;ve!==null;){var n=ve;if((n.flags&8772)!==0){var l=n.alternate;try{if((n.flags&8772)!==0)switch(n.tag){case 0:case 11:case 15:Xt||Hc(5,n);break;case 1:var d=n.stateNode;if(n.flags&4&&!Xt)if(l===null)d.componentDidMount();else{var v=n.elementType===n.type?l.memoizedProps:ei(n.type,l.memoizedProps);d.componentDidUpdate(v,l.memoizedState,d.__reactInternalSnapshotBeforeUpdate)}var m=n.updateQueue;m!==null&&um(n,m,d);break;case 3:var b=n.updateQueue;if(b!==null){if(l=null,n.child!==null)switch(n.child.tag){case 5:l=n.child.stateNode;break;case 1:l=n.child.stateNode}um(n,b,l)}break;case 5:var P=n.stateNode;if(l===null&&n.flags&4){l=P;var T=n.memoizedProps;switch(n.type){case"button":case"input":case"select":case"textarea":T.autoFocus&&l.focus();break;case"img":T.src&&(l.src=T.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(n.memoizedState===null){var z=n.alternate;if(z!==null){var J=z.memoizedState;if(J!==null){var te=J.dehydrated;te!==null&&ma(te)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}Xt||n.flags&512&&Jd(n)}catch(X){ut(n,n.return,X)}}if(n===s){ve=null;break}if(l=n.sibling,l!==null){l.return=n.return,ve=l;break}ve=n.return}}function uy(s){for(;ve!==null;){var n=ve;if(n===s){ve=null;break}var l=n.sibling;if(l!==null){l.return=n.return,ve=l;break}ve=n.return}}function dy(s){for(;ve!==null;){var n=ve;try{switch(n.tag){case 0:case 11:case 15:var l=n.return;try{Hc(4,n)}catch(T){ut(n,l,T)}break;case 1:var d=n.stateNode;if(typeof d.componentDidMount=="function"){var v=n.return;try{d.componentDidMount()}catch(T){ut(n,v,T)}}var m=n.return;try{Jd(n)}catch(T){ut(n,m,T)}break;case 5:var b=n.return;try{Jd(n)}catch(T){ut(n,b,T)}}}catch(T){ut(n,n.return,T)}if(n===s){ve=null;break}var P=n.sibling;if(P!==null){P.return=n.return,ve=P;break}ve=n.return}}var KC=Math.ceil,Uc=R.ReactCurrentDispatcher,tf=R.ReactCurrentOwner,Fr=R.ReactCurrentBatchConfig,ze=0,Dt=null,St=null,Ht=0,Pr=0,uo=ps(0),Et=0,za=null,ln=0,Kc=0,rf=0,Wa=null,vr=null,sf=0,fo=1/0,Ai=null,qc=!1,nf=null,xs=null,Vc=!1,Ss=null,Qc=0,Ha=0,of=null,Gc=-1,Yc=0;function rr(){return(ze&6)!==0?vt():Gc!==-1?Gc:Gc=vt()}function bs(s){return(s.mode&1)===0?1:(ze&2)!==0&&Ht!==0?Ht&-Ht:RC.transition!==null?(Yc===0&&(Yc=n_()),Yc):(s=Ke,s!==0||(s=window.event,s=s===void 0?16:p_(s.type)),s)}function ii(s,n,l,d){if(50<Ha)throw Ha=0,of=null,Error(r(185));fa(s,l,d),((ze&2)===0||s!==Dt)&&(s===Dt&&((ze&2)===0&&(Kc|=l),Et===4&&ws(s,Ht)),_r(s,d),l===1&&ze===0&&(n.mode&1)===0&&(fo=vt()+500,Cc&&vs()))}function _r(s,n){var l=s.callbackNode;Rw(s,n);var d=nc(s,s===Dt?Ht:0);if(d===0)l!==null&&r_(l),s.callbackNode=null,s.callbackPriority=0;else if(n=d&-d,s.callbackPriority!==n){if(l!=null&&r_(l),n===1)s.tag===0?PC(py.bind(null,s)):Z_(py.bind(null,s)),wC(function(){(ze&6)===0&&vs()}),l=null;else{switch(o_(d)){case 1:l=$u;break;case 4:l=i_;break;case 16:l=tc;break;case 536870912:l=s_;break;default:l=tc}l=by(l,fy.bind(null,s))}s.callbackPriority=n,s.callbackNode=l}}function fy(s,n){if(Gc=-1,Yc=0,(ze&6)!==0)throw Error(r(327));var l=s.callbackNode;if(po()&&s.callbackNode!==l)return null;var d=nc(s,s===Dt?Ht:0);if(d===0)return null;if((d&30)!==0||(d&s.expiredLanes)!==0||n)n=Xc(s,d);else{n=d;var v=ze;ze|=2;var m=vy();(Dt!==s||Ht!==n)&&(Ai=null,fo=vt()+500,hn(s,n));do try{QC();break}catch(P){gy(s,P)}while(!0);wd(),Uc.current=m,ze=v,St!==null?n=0:(Dt=null,Ht=0,n=Et)}if(n!==0){if(n===2&&(v=Au(s),v!==0&&(d=v,n=af(s,v))),n===1)throw l=za,hn(s,0),ws(s,d),_r(s,vt()),l;if(n===6)ws(s,d);else{if(v=s.current.alternate,(d&30)===0&&!qC(v)&&(n=Xc(s,d),n===2&&(m=Au(s),m!==0&&(d=m,n=af(s,m))),n===1))throw l=za,hn(s,0),ws(s,d),_r(s,vt()),l;switch(s.finishedWork=v,s.finishedLanes=d,n){case 0:case 1:throw Error(r(345));case 2:un(s,vr,Ai);break;case 3:if(ws(s,d),(d&130023424)===d&&(n=sf+500-vt(),10<n)){if(nc(s,0)!==0)break;if(v=s.suspendedLanes,(v&d)!==d){rr(),s.pingedLanes|=s.suspendedLanes&v;break}s.timeoutHandle=dd(un.bind(null,s,vr,Ai),n);break}un(s,vr,Ai);break;case 4:if(ws(s,d),(d&4194240)===d)break;for(n=s.eventTimes,v=-1;0<d;){var b=31-Xr(d);m=1<<b,b=n[b],b>v&&(v=b),d&=~m}if(d=v,d=vt()-d,d=(120>d?120:480>d?480:1080>d?1080:1920>d?1920:3e3>d?3e3:4320>d?4320:1960*KC(d/1960))-d,10<d){s.timeoutHandle=dd(un.bind(null,s,vr,Ai),d);break}un(s,vr,Ai);break;case 5:un(s,vr,Ai);break;default:throw Error(r(329))}}}return _r(s,vt()),s.callbackNode===l?fy.bind(null,s):null}function af(s,n){var l=Wa;return s.current.memoizedState.isDehydrated&&(hn(s,n).flags|=256),s=Xc(s,n),s!==2&&(n=vr,vr=l,n!==null&&lf(n)),s}function lf(s){vr===null?vr=s:vr.push.apply(vr,s)}function qC(s){for(var n=s;;){if(n.flags&16384){var l=n.updateQueue;if(l!==null&&(l=l.stores,l!==null))for(var d=0;d<l.length;d++){var v=l[d],m=v.getSnapshot;v=v.value;try{if(!Jr(m(),v))return!1}catch{return!1}}}if(l=n.child,n.subtreeFlags&16384&&l!==null)l.return=n,n=l;else{if(n===s)break;for(;n.sibling===null;){if(n.return===null||n.return===s)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function ws(s,n){for(n&=~rf,n&=~Kc,s.suspendedLanes|=n,s.pingedLanes&=~n,s=s.expirationTimes;0<n;){var l=31-Xr(n),d=1<<l;s[l]=-1,n&=~d}}function py(s){if((ze&6)!==0)throw Error(r(327));po();var n=nc(s,0);if((n&1)===0)return _r(s,vt()),null;var l=Xc(s,n);if(s.tag!==0&&l===2){var d=Au(s);d!==0&&(n=d,l=af(s,d))}if(l===1)throw l=za,hn(s,0),ws(s,n),_r(s,vt()),l;if(l===6)throw Error(r(345));return s.finishedWork=s.current.alternate,s.finishedLanes=n,un(s,vr,Ai),_r(s,vt()),null}function cf(s,n){var l=ze;ze|=1;try{return s(n)}finally{ze=l,ze===0&&(fo=vt()+500,Cc&&vs())}}function cn(s){Ss!==null&&Ss.tag===0&&(ze&6)===0&&po();var n=ze;ze|=1;var l=Fr.transition,d=Ke;try{if(Fr.transition=null,Ke=1,s)return s()}finally{Ke=d,Fr.transition=l,ze=n,(ze&6)===0&&vs()}}function hf(){Pr=uo.current,Ye(uo)}function hn(s,n){s.finishedWork=null,s.finishedLanes=0;var l=s.timeoutHandle;if(l!==-1&&(s.timeoutHandle=-1,bC(l)),St!==null)for(l=St.return;l!==null;){var d=l;switch(md(d),d.tag){case 1:d=d.type.childContextTypes,d!=null&&bc();break;case 3:lo(),Ye(fr),Ye(Qt),Ld();break;case 5:jd(d);break;case 4:lo();break;case 13:Ye(st);break;case 19:Ye(st);break;case 10:Cd(d.type._context);break;case 22:case 23:hf()}l=l.return}if(Dt=s,St=s=Cs(s.current,null),Ht=Pr=n,Et=0,za=null,rf=Kc=ln=0,vr=Wa=null,nn!==null){for(n=0;n<nn.length;n++)if(l=nn[n],d=l.interleaved,d!==null){l.interleaved=null;var v=d.next,m=l.pending;if(m!==null){var b=m.next;m.next=v,d.next=b}l.pending=d}nn=null}return s}function gy(s,n){do{var l=St;try{if(wd(),Bc.current=$c,Ic){for(var d=nt.memoizedState;d!==null;){var v=d.queue;v!==null&&(v.pending=null),d=d.next}Ic=!1}if(an=0,Mt=kt=nt=null,Ia=!1,Oa=0,tf.current=null,l===null||l.return===null){Et=1,za=n,St=null;break}e:{var m=s,b=l.return,P=l,T=n;if(n=Ht,P.flags|=32768,T!==null&&typeof T=="object"&&typeof T.then=="function"){var z=T,J=P,te=J.tag;if((J.mode&1)===0&&(te===0||te===11||te===15)){var X=J.alternate;X?(J.updateQueue=X.updateQueue,J.memoizedState=X.memoizedState,J.lanes=X.lanes):(J.updateQueue=null,J.memoizedState=null)}var pe=Nm(b);if(pe!==null){pe.flags&=-257,zm(pe,b,P,m,n),pe.mode&1&&Am(m,z,n),n=pe,T=z;var me=n.updateQueue;if(me===null){var ye=new Set;ye.add(T),n.updateQueue=ye}else me.add(T);break e}else{if((n&1)===0){Am(m,z,n),uf();break e}T=Error(r(426))}}else if(et&&P.mode&1){var _t=Nm(b);if(_t!==null){(_t.flags&65536)===0&&(_t.flags|=256),zm(_t,b,P,m,n),Sd(co(T,P));break e}}m=T=co(T,P),Et!==4&&(Et=2),Wa===null?Wa=[m]:Wa.push(m),m=b;do{switch(m.tag){case 3:m.flags|=65536,n&=-n,m.lanes|=n;var O=Fm(m,T,n);hm(m,O);break e;case 1:P=T;var B=m.type,A=m.stateNode;if((m.flags&128)===0&&(typeof B.getDerivedStateFromError=="function"||A!==null&&typeof A.componentDidCatch=="function"&&(xs===null||!xs.has(A)))){m.flags|=65536,n&=-n,m.lanes|=n;var se=$m(m,P,n);hm(m,se);break e}}m=m.return}while(m!==null)}my(l)}catch(xe){n=xe,St===l&&l!==null&&(St=l=l.return);continue}break}while(!0)}function vy(){var s=Uc.current;return Uc.current=$c,s===null?$c:s}function uf(){(Et===0||Et===3||Et===2)&&(Et=4),Dt===null||(ln&268435455)===0&&(Kc&268435455)===0||ws(Dt,Ht)}function Xc(s,n){var l=ze;ze|=2;var d=vy();(Dt!==s||Ht!==n)&&(Ai=null,hn(s,n));do try{VC();break}catch(v){gy(s,v)}while(!0);if(wd(),ze=l,Uc.current=d,St!==null)throw Error(r(261));return Dt=null,Ht=0,Et}function VC(){for(;St!==null;)_y(St)}function QC(){for(;St!==null&&!yw();)_y(St)}function _y(s){var n=Sy(s.alternate,s,Pr);s.memoizedProps=s.pendingProps,n===null?my(s):St=n,tf.current=null}function my(s){var n=s;do{var l=n.alternate;if(s=n.return,(n.flags&32768)===0){if(l=NC(l,n,Pr),l!==null){St=l;return}}else{if(l=zC(l,n),l!==null){l.flags&=32767,St=l;return}if(s!==null)s.flags|=32768,s.subtreeFlags=0,s.deletions=null;else{Et=6,St=null;return}}if(n=n.sibling,n!==null){St=n;return}St=n=s}while(n!==null);Et===0&&(Et=5)}function un(s,n,l){var d=Ke,v=Fr.transition;try{Fr.transition=null,Ke=1,GC(s,n,l,d)}finally{Fr.transition=v,Ke=d}return null}function GC(s,n,l,d){do po();while(Ss!==null);if((ze&6)!==0)throw Error(r(327));l=s.finishedWork;var v=s.finishedLanes;if(l===null)return null;if(s.finishedWork=null,s.finishedLanes=0,l===s.current)throw Error(r(177));s.callbackNode=null,s.callbackPriority=0;var m=l.lanes|l.childLanes;if(jw(s,m),s===Dt&&(St=Dt=null,Ht=0),(l.subtreeFlags&2064)===0&&(l.flags&2064)===0||Vc||(Vc=!0,by(tc,function(){return po(),null})),m=(l.flags&15990)!==0,(l.subtreeFlags&15990)!==0||m){m=Fr.transition,Fr.transition=null;var b=Ke;Ke=1;var P=ze;ze|=4,tf.current=null,HC(s,l),ly(l,s),gC(hd),lc=!!cd,hd=cd=null,s.current=l,UC(l),xw(),ze=P,Ke=b,Fr.transition=m}else s.current=l;if(Vc&&(Vc=!1,Ss=s,Qc=v),m=s.pendingLanes,m===0&&(xs=null),ww(l.stateNode),_r(s,vt()),n!==null)for(d=s.onRecoverableError,l=0;l<n.length;l++)v=n[l],d(v.value,{componentStack:v.stack,digest:v.digest});if(qc)throw qc=!1,s=nf,nf=null,s;return(Qc&1)!==0&&s.tag!==0&&po(),m=s.pendingLanes,(m&1)!==0?s===of?Ha++:(Ha=0,of=s):Ha=0,vs(),null}function po(){if(Ss!==null){var s=o_(Qc),n=Fr.transition,l=Ke;try{if(Fr.transition=null,Ke=16>s?16:s,Ss===null)var d=!1;else{if(s=Ss,Ss=null,Qc=0,(ze&6)!==0)throw Error(r(331));var v=ze;for(ze|=4,ve=s.current;ve!==null;){var m=ve,b=m.child;if((ve.flags&16)!==0){var P=m.deletions;if(P!==null){for(var T=0;T<P.length;T++){var z=P[T];for(ve=z;ve!==null;){var J=ve;switch(J.tag){case 0:case 11:case 15:Na(8,J,m)}var te=J.child;if(te!==null)te.return=J,ve=te;else for(;ve!==null;){J=ve;var X=J.sibling,pe=J.return;if(iy(J),J===z){ve=null;break}if(X!==null){X.return=pe,ve=X;break}ve=pe}}}var me=m.alternate;if(me!==null){var ye=me.child;if(ye!==null){me.child=null;do{var _t=ye.sibling;ye.sibling=null,ye=_t}while(ye!==null)}}ve=m}}if((m.subtreeFlags&2064)!==0&&b!==null)b.return=m,ve=b;else e:for(;ve!==null;){if(m=ve,(m.flags&2048)!==0)switch(m.tag){case 0:case 11:case 15:Na(9,m,m.return)}var O=m.sibling;if(O!==null){O.return=m.return,ve=O;break e}ve=m.return}}var B=s.current;for(ve=B;ve!==null;){b=ve;var A=b.child;if((b.subtreeFlags&2064)!==0&&A!==null)A.return=b,ve=A;else e:for(b=B;ve!==null;){if(P=ve,(P.flags&2048)!==0)try{switch(P.tag){case 0:case 11:case 15:Hc(9,P)}}catch(xe){ut(P,P.return,xe)}if(P===b){ve=null;break e}var se=P.sibling;if(se!==null){se.return=P.return,ve=se;break e}ve=P.return}}if(ze=v,vs(),ci&&typeof ci.onPostCommitFiberRoot=="function")try{ci.onPostCommitFiberRoot(rc,s)}catch{}d=!0}return d}finally{Ke=l,Fr.transition=n}}return!1}function yy(s,n,l){n=co(l,n),n=Fm(s,n,1),s=ms(s,n,1),n=rr(),s!==null&&(fa(s,1,n),_r(s,n))}function ut(s,n,l){if(s.tag===3)yy(s,s,l);else for(;n!==null;){if(n.tag===3){yy(n,s,l);break}else if(n.tag===1){var d=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(xs===null||!xs.has(d))){s=co(l,s),s=$m(n,s,1),n=ms(n,s,1),s=rr(),n!==null&&(fa(n,1,s),_r(n,s));break}}n=n.return}}function YC(s,n,l){var d=s.pingCache;d!==null&&d.delete(n),n=rr(),s.pingedLanes|=s.suspendedLanes&l,Dt===s&&(Ht&l)===l&&(Et===4||Et===3&&(Ht&130023424)===Ht&&500>vt()-sf?hn(s,0):rf|=l),_r(s,n)}function xy(s,n){n===0&&((s.mode&1)===0?n=1:(n=sc,sc<<=1,(sc&130023424)===0&&(sc=4194304)));var l=rr();s=Oi(s,n),s!==null&&(fa(s,n,l),_r(s,l))}function XC(s){var n=s.memoizedState,l=0;n!==null&&(l=n.retryLane),xy(s,l)}function JC(s,n){var l=0;switch(s.tag){case 13:var d=s.stateNode,v=s.memoizedState;v!==null&&(l=v.retryLane);break;case 19:d=s.stateNode;break;default:throw Error(r(314))}d!==null&&d.delete(n),xy(s,l)}var Sy;Sy=function(s,n,l){if(s!==null)if(s.memoizedProps!==n.pendingProps||fr.current)gr=!0;else{if((s.lanes&l)===0&&(n.flags&128)===0)return gr=!1,AC(s,n,l);gr=(s.flags&131072)!==0}else gr=!1,et&&(n.flags&1048576)!==0&&em(n,Ec,n.index);switch(n.lanes=0,n.tag){case 2:var d=n.type;zc(s,n),s=n.pendingProps;var v=to(n,Qt.current);ao(n,l),v=Bd(null,n,d,s,v,l);var m=Id();return n.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,pr(d)?(m=!0,wc(n)):m=!1,n.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,Pd(n),v.updater=Ac,n.stateNode=v,v._reactInternals=n,zd(n,d,s,l),n=Kd(null,n,d,!0,m,l)):(n.tag=0,et&&m&&_d(n),tr(null,n,v,l),n=n.child),n;case 16:d=n.elementType;e:{switch(zc(s,n),s=n.pendingProps,v=d._init,d=v(d._payload),n.type=d,v=n.tag=ek(d),s=ei(d,s),v){case 0:n=Ud(null,n,d,s,l);break e;case 1:n=Vm(null,n,d,s,l);break e;case 11:n=Wm(null,n,d,s,l);break e;case 14:n=Hm(null,n,d,ei(d.type,s),l);break e}throw Error(r(306,d,""))}return n;case 0:return d=n.type,v=n.pendingProps,v=n.elementType===d?v:ei(d,v),Ud(s,n,d,v,l);case 1:return d=n.type,v=n.pendingProps,v=n.elementType===d?v:ei(d,v),Vm(s,n,d,v,l);case 3:e:{if(Qm(n),s===null)throw Error(r(387));d=n.pendingProps,m=n.memoizedState,v=m.element,cm(s,n),Mc(n,d,null,l);var b=n.memoizedState;if(d=b.element,m.isDehydrated)if(m={element:d,isDehydrated:!1,cache:b.cache,pendingSuspenseBoundaries:b.pendingSuspenseBoundaries,transitions:b.transitions},n.updateQueue.baseState=m,n.memoizedState=m,n.flags&256){v=co(Error(r(423)),n),n=Gm(s,n,d,l,v);break e}else if(d!==v){v=co(Error(r(424)),n),n=Gm(s,n,d,l,v);break e}else for(Er=fs(n.stateNode.containerInfo.firstChild),kr=n,et=!0,Zr=null,l=am(n,null,d,l),n.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(so(),d===v){n=$i(s,n,l);break e}tr(s,n,d,l)}n=n.child}return n;case 5:return dm(n),s===null&&xd(n),d=n.type,v=n.pendingProps,m=s!==null?s.memoizedProps:null,b=v.children,ud(d,v)?b=null:m!==null&&ud(d,m)&&(n.flags|=32),qm(s,n),tr(s,n,b,l),n.child;case 6:return s===null&&xd(n),null;case 13:return Ym(s,n,l);case 4:return Rd(n,n.stateNode.containerInfo),d=n.pendingProps,s===null?n.child=no(n,null,d,l):tr(s,n,d,l),n.child;case 11:return d=n.type,v=n.pendingProps,v=n.elementType===d?v:ei(d,v),Wm(s,n,d,v,l);case 7:return tr(s,n,n.pendingProps,l),n.child;case 8:return tr(s,n,n.pendingProps.children,l),n.child;case 12:return tr(s,n,n.pendingProps.children,l),n.child;case 10:e:{if(d=n.type._context,v=n.pendingProps,m=n.memoizedProps,b=v.value,Qe(jc,d._currentValue),d._currentValue=b,m!==null)if(Jr(m.value,b)){if(m.children===v.children&&!fr.current){n=$i(s,n,l);break e}}else for(m=n.child,m!==null&&(m.return=n);m!==null;){var P=m.dependencies;if(P!==null){b=m.child;for(var T=P.firstContext;T!==null;){if(T.context===d){if(m.tag===1){T=Fi(-1,l&-l),T.tag=2;var z=m.updateQueue;if(z!==null){z=z.shared;var J=z.pending;J===null?T.next=T:(T.next=J.next,J.next=T),z.pending=T}}m.lanes|=l,T=m.alternate,T!==null&&(T.lanes|=l),kd(m.return,l,n),P.lanes|=l;break}T=T.next}}else if(m.tag===10)b=m.type===n.type?null:m.child;else if(m.tag===18){if(b=m.return,b===null)throw Error(r(341));b.lanes|=l,P=b.alternate,P!==null&&(P.lanes|=l),kd(b,l,n),b=m.sibling}else b=m.child;if(b!==null)b.return=m;else for(b=m;b!==null;){if(b===n){b=null;break}if(m=b.sibling,m!==null){m.return=b.return,b=m;break}b=b.return}m=b}tr(s,n,v.children,l),n=n.child}return n;case 9:return v=n.type,d=n.pendingProps.children,ao(n,l),v=Ir(v),d=d(v),n.flags|=1,tr(s,n,d,l),n.child;case 14:return d=n.type,v=ei(d,n.pendingProps),v=ei(d.type,v),Hm(s,n,d,v,l);case 15:return Um(s,n,n.type,n.pendingProps,l);case 17:return d=n.type,v=n.pendingProps,v=n.elementType===d?v:ei(d,v),zc(s,n),n.tag=1,pr(d)?(s=!0,wc(n)):s=!1,ao(n,l),Im(n,d,v),zd(n,d,v,l),Kd(null,n,d,!0,s,l);case 19:return Jm(s,n,l);case 22:return Km(s,n,l)}throw Error(r(156,n.tag))};function by(s,n){return t_(s,n)}function ZC(s,n,l,d){this.tag=s,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $r(s,n,l,d){return new ZC(s,n,l,d)}function df(s){return s=s.prototype,!(!s||!s.isReactComponent)}function ek(s){if(typeof s=="function")return df(s)?1:0;if(s!=null){if(s=s.$$typeof,s===Q)return 11;if(s===Y)return 14}return 2}function Cs(s,n){var l=s.alternate;return l===null?(l=$r(s.tag,n,s.key,s.mode),l.elementType=s.elementType,l.type=s.type,l.stateNode=s.stateNode,l.alternate=s,s.alternate=l):(l.pendingProps=n,l.type=s.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=s.flags&14680064,l.childLanes=s.childLanes,l.lanes=s.lanes,l.child=s.child,l.memoizedProps=s.memoizedProps,l.memoizedState=s.memoizedState,l.updateQueue=s.updateQueue,n=s.dependencies,l.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},l.sibling=s.sibling,l.index=s.index,l.ref=s.ref,l}function Jc(s,n,l,d,v,m){var b=2;if(d=s,typeof s=="function")df(s)&&(b=1);else if(typeof s=="string")b=5;else e:switch(s){case W:return dn(l.children,v,m,n);case H:b=8,v|=8;break;case K:return s=$r(12,l,n,v|2),s.elementType=K,s.lanes=m,s;case N:return s=$r(13,l,n,v),s.elementType=N,s.lanes=m,s;case q:return s=$r(19,l,n,v),s.elementType=q,s.lanes=m,s;case le:return Zc(l,v,m,n);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case ie:b=10;break e;case oe:b=9;break e;case Q:b=11;break e;case Y:b=14;break e;case re:b=16,d=null;break e}throw Error(r(130,s==null?s:typeof s,""))}return n=$r(b,l,n,v),n.elementType=s,n.type=d,n.lanes=m,n}function dn(s,n,l,d){return s=$r(7,s,d,n),s.lanes=l,s}function Zc(s,n,l,d){return s=$r(22,s,d,n),s.elementType=le,s.lanes=l,s.stateNode={isHidden:!1},s}function ff(s,n,l){return s=$r(6,s,null,n),s.lanes=l,s}function pf(s,n,l){return n=$r(4,s.children!==null?s.children:[],s.key,n),n.lanes=l,n.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},n}function tk(s,n,l,d,v){this.tag=n,this.containerInfo=s,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Nu(0),this.expirationTimes=Nu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nu(0),this.identifierPrefix=d,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function gf(s,n,l,d,v,m,b,P,T){return s=new tk(s,n,l,P,T),n===1?(n=1,m===!0&&(n|=8)):n=0,m=$r(3,null,null,n),s.current=m,m.stateNode=s,m.memoizedState={element:d,isDehydrated:l,cache:null,transitions:null,pendingSuspenseBoundaries:null},Pd(m),s}function rk(s,n,l){var d=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:F,key:d==null?null:""+d,children:s,containerInfo:n,implementation:l}}function wy(s){if(!s)return gs;s=s._reactInternals;e:{if(Zs(s)!==s||s.tag!==1)throw Error(r(170));var n=s;do{switch(n.tag){case 3:n=n.stateNode.context;break e;case 1:if(pr(n.type)){n=n.stateNode.__reactInternalMemoizedMergedChildContext;break e}}n=n.return}while(n!==null);throw Error(r(171))}if(s.tag===1){var l=s.type;if(pr(l))return X_(s,l,n)}return n}function Cy(s,n,l,d,v,m,b,P,T){return s=gf(l,d,!0,s,v,m,b,P,T),s.context=wy(null),l=s.current,d=rr(),v=bs(l),m=Fi(d,v),m.callback=n??null,ms(l,m,v),s.current.lanes=v,fa(s,v,d),_r(s,d),s}function eh(s,n,l,d){var v=n.current,m=rr(),b=bs(v);return l=wy(l),n.context===null?n.context=l:n.pendingContext=l,n=Fi(m,b),n.payload={element:s},d=d===void 0?null:d,d!==null&&(n.callback=d),s=ms(v,n,b),s!==null&&(ii(s,v,b,m),Lc(s,v,b)),b}function th(s){if(s=s.current,!s.child)return null;switch(s.child.tag){case 5:return s.child.stateNode;default:return s.child.stateNode}}function ky(s,n){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var l=s.retryLane;s.retryLane=l!==0&&l<n?l:n}}function vf(s,n){ky(s,n),(s=s.alternate)&&ky(s,n)}function ik(){return null}var Ey=typeof reportError=="function"?reportError:function(s){console.error(s)};function _f(s){this._internalRoot=s}rh.prototype.render=_f.prototype.render=function(s){var n=this._internalRoot;if(n===null)throw Error(r(409));eh(s,n,null,null)},rh.prototype.unmount=_f.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var n=s.containerInfo;cn(function(){eh(null,s,null,null)}),n[Mi]=null}};function rh(s){this._internalRoot=s}rh.prototype.unstable_scheduleHydration=function(s){if(s){var n=c_();s={blockedOn:null,target:s,priority:n};for(var l=0;l<hs.length&&n!==0&&n<hs[l].priority;l++);hs.splice(l,0,s),l===0&&d_(s)}};function mf(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function ih(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11&&(s.nodeType!==8||s.nodeValue!==" react-mount-point-unstable "))}function Py(){}function sk(s,n,l,d,v){if(v){if(typeof d=="function"){var m=d;d=function(){var z=th(b);m.call(z)}}var b=Cy(n,d,s,0,null,!1,!1,"",Py);return s._reactRootContainer=b,s[Mi]=b.current,Pa(s.nodeType===8?s.parentNode:s),cn(),b}for(;v=s.lastChild;)s.removeChild(v);if(typeof d=="function"){var P=d;d=function(){var z=th(T);P.call(z)}}var T=gf(s,0,!1,null,null,!1,!1,"",Py);return s._reactRootContainer=T,s[Mi]=T.current,Pa(s.nodeType===8?s.parentNode:s),cn(function(){eh(n,T,l,d)}),T}function sh(s,n,l,d,v){var m=l._reactRootContainer;if(m){var b=m;if(typeof v=="function"){var P=v;v=function(){var T=th(b);P.call(T)}}eh(n,b,s,v)}else b=sk(l,n,s,v,d);return th(b)}a_=function(s){switch(s.tag){case 3:var n=s.stateNode;if(n.current.memoizedState.isDehydrated){var l=da(n.pendingLanes);l!==0&&(zu(n,l|1),_r(n,vt()),(ze&6)===0&&(fo=vt()+500,vs()))}break;case 13:cn(function(){var d=Oi(s,1);if(d!==null){var v=rr();ii(d,s,1,v)}}),vf(s,1)}},Wu=function(s){if(s.tag===13){var n=Oi(s,134217728);if(n!==null){var l=rr();ii(n,s,134217728,l)}vf(s,134217728)}},l_=function(s){if(s.tag===13){var n=bs(s),l=Oi(s,n);if(l!==null){var d=rr();ii(l,s,n,d)}vf(s,n)}},c_=function(){return Ke},h_=function(s,n){var l=Ke;try{return Ke=s,n()}finally{Ke=l}},Bu=function(s,n,l){switch(n){case"input":if(na(s,l),n=l.name,l.type==="radio"&&n!=null){for(l=s;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll("input[name="+JSON.stringify(""+n)+'][type="radio"]'),n=0;n<l.length;n++){var d=l[n];if(d!==s&&d.form===s.form){var v=Sc(d);if(!v)throw Error(r(90));xt(d),na(d,v)}}}break;case"textarea":Av(s,l);break;case"select":n=l.value,n!=null&&Li(s,!!l.multiple,n,!1)}},Qv=cf,Gv=cn;var nk={usingClientEntryPoint:!1,Events:[Ta,Zn,Sc,qv,Vv,cf]},Ua={findFiberByHostInstance:en,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},ok={bundleType:Ua.bundleType,version:Ua.version,rendererPackageName:Ua.rendererPackageName,rendererConfig:Ua.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:R.ReactCurrentDispatcher,findHostInstanceByFiber:function(s){return s=Zv(s),s===null?null:s.stateNode},findFiberByHostInstance:Ua.findFiberByHostInstance||ik,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var nh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nh.isDisabled&&nh.supportsFiber)try{rc=nh.inject(ok),ci=nh}catch{}}return mr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=nk,mr.createPortal=function(s,n){var l=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!mf(n))throw Error(r(200));return rk(s,n,null,l)},mr.createRoot=function(s,n){if(!mf(s))throw Error(r(299));var l=!1,d="",v=Ey;return n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(d=n.identifierPrefix),n.onRecoverableError!==void 0&&(v=n.onRecoverableError)),n=gf(s,1,!1,null,null,l,!1,d,v),s[Mi]=n.current,Pa(s.nodeType===8?s.parentNode:s),new _f(n)},mr.findDOMNode=function(s){if(s==null)return null;if(s.nodeType===1)return s;var n=s._reactInternals;if(n===void 0)throw typeof s.render=="function"?Error(r(188)):(s=Object.keys(s).join(","),Error(r(268,s)));return s=Zv(n),s=s===null?null:s.stateNode,s},mr.flushSync=function(s){return cn(s)},mr.hydrate=function(s,n,l){if(!ih(n))throw Error(r(200));return sh(null,s,n,!0,l)},mr.hydrateRoot=function(s,n,l){if(!mf(s))throw Error(r(405));var d=l!=null&&l.hydratedSources||null,v=!1,m="",b=Ey;if(l!=null&&(l.unstable_strictMode===!0&&(v=!0),l.identifierPrefix!==void 0&&(m=l.identifierPrefix),l.onRecoverableError!==void 0&&(b=l.onRecoverableError)),n=Cy(n,null,s,1,l??null,v,!1,m,b),s[Mi]=n.current,Pa(s),d)for(s=0;s<d.length;s++)l=d[s],v=l._getVersion,v=v(l._source),n.mutableSourceEagerHydrationData==null?n.mutableSourceEagerHydrationData=[l,v]:n.mutableSourceEagerHydrationData.push(l,v);return new rh(n)},mr.render=function(s,n,l){if(!ih(n))throw Error(r(200));return sh(null,s,n,!1,l)},mr.unmountComponentAtNode=function(s){if(!ih(s))throw Error(r(40));return s._reactRootContainer?(cn(function(){sh(null,null,s,!1,function(){s._reactRootContainer=null,s[Mi]=null})}),!0):!1},mr.unstable_batchedUpdates=cf,mr.unstable_renderSubtreeIntoContainer=function(s,n,l,d){if(!ih(l))throw Error(r(200));if(s==null||s._reactInternals===void 0)throw Error(r(38));return sh(s,n,l,!1,d)},mr.version="18.3.1-next-f1338f8080-20240426",mr}var Oy;function Sx(){if(Oy)return bf.exports;Oy=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),bf.exports=gk(),bf.exports}var Fy;function vk(){if(Fy)return ah;Fy=1;var e=Sx();return ah.createRoot=e.createRoot,ah.hydrateRoot=e.hydrateRoot,ah}var _k=vk();const mk=xx(_k);var Zo=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},yk={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Fs,iv,ox,xk=(ox=class{constructor(){be(this,Fs,yk);be(this,iv,!1)}setTimeoutProvider(e){ue(this,Fs,e)}setTimeout(e,t){return j(this,Fs).setTimeout(e,t)}clearTimeout(e){j(this,Fs).clearTimeout(e)}setInterval(e,t){return j(this,Fs).setInterval(e,t)}clearInterval(e){j(this,Fs).clearInterval(e)}},Fs=new WeakMap,iv=new WeakMap,ox),bn=new xk;function Sk(e){setTimeout(e,0)}var In=typeof window>"u"||"Deno"in globalThis;function hr(){}function bk(e,t){return typeof e=="function"?e(t):e}function pp(e){return typeof e=="number"&&e>=0&&e!==1/0}function bx(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Gs(e,t){return typeof e=="function"?e(t):e}function Hr(e,t){return typeof e=="function"?e(t):e}function $y(e,t){const{type:r="all",exact:i,fetchStatus:o,predicate:a,queryKey:c,stale:u}=e;if(c){if(i){if(t.queryHash!==nv(c,t.options))return!1}else if(!Tl(t.queryKey,c))return!1}if(r!=="all"){const p=t.isActive();if(r==="active"&&!p||r==="inactive"&&p)return!1}return!(typeof u=="boolean"&&t.isStale()!==u||o&&o!==t.state.fetchStatus||a&&!a(t))}function Ay(e,t){const{exact:r,status:i,predicate:o,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(r){if(On(t.options.mutationKey)!==On(a))return!1}else if(!Tl(t.options.mutationKey,a))return!1}return!(i&&t.state.status!==i||o&&!o(t))}function nv(e,t){return((t==null?void 0:t.queryKeyHashFn)||On)(e)}function On(e){return JSON.stringify(e,(t,r)=>gp(r)?Object.keys(r).sort().reduce((i,o)=>(i[o]=r[o],i),{}):r)}function Tl(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Tl(e[r],t[r])):!1}var wk=Object.prototype.hasOwnProperty;function wx(e,t,r=0){if(e===t)return e;if(r>500)return t;const i=Ny(e)&&Ny(t);if(!i&&!(gp(e)&&gp(t)))return t;const a=(i?e:Object.keys(e)).length,c=i?t:Object.keys(t),u=c.length,p=i?new Array(u):{};let f=0;for(let g=0;g<u;g++){const _=i?g:c[g],y=e[_],x=t[_];if(y===x){p[_]=y,(i?g<a:wk.call(e,_))&&f++;continue}if(y===null||x===null||typeof y!="object"||typeof x!="object"){p[_]=x;continue}const S=wx(y,x,r+1);p[_]=S,S===y&&f++}return a===u&&f===a?e:p}function $h(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function Ny(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function gp(e){if(!zy(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!zy(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function zy(e){return Object.prototype.toString.call(e)==="[object Object]"}function Ck(e){return new Promise(t=>{bn.setTimeout(t,e)})}function vp(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?wx(e,t):t}function kk(e,t,r=0){const i=[...e,t];return r&&i.length>r?i.slice(1):i}function Ek(e,t,r=0){const i=[t,...e];return r&&i.length>r?i.slice(0,-1):i}var ov=Symbol();function Cx(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===ov?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function av(e,t){return typeof e=="function"?e(...t):!!e}function Pk(e,t,r){let i=!1,o;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??(o=t()),i||(i=!0,o.aborted?r():o.addEventListener("abort",r,{once:!0})),o)}),e}var Cn,$s,Do,ax,Rk=(ax=class extends Zo{constructor(){super();be(this,Cn);be(this,$s);be(this,Do);ue(this,Do,t=>{if(!In&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){j(this,$s)||this.setEventListener(j(this,Do))}onUnsubscribe(){var t;this.hasListeners()||((t=j(this,$s))==null||t.call(this),ue(this,$s,void 0))}setEventListener(t){var r;ue(this,Do,t),(r=j(this,$s))==null||r.call(this),ue(this,$s,t(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()}))}setFocused(t){j(this,Cn)!==t&&(ue(this,Cn,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof j(this,Cn)=="boolean"?j(this,Cn):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Cn=new WeakMap,$s=new WeakMap,Do=new WeakMap,ax),lv=new Rk;function _p(){let e,t;const r=new Promise((o,a)=>{e=o,t=a});r.status="pending",r.catch(()=>{});function i(o){Object.assign(r,o),delete r.resolve,delete r.reject}return r.resolve=o=>{i({status:"fulfilled",value:o}),e(o)},r.reject=o=>{i({status:"rejected",reason:o}),t(o)},r}var jk=Sk;function Tk(){let e=[],t=0,r=u=>{u()},i=u=>{u()},o=jk;const a=u=>{t?e.push(u):o(()=>{r(u)})},c=()=>{const u=e;e=[],u.length&&o(()=>{i(()=>{u.forEach(p=>{r(p)})})})};return{batch:u=>{let p;t++;try{p=u()}finally{t--,t||c()}return p},batchCalls:u=>(...p)=>{a(()=>{u(...p)})},schedule:a,setNotifyFunction:u=>{r=u},setBatchNotifyFunction:u=>{i=u},setScheduler:u=>{o=u}}}var jt=Tk(),Bo,As,Io,lx,Lk=(lx=class extends Zo{constructor(){super();be(this,Bo,!0);be(this,As);be(this,Io);ue(this,Io,t=>{if(!In&&window.addEventListener){const r=()=>t(!0),i=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",i)}}})}onSubscribe(){j(this,As)||this.setEventListener(j(this,Io))}onUnsubscribe(){var t;this.hasListeners()||((t=j(this,As))==null||t.call(this),ue(this,As,void 0))}setEventListener(t){var r;ue(this,Io,t),(r=j(this,As))==null||r.call(this),ue(this,As,t(this.setOnline.bind(this)))}setOnline(t){j(this,Bo)!==t&&(ue(this,Bo,t),this.listeners.forEach(i=>{i(t)}))}isOnline(){return j(this,Bo)}},Bo=new WeakMap,As=new WeakMap,Io=new WeakMap,lx),Ah=new Lk;function Mk(e){return Math.min(1e3*2**e,3e4)}function kx(e){return(e??"online")==="online"?Ah.isOnline():!0}var mp=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Ex(e){let t=!1,r=0,i;const o=_p(),a=()=>o.status!=="pending",c=w=>{var C;if(!a()){const E=new mp(w);y(E),(C=e.onCancel)==null||C.call(e,E)}},u=()=>{t=!0},p=()=>{t=!1},f=()=>lv.isFocused()&&(e.networkMode==="always"||Ah.isOnline())&&e.canRun(),g=()=>kx(e.networkMode)&&e.canRun(),_=w=>{a()||(i==null||i(),o.resolve(w))},y=w=>{a()||(i==null||i(),o.reject(w))},x=()=>new Promise(w=>{var C;i=E=>{(a()||f())&&w(E)},(C=e.onPause)==null||C.call(e)}).then(()=>{var w;i=void 0,a()||(w=e.onContinue)==null||w.call(e)}),S=()=>{if(a())return;let w;const C=r===0?e.initialPromise:void 0;try{w=C??e.fn()}catch(E){w=Promise.reject(E)}Promise.resolve(w).then(_).catch(E=>{var F;if(a())return;const I=e.retry??(In?0:3),k=e.retryDelay??Mk,R=typeof k=="function"?k(r,E):k,M=I===!0||typeof I=="number"&&r<I||typeof I=="function"&&I(r,E);if(t||!M){y(E);return}r++,(F=e.onFail)==null||F.call(e,r,E),Ck(R).then(()=>f()?void 0:x()).then(()=>{t?y(E):S()})})};return{promise:o,status:()=>o.status,cancel:c,continue:()=>(i==null||i(),o),cancelRetry:u,continueRetry:p,canStart:g,start:()=>(g()?S():x().then(S),o)}}var kn,cx,Px=(cx=class{constructor(){be(this,kn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),pp(this.gcTime)&&ue(this,kn,bn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(In?1/0:300*1e3))}clearGcTimeout(){j(this,kn)&&(bn.clearTimeout(j(this,kn)),ue(this,kn,void 0))}},kn=new WeakMap,cx),En,Oo,Wr,Pn,It,Wl,Rn,oi,Ui,hx,Dk=(hx=class extends Px{constructor(t){super();be(this,oi);be(this,En);be(this,Oo);be(this,Wr);be(this,Pn);be(this,It);be(this,Wl);be(this,Rn);ue(this,Rn,!1),ue(this,Wl,t.defaultOptions),this.setOptions(t.options),this.observers=[],ue(this,Pn,t.client),ue(this,Wr,j(this,Pn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ue(this,En,Hy(this.options)),this.state=t.state??j(this,En),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=j(this,It))==null?void 0:t.promise}setOptions(t){if(this.options={...j(this,Wl),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Hy(this.options);r.data!==void 0&&(this.setState(Wy(r.data,r.dataUpdatedAt)),ue(this,En,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&j(this,Wr).remove(this)}setData(t,r){const i=vp(this.state.data,t,this.options);return Me(this,oi,Ui).call(this,{data:i,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),i}setState(t,r){Me(this,oi,Ui).call(this,{type:"setState",state:t,setStateOptions:r})}cancel(t){var i,o;const r=(i=j(this,It))==null?void 0:i.promise;return(o=j(this,It))==null||o.cancel(t),r?r.then(hr).catch(hr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(j(this,En))}isActive(){return this.observers.some(t=>Hr(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ov||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Gs(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!bx(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(i=>i.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=j(this,It))==null||r.continue()}onOnline(){var r;const t=this.observers.find(i=>i.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=j(this,It))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),j(this,Wr).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(j(this,It)&&(j(this,Rn)?j(this,It).cancel({revert:!0}):j(this,It).cancelRetry()),this.scheduleGc()),j(this,Wr).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Me(this,oi,Ui).call(this,{type:"invalidate"})}async fetch(t,r){var p,f,g,_,y,x,S,w,C,E,I,k;if(this.state.fetchStatus!=="idle"&&((p=j(this,It))==null?void 0:p.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(j(this,It))return j(this,It).continueRetry(),j(this,It).promise}if(t&&this.setOptions(t),!this.options.queryFn){const R=this.observers.find(M=>M.options.queryFn);R&&this.setOptions(R.options)}const i=new AbortController,o=R=>{Object.defineProperty(R,"signal",{enumerable:!0,get:()=>(ue(this,Rn,!0),i.signal)})},a=()=>{const R=Cx(this.options,r),F=(()=>{const W={client:j(this,Pn),queryKey:this.queryKey,meta:this.meta};return o(W),W})();return ue(this,Rn,!1),this.options.persister?this.options.persister(R,F,this):R(F)},u=(()=>{const R={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:j(this,Pn),state:this.state,fetchFn:a};return o(R),R})();(f=this.options.behavior)==null||f.onFetch(u,this),ue(this,Oo,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((g=u.fetchOptions)==null?void 0:g.meta))&&Me(this,oi,Ui).call(this,{type:"fetch",meta:(_=u.fetchOptions)==null?void 0:_.meta}),ue(this,It,Ex({initialPromise:r==null?void 0:r.initialPromise,fn:u.fetchFn,onCancel:R=>{R instanceof mp&&R.revert&&this.setState({...j(this,Oo),fetchStatus:"idle"}),i.abort()},onFail:(R,M)=>{Me(this,oi,Ui).call(this,{type:"failed",failureCount:R,error:M})},onPause:()=>{Me(this,oi,Ui).call(this,{type:"pause"})},onContinue:()=>{Me(this,oi,Ui).call(this,{type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0}));try{const R=await j(this,It).start();if(R===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(R),(x=(y=j(this,Wr).config).onSuccess)==null||x.call(y,R,this),(w=(S=j(this,Wr).config).onSettled)==null||w.call(S,R,this.state.error,this),R}catch(R){if(R instanceof mp){if(R.silent)return j(this,It).promise;if(R.revert){if(this.state.data===void 0)throw R;return this.state.data}}throw Me(this,oi,Ui).call(this,{type:"error",error:R}),(E=(C=j(this,Wr).config).onError)==null||E.call(C,R,this),(k=(I=j(this,Wr).config).onSettled)==null||k.call(I,this.state.data,R,this),R}finally{this.scheduleGc()}}},En=new WeakMap,Oo=new WeakMap,Wr=new WeakMap,Pn=new WeakMap,It=new WeakMap,Wl=new WeakMap,Rn=new WeakMap,oi=new WeakSet,Ui=function(t){const r=i=>{switch(t.type){case"failed":return{...i,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...Rx(i.data,this.options),fetchMeta:t.meta??null};case"success":const o={...i,...Wy(t.data,t.dataUpdatedAt),dataUpdateCount:i.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ue(this,Oo,t.manual?o:void 0),o;case"error":const a=t.error;return{...i,error:a,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...t.state}}};this.state=r(this.state),jt.batch(()=>{this.observers.forEach(i=>{i.onQueryUpdate()}),j(this,Wr).notify({query:this,type:"updated",action:t})})},hx);function Rx(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:kx(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Wy(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Hy(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,i=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var xr,Ne,Hl,lr,jn,Fo,Qi,Ns,Ul,$o,Ao,Tn,Ln,zs,No,Ue,cl,yp,xp,Sp,bp,wp,Cp,kp,jx,ux,Bk=(ux=class extends Zo{constructor(t,r){super();be(this,Ue);be(this,xr);be(this,Ne);be(this,Hl);be(this,lr);be(this,jn);be(this,Fo);be(this,Qi);be(this,Ns);be(this,Ul);be(this,$o);be(this,Ao);be(this,Tn);be(this,Ln);be(this,zs);be(this,No,new Set);this.options=r,ue(this,xr,t),ue(this,Ns,null),ue(this,Qi,_p()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(j(this,Ne).addObserver(this),Uy(j(this,Ne),this.options)?Me(this,Ue,cl).call(this):this.updateResult(),Me(this,Ue,bp).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ep(j(this,Ne),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ep(j(this,Ne),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Me(this,Ue,wp).call(this),Me(this,Ue,Cp).call(this),j(this,Ne).removeObserver(this)}setOptions(t){const r=this.options,i=j(this,Ne);if(this.options=j(this,xr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Hr(this.options.enabled,j(this,Ne))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Me(this,Ue,kp).call(this),j(this,Ne).setOptions(this.options),r._defaulted&&!$h(this.options,r)&&j(this,xr).getQueryCache().notify({type:"observerOptionsUpdated",query:j(this,Ne),observer:this});const o=this.hasListeners();o&&Ky(j(this,Ne),i,this.options,r)&&Me(this,Ue,cl).call(this),this.updateResult(),o&&(j(this,Ne)!==i||Hr(this.options.enabled,j(this,Ne))!==Hr(r.enabled,j(this,Ne))||Gs(this.options.staleTime,j(this,Ne))!==Gs(r.staleTime,j(this,Ne)))&&Me(this,Ue,yp).call(this);const a=Me(this,Ue,xp).call(this);o&&(j(this,Ne)!==i||Hr(this.options.enabled,j(this,Ne))!==Hr(r.enabled,j(this,Ne))||a!==j(this,zs))&&Me(this,Ue,Sp).call(this,a)}getOptimisticResult(t){const r=j(this,xr).getQueryCache().build(j(this,xr),t),i=this.createResult(r,t);return Ok(this,i)&&(ue(this,lr,i),ue(this,Fo,this.options),ue(this,jn,j(this,Ne).state)),i}getCurrentResult(){return j(this,lr)}trackResult(t,r){return new Proxy(t,{get:(i,o)=>(this.trackProp(o),r==null||r(o),o==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&j(this,Qi).status==="pending"&&j(this,Qi).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(i,o))})}trackProp(t){j(this,No).add(t)}getCurrentQuery(){return j(this,Ne)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=j(this,xr).defaultQueryOptions(t),i=j(this,xr).getQueryCache().build(j(this,xr),r);return i.fetch().then(()=>this.createResult(i,r))}fetch(t){return Me(this,Ue,cl).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),j(this,lr)))}createResult(t,r){var K;const i=j(this,Ne),o=this.options,a=j(this,lr),c=j(this,jn),u=j(this,Fo),f=t!==i?t.state:j(this,Hl),{state:g}=t;let _={...g},y=!1,x;if(r._optimisticResults){const ie=this.hasListeners(),oe=!ie&&Uy(t,r),Q=ie&&Ky(t,i,r,o);(oe||Q)&&(_={..._,...Rx(g.data,t.options)}),r._optimisticResults==="isRestoring"&&(_.fetchStatus="idle")}let{error:S,errorUpdatedAt:w,status:C}=_;x=_.data;let E=!1;if(r.placeholderData!==void 0&&x===void 0&&C==="pending"){let ie;a!=null&&a.isPlaceholderData&&r.placeholderData===(u==null?void 0:u.placeholderData)?(ie=a.data,E=!0):ie=typeof r.placeholderData=="function"?r.placeholderData((K=j(this,Ao))==null?void 0:K.state.data,j(this,Ao)):r.placeholderData,ie!==void 0&&(C="success",x=vp(a==null?void 0:a.data,ie,r),y=!0)}if(r.select&&x!==void 0&&!E)if(a&&x===(c==null?void 0:c.data)&&r.select===j(this,Ul))x=j(this,$o);else try{ue(this,Ul,r.select),x=r.select(x),x=vp(a==null?void 0:a.data,x,r),ue(this,$o,x),ue(this,Ns,null)}catch(ie){ue(this,Ns,ie)}j(this,Ns)&&(S=j(this,Ns),x=j(this,$o),w=Date.now(),C="error");const I=_.fetchStatus==="fetching",k=C==="pending",R=C==="error",M=k&&I,F=x!==void 0,H={status:C,fetchStatus:_.fetchStatus,isPending:k,isSuccess:C==="success",isError:R,isInitialLoading:M,isLoading:M,data:x,dataUpdatedAt:_.dataUpdatedAt,error:S,errorUpdatedAt:w,failureCount:_.fetchFailureCount,failureReason:_.fetchFailureReason,errorUpdateCount:_.errorUpdateCount,isFetched:_.dataUpdateCount>0||_.errorUpdateCount>0,isFetchedAfterMount:_.dataUpdateCount>f.dataUpdateCount||_.errorUpdateCount>f.errorUpdateCount,isFetching:I,isRefetching:I&&!k,isLoadingError:R&&!F,isPaused:_.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:R&&F,isStale:cv(t,r),refetch:this.refetch,promise:j(this,Qi),isEnabled:Hr(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const ie=H.data!==void 0,oe=H.status==="error"&&!ie,Q=Y=>{oe?Y.reject(H.error):ie&&Y.resolve(H.data)},N=()=>{const Y=ue(this,Qi,H.promise=_p());Q(Y)},q=j(this,Qi);switch(q.status){case"pending":t.queryHash===i.queryHash&&Q(q);break;case"fulfilled":(oe||H.data!==q.value)&&N();break;case"rejected":(!oe||H.error!==q.reason)&&N();break}}return H}updateResult(){const t=j(this,lr),r=this.createResult(j(this,Ne),this.options);if(ue(this,jn,j(this,Ne).state),ue(this,Fo,this.options),j(this,jn).data!==void 0&&ue(this,Ao,j(this,Ne)),$h(r,t))return;ue(this,lr,r);const i=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,a=typeof o=="function"?o():o;if(a==="all"||!a&&!j(this,No).size)return!0;const c=new Set(a??j(this,No));return this.options.throwOnError&&c.add("error"),Object.keys(j(this,lr)).some(u=>{const p=u;return j(this,lr)[p]!==t[p]&&c.has(p)})};Me(this,Ue,jx).call(this,{listeners:i()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Me(this,Ue,bp).call(this)}},xr=new WeakMap,Ne=new WeakMap,Hl=new WeakMap,lr=new WeakMap,jn=new WeakMap,Fo=new WeakMap,Qi=new WeakMap,Ns=new WeakMap,Ul=new WeakMap,$o=new WeakMap,Ao=new WeakMap,Tn=new WeakMap,Ln=new WeakMap,zs=new WeakMap,No=new WeakMap,Ue=new WeakSet,cl=function(t){Me(this,Ue,kp).call(this);let r=j(this,Ne).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(hr)),r},yp=function(){Me(this,Ue,wp).call(this);const t=Gs(this.options.staleTime,j(this,Ne));if(In||j(this,lr).isStale||!pp(t))return;const i=bx(j(this,lr).dataUpdatedAt,t)+1;ue(this,Tn,bn.setTimeout(()=>{j(this,lr).isStale||this.updateResult()},i))},xp=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(j(this,Ne)):this.options.refetchInterval)??!1},Sp=function(t){Me(this,Ue,Cp).call(this),ue(this,zs,t),!(In||Hr(this.options.enabled,j(this,Ne))===!1||!pp(j(this,zs))||j(this,zs)===0)&&ue(this,Ln,bn.setInterval(()=>{(this.options.refetchIntervalInBackground||lv.isFocused())&&Me(this,Ue,cl).call(this)},j(this,zs)))},bp=function(){Me(this,Ue,yp).call(this),Me(this,Ue,Sp).call(this,Me(this,Ue,xp).call(this))},wp=function(){j(this,Tn)&&(bn.clearTimeout(j(this,Tn)),ue(this,Tn,void 0))},Cp=function(){j(this,Ln)&&(bn.clearInterval(j(this,Ln)),ue(this,Ln,void 0))},kp=function(){const t=j(this,xr).getQueryCache().build(j(this,xr),this.options);if(t===j(this,Ne))return;const r=j(this,Ne);ue(this,Ne,t),ue(this,Hl,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},jx=function(t){jt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(j(this,lr))}),j(this,xr).getQueryCache().notify({query:j(this,Ne),type:"observerResultsUpdated"})})},ux);function Ik(e,t){return Hr(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Uy(e,t){return Ik(e,t)||e.state.data!==void 0&&Ep(e,t,t.refetchOnMount)}function Ep(e,t,r){if(Hr(t.enabled,e)!==!1&&Gs(t.staleTime,e)!=="static"){const i=typeof r=="function"?r(e):r;return i==="always"||i!==!1&&cv(e,t)}return!1}function Ky(e,t,r,i){return(e!==t||Hr(i.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&cv(e,r)}function cv(e,t){return Hr(t.enabled,e)!==!1&&e.isStaleByTime(Gs(t.staleTime,e))}function Ok(e,t){return!$h(e.getCurrentResult(),t)}function qy(e){return{onFetch:(t,r)=>{var g,_,y,x,S;const i=t.options,o=(y=(_=(g=t.fetchOptions)==null?void 0:g.meta)==null?void 0:_.fetchMore)==null?void 0:y.direction,a=((x=t.state.data)==null?void 0:x.pages)||[],c=((S=t.state.data)==null?void 0:S.pageParams)||[];let u={pages:[],pageParams:[]},p=0;const f=async()=>{let w=!1;const C=k=>{Pk(k,()=>t.signal,()=>w=!0)},E=Cx(t.options,t.fetchOptions),I=async(k,R,M)=>{if(w)return Promise.reject();if(R==null&&k.pages.length)return Promise.resolve(k);const W=(()=>{const oe={client:t.client,queryKey:t.queryKey,pageParam:R,direction:M?"backward":"forward",meta:t.options.meta};return C(oe),oe})(),H=await E(W),{maxPages:K}=t.options,ie=M?Ek:kk;return{pages:ie(k.pages,H,K),pageParams:ie(k.pageParams,R,K)}};if(o&&a.length){const k=o==="backward",R=k?Fk:Vy,M={pages:a,pageParams:c},F=R(i,M);u=await I(M,F,k)}else{const k=e??a.length;do{const R=p===0?c[0]??i.initialPageParam:Vy(i,u);if(p>0&&R==null)break;u=await I(u,R),p++}while(p<k)}return u};t.options.persister?t.fetchFn=()=>{var w,C;return(C=(w=t.options).persister)==null?void 0:C.call(w,f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=f}}}function Vy(e,{pages:t,pageParams:r}){const i=t.length-1;return t.length>0?e.getNextPageParam(t[i],t,r[i],r):void 0}function Fk(e,{pages:t,pageParams:r}){var i;return t.length>0?(i=e.getPreviousPageParam)==null?void 0:i.call(e,t[0],t,r[0],r):void 0}var Kl,_i,Zt,Mn,mi,Ds,dx,$k=(dx=class extends Px{constructor(t){super();be(this,mi);be(this,Kl);be(this,_i);be(this,Zt);be(this,Mn);ue(this,Kl,t.client),this.mutationId=t.mutationId,ue(this,Zt,t.mutationCache),ue(this,_i,[]),this.state=t.state||Tx(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){j(this,_i).includes(t)||(j(this,_i).push(t),this.clearGcTimeout(),j(this,Zt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ue(this,_i,j(this,_i).filter(r=>r!==t)),this.scheduleGc(),j(this,Zt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){j(this,_i).length||(this.state.status==="pending"?this.scheduleGc():j(this,Zt).remove(this))}continue(){var t;return((t=j(this,Mn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var c,u,p,f,g,_,y,x,S,w,C,E,I,k,R,M,F,W;const r=()=>{Me(this,mi,Ds).call(this,{type:"continue"})},i={client:j(this,Kl),meta:this.options.meta,mutationKey:this.options.mutationKey};ue(this,Mn,Ex({fn:()=>this.options.mutationFn?this.options.mutationFn(t,i):Promise.reject(new Error("No mutationFn found")),onFail:(H,K)=>{Me(this,mi,Ds).call(this,{type:"failed",failureCount:H,error:K})},onPause:()=>{Me(this,mi,Ds).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>j(this,Zt).canRun(this)}));const o=this.state.status==="pending",a=!j(this,Mn).canStart();try{if(o)r();else{Me(this,mi,Ds).call(this,{type:"pending",variables:t,isPaused:a}),j(this,Zt).config.onMutate&&await j(this,Zt).config.onMutate(t,this,i);const K=await((u=(c=this.options).onMutate)==null?void 0:u.call(c,t,i));K!==this.state.context&&Me(this,mi,Ds).call(this,{type:"pending",context:K,variables:t,isPaused:a})}const H=await j(this,Mn).start();return await((f=(p=j(this,Zt).config).onSuccess)==null?void 0:f.call(p,H,t,this.state.context,this,i)),await((_=(g=this.options).onSuccess)==null?void 0:_.call(g,H,t,this.state.context,i)),await((x=(y=j(this,Zt).config).onSettled)==null?void 0:x.call(y,H,null,this.state.variables,this.state.context,this,i)),await((w=(S=this.options).onSettled)==null?void 0:w.call(S,H,null,t,this.state.context,i)),Me(this,mi,Ds).call(this,{type:"success",data:H}),H}catch(H){try{await((E=(C=j(this,Zt).config).onError)==null?void 0:E.call(C,H,t,this.state.context,this,i))}catch(K){Promise.reject(K)}try{await((k=(I=this.options).onError)==null?void 0:k.call(I,H,t,this.state.context,i))}catch(K){Promise.reject(K)}try{await((M=(R=j(this,Zt).config).onSettled)==null?void 0:M.call(R,void 0,H,this.state.variables,this.state.context,this,i))}catch(K){Promise.reject(K)}try{await((W=(F=this.options).onSettled)==null?void 0:W.call(F,void 0,H,t,this.state.context,i))}catch(K){Promise.reject(K)}throw Me(this,mi,Ds).call(this,{type:"error",error:H}),H}finally{j(this,Zt).runNext(this)}}},Kl=new WeakMap,_i=new WeakMap,Zt=new WeakMap,Mn=new WeakMap,mi=new WeakSet,Ds=function(t){const r=i=>{switch(t.type){case"failed":return{...i,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...i,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:t.error,failureCount:i.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),jt.batch(()=>{j(this,_i).forEach(i=>{i.onMutationUpdate(t)}),j(this,Zt).notify({mutation:this,type:"updated",action:t})})},dx);function Tx(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Gi,ai,ql,fx,Ak=(fx=class extends Zo{constructor(t={}){super();be(this,Gi);be(this,ai);be(this,ql);this.config=t,ue(this,Gi,new Set),ue(this,ai,new Map),ue(this,ql,0)}build(t,r,i){const o=new $k({client:t,mutationCache:this,mutationId:++oh(this,ql)._,options:t.defaultMutationOptions(r),state:i});return this.add(o),o}add(t){j(this,Gi).add(t);const r=lh(t);if(typeof r=="string"){const i=j(this,ai).get(r);i?i.push(t):j(this,ai).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(j(this,Gi).delete(t)){const r=lh(t);if(typeof r=="string"){const i=j(this,ai).get(r);if(i)if(i.length>1){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}else i[0]===t&&j(this,ai).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=lh(t);if(typeof r=="string"){const i=j(this,ai).get(r),o=i==null?void 0:i.find(a=>a.state.status==="pending");return!o||o===t}else return!0}runNext(t){var i;const r=lh(t);if(typeof r=="string"){const o=(i=j(this,ai).get(r))==null?void 0:i.find(a=>a!==t&&a.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){jt.batch(()=>{j(this,Gi).forEach(t=>{this.notify({type:"removed",mutation:t})}),j(this,Gi).clear(),j(this,ai).clear()})}getAll(){return Array.from(j(this,Gi))}find(t){const r={exact:!0,...t};return this.getAll().find(i=>Ay(r,i))}findAll(t={}){return this.getAll().filter(r=>Ay(t,r))}notify(t){jt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return jt.batch(()=>Promise.all(t.map(r=>r.continue().catch(hr))))}},Gi=new WeakMap,ai=new WeakMap,ql=new WeakMap,fx);function lh(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Yi,Ws,Sr,Xi,ts,kh,Pp,px,Nk=(px=class extends Zo{constructor(r,i){super();be(this,ts);be(this,Yi);be(this,Ws);be(this,Sr);be(this,Xi);ue(this,Yi,r),this.setOptions(i),this.bindMethods(),Me(this,ts,kh).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var o;const i=this.options;this.options=j(this,Yi).defaultMutationOptions(r),$h(this.options,i)||j(this,Yi).getMutationCache().notify({type:"observerOptionsUpdated",mutation:j(this,Sr),observer:this}),i!=null&&i.mutationKey&&this.options.mutationKey&&On(i.mutationKey)!==On(this.options.mutationKey)?this.reset():((o=j(this,Sr))==null?void 0:o.state.status)==="pending"&&j(this,Sr).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=j(this,Sr))==null||r.removeObserver(this)}onMutationUpdate(r){Me(this,ts,kh).call(this),Me(this,ts,Pp).call(this,r)}getCurrentResult(){return j(this,Ws)}reset(){var r;(r=j(this,Sr))==null||r.removeObserver(this),ue(this,Sr,void 0),Me(this,ts,kh).call(this),Me(this,ts,Pp).call(this)}mutate(r,i){var o;return ue(this,Xi,i),(o=j(this,Sr))==null||o.removeObserver(this),ue(this,Sr,j(this,Yi).getMutationCache().build(j(this,Yi),this.options)),j(this,Sr).addObserver(this),j(this,Sr).execute(r)}},Yi=new WeakMap,Ws=new WeakMap,Sr=new WeakMap,Xi=new WeakMap,ts=new WeakSet,kh=function(){var i;const r=((i=j(this,Sr))==null?void 0:i.state)??Tx();ue(this,Ws,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},Pp=function(r){jt.batch(()=>{var i,o,a,c,u,p,f,g;if(j(this,Xi)&&this.hasListeners()){const _=j(this,Ws).variables,y=j(this,Ws).context,x={client:j(this,Yi),meta:this.options.meta,mutationKey:this.options.mutationKey};if((r==null?void 0:r.type)==="success"){try{(o=(i=j(this,Xi)).onSuccess)==null||o.call(i,r.data,_,y,x)}catch(S){Promise.reject(S)}try{(c=(a=j(this,Xi)).onSettled)==null||c.call(a,r.data,null,_,y,x)}catch(S){Promise.reject(S)}}else if((r==null?void 0:r.type)==="error"){try{(p=(u=j(this,Xi)).onError)==null||p.call(u,r.error,_,y,x)}catch(S){Promise.reject(S)}try{(g=(f=j(this,Xi)).onSettled)==null||g.call(f,void 0,r.error,_,y,x)}catch(S){Promise.reject(S)}}}this.listeners.forEach(_=>{_(j(this,Ws))})})},px),yi,gx,zk=(gx=class extends Zo{constructor(t={}){super();be(this,yi);this.config=t,ue(this,yi,new Map)}build(t,r,i){const o=r.queryKey,a=r.queryHash??nv(o,r);let c=this.get(a);return c||(c=new Dk({client:t,queryKey:o,queryHash:a,options:t.defaultQueryOptions(r),state:i,defaultOptions:t.getQueryDefaults(o)}),this.add(c)),c}add(t){j(this,yi).has(t.queryHash)||(j(this,yi).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=j(this,yi).get(t.queryHash);r&&(t.destroy(),r===t&&j(this,yi).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){jt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return j(this,yi).get(t)}getAll(){return[...j(this,yi).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(i=>$y(r,i))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(i=>$y(t,i)):r}notify(t){jt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){jt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){jt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},yi=new WeakMap,gx),dt,Hs,Us,zo,Wo,Ks,Ho,Uo,vx,Wk=(vx=class{constructor(e={}){be(this,dt);be(this,Hs);be(this,Us);be(this,zo);be(this,Wo);be(this,Ks);be(this,Ho);be(this,Uo);ue(this,dt,e.queryCache||new zk),ue(this,Hs,e.mutationCache||new Ak),ue(this,Us,e.defaultOptions||{}),ue(this,zo,new Map),ue(this,Wo,new Map),ue(this,Ks,0)}mount(){oh(this,Ks)._++,j(this,Ks)===1&&(ue(this,Ho,lv.subscribe(async e=>{e&&(await this.resumePausedMutations(),j(this,dt).onFocus())})),ue(this,Uo,Ah.subscribe(async e=>{e&&(await this.resumePausedMutations(),j(this,dt).onOnline())})))}unmount(){var e,t;oh(this,Ks)._--,j(this,Ks)===0&&((e=j(this,Ho))==null||e.call(this),ue(this,Ho,void 0),(t=j(this,Uo))==null||t.call(this),ue(this,Uo,void 0))}isFetching(e){return j(this,dt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return j(this,Hs).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=j(this,dt).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=j(this,dt).build(this,t),i=r.state.data;return i===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Gs(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(i))}getQueriesData(e){return j(this,dt).findAll(e).map(({queryKey:t,state:r})=>{const i=r.data;return[t,i]})}setQueryData(e,t,r){const i=this.defaultQueryOptions({queryKey:e}),o=j(this,dt).get(i.queryHash),a=o==null?void 0:o.state.data,c=bk(t,a);if(c!==void 0)return j(this,dt).build(this,i).setData(c,{...r,manual:!0})}setQueriesData(e,t,r){return jt.batch(()=>j(this,dt).findAll(e).map(({queryKey:i})=>[i,this.setQueryData(i,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=j(this,dt).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=j(this,dt);jt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=j(this,dt);return jt.batch(()=>(r.findAll(e).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},i=jt.batch(()=>j(this,dt).findAll(e).map(o=>o.cancel(r)));return Promise.all(i).then(hr).catch(hr)}invalidateQueries(e,t={}){return jt.batch(()=>(j(this,dt).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},i=jt.batch(()=>j(this,dt).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let a=o.fetch(void 0,r);return r.throwOnError||(a=a.catch(hr)),o.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(i).then(hr)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=j(this,dt).build(this,t);return r.isStaleByTime(Gs(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(hr).catch(hr)}fetchInfiniteQuery(e){return e.behavior=qy(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(hr).catch(hr)}ensureInfiniteQueryData(e){return e.behavior=qy(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Ah.isOnline()?j(this,Hs).resumePausedMutations():Promise.resolve()}getQueryCache(){return j(this,dt)}getMutationCache(){return j(this,Hs)}getDefaultOptions(){return j(this,Us)}setDefaultOptions(e){ue(this,Us,e)}setQueryDefaults(e,t){j(this,zo).set(On(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...j(this,zo).values()],r={};return t.forEach(i=>{Tl(e,i.queryKey)&&Object.assign(r,i.defaultOptions)}),r}setMutationDefaults(e,t){j(this,Wo).set(On(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...j(this,Wo).values()],r={};return t.forEach(i=>{Tl(e,i.mutationKey)&&Object.assign(r,i.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...j(this,Us).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=nv(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===ov&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...j(this,Us).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){j(this,dt).clear(),j(this,Hs).clear()}},dt=new WeakMap,Hs=new WeakMap,Us=new WeakMap,zo=new WeakMap,Wo=new WeakMap,Ks=new WeakMap,Ho=new WeakMap,Uo=new WeakMap,vx),Lx=L.createContext(void 0),Gr=e=>{const t=L.useContext(Lx);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Hk=({client:e,children:t})=>(L.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),h.jsx(Lx.Provider,{value:e,children:t})),Mx=L.createContext(!1),Uk=()=>L.useContext(Mx);Mx.Provider;function Kk(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var qk=L.createContext(Kk()),Vk=()=>L.useContext(qk),Qk=(e,t,r)=>{const i=r!=null&&r.state.error&&typeof e.throwOnError=="function"?av(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||i)&&(t.isReset()||(e.retryOnMount=!1))},Gk=e=>{L.useEffect(()=>{e.clearReset()},[e])},Yk=({result:e,errorResetBoundary:t,throwOnError:r,query:i,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&i&&(o&&e.data===void 0||av(r,[e.error,i])),Xk=e=>{if(e.suspense){const r=o=>o==="static"?o:Math.max(o??1e3,1e3),i=e.staleTime;e.staleTime=typeof i=="function"?(...o)=>r(i(...o)):r(i),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Jk=(e,t)=>e.isLoading&&e.isFetching&&!t,Zk=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Qy=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function e2(e,t,r){var y,x,S,w;const i=Uk(),o=Vk(),a=Gr(),c=a.defaultQueryOptions(e);(x=(y=a.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||x.call(y,c);const u=a.getQueryCache().get(c.queryHash);c._optimisticResults=i?"isRestoring":"optimistic",Xk(c),Qk(c,o,u),Gk(o);const p=!a.getQueryCache().get(c.queryHash),[f]=L.useState(()=>new t(a,c)),g=f.getOptimisticResult(c),_=!i&&e.subscribed!==!1;if(L.useSyncExternalStore(L.useCallback(C=>{const E=_?f.subscribe(jt.batchCalls(C)):hr;return f.updateResult(),E},[f,_]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),L.useEffect(()=>{f.setOptions(c)},[c,f]),Zk(c,g))throw Qy(c,f,o);if(Yk({result:g,errorResetBoundary:o,throwOnError:c.throwOnError,query:u,suspense:c.suspense}))throw g.error;if((w=(S=a.getDefaultOptions().queries)==null?void 0:S._experimental_afterQuery)==null||w.call(S,c,g),c.experimental_prefetchInRender&&!In&&Jk(g,i)){const C=p?Qy(c,f,o):u==null?void 0:u.promise;C==null||C.catch(hr).finally(()=>{f.updateResult()})}return c.notifyOnChangeProps?g:f.trackResult(g)}function Nt(e,t){return e2(e,Bk)}function er(e,t){const r=Gr(),[i]=L.useState(()=>new Nk(r,e));L.useEffect(()=>{i.setOptions(e)},[i,e]);const o=L.useSyncExternalStore(L.useCallback(c=>i.subscribe(jt.batchCalls(c)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),a=L.useCallback((c,u)=>{i.mutate(c,u).catch(hr)},[i]);if(o.error&&av(i.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:a,mutateAsync:o.mutate}}Sx();/**- * @remix-run/router v1.23.2- *- * Copyright (c) Remix Software Inc.- *- * This source code is licensed under the MIT license found in the- * LICENSE.md file in the root directory of this source tree.- *- * @license MIT- */function Ll(){return Ll=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},Ll.apply(this,arguments)}var qs;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(qs||(qs={}));const Gy="popstate";function t2(e){e===void 0&&(e={});function t(i,o){let{pathname:a,search:c,hash:u}=i.location;return Rp("",{pathname:a,search:c,hash:u},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function r(i,o){return typeof o=="string"?o:Nh(o)}return i2(t,r,null,e)}function ht(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function hv(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function r2(){return Math.random().toString(36).substr(2,8)}function Yy(e,t){return{usr:e.state,key:e.key,idx:t}}function Rp(e,t,r,i){return r===void 0&&(r=null),Ll({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?ea(t):t,{state:r,key:t&&t.key||i||r2()})}function Nh(e){let{pathname:t="/",search:r="",hash:i=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),i&&i!=="#"&&(t+=i.charAt(0)==="#"?i:"#"+i),t}function ea(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let i=e.indexOf("?");i>=0&&(t.search=e.substr(i),e=e.substr(0,i)),e&&(t.pathname=e)}return t}function i2(e,t,r,i){i===void 0&&(i={});let{window:o=document.defaultView,v5Compat:a=!1}=i,c=o.history,u=qs.Pop,p=null,f=g();f==null&&(f=0,c.replaceState(Ll({},c.state,{idx:f}),""));function g(){return(c.state||{idx:null}).idx}function _(){u=qs.Pop;let C=g(),E=C==null?null:C-f;f=C,p&&p({action:u,location:w.location,delta:E})}function y(C,E){u=qs.Push;let I=Rp(w.location,C,E);f=g()+1;let k=Yy(I,f),R=w.createHref(I);try{c.pushState(k,"",R)}catch(M){if(M instanceof DOMException&&M.name==="DataCloneError")throw M;o.location.assign(R)}a&&p&&p({action:u,location:w.location,delta:1})}function x(C,E){u=qs.Replace;let I=Rp(w.location,C,E);f=g();let k=Yy(I,f),R=w.createHref(I);c.replaceState(k,"",R),a&&p&&p({action:u,location:w.location,delta:0})}function S(C){let E=o.location.origin!=="null"?o.location.origin:o.location.href,I=typeof C=="string"?C:Nh(C);return I=I.replace(/ $/,"%20"),ht(E,"No window.location.(origin|href) available to create URL for href: "+I),new URL(I,E)}let w={get action(){return u},get location(){return e(o,c)},listen(C){if(p)throw new Error("A history only accepts one active listener");return o.addEventListener(Gy,_),p=C,()=>{o.removeEventListener(Gy,_),p=null}},createHref(C){return t(o,C)},createURL:S,encodeLocation(C){let E=S(C);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:y,replace:x,go(C){return c.go(C)}};return w}var Xy;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Xy||(Xy={}));function s2(e,t,r){return r===void 0&&(r="/"),n2(e,t,r)}function n2(e,t,r,i){let o=typeof t=="string"?ea(t):t,a=Ko(o.pathname||"/",r);if(a==null)return null;let c=Dx(e);o2(c);let u=null;for(let p=0;u==null&&p<c.length;++p){let f=_2(a);u=g2(c[p],f)}return u}function Dx(e,t,r,i){t===void 0&&(t=[]),r===void 0&&(r=[]),i===void 0&&(i="");let o=(a,c,u)=>{let p={relativePath:u===void 0?a.path||"":u,caseSensitive:a.caseSensitive===!0,childrenIndex:c,route:a};p.relativePath.startsWith("/")&&(ht(p.relativePath.startsWith(i),'Absolute route path "'+p.relativePath+'" nested under path '+('"'+i+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),p.relativePath=p.relativePath.slice(i.length));let f=Ys([i,p.relativePath]),g=r.concat(p);a.children&&a.children.length>0&&(ht(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+f+'".')),Dx(a.children,t,g,f)),!(a.path==null&&!a.index)&&t.push({path:f,score:f2(f,a.index),routesMeta:g})};return e.forEach((a,c)=>{var u;if(a.path===""||!((u=a.path)!=null&&u.includes("?")))o(a,c);else for(let p of Bx(a.path))o(a,c,p)}),t}function Bx(e){let t=e.split("/");if(t.length===0)return[];let[r,...i]=t,o=r.endsWith("?"),a=r.replace(/\?$/,"");if(i.length===0)return o?[a,""]:[a];let c=Bx(i.join("/")),u=[];return u.push(...c.map(p=>p===""?a:[a,p].join("/"))),o&&u.push(...c),u.map(p=>e.startsWith("/")&&p===""?"/":p)}function o2(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:p2(t.routesMeta.map(i=>i.childrenIndex),r.routesMeta.map(i=>i.childrenIndex)))}const a2=/^:[\w-]+$/,l2=3,c2=2,h2=1,u2=10,d2=-2,Jy=e=>e==="*";function f2(e,t){let r=e.split("/"),i=r.length;return r.some(Jy)&&(i+=d2),t&&(i+=c2),r.filter(o=>!Jy(o)).reduce((o,a)=>o+(a2.test(a)?l2:a===""?h2:u2),i)}function p2(e,t){return e.length===t.length&&e.slice(0,-1).every((i,o)=>i===t[o])?e[e.length-1]-t[t.length-1]:0}function g2(e,t,r){let{routesMeta:i}=e,o={},a="/",c=[];for(let u=0;u<i.length;++u){let p=i[u],f=u===i.length-1,g=a==="/"?t:t.slice(a.length)||"/",_=jp({path:p.relativePath,caseSensitive:p.caseSensitive,end:f},g),y=p.route;if(!_)return null;Object.assign(o,_.params),c.push({params:o,pathname:Ys([a,_.pathname]),pathnameBase:b2(Ys([a,_.pathnameBase])),route:y}),_.pathnameBase!=="/"&&(a=Ys([a,_.pathnameBase]))}return c}function jp(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,i]=v2(e.path,e.caseSensitive,e.end),o=t.match(r);if(!o)return null;let a=o[0],c=a.replace(/(.)\/+$/,"$1"),u=o.slice(1);return{params:i.reduce((f,g,_)=>{let{paramName:y,isOptional:x}=g;if(y==="*"){let w=u[_]||"";c=a.slice(0,a.length-w.length).replace(/(.)\/+$/,"$1")}const S=u[_];return x&&!S?f[y]=void 0:f[y]=(S||"").replace(/%2F/g,"/"),f},{}),pathname:a,pathnameBase:c,pattern:e}}function v2(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),hv(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let i=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,u,p)=>(i.push({paramName:u,isOptional:p!=null}),p?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(i.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),i]}function _2(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return hv(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Ko(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,i=e.charAt(r);return i&&i!=="/"?null:e.slice(r)||"/"}const m2=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,y2=e=>m2.test(e);function x2(e,t){t===void 0&&(t="/");let{pathname:r,search:i="",hash:o=""}=typeof e=="string"?ea(e):e,a;if(r)if(y2(r))a=r;else{if(r.includes("//")){let c=r;r=r.replace(/\/\/+/g,"/"),hv(!1,"Pathnames cannot have embedded double slashes - normalizing "+(c+" -> "+r))}r.startsWith("/")?a=Zy(r.substring(1),"/"):a=Zy(r,t)}else a=t;return{pathname:a,search:w2(i),hash:C2(o)}}function Zy(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?r.length>1&&r.pop():o!=="."&&r.push(o)}),r.length>1?r.join("/"):"/"}function kf(e,t,r,i){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(i)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function S2(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function uv(e,t){let r=S2(e);return t?r.map((i,o)=>o===r.length-1?i.pathname:i.pathnameBase):r.map(i=>i.pathnameBase)}function dv(e,t,r,i){i===void 0&&(i=!1);let o;typeof e=="string"?o=ea(e):(o=Ll({},e),ht(!o.pathname||!o.pathname.includes("?"),kf("?","pathname","search",o)),ht(!o.pathname||!o.pathname.includes("#"),kf("#","pathname","hash",o)),ht(!o.search||!o.search.includes("#"),kf("#","search","hash",o)));let a=e===""||o.pathname==="",c=a?"/":o.pathname,u;if(c==null)u=r;else{let _=t.length-1;if(!i&&c.startsWith("..")){let y=c.split("/");for(;y[0]==="..";)y.shift(),_-=1;o.pathname=y.join("/")}u=_>=0?t[_]:"/"}let p=x2(o,u),f=c&&c!=="/"&&c.endsWith("/"),g=(a||c===".")&&r.endsWith("/");return!p.pathname.endsWith("/")&&(f||g)&&(p.pathname+="/"),p}const Ys=e=>e.join("/").replace(/\/\/+/g,"/"),b2=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),w2=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,C2=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function k2(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Ix=["post","put","patch","delete"];new Set(Ix);const E2=["get",...Ix];new Set(E2);/**- * React Router v6.30.3- *- * Copyright (c) Remix Software Inc.- *- * This source code is licensed under the MIT license found in the- * LICENSE.md file in the root directory of this source tree.- *- * @license MIT- */function Ml(){return Ml=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},Ml.apply(this,arguments)}const _u=L.createContext(null),Ox=L.createContext(null),rs=L.createContext(null),mu=L.createContext(null),Ri=L.createContext({outlet:null,matches:[],isDataRoute:!1}),Fx=L.createContext(null);function P2(e,t){let{relative:r}=t===void 0?{}:t;ta()||ht(!1);let{basename:i,navigator:o}=L.useContext(rs),{hash:a,pathname:c,search:u}=yu(e,{relative:r}),p=c;return i!=="/"&&(p=c==="/"?i:Ys([i,c])),o.createHref({pathname:p,search:u,hash:a})}function ta(){return L.useContext(mu)!=null}function ra(){return ta()||ht(!1),L.useContext(mu).location}function $x(e){L.useContext(rs).static||L.useLayoutEffect(e)}function ji(){let{isDataRoute:e}=L.useContext(Ri);return e?W2():R2()}function R2(){ta()||ht(!1);let e=L.useContext(_u),{basename:t,future:r,navigator:i}=L.useContext(rs),{matches:o}=L.useContext(Ri),{pathname:a}=ra(),c=JSON.stringify(uv(o,r.v7_relativeSplatPath)),u=L.useRef(!1);return $x(()=>{u.current=!0}),L.useCallback(function(f,g){if(g===void 0&&(g={}),!u.current)return;if(typeof f=="number"){i.go(f);return}let _=dv(f,JSON.parse(c),a,g.relative==="path");e==null&&t!=="/"&&(_.pathname=_.pathname==="/"?t:Ys([t,_.pathname])),(g.replace?i.replace:i.push)(_,g.state,g)},[t,i,c,a,e])}const j2=L.createContext(null);function T2(e){let t=L.useContext(Ri).outlet;return t&&L.createElement(j2.Provider,{value:e},t)}function Ax(){let{matches:e}=L.useContext(Ri),t=e[e.length-1];return t?t.params:{}}function yu(e,t){let{relative:r}=t===void 0?{}:t,{future:i}=L.useContext(rs),{matches:o}=L.useContext(Ri),{pathname:a}=ra(),c=JSON.stringify(uv(o,i.v7_relativeSplatPath));return L.useMemo(()=>dv(e,JSON.parse(c),a,r==="path"),[e,c,a,r])}function L2(e,t){return M2(e,t)}function M2(e,t,r,i){ta()||ht(!1);let{navigator:o}=L.useContext(rs),{matches:a}=L.useContext(Ri),c=a[a.length-1],u=c?c.params:{};c&&c.pathname;let p=c?c.pathnameBase:"/";c&&c.route;let f=ra(),g;if(t){var _;let C=typeof t=="string"?ea(t):t;p==="/"||(_=C.pathname)!=null&&_.startsWith(p)||ht(!1),g=C}else g=f;let y=g.pathname||"/",x=y;if(p!=="/"){let C=p.replace(/^\//,"").split("/");x="/"+y.replace(/^\//,"").split("/").slice(C.length).join("/")}let S=s2(e,{pathname:x}),w=F2(S&&S.map(C=>Object.assign({},C,{params:Object.assign({},u,C.params),pathname:Ys([p,o.encodeLocation?o.encodeLocation(C.pathname).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?p:Ys([p,o.encodeLocation?o.encodeLocation(C.pathnameBase).pathname:C.pathnameBase])})),a,r,i);return t&&w?L.createElement(mu.Provider,{value:{location:Ml({pathname:"/",search:"",hash:"",state:null,key:"default"},g),navigationType:qs.Pop}},w):w}function D2(){let e=z2(),t=k2(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return L.createElement(L.Fragment,null,L.createElement("h2",null,"Unexpected Application Error!"),L.createElement("h3",{style:{fontStyle:"italic"}},t),r?L.createElement("pre",{style:o},r):null,null)}const B2=L.createElement(D2,null);class I2 extends L.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?L.createElement(Ri.Provider,{value:this.props.routeContext},L.createElement(Fx.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function O2(e){let{routeContext:t,match:r,children:i}=e,o=L.useContext(_u);return o&&o.static&&o.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=r.route.id),L.createElement(Ri.Provider,{value:t},i)}function F2(e,t,r,i){var o;if(t===void 0&&(t=[]),r===void 0&&(r=null),i===void 0&&(i=null),e==null){var a;if(!r)return null;if(r.errors)e=r.matches;else if((a=i)!=null&&a.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let c=e,u=(o=r)==null?void 0:o.errors;if(u!=null){let g=c.findIndex(_=>_.route.id&&(u==null?void 0:u[_.route.id])!==void 0);g>=0||ht(!1),c=c.slice(0,Math.min(c.length,g+1))}let p=!1,f=-1;if(r&&i&&i.v7_partialHydration)for(let g=0;g<c.length;g++){let _=c[g];if((_.route.HydrateFallback||_.route.hydrateFallbackElement)&&(f=g),_.route.id){let{loaderData:y,errors:x}=r,S=_.route.loader&&y[_.route.id]===void 0&&(!x||x[_.route.id]===void 0);if(_.route.lazy||S){p=!0,f>=0?c=c.slice(0,f+1):c=[c[0]];break}}}return c.reduceRight((g,_,y)=>{let x,S=!1,w=null,C=null;r&&(x=u&&_.route.id?u[_.route.id]:void 0,w=_.route.errorElement||B2,p&&(f<0&&y===0?(H2("route-fallback"),S=!0,C=null):f===y&&(S=!0,C=_.route.hydrateFallbackElement||null)));let E=t.concat(c.slice(0,y+1)),I=()=>{let k;return x?k=w:S?k=C:_.route.Component?k=L.createElement(_.route.Component,null):_.route.element?k=_.route.element:k=g,L.createElement(O2,{match:_,routeContext:{outlet:g,matches:E,isDataRoute:r!=null},children:k})};return r&&(_.route.ErrorBoundary||_.route.errorElement||y===0)?L.createElement(I2,{location:r.location,revalidation:r.revalidation,component:w,error:x,children:I(),routeContext:{outlet:null,matches:E,isDataRoute:!0}}):I()},null)}var Nx=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(Nx||{}),zx=(function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e})(zx||{});function $2(e){let t=L.useContext(_u);return t||ht(!1),t}function A2(e){let t=L.useContext(Ox);return t||ht(!1),t}function N2(e){let t=L.useContext(Ri);return t||ht(!1),t}function Wx(e){let t=N2(),r=t.matches[t.matches.length-1];return r.route.id||ht(!1),r.route.id}function z2(){var e;let t=L.useContext(Fx),r=A2(),i=Wx();return t!==void 0?t:(e=r.errors)==null?void 0:e[i]}function W2(){let{router:e}=$2(Nx.UseNavigateStable),t=Wx(zx.UseNavigateStable),r=L.useRef(!1);return $x(()=>{r.current=!0}),L.useCallback(function(o,a){a===void 0&&(a={}),r.current&&(typeof o=="number"?e.navigate(o):e.navigate(o,Ml({fromRouteId:t},a)))},[e,t])}const e0={};function H2(e,t,r){e0[e]||(e0[e]=!0)}function U2(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Hx(e){let{to:t,replace:r,state:i,relative:o}=e;ta()||ht(!1);let{future:a,static:c}=L.useContext(rs),{matches:u}=L.useContext(Ri),{pathname:p}=ra(),f=ji(),g=dv(t,uv(u,a.v7_relativeSplatPath),p,o==="path"),_=JSON.stringify(g);return L.useEffect(()=>f(JSON.parse(_),{replace:r,state:i,relative:o}),[f,_,o,r,i]),null}function Ux(e){return T2(e.context)}function sr(e){ht(!1)}function K2(e){let{basename:t="/",children:r=null,location:i,navigationType:o=qs.Pop,navigator:a,static:c=!1,future:u}=e;ta()&&ht(!1);let p=t.replace(/^\/*/,"/"),f=L.useMemo(()=>({basename:p,navigator:a,static:c,future:Ml({v7_relativeSplatPath:!1},u)}),[p,u,a,c]);typeof i=="string"&&(i=ea(i));let{pathname:g="/",search:_="",hash:y="",state:x=null,key:S="default"}=i,w=L.useMemo(()=>{let C=Ko(g,p);return C==null?null:{location:{pathname:C,search:_,hash:y,state:x,key:S},navigationType:o}},[p,g,_,y,x,S,o]);return w==null?null:L.createElement(rs.Provider,{value:f},L.createElement(mu.Provider,{children:r,value:w}))}function q2(e){let{children:t,location:r}=e;return L2(Tp(t),r)}new Promise(()=>{});function Tp(e,t){t===void 0&&(t=[]);let r=[];return L.Children.forEach(e,(i,o)=>{if(!L.isValidElement(i))return;let a=[...t,o];if(i.type===L.Fragment){r.push.apply(r,Tp(i.props.children,a));return}i.type!==sr&&ht(!1),!i.props.index||!i.props.children||ht(!1);let c={id:i.props.id||a.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,loader:i.props.loader,action:i.props.action,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(c.children=Tp(i.props.children,a)),r.push(c)}),r}/**- * React Router DOM v6.30.3- *- * Copyright (c) Remix Software Inc.- *- * This source code is licensed under the MIT license found in the- * LICENSE.md file in the root directory of this source tree.- *- * @license MIT- */function zh(){return zh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},zh.apply(this,arguments)}function Kx(e,t){if(e==null)return{};var r={},i=Object.keys(e),o,a;for(a=0;a<i.length;a++)o=i[a],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}function V2(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Q2(e,t){return e.button===0&&(!t||t==="_self")&&!V2(e)}const G2=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Y2=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],X2="6";try{window.__reactRouterVersion=X2}catch{}const J2=L.createContext({isTransitioning:!1}),Z2="startTransition",t0=dk[Z2];function eE(e){let{basename:t,children:r,future:i,window:o}=e,a=L.useRef();a.current==null&&(a.current=t2({window:o,v5Compat:!0}));let c=a.current,[u,p]=L.useState({action:c.action,location:c.location}),{v7_startTransition:f}=i||{},g=L.useCallback(_=>{f&&t0?t0(()=>p(_)):p(_)},[p,f]);return L.useLayoutEffect(()=>c.listen(g),[c,g]),L.useEffect(()=>U2(i),[i]),L.createElement(K2,{basename:t,children:r,location:u.location,navigationType:u.action,navigator:c,future:i})}const tE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",rE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Wh=L.forwardRef(function(t,r){let{onClick:i,relative:o,reloadDocument:a,replace:c,state:u,target:p,to:f,preventScrollReset:g,viewTransition:_}=t,y=Kx(t,G2),{basename:x}=L.useContext(rs),S,w=!1;if(typeof f=="string"&&rE.test(f)&&(S=f,tE))try{let k=new URL(window.location.href),R=f.startsWith("//")?new URL(k.protocol+f):new URL(f),M=Ko(R.pathname,x);R.origin===k.origin&&M!=null?f=M+R.search+R.hash:w=!0}catch{}let C=P2(f,{relative:o}),E=nE(f,{replace:c,state:u,target:p,preventScrollReset:g,relative:o,viewTransition:_});function I(k){i&&i(k),k.defaultPrevented||E(k)}return L.createElement("a",zh({},y,{href:S||C,onClick:w||a?i:I,ref:r,target:p}))}),iE=L.forwardRef(function(t,r){let{"aria-current":i="page",caseSensitive:o=!1,className:a="",end:c=!1,style:u,to:p,viewTransition:f,children:g}=t,_=Kx(t,Y2),y=yu(p,{relative:_.relative}),x=ra(),S=L.useContext(Ox),{navigator:w,basename:C}=L.useContext(rs),E=S!=null&&oE(y)&&f===!0,I=w.encodeLocation?w.encodeLocation(y).pathname:y.pathname,k=x.pathname,R=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;o||(k=k.toLowerCase(),R=R?R.toLowerCase():null,I=I.toLowerCase()),R&&C&&(R=Ko(R,C)||R);const M=I!=="/"&&I.endsWith("/")?I.length-1:I.length;let F=k===I||!c&&k.startsWith(I)&&k.charAt(M)==="/",W=R!=null&&(R===I||!c&&R.startsWith(I)&&R.charAt(I.length)==="/"),H={isActive:F,isPending:W,isTransitioning:E},K=F?i:void 0,ie;typeof a=="function"?ie=a(H):ie=[a,F?"active":null,W?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let oe=typeof u=="function"?u(H):u;return L.createElement(Wh,zh({},_,{"aria-current":K,className:ie,ref:r,style:oe,to:p,viewTransition:f}),typeof g=="function"?g(H):g)});var Lp;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Lp||(Lp={}));var r0;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(r0||(r0={}));function sE(e){let t=L.useContext(_u);return t||ht(!1),t}function nE(e,t){let{target:r,replace:i,state:o,preventScrollReset:a,relative:c,viewTransition:u}=t===void 0?{}:t,p=ji(),f=ra(),g=yu(e,{relative:c});return L.useCallback(_=>{if(Q2(_,r)){_.preventDefault();let y=i!==void 0?i:Nh(f)===Nh(g);p(e,{replace:y,state:o,preventScrollReset:a,relative:c,viewTransition:u})}},[f,p,g,i,o,r,e,a,c,u])}function oE(e,t){t===void 0&&(t={});let r=L.useContext(J2);r==null&&ht(!1);let{basename:i}=sE(Lp.useViewTransitionState),o=yu(e,{relative:t.relative});if(!r.isTransitioning)return!1;let a=Ko(r.currentLocation.pathname,i)||r.currentLocation.pathname,c=Ko(r.nextLocation.pathname,i)||r.nextLocation.pathname;return jp(o.pathname,c)!=null||jp(o.pathname,a)!=null}var U=typeof window<"u"?window:void 0,Tt=typeof globalThis<"u"?globalThis:U;typeof self>"u"&&(Tt.self=Tt),typeof File>"u"&&(Tt.File=function(){});var Tr=Tt==null?void 0:Tt.navigator,ce=Tt==null?void 0:Tt.document,Ut=Tt==null?void 0:Tt.location,Mp=Tt==null?void 0:Tt.fetch,Dp=Tt!=null&&Tt.XMLHttpRequest&&"withCredentials"in new Tt.XMLHttpRequest?Tt.XMLHttpRequest:void 0,i0=Tt==null?void 0:Tt.AbortController,aE=Tt==null?void 0:Tt.CompressionStream,br=Tr==null?void 0:Tr.userAgent,Se=U??{},s0="1.372.8",cr={DEBUG:!1,LIB_VERSION:s0,LIB_NAME:"web",JS_SDK_VERSION:s0};function n0(e,t,r,i,o,a,c){try{var u=e[a](c),p=u.value}catch(f){return void r(f)}u.done?t(p):Promise.resolve(p).then(i,o)}function Ur(e){return function(){var t=this,r=arguments;return new Promise((function(i,o){var a=e.apply(t,r);function c(p){n0(a,i,o,c,u,"next",p)}function u(p){n0(a,i,o,c,u,"throw",p)}c(void 0)}))}}function ne(){return ne=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},ne.apply(null,arguments)}function qx(e,t){if(e==null)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;r[i]=e[i]}return r}function Bp(){return Bp=Ur((function*(e,t,r){t===void 0&&(t=!0);try{var i=new CompressionStream("gzip"),o=i.writable.getWriter(),a=o.write(new TextEncoder().encode(e)).then((()=>o.close())).catch((function(){var p=Ur((function*(f){try{yield o.abort(f)}catch{}throw f}));return function(f){return p.apply(this,arguments)}})()),c=new Response(i.readable).blob(),[u]=yield Promise.all([c,a]);return u}catch(p){if(r!=null&&r.rethrow)throw p;return t&&console.error("Failed to gzip compress data",p),null}})),Bp.apply(this,arguments)}var lE=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],o0=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var r=e.toLowerCase();return lE.concat(t).some((i=>{var o=i.toLowerCase();return r.indexOf(o)!==-1}))},cE=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function Fe(e,t){return e.indexOf(t)!==-1}var xu=function(e){return e.trim()},Ip=function(e){return e.replace(/^\$/,"")},Vx=Object.prototype,Qx=Vx.hasOwnProperty,Su=Vx.toString,We=Array.isArray||function(e){return Su.call(e)==="[object Array]"},Vi=e=>typeof e=="function",yt=e=>e===Object(e)&&!We(e),Eo=e=>{if(yt(e)){for(var t in e)if(Qx.call(e,t))return!1;return!0}return!1},de=e=>e===void 0,ct=e=>Su.call(e)=="[object String]",Eh=e=>ct(e)&&e.trim().length===0,is=e=>e===null,$e=e=>de(e)||is(e),Qr=e=>Su.call(e)=="[object Number]"&&e==e,bo=e=>Qr(e)&&e>0,bi=e=>Su.call(e)==="[object Boolean]",hE=e=>e instanceof FormData,uE=e=>Fe(cE,e);function Gx(e){return e===null||typeof e!="object"}function Hh(e,t){return{}.toString.call(e)==="[object "+t+"]"}function fv(e){return typeof Event<"u"&&(function(t,r){try{return t instanceof r}catch{return!1}})(e,Event)}var dE=[!0,"true",1,"1","yes"],Ef=e=>Fe(dE,e),fE=[!1,"false",0,"0","no"];function wi(e,t,r,i,o){return t>r&&(i.warn("min cannot be greater than max."),t=r),Qr(e)?e>r?(i.warn(" cannot be greater than max: "+r+". Using max value instead."),r):t>e?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(i.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+o),wi(o||r,t,r,i))}let pE=class{constructor(t){this.$t={},this.zt=t.zt,this.Ut=wi(t.bucketSize,0,100,t.Gt),this.Wt=wi(t.refillRate,0,this.Ut,t.Gt),this.Xt=wi(t.refillInterval,0,864e5,t.Gt)}Jt(t,r){var i=Math.floor((r-t.lastAccess)/this.Xt);i>0&&(t.tokens=Math.min(t.tokens+i*this.Wt,this.Ut),t.lastAccess=t.lastAccess+i*this.Xt)}consumeRateLimit(t){var r,i=Date.now(),o=String(t),a=this.$t[o];return a?this.Jt(a,i):this.$t[o]=a={tokens:this.Ut,lastAccess:i},a.tokens===0||(a.tokens--,a.tokens===0&&((r=this.zt)==null||r.call(this,t)),a.tokens===0)}stop(){this.$t={}}};var ch,a0,Pf,Lr="Mobile",Uh="iOS",Zi="Android",qo="Tablet",Yx=Zi+" "+qo,Xx="iPad",Jx="Apple",Zx=Jx+" Watch",bl="Safari",Vo="BlackBerry",eS="Samsung",tS=eS+"Browser",rS=eS+" Internet",Dn="Chrome",gE=Dn+" OS",iS=Dn+" "+Uh,pv="Internet Explorer",sS=pv+" "+Lr,gv="Opera",vE=gv+" Mini",vv="Edge",nS="Microsoft "+vv,To="Firefox",oS=To+" "+Uh,Dl="Nintendo",Bl="PlayStation",Lo="Xbox",aS=Zi+" "+Lr,lS=Lr+" "+bl,hl="Windows",Op=hl+" Phone",l0="Nokia",Fp="Ouya",cS="Generic",_E=cS+" "+Lr.toLowerCase(),hS=cS+" "+qo.toLowerCase(),$p="Konqueror",nr="(\\d+(\\.\\d+)?)",Rf=new RegExp("Version/"+nr),mE=new RegExp(Lo,"i"),yE=new RegExp(Bl+" \\w+","i"),xE=new RegExp(Dl+" \\w+","i"),_v=new RegExp(Vo+"|PlayBook|BB10","i"),SE={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},uS=function(e,t){return t=t||"",Fe(e," OPR/")&&Fe(e,"Mini")?vE:Fe(e," OPR/")?gv:_v.test(e)?Vo:Fe(e,"IE"+Lr)||Fe(e,"WPDesktop")?sS:Fe(e,tS)?rS:Fe(e,vv)||Fe(e,"Edg/")?nS:Fe(e,"FBIOS")?"Facebook "+Lr:Fe(e,"UCWEB")||Fe(e,"UCBrowser")?"UC Browser":Fe(e,"CriOS")?iS:Fe(e,"CrMo")||Fe(e,Dn)?Dn:Fe(e,Zi)&&Fe(e,bl)?aS:Fe(e,"FxiOS")?oS:Fe(e.toLowerCase(),$p.toLowerCase())?$p:((r,i)=>i&&Fe(i,Jx)||(function(o){return Fe(o,bl)&&!Fe(o,Dn)&&!Fe(o,Zi)})(r))(e,t)?Fe(e,Lr)?lS:bl:Fe(e,To)?To:Fe(e,"MSIE")||Fe(e,"Trident/")?pv:Fe(e,"Gecko")?To:""},bE={[sS]:[new RegExp("rv:"+nr)],[nS]:[new RegExp(vv+"?\\/"+nr)],[Dn]:[new RegExp("("+Dn+"|CrMo)\\/"+nr)],[iS]:[new RegExp("CriOS\\/"+nr)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+nr)],[bl]:[Rf],[lS]:[Rf],[gv]:[new RegExp("(Opera|OPR)\\/"+nr)],[To]:[new RegExp(To+"\\/"+nr)],[oS]:[new RegExp("FxiOS\\/"+nr)],[$p]:[new RegExp("Konqueror[:/]?"+nr,"i")],[Vo]:[new RegExp(Vo+" "+nr),Rf],[aS]:[new RegExp("android\\s"+nr,"i")],[rS]:[new RegExp(tS+"\\/"+nr)],[pv]:[new RegExp("(rv:|MSIE )"+nr)],Mozilla:[new RegExp("rv:"+nr)]},wE=function(e,t){var r=uS(e,t),i=bE[r];if(de(i))return null;for(var o=0;i.length>o;o++){var a=e.match(i[o]);if(a)return parseFloat(a[a.length-2])}return null},c0=[[new RegExp(Lo+"; "+Lo+" (.*?)[);]","i"),e=>[Lo,e&&e[1]||""]],[new RegExp(Dl,"i"),[Dl,""]],[new RegExp(Bl,"i"),[Bl,""]],[_v,[Vo,""]],[new RegExp(hl,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Op,""];if(new RegExp(Lr).test(t)&&!/IEMobile\b/.test(t))return[hl+" "+Lr,""];var r=/Windows NT ([0-9.]+)/i.exec(t);if(r&&r[1]){var i=SE[r[1]]||"";return/arm/i.test(t)&&(i="RT"),[hl,i]}return[hl,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[Uh,[e[3],e[4],e[5]||"0"].join(".")]:[Uh,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=de(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Zi+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Zi+")","i"),e=>e&&e[2]?[Zi,[e[2],e[3],e[4]||"0"].join(".")]:[Zi,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[gE,""]],[/Linux|debian/i,["Linux",""]]],h0=function(e){return xE.test(e)?Dl:yE.test(e)?Bl:mE.test(e)?Lo:new RegExp(Fp,"i").test(e)?Fp:new RegExp("("+Op+"|WPDesktop)","i").test(e)?Op:/iPad/.test(e)?Xx:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Zx:_v.test(e)?Vo:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(l0,"i").test(e)?l0:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(Lr).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Zi:Yx:new RegExp("(pda|"+Lr+")","i").test(e)?_E:new RegExp(qo,"i").test(e)&&!new RegExp(qo+" pc","i").test(e)?hS:""},CE=e=>e instanceof Error,dS={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},kE=dS.info;function fS(e){if(bi(e))return{boolValue:e};if(typeof e=="number")return Number.isFinite(e)?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:{stringValue:String(e)};if(typeof e=="string")return{stringValue:e};if(We(e))return{arrayValue:{values:e.map((t=>fS(t)))}};try{return{stringValue:JSON.stringify(e)}}catch{return{stringValue:String(e)}}}function u0(e){var t=[];for(var r in e){var i=e[r];is(i)||de(i)||t.push({key:r,value:fS(i)})}return t}function EE(e){var t=globalThis._posthogChunkIds;if(t){var r=Object.keys(t);return Pf&&r.length===a0||(a0=r.length,Pf=r.reduce(((i,o)=>{ch||(ch={});var a=ch[o];if(a)i[a[0]]=a[1];else for(var c=e(o),u=c.length-1;u>=0;u--){var p=c[u],f=p==null?void 0:p.filename,g=t[o];if(f&&g){i[f]=g,ch[o]=[f,g];break}}return i}),{})),Pf}}class PE{constructor(t,r,i){i===void 0&&(i=[]),this.coercers=t,this.stackParser=r,this.modifiers=i}buildFromUnknown(t,r){r===void 0&&(r={});var i=r&&r.mechanism||{handled:!0,type:"generic"},o=this.buildCoercingContext(i,r,0).apply(t),a=this.buildParsingContext(r),c=this.parseStacktrace(o,a);return{$exception_list:this.convertToExceptionList(c,i),$exception_level:"error"}}modifyFrames(t){var r=this;return Ur((function*(){for(var i of t)i.stacktrace&&i.stacktrace.frames&&We(i.stacktrace.frames)&&(i.stacktrace.frames=yield r.applyModifiers(i.stacktrace.frames));return t}))()}coerceFallback(t){var r;return{type:"Error",value:"Unknown error",stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}}parseStacktrace(t,r){var i,o;return t.cause!=null&&(i=this.parseStacktrace(t.cause,r)),t.stack!=""&&t.stack!=null&&(o=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?r.skipFirstLines:0),r.chunkIdMap)),ne({},t,{cause:i,stack:o})}applyChunkIds(t,r){return t.map((i=>(i.filename&&r&&(i.chunk_id=r[i.filename]),i)))}applyCoercers(t,r){for(var i of this.coercers)if(i.match(t))return i.coerce(t,r);return this.coerceFallback(r)}applyModifiers(t){var r=this;return Ur((function*(){var i=t;for(var o of r.modifiers)i=yield o(i);return i}))()}convertToExceptionList(t,r){var i,o,a,c={type:t.type,value:t.value,mechanism:{type:(i=r.type)!==null&&i!==void 0?i:"generic",handled:(o=r.handled)===null||o===void 0||o,synthetic:(a=t.synthetic)!==null&&a!==void 0&&a}};t.stack&&(c.stacktrace={type:"raw",frames:t.stack});var u=[c];return t.cause!=null&&u.push(...this.convertToExceptionList(t.cause,ne({},r,{handled:!0}))),u}buildParsingContext(t){var r;return{chunkIdMap:EE(this.stackParser),skipFirstLines:(r=t.skipFirstLines)!==null&&r!==void 0?r:1}}buildCoercingContext(t,r,i){i===void 0&&(i=0);var o=(a,c)=>{if(4>=c){var u=this.buildCoercingContext(t,r,c);return this.applyCoercers(a,u)}};return ne({},r,{syntheticException:i==0?r.syntheticException:void 0,mechanism:t,apply:a=>o(a,i),next:a=>o(a,i+1)})}}var Qo="?";function Ap(e,t,r,i,o){var a={platform:e,filename:t,function:r==="<anonymous>"?Qo:r,in_app:!0};return de(i)||(a.lineno=i),de(o)||(a.colno=o),a}var pS=(e,t)=>{var r=e.indexOf("safari-extension")!==-1,i=e.indexOf("safari-web-extension")!==-1;return r||i?[e.indexOf("@")!==-1?e.split("@")[0]:Qo,r?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},RE=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,jE=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,TE=/\((\S*)(?::(\d+))(?::(\d+))\)/,LE=(e,t)=>{var r=RE.exec(e);if(r){var[,i,o,a]=r;return Ap(t,i,Qo,+o,+a)}var c=jE.exec(e);if(c){if(c[2]&&c[2].indexOf("eval")===0){var u=TE.exec(c[2]);u&&(c[2]=u[1],c[3]=u[2],c[4]=u[3])}var[p,f]=pS(c[1]||Qo,c[2]);return Ap(t,f,p,c[3]?+c[3]:void 0,c[4]?+c[4]:void 0)}},ME=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,DE=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,BE=(e,t)=>{var r=ME.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){var i=DE.exec(r[3]);i&&(r[1]=r[1]||"eval",r[3]=i[1],r[4]=i[2],r[5]="")}var o=r[3],a=r[1]||Qo;return[a,o]=pS(a,o),Ap(t,o,a,r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},d0=/\(error: (.*)\)/;let IE=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,r){var i=ct(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var r=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?r+": "+t.message:r}isDOMException(t){return Hh(t,"DOMException")}isDOMError(t){return Hh(t,"DOMError")}},OE=class{match(t){return(r=>r instanceof Error)(t)}coerce(t,r){return{type:this.getType(t),value:this.getMessage(t,r),stack:this.getStack(t),cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,r){var i=t.message;return String(i.error&&typeof i.error.message=="string"?i.error.message:i)}getStack(t){return t.stacktrace||t.stack||void 0}},FE=class{constructor(){}match(t){return Hh(t,"ErrorEvent")&&t.error!=null}coerce(t,r){var i;return r.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:(i=r.syntheticException)==null?void 0:i.stack,synthetic:!0}}};var $E=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;let AE=class{match(t){return typeof t=="string"}coerce(t,r){var i,[o,a]=this.getInfos(t);return{type:o??"Error",value:a??t,stack:(i=r.syntheticException)==null?void 0:i.stack,synthetic:!0}}getInfos(t){var r="Error",i=t,o=t.match($E);return o&&(r=o[1],i=o[2]),[r,i]}};var NE=["fatal","error","warning","log","info","debug"];function gS(e,t){t===void 0&&(t=40);var r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(var i=r.length;i>0;i--){var o=r.slice(0,i).join(", ");if(t>=o.length)return i===r.length?o:o.length>t?o.slice(0,t)+"...":o}return""}let zE=class{match(t){return typeof t=="object"&&t!==null}coerce(t,r){var i,o=this.getErrorPropertyFromObject(t);return o?r.apply(o):{type:this.getType(t),value:this.getValue(t),stack:(i=r.syntheticException)==null?void 0:i.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return fv(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){var r="'"+t.name+"' captured as exception";return"message"in t&&typeof t.message=="string"&&(r+=" with message: '"+t.message+"'"),r}if("message"in t&&typeof t.message=="string")return t.message;var i=this.getObjectClassName(t);return(i&&i!=="Object"?"'"+i+"'":"Object")+" captured as exception with keys: "+gS(t)}isSeverityLevel(t){return ct(t)&&!Eh(t)&&NE.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var r in t)if({}.hasOwnProperty.call(t,r)){var i=t[r];if(CE(i))return i}}getObjectClassName(t){try{var r=Object.getPrototypeOf(t);return r?r.constructor.name:void 0}catch{return}}},WE=class{match(t){return fv(t)}coerce(t,r){var i,o=t.constructor.name;return{type:o,value:o+" captured as exception with keys: "+gS(t),stack:(i=r.syntheticException)==null?void 0:i.stack,synthetic:!0}}},HE=class{match(t){return Gx(t)}coerce(t,r){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:(i=r.syntheticException)==null?void 0:i.stack,synthetic:!0}}},UE=class{match(t){return Hh(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!fv(t))return!1;try{var r=t.detail;return r!=null&&typeof r=="object"&&"reason"in r}catch{return!1}}coerce(t,r){var i,o=this.getUnhandledRejectionReason(t);return Gx(o)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(o),stack:(i=r.syntheticException)==null?void 0:i.stack,synthetic:!0}:r.apply(o)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&t.detail!=null&&typeof t.detail=="object"&&"reason"in t.detail)return t.detail.reason}catch{}return t}};var Kh="$message",qh="$timestamp",KE=new Set([Kh,qh]),jf={enabled:!0,max_bytes:32768};function Vh(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:jf.enabled,max_bytes:VE(e.max_bytes,jf.max_bytes)}:ne({},jf)}let qE=class{constructor(t){this.Kt=[],this.Qt=0,this.Bt=Vh(t)}setConfig(t){this.Bt=Vh(t),this.er()}add(t){var r=(function(o){var a=(function(g){var _=new WeakSet;try{return JSON.stringify(g,((y,x)=>{if(typeof x=="bigint")return x.toString();if(typeof x!="function"&&typeof x!="symbol"){if(x instanceof Date)return x.toISOString();if(x instanceof Error)return{name:x.name,message:x.message,stack:x.stack};if(x&&typeof x=="object"){if(_.has(x))return"[Circular]";_.add(x)}return x}}))}catch{return}})(o);if(a)try{var c=JSON.parse(a);if(!yt(c))return;var u=c,p=u[Kh],f=u[qh];return!ct(p)||p.trim().length===0||!ct(f)&&!Qr(f)?void 0:{step:u,json:a}}catch{return}})(t);if(r){var i=(function(o){if(typeof TextEncoder<"u")return new TextEncoder().encode(o).length;for(var a=encodeURIComponent(o),c=0,u=0;a.length>u;u++)a[u]==="%"?(c+=1,u+=2):c+=1;return c})(r.json);i>this.Bt.max_bytes||(this.Kt.push({step:r.step,bytes:i}),this.Qt+=i,this.er())}}getAttachable(){return this.Kt.map((t=>t.step))}clear(){this.Kt=[],this.Qt=0}size(){return this.Kt.length}er(){for(;this.Qt>this.Bt.max_bytes&&this.Kt.length>0;){var t=this.Kt.shift();t&&(this.Qt-=t.bytes)}}};function VE(e,t){if(!Qr(e)||e===1/0||e===-1/0)return t;var r=Math.floor(e);return 0>r?t:r}var vS=function(e,t){var{debugEnabled:r}=t===void 0?{}:t,i={C(o){if(U&&(cr.DEBUG||Se.POSTHOG_DEBUG||r)&&!de(U.console)&&U.console){for(var a=("__rrweb_original__"in U.console[o])?U.console[o].__rrweb_original__:U.console[o],c=arguments.length,u=new Array(c>1?c-1:0),p=1;c>p;p++)u[p-1]=arguments[p];a(e,...u)}},debug(){for(var o=arguments.length,a=new Array(o),c=0;o>c;c++)a[c]=arguments[c];i.C("debug",...a)},info(){for(var o=arguments.length,a=new Array(o),c=0;o>c;c++)a[c]=arguments[c];i.C("log",...a)},warn(){for(var o=arguments.length,a=new Array(o),c=0;o>c;c++)a[c]=arguments[c];i.C("warn",...a)},error(){for(var o=arguments.length,a=new Array(o),c=0;o>c;c++)a[c]=arguments[c];i.C("error",...a)},critical(){for(var o=arguments.length,a=new Array(o),c=0;o>c;c++)a[c]=arguments[c];console.error(e,...a)},uninitializedWarning(o){i.error("You must initialize PostHog before calling "+o)},createLogger:(o,a)=>vS(e+" "+o,a)};return i},he=vS("[PostHog.js]"),tt=he.createLogger,QE=tt("[ExternalScriptsLoader]"),Tf=(e,t,r)=>{if(e.config.disable_external_dependency_loading)return QE.warn(t+" was requested but loading of external scripts is disabled."),r("Loading of external scripts is disabled");var i=ce==null?void 0:ce.querySelectorAll("script");if(i){for(var o,a=function(){if(i[c].src===t){var p=i[c];return p.__posthog_loading_callback_fired?{v:r()}:(p.addEventListener("load",(f=>{p.__posthog_loading_callback_fired=!0,r(void 0,f)})),p.onerror=f=>r(f),{v:void 0})}},c=0;i.length>c;c++)if(o=a())return o.v}var u=()=>{if(!ce)return r("document not found");var p=ce.createElement("script");if(p.type="text/javascript",p.crossOrigin="anonymous",p.src=t,p.onload=_=>{p.__posthog_loading_callback_fired=!0,r(void 0,_)},p.onerror=_=>r(_),e.config.prepare_external_dependency_script&&(p=e.config.prepare_external_dependency_script(p)),!p)return r("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")ce.head.appendChild(p);else{var f,g=ce.querySelectorAll("body > script");g.length>0?(f=g[0].parentNode)==null||f.insertBefore(p,g[0]):ce.body.appendChild(p)}};ce!=null&&ce.body?u():ce==null||ce.addEventListener("DOMContentLoaded",u)};Se.__PosthogExtensions__=Se.__PosthogExtensions__||{},Se.__PosthogExtensions__.loadExternalDependency=(e,t,r)=>{if(t!=="remote-config"){var i;if(e.config.__preview_external_dependency_versioned_paths)i=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var o="/static/"+t+".js?v="+e.version;if(t==="toolbar"){var a=3e5;o=o+"&t="+Math.floor(Date.now()/a)*a}i=e.requestRouter.endpointFor("assets",o)}Tf(e,i,r)}else{var c=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");Tf(e,c,r)}},Se.__PosthogExtensions__.loadSiteApp=(e,t,r)=>{var i=e.requestRouter.endpointFor("api",t);Tf(e,i,r)};var _S="$people_distinct_id",Qh="$device_id",ul="__alias",dl="__timers",Np="$autocapture_disabled_server_side",zp="$heatmaps_enabled_server_side",Wp="$exception_capture_enabled_server_side",Hp="$error_tracking_suppression_rules",Up="$error_tracking_capture_extension_exceptions",Kp="$web_vitals_enabled_server_side",mv="$dead_clicks_enabled_server_side",qp="$product_tours_enabled_server_side",Vp="$web_vitals_allowed_metrics",fl="$session_recording_remote_config",mS="$replay_override_sampling",yS="$replay_override_linked_flag",xS="$replay_override_url_trigger",SS="$replay_override_event_trigger",Gh="$sesid",yv="$session_is_sampled",Po="$enabled_feature_flags",Ph="$active_feature_flags",pl="$early_access_features",Qp="$feature_flag_details",Gp="$feature_flag_payloads",Yp="$feature_flag_request_id",Ki="$override_feature_flags",wo="$override_feature_flag_payloads",gl="$stored_person_properties",_n="$stored_group_properties",Xp="$surveys",Jp="$surveys_activated",Rh="ph_product_tours",wl="$flag_call_reported",Zp="$flag_call_reported_session_id",eg="$feature_flag_errors",Yh="$feature_flag_evaluated_at",ni="$user_state",tg="$client_session_props",rg="$capture_rate_limit",ig="$initial_campaign_params",sg="$initial_referrer_info",Xh="$initial_person_info",Jh="$epp",bS="__POSTHOG_TOOLBAR__",hh="$posthog_cookieless",wS="$sdk_debug_extensions_init_method",CS="$sdk_debug_extensions_init_time_ms",kS="$sdk_debug_recording_script_not_loaded",xv="PostHog loadExternalDependency extension not found.",mn="on_reject",Ji="always",go="anonymous",vo="identified",ng="identified_only",Zh="visibilitychange",eu="beforeunload",Co="$pageview",Lf="$pageleave",Mf="$identify",f0="$groupidentify";function uh(e,t){We(e)&&e.forEach(t)}function Je(e,t){if(!$e(e))if(We(e))e.forEach(t);else if(hE(e))e.forEach(((i,o)=>t(i,o)));else for(var r in e)Qx.call(e,r)&&t(e[r],r)}var pt=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];for(var o of r)for(var a in o)o[a]!==void 0&&(e[a]=o[a]);return e};function jh(e){for(var t=Object.keys(e),r=t.length,i=new Array(r);r--;)i[r]=[t[r],e[t[r]]];return i}var p0=function(e){try{return e()}catch{return}},GE=function(e){return function(){try{for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,r)}catch(o){he.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),he.critical(o)}}},Sv=function(e){var t={};return Je(e,(function(r,i){(ct(r)&&r.length>0||Qr(r))&&(t[i]=r)})),t},YE=["herokuapp.com","vercel.app","netlify.app"];function XE(e){var t=e==null?void 0:e.hostname;if(!ct(t))return!1;var r=t.split(".").slice(-2).join(".");for(var i of YE)if(r===i)return!1;return!0}function wt(e,t,r,i){var{capture:o=!1,passive:a=!0}=i??{};e==null||e.addEventListener(t,r,{capture:o,passive:a})}function ES(e){return e.name==="ph_toolbar_internal"}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Qr(e)&&isFinite(e)&&Math.floor(e)===e});let JE=class og{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,r,i,o){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||!Number.isInteger(o)||0>t||0>r||0>i||0>o||t>0xffffffffffff||r>4095||i>1073741823||o>4294967295)throw new RangeError("invalid field value");var a=new Uint8Array(16);return a[0]=t/Math.pow(2,40),a[1]=t/Math.pow(2,32),a[2]=t/Math.pow(2,24),a[3]=t/Math.pow(2,16),a[4]=t/Math.pow(2,8),a[5]=t,a[6]=112|r>>>8,a[7]=r,a[8]=128|i>>>24,a[9]=i>>>16,a[10]=i>>>8,a[11]=i,a[12]=o>>>24,a[13]=o>>>16,a[14]=o>>>8,a[15]=o,new og(a)}toString(){for(var t="",r=0;this.bytes.length>r;r++)t=t+(this.bytes[r]>>>4).toString(16)+(15&this.bytes[r]).toString(16),r!==3&&r!==5&&r!==7&&r!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new og(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var r=0;16>r;r++){var i=this.bytes[r]-t.bytes[r];if(i!==0)return Math.sign(i)}return 0}},ZE=class{constructor(){this.I=0,this.S=0,this.k=new e5}generate(){var t=this.generateOrAbort();if(de(t)){this.I=0;var r=this.generateOrAbort();if(de(r))throw new Error("Could not generate UUID after timestamp reset");return r}return t}generateOrAbort(){var t=Date.now();if(t>this.I)this.I=t,this.A();else{if(this.I>=t+1e4)return;this.S++,this.S>4398046511103&&(this.I++,this.A())}return JE.fromFieldsV7(this.I,Math.trunc(this.S/Math.pow(2,30)),this.S&Math.pow(2,30)-1,this.k.nextUint32())}A(){this.S=1024*this.k.nextUint32()+(1023&this.k.nextUint32())}};var g0,PS=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};U&&!de(U.crypto)&&crypto.getRandomValues&&(PS=e=>crypto.getRandomValues(e));let e5=class{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(PS(this.T),this.N=0),this.T[this.N++]}};var Os=()=>t5().toString(),t5=()=>(g0||(g0=new ZE)).generate(),qa="",r5=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Si={R:()=>!!ce,B(e){he.error("cookieStore error: "+e)},O(e){if(ce){try{for(var t=e+"=",r=ce.cookie.split(";").filter((a=>a.length)),i=0;r.length>i;i++){for(var o=r[i];o.charAt(0)==" ";)o=o.substring(1,o.length);if(o.indexOf(t)===0)return decodeURIComponent(o.substring(t.length,o.length))}}catch{}return null}},Z(e){var t;try{t=JSON.parse(Si.O(e))||{}}catch{}return t},M(e,t,r,i,o){if(ce)try{var a="",c="",u=(function(g,_){if(_){var y=(function(S,w){if(w===void 0&&(w=ce),qa)return qa;if(!w||["localhost","127.0.0.1"].includes(S))return"";for(var C=S.split("."),E=Math.min(C.length,8),I="dmn_chk_"+Os();!qa&&E--;){var k=C.slice(E).join("."),R=I+"=1;domain=."+k+";path=/";w.cookie=R+";max-age=3",w.cookie.includes(I)&&(w.cookie=R+";max-age=0",qa=k)}return qa})(g);if(!y){var x=(S=>{var w=S.match(r5);return w?w[0]:""})(g);x!==y&&he.info("Warning: cookie subdomain discovery mismatch",x,y),y=x}return y?"; domain=."+y:""}return""})(ce.location.hostname,i);if(r){var p=new Date;p.setTime(p.getTime()+864e5*r),a="; expires="+p.toUTCString()}o&&(c="; secure");var f=e+"="+encodeURIComponent(JSON.stringify(t))+a+"; SameSite=Lax; path=/"+u+c;return f.length>3686.4&&he.warn("cookieStore warning: large cookie, len="+f.length),ce.cookie=f,f}catch{return}},F(e,t){if(ce!=null&&ce.cookie)try{Si.M(e,"",-1,t)}catch{return}}},Df=null,lt={R(){if(!is(Df))return Df;var e=!0;if(de(U))e=!1;else try{var t="__mplssupport__";lt.M(t,"xyz"),lt.O(t)!=='"xyz"'&&(e=!1),lt.F(t)}catch{e=!1}return e||he.error("localStorage unsupported; falling back to cookie store"),Df=e,e},B(e){he.error("localStorage error: "+e)},O(e){try{return U==null?void 0:U.localStorage.getItem(e)}catch(t){lt.B(t)}return null},Z(e){try{return JSON.parse(lt.O(e))||{}}catch{}return null},M(e,t){try{U==null||U.localStorage.setItem(e,JSON.stringify(t))}catch(r){lt.B(r)}},F(e){try{U==null||U.localStorage.removeItem(e)}catch(t){lt.B(t)}}},i5=[Qh,"distinct_id",Gh,yv,Jh,Xh,ni],dh={},s5={R:()=>!0,B(e){he.error("memoryStorage error: "+e)},O:e=>dh[e]||null,Z:e=>dh[e]||null,M(e,t){dh[e]=t},F(e){delete dh[e]}},fn=null,qt={R(){if(!is(fn))return fn;if(fn=!0,de(U))fn=!1;else try{var e="__support__";qt.M(e,"xyz"),qt.O(e)!=='"xyz"'&&(fn=!1),qt.F(e)}catch{fn=!1}return fn},B(e){he.error("sessionStorage error: ",e)},O(e){try{return U==null?void 0:U.sessionStorage.getItem(e)}catch(t){qt.B(t)}return null},Z(e){try{return JSON.parse(qt.O(e))||null}catch{}return null},M(e,t){try{U==null||U.sessionStorage.setItem(e,JSON.stringify(t))}catch(r){qt.B(r)}},F(e){try{U==null||U.sessionStorage.removeItem(e)}catch(t){qt.B(t)}}};let n5=class{constructor(t){this._instance=t}get Bt(){return this._instance.config}get consent(){return this.rr()?0:this.ir}isOptedOut(){return this.Bt.cookieless_mode===Ji||this.isRejected()||this.consent===-1&&this.Bt.cookieless_mode===mn}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Bt.opt_out_capturing_by_default}optInOut(t){this.nr.M(this.sr,t?1:0,this.Bt.cookie_expiration,this.Bt.cross_subdomain_cookie,this.Bt.secure_cookie)}reset(){this.nr.F(this.sr,this.Bt.cross_subdomain_cookie)}get sr(){var{token:t,opt_out_capturing_cookie_prefix:r,consent_persistence_name:i}=this._instance.config;return i||(r?r+t:"__ph_opt_in_out_"+t)}get ir(){var t=this.nr.O(this.sr);return Ef(t)?1:Fe(fE,t)?0:-1}get nr(){var t=this.Bt.opt_out_capturing_persistence_type,r=t==="localStorage"?lt:Si;if(!this.ar||this.ar!==r){this.ar=r;var i=t==="localStorage"?Si:lt;i.O(this.sr)&&(this.ar.O(this.sr)||this.optInOut(Ef(i.O(this.sr))),i.F(this.sr,this.Bt.cross_subdomain_cookie))}return this.ar}rr(){return!!this.Bt.respect_dnt&&[Tr==null?void 0:Tr.doNotTrack,Tr==null?void 0:Tr.msDoNotTrack,Se.doNotTrack].some((t=>Ef(t)))}};var fh=tt("[Dead Clicks]"),o5=()=>!0,a5=e=>{var t,r=!((t=e.instance.persistence)==null||!t.get_property(mv)),i=e.instance.config.capture_dead_clicks;return bi(i)?i:!!yt(i)||r};let v0=class{get lazyLoadedDeadClicksAutocapture(){return this.lr}constructor(t,r,i){this.instance=t,this.isEnabled=r,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[mv]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.ur((()=>{this.hr()})):this.stop()}ur(t){var r,i;(r=Se.__PosthogExtensions__)!=null&&r.initDeadClicksAutocapture&&t(),(i=Se.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(o=>{o?fh.error("failed to load script",o):t()}))}hr(){var t;if(ce){if(!this.lr&&(t=Se.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var r=yt(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};r.__onCapture=this.onCapture,this.lr=Se.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,r),this.lr.start(ce),fh.info("starting...")}}else fh.error("`document` not found. Cannot start.")}stop(){this.lr&&(this.lr.stop(),this.lr=void 0,fh.info("stopping..."))}};var Bf=tt("[SegmentIntegration]"),RS="posthog-js";function jS(e,t){var{organization:r,projectId:i,prefix:o,severityAllowList:a=["error"],sendExceptionsToPostHog:c=!0}=t===void 0?{}:t;return u=>{var p,f,g,_,y;if(a!=="*"&&!a.includes(u.level)||!e.__loaded)return u;u.tags||(u.tags={});var x=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());u.tags["PostHog Person URL"]=x,e.sessionRecordingStarted()&&(u.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var S,w=((p=u.exception)==null?void 0:p.values)||[],C=w.map((I=>ne({},I,{stacktrace:I.stacktrace?ne({},I.stacktrace,{type:"raw",frames:(I.stacktrace.frames||[]).map((k=>ne({},k,{platform:"web:javascript"})))}):void 0}))),E={$exception_message:((f=w[0])==null?void 0:f.value)||u.message,$exception_type:(g=w[0])==null?void 0:g.type,$exception_level:u.level,$exception_list:C,$sentry_event_id:u.event_id,$sentry_exception:u.exception,$sentry_exception_message:((_=w[0])==null?void 0:_.value)||u.message,$sentry_exception_type:(y=w[0])==null?void 0:y.type,$sentry_tags:u.tags};return r&&i&&(E.$sentry_url=(o||"https://sentry.io/organizations/")+r+"/issues/?project="+i+"&query="+u.event_id),c&&((S=e.exceptions)==null||S.sendExceptionEvent(E)),u}}let l5=class{constructor(t,r,i,o,a,c){this.name=RS,this.setupOnce=function(u){u(jS(t,{organization:r,projectId:i,prefix:o,severityAllowList:a,sendExceptionsToPostHog:c==null||c}))}}},_0=class{constructor(t){this.cr=(r,i,o)=>{o&&(o.noSessionId||o.activityTimeout||o.sessionPastMaximumLength)&&(he.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:r,changeReason:o}),this.dr=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.vr()}vr(){var t;this.pr=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(this.cr)}destroy(){var t;(t=this.pr)==null||t.call(this),this.pr=void 0}doPageView(t,r){var i,o=this.gr(t,r);return this.dr={pathname:(i=U==null?void 0:U.location.pathname)!==null&&i!==void 0?i:"",pageViewId:r,timestamp:t},this._instance.scrollManager.resetContext(),o}doPageLeave(t){var r;return this.gr(t,(r=this.dr)==null?void 0:r.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.dr)==null?void 0:t.pageViewId}}gr(t,r){var i=this.dr;if(!i)return{$pageview_id:r};var o={$pageview_id:r,$prev_pageview_id:i.pageViewId},a=this._instance.scrollManager.getContext();if(a&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:c,lastScrollY:u,maxScrollY:p,maxContentHeight:f,lastContentY:g,maxContentY:_}=a;if(!(de(c)||de(u)||de(p)||de(f)||de(g)||de(_))){c=Math.ceil(c),u=Math.ceil(u),p=Math.ceil(p),f=Math.ceil(f),g=Math.ceil(g),_=Math.ceil(_);var y=c>1?wi(u/c,0,1,he):1,x=c>1?wi(p/c,0,1,he):1,S=f>1?wi(g/f,0,1,he):1,w=f>1?wi(_/f,0,1,he):1;o=pt(o,{$prev_pageview_last_scroll:u,$prev_pageview_last_scroll_percentage:y,$prev_pageview_max_scroll:p,$prev_pageview_max_scroll_percentage:x,$prev_pageview_last_content:g,$prev_pageview_last_content_percentage:S,$prev_pageview_max_content:_,$prev_pageview_max_content_percentage:w})}}return i.pathname&&(o.$prev_pageview_pathname=i.pathname),i.timestamp&&(o.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),o}};var c5={[_S]:{exposure:"hidden"},[ul]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[dl]:{exposure:"hidden"},[Np]:{exposure:"event"},[zp]:{exposure:"hidden"},[Wp]:{exposure:"event"},[Hp]:{exposure:"hidden"},[Up]:{exposure:"event"},[Kp]:{exposure:"event"},[mv]:{exposure:"event"},[qp]:{exposure:"hidden"},[Vp]:{exposure:"event"},[fl]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Gh]:{exposure:"hidden"},[yv]:{exposure:"event"},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},[Po]:{exposure:"derived",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!yt(e))return{};for(var t={},r=Object.keys(e),i=0;r.length>i;i++)t["$feature/"+r[i]]=e[r[i]];return t}},[Ph]:{exposure:"event"},[pl]:{exposure:"hidden"},[Qp]:{exposure:"hidden"},[Gp]:{exposure:"event"},[Yp]:{exposure:"event"},[Ki]:{exposure:"event"},[wo]:{exposure:"hidden"},[gl]:{exposure:"hidden"},[_n]:{exposure:"hidden"},[Xp]:{exposure:"hidden"},[Jp]:{exposure:"event"},[Rh]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[wl]:{exposure:"hidden"},[Zp]:{exposure:"hidden"},[eg]:{exposure:"hidden"},[Yh]:{exposure:"hidden"},[ni]:{exposure:"hidden"},[tg]:{exposure:"hidden"},[rg]:{exposure:"hidden"},[ig]:{exposure:"hidden"},[sg]:{exposure:"hidden"},[Xh]:{exposure:"hidden"},[Jh]:{exposure:"hidden"},[mS]:{exposure:"event"},[yS]:{exposure:"event"},[xS]:{exposure:"event"},[SS]:{exposure:"event"},[wS]:{exposure:"event"},[CS]:{exposure:"event"},[kS]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},h5=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],tu=e=>{var t=ce==null?void 0:ce.createElement("a");return de(t)?null:(t.href=e,t)},ru=function(e,t){for(var r,i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),o=0;i.length>o;o++){var a=i[o].split("=");if(a[0]===t){r=a;break}}if(!We(r)||2>r.length)return"";var c=r[1];try{c=decodeURIComponent(c)}catch{he.error("Skipping decoding for malformed query param: "+c)}return c.replace(/\+/g," ")},Il=function(e,t,r){if(!e||!t||!t.length)return e;for(var i=e.split("#"),o=i[1],a=(i[0]||"").split("?"),c=a[1],u=a[0],p=(c||"").split("&"),f=[],g=0;p.length>g;g++){var _=p[g].split("=");We(_)&&(t.includes(_[0])?f.push(_[0]+"="+r):f.push(p[g]))}var y=u;return c!=null&&(y+="?"+f.join("&")),o!=null&&(y+="#"+o),y},iu=function(e,t){var r=e.match(new RegExp(t+"=([^&]*)"));return r?r[1]:null},ph="https?://(.*)",Go=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],u5=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Go],Ol="<masked>",d5=["li_fat_id"];function TS(e,t,r){if(!ce)return{};var i,o=t?[...Go,...r||[]]:[],a=LS(Il(ce.URL,o,Ol),e),c=(i={},Je(d5,(function(u){var p=Si.O(u);i[u]=p||null})),i);return pt(c,a)}function LS(e,t){var r=u5.concat(t||[]),i={};return Je(r,(function(o){var a=ru(e,o);i[o]=a||null})),i}function MS(e){var t=(function(a){return a?a.search(ph+"google.([^/?]*)")===0?"google":a.search(ph+"bing.com")===0?"bing":a.search(ph+"yahoo.com")===0?"yahoo":a.search(ph+"duckduckgo.com")===0?"duckduckgo":null:null})(e),r=t!="yahoo"?"q":"p",i={};if(!is(t)){i.$search_engine=t;var o=ce?ru(ce.referrer,r):"";o.length&&(i.ph_keyword=o)}return i}function m0(){return navigator.language||navigator.userLanguage}var su="$direct";function DS(){return(ce==null?void 0:ce.referrer)||su}function BS(e,t){var r=e?[...Go,...t||[]]:[],i=Ut==null?void 0:Ut.href.substring(0,1e3);return{r:DS().substring(0,1e3),u:i?Il(i,r,Ol):void 0}}function IS(e){var t,{r,u:i}=e,o={$referrer:r,$referring_domain:r==null?void 0:r==su?su:(t=tu(r))==null?void 0:t.host};if(i){o.$current_url=i;var a=tu(i);o.$host=a==null?void 0:a.host,o.$pathname=a==null?void 0:a.pathname;var c=LS(i);pt(o,c)}if(r){var u=MS(r);pt(o,u)}return o}function OS(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function f5(){try{return new Date().getTimezoneOffset()}catch{return}}var p5=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];let If=class{constructor(t,r){this.Bt=t,this.props={},this.mr=!1,this.yr=(i=>{var o="";return i.token&&(o=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+o+"_posthog"})(t),this.nr=this.br(t),this.load(),t.debug&&he.info("Persistence loaded",t.persistence,ne({},this.props)),this.update_config(t,t,r),this.save()}isDisabled(){return!!this._r}br(t){p5.indexOf(t.persistence.toLowerCase())===-1&&(he.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var r=(function(o){o===void 0&&(o=[]);var a=[...i5,...o];return ne({},lt,{Z(c){try{var u={};try{u=Si.Z(c)||{}}catch{}var p=pt(u,JSON.parse(lt.O(c)||"{}"));return lt.M(c,p),p}catch{}return null},M(c,u,p,f,g,_){try{lt.M(c,u,void 0,void 0,_);var y={};a.forEach((x=>{u[x]&&(y[x]=u[x])})),Object.keys(y).length&&Si.M(c,y,p,f,g,_)}catch(x){lt.B(x)}},F(c,u){try{U==null||U.localStorage.removeItem(c),Si.F(c,u)}catch(p){lt.B(p)}}})})(t.cookie_persisted_properties||[]),i=t.persistence.toLowerCase();return i==="localstorage"&<.R()?lt:i==="localstorage+cookie"&&r.R()?r:i==="sessionstorage"&&qt.R()?qt:i==="memory"?s5:i==="cookie"?Si:r.R()?r:Si}wr(t){var r=t??this.Bt.feature_flag_cache_ttl_ms;if(!r||0>=r)return!1;var i=this.props[Yh];return!i||typeof i!="number"||Date.now()-i>r}properties(){var t={};return Je(this.props,((r,i)=>{var o=(a=>{var c=c5[a];if(c)return c;for(var[u,p]of h5)if(a.indexOf(u)===0)return p})(i);if((o==null?void 0:o.exposure)==="derived"){if(o.shouldSkipFromEventProperties!=null&&o.shouldSkipFromEventProperties(r,i===Po?()=>this.wr():()=>!1))return;o.transformToEventProperties&&pt(t,o.transformToEventProperties(r))}else o&&o.exposure!=="event"||(t[i]=r)})),t}load(){if(!this._r){var t=this.nr.Z(this.yr);t&&(this.props=pt({},t))}}save(){this._r||this.nr.M(this.yr,this.props,this.Ir,this.Cr,this.Sr,this.Bt.debug)}remove(){this.nr.F(this.yr,!1),this.nr.F(this.yr,!0)}clear(){this.remove(),this.props={}}register_once(t,r,i){if(yt(t)){de(r)&&(r="None"),this.Ir=de(i)?this.kr:i;var o=!1;if(Je(t,((a,c)=>{this.props.hasOwnProperty(c)&&this.props[c]!==r||(this.Tr(c,a),o=!0)})),o)return this.save(),!0}return!1}register(t,r){if(yt(t)){this.Ir=de(r)?this.kr:r;var i=!1;if(Je(t,((o,a)=>{t.hasOwnProperty(a)&&this.props[a]!==o&&(this.Tr(a,o),i=!0)})),i)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.Ar(t),this.save())}update_campaign_params(){if(!this.mr){var t=TS(this.Bt.custom_campaign_params,this.Bt.mask_personal_data_properties,this.Bt.custom_personal_data_properties);Eo(Sv(t))||this.register(t),this.mr=!0}}update_search_keyword(){var t;this.register((t=ce==null?void 0:ce.referrer)?MS(t):{})}update_referrer_info(){var t;this.register_once({$referrer:DS(),$referring_domain:ce!=null&&ce.referrer&&((t=tu(ce.referrer))==null?void 0:t.host)||su},void 0)}set_initial_person_info(){this.props[ig]||this.props[sg]||this.register_once({[Xh]:BS(this.Bt.mask_personal_data_properties,this.Bt.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};Je([sg,ig],(c=>{var u=this.props[c];u&&Je(u,(function(p,f){t["$initial_"+Ip(f)]=p}))}));var r,i,o=this.props[Xh];if(o){var a=(r=IS(o),i={},Je(r,(function(c,u){i["$initial_"+Ip(u)]=c})),i);pt(t,a)}return t}safe_merge(t){return Je(this.props,(function(r,i){i in t||(t[i]=r)})),t}update_config(t,r,i){if(this.kr=this.Ir=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!i),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==r.persistence||!((c,u)=>{if(c.length!==u.length)return!1;var p=[...c].sort(),f=[...u].sort();return p.every(((g,_)=>g===f[_]))})(t.cookie_persisted_properties||[],r.cookie_persisted_properties||[])){var o=this.br(t),a=this.props;this.clear(),this.nr=o,this.props=a,this.save()}}set_disabled(t){this._r=t,this._r?this.remove():this.save()}set_cross_subdomain(t){t!==this.Cr&&(this.Cr=t,this.remove(),this.save())}set_secure(t){t!==this.Sr&&(this.Sr=t,this.remove(),this.save())}set_event_timer(t,r){var i=this.props[dl]||{};i[t]=r,this.Tr(dl,i),this.save()}remove_event_timer(t){var r=this.props[dl]||{},i=r[t];return de(i)||(delete r[t],this.Tr(dl,r),this.save()),i}get_property(t){return this.props[t]}set_property(t,r){this.Tr(t,r),this.save()}Tr(t,r){this.props[t]=r}Ar(t){delete this.props[t]}};var Va={Activation:"events",Cancellation:"cancelEvents"},Of={Popover:"popover",API:"api",Widget:"widget"},vl={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Ff={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},ag={Popover:"popover",Inline:"inline"},g5={SHOWN:"product tour shown"},y0={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},x0=tt("[RateLimiter]");let v5=class{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=r=>{var i=r.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((o=>{x0.info((o||"events")+" is quota limited."),this.serverLimits[o]=new Date().getTime()+6e4}))}catch(o){return void x0.warn('could not rate limit - continuing. Error: "'+(o==null?void 0:o.message)+'"',{text:i})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return((t=this.instance.config.rate_limiting)==null?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max(((t=this.instance.config.rate_limiting)==null?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var r,i,o;t===void 0&&(t=!1);var{captureEventsBurstLimit:a,captureEventsPerSecond:c}=this,u=new Date().getTime(),p=(r=(i=this.instance.persistence)==null?void 0:i.get_property(rg))!==null&&r!==void 0?r:{tokens:a,last:u};p.tokens+=(u-p.last)/1e3*c,p.last=u,p.tokens>a&&(p.tokens=a);var f=1>p.tokens;return f||t||(p.tokens=Math.max(0,p.tokens-1)),!f||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+c+" events per second and "+a+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=f,(o=this.instance.persistence)==null||o.set_property(rg,p),{isRateLimited:f,remainingTokens:p.tokens}}isServerRateLimited(t){var r=this.serverLimits[t||"events"]||!1;return r!==!1&&new Date().getTime()<r}};var Qa=tt("[RemoteConfig]");let FS=class{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=Se._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}Er(t){var r,i;(r=Se.__PosthogExtensions__)!=null&&r.loadExternalDependency?(i=Se.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}Rr(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(r){t(r.json)}})}load(){try{if(this.remoteConfig)return Qa.info("Using preloaded remote config",this.remoteConfig),this.Nr(this.remoteConfig),void this.Mr();if(this._instance.Fr())return void Qa.warn("Remote config is disabled. Falling back to local config.");this.Er((t=>{if(!t)return Qa.info("No config found after loading remote JS config. Falling back to JSON."),void this.Rr((r=>{this.Nr(r),this.Mr()}));this.Nr(t),this.Mr()}))}catch(t){Qa.error("Error loading remote config",t)}}stop(){this.Or&&(clearInterval(this.Or),this.Or=void 0)}refresh(){this._instance.Fr()||(ce==null?void 0:ce.visibilityState)==="hidden"||this._instance.reloadFeatureFlags()}Mr(){var t;if(!this.Or){var r=(t=this._instance.config.remote_config_refresh_interval_ms)!==null&&t!==void 0?t:3e5;r!==0&&(this.Or=setInterval((()=>{this.refresh()}),r))}}Nr(t){var r;t||Qa.error("Failed to fetch remote config from PostHog."),this._instance.Nr(t??{}),(t==null?void 0:t.hasFeatureFlags)!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(r=this._instance.featureFlags)==null||r.ensureFlagsLoaded())}};var xi={GZipJS:"gzip-js",Base64:"base64"},qr=Uint8Array,wr=Uint16Array,Yo=Uint32Array,bv=new qr([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),wv=new qr([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),S0=new qr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),$S=function(e,t){for(var r=new wr(31),i=0;31>i;++i)r[i]=t+=1<<e[i-1];var o=new Yo(r[30]);for(i=1;30>i;++i)for(var a=r[i];r[i+1]>a;++a)o[a]=a-r[i]<<5|i;return[r,o]},AS=$S(bv,2),lg=AS[1];AS[0][28]=258,lg[258]=28;for(var b0=$S(wv,0)[1],NS=new wr(32768),Ze=0;32768>Ze;++Ze){var _o=(43690&Ze)>>>1|(21845&Ze)<<1;NS[Ze]=((65280&(_o=(61680&(_o=(52428&_o)>>>2|(13107&_o)<<2))>>>4|(3855&_o)<<4))>>>8|(255&_o)<<8)>>>1}var Cl=function(e,t,r){for(var i=e.length,o=0,a=new wr(t);i>o;++o)++a[e[o]-1];var c,u=new wr(t);for(o=0;t>o;++o)u[o]=u[o-1]+a[o-1]<<1;for(c=new wr(i),o=0;i>o;++o)c[o]=NS[u[e[o]-1]++]>>>15-e[o];return c},Fn=new qr(288);for(Ze=0;144>Ze;++Ze)Fn[Ze]=8;for(Ze=144;256>Ze;++Ze)Fn[Ze]=9;for(Ze=256;280>Ze;++Ze)Fn[Ze]=7;for(Ze=280;288>Ze;++Ze)Fn[Ze]=8;var nu=new qr(32);for(Ze=0;32>Ze;++Ze)nu[Ze]=5;var _5=Cl(Fn,9),m5=Cl(nu,5),zS=function(e){return(e/8>>0)+(7&e&&1)},WS=function(e,t,r){(r==null||r>e.length)&&(r=e.length);var i=new(e instanceof wr?wr:e instanceof Yo?Yo:qr)(r-t);return i.set(e.subarray(t,r)),i},Ni=function(e,t,r){var i=t/8>>0;e[i]|=r<<=7&t,e[i+1]|=r>>>8},Ga=function(e,t,r){var i=t/8>>0;e[i]|=r<<=7&t,e[i+1]|=r>>>8,e[i+2]|=r>>>16},$f=function(e,t){for(var r=[],i=0;e.length>i;++i)e[i]&&r.push({s:i,f:e[i]});var o=r.length,a=r.slice();if(!o)return[new qr(0),0];if(o==1){var c=new qr(r[0].s+1);return c[r[0].s]=1,[c,1]}r.sort((function(M,F){return M.f-F.f})),r.push({s:-1,f:25001});var u=r[0],p=r[1],f=0,g=1,_=2;for(r[0]={s:-1,f:u.f+p.f,l:u,r:p};g!=o-1;)u=r[r[_].f>r[f].f?f++:_++],p=r[f!=g&&r[_].f>r[f].f?f++:_++],r[g++]={s:-1,f:u.f+p.f,l:u,r:p};var y=a[0].s;for(i=1;o>i;++i)a[i].s>y&&(y=a[i].s);var x=new wr(y+1),S=cg(r[g-1],x,0);if(S>t){i=0;var w=0,C=S-t,E=1<<C;for(a.sort((function(M,F){return x[F.s]-x[M.s]||M.f-F.f}));o>i;++i){var I=a[i].s;if(t>=x[I])break;w+=E-(1<<S-x[I]),x[I]=t}for(w>>>=C;w>0;){var k=a[i].s;t>x[k]?w-=1<<t-x[k]++-1:++i}for(;i>=0&&w;--i){var R=a[i].s;x[R]==t&&(--x[R],++w)}S=t}return[new qr(x),S]},cg=function(e,t,r){return e.s==-1?Math.max(cg(e.l,t,r+1),cg(e.r,t,r+1)):t[e.s]=r},w0=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new wr(++t),i=0,o=e[0],a=1,c=function(p){r[i++]=p},u=1;t>=u;++u)if(e[u]==o&&u!=t)++a;else{if(!o&&a>2){for(;a>138;a-=138)c(32754);a>2&&(c(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(c(o),--a;a>6;a-=6)c(8304);a>2&&(c(a-3<<5|8208),a=0)}for(;a--;)c(o);a=1,o=e[u]}return[r.subarray(0,i),t]},Ya=function(e,t){for(var r=0,i=0;t.length>i;++i)r+=e[i]*t[i];return r},hg=function(e,t,r){var i=r.length,o=zS(t+2);e[o]=255&i,e[o+1]=i>>>8,e[o+2]=255^e[o],e[o+3]=255^e[o+1];for(var a=0;i>a;++a)e[o+a+4]=r[a];return 8*(o+4+i)},C0=function(e,t,r,i,o,a,c,u,p,f,g){Ni(t,g++,r),++o[256];for(var _=$f(o,15),y=_[0],x=_[1],S=$f(a,15),w=S[0],C=S[1],E=w0(y),I=E[0],k=E[1],R=w0(w),M=R[0],F=R[1],W=new wr(19),H=0;I.length>H;++H)W[31&I[H]]++;for(H=0;M.length>H;++H)W[31&M[H]]++;for(var K=$f(W,7),ie=K[0],oe=K[1],Q=19;Q>4&&!ie[S0[Q-1]];--Q);var N,q,Y,re,le=f+5<<3,$=Ya(o,Fn)+Ya(a,nu)+c,Z=Ya(o,y)+Ya(a,w)+c+14+3*Q+Ya(W,ie)+(2*W[16]+3*W[17]+7*W[18]);if($>=le&&Z>=le)return hg(t,g,e.subarray(p,p+f));if(Ni(t,g,1+($>Z)),g+=2,$>Z){N=Cl(y,x),q=y,Y=Cl(w,C),re=w;var ee=Cl(ie,oe);for(Ni(t,g,k-257),Ni(t,g+5,F-1),Ni(t,g+10,Q-4),g+=14,H=0;Q>H;++H)Ni(t,g+3*H,ie[S0[H]]);g+=3*Q;for(var D=[I,M],V=0;2>V;++V){var ge=D[V];for(H=0;ge.length>H;++H)Ni(t,g,ee[_e=31&ge[H]]),g+=ie[_e],_e>15&&(Ni(t,g,ge[H]>>>5&127),g+=ge[H]>>>12)}}else N=_5,q=Fn,Y=m5,re=nu;for(H=0;u>H;++H)if(i[H]>255){var _e;Ga(t,g,N[257+(_e=i[H]>>>18&31)]),g+=q[_e+257],_e>7&&(Ni(t,g,i[H]>>>23&31),g+=bv[_e]);var we=31&i[H];Ga(t,g,Y[we]),g+=re[we],we>3&&(Ga(t,g,i[H]>>>5&8191),g+=wv[we])}else Ga(t,g,N[i[H]]),g+=q[i[H]];return Ga(t,g,N[256]),g+q[256]},y5=new Yo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),x5=(function(){for(var e=new Yo(256),t=0;256>t;++t){for(var r=t,i=9;--i;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e})(),Af=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8};function S5(e,t){t===void 0&&(t={});var r=(function(){var _=4294967295;return{p(y){for(var x=_,S=0;y.length>S;++S)x=x5[255&x^y[S]]^x>>>8;_=x},d(){return 4294967295^_}}})(),i=e.length;r.p(e);var o,a,c,u,p,f=(u=10+((o=t).filename&&o.filename.length+1||0),p=8,(function(_,y,x,S,w,C){var E=_.length,I=new qr(S+E+5*(1+Math.floor(E/7e3))+w),k=I.subarray(S,I.length-w),R=0;if(!y||8>E)for(var M=0;E>=M;M+=65535){var F=M+65535;E>F?R=hg(k,R,_.subarray(M,F)):(k[M]=!0,R=hg(k,R,_.subarray(M,E)))}else{for(var W=y5[y-1],H=W>>>13,K=8191&W,ie=(1<<x)-1,oe=new wr(32768),Q=new wr(ie+1),N=Math.ceil(x/3),q=2*N,Y=function(Hn){return(_[Hn]^_[Hn+1]<<N^_[Hn+2]<<q)&ie},re=new Yo(25e3),le=new wr(288),$=new wr(32),Z=0,ee=0,D=(M=0,0),V=0,ge=0;E>M;++M){var _e=Y(M),we=32767&M,Ce=Q[_e];if(oe[we]=Ce,Q[_e]=we,M>=V){var De=E-M;if((Z>7e3||D>24576)&&De>423){R=C0(_,k,0,re,le,$,ee,D,ge,M-ge,R),D=Z=ee=0,ge=M;for(var je=0;286>je;++je)le[je]=0;for(je=0;30>je;++je)$[je]=0}var Le=2,it=0,Mr=K,xt=we-Ce&32767;if(De>2&&_e==Y(M-xt))for(var Ae=Math.min(H,De)-1,Ti=Math.min(32767,M),Xl=Math.min(258,De);Ti>=xt&&--Mr&&we!=Ce;){if(_[M+Le]==_[M+Le-xt]){for(var Yr=0;Xl>Yr&&_[M+Yr]==_[M+Yr-xt];++Yr);if(Yr>Le){if(Le=Yr,it=xt,Yr>Ae)break;var na=Math.min(xt,Yr-2),oa=0;for(je=0;na>je;++je){var Js=M-xt+je+32768&32767,os=Js-oe[Js]+32768&32767;os>oa&&(oa=os,Ce=Js)}}}xt+=(we=Ce)-(Ce=oe[we])+32768&32767}if(it){re[D++]=268435456|lg[Le]<<18|b0[it];var Li=31&lg[Le],Wn=31&b0[it];ee+=bv[Li]+wv[Wn],++le[257+Li],++$[Wn],V=M+Le,++Z}else re[D++]=_[M],++le[_[M]]}}R=C0(_,k,!0,re,le,$,ee,D,ge,M-ge,R)}return WS(I,0,S+zS(R)+w)})(a=e,(c=t).level==null?6:c.level,c.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(a.length)))):12+c.mem,u,p)),g=f.length;return(function(_,y){var x=y.filename;if(_[0]=31,_[1]=139,_[2]=8,_[8]=2>y.level?4:y.level==9?2:0,_[9]=3,y.mtime!=0&&Af(_,4,Math.floor(new Date(y.mtime||Date.now())/1e3)),x){_[3]=8;for(var S=0;x.length>=S;++S)_[S+10]=x.charCodeAt(S)}})(f,t),Af(f,g-8,r.d()),Af(f,g-4,i),f}var b5=!!Dp||!!Mp,HS="text/plain",k0=!1,bu=function(e,t,r){var i;r===void 0&&(r=!0);var[o,a]=e.split("?"),c=ne({},t),u=(i=a==null?void 0:a.split("&").map((f=>{var g,[_,y]=f.split("="),x=r&&(g=c[_])!==null&&g!==void 0?g:y;return delete c[_],_+"="+x})))!==null&&i!==void 0?i:[],p=(function(f,g){var _,y;g===void 0&&(g="&");var x=[];return Je(f,(function(S,w){de(S)||de(w)||w==="undefined"||(_=encodeURIComponent((C=>C instanceof File)(S)?S.name:S.toString()),y=encodeURIComponent(w),x[x.length]=y+"="+_)})),x.join(g)})(c);return p&&u.push(p),o+"?"+u.join("&")},Ro=(e,t)=>JSON.stringify(e,((r,i)=>typeof i=="bigint"?i.toString():i),t),Nf=e=>{if(e.tr)return e.tr;var{data:t,compression:r}=e;if(t){if(r===xi.GZipJS){var i=S5((function(u,p){var f=u.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(u);for(var g=new qr(u.length+(u.length>>>1)),_=0,y=function(C){g[_++]=C},x=0;f>x;++x){if(_+5>g.length){var S=new qr(_+8+(f-x<<1));S.set(g),g=S}var w=u.charCodeAt(x);128>w?y(w):2048>w?(y(192|w>>>6),y(128|63&w)):w>55295&&57344>w?(y(240|(w=65536+(1047552&w)|1023&u.charCodeAt(++x))>>>18),y(128|w>>>12&63),y(128|w>>>6&63),y(128|63&w)):(y(224|w>>>12),y(128|w>>>6&63),y(128|63&w))}return WS(g,0,_)})(Ro(t)),{mtime:0});return{contentType:HS,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(r===xi.Base64){var o=(function(u){return u&&btoa(encodeURIComponent(u).replace(/%([0-9A-F]{2})/g,((p,f)=>String.fromCharCode(parseInt(f,16)))))})(Ro(t)),a=(u=>"data="+encodeURIComponent(typeof u=="string"?u:Ro(u)))(o);return{contentType:"application/x-www-form-urlencoded",body:a,estimatedSize:new Blob([a]).size}}var c=Ro(t);return{contentType:"application/json",body:c,estimatedSize:new Blob([c]).size}}},w5=(function(){var e=Ur((function*(t){var r=Ro(t.data),i=yield(function(a,c,u){return Bp.apply(this,arguments)})(r,cr.DEBUG,{rethrow:!0});if(!i)return t;var o=yield i.arrayBuffer();return ne({},t,{tr:{contentType:HS,body:o,estimatedSize:o.byteLength}})}));return function(t){return e.apply(this,arguments)}})(),E0=(e,t)=>bu(e,{_:new Date().getTime().toString(),ver:cr.JS_SDK_VERSION,compression:t}),Th=[];Mp&&Th.push({transport:"fetch",method(e){var t,r,{contentType:i,body:o,estimatedSize:a}=(t=Nf(e))!==null&&t!==void 0?t:{},c=new Headers;Je(e.headers,(function(g,_){c.append(_,g)})),i&&c.append("Content-Type",i);var u=e.url,p=null;if(i0){var f=new i0;p={signal:f.signal,timeout:setTimeout((()=>f.abort()),e.timeout)}}Mp(u,ne({method:(e==null?void 0:e.method)||"GET",headers:c,keepalive:e.method==="POST"&&52428.8>(a||0),body:o,signal:(r=p)==null?void 0:r.signal},e.fetchOptions)).then((g=>g.text().then((_=>{var y={statusCode:g.status,text:_};if(g.status===200)try{y.json=JSON.parse(_)}catch(x){he.error(x)}e.callback==null||e.callback(y)})))).catch((g=>{he.error(g),e.callback==null||e.callback({statusCode:0,error:g})})).finally((()=>p?clearTimeout(p.timeout):null))}}),Dp&&Th.push({transport:"XHR",method(e){var t,r=new Dp;r.open(e.method||"GET",e.url,!0);var{contentType:i,body:o}=(t=Nf(e))!==null&&t!==void 0?t:{};Je(e.headers,(function(a,c){r.setRequestHeader(c,a)})),i&&r.setRequestHeader("Content-Type",i),e.timeout&&(r.timeout=e.timeout),e.disableXHRCredentials||(r.withCredentials=!0),r.onreadystatechange=()=>{if(r.readyState===4){var a={statusCode:r.status,text:r.responseText};if(r.status===200)try{a.json=JSON.parse(r.responseText)}catch{}e.callback==null||e.callback(a)}},r.send(o)}}),Tr!=null&&Tr.sendBeacon&&Th.push({transport:"sendBeacon",method(e){var t=bu(e.url,{beacon:"1"});try{var r,{contentType:i,body:o}=(r=Nf(e))!==null&&r!==void 0?r:{};if(!o)return;var a=o instanceof Blob?o:new Blob([o],{type:i});Tr.sendBeacon(t,a)}catch{}}});var ug=3e3;let C5=class{constructor(t,r){this.Pr=!0,this.Lr=[],this.Dr=wi((r==null?void 0:r.flush_interval_ms)||ug,250,5e3,he.createLogger("flush interval"),ug),this.Br=t}enqueue(t){this.Lr.push(t),this.jr||this.$r()}unload(){this.qr();var t=this.Lr.length>0?this.Zr():{},r=Object.values(t);[...r.filter((i=>i.url.indexOf("/e")===0)),...r.filter((i=>i.url.indexOf("/e")!==0))].map((i=>{this.Br(ne({},i,{transport:"sendBeacon"}))}))}enable(){this.Pr=!1,this.$r()}$r(){var t=this;this.Pr||(this.jr=setTimeout((()=>{if(this.qr(),this.Lr.length>0){var r=this.Zr(),i=function(){var a=r[o],c=new Date().getTime();a.data&&We(a.data)&&Je(a.data,(u=>{u.offset=Math.abs(u.timestamp-c),delete u.timestamp})),t.Br(a)};for(var o in r)i()}}),this.Dr))}qr(){clearTimeout(this.jr),this.jr=void 0}Zr(){var t={};return Je(this.Lr,(r=>{var i,o=r,a=(o?o.batchKey:null)||o.url;de(t[a])&&(t[a]=ne({},o,{data:[]})),(i=t[a].data)==null||i.push(o.data)})),this.Lr=[],t}};var k5=["retriesPerformedSoFar"];let E5=class{constructor(t){this.Hr=!1,this.Vr=3e3,this.Lr=[],this._instance=t,this.Lr=[],this.zr=!0,!de(U)&&"onLine"in U.navigator&&(this.zr=U.navigator.onLine,this.Ur=()=>{this.zr=!0,this.Yr()},this.Gr=()=>{this.zr=!1},wt(U,"online",this.Ur),wt(U,"offline",this.Gr))}get length(){return this.Lr.length}retriableRequest(t){var{retriesPerformedSoFar:r}=t,i=qx(t,k5);bo(r)&&(i.url=bu(i.url,{retry_count:r})),this._instance._send_request(ne({},i,{callback:o=>{o.statusCode===200||o.statusCode>=400&&500>o.statusCode||(r??0)>=10?i.callback==null||i.callback(o):this.Wr(ne({retriesPerformedSoFar:r},i))}}))}Wr(t){var r=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=r+1;var i=(function(c){var u=3e3*Math.pow(2,c),p=u/2,f=Math.min(18e5,u),g=Math.random()-.5;return Math.ceil(f+g*(f-p))})(r),o=Date.now()+i;this.Lr.push({retryAt:o,requestOptions:t});var a="Enqueued failed request for retry in "+i;navigator.onLine||(a+=" (Browser is offline)"),he.warn(a),this.Hr||(this.Hr=!0,this.Xr())}Xr(){if(this.Jr&&clearTimeout(this.Jr),this.Lr.length===0)return this.Hr=!1,void(this.Jr=void 0);this.Jr=setTimeout((()=>{this.zr&&this.Lr.length>0&&this.Yr(),this.Xr()}),this.Vr)}Yr(){var t=Date.now(),r=[],i=this.Lr.filter((a=>t>a.retryAt||(r.push(a),!1)));if(this.Lr=r,i.length>0)for(var{requestOptions:o}of i)this.retriableRequest(o)}unload(){for(var{requestOptions:t}of(this.Jr&&(clearTimeout(this.Jr),this.Jr=void 0),this.Hr=!1,de(U)||(this.Ur&&(U.removeEventListener("online",this.Ur),this.Ur=void 0),this.Gr&&(U.removeEventListener("offline",this.Gr),this.Gr=void 0)),this.Lr))try{this._instance._send_request(ne({},t,{transport:"sendBeacon"}))}catch(r){he.error(r)}this.Lr=[]}},P5=class{constructor(t){this.Kr=()=>{var r,i,o,a;this.Qr||(this.Qr={});var c=this.scrollElement(),u=this.scrollY(),p=c?Math.max(0,c.scrollHeight-c.clientHeight):0,f=u+((c==null?void 0:c.clientHeight)||0),g=(c==null?void 0:c.scrollHeight)||0;this.Qr.lastScrollY=Math.ceil(u),this.Qr.maxScrollY=Math.max(u,(r=this.Qr.maxScrollY)!==null&&r!==void 0?r:0),this.Qr.maxScrollHeight=Math.max(p,(i=this.Qr.maxScrollHeight)!==null&&i!==void 0?i:0),this.Qr.lastContentY=f,this.Qr.maxContentY=Math.max(f,(o=this.Qr.maxContentY)!==null&&o!==void 0?o:0),this.Qr.maxContentHeight=Math.max(g,(a=this.Qr.maxContentHeight)!==null&&a!==void 0?a:0)},this._instance=t}get ei(){return this._instance.config.scroll_root_selector}getContext(){return this.Qr}resetContext(){var t=this.Qr;return setTimeout(this.Kr,0),t}startMeasuringScrollPosition(){wt(U,"scroll",this.Kr,{capture:!0}),wt(U,"scrollend",this.Kr,{capture:!0}),wt(U,"resize",this.Kr)}scrollElement(){if(!this.ei)return U==null?void 0:U.document.documentElement;var t=We(this.ei)?this.ei:[this.ei];for(var r of t){var i=U==null?void 0:U.document.querySelector(r);if(i)return i}}scrollY(){if(this.ei){var t=this.scrollElement();return t&&t.scrollTop||0}return U&&(U.scrollY||U.pageYOffset||U.document.documentElement.scrollTop)||0}scrollX(){if(this.ei){var t=this.scrollElement();return t&&t.scrollLeft||0}return U&&(U.scrollX||U.pageXOffset||U.document.documentElement.scrollLeft)||0}};var R5=e=>BS(e==null?void 0:e.config.mask_personal_data_properties,e==null?void 0:e.config.custom_personal_data_properties);let P0=class{constructor(t,r,i,o){this.ti=a=>{var c=this.ri();if(!c||c.sessionId!==a){var u={sessionId:a,props:this.ii(this._instance)};this.ni.register({[tg]:u})}},this._instance=t,this.si=r,this.ni=i,this.ii=o||R5,this.si.onSessionId(this.ti)}ri(){return this.ni.props[tg]}getSetOnceProps(){var t,r=(t=this.ri())==null?void 0:t.props;return r?"r"in r?IS(r):{$referring_domain:r.referringDomain,$pathname:r.initialPathName,utm_source:r.utm_source,utm_campaign:r.utm_campaign,utm_medium:r.utm_medium,utm_content:r.utm_content,utm_term:r.utm_term}:{}}getSessionProps(){var t={};return Je(Sv(this.getSetOnceProps()),((r,i)=>{i==="$current_url"&&(i="url"),t["$session_entry_"+Ip(i)]=r})),t}},Cv=class{constructor(){this.oi={}}on(t,r){return this.oi[t]||(this.oi[t]=[]),this.oi[t].push(r),()=>{this.oi[t]=this.oi[t].filter((i=>i!==r))}}emit(t,r){for(var i of this.oi[t]||[])i(r);for(var o of this.oi["*"]||[])o(t,r)}};var zf=tt("[SessionId]");let R0=class{on(t,r){return this.ai.on(t,r)}constructor(t,r,i){var o;if(this.li=[],this.ui=void 0,this.ai=new Cv,this.hi=(f,g)=>!(!bo(f)||!bo(g))&&Math.abs(f-g)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===Ji)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Bt=t.config,this.ni=t.persistence,this.ci=void 0,this.di=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.vi=r||Os,this.fi=i||Os;var a=this.Bt.persistence_name||this.Bt.token;if(this._sessionTimeoutMs=1e3*wi(this.Bt.session_idle_timeout_seconds||1800,60,36e3,zf.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.pi(),this.gi="ph_"+a+"_window_id",this.mi="ph_"+a+"_primary_window_exists",this.yi()){var c=qt.Z(this.gi),u=qt.Z(this.mi);c&&!u?this.ci=c:qt.F(this.gi),qt.M(this.mi,!0)}if((o=this.Bt.bootstrap)!=null&&o.sessionID)try{var p=(f=>{var g=this.Bt.bootstrap.sessionID.replace(/-/g,"");if(g.length!==32)throw new Error("Not a valid UUID");if(g[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(g.substring(0,12),16)})();this.bi(this.Bt.bootstrap.sessionID,new Date().getTime(),p)}catch(f){zf.error("Invalid sessionID in bootstrap",f)}this.wi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return de(this.li)&&(this.li=[]),this.li.push(t),this.di&&t(this.di,this.ci),()=>{this.li=this.li.filter((r=>r!==t))}}yi(){return this.Bt.persistence!=="memory"&&!this.ni._r&&qt.R()}Ii(t){t!==this.ci&&(this.ci=t,this.yi()&&qt.M(this.gi,t))}Ci(){return this.ci?this.ci:this.yi()?qt.Z(this.gi):null}bi(t,r,i){t===this.di&&r===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=r,this.di=t,this.ni.register({[Gh]:[r,t,i]}))}Si(){var t=this.ni.props[Gh];return We(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.bi(null,null,null)}destroy(){clearTimeout(this.xi),this.xi=void 0,this.ui&&U&&(U.removeEventListener(eu,this.ui,{capture:!1}),this.ui=void 0),this.li=[]}wi(){this.ui=()=>{this.yi()&&qt.F(this.mi)},wt(U,eu,this.ui,{capture:!1})}checkAndGetSessionAndWindowId(t,r){if(t===void 0&&(t=!1),r===void 0&&(r=null),this.Bt.cookieless_mode===Ji)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=r||new Date().getTime(),[o,a,c]=this.Si(),u=this.Ci(),p=bo(c)&&Math.abs(i-c)>864e5,f=!1,g=!a,_=!g&&!t&&this.hi(i,o);g||_||p?(a=this.vi(),u=this.fi(),zf.info("new session ID generated",{sessionId:a,windowId:u,changeReason:{noSessionId:g,activityTimeout:_,sessionPastMaximumLength:p}}),c=i,f=!0):u||(u=this.fi(),f=!0);var y=bo(o)&&t&&!p?o:i,x=bo(c)?c:new Date().getTime();return this.Ii(u),this.bi(a,y,x),t||this.pi(),f&&this.li.forEach((S=>S(a,u,f?{noSessionId:g,activityTimeout:_,sessionPastMaximumLength:p}:void 0))),{sessionId:a,windowId:u,sessionStartTimestamp:x,changeReason:f?{noSessionId:g,activityTimeout:_,sessionPastMaximumLength:p}:void 0,lastActivityTimestamp:o}}pi(){clearTimeout(this.xi),this.xi=setTimeout((()=>{var[t]=this.Si();if(this.hi(new Date().getTime(),t)){var r=this.di;this.resetSessionId(),this.ai.emit("forcedIdleReset",{idleSessionId:r})}}),1.1*this.sessionTimeoutMs)}};var US=function(e,t){if(!e)return!1;var r=e.userAgent;if(r&&o0(r,t))return!0;try{var i=e==null?void 0:e.userAgentData;if(i!=null&&i.brands&&i.brands.some((o=>o0(o==null?void 0:o.brand,t))))return!0}catch{}return!!e.webdriver},ou=function(e,t){if(!(function(r){try{new RegExp(r)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function j0(e,t,r){return Ro({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:r})}var KS={exact:(e,t)=>t.some((r=>e.some((i=>r===i)))),is_not:(e,t)=>t.every((r=>e.every((i=>r!==i)))),regex:(e,t)=>t.some((r=>e.some((i=>ou(r,i))))),not_regex:(e,t)=>t.every((r=>e.every((i=>!ou(r,i))))),icontains:(e,t)=>t.map(gh).some((r=>e.map(gh).some((i=>r.includes(i))))),not_icontains:(e,t)=>t.map(gh).every((r=>e.map(gh).every((i=>!r.includes(i))))),gt:(e,t)=>t.some((r=>{var i=parseFloat(r);return!isNaN(i)&&e.some((o=>i>parseFloat(o)))})),lt:(e,t)=>t.some((r=>{var i=parseFloat(r);return!isNaN(i)&&e.some((o=>i<parseFloat(o)))}))},gh=e=>e.toLowerCase();function qS(e,t){return!e||Object.entries(e).every((r=>{var[i,o]=r,a=t==null?void 0:t[i];if(de(a)||is(a))return!1;var c=[String(a)],u=KS[o.operator];return!!u&&u(o.values,c)}))}var dg="custom",T0="i.posthog.com",j5=/^\/static\//;let T5=class{constructor(t){this.ki={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return t==="https://app.posthog.com"?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,r=(t=this.instance.config.ui_host)==null?void 0:t.replace(/\/$/,"");return r||(r=this.apiHost.replace("."+T0,".posthog.com")),r==="https://app.posthog.com"?"https://us.posthog.com":r}get region(){return this.ki[this.apiHost]||(this.ki[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":dg),this.ki[this.apiHost]}Ti(t){var r=this.instance.config.__preview_external_dependency_versioned_paths;if(typeof r=="string"&&j5.test(t))return r.trim().replace(/\/$/,"")||void 0}endpointFor(t,r){if(r===void 0&&(r=""),r&&(r=r[0]==="/"?r:"/"+r),t==="ui")return this.uiHost+r;if(t==="flags")return this.flagsApiHost+r;if(t==="assets"){var i=this.Ti(r);if(i)return""+i+r}if(this.region===dg)return this.apiHost+r;var o=T0+r;switch(t){case"assets":return"https://"+this.region+"-assets."+o;case"api":return"https://"+this.region+"."+o}}};var Ve=tt("[Surveys]"),fg="seenSurvey_",L5=[Of.Popover,Of.Widget,Of.API],M5={ignoreConditions:!1,ignoreDelay:!1,displayType:ag.Popover},D5=tt("[PostHog ExternalIntegrations]"),B5={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};let I5=class{constructor(t){this._instance=t}ur(t,r){var i;(i=Se.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,t,(o=>{if(o)return D5.error("failed to load script",o);r()}))}startIfEnabledOrStop(){var t=this,r=function(c){var u,p,f;!o||(u=Se.__PosthogExtensions__)!=null&&(u=u.integrations)!=null&&u[c]||t.ur(B5[c],(()=>{var g;(g=Se.__PosthogExtensions__)==null||(g=g.integrations)==null||(g=g[c])==null||g.start(t._instance)})),!o&&(p=Se.__PosthogExtensions__)!=null&&(p=p.integrations)!=null&&p[c]&&((f=Se.__PosthogExtensions__)==null||(f=f.integrations)==null||(f=f[c])==null||f.stop())};for(var[i,o]of Object.entries((a=this._instance.config.integrations)!==null&&a!==void 0?a:{})){var a;r(i)}}};var mo,kl={},Wf=0,pg=()=>{},L0='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Xa="Surveys module not available",M0="sanitize_properties is deprecated. Use before_send instead",VS="Invalid value for property_denylist config: ",ko="posthog",QS=!b5&&(br==null?void 0:br.indexOf("MSIE"))===-1&&(br==null?void 0:br.indexOf("Mozilla"))===-1,D0=e=>{var t;return ne({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:XE(ce==null?void 0:ce.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:pg,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,debug:Ut&&ct(Ut==null?void 0:Ut.search)&&Ut.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(U==null||(t=U.location)==null?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(r){he.error("Bad HTTP status: "+r.statusCode+" "+r.text)},get_device_id:r=>r,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:ng,before_send:void 0,request_queue_config:{flush_interval_ms:ug},error_tracking:{},_onCapture:pg,__preview_eager_load_replay:!1},(r=>({rageclick:!r||"2025-11-30">r||{content_ignorelist:!0},capture_pageview:!r||"2025-05-24">r||"history_change",session_recording:r&&r>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:r&&r>="2026-01-30"?"head":"body",internal_or_test_user_hostname:r&&r>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(e))},O5=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],B0=e=>{var t={};for(var[r,i]of O5)de(e[r])||(t[i]=e[r]);var o=pt({},t,e);return We(e.property_blacklist)&&(de(e.property_denylist)?o.property_denylist=e.property_blacklist:We(e.property_denylist)?o.property_denylist=[...e.property_blacklist,...e.property_denylist]:he.error(VS+e.property_denylist)),o};let F5=class{constructor(){this.__forceAllowLocalhost=!1}get Ai(){return this.__forceAllowLocalhost}set Ai(t){he.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},El=class yn{Ei(t,r){if(t){var i=this.Ri.indexOf(t);i!==-1&&this.Ri.splice(i,1)}return this.Ri.push(r),r.initialize==null||r.initialize(),r}Ni(){return this.config.cookieless_mode===Ji||this.config.cookieless_mode===mn&&this.consent.isRejected()}get decideEndpointWasHit(){var t,r;return(t=(r=this.featureFlags)==null?void 0:r.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,r;return(t=(r=this.featureFlags)==null?void 0:r.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.webPerformance=new F5,this.Mi=!1,this.version=cr.LIB_VERSION,this.Fi=new Cv,this.Ri=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=D0(),this.SentryIntegration=l5,this.sentryIntegration=i=>(function(o,a){var c=jS(o,a);return{name:RS,processEvent:u=>c(u)}})(this,i),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Oi=!1,this.Pi=null,this.Li=null,this.Di=null,this.scrollManager=new P5(this),this.pageViewManager=new _0(this),this.rateLimiter=new v5(this),this.requestRouter=new T5(this),this.consent=new n5(this),this.externalIntegrations=new I5(this);var r=(t=yn.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=r.featureFlags&&new r.featureFlags(this),this.toolbar=r.toolbar&&new r.toolbar(this),this.surveys=r.surveys&&new r.surveys(this),this.conversations=r.conversations&&new r.conversations(this),this.logs=r.logs&&new r.logs(this),this.experiments=r.experiments&&new r.experiments(this),this.exceptions=r.exceptions&&new r.exceptions(this),this.people={set:(i,o,a)=>{var c=ct(i)?{[i]:o}:i;this.setPersonProperties(c),a==null||a({})},set_once:(i,o,a)=>{var c=ct(i)?{[i]:o}:i;this.setPersonProperties(void 0,c),a==null||a({})}},this.on("eventCaptured",(i=>he.info('send "'+(i==null?void 0:i.event)+'"',i)))}init(t,r,i){if(i&&i!==ko){var o,a=(o=kl[i])!==null&&o!==void 0?o:new yn;return a._init(t,r,i),kl[i]=a,kl[ko][i]=a,a}return this._init(t,r,i)}_init(t,r,i){var o,a;if(r===void 0&&(r={}),de(t)||Eh(t))return he.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},r.debug=this.Bi(r.debug),this.ji=r,this.$i=[],r.person_profiles?this.Li=r.person_profiles:r.process_person&&(this.Li=r.process_person),this.set_config(pt({},D0(r.defaults),B0(r),{name:i,token:t})),this.config.on_xhr_error&&he.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=r.disable_compression?void 0:xi.GZipJS;var c=this.qi();this.persistence=new If(this.config,c),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new If(ne({},this.config,{persistence:"sessionStorage"}),c);var u=ne({},this.persistence.props),p=ne({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Zi=new C5((C=>this.Hi(C)),this.config.request_queue_config),this.Vi=new E5(this),this.__request_queue=[];var f=this.Ni();if(f||(this.sessionManager=new R0(this),this.sessionPropsManager=new P0(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(he.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.zi(f)}),0)):(he.info("Initializing extensions synchronously"),this.zi(f)),cr.DEBUG=cr.DEBUG||this.config.debug,cr.DEBUG&&he.info("Starting in debug mode",{this:this,config:r,thisC:ne({},this.config),p:u,s:p}),!this.config.identity_distinct_id||(o=r.bootstrap)!=null&&o.distinctID||(r.bootstrap=ne({},r.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((a=r.bootstrap)==null?void 0:a.distinctID)!==void 0){var g=r.bootstrap.distinctID,_=this.get_distinct_id(),y=this.persistence.get_property(ni);if(r.bootstrap.isIdentifiedID&&_!=null&&_!==g&&y===go)this.identify(g);else if(r.bootstrap.isIdentifiedID&&_!=null&&_!==g&&y===vo)he.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var x=this.config.get_device_id(Os()),S=r.bootstrap.isIdentifiedID?x:g;this.persistence.set_property(ni,r.bootstrap.isIdentifiedID?vo:go),this.register({distinct_id:g,$device_id:S})}}if(f)this.register_once({distinct_id:hh,$device_id:null},"");else if(!this.get_distinct_id()){var w=this.config.get_device_id(Os());this.register_once({distinct_id:w,$device_id:w},""),this.persistence.set_property(ni,go)}return wt(U,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),r.segment?(function(C,E){var I=C.config.segment;if(!I)return E();(function(k,R){var M=k.config.segment;if(!M)return R();var F=H=>{var K=()=>H.anonymousId()||Os();k.config.get_device_id=K,H.id()&&(k.register({distinct_id:H.id(),$device_id:K()}),k.persistence.set_property(ni,vo)),R()},W=M.user();"then"in W&&Vi(W.then)?W.then(F):F(W)})(C,(()=>{I.register((k=>{Promise&&Promise.resolve||Bf.warn("This browser does not have Promise support, and can not use the segment integration");var R=(M,F)=>{if(!F)return M;M.event.userId||M.event.anonymousId===k.get_distinct_id()||(Bf.info("No userId set, resetting PostHog"),k.reset()),M.event.userId&&M.event.userId!==k.get_distinct_id()&&(Bf.info("UserId set, identifying with PostHog"),k.identify(M.event.userId));var W=k.calculateEventProperties(F,M.event.properties);return M.event.properties=Object.assign({},W,M.event.properties),M};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:M=>R(M,M.event.event),page:M=>R(M,Co),identify:M=>R(M,Mf),screen:M=>R(M,"$screen")}})(C)).then((()=>{E()}))}))})(this,(()=>this.Ui())):this.Ui(),Vi(this.config._onCapture)&&this.config._onCapture!==pg&&(he.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(C=>this.config._onCapture(C.event,C)))),this.config.ip&&he.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}zi(t){var r,i,o,a,c,u,p,f=performance.now(),g=ne({},yn.__defaultExtensionClasses,this.config.__extensionClasses),_=[];g.featureFlags&&this.Ri.push(this.featureFlags=(r=this.featureFlags)!==null&&r!==void 0?r:new g.featureFlags(this)),g.exceptions&&this.Ri.push(this.exceptions=(i=this.exceptions)!==null&&i!==void 0?i:new g.exceptions(this)),g.historyAutocapture&&this.Ri.push(this.historyAutocapture=new g.historyAutocapture(this)),g.tracingHeaders&&this.Ri.push(new g.tracingHeaders(this)),g.siteApps&&this.Ri.push(this.siteApps=new g.siteApps(this)),g.sessionRecording&&!t&&this.Ri.push(this.sessionRecording=new g.sessionRecording(this)),this.config.disable_scroll_properties||_.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),g.autocapture&&this.Ri.push(this.autocapture=new g.autocapture(this)),g.surveys&&this.Ri.push(this.surveys=(o=this.surveys)!==null&&o!==void 0?o:new g.surveys(this)),g.logs&&this.Ri.push(this.logs=(a=this.logs)!==null&&a!==void 0?a:new g.logs(this)),g.conversations&&this.Ri.push(this.conversations=(c=this.conversations)!==null&&c!==void 0?c:new g.conversations(this)),g.productTours&&this.Ri.push(this.productTours=new g.productTours(this)),g.heatmaps&&this.Ri.push(this.heatmaps=new g.heatmaps(this)),g.webVitalsAutocapture&&this.Ri.push(this.webVitalsAutocapture=new g.webVitalsAutocapture(this)),g.exceptionObserver&&this.Ri.push(this.exceptionObserver=new g.exceptionObserver(this)),g.deadClicksAutocapture&&this.Ri.push(this.deadClicksAutocapture=new g.deadClicksAutocapture(this,a5)),g.toolbar&&this.Ri.push(this.toolbar=(u=this.toolbar)!==null&&u!==void 0?u:new g.toolbar(this)),g.experiments&&this.Ri.push(this.experiments=(p=this.experiments)!==null&&p!==void 0?p:new g.experiments(this)),this.Ri.forEach((y=>{y.initialize&&_.push((()=>{y.initialize==null||y.initialize()}))})),_.push((()=>{if(this.Yi){var y=this.Yi;this.Yi=void 0,this.Nr(y)}})),this.Gi(_,f)}Gi(t,r){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-r>=30&&t.length>0)return void setTimeout((()=>{this.Gi(t,r)}),0);var i=t.shift();if(i)try{i()}catch(a){he.error("Error initializing extension:",a)}}var o=Math.round(performance.now()-r);this.register_for_session({[wS]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[CS]:o}),this.config.__preview_deferred_init_extensions&&he.info("PostHog extensions initialized ("+o+"ms)")}Nr(t){var r;if(!ce||!ce.body)return he.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Nr(t)}),500);this.config.__preview_deferred_init_extensions&&(this.Yi=t),this.Wi=t,this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=Fe(t.supportedCompression,xi.GZipJS)?xi.GZipJS:Fe(t.supportedCompression,xi.Base64)?xi.Base64:void 0),(r=t.analytics)!=null&&r.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Li?this.Li:ng}),this.Ri.forEach((i=>i.onRemoteConfig==null?void 0:i.onRemoteConfig(t)))}Ui(){try{this.config.loaded(this)}catch(i){he.critical("`loaded` function failed",i)}if(this.Xi(),this.config.internal_or_test_user_hostname&&Ut!=null&&Ut.hostname){var t=Ut.hostname,r=this.config.internal_or_test_user_hostname;(typeof r=="string"?t===r:r.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Ni())&&this.Ji()}),1),this.Ki=new FS(this),this.Ki.load()}Xi(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Zi)==null||t.enable())}_dom_loaded(){this.is_capturing()&&uh(this.__request_queue,(t=>this.Hi(t))),this.__request_queue=[],this.Xi()}_handle_unload(){var t,r,i,o;(t=this.surveys)==null||t.handlePageUnload(),this.config.request_batching?(this.Qi()&&this.capture(Lf),(r=this.logs)==null||r.flushLogs("sendBeacon"),(i=this.Zi)==null||i.unload(),(o=this.Vi)==null||o.unload()):this.Qi()&&this.capture(Lf,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(QS?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=bu(t.url,{ip:this.config.ip?1:0}),t.headers=ne({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?this.compression:t.compression,t.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(r=>{var i,o,a,c=ne({},r);c.timeout=c.timeout||6e4,c.url=E0(c.url,c.compression);var u=(i=c.transport)!==null&&i!==void 0?i:"fetch",p=Th.filter((g=>!c.disableTransport||!g.transport||!c.disableTransport.includes(g.transport))),f=(o=(a=(function(g,_){for(var y=0;g.length>y;y++)if(g[y].transport===u)return g[y]})(p))==null?void 0:a.method)!==null&&o!==void 0?o:p[0].method;if(!f)throw new Error("No available transport method");u!=="sendBeacon"&&c.data&&c.compression===xi.GZipJS&&aE&&!k0?w5(c).then((g=>{f(g)})).catch((g=>{if((_=>!(!_||typeof _!="object")&&("name"in _?String(_.name):"")==="NotReadableError")(g))return k0=!0,void f(ne({},c,{compression:void 0,url:E0(r.url,void 0)}));f(c)})):f(c)})(ne({},t,{callback:r=>{var i,o;this.rateLimiter.checkForLimiting(r),400>r.statusCode||(i=(o=this.config).on_request_error)==null||i.call(o,r),t.callback==null||t.callback(r)}}))))}Hi(t){this.Vi?this.Vi.retriableRequest(t):this._send_request(t)}_execute_array(t){Wf++;try{var r,i=[],o=[],a=[];uh(t,(u=>{u&&(We(r=u[0])?a.push(u):Vi(u)?u.call(this):We(u)&&r==="alias"?i.push(u):We(u)&&r.indexOf("capture")!==-1&&Vi(this[r])?a.push(u):o.push(u))}));var c=function(u,p){uh(u,(function(f){if(We(f[0])){var g=p;Je(f,(function(_){g=g[_[0]].apply(g,_.slice(1))}))}else p[f[0]].apply(p,f.slice(1))}))};c(i,this),c(o,this),c(a,this)}finally{Wf--}}push(t){if(Wf>0&&We(t)&&ct(t[0])){var r=yn.prototype[t[0]];Vi(r)&&r.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,r,i){var o,a,c,u,p;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Zi){if(this.is_capturing())if(!de(t)&&ct(t)){var f=!this.config.opt_out_useragent_filter&&this._is_bot();if(!f||this.config.__preview_capture_bot_pageviews){var g=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(g==null||!g.isRateLimited){r!=null&&r.$current_url&&!ct(r==null?void 0:r.$current_url)&&(he.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),r==null||delete r.$current_url),t!=="$exception"||i!=null&&i.en||he.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var _=new Date,y=(i==null?void 0:i.timestamp)||_,x=Os(),S={uuid:x,event:t,properties:this.calculateEventProperties(t,r||{},y,x)};t===Co&&this.config.__preview_capture_bot_pageviews&&f&&(S.event="$bot_pageview",S.properties.$browser_type="bot"),g&&(S.properties.$lib_rate_limit_remaining_tokens=g.remainingTokens),i!=null&&i.$set&&(S.$set=i==null?void 0:i.$set);var w,C,E,I=this.tn(i==null?void 0:i.$set_once,t!==f0,t===Mf);if(I&&(S.$set_once=I),i!=null&&i._noTruncate||(a=this.config.properties_string_max_length,c=S,u=K=>ct(K)?K.slice(0,a):K,p=new Set,S=(function K(ie,oe){return ie!==Object(ie)?u?u(ie):ie:p.has(ie)?void 0:(p.add(ie),We(ie)?(Q=[],uh(ie,(N=>{Q.push(K(N))}))):(Q={},Je(ie,((N,q)=>{p.has(N)||(Q[q]=K(N))}))),Q);var Q})(c)),S.timestamp=y,de(i==null?void 0:i.timestamp)||(S.properties.$event_time_override_provided=!0,S.properties.$event_time_override_system_time=_),t===vl.DISMISSED||t===vl.SENT){var k=r==null?void 0:r[Ff.SURVEY_ID],R=r==null?void 0:r[Ff.SURVEY_ITERATION];(K=>{try{var ie=(oe=>((Q,N)=>{var q=""+fg+N.id;return N.current_iteration&&N.current_iteration>0&&(q=""+fg+N.id+"_"+N.current_iteration),q})(0,oe))(K);if(localStorage.getItem(ie))return;localStorage.setItem(ie,"true")}catch(oe){Ve.error("Failed to persist survey seen state",oe)}})({id:k,current_iteration:R}),S.$set=ne({},S.$set,{[(w={id:k,current_iteration:R},C=t===vl.SENT?"responded":"dismissed",E="$survey_"+C+"/"+w.id,w.current_iteration&&w.current_iteration>0&&(E="$survey_"+C+"/"+w.id+"/"+w.current_iteration),E)]:!0})}else t===vl.SHOWN&&(S.$set=ne({},S.$set,{[Ff.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===g5.SHOWN){var M=r==null?void 0:r[y0.TOUR_TYPE];M&&(S.$set=ne({},S.$set,{[y0.TOUR_LAST_SEEN_DATE+"/"+M]:new Date().toISOString()}))}var F=ne({},S.properties.$set,S.$set);if(Eo(F)||this.setPersonPropertiesForFlags(F),!$e(this.config.before_send)){var W=this.rn(S);if(!W)return;S=W}this.Fi.emit("eventCaptured",S);var H={method:"POST",url:(o=i==null?void 0:i._url)!==null&&o!==void 0?o:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:S,compression:"best-available",batchKey:i==null?void 0:i._batchKey};return!this.config.request_batching||i&&(i==null||!i._batchKey)||i!=null&&i.send_instantly?this.Hi(H):this.Zi.enqueue(H),S}he.critical("This capture call is ignored due to client rate limiting.")}}else he.error("No event name provided to posthog.capture")}else he.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(r=>t(r.event,r)))}calculateEventProperties(t,r,i,o,a){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return r;var c=a?void 0:this.persistence.remove_event_timer(t),u=ne({},r);if(u.token=this.config.token,u.$config_defaults=this.config.defaults,this.Ni()&&(u.$cookieless_mode=!0),t==="$snapshot"){var p=ne({},this.persistence.properties(),this.sessionPersistence.properties());return u.distinct_id=p.distinct_id,(!ct(u.distinct_id)&&!Qr(u.distinct_id)||Eh(u.distinct_id))&&he.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),u}var f,g=(function(E,I){var k,R,M,F;if(!br)return{};var W,H,K,ie,oe,Q,N,q,Y=E?[...Go,...I||[]]:[],[re,le]=(function($){for(var Z=0;c0.length>Z;Z++){var[ee,D]=c0[Z],V=ee.exec($),ge=V&&(Vi(D)?D(V,$):D);if(ge)return ge}return["",""]})(br);return pt(Sv({$os:re,$os_version:le,$browser:uS(br,navigator.vendor),$device:h0(br),$device_type:(H=br,K={userAgentDataPlatform:(k=navigator)==null||(k=k.userAgentData)==null?void 0:k.platform,maxTouchPoints:(R=navigator)==null?void 0:R.maxTouchPoints,screenWidth:U==null||(M=U.screen)==null?void 0:M.width,screenHeight:U==null||(F=U.screen)==null?void 0:F.height,devicePixelRatio:U==null?void 0:U.devicePixelRatio},q=h0(H),q===Xx||q===Yx||q==="Kobo"||q==="Kindle Fire"||q===hS?qo:q===Dl||q===Lo||q===Bl||q===Fp?"Console":q===Zx?"Wearable":q?Lr:(K==null?void 0:K.userAgentDataPlatform)==="Android"&&((ie=K==null?void 0:K.maxTouchPoints)!==null&&ie!==void 0?ie:0)>0?600>Math.min((oe=K==null?void 0:K.screenWidth)!==null&&oe!==void 0?oe:0,(Q=K==null?void 0:K.screenHeight)!==null&&Q!==void 0?Q:0)/((N=K==null?void 0:K.devicePixelRatio)!==null&&N!==void 0?N:1)?Lr:qo:"Desktop"),$timezone:OS(),$timezone_offset:f5()}),{$current_url:Il(Ut==null?void 0:Ut.href,Y,Ol),$host:Ut==null?void 0:Ut.host,$pathname:Ut==null?void 0:Ut.pathname,$raw_user_agent:br.length>1e3?br.substring(0,997)+"...":br,$browser_version:wE(br,navigator.vendor),$browser_language:m0(),$browser_language_prefix:(W=m0(),typeof W=="string"?W.split("-")[0]:void 0),$screen_height:U==null?void 0:U.screen.height,$screen_width:U==null?void 0:U.screen.width,$viewport_height:U==null?void 0:U.innerHeight,$viewport_width:U==null?void 0:U.innerWidth,$lib:cr.LIB_NAME,$lib_version:cr.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:_,windowId:y}=this.sessionManager.checkAndGetSessionAndWindowId(a,i.getTime());u.$session_id=_,u.$window_id=y}this.sessionPropsManager&&pt(u,this.sessionPropsManager.getSessionProps());try{var x;this.sessionRecording&&pt(u,this.sessionRecording.sdkDebugProperties),u.$sdk_debug_retry_queue_size=(x=this.Vi)==null?void 0:x.length}catch(E){u.$sdk_debug_error_capturing_properties=String(E)}if(this.requestRouter.region===dg&&(u.$lib_custom_api_host=this.config.api_host),f=t!==Co||a?t!==Lf||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,o),u=pt(u,f),t===Co&&ce&&(u.title=ce.title),!de(c)){var S=i.getTime()-c;u.$duration=parseFloat((S/1e3).toFixed(3))}br&&this.config.opt_out_useragent_filter&&(u.$browser_type=this._is_bot()?"bot":"browser"),(u=pt({},g,this.persistence.properties(),this.sessionPersistence.properties(),u)).$is_identified=this._isIdentified(),We(this.config.property_denylist)?Je(this.config.property_denylist,(function(E){delete u[E]})):he.error(VS+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var w=this.config.sanitize_properties;w&&(he.error(M0),u=w(u,t));var C=this.nn();return u.$process_person_profile=C,C&&!a&&this.sn("_calculate_event_properties"),u}tn(t,r,i){var o;if(r===void 0&&(r=!0),i===void 0&&(i=!1),!this.persistence||!this.nn()||this.Mi&&!i)return t;var a=this.persistence.get_initial_props(),c=(o=this.sessionPropsManager)==null?void 0:o.getSetOnceProps(),u=pt({},a,c||{},t||{}),p=this.config.sanitize_properties;return p&&(he.error(M0),u=p(u,"$set_once")),r&&(this.Mi=!0),Eo(u)?void 0:u}register(t,r){var i;(i=this.persistence)==null||i.register(t,r)}register_once(t,r,i){var o;(o=this.persistence)==null||o.register_once(t,r,i)}register_for_session(t){var r;(r=this.sessionPersistence)==null||r.register(t)}unregister(t){var r;(r=this.persistence)==null||r.unregister(t)}unregister_for_session(t){var r;(r=this.sessionPersistence)==null||r.unregister(t)}an(t,r){this.register({[t]:r})}getFeatureFlag(t,r){var i;return(i=this.featureFlags)==null?void 0:i.getFeatureFlag(t,r)}getFeatureFlagPayload(t){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagPayload(t)}getFeatureFlagResult(t,r){var i;return(i=this.featureFlags)==null?void 0:i.getFeatureFlagResult(t,r)}isFeatureEnabled(t,r){var i;return(i=this.featureFlags)==null?void 0:i.isFeatureEnabled(t,r)}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,r,i){var o;(o=this.featureFlags)==null||o.updateFlags(t,r,i)}updateEarlyAccessFeatureEnrollment(t,r,i){var o;(o=this.featureFlags)==null||o.updateEarlyAccessFeatureEnrollment(t,r,i)}getEarlyAccessFeatures(t,r,i){var o;return r===void 0&&(r=!1),(o=this.featureFlags)==null?void 0:o.getEarlyAccessFeatures(t,r,i)}on(t,r){return this.Fi.on(t,r)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Xa}),()=>{})}onSessionId(t){var r,i;return(r=(i=this.sessionManager)==null?void 0:i.onSessionId(t))!==null&&r!==void 0?r:()=>{}}getSurveys(t,r){r===void 0&&(r=!1),this.surveys?this.surveys.getSurveys(t,r):t([],{isLoaded:!1,error:Xa})}getActiveMatchingSurveys(t,r){r===void 0&&(r=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,r):t([],{isLoaded:!1,error:Xa})}renderSurvey(t,r){var i;(i=this.surveys)==null||i.renderSurvey(t,r)}displaySurvey(t,r){var i;r===void 0&&(r=M5),(i=this.surveys)==null||i.displaySurvey(t,r)}cancelPendingSurvey(t){var r;(r=this.surveys)==null||r.cancelPendingSurvey(t)}canRenderSurvey(t){var r,i;return(r=(i=this.surveys)==null?void 0:i.canRenderSurvey(t))!==null&&r!==void 0?r:{visible:!1,disabledReason:Xa}}canRenderSurveyAsync(t,r){var i,o;return r===void 0&&(r=!1),(i=(o=this.surveys)==null?void 0:o.canRenderSurveyAsync(t,r))!==null&&i!==void 0?i:Promise.resolve({visible:!1,disabledReason:Xa})}ln(t){return!t||Eh(t)?(he.critical("Unique user id has not been set in posthog.identify"),!1):t===hh?(he.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(he.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,r,i){if(!this.__loaded||!this.persistence)return he.uninitializedWarning("posthog.identify");if(Qr(t)&&(t=t.toString(),he.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.ln(t)&&this.sn("posthog.identify")){var o=this.get_distinct_id();this.register({$user_id:t}),this.get_property(Qh)||this.register_once({$had_persisted_distinct_id:!0,$device_id:o},""),t!==o&&t!==this.get_property(ul)&&(this.unregister(ul),this.register({distinct_id:t}));var a,c=(this.persistence.get_property(ni)||go)===go;t!==o&&c?(this.persistence.set_property(ni,vo),this.setPersonPropertiesForFlags({$set:r||{},$set_once:i||{}},!1),this.capture(Mf,{distinct_id:t,$anon_distinct_id:o},{$set:r||{},$set_once:i||{}}),this.Di=j0(t,r,i),(a=this.featureFlags)==null||a.setAnonymousDistinctId(o)):(r||i)&&this.setPersonProperties(r,i),t!==o&&(this.reloadFeatureFlags(),this.unregister(wl))}}setPersonProperties(t,r){if((t||r)&&this.sn("posthog.setPersonProperties")){var i=j0(this.get_distinct_id(),t,r);this.Di!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:r||{}},!0),this.capture("$set",{$set:t||{},$set_once:r||{}}),this.Di=i):he.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,r,i){if(t&&r){var o=this.getGroups(),a=o[t]!==r;if(a&&this.resetGroupPropertiesForFlags(t),this.register({$groups:ne({},o,{[t]:r})}),a||i){var c={$group_type:t,$group_key:r};i&&(c.$group_set=i),this.capture(f0,c)}i&&this.setGroupPropertiesForFlags({[t]:i}),a&&!i&&this.reloadFeatureFlags()}else he.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,r){var i;r===void 0&&(r=!0),(i=this.featureFlags)==null||i.setPersonPropertiesForFlags(t,r)}resetPersonPropertiesForFlags(){var t;(t=this.featureFlags)==null||t.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,r){var i;r===void 0&&(r=!0),this.sn("posthog.setGroupPropertiesForFlags")&&((i=this.featureFlags)==null||i.setGroupPropertiesForFlags(t,r))}resetGroupPropertiesForFlags(t){var r;(r=this.featureFlags)==null||r.resetGroupPropertiesForFlags(t)}reset(t){var r,i,o,a,c,u,p,f;if(he.info("reset"),!this.__loaded)return he.uninitializedWarning("posthog.reset");var g=this.get_property(Qh);if(this.consent.reset(),(r=this.persistence)==null||r.clear(),(i=this.sessionPersistence)==null||i.clear(),(o=this.surveys)==null||o.reset(),(a=this.Ki)==null||a.stop(),(c=this.featureFlags)==null||c.reset(),(u=this.conversations)==null||u.reset(),(p=this.persistence)==null||p.set_property(ni,go),(f=this.sessionManager)==null||f.resetSessionId(),this.Di=null,this.config.cookieless_mode===Ji)this.register_once({distinct_id:hh,$device_id:null},"");else{var _=this.config.get_device_id(Os());this.register_once({distinct_id:_,$device_id:t?_:g},"")}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(t,r){var i;this.config.identity_distinct_id=t,this.config.identity_hash=r,this.alias(t),(i=this.conversations)==null||i.un()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,(t=this.conversations)==null||t.hn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,r;return(t=(r=this.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:r,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),o=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+r);if(t!=null&&t.withTimestamp&&i){var a,c=(a=t.timestampLookBack)!==null&&a!==void 0?a:10;if(!i)return o;o+="?t="+Math.max(Math.floor((new Date().getTime()-i)/1e3)-c,0)}return o}alias(t,r){return t===this.get_property(_S)?(he.critical("Attempting to create alias for existing People user - aborting."),-2):this.sn("posthog.alias")?(de(r)&&(r=this.get_distinct_id()),t!==r?(this.an(ul,t),this.capture("$create_alias",{alias:t,distinct_id:r})):(he.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var r=ne({},this.config);if(yt(t)){var i,o,a,c,u,p,f,g,_,y;pt(this.config,B0(t));var x=this.qi();(i=this.persistence)==null||i.update_config(this.config,r,x),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new If(ne({},this.config,{persistence:"sessionStorage"}),x);var S=this.Bi(this.config.debug);bi(S)&&(this.config.debug=S),bi(this.config.debug)&&(this.config.debug?(cr.DEBUG=!0,lt.R()&<.M("ph_debug",!0),he.info("set_config",{config:t,oldConfig:r,newConfig:ne({},this.config)})):(cr.DEBUG=!1,lt.R()&<.F("ph_debug"))),(o=this.exceptionObserver)==null||o.onConfigChange(),(a=this.exceptions)==null||a.onConfigChange(),(c=this.sessionRecording)==null||c.startIfEnabledOrStop(),(u=this.autocapture)==null||u.startIfEnabled(),(p=this.heatmaps)==null||p.startIfEnabled(),(f=this.exceptionObserver)==null||f.startIfEnabledOrStop(),(g=this.deadClicksAutocapture)==null||g.startIfEnabledOrStop(),(_=this.surveys)==null||_.loadIfEnabled(),this.cn(),(y=this.externalIntegrations)==null||y.startIfEnabledOrStop()}}_overrideSDKInfo(t,r){cr.LIB_NAME=t,cr.LIB_VERSION=r}startSessionRecording(t){var r,i,o,a,c,u=t===!0,p={sampling:u||!(t==null||!t.sampling),linked_flag:u||!(t==null||!t.linked_flag),url_trigger:u||!(t==null||!t.url_trigger),event_trigger:u||!(t==null||!t.event_trigger)};Object.values(p).some(Boolean)&&((r=this.sessionManager)==null||r.checkAndGetSessionAndWindowId(),p.sampling&&((i=this.sessionRecording)==null||i.overrideSampling()),p.linked_flag&&((o=this.sessionRecording)==null||o.overrideLinkedFlag()),p.url_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger("url")),p.event_trigger&&((c=this.sessionRecording)==null||c.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)==null||!t.started)}captureException(t,r){if(this.exceptions){var i=new Error("PostHog syntheticException"),o=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(ne({},o,r))}}addExceptionStep(t,r){var i;(i=this.exceptions)==null||i.addExceptionStep(t,r)}captureLog(t){var r;(r=this.logs)==null||r.captureLog(t)}get logger(){var t,r;return(t=(r=this.logs)==null?void 0:r.logger)!==null&&t!==void 0?t:yn.dn}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var r,i;return(r=(i=this.toolbar)==null?void 0:i.loadToolbar(t))!==null&&r!==void 0&&r}get_property(t){var r;return(r=this.persistence)==null?void 0:r.props[t]}getSessionProperty(t){var r;return(r=this.sessionPersistence)==null?void 0:r.props[t]}toString(){var t,r=(t=this.config.name)!==null&&t!==void 0?t:ko;return r!==ko&&(r=ko+"."+r),r}_isIdentified(){var t,r;return((t=this.persistence)==null?void 0:t.get_property(ni))===vo||((r=this.sessionPersistence)==null?void 0:r.get_property(ni))===vo}nn(){var t,r;return!(this.config.person_profiles==="never"||this.config.person_profiles===ng&&!this._isIdentified()&&Eo(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[ul])&&((r=this.persistence)==null||(r=r.props)==null||!r[Jh]))}Qi(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.nn()||this.sn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.sn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}sn(t){return this.config.person_profiles==="never"?(he.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.an(Jh,!0),!0)}qi(){if(this.config.cookieless_mode==="always")return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==mn)}cn(){var t,r,i,o,a=this.qi();return((t=this.persistence)==null?void 0:t._r)!==a&&((i=this.persistence)==null||i.set_disabled(a)),((r=this.sessionPersistence)==null?void 0:r._r)!==a&&((o=this.sessionPersistence)==null||o.set_disabled(a)),a}opt_in_capturing(t){var r;if(this.config.cookieless_mode!==Ji){if(this.Ni()){var i,o,a,c,u;this.reset(!0),(i=this.sessionManager)==null||i.destroy(),(o=this.pageViewManager)==null||o.destroy(),this.sessionManager=new R0(this),this.pageViewManager=new _0(this),this.persistence&&(this.sessionPropsManager=new P0(this,this.sessionManager,this.persistence));var p,f=(a=(c=this.config.__extensionClasses)==null?void 0:c.sessionRecording)!==null&&a!==void 0?a:(u=yn.__defaultExtensionClasses)==null?void 0:u.sessionRecording;f&&(this.sessionRecording=this.Ei(this.sessionRecording,new f(this)),this.Wi&&((p=this.sessionRecording)==null||p.onRemoteConfig==null||p.onRemoteConfig(this.Wi)))}var g,_;this.consent.optInOut(!0),this.cn(),this.Xi(),(r=this.sessionRecording)==null||r.startIfEnabledOrStop(),this.config.cookieless_mode==mn&&((g=this.surveys)==null||g.loadIfEnabled()),(de(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((_=t==null?void 0:t.captureEventName)!==null&&_!==void 0?_:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Ji()}else he.warn(L0)}opt_out_capturing(){var t,r,i;this.config.cookieless_mode!==Ji?(this.config.cookieless_mode===mn&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.cn(),this.config.cookieless_mode===mn&&(this.register({distinct_id:hh,$device_id:null}),(t=this.sessionManager)==null||t.destroy(),(r=this.pageViewManager)==null||r.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(i=this.sessionRecording)==null||i.stopRecording(),this.sessionRecording=void 0,this.Ji())):he.warn(L0)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===Ji||(this.config.cookieless_mode===mn?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.cn()}_is_bot(){return Tr?US(Tr,this.config.custom_blocked_useragents):void 0}Ji(){ce&&(ce.visibilityState==="visible"?this.Oi||(this.Oi=!0,this.capture(Co,{title:ce.title},{send_instantly:!0}),this.Pi&&(ce.removeEventListener(Zh,this.Pi),this.Pi=null)):this.Pi||(this.Pi=this.Ji.bind(this),wt(ce,Zh,this.Pi)))}debug(t){t===!1?(U==null||U.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(U==null||U.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Fr(){var t,r,i,o,a,c,u=this.ji||{};return"advanced_disable_flags"in u?!!u.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(he.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",o=he,a=(r="advanced_disable_flags")in(t=u)&&!$e(t[r]),c=i in t&&!$e(t[i]),a?t[r]:!!c&&(o&&o.warn("Config field '"+i+"' is deprecated. Please use '"+r+"' instead. The old field will be removed in a future major version."),t[i]))}rn(t){if($e(this.config.before_send))return t;var r=We(this.config.before_send)?this.config.before_send:[this.config.before_send],i=t;for(var o of r){if(i=o(i),$e(i)){var a="Event '"+t.event+"' was rejected in beforeSend function";return uE(t.event)?he.warn(a+". This can cause unexpected behavior."):he.info(a),null}i.properties&&!Eo(i.properties)||he.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var t;return(t=this.pageViewManager.dr)==null?void 0:t.pageViewId}captureTraceFeedback(t,r){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:r})}captureTraceMetric(t,r,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:r,$ai_metric_value:String(i)})}Bi(t){var r=bi(t)&&!t,i=lt.R()&<.O("ph_debug")==="true";return!r&&(!!i||t)}};El.__defaultExtensionClasses={},El.dn={trace:mo=()=>{},debug:mo,info:mo,warn:mo,error:mo,fatal:mo},(function(e,t){for(var r=0;t.length>r;r++)e.prototype[t[r]]=GE(e.prototype[t[r]])})(El,["identify"]);var $5=1,A5=3,N5=11;function I0(e){return e instanceof Element&&(e.id===bS||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function $n(e){return!!e&&e.nodeType===$5}function li(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function GS(e){return!!e&&e.nodeType===A5}function YS(e){return!!e&&e.nodeType===N5&&$n(e.host)}function kv(e){return e?xu(e).split(/\s+/):[]}function O0(e){var t=U==null?void 0:U.location.href;return!!(t&&e&&e.some((r=>t.match(r))))}function au(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return kv(t)}function XS(e){return $e(e)?null:xu(e).split(/(\s+)/).filter((t=>Pl(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Fl(e){var t="";return vg(e)&&!ZS(e)&&e.childNodes&&e.childNodes.length&&Je(e.childNodes,(function(r){var i;GS(r)&&r.textContent&&(t+=(i=XS(r.textContent))!==null&&i!==void 0?i:"")})),xu(t)}function F0(e){return de(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Ev=["a","button","form","input","select","textarea","label"];function $0(e,t){if(de(t))return!0;var r,i=function(a){if(t.some((c=>a.matches(c))))return{v:!0}};for(var o of e)if(r=i(o))return r.v;return!1}function JS(e){var t=e.parentNode;return!(!t||!$n(t))&&t}var z5=["next","previous","prev",">","<"],A0=[".ph-no-rageclick",".ph-no-capture"],gg=e=>!e||li(e,"html")||!$n(e),N0=(e,t)=>{if(!U||gg(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,i=[e],o=e;o.parentNode&&!li(o,"body");)if(YS(o.parentNode))i.push(o.parentNode.host),o=o.parentNode.host;else{var a=JS(o);if(!a)break;if(t||Ev.indexOf(a.tagName.toLowerCase())>-1)r=!0;else{var c=U.getComputedStyle(a);c&&c.getPropertyValue("cursor")==="pointer"&&(r=!0)}i.push(a),o=a}return{parentIsUsefulElement:r,targetElementList:i}};function vg(e){for(var t=e;t.parentNode&&!li(t,"body");t=t.parentNode){var r=au(t);if(Fe(r,"ph-sensitive")||Fe(r,"ph-no-capture"))return!1}if(Fe(au(e),"ph-include"))return!0;var i=e.type||"";if(ct(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var o=e.name||e.id||"";return!ct(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function ZS(e){return!!(li(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||li(e,"select")||li(e,"textarea")||e.getAttribute("contenteditable")==="true")}var eb="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",W5=new RegExp("^(?:"+eb+")$"),H5=new RegExp(eb),tb="\\d{3}-?\\d{2}-?\\d{4}",U5=new RegExp("^("+tb+")$"),K5=new RegExp("("+tb+")");function Pl(e,t){return t===void 0&&(t=!0),!($e(e)||ct(e)&&(e=xu(e),(t?W5:H5).test((e||"").replace(/[- ]/g,""))||(t?U5:K5).test(e)))}function z0(e){var t=Fl(e);return Pl(t=(t+" "+rb(e)).trim())?t:""}function rb(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Je(e.childNodes,(function(r){var i;if(r&&((i=r.tagName)==null?void 0:i.toLowerCase())==="span")try{var o=Fl(r);t=(t+" "+o).trim(),r.childNodes&&r.childNodes.length&&(t=(t+" "+rb(r)).trim())}catch(a){he.error("[AutoCapture]",a)}})),t}function W0(e){return e.replace(/"|\\"/g,'\\"')}function q5(e){var t=e.attr__class;return t?We(t)?t:kv(t):void 0}let H0=class{constructor(t){this.disabled=t===!1;var r=yt(t)?t:{};this.thresholdPx=r.threshold_px||30,this.timeoutMs=r.timeout_ms||1e3,this.clickCount=r.click_count||3,this.clicks=[]}isRageClick(t,r,i){if(this.disabled)return!1;var o=this.clicks[this.clicks.length-1];if(o&&Math.abs(t-o.x)+Math.abs(r-o.y)<this.thresholdPx&&this.timeoutMs>i-o.timestamp){if(this.clicks.push({x:t,y:r,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:r,timestamp:i}];return!1}};var Hf="$copy_autocapture",Uf=tt("[AutoCapture]");function Kf(e,t){return t.length>e?t.slice(0,e)+"...":t}function V5(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!$n(t));return t}function Q5(e,t){var r,i,{e:o,maskAllElementAttributes:a,maskAllText:c,elementAttributeIgnoreList:u,elementsChainAsString:p}=t;if(!$n(e))return{props:{}};for(var f=[e],g=e;g.parentNode&&!li(g,"body");)if(YS(g.parentNode))f.push(g.parentNode.host),g=g.parentNode.host;else{if(!$n(g.parentNode))break;f.push(g.parentNode),g=g.parentNode}var _,y,x=[],S={},w=!1,C=!1;if(Je(f,(M=>{var F=vg(M);if(li(M,"a")){var W=M.getAttribute("href");w=F&&!!W&&Pl(W)&&W}Fe(au(M),"ph-no-capture")&&(C=!0),x.push((function(K,ie,oe,Q){var N=K.tagName.toLowerCase(),q={tag_name:N};Ev.indexOf(N)>-1&&!oe&&(q.$el_text=N.toLowerCase()==="a"||N.toLowerCase()==="button"?Kf(1024,z0(K)):Kf(1024,Fl(K)));var Y=au(K);Y.length>0&&(q.classes=Y.filter((function(Z){return Z!==""}))),Je(K.attributes,(function(Z){var ee;if((!ZS(K)||["name","id","class","aria-label"].indexOf(Z.name)!==-1)&&(Q==null||!Q.includes(Z.name))&&!ie&&Pl(Z.value)&&(!ct(ee=Z.name)||ee.substring(0,10)!=="_ngcontent"&&ee.substring(0,7)!=="_nghost")){var D=Z.value;Z.name==="class"&&(D=kv(D).join(" ")),q["attr__"+Z.name]=Kf(1024,D)}}));for(var re=1,le=1,$=K;$=V5($);)re++,$.tagName===K.tagName&&le++;return q.nth_child=re,q.nth_of_type=le,q})(M,a,c,u));var H=(function(K){if(!vg(K))return{};var ie={};return Je(K.attributes,(function(oe){if(oe.name&&oe.name.indexOf("data-ph-capture-attribute")===0){var Q=oe.name.replace("data-ph-capture-attribute-",""),N=oe.value;Q&&N&&Pl(N)&&(ie[Q]=N)}})),ie})(M);pt(S,H)})),C)return{props:{},explicitNoCapture:C};if(c||(x[0].$el_text=li(e,"a")||li(e,"button")?z0(e):Fl(e)),w){var E,I;x[0].attr__href=w;var k=(E=tu(w))==null?void 0:E.host,R=U==null||(I=U.location)==null?void 0:I.host;k&&R&&k!==R&&(_=w)}return{props:pt({$event_type:o.type,$ce_version:1},p?{}:{$elements:x},{$elements_chain:(y=x,(function(M){return M.map((F=>{var W,H,K="";if(F.tag_name&&(K+=F.tag_name),F.attr_class)for(var ie of(F.attr_class.sort(),F.attr_class))K+="."+ie.replace(/"/g,"");var oe=ne({},F.text?{text:F.text}:{},{"nth-child":(W=F.nth_child)!==null&&W!==void 0?W:0,"nth-of-type":(H=F.nth_of_type)!==null&&H!==void 0?H:0},F.href?{href:F.href}:{},F.attr_id?{attr_id:F.attr_id}:{},F.attributes),Q={};return jh(oe).sort(((N,q)=>{var[Y]=N,[re]=q;return Y.localeCompare(re)})).forEach((N=>{var[q,Y]=N;return Q[W0(q.toString())]=W0(Y.toString())})),(K+=":")+jh(Q).map((N=>{var[q,Y]=N;return q+'="'+Y+'"'})).join("")})).join(";")})((function(M){return M.map((F=>{var W,H,K={text:(W=F.$el_text)==null?void 0:W.slice(0,400),tag_name:F.tag_name,href:(H=F.attr__href)==null?void 0:H.slice(0,2048),attr_class:q5(F),attr_id:F.attr__id,nth_child:F.nth_child,nth_of_type:F.nth_of_type,attributes:{}};return jh(F).filter((ie=>{var[oe]=ie;return oe.indexOf("attr__")===0})).forEach((ie=>{var[oe,Q]=ie;return K.attributes[oe]=Q})),K}))})(y)))},(r=x[0])!=null&&r.$el_text?{$el_text:(i=x[0])==null?void 0:i.$el_text}:{},_&&o.type==="click"?{$external_click_url:_}:{},S)}}var Ja=tt("[ExceptionAutocapture]");function U0(e,t,r){try{if(!(t in e))return()=>{};var i=e[t],o=r(i);return Vi(o)&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=o,()=>{e[t]=i}}catch{return()=>{}}}var G5=tt("[TracingHeaders]"),Es=tt("[Web Vitals]"),K0=9e5,q0="disabled",V0="lazy_loading",Za="awaiting_config",vh="missing_config";tt("[SessionRecording]"),tt("[SessionRecording]");var _g="[SessionRecording]",Ps=tt(_g),Y5=tt("[Heatmaps]");function Q0(e){return yt(e)&&"clientX"in e&&"clientY"in e&&Qr(e.clientX)&&Qr(e.clientY)}var G0=tt("[Product Tours]"),X5=["$set_once","$set"],Rs=tt("[SiteApps]"),Y0="Error while initializing PostHog app with config id ";function yo(e,t,r){if($e(e))return!1;switch(r){case"exact":return e===t;case"contains":var i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}let J5=class{constructor(t){this.vn=new Cv,this.fn=(r,i)=>this.pn(r,i)&&this.gn(r,i)&&this.mn(r,i)&&this.yn(r,i),this.pn=(r,i)=>i==null||!i.event||(r==null?void 0:r.event)===(i==null?void 0:i.event),this._instance=t,this.bn=new Set,this._n=new Set}init(){var t,r;de((t=this._instance)==null?void 0:t._addCaptureHook)||(r=this._instance)==null||r._addCaptureHook(((i,o)=>{this.on(i,o)}))}register(t){var r,i;if(!de((r=this._instance)==null?void 0:r._addCaptureHook)&&(t.forEach((c=>{var u,p;(u=this._n)==null||u.add(c),(p=c.steps)==null||p.forEach((f=>{var g;(g=this.bn)==null||g.add((f==null?void 0:f.event)||"")}))})),(i=this._instance)!=null&&i.autocapture)){var o,a=new Set;t.forEach((c=>{var u;(u=c.steps)==null||u.forEach((p=>{p!=null&&p.selector&&a.add(p==null?void 0:p.selector)}))})),(o=this._instance)==null||o.autocapture.setElementSelectors(a)}}on(t,r){var i;r!=null&&t.length!=0&&(this.bn.has(t)||this.bn.has(r==null?void 0:r.event))&&this._n&&((i=this._n)==null?void 0:i.size)>0&&this._n.forEach((o=>{this.wn(r,o)&&this.vn.emit("actionCaptured",o.name)}))}In(t){this.onAction("actionCaptured",(r=>t(r)))}wn(t,r){if((r==null?void 0:r.steps)==null)return!1;for(var i of r.steps)if(this.fn(t,i))return!0;return!1}onAction(t,r){return this.vn.on(t,r)}gn(t,r){if(r!=null&&r.url){var i,o=t==null||(i=t.properties)==null?void 0:i.$current_url;if(!o||typeof o!="string"||!yo(o,r.url,r.url_matching||"contains"))return!1}return!0}mn(t,r){return!!this.Cn(t,r)&&!!this.Sn(t,r)&&!!this.xn(t,r)}Cn(t,r){var i;if(r==null||!r.href)return!0;var o=this.kn(t);if(o.length>0)return o.some((u=>yo(u.href,r.href,r.href_matching||"exact")));var a,c=(t==null||(i=t.properties)==null?void 0:i.$elements_chain)||"";return!!c&&yo((a=c.match(/(?::|")href="(.*?)"/))?a[1]:"",r.href,r.href_matching||"exact")}Sn(t,r){var i;if(r==null||!r.text)return!0;var o=this.kn(t);if(o.length>0)return o.some((f=>yo(f.text,r.text,r.text_matching||"exact")||yo(f.$el_text,r.text,r.text_matching||"exact")));var a,c,u,p=(t==null||(i=t.properties)==null?void 0:i.$elements_chain)||"";return!!p&&(a=(function(f){for(var g,_=[],y=/(?::|")text="(.*?)"/g;!$e(g=y.exec(f));)_.includes(g[1])||_.push(g[1]);return _})(p),c=r.text,u=r.text_matching||"exact",a.some((f=>yo(f,c,u))))}xn(t,r){var i,o;if(r==null||!r.selector)return!0;var a=t==null||(i=t.properties)==null?void 0:i.$element_selectors;if(a!=null&&a.includes(r.selector))return!0;var c=(t==null||(o=t.properties)==null?void 0:o.$elements_chain)||"";if(r.selector_regex&&c)try{return new RegExp(r.selector_regex).test(c)}catch{return!1}return!1}kn(t){var r;return(t==null||(r=t.properties)==null?void 0:r.$elements)==null?[]:t==null?void 0:t.properties.$elements}yn(t,r){return r==null||!r.properties||r.properties.length===0||qS(r.properties.reduce(((i,o)=>{var a=We(o.value)?o.value.map(String):o.value!=null?[String(o.value)]:[];return i[o.key]={values:a,operator:o.operator||"exact"},i}),{}),t==null?void 0:t.properties)}},Z5=class{constructor(t){this._instance=t,this.Tn=new Map,this.An=new Map,this.En=new Map}Rn(t,r){return!!t&&qS(t.propertyFilters,r==null?void 0:r.properties)}Nn(t,r){var i=new Map;return t.forEach((o=>{var a;(a=o.conditions)==null||(a=a[r])==null||(a=a.values)==null||a.forEach((c=>{if(c!=null&&c.name){var u=i.get(c.name)||[];u.push(o.id),i.set(c.name,u)}}))})),i}Mn(t,r,i){var o=(i===Va.Activation?this.Tn:this.An).get(t),a=[];return this.Fn((c=>{a=c.filter((u=>o==null?void 0:o.includes(u.id)))})),a.filter((c=>{var u,p=(u=c.conditions)==null||(u=u[i])==null||(u=u.values)==null?void 0:u.find((f=>f.name===t));return this.Rn(p,r)}))}register(t){var r;de((r=this._instance)==null?void 0:r._addCaptureHook)||(this.On(t),this.Pn(t))}Pn(t){var r=t.filter((i=>{var o,a;return((o=i.conditions)==null?void 0:o.actions)&&((a=i.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length)>0}));r.length!==0&&(this.Ln==null&&(this.Ln=new J5(this._instance),this.Ln.init(),this.Ln.In((i=>{this.onAction(i)}))),r.forEach((i=>{var o,a,c,u,p;i.conditions&&(o=i.conditions)!=null&&o.actions&&(a=i.conditions)!=null&&(a=a.actions)!=null&&a.values&&((c=i.conditions)==null||(c=c.actions)==null||(c=c.values)==null?void 0:c.length)>0&&((u=this.Ln)==null||u.register(i.conditions.actions.values),(p=i.conditions)==null||(p=p.actions)==null||(p=p.values)==null||p.forEach((f=>{if(f&&f.name){var g=this.En.get(f.name);g&&g.push(i.id),this.En.set(f.name,g||[i.id])}})))})))}On(t){var r,i=t.filter((a=>{var c,u;return((c=a.conditions)==null?void 0:c.events)&&((u=a.conditions)==null||(u=u.events)==null||(u=u.values)==null?void 0:u.length)>0})),o=t.filter((a=>{var c,u;return((c=a.conditions)==null?void 0:c.cancelEvents)&&((u=a.conditions)==null||(u=u.cancelEvents)==null||(u=u.values)==null?void 0:u.length)>0}));i.length===0&&o.length===0||((r=this._instance)==null||r._addCaptureHook(((a,c)=>{this.onEvent(a,c)})),this.Tn=this.Nn(t,Va.Activation),this.An=this.Nn(t,Va.Cancellation))}onEvent(t,r){var i,o=this.le(),a=this.Dn(),c=this.Bn(),u=((i=this._instance)==null||(i=i.persistence)==null?void 0:i.props[a])||[];if(c===t&&r&&u.length>0){var p,f;o.info("event matched, removing item from activated items",{event:t,eventPayload:r,existingActivatedItems:u});var g=(r==null||(p=r.properties)==null?void 0:p.$survey_id)||(r==null||(f=r.properties)==null?void 0:f.$product_tour_id);if(g){var _=u.indexOf(g);0>_||(u.splice(_,1),this.jn(u))}}else{if(this.An.has(t)){var y=this.Mn(t,r,Va.Cancellation);y.length>0&&(o.info("cancel event matched, cancelling items",{event:t,itemsToCancel:y.map((S=>S.id))}),y.forEach((S=>{var w=u.indexOf(S.id);0>w||u.splice(w,1),this.$n(S.id)})),this.jn(u))}if(this.Tn.has(t)){o.info("event name matched",{event:t,eventPayload:r,items:this.Tn.get(t)});var x=this.Mn(t,r,Va.Activation);this.jn(u.concat(x.map((S=>S.id))||[]))}}}onAction(t){var r,i=this.Dn(),o=((r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[i])||[];this.En.has(t)&&this.jn(o.concat(this.En.get(t)||[]))}jn(t){var r=this.le(),i=[...new Set(t)].filter((o=>!this.qn(o)));r.info("updating activated items",{activatedItems:i}),this.Zn(i)}getActivatedIds(){var t,r=this.Dn();return((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[r])||[]}getEventToItemsMap(){return this.Tn}Hn(){return this.Ln}},eP=class extends Z5{constructor(t){super(t)}Dn(){return Jp}Bn(){return vl.SHOWN}Fn(t){var r;(r=this._instance)==null||r.getSurveys(t)}$n(t){var r;(r=this._instance)==null||r.cancelPendingSurvey(t)}le(){return Ve}Zn(t){var r;(r=this._instance)==null||(r=r.persistence)==null||r.register({[Jp]:t})}qn(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}};var qf="SDK is not enabled or survey functionality is not yet loaded",X0="Disabled. Not loading surveys.",tP=U!=null&&U.location?iu(U.location.hash,"__posthog")||iu(location.hash,"state"):null,J0="_postHogToolbarParams",Z0=tt("[Toolbar]"),ir=tt("[FeatureFlags]"),pn=tt("[FeatureFlags]",{debugEnabled:!0}),Vf=`" failed. Feature flags didn't load in time.`,e1=e=>{for(var t={},r=0;e.length>r;r++)t[e[r]]=!0;return t},t1=e=>{var t={};for(var[r,i]of jh(e||{}))i&&(t[r]=i);return t},zi=tt("[Error tracking]"),r1="Refusing to render web experiment since the viewer is a likely bot",rP={icontains:(e,t)=>!!U&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!U&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!U&&ou(t.href,e),not_regex:(e,t)=>!!U&&!ou(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};let iP=class or{get Bt(){return this._instance.config}constructor(t){var r=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(i){i===void 0&&(i=!1),r.getWebExperiments((o=>{or.Vn("retrieved web experiments from the server"),r.zn=new Map,o.forEach((a=>{if(a.feature_flag_key){var c;r.zn&&(or.Vn("setting flag key ",a.feature_flag_key," to web experiment ",a),(c=r.zn)==null||c.set(a.feature_flag_key,a));var u=r._instance.getFeatureFlag(a.feature_flag_key);ct(u)&&a.variants[u]&&r.Un(a.name,u,a.variants[u].transforms)}else if(a.variants)for(var p in a.variants){var f=a.variants[p];or.Yn(f)&&r.Un(a.name,p,f.transforms)}}))}),i)},this._instance=t,this._instance.onFeatureFlags((i=>{this.onFeatureFlags(i)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())or.Vn(r1);else if(!this.Bt.disable_web_experiments){if($e(this.zn))return this.zn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();or.Vn("applying feature flags",t),t.forEach((r=>{var i;if(this.zn&&(i=this.zn)!=null&&i.has(r)){var o,a=this._instance.getFeatureFlag(r),c=(o=this.zn)==null?void 0:o.get(r);a&&c!=null&&c.variants[a]&&this.Un(c.name,a,c.variants[a].transforms)}}))}}previewWebExperiment(){var t=or.getWindowLocation();if(t!=null&&t.search){var r=ru(t==null?void 0:t.search,"__experiment_id"),i=ru(t==null?void 0:t.search,"__experiment_variant");r&&i&&(or.Vn("previewing web experiments "+r+" && "+i),this.getWebExperiments((o=>{this.Gn(parseInt(r),i,o)}),!1,!0))}}loadIfEnabled(){this.Bt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,r,i){if(this.Bt.disable_web_experiments&&!i)return t([]);var o=this._instance.get_property("$web_experiments");if(o&&!r)return t(o);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Bt.token),method:"GET",callback:a=>t(a.statusCode===200&&a.json&&a.json.experiments||[])})}Gn(t,r,i){var o=i.filter((a=>a.id===t));o&&o.length>0&&(or.Vn("Previewing web experiment ["+o[0].name+"] with variant ["+r+"]"),this.Un(o[0].name,r,o[0].variants[r].transforms))}static Yn(t){return!$e(t.conditions)&&or.Wn(t)&&or.Xn(t)}static Wn(t){var r;if($e(t.conditions)||$e((r=t.conditions)==null?void 0:r.url))return!0;var i,o,a,c=or.getWindowLocation();return!!c&&((i=t.conditions)==null||!i.url||rP[(o=(a=t.conditions)==null?void 0:a.urlMatchType)!==null&&o!==void 0?o:"icontains"](t.conditions.url,c))}static getWindowLocation(){return U==null?void 0:U.location}static Xn(t){var r;if($e(t.conditions)||$e((r=t.conditions)==null?void 0:r.utm))return!0;var i=TS();if(i.utm_source){var o,a,c,u,p,f,g,_,y=(o=t.conditions)==null||(o=o.utm)==null||!o.utm_campaign||((a=t.conditions)==null||(a=a.utm)==null?void 0:a.utm_campaign)==i.utm_campaign,x=(c=t.conditions)==null||(c=c.utm)==null||!c.utm_source||((u=t.conditions)==null||(u=u.utm)==null?void 0:u.utm_source)==i.utm_source,S=(p=t.conditions)==null||(p=p.utm)==null||!p.utm_medium||((f=t.conditions)==null||(f=f.utm)==null?void 0:f.utm_medium)==i.utm_medium,w=(g=t.conditions)==null||(g=g.utm)==null||!g.utm_term||((_=t.conditions)==null||(_=_.utm)==null?void 0:_.utm_term)==i.utm_term;return y&&S&&w&&x}return!1}static Vn(t){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;r>o;o++)i[o-1]=arguments[o];he.info("[WebExperiments] "+t,i)}Un(t,r,i){this._is_bot()?or.Vn(r1):r!=="control"?i.forEach((o=>{if(o.selector){var a;or.Vn("applying transform of variant "+r+" for experiment "+t+" ",o);var c=(a=document)==null?void 0:a.querySelectorAll(o.selector);c==null||c.forEach((u=>{var p=u;o.html&&(p.innerHTML=o.html),o.css&&p.setAttribute("style",o.css)}))}})):or.Vn("Control variants leave the page unmodified.")}_is_bot(){return Tr&&this._instance?US(Tr,this.Bt.custom_blocked_useragents):void 0}};var Ar=tt("[Conversations]"),gn="Conversations not available yet.",wu={featureFlags:class{constructor(e){this.Jn=!1,this.Kn=!1,this.Qn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.ns=!1,this.ss=!1,this._instance=e,this.featureFlagEventHandlers=[]}get Bt(){return this._instance.config}get ni(){return this._instance.persistence}os(e){return this._instance.get_property(e)}ls(){var e,t;return(e=(t=this.ni)==null?void 0:t.wr(this.Bt.feature_flag_cache_ttl_ms))!==null&&e!==void 0&&e}us(){return!!this.ls()&&(this.ss||this.Qn||(this.ss=!0,ir.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}hs(){var e,t=(e=this.Bt.evaluation_contexts)!==null&&e!==void 0?e:this.Bt.evaluation_environments;return!this.Bt.evaluation_environments||this.Bt.evaluation_contexts||this.ns||(ir.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ns=!0),t!=null&&t.length?t.filter((r=>{var i=r&&typeof r=="string"&&r.trim().length>0;return i||ir.error("Invalid evaluation context found:",r,"Expected non-empty string"),i})):[]}cs(){return this.hs().length>0}initialize(){var e,t,{config:r}=this._instance,i=(e=(t=r.bootstrap)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(i).length){var o,a,c=(o=(a=r.bootstrap)==null?void 0:a.featureFlagPayloads)!==null&&o!==void 0?o:{},u=Object.keys(i).filter((f=>!!i[f])).reduce(((f,g)=>(f[g]=i[g]||!1,f)),{}),p=Object.keys(c).filter((f=>u[f])).reduce(((f,g)=>(c[g]&&(f[g]=c[g]),f)),{});this.receivedFeatureFlags({featureFlags:u,featureFlagPayloads:p})}}updateFlags(e,t,r){var i=r!=null&&r.merge?this.getFlagVariants():{},o=r!=null&&r.merge?this.getFlagPayloads():{},a=ne({},i,e),c=ne({},o,t),u={};for(var[p,f]of Object.entries(a)){var g=typeof f=="string";u[p]={key:p,enabled:!!g||!!f,variant:g?f:void 0,reason:void 0,metadata:de(c==null?void 0:c[p])?void 0:{id:0,version:void 0,description:void 0,payload:c[p]}}}this.receivedFeatureFlags({flags:u})}get hasLoadedFlags(){return this.Kn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.os(Qp),t=this.os(Ki),r=this.os(wo);if(!r&&!t)return e||{};var i=pt({},e||{}),o=[...new Set([...Object.keys(r||{}),...Object.keys(t||{})])];for(var a of o){var c,u,p=i[a],f=t==null?void 0:t[a],g=de(f)?(c=p==null?void 0:p.enabled)!==null&&c!==void 0&&c:!!f,_=de(f)?p.variant:typeof f=="string"?f:void 0,y=r==null?void 0:r[a],x=ne({},p,{enabled:g,variant:g?_??(p==null?void 0:p.variant):void 0});g!==(p==null?void 0:p.enabled)&&(x.original_enabled=p==null?void 0:p.enabled),_!==(p==null?void 0:p.variant)&&(x.original_variant=p==null?void 0:p.variant),y&&(x.metadata=ne({},p==null?void 0:p.metadata,{payload:y,original_payload:p==null||(u=p.metadata)==null?void 0:u.payload})),i[a]=x}return this.Jn||(ir.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:i}),this.Jn=!0),i}getFlagVariants(){var e=this.os(Po),t=this.os(Ki);if(!t)return e||{};for(var r=pt({},e),i=Object.keys(t),o=0;i.length>o;o++)r[i[o]]=t[i[o]];return this.Jn||(ir.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:r}),this.Jn=!0),r}getFlagPayloads(){var e=this.os(Gp),t=this.os(wo);if(!t)return e||{};for(var r=pt({},e||{}),i=Object.keys(t),o=0;i.length>o;o++)r[i[o]]=t[i[o]];return this.Jn||(ir.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:r}),this.Jn=!0),r}reloadFeatureFlags(){this.es||this.Bt.advanced_disable_feature_flags||this.ds||(this._instance.Fi.emit("featureFlagsReloading",!0),this.ds=setTimeout((()=>{this.vs()}),5))}fs(){clearTimeout(this.ds),this.ds=void 0}ensureFlagsLoaded(){this.Kn||this.Qn||this.ds||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.es=e}vs(e){var t;if(this.fs(),!this._instance.Fr())if(this.Qn)this.ts=!0;else{var r=this.Bt.token,i=this.os(Qh),o={token:r,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:ne({},((t=this.ni)==null?void 0:t.get_initial_props())||{},this.os(gl)||{}),group_properties:this.os(_n),timezone:OS()};is(i)||de(i)||(o.$device_id=i),(e!=null&&e.disableFlags||this.Bt.advanced_disable_feature_flags)&&(o.disable_flags=!0),this.cs()&&(o.evaluation_contexts=this.hs());var a=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Bt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Qn=!0,this._instance._send_request({method:"POST",url:a,data:o,compression:this.Bt.disable_compression?void 0:xi.Base64,timeout:this.Bt.feature_flag_request_timeout_ms,callback:c=>{var u,p,f,g=!0;if(c.statusCode===200&&(this.ts||(this.$anon_distinct_id=void 0),g=!1),this.Qn=!1,!o.disable_flags||this.ts){this.rs=!g;var _=[];c.error?c.error instanceof Error?_.push(c.error.name==="AbortError"?"timeout":"connection_error"):_.push("unknown_error"):c.statusCode!==200&&_.push("api_error_"+c.statusCode),(u=c.json)!=null&&u.errorsWhileComputingFlags&&_.push("errors_while_computing_flags");var y,x=!((p=c.json)==null||(p=p.quotaLimited)==null||!p.includes("feature_flags"));x&&_.push("quota_limited"),(f=this.ni)==null||f.register({[eg]:_}),x?ir.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(o.disable_flags||this.receivedFeatureFlags((y=c.json)!==null&&y!==void 0?y:{},g,{partialResponse:!!this.Bt.advanced_only_evaluate_survey_feature_flags}),this.ts&&(this.ts=!1,this.vs()))}}})}}getFeatureFlag(e,t){var r;if(t===void 0&&(t={}),!t.fresh||this.rs)if(this.Kn||this.getFlags()&&this.getFlags().length>0){if(!this.us()){var i=this.getFeatureFlagResult(e,t);return(r=i==null?void 0:i.variant)!==null&&r!==void 0?r:i==null?void 0:i.enabled}}else ir.warn('getFeatureFlag for key "'+e+Vf)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t==null?void 0:t.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),!t.fresh||this.rs)if(this.Kn||this.getFlags()&&this.getFlags().length>0){if(!this.us()){var r=this.getFlagVariants(),i=e in r,o=r[e],a=this.getFlagPayloads()[e],c=String(o),u=this.os(Yp)||void 0,p=this.os(Yh)||void 0,f=this.os(wl)||{};if(this.Bt.advanced_feature_flags_dedup_per_session){var g,_=this._instance.get_session_id(),y=this.os(Zp);_&&_!==y&&(f={},(g=this.ni)==null||g.register({[wl]:f,[Zp]:_}))}if((t.send_event||!("send_event"in t))&&(!(e in f)||!f[e].includes(c))){var x,S,w,C,E,I,k,R,M,F;We(f[e])?f[e].push(c):f[e]=[c],(x=this.ni)==null||x.register({[wl]:f});var W=this.getFeatureFlagDetails(e),H=[...(S=this.os(eg))!==null&&S!==void 0?S:[]];de(o)&&H.push("flag_missing");var K={$feature_flag:e,$feature_flag_response:o,$feature_flag_payload:a||null,$feature_flag_request_id:u,$feature_flag_evaluated_at:p,$feature_flag_bootstrapped_response:((w=this.Bt.bootstrap)==null||(w=w.featureFlags)==null?void 0:w[e])||null,$feature_flag_bootstrapped_payload:((C=this.Bt.bootstrap)==null||(C=C.featureFlagPayloads)==null?void 0:C[e])||null,$used_bootstrap_value:!this.rs};de(W==null||(E=W.metadata)==null?void 0:E.version)||(K.$feature_flag_version=W.metadata.version);var ie,oe=(I=W==null||(k=W.reason)==null?void 0:k.description)!==null&&I!==void 0?I:W==null||(R=W.reason)==null?void 0:R.code;oe&&(K.$feature_flag_reason=oe),W!=null&&(M=W.metadata)!=null&&M.id&&(K.$feature_flag_id=W.metadata.id),de(W==null?void 0:W.original_variant)&&de(W==null?void 0:W.original_enabled)||(K.$feature_flag_original_response=de(W.original_variant)?W.original_enabled:W.original_variant),W!=null&&(F=W.metadata)!=null&&F.original_payload&&(K.$feature_flag_original_payload=W==null||(ie=W.metadata)==null?void 0:ie.original_payload),H.length&&(K.$feature_flag_error=H.join(",")),this._instance.capture("$feature_flag_called",K)}if(i){var Q=a;if(!de(a))try{Q=JSON.parse(a)}catch{}return{key:e,enabled:!!o,variant:typeof o=="string"?o:void 0,payload:Q}}}}else ir.warn('getFeatureFlagResult for key "'+e+Vf)}getRemoteConfigPayload(e,t){var r=this.Bt.token,i={distinct_id:this._instance.get_distinct_id(),token:r};this.cs()&&(i.evaluation_contexts=this.hs()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:i,compression:this.Bt.disable_compression?void 0:xi.Base64,timeout:this.Bt.feature_flag_request_timeout_ms,callback(o){var a,c=(a=o.json)==null?void 0:a.featureFlagPayloads;t((c==null?void 0:c[e])||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),!t.fresh||this.rs){if(this.Kn||this.getFlags()&&this.getFlags().length>0){var r=this.getFeatureFlag(e,t);return de(r)?void 0:!!r}ir.warn('isFeatureEnabled for key "'+e+Vf)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,r){if(this.ni){this.Kn=!0;var i=this.getFlagVariants(),o=this.getFlagPayloads(),a=this.getFlagsWithDetails();(function(c,u,p,f,g,_){p===void 0&&(p={}),f===void 0&&(f={}),g===void 0&&(g={});var y=(H=>{var K=H.flags;return K?(H.featureFlags=Object.fromEntries(Object.keys(K).map((ie=>{var oe;return[ie,(oe=K[ie].variant)!==null&&oe!==void 0?oe:K[ie].enabled]}))),H.featureFlagPayloads=Object.fromEntries(Object.keys(K).filter((ie=>K[ie].enabled)).filter((ie=>{var oe;return(oe=K[ie].metadata)==null?void 0:oe.payload})).map((ie=>{var oe;return[ie,(oe=K[ie].metadata)==null?void 0:oe.payload]})))):ir.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),H})(c),x=y.flags,S=y.featureFlags,w=y.featureFlagPayloads;if(S){var C=c.requestId,E=c.evaluatedAt;if(We(S)){ir.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var I={};if(S)for(var k=0;S.length>k;k++)I[S[k]]=!0;u&&u.register({[Ph]:S,[Po]:I})}else{var R=S,M=w,F=x;if(_!=null&&_.partialResponse)R=ne({},p,R),M=ne({},f,M),F=ne({},g,F);else if(c.errorsWhileComputingFlags)if(x){var W=new Set(Object.keys(x).filter((H=>{var K;return!((K=x[H])!=null&&K.failed)})));R=ne({},p,Object.fromEntries(Object.entries(R).filter((H=>{var[K]=H;return W.has(K)})))),M=ne({},f,Object.fromEntries(Object.entries(M||{}).filter((H=>{var[K]=H;return W.has(K)})))),F=ne({},g,Object.fromEntries(Object.entries(F||{}).filter((H=>{var[K]=H;return W.has(K)}))))}else R=ne({},p,R),M=ne({},f,M),F=ne({},g,F);u&&u.register(ne({[Ph]:Object.keys(t1(R)),[Po]:R||{},[Gp]:M||{},[Qp]:F||{}},C?{[Yp]:C}:{},E?{[Yh]:E}:{}))}}})(e,this.ni,i,o,a,r),t||(this.ss=!1),this.ps(t)}}override(e,t){t===void 0&&(t=!1),ir.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.ni)return ir.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this.ni.unregister(Ki),this.ni.unregister(wo),this.ps(),pn.info("All overrides cleared");if(We(e)){var t=e1(e);return this.ni.register({[Ki]:t}),this.ps(),pn.info("Flag overrides set",{flags:e})}if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var r,i=e;if(this.Jn=!!((r=i.suppressWarning)!==null&&r!==void 0&&r),"flags"in i){if(i.flags===!1)this.ni.unregister(Ki),pn.info("Flag overrides cleared");else if(i.flags){if(We(i.flags)){var o=e1(i.flags);this.ni.register({[Ki]:o})}else this.ni.register({[Ki]:i.flags});pn.info("Flag overrides set",{flags:i.flags})}}return"payloads"in i&&(i.payloads===!1?(this.ni.unregister(wo),pn.info("Payload overrides cleared")):i.payloads&&(this.ni.register({[wo]:i.payloads}),pn.info("Payload overrides set",{payloads:i.payloads}))),void this.ps()}if(e&&typeof e=="object")return this.ni.register({[Ki]:e}),this.ps(),pn.info("Flag overrides set",{flags:e});ir.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Kn){var{flags:t,flagVariants:r}=this.gs();e(t,r)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,r){var i,o=(this.os(pl)||[]).find((p=>p.flagKey===e)),a={["$feature_enrollment/"+e]:t},c={$feature_flag:e,$feature_enrollment:t,$set:a};o&&(c.$early_access_feature_name=o.name),r&&(c.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",c),this.setPersonPropertiesForFlags(a,!1);var u=ne({},this.getFlagVariants(),{[e]:t});(i=this.ni)==null||i.register({[Ph]:Object.keys(t1(u)),[Po]:u}),this.ps()}getEarlyAccessFeatures(e,t,r){t===void 0&&(t=!1);var i=this.os(pl),o=r?"&"+r.map((a=>"stage="+a)).join("&"):"";if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Bt.token+o),method:"GET",callback:a=>{var c,u;if(a.json){var p=a.json.earlyAccessFeatures;return(c=this.ni)==null||c.unregister(pl),(u=this.ni)==null||u.register({[pl]:p}),e(p)}}})}gs(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((r=>t[r])),flagVariants:Object.keys(t).filter((r=>t[r])).reduce(((r,i)=>(r[i]=t[i],r)),{})}}ps(e){var{flags:t,flagVariants:r}=this.gs();this.featureFlagEventHandlers.forEach((i=>i(t,r,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var r=this.os(gl)||{},i=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),o=e==null?void 0:e.$set_once,a={};if(o)for(var c in o)({}).hasOwnProperty.call(o,c)&&(c in r||(a[c]=o[c]));this._instance.register({[gl]:ne({},r,a,i)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(gl)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var r=this.os(_n)||{};Object.keys(r).length!==0&&Object.keys(r).forEach((i=>{r[i]=ne({},r[i],e[i]),delete e[i]})),this._instance.register({[_n]:ne({},r,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.os(_n)||{};this._instance.register({[_n]:ne({},t,{[e]:{}})})}else this._instance.unregister(_n)}reset(){this.Kn=!1,this.Qn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.$anon_distinct_id=void 0,this.fs(),this.Jn=!1}}},sP={sessionRecording:class{get Bt(){return this._instance.config}get ni(){return this._instance.persistence}get started(){var e;return!((e=this.ys)==null||!e.isStarted)}get status(){var e,t;return this.bs===Za||this.bs===vh?this.bs:(e=(t=this.ys)==null?void 0:t.status)!==null&&e!==void 0?e:this.bs}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.bs=q0,this._s=void 0,this._instance=e,!this._instance.sessionManager)throw Ps.error("started without valid sessionManager"),new Error(_g+" started without valid sessionManager. This is a bug.");if(this.Bt.cookieless_mode===Ji)throw new Error(_g+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get ws(){var e,t=!((e=this._instance.get_property(fl))==null||!e.enabled),r=!this.Bt.disable_session_recording,i=this.Bt.disable_session_recording||this._instance.consent.isOptedOut();return U&&t&&r&&!i}startIfEnabledOrStop(e){var t;if(!this.ws||(t=this.ys)==null||!t.isStarted){var r=!de(Object.assign)&&!de(Array.from);this.ws&&r?(this.Is(e),Ps.info("starting")):(this.bs=q0,this.stopRecording())}}Is(e){var t,r,i;this.ws&&(this.bs!==Za&&this.bs!==vh&&(this.bs=V0),Se!=null&&(t=Se.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(r=Se.__PosthogExtensions__)!=null&&r.initSessionRecording?this.Cs(e):(i=Se.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.Ss,(o=>{if(o)return Ps.error("could not load recorder",o);this.Cs(e)})))}stopRecording(){var e,t;(e=this._s)==null||e.call(this),this._s=void 0,(t=this.ys)==null||t.stop()}xs(){var e,t;(e=this._s)==null||e.call(this),this._s=void 0,(t=this.ys)==null||t.discard()}ks(){var e;(e=this.ni)==null||e.unregister(yv)}Ts(e,t){if($e(e))return null;var r,i=Qr(e)?e:parseFloat(e);return typeof(r=i)!="number"||!Number.isFinite(r)||0>r||r>1?(Ps.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}As(e){if(this.ni){var t,r,i=this.ni,o=()=>{var a,c=e.sessionRecording===!1?void 0:e.sessionRecording,u=this.Ts((a=this.Bt.session_recording)==null?void 0:a.sampleRate,"session_recording.sampleRate"),p=this.Ts(c==null?void 0:c.sampleRate,"remote config sampleRate"),f=u??p;$e(f)&&this.ks();var g=c==null?void 0:c.minimumDurationMilliseconds;i.register({[fl]:ne({cache_timestamp:Date.now(),enabled:!!c},c,{networkPayloadCapture:ne({capturePerformance:e.capturePerformance},c==null?void 0:c.networkPayloadCapture),canvasRecording:{enabled:c==null?void 0:c.recordCanvas,fps:c==null?void 0:c.canvasFps,quality:c==null?void 0:c.canvasQuality},sampleRate:f,minimumDurationMilliseconds:de(g)?null:g,endpoint:c==null?void 0:c.endpoint,triggerMatchType:c==null?void 0:c.triggerMatchType,masking:c==null?void 0:c.masking,urlTriggers:c==null?void 0:c.urlTriggers,version:c==null?void 0:c.version,triggerGroups:c==null?void 0:c.triggerGroups})})};o(),(t=this._s)==null||t.call(this),this._s=(r=this._instance.sessionManager)==null?void 0:r.onSessionId(o)}}onRemoteConfig(e){return"sessionRecording"in e?e.sessionRecording===!1?(this.As(e),void this.xs()):(this.As(e),void this.startIfEnabledOrStop()):(this.bs===Za&&(this.bs=vh,Ps.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var r;t===void 0&&(t="log"),(r=this.ys)!=null&&r.log?this.ys.log(e,t):Ps.warn("log called before recorder was ready")}get Ss(){var e,t,r=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(fl);return(r==null||(t=r.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Es(){var e,t=this._instance.get_property(fl);if(!t)return!1;var r=(e=(typeof t=="object"?t:JSON.parse(t)).cache_timestamp)!==null&&e!==void 0?e:Date.now();return 36e5>=Date.now()-r}Cs(e){var t,r;if((t=Se.__PosthogExtensions__)==null||!t.initSessionRecording)return Ps.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[kS]:!0});if(this.ys||(this.ys=(r=Se.__PosthogExtensions__)==null?void 0:r.initSessionRecording(this._instance),this.ys._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Es())return this.bs===vh||this.bs===Za?void 0:(this.bs=Za,Ps.info("persisted remote config is stale, requesting fresh config before starting"),void new FS(this._instance).load());this.bs=V0,this.ys.start(e)}onRRwebEmit(e){var t;(t=this.ys)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.ys||(t=this.ni)==null||t.register({[yS]:!0}),(e=this.ys)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.ys||(t=this.ni)==null||t.register({[mS]:!0}),(e=this.ys)==null||e.overrideSampling()}overrideTrigger(e){var t,r;this.ys||(r=this.ni)==null||r.register({[e==="url"?xS:SS]:!0}),(t=this.ys)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.ys)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var r;return!((r=this.ys)==null||!r.tryAddCustomEvent(e,t))}}},nP={autocapture:class{constructor(e){this.Rs=!1,this.Ns=null,this.Ms=!1,this.instance=e,this.rageclicks=new H0(e.config.rageclick),this.Fs=null}initialize(){this.startIfEnabled()}get Bt(){var e,t,r=yt(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=(e=r.url_allowlist)==null?void 0:e.map((i=>new RegExp(i))),r.url_ignorelist=(t=r.url_ignorelist)==null?void 0:t.map((i=>new RegExp(i))),r}Os(){if(this.isBrowserSupported()){if(U&&ce){var e=r=>{r=r||(U==null?void 0:U.event);try{this.Ps(r)}catch(i){Uf.error("Failed to capture event",i)}};if(wt(ce,"submit",e,{capture:!0}),wt(ce,"change",e,{capture:!0}),wt(ce,"click",e,{capture:!0}),this.Bt.capture_copied_text){var t=r=>{r=r||(U==null?void 0:U.event);try{this.Ps(r,Hf)}catch(i){Uf.error("Failed to capture copy/cut event",i)}};wt(ce,"copy",t,{capture:!0}),wt(ce,"cut",t,{capture:!0})}}}else Uf.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Rs&&(this.Os(),this.Rs=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.Ms=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Np]:!!e.autocapture_opt_out}),this.Ns=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.Fs=e}getElementSelectors(e){var t,r=[];return(t=this.Fs)==null||t.forEach((i=>{var o=ce==null?void 0:ce.querySelectorAll(i);o==null||o.forEach((a=>{e===a&&r.push(i)}))})),r}get isEnabled(){var e,t,r=(e=this.instance.persistence)==null?void 0:e.props[Np];if(is(this.Ns)&&!bi(r)&&!this.instance.Fr())return!1;var i=(t=this.Ns)!==null&&t!==void 0?t:!!r;return!!this.instance.config.autocapture&&!i}Ps(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var r,i=F0(e);GS(i)&&(i=i.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(r=this.rageclicks)!=null&&r.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&(function(_,y){if(!U||gg(_))return!1;var x,S,w;if(bi(y)?(x=!!y&&A0,S=void 0):(x=(w=y==null?void 0:y.css_selector_ignorelist)!==null&&w!==void 0?w:A0,S=y==null?void 0:y.content_ignorelist),x===!1)return!1;var{targetElementList:C}=N0(_,!1);return!(function(E,I){if(E===!1||de(E))return!1;var k;if(E===!0)k=z5;else{if(!We(E))return!1;if(E.length>10)return he.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;k=E.map((R=>R.toLowerCase()))}return I.some((R=>{var{safeText:M,ariaLabel:F}=R;return k.some((W=>M.includes(W)||F.includes(W)))}))})(S,C.map((E=>{var I;return{safeText:Fl(E).toLowerCase(),ariaLabel:((I=E.getAttribute("aria-label"))==null?void 0:I.toLowerCase().trim())||""}})))&&!$0(C,x)})(i,this.instance.config.rageclick)&&this.Ps(e,"$rageclick");var o=t===Hf;if(i&&(function(_,y,x,S,w){var C,E,I,k;if(x===void 0&&(x=void 0),!U||gg(_)||(C=x)!=null&&C.url_allowlist&&!O0(x.url_allowlist)||(E=x)!=null&&E.url_ignorelist&&O0(x.url_ignorelist))return!1;if((I=x)!=null&&I.dom_event_allowlist){var R=x.dom_event_allowlist;if(R&&!R.some((K=>y.type===K)))return!1}var{parentIsUsefulElement:M,targetElementList:F}=N0(_,S);if(!(function(K,ie){var oe=ie==null?void 0:ie.element_allowlist;if(de(oe))return!0;var Q,N=function(Y){if(oe.some((re=>Y.tagName.toLowerCase()===re)))return{v:!0}};for(var q of K)if(Q=N(q))return Q.v;return!1})(F,x)||!$0(F,(k=x)==null?void 0:k.css_selector_allowlist))return!1;var W=U.getComputedStyle(_);if(W&&W.getPropertyValue("cursor")==="pointer"&&y.type==="click")return!0;var H=_.tagName.toLowerCase();switch(H){case"html":return!1;case"form":return(w||["submit"]).indexOf(y.type)>=0;case"input":case"select":case"textarea":return(w||["change","click"]).indexOf(y.type)>=0;default:return M?(w||["click"]).indexOf(y.type)>=0:(w||["click"]).indexOf(y.type)>=0&&(Ev.indexOf(H)>-1||_.getAttribute("contenteditable")==="true")}})(i,e,this.Bt,o,o?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:c}=Q5(i,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Bt.element_attribute_ignorelist,elementsChainAsString:this.Ms});if(c)return!1;var u=this.getElementSelectors(i);if(u&&u.length>0&&(a.$element_selectors=u),t===Hf){var p,f=XS(U==null||(p=U.getSelection())==null?void 0:p.toString()),g=e.type||"clipboard";if(!f)return!1;a.$selected_content=f,a.$copy_type=g}return this.instance.capture(t,a),!0}}}isBrowserSupported(){return Vi(ce==null?void 0:ce.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.Ls=(U==null||(t=U.location)==null?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(he.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Ds&&this.Ds(),this.Ds=void 0,he.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(U&&U.history){var r=this;(e=U.history.pushState)!=null&&e.__posthog_wrapped__||U0(U.history,"pushState",(i=>function(o,a,c){i.call(this,o,a,c),r.Bs("pushState")})),(t=U.history.replaceState)!=null&&t.__posthog_wrapped__||U0(U.history,"replaceState",(i=>function(o,a,c){i.call(this,o,a,c),r.Bs("replaceState")})),this.js()}}Bs(e){try{var t,r=U==null||(t=U.location)==null?void 0:t.pathname;if(!r)return;r!==this.Ls&&this.isEnabled&&this._instance.capture(Co,{navigation_type:e}),this.Ls=r}catch(i){he.error("Error capturing "+e+" pageview",i)}}js(){if(!this.Ds){var e=()=>{this.Bs("popstate")};wt(U,"popstate",e),this.Ds=()=>{U&&U.removeEventListener("popstate",e)}}}},heatmaps:class{get Bt(){return this.instance.config}constructor(e){var t;this.$s=!1,this.Rs=!1,this.qs=null,this.instance=e,this.$s=!((t=this.instance.persistence)==null||!t.props[zp]),this.rageclicks=new H0(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return yt(this.Bt.capture_heatmaps)&&this.Bt.capture_heatmaps.flush_interval_milliseconds&&(e=this.Bt.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return $e(this.Bt.capture_heatmaps)?$e(this.Bt.enable_heatmaps)?this.$s:this.Bt.enable_heatmaps:this.Bt.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Rs)return;Y5.info("starting..."),this.Zs(),this.Ft()}else{var e;clearInterval((e=this.qs)!==null&&e!==void 0?e:void 0),this.Hs(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[zp]:t}),this.$s=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.T;return this.T=void 0,e}Vs(e){this.Tt(e.originalEvent,"deadclick")}Ft(){this.qs&&clearInterval(this.qs),this.qs=(ce==null?void 0:ce.visibilityState)==="visible"?setInterval(this.Yr.bind(this),this.flushIntervalMilliseconds):null}Zs(){U&&ce&&(this.zs=this.Yr.bind(this),wt(U,eu,this.zs),this.Us=e=>this.Tt(e||(U==null?void 0:U.event)),wt(ce,"click",this.Us,{capture:!0}),this.Ys=e=>this.Gs(e||(U==null?void 0:U.event)),wt(ce,"mousemove",this.Ys,{capture:!0}),this.Ws=new v0(this.instance,o5,this.Vs.bind(this)),this.Ws.startIfEnabledOrStop(),this.Xs=this.Ft.bind(this),wt(ce,Zh,this.Xs),this.Rs=!0)}Hs(){var e;U&&ce&&(this.zs&&U.removeEventListener(eu,this.zs),this.Us&&ce.removeEventListener("click",this.Us,{capture:!0}),this.Ys&&ce.removeEventListener("mousemove",this.Ys,{capture:!0}),this.Xs&&ce.removeEventListener(Zh,this.Xs),clearTimeout(this.Js),(e=this.Ws)==null||e.stop(),this.Rs=!1)}Ks(e,t){var r=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),o=this.instance.scrollManager.scrollElement(),a=(function(c,u,p){for(var f=c;f&&$n(f)&&!li(f,"body");){if(f===p)return!1;if(Fe(u,U==null?void 0:U.getComputedStyle(f).position))return!0;f=JS(f)}return!1})(F0(e),["fixed","sticky"],o);return{x:e.clientX+(a?0:i),y:e.clientY+(a?0:r),target_fixed:a,type:t}}Tt(e,t){var r;if(t===void 0&&(t="click"),!I0(e.target)&&Q0(e)){var i=this.Ks(e,t);(r=this.rageclicks)!=null&&r.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Qs(ne({},i,{type:"rageclick"})),this.Qs(i)}}Gs(e){!I0(e.target)&&Q0(e)&&(clearTimeout(this.Js),this.Js=setTimeout((()=>{this.Qs(this.Ks(e,"mousemove"))}),500))}Qs(e){if(U){var t=U.location.href,r=this.Bt.custom_personal_data_properties,i=this.Bt.mask_personal_data_properties?[...Go,...r||[]]:[],o=Il(t,i,Ol);this.T=this.T||{},this.T[o]||(this.T[o]=[]),this.T[o].push(e)}}Yr(){this.T&&!Eo(this.T)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:v0,webVitalsAutocapture:class{constructor(e){var t;this.$s=!1,this.Rs=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.eo=()=>{clearTimeout(this.ro),this.T.metrics.length!==0&&(this._instance.capture("$web_vitals",this.T.metrics.reduce(((r,i)=>ne({},r,{["$web_vitals_"+i.name+"_event"]:ne({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ht=r=>{var i,o=(i=this._instance.sessionManager)==null?void 0:i.checkAndGetSessionAndWindowId(!0);if(de(o))Es.error("Could not read session ID. Dropping metrics!");else{this.T=this.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var a=this.io();de(a)||($e(r==null?void 0:r.name)||$e(r==null?void 0:r.value)?Es.error("Invalid metric received",r):!this.no||this.no>r.value?(this.T.url!==a&&(this.eo(),this.ro=setTimeout(this.eo,this.flushToCaptureTimeoutMs)),de(this.T.url)&&(this.T.url=a),this.T.firstMetricTimestamp=de(this.T.firstMetricTimestamp)?Date.now():this.T.firstMetricTimestamp,r.attribution&&r.attribution.interactionTargetElement&&(r.attribution.interactionTargetElement=void 0),this.T.metrics.push(ne({},r,{$current_url:a,$session_id:o.sessionId,$window_id:o.windowId,timestamp:Date.now()})),this.T.metrics.length===this.allowedMetrics.length&&this.eo()):Es.error("Ignoring metric with value >= "+this.no,r))}},this.so=()=>{if(!this.Rs){var r,i,o,a,c=Se.__PosthogExtensions__;de(c)||de(c.postHogWebVitalsCallbacks)||({onLCP:r,onCLS:i,onFCP:o,onINP:a}=c.postHogWebVitalsCallbacks),r&&i&&o&&a?(this.allowedMetrics.indexOf("LCP")>-1&&r(this.ht.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.ht.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&o(this.ht.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&a(this.ht.bind(this)),this.Rs=!0):Es.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.$s=!((t=this._instance.persistence)==null||!t.props[Kp]),this.startIfEnabled()}get oo(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,r=yt(this.oo)?(e=this.oo)==null?void 0:e.web_vitals_allowed_metrics:void 0;return $e(r)?((t=this._instance.persistence)==null?void 0:t.props[Vp])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(yt(this.oo)?this.oo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=yt(this.oo)?this.oo.web_vitals_attribution:void 0;return e!=null&&e}get no(){var e=yt(this.oo)&&Qr(this.oo.__web_vitals_max_value)?this.oo.__web_vitals_max_value:K0;return e>0&&6e4>=e?K0:e}get isEnabled(){var e=Ut==null?void 0:Ut.protocol;if(e!=="http:"&&e!=="https:")return Es.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=yt(this.oo)?this.oo.web_vitals:bi(this.oo)?this.oo:void 0;return bi(t)?t:this.$s}startIfEnabled(){this.isEnabled&&!this.Rs&&(Es.info("enabled, starting..."),this.ur(this.so))}onRemoteConfig(e){if("capturePerformance"in e){var t=yt(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=yt(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Kp]:t}),this._instance.persistence.register({[Vp]:r})),this.$s=t,this.startIfEnabled()}}ur(e){var t,r;(t=Se.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks?e():(r=Se.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(i=>{i?Es.error("failed to load script",i):e()}))}io(){var e=U?U.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...Go,...t||[]]:[];return Il(e,r,Ol)}Es.error("Could not determine current URL")}}},oP={exceptionObserver:class{constructor(e){var t,r,i;this.so=()=>{var o;if(U&&this.isEnabled&&(o=Se.__PosthogExtensions__)!=null&&o.errorWrappingFunctions){var a=Se.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,c=Se.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,u=Se.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ao&&this.Bt.capture_unhandled_errors&&(this.ao=a(this.captureException.bind(this))),!this.lo&&this.Bt.capture_unhandled_rejections&&(this.lo=c(this.captureException.bind(this))),!this.uo&&this.Bt.capture_console_errors&&(this.uo=u(this.captureException.bind(this)))}catch(p){Ja.error("failed to start",p),this.ho()}}},this._instance=e,this.co=!((t=this._instance.persistence)==null||!t.props[Wp]),this.do=new pE({refillRate:(r=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:1,bucketSize:(i=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&i!==void 0?i:10,refillInterval:1e4,Gt:Ja}),this.Bt=this.vo(),this.startIfEnabledOrStop()}vo(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return yt(e)?t=ne({},t,e):(de(e)?this.co:e)&&(t=ne({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Bt.capture_console_errors||this.Bt.capture_unhandled_errors||this.Bt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Ja.info("enabled"),this.ho(),this.ur(this.so)):this.ho()}ur(e){var t,r;(t=Se.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(r=Se.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return Ja.error("failed to load script",i);e()}))}ho(){var e,t,r;(e=this.ao)==null||e.call(this),this.ao=void 0,(t=this.lo)==null||t.call(this),this.lo=void 0,(r=this.uo)==null||r.call(this),this.uo=void 0}onRemoteConfig(e){"autocaptureExceptions"in e&&(this.co=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Wp]:this.co}),this.Bt=this.vo(),this.startIfEnabledOrStop())}onConfigChange(){this.Bt=this.vo()}captureException(e){var t,r,i,o=(t=e==null||(r=e.$exception_list)==null||(r=r[0])==null?void 0:r.type)!==null&&t!==void 0?t:"Exception";this.do.consumeRateLimit(o)?Ja.info("Skipping exception capture because of client rate limiting.",{exception:o}):(i=this._instance.exceptions)==null||i.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,r;this.fo=[],this.po=new PE([new IE,new UE,new FE,new OE,new WE,new zE,new AE,new HE],(function(i){for(var o=arguments.length,a=new Array(o>1?o-1:0),c=1;o>c;c++)a[c-1]=arguments[c];return function(u,p){p===void 0&&(p=0);for(var f=[],g=u.split(`-`),_=p;g.length>_;_++){var y=g[_];if(1024>=y.length){var x=d0.test(y)?y.replace(d0,"$1"):y;if(!x.match(/\S*Error: /)){for(var S of a){var w=S(x,i);if(w){f.push(w);break}}if(f.length>=50)break}}}return(function(C){if(!C.length)return[];var E=Array.from(C);return E.reverse(),E.slice(0,50).map((I=>{return ne({},I,{filename:I.filename||(k=E,k[k.length-1]||{}).filename,function:I.function||Qo});var k}))})(f)}})("web:javascript",LE,BE)),this._instance=e,this.fo=(t=(r=this._instance.persistence)==null?void 0:r.get_property(Hp))!==null&&t!==void 0?t:[],this.mo=Vh(this.yo()),this.bo=new qE(this.mo)}onConfigChange(){this.mo=Vh(this.yo()),this.bo.setConfig(this.mo)}onRemoteConfig(e){var t,r,i;if("errorTracking"in e){var o=(t=(r=e.errorTracking)==null?void 0:r.suppressionRules)!==null&&t!==void 0?t:[],a=(i=e.errorTracking)==null?void 0:i.captureExtensionExceptions;this.fo=o,this._instance.persistence&&this._instance.persistence.register({[Hp]:this.fo,[Up]:a})}}get _o(){var e,t=!!this._instance.get_property(Up),r=this._instance.config.error_tracking.captureExtensionExceptions;return(e=r??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.po.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.mo.enabled)try{if(!ct(e)||e.trim().length===0)return void zi.warn("Ignoring exception step because message must be a non-empty string");var r=this.wo(t),{sanitizedProperties:i,droppedKeys:o}=(function(a){if(!a)return{sanitizedProperties:{},droppedKeys:[]};var c=[];return{sanitizedProperties:Object.keys(a).reduce(((u,p)=>KE.has(p)?(c.push(p),u):(u[p]=a[p],u)),{}),droppedKeys:c}})(r);o.length>0&&zi.warn("Ignoring reserved exception step fields",{droppedKeys:o}),this.bo.add(ne({[Kh]:e,[qh]:new Date().toISOString()},i))}catch(a){zi.error("Failed to add exception step. Ignoring breadcrumb.",a)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.Io(t)){if(this.Co(t))return this.So("Exception dropped: matched a suppression rule"),void zi.info("Skipping exception capture because a suppression rule matched");if(!this._o&&this.xo(t))return this.So("Exception dropped: thrown by a browser extension"),void zi.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ko(t))return this.So("Exception dropped: thrown by the PostHog SDK"),void zi.info("Skipping exception capture because it was thrown by the PostHog SDK")}var r=this.mo.enabled&&$e(e.$exception_steps)?this.To(e):e;try{var i=this._instance.capture("$exception",r,{_noTruncate:!0,_batchKey:"exceptionEvent",en:!0});return i&&this.bo.clear(),i}catch(o){return zi.error("Failed to capture exception event. Dropping this exception.",o),void this.bo.clear()}}catch(o){return void zi.error("Failed to process exception event. Ignoring this exception.",o)}}To(e){try{var t=this.bo.getAttachable();return t.length===0?e:ne({},e,{$exception_steps:t})}catch(r){return zi.error("Failed to read buffered exception steps. Capturing exception without steps.",r),e}}So(e){this.mo.enabled&&this.bo.add({[Kh]:e,[qh]:new Date().toISOString()})}wo(e){return yt(e)?ne({},e):{}}yo(){var e,t;return(e=(t=this._instance.config.error_tracking)==null?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}Co(e){if(e.length===0)return!1;var t=e.reduce(((r,i)=>{var{type:o,value:a}=i;return ct(o)&&o.length>0&&r.$exception_types.push(o),ct(a)&&a.length>0&&r.$exception_values.push(a),r}),{$exception_types:[],$exception_values:[]});return this.fo.some((r=>{var i=r.values.map((o=>{var a,c=KS[o.operator],u=We(o.value)?o.value:[o.value],p=(a=t[o.key])!==null&&a!==void 0?a:[];return u.length>0&&c(u,p)}));return r.type==="OR"?i.some(Boolean):i.every(Boolean)}))}xo(e){return e.flatMap((t=>{var r,i;return(r=(i=t.stacktrace)==null?void 0:i.frames)!==null&&r!==void 0?r:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}ko(e){if(e.length>0){var t,r,i,o,a=(t=(r=e[0].stacktrace)==null?void 0:r.frames)!==null&&t!==void 0?t:[],c=a[a.length-1];return(i=c==null||(o=c.filename)==null?void 0:o.includes("posthog.com/static"))!==null&&i!==void 0&&i}return!1}Io(e){return!$e(e)&&We(e)}}},aP=ne({productTours:class{get ni(){return this._instance.persistence}constructor(e){this.Ao=null,this.Eo=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){"productTours"in e&&(this.ni&&this.ni.register({[qp]:!!e.productTours}),this.loadIfEnabled())}loadIfEnabled(){var e,t;this.Ao||(e=this._instance).config.disable_product_tours||(t=e.persistence)==null||!t.get_property(qp)||this.ur((()=>this.Ro()))}ur(e){var t,r;(t=Se.__PosthogExtensions__)!=null&&t.generateProductTours?e():(r=Se.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"product-tours",(i=>{i?G0.error("Could not load product tours script",i):e()}))}Ro(){var e;!this.Ao&&(e=Se.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Ao=Se.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!We(this.Eo)||t){var r=this.ni;if(r){var i=r.props[Rh];if(We(i)&&!t)return this.Eo=i,void e(i,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:o=>{var a=o.statusCode;if(a!==200||!o.json){var c="Product Tours API could not be loaded, status: "+a;return G0.error(c),void e([],{isLoaded:!1,error:c})}var u=We(o.json.product_tours)?o.json.product_tours:[];this.Eo=u,r&&r.register({[Rh]:u}),e(u,{isLoaded:!0})}})}else e(this.Eo,{isLoaded:!0})}getActiveProductTours(e){$e(this.Ao)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ao.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Ao)==null||t.showTourById(e)}previewTour(e){this.Ao?this.Ao.previewTour(e):this.ur((()=>{var t;this.Ro(),(t=this.Ao)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.Ao)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Ao)==null||e.nextStep()}previousStep(){var e;(e=this.Ao)==null||e.previousStep()}clearCache(){var e;this.Eo=null,(e=this.ni)==null||e.unregister(Rh)}resetTour(e){var t;(t=this.Ao)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.Ao)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Ao)==null||t.cancelPendingTour(e)}}},wu),lP={siteApps:class{constructor(e){this._instance=e,this.No=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Mo(e,t){if(t){var r=this.globalsForEvent(t);this.No.push(r),this.No.length>1e3&&(this.No=this.No.slice(10))}}get siteAppLoaders(){var e;return(e=Se._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.Mo.bind(this));this.Fo=()=>{e(),this.No=[],this.Fo=void 0}}}globalsForEvent(e){var t,r,i,o,a,c,u;if(!e)throw new Error("Event payload is required");var p={},f=this._instance.get_property("$groups")||[],g=this._instance.get_property("$stored_group_properties")||{};for(var[_,y]of Object.entries(g))p[_]={id:f[_],type:_,properties:y};var{$set_once:x,$set:S}=e;return{event:ne({},qx(e,X5),{properties:ne({},e.properties,S?{$set:ne({},(t=(r=e.properties)==null?void 0:r.$set)!==null&&t!==void 0?t:{},S)}:{},x?{$set_once:ne({},(i=(o=e.properties)==null?void 0:o.$set_once)!==null&&i!==void 0?i:{},x)}:{}),elements_chain:(a=(c=e.properties)==null?void 0:c.$elements_chain)!==null&&a!==void 0?a:"",distinct_id:(u=e.properties)==null?void 0:u.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:p}}setupSiteApp(e){var t=this.apps[e.id],r=()=>{var c;!t.errored&&this.No.length&&(Rs.info("Processing "+this.No.length+" events for site app with id "+e.id),this.No.forEach((u=>t.processEvent==null?void 0:t.processEvent(u))),t.processedBuffer=!0),Object.values(this.apps).every((u=>u.processedBuffer||u.errored))&&((c=this.Fo)==null||c.call(this))},i=!1,o=c=>{t.errored=!c,t.loaded=!0,Rs.info("Site app with id "+e.id+" "+(c?"loaded":"errored")),i&&r()};try{var{processEvent:a}=e.init({posthog:this._instance,callback(c){o(c)}});a&&(t.processEvent=a),i=!0}catch(c){Rs.error(Y0+e.id,c),o(!1)}if(i&&t.loaded)try{r()}catch(c){Rs.error("Error while processing buffered events PostHog app with config id "+e.id,c),t.errored=!0}}Oo(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of e)this.setupSiteApp(r)}Po(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var r of Object.values(this.apps))try{r.processEvent==null||r.processEvent(t)}catch(i){Rs.error("Error while processing event "+e.event+" for site app "+r.id,i)}}}onRemoteConfig(e){var t,r,i,o=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.Oo(),void this._instance.on("eventCaptured",(p=>this.Po(p)))):void Rs.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((r=this.Fo)==null||r.call(this),(i=e.siteApps)!=null&&i.length)if(this.isEnabled){var a=function(p){var f;Se["__$$ph_site_app_"+p]=o._instance,(f=Se.__PosthogExtensions__)==null||f.loadSiteApp==null||f.loadSiteApp(o._instance,u,(g=>{if(g)return Rs.error(Y0+p,g)}))};for(var{id:c,url:u}of e.siteApps)a(c)}else Rs.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},cP={tracingHeaders:class{constructor(e){this.Lo=void 0,this.Do=void 0,this.so=()=>{var t,r,i=this.Bo()||[];de(this.Lo)&&((t=Se.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(i,this._instance.get_distinct_id(),this._instance.sessionManager)),de(this.Do)&&((r=Se.__PosthogExtensions__)==null||(r=r.tracingHeadersPatchFns)==null||r._patchFetch(i,this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}initialize(){this.startIfEnabledOrStop()}ur(e){var t,r;(t=Se.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(r=Se.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return G5.error("failed to load script",i);e()}))}Bo(){var e;return(e=this._instance.config.addTracingHeaders)!==null&&e!==void 0?e:this._instance.config.__add_tracing_headers}startIfEnabledOrStop(){var e,t;this.Bo()?this.ur(this.so):((e=this.Lo)==null||e.call(this),(t=this.Do)==null||t.call(this),this.Lo=void 0,this.Do=void 0)}}},hP=ne({surveys:class{get Bt(){return this._instance.config}constructor(e){this.jo=void 0,this._surveyManager=null,this.$o=!1,this.qo=[],this.Zo=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.Bt.disable_surveys){var t=e.surveys;if($e(t))return Ve.warn("Flags not loaded yet. Not loading surveys.");var r=We(t);this.jo=r?t.length>0:t,Ve.info("flags response received, isSurveysEnabled: "+this.jo),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var r=localStorage.key(t);(r!=null&&r.startsWith(fg)||r!=null&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach((i=>localStorage.removeItem(i)))}loadIfEnabled(){if(!this._surveyManager)if(this.$o)Ve.info("Already initializing surveys, skipping...");else if(this.Bt.disable_surveys)Ve.info(X0);else if(this.Bt.cookieless_mode&&this._instance.consent.isOptedOut())Ve.info("Not loading surveys in cookieless mode without consent.");else{var e=Se==null?void 0:Se.__PosthogExtensions__;if(e){if(!de(this.jo)||this.Bt.advanced_enable_surveys){var t=this.jo||this.Bt.advanced_enable_surveys;this.$o=!0;try{var r=e.generateSurveys;if(r)return void this.Ho(r,t);var i=e.loadExternalDependency;if(!i)return void this.Vo(xv);i(this._instance,"surveys",(o=>{o||!e.generateSurveys?this.Vo("Could not load surveys script",o):this.Ho(e.generateSurveys,t)}))}catch(o){throw this.Vo("Error initializing surveys",o),o}finally{this.$o=!1}}}else Ve.error("PostHog Extensions not found.")}}Ho(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new eP(this._instance),Ve.info("Surveys loaded successfully"),this.zo({isLoaded:!0})}Vo(e,t){Ve.error(e,t),this.zo({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.qo.push(e),this._surveyManager&&this.zo({isLoaded:!0}),()=>{this.qo=this.qo.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this.Bt.disable_surveys)return Ve.info(X0),e([]);var r,i=this._instance.get_property(Xp);if(i&&!t)return e(i,{isLoaded:!0});typeof Promise<"u"&&this.Zo?this.Zo.then((o=>{var{surveys:a,context:c}=o;return e(a,c)})):(typeof Promise<"u"&&(this.Zo=new Promise((o=>{r=o}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Bt.token),method:"GET",timeout:this.Bt.surveys_request_timeout_ms,callback:o=>{var a;this.Zo=null;var c=o.statusCode;if(c!==200||!o.json){var u="Surveys API could not be loaded, status: "+c;Ve.error(u);var p={isLoaded:!1,error:u};return e([],p),void(r==null||r({surveys:[],context:p}))}var f,g=o.json.surveys||[],_=g.filter((x=>(function(S){return!(!S.start_date||S.end_date)})(x)&&((function(S){var w;return!((w=S.conditions)==null||(w=w.events)==null||(w=w.values)==null||!w.length)})(x)||(function(S){var w;return!((w=S.conditions)==null||(w=w.actions)==null||(w=w.values)==null||!w.length)})(x))));_.length>0&&((f=this._surveyEventReceiver)==null||f.register(_)),(a=this._instance.persistence)==null||a.register({[Xp]:g});var y={isLoaded:!0};e(g,y),r==null||r({surveys:g,context:y})}}))}zo(e){for(var t of this.qo)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(r){Ve.error("Error in survey callback",r)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!$e(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Ve.warn("init was not called")}Uo(e){var t=null;return this.getSurveys((r=>{var i;t=(i=r.find((o=>o.id===e)))!==null&&i!==void 0?i:null})),t}Yo(e){if($e(this._surveyManager))return{eligible:!1,reason:qf};var t=typeof e=="string"?this.Uo(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if($e(this._surveyManager))return Ve.warn("init was not called"),{visible:!1,disabledReason:qf};var t=this.Yo(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return $e(this._surveyManager)?(Ve.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:qf})):new Promise((r=>{this.getSurveys((i=>{var o,a=(o=i.find((u=>u.id===e)))!==null&&o!==void 0?o:null;if(a){var c=this.Yo(a);r({visible:c.eligible,disabledReason:c.reason})}else r({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,r){var i;if($e(this._surveyManager))Ve.warn("init was not called");else{var o=typeof e=="string"?this.Uo(e):e;if(o!=null&&o.id)if(L5.includes(o.type)){var a=ce==null?void 0:ce.querySelector(t);if(a)return(i=o.appearance)!=null&&i.surveyPopupDelaySeconds?(Ve.info("Rendering survey "+o.id+" with delay of "+o.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var c,u;Ve.info("Rendering survey "+o.id+" with delay of "+((c=o.appearance)==null?void 0:c.surveyPopupDelaySeconds)+" seconds"),(u=this._surveyManager)==null||u.renderSurvey(o,a,r),Ve.info("Survey "+o.id+" rendered")}),1e3*o.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(o,a,r);Ve.warn("Survey element not found")}else Ve.warn("Surveys of type "+o.type+" cannot be rendered in the app");else Ve.warn("Survey not found")}}displaySurvey(e,t){var r;if($e(this._surveyManager))Ve.warn("init was not called");else{var i=this.Uo(e);if(i){var o=i;if((r=i.appearance)!=null&&r.surveyPopupDelaySeconds&&t.ignoreDelay&&(o=ne({},i,{appearance:ne({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==ag.Popover&&t.initialResponses&&Ve.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var a=this.canRenderSurvey(i);if(!a.visible)return void Ve.warn("Survey is not eligible to be displayed: ",a.disabledReason)}t.displayType!==ag.Inline?this._surveyManager.handlePopoverSurvey(o,t):this.renderSurvey(o,t.selector,t.properties)}else Ve.warn("Survey not found")}}cancelPendingSurvey(e){$e(this._surveyManager)?Ve.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}}},wu),uP={toolbar:class{constructor(e){this.instance=e}Go(e){Se.ph_toolbar_state=e}Wo(){var e;return(e=Se.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,r){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),r===void 0&&(r=void 0),ES(this.instance.config)||!U||!ce)return!1;e=e??U.location,r=r??U.history;try{if(!t){try{U.localStorage.setItem("test","test"),U.localStorage.removeItem("test")}catch{return!1}t=U==null?void 0:U.localStorage}var i,o=tP||iu(e.hash,"__posthog")||iu(e.hash,"state"),a=o?p0((()=>JSON.parse(atob(decodeURIComponent(o)))))||p0((()=>JSON.parse(decodeURIComponent(o)))):null;return a&&a.action==="ph_authorize"?((i=a).source="url",i&&Object.keys(i).length>0&&(a.desiredHash?e.hash=a.desiredHash:r?r.replaceState(r.state,"",e.pathname+e.search):e.hash="")):((i=JSON.parse(t.getItem(J0)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token||(this.loadToolbar(i),0))}catch{return!1}}Xo(e){var t=Se.ph_load_toolbar||Se.ph_load_editor;!$e(t)&&Vi(t)?t(e,this.instance):Z0.warn("No toolbar load function found")}loadToolbar(e){var t=!(ce==null||!ce.getElementById(bS));if(!U||t)return!1;var r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=ne({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(U.localStorage.setItem(J0,JSON.stringify(ne({},i,{source:void 0}))),this.Wo()===2)this.Xo(i);else if(this.Wo()===0){var o;this.Go(1),(o=Se.__PosthogExtensions__)==null||o.loadExternalDependency==null||o.loadExternalDependency(this.instance,"toolbar",(a=>{if(a)return Z0.error("[Toolbar] Failed to load",a),void this.Go(0);this.Go(2),this.Xo(i)})),wt(U,"turbolinks:load",(()=>{this.Go(0),this.loadToolbar(i)}))}return!0}Jo(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,r){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),r===void 0&&(r=void 0),this.maybeLoadToolbar(e,t,r)}}},dP=ne({experiments:iP},wu),fP={conversations:class{constructor(e){this.Ko=void 0,this._conversationsManager=null,this.Qo=!1,this.ea=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;$e(t)||(bi(t)?this.Ko=t:(this.Ko=t.enabled,this.ea=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.Ko=void 0,this.ea=null}loadIfEnabled(){if(!(this._conversationsManager||this.Qo||this._instance.config.disable_conversations||ES(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=Se==null?void 0:Se.__PosthogExtensions__;if(e&&!de(this.Ko)&&this.Ko)if(this.ea&&this.ea.token){this.Qo=!0;try{var t=e.initConversations;if(t)return this.ta(t),void(this.Qo=!1);var r=e.loadExternalDependency;if(!r)return void this.ra(xv);r(this._instance,"conversations",(i=>{i||!e.initConversations?this.ra("Could not load conversations script",i):this.ta(e.initConversations),this.Qo=!1}))}catch(i){this.ra("Error initializing conversations",i),this.Qo=!1}}else Ar.error("Conversations enabled but missing token in remote config.")}}ta(e){if(this.ea)try{this._conversationsManager=e(this.ea,this._instance),Ar.info("Conversations loaded successfully")}catch(t){this.ra("Error completing conversations initialization",t)}else Ar.error("Cannot complete initialization: remote config is null")}ra(e,t){Ar.error(e,t),this._conversationsManager=null,this.Qo=!1}show(){this._conversationsManager?this._conversationsManager.show():Ar.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Ko===!0&&!is(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,r){var i=this;return Ur((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,r):(Ar.warn(gn),null)}))()}getMessages(e,t){var r=this;return Ur((function*(){return r._conversationsManager?r._conversationsManager.getMessages(e,t):(Ar.warn(gn),null)}))()}markAsRead(e){var t=this;return Ur((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Ar.warn(gn),null)}))()}getTickets(e){var t=this;return Ur((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Ar.warn(gn),null)}))()}requestRestoreLink(e){var t=this;return Ur((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Ar.warn(gn),null)}))()}restoreFromToken(e){var t=this;return Ur((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Ar.warn(gn),null)}))()}restoreFromUrlToken(){var e=this;return Ur((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Ar.warn(gn),null)}))()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}un(){var e;(e=this._conversationsManager)==null||e.setIdentity()}hn(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},pP={logs:class{constructor(e){var t;this.ia=!1,this.na=!1,this.Gt=tt("[logs]"),this.sa=[],this.oa=0,this.aa=0,this.la=!1,this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.ia=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,r=(t=e.logs)==null?void 0:t.captureConsoleLogs;!$e(r)&&r&&(this.ia=!0,this.loadIfEnabled())}reset(){this.sa=[],this.jr&&(clearTimeout(this.jr),this.jr=void 0),this.oa=0,this.aa=0,this.la=!1}loadIfEnabled(){if(this.ia&&!this.na){var e=Se==null?void 0:Se.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",(r=>{var i;r||(i=e.logs)==null||!i.initializeLogs?this.Gt.error("Could not load logs script",r):(e.logs.initializeLogs(this._instance),this.na=!0)})):this.Gt.error(xv)}else this.Gt.error("PostHog Extensions not found.")}}captureLog(e){var t,r,i,o,a,c;if(this._instance.is_capturing())if(e&&e.body){var u=(t=(r=this._instance.config.logs)==null?void 0:r.flushIntervalMs)!==null&&t!==void 0?t:3e3,p=(i=(o=this._instance.config.logs)==null?void 0:o.maxLogsPerInterval)!==null&&i!==void 0?i:1e3,f=Date.now();if(u>f-this.aa||(this.aa=f,this.oa=0,this.la=!1),p>this.oa){this.oa++;var g=(function(_,y){var x=_.level||"info",{text:S,number:w}=dS[x]||kE,C=String(Date.now())+"000000",E={};y.distinctId&&(E.posthogDistinctId=y.distinctId),y.sessionId&&(E.sessionId=y.sessionId),y.currentUrl&&(E["url.full"]=y.currentUrl),y.screenName&&(E["screen.name"]=y.screenName),y.appState&&(E["app.state"]=y.appState),y.activeFeatureFlags&&y.activeFeatureFlags.length>0&&(E.feature_flags=y.activeFeatureFlags);var I=ne({},E,_.attributes||{}),k={timeUnixNano:C,observedTimeUnixNano:C,severityNumber:w,severityText:S,body:{stringValue:_.body},attributes:u0(I)};return _.trace_id&&(k.traceId=_.trace_id),_.span_id&&(k.spanId=_.span_id),de(_.trace_flags)||(k.flags=_.trace_flags),k})(e,this.ua());this.sa.push({record:g}),((a=(c=this._instance.config.logs)==null?void 0:c.maxBufferSize)!==null&&a!==void 0?a:100)>this.sa.length?this.ha():this.flushLogs()}else this.la||(this.Gt.warn("captureLog dropping logs: exceeded "+p+" logs per "+u+"ms"),this.la=!0)}else this.Gt.warn("captureLog requires a body")}get logger(){return this.ca||(this.ca={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.ca}flushLogs(e){if(this.jr&&(clearTimeout(this.jr),this.jr=void 0),this.sa.length!==0){var t=this.sa;this.sa=[];var r=this._instance.config.logs,i=ne({"service.name":(r==null?void 0:r.serviceName)||"unknown_service"},(r==null?void 0:r.environment)&&{"deployment.environment":r.environment},(r==null?void 0:r.serviceVersion)&&{"service.version":r.serviceVersion},r==null?void 0:r.resourceAttributes),o=(function(c,u,p,f){return{resourceLogs:[{resource:{attributes:u0(u)},scopeLogs:[{scope:{name:p,version:f},logRecords:c}]}]}})(t.map((c=>c.record)),i,cr.LIB_NAME,cr.LIB_VERSION),a=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.Hi({method:"POST",url:a,data:o,compression:"best-available",batchKey:"logs",transport:e})}}ha(){var e,t;this.jr||(this.jr=setTimeout((()=>{this.jr=void 0,this.flushLogs()}),(e=(t=this._instance.config.logs)==null?void 0:t.flushIntervalMs)!==null&&e!==void 0?e:3e3))}ua(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:r}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=r}if(Se!=null&&(e=Se.location)!=null&&e.href&&(t.currentUrl=Se.location.href),this._instance.featureFlags){var i=this._instance.featureFlags.getFlags();i&&i.length>0&&(t.activeFeatureFlags=i)}return t}}},gP=ne({},wu,sP,nP,oP,aP,lP,hP,cP,uP,dP,fP,pP);El.__defaultExtensionClasses=ne({},gP);var i1,Cu=(i1=kl[ko]=new El,(function(){function e(){e.done||(e.done=!0,QS=!1,Je(kl,(function(t){t._dom_loaded()})))}ce!=null&&ce.addEventListener?ce.readyState==="complete"?e():wt(ce,"DOMContentLoaded",e,{capture:!1}):U&&he.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),i1),ib;function vP(e){ib=e}function mg(){return ib}var sb=L.createContext({get client(){return mg()},bootstrap:void 0});function nb(e,t,r){if(r===void 0&&(r=new WeakMap),e===t)return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(r.has(e)&&r.get(e)===t)return!0;r.set(e,t);var i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;for(var a=0,c=i;a<c.length;a++){var u=c[a];if(!o.includes(u)||!nb(e[u],t[u],r))return!1}return!0}function _P(e){var t,r,i=e.children,o=e.client,a=e.apiKey,c=e.options,u=L.useRef(null),p=L.useMemo(function(){if(o)return a&&console.warn("[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`."),c&&console.warn("[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`."),o;var f=mg();return a||console.warn("[PostHog.js] No `apiKey` or `client` were provided to `PostHogProvider`. Using default global `window.posthog` instance. You must initialize it manually. This is not recommended behavior."),f},[o,a,JSON.stringify(c)]);return L.useEffect(function(){if(!o){var f=mg(),g=u.current;g?(a!==g.apiKey&&console.warn("[PostHog.js] You have provided a different `apiKey` to `PostHogProvider` than the one that was already initialized. This is not supported by our provider and we'll keep using the previous key. If you need to toggle between API Keys you need to control the `client` yourself and pass it in as a prop rather than an `apiKey` prop."),c&&!nb(c,g.options)&&f.set_config(c),u.current={apiKey:a,options:c??{}}):(f.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),f.init(a,c),u.current={apiKey:a,options:c??{}})}},[o,a,JSON.stringify(c)]),Is.createElement(sb.Provider,{value:{client:p,bootstrap:(t=c==null?void 0:c.bootstrap)!==null&&t!==void 0?t:(r=o==null?void 0:o.config)===null||r===void 0?void 0:r.bootstrap}},i)}var Qf=function(e){return typeof e=="function"},yg=function(e,t){return yg=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},yg(e,t)};function mP(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");yg(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var yP={componentStack:null,exceptionEvent:null,error:null},xP={INVALID_FALLBACK:"[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."};(function(e){mP(t,e);function t(r){var i=e.call(this,r)||this;return i.state=yP,i}return t.prototype.componentDidCatch=function(r,i){var o=this.props.additionalProperties,a;Qf(o)?a=o(r):typeof o=="object"&&(a=o);var c=this.context.client,u=c.captureException(r,a),p=i.componentStack;this.setState({error:r,componentStack:p??null,exceptionEvent:u})},t.prototype.render=function(){var r=this.props,i=r.children,o=r.fallback,a=this.state;if(a.componentStack==null)return Qf(i)?i():i;var c=Qf(o)?Is.createElement(o,{error:a.error,componentStack:a.componentStack,exceptionEvent:a.exceptionEvent}):o;return Is.isValidElement(c)?c:(console.warn(xP.INVALID_FALLBACK),Is.createElement(Is.Fragment,null))},t.contextType=sb,t})(Is.Component);vP(Cu);const ob="/api/dashboard";async function Te(e,t={}){const r=await fetch(`${ob}${e}`,{...t,credentials:"include",headers:{"Content-Type":"application/json",...t.headers}});if(r.status===401)throw new Error("Unauthorized");if(!r.ok){const i=await r.json().catch(()=>({}));let o;throw typeof i.error=="string"?o=i.error:i.error&&typeof i.error.message=="string"?o=i.error.message:typeof i.message=="string"?o=i.message:o=`Request failed: ${r.status}`,new Error(o)}if(r.status!==204)return r.json()}async function SP(){await fetch("/auth/logout",{method:"POST",credentials:"include"}).catch(()=>{}),Cu.reset(),window.location.replace("/login")}const bP=()=>Te("/me"),lu=e=>Te(`/sessions${e?`?status=${e}`:""}`),ab=()=>Te("/api-keys"),lb=e=>Te("/api-keys",{method:"POST",body:JSON.stringify({name:e})}),wP=e=>Te(`/api-keys/${e}`,{method:"DELETE"}),CP=(e=1,t=20)=>Te(`/checkpoints?page=${e}&per_page=${t}`),kP=e=>Te(`/checkpoints/${e}`,{method:"DELETE"}),EP=(e=!1)=>Te(`/images${e?"?all=true":""}`),PP=e=>Te(`/images/${e}`,{method:"DELETE"}),RP=e=>Te(`/sessions/${e}`),jP=e=>Te(`/sessions/${e}/stats`),cb=e=>Te(`/sessions/${e}/reboot`,{method:"POST"}),TP=e=>Te(`/sessions/${e}/power-cycle`,{method:"POST"});function LP(e,t={}){const r=new URL(`${ob}/sessions/${encodeURIComponent(e)}/logs`,window.location.origin);return t.tail!==void 0&&r.searchParams.set("tail",String(t.tail)),t.q&&r.searchParams.set("q",t.q),t.source&&r.searchParams.set("source",t.source),t.since&&r.searchParams.set("since",t.since),t.limit!==void 0&&r.searchParams.set("limit",String(t.limit)),new EventSource(r.toString(),{withCredentials:!0})}const MP=()=>Te("/org"),DP=e=>Te("/org",{method:"PUT",body:JSON.stringify({name:e})}),BP=e=>Te("/org/custom-domain",{method:"PUT",body:JSON.stringify({domain:e})}),IP=()=>Te("/org/custom-domain",{method:"DELETE"}),OP=()=>Te("/org/custom-domain/refresh",{method:"POST"}),FP=()=>Te("/org/members"),$P=e=>Te(`/org/members/${e}`,{method:"DELETE"}),AP=(e,t="member")=>Te("/org/invitations",{method:"POST",body:JSON.stringify({email:e,role:t})}),NP=()=>Te("/org/invitations"),zP=e=>Te(`/org/invitations/${e}`,{method:"DELETE"}),WP=e=>Te("/org/switch",{method:"POST",body:JSON.stringify({orgId:e})}),hb=()=>Te("/billing"),HP=()=>Te("/billing/setup",{method:"POST"}),UP=()=>Te("/billing/portal",{method:"POST"}),KP=(e=10)=>Te(`/billing/invoices?limit=${e}`),qP=e=>Te("/billing/redeem",{method:"POST",body:JSON.stringify({code:e})}),ub=()=>Te("/agents"),db=e=>Te(`/agents/${encodeURIComponent(e)}`),VP=e=>Te("/agents",{method:"POST",body:JSON.stringify(e)}),fb=e=>Te(`/agents/${encodeURIComponent(e)}`,{method:"DELETE"}),QP=e=>Te(`/agents/${encodeURIComponent(e)}/packages/gbrain`,{method:"POST"}),s1=e=>Te(`/agents/${encodeURIComponent(e)}/packages/gbrain`,{method:"DELETE"}),GP=(e,t)=>Te(`/agents/${encodeURIComponent(e)}/channels/telegram`,{method:"POST",body:JSON.stringify({bot_token:t})}),YP=e=>Te(`/agents/${encodeURIComponent(e)}/channels/telegram`,{method:"DELETE"}),XP=(e,t=50)=>Te(`/agents/${encodeURIComponent(e)}/events?limit=${t}`),JP=(e,t=20)=>Te(`/agents/${encodeURIComponent(e)}/operations?limit=${t}`),ZP=e=>Te(`/agents/${encodeURIComponent(e)}/restart`,{method:"POST"}),eR=(e,t=300)=>Te(`/agents/${encodeURIComponent(e)}/logs?tail=${t}`),pb=e=>Te(`/agents/${encodeURIComponent(e)}/entitlements`),tR=(e,t)=>Te(`/agents/${encodeURIComponent(e)}/subscriptions/${encodeURIComponent(t)}`,{method:"POST"}),rR=()=>Te("/billing/agent-subscriptions"),gb=(e,t)=>Te(`/agents/${encodeURIComponent(e)}/subscriptions/${encodeURIComponent(t)}`,{method:"DELETE"});async function*iR(e,t,r,i,o){const a={};o&&o.length>0?a.messages=o:a.content=r,i&&(a.conversation_id=i);const c=await fetch(`/api/dashboard/agents/${encodeURIComponent(e)}/instances/${encodeURIComponent(t)}/messages`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!c.ok||!c.body){const g=await c.text().catch(()=>"");throw new Error(`chat ${c.status}: ${g||"no body"}`)}const u=c.body.getReader(),p=new TextDecoder;let f="";for(;;){const{done:g,value:_}=await u.read();if(g)return;f+=p.decode(_,{stream:!0});let y;for(;(y=f.indexOf(`--`))!==-1;){const x=f.slice(0,y);f=f.slice(y+2);const S=x.split(`-`).filter(w=>w.startsWith("data:")).map(w=>w.slice(5).trimStart()).join(`-`);if(S)try{yield JSON.parse(S)}catch{yield{type:"raw",data:S}}}}}const vb=L.createContext({user:null,loading:!0,error:null,switchOrg:async()=>{},refreshUser:async()=>{}});function sR({children:e}){const[t,r]=L.useState(null),[i,o]=L.useState(!0),[a,c]=L.useState(null),u=L.useCallback(async()=>{try{const f=await bP();r(f),f!=null&&f.id&&Cu.identify(f.id,{email:f.email,org_id:f.orgId})}catch(f){f instanceof Error&&!f.message.includes("Unauthorized")&&c(f.message)}},[]);L.useEffect(()=>{u().finally(()=>o(!1))},[u]);const p=L.useCallback(async f=>{await WP(f),await u()},[u]);return h.jsx(vb.Provider,{value:{user:t,loading:i,error:a,switchOrg:p,refreshUser:u},children:e})}function _b(){return L.useContext(vb)}function nR(){const{user:e,loading:t}=_b();return t?h.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100vh",gap:16,background:"var(--bg-void)"},children:[h.jsx("div",{className:"loading-spinner"}),h.jsx("span",{style:{fontSize:12,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)",letterSpacing:"0.04em"},children:"Loading…"})]}):e?h.jsx(Ux,{}):h.jsx(Hx,{to:"/login",replace:!0})}const qi={grid:h.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1.5"}),h.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1.5"}),h.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1.5"}),h.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1.5"})]}),clock:h.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("circle",{cx:"12",cy:"12",r:"9"}),h.jsx("polyline",{points:"12 7 12 12 15.5 14.5"})]}),key:h.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:h.jsx("path",{d:"M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4"})}),layers:h.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("polygon",{points:"12 2 2 7 12 12 22 7 12 2"}),h.jsx("polyline",{points:"2 17 12 22 22 17"}),h.jsx("polyline",{points:"2 12 12 17 22 12"})]}),box:h.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),h.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),h.jsx("line",{x1:"12",y1:"22.08",x2:"12",y2:"12"})]}),creditCard:h.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("rect",{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2"}),h.jsx("line",{x1:"1",y1:"10",x2:"23",y2:"10"})]}),bot:h.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("rect",{x:"4",y:"7",width:"16",height:"12",rx:"2"}),h.jsx("path",{d:"M12 7V3"}),h.jsx("circle",{cx:"12",cy:"3",r:"1"}),h.jsx("circle",{cx:"9",cy:"13",r:"1",fill:"currentColor"}),h.jsx("circle",{cx:"15",cy:"13",r:"1",fill:"currentColor"}),h.jsx("path",{d:"M9 17h6"})]}),gear:h.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("circle",{cx:"12",cy:"12",r:"3"}),h.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),logout:h.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),h.jsx("polyline",{points:"16 17 21 12 16 7"}),h.jsx("line",{x1:"21",y1:"12",x2:"9",y2:"12"})]})},oR=[{to:"/",label:"Dashboard",end:!0,icon:qi.grid},{to:"/sessions",label:"Sessions",icon:qi.clock},{to:"/agents",label:"Agents",icon:qi.bot},{to:"/checkpoints",label:"Checkpoints",icon:qi.layers},{to:"/templates",label:"Templates",icon:qi.box},{to:"/api-keys",label:"API Keys",icon:qi.key},{to:"/billing",label:"Billing",icon:qi.creditCard},{to:"/settings",label:"Settings",icon:qi.gear}];function aR(){var c,u,p,f;const{user:e,switchOrg:t}=_b(),[r,i]=L.useState(!1),o=(((c=e==null?void 0:e.orgs)==null?void 0:c.length)??0)>1,a=(u=e==null?void 0:e.orgs)==null?void 0:u.find(g=>g.isActive);return h.jsxs("div",{style:{display:"flex",minHeight:"100vh"},children:[h.jsxs("nav",{style:{width:232,background:"var(--bg-deep)",borderRight:"1px solid var(--border-subtle)",display:"flex",flexDirection:"column",position:"fixed",top:0,left:0,bottom:0,zIndex:50},children:[h.jsx("div",{style:{padding:"22px 20px 18px",borderBottom:"1px solid var(--border-subtle)"},children:h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[h.jsx("div",{style:{width:30,height:30,borderRadius:8,background:"var(--gradient-primary)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,fontWeight:800,color:"#fff",fontFamily:"var(--font-display)",boxShadow:"0 0 16px rgba(99,102,241,0.25)"},children:"OS"}),h.jsxs("div",{children:[h.jsx("div",{style:{fontSize:14,fontWeight:700,fontFamily:"var(--font-display)",color:"var(--text-primary)",letterSpacing:"-0.02em"},children:"OpenComputer"}),h.jsx("div",{style:{fontSize:9,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)",letterSpacing:"0.06em",textTransform:"uppercase"},children:"Console"})]})]})}),o&&h.jsxs("div",{style:{padding:"10px 12px",borderBottom:"1px solid var(--border-subtle)",position:"relative"},children:[h.jsxs("button",{onClick:()=>i(!r),style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 10px",background:"rgba(255,255,255,0.03)",border:"1px solid var(--border-subtle)",borderRadius:6,cursor:"pointer",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font-body)"},children:[h.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(a==null?void 0:a.name)||"Select org"}),h.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:h.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),r&&h.jsx("div",{style:{position:"absolute",top:"100%",left:12,right:12,background:"var(--bg-deep)",border:"1px solid var(--border-subtle)",borderRadius:6,marginTop:4,zIndex:100,boxShadow:"0 4px 16px rgba(0,0,0,0.3)"},children:(p=e==null?void 0:e.orgs)==null?void 0:p.map(g=>h.jsxs("button",{onClick:()=>{t(g.id),i(!1)},style:{display:"block",width:"100%",textAlign:"left",padding:"8px 12px",background:g.isActive?"rgba(99,102,241,0.1)":"none",border:"none",cursor:"pointer",color:g.isActive?"var(--text-primary)":"var(--text-secondary)",fontSize:12,fontFamily:"var(--font-body)",borderBottom:"1px solid var(--border-subtle)"},onMouseOver:_=>{g.isActive||(_.currentTarget.style.background="rgba(255,255,255,0.03)")},onMouseOut:_=>{g.isActive||(_.currentTarget.style.background="none")},children:[g.name,g.isPersonal&&h.jsx("span",{style:{fontSize:10,color:"var(--text-tertiary)",marginLeft:6},children:"(personal)"})]},g.id))})]}),h.jsx("div",{style:{flex:1,padding:"10px 8px"},children:oR.map(g=>h.jsxs(iE,{to:g.to,end:g.end,style:({isActive:_})=>({display:"flex",alignItems:"center",gap:10,padding:"9px 14px",color:_?"var(--text-primary)":"var(--text-secondary)",background:_?"rgba(99, 102, 241, 0.07)":"transparent",textDecoration:"none",fontSize:13,fontWeight:_?600:400,fontFamily:"var(--font-body)",borderRadius:8,marginBottom:2,transition:"all 0.15s ease",borderLeft:_?"2px solid var(--accent-indigo)":"2px solid transparent"}),children:[h.jsx("span",{style:{display:"flex",alignItems:"center",opacity:.6},children:g.icon}),g.label]},g.to))}),h.jsxs("div",{style:{padding:"14px 16px",borderTop:"1px solid var(--border-subtle)"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:10},children:[h.jsx("div",{style:{width:28,height:28,borderRadius:"50%",background:"var(--gradient-primary)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:700,color:"#fff",flexShrink:0},children:((f=e==null?void 0:e.email)==null?void 0:f.charAt(0).toUpperCase())||"?"}),h.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:e==null?void 0:e.email})]}),h.jsxs("button",{onClick:()=>SP(),style:{display:"flex",alignItems:"center",gap:6,background:"none",border:"none",color:"var(--text-tertiary)",cursor:"pointer",fontSize:12,fontFamily:"var(--font-body)",padding:0,transition:"color 0.15s ease"},onMouseOver:g=>g.currentTarget.style.color="var(--accent-rose)",onMouseOut:g=>g.currentTarget.style.color="var(--text-tertiary)",children:[qi.logout,"Sign out"]})]})]}),h.jsx("main",{style:{flex:1,marginLeft:232,padding:"32px 36px",minHeight:"100vh",background:"radial-gradient(ellipse 80% 50% at 50% -10%, rgba(99,102,241,0.04) 0%, transparent 70%)"},children:h.jsx(Ux,{})})]})}function lR(){return h.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100vh",background:"var(--bg-void)",position:"relative",overflow:"hidden"},children:[h.jsx("div",{style:{position:"absolute",width:600,height:600,borderRadius:"50%",background:"radial-gradient(circle, rgba(99,102,241,0.08) 0%, transparent 70%)",top:"50%",left:"50%",transform:"translate(-50%, -55%)",pointerEvents:"none"}}),h.jsxs("div",{style:{position:"relative",textAlign:"center"},children:[h.jsx("div",{style:{width:56,height:56,borderRadius:16,background:"var(--gradient-primary)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:20,fontWeight:800,color:"#fff",fontFamily:"var(--font-display)",margin:"0 auto 24px",boxShadow:"0 0 40px rgba(99,102,241,0.3)"},children:"OS"}),h.jsx("h1",{style:{fontSize:34,fontWeight:700,fontFamily:"var(--font-display)",letterSpacing:"-0.04em",color:"var(--text-primary)",marginBottom:8},children:"OpenComputer"}),h.jsx("p",{style:{fontSize:14,color:"var(--text-tertiary)",marginBottom:40,maxWidth:280,lineHeight:1.5},children:"Sign in to manage your sandbox infrastructure"}),h.jsx("a",{href:"/auth/login",className:"btn-primary",style:{display:"inline-flex",padding:"14px 40px",fontSize:15,borderRadius:10,textDecoration:"none"},children:"Sign in"}),h.jsx("div",{style:{marginTop:48,fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)",letterSpacing:"0.04em"},children:"SECURE · GLOBAL · FAST"})]})]})}const n1="npx skills add diggerhq/opencomputer";function cR(){const{data:e,isLoading:t}=Nt({queryKey:["sessions","running"],queryFn:()=>lu("running")}),{data:r,isLoading:i}=Nt({queryKey:["sessions",""],queryFn:()=>lu()}),o=e??[],a=r??[],c=new Date().toISOString().slice(0,10),u=a.filter(f=>new Date(f.startedAt).toISOString().slice(0,10)===c).length,p=!i&&a.length===0;return h.jsxs("div",{children:[h.jsxs("div",{style:{marginBottom:32},children:[h.jsx("h1",{className:"page-title",children:p?"Welcome to OpenComputer":"Dashboard"}),h.jsx("p",{className:"page-subtitle",children:p?"Get your first sandbox running in two steps":"Overview of your sandbox infrastructure"})]}),p?h.jsx(hR,{}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:14,marginBottom:24},children:[h.jsx(l1,{label:"Active Sandboxes",value:t?"—":o.length,accent:"var(--accent-emerald)"}),h.jsx(l1,{label:"Sessions Today",value:i?"—":u,accent:"#818cf8"})]}),h.jsxs("div",{className:"glass-card animate-in stagger-1",style:{padding:"22px 24px",marginBottom:24},children:[h.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:14},children:[h.jsx("span",{className:"section-title",style:{marginBottom:0},children:"Live Sandboxes"}),o.length>0&&h.jsxs("span",{style:{fontSize:11,fontFamily:"var(--font-mono)",color:"var(--accent-emerald)",display:"flex",alignItems:"center",gap:6},children:[h.jsx("span",{className:"pulse-dot",style:{width:6,height:6,borderRadius:"50%",background:"var(--accent-emerald)",display:"inline-block"}}),o.length," active"]})]}),t?h.jsx("div",{style:{display:"flex",justifyContent:"center",padding:40},children:h.jsx("div",{className:"loading-spinner"})}):o.length===0?h.jsx("div",{style:{textAlign:"center",padding:"40px 20px",color:"var(--text-tertiary)",fontSize:13},children:"No sandboxes running"}):h.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6,maxHeight:300,overflowY:"auto"},children:o.map(f=>h.jsx(dR,{session:f},f.id))})]}),h.jsxs("div",{className:"glass-card animate-in stagger-2",style:{padding:"22px 24px"},children:[h.jsx("span",{className:"section-title",children:"Recent Sessions"}),i?h.jsx("div",{style:{display:"flex",justifyContent:"center",padding:40},children:h.jsx("div",{className:"loading-spinner"})}):a.length===0?h.jsx("div",{style:{textAlign:"center",padding:"40px 20px",color:"var(--text-tertiary)",fontSize:13},children:"No sessions yet"}):h.jsx("div",{style:{overflow:"hidden"},children:h.jsxs("table",{className:"data-table",children:[h.jsx("thead",{children:h.jsxs("tr",{children:[h.jsx("th",{children:"Sandbox ID"}),h.jsx("th",{children:"Template"}),h.jsx("th",{children:"Status"}),h.jsx("th",{children:"Started"}),h.jsx("th",{children:"Duration"})]})}),h.jsx("tbody",{children:a.slice(0,20).map(f=>h.jsxs(fR,{sandboxId:f.sandboxId,children:[h.jsx("td",{children:h.jsx("code",{style:{color:"var(--text-accent)"},children:f.sandboxId})}),h.jsx("td",{children:f.template||"base"}),h.jsx("td",{children:h.jsx(pR,{status:f.status})}),h.jsx("td",{style:{fontFamily:"var(--font-mono)",fontSize:12},children:new Date(f.startedAt).toLocaleString()}),h.jsx("td",{style:{fontFamily:"var(--font-mono)",fontSize:12},children:gR(f)})]},f.id))})]})})]})]})]})}function hR(){const e=Gr(),{data:t,isLoading:r}=Nt({queryKey:["api-keys"],queryFn:ab}),[i,o]=L.useState(null),[a,c]=L.useState(null),u=L.useRef(!1),p=er({mutationFn:()=>lb("Default"),onSuccess:_=>{c(_.key),e.invalidateQueries({queryKey:["api-keys"]})}}),f=((t==null?void 0:t.length)??0)>0;L.useEffect(()=>{r||u.current||!f&&!a&&!p.isPending&&(u.current=!0,p.mutate())},[r,f,a,p]);const g=(_,y)=>{navigator.clipboard.writeText(_),o(y),setTimeout(()=>o(x=>x===y?null:x),1500)};return h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[h.jsx(vR,{}),h.jsx(o1,{index:1,title:"Install the OpenComputer skill",description:"Adds a skill to Claude Code (or any agent that supports the Agent Skills standard) so it can drive sandboxes for you.",children:h.jsx(uR,{command:n1,copied:i==="install",onCopy:()=>g(n1,"install")})}),h.jsxs(o1,{index:2,title:"Your API key",description:"The skill uses this key to authenticate with OpenComputer. We've created a Default key for you — copy it now, you won't be able to see it again.",children:[(r||p.isPending)&&h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,color:"var(--text-tertiary)",fontSize:13},children:[h.jsx("div",{className:"loading-spinner",style:{width:14,height:14}}),"Preparing your API key…"]}),a&&h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[h.jsx(a1,{secret:a,copied:i==="key",onCopy:()=>g(a,"key")}),h.jsx("div",{style:{fontSize:12,color:"var(--text-tertiary)",marginTop:6},children:"Then run this in your terminal to configure the CLI:"}),h.jsx(a1,{secret:a,wrap:_=>`oc config set api-key ${_}`,copied:i==="cmd",onCopy:()=>g(`oc config set api-key ${a}`,"cmd")})]}),!a&&!p.isPending&&f&&h.jsxs("div",{style:{fontSize:13,color:"var(--text-secondary)"},children:["You already have ",t.length," API key",t.length===1?"":"s"," from a previous session. For security, existing key values can't be re-displayed."," ",h.jsx(Wh,{to:"/api-keys",style:{color:"var(--accent-indigo)"},children:"Manage keys"})," to rotate."]}),p.isError&&h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginTop:8},children:[h.jsx("span",{style:{fontSize:12,color:"var(--accent-rose, #fb7185)"},children:"Failed to create your API key."}),h.jsx("button",{className:"btn-ghost",style:{fontSize:12},onClick:()=>p.mutate(),children:"Retry"})]})]})]})}function o1({index:e,title:t,description:r,children:i}){return h.jsx("div",{className:"glass-card animate-in",style:{padding:"22px 24px"},children:h.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:14},children:[h.jsx("div",{style:{width:28,height:28,borderRadius:"50%",background:"rgba(99,102,241,0.12)",border:"1px solid var(--border-accent)",color:"var(--accent-indigo)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,fontWeight:600,flexShrink:0,fontFamily:"var(--font-mono)"},children:e}),h.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:12},children:[h.jsxs("div",{children:[h.jsx("div",{style:{fontSize:15,fontWeight:600,color:"var(--text-primary)",marginBottom:4},children:t}),h.jsx("div",{style:{fontSize:13,color:"var(--text-tertiary)",lineHeight:1.5},children:r})]}),i]})]})})}function uR({command:e,copied:t,onCopy:r}){return h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,background:"var(--bg-deep)",border:"1px solid var(--border-subtle)",borderRadius:"var(--radius-sm)",padding:"10px 12px"},children:[h.jsx("code",{style:{flex:1,fontFamily:"var(--font-mono)",fontSize:13,color:"var(--text-accent)",wordBreak:"break-all"},children:e}),h.jsx("button",{onClick:r,className:"btn-ghost",style:{fontSize:11,padding:"4px 10px",flexShrink:0},children:t?"Copied":"Copy"})]})}function a1({secret:e,wrap:t,copied:r,onCopy:i}){const[o,a]=L.useState(!1),c="•".repeat(Math.min(e.length,32)),u=o?e:c,p=t?t(u):u;return h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,background:"var(--bg-deep)",border:"1px solid var(--border-subtle)",borderRadius:"var(--radius-sm)",padding:"10px 12px"},children:[h.jsx("code",{style:{flex:1,fontFamily:"var(--font-mono)",fontSize:13,color:"var(--text-accent)",wordBreak:"break-all",letterSpacing:o?"normal":"0.05em"},children:p}),h.jsx("button",{onClick:()=>a(f=>!f),className:"btn-ghost",style:{fontSize:11,padding:"4px 10px",flexShrink:0},"aria-label":o?"Hide secret":"Reveal secret",children:o?"Hide":"Reveal"}),h.jsx("button",{onClick:i,className:"btn-ghost",style:{fontSize:11,padding:"4px 10px",flexShrink:0},children:r?"Copied":"Copy"})]})}function l1({label:e,value:t,accent:r}){return h.jsxs("div",{className:"stat-card animate-in",children:[h.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginBottom:8,letterSpacing:"0.03em"},children:e}),h.jsx("div",{className:"metric-value",style:{fontSize:30,fontWeight:700,lineHeight:1,color:r},children:typeof t=="number"?t.toLocaleString():t})]})}function dR({session:e}){const t=ji(),r=Math.round((Date.now()-new Date(e.startedAt).getTime())/1e3/60);return h.jsxs("div",{onClick:()=>t(`/sessions/${e.sandboxId}`),style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"9px 12px",borderRadius:8,background:"rgba(255,255,255,0.015)",border:"1px solid rgba(255,255,255,0.035)",transition:"all 0.15s ease",cursor:"pointer"},onMouseOver:i=>{i.currentTarget.style.background="rgba(99,102,241,0.05)",i.currentTarget.style.borderColor="rgba(99,102,241,0.12)"},onMouseOut:i=>{i.currentTarget.style.background="rgba(255,255,255,0.015)",i.currentTarget.style.borderColor="rgba(255,255,255,0.035)"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[h.jsx("span",{className:"pulse-dot",style:{width:6,height:6,borderRadius:"50%",background:"var(--accent-emerald)",flexShrink:0}}),h.jsxs("div",{children:[h.jsx("code",{style:{fontSize:12,fontFamily:"var(--font-mono)",color:"var(--text-accent)"},children:e.sandboxId}),h.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginTop:1},children:e.template||"base"})]})]}),h.jsxs("span",{className:"metric-value",style:{fontSize:11,color:"var(--text-tertiary)"},children:[r,"m"]})]})}function fR({sandboxId:e,children:t}){const r=ji();return h.jsx("tr",{onClick:()=>r(`/sessions/${e}`),style:{cursor:"pointer"},onMouseOver:i=>{i.currentTarget.style.background="rgba(99,102,241,0.04)"},onMouseOut:i=>{i.currentTarget.style.background=""},children:t})}function pR({status:e}){const t=e==="running"?"badge-running":e==="hibernated"?"badge-hibernated":e==="error"?"badge-error":"badge-stopped";return h.jsxs("span",{className:`badge ${t}`,children:[e==="running"&&h.jsx("span",{className:"pulse-dot",style:{width:5,height:5,borderRadius:"50%",background:"currentColor",display:"inline-block"}}),e]})}function gR(e){const t=new Date(e.startedAt).getTime(),r=e.stoppedAt?new Date(e.stoppedAt).getTime():Date.now(),i=Math.round((r-t)/1e3);return i<60?`${i}s`:i<3600?`${Math.round(i/60)}m`:`${Math.round(i/3600*10)/10}h`}function vR(){const e=ji();return h.jsxs("div",{onClick:()=>e("/agents"),onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),e("/agents"))},role:"button",tabIndex:0,style:{display:"flex",alignItems:"center",gap:18,padding:"20px 24px",border:"1px solid rgba(255,77,77,0.30)",borderRadius:14,background:"radial-gradient(ellipse at left, rgba(255,77,77,0.14), transparent 62%), rgba(255,77,77,0.04)",cursor:"pointer",transition:"background 0.12s ease, border-color 0.12s ease"},onMouseEnter:t=>{t.currentTarget.style.borderColor="rgba(255,77,77,0.55)"},onMouseLeave:t=>{t.currentTarget.style.borderColor="rgba(255,77,77,0.30)"},children:[h.jsx(_R,{}),h.jsxs("div",{style:{flex:1},children:[h.jsx("div",{style:{fontSize:16,fontWeight:700,fontFamily:"var(--font-display)",marginBottom:4},children:"Deploy an OpenClaw managed agent"}),h.jsx("div",{style:{fontSize:13,color:"var(--text-secondary)",lineHeight:1.5},children:"Spin up a managed agent runtime with built-in chat, Telegram, and gbrain memory. We host the gateway and the model routing — you bring the prompt."})]}),h.jsx("div",{style:{padding:"9px 18px",fontSize:13,fontWeight:600,background:"var(--accent-indigo)",color:"#fff",borderRadius:"var(--radius-sm)",whiteSpace:"nowrap"},children:"Deploy →"})]})}function _R(){return h.jsxs("svg",{width:"56",height:"56",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",style:{filter:"drop-shadow(0 0 16px rgba(255,77,77,0.45))",flexShrink:0},children:[h.jsx("defs",{children:h.jsxs("linearGradient",{id:"dash-lobster-gradient",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[h.jsx("stop",{offset:"0%",stopColor:"#ff4d4d"}),h.jsx("stop",{offset:"100%",stopColor:"#991b1b"})]})}),h.jsx("path",{d:"M60 10 C30 10 15 35 15 55 C15 75 30 95 45 100 L45 110 L55 110 L55 100 C55 100 60 102 65 100 L65 110 L75 110 L75 100 C90 95 105 75 105 55 C105 35 90 10 60 10Z",fill:"url(#dash-lobster-gradient)"}),h.jsx("path",{d:"M20 45 C5 40 0 50 5 60 C10 70 20 65 25 55 C28 48 25 45 20 45Z",fill:"url(#dash-lobster-gradient)"}),h.jsx("path",{d:"M100 45 C115 40 120 50 115 60 C110 70 100 65 95 55 C92 48 95 45 100 45Z",fill:"url(#dash-lobster-gradient)"}),h.jsx("path",{d:"M45 15 Q35 5 30 8",stroke:"#ff4d4d",strokeWidth:"3",strokeLinecap:"round"}),h.jsx("path",{d:"M75 15 Q85 5 90 8",stroke:"#ff4d4d",strokeWidth:"3",strokeLinecap:"round"}),h.jsx("circle",{cx:"45",cy:"35",r:"6",fill:"#050810"}),h.jsx("circle",{cx:"75",cy:"35",r:"6",fill:"#050810"}),h.jsx("circle",{cx:"46",cy:"34",r:"2.5",fill:"#00e5cc"}),h.jsx("circle",{cx:"76",cy:"34",r:"2.5",fill:"#00e5cc"})]})}const mR=["","running","stopped","hibernated","error"];function yR(){const[e,t]=L.useState(""),{data:r,isLoading:i}=Nt({queryKey:["sessions",e],queryFn:()=>lu(e||void 0)}),{data:o,isLoading:a}=Nt({queryKey:["sessions",""],queryFn:()=>lu()});return h.jsxs("div",{children:[h.jsxs("div",{style:{marginBottom:28},children:[h.jsx("h1",{className:"page-title",children:"Sessions"}),h.jsx("p",{className:"page-subtitle",children:"Session history"})]}),h.jsx(xR,{sessions:o??[],loading:a}),h.jsx("div",{style:{marginBottom:16,display:"flex",gap:6},children:mR.map(c=>h.jsx("button",{onClick:()=>t(c),className:`filter-btn${e===c?" active":""}`,children:c||"All"},c))}),i?h.jsx("div",{style:{display:"flex",justifyContent:"center",padding:48},children:h.jsx("div",{className:"loading-spinner"})}):h.jsx("div",{className:"glass-card animate-in stagger-1",style:{overflow:"hidden"},children:h.jsxs("table",{className:"data-table",children:[h.jsx("thead",{children:h.jsxs("tr",{children:[h.jsx("th",{children:"Sandbox ID"}),h.jsx("th",{children:"Template"}),h.jsx("th",{children:"Status"}),h.jsx("th",{children:"Started"}),h.jsx("th",{children:"Stopped"})]})}),h.jsxs("tbody",{children:[(r??[]).map(c=>h.jsxs(SR,{sandboxId:c.sandboxId,children:[h.jsx("td",{children:h.jsx("code",{style:{color:"var(--text-accent)"},children:c.sandboxId})}),h.jsx("td",{children:c.template||"base"}),h.jsx("td",{children:h.jsx(bR,{status:c.status})}),h.jsx("td",{style:{fontFamily:"var(--font-mono)",fontSize:12},children:new Date(c.startedAt).toLocaleString()}),h.jsx("td",{style:{fontFamily:"var(--font-mono)",fontSize:12},children:c.stoppedAt?new Date(c.stoppedAt).toLocaleString():"—"})]},c.id)),(r??[]).length===0&&h.jsx("tr",{children:h.jsx("td",{colSpan:5,style:{textAlign:"center",padding:32,color:"var(--text-tertiary)"},children:"No sessions found"})})]})]})})]})}function xR({sessions:e,loading:t}){const{days:r,maxCount:i}=L.useMemo(()=>{const o=new Date,a=[];for(let u=13;u>=0;u--){const p=new Date(o);p.setDate(p.getDate()-u);const f=p.toISOString().slice(0,10);a.push({label:p.toLocaleDateString("en-US",{month:"short",day:"numeric"}),date:f,count:0,hibernated:0,errored:0})}for(const u of e){const p=new Date(u.startedAt).toISOString().slice(0,10),f=a.find(g=>g.date===p);f&&(f.count++,u.status==="hibernated"?f.hibernated++:u.status==="error"&&f.errored++)}const c=Math.max(1,...a.map(u=>u.count));return{days:a,maxCount:c}},[e]);return h.jsxs("div",{className:"glass-card animate-in",style:{padding:"22px 24px",marginBottom:24},children:[h.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[h.jsx("span",{className:"section-title",style:{marginBottom:0},children:"Activity"}),h.jsx("span",{style:{fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:"Last 14 days"})]}),t?h.jsx("div",{style:{display:"flex",justifyContent:"center",padding:40},children:h.jsx("div",{className:"loading-spinner"})}):h.jsxs("div",{style:{position:"relative"},children:[h.jsxs("div",{style:{position:"absolute",left:0,top:0,bottom:24,display:"flex",flexDirection:"column",justifyContent:"space-between",width:32},children:[h.jsx("span",{style:{fontSize:10,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:i}),h.jsx("span",{style:{fontSize:10,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:"0"})]}),h.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:4,height:120,marginLeft:36},children:r.map(o=>{const a=i>0?Math.round(o.count/i*110):0,c=o.hibernated>0,u=o.errored>0;return h.jsx("div",{title:`${o.label}: ${o.count} sessions${o.hibernated?` (${o.hibernated} hibernated)`:""}${o.errored?` (${o.errored} errors)`:""}`,style:{flex:1,height:o.count>0?Math.max(a,4):0,borderRadius:"4px 4px 2px 2px",background:u?"linear-gradient(to top, rgba(251,113,133,0.5), rgba(129,140,248,0.5))":c?"linear-gradient(to top, rgba(34,211,238,0.4), rgba(129,140,248,0.5))":o.count>0?"linear-gradient(to top, rgba(99,102,241,0.25), rgba(129,140,248,0.5))":"transparent",transition:"height 0.3s ease",cursor:"default",position:"relative"},children:o.count>0&&h.jsx("span",{style:{position:"absolute",top:-16,left:"50%",transform:"translateX(-50%)",fontSize:9,fontFamily:"var(--font-mono)",color:"var(--text-tertiary)",whiteSpace:"nowrap"},children:o.count})},o.date)})}),h.jsx("div",{style:{display:"flex",gap:4,marginLeft:36,marginTop:6},children:r.map((o,a)=>h.jsx("div",{style:{flex:1,textAlign:"center",fontSize:9,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:a%2===0?o.label:""},o.date))}),h.jsxs("div",{style:{display:"flex",gap:16,justifyContent:"center",marginTop:12},children:[h.jsx(Gf,{color:"rgba(129,140,248,0.5)",label:"Sessions"}),h.jsx(Gf,{color:"rgba(34,211,238,0.4)",label:"Hibernated"}),h.jsx(Gf,{color:"rgba(251,113,133,0.5)",label:"Errors"})]})]})]})}function Gf({color:e,label:t}){return h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5},children:[h.jsx("div",{style:{width:8,height:8,borderRadius:2,background:e}}),h.jsx("span",{style:{fontSize:10,color:"var(--text-tertiary)"},children:t})]})}function SR({sandboxId:e,children:t}){const r=ji();return h.jsx("tr",{onClick:()=>r(`/sessions/${e}`),style:{cursor:"pointer"},onMouseOver:i=>{i.currentTarget.style.background="rgba(99,102,241,0.04)"},onMouseOut:i=>{i.currentTarget.style.background=""},children:t})}function bR({status:e}){const t=e==="running"?"badge-running":e==="hibernated"?"badge-hibernated":e==="error"?"badge-error":"badge-stopped";return h.jsxs("span",{className:`badge ${t}`,children:[e==="running"&&h.jsx("span",{className:"pulse-dot",style:{width:5,height:5,borderRadius:"50%",background:"currentColor",display:"inline-block"}}),e]})}const Yf={ready:"var(--accent-emerald, #34d399)",starting:"var(--accent-amber, #fbbf24)",degraded:"var(--accent-amber, #fbbf24)",error:"var(--accent-rose, #f87171)",unknown:"var(--text-tertiary)"};function wR(){const[e,t]=L.useState([]),[r,i]=L.useState({}),[o,a]=L.useState(!0),[c,u]=L.useState(null),[p,f]=L.useState(!1),g=ji();async function _(){try{const{agents:x}=await ub();t(x);const S={};await Promise.all(x.map(async w=>{try{S[w.id]=await db(w.id)}catch{}})),i(S)}catch(x){const S=x instanceof Error?x.message:String(x);u({kind:"error",text:`Failed to load agents: ${S}`})}finally{a(!1)}}L.useEffect(()=>{_();const x=setInterval(()=>void _(),5e3);return()=>clearInterval(x)},[]);async function y(x){if(window.confirm(`Delete agent "${x}"? The sandbox will be killed.`))try{await fb(x),u({kind:"success",text:`Agent ${x} deleted.`}),await _()}catch(S){u({kind:"error",text:`Delete failed: ${S.message}`})}}return h.jsxs("div",{children:[h.jsxs("header",{style:{marginBottom:28,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[h.jsxs("div",{children:[h.jsx("h1",{style:{fontSize:22,margin:0,fontFamily:"var(--font-display)",fontWeight:700},children:"Agents"}),h.jsx("p",{style:{color:"var(--text-secondary)",fontSize:13,marginTop:6},children:"Managed agent runtimes powered by OpenClaw. Add channels and packages to extend what they do."})]}),h.jsx("button",{onClick:()=>f(!0),style:Pv,children:"+ New agent"})]}),c&&h.jsxs("div",{style:{padding:"10px 14px",borderRadius:6,marginBottom:16,fontSize:13,background:c.kind==="error"?"rgba(248,113,113,0.08)":c.kind==="success"?"rgba(52,211,153,0.08)":"rgba(99,102,241,0.08)",border:`1px solid ${c.kind==="error"?"rgba(248,113,113,0.3)":c.kind==="success"?"rgba(52,211,153,0.3)":"rgba(99,102,241,0.3)"}`,color:"var(--text-primary)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[h.jsx("span",{children:c.text}),h.jsx("button",{onClick:()=>u(null),style:mb,children:"×"})]}),o?h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,color:"var(--text-tertiary)",fontSize:13,padding:"32px 0"},children:[h.jsx("span",{className:"loading-spinner",style:{width:14,height:14,borderWidth:1.5}}),"Loading agents…"]}):e.length===0?h.jsx(CR,{onCreate:()=>f(!0)}):h.jsx("div",{style:{display:"grid",gap:10},children:e.map(x=>{const S=r[x.id];return h.jsxs("div",{role:"button",tabIndex:0,onClick:()=>g(`/agents/${encodeURIComponent(x.id)}`),onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),g(`/agents/${encodeURIComponent(x.id)}`))},onMouseEnter:w=>{w.currentTarget.style.background="rgba(255,255,255,0.04)"},onMouseLeave:w=>{w.currentTarget.style.background="rgba(255,255,255,0.02)"},style:{background:"rgba(255,255,255,0.02)",border:"1px solid var(--border-subtle)",borderRadius:10,padding:"14px 18px",display:"flex",alignItems:"center",gap:16,cursor:"pointer",transition:"background 0.12s ease"},children:[h.jsx("div",{className:(S==null?void 0:S.status)==="starting"||(S==null?void 0:S.status)==="degraded"||S!=null&&S.current_operation?"pulse-dot":void 0,style:{width:8,height:8,borderRadius:"50%",background:Yf[(S==null?void 0:S.status)??"unknown"]??Yf.unknown,flexShrink:0,boxShadow:(S==null?void 0:S.status)==="starting"||S!=null&&S.current_operation?`0 0 0 3px ${Yf[(S==null?void 0:S.status)??"starting"]}22`:void 0},title:S!=null&&S.current_operation?`${S.current_operation.kind} · ${S.current_operation.phase}`:(S==null?void 0:S.status)??"unknown"}),h.jsxs("div",{style:{flex:1,minWidth:0},children:[h.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[h.jsx("span",{style:{fontWeight:600,fontSize:14},children:x.display_name}),h.jsx("span",{style:{fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:x.id})]}),h.jsxs("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:4,display:"flex",gap:12},children:[x.core&&h.jsxs("span",{children:["core: ",h.jsx("code",{style:LR,children:x.core})]}),h.jsxs("span",{children:["packages: ",x.packages.length===0?"—":x.packages.map(w=>w.name).join(", ")]}),h.jsxs("span",{children:["channels: ",x.channels.length===0?"—":x.channels.map(w=>w.name).join(", ")]})]}),(S==null?void 0:S.current_operation)&&h.jsxs("div",{style:{fontSize:11,color:"var(--accent-amber, #fbbf24)",marginTop:4,display:"flex",alignItems:"center",gap:6},children:[h.jsx("span",{className:"loading-spinner",style:{width:10,height:10,borderWidth:1.5,borderColor:"rgba(251,191,36,0.25)",borderTopColor:"var(--accent-amber, #fbbf24)"}}),h.jsxs("span",{children:[S.current_operation.kind," · ",S.current_operation.phase,S.current_operation.message?` — ${S.current_operation.message}`:""]})]}),(S==null?void 0:S.last_error)&&S.status!=="ready"&&h.jsxs("div",{style:{fontSize:11,color:"var(--accent-rose, #f87171)",marginTop:4},children:[S.last_error.phase,": ",S.last_error.message]})]}),h.jsx("div",{style:{display:"flex",gap:6},onClick:w=>w.stopPropagation(),children:h.jsx("button",{onClick:w=>{w.stopPropagation(),y(x.id)},style:TR,children:"Delete"})})]},x.id)})}),p&&h.jsx(ER,{onClose:()=>f(!1),onCreated:x=>{f(!1),g(`/agents/${encodeURIComponent(x)}`)},onError:x=>u({kind:"error",text:x})})]})}function CR({onCreate:e}){return h.jsxs("div",{style:{textAlign:"center",padding:"56px 24px 64px",border:"1px solid rgba(255,77,77,0.22)",borderRadius:14,background:"radial-gradient(ellipse at top, rgba(255,77,77,0.10), transparent 60%), rgba(255,255,255,0.015)",position:"relative",overflow:"hidden"},children:[h.jsx(kR,{}),h.jsx("div",{style:{fontSize:22,fontWeight:700,marginTop:18,fontFamily:"var(--font-display)"},children:"Deploy an OpenClaw managed agent"}),h.jsx("p",{style:{color:"var(--text-secondary)",fontSize:14,marginTop:10,marginBottom:26,maxWidth:520,marginLeft:"auto",marginRight:"auto",lineHeight:1.55},children:"OpenClaw runs the gateway, model routing, and tool execution inside a sandbox we manage for you. Connect Telegram, install gbrain for long-term memory, and you're live in under a minute."}),h.jsx("button",{onClick:e,style:Pv,children:"Create your first agent"})]})}function kR(){return h.jsxs("svg",{width:"80",height:"80",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",style:{filter:"drop-shadow(0 0 22px rgba(255,77,77,0.40))"},children:[h.jsx("defs",{children:h.jsxs("linearGradient",{id:"agents-lobster-gradient",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[h.jsx("stop",{offset:"0%",stopColor:"#ff4d4d"}),h.jsx("stop",{offset:"100%",stopColor:"#991b1b"})]})}),h.jsx("path",{d:"M60 10 C30 10 15 35 15 55 C15 75 30 95 45 100 L45 110 L55 110 L55 100 C55 100 60 102 65 100 L65 110 L75 110 L75 100 C90 95 105 75 105 55 C105 35 90 10 60 10Z",fill:"url(#agents-lobster-gradient)"}),h.jsx("path",{d:"M20 45 C5 40 0 50 5 60 C10 70 20 65 25 55 C28 48 25 45 20 45Z",fill:"url(#agents-lobster-gradient)"}),h.jsx("path",{d:"M100 45 C115 40 120 50 115 60 C110 70 100 65 95 55 C92 48 95 45 100 45Z",fill:"url(#agents-lobster-gradient)"}),h.jsx("path",{d:"M45 15 Q35 5 30 8",stroke:"#ff4d4d",strokeWidth:"3",strokeLinecap:"round"}),h.jsx("path",{d:"M75 15 Q85 5 90 8",stroke:"#ff4d4d",strokeWidth:"3",strokeLinecap:"round"}),h.jsx("circle",{cx:"45",cy:"35",r:"6",fill:"#050810"}),h.jsx("circle",{cx:"75",cy:"35",r:"6",fill:"#050810"}),h.jsx("circle",{cx:"46",cy:"34",r:"2.5",fill:"#00e5cc"}),h.jsx("circle",{cx:"76",cy:"34",r:"2.5",fill:"#00e5cc"})]})}function ER({onClose:e,onCreated:t,onError:r}){const[i,o]=L.useState(""),[a,c]=L.useState(""),[u,p]=L.useState("openclaw"),[f,g]=L.useState(!1);async function _(y){if(y.preventDefault(),!/^[a-z0-9][a-z0-9-]*$/.test(i)){r("id must be lowercase alphanumeric + hyphens, starting with a letter or digit");return}g(!0);try{await VP({id:i,display_name:a||i,core:u}),t(i)}catch(x){r(`Create failed: ${x.message}`)}finally{g(!1)}}return h.jsx(PR,{onClose:e,title:"Create agent",children:h.jsxs("form",{onSubmit:_,style:{display:"grid",gap:14},children:[h.jsx(Xf,{label:"Agent ID",hint:"lowercase, hyphens, must be unique",children:h.jsx("input",{autoFocus:!0,value:i,onChange:y=>o(y.target.value),placeholder:"my-bot",style:Jf,required:!0})}),h.jsx(Xf,{label:"Display name (optional)",children:h.jsx("input",{value:a,onChange:y=>c(y.target.value),placeholder:i||"My Bot",style:Jf})}),h.jsx(Xf,{label:"Core",hint:"OpenClaw is the only runtime available right now. Hermes support is coming soon.",children:h.jsxs("select",{value:u,onChange:y=>p(y.target.value),style:Jf,children:[h.jsx("option",{value:"openclaw",children:"openclaw"}),h.jsx("option",{value:"hermes",disabled:!0,children:"hermes (coming soon)"})]})}),h.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:4},children:[h.jsx("button",{type:"button",onClick:e,style:jR,children:"Cancel"}),h.jsx("button",{type:"submit",disabled:f||!i,style:Pv,children:f?h.jsx(RR,{text:"Creating…"}):"Create agent"})]})]})})}function PR({children:e,title:t,onClose:r}){return h.jsx("div",{onClick:r,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center",padding:20},children:h.jsxs("div",{onClick:i=>i.stopPropagation(),style:{background:"var(--bg-deep)",border:"1px solid var(--border-subtle)",borderRadius:12,width:"100%",maxWidth:480,maxHeight:"90vh",overflowY:"auto",padding:22},children:[h.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:18},children:[h.jsx("h2",{style:{fontSize:16,margin:0,fontFamily:"var(--font-display)"},children:t}),h.jsx("button",{onClick:r,style:mb,children:"×"})]}),e]})})}function Xf({label:e,hint:t,children:r}){return h.jsxs("label",{style:{display:"grid",gap:4},children:[h.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)",fontWeight:500},children:e}),r,t&&h.jsx("span",{style:{fontSize:11,color:"var(--text-tertiary)"},children:t})]})}function RR({text:e}){return h.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[h.jsx("span",{className:"loading-spinner",style:{width:11,height:11,borderWidth:1.5,borderColor:"rgba(255,255,255,0.25)",borderTopColor:"currentColor"}}),e]})}const Pv={background:"var(--gradient-primary, #6366f1)",color:"#fff",padding:"8px 14px",border:"none",borderRadius:6,cursor:"pointer",fontSize:13,fontWeight:600,fontFamily:"var(--font-body)"},jR={background:"rgba(255,255,255,0.04)",color:"var(--text-primary)",padding:"7px 12px",border:"1px solid var(--border-subtle)",borderRadius:6,cursor:"pointer",fontSize:12,fontFamily:"var(--font-body)"},TR={background:"rgba(248,113,113,0.08)",color:"#f87171",padding:"7px 12px",border:"1px solid rgba(248,113,113,0.35)",borderRadius:6,cursor:"pointer",fontSize:12,fontFamily:"var(--font-body)"},mb={background:"none",border:"none",color:"var(--text-tertiary)",cursor:"pointer",fontSize:22,padding:0,width:22,height:22,lineHeight:1},Jf={background:"rgba(255,255,255,0.02)",border:"1px solid var(--border-subtle)",borderRadius:6,padding:"8px 10px",color:"var(--text-primary)",fontSize:13,fontFamily:"var(--font-body)",outline:"none"},LR={fontFamily:"var(--font-mono)",background:"rgba(255,255,255,0.04)",padding:"1px 5px",borderRadius:3,fontSize:10.5},Zf={ready:"var(--accent-emerald, #34d399)",starting:"var(--accent-amber, #fbbf24)",degraded:"var(--accent-amber, #fbbf24)",error:"var(--accent-rose, #f87171)",unknown:"var(--text-tertiary)"};function MR(){const{agentId:e=""}=Ax(),t=ji(),[r,i]=L.useState(null),[o,a]=L.useState({}),[c,u]=L.useState(!0),[p,f]=L.useState("overview"),[g,_]=L.useState(null),[y,x]=L.useState(null);async function S(){try{const I=await db(e);i(I);try{const k=await pb(e),R={};for(const M of k.entitlements)R[M.feature]=M;a(R)}catch{}}catch(I){_({kind:"error",text:`Failed to load agent: ${I.message}`})}finally{u(!1)}}L.useEffect(()=>{S();const I=setInterval(()=>void S(),5e3);return()=>clearInterval(I)},[e]);async function w(I,k,R){x(I);try{await k(),_({kind:"success",text:R}),await S()}catch(M){_({kind:"error",text:`${I} failed: ${M.message}`})}finally{x(null)}}async function C(){if(window.confirm(`Delete agent "${e}"? Sandbox will be killed.`)){x("delete");try{await fb(e),t("/agents")}catch(I){_({kind:"error",text:`Delete failed: ${I.message}`}),x(null)}}}if(c&&!r)return h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,color:"var(--text-tertiary)",fontSize:13,padding:"32px 0"},children:[h.jsx("span",{className:"loading-spinner",style:{width:14,height:14,borderWidth:1.5}}),"Loading agent…"]});if(!r)return h.jsxs("div",{children:[h.jsx("button",{onClick:()=>t("/agents"),style:Ci,children:"← Back"}),h.jsx("p",{style:{color:"var(--accent-rose, #f87171)",marginTop:16},children:"Agent not found."})]});const E=r.sandbox_id;return h.jsxs("div",{children:[h.jsx("button",{onClick:()=>t("/agents"),style:{...Ci,marginBottom:16},children:"← Agents"}),h.jsxs("div",{style:{background:"rgba(255,255,255,0.02)",border:"1px solid var(--border-subtle)",borderRadius:10,padding:"18px 22px",display:"flex",alignItems:"flex-start",gap:18,marginBottom:18},children:[h.jsx("div",{className:r.status==="starting"||r.status==="degraded"||r.current_operation?"pulse-dot":void 0,style:{width:12,height:12,borderRadius:"50%",background:Zf[r.status]??Zf.unknown,boxShadow:r.status==="starting"||r.current_operation?`0 0 0 4px ${Zf[r.status]}22`:void 0,flexShrink:0,marginTop:6}}),h.jsxs("div",{style:{flex:1,minWidth:0},children:[h.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:10},children:[h.jsx("h1",{style:{margin:0,fontSize:20,fontFamily:"var(--font-display)",fontWeight:700},children:r.display_name}),h.jsx("span",{style:{fontSize:12,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:r.id}),h.jsx("span",{style:$l(r.status==="ready"?"emerald":r.status==="error"?"rose":"amber"),children:r.status})]}),h.jsxs("div",{style:{fontSize:12,color:"var(--text-secondary)",marginTop:6,display:"flex",gap:14,flexWrap:"wrap"},children:[r.core&&h.jsxs("span",{children:["core: ",h.jsx("code",{style:Vs,children:r.core})]}),r.model&&h.jsxs("span",{children:["model: ",h.jsx("code",{style:Vs,children:r.model})]}),r.instance_id&&h.jsxs("span",{children:["instance: ",h.jsxs("code",{style:Vs,children:[r.instance_id.slice(0,18),"…"]})]}),E&&h.jsxs("span",{children:["sandbox: ",h.jsx("code",{style:Vs,children:E})]})]}),r.current_operation&&h.jsxs("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginTop:8,fontFamily:"var(--font-mono)"},children:[r.current_operation.kind," · ",r.current_operation.phase,r.current_operation.message?` — ${r.current_operation.message}`:""]}),r.last_error&&r.status!=="ready"&&h.jsxs("div",{style:{fontSize:12,color:"var(--accent-rose, #f87171)",marginTop:8},children:[r.last_error.phase,": ",r.last_error.message]})]}),h.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",justifyContent:"flex-end"},children:[(()=>{const I=o.telegram;if(!(I&&I.entitled===!1&&I.reason!=="ungated"))return null;const R=I.price_monthly_cents??2e3;return h.jsxs("button",{onClick:()=>f("channels"),style:{background:"rgba(99,102,241,0.08)",color:"var(--accent-indigo, #818cf8)",border:"1px solid rgba(99,102,241,0.35)",padding:"6px 12px",borderRadius:999,cursor:"pointer",fontSize:12,fontFamily:"var(--font-body)",display:"inline-flex",alignItems:"center",gap:6},title:`Subscribe to Telegram channel for $${(R/100).toFixed(0)}/mo`,children:[h.jsx("span",{style:{fontSize:11},children:"★"}),"Upgrade — $",(R/100).toFixed(0),"/mo"]})})(),h.jsx("button",{onClick:()=>w("restart core",()=>ZP(e),"Core restarted."),disabled:!!y,style:Ci,title:"Kill and respawn the core process; sandbox VM stays up.",children:y==="restart core"?h.jsx(Mo,{text:"Restarting…"}):"Restart core"}),h.jsx("button",{onClick:()=>E?w("reboot sandbox",()=>cb(E),"Sandbox rebooted."):null,disabled:!!y||!E,style:Ci,title:"Reboot the sandbox VM (guest kernel restart).",children:y==="reboot sandbox"?h.jsx(Mo,{text:"Rebooting…"}):"Reboot sandbox"}),h.jsx("button",{onClick:C,disabled:!!y,style:hu,children:y==="delete"?h.jsx(Mo,{text:"Deleting…"}):"Delete"})]})]}),r.current_operation&&r.status!=="ready"&&h.jsx(GR,{operation:r.current_operation}),g&&h.jsxs("div",{style:{padding:"10px 14px",borderRadius:6,marginBottom:14,fontSize:13,background:g.kind==="error"?"rgba(248,113,113,0.08)":g.kind==="success"?"rgba(52,211,153,0.08)":"rgba(99,102,241,0.08)",border:`1px solid ${g.kind==="error"?"rgba(248,113,113,0.3)":g.kind==="success"?"rgba(52,211,153,0.3)":"rgba(99,102,241,0.3)"}`,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[h.jsx("span",{children:g.text}),h.jsx("button",{onClick:()=>_(null),style:Rv,children:"×"})]}),h.jsx("div",{style:{display:"flex",borderBottom:"1px solid var(--border-subtle)",marginBottom:18,gap:4},children:["overview","channels","plugins","events","logs","advanced"].map(I=>h.jsx("button",{onClick:()=>f(I),style:{background:"none",border:"none",borderBottom:p===I?"2px solid var(--accent-indigo)":"2px solid transparent",padding:"10px 14px",color:p===I?"var(--text-primary)":"var(--text-secondary)",fontSize:13,fontFamily:"var(--font-body)",fontWeight:p===I?600:400,cursor:"pointer",textTransform:"capitalize"},children:I},I))}),p==="overview"&&h.jsx(IR,{agentId:e,detail:r}),p==="channels"&&h.jsx($R,{detail:r,acting:y,onAction:(I,k,R)=>w(I,k,R)}),p==="plugins"&&h.jsx(NR,{detail:r,acting:y,onAction:(I,k,R)=>w(I,k,R)}),p==="events"&&h.jsx(UR,{agentId:e}),p==="logs"&&h.jsx(DR,{agentId:e,core:r.core}),p==="advanced"&&h.jsx(BR,{detail:r})]})}function DR({agentId:e,core:t}){const[r,i]=L.useState(""),[o,a]=L.useState(null),[c,u]=L.useState(!1),[p,f]=L.useState(!0),g=L.useRef(null);async function _(){try{const y=await eR(e,500);i(y.content),a(null)}catch(y){a(y.message)}finally{f(!1)}}return L.useEffect(()=>{if(c)return;_();const y=setInterval(()=>void _(),3e3);return()=>clearInterval(y)},[e,c]),L.useEffect(()=>{const y=g.current;if(!y)return;y.scrollHeight-y.scrollTop-y.clientHeight<80&&(y.scrollTop=y.scrollHeight)},[r]),t!=="openclaw"?h.jsx("p",{style:{fontSize:13,color:"var(--text-tertiary)"},children:"Process logs are only available for OpenClaw agents right now."}):h.jsxs("div",{style:{display:"grid",gap:10},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[h.jsxs("div",{style:{fontSize:12,color:"var(--text-tertiary)"},children:["Tailing ",h.jsx("code",{style:Vs,children:"/tmp/openclaw-gateway.log"})," · refresh every 3s ·"," ",h.jsx("span",{style:{color:c?"var(--accent-amber, #fbbf24)":"var(--accent-emerald, #34d399)"},children:c?"paused":"live"})]}),h.jsxs("div",{style:{display:"flex",gap:6},children:[h.jsx("button",{onClick:()=>u(y=>!y),style:Ci,children:c?"Resume":"Pause"}),h.jsx("button",{onClick:()=>void _(),style:Ci,children:"Refresh"})]})]}),o?h.jsx("div",{style:{fontSize:12,color:"#f87171",background:"rgba(248,113,113,0.06)",border:"1px solid rgba(248,113,113,0.2)",padding:"8px 10px",borderRadius:6},children:o}):null,h.jsx("pre",{ref:g,style:{fontSize:11,fontFamily:"var(--font-mono)",background:"rgba(255,255,255,0.02)",border:"1px solid var(--border-subtle)",padding:12,borderRadius:6,margin:0,height:"60vh",overflow:"auto",whiteSpace:"pre-wrap",wordBreak:"break-word",color:"var(--text-secondary)"},children:p&&!r?"Loading…":r||"(no log lines yet)"})]})}function BR({detail:e}){const t=ji(),r=e.sandbox_id;return h.jsxs("div",{style:{display:"grid",gap:18,maxWidth:720},children:[h.jsxs(Rl,{title:"Underlying sandbox",children:[h.jsx("p",{style:{fontSize:13,color:"var(--text-secondary)",margin:0},children:"Each managed agent runs inside an OC sandbox VM. Open the sandbox view to inspect processes, terminal access, preview URLs, reboot/power-cycle controls, and checkpoint history."}),h.jsx("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",marginTop:4},children:r?h.jsxs(h.Fragment,{children:[h.jsx("code",{style:Vs,children:r}),h.jsx("button",{onClick:()=>t(`/sessions/${encodeURIComponent(r)}`),style:Xo,children:"Open sandbox details →"})]}):h.jsx("span",{style:{fontSize:12,color:"var(--text-tertiary)"},children:"No sandbox provisioned yet."})})]}),h.jsx(Rl,{title:"Identifiers",children:h.jsxs("div",{style:{display:"grid",gap:6,fontSize:12},children:[h.jsx(el,{label:"Agent ID",value:e.id}),e.instance_id&&h.jsx(el,{label:"Instance ID",value:e.instance_id}),r&&h.jsx(el,{label:"Sandbox ID",value:r}),e.secret_store&&h.jsx(el,{label:"Secret store",value:e.secret_store}),e.core&&h.jsx(el,{label:"Core",value:e.core})]})}),h.jsx(Rl,{title:"Raw config",children:h.jsxs("details",{children:[h.jsx("summary",{style:{cursor:"pointer",fontSize:12,color:"var(--text-secondary)"},children:"Show JSON"}),h.jsx("pre",{style:{fontSize:11,fontFamily:"var(--font-mono)",background:"rgba(255,255,255,0.02)",border:"1px solid var(--border-subtle)",padding:10,borderRadius:6,overflow:"auto",margin:"8px 0 0 0",maxHeight:320},children:JSON.stringify(e.config,null,2)})]})})]})}function el({label:e,value:t}){return h.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[h.jsx("span",{style:{color:"var(--text-tertiary)",minWidth:100},children:e}),h.jsx("code",{style:{...Vs,fontSize:11,wordBreak:"break-all"},children:t})]})}function IR({agentId:e,detail:t}){return h.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) 280px",gap:18,alignItems:"start"},children:[h.jsx(FR,{agentId:e,instanceId:t.instance_id,disabled:t.status!=="ready"}),h.jsx(OR,{detail:t})]})}function OR({detail:e}){var o,a,c,u;const t=e.status==="ready"?"emerald":e.status==="error"?"rose":"amber",r=p=>p==="connected"?"emerald":p==="error"?"rose":"amber",i=p=>p==="installed"?"emerald":p==="error"?"rose":"amber";return h.jsxs("aside",{style:{background:"rgba(255,255,255,0.02)",border:"1px solid var(--border-subtle)",borderRadius:10,padding:"16px 18px",display:"grid",gap:16,position:"sticky",top:16},children:[h.jsxs("div",{children:[h.jsx("h3",{style:_h,children:"Health"}),h.jsxs("div",{style:{display:"grid",gap:8},children:[h.jsx(tl,{label:"Agent",value:e.status,tone:t}),h.jsx(tl,{label:"Core",value:((o=e.core_status)==null?void 0:o.status)??"unknown",tone:((a=e.core_status)==null?void 0:a.status)==="ready"?"emerald":((c=e.core_status)==null?void 0:c.status)==="error"?"rose":"amber"}),h.jsx(tl,{label:"Instance",value:e.instance_status??"—",tone:e.instance_status==="running"?"emerald":"amber"})]}),((u=e.core_status)==null?void 0:u.message)&&e.status!=="ready"&&h.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginTop:8},children:e.core_status.message})]}),Object.keys(e.channel_status??{}).length>0&&h.jsxs("div",{children:[h.jsx("h3",{style:_h,children:"Channels"}),h.jsx("div",{style:{display:"grid",gap:6},children:Object.entries(e.channel_status).map(([p,f])=>h.jsx(tl,{label:p,value:f.status,tone:r(f.status),detail:f.message},p))})]}),Object.keys(e.package_status??{}).length>0&&h.jsxs("div",{children:[h.jsx("h3",{style:_h,children:"Packages"}),h.jsx("div",{style:{display:"grid",gap:6},children:Object.entries(e.package_status).map(([p,f])=>h.jsx(tl,{label:p,value:f.status,tone:i(f.status),detail:f.message},p))})]}),e.last_error&&e.status!=="ready"&&h.jsxs("div",{children:[h.jsx("h3",{style:_h,children:"Last error"}),h.jsxs("div",{style:{fontSize:11,fontFamily:"var(--font-mono)",color:"#f87171",background:"rgba(248,113,113,0.06)",border:"1px solid rgba(248,113,113,0.2)",padding:"8px 10px",borderRadius:6,wordBreak:"break-word"},children:[h.jsx("div",{style:{color:"#fca5a5",marginBottom:4},children:e.last_error.phase}),e.last_error.message]})]})]})}const _h={fontSize:10,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--text-tertiary)",margin:"0 0 8px 0",fontFamily:"var(--font-mono)",fontWeight:600};function tl({label:e,value:t,tone:r,detail:i}){return h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,fontSize:12},children:[h.jsx("span",{style:{color:"var(--text-secondary)",textTransform:"capitalize"},children:e}),h.jsx("span",{style:$l(r),children:t})]}),i&&h.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",wordBreak:"break-word"},children:i})]})}function FR({agentId:e,instanceId:t,disabled:r}){const[i,o]=L.useState([]),[a,c]=L.useState(""),[u,p]=L.useState(!1),[f]=L.useState(()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`c-${Date.now()}`),g=L.useRef(null),_=L.useRef(null);L.useEffect(()=>{g.current&&(g.current.scrollTop=g.current.scrollHeight)},[i,u]),L.useEffect(()=>{var x;!u&&!r&&((x=_.current)==null||x.focus())},[u,r]);async function y(){if(!a.trim()||!t||u)return;const x=a.trim();c("");const S=i.filter(E=>(E.role==="user"||E.role==="assistant")&&E.text.length>0).map(E=>({role:E.role,content:E.text}));S.push({role:"user",content:x}),o(E=>[...E,{role:"user",text:x},{role:"assistant",text:""}]),p(!0);let w=!1,C=!1;try{for await(const E of iR(e,t,x,f,S))if(E.type==="text"&&E.content)w=!0,o(I=>{const k=[...I],R=k[k.length-1];return R&&R.role==="assistant"&&(k[k.length-1]={...R,text:R.text+E.content}),k});else if(E.type==="done"){C=!0;break}w||o(E=>{var k;const I=[...E];return((k=I[I.length-1])==null?void 0:k.role)==="assistant"&&!I[I.length-1].text&&I.pop(),I.push({role:"system",text:C?"Agent ended the turn without sending any text. Likely the OpenClaw chat-completions endpoint is disabled (snapshot needs gateway.http.endpoints.chatCompletions.enabled=true), or OPENROUTER_API_KEY is missing from the agent's secret store.":"Stream closed before any response. Likely sessions-api or the proxy timed out."}),I})}catch(E){o(I=>{var R;const k=[...I];return((R=k[k.length-1])==null?void 0:R.role)==="assistant"&&!k[k.length-1].text&&k.pop(),k.push({role:"system",text:`Error: ${E.message}`}),k})}finally{p(!1)}}return t?h.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"60vh",minHeight:400},children:[h.jsxs("div",{ref:g,style:{flex:1,overflowY:"auto",background:"rgba(255,255,255,0.02)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:16,marginBottom:12,display:"flex",flexDirection:"column",gap:10},children:[i.length===0&&h.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:13,margin:0},children:"Talk to the agent here. Messages don't go through Telegram — direct via the platform's instance API."}),i.map((x,S)=>h.jsx("div",{style:{alignSelf:x.role==="user"?"flex-end":"flex-start",maxWidth:"78%",background:x.role==="user"?"var(--gradient-primary, #6366f1)":x.role==="system"?"rgba(248,113,113,0.1)":"rgba(255,255,255,0.04)",color:x.role==="user"?"#fff":x.role==="system"?"#f87171":"var(--text-primary)",padding:"8px 12px",borderRadius:10,fontSize:13,whiteSpace:"pre-wrap",border:x.role==="system"?"1px solid rgba(248,113,113,0.3)":"none"},children:x.text||(u&&x.role==="assistant"&&S===i.length-1?"…":"")},S))]}),h.jsxs("form",{onSubmit:x=>{x.preventDefault(),y()},style:{display:"flex",gap:8},children:[h.jsx("input",{ref:_,value:a,onChange:x=>c(x.target.value),placeholder:r?"Agent not ready":"Send a message…",disabled:r||u,style:{...xb,flex:1},autoFocus:!0}),h.jsx("button",{type:"submit",disabled:r||u||!a.trim(),style:Xo,children:u?h.jsx(Mo,{text:"Sending…"}):"Send"})]})]}):h.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:13},children:"Agent has no instance yet. Once the sandbox is up you'll be able to chat here."})}function $R({detail:e,acting:t,onAction:r}){var R,M,F;const[i,o]=L.useState(!1),[a,c]=L.useState(!1),[u,p]=L.useState(!1),[f,g]=L.useState({}),_=e.channels.some(W=>W.name==="telegram"),y=e.core!==null;async function x(){try{const W=await pb(e.id),H={};for(const K of W.entitlements)H[K.feature]=K;g(H)}catch{}}if(L.useEffect(()=>{x()},[e.id]),!y)return h.jsx("p",{style:{fontSize:13,color:"var(--text-tertiary)"},children:"This agent has no managed core, so channels aren't applicable."});const S=f.telegram,w=(S==null?void 0:S.entitled)!==!1,C=(S==null?void 0:S.reason)==="ungated",E=(S==null?void 0:S.price_monthly_cents)??2e3;async function I(){if(_){o(!0);return}if(!w){c(!0);return}o(!0)}async function k(){p(!0);try{const W=await tR(e.id,"telegram");if(W.status==="checkout_required"){window.location.href=W.checkout_url;return}await x(),c(!1),o(!0)}catch(W){alert(`Subscription failed: ${W.message}`)}finally{p(!1)}}return h.jsxs(h.Fragment,{children:[h.jsxs("div",{style:yb,children:[h.jsx(cu,{tag:"channel",accent:"sky",icon:"✈️",name:"Telegram",description:C?"Talk to the agent through a Telegram bot. (Paywall not configured on this deployment.)":w?"Talk to the agent through a Telegram bot.":`Talk to the agent through a Telegram bot. $${(E/100).toFixed(0)}/mo per agent.`,status:_?"connected":"available",actionLabel:_?"Configure":w?"Connect":`Subscribe & connect — $${(E/100).toFixed(0)}/mo`,actionTone:_?"secondary":"primary",busy:t==="connect telegram"||t==="disconnect telegram",disabled:!!t,onAction:I}),WR.map(W=>h.jsx(cu,{tag:"channel",accent:"muted",icon:W.icon,name:W.name,description:W.description,status:"coming"},W.name))]}),a&&h.jsx(AR,{priceCents:E,subscribing:u,onClose:()=>c(!1),onSubscribe:k}),i&&h.jsx(HR,{alreadyConnected:_,ungated:C,subscriptionActive:!!((R=f.telegram)!=null&&R.entitled)&&!C,subscriptionWillCancel:!!((M=f.telegram)!=null&&M.cancel_at_period_end),subscriptionRenewsAt:(F=f.telegram)==null?void 0:F.current_period_end,onClose:()=>o(!1),onSubmit:async W=>{o(!1),await r("connect telegram",()=>GP(e.id,W),_?"Telegram bot token updated — webhook re-registered.":"Telegram connect queued — webhook will register shortly.")},onDisconnect:async()=>{o(!1),await r("disconnect telegram",()=>YP(e.id),"Telegram disconnected.")},onCancelSubscription:async()=>{try{await gb(e.id,"telegram"),await x(),o(!1),alert("Subscription scheduled to cancel at period end. Telegram remains active until then.")}catch(W){alert(`Cancel failed: ${W.message}`)}}})]})}function AR({priceCents:e,subscribing:t,onClose:r,onSubscribe:i}){return h.jsx("div",{onClick:r,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center",padding:20},children:h.jsxs("div",{onClick:o=>o.stopPropagation(),style:{background:"var(--bg-deep)",border:"1px solid var(--border-subtle)",borderRadius:12,width:"100%",maxWidth:460,padding:22},children:[h.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:14},children:[h.jsx("h2",{style:{fontSize:16,margin:0,fontFamily:"var(--font-display)"},children:"Subscribe to Telegram for this agent"}),h.jsx("button",{onClick:r,style:Rv,children:"×"})]}),h.jsxs("div",{style:{fontSize:13,color:"var(--text-secondary)",lineHeight:1.6,marginBottom:16},children:["Connecting Telegram to a managed agent costs ",h.jsxs("b",{children:["$",(e/100).toFixed(0),"/month"]}),". Each agent you connect to Telegram is billed separately. Cancel any time — service runs to the end of the current billing period."]}),h.jsx("div",{style:{background:"rgba(99,102,241,0.08)",border:"1px solid rgba(99,102,241,0.2)",borderRadius:6,padding:"10px 12px",fontSize:12,color:"var(--text-secondary)",marginBottom:16},children:"Your card on file will be charged immediately and prorated to the end of the current billing period. If no card is on file, Stripe Checkout will collect one."}),h.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[h.jsx("button",{type:"button",onClick:r,style:Ci,children:"Cancel"}),h.jsx("button",{onClick:()=>void i(),disabled:t,style:Xo,children:t?h.jsx(Mo,{text:"Subscribing…"}):`Subscribe — $${(e/100).toFixed(0)}/mo`})]})]})})}function NR({detail:e,acting:t,onAction:r}){var x;const i=e.packages.some(S=>S.name==="gbrain"),o=e.core!==null,a=(x=e.package_status)==null?void 0:x.gbrain,c=(a==null?void 0:a.status)==="installing",u=(a==null?void 0:a.status)==="error",p=u?(a==null?void 0:a.message)??"Install failed":void 0;if(!o)return h.jsx("p",{style:{fontSize:13,color:"var(--text-tertiary)"},children:"This agent has no managed core, so plugins aren't applicable."});let f=i?"connected":"available",g=i?"installed":void 0,_=i?"Uninstall":"Install",y=i?"danger":"primary";return c?(g="installing…",_=void 0):u&&(f="error",g="install failed",_="Retry",y="primary"),h.jsxs("div",{style:yb,children:[h.jsx(cu,{tag:"plugin",accent:"indigo",icon:"🧠",name:"gbrain",description:"Long-term memory + vector recall.",status:f,statusLabel:g,errorMessage:p,actionLabel:_,actionTone:y,secondaryActionLabel:u?"Clear":void 0,secondaryActionTone:"secondary",onSecondaryAction:u?()=>r("clear gbrain error",()=>s1(e.id),"gbrain install state cleared."):void 0,busy:t==="install gbrain"||t==="uninstall gbrain"||t==="clear gbrain error",disabled:!!t,onAction:_?()=>i?r("uninstall gbrain",()=>s1(e.id),"gbrain uninstalled."):r("install gbrain",()=>QP(e.id),"gbrain install queued."):void 0}),zR.map(S=>h.jsx(cu,{tag:"plugin",accent:"muted",icon:S.icon,name:S.name,description:S.description,status:"coming"},S.name))]})}const zR=[{icon:"📝",name:"Notion",description:"Read/write pages and databases."},{icon:"🐙",name:"GitHub",description:"Issues, PRs, comments, files."},{icon:"#",name:"Slack",description:"Post messages, react, search."},{icon:"📧",name:"Gmail",description:"Read/send mail, labels, drafts."},{icon:"📅",name:"Google Calendar",description:"Events, scheduling, busy/free."},{icon:"📄",name:"Google Drive",description:"Search, read, share files."},{icon:"🎫",name:"Linear",description:"Issues, cycles, projects."},{icon:"🎨",name:"Figma",description:"Files, comments, frames."},{icon:"💳",name:"Stripe",description:"Customers, payments, subscriptions."},{icon:"🛠️",name:"MCP servers",description:"Bring your own tool integrations."}],yb={display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:14},WR=[{icon:"💬",name:"Discord",description:"Server chat + DMs."},{icon:"📱",name:"WhatsApp",description:"Cloud API webhook."},{icon:"#",name:"Slack",description:"Workspace bot."},{icon:"✉️",name:"Email",description:"IMAP / inbound webhook."}];function cu({tag:e,accent:t,icon:r,name:i,description:o,status:a,statusLabel:c,errorMessage:u,actionLabel:p,actionTone:f,secondaryActionLabel:g,secondaryActionTone:_,onSecondaryAction:y,busy:x,disabled:S,onAction:w}){const C=t==="indigo"?"rgba(99,102,241,0.7)":t==="sky"?"rgba(56,189,248,0.7)":"rgba(255,255,255,0.12)";return h.jsxs("div",{style:{background:"rgba(255,255,255,0.02)",border:"1px solid var(--border-subtle)",borderRadius:10,padding:14,display:"flex",flexDirection:"column",gap:12,opacity:a==="coming"?.55:1,minHeight:168},children:[h.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8},children:[h.jsx("div",{style:{width:34,height:34,borderRadius:8,background:`linear-gradient(135deg, ${C}, rgba(255,255,255,0.04))`,display:"flex",alignItems:"center",justifyContent:"center",fontSize:18},"aria-hidden":!0,children:r}),h.jsx("span",{style:{fontSize:9,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:e})]}),h.jsxs("div",{style:{flex:1},children:[h.jsx("div",{style:{fontSize:14,fontWeight:600,color:"var(--text-primary)"},children:i}),h.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)",marginTop:4,lineHeight:1.4},children:o})]}),a==="connected"&&h.jsx("span",{style:$l("emerald"),children:c??"connected"}),a==="error"&&h.jsx("span",{style:$l("rose"),children:c??"error"}),a==="coming"&&h.jsx("span",{style:{alignSelf:"flex-start",fontSize:10,fontFamily:"var(--font-mono)",color:"var(--text-tertiary)",background:"rgba(255,255,255,0.04)",border:"1px solid var(--border-subtle)",padding:"3px 8px",borderRadius:999,textTransform:"uppercase",letterSpacing:"0.08em"},children:"coming soon"}),u&&h.jsx("div",{style:{fontSize:11,color:"rgba(252,165,165,0.95)",background:"rgba(239,68,68,0.08)",border:"1px solid rgba(239,68,68,0.25)",borderRadius:6,padding:"6px 8px",lineHeight:1.4,fontFamily:"var(--font-mono)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:u}),(p||g)&&a!=="coming"&&h.jsxs("div",{style:{display:"flex",gap:8},children:[p&&h.jsx("button",{onClick:w,disabled:S||x,style:f==="danger"?hu:f==="secondary"?Ci:Xo,children:x?h.jsx(Mo,{text:"Working…"}):p}),g&&h.jsx("button",{onClick:y,disabled:S||x,style:_==="danger"?hu:_==="primary"?Xo:Ci,children:g})]})]})}function HR({alreadyConnected:e,ungated:t,subscriptionActive:r,subscriptionWillCancel:i,subscriptionRenewsAt:o,onClose:a,onSubmit:c,onDisconnect:u,onCancelSubscription:p}){const[f,g]=L.useState(""),_=e?"Configure Telegram":"Connect Telegram";return h.jsx("div",{onClick:a,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center",padding:20},children:h.jsxs("div",{onClick:y=>y.stopPropagation(),style:{background:"var(--bg-deep)",border:"1px solid var(--border-subtle)",borderRadius:12,width:"100%",maxWidth:460,padding:22},children:[h.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[h.jsx("h2",{style:{fontSize:16,margin:0,fontFamily:"var(--font-display)"},children:_}),h.jsx("button",{onClick:a,style:Rv,children:"×"})]}),e&&h.jsx("p",{style:{fontSize:12,color:"var(--text-secondary)",margin:"0 0 14px 0",lineHeight:1.5},children:"Telegram is currently connected. Paste a new bot token to swap it, or disconnect to detach this agent from Telegram entirely."}),t&&h.jsxs("div",{style:{background:"rgba(251,191,36,0.08)",border:"1px solid rgba(251,191,36,0.25)",borderRadius:6,padding:"8px 12px",marginBottom:14,fontSize:12,color:"var(--text-secondary)"},children:[h.jsx("b",{style:{color:"#fbbf24"},children:"Not gated yet"})," on this deployment — connect proceeds without a subscription. Set ",h.jsx("code",{style:Vs,children:"STRIPE_TELEGRAM_AGENT_PRICE_ID"})," on the server to enable the paywall."]}),!t&&r&&h.jsx("div",{style:{background:"rgba(52,211,153,0.08)",border:"1px solid rgba(52,211,153,0.2)",borderRadius:6,padding:"8px 12px",marginBottom:14,fontSize:12,color:"var(--text-secondary)"},children:i?h.jsxs(h.Fragment,{children:["Subscription ",h.jsx("b",{children:"scheduled to cancel"}),o&&` on ${new Date(o).toLocaleDateString()}`,". Telegram remains active until then."]}):h.jsxs(h.Fragment,{children:["Subscription ",h.jsx("b",{style:{color:"#34d399"},children:"active"}),o&&` · renews ${new Date(o).toLocaleDateString()}`,"."," ",h.jsx("button",{type:"button",onClick:()=>{window.confirm("Cancel Telegram subscription? Service continues until period end.")&&p()},style:{background:"none",border:"none",color:"var(--accent-rose, #f87171)",cursor:"pointer",padding:0,fontSize:12,textDecoration:"underline"},children:"Cancel subscription"})]})}),h.jsxs("form",{onSubmit:y=>{y.preventDefault(),f.trim()&&c(f.trim())},style:{display:"grid",gap:14},children:[h.jsx(KR,{label:e?"New bot token":"Bot token",hint:"Paste the token @BotFather gave you. Stored in this agent's secret store.",children:h.jsx("input",{autoFocus:!0,value:f,onChange:y=>g(y.target.value),placeholder:"1234567890:AAA…",style:xb})}),h.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"space-between",alignItems:"center"},children:[e?h.jsx("button",{type:"button",onClick:()=>{window.confirm("Disconnect Telegram from this agent? Subscription remains active until cancelled separately.")&&u()},style:hu,children:"Disconnect"}):h.jsx("span",{}),h.jsxs("div",{style:{display:"flex",gap:8},children:[h.jsx("button",{type:"button",onClick:a,style:Ci,children:"Cancel"}),h.jsx("button",{type:"submit",disabled:!f.trim(),style:Xo,children:e?"Update":"Connect"})]})]})]})]})})}function UR({agentId:e}){const[t,r]=L.useState([]),[i,o]=L.useState([]),[a,c]=L.useState(!0);async function u(){try{const[p,f]=await Promise.all([XP(e,100),JP(e,30)]);r(p.events),o(f.operations)}catch{}finally{c(!1)}}return L.useEffect(()=>{u();const p=setInterval(()=>void u(),5e3);return()=>clearInterval(p)},[e]),a?h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,color:"var(--text-tertiary)",fontSize:13},children:[h.jsx("span",{className:"loading-spinner",style:{width:14,height:14,borderWidth:1.5}}),"Loading events…"]}):h.jsxs("div",{style:{display:"grid",gap:22},children:[h.jsx(Rl,{title:"Events",children:t.length===0?h.jsx("p",{style:{fontSize:12,color:"var(--text-tertiary)"},children:"No events yet."}):h.jsx("div",{style:{display:"grid",gap:6},children:t.map(p=>h.jsxs("div",{style:{fontSize:12,fontFamily:"var(--font-mono)",display:"flex",gap:10,padding:"6px 10px",background:"rgba(255,255,255,0.02)",borderLeft:`2px solid ${p.type==="error"?"#f87171":p.type==="warning"?"#fbbf24":"#6366f1"}`,borderRadius:4},children:[h.jsx("span",{style:{color:"var(--text-tertiary)",flexShrink:0},children:new Date(p.at).toLocaleTimeString()}),h.jsx("span",{style:{color:p.type==="error"?"#f87171":p.type==="warning"?"#fbbf24":"var(--text-secondary)",flexShrink:0},children:p.phase}),h.jsx("span",{style:{color:"var(--text-primary)",wordBreak:"break-word"},children:p.message})]},p.id))})}),h.jsx(Rl,{title:"Operations",children:i.length===0?h.jsx("p",{style:{fontSize:12,color:"var(--text-tertiary)"},children:"No operations recorded."}):h.jsx("div",{style:{display:"grid",gap:6},children:i.map(p=>h.jsxs("div",{style:{fontSize:12,display:"flex",gap:10,padding:"6px 10px",background:"rgba(255,255,255,0.02)",borderRadius:4},children:[h.jsx("span",{style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono)",flexShrink:0},children:new Date(p.created_at).toLocaleTimeString()}),h.jsx("span",{style:{color:"var(--text-primary)",fontFamily:"var(--font-mono)",flexShrink:0},children:p.kind}),p.target_key&&h.jsx("span",{style:{color:"var(--text-tertiary)"},children:p.target_key}),h.jsx("span",{style:$l(p.state==="success"?"emerald":p.state==="error"?"rose":"amber"),children:p.state}),p.message&&h.jsx("span",{style:{color:"var(--text-secondary)",wordBreak:"break-word"},children:p.message})]},p.id))})})]})}function Rl({title:e,children:t}){return h.jsxs("div",{children:[h.jsx("h3",{style:{fontSize:11,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",marginBottom:10,fontFamily:"var(--font-mono)"},children:e}),h.jsx("div",{style:{display:"grid",gap:8},children:t})]})}function KR({label:e,hint:t,children:r}){return h.jsxs("label",{style:{display:"grid",gap:4},children:[h.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)",fontWeight:500},children:e}),r,t&&h.jsx("span",{style:{fontSize:11,color:"var(--text-tertiary)"},children:t})]})}function Mo({text:e}){return h.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[h.jsx("span",{className:"loading-spinner",style:{width:11,height:11,borderWidth:1.5,borderColor:"rgba(255,255,255,0.25)",borderTopColor:"currentColor"}}),e]})}function $l(e){const t={emerald:{bg:"rgba(52,211,153,0.12)",border:"rgba(52,211,153,0.35)",fg:"#34d399"},amber:{bg:"rgba(251,191,36,0.12)",border:"rgba(251,191,36,0.35)",fg:"#fbbf24"},rose:{bg:"rgba(248,113,113,0.12)",border:"rgba(248,113,113,0.35)",fg:"#f87171"}}[e];return{background:t.bg,border:`1px solid ${t.border}`,color:t.fg,padding:"3px 9px",borderRadius:999,fontSize:11,fontWeight:500,fontFamily:"var(--font-mono)"}}const Xo={background:"var(--gradient-primary, #6366f1)",color:"#fff",padding:"8px 14px",border:"none",borderRadius:6,cursor:"pointer",fontSize:13,fontWeight:600,fontFamily:"var(--font-body)"},Ci={background:"rgba(255,255,255,0.04)",color:"var(--text-primary)",padding:"7px 12px",border:"1px solid var(--border-subtle)",borderRadius:6,cursor:"pointer",fontSize:12,fontFamily:"var(--font-body)"},hu={background:"rgba(248,113,113,0.08)",color:"#f87171",padding:"7px 12px",border:"1px solid rgba(248,113,113,0.35)",borderRadius:6,cursor:"pointer",fontSize:12,fontFamily:"var(--font-body)"},Rv={background:"none",border:"none",color:"var(--text-tertiary)",cursor:"pointer",fontSize:22,padding:0,width:22,height:22,lineHeight:1},xb={background:"rgba(255,255,255,0.02)",border:"1px solid var(--border-subtle)",borderRadius:6,padding:"8px 10px",color:"var(--text-primary)",fontSize:13,fontFamily:"var(--font-body)",outline:"none"},Vs={fontFamily:"var(--font-mono)",background:"rgba(255,255,255,0.04)",padding:"1px 5px",borderRadius:3,fontSize:10.5},qR={queued:"Queued",provision_sandbox:"Carving out a fresh tide pool",pull_image:"Reeling in the lobster",start_entrypoint:"Lighting the burner",wait_core_ready:"Warming up the gateway",materialize_declared_state:"Dressing the claw",install_gbrain:"Wiring up the long-term memory",uninstall_gbrain:"Pulling out the memory module",connect_telegram:"Threading the Telegram leash",disconnect_telegram:"Unhooking Telegram",configure_channel:"Configuring the channel"},c1={queued:["In line behind some other lobsters…","Politely waiting our turn","The maître d' is checking the list"],provision_sandbox:["Booting a microVM just for you","Stretching the sandbox awake","Wiring up the pretend internet","Tuning the network qdisc"],pull_image:["Tracking down a fresh claw image","Negotiating with the registry","Thawing 953 MB of OpenClaw","Decompressing layers, one at a time","The lobster is doing leg day","Pinching some bytes from the cache","Still pulling — bigger than it looks"],wait_core_ready:["OpenClaw is checking its config","Booting the OpenAI-compat gateway","Loading 3 plugins (and not 39)","Waiting on /health to turn green","The lobster cleared its throat"],start_entrypoint:["Launching the gateway process","Sourcing the per-agent env","Telling supervisord to do its thing"],materialize_declared_state:["Reconciling channels and packages","Snapping things into place","Almost there, just dressing it up"],install_gbrain:["Spinning up a Postgres for memories","Teaching the agent how to remember","Plumbing in pgvector"],connect_telegram:["Registering the Telegram webhook","Bot meets API, API meets bot","Confirming the bot can phone home"],default:["The lobster is busy. Please clap softly.","Crustacean cogs turning","Working on it","Just a moment, the claws are tangled"]};function VR(e){return e?qR[e]??e.replace(/_/g," "):"Working on it"}function QR(e){return e&&c1[e]||c1.default}function GR({operation:e}){const[t,r]=L.useState(0);L.useEffect(()=>{const u=setInterval(()=>r(p=>p+1),2600);return()=>clearInterval(u)},[]);const i=QR(e.phase),o=i[t%i.length],a=e.created_at?new Date(e.created_at).getTime():Date.now(),c=Math.max(0,Math.round((Date.now()-a)/1e3));return h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:18,padding:"20px 24px",borderRadius:14,border:"1px solid rgba(255,77,77,0.22)",background:"radial-gradient(ellipse at 0% 50%, rgba(255,77,77,0.10), transparent 55%), rgba(255,77,77,0.025)",marginBottom:14},children:[h.jsx(YR,{}),h.jsxs("div",{style:{flex:1,minWidth:0},children:[h.jsx("div",{style:{fontSize:17,fontWeight:700,fontFamily:"var(--font-display)",color:"var(--text-primary)"},children:VR(e.phase)}),h.jsx("div",{style:{fontSize:13,color:"var(--text-secondary)",marginTop:5,animation:"fadeUp 380ms ease-out"},children:o},t),h.jsxs("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginTop:8,fontFamily:"var(--font-mono)"},children:[e.kind," · ",e.phase," · ",c,"s elapsed"]})]}),h.jsx(XR,{}),h.jsx("style",{children:`- @keyframes fadeUp {- from { opacity: 0; transform: translateY(4px); }- to { opacity: 1; transform: translateY(0); }- }- @keyframes claw-wave-left {- 0%, 100% { transform: rotate(-4deg) translateX(0); }- 50% { transform: rotate(8deg) translateX(-1px); }- }- @keyframes claw-wave-right {- 0%, 100% { transform: rotate(4deg) translateX(0); }- 50% { transform: rotate(-8deg) translateX(1px); }- }- @keyframes lobster-bob {- 0%, 100% { transform: translateY(0); }- 50% { transform: translateY(-3px); }- }- @keyframes eye-blink {- 0%, 92%, 100% { transform: scaleY(1); }- 95% { transform: scaleY(0.1); }- }- @keyframes dot-pulse {- 0%, 80%, 100% { opacity: 0.25; transform: scale(0.7); }- 40% { opacity: 1; transform: scale(1); }- }- `})]})}function YR(){return h.jsxs("svg",{width:"68",height:"68",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",style:{flexShrink:0,filter:"drop-shadow(0 0 18px rgba(255,77,77,0.45))",animation:"lobster-bob 2.4s ease-in-out infinite"},children:[h.jsx("defs",{children:h.jsxs("linearGradient",{id:"boot-lobster-gradient",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[h.jsx("stop",{offset:"0%",stopColor:"#ff4d4d"}),h.jsx("stop",{offset:"100%",stopColor:"#991b1b"})]})}),h.jsx("path",{d:"M60 10 C30 10 15 35 15 55 C15 75 30 95 45 100 L45 110 L55 110 L55 100 C55 100 60 102 65 100 L65 110 L75 110 L75 100 C90 95 105 75 105 55 C105 35 90 10 60 10Z",fill:"url(#boot-lobster-gradient)"}),h.jsx("g",{style:{transformOrigin:"20px 55px",animation:"claw-wave-left 1.4s ease-in-out infinite"},children:h.jsx("path",{d:"M20 45 C5 40 0 50 5 60 C10 70 20 65 25 55 C28 48 25 45 20 45Z",fill:"url(#boot-lobster-gradient)"})}),h.jsx("g",{style:{transformOrigin:"100px 55px",animation:"claw-wave-right 1.4s ease-in-out infinite"},children:h.jsx("path",{d:"M100 45 C115 40 120 50 115 60 C110 70 100 65 95 55 C92 48 95 45 100 45Z",fill:"url(#boot-lobster-gradient)"})}),h.jsx("path",{d:"M45 15 Q35 5 30 8",stroke:"#ff4d4d",strokeWidth:"3",strokeLinecap:"round"}),h.jsx("path",{d:"M75 15 Q85 5 90 8",stroke:"#ff4d4d",strokeWidth:"3",strokeLinecap:"round"}),h.jsxs("g",{style:{transformOrigin:"center 35px",animation:"eye-blink 4.6s ease-in-out infinite"},children:[h.jsx("circle",{cx:"45",cy:"35",r:"6",fill:"#050810"}),h.jsx("circle",{cx:"75",cy:"35",r:"6",fill:"#050810"}),h.jsx("circle",{cx:"46",cy:"34",r:"2.5",fill:"#00e5cc"}),h.jsx("circle",{cx:"76",cy:"34",r:"2.5",fill:"#00e5cc"})]})]})}function XR(){return h.jsx("div",{style:{display:"flex",gap:6,alignItems:"center",flexShrink:0},children:[0,1,2].map(e=>h.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:"rgba(255,77,77,0.85)",animation:`dot-pulse 1.4s ease-in-out ${e*.18}s infinite`}},e))})}function JR(){const e=Gr(),{data:t,isLoading:r}=Nt({queryKey:["api-keys"],queryFn:ab}),[i,o]=L.useState(!1),[a,c]=L.useState(""),[u,p]=L.useState(null),[f,g]=L.useState(!1),_=er({mutationFn:x=>lb(x),onSuccess:x=>{p(x.key),o(!1),c(""),e.invalidateQueries({queryKey:["api-keys"]})}}),y=er({mutationFn:x=>wP(x),onSuccess:()=>{e.invalidateQueries({queryKey:["api-keys"]})}});return h.jsxs("div",{children:[h.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:28},children:[h.jsxs("div",{children:[h.jsx("h1",{className:"page-title",children:"API Keys"}),h.jsx("p",{className:"page-subtitle",children:"Manage authentication tokens for your integrations"})]}),h.jsxs("button",{className:"btn-primary",onClick:()=>o(!0),children:[h.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[h.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),h.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Create Key"]})]}),u&&h.jsxs("div",{className:"animate-in",style:{background:"rgba(99, 102, 241, 0.06)",border:"1px solid var(--border-accent)",borderRadius:"var(--radius-lg)",padding:20,marginBottom:20},children:[h.jsx("div",{style:{fontWeight:600,marginBottom:4,fontSize:14},children:"New API key created"}),h.jsx("div",{style:{fontSize:12,color:"var(--text-tertiary)",marginBottom:10},children:"Copy this key now. You won't be able to see it again."}),h.jsxs("div",{style:{position:"relative"},children:[h.jsx("code",{style:{display:"block",background:"var(--bg-deep)",color:"var(--text-accent)",padding:14,paddingRight:96,borderRadius:"var(--radius-sm)",fontSize:13,fontFamily:"var(--font-mono)",wordBreak:"break-all",border:"1px solid var(--border-subtle)"},children:u}),h.jsx("button",{onClick:async()=>{await navigator.clipboard.writeText(u),g(!0),setTimeout(()=>g(!1),1500)},className:"btn-ghost",style:{position:"absolute",top:8,right:8,fontSize:12,display:"inline-flex",alignItems:"center",gap:6},children:f?h.jsxs(h.Fragment,{children:[h.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:h.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Copied"]}):h.jsxs(h.Fragment,{children:[h.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),h.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),"Copy"]})})]}),h.jsx("button",{onClick:()=>{p(null),g(!1)},style:{marginTop:10,fontSize:12,background:"none",border:"none",color:"var(--accent-indigo)",cursor:"pointer",fontFamily:"var(--font-body)"},children:"Dismiss"})]}),i&&h.jsxs("div",{className:"glass-card animate-in",style:{padding:22,marginBottom:20},children:[h.jsxs("div",{style:{marginBottom:14},children:[h.jsx("label",{style:{display:"block",fontSize:12,fontWeight:600,color:"var(--text-secondary)",marginBottom:6},children:"Key Name"}),h.jsx("input",{type:"text",value:a,onChange:x=>c(x.target.value),placeholder:"e.g. Production Key",className:"input",autoFocus:!0})]}),h.jsxs("div",{style:{display:"flex",gap:8},children:[h.jsx("button",{className:"btn-primary",onClick:()=>_.mutate(a),disabled:_.isPending||!a.trim(),children:_.isPending?"Creating…":"Create"}),h.jsx("button",{className:"btn-ghost",onClick:()=>{o(!1),c("")},children:"Cancel"})]})]}),r?h.jsx("div",{style:{display:"flex",justifyContent:"center",padding:48},children:h.jsx("div",{className:"loading-spinner"})}):h.jsx("div",{className:"glass-card animate-in stagger-1",style:{overflow:"hidden"},children:h.jsxs("table",{className:"data-table",children:[h.jsx("thead",{children:h.jsxs("tr",{children:[h.jsx("th",{children:"Name"}),h.jsx("th",{children:"Prefix"}),h.jsx("th",{children:"Last Used"}),h.jsx("th",{children:"Created"}),h.jsx("th",{style:{width:80}})]})}),h.jsxs("tbody",{children:[(t??[]).map(x=>h.jsxs("tr",{children:[h.jsx("td",{style:{fontWeight:500,color:"var(--text-primary)"},children:x.name}),h.jsx("td",{children:h.jsxs("code",{children:[x.keyPrefix,"…"]})}),h.jsx("td",{style:{fontFamily:"var(--font-mono)",fontSize:12},children:x.lastUsed?new Date(x.lastUsed).toLocaleString():"Never"}),h.jsx("td",{style:{fontFamily:"var(--font-mono)",fontSize:12},children:new Date(x.createdAt).toLocaleString()}),h.jsx("td",{children:h.jsx("button",{className:"btn-danger",onClick:()=>{confirm("Revoke this API key?")&&y.mutate(x.id)},children:"Revoke"})})]},x.id)),(t??[]).length===0&&h.jsx("tr",{children:h.jsx("td",{colSpan:5,style:{textAlign:"center",padding:32,color:"var(--text-tertiary)"},children:"No API keys yet"})})]})]})})]})}function ZR(){const e=Gr(),[t,r]=L.useState(1),i=20,{data:o,isLoading:a}=Nt({queryKey:["checkpoints",t],queryFn:()=>CP(t,i)}),c=er({mutationFn:g=>kP(g),onSuccess:()=>{e.invalidateQueries({queryKey:["checkpoints"]})}}),u=(o==null?void 0:o.checkpoints)??[],p=(o==null?void 0:o.total)??0,f=Math.ceil(p/i);return h.jsxs("div",{children:[h.jsxs("div",{style:{marginBottom:28},children:[h.jsx("h1",{className:"page-title",children:"Checkpoints"}),h.jsx("p",{className:"page-subtitle",children:"Sandbox snapshots across your organization"})]}),a?h.jsx("div",{style:{display:"flex",justifyContent:"center",padding:48},children:h.jsx("div",{className:"loading-spinner"})}):h.jsxs("div",{className:"glass-card animate-in stagger-1",style:{overflow:"hidden"},children:[h.jsxs("table",{className:"data-table",children:[h.jsx("thead",{children:h.jsxs("tr",{children:[h.jsx("th",{children:"Name"}),h.jsx("th",{children:"Sandbox"}),h.jsx("th",{children:"Status"}),h.jsx("th",{style:{textAlign:"right"},children:"Active Forks"}),h.jsx("th",{style:{textAlign:"right"},children:"Total Forks"}),h.jsx("th",{children:"Created"}),h.jsx("th",{style:{width:80}})]})}),h.jsxs("tbody",{children:[u.map(g=>h.jsxs("tr",{children:[h.jsx("td",{style:{fontWeight:500,color:"var(--text-primary)"},children:g.name}),h.jsx("td",{children:h.jsx("code",{style:{fontSize:12},children:g.sandboxId})}),h.jsx("td",{children:h.jsx("span",{style:{fontSize:11,fontWeight:600,padding:"2px 8px",borderRadius:10,background:g.status==="ready"?"rgba(34, 197, 94, 0.08)":g.status==="failed"?"rgba(251, 113, 133, 0.08)":"rgba(234, 179, 8, 0.08)",color:g.status==="ready"?"var(--accent-green)":g.status==="failed"?"var(--accent-rose)":"#eab308",border:`1px solid ${g.status==="ready"?"rgba(34, 197, 94, 0.15)":g.status==="failed"?"rgba(251, 113, 133, 0.15)":"rgba(234, 179, 8, 0.15)"}`,cursor:g.status==="failed"&&g.errorMsg?"help":"default"},title:g.status==="failed"&&g.errorMsg?g.errorMsg:void 0,children:g.status==="ready"?"Ready":g.status==="failed"?"Failed":"Processing"})}),h.jsx("td",{style:{textAlign:"right",fontFamily:"var(--font-mono)",fontSize:12},children:g.activeForks>0?h.jsx("span",{style:{color:"var(--accent-emerald)"},children:g.activeForks}):h.jsx("span",{style:{color:"var(--text-tertiary)"},children:"0"})}),h.jsx("td",{style:{textAlign:"right",fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-secondary)"},children:g.totalForks}),h.jsx("td",{style:{fontFamily:"var(--font-mono)",fontSize:12},children:new Date(g.createdAt).toLocaleString()}),h.jsx("td",{children:h.jsx("button",{className:"btn-danger",onClick:()=>{confirm(`Delete checkpoint "${g.name}"? Active forks will not be affected.`)&&c.mutate(g.id)},children:"Delete"})})]},g.id)),u.length===0&&h.jsx("tr",{children:h.jsx("td",{colSpan:7,style:{textAlign:"center",padding:32,color:"var(--text-tertiary)"},children:"No checkpoints yet"})})]})]}),f>1&&h.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderTop:"1px solid var(--border-subtle)",fontSize:12,color:"var(--text-secondary)"},children:[h.jsxs("span",{children:[p," checkpoint",p!==1?"s":""]}),h.jsxs("div",{style:{display:"flex",gap:6},children:[h.jsx("button",{className:"btn-ghost",disabled:t<=1,onClick:()=>r(g=>g-1),style:{padding:"4px 10px",fontSize:12},children:"Prev"}),h.jsxs("span",{style:{padding:"4px 8px",lineHeight:"24px"},children:[t," / ",f]}),h.jsx("button",{className:"btn-ghost",disabled:t>=f,onClick:()=>r(g=>g+1),style:{padding:"4px 10px",fontSize:12},children:"Next"})]})]})]})]})}function ej({status:e}){const t=e==="ready",r=e==="failed";return h.jsx("span",{style:{fontSize:11,fontWeight:600,padding:"2px 8px",borderRadius:10,background:t?"rgba(34, 197, 94, 0.08)":r?"rgba(251, 113, 133, 0.08)":"rgba(234, 179, 8, 0.08)",color:t?"var(--accent-green)":r?"var(--accent-rose)":"#eab308",border:`1px solid ${t?"rgba(34, 197, 94, 0.15)":r?"rgba(251, 113, 133, 0.15)":"rgba(234, 179, 8, 0.15)"}`},children:t?"Ready":r?"Failed":"Building"})}function tj(e){const t=e.steps;return!t||t.length===0?"base":t.map(r=>{var a,c;const i=r.type,o=r.args;switch(i){case"apt_install":return`apt: ${((a=o==null?void 0:o.packages)==null?void 0:a.join(", "))||"..."}`;case"pip_install":return`pip: ${((c=o==null?void 0:o.packages)==null?void 0:c.join(", "))||"..."}`;case"run":return`run: ${((o==null?void 0:o.commands)||[]).length} cmd(s)`;case"env":return`env: ${Object.keys((o==null?void 0:o.vars)||{}).length} var(s)`;case"workdir":return`workdir: ${(o==null?void 0:o.path)||"..."}`;case"add_file":return`file: ${(o==null?void 0:o.path)||"..."}`;default:return i}}).join(" + ")}function rj(){const e=Gr(),{data:t,isLoading:r}=Nt({queryKey:["images"],queryFn:()=>EP()}),i=er({mutationFn:a=>PP(a),onSuccess:()=>{e.invalidateQueries({queryKey:["images"]})}}),o=(t??[]).length;return h.jsxs("div",{children:[h.jsxs("div",{style:{marginBottom:28},children:[h.jsx("h1",{className:"page-title",children:"Templates"}),h.jsx("p",{className:"page-subtitle",children:"Declarative image snapshots for your organization"})]}),r?h.jsx("div",{style:{display:"flex",justifyContent:"center",padding:48},children:h.jsx("div",{className:"loading-spinner"})}):h.jsx("div",{className:"glass-card animate-in stagger-1",style:{overflow:"hidden"},children:h.jsxs("table",{className:"data-table",children:[h.jsx("thead",{children:h.jsxs("tr",{children:[h.jsx("th",{children:"Name"}),h.jsx("th",{children:"Steps"}),h.jsx("th",{children:"Status"}),h.jsx("th",{children:"Checkpoint"}),h.jsx("th",{children:"Last Used"}),h.jsx("th",{children:"Created"}),h.jsx("th",{style:{width:80}})]})}),h.jsxs("tbody",{children:[(t??[]).map(a=>h.jsxs("tr",{children:[h.jsx("td",{style:{fontWeight:500,color:"var(--text-primary)"},children:a.name||h.jsx("span",{style:{color:"var(--text-tertiary)",fontStyle:"italic"},children:"auto-cached"})}),h.jsx("td",{style:{fontSize:12,color:"var(--text-secondary)",maxWidth:300,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:tj(a.manifest)}),h.jsx("td",{children:h.jsx(ej,{status:a.status})}),h.jsx("td",{children:a.checkpointId?h.jsx("code",{style:{fontSize:11},children:a.checkpointId.slice(0,8)}):h.jsx("span",{style:{color:"var(--text-tertiary)"},children:"-"})}),h.jsx("td",{style:{fontFamily:"var(--font-mono)",fontSize:12},children:new Date(a.lastUsedAt).toLocaleString()}),h.jsx("td",{style:{fontFamily:"var(--font-mono)",fontSize:12},children:new Date(a.createdAt).toLocaleString()}),h.jsx("td",{children:h.jsx("button",{className:"btn-danger",onClick:()=>{const c=a.name?`"${a.name}"`:"this cached image";confirm(`Delete ${c}? Existing sandboxes will not be affected.`)&&i.mutate(a.id)},children:"Delete"})})]},a.id)),o===0&&h.jsx("tr",{children:h.jsx("td",{colSpan:7,style:{textAlign:"center",padding:32,color:"var(--text-tertiary)"},children:"No templates yet. Create them using the SDK with Image.base().aptInstall([...]) or snapshots.create()."})})]})]})})]})}function h1({status:e}){let t="var(--text-tertiary)",r="rgba(255,255,255,0.04)";return e==="active"?(t="var(--accent-emerald)",r="rgba(52,211,153,0.1)"):e==="pending"||e==="pending_validation"||e==="initializing"?(t="var(--accent-amber, #f59e0b)",r="rgba(245,158,11,0.1)"):e==="none"&&(t="var(--text-tertiary)",r="rgba(255,255,255,0.04)"),h.jsx("span",{style:{display:"inline-block",padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,color:t,background:r,textTransform:"uppercase",letterSpacing:"0.5px"},children:e})}function ij(){var E,I;const e=Gr(),{data:t,isLoading:r}=Nt({queryKey:["org"],queryFn:MP}),[i,o]=L.useState(""),[a,c]=L.useState(!1),[u,p]=L.useState("");L.useEffect(()=>{t&&o(t.name)},[t]);const f=er({mutationFn:k=>DP(k),onSuccess:()=>{e.invalidateQueries({queryKey:["org"]}),c(!0),setTimeout(()=>c(!1),2e3)}}),g=er({mutationFn:k=>BP(k),onSuccess:()=>{e.invalidateQueries({queryKey:["org"]}),p("")}}),_=er({mutationFn:()=>IP(),onSuccess:()=>{e.invalidateQueries({queryKey:["org"]})}}),y=er({mutationFn:()=>OP(),onSuccess:()=>{e.invalidateQueries({queryKey:["org"]})}});if(r)return h.jsx("div",{style:{display:"flex",justifyContent:"center",padding:64},children:h.jsx("div",{className:"loading-spinner"})});const x=i===(t==null?void 0:t.name),S=(t==null?void 0:t.customDomain)&&t.customDomain!=="",w={display:"block",fontSize:12,fontWeight:600,color:"var(--text-secondary)",marginBottom:6},C={padding:"10px 14px",background:"rgba(255,255,255,0.02)",border:"1px solid var(--border-subtle)",borderRadius:"var(--radius-sm)",fontSize:13,fontFamily:"var(--font-mono)",color:"var(--text-tertiary)"};return h.jsxs("div",{children:[h.jsxs("div",{style:{marginBottom:28},children:[h.jsx("h1",{className:"page-title",children:"Settings"}),h.jsx("p",{className:"page-subtitle",children:"Organization configuration"})]}),h.jsxs("div",{className:"glass-card animate-in stagger-1",style:{padding:28,maxWidth:520},children:[h.jsxs("div",{style:{marginBottom:22},children:[h.jsx("label",{style:w,children:"Organization Name"}),h.jsx("input",{type:"text",value:i,onChange:k=>o(k.target.value),className:"input"})]}),h.jsxs("div",{style:{marginBottom:22},children:[h.jsx("label",{style:w,children:"Plan"}),h.jsx("div",{style:{padding:"10px 14px",background:"rgba(255,255,255,0.02)",border:"1px solid var(--border-subtle)",borderRadius:"var(--radius-sm)",fontSize:14,color:"var(--text-tertiary)",textTransform:"capitalize"},children:(t==null?void 0:t.plan)??"free"})]}),h.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16,marginBottom:24},children:[h.jsxs("div",{children:[h.jsx("label",{style:w,children:"Max Concurrent Sandboxes"}),h.jsx("div",{style:C,children:t==null?void 0:t.maxConcurrentSandboxes})]}),h.jsxs("div",{children:[h.jsx("label",{style:w,children:"Max Timeout (sec)"}),h.jsx("div",{style:C,children:t==null?void 0:t.maxSandboxTimeoutSec})]})]}),h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14},children:[h.jsx("button",{className:"btn-primary",onClick:()=>f.mutate(i),disabled:f.isPending||x,children:f.isPending?"Saving…":"Save Changes"}),a&&h.jsx("span",{style:{fontSize:12,fontWeight:500,color:"var(--accent-emerald)",animation:"fadeInUp 0.3s ease"},children:"Saved"})]})]}),h.jsxs("div",{className:"glass-card animate-in stagger-2",style:{padding:28,maxWidth:520,marginTop:20},children:[h.jsxs("div",{style:{marginBottom:18},children:[h.jsx("h2",{style:{fontSize:16,fontWeight:600,color:"var(--text-primary)",margin:0},children:"Custom Domain"}),h.jsx("p",{style:{fontSize:13,color:"var(--text-tertiary)",margin:"4px 0 0"},children:"Configure a custom domain for sandbox preview URLs (e.g. sandboxes become accessible at <id>.yourdomain.com)"})]}),S?h.jsxs(h.Fragment,{children:[h.jsxs("div",{style:{marginBottom:16},children:[h.jsx("label",{style:w,children:"Domain"}),h.jsxs("div",{style:C,children:["*.",t.customDomain]})]}),h.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16,marginBottom:16},children:[h.jsxs("div",{children:[h.jsx("label",{style:w,children:"Verification"}),h.jsx(h1,{status:t.domainVerificationStatus})]}),h.jsxs("div",{children:[h.jsx("label",{style:w,children:"SSL"}),h.jsx(h1,{status:t.domainSslStatus})]})]}),(t.verificationTxtName||t.sslTxtName)&&h.jsxs("div",{style:{marginBottom:16},children:[h.jsx("label",{style:w,children:"Required DNS TXT Records"}),h.jsxs("div",{style:{background:"rgba(255,255,255,0.02)",border:"1px solid var(--border-subtle)",borderRadius:"var(--radius-sm)",padding:14,fontSize:12,fontFamily:"var(--font-mono)",lineHeight:1.6,color:"var(--text-tertiary)",wordBreak:"break-all"},children:[t.verificationTxtName&&h.jsxs("div",{style:{marginBottom:t.sslTxtName?12:0},children:[h.jsx("div",{style:{color:"var(--text-secondary)",fontWeight:600,marginBottom:2},children:"Domain Verification:"}),h.jsxs("div",{children:["Name: ",t.verificationTxtName]}),h.jsxs("div",{children:["Value: ",t.verificationTxtValue]})]}),t.sslTxtName&&h.jsxs("div",{children:[h.jsx("div",{style:{color:"var(--text-secondary)",fontWeight:600,marginBottom:2},children:"SSL Validation:"}),h.jsxs("div",{children:["Name: ",t.sslTxtName]}),h.jsxs("div",{children:["Value: ",t.sslTxtValue]})]})]})]}),t.domainVerificationStatus==="active"&&h.jsxs("div",{style:{marginBottom:16},children:[h.jsx("label",{style:w,children:"Preview URL Setup"}),h.jsxs("div",{style:{background:"rgba(255,255,255,0.02)",border:"1px solid var(--border-subtle)",borderRadius:"var(--radius-sm)",padding:14,fontSize:12,fontFamily:"var(--font-mono)",lineHeight:1.6,color:"var(--text-tertiary)",wordBreak:"break-all"},children:[h.jsx("div",{style:{color:"var(--text-secondary)",fontWeight:600,marginBottom:6},children:"Add a wildcard CNAME record for preview URLs:"}),h.jsxs("div",{children:["Type: ",h.jsx("span",{style:{color:"var(--text-primary)"},children:"CNAME"})]}),h.jsxs("div",{children:["Name: ",h.jsxs("span",{style:{color:"var(--text-primary)"},children:["*.",t.customDomain]})]}),h.jsxs("div",{children:["Target: ",h.jsx("span",{style:{color:"var(--text-primary)"},children:"fallback-origin.opencomputer.dev"})]}),h.jsxs("div",{style:{marginTop:8,fontSize:11,color:"var(--text-tertiary)"},children:["This enables per-sandbox preview URLs (e.g. sb-abc123.",t.customDomain,") via the SDK's createPreviewURL() method."]})]})]}),h.jsxs("div",{style:{display:"flex",gap:10},children:[h.jsx("button",{className:"btn-primary",onClick:()=>y.mutate(),disabled:y.isPending,children:y.isPending?"Refreshing…":"Refresh Status"}),h.jsx("button",{className:"btn-secondary",onClick:()=>{confirm("Remove custom domain? Sandbox URLs will revert to the default domain.")&&_.mutate()},disabled:_.isPending,style:{color:"var(--accent-red, #ef4444)"},children:_.isPending?"Removing…":"Remove Domain"})]}),(g.isError||_.isError||y.isError)&&h.jsx("div",{style:{marginTop:10,fontSize:12,color:"var(--accent-red, #ef4444)"},children:(E=g.error||_.error||y.error)==null?void 0:E.message})]}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{style:{marginBottom:14},children:[h.jsx("label",{style:w,children:"Domain"}),h.jsx("input",{type:"text",value:u,onChange:k=>p(k.target.value),placeholder:"acme.dev",className:"input"})]}),h.jsx("button",{className:"btn-primary",onClick:()=>g.mutate(u),disabled:g.isPending||!u.trim(),children:g.isPending?"Setting up…":"Set Domain"}),g.isError&&h.jsx("div",{style:{marginTop:10,fontSize:12,color:"var(--accent-red, #ef4444)"},children:(I=g.error)==null?void 0:I.message})]})]}),h.jsx(sj,{}),h.jsx(nj,{})]})}function sj(){var f;const e=Gr(),{data:t,isLoading:r}=Nt({queryKey:["org-members"],queryFn:FP}),[i,o]=L.useState(""),[a,c]=L.useState(!1),u=er({mutationFn:g=>AP(g),onSuccess:()=>{e.invalidateQueries({queryKey:["org-members"]}),e.invalidateQueries({queryKey:["org-invitations"]}),o(""),c(!1)}}),p=er({mutationFn:g=>$P(g),onSuccess:()=>{e.invalidateQueries({queryKey:["org-members"]})}});return h.jsxs("div",{className:"glass-card animate-in stagger-3",style:{padding:28,maxWidth:520,marginTop:20},children:[h.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:18},children:[h.jsxs("div",{children:[h.jsx("h2",{style:{fontSize:16,fontWeight:600,color:"var(--text-primary)",margin:0},children:"Team Members"}),h.jsx("p",{style:{fontSize:13,color:"var(--text-tertiary)",margin:"4px 0 0"},children:"People with access to this organization"})]}),h.jsx("button",{className:"btn-primary",onClick:()=>c(!a),style:{fontSize:12,padding:"6px 14px"},children:"Invite"})]}),a&&h.jsxs("div",{style:{marginBottom:16,display:"flex",gap:8},children:[h.jsx("input",{type:"email",value:i,onChange:g=>o(g.target.value),placeholder:"[email protected]",className:"input",style:{flex:1}}),h.jsx("button",{className:"btn-primary",onClick:()=>u.mutate(i),disabled:u.isPending||!i.trim(),style:{fontSize:12,padding:"6px 14px",whiteSpace:"nowrap"},children:u.isPending?"Sending...":"Send"})]}),u.isError&&h.jsx("div",{style:{marginBottom:10,fontSize:12,color:"var(--accent-red, #ef4444)"},children:(f=u.error)==null?void 0:f.message}),r?h.jsx("div",{style:{padding:20,textAlign:"center"},children:h.jsx("div",{className:"loading-spinner"})}):h.jsxs("div",{children:[(t??[]).map((g,_)=>h.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 0",borderBottom:_<((t==null?void 0:t.length)??0)-1?"1px solid var(--border-subtle)":"none"},children:[h.jsxs("div",{children:[h.jsx("div",{style:{fontSize:13,color:"var(--text-primary)",fontWeight:500},children:g.name||g.email}),h.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)"},children:g.email})]}),h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[h.jsx("span",{style:{fontSize:11,fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.5px"},children:g.role}),g.membershipId&&h.jsx("button",{onClick:()=>{confirm(`Remove ${g.email} from this organization?`)&&p.mutate(g.membershipId)},disabled:p.isPending,style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",fontSize:11,padding:"2px 6px"},onMouseOver:y=>y.currentTarget.style.color="var(--accent-red, #ef4444)",onMouseOut:y=>y.currentTarget.style.color="var(--text-tertiary)",children:"Remove"})]})]},g.membershipId||g.id||_)),(!t||t.length===0)&&h.jsx("div",{style:{fontSize:13,color:"var(--text-tertiary)",padding:"10px 0"},children:"No members yet."})]})]})}function nj(){const e=Gr(),{data:t,isLoading:r}=Nt({queryKey:["org-invitations"],queryFn:NP}),i=er({mutationFn:a=>zP(a),onSuccess:()=>{e.invalidateQueries({queryKey:["org-invitations"]})}}),o=(t??[]).filter(a=>a.state==="pending");return!r&&o.length===0?null:h.jsxs("div",{className:"glass-card animate-in stagger-4",style:{padding:28,maxWidth:520,marginTop:20},children:[h.jsxs("div",{style:{marginBottom:18},children:[h.jsx("h2",{style:{fontSize:16,fontWeight:600,color:"var(--text-primary)",margin:0},children:"Pending Invitations"}),h.jsx("p",{style:{fontSize:13,color:"var(--text-tertiary)",margin:"4px 0 0"},children:"Invitations waiting to be accepted"})]}),r?h.jsx("div",{style:{padding:20,textAlign:"center"},children:h.jsx("div",{className:"loading-spinner"})}):h.jsx("div",{children:o.map((a,c)=>h.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 0",borderBottom:c<o.length-1?"1px solid var(--border-subtle)":"none"},children:[h.jsxs("div",{children:[h.jsx("div",{style:{fontSize:13,color:"var(--text-primary)",fontWeight:500},children:a.email}),h.jsxs("div",{style:{fontSize:11,color:"var(--text-tertiary)"},children:[a.state," · expires ",new Date(a.expiresAt).toLocaleDateString()]})]}),h.jsx("button",{onClick:()=>{confirm(`Revoke invitation for ${a.email}?`)&&i.mutate(a.id)},disabled:i.isPending,style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",fontSize:11,padding:"2px 6px"},onMouseOver:u=>u.currentTarget.style.color="var(--accent-red, #ef4444)",onMouseOut:u=>u.currentTarget.style.color="var(--text-tertiary)",children:"Revoke"})]},a.id))})]})}function oj(){const[e,t]=L.useState("sandboxes");return h.jsxs("div",{children:[h.jsxs("div",{style:{marginBottom:24},children:[h.jsx("h1",{className:"page-title",children:"Billing"}),h.jsx("p",{className:"page-subtitle",children:"Manage your plan, per-agent subscriptions, and invoices"})]}),h.jsx("div",{style:{display:"flex",borderBottom:"1px solid var(--border-subtle)",marginBottom:18,gap:4},children:["sandboxes","agents","invoices"].map(r=>h.jsx("button",{onClick:()=>t(r),style:{background:"none",border:"none",borderBottom:e===r?"2px solid var(--accent-indigo)":"2px solid transparent",padding:"10px 14px",color:e===r?"var(--text-primary)":"var(--text-secondary)",fontSize:13,fontFamily:"var(--font-body)",fontWeight:e===r?600:400,cursor:"pointer",textTransform:"capitalize"},children:r},r))}),e==="sandboxes"&&h.jsx(aj,{}),e==="agents"&&h.jsx(lj,{}),e==="invoices"&&h.jsx(cj,{})]})}function aj(){const e=Gr(),{data:t,isLoading:r}=Nt({queryKey:["billing"],queryFn:hb,refetchInterval:3e4}),[i,o]=L.useState(""),[a,c]=L.useState(""),u=er({mutationFn:HP,onSuccess:_=>{window.location.href=_.url}}),p=er({mutationFn:UP,onSuccess:_=>{window.location.href=_.url}}),f=er({mutationFn:()=>qP(i),onSuccess:_=>{e.invalidateQueries({queryKey:["billing"]}),o(""),c(`$${(_.creditAppliedCents/100).toFixed(2)} credit applied!`),setTimeout(()=>c(""),4e3)}}),g=(t==null?void 0:t.plan)==="pro";return r?h.jsx("div",{style:{display:"flex",justifyContent:"center",padding:80},children:h.jsx("div",{className:"loading-spinner"})}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"glass-card animate-in stagger-1",style:{padding:28,marginBottom:14},children:[h.jsx("span",{className:"section-title",style:{marginBottom:16,display:"block"},children:"Current Plan"}),h.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:12,marginBottom:8},children:[h.jsx("span",{className:"metric-value",style:{fontSize:36,fontWeight:700,color:g?"var(--accent-indigo)":"var(--text-primary)"},children:g?"Pro":"Free"}),h.jsx("span",{style:{fontSize:12,color:"var(--text-tertiary)"},children:g?`${(t==null?void 0:t.maxConcurrentSandboxes)??5} concurrent sandboxes, all tiers`:`${(t==null?void 0:t.maxConcurrentSandboxes)??5} concurrent sandboxes, up to 4GB / 1 vCPU`})]}),g&&(t==null?void 0:t.stripeCreditCents)!=null&&t.stripeCreditCents>0&&h.jsxs("div",{style:{fontSize:13,color:"var(--accent-emerald)",marginBottom:12},children:["$",(t.stripeCreditCents/100).toFixed(2)," promotional credit remaining"]}),!g&&t!=null&&h.jsxs("div",{style:{marginTop:12},children:[t.freeCreditsRemainingCents>0?h.jsxs("div",{style:{fontSize:14,fontWeight:600,fontFamily:"var(--font-mono)",color:"var(--accent-emerald)",marginBottom:12},children:["$",(t.freeCreditsRemainingCents/100).toFixed(2)," free trial credit remaining"]}):h.jsxs("div",{style:{fontSize:13,color:"var(--accent-rose)",marginBottom:12,display:"flex",alignItems:"center",gap:6},children:[h.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[h.jsx("circle",{cx:"12",cy:"12",r:"10"}),h.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),h.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),"Free trial credits exhausted — upgrade to continue using sandboxes"]}),h.jsx("div",{style:{fontSize:13,color:"var(--text-secondary)",marginBottom:10},children:"Upgrade to Pro for an additional $30 free credit and larger machine sizes"}),h.jsx("button",{onClick:()=>u.mutate(),disabled:u.isPending,style:{padding:"10px 24px",fontSize:14,fontWeight:600,fontFamily:"var(--font-body)",cursor:"pointer",border:"none",borderRadius:"var(--radius-sm)",background:"var(--accent-indigo)",color:"#fff",opacity:u.isPending?.6:1},children:u.isPending?"Redirecting...":"Upgrade to Pro"}),u.isError&&h.jsx("p",{style:{fontSize:12,color:"var(--accent-rose)",marginTop:8},children:u.error.message})]}),g&&h.jsxs("div",{style:{fontSize:11,color:"var(--accent-emerald)",marginTop:4,display:"flex",alignItems:"center",gap:6},children:[h.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:h.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Payment method on file — billed monthly via Stripe"]}),h.jsxs("div",{style:{fontSize:12,color:"var(--text-tertiary)",marginTop:12},children:["Need more concurrency?"," ",h.jsx("a",{href:"https://cal.com/team/digger/opencomputer-founder-chat",target:"_blank",rel:"noreferrer",style:{color:"var(--accent-indigo)",textDecoration:"none"},children:"Talk to us"})]})]}),g&&h.jsxs("div",{className:"glass-card animate-in stagger-2",style:{padding:"22px 24px",marginBottom:14},children:[h.jsx("span",{className:"section-title",style:{marginBottom:10,display:"block"},children:"Usage & Payment Method"}),h.jsx("p",{style:{fontSize:13,color:"var(--text-secondary)",marginBottom:14,lineHeight:1.5},children:"View your current-cycle usage, manage your payment method, and download invoices on Stripe."}),h.jsx("button",{onClick:()=>p.mutate(),disabled:p.isPending,style:{padding:"10px 20px",fontSize:13,fontWeight:600,fontFamily:"var(--font-body)",cursor:"pointer",border:"1px solid var(--border-subtle)",borderRadius:"var(--radius-sm)",background:"rgba(255,255,255,0.02)",color:"var(--text-primary)",opacity:p.isPending?.6:1},children:p.isPending?"Opening Stripe…":"Open Stripe billing portal ↗"}),p.isError&&h.jsx("p",{style:{fontSize:12,color:"var(--accent-rose)",marginTop:10},children:p.error.message})]}),g&&h.jsxs("div",{className:"glass-card animate-in stagger-3",style:{padding:"22px 24px",marginBottom:14},children:[h.jsx("span",{className:"section-title",style:{marginBottom:12,display:"block"},children:"Promotion Code"}),h.jsxs("div",{style:{display:"flex",alignItems:"end",gap:14},children:[h.jsxs("div",{children:[h.jsx("label",{style:{fontSize:11,color:"var(--text-tertiary)",display:"block",marginBottom:6},children:"Enter a promotion code to apply credit"}),h.jsx("input",{className:"input",type:"text",placeholder:"e.g. WELCOME100",value:i,onChange:_=>o(_.target.value.toUpperCase()),style:{width:240,fontFamily:"var(--font-mono)",fontSize:13}})]}),h.jsx("button",{onClick:()=>f.mutate(),disabled:f.isPending||!i.trim(),style:{padding:"8px 20px",fontSize:13,fontWeight:600,fontFamily:"var(--font-body)",cursor:"pointer",border:"none",borderRadius:"var(--radius-sm)",background:"var(--accent-indigo)",color:"#fff",opacity:f.isPending||!i.trim()?.5:1},children:f.isPending?"Applying...":"Redeem"})]}),a&&h.jsx("p",{style:{fontSize:13,color:"var(--accent-emerald)",marginTop:10},children:a}),f.isError&&h.jsx("p",{style:{fontSize:12,color:"var(--accent-rose)",marginTop:10},children:f.error.message})]})]})}function lj(){const e=Gr(),{data:t,isLoading:r}=Nt({queryKey:["org-agent-subscriptions"],queryFn:rR,refetchInterval:3e4}),{data:i}=Nt({queryKey:["agents"],queryFn:ub}),o=er({mutationFn:({agentId:g,feature:_})=>gb(g,_),onSuccess:()=>{e.invalidateQueries({queryKey:["org-agent-subscriptions"]})}}),a=L.useMemo(()=>{const g={};for(const _ of(i==null?void 0:i.agents)??[])g[_.id]=_;return g},[i]),c=L.useMemo(()=>{const g=new Set,_=[...(t==null?void 0:t.subscriptions)??[]].sort((x,S)=>S.created_at.localeCompare(x.created_at)),y=[];for(const x of _){const S=`${x.agent_id}::${x.feature}`;g.has(S)||(g.add(S),y.push(x))}return y},[t]),u=c.filter(g=>g.active),p=c.filter(g=>!g.active),f=u.reduce((g,_)=>g+_.price_monthly_cents,0);return r?h.jsx("div",{style:{display:"flex",justifyContent:"center",padding:80},children:h.jsx("div",{className:"loading-spinner"})}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"glass-card animate-in stagger-1",style:{padding:28,marginBottom:14},children:[h.jsx("span",{className:"section-title",style:{marginBottom:12,display:"block"},children:"Per-agent features"}),h.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:12,marginBottom:6},children:[h.jsxs("span",{className:"metric-value",style:{fontSize:32,fontWeight:700},children:["$",(f/100).toFixed(2)]}),h.jsxs("span",{style:{fontSize:12,color:"var(--text-tertiary)"},children:["/mo across ",u.length," active subscription",u.length===1?"":"s"]})]}),h.jsx("p",{style:{fontSize:13,color:"var(--text-secondary)",lineHeight:1.5,marginTop:6},children:"Each connected channel (e.g. Telegram) is billed per-agent. Subscribe or cancel from each agent's page."})]}),h.jsxs("div",{className:"glass-card animate-in stagger-2",style:{padding:"22px 24px",marginBottom:14},children:[h.jsx("span",{className:"section-title",style:{marginBottom:14,display:"block"},children:"Active"}),u.length===0?h.jsx("div",{style:{textAlign:"center",padding:"32px 20px",color:"var(--text-tertiary)",fontSize:13},children:"No active per-agent subscriptions yet."}):h.jsxs("table",{className:"data-table",children:[h.jsx("thead",{children:h.jsxs("tr",{children:[h.jsx("th",{children:"Agent"}),h.jsx("th",{children:"Feature"}),h.jsx("th",{children:"Status"}),h.jsx("th",{children:"Renews"}),h.jsx("th",{style:{textAlign:"right"},children:"Price"}),h.jsx("th",{})]})}),h.jsx("tbody",{children:u.map(g=>{const _=a[g.agent_id],y=(_==null?void 0:_.display_name)||g.agent_id,x=g.cancel_at_period_end?`Ends ${ep(g.current_period_end)}`:g.current_period_end?ep(g.current_period_end):"—";return h.jsxs("tr",{children:[h.jsxs("td",{children:[h.jsx(Wh,{to:`/agents/${encodeURIComponent(g.agent_id)}`,style:{color:"var(--accent-indigo)",textDecoration:"none",fontWeight:600},children:y}),_&&h.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:g.agent_id})]}),h.jsx("td",{style:{textTransform:"capitalize",fontSize:13},children:g.feature}),h.jsx("td",{children:h.jsx(u1,{status:g.status,cancelAtPeriodEnd:g.cancel_at_period_end})}),h.jsx("td",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-secondary)"},children:x}),h.jsxs("td",{style:{fontFamily:"var(--font-mono)",fontSize:13,fontWeight:600,textAlign:"right"},children:["$",(g.price_monthly_cents/100).toFixed(2),"/mo"]}),h.jsx("td",{style:{textAlign:"right"},children:!g.cancel_at_period_end&&h.jsx("button",{onClick:()=>{confirm(`Cancel ${g.feature} for ${y} at end of billing period?`)&&o.mutate({agentId:g.agent_id,feature:g.feature})},disabled:o.isPending,style:{background:"none",border:"1px solid var(--border-subtle)",color:"var(--text-secondary)",fontSize:12,padding:"4px 10px",borderRadius:"var(--radius-sm)",cursor:"pointer",fontFamily:"var(--font-body)"},children:"Cancel"})})]},g.stripe_subscription_id)})})]})]}),p.length>0&&h.jsxs("div",{className:"glass-card animate-in stagger-3",style:{padding:"22px 24px"},children:[h.jsx("span",{className:"section-title",style:{marginBottom:14,display:"block"},children:"Past"}),h.jsxs("table",{className:"data-table",children:[h.jsx("thead",{children:h.jsxs("tr",{children:[h.jsx("th",{children:"Agent"}),h.jsx("th",{children:"Feature"}),h.jsx("th",{children:"Status"}),h.jsx("th",{children:"Ended"})]})}),h.jsx("tbody",{children:p.map(g=>{const _=a[g.agent_id],y=(_==null?void 0:_.display_name)||g.agent_id;return h.jsxs("tr",{children:[h.jsx("td",{children:h.jsx(Wh,{to:`/agents/${encodeURIComponent(g.agent_id)}`,style:{color:"var(--text-secondary)",textDecoration:"none"},children:y})}),h.jsx("td",{style:{textTransform:"capitalize",fontSize:13},children:g.feature}),h.jsx("td",{children:h.jsx(u1,{status:g.status,cancelAtPeriodEnd:!1})}),h.jsx("td",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-tertiary)"},children:ep(g.canceled_at||g.current_period_end)})]},g.stripe_subscription_id)})})]})]})]})}function cj(){var o;const{data:e}=Nt({queryKey:["billing"],queryFn:hb}),{data:t,isLoading:r}=Nt({queryKey:["invoices"],queryFn:()=>KP()}),i=(e==null?void 0:e.plan)==="pro";return r?h.jsx("div",{style:{display:"flex",justifyContent:"center",padding:80},children:h.jsx("div",{className:"loading-spinner"})}):i?h.jsxs("div",{className:"glass-card animate-in stagger-1",style:{padding:"22px 24px"},children:[h.jsx("span",{className:"section-title",style:{marginBottom:14,display:"block"},children:"Invoices"}),(o=t==null?void 0:t.invoices)!=null&&o.length?h.jsxs("table",{className:"data-table",children:[h.jsx("thead",{children:h.jsxs("tr",{children:[h.jsx("th",{children:"Date"}),h.jsx("th",{children:"Number"}),h.jsx("th",{children:"Status"}),h.jsx("th",{children:"Amount"}),h.jsx("th",{})]})}),h.jsx("tbody",{children:t.invoices.map(a=>h.jsxs("tr",{children:[h.jsx("td",{style:{fontFamily:"var(--font-mono)",fontSize:12},children:new Date(a.created*1e3).toLocaleDateString()}),h.jsx("td",{style:{fontSize:12},children:a.number}),h.jsx("td",{children:h.jsx(hj,{status:a.status})}),h.jsxs("td",{style:{fontFamily:"var(--font-mono)",fontSize:13,fontWeight:600},children:["$",(a.amountDue/100).toFixed(2)]}),h.jsx("td",{children:a.hostedUrl&&h.jsx("a",{href:a.hostedUrl,target:"_blank",rel:"noreferrer",style:{fontSize:12,color:"var(--accent-indigo)",textDecoration:"none"},children:"View"})})]},a.id))})]}):h.jsx("div",{style:{textAlign:"center",padding:"40px 20px",color:"var(--text-tertiary)",fontSize:13},children:"No invoices yet — your first invoice will appear at the end of the billing period"})]}):h.jsx("div",{className:"glass-card",style:{padding:28,textAlign:"center"},children:h.jsx("p",{style:{fontSize:14,color:"var(--text-secondary)"},children:"Invoices appear here once you're on the Pro plan or have a per-agent subscription."})})}function ep(e){if(!e)return"—";const t=new Date(e);return isNaN(t.getTime())?"—":t.toLocaleDateString()}function u1({status:e,cancelAtPeriodEnd:t}){let r="var(--text-tertiary)",i="rgba(255,255,255,0.04)",o=e;return t?(r="var(--accent-amber, #f59e0b)",i="rgba(245,158,11,0.1)",o="cancels"):e==="active"||e==="trialing"?(r="var(--accent-emerald)",i="rgba(52,211,153,0.1)"):e==="past_due"||e==="incomplete"?(r="var(--accent-amber, #f59e0b)",i="rgba(245,158,11,0.1)"):(e==="canceled"||e==="unpaid"||e==="incomplete_expired")&&(r="var(--accent-rose)",i="rgba(244,63,94,0.1)"),h.jsx("span",{style:{display:"inline-block",padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,color:r,background:i,textTransform:"uppercase",letterSpacing:"0.5px"},children:o})}function hj({status:e}){let t="var(--text-tertiary)",r="rgba(255,255,255,0.04)";return e==="paid"?(t="var(--accent-emerald)",r="rgba(52,211,153,0.1)"):e==="open"?(t="var(--accent-cyan)",r="rgba(34,211,238,0.1)"):e==="uncollectible"&&(t="var(--accent-rose)",r="rgba(244,63,94,0.1)"),h.jsx("span",{style:{display:"inline-block",padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,color:t,background:r,textTransform:"uppercase",letterSpacing:"0.5px"},children:e})}/**- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.- * @license MIT- *- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)- * @license MIT- *- * Originally forked from (with the author's permission):- * Fabrice Bellard's javascript vt100 for jslinux:- * http://bellard.org/jslinux/- * Copyright (c) 2011 Fabrice Bellard- */var Sb=Object.defineProperty,uj=Object.getOwnPropertyDescriptor,dj=(e,t)=>{for(var r in t)Sb(e,r,{get:t[r],enumerable:!0})},gt=(e,t,r,i)=>{for(var o=i>1?void 0:i?uj(t,r):t,a=e.length-1,c;a>=0;a--)(c=e[a])&&(o=(i?c(t,r,o):c(o))||o);return i&&o&&Sb(t,r,o),o},fe=(e,t)=>(r,i)=>t(r,i,e),d1="Terminal input",xg={get:()=>d1,set:e=>d1=e},f1="Too much output to announce, navigate to rows manually to read",Sg={get:()=>f1,set:e=>f1=e};function fj(e){return e.replace(/\r?\n/g,"\r")}function pj(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function gj(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function vj(e,t,r,i){if(e.stopPropagation(),e.clipboardData){let o=e.clipboardData.getData("text/plain");bb(o,t,r,i)}}function bb(e,t,r,i){e=fj(e),e=pj(e,r.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),t.value=""}function wb(e,t,r){let i=r.getBoundingClientRect(),o=e.clientX-i.left-10,a=e.clientY-i.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${o}px`,t.style.top=`${a}px`,t.style.zIndex="1000",t.focus()}function p1(e,t,r,i,o){wb(e,t,r),o&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}function Bs(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function ku(e,t=0,r=e.length){let i="";for(let o=t;o<r;++o){let a=e[o];a>65535?(a-=65536,i+=String.fromCharCode((a>>10)+55296)+String.fromCharCode(a%1024+56320)):i+=String.fromCharCode(a)}return i}var _j=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let r=e.length;if(!r)return 0;let i=0,o=0;if(this._interim){let a=e.charCodeAt(o++);56320<=a&&a<=57343?t[i++]=(this._interim-55296)*1024+a-56320+65536:(t[i++]=this._interim,t[i++]=a),this._interim=0}for(let a=o;a<r;++a){let c=e.charCodeAt(a);if(55296<=c&&c<=56319){if(++a>=r)return this._interim=c,i;let u=e.charCodeAt(a);56320<=u&&u<=57343?t[i++]=(c-55296)*1024+u-56320+65536:(t[i++]=c,t[i++]=u);continue}c!==65279&&(t[i++]=c)}return i}},mj=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let r=e.length;if(!r)return 0;let i=0,o,a,c,u,p=0,f=0;if(this.interim[0]){let y=!1,x=this.interim[0];x&=(x&224)===192?31:(x&240)===224?15:7;let S=0,w;for(;(w=this.interim[++S]&63)&&S<4;)x<<=6,x|=w;let C=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,E=C-S;for(;f<E;){if(f>=r)return 0;if(w=e[f++],(w&192)!==128){f--,y=!0;break}else this.interim[S++]=w,x<<=6,x|=w&63}y||(C===2?x<128?f--:t[i++]=x:C===3?x<2048||x>=55296&&x<=57343||x===65279||(t[i++]=x):x<65536||x>1114111||(t[i++]=x)),this.interim.fill(0)}let g=r-4,_=f;for(;_<r;){for(;_<g&&!((o=e[_])&128)&&!((a=e[_+1])&128)&&!((c=e[_+2])&128)&&!((u=e[_+3])&128);)t[i++]=o,t[i++]=a,t[i++]=c,t[i++]=u,_+=4;if(o=e[_++],o<128)t[i++]=o;else if((o&224)===192){if(_>=r)return this.interim[0]=o,i;if(a=e[_++],(a&192)!==128){_--;continue}if(p=(o&31)<<6|a&63,p<128){_--;continue}t[i++]=p}else if((o&240)===224){if(_>=r)return this.interim[0]=o,i;if(a=e[_++],(a&192)!==128){_--;continue}if(_>=r)return this.interim[0]=o,this.interim[1]=a,i;if(c=e[_++],(c&192)!==128){_--;continue}if(p=(o&15)<<12|(a&63)<<6|c&63,p<2048||p>=55296&&p<=57343||p===65279)continue;t[i++]=p}else if((o&248)===240){if(_>=r)return this.interim[0]=o,i;if(a=e[_++],(a&192)!==128){_--;continue}if(_>=r)return this.interim[0]=o,this.interim[1]=a,i;if(c=e[_++],(c&192)!==128){_--;continue}if(_>=r)return this.interim[0]=o,this.interim[1]=a,this.interim[2]=c,i;if(u=e[_++],(u&192)!==128){_--;continue}if(p=(o&7)<<18|(a&63)<<12|(c&63)<<6|u&63,p<65536||p>1114111)continue;t[i++]=p}}return i}},Cb="",Qs=" ",Vl=class kb{constructor(){this.fg=0,this.bg=0,this.extended=new uu}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new kb;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},uu=class Eb{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new Eb(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Vr=class Pb extends Vl{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new uu,this.combinedData=""}static fromCharData(t){let r=new Pb;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Bs(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let o=t[1].charCodeAt(1);56320<=o&&o<=57343?this.content=(i-55296)*1024+o-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},g1="di$target",bg="di$dependencies",tp=new Map;function yj(e){return e[bg]||[]}function zt(e){if(tp.has(e))return tp.get(e);let t=function(r,i,o){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");xj(t,r,o)};return t._id=e,tp.set(e,t),t}function xj(e,t,r){t[g1]===t?t[bg].push({id:e,index:r}):(t[bg]=[{id:e,index:r}],t[g1]=t)}var ur=zt("BufferService"),Rb=zt("CoreMouseService"),zn=zt("CoreService"),Sj=zt("CharsetService"),jv=zt("InstantiationService"),jb=zt("LogService"),dr=zt("OptionsService"),Tb=zt("OscLinkService"),bj=zt("UnicodeService"),Ql=zt("DecorationService"),wg=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){var g;let r=this._bufferService.buffer.lines.get(e-1);if(!r){t(void 0);return}let i=[],o=this._optionsService.rawOptions.linkHandler,a=new Vr,c=r.getTrimmedLength(),u=-1,p=-1,f=!1;for(let _=0;_<c;_++)if(!(p===-1&&!r.hasContent(_))){if(r.loadCell(_,a),a.hasExtendedAttrs()&&a.extended.urlId)if(p===-1){p=_,u=a.extended.urlId;continue}else f=a.extended.urlId!==u;else p!==-1&&(f=!0);if(f||p!==-1&&_===c-1){let y=(g=this._oscLinkService.getLinkData(u))==null?void 0:g.uri;if(y){let x={start:{x:p+1,y:e},end:{x:_+(!f&&_===c-1?1:0),y:e}},S=!1;if(!(o!=null&&o.allowNonHttpProtocols))try{let w=new URL(y);["http:","https:"].includes(w.protocol)||(S=!0)}catch{S=!0}S||i.push({text:y,range:x,activate:(w,C)=>o?o.activate(w,C,x):wj(w,C),hover:(w,C)=>{var E;return(E=o==null?void 0:o.hover)==null?void 0:E.call(o,w,C,x)},leave:(w,C)=>{var E;return(E=o==null?void 0:o.leave)==null?void 0:E.call(o,w,C,x)}})}f=!1,a.hasExtendedAttrs()&&a.extended.urlId?(p=_,u=a.extended.urlId):(p=-1,u=-1)}}t(i)}};wg=gt([fe(0,ur),fe(1,dr),fe(2,Tb)],wg);function wj(e,t){if(confirm(`Do you want to navigate to ${t}?--WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Eu=zt("CharSizeService"),ss=zt("CoreBrowserService"),Tv=zt("MouseService"),ns=zt("RenderService"),Cj=zt("SelectionService"),Lb=zt("CharacterJoinerService"),ia=zt("ThemeService"),Mb=zt("LinkProviderService"),kj=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?v1.isErrorNoTelemetry(e)?new v1(e.message+`--`+e.stack):new Error(e.message+`--`+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)}},Ej=new kj;function Lh(e){Pj(e)||Ej.onUnexpectedError(e)}var Cg="Canceled";function Pj(e){return e instanceof Rj?!0:e instanceof Error&&e.name===Cg&&e.message===Cg}var Rj=class extends Error{constructor(){super(Cg),this.name=this.message}};function jj(e){return new Error(`Illegal argument: ${e}`)}var v1=class kg extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof kg)return t;let r=new kg;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Eg=class Db extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,Db.prototype)}};function Rr(e,t=0){return e[e.length-(1+t)]}var Tj;(e=>{function t(a){return a<0}e.isLessThan=t;function r(a){return a<=0}e.isLessThanOrEqual=r;function i(a){return a>0}e.isGreaterThan=i;function o(a){return a===0}e.isNeitherLessOrGreaterThan=o,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Tj||(Tj={}));function Lj(e,t){let r=this,i=!1,o;return function(){return i||(i=!0,t||(o=e.apply(r,arguments))),o}}var Bb;(e=>{function t(R){return R&&typeof R=="object"&&typeof R[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function i(){return r}e.empty=i;function*o(R){yield R}e.single=o;function a(R){return t(R)?R:o(R)}e.wrap=a;function c(R){return R||r}e.from=c;function*u(R){for(let M=R.length-1;M>=0;M--)yield R[M]}e.reverse=u;function p(R){return!R||R[Symbol.iterator]().next().done===!0}e.isEmpty=p;function f(R){return R[Symbol.iterator]().next().value}e.first=f;function g(R,M){let F=0;for(let W of R)if(M(W,F++))return!0;return!1}e.some=g;function _(R,M){for(let F of R)if(M(F))return F}e.find=_;function*y(R,M){for(let F of R)M(F)&&(yield F)}e.filter=y;function*x(R,M){let F=0;for(let W of R)yield M(W,F++)}e.map=x;function*S(R,M){let F=0;for(let W of R)yield*M(W,F++)}e.flatMap=S;function*w(...R){for(let M of R)yield*M}e.concat=w;function C(R,M,F){let W=F;for(let H of R)W=M(W,H);return W}e.reduce=C;function*E(R,M,F=R.length){for(M<0&&(M+=R.length),F<0?F+=R.length:F>R.length&&(F=R.length);M<F;M++)yield R[M]}e.slice=E;function I(R,M=Number.POSITIVE_INFINITY){let F=[];if(M===0)return[F,R];let W=R[Symbol.iterator]();for(let H=0;H<M;H++){let K=W.next();if(K.done)return[F,e.empty()];F.push(K.value)}return[F,{[Symbol.iterator](){return W}}]}e.consume=I;async function k(R){let M=[];for await(let F of R)M.push(F);return Promise.resolve(M)}e.asyncToArray=k})(Bb||(Bb={}));function An(e){if(Bb.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function Mj(...e){return rt(()=>An(e))}function rt(e){return{dispose:Lj(()=>{e()})}}var Ib=class Ob{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{An(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?Ob.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};Ib.DISABLE_DISPOSED_WARNING=!1;var Xs=Ib,Ie=class{constructor(){this._store=new Xs,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)}};Ie.None=Object.freeze({dispose(){}});var Jo=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},es=typeof window=="object"?window:globalThis,Pg=class Rg{constructor(t){this.element=t,this.next=Rg.Undefined,this.prev=Rg.Undefined}};Pg.Undefined=new Pg(void 0);var ot=Pg,_1=class{constructor(){this._first=ot.Undefined,this._last=ot.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ot.Undefined}clear(){let e=this._first;for(;e!==ot.Undefined;){let t=e.next;e.prev=ot.Undefined,e.next=ot.Undefined,e=t}this._first=ot.Undefined,this._last=ot.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new ot(e);if(this._first===ot.Undefined)this._first=r,this._last=r;else if(t){let o=this._last;this._last=r,r.prev=o,o.next=r}else{let o=this._first;this._first=r,r.next=o,o.prev=r}this._size+=1;let i=!1;return()=>{i||(i=!0,this._remove(r))}}shift(){if(this._first!==ot.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ot.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ot.Undefined&&e.next!==ot.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ot.Undefined&&e.next===ot.Undefined?(this._first=ot.Undefined,this._last=ot.Undefined):e.next===ot.Undefined?(this._last=this._last.prev,this._last.next=ot.Undefined):e.prev===ot.Undefined&&(this._first=this._first.next,this._first.prev=ot.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ot.Undefined;)yield e.element,e=e.next}},Dj=globalThis.performance&&typeof globalThis.performance.now=="function",Bj=class Fb{static create(t){return new Fb(t)}constructor(t){this._now=Dj&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Vt;(e=>{e.None=()=>Ie.None;function t(Q,N){return _(Q,()=>{},0,void 0,!0,void 0,N)}e.defer=t;function r(Q){return(N,q=null,Y)=>{let re=!1,le;return le=Q($=>{if(!re)return le?le.dispose():re=!0,N.call(q,$)},null,Y),re&&le.dispose(),le}}e.once=r;function i(Q,N,q){return f((Y,re=null,le)=>Q($=>Y.call(re,N($)),null,le),q)}e.map=i;function o(Q,N,q){return f((Y,re=null,le)=>Q($=>{N($),Y.call(re,$)},null,le),q)}e.forEach=o;function a(Q,N,q){return f((Y,re=null,le)=>Q($=>N($)&&Y.call(re,$),null,le),q)}e.filter=a;function c(Q){return Q}e.signal=c;function u(...Q){return(N,q=null,Y)=>{let re=Mj(...Q.map(le=>le($=>N.call(q,$))));return g(re,Y)}}e.any=u;function p(Q,N,q,Y){let re=q;return i(Q,le=>(re=N(re,le),re),Y)}e.reduce=p;function f(Q,N){let q,Y={onWillAddFirstListener(){q=Q(re.fire,re)},onDidRemoveLastListener(){q==null||q.dispose()}},re=new ae(Y);return N==null||N.add(re),re.event}function g(Q,N){return N instanceof Array?N.push(Q):N&&N.add(Q),Q}function _(Q,N,q=100,Y=!1,re=!1,le,$){let Z,ee,D,V=0,ge,_e={leakWarningThreshold:le,onWillAddFirstListener(){Z=Q(Ce=>{V++,ee=N(ee,Ce),Y&&!D&&(we.fire(ee),ee=void 0),ge=()=>{let De=ee;ee=void 0,D=void 0,(!Y||V>1)&&we.fire(De),V=0},typeof q=="number"?(clearTimeout(D),D=setTimeout(ge,q)):D===void 0&&(D=0,queueMicrotask(ge))})},onWillRemoveListener(){re&&V>0&&(ge==null||ge())},onDidRemoveLastListener(){ge=void 0,Z.dispose()}},we=new ae(_e);return $==null||$.add(we),we.event}e.debounce=_;function y(Q,N=0,q){return e.debounce(Q,(Y,re)=>Y?(Y.push(re),Y):[re],N,void 0,!0,void 0,q)}e.accumulate=y;function x(Q,N=(Y,re)=>Y===re,q){let Y=!0,re;return a(Q,le=>{let $=Y||!N(le,re);return Y=!1,re=le,$},q)}e.latch=x;function S(Q,N,q){return[e.filter(Q,N,q),e.filter(Q,Y=>!N(Y),q)]}e.split=S;function w(Q,N=!1,q=[],Y){let re=q.slice(),le=Q(ee=>{re?re.push(ee):Z.fire(ee)});Y&&Y.add(le);let $=()=>{re==null||re.forEach(ee=>Z.fire(ee)),re=null},Z=new ae({onWillAddFirstListener(){le||(le=Q(ee=>Z.fire(ee)),Y&&Y.add(le))},onDidAddFirstListener(){re&&(N?setTimeout($):$())},onDidRemoveLastListener(){le&&le.dispose(),le=null}});return Y&&Y.add(Z),Z.event}e.buffer=w;function C(Q,N){return(q,Y,re)=>{let le=N(new I);return Q(function($){let Z=le.evaluate($);Z!==E&&q.call(Y,Z)},void 0,re)}}e.chain=C;let E=Symbol("HaltChainable");class I{constructor(){this.steps=[]}map(N){return this.steps.push(N),this}forEach(N){return this.steps.push(q=>(N(q),q)),this}filter(N){return this.steps.push(q=>N(q)?q:E),this}reduce(N,q){let Y=q;return this.steps.push(re=>(Y=N(Y,re),Y)),this}latch(N=(q,Y)=>q===Y){let q=!0,Y;return this.steps.push(re=>{let le=q||!N(re,Y);return q=!1,Y=re,le?re:E}),this}evaluate(N){for(let q of this.steps)if(N=q(N),N===E)break;return N}}function k(Q,N,q=Y=>Y){let Y=(...Z)=>$.fire(q(...Z)),re=()=>Q.on(N,Y),le=()=>Q.removeListener(N,Y),$=new ae({onWillAddFirstListener:re,onDidRemoveLastListener:le});return $.event}e.fromNodeEventEmitter=k;function R(Q,N,q=Y=>Y){let Y=(...Z)=>$.fire(q(...Z)),re=()=>Q.addEventListener(N,Y),le=()=>Q.removeEventListener(N,Y),$=new ae({onWillAddFirstListener:re,onDidRemoveLastListener:le});return $.event}e.fromDOMEventEmitter=R;function M(Q){return new Promise(N=>r(Q)(N))}e.toPromise=M;function F(Q){let N=new ae;return Q.then(q=>{N.fire(q)},()=>{N.fire(void 0)}).finally(()=>{N.dispose()}),N.event}e.fromPromise=F;function W(Q,N){return Q(q=>N.fire(q))}e.forward=W;function H(Q,N,q){return N(q),Q(Y=>N(Y))}e.runAndSubscribe=H;class K{constructor(N,q){this._observable=N,this._counter=0,this._hasChanged=!1;let Y={onWillAddFirstListener:()=>{N.addObserver(this)},onDidRemoveLastListener:()=>{N.removeObserver(this)}};this.emitter=new ae(Y),q&&q.add(this.emitter)}beginUpdate(N){this._counter++}handlePossibleChange(N){}handleChange(N,q){this._hasChanged=!0}endUpdate(N){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function ie(Q,N){return new K(Q,N).emitter.event}e.fromObservable=ie;function oe(Q){return(N,q,Y)=>{let re=0,le=!1,$={beginUpdate(){re++},endUpdate(){re--,re===0&&(Q.reportChanges(),le&&(le=!1,N.call(q)))},handlePossibleChange(){},handleChange(){le=!0}};Q.addObserver($),Q.reportChanges();let Z={dispose(){Q.removeObserver($)}};return Y instanceof Xs?Y.add(Z):Array.isArray(Y)&&Y.push(Z),Z}}e.fromObservableLight=oe})(Vt||(Vt={}));var jg=class Tg{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Tg._idPool++}`,Tg.all.add(this)}start(t){this._stopWatch=new Bj,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};jg.all=new Set,jg._idPool=0;var Ij=jg,Oj=-1,$b=class Ab{constructor(t,r,i=(Ab._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=i,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,r){let i=this.threshold;if(i<=0||r<i)return;this._stacks||(this._stacks=new Map);let o=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[a,c]=this.getMostFrequentStack(),u=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${c}):`;console.warn(u),console.warn(a);let p=new Aj(u,a);this._errorHandler(p)}return()=>{let a=this._stacks.get(t.value)||0;this._stacks.set(t.value,a-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[i,o]of this._stacks)(!t||r<o)&&(t=[i,o],r=o);return t}};$b._idPool=1;var Fj=$b,$j=class Nb{constructor(t){this.value=t}static create(){let t=new Error;return new Nb(t.stack??"")}print(){console.warn(this.value.split(`-`).slice(2).join(`-`))}},Aj=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Nj=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},zj=0,rp=class{constructor(e){this.value=e,this.id=zj++}},Wj=2,Hj,ae=class{constructor(t){var r,i,o,a;this._size=0,this._options=t,this._leakageMon=(r=this._options)!=null&&r.leakWarningThreshold?new Fj((t==null?void 0:t.onListenerError)??Lh,((i=this._options)==null?void 0:i.leakWarningThreshold)??Oj):void 0,this._perfMon=(o=this._options)!=null&&o._profName?new Ij(this._options._profName):void 0,this._deliveryQueue=(a=this._options)==null?void 0:a.deliveryQueue}dispose(){var t,r,i,o;this._disposed||(this._disposed=!0,((t=this._deliveryQueue)==null?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(i=(r=this._options)==null?void 0:r.onDidRemoveLastListener)==null||i.call(r),(o=this._leakageMon)==null||o.dispose())}get event(){return this._event??(this._event=(t,r,i)=>{var u,p,f,g,_;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let y=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(y);let x=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],S=new Nj(`${y}. HINT: Stack shows most frequent listener (${x[1]}-times)`,x[0]);return(((u=this._options)==null?void 0:u.onListenerError)||Lh)(S),Ie.None}if(this._disposed)return Ie.None;r&&(t=t.bind(r));let o=new rp(t),a;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(o.stack=$j.create(),a=this._leakageMon.check(o.stack,this._size+1)),this._listeners?this._listeners instanceof rp?(this._deliveryQueue??(this._deliveryQueue=new Uj),this._listeners=[this._listeners,o]):this._listeners.push(o):((f=(p=this._options)==null?void 0:p.onWillAddFirstListener)==null||f.call(p,this),this._listeners=o,(_=(g=this._options)==null?void 0:g.onDidAddFirstListener)==null||_.call(g,this)),this._size++;let c=rt(()=>{a==null||a(),this._removeListener(o)});return i instanceof Xs?i.add(c):Array.isArray(i)&&i.push(c),c}),this._event}_removeListener(t){var a,c,u,p;if((c=(a=this._options)==null?void 0:a.onWillRemoveListener)==null||c.call(a,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(p=(u=this._options)==null?void 0:u.onDidRemoveLastListener)==null||p.call(u,this),this._size=0;return}let r=this._listeners,i=r.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,r[i]=void 0;let o=this._deliveryQueue.current===this;if(this._size*Wj<=r.length){let f=0;for(let g=0;g<r.length;g++)r[g]?r[f++]=r[g]:o&&(this._deliveryQueue.end--,f<this._deliveryQueue.i&&this._deliveryQueue.i--);r.length=f}}_deliver(t,r){var o;if(!t)return;let i=((o=this._options)==null?void 0:o.onListenerError)||Lh;if(!i){t.value(r);return}try{t.value(r)}catch(a){i(a)}}_deliverQueue(t){let r=t.current._listeners;for(;t.i<t.end;)this._deliver(r[t.i++],t.value);t.reset()}fire(t){var r,i,o,a;if((r=this._deliveryQueue)!=null&&r.current&&(this._deliverQueue(this._deliveryQueue),(i=this._perfMon)==null||i.stop()),(o=this._perfMon)==null||o.start(this._size),this._listeners)if(this._listeners instanceof rp)this._deliver(this._listeners,t);else{let c=this._deliveryQueue;c.enqueue(this,t,this._listeners.length),this._deliverQueue(c)}(a=this._perfMon)==null||a.stop()}hasListeners(){return this._size>0}},Uj=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Lg=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ae,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ae,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Lg.INSTANCE=new Lg;var Lv=Lg;function Kj(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}Lv.INSTANCE.onDidChangeZoomLevel;function qj(e){return Lv.INSTANCE.getZoomFactor(e)}Lv.INSTANCE.onDidChangeFullscreen;var sa=typeof navigator=="object"?navigator.userAgent:"",Mg=sa.indexOf("Firefox")>=0,Vj=sa.indexOf("AppleWebKit")>=0,Mv=sa.indexOf("Chrome")>=0,Qj=!Mv&&sa.indexOf("Safari")>=0;sa.indexOf("Electron/")>=0;sa.indexOf("Android")>=0;var ip=!1;if(typeof es.matchMedia=="function"){let e=es.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=es.matchMedia("(display-mode: fullscreen)");ip=e.matches,Kj(es,e,({matches:r})=>{ip&&t.matches||(ip=r)})}var jo="en",Dg=!1,Bg=!1,Mh=!1,zb=!1,mh,Dh=jo,m1=jo,Gj,si,Bn=globalThis,Kt,_x;typeof Bn.vscode<"u"&&typeof Bn.vscode.process<"u"?Kt=Bn.vscode.process:typeof process<"u"&&typeof((_x=process==null?void 0:process.versions)==null?void 0:_x.node)=="string"&&(Kt=process);var mx,Yj=typeof((mx=Kt==null?void 0:Kt.versions)==null?void 0:mx.electron)=="string",Xj=Yj&&(Kt==null?void 0:Kt.type)==="renderer",yx;if(typeof Kt=="object"){Dg=Kt.platform==="win32",Bg=Kt.platform==="darwin",Mh=Kt.platform==="linux",Mh&&Kt.env.SNAP&&Kt.env.SNAP_REVISION,Kt.env.CI||Kt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,mh=jo,Dh=jo;let e=Kt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);mh=t.userLocale,m1=t.osLocale,Dh=t.resolvedLanguage||jo,Gj=(yx=t.languagePack)==null?void 0:yx.translationsConfigFile}catch{}zb=!0}else typeof navigator=="object"&&!Xj?(si=navigator.userAgent,Dg=si.indexOf("Windows")>=0,Bg=si.indexOf("Macintosh")>=0,(si.indexOf("Macintosh")>=0||si.indexOf("iPad")>=0||si.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Mh=si.indexOf("Linux")>=0,(si==null?void 0:si.indexOf("Mobi"))>=0,Dh=globalThis._VSCODE_NLS_LANGUAGE||jo,mh=navigator.language.toLowerCase(),m1=mh):console.error("Unable to resolve platform.");var Wb=Dg,Ei=Bg,Jj=Mh,y1=zb,Pi=si,js=Dh,Zj;(e=>{function t(){return js}e.value=t;function r(){return js.length===2?js==="en":js.length>=3?js[0]==="e"&&js[1]==="n"&&js[2]==="-":!1}e.isDefaultVariant=r;function i(){return js==="en"}e.isDefault=i})(Zj||(Zj={}));var eT=typeof Bn.postMessage=="function"&&!Bn.importScripts;(()=>{if(eT){let e=[];Bn.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let i=0,o=e.length;i<o;i++){let a=e[i];if(a.id===r.data.vscodeScheduleAsyncWork){e.splice(i,1),a.callback();return}}});let t=0;return r=>{let i=++t;e.push({id:i,callback:r}),Bn.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var tT=!!(Pi&&Pi.indexOf("Chrome")>=0);Pi&&Pi.indexOf("Firefox")>=0;!tT&&Pi&&Pi.indexOf("Safari")>=0;Pi&&Pi.indexOf("Edg/")>=0;Pi&&Pi.indexOf("Android")>=0;var xo=typeof navigator=="object"?navigator:{};y1||document.queryCommandSupported&&document.queryCommandSupported("copy")||xo&&xo.clipboard&&xo.clipboard.writeText,y1||xo&&xo.clipboard&&xo.clipboard.readText;var Dv=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}},sp=new Dv,x1=new Dv,S1=new Dv,rT=new Array(230),Hb;(e=>{function t(u){return sp.keyCodeToStr(u)}e.toString=t;function r(u){return sp.strToKeyCode(u)}e.fromString=r;function i(u){return x1.keyCodeToStr(u)}e.toUserSettingsUS=i;function o(u){return S1.keyCodeToStr(u)}e.toUserSettingsGeneral=o;function a(u){return x1.strToKeyCode(u)||S1.strToKeyCode(u)}e.fromUserSettings=a;function c(u){if(u>=98&&u<=113)return null;switch(u){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return sp.keyCodeToStr(u)}e.toElectronAccelerator=c})(Hb||(Hb={}));var iT=class Ub{constructor(t,r,i,o,a){this.ctrlKey=t,this.shiftKey=r,this.altKey=i,this.metaKey=o,this.keyCode=a}equals(t){return t instanceof Ub&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",r=this.shiftKey?"1":"0",i=this.altKey?"1":"0",o=this.metaKey?"1":"0";return`K${t}${r}${i}${o}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new sT([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},sT=class{constructor(e){if(e.length===0)throw jj("chords");this.chords=e}getHashCode(){let e="";for(let t=0,r=this.chords.length;t<r;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function nT(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return Hb.fromString(r)}let t=e.keyCode;if(t===3)return 7;if(Mg)switch(t){case 59:return 85;case 60:if(Jj)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Ei)return 57;break}else if(Vj&&(Ei&&t===93||!Ei&&t===92))return 57;return rT[t]||0}var oT=Ei?256:2048,aT=512,lT=1024,cT=Ei?2048:256,b1=class{constructor(e){var r;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(r=t.getModifierState)==null?void 0:r.call(t,"AltGraph"),this.keyCode=nT(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=oT),this.altKey&&(t|=aT),this.shiftKey&&(t|=lT),this.metaKey&&(t|=cT),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new iT(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},w1=new WeakMap;function hT(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,r=e.parent.location;if(t.origin!=="null"&&r.origin!=="null"&&t.origin!==r.origin)return null}catch{return null}return e.parent}var uT=class{static getSameOriginWindowChain(e){let t=w1.get(e);if(!t){t=[],w1.set(e,t);let r=e,i;do i=hT(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 r=0,i=0,o=this.getSameOriginWindowChain(e);for(let a of o){let c=a.window.deref();if(r+=(c==null?void 0:c.scrollY)??0,i+=(c==null?void 0:c.scrollX)??0,c===t||!a.iframeElement)break;let u=a.iframeElement.getBoundingClientRect();r+=u.top,i+=u.left}return{top:r,left:i}}},yh=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let r=uT.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},C1=class{constructor(e,t=0,r=0){var o;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=t;let i=!1;if(Mv){let a=navigator.userAgent.match(/Chrome\/(\d+)/);i=(a?parseInt(a[1]):123)<=122}if(e){let a=e,c=e,u=((o=e.view)==null?void 0:o.devicePixelRatio)||1;if(typeof a.wheelDeltaY<"u")i?this.deltaY=a.wheelDeltaY/(120*u):this.deltaY=a.wheelDeltaY/120;else if(typeof c.VERTICAL_AXIS<"u"&&c.axis===c.VERTICAL_AXIS)this.deltaY=-c.detail/3;else if(e.type==="wheel"){let p=e;p.deltaMode===p.DOM_DELTA_LINE?Mg&&!Ei?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof a.wheelDeltaX<"u")Qj&&Wb?this.deltaX=-(a.wheelDeltaX/120):i?this.deltaX=a.wheelDeltaX/(120*u):this.deltaX=a.wheelDeltaX/120;else if(typeof c.HORIZONTAL_AXIS<"u"&&c.axis===c.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let p=e;p.deltaMode===p.DOM_DELTA_LINE?Mg&&!Ei?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(i?this.deltaY=e.wheelDelta/(120*u):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},Kb=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),dT;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof fT?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Vt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Kb})})(dT||(dT={}));var fT=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Kb:(this._emitter||(this._emitter=new ae),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Bv=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Eg("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Eg("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},pT=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,r=globalThis){if(this.isDisposed)throw new Eg("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=r.setInterval(()=>{e()},t);this.disposable=rt(()=>{r.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},gT;(e=>{async function t(i){let o,a=await Promise.all(i.map(c=>c.then(u=>u,u=>{o||(o=u)})));if(typeof o<"u")throw o;return a}e.settled=t;function r(i){return new Promise(async(o,a)=>{try{await i(o,a)}catch(c){a(c)}})}e.withAsyncBody=r})(gT||(gT={}));var k1=class zr{static fromArray(t){return new zr(r=>{r.emitMany(t)})}static fromPromise(t){return new zr(async r=>{r.emitMany(await t)})}static fromPromises(t){return new zr(async r=>{await Promise.all(t.map(async i=>r.emitOne(await i)))})}static merge(t){return new zr(async r=>{await Promise.all(t.map(async i=>{for await(let o of i)r.emitOne(o)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new ae,queueMicrotask(async()=>{let i={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(t(i)),this.resolve()}catch(o){this.reject(o)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Vt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var r;return(r=this._onReturn)==null||r.call(this),{done:!0,value:void 0}}}}static map(t,r){return new zr(async i=>{for await(let o of t)i.emitOne(r(o))})}map(t){return zr.map(this,t)}static filter(t,r){return new zr(async i=>{for await(let o of t)r(o)&&i.emitOne(o)})}filter(t){return zr.filter(this,t)}static coalesce(t){return zr.filter(t,r=>!!r)}coalesce(){return zr.coalesce(this)}static async toPromise(t){let r=[];for await(let i of t)r.push(i);return r}toPromise(){return zr.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};k1.EMPTY=k1.fromArray([]);var{getWindow:ki,getWindowId:vT,onDidRegisterWindow:_T}=(function(){let e=new Map,t={window:es,disposables:new Xs};e.set(es.vscodeWindowId,t);let r=new ae,i=new ae,o=new ae;function a(c,u){return(typeof c=="number"?e.get(c):void 0)??(u?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:i.event,registerWindow(c){if(e.has(c.vscodeWindowId))return Ie.None;let u=new Xs,p={window:c,disposables:u.add(new Xs)};return e.set(c.vscodeWindowId,p),u.add(rt(()=>{e.delete(c.vscodeWindowId),i.fire(c)})),u.add(Re(c,Ot.BEFORE_UNLOAD,()=>{o.fire(c)})),r.fire(p),u},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(c){return c.vscodeWindowId},hasWindow(c){return e.has(c)},getWindowById:a,getWindow(c){var f;let u=c;if((f=u==null?void 0:u.ownerDocument)!=null&&f.defaultView)return u.ownerDocument.defaultView.window;let p=c;return p!=null&&p.view?p.view.window:es},getDocument(c){return ki(c).document}}})(),mT=class{constructor(e,t,r,i){this._node=e,this._type=t,this._handler=r,this._options=i||!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 Re(e,t,r,i){return new mT(e,t,r,i)}var E1=function(e,t,r,i){return Re(e,t,r,i)},Iv,yT=class extends pT{constructor(e){super(),this.defaultTarget=e&&ki(e)}cancelAndSet(e,t,r){return super.cancelAndSet(e,t,r??this.defaultTarget)}},P1=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Lh(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,i=new Map,o=a=>{r.set(a,!1);let c=e.get(a)??[];for(t.set(a,c),e.set(a,[]),i.set(a,!0);c.length>0;)c.sort(P1.sort),c.shift().execute();i.set(a,!1)};Iv=(a,c,u=0)=>{let p=vT(a),f=new P1(c,u),g=e.get(p);return g||(g=[],e.set(p,g)),g.push(f),r.get(p)||(r.set(p,!0),a.requestAnimationFrame(()=>o(p))),f}})();function xT(e){let t=e.getBoundingClientRect(),r=ki(e);return{left:t.left+r.scrollX,top:t.top+r.scrollY,width:t.width,height:t.height}}var Ot={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"},ST=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=yr(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=yr(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=yr(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=yr(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=yr(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=yr(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=yr(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=yr(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=yr(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=yr(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=yr(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=yr(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=yr(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=yr(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 yr(e){return typeof e=="number"?`${e}px`:e}function jl(e){return new ST(e)}var qb=class{constructor(){this._hooks=new Xs,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 r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,r,i,o){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=i,this._onStopCallback=o;let a=e;try{e.setPointerCapture(t),this._hooks.add(rt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=ki(e)}this._hooks.add(Re(a,Ot.POINTER_MOVE,c=>{if(c.buttons!==r){this.stopMonitoring(!0);return}c.preventDefault(),this._pointerMoveCallback(c)})),this._hooks.add(Re(a,Ot.POINTER_UP,c=>this.stopMonitoring(!0)))}};function bT(e,t,r){let i=null,o=null;if(typeof r.value=="function"?(i="value",o=r.value,o.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof r.get=="function"&&(i="get",o=r.get),!o)throw new Error("not supported");let a=`$memoize$${t}`;r[i]=function(...c){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:o.apply(this,c)}),this[a]}}var vi;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(vi||(vi={}));var _l=class Jt extends Ie{constructor(){super(),this.dispatched=!1,this.targets=new _1,this.ignoreTargets=new _1,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Vt.runAndSubscribe(_T,({window:t,disposables:r})=>{r.add(Re(t.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),r.add(Re(t.document,"touchend",i=>this.onTouchEnd(t,i))),r.add(Re(t.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:es,disposables:this._store}))}static addTarget(t){if(!Jt.isTouchDevice())return Ie.None;Jt.INSTANCE||(Jt.INSTANCE=new Jt);let r=Jt.INSTANCE.targets.push(t);return rt(r)}static ignoreTarget(t){if(!Jt.isTouchDevice())return Ie.None;Jt.INSTANCE||(Jt.INSTANCE=new Jt);let r=Jt.INSTANCE.ignoreTargets.push(t);return rt(r)}static isTouchDevice(){return"ontouchstart"in es||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let r=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,o=t.targetTouches.length;i<o;i++){let a=t.targetTouches.item(i);this.activeTouches[a.identifier]={id:a.identifier,initialTarget:a.target,initialTimeStamp:r,initialPageX:a.pageX,initialPageY:a.pageY,rollingTimestamps:[r],rollingPageX:[a.pageX],rollingPageY:[a.pageY]};let c=this.newGestureEvent(vi.Start,a.target);c.pageX=a.pageX,c.pageY=a.pageY,this.dispatchEvent(c)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,r){let i=Date.now(),o=Object.keys(this.activeTouches).length;for(let a=0,c=r.changedTouches.length;a<c;a++){let u=r.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(u.identifier))){console.warn("move of an UNKNOWN touch",u);continue}let p=this.activeTouches[u.identifier],f=Date.now()-p.initialTimeStamp;if(f<Jt.HOLD_DELAY&&Math.abs(p.initialPageX-Rr(p.rollingPageX))<30&&Math.abs(p.initialPageY-Rr(p.rollingPageY))<30){let g=this.newGestureEvent(vi.Tap,p.initialTarget);g.pageX=Rr(p.rollingPageX),g.pageY=Rr(p.rollingPageY),this.dispatchEvent(g)}else if(f>=Jt.HOLD_DELAY&&Math.abs(p.initialPageX-Rr(p.rollingPageX))<30&&Math.abs(p.initialPageY-Rr(p.rollingPageY))<30){let g=this.newGestureEvent(vi.Contextmenu,p.initialTarget);g.pageX=Rr(p.rollingPageX),g.pageY=Rr(p.rollingPageY),this.dispatchEvent(g)}else if(o===1){let g=Rr(p.rollingPageX),_=Rr(p.rollingPageY),y=Rr(p.rollingTimestamps)-p.rollingTimestamps[0],x=g-p.rollingPageX[0],S=_-p.rollingPageY[0],w=[...this.targets].filter(C=>p.initialTarget instanceof Node&&C.contains(p.initialTarget));this.inertia(t,w,i,Math.abs(x)/y,x>0?1:-1,g,Math.abs(S)/y,S>0?1:-1,_)}this.dispatchEvent(this.newGestureEvent(vi.End,p.initialTarget)),delete this.activeTouches[u.identifier]}this.dispatched&&(r.preventDefault(),r.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,r){let i=document.createEvent("CustomEvent");return i.initEvent(t,!1,!0),i.initialTarget=r,i.tapCount=0,i}dispatchEvent(t){if(t.type===vi.Tap){let r=new Date().getTime(),i=0;r-this._lastSetTapCountTime>Jt.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=r,t.tapCount=i}else(t.type===vi.Change||t.type===vi.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let i of this.ignoreTargets)if(i.contains(t.initialTarget))return;let r=[];for(let i of this.targets)if(i.contains(t.initialTarget)){let o=0,a=t.initialTarget;for(;a&&a!==i;)o++,a=a.parentElement;r.push([o,i])}r.sort((i,o)=>i[0]-o[0]);for(let[i,o]of r)o.dispatchEvent(t),this.dispatched=!0}}inertia(t,r,i,o,a,c,u,p,f){this.handle=Iv(t,()=>{let g=Date.now(),_=g-i,y=0,x=0,S=!0;o+=Jt.SCROLL_FRICTION*_,u+=Jt.SCROLL_FRICTION*_,o>0&&(S=!1,y=a*o*_),u>0&&(S=!1,x=p*u*_);let w=this.newGestureEvent(vi.Change);w.translationX=y,w.translationY=x,r.forEach(C=>C.dispatchEvent(w)),S||this.inertia(t,r,g,o,a,c+y,u,p,f+x)})}onTouchMove(t){let r=Date.now();for(let i=0,o=t.changedTouches.length;i<o;i++){let a=t.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("end of an UNKNOWN touch",a);continue}let c=this.activeTouches[a.identifier],u=this.newGestureEvent(vi.Change,c.initialTarget);u.translationX=a.pageX-Rr(c.rollingPageX),u.translationY=a.pageY-Rr(c.rollingPageY),u.pageX=a.pageX,u.pageY=a.pageY,this.dispatchEvent(u),c.rollingPageX.length>3&&(c.rollingPageX.shift(),c.rollingPageY.shift(),c.rollingTimestamps.shift()),c.rollingPageX.push(a.pageX),c.rollingPageY.push(a.pageY),c.rollingTimestamps.push(r)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};_l.SCROLL_FRICTION=-.005,_l.HOLD_DELAY=700,_l.CLEAR_TAP_COUNT_TIME=400,gt([bT],_l,"isTouchDevice",1);var wT=_l,Ov=class extends Ie{onclick(e,t){this._register(Re(e,Ot.CLICK,r=>t(new yh(ki(e),r))))}onmousedown(e,t){this._register(Re(e,Ot.MOUSE_DOWN,r=>t(new yh(ki(e),r))))}onmouseover(e,t){this._register(Re(e,Ot.MOUSE_OVER,r=>t(new yh(ki(e),r))))}onmouseleave(e,t){this._register(Re(e,Ot.MOUSE_LEAVE,r=>t(new yh(ki(e),r))))}onkeydown(e,t){this._register(Re(e,Ot.KEY_DOWN,r=>t(new b1(r))))}onkeyup(e,t){this._register(Re(e,Ot.KEY_UP,r=>t(new b1(r))))}oninput(e,t){this._register(Re(e,Ot.INPUT,t))}onblur(e,t){this._register(Re(e,Ot.BLUR,t))}onfocus(e,t){this._register(Re(e,Ot.FOCUS,t))}onchange(e,t){this._register(Re(e,Ot.CHANGE,t))}ignoreGesture(e){return wT.ignoreTarget(e)}},R1=11,CT=class extends Ov{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=R1+"px",this.domNode.style.height=R1+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new qb),this._register(E1(this.bgDomNode,Ot.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(E1(this.domNode,Ot.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new yT),this._pointerdownScheduleRepeatTimer=this._register(new Bv)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,ki(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},kT=class Ig{constructor(t,r,i,o,a,c,u){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(r=r|0,i=i|0,o=o|0,a=a|0,c=c|0,u=u|0),this.rawScrollLeft=o,this.rawScrollTop=u,r<0&&(r=0),o+r>i&&(o=i-r),o<0&&(o=0),a<0&&(a=0),u+a>c&&(u=c-a),u<0&&(u=0),this.width=r,this.scrollWidth=i,this.scrollLeft=o,this.height=a,this.scrollHeight=c,this.scrollTop=u}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,r){return new Ig(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,r?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,r?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Ig(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,r){let i=this.width!==t.width,o=this.scrollWidth!==t.scrollWidth,a=this.scrollLeft!==t.scrollLeft,c=this.height!==t.height,u=this.scrollHeight!==t.scrollHeight,p=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:r,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:o,scrollLeftChanged:a,heightChanged:c,scrollHeightChanged:u,scrollTopChanged:p}}},ET=class extends Ie{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ae),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new kT(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),(i=this._smoothScrolling)==null||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(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let r=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===r.scrollLeft&&this._smoothScrolling.to.scrollTop===r.scrollTop)return;let i;t?i=new T1(this._smoothScrolling.from,r,this._smoothScrolling.startTime,this._smoothScrolling.duration):i=this._smoothScrolling.combine(this._state,r,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=i}else{let r=this._state.withScrollPosition(e);this._smoothScrolling=T1.start(this._state,r,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let r=this._state;r.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(r,t)))}},j1=class{constructor(e,t,r){this.scrollLeft=e,this.scrollTop=t,this.isDone=r}};function np(e,t){let r=t-e;return function(i){return e+r*jT(i)}}function PT(e,t,r){return function(i){return i<r?e(i/r):t((i-r)/(1-r))}}var T1=class Og{constructor(t,r,i,o){this.from=t,this.to=r,this.duration=o,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(t,r,i){if(Math.abs(t-r)>2.5*i){let o,a;return t<r?(o=t+.75*i,a=r-.75*i):(o=t-.75*i,a=r+.75*i),PT(np(t,o),np(a,r),.33)}return np(t,r)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let r=(t-this.startTime)/this.duration;if(r<1){let i=this.scrollLeft(r),o=this.scrollTop(r);return new j1(i,o,!1)}return new j1(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,r,i){return Og.start(t,r,i)}static start(t,r,i){i=i+10;let o=Date.now()-10;return new Og(t,r,o,i)}};function RT(e){return Math.pow(e,3)}function jT(e){return 1-RT(1-e)}var TT=class extends Ie{constructor(e,t,r){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=r,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Bv)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},LT=140,Vb=class extends Ov{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 TT(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new qb),this._shouldRender=!0,this.domNode=jl(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(Re(this.domNode.domNode,Ot.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new CT(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,i){this.slider=jl(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof r=="number"&&this.slider.setWidth(r),typeof i=="number"&&this.slider.setHeight(i),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Re(this.slider.domNode,Ot.POINTER_DOWN,o=>{o.button===0&&(o.preventDefault(),this._sliderPointerDown(o))})),this.onclick(this.slider.domNode,o=>{o.leftButton&&o.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,r=t+this._scrollbarState.getSliderPosition(),i=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),o=this._sliderPointerPosition(e);r<=o&&o<=i?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,r;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,r=e.offsetY;else{let o=xT(this.domNode.domNode);t=e.pageX-o.left,r=e.pageY-o.top}let i=this._pointerDownRelativePosition(t,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(i):this._scrollbarState.getDesiredScrollPositionFromOffset(i)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),r=this._sliderOrthogonalPointerPosition(e),i=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,o=>{let a=this._sliderOrthogonalPointerPosition(o),c=Math.abs(a-r);if(Wb&&c>LT){this._setDesiredScrollPositionNow(i.getScrollPosition());return}let u=this._sliderPointerPosition(o)-t;this._setDesiredScrollPositionNow(i.getDesiredScrollPositionFromDelta(u))},()=>{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()}},Qb=class Fg{constructor(t,r,i,o,a,c){this._scrollbarSize=Math.round(r),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(t),this._visibleSize=o,this._scrollSize=a,this._scrollPosition=c,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Fg(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let r=Math.round(t);return this._visibleSize!==r?(this._visibleSize=r,this._refreshComputedValues(),!0):!1}setScrollSize(t){let r=Math.round(t);return this._scrollSize!==r?(this._scrollSize=r,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let r=Math.round(t);return this._scrollPosition!==r?(this._scrollPosition=r,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,r,i,o,a){let c=Math.max(0,i-t),u=Math.max(0,c-2*r),p=o>0&&o>i;if(!p)return{computedAvailableSize:Math.round(c),computedIsNeeded:p,computedSliderSize:Math.round(u),computedSliderRatio:0,computedSliderPosition:0};let f=Math.round(Math.max(20,Math.floor(i*u/o))),g=(u-f)/(o-i),_=a*g;return{computedAvailableSize:Math.round(c),computedIsNeeded:p,computedSliderSize:Math.round(f),computedSliderRatio:g,computedSliderPosition:Math.round(_)}}_refreshComputedValues(){let t=Fg._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize-this._computedSliderSize/2;return Math.round(r/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize,i=this._scrollPosition;return r<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let r=this._computedSliderPosition+t;return Math.round(r/this._computedSliderRatio)}},MT=class extends Vb{constructor(e,t,r){let i=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new Qb(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,i.width,i.scrollWidth,o.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},DT=class extends Vb{constructor(e,t,r){let i=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new Qb(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,i.height,i.scrollHeight,o.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},BT=500,L1=50,IT=class{constructor(e,t,r){this.timestamp=e,this.deltaX=t,this.deltaY=r,this.score=0}},$g=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,r=0,i=1,o=this._rear;do{let a=o===this._front?t:Math.pow(2,-i);if(t-=a,r+=this._memory[o].score*a,o===this._front)break;o=(this._capacity+o-1)%this._capacity,i++}while(!0);return r<=.5}acceptStandardWheelEvent(t){if(Mv){let r=ki(t.browserEvent),i=qj(r);this.accept(Date.now(),t.deltaX*i,t.deltaY*i)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,r,i){let o=null,a=new IT(t,r,i);this._front===-1&&this._rear===-1?(this._memory[0]=a,this._front=0,this._rear=0):(o=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]=a),a.score=this._computeScore(a,o)}_computeScore(t,r){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(i+=.25),r){let o=Math.abs(t.deltaX),a=Math.abs(t.deltaY),c=Math.abs(r.deltaX),u=Math.abs(r.deltaY),p=Math.max(Math.min(o,c),1),f=Math.max(Math.min(a,u),1),g=Math.max(o,c),_=Math.max(a,u);g%p===0&&_%f===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};$g.INSTANCE=new $g;var OT=$g,FT=class extends Ov{constructor(e,t,r){super(),this._onScroll=this._register(new ae),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ae),this.onWillScroll=this._onWillScroll.event,this._options=AT(t),this._scrollable=r,this._register(this._scrollable.onScroll(o=>{this._onWillScroll.fire(o),this._onDidScroll(o),this._onScroll.fire(o)}));let i={onMouseWheel:o=>this._onMouseWheel(o),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new DT(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new MT(this._scrollable,this._options,i)),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=jl(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=jl(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=jl(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,o=>this._onMouseOver(o)),this.onmouseleave(this._listenOnDomNode,o=>this._onMouseLeave(o)),this._hideTimeout=this._register(new Bv),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=An(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,Ei&&(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 C1(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=An(this._mouseWheelToDispose),e)){let t=r=>{this._onMouseWheel(new C1(r))};this._mouseWheelToDispose.push(Re(this._listenOnDomNode,Ot.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var o;if((o=e.browserEvent)!=null&&o.defaultPrevented)return;let t=OT.INSTANCE;t.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let a=e.deltaY*this._options.mouseWheelScrollSensitivity,c=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&c+a===0?c=a=0:Math.abs(a)>=Math.abs(c)?c=0:a=0),this._options.flipAxes&&([a,c]=[c,a]);let u=!Ei&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||u)&&!c&&(c=a,a=0),e.browserEvent&&e.browserEvent.altKey&&(c=c*this._options.fastScrollSensitivity,a=a*this._options.fastScrollSensitivity);let p=this._scrollable.getFutureScrollPosition(),f={};if(a){let g=L1*a,_=p.scrollTop-(g<0?Math.floor(g):Math.ceil(g));this._verticalScrollbar.writeScrollPosition(f,_)}if(c){let g=L1*c,_=p.scrollLeft-(g<0?Math.floor(g):Math.ceil(g));this._horizontalScrollbar.writeScrollPosition(f,_)}f=this._scrollable.validateScrollPosition(f),(p.scrollLeft!==f.scrollLeft||p.scrollTop!==f.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(f):this._scrollable.setScrollPositionNow(f),r=!0)}let i=r;!i&&this._options.alwaysConsumeMouseWheel&&(i=!0),!i&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(i=!0),i&&(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,r=e.scrollLeft>0,i=r?" left":"",o=t?" top":"",a=r||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${i}`),this._topShadowDomNode.setClassName(`shadow${o}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${o}${i}`)}}_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(),BT)}},$T=class extends FT{constructor(e,t,r){super(e,t,r)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function AT(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,Ei&&(t.className+=" mac"),t}var Ag=class extends Ie{constructor(e,t,r,i,o,a,c,u){super(),this._bufferService=r,this._optionsService=c,this._renderService=u,this._onRequestScrollLines=this._register(new ae),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let p=this._register(new ET({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:f=>Iv(i.window,f)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{p.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new $T(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},p)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(o.onProtocolChange(f=>{this._scrollableElement.updateOptions({handleMouseWheel:!(f&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Vt.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(rt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(rt(()=>this._styleElement.remove())),this._register(Vt.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${a.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${a.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${a.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`-`)})),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(f=>this._handleScroll(f)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),r=t-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};Ag=gt([fe(2,ur),fe(3,ss),fe(4,Rb),fe(5,ia),fe(6,dr),fe(7,ns)],Ag);var Ng=class extends Ie{constructor(e,t,r,i,o){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=r,this._decorationService=i,this._renderService=o,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(a=>this._removeDecoration(a))),this._register(rt(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var i;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((i=e==null?void 0:e.options)==null?void 0:i.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,t=e.element){if(!t)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};Ng=gt([fe(1,ur),fe(2,ss),fe(3,Ql),fe(4,ns)],Ng);var NT=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,r){return t>=e.startBufferLine-this._linePadding[r||"full"]&&t<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},pi={full:0,left:0,center:0,right:0},Ts={full:0,left:0,center:0,right:0},rl={full:0,left:0,center:0,right:0},du=class extends Ie{constructor(e,t,r,i,o,a,c,u){var f;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=r,this._decorationService=i,this._renderService=o,this._optionsService=a,this._themeService=c,this._coreBrowserService=u,this._colorZoneStore=new NT,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(),(f=this._viewportElement.parentElement)==null||f.insertBefore(this._canvas,this._viewportElement),this._register(rt(()=>{var g;return(g=this._canvas)==null?void 0:g.remove()}));let p=this._canvas.getContext("2d");if(p)this._ctx=p;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Ts.full=this._canvas.width,Ts.left=e,Ts.center=t,Ts.right=e,this._refreshDrawHeightConstants(),rl.full=1,rl.left=1,rl.center=1+Ts.left,rl.right=1+Ts.left+Ts.center}_refreshDrawHeightConstants(){pi.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);pi.left=t,pi.center=t,pi.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*pi.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*pi.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*pi.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*pi.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(rl[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-pi[e.position||"full"]/2),Ts[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+pi[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};du=gt([fe(2,ur),fe(3,Ql),fe(4,ns),fe(5,dr),fe(6,ia),fe(7,ss)],du);var G;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`-`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(G||(G={}));var Bh;(e=>(e.PAD="",e.HOP="",e.BPH="",e.NBH="",e.IND="",e.NEL=" ",e.SSA="",e.ESA="",e.HTS="",e.HTJ="",e.VTS="",e.PLD="",e.PLU="",e.RI="",e.SS2="",e.SS3="",e.DCS="",e.PU1="",e.PU2="",e.STS="",e.CCH="",e.MW="",e.SPA="",e.EPA="",e.SOS="",e.SGCI="",e.SCI="",e.CSI="",e.ST="",e.OSC="",e.PM="",e.APC=""))(Bh||(Bh={}));var Gb;(e=>e.ST=`${G.ESC}\\`)(Gb||(Gb={}));var zg=class{constructor(e,t,r,i,o,a){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=i,this._coreService=o,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let r;t.start+=this._dataAlreadySent.length,this._isComposing?r=this._textarea.value.substring(t.start,this._compositionPosition.start):r=this._textarea.value.substring(t.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,r=t.replace(e,"");this._dataAlreadySent=r,t.length>e.length?this._coreService.triggerDataEvent(r,!0):t.length<e.length?this._coreService.triggerDataEvent(`${G.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,o=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=o+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let a=this._compositionView.getBoundingClientRect();this._textarea.style.left=o+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(a.width,1)+"px",this._textarea.style.height=Math.max(a.height,1)+"px",this._textarea.style.lineHeight=a.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};zg=gt([fe(2,ur),fe(3,dr),fe(4,zn),fe(5,ns)],zg);var Ft=0,$t=0,At=0,ft=0,M1={css:"#00000000",rgba:0},Ct;(e=>{function t(o,a,c,u){return u!==void 0?`#${vn(o)}${vn(a)}${vn(c)}${vn(u)}`:`#${vn(o)}${vn(a)}${vn(c)}`}e.toCss=t;function r(o,a,c,u=255){return(o<<24|a<<16|c<<8|u)>>>0}e.toRgba=r;function i(o,a,c,u){return{css:e.toCss(o,a,c,u),rgba:e.toRgba(o,a,c,u)}}e.toColor=i})(Ct||(Ct={}));var Xe;(e=>{function t(p,f){if(ft=(f.rgba&255)/255,ft===1)return{css:f.css,rgba:f.rgba};let g=f.rgba>>24&255,_=f.rgba>>16&255,y=f.rgba>>8&255,x=p.rgba>>24&255,S=p.rgba>>16&255,w=p.rgba>>8&255;Ft=x+Math.round((g-x)*ft),$t=S+Math.round((_-S)*ft),At=w+Math.round((y-w)*ft);let C=Ct.toCss(Ft,$t,At),E=Ct.toRgba(Ft,$t,At);return{css:C,rgba:E}}e.blend=t;function r(p){return(p.rgba&255)===255}e.isOpaque=r;function i(p,f,g){let _=Ih.ensureContrastRatio(p.rgba,f.rgba,g);if(_)return Ct.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=i;function o(p){let f=(p.rgba|255)>>>0;return[Ft,$t,At]=Ih.toChannels(f),{css:Ct.toCss(Ft,$t,At),rgba:f}}e.opaque=o;function a(p,f){return ft=Math.round(f*255),[Ft,$t,At]=Ih.toChannels(p.rgba),{css:Ct.toCss(Ft,$t,At,ft),rgba:Ct.toRgba(Ft,$t,At,ft)}}e.opacity=a;function c(p,f){return ft=p.rgba&255,a(p,ft*f/255)}e.multiplyOpacity=c;function u(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=u})(Xe||(Xe={}));var at;(e=>{let t,r;try{let o=document.createElement("canvas");o.width=1,o.height=1;let a=o.getContext("2d",{willReadFrequently:!0});a&&(t=a,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function i(o){if(o.match(/#[\da-f]{3,8}/i))switch(o.length){case 4:return Ft=parseInt(o.slice(1,2).repeat(2),16),$t=parseInt(o.slice(2,3).repeat(2),16),At=parseInt(o.slice(3,4).repeat(2),16),Ct.toColor(Ft,$t,At);case 5:return Ft=parseInt(o.slice(1,2).repeat(2),16),$t=parseInt(o.slice(2,3).repeat(2),16),At=parseInt(o.slice(3,4).repeat(2),16),ft=parseInt(o.slice(4,5).repeat(2),16),Ct.toColor(Ft,$t,At,ft);case 7:return{css:o,rgba:(parseInt(o.slice(1),16)<<8|255)>>>0};case 9:return{css:o,rgba:parseInt(o.slice(1),16)>>>0}}let a=o.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(a)return Ft=parseInt(a[1]),$t=parseInt(a[2]),At=parseInt(a[3]),ft=Math.round((a[5]===void 0?1:parseFloat(a[5]))*255),Ct.toColor(Ft,$t,At,ft);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=o,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Ft,$t,At,ft]=t.getImageData(0,0,1,1).data,ft!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ct.toRgba(Ft,$t,At,ft),css:o}}e.toColor=i})(at||(at={}));var ar;(e=>{function t(i){return r(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function r(i,o,a){let c=i/255,u=o/255,p=a/255,f=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),g=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),_=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return f*.2126+g*.7152+_*.0722}e.relativeLuminance2=r})(ar||(ar={}));var Ih;(e=>{function t(c,u){if(ft=(u&255)/255,ft===1)return u;let p=u>>24&255,f=u>>16&255,g=u>>8&255,_=c>>24&255,y=c>>16&255,x=c>>8&255;return Ft=_+Math.round((p-_)*ft),$t=y+Math.round((f-y)*ft),At=x+Math.round((g-x)*ft),Ct.toRgba(Ft,$t,At)}e.blend=t;function r(c,u,p){let f=ar.relativeLuminance(c>>8),g=ar.relativeLuminance(u>>8);if(Wi(f,g)<p){if(g<f){let x=i(c,u,p),S=Wi(f,ar.relativeLuminance(x>>8));if(S<p){let w=o(c,u,p),C=Wi(f,ar.relativeLuminance(w>>8));return S>C?x:w}return x}let _=o(c,u,p),y=Wi(f,ar.relativeLuminance(_>>8));if(y<p){let x=i(c,u,p),S=Wi(f,ar.relativeLuminance(x>>8));return y>S?_:x}return _}}e.ensureContrastRatio=r;function i(c,u,p){let f=c>>24&255,g=c>>16&255,_=c>>8&255,y=u>>24&255,x=u>>16&255,S=u>>8&255,w=Wi(ar.relativeLuminance2(y,x,S),ar.relativeLuminance2(f,g,_));for(;w<p&&(y>0||x>0||S>0);)y-=Math.max(0,Math.ceil(y*.1)),x-=Math.max(0,Math.ceil(x*.1)),S-=Math.max(0,Math.ceil(S*.1)),w=Wi(ar.relativeLuminance2(y,x,S),ar.relativeLuminance2(f,g,_));return(y<<24|x<<16|S<<8|255)>>>0}e.reduceLuminance=i;function o(c,u,p){let f=c>>24&255,g=c>>16&255,_=c>>8&255,y=u>>24&255,x=u>>16&255,S=u>>8&255,w=Wi(ar.relativeLuminance2(y,x,S),ar.relativeLuminance2(f,g,_));for(;w<p&&(y<255||x<255||S<255);)y=Math.min(255,y+Math.ceil((255-y)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),w=Wi(ar.relativeLuminance2(y,x,S),ar.relativeLuminance2(f,g,_));return(y<<24|x<<16|S<<8|255)>>>0}e.increaseLuminance=o;function a(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=a})(Ih||(Ih={}));function vn(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Wi(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var zT=class extends Vl{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}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()]}},fu=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Vr}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let r=[],i=t.translateToString(!0),o=0,a=0,c=0,u=t.getFg(0),p=t.getBg(0);for(let f=0;f<t.getTrimmedLength();f++)if(t.loadCell(f,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==u||this._workCell.bg!==p){if(f-o>1){let g=this._getJoinedRanges(i,c,a,t,o);for(let _=0;_<g.length;_++)r.push(g[_])}o=f,c=a,u=this._workCell.fg,p=this._workCell.bg}a+=this._workCell.getChars().length||Qs.length}if(this._bufferService.cols-o>1){let f=this._getJoinedRanges(i,c,a,t,o);for(let g=0;g<f.length;g++)r.push(f[g])}return r}_getJoinedRanges(e,t,r,i,o){let a=e.substring(t,r),c=[];try{c=this._characterJoiners[0].handler(a)}catch(u){console.error(u)}for(let u=1;u<this._characterJoiners.length;u++)try{let p=this._characterJoiners[u].handler(a);for(let f=0;f<p.length;f++)fu._mergeRanges(c,p[f])}catch(p){console.error(p)}return this._stringRangesToCellRanges(c,i,o),c}_stringRangesToCellRanges(e,t,r){let i=0,o=!1,a=0,c=e[i];if(c){for(let u=r;u<this._bufferService.cols;u++){let p=t.getWidth(u),f=t.getString(u).length||Qs.length;if(p!==0){if(!o&&c[0]<=a&&(c[0]=u,o=!0),c[1]<=a){if(c[1]=u,c=e[++i],!c)break;c[0]<=a?(c[0]=u,o=!0):o=!1}a+=f}}c&&(c[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(r){if(t[1]<=o[0])return e[i-1][1]=t[1],e;if(t[1]<=o[1])return e[i-1][1]=Math.max(t[1],o[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(t[1]<=o[0])return e.splice(i,0,t),e;if(t[1]<=o[1])return o[0]=Math.min(t[0],o[0]),e;t[0]<o[1]&&(o[0]=Math.min(t[0],o[0]),r=!0);continue}}return r?e[e.length-1][1]=t[1]:e.push(t),e}};fu=gt([fe(0,ur)],fu);function WT(e){return 57508<=e&&e<=57558}function HT(e){return 9472<=e&&e<=9631}function UT(e){return WT(e)||HT(e)}function KT(){return{css:{canvas:xh(),cell:xh()},device:{canvas:xh(),cell:xh(),char:{width:0,height:0,left:0,top:0}}}}function xh(){return{width:0,height:0}}var Wg=class{constructor(e,t,r,i,o,a,c){this._document=e,this._characterJoinerService=t,this._optionsService=r,this._coreBrowserService=i,this._coreService=o,this._decorationService=a,this._themeService=c,this._workCell=new Vr,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,r){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=r}createRow(e,t,r,i,o,a,c,u,p,f,g){let _=[],y=this._characterJoinerService.getJoinedCharacters(t),x=this._themeService.colors,S=e.getNoBgTrimmedLength();r&&S<a+1&&(S=a+1);let w,C=0,E="",I=0,k=0,R=0,M=0,F=!1,W=0,H=!1,K=0,ie=0,oe=[],Q=f!==-1&&g!==-1;for(let N=0;N<S;N++){e.loadCell(N,this._workCell);let q=this._workCell.getWidth();if(q===0)continue;let Y=!1,re=N>=ie,le=N,$=this._workCell;if(y.length>0&&N===y[0][0]&&re){let Ae=y.shift(),Ti=this._isCellInSelection(Ae[0],t);for(I=Ae[0]+1;I<Ae[1];I++)re&&(re=Ti===this._isCellInSelection(I,t));re&&(re=!r||a<Ae[0]||a>=Ae[1]),re?(Y=!0,$=new zT(this._workCell,e.translateToString(!0,Ae[0],Ae[1]),Ae[1]-Ae[0]),le=Ae[1]-1,q=$.getWidth()):ie=Ae[1]}let Z=this._isCellInSelection(N,t),ee=r&&N===a,D=Q&&N>=f&&N<=g,V=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,Ae=>{V=!0});let ge=$.getChars()||Qs;if(ge===" "&&($.isUnderline()||$.isOverline())&&(ge=" "),K=q*u-p.get(ge,$.isBold(),$.isItalic()),!w)w=this._document.createElement("span");else if(C&&(Z&&H||!Z&&!H&&$.bg===k)&&(Z&&H&&x.selectionForeground||$.fg===R)&&$.extended.ext===M&&D===F&&K===W&&!ee&&!Y&&!V&&re){$.isInvisible()?E+=Qs:E+=ge,C++;continue}else C&&(w.textContent=E),w=this._document.createElement("span"),C=0,E="";if(k=$.bg,R=$.fg,M=$.extended.ext,F=D,W=K,H=Z,Y&&a>=N&&a<=le&&(a=N),!this._coreService.isCursorHidden&&ee&&this._coreService.isCursorInitialized){if(oe.push("xterm-cursor"),this._coreBrowserService.isFocused)c&&oe.push("xterm-cursor-blink"),oe.push(i==="bar"?"xterm-cursor-bar":i==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(o)switch(o){case"outline":oe.push("xterm-cursor-outline");break;case"block":oe.push("xterm-cursor-block");break;case"bar":oe.push("xterm-cursor-bar");break;case"underline":oe.push("xterm-cursor-underline");break}}if($.isBold()&&oe.push("xterm-bold"),$.isItalic()&&oe.push("xterm-italic"),$.isDim()&&oe.push("xterm-dim"),$.isInvisible()?E=Qs:E=$.getChars()||Qs,$.isUnderline()&&(oe.push(`xterm-underline-${$.extended.underlineStyle}`),E===" "&&(E=" "),!$.isUnderlineColorDefault()))if($.isUnderlineColorRGB())w.style.textDecorationColor=`rgb(${Vl.toColorRGB($.getUnderlineColor()).join(",")})`;else{let Ae=$.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&$.isBold()&&Ae<8&&(Ae+=8),w.style.textDecorationColor=x.ansi[Ae].css}$.isOverline()&&(oe.push("xterm-overline"),E===" "&&(E=" ")),$.isStrikethrough()&&oe.push("xterm-strikethrough"),D&&(w.style.textDecoration="underline");let _e=$.getFgColor(),we=$.getFgColorMode(),Ce=$.getBgColor(),De=$.getBgColorMode(),je=!!$.isInverse();if(je){let Ae=_e;_e=Ce,Ce=Ae;let Ti=we;we=De,De=Ti}let Le,it,Mr=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,Ae=>{Ae.options.layer!=="top"&&Mr||(Ae.backgroundColorRGB&&(De=50331648,Ce=Ae.backgroundColorRGB.rgba>>8&16777215,Le=Ae.backgroundColorRGB),Ae.foregroundColorRGB&&(we=50331648,_e=Ae.foregroundColorRGB.rgba>>8&16777215,it=Ae.foregroundColorRGB),Mr=Ae.options.layer==="top")}),!Mr&&Z&&(Le=this._coreBrowserService.isFocused?x.selectionBackgroundOpaque:x.selectionInactiveBackgroundOpaque,Ce=Le.rgba>>8&16777215,De=50331648,Mr=!0,x.selectionForeground&&(we=50331648,_e=x.selectionForeground.rgba>>8&16777215,it=x.selectionForeground)),Mr&&oe.push("xterm-decoration-top");let xt;switch(De){case 16777216:case 33554432:xt=x.ansi[Ce],oe.push(`xterm-bg-${Ce}`);break;case 50331648:xt=Ct.toColor(Ce>>16,Ce>>8&255,Ce&255),this._addStyle(w,`background-color:#${D1((Ce>>>0).toString(16),"0",6)}`);break;case 0:default:je?(xt=x.foreground,oe.push("xterm-bg-257")):xt=x.background}switch(Le||$.isDim()&&(Le=Xe.multiplyOpacity(xt,.5)),we){case 16777216:case 33554432:$.isBold()&&_e<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(_e+=8),this._applyMinimumContrast(w,xt,x.ansi[_e],$,Le,void 0)||oe.push(`xterm-fg-${_e}`);break;case 50331648:let Ae=Ct.toColor(_e>>16&255,_e>>8&255,_e&255);this._applyMinimumContrast(w,xt,Ae,$,Le,it)||this._addStyle(w,`color:#${D1(_e.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(w,xt,x.foreground,$,Le,it)||je&&oe.push("xterm-fg-257")}oe.length&&(w.className=oe.join(" "),oe.length=0),!ee&&!Y&&!V&&re?C++:w.textContent=E,K!==this.defaultSpacing&&(w.style.letterSpacing=`${K}px`),_.push(w),N=le}return w&&C&&(w.textContent=E),_}_applyMinimumContrast(e,t,r,i,o,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||UT(i.getCode()))return!1;let c=this._getContrastCache(i),u;if(!o&&!a&&(u=c.getColor(t.rgba,r.rgba)),u===void 0){let p=this._optionsService.rawOptions.minimumContrastRatio/(i.isDim()?2:1);u=Xe.ensureContrastRatio(o||t,a||r,p),c.setColor((o||t).rgba,(a||r).rgba,u??null)}return u?(this._addStyle(e,`color:${u.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let r=this._selectionStart,i=this._selectionEnd;return!r||!i?!1:this._columnSelectMode?r[0]<=i[0]?e>=r[0]&&t>=r[1]&&e<i[0]&&t<=i[1]:e<r[0]&&t>=r[1]&&e>=i[0]&&t<=i[1]:t>r[1]&&t<i[1]||r[1]===i[1]&&t===r[1]&&e>=r[0]&&e<i[0]||r[1]<i[1]&&t===i[1]&&e<i[0]||r[1]<i[1]&&t===r[1]&&e>=r[0]}};Wg=gt([fe(1,Lb),fe(2,dr),fe(3,ss),fe(4,zn),fe(5,Ql),fe(6,ia)],Wg);function D1(e,t,r){for(;e.length<r;)e=t+e;return e}var qT=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 r=e.createElement("span");r.classList.add("xterm-char-measure-element");let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontWeight="bold";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontStyle="italic";let a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontWeight="bold",a.style.fontStyle="italic",this._measureElements=[r,i,o,a],this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(o),this._container.appendChild(a),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,r,i){e===this._font&&t===this._fontSize&&r===this._weight&&i===this._weightBold||(this._font=e,this._fontSize=t,this._weight=r,this._weightBold=i,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${i}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${i}`,this.clear())}get(e,t,r){let i=0;if(!t&&!r&&e.length===1&&(i=e.charCodeAt(0))<256){if(this._flat[i]!==-9999)return this._flat[i];let c=this._measure(e,0);return c>0&&(this._flat[i]=c),c}let o=e;t&&(o+="B"),r&&(o+="I");let a=this._holey.get(o);if(a===void 0){let c=0;t&&(c|=1),r&&(c|=2),a=this._measure(e,c),a>0&&this._holey.set(o,a)}return a}_measure(e,t){let r=this._measureElements[t];return r.textContent=e.repeat(32),r.offsetWidth/32}},VT=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,r,i=!1){if(this.selectionStart=t,this.selectionEnd=r,!t||!r||t[0]===r[0]&&t[1]===r[1]){this.clear();return}let o=e.buffers.active.ydisp,a=t[1]-o,c=r[1]-o,u=Math.max(a,0),p=Math.min(c,e.rows-1);if(u>=e.rows||p<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=a,this.viewportEndRow=c,this.viewportCappedStartRow=u,this.viewportCappedEndRow=p,this.startCol=t[0],this.endCol=r[0]}isCellSelected(e,t,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&r>=this.viewportCappedStartRow&&t<this.endCol&&r<=this.viewportCappedEndRow:t<this.startCol&&r>=this.viewportCappedStartRow&&t>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol):!1}};function QT(){return new VT}var op="xterm-dom-renderer-owner-",Nr="xterm-rows",Sh="xterm-fg-",B1="xterm-bg-",il="xterm-focus",bh="xterm-selection",GT=1,Hg=class extends Ie{constructor(e,t,r,i,o,a,c,u,p,f,g,_,y,x){super(),this._terminal=e,this._document=t,this._element=r,this._screenElement=i,this._viewportElement=o,this._helperContainer=a,this._linkifier2=c,this._charSizeService=p,this._optionsService=f,this._bufferService=g,this._coreService=_,this._coreBrowserService=y,this._themeService=x,this._terminalClass=GT++,this._rowElements=[],this._selectionRenderModel=QT(),this.onRequestRedraw=this._register(new ae).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Nr),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(bh),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=KT(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(S=>this._injectCss(S))),this._injectCss(this._themeService.colors),this._rowFactory=u.createInstance(Wg,document),this._element.classList.add(op+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(S=>this._handleLinkHover(S))),this._register(this._linkifier2.onHideLinkUnderline(S=>this._handleLinkLeave(S))),this._register(rt(()=>{this._element.classList.remove(op+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new qT(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 r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Nr} 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} .${Nr} { 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} .${Nr} .xterm-dim { color: ${Xe.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 r=`blink_underline_${this._terminalClass}`,i=`blink_bar_${this._terminalClass}`,o=`blink_block_${this._terminalClass}`;t+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${i} { 50% { box-shadow: none; }}`,t+=`@keyframes ${o} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Nr}.${il} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Nr}.${il} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Nr}.${il} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${o} 1s step-end infinite;}${this._terminalSelector} .${Nr} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Nr} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Nr} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Nr} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Nr} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${bh} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${bh} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${bh} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[a,c]of e.ansi.entries())t+=`${this._terminalSelector} .${Sh}${a} { color: ${c.css}; }${this._terminalSelector} .${Sh}${a}.xterm-dim { color: ${Xe.multiplyOpacity(c,.5).css}; }${this._terminalSelector} .${B1}${a} { background-color: ${c.css}; }`;t+=`${this._terminalSelector} .${Sh}257 { color: ${Xe.opaque(e.background).css}; }${this._terminalSelector} .${Sh}257.xterm-dim { color: ${Xe.multiplyOpacity(Xe.opaque(e.background),.5).css}; }${this._terminalSelector} .${B1}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 r=this._rowElements.length;r<=t;r++){let i=this._document.createElement("div");this._rowContainer.appendChild(i),this._rowElements.push(i)}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(il),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(il),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,r),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,r),!this._selectionRenderModel.hasSelection))return;let i=this._selectionRenderModel.viewportStartRow,o=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,c=this._selectionRenderModel.viewportCappedEndRow,u=this._document.createDocumentFragment();if(r){let p=e[0]>t[0];u.appendChild(this._createSelectionElement(a,p?t[0]:e[0],p?e[0]:t[0],c-a+1))}else{let p=i===a?e[0]:0,f=a===o?t[0]:this._bufferService.cols;u.appendChild(this._createSelectionElement(a,p,f));let g=c-a-1;if(u.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,g)),a!==c){let _=o===c?t[0]:this._bufferService.cols;u.appendChild(this._createSelectionElement(c,0,_))}}this._selectionContainer.appendChild(u)}_createSelectionElement(e,t,r,i=1){let o=this._document.createElement("div"),a=t*this.dimensions.css.cell.width,c=this.dimensions.css.cell.width*(r-t);return a+c>this.dimensions.css.canvas.width&&(c=this.dimensions.css.canvas.width-a),o.style.height=`${i*this.dimensions.css.cell.height}px`,o.style.top=`${e*this.dimensions.css.cell.height}px`,o.style.left=`${a}px`,o.style.width=`${c}px`,o}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 r=this._bufferService.buffer,i=r.ybase+r.y,o=Math.min(r.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,c=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,u=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=e;p<=t;p++){let f=p+r.ydisp,g=this._rowElements[p],_=r.lines.get(f);if(!g||!_)break;g.replaceChildren(...this._rowFactory.createRow(_,f,f===i,c,u,o,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${op}${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,r,i,o,a){r<0&&(e=0),i<0&&(t=0);let c=this._bufferService.rows-1;r=Math.max(Math.min(r,c),0),i=Math.max(Math.min(i,c),0),o=Math.min(o,this._bufferService.cols);let u=this._bufferService.buffer,p=u.ybase+u.y,f=Math.min(u.x,o-1),g=this._optionsService.rawOptions.cursorBlink,_=this._optionsService.rawOptions.cursorStyle,y=this._optionsService.rawOptions.cursorInactiveStyle;for(let x=r;x<=i;++x){let S=x+u.ydisp,w=this._rowElements[x],C=u.lines.get(S);if(!w||!C)break;w.replaceChildren(...this._rowFactory.createRow(C,S,S===p,_,y,f,g,this.dimensions.css.cell.width,this._widthCache,a?x===r?e:0:-1,a?(x===i?t:o)-1:-1))}}};Hg=gt([fe(7,jv),fe(8,Eu),fe(9,dr),fe(10,ur),fe(11,zn),fe(12,ss),fe(13,ia)],Hg);var Ug=class extends Ie{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ae),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new XT(this._optionsService))}catch{this._measureStrategy=this._register(new YT(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())}};Ug=gt([fe(2,dr)],Ug);var Yb=class extends Ie{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},YT=class extends Yb{constructor(e,t,r){super(),this._document=e,this._parentElement=t,this._optionsService=r,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}},XT=class extends Yb{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}},JT=class extends Ie{constructor(e,t,r){super(),this._textarea=e,this._window=t,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new ZT(this._window)),this._onDprChange=this._register(new ae),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ae),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register(Vt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Re(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Re(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},ZT=class extends Ie{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Jo),this._onDprChange=this._register(new ae),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(rt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Re(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},e3=class extends Ie{constructor(){super(),this.linkProviders=[],this._register(rt(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function Fv(e,t,r){let i=r.getBoundingClientRect(),o=e.getComputedStyle(r),a=parseInt(o.getPropertyValue("padding-left")),c=parseInt(o.getPropertyValue("padding-top"));return[t.clientX-i.left-a,t.clientY-i.top-c]}function t3(e,t,r,i,o,a,c,u,p){if(!a)return;let f=Fv(e,t,r);if(f)return f[0]=Math.ceil((f[0]+(p?c/2:0))/c),f[1]=Math.ceil(f[1]/u),f[0]=Math.min(Math.max(f[0],1),i+(p?1:0)),f[1]=Math.min(Math.max(f[1],1),o),f}var Kg=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,i,o){return t3(window,e,t,r,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,o)}getMouseReportCoords(e,t){let r=Fv(window,e,t);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};Kg=gt([fe(0,ns),fe(1,Eu)],Kg);var r3=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,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},Xb={};dj(Xb,{getSafariVersion:()=>s3,isChromeOS:()=>tw,isFirefox:()=>Jb,isIpad:()=>n3,isIphone:()=>o3,isLegacyEdge:()=>i3,isLinux:()=>$v,isMac:()=>pu,isNode:()=>Pu,isSafari:()=>Zb,isWindows:()=>ew});var Pu=typeof process<"u"&&"title"in process,Gl=Pu?"node":navigator.userAgent,Yl=Pu?"node":navigator.platform,Jb=Gl.includes("Firefox"),i3=Gl.includes("Edge"),Zb=/^((?!chrome|android).)*safari/i.test(Gl);function s3(){if(!Zb)return 0;let e=Gl.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var pu=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Yl),n3=Yl==="iPad",o3=Yl==="iPhone",ew=["Windows","Win16","Win32","WinCE"].includes(Yl),$v=Yl.indexOf("Linux")>=0,tw=/\bCrOS\b/.test(Gl),rw=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,r=0,i=e.timeRemaining(),o=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),o=e.timeRemaining(),r*1.5>o){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=o}this.clear()}},a3=class extends rw{_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())}}},l3=class extends rw{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},gu=!Pu&&"requestIdleCallback"in window?l3:a3,c3=class{constructor(){this._queue=new gu}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},qg=class extends Ie{constructor(e,t,r,i,o,a,c,u,p){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=i,this._coreService=o,this._coreBrowserService=u,this._renderer=this._register(new Jo),this._pausedResizeTask=new c3,this._observerDisposable=this._register(new Jo),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 ae),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ae),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ae),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ae),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new r3((f,g)=>this._renderRows(f,g),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new h3(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(rt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(c.onResize(()=>this._fullRefresh())),this._register(c.buffers.onBufferActivate(()=>{var f;return(f=this._renderer.value)==null?void 0:f.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(c.cols,c.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(c.buffer.y,c.buffer.y,!0))),this._register(p.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(f=>this._registerIntersectionObserver(f,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(i=>this._handleIntersectionChange(i[i.length-1]),{threshold:0});r.observe(t),this._observerDisposable.value=rt(()=>r.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let i=this._syncOutputHandler.flush();i&&(e=Math.min(e,i.start),t=Math.max(t,i.end)),r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var r;return(r=this._renderer.value)==null?void 0:r.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,r){var i;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,(i=this._renderer.value)==null||i.handleSelectionChanged(e,t,r)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};qg=gt([fe(2,dr),fe(3,Eu),fe(4,zn),fe(5,Ql),fe(6,ur),fe(7,ss),fe(8,ia)],qg);var h3=class{constructor(e,t,r){this._coreBrowserService=e,this._coreService=t,this._onTimeout=r,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function u3(e,t,r,i){let o=r.buffer.x,a=r.buffer.y;if(!r.buffer.hasScrollback)return p3(o,a,e,t,r,i)+Ru(a,t,r,i)+g3(o,a,e,t,r,i);let c;if(a===t)return c=o>e?"D":"C",Nl(Math.abs(o-e),Al(c,i));c=a>t?"D":"C";let u=Math.abs(a-t),p=f3(a>t?e:o,r)+(u-1)*r.cols+1+d3(a>t?o:e);return Nl(p,Al(c,i))}function d3(e,t){return e-1}function f3(e,t){return t.cols-e}function p3(e,t,r,i,o,a){return Ru(t,i,o,a).length===0?"":Nl(sw(e,t,e,t-Nn(t,o),!1,o).length,Al("D",a))}function Ru(e,t,r,i){let o=e-Nn(e,r),a=t-Nn(t,r),c=Math.abs(o-a)-v3(e,t,r);return Nl(c,Al(iw(e,t),i))}function g3(e,t,r,i,o,a){let c;Ru(t,i,o,a).length>0?c=i-Nn(i,o):c=t;let u=i,p=_3(e,t,r,i,o,a);return Nl(sw(e,c,r,u,p==="C",o).length,Al(p,a))}function v3(e,t,r){var c;let i=0,o=e-Nn(e,r),a=t-Nn(t,r);for(let u=0;u<Math.abs(o-a);u++){let p=iw(e,t)==="A"?-1:1;(c=r.buffer.lines.get(o+p*u))!=null&&c.isWrapped&&i++}return i}function Nn(e,t){let r=0,i=t.buffer.lines.get(e),o=i==null?void 0:i.isWrapped;for(;o&&e>=0&&e<t.rows;)r++,i=t.buffer.lines.get(--e),o=i==null?void 0:i.isWrapped;return r}function _3(e,t,r,i,o,a){let c;return Ru(r,i,o,a).length>0?c=i-Nn(i,o):c=t,e<r&&c<=i||e>=r&&c<i?"C":"D"}function iw(e,t){return e>t?"A":"B"}function sw(e,t,r,i,o,a){let c=e,u=t,p="";for(;(c!==r||u!==i)&&u>=0&&u<a.buffer.lines.length;)c+=o?1:-1,o&&c>a.cols-1?(p+=a.buffer.translateBufferLineToString(u,!1,e,c),c=0,e=0,u++):!o&&c<0&&(p+=a.buffer.translateBufferLineToString(u,!1,0,e+1),c=a.cols-1,e=c,u--);return p+a.buffer.translateBufferLineToString(u,!1,e,c)}function Al(e,t){let r=t?"O":"[";return G.ESC+r+e}function Nl(e,t){e=Math.floor(e);let r="";for(let i=0;i<e;i++)r+=t;return r}var m3=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function I1(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 ap=50,y3=15,x3=50,S3=500,b3=" ",w3=new RegExp(b3,"g"),Vg=class extends Ie{constructor(e,t,r,i,o,a,c,u,p){super(),this._element=e,this._screenElement=t,this._linkifier=r,this._bufferService=i,this._coreService=o,this._mouseService=a,this._optionsService=c,this._renderService=u,this._coreBrowserService=p,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Vr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ae),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ae),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ae),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ae),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=f=>this._handleMouseMove(f),this._mouseUpListener=f=>this._handleMouseUp(f),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(f=>this._handleTrim(f)),this._register(this._bufferService.buffers.onBufferActivate(f=>this._handleBufferActivate(f))),this.enable(),this._model=new m3(this._bufferService),this._activeSelectionMode=0,this._register(rt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(f=>{f.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let r=this._bufferService.buffer,i=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let o=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let c=e[1];c<=t[1];c++){let u=r.translateBufferLineToString(c,!0,o,a);i.push(u)}}else{let o=e[1]===t[1]?t[0]:void 0;i.push(r.translateBufferLineToString(e[1],!0,e[0],o));for(let a=e[1]+1;a<=t[1]-1;a++){let c=r.lines.get(a),u=r.translateBufferLineToString(a,!0);c!=null&&c.isWrapped?i[i.length-1]+=u:i.push(u)}if(e[1]!==t[1]){let a=r.lines.get(t[1]),c=r.translateBufferLineToString(t[1],!0,0,t[0]);a&&a.isWrapped?i[i.length-1]+=c:i.push(c)}}return i.map(o=>o.replace(w3," ")).join(ew?`\r-`:`-`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),$v&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!r||!i||!t?!1:this._areCoordsInSelection(t,r,i)}isCellInSelection(e,t){let r=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!r||!i?!1:this._areCoordsInSelection([e,t],r,i)}_areCoordsInSelection(e,t,r){return e[1]>t[1]&&e[1]<r[1]||t[1]===r[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<r[0]||t[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||t[1]<r[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var o,a;let r=(a=(o=this._linkifier.currentLink)==null?void 0:o.link)==null?void 0:a.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=I1(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let i=this._getMouseBufferCoords(e);return i?(this._selectWordAt(i,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=Fv(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=r?0:(t>r&&(t-=r),t=Math.min(Math.max(t,-ap),ap),t/=ap,t/Math.abs(t)+Math.round(t*(y3-1)))}shouldForceSelection(e){return pu?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),x3)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(pu&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let r=this._bufferService.buffer;if(this._model.selectionEnd[1]<r.lines.length){let i=r.lines.get(this._model.selectionEnd[1]);i&&i.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<S3&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let r=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(r&&r[0]!==void 0&&r[1]!==void 0){let i=u3(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(i,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,r=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,t,r);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,r)}_fireOnSelectionChange(e,t,r){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let r=t;for(let i=0;t>=i;i++){let o=e.loadCell(i,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:o>1&&t!==i&&(r+=o-1)}return r}setSelection(e,t,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,r=!0,i=!0){if(e[0]>=this._bufferService.cols)return;let o=this._bufferService.buffer,a=o.lines.get(e[1]);if(!a)return;let c=o.translateBufferLineToString(e[1],!1),u=this._convertViewportColToCharacterIndex(a,e[0]),p=u,f=e[0]-u,g=0,_=0,y=0,x=0;if(c.charAt(u)===" "){for(;u>0&&c.charAt(u-1)===" ";)u--;for(;p<c.length&&c.charAt(p+1)===" ";)p++}else{let C=e[0],E=e[0];a.getWidth(C)===0&&(g++,C--),a.getWidth(E)===2&&(_++,E++);let I=a.getString(E).length;for(I>1&&(x+=I-1,p+=I-1);C>0&&u>0&&!this._isCharWordSeparator(a.loadCell(C-1,this._workCell));){a.loadCell(C-1,this._workCell);let k=this._workCell.getChars().length;this._workCell.getWidth()===0?(g++,C--):k>1&&(y+=k-1,u-=k-1),u--,C--}for(;E<a.length&&p+1<c.length&&!this._isCharWordSeparator(a.loadCell(E+1,this._workCell));){a.loadCell(E+1,this._workCell);let k=this._workCell.getChars().length;this._workCell.getWidth()===2?(_++,E++):k>1&&(x+=k-1,p+=k-1),p++,E++}}p++;let S=u+f-g+y,w=Math.min(this._bufferService.cols,p-u+g+_-y-x);if(!(!t&&c.slice(u,p).trim()==="")){if(r&&S===0&&a.getCodePoint(0)!==32){let C=o.lines.get(e[1]-1);if(C&&a.isWrapped&&C.getCodePoint(this._bufferService.cols-1)!==32){let E=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(E){let I=this._bufferService.cols-E.start;S-=I,w+=I}}}if(i&&S+w===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let C=o.lines.get(e[1]+1);if(C!=null&&C.isWrapped&&C.getCodePoint(0)!==32){let E=this._getWordAt([0,e[1]+1],!1,!1,!0);E&&(w+=E.length)}}return{start:S,length:w}}}_selectWordAt(e,t){let r=this._getWordAt(e,t);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let r=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),r={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=I1(r,this._bufferService.cols)}};Vg=gt([fe(3,ur),fe(4,zn),fe(5,Tv),fe(6,dr),fe(7,ns),fe(8,ss)],Vg);var O1=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},F1=class{constructor(){this._color=new O1,this._css=new O1}setCss(e,t,r){this._css.set(e,t,r)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,r){this._color.set(e,t,r)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Pt=Object.freeze((()=>{let e=[at.toColor("#2e3436"),at.toColor("#cc0000"),at.toColor("#4e9a06"),at.toColor("#c4a000"),at.toColor("#3465a4"),at.toColor("#75507b"),at.toColor("#06989a"),at.toColor("#d3d7cf"),at.toColor("#555753"),at.toColor("#ef2929"),at.toColor("#8ae234"),at.toColor("#fce94f"),at.toColor("#729fcf"),at.toColor("#ad7fa8"),at.toColor("#34e2e2"),at.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let i=t[r/36%6|0],o=t[r/6%6|0],a=t[r%6];e.push({css:Ct.toCss(i,o,a),rgba:Ct.toRgba(i,o,a)})}for(let r=0;r<24;r++){let i=8+r*10;e.push({css:Ct.toCss(i,i,i),rgba:Ct.toRgba(i,i,i)})}return e})()),xn=at.toColor("#ffffff"),ml=at.toColor("#000000"),$1=at.toColor("#ffffff"),A1=ml,sl={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},C3=xn,Qg=class extends Ie{constructor(e){super(),this._optionsService=e,this._contrastCache=new F1,this._halfContrastCache=new F1,this._onChangeColors=this._register(new ae),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:xn,background:ml,cursor:$1,cursorAccent:A1,selectionForeground:void 0,selectionBackgroundTransparent:sl,selectionBackgroundOpaque:Xe.blend(ml,sl),selectionInactiveBackgroundTransparent:sl,selectionInactiveBackgroundOpaque:Xe.blend(ml,sl),scrollbarSliderBackground:Xe.opacity(xn,.2),scrollbarSliderHoverBackground:Xe.opacity(xn,.4),scrollbarSliderActiveBackground:Xe.opacity(xn,.5),overviewRulerBorder:xn,ansi:Pt.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=qe(e.foreground,xn),t.background=qe(e.background,ml),t.cursor=Xe.blend(t.background,qe(e.cursor,$1)),t.cursorAccent=Xe.blend(t.background,qe(e.cursorAccent,A1)),t.selectionBackgroundTransparent=qe(e.selectionBackground,sl),t.selectionBackgroundOpaque=Xe.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=qe(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Xe.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?qe(e.selectionForeground,M1):void 0,t.selectionForeground===M1&&(t.selectionForeground=void 0),Xe.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Xe.opacity(t.selectionBackgroundTransparent,.3)),Xe.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Xe.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=qe(e.scrollbarSliderBackground,Xe.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=qe(e.scrollbarSliderHoverBackground,Xe.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=qe(e.scrollbarSliderActiveBackground,Xe.opacity(t.foreground,.5)),t.overviewRulerBorder=qe(e.overviewRulerBorder,C3),t.ansi=Pt.slice(),t.ansi[0]=qe(e.black,Pt[0]),t.ansi[1]=qe(e.red,Pt[1]),t.ansi[2]=qe(e.green,Pt[2]),t.ansi[3]=qe(e.yellow,Pt[3]),t.ansi[4]=qe(e.blue,Pt[4]),t.ansi[5]=qe(e.magenta,Pt[5]),t.ansi[6]=qe(e.cyan,Pt[6]),t.ansi[7]=qe(e.white,Pt[7]),t.ansi[8]=qe(e.brightBlack,Pt[8]),t.ansi[9]=qe(e.brightRed,Pt[9]),t.ansi[10]=qe(e.brightGreen,Pt[10]),t.ansi[11]=qe(e.brightYellow,Pt[11]),t.ansi[12]=qe(e.brightBlue,Pt[12]),t.ansi[13]=qe(e.brightMagenta,Pt[13]),t.ansi[14]=qe(e.brightCyan,Pt[14]),t.ansi[15]=qe(e.brightWhite,Pt[15]),e.extendedAnsi){let r=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<r;i++)t.ansi[i+16]=qe(e.extendedAnsi[i],Pt[i+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};Qg=gt([fe(0,dr)],Qg);function qe(e,t){if(e!==void 0)try{return at.toColor(e)}catch{}return t}var k3=class{constructor(...e){this._entries=new Map;for(let[t,r]of e)this.set(t,r)}set(e,t){let r=this._entries.get(e);return this._entries.set(e,t),r}forEach(e){for(let[t,r]of this._entries.entries())e(t,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},E3=class{constructor(){this._services=new k3,this._services.set(jv,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let r=yj(e).sort((a,c)=>a.index-c.index),i=[];for(let a of r){let c=this._services.get(a.id);if(!c)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${a.id._id}.`);i.push(c)}let o=r.length>0?r[0].index:t.length;if(t.length!==o)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${o+1} conflicts with ${t.length} static arguments`);return new e(...t,...i)}},P3={trace:0,debug:1,info:2,warn:3,error:4,off:5},R3="xterm.js: ",Gg=class extends Ie{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=P3[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":R3)+t,...r)}trace(e,...t){var r;this._logLevel<=0&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var r;this._logLevel<=1&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var r;this._logLevel<=2&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var r;this._logLevel<=3&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var r;this._logLevel<=4&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.error.bind(this._optionsService.options.logger))??console.error,e,t)}};Gg=gt([fe(0,dr)],Gg);var N1=class extends Ie{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new ae),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ae),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ae),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 r=0;r<Math.min(e,this.length);r++)t[r]=this._array[this._getCyclicIndex(r)];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,...r){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 i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+r.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<r.length;i++)this._array[this._getCyclicIndex(e+i)]=r[i];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let i=this._length+r.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,r){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let o=t-1;o>=0;o--)this.set(e+o+r,this.get(e+o));let i=e+t+r-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<t;i++)this.set(e+i+r,this.get(e+i))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Be=3,bt=Object.freeze(new Vl),wh=0,lp=2,yl=class nw{constructor(t,r,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Be);let o=r||Vr.fromCharData([0,Cb,1,0]);for(let a=0;a<t;++a)this.setCell(a,o);this.length=t}get(t){let r=this._data[t*Be+0],i=r&2097151;return[this._data[t*Be+1],r&2097152?this._combined[t]:i?Bs(i):"",r>>22,r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i]}set(t,r){this._data[t*Be+1]=r[0],r[1].length>1?(this._combined[t]=r[1],this._data[t*Be+0]=t|2097152|r[2]<<22):this._data[t*Be+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(t){return this._data[t*Be+0]>>22}hasWidth(t){return this._data[t*Be+0]&12582912}getFg(t){return this._data[t*Be+1]}getBg(t){return this._data[t*Be+2]}hasContent(t){return this._data[t*Be+0]&4194303}getCodePoint(t){let r=this._data[t*Be+0];return r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r&2097151}isCombined(t){return this._data[t*Be+0]&2097152}getString(t){let r=this._data[t*Be+0];return r&2097152?this._combined[t]:r&2097151?Bs(r&2097151):""}isProtected(t){return this._data[t*Be+2]&536870912}loadCell(t,r){return wh=t*Be,r.content=this._data[wh+0],r.fg=this._data[wh+1],r.bg=this._data[wh+2],r.content&2097152&&(r.combinedData=this._combined[t]),r.bg&268435456&&(r.extended=this._extendedAttrs[t]),r}setCell(t,r){r.content&2097152&&(this._combined[t]=r.combinedData),r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*Be+0]=r.content,this._data[t*Be+1]=r.fg,this._data[t*Be+2]=r.bg}setCellFromCodepoint(t,r,i,o){o.bg&268435456&&(this._extendedAttrs[t]=o.extended),this._data[t*Be+0]=r|i<<22,this._data[t*Be+1]=o.fg,this._data[t*Be+2]=o.bg}addCodepointToCell(t,r,i){let o=this._data[t*Be+0];o&2097152?this._combined[t]+=Bs(r):o&2097151?(this._combined[t]=Bs(o&2097151)+Bs(r),o&=-2097152,o|=2097152):o=r|1<<22,i&&(o&=-12582913,o|=i<<22),this._data[t*Be+0]=o}insertCells(t,r,i){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),r<this.length-t){let o=new Vr;for(let a=this.length-t-r-1;a>=0;--a)this.setCell(t+r+a,this.loadCell(t+a,o));for(let a=0;a<r;++a)this.setCell(t+a,i)}else for(let o=t;o<this.length;++o)this.setCell(o,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(t,r,i){if(t%=this.length,r<this.length-t){let o=new Vr;for(let a=0;a<this.length-t-r;++a)this.setCell(t+a,this.loadCell(t+r+a,o));for(let a=this.length-r;a<this.length;++a)this.setCell(a,i)}else for(let o=t;o<this.length;++o)this.setCell(o,i);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,i)}replaceCells(t,r,i,o=!1){if(o){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,i);t<r&&t<this.length;)this.isProtected(t)||this.setCell(t,i),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,i);t<r&&t<this.length;)this.setCell(t++,i)}resize(t,r){if(t===this.length)return this._data.length*4*lp<this._data.buffer.byteLength;let i=t*Be;if(t>this.length){if(this._data.buffer.byteLength>=i*4)this._data=new Uint32Array(this._data.buffer,0,i);else{let o=new Uint32Array(i);o.set(this._data),this._data=o}for(let o=this.length;o<t;++o)this.setCell(o,r)}else{this._data=this._data.subarray(0,i);let o=Object.keys(this._combined);for(let c=0;c<o.length;c++){let u=parseInt(o[c],10);u>=t&&delete this._combined[u]}let a=Object.keys(this._extendedAttrs);for(let c=0;c<a.length;c++){let u=parseInt(a[c],10);u>=t&&delete this._extendedAttrs[u]}}return this.length=t,i*4*lp<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*lp<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,r=!1){if(r){for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,t);return}this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let r in t._combined)this._combined[r]=t._combined[r];this._extendedAttrs={};for(let r in t._extendedAttrs)this._extendedAttrs[r]=t._extendedAttrs[r];this.isWrapped=t.isWrapped}clone(){let t=new nw(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let r in this._combined)t._combined[r]=this._combined[r];for(let r in this._extendedAttrs)t._extendedAttrs[r]=this._extendedAttrs[r];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Be+0]&4194303)return t+(this._data[t*Be+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Be+0]&4194303||this._data[t*Be+2]&50331648)return t+(this._data[t*Be+0]>>22);return 0}copyCellsFrom(t,r,i,o,a){let c=t._data;if(a)for(let p=o-1;p>=0;p--){for(let f=0;f<Be;f++)this._data[(i+p)*Be+f]=c[(r+p)*Be+f];c[(r+p)*Be+2]&268435456&&(this._extendedAttrs[i+p]=t._extendedAttrs[r+p])}else for(let p=0;p<o;p++){for(let f=0;f<Be;f++)this._data[(i+p)*Be+f]=c[(r+p)*Be+f];c[(r+p)*Be+2]&268435456&&(this._extendedAttrs[i+p]=t._extendedAttrs[r+p])}let u=Object.keys(t._combined);for(let p=0;p<u.length;p++){let f=parseInt(u[p],10);f>=r&&(this._combined[f-r+i]=t._combined[f])}}translateToString(t,r,i,o){r=r??0,i=i??this.length,t&&(i=Math.min(i,this.getTrimmedLength())),o&&(o.length=0);let a="";for(;r<i;){let c=this._data[r*Be+0],u=c&2097151,p=c&2097152?this._combined[r]:u?Bs(u):Qs;if(a+=p,o)for(let f=0;f<p.length;++f)o.push(r);r+=c>>22||1}return o&&o.push(r),a}};function j3(e,t,r,i,o,a){let c=[];for(let u=0;u<e.length-1;u++){let p=u,f=e.get(++p);if(!f.isWrapped)continue;let g=[e.get(u)];for(;p<e.length&&f.isWrapped;)g.push(f),f=e.get(++p);if(!a&&i>=u&&i<p){u+=g.length-1;continue}let _=0,y=zl(g,_,t),x=1,S=0;for(;x<g.length;){let C=zl(g,x,t),E=C-S,I=r-y,k=Math.min(E,I);g[_].copyCellsFrom(g[x],S,y,k,!1),y+=k,y===r&&(_++,y=0),S+=k,S===C&&(x++,S=0),y===0&&_!==0&&g[_-1].getWidth(r-1)===2&&(g[_].copyCellsFrom(g[_-1],r-1,y++,1,!1),g[_-1].setCell(r-1,o))}g[_].replaceCells(y,r,o);let w=0;for(let C=g.length-1;C>0&&(C>_||g[C].getTrimmedLength()===0);C--)w++;w>0&&(c.push(u+g.length-w),c.push(w)),u+=g.length-1}return c}function T3(e,t){let r=[],i=0,o=t[i],a=0;for(let c=0;c<e.length;c++)if(o===c){let u=t[++i];e.onDeleteEmitter.fire({index:c-a,amount:u}),c+=u-1,a+=u,o=t[++i]}else r.push(c);return{layout:r,countRemoved:a}}function L3(e,t){let r=[];for(let i=0;i<t.length;i++)r.push(e.get(t[i]));for(let i=0;i<r.length;i++)e.set(i,r[i]);e.length=t.length}function M3(e,t,r){let i=[],o=e.map((p,f)=>zl(e,f,t)).reduce((p,f)=>p+f),a=0,c=0,u=0;for(;u<o;){if(o-u<r){i.push(o-u);break}a+=r;let p=zl(e,c,t);a>p&&(a-=p,c++);let f=e[c].getWidth(a-1)===2;f&&a--;let g=f?r-1:r;i.push(g),u+=g}return i}function zl(e,t,r){if(t===e.length-1)return e[t].getTrimmedLength();let i=!e[t].hasContent(r-1)&&e[t].getWidth(r-1)===1,o=e[t+1].getWidth(0)===2;return i&&o?r-1:r}var ow=class aw{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=aw._nextId++,this._onDispose=this.register(new ae),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),An(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};ow._nextId=1;var D3=ow,Lt={},Sn=Lt.B;Lt[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};Lt.A={"#":"£"};Lt.B=void 0;Lt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Lt.C=Lt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Lt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Lt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Lt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Lt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Lt.E=Lt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Lt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Lt.H=Lt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Lt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var z1=4294967295,W1=class{constructor(e,t,r){this._hasScrollback=e,this._optionsService=t,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=bt.clone(),this.savedCharset=Sn,this.markers=[],this._nullCell=Vr.fromCharData([0,Cb,1,0]),this._whitespaceCell=Vr.fromCharData([0,Qs,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new gu,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new N1(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 uu),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 uu),this._whitespaceCell}getBlankLine(e,t){return new yl(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>z1?z1:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=bt);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new N1(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(bt),i=0,o=this._getCorrectBufferLength(t);if(o>this.lines.maxLength&&(this.lines.maxLength=o),this.lines.length>0){if(this._cols<e)for(let c=0;c<this.lines.length;c++)i+=+this.lines.get(c).resize(e,r);let a=0;if(this._rows<t)for(let c=this._rows;c<t;c++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new yl(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new yl(e,r)));else for(let c=this._rows;c>t;c--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(o<this.lines.maxLength){let c=this.lines.length-o;c>0&&(this.lines.trimStart(c),this.ybase=Math.max(this.ybase-c,0),this.ydisp=Math.max(this.ydisp-c,0),this.savedY=Math.max(this.savedY-c,0)),this.lines.maxLength=o}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),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 a=0;a<this.lines.length;a++)i+=+this.lines.get(a).resize(e,r);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),i>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,i=j3(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(bt),r);if(i.length>0){let o=T3(this.lines,i);L3(this.lines,o.layout),this._reflowLargerAdjustViewport(e,t,o.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let i=this.getNullCell(bt),o=r;for(;o-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new yl(e,i))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)}_reflowSmaller(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,i=this.getNullCell(bt),o=[],a=0;for(let c=this.lines.length-1;c>=0;c--){let u=this.lines.get(c);if(!u||!u.isWrapped&&u.getTrimmedLength()<=e)continue;let p=[u];for(;u.isWrapped&&c>0;)u=this.lines.get(--c),p.unshift(u);if(!r){let k=this.ybase+this.y;if(k>=c&&k<c+p.length)continue}let f=p[p.length-1].getTrimmedLength(),g=M3(p,this._cols,e),_=g.length-p.length,y;this.ybase===0&&this.y!==this.lines.length-1?y=Math.max(0,this.y-this.lines.maxLength+_):y=Math.max(0,this.lines.length-this.lines.maxLength+_);let x=[];for(let k=0;k<_;k++){let R=this.getBlankLine(bt,!0);x.push(R)}x.length>0&&(o.push({start:c+p.length+a,newLines:x}),a+=x.length),p.push(...x);let S=g.length-1,w=g[S];w===0&&(S--,w=g[S]);let C=p.length-_-1,E=f;for(;C>=0;){let k=Math.min(E,w);if(p[S]===void 0)break;if(p[S].copyCellsFrom(p[C],E-k,w-k,k,!0),w-=k,w===0&&(S--,w=g[S]),E-=k,E===0){C--;let R=Math.max(C,0);E=zl(p,R,this._cols)}}for(let k=0;k<p.length;k++)g[k]<e&&p[k].setCell(g[k],i);let I=_-y;for(;I-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+_,this.ybase+t-1)}if(o.length>0){let c=[],u=[];for(let w=0;w<this.lines.length;w++)u.push(this.lines.get(w));let p=this.lines.length,f=p-1,g=0,_=o[g];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let y=0;for(let w=Math.min(this.lines.maxLength-1,p+a-1);w>=0;w--)if(_&&_.start>f+y){for(let C=_.newLines.length-1;C>=0;C--)this.lines.set(w--,_.newLines[C]);w++,c.push({index:f+1,amount:_.newLines.length}),y+=_.newLines.length,_=o[++g]}else this.lines.set(w,u[f--]);let x=0;for(let w=c.length-1;w>=0;w--)c[w].index+=x,this.lines.onInsertEmitter.fire(c[w]),x+=c[w].amount;let S=Math.max(0,p+a-this.lines.maxLength);S>0&&this.lines.onTrimEmitter.fire(S)}}translateBufferLineToString(e,t,r=0,i){let o=this.lines.get(e);return o?o.translateToString(t,r,i):""}getWrappedRangeForLine(e){let t=e,r=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:t,last:r}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new D3(e);return this.markers.push(t),t.register(this.lines.onTrim(r=>{t.line-=r,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(r=>{t.line>=r.index&&(t.line+=r.amount)})),t.register(this.lines.onDelete(r=>{t.line>=r.index&&t.line<r.index+r.amount&&t.dispose(),t.line>r.index&&(t.line-=r.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},B3=class extends Ie{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new ae),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 W1(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new W1(!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)}},lw=2,cw=1,Yg=class extends Ie{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ae),this.onResize=this._onResize.event,this._onScroll=this._register(new ae),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,lw),this.rows=Math.max(e.rawOptions.rows||0,cw),this.buffers=this._register(new B3(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let r=this.cols!==e,i=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:r,rowsChanged:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let r=this.buffer,i;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 o=r.ybase+r.scrollTop,a=r.ybase+r.scrollBottom;if(r.scrollTop===0){let c=r.lines.isFull;a===r.lines.length-1?c?r.lines.recycle().copyFrom(i):r.lines.push(i.clone()):r.lines.splice(a+1,0,i.clone()),c?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let c=a-o+1;r.lines.shiftElements(o+1,c-1,-1),r.lines.set(a,i.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,t){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let i=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),i!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};Yg=gt([fe(0,dr)],Yg);var So={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:pu,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},I3=["normal","bold","100","200","300","400","500","600","700","800","900"],O3=class extends Ie{constructor(e){super(),this._onOptionChange=this._register(new ae),this.onOptionChange=this._onOptionChange.event;let t={...So};for(let r in e)if(r in t)try{let i=e[r];t[r]=this._sanitizeAndValidateOption(r,i)}catch(i){console.error(i)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(rt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(r=>{r===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&t()})}_setupOptions(){let e=r=>{if(!(r in So))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,i)=>{if(!(r in So))throw new Error(`No option with key "${r}"`);i=this._sanitizeAndValidateOption(r,i),this.rawOptions[r]!==i&&(this.rawOptions[r]=i,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let i={get:e.bind(this,r),set:t.bind(this,r)};Object.defineProperty(this.options,r,i)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=So[e]),!F3(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=So[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=I3.includes(t)?t:So[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function F3(e){return e==="block"||e==="underline"||e==="bar"}function xl(e,t=5){if(typeof e!="object")return e;let r=Array.isArray(e)?[]:{};for(let i in e)r[i]=t<=1?e[i]:e[i]&&xl(e[i],t-1);return r}var H1=Object.freeze({insertMode:!1}),U1=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Xg=class extends Ie{constructor(e,t,r){super(),this._bufferService=e,this._logService=t,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new ae),this.onData=this._onData.event,this._onUserInput=this._register(new ae),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ae),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ae),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=xl(H1),this.decPrivateModes=xl(U1)}reset(){this.modes=xl(H1),this.decPrivateModes=xl(U1)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(i=>i.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};Xg=gt([fe(0,ur),fe(1,jb),fe(2,dr)],Xg);var K1={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function cp(e,t){let r=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(r|=64,r|=e.action):(r|=e.button&3,e.button&4&&(r|=64),e.button&8&&(r|=128),e.action===32?r|=32:e.action===0&&!t&&(r|=3)),r}var hp=String.fromCharCode,q1={DEFAULT:e=>{let t=[cp(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${hp(t[0])}${hp(t[1])}${hp(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${cp(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${cp(e,!0)};${e.x};${e.y}${t}`}},Jg=class extends Ie{constructor(e,t,r){super(),this._bufferService=e,this._coreService=t,this._optionsService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new ae),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(K1))this.addProtocol(i,K1[i]);for(let i of Object.keys(q1))this.addEncoding(i,q1[i]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,r){if(e.deltaY===0||e.shiftKey||t===void 0||r===void 0)return 0;let i=t/r,o=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(o/=i+0,Math.abs(e.deltaY)<50&&(o*=.3),this._wheelPartialScroll+=o,o=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(o*=this._bufferService.rows),o}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,r){if(r){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)}};Jg=gt([fe(0,ur),fe(1,zn),fe(2,dr)],Jg);var up=[[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]],$3=[[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]],Rt;function A3(e,t){let r=0,i=t.length-1,o;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=r;)if(o=r+i>>1,e>t[o][1])r=o+1;else if(e<t[o][0])i=o-1;else return!0;return!1}var N3=class{constructor(){if(this.version="6",!Rt){Rt=new Uint8Array(65536),Rt.fill(1),Rt[0]=0,Rt.fill(0,1,32),Rt.fill(0,127,160),Rt.fill(2,4352,4448),Rt[9001]=2,Rt[9002]=2,Rt.fill(2,11904,42192),Rt[12351]=1,Rt.fill(2,44032,55204),Rt.fill(2,63744,64256),Rt.fill(2,65040,65050),Rt.fill(2,65072,65136),Rt.fill(2,65280,65377),Rt.fill(2,65504,65511);for(let e=0;e<up.length;++e)Rt.fill(0,up[e][0],up[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Rt[e]:A3(e,$3)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let r=this.wcwidth(e),i=r===0&&t!==0;if(i){let o=wn.extractWidth(t);o===0?i=!1:o>r&&(r=o)}return wn.createPropertyValue(0,r,i)}},wn=class Oh{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ae,this.onChange=this._onChange.event;let t=new N3;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,r,i=!1){return(t&16777215)<<3|(r&3)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let r=0,i=0,o=t.length;for(let a=0;a<o;++a){let c=t.charCodeAt(a);if(55296<=c&&c<=56319){if(++a>=o)return r+this.wcwidth(c);let f=t.charCodeAt(a);56320<=f&&f<=57343?c=(c-55296)*1024+f-56320+65536:r+=this.wcwidth(f)}let u=this.charProperties(c,i),p=Oh.extractWidth(u);Oh.extractShouldJoin(u)&&(p-=Oh.extractWidth(i)),r+=p,i=u}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},z3=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 V1(e){var i;let t=(i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:i.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&t&&(r.isWrapped=t[3]!==0&&t[3]!==32)}var nl=2147483647,W3=256,hw=class Zg{constructor(t=32,r=32){if(this.maxLength=t,this.maxSubParamsLength=r,r>W3)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(r),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let r=new Zg;if(!t.length)return r;for(let i=Array.isArray(t[0])?1:0;i<t.length;++i){let o=t[i];if(Array.isArray(o))for(let a=0;a<o.length;++a)r.addSubParam(o[a]);else r.addParam(o)}return r}clone(){let t=new Zg(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let r=0;r<this.length;++r){t.push(this.params[r]);let i=this._subParamsIdx[r]>>8,o=this._subParamsIdx[r]&255;o-i>0&&t.push(Array.prototype.slice.call(this._subParams,i,o))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>nl?nl:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>nl?nl:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let r=this._subParamsIdx[t]>>8,i=this._subParamsIdx[t]&255;return i-r>0?this._subParams.subarray(r,i):null}getSubParamsAll(){let t={};for(let r=0;r<this.length;++r){let i=this._subParamsIdx[r]>>8,o=this._subParamsIdx[r]&255;o-i>0&&(t[r]=this._subParams.slice(i,o))}return t}addDigit(t){let r;if(this._rejectDigits||!(r=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,o=i[r-1];i[r-1]=~o?Math.min(o*10+t,nl):t}},ol=[],H3=class{constructor(){this._state=0,this._active=ol,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,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=ol}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=ol,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||ol,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,r){if(!this._active.length)this._handlerFb(this._id,"PUT",ku(e,t,r));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,r)}start(){this.reset(),this._state=1}put(e,t,r){if(this._state!==3){if(this._state===1)for(;t<r;){let i=e[t++];if(i===59){this._state=2,this._start();break}if(i<48||57<i){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+i-48}this._state===2&&r-t>0&&this._put(e,t,r)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let r=!1,i=this._active.length-1,o=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,r=t,o=this._stack.fallThrough,this._stack.paused=!1),!o&&r===!1){for(;i>=0&&(r=this._active[i].end(e),r!==!0);i--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,r;i--}for(;i>=0;i--)if(r=this._active[i].end(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,r}this._active=ol,this._id=-1,this._state=0}}},jr=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=ku(e,t,r),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(r=>(this._data="",this._hitLimit=!1,r));return this._data="",this._hitLimit=!1,t}},al=[],U3=class{constructor(){this._handlers=Object.create(null),this._active=al,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=al}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,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=al,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||al,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let r=this._active.length-1;r>=0;r--)this._active[r].hook(t)}put(e,t,r){if(!this._active.length)this._handlerFb(this._ident,"PUT",ku(e,t,r));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,r)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let r=!1,i=this._active.length-1,o=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,r=t,o=this._stack.fallThrough,this._stack.paused=!1),!o&&r===!1){for(;i>=0&&(r=this._active[i].unhook(e),r!==!0);i--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,r;i--}for(;i>=0;i--)if(r=this._active[i].unhook(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,r}this._active=al,this._ident=0}},Sl=new hw;Sl.addParam(0);var Q1=class{constructor(e){this._handler=e,this._data="",this._params=Sl,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Sl,this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=ku(e,t,r),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(r=>(this._params=Sl,this._data="",this._hitLimit=!1,r));return this._params=Sl,this._data="",this._hitLimit=!1,t}},K3=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,r,i){this.table[t<<8|e]=r<<4|i}addMany(e,t,r,i){for(let o=0;o<e.length;o++)this.table[t<<8|e[o]]=r<<4|i}},Kr=160,q3=(function(){let e=new K3(4095),t=Array.apply(null,Array(256)).map((u,p)=>p),r=(u,p)=>t.slice(u,p),i=r(32,127),o=r(0,24);o.push(25),o.push.apply(o,r(28,32));let a=r(0,14),c;e.setDefault(1,0),e.addMany(i,0,2,0);for(c in a)e.addMany([24,26,153,154],c,3,0),e.addMany(r(128,144),c,3,0),e.addMany(r(144,152),c,3,0),e.add(156,c,0,0),e.add(27,c,11,1),e.add(157,c,4,8),e.addMany([152,158,159],c,0,7),e.add(155,c,11,3),e.add(144,c,11,9);return e.addMany(o,0,3,0),e.addMany(o,1,3,1),e.add(127,1,0,1),e.addMany(o,8,0,8),e.addMany(o,3,3,3),e.add(127,3,0,3),e.addMany(o,4,3,4),e.add(127,4,0,4),e.addMany(o,6,3,6),e.addMany(o,5,3,5),e.add(127,5,0,5),e.addMany(o,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(i,7,0,7),e.addMany(o,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(o,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(o,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(o,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(o,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(o,13,13,13),e.addMany(i,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Kr,0,2,0),e.add(Kr,8,5,8),e.add(Kr,6,0,6),e.add(Kr,11,0,11),e.add(Kr,13,13,13),e})(),V3=class extends Ie{constructor(e=q3){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 hw,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,r,i)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,r)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(rt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new H3),this._dcsParser=this._register(new U3),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>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 o=0;o<e.intermediates.length;++o){let a=e.intermediates.charCodeAt(o);if(32>a||a>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=a}}if(e.final.length!==1)throw new Error("final must be a single byte");let i=e.final.charCodeAt(0);if(t[0]>i||i>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return r<<=8,r|=i,r}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let i=this._escHandlers[r];return i.push(t),{dispose:()=>{let o=i.indexOf(t);o!==-1&&i.splice(o,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 r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let i=this._csiHandlers[r];return i.push(t),{dispose:()=>{let o=i.indexOf(t);o!==-1&&i.splice(o,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,r,i,o){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=r,this._parseStack.transition=i,this._parseStack.chunkPos=o}parse(e,t,r){let i=0,o=0,a=0,c;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let u=this._parseStack.handlers,p=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&p>-1){for(;p>=0&&(c=u[p](this._params),c!==!0);p--)if(c instanceof Promise)return this._parseStack.handlerPos=p,c}this._parseStack.handlers=[];break;case 4:if(r===!1&&p>-1){for(;p>=0&&(c=u[p](),c!==!0);p--)if(c instanceof Promise)return this._parseStack.handlerPos=p,c}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],c=this._dcsParser.unhook(i!==24&&i!==26,r),c)return c;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],c=this._oscParser.end(i!==24&&i!==26,r),c)return c;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let u=a;u<t;++u){switch(i=e[u],o=this._transitions.table[this.currentState<<8|(i<160?i:Kr)],o>>4){case 2:for(let y=u+1;;++y){if(y>=t||(i=e[y])<32||i>126&&i<Kr){this._printHandler(e,u,y),u=y-1;break}if(++y>=t||(i=e[y])<32||i>126&&i<Kr){this._printHandler(e,u,y),u=y-1;break}if(++y>=t||(i=e[y])<32||i>126&&i<Kr){this._printHandler(e,u,y),u=y-1;break}if(++y>=t||(i=e[y])<32||i>126&&i<Kr){this._printHandler(e,u,y),u=y-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:u,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let p=this._csiHandlers[this._collect<<8|i],f=p?p.length-1:-1;for(;f>=0&&(c=p[f](this._params),c!==!0);f--)if(c instanceof Promise)return this._preserveStack(3,p,f,o,u),c;f<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++u<t&&(i=e[u])>47&&i<60);u--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let g=this._escHandlers[this._collect<<8|i],_=g?g.length-1:-1;for(;_>=0&&(c=g[_](),c!==!0);_--)if(c instanceof Promise)return this._preserveStack(4,g,_,o,u),c;_<0&&this._escHandlerFb(this._collect<<8|i),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|i,this._params);break;case 13:for(let y=u+1;;++y)if(y>=t||(i=e[y])===24||i===26||i===27||i>127&&i<Kr){this._dcsParser.put(e,u,y),u=y-1;break}break;case 14:if(c=this._dcsParser.unhook(i!==24&&i!==26),c)return this._preserveStack(6,[],0,o,u),c;i===27&&(o|=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 y=u+1;;y++)if(y>=t||(i=e[y])<32||i>127&&i<Kr){this._oscParser.put(e,u,y),u=y-1;break}break;case 6:if(c=this._oscParser.end(i!==24&&i!==26),c)return this._preserveStack(5,[],0,o,u),c;i===27&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=o&15}}},Q3=/^([\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})$/,G3=/^[\da-f]+$/;function G1(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let r=Q3.exec(t);if(r){let i=r[1]?15:r[4]?255:r[7]?4095:65535;return[Math.round(parseInt(r[1]||r[4]||r[7]||r[10],16)/i*255),Math.round(parseInt(r[2]||r[5]||r[8]||r[11],16)/i*255),Math.round(parseInt(r[3]||r[6]||r[9]||r[12],16)/i*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),G3.exec(t)&&[3,6,9,12].includes(t.length))){let r=t.length/3,i=[0,0,0];for(let o=0;o<3;++o){let a=parseInt(t.slice(r*o,r*o+r),16);i[o]=r===1?a<<4:r===2?a:r===3?a>>4:a>>8}return i}}function dp(e,t){let r=e.toString(16),i=r.length<2?"0"+r:r;switch(t){case 4:return r[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}function Y3(e,t=16){let[r,i,o]=e;return`rgb:${dp(r,t)}/${dp(i,t)}/${dp(o,t)}`}var X3={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Ls=131072,Y1=10;function X1(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 J1=5e3,Z1=0,J3=class extends Ie{constructor(e,t,r,i,o,a,c,u,p=new V3){super(),this._bufferService=e,this._charsetService=t,this._coreService=r,this._logService=i,this._optionsService=o,this._oscLinkService=a,this._coreMouseService=c,this._unicodeService=u,this._parser=p,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new _j,this._utf8Decoder=new mj,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=bt.clone(),this._eraseAttrDataInternal=bt.clone(),this._onRequestBell=this._register(new ae),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ae),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ae),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ae),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ae),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ae),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ae),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ae),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ae),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ae),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ae),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ae),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ae),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 ev(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(f=>this._activeBuffer=f.activeBuffer)),this._parser.setCsiHandlerFallback((f,g)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(f),params:g.toArray()})}),this._parser.setEscHandlerFallback(f=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(f)})}),this._parser.setExecuteHandlerFallback(f=>{this._logService.debug("Unknown EXECUTE code: ",{code:f})}),this._parser.setOscHandlerFallback((f,g,_)=>{this._logService.debug("Unknown OSC code: ",{identifier:f,action:g,data:_})}),this._parser.setDcsHandlerFallback((f,g,_)=>{g==="HOOK"&&(_=_.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(f),action:g,payload:_})}),this._parser.setPrintHandler((f,g,_)=>this.print(f,g,_)),this._parser.registerCsiHandler({final:"@"},f=>this.insertChars(f)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},f=>this.scrollLeft(f)),this._parser.registerCsiHandler({final:"A"},f=>this.cursorUp(f)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},f=>this.scrollRight(f)),this._parser.registerCsiHandler({final:"B"},f=>this.cursorDown(f)),this._parser.registerCsiHandler({final:"C"},f=>this.cursorForward(f)),this._parser.registerCsiHandler({final:"D"},f=>this.cursorBackward(f)),this._parser.registerCsiHandler({final:"E"},f=>this.cursorNextLine(f)),this._parser.registerCsiHandler({final:"F"},f=>this.cursorPrecedingLine(f)),this._parser.registerCsiHandler({final:"G"},f=>this.cursorCharAbsolute(f)),this._parser.registerCsiHandler({final:"H"},f=>this.cursorPosition(f)),this._parser.registerCsiHandler({final:"I"},f=>this.cursorForwardTab(f)),this._parser.registerCsiHandler({final:"J"},f=>this.eraseInDisplay(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},f=>this.eraseInDisplay(f,!0)),this._parser.registerCsiHandler({final:"K"},f=>this.eraseInLine(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},f=>this.eraseInLine(f,!0)),this._parser.registerCsiHandler({final:"L"},f=>this.insertLines(f)),this._parser.registerCsiHandler({final:"M"},f=>this.deleteLines(f)),this._parser.registerCsiHandler({final:"P"},f=>this.deleteChars(f)),this._parser.registerCsiHandler({final:"S"},f=>this.scrollUp(f)),this._parser.registerCsiHandler({final:"T"},f=>this.scrollDown(f)),this._parser.registerCsiHandler({final:"X"},f=>this.eraseChars(f)),this._parser.registerCsiHandler({final:"Z"},f=>this.cursorBackwardTab(f)),this._parser.registerCsiHandler({final:"`"},f=>this.charPosAbsolute(f)),this._parser.registerCsiHandler({final:"a"},f=>this.hPositionRelative(f)),this._parser.registerCsiHandler({final:"b"},f=>this.repeatPrecedingCharacter(f)),this._parser.registerCsiHandler({final:"c"},f=>this.sendDeviceAttributesPrimary(f)),this._parser.registerCsiHandler({prefix:">",final:"c"},f=>this.sendDeviceAttributesSecondary(f)),this._parser.registerCsiHandler({final:"d"},f=>this.linePosAbsolute(f)),this._parser.registerCsiHandler({final:"e"},f=>this.vPositionRelative(f)),this._parser.registerCsiHandler({final:"f"},f=>this.hVPosition(f)),this._parser.registerCsiHandler({final:"g"},f=>this.tabClear(f)),this._parser.registerCsiHandler({final:"h"},f=>this.setMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"h"},f=>this.setModePrivate(f)),this._parser.registerCsiHandler({final:"l"},f=>this.resetMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"l"},f=>this.resetModePrivate(f)),this._parser.registerCsiHandler({final:"m"},f=>this.charAttributes(f)),this._parser.registerCsiHandler({final:"n"},f=>this.deviceStatus(f)),this._parser.registerCsiHandler({prefix:"?",final:"n"},f=>this.deviceStatusPrivate(f)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},f=>this.softReset(f)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},f=>this.setCursorStyle(f)),this._parser.registerCsiHandler({final:"r"},f=>this.setScrollRegion(f)),this._parser.registerCsiHandler({final:"s"},f=>this.saveCursor(f)),this._parser.registerCsiHandler({final:"t"},f=>this.windowOptions(f)),this._parser.registerCsiHandler({final:"u"},f=>this.restoreCursor(f)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},f=>this.insertColumns(f)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},f=>this.deleteColumns(f)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},f=>this.selectProtected(f)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},f=>this.requestMode(f,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},f=>this.requestMode(f,!1)),this._parser.setExecuteHandler(G.BEL,()=>this.bell()),this._parser.setExecuteHandler(G.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(G.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(G.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(G.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(G.BS,()=>this.backspace()),this._parser.setExecuteHandler(G.HT,()=>this.tab()),this._parser.setExecuteHandler(G.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(G.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Bh.IND,()=>this.index()),this._parser.setExecuteHandler(Bh.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Bh.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new jr(f=>(this.setTitle(f),this.setIconName(f),!0))),this._parser.registerOscHandler(1,new jr(f=>this.setIconName(f))),this._parser.registerOscHandler(2,new jr(f=>this.setTitle(f))),this._parser.registerOscHandler(4,new jr(f=>this.setOrReportIndexedColor(f))),this._parser.registerOscHandler(8,new jr(f=>this.setHyperlink(f))),this._parser.registerOscHandler(10,new jr(f=>this.setOrReportFgColor(f))),this._parser.registerOscHandler(11,new jr(f=>this.setOrReportBgColor(f))),this._parser.registerOscHandler(12,new jr(f=>this.setOrReportCursorColor(f))),this._parser.registerOscHandler(104,new jr(f=>this.restoreIndexedColor(f))),this._parser.registerOscHandler(110,new jr(f=>this.restoreFgColor(f))),this._parser.registerOscHandler(111,new jr(f=>this.restoreBgColor(f))),this._parser.registerOscHandler(112,new jr(f=>this.restoreCursorColor(f))),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 f in Lt)this._parser.registerEscHandler({intermediates:"(",final:f},()=>this.selectCharset("("+f)),this._parser.registerEscHandler({intermediates:")",final:f},()=>this.selectCharset(")"+f)),this._parser.registerEscHandler({intermediates:"*",final:f},()=>this.selectCharset("*"+f)),this._parser.registerEscHandler({intermediates:"+",final:f},()=>this.selectCharset("+"+f)),this._parser.registerEscHandler({intermediates:"-",final:f},()=>this.selectCharset("-"+f)),this._parser.registerEscHandler({intermediates:".",final:f},()=>this.selectCharset("."+f)),this._parser.registerEscHandler({intermediates:"/",final:f},()=>this.selectCharset("/"+f));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(f=>(this._logService.error("Parsing error: ",f),f)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Q1((f,g)=>this.requestStatusString(f,g)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,r,i){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=r,this._parseStack.position=i}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,r)=>setTimeout(()=>r("#SLOW_TIMEOUT"),J1))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${J1} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let r,i=this._activeBuffer.x,o=this._activeBuffer.y,a=0,c=this._parseStack.paused;if(c){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(r),r;i=this._parseStack.cursorStartX,o=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Ls&&(a=this._parseStack.position+Ls)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,f=>String.fromCharCode(f)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(f=>f.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Ls&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Ls))),c||this._dirtyRowTracker.clearRange(),e.length>Ls)for(let f=a;f<e.length;f+=Ls){let g=f+Ls<e.length?f+Ls:e.length,_=typeof e=="string"?this._stringDecoder.decode(e.substring(f,g),this._parseBuffer):this._utf8Decoder.decode(e.subarray(f,g),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,_))return this._preserveStack(i,o,_,f),this._logSlowResolvingAsync(r),r}else if(!c){let f=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,f))return this._preserveStack(i,o,f,0),this._logSlowResolvingAsync(r),r}(this._activeBuffer.x!==i||this._activeBuffer.y!==o)&&this._onCursorMove.fire();let u=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),p=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);p<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(p,this._bufferService.rows-1),end:Math.min(u,this._bufferService.rows-1)})}print(e,t,r){let i,o,a=this._charsetService.charset,c=this._optionsService.rawOptions.screenReaderMode,u=this._bufferService.cols,p=this._coreService.decPrivateModes.wraparound,f=this._coreService.modes.insertMode,g=this._curAttrData,_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-t>0&&_.getWidth(this._activeBuffer.x-1)===2&&_.setCellFromCodepoint(this._activeBuffer.x-1,0,1,g);let y=this._parser.precedingJoinState;for(let x=t;x<r;++x){if(i=e[x],i<127&&a){let E=a[String.fromCharCode(i)];E&&(i=E.charCodeAt(0))}let S=this._unicodeService.charProperties(i,y);o=wn.extractWidth(S);let w=wn.extractShouldJoin(S),C=w?wn.extractWidth(y):0;if(y=S,c&&this._onA11yChar.fire(Bs(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+o-C>u){if(p){let E=_,I=this._activeBuffer.x-C;for(this._activeBuffer.x=C,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),C>0&&_ instanceof yl&&_.copyCellsFrom(E,I,0,C,!1);I<u;)E.setCellFromCodepoint(I++,0,1,g)}else if(this._activeBuffer.x=u-1,o===2)continue}if(w&&this._activeBuffer.x){let E=_.getWidth(this._activeBuffer.x-1)?1:2;_.addCodepointToCell(this._activeBuffer.x-E,i,o);for(let I=o-C;--I>=0;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,g);continue}if(f&&(_.insertCells(this._activeBuffer.x,o-C,this._activeBuffer.getNullCell(g)),_.getWidth(u-1)===2&&_.setCellFromCodepoint(u-1,0,1,g)),_.setCellFromCodepoint(this._activeBuffer.x++,i,o,g),o>0)for(;--o;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,g)}this._parser.precedingJoinState=y,this._activeBuffer.x<u&&r-t>0&&_.getWidth(this._activeBuffer.x)===0&&!_.hasContent(this._activeBuffer.x)&&_.setCellFromCodepoint(this._activeBuffer.x,0,1,g),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>X1(r.params[0],this._optionsService.rawOptions.windowOptions)?t(r):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Q1(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new jr(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,r,i=!1,o=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,r,this._activeBuffer.getNullCell(this._eraseAttrData()),o),i&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,t=!1){var i;this._restrictCursor(this._bufferService.cols);let r;switch(e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,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--&&!((i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r))!=null&&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 o=this._activeBuffer.lines.length-this._bufferService.rows;o>0&&(this._activeBuffer.lines.trimStart(o),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-o,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-o,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,o=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;for(;t--;)this._activeBuffer.lines.splice(o-1,1),this._activeBuffer.lines.splice(r,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 r=this._activeBuffer.ybase+this._activeBuffer.y,i;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(bt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.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 r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.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 r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.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 r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.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 r=e.params[0]||1,i=wn.extractWidth(t),o=this._activeBuffer.x-i,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(o),c=new Uint32Array(a.length*r),u=0;for(let f=0;f<a.length;){let g=a.codePointAt(f)||0;c[u++]=g,f+=g>65535?2:1}let p=u;for(let f=1;f<r;++f)c.copyWithin(p,0,u),p+=u;return this.print(c,0,p),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(G.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(G.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(G.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(G.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(G.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Sn),this._charsetService.setgCharset(1,Sn),this._charsetService.setgCharset(2,Sn),this._charsetService.setgCharset(3,Sn);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(w=>(w[w.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",w[w.SET=1]="SET",w[w.RESET=2]="RESET",w[w.PERMANENTLY_SET=3]="PERMANENTLY_SET",w[w.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(r={}));let i=this._coreService.decPrivateModes,{activeProtocol:o,activeEncoding:a}=this._coreMouseService,c=this._coreService,{buffers:u,cols:p}=this._bufferService,{active:f,alt:g}=u,_=this._optionsService.rawOptions,y=(w,C)=>(c.triggerDataEvent(`${G.ESC}[${t?"":"?"}${w};${C}$y`),!0),x=w=>w?1:2,S=e.params[0];return t?S===2?y(S,4):S===4?y(S,x(c.modes.insertMode)):S===12?y(S,3):S===20?y(S,x(_.convertEol)):y(S,0):S===1?y(S,x(i.applicationCursorKeys)):S===3?y(S,_.windowOptions.setWinLines?p===80?2:p===132?1:0:0):S===6?y(S,x(i.origin)):S===7?y(S,x(i.wraparound)):S===8?y(S,3):S===9?y(S,x(o==="X10")):S===12?y(S,x(_.cursorBlink)):S===25?y(S,x(!c.isCursorHidden)):S===45?y(S,x(i.reverseWraparound)):S===66?y(S,x(i.applicationKeypad)):S===67?y(S,4):S===1e3?y(S,x(o==="VT200")):S===1002?y(S,x(o==="DRAG")):S===1003?y(S,x(o==="ANY")):S===1004?y(S,x(i.sendFocus)):S===1005?y(S,4):S===1006?y(S,x(a==="SGR")):S===1015?y(S,4):S===1016?y(S,x(a==="SGR_PIXELS")):S===1048?y(S,1):S===47||S===1047||S===1049?y(S,x(f===g)):S===2004?y(S,x(i.bracketedPasteMode)):S===2026?y(S,x(i.synchronizedOutput)):y(S,0)}_updateAttrColor(e,t,r,i,o){return t===2?(e|=50331648,e&=-16777216,e|=Vl.fromColorRGB([r,i,o])):t===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,t,r){let i=[0,0,-1,0,0,0],o=0,a=0;do{if(i[a+o]=e.params[t+a],e.hasSubParams(t+a)){let c=e.getSubParams(t+a),u=0;do i[1]===5&&(o=1),i[a+u+1+o]=c[u];while(++u<c.length&&u+a+1+o<i.length);break}if(i[1]===5&&a+o>=2||i[1]===2&&a+o>=5)break;i[1]&&(o=1)}while(++a+t<e.length&&a+o<i.length);for(let c=2;c<i.length;++c)i[c]===-1&&(i[c]=0);switch(i[0]){case 38:r.fg=this._updateAttrColor(r.fg,i[1],i[3],i[4],i[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,i[1],i[3],i[4],i[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,i[1],i[3],i[4],i[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=bt.fg,e.bg=bt.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,r,i=this._curAttrData;for(let o=0;o<t;o++)r=e.params[o],r>=30&&r<=37?(i.fg&=-50331904,i.fg|=16777216|r-30):r>=40&&r<=47?(i.bg&=-50331904,i.bg|=16777216|r-40):r>=90&&r<=97?(i.fg&=-50331904,i.fg|=16777216|r-90|8):r>=100&&r<=107?(i.bg&=-50331904,i.bg|=16777216|r-100|8):r===0?this._processSGR0(i):r===1?i.fg|=134217728:r===3?i.bg|=67108864:r===4?(i.fg|=268435456,this._processUnderline(e.hasSubParams(o)?e.getSubParams(o)[0]:1,i)):r===5?i.fg|=536870912:r===7?i.fg|=67108864:r===8?i.fg|=1073741824:r===9?i.fg|=2147483648:r===2?i.bg|=134217728:r===21?this._processUnderline(2,i):r===22?(i.fg&=-134217729,i.bg&=-134217729):r===23?i.bg&=-67108865:r===24?(i.fg&=-268435457,this._processUnderline(0,i)):r===25?i.fg&=-536870913:r===27?i.fg&=-67108865:r===28?i.fg&=-1073741825:r===29?i.fg&=2147483647:r===39?(i.fg&=-67108864,i.fg|=bt.fg&16777215):r===49?(i.bg&=-67108864,i.bg|=bt.bg&16777215):r===38||r===48||r===58?o+=this._extractColor(e,o,i):r===53?i.bg|=1073741824:r===55?i.bg&=-1073741825:r===59?(i.extended=i.extended.clone(),i.extended.underlineColor=-1,i.updateExtended()):r===100?(i.fg&=-67108864,i.fg|=bt.fg&16777215,i.bg&=-67108864,i.bg|=bt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${G.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${G.ESC}[${t};${r}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${G.ESC}[?${t};${r}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=bt.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let r=t%2===1;this._coreService.decPrivateModes.cursorBlink=r}return!0}setScrollRegion(e){let t=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||r===0)&&(r=this._bufferService.rows),r>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!X1(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${G.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Y1&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Y1&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],r=e.split(";");for(;r.length>1;){let i=r.shift(),o=r.shift();if(/^\d+$/.exec(i)){let a=parseInt(i);if(ex(a))if(o==="?")t.push({type:0,index:a});else{let c=G1(o);c&&t.push({type:1,index:a,color:c})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let r=e.slice(0,t).trim(),i=e.slice(t+1);return i?this._createHyperlink(r,i):r.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),i,o=r.findIndex(a=>a.startsWith("id="));return o!==-1&&(i=r[o].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 r=e.split(";");for(let i=0;i<r.length&&!(t>=this._specialColors.length);++i,++t)if(r[i]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let o=G1(r[i]);o&&this._onColor.fire([{type:1,index:this._specialColors[t],color:o}])}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=[],r=e.split(";");for(let i=0;i<r.length;++i)if(/^\d+$/.exec(r[i])){let o=parseInt(r[i]);ex(o)&&t.push({type:2,index:o})}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,Sn),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(X3[e[0]],Lt[e[1]]||Sn),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=bt.clone(),this._eraseAttrDataInternal=bt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Vr;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let r=this._activeBuffer.ybase+this._activeBuffer.y+t,i=this._activeBuffer.lines.get(r);i&&(i.fill(e),i.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let r=c=>(this._coreService.triggerDataEvent(`${G.ESC}${c}${G.ESC}\\`),!0),i=this._bufferService.buffer,o=this._optionsService.rawOptions;return r(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[o.cursorStyle]-(o.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},ev=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&&(Z1=e,e=t,t=Z1),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};ev=gt([fe(0,ur)],ev);function ex(e){return 0<=e&&e<256}var Z3=5e7,tx=12,eL=50,tL=class extends Ie{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 ae),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let r;for(;r=this._writeBuffer.shift();){this._action(r);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>Z3)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],o=this._action(i,t);if(o){let c=u=>performance.now()-r>=tx?setTimeout(()=>this._innerWrite(0,u)):this._innerWrite(r,u);o.catch(u=>(queueMicrotask(()=>{throw u}),Promise.resolve(!1))).then(c);return}let a=this._callbacks[this._bufferOffset];if(a&&a(),this._bufferOffset++,this._pendingData-=i.length,performance.now()-r>=tx)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>eL&&(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()}},tv=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let u=t.addMarker(t.ybase+t.y),p={data:e,id:this._nextId++,lines:[u]};return u.onDispose(()=>this._removeMarkerFromLink(p,u)),this._dataByLinkId.set(p.id,p),p.id}let r=e,i=this._getEntryIdKey(r),o=this._entriesWithId.get(i);if(o)return this.addLineToLink(o.id,t.ybase+t.y),o.id;let a=t.addMarker(t.ybase+t.y),c={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(c,a)),this._entriesWithId.set(c.key,c),this._dataByLinkId.set(c.id,c),c.id}addLineToLink(e,t){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(i=>i.line!==t)){let i=this._bufferService.buffer.addMarker(t);r.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(r,i))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let r=e.lines.indexOf(t);r!==-1&&(e.lines.splice(r,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};tv=gt([fe(0,ur)],tv);var rx=!1,rL=class extends Ie{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Jo),this._onBinary=this._register(new ae),this.onBinary=this._onBinary.event,this._onData=this._register(new ae),this.onData=this._onData.event,this._onLineFeed=this._register(new ae),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ae),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ae),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ae),this._instantiationService=new E3,this.optionsService=this._register(new O3(e)),this._instantiationService.setService(dr,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Yg)),this._instantiationService.setService(ur,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Gg)),this._instantiationService.setService(jb,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Xg)),this._instantiationService.setService(zn,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Jg)),this._instantiationService.setService(Rb,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(wn)),this._instantiationService.setService(bj,this.unicodeService),this._charsetService=this._instantiationService.createInstance(z3),this._instantiationService.setService(Sj,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(tv),this._instantiationService.setService(Tb,this._oscLinkService),this._inputHandler=this._register(new J3(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Vt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Vt.forward(this._bufferService.onResize,this._onResize)),this._register(Vt.forward(this.coreService.onData,this._onData)),this._register(Vt.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new tL((t,r)=>this._inputHandler.parse(t,r))),this._register(Vt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ae),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!rx&&(this._logService.warn("writeSync is unreliable and will be removed soon."),rx=!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,lw),t=Math.max(t,cw),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(V1.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(V1(this._bufferService),!1))),this._windowsWrappingHeuristics.value=rt(()=>{for(let t of e)t.dispose()})}}},iL={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function sL(e,t,r,i){var c;let o={type:0,cancel:!1,key:void 0},a=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?o.key=G.ESC+"OA":o.key=G.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?o.key=G.ESC+"OD":o.key=G.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?o.key=G.ESC+"OC":o.key=G.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?o.key=G.ESC+"OB":o.key=G.ESC+"[B");break;case 8:o.key=e.ctrlKey?"\b":G.DEL,e.altKey&&(o.key=G.ESC+o.key);break;case 9:if(e.shiftKey){o.key=G.ESC+"[Z";break}o.key=G.HT,o.cancel=!0;break;case 13:o.key=e.altKey?G.ESC+G.CR:G.CR,o.cancel=!0;break;case 27:o.key=G.ESC,e.altKey&&(o.key=G.ESC+G.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;a?o.key=G.ESC+"[1;"+(a+1)+"D":t?o.key=G.ESC+"OD":o.key=G.ESC+"[D";break;case 39:if(e.metaKey)break;a?o.key=G.ESC+"[1;"+(a+1)+"C":t?o.key=G.ESC+"OC":o.key=G.ESC+"[C";break;case 38:if(e.metaKey)break;a?o.key=G.ESC+"[1;"+(a+1)+"A":t?o.key=G.ESC+"OA":o.key=G.ESC+"[A";break;case 40:if(e.metaKey)break;a?o.key=G.ESC+"[1;"+(a+1)+"B":t?o.key=G.ESC+"OB":o.key=G.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(o.key=G.ESC+"[2~");break;case 46:a?o.key=G.ESC+"[3;"+(a+1)+"~":o.key=G.ESC+"[3~";break;case 36:a?o.key=G.ESC+"[1;"+(a+1)+"H":t?o.key=G.ESC+"OH":o.key=G.ESC+"[H";break;case 35:a?o.key=G.ESC+"[1;"+(a+1)+"F":t?o.key=G.ESC+"OF":o.key=G.ESC+"[F";break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=G.ESC+"[5;"+(a+1)+"~":o.key=G.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=G.ESC+"[6;"+(a+1)+"~":o.key=G.ESC+"[6~";break;case 112:a?o.key=G.ESC+"[1;"+(a+1)+"P":o.key=G.ESC+"OP";break;case 113:a?o.key=G.ESC+"[1;"+(a+1)+"Q":o.key=G.ESC+"OQ";break;case 114:a?o.key=G.ESC+"[1;"+(a+1)+"R":o.key=G.ESC+"OR";break;case 115:a?o.key=G.ESC+"[1;"+(a+1)+"S":o.key=G.ESC+"OS";break;case 116:a?o.key=G.ESC+"[15;"+(a+1)+"~":o.key=G.ESC+"[15~";break;case 117:a?o.key=G.ESC+"[17;"+(a+1)+"~":o.key=G.ESC+"[17~";break;case 118:a?o.key=G.ESC+"[18;"+(a+1)+"~":o.key=G.ESC+"[18~";break;case 119:a?o.key=G.ESC+"[19;"+(a+1)+"~":o.key=G.ESC+"[19~";break;case 120:a?o.key=G.ESC+"[20;"+(a+1)+"~":o.key=G.ESC+"[20~";break;case 121:a?o.key=G.ESC+"[21;"+(a+1)+"~":o.key=G.ESC+"[21~";break;case 122:a?o.key=G.ESC+"[23;"+(a+1)+"~":o.key=G.ESC+"[23~";break;case 123:a?o.key=G.ESC+"[24;"+(a+1)+"~":o.key=G.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?o.key=G.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=G.DEL:e.keyCode===219?o.key=G.ESC:e.keyCode===220?o.key=G.FS:e.keyCode===221&&(o.key=G.GS);else if((!r||i)&&e.altKey&&!e.metaKey){let u=(c=iL[e.keyCode])==null?void 0:c[e.shiftKey?1:0];if(u)o.key=G.ESC+u;else if(e.keyCode>=65&&e.keyCode<=90){let p=e.ctrlKey?e.keyCode-64:e.keyCode+32,f=String.fromCharCode(p);e.shiftKey&&(f=f.toUpperCase()),o.key=G.ESC+f}else if(e.keyCode===32)o.key=G.ESC+(e.ctrlKey?G.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let p=e.code.slice(3,4);e.shiftKey||(p=p.toLowerCase()),o.key=G.ESC+p,o.cancel=!0}}else r&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(o.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?o.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(o.key=G.US),e.key==="@"&&(o.key=G.NUL));break}return o}var mt=0,nL=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new gu,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new gu,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((o,a)=>this._getKey(o)-this._getKey(a)),t=0,r=0,i=new Array(this._array.length+this._insertedValues.length);for(let o=0;o<i.length;o++)r>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[r])?(i[o]=e[t],t++):i[o]=this._array[r++];this._array=i,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(mt=this._search(t),mt===-1)||this._getKey(this._array[mt])!==t)return!1;do if(this._array[mt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(mt),!0;while(++mt<this._array.length&&this._getKey(this._array[mt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((o,a)=>o-a),t=0,r=new Array(this._array.length-e.length),i=0;for(let o=0;o<this._array.length;o++)e[t]===o?t++:r[i++]=this._array[o];this._array=r,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(mt=this._search(e),!(mt<0||mt>=this._array.length)&&this._getKey(this._array[mt])===e))do yield this._array[mt];while(++mt<this._array.length&&this._getKey(this._array[mt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(mt=this._search(e),!(mt<0||mt>=this._array.length)&&this._getKey(this._array[mt])===e))do t(this._array[mt]);while(++mt<this._array.length&&this._getKey(this._array[mt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,r=this._array.length-1;for(;r>=t;){let i=t+r>>1,o=this._getKey(this._array[i]);if(o>e)r=i-1;else if(o<e)t=i+1;else{for(;i>0&&this._getKey(this._array[i-1])===e;)i--;return i}}return t}},fp=0,ix=0,oL=class extends Ie{constructor(){super(),this._decorations=new nL(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new ae),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ae),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(rt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new aL(e);if(t){let r=t.marker.onDispose(()=>t.dispose()),i=t.onDispose(()=>{i.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),r.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,r){let i=0,o=0;for(let a of this._decorations.getKeyIterator(t))i=a.options.x??0,o=i+(a.options.width??1),e>=i&&e<o&&(!r||(a.options.layer??"bottom")===r)&&(yield a)}forEachDecorationAtCell(e,t,r,i){this._decorations.forEachByKey(t,o=>{fp=o.options.x??0,ix=fp+(o.options.width??1),e>=fp&&e<ix&&(!r||(o.options.layer??"bottom")===r)&&i(o)})}},aL=class extends Xs{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new ae),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ae),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=at.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=at.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},lL=1e3,cL=class{constructor(e,t=lL){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let i=performance.now();if(i-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=i,this._innerRefresh();else if(!this._additionalRefreshRequested){let o=i-this._lastRefreshMs,a=this._debounceThresholdMS-o;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},a)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},sx=20,vu=class extends Ie{constructor(e,t,r,i){super(),this._terminal=e,this._coreBrowserService=r,this._renderService=i,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let o=this._coreBrowserService.mainDocument;this._accessibilityContainer=o.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=o.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let a=0;a<this._terminal.rows;a++)this._rowElements[a]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[a]);if(this._topBoundaryFocusListener=a=>this._handleBoundaryFocus(a,0),this._bottomBoundaryFocusListener=a=>this._handleBoundaryFocus(a,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=o.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new cL(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(a=>this._handleResize(a.rows))),this._register(this._terminal.onRender(a=>this._refreshRows(a.start,a.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(a=>this._handleChar(a))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`-`))),this._register(this._terminal.onA11yTab(a=>this._handleTab(a))),this._register(this._terminal.onKey(a=>this._handleKey(a.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Re(o,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(rt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<sx+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`-`&&(this._liveRegionLineCount++,this._liveRegionLineCount===sx+1&&(this._liveRegion.textContent+=Sg.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let r=this._terminal.buffer,i=r.lines.length.toString();for(let o=e;o<=t;o++){let a=r.lines.get(r.ydisp+o),c=[],u=(a==null?void 0:a.translateToString(!0,void 0,void 0,c))||"",p=(r.ydisp+o+1).toString(),f=this._rowElements[o];f&&(u.length===0?(f.textContent=" ",this._rowColumns.set(f,[0,1])):(f.textContent=u,this._rowColumns.set(f,c)),f.setAttribute("aria-posinset",p),f.setAttribute("aria-setsize",i),this._alignRowWidth(f))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let r=e.target,i=this._rowElements[t===0?1:this._rowElements.length-2],o=r.getAttribute("aria-posinset"),a=t===0?"1":`${this._terminal.buffer.lines.length}`;if(o===a||e.relatedTarget!==i)return;let c,u;if(t===0?(c=r,u=this._rowElements.pop(),this._rowContainer.removeChild(u)):(c=this._rowElements.shift(),u=r,this._rowContainer.removeChild(c)),c.removeEventListener("focus",this._topBoundaryFocusListener),u.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let p=this._createAccessibilityTreeNode();this._rowElements.unshift(p),this._rowContainer.insertAdjacentElement("afterbegin",p)}else{let p=this._createAccessibilityTreeNode();this._rowElements.push(p),this._rowContainer.appendChild(p)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var u;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},r={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===r.node&&t.offset>r.offset)&&([t,r]=[r,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let i=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(i)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:i,offset:((u=i.textContent)==null?void 0:u.length)??0}),!this._rowContainer.contains(r.node))return;let o=({node:p,offset:f})=>{let g=p instanceof Text?p.parentNode:p,_=parseInt(g==null?void 0:g.getAttribute("aria-posinset"),10)-1;if(isNaN(_))return console.warn("row is invalid. Race condition?"),null;let y=this._rowColumns.get(g);if(!y)return console.warn("columns is null. Race condition?"),null;let x=f<y.length?y[f]:y.slice(-1)[0]+1;return x>=this._terminal.cols&&(++_,x=0),{row:_,column:x}},a=o(t),c=o(r);if(!(!a||!c)){if(a.row>c.row||a.row===c.row&&a.column>=c.column)throw new Error("invalid range");this._terminal.select(a.column,a.row,(c.row-a.row)*this._terminal.cols-a.column+c.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var o,a;e.style.transform="";let t=e.getBoundingClientRect().width,r=(a=(o=this._rowColumns.get(e))==null?void 0:o.slice(-1))==null?void 0:a[0];if(!r)return;let i=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${i/t})`}};vu=gt([fe(1,jv),fe(2,ss),fe(3,ns)],vu);var rv=class extends Ie{constructor(e,t,r,i,o){super(),this._element=e,this._mouseService=t,this._renderService=r,this._bufferService=i,this._linkProviderService=o,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new ae),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ae),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(rt(()=>{var a;An(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(a=this._activeProviderReplies)==null||a.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Re(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Re(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Re(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Re(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 r=e.composedPath();for(let i=0;i<r.length;i++){let o=r[i];if(o.classList.contains("xterm"))break;if(o.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var i,o;(!this._activeProviderReplies||!t)&&((i=this._activeProviderReplies)==null||i.forEach(a=>{a==null||a.forEach(c=>{c.link.dispose&&c.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[a,c]of this._linkProviderService.linkProviders.entries())t?(o=this._activeProviderReplies)!=null&&o.get(a)&&(r=this._checkLinkProviderResult(a,e,r)):c.provideLinks(e.y,u=>{var f,g;if(this._isMouseOut)return;let p=u==null?void 0:u.map(_=>({link:_}));(f=this._activeProviderReplies)==null||f.set(a,p),r=this._checkLinkProviderResult(a,e,r),((g=this._activeProviderReplies)==null?void 0:g.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let r=new Set;for(let i=0;i<t.size;i++){let o=t.get(i);if(o)for(let a=0;a<o.length;a++){let c=o[a],u=c.link.range.start.y<e?0:c.link.range.start.x,p=c.link.range.end.y>e?this._bufferService.cols:c.link.range.end.x;for(let f=u;f<=p;f++){if(r.has(f)){o.splice(a--,1);break}r.add(f)}}}}_checkLinkProviderResult(e,t,r){var a;if(!this._activeProviderReplies)return r;let i=this._activeProviderReplies.get(e),o=!1;for(let c=0;c<e;c++)(!this._activeProviderReplies.has(c)||this._activeProviderReplies.get(c))&&(o=!0);if(!o&&i){let c=i.find(u=>this._linkAtPosition(u.link,t));c&&(r=!0,this._handleNewLink(c))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let c=0;c<this._activeProviderReplies.size;c++){let u=(a=this._activeProviderReplies.get(c))==null?void 0:a.find(p=>this._linkAtPosition(p.link,t));if(u){r=!0,this._handleNewLink(u);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&hL(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,An(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var r,i;return(i=(r=this._currentLink)==null?void 0:r.state)==null?void 0:i.decorations.pointerCursor},set:r=>{var i;(i=this._currentLink)!=null&&i.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>{var r,i;return(i=(r=this._currentLink)==null?void 0:r.state)==null?void 0:i.decorations.underline},set:r=>{var i,o,a;(i=this._currentLink)!=null&&i.state&&((a=(o=this._currentLink)==null?void 0:o.state)==null?void 0:a.decorations.underline)!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;let i=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,o=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=o&&(this._clearCurrentLink(i,o),this._lastMouseEvent)){let a=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);a&&this._askForLink(a,!1)}})))}_linkHover(e,t,r){var i;(i=this._currentLink)!=null&&i.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(r,t.text)}_fireUnderlineEvent(e,t){let r=e.range,i=this._bufferService.buffer.ydisp,o=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-i-1,r.end.x,r.end.y-i-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(o)}_linkLeave(e,t,r){var i;(i=this._currentLink)!=null&&i.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(r,t.text)}_linkAtPosition(e,t){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,i=e.range.end.y*this._bufferService.cols+e.range.end.x,o=t.y*this._bufferService.cols+t.x;return r<=o&&o<=i}_positionFromMouseEvent(e,t,r){let i=r.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,r,i,o){return{x1:e,y1:t,x2:r,y2:i,cols:this._bufferService.cols,fg:o}}};rv=gt([fe(1,Tv),fe(2,ns),fe(3,ur),fe(4,Mb)],rv);function hL(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var uL=class extends rL{constructor(e={}){super(e),this._linkifier=this._register(new Jo),this.browser=Xb,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Jo),this._onCursorMove=this._register(new ae),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ae),this.onKey=this._onKey.event,this._onRender=this._register(new ae),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ae),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ae),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ae),this.onBell=this._onBell.event,this._onFocus=this._register(new ae),this._onBlur=this._register(new ae),this._onA11yCharEmitter=this._register(new ae),this._onA11yTabEmitter=this._register(new ae),this._onWillOpen=this._register(new ae),this._setup(),this._decorationService=this._instantiationService.createInstance(oL),this._instantiationService.setService(Ql,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(e3),this._instantiationService.setService(Mb,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(wg)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(Vt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Vt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Vt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Vt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(rt(()=>{var t,r;this._customKeyEventHandler=void 0,(r=(t=this.element)==null?void 0:t.parentNode)==null||r.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 r,i="";switch(t.index){case 256:r="foreground",i="10";break;case 257:r="background",i="11";break;case 258:r="cursor",i="12";break;default:r="ansi",i="4;"+t.index}switch(t.type){case 0:let o=Xe.toColorRGB(r==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${G.ESC}]${i};${Y3(o)}${Gb.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(a=>a.ansi[t.index]=Ct.toColor(...t.color));else{let a=r;this._themeService.modifyColors(c=>c[a]=Ct.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(vu,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(G.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(G.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 r=Math.min(this.buffer.x,this.cols-1),i=this._renderService.dimensions.css.cell.height,o=t.getWidth(r),a=this._renderService.dimensions.css.cell.width*o,c=this.buffer.y*this._renderService.dimensions.css.cell.height,u=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=u+"px",this.textarea.style.top=c+"px",this.textarea.style.width=a+"px",this.textarea.style.height=i+"px",this.textarea.style.lineHeight=i+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Re(this.element,"copy",t=>{this.hasSelection()&&gj(t,this._selectionService)}));let e=t=>vj(t,this.textarea,this.coreService,this.optionsService);this._register(Re(this.textarea,"paste",e)),this._register(Re(this.element,"paste",e)),Jb?this._register(Re(this.element,"mousedown",t=>{t.button===2&&p1(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Re(this.element,"contextmenu",t=>{p1(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),$v&&this._register(Re(this.element,"auxclick",t=>{t.button===1&&wb(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Re(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Re(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Re(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Re(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Re(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Re(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Re(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var o;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"),((o=this.element)==null?void 0:o.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Re(this.screenElement,"mousemove",a=>this.updateCursorStyle(a))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",xg.get()),tw||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(JT,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(ss,this._coreBrowserService),this._register(Re(this.textarea,"focus",a=>this._handleTextAreaFocus(a))),this._register(Re(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Ug,this._document,this._helperContainer),this._instantiationService.setService(Eu,this._charSizeService),this._themeService=this._instantiationService.createInstance(Qg),this._instantiationService.setService(ia,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(fu),this._instantiationService.setService(Lb,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(qg,this.rows,this.screenElement)),this._instantiationService.setService(ns,this._renderService),this._register(this._renderService.onRenderedViewportChange(a=>this._onRender.fire(a))),this.onResize(a=>this._renderService.resize(a.cols,a.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(zg,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Kg),this._instantiationService.setService(Tv,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(rv,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(Ag,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(a=>{super.scrollLines(a,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Vg,this.element,this.screenElement,i)),this._instantiationService.setService(Cj,this._selectionService),this._register(this._selectionService.onRequestScrollLines(a=>this.scrollLines(a.amount,a.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(a=>this._renderService.handleSelectionChanged(a.start,a.end,a.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(a=>{this.textarea.value=a,this.textarea.focus(),this.textarea.select()})),this._register(Vt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var a;this._selectionService.refresh(),(a=this._viewport)==null||a.queueSync()})),this._register(this._instantiationService.createInstance(Ng,this.screenElement)),this._register(Re(this.element,"mousedown",a=>this._selectionService.handleMouseDown(a))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(vu,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",a=>this._handleScreenReaderModeOptionChange(a))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(du,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",a=>{!this._overviewRulerRenderer&&a&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(du,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Hg,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function r(a){var f,g,_,y,x;let c=e._mouseService.getMouseReportCoords(a,e.screenElement);if(!c)return!1;let u,p;switch(a.overrideType||a.type){case"mousemove":p=32,a.buttons===void 0?(u=3,a.button!==void 0&&(u=a.button<3?a.button:3)):u=a.buttons&1?0:a.buttons&4?1:a.buttons&2?2:3;break;case"mouseup":p=0,u=a.button<3?a.button:3;break;case"mousedown":p=1,u=a.button<3?a.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(a)===!1)return!1;let S=a.deltaY;if(S===0||e.coreMouseService.consumeWheelEvent(a,(y=(_=(g=(f=e._renderService)==null?void 0:f.dimensions)==null?void 0:g.device)==null?void 0:_.cell)==null?void 0:y.height,(x=e._coreBrowserService)==null?void 0:x.dpr)===0)return!1;p=S<0?0:1,u=4;break;default:return!1}return p===void 0||u===void 0||u>4?!1:e.coreMouseService.triggerMouseEvent({col:c.col,row:c.row,x:c.x,y:c.y,button:u,action:p,ctrl:a.ctrlKey,alt:a.altKey,shift:a.shiftKey})}let i={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o={mouseup:a=>(r(a),a.buttons||(this._document.removeEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.removeEventListener("mousemove",i.mousedrag)),this.cancel(a)),wheel:a=>(r(a),this.cancel(a,!0)),mousedrag:a=>{a.buttons&&r(a)},mousemove:a=>{a.buttons||r(a)}};this._register(this.coreMouseService.onProtocolChange(a=>{a?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(a)),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()),a&8?i.mousemove||(t.addEventListener("mousemove",o.mousemove),i.mousemove=o.mousemove):(t.removeEventListener("mousemove",i.mousemove),i.mousemove=null),a&16?i.wheel||(t.addEventListener("wheel",o.wheel,{passive:!1}),i.wheel=o.wheel):(t.removeEventListener("wheel",i.wheel),i.wheel=null),a&2?i.mouseup||(i.mouseup=o.mouseup):(this._document.removeEventListener("mouseup",i.mouseup),i.mouseup=null),a&4?i.mousedrag||(i.mousedrag=o.mousedrag):(this._document.removeEventListener("mousemove",i.mousedrag),i.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Re(t,"mousedown",a=>{if(a.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(a)))return r(a),i.mouseup&&this._document.addEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.addEventListener("mousemove",i.mousedrag),this.cancel(a)})),this._register(Re(t,"wheel",a=>{var c,u,p,f,g;if(!i.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(a)===!1)return!1;if(!this.buffer.hasScrollback){if(a.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(a,(f=(p=(u=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:u.device)==null?void 0:p.cell)==null?void 0:f.height,(g=e._coreBrowserService)==null?void 0:g.dpr)===0)return this.cancel(a,!0);let _=G.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(a.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(_,!0),this.cancel(a,!0)}}},{passive:!1}))}refresh(e,t){var r;(r=this._renderService)==null||r.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){bb(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,r){this._selectionService.setSelection(e,t,r)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var r;(r=this._selectionService)==null||r.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let r=sL(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),r.type===3||r.type===2){let i=this.rows-1;return this.scrollLines(r.type===2?-i:i),this.cancel(e,!0)}if(r.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((r.key===G.ETX||r.key===G.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let r=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?r:r&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(dL(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var r;(r=this._charSizeService)==null||r.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(bt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(G.ESC+"[I"):this.coreService.triggerDataEvent(G.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${G.ESC}[4;${r};${t}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),o=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${G.ESC}[6;${o};${i}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function dL(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var fL=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let r={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(r),t.dispose=()=>this._wrappedAddonDispose(r),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){t=r;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},pL=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 Vr)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}},nx=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 pL(t)}getNullCell(){return new Vr}},gL=class extends Ie{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new ae),this.onBufferChange=this._onBufferChange.event,this._normal=new nx(this._core.buffers.normal,"normal"),this._alternate=new nx(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)}},vL=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,r=>t(r.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(r,i)=>t(r,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)}},_L=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}},mL=["cols","rows"],gi=0,yL=class extends Ie{constructor(e){super(),this._core=this._register(new uL(e)),this._addonManager=this._register(new fL),this._publicOptions={...this._core.options};let t=i=>this._core.options[i],r=(i,o)=>{this._checkReadonlyOptions(i),this._core.options[i]=o};for(let i in this._core.options){let o={get:t.bind(this,i),set:r.bind(this,i)};Object.defineProperty(this._publicOptions,i,o)}}_checkReadonlyOptions(e){if(mL.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 vL(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new _L(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 gL(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,r){this._verifyIntegers(e,t,r),this._core.select(e,t,r)}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-`,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 xg.get()},set promptLabel(e){xg.set(e)},get tooMuchOutput(){return Sg.get()},set tooMuchOutput(e){Sg.set(e)}}}_verifyIntegers(...e){for(gi of e)if(gi===1/0||isNaN(gi)||gi%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(gi of e)if(gi&&(gi===1/0||isNaN(gi)||gi%1!==0||gi<0))throw new Error("This API only accepts positive integers")}};/**- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.- * @license MIT- *- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)- * @license MIT- *- * Originally forked from (with the author's permission):- * Fabrice Bellard's javascript vt100 for jslinux:- * http://bellard.org/jslinux/- * Copyright (c) 2011 Fabrice Bellard- */var xL=2,SL=1,bL=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var _;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((_=this._terminal.options.overviewRuler)==null?void 0:_.width)||14,r=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(r.getPropertyValue("height")),o=Math.max(0,parseInt(r.getPropertyValue("width"))),a=window.getComputedStyle(this._terminal.element),c={top:parseInt(a.getPropertyValue("padding-top")),bottom:parseInt(a.getPropertyValue("padding-bottom")),right:parseInt(a.getPropertyValue("padding-right")),left:parseInt(a.getPropertyValue("padding-left"))},u=c.top+c.bottom,p=c.right+c.left,f=i-u,g=o-p-t;return{cols:Math.max(xL,Math.floor(g/e.css.cell.width)),rows:Math.max(SL,Math.floor(f/e.css.cell.height))}}};/**- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.- * @license MIT- *- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)- * @license MIT- *- * Originally forked from (with the author's permission):- * Fabrice Bellard's javascript vt100 for jslinux:- * http://bellard.org/jslinux/- * Copyright (c) 2011 Fabrice Bellard- */var wL=class{constructor(e,t,r,i={}){this._terminal=e,this._regex=t,this._handler=r,this._options=i}provideLinks(e,t){let r=kL.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(r))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(r,i)=>{if(this._options.hover){let{range:o}=t;this._options.hover(r,i,o)}},t))}};function CL(e){try{let t=new URL(e),r=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(r.toLocaleLowerCase())}catch{return!1}}var kL=class Fh{static computeLink(t,r,i,o){let a=new RegExp(r.source,(r.flags||"")+"g"),[c,u]=Fh._getWindowedLineStrings(t-1,i),p=c.join(""),f,g=[];for(;f=a.exec(p);){let _=f[0];if(!CL(_))continue;let[y,x]=Fh._mapStrIdx(i,u,0,f.index),[S,w]=Fh._mapStrIdx(i,y,x,_.length);if(y===-1||x===-1||S===-1||w===-1)continue;let C={start:{x:x+1,y:y+1},end:{x:w,y:S+1}};g.push({range:C,text:_,activate:o})}return g}static _getWindowedLineStrings(t,r){let i,o=t,a=t,c=0,u="",p=[];if(i=r.buffer.active.getLine(t)){let f=i.translateToString(!0);if(i.isWrapped&&f[0]!==" "){for(c=0;(i=r.buffer.active.getLine(--o))&&c<2048&&(u=i.translateToString(!0),c+=u.length,p.push(u),!(!i.isWrapped||u.indexOf(" ")!==-1)););p.reverse()}for(p.push(f),c=0;(i=r.buffer.active.getLine(++a))&&i.isWrapped&&c<2048&&(u=i.translateToString(!0),c+=u.length,p.push(u),u.indexOf(" ")===-1););}return[p,o]}static _mapStrIdx(t,r,i,o){let a=t.buffer.active,c=a.getNullCell(),u=i;for(;o;){let p=a.getLine(r);if(!p)return[-1,-1];for(let f=u;f<p.length;++f){p.getCell(f,c);let g=c.getChars();if(c.getWidth()&&(o-=g.length||1,f===p.length-1&&g==="")){let _=a.getLine(r+1);_&&_.isWrapped&&(_.getCell(0,c),c.getWidth()===2&&(o+=1))}if(o<0)return[r,f]}r++,u=0}return[r,u]}},EL=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function PL(e,t){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var RL=class{constructor(e=PL,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,r=t.urlRegex||EL;this._linkProvider=this._terminal.registerLinkProvider(new wL(this._terminal,r,this._handler,t))}dispose(){var e;(e=this._linkProvider)==null||e.dispose()}};function jL({sandboxId:e,onClose:t}){const r=L.useRef(null),i=L.useRef(null),o=L.useRef(null),a=L.useRef(null),c=L.useRef(null),[u,p]=L.useState("connecting"),[f,g]=L.useState("");return L.useEffect(()=>{if(!r.current)return;const _=new yL({cursorBlink:!0,fontSize:13,fontFamily:"JetBrains Mono, Menlo, Monaco, Consolas, monospace",theme:{background:"#0a0a0f",foreground:"#e4e4e7",cursor:"#818cf8",selectionBackground:"rgba(129, 140, 248, 0.3)",black:"#18181b",red:"#fb7185",green:"#34d399",yellow:"#fbbf24",blue:"#818cf8",magenta:"#c084fc",cyan:"#22d3ee",white:"#e4e4e7",brightBlack:"#52525b",brightRed:"#fda4af",brightGreen:"#6ee7b7",brightYellow:"#fde68a",brightBlue:"#a5b4fc",brightMagenta:"#d8b4fe",brightCyan:"#67e8f9",brightWhite:"#fafafa"},allowProposedApi:!0}),y=new bL,x=new RL;_.loadAddon(y),_.loadAddon(x),_.open(r.current),requestAnimationFrame(()=>{y.fit()}),i.current=_,a.current=y,_.writeln("\x1B[2m Connecting to sandbox...\x1B[0m"),(async()=>{try{const C=_.cols,E=_.rows,I=await fetch(`/api/dashboard/sessions/${e}/pty`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({cols:C,rows:E})});if(!I.ok){const W=await I.json();throw new Error(W.error||`HTTP ${I.status}`)}const{sessionId:k}=await I.json();c.current=k;const M=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/dashboard/sessions/${e}/pty/${k}`,F=new WebSocket(M);F.binaryType="arraybuffer",o.current=F,F.onopen=()=>{p("connected"),_.clear(),_.focus()},F.onmessage=W=>{const H=new Uint8Array(W.data);_.write(H)},F.onclose=()=>{p("disconnected"),_.writeln(""),_.writeln("\x1B[2m Session ended.\x1B[0m")},F.onerror=()=>{p("error"),g("WebSocket connection failed")},_.onData(W=>{F.readyState===WebSocket.OPEN&&F.send(new TextEncoder().encode(W))}),_.onResize(({cols:W,rows:H})=>{c.current&&fetch(`/api/dashboard/sessions/${e}/pty/${c.current}/resize`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({cols:W,rows:H})}).catch(()=>{})})}catch(C){p("error");const E=C instanceof Error?C.message:"Failed to connect";g(E),_.writeln(`\x1B[31m Error: ${E}\x1B[0m`)}})();const w=()=>{a.current&&a.current.fit()};return window.addEventListener("resize",w),()=>{window.removeEventListener("resize",w),o.current&&o.current.close(),_.dispose()}},[e]),h.jsxs("div",{children:[h.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[h.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--text-tertiary)"},children:[h.jsx("polyline",{points:"4 17 10 11 4 5"}),h.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]}),h.jsx("span",{style:{fontSize:11,fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Terminal"}),h.jsx("span",{style:{fontSize:10,padding:"2px 6px",borderRadius:4,background:u==="connected"?"rgba(52,211,153,0.15)":u==="connecting"?"rgba(129,140,248,0.15)":u==="error"?"rgba(251,113,133,0.15)":"rgba(255,255,255,0.05)",color:u==="connected"?"var(--accent-emerald)":u==="connecting"?"#818cf8":u==="error"?"#fb7185":"var(--text-tertiary)"},children:u})]}),t&&h.jsx("button",{onClick:t,style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",fontSize:11,padding:"4px 8px"},children:"Close"})]}),h.jsx("div",{ref:r,style:{height:350,borderRadius:8,overflow:"hidden",background:"#0a0a0f",padding:"8px 4px"}}),u==="error"&&f&&h.jsx("div",{style:{fontSize:11,color:"#fb7185",marginTop:8},children:f})]})}const Ms=3e3,TL=200,LL=40,uw=[{value:"exec_stdout",label:"stdout",color:"var(--text-secondary)"},{value:"exec_stderr",label:"stderr",color:"var(--accent-rose)"},{value:"var_log",label:"var/log",color:"#f59e0b"},{value:"agent",label:"agent",color:"var(--accent-violet)"}];function ML(e,t){const[r,i]=L.useState(e);return L.useEffect(()=>{const o=setTimeout(()=>i(e),t);return()=>clearTimeout(o)},[e,t]),r}function DL({sandboxId:e,onClose:t}){const[r,i]=L.useState(""),[o,a]=L.useState(!1),[c,u]=L.useState(new Set),[p,f]=L.useState([]),[g,_]=L.useState("connecting"),y=ML(r,TL),x=L.useRef([]),S=L.useRef(null),w=L.useRef(!0);L.useEffect(()=>{f([]),x.current=[],w.current=!0,_("connecting");const k=LP(e,{tail:!0});return k.onopen=()=>_("open"),k.onerror=()=>_("error"),k.onmessage=R=>{let M;try{M=JSON.parse(R.data)}catch{return}if(o){x.current.push(M),x.current.length>Ms&&(x.current=x.current.slice(-Ms));return}f(F=>{const W=F.length>=Ms?F.slice(F.length-Ms+1):F.slice();return W.push(M),W})},()=>{k.close(),_("closed")}},[e]),L.useEffect(()=>{if(!o&&x.current.length>0){const k=x.current;x.current=[],f(R=>{const M=R.concat(k);return M.length>Ms?M.slice(M.length-Ms):M})}},[o]),L.useEffect(()=>{if(!w.current)return;const k=S.current;k&&(k.scrollTop=k.scrollHeight)},[p]);const C=()=>{const k=S.current;if(!k)return;const R=k.scrollHeight-k.scrollTop-k.clientHeight;w.current=R<=LL},E=k=>{u(R=>{const M=new Set(R);return M.has(k)?M.delete(k):M.add(k),M})},I=L.useMemo(()=>{const k=y.trim().toLowerCase(),R=new Set,M=[];for(const F of p){if(F.line===""&&F.exit_code!==void 0&&F.exec_id){if(R.has(F.exec_id))continue;R.add(F.exec_id)}M.push(F)}return M.filter(F=>!(c.has(F.source)||k&&!OL(F).includes(k)))},[p,c,y]);return h.jsxs("div",{style:{display:"flex",flexDirection:"column",height:480},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:12,flexWrap:"wrap"},children:[h.jsx("div",{style:{fontSize:11,fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Logs"}),h.jsx(BL,{state:g}),h.jsxs("div",{style:{flex:1,minWidth:160,position:"relative"},children:[h.jsx("input",{type:"text",value:r,onChange:k=>i(k.target.value),placeholder:"Search…",style:{width:"100%",boxSizing:"border-box",background:"var(--bg-deep)",border:"1px solid var(--border-subtle)",borderRadius:"var(--radius-sm)",color:"var(--text-primary)",fontSize:13,padding:"6px 28px 6px 10px",fontFamily:"inherit"}}),r&&h.jsx("button",{type:"button",onClick:()=>i(""),"aria-label":"Clear search",title:"Clear",style:{position:"absolute",right:6,top:"50%",transform:"translateY(-50%)",background:"none",border:"none",padding:4,cursor:"pointer",color:"var(--text-tertiary)",display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:0,opacity:.7,transition:"opacity 0.1s"},onMouseEnter:k=>k.currentTarget.style.opacity="1",onMouseLeave:k=>k.currentTarget.style.opacity="0.7",children:h.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",children:[h.jsx("line",{x1:"2",y1:"2",x2:"10",y2:"10"}),h.jsx("line",{x1:"10",y1:"2",x2:"2",y2:"10"})]})})]}),h.jsx("div",{style:{display:"flex",gap:4},children:uw.map(k=>{const R=!c.has(k.value),M=`color-mix(in srgb, ${k.color} 18%, transparent)`;return h.jsx("button",{onClick:()=>E(k.value),title:R?`Hide ${k.label}`:`Show ${k.label}`,style:{background:R?M:"transparent",color:k.color,border:`1px solid ${k.color}`,borderRadius:"var(--radius-sm)",fontSize:11,fontWeight:R?600:400,opacity:R?1:.45,padding:"3px 8px",cursor:"pointer",fontFamily:"var(--font-mono)",transition:"background 0.1s, opacity 0.1s"},children:k.label},k.value)})}),h.jsxs("button",{onClick:()=>a(k=>!k),className:"btn-ghost",title:o?"Resume live tail":"Pause display (stream keeps running)",children:[o?"Resume":"Pause",o&&x.current.length>0&&h.jsxs("span",{style:{marginLeft:6,color:"var(--text-tertiary)"},children:["(",x.current.length," buffered)"]})]}),t&&h.jsx("button",{onClick:t,className:"btn-ghost",title:"Close logs",children:"Close"})]}),h.jsxs("div",{ref:S,onScroll:C,style:{flex:1,background:"var(--bg-deep)",border:"1px solid var(--border-subtle)",borderRadius:"var(--radius-sm)",padding:"8px 0",overflowY:"auto",fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.45},children:[I.length===0&&g==="open"&&h.jsxs("div",{style:{padding:"20px",textAlign:"center",color:"var(--text-tertiary)"},children:["No logs yet. Run a command, write to ",h.jsx("code",{children:"/var/log/..."}),", or wait for system activity."]}),I.length===0&&g==="error"&&h.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--accent-rose)"},children:"Couldn't connect to log stream. Logs may not be configured for this deployment."}),I.map((k,R)=>h.jsx(IL,{ev:k},R))]}),I.length>=Ms&&h.jsxs("div",{style:{marginTop:6,fontSize:11,color:"var(--text-tertiary)"},children:["Showing latest ",Ms," events; older events scrolled off."]})]})}function BL({state:e}){const t=e==="open"?"var(--accent-emerald, #10b981)":e==="error"?"var(--accent-rose)":"var(--text-tertiary)";return h.jsx("span",{title:`Connection: ${e}`,style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:t}})}function IL({ev:e}){const t=uw.find(a=>a.value===e.source),r=(t==null?void 0:t.color)||"var(--text-tertiary)",i=FL(e._time),o={display:"flex",gap:10,padding:"1px 14px",borderLeft:`3px solid ${r}`,paddingLeft:11};if(e.line===""&&e.exit_code!==void 0){const a=e.exit_code===0;return h.jsxs("div",{style:{...o,padding:"2px 14px 2px 11px",color:a?"var(--accent-emerald, #10b981)":"var(--accent-rose)",fontStyle:"italic",opacity:.85},children:[h.jsx("span",{style:{color:"var(--text-tertiary)",fontStyle:"normal"},children:i}),h.jsxs("span",{children:[a?"✓":"✗"," ",e.command||"command"," exited ",e.exit_code]})]})}return h.jsxs("div",{style:{...o,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:[h.jsx("span",{style:{color:"var(--text-tertiary)",flexShrink:0},children:i}),h.jsx("span",{style:{color:r,flexShrink:0,minWidth:56,fontSize:11,paddingTop:1},children:(t==null?void 0:t.label)||e.source}),h.jsx("span",{style:{color:"var(--text-primary)",flex:1},children:e.line})]})}function OL(e){if(e.line===""&&e.exit_code!==void 0){const t=e.command||"command",r=e.argv?e.argv.join(" "):"";return`${t} ${r} exited ${e.exit_code}`.toLowerCase()}return e.line.toLowerCase()}function FL(e){const t=new Date(e);if(isNaN(t.getTime()))return"";const r=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0"),o=String(t.getSeconds()).padStart(2,"0"),a=String(t.getMilliseconds()).padStart(3,"0");return`${r}:${i}:${o}.${a}`}function $L({status:e}){const t=e==="running"?"badge-running":e==="stopped"?"badge-stopped":e==="hibernated"?"badge-hibernated":e==="error"?"badge-error":"";return h.jsx("span",{className:`status-badge ${t}`,children:e})}function ll(e){if(e===0)return"0 B";const t=["B","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(1024));return`${(e/Math.pow(1024,r)).toFixed(r>0?1:0)} ${t[r]}`}function AL(e){const t=Date.now()-new Date(e).getTime(),r=Math.floor(t/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const i=Math.floor(r/60);return i<24?`${i}h ${r%60}m ago`:`${Math.floor(i/24)}d ago`}function Ch({label:e,value:t,sub:r}){return h.jsxs("div",{style:{background:"rgba(255,255,255,0.02)",border:"1px solid var(--border-subtle)",borderRadius:"var(--radius-md)",padding:"16px 20px",flex:1},children:[h.jsx("div",{style:{fontSize:11,fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:6},children:e}),h.jsx("div",{style:{fontSize:22,fontWeight:700,color:"var(--text-primary)"},children:t}),r&&h.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginTop:2},children:r})]})}function NL(){var M,F,W;const{sandboxId:e}=Ax(),t=ji(),r=Gr(),[i,o]=L.useState(null),[a,c]=L.useState(!1),[u,p]=L.useState(!1),[f,g]=L.useState(!1),[_,y]=L.useState("idle"),[x,S]=L.useState(null),w=async()=>{if(_==="idle"&&confirm(`Reboot this sandbox?--The guest kernel will restart. Running processes are killed; workspace data is preserved. Takes a few seconds.`)){y("rebooting"),S(null);try{await cb(e),r.invalidateQueries({queryKey:["session-detail",e]}),r.invalidateQueries({queryKey:["session-stats",e]})}catch(H){S(H instanceof Error?H.message:String(H))}finally{y("idle")}}},C=async()=>{if(_==="idle"&&confirm(`Power-cycle this sandbox?--The QEMU process is destroyed and recreated with the same disks. Use this if a regular reboot didn't recover. Workspace data is preserved; takes ~30 seconds.`)){y("power-cycling"),S(null);try{await TP(e),r.invalidateQueries({queryKey:["session-detail",e]}),r.invalidateQueries({queryKey:["session-stats",e]})}catch(H){S(H instanceof Error?H.message:String(H))}finally{y("idle")}}},{data:E,isLoading:I}=Nt({queryKey:["session-detail",e],queryFn:()=>RP(e),enabled:!!e}),{data:k}=Nt({queryKey:["session-stats",e],queryFn:()=>jP(e),enabled:!!e&&(E==null?void 0:E.status)==="running",refetchInterval:5e3,retry:!1}),R=(H,K)=>{navigator.clipboard.writeText(`https://${H}`),o(K),setTimeout(()=>o(null),2e3)};return I?h.jsx("div",{style:{display:"flex",justifyContent:"center",padding:80},children:h.jsx("div",{className:"loading-spinner"})}):E?h.jsxs("div",{children:[h.jsxs("button",{onClick:()=>t("/sessions"),style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",fontSize:13,padding:0,marginBottom:20,display:"flex",alignItems:"center",gap:6},children:[h.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("path",{d:"M19 12H5"}),h.jsx("polyline",{points:"12 19 5 12 12 5"})]}),"Back to Sessions"]}),h.jsxs("div",{className:"glass-card animate-in",style:{padding:24,marginBottom:16},children:[h.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[h.jsxs("div",{children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:8},children:[h.jsx("code",{style:{fontSize:20,fontWeight:700,fontFamily:"var(--font-mono)",color:"var(--text-primary)"},children:E.sandboxId}),h.jsx($L,{status:E.status})]}),h.jsxs("div",{style:{fontSize:13,color:"var(--text-tertiary)"},children:[E.template||"base"," · Started ",AL(E.startedAt)]})]}),h.jsxs("div",{style:{display:"flex",gap:8},children:[h.jsxs("button",{className:u?"btn-primary":"btn-ghost",onClick:()=>p(!u),title:"Live logs from /var/log + every exec'd command",children:[h.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),h.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),h.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),h.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),h.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),h.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Logs"]}),E.status==="running"&&h.jsxs(h.Fragment,{children:[h.jsxs("button",{className:a?"btn-primary":"btn-ghost",onClick:()=>c(!a),children:[h.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("polyline",{points:"4 17 10 11 4 5"}),h.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]}),"Terminal"]}),h.jsxs("button",{className:"btn-ghost",onClick:w,disabled:_!=="idle",title:"Soft restart: kernel reboots, workspace preserved",children:[h.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("polyline",{points:"23 4 23 10 17 10"}),h.jsx("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]}),_==="rebooting"?"Rebooting…":"Reboot"]}),h.jsxs("button",{className:"btn-ghost",onClick:C,disabled:_!=="idle",title:"Hard restart: rebuilds VM, workspace preserved. Use if reboot didn't recover.",children:[h.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("path",{d:"M18.36 6.64a9 9 0 1 1-12.73 0"}),h.jsx("line",{x1:"12",y1:"2",x2:"12",y2:"12"})]}),_==="power-cycling"?"Power-cycling…":"Power Cycle"]})]})]})]}),x&&h.jsxs("div",{style:{marginTop:12,padding:"10px 14px",background:"rgba(239,68,68,0.08)",border:"1px solid rgba(239,68,68,0.3)",borderRadius:"var(--radius-sm)",color:"var(--text-error, #f87171)",fontSize:13},children:["Reset failed: ",x]})]}),a&&E.status==="running"&&h.jsx("div",{className:"glass-card animate-in",style:{padding:20,marginBottom:16},children:h.jsx(jL,{sandboxId:e,onClose:()=>c(!1)})}),u&&h.jsx("div",{className:"glass-card animate-in",style:{padding:20,marginBottom:16},children:h.jsx(DL,{sandboxId:e,onClose:()=>p(!1)})}),E.status==="running"&&h.jsxs("div",{className:"glass-card animate-in stagger-1",style:{padding:20,marginBottom:16},children:[h.jsx("div",{style:{fontSize:11,fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:14},children:"Resource Usage"}),h.jsxs("div",{style:{display:"flex",gap:12},children:[h.jsx(Ch,{label:"CPU",value:k?`${k.cpuPercent.toFixed(1)}%`:"—"}),h.jsx(Ch,{label:"Memory",value:k?ll(k.memUsage):"—",sub:k?`of ${ll(k.memLimit)}`:void 0}),h.jsx(Ch,{label:"Processes",value:k?String(k.pids):"—"}),h.jsx(Ch,{label:"Network",value:k?`↑${ll(k.netOutput)}`:"—",sub:k?`↓${ll(k.netInput)}`:void 0})]})]}),E.previewUrls&&E.previewUrls.length>0&&(()=>{const H=E.previewUrls.some(K=>K.customHostname);return h.jsxs("div",{className:"glass-card animate-in stagger-2",style:{padding:20,marginBottom:16},children:[h.jsx("div",{style:{fontSize:11,fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:10},children:"Preview URLs"}),h.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:E.previewUrls.map(K=>{const ie=K.customHostname||K.hostname;return h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[h.jsxs("div",{style:{minWidth:60,fontSize:12,fontWeight:600,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:[":",K.port]}),h.jsx("div",{style:{flex:1,background:"var(--bg-deep)",border:"1px solid var(--border-subtle)",borderRadius:"var(--radius-sm)",padding:"10px 14px",fontFamily:"var(--font-mono)",fontSize:13,color:"var(--text-accent)"},children:h.jsxs("a",{href:`https://${ie}`,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--text-accent)",textDecoration:"none"},children:["https://",ie]})}),h.jsx("button",{className:"btn-ghost",onClick:()=>R(ie,`${K.port}`),style:{whiteSpace:"nowrap"},children:i===`${K.port}`?"Copied":"Copy"})]},K.id)})}),H&&h.jsxs("div",{style:{marginTop:12},children:[h.jsxs("button",{onClick:()=>g(!f),style:{background:"none",border:"none",cursor:"pointer",padding:0,fontSize:11,color:"var(--text-tertiary)",display:"flex",alignItems:"center",gap:4},children:[h.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:f?"rotate(90deg)":"none",transition:"transform 0.15s"},children:h.jsx("polyline",{points:"9 18 15 12 9 6"})}),"Internal URLs"]}),f&&h.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6,marginTop:8},children:E.previewUrls.map(K=>h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[h.jsxs("div",{style:{minWidth:60,fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:[":",K.port]}),h.jsx("div",{style:{flex:1,background:"var(--bg-deep)",border:"1px solid var(--border-subtle)",borderRadius:"var(--radius-sm)",padding:"8px 12px",fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-tertiary)"},children:h.jsxs("a",{href:`https://${K.hostname}`,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--text-tertiary)",textDecoration:"none"},children:["https://",K.hostname]})}),h.jsx("button",{className:"btn-ghost",onClick:()=>R(K.hostname,`int-${K.port}`),style:{whiteSpace:"nowrap",fontSize:11},children:i===`int-${K.port}`?"Copied":"Copy"})]},`int-${K.id}`))})]})]})})(),h.jsxs("div",{className:"glass-card animate-in stagger-3",style:{padding:20,marginBottom:16},children:[h.jsx("div",{style:{fontSize:11,fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:14},children:"Details"}),h.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px 32px"},children:[h.jsx(Hi,{label:"Template",value:E.template||"base"}),h.jsx(Hi,{label:"Timeout",value:(M=E.config)!=null&&M.timeout?`${E.config.timeout}s`:"300s"}),h.jsx(Hi,{label:"CPUs",value:String(((F=E.config)==null?void 0:F.cpuCount)??1)}),h.jsx(Hi,{label:"Memory",value:`${((W=E.config)==null?void 0:W.memoryMB)??512} MB`}),h.jsx(Hi,{label:"Started",value:new Date(E.startedAt).toLocaleString()}),E.stoppedAt&&h.jsx(Hi,{label:"Stopped",value:new Date(E.stoppedAt).toLocaleString()}),E.errorMsg&&h.jsx(Hi,{label:"Error",value:E.errorMsg,isError:!0})]})]}),E.checkpoint&&h.jsxs("div",{className:"glass-card animate-in stagger-4",style:{padding:20},children:[h.jsx("div",{style:{fontSize:11,fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:14},children:"Checkpoint"}),h.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px 32px"},children:[h.jsx(Hi,{label:"Size",value:ll(E.checkpoint.sizeBytes)}),h.jsx(Hi,{label:"Hibernated",value:new Date(E.checkpoint.hibernatedAt).toLocaleString()})]})]})]}):h.jsx("div",{style:{padding:40,textAlign:"center",color:"var(--text-tertiary)"},children:"Session not found"})}function Hi({label:e,value:t,isError:r}){return h.jsxs("div",{children:[h.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginBottom:2},children:e}),h.jsx("div",{style:{fontSize:13,fontFamily:"var(--font-mono)",color:r?"var(--accent-rose)":"var(--text-primary)",wordBreak:"break-all"},children:t})]})}function zL(){return h.jsx(sR,{children:h.jsxs(q2,{children:[h.jsx(sr,{path:"/login",element:h.jsx(lR,{})}),h.jsx(sr,{element:h.jsx(nR,{}),children:h.jsxs(sr,{element:h.jsx(aR,{}),children:[h.jsx(sr,{index:!0,element:h.jsx(cR,{})}),h.jsx(sr,{path:"sessions",element:h.jsx(yR,{})}),h.jsx(sr,{path:"sessions/:sandboxId",element:h.jsx(NL,{})}),h.jsx(sr,{path:"agents",element:h.jsx(wR,{})}),h.jsx(sr,{path:"agents/:agentId",element:h.jsx(MR,{})}),h.jsx(sr,{path:"checkpoints",element:h.jsx(ZR,{})}),h.jsx(sr,{path:"templates",element:h.jsx(rj,{})}),h.jsx(sr,{path:"api-keys",element:h.jsx(JR,{})}),h.jsx(sr,{path:"billing",element:h.jsx(oj,{})}),h.jsx(sr,{path:"settings",element:h.jsx(ij,{})})]})}),h.jsx(sr,{path:"*",element:h.jsx(Hx,{to:"/",replace:!0})})]})})}const WL=new Wk({defaultOptions:{queries:{retry:1,staleTime:3e4}}});mk.createRoot(document.getElementById("root")).render(h.jsx(Is.StrictMode,{children:h.jsx(_P,{client:Cu,children:h.jsx(Hk,{client:WL,children:h.jsx(eE,{children:h.jsx(zL,{})})})})}));diff --git a/cloudflare-workers/api-edge/assets/assets/index-_SFtweev.css b/cloudflare-workers/api-edge/assets/assets/index-_SFtweev.cssdeleted file mode 100644index f7d9fa8b..00000000--- a/cloudflare-workers/api-edge/assets/assets/index-_SFtweev.css+++ /dev/null@@ -1,32 +0,0 @@-/**- * Copyright (c) 2014 The xterm.js authors. All rights reserved.- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)- * https://github.com/chjj/term.js- * @license MIT- *- * Permission is hereby granted, free of charge, to any person obtaining a copy- * of this software and associated documentation files (the "Software"), to deal- * in the Software without restriction, including without limitation the rights- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell- * copies of the Software, and to permit persons to whom the Software is- * furnished to do so, subject to the following conditions:- *- * The above copyright notice and this permission notice shall be included in- * all copies or substantial portions of the Software.- *- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN- * THE SOFTWARE.- *- * Originally forked from (with the author's permission):- * Fabrice Bellard's javascript vt100 for jslinux:- * http://bellard.org/jslinux/- * Copyright (c) 2011 Fabrice Bellard- * The original design remains. The terminal itself- * has been extended to include xterm CSI codes, among- * other features.- */.xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;right:0;left:0;top:0;bottom:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{font-family:monospace;-webkit-user-select:text;user-select:text;white-space:pre}.xterm .xterm-accessibility-tree>div{transform-origin:left;width:fit-content}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;background:#0000;transition:opacity .1s linear;z-index:11}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{position:absolute;display:none}.xterm .xterm-scrollable-element>.shadow.top{display:block;top:0;left:3px;height:3px;width:100%;box-shadow:var(--vscode-scrollbar-shadow, #000) 0 6px 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.left{display:block;top:3px;left:0;height:100%;width:3px;box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.top-left-corner{display:block;top:0;left:0;height:3px;width:3px}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}:root{--bg-void: #08080c;--bg-deep: #0c0c12;--bg-surface: #111118;--bg-card: rgba(17, 17, 24, .65);--bg-elevated: #18182200;--bg-hover: rgba(99, 102, 241, .05);--border-subtle: rgba(255, 255, 255, .06);--border-default: rgba(255, 255, 255, .08);--border-accent: rgba(129, 140, 248, .22);--border-glow: rgba(129, 140, 248, .4);--text-primary: #ededf0;--text-secondary: #8585a0;--text-tertiary: #4e4e64;--text-accent: #a5b4fc;--accent-indigo: #818cf8;--accent-violet: #a78bfa;--accent-emerald: #34d399;--accent-cyan: #22d3ee;--accent-amber: #fbbf24;--accent-rose: #fb7185;--accent-pink: #f472b6;--gradient-primary: linear-gradient(135deg, #6366f1, #818cf8);--gradient-surface: linear-gradient(180deg, rgba(255,255,255,.025) 0%, transparent 100%);--shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);--shadow-md: 0 4px 16px rgba(0, 0, 0, .35);--shadow-glow: 0 0 24px rgba(99, 102, 241, .12);--radius-sm: 6px;--radius-md: 10px;--radius-lg: 14px;--radius-xl: 20px;--font-display: "Outfit", sans-serif;--font-body: "DM Sans", sans-serif;--font-mono: "JetBrains Mono", monospace}*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}html{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}body{font-family:var(--font-body);background:var(--bg-void);color:var(--text-primary);line-height:1.5}body:before{content:"";position:fixed;top:0;right:0;bottom:0;left:0;background-image:radial-gradient(circle,rgba(99,102,241,.035) 1px,transparent 1px);background-size:28px 28px;pointer-events:none;z-index:0}#root{position:relative;z-index:1}::-webkit-scrollbar{width:5px;height:5px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:#ffffff14;border-radius:4px}::-webkit-scrollbar-thumb:hover{background:#ffffff24}.glass-card{background:var(--bg-card);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);border:1px solid var(--border-subtle);border-radius:var(--radius-lg);background-image:var(--gradient-surface);transition:border-color .25s ease,box-shadow .25s ease}.glass-card:hover{border-color:var(--border-accent);box-shadow:var(--shadow-glow)}.stat-card{position:relative;background:var(--bg-surface);background-image:var(--gradient-surface);border:1px solid var(--border-subtle);border-radius:var(--radius-lg);padding:22px 24px;overflow:hidden;transition:all .3s cubic-bezier(.16,1,.3,1)}.stat-card:after{content:"";position:absolute;bottom:0;left:0;right:0;height:2px;background:var(--gradient-primary);opacity:0;transition:opacity .3s ease}.stat-card:hover{transform:translateY(-3px);border-color:var(--border-accent);box-shadow:var(--shadow-glow)}.stat-card:hover:after{opacity:1}@keyframes fadeInUp{0%{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}@keyframes pulseDot{0%,to{opacity:1;transform:scale(1)}50%{opacity:.35;transform:scale(.85)}}@keyframes shimmer{0%{background-position:-200% center}to{background-position:200% center}}@keyframes spin{to{transform:rotate(360deg)}}@keyframes subtleFloat{0%,to{transform:translateY(0)}50%{transform:translateY(-6px)}}.animate-in{animation:fadeInUp .55s cubic-bezier(.16,1,.3,1) forwards}.stagger-1{animation-delay:.04s;opacity:0}.stagger-2{animation-delay:.1s;opacity:0}.stagger-3{animation-delay:.16s;opacity:0}.stagger-4{animation-delay:.22s;opacity:0}.stagger-5{animation-delay:.28s;opacity:0}.pulse-dot{animation:pulseDot 2.2s ease-in-out infinite}.badge{display:inline-flex;align-items:center;gap:6px;font-size:11px;padding:3px 10px;border-radius:20px;font-weight:500;letter-spacing:.03em}.badge-running{background:#34d3991a;color:#34d399;border:1px solid rgba(52,211,153,.18)}.badge-stopped{background:#8585a01a;color:#8585a0;border:1px solid rgba(133,133,160,.15)}.badge-error{background:#fb71851a;color:#fb7185;border:1px solid rgba(251,113,133,.18)}.badge-hibernated{background:#22d3ee1a;color:#22d3ee;border:1px solid rgba(34,211,238,.18)}.data-table{width:100%;border-collapse:separate;border-spacing:0}.data-table thead th{text-align:left;padding:14px 16px;font-size:10px;font-weight:600;color:var(--text-tertiary);text-transform:uppercase;letter-spacing:.1em;border-bottom:1px solid var(--border-subtle);font-family:var(--font-body)}.data-table tbody tr{transition:background .15s ease}.data-table tbody tr:hover{background:var(--bg-hover)}.data-table tbody td{padding:13px 16px;font-size:13px;color:var(--text-secondary);border-bottom:1px solid rgba(255,255,255,.025)}.data-table tbody td code{font-family:var(--font-mono);font-size:12px;color:var(--text-accent);background:#6366f112;padding:2px 7px;border-radius:4px}.btn-primary{display:inline-flex;align-items:center;gap:6px;padding:9px 22px;background:var(--gradient-primary);color:#fff;border:none;border-radius:var(--radius-sm);cursor:pointer;font-size:13px;font-weight:600;font-family:var(--font-body);letter-spacing:.01em;transition:all .2s ease}.btn-primary:hover{box-shadow:0 0 24px #6366f14d;transform:translateY(-1px)}.btn-primary:disabled{opacity:.45;cursor:default;transform:none;box-shadow:none}.btn-ghost{display:inline-flex;align-items:center;gap:6px;padding:9px 18px;background:transparent;color:var(--text-secondary);border:1px solid var(--border-subtle);border-radius:var(--radius-sm);cursor:pointer;font-size:13px;font-weight:500;font-family:var(--font-body);transition:all .2s ease}.btn-ghost:hover{border-color:var(--border-accent);color:var(--text-primary);background:var(--bg-hover)}.btn-danger{display:inline-flex;align-items:center;padding:5px 14px;background:#fb718512;color:var(--accent-rose);border:1px solid rgba(251,113,133,.14);border-radius:var(--radius-sm);cursor:pointer;font-size:12px;font-weight:500;font-family:var(--font-body);transition:all .2s ease}.btn-danger:hover{background:#fb718524;border-color:#fb718547}.filter-btn{padding:5px 16px;border-radius:20px;border:1px solid var(--border-subtle);background:transparent;color:var(--text-secondary);cursor:pointer;font-size:12px;font-weight:500;font-family:var(--font-body);transition:all .2s ease}.filter-btn:hover{border-color:var(--border-accent);color:var(--text-primary)}.filter-btn.active{background:#6366f11a;border-color:#6366f147;color:var(--accent-indigo)}.input{width:100%;padding:10px 14px;background:var(--bg-deep);border:1px solid var(--border-subtle);border-radius:var(--radius-sm);color:var(--text-primary);font-size:14px;font-family:var(--font-body);outline:none;transition:border-color .2s ease,box-shadow .2s ease}.input:focus{border-color:var(--accent-indigo);box-shadow:0 0 0 3px #6366f114}.input::placeholder{color:var(--text-tertiary)}.loading-spinner{width:22px;height:22px;border:2px solid var(--border-subtle);border-top-color:var(--accent-indigo);border-radius:50%;animation:spin .75s linear infinite}.recharts-cartesian-grid-horizontal line,.recharts-cartesian-grid-vertical line{stroke:#ffffff09!important}.recharts-text{fill:var(--text-tertiary)!important;font-family:var(--font-mono)!important;font-size:10px!important}.recharts-tooltip-wrapper{outline:none!important}.metric-value{font-family:var(--font-mono);font-variant-numeric:tabular-nums;letter-spacing:-.03em}.section-title{font-family:var(--font-display);font-size:11px;font-weight:600;color:var(--text-tertiary);text-transform:uppercase;letter-spacing:.1em;margin-bottom:16px}.page-title{font-size:26px;font-weight:700;font-family:var(--font-display);letter-spacing:-.03em;color:var(--text-primary);margin-bottom:4px}.page-subtitle{font-size:13px;color:var(--text-tertiary);margin-bottom:0}@media(max-width:1100px){.grid-stats{grid-template-columns:repeat(2,1fr)!important}.grid-charts-main,.grid-charts-secondary{grid-template-columns:1fr!important}}diff --git a/cloudflare-workers/api-edge/assets/index.html b/cloudflare-workers/api-edge/assets/index.htmldeleted file mode 100644index d2309096..00000000--- a/cloudflare-workers/api-edge/assets/index.html+++ /dev/null@@ -1,19 +0,0 @@-<!doctype html>-<html lang="en">- <head>- <meta charset="UTF-8" />- <meta name="viewport" content="width=device-width, initial-scale=1.0" />- <title>OpenComputer</title>- <link rel="preconnect" href="https://fonts.googleapis.com" />- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />- <link- href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300..700;1,9..40,300..700&family=JetBrains+Mono:wght@400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap"- rel="stylesheet"- />- <script type="module" crossorigin src="/assets/index-DquMJ_wD.js"></script>- <link rel="stylesheet" crossorigin href="/assets/index-_SFtweev.css">- </head>- <body>- <div id="root"></div>- </body>-</html>