0pflow 0.1.0-dev.6c5c92a → 0.1.0-dev.76a002f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__tests__/factory.test.js +6 -0
- package/dist/__tests__/factory.test.js.map +1 -1
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +16 -1
- package/dist/agent.js.map +1 -1
- package/dist/cli/deploy.d.ts +27 -0
- package/dist/cli/deploy.d.ts.map +1 -0
- package/dist/cli/deploy.js +332 -0
- package/dist/cli/deploy.js.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +35 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/install.d.ts +67 -0
- package/dist/cli/install.d.ts.map +1 -0
- package/dist/cli/install.js +270 -0
- package/dist/cli/install.js.map +1 -0
- package/dist/cli/mcp/lib/scaffolding.d.ts.map +1 -1
- package/dist/cli/mcp/lib/scaffolding.js +13 -33
- package/dist/cli/mcp/lib/scaffolding.js.map +1 -1
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +270 -101
- package/dist/cli/run.js.map +1 -1
- package/dist/connections/cloud-auth.d.ts.map +1 -1
- package/dist/connections/cloud-auth.js +5 -1
- package/dist/connections/cloud-auth.js.map +1 -1
- package/dist/connections/cloud-integration-provider.d.ts +1 -0
- package/dist/connections/cloud-integration-provider.d.ts.map +1 -1
- package/dist/connections/cloud-integration-provider.js +16 -1
- package/dist/connections/cloud-integration-provider.js.map +1 -1
- package/dist/connections/connection-labels.d.ts +14 -0
- package/dist/connections/connection-labels.d.ts.map +1 -0
- package/dist/connections/connection-labels.js +46 -0
- package/dist/connections/connection-labels.js.map +1 -0
- package/dist/connections/index.d.ts +1 -0
- package/dist/connections/index.d.ts.map +1 -1
- package/dist/connections/index.js +1 -0
- package/dist/connections/index.js.map +1 -1
- package/dist/connections/integration-provider.d.ts +1 -0
- package/dist/connections/integration-provider.d.ts.map +1 -1
- package/dist/connections/local-integration-provider.d.ts +1 -0
- package/dist/connections/local-integration-provider.d.ts.map +1 -1
- package/dist/connections/local-integration-provider.js +17 -1
- package/dist/connections/local-integration-provider.js.map +1 -1
- package/dist/dev-ui/deploy-api.d.ts +14 -0
- package/dist/dev-ui/deploy-api.d.ts.map +1 -0
- package/dist/dev-ui/deploy-api.js +112 -0
- package/dist/dev-ui/deploy-api.js.map +1 -0
- package/dist/dev-ui/dev-server.d.ts.map +1 -1
- package/dist/dev-ui/dev-server.js +46 -2
- package/dist/dev-ui/dev-server.js.map +1 -1
- package/dist/dev-ui/watcher.d.ts.map +1 -1
- package/dist/dev-ui/watcher.js +6 -2
- package/dist/dev-ui/watcher.js.map +1 -1
- package/dist/dev-ui-client/assets/index-BO7ghj1c.css +32 -0
- package/dist/dev-ui-client/assets/index-goWlzKQw.js +125 -0
- package/dist/dev-ui-client/index.html +5 -2
- package/dist/discover.d.ts.map +1 -1
- package/dist/discover.js +5 -2
- package/dist/discover.js.map +1 -1
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +12 -1
- package/dist/factory.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/registry-gen.d.ts +6 -0
- package/dist/registry-gen.d.ts.map +1 -0
- package/dist/registry-gen.js +146 -0
- package/dist/registry-gen.js.map +1 -0
- package/dist/workflow.d.ts.map +1 -1
- package/dist/workflow.js +16 -1
- package/dist/workflow.js.map +1 -1
- package/package.json +3 -2
- package/templates/app/.dockerignore +6 -0
- package/templates/app/Dockerfile +34 -0
- package/templates/app/generated/registry.ts +8 -0
- package/templates/app/next.config.js +4 -1
- package/templates/app/package.json +2 -0
- package/templates/app/src/lib/pflow.ts +5 -6
- package/dist/dev-ui-client/assets/index-C-LxzUII.css +0 -32
- package/dist/dev-ui-client/assets/index-aAIwXl4O.js +0 -127
- package/dist/version.d.ts +0 -6
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js +0 -7
- package/dist/version.js.map +0 -1
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function s(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(o){if(o.ep)return;o.ep=!0;const l=s(o);fetch(o.href,l)}})();function US(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var fd={exports:{}},_a={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var cv;function TC(){if(cv)return _a;cv=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function s(r,o,l){var u=null;if(l!==void 0&&(u=""+l),o.key!==void 0&&(u=""+o.key),"key"in o){l={};for(var h in o)h!=="key"&&(l[h]=o[h])}else l=o;return o=l.ref,{$$typeof:e,type:r,key:u,ref:o!==void 0?o:null,props:l}}return _a.Fragment=t,_a.jsx=s,_a.jsxs=s,_a}var uv;function AC(){return uv||(uv=1,fd.exports=TC()),fd.exports}var T=AC(),dd={exports:{}},Me={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react.production.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var hv;function NC(){if(hv)return Me;hv=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),v=Symbol.iterator;function S(R){return R===null||typeof R!="object"?null:(R=v&&R[v]||R["@@iterator"],typeof R=="function"?R:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,x={};function C(R,W,ee){this.props=R,this.context=W,this.refs=x,this.updater=ee||y}C.prototype.isReactComponent={},C.prototype.setState=function(R,W){if(typeof R!="object"&&typeof R!="function"&&R!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,R,W,"setState")},C.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function A(){}A.prototype=C.prototype;function E(R,W,ee){this.props=R,this.context=W,this.refs=x,this.updater=ee||y}var D=E.prototype=new A;D.constructor=E,b(D,C.prototype),D.isPureReactComponent=!0;var H=Array.isArray;function O(){}var P={H:null,A:null,T:null,S:null},V=Object.prototype.hasOwnProperty;function G(R,W,ee){var te=ee.ref;return{$$typeof:e,type:R,key:W,ref:te!==void 0?te:null,props:ee}}function ne(R,W){return G(R.type,W,R.props)}function X(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function $(R){var W={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(ee){return W[ee]})}var q=/\/+/g;function N(R,W){return typeof R=="object"&&R!==null&&R.key!=null?$(""+R.key):W.toString(36)}function z(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(O,O):(R.status="pending",R.then(function(W){R.status==="pending"&&(R.status="fulfilled",R.value=W)},function(W){R.status==="pending"&&(R.status="rejected",R.reason=W)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function M(R,W,ee,te,le){var ce=typeof R;(ce==="undefined"||ce==="boolean")&&(R=null);var he=!1;if(R===null)he=!0;else switch(ce){case"bigint":case"string":case"number":he=!0;break;case"object":switch(R.$$typeof){case e:case t:he=!0;break;case p:return he=R._init,M(he(R._payload),W,ee,te,le)}}if(he)return le=le(R),he=te===""?"."+N(R,0):te,H(le)?(ee="",he!=null&&(ee=he.replace(q,"$&/")+"/"),M(le,W,ee,"",function(Ce){return Ce})):le!=null&&(X(le)&&(le=ne(le,ee+(le.key==null||R&&R.key===le.key?"":(""+le.key).replace(q,"$&/")+"/")+he)),W.push(le)),1;he=0;var ue=te===""?".":te+":";if(H(R))for(var _e=0;_e<R.length;_e++)te=R[_e],ce=ue+N(te,_e),he+=M(te,W,ee,ce,le);else if(_e=S(R),typeof _e=="function")for(R=_e.call(R),_e=0;!(te=R.next()).done;)te=te.value,ce=ue+N(te,_e++),he+=M(te,W,ee,ce,le);else if(ce==="object"){if(typeof R.then=="function")return M(z(R),W,ee,te,le);throw W=String(R),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return he}function L(R,W,ee){if(R==null)return R;var te=[],le=0;return M(R,te,"","",function(ce){return W.call(ee,ce,le++)}),te}function B(R){if(R._status===-1){var W=R._result;W=W(),W.then(function(ee){(R._status===0||R._status===-1)&&(R._status=1,R._result=ee)},function(ee){(R._status===0||R._status===-1)&&(R._status=2,R._result=ee)}),R._status===-1&&(R._status=0,R._result=W)}if(R._status===1)return R._result.default;throw R._result}var j=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R=="object"&&R!==null&&typeof R.message=="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)},Z={map:L,forEach:function(R,W,ee){L(R,function(){W.apply(this,arguments)},ee)},count:function(R){var W=0;return L(R,function(){W++}),W},toArray:function(R){return L(R,function(W){return W})||[]},only:function(R){if(!X(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return Me.Activity=m,Me.Children=Z,Me.Component=C,Me.Fragment=s,Me.Profiler=o,Me.PureComponent=E,Me.StrictMode=r,Me.Suspense=d,Me.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=P,Me.__COMPILER_RUNTIME={__proto__:null,c:function(R){return P.H.useMemoCache(R)}},Me.cache=function(R){return function(){return R.apply(null,arguments)}},Me.cacheSignal=function(){return null},Me.cloneElement=function(R,W,ee){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var te=b({},R.props),le=R.key;if(W!=null)for(ce in W.key!==void 0&&(le=""+W.key),W)!V.call(W,ce)||ce==="key"||ce==="__self"||ce==="__source"||ce==="ref"&&W.ref===void 0||(te[ce]=W[ce]);var ce=arguments.length-2;if(ce===1)te.children=ee;else if(1<ce){for(var he=Array(ce),ue=0;ue<ce;ue++)he[ue]=arguments[ue+2];te.children=he}return G(R.type,le,te)},Me.createContext=function(R){return R={$$typeof:u,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:l,_context:R},R},Me.createElement=function(R,W,ee){var te,le={},ce=null;if(W!=null)for(te in W.key!==void 0&&(ce=""+W.key),W)V.call(W,te)&&te!=="key"&&te!=="__self"&&te!=="__source"&&(le[te]=W[te]);var he=arguments.length-2;if(he===1)le.children=ee;else if(1<he){for(var ue=Array(he),_e=0;_e<he;_e++)ue[_e]=arguments[_e+2];le.children=ue}if(R&&R.defaultProps)for(te in he=R.defaultProps,he)le[te]===void 0&&(le[te]=he[te]);return G(R,ce,le)},Me.createRef=function(){return{current:null}},Me.forwardRef=function(R){return{$$typeof:h,render:R}},Me.isValidElement=X,Me.lazy=function(R){return{$$typeof:p,_payload:{_status:-1,_result:R},_init:B}},Me.memo=function(R,W){return{$$typeof:f,type:R,compare:W===void 0?null:W}},Me.startTransition=function(R){var W=P.T,ee={};P.T=ee;try{var te=R(),le=P.S;le!==null&&le(ee,te),typeof te=="object"&&te!==null&&typeof te.then=="function"&&te.then(O,j)}catch(ce){j(ce)}finally{W!==null&&ee.types!==null&&(W.types=ee.types),P.T=W}},Me.unstable_useCacheRefresh=function(){return P.H.useCacheRefresh()},Me.use=function(R){return P.H.use(R)},Me.useActionState=function(R,W,ee){return P.H.useActionState(R,W,ee)},Me.useCallback=function(R,W){return P.H.useCallback(R,W)},Me.useContext=function(R){return P.H.useContext(R)},Me.useDebugValue=function(){},Me.useDeferredValue=function(R,W){return P.H.useDeferredValue(R,W)},Me.useEffect=function(R,W){return P.H.useEffect(R,W)},Me.useEffectEvent=function(R){return P.H.useEffectEvent(R)},Me.useId=function(){return P.H.useId()},Me.useImperativeHandle=function(R,W,ee){return P.H.useImperativeHandle(R,W,ee)},Me.useInsertionEffect=function(R,W){return P.H.useInsertionEffect(R,W)},Me.useLayoutEffect=function(R,W){return P.H.useLayoutEffect(R,W)},Me.useMemo=function(R,W){return P.H.useMemo(R,W)},Me.useOptimistic=function(R,W){return P.H.useOptimistic(R,W)},Me.useReducer=function(R,W,ee){return P.H.useReducer(R,W,ee)},Me.useRef=function(R){return P.H.useRef(R)},Me.useState=function(R){return P.H.useState(R)},Me.useSyncExternalStore=function(R,W,ee){return P.H.useSyncExternalStore(R,W,ee)},Me.useTransition=function(){return P.H.useTransition()},Me.version="19.2.4",Me}var fv;function Ga(){return fv||(fv=1,dd.exports=NC()),dd.exports}var I=Ga();const RC=US(I);var _d={exports:{}},ga={},gd={exports:{}},pd={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/var dv;function BC(){return dv||(dv=1,(function(e){function t(M,L){var B=M.length;M.push(L);e:for(;0<B;){var j=B-1>>>1,Z=M[j];if(0<o(Z,L))M[j]=L,M[B]=Z,B=j;else break e}}function s(M){return M.length===0?null:M[0]}function r(M){if(M.length===0)return null;var L=M[0],B=M.pop();if(B!==L){M[0]=B;e:for(var j=0,Z=M.length,R=Z>>>1;j<R;){var W=2*(j+1)-1,ee=M[W],te=W+1,le=M[te];if(0>o(ee,B))te<Z&&0>o(le,ee)?(M[j]=le,M[te]=B,j=te):(M[j]=ee,M[W]=B,j=W);else if(te<Z&&0>o(le,B))M[j]=le,M[te]=B,j=te;else break e}}return L}function o(M,L){var B=M.sortIndex-L.sortIndex;return B!==0?B:M.id-L.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,h=u.now();e.unstable_now=function(){return u.now()-h}}var d=[],f=[],p=1,m=null,v=3,S=!1,y=!1,b=!1,x=!1,C=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function D(M){for(var L=s(f);L!==null;){if(L.callback===null)r(f);else if(L.startTime<=M)r(f),L.sortIndex=L.expirationTime,t(d,L);else break;L=s(f)}}function H(M){if(b=!1,D(M),!y)if(s(d)!==null)y=!0,O||(O=!0,$());else{var L=s(f);L!==null&&z(H,L.startTime-M)}}var O=!1,P=-1,V=5,G=-1;function ne(){return x?!0:!(e.unstable_now()-G<V)}function X(){if(x=!1,O){var M=e.unstable_now();G=M;var L=!0;try{e:{y=!1,b&&(b=!1,A(P),P=-1),S=!0;var B=v;try{t:{for(D(M),m=s(d);m!==null&&!(m.expirationTime>M&&ne());){var j=m.callback;if(typeof j=="function"){m.callback=null,v=m.priorityLevel;var Z=j(m.expirationTime<=M);if(M=e.unstable_now(),typeof Z=="function"){m.callback=Z,D(M),L=!0;break t}m===s(d)&&r(d),D(M)}else r(d);m=s(d)}if(m!==null)L=!0;else{var R=s(f);R!==null&&z(H,R.startTime-M),L=!1}}break e}finally{m=null,v=B,S=!1}L=void 0}}finally{L?$():O=!1}}}var $;if(typeof E=="function")$=function(){E(X)};else if(typeof MessageChannel<"u"){var q=new MessageChannel,N=q.port2;q.port1.onmessage=X,$=function(){N.postMessage(null)}}else $=function(){C(X,0)};function z(M,L){P=C(function(){M(e.unstable_now())},L)}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(M){M.callback=null},e.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<M?Math.floor(1e3/M):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(M){switch(v){case 1:case 2:case 3:var L=3;break;default:L=v}var B=v;v=L;try{return M()}finally{v=B}},e.unstable_requestPaint=function(){x=!0},e.unstable_runWithPriority=function(M,L){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var B=v;v=M;try{return L()}finally{v=B}},e.unstable_scheduleCallback=function(M,L,B){var j=e.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?j+B:j):B=j,M){case 1:var Z=-1;break;case 2:Z=250;break;case 5:Z=1073741823;break;case 4:Z=1e4;break;default:Z=5e3}return Z=B+Z,M={id:p++,callback:L,priorityLevel:M,startTime:B,expirationTime:Z,sortIndex:-1},B>j?(M.sortIndex=B,t(f,M),s(d)===null&&M===s(f)&&(b?(A(P),P=-1):b=!0,z(H,B-j))):(M.sortIndex=Z,t(d,M),y||S||(y=!0,O||(O=!0,$()))),M},e.unstable_shouldYield=ne,e.unstable_wrapCallback=function(M){var L=v;return function(){var B=v;v=L;try{return M.apply(this,arguments)}finally{v=B}}}})(pd)),pd}var _v;function LC(){return _v||(_v=1,gd.exports=BC()),gd.exports}var md={exports:{}},jt={};/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var gv;function OC(){if(gv)return jt;gv=1;var e=Ga();function t(d){var f="https://react.dev/errors/"+d;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)f+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+d+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var r={d:{f:s,r:function(){throw Error(t(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},o=Symbol.for("react.portal");function l(d,f,p){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:m==null?null:""+m,children:d,containerInfo:f,implementation:p}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(d,f){if(d==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return jt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,jt.createPortal=function(d,f){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(t(299));return l(d,f,null,p)},jt.flushSync=function(d){var f=u.T,p=r.p;try{if(u.T=null,r.p=2,d)return d()}finally{u.T=f,r.p=p,r.d.f()}},jt.preconnect=function(d,f){typeof d=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,r.d.C(d,f))},jt.prefetchDNS=function(d){typeof d=="string"&&r.d.D(d)},jt.preinit=function(d,f){if(typeof d=="string"&&f&&typeof f.as=="string"){var p=f.as,m=h(p,f.crossOrigin),v=typeof f.integrity=="string"?f.integrity:void 0,S=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;p==="style"?r.d.S(d,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:m,integrity:v,fetchPriority:S}):p==="script"&&r.d.X(d,{crossOrigin:m,integrity:v,fetchPriority:S,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},jt.preinitModule=function(d,f){if(typeof d=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var p=h(f.as,f.crossOrigin);r.d.M(d,{crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&r.d.M(d)},jt.preload=function(d,f){if(typeof d=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var p=f.as,m=h(p,f.crossOrigin);r.d.L(d,p,{crossOrigin:m,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},jt.preloadModule=function(d,f){if(typeof d=="string")if(f){var p=h(f.as,f.crossOrigin);r.d.m(d,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else r.d.m(d)},jt.requestFormReset=function(d){r.d.r(d)},jt.unstable_batchedUpdates=function(d,f){return d(f)},jt.useFormState=function(d,f,p){return u.H.useFormState(d,f,p)},jt.useFormStatus=function(){return u.H.useHostTransitionStatus()},jt.version="19.2.4",jt}var pv;function jS(){if(pv)return md.exports;pv=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(),md.exports=OC(),md.exports}/**
|
|
34
|
+
* @license React
|
|
35
|
+
* react-dom-client.production.js
|
|
36
|
+
*
|
|
37
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the MIT license found in the
|
|
40
|
+
* LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/var mv;function zC(){if(mv)return ga;mv=1;var e=LC(),t=Ga(),s=jS();function r(i){var n="https://react.dev/errors/"+i;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+i+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function l(i){var n=i,a=i;if(i.alternate)for(;n.return;)n=n.return;else{i=n;do n=i,(n.flags&4098)!==0&&(a=n.return),i=n.return;while(i)}return n.tag===3?a:null}function u(i){if(i.tag===13){var n=i.memoizedState;if(n===null&&(i=i.alternate,i!==null&&(n=i.memoizedState)),n!==null)return n.dehydrated}return null}function h(i){if(i.tag===31){var n=i.memoizedState;if(n===null&&(i=i.alternate,i!==null&&(n=i.memoizedState)),n!==null)return n.dehydrated}return null}function d(i){if(l(i)!==i)throw Error(r(188))}function f(i){var n=i.alternate;if(!n){if(n=l(i),n===null)throw Error(r(188));return n!==i?null:i}for(var a=i,c=n;;){var _=a.return;if(_===null)break;var g=_.alternate;if(g===null){if(c=_.return,c!==null){a=c;continue}break}if(_.child===g.child){for(g=_.child;g;){if(g===a)return d(_),i;if(g===c)return d(_),n;g=g.sibling}throw Error(r(188))}if(a.return!==c.return)a=_,c=g;else{for(var w=!1,k=_.child;k;){if(k===a){w=!0,a=_,c=g;break}if(k===c){w=!0,c=_,a=g;break}k=k.sibling}if(!w){for(k=g.child;k;){if(k===a){w=!0,a=g,c=_;break}if(k===c){w=!0,c=g,a=_;break}k=k.sibling}if(!w)throw Error(r(189))}}if(a.alternate!==c)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?i:n}function p(i){var n=i.tag;if(n===5||n===26||n===27||n===6)return i;for(i=i.child;i!==null;){if(n=p(i),n!==null)return n;i=i.sibling}return null}var m=Object.assign,v=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),y=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),E=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),ne=Symbol.for("react.memo_cache_sentinel"),X=Symbol.iterator;function $(i){return i===null||typeof i!="object"?null:(i=X&&i[X]||i["@@iterator"],typeof i=="function"?i:null)}var q=Symbol.for("react.client.reference");function N(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===q?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case b:return"Fragment";case C:return"Profiler";case x:return"StrictMode";case H:return"Suspense";case O:return"SuspenseList";case G:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case y:return"Portal";case E:return i.displayName||"Context";case A:return(i._context.displayName||"Context")+".Consumer";case D:var n=i.render;return i=i.displayName,i||(i=n.displayName||n.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case P:return n=i.displayName||null,n!==null?n:N(i.type)||"Memo";case V:n=i._payload,i=i._init;try{return N(i(n))}catch{}}return null}var z=Array.isArray,M=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B={pending:!1,data:null,method:null,action:null},j=[],Z=-1;function R(i){return{current:i}}function W(i){0>Z||(i.current=j[Z],j[Z]=null,Z--)}function ee(i,n){Z++,j[Z]=i.current,i.current=n}var te=R(null),le=R(null),ce=R(null),he=R(null);function ue(i,n){switch(ee(ce,n),ee(le,i),ee(te,null),n.nodeType){case 9:case 11:i=(i=n.documentElement)&&(i=i.namespaceURI)?R0(i):0;break;default:if(i=n.tagName,n=n.namespaceURI)n=R0(n),i=B0(n,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}W(te),ee(te,i)}function _e(){W(te),W(le),W(ce)}function Ce(i){i.memoizedState!==null&&ee(he,i);var n=te.current,a=B0(n,i.type);n!==a&&(ee(le,i),ee(te,a))}function be(i){le.current===i&&(W(te),W(le)),he.current===i&&(W(he),ua._currentValue=B)}var me,de;function ke(i){if(me===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);me=n&&n[1]||"",de=-1<a.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+me+i+de}var $e=!1;function Le(i,n){if(!i||$e)return"";$e=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(n){var oe=function(){throw Error()};if(Object.defineProperty(oe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(oe,[])}catch(ie){var J=ie}Reflect.construct(i,[],oe)}else{try{oe.call()}catch(ie){J=ie}i.call(oe.prototype)}}else{try{throw Error()}catch(ie){J=ie}(oe=i())&&typeof oe.catch=="function"&&oe.catch(function(){})}}catch(ie){if(ie&&J&&typeof ie.stack=="string")return[ie.stack,J.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var _=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");_&&_.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var g=c.DetermineComponentFrameRoot(),w=g[0],k=g[1];if(w&&k){var U=w.split(`
|
|
44
|
+
`),Q=k.split(`
|
|
45
|
+
`);for(_=c=0;c<U.length&&!U[c].includes("DetermineComponentFrameRoot");)c++;for(;_<Q.length&&!Q[_].includes("DetermineComponentFrameRoot");)_++;if(c===U.length||_===Q.length)for(c=U.length-1,_=Q.length-1;1<=c&&0<=_&&U[c]!==Q[_];)_--;for(;1<=c&&0<=_;c--,_--)if(U[c]!==Q[_]){if(c!==1||_!==1)do if(c--,_--,0>_||U[c]!==Q[_]){var se=`
|
|
46
|
+
`+U[c].replace(" at new "," at ");return i.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",i.displayName)),se}while(1<=c&&0<=_);break}}}finally{$e=!1,Error.prepareStackTrace=a}return(a=i?i.displayName||i.name:"")?ke(a):""}function Et(i,n){switch(i.tag){case 26:case 27:case 5:return ke(i.type);case 16:return ke("Lazy");case 13:return i.child!==n&&n!==null?ke("Suspense Fallback"):ke("Suspense");case 19:return ke("SuspenseList");case 0:case 15:return Le(i.type,!1);case 11:return Le(i.type.render,!1);case 1:return Le(i.type,!0);case 31:return ke("Activity");default:return""}}function Ni(i){try{var n="",a=null;do n+=Et(i,a),a=i,i=i.return;while(i);return n}catch(c){return`
|
|
47
|
+
Error generating stack: `+c.message+`
|
|
48
|
+
`+c.stack}}var oi=Object.prototype.hasOwnProperty,Ri=e.unstable_scheduleCallback,rs=e.unstable_cancelCallback,En=e.unstable_shouldYield,Mn=e.unstable_requestPaint,Rt=e.unstable_now,dr=e.unstable_getCurrentPriorityLevel,os=e.unstable_ImmediatePriority,Hs=e.unstable_UserBlockingPriority,kn=e.unstable_NormalPriority,Ku=e.unstable_LowPriority,_r=e.unstable_IdlePriority,Gu=e.log,Fu=e.unstable_setDisableYieldValue,Dn=null,$t=null;function qi(i){if(typeof Gu=="function"&&Fu(i),$t&&typeof $t.setStrictMode=="function")try{$t.setStrictMode(Dn,i)}catch{}}var qt=Math.clz32?Math.clz32:Ju,Zu=Math.log,Qu=Math.LN2;function Ju(i){return i>>>=0,i===0?32:31-(Zu(i)/Qu|0)|0}var gr=256,pr=262144,mr=4194304;function as(i){var n=i&42;if(n!==0)return n;switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function vr(i,n,a){var c=i.pendingLanes;if(c===0)return 0;var _=0,g=i.suspendedLanes,w=i.pingedLanes;i=i.warmLanes;var k=c&134217727;return k!==0?(c=k&~g,c!==0?_=as(c):(w&=k,w!==0?_=as(w):a||(a=k&~i,a!==0&&(_=as(a))))):(k=c&~g,k!==0?_=as(k):w!==0?_=as(w):a||(a=c&~i,a!==0&&(_=as(a)))),_===0?0:n!==0&&n!==_&&(n&g)===0&&(g=_&-_,a=n&-n,g>=a||g===32&&(a&4194048)!==0)?n:_}function Tn(i,n){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&n)===0}function eh(i,n){switch(i){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function al(){var i=mr;return mr<<=1,(mr&62914560)===0&&(mr=4194304),i}function bo(i){for(var n=[],a=0;31>a;a++)n.push(i);return n}function An(i,n){i.pendingLanes|=n,n!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function th(i,n,a,c,_,g){var w=i.pendingLanes;i.pendingLanes=a,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=a,i.entangledLanes&=a,i.errorRecoveryDisabledLanes&=a,i.shellSuspendCounter=0;var k=i.entanglements,U=i.expirationTimes,Q=i.hiddenUpdates;for(a=w&~a;0<a;){var se=31-qt(a),oe=1<<se;k[se]=0,U[se]=-1;var J=Q[se];if(J!==null)for(Q[se]=null,se=0;se<J.length;se++){var ie=J[se];ie!==null&&(ie.lane&=-536870913)}a&=~oe}c!==0&&ll(i,c,0),g!==0&&_===0&&i.tag!==0&&(i.suspendedLanes|=g&~(w&~n))}function ll(i,n,a){i.pendingLanes|=n,i.suspendedLanes&=~n;var c=31-qt(n);i.entangledLanes|=n,i.entanglements[c]=i.entanglements[c]|1073741824|a&261930}function cl(i,n){var a=i.entangledLanes|=n;for(i=i.entanglements;a;){var c=31-qt(a),_=1<<c;_&n|i[c]&n&&(i[c]|=n),a&=~_}}function ul(i,n){var a=n&-n;return a=(a&42)!==0?1:wo(a),(a&(i.suspendedLanes|n))!==0?0:a}function wo(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function xo(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function hl(){var i=L.p;return i!==0?i:(i=window.event,i===void 0?32:iv(i.type))}function fl(i,n){var a=L.p;try{return L.p=i,n()}finally{L.p=a}}var Wi=Math.random().toString(36).slice(2),St="__reactFiber$"+Wi,Ut="__reactProps$"+Wi,ls="__reactContainer$"+Wi,yr="__reactEvents$"+Wi,dl="__reactListeners$"+Wi,ih="__reactHandles$"+Wi,_l="__reactResources$"+Wi,Nn="__reactMarker$"+Wi;function Co(i){delete i[St],delete i[Ut],delete i[yr],delete i[dl],delete i[ih]}function Ps(i){var n=i[St];if(n)return n;for(var a=i.parentNode;a;){if(n=a[ls]||a[St]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(i=j0(i);i!==null;){if(a=i[St])return a;i=j0(i)}return n}i=a,a=i.parentNode}return null}function Us(i){if(i=i[St]||i[ls]){var n=i.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return i}return null}function js(i){var n=i.tag;if(n===5||n===26||n===27||n===6)return i.stateNode;throw Error(r(33))}function Is(i){var n=i[_l];return n||(n=i[_l]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function ft(i){i[Nn]=!0}var gl=new Set,pl={};function cs(i,n){$s(i,n),$s(i+"Capture",n)}function $s(i,n){for(pl[i]=n,i=0;i<n.length;i++)gl.add(n[i])}var sh=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Eo={},ml={};function nh(i){return oi.call(ml,i)?!0:oi.call(Eo,i)?!1:sh.test(i)?ml[i]=!0:(Eo[i]=!0,!1)}function Sr(i,n,a){if(nh(n))if(a===null)i.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":i.removeAttribute(n);return;case"boolean":var c=n.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){i.removeAttribute(n);return}}i.setAttribute(n,""+a)}}function br(i,n,a){if(a===null)i.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(n);return}i.setAttribute(n,""+a)}}function Bi(i,n,a,c){if(c===null)i.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(a);return}i.setAttributeNS(n,a,""+c)}}function Kt(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function vl(i){var n=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function rh(i,n,a){var c=Object.getOwnPropertyDescriptor(i.constructor.prototype,n);if(!i.hasOwnProperty(n)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var _=c.get,g=c.set;return Object.defineProperty(i,n,{configurable:!0,get:function(){return _.call(this)},set:function(w){a=""+w,g.call(this,w)}}),Object.defineProperty(i,n,{enumerable:c.enumerable}),{getValue:function(){return a},setValue:function(w){a=""+w},stopTracking:function(){i._valueTracker=null,delete i[n]}}}}function qs(i){if(!i._valueTracker){var n=vl(i)?"checked":"value";i._valueTracker=rh(i,n,""+i[n])}}function yl(i){if(!i)return!1;var n=i._valueTracker;if(!n)return!0;var a=n.getValue(),c="";return i&&(c=vl(i)?i.checked?"true":"false":i.value),i=c,i!==a?(n.setValue(i),!0):!1}function Rn(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var oh=/[\n"\\]/g;function Gt(i){return i.replace(oh,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Bn(i,n,a,c,_,g,w,k){i.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?i.type=w:i.removeAttribute("type"),n!=null?w==="number"?(n===0&&i.value===""||i.value!=n)&&(i.value=""+Kt(n)):i.value!==""+Kt(n)&&(i.value=""+Kt(n)):w!=="submit"&&w!=="reset"||i.removeAttribute("value"),n!=null?Mo(i,w,Kt(n)):a!=null?Mo(i,w,Kt(a)):c!=null&&i.removeAttribute("value"),_==null&&g!=null&&(i.defaultChecked=!!g),_!=null&&(i.checked=_&&typeof _!="function"&&typeof _!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?i.name=""+Kt(k):i.removeAttribute("name")}function Sl(i,n,a,c,_,g,w,k){if(g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(i.type=g),n!=null||a!=null){if(!(g!=="submit"&&g!=="reset"||n!=null)){qs(i);return}a=a!=null?""+Kt(a):"",n=n!=null?""+Kt(n):a,k||n===i.value||(i.value=n),i.defaultValue=n}c=c??_,c=typeof c!="function"&&typeof c!="symbol"&&!!c,i.checked=k?i.checked:!!c,i.defaultChecked=!!c,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(i.name=w),qs(i)}function Mo(i,n,a){n==="number"&&Rn(i.ownerDocument)===i||i.defaultValue===""+a||(i.defaultValue=""+a)}function us(i,n,a,c){if(i=i.options,n){n={};for(var _=0;_<a.length;_++)n["$"+a[_]]=!0;for(a=0;a<i.length;a++)_=n.hasOwnProperty("$"+i[a].value),i[a].selected!==_&&(i[a].selected=_),_&&c&&(i[a].defaultSelected=!0)}else{for(a=""+Kt(a),n=null,_=0;_<i.length;_++){if(i[_].value===a){i[_].selected=!0,c&&(i[_].defaultSelected=!0);return}n!==null||i[_].disabled||(n=i[_])}n!==null&&(n.selected=!0)}}function kg(i,n,a){if(n!=null&&(n=""+Kt(n),n!==i.value&&(i.value=n),a==null)){i.defaultValue!==n&&(i.defaultValue=n);return}i.defaultValue=a!=null?""+Kt(a):""}function Dg(i,n,a,c){if(n==null){if(c!=null){if(a!=null)throw Error(r(92));if(z(c)){if(1<c.length)throw Error(r(93));c=c[0]}a=c}a==null&&(a=""),n=a}a=Kt(n),i.defaultValue=a,c=i.textContent,c===a&&c!==""&&c!==null&&(i.value=c),qs(i)}function wr(i,n){if(n){var a=i.firstChild;if(a&&a===i.lastChild&&a.nodeType===3){a.nodeValue=n;return}}i.textContent=n}var Cw=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Tg(i,n,a){var c=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?c?i.setProperty(n,""):n==="float"?i.cssFloat="":i[n]="":c?i.setProperty(n,a):typeof a!="number"||a===0||Cw.has(n)?n==="float"?i.cssFloat=a:i[n]=(""+a).trim():i[n]=a+"px"}function Ag(i,n,a){if(n!=null&&typeof n!="object")throw Error(r(62));if(i=i.style,a!=null){for(var c in a)!a.hasOwnProperty(c)||n!=null&&n.hasOwnProperty(c)||(c.indexOf("--")===0?i.setProperty(c,""):c==="float"?i.cssFloat="":i[c]="");for(var _ in n)c=n[_],n.hasOwnProperty(_)&&a[_]!==c&&Tg(i,_,c)}else for(var g in n)n.hasOwnProperty(g)&&Tg(i,g,n[g])}function ah(i){if(i.indexOf("-")===-1)return!1;switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ew=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Mw=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function bl(i){return Mw.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function hs(){}var lh=null;function ch(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var xr=null,Cr=null;function Ng(i){var n=Us(i);if(n&&(i=n.stateNode)){var a=i[Ut]||null;e:switch(i=n.stateNode,n.type){case"input":if(Bn(i,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=i;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Gt(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var c=a[n];if(c!==i&&c.form===i.form){var _=c[Ut]||null;if(!_)throw Error(r(90));Bn(c,_.value,_.defaultValue,_.defaultValue,_.checked,_.defaultChecked,_.type,_.name)}}for(n=0;n<a.length;n++)c=a[n],c.form===i.form&&yl(c)}break e;case"textarea":kg(i,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&us(i,!!a.multiple,n,!1)}}}var uh=!1;function Rg(i,n,a){if(uh)return i(n,a);uh=!0;try{var c=i(n);return c}finally{if(uh=!1,(xr!==null||Cr!==null)&&(lc(),xr&&(n=xr,i=Cr,Cr=xr=null,Ng(n),i)))for(n=0;n<i.length;n++)Ng(i[n])}}function ko(i,n){var a=i.stateNode;if(a===null)return null;var c=a[Ut]||null;if(c===null)return null;a=c[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":(c=!c.disabled)||(i=i.type,c=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!c;break e;default:i=!1}if(i)return null;if(a&&typeof a!="function")throw Error(r(231,n,typeof a));return a}var fs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),hh=!1;if(fs)try{var Do={};Object.defineProperty(Do,"passive",{get:function(){hh=!0}}),window.addEventListener("test",Do,Do),window.removeEventListener("test",Do,Do)}catch{hh=!1}var Ws=null,fh=null,wl=null;function Bg(){if(wl)return wl;var i,n=fh,a=n.length,c,_="value"in Ws?Ws.value:Ws.textContent,g=_.length;for(i=0;i<a&&n[i]===_[i];i++);var w=a-i;for(c=1;c<=w&&n[a-c]===_[g-c];c++);return wl=_.slice(i,1<c?1-c:void 0)}function xl(i){var n=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&n===13&&(i=13)):i=n,i===10&&(i=13),32<=i||i===13?i:0}function Cl(){return!0}function Lg(){return!1}function Ft(i){function n(a,c,_,g,w){this._reactName=a,this._targetInst=_,this.type=c,this.nativeEvent=g,this.target=w,this.currentTarget=null;for(var k in i)i.hasOwnProperty(k)&&(a=i[k],this[k]=a?a(g):g[k]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?Cl:Lg,this.isPropagationStopped=Lg,this}return m(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Cl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Cl)},persist:function(){},isPersistent:Cl}),n}var Ln={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},El=Ft(Ln),To=m({},Ln,{view:0,detail:0}),kw=Ft(To),dh,_h,Ao,Ml=m({},To,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ph,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==Ao&&(Ao&&i.type==="mousemove"?(dh=i.screenX-Ao.screenX,_h=i.screenY-Ao.screenY):_h=dh=0,Ao=i),dh)},movementY:function(i){return"movementY"in i?i.movementY:_h}}),Og=Ft(Ml),Dw=m({},Ml,{dataTransfer:0}),Tw=Ft(Dw),Aw=m({},To,{relatedTarget:0}),gh=Ft(Aw),Nw=m({},Ln,{animationName:0,elapsedTime:0,pseudoElement:0}),Rw=Ft(Nw),Bw=m({},Ln,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),Lw=Ft(Bw),Ow=m({},Ln,{data:0}),zg=Ft(Ow),zw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Hw={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"},Pw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Uw(i){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(i):(i=Pw[i])?!!n[i]:!1}function ph(){return Uw}var jw=m({},To,{key:function(i){if(i.key){var n=zw[i.key]||i.key;if(n!=="Unidentified")return n}return i.type==="keypress"?(i=xl(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?Hw[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ph,charCode:function(i){return i.type==="keypress"?xl(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?xl(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),Iw=Ft(jw),$w=m({},Ml,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Hg=Ft($w),qw=m({},To,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ph}),Ww=Ft(qw),Yw=m({},Ln,{propertyName:0,elapsedTime:0,pseudoElement:0}),Vw=Ft(Yw),Xw=m({},Ml,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),Kw=Ft(Xw),Gw=m({},Ln,{newState:0,oldState:0}),Fw=Ft(Gw),Zw=[9,13,27,32],mh=fs&&"CompositionEvent"in window,No=null;fs&&"documentMode"in document&&(No=document.documentMode);var Qw=fs&&"TextEvent"in window&&!No,Pg=fs&&(!mh||No&&8<No&&11>=No),Ug=" ",jg=!1;function Ig(i,n){switch(i){case"keyup":return Zw.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $g(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Er=!1;function Jw(i,n){switch(i){case"compositionend":return $g(n);case"keypress":return n.which!==32?null:(jg=!0,Ug);case"textInput":return i=n.data,i===Ug&&jg?null:i;default:return null}}function ex(i,n){if(Er)return i==="compositionend"||!mh&&Ig(i,n)?(i=Bg(),wl=fh=Ws=null,Er=!1,i):null;switch(i){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 Pg&&n.locale!=="ko"?null:n.data;default:return null}}var tx={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 qg(i){var n=i&&i.nodeName&&i.nodeName.toLowerCase();return n==="input"?!!tx[i.type]:n==="textarea"}function Wg(i,n,a,c){xr?Cr?Cr.push(c):Cr=[c]:xr=c,n=gc(n,"onChange"),0<n.length&&(a=new El("onChange","change",null,a,c),i.push({event:a,listeners:n}))}var Ro=null,Bo=null;function ix(i){M0(i,0)}function kl(i){var n=js(i);if(yl(n))return i}function Yg(i,n){if(i==="change")return n}var Vg=!1;if(fs){var vh;if(fs){var yh="oninput"in document;if(!yh){var Xg=document.createElement("div");Xg.setAttribute("oninput","return;"),yh=typeof Xg.oninput=="function"}vh=yh}else vh=!1;Vg=vh&&(!document.documentMode||9<document.documentMode)}function Kg(){Ro&&(Ro.detachEvent("onpropertychange",Gg),Bo=Ro=null)}function Gg(i){if(i.propertyName==="value"&&kl(Bo)){var n=[];Wg(n,Bo,i,ch(i)),Rg(ix,n)}}function sx(i,n,a){i==="focusin"?(Kg(),Ro=n,Bo=a,Ro.attachEvent("onpropertychange",Gg)):i==="focusout"&&Kg()}function nx(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return kl(Bo)}function rx(i,n){if(i==="click")return kl(n)}function ox(i,n){if(i==="input"||i==="change")return kl(n)}function ax(i,n){return i===n&&(i!==0||1/i===1/n)||i!==i&&n!==n}var ai=typeof Object.is=="function"?Object.is:ax;function Lo(i,n){if(ai(i,n))return!0;if(typeof i!="object"||i===null||typeof n!="object"||n===null)return!1;var a=Object.keys(i),c=Object.keys(n);if(a.length!==c.length)return!1;for(c=0;c<a.length;c++){var _=a[c];if(!oi.call(n,_)||!ai(i[_],n[_]))return!1}return!0}function Fg(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Zg(i,n){var a=Fg(i);i=0;for(var c;a;){if(a.nodeType===3){if(c=i+a.textContent.length,i<=n&&c>=n)return{node:a,offset:n-i};i=c}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Fg(a)}}function Qg(i,n){return i&&n?i===n?!0:i&&i.nodeType===3?!1:n&&n.nodeType===3?Qg(i,n.parentNode):"contains"in i?i.contains(n):i.compareDocumentPosition?!!(i.compareDocumentPosition(n)&16):!1:!1}function Jg(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var n=Rn(i.document);n instanceof i.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)i=n.contentWindow;else break;n=Rn(i.document)}return n}function Sh(i){var n=i&&i.nodeName&&i.nodeName.toLowerCase();return n&&(n==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||n==="textarea"||i.contentEditable==="true")}var lx=fs&&"documentMode"in document&&11>=document.documentMode,Mr=null,bh=null,Oo=null,wh=!1;function ep(i,n,a){var c=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;wh||Mr==null||Mr!==Rn(c)||(c=Mr,"selectionStart"in c&&Sh(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Oo&&Lo(Oo,c)||(Oo=c,c=gc(bh,"onSelect"),0<c.length&&(n=new El("onSelect","select",null,n,a),i.push({event:n,listeners:c}),n.target=Mr)))}function On(i,n){var a={};return a[i.toLowerCase()]=n.toLowerCase(),a["Webkit"+i]="webkit"+n,a["Moz"+i]="moz"+n,a}var kr={animationend:On("Animation","AnimationEnd"),animationiteration:On("Animation","AnimationIteration"),animationstart:On("Animation","AnimationStart"),transitionrun:On("Transition","TransitionRun"),transitionstart:On("Transition","TransitionStart"),transitioncancel:On("Transition","TransitionCancel"),transitionend:On("Transition","TransitionEnd")},xh={},tp={};fs&&(tp=document.createElement("div").style,"AnimationEvent"in window||(delete kr.animationend.animation,delete kr.animationiteration.animation,delete kr.animationstart.animation),"TransitionEvent"in window||delete kr.transitionend.transition);function zn(i){if(xh[i])return xh[i];if(!kr[i])return i;var n=kr[i],a;for(a in n)if(n.hasOwnProperty(a)&&a in tp)return xh[i]=n[a];return i}var ip=zn("animationend"),sp=zn("animationiteration"),np=zn("animationstart"),cx=zn("transitionrun"),ux=zn("transitionstart"),hx=zn("transitioncancel"),rp=zn("transitionend"),op=new Map,Ch="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Ch.push("scrollEnd");function Li(i,n){op.set(i,n),cs(n,[i])}var Dl=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},yi=[],Dr=0,Eh=0;function Tl(){for(var i=Dr,n=Eh=Dr=0;n<i;){var a=yi[n];yi[n++]=null;var c=yi[n];yi[n++]=null;var _=yi[n];yi[n++]=null;var g=yi[n];if(yi[n++]=null,c!==null&&_!==null){var w=c.pending;w===null?_.next=_:(_.next=w.next,w.next=_),c.pending=_}g!==0&&ap(a,_,g)}}function Al(i,n,a,c){yi[Dr++]=i,yi[Dr++]=n,yi[Dr++]=a,yi[Dr++]=c,Eh|=c,i.lanes|=c,i=i.alternate,i!==null&&(i.lanes|=c)}function Mh(i,n,a,c){return Al(i,n,a,c),Nl(i)}function Hn(i,n){return Al(i,null,null,n),Nl(i)}function ap(i,n,a){i.lanes|=a;var c=i.alternate;c!==null&&(c.lanes|=a);for(var _=!1,g=i.return;g!==null;)g.childLanes|=a,c=g.alternate,c!==null&&(c.childLanes|=a),g.tag===22&&(i=g.stateNode,i===null||i._visibility&1||(_=!0)),i=g,g=g.return;return i.tag===3?(g=i.stateNode,_&&n!==null&&(_=31-qt(a),i=g.hiddenUpdates,c=i[_],c===null?i[_]=[n]:c.push(n),n.lane=a|536870912),g):null}function Nl(i){if(50<sa)throw sa=0,zf=null,Error(r(185));for(var n=i.return;n!==null;)i=n,n=i.return;return i.tag===3?i.stateNode:null}var Tr={};function fx(i,n,a,c){this.tag=i,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function li(i,n,a,c){return new fx(i,n,a,c)}function kh(i){return i=i.prototype,!(!i||!i.isReactComponent)}function ds(i,n){var a=i.alternate;return a===null?(a=li(i.tag,n,i.key,i.mode),a.elementType=i.elementType,a.type=i.type,a.stateNode=i.stateNode,a.alternate=i,i.alternate=a):(a.pendingProps=n,a.type=i.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=i.flags&65011712,a.childLanes=i.childLanes,a.lanes=i.lanes,a.child=i.child,a.memoizedProps=i.memoizedProps,a.memoizedState=i.memoizedState,a.updateQueue=i.updateQueue,n=i.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=i.sibling,a.index=i.index,a.ref=i.ref,a.refCleanup=i.refCleanup,a}function lp(i,n){i.flags&=65011714;var a=i.alternate;return a===null?(i.childLanes=0,i.lanes=n,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,n=a.dependencies,i.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),i}function Rl(i,n,a,c,_,g){var w=0;if(c=i,typeof i=="function")kh(i)&&(w=1);else if(typeof i=="string")w=mC(i,a,te.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case G:return i=li(31,a,n,_),i.elementType=G,i.lanes=g,i;case b:return Pn(a.children,_,g,n);case x:w=8,_|=24;break;case C:return i=li(12,a,n,_|2),i.elementType=C,i.lanes=g,i;case H:return i=li(13,a,n,_),i.elementType=H,i.lanes=g,i;case O:return i=li(19,a,n,_),i.elementType=O,i.lanes=g,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case E:w=10;break e;case A:w=9;break e;case D:w=11;break e;case P:w=14;break e;case V:w=16,c=null;break e}w=29,a=Error(r(130,i===null?"null":typeof i,"")),c=null}return n=li(w,a,n,_),n.elementType=i,n.type=c,n.lanes=g,n}function Pn(i,n,a,c){return i=li(7,i,c,n),i.lanes=a,i}function Dh(i,n,a){return i=li(6,i,null,n),i.lanes=a,i}function cp(i){var n=li(18,null,null,0);return n.stateNode=i,n}function Th(i,n,a){return n=li(4,i.children!==null?i.children:[],i.key,n),n.lanes=a,n.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},n}var up=new WeakMap;function Si(i,n){if(typeof i=="object"&&i!==null){var a=up.get(i);return a!==void 0?a:(n={value:i,source:n,stack:Ni(n)},up.set(i,n),n)}return{value:i,source:n,stack:Ni(n)}}var Ar=[],Nr=0,Bl=null,zo=0,bi=[],wi=0,Ys=null,Yi=1,Vi="";function _s(i,n){Ar[Nr++]=zo,Ar[Nr++]=Bl,Bl=i,zo=n}function hp(i,n,a){bi[wi++]=Yi,bi[wi++]=Vi,bi[wi++]=Ys,Ys=i;var c=Yi;i=Vi;var _=32-qt(c)-1;c&=~(1<<_),a+=1;var g=32-qt(n)+_;if(30<g){var w=_-_%5;g=(c&(1<<w)-1).toString(32),c>>=w,_-=w,Yi=1<<32-qt(n)+_|a<<_|c,Vi=g+i}else Yi=1<<g|a<<_|c,Vi=i}function Ah(i){i.return!==null&&(_s(i,1),hp(i,1,0))}function Nh(i){for(;i===Bl;)Bl=Ar[--Nr],Ar[Nr]=null,zo=Ar[--Nr],Ar[Nr]=null;for(;i===Ys;)Ys=bi[--wi],bi[wi]=null,Vi=bi[--wi],bi[wi]=null,Yi=bi[--wi],bi[wi]=null}function fp(i,n){bi[wi++]=Yi,bi[wi++]=Vi,bi[wi++]=Ys,Yi=n.id,Vi=n.overflow,Ys=i}var Bt=null,Fe=null,He=!1,Vs=null,xi=!1,Rh=Error(r(519));function Xs(i){var n=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ho(Si(n,i)),Rh}function dp(i){var n=i.stateNode,a=i.type,c=i.memoizedProps;switch(n[St]=i,n[Ut]=c,a){case"dialog":Be("cancel",n),Be("close",n);break;case"iframe":case"object":case"embed":Be("load",n);break;case"video":case"audio":for(a=0;a<ra.length;a++)Be(ra[a],n);break;case"source":Be("error",n);break;case"img":case"image":case"link":Be("error",n),Be("load",n);break;case"details":Be("toggle",n);break;case"input":Be("invalid",n),Sl(n,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":Be("invalid",n);break;case"textarea":Be("invalid",n),Dg(n,c.value,c.defaultValue,c.children)}a=c.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||c.suppressHydrationWarning===!0||A0(n.textContent,a)?(c.popover!=null&&(Be("beforetoggle",n),Be("toggle",n)),c.onScroll!=null&&Be("scroll",n),c.onScrollEnd!=null&&Be("scrollend",n),c.onClick!=null&&(n.onclick=hs),n=!0):n=!1,n||Xs(i,!0)}function _p(i){for(Bt=i.return;Bt;)switch(Bt.tag){case 5:case 31:case 13:xi=!1;return;case 27:case 3:xi=!0;return;default:Bt=Bt.return}}function Rr(i){if(i!==Bt)return!1;if(!He)return _p(i),He=!0,!1;var n=i.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=i.type,a=!(a!=="form"&&a!=="button")||Zf(i.type,i.memoizedProps)),a=!a),a&&Fe&&Xs(i),_p(i),n===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));Fe=U0(i)}else if(n===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));Fe=U0(i)}else n===27?(n=Fe,ln(i.type)?(i=id,id=null,Fe=i):Fe=n):Fe=Bt?Ei(i.stateNode.nextSibling):null;return!0}function Un(){Fe=Bt=null,He=!1}function Bh(){var i=Vs;return i!==null&&(ei===null?ei=i:ei.push.apply(ei,i),Vs=null),i}function Ho(i){Vs===null?Vs=[i]:Vs.push(i)}var Lh=R(null),jn=null,gs=null;function Ks(i,n,a){ee(Lh,n._currentValue),n._currentValue=a}function ps(i){i._currentValue=Lh.current,W(Lh)}function Oh(i,n,a){for(;i!==null;){var c=i.alternate;if((i.childLanes&n)!==n?(i.childLanes|=n,c!==null&&(c.childLanes|=n)):c!==null&&(c.childLanes&n)!==n&&(c.childLanes|=n),i===a)break;i=i.return}}function zh(i,n,a,c){var _=i.child;for(_!==null&&(_.return=i);_!==null;){var g=_.dependencies;if(g!==null){var w=_.child;g=g.firstContext;e:for(;g!==null;){var k=g;g=_;for(var U=0;U<n.length;U++)if(k.context===n[U]){g.lanes|=a,k=g.alternate,k!==null&&(k.lanes|=a),Oh(g.return,a,i),c||(w=null);break e}g=k.next}}else if(_.tag===18){if(w=_.return,w===null)throw Error(r(341));w.lanes|=a,g=w.alternate,g!==null&&(g.lanes|=a),Oh(w,a,i),w=null}else w=_.child;if(w!==null)w.return=_;else for(w=_;w!==null;){if(w===i){w=null;break}if(_=w.sibling,_!==null){_.return=w.return,w=_;break}w=w.return}_=w}}function Br(i,n,a,c){i=null;for(var _=n,g=!1;_!==null;){if(!g){if((_.flags&524288)!==0)g=!0;else if((_.flags&262144)!==0)break}if(_.tag===10){var w=_.alternate;if(w===null)throw Error(r(387));if(w=w.memoizedProps,w!==null){var k=_.type;ai(_.pendingProps.value,w.value)||(i!==null?i.push(k):i=[k])}}else if(_===he.current){if(w=_.alternate,w===null)throw Error(r(387));w.memoizedState.memoizedState!==_.memoizedState.memoizedState&&(i!==null?i.push(ua):i=[ua])}_=_.return}i!==null&&zh(n,i,a,c),n.flags|=262144}function Ll(i){for(i=i.firstContext;i!==null;){if(!ai(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function In(i){jn=i,gs=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Lt(i){return gp(jn,i)}function Ol(i,n){return jn===null&&In(i),gp(i,n)}function gp(i,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},gs===null){if(i===null)throw Error(r(308));gs=n,i.dependencies={lanes:0,firstContext:n},i.flags|=524288}else gs=gs.next=n;return a}var dx=typeof AbortController<"u"?AbortController:function(){var i=[],n=this.signal={aborted:!1,addEventListener:function(a,c){i.push(c)}};this.abort=function(){n.aborted=!0,i.forEach(function(a){return a()})}},_x=e.unstable_scheduleCallback,gx=e.unstable_NormalPriority,dt={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Hh(){return{controller:new dx,data:new Map,refCount:0}}function Po(i){i.refCount--,i.refCount===0&&_x(gx,function(){i.controller.abort()})}var Uo=null,Ph=0,Lr=0,Or=null;function px(i,n){if(Uo===null){var a=Uo=[];Ph=0,Lr=$f(),Or={status:"pending",value:void 0,then:function(c){a.push(c)}}}return Ph++,n.then(pp,pp),n}function pp(){if(--Ph===0&&Uo!==null){Or!==null&&(Or.status="fulfilled");var i=Uo;Uo=null,Lr=0,Or=null;for(var n=0;n<i.length;n++)(0,i[n])()}}function mx(i,n){var a=[],c={status:"pending",value:null,reason:null,then:function(_){a.push(_)}};return i.then(function(){c.status="fulfilled",c.value=n;for(var _=0;_<a.length;_++)(0,a[_])(n)},function(_){for(c.status="rejected",c.reason=_,_=0;_<a.length;_++)(0,a[_])(void 0)}),c}var mp=M.S;M.S=function(i,n){e0=Rt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&px(i,n),mp!==null&&mp(i,n)};var $n=R(null);function Uh(){var i=$n.current;return i!==null?i:Ge.pooledCache}function zl(i,n){n===null?ee($n,$n.current):ee($n,n.pool)}function vp(){var i=Uh();return i===null?null:{parent:dt._currentValue,pool:i}}var zr=Error(r(460)),jh=Error(r(474)),Hl=Error(r(542)),Pl={then:function(){}};function yp(i){return i=i.status,i==="fulfilled"||i==="rejected"}function Sp(i,n,a){switch(a=i[a],a===void 0?i.push(n):a!==n&&(n.then(hs,hs),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw i=n.reason,wp(i),i;default:if(typeof n.status=="string")n.then(hs,hs);else{if(i=Ge,i!==null&&100<i.shellSuspendCounter)throw Error(r(482));i=n,i.status="pending",i.then(function(c){if(n.status==="pending"){var _=n;_.status="fulfilled",_.value=c}},function(c){if(n.status==="pending"){var _=n;_.status="rejected",_.reason=c}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw i=n.reason,wp(i),i}throw Wn=n,zr}}function qn(i){try{var n=i._init;return n(i._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Wn=a,zr):a}}var Wn=null;function bp(){if(Wn===null)throw Error(r(459));var i=Wn;return Wn=null,i}function wp(i){if(i===zr||i===Hl)throw Error(r(483))}var Hr=null,jo=0;function Ul(i){var n=jo;return jo+=1,Hr===null&&(Hr=[]),Sp(Hr,i,n)}function Io(i,n){n=n.props.ref,i.ref=n!==void 0?n:null}function jl(i,n){throw n.$$typeof===v?Error(r(525)):(i=Object.prototype.toString.call(n),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":i)))}function xp(i){function n(K,Y){if(i){var F=K.deletions;F===null?(K.deletions=[Y],K.flags|=16):F.push(Y)}}function a(K,Y){if(!i)return null;for(;Y!==null;)n(K,Y),Y=Y.sibling;return null}function c(K){for(var Y=new Map;K!==null;)K.key!==null?Y.set(K.key,K):Y.set(K.index,K),K=K.sibling;return Y}function _(K,Y){return K=ds(K,Y),K.index=0,K.sibling=null,K}function g(K,Y,F){return K.index=F,i?(F=K.alternate,F!==null?(F=F.index,F<Y?(K.flags|=67108866,Y):F):(K.flags|=67108866,Y)):(K.flags|=1048576,Y)}function w(K){return i&&K.alternate===null&&(K.flags|=67108866),K}function k(K,Y,F,re){return Y===null||Y.tag!==6?(Y=Dh(F,K.mode,re),Y.return=K,Y):(Y=_(Y,F),Y.return=K,Y)}function U(K,Y,F,re){var Se=F.type;return Se===b?se(K,Y,F.props.children,re,F.key):Y!==null&&(Y.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===V&&qn(Se)===Y.type)?(Y=_(Y,F.props),Io(Y,F),Y.return=K,Y):(Y=Rl(F.type,F.key,F.props,null,K.mode,re),Io(Y,F),Y.return=K,Y)}function Q(K,Y,F,re){return Y===null||Y.tag!==4||Y.stateNode.containerInfo!==F.containerInfo||Y.stateNode.implementation!==F.implementation?(Y=Th(F,K.mode,re),Y.return=K,Y):(Y=_(Y,F.children||[]),Y.return=K,Y)}function se(K,Y,F,re,Se){return Y===null||Y.tag!==7?(Y=Pn(F,K.mode,re,Se),Y.return=K,Y):(Y=_(Y,F),Y.return=K,Y)}function oe(K,Y,F){if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return Y=Dh(""+Y,K.mode,F),Y.return=K,Y;if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case S:return F=Rl(Y.type,Y.key,Y.props,null,K.mode,F),Io(F,Y),F.return=K,F;case y:return Y=Th(Y,K.mode,F),Y.return=K,Y;case V:return Y=qn(Y),oe(K,Y,F)}if(z(Y)||$(Y))return Y=Pn(Y,K.mode,F,null),Y.return=K,Y;if(typeof Y.then=="function")return oe(K,Ul(Y),F);if(Y.$$typeof===E)return oe(K,Ol(K,Y),F);jl(K,Y)}return null}function J(K,Y,F,re){var Se=Y!==null?Y.key:null;if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return Se!==null?null:k(K,Y,""+F,re);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case S:return F.key===Se?U(K,Y,F,re):null;case y:return F.key===Se?Q(K,Y,F,re):null;case V:return F=qn(F),J(K,Y,F,re)}if(z(F)||$(F))return Se!==null?null:se(K,Y,F,re,null);if(typeof F.then=="function")return J(K,Y,Ul(F),re);if(F.$$typeof===E)return J(K,Y,Ol(K,F),re);jl(K,F)}return null}function ie(K,Y,F,re,Se){if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return K=K.get(F)||null,k(Y,K,""+re,Se);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case S:return K=K.get(re.key===null?F:re.key)||null,U(Y,K,re,Se);case y:return K=K.get(re.key===null?F:re.key)||null,Q(Y,K,re,Se);case V:return re=qn(re),ie(K,Y,F,re,Se)}if(z(re)||$(re))return K=K.get(F)||null,se(Y,K,re,Se,null);if(typeof re.then=="function")return ie(K,Y,F,Ul(re),Se);if(re.$$typeof===E)return ie(K,Y,F,Ol(Y,re),Se);jl(Y,re)}return null}function pe(K,Y,F,re){for(var Se=null,Ue=null,ve=Y,Te=Y=0,ze=null;ve!==null&&Te<F.length;Te++){ve.index>Te?(ze=ve,ve=null):ze=ve.sibling;var je=J(K,ve,F[Te],re);if(je===null){ve===null&&(ve=ze);break}i&&ve&&je.alternate===null&&n(K,ve),Y=g(je,Y,Te),Ue===null?Se=je:Ue.sibling=je,Ue=je,ve=ze}if(Te===F.length)return a(K,ve),He&&_s(K,Te),Se;if(ve===null){for(;Te<F.length;Te++)ve=oe(K,F[Te],re),ve!==null&&(Y=g(ve,Y,Te),Ue===null?Se=ve:Ue.sibling=ve,Ue=ve);return He&&_s(K,Te),Se}for(ve=c(ve);Te<F.length;Te++)ze=ie(ve,K,Te,F[Te],re),ze!==null&&(i&&ze.alternate!==null&&ve.delete(ze.key===null?Te:ze.key),Y=g(ze,Y,Te),Ue===null?Se=ze:Ue.sibling=ze,Ue=ze);return i&&ve.forEach(function(dn){return n(K,dn)}),He&&_s(K,Te),Se}function we(K,Y,F,re){if(F==null)throw Error(r(151));for(var Se=null,Ue=null,ve=Y,Te=Y=0,ze=null,je=F.next();ve!==null&&!je.done;Te++,je=F.next()){ve.index>Te?(ze=ve,ve=null):ze=ve.sibling;var dn=J(K,ve,je.value,re);if(dn===null){ve===null&&(ve=ze);break}i&&ve&&dn.alternate===null&&n(K,ve),Y=g(dn,Y,Te),Ue===null?Se=dn:Ue.sibling=dn,Ue=dn,ve=ze}if(je.done)return a(K,ve),He&&_s(K,Te),Se;if(ve===null){for(;!je.done;Te++,je=F.next())je=oe(K,je.value,re),je!==null&&(Y=g(je,Y,Te),Ue===null?Se=je:Ue.sibling=je,Ue=je);return He&&_s(K,Te),Se}for(ve=c(ve);!je.done;Te++,je=F.next())je=ie(ve,K,Te,je.value,re),je!==null&&(i&&je.alternate!==null&&ve.delete(je.key===null?Te:je.key),Y=g(je,Y,Te),Ue===null?Se=je:Ue.sibling=je,Ue=je);return i&&ve.forEach(function(DC){return n(K,DC)}),He&&_s(K,Te),Se}function Xe(K,Y,F,re){if(typeof F=="object"&&F!==null&&F.type===b&&F.key===null&&(F=F.props.children),typeof F=="object"&&F!==null){switch(F.$$typeof){case S:e:{for(var Se=F.key;Y!==null;){if(Y.key===Se){if(Se=F.type,Se===b){if(Y.tag===7){a(K,Y.sibling),re=_(Y,F.props.children),re.return=K,K=re;break e}}else if(Y.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===V&&qn(Se)===Y.type){a(K,Y.sibling),re=_(Y,F.props),Io(re,F),re.return=K,K=re;break e}a(K,Y);break}else n(K,Y);Y=Y.sibling}F.type===b?(re=Pn(F.props.children,K.mode,re,F.key),re.return=K,K=re):(re=Rl(F.type,F.key,F.props,null,K.mode,re),Io(re,F),re.return=K,K=re)}return w(K);case y:e:{for(Se=F.key;Y!==null;){if(Y.key===Se)if(Y.tag===4&&Y.stateNode.containerInfo===F.containerInfo&&Y.stateNode.implementation===F.implementation){a(K,Y.sibling),re=_(Y,F.children||[]),re.return=K,K=re;break e}else{a(K,Y);break}else n(K,Y);Y=Y.sibling}re=Th(F,K.mode,re),re.return=K,K=re}return w(K);case V:return F=qn(F),Xe(K,Y,F,re)}if(z(F))return pe(K,Y,F,re);if($(F)){if(Se=$(F),typeof Se!="function")throw Error(r(150));return F=Se.call(F),we(K,Y,F,re)}if(typeof F.then=="function")return Xe(K,Y,Ul(F),re);if(F.$$typeof===E)return Xe(K,Y,Ol(K,F),re);jl(K,F)}return typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint"?(F=""+F,Y!==null&&Y.tag===6?(a(K,Y.sibling),re=_(Y,F),re.return=K,K=re):(a(K,Y),re=Dh(F,K.mode,re),re.return=K,K=re),w(K)):a(K,Y)}return function(K,Y,F,re){try{jo=0;var Se=Xe(K,Y,F,re);return Hr=null,Se}catch(ve){if(ve===zr||ve===Hl)throw ve;var Ue=li(29,ve,null,K.mode);return Ue.lanes=re,Ue.return=K,Ue}finally{}}}var Yn=xp(!0),Cp=xp(!1),Gs=!1;function Ih(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function $h(i,n){i=i.updateQueue,n.updateQueue===i&&(n.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Fs(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Zs(i,n,a){var c=i.updateQueue;if(c===null)return null;if(c=c.shared,(Ie&2)!==0){var _=c.pending;return _===null?n.next=n:(n.next=_.next,_.next=n),c.pending=n,n=Nl(i),ap(i,null,a),n}return Al(i,c,n,a),Nl(i)}function $o(i,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var c=n.lanes;c&=i.pendingLanes,a|=c,n.lanes=a,cl(i,a)}}function qh(i,n){var a=i.updateQueue,c=i.alternate;if(c!==null&&(c=c.updateQueue,a===c)){var _=null,g=null;if(a=a.firstBaseUpdate,a!==null){do{var w={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};g===null?_=g=w:g=g.next=w,a=a.next}while(a!==null);g===null?_=g=n:g=g.next=n}else _=g=n;a={baseState:c.baseState,firstBaseUpdate:_,lastBaseUpdate:g,shared:c.shared,callbacks:c.callbacks},i.updateQueue=a;return}i=a.lastBaseUpdate,i===null?a.firstBaseUpdate=n:i.next=n,a.lastBaseUpdate=n}var Wh=!1;function qo(){if(Wh){var i=Or;if(i!==null)throw i}}function Wo(i,n,a,c){Wh=!1;var _=i.updateQueue;Gs=!1;var g=_.firstBaseUpdate,w=_.lastBaseUpdate,k=_.shared.pending;if(k!==null){_.shared.pending=null;var U=k,Q=U.next;U.next=null,w===null?g=Q:w.next=Q,w=U;var se=i.alternate;se!==null&&(se=se.updateQueue,k=se.lastBaseUpdate,k!==w&&(k===null?se.firstBaseUpdate=Q:k.next=Q,se.lastBaseUpdate=U))}if(g!==null){var oe=_.baseState;w=0,se=Q=U=null,k=g;do{var J=k.lane&-536870913,ie=J!==k.lane;if(ie?(Oe&J)===J:(c&J)===J){J!==0&&J===Lr&&(Wh=!0),se!==null&&(se=se.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var pe=i,we=k;J=n;var Xe=a;switch(we.tag){case 1:if(pe=we.payload,typeof pe=="function"){oe=pe.call(Xe,oe,J);break e}oe=pe;break e;case 3:pe.flags=pe.flags&-65537|128;case 0:if(pe=we.payload,J=typeof pe=="function"?pe.call(Xe,oe,J):pe,J==null)break e;oe=m({},oe,J);break e;case 2:Gs=!0}}J=k.callback,J!==null&&(i.flags|=64,ie&&(i.flags|=8192),ie=_.callbacks,ie===null?_.callbacks=[J]:ie.push(J))}else ie={lane:J,tag:k.tag,payload:k.payload,callback:k.callback,next:null},se===null?(Q=se=ie,U=oe):se=se.next=ie,w|=J;if(k=k.next,k===null){if(k=_.shared.pending,k===null)break;ie=k,k=ie.next,ie.next=null,_.lastBaseUpdate=ie,_.shared.pending=null}}while(!0);se===null&&(U=oe),_.baseState=U,_.firstBaseUpdate=Q,_.lastBaseUpdate=se,g===null&&(_.shared.lanes=0),sn|=w,i.lanes=w,i.memoizedState=oe}}function Ep(i,n){if(typeof i!="function")throw Error(r(191,i));i.call(n)}function Mp(i,n){var a=i.callbacks;if(a!==null)for(i.callbacks=null,i=0;i<a.length;i++)Ep(a[i],n)}var Pr=R(null),Il=R(0);function kp(i,n){i=Es,ee(Il,i),ee(Pr,n),Es=i|n.baseLanes}function Yh(){ee(Il,Es),ee(Pr,Pr.current)}function Vh(){Es=Il.current,W(Pr),W(Il)}var ci=R(null),Ci=null;function Qs(i){var n=i.alternate;ee(ct,ct.current&1),ee(ci,i),Ci===null&&(n===null||Pr.current!==null||n.memoizedState!==null)&&(Ci=i)}function Xh(i){ee(ct,ct.current),ee(ci,i),Ci===null&&(Ci=i)}function Dp(i){i.tag===22?(ee(ct,ct.current),ee(ci,i),Ci===null&&(Ci=i)):Js()}function Js(){ee(ct,ct.current),ee(ci,ci.current)}function ui(i){W(ci),Ci===i&&(Ci=null),W(ct)}var ct=R(0);function $l(i){for(var n=i;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||ed(a)||td(a)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===i)break;for(;n.sibling===null;){if(n.return===null||n.return===i)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var ms=0,De=null,Ye=null,_t=null,ql=!1,Ur=!1,Vn=!1,Wl=0,Yo=0,jr=null,vx=0;function rt(){throw Error(r(321))}function Kh(i,n){if(n===null)return!1;for(var a=0;a<n.length&&a<i.length;a++)if(!ai(i[a],n[a]))return!1;return!0}function Gh(i,n,a,c,_,g){return ms=g,De=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,M.H=i===null||i.memoizedState===null?hm:hf,Vn=!1,g=a(c,_),Vn=!1,Ur&&(g=Ap(n,a,c,_)),Tp(i),g}function Tp(i){M.H=Ko;var n=Ye!==null&&Ye.next!==null;if(ms=0,_t=Ye=De=null,ql=!1,Yo=0,jr=null,n)throw Error(r(300));i===null||gt||(i=i.dependencies,i!==null&&Ll(i)&&(gt=!0))}function Ap(i,n,a,c){De=i;var _=0;do{if(Ur&&(jr=null),Yo=0,Ur=!1,25<=_)throw Error(r(301));if(_+=1,_t=Ye=null,i.updateQueue!=null){var g=i.updateQueue;g.lastEffect=null,g.events=null,g.stores=null,g.memoCache!=null&&(g.memoCache.index=0)}M.H=fm,g=n(a,c)}while(Ur);return g}function yx(){var i=M.H,n=i.useState()[0];return n=typeof n.then=="function"?Vo(n):n,i=i.useState()[0],(Ye!==null?Ye.memoizedState:null)!==i&&(De.flags|=1024),n}function Fh(){var i=Wl!==0;return Wl=0,i}function Zh(i,n,a){n.updateQueue=i.updateQueue,n.flags&=-2053,i.lanes&=~a}function Qh(i){if(ql){for(i=i.memoizedState;i!==null;){var n=i.queue;n!==null&&(n.pending=null),i=i.next}ql=!1}ms=0,_t=Ye=De=null,Ur=!1,Yo=Wl=0,jr=null}function Wt(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _t===null?De.memoizedState=_t=i:_t=_t.next=i,_t}function ut(){if(Ye===null){var i=De.alternate;i=i!==null?i.memoizedState:null}else i=Ye.next;var n=_t===null?De.memoizedState:_t.next;if(n!==null)_t=n,Ye=i;else{if(i===null)throw De.alternate===null?Error(r(467)):Error(r(310));Ye=i,i={memoizedState:Ye.memoizedState,baseState:Ye.baseState,baseQueue:Ye.baseQueue,queue:Ye.queue,next:null},_t===null?De.memoizedState=_t=i:_t=_t.next=i}return _t}function Yl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Vo(i){var n=Yo;return Yo+=1,jr===null&&(jr=[]),i=Sp(jr,i,n),n=De,(_t===null?n.memoizedState:_t.next)===null&&(n=n.alternate,M.H=n===null||n.memoizedState===null?hm:hf),i}function Vl(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Vo(i);if(i.$$typeof===E)return Lt(i)}throw Error(r(438,String(i)))}function Jh(i){var n=null,a=De.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var c=De.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(n={data:c.data.map(function(_){return _.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=Yl(),De.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(i),c=0;c<i;c++)a[c]=ne;return n.index++,a}function vs(i,n){return typeof n=="function"?n(i):n}function Xl(i){var n=ut();return ef(n,Ye,i)}function ef(i,n,a){var c=i.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=a;var _=i.baseQueue,g=c.pending;if(g!==null){if(_!==null){var w=_.next;_.next=g.next,g.next=w}n.baseQueue=_=g,c.pending=null}if(g=i.baseState,_===null)i.memoizedState=g;else{n=_.next;var k=w=null,U=null,Q=n,se=!1;do{var oe=Q.lane&-536870913;if(oe!==Q.lane?(Oe&oe)===oe:(ms&oe)===oe){var J=Q.revertLane;if(J===0)U!==null&&(U=U.next={lane:0,revertLane:0,gesture:null,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null}),oe===Lr&&(se=!0);else if((ms&J)===J){Q=Q.next,J===Lr&&(se=!0);continue}else oe={lane:0,revertLane:Q.revertLane,gesture:null,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null},U===null?(k=U=oe,w=g):U=U.next=oe,De.lanes|=J,sn|=J;oe=Q.action,Vn&&a(g,oe),g=Q.hasEagerState?Q.eagerState:a(g,oe)}else J={lane:oe,revertLane:Q.revertLane,gesture:Q.gesture,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null},U===null?(k=U=J,w=g):U=U.next=J,De.lanes|=oe,sn|=oe;Q=Q.next}while(Q!==null&&Q!==n);if(U===null?w=g:U.next=k,!ai(g,i.memoizedState)&&(gt=!0,se&&(a=Or,a!==null)))throw a;i.memoizedState=g,i.baseState=w,i.baseQueue=U,c.lastRenderedState=g}return _===null&&(c.lanes=0),[i.memoizedState,c.dispatch]}function tf(i){var n=ut(),a=n.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=i;var c=a.dispatch,_=a.pending,g=n.memoizedState;if(_!==null){a.pending=null;var w=_=_.next;do g=i(g,w.action),w=w.next;while(w!==_);ai(g,n.memoizedState)||(gt=!0),n.memoizedState=g,n.baseQueue===null&&(n.baseState=g),a.lastRenderedState=g}return[g,c]}function Np(i,n,a){var c=De,_=ut(),g=He;if(g){if(a===void 0)throw Error(r(407));a=a()}else a=n();var w=!ai((Ye||_).memoizedState,a);if(w&&(_.memoizedState=a,gt=!0),_=_.queue,rf(Lp.bind(null,c,_,i),[i]),_.getSnapshot!==n||w||_t!==null&&_t.memoizedState.tag&1){if(c.flags|=2048,Ir(9,{destroy:void 0},Bp.bind(null,c,_,a,n),null),Ge===null)throw Error(r(349));g||(ms&127)!==0||Rp(c,n,a)}return a}function Rp(i,n,a){i.flags|=16384,i={getSnapshot:n,value:a},n=De.updateQueue,n===null?(n=Yl(),De.updateQueue=n,n.stores=[i]):(a=n.stores,a===null?n.stores=[i]:a.push(i))}function Bp(i,n,a,c){n.value=a,n.getSnapshot=c,Op(n)&&zp(i)}function Lp(i,n,a){return a(function(){Op(n)&&zp(i)})}function Op(i){var n=i.getSnapshot;i=i.value;try{var a=n();return!ai(i,a)}catch{return!0}}function zp(i){var n=Hn(i,2);n!==null&&ti(n,i,2)}function sf(i){var n=Wt();if(typeof i=="function"){var a=i;if(i=a(),Vn){qi(!0);try{a()}finally{qi(!1)}}}return n.memoizedState=n.baseState=i,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:vs,lastRenderedState:i},n}function Hp(i,n,a,c){return i.baseState=a,ef(i,Ye,typeof c=="function"?c:vs)}function Sx(i,n,a,c,_){if(Fl(i))throw Error(r(485));if(i=n.action,i!==null){var g={payload:_,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){g.listeners.push(w)}};M.T!==null?a(!0):g.isTransition=!1,c(g),a=n.pending,a===null?(g.next=n.pending=g,Pp(n,g)):(g.next=a.next,n.pending=a.next=g)}}function Pp(i,n){var a=n.action,c=n.payload,_=i.state;if(n.isTransition){var g=M.T,w={};M.T=w;try{var k=a(_,c),U=M.S;U!==null&&U(w,k),Up(i,n,k)}catch(Q){nf(i,n,Q)}finally{g!==null&&w.types!==null&&(g.types=w.types),M.T=g}}else try{g=a(_,c),Up(i,n,g)}catch(Q){nf(i,n,Q)}}function Up(i,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(c){jp(i,n,c)},function(c){return nf(i,n,c)}):jp(i,n,a)}function jp(i,n,a){n.status="fulfilled",n.value=a,Ip(n),i.state=a,n=i.pending,n!==null&&(a=n.next,a===n?i.pending=null:(a=a.next,n.next=a,Pp(i,a)))}function nf(i,n,a){var c=i.pending;if(i.pending=null,c!==null){c=c.next;do n.status="rejected",n.reason=a,Ip(n),n=n.next;while(n!==c)}i.action=null}function Ip(i){i=i.listeners;for(var n=0;n<i.length;n++)(0,i[n])()}function $p(i,n){return n}function qp(i,n){if(He){var a=Ge.formState;if(a!==null){e:{var c=De;if(He){if(Fe){t:{for(var _=Fe,g=xi;_.nodeType!==8;){if(!g){_=null;break t}if(_=Ei(_.nextSibling),_===null){_=null;break t}}g=_.data,_=g==="F!"||g==="F"?_:null}if(_){Fe=Ei(_.nextSibling),c=_.data==="F!";break e}}Xs(c)}c=!1}c&&(n=a[0])}}return a=Wt(),a.memoizedState=a.baseState=n,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$p,lastRenderedState:n},a.queue=c,a=lm.bind(null,De,c),c.dispatch=a,c=sf(!1),g=uf.bind(null,De,!1,c.queue),c=Wt(),_={state:n,dispatch:null,action:i,pending:null},c.queue=_,a=Sx.bind(null,De,_,g,a),_.dispatch=a,c.memoizedState=i,[n,a,!1]}function Wp(i){var n=ut();return Yp(n,Ye,i)}function Yp(i,n,a){if(n=ef(i,n,$p)[0],i=Xl(vs)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var c=Vo(n)}catch(w){throw w===zr?Hl:w}else c=n;n=ut();var _=n.queue,g=_.dispatch;return a!==n.memoizedState&&(De.flags|=2048,Ir(9,{destroy:void 0},bx.bind(null,_,a),null)),[c,g,i]}function bx(i,n){i.action=n}function Vp(i){var n=ut(),a=Ye;if(a!==null)return Yp(n,a,i);ut(),n=n.memoizedState,a=ut();var c=a.queue.dispatch;return a.memoizedState=i,[n,c,!1]}function Ir(i,n,a,c){return i={tag:i,create:a,deps:c,inst:n,next:null},n=De.updateQueue,n===null&&(n=Yl(),De.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=i.next=i:(c=a.next,a.next=i,i.next=c,n.lastEffect=i),i}function Xp(){return ut().memoizedState}function Kl(i,n,a,c){var _=Wt();De.flags|=i,_.memoizedState=Ir(1|n,{destroy:void 0},a,c===void 0?null:c)}function Gl(i,n,a,c){var _=ut();c=c===void 0?null:c;var g=_.memoizedState.inst;Ye!==null&&c!==null&&Kh(c,Ye.memoizedState.deps)?_.memoizedState=Ir(n,g,a,c):(De.flags|=i,_.memoizedState=Ir(1|n,g,a,c))}function Kp(i,n){Kl(8390656,8,i,n)}function rf(i,n){Gl(2048,8,i,n)}function wx(i){De.flags|=4;var n=De.updateQueue;if(n===null)n=Yl(),De.updateQueue=n,n.events=[i];else{var a=n.events;a===null?n.events=[i]:a.push(i)}}function Gp(i){var n=ut().memoizedState;return wx({ref:n,nextImpl:i}),function(){if((Ie&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}function Fp(i,n){return Gl(4,2,i,n)}function Zp(i,n){return Gl(4,4,i,n)}function Qp(i,n){if(typeof n=="function"){i=i();var a=n(i);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return i=i(),n.current=i,function(){n.current=null}}function Jp(i,n,a){a=a!=null?a.concat([i]):null,Gl(4,4,Qp.bind(null,n,i),a)}function of(){}function em(i,n){var a=ut();n=n===void 0?null:n;var c=a.memoizedState;return n!==null&&Kh(n,c[1])?c[0]:(a.memoizedState=[i,n],i)}function tm(i,n){var a=ut();n=n===void 0?null:n;var c=a.memoizedState;if(n!==null&&Kh(n,c[1]))return c[0];if(c=i(),Vn){qi(!0);try{i()}finally{qi(!1)}}return a.memoizedState=[c,n],c}function af(i,n,a){return a===void 0||(ms&1073741824)!==0&&(Oe&261930)===0?i.memoizedState=n:(i.memoizedState=a,i=i0(),De.lanes|=i,sn|=i,a)}function im(i,n,a,c){return ai(a,n)?a:Pr.current!==null?(i=af(i,a,c),ai(i,n)||(gt=!0),i):(ms&42)===0||(ms&1073741824)!==0&&(Oe&261930)===0?(gt=!0,i.memoizedState=a):(i=i0(),De.lanes|=i,sn|=i,n)}function sm(i,n,a,c,_){var g=L.p;L.p=g!==0&&8>g?g:8;var w=M.T,k={};M.T=k,uf(i,!1,n,a);try{var U=_(),Q=M.S;if(Q!==null&&Q(k,U),U!==null&&typeof U=="object"&&typeof U.then=="function"){var se=mx(U,c);Xo(i,n,se,di(i))}else Xo(i,n,c,di(i))}catch(oe){Xo(i,n,{then:function(){},status:"rejected",reason:oe},di())}finally{L.p=g,w!==null&&k.types!==null&&(w.types=k.types),M.T=w}}function xx(){}function lf(i,n,a,c){if(i.tag!==5)throw Error(r(476));var _=nm(i).queue;sm(i,_,n,B,a===null?xx:function(){return rm(i),a(c)})}function nm(i){var n=i.memoizedState;if(n!==null)return n;n={memoizedState:B,baseState:B,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vs,lastRenderedState:B},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vs,lastRenderedState:a},next:null},i.memoizedState=n,i=i.alternate,i!==null&&(i.memoizedState=n),n}function rm(i){var n=nm(i);n.next===null&&(n=i.alternate.memoizedState),Xo(i,n.next.queue,{},di())}function cf(){return Lt(ua)}function om(){return ut().memoizedState}function am(){return ut().memoizedState}function Cx(i){for(var n=i.return;n!==null;){switch(n.tag){case 24:case 3:var a=di();i=Fs(a);var c=Zs(n,i,a);c!==null&&(ti(c,n,a),$o(c,n,a)),n={cache:Hh()},i.payload=n;return}n=n.return}}function Ex(i,n,a){var c=di();a={lane:c,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Fl(i)?cm(n,a):(a=Mh(i,n,a,c),a!==null&&(ti(a,i,c),um(a,n,c)))}function lm(i,n,a){var c=di();Xo(i,n,a,c)}function Xo(i,n,a,c){var _={lane:c,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Fl(i))cm(n,_);else{var g=i.alternate;if(i.lanes===0&&(g===null||g.lanes===0)&&(g=n.lastRenderedReducer,g!==null))try{var w=n.lastRenderedState,k=g(w,a);if(_.hasEagerState=!0,_.eagerState=k,ai(k,w))return Al(i,n,_,0),Ge===null&&Tl(),!1}catch{}finally{}if(a=Mh(i,n,_,c),a!==null)return ti(a,i,c),um(a,n,c),!0}return!1}function uf(i,n,a,c){if(c={lane:2,revertLane:$f(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Fl(i)){if(n)throw Error(r(479))}else n=Mh(i,a,c,2),n!==null&&ti(n,i,2)}function Fl(i){var n=i.alternate;return i===De||n!==null&&n===De}function cm(i,n){Ur=ql=!0;var a=i.pending;a===null?n.next=n:(n.next=a.next,a.next=n),i.pending=n}function um(i,n,a){if((a&4194048)!==0){var c=n.lanes;c&=i.pendingLanes,a|=c,n.lanes=a,cl(i,a)}}var Ko={readContext:Lt,use:Vl,useCallback:rt,useContext:rt,useEffect:rt,useImperativeHandle:rt,useLayoutEffect:rt,useInsertionEffect:rt,useMemo:rt,useReducer:rt,useRef:rt,useState:rt,useDebugValue:rt,useDeferredValue:rt,useTransition:rt,useSyncExternalStore:rt,useId:rt,useHostTransitionStatus:rt,useFormState:rt,useActionState:rt,useOptimistic:rt,useMemoCache:rt,useCacheRefresh:rt};Ko.useEffectEvent=rt;var hm={readContext:Lt,use:Vl,useCallback:function(i,n){return Wt().memoizedState=[i,n===void 0?null:n],i},useContext:Lt,useEffect:Kp,useImperativeHandle:function(i,n,a){a=a!=null?a.concat([i]):null,Kl(4194308,4,Qp.bind(null,n,i),a)},useLayoutEffect:function(i,n){return Kl(4194308,4,i,n)},useInsertionEffect:function(i,n){Kl(4,2,i,n)},useMemo:function(i,n){var a=Wt();n=n===void 0?null:n;var c=i();if(Vn){qi(!0);try{i()}finally{qi(!1)}}return a.memoizedState=[c,n],c},useReducer:function(i,n,a){var c=Wt();if(a!==void 0){var _=a(n);if(Vn){qi(!0);try{a(n)}finally{qi(!1)}}}else _=n;return c.memoizedState=c.baseState=_,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:_},c.queue=i,i=i.dispatch=Ex.bind(null,De,i),[c.memoizedState,i]},useRef:function(i){var n=Wt();return i={current:i},n.memoizedState=i},useState:function(i){i=sf(i);var n=i.queue,a=lm.bind(null,De,n);return n.dispatch=a,[i.memoizedState,a]},useDebugValue:of,useDeferredValue:function(i,n){var a=Wt();return af(a,i,n)},useTransition:function(){var i=sf(!1);return i=sm.bind(null,De,i.queue,!0,!1),Wt().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,n,a){var c=De,_=Wt();if(He){if(a===void 0)throw Error(r(407));a=a()}else{if(a=n(),Ge===null)throw Error(r(349));(Oe&127)!==0||Rp(c,n,a)}_.memoizedState=a;var g={value:a,getSnapshot:n};return _.queue=g,Kp(Lp.bind(null,c,g,i),[i]),c.flags|=2048,Ir(9,{destroy:void 0},Bp.bind(null,c,g,a,n),null),a},useId:function(){var i=Wt(),n=Ge.identifierPrefix;if(He){var a=Vi,c=Yi;a=(c&~(1<<32-qt(c)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Wl++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=vx++,n="_"+n+"r_"+a.toString(32)+"_";return i.memoizedState=n},useHostTransitionStatus:cf,useFormState:qp,useActionState:qp,useOptimistic:function(i){var n=Wt();n.memoizedState=n.baseState=i;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=uf.bind(null,De,!0,a),a.dispatch=n,[i,n]},useMemoCache:Jh,useCacheRefresh:function(){return Wt().memoizedState=Cx.bind(null,De)},useEffectEvent:function(i){var n=Wt(),a={impl:i};return n.memoizedState=a,function(){if((Ie&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}},hf={readContext:Lt,use:Vl,useCallback:em,useContext:Lt,useEffect:rf,useImperativeHandle:Jp,useInsertionEffect:Fp,useLayoutEffect:Zp,useMemo:tm,useReducer:Xl,useRef:Xp,useState:function(){return Xl(vs)},useDebugValue:of,useDeferredValue:function(i,n){var a=ut();return im(a,Ye.memoizedState,i,n)},useTransition:function(){var i=Xl(vs)[0],n=ut().memoizedState;return[typeof i=="boolean"?i:Vo(i),n]},useSyncExternalStore:Np,useId:om,useHostTransitionStatus:cf,useFormState:Wp,useActionState:Wp,useOptimistic:function(i,n){var a=ut();return Hp(a,Ye,i,n)},useMemoCache:Jh,useCacheRefresh:am};hf.useEffectEvent=Gp;var fm={readContext:Lt,use:Vl,useCallback:em,useContext:Lt,useEffect:rf,useImperativeHandle:Jp,useInsertionEffect:Fp,useLayoutEffect:Zp,useMemo:tm,useReducer:tf,useRef:Xp,useState:function(){return tf(vs)},useDebugValue:of,useDeferredValue:function(i,n){var a=ut();return Ye===null?af(a,i,n):im(a,Ye.memoizedState,i,n)},useTransition:function(){var i=tf(vs)[0],n=ut().memoizedState;return[typeof i=="boolean"?i:Vo(i),n]},useSyncExternalStore:Np,useId:om,useHostTransitionStatus:cf,useFormState:Vp,useActionState:Vp,useOptimistic:function(i,n){var a=ut();return Ye!==null?Hp(a,Ye,i,n):(a.baseState=i,[i,a.queue.dispatch])},useMemoCache:Jh,useCacheRefresh:am};fm.useEffectEvent=Gp;function ff(i,n,a,c){n=i.memoizedState,a=a(c,n),a=a==null?n:m({},n,a),i.memoizedState=a,i.lanes===0&&(i.updateQueue.baseState=a)}var df={enqueueSetState:function(i,n,a){i=i._reactInternals;var c=di(),_=Fs(c);_.payload=n,a!=null&&(_.callback=a),n=Zs(i,_,c),n!==null&&(ti(n,i,c),$o(n,i,c))},enqueueReplaceState:function(i,n,a){i=i._reactInternals;var c=di(),_=Fs(c);_.tag=1,_.payload=n,a!=null&&(_.callback=a),n=Zs(i,_,c),n!==null&&(ti(n,i,c),$o(n,i,c))},enqueueForceUpdate:function(i,n){i=i._reactInternals;var a=di(),c=Fs(a);c.tag=2,n!=null&&(c.callback=n),n=Zs(i,c,a),n!==null&&(ti(n,i,a),$o(n,i,a))}};function dm(i,n,a,c,_,g,w){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(c,g,w):n.prototype&&n.prototype.isPureReactComponent?!Lo(a,c)||!Lo(_,g):!0}function _m(i,n,a,c){i=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,c),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,c),n.state!==i&&df.enqueueReplaceState(n,n.state,null)}function Xn(i,n){var a=n;if("ref"in n){a={};for(var c in n)c!=="ref"&&(a[c]=n[c])}if(i=i.defaultProps){a===n&&(a=m({},a));for(var _ in i)a[_]===void 0&&(a[_]=i[_])}return a}function gm(i){Dl(i)}function pm(i){console.error(i)}function mm(i){Dl(i)}function Zl(i,n){try{var a=i.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(c){setTimeout(function(){throw c})}}function vm(i,n,a){try{var c=i.onCaughtError;c(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(_){setTimeout(function(){throw _})}}function _f(i,n,a){return a=Fs(a),a.tag=3,a.payload={element:null},a.callback=function(){Zl(i,n)},a}function ym(i){return i=Fs(i),i.tag=3,i}function Sm(i,n,a,c){var _=a.type.getDerivedStateFromError;if(typeof _=="function"){var g=c.value;i.payload=function(){return _(g)},i.callback=function(){vm(n,a,c)}}var w=a.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(i.callback=function(){vm(n,a,c),typeof _!="function"&&(nn===null?nn=new Set([this]):nn.add(this));var k=c.stack;this.componentDidCatch(c.value,{componentStack:k!==null?k:""})})}function Mx(i,n,a,c,_){if(a.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(n=a.alternate,n!==null&&Br(n,a,_,!0),a=ci.current,a!==null){switch(a.tag){case 31:case 13:return Ci===null?cc():a.alternate===null&&ot===0&&(ot=3),a.flags&=-257,a.flags|=65536,a.lanes=_,c===Pl?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([c]):n.add(c),Uf(i,c,_)),!1;case 22:return a.flags|=65536,c===Pl?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([c])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([c]):a.add(c)),Uf(i,c,_)),!1}throw Error(r(435,a.tag))}return Uf(i,c,_),cc(),!1}if(He)return n=ci.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=_,c!==Rh&&(i=Error(r(422),{cause:c}),Ho(Si(i,a)))):(c!==Rh&&(n=Error(r(423),{cause:c}),Ho(Si(n,a))),i=i.current.alternate,i.flags|=65536,_&=-_,i.lanes|=_,c=Si(c,a),_=_f(i.stateNode,c,_),qh(i,_),ot!==4&&(ot=2)),!1;var g=Error(r(520),{cause:c});if(g=Si(g,a),ia===null?ia=[g]:ia.push(g),ot!==4&&(ot=2),n===null)return!0;c=Si(c,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,i=_&-_,a.lanes|=i,i=_f(a.stateNode,c,i),qh(a,i),!1;case 1:if(n=a.type,g=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(nn===null||!nn.has(g))))return a.flags|=65536,_&=-_,a.lanes|=_,_=ym(_),Sm(_,i,a,c),qh(a,_),!1}a=a.return}while(a!==null);return!1}var gf=Error(r(461)),gt=!1;function Ot(i,n,a,c){n.child=i===null?Cp(n,null,a,c):Yn(n,i.child,a,c)}function bm(i,n,a,c,_){a=a.render;var g=n.ref;if("ref"in c){var w={};for(var k in c)k!=="ref"&&(w[k]=c[k])}else w=c;return In(n),c=Gh(i,n,a,w,g,_),k=Fh(),i!==null&&!gt?(Zh(i,n,_),ys(i,n,_)):(He&&k&&Ah(n),n.flags|=1,Ot(i,n,c,_),n.child)}function wm(i,n,a,c,_){if(i===null){var g=a.type;return typeof g=="function"&&!kh(g)&&g.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=g,xm(i,n,g,c,_)):(i=Rl(a.type,null,c,n,n.mode,_),i.ref=n.ref,i.return=n,n.child=i)}if(g=i.child,!xf(i,_)){var w=g.memoizedProps;if(a=a.compare,a=a!==null?a:Lo,a(w,c)&&i.ref===n.ref)return ys(i,n,_)}return n.flags|=1,i=ds(g,c),i.ref=n.ref,i.return=n,n.child=i}function xm(i,n,a,c,_){if(i!==null){var g=i.memoizedProps;if(Lo(g,c)&&i.ref===n.ref)if(gt=!1,n.pendingProps=c=g,xf(i,_))(i.flags&131072)!==0&&(gt=!0);else return n.lanes=i.lanes,ys(i,n,_)}return pf(i,n,a,c,_)}function Cm(i,n,a,c){var _=c.children,g=i!==null?i.memoizedState:null;if(i===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.mode==="hidden"){if((n.flags&128)!==0){if(g=g!==null?g.baseLanes|a:a,i!==null){for(c=n.child=i.child,_=0;c!==null;)_=_|c.lanes|c.childLanes,c=c.sibling;c=_&~g}else c=0,n.child=null;return Em(i,n,g,a,c)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},i!==null&&zl(n,g!==null?g.cachePool:null),g!==null?kp(n,g):Yh(),Dp(n);else return c=n.lanes=536870912,Em(i,n,g!==null?g.baseLanes|a:a,a,c)}else g!==null?(zl(n,g.cachePool),kp(n,g),Js(),n.memoizedState=null):(i!==null&&zl(n,null),Yh(),Js());return Ot(i,n,_,a),n.child}function Go(i,n){return i!==null&&i.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Em(i,n,a,c,_){var g=Uh();return g=g===null?null:{parent:dt._currentValue,pool:g},n.memoizedState={baseLanes:a,cachePool:g},i!==null&&zl(n,null),Yh(),Dp(n),i!==null&&Br(i,n,c,!0),n.childLanes=_,null}function Ql(i,n){return n=ec({mode:n.mode,children:n.children},i.mode),n.ref=i.ref,i.child=n,n.return=i,n}function Mm(i,n,a){return Yn(n,i.child,null,a),i=Ql(n,n.pendingProps),i.flags|=2,ui(n),n.memoizedState=null,i}function kx(i,n,a){var c=n.pendingProps,_=(n.flags&128)!==0;if(n.flags&=-129,i===null){if(He){if(c.mode==="hidden")return i=Ql(n,c),n.lanes=536870912,Go(null,i);if(Xh(n),(i=Fe)?(i=P0(i,xi),i=i!==null&&i.data==="&"?i:null,i!==null&&(n.memoizedState={dehydrated:i,treeContext:Ys!==null?{id:Yi,overflow:Vi}:null,retryLane:536870912,hydrationErrors:null},a=cp(i),a.return=n,n.child=a,Bt=n,Fe=null)):i=null,i===null)throw Xs(n);return n.lanes=536870912,null}return Ql(n,c)}var g=i.memoizedState;if(g!==null){var w=g.dehydrated;if(Xh(n),_)if(n.flags&256)n.flags&=-257,n=Mm(i,n,a);else if(n.memoizedState!==null)n.child=i.child,n.flags|=128,n=null;else throw Error(r(558));else if(gt||Br(i,n,a,!1),_=(a&i.childLanes)!==0,gt||_){if(c=Ge,c!==null&&(w=ul(c,a),w!==0&&w!==g.retryLane))throw g.retryLane=w,Hn(i,w),ti(c,i,w),gf;cc(),n=Mm(i,n,a)}else i=g.treeContext,Fe=Ei(w.nextSibling),Bt=n,He=!0,Vs=null,xi=!1,i!==null&&fp(n,i),n=Ql(n,c),n.flags|=4096;return n}return i=ds(i.child,{mode:c.mode,children:c.children}),i.ref=n.ref,n.child=i,i.return=n,i}function Jl(i,n){var a=n.ref;if(a===null)i!==null&&i.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(r(284));(i===null||i.ref!==a)&&(n.flags|=4194816)}}function pf(i,n,a,c,_){return In(n),a=Gh(i,n,a,c,void 0,_),c=Fh(),i!==null&&!gt?(Zh(i,n,_),ys(i,n,_)):(He&&c&&Ah(n),n.flags|=1,Ot(i,n,a,_),n.child)}function km(i,n,a,c,_,g){return In(n),n.updateQueue=null,a=Ap(n,c,a,_),Tp(i),c=Fh(),i!==null&&!gt?(Zh(i,n,g),ys(i,n,g)):(He&&c&&Ah(n),n.flags|=1,Ot(i,n,a,g),n.child)}function Dm(i,n,a,c,_){if(In(n),n.stateNode===null){var g=Tr,w=a.contextType;typeof w=="object"&&w!==null&&(g=Lt(w)),g=new a(c,g),n.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,g.updater=df,n.stateNode=g,g._reactInternals=n,g=n.stateNode,g.props=c,g.state=n.memoizedState,g.refs={},Ih(n),w=a.contextType,g.context=typeof w=="object"&&w!==null?Lt(w):Tr,g.state=n.memoizedState,w=a.getDerivedStateFromProps,typeof w=="function"&&(ff(n,a,w,c),g.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(w=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),w!==g.state&&df.enqueueReplaceState(g,g.state,null),Wo(n,c,g,_),qo(),g.state=n.memoizedState),typeof g.componentDidMount=="function"&&(n.flags|=4194308),c=!0}else if(i===null){g=n.stateNode;var k=n.memoizedProps,U=Xn(a,k);g.props=U;var Q=g.context,se=a.contextType;w=Tr,typeof se=="object"&&se!==null&&(w=Lt(se));var oe=a.getDerivedStateFromProps;se=typeof oe=="function"||typeof g.getSnapshotBeforeUpdate=="function",k=n.pendingProps!==k,se||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(k||Q!==w)&&_m(n,g,c,w),Gs=!1;var J=n.memoizedState;g.state=J,Wo(n,c,g,_),qo(),Q=n.memoizedState,k||J!==Q||Gs?(typeof oe=="function"&&(ff(n,a,oe,c),Q=n.memoizedState),(U=Gs||dm(n,a,U,c,J,Q,w))?(se||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount()),typeof g.componentDidMount=="function"&&(n.flags|=4194308)):(typeof g.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=c,n.memoizedState=Q),g.props=c,g.state=Q,g.context=w,c=U):(typeof g.componentDidMount=="function"&&(n.flags|=4194308),c=!1)}else{g=n.stateNode,$h(i,n),w=n.memoizedProps,se=Xn(a,w),g.props=se,oe=n.pendingProps,J=g.context,Q=a.contextType,U=Tr,typeof Q=="object"&&Q!==null&&(U=Lt(Q)),k=a.getDerivedStateFromProps,(Q=typeof k=="function"||typeof g.getSnapshotBeforeUpdate=="function")||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(w!==oe||J!==U)&&_m(n,g,c,U),Gs=!1,J=n.memoizedState,g.state=J,Wo(n,c,g,_),qo();var ie=n.memoizedState;w!==oe||J!==ie||Gs||i!==null&&i.dependencies!==null&&Ll(i.dependencies)?(typeof k=="function"&&(ff(n,a,k,c),ie=n.memoizedState),(se=Gs||dm(n,a,se,c,J,ie,U)||i!==null&&i.dependencies!==null&&Ll(i.dependencies))?(Q||typeof g.UNSAFE_componentWillUpdate!="function"&&typeof g.componentWillUpdate!="function"||(typeof g.componentWillUpdate=="function"&&g.componentWillUpdate(c,ie,U),typeof g.UNSAFE_componentWillUpdate=="function"&&g.UNSAFE_componentWillUpdate(c,ie,U)),typeof g.componentDidUpdate=="function"&&(n.flags|=4),typeof g.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof g.componentDidUpdate!="function"||w===i.memoizedProps&&J===i.memoizedState||(n.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||w===i.memoizedProps&&J===i.memoizedState||(n.flags|=1024),n.memoizedProps=c,n.memoizedState=ie),g.props=c,g.state=ie,g.context=U,c=se):(typeof g.componentDidUpdate!="function"||w===i.memoizedProps&&J===i.memoizedState||(n.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||w===i.memoizedProps&&J===i.memoizedState||(n.flags|=1024),c=!1)}return g=c,Jl(i,n),c=(n.flags&128)!==0,g||c?(g=n.stateNode,a=c&&typeof a.getDerivedStateFromError!="function"?null:g.render(),n.flags|=1,i!==null&&c?(n.child=Yn(n,i.child,null,_),n.child=Yn(n,null,a,_)):Ot(i,n,a,_),n.memoizedState=g.state,i=n.child):i=ys(i,n,_),i}function Tm(i,n,a,c){return Un(),n.flags|=256,Ot(i,n,a,c),n.child}var mf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function vf(i){return{baseLanes:i,cachePool:vp()}}function yf(i,n,a){return i=i!==null?i.childLanes&~a:0,n&&(i|=fi),i}function Am(i,n,a){var c=n.pendingProps,_=!1,g=(n.flags&128)!==0,w;if((w=g)||(w=i!==null&&i.memoizedState===null?!1:(ct.current&2)!==0),w&&(_=!0,n.flags&=-129),w=(n.flags&32)!==0,n.flags&=-33,i===null){if(He){if(_?Qs(n):Js(),(i=Fe)?(i=P0(i,xi),i=i!==null&&i.data!=="&"?i:null,i!==null&&(n.memoizedState={dehydrated:i,treeContext:Ys!==null?{id:Yi,overflow:Vi}:null,retryLane:536870912,hydrationErrors:null},a=cp(i),a.return=n,n.child=a,Bt=n,Fe=null)):i=null,i===null)throw Xs(n);return td(i)?n.lanes=32:n.lanes=536870912,null}var k=c.children;return c=c.fallback,_?(Js(),_=n.mode,k=ec({mode:"hidden",children:k},_),c=Pn(c,_,a,null),k.return=n,c.return=n,k.sibling=c,n.child=k,c=n.child,c.memoizedState=vf(a),c.childLanes=yf(i,w,a),n.memoizedState=mf,Go(null,c)):(Qs(n),Sf(n,k))}var U=i.memoizedState;if(U!==null&&(k=U.dehydrated,k!==null)){if(g)n.flags&256?(Qs(n),n.flags&=-257,n=bf(i,n,a)):n.memoizedState!==null?(Js(),n.child=i.child,n.flags|=128,n=null):(Js(),k=c.fallback,_=n.mode,c=ec({mode:"visible",children:c.children},_),k=Pn(k,_,a,null),k.flags|=2,c.return=n,k.return=n,c.sibling=k,n.child=c,Yn(n,i.child,null,a),c=n.child,c.memoizedState=vf(a),c.childLanes=yf(i,w,a),n.memoizedState=mf,n=Go(null,c));else if(Qs(n),td(k)){if(w=k.nextSibling&&k.nextSibling.dataset,w)var Q=w.dgst;w=Q,c=Error(r(419)),c.stack="",c.digest=w,Ho({value:c,source:null,stack:null}),n=bf(i,n,a)}else if(gt||Br(i,n,a,!1),w=(a&i.childLanes)!==0,gt||w){if(w=Ge,w!==null&&(c=ul(w,a),c!==0&&c!==U.retryLane))throw U.retryLane=c,Hn(i,c),ti(w,i,c),gf;ed(k)||cc(),n=bf(i,n,a)}else ed(k)?(n.flags|=192,n.child=i.child,n=null):(i=U.treeContext,Fe=Ei(k.nextSibling),Bt=n,He=!0,Vs=null,xi=!1,i!==null&&fp(n,i),n=Sf(n,c.children),n.flags|=4096);return n}return _?(Js(),k=c.fallback,_=n.mode,U=i.child,Q=U.sibling,c=ds(U,{mode:"hidden",children:c.children}),c.subtreeFlags=U.subtreeFlags&65011712,Q!==null?k=ds(Q,k):(k=Pn(k,_,a,null),k.flags|=2),k.return=n,c.return=n,c.sibling=k,n.child=c,Go(null,c),c=n.child,k=i.child.memoizedState,k===null?k=vf(a):(_=k.cachePool,_!==null?(U=dt._currentValue,_=_.parent!==U?{parent:U,pool:U}:_):_=vp(),k={baseLanes:k.baseLanes|a,cachePool:_}),c.memoizedState=k,c.childLanes=yf(i,w,a),n.memoizedState=mf,Go(i.child,c)):(Qs(n),a=i.child,i=a.sibling,a=ds(a,{mode:"visible",children:c.children}),a.return=n,a.sibling=null,i!==null&&(w=n.deletions,w===null?(n.deletions=[i],n.flags|=16):w.push(i)),n.child=a,n.memoizedState=null,a)}function Sf(i,n){return n=ec({mode:"visible",children:n},i.mode),n.return=i,i.child=n}function ec(i,n){return i=li(22,i,null,n),i.lanes=0,i}function bf(i,n,a){return Yn(n,i.child,null,a),i=Sf(n,n.pendingProps.children),i.flags|=2,n.memoizedState=null,i}function Nm(i,n,a){i.lanes|=n;var c=i.alternate;c!==null&&(c.lanes|=n),Oh(i.return,n,a)}function wf(i,n,a,c,_,g){var w=i.memoizedState;w===null?i.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:c,tail:a,tailMode:_,treeForkCount:g}:(w.isBackwards=n,w.rendering=null,w.renderingStartTime=0,w.last=c,w.tail=a,w.tailMode=_,w.treeForkCount=g)}function Rm(i,n,a){var c=n.pendingProps,_=c.revealOrder,g=c.tail;c=c.children;var w=ct.current,k=(w&2)!==0;if(k?(w=w&1|2,n.flags|=128):w&=1,ee(ct,w),Ot(i,n,c,a),c=He?zo:0,!k&&i!==null&&(i.flags&128)!==0)e:for(i=n.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&Nm(i,a,n);else if(i.tag===19)Nm(i,a,n);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===n)break e;for(;i.sibling===null;){if(i.return===null||i.return===n)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(_){case"forwards":for(a=n.child,_=null;a!==null;)i=a.alternate,i!==null&&$l(i)===null&&(_=a),a=a.sibling;a=_,a===null?(_=n.child,n.child=null):(_=a.sibling,a.sibling=null),wf(n,!1,_,a,g,c);break;case"backwards":case"unstable_legacy-backwards":for(a=null,_=n.child,n.child=null;_!==null;){if(i=_.alternate,i!==null&&$l(i)===null){n.child=_;break}i=_.sibling,_.sibling=a,a=_,_=i}wf(n,!0,a,null,g,c);break;case"together":wf(n,!1,null,null,void 0,c);break;default:n.memoizedState=null}return n.child}function ys(i,n,a){if(i!==null&&(n.dependencies=i.dependencies),sn|=n.lanes,(a&n.childLanes)===0)if(i!==null){if(Br(i,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(i!==null&&n.child!==i.child)throw Error(r(153));if(n.child!==null){for(i=n.child,a=ds(i,i.pendingProps),n.child=a,a.return=n;i.sibling!==null;)i=i.sibling,a=a.sibling=ds(i,i.pendingProps),a.return=n;a.sibling=null}return n.child}function xf(i,n){return(i.lanes&n)!==0?!0:(i=i.dependencies,!!(i!==null&&Ll(i)))}function Dx(i,n,a){switch(n.tag){case 3:ue(n,n.stateNode.containerInfo),Ks(n,dt,i.memoizedState.cache),Un();break;case 27:case 5:Ce(n);break;case 4:ue(n,n.stateNode.containerInfo);break;case 10:Ks(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Xh(n),null;break;case 13:var c=n.memoizedState;if(c!==null)return c.dehydrated!==null?(Qs(n),n.flags|=128,null):(a&n.child.childLanes)!==0?Am(i,n,a):(Qs(n),i=ys(i,n,a),i!==null?i.sibling:null);Qs(n);break;case 19:var _=(i.flags&128)!==0;if(c=(a&n.childLanes)!==0,c||(Br(i,n,a,!1),c=(a&n.childLanes)!==0),_){if(c)return Rm(i,n,a);n.flags|=128}if(_=n.memoizedState,_!==null&&(_.rendering=null,_.tail=null,_.lastEffect=null),ee(ct,ct.current),c)break;return null;case 22:return n.lanes=0,Cm(i,n,a,n.pendingProps);case 24:Ks(n,dt,i.memoizedState.cache)}return ys(i,n,a)}function Bm(i,n,a){if(i!==null)if(i.memoizedProps!==n.pendingProps)gt=!0;else{if(!xf(i,a)&&(n.flags&128)===0)return gt=!1,Dx(i,n,a);gt=(i.flags&131072)!==0}else gt=!1,He&&(n.flags&1048576)!==0&&hp(n,zo,n.index);switch(n.lanes=0,n.tag){case 16:e:{var c=n.pendingProps;if(i=qn(n.elementType),n.type=i,typeof i=="function")kh(i)?(c=Xn(i,c),n.tag=1,n=Dm(null,n,i,c,a)):(n.tag=0,n=pf(null,n,i,c,a));else{if(i!=null){var _=i.$$typeof;if(_===D){n.tag=11,n=bm(null,n,i,c,a);break e}else if(_===P){n.tag=14,n=wm(null,n,i,c,a);break e}}throw n=N(i)||i,Error(r(306,n,""))}}return n;case 0:return pf(i,n,n.type,n.pendingProps,a);case 1:return c=n.type,_=Xn(c,n.pendingProps),Dm(i,n,c,_,a);case 3:e:{if(ue(n,n.stateNode.containerInfo),i===null)throw Error(r(387));c=n.pendingProps;var g=n.memoizedState;_=g.element,$h(i,n),Wo(n,c,null,a);var w=n.memoizedState;if(c=w.cache,Ks(n,dt,c),c!==g.cache&&zh(n,[dt],a,!0),qo(),c=w.element,g.isDehydrated)if(g={element:c,isDehydrated:!1,cache:w.cache},n.updateQueue.baseState=g,n.memoizedState=g,n.flags&256){n=Tm(i,n,c,a);break e}else if(c!==_){_=Si(Error(r(424)),n),Ho(_),n=Tm(i,n,c,a);break e}else{switch(i=n.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(Fe=Ei(i.firstChild),Bt=n,He=!0,Vs=null,xi=!0,a=Cp(n,null,c,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Un(),c===_){n=ys(i,n,a);break e}Ot(i,n,c,a)}n=n.child}return n;case 26:return Jl(i,n),i===null?(a=W0(n.type,null,n.pendingProps,null))?n.memoizedState=a:He||(a=n.type,i=n.pendingProps,c=pc(ce.current).createElement(a),c[St]=n,c[Ut]=i,zt(c,a,i),ft(c),n.stateNode=c):n.memoizedState=W0(n.type,i.memoizedProps,n.pendingProps,i.memoizedState),null;case 27:return Ce(n),i===null&&He&&(c=n.stateNode=I0(n.type,n.pendingProps,ce.current),Bt=n,xi=!0,_=Fe,ln(n.type)?(id=_,Fe=Ei(c.firstChild)):Fe=_),Ot(i,n,n.pendingProps.children,a),Jl(i,n),i===null&&(n.flags|=4194304),n.child;case 5:return i===null&&He&&((_=c=Fe)&&(c=nC(c,n.type,n.pendingProps,xi),c!==null?(n.stateNode=c,Bt=n,Fe=Ei(c.firstChild),xi=!1,_=!0):_=!1),_||Xs(n)),Ce(n),_=n.type,g=n.pendingProps,w=i!==null?i.memoizedProps:null,c=g.children,Zf(_,g)?c=null:w!==null&&Zf(_,w)&&(n.flags|=32),n.memoizedState!==null&&(_=Gh(i,n,yx,null,null,a),ua._currentValue=_),Jl(i,n),Ot(i,n,c,a),n.child;case 6:return i===null&&He&&((i=a=Fe)&&(a=rC(a,n.pendingProps,xi),a!==null?(n.stateNode=a,Bt=n,Fe=null,i=!0):i=!1),i||Xs(n)),null;case 13:return Am(i,n,a);case 4:return ue(n,n.stateNode.containerInfo),c=n.pendingProps,i===null?n.child=Yn(n,null,c,a):Ot(i,n,c,a),n.child;case 11:return bm(i,n,n.type,n.pendingProps,a);case 7:return Ot(i,n,n.pendingProps,a),n.child;case 8:return Ot(i,n,n.pendingProps.children,a),n.child;case 12:return Ot(i,n,n.pendingProps.children,a),n.child;case 10:return c=n.pendingProps,Ks(n,n.type,c.value),Ot(i,n,c.children,a),n.child;case 9:return _=n.type._context,c=n.pendingProps.children,In(n),_=Lt(_),c=c(_),n.flags|=1,Ot(i,n,c,a),n.child;case 14:return wm(i,n,n.type,n.pendingProps,a);case 15:return xm(i,n,n.type,n.pendingProps,a);case 19:return Rm(i,n,a);case 31:return kx(i,n,a);case 22:return Cm(i,n,a,n.pendingProps);case 24:return In(n),c=Lt(dt),i===null?(_=Uh(),_===null&&(_=Ge,g=Hh(),_.pooledCache=g,g.refCount++,g!==null&&(_.pooledCacheLanes|=a),_=g),n.memoizedState={parent:c,cache:_},Ih(n),Ks(n,dt,_)):((i.lanes&a)!==0&&($h(i,n),Wo(n,null,null,a),qo()),_=i.memoizedState,g=n.memoizedState,_.parent!==c?(_={parent:c,cache:c},n.memoizedState=_,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=_),Ks(n,dt,c)):(c=g.cache,Ks(n,dt,c),c!==_.cache&&zh(n,[dt],a,!0))),Ot(i,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(r(156,n.tag))}function Ss(i){i.flags|=4}function Cf(i,n,a,c,_){if((n=(i.mode&32)!==0)&&(n=!1),n){if(i.flags|=16777216,(_&335544128)===_)if(i.stateNode.complete)i.flags|=8192;else if(o0())i.flags|=8192;else throw Wn=Pl,jh}else i.flags&=-16777217}function Lm(i,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!G0(n))if(o0())i.flags|=8192;else throw Wn=Pl,jh}function tc(i,n){n!==null&&(i.flags|=4),i.flags&16384&&(n=i.tag!==22?al():536870912,i.lanes|=n,Yr|=n)}function Fo(i,n){if(!He)switch(i.tailMode){case"hidden":n=i.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?i.tail=null:a.sibling=null;break;case"collapsed":a=i.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?n||i.tail===null?i.tail=null:i.tail.sibling=null:c.sibling=null}}function Ze(i){var n=i.alternate!==null&&i.alternate.child===i.child,a=0,c=0;if(n)for(var _=i.child;_!==null;)a|=_.lanes|_.childLanes,c|=_.subtreeFlags&65011712,c|=_.flags&65011712,_.return=i,_=_.sibling;else for(_=i.child;_!==null;)a|=_.lanes|_.childLanes,c|=_.subtreeFlags,c|=_.flags,_.return=i,_=_.sibling;return i.subtreeFlags|=c,i.childLanes=a,n}function Tx(i,n,a){var c=n.pendingProps;switch(Nh(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ze(n),null;case 1:return Ze(n),null;case 3:return a=n.stateNode,c=null,i!==null&&(c=i.memoizedState.cache),n.memoizedState.cache!==c&&(n.flags|=2048),ps(dt),_e(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(i===null||i.child===null)&&(Rr(n)?Ss(n):i===null||i.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Bh())),Ze(n),null;case 26:var _=n.type,g=n.memoizedState;return i===null?(Ss(n),g!==null?(Ze(n),Lm(n,g)):(Ze(n),Cf(n,_,null,c,a))):g?g!==i.memoizedState?(Ss(n),Ze(n),Lm(n,g)):(Ze(n),n.flags&=-16777217):(i=i.memoizedProps,i!==c&&Ss(n),Ze(n),Cf(n,_,i,c,a)),null;case 27:if(be(n),a=ce.current,_=n.type,i!==null&&n.stateNode!=null)i.memoizedProps!==c&&Ss(n);else{if(!c){if(n.stateNode===null)throw Error(r(166));return Ze(n),null}i=te.current,Rr(n)?dp(n):(i=I0(_,c,a),n.stateNode=i,Ss(n))}return Ze(n),null;case 5:if(be(n),_=n.type,i!==null&&n.stateNode!=null)i.memoizedProps!==c&&Ss(n);else{if(!c){if(n.stateNode===null)throw Error(r(166));return Ze(n),null}if(g=te.current,Rr(n))dp(n);else{var w=pc(ce.current);switch(g){case 1:g=w.createElementNS("http://www.w3.org/2000/svg",_);break;case 2:g=w.createElementNS("http://www.w3.org/1998/Math/MathML",_);break;default:switch(_){case"svg":g=w.createElementNS("http://www.w3.org/2000/svg",_);break;case"math":g=w.createElementNS("http://www.w3.org/1998/Math/MathML",_);break;case"script":g=w.createElement("div"),g.innerHTML="<script><\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof c.is=="string"?w.createElement("select",{is:c.is}):w.createElement("select"),c.multiple?g.multiple=!0:c.size&&(g.size=c.size);break;default:g=typeof c.is=="string"?w.createElement(_,{is:c.is}):w.createElement(_)}}g[St]=n,g[Ut]=c;e:for(w=n.child;w!==null;){if(w.tag===5||w.tag===6)g.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===n)break e;for(;w.sibling===null;){if(w.return===null||w.return===n)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}n.stateNode=g;e:switch(zt(g,_,c),_){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&Ss(n)}}return Ze(n),Cf(n,n.type,i===null?null:i.memoizedProps,n.pendingProps,a),null;case 6:if(i&&n.stateNode!=null)i.memoizedProps!==c&&Ss(n);else{if(typeof c!="string"&&n.stateNode===null)throw Error(r(166));if(i=ce.current,Rr(n)){if(i=n.stateNode,a=n.memoizedProps,c=null,_=Bt,_!==null)switch(_.tag){case 27:case 5:c=_.memoizedProps}i[St]=n,i=!!(i.nodeValue===a||c!==null&&c.suppressHydrationWarning===!0||A0(i.nodeValue,a)),i||Xs(n,!0)}else i=pc(i).createTextNode(c),i[St]=n,n.stateNode=i}return Ze(n),null;case 31:if(a=n.memoizedState,i===null||i.memoizedState!==null){if(c=Rr(n),a!==null){if(i===null){if(!c)throw Error(r(318));if(i=n.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[St]=n}else Un(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Ze(n),i=!1}else a=Bh(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=a),i=!0;if(!i)return n.flags&256?(ui(n),n):(ui(n),null);if((n.flags&128)!==0)throw Error(r(558))}return Ze(n),null;case 13:if(c=n.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(_=Rr(n),c!==null&&c.dehydrated!==null){if(i===null){if(!_)throw Error(r(318));if(_=n.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(r(317));_[St]=n}else Un(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Ze(n),_=!1}else _=Bh(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=_),_=!0;if(!_)return n.flags&256?(ui(n),n):(ui(n),null)}return ui(n),(n.flags&128)!==0?(n.lanes=a,n):(a=c!==null,i=i!==null&&i.memoizedState!==null,a&&(c=n.child,_=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(_=c.alternate.memoizedState.cachePool.pool),g=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(g=c.memoizedState.cachePool.pool),g!==_&&(c.flags|=2048)),a!==i&&a&&(n.child.flags|=8192),tc(n,n.updateQueue),Ze(n),null);case 4:return _e(),i===null&&Vf(n.stateNode.containerInfo),Ze(n),null;case 10:return ps(n.type),Ze(n),null;case 19:if(W(ct),c=n.memoizedState,c===null)return Ze(n),null;if(_=(n.flags&128)!==0,g=c.rendering,g===null)if(_)Fo(c,!1);else{if(ot!==0||i!==null&&(i.flags&128)!==0)for(i=n.child;i!==null;){if(g=$l(i),g!==null){for(n.flags|=128,Fo(c,!1),i=g.updateQueue,n.updateQueue=i,tc(n,i),n.subtreeFlags=0,i=a,a=n.child;a!==null;)lp(a,i),a=a.sibling;return ee(ct,ct.current&1|2),He&&_s(n,c.treeForkCount),n.child}i=i.sibling}c.tail!==null&&Rt()>oc&&(n.flags|=128,_=!0,Fo(c,!1),n.lanes=4194304)}else{if(!_)if(i=$l(g),i!==null){if(n.flags|=128,_=!0,i=i.updateQueue,n.updateQueue=i,tc(n,i),Fo(c,!0),c.tail===null&&c.tailMode==="hidden"&&!g.alternate&&!He)return Ze(n),null}else 2*Rt()-c.renderingStartTime>oc&&a!==536870912&&(n.flags|=128,_=!0,Fo(c,!1),n.lanes=4194304);c.isBackwards?(g.sibling=n.child,n.child=g):(i=c.last,i!==null?i.sibling=g:n.child=g,c.last=g)}return c.tail!==null?(i=c.tail,c.rendering=i,c.tail=i.sibling,c.renderingStartTime=Rt(),i.sibling=null,a=ct.current,ee(ct,_?a&1|2:a&1),He&&_s(n,c.treeForkCount),i):(Ze(n),null);case 22:case 23:return ui(n),Vh(),c=n.memoizedState!==null,i!==null?i.memoizedState!==null!==c&&(n.flags|=8192):c&&(n.flags|=8192),c?(a&536870912)!==0&&(n.flags&128)===0&&(Ze(n),n.subtreeFlags&6&&(n.flags|=8192)):Ze(n),a=n.updateQueue,a!==null&&tc(n,a.retryQueue),a=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(a=i.memoizedState.cachePool.pool),c=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),c!==a&&(n.flags|=2048),i!==null&&W($n),null;case 24:return a=null,i!==null&&(a=i.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),ps(dt),Ze(n),null;case 25:return null;case 30:return null}throw Error(r(156,n.tag))}function Ax(i,n){switch(Nh(n),n.tag){case 1:return i=n.flags,i&65536?(n.flags=i&-65537|128,n):null;case 3:return ps(dt),_e(),i=n.flags,(i&65536)!==0&&(i&128)===0?(n.flags=i&-65537|128,n):null;case 26:case 27:case 5:return be(n),null;case 31:if(n.memoizedState!==null){if(ui(n),n.alternate===null)throw Error(r(340));Un()}return i=n.flags,i&65536?(n.flags=i&-65537|128,n):null;case 13:if(ui(n),i=n.memoizedState,i!==null&&i.dehydrated!==null){if(n.alternate===null)throw Error(r(340));Un()}return i=n.flags,i&65536?(n.flags=i&-65537|128,n):null;case 19:return W(ct),null;case 4:return _e(),null;case 10:return ps(n.type),null;case 22:case 23:return ui(n),Vh(),i!==null&&W($n),i=n.flags,i&65536?(n.flags=i&-65537|128,n):null;case 24:return ps(dt),null;case 25:return null;default:return null}}function Om(i,n){switch(Nh(n),n.tag){case 3:ps(dt),_e();break;case 26:case 27:case 5:be(n);break;case 4:_e();break;case 31:n.memoizedState!==null&&ui(n);break;case 13:ui(n);break;case 19:W(ct);break;case 10:ps(n.type);break;case 22:case 23:ui(n),Vh(),i!==null&&W($n);break;case 24:ps(dt)}}function Zo(i,n){try{var a=n.updateQueue,c=a!==null?a.lastEffect:null;if(c!==null){var _=c.next;a=_;do{if((a.tag&i)===i){c=void 0;var g=a.create,w=a.inst;c=g(),w.destroy=c}a=a.next}while(a!==_)}}catch(k){We(n,n.return,k)}}function en(i,n,a){try{var c=n.updateQueue,_=c!==null?c.lastEffect:null;if(_!==null){var g=_.next;c=g;do{if((c.tag&i)===i){var w=c.inst,k=w.destroy;if(k!==void 0){w.destroy=void 0,_=n;var U=a,Q=k;try{Q()}catch(se){We(_,U,se)}}}c=c.next}while(c!==g)}}catch(se){We(n,n.return,se)}}function zm(i){var n=i.updateQueue;if(n!==null){var a=i.stateNode;try{Mp(n,a)}catch(c){We(i,i.return,c)}}}function Hm(i,n,a){a.props=Xn(i.type,i.memoizedProps),a.state=i.memoizedState;try{a.componentWillUnmount()}catch(c){We(i,n,c)}}function Qo(i,n){try{var a=i.ref;if(a!==null){switch(i.tag){case 26:case 27:case 5:var c=i.stateNode;break;case 30:c=i.stateNode;break;default:c=i.stateNode}typeof a=="function"?i.refCleanup=a(c):a.current=c}}catch(_){We(i,n,_)}}function Xi(i,n){var a=i.ref,c=i.refCleanup;if(a!==null)if(typeof c=="function")try{c()}catch(_){We(i,n,_)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(_){We(i,n,_)}else a.current=null}function Pm(i){var n=i.type,a=i.memoizedProps,c=i.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&c.focus();break e;case"img":a.src?c.src=a.src:a.srcSet&&(c.srcset=a.srcSet)}}catch(_){We(i,i.return,_)}}function Ef(i,n,a){try{var c=i.stateNode;Qx(c,i.type,a,n),c[Ut]=n}catch(_){We(i,i.return,_)}}function Um(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&ln(i.type)||i.tag===4}function Mf(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Um(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&ln(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function kf(i,n,a){var c=i.tag;if(c===5||c===6)i=i.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(i,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(i),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=hs));else if(c!==4&&(c===27&&ln(i.type)&&(a=i.stateNode,n=null),i=i.child,i!==null))for(kf(i,n,a),i=i.sibling;i!==null;)kf(i,n,a),i=i.sibling}function ic(i,n,a){var c=i.tag;if(c===5||c===6)i=i.stateNode,n?a.insertBefore(i,n):a.appendChild(i);else if(c!==4&&(c===27&&ln(i.type)&&(a=i.stateNode),i=i.child,i!==null))for(ic(i,n,a),i=i.sibling;i!==null;)ic(i,n,a),i=i.sibling}function jm(i){var n=i.stateNode,a=i.memoizedProps;try{for(var c=i.type,_=n.attributes;_.length;)n.removeAttributeNode(_[0]);zt(n,c,a),n[St]=i,n[Ut]=a}catch(g){We(i,i.return,g)}}var bs=!1,pt=!1,Df=!1,Im=typeof WeakSet=="function"?WeakSet:Set,Mt=null;function Nx(i,n){if(i=i.containerInfo,Gf=xc,i=Jg(i),Sh(i)){if("selectionStart"in i)var a={start:i.selectionStart,end:i.selectionEnd};else e:{a=(a=i.ownerDocument)&&a.defaultView||window;var c=a.getSelection&&a.getSelection();if(c&&c.rangeCount!==0){a=c.anchorNode;var _=c.anchorOffset,g=c.focusNode;c=c.focusOffset;try{a.nodeType,g.nodeType}catch{a=null;break e}var w=0,k=-1,U=-1,Q=0,se=0,oe=i,J=null;t:for(;;){for(var ie;oe!==a||_!==0&&oe.nodeType!==3||(k=w+_),oe!==g||c!==0&&oe.nodeType!==3||(U=w+c),oe.nodeType===3&&(w+=oe.nodeValue.length),(ie=oe.firstChild)!==null;)J=oe,oe=ie;for(;;){if(oe===i)break t;if(J===a&&++Q===_&&(k=w),J===g&&++se===c&&(U=w),(ie=oe.nextSibling)!==null)break;oe=J,J=oe.parentNode}oe=ie}a=k===-1||U===-1?null:{start:k,end:U}}else a=null}a=a||{start:0,end:0}}else a=null;for(Ff={focusedElem:i,selectionRange:a},xc=!1,Mt=n;Mt!==null;)if(n=Mt,i=n.child,(n.subtreeFlags&1028)!==0&&i!==null)i.return=n,Mt=i;else for(;Mt!==null;){switch(n=Mt,g=n.alternate,i=n.flags,n.tag){case 0:if((i&4)!==0&&(i=n.updateQueue,i=i!==null?i.events:null,i!==null))for(a=0;a<i.length;a++)_=i[a],_.ref.impl=_.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&g!==null){i=void 0,a=n,_=g.memoizedProps,g=g.memoizedState,c=a.stateNode;try{var pe=Xn(a.type,_);i=c.getSnapshotBeforeUpdate(pe,g),c.__reactInternalSnapshotBeforeUpdate=i}catch(we){We(a,a.return,we)}}break;case 3:if((i&1024)!==0){if(i=n.stateNode.containerInfo,a=i.nodeType,a===9)Jf(i);else if(a===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Jf(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(r(163))}if(i=n.sibling,i!==null){i.return=n.return,Mt=i;break}Mt=n.return}}function $m(i,n,a){var c=a.flags;switch(a.tag){case 0:case 11:case 15:xs(i,a),c&4&&Zo(5,a);break;case 1:if(xs(i,a),c&4)if(i=a.stateNode,n===null)try{i.componentDidMount()}catch(w){We(a,a.return,w)}else{var _=Xn(a.type,n.memoizedProps);n=n.memoizedState;try{i.componentDidUpdate(_,n,i.__reactInternalSnapshotBeforeUpdate)}catch(w){We(a,a.return,w)}}c&64&&zm(a),c&512&&Qo(a,a.return);break;case 3:if(xs(i,a),c&64&&(i=a.updateQueue,i!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{Mp(i,n)}catch(w){We(a,a.return,w)}}break;case 27:n===null&&c&4&&jm(a);case 26:case 5:xs(i,a),n===null&&c&4&&Pm(a),c&512&&Qo(a,a.return);break;case 12:xs(i,a);break;case 31:xs(i,a),c&4&&Ym(i,a);break;case 13:xs(i,a),c&4&&Vm(i,a),c&64&&(i=a.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(a=jx.bind(null,a),oC(i,a))));break;case 22:if(c=a.memoizedState!==null||bs,!c){n=n!==null&&n.memoizedState!==null||pt,_=bs;var g=pt;bs=c,(pt=n)&&!g?Cs(i,a,(a.subtreeFlags&8772)!==0):xs(i,a),bs=_,pt=g}break;case 30:break;default:xs(i,a)}}function qm(i){var n=i.alternate;n!==null&&(i.alternate=null,qm(n)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(n=i.stateNode,n!==null&&Co(n)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var Je=null,Zt=!1;function ws(i,n,a){for(a=a.child;a!==null;)Wm(i,n,a),a=a.sibling}function Wm(i,n,a){if($t&&typeof $t.onCommitFiberUnmount=="function")try{$t.onCommitFiberUnmount(Dn,a)}catch{}switch(a.tag){case 26:pt||Xi(a,n),ws(i,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:pt||Xi(a,n);var c=Je,_=Zt;ln(a.type)&&(Je=a.stateNode,Zt=!1),ws(i,n,a),aa(a.stateNode),Je=c,Zt=_;break;case 5:pt||Xi(a,n);case 6:if(c=Je,_=Zt,Je=null,ws(i,n,a),Je=c,Zt=_,Je!==null)if(Zt)try{(Je.nodeType===9?Je.body:Je.nodeName==="HTML"?Je.ownerDocument.body:Je).removeChild(a.stateNode)}catch(g){We(a,n,g)}else try{Je.removeChild(a.stateNode)}catch(g){We(a,n,g)}break;case 18:Je!==null&&(Zt?(i=Je,z0(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,a.stateNode),Jr(i)):z0(Je,a.stateNode));break;case 4:c=Je,_=Zt,Je=a.stateNode.containerInfo,Zt=!0,ws(i,n,a),Je=c,Zt=_;break;case 0:case 11:case 14:case 15:en(2,a,n),pt||en(4,a,n),ws(i,n,a);break;case 1:pt||(Xi(a,n),c=a.stateNode,typeof c.componentWillUnmount=="function"&&Hm(a,n,c)),ws(i,n,a);break;case 21:ws(i,n,a);break;case 22:pt=(c=pt)||a.memoizedState!==null,ws(i,n,a),pt=c;break;default:ws(i,n,a)}}function Ym(i,n){if(n.memoizedState===null&&(i=n.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Jr(i)}catch(a){We(n,n.return,a)}}}function Vm(i,n){if(n.memoizedState===null&&(i=n.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Jr(i)}catch(a){We(n,n.return,a)}}function Rx(i){switch(i.tag){case 31:case 13:case 19:var n=i.stateNode;return n===null&&(n=i.stateNode=new Im),n;case 22:return i=i.stateNode,n=i._retryCache,n===null&&(n=i._retryCache=new Im),n;default:throw Error(r(435,i.tag))}}function sc(i,n){var a=Rx(i);n.forEach(function(c){if(!a.has(c)){a.add(c);var _=Ix.bind(null,i,c);c.then(_,_)}})}function Qt(i,n){var a=n.deletions;if(a!==null)for(var c=0;c<a.length;c++){var _=a[c],g=i,w=n,k=w;e:for(;k!==null;){switch(k.tag){case 27:if(ln(k.type)){Je=k.stateNode,Zt=!1;break e}break;case 5:Je=k.stateNode,Zt=!1;break e;case 3:case 4:Je=k.stateNode.containerInfo,Zt=!0;break e}k=k.return}if(Je===null)throw Error(r(160));Wm(g,w,_),Je=null,Zt=!1,g=_.alternate,g!==null&&(g.return=null),_.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Xm(n,i),n=n.sibling}var Oi=null;function Xm(i,n){var a=i.alternate,c=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:Qt(n,i),Jt(i),c&4&&(en(3,i,i.return),Zo(3,i),en(5,i,i.return));break;case 1:Qt(n,i),Jt(i),c&512&&(pt||a===null||Xi(a,a.return)),c&64&&bs&&(i=i.updateQueue,i!==null&&(c=i.callbacks,c!==null&&(a=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=a===null?c:a.concat(c))));break;case 26:var _=Oi;if(Qt(n,i),Jt(i),c&512&&(pt||a===null||Xi(a,a.return)),c&4){var g=a!==null?a.memoizedState:null;if(c=i.memoizedState,a===null)if(c===null)if(i.stateNode===null){e:{c=i.type,a=i.memoizedProps,_=_.ownerDocument||_;t:switch(c){case"title":g=_.getElementsByTagName("title")[0],(!g||g[Nn]||g[St]||g.namespaceURI==="http://www.w3.org/2000/svg"||g.hasAttribute("itemprop"))&&(g=_.createElement(c),_.head.insertBefore(g,_.querySelector("head > title"))),zt(g,c,a),g[St]=i,ft(g),c=g;break e;case"link":var w=X0("link","href",_).get(c+(a.href||""));if(w){for(var k=0;k<w.length;k++)if(g=w[k],g.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&g.getAttribute("rel")===(a.rel==null?null:a.rel)&&g.getAttribute("title")===(a.title==null?null:a.title)&&g.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){w.splice(k,1);break t}}g=_.createElement(c),zt(g,c,a),_.head.appendChild(g);break;case"meta":if(w=X0("meta","content",_).get(c+(a.content||""))){for(k=0;k<w.length;k++)if(g=w[k],g.getAttribute("content")===(a.content==null?null:""+a.content)&&g.getAttribute("name")===(a.name==null?null:a.name)&&g.getAttribute("property")===(a.property==null?null:a.property)&&g.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&g.getAttribute("charset")===(a.charSet==null?null:a.charSet)){w.splice(k,1);break t}}g=_.createElement(c),zt(g,c,a),_.head.appendChild(g);break;default:throw Error(r(468,c))}g[St]=i,ft(g),c=g}i.stateNode=c}else K0(_,i.type,i.stateNode);else i.stateNode=V0(_,c,i.memoizedProps);else g!==c?(g===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):g.count--,c===null?K0(_,i.type,i.stateNode):V0(_,c,i.memoizedProps)):c===null&&i.stateNode!==null&&Ef(i,i.memoizedProps,a.memoizedProps)}break;case 27:Qt(n,i),Jt(i),c&512&&(pt||a===null||Xi(a,a.return)),a!==null&&c&4&&Ef(i,i.memoizedProps,a.memoizedProps);break;case 5:if(Qt(n,i),Jt(i),c&512&&(pt||a===null||Xi(a,a.return)),i.flags&32){_=i.stateNode;try{wr(_,"")}catch(pe){We(i,i.return,pe)}}c&4&&i.stateNode!=null&&(_=i.memoizedProps,Ef(i,_,a!==null?a.memoizedProps:_)),c&1024&&(Df=!0);break;case 6:if(Qt(n,i),Jt(i),c&4){if(i.stateNode===null)throw Error(r(162));c=i.memoizedProps,a=i.stateNode;try{a.nodeValue=c}catch(pe){We(i,i.return,pe)}}break;case 3:if(yc=null,_=Oi,Oi=mc(n.containerInfo),Qt(n,i),Oi=_,Jt(i),c&4&&a!==null&&a.memoizedState.isDehydrated)try{Jr(n.containerInfo)}catch(pe){We(i,i.return,pe)}Df&&(Df=!1,Km(i));break;case 4:c=Oi,Oi=mc(i.stateNode.containerInfo),Qt(n,i),Jt(i),Oi=c;break;case 12:Qt(n,i),Jt(i);break;case 31:Qt(n,i),Jt(i),c&4&&(c=i.updateQueue,c!==null&&(i.updateQueue=null,sc(i,c)));break;case 13:Qt(n,i),Jt(i),i.child.flags&8192&&i.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(rc=Rt()),c&4&&(c=i.updateQueue,c!==null&&(i.updateQueue=null,sc(i,c)));break;case 22:_=i.memoizedState!==null;var U=a!==null&&a.memoizedState!==null,Q=bs,se=pt;if(bs=Q||_,pt=se||U,Qt(n,i),pt=se,bs=Q,Jt(i),c&8192)e:for(n=i.stateNode,n._visibility=_?n._visibility&-2:n._visibility|1,_&&(a===null||U||bs||pt||Kn(i)),a=null,n=i;;){if(n.tag===5||n.tag===26){if(a===null){U=a=n;try{if(g=U.stateNode,_)w=g.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{k=U.stateNode;var oe=U.memoizedProps.style,J=oe!=null&&oe.hasOwnProperty("display")?oe.display:null;k.style.display=J==null||typeof J=="boolean"?"":(""+J).trim()}}catch(pe){We(U,U.return,pe)}}}else if(n.tag===6){if(a===null){U=n;try{U.stateNode.nodeValue=_?"":U.memoizedProps}catch(pe){We(U,U.return,pe)}}}else if(n.tag===18){if(a===null){U=n;try{var ie=U.stateNode;_?H0(ie,!0):H0(U.stateNode,!1)}catch(pe){We(U,U.return,pe)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===i)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===i)break e;for(;n.sibling===null;){if(n.return===null||n.return===i)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}c&4&&(c=i.updateQueue,c!==null&&(a=c.retryQueue,a!==null&&(c.retryQueue=null,sc(i,a))));break;case 19:Qt(n,i),Jt(i),c&4&&(c=i.updateQueue,c!==null&&(i.updateQueue=null,sc(i,c)));break;case 30:break;case 21:break;default:Qt(n,i),Jt(i)}}function Jt(i){var n=i.flags;if(n&2){try{for(var a,c=i.return;c!==null;){if(Um(c)){a=c;break}c=c.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var _=a.stateNode,g=Mf(i);ic(i,g,_);break;case 5:var w=a.stateNode;a.flags&32&&(wr(w,""),a.flags&=-33);var k=Mf(i);ic(i,k,w);break;case 3:case 4:var U=a.stateNode.containerInfo,Q=Mf(i);kf(i,Q,U);break;default:throw Error(r(161))}}catch(se){We(i,i.return,se)}i.flags&=-3}n&4096&&(i.flags&=-4097)}function Km(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var n=i;Km(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),i=i.sibling}}function xs(i,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)$m(i,n.alternate,n),n=n.sibling}function Kn(i){for(i=i.child;i!==null;){var n=i;switch(n.tag){case 0:case 11:case 14:case 15:en(4,n,n.return),Kn(n);break;case 1:Xi(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&Hm(n,n.return,a),Kn(n);break;case 27:aa(n.stateNode);case 26:case 5:Xi(n,n.return),Kn(n);break;case 22:n.memoizedState===null&&Kn(n);break;case 30:Kn(n);break;default:Kn(n)}i=i.sibling}}function Cs(i,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var c=n.alternate,_=i,g=n,w=g.flags;switch(g.tag){case 0:case 11:case 15:Cs(_,g,a),Zo(4,g);break;case 1:if(Cs(_,g,a),c=g,_=c.stateNode,typeof _.componentDidMount=="function")try{_.componentDidMount()}catch(Q){We(c,c.return,Q)}if(c=g,_=c.updateQueue,_!==null){var k=c.stateNode;try{var U=_.shared.hiddenCallbacks;if(U!==null)for(_.shared.hiddenCallbacks=null,_=0;_<U.length;_++)Ep(U[_],k)}catch(Q){We(c,c.return,Q)}}a&&w&64&&zm(g),Qo(g,g.return);break;case 27:jm(g);case 26:case 5:Cs(_,g,a),a&&c===null&&w&4&&Pm(g),Qo(g,g.return);break;case 12:Cs(_,g,a);break;case 31:Cs(_,g,a),a&&w&4&&Ym(_,g);break;case 13:Cs(_,g,a),a&&w&4&&Vm(_,g);break;case 22:g.memoizedState===null&&Cs(_,g,a),Qo(g,g.return);break;case 30:break;default:Cs(_,g,a)}n=n.sibling}}function Tf(i,n){var a=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(a=i.memoizedState.cachePool.pool),i=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),i!==a&&(i!=null&&i.refCount++,a!=null&&Po(a))}function Af(i,n){i=null,n.alternate!==null&&(i=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==i&&(n.refCount++,i!=null&&Po(i))}function zi(i,n,a,c){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Gm(i,n,a,c),n=n.sibling}function Gm(i,n,a,c){var _=n.flags;switch(n.tag){case 0:case 11:case 15:zi(i,n,a,c),_&2048&&Zo(9,n);break;case 1:zi(i,n,a,c);break;case 3:zi(i,n,a,c),_&2048&&(i=null,n.alternate!==null&&(i=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==i&&(n.refCount++,i!=null&&Po(i)));break;case 12:if(_&2048){zi(i,n,a,c),i=n.stateNode;try{var g=n.memoizedProps,w=g.id,k=g.onPostCommit;typeof k=="function"&&k(w,n.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(U){We(n,n.return,U)}}else zi(i,n,a,c);break;case 31:zi(i,n,a,c);break;case 13:zi(i,n,a,c);break;case 23:break;case 22:g=n.stateNode,w=n.alternate,n.memoizedState!==null?g._visibility&2?zi(i,n,a,c):Jo(i,n):g._visibility&2?zi(i,n,a,c):(g._visibility|=2,$r(i,n,a,c,(n.subtreeFlags&10256)!==0||!1)),_&2048&&Tf(w,n);break;case 24:zi(i,n,a,c),_&2048&&Af(n.alternate,n);break;default:zi(i,n,a,c)}}function $r(i,n,a,c,_){for(_=_&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var g=i,w=n,k=a,U=c,Q=w.flags;switch(w.tag){case 0:case 11:case 15:$r(g,w,k,U,_),Zo(8,w);break;case 23:break;case 22:var se=w.stateNode;w.memoizedState!==null?se._visibility&2?$r(g,w,k,U,_):Jo(g,w):(se._visibility|=2,$r(g,w,k,U,_)),_&&Q&2048&&Tf(w.alternate,w);break;case 24:$r(g,w,k,U,_),_&&Q&2048&&Af(w.alternate,w);break;default:$r(g,w,k,U,_)}n=n.sibling}}function Jo(i,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=i,c=n,_=c.flags;switch(c.tag){case 22:Jo(a,c),_&2048&&Tf(c.alternate,c);break;case 24:Jo(a,c),_&2048&&Af(c.alternate,c);break;default:Jo(a,c)}n=n.sibling}}var ea=8192;function qr(i,n,a){if(i.subtreeFlags&ea)for(i=i.child;i!==null;)Fm(i,n,a),i=i.sibling}function Fm(i,n,a){switch(i.tag){case 26:qr(i,n,a),i.flags&ea&&i.memoizedState!==null&&vC(a,Oi,i.memoizedState,i.memoizedProps);break;case 5:qr(i,n,a);break;case 3:case 4:var c=Oi;Oi=mc(i.stateNode.containerInfo),qr(i,n,a),Oi=c;break;case 22:i.memoizedState===null&&(c=i.alternate,c!==null&&c.memoizedState!==null?(c=ea,ea=16777216,qr(i,n,a),ea=c):qr(i,n,a));break;default:qr(i,n,a)}}function Zm(i){var n=i.alternate;if(n!==null&&(i=n.child,i!==null)){n.child=null;do n=i.sibling,i.sibling=null,i=n;while(i!==null)}}function ta(i){var n=i.deletions;if((i.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var c=n[a];Mt=c,Jm(c,i)}Zm(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Qm(i),i=i.sibling}function Qm(i){switch(i.tag){case 0:case 11:case 15:ta(i),i.flags&2048&&en(9,i,i.return);break;case 3:ta(i);break;case 12:ta(i);break;case 22:var n=i.stateNode;i.memoizedState!==null&&n._visibility&2&&(i.return===null||i.return.tag!==13)?(n._visibility&=-3,nc(i)):ta(i);break;default:ta(i)}}function nc(i){var n=i.deletions;if((i.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var c=n[a];Mt=c,Jm(c,i)}Zm(i)}for(i=i.child;i!==null;){switch(n=i,n.tag){case 0:case 11:case 15:en(8,n,n.return),nc(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,nc(n));break;default:nc(n)}i=i.sibling}}function Jm(i,n){for(;Mt!==null;){var a=Mt;switch(a.tag){case 0:case 11:case 15:en(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var c=a.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:Po(a.memoizedState.cache)}if(c=a.child,c!==null)c.return=a,Mt=c;else e:for(a=i;Mt!==null;){c=Mt;var _=c.sibling,g=c.return;if(qm(c),c===a){Mt=null;break e}if(_!==null){_.return=g,Mt=_;break e}Mt=g}}}var Bx={getCacheForType:function(i){var n=Lt(dt),a=n.data.get(i);return a===void 0&&(a=i(),n.data.set(i,a)),a},cacheSignal:function(){return Lt(dt).controller.signal}},Lx=typeof WeakMap=="function"?WeakMap:Map,Ie=0,Ge=null,Re=null,Oe=0,qe=0,hi=null,tn=!1,Wr=!1,Nf=!1,Es=0,ot=0,sn=0,Gn=0,Rf=0,fi=0,Yr=0,ia=null,ei=null,Bf=!1,rc=0,e0=0,oc=1/0,ac=null,nn=null,bt=0,rn=null,Vr=null,Ms=0,Lf=0,Of=null,t0=null,sa=0,zf=null;function di(){return(Ie&2)!==0&&Oe!==0?Oe&-Oe:M.T!==null?$f():hl()}function i0(){if(fi===0)if((Oe&536870912)===0||He){var i=pr;pr<<=1,(pr&3932160)===0&&(pr=262144),fi=i}else fi=536870912;return i=ci.current,i!==null&&(i.flags|=32),fi}function ti(i,n,a){(i===Ge&&(qe===2||qe===9)||i.cancelPendingCommit!==null)&&(Xr(i,0),on(i,Oe,fi,!1)),An(i,a),((Ie&2)===0||i!==Ge)&&(i===Ge&&((Ie&2)===0&&(Gn|=a),ot===4&&on(i,Oe,fi,!1)),Ki(i))}function s0(i,n,a){if((Ie&6)!==0)throw Error(r(327));var c=!a&&(n&127)===0&&(n&i.expiredLanes)===0||Tn(i,n),_=c?Hx(i,n):Pf(i,n,!0),g=c;do{if(_===0){Wr&&!c&&on(i,n,0,!1);break}else{if(a=i.current.alternate,g&&!Ox(a)){_=Pf(i,n,!1),g=!1;continue}if(_===2){if(g=n,i.errorRecoveryDisabledLanes&g)var w=0;else w=i.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){n=w;e:{var k=i;_=ia;var U=k.current.memoizedState.isDehydrated;if(U&&(Xr(k,w).flags|=256),w=Pf(k,w,!1),w!==2){if(Nf&&!U){k.errorRecoveryDisabledLanes|=g,Gn|=g,_=4;break e}g=ei,ei=_,g!==null&&(ei===null?ei=g:ei.push.apply(ei,g))}_=w}if(g=!1,_!==2)continue}}if(_===1){Xr(i,0),on(i,n,0,!0);break}e:{switch(c=i,g=_,g){case 0:case 1:throw Error(r(345));case 4:if((n&4194048)!==n)break;case 6:on(c,n,fi,!tn);break e;case 2:ei=null;break;case 3:case 5:break;default:throw Error(r(329))}if((n&62914560)===n&&(_=rc+300-Rt(),10<_)){if(on(c,n,fi,!tn),vr(c,0,!0)!==0)break e;Ms=n,c.timeoutHandle=L0(n0.bind(null,c,a,ei,ac,Bf,n,fi,Gn,Yr,tn,g,"Throttled",-0,0),_);break e}n0(c,a,ei,ac,Bf,n,fi,Gn,Yr,tn,g,null,-0,0)}}break}while(!0);Ki(i)}function n0(i,n,a,c,_,g,w,k,U,Q,se,oe,J,ie){if(i.timeoutHandle=-1,oe=n.subtreeFlags,oe&8192||(oe&16785408)===16785408){oe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:hs},Fm(n,g,oe);var pe=(g&62914560)===g?rc-Rt():(g&4194048)===g?e0-Rt():0;if(pe=yC(oe,pe),pe!==null){Ms=g,i.cancelPendingCommit=pe(f0.bind(null,i,n,g,a,c,_,w,k,U,se,oe,null,J,ie)),on(i,g,w,!Q);return}}f0(i,n,g,a,c,_,w,k,U)}function Ox(i){for(var n=i;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var c=0;c<a.length;c++){var _=a[c],g=_.getSnapshot;_=_.value;try{if(!ai(g(),_))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===i)break;for(;n.sibling===null;){if(n.return===null||n.return===i)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function on(i,n,a,c){n&=~Rf,n&=~Gn,i.suspendedLanes|=n,i.pingedLanes&=~n,c&&(i.warmLanes|=n),c=i.expirationTimes;for(var _=n;0<_;){var g=31-qt(_),w=1<<g;c[g]=-1,_&=~w}a!==0&&ll(i,a,n)}function lc(){return(Ie&6)===0?(na(0),!1):!0}function Hf(){if(Re!==null){if(qe===0)var i=Re.return;else i=Re,gs=jn=null,Qh(i),Hr=null,jo=0,i=Re;for(;i!==null;)Om(i.alternate,i),i=i.return;Re=null}}function Xr(i,n){var a=i.timeoutHandle;a!==-1&&(i.timeoutHandle=-1,tC(a)),a=i.cancelPendingCommit,a!==null&&(i.cancelPendingCommit=null,a()),Ms=0,Hf(),Ge=i,Re=a=ds(i.current,null),Oe=n,qe=0,hi=null,tn=!1,Wr=Tn(i,n),Nf=!1,Yr=fi=Rf=Gn=sn=ot=0,ei=ia=null,Bf=!1,(n&8)!==0&&(n|=n&32);var c=i.entangledLanes;if(c!==0)for(i=i.entanglements,c&=n;0<c;){var _=31-qt(c),g=1<<_;n|=i[_],c&=~g}return Es=n,Tl(),a}function r0(i,n){De=null,M.H=Ko,n===zr||n===Hl?(n=bp(),qe=3):n===jh?(n=bp(),qe=4):qe=n===gf?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,hi=n,Re===null&&(ot=1,Zl(i,Si(n,i.current)))}function o0(){var i=ci.current;return i===null?!0:(Oe&4194048)===Oe?Ci===null:(Oe&62914560)===Oe||(Oe&536870912)!==0?i===Ci:!1}function a0(){var i=M.H;return M.H=Ko,i===null?Ko:i}function l0(){var i=M.A;return M.A=Bx,i}function cc(){ot=4,tn||(Oe&4194048)!==Oe&&ci.current!==null||(Wr=!0),(sn&134217727)===0&&(Gn&134217727)===0||Ge===null||on(Ge,Oe,fi,!1)}function Pf(i,n,a){var c=Ie;Ie|=2;var _=a0(),g=l0();(Ge!==i||Oe!==n)&&(ac=null,Xr(i,n)),n=!1;var w=ot;e:do try{if(qe!==0&&Re!==null){var k=Re,U=hi;switch(qe){case 8:Hf(),w=6;break e;case 3:case 2:case 9:case 6:ci.current===null&&(n=!0);var Q=qe;if(qe=0,hi=null,Kr(i,k,U,Q),a&&Wr){w=0;break e}break;default:Q=qe,qe=0,hi=null,Kr(i,k,U,Q)}}zx(),w=ot;break}catch(se){r0(i,se)}while(!0);return n&&i.shellSuspendCounter++,gs=jn=null,Ie=c,M.H=_,M.A=g,Re===null&&(Ge=null,Oe=0,Tl()),w}function zx(){for(;Re!==null;)c0(Re)}function Hx(i,n){var a=Ie;Ie|=2;var c=a0(),_=l0();Ge!==i||Oe!==n?(ac=null,oc=Rt()+500,Xr(i,n)):Wr=Tn(i,n);e:do try{if(qe!==0&&Re!==null){n=Re;var g=hi;t:switch(qe){case 1:qe=0,hi=null,Kr(i,n,g,1);break;case 2:case 9:if(yp(g)){qe=0,hi=null,u0(n);break}n=function(){qe!==2&&qe!==9||Ge!==i||(qe=7),Ki(i)},g.then(n,n);break e;case 3:qe=7;break e;case 4:qe=5;break e;case 7:yp(g)?(qe=0,hi=null,u0(n)):(qe=0,hi=null,Kr(i,n,g,7));break;case 5:var w=null;switch(Re.tag){case 26:w=Re.memoizedState;case 5:case 27:var k=Re;if(w?G0(w):k.stateNode.complete){qe=0,hi=null;var U=k.sibling;if(U!==null)Re=U;else{var Q=k.return;Q!==null?(Re=Q,uc(Q)):Re=null}break t}}qe=0,hi=null,Kr(i,n,g,5);break;case 6:qe=0,hi=null,Kr(i,n,g,6);break;case 8:Hf(),ot=6;break e;default:throw Error(r(462))}}Px();break}catch(se){r0(i,se)}while(!0);return gs=jn=null,M.H=c,M.A=_,Ie=a,Re!==null?0:(Ge=null,Oe=0,Tl(),ot)}function Px(){for(;Re!==null&&!En();)c0(Re)}function c0(i){var n=Bm(i.alternate,i,Es);i.memoizedProps=i.pendingProps,n===null?uc(i):Re=n}function u0(i){var n=i,a=n.alternate;switch(n.tag){case 15:case 0:n=km(a,n,n.pendingProps,n.type,void 0,Oe);break;case 11:n=km(a,n,n.pendingProps,n.type.render,n.ref,Oe);break;case 5:Qh(n);default:Om(a,n),n=Re=lp(n,Es),n=Bm(a,n,Es)}i.memoizedProps=i.pendingProps,n===null?uc(i):Re=n}function Kr(i,n,a,c){gs=jn=null,Qh(n),Hr=null,jo=0;var _=n.return;try{if(Mx(i,_,n,a,Oe)){ot=1,Zl(i,Si(a,i.current)),Re=null;return}}catch(g){if(_!==null)throw Re=_,g;ot=1,Zl(i,Si(a,i.current)),Re=null;return}n.flags&32768?(He||c===1?i=!0:Wr||(Oe&536870912)!==0?i=!1:(tn=i=!0,(c===2||c===9||c===3||c===6)&&(c=ci.current,c!==null&&c.tag===13&&(c.flags|=16384))),h0(n,i)):uc(n)}function uc(i){var n=i;do{if((n.flags&32768)!==0){h0(n,tn);return}i=n.return;var a=Tx(n.alternate,n,Es);if(a!==null){Re=a;return}if(n=n.sibling,n!==null){Re=n;return}Re=n=i}while(n!==null);ot===0&&(ot=5)}function h0(i,n){do{var a=Ax(i.alternate,i);if(a!==null){a.flags&=32767,Re=a;return}if(a=i.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(i=i.sibling,i!==null)){Re=i;return}Re=i=a}while(i!==null);ot=6,Re=null}function f0(i,n,a,c,_,g,w,k,U){i.cancelPendingCommit=null;do hc();while(bt!==0);if((Ie&6)!==0)throw Error(r(327));if(n!==null){if(n===i.current)throw Error(r(177));if(g=n.lanes|n.childLanes,g|=Eh,th(i,a,g,w,k,U),i===Ge&&(Re=Ge=null,Oe=0),Vr=n,rn=i,Ms=a,Lf=g,Of=_,t0=c,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,$x(kn,function(){return m0(),null})):(i.callbackNode=null,i.callbackPriority=0),c=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||c){c=M.T,M.T=null,_=L.p,L.p=2,w=Ie,Ie|=4;try{Nx(i,n,a)}finally{Ie=w,L.p=_,M.T=c}}bt=1,d0(),_0(),g0()}}function d0(){if(bt===1){bt=0;var i=rn,n=Vr,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=M.T,M.T=null;var c=L.p;L.p=2;var _=Ie;Ie|=4;try{Xm(n,i);var g=Ff,w=Jg(i.containerInfo),k=g.focusedElem,U=g.selectionRange;if(w!==k&&k&&k.ownerDocument&&Qg(k.ownerDocument.documentElement,k)){if(U!==null&&Sh(k)){var Q=U.start,se=U.end;if(se===void 0&&(se=Q),"selectionStart"in k)k.selectionStart=Q,k.selectionEnd=Math.min(se,k.value.length);else{var oe=k.ownerDocument||document,J=oe&&oe.defaultView||window;if(J.getSelection){var ie=J.getSelection(),pe=k.textContent.length,we=Math.min(U.start,pe),Xe=U.end===void 0?we:Math.min(U.end,pe);!ie.extend&&we>Xe&&(w=Xe,Xe=we,we=w);var K=Zg(k,we),Y=Zg(k,Xe);if(K&&Y&&(ie.rangeCount!==1||ie.anchorNode!==K.node||ie.anchorOffset!==K.offset||ie.focusNode!==Y.node||ie.focusOffset!==Y.offset)){var F=oe.createRange();F.setStart(K.node,K.offset),ie.removeAllRanges(),we>Xe?(ie.addRange(F),ie.extend(Y.node,Y.offset)):(F.setEnd(Y.node,Y.offset),ie.addRange(F))}}}}for(oe=[],ie=k;ie=ie.parentNode;)ie.nodeType===1&&oe.push({element:ie,left:ie.scrollLeft,top:ie.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;k<oe.length;k++){var re=oe[k];re.element.scrollLeft=re.left,re.element.scrollTop=re.top}}xc=!!Gf,Ff=Gf=null}finally{Ie=_,L.p=c,M.T=a}}i.current=n,bt=2}}function _0(){if(bt===2){bt=0;var i=rn,n=Vr,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=M.T,M.T=null;var c=L.p;L.p=2;var _=Ie;Ie|=4;try{$m(i,n.alternate,n)}finally{Ie=_,L.p=c,M.T=a}}bt=3}}function g0(){if(bt===4||bt===3){bt=0,Mn();var i=rn,n=Vr,a=Ms,c=t0;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?bt=5:(bt=0,Vr=rn=null,p0(i,i.pendingLanes));var _=i.pendingLanes;if(_===0&&(nn=null),xo(a),n=n.stateNode,$t&&typeof $t.onCommitFiberRoot=="function")try{$t.onCommitFiberRoot(Dn,n,void 0,(n.current.flags&128)===128)}catch{}if(c!==null){n=M.T,_=L.p,L.p=2,M.T=null;try{for(var g=i.onRecoverableError,w=0;w<c.length;w++){var k=c[w];g(k.value,{componentStack:k.stack})}}finally{M.T=n,L.p=_}}(Ms&3)!==0&&hc(),Ki(i),_=i.pendingLanes,(a&261930)!==0&&(_&42)!==0?i===zf?sa++:(sa=0,zf=i):sa=0,na(0)}}function p0(i,n){(i.pooledCacheLanes&=n)===0&&(n=i.pooledCache,n!=null&&(i.pooledCache=null,Po(n)))}function hc(){return d0(),_0(),g0(),m0()}function m0(){if(bt!==5)return!1;var i=rn,n=Lf;Lf=0;var a=xo(Ms),c=M.T,_=L.p;try{L.p=32>a?32:a,M.T=null,a=Of,Of=null;var g=rn,w=Ms;if(bt=0,Vr=rn=null,Ms=0,(Ie&6)!==0)throw Error(r(331));var k=Ie;if(Ie|=4,Qm(g.current),Gm(g,g.current,w,a),Ie=k,na(0,!1),$t&&typeof $t.onPostCommitFiberRoot=="function")try{$t.onPostCommitFiberRoot(Dn,g)}catch{}return!0}finally{L.p=_,M.T=c,p0(i,n)}}function v0(i,n,a){n=Si(a,n),n=_f(i.stateNode,n,2),i=Zs(i,n,2),i!==null&&(An(i,2),Ki(i))}function We(i,n,a){if(i.tag===3)v0(i,i,a);else for(;n!==null;){if(n.tag===3){v0(n,i,a);break}else if(n.tag===1){var c=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(nn===null||!nn.has(c))){i=Si(a,i),a=ym(2),c=Zs(n,a,2),c!==null&&(Sm(a,c,n,i),An(c,2),Ki(c));break}}n=n.return}}function Uf(i,n,a){var c=i.pingCache;if(c===null){c=i.pingCache=new Lx;var _=new Set;c.set(n,_)}else _=c.get(n),_===void 0&&(_=new Set,c.set(n,_));_.has(a)||(Nf=!0,_.add(a),i=Ux.bind(null,i,n,a),n.then(i,i))}function Ux(i,n,a){var c=i.pingCache;c!==null&&c.delete(n),i.pingedLanes|=i.suspendedLanes&a,i.warmLanes&=~a,Ge===i&&(Oe&a)===a&&(ot===4||ot===3&&(Oe&62914560)===Oe&&300>Rt()-rc?(Ie&2)===0&&Xr(i,0):Rf|=a,Yr===Oe&&(Yr=0)),Ki(i)}function y0(i,n){n===0&&(n=al()),i=Hn(i,n),i!==null&&(An(i,n),Ki(i))}function jx(i){var n=i.memoizedState,a=0;n!==null&&(a=n.retryLane),y0(i,a)}function Ix(i,n){var a=0;switch(i.tag){case 31:case 13:var c=i.stateNode,_=i.memoizedState;_!==null&&(a=_.retryLane);break;case 19:c=i.stateNode;break;case 22:c=i.stateNode._retryCache;break;default:throw Error(r(314))}c!==null&&c.delete(n),y0(i,a)}function $x(i,n){return Ri(i,n)}var fc=null,Gr=null,jf=!1,dc=!1,If=!1,an=0;function Ki(i){i!==Gr&&i.next===null&&(Gr===null?fc=Gr=i:Gr=Gr.next=i),dc=!0,jf||(jf=!0,Wx())}function na(i,n){if(!If&&dc){If=!0;do for(var a=!1,c=fc;c!==null;){if(i!==0){var _=c.pendingLanes;if(_===0)var g=0;else{var w=c.suspendedLanes,k=c.pingedLanes;g=(1<<31-qt(42|i)+1)-1,g&=_&~(w&~k),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(a=!0,x0(c,g))}else g=Oe,g=vr(c,c===Ge?g:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(g&3)===0||Tn(c,g)||(a=!0,x0(c,g));c=c.next}while(a);If=!1}}function qx(){S0()}function S0(){dc=jf=!1;var i=0;an!==0&&eC()&&(i=an);for(var n=Rt(),a=null,c=fc;c!==null;){var _=c.next,g=b0(c,n);g===0?(c.next=null,a===null?fc=_:a.next=_,_===null&&(Gr=a)):(a=c,(i!==0||(g&3)!==0)&&(dc=!0)),c=_}bt!==0&&bt!==5||na(i),an!==0&&(an=0)}function b0(i,n){for(var a=i.suspendedLanes,c=i.pingedLanes,_=i.expirationTimes,g=i.pendingLanes&-62914561;0<g;){var w=31-qt(g),k=1<<w,U=_[w];U===-1?((k&a)===0||(k&c)!==0)&&(_[w]=eh(k,n)):U<=n&&(i.expiredLanes|=k),g&=~k}if(n=Ge,a=Oe,a=vr(i,i===n?a:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),c=i.callbackNode,a===0||i===n&&(qe===2||qe===9)||i.cancelPendingCommit!==null)return c!==null&&c!==null&&rs(c),i.callbackNode=null,i.callbackPriority=0;if((a&3)===0||Tn(i,a)){if(n=a&-a,n===i.callbackPriority)return n;switch(c!==null&&rs(c),xo(a)){case 2:case 8:a=Hs;break;case 32:a=kn;break;case 268435456:a=_r;break;default:a=kn}return c=w0.bind(null,i),a=Ri(a,c),i.callbackPriority=n,i.callbackNode=a,n}return c!==null&&c!==null&&rs(c),i.callbackPriority=2,i.callbackNode=null,2}function w0(i,n){if(bt!==0&&bt!==5)return i.callbackNode=null,i.callbackPriority=0,null;var a=i.callbackNode;if(hc()&&i.callbackNode!==a)return null;var c=Oe;return c=vr(i,i===Ge?c:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),c===0?null:(s0(i,c,n),b0(i,Rt()),i.callbackNode!=null&&i.callbackNode===a?w0.bind(null,i):null)}function x0(i,n){if(hc())return null;s0(i,n,!0)}function Wx(){iC(function(){(Ie&6)!==0?Ri(os,qx):S0()})}function $f(){if(an===0){var i=Lr;i===0&&(i=gr,gr<<=1,(gr&261888)===0&&(gr=256)),an=i}return an}function C0(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:bl(""+i)}function E0(i,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,i.id&&a.setAttribute("form",i.id),n.parentNode.insertBefore(a,n),i=new FormData(i),a.parentNode.removeChild(a),i}function Yx(i,n,a,c,_){if(n==="submit"&&a&&a.stateNode===_){var g=C0((_[Ut]||null).action),w=c.submitter;w&&(n=(n=w[Ut]||null)?C0(n.formAction):w.getAttribute("formAction"),n!==null&&(g=n,w=null));var k=new El("action","action",null,c,_);i.push({event:k,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(an!==0){var U=w?E0(_,w):new FormData(_);lf(a,{pending:!0,data:U,method:_.method,action:g},null,U)}}else typeof g=="function"&&(k.preventDefault(),U=w?E0(_,w):new FormData(_),lf(a,{pending:!0,data:U,method:_.method,action:g},g,U))},currentTarget:_}]})}}for(var qf=0;qf<Ch.length;qf++){var Wf=Ch[qf],Vx=Wf.toLowerCase(),Xx=Wf[0].toUpperCase()+Wf.slice(1);Li(Vx,"on"+Xx)}Li(ip,"onAnimationEnd"),Li(sp,"onAnimationIteration"),Li(np,"onAnimationStart"),Li("dblclick","onDoubleClick"),Li("focusin","onFocus"),Li("focusout","onBlur"),Li(cx,"onTransitionRun"),Li(ux,"onTransitionStart"),Li(hx,"onTransitionCancel"),Li(rp,"onTransitionEnd"),$s("onMouseEnter",["mouseout","mouseover"]),$s("onMouseLeave",["mouseout","mouseover"]),$s("onPointerEnter",["pointerout","pointerover"]),$s("onPointerLeave",["pointerout","pointerover"]),cs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),cs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),cs("onBeforeInput",["compositionend","keypress","textInput","paste"]),cs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),cs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),cs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ra="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(" "),Kx=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ra));function M0(i,n){n=(n&4)!==0;for(var a=0;a<i.length;a++){var c=i[a],_=c.event;c=c.listeners;e:{var g=void 0;if(n)for(var w=c.length-1;0<=w;w--){var k=c[w],U=k.instance,Q=k.currentTarget;if(k=k.listener,U!==g&&_.isPropagationStopped())break e;g=k,_.currentTarget=Q;try{g(_)}catch(se){Dl(se)}_.currentTarget=null,g=U}else for(w=0;w<c.length;w++){if(k=c[w],U=k.instance,Q=k.currentTarget,k=k.listener,U!==g&&_.isPropagationStopped())break e;g=k,_.currentTarget=Q;try{g(_)}catch(se){Dl(se)}_.currentTarget=null,g=U}}}}function Be(i,n){var a=n[yr];a===void 0&&(a=n[yr]=new Set);var c=i+"__bubble";a.has(c)||(k0(n,i,2,!1),a.add(c))}function Yf(i,n,a){var c=0;n&&(c|=4),k0(a,i,c,n)}var _c="_reactListening"+Math.random().toString(36).slice(2);function Vf(i){if(!i[_c]){i[_c]=!0,gl.forEach(function(a){a!=="selectionchange"&&(Kx.has(a)||Yf(a,!1,i),Yf(a,!0,i))});var n=i.nodeType===9?i:i.ownerDocument;n===null||n[_c]||(n[_c]=!0,Yf("selectionchange",!1,n))}}function k0(i,n,a,c){switch(iv(n)){case 2:var _=wC;break;case 8:_=xC;break;default:_=ad}a=_.bind(null,n,a,i),_=void 0,!hh||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(_=!0),c?_!==void 0?i.addEventListener(n,a,{capture:!0,passive:_}):i.addEventListener(n,a,!0):_!==void 0?i.addEventListener(n,a,{passive:_}):i.addEventListener(n,a,!1)}function Xf(i,n,a,c,_){var g=c;if((n&1)===0&&(n&2)===0&&c!==null)e:for(;;){if(c===null)return;var w=c.tag;if(w===3||w===4){var k=c.stateNode.containerInfo;if(k===_)break;if(w===4)for(w=c.return;w!==null;){var U=w.tag;if((U===3||U===4)&&w.stateNode.containerInfo===_)return;w=w.return}for(;k!==null;){if(w=Ps(k),w===null)return;if(U=w.tag,U===5||U===6||U===26||U===27){c=g=w;continue e}k=k.parentNode}}c=c.return}Rg(function(){var Q=g,se=ch(a),oe=[];e:{var J=op.get(i);if(J!==void 0){var ie=El,pe=i;switch(i){case"keypress":if(xl(a)===0)break e;case"keydown":case"keyup":ie=Iw;break;case"focusin":pe="focus",ie=gh;break;case"focusout":pe="blur",ie=gh;break;case"beforeblur":case"afterblur":ie=gh;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ie=Og;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ie=Tw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ie=Ww;break;case ip:case sp:case np:ie=Rw;break;case rp:ie=Vw;break;case"scroll":case"scrollend":ie=kw;break;case"wheel":ie=Kw;break;case"copy":case"cut":case"paste":ie=Lw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ie=Hg;break;case"toggle":case"beforetoggle":ie=Fw}var we=(n&4)!==0,Xe=!we&&(i==="scroll"||i==="scrollend"),K=we?J!==null?J+"Capture":null:J;we=[];for(var Y=Q,F;Y!==null;){var re=Y;if(F=re.stateNode,re=re.tag,re!==5&&re!==26&&re!==27||F===null||K===null||(re=ko(Y,K),re!=null&&we.push(oa(Y,re,F))),Xe)break;Y=Y.return}0<we.length&&(J=new ie(J,pe,null,a,se),oe.push({event:J,listeners:we}))}}if((n&7)===0){e:{if(J=i==="mouseover"||i==="pointerover",ie=i==="mouseout"||i==="pointerout",J&&a!==lh&&(pe=a.relatedTarget||a.fromElement)&&(Ps(pe)||pe[ls]))break e;if((ie||J)&&(J=se.window===se?se:(J=se.ownerDocument)?J.defaultView||J.parentWindow:window,ie?(pe=a.relatedTarget||a.toElement,ie=Q,pe=pe?Ps(pe):null,pe!==null&&(Xe=l(pe),we=pe.tag,pe!==Xe||we!==5&&we!==27&&we!==6)&&(pe=null)):(ie=null,pe=Q),ie!==pe)){if(we=Og,re="onMouseLeave",K="onMouseEnter",Y="mouse",(i==="pointerout"||i==="pointerover")&&(we=Hg,re="onPointerLeave",K="onPointerEnter",Y="pointer"),Xe=ie==null?J:js(ie),F=pe==null?J:js(pe),J=new we(re,Y+"leave",ie,a,se),J.target=Xe,J.relatedTarget=F,re=null,Ps(se)===Q&&(we=new we(K,Y+"enter",pe,a,se),we.target=F,we.relatedTarget=Xe,re=we),Xe=re,ie&&pe)t:{for(we=Gx,K=ie,Y=pe,F=0,re=K;re;re=we(re))F++;re=0;for(var Se=Y;Se;Se=we(Se))re++;for(;0<F-re;)K=we(K),F--;for(;0<re-F;)Y=we(Y),re--;for(;F--;){if(K===Y||Y!==null&&K===Y.alternate){we=K;break t}K=we(K),Y=we(Y)}we=null}else we=null;ie!==null&&D0(oe,J,ie,we,!1),pe!==null&&Xe!==null&&D0(oe,Xe,pe,we,!0)}}e:{if(J=Q?js(Q):window,ie=J.nodeName&&J.nodeName.toLowerCase(),ie==="select"||ie==="input"&&J.type==="file")var Ue=Yg;else if(qg(J))if(Vg)Ue=ox;else{Ue=nx;var ve=sx}else ie=J.nodeName,!ie||ie.toLowerCase()!=="input"||J.type!=="checkbox"&&J.type!=="radio"?Q&&ah(Q.elementType)&&(Ue=Yg):Ue=rx;if(Ue&&(Ue=Ue(i,Q))){Wg(oe,Ue,a,se);break e}ve&&ve(i,J,Q),i==="focusout"&&Q&&J.type==="number"&&Q.memoizedProps.value!=null&&Mo(J,"number",J.value)}switch(ve=Q?js(Q):window,i){case"focusin":(qg(ve)||ve.contentEditable==="true")&&(Mr=ve,bh=Q,Oo=null);break;case"focusout":Oo=bh=Mr=null;break;case"mousedown":wh=!0;break;case"contextmenu":case"mouseup":case"dragend":wh=!1,ep(oe,a,se);break;case"selectionchange":if(lx)break;case"keydown":case"keyup":ep(oe,a,se)}var Te;if(mh)e:{switch(i){case"compositionstart":var ze="onCompositionStart";break e;case"compositionend":ze="onCompositionEnd";break e;case"compositionupdate":ze="onCompositionUpdate";break e}ze=void 0}else Er?Ig(i,a)&&(ze="onCompositionEnd"):i==="keydown"&&a.keyCode===229&&(ze="onCompositionStart");ze&&(Pg&&a.locale!=="ko"&&(Er||ze!=="onCompositionStart"?ze==="onCompositionEnd"&&Er&&(Te=Bg()):(Ws=se,fh="value"in Ws?Ws.value:Ws.textContent,Er=!0)),ve=gc(Q,ze),0<ve.length&&(ze=new zg(ze,i,null,a,se),oe.push({event:ze,listeners:ve}),Te?ze.data=Te:(Te=$g(a),Te!==null&&(ze.data=Te)))),(Te=Qw?Jw(i,a):ex(i,a))&&(ze=gc(Q,"onBeforeInput"),0<ze.length&&(ve=new zg("onBeforeInput","beforeinput",null,a,se),oe.push({event:ve,listeners:ze}),ve.data=Te)),Yx(oe,i,Q,a,se)}M0(oe,n)})}function oa(i,n,a){return{instance:i,listener:n,currentTarget:a}}function gc(i,n){for(var a=n+"Capture",c=[];i!==null;){var _=i,g=_.stateNode;if(_=_.tag,_!==5&&_!==26&&_!==27||g===null||(_=ko(i,a),_!=null&&c.unshift(oa(i,_,g)),_=ko(i,n),_!=null&&c.push(oa(i,_,g))),i.tag===3)return c;i=i.return}return[]}function Gx(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function D0(i,n,a,c,_){for(var g=n._reactName,w=[];a!==null&&a!==c;){var k=a,U=k.alternate,Q=k.stateNode;if(k=k.tag,U!==null&&U===c)break;k!==5&&k!==26&&k!==27||Q===null||(U=Q,_?(Q=ko(a,g),Q!=null&&w.unshift(oa(a,Q,U))):_||(Q=ko(a,g),Q!=null&&w.push(oa(a,Q,U)))),a=a.return}w.length!==0&&i.push({event:n,listeners:w})}var Fx=/\r\n?/g,Zx=/\u0000|\uFFFD/g;function T0(i){return(typeof i=="string"?i:""+i).replace(Fx,`
|
|
49
|
+
`).replace(Zx,"")}function A0(i,n){return n=T0(n),T0(i)===n}function Ve(i,n,a,c,_,g){switch(a){case"children":typeof c=="string"?n==="body"||n==="textarea"&&c===""||wr(i,c):(typeof c=="number"||typeof c=="bigint")&&n!=="body"&&wr(i,""+c);break;case"className":br(i,"class",c);break;case"tabIndex":br(i,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":br(i,a,c);break;case"style":Ag(i,c,g);break;case"data":if(n!=="object"){br(i,"data",c);break}case"src":case"href":if(c===""&&(n!=="a"||a!=="href")){i.removeAttribute(a);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){i.removeAttribute(a);break}c=bl(""+c),i.setAttribute(a,c);break;case"action":case"formAction":if(typeof c=="function"){i.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof g=="function"&&(a==="formAction"?(n!=="input"&&Ve(i,n,"name",_.name,_,null),Ve(i,n,"formEncType",_.formEncType,_,null),Ve(i,n,"formMethod",_.formMethod,_,null),Ve(i,n,"formTarget",_.formTarget,_,null)):(Ve(i,n,"encType",_.encType,_,null),Ve(i,n,"method",_.method,_,null),Ve(i,n,"target",_.target,_,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){i.removeAttribute(a);break}c=bl(""+c),i.setAttribute(a,c);break;case"onClick":c!=null&&(i.onclick=hs);break;case"onScroll":c!=null&&Be("scroll",i);break;case"onScrollEnd":c!=null&&Be("scrollend",i);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(r(61));if(a=c.__html,a!=null){if(_.children!=null)throw Error(r(60));i.innerHTML=a}}break;case"multiple":i.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":i.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){i.removeAttribute("xlink:href");break}a=bl(""+c),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":c!=null&&typeof c!="function"&&typeof c!="symbol"?i.setAttribute(a,""+c):i.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":c&&typeof c!="function"&&typeof c!="symbol"?i.setAttribute(a,""):i.removeAttribute(a);break;case"capture":case"download":c===!0?i.setAttribute(a,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?i.setAttribute(a,c):i.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?i.setAttribute(a,c):i.removeAttribute(a);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?i.removeAttribute(a):i.setAttribute(a,c);break;case"popover":Be("beforetoggle",i),Be("toggle",i),Sr(i,"popover",c);break;case"xlinkActuate":Bi(i,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":Bi(i,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":Bi(i,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":Bi(i,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":Bi(i,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":Bi(i,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":Bi(i,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":Bi(i,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":Bi(i,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":Sr(i,"is",c);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Ew.get(a)||a,Sr(i,a,c))}}function Kf(i,n,a,c,_,g){switch(a){case"style":Ag(i,c,g);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(r(61));if(a=c.__html,a!=null){if(_.children!=null)throw Error(r(60));i.innerHTML=a}}break;case"children":typeof c=="string"?wr(i,c):(typeof c=="number"||typeof c=="bigint")&&wr(i,""+c);break;case"onScroll":c!=null&&Be("scroll",i);break;case"onScrollEnd":c!=null&&Be("scrollend",i);break;case"onClick":c!=null&&(i.onclick=hs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!pl.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(_=a.endsWith("Capture"),n=a.slice(2,_?a.length-7:void 0),g=i[Ut]||null,g=g!=null?g[a]:null,typeof g=="function"&&i.removeEventListener(n,g,_),typeof c=="function")){typeof g!="function"&&g!==null&&(a in i?i[a]=null:i.hasAttribute(a)&&i.removeAttribute(a)),i.addEventListener(n,c,_);break e}a in i?i[a]=c:c===!0?i.setAttribute(a,""):Sr(i,a,c)}}}function zt(i,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Be("error",i),Be("load",i);var c=!1,_=!1,g;for(g in a)if(a.hasOwnProperty(g)){var w=a[g];if(w!=null)switch(g){case"src":c=!0;break;case"srcSet":_=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:Ve(i,n,g,w,a,null)}}_&&Ve(i,n,"srcSet",a.srcSet,a,null),c&&Ve(i,n,"src",a.src,a,null);return;case"input":Be("invalid",i);var k=g=w=_=null,U=null,Q=null;for(c in a)if(a.hasOwnProperty(c)){var se=a[c];if(se!=null)switch(c){case"name":_=se;break;case"type":w=se;break;case"checked":U=se;break;case"defaultChecked":Q=se;break;case"value":g=se;break;case"defaultValue":k=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,n));break;default:Ve(i,n,c,se,a,null)}}Sl(i,g,k,U,Q,w,_,!1);return;case"select":Be("invalid",i),c=w=g=null;for(_ in a)if(a.hasOwnProperty(_)&&(k=a[_],k!=null))switch(_){case"value":g=k;break;case"defaultValue":w=k;break;case"multiple":c=k;default:Ve(i,n,_,k,a,null)}n=g,a=w,i.multiple=!!c,n!=null?us(i,!!c,n,!1):a!=null&&us(i,!!c,a,!0);return;case"textarea":Be("invalid",i),g=_=c=null;for(w in a)if(a.hasOwnProperty(w)&&(k=a[w],k!=null))switch(w){case"value":c=k;break;case"defaultValue":_=k;break;case"children":g=k;break;case"dangerouslySetInnerHTML":if(k!=null)throw Error(r(91));break;default:Ve(i,n,w,k,a,null)}Dg(i,c,_,g);return;case"option":for(U in a)if(a.hasOwnProperty(U)&&(c=a[U],c!=null))switch(U){case"selected":i.selected=c&&typeof c!="function"&&typeof c!="symbol";break;default:Ve(i,n,U,c,a,null)}return;case"dialog":Be("beforetoggle",i),Be("toggle",i),Be("cancel",i),Be("close",i);break;case"iframe":case"object":Be("load",i);break;case"video":case"audio":for(c=0;c<ra.length;c++)Be(ra[c],i);break;case"image":Be("error",i),Be("load",i);break;case"details":Be("toggle",i);break;case"embed":case"source":case"link":Be("error",i),Be("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Q in a)if(a.hasOwnProperty(Q)&&(c=a[Q],c!=null))switch(Q){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:Ve(i,n,Q,c,a,null)}return;default:if(ah(n)){for(se in a)a.hasOwnProperty(se)&&(c=a[se],c!==void 0&&Kf(i,n,se,c,a,void 0));return}}for(k in a)a.hasOwnProperty(k)&&(c=a[k],c!=null&&Ve(i,n,k,c,a,null))}function Qx(i,n,a,c){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var _=null,g=null,w=null,k=null,U=null,Q=null,se=null;for(ie in a){var oe=a[ie];if(a.hasOwnProperty(ie)&&oe!=null)switch(ie){case"checked":break;case"value":break;case"defaultValue":U=oe;default:c.hasOwnProperty(ie)||Ve(i,n,ie,null,c,oe)}}for(var J in c){var ie=c[J];if(oe=a[J],c.hasOwnProperty(J)&&(ie!=null||oe!=null))switch(J){case"type":g=ie;break;case"name":_=ie;break;case"checked":Q=ie;break;case"defaultChecked":se=ie;break;case"value":w=ie;break;case"defaultValue":k=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(r(137,n));break;default:ie!==oe&&Ve(i,n,J,ie,c,oe)}}Bn(i,w,k,U,Q,se,g,_);return;case"select":ie=w=k=J=null;for(g in a)if(U=a[g],a.hasOwnProperty(g)&&U!=null)switch(g){case"value":break;case"multiple":ie=U;default:c.hasOwnProperty(g)||Ve(i,n,g,null,c,U)}for(_ in c)if(g=c[_],U=a[_],c.hasOwnProperty(_)&&(g!=null||U!=null))switch(_){case"value":J=g;break;case"defaultValue":k=g;break;case"multiple":w=g;default:g!==U&&Ve(i,n,_,g,c,U)}n=k,a=w,c=ie,J!=null?us(i,!!a,J,!1):!!c!=!!a&&(n!=null?us(i,!!a,n,!0):us(i,!!a,a?[]:"",!1));return;case"textarea":ie=J=null;for(k in a)if(_=a[k],a.hasOwnProperty(k)&&_!=null&&!c.hasOwnProperty(k))switch(k){case"value":break;case"children":break;default:Ve(i,n,k,null,c,_)}for(w in c)if(_=c[w],g=a[w],c.hasOwnProperty(w)&&(_!=null||g!=null))switch(w){case"value":J=_;break;case"defaultValue":ie=_;break;case"children":break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(r(91));break;default:_!==g&&Ve(i,n,w,_,c,g)}kg(i,J,ie);return;case"option":for(var pe in a)if(J=a[pe],a.hasOwnProperty(pe)&&J!=null&&!c.hasOwnProperty(pe))switch(pe){case"selected":i.selected=!1;break;default:Ve(i,n,pe,null,c,J)}for(U in c)if(J=c[U],ie=a[U],c.hasOwnProperty(U)&&J!==ie&&(J!=null||ie!=null))switch(U){case"selected":i.selected=J&&typeof J!="function"&&typeof J!="symbol";break;default:Ve(i,n,U,J,c,ie)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var we in a)J=a[we],a.hasOwnProperty(we)&&J!=null&&!c.hasOwnProperty(we)&&Ve(i,n,we,null,c,J);for(Q in c)if(J=c[Q],ie=a[Q],c.hasOwnProperty(Q)&&J!==ie&&(J!=null||ie!=null))switch(Q){case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(r(137,n));break;default:Ve(i,n,Q,J,c,ie)}return;default:if(ah(n)){for(var Xe in a)J=a[Xe],a.hasOwnProperty(Xe)&&J!==void 0&&!c.hasOwnProperty(Xe)&&Kf(i,n,Xe,void 0,c,J);for(se in c)J=c[se],ie=a[se],!c.hasOwnProperty(se)||J===ie||J===void 0&&ie===void 0||Kf(i,n,se,J,c,ie);return}}for(var K in a)J=a[K],a.hasOwnProperty(K)&&J!=null&&!c.hasOwnProperty(K)&&Ve(i,n,K,null,c,J);for(oe in c)J=c[oe],ie=a[oe],!c.hasOwnProperty(oe)||J===ie||J==null&&ie==null||Ve(i,n,oe,J,c,ie)}function N0(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Jx(){if(typeof performance.getEntriesByType=="function"){for(var i=0,n=0,a=performance.getEntriesByType("resource"),c=0;c<a.length;c++){var _=a[c],g=_.transferSize,w=_.initiatorType,k=_.duration;if(g&&k&&N0(w)){for(w=0,k=_.responseEnd,c+=1;c<a.length;c++){var U=a[c],Q=U.startTime;if(Q>k)break;var se=U.transferSize,oe=U.initiatorType;se&&N0(oe)&&(U=U.responseEnd,w+=se*(U<k?1:(k-Q)/(U-Q)))}if(--c,n+=8*(g+w)/(_.duration/1e3),i++,10<i)break}}if(0<i)return n/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var Gf=null,Ff=null;function pc(i){return i.nodeType===9?i:i.ownerDocument}function R0(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function B0(i,n){if(i===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&n==="foreignObject"?0:i}function Zf(i,n){return i==="textarea"||i==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Qf=null;function eC(){var i=window.event;return i&&i.type==="popstate"?i===Qf?!1:(Qf=i,!0):(Qf=null,!1)}var L0=typeof setTimeout=="function"?setTimeout:void 0,tC=typeof clearTimeout=="function"?clearTimeout:void 0,O0=typeof Promise=="function"?Promise:void 0,iC=typeof queueMicrotask=="function"?queueMicrotask:typeof O0<"u"?function(i){return O0.resolve(null).then(i).catch(sC)}:L0;function sC(i){setTimeout(function(){throw i})}function ln(i){return i==="head"}function z0(i,n){var a=n,c=0;do{var _=a.nextSibling;if(i.removeChild(a),_&&_.nodeType===8)if(a=_.data,a==="/$"||a==="/&"){if(c===0){i.removeChild(_),Jr(n);return}c--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")c++;else if(a==="html")aa(i.ownerDocument.documentElement);else if(a==="head"){a=i.ownerDocument.head,aa(a);for(var g=a.firstChild;g;){var w=g.nextSibling,k=g.nodeName;g[Nn]||k==="SCRIPT"||k==="STYLE"||k==="LINK"&&g.rel.toLowerCase()==="stylesheet"||a.removeChild(g),g=w}}else a==="body"&&aa(i.ownerDocument.body);a=_}while(a);Jr(n)}function H0(i,n){var a=i;i=0;do{var c=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),c&&c.nodeType===8)if(a=c.data,a==="/$"){if(i===0)break;i--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||i++;a=c}while(a)}function Jf(i){var n=i.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Jf(a),Co(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}i.removeChild(a)}}function nC(i,n,a,c){for(;i.nodeType===1;){var _=a;if(i.nodeName.toLowerCase()!==n.toLowerCase()){if(!c&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(c){if(!i[Nn])switch(n){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(g=i.getAttribute("rel"),g==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(g!==_.rel||i.getAttribute("href")!==(_.href==null||_.href===""?null:_.href)||i.getAttribute("crossorigin")!==(_.crossOrigin==null?null:_.crossOrigin)||i.getAttribute("title")!==(_.title==null?null:_.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(g=i.getAttribute("src"),(g!==(_.src==null?null:_.src)||i.getAttribute("type")!==(_.type==null?null:_.type)||i.getAttribute("crossorigin")!==(_.crossOrigin==null?null:_.crossOrigin))&&g&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(n==="input"&&i.type==="hidden"){var g=_.name==null?null:""+_.name;if(_.type==="hidden"&&i.getAttribute("name")===g)return i}else return i;if(i=Ei(i.nextSibling),i===null)break}return null}function rC(i,n,a){if(n==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!a||(i=Ei(i.nextSibling),i===null))return null;return i}function P0(i,n){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!n||(i=Ei(i.nextSibling),i===null))return null;return i}function ed(i){return i.data==="$?"||i.data==="$~"}function td(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function oC(i,n){var a=i.ownerDocument;if(i.data==="$~")i._reactRetry=n;else if(i.data!=="$?"||a.readyState!=="loading")n();else{var c=function(){n(),a.removeEventListener("DOMContentLoaded",c)};a.addEventListener("DOMContentLoaded",c),i._reactRetry=c}}function Ei(i){for(;i!=null;i=i.nextSibling){var n=i.nodeType;if(n===1||n===3)break;if(n===8){if(n=i.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return i}var id=null;function U0(i){i=i.nextSibling;for(var n=0;i;){if(i.nodeType===8){var a=i.data;if(a==="/$"||a==="/&"){if(n===0)return Ei(i.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}i=i.nextSibling}return null}function j0(i){i=i.previousSibling;for(var n=0;i;){if(i.nodeType===8){var a=i.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return i;n--}else a!=="/$"&&a!=="/&"||n++}i=i.previousSibling}return null}function I0(i,n,a){switch(n=pc(a),i){case"html":if(i=n.documentElement,!i)throw Error(r(452));return i;case"head":if(i=n.head,!i)throw Error(r(453));return i;case"body":if(i=n.body,!i)throw Error(r(454));return i;default:throw Error(r(451))}}function aa(i){for(var n=i.attributes;n.length;)i.removeAttributeNode(n[0]);Co(i)}var Mi=new Map,$0=new Set;function mc(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var ks=L.d;L.d={f:aC,r:lC,D:cC,C:uC,L:hC,m:fC,X:_C,S:dC,M:gC};function aC(){var i=ks.f(),n=lc();return i||n}function lC(i){var n=Us(i);n!==null&&n.tag===5&&n.type==="form"?rm(n):ks.r(i)}var Fr=typeof document>"u"?null:document;function q0(i,n,a){var c=Fr;if(c&&typeof n=="string"&&n){var _=Gt(n);_='link[rel="'+i+'"][href="'+_+'"]',typeof a=="string"&&(_+='[crossorigin="'+a+'"]'),$0.has(_)||($0.add(_),i={rel:i,crossOrigin:a,href:n},c.querySelector(_)===null&&(n=c.createElement("link"),zt(n,"link",i),ft(n),c.head.appendChild(n)))}}function cC(i){ks.D(i),q0("dns-prefetch",i,null)}function uC(i,n){ks.C(i,n),q0("preconnect",i,n)}function hC(i,n,a){ks.L(i,n,a);var c=Fr;if(c&&i&&n){var _='link[rel="preload"][as="'+Gt(n)+'"]';n==="image"&&a&&a.imageSrcSet?(_+='[imagesrcset="'+Gt(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(_+='[imagesizes="'+Gt(a.imageSizes)+'"]')):_+='[href="'+Gt(i)+'"]';var g=_;switch(n){case"style":g=Zr(i);break;case"script":g=Qr(i)}Mi.has(g)||(i=m({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:i,as:n},a),Mi.set(g,i),c.querySelector(_)!==null||n==="style"&&c.querySelector(la(g))||n==="script"&&c.querySelector(ca(g))||(n=c.createElement("link"),zt(n,"link",i),ft(n),c.head.appendChild(n)))}}function fC(i,n){ks.m(i,n);var a=Fr;if(a&&i){var c=n&&typeof n.as=="string"?n.as:"script",_='link[rel="modulepreload"][as="'+Gt(c)+'"][href="'+Gt(i)+'"]',g=_;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=Qr(i)}if(!Mi.has(g)&&(i=m({rel:"modulepreload",href:i},n),Mi.set(g,i),a.querySelector(_)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(ca(g)))return}c=a.createElement("link"),zt(c,"link",i),ft(c),a.head.appendChild(c)}}}function dC(i,n,a){ks.S(i,n,a);var c=Fr;if(c&&i){var _=Is(c).hoistableStyles,g=Zr(i);n=n||"default";var w=_.get(g);if(!w){var k={loading:0,preload:null};if(w=c.querySelector(la(g)))k.loading=5;else{i=m({rel:"stylesheet",href:i,"data-precedence":n},a),(a=Mi.get(g))&&sd(i,a);var U=w=c.createElement("link");ft(U),zt(U,"link",i),U._p=new Promise(function(Q,se){U.onload=Q,U.onerror=se}),U.addEventListener("load",function(){k.loading|=1}),U.addEventListener("error",function(){k.loading|=2}),k.loading|=4,vc(w,n,c)}w={type:"stylesheet",instance:w,count:1,state:k},_.set(g,w)}}}function _C(i,n){ks.X(i,n);var a=Fr;if(a&&i){var c=Is(a).hoistableScripts,_=Qr(i),g=c.get(_);g||(g=a.querySelector(ca(_)),g||(i=m({src:i,async:!0},n),(n=Mi.get(_))&&nd(i,n),g=a.createElement("script"),ft(g),zt(g,"link",i),a.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},c.set(_,g))}}function gC(i,n){ks.M(i,n);var a=Fr;if(a&&i){var c=Is(a).hoistableScripts,_=Qr(i),g=c.get(_);g||(g=a.querySelector(ca(_)),g||(i=m({src:i,async:!0,type:"module"},n),(n=Mi.get(_))&&nd(i,n),g=a.createElement("script"),ft(g),zt(g,"link",i),a.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},c.set(_,g))}}function W0(i,n,a,c){var _=(_=ce.current)?mc(_):null;if(!_)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=Zr(a.href),a=Is(_).hoistableStyles,c=a.get(n),c||(c={type:"style",instance:null,count:0,state:null},a.set(n,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){i=Zr(a.href);var g=Is(_).hoistableStyles,w=g.get(i);if(w||(_=_.ownerDocument||_,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(i,w),(g=_.querySelector(la(i)))&&!g._p&&(w.instance=g,w.state.loading=5),Mi.has(i)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Mi.set(i,a),g||pC(_,i,a,w.state))),n&&c===null)throw Error(r(528,""));return w}if(n&&c!==null)throw Error(r(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Qr(a),a=Is(_).hoistableScripts,c=a.get(n),c||(c={type:"script",instance:null,count:0,state:null},a.set(n,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function Zr(i){return'href="'+Gt(i)+'"'}function la(i){return'link[rel="stylesheet"]['+i+"]"}function Y0(i){return m({},i,{"data-precedence":i.precedence,precedence:null})}function pC(i,n,a,c){i.querySelector('link[rel="preload"][as="style"]['+n+"]")?c.loading=1:(n=i.createElement("link"),c.preload=n,n.addEventListener("load",function(){return c.loading|=1}),n.addEventListener("error",function(){return c.loading|=2}),zt(n,"link",a),ft(n),i.head.appendChild(n))}function Qr(i){return'[src="'+Gt(i)+'"]'}function ca(i){return"script[async]"+i}function V0(i,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var c=i.querySelector('style[data-href~="'+Gt(a.href)+'"]');if(c)return n.instance=c,ft(c),c;var _=m({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return c=(i.ownerDocument||i).createElement("style"),ft(c),zt(c,"style",_),vc(c,a.precedence,i),n.instance=c;case"stylesheet":_=Zr(a.href);var g=i.querySelector(la(_));if(g)return n.state.loading|=4,n.instance=g,ft(g),g;c=Y0(a),(_=Mi.get(_))&&sd(c,_),g=(i.ownerDocument||i).createElement("link"),ft(g);var w=g;return w._p=new Promise(function(k,U){w.onload=k,w.onerror=U}),zt(g,"link",c),n.state.loading|=4,vc(g,a.precedence,i),n.instance=g;case"script":return g=Qr(a.src),(_=i.querySelector(ca(g)))?(n.instance=_,ft(_),_):(c=a,(_=Mi.get(g))&&(c=m({},a),nd(c,_)),i=i.ownerDocument||i,_=i.createElement("script"),ft(_),zt(_,"link",c),i.head.appendChild(_),n.instance=_);case"void":return null;default:throw Error(r(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(c=n.instance,n.state.loading|=4,vc(c,a.precedence,i));return n.instance}function vc(i,n,a){for(var c=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),_=c.length?c[c.length-1]:null,g=_,w=0;w<c.length;w++){var k=c[w];if(k.dataset.precedence===n)g=k;else if(g!==_)break}g?g.parentNode.insertBefore(i,g.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(i,n.firstChild))}function sd(i,n){i.crossOrigin==null&&(i.crossOrigin=n.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=n.referrerPolicy),i.title==null&&(i.title=n.title)}function nd(i,n){i.crossOrigin==null&&(i.crossOrigin=n.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=n.referrerPolicy),i.integrity==null&&(i.integrity=n.integrity)}var yc=null;function X0(i,n,a){if(yc===null){var c=new Map,_=yc=new Map;_.set(a,c)}else _=yc,c=_.get(a),c||(c=new Map,_.set(a,c));if(c.has(i))return c;for(c.set(i,null),a=a.getElementsByTagName(i),_=0;_<a.length;_++){var g=a[_];if(!(g[Nn]||g[St]||i==="link"&&g.getAttribute("rel")==="stylesheet")&&g.namespaceURI!=="http://www.w3.org/2000/svg"){var w=g.getAttribute(n)||"";w=i+w;var k=c.get(w);k?k.push(g):c.set(w,[g])}}return c}function K0(i,n,a){i=i.ownerDocument||i,i.head.insertBefore(a,n==="title"?i.querySelector("head > title"):null)}function mC(i,n,a){if(a===1||n.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return i=n.disabled,typeof n.precedence=="string"&&i==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function G0(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function vC(i,n,a,c){if(a.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var _=Zr(c.href),g=n.querySelector(la(_));if(g){n=g._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(i.count++,i=Sc.bind(i),n.then(i,i)),a.state.loading|=4,a.instance=g,ft(g);return}g=n.ownerDocument||n,c=Y0(c),(_=Mi.get(_))&&sd(c,_),g=g.createElement("link"),ft(g);var w=g;w._p=new Promise(function(k,U){w.onload=k,w.onerror=U}),zt(g,"link",c),a.instance=g}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(i.count++,a=Sc.bind(i),n.addEventListener("load",a),n.addEventListener("error",a))}}var rd=0;function yC(i,n){return i.stylesheets&&i.count===0&&wc(i,i.stylesheets),0<i.count||0<i.imgCount?function(a){var c=setTimeout(function(){if(i.stylesheets&&wc(i,i.stylesheets),i.unsuspend){var g=i.unsuspend;i.unsuspend=null,g()}},6e4+n);0<i.imgBytes&&rd===0&&(rd=62500*Jx());var _=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&wc(i,i.stylesheets),i.unsuspend)){var g=i.unsuspend;i.unsuspend=null,g()}},(i.imgBytes>rd?50:800)+n);return i.unsuspend=a,function(){i.unsuspend=null,clearTimeout(c),clearTimeout(_)}}:null}function Sc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)wc(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var bc=null;function wc(i,n){i.stylesheets=null,i.unsuspend!==null&&(i.count++,bc=new Map,n.forEach(SC,i),bc=null,Sc.call(i))}function SC(i,n){if(!(n.state.loading&4)){var a=bc.get(i);if(a)var c=a.get(null);else{a=new Map,bc.set(i,a);for(var _=i.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g<_.length;g++){var w=_[g];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(a.set(w.dataset.precedence,w),c=w)}c&&a.set(null,c)}_=n.instance,w=_.getAttribute("data-precedence"),g=a.get(w)||c,g===c&&a.set(null,_),a.set(w,_),this.count++,c=Sc.bind(this),_.addEventListener("load",c),_.addEventListener("error",c),g?g.parentNode.insertBefore(_,g.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(_,i.firstChild)),n.state.loading|=4}}var ua={$$typeof:E,Provider:null,Consumer:null,_currentValue:B,_currentValue2:B,_threadCount:0};function bC(i,n,a,c,_,g,w,k,U){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=bo(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=bo(0),this.hiddenUpdates=bo(null),this.identifierPrefix=c,this.onUncaughtError=_,this.onCaughtError=g,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=U,this.incompleteTransitions=new Map}function F0(i,n,a,c,_,g,w,k,U,Q,se,oe){return i=new bC(i,n,a,w,U,Q,se,oe,k),n=1,g===!0&&(n|=24),g=li(3,null,null,n),i.current=g,g.stateNode=i,n=Hh(),n.refCount++,i.pooledCache=n,n.refCount++,g.memoizedState={element:c,isDehydrated:a,cache:n},Ih(g),i}function Z0(i){return i?(i=Tr,i):Tr}function Q0(i,n,a,c,_,g){_=Z0(_),c.context===null?c.context=_:c.pendingContext=_,c=Fs(n),c.payload={element:a},g=g===void 0?null:g,g!==null&&(c.callback=g),a=Zs(i,c,n),a!==null&&(ti(a,i,n),$o(a,i,n))}function J0(i,n){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var a=i.retryLane;i.retryLane=a!==0&&a<n?a:n}}function od(i,n){J0(i,n),(i=i.alternate)&&J0(i,n)}function ev(i){if(i.tag===13||i.tag===31){var n=Hn(i,67108864);n!==null&&ti(n,i,67108864),od(i,67108864)}}function tv(i){if(i.tag===13||i.tag===31){var n=di();n=wo(n);var a=Hn(i,n);a!==null&&ti(a,i,n),od(i,n)}}var xc=!0;function wC(i,n,a,c){var _=M.T;M.T=null;var g=L.p;try{L.p=2,ad(i,n,a,c)}finally{L.p=g,M.T=_}}function xC(i,n,a,c){var _=M.T;M.T=null;var g=L.p;try{L.p=8,ad(i,n,a,c)}finally{L.p=g,M.T=_}}function ad(i,n,a,c){if(xc){var _=ld(c);if(_===null)Xf(i,n,c,Cc,a),sv(i,c);else if(EC(_,i,n,a,c))c.stopPropagation();else if(sv(i,c),n&4&&-1<CC.indexOf(i)){for(;_!==null;){var g=Us(_);if(g!==null)switch(g.tag){case 3:if(g=g.stateNode,g.current.memoizedState.isDehydrated){var w=as(g.pendingLanes);if(w!==0){var k=g;for(k.pendingLanes|=2,k.entangledLanes|=2;w;){var U=1<<31-qt(w);k.entanglements[1]|=U,w&=~U}Ki(g),(Ie&6)===0&&(oc=Rt()+500,na(0))}}break;case 31:case 13:k=Hn(g,2),k!==null&&ti(k,g,2),lc(),od(g,2)}if(g=ld(c),g===null&&Xf(i,n,c,Cc,a),g===_)break;_=g}_!==null&&c.stopPropagation()}else Xf(i,n,c,null,a)}}function ld(i){return i=ch(i),cd(i)}var Cc=null;function cd(i){if(Cc=null,i=Ps(i),i!==null){var n=l(i);if(n===null)i=null;else{var a=n.tag;if(a===13){if(i=u(n),i!==null)return i;i=null}else if(a===31){if(i=h(n),i!==null)return i;i=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;i=null}else n!==i&&(i=null)}}return Cc=i,null}function iv(i){switch(i){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(dr()){case os:return 2;case Hs:return 8;case kn:case Ku:return 32;case _r:return 268435456;default:return 32}default:return 32}}var ud=!1,cn=null,un=null,hn=null,ha=new Map,fa=new Map,fn=[],CC="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function sv(i,n){switch(i){case"focusin":case"focusout":cn=null;break;case"dragenter":case"dragleave":un=null;break;case"mouseover":case"mouseout":hn=null;break;case"pointerover":case"pointerout":ha.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":fa.delete(n.pointerId)}}function da(i,n,a,c,_,g){return i===null||i.nativeEvent!==g?(i={blockedOn:n,domEventName:a,eventSystemFlags:c,nativeEvent:g,targetContainers:[_]},n!==null&&(n=Us(n),n!==null&&ev(n)),i):(i.eventSystemFlags|=c,n=i.targetContainers,_!==null&&n.indexOf(_)===-1&&n.push(_),i)}function EC(i,n,a,c,_){switch(n){case"focusin":return cn=da(cn,i,n,a,c,_),!0;case"dragenter":return un=da(un,i,n,a,c,_),!0;case"mouseover":return hn=da(hn,i,n,a,c,_),!0;case"pointerover":var g=_.pointerId;return ha.set(g,da(ha.get(g)||null,i,n,a,c,_)),!0;case"gotpointercapture":return g=_.pointerId,fa.set(g,da(fa.get(g)||null,i,n,a,c,_)),!0}return!1}function nv(i){var n=Ps(i.target);if(n!==null){var a=l(n);if(a!==null){if(n=a.tag,n===13){if(n=u(a),n!==null){i.blockedOn=n,fl(i.priority,function(){tv(a)});return}}else if(n===31){if(n=h(a),n!==null){i.blockedOn=n,fl(i.priority,function(){tv(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){i.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Ec(i){if(i.blockedOn!==null)return!1;for(var n=i.targetContainers;0<n.length;){var a=ld(i.nativeEvent);if(a===null){a=i.nativeEvent;var c=new a.constructor(a.type,a);lh=c,a.target.dispatchEvent(c),lh=null}else return n=Us(a),n!==null&&ev(n),i.blockedOn=a,!1;n.shift()}return!0}function rv(i,n,a){Ec(i)&&a.delete(n)}function MC(){ud=!1,cn!==null&&Ec(cn)&&(cn=null),un!==null&&Ec(un)&&(un=null),hn!==null&&Ec(hn)&&(hn=null),ha.forEach(rv),fa.forEach(rv)}function Mc(i,n){i.blockedOn===n&&(i.blockedOn=null,ud||(ud=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,MC)))}var kc=null;function ov(i){kc!==i&&(kc=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){kc===i&&(kc=null);for(var n=0;n<i.length;n+=3){var a=i[n],c=i[n+1],_=i[n+2];if(typeof c!="function"){if(cd(c||a)===null)continue;break}var g=Us(a);g!==null&&(i.splice(n,3),n-=3,lf(g,{pending:!0,data:_,method:a.method,action:c},c,_))}}))}function Jr(i){function n(U){return Mc(U,i)}cn!==null&&Mc(cn,i),un!==null&&Mc(un,i),hn!==null&&Mc(hn,i),ha.forEach(n),fa.forEach(n);for(var a=0;a<fn.length;a++){var c=fn[a];c.blockedOn===i&&(c.blockedOn=null)}for(;0<fn.length&&(a=fn[0],a.blockedOn===null);)nv(a),a.blockedOn===null&&fn.shift();if(a=(i.ownerDocument||i).$$reactFormReplay,a!=null)for(c=0;c<a.length;c+=3){var _=a[c],g=a[c+1],w=_[Ut]||null;if(typeof g=="function")w||ov(a);else if(w){var k=null;if(g&&g.hasAttribute("formAction")){if(_=g,w=g[Ut]||null)k=w.formAction;else if(cd(_)!==null)continue}else k=w.action;typeof k=="function"?a[c+1]=k:(a.splice(c,3),c-=3),ov(a)}}}function av(){function i(g){g.canIntercept&&g.info==="react-transition"&&g.intercept({handler:function(){return new Promise(function(w){return _=w})},focusReset:"manual",scroll:"manual"})}function n(){_!==null&&(_(),_=null),c||setTimeout(a,20)}function a(){if(!c&&!navigation.transition){var g=navigation.currentEntry;g&&g.url!=null&&navigation.navigate(g.url,{state:g.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var c=!1,_=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){c=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),_!==null&&(_(),_=null)}}}function hd(i){this._internalRoot=i}Dc.prototype.render=hd.prototype.render=function(i){var n=this._internalRoot;if(n===null)throw Error(r(409));var a=n.current,c=di();Q0(a,c,i,n,null,null)},Dc.prototype.unmount=hd.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var n=i.containerInfo;Q0(i.current,2,null,i,null,null),lc(),n[ls]=null}};function Dc(i){this._internalRoot=i}Dc.prototype.unstable_scheduleHydration=function(i){if(i){var n=hl();i={blockedOn:null,target:i,priority:n};for(var a=0;a<fn.length&&n!==0&&n<fn[a].priority;a++);fn.splice(a,0,i),a===0&&nv(i)}};var lv=t.version;if(lv!=="19.2.4")throw Error(r(527,lv,"19.2.4"));L.findDOMNode=function(i){var n=i._reactInternals;if(n===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=f(n),i=i!==null?p(i):null,i=i===null?null:i.stateNode,i};var kC={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Tc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Tc.isDisabled&&Tc.supportsFiber)try{Dn=Tc.inject(kC),$t=Tc}catch{}}return ga.createRoot=function(i,n){if(!o(i))throw Error(r(299));var a=!1,c="",_=gm,g=pm,w=mm;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(c=n.identifierPrefix),n.onUncaughtError!==void 0&&(_=n.onUncaughtError),n.onCaughtError!==void 0&&(g=n.onCaughtError),n.onRecoverableError!==void 0&&(w=n.onRecoverableError)),n=F0(i,1,!1,null,null,a,c,null,_,g,w,av),i[ls]=n.current,Vf(i),new hd(n)},ga.hydrateRoot=function(i,n,a){if(!o(i))throw Error(r(299));var c=!1,_="",g=gm,w=pm,k=mm,U=null;return a!=null&&(a.unstable_strictMode===!0&&(c=!0),a.identifierPrefix!==void 0&&(_=a.identifierPrefix),a.onUncaughtError!==void 0&&(g=a.onUncaughtError),a.onCaughtError!==void 0&&(w=a.onCaughtError),a.onRecoverableError!==void 0&&(k=a.onRecoverableError),a.formState!==void 0&&(U=a.formState)),n=F0(i,1,!0,n,a??null,c,_,U,g,w,k,av),n.context=Z0(null),a=n.current,c=di(),c=wo(c),_=Fs(c),_.callback=null,Zs(a,_,c),a=c,n.current.lanes=a,An(n,a),Ki(n),i[ls]=n.current,Vf(i),new Dc(n)},ga.version="19.2.4",ga}var vv;function HC(){if(vv)return _d.exports;vv=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(),_d.exports=zC(),_d.exports}var PC=HC();function yt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let s=0,r;s<e.length;s++)(r=yt(e[s]))!==""&&(t+=(t&&" ")+r);else for(let s in e)e[s]&&(t+=(t&&" ")+s);return t}var UC={value:()=>{}};function Au(){for(var e=0,t=arguments.length,s={},r;e<t;++e){if(!(r=arguments[e]+"")||r in s||/[\s.]/.test(r))throw new Error("illegal type: "+r);s[r]=[]}return new Kc(s)}function Kc(e){this._=e}function jC(e,t){return e.trim().split(/^|\s+/).map(function(s){var r="",o=s.indexOf(".");if(o>=0&&(r=s.slice(o+1),s=s.slice(0,o)),s&&!t.hasOwnProperty(s))throw new Error("unknown type: "+s);return{type:s,name:r}})}Kc.prototype=Au.prototype={constructor:Kc,on:function(e,t){var s=this._,r=jC(e+"",s),o,l=-1,u=r.length;if(arguments.length<2){for(;++l<u;)if((o=(e=r[l]).type)&&(o=IC(s[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++l<u;)if(o=(e=r[l]).type)s[o]=yv(s[o],e.name,t);else if(t==null)for(o in s)s[o]=yv(s[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var s in t)e[s]=t[s].slice();return new Kc(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var s=new Array(o),r=0,o,l;r<o;++r)s[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],r=0,o=l.length;r<o;++r)l[r].value.apply(t,s)},apply:function(e,t,s){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,l=r.length;o<l;++o)r[o].value.apply(t,s)}};function IC(e,t){for(var s=0,r=e.length,o;s<r;++s)if((o=e[s]).name===t)return o.value}function yv(e,t,s){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=UC,e=e.slice(0,r).concat(e.slice(r+1));break}return s!=null&&e.push({name:t,value:s}),e}var Gd="http://www.w3.org/1999/xhtml";const Sv={svg:"http://www.w3.org/2000/svg",xhtml:Gd,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Nu(e){var t=e+="",s=t.indexOf(":");return s>=0&&(t=e.slice(0,s))!=="xmlns"&&(e=e.slice(s+1)),Sv.hasOwnProperty(t)?{space:Sv[t],local:e}:e}function $C(e){return function(){var t=this.ownerDocument,s=this.namespaceURI;return s===Gd&&t.documentElement.namespaceURI===Gd?t.createElement(e):t.createElementNS(s,e)}}function qC(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function IS(e){var t=Nu(e);return(t.local?qC:$C)(t)}function WC(){}function G_(e){return e==null?WC:function(){return this.querySelector(e)}}function YC(e){typeof e!="function"&&(e=G_(e));for(var t=this._groups,s=t.length,r=new Array(s),o=0;o<s;++o)for(var l=t[o],u=l.length,h=r[o]=new Array(u),d,f,p=0;p<u;++p)(d=l[p])&&(f=e.call(d,d.__data__,p,l))&&("__data__"in d&&(f.__data__=d.__data__),h[p]=f);return new vi(r,this._parents)}function VC(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function XC(){return[]}function $S(e){return e==null?XC:function(){return this.querySelectorAll(e)}}function KC(e){return function(){return VC(e.apply(this,arguments))}}function GC(e){typeof e=="function"?e=KC(e):e=$S(e);for(var t=this._groups,s=t.length,r=[],o=[],l=0;l<s;++l)for(var u=t[l],h=u.length,d,f=0;f<h;++f)(d=u[f])&&(r.push(e.call(d,d.__data__,f,u)),o.push(d));return new vi(r,o)}function qS(e){return function(){return this.matches(e)}}function WS(e){return function(t){return t.matches(e)}}var FC=Array.prototype.find;function ZC(e){return function(){return FC.call(this.children,e)}}function QC(){return this.firstElementChild}function JC(e){return this.select(e==null?QC:ZC(typeof e=="function"?e:WS(e)))}var e2=Array.prototype.filter;function t2(){return Array.from(this.children)}function i2(e){return function(){return e2.call(this.children,e)}}function s2(e){return this.selectAll(e==null?t2:i2(typeof e=="function"?e:WS(e)))}function n2(e){typeof e!="function"&&(e=qS(e));for(var t=this._groups,s=t.length,r=new Array(s),o=0;o<s;++o)for(var l=t[o],u=l.length,h=r[o]=[],d,f=0;f<u;++f)(d=l[f])&&e.call(d,d.__data__,f,l)&&h.push(d);return new vi(r,this._parents)}function YS(e){return new Array(e.length)}function r2(){return new vi(this._enter||this._groups.map(YS),this._parents)}function lu(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}lu.prototype={constructor:lu,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function o2(e){return function(){return e}}function a2(e,t,s,r,o,l){for(var u=0,h,d=t.length,f=l.length;u<f;++u)(h=t[u])?(h.__data__=l[u],r[u]=h):s[u]=new lu(e,l[u]);for(;u<d;++u)(h=t[u])&&(o[u]=h)}function l2(e,t,s,r,o,l,u){var h,d,f=new Map,p=t.length,m=l.length,v=new Array(p),S;for(h=0;h<p;++h)(d=t[h])&&(v[h]=S=u.call(d,d.__data__,h,t)+"",f.has(S)?o[h]=d:f.set(S,d));for(h=0;h<m;++h)S=u.call(e,l[h],h,l)+"",(d=f.get(S))?(r[h]=d,d.__data__=l[h],f.delete(S)):s[h]=new lu(e,l[h]);for(h=0;h<p;++h)(d=t[h])&&f.get(v[h])===d&&(o[h]=d)}function c2(e){return e.__data__}function u2(e,t){if(!arguments.length)return Array.from(this,c2);var s=t?l2:a2,r=this._parents,o=this._groups;typeof e!="function"&&(e=o2(e));for(var l=o.length,u=new Array(l),h=new Array(l),d=new Array(l),f=0;f<l;++f){var p=r[f],m=o[f],v=m.length,S=h2(e.call(p,p&&p.__data__,f,r)),y=S.length,b=h[f]=new Array(y),x=u[f]=new Array(y),C=d[f]=new Array(v);s(p,m,b,x,C,S,t);for(var A=0,E=0,D,H;A<y;++A)if(D=b[A]){for(A>=E&&(E=A+1);!(H=x[E])&&++E<y;);D._next=H||null}}return u=new vi(u,r),u._enter=h,u._exit=d,u}function h2(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function f2(){return new vi(this._exit||this._groups.map(YS),this._parents)}function d2(e,t,s){var r=this.enter(),o=this,l=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),s==null?l.remove():s(l),r&&o?r.merge(o).order():o}function _2(e){for(var t=e.selection?e.selection():e,s=this._groups,r=t._groups,o=s.length,l=r.length,u=Math.min(o,l),h=new Array(o),d=0;d<u;++d)for(var f=s[d],p=r[d],m=f.length,v=h[d]=new Array(m),S,y=0;y<m;++y)(S=f[y]||p[y])&&(v[y]=S);for(;d<o;++d)h[d]=s[d];return new vi(h,this._parents)}function g2(){for(var e=this._groups,t=-1,s=e.length;++t<s;)for(var r=e[t],o=r.length-1,l=r[o],u;--o>=0;)(u=r[o])&&(l&&u.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(u,l),l=u);return this}function p2(e){e||(e=m2);function t(m,v){return m&&v?e(m.__data__,v.__data__):!m-!v}for(var s=this._groups,r=s.length,o=new Array(r),l=0;l<r;++l){for(var u=s[l],h=u.length,d=o[l]=new Array(h),f,p=0;p<h;++p)(f=u[p])&&(d[p]=f);d.sort(t)}return new vi(o,this._parents).order()}function m2(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function v2(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function y2(){return Array.from(this)}function S2(){for(var e=this._groups,t=0,s=e.length;t<s;++t)for(var r=e[t],o=0,l=r.length;o<l;++o){var u=r[o];if(u)return u}return null}function b2(){let e=0;for(const t of this)++e;return e}function w2(){return!this.node()}function x2(e){for(var t=this._groups,s=0,r=t.length;s<r;++s)for(var o=t[s],l=0,u=o.length,h;l<u;++l)(h=o[l])&&e.call(h,h.__data__,l,o);return this}function C2(e){return function(){this.removeAttribute(e)}}function E2(e){return function(){this.removeAttributeNS(e.space,e.local)}}function M2(e,t){return function(){this.setAttribute(e,t)}}function k2(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function D2(e,t){return function(){var s=t.apply(this,arguments);s==null?this.removeAttribute(e):this.setAttribute(e,s)}}function T2(e,t){return function(){var s=t.apply(this,arguments);s==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,s)}}function A2(e,t){var s=Nu(e);if(arguments.length<2){var r=this.node();return s.local?r.getAttributeNS(s.space,s.local):r.getAttribute(s)}return this.each((t==null?s.local?E2:C2:typeof t=="function"?s.local?T2:D2:s.local?k2:M2)(s,t))}function VS(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function N2(e){return function(){this.style.removeProperty(e)}}function R2(e,t,s){return function(){this.style.setProperty(e,t,s)}}function B2(e,t,s){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,s)}}function L2(e,t,s){return arguments.length>1?this.each((t==null?N2:typeof t=="function"?B2:R2)(e,t,s??"")):uo(this.node(),e)}function uo(e,t){return e.style.getPropertyValue(t)||VS(e).getComputedStyle(e,null).getPropertyValue(t)}function O2(e){return function(){delete this[e]}}function z2(e,t){return function(){this[e]=t}}function H2(e,t){return function(){var s=t.apply(this,arguments);s==null?delete this[e]:this[e]=s}}function P2(e,t){return arguments.length>1?this.each((t==null?O2:typeof t=="function"?H2:z2)(e,t)):this.node()[e]}function XS(e){return e.trim().split(/^|\s+/)}function F_(e){return e.classList||new KS(e)}function KS(e){this._node=e,this._names=XS(e.getAttribute("class")||"")}KS.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function GS(e,t){for(var s=F_(e),r=-1,o=t.length;++r<o;)s.add(t[r])}function FS(e,t){for(var s=F_(e),r=-1,o=t.length;++r<o;)s.remove(t[r])}function U2(e){return function(){GS(this,e)}}function j2(e){return function(){FS(this,e)}}function I2(e,t){return function(){(t.apply(this,arguments)?GS:FS)(this,e)}}function $2(e,t){var s=XS(e+"");if(arguments.length<2){for(var r=F_(this.node()),o=-1,l=s.length;++o<l;)if(!r.contains(s[o]))return!1;return!0}return this.each((typeof t=="function"?I2:t?U2:j2)(s,t))}function q2(){this.textContent=""}function W2(e){return function(){this.textContent=e}}function Y2(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function V2(e){return arguments.length?this.each(e==null?q2:(typeof e=="function"?Y2:W2)(e)):this.node().textContent}function X2(){this.innerHTML=""}function K2(e){return function(){this.innerHTML=e}}function G2(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function F2(e){return arguments.length?this.each(e==null?X2:(typeof e=="function"?G2:K2)(e)):this.node().innerHTML}function Z2(){this.nextSibling&&this.parentNode.appendChild(this)}function Q2(){return this.each(Z2)}function J2(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function eE(){return this.each(J2)}function tE(e){var t=typeof e=="function"?e:IS(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function iE(){return null}function sE(e,t){var s=typeof e=="function"?e:IS(e),r=t==null?iE:typeof t=="function"?t:G_(t);return this.select(function(){return this.insertBefore(s.apply(this,arguments),r.apply(this,arguments)||null)})}function nE(){var e=this.parentNode;e&&e.removeChild(this)}function rE(){return this.each(nE)}function oE(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function aE(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function lE(e){return this.select(e?aE:oE)}function cE(e){return arguments.length?this.property("__data__",e):this.node().__data__}function uE(e){return function(t){e.call(this,t,this.__data__)}}function hE(e){return e.trim().split(/^|\s+/).map(function(t){var s="",r=t.indexOf(".");return r>=0&&(s=t.slice(r+1),t=t.slice(0,r)),{type:t,name:s}})}function fE(e){return function(){var t=this.__on;if(t){for(var s=0,r=-1,o=t.length,l;s<o;++s)l=t[s],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):t[++r]=l;++r?t.length=r:delete this.__on}}}function dE(e,t,s){return function(){var r=this.__on,o,l=uE(t);if(r){for(var u=0,h=r.length;u<h;++u)if((o=r[u]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=l,o.options=s),o.value=t;return}}this.addEventListener(e.type,l,s),o={type:e.type,name:e.name,value:t,listener:l,options:s},r?r.push(o):this.__on=[o]}}function _E(e,t,s){var r=hE(e+""),o,l=r.length,u;if(arguments.length<2){var h=this.node().__on;if(h){for(var d=0,f=h.length,p;d<f;++d)for(o=0,p=h[d];o<l;++o)if((u=r[o]).type===p.type&&u.name===p.name)return p.value}return}for(h=t?dE:fE,o=0;o<l;++o)this.each(h(r[o],t,s));return this}function ZS(e,t,s){var r=VS(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,s):(o=r.document.createEvent("Event"),s?(o.initEvent(t,s.bubbles,s.cancelable),o.detail=s.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function gE(e,t){return function(){return ZS(this,e,t)}}function pE(e,t){return function(){return ZS(this,e,t.apply(this,arguments))}}function mE(e,t){return this.each((typeof t=="function"?pE:gE)(e,t))}function*vE(){for(var e=this._groups,t=0,s=e.length;t<s;++t)for(var r=e[t],o=0,l=r.length,u;o<l;++o)(u=r[o])&&(yield u)}var QS=[null];function vi(e,t){this._groups=e,this._parents=t}function Fa(){return new vi([[document.documentElement]],QS)}function yE(){return this}vi.prototype=Fa.prototype={constructor:vi,select:YC,selectAll:GC,selectChild:JC,selectChildren:s2,filter:n2,data:u2,enter:r2,exit:f2,join:d2,merge:_2,selection:yE,order:g2,sort:p2,call:v2,nodes:y2,node:S2,size:b2,empty:w2,each:x2,attr:A2,style:L2,property:P2,classed:$2,text:V2,html:F2,raise:Q2,lower:eE,append:tE,insert:sE,remove:rE,clone:lE,datum:cE,on:_E,dispatch:mE,[Symbol.iterator]:vE};function mi(e){return typeof e=="string"?new vi([[document.querySelector(e)]],[document.documentElement]):new vi([[e]],QS)}function SE(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Pi(e,t){if(e=SE(e),t===void 0&&(t=e.currentTarget),t){var s=t.ownerSVGElement||t;if(s.createSVGPoint){var r=s.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const bE={passive:!1},za={capture:!0,passive:!1};function vd(e){e.stopImmediatePropagation()}function lo(e){e.preventDefault(),e.stopImmediatePropagation()}function JS(e){var t=e.document.documentElement,s=mi(e).on("dragstart.drag",lo,za);"onselectstart"in t?s.on("selectstart.drag",lo,za):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function e1(e,t){var s=e.document.documentElement,r=mi(e).on("dragstart.drag",null);t&&(r.on("click.drag",lo,za),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in s?r.on("selectstart.drag",null):(s.style.MozUserSelect=s.__noselect,delete s.__noselect)}const Ac=e=>()=>e;function Fd(e,{sourceEvent:t,subject:s,target:r,identifier:o,active:l,x:u,y:h,dx:d,dy:f,dispatch:p}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:s,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:u,enumerable:!0,configurable:!0},y:{value:h,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:f,enumerable:!0,configurable:!0},_:{value:p}})}Fd.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function wE(e){return!e.ctrlKey&&!e.button}function xE(){return this.parentNode}function CE(e,t){return t??{x:e.x,y:e.y}}function EE(){return navigator.maxTouchPoints||"ontouchstart"in this}function t1(){var e=wE,t=xE,s=CE,r=EE,o={},l=Au("start","drag","end"),u=0,h,d,f,p,m=0;function v(D){D.on("mousedown.drag",S).filter(r).on("touchstart.drag",x).on("touchmove.drag",C,bE).on("touchend.drag touchcancel.drag",A).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function S(D,H){if(!(p||!e.call(this,D,H))){var O=E(this,t.call(this,D,H),D,H,"mouse");O&&(mi(D.view).on("mousemove.drag",y,za).on("mouseup.drag",b,za),JS(D.view),vd(D),f=!1,h=D.clientX,d=D.clientY,O("start",D))}}function y(D){if(lo(D),!f){var H=D.clientX-h,O=D.clientY-d;f=H*H+O*O>m}o.mouse("drag",D)}function b(D){mi(D.view).on("mousemove.drag mouseup.drag",null),e1(D.view,f),lo(D),o.mouse("end",D)}function x(D,H){if(e.call(this,D,H)){var O=D.changedTouches,P=t.call(this,D,H),V=O.length,G,ne;for(G=0;G<V;++G)(ne=E(this,P,D,H,O[G].identifier,O[G]))&&(vd(D),ne("start",D,O[G]))}}function C(D){var H=D.changedTouches,O=H.length,P,V;for(P=0;P<O;++P)(V=o[H[P].identifier])&&(lo(D),V("drag",D,H[P]))}function A(D){var H=D.changedTouches,O=H.length,P,V;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),P=0;P<O;++P)(V=o[H[P].identifier])&&(vd(D),V("end",D,H[P]))}function E(D,H,O,P,V,G){var ne=l.copy(),X=Pi(G||O,H),$,q,N;if((N=s.call(D,new Fd("beforestart",{sourceEvent:O,target:v,identifier:V,active:u,x:X[0],y:X[1],dx:0,dy:0,dispatch:ne}),P))!=null)return $=N.x-X[0]||0,q=N.y-X[1]||0,function z(M,L,B){var j=X,Z;switch(M){case"start":o[V]=z,Z=u++;break;case"end":delete o[V],--u;case"drag":X=Pi(B||L,H),Z=u;break}ne.call(M,D,new Fd(M,{sourceEvent:L,subject:N,target:v,identifier:V,active:Z,x:X[0]+$,y:X[1]+q,dx:X[0]-j[0],dy:X[1]-j[1],dispatch:ne}),P)}}return v.filter=function(D){return arguments.length?(e=typeof D=="function"?D:Ac(!!D),v):e},v.container=function(D){return arguments.length?(t=typeof D=="function"?D:Ac(D),v):t},v.subject=function(D){return arguments.length?(s=typeof D=="function"?D:Ac(D),v):s},v.touchable=function(D){return arguments.length?(r=typeof D=="function"?D:Ac(!!D),v):r},v.on=function(){var D=l.on.apply(l,arguments);return D===l?v:D},v.clickDistance=function(D){return arguments.length?(m=(D=+D)*D,v):Math.sqrt(m)},v}function Z_(e,t,s){e.prototype=t.prototype=s,s.constructor=e}function i1(e,t){var s=Object.create(e.prototype);for(var r in t)s[r]=t[r];return s}function Za(){}var Ha=.7,cu=1/Ha,co="\\s*([+-]?\\d+)\\s*",Pa="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",es="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ME=/^#([0-9a-f]{3,8})$/,kE=new RegExp(`^rgb\\(${co},${co},${co}\\)$`),DE=new RegExp(`^rgb\\(${es},${es},${es}\\)$`),TE=new RegExp(`^rgba\\(${co},${co},${co},${Pa}\\)$`),AE=new RegExp(`^rgba\\(${es},${es},${es},${Pa}\\)$`),NE=new RegExp(`^hsl\\(${Pa},${es},${es}\\)$`),RE=new RegExp(`^hsla\\(${Pa},${es},${es},${Pa}\\)$`),bv={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Z_(Za,or,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:wv,formatHex:wv,formatHex8:BE,formatHsl:LE,formatRgb:xv,toString:xv});function wv(){return this.rgb().formatHex()}function BE(){return this.rgb().formatHex8()}function LE(){return s1(this).formatHsl()}function xv(){return this.rgb().formatRgb()}function or(e){var t,s;return e=(e+"").trim().toLowerCase(),(t=ME.exec(e))?(s=t[1].length,t=parseInt(t[1],16),s===6?Cv(t):s===3?new ri(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):s===8?Nc(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):s===4?Nc(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=kE.exec(e))?new ri(t[1],t[2],t[3],1):(t=DE.exec(e))?new ri(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=TE.exec(e))?Nc(t[1],t[2],t[3],t[4]):(t=AE.exec(e))?Nc(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=NE.exec(e))?kv(t[1],t[2]/100,t[3]/100,1):(t=RE.exec(e))?kv(t[1],t[2]/100,t[3]/100,t[4]):bv.hasOwnProperty(e)?Cv(bv[e]):e==="transparent"?new ri(NaN,NaN,NaN,0):null}function Cv(e){return new ri(e>>16&255,e>>8&255,e&255,1)}function Nc(e,t,s,r){return r<=0&&(e=t=s=NaN),new ri(e,t,s,r)}function OE(e){return e instanceof Za||(e=or(e)),e?(e=e.rgb(),new ri(e.r,e.g,e.b,e.opacity)):new ri}function Zd(e,t,s,r){return arguments.length===1?OE(e):new ri(e,t,s,r??1)}function ri(e,t,s,r){this.r=+e,this.g=+t,this.b=+s,this.opacity=+r}Z_(ri,Zd,i1(Za,{brighter(e){return e=e==null?cu:Math.pow(cu,e),new ri(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ha:Math.pow(Ha,e),new ri(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ri(sr(this.r),sr(this.g),sr(this.b),uu(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ev,formatHex:Ev,formatHex8:zE,formatRgb:Mv,toString:Mv}));function Ev(){return`#${tr(this.r)}${tr(this.g)}${tr(this.b)}`}function zE(){return`#${tr(this.r)}${tr(this.g)}${tr(this.b)}${tr((isNaN(this.opacity)?1:this.opacity)*255)}`}function Mv(){const e=uu(this.opacity);return`${e===1?"rgb(":"rgba("}${sr(this.r)}, ${sr(this.g)}, ${sr(this.b)}${e===1?")":`, ${e})`}`}function uu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function sr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function tr(e){return e=sr(e),(e<16?"0":"")+e.toString(16)}function kv(e,t,s,r){return r<=0?e=t=s=NaN:s<=0||s>=1?e=t=NaN:t<=0&&(e=NaN),new Ui(e,t,s,r)}function s1(e){if(e instanceof Ui)return new Ui(e.h,e.s,e.l,e.opacity);if(e instanceof Za||(e=or(e)),!e)return new Ui;if(e instanceof Ui)return e;e=e.rgb();var t=e.r/255,s=e.g/255,r=e.b/255,o=Math.min(t,s,r),l=Math.max(t,s,r),u=NaN,h=l-o,d=(l+o)/2;return h?(t===l?u=(s-r)/h+(s<r)*6:s===l?u=(r-t)/h+2:u=(t-s)/h+4,h/=d<.5?l+o:2-l-o,u*=60):h=d>0&&d<1?0:u,new Ui(u,h,d,e.opacity)}function HE(e,t,s,r){return arguments.length===1?s1(e):new Ui(e,t,s,r??1)}function Ui(e,t,s,r){this.h=+e,this.s=+t,this.l=+s,this.opacity=+r}Z_(Ui,HE,i1(Za,{brighter(e){return e=e==null?cu:Math.pow(cu,e),new Ui(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ha:Math.pow(Ha,e),new Ui(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,s=this.l,r=s+(s<.5?s:1-s)*t,o=2*s-r;return new ri(yd(e>=240?e-240:e+120,o,r),yd(e,o,r),yd(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new Ui(Dv(this.h),Rc(this.s),Rc(this.l),uu(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=uu(this.opacity);return`${e===1?"hsl(":"hsla("}${Dv(this.h)}, ${Rc(this.s)*100}%, ${Rc(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Dv(e){return e=(e||0)%360,e<0?e+360:e}function Rc(e){return Math.max(0,Math.min(1,e||0))}function yd(e,t,s){return(e<60?t+(s-t)*e/60:e<180?s:e<240?t+(s-t)*(240-e)/60:t)*255}const Q_=e=>()=>e;function PE(e,t){return function(s){return e+s*t}}function UE(e,t,s){return e=Math.pow(e,s),t=Math.pow(t,s)-e,s=1/s,function(r){return Math.pow(e+r*t,s)}}function jE(e){return(e=+e)==1?n1:function(t,s){return s-t?UE(t,s,e):Q_(isNaN(t)?s:t)}}function n1(e,t){var s=t-e;return s?PE(e,s):Q_(isNaN(e)?t:e)}const hu=(function e(t){var s=jE(t);function r(o,l){var u=s((o=Zd(o)).r,(l=Zd(l)).r),h=s(o.g,l.g),d=s(o.b,l.b),f=n1(o.opacity,l.opacity);return function(p){return o.r=u(p),o.g=h(p),o.b=d(p),o.opacity=f(p),o+""}}return r.gamma=e,r})(1);function IE(e,t){t||(t=[]);var s=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(l){for(o=0;o<s;++o)r[o]=e[o]*(1-l)+t[o]*l;return r}}function $E(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function qE(e,t){var s=t?t.length:0,r=e?Math.min(s,e.length):0,o=new Array(r),l=new Array(s),u;for(u=0;u<r;++u)o[u]=Ba(e[u],t[u]);for(;u<s;++u)l[u]=t[u];return function(h){for(u=0;u<r;++u)l[u]=o[u](h);return l}}function WE(e,t){var s=new Date;return e=+e,t=+t,function(r){return s.setTime(e*(1-r)+t*r),s}}function Qi(e,t){return e=+e,t=+t,function(s){return e*(1-s)+t*s}}function YE(e,t){var s={},r={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?s[o]=Ba(e[o],t[o]):r[o]=t[o];return function(l){for(o in s)r[o]=s[o](l);return r}}var Qd=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Sd=new RegExp(Qd.source,"g");function VE(e){return function(){return e}}function XE(e){return function(t){return e(t)+""}}function r1(e,t){var s=Qd.lastIndex=Sd.lastIndex=0,r,o,l,u=-1,h=[],d=[];for(e=e+"",t=t+"";(r=Qd.exec(e))&&(o=Sd.exec(t));)(l=o.index)>s&&(l=t.slice(s,l),h[u]?h[u]+=l:h[++u]=l),(r=r[0])===(o=o[0])?h[u]?h[u]+=o:h[++u]=o:(h[++u]=null,d.push({i:u,x:Qi(r,o)})),s=Sd.lastIndex;return s<t.length&&(l=t.slice(s),h[u]?h[u]+=l:h[++u]=l),h.length<2?d[0]?XE(d[0].x):VE(t):(t=d.length,function(f){for(var p=0,m;p<t;++p)h[(m=d[p]).i]=m.x(f);return h.join("")})}function Ba(e,t){var s=typeof t,r;return t==null||s==="boolean"?Q_(t):(s==="number"?Qi:s==="string"?(r=or(t))?(t=r,hu):r1:t instanceof or?hu:t instanceof Date?WE:$E(t)?IE:Array.isArray(t)?qE:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?YE:Qi)(e,t)}var Tv=180/Math.PI,Jd={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function o1(e,t,s,r,o,l){var u,h,d;return(u=Math.sqrt(e*e+t*t))&&(e/=u,t/=u),(d=e*s+t*r)&&(s-=e*d,r-=t*d),(h=Math.sqrt(s*s+r*r))&&(s/=h,r/=h,d/=h),e*r<t*s&&(e=-e,t=-t,d=-d,u=-u),{translateX:o,translateY:l,rotate:Math.atan2(t,e)*Tv,skewX:Math.atan(d)*Tv,scaleX:u,scaleY:h}}var Bc;function KE(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Jd:o1(t.a,t.b,t.c,t.d,t.e,t.f)}function GE(e){return e==null||(Bc||(Bc=document.createElementNS("http://www.w3.org/2000/svg","g")),Bc.setAttribute("transform",e),!(e=Bc.transform.baseVal.consolidate()))?Jd:(e=e.matrix,o1(e.a,e.b,e.c,e.d,e.e,e.f))}function a1(e,t,s,r){function o(f){return f.length?f.pop()+" ":""}function l(f,p,m,v,S,y){if(f!==m||p!==v){var b=S.push("translate(",null,t,null,s);y.push({i:b-4,x:Qi(f,m)},{i:b-2,x:Qi(p,v)})}else(m||v)&&S.push("translate("+m+t+v+s)}function u(f,p,m,v){f!==p?(f-p>180?p+=360:p-f>180&&(f+=360),v.push({i:m.push(o(m)+"rotate(",null,r)-2,x:Qi(f,p)})):p&&m.push(o(m)+"rotate("+p+r)}function h(f,p,m,v){f!==p?v.push({i:m.push(o(m)+"skewX(",null,r)-2,x:Qi(f,p)}):p&&m.push(o(m)+"skewX("+p+r)}function d(f,p,m,v,S,y){if(f!==m||p!==v){var b=S.push(o(S)+"scale(",null,",",null,")");y.push({i:b-4,x:Qi(f,m)},{i:b-2,x:Qi(p,v)})}else(m!==1||v!==1)&&S.push(o(S)+"scale("+m+","+v+")")}return function(f,p){var m=[],v=[];return f=e(f),p=e(p),l(f.translateX,f.translateY,p.translateX,p.translateY,m,v),u(f.rotate,p.rotate,m,v),h(f.skewX,p.skewX,m,v),d(f.scaleX,f.scaleY,p.scaleX,p.scaleY,m,v),f=p=null,function(S){for(var y=-1,b=v.length,x;++y<b;)m[(x=v[y]).i]=x.x(S);return m.join("")}}}var FE=a1(KE,"px, ","px)","deg)"),ZE=a1(GE,", ",")",")"),QE=1e-12;function Av(e){return((e=Math.exp(e))+1/e)/2}function JE(e){return((e=Math.exp(e))-1/e)/2}function eM(e){return((e=Math.exp(2*e))-1)/(e+1)}const Gc=(function e(t,s,r){function o(l,u){var h=l[0],d=l[1],f=l[2],p=u[0],m=u[1],v=u[2],S=p-h,y=m-d,b=S*S+y*y,x,C;if(b<QE)C=Math.log(v/f)/t,x=function(P){return[h+P*S,d+P*y,f*Math.exp(t*P*C)]};else{var A=Math.sqrt(b),E=(v*v-f*f+r*b)/(2*f*s*A),D=(v*v-f*f-r*b)/(2*v*s*A),H=Math.log(Math.sqrt(E*E+1)-E),O=Math.log(Math.sqrt(D*D+1)-D);C=(O-H)/t,x=function(P){var V=P*C,G=Av(H),ne=f/(s*A)*(G*eM(t*V+H)-JE(H));return[h+ne*S,d+ne*y,f*G/Av(t*V+H)]}}return x.duration=C*1e3*t/Math.SQRT2,x}return o.rho=function(l){var u=Math.max(.001,+l),h=u*u,d=h*h;return e(u,h,d)},o})(Math.SQRT2,2,4);var ho=0,Ma=0,pa=0,l1=1e3,fu,ka,du=0,ar=0,Ru=0,Ua=typeof performance=="object"&&performance.now?performance:Date,c1=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function J_(){return ar||(c1(tM),ar=Ua.now()+Ru)}function tM(){ar=0}function _u(){this._call=this._time=this._next=null}_u.prototype=u1.prototype={constructor:_u,restart:function(e,t,s){if(typeof e!="function")throw new TypeError("callback is not a function");s=(s==null?J_():+s)+(t==null?0:+t),!this._next&&ka!==this&&(ka?ka._next=this:fu=this,ka=this),this._call=e,this._time=s,e_()},stop:function(){this._call&&(this._call=null,this._time=1/0,e_())}};function u1(e,t,s){var r=new _u;return r.restart(e,t,s),r}function iM(){J_(),++ho;for(var e=fu,t;e;)(t=ar-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ho}function Nv(){ar=(du=Ua.now())+Ru,ho=Ma=0;try{iM()}finally{ho=0,nM(),ar=0}}function sM(){var e=Ua.now(),t=e-du;t>l1&&(Ru-=t,du=e)}function nM(){for(var e,t=fu,s,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(s=t._next,t._next=null,t=e?e._next=s:fu=s);ka=e,e_(r)}function e_(e){if(!ho){Ma&&(Ma=clearTimeout(Ma));var t=e-ar;t>24?(e<1/0&&(Ma=setTimeout(Nv,e-Ua.now()-Ru)),pa&&(pa=clearInterval(pa))):(pa||(du=Ua.now(),pa=setInterval(sM,l1)),ho=1,c1(Nv))}}function Rv(e,t,s){var r=new _u;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,s),r}var rM=Au("start","end","cancel","interrupt"),oM=[],h1=0,Bv=1,t_=2,Fc=3,Lv=4,i_=5,Zc=6;function Bu(e,t,s,r,o,l){var u=e.__transition;if(!u)e.__transition={};else if(s in u)return;aM(e,s,{name:t,index:r,group:o,on:rM,tween:oM,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:h1})}function eg(e,t){var s=$i(e,t);if(s.state>h1)throw new Error("too late; already scheduled");return s}function ns(e,t){var s=$i(e,t);if(s.state>Fc)throw new Error("too late; already running");return s}function $i(e,t){var s=e.__transition;if(!s||!(s=s[t]))throw new Error("transition not found");return s}function aM(e,t,s){var r=e.__transition,o;r[t]=s,s.timer=u1(l,0,s.time);function l(f){s.state=Bv,s.timer.restart(u,s.delay,s.time),s.delay<=f&&u(f-s.delay)}function u(f){var p,m,v,S;if(s.state!==Bv)return d();for(p in r)if(S=r[p],S.name===s.name){if(S.state===Fc)return Rv(u);S.state===Lv?(S.state=Zc,S.timer.stop(),S.on.call("interrupt",e,e.__data__,S.index,S.group),delete r[p]):+p<t&&(S.state=Zc,S.timer.stop(),S.on.call("cancel",e,e.__data__,S.index,S.group),delete r[p])}if(Rv(function(){s.state===Fc&&(s.state=Lv,s.timer.restart(h,s.delay,s.time),h(f))}),s.state=t_,s.on.call("start",e,e.__data__,s.index,s.group),s.state===t_){for(s.state=Fc,o=new Array(v=s.tween.length),p=0,m=-1;p<v;++p)(S=s.tween[p].value.call(e,e.__data__,s.index,s.group))&&(o[++m]=S);o.length=m+1}}function h(f){for(var p=f<s.duration?s.ease.call(null,f/s.duration):(s.timer.restart(d),s.state=i_,1),m=-1,v=o.length;++m<v;)o[m].call(e,p);s.state===i_&&(s.on.call("end",e,e.__data__,s.index,s.group),d())}function d(){s.state=Zc,s.timer.stop(),delete r[t];for(var f in r)return;delete e.__transition}}function Qc(e,t){var s=e.__transition,r,o,l=!0,u;if(s){t=t==null?null:t+"";for(u in s){if((r=s[u]).name!==t){l=!1;continue}o=r.state>t_&&r.state<i_,r.state=Zc,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete s[u]}l&&delete e.__transition}}function lM(e){return this.each(function(){Qc(this,e)})}function cM(e,t){var s,r;return function(){var o=ns(this,e),l=o.tween;if(l!==s){r=s=l;for(var u=0,h=r.length;u<h;++u)if(r[u].name===t){r=r.slice(),r.splice(u,1);break}}o.tween=r}}function uM(e,t,s){var r,o;if(typeof s!="function")throw new Error;return function(){var l=ns(this,e),u=l.tween;if(u!==r){o=(r=u).slice();for(var h={name:t,value:s},d=0,f=o.length;d<f;++d)if(o[d].name===t){o[d]=h;break}d===f&&o.push(h)}l.tween=o}}function hM(e,t){var s=this._id;if(e+="",arguments.length<2){for(var r=$i(this.node(),s).tween,o=0,l=r.length,u;o<l;++o)if((u=r[o]).name===e)return u.value;return null}return this.each((t==null?cM:uM)(s,e,t))}function tg(e,t,s){var r=e._id;return e.each(function(){var o=ns(this,r);(o.value||(o.value={}))[t]=s.apply(this,arguments)}),function(o){return $i(o,r).value[t]}}function f1(e,t){var s;return(typeof t=="number"?Qi:t instanceof or?hu:(s=or(t))?(t=s,hu):r1)(e,t)}function fM(e){return function(){this.removeAttribute(e)}}function dM(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _M(e,t,s){var r,o=s+"",l;return function(){var u=this.getAttribute(e);return u===o?null:u===r?l:l=t(r=u,s)}}function gM(e,t,s){var r,o=s+"",l;return function(){var u=this.getAttributeNS(e.space,e.local);return u===o?null:u===r?l:l=t(r=u,s)}}function pM(e,t,s){var r,o,l;return function(){var u,h=s(this),d;return h==null?void this.removeAttribute(e):(u=this.getAttribute(e),d=h+"",u===d?null:u===r&&d===o?l:(o=d,l=t(r=u,h)))}}function mM(e,t,s){var r,o,l;return function(){var u,h=s(this),d;return h==null?void this.removeAttributeNS(e.space,e.local):(u=this.getAttributeNS(e.space,e.local),d=h+"",u===d?null:u===r&&d===o?l:(o=d,l=t(r=u,h)))}}function vM(e,t){var s=Nu(e),r=s==="transform"?ZE:f1;return this.attrTween(e,typeof t=="function"?(s.local?mM:pM)(s,r,tg(this,"attr."+e,t)):t==null?(s.local?dM:fM)(s):(s.local?gM:_M)(s,r,t))}function yM(e,t){return function(s){this.setAttribute(e,t.call(this,s))}}function SM(e,t){return function(s){this.setAttributeNS(e.space,e.local,t.call(this,s))}}function bM(e,t){var s,r;function o(){var l=t.apply(this,arguments);return l!==r&&(s=(r=l)&&SM(e,l)),s}return o._value=t,o}function wM(e,t){var s,r;function o(){var l=t.apply(this,arguments);return l!==r&&(s=(r=l)&&yM(e,l)),s}return o._value=t,o}function xM(e,t){var s="attr."+e;if(arguments.length<2)return(s=this.tween(s))&&s._value;if(t==null)return this.tween(s,null);if(typeof t!="function")throw new Error;var r=Nu(e);return this.tween(s,(r.local?bM:wM)(r,t))}function CM(e,t){return function(){eg(this,e).delay=+t.apply(this,arguments)}}function EM(e,t){return t=+t,function(){eg(this,e).delay=t}}function MM(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?CM:EM)(t,e)):$i(this.node(),t).delay}function kM(e,t){return function(){ns(this,e).duration=+t.apply(this,arguments)}}function DM(e,t){return t=+t,function(){ns(this,e).duration=t}}function TM(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?kM:DM)(t,e)):$i(this.node(),t).duration}function AM(e,t){if(typeof t!="function")throw new Error;return function(){ns(this,e).ease=t}}function NM(e){var t=this._id;return arguments.length?this.each(AM(t,e)):$i(this.node(),t).ease}function RM(e,t){return function(){var s=t.apply(this,arguments);if(typeof s!="function")throw new Error;ns(this,e).ease=s}}function BM(e){if(typeof e!="function")throw new Error;return this.each(RM(this._id,e))}function LM(e){typeof e!="function"&&(e=qS(e));for(var t=this._groups,s=t.length,r=new Array(s),o=0;o<s;++o)for(var l=t[o],u=l.length,h=r[o]=[],d,f=0;f<u;++f)(d=l[f])&&e.call(d,d.__data__,f,l)&&h.push(d);return new Bs(r,this._parents,this._name,this._id)}function OM(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,s=e._groups,r=t.length,o=s.length,l=Math.min(r,o),u=new Array(r),h=0;h<l;++h)for(var d=t[h],f=s[h],p=d.length,m=u[h]=new Array(p),v,S=0;S<p;++S)(v=d[S]||f[S])&&(m[S]=v);for(;h<r;++h)u[h]=t[h];return new Bs(u,this._parents,this._name,this._id)}function zM(e){return(e+"").trim().split(/^|\s+/).every(function(t){var s=t.indexOf(".");return s>=0&&(t=t.slice(0,s)),!t||t==="start"})}function HM(e,t,s){var r,o,l=zM(t)?eg:ns;return function(){var u=l(this,e),h=u.on;h!==r&&(o=(r=h).copy()).on(t,s),u.on=o}}function PM(e,t){var s=this._id;return arguments.length<2?$i(this.node(),s).on.on(e):this.each(HM(s,e,t))}function UM(e){return function(){var t=this.parentNode;for(var s in this.__transition)if(+s!==e)return;t&&t.removeChild(this)}}function jM(){return this.on("end.remove",UM(this._id))}function IM(e){var t=this._name,s=this._id;typeof e!="function"&&(e=G_(e));for(var r=this._groups,o=r.length,l=new Array(o),u=0;u<o;++u)for(var h=r[u],d=h.length,f=l[u]=new Array(d),p,m,v=0;v<d;++v)(p=h[v])&&(m=e.call(p,p.__data__,v,h))&&("__data__"in p&&(m.__data__=p.__data__),f[v]=m,Bu(f[v],t,s,v,f,$i(p,s)));return new Bs(l,this._parents,t,s)}function $M(e){var t=this._name,s=this._id;typeof e!="function"&&(e=$S(e));for(var r=this._groups,o=r.length,l=[],u=[],h=0;h<o;++h)for(var d=r[h],f=d.length,p,m=0;m<f;++m)if(p=d[m]){for(var v=e.call(p,p.__data__,m,d),S,y=$i(p,s),b=0,x=v.length;b<x;++b)(S=v[b])&&Bu(S,t,s,b,v,y);l.push(v),u.push(p)}return new Bs(l,u,t,s)}var qM=Fa.prototype.constructor;function WM(){return new qM(this._groups,this._parents)}function YM(e,t){var s,r,o;return function(){var l=uo(this,e),u=(this.style.removeProperty(e),uo(this,e));return l===u?null:l===s&&u===r?o:o=t(s=l,r=u)}}function d1(e){return function(){this.style.removeProperty(e)}}function VM(e,t,s){var r,o=s+"",l;return function(){var u=uo(this,e);return u===o?null:u===r?l:l=t(r=u,s)}}function XM(e,t,s){var r,o,l;return function(){var u=uo(this,e),h=s(this),d=h+"";return h==null&&(d=h=(this.style.removeProperty(e),uo(this,e))),u===d?null:u===r&&d===o?l:(o=d,l=t(r=u,h))}}function KM(e,t){var s,r,o,l="style."+t,u="end."+l,h;return function(){var d=ns(this,e),f=d.on,p=d.value[l]==null?h||(h=d1(t)):void 0;(f!==s||o!==p)&&(r=(s=f).copy()).on(u,o=p),d.on=r}}function GM(e,t,s){var r=(e+="")=="transform"?FE:f1;return t==null?this.styleTween(e,YM(e,r)).on("end.style."+e,d1(e)):typeof t=="function"?this.styleTween(e,XM(e,r,tg(this,"style."+e,t))).each(KM(this._id,e)):this.styleTween(e,VM(e,r,t),s).on("end.style."+e,null)}function FM(e,t,s){return function(r){this.style.setProperty(e,t.call(this,r),s)}}function ZM(e,t,s){var r,o;function l(){var u=t.apply(this,arguments);return u!==o&&(r=(o=u)&&FM(e,u,s)),r}return l._value=t,l}function QM(e,t,s){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,ZM(e,t,s??""))}function JM(e){return function(){this.textContent=e}}function ek(e){return function(){var t=e(this);this.textContent=t??""}}function tk(e){return this.tween("text",typeof e=="function"?ek(tg(this,"text",e)):JM(e==null?"":e+""))}function ik(e){return function(t){this.textContent=e.call(this,t)}}function sk(e){var t,s;function r(){var o=e.apply(this,arguments);return o!==s&&(t=(s=o)&&ik(o)),t}return r._value=e,r}function nk(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,sk(e))}function rk(){for(var e=this._name,t=this._id,s=_1(),r=this._groups,o=r.length,l=0;l<o;++l)for(var u=r[l],h=u.length,d,f=0;f<h;++f)if(d=u[f]){var p=$i(d,t);Bu(d,e,s,f,u,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new Bs(r,this._parents,e,s)}function ok(){var e,t,s=this,r=s._id,o=s.size();return new Promise(function(l,u){var h={value:u},d={value:function(){--o===0&&l()}};s.each(function(){var f=ns(this,r),p=f.on;p!==e&&(t=(e=p).copy(),t._.cancel.push(h),t._.interrupt.push(h),t._.end.push(d)),f.on=t}),o===0&&l()})}var ak=0;function Bs(e,t,s,r){this._groups=e,this._parents=t,this._name=s,this._id=r}function _1(){return++ak}var Ds=Fa.prototype;Bs.prototype={constructor:Bs,select:IM,selectAll:$M,selectChild:Ds.selectChild,selectChildren:Ds.selectChildren,filter:LM,merge:OM,selection:WM,transition:rk,call:Ds.call,nodes:Ds.nodes,node:Ds.node,size:Ds.size,empty:Ds.empty,each:Ds.each,on:PM,attr:vM,attrTween:xM,style:GM,styleTween:QM,text:tk,textTween:nk,remove:jM,tween:hM,delay:MM,duration:TM,ease:NM,easeVarying:BM,end:ok,[Symbol.iterator]:Ds[Symbol.iterator]};function lk(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var ck={time:null,delay:0,duration:250,ease:lk};function uk(e,t){for(var s;!(s=e.__transition)||!(s=s[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return s}function hk(e){var t,s;e instanceof Bs?(t=e._id,e=e._name):(t=_1(),(s=ck).time=J_(),e=e==null?null:e+"");for(var r=this._groups,o=r.length,l=0;l<o;++l)for(var u=r[l],h=u.length,d,f=0;f<h;++f)(d=u[f])&&Bu(d,e,t,f,u,s||uk(d,t));return new Bs(r,this._parents,e,t)}Fa.prototype.interrupt=lM;Fa.prototype.transition=hk;const Lc=e=>()=>e;function fk(e,{sourceEvent:t,target:s,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function As(e,t,s){this.k=e,this.x=t,this.y=s}As.prototype={constructor:As,scale:function(e){return e===1?this:new As(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new As(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Lu=new As(1,0,0);g1.prototype=As.prototype;function g1(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Lu;return e.__zoom}function bd(e){e.stopImmediatePropagation()}function ma(e){e.preventDefault(),e.stopImmediatePropagation()}function dk(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function _k(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Ov(){return this.__zoom||Lu}function gk(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function pk(){return navigator.maxTouchPoints||"ontouchstart"in this}function mk(e,t,s){var r=e.invertX(t[0][0])-s[0][0],o=e.invertX(t[1][0])-s[1][0],l=e.invertY(t[0][1])-s[0][1],u=e.invertY(t[1][1])-s[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),u>l?(l+u)/2:Math.min(0,l)||Math.max(0,u))}function p1(){var e=dk,t=_k,s=mk,r=gk,o=pk,l=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],h=250,d=Gc,f=Au("start","zoom","end"),p,m,v,S=500,y=150,b=0,x=10;function C(N){N.property("__zoom",Ov).on("wheel.zoom",V,{passive:!1}).on("mousedown.zoom",G).on("dblclick.zoom",ne).filter(o).on("touchstart.zoom",X).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",q).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}C.transform=function(N,z,M,L){var B=N.selection?N.selection():N;B.property("__zoom",Ov),N!==B?H(N,z,M,L):B.interrupt().each(function(){O(this,arguments).event(L).start().zoom(null,typeof z=="function"?z.apply(this,arguments):z).end()})},C.scaleBy=function(N,z,M,L){C.scaleTo(N,function(){var B=this.__zoom.k,j=typeof z=="function"?z.apply(this,arguments):z;return B*j},M,L)},C.scaleTo=function(N,z,M,L){C.transform(N,function(){var B=t.apply(this,arguments),j=this.__zoom,Z=M==null?D(B):typeof M=="function"?M.apply(this,arguments):M,R=j.invert(Z),W=typeof z=="function"?z.apply(this,arguments):z;return s(E(A(j,W),Z,R),B,u)},M,L)},C.translateBy=function(N,z,M,L){C.transform(N,function(){return s(this.__zoom.translate(typeof z=="function"?z.apply(this,arguments):z,typeof M=="function"?M.apply(this,arguments):M),t.apply(this,arguments),u)},null,L)},C.translateTo=function(N,z,M,L,B){C.transform(N,function(){var j=t.apply(this,arguments),Z=this.__zoom,R=L==null?D(j):typeof L=="function"?L.apply(this,arguments):L;return s(Lu.translate(R[0],R[1]).scale(Z.k).translate(typeof z=="function"?-z.apply(this,arguments):-z,typeof M=="function"?-M.apply(this,arguments):-M),j,u)},L,B)};function A(N,z){return z=Math.max(l[0],Math.min(l[1],z)),z===N.k?N:new As(z,N.x,N.y)}function E(N,z,M){var L=z[0]-M[0]*N.k,B=z[1]-M[1]*N.k;return L===N.x&&B===N.y?N:new As(N.k,L,B)}function D(N){return[(+N[0][0]+ +N[1][0])/2,(+N[0][1]+ +N[1][1])/2]}function H(N,z,M,L){N.on("start.zoom",function(){O(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){O(this,arguments).event(L).end()}).tween("zoom",function(){var B=this,j=arguments,Z=O(B,j).event(L),R=t.apply(B,j),W=M==null?D(R):typeof M=="function"?M.apply(B,j):M,ee=Math.max(R[1][0]-R[0][0],R[1][1]-R[0][1]),te=B.__zoom,le=typeof z=="function"?z.apply(B,j):z,ce=d(te.invert(W).concat(ee/te.k),le.invert(W).concat(ee/le.k));return function(he){if(he===1)he=le;else{var ue=ce(he),_e=ee/ue[2];he=new As(_e,W[0]-ue[0]*_e,W[1]-ue[1]*_e)}Z.zoom(null,he)}})}function O(N,z,M){return!M&&N.__zooming||new P(N,z)}function P(N,z){this.that=N,this.args=z,this.active=0,this.sourceEvent=null,this.extent=t.apply(N,z),this.taps=0}P.prototype={event:function(N){return N&&(this.sourceEvent=N),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(N,z){return this.mouse&&N!=="mouse"&&(this.mouse[1]=z.invert(this.mouse[0])),this.touch0&&N!=="touch"&&(this.touch0[1]=z.invert(this.touch0[0])),this.touch1&&N!=="touch"&&(this.touch1[1]=z.invert(this.touch1[0])),this.that.__zoom=z,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(N){var z=mi(this.that).datum();f.call(N,this.that,new fk(N,{sourceEvent:this.sourceEvent,target:C,transform:this.that.__zoom,dispatch:f}),z)}};function V(N,...z){if(!e.apply(this,arguments))return;var M=O(this,z).event(N),L=this.__zoom,B=Math.max(l[0],Math.min(l[1],L.k*Math.pow(2,r.apply(this,arguments)))),j=Pi(N);if(M.wheel)(M.mouse[0][0]!==j[0]||M.mouse[0][1]!==j[1])&&(M.mouse[1]=L.invert(M.mouse[0]=j)),clearTimeout(M.wheel);else{if(L.k===B)return;M.mouse=[j,L.invert(j)],Qc(this),M.start()}ma(N),M.wheel=setTimeout(Z,y),M.zoom("mouse",s(E(A(L,B),M.mouse[0],M.mouse[1]),M.extent,u));function Z(){M.wheel=null,M.end()}}function G(N,...z){if(v||!e.apply(this,arguments))return;var M=N.currentTarget,L=O(this,z,!0).event(N),B=mi(N.view).on("mousemove.zoom",W,!0).on("mouseup.zoom",ee,!0),j=Pi(N,M),Z=N.clientX,R=N.clientY;JS(N.view),bd(N),L.mouse=[j,this.__zoom.invert(j)],Qc(this),L.start();function W(te){if(ma(te),!L.moved){var le=te.clientX-Z,ce=te.clientY-R;L.moved=le*le+ce*ce>b}L.event(te).zoom("mouse",s(E(L.that.__zoom,L.mouse[0]=Pi(te,M),L.mouse[1]),L.extent,u))}function ee(te){B.on("mousemove.zoom mouseup.zoom",null),e1(te.view,L.moved),ma(te),L.event(te).end()}}function ne(N,...z){if(e.apply(this,arguments)){var M=this.__zoom,L=Pi(N.changedTouches?N.changedTouches[0]:N,this),B=M.invert(L),j=M.k*(N.shiftKey?.5:2),Z=s(E(A(M,j),L,B),t.apply(this,z),u);ma(N),h>0?mi(this).transition().duration(h).call(H,Z,L,N):mi(this).call(C.transform,Z,L,N)}}function X(N,...z){if(e.apply(this,arguments)){var M=N.touches,L=M.length,B=O(this,z,N.changedTouches.length===L).event(N),j,Z,R,W;for(bd(N),Z=0;Z<L;++Z)R=M[Z],W=Pi(R,this),W=[W,this.__zoom.invert(W),R.identifier],B.touch0?!B.touch1&&B.touch0[2]!==W[2]&&(B.touch1=W,B.taps=0):(B.touch0=W,j=!0,B.taps=1+!!p);p&&(p=clearTimeout(p)),j&&(B.taps<2&&(m=W[0],p=setTimeout(function(){p=null},S)),Qc(this),B.start())}}function $(N,...z){if(this.__zooming){var M=O(this,z).event(N),L=N.changedTouches,B=L.length,j,Z,R,W;for(ma(N),j=0;j<B;++j)Z=L[j],R=Pi(Z,this),M.touch0&&M.touch0[2]===Z.identifier?M.touch0[0]=R:M.touch1&&M.touch1[2]===Z.identifier&&(M.touch1[0]=R);if(Z=M.that.__zoom,M.touch1){var ee=M.touch0[0],te=M.touch0[1],le=M.touch1[0],ce=M.touch1[1],he=(he=le[0]-ee[0])*he+(he=le[1]-ee[1])*he,ue=(ue=ce[0]-te[0])*ue+(ue=ce[1]-te[1])*ue;Z=A(Z,Math.sqrt(he/ue)),R=[(ee[0]+le[0])/2,(ee[1]+le[1])/2],W=[(te[0]+ce[0])/2,(te[1]+ce[1])/2]}else if(M.touch0)R=M.touch0[0],W=M.touch0[1];else return;M.zoom("touch",s(E(Z,R,W),M.extent,u))}}function q(N,...z){if(this.__zooming){var M=O(this,z).event(N),L=N.changedTouches,B=L.length,j,Z;for(bd(N),v&&clearTimeout(v),v=setTimeout(function(){v=null},S),j=0;j<B;++j)Z=L[j],M.touch0&&M.touch0[2]===Z.identifier?delete M.touch0:M.touch1&&M.touch1[2]===Z.identifier&&delete M.touch1;if(M.touch1&&!M.touch0&&(M.touch0=M.touch1,delete M.touch1),M.touch0)M.touch0[1]=this.__zoom.invert(M.touch0[0]);else if(M.end(),M.taps===2&&(Z=Pi(Z,this),Math.hypot(m[0]-Z[0],m[1]-Z[1])<x)){var R=mi(this).on("dblclick.zoom");R&&R.apply(this,arguments)}}}return C.wheelDelta=function(N){return arguments.length?(r=typeof N=="function"?N:Lc(+N),C):r},C.filter=function(N){return arguments.length?(e=typeof N=="function"?N:Lc(!!N),C):e},C.touchable=function(N){return arguments.length?(o=typeof N=="function"?N:Lc(!!N),C):o},C.extent=function(N){return arguments.length?(t=typeof N=="function"?N:Lc([[+N[0][0],+N[0][1]],[+N[1][0],+N[1][1]]]),C):t},C.scaleExtent=function(N){return arguments.length?(l[0]=+N[0],l[1]=+N[1],C):[l[0],l[1]]},C.translateExtent=function(N){return arguments.length?(u[0][0]=+N[0][0],u[1][0]=+N[1][0],u[0][1]=+N[0][1],u[1][1]=+N[1][1],C):[[u[0][0],u[0][1]],[u[1][0],u[1][1]]]},C.constrain=function(N){return arguments.length?(s=N,C):s},C.duration=function(N){return arguments.length?(h=+N,C):h},C.interpolate=function(N){return arguments.length?(d=N,C):d},C.on=function(){var N=f.on.apply(f,arguments);return N===f?C:N},C.clickDistance=function(N){return arguments.length?(b=(N=+N)*N,C):Math.sqrt(b)},C.tapDistance=function(N){return arguments.length?(x=+N,C):x},C}const is={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:s,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?s:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},ja=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],m1=["Enter"," ","Escape"],v1={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:s})=>`Moved selected node ${e}. New position, x: ${t}, y: ${s}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var fo;(function(e){e.Strict="strict",e.Loose="loose"})(fo||(fo={}));var nr;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(nr||(nr={}));var Ia;(function(e){e.Partial="partial",e.Full="full"})(Ia||(Ia={}));const y1={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Sn;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Sn||(Sn={}));var gu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(gu||(gu={}));var ye;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(ye||(ye={}));const zv={[ye.Left]:ye.Right,[ye.Right]:ye.Left,[ye.Top]:ye.Bottom,[ye.Bottom]:ye.Top};function S1(e){return e===null?null:e?"valid":"invalid"}const b1=e=>"id"in e&&"source"in e&&"target"in e,vk=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),ig=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Qa=(e,t=[0,0])=>{const{width:s,height:r}=Ls(e),o=e.origin??t,l=s*o[0],u=r*o[1];return{x:e.position.x-l,y:e.position.y-u}},yk=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const s=e.reduce((r,o)=>{const l=typeof o=="string";let u=!t.nodeLookup&&!l?o:void 0;t.nodeLookup&&(u=l?t.nodeLookup.get(o):ig(o)?o:t.nodeLookup.get(o.id));const h=u?pu(u,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Ou(r,h)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return zu(s)},Ja=(e,t={})=>{let s={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(s=Ou(s,pu(o)),r=!0)}),r?zu(s):{x:0,y:0,width:0,height:0}},sg=(e,t,[s,r,o]=[0,0,1],l=!1,u=!1)=>{const h={...tl(t,[s,r,o]),width:t.width/o,height:t.height/o},d=[];for(const f of e.values()){const{measured:p,selectable:m=!0,hidden:v=!1}=f;if(u&&!m||v)continue;const S=p.width??f.width??f.initialWidth??null,y=p.height??f.height??f.initialHeight??null,b=$a(h,go(f)),x=(S??0)*(y??0),C=l&&b>0;(!f.internals.handleBounds||C||b>=x||f.dragging)&&d.push(f)}return d},Sk=(e,t)=>{const s=new Set;return e.forEach(r=>{s.add(r.id)}),t.filter(r=>s.has(r.source)||s.has(r.target))};function bk(e,t){const s=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!o.hidden)&&(!r||r.has(o.id))&&s.set(o.id,o)}),s}async function wk({nodes:e,width:t,height:s,panZoom:r,minZoom:o,maxZoom:l},u){if(e.size===0)return Promise.resolve(!0);const h=bk(e,u),d=Ja(h),f=ng(d,t,s,(u==null?void 0:u.minZoom)??o,(u==null?void 0:u.maxZoom)??l,(u==null?void 0:u.padding)??.1);return await r.setViewport(f,{duration:u==null?void 0:u.duration,ease:u==null?void 0:u.ease,interpolate:u==null?void 0:u.interpolate}),Promise.resolve(!0)}function w1({nodeId:e,nextPosition:t,nodeLookup:s,nodeOrigin:r=[0,0],nodeExtent:o,onError:l}){const u=s.get(e),h=u.parentId?s.get(u.parentId):void 0,{x:d,y:f}=h?h.internals.positionAbsolute:{x:0,y:0},p=u.origin??r;let m=u.extent||o;if(u.extent==="parent"&&!u.expandParent)if(!h)l==null||l("005",is.error005());else{const S=h.measured.width,y=h.measured.height;S&&y&&(m=[[d,f],[d+S,f+y]])}else h&&po(u.extent)&&(m=[[u.extent[0][0]+d,u.extent[0][1]+f],[u.extent[1][0]+d,u.extent[1][1]+f]]);const v=po(m)?lr(t,m,u.measured):t;return(u.measured.width===void 0||u.measured.height===void 0)&&(l==null||l("015",is.error015())),{position:{x:v.x-d+(u.measured.width??0)*p[0],y:v.y-f+(u.measured.height??0)*p[1]},positionAbsolute:v}}async function xk({nodesToRemove:e=[],edgesToRemove:t=[],nodes:s,edges:r,onBeforeDelete:o}){const l=new Set(e.map(v=>v.id)),u=[];for(const v of s){if(v.deletable===!1)continue;const S=l.has(v.id),y=!S&&v.parentId&&u.find(b=>b.id===v.parentId);(S||y)&&u.push(v)}const h=new Set(t.map(v=>v.id)),d=r.filter(v=>v.deletable!==!1),p=Sk(u,d);for(const v of d)h.has(v.id)&&!p.find(y=>y.id===v.id)&&p.push(v);if(!o)return{edges:p,nodes:u};const m=await o({nodes:u,edges:p});return typeof m=="boolean"?m?{edges:p,nodes:u}:{edges:[],nodes:[]}:m}const _o=(e,t=0,s=1)=>Math.min(Math.max(e,t),s),lr=(e={x:0,y:0},t,s)=>({x:_o(e.x,t[0][0],t[1][0]-((s==null?void 0:s.width)??0)),y:_o(e.y,t[0][1],t[1][1]-((s==null?void 0:s.height)??0))});function x1(e,t,s){const{width:r,height:o}=Ls(s),{x:l,y:u}=s.internals.positionAbsolute;return lr(e,[[l,u],[l+r,u+o]],t)}const Hv=(e,t,s)=>e<t?_o(Math.abs(e-t),1,t)/t:e>s?-_o(Math.abs(e-s),1,t)/t:0,C1=(e,t,s=15,r=40)=>{const o=Hv(e.x,r,t.width-r)*s,l=Hv(e.y,r,t.height-r)*s;return[o,l]},Ou=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),s_=({x:e,y:t,width:s,height:r})=>({x:e,y:t,x2:e+s,y2:t+r}),zu=({x:e,y:t,x2:s,y2:r})=>({x:e,y:t,width:s-e,height:r-t}),go=(e,t=[0,0])=>{var o,l;const{x:s,y:r}=ig(e)?e.internals.positionAbsolute:Qa(e,t);return{x:s,y:r,width:((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0,height:((l=e.measured)==null?void 0:l.height)??e.height??e.initialHeight??0}},pu=(e,t=[0,0])=>{var o,l;const{x:s,y:r}=ig(e)?e.internals.positionAbsolute:Qa(e,t);return{x:s,y:r,x2:s+(((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0),y2:r+(((l=e.measured)==null?void 0:l.height)??e.height??e.initialHeight??0)}},E1=(e,t)=>zu(Ou(s_(e),s_(t))),$a=(e,t)=>{const s=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(s*r)},Pv=e=>ji(e.width)&&ji(e.height)&&ji(e.x)&&ji(e.y),ji=e=>!isNaN(e)&&isFinite(e),Ck=(e,t)=>{},el=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),tl=({x:e,y:t},[s,r,o],l=!1,u=[1,1])=>{const h={x:(e-s)/o,y:(t-r)/o};return l?el(h,u):h},mu=({x:e,y:t},[s,r,o])=>({x:e*o+s,y:t*o+r});function eo(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const s=parseFloat(e);if(!Number.isNaN(s))return Math.floor(s)}if(typeof e=="string"&&e.endsWith("%")){const s=parseFloat(e);if(!Number.isNaN(s))return Math.floor(t*s*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Ek(e,t,s){if(typeof e=="string"||typeof e=="number"){const r=eo(e,s),o=eo(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=eo(e.top??e.y??0,s),o=eo(e.bottom??e.y??0,s),l=eo(e.left??e.x??0,t),u=eo(e.right??e.x??0,t);return{top:r,right:u,bottom:o,left:l,x:l+u,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Mk(e,t,s,r,o,l){const{x:u,y:h}=mu(e,[t,s,r]),{x:d,y:f}=mu({x:e.x+e.width,y:e.y+e.height},[t,s,r]),p=o-d,m=l-f;return{left:Math.floor(u),top:Math.floor(h),right:Math.floor(p),bottom:Math.floor(m)}}const ng=(e,t,s,r,o,l)=>{const u=Ek(l,t,s),h=(t-u.x)/e.width,d=(s-u.y)/e.height,f=Math.min(h,d),p=_o(f,r,o),m=e.x+e.width/2,v=e.y+e.height/2,S=t/2-m*p,y=s/2-v*p,b=Mk(e,S,y,p,t,s),x={left:Math.min(b.left-u.left,0),top:Math.min(b.top-u.top,0),right:Math.min(b.right-u.right,0),bottom:Math.min(b.bottom-u.bottom,0)};return{x:S-x.left+x.right,y:y-x.top+x.bottom,zoom:p}},qa=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function po(e){return e!=null&&e!=="parent"}function Ls(e){var t,s;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}}function M1(e){var t,s;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight)!==void 0}function k1(e,t={width:0,height:0},s,r,o){const l={...e},u=r.get(s);if(u){const h=u.origin||o;l.x+=u.internals.positionAbsolute.x-(t.width??0)*h[0],l.y+=u.internals.positionAbsolute.y-(t.height??0)*h[1]}return l}function Uv(e,t){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}function kk(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function Dk(e){return{...v1,...e||{}}}function La(e,{snapGrid:t=[0,0],snapToGrid:s=!1,transform:r,containerBounds:o}){const{x:l,y:u}=Ii(e),h=tl({x:l-((o==null?void 0:o.left)??0),y:u-((o==null?void 0:o.top)??0)},r),{x:d,y:f}=s?el(h,t):h;return{xSnapped:d,ySnapped:f,...h}}const rg=e=>({width:e.offsetWidth,height:e.offsetHeight}),D1=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Tk=["INPUT","SELECT","TEXTAREA"];function T1(e){var r,o;const t=((o=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:o[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:Tk.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const A1=e=>"clientX"in e,Ii=(e,t)=>{var l,u;const s=A1(e),r=s?e.clientX:(l=e.touches)==null?void 0:l[0].clientX,o=s?e.clientY:(u=e.touches)==null?void 0:u[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},jv=(e,t,s,r,o)=>{const l=t.querySelectorAll(`.${e}`);return!l||!l.length?null:Array.from(l).map(u=>{const h=u.getBoundingClientRect();return{id:u.getAttribute("data-handleid"),type:e,nodeId:o,position:u.getAttribute("data-handlepos"),x:(h.left-s.left)/r,y:(h.top-s.top)/r,...rg(u)}})};function N1({sourceX:e,sourceY:t,targetX:s,targetY:r,sourceControlX:o,sourceControlY:l,targetControlX:u,targetControlY:h}){const d=e*.125+o*.375+u*.375+s*.125,f=t*.125+l*.375+h*.375+r*.125,p=Math.abs(d-e),m=Math.abs(f-t);return[d,f,p,m]}function Oc(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Iv({pos:e,x1:t,y1:s,x2:r,y2:o,c:l}){switch(e){case ye.Left:return[t-Oc(t-r,l),s];case ye.Right:return[t+Oc(r-t,l),s];case ye.Top:return[t,s-Oc(s-o,l)];case ye.Bottom:return[t,s+Oc(o-s,l)]}}function og({sourceX:e,sourceY:t,sourcePosition:s=ye.Bottom,targetX:r,targetY:o,targetPosition:l=ye.Top,curvature:u=.25}){const[h,d]=Iv({pos:s,x1:e,y1:t,x2:r,y2:o,c:u}),[f,p]=Iv({pos:l,x1:r,y1:o,x2:e,y2:t,c:u}),[m,v,S,y]=N1({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:h,sourceControlY:d,targetControlX:f,targetControlY:p});return[`M${e},${t} C${h},${d} ${f},${p} ${r},${o}`,m,v,S,y]}function R1({sourceX:e,sourceY:t,targetX:s,targetY:r}){const o=Math.abs(s-e)/2,l=s<e?s+o:s-o,u=Math.abs(r-t)/2,h=r<t?r+u:r-u;return[l,h,o,u]}function Ak({sourceNode:e,targetNode:t,selected:s=!1,zIndex:r=0,elevateOnSelect:o=!1,zIndexMode:l="basic"}){if(l==="manual")return r;const u=o&&s?r+1e3:r,h=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return u+h}function Nk({sourceNode:e,targetNode:t,width:s,height:r,transform:o}){const l=Ou(pu(e),pu(t));l.x===l.x2&&(l.x2+=1),l.y===l.y2&&(l.y2+=1);const u={x:-o[0]/o[2],y:-o[1]/o[2],width:s/o[2],height:r/o[2]};return $a(u,zu(l))>0}const Rk=({source:e,sourceHandle:t,target:s,targetHandle:r})=>`xy-edge__${e}${t||""}-${s}${r||""}`,Bk=(e,t)=>t.some(s=>s.source===e.source&&s.target===e.target&&(s.sourceHandle===e.sourceHandle||!s.sourceHandle&&!e.sourceHandle)&&(s.targetHandle===e.targetHandle||!s.targetHandle&&!e.targetHandle)),Lk=(e,t,s={})=>{if(!e.source||!e.target)return t;const r=s.getEdgeId||Rk;let o;return b1(e)?o={...e}:o={...e,id:r(e)},Bk(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function B1({sourceX:e,sourceY:t,targetX:s,targetY:r}){const[o,l,u,h]=R1({sourceX:e,sourceY:t,targetX:s,targetY:r});return[`M ${e},${t}L ${s},${r}`,o,l,u,h]}const $v={[ye.Left]:{x:-1,y:0},[ye.Right]:{x:1,y:0},[ye.Top]:{x:0,y:-1},[ye.Bottom]:{x:0,y:1}},Ok=({source:e,sourcePosition:t=ye.Bottom,target:s})=>t===ye.Left||t===ye.Right?e.x<s.x?{x:1,y:0}:{x:-1,y:0}:e.y<s.y?{x:0,y:1}:{x:0,y:-1},qv=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function zk({source:e,sourcePosition:t=ye.Bottom,target:s,targetPosition:r=ye.Top,center:o,offset:l,stepPosition:u}){const h=$v[t],d=$v[r],f={x:e.x+h.x*l,y:e.y+h.y*l},p={x:s.x+d.x*l,y:s.y+d.y*l},m=Ok({source:f,sourcePosition:t,target:p}),v=m.x!==0?"x":"y",S=m[v];let y=[],b,x;const C={x:0,y:0},A={x:0,y:0},[,,E,D]=R1({sourceX:e.x,sourceY:e.y,targetX:s.x,targetY:s.y});if(h[v]*d[v]===-1){v==="x"?(b=o.x??f.x+(p.x-f.x)*u,x=o.y??(f.y+p.y)/2):(b=o.x??(f.x+p.x)/2,x=o.y??f.y+(p.y-f.y)*u);const O=[{x:b,y:f.y},{x:b,y:p.y}],P=[{x:f.x,y:x},{x:p.x,y:x}];h[v]===S?y=v==="x"?O:P:y=v==="x"?P:O}else{const O=[{x:f.x,y:p.y}],P=[{x:p.x,y:f.y}];if(v==="x"?y=h.x===S?P:O:y=h.y===S?O:P,t===r){const $=Math.abs(e[v]-s[v]);if($<=l){const q=Math.min(l-1,l-$);h[v]===S?C[v]=(f[v]>e[v]?-1:1)*q:A[v]=(p[v]>s[v]?-1:1)*q}}if(t!==r){const $=v==="x"?"y":"x",q=h[v]===d[$],N=f[$]>p[$],z=f[$]<p[$];(h[v]===1&&(!q&&N||q&&z)||h[v]!==1&&(!q&&z||q&&N))&&(y=v==="x"?O:P)}const V={x:f.x+C.x,y:f.y+C.y},G={x:p.x+A.x,y:p.y+A.y},ne=Math.max(Math.abs(V.x-y[0].x),Math.abs(G.x-y[0].x)),X=Math.max(Math.abs(V.y-y[0].y),Math.abs(G.y-y[0].y));ne>=X?(b=(V.x+G.x)/2,x=y[0].y):(b=y[0].x,x=(V.y+G.y)/2)}return[[e,{x:f.x+C.x,y:f.y+C.y},...y,{x:p.x+A.x,y:p.y+A.y},s],b,x,E,D]}function Hk(e,t,s,r){const o=Math.min(qv(e,t)/2,qv(t,s)/2,r),{x:l,y:u}=t;if(e.x===l&&l===s.x||e.y===u&&u===s.y)return`L${l} ${u}`;if(e.y===u){const f=e.x<s.x?-1:1,p=e.y<s.y?1:-1;return`L ${l+o*f},${u}Q ${l},${u} ${l},${u+o*p}`}const h=e.x<s.x?1:-1,d=e.y<s.y?-1:1;return`L ${l},${u+o*d}Q ${l},${u} ${l+o*h},${u}`}function n_({sourceX:e,sourceY:t,sourcePosition:s=ye.Bottom,targetX:r,targetY:o,targetPosition:l=ye.Top,borderRadius:u=5,centerX:h,centerY:d,offset:f=20,stepPosition:p=.5}){const[m,v,S,y,b]=zk({source:{x:e,y:t},sourcePosition:s,target:{x:r,y:o},targetPosition:l,center:{x:h,y:d},offset:f,stepPosition:p});return[m.reduce((C,A,E)=>{let D="";return E>0&&E<m.length-1?D=Hk(m[E-1],A,m[E+1],u):D=`${E===0?"M":"L"}${A.x} ${A.y}`,C+=D,C},""),v,S,y,b]}function Wv(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Pk(e){var m;const{sourceNode:t,targetNode:s}=e;if(!Wv(t)||!Wv(s))return null;const r=t.internals.handleBounds||Yv(t.handles),o=s.internals.handleBounds||Yv(s.handles),l=Vv((r==null?void 0:r.source)??[],e.sourceHandle),u=Vv(e.connectionMode===fo.Strict?(o==null?void 0:o.target)??[]:((o==null?void 0:o.target)??[]).concat((o==null?void 0:o.source)??[]),e.targetHandle);if(!l||!u)return(m=e.onError)==null||m.call(e,"008",is.error008(l?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const h=(l==null?void 0:l.position)||ye.Bottom,d=(u==null?void 0:u.position)||ye.Top,f=cr(t,l,h),p=cr(s,u,d);return{sourceX:f.x,sourceY:f.y,targetX:p.x,targetY:p.y,sourcePosition:h,targetPosition:d}}function Yv(e){if(!e)return null;const t=[],s=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&s.push(r);return{source:t,target:s}}function cr(e,t,s=ye.Left,r=!1){const o=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,l=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:u,height:h}=t??Ls(e);if(r)return{x:o+u/2,y:l+h/2};switch((t==null?void 0:t.position)??s){case ye.Top:return{x:o+u/2,y:l};case ye.Right:return{x:o+u,y:l+h/2};case ye.Bottom:return{x:o+u/2,y:l+h};case ye.Left:return{x:o,y:l+h/2}}}function Vv(e,t){return e&&(t?e.find(s=>s.id===t):e[0])||null}function r_(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function Uk(e,{id:t,defaultColor:s,defaultMarkerStart:r,defaultMarkerEnd:o}){const l=new Set;return e.reduce((u,h)=>([h.markerStart||r,h.markerEnd||o].forEach(d=>{if(d&&typeof d=="object"){const f=r_(d,t);l.has(f)||(u.push({id:f,color:d.color||s,...d}),l.add(f))}}),u),[]).sort((u,h)=>u.id.localeCompare(h.id))}const L1=1e3,jk=10,ag={nodeOrigin:[0,0],nodeExtent:ja,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Ik={...ag,checkEquality:!0};function lg(e,t){const s={...e};for(const r in t)t[r]!==void 0&&(s[r]=t[r]);return s}function $k(e,t,s){const r=lg(ag,s);for(const o of e.values())if(o.parentId)ug(o,e,t,r);else{const l=Qa(o,r.nodeOrigin),u=po(o.extent)?o.extent:r.nodeExtent,h=lr(l,u,Ls(o));o.internals.positionAbsolute=h}}function qk(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const s=[],r=[];for(const o of e.handles){const l={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?s.push(l):o.type==="target"&&r.push(l)}return{source:s,target:r}}function cg(e){return e==="manual"}function o_(e,t,s,r={}){var f,p;const o=lg(Ik,r),l={i:0},u=new Map(t),h=o!=null&&o.elevateNodesOnSelect&&!cg(o.zIndexMode)?L1:0;let d=e.length>0;t.clear(),s.clear();for(const m of e){let v=u.get(m.id);if(o.checkEquality&&m===(v==null?void 0:v.internals.userNode))t.set(m.id,v);else{const S=Qa(m,o.nodeOrigin),y=po(m.extent)?m.extent:o.nodeExtent,b=lr(S,y,Ls(m));v={...o.defaults,...m,measured:{width:(f=m.measured)==null?void 0:f.width,height:(p=m.measured)==null?void 0:p.height},internals:{positionAbsolute:b,handleBounds:qk(m,v),z:O1(m,h,o.zIndexMode),userNode:m}},t.set(m.id,v)}(v.measured===void 0||v.measured.width===void 0||v.measured.height===void 0)&&!v.hidden&&(d=!1),m.parentId&&ug(v,t,s,r,l)}return d}function Wk(e,t){if(!e.parentId)return;const s=t.get(e.parentId);s?s.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function ug(e,t,s,r,o){const{elevateNodesOnSelect:l,nodeOrigin:u,nodeExtent:h,zIndexMode:d}=lg(ag,r),f=e.parentId,p=t.get(f);if(!p){console.warn(`Parent node ${f} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Wk(e,s),o&&!p.parentId&&p.internals.rootParentIndex===void 0&&d==="auto"&&(p.internals.rootParentIndex=++o.i,p.internals.z=p.internals.z+o.i*jk),o&&p.internals.rootParentIndex!==void 0&&(o.i=p.internals.rootParentIndex);const m=l&&!cg(d)?L1:0,{x:v,y:S,z:y}=Yk(e,p,u,h,m,d),{positionAbsolute:b}=e.internals,x=v!==b.x||S!==b.y;(x||y!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:x?{x:v,y:S}:b,z:y}})}function O1(e,t,s){const r=ji(e.zIndex)?e.zIndex:0;return cg(s)?r:r+(e.selected?t:0)}function Yk(e,t,s,r,o,l){const{x:u,y:h}=t.internals.positionAbsolute,d=Ls(e),f=Qa(e,s),p=po(e.extent)?lr(f,e.extent,d):f;let m=lr({x:u+p.x,y:h+p.y},r,d);e.extent==="parent"&&(m=x1(m,d,t));const v=O1(e,o,l),S=t.internals.z??0;return{x:m.x,y:m.y,z:S>=v?S+1:v}}function hg(e,t,s,r=[0,0]){var u;const o=[],l=new Map;for(const h of e){const d=t.get(h.parentId);if(!d)continue;const f=((u=l.get(h.parentId))==null?void 0:u.expandedRect)??go(d),p=E1(f,h.rect);l.set(h.parentId,{expandedRect:p,parent:d})}return l.size>0&&l.forEach(({expandedRect:h,parent:d},f)=>{var E;const p=d.internals.positionAbsolute,m=Ls(d),v=d.origin??r,S=h.x<p.x?Math.round(Math.abs(p.x-h.x)):0,y=h.y<p.y?Math.round(Math.abs(p.y-h.y)):0,b=Math.max(m.width,Math.round(h.width)),x=Math.max(m.height,Math.round(h.height)),C=(b-m.width)*v[0],A=(x-m.height)*v[1];(S>0||y>0||C||A)&&(o.push({id:f,type:"position",position:{x:d.position.x-S+C,y:d.position.y-y+A}}),(E=s.get(f))==null||E.forEach(D=>{e.some(H=>H.id===D.id)||o.push({id:D.id,type:"position",position:{x:D.position.x+S,y:D.position.y+y}})})),(m.width<h.width||m.height<h.height||S||y)&&o.push({id:f,type:"dimensions",setAttributes:!0,dimensions:{width:b+(S?v[0]*S-C:0),height:x+(y?v[1]*y-A:0)}})}),o}function Vk(e,t,s,r,o,l,u){const h=r==null?void 0:r.querySelector(".xyflow__viewport");let d=!1;if(!h)return{changes:[],updatedInternals:d};const f=[],p=window.getComputedStyle(h),{m22:m}=new window.DOMMatrixReadOnly(p.transform),v=[];for(const S of e.values()){const y=t.get(S.id);if(!y)continue;if(y.hidden){t.set(y.id,{...y,internals:{...y.internals,handleBounds:void 0}}),d=!0;continue}const b=rg(S.nodeElement),x=y.measured.width!==b.width||y.measured.height!==b.height;if(!!(b.width&&b.height&&(x||!y.internals.handleBounds||S.force))){const A=S.nodeElement.getBoundingClientRect(),E=po(y.extent)?y.extent:l;let{positionAbsolute:D}=y.internals;y.parentId&&y.extent==="parent"?D=x1(D,b,t.get(y.parentId)):E&&(D=lr(D,E,b));const H={...y,measured:b,internals:{...y.internals,positionAbsolute:D,handleBounds:{source:jv("source",S.nodeElement,A,m,y.id),target:jv("target",S.nodeElement,A,m,y.id)}}};t.set(y.id,H),y.parentId&&ug(H,t,s,{nodeOrigin:o,zIndexMode:u}),d=!0,x&&(f.push({id:y.id,type:"dimensions",dimensions:b}),y.expandParent&&y.parentId&&v.push({id:y.id,parentId:y.parentId,rect:go(H,o)}))}}if(v.length>0){const S=hg(v,t,s,o);f.push(...S)}return{changes:f,updatedInternals:d}}async function Xk({delta:e,panZoom:t,transform:s,translateExtent:r,width:o,height:l}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const u=await t.setViewportConstrained({x:s[0]+e.x,y:s[1]+e.y,zoom:s[2]},[[0,0],[o,l]],r),h=!!u&&(u.x!==s[0]||u.y!==s[1]||u.k!==s[2]);return Promise.resolve(h)}function Xv(e,t,s,r,o,l){let u=o;const h=r.get(u)||new Map;r.set(u,h.set(s,t)),u=`${o}-${e}`;const d=r.get(u)||new Map;if(r.set(u,d.set(s,t)),l){u=`${o}-${e}-${l}`;const f=r.get(u)||new Map;r.set(u,f.set(s,t))}}function z1(e,t,s){e.clear(),t.clear();for(const r of s){const{source:o,target:l,sourceHandle:u=null,targetHandle:h=null}=r,d={edgeId:r.id,source:o,target:l,sourceHandle:u,targetHandle:h},f=`${o}-${u}--${l}-${h}`,p=`${l}-${h}--${o}-${u}`;Xv("source",d,p,e,o,u),Xv("target",d,f,e,l,h),t.set(r.id,r)}}function H1(e,t){if(!e.parentId)return!1;const s=t.get(e.parentId);return s?s.selected?!0:H1(s,t):!1}function Kv(e,t,s){var o;let r=e;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,t))return!0;if(r===s)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Kk(e,t,s,r){const o=new Map;for(const[l,u]of e)if((u.selected||u.id===r)&&(!u.parentId||!H1(u,e))&&(u.draggable||t&&typeof u.draggable>"u")){const h=e.get(l);h&&o.set(l,{id:l,position:h.position||{x:0,y:0},distance:{x:s.x-h.internals.positionAbsolute.x,y:s.y-h.internals.positionAbsolute.y},extent:h.extent,parentId:h.parentId,origin:h.origin,expandParent:h.expandParent,internals:{positionAbsolute:h.internals.positionAbsolute||{x:0,y:0}},measured:{width:h.measured.width??0,height:h.measured.height??0}})}return o}function wd({nodeId:e,dragItems:t,nodeLookup:s,dragging:r=!0}){var u,h,d;const o=[];for(const[f,p]of t){const m=(u=s.get(f))==null?void 0:u.internals.userNode;m&&o.push({...m,position:p.position,dragging:r})}if(!e)return[o[0],o];const l=(h=s.get(e))==null?void 0:h.internals.userNode;return[l?{...l,position:((d=t.get(e))==null?void 0:d.position)||l.position,dragging:r}:o[0],o]}function Gk({dragItems:e,snapGrid:t,x:s,y:r}){const o=e.values().next().value;if(!o)return null;const l={x:s-o.distance.x,y:r-o.distance.y},u=el(l,t);return{x:u.x-l.x,y:u.y-l.y}}function Fk({onNodeMouseDown:e,getStoreItems:t,onDragStart:s,onDrag:r,onDragStop:o}){let l={x:null,y:null},u=0,h=new Map,d=!1,f={x:0,y:0},p=null,m=!1,v=null,S=!1,y=!1,b=null;function x({noDragClassName:A,handleSelector:E,domNode:D,isSelectable:H,nodeId:O,nodeClickDistance:P=0}){v=mi(D);function V({x:$,y:q}){const{nodeLookup:N,nodeExtent:z,snapGrid:M,snapToGrid:L,nodeOrigin:B,onNodeDrag:j,onSelectionDrag:Z,onError:R,updateNodePositions:W}=t();l={x:$,y:q};let ee=!1;const te=h.size>1,le=te&&z?s_(Ja(h)):null,ce=te&&L?Gk({dragItems:h,snapGrid:M,x:$,y:q}):null;for(const[he,ue]of h){if(!N.has(he))continue;let _e={x:$-ue.distance.x,y:q-ue.distance.y};L&&(_e=ce?{x:Math.round(_e.x+ce.x),y:Math.round(_e.y+ce.y)}:el(_e,M));let Ce=null;if(te&&z&&!ue.extent&&le){const{positionAbsolute:de}=ue.internals,ke=de.x-le.x+z[0][0],$e=de.x+ue.measured.width-le.x2+z[1][0],Le=de.y-le.y+z[0][1],Et=de.y+ue.measured.height-le.y2+z[1][1];Ce=[[ke,Le],[$e,Et]]}const{position:be,positionAbsolute:me}=w1({nodeId:he,nextPosition:_e,nodeLookup:N,nodeExtent:Ce||z,nodeOrigin:B,onError:R});ee=ee||ue.position.x!==be.x||ue.position.y!==be.y,ue.position=be,ue.internals.positionAbsolute=me}if(y=y||ee,!!ee&&(W(h,!0),b&&(r||j||!O&&Z))){const[he,ue]=wd({nodeId:O,dragItems:h,nodeLookup:N});r==null||r(b,h,he,ue),j==null||j(b,he,ue),O||Z==null||Z(b,ue)}}async function G(){if(!p)return;const{transform:$,panBy:q,autoPanSpeed:N,autoPanOnNodeDrag:z}=t();if(!z){d=!1,cancelAnimationFrame(u);return}const[M,L]=C1(f,p,N);(M!==0||L!==0)&&(l.x=(l.x??0)-M/$[2],l.y=(l.y??0)-L/$[2],await q({x:M,y:L})&&V(l)),u=requestAnimationFrame(G)}function ne($){var te;const{nodeLookup:q,multiSelectionActive:N,nodesDraggable:z,transform:M,snapGrid:L,snapToGrid:B,selectNodesOnDrag:j,onNodeDragStart:Z,onSelectionDragStart:R,unselectNodesAndEdges:W}=t();m=!0,(!j||!H)&&!N&&O&&((te=q.get(O))!=null&&te.selected||W()),H&&j&&O&&(e==null||e(O));const ee=La($.sourceEvent,{transform:M,snapGrid:L,snapToGrid:B,containerBounds:p});if(l=ee,h=Kk(q,z,ee,O),h.size>0&&(s||Z||!O&&R)){const[le,ce]=wd({nodeId:O,dragItems:h,nodeLookup:q});s==null||s($.sourceEvent,h,le,ce),Z==null||Z($.sourceEvent,le,ce),O||R==null||R($.sourceEvent,ce)}}const X=t1().clickDistance(P).on("start",$=>{const{domNode:q,nodeDragThreshold:N,transform:z,snapGrid:M,snapToGrid:L}=t();p=(q==null?void 0:q.getBoundingClientRect())||null,S=!1,y=!1,b=$.sourceEvent,N===0&&ne($),l=La($.sourceEvent,{transform:z,snapGrid:M,snapToGrid:L,containerBounds:p}),f=Ii($.sourceEvent,p)}).on("drag",$=>{const{autoPanOnNodeDrag:q,transform:N,snapGrid:z,snapToGrid:M,nodeDragThreshold:L,nodeLookup:B}=t(),j=La($.sourceEvent,{transform:N,snapGrid:z,snapToGrid:M,containerBounds:p});if(b=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||O&&!B.has(O))&&(S=!0),!S){if(!d&&q&&m&&(d=!0,G()),!m){const Z=Ii($.sourceEvent,p),R=Z.x-f.x,W=Z.y-f.y;Math.sqrt(R*R+W*W)>L&&ne($)}(l.x!==j.xSnapped||l.y!==j.ySnapped)&&h&&m&&(f=Ii($.sourceEvent,p),V(j))}}).on("end",$=>{if(!(!m||S)&&(d=!1,m=!1,cancelAnimationFrame(u),h.size>0)){const{nodeLookup:q,updateNodePositions:N,onNodeDragStop:z,onSelectionDragStop:M}=t();if(y&&(N(h,!1),y=!1),o||z||!O&&M){const[L,B]=wd({nodeId:O,dragItems:h,nodeLookup:q,dragging:!1});o==null||o($.sourceEvent,h,L,B),z==null||z($.sourceEvent,L,B),O||M==null||M($.sourceEvent,B)}}}).filter($=>{const q=$.target;return!$.button&&(!A||!Kv(q,`.${A}`,D))&&(!E||Kv(q,E,D))});v.call(X)}function C(){v==null||v.on(".drag",null)}return{update:x,destroy:C}}function Zk(e,t,s){const r=[],o={x:e.x-s,y:e.y-s,width:s*2,height:s*2};for(const l of t.values())$a(o,go(l))>0&&r.push(l);return r}const Qk=250;function Jk(e,t,s,r){var h,d;let o=[],l=1/0;const u=Zk(e,s,t+Qk);for(const f of u){const p=[...((h=f.internals.handleBounds)==null?void 0:h.source)??[],...((d=f.internals.handleBounds)==null?void 0:d.target)??[]];for(const m of p){if(r.nodeId===m.nodeId&&r.type===m.type&&r.id===m.id)continue;const{x:v,y:S}=cr(f,m,m.position,!0),y=Math.sqrt(Math.pow(v-e.x,2)+Math.pow(S-e.y,2));y>t||(y<l?(o=[{...m,x:v,y:S}],l=y):y===l&&o.push({...m,x:v,y:S}))}}if(!o.length)return null;if(o.length>1){const f=r.type==="source"?"target":"source";return o.find(p=>p.type===f)??o[0]}return o[0]}function P1(e,t,s,r,o,l=!1){var f,p,m;const u=r.get(e);if(!u)return null;const h=o==="strict"?(f=u.internals.handleBounds)==null?void 0:f[t]:[...((p=u.internals.handleBounds)==null?void 0:p.source)??[],...((m=u.internals.handleBounds)==null?void 0:m.target)??[]],d=(s?h==null?void 0:h.find(v=>v.id===s):h==null?void 0:h[0])??null;return d&&l?{...d,...cr(u,d,d.position,!0)}:d}function U1(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function e3(e,t){let s=null;return t?s=!0:e&&!t&&(s=!1),s}const j1=()=>!0;function t3(e,{connectionMode:t,connectionRadius:s,handleId:r,nodeId:o,edgeUpdaterType:l,isTarget:u,domNode:h,nodeLookup:d,lib:f,autoPanOnConnect:p,flowId:m,panBy:v,cancelConnection:S,onConnectStart:y,onConnect:b,onConnectEnd:x,isValidConnection:C=j1,onReconnectEnd:A,updateConnection:E,getTransform:D,getFromHandle:H,autoPanSpeed:O,dragThreshold:P=1,handleDomNode:V}){const G=D1(e.target);let ne=0,X;const{x:$,y:q}=Ii(e),N=U1(l,V),z=h==null?void 0:h.getBoundingClientRect();let M=!1;if(!z||!N)return;const L=P1(o,N,r,d,t);if(!L)return;let B=Ii(e,z),j=!1,Z=null,R=!1,W=null;function ee(){if(!p||!z)return;const[be,me]=C1(B,z,O);v({x:be,y:me}),ne=requestAnimationFrame(ee)}const te={...L,nodeId:o,type:N,position:L.position},le=d.get(o);let he={inProgress:!0,isValid:null,from:cr(le,te,ye.Left,!0),fromHandle:te,fromPosition:te.position,fromNode:le,to:B,toHandle:null,toPosition:zv[te.position],toNode:null,pointer:B};function ue(){M=!0,E(he),y==null||y(e,{nodeId:o,handleId:r,handleType:N})}P===0&&ue();function _e(be){if(!M){const{x:Et,y:Ni}=Ii(be),oi=Et-$,Ri=Ni-q;if(!(oi*oi+Ri*Ri>P*P))return;ue()}if(!H()||!te){Ce(be);return}const me=D();B=Ii(be,z),X=Jk(tl(B,me,!1,[1,1]),s,d,te),j||(ee(),j=!0);const de=I1(be,{handle:X,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:u?"target":"source",isValidConnection:C,doc:G,lib:f,flowId:m,nodeLookup:d});W=de.handleDomNode,Z=de.connection,R=e3(!!X,de.isValid);const ke=d.get(o),$e=ke?cr(ke,te,ye.Left,!0):he.from,Le={...he,from:$e,isValid:R,to:de.toHandle&&R?mu({x:de.toHandle.x,y:de.toHandle.y},me):B,toHandle:de.toHandle,toPosition:R&&de.toHandle?de.toHandle.position:zv[te.position],toNode:de.toHandle?d.get(de.toHandle.nodeId):null,pointer:B};E(Le),he=Le}function Ce(be){if(!("touches"in be&&be.touches.length>0)){if(M){(X||W)&&Z&&R&&(b==null||b(Z));const{inProgress:me,...de}=he,ke={...de,toPosition:he.toHandle?he.toPosition:null};x==null||x(be,ke),l&&(A==null||A(be,ke))}S(),cancelAnimationFrame(ne),j=!1,R=!1,Z=null,W=null,G.removeEventListener("mousemove",_e),G.removeEventListener("mouseup",Ce),G.removeEventListener("touchmove",_e),G.removeEventListener("touchend",Ce)}}G.addEventListener("mousemove",_e),G.addEventListener("mouseup",Ce),G.addEventListener("touchmove",_e),G.addEventListener("touchend",Ce)}function I1(e,{handle:t,connectionMode:s,fromNodeId:r,fromHandleId:o,fromType:l,doc:u,lib:h,flowId:d,isValidConnection:f=j1,nodeLookup:p}){const m=l==="target",v=t?u.querySelector(`.${h}-flow__handle[data-id="${d}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:S,y}=Ii(e),b=u.elementFromPoint(S,y),x=b!=null&&b.classList.contains(`${h}-flow__handle`)?b:v,C={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){const A=U1(void 0,x),E=x.getAttribute("data-nodeid"),D=x.getAttribute("data-handleid"),H=x.classList.contains("connectable"),O=x.classList.contains("connectableend");if(!E||!A)return C;const P={source:m?E:r,sourceHandle:m?D:o,target:m?r:E,targetHandle:m?o:D};C.connection=P;const G=H&&O&&(s===fo.Strict?m&&A==="source"||!m&&A==="target":E!==r||D!==o);C.isValid=G&&f(P),C.toHandle=P1(E,A,D,p,s,!0)}return C}const a_={onPointerDown:t3,isValid:I1};function i3({domNode:e,panZoom:t,getTransform:s,getViewScale:r}){const o=mi(e);function l({translateExtent:h,width:d,height:f,zoomStep:p=1,pannable:m=!0,zoomable:v=!0,inversePan:S=!1}){const y=E=>{if(E.sourceEvent.type!=="wheel"||!t)return;const D=s(),H=E.sourceEvent.ctrlKey&&qa()?10:1,O=-E.sourceEvent.deltaY*(E.sourceEvent.deltaMode===1?.05:E.sourceEvent.deltaMode?1:.002)*p,P=D[2]*Math.pow(2,O*H);t.scaleTo(P)};let b=[0,0];const x=E=>{(E.sourceEvent.type==="mousedown"||E.sourceEvent.type==="touchstart")&&(b=[E.sourceEvent.clientX??E.sourceEvent.touches[0].clientX,E.sourceEvent.clientY??E.sourceEvent.touches[0].clientY])},C=E=>{const D=s();if(E.sourceEvent.type!=="mousemove"&&E.sourceEvent.type!=="touchmove"||!t)return;const H=[E.sourceEvent.clientX??E.sourceEvent.touches[0].clientX,E.sourceEvent.clientY??E.sourceEvent.touches[0].clientY],O=[H[0]-b[0],H[1]-b[1]];b=H;const P=r()*Math.max(D[2],Math.log(D[2]))*(S?-1:1),V={x:D[0]-O[0]*P,y:D[1]-O[1]*P},G=[[0,0],[d,f]];t.setViewportConstrained({x:V.x,y:V.y,zoom:D[2]},G,h)},A=p1().on("start",x).on("zoom",m?C:null).on("zoom.wheel",v?y:null);o.call(A,{})}function u(){o.on("zoom",null)}return{update:l,destroy:u,pointer:Pi}}const Hu=e=>({x:e.x,y:e.y,zoom:e.k}),xd=({x:e,y:t,zoom:s})=>Lu.translate(e,t).scale(s),no=(e,t)=>e.target.closest(`.${t}`),$1=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),s3=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Cd=(e,t=0,s=s3,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(s).on("end",r):e},q1=e=>{const t=e.ctrlKey&&qa()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function n3({zoomPanValues:e,noWheelClassName:t,d3Selection:s,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:l,zoomOnPinch:u,onPanZoomStart:h,onPanZoom:d,onPanZoomEnd:f}){return p=>{if(no(p,t))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const m=s.property("__zoom").k||1;if(p.ctrlKey&&u){const x=Pi(p),C=q1(p),A=m*Math.pow(2,C);r.scaleTo(s,A,x,p);return}const v=p.deltaMode===1?20:1;let S=o===nr.Vertical?0:p.deltaX*v,y=o===nr.Horizontal?0:p.deltaY*v;!qa()&&p.shiftKey&&o!==nr.Vertical&&(S=p.deltaY*v,y=0),r.translateBy(s,-(S/m)*l,-(y/m)*l,{internal:!0});const b=Hu(s.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(d==null||d(p,b),e.panScrollTimeout=setTimeout(()=>{f==null||f(p,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,h==null||h(p,b))}}function r3({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:s}){return function(r,o){const l=r.type==="wheel",u=!t&&l&&!r.ctrlKey,h=no(r,e);if(r.ctrlKey&&l&&h&&r.preventDefault(),u||h)return null;r.preventDefault(),s.call(this,r,o)}}function o3({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:s}){return r=>{var l,u,h;if((l=r.sourceEvent)!=null&&l.internal)return;const o=Hu(r.transform);e.mouseButton=((u=r.sourceEvent)==null?void 0:u.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=o,((h=r.sourceEvent)==null?void 0:h.type)==="mousedown"&&t(!0),s&&(s==null||s(r.sourceEvent,o))}}function a3({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:s,onTransformChange:r,onPanZoom:o}){return l=>{var u,h;e.usedRightMouseButton=!!(s&&$1(t,e.mouseButton??0)),(u=l.sourceEvent)!=null&&u.sync||r([l.transform.x,l.transform.y,l.transform.k]),o&&!((h=l.sourceEvent)!=null&&h.internal)&&(o==null||o(l.sourceEvent,Hu(l.transform)))}}function l3({zoomPanValues:e,panOnDrag:t,panOnScroll:s,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:l}){return u=>{var h;if(!((h=u.sourceEvent)!=null&&h.internal)&&(e.isZoomingOrPanning=!1,l&&$1(t,e.mouseButton??0)&&!e.usedRightMouseButton&&u.sourceEvent&&l(u.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const d=Hu(u.transform);e.prevViewport=d,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(u.sourceEvent,d)},s?150:0)}}}function c3({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:s,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:l,userSelectionActive:u,noWheelClassName:h,noPanClassName:d,lib:f,connectionInProgress:p}){return m=>{var x;const v=e||t,S=s&&m.ctrlKey,y=m.type==="wheel";if(m.button===1&&m.type==="mousedown"&&(no(m,`${f}-flow__node`)||no(m,`${f}-flow__edge`)))return!0;if(!r&&!v&&!o&&!l&&!s||u||p&&!y||no(m,h)&&y||no(m,d)&&(!y||o&&y&&!e)||!s&&m.ctrlKey&&y)return!1;if(!s&&m.type==="touchstart"&&((x=m.touches)==null?void 0:x.length)>1)return m.preventDefault(),!1;if(!v&&!o&&!S&&y||!r&&(m.type==="mousedown"||m.type==="touchstart")||Array.isArray(r)&&!r.includes(m.button)&&m.type==="mousedown")return!1;const b=Array.isArray(r)&&r.includes(m.button)||!m.button||m.button<=1;return(!m.ctrlKey||y)&&b}}function u3({domNode:e,minZoom:t,maxZoom:s,translateExtent:r,viewport:o,onPanZoom:l,onPanZoomStart:u,onPanZoomEnd:h,onDraggingChange:d}){const f={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect(),m=p1().scaleExtent([t,s]).translateExtent(r),v=mi(e).call(m);A({x:o.x,y:o.y,zoom:_o(o.zoom,t,s)},[[0,0],[p.width,p.height]],r);const S=v.on("wheel.zoom"),y=v.on("dblclick.zoom");m.wheelDelta(q1);function b(X,$){return v?new Promise(q=>{m==null||m.interpolate(($==null?void 0:$.interpolate)==="linear"?Ba:Gc).transform(Cd(v,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>q(!0)),X)}):Promise.resolve(!1)}function x({noWheelClassName:X,noPanClassName:$,onPaneContextMenu:q,userSelectionActive:N,panOnScroll:z,panOnDrag:M,panOnScrollMode:L,panOnScrollSpeed:B,preventScrolling:j,zoomOnPinch:Z,zoomOnScroll:R,zoomOnDoubleClick:W,zoomActivationKeyPressed:ee,lib:te,onTransformChange:le,connectionInProgress:ce,paneClickDistance:he,selectionOnDrag:ue}){N&&!f.isZoomingOrPanning&&C();const _e=z&&!ee&&!N;m.clickDistance(ue?1/0:!ji(he)||he<0?0:he);const Ce=_e?n3({zoomPanValues:f,noWheelClassName:X,d3Selection:v,d3Zoom:m,panOnScrollMode:L,panOnScrollSpeed:B,zoomOnPinch:Z,onPanZoomStart:u,onPanZoom:l,onPanZoomEnd:h}):r3({noWheelClassName:X,preventScrolling:j,d3ZoomHandler:S});if(v.on("wheel.zoom",Ce,{passive:!1}),!N){const me=o3({zoomPanValues:f,onDraggingChange:d,onPanZoomStart:u});m.on("start",me);const de=a3({zoomPanValues:f,panOnDrag:M,onPaneContextMenu:!!q,onPanZoom:l,onTransformChange:le});m.on("zoom",de);const ke=l3({zoomPanValues:f,panOnDrag:M,panOnScroll:z,onPaneContextMenu:q,onPanZoomEnd:h,onDraggingChange:d});m.on("end",ke)}const be=c3({zoomActivationKeyPressed:ee,panOnDrag:M,zoomOnScroll:R,panOnScroll:z,zoomOnDoubleClick:W,zoomOnPinch:Z,userSelectionActive:N,noPanClassName:$,noWheelClassName:X,lib:te,connectionInProgress:ce});m.filter(be),W?v.on("dblclick.zoom",y):v.on("dblclick.zoom",null)}function C(){m.on("zoom",null)}async function A(X,$,q){const N=xd(X),z=m==null?void 0:m.constrain()(N,$,q);return z&&await b(z),new Promise(M=>M(z))}async function E(X,$){const q=xd(X);return await b(q,$),new Promise(N=>N(q))}function D(X){if(v){const $=xd(X),q=v.property("__zoom");(q.k!==X.zoom||q.x!==X.x||q.y!==X.y)&&(m==null||m.transform(v,$,null,{sync:!0}))}}function H(){const X=v?g1(v.node()):{x:0,y:0,k:1};return{x:X.x,y:X.y,zoom:X.k}}function O(X,$){return v?new Promise(q=>{m==null||m.interpolate(($==null?void 0:$.interpolate)==="linear"?Ba:Gc).scaleTo(Cd(v,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>q(!0)),X)}):Promise.resolve(!1)}function P(X,$){return v?new Promise(q=>{m==null||m.interpolate(($==null?void 0:$.interpolate)==="linear"?Ba:Gc).scaleBy(Cd(v,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>q(!0)),X)}):Promise.resolve(!1)}function V(X){m==null||m.scaleExtent(X)}function G(X){m==null||m.translateExtent(X)}function ne(X){const $=!ji(X)||X<0?0:X;m==null||m.clickDistance($)}return{update:x,destroy:C,setViewport:E,setViewportConstrained:A,getViewport:H,scaleTo:O,scaleBy:P,setScaleExtent:V,setTranslateExtent:G,syncViewport:D,setClickDistance:ne}}var mo;(function(e){e.Line="line",e.Handle="handle"})(mo||(mo={}));function h3({width:e,prevWidth:t,height:s,prevHeight:r,affectsX:o,affectsY:l}){const u=e-t,h=s-r,d=[u>0?1:u<0?-1:0,h>0?1:h<0?-1:0];return u&&o&&(d[0]=d[0]*-1),h&&l&&(d[1]=d[1]*-1),d}function Gv(e){const t=e.includes("right")||e.includes("left"),s=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:s,affectsX:r,affectsY:o}}function _n(e,t){return Math.max(0,t-e)}function gn(e,t){return Math.max(0,e-t)}function zc(e,t,s){return Math.max(0,t-e,e-s)}function Fv(e,t){return e?!t:t}function f3(e,t,s,r,o,l,u,h){let{affectsX:d,affectsY:f}=t;const{isHorizontal:p,isVertical:m}=t,v=p&&m,{xSnapped:S,ySnapped:y}=s,{minWidth:b,maxWidth:x,minHeight:C,maxHeight:A}=r,{x:E,y:D,width:H,height:O,aspectRatio:P}=e;let V=Math.floor(p?S-e.pointerX:0),G=Math.floor(m?y-e.pointerY:0);const ne=H+(d?-V:V),X=O+(f?-G:G),$=-l[0]*H,q=-l[1]*O;let N=zc(ne,b,x),z=zc(X,C,A);if(u){let B=0,j=0;d&&V<0?B=_n(E+V+$,u[0][0]):!d&&V>0&&(B=gn(E+ne+$,u[1][0])),f&&G<0?j=_n(D+G+q,u[0][1]):!f&&G>0&&(j=gn(D+X+q,u[1][1])),N=Math.max(N,B),z=Math.max(z,j)}if(h){let B=0,j=0;d&&V>0?B=gn(E+V,h[0][0]):!d&&V<0&&(B=_n(E+ne,h[1][0])),f&&G>0?j=gn(D+G,h[0][1]):!f&&G<0&&(j=_n(D+X,h[1][1])),N=Math.max(N,B),z=Math.max(z,j)}if(o){if(p){const B=zc(ne/P,C,A)*P;if(N=Math.max(N,B),u){let j=0;!d&&!f||d&&!f&&v?j=gn(D+q+ne/P,u[1][1])*P:j=_n(D+q+(d?V:-V)/P,u[0][1])*P,N=Math.max(N,j)}if(h){let j=0;!d&&!f||d&&!f&&v?j=_n(D+ne/P,h[1][1])*P:j=gn(D+(d?V:-V)/P,h[0][1])*P,N=Math.max(N,j)}}if(m){const B=zc(X*P,b,x)/P;if(z=Math.max(z,B),u){let j=0;!d&&!f||f&&!d&&v?j=gn(E+X*P+$,u[1][0])/P:j=_n(E+(f?G:-G)*P+$,u[0][0])/P,z=Math.max(z,j)}if(h){let j=0;!d&&!f||f&&!d&&v?j=_n(E+X*P,h[1][0])/P:j=gn(E+(f?G:-G)*P,h[0][0])/P,z=Math.max(z,j)}}}G=G+(G<0?z:-z),V=V+(V<0?N:-N),o&&(v?ne>X*P?G=(Fv(d,f)?-V:V)/P:V=(Fv(d,f)?-G:G)*P:p?(G=V/P,f=d):(V=G*P,d=f));const M=d?E+V:E,L=f?D+G:D;return{width:H+(d?-V:V),height:O+(f?-G:G),x:l[0]*V*(d?-1:1)+M,y:l[1]*G*(f?-1:1)+L}}const W1={width:0,height:0,x:0,y:0},d3={...W1,pointerX:0,pointerY:0,aspectRatio:1};function _3(e){return[[0,0],[e.measured.width,e.measured.height]]}function g3(e,t,s){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,l=e.measured.width??0,u=e.measured.height??0,h=s[0]*l,d=s[1]*u;return[[r-h,o-d],[r+l-h,o+u-d]]}function p3({domNode:e,nodeId:t,getStoreItems:s,onChange:r,onEnd:o}){const l=mi(e);let u={controlDirection:Gv("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function h({controlPosition:f,boundaries:p,keepAspectRatio:m,resizeDirection:v,onResizeStart:S,onResize:y,onResizeEnd:b,shouldResize:x}){let C={...W1},A={...d3};u={boundaries:p,resizeDirection:v,keepAspectRatio:m,controlDirection:Gv(f)};let E,D=null,H=[],O,P,V,G=!1;const ne=t1().on("start",X=>{const{nodeLookup:$,transform:q,snapGrid:N,snapToGrid:z,nodeOrigin:M,paneDomNode:L}=s();if(E=$.get(t),!E)return;D=(L==null?void 0:L.getBoundingClientRect())??null;const{xSnapped:B,ySnapped:j}=La(X.sourceEvent,{transform:q,snapGrid:N,snapToGrid:z,containerBounds:D});C={width:E.measured.width??0,height:E.measured.height??0,x:E.position.x??0,y:E.position.y??0},A={...C,pointerX:B,pointerY:j,aspectRatio:C.width/C.height},O=void 0,E.parentId&&(E.extent==="parent"||E.expandParent)&&(O=$.get(E.parentId),P=O&&E.extent==="parent"?_3(O):void 0),H=[],V=void 0;for(const[Z,R]of $)if(R.parentId===t&&(H.push({id:Z,position:{...R.position},extent:R.extent}),R.extent==="parent"||R.expandParent)){const W=g3(R,E,R.origin??M);V?V=[[Math.min(W[0][0],V[0][0]),Math.min(W[0][1],V[0][1])],[Math.max(W[1][0],V[1][0]),Math.max(W[1][1],V[1][1])]]:V=W}S==null||S(X,{...C})}).on("drag",X=>{const{transform:$,snapGrid:q,snapToGrid:N,nodeOrigin:z}=s(),M=La(X.sourceEvent,{transform:$,snapGrid:q,snapToGrid:N,containerBounds:D}),L=[];if(!E)return;const{x:B,y:j,width:Z,height:R}=C,W={},ee=E.origin??z,{width:te,height:le,x:ce,y:he}=f3(A,u.controlDirection,M,u.boundaries,u.keepAspectRatio,ee,P,V),ue=te!==Z,_e=le!==R,Ce=ce!==B&&ue,be=he!==j&&_e;if(!Ce&&!be&&!ue&&!_e)return;if((Ce||be||ee[0]===1||ee[1]===1)&&(W.x=Ce?ce:C.x,W.y=be?he:C.y,C.x=W.x,C.y=W.y,H.length>0)){const $e=ce-B,Le=he-j;for(const Et of H)Et.position={x:Et.position.x-$e+ee[0]*(te-Z),y:Et.position.y-Le+ee[1]*(le-R)},L.push(Et)}if((ue||_e)&&(W.width=ue&&(!u.resizeDirection||u.resizeDirection==="horizontal")?te:C.width,W.height=_e&&(!u.resizeDirection||u.resizeDirection==="vertical")?le:C.height,C.width=W.width,C.height=W.height),O&&E.expandParent){const $e=ee[0]*(W.width??0);W.x&&W.x<$e&&(C.x=$e,A.x=A.x-(W.x-$e));const Le=ee[1]*(W.height??0);W.y&&W.y<Le&&(C.y=Le,A.y=A.y-(W.y-Le))}const me=h3({width:C.width,prevWidth:Z,height:C.height,prevHeight:R,affectsX:u.controlDirection.affectsX,affectsY:u.controlDirection.affectsY}),de={...C,direction:me};(x==null?void 0:x(X,de))!==!1&&(G=!0,y==null||y(X,de),r(W,L))}).on("end",X=>{G&&(b==null||b(X,{...C}),o==null||o({...C}),G=!1)});l.call(ne)}function d(){l.on(".drag",null)}return{update:h,destroy:d}}var Ed={exports:{}},Md={},kd={exports:{}},Dd={};/**
|
|
50
|
+
* @license React
|
|
51
|
+
* use-sync-external-store-shim.production.js
|
|
52
|
+
*
|
|
53
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
54
|
+
*
|
|
55
|
+
* This source code is licensed under the MIT license found in the
|
|
56
|
+
* LICENSE file in the root directory of this source tree.
|
|
57
|
+
*/var Zv;function m3(){if(Zv)return Dd;Zv=1;var e=Ga();function t(m,v){return m===v&&(m!==0||1/m===1/v)||m!==m&&v!==v}var s=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,l=e.useLayoutEffect,u=e.useDebugValue;function h(m,v){var S=v(),y=r({inst:{value:S,getSnapshot:v}}),b=y[0].inst,x=y[1];return l(function(){b.value=S,b.getSnapshot=v,d(b)&&x({inst:b})},[m,S,v]),o(function(){return d(b)&&x({inst:b}),m(function(){d(b)&&x({inst:b})})},[m]),u(S),S}function d(m){var v=m.getSnapshot;m=m.value;try{var S=v();return!s(m,S)}catch{return!0}}function f(m,v){return v()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:h;return Dd.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,Dd}var Qv;function v3(){return Qv||(Qv=1,kd.exports=m3()),kd.exports}/**
|
|
58
|
+
* @license React
|
|
59
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
60
|
+
*
|
|
61
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
62
|
+
*
|
|
63
|
+
* This source code is licensed under the MIT license found in the
|
|
64
|
+
* LICENSE file in the root directory of this source tree.
|
|
65
|
+
*/var Jv;function y3(){if(Jv)return Md;Jv=1;var e=Ga(),t=v3();function s(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var r=typeof Object.is=="function"?Object.is:s,o=t.useSyncExternalStore,l=e.useRef,u=e.useEffect,h=e.useMemo,d=e.useDebugValue;return Md.useSyncExternalStoreWithSelector=function(f,p,m,v,S){var y=l(null);if(y.current===null){var b={hasValue:!1,value:null};y.current=b}else b=y.current;y=h(function(){function C(O){if(!A){if(A=!0,E=O,O=v(O),S!==void 0&&b.hasValue){var P=b.value;if(S(P,O))return D=P}return D=O}if(P=D,r(E,O))return P;var V=v(O);return S!==void 0&&S(P,V)?(E=O,P):(E=O,D=V)}var A=!1,E,D,H=m===void 0?null:m;return[function(){return C(p())},H===null?void 0:function(){return C(H())}]},[p,m,v,S]);var x=o(f,y[0],y[1]);return u(function(){b.hasValue=!0,b.value=x},[x]),d(x),x},Md}var ey;function S3(){return ey||(ey=1,Ed.exports=y3()),Ed.exports}var b3=S3();const w3=US(b3),x3={},ty=e=>{let t;const s=new Set,r=(p,m)=>{const v=typeof p=="function"?p(t):p;if(!Object.is(v,t)){const S=t;t=m??(typeof v!="object"||v===null)?v:Object.assign({},t,v),s.forEach(y=>y(t,S))}},o=()=>t,d={setState:r,getState:o,getInitialState:()=>f,subscribe:p=>(s.add(p),()=>s.delete(p)),destroy:()=>{(x3?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),s.clear()}},f=t=e(r,o,d);return d},C3=e=>e?ty(e):ty,{useDebugValue:E3}=RC,{useSyncExternalStoreWithSelector:M3}=w3,k3=e=>e;function Y1(e,t=k3,s){const r=M3(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,s);return E3(r),r}const iy=(e,t)=>{const s=C3(e),r=(o,l=t)=>Y1(s,o,l);return Object.assign(r,s),r},D3=(e,t)=>e?iy(e,t):iy;function et(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const s=Object.keys(e);if(s.length!==Object.keys(t).length)return!1;for(const r of s)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}jS();const Pu=I.createContext(null),T3=Pu.Provider,V1=is.error001();function Pe(e,t){const s=I.useContext(Pu);if(s===null)throw new Error(V1);return Y1(s,e,t)}function it(){const e=I.useContext(Pu);if(e===null)throw new Error(V1);return I.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const sy={display:"none"},A3={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},X1="react-flow__node-desc",K1="react-flow__edge-desc",N3="react-flow__aria-live",R3=e=>e.ariaLiveMessage,B3=e=>e.ariaLabelConfig;function L3({rfId:e}){const t=Pe(R3);return T.jsx("div",{id:`${N3}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:A3,children:t})}function O3({rfId:e,disableKeyboardA11y:t}){const s=Pe(B3);return T.jsxs(T.Fragment,{children:[T.jsx("div",{id:`${X1}-${e}`,style:sy,children:t?s["node.a11yDescription.default"]:s["node.a11yDescription.keyboardDisabled"]}),T.jsx("div",{id:`${K1}-${e}`,style:sy,children:s["edge.a11yDescription.default"]}),!t&&T.jsx(L3,{rfId:e})]})}const Uu=I.forwardRef(({position:e="top-left",children:t,className:s,style:r,...o},l)=>{const u=`${e}`.split("-");return T.jsx("div",{className:yt(["react-flow__panel",s,...u]),style:r,ref:l,...o,children:t})});Uu.displayName="Panel";function z3({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:T.jsx(Uu,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:T.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const H3=e=>{const t=[],s=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&s.push(r);return{selectedNodes:t,selectedEdges:s}},Hc=e=>e.id;function P3(e,t){return et(e.selectedNodes.map(Hc),t.selectedNodes.map(Hc))&&et(e.selectedEdges.map(Hc),t.selectedEdges.map(Hc))}function U3({onSelectionChange:e}){const t=it(),{selectedNodes:s,selectedEdges:r}=Pe(H3,P3);return I.useEffect(()=>{const o={nodes:s,edges:r};e==null||e(o),t.getState().onSelectionChangeHandlers.forEach(l=>l(o))},[s,r,e]),null}const j3=e=>!!e.onSelectionChangeHandlers;function I3({onSelectionChange:e}){const t=Pe(j3);return e||t?T.jsx(U3,{onSelectionChange:e}):null}const G1=[0,0],$3={x:0,y:0,zoom:1},q3=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],ny=[...q3,"rfId"],W3=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),ry={translateExtent:ja,nodeOrigin:G1,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Y3(e){const{setNodes:t,setEdges:s,setMinZoom:r,setMaxZoom:o,setTranslateExtent:l,setNodeExtent:u,reset:h,setDefaultNodesAndEdges:d}=Pe(W3,et),f=it();I.useEffect(()=>(d(e.defaultNodes,e.defaultEdges),()=>{p.current=ry,h()}),[]);const p=I.useRef(ry);return I.useEffect(()=>{for(const m of ny){const v=e[m],S=p.current[m];v!==S&&(typeof e[m]>"u"||(m==="nodes"?t(v):m==="edges"?s(v):m==="minZoom"?r(v):m==="maxZoom"?o(v):m==="translateExtent"?l(v):m==="nodeExtent"?u(v):m==="ariaLabelConfig"?f.setState({ariaLabelConfig:Dk(v)}):m==="fitView"?f.setState({fitViewQueued:v}):m==="fitViewOptions"?f.setState({fitViewOptions:v}):f.setState({[m]:v})))}p.current=e},ny.map(m=>e[m])),null}function oy(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function V3(e){var r;const[t,s]=I.useState(e==="system"?null:e);return I.useEffect(()=>{if(e!=="system"){s(e);return}const o=oy(),l=()=>s(o!=null&&o.matches?"dark":"light");return l(),o==null||o.addEventListener("change",l),()=>{o==null||o.removeEventListener("change",l)}},[e]),t!==null?t:(r=oy())!=null&&r.matches?"dark":"light"}const ay=typeof document<"u"?document:null;function Wa(e=null,t={target:ay,actInsideInputWithModifier:!0}){const[s,r]=I.useState(!1),o=I.useRef(!1),l=I.useRef(new Set([])),[u,h]=I.useMemo(()=>{if(e!==null){const f=(Array.isArray(e)?e:[e]).filter(m=>typeof m=="string").map(m=>m.replace("+",`
|
|
66
|
+
`).replace(`
|
|
67
|
+
|
|
68
|
+
`,`
|
|
69
|
+
+`).split(`
|
|
70
|
+
`)),p=f.reduce((m,v)=>m.concat(...v),[]);return[f,p]}return[[],[]]},[e]);return I.useEffect(()=>{const d=(t==null?void 0:t.target)??ay,f=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const p=S=>{var x,C;if(o.current=S.ctrlKey||S.metaKey||S.shiftKey||S.altKey,(!o.current||o.current&&!f)&&T1(S))return!1;const b=cy(S.code,h);if(l.current.add(S[b]),ly(u,l.current,!1)){const A=((C=(x=S.composedPath)==null?void 0:x.call(S))==null?void 0:C[0])||S.target,E=(A==null?void 0:A.nodeName)==="BUTTON"||(A==null?void 0:A.nodeName)==="A";t.preventDefault!==!1&&(o.current||!E)&&S.preventDefault(),r(!0)}},m=S=>{const y=cy(S.code,h);ly(u,l.current,!0)?(r(!1),l.current.clear()):l.current.delete(S[y]),S.key==="Meta"&&l.current.clear(),o.current=!1},v=()=>{l.current.clear(),r(!1)};return d==null||d.addEventListener("keydown",p),d==null||d.addEventListener("keyup",m),window.addEventListener("blur",v),window.addEventListener("contextmenu",v),()=>{d==null||d.removeEventListener("keydown",p),d==null||d.removeEventListener("keyup",m),window.removeEventListener("blur",v),window.removeEventListener("contextmenu",v)}}},[e,r]),s}function ly(e,t,s){return e.filter(r=>s||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function cy(e,t){return t.includes(e)?"code":"key"}const X3=()=>{const e=it();return I.useMemo(()=>({zoomIn:t=>{const{panZoom:s}=e.getState();return s?s.scaleBy(1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:s}=e.getState();return s?s.scaleBy(1/1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomTo:(t,s)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration:s==null?void 0:s.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,s)=>{const{transform:[r,o,l],panZoom:u}=e.getState();return u?(await u.setViewport({x:t.x??r,y:t.y??o,zoom:t.zoom??l},s),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,s,r]=e.getState().transform;return{x:t,y:s,zoom:r}},setCenter:async(t,s,r)=>e.getState().setCenter(t,s,r),fitBounds:async(t,s)=>{const{width:r,height:o,minZoom:l,maxZoom:u,panZoom:h}=e.getState(),d=ng(t,r,o,l,u,(s==null?void 0:s.padding)??.1);return h?(await h.setViewport(d,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,s={})=>{const{transform:r,snapGrid:o,snapToGrid:l,domNode:u}=e.getState();if(!u)return t;const{x:h,y:d}=u.getBoundingClientRect(),f={x:t.x-h,y:t.y-d},p=s.snapGrid??o,m=s.snapToGrid??l;return tl(f,r,m,p)},flowToScreenPosition:t=>{const{transform:s,domNode:r}=e.getState();if(!r)return t;const{x:o,y:l}=r.getBoundingClientRect(),u=mu(t,s);return{x:u.x+o,y:u.y+l}}}),[])};function F1(e,t){const s=[],r=new Map,o=[];for(const l of e)if(l.type==="add"){o.push(l);continue}else if(l.type==="remove"||l.type==="replace")r.set(l.id,[l]);else{const u=r.get(l.id);u?u.push(l):r.set(l.id,[l])}for(const l of t){const u=r.get(l.id);if(!u){s.push(l);continue}if(u[0].type==="remove")continue;if(u[0].type==="replace"){s.push({...u[0].item});continue}const h={...l};for(const d of u)K3(d,h);s.push(h)}return o.length&&o.forEach(l=>{l.index!==void 0?s.splice(l.index,0,{...l.item}):s.push({...l.item})}),s}function K3(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function Z1(e,t){return F1(e,t)}function Q1(e,t){return F1(e,t)}function Zn(e,t){return{id:e,type:"select",selected:t}}function ro(e,t=new Set,s=!1){const r=[];for(const[o,l]of e){const u=t.has(o);!(l.selected===void 0&&!u)&&l.selected!==u&&(s&&(l.selected=u),r.push(Zn(l.id,u)))}return r}function uy({items:e=[],lookup:t}){var o;const s=[],r=new Map(e.map(l=>[l.id,l]));for(const[l,u]of e.entries()){const h=t.get(u.id),d=((o=h==null?void 0:h.internals)==null?void 0:o.userNode)??h;d!==void 0&&d!==u&&s.push({id:u.id,item:u,type:"replace"}),d===void 0&&s.push({item:u,type:"add",index:l})}for(const[l]of t)r.get(l)===void 0&&s.push({id:l,type:"remove"});return s}function hy(e){return{id:e.id,type:"remove"}}const fy=e=>vk(e),G3=e=>b1(e);function J1(e){return I.forwardRef(e)}const F3=typeof window<"u"?I.useLayoutEffect:I.useEffect;function dy(e){const[t,s]=I.useState(BigInt(0)),[r]=I.useState(()=>Z3(()=>s(o=>o+BigInt(1))));return F3(()=>{const o=r.get();o.length&&(e(o),r.reset())},[t]),r}function Z3(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:s=>{t.push(s),e()}}}const eb=I.createContext(null);function Q3({children:e}){const t=it(),s=I.useCallback(h=>{const{nodes:d=[],setNodes:f,hasDefaultNodes:p,onNodesChange:m,nodeLookup:v,fitViewQueued:S,onNodesChangeMiddlewareMap:y}=t.getState();let b=d;for(const C of h)b=typeof C=="function"?C(b):C;let x=uy({items:b,lookup:v});for(const C of y.values())x=C(x);p&&f(b),x.length>0?m==null||m(x):S&&window.requestAnimationFrame(()=>{const{fitViewQueued:C,nodes:A,setNodes:E}=t.getState();C&&E(A)})},[]),r=dy(s),o=I.useCallback(h=>{const{edges:d=[],setEdges:f,hasDefaultEdges:p,onEdgesChange:m,edgeLookup:v}=t.getState();let S=d;for(const y of h)S=typeof y=="function"?y(S):y;p?f(S):m&&m(uy({items:S,lookup:v}))},[]),l=dy(o),u=I.useMemo(()=>({nodeQueue:r,edgeQueue:l}),[]);return T.jsx(eb.Provider,{value:u,children:e})}function J3(){const e=I.useContext(eb);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const e5=e=>!!e.panZoom;function ju(){const e=X3(),t=it(),s=J3(),r=Pe(e5),o=I.useMemo(()=>{const l=m=>t.getState().nodeLookup.get(m),u=m=>{s.nodeQueue.push(m)},h=m=>{s.edgeQueue.push(m)},d=m=>{var C,A;const{nodeLookup:v,nodeOrigin:S}=t.getState(),y=fy(m)?m:v.get(m.id),b=y.parentId?k1(y.position,y.measured,y.parentId,v,S):y.position,x={...y,position:b,width:((C=y.measured)==null?void 0:C.width)??y.width,height:((A=y.measured)==null?void 0:A.height)??y.height};return go(x)},f=(m,v,S={replace:!1})=>{u(y=>y.map(b=>{if(b.id===m){const x=typeof v=="function"?v(b):v;return S.replace&&fy(x)?x:{...b,...x}}return b}))},p=(m,v,S={replace:!1})=>{h(y=>y.map(b=>{if(b.id===m){const x=typeof v=="function"?v(b):v;return S.replace&&G3(x)?x:{...b,...x}}return b}))};return{getNodes:()=>t.getState().nodes.map(m=>({...m})),getNode:m=>{var v;return(v=l(m))==null?void 0:v.internals.userNode},getInternalNode:l,getEdges:()=>{const{edges:m=[]}=t.getState();return m.map(v=>({...v}))},getEdge:m=>t.getState().edgeLookup.get(m),setNodes:u,setEdges:h,addNodes:m=>{const v=Array.isArray(m)?m:[m];s.nodeQueue.push(S=>[...S,...v])},addEdges:m=>{const v=Array.isArray(m)?m:[m];s.edgeQueue.push(S=>[...S,...v])},toObject:()=>{const{nodes:m=[],edges:v=[],transform:S}=t.getState(),[y,b,x]=S;return{nodes:m.map(C=>({...C})),edges:v.map(C=>({...C})),viewport:{x:y,y:b,zoom:x}}},deleteElements:async({nodes:m=[],edges:v=[]})=>{const{nodes:S,edges:y,onNodesDelete:b,onEdgesDelete:x,triggerNodeChanges:C,triggerEdgeChanges:A,onDelete:E,onBeforeDelete:D}=t.getState(),{nodes:H,edges:O}=await xk({nodesToRemove:m,edgesToRemove:v,nodes:S,edges:y,onBeforeDelete:D}),P=O.length>0,V=H.length>0;if(P){const G=O.map(hy);x==null||x(O),A(G)}if(V){const G=H.map(hy);b==null||b(H),C(G)}return(V||P)&&(E==null||E({nodes:H,edges:O})),{deletedNodes:H,deletedEdges:O}},getIntersectingNodes:(m,v=!0,S)=>{const y=Pv(m),b=y?m:d(m),x=S!==void 0;return b?(S||t.getState().nodes).filter(C=>{const A=t.getState().nodeLookup.get(C.id);if(A&&!y&&(C.id===m.id||!A.internals.positionAbsolute))return!1;const E=go(x?C:A),D=$a(E,b);return v&&D>0||D>=E.width*E.height||D>=b.width*b.height}):[]},isNodeIntersecting:(m,v,S=!0)=>{const b=Pv(m)?m:d(m);if(!b)return!1;const x=$a(b,v);return S&&x>0||x>=v.width*v.height||x>=b.width*b.height},updateNode:f,updateNodeData:(m,v,S={replace:!1})=>{f(m,y=>{const b=typeof v=="function"?v(y):v;return S.replace?{...y,data:b}:{...y,data:{...y.data,...b}}},S)},updateEdge:p,updateEdgeData:(m,v,S={replace:!1})=>{p(m,y=>{const b=typeof v=="function"?v(y):v;return S.replace?{...y,data:b}:{...y,data:{...y.data,...b}}},S)},getNodesBounds:m=>{const{nodeLookup:v,nodeOrigin:S}=t.getState();return yk(m,{nodeLookup:v,nodeOrigin:S})},getHandleConnections:({type:m,id:v,nodeId:S})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${S}-${m}${v?`-${v}`:""}`))==null?void 0:y.values())??[])},getNodeConnections:({type:m,handleId:v,nodeId:S})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${S}${m?v?`-${m}-${v}`:`-${m}`:""}`))==null?void 0:y.values())??[])},fitView:async m=>{const v=t.getState().fitViewResolver??kk();return t.setState({fitViewQueued:!0,fitViewOptions:m,fitViewResolver:v}),s.nodeQueue.push(S=>[...S]),v.promise}}},[]);return I.useMemo(()=>({...o,...e,viewportInitialized:r}),[r])}const _y=e=>e.selected,t5=typeof window<"u"?window:void 0;function i5({deleteKeyCode:e,multiSelectionKeyCode:t}){const s=it(),{deleteElements:r}=ju(),o=Wa(e,{actInsideInputWithModifier:!1}),l=Wa(t,{target:t5});I.useEffect(()=>{if(o){const{edges:u,nodes:h}=s.getState();r({nodes:h.filter(_y),edges:u.filter(_y)}),s.setState({nodesSelectionActive:!1})}},[o]),I.useEffect(()=>{s.setState({multiSelectionActive:l})},[l])}function s5(e){const t=it();I.useEffect(()=>{const s=()=>{var o,l,u,h;if(!e.current||!(((l=(o=e.current).checkVisibility)==null?void 0:l.call(o))??!0))return!1;const r=rg(e.current);(r.height===0||r.width===0)&&((h=(u=t.getState()).onError)==null||h.call(u,"004",is.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){s(),window.addEventListener("resize",s);const r=new ResizeObserver(()=>s());return r.observe(e.current),()=>{window.removeEventListener("resize",s),r&&e.current&&r.unobserve(e.current)}}},[])}const Iu={position:"absolute",width:"100%",height:"100%",top:0,left:0},n5=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function r5({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:s=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:l=nr.Free,zoomOnDoubleClick:u=!0,panOnDrag:h=!0,defaultViewport:d,translateExtent:f,minZoom:p,maxZoom:m,zoomActivationKeyCode:v,preventScrolling:S=!0,children:y,noWheelClassName:b,noPanClassName:x,onViewportChange:C,isControlledViewport:A,paneClickDistance:E,selectionOnDrag:D}){const H=it(),O=I.useRef(null),{userSelectionActive:P,lib:V,connectionInProgress:G}=Pe(n5,et),ne=Wa(v),X=I.useRef();s5(O);const $=I.useCallback(q=>{C==null||C({x:q[0],y:q[1],zoom:q[2]}),A||H.setState({transform:q})},[C,A]);return I.useEffect(()=>{if(O.current){X.current=u3({domNode:O.current,minZoom:p,maxZoom:m,translateExtent:f,viewport:d,onDraggingChange:M=>H.setState({paneDragging:M}),onPanZoomStart:(M,L)=>{const{onViewportChangeStart:B,onMoveStart:j}=H.getState();j==null||j(M,L),B==null||B(L)},onPanZoom:(M,L)=>{const{onViewportChange:B,onMove:j}=H.getState();j==null||j(M,L),B==null||B(L)},onPanZoomEnd:(M,L)=>{const{onViewportChangeEnd:B,onMoveEnd:j}=H.getState();j==null||j(M,L),B==null||B(L)}});const{x:q,y:N,zoom:z}=X.current.getViewport();return H.setState({panZoom:X.current,transform:[q,N,z],domNode:O.current.closest(".react-flow")}),()=>{var M;(M=X.current)==null||M.destroy()}}},[]),I.useEffect(()=>{var q;(q=X.current)==null||q.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:s,panOnScroll:r,panOnScrollSpeed:o,panOnScrollMode:l,zoomOnDoubleClick:u,panOnDrag:h,zoomActivationKeyPressed:ne,preventScrolling:S,noPanClassName:x,userSelectionActive:P,noWheelClassName:b,lib:V,onTransformChange:$,connectionInProgress:G,selectionOnDrag:D,paneClickDistance:E})},[e,t,s,r,o,l,u,h,ne,S,x,P,b,V,$,G,D,E]),T.jsx("div",{className:"react-flow__renderer",ref:O,style:Iu,children:y})}const o5=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function a5(){const{userSelectionActive:e,userSelectionRect:t}=Pe(o5,et);return e&&t?T.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Td=(e,t)=>s=>{s.target===t.current&&(e==null||e(s))},l5=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function c5({isSelecting:e,selectionKeyPressed:t,selectionMode:s=Ia.Full,panOnDrag:r,paneClickDistance:o,selectionOnDrag:l,onSelectionStart:u,onSelectionEnd:h,onPaneClick:d,onPaneContextMenu:f,onPaneScroll:p,onPaneMouseEnter:m,onPaneMouseMove:v,onPaneMouseLeave:S,children:y}){const b=it(),{userSelectionActive:x,elementsSelectable:C,dragging:A,connectionInProgress:E}=Pe(l5,et),D=C&&(e||x),H=I.useRef(null),O=I.useRef(),P=I.useRef(new Set),V=I.useRef(new Set),G=I.useRef(!1),ne=B=>{if(G.current||E){G.current=!1;return}d==null||d(B),b.getState().resetSelectedElements(),b.setState({nodesSelectionActive:!1})},X=B=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){B.preventDefault();return}f==null||f(B)},$=p?B=>p(B):void 0,q=B=>{G.current&&(B.stopPropagation(),G.current=!1)},N=B=>{var le,ce;const{domNode:j}=b.getState();if(O.current=j==null?void 0:j.getBoundingClientRect(),!O.current)return;const Z=B.target===H.current;if(!Z&&!!B.target.closest(".nokey")||!e||!(l&&Z||t)||B.button!==0||!B.isPrimary)return;(ce=(le=B.target)==null?void 0:le.setPointerCapture)==null||ce.call(le,B.pointerId),G.current=!1;const{x:ee,y:te}=Ii(B.nativeEvent,O.current);b.setState({userSelectionRect:{width:0,height:0,startX:ee,startY:te,x:ee,y:te}}),Z||(B.stopPropagation(),B.preventDefault())},z=B=>{const{userSelectionRect:j,transform:Z,nodeLookup:R,edgeLookup:W,connectionLookup:ee,triggerNodeChanges:te,triggerEdgeChanges:le,defaultEdgeOptions:ce,resetSelectedElements:he}=b.getState();if(!O.current||!j)return;const{x:ue,y:_e}=Ii(B.nativeEvent,O.current),{startX:Ce,startY:be}=j;if(!G.current){const Le=t?0:o;if(Math.hypot(ue-Ce,_e-be)<=Le)return;he(),u==null||u(B)}G.current=!0;const me={startX:Ce,startY:be,x:ue<Ce?ue:Ce,y:_e<be?_e:be,width:Math.abs(ue-Ce),height:Math.abs(_e-be)},de=P.current,ke=V.current;P.current=new Set(sg(R,me,Z,s===Ia.Partial,!0).map(Le=>Le.id)),V.current=new Set;const $e=(ce==null?void 0:ce.selectable)??!0;for(const Le of P.current){const Et=ee.get(Le);if(Et)for(const{edgeId:Ni}of Et.values()){const oi=W.get(Ni);oi&&(oi.selectable??$e)&&V.current.add(Ni)}}if(!Uv(de,P.current)){const Le=ro(R,P.current,!0);te(Le)}if(!Uv(ke,V.current)){const Le=ro(W,V.current);le(Le)}b.setState({userSelectionRect:me,userSelectionActive:!0,nodesSelectionActive:!1})},M=B=>{var j,Z;B.button===0&&((Z=(j=B.target)==null?void 0:j.releasePointerCapture)==null||Z.call(j,B.pointerId),!x&&B.target===H.current&&b.getState().userSelectionRect&&(ne==null||ne(B)),b.setState({userSelectionActive:!1,userSelectionRect:null}),G.current&&(h==null||h(B),b.setState({nodesSelectionActive:P.current.size>0})))},L=r===!0||Array.isArray(r)&&r.includes(0);return T.jsxs("div",{className:yt(["react-flow__pane",{draggable:L,dragging:A,selection:e}]),onClick:D?void 0:Td(ne,H),onContextMenu:Td(X,H),onWheel:Td($,H),onPointerEnter:D?void 0:m,onPointerMove:D?z:v,onPointerUp:D?M:void 0,onPointerDownCapture:D?N:void 0,onClickCapture:D?q:void 0,onPointerLeave:S,ref:H,style:Iu,children:[y,T.jsx(a5,{})]})}function l_({id:e,store:t,unselect:s=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:l,multiSelectionActive:u,nodeLookup:h,onError:d}=t.getState(),f=h.get(e);if(!f){d==null||d("012",is.error012(e));return}t.setState({nodesSelectionActive:!1}),f.selected?(s||f.selected&&u)&&(l({nodes:[f],edges:[]}),requestAnimationFrame(()=>{var p;return(p=r==null?void 0:r.current)==null?void 0:p.blur()})):o([e])}function tb({nodeRef:e,disabled:t=!1,noDragClassName:s,handleSelector:r,nodeId:o,isSelectable:l,nodeClickDistance:u}){const h=it(),[d,f]=I.useState(!1),p=I.useRef();return I.useEffect(()=>{p.current=Fk({getStoreItems:()=>h.getState(),onNodeMouseDown:m=>{l_({id:m,store:h,nodeRef:e})},onDragStart:()=>{f(!0)},onDragStop:()=>{f(!1)}})},[]),I.useEffect(()=>{var m,v;if(t)(m=p.current)==null||m.destroy();else if(e.current)return(v=p.current)==null||v.update({noDragClassName:s,handleSelector:r,domNode:e.current,isSelectable:l,nodeId:o,nodeClickDistance:u}),()=>{var S;(S=p.current)==null||S.destroy()}},[s,r,t,l,e,o]),d}const u5=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function ib(){const e=it();return I.useCallback(s=>{const{nodeExtent:r,snapToGrid:o,snapGrid:l,nodesDraggable:u,onError:h,updateNodePositions:d,nodeLookup:f,nodeOrigin:p}=e.getState(),m=new Map,v=u5(u),S=o?l[0]:5,y=o?l[1]:5,b=s.direction.x*S*s.factor,x=s.direction.y*y*s.factor;for(const[,C]of f){if(!v(C))continue;let A={x:C.internals.positionAbsolute.x+b,y:C.internals.positionAbsolute.y+x};o&&(A=el(A,l));const{position:E,positionAbsolute:D}=w1({nodeId:C.id,nextPosition:A,nodeLookup:f,nodeExtent:r,nodeOrigin:p,onError:h});C.position=E,C.internals.positionAbsolute=D,m.set(C.id,C)}d(m)},[])}const fg=I.createContext(null),h5=fg.Provider;fg.Consumer;const sb=()=>I.useContext(fg),f5=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),d5=(e,t,s)=>r=>{const{connectionClickStartHandle:o,connectionMode:l,connection:u}=r,{fromHandle:h,toHandle:d,isValid:f}=u,p=(d==null?void 0:d.nodeId)===e&&(d==null?void 0:d.id)===t&&(d==null?void 0:d.type)===s;return{connectingFrom:(h==null?void 0:h.nodeId)===e&&(h==null?void 0:h.id)===t&&(h==null?void 0:h.type)===s,connectingTo:p,clickConnecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===s,isPossibleEndHandle:l===fo.Strict?(h==null?void 0:h.type)!==s:e!==(h==null?void 0:h.nodeId)||t!==(h==null?void 0:h.id),connectionInProcess:!!h,clickConnectionInProcess:!!o,valid:p&&f}};function _5({type:e="source",position:t=ye.Top,isValidConnection:s,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:l=!0,id:u,onConnect:h,children:d,className:f,onMouseDown:p,onTouchStart:m,...v},S){var z,M;const y=u||null,b=e==="target",x=it(),C=sb(),{connectOnClick:A,noPanClassName:E,rfId:D}=Pe(f5,et),{connectingFrom:H,connectingTo:O,clickConnecting:P,isPossibleEndHandle:V,connectionInProcess:G,clickConnectionInProcess:ne,valid:X}=Pe(d5(C,y,e),et);C||(M=(z=x.getState()).onError)==null||M.call(z,"010",is.error010());const $=L=>{const{defaultEdgeOptions:B,onConnect:j,hasDefaultEdges:Z}=x.getState(),R={...B,...L};if(Z){const{edges:W,setEdges:ee}=x.getState();ee(Lk(R,W))}j==null||j(R),h==null||h(R)},q=L=>{if(!C)return;const B=A1(L.nativeEvent);if(o&&(B&&L.button===0||!B)){const j=x.getState();a_.onPointerDown(L.nativeEvent,{handleDomNode:L.currentTarget,autoPanOnConnect:j.autoPanOnConnect,connectionMode:j.connectionMode,connectionRadius:j.connectionRadius,domNode:j.domNode,nodeLookup:j.nodeLookup,lib:j.lib,isTarget:b,handleId:y,nodeId:C,flowId:j.rfId,panBy:j.panBy,cancelConnection:j.cancelConnection,onConnectStart:j.onConnectStart,onConnectEnd:j.onConnectEnd,updateConnection:j.updateConnection,onConnect:$,isValidConnection:s||j.isValidConnection,getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,autoPanSpeed:j.autoPanSpeed,dragThreshold:j.connectionDragThreshold})}B?p==null||p(L):m==null||m(L)},N=L=>{const{onClickConnectStart:B,onClickConnectEnd:j,connectionClickStartHandle:Z,connectionMode:R,isValidConnection:W,lib:ee,rfId:te,nodeLookup:le,connection:ce}=x.getState();if(!C||!Z&&!o)return;if(!Z){B==null||B(L.nativeEvent,{nodeId:C,handleId:y,handleType:e}),x.setState({connectionClickStartHandle:{nodeId:C,type:e,id:y}});return}const he=D1(L.target),ue=s||W,{connection:_e,isValid:Ce}=a_.isValid(L.nativeEvent,{handle:{nodeId:C,id:y,type:e},connectionMode:R,fromNodeId:Z.nodeId,fromHandleId:Z.id||null,fromType:Z.type,isValidConnection:ue,flowId:te,doc:he,lib:ee,nodeLookup:le});Ce&&_e&&$(_e);const be=structuredClone(ce);delete be.inProgress,be.toPosition=be.toHandle?be.toHandle.position:null,j==null||j(L,be),x.setState({connectionClickStartHandle:null})};return T.jsx("div",{"data-handleid":y,"data-nodeid":C,"data-handlepos":t,"data-id":`${D}-${C}-${y}-${e}`,className:yt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",E,f,{source:!b,target:b,connectable:r,connectablestart:o,connectableend:l,clickconnecting:P,connectingfrom:H,connectingto:O,valid:X,connectionindicator:r&&(!G||V)&&(G||ne?l:o)}]),onMouseDown:q,onTouchStart:q,onClick:A?N:void 0,ref:S,...v,children:d})}const xn=I.memo(J1(_5));function g5({data:e,isConnectable:t,sourcePosition:s=ye.Bottom}){return T.jsxs(T.Fragment,{children:[e==null?void 0:e.label,T.jsx(xn,{type:"source",position:s,isConnectable:t})]})}function p5({data:e,isConnectable:t,targetPosition:s=ye.Top,sourcePosition:r=ye.Bottom}){return T.jsxs(T.Fragment,{children:[T.jsx(xn,{type:"target",position:s,isConnectable:t}),e==null?void 0:e.label,T.jsx(xn,{type:"source",position:r,isConnectable:t})]})}function m5(){return null}function v5({data:e,isConnectable:t,targetPosition:s=ye.Top}){return T.jsxs(T.Fragment,{children:[T.jsx(xn,{type:"target",position:s,isConnectable:t}),e==null?void 0:e.label]})}const vu={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},gy={input:g5,default:p5,output:v5,group:m5};function y5(e){var t,s,r,o;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((s=e.style)==null?void 0:s.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((o=e.style)==null?void 0:o.height)}}const S5=e=>{const{width:t,height:s,x:r,y:o}=Ja(e.nodeLookup,{filter:l=>!!l.selected});return{width:ji(t)?t:null,height:ji(s)?s:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${o}px)`}};function b5({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:s}){const r=it(),{width:o,height:l,transformString:u,userSelectionActive:h}=Pe(S5,et),d=ib(),f=I.useRef(null);if(I.useEffect(()=>{var v;s||(v=f.current)==null||v.focus({preventScroll:!0})},[s]),tb({nodeRef:f}),h||!o||!l)return null;const p=e?v=>{const S=r.getState().nodes.filter(y=>y.selected);e(v,S)}:void 0,m=v=>{Object.prototype.hasOwnProperty.call(vu,v.key)&&(v.preventDefault(),d({direction:vu[v.key],factor:v.shiftKey?4:1}))};return T.jsx("div",{className:yt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:u},children:T.jsx("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:p,tabIndex:s?void 0:-1,onKeyDown:s?void 0:m,style:{width:o,height:l}})})}const py=typeof window<"u"?window:void 0,w5=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function nb({children:e,onPaneClick:t,onPaneMouseEnter:s,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:l,onPaneScroll:u,paneClickDistance:h,deleteKeyCode:d,selectionKeyCode:f,selectionOnDrag:p,selectionMode:m,onSelectionStart:v,onSelectionEnd:S,multiSelectionKeyCode:y,panActivationKeyCode:b,zoomActivationKeyCode:x,elementsSelectable:C,zoomOnScroll:A,zoomOnPinch:E,panOnScroll:D,panOnScrollSpeed:H,panOnScrollMode:O,zoomOnDoubleClick:P,panOnDrag:V,defaultViewport:G,translateExtent:ne,minZoom:X,maxZoom:$,preventScrolling:q,onSelectionContextMenu:N,noWheelClassName:z,noPanClassName:M,disableKeyboardA11y:L,onViewportChange:B,isControlledViewport:j}){const{nodesSelectionActive:Z,userSelectionActive:R}=Pe(w5,et),W=Wa(f,{target:py}),ee=Wa(b,{target:py}),te=ee||V,le=ee||D,ce=p&&te!==!0,he=W||R||ce;return i5({deleteKeyCode:d,multiSelectionKeyCode:y}),T.jsx(r5,{onPaneContextMenu:l,elementsSelectable:C,zoomOnScroll:A,zoomOnPinch:E,panOnScroll:le,panOnScrollSpeed:H,panOnScrollMode:O,zoomOnDoubleClick:P,panOnDrag:!W&&te,defaultViewport:G,translateExtent:ne,minZoom:X,maxZoom:$,zoomActivationKeyCode:x,preventScrolling:q,noWheelClassName:z,noPanClassName:M,onViewportChange:B,isControlledViewport:j,paneClickDistance:h,selectionOnDrag:ce,children:T.jsxs(c5,{onSelectionStart:v,onSelectionEnd:S,onPaneClick:t,onPaneMouseEnter:s,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:l,onPaneScroll:u,panOnDrag:te,isSelecting:!!he,selectionMode:m,selectionKeyPressed:W,paneClickDistance:h,selectionOnDrag:ce,children:[e,Z&&T.jsx(b5,{onSelectionContextMenu:N,noPanClassName:M,disableKeyboardA11y:L})]})})}nb.displayName="FlowRenderer";const x5=I.memo(nb),C5=e=>t=>e?sg(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(s=>s.id):Array.from(t.nodeLookup.keys());function E5(e){return Pe(I.useCallback(C5(e),[e]),et)}const M5=e=>e.updateNodeInternals;function k5(){const e=Pe(M5),[t]=I.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(s=>{const r=new Map;s.forEach(o=>{const l=o.target.getAttribute("data-id");r.set(l,{id:l,nodeElement:o.target,force:!0})}),e(r)}));return I.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function D5({node:e,nodeType:t,hasDimensions:s,resizeObserver:r}){const o=it(),l=I.useRef(null),u=I.useRef(null),h=I.useRef(e.sourcePosition),d=I.useRef(e.targetPosition),f=I.useRef(t),p=s&&!!e.internals.handleBounds;return I.useEffect(()=>{l.current&&!e.hidden&&(!p||u.current!==l.current)&&(u.current&&(r==null||r.unobserve(u.current)),r==null||r.observe(l.current),u.current=l.current)},[p,e.hidden]),I.useEffect(()=>()=>{u.current&&(r==null||r.unobserve(u.current),u.current=null)},[]),I.useEffect(()=>{if(l.current){const m=f.current!==t,v=h.current!==e.sourcePosition,S=d.current!==e.targetPosition;(m||v||S)&&(f.current=t,h.current=e.sourcePosition,d.current=e.targetPosition,o.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:l.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),l}function T5({id:e,onClick:t,onMouseEnter:s,onMouseMove:r,onMouseLeave:o,onContextMenu:l,onDoubleClick:u,nodesDraggable:h,elementsSelectable:d,nodesConnectable:f,nodesFocusable:p,resizeObserver:m,noDragClassName:v,noPanClassName:S,disableKeyboardA11y:y,rfId:b,nodeTypes:x,nodeClickDistance:C,onError:A}){const{node:E,internals:D,isParent:H}=Pe(ue=>{const _e=ue.nodeLookup.get(e),Ce=ue.parentLookup.has(e);return{node:_e,internals:_e.internals,isParent:Ce}},et);let O=E.type||"default",P=(x==null?void 0:x[O])||gy[O];P===void 0&&(A==null||A("003",is.error003(O)),O="default",P=(x==null?void 0:x.default)||gy.default);const V=!!(E.draggable||h&&typeof E.draggable>"u"),G=!!(E.selectable||d&&typeof E.selectable>"u"),ne=!!(E.connectable||f&&typeof E.connectable>"u"),X=!!(E.focusable||p&&typeof E.focusable>"u"),$=it(),q=M1(E),N=D5({node:E,nodeType:O,hasDimensions:q,resizeObserver:m}),z=tb({nodeRef:N,disabled:E.hidden||!V,noDragClassName:v,handleSelector:E.dragHandle,nodeId:e,isSelectable:G,nodeClickDistance:C}),M=ib();if(E.hidden)return null;const L=Ls(E),B=y5(E),j=G||V||t||s||r||o,Z=s?ue=>s(ue,{...D.userNode}):void 0,R=r?ue=>r(ue,{...D.userNode}):void 0,W=o?ue=>o(ue,{...D.userNode}):void 0,ee=l?ue=>l(ue,{...D.userNode}):void 0,te=u?ue=>u(ue,{...D.userNode}):void 0,le=ue=>{const{selectNodesOnDrag:_e,nodeDragThreshold:Ce}=$.getState();G&&(!_e||!V||Ce>0)&&l_({id:e,store:$,nodeRef:N}),t&&t(ue,{...D.userNode})},ce=ue=>{if(!(T1(ue.nativeEvent)||y)){if(m1.includes(ue.key)&&G){const _e=ue.key==="Escape";l_({id:e,store:$,unselect:_e,nodeRef:N})}else if(V&&E.selected&&Object.prototype.hasOwnProperty.call(vu,ue.key)){ue.preventDefault();const{ariaLabelConfig:_e}=$.getState();$.setState({ariaLiveMessage:_e["node.a11yDescription.ariaLiveMessage"]({direction:ue.key.replace("Arrow","").toLowerCase(),x:~~D.positionAbsolute.x,y:~~D.positionAbsolute.y})}),M({direction:vu[ue.key],factor:ue.shiftKey?4:1})}}},he=()=>{var ke;if(y||!((ke=N.current)!=null&&ke.matches(":focus-visible")))return;const{transform:ue,width:_e,height:Ce,autoPanOnNodeFocus:be,setCenter:me}=$.getState();if(!be)return;sg(new Map([[e,E]]),{x:0,y:0,width:_e,height:Ce},ue,!0).length>0||me(E.position.x+L.width/2,E.position.y+L.height/2,{zoom:ue[2]})};return T.jsx("div",{className:yt(["react-flow__node",`react-flow__node-${O}`,{[S]:V},E.className,{selected:E.selected,selectable:G,parent:H,draggable:V,dragging:z}]),ref:N,style:{zIndex:D.z,transform:`translate(${D.positionAbsolute.x}px,${D.positionAbsolute.y}px)`,pointerEvents:j?"all":"none",visibility:q?"visible":"hidden",...E.style,...B},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:Z,onMouseMove:R,onMouseLeave:W,onContextMenu:ee,onClick:le,onDoubleClick:te,onKeyDown:X?ce:void 0,tabIndex:X?0:void 0,onFocus:X?he:void 0,role:E.ariaRole??(X?"group":void 0),"aria-roledescription":"node","aria-describedby":y?void 0:`${X1}-${b}`,"aria-label":E.ariaLabel,...E.domAttributes,children:T.jsx(h5,{value:e,children:T.jsx(P,{id:e,data:E.data,type:O,positionAbsoluteX:D.positionAbsolute.x,positionAbsoluteY:D.positionAbsolute.y,selected:E.selected??!1,selectable:G,draggable:V,deletable:E.deletable??!0,isConnectable:ne,sourcePosition:E.sourcePosition,targetPosition:E.targetPosition,dragging:z,dragHandle:E.dragHandle,zIndex:D.z,parentId:E.parentId,...L})})})}var A5=I.memo(T5);const N5=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function rb(e){const{nodesDraggable:t,nodesConnectable:s,nodesFocusable:r,elementsSelectable:o,onError:l}=Pe(N5,et),u=E5(e.onlyRenderVisibleElements),h=k5();return T.jsx("div",{className:"react-flow__nodes",style:Iu,children:u.map(d=>T.jsx(A5,{id:d,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:h,nodesDraggable:t,nodesConnectable:s,nodesFocusable:r,elementsSelectable:o,nodeClickDistance:e.nodeClickDistance,onError:l},d))})}rb.displayName="NodeRenderer";const R5=I.memo(rb);function B5(e){return Pe(I.useCallback(s=>{if(!e)return s.edges.map(o=>o.id);const r=[];if(s.width&&s.height)for(const o of s.edges){const l=s.nodeLookup.get(o.source),u=s.nodeLookup.get(o.target);l&&u&&Nk({sourceNode:l,targetNode:u,width:s.width,height:s.height,transform:s.transform})&&r.push(o.id)}return r},[e]),et)}const L5=({color:e="none",strokeWidth:t=1})=>{const s={strokeWidth:t,...e&&{stroke:e}};return T.jsx("polyline",{className:"arrow",style:s,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},O5=({color:e="none",strokeWidth:t=1})=>{const s={strokeWidth:t,...e&&{stroke:e,fill:e}};return T.jsx("polyline",{className:"arrowclosed",style:s,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},my={[gu.Arrow]:L5,[gu.ArrowClosed]:O5};function z5(e){const t=it();return I.useMemo(()=>{var o,l;return Object.prototype.hasOwnProperty.call(my,e)?my[e]:((l=(o=t.getState()).onError)==null||l.call(o,"009",is.error009(e)),null)},[e])}const H5=({id:e,type:t,color:s,width:r=12.5,height:o=12.5,markerUnits:l="strokeWidth",strokeWidth:u,orient:h="auto-start-reverse"})=>{const d=z5(t);return d?T.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:h,refX:"0",refY:"0",children:T.jsx(d,{color:s,strokeWidth:u})}):null},ob=({defaultColor:e,rfId:t})=>{const s=Pe(l=>l.edges),r=Pe(l=>l.defaultEdgeOptions),o=I.useMemo(()=>Uk(s,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[s,r,t,e]);return o.length?T.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:T.jsx("defs",{children:o.map(l=>T.jsx(H5,{id:l.id,type:l.type,color:l.color,width:l.width,height:l.height,markerUnits:l.markerUnits,strokeWidth:l.strokeWidth,orient:l.orient},l.id))})}):null};ob.displayName="MarkerDefinitions";var P5=I.memo(ob);function ab({x:e,y:t,label:s,labelStyle:r,labelShowBg:o=!0,labelBgStyle:l,labelBgPadding:u=[2,4],labelBgBorderRadius:h=2,children:d,className:f,...p}){const[m,v]=I.useState({x:1,y:0,width:0,height:0}),S=yt(["react-flow__edge-textwrapper",f]),y=I.useRef(null);return I.useEffect(()=>{if(y.current){const b=y.current.getBBox();v({x:b.x,y:b.y,width:b.width,height:b.height})}},[s]),s?T.jsxs("g",{transform:`translate(${e-m.width/2} ${t-m.height/2})`,className:S,visibility:m.width?"visible":"hidden",...p,children:[o&&T.jsx("rect",{width:m.width+2*u[0],x:-u[0],y:-u[1],height:m.height+2*u[1],className:"react-flow__edge-textbg",style:l,rx:h,ry:h}),T.jsx("text",{className:"react-flow__edge-text",y:m.height/2,dy:"0.3em",ref:y,style:r,children:s}),d]}):null}ab.displayName="EdgeText";const U5=I.memo(ab);function $u({path:e,labelX:t,labelY:s,label:r,labelStyle:o,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:d,interactionWidth:f=20,...p}){return T.jsxs(T.Fragment,{children:[T.jsx("path",{...p,d:e,fill:"none",className:yt(["react-flow__edge-path",p.className])}),f?T.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:f,className:"react-flow__edge-interaction"}):null,r&&ji(t)&&ji(s)?T.jsx(U5,{x:t,y:s,label:r,labelStyle:o,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:d}):null]})}function vy({pos:e,x1:t,y1:s,x2:r,y2:o}){return e===ye.Left||e===ye.Right?[.5*(t+r),s]:[t,.5*(s+o)]}function lb({sourceX:e,sourceY:t,sourcePosition:s=ye.Bottom,targetX:r,targetY:o,targetPosition:l=ye.Top}){const[u,h]=vy({pos:s,x1:e,y1:t,x2:r,y2:o}),[d,f]=vy({pos:l,x1:r,y1:o,x2:e,y2:t}),[p,m,v,S]=N1({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:u,sourceControlY:h,targetControlX:d,targetControlY:f});return[`M${e},${t} C${u},${h} ${d},${f} ${r},${o}`,p,m,v,S]}function cb(e){return I.memo(({id:t,sourceX:s,sourceY:r,targetX:o,targetY:l,sourcePosition:u,targetPosition:h,label:d,labelStyle:f,labelShowBg:p,labelBgStyle:m,labelBgPadding:v,labelBgBorderRadius:S,style:y,markerEnd:b,markerStart:x,interactionWidth:C})=>{const[A,E,D]=lb({sourceX:s,sourceY:r,sourcePosition:u,targetX:o,targetY:l,targetPosition:h}),H=e.isInternal?void 0:t;return T.jsx($u,{id:H,path:A,labelX:E,labelY:D,label:d,labelStyle:f,labelShowBg:p,labelBgStyle:m,labelBgPadding:v,labelBgBorderRadius:S,style:y,markerEnd:b,markerStart:x,interactionWidth:C})})}const j5=cb({isInternal:!1}),ub=cb({isInternal:!0});j5.displayName="SimpleBezierEdge";ub.displayName="SimpleBezierEdgeInternal";function hb(e){return I.memo(({id:t,sourceX:s,sourceY:r,targetX:o,targetY:l,label:u,labelStyle:h,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:m,style:v,sourcePosition:S=ye.Bottom,targetPosition:y=ye.Top,markerEnd:b,markerStart:x,pathOptions:C,interactionWidth:A})=>{const[E,D,H]=n_({sourceX:s,sourceY:r,sourcePosition:S,targetX:o,targetY:l,targetPosition:y,borderRadius:C==null?void 0:C.borderRadius,offset:C==null?void 0:C.offset,stepPosition:C==null?void 0:C.stepPosition}),O=e.isInternal?void 0:t;return T.jsx($u,{id:O,path:E,labelX:D,labelY:H,label:u,labelStyle:h,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:m,style:v,markerEnd:b,markerStart:x,interactionWidth:A})})}const fb=hb({isInternal:!1}),db=hb({isInternal:!0});fb.displayName="SmoothStepEdge";db.displayName="SmoothStepEdgeInternal";function _b(e){return I.memo(({id:t,...s})=>{var o;const r=e.isInternal?void 0:t;return T.jsx(fb,{...s,id:r,pathOptions:I.useMemo(()=>{var l;return{borderRadius:0,offset:(l=s.pathOptions)==null?void 0:l.offset}},[(o=s.pathOptions)==null?void 0:o.offset])})})}const I5=_b({isInternal:!1}),gb=_b({isInternal:!0});I5.displayName="StepEdge";gb.displayName="StepEdgeInternal";function pb(e){return I.memo(({id:t,sourceX:s,sourceY:r,targetX:o,targetY:l,label:u,labelStyle:h,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:m,style:v,markerEnd:S,markerStart:y,interactionWidth:b})=>{const[x,C,A]=B1({sourceX:s,sourceY:r,targetX:o,targetY:l}),E=e.isInternal?void 0:t;return T.jsx($u,{id:E,path:x,labelX:C,labelY:A,label:u,labelStyle:h,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:m,style:v,markerEnd:S,markerStart:y,interactionWidth:b})})}const $5=pb({isInternal:!1}),mb=pb({isInternal:!0});$5.displayName="StraightEdge";mb.displayName="StraightEdgeInternal";function vb(e){return I.memo(({id:t,sourceX:s,sourceY:r,targetX:o,targetY:l,sourcePosition:u=ye.Bottom,targetPosition:h=ye.Top,label:d,labelStyle:f,labelShowBg:p,labelBgStyle:m,labelBgPadding:v,labelBgBorderRadius:S,style:y,markerEnd:b,markerStart:x,pathOptions:C,interactionWidth:A})=>{const[E,D,H]=og({sourceX:s,sourceY:r,sourcePosition:u,targetX:o,targetY:l,targetPosition:h,curvature:C==null?void 0:C.curvature}),O=e.isInternal?void 0:t;return T.jsx($u,{id:O,path:E,labelX:D,labelY:H,label:d,labelStyle:f,labelShowBg:p,labelBgStyle:m,labelBgPadding:v,labelBgBorderRadius:S,style:y,markerEnd:b,markerStart:x,interactionWidth:A})})}const q5=vb({isInternal:!1}),yb=vb({isInternal:!0});q5.displayName="BezierEdge";yb.displayName="BezierEdgeInternal";const yy={default:yb,straight:mb,step:gb,smoothstep:db,simplebezier:ub},Sy={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},W5=(e,t,s)=>s===ye.Left?e-t:s===ye.Right?e+t:e,Y5=(e,t,s)=>s===ye.Top?e-t:s===ye.Bottom?e+t:e,by="react-flow__edgeupdater";function wy({position:e,centerX:t,centerY:s,radius:r=10,onMouseDown:o,onMouseEnter:l,onMouseOut:u,type:h}){return T.jsx("circle",{onMouseDown:o,onMouseEnter:l,onMouseOut:u,className:yt([by,`${by}-${h}`]),cx:W5(t,r,e),cy:Y5(s,r,e),r,stroke:"transparent",fill:"transparent"})}function V5({isReconnectable:e,reconnectRadius:t,edge:s,sourceX:r,sourceY:o,targetX:l,targetY:u,sourcePosition:h,targetPosition:d,onReconnect:f,onReconnectStart:p,onReconnectEnd:m,setReconnecting:v,setUpdateHover:S}){const y=it(),b=(D,H)=>{if(D.button!==0)return;const{autoPanOnConnect:O,domNode:P,isValidConnection:V,connectionMode:G,connectionRadius:ne,lib:X,onConnectStart:$,onConnectEnd:q,cancelConnection:N,nodeLookup:z,rfId:M,panBy:L,updateConnection:B}=y.getState(),j=H.type==="target",Z=(ee,te)=>{v(!1),m==null||m(ee,s,H.type,te)},R=ee=>f==null?void 0:f(s,ee),W=(ee,te)=>{v(!0),p==null||p(D,s,H.type),$==null||$(ee,te)};a_.onPointerDown(D.nativeEvent,{autoPanOnConnect:O,connectionMode:G,connectionRadius:ne,domNode:P,handleId:H.id,nodeId:H.nodeId,nodeLookup:z,isTarget:j,edgeUpdaterType:H.type,lib:X,flowId:M,cancelConnection:N,panBy:L,isValidConnection:V,onConnect:R,onConnectStart:W,onConnectEnd:q,onReconnectEnd:Z,updateConnection:B,getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,dragThreshold:y.getState().connectionDragThreshold,handleDomNode:D.currentTarget})},x=D=>b(D,{nodeId:s.target,id:s.targetHandle??null,type:"target"}),C=D=>b(D,{nodeId:s.source,id:s.sourceHandle??null,type:"source"}),A=()=>S(!0),E=()=>S(!1);return T.jsxs(T.Fragment,{children:[(e===!0||e==="source")&&T.jsx(wy,{position:h,centerX:r,centerY:o,radius:t,onMouseDown:x,onMouseEnter:A,onMouseOut:E,type:"source"}),(e===!0||e==="target")&&T.jsx(wy,{position:d,centerX:l,centerY:u,radius:t,onMouseDown:C,onMouseEnter:A,onMouseOut:E,type:"target"})]})}function X5({id:e,edgesFocusable:t,edgesReconnectable:s,elementsSelectable:r,onClick:o,onDoubleClick:l,onContextMenu:u,onMouseEnter:h,onMouseMove:d,onMouseLeave:f,reconnectRadius:p,onReconnect:m,onReconnectStart:v,onReconnectEnd:S,rfId:y,edgeTypes:b,noPanClassName:x,onError:C,disableKeyboardA11y:A}){let E=Pe(me=>me.edgeLookup.get(e));const D=Pe(me=>me.defaultEdgeOptions);E=D?{...D,...E}:E;let H=E.type||"default",O=(b==null?void 0:b[H])||yy[H];O===void 0&&(C==null||C("011",is.error011(H)),H="default",O=(b==null?void 0:b.default)||yy.default);const P=!!(E.focusable||t&&typeof E.focusable>"u"),V=typeof m<"u"&&(E.reconnectable||s&&typeof E.reconnectable>"u"),G=!!(E.selectable||r&&typeof E.selectable>"u"),ne=I.useRef(null),[X,$]=I.useState(!1),[q,N]=I.useState(!1),z=it(),{zIndex:M,sourceX:L,sourceY:B,targetX:j,targetY:Z,sourcePosition:R,targetPosition:W}=Pe(I.useCallback(me=>{const de=me.nodeLookup.get(E.source),ke=me.nodeLookup.get(E.target);if(!de||!ke)return{zIndex:E.zIndex,...Sy};const $e=Pk({id:e,sourceNode:de,targetNode:ke,sourceHandle:E.sourceHandle||null,targetHandle:E.targetHandle||null,connectionMode:me.connectionMode,onError:C});return{zIndex:Ak({selected:E.selected,zIndex:E.zIndex,sourceNode:de,targetNode:ke,elevateOnSelect:me.elevateEdgesOnSelect,zIndexMode:me.zIndexMode}),...$e||Sy}},[E.source,E.target,E.sourceHandle,E.targetHandle,E.selected,E.zIndex]),et),ee=I.useMemo(()=>E.markerStart?`url('#${r_(E.markerStart,y)}')`:void 0,[E.markerStart,y]),te=I.useMemo(()=>E.markerEnd?`url('#${r_(E.markerEnd,y)}')`:void 0,[E.markerEnd,y]);if(E.hidden||L===null||B===null||j===null||Z===null)return null;const le=me=>{var Le;const{addSelectedEdges:de,unselectNodesAndEdges:ke,multiSelectionActive:$e}=z.getState();G&&(z.setState({nodesSelectionActive:!1}),E.selected&&$e?(ke({nodes:[],edges:[E]}),(Le=ne.current)==null||Le.blur()):de([e])),o&&o(me,E)},ce=l?me=>{l(me,{...E})}:void 0,he=u?me=>{u(me,{...E})}:void 0,ue=h?me=>{h(me,{...E})}:void 0,_e=d?me=>{d(me,{...E})}:void 0,Ce=f?me=>{f(me,{...E})}:void 0,be=me=>{var de;if(!A&&m1.includes(me.key)&&G){const{unselectNodesAndEdges:ke,addSelectedEdges:$e}=z.getState();me.key==="Escape"?((de=ne.current)==null||de.blur(),ke({edges:[E]})):$e([e])}};return T.jsx("svg",{style:{zIndex:M},children:T.jsxs("g",{className:yt(["react-flow__edge",`react-flow__edge-${H}`,E.className,x,{selected:E.selected,animated:E.animated,inactive:!G&&!o,updating:X,selectable:G}]),onClick:le,onDoubleClick:ce,onContextMenu:he,onMouseEnter:ue,onMouseMove:_e,onMouseLeave:Ce,onKeyDown:P?be:void 0,tabIndex:P?0:void 0,role:E.ariaRole??(P?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":E.ariaLabel===null?void 0:E.ariaLabel||`Edge from ${E.source} to ${E.target}`,"aria-describedby":P?`${K1}-${y}`:void 0,ref:ne,...E.domAttributes,children:[!q&&T.jsx(O,{id:e,source:E.source,target:E.target,type:E.type,selected:E.selected,animated:E.animated,selectable:G,deletable:E.deletable??!0,label:E.label,labelStyle:E.labelStyle,labelShowBg:E.labelShowBg,labelBgStyle:E.labelBgStyle,labelBgPadding:E.labelBgPadding,labelBgBorderRadius:E.labelBgBorderRadius,sourceX:L,sourceY:B,targetX:j,targetY:Z,sourcePosition:R,targetPosition:W,data:E.data,style:E.style,sourceHandleId:E.sourceHandle,targetHandleId:E.targetHandle,markerStart:ee,markerEnd:te,pathOptions:"pathOptions"in E?E.pathOptions:void 0,interactionWidth:E.interactionWidth}),V&&T.jsx(V5,{edge:E,isReconnectable:V,reconnectRadius:p,onReconnect:m,onReconnectStart:v,onReconnectEnd:S,sourceX:L,sourceY:B,targetX:j,targetY:Z,sourcePosition:R,targetPosition:W,setUpdateHover:$,setReconnecting:N})]})})}var K5=I.memo(X5);const G5=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Sb({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:s,edgeTypes:r,noPanClassName:o,onReconnect:l,onEdgeContextMenu:u,onEdgeMouseEnter:h,onEdgeMouseMove:d,onEdgeMouseLeave:f,onEdgeClick:p,reconnectRadius:m,onEdgeDoubleClick:v,onReconnectStart:S,onReconnectEnd:y,disableKeyboardA11y:b}){const{edgesFocusable:x,edgesReconnectable:C,elementsSelectable:A,onError:E}=Pe(G5,et),D=B5(t);return T.jsxs("div",{className:"react-flow__edges",children:[T.jsx(P5,{defaultColor:e,rfId:s}),D.map(H=>T.jsx(K5,{id:H,edgesFocusable:x,edgesReconnectable:C,elementsSelectable:A,noPanClassName:o,onReconnect:l,onContextMenu:u,onMouseEnter:h,onMouseMove:d,onMouseLeave:f,onClick:p,reconnectRadius:m,onDoubleClick:v,onReconnectStart:S,onReconnectEnd:y,rfId:s,onError:E,edgeTypes:r,disableKeyboardA11y:b},H))]})}Sb.displayName="EdgeRenderer";const F5=I.memo(Sb),Z5=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Q5({children:e}){const t=Pe(Z5);return T.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function J5(e){const t=ju(),s=I.useRef(!1);I.useEffect(()=>{!s.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),s.current=!0)},[e,t.viewportInitialized])}const eD=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function tD(e){const t=Pe(eD),s=it();return I.useEffect(()=>{e&&(t==null||t(e),s.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function iD(e){return e.connection.inProgress?{...e.connection,to:tl(e.connection.to,e.transform)}:{...e.connection}}function sD(e){return iD}function nD(e){const t=sD();return Pe(t,et)}const rD=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function oD({containerStyle:e,style:t,type:s,component:r}){const{nodesConnectable:o,width:l,height:u,isValid:h,inProgress:d}=Pe(rD,et);return!(l&&o&&d)?null:T.jsx("svg",{style:e,width:l,height:u,className:"react-flow__connectionline react-flow__container",children:T.jsx("g",{className:yt(["react-flow__connection",S1(h)]),children:T.jsx(bb,{style:t,type:s,CustomComponent:r,isValid:h})})})}const bb=({style:e,type:t=Sn.Bezier,CustomComponent:s,isValid:r})=>{const{inProgress:o,from:l,fromNode:u,fromHandle:h,fromPosition:d,to:f,toNode:p,toHandle:m,toPosition:v,pointer:S}=nD();if(!o)return;if(s)return T.jsx(s,{connectionLineType:t,connectionLineStyle:e,fromNode:u,fromHandle:h,fromX:l.x,fromY:l.y,toX:f.x,toY:f.y,fromPosition:d,toPosition:v,connectionStatus:S1(r),toNode:p,toHandle:m,pointer:S});let y="";const b={sourceX:l.x,sourceY:l.y,sourcePosition:d,targetX:f.x,targetY:f.y,targetPosition:v};switch(t){case Sn.Bezier:[y]=og(b);break;case Sn.SimpleBezier:[y]=lb(b);break;case Sn.Step:[y]=n_({...b,borderRadius:0});break;case Sn.SmoothStep:[y]=n_(b);break;default:[y]=B1(b)}return T.jsx("path",{d:y,fill:"none",className:"react-flow__connection-path",style:e})};bb.displayName="ConnectionLine";const aD={};function xy(e=aD){I.useRef(e),it(),I.useEffect(()=>{},[e])}function lD(){it(),I.useRef(!1),I.useEffect(()=>{},[])}function wb({nodeTypes:e,edgeTypes:t,onInit:s,onNodeClick:r,onEdgeClick:o,onNodeDoubleClick:l,onEdgeDoubleClick:u,onNodeMouseEnter:h,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:p,onSelectionContextMenu:m,onSelectionStart:v,onSelectionEnd:S,connectionLineType:y,connectionLineStyle:b,connectionLineComponent:x,connectionLineContainerStyle:C,selectionKeyCode:A,selectionOnDrag:E,selectionMode:D,multiSelectionKeyCode:H,panActivationKeyCode:O,zoomActivationKeyCode:P,deleteKeyCode:V,onlyRenderVisibleElements:G,elementsSelectable:ne,defaultViewport:X,translateExtent:$,minZoom:q,maxZoom:N,preventScrolling:z,defaultMarkerColor:M,zoomOnScroll:L,zoomOnPinch:B,panOnScroll:j,panOnScrollSpeed:Z,panOnScrollMode:R,zoomOnDoubleClick:W,panOnDrag:ee,onPaneClick:te,onPaneMouseEnter:le,onPaneMouseMove:ce,onPaneMouseLeave:he,onPaneScroll:ue,onPaneContextMenu:_e,paneClickDistance:Ce,nodeClickDistance:be,onEdgeContextMenu:me,onEdgeMouseEnter:de,onEdgeMouseMove:ke,onEdgeMouseLeave:$e,reconnectRadius:Le,onReconnect:Et,onReconnectStart:Ni,onReconnectEnd:oi,noDragClassName:Ri,noWheelClassName:rs,noPanClassName:En,disableKeyboardA11y:Mn,nodeExtent:Rt,rfId:dr,viewport:os,onViewportChange:Hs}){return xy(e),xy(t),lD(),J5(s),tD(os),T.jsx(x5,{onPaneClick:te,onPaneMouseEnter:le,onPaneMouseMove:ce,onPaneMouseLeave:he,onPaneContextMenu:_e,onPaneScroll:ue,paneClickDistance:Ce,deleteKeyCode:V,selectionKeyCode:A,selectionOnDrag:E,selectionMode:D,onSelectionStart:v,onSelectionEnd:S,multiSelectionKeyCode:H,panActivationKeyCode:O,zoomActivationKeyCode:P,elementsSelectable:ne,zoomOnScroll:L,zoomOnPinch:B,zoomOnDoubleClick:W,panOnScroll:j,panOnScrollSpeed:Z,panOnScrollMode:R,panOnDrag:ee,defaultViewport:X,translateExtent:$,minZoom:q,maxZoom:N,onSelectionContextMenu:m,preventScrolling:z,noDragClassName:Ri,noWheelClassName:rs,noPanClassName:En,disableKeyboardA11y:Mn,onViewportChange:Hs,isControlledViewport:!!os,children:T.jsxs(Q5,{children:[T.jsx(F5,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:u,onReconnect:Et,onReconnectStart:Ni,onReconnectEnd:oi,onlyRenderVisibleElements:G,onEdgeContextMenu:me,onEdgeMouseEnter:de,onEdgeMouseMove:ke,onEdgeMouseLeave:$e,reconnectRadius:Le,defaultMarkerColor:M,noPanClassName:En,disableKeyboardA11y:Mn,rfId:dr}),T.jsx(oD,{style:b,type:y,component:x,containerStyle:C}),T.jsx("div",{className:"react-flow__edgelabel-renderer"}),T.jsx(R5,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:l,onNodeMouseEnter:h,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:p,nodeClickDistance:be,onlyRenderVisibleElements:G,noPanClassName:En,noDragClassName:Ri,disableKeyboardA11y:Mn,nodeExtent:Rt,rfId:dr}),T.jsx("div",{className:"react-flow__viewport-portal"})]})})}wb.displayName="GraphView";const cD=I.memo(wb),Cy=({nodes:e,edges:t,defaultNodes:s,defaultEdges:r,width:o,height:l,fitView:u,fitViewOptions:h,minZoom:d=.5,maxZoom:f=2,nodeOrigin:p,nodeExtent:m,zIndexMode:v="basic"}={})=>{const S=new Map,y=new Map,b=new Map,x=new Map,C=r??t??[],A=s??e??[],E=p??[0,0],D=m??ja;z1(b,x,C);const H=o_(A,S,y,{nodeOrigin:E,nodeExtent:D,zIndexMode:v});let O=[0,0,1];if(u&&o&&l){const P=Ja(S,{filter:X=>!!((X.width||X.initialWidth)&&(X.height||X.initialHeight))}),{x:V,y:G,zoom:ne}=ng(P,o,l,d,f,(h==null?void 0:h.padding)??.1);O=[V,G,ne]}return{rfId:"1",width:o??0,height:l??0,transform:O,nodes:A,nodesInitialized:H,nodeLookup:S,parentLookup:y,edges:C,edgeLookup:x,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:s!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:d,maxZoom:f,translateExtent:ja,nodeExtent:D,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:fo.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:E,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:u??!1,fitViewOptions:h,fitViewResolver:null,connection:{...y1},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Ck,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:v1,zIndexMode:v,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},uD=({nodes:e,edges:t,defaultNodes:s,defaultEdges:r,width:o,height:l,fitView:u,fitViewOptions:h,minZoom:d,maxZoom:f,nodeOrigin:p,nodeExtent:m,zIndexMode:v})=>D3((S,y)=>{async function b(){const{nodeLookup:x,panZoom:C,fitViewOptions:A,fitViewResolver:E,width:D,height:H,minZoom:O,maxZoom:P}=y();C&&(await wk({nodes:x,width:D,height:H,panZoom:C,minZoom:O,maxZoom:P},A),E==null||E.resolve(!0),S({fitViewResolver:null}))}return{...Cy({nodes:e,edges:t,width:o,height:l,fitView:u,fitViewOptions:h,minZoom:d,maxZoom:f,nodeOrigin:p,nodeExtent:m,defaultNodes:s,defaultEdges:r,zIndexMode:v}),setNodes:x=>{const{nodeLookup:C,parentLookup:A,nodeOrigin:E,elevateNodesOnSelect:D,fitViewQueued:H,zIndexMode:O}=y(),P=o_(x,C,A,{nodeOrigin:E,nodeExtent:m,elevateNodesOnSelect:D,checkEquality:!0,zIndexMode:O});H&&P?(b(),S({nodes:x,nodesInitialized:P,fitViewQueued:!1,fitViewOptions:void 0})):S({nodes:x,nodesInitialized:P})},setEdges:x=>{const{connectionLookup:C,edgeLookup:A}=y();z1(C,A,x),S({edges:x})},setDefaultNodesAndEdges:(x,C)=>{if(x){const{setNodes:A}=y();A(x),S({hasDefaultNodes:!0})}if(C){const{setEdges:A}=y();A(C),S({hasDefaultEdges:!0})}},updateNodeInternals:x=>{const{triggerNodeChanges:C,nodeLookup:A,parentLookup:E,domNode:D,nodeOrigin:H,nodeExtent:O,debug:P,fitViewQueued:V,zIndexMode:G}=y(),{changes:ne,updatedInternals:X}=Vk(x,A,E,D,H,O,G);X&&($k(A,E,{nodeOrigin:H,nodeExtent:O,zIndexMode:G}),V?(b(),S({fitViewQueued:!1,fitViewOptions:void 0})):S({}),(ne==null?void 0:ne.length)>0&&(P&&console.log("React Flow: trigger node changes",ne),C==null||C(ne)))},updateNodePositions:(x,C=!1)=>{const A=[];let E=[];const{nodeLookup:D,triggerNodeChanges:H,connection:O,updateConnection:P,onNodesChangeMiddlewareMap:V}=y();for(const[G,ne]of x){const X=D.get(G),$=!!(X!=null&&X.expandParent&&(X!=null&&X.parentId)&&(ne!=null&&ne.position)),q={id:G,type:"position",position:$?{x:Math.max(0,ne.position.x),y:Math.max(0,ne.position.y)}:ne.position,dragging:C};if(X&&O.inProgress&&O.fromNode.id===X.id){const N=cr(X,O.fromHandle,ye.Left,!0);P({...O,from:N})}$&&X.parentId&&A.push({id:G,parentId:X.parentId,rect:{...ne.internals.positionAbsolute,width:ne.measured.width??0,height:ne.measured.height??0}}),E.push(q)}if(A.length>0){const{parentLookup:G,nodeOrigin:ne}=y(),X=hg(A,D,G,ne);E.push(...X)}for(const G of V.values())E=G(E);H(E)},triggerNodeChanges:x=>{const{onNodesChange:C,setNodes:A,nodes:E,hasDefaultNodes:D,debug:H}=y();if(x!=null&&x.length){if(D){const O=Z1(x,E);A(O)}H&&console.log("React Flow: trigger node changes",x),C==null||C(x)}},triggerEdgeChanges:x=>{const{onEdgesChange:C,setEdges:A,edges:E,hasDefaultEdges:D,debug:H}=y();if(x!=null&&x.length){if(D){const O=Q1(x,E);A(O)}H&&console.log("React Flow: trigger edge changes",x),C==null||C(x)}},addSelectedNodes:x=>{const{multiSelectionActive:C,edgeLookup:A,nodeLookup:E,triggerNodeChanges:D,triggerEdgeChanges:H}=y();if(C){const O=x.map(P=>Zn(P,!0));D(O);return}D(ro(E,new Set([...x]),!0)),H(ro(A))},addSelectedEdges:x=>{const{multiSelectionActive:C,edgeLookup:A,nodeLookup:E,triggerNodeChanges:D,triggerEdgeChanges:H}=y();if(C){const O=x.map(P=>Zn(P,!0));H(O);return}H(ro(A,new Set([...x]))),D(ro(E,new Set,!0))},unselectNodesAndEdges:({nodes:x,edges:C}={})=>{const{edges:A,nodes:E,nodeLookup:D,triggerNodeChanges:H,triggerEdgeChanges:O}=y(),P=x||E,V=C||A,G=P.map(X=>{const $=D.get(X.id);return $&&($.selected=!1),Zn(X.id,!1)}),ne=V.map(X=>Zn(X.id,!1));H(G),O(ne)},setMinZoom:x=>{const{panZoom:C,maxZoom:A}=y();C==null||C.setScaleExtent([x,A]),S({minZoom:x})},setMaxZoom:x=>{const{panZoom:C,minZoom:A}=y();C==null||C.setScaleExtent([A,x]),S({maxZoom:x})},setTranslateExtent:x=>{var C;(C=y().panZoom)==null||C.setTranslateExtent(x),S({translateExtent:x})},resetSelectedElements:()=>{const{edges:x,nodes:C,triggerNodeChanges:A,triggerEdgeChanges:E,elementsSelectable:D}=y();if(!D)return;const H=C.reduce((P,V)=>V.selected?[...P,Zn(V.id,!1)]:P,[]),O=x.reduce((P,V)=>V.selected?[...P,Zn(V.id,!1)]:P,[]);A(H),E(O)},setNodeExtent:x=>{const{nodes:C,nodeLookup:A,parentLookup:E,nodeOrigin:D,elevateNodesOnSelect:H,nodeExtent:O,zIndexMode:P}=y();x[0][0]===O[0][0]&&x[0][1]===O[0][1]&&x[1][0]===O[1][0]&&x[1][1]===O[1][1]||(o_(C,A,E,{nodeOrigin:D,nodeExtent:x,elevateNodesOnSelect:H,checkEquality:!1,zIndexMode:P}),S({nodeExtent:x}))},panBy:x=>{const{transform:C,width:A,height:E,panZoom:D,translateExtent:H}=y();return Xk({delta:x,panZoom:D,transform:C,translateExtent:H,width:A,height:E})},setCenter:async(x,C,A)=>{const{width:E,height:D,maxZoom:H,panZoom:O}=y();if(!O)return Promise.resolve(!1);const P=typeof(A==null?void 0:A.zoom)<"u"?A.zoom:H;return await O.setViewport({x:E/2-x*P,y:D/2-C*P,zoom:P},{duration:A==null?void 0:A.duration,ease:A==null?void 0:A.ease,interpolate:A==null?void 0:A.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{S({connection:{...y1}})},updateConnection:x=>{S({connection:x})},reset:()=>S({...Cy()})}},Object.is);function xb({initialNodes:e,initialEdges:t,defaultNodes:s,defaultEdges:r,initialWidth:o,initialHeight:l,initialMinZoom:u,initialMaxZoom:h,initialFitViewOptions:d,fitView:f,nodeOrigin:p,nodeExtent:m,zIndexMode:v,children:S}){const[y]=I.useState(()=>uD({nodes:e,edges:t,defaultNodes:s,defaultEdges:r,width:o,height:l,fitView:f,minZoom:u,maxZoom:h,fitViewOptions:d,nodeOrigin:p,nodeExtent:m,zIndexMode:v}));return T.jsx(T3,{value:y,children:T.jsx(Q3,{children:S})})}function hD({children:e,nodes:t,edges:s,defaultNodes:r,defaultEdges:o,width:l,height:u,fitView:h,fitViewOptions:d,minZoom:f,maxZoom:p,nodeOrigin:m,nodeExtent:v,zIndexMode:S}){return I.useContext(Pu)?T.jsx(T.Fragment,{children:e}):T.jsx(xb,{initialNodes:t,initialEdges:s,defaultNodes:r,defaultEdges:o,initialWidth:l,initialHeight:u,fitView:h,initialFitViewOptions:d,initialMinZoom:f,initialMaxZoom:p,nodeOrigin:m,nodeExtent:v,zIndexMode:S,children:e})}const fD={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function dD({nodes:e,edges:t,defaultNodes:s,defaultEdges:r,className:o,nodeTypes:l,edgeTypes:u,onNodeClick:h,onEdgeClick:d,onInit:f,onMove:p,onMoveStart:m,onMoveEnd:v,onConnect:S,onConnectStart:y,onConnectEnd:b,onClickConnectStart:x,onClickConnectEnd:C,onNodeMouseEnter:A,onNodeMouseMove:E,onNodeMouseLeave:D,onNodeContextMenu:H,onNodeDoubleClick:O,onNodeDragStart:P,onNodeDrag:V,onNodeDragStop:G,onNodesDelete:ne,onEdgesDelete:X,onDelete:$,onSelectionChange:q,onSelectionDragStart:N,onSelectionDrag:z,onSelectionDragStop:M,onSelectionContextMenu:L,onSelectionStart:B,onSelectionEnd:j,onBeforeDelete:Z,connectionMode:R,connectionLineType:W=Sn.Bezier,connectionLineStyle:ee,connectionLineComponent:te,connectionLineContainerStyle:le,deleteKeyCode:ce="Backspace",selectionKeyCode:he="Shift",selectionOnDrag:ue=!1,selectionMode:_e=Ia.Full,panActivationKeyCode:Ce="Space",multiSelectionKeyCode:be=qa()?"Meta":"Control",zoomActivationKeyCode:me=qa()?"Meta":"Control",snapToGrid:de,snapGrid:ke,onlyRenderVisibleElements:$e=!1,selectNodesOnDrag:Le,nodesDraggable:Et,autoPanOnNodeFocus:Ni,nodesConnectable:oi,nodesFocusable:Ri,nodeOrigin:rs=G1,edgesFocusable:En,edgesReconnectable:Mn,elementsSelectable:Rt=!0,defaultViewport:dr=$3,minZoom:os=.5,maxZoom:Hs=2,translateExtent:kn=ja,preventScrolling:Ku=!0,nodeExtent:_r,defaultMarkerColor:Gu="#b1b1b7",zoomOnScroll:Fu=!0,zoomOnPinch:Dn=!0,panOnScroll:$t=!1,panOnScrollSpeed:qi=.5,panOnScrollMode:qt=nr.Free,zoomOnDoubleClick:Zu=!0,panOnDrag:Qu=!0,onPaneClick:Ju,onPaneMouseEnter:gr,onPaneMouseMove:pr,onPaneMouseLeave:mr,onPaneScroll:as,onPaneContextMenu:vr,paneClickDistance:Tn=1,nodeClickDistance:eh=0,children:al,onReconnect:bo,onReconnectStart:An,onReconnectEnd:th,onEdgeContextMenu:ll,onEdgeDoubleClick:cl,onEdgeMouseEnter:ul,onEdgeMouseMove:wo,onEdgeMouseLeave:xo,reconnectRadius:hl=10,onNodesChange:fl,onEdgesChange:Wi,noDragClassName:St="nodrag",noWheelClassName:Ut="nowheel",noPanClassName:ls="nopan",fitView:yr,fitViewOptions:dl,connectOnClick:ih,attributionPosition:_l,proOptions:Nn,defaultEdgeOptions:Co,elevateNodesOnSelect:Ps=!0,elevateEdgesOnSelect:Us=!1,disableKeyboardA11y:js=!1,autoPanOnConnect:Is,autoPanOnNodeDrag:ft,autoPanSpeed:gl,connectionRadius:pl,isValidConnection:cs,onError:$s,style:sh,id:Eo,nodeDragThreshold:ml,connectionDragThreshold:nh,viewport:Sr,onViewportChange:br,width:Bi,height:Kt,colorMode:vl="light",debug:rh,onScroll:qs,ariaLabelConfig:yl,zIndexMode:Rn="basic",...oh},Gt){const Bn=Eo||"1",Sl=V3(vl),Mo=I.useCallback(us=>{us.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),qs==null||qs(us)},[qs]);return T.jsx("div",{"data-testid":"rf__wrapper",...oh,onScroll:Mo,style:{...sh,...fD},ref:Gt,className:yt(["react-flow",o,Sl]),id:Eo,role:"application",children:T.jsxs(hD,{nodes:e,edges:t,width:Bi,height:Kt,fitView:yr,fitViewOptions:dl,minZoom:os,maxZoom:Hs,nodeOrigin:rs,nodeExtent:_r,zIndexMode:Rn,children:[T.jsx(cD,{onInit:f,onNodeClick:h,onEdgeClick:d,onNodeMouseEnter:A,onNodeMouseMove:E,onNodeMouseLeave:D,onNodeContextMenu:H,onNodeDoubleClick:O,nodeTypes:l,edgeTypes:u,connectionLineType:W,connectionLineStyle:ee,connectionLineComponent:te,connectionLineContainerStyle:le,selectionKeyCode:he,selectionOnDrag:ue,selectionMode:_e,deleteKeyCode:ce,multiSelectionKeyCode:be,panActivationKeyCode:Ce,zoomActivationKeyCode:me,onlyRenderVisibleElements:$e,defaultViewport:dr,translateExtent:kn,minZoom:os,maxZoom:Hs,preventScrolling:Ku,zoomOnScroll:Fu,zoomOnPinch:Dn,zoomOnDoubleClick:Zu,panOnScroll:$t,panOnScrollSpeed:qi,panOnScrollMode:qt,panOnDrag:Qu,onPaneClick:Ju,onPaneMouseEnter:gr,onPaneMouseMove:pr,onPaneMouseLeave:mr,onPaneScroll:as,onPaneContextMenu:vr,paneClickDistance:Tn,nodeClickDistance:eh,onSelectionContextMenu:L,onSelectionStart:B,onSelectionEnd:j,onReconnect:bo,onReconnectStart:An,onReconnectEnd:th,onEdgeContextMenu:ll,onEdgeDoubleClick:cl,onEdgeMouseEnter:ul,onEdgeMouseMove:wo,onEdgeMouseLeave:xo,reconnectRadius:hl,defaultMarkerColor:Gu,noDragClassName:St,noWheelClassName:Ut,noPanClassName:ls,rfId:Bn,disableKeyboardA11y:js,nodeExtent:_r,viewport:Sr,onViewportChange:br}),T.jsx(Y3,{nodes:e,edges:t,defaultNodes:s,defaultEdges:r,onConnect:S,onConnectStart:y,onConnectEnd:b,onClickConnectStart:x,onClickConnectEnd:C,nodesDraggable:Et,autoPanOnNodeFocus:Ni,nodesConnectable:oi,nodesFocusable:Ri,edgesFocusable:En,edgesReconnectable:Mn,elementsSelectable:Rt,elevateNodesOnSelect:Ps,elevateEdgesOnSelect:Us,minZoom:os,maxZoom:Hs,nodeExtent:_r,onNodesChange:fl,onEdgesChange:Wi,snapToGrid:de,snapGrid:ke,connectionMode:R,translateExtent:kn,connectOnClick:ih,defaultEdgeOptions:Co,fitView:yr,fitViewOptions:dl,onNodesDelete:ne,onEdgesDelete:X,onDelete:$,onNodeDragStart:P,onNodeDrag:V,onNodeDragStop:G,onSelectionDrag:z,onSelectionDragStart:N,onSelectionDragStop:M,onMove:p,onMoveStart:m,onMoveEnd:v,noPanClassName:ls,nodeOrigin:rs,rfId:Bn,autoPanOnConnect:Is,autoPanOnNodeDrag:ft,autoPanSpeed:gl,onError:$s,connectionRadius:pl,isValidConnection:cs,selectNodesOnDrag:Le,nodeDragThreshold:ml,connectionDragThreshold:nh,onBeforeDelete:Z,debug:rh,ariaLabelConfig:yl,zIndexMode:Rn}),T.jsx(I3,{onSelectionChange:q}),al,T.jsx(z3,{proOptions:Nn,position:_l}),T.jsx(O3,{rfId:Bn,disableKeyboardA11y:js})]})})}var _D=J1(dD);function gD(e){const[t,s]=I.useState(e),r=I.useCallback(o=>s(l=>Z1(o,l)),[]);return[t,s,r]}function pD(e){const[t,s]=I.useState(e),r=I.useCallback(o=>s(l=>Q1(o,l)),[]);return[t,s,r]}function mD({dimensions:e,lineWidth:t,variant:s,className:r}){return T.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:yt(["react-flow__background-pattern",s,r])})}function vD({radius:e,className:t}){return T.jsx("circle",{cx:e,cy:e,r:e,className:yt(["react-flow__background-pattern","dots",t])})}var Rs;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Rs||(Rs={}));const yD={[Rs.Dots]:1,[Rs.Lines]:1,[Rs.Cross]:6},SD=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Cb({id:e,variant:t=Rs.Dots,gap:s=20,size:r,lineWidth:o=1,offset:l=0,color:u,bgColor:h,style:d,className:f,patternClassName:p}){const m=I.useRef(null),{transform:v,patternId:S}=Pe(SD,et),y=r||yD[t],b=t===Rs.Dots,x=t===Rs.Cross,C=Array.isArray(s)?s:[s,s],A=[C[0]*v[2]||1,C[1]*v[2]||1],E=y*v[2],D=Array.isArray(l)?l:[l,l],H=x?[E,E]:A,O=[D[0]*v[2]||1+H[0]/2,D[1]*v[2]||1+H[1]/2],P=`${S}${e||""}`;return T.jsxs("svg",{className:yt(["react-flow__background",f]),style:{...d,...Iu,"--xy-background-color-props":h,"--xy-background-pattern-color-props":u},ref:m,"data-testid":"rf__background",children:[T.jsx("pattern",{id:P,x:v[0]%A[0],y:v[1]%A[1],width:A[0],height:A[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${O[0]},-${O[1]})`,children:b?T.jsx(vD,{radius:E/2,className:p}):T.jsx(mD,{dimensions:H,lineWidth:o,variant:t,className:p})}),T.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${P})`})]})}Cb.displayName="Background";const bD=I.memo(Cb);function wD(){return T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:T.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function xD(){return T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:T.jsx("path",{d:"M0 0h32v4.2H0z"})})}function CD(){return T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:T.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function ED(){return T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:T.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function MD(){return T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:T.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Pc({children:e,className:t,...s}){return T.jsx("button",{type:"button",className:yt(["react-flow__controls-button",t]),...s,children:e})}const kD=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Eb({style:e,showZoom:t=!0,showFitView:s=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:l,onZoomOut:u,onFitView:h,onInteractiveChange:d,className:f,children:p,position:m="bottom-left",orientation:v="vertical","aria-label":S}){const y=it(),{isInteractive:b,minZoomReached:x,maxZoomReached:C,ariaLabelConfig:A}=Pe(kD,et),{zoomIn:E,zoomOut:D,fitView:H}=ju(),O=()=>{E(),l==null||l()},P=()=>{D(),u==null||u()},V=()=>{H(o),h==null||h()},G=()=>{y.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),d==null||d(!b)},ne=v==="horizontal"?"horizontal":"vertical";return T.jsxs(Uu,{className:yt(["react-flow__controls",ne,f]),position:m,style:e,"data-testid":"rf__controls","aria-label":S??A["controls.ariaLabel"],children:[t&&T.jsxs(T.Fragment,{children:[T.jsx(Pc,{onClick:O,className:"react-flow__controls-zoomin",title:A["controls.zoomIn.ariaLabel"],"aria-label":A["controls.zoomIn.ariaLabel"],disabled:C,children:T.jsx(wD,{})}),T.jsx(Pc,{onClick:P,className:"react-flow__controls-zoomout",title:A["controls.zoomOut.ariaLabel"],"aria-label":A["controls.zoomOut.ariaLabel"],disabled:x,children:T.jsx(xD,{})})]}),s&&T.jsx(Pc,{className:"react-flow__controls-fitview",onClick:V,title:A["controls.fitView.ariaLabel"],"aria-label":A["controls.fitView.ariaLabel"],children:T.jsx(CD,{})}),r&&T.jsx(Pc,{className:"react-flow__controls-interactive",onClick:G,title:A["controls.interactive.ariaLabel"],"aria-label":A["controls.interactive.ariaLabel"],children:b?T.jsx(MD,{}):T.jsx(ED,{})}),p]})}Eb.displayName="Controls";const DD=I.memo(Eb);function TD({id:e,x:t,y:s,width:r,height:o,style:l,color:u,strokeColor:h,strokeWidth:d,className:f,borderRadius:p,shapeRendering:m,selected:v,onClick:S}){const{background:y,backgroundColor:b}=l||{},x=u||y||b;return T.jsx("rect",{className:yt(["react-flow__minimap-node",{selected:v},f]),x:t,y:s,rx:p,ry:p,width:r,height:o,style:{fill:x,stroke:h,strokeWidth:d},shapeRendering:m,onClick:S?C=>S(C,e):void 0})}const AD=I.memo(TD),ND=e=>e.nodes.map(t=>t.id),Ad=e=>e instanceof Function?e:()=>e;function RD({nodeStrokeColor:e,nodeColor:t,nodeClassName:s="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:l=AD,onClick:u}){const h=Pe(ND,et),d=Ad(t),f=Ad(e),p=Ad(s),m=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return T.jsx(T.Fragment,{children:h.map(v=>T.jsx(LD,{id:v,nodeColorFunc:d,nodeStrokeColorFunc:f,nodeClassNameFunc:p,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:l,onClick:u,shapeRendering:m},v))})}function BD({id:e,nodeColorFunc:t,nodeStrokeColorFunc:s,nodeClassNameFunc:r,nodeBorderRadius:o,nodeStrokeWidth:l,shapeRendering:u,NodeComponent:h,onClick:d}){const{node:f,x:p,y:m,width:v,height:S}=Pe(y=>{const{internals:b}=y.nodeLookup.get(e),x=b.userNode,{x:C,y:A}=b.positionAbsolute,{width:E,height:D}=Ls(x);return{node:x,x:C,y:A,width:E,height:D}},et);return!f||f.hidden||!M1(f)?null:T.jsx(h,{x:p,y:m,width:v,height:S,style:f.style,selected:!!f.selected,className:r(f),color:t(f),borderRadius:o,strokeColor:s(f),strokeWidth:l,shapeRendering:u,onClick:d,id:f.id})}const LD=I.memo(BD);var OD=I.memo(RD);const zD=200,HD=150,PD=e=>!e.hidden,UD=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?E1(Ja(e.nodeLookup,{filter:PD}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},jD="react-flow__minimap-desc";function Mb({style:e,className:t,nodeStrokeColor:s,nodeColor:r,nodeClassName:o="",nodeBorderRadius:l=5,nodeStrokeWidth:u,nodeComponent:h,bgColor:d,maskColor:f,maskStrokeColor:p,maskStrokeWidth:m,position:v="bottom-right",onClick:S,onNodeClick:y,pannable:b=!1,zoomable:x=!1,ariaLabel:C,inversePan:A,zoomStep:E=1,offsetScale:D=5}){const H=it(),O=I.useRef(null),{boundingRect:P,viewBB:V,rfId:G,panZoom:ne,translateExtent:X,flowWidth:$,flowHeight:q,ariaLabelConfig:N}=Pe(UD,et),z=(e==null?void 0:e.width)??zD,M=(e==null?void 0:e.height)??HD,L=P.width/z,B=P.height/M,j=Math.max(L,B),Z=j*z,R=j*M,W=D*j,ee=P.x-(Z-P.width)/2-W,te=P.y-(R-P.height)/2-W,le=Z+W*2,ce=R+W*2,he=`${jD}-${G}`,ue=I.useRef(0),_e=I.useRef();ue.current=j,I.useEffect(()=>{if(O.current&&ne)return _e.current=i3({domNode:O.current,panZoom:ne,getTransform:()=>H.getState().transform,getViewScale:()=>ue.current}),()=>{var de;(de=_e.current)==null||de.destroy()}},[ne]),I.useEffect(()=>{var de;(de=_e.current)==null||de.update({translateExtent:X,width:$,height:q,inversePan:A,pannable:b,zoomStep:E,zoomable:x})},[b,x,A,E,X,$,q]);const Ce=S?de=>{var Le;const[ke,$e]=((Le=_e.current)==null?void 0:Le.pointer(de))||[0,0];S(de,{x:ke,y:$e})}:void 0,be=y?I.useCallback((de,ke)=>{const $e=H.getState().nodeLookup.get(ke).internals.userNode;y(de,$e)},[]):void 0,me=C??N["minimap.ariaLabel"];return T.jsx(Uu,{position:v,style:{...e,"--xy-minimap-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-background-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof m=="number"?m*j:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof s=="string"?s:void 0,"--xy-minimap-node-stroke-width-props":typeof u=="number"?u:void 0},className:yt(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:T.jsxs("svg",{width:z,height:M,viewBox:`${ee} ${te} ${le} ${ce}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":he,ref:O,onClick:Ce,children:[me&&T.jsx("title",{id:he,children:me}),T.jsx(OD,{onClick:be,nodeColor:r,nodeStrokeColor:s,nodeBorderRadius:l,nodeClassName:o,nodeStrokeWidth:u,nodeComponent:h}),T.jsx("path",{className:"react-flow__minimap-mask",d:`M${ee-W},${te-W}h${le+W*2}v${ce+W*2}h${-le-W*2}z
|
|
71
|
+
M${V.x},${V.y}h${V.width}v${V.height}h${-V.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Mb.displayName="MiniMap";const ID=I.memo(Mb),$D=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,qD={[mo.Line]:"right",[mo.Handle]:"bottom-right"};function WD({nodeId:e,position:t,variant:s=mo.Handle,className:r,style:o=void 0,children:l,color:u,minWidth:h=10,minHeight:d=10,maxWidth:f=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:m=!1,resizeDirection:v,autoScale:S=!0,shouldResize:y,onResizeStart:b,onResize:x,onResizeEnd:C}){const A=sb(),E=typeof e=="string"?e:A,D=it(),H=I.useRef(null),O=s===mo.Handle,P=Pe(I.useCallback($D(O&&S),[O,S]),et),V=I.useRef(null),G=t??qD[s];I.useEffect(()=>{if(!(!H.current||!E))return V.current||(V.current=p3({domNode:H.current,nodeId:E,getStoreItems:()=>{const{nodeLookup:X,transform:$,snapGrid:q,snapToGrid:N,nodeOrigin:z,domNode:M}=D.getState();return{nodeLookup:X,transform:$,snapGrid:q,snapToGrid:N,nodeOrigin:z,paneDomNode:M}},onChange:(X,$)=>{const{triggerNodeChanges:q,nodeLookup:N,parentLookup:z,nodeOrigin:M}=D.getState(),L=[],B={x:X.x,y:X.y},j=N.get(E);if(j&&j.expandParent&&j.parentId){const Z=j.origin??M,R=X.width??j.measured.width??0,W=X.height??j.measured.height??0,ee={id:j.id,parentId:j.parentId,rect:{width:R,height:W,...k1({x:X.x??j.position.x,y:X.y??j.position.y},{width:R,height:W},j.parentId,N,Z)}},te=hg([ee],N,z,M);L.push(...te),B.x=X.x?Math.max(Z[0]*R,X.x):void 0,B.y=X.y?Math.max(Z[1]*W,X.y):void 0}if(B.x!==void 0&&B.y!==void 0){const Z={id:E,type:"position",position:{...B}};L.push(Z)}if(X.width!==void 0&&X.height!==void 0){const R={id:E,type:"dimensions",resizing:!0,setAttributes:v?v==="horizontal"?"width":"height":!0,dimensions:{width:X.width,height:X.height}};L.push(R)}for(const Z of $){const R={...Z,type:"position"};L.push(R)}q(L)},onEnd:({width:X,height:$})=>{const q={id:E,type:"dimensions",resizing:!1,dimensions:{width:X,height:$}};D.getState().triggerNodeChanges([q])}})),V.current.update({controlPosition:G,boundaries:{minWidth:h,minHeight:d,maxWidth:f,maxHeight:p},keepAspectRatio:m,resizeDirection:v,onResizeStart:b,onResize:x,onResizeEnd:C,shouldResize:y}),()=>{var X;(X=V.current)==null||X.destroy()}},[G,h,d,f,p,m,b,x,C,y]);const ne=G.split("-");return T.jsx("div",{className:yt(["react-flow__resize-control","nodrag",...ne,s,r]),ref:H,style:{...o,scale:P,...u&&{[O?"backgroundColor":"borderColor"]:u}},children:l})}I.memo(WD);const YD=1e3,VD=1e4;function XD(){const[e,t]=I.useState({workflows:[],parseErrors:[]}),[s,r]=I.useState(!1),o=I.useRef(0),l=I.useRef(null),u=I.useRef(new EventTarget),h=I.useCallback(f=>{const p=l.current;p&&p.readyState===WebSocket.OPEN&&p.send(JSON.stringify(f))},[]),d=I.useCallback(()=>{const f=window.location.protocol==="https:"?"wss:":"ws:",p=new WebSocket(`${f}//${window.location.host}`);l.current=p,p.onopen=()=>{r(!0),o.current=0},p.onclose=()=>{r(!1),l.current=null;const m=Math.min(YD*2**o.current,VD);o.current++,setTimeout(d,m)},p.onerror=()=>{p.close()},p.onmessage=m=>{try{const v=JSON.parse(m.data);switch(v.type){case"full-sync":t(v.data);break;case"workflow-updated":t(S=>{const y=S.workflows.filter(x=>x.filePath!==v.data.filePath||x.workflowName!==v.data.workflowName);y.push(v.data);const b=S.parseErrors.filter(x=>x.filePath!==v.data.filePath);return{workflows:y,parseErrors:b}});break;case"workflow-removed":t(S=>({workflows:S.workflows.filter(y=>y.filePath!==v.data.filePath),parseErrors:S.parseErrors.filter(y=>y.filePath!==v.data.filePath)}));break;case"parse-error":t(S=>{const y=S.workflows.filter(x=>x.filePath!==v.data.filePath),b=S.parseErrors.filter(x=>x.filePath!==v.data.filePath);return b.push(v.data),{workflows:y,parseErrors:b}});break;case"pty-data":u.current.dispatchEvent(new CustomEvent("data",{detail:v.data}));break;case"pty-exit":u.current.dispatchEvent(new CustomEvent("exit",{detail:v.data.code}));break;case"pty-spawned":u.current.dispatchEvent(new CustomEvent("spawned",{detail:v.data.pid}));break}}catch{}}},[]);return I.useEffect(()=>(d(),()=>{var f;(f=l.current)==null||f.close()}),[d]),{state:e,connected:s,sendMessage:h,ptyEvents:u.current}}function KD(){const[e,t]=I.useState([]),[s,r]=I.useState(!0),[o,l]=I.useState(0),u=I.useCallback(async()=>{try{const p=await fetch("/api/connections");p.ok&&t(await p.json())}catch{}finally{r(!1)}},[]);I.useEffect(()=>{u()},[u]);const h=I.useCallback(async p=>{await fetch("/api/connections",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(p)}),await u(),l(m=>m+1)},[u]),d=I.useCallback(async(p,m,v)=>{await fetch("/api/connections",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({workflow_name:p,node_name:m,integration_id:v})}),await u(),l(S=>S+1)},[u]),f=I.useCallback((p,m,v)=>e.find(S=>S.workflow_name===p&&S.node_name===m&&S.integration_id===v)??e.find(S=>S.workflow_name==="*"&&S.node_name==="*"&&S.integration_id===v)??null,[e]);return{connections:e,loading:s,upsert:h,remove:d,getForNode:f,refetch:u,mutationVersion:o}}function GD(){const[e,t]=I.useState([]),[s,r]=I.useState(!0);return I.useEffect(()=>{(async()=>{try{const o=await fetch("/api/nango/integrations");o.ok&&t(await o.json())}catch{}finally{r(!1)}})()},[]),{integrations:e,loading:s}}function FD(e,t=0){const[s,r]=I.useState([]),[o,l]=I.useState(!1),u=I.useCallback(async()=>{if(!e)return[];l(!0);try{const h=await fetch(`/api/nango/connections/${encodeURIComponent(e)}`);if(h.ok){const d=await h.json();return r(d),d}}catch{}finally{l(!1)}return[]},[e]);return I.useEffect(()=>{u()},[u,t]),{nangoConnections:s,loading:o,refetch:u}}const ZD=5e3;function QD(e){const[t,s]=I.useState([]),[r,o]=I.useState(!0),[l,u]=I.useState(!0),[h,d]=I.useState(null),[f,p]=I.useState(null),[m,v]=I.useState(!1),S=I.useRef(void 0),y=I.useCallback(async()=>{try{const x=new URLSearchParams;e&&x.set("workflow",e),x.set("limit","50");const C=await fetch(`/api/runs?${x}`);C.ok?(s(await C.json()),u(!0)):u(!1)}catch{u(!1)}finally{o(!1)}},[e]);I.useEffect(()=>(o(!0),y(),S.current=setInterval(y,ZD),()=>clearInterval(S.current)),[y]);const b=I.useCallback(async x=>{if(d(x),!x){p(null);return}v(!0);try{const C=await fetch(`/api/runs/${x}/trace`);C.ok&&p(await C.json())}catch{}finally{v(!1)}},[]);return{runs:t,loading:r,available:l,selectedRunId:h,trace:f,traceLoading:m,selectRun:b,refresh:y}}/**
|
|
72
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
73
|
+
* @license MIT
|
|
74
|
+
*
|
|
75
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
76
|
+
* @license MIT
|
|
77
|
+
*
|
|
78
|
+
* Originally forked from (with the author's permission):
|
|
79
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
80
|
+
* http://bellard.org/jslinux/
|
|
81
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
82
|
+
*/var kb=Object.defineProperty,JD=Object.getOwnPropertyDescriptor,eT=(e,t)=>{for(var s in t)kb(e,s,{get:t[s],enumerable:!0})},lt=(e,t,s,r)=>{for(var o=r>1?void 0:r?JD(t,s):t,l=e.length-1,u;l>=0;l--)(u=e[l])&&(o=(r?u(t,s,o):u(o))||o);return r&&o&&kb(t,s,o),o},ge=(e,t)=>(s,r)=>t(s,r,e),Ey="Terminal input",c_={get:()=>Ey,set:e=>Ey=e},My="Too much output to announce, navigate to rows manually to read",u_={get:()=>My,set:e=>My=e};function tT(e){return e.replace(/\r?\n/g,"\r")}function iT(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function sT(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function nT(e,t,s,r){if(e.stopPropagation(),e.clipboardData){let o=e.clipboardData.getData("text/plain");Db(o,t,s,r)}}function Db(e,t,s,r){e=tT(e),e=iT(e,s.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(e,!0),t.value=""}function Tb(e,t,s){let r=s.getBoundingClientRect(),o=e.clientX-r.left-10,l=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${o}px`,t.style.top=`${l}px`,t.style.zIndex="1000",t.focus()}function ky(e,t,s,r,o){Tb(e,t,s),o&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function yn(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function qu(e,t=0,s=e.length){let r="";for(let o=t;o<s;++o){let l=e[o];l>65535?(l-=65536,r+=String.fromCharCode((l>>10)+55296)+String.fromCharCode(l%1024+56320)):r+=String.fromCharCode(l)}return r}var rT=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let s=e.length;if(!s)return 0;let r=0,o=0;if(this._interim){let l=e.charCodeAt(o++);56320<=l&&l<=57343?t[r++]=(this._interim-55296)*1024+l-56320+65536:(t[r++]=this._interim,t[r++]=l),this._interim=0}for(let l=o;l<s;++l){let u=e.charCodeAt(l);if(55296<=u&&u<=56319){if(++l>=s)return this._interim=u,r;let h=e.charCodeAt(l);56320<=h&&h<=57343?t[r++]=(u-55296)*1024+h-56320+65536:(t[r++]=u,t[r++]=h);continue}u!==65279&&(t[r++]=u)}return r}},oT=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let s=e.length;if(!s)return 0;let r=0,o,l,u,h,d=0,f=0;if(this.interim[0]){let v=!1,S=this.interim[0];S&=(S&224)===192?31:(S&240)===224?15:7;let y=0,b;for(;(b=this.interim[++y]&63)&&y<4;)S<<=6,S|=b;let x=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,C=x-y;for(;f<C;){if(f>=s)return 0;if(b=e[f++],(b&192)!==128){f--,v=!0;break}else this.interim[y++]=b,S<<=6,S|=b&63}v||(x===2?S<128?f--:t[r++]=S:x===3?S<2048||S>=55296&&S<=57343||S===65279||(t[r++]=S):S<65536||S>1114111||(t[r++]=S)),this.interim.fill(0)}let p=s-4,m=f;for(;m<s;){for(;m<p&&!((o=e[m])&128)&&!((l=e[m+1])&128)&&!((u=e[m+2])&128)&&!((h=e[m+3])&128);)t[r++]=o,t[r++]=l,t[r++]=u,t[r++]=h,m+=4;if(o=e[m++],o<128)t[r++]=o;else if((o&224)===192){if(m>=s)return this.interim[0]=o,r;if(l=e[m++],(l&192)!==128){m--;continue}if(d=(o&31)<<6|l&63,d<128){m--;continue}t[r++]=d}else if((o&240)===224){if(m>=s)return this.interim[0]=o,r;if(l=e[m++],(l&192)!==128){m--;continue}if(m>=s)return this.interim[0]=o,this.interim[1]=l,r;if(u=e[m++],(u&192)!==128){m--;continue}if(d=(o&15)<<12|(l&63)<<6|u&63,d<2048||d>=55296&&d<=57343||d===65279)continue;t[r++]=d}else if((o&248)===240){if(m>=s)return this.interim[0]=o,r;if(l=e[m++],(l&192)!==128){m--;continue}if(m>=s)return this.interim[0]=o,this.interim[1]=l,r;if(u=e[m++],(u&192)!==128){m--;continue}if(m>=s)return this.interim[0]=o,this.interim[1]=l,this.interim[2]=u,r;if(h=e[m++],(h&192)!==128){m--;continue}if(d=(o&7)<<18|(l&63)<<12|(u&63)<<6|h&63,d<65536||d>1114111)continue;t[r++]=d}}return r}},Ab="",bn=" ",il=class Nb{constructor(){this.fg=0,this.bg=0,this.extended=new yu}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 Nb;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}},yu=class Rb{constructor(t=0,s=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=s}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 Rb(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ai=class Bb extends il{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new yu,this.combinedData=""}static fromCharData(t){let s=new Bb;return s.setFromCharData(t),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?yn(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 s=!1;if(t[1].length>2)s=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let o=t[1].charCodeAt(1);56320<=o&&o<=57343?this.content=(r-55296)*1024+o-56320+65536|t[2]<<22:s=!0}else s=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;s&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Dy="di$target",h_="di$dependencies",Nd=new Map;function aT(e){return e[h_]||[]}function Nt(e){if(Nd.has(e))return Nd.get(e);let t=function(s,r,o){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");lT(t,s,o)};return t._id=e,Nd.set(e,t),t}function lT(e,t,s){t[Dy]===t?t[h_].push({id:e,index:s}):(t[h_]=[{id:e,index:s}],t[Dy]=t)}var Vt=Nt("BufferService"),Lb=Nt("CoreMouseService"),fr=Nt("CoreService"),cT=Nt("CharsetService"),dg=Nt("InstantiationService"),Ob=Nt("LogService"),Xt=Nt("OptionsService"),zb=Nt("OscLinkService"),uT=Nt("UnicodeService"),sl=Nt("DecorationService"),f_=class{constructor(e,t,s){this._bufferService=e,this._optionsService=t,this._oscLinkService=s}provideLinks(e,t){var p;let s=this._bufferService.buffer.lines.get(e-1);if(!s){t(void 0);return}let r=[],o=this._optionsService.rawOptions.linkHandler,l=new Ai,u=s.getTrimmedLength(),h=-1,d=-1,f=!1;for(let m=0;m<u;m++)if(!(d===-1&&!s.hasContent(m))){if(s.loadCell(m,l),l.hasExtendedAttrs()&&l.extended.urlId)if(d===-1){d=m,h=l.extended.urlId;continue}else f=l.extended.urlId!==h;else d!==-1&&(f=!0);if(f||d!==-1&&m===u-1){let v=(p=this._oscLinkService.getLinkData(h))==null?void 0:p.uri;if(v){let S={start:{x:d+1,y:e},end:{x:m+(!f&&m===u-1?1:0),y:e}},y=!1;if(!(o!=null&&o.allowNonHttpProtocols))try{let b=new URL(v);["http:","https:"].includes(b.protocol)||(y=!0)}catch{y=!0}y||r.push({text:v,range:S,activate:(b,x)=>o?o.activate(b,x,S):hT(b,x),hover:(b,x)=>{var C;return(C=o==null?void 0:o.hover)==null?void 0:C.call(o,b,x,S)},leave:(b,x)=>{var C;return(C=o==null?void 0:o.leave)==null?void 0:C.call(o,b,x,S)}})}f=!1,l.hasExtendedAttrs()&&l.extended.urlId?(d=m,h=l.extended.urlId):(d=-1,h=-1)}}t(r)}};f_=lt([ge(0,Vt),ge(1,Xt),ge(2,zb)],f_);function hT(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
83
|
+
|
|
84
|
+
WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Wu=Nt("CharSizeService"),Os=Nt("CoreBrowserService"),_g=Nt("MouseService"),zs=Nt("RenderService"),fT=Nt("SelectionService"),Hb=Nt("CharacterJoinerService"),yo=Nt("ThemeService"),Pb=Nt("LinkProviderService"),dT=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Ty.isErrorNoTelemetry(e)?new Ty(e.message+`
|
|
85
|
+
|
|
86
|
+
`+e.stack):new Error(e.message+`
|
|
87
|
+
|
|
88
|
+
`+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)}},_T=new dT;function Jc(e){gT(e)||_T.onUnexpectedError(e)}var d_="Canceled";function gT(e){return e instanceof pT?!0:e instanceof Error&&e.name===d_&&e.message===d_}var pT=class extends Error{constructor(){super(d_),this.name=this.message}};function mT(e){return new Error(`Illegal argument: ${e}`)}var Ty=class __ extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof __)return t;let s=new __;return s.message=t.message,s.stack=t.stack,s}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},g_=class Ub extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,Ub.prototype)}};function _i(e,t=0){return e[e.length-(1+t)]}var vT;(e=>{function t(l){return l<0}e.isLessThan=t;function s(l){return l<=0}e.isLessThanOrEqual=s;function r(l){return l>0}e.isGreaterThan=r;function o(l){return l===0}e.isNeitherLessOrGreaterThan=o,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(vT||(vT={}));function yT(e,t){let s=this,r=!1,o;return function(){return r||(r=!0,t||(o=e.apply(s,arguments))),o}}var jb;(e=>{function t(D){return D&&typeof D=="object"&&typeof D[Symbol.iterator]=="function"}e.is=t;let s=Object.freeze([]);function r(){return s}e.empty=r;function*o(D){yield D}e.single=o;function l(D){return t(D)?D:o(D)}e.wrap=l;function u(D){return D||s}e.from=u;function*h(D){for(let H=D.length-1;H>=0;H--)yield D[H]}e.reverse=h;function d(D){return!D||D[Symbol.iterator]().next().done===!0}e.isEmpty=d;function f(D){return D[Symbol.iterator]().next().value}e.first=f;function p(D,H){let O=0;for(let P of D)if(H(P,O++))return!0;return!1}e.some=p;function m(D,H){for(let O of D)if(H(O))return O}e.find=m;function*v(D,H){for(let O of D)H(O)&&(yield O)}e.filter=v;function*S(D,H){let O=0;for(let P of D)yield H(P,O++)}e.map=S;function*y(D,H){let O=0;for(let P of D)yield*H(P,O++)}e.flatMap=y;function*b(...D){for(let H of D)yield*H}e.concat=b;function x(D,H,O){let P=O;for(let V of D)P=H(P,V);return P}e.reduce=x;function*C(D,H,O=D.length){for(H<0&&(H+=D.length),O<0?O+=D.length:O>D.length&&(O=D.length);H<O;H++)yield D[H]}e.slice=C;function A(D,H=Number.POSITIVE_INFINITY){let O=[];if(H===0)return[O,D];let P=D[Symbol.iterator]();for(let V=0;V<H;V++){let G=P.next();if(G.done)return[O,e.empty()];O.push(G.value)}return[O,{[Symbol.iterator](){return P}}]}e.consume=A;async function E(D){let H=[];for await(let O of D)H.push(O);return Promise.resolve(H)}e.asyncToArray=E})(jb||(jb={}));function ur(e){if(jb.is(e)){let t=[];for(let s of e)if(s)try{s.dispose()}catch(r){t.push(r)}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 ST(...e){return tt(()=>ur(e))}function tt(e){return{dispose:yT(()=>{e()})}}var Ib=class $b{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{ur(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?$b.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};Ib.DISABLE_DISPOSED_WARNING=!1;var wn=Ib,Ne=class{constructor(){this._store=new wn,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};Ne.None=Object.freeze({dispose(){}});var vo=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}},Ns=typeof window=="object"?window:globalThis,p_=class m_{constructor(t){this.element=t,this.next=m_.Undefined,this.prev=m_.Undefined}};p_.Undefined=new p_(void 0);var st=p_,Ay=class{constructor(){this._first=st.Undefined,this._last=st.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===st.Undefined}clear(){let e=this._first;for(;e!==st.Undefined;){let t=e.next;e.prev=st.Undefined,e.next=st.Undefined,e=t}this._first=st.Undefined,this._last=st.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let s=new st(e);if(this._first===st.Undefined)this._first=s,this._last=s;else if(t){let o=this._last;this._last=s,s.prev=o,o.next=s}else{let o=this._first;this._first=s,s.next=o,o.prev=s}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(s))}}shift(){if(this._first!==st.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==st.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==st.Undefined&&e.next!==st.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===st.Undefined&&e.next===st.Undefined?(this._first=st.Undefined,this._last=st.Undefined):e.next===st.Undefined?(this._last=this._last.prev,this._last.next=st.Undefined):e.prev===st.Undefined&&(this._first=this._first.next,this._first.prev=st.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==st.Undefined;)yield e.element,e=e.next}},bT=globalThis.performance&&typeof globalThis.performance.now=="function",wT=class qb{static create(t){return new qb(t)}constructor(t){this._now=bT&&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}},Pt;(e=>{e.None=()=>Ne.None;function t($,q){return m($,()=>{},0,void 0,!0,void 0,q)}e.defer=t;function s($){return(q,N=null,z)=>{let M=!1,L;return L=$(B=>{if(!M)return L?L.dispose():M=!0,q.call(N,B)},null,z),M&&L.dispose(),L}}e.once=s;function r($,q,N){return f((z,M=null,L)=>$(B=>z.call(M,q(B)),null,L),N)}e.map=r;function o($,q,N){return f((z,M=null,L)=>$(B=>{q(B),z.call(M,B)},null,L),N)}e.forEach=o;function l($,q,N){return f((z,M=null,L)=>$(B=>q(B)&&z.call(M,B),null,L),N)}e.filter=l;function u($){return $}e.signal=u;function h(...$){return(q,N=null,z)=>{let M=ST(...$.map(L=>L(B=>q.call(N,B))));return p(M,z)}}e.any=h;function d($,q,N,z){let M=N;return r($,L=>(M=q(M,L),M),z)}e.reduce=d;function f($,q){let N,z={onWillAddFirstListener(){N=$(M.fire,M)},onDidRemoveLastListener(){N==null||N.dispose()}},M=new fe(z);return q==null||q.add(M),M.event}function p($,q){return q instanceof Array?q.push($):q&&q.add($),$}function m($,q,N=100,z=!1,M=!1,L,B){let j,Z,R,W=0,ee,te={leakWarningThreshold:L,onWillAddFirstListener(){j=$(ce=>{W++,Z=q(Z,ce),z&&!R&&(le.fire(Z),Z=void 0),ee=()=>{let he=Z;Z=void 0,R=void 0,(!z||W>1)&&le.fire(he),W=0},typeof N=="number"?(clearTimeout(R),R=setTimeout(ee,N)):R===void 0&&(R=0,queueMicrotask(ee))})},onWillRemoveListener(){M&&W>0&&(ee==null||ee())},onDidRemoveLastListener(){ee=void 0,j.dispose()}},le=new fe(te);return B==null||B.add(le),le.event}e.debounce=m;function v($,q=0,N){return e.debounce($,(z,M)=>z?(z.push(M),z):[M],q,void 0,!0,void 0,N)}e.accumulate=v;function S($,q=(z,M)=>z===M,N){let z=!0,M;return l($,L=>{let B=z||!q(L,M);return z=!1,M=L,B},N)}e.latch=S;function y($,q,N){return[e.filter($,q,N),e.filter($,z=>!q(z),N)]}e.split=y;function b($,q=!1,N=[],z){let M=N.slice(),L=$(Z=>{M?M.push(Z):j.fire(Z)});z&&z.add(L);let B=()=>{M==null||M.forEach(Z=>j.fire(Z)),M=null},j=new fe({onWillAddFirstListener(){L||(L=$(Z=>j.fire(Z)),z&&z.add(L))},onDidAddFirstListener(){M&&(q?setTimeout(B):B())},onDidRemoveLastListener(){L&&L.dispose(),L=null}});return z&&z.add(j),j.event}e.buffer=b;function x($,q){return(N,z,M)=>{let L=q(new A);return $(function(B){let j=L.evaluate(B);j!==C&&N.call(z,j)},void 0,M)}}e.chain=x;let C=Symbol("HaltChainable");class A{constructor(){this.steps=[]}map(q){return this.steps.push(q),this}forEach(q){return this.steps.push(N=>(q(N),N)),this}filter(q){return this.steps.push(N=>q(N)?N:C),this}reduce(q,N){let z=N;return this.steps.push(M=>(z=q(z,M),z)),this}latch(q=(N,z)=>N===z){let N=!0,z;return this.steps.push(M=>{let L=N||!q(M,z);return N=!1,z=M,L?M:C}),this}evaluate(q){for(let N of this.steps)if(q=N(q),q===C)break;return q}}function E($,q,N=z=>z){let z=(...j)=>B.fire(N(...j)),M=()=>$.on(q,z),L=()=>$.removeListener(q,z),B=new fe({onWillAddFirstListener:M,onDidRemoveLastListener:L});return B.event}e.fromNodeEventEmitter=E;function D($,q,N=z=>z){let z=(...j)=>B.fire(N(...j)),M=()=>$.addEventListener(q,z),L=()=>$.removeEventListener(q,z),B=new fe({onWillAddFirstListener:M,onDidRemoveLastListener:L});return B.event}e.fromDOMEventEmitter=D;function H($){return new Promise(q=>s($)(q))}e.toPromise=H;function O($){let q=new fe;return $.then(N=>{q.fire(N)},()=>{q.fire(void 0)}).finally(()=>{q.dispose()}),q.event}e.fromPromise=O;function P($,q){return $(N=>q.fire(N))}e.forward=P;function V($,q,N){return q(N),$(z=>q(z))}e.runAndSubscribe=V;class G{constructor(q,N){this._observable=q,this._counter=0,this._hasChanged=!1;let z={onWillAddFirstListener:()=>{q.addObserver(this)},onDidRemoveLastListener:()=>{q.removeObserver(this)}};this.emitter=new fe(z),N&&N.add(this.emitter)}beginUpdate(q){this._counter++}handlePossibleChange(q){}handleChange(q,N){this._hasChanged=!0}endUpdate(q){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function ne($,q){return new G($,q).emitter.event}e.fromObservable=ne;function X($){return(q,N,z)=>{let M=0,L=!1,B={beginUpdate(){M++},endUpdate(){M--,M===0&&($.reportChanges(),L&&(L=!1,q.call(N)))},handlePossibleChange(){},handleChange(){L=!0}};$.addObserver(B),$.reportChanges();let j={dispose(){$.removeObserver(B)}};return z instanceof wn?z.add(j):Array.isArray(z)&&z.push(j),j}}e.fromObservableLight=X})(Pt||(Pt={}));var v_=class y_{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${y_._idPool++}`,y_.all.add(this)}start(t){this._stopWatch=new wT,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}}};v_.all=new Set,v_._idPool=0;var xT=v_,CT=-1,Wb=class Yb{constructor(t,s,r=(Yb._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=s,this.name=r,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,s){let r=this.threshold;if(r<=0||s<r)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=r*.5;let[l,u]=this.getMostFrequentStack(),h=`[${this.name}] potential listener LEAK detected, having ${s} listeners already. MOST frequent listener (${u}):`;console.warn(h),console.warn(l);let d=new kT(h,l);this._errorHandler(d)}return()=>{let l=this._stacks.get(t.value)||0;this._stacks.set(t.value,l-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,s=0;for(let[r,o]of this._stacks)(!t||s<o)&&(t=[r,o],s=o);return t}};Wb._idPool=1;var ET=Wb,MT=class Vb{constructor(t){this.value=t}static create(){let t=new Error;return new Vb(t.stack??"")}print(){console.warn(this.value.split(`
|
|
89
|
+
`).slice(2).join(`
|
|
90
|
+
`))}},kT=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},DT=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},TT=0,Rd=class{constructor(e){this.value=e,this.id=TT++}},AT=2,NT,fe=class{constructor(t){var s,r,o,l;this._size=0,this._options=t,this._leakageMon=(s=this._options)!=null&&s.leakWarningThreshold?new ET((t==null?void 0:t.onListenerError)??Jc,((r=this._options)==null?void 0:r.leakWarningThreshold)??CT):void 0,this._perfMon=(o=this._options)!=null&&o._profName?new xT(this._options._profName):void 0,this._deliveryQueue=(l=this._options)==null?void 0:l.deliveryQueue}dispose(){var t,s,r,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),(r=(s=this._options)==null?void 0:s.onDidRemoveLastListener)==null||r.call(s),(o=this._leakageMon)==null||o.dispose())}get event(){return this._event??(this._event=(t,s,r)=>{var h,d,f,p,m;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let v=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(v);let S=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],y=new DT(`${v}. HINT: Stack shows most frequent listener (${S[1]}-times)`,S[0]);return(((h=this._options)==null?void 0:h.onListenerError)||Jc)(y),Ne.None}if(this._disposed)return Ne.None;s&&(t=t.bind(s));let o=new Rd(t),l;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(o.stack=MT.create(),l=this._leakageMon.check(o.stack,this._size+1)),this._listeners?this._listeners instanceof Rd?(this._deliveryQueue??(this._deliveryQueue=new RT),this._listeners=[this._listeners,o]):this._listeners.push(o):((f=(d=this._options)==null?void 0:d.onWillAddFirstListener)==null||f.call(d,this),this._listeners=o,(m=(p=this._options)==null?void 0:p.onDidAddFirstListener)==null||m.call(p,this)),this._size++;let u=tt(()=>{l==null||l(),this._removeListener(o)});return r instanceof wn?r.add(u):Array.isArray(r)&&r.push(u),u}),this._event}_removeListener(t){var l,u,h,d;if((u=(l=this._options)==null?void 0:l.onWillRemoveListener)==null||u.call(l,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(d=(h=this._options)==null?void 0:h.onDidRemoveLastListener)==null||d.call(h,this),this._size=0;return}let s=this._listeners,r=s.indexOf(t);if(r===-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--,s[r]=void 0;let o=this._deliveryQueue.current===this;if(this._size*AT<=s.length){let f=0;for(let p=0;p<s.length;p++)s[p]?s[f++]=s[p]:o&&(this._deliveryQueue.end--,f<this._deliveryQueue.i&&this._deliveryQueue.i--);s.length=f}}_deliver(t,s){var o;if(!t)return;let r=((o=this._options)==null?void 0:o.onListenerError)||Jc;if(!r){t.value(s);return}try{t.value(s)}catch(l){r(l)}}_deliverQueue(t){let s=t.current._listeners;for(;t.i<t.end;)this._deliver(s[t.i++],t.value);t.reset()}fire(t){var s,r,o,l;if((s=this._deliveryQueue)!=null&&s.current&&(this._deliverQueue(this._deliveryQueue),(r=this._perfMon)==null||r.stop()),(o=this._perfMon)==null||o.start(this._size),this._listeners)if(this._listeners instanceof Rd)this._deliver(this._listeners,t);else{let u=this._deliveryQueue;u.enqueue(this,t,this._listeners.length),this._deliverQueue(u)}(l=this._perfMon)==null||l.stop()}hasListeners(){return this._size>0}},RT=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,s){this.i=0,this.end=s,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},S_=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new fe,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new fe,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,s){if(this.getZoomLevel(s)===t)return;let r=this.getWindowId(s);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,s){this.mapWindowIdToZoomFactor.set(this.getWindowId(s),t)}setFullscreen(t,s){if(this.isFullscreen(s)===t)return;let r=this.getWindowId(s);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};S_.INSTANCE=new S_;var gg=S_;function BT(e,t,s){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",s)}gg.INSTANCE.onDidChangeZoomLevel;function LT(e){return gg.INSTANCE.getZoomFactor(e)}gg.INSTANCE.onDidChangeFullscreen;var So=typeof navigator=="object"?navigator.userAgent:"",b_=So.indexOf("Firefox")>=0,OT=So.indexOf("AppleWebKit")>=0,pg=So.indexOf("Chrome")>=0,zT=!pg&&So.indexOf("Safari")>=0;So.indexOf("Electron/")>=0;So.indexOf("Android")>=0;var Bd=!1;if(typeof Ns.matchMedia=="function"){let e=Ns.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Ns.matchMedia("(display-mode: fullscreen)");Bd=e.matches,BT(Ns,e,({matches:s})=>{Bd&&t.matches||(Bd=s)})}var oo="en",w_=!1,x_=!1,eu=!1,Xb=!1,Uc,tu=oo,Ny=oo,HT,Hi,rr=globalThis,Ht,zS;typeof rr.vscode<"u"&&typeof rr.vscode.process<"u"?Ht=rr.vscode.process:typeof process<"u"&&typeof((zS=process==null?void 0:process.versions)==null?void 0:zS.node)=="string"&&(Ht=process);var HS,PT=typeof((HS=Ht==null?void 0:Ht.versions)==null?void 0:HS.electron)=="string",UT=PT&&(Ht==null?void 0:Ht.type)==="renderer",PS;if(typeof Ht=="object"){w_=Ht.platform==="win32",x_=Ht.platform==="darwin",eu=Ht.platform==="linux",eu&&Ht.env.SNAP&&Ht.env.SNAP_REVISION,Ht.env.CI||Ht.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Uc=oo,tu=oo;let e=Ht.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Uc=t.userLocale,Ny=t.osLocale,tu=t.resolvedLanguage||oo,HT=(PS=t.languagePack)==null?void 0:PS.translationsConfigFile}catch{}Xb=!0}else typeof navigator=="object"&&!UT?(Hi=navigator.userAgent,w_=Hi.indexOf("Windows")>=0,x_=Hi.indexOf("Macintosh")>=0,(Hi.indexOf("Macintosh")>=0||Hi.indexOf("iPad")>=0||Hi.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,eu=Hi.indexOf("Linux")>=0,(Hi==null?void 0:Hi.indexOf("Mobi"))>=0,tu=globalThis._VSCODE_NLS_LANGUAGE||oo,Uc=navigator.language.toLowerCase(),Ny=Uc):console.error("Unable to resolve platform.");var Kb=w_,ts=x_,jT=eu,Ry=Xb,ss=Hi,pn=tu,IT;(e=>{function t(){return pn}e.value=t;function s(){return pn.length===2?pn==="en":pn.length>=3?pn[0]==="e"&&pn[1]==="n"&&pn[2]==="-":!1}e.isDefaultVariant=s;function r(){return pn==="en"}e.isDefault=r})(IT||(IT={}));var $T=typeof rr.postMessage=="function"&&!rr.importScripts;(()=>{if($T){let e=[];rr.addEventListener("message",s=>{if(s.data&&s.data.vscodeScheduleAsyncWork)for(let r=0,o=e.length;r<o;r++){let l=e[r];if(l.id===s.data.vscodeScheduleAsyncWork){e.splice(r,1),l.callback();return}}});let t=0;return s=>{let r=++t;e.push({id:r,callback:s}),rr.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var qT=!!(ss&&ss.indexOf("Chrome")>=0);ss&&ss.indexOf("Firefox")>=0;!qT&&ss&&ss.indexOf("Safari")>=0;ss&&ss.indexOf("Edg/")>=0;ss&&ss.indexOf("Android")>=0;var to=typeof navigator=="object"?navigator:{};Ry||document.queryCommandSupported&&document.queryCommandSupported("copy")||to&&to.clipboard&&to.clipboard.writeText,Ry||to&&to.clipboard&&to.clipboard.readText;var mg=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}},Ld=new mg,By=new mg,Ly=new mg,WT=new Array(230),Gb;(e=>{function t(h){return Ld.keyCodeToStr(h)}e.toString=t;function s(h){return Ld.strToKeyCode(h)}e.fromString=s;function r(h){return By.keyCodeToStr(h)}e.toUserSettingsUS=r;function o(h){return Ly.keyCodeToStr(h)}e.toUserSettingsGeneral=o;function l(h){return By.strToKeyCode(h)||Ly.strToKeyCode(h)}e.fromUserSettings=l;function u(h){if(h>=98&&h<=113)return null;switch(h){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Ld.keyCodeToStr(h)}e.toElectronAccelerator=u})(Gb||(Gb={}));var YT=class Fb{constructor(t,s,r,o,l){this.ctrlKey=t,this.shiftKey=s,this.altKey=r,this.metaKey=o,this.keyCode=l}equals(t){return t instanceof Fb&&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",s=this.shiftKey?"1":"0",r=this.altKey?"1":"0",o=this.metaKey?"1":"0";return`K${t}${s}${r}${o}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new VT([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},VT=class{constructor(e){if(e.length===0)throw mT("chords");this.chords=e}getHashCode(){let e="";for(let t=0,s=this.chords.length;t<s;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 XT(e){if(e.charCode){let s=String.fromCharCode(e.charCode).toUpperCase();return Gb.fromString(s)}let t=e.keyCode;if(t===3)return 7;if(b_)switch(t){case 59:return 85;case 60:if(jT)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(ts)return 57;break}else if(OT&&(ts&&t===93||!ts&&t===92))return 57;return WT[t]||0}var KT=ts?256:2048,GT=512,FT=1024,ZT=ts?2048:256,Oy=class{constructor(e){var s;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=(s=t.getModifierState)==null?void 0:s.call(t,"AltGraph"),this.keyCode=XT(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|=KT),this.altKey&&(t|=GT),this.shiftKey&&(t|=FT),this.metaKey&&(t|=ZT),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new YT(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},zy=new WeakMap;function QT(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,s=e.parent.location;if(t.origin!=="null"&&s.origin!=="null"&&t.origin!==s.origin)return null}catch{return null}return e.parent}var JT=class{static getSameOriginWindowChain(e){let t=zy.get(e);if(!t){t=[],zy.set(e,t);let s=e,r;do r=QT(s),r?t.push({window:new WeakRef(s),iframeElement:s.frameElement||null}):t.push({window:new WeakRef(s),iframeElement:null}),s=r;while(s)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let s=0,r=0,o=this.getSameOriginWindowChain(e);for(let l of o){let u=l.window.deref();if(s+=(u==null?void 0:u.scrollY)??0,r+=(u==null?void 0:u.scrollX)??0,u===t||!l.iframeElement)break;let h=l.iframeElement.getBoundingClientRect();s+=h.top,r+=h.left}return{top:s,left:r}}},jc=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 s=JT.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=s.left,this.posy-=s.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Hy=class{constructor(e,t=0,s=0){var o;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=s,this.deltaX=t;let r=!1;if(pg){let l=navigator.userAgent.match(/Chrome\/(\d+)/);r=(l?parseInt(l[1]):123)<=122}if(e){let l=e,u=e,h=((o=e.view)==null?void 0:o.devicePixelRatio)||1;if(typeof l.wheelDeltaY<"u")r?this.deltaY=l.wheelDeltaY/(120*h):this.deltaY=l.wheelDeltaY/120;else if(typeof u.VERTICAL_AXIS<"u"&&u.axis===u.VERTICAL_AXIS)this.deltaY=-u.detail/3;else if(e.type==="wheel"){let d=e;d.deltaMode===d.DOM_DELTA_LINE?b_&&!ts?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof l.wheelDeltaX<"u")zT&&Kb?this.deltaX=-(l.wheelDeltaX/120):r?this.deltaX=l.wheelDeltaX/(120*h):this.deltaX=l.wheelDeltaX/120;else if(typeof u.HORIZONTAL_AXIS<"u"&&u.axis===u.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let d=e;d.deltaMode===d.DOM_DELTA_LINE?b_&&!ts?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*h):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},Zb=Object.freeze(function(e,t){let s=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(s)}}}),eA;(e=>{function t(s){return s===e.None||s===e.Cancelled||s instanceof tA?!0:!s||typeof s!="object"?!1:typeof s.isCancellationRequested=="boolean"&&typeof s.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Pt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Zb})})(eA||(eA={}));var tA=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?Zb:(this._emitter||(this._emitter=new fe),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},vg=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 g_("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new g_("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},iA=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,s=globalThis){if(this.isDisposed)throw new g_("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=s.setInterval(()=>{e()},t);this.disposable=tt(()=>{s.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},sA;(e=>{async function t(r){let o,l=await Promise.all(r.map(u=>u.then(h=>h,h=>{o||(o=h)})));if(typeof o<"u")throw o;return l}e.settled=t;function s(r){return new Promise(async(o,l)=>{try{await r(o,l)}catch(u){l(u)}})}e.withAsyncBody=s})(sA||(sA={}));var Py=class Di{static fromArray(t){return new Di(s=>{s.emitMany(t)})}static fromPromise(t){return new Di(async s=>{s.emitMany(await t)})}static fromPromises(t){return new Di(async s=>{await Promise.all(t.map(async r=>s.emitOne(await r)))})}static merge(t){return new Di(async s=>{await Promise.all(t.map(async r=>{for await(let o of r)s.emitOne(o)}))})}constructor(t,s){this._state=0,this._results=[],this._error=null,this._onReturn=s,this._onStateChanged=new fe,queueMicrotask(async()=>{let r={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(t(r)),this.resolve()}catch(o){this.reject(o)}finally{r.emitOne=void 0,r.emitMany=void 0,r.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 Pt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var s;return(s=this._onReturn)==null||s.call(this),{done:!0,value:void 0}}}}static map(t,s){return new Di(async r=>{for await(let o of t)r.emitOne(s(o))})}map(t){return Di.map(this,t)}static filter(t,s){return new Di(async r=>{for await(let o of t)s(o)&&r.emitOne(o)})}filter(t){return Di.filter(this,t)}static coalesce(t){return Di.filter(t,s=>!!s)}coalesce(){return Di.coalesce(this)}static async toPromise(t){let s=[];for await(let r of t)s.push(r);return s}toPromise(){return Di.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())}};Py.EMPTY=Py.fromArray([]);var{getWindow:Ji,getWindowId:nA,onDidRegisterWindow:rA}=(function(){let e=new Map,t={window:Ns,disposables:new wn};e.set(Ns.vscodeWindowId,t);let s=new fe,r=new fe,o=new fe;function l(u,h){return(typeof u=="number"?e.get(u):void 0)??(h?t:void 0)}return{onDidRegisterWindow:s.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:r.event,registerWindow(u){if(e.has(u.vscodeWindowId))return Ne.None;let h=new wn,d={window:u,disposables:h.add(new wn)};return e.set(u.vscodeWindowId,d),h.add(tt(()=>{e.delete(u.vscodeWindowId),r.fire(u)})),h.add(Ee(u,kt.BEFORE_UNLOAD,()=>{o.fire(u)})),s.fire(d),h},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(u){return u.vscodeWindowId},hasWindow(u){return e.has(u)},getWindowById:l,getWindow(u){var f;let h=u;if((f=h==null?void 0:h.ownerDocument)!=null&&f.defaultView)return h.ownerDocument.defaultView.window;let d=u;return d!=null&&d.view?d.view.window:Ns},getDocument(u){return Ji(u).document}}})(),oA=class{constructor(e,t,s,r){this._node=e,this._type=t,this._handler=s,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Ee(e,t,s,r){return new oA(e,t,s,r)}var Uy=function(e,t,s,r){return Ee(e,t,s,r)},yg,aA=class extends iA{constructor(e){super(),this.defaultTarget=e&&Ji(e)}cancelAndSet(e,t,s){return super.cancelAndSet(e,t,s??this.defaultTarget)}},jy=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){Jc(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,s=new Map,r=new Map,o=l=>{s.set(l,!1);let u=e.get(l)??[];for(t.set(l,u),e.set(l,[]),r.set(l,!0);u.length>0;)u.sort(jy.sort),u.shift().execute();r.set(l,!1)};yg=(l,u,h=0)=>{let d=nA(l),f=new jy(u,h),p=e.get(d);return p||(p=[],e.set(d,p)),p.push(f),s.get(d)||(s.set(d,!0),l.requestAnimationFrame(()=>o(d))),f}})();function lA(e){let t=e.getBoundingClientRect(),s=Ji(e);return{left:t.left+s.scrollX,top:t.top+s.scrollY,width:t.width,height:t.height}}var kt={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"},cA=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=ii(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=ii(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=ii(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=ii(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=ii(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=ii(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=ii(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=ii(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=ii(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=ii(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=ii(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=ii(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=ii(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=ii(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 ii(e){return typeof e=="number"?`${e}px`:e}function Oa(e){return new cA(e)}var Qb=class{constructor(){this._hooks=new wn,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 s=this._onStopCallback;this._onStopCallback=null,e&&s&&s(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,s,r,o){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=o;let l=e;try{e.setPointerCapture(t),this._hooks.add(tt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{l=Ji(e)}this._hooks.add(Ee(l,kt.POINTER_MOVE,u=>{if(u.buttons!==s){this.stopMonitoring(!0);return}u.preventDefault(),this._pointerMoveCallback(u)})),this._hooks.add(Ee(l,kt.POINTER_UP,u=>this.stopMonitoring(!0)))}};function uA(e,t,s){let r=null,o=null;if(typeof s.value=="function"?(r="value",o=s.value,o.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof s.get=="function"&&(r="get",o=s.get),!o)throw new Error("not supported");let l=`$memoize$${t}`;s[r]=function(...u){return this.hasOwnProperty(l)||Object.defineProperty(this,l,{configurable:!1,enumerable:!1,writable:!1,value:o.apply(this,u)}),this[l]}}var Zi;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Zi||(Zi={}));var Da=class It extends Ne{constructor(){super(),this.dispatched=!1,this.targets=new Ay,this.ignoreTargets=new Ay,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Pt.runAndSubscribe(rA,({window:t,disposables:s})=>{s.add(Ee(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),s.add(Ee(t.document,"touchend",r=>this.onTouchEnd(t,r))),s.add(Ee(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:Ns,disposables:this._store}))}static addTarget(t){if(!It.isTouchDevice())return Ne.None;It.INSTANCE||(It.INSTANCE=new It);let s=It.INSTANCE.targets.push(t);return tt(s)}static ignoreTarget(t){if(!It.isTouchDevice())return Ne.None;It.INSTANCE||(It.INSTANCE=new It);let s=It.INSTANCE.ignoreTargets.push(t);return tt(s)}static isTouchDevice(){return"ontouchstart"in Ns||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let s=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,o=t.targetTouches.length;r<o;r++){let l=t.targetTouches.item(r);this.activeTouches[l.identifier]={id:l.identifier,initialTarget:l.target,initialTimeStamp:s,initialPageX:l.pageX,initialPageY:l.pageY,rollingTimestamps:[s],rollingPageX:[l.pageX],rollingPageY:[l.pageY]};let u=this.newGestureEvent(Zi.Start,l.target);u.pageX=l.pageX,u.pageY=l.pageY,this.dispatchEvent(u)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,s){let r=Date.now(),o=Object.keys(this.activeTouches).length;for(let l=0,u=s.changedTouches.length;l<u;l++){let h=s.changedTouches.item(l);if(!this.activeTouches.hasOwnProperty(String(h.identifier))){console.warn("move of an UNKNOWN touch",h);continue}let d=this.activeTouches[h.identifier],f=Date.now()-d.initialTimeStamp;if(f<It.HOLD_DELAY&&Math.abs(d.initialPageX-_i(d.rollingPageX))<30&&Math.abs(d.initialPageY-_i(d.rollingPageY))<30){let p=this.newGestureEvent(Zi.Tap,d.initialTarget);p.pageX=_i(d.rollingPageX),p.pageY=_i(d.rollingPageY),this.dispatchEvent(p)}else if(f>=It.HOLD_DELAY&&Math.abs(d.initialPageX-_i(d.rollingPageX))<30&&Math.abs(d.initialPageY-_i(d.rollingPageY))<30){let p=this.newGestureEvent(Zi.Contextmenu,d.initialTarget);p.pageX=_i(d.rollingPageX),p.pageY=_i(d.rollingPageY),this.dispatchEvent(p)}else if(o===1){let p=_i(d.rollingPageX),m=_i(d.rollingPageY),v=_i(d.rollingTimestamps)-d.rollingTimestamps[0],S=p-d.rollingPageX[0],y=m-d.rollingPageY[0],b=[...this.targets].filter(x=>d.initialTarget instanceof Node&&x.contains(d.initialTarget));this.inertia(t,b,r,Math.abs(S)/v,S>0?1:-1,p,Math.abs(y)/v,y>0?1:-1,m)}this.dispatchEvent(this.newGestureEvent(Zi.End,d.initialTarget)),delete this.activeTouches[h.identifier]}this.dispatched&&(s.preventDefault(),s.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,s){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=s,r.tapCount=0,r}dispatchEvent(t){if(t.type===Zi.Tap){let s=new Date().getTime(),r=0;s-this._lastSetTapCountTime>It.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=s,t.tapCount=r}else(t.type===Zi.Change||t.type===Zi.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let s=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let o=0,l=t.initialTarget;for(;l&&l!==r;)o++,l=l.parentElement;s.push([o,r])}s.sort((r,o)=>r[0]-o[0]);for(let[r,o]of s)o.dispatchEvent(t),this.dispatched=!0}}inertia(t,s,r,o,l,u,h,d,f){this.handle=yg(t,()=>{let p=Date.now(),m=p-r,v=0,S=0,y=!0;o+=It.SCROLL_FRICTION*m,h+=It.SCROLL_FRICTION*m,o>0&&(y=!1,v=l*o*m),h>0&&(y=!1,S=d*h*m);let b=this.newGestureEvent(Zi.Change);b.translationX=v,b.translationY=S,s.forEach(x=>x.dispatchEvent(b)),y||this.inertia(t,s,p,o,l,u+v,h,d,f+S)})}onTouchMove(t){let s=Date.now();for(let r=0,o=t.changedTouches.length;r<o;r++){let l=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("end of an UNKNOWN touch",l);continue}let u=this.activeTouches[l.identifier],h=this.newGestureEvent(Zi.Change,u.initialTarget);h.translationX=l.pageX-_i(u.rollingPageX),h.translationY=l.pageY-_i(u.rollingPageY),h.pageX=l.pageX,h.pageY=l.pageY,this.dispatchEvent(h),u.rollingPageX.length>3&&(u.rollingPageX.shift(),u.rollingPageY.shift(),u.rollingTimestamps.shift()),u.rollingPageX.push(l.pageX),u.rollingPageY.push(l.pageY),u.rollingTimestamps.push(s)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Da.SCROLL_FRICTION=-.005,Da.HOLD_DELAY=700,Da.CLEAR_TAP_COUNT_TIME=400,lt([uA],Da,"isTouchDevice",1);var hA=Da,Sg=class extends Ne{onclick(e,t){this._register(Ee(e,kt.CLICK,s=>t(new jc(Ji(e),s))))}onmousedown(e,t){this._register(Ee(e,kt.MOUSE_DOWN,s=>t(new jc(Ji(e),s))))}onmouseover(e,t){this._register(Ee(e,kt.MOUSE_OVER,s=>t(new jc(Ji(e),s))))}onmouseleave(e,t){this._register(Ee(e,kt.MOUSE_LEAVE,s=>t(new jc(Ji(e),s))))}onkeydown(e,t){this._register(Ee(e,kt.KEY_DOWN,s=>t(new Oy(s))))}onkeyup(e,t){this._register(Ee(e,kt.KEY_UP,s=>t(new Oy(s))))}oninput(e,t){this._register(Ee(e,kt.INPUT,t))}onblur(e,t){this._register(Ee(e,kt.BLUR,t))}onfocus(e,t){this._register(Ee(e,kt.FOCUS,t))}onchange(e,t){this._register(Ee(e,kt.CHANGE,t))}ignoreGesture(e){return hA.ignoreTarget(e)}},Iy=11,fA=class extends Sg{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=Iy+"px",this.domNode.style.height=Iy+"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(Uy(this.bgDomNode,kt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Uy(this.domNode,kt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new aA),this._pointerdownScheduleRepeatTimer=this._register(new vg)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Ji(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},dA=class C_{constructor(t,s,r,o,l,u,h){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(s=s|0,r=r|0,o=o|0,l=l|0,u=u|0,h=h|0),this.rawScrollLeft=o,this.rawScrollTop=h,s<0&&(s=0),o+s>r&&(o=r-s),o<0&&(o=0),l<0&&(l=0),h+l>u&&(h=u-l),h<0&&(h=0),this.width=s,this.scrollWidth=r,this.scrollLeft=o,this.height=l,this.scrollHeight=u,this.scrollTop=h}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,s){return new C_(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,s?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,s?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new C_(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,s){let r=this.width!==t.width,o=this.scrollWidth!==t.scrollWidth,l=this.scrollLeft!==t.scrollLeft,u=this.height!==t.height,h=this.scrollHeight!==t.scrollHeight,d=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:s,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:r,scrollWidthChanged:o,scrollLeftChanged:l,heightChanged:u,scrollHeightChanged:h,scrollTopChanged:d}}},_A=class extends Ne{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new fe),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new dA(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 r;let s=this._state.withScrollDimensions(e,t);this._setState(s,!!this._smoothScrolling),(r=this._smoothScrolling)==null||r.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 s=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===s.scrollLeft&&this._smoothScrolling.to.scrollTop===s.scrollTop)return;let r;t?r=new qy(this._smoothScrolling.from,s,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,s,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let s=this._state.withScrollPosition(e);this._smoothScrolling=qy.start(this._state,s,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 s=this._state;s.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(s,t)))}},$y=class{constructor(e,t,s){this.scrollLeft=e,this.scrollTop=t,this.isDone=s}};function Od(e,t){let s=t-e;return function(r){return e+s*mA(r)}}function gA(e,t,s){return function(r){return r<s?e(r/s):t((r-s)/(1-s))}}var qy=class E_{constructor(t,s,r,o){this.from=t,this.to=s,this.duration=o,this.startTime=r,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,s,r){if(Math.abs(t-s)>2.5*r){let o,l;return t<s?(o=t+.75*r,l=s-.75*r):(o=t-.75*r,l=s+.75*r),gA(Od(t,o),Od(l,s),.33)}return Od(t,s)}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 s=(t-this.startTime)/this.duration;if(s<1){let r=this.scrollLeft(s),o=this.scrollTop(s);return new $y(r,o,!1)}return new $y(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,s,r){return E_.start(t,s,r)}static start(t,s,r){r=r+10;let o=Date.now()-10;return new E_(t,s,o,r)}};function pA(e){return Math.pow(e,3)}function mA(e){return 1-pA(1-e)}var vA=class extends Ne{constructor(e,t,s){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=s,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new vg)}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":"")))}},yA=140,Jb=class extends Sg{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 vA(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=Oa(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(Ee(this.domNode.domNode,kt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new fA(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,s,r){this.slider=Oa(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof s=="number"&&this.slider.setWidth(s),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Ee(this.slider.domNode,kt.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,s=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),o=this._sliderPointerPosition(e);s<=o&&o<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,s;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,s=e.offsetY;else{let o=lA(this.domNode.domNode);t=e.pageX-o.left,s=e.pageY-o.top}let r=this._pointerDownRelativePosition(t,s);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),s=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,o=>{let l=this._sliderOrthogonalPointerPosition(o),u=Math.abs(l-s);if(Kb&&u>yA){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let h=this._sliderPointerPosition(o)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(h))},()=>{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()}},ew=class M_{constructor(t,s,r,o,l,u){this._scrollbarSize=Math.round(s),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=o,this._scrollSize=l,this._scrollPosition=u,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new M_(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let s=Math.round(t);return this._visibleSize!==s?(this._visibleSize=s,this._refreshComputedValues(),!0):!1}setScrollSize(t){let s=Math.round(t);return this._scrollSize!==s?(this._scrollSize=s,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let s=Math.round(t);return this._scrollPosition!==s?(this._scrollPosition=s,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,s,r,o,l){let u=Math.max(0,r-t),h=Math.max(0,u-2*s),d=o>0&&o>r;if(!d)return{computedAvailableSize:Math.round(u),computedIsNeeded:d,computedSliderSize:Math.round(h),computedSliderRatio:0,computedSliderPosition:0};let f=Math.round(Math.max(20,Math.floor(r*h/o))),p=(h-f)/(o-r),m=l*p;return{computedAvailableSize:Math.round(u),computedIsNeeded:d,computedSliderSize:Math.round(f),computedSliderRatio:p,computedSliderPosition:Math.round(m)}}_refreshComputedValues(){let t=M_._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 s=t-this._arrowSize-this._computedSliderSize/2;return Math.round(s/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let s=t-this._arrowSize,r=this._scrollPosition;return s<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let s=this._computedSliderPosition+t;return Math.round(s/this._computedSliderRatio)}},SA=class extends Jb{constructor(e,t,s){let r=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new ew(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.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}},bA=class extends Jb{constructor(e,t,s){let r=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new ew(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.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}},wA=500,Wy=50,xA=class{constructor(e,t,s){this.timestamp=e,this.deltaX=t,this.deltaY=s,this.score=0}},k_=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,s=0,r=1,o=this._rear;do{let l=o===this._front?t:Math.pow(2,-r);if(t-=l,s+=this._memory[o].score*l,o===this._front)break;o=(this._capacity+o-1)%this._capacity,r++}while(!0);return s<=.5}acceptStandardWheelEvent(t){if(pg){let s=Ji(t.browserEvent),r=LT(s);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,s,r){let o=null,l=new xA(t,s,r);this._front===-1&&this._rear===-1?(this._memory[0]=l,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]=l),l.score=this._computeScore(l,o)}_computeScore(t,s){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),s){let o=Math.abs(t.deltaX),l=Math.abs(t.deltaY),u=Math.abs(s.deltaX),h=Math.abs(s.deltaY),d=Math.max(Math.min(o,u),1),f=Math.max(Math.min(l,h),1),p=Math.max(o,u),m=Math.max(l,h);p%d===0&&m%f===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};k_.INSTANCE=new k_;var CA=k_,EA=class extends Sg{constructor(e,t,s){super(),this._onScroll=this._register(new fe),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new fe),this.onWillScroll=this._onWillScroll.event,this._options=kA(t),this._scrollable=s,this._register(this._scrollable.onScroll(o=>{this._onWillScroll.fire(o),this._onDidScroll(o),this._onScroll.fire(o)}));let r={onMouseWheel:o=>this._onMouseWheel(o),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new bA(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new SA(this._scrollable,this._options,r)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Oa(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Oa(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Oa(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 vg),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=ur(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,ts&&(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 Hy(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=ur(this._mouseWheelToDispose),e)){let t=s=>{this._onMouseWheel(new Hy(s))};this._mouseWheelToDispose.push(Ee(this._listenOnDomNode,kt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var o;if((o=e.browserEvent)!=null&&o.defaultPrevented)return;let t=CA.INSTANCE;t.acceptStandardWheelEvent(e);let s=!1;if(e.deltaY||e.deltaX){let l=e.deltaY*this._options.mouseWheelScrollSensitivity,u=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&u+l===0?u=l=0:Math.abs(l)>=Math.abs(u)?u=0:l=0),this._options.flipAxes&&([l,u]=[u,l]);let h=!ts&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||h)&&!u&&(u=l,l=0),e.browserEvent&&e.browserEvent.altKey&&(u=u*this._options.fastScrollSensitivity,l=l*this._options.fastScrollSensitivity);let d=this._scrollable.getFutureScrollPosition(),f={};if(l){let p=Wy*l,m=d.scrollTop-(p<0?Math.floor(p):Math.ceil(p));this._verticalScrollbar.writeScrollPosition(f,m)}if(u){let p=Wy*u,m=d.scrollLeft-(p<0?Math.floor(p):Math.ceil(p));this._horizontalScrollbar.writeScrollPosition(f,m)}f=this._scrollable.validateScrollPosition(f),(d.scrollLeft!==f.scrollLeft||d.scrollTop!==f.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(f):this._scrollable.setScrollPositionNow(f),s=!0)}let r=s;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_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,s=e.scrollLeft>0,r=s?" left":"",o=t?" top":"",l=s||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${o}`),this._topLeftShadowDomNode.setClassName(`shadow${l}${o}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),wA)}},MA=class extends EA{constructor(e,t,s){super(e,t,s)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function kA(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,ts&&(t.className+=" mac"),t}var D_=class extends Ne{constructor(e,t,s,r,o,l,u,h){super(),this._bufferService=s,this._optionsService=u,this._renderService=h,this._onRequestScrollLines=this._register(new fe),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let d=this._register(new _A({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:f=>yg(r.window,f)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{d.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new MA(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},d)),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(Pt.runAndSubscribe(l.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=l.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(tt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(tt(()=>this._styleElement.remove())),this._register(Pt.runAndSubscribe(l.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${l.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${l.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${l.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
91
|
+
`)})),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),s=t-this._bufferService.buffer.ydisp;s!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(s)),this._isHandlingScroll=!1}};D_=lt([ge(2,Vt),ge(3,Os),ge(4,Lb),ge(5,yo),ge(6,Xt),ge(7,zs)],D_);var T_=class extends Ne{constructor(e,t,s,r,o){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=s,this._decorationService=r,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(l=>this._removeDecoration(l))),this._register(tt(()=>{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 r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.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 s=e.options.x??0;return s&&s>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 s=this._decorationElements.get(e);s||(s=this._createElement(e),e.element=s,this._decorationElements.set(e,s),this._container.appendChild(s),e.onDispose(()=>{this._decorationElements.delete(e),s.remove()})),s.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(s.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,s.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,s.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,s.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(s)}}_refreshXPosition(e,t=e.element){if(!t)return;let s=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=s?`${s*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=s?`${s*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};T_=lt([ge(1,Vt),ge(2,Os),ge(3,sl),ge(4,zs)],T_);var DA=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,s){return t>=e.startBufferLine-this._linePadding[s||"full"]&&t<=e.endBufferLine+this._linePadding[s||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Gi={full:0,left:0,center:0,right:0},mn={full:0,left:0,center:0,right:0},va={full:0,left:0,center:0,right:0},Su=class extends Ne{constructor(e,t,s,r,o,l,u,h){var f;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=s,this._decorationService=r,this._renderService=o,this._optionsService=l,this._themeService=u,this._coreBrowserService=h,this._colorZoneStore=new DA,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(tt(()=>{var p;return(p=this._canvas)==null?void 0:p.remove()}));let d=this._canvas.getContext("2d");if(d)this._ctx=d;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);mn.full=this._canvas.width,mn.left=e,mn.center=t,mn.right=e,this._refreshDrawHeightConstants(),va.full=1,va.left=1,va.center=1+mn.left,va.right=1+mn.left+mn.center}_refreshDrawHeightConstants(){Gi.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);Gi.left=t,Gi.center=t,Gi.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Gi.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Gi.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Gi.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Gi.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(va[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Gi[e.position||"full"]/2),mn[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Gi[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}))}};Su=lt([ge(2,Vt),ge(3,sl),ge(4,zs),ge(5,Xt),ge(6,yo),ge(7,Os)],Su);var ae;(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=`
|
|
92
|
+
`,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=""))(ae||(ae={}));var iu;(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=""))(iu||(iu={}));var tw;(e=>e.ST=`${ae.ESC}\\`)(tw||(tw={}));var A_=class{constructor(e,t,s,r,o,l){this._textarea=e,this._compositionView=t,this._bufferService=s,this._optionsService=r,this._coreService=o,this._renderService=l,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 s;t.start+=this._dataAlreadySent.length,this._isComposing?s=this._textarea.value.substring(t.start,this._compositionPosition.start):s=this._textarea.value.substring(t.start),s.length>0&&this._coreService.triggerDataEvent(s,!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,s=t.replace(e,"");this._dataAlreadySent=s,t.length>e.length?this._coreService.triggerDataEvent(s,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ae.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),s=this._renderService.dimensions.css.cell.height,r=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=r+"px",this._compositionView.style.height=s+"px",this._compositionView.style.lineHeight=s+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let l=this._compositionView.getBoundingClientRect();this._textarea.style.left=o+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(l.width,1)+"px",this._textarea.style.height=Math.max(l.height,1)+"px",this._textarea.style.lineHeight=l.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};A_=lt([ge(2,Vt),ge(3,Xt),ge(4,fr),ge(5,zs)],A_);var Dt=0,Tt=0,At=0,at=0,Yy={css:"#00000000",rgba:0},vt;(e=>{function t(o,l,u,h){return h!==void 0?`#${Fn(o)}${Fn(l)}${Fn(u)}${Fn(h)}`:`#${Fn(o)}${Fn(l)}${Fn(u)}`}e.toCss=t;function s(o,l,u,h=255){return(o<<24|l<<16|u<<8|h)>>>0}e.toRgba=s;function r(o,l,u,h){return{css:e.toCss(o,l,u,h),rgba:e.toRgba(o,l,u,h)}}e.toColor=r})(vt||(vt={}));var Qe;(e=>{function t(d,f){if(at=(f.rgba&255)/255,at===1)return{css:f.css,rgba:f.rgba};let p=f.rgba>>24&255,m=f.rgba>>16&255,v=f.rgba>>8&255,S=d.rgba>>24&255,y=d.rgba>>16&255,b=d.rgba>>8&255;Dt=S+Math.round((p-S)*at),Tt=y+Math.round((m-y)*at),At=b+Math.round((v-b)*at);let x=vt.toCss(Dt,Tt,At),C=vt.toRgba(Dt,Tt,At);return{css:x,rgba:C}}e.blend=t;function s(d){return(d.rgba&255)===255}e.isOpaque=s;function r(d,f,p){let m=su.ensureContrastRatio(d.rgba,f.rgba,p);if(m)return vt.toColor(m>>24&255,m>>16&255,m>>8&255)}e.ensureContrastRatio=r;function o(d){let f=(d.rgba|255)>>>0;return[Dt,Tt,At]=su.toChannels(f),{css:vt.toCss(Dt,Tt,At),rgba:f}}e.opaque=o;function l(d,f){return at=Math.round(f*255),[Dt,Tt,At]=su.toChannels(d.rgba),{css:vt.toCss(Dt,Tt,At,at),rgba:vt.toRgba(Dt,Tt,At,at)}}e.opacity=l;function u(d,f){return at=d.rgba&255,l(d,at*f/255)}e.multiplyOpacity=u;function h(d){return[d.rgba>>24&255,d.rgba>>16&255,d.rgba>>8&255]}e.toColorRGB=h})(Qe||(Qe={}));var nt;(e=>{let t,s;try{let o=document.createElement("canvas");o.width=1,o.height=1;let l=o.getContext("2d",{willReadFrequently:!0});l&&(t=l,t.globalCompositeOperation="copy",s=t.createLinearGradient(0,0,1,1))}catch{}function r(o){if(o.match(/#[\da-f]{3,8}/i))switch(o.length){case 4:return Dt=parseInt(o.slice(1,2).repeat(2),16),Tt=parseInt(o.slice(2,3).repeat(2),16),At=parseInt(o.slice(3,4).repeat(2),16),vt.toColor(Dt,Tt,At);case 5:return Dt=parseInt(o.slice(1,2).repeat(2),16),Tt=parseInt(o.slice(2,3).repeat(2),16),At=parseInt(o.slice(3,4).repeat(2),16),at=parseInt(o.slice(4,5).repeat(2),16),vt.toColor(Dt,Tt,At,at);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 l=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(l)return Dt=parseInt(l[1]),Tt=parseInt(l[2]),At=parseInt(l[3]),at=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),vt.toColor(Dt,Tt,At,at);if(!t||!s)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=s,t.fillStyle=o,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Dt,Tt,At,at]=t.getImageData(0,0,1,1).data,at!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:vt.toRgba(Dt,Tt,At,at),css:o}}e.toColor=r})(nt||(nt={}));var Yt;(e=>{function t(r){return s(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function s(r,o,l){let u=r/255,h=o/255,d=l/255,f=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),p=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),m=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4);return f*.2126+p*.7152+m*.0722}e.relativeLuminance2=s})(Yt||(Yt={}));var su;(e=>{function t(u,h){if(at=(h&255)/255,at===1)return h;let d=h>>24&255,f=h>>16&255,p=h>>8&255,m=u>>24&255,v=u>>16&255,S=u>>8&255;return Dt=m+Math.round((d-m)*at),Tt=v+Math.round((f-v)*at),At=S+Math.round((p-S)*at),vt.toRgba(Dt,Tt,At)}e.blend=t;function s(u,h,d){let f=Yt.relativeLuminance(u>>8),p=Yt.relativeLuminance(h>>8);if(Ts(f,p)<d){if(p<f){let S=r(u,h,d),y=Ts(f,Yt.relativeLuminance(S>>8));if(y<d){let b=o(u,h,d),x=Ts(f,Yt.relativeLuminance(b>>8));return y>x?S:b}return S}let m=o(u,h,d),v=Ts(f,Yt.relativeLuminance(m>>8));if(v<d){let S=r(u,h,d),y=Ts(f,Yt.relativeLuminance(S>>8));return v>y?m:S}return m}}e.ensureContrastRatio=s;function r(u,h,d){let f=u>>24&255,p=u>>16&255,m=u>>8&255,v=h>>24&255,S=h>>16&255,y=h>>8&255,b=Ts(Yt.relativeLuminance2(v,S,y),Yt.relativeLuminance2(f,p,m));for(;b<d&&(v>0||S>0||y>0);)v-=Math.max(0,Math.ceil(v*.1)),S-=Math.max(0,Math.ceil(S*.1)),y-=Math.max(0,Math.ceil(y*.1)),b=Ts(Yt.relativeLuminance2(v,S,y),Yt.relativeLuminance2(f,p,m));return(v<<24|S<<16|y<<8|255)>>>0}e.reduceLuminance=r;function o(u,h,d){let f=u>>24&255,p=u>>16&255,m=u>>8&255,v=h>>24&255,S=h>>16&255,y=h>>8&255,b=Ts(Yt.relativeLuminance2(v,S,y),Yt.relativeLuminance2(f,p,m));for(;b<d&&(v<255||S<255||y<255);)v=Math.min(255,v+Math.ceil((255-v)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),b=Ts(Yt.relativeLuminance2(v,S,y),Yt.relativeLuminance2(f,p,m));return(v<<24|S<<16|y<<8|255)>>>0}e.increaseLuminance=o;function l(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=l})(su||(su={}));function Fn(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Ts(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var TA=class extends il{constructor(e,t,s){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=s}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},bu=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Ai}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 s=[],r=t.translateToString(!0),o=0,l=0,u=0,h=t.getFg(0),d=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!==h||this._workCell.bg!==d){if(f-o>1){let p=this._getJoinedRanges(r,u,l,t,o);for(let m=0;m<p.length;m++)s.push(p[m])}o=f,u=l,h=this._workCell.fg,d=this._workCell.bg}l+=this._workCell.getChars().length||bn.length}if(this._bufferService.cols-o>1){let f=this._getJoinedRanges(r,u,l,t,o);for(let p=0;p<f.length;p++)s.push(f[p])}return s}_getJoinedRanges(e,t,s,r,o){let l=e.substring(t,s),u=[];try{u=this._characterJoiners[0].handler(l)}catch(h){console.error(h)}for(let h=1;h<this._characterJoiners.length;h++)try{let d=this._characterJoiners[h].handler(l);for(let f=0;f<d.length;f++)bu._mergeRanges(u,d[f])}catch(d){console.error(d)}return this._stringRangesToCellRanges(u,r,o),u}_stringRangesToCellRanges(e,t,s){let r=0,o=!1,l=0,u=e[r];if(u){for(let h=s;h<this._bufferService.cols;h++){let d=t.getWidth(h),f=t.getString(h).length||bn.length;if(d!==0){if(!o&&u[0]<=l&&(u[0]=h,o=!0),u[1]<=l){if(u[1]=h,u=e[++r],!u)break;u[0]<=l?(u[0]=h,o=!0):o=!1}l+=f}}u&&(u[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let s=!1;for(let r=0;r<e.length;r++){let o=e[r];if(s){if(t[1]<=o[0])return e[r-1][1]=t[1],e;if(t[1]<=o[1])return e[r-1][1]=Math.max(t[1],o[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=o[0])return e.splice(r,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]),s=!0);continue}}return s?e[e.length-1][1]=t[1]:e.push(t),e}};bu=lt([ge(0,Vt)],bu);function AA(e){return 57508<=e&&e<=57558}function NA(e){return 9472<=e&&e<=9631}function RA(e){return AA(e)||NA(e)}function BA(){return{css:{canvas:Ic(),cell:Ic()},device:{canvas:Ic(),cell:Ic(),char:{width:0,height:0,left:0,top:0}}}}function Ic(){return{width:0,height:0}}var N_=class{constructor(e,t,s,r,o,l,u){this._document=e,this._characterJoinerService=t,this._optionsService=s,this._coreBrowserService=r,this._coreService=o,this._decorationService=l,this._themeService=u,this._workCell=new Ai,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,s){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=s}createRow(e,t,s,r,o,l,u,h,d,f,p){let m=[],v=this._characterJoinerService.getJoinedCharacters(t),S=this._themeService.colors,y=e.getNoBgTrimmedLength();s&&y<l+1&&(y=l+1);let b,x=0,C="",A=0,E=0,D=0,H=0,O=!1,P=0,V=!1,G=0,ne=0,X=[],$=f!==-1&&p!==-1;for(let q=0;q<y;q++){e.loadCell(q,this._workCell);let N=this._workCell.getWidth();if(N===0)continue;let z=!1,M=q>=ne,L=q,B=this._workCell;if(v.length>0&&q===v[0][0]&&M){let de=v.shift(),ke=this._isCellInSelection(de[0],t);for(A=de[0]+1;A<de[1];A++)M&&(M=ke===this._isCellInSelection(A,t));M&&(M=!s||l<de[0]||l>=de[1]),M?(z=!0,B=new TA(this._workCell,e.translateToString(!0,de[0],de[1]),de[1]-de[0]),L=de[1]-1,N=B.getWidth()):ne=de[1]}let j=this._isCellInSelection(q,t),Z=s&&q===l,R=$&&q>=f&&q<=p,W=!1;this._decorationService.forEachDecorationAtCell(q,t,void 0,de=>{W=!0});let ee=B.getChars()||bn;if(ee===" "&&(B.isUnderline()||B.isOverline())&&(ee=" "),G=N*h-d.get(ee,B.isBold(),B.isItalic()),!b)b=this._document.createElement("span");else if(x&&(j&&V||!j&&!V&&B.bg===E)&&(j&&V&&S.selectionForeground||B.fg===D)&&B.extended.ext===H&&R===O&&G===P&&!Z&&!z&&!W&&M){B.isInvisible()?C+=bn:C+=ee,x++;continue}else x&&(b.textContent=C),b=this._document.createElement("span"),x=0,C="";if(E=B.bg,D=B.fg,H=B.extended.ext,O=R,P=G,V=j,z&&l>=q&&l<=L&&(l=q),!this._coreService.isCursorHidden&&Z&&this._coreService.isCursorInitialized){if(X.push("xterm-cursor"),this._coreBrowserService.isFocused)u&&X.push("xterm-cursor-blink"),X.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(o)switch(o){case"outline":X.push("xterm-cursor-outline");break;case"block":X.push("xterm-cursor-block");break;case"bar":X.push("xterm-cursor-bar");break;case"underline":X.push("xterm-cursor-underline");break}}if(B.isBold()&&X.push("xterm-bold"),B.isItalic()&&X.push("xterm-italic"),B.isDim()&&X.push("xterm-dim"),B.isInvisible()?C=bn:C=B.getChars()||bn,B.isUnderline()&&(X.push(`xterm-underline-${B.extended.underlineStyle}`),C===" "&&(C=" "),!B.isUnderlineColorDefault()))if(B.isUnderlineColorRGB())b.style.textDecorationColor=`rgb(${il.toColorRGB(B.getUnderlineColor()).join(",")})`;else{let de=B.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&B.isBold()&&de<8&&(de+=8),b.style.textDecorationColor=S.ansi[de].css}B.isOverline()&&(X.push("xterm-overline"),C===" "&&(C=" ")),B.isStrikethrough()&&X.push("xterm-strikethrough"),R&&(b.style.textDecoration="underline");let te=B.getFgColor(),le=B.getFgColorMode(),ce=B.getBgColor(),he=B.getBgColorMode(),ue=!!B.isInverse();if(ue){let de=te;te=ce,ce=de;let ke=le;le=he,he=ke}let _e,Ce,be=!1;this._decorationService.forEachDecorationAtCell(q,t,void 0,de=>{de.options.layer!=="top"&&be||(de.backgroundColorRGB&&(he=50331648,ce=de.backgroundColorRGB.rgba>>8&16777215,_e=de.backgroundColorRGB),de.foregroundColorRGB&&(le=50331648,te=de.foregroundColorRGB.rgba>>8&16777215,Ce=de.foregroundColorRGB),be=de.options.layer==="top")}),!be&&j&&(_e=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,ce=_e.rgba>>8&16777215,he=50331648,be=!0,S.selectionForeground&&(le=50331648,te=S.selectionForeground.rgba>>8&16777215,Ce=S.selectionForeground)),be&&X.push("xterm-decoration-top");let me;switch(he){case 16777216:case 33554432:me=S.ansi[ce],X.push(`xterm-bg-${ce}`);break;case 50331648:me=vt.toColor(ce>>16,ce>>8&255,ce&255),this._addStyle(b,`background-color:#${Vy((ce>>>0).toString(16),"0",6)}`);break;case 0:default:ue?(me=S.foreground,X.push("xterm-bg-257")):me=S.background}switch(_e||B.isDim()&&(_e=Qe.multiplyOpacity(me,.5)),le){case 16777216:case 33554432:B.isBold()&&te<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(te+=8),this._applyMinimumContrast(b,me,S.ansi[te],B,_e,void 0)||X.push(`xterm-fg-${te}`);break;case 50331648:let de=vt.toColor(te>>16&255,te>>8&255,te&255);this._applyMinimumContrast(b,me,de,B,_e,Ce)||this._addStyle(b,`color:#${Vy(te.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(b,me,S.foreground,B,_e,Ce)||ue&&X.push("xterm-fg-257")}X.length&&(b.className=X.join(" "),X.length=0),!Z&&!z&&!W&&M?x++:b.textContent=C,G!==this.defaultSpacing&&(b.style.letterSpacing=`${G}px`),m.push(b),q=L}return b&&x&&(b.textContent=C),m}_applyMinimumContrast(e,t,s,r,o,l){if(this._optionsService.rawOptions.minimumContrastRatio===1||RA(r.getCode()))return!1;let u=this._getContrastCache(r),h;if(!o&&!l&&(h=u.getColor(t.rgba,s.rgba)),h===void 0){let d=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);h=Qe.ensureContrastRatio(o||t,l||s,d),u.setColor((o||t).rgba,(l||s).rgba,h??null)}return h?(this._addStyle(e,`color:${h.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 s=this._selectionStart,r=this._selectionEnd;return!s||!r?!1:this._columnSelectMode?s[0]<=r[0]?e>=s[0]&&t>=s[1]&&e<r[0]&&t<=r[1]:e<s[0]&&t>=s[1]&&e>=r[0]&&t<=r[1]:t>s[1]&&t<r[1]||s[1]===r[1]&&t===s[1]&&e>=s[0]&&e<r[0]||s[1]<r[1]&&t===r[1]&&e<r[0]||s[1]<r[1]&&t===s[1]&&e>=s[0]}};N_=lt([ge(1,Hb),ge(2,Xt),ge(3,Os),ge(4,fr),ge(5,sl),ge(6,yo)],N_);function Vy(e,t,s){for(;e.length<s;)e=t+e;return e}var LA=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 s=e.createElement("span");s.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontStyle="italic";let l=e.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontWeight="bold",l.style.fontStyle="italic",this._measureElements=[s,r,o,l],this._container.appendChild(s),this._container.appendChild(r),this._container.appendChild(o),this._container.appendChild(l),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,s,r){e===this._font&&t===this._fontSize&&s===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=s,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${s}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${s}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,s){let r=0;if(!t&&!s&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let u=this._measure(e,0);return u>0&&(this._flat[r]=u),u}let o=e;t&&(o+="B"),s&&(o+="I");let l=this._holey.get(o);if(l===void 0){let u=0;t&&(u|=1),s&&(u|=2),l=this._measure(e,u),l>0&&this._holey.set(o,l)}return l}_measure(e,t){let s=this._measureElements[t];return s.textContent=e.repeat(32),s.offsetWidth/32}},OA=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,s,r=!1){if(this.selectionStart=t,this.selectionEnd=s,!t||!s||t[0]===s[0]&&t[1]===s[1]){this.clear();return}let o=e.buffers.active.ydisp,l=t[1]-o,u=s[1]-o,h=Math.max(l,0),d=Math.min(u,e.rows-1);if(h>=e.rows||d<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=l,this.viewportEndRow=u,this.viewportCappedStartRow=h,this.viewportCappedEndRow=d,this.startCol=t[0],this.endCol=s[0]}isCellSelected(e,t,s){return this.hasSelection?(s-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&s>=this.viewportCappedStartRow&&t<this.endCol&&s<=this.viewportCappedEndRow:t<this.startCol&&s>=this.viewportCappedStartRow&&t>=this.endCol&&s<=this.viewportCappedEndRow:s>this.viewportStartRow&&s<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol):!1}};function zA(){return new OA}var zd="xterm-dom-renderer-owner-",ki="xterm-rows",$c="xterm-fg-",Xy="xterm-bg-",ya="xterm-focus",qc="xterm-selection",HA=1,R_=class extends Ne{constructor(e,t,s,r,o,l,u,h,d,f,p,m,v,S){super(),this._terminal=e,this._document=t,this._element=s,this._screenElement=r,this._viewportElement=o,this._helperContainer=l,this._linkifier2=u,this._charSizeService=d,this._optionsService=f,this._bufferService=p,this._coreService=m,this._coreBrowserService=v,this._themeService=S,this._terminalClass=HA++,this._rowElements=[],this._selectionRenderModel=zA(),this.onRequestRedraw=this._register(new fe).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(ki),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(qc),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=BA(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(y=>this._injectCss(y))),this._injectCss(this._themeService.colors),this._rowFactory=h.createInstance(N_,document),this._element.classList.add(zd+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(y=>this._handleLinkHover(y))),this._register(this._linkifier2.onHideLinkUnderline(y=>this._handleLinkLeave(y))),this._register(tt(()=>{this._element.classList.remove(zd+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new LA(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 s of this._rowElements)s.style.width=`${this.dimensions.css.canvas.width}px`,s.style.height=`${this.dimensions.css.cell.height}px`,s.style.lineHeight=`${this.dimensions.css.cell.height}px`,s.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${ki} 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} .${ki} { 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} .${ki} .xterm-dim { color: ${Qe.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 s=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,o=`blink_block_${this._terminalClass}`;t+=`@keyframes ${s} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 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} .${ki}.${ya} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${ki}.${ya} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${ki}.${ya} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${o} 1s step-end infinite;}${this._terminalSelector} .${ki} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${ki} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${ki} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${ki} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${ki} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${qc} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${qc} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${qc} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[l,u]of e.ansi.entries())t+=`${this._terminalSelector} .${$c}${l} { color: ${u.css}; }${this._terminalSelector} .${$c}${l}.xterm-dim { color: ${Qe.multiplyOpacity(u,.5).css}; }${this._terminalSelector} .${Xy}${l} { background-color: ${u.css}; }`;t+=`${this._terminalSelector} .${$c}257 { color: ${Qe.opaque(e.background).css}; }${this._terminalSelector} .${$c}257.xterm-dim { color: ${Qe.multiplyOpacity(Qe.opaque(e.background),.5).css}; }${this._terminalSelector} .${Xy}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let s=this._rowElements.length;s<=t;s++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}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(ya),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(ya),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,s){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,s),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,s),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,o=this._selectionRenderModel.viewportEndRow,l=this._selectionRenderModel.viewportCappedStartRow,u=this._selectionRenderModel.viewportCappedEndRow,h=this._document.createDocumentFragment();if(s){let d=e[0]>t[0];h.appendChild(this._createSelectionElement(l,d?t[0]:e[0],d?e[0]:t[0],u-l+1))}else{let d=r===l?e[0]:0,f=l===o?t[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(l,d,f));let p=u-l-1;if(h.appendChild(this._createSelectionElement(l+1,0,this._bufferService.cols,p)),l!==u){let m=o===u?t[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(u,0,m))}}this._selectionContainer.appendChild(h)}_createSelectionElement(e,t,s,r=1){let o=this._document.createElement("div"),l=t*this.dimensions.css.cell.width,u=this.dimensions.css.cell.width*(s-t);return l+u>this.dimensions.css.canvas.width&&(u=this.dimensions.css.canvas.width-l),o.style.height=`${r*this.dimensions.css.cell.height}px`,o.style.top=`${e*this.dimensions.css.cell.height}px`,o.style.left=`${l}px`,o.style.width=`${u}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 s=this._bufferService.buffer,r=s.ybase+s.y,o=Math.min(s.x,this._bufferService.cols-1),l=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,u=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,h=this._optionsService.rawOptions.cursorInactiveStyle;for(let d=e;d<=t;d++){let f=d+s.ydisp,p=this._rowElements[d],m=s.lines.get(f);if(!p||!m)break;p.replaceChildren(...this._rowFactory.createRow(m,f,f===r,u,h,o,l,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${zd}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,s,r,o,l){s<0&&(e=0),r<0&&(t=0);let u=this._bufferService.rows-1;s=Math.max(Math.min(s,u),0),r=Math.max(Math.min(r,u),0),o=Math.min(o,this._bufferService.cols);let h=this._bufferService.buffer,d=h.ybase+h.y,f=Math.min(h.x,o-1),p=this._optionsService.rawOptions.cursorBlink,m=this._optionsService.rawOptions.cursorStyle,v=this._optionsService.rawOptions.cursorInactiveStyle;for(let S=s;S<=r;++S){let y=S+h.ydisp,b=this._rowElements[S],x=h.lines.get(y);if(!b||!x)break;b.replaceChildren(...this._rowFactory.createRow(x,y,y===d,m,v,f,p,this.dimensions.css.cell.width,this._widthCache,l?S===s?e:0:-1,l?(S===r?t:o)-1:-1))}}};R_=lt([ge(7,dg),ge(8,Wu),ge(9,Xt),ge(10,Vt),ge(11,fr),ge(12,Os),ge(13,yo)],R_);var B_=class extends Ne{constructor(e,t,s){super(),this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=this._register(new fe),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new UA(this._optionsService))}catch{this._measureStrategy=this._register(new PA(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())}};B_=lt([ge(2,Xt)],B_);var iw=class extends Ne{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},PA=class extends iw{constructor(e,t,s){super(),this._document=e,this._parentElement=t,this._optionsService=s,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},UA=class extends iw{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}},jA=class extends Ne{constructor(e,t,s){super(),this._textarea=e,this._window=t,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new IA(this._window)),this._onDprChange=this._register(new fe),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new fe),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(Pt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Ee(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Ee(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},IA=class extends Ne{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new vo),this._onDprChange=this._register(new fe),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(tt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Ee(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},$A=class extends Ne{constructor(){super(),this.linkProviders=[],this._register(tt(()=>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 bg(e,t,s){let r=s.getBoundingClientRect(),o=e.getComputedStyle(s),l=parseInt(o.getPropertyValue("padding-left")),u=parseInt(o.getPropertyValue("padding-top"));return[t.clientX-r.left-l,t.clientY-r.top-u]}function qA(e,t,s,r,o,l,u,h,d){if(!l)return;let f=bg(e,t,s);if(f)return f[0]=Math.ceil((f[0]+(d?u/2:0))/u),f[1]=Math.ceil(f[1]/h),f[0]=Math.min(Math.max(f[0],1),r+(d?1:0)),f[1]=Math.min(Math.max(f[1],1),o),f}var L_=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,s,r,o){return qA(window,e,t,s,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,o)}getMouseReportCoords(e,t){let s=bg(window,e,t);if(this._charSizeService.hasValidSize)return s[0]=Math.min(Math.max(s[0],0),this._renderService.dimensions.css.canvas.width-1),s[1]=Math.min(Math.max(s[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(s[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(s[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(s[0]),y:Math.floor(s[1])}}};L_=lt([ge(0,zs),ge(1,Wu)],L_);var WA=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,s){this._rowCount=s,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=[]}},sw={};eT(sw,{getSafariVersion:()=>VA,isChromeOS:()=>aw,isFirefox:()=>nw,isIpad:()=>XA,isIphone:()=>KA,isLegacyEdge:()=>YA,isLinux:()=>wg,isMac:()=>wu,isNode:()=>Yu,isSafari:()=>rw,isWindows:()=>ow});var Yu=typeof process<"u"&&"title"in process,nl=Yu?"node":navigator.userAgent,rl=Yu?"node":navigator.platform,nw=nl.includes("Firefox"),YA=nl.includes("Edge"),rw=/^((?!chrome|android).)*safari/i.test(nl);function VA(){if(!rw)return 0;let e=nl.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var wu=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(rl),XA=rl==="iPad",KA=rl==="iPhone",ow=["Windows","Win16","Win32","WinCE"].includes(rl),wg=rl.indexOf("Linux")>=0,aw=/\bCrOS\b/.test(nl),lw=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,s=0,r=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),s=Math.max(t,s),o=e.timeRemaining(),s*1.5>o){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=o}this.clear()}},GA=class extends lw{_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())}}},FA=class extends lw{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},xu=!Yu&&"requestIdleCallback"in window?FA:GA,ZA=class{constructor(){this._queue=new xu}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},O_=class extends Ne{constructor(e,t,s,r,o,l,u,h,d){super(),this._rowCount=e,this._optionsService=s,this._charSizeService=r,this._coreService=o,this._coreBrowserService=h,this._renderer=this._register(new vo),this._pausedResizeTask=new ZA,this._observerDisposable=this._register(new vo),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 fe),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new fe),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new fe),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new fe),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new WA((f,p)=>this._renderRows(f,p),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new QA(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(tt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(u.onResize(()=>this._fullRefresh())),this._register(u.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(l.onDecorationRegistered(()=>this._fullRefresh())),this._register(l.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(u.cols,u.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(u.buffer.y,u.buffer.y,!0))),this._register(d.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 s=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});s.observe(t),this._observerDisposable.value=tt(()=>s.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,s=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),s||(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 s;return(s=this._renderer.value)==null?void 0:s.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,s){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=s,(r=this._renderer.value)==null||r.handleSelectionChanged(e,t,s)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};O_=lt([ge(2,Xt),ge(3,Wu),ge(4,fr),ge(5,sl),ge(6,Vt),ge(7,Os),ge(8,yo)],O_);var QA=class{constructor(e,t,s){this._coreBrowserService=e,this._coreService=t,this._onTimeout=s,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===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 JA(e,t,s,r){let o=s.buffer.x,l=s.buffer.y;if(!s.buffer.hasScrollback)return iN(o,l,e,t,s,r)+Vu(l,t,s,r)+sN(o,l,e,t,s,r);let u;if(l===t)return u=o>e?"D":"C",Va(Math.abs(o-e),Ya(u,r));u=l>t?"D":"C";let h=Math.abs(l-t),d=tN(l>t?e:o,s)+(h-1)*s.cols+1+eN(l>t?o:e);return Va(d,Ya(u,r))}function eN(e,t){return e-1}function tN(e,t){return t.cols-e}function iN(e,t,s,r,o,l){return Vu(t,r,o,l).length===0?"":Va(uw(e,t,e,t-hr(t,o),!1,o).length,Ya("D",l))}function Vu(e,t,s,r){let o=e-hr(e,s),l=t-hr(t,s),u=Math.abs(o-l)-nN(e,t,s);return Va(u,Ya(cw(e,t),r))}function sN(e,t,s,r,o,l){let u;Vu(t,r,o,l).length>0?u=r-hr(r,o):u=t;let h=r,d=rN(e,t,s,r,o,l);return Va(uw(e,u,s,h,d==="C",o).length,Ya(d,l))}function nN(e,t,s){var u;let r=0,o=e-hr(e,s),l=t-hr(t,s);for(let h=0;h<Math.abs(o-l);h++){let d=cw(e,t)==="A"?-1:1;(u=s.buffer.lines.get(o+d*h))!=null&&u.isWrapped&&r++}return r}function hr(e,t){let s=0,r=t.buffer.lines.get(e),o=r==null?void 0:r.isWrapped;for(;o&&e>=0&&e<t.rows;)s++,r=t.buffer.lines.get(--e),o=r==null?void 0:r.isWrapped;return s}function rN(e,t,s,r,o,l){let u;return Vu(s,r,o,l).length>0?u=r-hr(r,o):u=t,e<s&&u<=r||e>=s&&u<r?"C":"D"}function cw(e,t){return e>t?"A":"B"}function uw(e,t,s,r,o,l){let u=e,h=t,d="";for(;(u!==s||h!==r)&&h>=0&&h<l.buffer.lines.length;)u+=o?1:-1,o&&u>l.cols-1?(d+=l.buffer.translateBufferLineToString(h,!1,e,u),u=0,e=0,h++):!o&&u<0&&(d+=l.buffer.translateBufferLineToString(h,!1,0,e+1),u=l.cols-1,e=u,h--);return d+l.buffer.translateBufferLineToString(h,!1,e,u)}function Ya(e,t){let s=t?"O":"[";return ae.ESC+s+e}function Va(e,t){e=Math.floor(e);let s="";for(let r=0;r<e;r++)s+=t;return s}var oN=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 Ky(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 Hd=50,aN=15,lN=50,cN=500,uN=" ",hN=new RegExp(uN,"g"),z_=class extends Ne{constructor(e,t,s,r,o,l,u,h,d){super(),this._element=e,this._screenElement=t,this._linkifier=s,this._bufferService=r,this._coreService=o,this._mouseService=l,this._optionsService=u,this._renderService=h,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Ai,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new fe),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new fe),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new fe),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new fe),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 oN(this._bufferService),this._activeSelectionMode=0,this._register(tt(()=>{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 s=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let o=e[0]<t[0]?e[0]:t[0],l=e[0]<t[0]?t[0]:e[0];for(let u=e[1];u<=t[1];u++){let h=s.translateBufferLineToString(u,!0,o,l);r.push(h)}}else{let o=e[1]===t[1]?t[0]:void 0;r.push(s.translateBufferLineToString(e[1],!0,e[0],o));for(let l=e[1]+1;l<=t[1]-1;l++){let u=s.lines.get(l),h=s.translateBufferLineToString(l,!0);u!=null&&u.isWrapped?r[r.length-1]+=h:r.push(h)}if(e[1]!==t[1]){let l=s.lines.get(t[1]),u=s.translateBufferLineToString(t[1],!0,0,t[0]);l&&l.isWrapped?r[r.length-1]+=u:r.push(u)}}return r.map(o=>o.replace(hN," ")).join(ow?`\r
|
|
93
|
+
`:`
|
|
94
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),wg&&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),s=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!s||!r||!t?!1:this._areCoordsInSelection(t,s,r)}isCellInSelection(e,t){let s=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!s||!r?!1:this._areCoordsInSelection([e,t],s,r)}_areCoordsInSelection(e,t,s){return e[1]>t[1]&&e[1]<s[1]||t[1]===s[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<s[0]||t[1]<s[1]&&e[1]===s[1]&&e[0]<s[0]||t[1]<s[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var o,l;let s=(l=(o=this._linkifier.currentLink)==null?void 0:o.link)==null?void 0:l.range;if(s)return this._model.selectionStart=[s.start.x-1,s.start.y-1],this._model.selectionStartLength=Ky(s,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!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=bg(this._coreBrowserService.window,e,this._screenElement)[1],s=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=s?0:(t>s&&(t-=s),t=Math.min(Math.max(t,-Hd),Hd),t/=Hd,t/Math.abs(t)+Math.round(t*(aN-1)))}shouldForceSelection(e){return wu?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(),lN)}_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&&!(wu&&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 s=this._bufferService.buffer;if(this._model.selectionEnd[1]<s.lines.length){let r=s.lines.get(this._model.selectionEnd[1]);r&&r.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<cN&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let s=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(s&&s[0]!==void 0&&s[1]!==void 0){let r=JA(s[0]-1,s[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,s=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!s){this._oldHasSelection&&this._fireOnSelectionChange(e,t,s);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,s)}_fireOnSelectionChange(e,t,s){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=s,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let s=t;for(let r=0;t>=r;r++){let o=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?s--:o>1&&t!==r&&(s+=o-1)}return s}setSelection(e,t,s){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=s,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,s=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let o=this._bufferService.buffer,l=o.lines.get(e[1]);if(!l)return;let u=o.translateBufferLineToString(e[1],!1),h=this._convertViewportColToCharacterIndex(l,e[0]),d=h,f=e[0]-h,p=0,m=0,v=0,S=0;if(u.charAt(h)===" "){for(;h>0&&u.charAt(h-1)===" ";)h--;for(;d<u.length&&u.charAt(d+1)===" ";)d++}else{let x=e[0],C=e[0];l.getWidth(x)===0&&(p++,x--),l.getWidth(C)===2&&(m++,C++);let A=l.getString(C).length;for(A>1&&(S+=A-1,d+=A-1);x>0&&h>0&&!this._isCharWordSeparator(l.loadCell(x-1,this._workCell));){l.loadCell(x-1,this._workCell);let E=this._workCell.getChars().length;this._workCell.getWidth()===0?(p++,x--):E>1&&(v+=E-1,h-=E-1),h--,x--}for(;C<l.length&&d+1<u.length&&!this._isCharWordSeparator(l.loadCell(C+1,this._workCell));){l.loadCell(C+1,this._workCell);let E=this._workCell.getChars().length;this._workCell.getWidth()===2?(m++,C++):E>1&&(S+=E-1,d+=E-1),d++,C++}}d++;let y=h+f-p+v,b=Math.min(this._bufferService.cols,d-h+p+m-v-S);if(!(!t&&u.slice(h,d).trim()==="")){if(s&&y===0&&l.getCodePoint(0)!==32){let x=o.lines.get(e[1]-1);if(x&&l.isWrapped&&x.getCodePoint(this._bufferService.cols-1)!==32){let C=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(C){let A=this._bufferService.cols-C.start;y-=A,b+=A}}}if(r&&y+b===this._bufferService.cols&&l.getCodePoint(this._bufferService.cols-1)!==32){let x=o.lines.get(e[1]+1);if(x!=null&&x.isWrapped&&x.getCodePoint(0)!==32){let C=this._getWordAt([0,e[1]+1],!1,!1,!0);C&&(b+=C.length)}}return{start:y,length:b}}}_selectWordAt(e,t){let s=this._getWordAt(e,t);if(s){for(;s.start<0;)s.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[s.start,e[1]],this._model.selectionStartLength=s.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let s=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,s--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,s++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,s]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),s={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Ky(s,this._bufferService.cols)}};z_=lt([ge(3,Vt),ge(4,fr),ge(5,_g),ge(6,Xt),ge(7,zs),ge(8,Os)],z_);var Gy=class{constructor(){this._data={}}set(e,t,s){this._data[e]||(this._data[e]={}),this._data[e][t]=s}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Fy=class{constructor(){this._color=new Gy,this._css=new Gy}setCss(e,t,s){this._css.set(e,t,s)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,s){this._color.set(e,t,s)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},wt=Object.freeze((()=>{let e=[nt.toColor("#2e3436"),nt.toColor("#cc0000"),nt.toColor("#4e9a06"),nt.toColor("#c4a000"),nt.toColor("#3465a4"),nt.toColor("#75507b"),nt.toColor("#06989a"),nt.toColor("#d3d7cf"),nt.toColor("#555753"),nt.toColor("#ef2929"),nt.toColor("#8ae234"),nt.toColor("#fce94f"),nt.toColor("#729fcf"),nt.toColor("#ad7fa8"),nt.toColor("#34e2e2"),nt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let s=0;s<216;s++){let r=t[s/36%6|0],o=t[s/6%6|0],l=t[s%6];e.push({css:vt.toCss(r,o,l),rgba:vt.toRgba(r,o,l)})}for(let s=0;s<24;s++){let r=8+s*10;e.push({css:vt.toCss(r,r,r),rgba:vt.toRgba(r,r,r)})}return e})()),Qn=nt.toColor("#ffffff"),Ta=nt.toColor("#000000"),Zy=nt.toColor("#ffffff"),Qy=Ta,Sa={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},fN=Qn,H_=class extends Ne{constructor(e){super(),this._optionsService=e,this._contrastCache=new Fy,this._halfContrastCache=new Fy,this._onChangeColors=this._register(new fe),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Qn,background:Ta,cursor:Zy,cursorAccent:Qy,selectionForeground:void 0,selectionBackgroundTransparent:Sa,selectionBackgroundOpaque:Qe.blend(Ta,Sa),selectionInactiveBackgroundTransparent:Sa,selectionInactiveBackgroundOpaque:Qe.blend(Ta,Sa),scrollbarSliderBackground:Qe.opacity(Qn,.2),scrollbarSliderHoverBackground:Qe.opacity(Qn,.4),scrollbarSliderActiveBackground:Qe.opacity(Qn,.5),overviewRulerBorder:Qn,ansi:wt.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=Ke(e.foreground,Qn),t.background=Ke(e.background,Ta),t.cursor=Qe.blend(t.background,Ke(e.cursor,Zy)),t.cursorAccent=Qe.blend(t.background,Ke(e.cursorAccent,Qy)),t.selectionBackgroundTransparent=Ke(e.selectionBackground,Sa),t.selectionBackgroundOpaque=Qe.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Ke(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Qe.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Ke(e.selectionForeground,Yy):void 0,t.selectionForeground===Yy&&(t.selectionForeground=void 0),Qe.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Qe.opacity(t.selectionBackgroundTransparent,.3)),Qe.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Qe.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Ke(e.scrollbarSliderBackground,Qe.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Ke(e.scrollbarSliderHoverBackground,Qe.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Ke(e.scrollbarSliderActiveBackground,Qe.opacity(t.foreground,.5)),t.overviewRulerBorder=Ke(e.overviewRulerBorder,fN),t.ansi=wt.slice(),t.ansi[0]=Ke(e.black,wt[0]),t.ansi[1]=Ke(e.red,wt[1]),t.ansi[2]=Ke(e.green,wt[2]),t.ansi[3]=Ke(e.yellow,wt[3]),t.ansi[4]=Ke(e.blue,wt[4]),t.ansi[5]=Ke(e.magenta,wt[5]),t.ansi[6]=Ke(e.cyan,wt[6]),t.ansi[7]=Ke(e.white,wt[7]),t.ansi[8]=Ke(e.brightBlack,wt[8]),t.ansi[9]=Ke(e.brightRed,wt[9]),t.ansi[10]=Ke(e.brightGreen,wt[10]),t.ansi[11]=Ke(e.brightYellow,wt[11]),t.ansi[12]=Ke(e.brightBlue,wt[12]),t.ansi[13]=Ke(e.brightMagenta,wt[13]),t.ansi[14]=Ke(e.brightCyan,wt[14]),t.ansi[15]=Ke(e.brightWhite,wt[15]),e.extendedAnsi){let s=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<s;r++)t.ansi[r+16]=Ke(e.extendedAnsi[r],wt[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(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()}}};H_=lt([ge(0,Xt)],H_);function Ke(e,t){if(e!==void 0)try{return nt.toColor(e)}catch{}return t}var dN=class{constructor(...e){this._entries=new Map;for(let[t,s]of e)this.set(t,s)}set(e,t){let s=this._entries.get(e);return this._entries.set(e,t),s}forEach(e){for(let[t,s]of this._entries.entries())e(t,s)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},_N=class{constructor(){this._services=new dN,this._services.set(dg,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let s=aT(e).sort((l,u)=>l.index-u.index),r=[];for(let l of s){let u=this._services.get(l.id);if(!u)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${l.id._id}.`);r.push(u)}let o=s.length>0?s[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,...r)}},gN={trace:0,debug:1,info:2,warn:3,error:4,off:5},pN="xterm.js: ",P_=class extends Ne{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=gN[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,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":pN)+t,...s)}trace(e,...t){var s;this._logLevel<=0&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var s;this._logLevel<=1&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var s;this._logLevel<=2&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var s;this._logLevel<=3&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var s;this._logLevel<=4&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.error.bind(this._optionsService.options.logger))??console.error,e,t)}};P_=lt([ge(0,Xt)],P_);var Jy=class extends Ne{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new fe),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new fe),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new fe),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let s=0;s<Math.min(e,this.length);s++)t[s]=this._array[this._getCyclicIndex(s)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...s){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+s.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<s.length;r++)this._array[this._getCyclicIndex(e+r)]=s[r];if(s.length&&this.onInsertEmitter.fire({index:e,amount:s.length}),this._length+s.length>this._maxLength){let r=this._length+s.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=s.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,s){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+s<0)throw new Error("Cannot shift elements in list beyond index 0");if(s>0){for(let o=t-1;o>=0;o--)this.set(e+o+s,this.get(e+o));let r=e+t+s-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+s,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Ae=3,mt=Object.freeze(new il),Wc=0,Pd=2,Aa=class hw{constructor(t,s,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Ae);let o=s||Ai.fromCharData([0,Ab,1,0]);for(let l=0;l<t;++l)this.setCell(l,o);this.length=t}get(t){let s=this._data[t*Ae+0],r=s&2097151;return[this._data[t*Ae+1],s&2097152?this._combined[t]:r?yn(r):"",s>>22,s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,s){this._data[t*Ae+1]=s[0],s[1].length>1?(this._combined[t]=s[1],this._data[t*Ae+0]=t|2097152|s[2]<<22):this._data[t*Ae+0]=s[1].charCodeAt(0)|s[2]<<22}getWidth(t){return this._data[t*Ae+0]>>22}hasWidth(t){return this._data[t*Ae+0]&12582912}getFg(t){return this._data[t*Ae+1]}getBg(t){return this._data[t*Ae+2]}hasContent(t){return this._data[t*Ae+0]&4194303}getCodePoint(t){let s=this._data[t*Ae+0];return s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s&2097151}isCombined(t){return this._data[t*Ae+0]&2097152}getString(t){let s=this._data[t*Ae+0];return s&2097152?this._combined[t]:s&2097151?yn(s&2097151):""}isProtected(t){return this._data[t*Ae+2]&536870912}loadCell(t,s){return Wc=t*Ae,s.content=this._data[Wc+0],s.fg=this._data[Wc+1],s.bg=this._data[Wc+2],s.content&2097152&&(s.combinedData=this._combined[t]),s.bg&268435456&&(s.extended=this._extendedAttrs[t]),s}setCell(t,s){s.content&2097152&&(this._combined[t]=s.combinedData),s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*Ae+0]=s.content,this._data[t*Ae+1]=s.fg,this._data[t*Ae+2]=s.bg}setCellFromCodepoint(t,s,r,o){o.bg&268435456&&(this._extendedAttrs[t]=o.extended),this._data[t*Ae+0]=s|r<<22,this._data[t*Ae+1]=o.fg,this._data[t*Ae+2]=o.bg}addCodepointToCell(t,s,r){let o=this._data[t*Ae+0];o&2097152?this._combined[t]+=yn(s):o&2097151?(this._combined[t]=yn(o&2097151)+yn(s),o&=-2097152,o|=2097152):o=s|1<<22,r&&(o&=-12582913,o|=r<<22),this._data[t*Ae+0]=o}insertCells(t,s,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),s<this.length-t){let o=new Ai;for(let l=this.length-t-s-1;l>=0;--l)this.setCell(t+s+l,this.loadCell(t+l,o));for(let l=0;l<s;++l)this.setCell(t+l,r)}else for(let o=t;o<this.length;++o)this.setCell(o,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,s,r){if(t%=this.length,s<this.length-t){let o=new Ai;for(let l=0;l<this.length-t-s;++l)this.setCell(t+l,this.loadCell(t+s+l,o));for(let l=this.length-s;l<this.length;++l)this.setCell(l,r)}else for(let o=t;o<this.length;++o)this.setCell(o,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,s,r,o=!1){if(o){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),s<this.length&&this.getWidth(s-1)===2&&!this.isProtected(s)&&this.setCellFromCodepoint(s,0,1,r);t<s&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),s<this.length&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s,0,1,r);t<s&&t<this.length;)this.setCell(t++,r)}resize(t,s){if(t===this.length)return this._data.length*4*Pd<this._data.buffer.byteLength;let r=t*Ae;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let o=new Uint32Array(r);o.set(this._data),this._data=o}for(let o=this.length;o<t;++o)this.setCell(o,s)}else{this._data=this._data.subarray(0,r);let o=Object.keys(this._combined);for(let u=0;u<o.length;u++){let h=parseInt(o[u],10);h>=t&&delete this._combined[h]}let l=Object.keys(this._extendedAttrs);for(let u=0;u<l.length;u++){let h=parseInt(l[u],10);h>=t&&delete this._extendedAttrs[h]}}return this.length=t,r*4*Pd<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Pd<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,s=!1){if(s){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,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 s in t._combined)this._combined[s]=t._combined[s];this._extendedAttrs={};for(let s in t._extendedAttrs)this._extendedAttrs[s]=t._extendedAttrs[s];this.isWrapped=t.isWrapped}clone(){let t=new hw(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let s in this._combined)t._combined[s]=this._combined[s];for(let s in this._extendedAttrs)t._extendedAttrs[s]=this._extendedAttrs[s];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ae+0]&4194303)return t+(this._data[t*Ae+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ae+0]&4194303||this._data[t*Ae+2]&50331648)return t+(this._data[t*Ae+0]>>22);return 0}copyCellsFrom(t,s,r,o,l){let u=t._data;if(l)for(let d=o-1;d>=0;d--){for(let f=0;f<Ae;f++)this._data[(r+d)*Ae+f]=u[(s+d)*Ae+f];u[(s+d)*Ae+2]&268435456&&(this._extendedAttrs[r+d]=t._extendedAttrs[s+d])}else for(let d=0;d<o;d++){for(let f=0;f<Ae;f++)this._data[(r+d)*Ae+f]=u[(s+d)*Ae+f];u[(s+d)*Ae+2]&268435456&&(this._extendedAttrs[r+d]=t._extendedAttrs[s+d])}let h=Object.keys(t._combined);for(let d=0;d<h.length;d++){let f=parseInt(h[d],10);f>=s&&(this._combined[f-s+r]=t._combined[f])}}translateToString(t,s,r,o){s=s??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),o&&(o.length=0);let l="";for(;s<r;){let u=this._data[s*Ae+0],h=u&2097151,d=u&2097152?this._combined[s]:h?yn(h):bn;if(l+=d,o)for(let f=0;f<d.length;++f)o.push(s);s+=u>>22||1}return o&&o.push(s),l}};function mN(e,t,s,r,o,l){let u=[];for(let h=0;h<e.length-1;h++){let d=h,f=e.get(++d);if(!f.isWrapped)continue;let p=[e.get(h)];for(;d<e.length&&f.isWrapped;)p.push(f),f=e.get(++d);if(!l&&r>=h&&r<d){h+=p.length-1;continue}let m=0,v=Xa(p,m,t),S=1,y=0;for(;S<p.length;){let x=Xa(p,S,t),C=x-y,A=s-v,E=Math.min(C,A);p[m].copyCellsFrom(p[S],y,v,E,!1),v+=E,v===s&&(m++,v=0),y+=E,y===x&&(S++,y=0),v===0&&m!==0&&p[m-1].getWidth(s-1)===2&&(p[m].copyCellsFrom(p[m-1],s-1,v++,1,!1),p[m-1].setCell(s-1,o))}p[m].replaceCells(v,s,o);let b=0;for(let x=p.length-1;x>0&&(x>m||p[x].getTrimmedLength()===0);x--)b++;b>0&&(u.push(h+p.length-b),u.push(b)),h+=p.length-1}return u}function vN(e,t){let s=[],r=0,o=t[r],l=0;for(let u=0;u<e.length;u++)if(o===u){let h=t[++r];e.onDeleteEmitter.fire({index:u-l,amount:h}),u+=h-1,l+=h,o=t[++r]}else s.push(u);return{layout:s,countRemoved:l}}function yN(e,t){let s=[];for(let r=0;r<t.length;r++)s.push(e.get(t[r]));for(let r=0;r<s.length;r++)e.set(r,s[r]);e.length=t.length}function SN(e,t,s){let r=[],o=e.map((d,f)=>Xa(e,f,t)).reduce((d,f)=>d+f),l=0,u=0,h=0;for(;h<o;){if(o-h<s){r.push(o-h);break}l+=s;let d=Xa(e,u,t);l>d&&(l-=d,u++);let f=e[u].getWidth(l-1)===2;f&&l--;let p=f?s-1:s;r.push(p),h+=p}return r}function Xa(e,t,s){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(s-1)&&e[t].getWidth(s-1)===1,o=e[t+1].getWidth(0)===2;return r&&o?s-1:s}var fw=class dw{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=dw._nextId++,this._onDispose=this.register(new fe),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ur(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};fw._nextId=1;var bN=fw,Ct={},Jn=Ct.B;Ct[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Ct.A={"#":"£"};Ct.B=void 0;Ct[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Ct.C=Ct[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ct.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Ct.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Ct.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Ct.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Ct.E=Ct[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Ct.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Ct.H=Ct[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ct["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var eS=4294967295,tS=class{constructor(e,t,s){this._hasScrollback=e,this._optionsService=t,this._bufferService=s,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=mt.clone(),this.savedCharset=Jn,this.markers=[],this._nullCell=Ai.fromCharData([0,Ab,1,0]),this._whitespaceCell=Ai.fromCharData([0,bn,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new xu,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Jy(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 yu),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 yu),this._whitespaceCell}getBlankLine(e,t){return new Aa(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>eS?eS:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=mt);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 Jy(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let s=this.getNullCell(mt),r=0,o=this._getCorrectBufferLength(t);if(o>this.lines.maxLength&&(this.lines.maxLength=o),this.lines.length>0){if(this._cols<e)for(let u=0;u<this.lines.length;u++)r+=+this.lines.get(u).resize(e,s);let l=0;if(this._rows<t)for(let u=this._rows;u<t;u++)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 Aa(e,s)):this.ybase>0&&this.lines.length<=this.ybase+this.y+l+1?(this.ybase--,l++,this.ydisp>0&&this.ydisp--):this.lines.push(new Aa(e,s)));else for(let u=this._rows;u>t;u--)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 u=this.lines.length-o;u>0&&(this.lines.trimStart(u),this.ybase=Math.max(this.ybase-u,0),this.ydisp=Math.max(this.ydisp-u,0),this.savedY=Math.max(this.savedY-u,0)),this.lines.maxLength=o}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),l&&(this.y+=l),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 l=0;l<this.lines.length;l++)r+=+this.lines.get(l).resize(e,s);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&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 s=this._optionsService.rawOptions.reflowCursorLine,r=mN(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(mt),s);if(r.length>0){let o=vN(this.lines,r);yN(this.lines,o.layout),this._reflowLargerAdjustViewport(e,t,o.countRemoved)}}_reflowLargerAdjustViewport(e,t,s){let r=this.getNullCell(mt),o=s;for(;o-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Aa(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-s,0)}_reflowSmaller(e,t){let s=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(mt),o=[],l=0;for(let u=this.lines.length-1;u>=0;u--){let h=this.lines.get(u);if(!h||!h.isWrapped&&h.getTrimmedLength()<=e)continue;let d=[h];for(;h.isWrapped&&u>0;)h=this.lines.get(--u),d.unshift(h);if(!s){let E=this.ybase+this.y;if(E>=u&&E<u+d.length)continue}let f=d[d.length-1].getTrimmedLength(),p=SN(d,this._cols,e),m=p.length-d.length,v;this.ybase===0&&this.y!==this.lines.length-1?v=Math.max(0,this.y-this.lines.maxLength+m):v=Math.max(0,this.lines.length-this.lines.maxLength+m);let S=[];for(let E=0;E<m;E++){let D=this.getBlankLine(mt,!0);S.push(D)}S.length>0&&(o.push({start:u+d.length+l,newLines:S}),l+=S.length),d.push(...S);let y=p.length-1,b=p[y];b===0&&(y--,b=p[y]);let x=d.length-m-1,C=f;for(;x>=0;){let E=Math.min(C,b);if(d[y]===void 0)break;if(d[y].copyCellsFrom(d[x],C-E,b-E,E,!0),b-=E,b===0&&(y--,b=p[y]),C-=E,C===0){x--;let D=Math.max(x,0);C=Xa(d,D,this._cols)}}for(let E=0;E<d.length;E++)p[E]<e&&d[E].setCell(p[E],r);let A=m-v;for(;A-- >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+l)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+m,this.ybase+t-1)}if(o.length>0){let u=[],h=[];for(let b=0;b<this.lines.length;b++)h.push(this.lines.get(b));let d=this.lines.length,f=d-1,p=0,m=o[p];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+l);let v=0;for(let b=Math.min(this.lines.maxLength-1,d+l-1);b>=0;b--)if(m&&m.start>f+v){for(let x=m.newLines.length-1;x>=0;x--)this.lines.set(b--,m.newLines[x]);b++,u.push({index:f+1,amount:m.newLines.length}),v+=m.newLines.length,m=o[++p]}else this.lines.set(b,h[f--]);let S=0;for(let b=u.length-1;b>=0;b--)u[b].index+=S,this.lines.onInsertEmitter.fire(u[b]),S+=u[b].amount;let y=Math.max(0,d+l-this.lines.maxLength);y>0&&this.lines.onTrimEmitter.fire(y)}}translateBufferLineToString(e,t,s=0,r){let o=this.lines.get(e);return o?o.translateToString(t,s,r):""}getWrappedRangeForLine(e){let t=e,s=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;s+1<this.lines.length&&this.lines.get(s+1).isWrapped;)s++;return{first:t,last:s}}setupTabStops(e){for(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 bN(e);return this.markers.push(t),t.register(this.lines.onTrim(s=>{t.line-=s,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(s=>{t.line>=s.index&&(t.line+=s.amount)})),t.register(this.lines.onDelete(s=>{t.line>=s.index&&t.line<s.index+s.amount&&t.dispose(),t.line>s.index&&(t.line-=s.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},wN=class extends Ne{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new fe),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 tS(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new tS(!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)}},_w=2,gw=1,U_=class extends Ne{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new fe),this.onResize=this._onResize.event,this._onScroll=this._register(new fe),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,_w),this.rows=Math.max(e.rawOptions.rows||0,gw),this.buffers=this._register(new wN(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let s=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:s,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let s=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=s.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let o=s.ybase+s.scrollTop,l=s.ybase+s.scrollBottom;if(s.scrollTop===0){let u=s.lines.isFull;l===s.lines.length-1?u?s.lines.recycle().copyFrom(r):s.lines.push(r.clone()):s.lines.splice(l+1,0,r.clone()),u?this.isUserScrolling&&(s.ydisp=Math.max(s.ydisp-1,0)):(s.ybase++,this.isUserScrolling||s.ydisp++)}else{let u=l-o+1;s.lines.shiftElements(o+1,u-1,-1),s.lines.set(l,r.clone())}this.isUserScrolling||(s.ydisp=s.ybase),this._onScroll.fire(s.ydisp)}scrollLines(e,t){let s=this.buffer;if(e<0){if(s.ydisp===0)return;this.isUserScrolling=!0}else e+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);let r=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+e,s.ybase),0),r!==s.ydisp&&(t||this._onScroll.fire(s.ydisp))}};U_=lt([ge(0,Xt)],U_);var io={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:wu,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},xN=["normal","bold","100","200","300","400","500","600","700","800","900"],CN=class extends Ne{constructor(e){super(),this._onOptionChange=this._register(new fe),this.onOptionChange=this._onOptionChange.event;let t={...io};for(let s in e)if(s in t)try{let r=e[s];t[s]=this._sanitizeAndValidateOption(s,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(tt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(s=>{s===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(s=>{e.indexOf(s)!==-1&&t()})}_setupOptions(){let e=s=>{if(!(s in io))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},t=(s,r)=>{if(!(s in io))throw new Error(`No option with key "${s}"`);r=this._sanitizeAndValidateOption(s,r),this.rawOptions[s]!==r&&(this.rawOptions[s]=r,this._onOptionChange.fire(s))};for(let s in this.rawOptions){let r={get:e.bind(this,s),set:t.bind(this,s)};Object.defineProperty(this.options,s,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=io[e]),!EN(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=io[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=xN.includes(t)?t:io[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 EN(e){return e==="block"||e==="underline"||e==="bar"}function Na(e,t=5){if(typeof e!="object")return e;let s=Array.isArray(e)?[]:{};for(let r in e)s[r]=t<=1?e[r]:e[r]&&Na(e[r],t-1);return s}var iS=Object.freeze({insertMode:!1}),sS=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),j_=class extends Ne{constructor(e,t,s){super(),this._bufferService=e,this._logService=t,this._optionsService=s,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new fe),this.onData=this._onData.event,this._onUserInput=this._register(new fe),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new fe),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new fe),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Na(iS),this.decPrivateModes=Na(sS)}reset(){this.modes=Na(iS),this.decPrivateModes=Na(sS)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let s=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&s.ybase!==s.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.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))}};j_=lt([ge(0,Vt),ge(1,Ob),ge(2,Xt)],j_);var nS={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 Ud(e,t){let s=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(s|=64,s|=e.action):(s|=e.button&3,e.button&4&&(s|=64),e.button&8&&(s|=128),e.action===32?s|=32:e.action===0&&!t&&(s|=3)),s}var jd=String.fromCharCode,rS={DEFAULT:e=>{let t=[Ud(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${jd(t[0])}${jd(t[1])}${jd(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Ud(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Ud(e,!0)};${e.x};${e.y}${t}`}},I_=class extends Ne{constructor(e,t,s){super(),this._bufferService=e,this._coreService=t,this._optionsService=s,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new fe),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(nS))this.addProtocol(r,nS[r]);for(let r of Object.keys(rS))this.addEncoding(r,rS[r]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return 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,s){if(e.deltaY===0||e.shiftKey||t===void 0||s===void 0)return 0;let r=t/s,o=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(o/=r+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,s){if(s){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};I_=lt([ge(0,Vt),ge(1,fr),ge(2,Xt)],I_);var Id=[[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]],MN=[[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]],xt;function kN(e,t){let s=0,r=t.length-1,o;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=s;)if(o=s+r>>1,e>t[o][1])s=o+1;else if(e<t[o][0])r=o-1;else return!0;return!1}var DN=class{constructor(){if(this.version="6",!xt){xt=new Uint8Array(65536),xt.fill(1),xt[0]=0,xt.fill(0,1,32),xt.fill(0,127,160),xt.fill(2,4352,4448),xt[9001]=2,xt[9002]=2,xt.fill(2,11904,42192),xt[12351]=1,xt.fill(2,44032,55204),xt.fill(2,63744,64256),xt.fill(2,65040,65050),xt.fill(2,65072,65136),xt.fill(2,65280,65377),xt.fill(2,65504,65511);for(let e=0;e<Id.length;++e)xt.fill(0,Id[e][0],Id[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?xt[e]:kN(e,MN)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let s=this.wcwidth(e),r=s===0&&t!==0;if(r){let o=ir.extractWidth(t);o===0?r=!1:o>s&&(s=o)}return ir.createPropertyValue(0,s,r)}},ir=class nu{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new fe,this.onChange=this._onChange.event;let t=new DN;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,s,r=!1){return(t&16777215)<<3|(s&3)<<1|(r?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 s=0,r=0,o=t.length;for(let l=0;l<o;++l){let u=t.charCodeAt(l);if(55296<=u&&u<=56319){if(++l>=o)return s+this.wcwidth(u);let f=t.charCodeAt(l);56320<=f&&f<=57343?u=(u-55296)*1024+f-56320+65536:s+=this.wcwidth(f)}let h=this.charProperties(u,r),d=nu.extractWidth(h);nu.extractShouldJoin(h)&&(d-=nu.extractWidth(r)),s+=d,r=h}return s}charProperties(t,s){return this._activeProvider.charProperties(t,s)}},TN=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 oS(e){var r;let t=(r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:r.get(e.cols-1),s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);s&&t&&(s.isWrapped=t[3]!==0&&t[3]!==32)}var ba=2147483647,AN=256,pw=class $_{constructor(t=32,s=32){if(this.maxLength=t,this.maxSubParamsLength=s,s>AN)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(s),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let s=new $_;if(!t.length)return s;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let o=t[r];if(Array.isArray(o))for(let l=0;l<o.length;++l)s.addSubParam(o[l]);else s.addParam(o)}return s}clone(){let t=new $_(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 s=0;s<this.length;++s){t.push(this.params[s]);let r=this._subParamsIdx[s]>>8,o=this._subParamsIdx[s]&255;o-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,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>ba?ba: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>ba?ba:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let s=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-s>0?this._subParams.subarray(s,r):null}getSubParamsAll(){let t={};for(let s=0;s<this.length;++s){let r=this._subParamsIdx[s]>>8,o=this._subParamsIdx[s]&255;o-r>0&&(t[s]=this._subParams.slice(r,o))}return t}addDigit(t){let s;if(this._rejectDigits||!(s=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,o=r[s-1];r[s-1]=~o?Math.min(o*10+t,ba):t}},wa=[],NN=class{constructor(){this._state=0,this._active=wa,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 s=this._handlers[e];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.splice(r,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=wa}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=wa,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||wa,!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,s){if(!this._active.length)this._handlerFb(this._id,"PUT",qu(e,t,s));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,s)}start(){this.reset(),this._state=1}put(e,t,s){if(this._state!==3){if(this._state===1)for(;t<s;){let r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&s-t>0&&this._put(e,t,s)}}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 s=!1,r=this._active.length-1,o=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,s=t,o=this._stack.fallThrough,this._stack.paused=!1),!o&&s===!1){for(;r>=0&&(s=this._active[r].end(e),s!==!0);r--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,s;r--}for(;r>=0;r--)if(s=this._active[r].end(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,s}this._active=wa,this._id=-1,this._state=0}}},gi=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=qu(e,t,s),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(s=>(this._data="",this._hitLimit=!1,s));return this._data="",this._hitLimit=!1,t}},xa=[],RN=class{constructor(){this._handlers=Object.create(null),this._active=xa,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=xa}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.splice(r,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=xa,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||xa,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let s=this._active.length-1;s>=0;s--)this._active[s].hook(t)}put(e,t,s){if(!this._active.length)this._handlerFb(this._ident,"PUT",qu(e,t,s));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,s)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let s=!1,r=this._active.length-1,o=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,s=t,o=this._stack.fallThrough,this._stack.paused=!1),!o&&s===!1){for(;r>=0&&(s=this._active[r].unhook(e),s!==!0);r--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,s;r--}for(;r>=0;r--)if(s=this._active[r].unhook(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,s}this._active=xa,this._ident=0}},Ra=new pw;Ra.addParam(0);var aS=class{constructor(e){this._handler=e,this._data="",this._params=Ra,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Ra,this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=qu(e,t,s),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(s=>(this._params=Ra,this._data="",this._hitLimit=!1,s));return this._params=Ra,this._data="",this._hitLimit=!1,t}},BN=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,s,r){this.table[t<<8|e]=s<<4|r}addMany(e,t,s,r){for(let o=0;o<e.length;o++)this.table[t<<8|e[o]]=s<<4|r}},Ti=160,LN=(function(){let e=new BN(4095),t=Array.apply(null,Array(256)).map((h,d)=>d),s=(h,d)=>t.slice(h,d),r=s(32,127),o=s(0,24);o.push(25),o.push.apply(o,s(28,32));let l=s(0,14),u;e.setDefault(1,0),e.addMany(r,0,2,0);for(u in l)e.addMany([24,26,153,154],u,3,0),e.addMany(s(128,144),u,3,0),e.addMany(s(144,152),u,3,0),e.add(156,u,0,0),e.add(27,u,11,1),e.add(157,u,4,8),e.addMany([152,158,159],u,0,7),e.add(155,u,11,3),e.add(144,u,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(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(s(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,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(s(64,127),3,7,0),e.addMany(s(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(s(48,60),4,8,4),e.addMany(s(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(s(32,64),6,0,6),e.add(127,6,0,6),e.addMany(s(64,127),6,0,0),e.addMany(s(32,48),3,9,5),e.addMany(s(32,48),5,9,5),e.addMany(s(48,64),5,0,6),e.addMany(s(64,127),5,7,0),e.addMany(s(32,48),4,9,5),e.addMany(s(32,48),1,9,2),e.addMany(s(32,48),2,9,2),e.addMany(s(48,127),2,10,0),e.addMany(s(48,80),1,10,0),e.addMany(s(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(s(96,127),1,10,0),e.add(80,1,11,9),e.addMany(o,9,0,9),e.add(127,9,0,9),e.addMany(s(28,32),9,0,9),e.addMany(s(32,48),9,9,12),e.addMany(s(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(o,11,0,11),e.addMany(s(32,128),11,0,11),e.addMany(s(28,32),11,0,11),e.addMany(o,10,0,10),e.add(127,10,0,10),e.addMany(s(28,32),10,0,10),e.addMany(s(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(s(32,48),10,9,12),e.addMany(o,12,0,12),e.add(127,12,0,12),e.addMany(s(28,32),12,0,12),e.addMany(s(32,48),12,9,12),e.addMany(s(48,64),12,0,11),e.addMany(s(64,127),12,12,13),e.addMany(s(64,127),10,12,13),e.addMany(s(64,127),9,12,13),e.addMany(o,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Ti,0,2,0),e.add(Ti,8,5,8),e.add(Ti,6,0,6),e.add(Ti,11,0,11),e.add(Ti,13,13,13),e})(),ON=class extends Ne{constructor(e=LN){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 pw,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,s,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,s)=>{},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(tt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new NN),this._dcsParser=this._register(new RN),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let s=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=e.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let o=0;o<e.intermediates.length;++o){let l=e.intermediates.charCodeAt(o);if(32>l||l>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=l}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return s<<=8,s|=r,s}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 s=this._identifier(e,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);let r=this._escHandlers[s];return r.push(t),{dispose:()=>{let o=r.indexOf(t);o!==-1&&r.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 s=this._identifier(e);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);let r=this._csiHandlers[s];return r.push(t),{dispose:()=>{let o=r.indexOf(t);o!==-1&&r.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,s,r,o){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=s,this._parseStack.transition=r,this._parseStack.chunkPos=o}parse(e,t,s){let r=0,o=0,l=0,u;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,l=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let h=this._parseStack.handlers,d=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&d>-1){for(;d>=0&&(u=h[d](this._params),u!==!0);d--)if(u instanceof Promise)return this._parseStack.handlerPos=d,u}this._parseStack.handlers=[];break;case 4:if(s===!1&&d>-1){for(;d>=0&&(u=h[d](),u!==!0);d--)if(u instanceof Promise)return this._parseStack.handlerPos=d,u}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],u=this._dcsParser.unhook(r!==24&&r!==26,s),u)return u;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],u=this._oscParser.end(r!==24&&r!==26,s),u)return u;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,l=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let h=l;h<t;++h){switch(r=e[h],o=this._transitions.table[this.currentState<<8|(r<160?r:Ti)],o>>4){case 2:for(let v=h+1;;++v){if(v>=t||(r=e[v])<32||r>126&&r<Ti){this._printHandler(e,h,v),h=v-1;break}if(++v>=t||(r=e[v])<32||r>126&&r<Ti){this._printHandler(e,h,v),h=v-1;break}if(++v>=t||(r=e[v])<32||r>126&&r<Ti){this._printHandler(e,h,v),h=v-1;break}if(++v>=t||(r=e[v])<32||r>126&&r<Ti){this._printHandler(e,h,v),h=v-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:h,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let d=this._csiHandlers[this._collect<<8|r],f=d?d.length-1:-1;for(;f>=0&&(u=d[f](this._params),u!==!0);f--)if(u instanceof Promise)return this._preserveStack(3,d,f,o,h),u;f<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++h<t&&(r=e[h])>47&&r<60);h--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let p=this._escHandlers[this._collect<<8|r],m=p?p.length-1:-1;for(;m>=0&&(u=p[m](),u!==!0);m--)if(u instanceof Promise)return this._preserveStack(4,p,m,o,h),u;m<0&&this._escHandlerFb(this._collect<<8|r),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|r,this._params);break;case 13:for(let v=h+1;;++v)if(v>=t||(r=e[v])===24||r===26||r===27||r>127&&r<Ti){this._dcsParser.put(e,h,v),h=v-1;break}break;case 14:if(u=this._dcsParser.unhook(r!==24&&r!==26),u)return this._preserveStack(6,[],0,o,h),u;r===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 v=h+1;;v++)if(v>=t||(r=e[v])<32||r>127&&r<Ti){this._oscParser.put(e,h,v),h=v-1;break}break;case 6:if(u=this._oscParser.end(r!==24&&r!==26),u)return this._preserveStack(5,[],0,o,h),u;r===27&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=o&15}}},zN=/^([\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})$/,HN=/^[\da-f]+$/;function lS(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let s=zN.exec(t);if(s){let r=s[1]?15:s[4]?255:s[7]?4095:65535;return[Math.round(parseInt(s[1]||s[4]||s[7]||s[10],16)/r*255),Math.round(parseInt(s[2]||s[5]||s[8]||s[11],16)/r*255),Math.round(parseInt(s[3]||s[6]||s[9]||s[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),HN.exec(t)&&[3,6,9,12].includes(t.length))){let s=t.length/3,r=[0,0,0];for(let o=0;o<3;++o){let l=parseInt(t.slice(s*o,s*o+s),16);r[o]=s===1?l<<4:s===2?l:s===3?l>>4:l>>8}return r}}function $d(e,t){let s=e.toString(16),r=s.length<2?"0"+s:s;switch(t){case 4:return s[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function PN(e,t=16){let[s,r,o]=e;return`rgb:${$d(s,t)}/${$d(r,t)}/${$d(o,t)}`}var UN={"(":0,")":1,"*":2,"+":3,"-":1,".":2},vn=131072,cS=10;function uS(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 hS=5e3,fS=0,jN=class extends Ne{constructor(e,t,s,r,o,l,u,h,d=new ON){super(),this._bufferService=e,this._charsetService=t,this._coreService=s,this._logService=r,this._optionsService=o,this._oscLinkService=l,this._coreMouseService=u,this._unicodeService=h,this._parser=d,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new rT,this._utf8Decoder=new oT,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=mt.clone(),this._eraseAttrDataInternal=mt.clone(),this._onRequestBell=this._register(new fe),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new fe),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new fe),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new fe),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new fe),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new fe),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new fe),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new fe),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new fe),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new fe),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new fe),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new fe),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new fe),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 q_(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(f=>this._activeBuffer=f.activeBuffer)),this._parser.setCsiHandlerFallback((f,p)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(f),params:p.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,p,m)=>{this._logService.debug("Unknown OSC code: ",{identifier:f,action:p,data:m})}),this._parser.setDcsHandlerFallback((f,p,m)=>{p==="HOOK"&&(m=m.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(f),action:p,payload:m})}),this._parser.setPrintHandler((f,p,m)=>this.print(f,p,m)),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(ae.BEL,()=>this.bell()),this._parser.setExecuteHandler(ae.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ae.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ae.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ae.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ae.BS,()=>this.backspace()),this._parser.setExecuteHandler(ae.HT,()=>this.tab()),this._parser.setExecuteHandler(ae.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ae.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(iu.IND,()=>this.index()),this._parser.setExecuteHandler(iu.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(iu.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new gi(f=>(this.setTitle(f),this.setIconName(f),!0))),this._parser.registerOscHandler(1,new gi(f=>this.setIconName(f))),this._parser.registerOscHandler(2,new gi(f=>this.setTitle(f))),this._parser.registerOscHandler(4,new gi(f=>this.setOrReportIndexedColor(f))),this._parser.registerOscHandler(8,new gi(f=>this.setHyperlink(f))),this._parser.registerOscHandler(10,new gi(f=>this.setOrReportFgColor(f))),this._parser.registerOscHandler(11,new gi(f=>this.setOrReportBgColor(f))),this._parser.registerOscHandler(12,new gi(f=>this.setOrReportCursorColor(f))),this._parser.registerOscHandler(104,new gi(f=>this.restoreIndexedColor(f))),this._parser.registerOscHandler(110,new gi(f=>this.restoreFgColor(f))),this._parser.registerOscHandler(111,new gi(f=>this.restoreBgColor(f))),this._parser.registerOscHandler(112,new gi(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 Ct)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 aS((f,p)=>this.requestStatusString(f,p)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,s,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=s,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,s)=>setTimeout(()=>s("#SLOW_TIMEOUT"),hS))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${hS} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let s,r=this._activeBuffer.x,o=this._activeBuffer.y,l=0,u=this._parseStack.paused;if(u){if(s=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(s),s;r=this._parseStack.cursorStartX,o=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>vn&&(l=this._parseStack.position+vn)}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<vn&&(this._parseBuffer=new Uint32Array(Math.min(e.length,vn))),u||this._dirtyRowTracker.clearRange(),e.length>vn)for(let f=l;f<e.length;f+=vn){let p=f+vn<e.length?f+vn:e.length,m=typeof e=="string"?this._stringDecoder.decode(e.substring(f,p),this._parseBuffer):this._utf8Decoder.decode(e.subarray(f,p),this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,m))return this._preserveStack(r,o,m,f),this._logSlowResolvingAsync(s),s}else if(!u){let f=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,f))return this._preserveStack(r,o,f,0),this._logSlowResolvingAsync(s),s}(this._activeBuffer.x!==r||this._activeBuffer.y!==o)&&this._onCursorMove.fire();let h=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),d=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);d<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(d,this._bufferService.rows-1),end:Math.min(h,this._bufferService.rows-1)})}print(e,t,s){let r,o,l=this._charsetService.charset,u=this._optionsService.rawOptions.screenReaderMode,h=this._bufferService.cols,d=this._coreService.decPrivateModes.wraparound,f=this._coreService.modes.insertMode,p=this._curAttrData,m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&s-t>0&&m.getWidth(this._activeBuffer.x-1)===2&&m.setCellFromCodepoint(this._activeBuffer.x-1,0,1,p);let v=this._parser.precedingJoinState;for(let S=t;S<s;++S){if(r=e[S],r<127&&l){let C=l[String.fromCharCode(r)];C&&(r=C.charCodeAt(0))}let y=this._unicodeService.charProperties(r,v);o=ir.extractWidth(y);let b=ir.extractShouldJoin(y),x=b?ir.extractWidth(v):0;if(v=y,u&&this._onA11yChar.fire(yn(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+o-x>h){if(d){let C=m,A=this._activeBuffer.x-x;for(this._activeBuffer.x=x,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),m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),x>0&&m instanceof Aa&&m.copyCellsFrom(C,A,0,x,!1);A<h;)C.setCellFromCodepoint(A++,0,1,p)}else if(this._activeBuffer.x=h-1,o===2)continue}if(b&&this._activeBuffer.x){let C=m.getWidth(this._activeBuffer.x-1)?1:2;m.addCodepointToCell(this._activeBuffer.x-C,r,o);for(let A=o-x;--A>=0;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,p);continue}if(f&&(m.insertCells(this._activeBuffer.x,o-x,this._activeBuffer.getNullCell(p)),m.getWidth(h-1)===2&&m.setCellFromCodepoint(h-1,0,1,p)),m.setCellFromCodepoint(this._activeBuffer.x++,r,o,p),o>0)for(;--o;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,p)}this._parser.precedingJoinState=v,this._activeBuffer.x<h&&s-t>0&&m.getWidth(this._activeBuffer.x)===0&&!m.hasContent(this._activeBuffer.x)&&m.setCellFromCodepoint(this._activeBuffer.x,0,1,p),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,s=>uS(s.params[0],this._optionsService.rawOptions.windowOptions)?t(s):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new aS(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new gi(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,s,r=!1,o=!1){let l=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);l.replaceCells(t,s,this._activeBuffer.getNullCell(this._eraseAttrData()),o),r&&(l.isWrapped=!1)}_resetBufferLine(e,t=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s&&(s.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),s.isWrapped=!1)}eraseInDisplay(e,t=!1){var r;this._restrictCursor(this._bufferService.cols);let s;switch(e.params[0]){case 0:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);s<this._bufferService.rows;s++)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(s);break;case 1:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(s+1).isWrapped=!1);s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(s=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,s-1);s--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+s))!=null&&r.getTrimmedLength()););for(;s>=0;s--)this._bufferService.scroll(this._eraseAttrData())}else{for(s=this._bufferService.rows,this._dirtyRowTracker.markDirty(s-1);s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let 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 s=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,o=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(o-1,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let s=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(s,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}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(mt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let s=e.params[0]||1,r=ir.extractWidth(t),o=this._activeBuffer.x-r,l=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(o),u=new Uint32Array(l.length*s),h=0;for(let f=0;f<l.length;){let p=l.codePointAt(f)||0;u[h++]=p,f+=p>65535?2:1}let d=h;for(let f=1;f<s;++f)u.copyWithin(d,0,h),d+=h;return this.print(u,0,d),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ae.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ae.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ae.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ae.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ae.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,Jn),this._charsetService.setgCharset(1,Jn),this._charsetService.setgCharset(2,Jn),this._charsetService.setgCharset(3,Jn);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){(b=>(b[b.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",b[b.SET=1]="SET",b[b.RESET=2]="RESET",b[b.PERMANENTLY_SET=3]="PERMANENTLY_SET",b[b.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(s={}));let r=this._coreService.decPrivateModes,{activeProtocol:o,activeEncoding:l}=this._coreMouseService,u=this._coreService,{buffers:h,cols:d}=this._bufferService,{active:f,alt:p}=h,m=this._optionsService.rawOptions,v=(b,x)=>(u.triggerDataEvent(`${ae.ESC}[${t?"":"?"}${b};${x}$y`),!0),S=b=>b?1:2,y=e.params[0];return t?y===2?v(y,4):y===4?v(y,S(u.modes.insertMode)):y===12?v(y,3):y===20?v(y,S(m.convertEol)):v(y,0):y===1?v(y,S(r.applicationCursorKeys)):y===3?v(y,m.windowOptions.setWinLines?d===80?2:d===132?1:0:0):y===6?v(y,S(r.origin)):y===7?v(y,S(r.wraparound)):y===8?v(y,3):y===9?v(y,S(o==="X10")):y===12?v(y,S(m.cursorBlink)):y===25?v(y,S(!u.isCursorHidden)):y===45?v(y,S(r.reverseWraparound)):y===66?v(y,S(r.applicationKeypad)):y===67?v(y,4):y===1e3?v(y,S(o==="VT200")):y===1002?v(y,S(o==="DRAG")):y===1003?v(y,S(o==="ANY")):y===1004?v(y,S(r.sendFocus)):y===1005?v(y,4):y===1006?v(y,S(l==="SGR")):y===1015?v(y,4):y===1016?v(y,S(l==="SGR_PIXELS")):y===1048?v(y,1):y===47||y===1047||y===1049?v(y,S(f===p)):y===2004?v(y,S(r.bracketedPasteMode)):y===2026?v(y,S(r.synchronizedOutput)):v(y,0)}_updateAttrColor(e,t,s,r,o){return t===2?(e|=50331648,e&=-16777216,e|=il.fromColorRGB([s,r,o])):t===5&&(e&=-50331904,e|=33554432|s&255),e}_extractColor(e,t,s){let r=[0,0,-1,0,0,0],o=0,l=0;do{if(r[l+o]=e.params[t+l],e.hasSubParams(t+l)){let u=e.getSubParams(t+l),h=0;do r[1]===5&&(o=1),r[l+h+1+o]=u[h];while(++h<u.length&&h+l+1+o<r.length);break}if(r[1]===5&&l+o>=2||r[1]===2&&l+o>=5)break;r[1]&&(o=1)}while(++l+t<e.length&&l+o<r.length);for(let u=2;u<r.length;++u)r[u]===-1&&(r[u]=0);switch(r[0]){case 38:s.fg=this._updateAttrColor(s.fg,r[1],r[3],r[4],r[5]);break;case 48:s.bg=this._updateAttrColor(s.bg,r[1],r[3],r[4],r[5]);break;case 58:s.extended=s.extended.clone(),s.extended.underlineColor=this._updateAttrColor(s.extended.underlineColor,r[1],r[3],r[4],r[5])}return l}_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=mt.fg,e.bg=mt.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,s,r=this._curAttrData;for(let o=0;o<t;o++)s=e.params[o],s>=30&&s<=37?(r.fg&=-50331904,r.fg|=16777216|s-30):s>=40&&s<=47?(r.bg&=-50331904,r.bg|=16777216|s-40):s>=90&&s<=97?(r.fg&=-50331904,r.fg|=16777216|s-90|8):s>=100&&s<=107?(r.bg&=-50331904,r.bg|=16777216|s-100|8):s===0?this._processSGR0(r):s===1?r.fg|=134217728:s===3?r.bg|=67108864:s===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(o)?e.getSubParams(o)[0]:1,r)):s===5?r.fg|=536870912:s===7?r.fg|=67108864:s===8?r.fg|=1073741824:s===9?r.fg|=2147483648:s===2?r.bg|=134217728:s===21?this._processUnderline(2,r):s===22?(r.fg&=-134217729,r.bg&=-134217729):s===23?r.bg&=-67108865:s===24?(r.fg&=-268435457,this._processUnderline(0,r)):s===25?r.fg&=-536870913:s===27?r.fg&=-67108865:s===28?r.fg&=-1073741825:s===29?r.fg&=2147483647:s===39?(r.fg&=-67108864,r.fg|=mt.fg&16777215):s===49?(r.bg&=-67108864,r.bg|=mt.bg&16777215):s===38||s===48||s===58?o+=this._extractColor(e,o,r):s===53?r.bg|=1073741824:s===55?r.bg&=-1073741825:s===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):s===100?(r.fg&=-67108864,r.fg|=mt.fg&16777215,r.bg&=-67108864,r.bg|=mt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",s);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ae.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ae.ESC}[${t};${s}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ae.ESC}[?${t};${s}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=mt.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 s=t%2===1;this._coreService.decPrivateModes.cursorBlink=s}return!0}setScrollRegion(e){let t=e.params[0]||1,s;return(e.length<2||(s=e.params[1])>this._bufferService.rows||s===0)&&(s=this._bufferService.rows),s>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=s-1,this._setCursor(0,0)),!0}windowOptions(e){if(!uS(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(`${ae.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>cS&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>cS&&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=[],s=e.split(";");for(;s.length>1;){let r=s.shift(),o=s.shift();if(/^\d+$/.exec(r)){let l=parseInt(r);if(dS(l))if(o==="?")t.push({type:0,index:l});else{let u=lS(o);u&&t.push({type:1,index:l,color:u})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let s=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(s,r):s.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let s=e.split(":"),r,o=s.findIndex(l=>l.startsWith("id="));return o!==-1&&(r=s[o].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let s=e.split(";");for(let r=0;r<s.length&&!(t>=this._specialColors.length);++r,++t)if(s[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let o=lS(s[r]);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=[],s=e.split(";");for(let r=0;r<s.length;++r)if(/^\d+$/.exec(s[r])){let o=parseInt(s[r]);dS(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,Jn),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(UN[e[0]],Ct[e[1]]||Jn),!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=mt.clone(),this._eraseAttrDataInternal=mt.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 Ai;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 s=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(s);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let s=u=>(this._coreService.triggerDataEvent(`${ae.ESC}${u}${ae.ESC}\\`),!0),r=this._bufferService.buffer,o=this._optionsService.rawOptions;return s(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${r.scrollTop+1};${r.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)}},q_=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&&(fS=e,e=t,t=fS),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};q_=lt([ge(0,Vt)],q_);function dS(e){return 0<=e&&e<256}var IN=5e7,_S=12,$N=50,qN=class extends Ne{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new fe),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 s;for(;s=this._writeBuffer.shift();){this._action(s);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>IN)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 s=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],o=this._action(r,t);if(o){let u=h=>performance.now()-s>=_S?setTimeout(()=>this._innerWrite(0,h)):this._innerWrite(s,h);o.catch(h=>(queueMicrotask(()=>{throw h}),Promise.resolve(!1))).then(u);return}let l=this._callbacks[this._bufferOffset];if(l&&l(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-s>=_S)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>$N&&(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()}},W_=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 h=t.addMarker(t.ybase+t.y),d={data:e,id:this._nextId++,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(d,h)),this._dataByLinkId.set(d.id,d),d.id}let s=e,r=this._getEntryIdKey(s),o=this._entriesWithId.get(r);if(o)return this.addLineToLink(o.id,t.ybase+t.y),o.id;let l=t.addMarker(t.ybase+t.y),u={id:this._nextId++,key:this._getEntryIdKey(s),data:s,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(u,l)),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.id}addLineToLink(e,t){let s=this._dataByLinkId.get(e);if(s&&s.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);s.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(s,r))}}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 s=e.lines.indexOf(t);s!==-1&&(e.lines.splice(s,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};W_=lt([ge(0,Vt)],W_);var gS=!1,WN=class extends Ne{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new vo),this._onBinary=this._register(new fe),this.onBinary=this._onBinary.event,this._onData=this._register(new fe),this.onData=this._onData.event,this._onLineFeed=this._register(new fe),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new fe),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new fe),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new fe),this._instantiationService=new _N,this.optionsService=this._register(new CN(e)),this._instantiationService.setService(Xt,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(U_)),this._instantiationService.setService(Vt,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(P_)),this._instantiationService.setService(Ob,this._logService),this.coreService=this._register(this._instantiationService.createInstance(j_)),this._instantiationService.setService(fr,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(I_)),this._instantiationService.setService(Lb,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(ir)),this._instantiationService.setService(uT,this.unicodeService),this._charsetService=this._instantiationService.createInstance(TN),this._instantiationService.setService(cT,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(W_),this._instantiationService.setService(zb,this._oscLinkService),this._inputHandler=this._register(new jN(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Pt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Pt.forward(this._bufferService.onResize,this._onResize)),this._register(Pt.forward(this.coreService.onData,this._onData)),this._register(Pt.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 qN((t,s)=>this._inputHandler.parse(t,s))),this._register(Pt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new fe),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&&!gS&&(this._logService.warn("writeSync is unreliable and will be removed soon."),gS=!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,_w),t=Math.max(t,gw),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(oS.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(oS(this._bufferService),!1))),this._windowsWrappingHeuristics.value=tt(()=>{for(let t of e)t.dispose()})}}},YN={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 VN(e,t,s,r){var u;let o={type:0,cancel:!1,key:void 0},l=(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=ae.ESC+"OA":o.key=ae.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?o.key=ae.ESC+"OD":o.key=ae.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?o.key=ae.ESC+"OC":o.key=ae.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?o.key=ae.ESC+"OB":o.key=ae.ESC+"[B");break;case 8:o.key=e.ctrlKey?"\b":ae.DEL,e.altKey&&(o.key=ae.ESC+o.key);break;case 9:if(e.shiftKey){o.key=ae.ESC+"[Z";break}o.key=ae.HT,o.cancel=!0;break;case 13:o.key=e.altKey?ae.ESC+ae.CR:ae.CR,o.cancel=!0;break;case 27:o.key=ae.ESC,e.altKey&&(o.key=ae.ESC+ae.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;l?o.key=ae.ESC+"[1;"+(l+1)+"D":t?o.key=ae.ESC+"OD":o.key=ae.ESC+"[D";break;case 39:if(e.metaKey)break;l?o.key=ae.ESC+"[1;"+(l+1)+"C":t?o.key=ae.ESC+"OC":o.key=ae.ESC+"[C";break;case 38:if(e.metaKey)break;l?o.key=ae.ESC+"[1;"+(l+1)+"A":t?o.key=ae.ESC+"OA":o.key=ae.ESC+"[A";break;case 40:if(e.metaKey)break;l?o.key=ae.ESC+"[1;"+(l+1)+"B":t?o.key=ae.ESC+"OB":o.key=ae.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(o.key=ae.ESC+"[2~");break;case 46:l?o.key=ae.ESC+"[3;"+(l+1)+"~":o.key=ae.ESC+"[3~";break;case 36:l?o.key=ae.ESC+"[1;"+(l+1)+"H":t?o.key=ae.ESC+"OH":o.key=ae.ESC+"[H";break;case 35:l?o.key=ae.ESC+"[1;"+(l+1)+"F":t?o.key=ae.ESC+"OF":o.key=ae.ESC+"[F";break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=ae.ESC+"[5;"+(l+1)+"~":o.key=ae.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=ae.ESC+"[6;"+(l+1)+"~":o.key=ae.ESC+"[6~";break;case 112:l?o.key=ae.ESC+"[1;"+(l+1)+"P":o.key=ae.ESC+"OP";break;case 113:l?o.key=ae.ESC+"[1;"+(l+1)+"Q":o.key=ae.ESC+"OQ";break;case 114:l?o.key=ae.ESC+"[1;"+(l+1)+"R":o.key=ae.ESC+"OR";break;case 115:l?o.key=ae.ESC+"[1;"+(l+1)+"S":o.key=ae.ESC+"OS";break;case 116:l?o.key=ae.ESC+"[15;"+(l+1)+"~":o.key=ae.ESC+"[15~";break;case 117:l?o.key=ae.ESC+"[17;"+(l+1)+"~":o.key=ae.ESC+"[17~";break;case 118:l?o.key=ae.ESC+"[18;"+(l+1)+"~":o.key=ae.ESC+"[18~";break;case 119:l?o.key=ae.ESC+"[19;"+(l+1)+"~":o.key=ae.ESC+"[19~";break;case 120:l?o.key=ae.ESC+"[20;"+(l+1)+"~":o.key=ae.ESC+"[20~";break;case 121:l?o.key=ae.ESC+"[21;"+(l+1)+"~":o.key=ae.ESC+"[21~";break;case 122:l?o.key=ae.ESC+"[23;"+(l+1)+"~":o.key=ae.ESC+"[23~";break;case 123:l?o.key=ae.ESC+"[24;"+(l+1)+"~":o.key=ae.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=ae.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=ae.DEL:e.keyCode===219?o.key=ae.ESC:e.keyCode===220?o.key=ae.FS:e.keyCode===221&&(o.key=ae.GS);else if((!s||r)&&e.altKey&&!e.metaKey){let h=(u=YN[e.keyCode])==null?void 0:u[e.shiftKey?1:0];if(h)o.key=ae.ESC+h;else if(e.keyCode>=65&&e.keyCode<=90){let d=e.ctrlKey?e.keyCode-64:e.keyCode+32,f=String.fromCharCode(d);e.shiftKey&&(f=f.toUpperCase()),o.key=ae.ESC+f}else if(e.keyCode===32)o.key=ae.ESC+(e.ctrlKey?ae.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let d=e.code.slice(3,4);e.shiftKey||(d=d.toLowerCase()),o.key=ae.ESC+d,o.cancel=!0}}else s&&!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=ae.US),e.key==="@"&&(o.key=ae.NUL));break}return o}var ht=0,XN=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new xu,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new xu,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,l)=>this._getKey(o)-this._getKey(l)),t=0,s=0,r=new Array(this._array.length+this._insertedValues.length);for(let o=0;o<r.length;o++)s>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[s])?(r[o]=e[t],t++):r[o]=this._array[s++];this._array=r,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||(ht=this._search(t),ht===-1)||this._getKey(this._array[ht])!==t)return!1;do if(this._array[ht]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(ht),!0;while(++ht<this._array.length&&this._getKey(this._array[ht])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((o,l)=>o-l),t=0,s=new Array(this._array.length-e.length),r=0;for(let o=0;o<this._array.length;o++)e[t]===o?t++:s[r++]=this._array[o];this._array=s,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(ht=this._search(e),!(ht<0||ht>=this._array.length)&&this._getKey(this._array[ht])===e))do yield this._array[ht];while(++ht<this._array.length&&this._getKey(this._array[ht])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(ht=this._search(e),!(ht<0||ht>=this._array.length)&&this._getKey(this._array[ht])===e))do t(this._array[ht]);while(++ht<this._array.length&&this._getKey(this._array[ht])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,s=this._array.length-1;for(;s>=t;){let r=t+s>>1,o=this._getKey(this._array[r]);if(o>e)s=r-1;else if(o<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},qd=0,pS=0,KN=class extends Ne{constructor(){super(),this._decorations=new XN(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new fe),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new fe),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(tt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new GN(e);if(t){let s=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),s.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,s){let r=0,o=0;for(let l of this._decorations.getKeyIterator(t))r=l.options.x??0,o=r+(l.options.width??1),e>=r&&e<o&&(!s||(l.options.layer??"bottom")===s)&&(yield l)}forEachDecorationAtCell(e,t,s,r){this._decorations.forEachByKey(t,o=>{qd=o.options.x??0,pS=qd+(o.options.width??1),e>=qd&&e<pS&&(!s||(o.options.layer??"bottom")===s)&&r(o)})}},GN=class extends wn{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new fe),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new fe),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=nt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=nt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},FN=1e3,ZN=class{constructor(e,t=FN){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,s){this._rowCount=s,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 r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let o=r-this._lastRefreshMs,l=this._debounceThresholdMS-o;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},l)}}_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)}},mS=20,Cu=class extends Ne{constructor(e,t,s,r){super(),this._terminal=e,this._coreBrowserService=s,this._renderService=r,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 l=0;l<this._terminal.rows;l++)this._rowElements[l]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[l]);if(this._topBoundaryFocusListener=l=>this._handleBoundaryFocus(l,0),this._bottomBoundaryFocusListener=l=>this._handleBoundaryFocus(l,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 ZN(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(l=>this._handleResize(l.rows))),this._register(this._terminal.onRender(l=>this._refreshRows(l.start,l.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(l=>this._handleChar(l))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
95
|
+
`))),this._register(this._terminal.onA11yTab(l=>this._handleTab(l))),this._register(this._terminal.onKey(l=>this._handleKey(l.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Ee(o,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(tt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<mS+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
96
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===mS+1&&(this._liveRegion.textContent+=u_.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 s=this._terminal.buffer,r=s.lines.length.toString();for(let o=e;o<=t;o++){let l=s.lines.get(s.ydisp+o),u=[],h=(l==null?void 0:l.translateToString(!0,void 0,void 0,u))||"",d=(s.ydisp+o+1).toString(),f=this._rowElements[o];f&&(h.length===0?(f.textContent=" ",this._rowColumns.set(f,[0,1])):(f.textContent=h,this._rowColumns.set(f,u)),f.setAttribute("aria-posinset",d),f.setAttribute("aria-setsize",r),this._alignRowWidth(f))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let s=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],o=s.getAttribute("aria-posinset"),l=t===0?"1":`${this._terminal.buffer.lines.length}`;if(o===l||e.relatedTarget!==r)return;let u,h;if(t===0?(u=s,h=this._rowElements.pop(),this._rowContainer.removeChild(h)):(u=this._rowElements.shift(),h=s,this._rowContainer.removeChild(u)),u.removeEventListener("focus",this._topBoundaryFocusListener),h.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let d=this._createAccessibilityTreeNode();this._rowElements.unshift(d),this._rowContainer.insertAdjacentElement("afterbegin",d)}else{let d=this._createAccessibilityTreeNode();this._rowElements.push(d),this._rowContainer.appendChild(d)}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 h;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},s={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(s.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===s.node&&t.offset>s.offset)&&([t,s]=[s,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 r=this._rowElements.slice(-1)[0];if(s.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(s={node:r,offset:((h=r.textContent)==null?void 0:h.length)??0}),!this._rowContainer.contains(s.node))return;let o=({node:d,offset:f})=>{let p=d instanceof Text?d.parentNode:d,m=parseInt(p==null?void 0:p.getAttribute("aria-posinset"),10)-1;if(isNaN(m))return console.warn("row is invalid. Race condition?"),null;let v=this._rowColumns.get(p);if(!v)return console.warn("columns is null. Race condition?"),null;let S=f<v.length?v[f]:v.slice(-1)[0]+1;return S>=this._terminal.cols&&(++m,S=0),{row:m,column:S}},l=o(t),u=o(s);if(!(!l||!u)){if(l.row>u.row||l.row===u.row&&l.column>=u.column)throw new Error("invalid range");this._terminal.select(l.column,l.row,(u.row-l.row)*this._terminal.cols-l.column+u.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,l;e.style.transform="";let t=e.getBoundingClientRect().width,s=(l=(o=this._rowColumns.get(e))==null?void 0:o.slice(-1))==null?void 0:l[0];if(!s)return;let r=s*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};Cu=lt([ge(1,dg),ge(2,Os),ge(3,zs)],Cu);var Y_=class extends Ne{constructor(e,t,s,r,o){super(),this._element=e,this._mouseService=t,this._renderService=s,this._bufferService=r,this._linkProviderService=o,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new fe),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new fe),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(tt(()=>{var l;ur(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(l=this._activeProviderReplies)==null||l.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Ee(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Ee(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Ee(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Ee(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let s=e.composedPath();for(let r=0;r<s.length;r++){let o=s[r];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 r,o;(!this._activeProviderReplies||!t)&&((r=this._activeProviderReplies)==null||r.forEach(l=>{l==null||l.forEach(u=>{u.link.dispose&&u.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let s=!1;for(let[l,u]of this._linkProviderService.linkProviders.entries())t?(o=this._activeProviderReplies)!=null&&o.get(l)&&(s=this._checkLinkProviderResult(l,e,s)):u.provideLinks(e.y,h=>{var f,p;if(this._isMouseOut)return;let d=h==null?void 0:h.map(m=>({link:m}));(f=this._activeProviderReplies)==null||f.set(l,d),s=this._checkLinkProviderResult(l,e,s),((p=this._activeProviderReplies)==null?void 0:p.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let s=new Set;for(let r=0;r<t.size;r++){let o=t.get(r);if(o)for(let l=0;l<o.length;l++){let u=o[l],h=u.link.range.start.y<e?0:u.link.range.start.x,d=u.link.range.end.y>e?this._bufferService.cols:u.link.range.end.x;for(let f=h;f<=d;f++){if(s.has(f)){o.splice(l--,1);break}s.add(f)}}}}_checkLinkProviderResult(e,t,s){var l;if(!this._activeProviderReplies)return s;let r=this._activeProviderReplies.get(e),o=!1;for(let u=0;u<e;u++)(!this._activeProviderReplies.has(u)||this._activeProviderReplies.get(u))&&(o=!0);if(!o&&r){let u=r.find(h=>this._linkAtPosition(h.link,t));u&&(s=!0,this._handleNewLink(u))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let u=0;u<this._activeProviderReplies.size;u++){let h=(l=this._activeProviderReplies.get(u))==null?void 0:l.find(d=>this._linkAtPosition(d.link,t));if(h){s=!0,this._handleNewLink(h);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&QN(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,ur(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 s,r;return(r=(s=this._currentLink)==null?void 0:s.state)==null?void 0:r.decorations.pointerCursor},set:s=>{var r;(r=this._currentLink)!=null&&r.state&&this._currentLink.state.decorations.pointerCursor!==s&&(this._currentLink.state.decorations.pointerCursor=s,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",s))}},underline:{get:()=>{var s,r;return(r=(s=this._currentLink)==null?void 0:s.state)==null?void 0:r.decorations.underline},set:s=>{var r,o,l;(r=this._currentLink)!=null&&r.state&&((l=(o=this._currentLink)==null?void 0:o.state)==null?void 0:l.decorations.underline)!==s&&(this._currentLink.state.decorations.underline=s,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,s))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(s=>{if(!this._currentLink)return;let r=s.start===0?0:s.start+1+this._bufferService.buffer.ydisp,o=this._bufferService.buffer.ydisp+1+s.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=o&&(this._clearCurrentLink(r,o),this._lastMouseEvent)){let l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._askForLink(l,!1)}})))}_linkHover(e,t,s){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(s,t.text)}_fireUnderlineEvent(e,t){let s=e.range,r=this._bufferService.buffer.ydisp,o=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-r-1,s.end.x,s.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(o)}_linkLeave(e,t,s){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(s,t.text)}_linkAtPosition(e,t){let s=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,o=t.y*this._bufferService.cols+t.x;return s<=o&&o<=r}_positionFromMouseEvent(e,t,s){let r=s.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,s,r,o){return{x1:e,y1:t,x2:s,y2:r,cols:this._bufferService.cols,fg:o}}};Y_=lt([ge(1,_g),ge(2,zs),ge(3,Vt),ge(4,Pb)],Y_);function QN(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 JN=class extends WN{constructor(e={}){super(e),this._linkifier=this._register(new vo),this.browser=sw,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new vo),this._onCursorMove=this._register(new fe),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new fe),this.onKey=this._onKey.event,this._onRender=this._register(new fe),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new fe),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new fe),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new fe),this.onBell=this._onBell.event,this._onFocus=this._register(new fe),this._onBlur=this._register(new fe),this._onA11yCharEmitter=this._register(new fe),this._onA11yTabEmitter=this._register(new fe),this._onWillOpen=this._register(new fe),this._setup(),this._decorationService=this._instantiationService.createInstance(KN),this._instantiationService.setService(sl,this._decorationService),this._linkProviderService=this._instantiationService.createInstance($A),this._instantiationService.setService(Pb,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(f_)),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(Pt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Pt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Pt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Pt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(tt(()=>{var t,s;this._customKeyEventHandler=void 0,(s=(t=this.element)==null?void 0:t.parentNode)==null||s.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 s,r="";switch(t.index){case 256:s="foreground",r="10";break;case 257:s="background",r="11";break;case 258:s="cursor",r="12";break;default:s="ansi",r="4;"+t.index}switch(t.type){case 0:let o=Qe.toColorRGB(s==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[s]);this.coreService.triggerDataEvent(`${ae.ESC}]${r};${PN(o)}${tw.ST}`);break;case 1:if(s==="ansi")this._themeService.modifyColors(l=>l.ansi[t.index]=vt.toColor(...t.color));else{let l=s;this._themeService.modifyColors(u=>u[l]=vt.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(Cu,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ae.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(ae.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 s=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,o=t.getWidth(s),l=this._renderService.dimensions.css.cell.width*o,u=this.buffer.y*this._renderService.dimensions.css.cell.height,h=s*this._renderService.dimensions.css.cell.width;this.textarea.style.left=h+"px",this.textarea.style.top=u+"px",this.textarea.style.width=l+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Ee(this.element,"copy",t=>{this.hasSelection()&&sT(t,this._selectionService)}));let e=t=>nT(t,this.textarea,this.coreService,this.optionsService);this._register(Ee(this.textarea,"paste",e)),this._register(Ee(this.element,"paste",e)),nw?this._register(Ee(this.element,"mousedown",t=>{t.button===2&&ky(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Ee(this.element,"contextmenu",t=>{ky(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),wg&&this._register(Ee(this.element,"auxclick",t=>{t.button===1&&Tb(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Ee(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Ee(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Ee(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Ee(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Ee(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Ee(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Ee(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var 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(Ee(this.screenElement,"mousemove",l=>this.updateCursorStyle(l))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let s=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",c_.get()),aw||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",()=>s.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(jA,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Os,this._coreBrowserService),this._register(Ee(this.textarea,"focus",l=>this._handleTextAreaFocus(l))),this._register(Ee(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(B_,this._document,this._helperContainer),this._instantiationService.setService(Wu,this._charSizeService),this._themeService=this._instantiationService.createInstance(H_),this._instantiationService.setService(yo,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(bu),this._instantiationService.setService(Hb,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(O_,this.rows,this.screenElement)),this._instantiationService.setService(zs,this._renderService),this._register(this._renderService.onRenderedViewportChange(l=>this._onRender.fire(l))),this.onResize(l=>this._renderService.resize(l.cols,l.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(A_,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(L_),this._instantiationService.setService(_g,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Y_,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(D_,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(l=>{super.scrollLines(l,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(z_,this.element,this.screenElement,r)),this._instantiationService.setService(fT,this._selectionService),this._register(this._selectionService.onRequestScrollLines(l=>this.scrollLines(l.amount,l.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(l=>this._renderService.handleSelectionChanged(l.start,l.end,l.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(l=>{this.textarea.value=l,this.textarea.focus(),this.textarea.select()})),this._register(Pt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var l;this._selectionService.refresh(),(l=this._viewport)==null||l.queueSync()})),this._register(this._instantiationService.createInstance(T_,this.screenElement)),this._register(Ee(this.element,"mousedown",l=>this._selectionService.handleMouseDown(l))),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(Cu,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",l=>this._handleScreenReaderModeOptionChange(l))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Su,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",l=>{!this._overviewRulerRenderer&&l&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Su,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(R_,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function s(l){var f,p,m,v,S;let u=e._mouseService.getMouseReportCoords(l,e.screenElement);if(!u)return!1;let h,d;switch(l.overrideType||l.type){case"mousemove":d=32,l.buttons===void 0?(h=3,l.button!==void 0&&(h=l.button<3?l.button:3)):h=l.buttons&1?0:l.buttons&4?1:l.buttons&2?2:3;break;case"mouseup":d=0,h=l.button<3?l.button:3;break;case"mousedown":d=1,h=l.button<3?l.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(l)===!1)return!1;let y=l.deltaY;if(y===0||e.coreMouseService.consumeWheelEvent(l,(v=(m=(p=(f=e._renderService)==null?void 0:f.dimensions)==null?void 0:p.device)==null?void 0:m.cell)==null?void 0:v.height,(S=e._coreBrowserService)==null?void 0:S.dpr)===0)return!1;d=y<0?0:1,h=4;break;default:return!1}return d===void 0||h===void 0||h>4?!1:e.coreMouseService.triggerMouseEvent({col:u.col,row:u.row,x:u.x,y:u.y,button:h,action:d,ctrl:l.ctrlKey,alt:l.altKey,shift:l.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o={mouseup:l=>(s(l),l.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(l)),wheel:l=>(s(l),this.cancel(l,!0)),mousedrag:l=>{l.buttons&&s(l)},mousemove:l=>{l.buttons||s(l)}};this._register(this.coreMouseService.onProtocolChange(l=>{l?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(l)),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()),l&8?r.mousemove||(t.addEventListener("mousemove",o.mousemove),r.mousemove=o.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),l&16?r.wheel||(t.addEventListener("wheel",o.wheel,{passive:!1}),r.wheel=o.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),l&2?r.mouseup||(r.mouseup=o.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),l&4?r.mousedrag||(r.mousedrag=o.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Ee(t,"mousedown",l=>{if(l.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(l)))return s(l),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(l)})),this._register(Ee(t,"wheel",l=>{var u,h,d,f,p;if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(l)===!1)return!1;if(!this.buffer.hasScrollback){if(l.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(l,(f=(d=(h=(u=e._renderService)==null?void 0:u.dimensions)==null?void 0:h.device)==null?void 0:d.cell)==null?void 0:f.height,(p=e._coreBrowserService)==null?void 0:p.dpr)===0)return this.cancel(l,!0);let m=ae.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(l.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(m,!0),this.cancel(l,!0)}}},{passive:!1}))}refresh(e,t){var s;(s=this._renderService)==null||s.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){Db(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,s){this._selectionService.setSelection(e,t,s)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var s;(s=this._selectionService)==null||s.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 s=VN(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),s.type===3||s.type===2){let r=this.rows-1;return this.scrollLines(s.type===2?-r:r),this.cancel(e,!0)}if(s.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(s.cancel&&this.cancel(e,!0),!s.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((s.key===ae.ETX||s.key===ae.CR)&&(this.textarea.value=""),this._onKey.fire({key:s.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(s.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let s=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?s:s&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(e4(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 s;(s=this._charSizeService)==null||s.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(mt));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(ae.ESC+"[I"):this.coreService.triggerDataEvent(ae.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),s=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ae.ESC}[4;${s};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),o=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ae.ESC}[6;${o};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function e4(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var t4=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let s={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(s),t.dispose=()=>this._wrappedAddonDispose(s),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let s=0;s<this._addons.length;s++)if(this._addons[s]===e){t=s;break}if(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)}},i4=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 Ai)}translateToString(e,t,s){return this._line.translateToString(e,t,s)}},vS=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 i4(t)}getNullCell(){return new Ai}},s4=class extends Ne{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new fe),this.onBufferChange=this._onBufferChange.event,this._normal=new vS(this._core.buffers.normal,"normal"),this._alternate=new vS(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)}},n4=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,s=>t(s.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(s,r)=>t(s,r.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)}},r4=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}},o4=["cols","rows"],Fi=0,a4=class extends Ne{constructor(e){super(),this._core=this._register(new JN(e)),this._addonManager=this._register(new t4),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],s=(r,o)=>{this._checkReadonlyOptions(r),this._core.options[r]=o};for(let r in this._core.options){let o={get:t.bind(this,r),set:s.bind(this,r)};Object.defineProperty(this._publicOptions,r,o)}}_checkReadonlyOptions(e){if(o4.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 n4(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new r4(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 s4(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,s){this._verifyIntegers(e,t,s),this._core.select(e,t,s)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
97
|
+
`,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 c_.get()},set promptLabel(e){c_.set(e)},get tooMuchOutput(){return u_.get()},set tooMuchOutput(e){u_.set(e)}}}_verifyIntegers(...e){for(Fi of e)if(Fi===1/0||isNaN(Fi)||Fi%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Fi of e)if(Fi&&(Fi===1/0||isNaN(Fi)||Fi%1!==0||Fi<0))throw new Error("This API only accepts positive integers")}};/**
|
|
98
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
99
|
+
* @license MIT
|
|
100
|
+
*
|
|
101
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
102
|
+
* @license MIT
|
|
103
|
+
*
|
|
104
|
+
* Originally forked from (with the author's permission):
|
|
105
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
106
|
+
* http://bellard.org/jslinux/
|
|
107
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
108
|
+
*/var l4=2,c4=1,u4=class{activate(t){this._terminal=t}dispose(){}fit(){let t=this.proposeDimensions();if(!t||!this._terminal||isNaN(t.cols)||isNaN(t.rows))return;let s=this._terminal._core;(this._terminal.rows!==t.rows||this._terminal.cols!==t.cols)&&(s._renderService.clear(),this._terminal.resize(t.cols,t.rows))}proposeDimensions(){var v;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let t=this._terminal._core._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let s=this._terminal.options.scrollback===0?0:((v=this._terminal.options.overviewRuler)==null?void 0:v.width)||14,r=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(r.getPropertyValue("height")),l=Math.max(0,parseInt(r.getPropertyValue("width"))),u=window.getComputedStyle(this._terminal.element),h={top:parseInt(u.getPropertyValue("padding-top")),bottom:parseInt(u.getPropertyValue("padding-bottom")),right:parseInt(u.getPropertyValue("padding-right")),left:parseInt(u.getPropertyValue("padding-left"))},d=h.top+h.bottom,f=h.right+h.left,p=o-d,m=l-f-s;return{cols:Math.max(l4,Math.floor(m/t.css.cell.width)),rows:Math.max(c4,Math.floor(p/t.css.cell.height))}}};/**
|
|
109
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
110
|
+
* @license MIT
|
|
111
|
+
*
|
|
112
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
113
|
+
* @license MIT
|
|
114
|
+
*
|
|
115
|
+
* Originally forked from (with the author's permission):
|
|
116
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
117
|
+
* http://bellard.org/jslinux/
|
|
118
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
119
|
+
*/var h4=class{constructor(t,s,r,o={}){this._terminal=t,this._regex=s,this._handler=r,this._options=o}provideLinks(t,s){let r=d4.computeLink(t,this._regex,this._terminal,this._handler);s(this._addCallbacks(r))}_addCallbacks(t){return t.map(s=>(s.leave=this._options.leave,s.hover=(r,o)=>{if(this._options.hover){let{range:l}=s;this._options.hover(r,o,l)}},s))}};function f4(e){try{let t=new URL(e),s=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(s.toLocaleLowerCase())}catch{return!1}}var d4=class ru{static computeLink(t,s,r,o){let l=new RegExp(s.source,(s.flags||"")+"g"),[u,h]=ru._getWindowedLineStrings(t-1,r),d=u.join(""),f,p=[];for(;f=l.exec(d);){let m=f[0];if(!f4(m))continue;let[v,S]=ru._mapStrIdx(r,h,0,f.index),[y,b]=ru._mapStrIdx(r,v,S,m.length);if(v===-1||S===-1||y===-1||b===-1)continue;let x={start:{x:S+1,y:v+1},end:{x:b,y:y+1}};p.push({range:x,text:m,activate:o})}return p}static _getWindowedLineStrings(t,s){let r,o=t,l=t,u=0,h="",d=[];if(r=s.buffer.active.getLine(t)){let f=r.translateToString(!0);if(r.isWrapped&&f[0]!==" "){for(u=0;(r=s.buffer.active.getLine(--o))&&u<2048&&(h=r.translateToString(!0),u+=h.length,d.push(h),!(!r.isWrapped||h.indexOf(" ")!==-1)););d.reverse()}for(d.push(f),u=0;(r=s.buffer.active.getLine(++l))&&r.isWrapped&&u<2048&&(h=r.translateToString(!0),u+=h.length,d.push(h),h.indexOf(" ")===-1););}return[d,o]}static _mapStrIdx(t,s,r,o){let l=t.buffer.active,u=l.getNullCell(),h=r;for(;o;){let d=l.getLine(s);if(!d)return[-1,-1];for(let f=h;f<d.length;++f){d.getCell(f,u);let p=u.getChars();if(u.getWidth()&&(o-=p.length||1,f===d.length-1&&p==="")){let m=l.getLine(s+1);m&&m.isWrapped&&(m.getCell(0,u),u.getWidth()===2&&(o+=1))}if(o<0)return[s,f]}s++,h=0}return[s,h]}},_4=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function g4(e,t){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var p4=class{constructor(t=g4,s={}){this._handler=t,this._options=s}activate(t){this._terminal=t;let s=this._options,r=s.urlRegex||_4;this._linkProvider=this._terminal.registerLinkProvider(new h4(this._terminal,r,this._handler,s))}dispose(){var t;(t=this._linkProvider)==null||t.dispose()}};function m4(e){const t=new a4({fontFamily:"'SF Mono', Menlo, Monaco, 'Courier New', monospace",fontSize:12,lineHeight:1.2,theme:{background:"#1a1a1a",foreground:"#e8e4df",cursor:"#1a1a1a",cursorAccent:"#1a1a1a",selectionBackground:"rgba(255, 255, 255, 0.15)",black:"#1a1a1a",brightBlack:"#787068",white:"#e8e4df",brightWhite:"#faf9f7",red:"#ef4444",green:"#22c55e",yellow:"#eab308",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",brightRed:"#f87171",brightGreen:"#4ade80",brightYellow:"#facc15",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee"},cursorBlink:!1,cursorInactiveStyle:"none",scrollback:1e4,convertEol:!0}),s=new u4;return t.loadAddon(s),t.loadAddon(new p4),t.onData(r=>{e.current({type:"pty-input",data:r})}),{term:t,fitAddon:s}}function v4({sendMessage:e,ptyEvents:t}){const[s,r]=I.useState(!1),[o,l]=I.useState(!1),u=I.useRef(e);u.current=e;const h=I.useRef(null);h.current||(h.current=m4(u));const{term:d,fitAddon:f}=h.current,p=I.useRef(!1),m=I.useRef([]);I.useEffect(()=>()=>{d.dispose(),h.current=null},[d]),I.useEffect(()=>{const b=A=>{const E=A.detail;p.current?(d.write(E),l(!0)):m.current.push(E)},x=A=>{r(!1);const E=`\r
|
|
120
|
+
\x1B[90m[Process exited with code ${A.detail}. Press Enter to restart.]\x1B[0m`;p.current?d.writeln(E):m.current.push(E+`\r
|
|
121
|
+
`)},C=()=>{r(!0)};return t.addEventListener("data",b),t.addEventListener("exit",x),t.addEventListener("spawned",C),()=>{t.removeEventListener("data",b),t.removeEventListener("exit",x),t.removeEventListener("spawned",C)}},[t,d]);const v=I.useCallback(b=>{if(b){if(p.current)d.element&&b.appendChild(d.element);else if(d.open(b),p.current=!0,m.current.length>0){for(const x of m.current)d.write(x);m.current=[],l(!0)}f.fit(),d.focus(),u.current({type:"pty-resize",data:{cols:d.cols,rows:d.rows}})}},[d,f]),S=I.useCallback(()=>{f.fit(),u.current({type:"pty-resize",data:{cols:d.cols,rows:d.rows}})},[d,f]),y=I.useCallback(()=>{d.clear(),u.current({type:"pty-spawn"})},[d]);return{attachTo:v,fit:S,ptyAlive:s,hasData:o,restart:y}}function yS({defaultWidth:e,minWidth:t,maxWidth:s,side:r}){const[o,l]=I.useState(e),u=I.useRef(!1),h=I.useRef(0),d=I.useRef(0),f=I.useCallback(p=>{p.preventDefault(),u.current=!0,h.current=p.clientX,d.current=o},[o]);return I.useEffect(()=>{const p=v=>{if(!u.current)return;const S=v.clientX-h.current,y=r==="right"?d.current+S:d.current-S;l(Math.max(t,Math.min(s,y)))},m=()=>{u.current=!1};return window.addEventListener("mousemove",p),window.addEventListener("mouseup",m),()=>{window.removeEventListener("mousemove",p),window.removeEventListener("mouseup",m)}},[t,s,r]),{width:o,onDragStart:f}}function Wd(e,t,s){if(e&&e.length){const[r,o]=t,l=Math.PI/180*s,u=Math.cos(l),h=Math.sin(l);for(const d of e){const[f,p]=d;d[0]=(f-r)*u-(p-o)*h+r,d[1]=(f-r)*h+(p-o)*u+o}}}function y4(e,t){return e[0]===t[0]&&e[1]===t[1]}function S4(e,t,s,r=1){const o=s,l=Math.max(t,.1),u=e[0]&&e[0][0]&&typeof e[0][0]=="number"?[e]:e,h=[0,0];if(o)for(const f of u)Wd(f,h,o);const d=(function(f,p,m){const v=[];for(const A of f){const E=[...A];y4(E[0],E[E.length-1])||E.push([E[0][0],E[0][1]]),E.length>2&&v.push(E)}const S=[];p=Math.max(p,.1);const y=[];for(const A of v)for(let E=0;E<A.length-1;E++){const D=A[E],H=A[E+1];if(D[1]!==H[1]){const O=Math.min(D[1],H[1]);y.push({ymin:O,ymax:Math.max(D[1],H[1]),x:O===D[1]?D[0]:H[0],islope:(H[0]-D[0])/(H[1]-D[1])})}}if(y.sort(((A,E)=>A.ymin<E.ymin?-1:A.ymin>E.ymin?1:A.x<E.x?-1:A.x>E.x?1:A.ymax===E.ymax?0:(A.ymax-E.ymax)/Math.abs(A.ymax-E.ymax))),!y.length)return S;let b=[],x=y[0].ymin,C=0;for(;b.length||y.length;){if(y.length){let A=-1;for(let E=0;E<y.length&&!(y[E].ymin>x);E++)A=E;y.splice(0,A+1).forEach((E=>{b.push({s:x,edge:E})}))}if(b=b.filter((A=>!(A.edge.ymax<=x))),b.sort(((A,E)=>A.edge.x===E.edge.x?0:(A.edge.x-E.edge.x)/Math.abs(A.edge.x-E.edge.x))),(m!==1||C%p==0)&&b.length>1)for(let A=0;A<b.length;A+=2){const E=A+1;if(E>=b.length)break;const D=b[A].edge,H=b[E].edge;S.push([[Math.round(D.x),x],[Math.round(H.x),x]])}x+=m,b.forEach((A=>{A.edge.x=A.edge.x+m*A.edge.islope})),C++}return S})(u,l,r);if(o){for(const f of u)Wd(f,h,-o);(function(f,p,m){const v=[];f.forEach((S=>v.push(...S))),Wd(v,p,m)})(d,h,-o)}return d}function ol(e,t){var s;const r=t.hachureAngle+90;let o=t.hachureGap;o<0&&(o=4*t.strokeWidth),o=Math.round(Math.max(o,.1));let l=1;return t.roughness>=1&&(((s=t.randomizer)===null||s===void 0?void 0:s.next())||Math.random())>.7&&(l=o),S4(e,o,r,l||1)}class xg{constructor(t){this.helper=t}fillPolygons(t,s){return this._fillPolygons(t,s)}_fillPolygons(t,s){const r=ol(t,s);return{type:"fillSketch",ops:this.renderLines(r,s)}}renderLines(t,s){const r=[];for(const o of t)r.push(...this.helper.doubleLineOps(o[0][0],o[0][1],o[1][0],o[1][1],s));return r}}function Xu(e){const t=e[0],s=e[1];return Math.sqrt(Math.pow(t[0]-s[0],2)+Math.pow(t[1]-s[1],2))}class b4 extends xg{fillPolygons(t,s){let r=s.hachureGap;r<0&&(r=4*s.strokeWidth),r=Math.max(r,.1);const o=ol(t,Object.assign({},s,{hachureGap:r})),l=Math.PI/180*s.hachureAngle,u=[],h=.5*r*Math.cos(l),d=.5*r*Math.sin(l);for(const[f,p]of o)Xu([f,p])&&u.push([[f[0]-h,f[1]+d],[...p]],[[f[0]+h,f[1]-d],[...p]]);return{type:"fillSketch",ops:this.renderLines(u,s)}}}class w4 extends xg{fillPolygons(t,s){const r=this._fillPolygons(t,s),o=Object.assign({},s,{hachureAngle:s.hachureAngle+90}),l=this._fillPolygons(t,o);return r.ops=r.ops.concat(l.ops),r}}class x4{constructor(t){this.helper=t}fillPolygons(t,s){const r=ol(t,s=Object.assign({},s,{hachureAngle:0}));return this.dotsOnLines(r,s)}dotsOnLines(t,s){const r=[];let o=s.hachureGap;o<0&&(o=4*s.strokeWidth),o=Math.max(o,.1);let l=s.fillWeight;l<0&&(l=s.strokeWidth/2);const u=o/4;for(const h of t){const d=Xu(h),f=d/o,p=Math.ceil(f)-1,m=d-p*o,v=(h[0][0]+h[1][0])/2-o/4,S=Math.min(h[0][1],h[1][1]);for(let y=0;y<p;y++){const b=S+m+y*o,x=v-u+2*Math.random()*u,C=b-u+2*Math.random()*u,A=this.helper.ellipse(x,C,l,l,s);r.push(...A.ops)}}return{type:"fillSketch",ops:r}}}class C4{constructor(t){this.helper=t}fillPolygons(t,s){const r=ol(t,s);return{type:"fillSketch",ops:this.dashedLine(r,s)}}dashedLine(t,s){const r=s.dashOffset<0?s.hachureGap<0?4*s.strokeWidth:s.hachureGap:s.dashOffset,o=s.dashGap<0?s.hachureGap<0?4*s.strokeWidth:s.hachureGap:s.dashGap,l=[];return t.forEach((u=>{const h=Xu(u),d=Math.floor(h/(r+o)),f=(h+o-d*(r+o))/2;let p=u[0],m=u[1];p[0]>m[0]&&(p=u[1],m=u[0]);const v=Math.atan((m[1]-p[1])/(m[0]-p[0]));for(let S=0;S<d;S++){const y=S*(r+o),b=y+r,x=[p[0]+y*Math.cos(v)+f*Math.cos(v),p[1]+y*Math.sin(v)+f*Math.sin(v)],C=[p[0]+b*Math.cos(v)+f*Math.cos(v),p[1]+b*Math.sin(v)+f*Math.sin(v)];l.push(...this.helper.doubleLineOps(x[0],x[1],C[0],C[1],s))}})),l}}class E4{constructor(t){this.helper=t}fillPolygons(t,s){const r=s.hachureGap<0?4*s.strokeWidth:s.hachureGap,o=s.zigzagOffset<0?r:s.zigzagOffset,l=ol(t,s=Object.assign({},s,{hachureGap:r+o}));return{type:"fillSketch",ops:this.zigzagLines(l,o,s)}}zigzagLines(t,s,r){const o=[];return t.forEach((l=>{const u=Xu(l),h=Math.round(u/(2*s));let d=l[0],f=l[1];d[0]>f[0]&&(d=l[1],f=l[0]);const p=Math.atan((f[1]-d[1])/(f[0]-d[0]));for(let m=0;m<h;m++){const v=2*m*s,S=2*(m+1)*s,y=Math.sqrt(2*Math.pow(s,2)),b=[d[0]+v*Math.cos(p),d[1]+v*Math.sin(p)],x=[d[0]+S*Math.cos(p),d[1]+S*Math.sin(p)],C=[b[0]+y*Math.cos(p+Math.PI/4),b[1]+y*Math.sin(p+Math.PI/4)];o.push(...this.helper.doubleLineOps(b[0],b[1],C[0],C[1],r),...this.helper.doubleLineOps(C[0],C[1],x[0],x[1],r))}})),o}}const si={};class M4{constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}}const k4=0,Yd=1,SS=2,Yc={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function Vd(e,t){return e.type===t}function Cg(e){const t=[],s=(function(u){const h=new Array;for(;u!=="";)if(u.match(/^([ \t\r\n,]+)/))u=u.substr(RegExp.$1.length);else if(u.match(/^([aAcChHlLmMqQsStTvVzZ])/))h[h.length]={type:k4,text:RegExp.$1},u=u.substr(RegExp.$1.length);else{if(!u.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];h[h.length]={type:Yd,text:`${parseFloat(RegExp.$1)}`},u=u.substr(RegExp.$1.length)}return h[h.length]={type:SS,text:""},h})(e);let r="BOD",o=0,l=s[o];for(;!Vd(l,SS);){let u=0;const h=[];if(r==="BOD"){if(l.text!=="M"&&l.text!=="m")return Cg("M0,0"+e);o++,u=Yc[l.text],r=l.text}else Vd(l,Yd)?u=Yc[r]:(o++,u=Yc[l.text],r=l.text);if(!(o+u<s.length))throw new Error("Path data ended short");for(let d=o;d<o+u;d++){const f=s[d];if(!Vd(f,Yd))throw new Error("Param not a number: "+r+","+f.text);h[h.length]=+f.text}if(typeof Yc[r]!="number")throw new Error("Bad segment: "+r);{const d={key:r,data:h};t.push(d),o+=u,l=s[o],r==="M"&&(r="L"),r==="m"&&(r="l")}}return t}function mw(e){let t=0,s=0,r=0,o=0;const l=[];for(const{key:u,data:h}of e)switch(u){case"M":l.push({key:"M",data:[...h]}),[t,s]=h,[r,o]=h;break;case"m":t+=h[0],s+=h[1],l.push({key:"M",data:[t,s]}),r=t,o=s;break;case"L":l.push({key:"L",data:[...h]}),[t,s]=h;break;case"l":t+=h[0],s+=h[1],l.push({key:"L",data:[t,s]});break;case"C":l.push({key:"C",data:[...h]}),t=h[4],s=h[5];break;case"c":{const d=h.map(((f,p)=>p%2?f+s:f+t));l.push({key:"C",data:d}),t=d[4],s=d[5];break}case"Q":l.push({key:"Q",data:[...h]}),t=h[2],s=h[3];break;case"q":{const d=h.map(((f,p)=>p%2?f+s:f+t));l.push({key:"Q",data:d}),t=d[2],s=d[3];break}case"A":l.push({key:"A",data:[...h]}),t=h[5],s=h[6];break;case"a":t+=h[5],s+=h[6],l.push({key:"A",data:[h[0],h[1],h[2],h[3],h[4],t,s]});break;case"H":l.push({key:"H",data:[...h]}),t=h[0];break;case"h":t+=h[0],l.push({key:"H",data:[t]});break;case"V":l.push({key:"V",data:[...h]}),s=h[0];break;case"v":s+=h[0],l.push({key:"V",data:[s]});break;case"S":l.push({key:"S",data:[...h]}),t=h[2],s=h[3];break;case"s":{const d=h.map(((f,p)=>p%2?f+s:f+t));l.push({key:"S",data:d}),t=d[2],s=d[3];break}case"T":l.push({key:"T",data:[...h]}),t=h[0],s=h[1];break;case"t":t+=h[0],s+=h[1],l.push({key:"T",data:[t,s]});break;case"Z":case"z":l.push({key:"Z",data:[]}),t=r,s=o}return l}function vw(e){const t=[];let s="",r=0,o=0,l=0,u=0,h=0,d=0;for(const{key:f,data:p}of e){switch(f){case"M":t.push({key:"M",data:[...p]}),[r,o]=p,[l,u]=p;break;case"C":t.push({key:"C",data:[...p]}),r=p[4],o=p[5],h=p[2],d=p[3];break;case"L":t.push({key:"L",data:[...p]}),[r,o]=p;break;case"H":r=p[0],t.push({key:"L",data:[r,o]});break;case"V":o=p[0],t.push({key:"L",data:[r,o]});break;case"S":{let m=0,v=0;s==="C"||s==="S"?(m=r+(r-h),v=o+(o-d)):(m=r,v=o),t.push({key:"C",data:[m,v,...p]}),h=p[0],d=p[1],r=p[2],o=p[3];break}case"T":{const[m,v]=p;let S=0,y=0;s==="Q"||s==="T"?(S=r+(r-h),y=o+(o-d)):(S=r,y=o);const b=r+2*(S-r)/3,x=o+2*(y-o)/3,C=m+2*(S-m)/3,A=v+2*(y-v)/3;t.push({key:"C",data:[b,x,C,A,m,v]}),h=S,d=y,r=m,o=v;break}case"Q":{const[m,v,S,y]=p,b=r+2*(m-r)/3,x=o+2*(v-o)/3,C=S+2*(m-S)/3,A=y+2*(v-y)/3;t.push({key:"C",data:[b,x,C,A,S,y]}),h=m,d=v,r=S,o=y;break}case"A":{const m=Math.abs(p[0]),v=Math.abs(p[1]),S=p[2],y=p[3],b=p[4],x=p[5],C=p[6];m===0||v===0?(t.push({key:"C",data:[r,o,x,C,x,C]}),r=x,o=C):(r!==x||o!==C)&&(yw(r,o,x,C,m,v,S,y,b).forEach((function(A){t.push({key:"C",data:A})})),r=x,o=C);break}case"Z":t.push({key:"Z",data:[]}),r=l,o=u}s=f}return t}function Ca(e,t,s){return[e*Math.cos(s)-t*Math.sin(s),e*Math.sin(s)+t*Math.cos(s)]}function yw(e,t,s,r,o,l,u,h,d,f){const p=(m=u,Math.PI*m/180);var m;let v=[],S=0,y=0,b=0,x=0;if(f)[S,y,b,x]=f;else{[e,t]=Ca(e,t,-p),[s,r]=Ca(s,r,-p);const q=(e-s)/2,N=(t-r)/2;let z=q*q/(o*o)+N*N/(l*l);z>1&&(z=Math.sqrt(z),o*=z,l*=z);const M=o*o,L=l*l,B=M*L-M*N*N-L*q*q,j=M*N*N+L*q*q,Z=(h===d?-1:1)*Math.sqrt(Math.abs(B/j));b=Z*o*N/l+(e+s)/2,x=Z*-l*q/o+(t+r)/2,S=Math.asin(parseFloat(((t-x)/l).toFixed(9))),y=Math.asin(parseFloat(((r-x)/l).toFixed(9))),e<b&&(S=Math.PI-S),s<b&&(y=Math.PI-y),S<0&&(S=2*Math.PI+S),y<0&&(y=2*Math.PI+y),d&&S>y&&(S-=2*Math.PI),!d&&y>S&&(y-=2*Math.PI)}let C=y-S;if(Math.abs(C)>120*Math.PI/180){const q=y,N=s,z=r;y=d&&y>S?S+120*Math.PI/180*1:S+120*Math.PI/180*-1,v=yw(s=b+o*Math.cos(y),r=x+l*Math.sin(y),N,z,o,l,u,0,d,[y,q,b,x])}C=y-S;const A=Math.cos(S),E=Math.sin(S),D=Math.cos(y),H=Math.sin(y),O=Math.tan(C/4),P=4/3*o*O,V=4/3*l*O,G=[e,t],ne=[e+P*E,t-V*A],X=[s+P*H,r-V*D],$=[s,r];if(ne[0]=2*G[0]-ne[0],ne[1]=2*G[1]-ne[1],f)return[ne,X,$].concat(v);{v=[ne,X,$].concat(v);const q=[];for(let N=0;N<v.length;N+=3){const z=Ca(v[N][0],v[N][1],p),M=Ca(v[N+1][0],v[N+1][1],p),L=Ca(v[N+2][0],v[N+2][1],p);q.push([z[0],z[1],M[0],M[1],L[0],L[1]])}return q}}const D4={randOffset:function(e,t){return xe(e,t)},randOffsetWithRange:function(e,t,s){return Eu(e,t,s)},ellipse:function(e,t,s,r,o){const l=bw(s,r,o);return V_(e,t,o,l).opset},doubleLineOps:function(e,t,s,r,o){return Cn(e,t,s,r,o,!0)}};function Sw(e,t,s,r,o){return{type:"path",ops:Cn(e,t,s,r,o)}}function ou(e,t,s){const r=(e||[]).length;if(r>2){const o=[];for(let l=0;l<r-1;l++)o.push(...Cn(e[l][0],e[l][1],e[l+1][0],e[l+1][1],s));return t&&o.push(...Cn(e[r-1][0],e[r-1][1],e[0][0],e[0][1],s)),{type:"path",ops:o}}return r===2?Sw(e[0][0],e[0][1],e[1][0],e[1][1],s):{type:"path",ops:[]}}function T4(e,t,s,r,o){return(function(l,u){return ou(l,!0,u)})([[e,t],[e+s,t],[e+s,t+r],[e,t+r]],o)}function bS(e,t){if(e.length){const s=typeof e[0][0]=="number"?[e]:e,r=Vc(s[0],1*(1+.2*t.roughness),t),o=t.disableMultiStroke?[]:Vc(s[0],1.5*(1+.22*t.roughness),CS(t));for(let l=1;l<s.length;l++){const u=s[l];if(u.length){const h=Vc(u,1*(1+.2*t.roughness),t),d=t.disableMultiStroke?[]:Vc(u,1.5*(1+.22*t.roughness),CS(t));for(const f of h)f.op!=="move"&&r.push(f);for(const f of d)f.op!=="move"&&o.push(f)}}return{type:"path",ops:r.concat(o)}}return{type:"path",ops:[]}}function bw(e,t,s){const r=Math.sqrt(2*Math.PI*Math.sqrt((Math.pow(e/2,2)+Math.pow(t/2,2))/2)),o=Math.ceil(Math.max(s.curveStepCount,s.curveStepCount/Math.sqrt(200)*r)),l=2*Math.PI/o;let u=Math.abs(e/2),h=Math.abs(t/2);const d=1-s.curveFitting;return u+=xe(u*d,s),h+=xe(h*d,s),{increment:l,rx:u,ry:h}}function V_(e,t,s,r){const[o,l]=ES(r.increment,e,t,r.rx,r.ry,1,r.increment*Eu(.1,Eu(.4,1,s),s),s);let u=Mu(o,null,s);if(!s.disableMultiStroke&&s.roughness!==0){const[h]=ES(r.increment,e,t,r.rx,r.ry,1.5,0,s),d=Mu(h,null,s);u=u.concat(d)}return{estimatedPoints:l,opset:{type:"path",ops:u}}}function wS(e,t,s,r,o,l,u,h,d){const f=e,p=t;let m=Math.abs(s/2),v=Math.abs(r/2);m+=xe(.01*m,d),v+=xe(.01*v,d);let S=o,y=l;for(;S<0;)S+=2*Math.PI,y+=2*Math.PI;y-S>2*Math.PI&&(S=0,y=2*Math.PI);const b=2*Math.PI/d.curveStepCount,x=Math.min(b/2,(y-S)/2),C=MS(x,f,p,m,v,S,y,1,d);if(!d.disableMultiStroke){const A=MS(x,f,p,m,v,S,y,1.5,d);C.push(...A)}return u&&(h?C.push(...Cn(f,p,f+m*Math.cos(S),p+v*Math.sin(S),d),...Cn(f,p,f+m*Math.cos(y),p+v*Math.sin(y),d)):C.push({op:"lineTo",data:[f,p]},{op:"lineTo",data:[f+m*Math.cos(S),p+v*Math.sin(S)]})),{type:"path",ops:C}}function xS(e,t){const s=vw(mw(Cg(e))),r=[];let o=[0,0],l=[0,0];for(const{key:u,data:h}of s)switch(u){case"M":l=[h[0],h[1]],o=[h[0],h[1]];break;case"L":r.push(...Cn(l[0],l[1],h[0],h[1],t)),l=[h[0],h[1]];break;case"C":{const[d,f,p,m,v,S]=h;r.push(...A4(d,f,p,m,v,S,l,t)),l=[v,S];break}case"Z":r.push(...Cn(l[0],l[1],o[0],o[1],t)),l=[o[0],o[1]]}return{type:"path",ops:r}}function Xd(e,t){const s=[];for(const r of e)if(r.length){const o=t.maxRandomnessOffset||0,l=r.length;if(l>2){s.push({op:"move",data:[r[0][0]+xe(o,t),r[0][1]+xe(o,t)]});for(let u=1;u<l;u++)s.push({op:"lineTo",data:[r[u][0]+xe(o,t),r[u][1]+xe(o,t)]})}}return{type:"fillPath",ops:s}}function so(e,t){return(function(s,r){let o=s.fillStyle||"hachure";if(!si[o])switch(o){case"zigzag":si[o]||(si[o]=new b4(r));break;case"cross-hatch":si[o]||(si[o]=new w4(r));break;case"dots":si[o]||(si[o]=new x4(r));break;case"dashed":si[o]||(si[o]=new C4(r));break;case"zigzag-line":si[o]||(si[o]=new E4(r));break;default:o="hachure",si[o]||(si[o]=new xg(r))}return si[o]})(t,D4).fillPolygons(e,t)}function CS(e){const t=Object.assign({},e);return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}function ww(e){return e.randomizer||(e.randomizer=new M4(e.seed||0)),e.randomizer.next()}function Eu(e,t,s,r=1){return s.roughness*r*(ww(s)*(t-e)+e)}function xe(e,t,s=1){return Eu(-e,e,t,s)}function Cn(e,t,s,r,o,l=!1){const u=l?o.disableMultiStrokeFill:o.disableMultiStroke,h=X_(e,t,s,r,o,!0,!1);if(u)return h;const d=X_(e,t,s,r,o,!0,!0);return h.concat(d)}function X_(e,t,s,r,o,l,u){const h=Math.pow(e-s,2)+Math.pow(t-r,2),d=Math.sqrt(h);let f=1;f=d<200?1:d>500?.4:-.0016668*d+1.233334;let p=o.maxRandomnessOffset||0;p*p*100>h&&(p=d/10);const m=p/2,v=.2+.2*ww(o);let S=o.bowing*o.maxRandomnessOffset*(r-t)/200,y=o.bowing*o.maxRandomnessOffset*(e-s)/200;S=xe(S,o,f),y=xe(y,o,f);const b=[],x=()=>xe(m,o,f),C=()=>xe(p,o,f),A=o.preserveVertices;return u?b.push({op:"move",data:[e+(A?0:x()),t+(A?0:x())]}):b.push({op:"move",data:[e+(A?0:xe(p,o,f)),t+(A?0:xe(p,o,f))]}),u?b.push({op:"bcurveTo",data:[S+e+(s-e)*v+x(),y+t+(r-t)*v+x(),S+e+2*(s-e)*v+x(),y+t+2*(r-t)*v+x(),s+(A?0:x()),r+(A?0:x())]}):b.push({op:"bcurveTo",data:[S+e+(s-e)*v+C(),y+t+(r-t)*v+C(),S+e+2*(s-e)*v+C(),y+t+2*(r-t)*v+C(),s+(A?0:C()),r+(A?0:C())]}),b}function Vc(e,t,s){if(!e.length)return[];const r=[];r.push([e[0][0]+xe(t,s),e[0][1]+xe(t,s)]),r.push([e[0][0]+xe(t,s),e[0][1]+xe(t,s)]);for(let o=1;o<e.length;o++)r.push([e[o][0]+xe(t,s),e[o][1]+xe(t,s)]),o===e.length-1&&r.push([e[o][0]+xe(t,s),e[o][1]+xe(t,s)]);return Mu(r,null,s)}function Mu(e,t,s){const r=e.length,o=[];if(r>3){const l=[],u=1-s.curveTightness;o.push({op:"move",data:[e[1][0],e[1][1]]});for(let h=1;h+2<r;h++){const d=e[h];l[0]=[d[0],d[1]],l[1]=[d[0]+(u*e[h+1][0]-u*e[h-1][0])/6,d[1]+(u*e[h+1][1]-u*e[h-1][1])/6],l[2]=[e[h+1][0]+(u*e[h][0]-u*e[h+2][0])/6,e[h+1][1]+(u*e[h][1]-u*e[h+2][1])/6],l[3]=[e[h+1][0],e[h+1][1]],o.push({op:"bcurveTo",data:[l[1][0],l[1][1],l[2][0],l[2][1],l[3][0],l[3][1]]})}}else r===3?(o.push({op:"move",data:[e[1][0],e[1][1]]}),o.push({op:"bcurveTo",data:[e[1][0],e[1][1],e[2][0],e[2][1],e[2][0],e[2][1]]})):r===2&&o.push(...X_(e[0][0],e[0][1],e[1][0],e[1][1],s,!0,!0));return o}function ES(e,t,s,r,o,l,u,h){const d=[],f=[];if(h.roughness===0){e/=4,f.push([t+r*Math.cos(-e),s+o*Math.sin(-e)]);for(let p=0;p<=2*Math.PI;p+=e){const m=[t+r*Math.cos(p),s+o*Math.sin(p)];d.push(m),f.push(m)}f.push([t+r*Math.cos(0),s+o*Math.sin(0)]),f.push([t+r*Math.cos(e),s+o*Math.sin(e)])}else{const p=xe(.5,h)-Math.PI/2;f.push([xe(l,h)+t+.9*r*Math.cos(p-e),xe(l,h)+s+.9*o*Math.sin(p-e)]);const m=2*Math.PI+p-.01;for(let v=p;v<m;v+=e){const S=[xe(l,h)+t+r*Math.cos(v),xe(l,h)+s+o*Math.sin(v)];d.push(S),f.push(S)}f.push([xe(l,h)+t+r*Math.cos(p+2*Math.PI+.5*u),xe(l,h)+s+o*Math.sin(p+2*Math.PI+.5*u)]),f.push([xe(l,h)+t+.98*r*Math.cos(p+u),xe(l,h)+s+.98*o*Math.sin(p+u)]),f.push([xe(l,h)+t+.9*r*Math.cos(p+.5*u),xe(l,h)+s+.9*o*Math.sin(p+.5*u)])}return[f,d]}function MS(e,t,s,r,o,l,u,h,d){const f=l+xe(.1,d),p=[];p.push([xe(h,d)+t+.9*r*Math.cos(f-e),xe(h,d)+s+.9*o*Math.sin(f-e)]);for(let m=f;m<=u;m+=e)p.push([xe(h,d)+t+r*Math.cos(m),xe(h,d)+s+o*Math.sin(m)]);return p.push([t+r*Math.cos(u),s+o*Math.sin(u)]),p.push([t+r*Math.cos(u),s+o*Math.sin(u)]),Mu(p,null,d)}function A4(e,t,s,r,o,l,u,h){const d=[],f=[h.maxRandomnessOffset||1,(h.maxRandomnessOffset||1)+.3];let p=[0,0];const m=h.disableMultiStroke?1:2,v=h.preserveVertices;for(let S=0;S<m;S++)S===0?d.push({op:"move",data:[u[0],u[1]]}):d.push({op:"move",data:[u[0]+(v?0:xe(f[0],h)),u[1]+(v?0:xe(f[0],h))]}),p=v?[o,l]:[o+xe(f[S],h),l+xe(f[S],h)],d.push({op:"bcurveTo",data:[e+xe(f[S],h),t+xe(f[S],h),s+xe(f[S],h),r+xe(f[S],h),p[0],p[1]]});return d}function Ea(e){return[...e]}function kS(e,t=0){const s=e.length;if(s<3)throw new Error("A curve must have at least three points.");const r=[];if(s===3)r.push(Ea(e[0]),Ea(e[1]),Ea(e[2]),Ea(e[2]));else{const o=[];o.push(e[0],e[0]);for(let h=1;h<e.length;h++)o.push(e[h]),h===e.length-1&&o.push(e[h]);const l=[],u=1-t;r.push(Ea(o[0]));for(let h=1;h+2<o.length;h++){const d=o[h];l[0]=[d[0],d[1]],l[1]=[d[0]+(u*o[h+1][0]-u*o[h-1][0])/6,d[1]+(u*o[h+1][1]-u*o[h-1][1])/6],l[2]=[o[h+1][0]+(u*o[h][0]-u*o[h+2][0])/6,o[h+1][1]+(u*o[h][1]-u*o[h+2][1])/6],l[3]=[o[h+1][0],o[h+1][1]],r.push(l[1],l[2],l[3])}}return r}function au(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function N4(e,t,s){const r=au(t,s);if(r===0)return au(e,t);let o=((e[0]-t[0])*(s[0]-t[0])+(e[1]-t[1])*(s[1]-t[1]))/r;return o=Math.max(0,Math.min(1,o)),au(e,er(t,s,o))}function er(e,t,s){return[e[0]+(t[0]-e[0])*s,e[1]+(t[1]-e[1])*s]}function K_(e,t,s,r){const o=r||[];if((function(h,d){const f=h[d+0],p=h[d+1],m=h[d+2],v=h[d+3];let S=3*p[0]-2*f[0]-v[0];S*=S;let y=3*p[1]-2*f[1]-v[1];y*=y;let b=3*m[0]-2*v[0]-f[0];b*=b;let x=3*m[1]-2*v[1]-f[1];return x*=x,S<b&&(S=b),y<x&&(y=x),S+y})(e,t)<s){const h=e[t+0];o.length?(l=o[o.length-1],u=h,Math.sqrt(au(l,u))>1&&o.push(h)):o.push(h),o.push(e[t+3])}else{const d=e[t+0],f=e[t+1],p=e[t+2],m=e[t+3],v=er(d,f,.5),S=er(f,p,.5),y=er(p,m,.5),b=er(v,S,.5),x=er(S,y,.5),C=er(b,x,.5);K_([d,v,b,C],0,s,o),K_([C,x,y,m],0,s,o)}var l,u;return o}function R4(e,t){return ku(e,0,e.length,t)}function ku(e,t,s,r,o){const l=o||[],u=e[t],h=e[s-1];let d=0,f=1;for(let p=t+1;p<s-1;++p){const m=N4(e[p],u,h);m>d&&(d=m,f=p)}return Math.sqrt(d)>r?(ku(e,t,f+1,r,l),ku(e,f,s,r,l)):(l.length||l.push(u),l.push(h)),l}function Kd(e,t=.15,s){const r=[],o=(e.length-1)/3;for(let l=0;l<o;l++)K_(e,3*l,t,r);return s&&s>0?ku(r,0,r.length,s):r}const pi="none";class Du{constructor(t){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=t||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Math.floor(Math.random()*2**31)}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,s,r){return{shape:t,sets:s||[],options:r||this.defaultOptions}}line(t,s,r,o,l){const u=this._o(l);return this._d("line",[Sw(t,s,r,o,u)],u)}rectangle(t,s,r,o,l){const u=this._o(l),h=[],d=T4(t,s,r,o,u);if(u.fill){const f=[[t,s],[t+r,s],[t+r,s+o],[t,s+o]];u.fillStyle==="solid"?h.push(Xd([f],u)):h.push(so([f],u))}return u.stroke!==pi&&h.push(d),this._d("rectangle",h,u)}ellipse(t,s,r,o,l){const u=this._o(l),h=[],d=bw(r,o,u),f=V_(t,s,u,d);if(u.fill)if(u.fillStyle==="solid"){const p=V_(t,s,u,d).opset;p.type="fillPath",h.push(p)}else h.push(so([f.estimatedPoints],u));return u.stroke!==pi&&h.push(f.opset),this._d("ellipse",h,u)}circle(t,s,r,o){const l=this.ellipse(t,s,r,r,o);return l.shape="circle",l}linearPath(t,s){const r=this._o(s);return this._d("linearPath",[ou(t,!1,r)],r)}arc(t,s,r,o,l,u,h=!1,d){const f=this._o(d),p=[],m=wS(t,s,r,o,l,u,h,!0,f);if(h&&f.fill)if(f.fillStyle==="solid"){const v=Object.assign({},f);v.disableMultiStroke=!0;const S=wS(t,s,r,o,l,u,!0,!1,v);S.type="fillPath",p.push(S)}else p.push((function(v,S,y,b,x,C,A){const E=v,D=S;let H=Math.abs(y/2),O=Math.abs(b/2);H+=xe(.01*H,A),O+=xe(.01*O,A);let P=x,V=C;for(;P<0;)P+=2*Math.PI,V+=2*Math.PI;V-P>2*Math.PI&&(P=0,V=2*Math.PI);const G=(V-P)/A.curveStepCount,ne=[];for(let X=P;X<=V;X+=G)ne.push([E+H*Math.cos(X),D+O*Math.sin(X)]);return ne.push([E+H*Math.cos(V),D+O*Math.sin(V)]),ne.push([E,D]),so([ne],A)})(t,s,r,o,l,u,f));return f.stroke!==pi&&p.push(m),this._d("arc",p,f)}curve(t,s){const r=this._o(s),o=[],l=bS(t,r);if(r.fill&&r.fill!==pi)if(r.fillStyle==="solid"){const u=bS(t,Object.assign(Object.assign({},r),{disableMultiStroke:!0,roughness:r.roughness?r.roughness+r.fillShapeRoughnessGain:0}));o.push({type:"fillPath",ops:this._mergedShape(u.ops)})}else{const u=[],h=t;if(h.length){const d=typeof h[0][0]=="number"?[h]:h;for(const f of d)f.length<3?u.push(...f):f.length===3?u.push(...Kd(kS([f[0],f[0],f[1],f[2]]),10,(1+r.roughness)/2)):u.push(...Kd(kS(f),10,(1+r.roughness)/2))}u.length&&o.push(so([u],r))}return r.stroke!==pi&&o.push(l),this._d("curve",o,r)}polygon(t,s){const r=this._o(s),o=[],l=ou(t,!0,r);return r.fill&&(r.fillStyle==="solid"?o.push(Xd([t],r)):o.push(so([t],r))),r.stroke!==pi&&o.push(l),this._d("polygon",o,r)}path(t,s){const r=this._o(s),o=[];if(!t)return this._d("path",o,r);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");const l=r.fill&&r.fill!=="transparent"&&r.fill!==pi,u=r.stroke!==pi,h=!!(r.simplification&&r.simplification<1),d=(function(p,m,v){const S=vw(mw(Cg(p))),y=[];let b=[],x=[0,0],C=[];const A=()=>{C.length>=4&&b.push(...Kd(C,m)),C=[]},E=()=>{A(),b.length&&(y.push(b),b=[])};for(const{key:H,data:O}of S)switch(H){case"M":E(),x=[O[0],O[1]],b.push(x);break;case"L":A(),b.push([O[0],O[1]]);break;case"C":if(!C.length){const P=b.length?b[b.length-1]:x;C.push([P[0],P[1]])}C.push([O[0],O[1]]),C.push([O[2],O[3]]),C.push([O[4],O[5]]);break;case"Z":A(),b.push([x[0],x[1]])}if(E(),!v)return y;const D=[];for(const H of y){const O=R4(H,v);O.length&&D.push(O)}return D})(t,1,h?4-4*(r.simplification||1):(1+r.roughness)/2),f=xS(t,r);if(l)if(r.fillStyle==="solid")if(d.length===1){const p=xS(t,Object.assign(Object.assign({},r),{disableMultiStroke:!0,roughness:r.roughness?r.roughness+r.fillShapeRoughnessGain:0}));o.push({type:"fillPath",ops:this._mergedShape(p.ops)})}else o.push(Xd(d,r));else o.push(so(d,r));return u&&(h?d.forEach((p=>{o.push(ou(p,!1,r))})):o.push(f)),this._d("path",o,r)}opsToPath(t,s){let r="";for(const o of t.ops){const l=typeof s=="number"&&s>=0?o.data.map((u=>+u.toFixed(s))):o.data;switch(o.op){case"move":r+=`M${l[0]} ${l[1]} `;break;case"bcurveTo":r+=`C${l[0]} ${l[1]}, ${l[2]} ${l[3]}, ${l[4]} ${l[5]} `;break;case"lineTo":r+=`L${l[0]} ${l[1]} `}}return r.trim()}toPaths(t){const s=t.sets||[],r=t.options||this.defaultOptions,o=[];for(const l of s){let u=null;switch(l.type){case"path":u={d:this.opsToPath(l),stroke:r.stroke,strokeWidth:r.strokeWidth,fill:pi};break;case"fillPath":u={d:this.opsToPath(l),stroke:pi,strokeWidth:0,fill:r.fill||pi};break;case"fillSketch":u=this.fillSketch(l,r)}u&&o.push(u)}return o}fillSketch(t,s){let r=s.fillWeight;return r<0&&(r=s.strokeWidth/2),{d:this.opsToPath(t),stroke:s.fill||pi,strokeWidth:r,fill:pi}}_mergedShape(t){return t.filter(((s,r)=>r===0||s.op!=="move"))}}class B4{constructor(t,s){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new Du(s)}draw(t){const s=t.sets||[],r=t.options||this.getDefaultOptions(),o=this.ctx,l=t.options.fixedDecimalPlaceDigits;for(const u of s)switch(u.type){case"path":o.save(),o.strokeStyle=r.stroke==="none"?"transparent":r.stroke,o.lineWidth=r.strokeWidth,r.strokeLineDash&&o.setLineDash(r.strokeLineDash),r.strokeLineDashOffset&&(o.lineDashOffset=r.strokeLineDashOffset),this._drawToContext(o,u,l),o.restore();break;case"fillPath":{o.save(),o.fillStyle=r.fill||"";const h=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(o,u,l,h),o.restore();break}case"fillSketch":this.fillSketch(o,u,r)}}fillSketch(t,s,r){let o=r.fillWeight;o<0&&(o=r.strokeWidth/2),t.save(),r.fillLineDash&&t.setLineDash(r.fillLineDash),r.fillLineDashOffset&&(t.lineDashOffset=r.fillLineDashOffset),t.strokeStyle=r.fill||"",t.lineWidth=o,this._drawToContext(t,s,r.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,s,r,o="nonzero"){t.beginPath();for(const l of s.ops){const u=typeof r=="number"&&r>=0?l.data.map((h=>+h.toFixed(r))):l.data;switch(l.op){case"move":t.moveTo(u[0],u[1]);break;case"bcurveTo":t.bezierCurveTo(u[0],u[1],u[2],u[3],u[4],u[5]);break;case"lineTo":t.lineTo(u[0],u[1])}}s.type==="fillPath"?t.fill(o):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,s,r,o,l){const u=this.gen.line(t,s,r,o,l);return this.draw(u),u}rectangle(t,s,r,o,l){const u=this.gen.rectangle(t,s,r,o,l);return this.draw(u),u}ellipse(t,s,r,o,l){const u=this.gen.ellipse(t,s,r,o,l);return this.draw(u),u}circle(t,s,r,o){const l=this.gen.circle(t,s,r,o);return this.draw(l),l}linearPath(t,s){const r=this.gen.linearPath(t,s);return this.draw(r),r}polygon(t,s){const r=this.gen.polygon(t,s);return this.draw(r),r}arc(t,s,r,o,l,u,h=!1,d){const f=this.gen.arc(t,s,r,o,l,u,h,d);return this.draw(f),f}curve(t,s){const r=this.gen.curve(t,s);return this.draw(r),r}path(t,s){const r=this.gen.path(t,s);return this.draw(r),r}}const Xc="http://www.w3.org/2000/svg";class L4{constructor(t,s){this.svg=t,this.gen=new Du(s)}draw(t){const s=t.sets||[],r=t.options||this.getDefaultOptions(),o=this.svg.ownerDocument||window.document,l=o.createElementNS(Xc,"g"),u=t.options.fixedDecimalPlaceDigits;for(const h of s){let d=null;switch(h.type){case"path":d=o.createElementNS(Xc,"path"),d.setAttribute("d",this.opsToPath(h,u)),d.setAttribute("stroke",r.stroke),d.setAttribute("stroke-width",r.strokeWidth+""),d.setAttribute("fill","none"),r.strokeLineDash&&d.setAttribute("stroke-dasharray",r.strokeLineDash.join(" ").trim()),r.strokeLineDashOffset&&d.setAttribute("stroke-dashoffset",`${r.strokeLineDashOffset}`);break;case"fillPath":d=o.createElementNS(Xc,"path"),d.setAttribute("d",this.opsToPath(h,u)),d.setAttribute("stroke","none"),d.setAttribute("stroke-width","0"),d.setAttribute("fill",r.fill||""),t.shape!=="curve"&&t.shape!=="polygon"||d.setAttribute("fill-rule","evenodd");break;case"fillSketch":d=this.fillSketch(o,h,r)}d&&l.appendChild(d)}return l}fillSketch(t,s,r){let o=r.fillWeight;o<0&&(o=r.strokeWidth/2);const l=t.createElementNS(Xc,"path");return l.setAttribute("d",this.opsToPath(s,r.fixedDecimalPlaceDigits)),l.setAttribute("stroke",r.fill||""),l.setAttribute("stroke-width",o+""),l.setAttribute("fill","none"),r.fillLineDash&&l.setAttribute("stroke-dasharray",r.fillLineDash.join(" ").trim()),r.fillLineDashOffset&&l.setAttribute("stroke-dashoffset",`${r.fillLineDashOffset}`),l}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,s){return this.gen.opsToPath(t,s)}line(t,s,r,o,l){const u=this.gen.line(t,s,r,o,l);return this.draw(u)}rectangle(t,s,r,o,l){const u=this.gen.rectangle(t,s,r,o,l);return this.draw(u)}ellipse(t,s,r,o,l){const u=this.gen.ellipse(t,s,r,o,l);return this.draw(u)}circle(t,s,r,o){const l=this.gen.circle(t,s,r,o);return this.draw(l)}linearPath(t,s){const r=this.gen.linearPath(t,s);return this.draw(r)}polygon(t,s){const r=this.gen.polygon(t,s);return this.draw(r)}arc(t,s,r,o,l,u,h=!1,d){const f=this.gen.arc(t,s,r,o,l,u,h,d);return this.draw(f)}curve(t,s){const r=this.gen.curve(t,s);return this.draw(r)}path(t,s){const r=this.gen.path(t,s);return this.draw(r)}}var O4={canvas:(e,t)=>new B4(e,t),svg:(e,t)=>new L4(e,t),generator:e=>new Du(e),newSeed:()=>Du.newSeed()};const ni=O4.generator();function Eg(e){let t=0;for(let s=0;s<e.length;s++)t=t*31+e.charCodeAt(s)|0;return Math.abs(t)}const ao={nodeBorder:{roughness:.4,bowing:.3,strokeWidth:1,stroke:"#9e9689",fill:"#fffef9",fillStyle:"solid"},accentLine:{roughness:.5,bowing:.2,strokeWidth:2.5},edge:{roughness:.8,bowing:.5,strokeWidth:1.2,stroke:"#9e9689"},loopGroup:{roughness:.6,bowing:.4,strokeWidth:1.2,stroke:"#a89f94",fill:"rgba(247, 243, 238, 0.4)",fillStyle:"solid"},badge:{roughness:.3,bowing:.15,strokeWidth:.7},conditionBorder:{roughness:.4,bowing:.3,strokeWidth:1,stroke:"#d4a843",fill:"#fffef9",fillStyle:"solid"}},z4={node:"#4ade80",agent:"#a78bfa",workflow:"#4ade80",input:"#a89f94",output:"#a89f94",condition:"#fbbf24"},H4={node:"rgba(236, 253, 245, 0.8)",agent:"rgba(245, 243, 255, 0.8)",workflow:"rgba(236, 253, 245, 0.8)",input:"rgba(240, 235, 227, 0.8)",output:"rgba(240, 235, 227, 0.8)",condition:"rgba(255, 251, 235, 0.8)"},DS={node:"#22c55e",agent:"#8b5cf6",workflow:"#22c55e",input:"#a8a099",output:"#a8a099",condition:"#f59e0b"},P4={node:"fn",agent:"AI",workflow:"wf",input:"IN",output:"OUT",condition:"?"};function U4({id:e,data:t}){var S;const s=t.type??"node",r=t.label??"",o=t.fields??void 0,l=P4[s]??"fn",u=s==="input"||s==="output",h=s==="condition",d=I.useRef(null),[f,p]=I.useState({w:u?130:180,h:46});I.useLayoutEffect(()=>{if(!d.current)return;const{offsetWidth:y,offsetHeight:b}=d.current;(y!==f.w||b!==f.h)&&p({w:y,h:b})});const m=Eg(e),v=I.useMemo(()=>{const{w:y,h:b}=f,x=h?ao.conditionBorder:ao.nodeBorder,C=ni.rectangle(.5,.5,y-1,b-1,{...x,seed:m}),A=z4[s]??"#a89f94",E=ni.line(4,10,4,b-10,{...ao.accentLine,stroke:A,seed:m+1}),D=H4[s]??"rgba(240, 235, 227, 0.8)",H=DS[s]??"#a8a099",O=ni.rectangle(20,8,28,28,{...ao.badge,stroke:H,fill:D,fillStyle:"solid",seed:m+2});let P=null;if(u&&o&&o.length>0){const V=ni.line(14,42,y-10,42,{roughness:.6,bowing:.3,strokeWidth:.7,stroke:"#d5cdc0",seed:m+3});P=ni.toPaths(V)}return{border:ni.toPaths(C),accent:ni.toPaths(E),badge:ni.toPaths(O),separator:P}},[f,s,h,m,u,o]);return T.jsxs("div",{ref:d,className:"relative",style:{minWidth:u?120:160,maxWidth:260},children:[T.jsxs("svg",{className:"absolute inset-0 w-full h-full pointer-events-none",style:{overflow:"visible"},children:[v.border.map((y,b)=>T.jsx("path",{d:y.d,fill:y.fill,stroke:y.stroke,strokeWidth:y.strokeWidth,strokeLinecap:"round"},`b${b}`)),v.accent.map((y,b)=>T.jsx("path",{d:y.d,fill:"none",stroke:y.stroke,strokeWidth:y.strokeWidth,strokeLinecap:"round"},`a${b}`)),v.badge.map((y,b)=>T.jsx("path",{d:y.d,fill:y.fill,stroke:y.stroke,strokeWidth:y.strokeWidth},`g${b}`)),(S=v.separator)==null?void 0:S.map((y,b)=>T.jsx("path",{d:y.d,fill:"none",stroke:y.stroke,strokeWidth:y.strokeWidth},`s${b}`))]}),T.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 pl-5 relative z-10",children:[T.jsx("div",{className:"w-7 h-7 flex items-center justify-center shrink-0",children:T.jsx("span",{className:"text-[11px] font-bold font-sketch",style:{color:DS[s]},children:l})}),T.jsx("span",{className:`font-sketch font-semibold ${u?"text-[13px] text-muted-foreground":"text-[15px] text-card-foreground"}`,children:r})]}),u&&o&&o.length>0&&T.jsx("div",{className:"px-3 py-1.5 pl-5 flex flex-wrap gap-x-2 gap-y-0.5 relative z-10",children:o.map(y=>T.jsx("span",{className:"text-[11px] text-[#a8a099] font-sketch",children:y},y))}),s!=="input"&&T.jsx(xn,{type:"target",position:ye.Left,className:"!w-[5px] !h-[5px] !bg-[#c9c0b4] !border-0 !opacity-40"}),s!=="output"&&T.jsx(xn,{type:"source",position:ye.Right,className:"!w-[5px] !h-[5px] !bg-[#c9c0b4] !border-0 !opacity-40"})]})}function j4({id:e,data:t}){const s=t.label??"",r=t.width,o=t.height,l=Eg(e),u=I.useMemo(()=>{const h=ni.rectangle(1,1,r-2,o-2,{...ao.loopGroup,seed:l}),d=ni.line(8,28,r-8,28,{roughness:.8,bowing:.3,strokeWidth:.8,stroke:"#b8ad9e",seed:l+1});return{border:ni.toPaths(h),headerLine:ni.toPaths(d)}},[r,o,l]);return T.jsxs("div",{className:"relative",style:{width:r,height:o},children:[T.jsxs("svg",{className:"absolute inset-0 w-full h-full pointer-events-none",style:{overflow:"visible"},children:[u.border.map((h,d)=>T.jsx("path",{d:h.d,fill:h.fill,stroke:h.stroke,strokeWidth:h.strokeWidth,strokeLinecap:"round",strokeDasharray:"8 5"},`b${d}`)),u.headerLine.map((h,d)=>T.jsx("path",{d:h.d,fill:"none",stroke:h.stroke,strokeWidth:h.strokeWidth,strokeDasharray:"6 4"},`h${d}`))]}),T.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1 relative z-10",children:[T.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",className:"shrink-0 text-[#a8a099]",children:[T.jsx("path",{d:"M3 4C2 4 1 5 1 6.5C1 8 2 9 3 9H11C12 9 13 8 13 6.5C13 5 12 4 11 4",stroke:"currentColor",strokeWidth:"1.5",fill:"none"}),T.jsx("path",{d:"M9.5 3L11 4L9.5 5",fill:"currentColor"})]}),T.jsx("span",{className:"text-[12px] font-semibold text-muted-foreground truncate font-sketch",children:s})]}),T.jsx(xn,{type:"target",position:ye.Left,className:"!bg-transparent !w-0 !h-0 !border-0"}),T.jsx(xn,{type:"source",position:ye.Right,className:"!bg-transparent !w-0 !h-0 !border-0"})]})}function I4(e){const{id:t,sourceX:s,sourceY:r,sourcePosition:o,targetX:l,targetY:u,targetPosition:h,markerEnd:d,label:f}=e,[p,m,v]=og({sourceX:s,sourceY:r,sourcePosition:o,targetX:l,targetY:u,targetPosition:h}),S=I.useMemo(()=>{const y=ni.path(p,{...ao.edge,seed:Eg(t)});return ni.toPaths(y)},[p,t]);return T.jsxs("g",{children:[T.jsx("path",{d:p,fill:"none",strokeWidth:20,stroke:"transparent",className:"react-flow__edge-interaction"}),S.map((y,b)=>T.jsx("path",{d:y.d,fill:"none",stroke:y.stroke,strokeWidth:y.strokeWidth,strokeLinecap:"round",strokeLinejoin:"round",markerEnd:b===S.length-1?d:void 0},b)),f&&T.jsx("text",{x:m,y:v,textAnchor:"middle",dominantBaseline:"central",className:"react-flow__edge-text",children:f})]})}const $4="modulepreload",q4=function(e){return"/"+e},TS={},W4=function(t,s,r){let o=Promise.resolve();if(s&&s.length>0){let u=function(f){return Promise.all(f.map(p=>Promise.resolve(p).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),d=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));o=u(s.map(f=>{if(f=q4(f),f in TS)return;TS[f]=!0;const p=f.endsWith(".css"),m=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${m}`))return;const v=document.createElement("link");if(v.rel=p?"stylesheet":$4,p||(v.as="script"),v.crossOrigin="",v.href=f,d&&v.setAttribute("nonce",d),document.head.appendChild(v),p)return new Promise((S,y)=>{v.addEventListener("load",S),v.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${f}`)))})}))}function l(u){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=u,window.dispatchEvent(h),!h.defaultPrevented)throw u}return o.then(u=>{for(const h of u||[])h.status==="rejected"&&l(h.reason);return t().catch(l)})};function xw({integrationId:e,workflowName:t,nodeName:s,connectionsApi:r}){const{nangoConnections:o,loading:l,refetch:u}=FD(e,r.mutationVersion),[h,d]=I.useState(!1),f=r.getForNode(t,s,e),p=I.useCallback(async v=>{await r.upsert({workflow_name:t,node_name:s,integration_id:e,connection_id:v})},[r,t,s,e]),m=I.useCallback(async()=>{d(!0);try{const v=await fetch("/api/nango/connect-session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({integration_id:e})});if(!v.ok)return;const{token:S}=await v.json(),b=(await W4(()=>import("./index-DAKTQEvj.js"),[])).default;new b().openConnectUI({sessionToken:S,onEvent:async C=>{if(C.type==="connect"){u();const A=C.payload.connectionId;A&&(await p(A),t!=="*"&&await r.upsert({workflow_name:"*",node_name:"*",integration_id:e,connection_id:A}))}else C.type==="close"&&u()}})}catch{}finally{d(!1)}},[e,u,p,t,r]);return T.jsxs("div",{className:"flex flex-col gap-1.5",children:[T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsx("span",{className:"text-[12px] font-medium text-popover-foreground capitalize",children:e}),T.jsx("button",{onClick:m,disabled:h,className:"text-[10px] px-2.5 py-0.5 rounded-full bg-[#e0d9cf] text-[#6b6358] hover:bg-[#d5cdc0] transition-colors cursor-pointer disabled:opacity-50",children:h?"...":"Connect"})]}),l?T.jsx("p",{className:"text-[11px] text-[#a8a099] italic",children:"Loading connections..."}):o.length===0?T.jsx("p",{className:"text-[11px] text-[#a8a099] italic",children:"No connections. Click Connect to add one."}):T.jsxs("select",{value:(f==null?void 0:f.connection_id)??"",onChange:v=>p(v.target.value),className:"text-[12px] px-2 py-1 rounded-md border border-border bg-background text-foreground",children:[T.jsx("option",{value:"",children:"Select a connection..."}),o.map(v=>T.jsx("option",{value:v.connection_id,children:v.display_name},v.connection_id))]})]})}const Y4={node:"fn",agent:"AI",workflow:"wf",input:"IN",output:"OUT",condition:"?"},AS={node:{iconBg:"bg-emerald-50 text-emerald-600"},agent:{iconBg:"bg-purple-50 text-purple-600"},workflow:{iconBg:"bg-emerald-50 text-emerald-600"},input:{iconBg:"bg-[#f5f3f0] text-[#a8a099]"},output:{iconBg:"bg-[#f5f3f0] text-[#a8a099]"},condition:{iconBg:"bg-amber-50 text-amber-600"}},V4={node:"Node",agent:"Agent",workflow:"Workflow",input:"Input",output:"Output",condition:"Condition"};function X4({node:e,position:t,onClose:s,workflowName:r,connectionsApi:o}){const l=I.useRef(null),u=Y4[e.type]??"fn",h=AS[e.type]??AS.node,d=V4[e.type]??e.type;I.useEffect(()=>{const b=x=>{x.key==="Escape"&&s()};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s]),I.useEffect(()=>{const b=C=>{l.current&&!l.current.contains(C.target)&&s()},x=setTimeout(()=>{document.addEventListener("mousedown",b)},0);return()=>{clearTimeout(x),document.removeEventListener("mousedown",b)}},[s]);const f=300,p=400,m=12,[v,S]=I.useState({left:t.x+12,top:t.y-20});I.useLayoutEffect(()=>{const b=l.current;if(!b)return;const x=b.offsetParent,C=(x==null?void 0:x.clientWidth)??window.innerWidth,A=(x==null?void 0:x.clientHeight)??window.innerHeight;S({left:Math.max(m,Math.min(t.x+12,C-f-m)),top:Math.max(m,Math.min(t.y-20,A-p-m))})},[t.x,t.y]);const y=e.integrations&&e.integrations.length>0&&e.nodeName&&r&&o;return T.jsxs("div",{ref:l,style:{left:v.left,top:v.top},className:"absolute z-50 w-[300px] bg-popover rounded-xl border border-border shadow-lg",children:[T.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-accent",children:[T.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[T.jsx("div",{className:`w-7 h-7 rounded-md flex items-center justify-center shrink-0 ${h.iconBg}`,children:T.jsx("span",{className:"text-[10px] font-bold",children:u})}),T.jsxs("div",{className:"min-w-0",children:[T.jsx("p",{className:"text-[13px] font-medium text-popover-foreground truncate",children:e.label}),T.jsx("p",{className:"text-[10px] text-[#a8a099] uppercase tracking-wide",children:d})]})]}),T.jsx("button",{onClick:s,"aria-label":"Close node details",className:"p-1 rounded-md text-[#a8a099] hover:text-popover-foreground hover:bg-accent transition-colors cursor-pointer",children:T.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:T.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),T.jsxs("div",{className:"px-4 py-3",children:[T.jsx("p",{className:"text-[11px] uppercase tracking-wider text-[#a8a099] mb-1.5",children:"Description"}),e.description?T.jsx("p",{className:"text-[13px] text-muted-foreground whitespace-pre-line leading-relaxed",children:e.description}):T.jsx("p",{className:"text-[13px] text-[#a8a099] italic",children:"No description available"})]}),y&&T.jsxs("div",{className:"px-4 py-3 border-t border-accent",children:[T.jsx("p",{className:"text-[11px] uppercase tracking-wider text-[#a8a099] mb-2",children:"Integrations"}),T.jsx("div",{className:"flex flex-col gap-3",children:e.integrations.map(b=>T.jsx(xw,{integrationId:b,workflowName:r,nodeName:e.nodeName,connectionsApi:o},b))})]})]})}const Tu=220,Ka=50,K4=80,NS=40,RS=20,BS=16,LS=28;function G4(e,t){if(e.length===0)return new Map;const s=new Map,r=new Map,o=new Set(e);for(const f of e)s.set(f,[]),r.set(f,[]);for(const f of t)o.has(f.source)&&o.has(f.target)&&(s.get(f.source).push(f.target),r.get(f.target).push(f.source));const l=F4(e,s,r),u=new Map;for(const[f,p]of l)u.has(p)||u.set(p,[]),u.get(p).push(f);Z4(u,l,s);const h=Math.max(...u.keys()),d=new Map;for(let f=0;f<=h;f++){const p=u.get(f)||[],v=-(p.length*Ka+(p.length-1)*NS)/2;for(let S=0;S<p.length;S++)d.set(p[S],{x:Math.round(f*(Tu+K4)),y:Math.round(v+S*(Ka+NS))})}return d}function F4(e,t,s){const r=new Map,o=e.filter(h=>s.get(h).length===0),l=o.length>0?o:[e[0]],u=[...l];for(const h of l)r.set(h,0);for(const h of e)r.has(h)||(r.set(h,0),u.push(h));for(;u.length>0;){const h=u.shift(),d=r.get(h);for(const f of t.get(h)||[]){const p=r.get(f),m=d+1;(p===void 0||m>p)&&(r.set(f,m),u.push(f))}}return r}function Z4(e,t,s){const r=Math.max(...e.keys()),o=new Map;for(const[l,u]of s)for(const h of u)o.has(h)||o.set(h,[]),o.get(h).push(l);for(let l=1;l<=r;l++){const u=e.get(l);if(!u||u.length<=1)continue;const h=e.get(l-1)||[],d=new Map;h.forEach((f,p)=>d.set(f,p)),u.sort((f,p)=>{const m=(o.get(f)||[]).filter(b=>t.get(b)===l-1),v=(o.get(p)||[]).filter(b=>t.get(b)===l-1),S=m.length>0?m.reduce((b,x)=>b+(d.get(x)||0),0)/m.length:0,y=v.length>0?v.reduce((b,x)=>b+(d.get(x)||0),0)/v.length:0;return S-y}),e.set(l,u)}}function Q4(e,t){const s=[];for(const r of t){const o=new Map;let l=1/0,u=1/0,h=-1/0,d=-1/0;for(const S of r.nodeIds){const y=e.get(S);y&&(l=Math.min(l,y.x),u=Math.min(u,y.y),h=Math.max(h,y.x+Tu),d=Math.max(d,y.y+Ka))}if(l===1/0)continue;const f=l-RS,p=u-LS-BS,m=h-l+2*RS,v=d-u+LS+2*BS;for(const S of r.nodeIds){const y=e.get(S);y&&o.set(S,{x:y.x-f,y:y.y-p})}s.push({id:r.id,position:{x:f,y:p},width:m,height:v,childPositions:o})}return s}const J4={workflowNode:U4,loopGroup:j4},eR={scribby:I4};function tR({dag:e,connectionsApi:t}){const{fitView:s}=ju(),[r,o]=I.useState(null),[l,u]=I.useState(null),{flowNodes:h,flowEdges:d}=I.useMemo(()=>{const A=G4(e.nodes.map(V=>V.id),e.edges.map(V=>({source:V.source,target:V.target}))),E=e.loopGroups??[],D=Q4(A,E),H=new Map;for(const V of D){const G=E.find(ne=>ne.id===V.id);if(G)for(const ne of G.nodeIds)H.set(ne,V)}const O=[];for(const V of D){const G=E.find(ne=>ne.id===V.id);O.push({id:V.id,type:"loopGroup",position:V.position,data:{label:(G==null?void 0:G.label)??"",width:V.width,height:V.height},draggable:!0,style:{width:V.width,height:V.height}})}for(const V of e.nodes){const G=H.get(V.id);if(G){const ne=G.childPositions.get(V.id)??{x:0,y:0};O.push({id:V.id,type:"workflowNode",position:ne,parentId:G.id,extent:"parent",data:{...V},draggable:!0,width:Tu,height:Ka})}else{const ne=A.get(V.id)??{x:0,y:0};O.push({id:V.id,type:"workflowNode",position:ne,data:{...V},draggable:!0,width:Tu,height:Ka})}}const P=e.edges.map(V=>({id:V.id,source:V.source,target:V.target,label:V.label,type:"scribby",animated:!1,style:{stroke:"#9e9689",strokeWidth:1.2,strokeLinecap:"round"},labelStyle:{fontSize:13,fill:"#6b6358",fontFamily:"'Caveat', cursive"}}));return{flowNodes:O,flowEdges:P}},[e]),[f,p,m]=gD(h),[v,S,y]=pD(d);I.useEffect(()=>{p(h),S(d),setTimeout(()=>s({padding:.2,duration:300}),50)},[h,d,p,S,s]);const b=I.useCallback((A,E)=>{const D=E.data;if(D.type==="input"||D.type==="output"||D.type==="condition")return;const O=A.currentTarget.closest(".react-flow"),P=(O==null?void 0:O.getBoundingClientRect())??{left:0,top:0};o(D),u({x:A.clientX-P.left,y:A.clientY-P.top})},[]),x=I.useCallback(()=>{o(null),u(null)},[]),C=I.useCallback(()=>{setTimeout(()=>s({padding:.2,duration:200}),50)},[s]);return T.jsxs("div",{className:"relative w-full h-full",children:[T.jsxs(_D,{nodes:f,edges:v,onNodesChange:m,onEdgesChange:y,nodeTypes:J4,edgeTypes:eR,onInit:C,onNodeClick:b,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,proOptions:{hideAttribution:!0},children:[T.jsx(bD,{variant:Rs.Cross,color:"#d5cdc0",gap:24,size:1.5}),T.jsx(DD,{showInteractive:!1}),T.jsx(ID,{nodeStrokeWidth:3,pannable:!0,zoomable:!0,style:{width:120,height:80},maskColor:"rgba(240, 235, 227, 0.7)"})]}),r&&l&&T.jsx(X4,{node:r,position:l,onClose:x,workflowName:e.workflowName,connectionsApi:t})]})}function iR({workflows:e,parseErrors:t,selected:s,onSelect:r}){return T.jsxs("div",{className:"flex flex-col gap-1",children:[T.jsx("h2",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1",children:"Workflows"}),e.length===0&&t.length===0&&T.jsx("p",{className:"text-xs text-[#a8a099] italic",children:"No workflows found"}),e.map(o=>T.jsxs("button",{onClick:()=>r(o.workflowName),className:`
|
|
122
|
+
text-left px-2.5 py-1.5 rounded-md text-sm transition-colors
|
|
123
|
+
${s===o.workflowName?"bg-[#e8e0d4] text-foreground font-medium shadow-[inset_0_0_0_1px_rgba(0,0,0,0.04)]":"text-muted-foreground hover:bg-accent/60"}
|
|
124
|
+
`,children:[T.jsx("div",{className:"font-medium truncate",children:o.workflowName}),T.jsx("div",{className:"text-[10px] text-[#a8a099] truncate",children:o.filePath})]},`${o.filePath}:${o.workflowName}`)),t.length>0&&T.jsxs(T.Fragment,{children:[T.jsx("h2",{className:"text-xs font-semibold text-amber-600 uppercase tracking-wider mt-3 mb-1",children:"Parse Errors"}),t.map(o=>T.jsxs("div",{className:"px-2.5 py-1.5 rounded-md text-xs bg-amber-50 text-amber-700 border border-amber-200",children:[T.jsx("div",{className:"font-medium truncate",children:o.filePath}),T.jsx("div",{className:"truncate mt-0.5 text-amber-600",children:o.error})]},o.filePath))]})]})}function sR({workflows:e,connectionsApi:t}){const{integrations:s,loading:r}=GD(),o=I.useMemo(()=>{const u=new Set;for(const h of e)for(const d of h.nodes)if(d.integrations)for(const f of d.integrations)u.add(f);return u},[e]),l=I.useMemo(()=>{const u=new Set(o);for(const h of s)u.add(h.id);return Array.from(u).sort((h,d)=>{const f=o.has(h)?0:1,p=o.has(d)?0:1;return f-p||h.localeCompare(d)})},[s,o]);return r||l.length===0?null:T.jsxs("div",{className:"border-t border-border pt-3",children:[T.jsx("p",{className:"text-[11px] uppercase tracking-wider text-[#a8a099] mb-2 px-1",children:"Global Connections"}),T.jsx("div",{className:"flex flex-col gap-3",children:l.map(u=>T.jsx(xw,{integrationId:u,workflowName:"*",nodeName:"*",connectionsApi:t},u))})]})}function nR(){const[e,t]=I.useState({status:"idle"}),[s,r]=I.useState(null),[o,l]=I.useState("unknown");I.useEffect(()=>{const d=()=>{fetch("/api/deploy").then(p=>p.json()).then(p=>{p.deployed&&p.url&&(r(p.url),l(p.freshness??"unknown"))}).catch(()=>{})};d();const f=setInterval(d,3e4);return()=>clearInterval(f)},[]);const u=I.useCallback(async()=>{var d;t({status:"deploying",message:"Starting deploy..."});try{const f=await fetch("/api/deploy",{method:"POST"});if(!f.ok){t({status:"error",error:`Deploy request failed (HTTP ${f.status})`});return}const p=(d=f.body)==null?void 0:d.getReader();if(!p){t({status:"error",error:"No response body"});return}const m=new TextDecoder;let v="";for(;;){const{done:S,value:y}=await p.read();if(S)break;v+=m.decode(y,{stream:!0});const b=v.split(`
|
|
125
|
+
`);v=b.pop()??"";for(const x of b)if(x.startsWith("data: "))try{const C=JSON.parse(x.slice(6));C.type==="progress"?t({status:"deploying",step:C.step,message:C.message}):C.type==="done"?(C.url&&r(C.url),l("current"),t({status:"success",url:C.url})):C.type==="error"&&t({status:"error",error:C.message})}catch{}}}catch(f){t({status:"error",error:f instanceof Error?f.message:String(f)})}},[]),h=I.useCallback(()=>{t({status:"idle"})},[]);return{...e,deployedUrl:s,freshness:o,startDeploy:u,reset:h}}function OS(e){return e.replace(/^https?:\/\//,"")}function rR(){const e=nR();return T.jsxs("div",{className:"border-t border-border pt-3",children:[T.jsx("p",{className:"text-[11px] uppercase tracking-wider text-[#a8a099] mb-2 px-1",children:"Deploy"}),e.deployedUrl&&e.status!=="deploying"&&e.status!=="success"&&T.jsxs("a",{href:e.deployedUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground px-1 mb-2 group transition-colors",title:e.freshness==="outdated"?"Local changes not yet deployed":e.freshness==="current"?"Up to date":void 0,children:[T.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${e.freshness==="outdated"?"bg-yellow-400":e.freshness==="current"?"bg-green-400":"bg-zinc-400"}`}),T.jsx("span",{className:"truncate group-hover:underline",children:OS(e.deployedUrl)}),T.jsx("svg",{className:"w-2.5 h-2.5 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:T.jsx("path",{d:"M3.5 1.5h7v7M10.5 1.5L1.5 10.5"})})]}),e.status==="idle"&&T.jsx("button",{onClick:e.startDeploy,className:"w-full px-3 py-1.5 text-xs bg-foreground text-background rounded hover:opacity-90 transition-opacity cursor-pointer",children:e.deployedUrl?"Re-deploy":"Deploy to Cloud"}),e.status==="deploying"&&T.jsxs("div",{className:"text-xs text-muted-foreground px-1 flex items-center gap-2",children:[T.jsxs("svg",{className:"animate-spin h-3 w-3",viewBox:"0 0 24 24",fill:"none",children:[T.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),T.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),T.jsx("span",{children:e.message??"Deploying..."})]}),e.status==="success"&&T.jsxs("div",{className:"text-xs px-1",children:[T.jsx("p",{className:"text-green-400 mb-1",children:"Deployed successfully!"}),e.url&&T.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 underline break-all",children:OS(e.url)}),T.jsx("button",{onClick:e.reset,className:"mt-1 block text-muted-foreground hover:text-foreground underline cursor-pointer",children:"Done"})]}),e.status==="error"&&T.jsxs("div",{className:"text-xs px-1",children:[T.jsx("p",{className:"text-red-400 mb-1",children:e.error}),T.jsx("button",{onClick:e.reset,className:"text-muted-foreground hover:text-foreground underline cursor-pointer",children:"Try again"})]})]})}const oR=150,aR=400;function lR({tabs:e,defaultTab:t,onClose:s}){var v,S;const[r,o]=I.useState(t??((v=e[0])==null?void 0:v.id)??""),[l,u]=I.useState(aR),h=I.useRef(!1),d=I.useRef(0),f=I.useRef(0),p=I.useCallback(y=>{y.preventDefault(),h.current=!0,d.current=y.clientY,f.current=l},[l]);I.useEffect(()=>{const y=x=>{if(!h.current)return;const C=window.innerHeight*.6,A=d.current-x.clientY;u(Math.max(oR,Math.min(C,f.current+A)))},b=()=>{h.current=!1};return window.addEventListener("mousemove",y),window.addEventListener("mouseup",b),()=>{window.removeEventListener("mousemove",y),window.removeEventListener("mouseup",b)}},[]);const m=(S=e.find(y=>y.id===r))==null?void 0:S.content;return T.jsxs("div",{className:"border-t border-border flex flex-col bg-background",style:{height:l},children:[T.jsx("div",{onMouseDown:p,className:"h-1 cursor-ns-resize hover:bg-accent shrink-0"}),T.jsxs("div",{className:"shrink-0 px-3 flex items-center gap-0 border-b border-border",children:[e.map(y=>T.jsxs("button",{onClick:()=>o(y.id),className:`relative text-[12px] tracking-wide px-3 py-2 cursor-pointer transition-colors ${r===y.id?"text-foreground":"text-muted-foreground hover:text-foreground/70"}`,children:[y.label,r===y.id&&T.jsx("span",{className:"absolute bottom-0 left-3 right-3 h-[1.5px] bg-[#b8ad9e] rounded-full"})]},y.id)),T.jsx("div",{className:"flex-1"}),T.jsx("button",{onClick:s,className:"text-muted-foreground hover:text-foreground text-sm px-1.5 py-0.5 cursor-pointer",title:"Close panel",children:"×"})]}),T.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:m})]})}const cR={SUCCESS:{bg:"bg-emerald-50",text:"text-emerald-700",label:"Success"},ERROR:{bg:"bg-red-50",text:"text-red-700",label:"Failed"},PENDING:{bg:"bg-amber-50",text:"text-amber-700",label:"Pending"},RETRIES_EXCEEDED:{bg:"bg-red-50",text:"text-red-700",label:"Retries Exceeded"}};function uR({runs:e,loading:t,selectedRunId:s,trace:r,traceLoading:o,selectRun:l,refresh:u}){return t&&e.length===0?T.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading runs..."}):e.length===0?T.jsx("div",{className:"flex items-center justify-center h-full",children:T.jsxs("div",{className:"rounded-lg border border-dashed border-border p-8 text-center",children:[T.jsx("p",{className:"text-[13px] text-foreground/60",children:"No runs yet"}),T.jsx("p",{className:"text-[11px] text-muted-foreground mt-1 leading-relaxed max-w-[240px]",children:"Workflow runs will appear here with their status, duration, and step-by-step trace."})]})}):T.jsxs("div",{className:"h-full flex flex-col",children:[T.jsxs("div",{className:"shrink-0 px-3 py-1.5 flex items-center justify-between border-b border-border",children:[T.jsxs("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-medium",children:[e.length," run",e.length!==1?"s":""]}),T.jsx("button",{onClick:u,className:"text-[11px] text-muted-foreground hover:text-foreground cursor-pointer transition-colors",children:"Refresh"})]}),T.jsx("div",{className:"flex-1 min-h-0 overflow-auto px-3 py-2 space-y-1",children:e.map(h=>T.jsx(hR,{run:h,isExpanded:s===h.workflow_uuid,trace:s===h.workflow_uuid?r:null,traceLoading:s===h.workflow_uuid&&o,onToggle:()=>l(s===h.workflow_uuid?null:h.workflow_uuid)},h.workflow_uuid))})]})}function hR({run:e,isExpanded:t,trace:s,traceLoading:r,onToggle:o}){var d;const l=cR[e.status]??{bg:"bg-gray-50",text:"text-gray-700",label:e.status},u=(d=s==null?void 0:s.workflow)==null?void 0:d.duration_ms,h=_R(e.created_at);return T.jsxs("div",{className:`rounded-lg border transition-colors ${e.status==="PENDING"?"border-amber-200":"border-border"} bg-muted`,children:[T.jsxs("button",{onClick:o,className:"w-full flex items-center gap-2 px-3 py-2 text-left cursor-pointer",children:[T.jsx("span",{className:"text-muted-foreground text-[10px] shrink-0",children:t?"▾":"▸"}),T.jsx("span",{className:`shrink-0 px-1.5 py-0.5 rounded text-[10px] font-medium ${l.bg} ${l.text}`,children:l.label}),T.jsx("span",{className:"text-[12px] font-medium text-foreground truncate",children:e.name}),T.jsx("div",{className:"flex-1"}),u!=null&&T.jsx("span",{className:"text-[11px] font-mono text-muted-foreground shrink-0",children:Mg(u)}),T.jsx("span",{className:"text-[11px] text-muted-foreground shrink-0",children:gR(h)})]}),t&&T.jsxs("div",{className:"border-t border-border px-3 py-2",children:[r?T.jsx("p",{className:"text-[11px] text-muted-foreground text-center py-3",children:"Loading trace..."}):s&&s.operations.length>0?T.jsx(fR,{operations:s.operations,rootWorkflowId:e.workflow_uuid}):T.jsx("p",{className:"text-[11px] text-muted-foreground text-center py-3 italic",children:"No operations recorded."}),e.error&&T.jsx("div",{className:"mt-2",children:T.jsx("pre",{className:"text-[10px] font-mono text-red-600 bg-red-50 rounded p-1.5 whitespace-pre-wrap break-all",children:e.error})})]})]})}function fR({operations:e,rootWorkflowId:t}){const[s,r]=I.useState(new Set),o=I.useCallback(f=>{r(p=>{const m=new Set(p);return m.has(f)?m.delete(f):m.add(f),m})},[]),l=new Map;for(const f of e){const p=l.get(f.workflow_uuid)??[];p.push(f),l.set(f.workflow_uuid,p)}const u=l.get(t)??[],h=new Set;for(const f of u)f.function_name==="DBOS.getResult"&&f.child_workflow_id&&h.add(f.child_workflow_id);const d=u.filter(f=>!f.child_workflow_id||f.function_name==="DBOS.getResult"?!0:!h.has(f.child_workflow_id));return T.jsx("div",{className:"space-y-0.5",children:d.map(f=>{let p=f.function_name;if(f.function_name==="DBOS.getResult"&&f.child_workflow_id){const b=u.find(x=>x.child_workflow_id===f.child_workflow_id&&x.function_name!=="DBOS.getResult");b&&(p=b.function_name)}const m=!!(f.output_preview||f.error||f.child_workflow_id),v=`${f.workflow_uuid}-${f.function_id}`,S=s.has(v),y=f.child_workflow_id?l.get(f.child_workflow_id)??[]:[];return T.jsxs("div",{children:[T.jsxs("button",{onClick:()=>m&&o(v),className:`w-full flex items-center gap-2 px-2 py-1 rounded text-left transition-colors ${m?"cursor-pointer hover:bg-accent":"cursor-default"} ${f.error?"bg-red-50/30":""}`,children:[m?T.jsx("span",{className:"text-muted-foreground text-[9px] w-3 shrink-0",children:S?"▾":"▸"}):T.jsx("span",{className:"w-3 shrink-0"}),T.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${f.error?"bg-red-500":f.duration_ms!=null?"bg-emerald-500":"bg-amber-400"}`}),T.jsx("span",{className:`text-[12px] font-medium truncate flex-1 ${f.error?"text-red-700":"text-foreground"}`,children:p}),f.duration_ms!=null&&T.jsx("span",{className:"text-[10px] font-mono text-muted-foreground shrink-0",children:Mg(f.duration_ms)})]}),S&&T.jsxs("div",{className:"ml-7 mt-0.5 mb-1 space-y-1",children:[f.error&&T.jsx("pre",{className:"text-[10px] font-mono text-red-600 bg-red-50 rounded p-1.5 whitespace-pre-wrap break-all",children:f.error}),y.length>0&&T.jsx("div",{className:"space-y-0.5 border-l-2 border-border pl-2",children:y.map(b=>T.jsx(dR,{op:b},`${b.workflow_uuid}-${b.function_id}`))}),f.output_preview&&!f.error&&T.jsx("pre",{className:"text-[10px] font-mono text-muted-foreground bg-background rounded p-1.5 whitespace-pre-wrap break-all max-h-[100px] overflow-auto",children:pR(f.output_preview)})]})]},v)})})}function dR({op:e}){return T.jsxs("div",{className:`flex items-center gap-2 px-2 py-0.5 rounded text-[11px] ${e.error?"bg-red-50/30":""}`,children:[T.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${e.error?"bg-red-500":e.duration_ms!=null?"bg-emerald-500":"bg-amber-400"}`}),T.jsx("span",{className:`truncate flex-1 ${e.error?"text-red-700":"text-foreground/80"}`,children:e.function_name}),e.duration_ms!=null&&T.jsx("span",{className:"text-[10px] font-mono text-muted-foreground shrink-0",children:Mg(e.duration_ms)})]})}function _R(e){if(typeof e=="number")return e;if(typeof e=="string"){if(/^\d+$/.test(e))return parseInt(e,10);const t=new Date(e).getTime();if(!isNaN(t))return t}return Date.now()}function Mg(e){if(e<1e3)return`${e}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;const t=Math.floor(e/6e4),s=Math.floor(e%6e4/1e3);return`${t}m ${s}s`}function gR(e){const t=Date.now()-e;return t<0?"just now":t<6e4?`${Math.floor(t/1e3)}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:t<6048e5?`${Math.floor(t/864e5)}d ago`:new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function pR(e){if(!e)return"";try{const t=JSON.parse(e),s=JSON.stringify(t,null,2);return s.length>200?s.slice(0,197)+"...":s}catch{return e.length>200?e.slice(0,197)+"...":e}}function mR({attachTo:e,fit:t,ptyAlive:s,hasData:r,restart:o}){const l=I.useRef(null);return I.useEffect(()=>(l.current&&e(l.current),()=>e(null)),[e]),I.useEffect(()=>{if(!l.current)return;const u=new ResizeObserver(()=>{requestAnimationFrame(t)});return u.observe(l.current),()=>u.disconnect()},[t]),I.useEffect(()=>{const u=setTimeout(t,50);return()=>clearTimeout(u)},[t]),I.useEffect(()=>{if(s)return;const u=l.current;if(!u)return;const h=d=>{d.key==="Enter"&&o()};return u.addEventListener("keydown",h),()=>u.removeEventListener("keydown",h)},[s,o]),T.jsxs("div",{className:"relative h-full w-full overflow-hidden bg-[#1a1a1a] px-4 py-2",children:[T.jsx("div",{ref:l,className:"h-full w-full"}),!r&&T.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:T.jsxs("div",{className:"flex items-center gap-3 text-zinc-500",children:[T.jsxs("svg",{className:"h-5 w-5 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[T.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),T.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),T.jsx("span",{children:"Starting Claude Code..."})]})})]})}function vR(){const{state:e,connected:t,sendMessage:s,ptyEvents:r}=XD(),o=v4({sendMessage:s,ptyEvents:r}),l=KD(),[u,h]=I.useState(null),[d,f]=I.useState(!0),[p,m]=I.useState(!1),v=yS({defaultWidth:224,minWidth:160,maxWidth:400,side:"right"}),S=yS({defaultWidth:288,minWidth:200,maxWidth:500,side:"left"}),y=QD(u);I.useEffect(()=>{!u&&e.workflows.length>0&&h(e.workflows[0].workflowName)},[e.workflows,u]);const b=e.workflows.find(C=>C.workflowName===u),x=I.useMemo(()=>[{id:"terminal",label:"Terminal",content:T.jsx(mR,{attachTo:o.attachTo,fit:o.fit,ptyAlive:o.ptyAlive,hasData:o.hasData,restart:o.restart})}],[o]);return T.jsxs("div",{className:"h-screen w-screen flex bg-background",children:[T.jsxs("div",{className:"flex flex-col bg-[#f3ede5] shrink-0 relative",style:{width:v.width},children:[T.jsxs("div",{className:"px-4 py-3 border-b border-border flex items-center justify-between",children:[T.jsx("h1",{className:"text-sm font-bold text-foreground font-serif tracking-wide",children:"0pflow"}),T.jsx("span",{className:`w-2 h-2 rounded-full ${t?"bg-green-400":"bg-red-400"}`,title:t?"Connected":"Disconnected"})]}),T.jsxs("div",{className:"flex-1 overflow-y-auto p-3",children:[T.jsx(iR,{workflows:e.workflows,parseErrors:e.parseErrors,selected:u,onSelect:h}),T.jsx(sR,{workflows:e.workflows,connectionsApi:l}),T.jsx(rR,{})]}),T.jsx("div",{onMouseDown:v.onDragStart,className:"absolute top-0 right-0 w-1 h-full cursor-ew-resize hover:bg-accent z-20"})]}),T.jsxs("div",{className:"flex-1 flex flex-col min-w-0 border-x border-border",children:[T.jsxs("div",{className:"flex-1 relative min-h-0",children:[b?T.jsxs(xb,{children:[T.jsx("div",{className:"absolute inset-0 shadow-[inset_0_0_20px_rgba(0,0,0,0.03)]",children:T.jsx(tR,{dag:b,connectionsApi:l})}),T.jsxs("div",{className:"absolute top-3 left-3 bg-card/80 backdrop-blur-sm px-3 py-1.5 rounded-lg shadow-[0_1px_4px_rgba(0,0,0,0.04)] border border-border",children:[T.jsx("span",{className:"text-[15px] font-semibold text-foreground font-sketch",children:b.workflowName}),T.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:["v",b.version]})]})]},b.workflowName):T.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:e.workflows.length===0?"No workflow files found. Create a workflow to get started.":"Select a workflow from the sidebar."}),T.jsxs("div",{className:"absolute top-3 right-3 flex gap-1.5",children:[y.available&&T.jsx("button",{onClick:()=>m(!p),className:`bg-card/80 backdrop-blur-sm px-3 py-1.5 rounded-md shadow-sm border border-border text-[12px] cursor-pointer transition-colors ${p?"text-foreground":"text-muted-foreground hover:text-foreground"}`,children:"History"}),T.jsx("button",{onClick:()=>f(!d),className:`bg-card/80 backdrop-blur-sm px-3 py-1.5 rounded-md shadow-sm border border-border text-[12px] cursor-pointer transition-colors ${d?"text-foreground":"text-muted-foreground hover:text-foreground"}`,children:"Terminal"})]})]}),d&&T.jsx(lR,{tabs:x,defaultTab:"terminal",onClose:()=>f(!1)})]}),p&&y.available&&T.jsxs("div",{className:"flex flex-col bg-[#f3ede5] shrink-0 relative",style:{width:S.width},children:[T.jsx("div",{onMouseDown:S.onDragStart,className:"absolute top-0 left-0 w-1 h-full cursor-ew-resize hover:bg-accent z-20"}),T.jsxs("div",{className:"shrink-0 px-4 py-3 border-b border-border flex items-center justify-between",children:[T.jsx("span",{className:"text-[12px] font-medium text-foreground tracking-wide",children:"History"}),T.jsx("button",{onClick:()=>m(!1),className:"text-muted-foreground hover:text-foreground text-sm px-1 cursor-pointer",title:"Close",children:"×"})]}),T.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:T.jsx(uR,{runs:y.runs,loading:y.loading,selectedRunId:y.selectedRunId,trace:y.trace,traceLoading:y.traceLoading,selectRun:y.selectRun,refresh:y.refresh})})]})]})}PC.createRoot(document.getElementById("root")).render(T.jsx(I.StrictMode,{children:T.jsx(vR,{})}));
|