clustr-ai 0.1.17 → 0.1.19

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.
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Mf;function K0(){if(Mf)return De;Mf=1;var e=Symbol.for("react.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),h=Symbol.for("react.profiler"),S=Symbol.for("react.provider"),y=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),_=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),c=Symbol.iterator;function m(P){return P===null||typeof P!="object"?null:(P=c&&P[c]||P["@@iterator"],typeof P=="function"?P:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,x={};function f(P,F,G){this.props=P,this.context=F,this.refs=x,this.updater=G||C}f.prototype.isReactComponent={},f.prototype.setState=function(P,F){if(typeof P!="object"&&typeof P!="function"&&P!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,P,F,"setState")},f.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function p(){}p.prototype=f.prototype;function d(P,F,G){this.props=P,this.context=F,this.refs=x,this.updater=G||C}var u=d.prototype=new p;u.constructor=d,b(u,f.prototype),u.isPureReactComponent=!0;var w=Array.isArray,L=Object.prototype.hasOwnProperty,R={current:null},D={key:!0,ref:!0,__self:!0,__source:!0};function k(P,F,G){var Z,ie={},ae=null,X=null;if(F!=null)for(Z in F.ref!==void 0&&(X=F.ref),F.key!==void 0&&(ae=""+F.key),F)L.call(F,Z)&&!D.hasOwnProperty(Z)&&(ie[Z]=F[Z]);var H=arguments.length-2;if(H===1)ie.children=G;else if(1<H){for(var re=Array(H),te=0;te<H;te++)re[te]=arguments[te+2];ie.children=re}if(P&&P.defaultProps)for(Z in H=P.defaultProps,H)ie[Z]===void 0&&(ie[Z]=H[Z]);return{$$typeof:e,type:P,key:ae,ref:X,props:ie,_owner:R.current}}function M(P,F){return{$$typeof:e,type:P.type,key:F,ref:P.ref,props:P.props,_owner:P._owner}}function W(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function z(P){var F={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(G){return F[G]})}var j=/\/+/g;function N(P,F){return typeof P=="object"&&P!==null&&P.key!=null?z(""+P.key):F.toString(36)}function I(P,F,G,Z,ie){var ae=typeof P;(ae==="undefined"||ae==="boolean")&&(P=null);var X=!1;if(P===null)X=!0;else switch(ae){case"string":case"number":X=!0;break;case"object":switch(P.$$typeof){case e:case r:X=!0}}if(X)return X=P,ie=ie(X),P=Z===""?"."+N(X,0):Z,w(ie)?(G="",P!=null&&(G=P.replace(j,"$&/")+"/"),I(ie,F,G,"",function(te){return te})):ie!=null&&(W(ie)&&(ie=M(ie,G+(!ie.key||X&&X.key===ie.key?"":(""+ie.key).replace(j,"$&/")+"/")+P)),F.push(ie)),1;if(X=0,Z=Z===""?".":Z+":",w(P))for(var H=0;H<P.length;H++){ae=P[H];var re=Z+N(ae,H);X+=I(ae,F,G,re,ie)}else if(re=m(P),typeof re=="function")for(P=re.call(P),H=0;!(ae=P.next()).done;)ae=ae.value,re=Z+N(ae,H++),X+=I(ae,F,G,re,ie);else if(ae==="object")throw F=String(P),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.");return X}function q(P,F,G){if(P==null)return P;var Z=[],ie=0;return I(P,Z,"","",function(ae){return F.call(G,ae,ie++)}),Z}function U(P){if(P._status===-1){var F=P._result;F=F(),F.then(function(G){(P._status===0||P._status===-1)&&(P._status=1,P._result=G)},function(G){(P._status===0||P._status===-1)&&(P._status=2,P._result=G)}),P._status===-1&&(P._status=0,P._result=F)}if(P._status===1)return P._result.default;throw P._result}var K={current:null},V={transition:null},T={ReactCurrentDispatcher:K,ReactCurrentBatchConfig:V,ReactCurrentOwner:R};function B(){throw Error("act(...) is not supported in production builds of React.")}return De.Children={map:q,forEach:function(P,F,G){q(P,function(){F.apply(this,arguments)},G)},count:function(P){var F=0;return q(P,function(){F++}),F},toArray:function(P){return q(P,function(F){return F})||[]},only:function(P){if(!W(P))throw Error("React.Children.only expected to receive a single React element child.");return P}},De.Component=f,De.Fragment=i,De.Profiler=h,De.PureComponent=d,De.StrictMode=o,De.Suspense=l,De.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=T,De.act=B,De.cloneElement=function(P,F,G){if(P==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+P+".");var Z=b({},P.props),ie=P.key,ae=P.ref,X=P._owner;if(F!=null){if(F.ref!==void 0&&(ae=F.ref,X=R.current),F.key!==void 0&&(ie=""+F.key),P.type&&P.type.defaultProps)var H=P.type.defaultProps;for(re in F)L.call(F,re)&&!D.hasOwnProperty(re)&&(Z[re]=F[re]===void 0&&H!==void 0?H[re]:F[re])}var re=arguments.length-2;if(re===1)Z.children=G;else if(1<re){H=Array(re);for(var te=0;te<re;te++)H[te]=arguments[te+2];Z.children=H}return{$$typeof:e,type:P.type,key:ie,ref:ae,props:Z,_owner:X}},De.createContext=function(P){return P={$$typeof:y,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},P.Provider={$$typeof:S,_context:P},P.Consumer=P},De.createElement=k,De.createFactory=function(P){var F=k.bind(null,P);return F.type=P,F},De.createRef=function(){return{current:null}},De.forwardRef=function(P){return{$$typeof:a,render:P}},De.isValidElement=W,De.lazy=function(P){return{$$typeof:v,_payload:{_status:-1,_result:P},_init:U}},De.memo=function(P,F){return{$$typeof:_,type:P,compare:F===void 0?null:F}},De.startTransition=function(P){var F=V.transition;V.transition={};try{P()}finally{V.transition=F}},De.unstable_act=B,De.useCallback=function(P,F){return K.current.useCallback(P,F)},De.useContext=function(P){return K.current.useContext(P)},De.useDebugValue=function(){},De.useDeferredValue=function(P){return K.current.useDeferredValue(P)},De.useEffect=function(P,F){return K.current.useEffect(P,F)},De.useId=function(){return K.current.useId()},De.useImperativeHandle=function(P,F,G){return K.current.useImperativeHandle(P,F,G)},De.useInsertionEffect=function(P,F){return K.current.useInsertionEffect(P,F)},De.useLayoutEffect=function(P,F){return K.current.useLayoutEffect(P,F)},De.useMemo=function(P,F){return K.current.useMemo(P,F)},De.useReducer=function(P,F,G){return K.current.useReducer(P,F,G)},De.useRef=function(P){return K.current.useRef(P)},De.useState=function(P){return K.current.useState(P)},De.useSyncExternalStore=function(P,F,G){return K.current.useSyncExternalStore(P,F,G)},De.useTransition=function(){return K.current.useTransition()},De.version="18.3.1",De}var Pf;function ks(){return Pf||(Pf=1,Fc.exports=K0()),Fc.exports}/**
9
+ */var Mf;function K0(){if(Mf)return De;Mf=1;var e=Symbol.for("react.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),h=Symbol.for("react.profiler"),S=Symbol.for("react.provider"),y=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),_=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),c=Symbol.iterator;function m(P){return P===null||typeof P!="object"?null:(P=c&&P[c]||P["@@iterator"],typeof P=="function"?P:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,x={};function f(P,F,Y){this.props=P,this.context=F,this.refs=x,this.updater=Y||C}f.prototype.isReactComponent={},f.prototype.setState=function(P,F){if(typeof P!="object"&&typeof P!="function"&&P!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,P,F,"setState")},f.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function p(){}p.prototype=f.prototype;function d(P,F,Y){this.props=P,this.context=F,this.refs=x,this.updater=Y||C}var u=d.prototype=new p;u.constructor=d,b(u,f.prototype),u.isPureReactComponent=!0;var w=Array.isArray,L=Object.prototype.hasOwnProperty,R={current:null},D={key:!0,ref:!0,__self:!0,__source:!0};function k(P,F,Y){var Z,ie={},ae=null,X=null;if(F!=null)for(Z in F.ref!==void 0&&(X=F.ref),F.key!==void 0&&(ae=""+F.key),F)L.call(F,Z)&&!D.hasOwnProperty(Z)&&(ie[Z]=F[Z]);var H=arguments.length-2;if(H===1)ie.children=Y;else if(1<H){for(var re=Array(H),te=0;te<H;te++)re[te]=arguments[te+2];ie.children=re}if(P&&P.defaultProps)for(Z in H=P.defaultProps,H)ie[Z]===void 0&&(ie[Z]=H[Z]);return{$$typeof:e,type:P,key:ae,ref:X,props:ie,_owner:R.current}}function M(P,F){return{$$typeof:e,type:P.type,key:F,ref:P.ref,props:P.props,_owner:P._owner}}function W(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function z(P){var F={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(Y){return F[Y]})}var j=/\/+/g;function N(P,F){return typeof P=="object"&&P!==null&&P.key!=null?z(""+P.key):F.toString(36)}function I(P,F,Y,Z,ie){var ae=typeof P;(ae==="undefined"||ae==="boolean")&&(P=null);var X=!1;if(P===null)X=!0;else switch(ae){case"string":case"number":X=!0;break;case"object":switch(P.$$typeof){case e:case r:X=!0}}if(X)return X=P,ie=ie(X),P=Z===""?"."+N(X,0):Z,w(ie)?(Y="",P!=null&&(Y=P.replace(j,"$&/")+"/"),I(ie,F,Y,"",function(te){return te})):ie!=null&&(W(ie)&&(ie=M(ie,Y+(!ie.key||X&&X.key===ie.key?"":(""+ie.key).replace(j,"$&/")+"/")+P)),F.push(ie)),1;if(X=0,Z=Z===""?".":Z+":",w(P))for(var H=0;H<P.length;H++){ae=P[H];var re=Z+N(ae,H);X+=I(ae,F,Y,re,ie)}else if(re=m(P),typeof re=="function")for(P=re.call(P),H=0;!(ae=P.next()).done;)ae=ae.value,re=Z+N(ae,H++),X+=I(ae,F,Y,re,ie);else if(ae==="object")throw F=String(P),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.");return X}function q(P,F,Y){if(P==null)return P;var Z=[],ie=0;return I(P,Z,"","",function(ae){return F.call(Y,ae,ie++)}),Z}function U(P){if(P._status===-1){var F=P._result;F=F(),F.then(function(Y){(P._status===0||P._status===-1)&&(P._status=1,P._result=Y)},function(Y){(P._status===0||P._status===-1)&&(P._status=2,P._result=Y)}),P._status===-1&&(P._status=0,P._result=F)}if(P._status===1)return P._result.default;throw P._result}var K={current:null},V={transition:null},T={ReactCurrentDispatcher:K,ReactCurrentBatchConfig:V,ReactCurrentOwner:R};function B(){throw Error("act(...) is not supported in production builds of React.")}return De.Children={map:q,forEach:function(P,F,Y){q(P,function(){F.apply(this,arguments)},Y)},count:function(P){var F=0;return q(P,function(){F++}),F},toArray:function(P){return q(P,function(F){return F})||[]},only:function(P){if(!W(P))throw Error("React.Children.only expected to receive a single React element child.");return P}},De.Component=f,De.Fragment=i,De.Profiler=h,De.PureComponent=d,De.StrictMode=o,De.Suspense=l,De.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=T,De.act=B,De.cloneElement=function(P,F,Y){if(P==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+P+".");var Z=b({},P.props),ie=P.key,ae=P.ref,X=P._owner;if(F!=null){if(F.ref!==void 0&&(ae=F.ref,X=R.current),F.key!==void 0&&(ie=""+F.key),P.type&&P.type.defaultProps)var H=P.type.defaultProps;for(re in F)L.call(F,re)&&!D.hasOwnProperty(re)&&(Z[re]=F[re]===void 0&&H!==void 0?H[re]:F[re])}var re=arguments.length-2;if(re===1)Z.children=Y;else if(1<re){H=Array(re);for(var te=0;te<re;te++)H[te]=arguments[te+2];Z.children=H}return{$$typeof:e,type:P.type,key:ie,ref:ae,props:Z,_owner:X}},De.createContext=function(P){return P={$$typeof:y,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},P.Provider={$$typeof:S,_context:P},P.Consumer=P},De.createElement=k,De.createFactory=function(P){var F=k.bind(null,P);return F.type=P,F},De.createRef=function(){return{current:null}},De.forwardRef=function(P){return{$$typeof:a,render:P}},De.isValidElement=W,De.lazy=function(P){return{$$typeof:v,_payload:{_status:-1,_result:P},_init:U}},De.memo=function(P,F){return{$$typeof:_,type:P,compare:F===void 0?null:F}},De.startTransition=function(P){var F=V.transition;V.transition={};try{P()}finally{V.transition=F}},De.unstable_act=B,De.useCallback=function(P,F){return K.current.useCallback(P,F)},De.useContext=function(P){return K.current.useContext(P)},De.useDebugValue=function(){},De.useDeferredValue=function(P){return K.current.useDeferredValue(P)},De.useEffect=function(P,F){return K.current.useEffect(P,F)},De.useId=function(){return K.current.useId()},De.useImperativeHandle=function(P,F,Y){return K.current.useImperativeHandle(P,F,Y)},De.useInsertionEffect=function(P,F){return K.current.useInsertionEffect(P,F)},De.useLayoutEffect=function(P,F){return K.current.useLayoutEffect(P,F)},De.useMemo=function(P,F){return K.current.useMemo(P,F)},De.useReducer=function(P,F,Y){return K.current.useReducer(P,F,Y)},De.useRef=function(P){return K.current.useRef(P)},De.useState=function(P){return K.current.useState(P)},De.useSyncExternalStore=function(P,F,Y){return K.current.useSyncExternalStore(P,F,Y)},De.useTransition=function(){return K.current.useTransition()},De.version="18.3.1",De}var Pf;function ks(){return Pf||(Pf=1,Fc.exports=K0()),Fc.exports}/**
10
10
  * @license React
11
11
  * react-jsx-runtime.production.min.js
12
12
  *
@@ -22,7 +22,7 @@
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */var If;function G0(){return If||(If=1,(function(e){function r(V,T){var B=V.length;V.push(T);e:for(;0<B;){var P=B-1>>>1,F=V[P];if(0<h(F,T))V[P]=T,V[B]=F,B=P;else break e}}function i(V){return V.length===0?null:V[0]}function o(V){if(V.length===0)return null;var T=V[0],B=V.pop();if(B!==T){V[0]=B;e:for(var P=0,F=V.length,G=F>>>1;P<G;){var Z=2*(P+1)-1,ie=V[Z],ae=Z+1,X=V[ae];if(0>h(ie,B))ae<F&&0>h(X,ie)?(V[P]=X,V[ae]=B,P=ae):(V[P]=ie,V[Z]=B,P=Z);else if(ae<F&&0>h(X,B))V[P]=X,V[ae]=B,P=ae;else break e}}return T}function h(V,T){var B=V.sortIndex-T.sortIndex;return B!==0?B:V.id-T.id}if(typeof performance=="object"&&typeof performance.now=="function"){var S=performance;e.unstable_now=function(){return S.now()}}else{var y=Date,a=y.now();e.unstable_now=function(){return y.now()-a}}var l=[],_=[],v=1,c=null,m=3,C=!1,b=!1,x=!1,f=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function u(V){for(var T=i(_);T!==null;){if(T.callback===null)o(_);else if(T.startTime<=V)o(_),T.sortIndex=T.expirationTime,r(l,T);else break;T=i(_)}}function w(V){if(x=!1,u(V),!b)if(i(l)!==null)b=!0,U(L);else{var T=i(_);T!==null&&K(w,T.startTime-V)}}function L(V,T){b=!1,x&&(x=!1,p(k),k=-1),C=!0;var B=m;try{for(u(T),c=i(l);c!==null&&(!(c.expirationTime>T)||V&&!z());){var P=c.callback;if(typeof P=="function"){c.callback=null,m=c.priorityLevel;var F=P(c.expirationTime<=T);T=e.unstable_now(),typeof F=="function"?c.callback=F:c===i(l)&&o(l),u(T)}else o(l);c=i(l)}if(c!==null)var G=!0;else{var Z=i(_);Z!==null&&K(w,Z.startTime-T),G=!1}return G}finally{c=null,m=B,C=!1}}var R=!1,D=null,k=-1,M=5,W=-1;function z(){return!(e.unstable_now()-W<M)}function j(){if(D!==null){var V=e.unstable_now();W=V;var T=!0;try{T=D(!0,V)}finally{T?N():(R=!1,D=null)}}else R=!1}var N;if(typeof d=="function")N=function(){d(j)};else if(typeof MessageChannel<"u"){var I=new MessageChannel,q=I.port2;I.port1.onmessage=j,N=function(){q.postMessage(null)}}else N=function(){f(j,0)};function U(V){D=V,R||(R=!0,N())}function K(V,T){k=f(function(){V(e.unstable_now())},T)}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(V){V.callback=null},e.unstable_continueExecution=function(){b||C||(b=!0,U(L))},e.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<V?Math.floor(1e3/V):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return i(l)},e.unstable_next=function(V){switch(m){case 1:case 2:case 3:var T=3;break;default:T=m}var B=m;m=T;try{return V()}finally{m=B}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(V,T){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var B=m;m=V;try{return T()}finally{m=B}},e.unstable_scheduleCallback=function(V,T,B){var P=e.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?P+B:P):B=P,V){case 1:var F=-1;break;case 2:F=250;break;case 5:F=1073741823;break;case 4:F=1e4;break;default:F=5e3}return F=B+F,V={id:v++,callback:T,priorityLevel:V,startTime:B,expirationTime:F,sortIndex:-1},B>P?(V.sortIndex=B,r(_,V),i(l)===null&&V===i(_)&&(x?(p(k),k=-1):x=!0,K(w,B-P))):(V.sortIndex=F,r(l,V),b||C||(b=!0,U(L))),V},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(V){var T=m;return function(){var B=m;m=T;try{return V.apply(this,arguments)}finally{m=B}}}})($c)),$c}var Of;function Q0(){return Of||(Of=1,zc.exports=G0()),zc.exports}/**
25
+ */var If;function G0(){return If||(If=1,(function(e){function r(V,T){var B=V.length;V.push(T);e:for(;0<B;){var P=B-1>>>1,F=V[P];if(0<h(F,T))V[P]=T,V[B]=F,B=P;else break e}}function i(V){return V.length===0?null:V[0]}function o(V){if(V.length===0)return null;var T=V[0],B=V.pop();if(B!==T){V[0]=B;e:for(var P=0,F=V.length,Y=F>>>1;P<Y;){var Z=2*(P+1)-1,ie=V[Z],ae=Z+1,X=V[ae];if(0>h(ie,B))ae<F&&0>h(X,ie)?(V[P]=X,V[ae]=B,P=ae):(V[P]=ie,V[Z]=B,P=Z);else if(ae<F&&0>h(X,B))V[P]=X,V[ae]=B,P=ae;else break e}}return T}function h(V,T){var B=V.sortIndex-T.sortIndex;return B!==0?B:V.id-T.id}if(typeof performance=="object"&&typeof performance.now=="function"){var S=performance;e.unstable_now=function(){return S.now()}}else{var y=Date,a=y.now();e.unstable_now=function(){return y.now()-a}}var l=[],_=[],v=1,c=null,m=3,C=!1,b=!1,x=!1,f=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function u(V){for(var T=i(_);T!==null;){if(T.callback===null)o(_);else if(T.startTime<=V)o(_),T.sortIndex=T.expirationTime,r(l,T);else break;T=i(_)}}function w(V){if(x=!1,u(V),!b)if(i(l)!==null)b=!0,U(L);else{var T=i(_);T!==null&&K(w,T.startTime-V)}}function L(V,T){b=!1,x&&(x=!1,p(k),k=-1),C=!0;var B=m;try{for(u(T),c=i(l);c!==null&&(!(c.expirationTime>T)||V&&!z());){var P=c.callback;if(typeof P=="function"){c.callback=null,m=c.priorityLevel;var F=P(c.expirationTime<=T);T=e.unstable_now(),typeof F=="function"?c.callback=F:c===i(l)&&o(l),u(T)}else o(l);c=i(l)}if(c!==null)var Y=!0;else{var Z=i(_);Z!==null&&K(w,Z.startTime-T),Y=!1}return Y}finally{c=null,m=B,C=!1}}var R=!1,D=null,k=-1,M=5,W=-1;function z(){return!(e.unstable_now()-W<M)}function j(){if(D!==null){var V=e.unstable_now();W=V;var T=!0;try{T=D(!0,V)}finally{T?N():(R=!1,D=null)}}else R=!1}var N;if(typeof d=="function")N=function(){d(j)};else if(typeof MessageChannel<"u"){var I=new MessageChannel,q=I.port2;I.port1.onmessage=j,N=function(){q.postMessage(null)}}else N=function(){f(j,0)};function U(V){D=V,R||(R=!0,N())}function K(V,T){k=f(function(){V(e.unstable_now())},T)}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(V){V.callback=null},e.unstable_continueExecution=function(){b||C||(b=!0,U(L))},e.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<V?Math.floor(1e3/V):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return i(l)},e.unstable_next=function(V){switch(m){case 1:case 2:case 3:var T=3;break;default:T=m}var B=m;m=T;try{return V()}finally{m=B}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(V,T){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var B=m;m=V;try{return T()}finally{m=B}},e.unstable_scheduleCallback=function(V,T,B){var P=e.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?P+B:P):B=P,V){case 1:var F=-1;break;case 2:F=250;break;case 5:F=1073741823;break;case 4:F=1e4;break;default:F=5e3}return F=B+F,V={id:v++,callback:T,priorityLevel:V,startTime:B,expirationTime:F,sortIndex:-1},B>P?(V.sortIndex=B,r(_,V),i(l)===null&&V===i(_)&&(x?(p(k),k=-1):x=!0,K(w,B-P))):(V.sortIndex=F,r(l,V),b||C||(b=!0,U(L))),V},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(V){var T=m;return function(){var B=m;m=T;try{return V.apply(this,arguments)}finally{m=B}}}})($c)),$c}var Of;function Q0(){return Of||(Of=1,zc.exports=G0()),zc.exports}/**
26
26
  * @license React
27
27
  * react-dom.production.min.js
28
28
  *
@@ -31,13 +31,13 @@
31
31
  * This source code is licensed under the MIT license found in the
32
32
  * LICENSE file in the root directory of this source tree.
33
33
  */var Hf;function J0(){if(Hf)return kt;Hf=1;var e=ks(),r=Q0();function i(t){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+t,s=1;s<arguments.length;s++)n+="&args[]="+encodeURIComponent(arguments[s]);return"Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var o=new Set,h={};function S(t,n){y(t,n),y(t+"Capture",n)}function y(t,n){for(h[t]=n,t=0;t<n.length;t++)o.add(n[t])}var a=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),l=Object.prototype.hasOwnProperty,_=/^[: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]*$/,v={},c={};function m(t){return l.call(c,t)?!0:l.call(v,t)?!1:_.test(t)?c[t]=!0:(v[t]=!0,!1)}function C(t,n,s,g){if(s!==null&&s.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return g?!1:s!==null?!s.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function b(t,n,s,g){if(n===null||typeof n>"u"||C(t,n,s,g))return!0;if(g)return!1;if(s!==null)switch(s.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function x(t,n,s,g,E,A,$){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=g,this.attributeNamespace=E,this.mustUseProperty=s,this.propertyName=t,this.type=n,this.sanitizeURL=A,this.removeEmptyString=$}var f={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){f[t]=new x(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var n=t[0];f[n]=new x(n,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){f[t]=new x(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){f[t]=new x(t,2,!1,t,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){f[t]=new x(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){f[t]=new x(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){f[t]=new x(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){f[t]=new x(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){f[t]=new x(t,5,!1,t.toLowerCase(),null,!1,!1)});var p=/[\-:]([a-z])/g;function d(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var n=t.replace(p,d);f[n]=new x(n,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var n=t.replace(p,d);f[n]=new x(n,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var n=t.replace(p,d);f[n]=new x(n,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){f[t]=new x(t,1,!1,t.toLowerCase(),null,!1,!1)}),f.xlinkHref=new x("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){f[t]=new x(t,1,!1,t.toLowerCase(),null,!0,!0)});function u(t,n,s,g){var E=f.hasOwnProperty(n)?f[n]:null;(E!==null?E.type!==0:g||!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(b(n,s,E,g)&&(s=null),g||E===null?m(n)&&(s===null?t.removeAttribute(n):t.setAttribute(n,""+s)):E.mustUseProperty?t[E.propertyName]=s===null?E.type===3?!1:"":s:(n=E.attributeName,g=E.attributeNamespace,s===null?t.removeAttribute(n):(E=E.type,s=E===3||E===4&&s===!0?"":""+s,g?t.setAttributeNS(g,n,s):t.setAttribute(n,s))))}var w=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,L=Symbol.for("react.element"),R=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),W=Symbol.for("react.provider"),z=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),K=Symbol.for("react.offscreen"),V=Symbol.iterator;function T(t){return t===null||typeof t!="object"?null:(t=V&&t[V]||t["@@iterator"],typeof t=="function"?t:null)}var B=Object.assign,P;function F(t){if(P===void 0)try{throw Error()}catch(s){var n=s.stack.trim().match(/\n( *(at )?)/);P=n&&n[1]||""}return`
34
- `+P+t}var G=!1;function Z(t,n){if(!t||G)return"";G=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(n)if(n=function(){throw Error()},Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(n,[])}catch(oe){var g=oe}Reflect.construct(t,[],n)}else{try{n.call()}catch(oe){g=oe}t.call(n.prototype)}else{try{throw Error()}catch(oe){g=oe}t()}}catch(oe){if(oe&&g&&typeof oe.stack=="string"){for(var E=oe.stack.split(`
34
+ `+P+t}var Y=!1;function Z(t,n){if(!t||Y)return"";Y=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(n)if(n=function(){throw Error()},Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(n,[])}catch(oe){var g=oe}Reflect.construct(t,[],n)}else{try{n.call()}catch(oe){g=oe}t.call(n.prototype)}else{try{throw Error()}catch(oe){g=oe}t()}}catch(oe){if(oe&&g&&typeof oe.stack=="string"){for(var E=oe.stack.split(`
35
35
  `),A=g.stack.split(`
36
- `),$=E.length-1,Y=A.length-1;1<=$&&0<=Y&&E[$]!==A[Y];)Y--;for(;1<=$&&0<=Y;$--,Y--)if(E[$]!==A[Y]){if($!==1||Y!==1)do if($--,Y--,0>Y||E[$]!==A[Y]){var Q=`
37
- `+E[$].replace(" at new "," at ");return t.displayName&&Q.includes("<anonymous>")&&(Q=Q.replace("<anonymous>",t.displayName)),Q}while(1<=$&&0<=Y);break}}}finally{G=!1,Error.prepareStackTrace=s}return(t=t?t.displayName||t.name:"")?F(t):""}function ie(t){switch(t.tag){case 5:return F(t.type);case 16:return F("Lazy");case 13:return F("Suspense");case 19:return F("SuspenseList");case 0:case 2:case 15:return t=Z(t.type,!1),t;case 11:return t=Z(t.type.render,!1),t;case 1:return t=Z(t.type,!0),t;default:return""}}function ae(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case D:return"Fragment";case R:return"Portal";case M:return"Profiler";case k:return"StrictMode";case N:return"Suspense";case I:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case z:return(t.displayName||"Context")+".Consumer";case W:return(t._context.displayName||"Context")+".Provider";case j:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case q:return n=t.displayName||null,n!==null?n:ae(t.type)||"Memo";case U:n=t._payload,t=t._init;try{return ae(t(n))}catch{}}return null}function X(t){var n=t.type;switch(t.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=n.render,t=t.displayName||t.name||"",n.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ae(n);case 8:return n===k?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function H(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function re(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function te(t){var n=re(t)?"checked":"value",s=Object.getOwnPropertyDescriptor(t.constructor.prototype,n),g=""+t[n];if(!t.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var E=s.get,A=s.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return E.call(this)},set:function($){g=""+$,A.call(this,$)}}),Object.defineProperty(t,n,{enumerable:s.enumerable}),{getValue:function(){return g},setValue:function($){g=""+$},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function ce(t){t._valueTracker||(t._valueTracker=te(t))}function le(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var s=n.getValue(),g="";return t&&(g=re(t)?t.checked?"true":"false":t.value),t=g,t!==s?(n.setValue(t),!0):!1}function pe(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Se(t,n){var s=n.checked;return B({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??t._wrapperState.initialChecked})}function be(t,n){var s=n.defaultValue==null?"":n.defaultValue,g=n.checked!=null?n.checked:n.defaultChecked;s=H(n.value!=null?n.value:s),t._wrapperState={initialChecked:g,initialValue:s,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function ue(t,n){n=n.checked,n!=null&&u(t,"checked",n,!1)}function ge(t,n){ue(t,n);var s=H(n.value),g=n.type;if(s!=null)g==="number"?(s===0&&t.value===""||t.value!=s)&&(t.value=""+s):t.value!==""+s&&(t.value=""+s);else if(g==="submit"||g==="reset"){t.removeAttribute("value");return}n.hasOwnProperty("value")?Ie(t,n.type,s):n.hasOwnProperty("defaultValue")&&Ie(t,n.type,H(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(t.defaultChecked=!!n.defaultChecked)}function Re(t,n,s){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var g=n.type;if(!(g!=="submit"&&g!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+t._wrapperState.initialValue,s||n===t.value||(t.value=n),t.defaultValue=n}s=t.name,s!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,s!==""&&(t.name=s)}function Ie(t,n,s){(n!=="number"||pe(t.ownerDocument)!==t)&&(s==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+s&&(t.defaultValue=""+s))}var ze=Array.isArray;function Qe(t,n,s,g){if(t=t.options,n){n={};for(var E=0;E<s.length;E++)n["$"+s[E]]=!0;for(s=0;s<t.length;s++)E=n.hasOwnProperty("$"+t[s].value),t[s].selected!==E&&(t[s].selected=E),E&&g&&(t[s].defaultSelected=!0)}else{for(s=""+H(s),n=null,E=0;E<t.length;E++){if(t[E].value===s){t[E].selected=!0,g&&(t[E].defaultSelected=!0);return}n!==null||t[E].disabled||(n=t[E])}n!==null&&(n.selected=!0)}}function ut(t,n){if(n.dangerouslySetInnerHTML!=null)throw Error(i(91));return B({},n,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function qe(t,n){var s=n.value;if(s==null){if(s=n.children,n=n.defaultValue,s!=null){if(n!=null)throw Error(i(92));if(ze(s)){if(1<s.length)throw Error(i(93));s=s[0]}n=s}n==null&&(n=""),s=n}t._wrapperState={initialValue:H(s)}}function pt(t,n){var s=H(n.value),g=H(n.defaultValue);s!=null&&(s=""+s,s!==t.value&&(t.value=s),n.defaultValue==null&&t.defaultValue!==s&&(t.defaultValue=s)),g!=null&&(t.defaultValue=""+g)}function Ne(t){var n=t.textContent;n===t._wrapperState.initialValue&&n!==""&&n!==null&&(t.value=n)}function Je(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ht(t,n){return t==null||t==="http://www.w3.org/1999/xhtml"?Je(n):t==="http://www.w3.org/2000/svg"&&n==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var $e,pr=(function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(n,s,g,E){MSApp.execUnsafeLocalFunction(function(){return t(n,s,g,E)})}:t})(function(t,n){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=n;else{for($e=$e||document.createElement("div"),$e.innerHTML="<svg>"+n.valueOf().toString()+"</svg>",n=$e.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;n.firstChild;)t.appendChild(n.firstChild)}});function ot(t,n){if(n){var s=t.firstChild;if(s&&s===t.lastChild&&s.nodeType===3){s.nodeValue=n;return}}t.textContent=n}var Rt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Oe=["Webkit","ms","Moz","O"];Object.keys(Rt).forEach(function(t){Oe.forEach(function(n){n=n+t.charAt(0).toUpperCase()+t.substring(1),Rt[n]=Rt[t]})});function Rn(t,n,s){return n==null||typeof n=="boolean"||n===""?"":s||typeof n!="number"||n===0||Rt.hasOwnProperty(t)&&Rt[t]?(""+n).trim():n+"px"}function Ps(t,n){t=t.style;for(var s in n)if(n.hasOwnProperty(s)){var g=s.indexOf("--")===0,E=Rn(s,n[s],g);s==="float"&&(s="cssFloat"),g?t.setProperty(s,E):t[s]=E}}var Ka=B({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function vi(t,n){if(n){if(Ka[t]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(i(137,t));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(i(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(i(61))}if(n.style!=null&&typeof n.style!="object")throw Error(i(62))}}function yi(t,n){if(t.indexOf("-")===-1)return typeof n.is=="string";switch(t){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 wi=null;function Si(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Ci=null,Dr=null,Ar=null;function Ns(t){if(t=Ki(t)){if(typeof Ci!="function")throw Error(i(280));var n=t.stateNode;n&&(n=uo(n),Ci(t.stateNode,t.type,n))}}function Bs(t){Dr?Ar?Ar.push(t):Ar=[t]:Dr=t}function Is(){if(Dr){var t=Dr,n=Ar;if(Ar=Dr=null,Ns(t),n)for(t=0;t<n.length;t++)Ns(n[t])}}function Os(t,n){return t(n)}function Hs(){}var xi=!1;function Fs(t,n,s){if(xi)return t(n,s);xi=!0;try{return Os(t,n,s)}finally{xi=!1,(Dr!==null||Ar!==null)&&(Hs(),Is())}}function rn(t,n){var s=t.stateNode;if(s===null)return null;var g=uo(s);if(g===null)return null;s=g[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":(g=!g.disabled)||(t=t.type,g=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!g;break e;default:t=!1}if(t)return null;if(s&&typeof s!="function")throw Error(i(231,n,typeof s));return s}var bi=!1;if(a)try{var nn={};Object.defineProperty(nn,"passive",{get:function(){bi=!0}}),window.addEventListener("test",nn,nn),window.removeEventListener("test",nn,nn)}catch{bi=!1}function Xa(t,n,s,g,E,A,$,Y,Q){var oe=Array.prototype.slice.call(arguments,3);try{n.apply(s,oe)}catch(de){this.onError(de)}}var sn=!1,Dn=null,An=!1,Ei=null,Ya={onError:function(t){sn=!0,Dn=t}};function Ga(t,n,s,g,E,A,$,Y,Q){sn=!1,Dn=null,Xa.apply(Ya,arguments)}function Qa(t,n,s,g,E,A,$,Y,Q){if(Ga.apply(this,arguments),sn){if(sn){var oe=Dn;sn=!1,Dn=null}else throw Error(i(198));An||(An=!0,Ei=oe)}}function rr(t){var n=t,s=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(s=n.return),t=n.return;while(t)}return n.tag===3?s:null}function ki(t){if(t.tag===13){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function Li(t){if(rr(t)!==t)throw Error(i(188))}function Ja(t){var n=t.alternate;if(!n){if(n=rr(t),n===null)throw Error(i(188));return n!==t?null:t}for(var s=t,g=n;;){var E=s.return;if(E===null)break;var A=E.alternate;if(A===null){if(g=E.return,g!==null){s=g;continue}break}if(E.child===A.child){for(A=E.child;A;){if(A===s)return Li(E),t;if(A===g)return Li(E),n;A=A.sibling}throw Error(i(188))}if(s.return!==g.return)s=E,g=A;else{for(var $=!1,Y=E.child;Y;){if(Y===s){$=!0,s=E,g=A;break}if(Y===g){$=!0,g=E,s=A;break}Y=Y.sibling}if(!$){for(Y=A.child;Y;){if(Y===s){$=!0,s=A,g=E;break}if(Y===g){$=!0,g=A,s=E;break}Y=Y.sibling}if(!$)throw Error(i(189))}}if(s.alternate!==g)throw Error(i(190))}if(s.tag!==3)throw Error(i(188));return s.stateNode.current===s?t:n}function js(t){return t=Ja(t),t!==null?zs(t):null}function zs(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var n=zs(t);if(n!==null)return n;t=t.sibling}return null}var $s=r.unstable_scheduleCallback,Ws=r.unstable_cancelCallback,Za=r.unstable_shouldYield,Us=r.unstable_requestPaint,Ke=r.unstable_now,el=r.unstable_getCurrentPriorityLevel,Ri=r.unstable_ImmediatePriority,Vs=r.unstable_UserBlockingPriority,Tn=r.unstable_NormalPriority,tl=r.unstable_LowPriority,qs=r.unstable_IdlePriority,on=null,It=null;function rl(t){if(It&&typeof It.onCommitFiberRoot=="function")try{It.onCommitFiberRoot(on,t,void 0,(t.current.flags&128)===128)}catch{}}var Dt=Math.clz32?Math.clz32:sl,nl=Math.log,il=Math.LN2;function sl(t){return t>>>=0,t===0?32:31-(nl(t)/il|0)|0}var Mn=64,Pn=4194304;function nr(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Nn(t,n){var s=t.pendingLanes;if(s===0)return 0;var g=0,E=t.suspendedLanes,A=t.pingedLanes,$=s&268435455;if($!==0){var Y=$&~E;Y!==0?g=nr(Y):(A&=$,A!==0&&(g=nr(A)))}else $=s&~E,$!==0?g=nr($):A!==0&&(g=nr(A));if(g===0)return 0;if(n!==0&&n!==g&&(n&E)===0&&(E=g&-g,A=n&-n,E>=A||E===16&&(A&4194240)!==0))return n;if((g&4)!==0&&(g|=s&16),n=t.entangledLanes,n!==0)for(t=t.entanglements,n&=g;0<n;)s=31-Dt(n),E=1<<s,g|=t[s],n&=~E;return g}function Ks(t,n){switch(t){case 1:case 2:case 4:return n+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ol(t,n){for(var s=t.suspendedLanes,g=t.pingedLanes,E=t.expirationTimes,A=t.pendingLanes;0<A;){var $=31-Dt(A),Y=1<<$,Q=E[$];Q===-1?((Y&s)===0||(Y&g)!==0)&&(E[$]=Ks(Y,n)):Q<=n&&(t.expiredLanes|=Y),A&=~Y}}function Di(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Bn(){var t=Mn;return Mn<<=1,(Mn&4194240)===0&&(Mn=64),t}function Ai(t){for(var n=[],s=0;31>s;s++)n.push(t);return n}function an(t,n,s){t.pendingLanes|=n,n!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,n=31-Dt(n),t[n]=s}function Xs(t,n){var s=t.pendingLanes&~n;t.pendingLanes=n,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=n,t.mutableReadLanes&=n,t.entangledLanes&=n,n=t.entanglements;var g=t.eventTimes;for(t=t.expirationTimes;0<s;){var E=31-Dt(s),A=1<<E;n[E]=0,g[E]=-1,t[E]=-1,s&=~A}}function al(t,n){var s=t.entangledLanes|=n;for(t=t.entanglements;s;){var g=31-Dt(s),E=1<<g;E&n|t[g]&n&&(t[g]|=n),s&=~E}}var Be=0;function ch(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var uh,ll,hh,dh,fh,cl=!1,Ys=[],Tr=null,Mr=null,Pr=null,Ti=new Map,Mi=new Map,Nr=[],_m="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function ph(t,n){switch(t){case"focusin":case"focusout":Tr=null;break;case"dragenter":case"dragleave":Mr=null;break;case"mouseover":case"mouseout":Pr=null;break;case"pointerover":case"pointerout":Ti.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Mi.delete(n.pointerId)}}function Pi(t,n,s,g,E,A){return t===null||t.nativeEvent!==A?(t={blockedOn:n,domEventName:s,eventSystemFlags:g,nativeEvent:A,targetContainers:[E]},n!==null&&(n=Ki(n),n!==null&&ll(n)),t):(t.eventSystemFlags|=g,n=t.targetContainers,E!==null&&n.indexOf(E)===-1&&n.push(E),t)}function gm(t,n,s,g,E){switch(n){case"focusin":return Tr=Pi(Tr,t,n,s,g,E),!0;case"dragenter":return Mr=Pi(Mr,t,n,s,g,E),!0;case"mouseover":return Pr=Pi(Pr,t,n,s,g,E),!0;case"pointerover":var A=E.pointerId;return Ti.set(A,Pi(Ti.get(A)||null,t,n,s,g,E)),!0;case"gotpointercapture":return A=E.pointerId,Mi.set(A,Pi(Mi.get(A)||null,t,n,s,g,E)),!0}return!1}function _h(t){var n=ln(t.target);if(n!==null){var s=rr(n);if(s!==null){if(n=s.tag,n===13){if(n=ki(s),n!==null){t.blockedOn=n,fh(t.priority,function(){hh(s)});return}}else if(n===3&&s.stateNode.current.memoizedState.isDehydrated){t.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Gs(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var s=hl(t.domEventName,t.eventSystemFlags,n[0],t.nativeEvent);if(s===null){s=t.nativeEvent;var g=new s.constructor(s.type,s);wi=g,s.target.dispatchEvent(g),wi=null}else return n=Ki(s),n!==null&&ll(n),t.blockedOn=s,!1;n.shift()}return!0}function gh(t,n,s){Gs(t)&&s.delete(n)}function mm(){cl=!1,Tr!==null&&Gs(Tr)&&(Tr=null),Mr!==null&&Gs(Mr)&&(Mr=null),Pr!==null&&Gs(Pr)&&(Pr=null),Ti.forEach(gh),Mi.forEach(gh)}function Ni(t,n){t.blockedOn===n&&(t.blockedOn=null,cl||(cl=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,mm)))}function Bi(t){function n(E){return Ni(E,t)}if(0<Ys.length){Ni(Ys[0],t);for(var s=1;s<Ys.length;s++){var g=Ys[s];g.blockedOn===t&&(g.blockedOn=null)}}for(Tr!==null&&Ni(Tr,t),Mr!==null&&Ni(Mr,t),Pr!==null&&Ni(Pr,t),Ti.forEach(n),Mi.forEach(n),s=0;s<Nr.length;s++)g=Nr[s],g.blockedOn===t&&(g.blockedOn=null);for(;0<Nr.length&&(s=Nr[0],s.blockedOn===null);)_h(s),s.blockedOn===null&&Nr.shift()}var In=w.ReactCurrentBatchConfig,Qs=!0;function vm(t,n,s,g){var E=Be,A=In.transition;In.transition=null;try{Be=1,ul(t,n,s,g)}finally{Be=E,In.transition=A}}function ym(t,n,s,g){var E=Be,A=In.transition;In.transition=null;try{Be=4,ul(t,n,s,g)}finally{Be=E,In.transition=A}}function ul(t,n,s,g){if(Qs){var E=hl(t,n,s,g);if(E===null)Rl(t,n,g,Js,s),ph(t,g);else if(gm(E,t,n,s,g))g.stopPropagation();else if(ph(t,g),n&4&&-1<_m.indexOf(t)){for(;E!==null;){var A=Ki(E);if(A!==null&&uh(A),A=hl(t,n,s,g),A===null&&Rl(t,n,g,Js,s),A===E)break;E=A}E!==null&&g.stopPropagation()}else Rl(t,n,g,null,s)}}var Js=null;function hl(t,n,s,g){if(Js=null,t=Si(g),t=ln(t),t!==null)if(n=rr(t),n===null)t=null;else if(s=n.tag,s===13){if(t=ki(n),t!==null)return t;t=null}else if(s===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;t=null}else n!==t&&(t=null);return Js=t,null}function mh(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(el()){case Ri:return 1;case Vs:return 4;case Tn:case tl:return 16;case qs:return 536870912;default:return 16}default:return 16}}var Br=null,dl=null,Zs=null;function vh(){if(Zs)return Zs;var t,n=dl,s=n.length,g,E="value"in Br?Br.value:Br.textContent,A=E.length;for(t=0;t<s&&n[t]===E[t];t++);var $=s-t;for(g=1;g<=$&&n[s-g]===E[A-g];g++);return Zs=E.slice(t,1<g?1-g:void 0)}function eo(t){var n=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&n===13&&(t=13)):t=n,t===10&&(t=13),32<=t||t===13?t:0}function to(){return!0}function yh(){return!1}function At(t){function n(s,g,E,A,$){this._reactName=s,this._targetInst=E,this.type=g,this.nativeEvent=A,this.target=$,this.currentTarget=null;for(var Y in t)t.hasOwnProperty(Y)&&(s=t[Y],this[Y]=s?s(A):A[Y]);return this.isDefaultPrevented=(A.defaultPrevented!=null?A.defaultPrevented:A.returnValue===!1)?to:yh,this.isPropagationStopped=yh,this}return B(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=to)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=to)},persist:function(){},isPersistent:to}),n}var On={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},fl=At(On),Ii=B({},On,{view:0,detail:0}),wm=At(Ii),pl,_l,Oi,ro=B({},Ii,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ml,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Oi&&(Oi&&t.type==="mousemove"?(pl=t.screenX-Oi.screenX,_l=t.screenY-Oi.screenY):_l=pl=0,Oi=t),pl)},movementY:function(t){return"movementY"in t?t.movementY:_l}}),wh=At(ro),Sm=B({},ro,{dataTransfer:0}),Cm=At(Sm),xm=B({},Ii,{relatedTarget:0}),gl=At(xm),bm=B({},On,{animationName:0,elapsedTime:0,pseudoElement:0}),Em=At(bm),km=B({},On,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Lm=At(km),Rm=B({},On,{data:0}),Sh=At(Rm),Dm={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Am={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"},Tm={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Mm(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=Tm[t])?!!n[t]:!1}function ml(){return Mm}var Pm=B({},Ii,{key:function(t){if(t.key){var n=Dm[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=eo(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Am[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ml,charCode:function(t){return t.type==="keypress"?eo(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?eo(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Nm=At(Pm),Bm=B({},ro,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ch=At(Bm),Im=B({},Ii,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ml}),Om=At(Im),Hm=B({},On,{propertyName:0,elapsedTime:0,pseudoElement:0}),Fm=At(Hm),jm=B({},ro,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),zm=At(jm),$m=[9,13,27,32],vl=a&&"CompositionEvent"in window,Hi=null;a&&"documentMode"in document&&(Hi=document.documentMode);var Wm=a&&"TextEvent"in window&&!Hi,xh=a&&(!vl||Hi&&8<Hi&&11>=Hi),bh=" ",Eh=!1;function kh(t,n){switch(t){case"keyup":return $m.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Lh(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Hn=!1;function Um(t,n){switch(t){case"compositionend":return Lh(n);case"keypress":return n.which!==32?null:(Eh=!0,bh);case"textInput":return t=n.data,t===bh&&Eh?null:t;default:return null}}function Vm(t,n){if(Hn)return t==="compositionend"||!vl&&kh(t,n)?(t=vh(),Zs=dl=Br=null,Hn=!1,t):null;switch(t){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 xh&&n.locale!=="ko"?null:n.data;default:return null}}var qm={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Rh(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!qm[t.type]:n==="textarea"}function Dh(t,n,s,g){Bs(g),n=ao(n,"onChange"),0<n.length&&(s=new fl("onChange","change",null,s,g),t.push({event:s,listeners:n}))}var Fi=null,ji=null;function Km(t){Kh(t,0)}function no(t){var n=Wn(t);if(le(n))return t}function Xm(t,n){if(t==="change")return n}var Ah=!1;if(a){var yl;if(a){var wl="oninput"in document;if(!wl){var Th=document.createElement("div");Th.setAttribute("oninput","return;"),wl=typeof Th.oninput=="function"}yl=wl}else yl=!1;Ah=yl&&(!document.documentMode||9<document.documentMode)}function Mh(){Fi&&(Fi.detachEvent("onpropertychange",Ph),ji=Fi=null)}function Ph(t){if(t.propertyName==="value"&&no(ji)){var n=[];Dh(n,ji,t,Si(t)),Fs(Km,n)}}function Ym(t,n,s){t==="focusin"?(Mh(),Fi=n,ji=s,Fi.attachEvent("onpropertychange",Ph)):t==="focusout"&&Mh()}function Gm(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return no(ji)}function Qm(t,n){if(t==="click")return no(n)}function Jm(t,n){if(t==="input"||t==="change")return no(n)}function Zm(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var Ut=typeof Object.is=="function"?Object.is:Zm;function zi(t,n){if(Ut(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var s=Object.keys(t),g=Object.keys(n);if(s.length!==g.length)return!1;for(g=0;g<s.length;g++){var E=s[g];if(!l.call(n,E)||!Ut(t[E],n[E]))return!1}return!0}function Nh(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Bh(t,n){var s=Nh(t);t=0;for(var g;s;){if(s.nodeType===3){if(g=t+s.textContent.length,t<=n&&g>=n)return{node:s,offset:n-t};t=g}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Nh(s)}}function Ih(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?Ih(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function Oh(){for(var t=window,n=pe();n instanceof t.HTMLIFrameElement;){try{var s=typeof n.contentWindow.location.href=="string"}catch{s=!1}if(s)t=n.contentWindow;else break;n=pe(t.document)}return n}function Sl(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}function e0(t){var n=Oh(),s=t.focusedElem,g=t.selectionRange;if(n!==s&&s&&s.ownerDocument&&Ih(s.ownerDocument.documentElement,s)){if(g!==null&&Sl(s)){if(n=g.start,t=g.end,t===void 0&&(t=n),"selectionStart"in s)s.selectionStart=n,s.selectionEnd=Math.min(t,s.value.length);else if(t=(n=s.ownerDocument||document)&&n.defaultView||window,t.getSelection){t=t.getSelection();var E=s.textContent.length,A=Math.min(g.start,E);g=g.end===void 0?A:Math.min(g.end,E),!t.extend&&A>g&&(E=g,g=A,A=E),E=Bh(s,A);var $=Bh(s,g);E&&$&&(t.rangeCount!==1||t.anchorNode!==E.node||t.anchorOffset!==E.offset||t.focusNode!==$.node||t.focusOffset!==$.offset)&&(n=n.createRange(),n.setStart(E.node,E.offset),t.removeAllRanges(),A>g?(t.addRange(n),t.extend($.node,$.offset)):(n.setEnd($.node,$.offset),t.addRange(n)))}}for(n=[],t=s;t=t.parentNode;)t.nodeType===1&&n.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s<n.length;s++)t=n[s],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var t0=a&&"documentMode"in document&&11>=document.documentMode,Fn=null,Cl=null,$i=null,xl=!1;function Hh(t,n,s){var g=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;xl||Fn==null||Fn!==pe(g)||(g=Fn,"selectionStart"in g&&Sl(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),$i&&zi($i,g)||($i=g,g=ao(Cl,"onSelect"),0<g.length&&(n=new fl("onSelect","select",null,n,s),t.push({event:n,listeners:g}),n.target=Fn)))}function io(t,n){var s={};return s[t.toLowerCase()]=n.toLowerCase(),s["Webkit"+t]="webkit"+n,s["Moz"+t]="moz"+n,s}var jn={animationend:io("Animation","AnimationEnd"),animationiteration:io("Animation","AnimationIteration"),animationstart:io("Animation","AnimationStart"),transitionend:io("Transition","TransitionEnd")},bl={},Fh={};a&&(Fh=document.createElement("div").style,"AnimationEvent"in window||(delete jn.animationend.animation,delete jn.animationiteration.animation,delete jn.animationstart.animation),"TransitionEvent"in window||delete jn.transitionend.transition);function so(t){if(bl[t])return bl[t];if(!jn[t])return t;var n=jn[t],s;for(s in n)if(n.hasOwnProperty(s)&&s in Fh)return bl[t]=n[s];return t}var jh=so("animationend"),zh=so("animationiteration"),$h=so("animationstart"),Wh=so("transitionend"),Uh=new Map,Vh="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Ir(t,n){Uh.set(t,n),S(n,[t])}for(var El=0;El<Vh.length;El++){var kl=Vh[El],r0=kl.toLowerCase(),n0=kl[0].toUpperCase()+kl.slice(1);Ir(r0,"on"+n0)}Ir(jh,"onAnimationEnd"),Ir(zh,"onAnimationIteration"),Ir($h,"onAnimationStart"),Ir("dblclick","onDoubleClick"),Ir("focusin","onFocus"),Ir("focusout","onBlur"),Ir(Wh,"onTransitionEnd"),y("onMouseEnter",["mouseout","mouseover"]),y("onMouseLeave",["mouseout","mouseover"]),y("onPointerEnter",["pointerout","pointerover"]),y("onPointerLeave",["pointerout","pointerover"]),S("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),S("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),S("onBeforeInput",["compositionend","keypress","textInput","paste"]),S("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),S("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),S("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Wi="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(" "),i0=new Set("cancel close invalid load scroll toggle".split(" ").concat(Wi));function qh(t,n,s){var g=t.type||"unknown-event";t.currentTarget=s,Qa(g,n,void 0,t),t.currentTarget=null}function Kh(t,n){n=(n&4)!==0;for(var s=0;s<t.length;s++){var g=t[s],E=g.event;g=g.listeners;e:{var A=void 0;if(n)for(var $=g.length-1;0<=$;$--){var Y=g[$],Q=Y.instance,oe=Y.currentTarget;if(Y=Y.listener,Q!==A&&E.isPropagationStopped())break e;qh(E,Y,oe),A=Q}else for($=0;$<g.length;$++){if(Y=g[$],Q=Y.instance,oe=Y.currentTarget,Y=Y.listener,Q!==A&&E.isPropagationStopped())break e;qh(E,Y,oe),A=Q}}}if(An)throw t=Ei,An=!1,Ei=null,t}function Fe(t,n){var s=n[Nl];s===void 0&&(s=n[Nl]=new Set);var g=t+"__bubble";s.has(g)||(Xh(n,t,2,!1),s.add(g))}function Ll(t,n,s){var g=0;n&&(g|=4),Xh(s,t,g,n)}var oo="_reactListening"+Math.random().toString(36).slice(2);function Ui(t){if(!t[oo]){t[oo]=!0,o.forEach(function(s){s!=="selectionchange"&&(i0.has(s)||Ll(s,!1,t),Ll(s,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[oo]||(n[oo]=!0,Ll("selectionchange",!1,n))}}function Xh(t,n,s,g){switch(mh(n)){case 1:var E=vm;break;case 4:E=ym;break;default:E=ul}s=E.bind(null,n,s,t),E=void 0,!bi||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(E=!0),g?E!==void 0?t.addEventListener(n,s,{capture:!0,passive:E}):t.addEventListener(n,s,!0):E!==void 0?t.addEventListener(n,s,{passive:E}):t.addEventListener(n,s,!1)}function Rl(t,n,s,g,E){var A=g;if((n&1)===0&&(n&2)===0&&g!==null)e:for(;;){if(g===null)return;var $=g.tag;if($===3||$===4){var Y=g.stateNode.containerInfo;if(Y===E||Y.nodeType===8&&Y.parentNode===E)break;if($===4)for($=g.return;$!==null;){var Q=$.tag;if((Q===3||Q===4)&&(Q=$.stateNode.containerInfo,Q===E||Q.nodeType===8&&Q.parentNode===E))return;$=$.return}for(;Y!==null;){if($=ln(Y),$===null)return;if(Q=$.tag,Q===5||Q===6){g=A=$;continue e}Y=Y.parentNode}}g=g.return}Fs(function(){var oe=A,de=Si(s),fe=[];e:{var he=Uh.get(t);if(he!==void 0){var me=fl,ye=t;switch(t){case"keypress":if(eo(s)===0)break e;case"keydown":case"keyup":me=Nm;break;case"focusin":ye="focus",me=gl;break;case"focusout":ye="blur",me=gl;break;case"beforeblur":case"afterblur":me=gl;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":me=wh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":me=Cm;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":me=Om;break;case jh:case zh:case $h:me=Em;break;case Wh:me=Fm;break;case"scroll":me=wm;break;case"wheel":me=zm;break;case"copy":case"cut":case"paste":me=Lm;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":me=Ch}var we=(n&4)!==0,Ze=!we&&t==="scroll",ne=we?he!==null?he+"Capture":null:he;we=[];for(var ee=oe,se;ee!==null;){se=ee;var _e=se.stateNode;if(se.tag===5&&_e!==null&&(se=_e,ne!==null&&(_e=rn(ee,ne),_e!=null&&we.push(Vi(ee,_e,se)))),Ze)break;ee=ee.return}0<we.length&&(he=new me(he,ye,null,s,de),fe.push({event:he,listeners:we}))}}if((n&7)===0){e:{if(he=t==="mouseover"||t==="pointerover",me=t==="mouseout"||t==="pointerout",he&&s!==wi&&(ye=s.relatedTarget||s.fromElement)&&(ln(ye)||ye[_r]))break e;if((me||he)&&(he=de.window===de?de:(he=de.ownerDocument)?he.defaultView||he.parentWindow:window,me?(ye=s.relatedTarget||s.toElement,me=oe,ye=ye?ln(ye):null,ye!==null&&(Ze=rr(ye),ye!==Ze||ye.tag!==5&&ye.tag!==6)&&(ye=null)):(me=null,ye=oe),me!==ye)){if(we=wh,_e="onMouseLeave",ne="onMouseEnter",ee="mouse",(t==="pointerout"||t==="pointerover")&&(we=Ch,_e="onPointerLeave",ne="onPointerEnter",ee="pointer"),Ze=me==null?he:Wn(me),se=ye==null?he:Wn(ye),he=new we(_e,ee+"leave",me,s,de),he.target=Ze,he.relatedTarget=se,_e=null,ln(de)===oe&&(we=new we(ne,ee+"enter",ye,s,de),we.target=se,we.relatedTarget=Ze,_e=we),Ze=_e,me&&ye)t:{for(we=me,ne=ye,ee=0,se=we;se;se=zn(se))ee++;for(se=0,_e=ne;_e;_e=zn(_e))se++;for(;0<ee-se;)we=zn(we),ee--;for(;0<se-ee;)ne=zn(ne),se--;for(;ee--;){if(we===ne||ne!==null&&we===ne.alternate)break t;we=zn(we),ne=zn(ne)}we=null}else we=null;me!==null&&Yh(fe,he,me,we,!1),ye!==null&&Ze!==null&&Yh(fe,Ze,ye,we,!0)}}e:{if(he=oe?Wn(oe):window,me=he.nodeName&&he.nodeName.toLowerCase(),me==="select"||me==="input"&&he.type==="file")var Ce=Xm;else if(Rh(he))if(Ah)Ce=Jm;else{Ce=Gm;var Ee=Ym}else(me=he.nodeName)&&me.toLowerCase()==="input"&&(he.type==="checkbox"||he.type==="radio")&&(Ce=Qm);if(Ce&&(Ce=Ce(t,oe))){Dh(fe,Ce,s,de);break e}Ee&&Ee(t,he,oe),t==="focusout"&&(Ee=he._wrapperState)&&Ee.controlled&&he.type==="number"&&Ie(he,"number",he.value)}switch(Ee=oe?Wn(oe):window,t){case"focusin":(Rh(Ee)||Ee.contentEditable==="true")&&(Fn=Ee,Cl=oe,$i=null);break;case"focusout":$i=Cl=Fn=null;break;case"mousedown":xl=!0;break;case"contextmenu":case"mouseup":case"dragend":xl=!1,Hh(fe,s,de);break;case"selectionchange":if(t0)break;case"keydown":case"keyup":Hh(fe,s,de)}var ke;if(vl)e:{switch(t){case"compositionstart":var Le="onCompositionStart";break e;case"compositionend":Le="onCompositionEnd";break e;case"compositionupdate":Le="onCompositionUpdate";break e}Le=void 0}else Hn?kh(t,s)&&(Le="onCompositionEnd"):t==="keydown"&&s.keyCode===229&&(Le="onCompositionStart");Le&&(xh&&s.locale!=="ko"&&(Hn||Le!=="onCompositionStart"?Le==="onCompositionEnd"&&Hn&&(ke=vh()):(Br=de,dl="value"in Br?Br.value:Br.textContent,Hn=!0)),Ee=ao(oe,Le),0<Ee.length&&(Le=new Sh(Le,t,null,s,de),fe.push({event:Le,listeners:Ee}),ke?Le.data=ke:(ke=Lh(s),ke!==null&&(Le.data=ke)))),(ke=Wm?Um(t,s):Vm(t,s))&&(oe=ao(oe,"onBeforeInput"),0<oe.length&&(de=new Sh("onBeforeInput","beforeinput",null,s,de),fe.push({event:de,listeners:oe}),de.data=ke))}Kh(fe,n)})}function Vi(t,n,s){return{instance:t,listener:n,currentTarget:s}}function ao(t,n){for(var s=n+"Capture",g=[];t!==null;){var E=t,A=E.stateNode;E.tag===5&&A!==null&&(E=A,A=rn(t,s),A!=null&&g.unshift(Vi(t,A,E)),A=rn(t,n),A!=null&&g.push(Vi(t,A,E))),t=t.return}return g}function zn(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Yh(t,n,s,g,E){for(var A=n._reactName,$=[];s!==null&&s!==g;){var Y=s,Q=Y.alternate,oe=Y.stateNode;if(Q!==null&&Q===g)break;Y.tag===5&&oe!==null&&(Y=oe,E?(Q=rn(s,A),Q!=null&&$.unshift(Vi(s,Q,Y))):E||(Q=rn(s,A),Q!=null&&$.push(Vi(s,Q,Y)))),s=s.return}$.length!==0&&t.push({event:n,listeners:$})}var s0=/\r\n?/g,o0=/\u0000|\uFFFD/g;function Gh(t){return(typeof t=="string"?t:""+t).replace(s0,`
38
- `).replace(o0,"")}function lo(t,n,s){if(n=Gh(n),Gh(t)!==n&&s)throw Error(i(425))}function co(){}var Dl=null,Al=null;function Tl(t,n){return t==="textarea"||t==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Ml=typeof setTimeout=="function"?setTimeout:void 0,a0=typeof clearTimeout=="function"?clearTimeout:void 0,Qh=typeof Promise=="function"?Promise:void 0,l0=typeof queueMicrotask=="function"?queueMicrotask:typeof Qh<"u"?function(t){return Qh.resolve(null).then(t).catch(c0)}:Ml;function c0(t){setTimeout(function(){throw t})}function Pl(t,n){var s=n,g=0;do{var E=s.nextSibling;if(t.removeChild(s),E&&E.nodeType===8)if(s=E.data,s==="/$"){if(g===0){t.removeChild(E),Bi(n);return}g--}else s!=="$"&&s!=="$?"&&s!=="$!"||g++;s=E}while(s);Bi(n)}function Or(t){for(;t!=null;t=t.nextSibling){var n=t.nodeType;if(n===1||n===3)break;if(n===8){if(n=t.data,n==="$"||n==="$!"||n==="$?")break;if(n==="/$")return null}}return t}function Jh(t){t=t.previousSibling;for(var n=0;t;){if(t.nodeType===8){var s=t.data;if(s==="$"||s==="$!"||s==="$?"){if(n===0)return t;n--}else s==="/$"&&n++}t=t.previousSibling}return null}var $n=Math.random().toString(36).slice(2),ir="__reactFiber$"+$n,qi="__reactProps$"+$n,_r="__reactContainer$"+$n,Nl="__reactEvents$"+$n,u0="__reactListeners$"+$n,h0="__reactHandles$"+$n;function ln(t){var n=t[ir];if(n)return n;for(var s=t.parentNode;s;){if(n=s[_r]||s[ir]){if(s=n.alternate,n.child!==null||s!==null&&s.child!==null)for(t=Jh(t);t!==null;){if(s=t[ir])return s;t=Jh(t)}return n}t=s,s=t.parentNode}return null}function Ki(t){return t=t[ir]||t[_r],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Wn(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(i(33))}function uo(t){return t[qi]||null}var Bl=[],Un=-1;function Hr(t){return{current:t}}function je(t){0>Un||(t.current=Bl[Un],Bl[Un]=null,Un--)}function He(t,n){Un++,Bl[Un]=t.current,t.current=n}var Fr={},_t=Hr(Fr),St=Hr(!1),cn=Fr;function Vn(t,n){var s=t.type.contextTypes;if(!s)return Fr;var g=t.stateNode;if(g&&g.__reactInternalMemoizedUnmaskedChildContext===n)return g.__reactInternalMemoizedMaskedChildContext;var E={},A;for(A in s)E[A]=n[A];return g&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=n,t.__reactInternalMemoizedMaskedChildContext=E),E}function Ct(t){return t=t.childContextTypes,t!=null}function ho(){je(St),je(_t)}function Zh(t,n,s){if(_t.current!==Fr)throw Error(i(168));He(_t,n),He(St,s)}function ed(t,n,s){var g=t.stateNode;if(n=n.childContextTypes,typeof g.getChildContext!="function")return s;g=g.getChildContext();for(var E in g)if(!(E in n))throw Error(i(108,X(t)||"Unknown",E));return B({},s,g)}function fo(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Fr,cn=_t.current,He(_t,t),He(St,St.current),!0}function td(t,n,s){var g=t.stateNode;if(!g)throw Error(i(169));s?(t=ed(t,n,cn),g.__reactInternalMemoizedMergedChildContext=t,je(St),je(_t),He(_t,t)):je(St),He(St,s)}var gr=null,po=!1,Il=!1;function rd(t){gr===null?gr=[t]:gr.push(t)}function d0(t){po=!0,rd(t)}function jr(){if(!Il&&gr!==null){Il=!0;var t=0,n=Be;try{var s=gr;for(Be=1;t<s.length;t++){var g=s[t];do g=g(!0);while(g!==null)}gr=null,po=!1}catch(E){throw gr!==null&&(gr=gr.slice(t+1)),$s(Ri,jr),E}finally{Be=n,Il=!1}}return null}var qn=[],Kn=0,_o=null,go=0,Ot=[],Ht=0,un=null,mr=1,vr="";function hn(t,n){qn[Kn++]=go,qn[Kn++]=_o,_o=t,go=n}function nd(t,n,s){Ot[Ht++]=mr,Ot[Ht++]=vr,Ot[Ht++]=un,un=t;var g=mr;t=vr;var E=32-Dt(g)-1;g&=~(1<<E),s+=1;var A=32-Dt(n)+E;if(30<A){var $=E-E%5;A=(g&(1<<$)-1).toString(32),g>>=$,E-=$,mr=1<<32-Dt(n)+E|s<<E|g,vr=A+t}else mr=1<<A|s<<E|g,vr=t}function Ol(t){t.return!==null&&(hn(t,1),nd(t,1,0))}function Hl(t){for(;t===_o;)_o=qn[--Kn],qn[Kn]=null,go=qn[--Kn],qn[Kn]=null;for(;t===un;)un=Ot[--Ht],Ot[Ht]=null,vr=Ot[--Ht],Ot[Ht]=null,mr=Ot[--Ht],Ot[Ht]=null}var Tt=null,Mt=null,We=!1,Vt=null;function id(t,n){var s=$t(5,null,null,0);s.elementType="DELETED",s.stateNode=n,s.return=t,n=t.deletions,n===null?(t.deletions=[s],t.flags|=16):n.push(s)}function sd(t,n){switch(t.tag){case 5:var s=t.type;return n=n.nodeType!==1||s.toLowerCase()!==n.nodeName.toLowerCase()?null:n,n!==null?(t.stateNode=n,Tt=t,Mt=Or(n.firstChild),!0):!1;case 6:return n=t.pendingProps===""||n.nodeType!==3?null:n,n!==null?(t.stateNode=n,Tt=t,Mt=null,!0):!1;case 13:return n=n.nodeType!==8?null:n,n!==null?(s=un!==null?{id:mr,overflow:vr}:null,t.memoizedState={dehydrated:n,treeContext:s,retryLane:1073741824},s=$t(18,null,null,0),s.stateNode=n,s.return=t,t.child=s,Tt=t,Mt=null,!0):!1;default:return!1}}function Fl(t){return(t.mode&1)!==0&&(t.flags&128)===0}function jl(t){if(We){var n=Mt;if(n){var s=n;if(!sd(t,n)){if(Fl(t))throw Error(i(418));n=Or(s.nextSibling);var g=Tt;n&&sd(t,n)?id(g,s):(t.flags=t.flags&-4097|2,We=!1,Tt=t)}}else{if(Fl(t))throw Error(i(418));t.flags=t.flags&-4097|2,We=!1,Tt=t}}}function od(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Tt=t}function mo(t){if(t!==Tt)return!1;if(!We)return od(t),We=!0,!1;var n;if((n=t.tag!==3)&&!(n=t.tag!==5)&&(n=t.type,n=n!=="head"&&n!=="body"&&!Tl(t.type,t.memoizedProps)),n&&(n=Mt)){if(Fl(t))throw ad(),Error(i(418));for(;n;)id(t,n),n=Or(n.nextSibling)}if(od(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));e:{for(t=t.nextSibling,n=0;t;){if(t.nodeType===8){var s=t.data;if(s==="/$"){if(n===0){Mt=Or(t.nextSibling);break e}n--}else s!=="$"&&s!=="$!"&&s!=="$?"||n++}t=t.nextSibling}Mt=null}}else Mt=Tt?Or(t.stateNode.nextSibling):null;return!0}function ad(){for(var t=Mt;t;)t=Or(t.nextSibling)}function Xn(){Mt=Tt=null,We=!1}function zl(t){Vt===null?Vt=[t]:Vt.push(t)}var f0=w.ReactCurrentBatchConfig;function Xi(t,n,s){if(t=s.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(s._owner){if(s=s._owner,s){if(s.tag!==1)throw Error(i(309));var g=s.stateNode}if(!g)throw Error(i(147,t));var E=g,A=""+t;return n!==null&&n.ref!==null&&typeof n.ref=="function"&&n.ref._stringRef===A?n.ref:(n=function($){var Y=E.refs;$===null?delete Y[A]:Y[A]=$},n._stringRef=A,n)}if(typeof t!="string")throw Error(i(284));if(!s._owner)throw Error(i(290,t))}return t}function vo(t,n){throw t=Object.prototype.toString.call(n),Error(i(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t))}function ld(t){var n=t._init;return n(t._payload)}function cd(t){function n(ne,ee){if(t){var se=ne.deletions;se===null?(ne.deletions=[ee],ne.flags|=16):se.push(ee)}}function s(ne,ee){if(!t)return null;for(;ee!==null;)n(ne,ee),ee=ee.sibling;return null}function g(ne,ee){for(ne=new Map;ee!==null;)ee.key!==null?ne.set(ee.key,ee):ne.set(ee.index,ee),ee=ee.sibling;return ne}function E(ne,ee){return ne=Xr(ne,ee),ne.index=0,ne.sibling=null,ne}function A(ne,ee,se){return ne.index=se,t?(se=ne.alternate,se!==null?(se=se.index,se<ee?(ne.flags|=2,ee):se):(ne.flags|=2,ee)):(ne.flags|=1048576,ee)}function $(ne){return t&&ne.alternate===null&&(ne.flags|=2),ne}function Y(ne,ee,se,_e){return ee===null||ee.tag!==6?(ee=Mc(se,ne.mode,_e),ee.return=ne,ee):(ee=E(ee,se),ee.return=ne,ee)}function Q(ne,ee,se,_e){var Ce=se.type;return Ce===D?de(ne,ee,se.props.children,_e,se.key):ee!==null&&(ee.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===U&&ld(Ce)===ee.type)?(_e=E(ee,se.props),_e.ref=Xi(ne,ee,se),_e.return=ne,_e):(_e=$o(se.type,se.key,se.props,null,ne.mode,_e),_e.ref=Xi(ne,ee,se),_e.return=ne,_e)}function oe(ne,ee,se,_e){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==se.containerInfo||ee.stateNode.implementation!==se.implementation?(ee=Pc(se,ne.mode,_e),ee.return=ne,ee):(ee=E(ee,se.children||[]),ee.return=ne,ee)}function de(ne,ee,se,_e,Ce){return ee===null||ee.tag!==7?(ee=yn(se,ne.mode,_e,Ce),ee.return=ne,ee):(ee=E(ee,se),ee.return=ne,ee)}function fe(ne,ee,se){if(typeof ee=="string"&&ee!==""||typeof ee=="number")return ee=Mc(""+ee,ne.mode,se),ee.return=ne,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case L:return se=$o(ee.type,ee.key,ee.props,null,ne.mode,se),se.ref=Xi(ne,null,ee),se.return=ne,se;case R:return ee=Pc(ee,ne.mode,se),ee.return=ne,ee;case U:var _e=ee._init;return fe(ne,_e(ee._payload),se)}if(ze(ee)||T(ee))return ee=yn(ee,ne.mode,se,null),ee.return=ne,ee;vo(ne,ee)}return null}function he(ne,ee,se,_e){var Ce=ee!==null?ee.key:null;if(typeof se=="string"&&se!==""||typeof se=="number")return Ce!==null?null:Y(ne,ee,""+se,_e);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case L:return se.key===Ce?Q(ne,ee,se,_e):null;case R:return se.key===Ce?oe(ne,ee,se,_e):null;case U:return Ce=se._init,he(ne,ee,Ce(se._payload),_e)}if(ze(se)||T(se))return Ce!==null?null:de(ne,ee,se,_e,null);vo(ne,se)}return null}function me(ne,ee,se,_e,Ce){if(typeof _e=="string"&&_e!==""||typeof _e=="number")return ne=ne.get(se)||null,Y(ee,ne,""+_e,Ce);if(typeof _e=="object"&&_e!==null){switch(_e.$$typeof){case L:return ne=ne.get(_e.key===null?se:_e.key)||null,Q(ee,ne,_e,Ce);case R:return ne=ne.get(_e.key===null?se:_e.key)||null,oe(ee,ne,_e,Ce);case U:var Ee=_e._init;return me(ne,ee,se,Ee(_e._payload),Ce)}if(ze(_e)||T(_e))return ne=ne.get(se)||null,de(ee,ne,_e,Ce,null);vo(ee,_e)}return null}function ye(ne,ee,se,_e){for(var Ce=null,Ee=null,ke=ee,Le=ee=0,ct=null;ke!==null&&Le<se.length;Le++){ke.index>Le?(ct=ke,ke=null):ct=ke.sibling;var Pe=he(ne,ke,se[Le],_e);if(Pe===null){ke===null&&(ke=ct);break}t&&ke&&Pe.alternate===null&&n(ne,ke),ee=A(Pe,ee,Le),Ee===null?Ce=Pe:Ee.sibling=Pe,Ee=Pe,ke=ct}if(Le===se.length)return s(ne,ke),We&&hn(ne,Le),Ce;if(ke===null){for(;Le<se.length;Le++)ke=fe(ne,se[Le],_e),ke!==null&&(ee=A(ke,ee,Le),Ee===null?Ce=ke:Ee.sibling=ke,Ee=ke);return We&&hn(ne,Le),Ce}for(ke=g(ne,ke);Le<se.length;Le++)ct=me(ke,ne,Le,se[Le],_e),ct!==null&&(t&&ct.alternate!==null&&ke.delete(ct.key===null?Le:ct.key),ee=A(ct,ee,Le),Ee===null?Ce=ct:Ee.sibling=ct,Ee=ct);return t&&ke.forEach(function(Yr){return n(ne,Yr)}),We&&hn(ne,Le),Ce}function we(ne,ee,se,_e){var Ce=T(se);if(typeof Ce!="function")throw Error(i(150));if(se=Ce.call(se),se==null)throw Error(i(151));for(var Ee=Ce=null,ke=ee,Le=ee=0,ct=null,Pe=se.next();ke!==null&&!Pe.done;Le++,Pe=se.next()){ke.index>Le?(ct=ke,ke=null):ct=ke.sibling;var Yr=he(ne,ke,Pe.value,_e);if(Yr===null){ke===null&&(ke=ct);break}t&&ke&&Yr.alternate===null&&n(ne,ke),ee=A(Yr,ee,Le),Ee===null?Ce=Yr:Ee.sibling=Yr,Ee=Yr,ke=ct}if(Pe.done)return s(ne,ke),We&&hn(ne,Le),Ce;if(ke===null){for(;!Pe.done;Le++,Pe=se.next())Pe=fe(ne,Pe.value,_e),Pe!==null&&(ee=A(Pe,ee,Le),Ee===null?Ce=Pe:Ee.sibling=Pe,Ee=Pe);return We&&hn(ne,Le),Ce}for(ke=g(ne,ke);!Pe.done;Le++,Pe=se.next())Pe=me(ke,ne,Le,Pe.value,_e),Pe!==null&&(t&&Pe.alternate!==null&&ke.delete(Pe.key===null?Le:Pe.key),ee=A(Pe,ee,Le),Ee===null?Ce=Pe:Ee.sibling=Pe,Ee=Pe);return t&&ke.forEach(function(q0){return n(ne,q0)}),We&&hn(ne,Le),Ce}function Ze(ne,ee,se,_e){if(typeof se=="object"&&se!==null&&se.type===D&&se.key===null&&(se=se.props.children),typeof se=="object"&&se!==null){switch(se.$$typeof){case L:e:{for(var Ce=se.key,Ee=ee;Ee!==null;){if(Ee.key===Ce){if(Ce=se.type,Ce===D){if(Ee.tag===7){s(ne,Ee.sibling),ee=E(Ee,se.props.children),ee.return=ne,ne=ee;break e}}else if(Ee.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===U&&ld(Ce)===Ee.type){s(ne,Ee.sibling),ee=E(Ee,se.props),ee.ref=Xi(ne,Ee,se),ee.return=ne,ne=ee;break e}s(ne,Ee);break}else n(ne,Ee);Ee=Ee.sibling}se.type===D?(ee=yn(se.props.children,ne.mode,_e,se.key),ee.return=ne,ne=ee):(_e=$o(se.type,se.key,se.props,null,ne.mode,_e),_e.ref=Xi(ne,ee,se),_e.return=ne,ne=_e)}return $(ne);case R:e:{for(Ee=se.key;ee!==null;){if(ee.key===Ee)if(ee.tag===4&&ee.stateNode.containerInfo===se.containerInfo&&ee.stateNode.implementation===se.implementation){s(ne,ee.sibling),ee=E(ee,se.children||[]),ee.return=ne,ne=ee;break e}else{s(ne,ee);break}else n(ne,ee);ee=ee.sibling}ee=Pc(se,ne.mode,_e),ee.return=ne,ne=ee}return $(ne);case U:return Ee=se._init,Ze(ne,ee,Ee(se._payload),_e)}if(ze(se))return ye(ne,ee,se,_e);if(T(se))return we(ne,ee,se,_e);vo(ne,se)}return typeof se=="string"&&se!==""||typeof se=="number"?(se=""+se,ee!==null&&ee.tag===6?(s(ne,ee.sibling),ee=E(ee,se),ee.return=ne,ne=ee):(s(ne,ee),ee=Mc(se,ne.mode,_e),ee.return=ne,ne=ee),$(ne)):s(ne,ee)}return Ze}var Yn=cd(!0),ud=cd(!1),yo=Hr(null),wo=null,Gn=null,$l=null;function Wl(){$l=Gn=wo=null}function Ul(t){var n=yo.current;je(yo),t._currentValue=n}function Vl(t,n,s){for(;t!==null;){var g=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,g!==null&&(g.childLanes|=n)):g!==null&&(g.childLanes&n)!==n&&(g.childLanes|=n),t===s)break;t=t.return}}function Qn(t,n){wo=t,$l=Gn=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&n)!==0&&(xt=!0),t.firstContext=null)}function Ft(t){var n=t._currentValue;if($l!==t)if(t={context:t,memoizedValue:n,next:null},Gn===null){if(wo===null)throw Error(i(308));Gn=t,wo.dependencies={lanes:0,firstContext:t}}else Gn=Gn.next=t;return n}var dn=null;function ql(t){dn===null?dn=[t]:dn.push(t)}function hd(t,n,s,g){var E=n.interleaved;return E===null?(s.next=s,ql(n)):(s.next=E.next,E.next=s),n.interleaved=s,yr(t,g)}function yr(t,n){t.lanes|=n;var s=t.alternate;for(s!==null&&(s.lanes|=n),s=t,t=t.return;t!==null;)t.childLanes|=n,s=t.alternate,s!==null&&(s.childLanes|=n),s=t,t=t.return;return s.tag===3?s.stateNode:null}var zr=!1;function Kl(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function dd(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function wr(t,n){return{eventTime:t,lane:n,tag:0,payload:null,callback:null,next:null}}function $r(t,n,s){var g=t.updateQueue;if(g===null)return null;if(g=g.shared,(Me&2)!==0){var E=g.pending;return E===null?n.next=n:(n.next=E.next,E.next=n),g.pending=n,yr(t,s)}return E=g.interleaved,E===null?(n.next=n,ql(g)):(n.next=E.next,E.next=n),g.interleaved=n,yr(t,s)}function So(t,n,s){if(n=n.updateQueue,n!==null&&(n=n.shared,(s&4194240)!==0)){var g=n.lanes;g&=t.pendingLanes,s|=g,n.lanes=s,al(t,s)}}function fd(t,n){var s=t.updateQueue,g=t.alternate;if(g!==null&&(g=g.updateQueue,s===g)){var E=null,A=null;if(s=s.firstBaseUpdate,s!==null){do{var $={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};A===null?E=A=$:A=A.next=$,s=s.next}while(s!==null);A===null?E=A=n:A=A.next=n}else E=A=n;s={baseState:g.baseState,firstBaseUpdate:E,lastBaseUpdate:A,shared:g.shared,effects:g.effects},t.updateQueue=s;return}t=s.lastBaseUpdate,t===null?s.firstBaseUpdate=n:t.next=n,s.lastBaseUpdate=n}function Co(t,n,s,g){var E=t.updateQueue;zr=!1;var A=E.firstBaseUpdate,$=E.lastBaseUpdate,Y=E.shared.pending;if(Y!==null){E.shared.pending=null;var Q=Y,oe=Q.next;Q.next=null,$===null?A=oe:$.next=oe,$=Q;var de=t.alternate;de!==null&&(de=de.updateQueue,Y=de.lastBaseUpdate,Y!==$&&(Y===null?de.firstBaseUpdate=oe:Y.next=oe,de.lastBaseUpdate=Q))}if(A!==null){var fe=E.baseState;$=0,de=oe=Q=null,Y=A;do{var he=Y.lane,me=Y.eventTime;if((g&he)===he){de!==null&&(de=de.next={eventTime:me,lane:0,tag:Y.tag,payload:Y.payload,callback:Y.callback,next:null});e:{var ye=t,we=Y;switch(he=n,me=s,we.tag){case 1:if(ye=we.payload,typeof ye=="function"){fe=ye.call(me,fe,he);break e}fe=ye;break e;case 3:ye.flags=ye.flags&-65537|128;case 0:if(ye=we.payload,he=typeof ye=="function"?ye.call(me,fe,he):ye,he==null)break e;fe=B({},fe,he);break e;case 2:zr=!0}}Y.callback!==null&&Y.lane!==0&&(t.flags|=64,he=E.effects,he===null?E.effects=[Y]:he.push(Y))}else me={eventTime:me,lane:he,tag:Y.tag,payload:Y.payload,callback:Y.callback,next:null},de===null?(oe=de=me,Q=fe):de=de.next=me,$|=he;if(Y=Y.next,Y===null){if(Y=E.shared.pending,Y===null)break;he=Y,Y=he.next,he.next=null,E.lastBaseUpdate=he,E.shared.pending=null}}while(!0);if(de===null&&(Q=fe),E.baseState=Q,E.firstBaseUpdate=oe,E.lastBaseUpdate=de,n=E.shared.interleaved,n!==null){E=n;do $|=E.lane,E=E.next;while(E!==n)}else A===null&&(E.shared.lanes=0);_n|=$,t.lanes=$,t.memoizedState=fe}}function pd(t,n,s){if(t=n.effects,n.effects=null,t!==null)for(n=0;n<t.length;n++){var g=t[n],E=g.callback;if(E!==null){if(g.callback=null,g=s,typeof E!="function")throw Error(i(191,E));E.call(g)}}}var Yi={},sr=Hr(Yi),Gi=Hr(Yi),Qi=Hr(Yi);function fn(t){if(t===Yi)throw Error(i(174));return t}function Xl(t,n){switch(He(Qi,n),He(Gi,t),He(sr,Yi),t=n.nodeType,t){case 9:case 11:n=(n=n.documentElement)?n.namespaceURI:ht(null,"");break;default:t=t===8?n.parentNode:n,n=t.namespaceURI||null,t=t.tagName,n=ht(n,t)}je(sr),He(sr,n)}function Jn(){je(sr),je(Gi),je(Qi)}function _d(t){fn(Qi.current);var n=fn(sr.current),s=ht(n,t.type);n!==s&&(He(Gi,t),He(sr,s))}function Yl(t){Gi.current===t&&(je(sr),je(Gi))}var Xe=Hr(0);function xo(t){for(var n=t;n!==null;){if(n.tag===13){var s=n.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||s.data==="$?"||s.data==="$!"))return n}else if(n.tag===19&&n.memoizedProps.revealOrder!==void 0){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Gl=[];function Ql(){for(var t=0;t<Gl.length;t++)Gl[t]._workInProgressVersionPrimary=null;Gl.length=0}var bo=w.ReactCurrentDispatcher,Jl=w.ReactCurrentBatchConfig,pn=0,Ye=null,nt=null,at=null,Eo=!1,Ji=!1,Zi=0,p0=0;function gt(){throw Error(i(321))}function Zl(t,n){if(n===null)return!1;for(var s=0;s<n.length&&s<t.length;s++)if(!Ut(t[s],n[s]))return!1;return!0}function ec(t,n,s,g,E,A){if(pn=A,Ye=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,bo.current=t===null||t.memoizedState===null?v0:y0,t=s(g,E),Ji){A=0;do{if(Ji=!1,Zi=0,25<=A)throw Error(i(301));A+=1,at=nt=null,n.updateQueue=null,bo.current=w0,t=s(g,E)}while(Ji)}if(bo.current=Ro,n=nt!==null&&nt.next!==null,pn=0,at=nt=Ye=null,Eo=!1,n)throw Error(i(300));return t}function tc(){var t=Zi!==0;return Zi=0,t}function or(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return at===null?Ye.memoizedState=at=t:at=at.next=t,at}function jt(){if(nt===null){var t=Ye.alternate;t=t!==null?t.memoizedState:null}else t=nt.next;var n=at===null?Ye.memoizedState:at.next;if(n!==null)at=n,nt=t;else{if(t===null)throw Error(i(310));nt=t,t={memoizedState:nt.memoizedState,baseState:nt.baseState,baseQueue:nt.baseQueue,queue:nt.queue,next:null},at===null?Ye.memoizedState=at=t:at=at.next=t}return at}function es(t,n){return typeof n=="function"?n(t):n}function rc(t){var n=jt(),s=n.queue;if(s===null)throw Error(i(311));s.lastRenderedReducer=t;var g=nt,E=g.baseQueue,A=s.pending;if(A!==null){if(E!==null){var $=E.next;E.next=A.next,A.next=$}g.baseQueue=E=A,s.pending=null}if(E!==null){A=E.next,g=g.baseState;var Y=$=null,Q=null,oe=A;do{var de=oe.lane;if((pn&de)===de)Q!==null&&(Q=Q.next={lane:0,action:oe.action,hasEagerState:oe.hasEagerState,eagerState:oe.eagerState,next:null}),g=oe.hasEagerState?oe.eagerState:t(g,oe.action);else{var fe={lane:de,action:oe.action,hasEagerState:oe.hasEagerState,eagerState:oe.eagerState,next:null};Q===null?(Y=Q=fe,$=g):Q=Q.next=fe,Ye.lanes|=de,_n|=de}oe=oe.next}while(oe!==null&&oe!==A);Q===null?$=g:Q.next=Y,Ut(g,n.memoizedState)||(xt=!0),n.memoizedState=g,n.baseState=$,n.baseQueue=Q,s.lastRenderedState=g}if(t=s.interleaved,t!==null){E=t;do A=E.lane,Ye.lanes|=A,_n|=A,E=E.next;while(E!==t)}else E===null&&(s.lanes=0);return[n.memoizedState,s.dispatch]}function nc(t){var n=jt(),s=n.queue;if(s===null)throw Error(i(311));s.lastRenderedReducer=t;var g=s.dispatch,E=s.pending,A=n.memoizedState;if(E!==null){s.pending=null;var $=E=E.next;do A=t(A,$.action),$=$.next;while($!==E);Ut(A,n.memoizedState)||(xt=!0),n.memoizedState=A,n.baseQueue===null&&(n.baseState=A),s.lastRenderedState=A}return[A,g]}function gd(){}function md(t,n){var s=Ye,g=jt(),E=n(),A=!Ut(g.memoizedState,E);if(A&&(g.memoizedState=E,xt=!0),g=g.queue,ic(wd.bind(null,s,g,t),[t]),g.getSnapshot!==n||A||at!==null&&at.memoizedState.tag&1){if(s.flags|=2048,ts(9,yd.bind(null,s,g,E,n),void 0,null),lt===null)throw Error(i(349));(pn&30)!==0||vd(s,n,E)}return E}function vd(t,n,s){t.flags|=16384,t={getSnapshot:n,value:s},n=Ye.updateQueue,n===null?(n={lastEffect:null,stores:null},Ye.updateQueue=n,n.stores=[t]):(s=n.stores,s===null?n.stores=[t]:s.push(t))}function yd(t,n,s,g){n.value=s,n.getSnapshot=g,Sd(n)&&Cd(t)}function wd(t,n,s){return s(function(){Sd(n)&&Cd(t)})}function Sd(t){var n=t.getSnapshot;t=t.value;try{var s=n();return!Ut(t,s)}catch{return!0}}function Cd(t){var n=yr(t,1);n!==null&&Yt(n,t,1,-1)}function xd(t){var n=or();return typeof t=="function"&&(t=t()),n.memoizedState=n.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:es,lastRenderedState:t},n.queue=t,t=t.dispatch=m0.bind(null,Ye,t),[n.memoizedState,t]}function ts(t,n,s,g){return t={tag:t,create:n,destroy:s,deps:g,next:null},n=Ye.updateQueue,n===null?(n={lastEffect:null,stores:null},Ye.updateQueue=n,n.lastEffect=t.next=t):(s=n.lastEffect,s===null?n.lastEffect=t.next=t:(g=s.next,s.next=t,t.next=g,n.lastEffect=t)),t}function bd(){return jt().memoizedState}function ko(t,n,s,g){var E=or();Ye.flags|=t,E.memoizedState=ts(1|n,s,void 0,g===void 0?null:g)}function Lo(t,n,s,g){var E=jt();g=g===void 0?null:g;var A=void 0;if(nt!==null){var $=nt.memoizedState;if(A=$.destroy,g!==null&&Zl(g,$.deps)){E.memoizedState=ts(n,s,A,g);return}}Ye.flags|=t,E.memoizedState=ts(1|n,s,A,g)}function Ed(t,n){return ko(8390656,8,t,n)}function ic(t,n){return Lo(2048,8,t,n)}function kd(t,n){return Lo(4,2,t,n)}function Ld(t,n){return Lo(4,4,t,n)}function Rd(t,n){if(typeof n=="function")return t=t(),n(t),function(){n(null)};if(n!=null)return t=t(),n.current=t,function(){n.current=null}}function Dd(t,n,s){return s=s!=null?s.concat([t]):null,Lo(4,4,Rd.bind(null,n,t),s)}function sc(){}function Ad(t,n){var s=jt();n=n===void 0?null:n;var g=s.memoizedState;return g!==null&&n!==null&&Zl(n,g[1])?g[0]:(s.memoizedState=[t,n],t)}function Td(t,n){var s=jt();n=n===void 0?null:n;var g=s.memoizedState;return g!==null&&n!==null&&Zl(n,g[1])?g[0]:(t=t(),s.memoizedState=[t,n],t)}function Md(t,n,s){return(pn&21)===0?(t.baseState&&(t.baseState=!1,xt=!0),t.memoizedState=s):(Ut(s,n)||(s=Bn(),Ye.lanes|=s,_n|=s,t.baseState=!0),n)}function _0(t,n){var s=Be;Be=s!==0&&4>s?s:4,t(!0);var g=Jl.transition;Jl.transition={};try{t(!1),n()}finally{Be=s,Jl.transition=g}}function Pd(){return jt().memoizedState}function g0(t,n,s){var g=qr(t);if(s={lane:g,action:s,hasEagerState:!1,eagerState:null,next:null},Nd(t))Bd(n,s);else if(s=hd(t,n,s,g),s!==null){var E=wt();Yt(s,t,g,E),Id(s,n,g)}}function m0(t,n,s){var g=qr(t),E={lane:g,action:s,hasEagerState:!1,eagerState:null,next:null};if(Nd(t))Bd(n,E);else{var A=t.alternate;if(t.lanes===0&&(A===null||A.lanes===0)&&(A=n.lastRenderedReducer,A!==null))try{var $=n.lastRenderedState,Y=A($,s);if(E.hasEagerState=!0,E.eagerState=Y,Ut(Y,$)){var Q=n.interleaved;Q===null?(E.next=E,ql(n)):(E.next=Q.next,Q.next=E),n.interleaved=E;return}}catch{}finally{}s=hd(t,n,E,g),s!==null&&(E=wt(),Yt(s,t,g,E),Id(s,n,g))}}function Nd(t){var n=t.alternate;return t===Ye||n!==null&&n===Ye}function Bd(t,n){Ji=Eo=!0;var s=t.pending;s===null?n.next=n:(n.next=s.next,s.next=n),t.pending=n}function Id(t,n,s){if((s&4194240)!==0){var g=n.lanes;g&=t.pendingLanes,s|=g,n.lanes=s,al(t,s)}}var Ro={readContext:Ft,useCallback:gt,useContext:gt,useEffect:gt,useImperativeHandle:gt,useInsertionEffect:gt,useLayoutEffect:gt,useMemo:gt,useReducer:gt,useRef:gt,useState:gt,useDebugValue:gt,useDeferredValue:gt,useTransition:gt,useMutableSource:gt,useSyncExternalStore:gt,useId:gt,unstable_isNewReconciler:!1},v0={readContext:Ft,useCallback:function(t,n){return or().memoizedState=[t,n===void 0?null:n],t},useContext:Ft,useEffect:Ed,useImperativeHandle:function(t,n,s){return s=s!=null?s.concat([t]):null,ko(4194308,4,Rd.bind(null,n,t),s)},useLayoutEffect:function(t,n){return ko(4194308,4,t,n)},useInsertionEffect:function(t,n){return ko(4,2,t,n)},useMemo:function(t,n){var s=or();return n=n===void 0?null:n,t=t(),s.memoizedState=[t,n],t},useReducer:function(t,n,s){var g=or();return n=s!==void 0?s(n):n,g.memoizedState=g.baseState=n,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:n},g.queue=t,t=t.dispatch=g0.bind(null,Ye,t),[g.memoizedState,t]},useRef:function(t){var n=or();return t={current:t},n.memoizedState=t},useState:xd,useDebugValue:sc,useDeferredValue:function(t){return or().memoizedState=t},useTransition:function(){var t=xd(!1),n=t[0];return t=_0.bind(null,t[1]),or().memoizedState=t,[n,t]},useMutableSource:function(){},useSyncExternalStore:function(t,n,s){var g=Ye,E=or();if(We){if(s===void 0)throw Error(i(407));s=s()}else{if(s=n(),lt===null)throw Error(i(349));(pn&30)!==0||vd(g,n,s)}E.memoizedState=s;var A={value:s,getSnapshot:n};return E.queue=A,Ed(wd.bind(null,g,A,t),[t]),g.flags|=2048,ts(9,yd.bind(null,g,A,s,n),void 0,null),s},useId:function(){var t=or(),n=lt.identifierPrefix;if(We){var s=vr,g=mr;s=(g&~(1<<32-Dt(g)-1)).toString(32)+s,n=":"+n+"R"+s,s=Zi++,0<s&&(n+="H"+s.toString(32)),n+=":"}else s=p0++,n=":"+n+"r"+s.toString(32)+":";return t.memoizedState=n},unstable_isNewReconciler:!1},y0={readContext:Ft,useCallback:Ad,useContext:Ft,useEffect:ic,useImperativeHandle:Dd,useInsertionEffect:kd,useLayoutEffect:Ld,useMemo:Td,useReducer:rc,useRef:bd,useState:function(){return rc(es)},useDebugValue:sc,useDeferredValue:function(t){var n=jt();return Md(n,nt.memoizedState,t)},useTransition:function(){var t=rc(es)[0],n=jt().memoizedState;return[t,n]},useMutableSource:gd,useSyncExternalStore:md,useId:Pd,unstable_isNewReconciler:!1},w0={readContext:Ft,useCallback:Ad,useContext:Ft,useEffect:ic,useImperativeHandle:Dd,useInsertionEffect:kd,useLayoutEffect:Ld,useMemo:Td,useReducer:nc,useRef:bd,useState:function(){return nc(es)},useDebugValue:sc,useDeferredValue:function(t){var n=jt();return nt===null?n.memoizedState=t:Md(n,nt.memoizedState,t)},useTransition:function(){var t=nc(es)[0],n=jt().memoizedState;return[t,n]},useMutableSource:gd,useSyncExternalStore:md,useId:Pd,unstable_isNewReconciler:!1};function qt(t,n){if(t&&t.defaultProps){n=B({},n),t=t.defaultProps;for(var s in t)n[s]===void 0&&(n[s]=t[s]);return n}return n}function oc(t,n,s,g){n=t.memoizedState,s=s(g,n),s=s==null?n:B({},n,s),t.memoizedState=s,t.lanes===0&&(t.updateQueue.baseState=s)}var Do={isMounted:function(t){return(t=t._reactInternals)?rr(t)===t:!1},enqueueSetState:function(t,n,s){t=t._reactInternals;var g=wt(),E=qr(t),A=wr(g,E);A.payload=n,s!=null&&(A.callback=s),n=$r(t,A,E),n!==null&&(Yt(n,t,E,g),So(n,t,E))},enqueueReplaceState:function(t,n,s){t=t._reactInternals;var g=wt(),E=qr(t),A=wr(g,E);A.tag=1,A.payload=n,s!=null&&(A.callback=s),n=$r(t,A,E),n!==null&&(Yt(n,t,E,g),So(n,t,E))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var s=wt(),g=qr(t),E=wr(s,g);E.tag=2,n!=null&&(E.callback=n),n=$r(t,E,g),n!==null&&(Yt(n,t,g,s),So(n,t,g))}};function Od(t,n,s,g,E,A,$){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(g,A,$):n.prototype&&n.prototype.isPureReactComponent?!zi(s,g)||!zi(E,A):!0}function Hd(t,n,s){var g=!1,E=Fr,A=n.contextType;return typeof A=="object"&&A!==null?A=Ft(A):(E=Ct(n)?cn:_t.current,g=n.contextTypes,A=(g=g!=null)?Vn(t,E):Fr),n=new n(s,A),t.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,n.updater=Do,t.stateNode=n,n._reactInternals=t,g&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=E,t.__reactInternalMemoizedMaskedChildContext=A),n}function Fd(t,n,s,g){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(s,g),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(s,g),n.state!==t&&Do.enqueueReplaceState(n,n.state,null)}function ac(t,n,s,g){var E=t.stateNode;E.props=s,E.state=t.memoizedState,E.refs={},Kl(t);var A=n.contextType;typeof A=="object"&&A!==null?E.context=Ft(A):(A=Ct(n)?cn:_t.current,E.context=Vn(t,A)),E.state=t.memoizedState,A=n.getDerivedStateFromProps,typeof A=="function"&&(oc(t,n,A,s),E.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(n=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),n!==E.state&&Do.enqueueReplaceState(E,E.state,null),Co(t,s,E,g),E.state=t.memoizedState),typeof E.componentDidMount=="function"&&(t.flags|=4194308)}function Zn(t,n){try{var s="",g=n;do s+=ie(g),g=g.return;while(g);var E=s}catch(A){E=`
36
+ `),$=E.length-1,G=A.length-1;1<=$&&0<=G&&E[$]!==A[G];)G--;for(;1<=$&&0<=G;$--,G--)if(E[$]!==A[G]){if($!==1||G!==1)do if($--,G--,0>G||E[$]!==A[G]){var Q=`
37
+ `+E[$].replace(" at new "," at ");return t.displayName&&Q.includes("<anonymous>")&&(Q=Q.replace("<anonymous>",t.displayName)),Q}while(1<=$&&0<=G);break}}}finally{Y=!1,Error.prepareStackTrace=s}return(t=t?t.displayName||t.name:"")?F(t):""}function ie(t){switch(t.tag){case 5:return F(t.type);case 16:return F("Lazy");case 13:return F("Suspense");case 19:return F("SuspenseList");case 0:case 2:case 15:return t=Z(t.type,!1),t;case 11:return t=Z(t.type.render,!1),t;case 1:return t=Z(t.type,!0),t;default:return""}}function ae(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case D:return"Fragment";case R:return"Portal";case M:return"Profiler";case k:return"StrictMode";case N:return"Suspense";case I:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case z:return(t.displayName||"Context")+".Consumer";case W:return(t._context.displayName||"Context")+".Provider";case j:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case q:return n=t.displayName||null,n!==null?n:ae(t.type)||"Memo";case U:n=t._payload,t=t._init;try{return ae(t(n))}catch{}}return null}function X(t){var n=t.type;switch(t.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=n.render,t=t.displayName||t.name||"",n.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ae(n);case 8:return n===k?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function H(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function re(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function te(t){var n=re(t)?"checked":"value",s=Object.getOwnPropertyDescriptor(t.constructor.prototype,n),g=""+t[n];if(!t.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var E=s.get,A=s.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return E.call(this)},set:function($){g=""+$,A.call(this,$)}}),Object.defineProperty(t,n,{enumerable:s.enumerable}),{getValue:function(){return g},setValue:function($){g=""+$},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function ce(t){t._valueTracker||(t._valueTracker=te(t))}function le(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var s=n.getValue(),g="";return t&&(g=re(t)?t.checked?"true":"false":t.value),t=g,t!==s?(n.setValue(t),!0):!1}function pe(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Se(t,n){var s=n.checked;return B({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??t._wrapperState.initialChecked})}function be(t,n){var s=n.defaultValue==null?"":n.defaultValue,g=n.checked!=null?n.checked:n.defaultChecked;s=H(n.value!=null?n.value:s),t._wrapperState={initialChecked:g,initialValue:s,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function ue(t,n){n=n.checked,n!=null&&u(t,"checked",n,!1)}function ge(t,n){ue(t,n);var s=H(n.value),g=n.type;if(s!=null)g==="number"?(s===0&&t.value===""||t.value!=s)&&(t.value=""+s):t.value!==""+s&&(t.value=""+s);else if(g==="submit"||g==="reset"){t.removeAttribute("value");return}n.hasOwnProperty("value")?Ie(t,n.type,s):n.hasOwnProperty("defaultValue")&&Ie(t,n.type,H(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(t.defaultChecked=!!n.defaultChecked)}function Re(t,n,s){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var g=n.type;if(!(g!=="submit"&&g!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+t._wrapperState.initialValue,s||n===t.value||(t.value=n),t.defaultValue=n}s=t.name,s!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,s!==""&&(t.name=s)}function Ie(t,n,s){(n!=="number"||pe(t.ownerDocument)!==t)&&(s==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+s&&(t.defaultValue=""+s))}var ze=Array.isArray;function Qe(t,n,s,g){if(t=t.options,n){n={};for(var E=0;E<s.length;E++)n["$"+s[E]]=!0;for(s=0;s<t.length;s++)E=n.hasOwnProperty("$"+t[s].value),t[s].selected!==E&&(t[s].selected=E),E&&g&&(t[s].defaultSelected=!0)}else{for(s=""+H(s),n=null,E=0;E<t.length;E++){if(t[E].value===s){t[E].selected=!0,g&&(t[E].defaultSelected=!0);return}n!==null||t[E].disabled||(n=t[E])}n!==null&&(n.selected=!0)}}function ut(t,n){if(n.dangerouslySetInnerHTML!=null)throw Error(i(91));return B({},n,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function qe(t,n){var s=n.value;if(s==null){if(s=n.children,n=n.defaultValue,s!=null){if(n!=null)throw Error(i(92));if(ze(s)){if(1<s.length)throw Error(i(93));s=s[0]}n=s}n==null&&(n=""),s=n}t._wrapperState={initialValue:H(s)}}function pt(t,n){var s=H(n.value),g=H(n.defaultValue);s!=null&&(s=""+s,s!==t.value&&(t.value=s),n.defaultValue==null&&t.defaultValue!==s&&(t.defaultValue=s)),g!=null&&(t.defaultValue=""+g)}function Ne(t){var n=t.textContent;n===t._wrapperState.initialValue&&n!==""&&n!==null&&(t.value=n)}function Je(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ht(t,n){return t==null||t==="http://www.w3.org/1999/xhtml"?Je(n):t==="http://www.w3.org/2000/svg"&&n==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var $e,pr=(function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(n,s,g,E){MSApp.execUnsafeLocalFunction(function(){return t(n,s,g,E)})}:t})(function(t,n){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=n;else{for($e=$e||document.createElement("div"),$e.innerHTML="<svg>"+n.valueOf().toString()+"</svg>",n=$e.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;n.firstChild;)t.appendChild(n.firstChild)}});function ot(t,n){if(n){var s=t.firstChild;if(s&&s===t.lastChild&&s.nodeType===3){s.nodeValue=n;return}}t.textContent=n}var Rt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Oe=["Webkit","ms","Moz","O"];Object.keys(Rt).forEach(function(t){Oe.forEach(function(n){n=n+t.charAt(0).toUpperCase()+t.substring(1),Rt[n]=Rt[t]})});function Rn(t,n,s){return n==null||typeof n=="boolean"||n===""?"":s||typeof n!="number"||n===0||Rt.hasOwnProperty(t)&&Rt[t]?(""+n).trim():n+"px"}function Ps(t,n){t=t.style;for(var s in n)if(n.hasOwnProperty(s)){var g=s.indexOf("--")===0,E=Rn(s,n[s],g);s==="float"&&(s="cssFloat"),g?t.setProperty(s,E):t[s]=E}}var Ka=B({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function vi(t,n){if(n){if(Ka[t]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(i(137,t));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(i(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(i(61))}if(n.style!=null&&typeof n.style!="object")throw Error(i(62))}}function yi(t,n){if(t.indexOf("-")===-1)return typeof n.is=="string";switch(t){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 wi=null;function Si(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Ci=null,Dr=null,Ar=null;function Ns(t){if(t=Ki(t)){if(typeof Ci!="function")throw Error(i(280));var n=t.stateNode;n&&(n=uo(n),Ci(t.stateNode,t.type,n))}}function Bs(t){Dr?Ar?Ar.push(t):Ar=[t]:Dr=t}function Is(){if(Dr){var t=Dr,n=Ar;if(Ar=Dr=null,Ns(t),n)for(t=0;t<n.length;t++)Ns(n[t])}}function Os(t,n){return t(n)}function Hs(){}var xi=!1;function Fs(t,n,s){if(xi)return t(n,s);xi=!0;try{return Os(t,n,s)}finally{xi=!1,(Dr!==null||Ar!==null)&&(Hs(),Is())}}function rn(t,n){var s=t.stateNode;if(s===null)return null;var g=uo(s);if(g===null)return null;s=g[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":(g=!g.disabled)||(t=t.type,g=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!g;break e;default:t=!1}if(t)return null;if(s&&typeof s!="function")throw Error(i(231,n,typeof s));return s}var bi=!1;if(a)try{var nn={};Object.defineProperty(nn,"passive",{get:function(){bi=!0}}),window.addEventListener("test",nn,nn),window.removeEventListener("test",nn,nn)}catch{bi=!1}function Xa(t,n,s,g,E,A,$,G,Q){var oe=Array.prototype.slice.call(arguments,3);try{n.apply(s,oe)}catch(de){this.onError(de)}}var sn=!1,Dn=null,An=!1,Ei=null,Ya={onError:function(t){sn=!0,Dn=t}};function Ga(t,n,s,g,E,A,$,G,Q){sn=!1,Dn=null,Xa.apply(Ya,arguments)}function Qa(t,n,s,g,E,A,$,G,Q){if(Ga.apply(this,arguments),sn){if(sn){var oe=Dn;sn=!1,Dn=null}else throw Error(i(198));An||(An=!0,Ei=oe)}}function rr(t){var n=t,s=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(s=n.return),t=n.return;while(t)}return n.tag===3?s:null}function ki(t){if(t.tag===13){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function Li(t){if(rr(t)!==t)throw Error(i(188))}function Ja(t){var n=t.alternate;if(!n){if(n=rr(t),n===null)throw Error(i(188));return n!==t?null:t}for(var s=t,g=n;;){var E=s.return;if(E===null)break;var A=E.alternate;if(A===null){if(g=E.return,g!==null){s=g;continue}break}if(E.child===A.child){for(A=E.child;A;){if(A===s)return Li(E),t;if(A===g)return Li(E),n;A=A.sibling}throw Error(i(188))}if(s.return!==g.return)s=E,g=A;else{for(var $=!1,G=E.child;G;){if(G===s){$=!0,s=E,g=A;break}if(G===g){$=!0,g=E,s=A;break}G=G.sibling}if(!$){for(G=A.child;G;){if(G===s){$=!0,s=A,g=E;break}if(G===g){$=!0,g=A,s=E;break}G=G.sibling}if(!$)throw Error(i(189))}}if(s.alternate!==g)throw Error(i(190))}if(s.tag!==3)throw Error(i(188));return s.stateNode.current===s?t:n}function js(t){return t=Ja(t),t!==null?zs(t):null}function zs(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var n=zs(t);if(n!==null)return n;t=t.sibling}return null}var $s=r.unstable_scheduleCallback,Ws=r.unstable_cancelCallback,Za=r.unstable_shouldYield,Us=r.unstable_requestPaint,Ke=r.unstable_now,el=r.unstable_getCurrentPriorityLevel,Ri=r.unstable_ImmediatePriority,Vs=r.unstable_UserBlockingPriority,Tn=r.unstable_NormalPriority,tl=r.unstable_LowPriority,qs=r.unstable_IdlePriority,on=null,It=null;function rl(t){if(It&&typeof It.onCommitFiberRoot=="function")try{It.onCommitFiberRoot(on,t,void 0,(t.current.flags&128)===128)}catch{}}var Dt=Math.clz32?Math.clz32:sl,nl=Math.log,il=Math.LN2;function sl(t){return t>>>=0,t===0?32:31-(nl(t)/il|0)|0}var Mn=64,Pn=4194304;function nr(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Nn(t,n){var s=t.pendingLanes;if(s===0)return 0;var g=0,E=t.suspendedLanes,A=t.pingedLanes,$=s&268435455;if($!==0){var G=$&~E;G!==0?g=nr(G):(A&=$,A!==0&&(g=nr(A)))}else $=s&~E,$!==0?g=nr($):A!==0&&(g=nr(A));if(g===0)return 0;if(n!==0&&n!==g&&(n&E)===0&&(E=g&-g,A=n&-n,E>=A||E===16&&(A&4194240)!==0))return n;if((g&4)!==0&&(g|=s&16),n=t.entangledLanes,n!==0)for(t=t.entanglements,n&=g;0<n;)s=31-Dt(n),E=1<<s,g|=t[s],n&=~E;return g}function Ks(t,n){switch(t){case 1:case 2:case 4:return n+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ol(t,n){for(var s=t.suspendedLanes,g=t.pingedLanes,E=t.expirationTimes,A=t.pendingLanes;0<A;){var $=31-Dt(A),G=1<<$,Q=E[$];Q===-1?((G&s)===0||(G&g)!==0)&&(E[$]=Ks(G,n)):Q<=n&&(t.expiredLanes|=G),A&=~G}}function Di(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Bn(){var t=Mn;return Mn<<=1,(Mn&4194240)===0&&(Mn=64),t}function Ai(t){for(var n=[],s=0;31>s;s++)n.push(t);return n}function an(t,n,s){t.pendingLanes|=n,n!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,n=31-Dt(n),t[n]=s}function Xs(t,n){var s=t.pendingLanes&~n;t.pendingLanes=n,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=n,t.mutableReadLanes&=n,t.entangledLanes&=n,n=t.entanglements;var g=t.eventTimes;for(t=t.expirationTimes;0<s;){var E=31-Dt(s),A=1<<E;n[E]=0,g[E]=-1,t[E]=-1,s&=~A}}function al(t,n){var s=t.entangledLanes|=n;for(t=t.entanglements;s;){var g=31-Dt(s),E=1<<g;E&n|t[g]&n&&(t[g]|=n),s&=~E}}var Be=0;function ch(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var uh,ll,hh,dh,fh,cl=!1,Ys=[],Tr=null,Mr=null,Pr=null,Ti=new Map,Mi=new Map,Nr=[],_m="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function ph(t,n){switch(t){case"focusin":case"focusout":Tr=null;break;case"dragenter":case"dragleave":Mr=null;break;case"mouseover":case"mouseout":Pr=null;break;case"pointerover":case"pointerout":Ti.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Mi.delete(n.pointerId)}}function Pi(t,n,s,g,E,A){return t===null||t.nativeEvent!==A?(t={blockedOn:n,domEventName:s,eventSystemFlags:g,nativeEvent:A,targetContainers:[E]},n!==null&&(n=Ki(n),n!==null&&ll(n)),t):(t.eventSystemFlags|=g,n=t.targetContainers,E!==null&&n.indexOf(E)===-1&&n.push(E),t)}function gm(t,n,s,g,E){switch(n){case"focusin":return Tr=Pi(Tr,t,n,s,g,E),!0;case"dragenter":return Mr=Pi(Mr,t,n,s,g,E),!0;case"mouseover":return Pr=Pi(Pr,t,n,s,g,E),!0;case"pointerover":var A=E.pointerId;return Ti.set(A,Pi(Ti.get(A)||null,t,n,s,g,E)),!0;case"gotpointercapture":return A=E.pointerId,Mi.set(A,Pi(Mi.get(A)||null,t,n,s,g,E)),!0}return!1}function _h(t){var n=ln(t.target);if(n!==null){var s=rr(n);if(s!==null){if(n=s.tag,n===13){if(n=ki(s),n!==null){t.blockedOn=n,fh(t.priority,function(){hh(s)});return}}else if(n===3&&s.stateNode.current.memoizedState.isDehydrated){t.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Gs(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var s=hl(t.domEventName,t.eventSystemFlags,n[0],t.nativeEvent);if(s===null){s=t.nativeEvent;var g=new s.constructor(s.type,s);wi=g,s.target.dispatchEvent(g),wi=null}else return n=Ki(s),n!==null&&ll(n),t.blockedOn=s,!1;n.shift()}return!0}function gh(t,n,s){Gs(t)&&s.delete(n)}function mm(){cl=!1,Tr!==null&&Gs(Tr)&&(Tr=null),Mr!==null&&Gs(Mr)&&(Mr=null),Pr!==null&&Gs(Pr)&&(Pr=null),Ti.forEach(gh),Mi.forEach(gh)}function Ni(t,n){t.blockedOn===n&&(t.blockedOn=null,cl||(cl=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,mm)))}function Bi(t){function n(E){return Ni(E,t)}if(0<Ys.length){Ni(Ys[0],t);for(var s=1;s<Ys.length;s++){var g=Ys[s];g.blockedOn===t&&(g.blockedOn=null)}}for(Tr!==null&&Ni(Tr,t),Mr!==null&&Ni(Mr,t),Pr!==null&&Ni(Pr,t),Ti.forEach(n),Mi.forEach(n),s=0;s<Nr.length;s++)g=Nr[s],g.blockedOn===t&&(g.blockedOn=null);for(;0<Nr.length&&(s=Nr[0],s.blockedOn===null);)_h(s),s.blockedOn===null&&Nr.shift()}var In=w.ReactCurrentBatchConfig,Qs=!0;function vm(t,n,s,g){var E=Be,A=In.transition;In.transition=null;try{Be=1,ul(t,n,s,g)}finally{Be=E,In.transition=A}}function ym(t,n,s,g){var E=Be,A=In.transition;In.transition=null;try{Be=4,ul(t,n,s,g)}finally{Be=E,In.transition=A}}function ul(t,n,s,g){if(Qs){var E=hl(t,n,s,g);if(E===null)Rl(t,n,g,Js,s),ph(t,g);else if(gm(E,t,n,s,g))g.stopPropagation();else if(ph(t,g),n&4&&-1<_m.indexOf(t)){for(;E!==null;){var A=Ki(E);if(A!==null&&uh(A),A=hl(t,n,s,g),A===null&&Rl(t,n,g,Js,s),A===E)break;E=A}E!==null&&g.stopPropagation()}else Rl(t,n,g,null,s)}}var Js=null;function hl(t,n,s,g){if(Js=null,t=Si(g),t=ln(t),t!==null)if(n=rr(t),n===null)t=null;else if(s=n.tag,s===13){if(t=ki(n),t!==null)return t;t=null}else if(s===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;t=null}else n!==t&&(t=null);return Js=t,null}function mh(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(el()){case Ri:return 1;case Vs:return 4;case Tn:case tl:return 16;case qs:return 536870912;default:return 16}default:return 16}}var Br=null,dl=null,Zs=null;function vh(){if(Zs)return Zs;var t,n=dl,s=n.length,g,E="value"in Br?Br.value:Br.textContent,A=E.length;for(t=0;t<s&&n[t]===E[t];t++);var $=s-t;for(g=1;g<=$&&n[s-g]===E[A-g];g++);return Zs=E.slice(t,1<g?1-g:void 0)}function eo(t){var n=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&n===13&&(t=13)):t=n,t===10&&(t=13),32<=t||t===13?t:0}function to(){return!0}function yh(){return!1}function At(t){function n(s,g,E,A,$){this._reactName=s,this._targetInst=E,this.type=g,this.nativeEvent=A,this.target=$,this.currentTarget=null;for(var G in t)t.hasOwnProperty(G)&&(s=t[G],this[G]=s?s(A):A[G]);return this.isDefaultPrevented=(A.defaultPrevented!=null?A.defaultPrevented:A.returnValue===!1)?to:yh,this.isPropagationStopped=yh,this}return B(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=to)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=to)},persist:function(){},isPersistent:to}),n}var On={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},fl=At(On),Ii=B({},On,{view:0,detail:0}),wm=At(Ii),pl,_l,Oi,ro=B({},Ii,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ml,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Oi&&(Oi&&t.type==="mousemove"?(pl=t.screenX-Oi.screenX,_l=t.screenY-Oi.screenY):_l=pl=0,Oi=t),pl)},movementY:function(t){return"movementY"in t?t.movementY:_l}}),wh=At(ro),Sm=B({},ro,{dataTransfer:0}),Cm=At(Sm),xm=B({},Ii,{relatedTarget:0}),gl=At(xm),bm=B({},On,{animationName:0,elapsedTime:0,pseudoElement:0}),Em=At(bm),km=B({},On,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Lm=At(km),Rm=B({},On,{data:0}),Sh=At(Rm),Dm={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Am={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"},Tm={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Mm(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=Tm[t])?!!n[t]:!1}function ml(){return Mm}var Pm=B({},Ii,{key:function(t){if(t.key){var n=Dm[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=eo(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Am[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ml,charCode:function(t){return t.type==="keypress"?eo(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?eo(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Nm=At(Pm),Bm=B({},ro,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ch=At(Bm),Im=B({},Ii,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ml}),Om=At(Im),Hm=B({},On,{propertyName:0,elapsedTime:0,pseudoElement:0}),Fm=At(Hm),jm=B({},ro,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),zm=At(jm),$m=[9,13,27,32],vl=a&&"CompositionEvent"in window,Hi=null;a&&"documentMode"in document&&(Hi=document.documentMode);var Wm=a&&"TextEvent"in window&&!Hi,xh=a&&(!vl||Hi&&8<Hi&&11>=Hi),bh=" ",Eh=!1;function kh(t,n){switch(t){case"keyup":return $m.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Lh(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Hn=!1;function Um(t,n){switch(t){case"compositionend":return Lh(n);case"keypress":return n.which!==32?null:(Eh=!0,bh);case"textInput":return t=n.data,t===bh&&Eh?null:t;default:return null}}function Vm(t,n){if(Hn)return t==="compositionend"||!vl&&kh(t,n)?(t=vh(),Zs=dl=Br=null,Hn=!1,t):null;switch(t){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 xh&&n.locale!=="ko"?null:n.data;default:return null}}var qm={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Rh(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!qm[t.type]:n==="textarea"}function Dh(t,n,s,g){Bs(g),n=ao(n,"onChange"),0<n.length&&(s=new fl("onChange","change",null,s,g),t.push({event:s,listeners:n}))}var Fi=null,ji=null;function Km(t){Kh(t,0)}function no(t){var n=Wn(t);if(le(n))return t}function Xm(t,n){if(t==="change")return n}var Ah=!1;if(a){var yl;if(a){var wl="oninput"in document;if(!wl){var Th=document.createElement("div");Th.setAttribute("oninput","return;"),wl=typeof Th.oninput=="function"}yl=wl}else yl=!1;Ah=yl&&(!document.documentMode||9<document.documentMode)}function Mh(){Fi&&(Fi.detachEvent("onpropertychange",Ph),ji=Fi=null)}function Ph(t){if(t.propertyName==="value"&&no(ji)){var n=[];Dh(n,ji,t,Si(t)),Fs(Km,n)}}function Ym(t,n,s){t==="focusin"?(Mh(),Fi=n,ji=s,Fi.attachEvent("onpropertychange",Ph)):t==="focusout"&&Mh()}function Gm(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return no(ji)}function Qm(t,n){if(t==="click")return no(n)}function Jm(t,n){if(t==="input"||t==="change")return no(n)}function Zm(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var Ut=typeof Object.is=="function"?Object.is:Zm;function zi(t,n){if(Ut(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var s=Object.keys(t),g=Object.keys(n);if(s.length!==g.length)return!1;for(g=0;g<s.length;g++){var E=s[g];if(!l.call(n,E)||!Ut(t[E],n[E]))return!1}return!0}function Nh(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Bh(t,n){var s=Nh(t);t=0;for(var g;s;){if(s.nodeType===3){if(g=t+s.textContent.length,t<=n&&g>=n)return{node:s,offset:n-t};t=g}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Nh(s)}}function Ih(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?Ih(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function Oh(){for(var t=window,n=pe();n instanceof t.HTMLIFrameElement;){try{var s=typeof n.contentWindow.location.href=="string"}catch{s=!1}if(s)t=n.contentWindow;else break;n=pe(t.document)}return n}function Sl(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}function e0(t){var n=Oh(),s=t.focusedElem,g=t.selectionRange;if(n!==s&&s&&s.ownerDocument&&Ih(s.ownerDocument.documentElement,s)){if(g!==null&&Sl(s)){if(n=g.start,t=g.end,t===void 0&&(t=n),"selectionStart"in s)s.selectionStart=n,s.selectionEnd=Math.min(t,s.value.length);else if(t=(n=s.ownerDocument||document)&&n.defaultView||window,t.getSelection){t=t.getSelection();var E=s.textContent.length,A=Math.min(g.start,E);g=g.end===void 0?A:Math.min(g.end,E),!t.extend&&A>g&&(E=g,g=A,A=E),E=Bh(s,A);var $=Bh(s,g);E&&$&&(t.rangeCount!==1||t.anchorNode!==E.node||t.anchorOffset!==E.offset||t.focusNode!==$.node||t.focusOffset!==$.offset)&&(n=n.createRange(),n.setStart(E.node,E.offset),t.removeAllRanges(),A>g?(t.addRange(n),t.extend($.node,$.offset)):(n.setEnd($.node,$.offset),t.addRange(n)))}}for(n=[],t=s;t=t.parentNode;)t.nodeType===1&&n.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s<n.length;s++)t=n[s],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var t0=a&&"documentMode"in document&&11>=document.documentMode,Fn=null,Cl=null,$i=null,xl=!1;function Hh(t,n,s){var g=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;xl||Fn==null||Fn!==pe(g)||(g=Fn,"selectionStart"in g&&Sl(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),$i&&zi($i,g)||($i=g,g=ao(Cl,"onSelect"),0<g.length&&(n=new fl("onSelect","select",null,n,s),t.push({event:n,listeners:g}),n.target=Fn)))}function io(t,n){var s={};return s[t.toLowerCase()]=n.toLowerCase(),s["Webkit"+t]="webkit"+n,s["Moz"+t]="moz"+n,s}var jn={animationend:io("Animation","AnimationEnd"),animationiteration:io("Animation","AnimationIteration"),animationstart:io("Animation","AnimationStart"),transitionend:io("Transition","TransitionEnd")},bl={},Fh={};a&&(Fh=document.createElement("div").style,"AnimationEvent"in window||(delete jn.animationend.animation,delete jn.animationiteration.animation,delete jn.animationstart.animation),"TransitionEvent"in window||delete jn.transitionend.transition);function so(t){if(bl[t])return bl[t];if(!jn[t])return t;var n=jn[t],s;for(s in n)if(n.hasOwnProperty(s)&&s in Fh)return bl[t]=n[s];return t}var jh=so("animationend"),zh=so("animationiteration"),$h=so("animationstart"),Wh=so("transitionend"),Uh=new Map,Vh="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Ir(t,n){Uh.set(t,n),S(n,[t])}for(var El=0;El<Vh.length;El++){var kl=Vh[El],r0=kl.toLowerCase(),n0=kl[0].toUpperCase()+kl.slice(1);Ir(r0,"on"+n0)}Ir(jh,"onAnimationEnd"),Ir(zh,"onAnimationIteration"),Ir($h,"onAnimationStart"),Ir("dblclick","onDoubleClick"),Ir("focusin","onFocus"),Ir("focusout","onBlur"),Ir(Wh,"onTransitionEnd"),y("onMouseEnter",["mouseout","mouseover"]),y("onMouseLeave",["mouseout","mouseover"]),y("onPointerEnter",["pointerout","pointerover"]),y("onPointerLeave",["pointerout","pointerover"]),S("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),S("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),S("onBeforeInput",["compositionend","keypress","textInput","paste"]),S("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),S("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),S("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Wi="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(" "),i0=new Set("cancel close invalid load scroll toggle".split(" ").concat(Wi));function qh(t,n,s){var g=t.type||"unknown-event";t.currentTarget=s,Qa(g,n,void 0,t),t.currentTarget=null}function Kh(t,n){n=(n&4)!==0;for(var s=0;s<t.length;s++){var g=t[s],E=g.event;g=g.listeners;e:{var A=void 0;if(n)for(var $=g.length-1;0<=$;$--){var G=g[$],Q=G.instance,oe=G.currentTarget;if(G=G.listener,Q!==A&&E.isPropagationStopped())break e;qh(E,G,oe),A=Q}else for($=0;$<g.length;$++){if(G=g[$],Q=G.instance,oe=G.currentTarget,G=G.listener,Q!==A&&E.isPropagationStopped())break e;qh(E,G,oe),A=Q}}}if(An)throw t=Ei,An=!1,Ei=null,t}function Fe(t,n){var s=n[Nl];s===void 0&&(s=n[Nl]=new Set);var g=t+"__bubble";s.has(g)||(Xh(n,t,2,!1),s.add(g))}function Ll(t,n,s){var g=0;n&&(g|=4),Xh(s,t,g,n)}var oo="_reactListening"+Math.random().toString(36).slice(2);function Ui(t){if(!t[oo]){t[oo]=!0,o.forEach(function(s){s!=="selectionchange"&&(i0.has(s)||Ll(s,!1,t),Ll(s,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[oo]||(n[oo]=!0,Ll("selectionchange",!1,n))}}function Xh(t,n,s,g){switch(mh(n)){case 1:var E=vm;break;case 4:E=ym;break;default:E=ul}s=E.bind(null,n,s,t),E=void 0,!bi||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(E=!0),g?E!==void 0?t.addEventListener(n,s,{capture:!0,passive:E}):t.addEventListener(n,s,!0):E!==void 0?t.addEventListener(n,s,{passive:E}):t.addEventListener(n,s,!1)}function Rl(t,n,s,g,E){var A=g;if((n&1)===0&&(n&2)===0&&g!==null)e:for(;;){if(g===null)return;var $=g.tag;if($===3||$===4){var G=g.stateNode.containerInfo;if(G===E||G.nodeType===8&&G.parentNode===E)break;if($===4)for($=g.return;$!==null;){var Q=$.tag;if((Q===3||Q===4)&&(Q=$.stateNode.containerInfo,Q===E||Q.nodeType===8&&Q.parentNode===E))return;$=$.return}for(;G!==null;){if($=ln(G),$===null)return;if(Q=$.tag,Q===5||Q===6){g=A=$;continue e}G=G.parentNode}}g=g.return}Fs(function(){var oe=A,de=Si(s),fe=[];e:{var he=Uh.get(t);if(he!==void 0){var me=fl,ye=t;switch(t){case"keypress":if(eo(s)===0)break e;case"keydown":case"keyup":me=Nm;break;case"focusin":ye="focus",me=gl;break;case"focusout":ye="blur",me=gl;break;case"beforeblur":case"afterblur":me=gl;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":me=wh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":me=Cm;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":me=Om;break;case jh:case zh:case $h:me=Em;break;case Wh:me=Fm;break;case"scroll":me=wm;break;case"wheel":me=zm;break;case"copy":case"cut":case"paste":me=Lm;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":me=Ch}var we=(n&4)!==0,Ze=!we&&t==="scroll",ne=we?he!==null?he+"Capture":null:he;we=[];for(var ee=oe,se;ee!==null;){se=ee;var _e=se.stateNode;if(se.tag===5&&_e!==null&&(se=_e,ne!==null&&(_e=rn(ee,ne),_e!=null&&we.push(Vi(ee,_e,se)))),Ze)break;ee=ee.return}0<we.length&&(he=new me(he,ye,null,s,de),fe.push({event:he,listeners:we}))}}if((n&7)===0){e:{if(he=t==="mouseover"||t==="pointerover",me=t==="mouseout"||t==="pointerout",he&&s!==wi&&(ye=s.relatedTarget||s.fromElement)&&(ln(ye)||ye[_r]))break e;if((me||he)&&(he=de.window===de?de:(he=de.ownerDocument)?he.defaultView||he.parentWindow:window,me?(ye=s.relatedTarget||s.toElement,me=oe,ye=ye?ln(ye):null,ye!==null&&(Ze=rr(ye),ye!==Ze||ye.tag!==5&&ye.tag!==6)&&(ye=null)):(me=null,ye=oe),me!==ye)){if(we=wh,_e="onMouseLeave",ne="onMouseEnter",ee="mouse",(t==="pointerout"||t==="pointerover")&&(we=Ch,_e="onPointerLeave",ne="onPointerEnter",ee="pointer"),Ze=me==null?he:Wn(me),se=ye==null?he:Wn(ye),he=new we(_e,ee+"leave",me,s,de),he.target=Ze,he.relatedTarget=se,_e=null,ln(de)===oe&&(we=new we(ne,ee+"enter",ye,s,de),we.target=se,we.relatedTarget=Ze,_e=we),Ze=_e,me&&ye)t:{for(we=me,ne=ye,ee=0,se=we;se;se=zn(se))ee++;for(se=0,_e=ne;_e;_e=zn(_e))se++;for(;0<ee-se;)we=zn(we),ee--;for(;0<se-ee;)ne=zn(ne),se--;for(;ee--;){if(we===ne||ne!==null&&we===ne.alternate)break t;we=zn(we),ne=zn(ne)}we=null}else we=null;me!==null&&Yh(fe,he,me,we,!1),ye!==null&&Ze!==null&&Yh(fe,Ze,ye,we,!0)}}e:{if(he=oe?Wn(oe):window,me=he.nodeName&&he.nodeName.toLowerCase(),me==="select"||me==="input"&&he.type==="file")var Ce=Xm;else if(Rh(he))if(Ah)Ce=Jm;else{Ce=Gm;var Ee=Ym}else(me=he.nodeName)&&me.toLowerCase()==="input"&&(he.type==="checkbox"||he.type==="radio")&&(Ce=Qm);if(Ce&&(Ce=Ce(t,oe))){Dh(fe,Ce,s,de);break e}Ee&&Ee(t,he,oe),t==="focusout"&&(Ee=he._wrapperState)&&Ee.controlled&&he.type==="number"&&Ie(he,"number",he.value)}switch(Ee=oe?Wn(oe):window,t){case"focusin":(Rh(Ee)||Ee.contentEditable==="true")&&(Fn=Ee,Cl=oe,$i=null);break;case"focusout":$i=Cl=Fn=null;break;case"mousedown":xl=!0;break;case"contextmenu":case"mouseup":case"dragend":xl=!1,Hh(fe,s,de);break;case"selectionchange":if(t0)break;case"keydown":case"keyup":Hh(fe,s,de)}var ke;if(vl)e:{switch(t){case"compositionstart":var Le="onCompositionStart";break e;case"compositionend":Le="onCompositionEnd";break e;case"compositionupdate":Le="onCompositionUpdate";break e}Le=void 0}else Hn?kh(t,s)&&(Le="onCompositionEnd"):t==="keydown"&&s.keyCode===229&&(Le="onCompositionStart");Le&&(xh&&s.locale!=="ko"&&(Hn||Le!=="onCompositionStart"?Le==="onCompositionEnd"&&Hn&&(ke=vh()):(Br=de,dl="value"in Br?Br.value:Br.textContent,Hn=!0)),Ee=ao(oe,Le),0<Ee.length&&(Le=new Sh(Le,t,null,s,de),fe.push({event:Le,listeners:Ee}),ke?Le.data=ke:(ke=Lh(s),ke!==null&&(Le.data=ke)))),(ke=Wm?Um(t,s):Vm(t,s))&&(oe=ao(oe,"onBeforeInput"),0<oe.length&&(de=new Sh("onBeforeInput","beforeinput",null,s,de),fe.push({event:de,listeners:oe}),de.data=ke))}Kh(fe,n)})}function Vi(t,n,s){return{instance:t,listener:n,currentTarget:s}}function ao(t,n){for(var s=n+"Capture",g=[];t!==null;){var E=t,A=E.stateNode;E.tag===5&&A!==null&&(E=A,A=rn(t,s),A!=null&&g.unshift(Vi(t,A,E)),A=rn(t,n),A!=null&&g.push(Vi(t,A,E))),t=t.return}return g}function zn(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Yh(t,n,s,g,E){for(var A=n._reactName,$=[];s!==null&&s!==g;){var G=s,Q=G.alternate,oe=G.stateNode;if(Q!==null&&Q===g)break;G.tag===5&&oe!==null&&(G=oe,E?(Q=rn(s,A),Q!=null&&$.unshift(Vi(s,Q,G))):E||(Q=rn(s,A),Q!=null&&$.push(Vi(s,Q,G)))),s=s.return}$.length!==0&&t.push({event:n,listeners:$})}var s0=/\r\n?/g,o0=/\u0000|\uFFFD/g;function Gh(t){return(typeof t=="string"?t:""+t).replace(s0,`
38
+ `).replace(o0,"")}function lo(t,n,s){if(n=Gh(n),Gh(t)!==n&&s)throw Error(i(425))}function co(){}var Dl=null,Al=null;function Tl(t,n){return t==="textarea"||t==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Ml=typeof setTimeout=="function"?setTimeout:void 0,a0=typeof clearTimeout=="function"?clearTimeout:void 0,Qh=typeof Promise=="function"?Promise:void 0,l0=typeof queueMicrotask=="function"?queueMicrotask:typeof Qh<"u"?function(t){return Qh.resolve(null).then(t).catch(c0)}:Ml;function c0(t){setTimeout(function(){throw t})}function Pl(t,n){var s=n,g=0;do{var E=s.nextSibling;if(t.removeChild(s),E&&E.nodeType===8)if(s=E.data,s==="/$"){if(g===0){t.removeChild(E),Bi(n);return}g--}else s!=="$"&&s!=="$?"&&s!=="$!"||g++;s=E}while(s);Bi(n)}function Or(t){for(;t!=null;t=t.nextSibling){var n=t.nodeType;if(n===1||n===3)break;if(n===8){if(n=t.data,n==="$"||n==="$!"||n==="$?")break;if(n==="/$")return null}}return t}function Jh(t){t=t.previousSibling;for(var n=0;t;){if(t.nodeType===8){var s=t.data;if(s==="$"||s==="$!"||s==="$?"){if(n===0)return t;n--}else s==="/$"&&n++}t=t.previousSibling}return null}var $n=Math.random().toString(36).slice(2),ir="__reactFiber$"+$n,qi="__reactProps$"+$n,_r="__reactContainer$"+$n,Nl="__reactEvents$"+$n,u0="__reactListeners$"+$n,h0="__reactHandles$"+$n;function ln(t){var n=t[ir];if(n)return n;for(var s=t.parentNode;s;){if(n=s[_r]||s[ir]){if(s=n.alternate,n.child!==null||s!==null&&s.child!==null)for(t=Jh(t);t!==null;){if(s=t[ir])return s;t=Jh(t)}return n}t=s,s=t.parentNode}return null}function Ki(t){return t=t[ir]||t[_r],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Wn(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(i(33))}function uo(t){return t[qi]||null}var Bl=[],Un=-1;function Hr(t){return{current:t}}function je(t){0>Un||(t.current=Bl[Un],Bl[Un]=null,Un--)}function He(t,n){Un++,Bl[Un]=t.current,t.current=n}var Fr={},_t=Hr(Fr),St=Hr(!1),cn=Fr;function Vn(t,n){var s=t.type.contextTypes;if(!s)return Fr;var g=t.stateNode;if(g&&g.__reactInternalMemoizedUnmaskedChildContext===n)return g.__reactInternalMemoizedMaskedChildContext;var E={},A;for(A in s)E[A]=n[A];return g&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=n,t.__reactInternalMemoizedMaskedChildContext=E),E}function Ct(t){return t=t.childContextTypes,t!=null}function ho(){je(St),je(_t)}function Zh(t,n,s){if(_t.current!==Fr)throw Error(i(168));He(_t,n),He(St,s)}function ed(t,n,s){var g=t.stateNode;if(n=n.childContextTypes,typeof g.getChildContext!="function")return s;g=g.getChildContext();for(var E in g)if(!(E in n))throw Error(i(108,X(t)||"Unknown",E));return B({},s,g)}function fo(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Fr,cn=_t.current,He(_t,t),He(St,St.current),!0}function td(t,n,s){var g=t.stateNode;if(!g)throw Error(i(169));s?(t=ed(t,n,cn),g.__reactInternalMemoizedMergedChildContext=t,je(St),je(_t),He(_t,t)):je(St),He(St,s)}var gr=null,po=!1,Il=!1;function rd(t){gr===null?gr=[t]:gr.push(t)}function d0(t){po=!0,rd(t)}function jr(){if(!Il&&gr!==null){Il=!0;var t=0,n=Be;try{var s=gr;for(Be=1;t<s.length;t++){var g=s[t];do g=g(!0);while(g!==null)}gr=null,po=!1}catch(E){throw gr!==null&&(gr=gr.slice(t+1)),$s(Ri,jr),E}finally{Be=n,Il=!1}}return null}var qn=[],Kn=0,_o=null,go=0,Ot=[],Ht=0,un=null,mr=1,vr="";function hn(t,n){qn[Kn++]=go,qn[Kn++]=_o,_o=t,go=n}function nd(t,n,s){Ot[Ht++]=mr,Ot[Ht++]=vr,Ot[Ht++]=un,un=t;var g=mr;t=vr;var E=32-Dt(g)-1;g&=~(1<<E),s+=1;var A=32-Dt(n)+E;if(30<A){var $=E-E%5;A=(g&(1<<$)-1).toString(32),g>>=$,E-=$,mr=1<<32-Dt(n)+E|s<<E|g,vr=A+t}else mr=1<<A|s<<E|g,vr=t}function Ol(t){t.return!==null&&(hn(t,1),nd(t,1,0))}function Hl(t){for(;t===_o;)_o=qn[--Kn],qn[Kn]=null,go=qn[--Kn],qn[Kn]=null;for(;t===un;)un=Ot[--Ht],Ot[Ht]=null,vr=Ot[--Ht],Ot[Ht]=null,mr=Ot[--Ht],Ot[Ht]=null}var Tt=null,Mt=null,We=!1,Vt=null;function id(t,n){var s=$t(5,null,null,0);s.elementType="DELETED",s.stateNode=n,s.return=t,n=t.deletions,n===null?(t.deletions=[s],t.flags|=16):n.push(s)}function sd(t,n){switch(t.tag){case 5:var s=t.type;return n=n.nodeType!==1||s.toLowerCase()!==n.nodeName.toLowerCase()?null:n,n!==null?(t.stateNode=n,Tt=t,Mt=Or(n.firstChild),!0):!1;case 6:return n=t.pendingProps===""||n.nodeType!==3?null:n,n!==null?(t.stateNode=n,Tt=t,Mt=null,!0):!1;case 13:return n=n.nodeType!==8?null:n,n!==null?(s=un!==null?{id:mr,overflow:vr}:null,t.memoizedState={dehydrated:n,treeContext:s,retryLane:1073741824},s=$t(18,null,null,0),s.stateNode=n,s.return=t,t.child=s,Tt=t,Mt=null,!0):!1;default:return!1}}function Fl(t){return(t.mode&1)!==0&&(t.flags&128)===0}function jl(t){if(We){var n=Mt;if(n){var s=n;if(!sd(t,n)){if(Fl(t))throw Error(i(418));n=Or(s.nextSibling);var g=Tt;n&&sd(t,n)?id(g,s):(t.flags=t.flags&-4097|2,We=!1,Tt=t)}}else{if(Fl(t))throw Error(i(418));t.flags=t.flags&-4097|2,We=!1,Tt=t}}}function od(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Tt=t}function mo(t){if(t!==Tt)return!1;if(!We)return od(t),We=!0,!1;var n;if((n=t.tag!==3)&&!(n=t.tag!==5)&&(n=t.type,n=n!=="head"&&n!=="body"&&!Tl(t.type,t.memoizedProps)),n&&(n=Mt)){if(Fl(t))throw ad(),Error(i(418));for(;n;)id(t,n),n=Or(n.nextSibling)}if(od(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));e:{for(t=t.nextSibling,n=0;t;){if(t.nodeType===8){var s=t.data;if(s==="/$"){if(n===0){Mt=Or(t.nextSibling);break e}n--}else s!=="$"&&s!=="$!"&&s!=="$?"||n++}t=t.nextSibling}Mt=null}}else Mt=Tt?Or(t.stateNode.nextSibling):null;return!0}function ad(){for(var t=Mt;t;)t=Or(t.nextSibling)}function Xn(){Mt=Tt=null,We=!1}function zl(t){Vt===null?Vt=[t]:Vt.push(t)}var f0=w.ReactCurrentBatchConfig;function Xi(t,n,s){if(t=s.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(s._owner){if(s=s._owner,s){if(s.tag!==1)throw Error(i(309));var g=s.stateNode}if(!g)throw Error(i(147,t));var E=g,A=""+t;return n!==null&&n.ref!==null&&typeof n.ref=="function"&&n.ref._stringRef===A?n.ref:(n=function($){var G=E.refs;$===null?delete G[A]:G[A]=$},n._stringRef=A,n)}if(typeof t!="string")throw Error(i(284));if(!s._owner)throw Error(i(290,t))}return t}function vo(t,n){throw t=Object.prototype.toString.call(n),Error(i(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t))}function ld(t){var n=t._init;return n(t._payload)}function cd(t){function n(ne,ee){if(t){var se=ne.deletions;se===null?(ne.deletions=[ee],ne.flags|=16):se.push(ee)}}function s(ne,ee){if(!t)return null;for(;ee!==null;)n(ne,ee),ee=ee.sibling;return null}function g(ne,ee){for(ne=new Map;ee!==null;)ee.key!==null?ne.set(ee.key,ee):ne.set(ee.index,ee),ee=ee.sibling;return ne}function E(ne,ee){return ne=Xr(ne,ee),ne.index=0,ne.sibling=null,ne}function A(ne,ee,se){return ne.index=se,t?(se=ne.alternate,se!==null?(se=se.index,se<ee?(ne.flags|=2,ee):se):(ne.flags|=2,ee)):(ne.flags|=1048576,ee)}function $(ne){return t&&ne.alternate===null&&(ne.flags|=2),ne}function G(ne,ee,se,_e){return ee===null||ee.tag!==6?(ee=Mc(se,ne.mode,_e),ee.return=ne,ee):(ee=E(ee,se),ee.return=ne,ee)}function Q(ne,ee,se,_e){var Ce=se.type;return Ce===D?de(ne,ee,se.props.children,_e,se.key):ee!==null&&(ee.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===U&&ld(Ce)===ee.type)?(_e=E(ee,se.props),_e.ref=Xi(ne,ee,se),_e.return=ne,_e):(_e=$o(se.type,se.key,se.props,null,ne.mode,_e),_e.ref=Xi(ne,ee,se),_e.return=ne,_e)}function oe(ne,ee,se,_e){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==se.containerInfo||ee.stateNode.implementation!==se.implementation?(ee=Pc(se,ne.mode,_e),ee.return=ne,ee):(ee=E(ee,se.children||[]),ee.return=ne,ee)}function de(ne,ee,se,_e,Ce){return ee===null||ee.tag!==7?(ee=yn(se,ne.mode,_e,Ce),ee.return=ne,ee):(ee=E(ee,se),ee.return=ne,ee)}function fe(ne,ee,se){if(typeof ee=="string"&&ee!==""||typeof ee=="number")return ee=Mc(""+ee,ne.mode,se),ee.return=ne,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case L:return se=$o(ee.type,ee.key,ee.props,null,ne.mode,se),se.ref=Xi(ne,null,ee),se.return=ne,se;case R:return ee=Pc(ee,ne.mode,se),ee.return=ne,ee;case U:var _e=ee._init;return fe(ne,_e(ee._payload),se)}if(ze(ee)||T(ee))return ee=yn(ee,ne.mode,se,null),ee.return=ne,ee;vo(ne,ee)}return null}function he(ne,ee,se,_e){var Ce=ee!==null?ee.key:null;if(typeof se=="string"&&se!==""||typeof se=="number")return Ce!==null?null:G(ne,ee,""+se,_e);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case L:return se.key===Ce?Q(ne,ee,se,_e):null;case R:return se.key===Ce?oe(ne,ee,se,_e):null;case U:return Ce=se._init,he(ne,ee,Ce(se._payload),_e)}if(ze(se)||T(se))return Ce!==null?null:de(ne,ee,se,_e,null);vo(ne,se)}return null}function me(ne,ee,se,_e,Ce){if(typeof _e=="string"&&_e!==""||typeof _e=="number")return ne=ne.get(se)||null,G(ee,ne,""+_e,Ce);if(typeof _e=="object"&&_e!==null){switch(_e.$$typeof){case L:return ne=ne.get(_e.key===null?se:_e.key)||null,Q(ee,ne,_e,Ce);case R:return ne=ne.get(_e.key===null?se:_e.key)||null,oe(ee,ne,_e,Ce);case U:var Ee=_e._init;return me(ne,ee,se,Ee(_e._payload),Ce)}if(ze(_e)||T(_e))return ne=ne.get(se)||null,de(ee,ne,_e,Ce,null);vo(ee,_e)}return null}function ye(ne,ee,se,_e){for(var Ce=null,Ee=null,ke=ee,Le=ee=0,ct=null;ke!==null&&Le<se.length;Le++){ke.index>Le?(ct=ke,ke=null):ct=ke.sibling;var Pe=he(ne,ke,se[Le],_e);if(Pe===null){ke===null&&(ke=ct);break}t&&ke&&Pe.alternate===null&&n(ne,ke),ee=A(Pe,ee,Le),Ee===null?Ce=Pe:Ee.sibling=Pe,Ee=Pe,ke=ct}if(Le===se.length)return s(ne,ke),We&&hn(ne,Le),Ce;if(ke===null){for(;Le<se.length;Le++)ke=fe(ne,se[Le],_e),ke!==null&&(ee=A(ke,ee,Le),Ee===null?Ce=ke:Ee.sibling=ke,Ee=ke);return We&&hn(ne,Le),Ce}for(ke=g(ne,ke);Le<se.length;Le++)ct=me(ke,ne,Le,se[Le],_e),ct!==null&&(t&&ct.alternate!==null&&ke.delete(ct.key===null?Le:ct.key),ee=A(ct,ee,Le),Ee===null?Ce=ct:Ee.sibling=ct,Ee=ct);return t&&ke.forEach(function(Yr){return n(ne,Yr)}),We&&hn(ne,Le),Ce}function we(ne,ee,se,_e){var Ce=T(se);if(typeof Ce!="function")throw Error(i(150));if(se=Ce.call(se),se==null)throw Error(i(151));for(var Ee=Ce=null,ke=ee,Le=ee=0,ct=null,Pe=se.next();ke!==null&&!Pe.done;Le++,Pe=se.next()){ke.index>Le?(ct=ke,ke=null):ct=ke.sibling;var Yr=he(ne,ke,Pe.value,_e);if(Yr===null){ke===null&&(ke=ct);break}t&&ke&&Yr.alternate===null&&n(ne,ke),ee=A(Yr,ee,Le),Ee===null?Ce=Yr:Ee.sibling=Yr,Ee=Yr,ke=ct}if(Pe.done)return s(ne,ke),We&&hn(ne,Le),Ce;if(ke===null){for(;!Pe.done;Le++,Pe=se.next())Pe=fe(ne,Pe.value,_e),Pe!==null&&(ee=A(Pe,ee,Le),Ee===null?Ce=Pe:Ee.sibling=Pe,Ee=Pe);return We&&hn(ne,Le),Ce}for(ke=g(ne,ke);!Pe.done;Le++,Pe=se.next())Pe=me(ke,ne,Le,Pe.value,_e),Pe!==null&&(t&&Pe.alternate!==null&&ke.delete(Pe.key===null?Le:Pe.key),ee=A(Pe,ee,Le),Ee===null?Ce=Pe:Ee.sibling=Pe,Ee=Pe);return t&&ke.forEach(function(q0){return n(ne,q0)}),We&&hn(ne,Le),Ce}function Ze(ne,ee,se,_e){if(typeof se=="object"&&se!==null&&se.type===D&&se.key===null&&(se=se.props.children),typeof se=="object"&&se!==null){switch(se.$$typeof){case L:e:{for(var Ce=se.key,Ee=ee;Ee!==null;){if(Ee.key===Ce){if(Ce=se.type,Ce===D){if(Ee.tag===7){s(ne,Ee.sibling),ee=E(Ee,se.props.children),ee.return=ne,ne=ee;break e}}else if(Ee.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===U&&ld(Ce)===Ee.type){s(ne,Ee.sibling),ee=E(Ee,se.props),ee.ref=Xi(ne,Ee,se),ee.return=ne,ne=ee;break e}s(ne,Ee);break}else n(ne,Ee);Ee=Ee.sibling}se.type===D?(ee=yn(se.props.children,ne.mode,_e,se.key),ee.return=ne,ne=ee):(_e=$o(se.type,se.key,se.props,null,ne.mode,_e),_e.ref=Xi(ne,ee,se),_e.return=ne,ne=_e)}return $(ne);case R:e:{for(Ee=se.key;ee!==null;){if(ee.key===Ee)if(ee.tag===4&&ee.stateNode.containerInfo===se.containerInfo&&ee.stateNode.implementation===se.implementation){s(ne,ee.sibling),ee=E(ee,se.children||[]),ee.return=ne,ne=ee;break e}else{s(ne,ee);break}else n(ne,ee);ee=ee.sibling}ee=Pc(se,ne.mode,_e),ee.return=ne,ne=ee}return $(ne);case U:return Ee=se._init,Ze(ne,ee,Ee(se._payload),_e)}if(ze(se))return ye(ne,ee,se,_e);if(T(se))return we(ne,ee,se,_e);vo(ne,se)}return typeof se=="string"&&se!==""||typeof se=="number"?(se=""+se,ee!==null&&ee.tag===6?(s(ne,ee.sibling),ee=E(ee,se),ee.return=ne,ne=ee):(s(ne,ee),ee=Mc(se,ne.mode,_e),ee.return=ne,ne=ee),$(ne)):s(ne,ee)}return Ze}var Yn=cd(!0),ud=cd(!1),yo=Hr(null),wo=null,Gn=null,$l=null;function Wl(){$l=Gn=wo=null}function Ul(t){var n=yo.current;je(yo),t._currentValue=n}function Vl(t,n,s){for(;t!==null;){var g=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,g!==null&&(g.childLanes|=n)):g!==null&&(g.childLanes&n)!==n&&(g.childLanes|=n),t===s)break;t=t.return}}function Qn(t,n){wo=t,$l=Gn=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&n)!==0&&(xt=!0),t.firstContext=null)}function Ft(t){var n=t._currentValue;if($l!==t)if(t={context:t,memoizedValue:n,next:null},Gn===null){if(wo===null)throw Error(i(308));Gn=t,wo.dependencies={lanes:0,firstContext:t}}else Gn=Gn.next=t;return n}var dn=null;function ql(t){dn===null?dn=[t]:dn.push(t)}function hd(t,n,s,g){var E=n.interleaved;return E===null?(s.next=s,ql(n)):(s.next=E.next,E.next=s),n.interleaved=s,yr(t,g)}function yr(t,n){t.lanes|=n;var s=t.alternate;for(s!==null&&(s.lanes|=n),s=t,t=t.return;t!==null;)t.childLanes|=n,s=t.alternate,s!==null&&(s.childLanes|=n),s=t,t=t.return;return s.tag===3?s.stateNode:null}var zr=!1;function Kl(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function dd(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function wr(t,n){return{eventTime:t,lane:n,tag:0,payload:null,callback:null,next:null}}function $r(t,n,s){var g=t.updateQueue;if(g===null)return null;if(g=g.shared,(Me&2)!==0){var E=g.pending;return E===null?n.next=n:(n.next=E.next,E.next=n),g.pending=n,yr(t,s)}return E=g.interleaved,E===null?(n.next=n,ql(g)):(n.next=E.next,E.next=n),g.interleaved=n,yr(t,s)}function So(t,n,s){if(n=n.updateQueue,n!==null&&(n=n.shared,(s&4194240)!==0)){var g=n.lanes;g&=t.pendingLanes,s|=g,n.lanes=s,al(t,s)}}function fd(t,n){var s=t.updateQueue,g=t.alternate;if(g!==null&&(g=g.updateQueue,s===g)){var E=null,A=null;if(s=s.firstBaseUpdate,s!==null){do{var $={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};A===null?E=A=$:A=A.next=$,s=s.next}while(s!==null);A===null?E=A=n:A=A.next=n}else E=A=n;s={baseState:g.baseState,firstBaseUpdate:E,lastBaseUpdate:A,shared:g.shared,effects:g.effects},t.updateQueue=s;return}t=s.lastBaseUpdate,t===null?s.firstBaseUpdate=n:t.next=n,s.lastBaseUpdate=n}function Co(t,n,s,g){var E=t.updateQueue;zr=!1;var A=E.firstBaseUpdate,$=E.lastBaseUpdate,G=E.shared.pending;if(G!==null){E.shared.pending=null;var Q=G,oe=Q.next;Q.next=null,$===null?A=oe:$.next=oe,$=Q;var de=t.alternate;de!==null&&(de=de.updateQueue,G=de.lastBaseUpdate,G!==$&&(G===null?de.firstBaseUpdate=oe:G.next=oe,de.lastBaseUpdate=Q))}if(A!==null){var fe=E.baseState;$=0,de=oe=Q=null,G=A;do{var he=G.lane,me=G.eventTime;if((g&he)===he){de!==null&&(de=de.next={eventTime:me,lane:0,tag:G.tag,payload:G.payload,callback:G.callback,next:null});e:{var ye=t,we=G;switch(he=n,me=s,we.tag){case 1:if(ye=we.payload,typeof ye=="function"){fe=ye.call(me,fe,he);break e}fe=ye;break e;case 3:ye.flags=ye.flags&-65537|128;case 0:if(ye=we.payload,he=typeof ye=="function"?ye.call(me,fe,he):ye,he==null)break e;fe=B({},fe,he);break e;case 2:zr=!0}}G.callback!==null&&G.lane!==0&&(t.flags|=64,he=E.effects,he===null?E.effects=[G]:he.push(G))}else me={eventTime:me,lane:he,tag:G.tag,payload:G.payload,callback:G.callback,next:null},de===null?(oe=de=me,Q=fe):de=de.next=me,$|=he;if(G=G.next,G===null){if(G=E.shared.pending,G===null)break;he=G,G=he.next,he.next=null,E.lastBaseUpdate=he,E.shared.pending=null}}while(!0);if(de===null&&(Q=fe),E.baseState=Q,E.firstBaseUpdate=oe,E.lastBaseUpdate=de,n=E.shared.interleaved,n!==null){E=n;do $|=E.lane,E=E.next;while(E!==n)}else A===null&&(E.shared.lanes=0);_n|=$,t.lanes=$,t.memoizedState=fe}}function pd(t,n,s){if(t=n.effects,n.effects=null,t!==null)for(n=0;n<t.length;n++){var g=t[n],E=g.callback;if(E!==null){if(g.callback=null,g=s,typeof E!="function")throw Error(i(191,E));E.call(g)}}}var Yi={},sr=Hr(Yi),Gi=Hr(Yi),Qi=Hr(Yi);function fn(t){if(t===Yi)throw Error(i(174));return t}function Xl(t,n){switch(He(Qi,n),He(Gi,t),He(sr,Yi),t=n.nodeType,t){case 9:case 11:n=(n=n.documentElement)?n.namespaceURI:ht(null,"");break;default:t=t===8?n.parentNode:n,n=t.namespaceURI||null,t=t.tagName,n=ht(n,t)}je(sr),He(sr,n)}function Jn(){je(sr),je(Gi),je(Qi)}function _d(t){fn(Qi.current);var n=fn(sr.current),s=ht(n,t.type);n!==s&&(He(Gi,t),He(sr,s))}function Yl(t){Gi.current===t&&(je(sr),je(Gi))}var Xe=Hr(0);function xo(t){for(var n=t;n!==null;){if(n.tag===13){var s=n.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||s.data==="$?"||s.data==="$!"))return n}else if(n.tag===19&&n.memoizedProps.revealOrder!==void 0){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Gl=[];function Ql(){for(var t=0;t<Gl.length;t++)Gl[t]._workInProgressVersionPrimary=null;Gl.length=0}var bo=w.ReactCurrentDispatcher,Jl=w.ReactCurrentBatchConfig,pn=0,Ye=null,nt=null,at=null,Eo=!1,Ji=!1,Zi=0,p0=0;function gt(){throw Error(i(321))}function Zl(t,n){if(n===null)return!1;for(var s=0;s<n.length&&s<t.length;s++)if(!Ut(t[s],n[s]))return!1;return!0}function ec(t,n,s,g,E,A){if(pn=A,Ye=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,bo.current=t===null||t.memoizedState===null?v0:y0,t=s(g,E),Ji){A=0;do{if(Ji=!1,Zi=0,25<=A)throw Error(i(301));A+=1,at=nt=null,n.updateQueue=null,bo.current=w0,t=s(g,E)}while(Ji)}if(bo.current=Ro,n=nt!==null&&nt.next!==null,pn=0,at=nt=Ye=null,Eo=!1,n)throw Error(i(300));return t}function tc(){var t=Zi!==0;return Zi=0,t}function or(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return at===null?Ye.memoizedState=at=t:at=at.next=t,at}function jt(){if(nt===null){var t=Ye.alternate;t=t!==null?t.memoizedState:null}else t=nt.next;var n=at===null?Ye.memoizedState:at.next;if(n!==null)at=n,nt=t;else{if(t===null)throw Error(i(310));nt=t,t={memoizedState:nt.memoizedState,baseState:nt.baseState,baseQueue:nt.baseQueue,queue:nt.queue,next:null},at===null?Ye.memoizedState=at=t:at=at.next=t}return at}function es(t,n){return typeof n=="function"?n(t):n}function rc(t){var n=jt(),s=n.queue;if(s===null)throw Error(i(311));s.lastRenderedReducer=t;var g=nt,E=g.baseQueue,A=s.pending;if(A!==null){if(E!==null){var $=E.next;E.next=A.next,A.next=$}g.baseQueue=E=A,s.pending=null}if(E!==null){A=E.next,g=g.baseState;var G=$=null,Q=null,oe=A;do{var de=oe.lane;if((pn&de)===de)Q!==null&&(Q=Q.next={lane:0,action:oe.action,hasEagerState:oe.hasEagerState,eagerState:oe.eagerState,next:null}),g=oe.hasEagerState?oe.eagerState:t(g,oe.action);else{var fe={lane:de,action:oe.action,hasEagerState:oe.hasEagerState,eagerState:oe.eagerState,next:null};Q===null?(G=Q=fe,$=g):Q=Q.next=fe,Ye.lanes|=de,_n|=de}oe=oe.next}while(oe!==null&&oe!==A);Q===null?$=g:Q.next=G,Ut(g,n.memoizedState)||(xt=!0),n.memoizedState=g,n.baseState=$,n.baseQueue=Q,s.lastRenderedState=g}if(t=s.interleaved,t!==null){E=t;do A=E.lane,Ye.lanes|=A,_n|=A,E=E.next;while(E!==t)}else E===null&&(s.lanes=0);return[n.memoizedState,s.dispatch]}function nc(t){var n=jt(),s=n.queue;if(s===null)throw Error(i(311));s.lastRenderedReducer=t;var g=s.dispatch,E=s.pending,A=n.memoizedState;if(E!==null){s.pending=null;var $=E=E.next;do A=t(A,$.action),$=$.next;while($!==E);Ut(A,n.memoizedState)||(xt=!0),n.memoizedState=A,n.baseQueue===null&&(n.baseState=A),s.lastRenderedState=A}return[A,g]}function gd(){}function md(t,n){var s=Ye,g=jt(),E=n(),A=!Ut(g.memoizedState,E);if(A&&(g.memoizedState=E,xt=!0),g=g.queue,ic(wd.bind(null,s,g,t),[t]),g.getSnapshot!==n||A||at!==null&&at.memoizedState.tag&1){if(s.flags|=2048,ts(9,yd.bind(null,s,g,E,n),void 0,null),lt===null)throw Error(i(349));(pn&30)!==0||vd(s,n,E)}return E}function vd(t,n,s){t.flags|=16384,t={getSnapshot:n,value:s},n=Ye.updateQueue,n===null?(n={lastEffect:null,stores:null},Ye.updateQueue=n,n.stores=[t]):(s=n.stores,s===null?n.stores=[t]:s.push(t))}function yd(t,n,s,g){n.value=s,n.getSnapshot=g,Sd(n)&&Cd(t)}function wd(t,n,s){return s(function(){Sd(n)&&Cd(t)})}function Sd(t){var n=t.getSnapshot;t=t.value;try{var s=n();return!Ut(t,s)}catch{return!0}}function Cd(t){var n=yr(t,1);n!==null&&Yt(n,t,1,-1)}function xd(t){var n=or();return typeof t=="function"&&(t=t()),n.memoizedState=n.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:es,lastRenderedState:t},n.queue=t,t=t.dispatch=m0.bind(null,Ye,t),[n.memoizedState,t]}function ts(t,n,s,g){return t={tag:t,create:n,destroy:s,deps:g,next:null},n=Ye.updateQueue,n===null?(n={lastEffect:null,stores:null},Ye.updateQueue=n,n.lastEffect=t.next=t):(s=n.lastEffect,s===null?n.lastEffect=t.next=t:(g=s.next,s.next=t,t.next=g,n.lastEffect=t)),t}function bd(){return jt().memoizedState}function ko(t,n,s,g){var E=or();Ye.flags|=t,E.memoizedState=ts(1|n,s,void 0,g===void 0?null:g)}function Lo(t,n,s,g){var E=jt();g=g===void 0?null:g;var A=void 0;if(nt!==null){var $=nt.memoizedState;if(A=$.destroy,g!==null&&Zl(g,$.deps)){E.memoizedState=ts(n,s,A,g);return}}Ye.flags|=t,E.memoizedState=ts(1|n,s,A,g)}function Ed(t,n){return ko(8390656,8,t,n)}function ic(t,n){return Lo(2048,8,t,n)}function kd(t,n){return Lo(4,2,t,n)}function Ld(t,n){return Lo(4,4,t,n)}function Rd(t,n){if(typeof n=="function")return t=t(),n(t),function(){n(null)};if(n!=null)return t=t(),n.current=t,function(){n.current=null}}function Dd(t,n,s){return s=s!=null?s.concat([t]):null,Lo(4,4,Rd.bind(null,n,t),s)}function sc(){}function Ad(t,n){var s=jt();n=n===void 0?null:n;var g=s.memoizedState;return g!==null&&n!==null&&Zl(n,g[1])?g[0]:(s.memoizedState=[t,n],t)}function Td(t,n){var s=jt();n=n===void 0?null:n;var g=s.memoizedState;return g!==null&&n!==null&&Zl(n,g[1])?g[0]:(t=t(),s.memoizedState=[t,n],t)}function Md(t,n,s){return(pn&21)===0?(t.baseState&&(t.baseState=!1,xt=!0),t.memoizedState=s):(Ut(s,n)||(s=Bn(),Ye.lanes|=s,_n|=s,t.baseState=!0),n)}function _0(t,n){var s=Be;Be=s!==0&&4>s?s:4,t(!0);var g=Jl.transition;Jl.transition={};try{t(!1),n()}finally{Be=s,Jl.transition=g}}function Pd(){return jt().memoizedState}function g0(t,n,s){var g=qr(t);if(s={lane:g,action:s,hasEagerState:!1,eagerState:null,next:null},Nd(t))Bd(n,s);else if(s=hd(t,n,s,g),s!==null){var E=wt();Yt(s,t,g,E),Id(s,n,g)}}function m0(t,n,s){var g=qr(t),E={lane:g,action:s,hasEagerState:!1,eagerState:null,next:null};if(Nd(t))Bd(n,E);else{var A=t.alternate;if(t.lanes===0&&(A===null||A.lanes===0)&&(A=n.lastRenderedReducer,A!==null))try{var $=n.lastRenderedState,G=A($,s);if(E.hasEagerState=!0,E.eagerState=G,Ut(G,$)){var Q=n.interleaved;Q===null?(E.next=E,ql(n)):(E.next=Q.next,Q.next=E),n.interleaved=E;return}}catch{}finally{}s=hd(t,n,E,g),s!==null&&(E=wt(),Yt(s,t,g,E),Id(s,n,g))}}function Nd(t){var n=t.alternate;return t===Ye||n!==null&&n===Ye}function Bd(t,n){Ji=Eo=!0;var s=t.pending;s===null?n.next=n:(n.next=s.next,s.next=n),t.pending=n}function Id(t,n,s){if((s&4194240)!==0){var g=n.lanes;g&=t.pendingLanes,s|=g,n.lanes=s,al(t,s)}}var Ro={readContext:Ft,useCallback:gt,useContext:gt,useEffect:gt,useImperativeHandle:gt,useInsertionEffect:gt,useLayoutEffect:gt,useMemo:gt,useReducer:gt,useRef:gt,useState:gt,useDebugValue:gt,useDeferredValue:gt,useTransition:gt,useMutableSource:gt,useSyncExternalStore:gt,useId:gt,unstable_isNewReconciler:!1},v0={readContext:Ft,useCallback:function(t,n){return or().memoizedState=[t,n===void 0?null:n],t},useContext:Ft,useEffect:Ed,useImperativeHandle:function(t,n,s){return s=s!=null?s.concat([t]):null,ko(4194308,4,Rd.bind(null,n,t),s)},useLayoutEffect:function(t,n){return ko(4194308,4,t,n)},useInsertionEffect:function(t,n){return ko(4,2,t,n)},useMemo:function(t,n){var s=or();return n=n===void 0?null:n,t=t(),s.memoizedState=[t,n],t},useReducer:function(t,n,s){var g=or();return n=s!==void 0?s(n):n,g.memoizedState=g.baseState=n,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:n},g.queue=t,t=t.dispatch=g0.bind(null,Ye,t),[g.memoizedState,t]},useRef:function(t){var n=or();return t={current:t},n.memoizedState=t},useState:xd,useDebugValue:sc,useDeferredValue:function(t){return or().memoizedState=t},useTransition:function(){var t=xd(!1),n=t[0];return t=_0.bind(null,t[1]),or().memoizedState=t,[n,t]},useMutableSource:function(){},useSyncExternalStore:function(t,n,s){var g=Ye,E=or();if(We){if(s===void 0)throw Error(i(407));s=s()}else{if(s=n(),lt===null)throw Error(i(349));(pn&30)!==0||vd(g,n,s)}E.memoizedState=s;var A={value:s,getSnapshot:n};return E.queue=A,Ed(wd.bind(null,g,A,t),[t]),g.flags|=2048,ts(9,yd.bind(null,g,A,s,n),void 0,null),s},useId:function(){var t=or(),n=lt.identifierPrefix;if(We){var s=vr,g=mr;s=(g&~(1<<32-Dt(g)-1)).toString(32)+s,n=":"+n+"R"+s,s=Zi++,0<s&&(n+="H"+s.toString(32)),n+=":"}else s=p0++,n=":"+n+"r"+s.toString(32)+":";return t.memoizedState=n},unstable_isNewReconciler:!1},y0={readContext:Ft,useCallback:Ad,useContext:Ft,useEffect:ic,useImperativeHandle:Dd,useInsertionEffect:kd,useLayoutEffect:Ld,useMemo:Td,useReducer:rc,useRef:bd,useState:function(){return rc(es)},useDebugValue:sc,useDeferredValue:function(t){var n=jt();return Md(n,nt.memoizedState,t)},useTransition:function(){var t=rc(es)[0],n=jt().memoizedState;return[t,n]},useMutableSource:gd,useSyncExternalStore:md,useId:Pd,unstable_isNewReconciler:!1},w0={readContext:Ft,useCallback:Ad,useContext:Ft,useEffect:ic,useImperativeHandle:Dd,useInsertionEffect:kd,useLayoutEffect:Ld,useMemo:Td,useReducer:nc,useRef:bd,useState:function(){return nc(es)},useDebugValue:sc,useDeferredValue:function(t){var n=jt();return nt===null?n.memoizedState=t:Md(n,nt.memoizedState,t)},useTransition:function(){var t=nc(es)[0],n=jt().memoizedState;return[t,n]},useMutableSource:gd,useSyncExternalStore:md,useId:Pd,unstable_isNewReconciler:!1};function qt(t,n){if(t&&t.defaultProps){n=B({},n),t=t.defaultProps;for(var s in t)n[s]===void 0&&(n[s]=t[s]);return n}return n}function oc(t,n,s,g){n=t.memoizedState,s=s(g,n),s=s==null?n:B({},n,s),t.memoizedState=s,t.lanes===0&&(t.updateQueue.baseState=s)}var Do={isMounted:function(t){return(t=t._reactInternals)?rr(t)===t:!1},enqueueSetState:function(t,n,s){t=t._reactInternals;var g=wt(),E=qr(t),A=wr(g,E);A.payload=n,s!=null&&(A.callback=s),n=$r(t,A,E),n!==null&&(Yt(n,t,E,g),So(n,t,E))},enqueueReplaceState:function(t,n,s){t=t._reactInternals;var g=wt(),E=qr(t),A=wr(g,E);A.tag=1,A.payload=n,s!=null&&(A.callback=s),n=$r(t,A,E),n!==null&&(Yt(n,t,E,g),So(n,t,E))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var s=wt(),g=qr(t),E=wr(s,g);E.tag=2,n!=null&&(E.callback=n),n=$r(t,E,g),n!==null&&(Yt(n,t,g,s),So(n,t,g))}};function Od(t,n,s,g,E,A,$){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(g,A,$):n.prototype&&n.prototype.isPureReactComponent?!zi(s,g)||!zi(E,A):!0}function Hd(t,n,s){var g=!1,E=Fr,A=n.contextType;return typeof A=="object"&&A!==null?A=Ft(A):(E=Ct(n)?cn:_t.current,g=n.contextTypes,A=(g=g!=null)?Vn(t,E):Fr),n=new n(s,A),t.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,n.updater=Do,t.stateNode=n,n._reactInternals=t,g&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=E,t.__reactInternalMemoizedMaskedChildContext=A),n}function Fd(t,n,s,g){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(s,g),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(s,g),n.state!==t&&Do.enqueueReplaceState(n,n.state,null)}function ac(t,n,s,g){var E=t.stateNode;E.props=s,E.state=t.memoizedState,E.refs={},Kl(t);var A=n.contextType;typeof A=="object"&&A!==null?E.context=Ft(A):(A=Ct(n)?cn:_t.current,E.context=Vn(t,A)),E.state=t.memoizedState,A=n.getDerivedStateFromProps,typeof A=="function"&&(oc(t,n,A,s),E.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(n=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),n!==E.state&&Do.enqueueReplaceState(E,E.state,null),Co(t,s,E,g),E.state=t.memoizedState),typeof E.componentDidMount=="function"&&(t.flags|=4194308)}function Zn(t,n){try{var s="",g=n;do s+=ie(g),g=g.return;while(g);var E=s}catch(A){E=`
39
39
  Error generating stack: `+A.message+`
40
- `+A.stack}return{value:t,source:n,stack:E,digest:null}}function lc(t,n,s){return{value:t,source:null,stack:s??null,digest:n??null}}function cc(t,n){try{console.error(n.value)}catch(s){setTimeout(function(){throw s})}}var S0=typeof WeakMap=="function"?WeakMap:Map;function jd(t,n,s){s=wr(-1,s),s.tag=3,s.payload={element:null};var g=n.value;return s.callback=function(){Io||(Io=!0,bc=g),cc(t,n)},s}function zd(t,n,s){s=wr(-1,s),s.tag=3;var g=t.type.getDerivedStateFromError;if(typeof g=="function"){var E=n.value;s.payload=function(){return g(E)},s.callback=function(){cc(t,n)}}var A=t.stateNode;return A!==null&&typeof A.componentDidCatch=="function"&&(s.callback=function(){cc(t,n),typeof g!="function"&&(Ur===null?Ur=new Set([this]):Ur.add(this));var $=n.stack;this.componentDidCatch(n.value,{componentStack:$!==null?$:""})}),s}function $d(t,n,s){var g=t.pingCache;if(g===null){g=t.pingCache=new S0;var E=new Set;g.set(n,E)}else E=g.get(n),E===void 0&&(E=new Set,g.set(n,E));E.has(s)||(E.add(s),t=B0.bind(null,t,n,s),n.then(t,t))}function Wd(t){do{var n;if((n=t.tag===13)&&(n=t.memoizedState,n=n!==null?n.dehydrated!==null:!0),n)return t;t=t.return}while(t!==null);return null}function Ud(t,n,s,g,E){return(t.mode&1)===0?(t===n?t.flags|=65536:(t.flags|=128,s.flags|=131072,s.flags&=-52805,s.tag===1&&(s.alternate===null?s.tag=17:(n=wr(-1,1),n.tag=2,$r(s,n,1))),s.lanes|=1),t):(t.flags|=65536,t.lanes=E,t)}var C0=w.ReactCurrentOwner,xt=!1;function yt(t,n,s,g){n.child=t===null?ud(n,null,s,g):Yn(n,t.child,s,g)}function Vd(t,n,s,g,E){s=s.render;var A=n.ref;return Qn(n,E),g=ec(t,n,s,g,A,E),s=tc(),t!==null&&!xt?(n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~E,Sr(t,n,E)):(We&&s&&Ol(n),n.flags|=1,yt(t,n,g,E),n.child)}function qd(t,n,s,g,E){if(t===null){var A=s.type;return typeof A=="function"&&!Tc(A)&&A.defaultProps===void 0&&s.compare===null&&s.defaultProps===void 0?(n.tag=15,n.type=A,Kd(t,n,A,g,E)):(t=$o(s.type,null,g,n,n.mode,E),t.ref=n.ref,t.return=n,n.child=t)}if(A=t.child,(t.lanes&E)===0){var $=A.memoizedProps;if(s=s.compare,s=s!==null?s:zi,s($,g)&&t.ref===n.ref)return Sr(t,n,E)}return n.flags|=1,t=Xr(A,g),t.ref=n.ref,t.return=n,n.child=t}function Kd(t,n,s,g,E){if(t!==null){var A=t.memoizedProps;if(zi(A,g)&&t.ref===n.ref)if(xt=!1,n.pendingProps=g=A,(t.lanes&E)!==0)(t.flags&131072)!==0&&(xt=!0);else return n.lanes=t.lanes,Sr(t,n,E)}return uc(t,n,s,g,E)}function Xd(t,n,s){var g=n.pendingProps,E=g.children,A=t!==null?t.memoizedState:null;if(g.mode==="hidden")if((n.mode&1)===0)n.memoizedState={baseLanes:0,cachePool:null,transitions:null},He(ti,Pt),Pt|=s;else{if((s&1073741824)===0)return t=A!==null?A.baseLanes|s:s,n.lanes=n.childLanes=1073741824,n.memoizedState={baseLanes:t,cachePool:null,transitions:null},n.updateQueue=null,He(ti,Pt),Pt|=t,null;n.memoizedState={baseLanes:0,cachePool:null,transitions:null},g=A!==null?A.baseLanes:s,He(ti,Pt),Pt|=g}else A!==null?(g=A.baseLanes|s,n.memoizedState=null):g=s,He(ti,Pt),Pt|=g;return yt(t,n,E,s),n.child}function Yd(t,n){var s=n.ref;(t===null&&s!==null||t!==null&&t.ref!==s)&&(n.flags|=512,n.flags|=2097152)}function uc(t,n,s,g,E){var A=Ct(s)?cn:_t.current;return A=Vn(n,A),Qn(n,E),s=ec(t,n,s,g,A,E),g=tc(),t!==null&&!xt?(n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~E,Sr(t,n,E)):(We&&g&&Ol(n),n.flags|=1,yt(t,n,s,E),n.child)}function Gd(t,n,s,g,E){if(Ct(s)){var A=!0;fo(n)}else A=!1;if(Qn(n,E),n.stateNode===null)To(t,n),Hd(n,s,g),ac(n,s,g,E),g=!0;else if(t===null){var $=n.stateNode,Y=n.memoizedProps;$.props=Y;var Q=$.context,oe=s.contextType;typeof oe=="object"&&oe!==null?oe=Ft(oe):(oe=Ct(s)?cn:_t.current,oe=Vn(n,oe));var de=s.getDerivedStateFromProps,fe=typeof de=="function"||typeof $.getSnapshotBeforeUpdate=="function";fe||typeof $.UNSAFE_componentWillReceiveProps!="function"&&typeof $.componentWillReceiveProps!="function"||(Y!==g||Q!==oe)&&Fd(n,$,g,oe),zr=!1;var he=n.memoizedState;$.state=he,Co(n,g,$,E),Q=n.memoizedState,Y!==g||he!==Q||St.current||zr?(typeof de=="function"&&(oc(n,s,de,g),Q=n.memoizedState),(Y=zr||Od(n,s,Y,g,he,Q,oe))?(fe||typeof $.UNSAFE_componentWillMount!="function"&&typeof $.componentWillMount!="function"||(typeof $.componentWillMount=="function"&&$.componentWillMount(),typeof $.UNSAFE_componentWillMount=="function"&&$.UNSAFE_componentWillMount()),typeof $.componentDidMount=="function"&&(n.flags|=4194308)):(typeof $.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=g,n.memoizedState=Q),$.props=g,$.state=Q,$.context=oe,g=Y):(typeof $.componentDidMount=="function"&&(n.flags|=4194308),g=!1)}else{$=n.stateNode,dd(t,n),Y=n.memoizedProps,oe=n.type===n.elementType?Y:qt(n.type,Y),$.props=oe,fe=n.pendingProps,he=$.context,Q=s.contextType,typeof Q=="object"&&Q!==null?Q=Ft(Q):(Q=Ct(s)?cn:_t.current,Q=Vn(n,Q));var me=s.getDerivedStateFromProps;(de=typeof me=="function"||typeof $.getSnapshotBeforeUpdate=="function")||typeof $.UNSAFE_componentWillReceiveProps!="function"&&typeof $.componentWillReceiveProps!="function"||(Y!==fe||he!==Q)&&Fd(n,$,g,Q),zr=!1,he=n.memoizedState,$.state=he,Co(n,g,$,E);var ye=n.memoizedState;Y!==fe||he!==ye||St.current||zr?(typeof me=="function"&&(oc(n,s,me,g),ye=n.memoizedState),(oe=zr||Od(n,s,oe,g,he,ye,Q)||!1)?(de||typeof $.UNSAFE_componentWillUpdate!="function"&&typeof $.componentWillUpdate!="function"||(typeof $.componentWillUpdate=="function"&&$.componentWillUpdate(g,ye,Q),typeof $.UNSAFE_componentWillUpdate=="function"&&$.UNSAFE_componentWillUpdate(g,ye,Q)),typeof $.componentDidUpdate=="function"&&(n.flags|=4),typeof $.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof $.componentDidUpdate!="function"||Y===t.memoizedProps&&he===t.memoizedState||(n.flags|=4),typeof $.getSnapshotBeforeUpdate!="function"||Y===t.memoizedProps&&he===t.memoizedState||(n.flags|=1024),n.memoizedProps=g,n.memoizedState=ye),$.props=g,$.state=ye,$.context=Q,g=oe):(typeof $.componentDidUpdate!="function"||Y===t.memoizedProps&&he===t.memoizedState||(n.flags|=4),typeof $.getSnapshotBeforeUpdate!="function"||Y===t.memoizedProps&&he===t.memoizedState||(n.flags|=1024),g=!1)}return hc(t,n,s,g,A,E)}function hc(t,n,s,g,E,A){Yd(t,n);var $=(n.flags&128)!==0;if(!g&&!$)return E&&td(n,s,!1),Sr(t,n,A);g=n.stateNode,C0.current=n;var Y=$&&typeof s.getDerivedStateFromError!="function"?null:g.render();return n.flags|=1,t!==null&&$?(n.child=Yn(n,t.child,null,A),n.child=Yn(n,null,Y,A)):yt(t,n,Y,A),n.memoizedState=g.state,E&&td(n,s,!0),n.child}function Qd(t){var n=t.stateNode;n.pendingContext?Zh(t,n.pendingContext,n.pendingContext!==n.context):n.context&&Zh(t,n.context,!1),Xl(t,n.containerInfo)}function Jd(t,n,s,g,E){return Xn(),zl(E),n.flags|=256,yt(t,n,s,g),n.child}var dc={dehydrated:null,treeContext:null,retryLane:0};function fc(t){return{baseLanes:t,cachePool:null,transitions:null}}function Zd(t,n,s){var g=n.pendingProps,E=Xe.current,A=!1,$=(n.flags&128)!==0,Y;if((Y=$)||(Y=t!==null&&t.memoizedState===null?!1:(E&2)!==0),Y?(A=!0,n.flags&=-129):(t===null||t.memoizedState!==null)&&(E|=1),He(Xe,E&1),t===null)return jl(n),t=n.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?((n.mode&1)===0?n.lanes=1:t.data==="$!"?n.lanes=8:n.lanes=1073741824,null):($=g.children,t=g.fallback,A?(g=n.mode,A=n.child,$={mode:"hidden",children:$},(g&1)===0&&A!==null?(A.childLanes=0,A.pendingProps=$):A=Wo($,g,0,null),t=yn(t,g,s,null),A.return=n,t.return=n,A.sibling=t,n.child=A,n.child.memoizedState=fc(s),n.memoizedState=dc,t):pc(n,$));if(E=t.memoizedState,E!==null&&(Y=E.dehydrated,Y!==null))return x0(t,n,$,g,Y,E,s);if(A){A=g.fallback,$=n.mode,E=t.child,Y=E.sibling;var Q={mode:"hidden",children:g.children};return($&1)===0&&n.child!==E?(g=n.child,g.childLanes=0,g.pendingProps=Q,n.deletions=null):(g=Xr(E,Q),g.subtreeFlags=E.subtreeFlags&14680064),Y!==null?A=Xr(Y,A):(A=yn(A,$,s,null),A.flags|=2),A.return=n,g.return=n,g.sibling=A,n.child=g,g=A,A=n.child,$=t.child.memoizedState,$=$===null?fc(s):{baseLanes:$.baseLanes|s,cachePool:null,transitions:$.transitions},A.memoizedState=$,A.childLanes=t.childLanes&~s,n.memoizedState=dc,g}return A=t.child,t=A.sibling,g=Xr(A,{mode:"visible",children:g.children}),(n.mode&1)===0&&(g.lanes=s),g.return=n,g.sibling=null,t!==null&&(s=n.deletions,s===null?(n.deletions=[t],n.flags|=16):s.push(t)),n.child=g,n.memoizedState=null,g}function pc(t,n){return n=Wo({mode:"visible",children:n},t.mode,0,null),n.return=t,t.child=n}function Ao(t,n,s,g){return g!==null&&zl(g),Yn(n,t.child,null,s),t=pc(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function x0(t,n,s,g,E,A,$){if(s)return n.flags&256?(n.flags&=-257,g=lc(Error(i(422))),Ao(t,n,$,g)):n.memoizedState!==null?(n.child=t.child,n.flags|=128,null):(A=g.fallback,E=n.mode,g=Wo({mode:"visible",children:g.children},E,0,null),A=yn(A,E,$,null),A.flags|=2,g.return=n,A.return=n,g.sibling=A,n.child=g,(n.mode&1)!==0&&Yn(n,t.child,null,$),n.child.memoizedState=fc($),n.memoizedState=dc,A);if((n.mode&1)===0)return Ao(t,n,$,null);if(E.data==="$!"){if(g=E.nextSibling&&E.nextSibling.dataset,g)var Y=g.dgst;return g=Y,A=Error(i(419)),g=lc(A,g,void 0),Ao(t,n,$,g)}if(Y=($&t.childLanes)!==0,xt||Y){if(g=lt,g!==null){switch($&-$){case 4:E=2;break;case 16:E=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:E=32;break;case 536870912:E=268435456;break;default:E=0}E=(E&(g.suspendedLanes|$))!==0?0:E,E!==0&&E!==A.retryLane&&(A.retryLane=E,yr(t,E),Yt(g,t,E,-1))}return Ac(),g=lc(Error(i(421))),Ao(t,n,$,g)}return E.data==="$?"?(n.flags|=128,n.child=t.child,n=I0.bind(null,t),E._reactRetry=n,null):(t=A.treeContext,Mt=Or(E.nextSibling),Tt=n,We=!0,Vt=null,t!==null&&(Ot[Ht++]=mr,Ot[Ht++]=vr,Ot[Ht++]=un,mr=t.id,vr=t.overflow,un=n),n=pc(n,g.children),n.flags|=4096,n)}function ef(t,n,s){t.lanes|=n;var g=t.alternate;g!==null&&(g.lanes|=n),Vl(t.return,n,s)}function _c(t,n,s,g,E){var A=t.memoizedState;A===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:g,tail:s,tailMode:E}:(A.isBackwards=n,A.rendering=null,A.renderingStartTime=0,A.last=g,A.tail=s,A.tailMode=E)}function tf(t,n,s){var g=n.pendingProps,E=g.revealOrder,A=g.tail;if(yt(t,n,g.children,s),g=Xe.current,(g&2)!==0)g=g&1|2,n.flags|=128;else{if(t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&ef(t,s,n);else if(t.tag===19)ef(t,s,n);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break e;for(;t.sibling===null;){if(t.return===null||t.return===n)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}g&=1}if(He(Xe,g),(n.mode&1)===0)n.memoizedState=null;else switch(E){case"forwards":for(s=n.child,E=null;s!==null;)t=s.alternate,t!==null&&xo(t)===null&&(E=s),s=s.sibling;s=E,s===null?(E=n.child,n.child=null):(E=s.sibling,s.sibling=null),_c(n,!1,E,s,A);break;case"backwards":for(s=null,E=n.child,n.child=null;E!==null;){if(t=E.alternate,t!==null&&xo(t)===null){n.child=E;break}t=E.sibling,E.sibling=s,s=E,E=t}_c(n,!0,s,null,A);break;case"together":_c(n,!1,null,null,void 0);break;default:n.memoizedState=null}return n.child}function To(t,n){(n.mode&1)===0&&t!==null&&(t.alternate=null,n.alternate=null,n.flags|=2)}function Sr(t,n,s){if(t!==null&&(n.dependencies=t.dependencies),_n|=n.lanes,(s&n.childLanes)===0)return null;if(t!==null&&n.child!==t.child)throw Error(i(153));if(n.child!==null){for(t=n.child,s=Xr(t,t.pendingProps),n.child=s,s.return=n;t.sibling!==null;)t=t.sibling,s=s.sibling=Xr(t,t.pendingProps),s.return=n;s.sibling=null}return n.child}function b0(t,n,s){switch(n.tag){case 3:Qd(n),Xn();break;case 5:_d(n);break;case 1:Ct(n.type)&&fo(n);break;case 4:Xl(n,n.stateNode.containerInfo);break;case 10:var g=n.type._context,E=n.memoizedProps.value;He(yo,g._currentValue),g._currentValue=E;break;case 13:if(g=n.memoizedState,g!==null)return g.dehydrated!==null?(He(Xe,Xe.current&1),n.flags|=128,null):(s&n.child.childLanes)!==0?Zd(t,n,s):(He(Xe,Xe.current&1),t=Sr(t,n,s),t!==null?t.sibling:null);He(Xe,Xe.current&1);break;case 19:if(g=(s&n.childLanes)!==0,(t.flags&128)!==0){if(g)return tf(t,n,s);n.flags|=128}if(E=n.memoizedState,E!==null&&(E.rendering=null,E.tail=null,E.lastEffect=null),He(Xe,Xe.current),g)break;return null;case 22:case 23:return n.lanes=0,Xd(t,n,s)}return Sr(t,n,s)}var rf,gc,nf,sf;rf=function(t,n){for(var s=n.child;s!==null;){if(s.tag===5||s.tag===6)t.appendChild(s.stateNode);else if(s.tag!==4&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return;s=s.return}s.sibling.return=s.return,s=s.sibling}},gc=function(){},nf=function(t,n,s,g){var E=t.memoizedProps;if(E!==g){t=n.stateNode,fn(sr.current);var A=null;switch(s){case"input":E=Se(t,E),g=Se(t,g),A=[];break;case"select":E=B({},E,{value:void 0}),g=B({},g,{value:void 0}),A=[];break;case"textarea":E=ut(t,E),g=ut(t,g),A=[];break;default:typeof E.onClick!="function"&&typeof g.onClick=="function"&&(t.onclick=co)}vi(s,g);var $;s=null;for(oe in E)if(!g.hasOwnProperty(oe)&&E.hasOwnProperty(oe)&&E[oe]!=null)if(oe==="style"){var Y=E[oe];for($ in Y)Y.hasOwnProperty($)&&(s||(s={}),s[$]="")}else oe!=="dangerouslySetInnerHTML"&&oe!=="children"&&oe!=="suppressContentEditableWarning"&&oe!=="suppressHydrationWarning"&&oe!=="autoFocus"&&(h.hasOwnProperty(oe)?A||(A=[]):(A=A||[]).push(oe,null));for(oe in g){var Q=g[oe];if(Y=E!=null?E[oe]:void 0,g.hasOwnProperty(oe)&&Q!==Y&&(Q!=null||Y!=null))if(oe==="style")if(Y){for($ in Y)!Y.hasOwnProperty($)||Q&&Q.hasOwnProperty($)||(s||(s={}),s[$]="");for($ in Q)Q.hasOwnProperty($)&&Y[$]!==Q[$]&&(s||(s={}),s[$]=Q[$])}else s||(A||(A=[]),A.push(oe,s)),s=Q;else oe==="dangerouslySetInnerHTML"?(Q=Q?Q.__html:void 0,Y=Y?Y.__html:void 0,Q!=null&&Y!==Q&&(A=A||[]).push(oe,Q)):oe==="children"?typeof Q!="string"&&typeof Q!="number"||(A=A||[]).push(oe,""+Q):oe!=="suppressContentEditableWarning"&&oe!=="suppressHydrationWarning"&&(h.hasOwnProperty(oe)?(Q!=null&&oe==="onScroll"&&Fe("scroll",t),A||Y===Q||(A=[])):(A=A||[]).push(oe,Q))}s&&(A=A||[]).push("style",s);var oe=A;(n.updateQueue=oe)&&(n.flags|=4)}},sf=function(t,n,s,g){s!==g&&(n.flags|=4)};function rs(t,n){if(!We)switch(t.tailMode){case"hidden":n=t.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t.tail=null:s.sibling=null;break;case"collapsed":s=t.tail;for(var g=null;s!==null;)s.alternate!==null&&(g=s),s=s.sibling;g===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:g.sibling=null}}function mt(t){var n=t.alternate!==null&&t.alternate.child===t.child,s=0,g=0;if(n)for(var E=t.child;E!==null;)s|=E.lanes|E.childLanes,g|=E.subtreeFlags&14680064,g|=E.flags&14680064,E.return=t,E=E.sibling;else for(E=t.child;E!==null;)s|=E.lanes|E.childLanes,g|=E.subtreeFlags,g|=E.flags,E.return=t,E=E.sibling;return t.subtreeFlags|=g,t.childLanes=s,n}function E0(t,n,s){var g=n.pendingProps;switch(Hl(n),n.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mt(n),null;case 1:return Ct(n.type)&&ho(),mt(n),null;case 3:return g=n.stateNode,Jn(),je(St),je(_t),Ql(),g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null),(t===null||t.child===null)&&(mo(n)?n.flags|=4:t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Vt!==null&&(Lc(Vt),Vt=null))),gc(t,n),mt(n),null;case 5:Yl(n);var E=fn(Qi.current);if(s=n.type,t!==null&&n.stateNode!=null)nf(t,n,s,g,E),t.ref!==n.ref&&(n.flags|=512,n.flags|=2097152);else{if(!g){if(n.stateNode===null)throw Error(i(166));return mt(n),null}if(t=fn(sr.current),mo(n)){g=n.stateNode,s=n.type;var A=n.memoizedProps;switch(g[ir]=n,g[qi]=A,t=(n.mode&1)!==0,s){case"dialog":Fe("cancel",g),Fe("close",g);break;case"iframe":case"object":case"embed":Fe("load",g);break;case"video":case"audio":for(E=0;E<Wi.length;E++)Fe(Wi[E],g);break;case"source":Fe("error",g);break;case"img":case"image":case"link":Fe("error",g),Fe("load",g);break;case"details":Fe("toggle",g);break;case"input":be(g,A),Fe("invalid",g);break;case"select":g._wrapperState={wasMultiple:!!A.multiple},Fe("invalid",g);break;case"textarea":qe(g,A),Fe("invalid",g)}vi(s,A),E=null;for(var $ in A)if(A.hasOwnProperty($)){var Y=A[$];$==="children"?typeof Y=="string"?g.textContent!==Y&&(A.suppressHydrationWarning!==!0&&lo(g.textContent,Y,t),E=["children",Y]):typeof Y=="number"&&g.textContent!==""+Y&&(A.suppressHydrationWarning!==!0&&lo(g.textContent,Y,t),E=["children",""+Y]):h.hasOwnProperty($)&&Y!=null&&$==="onScroll"&&Fe("scroll",g)}switch(s){case"input":ce(g),Re(g,A,!0);break;case"textarea":ce(g),Ne(g);break;case"select":case"option":break;default:typeof A.onClick=="function"&&(g.onclick=co)}g=E,n.updateQueue=g,g!==null&&(n.flags|=4)}else{$=E.nodeType===9?E:E.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=Je(s)),t==="http://www.w3.org/1999/xhtml"?s==="script"?(t=$.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof g.is=="string"?t=$.createElement(s,{is:g.is}):(t=$.createElement(s),s==="select"&&($=t,g.multiple?$.multiple=!0:g.size&&($.size=g.size))):t=$.createElementNS(t,s),t[ir]=n,t[qi]=g,rf(t,n,!1,!1),n.stateNode=t;e:{switch($=yi(s,g),s){case"dialog":Fe("cancel",t),Fe("close",t),E=g;break;case"iframe":case"object":case"embed":Fe("load",t),E=g;break;case"video":case"audio":for(E=0;E<Wi.length;E++)Fe(Wi[E],t);E=g;break;case"source":Fe("error",t),E=g;break;case"img":case"image":case"link":Fe("error",t),Fe("load",t),E=g;break;case"details":Fe("toggle",t),E=g;break;case"input":be(t,g),E=Se(t,g),Fe("invalid",t);break;case"option":E=g;break;case"select":t._wrapperState={wasMultiple:!!g.multiple},E=B({},g,{value:void 0}),Fe("invalid",t);break;case"textarea":qe(t,g),E=ut(t,g),Fe("invalid",t);break;default:E=g}vi(s,E),Y=E;for(A in Y)if(Y.hasOwnProperty(A)){var Q=Y[A];A==="style"?Ps(t,Q):A==="dangerouslySetInnerHTML"?(Q=Q?Q.__html:void 0,Q!=null&&pr(t,Q)):A==="children"?typeof Q=="string"?(s!=="textarea"||Q!=="")&&ot(t,Q):typeof Q=="number"&&ot(t,""+Q):A!=="suppressContentEditableWarning"&&A!=="suppressHydrationWarning"&&A!=="autoFocus"&&(h.hasOwnProperty(A)?Q!=null&&A==="onScroll"&&Fe("scroll",t):Q!=null&&u(t,A,Q,$))}switch(s){case"input":ce(t),Re(t,g,!1);break;case"textarea":ce(t),Ne(t);break;case"option":g.value!=null&&t.setAttribute("value",""+H(g.value));break;case"select":t.multiple=!!g.multiple,A=g.value,A!=null?Qe(t,!!g.multiple,A,!1):g.defaultValue!=null&&Qe(t,!!g.multiple,g.defaultValue,!0);break;default:typeof E.onClick=="function"&&(t.onclick=co)}switch(s){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}}g&&(n.flags|=4)}n.ref!==null&&(n.flags|=512,n.flags|=2097152)}return mt(n),null;case 6:if(t&&n.stateNode!=null)sf(t,n,t.memoizedProps,g);else{if(typeof g!="string"&&n.stateNode===null)throw Error(i(166));if(s=fn(Qi.current),fn(sr.current),mo(n)){if(g=n.stateNode,s=n.memoizedProps,g[ir]=n,(A=g.nodeValue!==s)&&(t=Tt,t!==null))switch(t.tag){case 3:lo(g.nodeValue,s,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&lo(g.nodeValue,s,(t.mode&1)!==0)}A&&(n.flags|=4)}else g=(s.nodeType===9?s:s.ownerDocument).createTextNode(g),g[ir]=n,n.stateNode=g}return mt(n),null;case 13:if(je(Xe),g=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(We&&Mt!==null&&(n.mode&1)!==0&&(n.flags&128)===0)ad(),Xn(),n.flags|=98560,A=!1;else if(A=mo(n),g!==null&&g.dehydrated!==null){if(t===null){if(!A)throw Error(i(318));if(A=n.memoizedState,A=A!==null?A.dehydrated:null,!A)throw Error(i(317));A[ir]=n}else Xn(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;mt(n),A=!1}else Vt!==null&&(Lc(Vt),Vt=null),A=!0;if(!A)return n.flags&65536?n:null}return(n.flags&128)!==0?(n.lanes=s,n):(g=g!==null,g!==(t!==null&&t.memoizedState!==null)&&g&&(n.child.flags|=8192,(n.mode&1)!==0&&(t===null||(Xe.current&1)!==0?it===0&&(it=3):Ac())),n.updateQueue!==null&&(n.flags|=4),mt(n),null);case 4:return Jn(),gc(t,n),t===null&&Ui(n.stateNode.containerInfo),mt(n),null;case 10:return Ul(n.type._context),mt(n),null;case 17:return Ct(n.type)&&ho(),mt(n),null;case 19:if(je(Xe),A=n.memoizedState,A===null)return mt(n),null;if(g=(n.flags&128)!==0,$=A.rendering,$===null)if(g)rs(A,!1);else{if(it!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if($=xo(t),$!==null){for(n.flags|=128,rs(A,!1),g=$.updateQueue,g!==null&&(n.updateQueue=g,n.flags|=4),n.subtreeFlags=0,g=s,s=n.child;s!==null;)A=s,t=g,A.flags&=14680066,$=A.alternate,$===null?(A.childLanes=0,A.lanes=t,A.child=null,A.subtreeFlags=0,A.memoizedProps=null,A.memoizedState=null,A.updateQueue=null,A.dependencies=null,A.stateNode=null):(A.childLanes=$.childLanes,A.lanes=$.lanes,A.child=$.child,A.subtreeFlags=0,A.deletions=null,A.memoizedProps=$.memoizedProps,A.memoizedState=$.memoizedState,A.updateQueue=$.updateQueue,A.type=$.type,t=$.dependencies,A.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),s=s.sibling;return He(Xe,Xe.current&1|2),n.child}t=t.sibling}A.tail!==null&&Ke()>ri&&(n.flags|=128,g=!0,rs(A,!1),n.lanes=4194304)}else{if(!g)if(t=xo($),t!==null){if(n.flags|=128,g=!0,s=t.updateQueue,s!==null&&(n.updateQueue=s,n.flags|=4),rs(A,!0),A.tail===null&&A.tailMode==="hidden"&&!$.alternate&&!We)return mt(n),null}else 2*Ke()-A.renderingStartTime>ri&&s!==1073741824&&(n.flags|=128,g=!0,rs(A,!1),n.lanes=4194304);A.isBackwards?($.sibling=n.child,n.child=$):(s=A.last,s!==null?s.sibling=$:n.child=$,A.last=$)}return A.tail!==null?(n=A.tail,A.rendering=n,A.tail=n.sibling,A.renderingStartTime=Ke(),n.sibling=null,s=Xe.current,He(Xe,g?s&1|2:s&1),n):(mt(n),null);case 22:case 23:return Dc(),g=n.memoizedState!==null,t!==null&&t.memoizedState!==null!==g&&(n.flags|=8192),g&&(n.mode&1)!==0?(Pt&1073741824)!==0&&(mt(n),n.subtreeFlags&6&&(n.flags|=8192)):mt(n),null;case 24:return null;case 25:return null}throw Error(i(156,n.tag))}function k0(t,n){switch(Hl(n),n.tag){case 1:return Ct(n.type)&&ho(),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return Jn(),je(St),je(_t),Ql(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 5:return Yl(n),null;case 13:if(je(Xe),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(i(340));Xn()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return je(Xe),null;case 4:return Jn(),null;case 10:return Ul(n.type._context),null;case 22:case 23:return Dc(),null;case 24:return null;default:return null}}var Mo=!1,vt=!1,L0=typeof WeakSet=="function"?WeakSet:Set,ve=null;function ei(t,n){var s=t.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(g){Ge(t,n,g)}else s.current=null}function mc(t,n,s){try{s()}catch(g){Ge(t,n,g)}}var of=!1;function R0(t,n){if(Dl=Qs,t=Oh(),Sl(t)){if("selectionStart"in t)var s={start:t.selectionStart,end:t.selectionEnd};else e:{s=(s=t.ownerDocument)&&s.defaultView||window;var g=s.getSelection&&s.getSelection();if(g&&g.rangeCount!==0){s=g.anchorNode;var E=g.anchorOffset,A=g.focusNode;g=g.focusOffset;try{s.nodeType,A.nodeType}catch{s=null;break e}var $=0,Y=-1,Q=-1,oe=0,de=0,fe=t,he=null;t:for(;;){for(var me;fe!==s||E!==0&&fe.nodeType!==3||(Y=$+E),fe!==A||g!==0&&fe.nodeType!==3||(Q=$+g),fe.nodeType===3&&($+=fe.nodeValue.length),(me=fe.firstChild)!==null;)he=fe,fe=me;for(;;){if(fe===t)break t;if(he===s&&++oe===E&&(Y=$),he===A&&++de===g&&(Q=$),(me=fe.nextSibling)!==null)break;fe=he,he=fe.parentNode}fe=me}s=Y===-1||Q===-1?null:{start:Y,end:Q}}else s=null}s=s||{start:0,end:0}}else s=null;for(Al={focusedElem:t,selectionRange:s},Qs=!1,ve=n;ve!==null;)if(n=ve,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,ve=t;else for(;ve!==null;){n=ve;try{var ye=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(ye!==null){var we=ye.memoizedProps,Ze=ye.memoizedState,ne=n.stateNode,ee=ne.getSnapshotBeforeUpdate(n.elementType===n.type?we:qt(n.type,we),Ze);ne.__reactInternalSnapshotBeforeUpdate=ee}break;case 3:var se=n.stateNode.containerInfo;se.nodeType===1?se.textContent="":se.nodeType===9&&se.documentElement&&se.removeChild(se.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(_e){Ge(n,n.return,_e)}if(t=n.sibling,t!==null){t.return=n.return,ve=t;break}ve=n.return}return ye=of,of=!1,ye}function ns(t,n,s){var g=n.updateQueue;if(g=g!==null?g.lastEffect:null,g!==null){var E=g=g.next;do{if((E.tag&t)===t){var A=E.destroy;E.destroy=void 0,A!==void 0&&mc(n,s,A)}E=E.next}while(E!==g)}}function Po(t,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&t)===t){var g=s.create;s.destroy=g()}s=s.next}while(s!==n)}}function vc(t){var n=t.ref;if(n!==null){var s=t.stateNode;switch(t.tag){case 5:t=s;break;default:t=s}typeof n=="function"?n(t):n.current=t}}function af(t){var n=t.alternate;n!==null&&(t.alternate=null,af(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&(delete n[ir],delete n[qi],delete n[Nl],delete n[u0],delete n[h0])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function lf(t){return t.tag===5||t.tag===3||t.tag===4}function cf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||lf(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function yc(t,n,s){var g=t.tag;if(g===5||g===6)t=t.stateNode,n?s.nodeType===8?s.parentNode.insertBefore(t,n):s.insertBefore(t,n):(s.nodeType===8?(n=s.parentNode,n.insertBefore(t,s)):(n=s,n.appendChild(t)),s=s._reactRootContainer,s!=null||n.onclick!==null||(n.onclick=co));else if(g!==4&&(t=t.child,t!==null))for(yc(t,n,s),t=t.sibling;t!==null;)yc(t,n,s),t=t.sibling}function wc(t,n,s){var g=t.tag;if(g===5||g===6)t=t.stateNode,n?s.insertBefore(t,n):s.appendChild(t);else if(g!==4&&(t=t.child,t!==null))for(wc(t,n,s),t=t.sibling;t!==null;)wc(t,n,s),t=t.sibling}var dt=null,Kt=!1;function Wr(t,n,s){for(s=s.child;s!==null;)uf(t,n,s),s=s.sibling}function uf(t,n,s){if(It&&typeof It.onCommitFiberUnmount=="function")try{It.onCommitFiberUnmount(on,s)}catch{}switch(s.tag){case 5:vt||ei(s,n);case 6:var g=dt,E=Kt;dt=null,Wr(t,n,s),dt=g,Kt=E,dt!==null&&(Kt?(t=dt,s=s.stateNode,t.nodeType===8?t.parentNode.removeChild(s):t.removeChild(s)):dt.removeChild(s.stateNode));break;case 18:dt!==null&&(Kt?(t=dt,s=s.stateNode,t.nodeType===8?Pl(t.parentNode,s):t.nodeType===1&&Pl(t,s),Bi(t)):Pl(dt,s.stateNode));break;case 4:g=dt,E=Kt,dt=s.stateNode.containerInfo,Kt=!0,Wr(t,n,s),dt=g,Kt=E;break;case 0:case 11:case 14:case 15:if(!vt&&(g=s.updateQueue,g!==null&&(g=g.lastEffect,g!==null))){E=g=g.next;do{var A=E,$=A.destroy;A=A.tag,$!==void 0&&((A&2)!==0||(A&4)!==0)&&mc(s,n,$),E=E.next}while(E!==g)}Wr(t,n,s);break;case 1:if(!vt&&(ei(s,n),g=s.stateNode,typeof g.componentWillUnmount=="function"))try{g.props=s.memoizedProps,g.state=s.memoizedState,g.componentWillUnmount()}catch(Y){Ge(s,n,Y)}Wr(t,n,s);break;case 21:Wr(t,n,s);break;case 22:s.mode&1?(vt=(g=vt)||s.memoizedState!==null,Wr(t,n,s),vt=g):Wr(t,n,s);break;default:Wr(t,n,s)}}function hf(t){var n=t.updateQueue;if(n!==null){t.updateQueue=null;var s=t.stateNode;s===null&&(s=t.stateNode=new L0),n.forEach(function(g){var E=O0.bind(null,t,g);s.has(g)||(s.add(g),g.then(E,E))})}}function Xt(t,n){var s=n.deletions;if(s!==null)for(var g=0;g<s.length;g++){var E=s[g];try{var A=t,$=n,Y=$;e:for(;Y!==null;){switch(Y.tag){case 5:dt=Y.stateNode,Kt=!1;break e;case 3:dt=Y.stateNode.containerInfo,Kt=!0;break e;case 4:dt=Y.stateNode.containerInfo,Kt=!0;break e}Y=Y.return}if(dt===null)throw Error(i(160));uf(A,$,E),dt=null,Kt=!1;var Q=E.alternate;Q!==null&&(Q.return=null),E.return=null}catch(oe){Ge(E,n,oe)}}if(n.subtreeFlags&12854)for(n=n.child;n!==null;)df(n,t),n=n.sibling}function df(t,n){var s=t.alternate,g=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Xt(n,t),ar(t),g&4){try{ns(3,t,t.return),Po(3,t)}catch(we){Ge(t,t.return,we)}try{ns(5,t,t.return)}catch(we){Ge(t,t.return,we)}}break;case 1:Xt(n,t),ar(t),g&512&&s!==null&&ei(s,s.return);break;case 5:if(Xt(n,t),ar(t),g&512&&s!==null&&ei(s,s.return),t.flags&32){var E=t.stateNode;try{ot(E,"")}catch(we){Ge(t,t.return,we)}}if(g&4&&(E=t.stateNode,E!=null)){var A=t.memoizedProps,$=s!==null?s.memoizedProps:A,Y=t.type,Q=t.updateQueue;if(t.updateQueue=null,Q!==null)try{Y==="input"&&A.type==="radio"&&A.name!=null&&ue(E,A),yi(Y,$);var oe=yi(Y,A);for($=0;$<Q.length;$+=2){var de=Q[$],fe=Q[$+1];de==="style"?Ps(E,fe):de==="dangerouslySetInnerHTML"?pr(E,fe):de==="children"?ot(E,fe):u(E,de,fe,oe)}switch(Y){case"input":ge(E,A);break;case"textarea":pt(E,A);break;case"select":var he=E._wrapperState.wasMultiple;E._wrapperState.wasMultiple=!!A.multiple;var me=A.value;me!=null?Qe(E,!!A.multiple,me,!1):he!==!!A.multiple&&(A.defaultValue!=null?Qe(E,!!A.multiple,A.defaultValue,!0):Qe(E,!!A.multiple,A.multiple?[]:"",!1))}E[qi]=A}catch(we){Ge(t,t.return,we)}}break;case 6:if(Xt(n,t),ar(t),g&4){if(t.stateNode===null)throw Error(i(162));E=t.stateNode,A=t.memoizedProps;try{E.nodeValue=A}catch(we){Ge(t,t.return,we)}}break;case 3:if(Xt(n,t),ar(t),g&4&&s!==null&&s.memoizedState.isDehydrated)try{Bi(n.containerInfo)}catch(we){Ge(t,t.return,we)}break;case 4:Xt(n,t),ar(t);break;case 13:Xt(n,t),ar(t),E=t.child,E.flags&8192&&(A=E.memoizedState!==null,E.stateNode.isHidden=A,!A||E.alternate!==null&&E.alternate.memoizedState!==null||(xc=Ke())),g&4&&hf(t);break;case 22:if(de=s!==null&&s.memoizedState!==null,t.mode&1?(vt=(oe=vt)||de,Xt(n,t),vt=oe):Xt(n,t),ar(t),g&8192){if(oe=t.memoizedState!==null,(t.stateNode.isHidden=oe)&&!de&&(t.mode&1)!==0)for(ve=t,de=t.child;de!==null;){for(fe=ve=de;ve!==null;){switch(he=ve,me=he.child,he.tag){case 0:case 11:case 14:case 15:ns(4,he,he.return);break;case 1:ei(he,he.return);var ye=he.stateNode;if(typeof ye.componentWillUnmount=="function"){g=he,s=he.return;try{n=g,ye.props=n.memoizedProps,ye.state=n.memoizedState,ye.componentWillUnmount()}catch(we){Ge(g,s,we)}}break;case 5:ei(he,he.return);break;case 22:if(he.memoizedState!==null){_f(fe);continue}}me!==null?(me.return=he,ve=me):_f(fe)}de=de.sibling}e:for(de=null,fe=t;;){if(fe.tag===5){if(de===null){de=fe;try{E=fe.stateNode,oe?(A=E.style,typeof A.setProperty=="function"?A.setProperty("display","none","important"):A.display="none"):(Y=fe.stateNode,Q=fe.memoizedProps.style,$=Q!=null&&Q.hasOwnProperty("display")?Q.display:null,Y.style.display=Rn("display",$))}catch(we){Ge(t,t.return,we)}}}else if(fe.tag===6){if(de===null)try{fe.stateNode.nodeValue=oe?"":fe.memoizedProps}catch(we){Ge(t,t.return,we)}}else if((fe.tag!==22&&fe.tag!==23||fe.memoizedState===null||fe===t)&&fe.child!==null){fe.child.return=fe,fe=fe.child;continue}if(fe===t)break e;for(;fe.sibling===null;){if(fe.return===null||fe.return===t)break e;de===fe&&(de=null),fe=fe.return}de===fe&&(de=null),fe.sibling.return=fe.return,fe=fe.sibling}}break;case 19:Xt(n,t),ar(t),g&4&&hf(t);break;case 21:break;default:Xt(n,t),ar(t)}}function ar(t){var n=t.flags;if(n&2){try{e:{for(var s=t.return;s!==null;){if(lf(s)){var g=s;break e}s=s.return}throw Error(i(160))}switch(g.tag){case 5:var E=g.stateNode;g.flags&32&&(ot(E,""),g.flags&=-33);var A=cf(t);wc(t,A,E);break;case 3:case 4:var $=g.stateNode.containerInfo,Y=cf(t);yc(t,Y,$);break;default:throw Error(i(161))}}catch(Q){Ge(t,t.return,Q)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function D0(t,n,s){ve=t,ff(t)}function ff(t,n,s){for(var g=(t.mode&1)!==0;ve!==null;){var E=ve,A=E.child;if(E.tag===22&&g){var $=E.memoizedState!==null||Mo;if(!$){var Y=E.alternate,Q=Y!==null&&Y.memoizedState!==null||vt;Y=Mo;var oe=vt;if(Mo=$,(vt=Q)&&!oe)for(ve=E;ve!==null;)$=ve,Q=$.child,$.tag===22&&$.memoizedState!==null?gf(E):Q!==null?(Q.return=$,ve=Q):gf(E);for(;A!==null;)ve=A,ff(A),A=A.sibling;ve=E,Mo=Y,vt=oe}pf(t)}else(E.subtreeFlags&8772)!==0&&A!==null?(A.return=E,ve=A):pf(t)}}function pf(t){for(;ve!==null;){var n=ve;if((n.flags&8772)!==0){var s=n.alternate;try{if((n.flags&8772)!==0)switch(n.tag){case 0:case 11:case 15:vt||Po(5,n);break;case 1:var g=n.stateNode;if(n.flags&4&&!vt)if(s===null)g.componentDidMount();else{var E=n.elementType===n.type?s.memoizedProps:qt(n.type,s.memoizedProps);g.componentDidUpdate(E,s.memoizedState,g.__reactInternalSnapshotBeforeUpdate)}var A=n.updateQueue;A!==null&&pd(n,A,g);break;case 3:var $=n.updateQueue;if($!==null){if(s=null,n.child!==null)switch(n.child.tag){case 5:s=n.child.stateNode;break;case 1:s=n.child.stateNode}pd(n,$,s)}break;case 5:var Y=n.stateNode;if(s===null&&n.flags&4){s=Y;var Q=n.memoizedProps;switch(n.type){case"button":case"input":case"select":case"textarea":Q.autoFocus&&s.focus();break;case"img":Q.src&&(s.src=Q.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(n.memoizedState===null){var oe=n.alternate;if(oe!==null){var de=oe.memoizedState;if(de!==null){var fe=de.dehydrated;fe!==null&&Bi(fe)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(i(163))}vt||n.flags&512&&vc(n)}catch(he){Ge(n,n.return,he)}}if(n===t){ve=null;break}if(s=n.sibling,s!==null){s.return=n.return,ve=s;break}ve=n.return}}function _f(t){for(;ve!==null;){var n=ve;if(n===t){ve=null;break}var s=n.sibling;if(s!==null){s.return=n.return,ve=s;break}ve=n.return}}function gf(t){for(;ve!==null;){var n=ve;try{switch(n.tag){case 0:case 11:case 15:var s=n.return;try{Po(4,n)}catch(Q){Ge(n,s,Q)}break;case 1:var g=n.stateNode;if(typeof g.componentDidMount=="function"){var E=n.return;try{g.componentDidMount()}catch(Q){Ge(n,E,Q)}}var A=n.return;try{vc(n)}catch(Q){Ge(n,A,Q)}break;case 5:var $=n.return;try{vc(n)}catch(Q){Ge(n,$,Q)}}}catch(Q){Ge(n,n.return,Q)}if(n===t){ve=null;break}var Y=n.sibling;if(Y!==null){Y.return=n.return,ve=Y;break}ve=n.return}}var A0=Math.ceil,No=w.ReactCurrentDispatcher,Sc=w.ReactCurrentOwner,zt=w.ReactCurrentBatchConfig,Me=0,lt=null,et=null,ft=0,Pt=0,ti=Hr(0),it=0,is=null,_n=0,Bo=0,Cc=0,ss=null,bt=null,xc=0,ri=1/0,Cr=null,Io=!1,bc=null,Ur=null,Oo=!1,Vr=null,Ho=0,os=0,Ec=null,Fo=-1,jo=0;function wt(){return(Me&6)!==0?Ke():Fo!==-1?Fo:Fo=Ke()}function qr(t){return(t.mode&1)===0?1:(Me&2)!==0&&ft!==0?ft&-ft:f0.transition!==null?(jo===0&&(jo=Bn()),jo):(t=Be,t!==0||(t=window.event,t=t===void 0?16:mh(t.type)),t)}function Yt(t,n,s,g){if(50<os)throw os=0,Ec=null,Error(i(185));an(t,s,g),((Me&2)===0||t!==lt)&&(t===lt&&((Me&2)===0&&(Bo|=s),it===4&&Kr(t,ft)),Et(t,g),s===1&&Me===0&&(n.mode&1)===0&&(ri=Ke()+500,po&&jr()))}function Et(t,n){var s=t.callbackNode;ol(t,n);var g=Nn(t,t===lt?ft:0);if(g===0)s!==null&&Ws(s),t.callbackNode=null,t.callbackPriority=0;else if(n=g&-g,t.callbackPriority!==n){if(s!=null&&Ws(s),n===1)t.tag===0?d0(vf.bind(null,t)):rd(vf.bind(null,t)),l0(function(){(Me&6)===0&&jr()}),s=null;else{switch(ch(g)){case 1:s=Ri;break;case 4:s=Vs;break;case 16:s=Tn;break;case 536870912:s=qs;break;default:s=Tn}s=kf(s,mf.bind(null,t))}t.callbackPriority=n,t.callbackNode=s}}function mf(t,n){if(Fo=-1,jo=0,(Me&6)!==0)throw Error(i(327));var s=t.callbackNode;if(ni()&&t.callbackNode!==s)return null;var g=Nn(t,t===lt?ft:0);if(g===0)return null;if((g&30)!==0||(g&t.expiredLanes)!==0||n)n=zo(t,g);else{n=g;var E=Me;Me|=2;var A=wf();(lt!==t||ft!==n)&&(Cr=null,ri=Ke()+500,mn(t,n));do try{P0();break}catch(Y){yf(t,Y)}while(!0);Wl(),No.current=A,Me=E,et!==null?n=0:(lt=null,ft=0,n=it)}if(n!==0){if(n===2&&(E=Di(t),E!==0&&(g=E,n=kc(t,E))),n===1)throw s=is,mn(t,0),Kr(t,g),Et(t,Ke()),s;if(n===6)Kr(t,g);else{if(E=t.current.alternate,(g&30)===0&&!T0(E)&&(n=zo(t,g),n===2&&(A=Di(t),A!==0&&(g=A,n=kc(t,A))),n===1))throw s=is,mn(t,0),Kr(t,g),Et(t,Ke()),s;switch(t.finishedWork=E,t.finishedLanes=g,n){case 0:case 1:throw Error(i(345));case 2:vn(t,bt,Cr);break;case 3:if(Kr(t,g),(g&130023424)===g&&(n=xc+500-Ke(),10<n)){if(Nn(t,0)!==0)break;if(E=t.suspendedLanes,(E&g)!==g){wt(),t.pingedLanes|=t.suspendedLanes&E;break}t.timeoutHandle=Ml(vn.bind(null,t,bt,Cr),n);break}vn(t,bt,Cr);break;case 4:if(Kr(t,g),(g&4194240)===g)break;for(n=t.eventTimes,E=-1;0<g;){var $=31-Dt(g);A=1<<$,$=n[$],$>E&&(E=$),g&=~A}if(g=E,g=Ke()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*A0(g/1960))-g,10<g){t.timeoutHandle=Ml(vn.bind(null,t,bt,Cr),g);break}vn(t,bt,Cr);break;case 5:vn(t,bt,Cr);break;default:throw Error(i(329))}}}return Et(t,Ke()),t.callbackNode===s?mf.bind(null,t):null}function kc(t,n){var s=ss;return t.current.memoizedState.isDehydrated&&(mn(t,n).flags|=256),t=zo(t,n),t!==2&&(n=bt,bt=s,n!==null&&Lc(n)),t}function Lc(t){bt===null?bt=t:bt.push.apply(bt,t)}function T0(t){for(var n=t;;){if(n.flags&16384){var s=n.updateQueue;if(s!==null&&(s=s.stores,s!==null))for(var g=0;g<s.length;g++){var E=s[g],A=E.getSnapshot;E=E.value;try{if(!Ut(A(),E))return!1}catch{return!1}}}if(s=n.child,n.subtreeFlags&16384&&s!==null)s.return=n,n=s;else{if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Kr(t,n){for(n&=~Cc,n&=~Bo,t.suspendedLanes|=n,t.pingedLanes&=~n,t=t.expirationTimes;0<n;){var s=31-Dt(n),g=1<<s;t[s]=-1,n&=~g}}function vf(t){if((Me&6)!==0)throw Error(i(327));ni();var n=Nn(t,0);if((n&1)===0)return Et(t,Ke()),null;var s=zo(t,n);if(t.tag!==0&&s===2){var g=Di(t);g!==0&&(n=g,s=kc(t,g))}if(s===1)throw s=is,mn(t,0),Kr(t,n),Et(t,Ke()),s;if(s===6)throw Error(i(345));return t.finishedWork=t.current.alternate,t.finishedLanes=n,vn(t,bt,Cr),Et(t,Ke()),null}function Rc(t,n){var s=Me;Me|=1;try{return t(n)}finally{Me=s,Me===0&&(ri=Ke()+500,po&&jr())}}function gn(t){Vr!==null&&Vr.tag===0&&(Me&6)===0&&ni();var n=Me;Me|=1;var s=zt.transition,g=Be;try{if(zt.transition=null,Be=1,t)return t()}finally{Be=g,zt.transition=s,Me=n,(Me&6)===0&&jr()}}function Dc(){Pt=ti.current,je(ti)}function mn(t,n){t.finishedWork=null,t.finishedLanes=0;var s=t.timeoutHandle;if(s!==-1&&(t.timeoutHandle=-1,a0(s)),et!==null)for(s=et.return;s!==null;){var g=s;switch(Hl(g),g.tag){case 1:g=g.type.childContextTypes,g!=null&&ho();break;case 3:Jn(),je(St),je(_t),Ql();break;case 5:Yl(g);break;case 4:Jn();break;case 13:je(Xe);break;case 19:je(Xe);break;case 10:Ul(g.type._context);break;case 22:case 23:Dc()}s=s.return}if(lt=t,et=t=Xr(t.current,null),ft=Pt=n,it=0,is=null,Cc=Bo=_n=0,bt=ss=null,dn!==null){for(n=0;n<dn.length;n++)if(s=dn[n],g=s.interleaved,g!==null){s.interleaved=null;var E=g.next,A=s.pending;if(A!==null){var $=A.next;A.next=E,g.next=$}s.pending=g}dn=null}return t}function yf(t,n){do{var s=et;try{if(Wl(),bo.current=Ro,Eo){for(var g=Ye.memoizedState;g!==null;){var E=g.queue;E!==null&&(E.pending=null),g=g.next}Eo=!1}if(pn=0,at=nt=Ye=null,Ji=!1,Zi=0,Sc.current=null,s===null||s.return===null){it=1,is=n,et=null;break}e:{var A=t,$=s.return,Y=s,Q=n;if(n=ft,Y.flags|=32768,Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var oe=Q,de=Y,fe=de.tag;if((de.mode&1)===0&&(fe===0||fe===11||fe===15)){var he=de.alternate;he?(de.updateQueue=he.updateQueue,de.memoizedState=he.memoizedState,de.lanes=he.lanes):(de.updateQueue=null,de.memoizedState=null)}var me=Wd($);if(me!==null){me.flags&=-257,Ud(me,$,Y,A,n),me.mode&1&&$d(A,oe,n),n=me,Q=oe;var ye=n.updateQueue;if(ye===null){var we=new Set;we.add(Q),n.updateQueue=we}else ye.add(Q);break e}else{if((n&1)===0){$d(A,oe,n),Ac();break e}Q=Error(i(426))}}else if(We&&Y.mode&1){var Ze=Wd($);if(Ze!==null){(Ze.flags&65536)===0&&(Ze.flags|=256),Ud(Ze,$,Y,A,n),zl(Zn(Q,Y));break e}}A=Q=Zn(Q,Y),it!==4&&(it=2),ss===null?ss=[A]:ss.push(A),A=$;do{switch(A.tag){case 3:A.flags|=65536,n&=-n,A.lanes|=n;var ne=jd(A,Q,n);fd(A,ne);break e;case 1:Y=Q;var ee=A.type,se=A.stateNode;if((A.flags&128)===0&&(typeof ee.getDerivedStateFromError=="function"||se!==null&&typeof se.componentDidCatch=="function"&&(Ur===null||!Ur.has(se)))){A.flags|=65536,n&=-n,A.lanes|=n;var _e=zd(A,Y,n);fd(A,_e);break e}}A=A.return}while(A!==null)}Cf(s)}catch(Ce){n=Ce,et===s&&s!==null&&(et=s=s.return);continue}break}while(!0)}function wf(){var t=No.current;return No.current=Ro,t===null?Ro:t}function Ac(){(it===0||it===3||it===2)&&(it=4),lt===null||(_n&268435455)===0&&(Bo&268435455)===0||Kr(lt,ft)}function zo(t,n){var s=Me;Me|=2;var g=wf();(lt!==t||ft!==n)&&(Cr=null,mn(t,n));do try{M0();break}catch(E){yf(t,E)}while(!0);if(Wl(),Me=s,No.current=g,et!==null)throw Error(i(261));return lt=null,ft=0,it}function M0(){for(;et!==null;)Sf(et)}function P0(){for(;et!==null&&!Za();)Sf(et)}function Sf(t){var n=Ef(t.alternate,t,Pt);t.memoizedProps=t.pendingProps,n===null?Cf(t):et=n,Sc.current=null}function Cf(t){var n=t;do{var s=n.alternate;if(t=n.return,(n.flags&32768)===0){if(s=E0(s,n,Pt),s!==null){et=s;return}}else{if(s=k0(s,n),s!==null){s.flags&=32767,et=s;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{it=6,et=null;return}}if(n=n.sibling,n!==null){et=n;return}et=n=t}while(n!==null);it===0&&(it=5)}function vn(t,n,s){var g=Be,E=zt.transition;try{zt.transition=null,Be=1,N0(t,n,s,g)}finally{zt.transition=E,Be=g}return null}function N0(t,n,s,g){do ni();while(Vr!==null);if((Me&6)!==0)throw Error(i(327));s=t.finishedWork;var E=t.finishedLanes;if(s===null)return null;if(t.finishedWork=null,t.finishedLanes=0,s===t.current)throw Error(i(177));t.callbackNode=null,t.callbackPriority=0;var A=s.lanes|s.childLanes;if(Xs(t,A),t===lt&&(et=lt=null,ft=0),(s.subtreeFlags&2064)===0&&(s.flags&2064)===0||Oo||(Oo=!0,kf(Tn,function(){return ni(),null})),A=(s.flags&15990)!==0,(s.subtreeFlags&15990)!==0||A){A=zt.transition,zt.transition=null;var $=Be;Be=1;var Y=Me;Me|=4,Sc.current=null,R0(t,s),df(s,t),e0(Al),Qs=!!Dl,Al=Dl=null,t.current=s,D0(s),Us(),Me=Y,Be=$,zt.transition=A}else t.current=s;if(Oo&&(Oo=!1,Vr=t,Ho=E),A=t.pendingLanes,A===0&&(Ur=null),rl(s.stateNode),Et(t,Ke()),n!==null)for(g=t.onRecoverableError,s=0;s<n.length;s++)E=n[s],g(E.value,{componentStack:E.stack,digest:E.digest});if(Io)throw Io=!1,t=bc,bc=null,t;return(Ho&1)!==0&&t.tag!==0&&ni(),A=t.pendingLanes,(A&1)!==0?t===Ec?os++:(os=0,Ec=t):os=0,jr(),null}function ni(){if(Vr!==null){var t=ch(Ho),n=zt.transition,s=Be;try{if(zt.transition=null,Be=16>t?16:t,Vr===null)var g=!1;else{if(t=Vr,Vr=null,Ho=0,(Me&6)!==0)throw Error(i(331));var E=Me;for(Me|=4,ve=t.current;ve!==null;){var A=ve,$=A.child;if((ve.flags&16)!==0){var Y=A.deletions;if(Y!==null){for(var Q=0;Q<Y.length;Q++){var oe=Y[Q];for(ve=oe;ve!==null;){var de=ve;switch(de.tag){case 0:case 11:case 15:ns(8,de,A)}var fe=de.child;if(fe!==null)fe.return=de,ve=fe;else for(;ve!==null;){de=ve;var he=de.sibling,me=de.return;if(af(de),de===oe){ve=null;break}if(he!==null){he.return=me,ve=he;break}ve=me}}}var ye=A.alternate;if(ye!==null){var we=ye.child;if(we!==null){ye.child=null;do{var Ze=we.sibling;we.sibling=null,we=Ze}while(we!==null)}}ve=A}}if((A.subtreeFlags&2064)!==0&&$!==null)$.return=A,ve=$;else e:for(;ve!==null;){if(A=ve,(A.flags&2048)!==0)switch(A.tag){case 0:case 11:case 15:ns(9,A,A.return)}var ne=A.sibling;if(ne!==null){ne.return=A.return,ve=ne;break e}ve=A.return}}var ee=t.current;for(ve=ee;ve!==null;){$=ve;var se=$.child;if(($.subtreeFlags&2064)!==0&&se!==null)se.return=$,ve=se;else e:for($=ee;ve!==null;){if(Y=ve,(Y.flags&2048)!==0)try{switch(Y.tag){case 0:case 11:case 15:Po(9,Y)}}catch(Ce){Ge(Y,Y.return,Ce)}if(Y===$){ve=null;break e}var _e=Y.sibling;if(_e!==null){_e.return=Y.return,ve=_e;break e}ve=Y.return}}if(Me=E,jr(),It&&typeof It.onPostCommitFiberRoot=="function")try{It.onPostCommitFiberRoot(on,t)}catch{}g=!0}return g}finally{Be=s,zt.transition=n}}return!1}function xf(t,n,s){n=Zn(s,n),n=jd(t,n,1),t=$r(t,n,1),n=wt(),t!==null&&(an(t,1,n),Et(t,n))}function Ge(t,n,s){if(t.tag===3)xf(t,t,s);else for(;n!==null;){if(n.tag===3){xf(n,t,s);break}else if(n.tag===1){var g=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Ur===null||!Ur.has(g))){t=Zn(s,t),t=zd(n,t,1),n=$r(n,t,1),t=wt(),n!==null&&(an(n,1,t),Et(n,t));break}}n=n.return}}function B0(t,n,s){var g=t.pingCache;g!==null&&g.delete(n),n=wt(),t.pingedLanes|=t.suspendedLanes&s,lt===t&&(ft&s)===s&&(it===4||it===3&&(ft&130023424)===ft&&500>Ke()-xc?mn(t,0):Cc|=s),Et(t,n)}function bf(t,n){n===0&&((t.mode&1)===0?n=1:(n=Pn,Pn<<=1,(Pn&130023424)===0&&(Pn=4194304)));var s=wt();t=yr(t,n),t!==null&&(an(t,n,s),Et(t,s))}function I0(t){var n=t.memoizedState,s=0;n!==null&&(s=n.retryLane),bf(t,s)}function O0(t,n){var s=0;switch(t.tag){case 13:var g=t.stateNode,E=t.memoizedState;E!==null&&(s=E.retryLane);break;case 19:g=t.stateNode;break;default:throw Error(i(314))}g!==null&&g.delete(n),bf(t,s)}var Ef;Ef=function(t,n,s){if(t!==null)if(t.memoizedProps!==n.pendingProps||St.current)xt=!0;else{if((t.lanes&s)===0&&(n.flags&128)===0)return xt=!1,b0(t,n,s);xt=(t.flags&131072)!==0}else xt=!1,We&&(n.flags&1048576)!==0&&nd(n,go,n.index);switch(n.lanes=0,n.tag){case 2:var g=n.type;To(t,n),t=n.pendingProps;var E=Vn(n,_t.current);Qn(n,s),E=ec(null,n,g,t,E,s);var A=tc();return n.flags|=1,typeof E=="object"&&E!==null&&typeof E.render=="function"&&E.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,Ct(g)?(A=!0,fo(n)):A=!1,n.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,Kl(n),E.updater=Do,n.stateNode=E,E._reactInternals=n,ac(n,g,t,s),n=hc(null,n,g,!0,A,s)):(n.tag=0,We&&A&&Ol(n),yt(null,n,E,s),n=n.child),n;case 16:g=n.elementType;e:{switch(To(t,n),t=n.pendingProps,E=g._init,g=E(g._payload),n.type=g,E=n.tag=F0(g),t=qt(g,t),E){case 0:n=uc(null,n,g,t,s);break e;case 1:n=Gd(null,n,g,t,s);break e;case 11:n=Vd(null,n,g,t,s);break e;case 14:n=qd(null,n,g,qt(g.type,t),s);break e}throw Error(i(306,g,""))}return n;case 0:return g=n.type,E=n.pendingProps,E=n.elementType===g?E:qt(g,E),uc(t,n,g,E,s);case 1:return g=n.type,E=n.pendingProps,E=n.elementType===g?E:qt(g,E),Gd(t,n,g,E,s);case 3:e:{if(Qd(n),t===null)throw Error(i(387));g=n.pendingProps,A=n.memoizedState,E=A.element,dd(t,n),Co(n,g,null,s);var $=n.memoizedState;if(g=$.element,A.isDehydrated)if(A={element:g,isDehydrated:!1,cache:$.cache,pendingSuspenseBoundaries:$.pendingSuspenseBoundaries,transitions:$.transitions},n.updateQueue.baseState=A,n.memoizedState=A,n.flags&256){E=Zn(Error(i(423)),n),n=Jd(t,n,g,s,E);break e}else if(g!==E){E=Zn(Error(i(424)),n),n=Jd(t,n,g,s,E);break e}else for(Mt=Or(n.stateNode.containerInfo.firstChild),Tt=n,We=!0,Vt=null,s=ud(n,null,g,s),n.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(Xn(),g===E){n=Sr(t,n,s);break e}yt(t,n,g,s)}n=n.child}return n;case 5:return _d(n),t===null&&jl(n),g=n.type,E=n.pendingProps,A=t!==null?t.memoizedProps:null,$=E.children,Tl(g,E)?$=null:A!==null&&Tl(g,A)&&(n.flags|=32),Yd(t,n),yt(t,n,$,s),n.child;case 6:return t===null&&jl(n),null;case 13:return Zd(t,n,s);case 4:return Xl(n,n.stateNode.containerInfo),g=n.pendingProps,t===null?n.child=Yn(n,null,g,s):yt(t,n,g,s),n.child;case 11:return g=n.type,E=n.pendingProps,E=n.elementType===g?E:qt(g,E),Vd(t,n,g,E,s);case 7:return yt(t,n,n.pendingProps,s),n.child;case 8:return yt(t,n,n.pendingProps.children,s),n.child;case 12:return yt(t,n,n.pendingProps.children,s),n.child;case 10:e:{if(g=n.type._context,E=n.pendingProps,A=n.memoizedProps,$=E.value,He(yo,g._currentValue),g._currentValue=$,A!==null)if(Ut(A.value,$)){if(A.children===E.children&&!St.current){n=Sr(t,n,s);break e}}else for(A=n.child,A!==null&&(A.return=n);A!==null;){var Y=A.dependencies;if(Y!==null){$=A.child;for(var Q=Y.firstContext;Q!==null;){if(Q.context===g){if(A.tag===1){Q=wr(-1,s&-s),Q.tag=2;var oe=A.updateQueue;if(oe!==null){oe=oe.shared;var de=oe.pending;de===null?Q.next=Q:(Q.next=de.next,de.next=Q),oe.pending=Q}}A.lanes|=s,Q=A.alternate,Q!==null&&(Q.lanes|=s),Vl(A.return,s,n),Y.lanes|=s;break}Q=Q.next}}else if(A.tag===10)$=A.type===n.type?null:A.child;else if(A.tag===18){if($=A.return,$===null)throw Error(i(341));$.lanes|=s,Y=$.alternate,Y!==null&&(Y.lanes|=s),Vl($,s,n),$=A.sibling}else $=A.child;if($!==null)$.return=A;else for($=A;$!==null;){if($===n){$=null;break}if(A=$.sibling,A!==null){A.return=$.return,$=A;break}$=$.return}A=$}yt(t,n,E.children,s),n=n.child}return n;case 9:return E=n.type,g=n.pendingProps.children,Qn(n,s),E=Ft(E),g=g(E),n.flags|=1,yt(t,n,g,s),n.child;case 14:return g=n.type,E=qt(g,n.pendingProps),E=qt(g.type,E),qd(t,n,g,E,s);case 15:return Kd(t,n,n.type,n.pendingProps,s);case 17:return g=n.type,E=n.pendingProps,E=n.elementType===g?E:qt(g,E),To(t,n),n.tag=1,Ct(g)?(t=!0,fo(n)):t=!1,Qn(n,s),Hd(n,g,E),ac(n,g,E,s),hc(null,n,g,!0,t,s);case 19:return tf(t,n,s);case 22:return Xd(t,n,s)}throw Error(i(156,n.tag))};function kf(t,n){return $s(t,n)}function H0(t,n,s,g){this.tag=t,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $t(t,n,s,g){return new H0(t,n,s,g)}function Tc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function F0(t){if(typeof t=="function")return Tc(t)?1:0;if(t!=null){if(t=t.$$typeof,t===j)return 11;if(t===q)return 14}return 2}function Xr(t,n){var s=t.alternate;return s===null?(s=$t(t.tag,n,t.key,t.mode),s.elementType=t.elementType,s.type=t.type,s.stateNode=t.stateNode,s.alternate=t,t.alternate=s):(s.pendingProps=n,s.type=t.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=t.flags&14680064,s.childLanes=t.childLanes,s.lanes=t.lanes,s.child=t.child,s.memoizedProps=t.memoizedProps,s.memoizedState=t.memoizedState,s.updateQueue=t.updateQueue,n=t.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},s.sibling=t.sibling,s.index=t.index,s.ref=t.ref,s}function $o(t,n,s,g,E,A){var $=2;if(g=t,typeof t=="function")Tc(t)&&($=1);else if(typeof t=="string")$=5;else e:switch(t){case D:return yn(s.children,E,A,n);case k:$=8,E|=8;break;case M:return t=$t(12,s,n,E|2),t.elementType=M,t.lanes=A,t;case N:return t=$t(13,s,n,E),t.elementType=N,t.lanes=A,t;case I:return t=$t(19,s,n,E),t.elementType=I,t.lanes=A,t;case K:return Wo(s,E,A,n);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case W:$=10;break e;case z:$=9;break e;case j:$=11;break e;case q:$=14;break e;case U:$=16,g=null;break e}throw Error(i(130,t==null?t:typeof t,""))}return n=$t($,s,n,E),n.elementType=t,n.type=g,n.lanes=A,n}function yn(t,n,s,g){return t=$t(7,t,g,n),t.lanes=s,t}function Wo(t,n,s,g){return t=$t(22,t,g,n),t.elementType=K,t.lanes=s,t.stateNode={isHidden:!1},t}function Mc(t,n,s){return t=$t(6,t,null,n),t.lanes=s,t}function Pc(t,n,s){return n=$t(4,t.children!==null?t.children:[],t.key,n),n.lanes=s,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}function j0(t,n,s,g,E){this.tag=n,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ai(0),this.expirationTimes=Ai(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ai(0),this.identifierPrefix=g,this.onRecoverableError=E,this.mutableSourceEagerHydrationData=null}function Nc(t,n,s,g,E,A,$,Y,Q){return t=new j0(t,n,s,Y,Q),n===1?(n=1,A===!0&&(n|=8)):n=0,A=$t(3,null,null,n),t.current=A,A.stateNode=t,A.memoizedState={element:g,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},Kl(A),t}function z0(t,n,s){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:R,key:g==null?null:""+g,children:t,containerInfo:n,implementation:s}}function Lf(t){if(!t)return Fr;t=t._reactInternals;e:{if(rr(t)!==t||t.tag!==1)throw Error(i(170));var n=t;do{switch(n.tag){case 3:n=n.stateNode.context;break e;case 1:if(Ct(n.type)){n=n.stateNode.__reactInternalMemoizedMergedChildContext;break e}}n=n.return}while(n!==null);throw Error(i(171))}if(t.tag===1){var s=t.type;if(Ct(s))return ed(t,s,n)}return n}function Rf(t,n,s,g,E,A,$,Y,Q){return t=Nc(s,g,!0,t,E,A,$,Y,Q),t.context=Lf(null),s=t.current,g=wt(),E=qr(s),A=wr(g,E),A.callback=n??null,$r(s,A,E),t.current.lanes=E,an(t,E,g),Et(t,g),t}function Uo(t,n,s,g){var E=n.current,A=wt(),$=qr(E);return s=Lf(s),n.context===null?n.context=s:n.pendingContext=s,n=wr(A,$),n.payload={element:t},g=g===void 0?null:g,g!==null&&(n.callback=g),t=$r(E,n,$),t!==null&&(Yt(t,E,$,A),So(t,E,$)),$}function Vo(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function Df(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var s=t.retryLane;t.retryLane=s!==0&&s<n?s:n}}function Bc(t,n){Df(t,n),(t=t.alternate)&&Df(t,n)}function $0(){return null}var Af=typeof reportError=="function"?reportError:function(t){console.error(t)};function Ic(t){this._internalRoot=t}qo.prototype.render=Ic.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(i(409));Uo(t,n,null,null)},qo.prototype.unmount=Ic.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;gn(function(){Uo(null,t,null,null)}),n[_r]=null}};function qo(t){this._internalRoot=t}qo.prototype.unstable_scheduleHydration=function(t){if(t){var n=dh();t={blockedOn:null,target:t,priority:n};for(var s=0;s<Nr.length&&n!==0&&n<Nr[s].priority;s++);Nr.splice(s,0,t),s===0&&_h(t)}};function Oc(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Ko(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Tf(){}function W0(t,n,s,g,E){if(E){if(typeof g=="function"){var A=g;g=function(){var oe=Vo($);A.call(oe)}}var $=Rf(n,g,t,0,null,!1,!1,"",Tf);return t._reactRootContainer=$,t[_r]=$.current,Ui(t.nodeType===8?t.parentNode:t),gn(),$}for(;E=t.lastChild;)t.removeChild(E);if(typeof g=="function"){var Y=g;g=function(){var oe=Vo(Q);Y.call(oe)}}var Q=Nc(t,0,!1,null,null,!1,!1,"",Tf);return t._reactRootContainer=Q,t[_r]=Q.current,Ui(t.nodeType===8?t.parentNode:t),gn(function(){Uo(n,Q,s,g)}),Q}function Xo(t,n,s,g,E){var A=s._reactRootContainer;if(A){var $=A;if(typeof E=="function"){var Y=E;E=function(){var Q=Vo($);Y.call(Q)}}Uo(n,$,t,E)}else $=W0(s,n,t,E,g);return Vo($)}uh=function(t){switch(t.tag){case 3:var n=t.stateNode;if(n.current.memoizedState.isDehydrated){var s=nr(n.pendingLanes);s!==0&&(al(n,s|1),Et(n,Ke()),(Me&6)===0&&(ri=Ke()+500,jr()))}break;case 13:gn(function(){var g=yr(t,1);if(g!==null){var E=wt();Yt(g,t,1,E)}}),Bc(t,1)}},ll=function(t){if(t.tag===13){var n=yr(t,134217728);if(n!==null){var s=wt();Yt(n,t,134217728,s)}Bc(t,134217728)}},hh=function(t){if(t.tag===13){var n=qr(t),s=yr(t,n);if(s!==null){var g=wt();Yt(s,t,n,g)}Bc(t,n)}},dh=function(){return Be},fh=function(t,n){var s=Be;try{return Be=t,n()}finally{Be=s}},Ci=function(t,n,s){switch(n){case"input":if(ge(t,s),n=s.name,s.type==="radio"&&n!=null){for(s=t;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll("input[name="+JSON.stringify(""+n)+'][type="radio"]'),n=0;n<s.length;n++){var g=s[n];if(g!==t&&g.form===t.form){var E=uo(g);if(!E)throw Error(i(90));le(g),ge(g,E)}}}break;case"textarea":pt(t,s);break;case"select":n=s.value,n!=null&&Qe(t,!!s.multiple,n,!1)}},Os=Rc,Hs=gn;var U0={usingClientEntryPoint:!1,Events:[Ki,Wn,uo,Bs,Is,Rc]},as={findFiberByHostInstance:ln,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},V0={bundleType:as.bundleType,version:as.version,rendererPackageName:as.rendererPackageName,rendererConfig:as.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:w.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=js(t),t===null?null:t.stateNode},findFiberByHostInstance:as.findFiberByHostInstance||$0,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yo.isDisabled&&Yo.supportsFiber)try{on=Yo.inject(V0),It=Yo}catch{}}return kt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=U0,kt.createPortal=function(t,n){var s=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Oc(n))throw Error(i(200));return z0(t,n,null,s)},kt.createRoot=function(t,n){if(!Oc(t))throw Error(i(299));var s=!1,g="",E=Af;return n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(g=n.identifierPrefix),n.onRecoverableError!==void 0&&(E=n.onRecoverableError)),n=Nc(t,1,!1,null,null,s,!1,g,E),t[_r]=n.current,Ui(t.nodeType===8?t.parentNode:t),new Ic(n)},kt.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var n=t._reactInternals;if(n===void 0)throw typeof t.render=="function"?Error(i(188)):(t=Object.keys(t).join(","),Error(i(268,t)));return t=js(n),t=t===null?null:t.stateNode,t},kt.flushSync=function(t){return gn(t)},kt.hydrate=function(t,n,s){if(!Ko(n))throw Error(i(200));return Xo(null,t,n,!0,s)},kt.hydrateRoot=function(t,n,s){if(!Oc(t))throw Error(i(405));var g=s!=null&&s.hydratedSources||null,E=!1,A="",$=Af;if(s!=null&&(s.unstable_strictMode===!0&&(E=!0),s.identifierPrefix!==void 0&&(A=s.identifierPrefix),s.onRecoverableError!==void 0&&($=s.onRecoverableError)),n=Rf(n,null,t,1,s??null,E,!1,A,$),t[_r]=n.current,Ui(t),g)for(t=0;t<g.length;t++)s=g[t],E=s._getVersion,E=E(s._source),n.mutableSourceEagerHydrationData==null?n.mutableSourceEagerHydrationData=[s,E]:n.mutableSourceEagerHydrationData.push(s,E);return new qo(n)},kt.render=function(t,n,s){if(!Ko(n))throw Error(i(200));return Xo(null,t,n,!1,s)},kt.unmountComponentAtNode=function(t){if(!Ko(t))throw Error(i(40));return t._reactRootContainer?(gn(function(){Xo(null,null,t,!1,function(){t._reactRootContainer=null,t[_r]=null})}),!0):!1},kt.unstable_batchedUpdates=Rc,kt.unstable_renderSubtreeIntoContainer=function(t,n,s,g){if(!Ko(s))throw Error(i(200));if(t==null||t._reactInternals===void 0)throw Error(i(38));return Xo(t,n,s,!1,g)},kt.version="18.3.1-next-f1338f8080-20240426",kt}var Ff;function r_(){if(Ff)return jc.exports;Ff=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(r){console.error(r)}}return e(),jc.exports=J0(),jc.exports}var jf;function Z0(){if(jf)return Go;jf=1;var e=r_();return Go.createRoot=e.createRoot,Go.hydrateRoot=e.hydrateRoot,Go}var ev=Z0();const tv=Ou(ev),hr=Object.create(null);hr.open="0";hr.close="1";hr.ping="2";hr.pong="3";hr.message="4";hr.upgrade="5";hr.noop="6";const ca=Object.create(null);Object.keys(hr).forEach(e=>{ca[hr[e]]=e});const du={type:"error",data:"parser error"},n_=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",i_=typeof ArrayBuffer=="function",s_=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Fu=({type:e,data:r},i,o)=>n_&&r instanceof Blob?i?o(r):zf(r,o):i_&&(r instanceof ArrayBuffer||s_(r))?i?o(r):zf(new Blob([r]),o):o(hr[e]+(r||"")),zf=(e,r)=>{const i=new FileReader;return i.onload=function(){const o=i.result.split(",")[1];r("b"+(o||""))},i.readAsDataURL(e)};function $f(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Wc;function rv(e,r){if(n_&&e.data instanceof Blob)return e.data.arrayBuffer().then($f).then(r);if(i_&&(e.data instanceof ArrayBuffer||s_(e.data)))return r($f(e.data));Fu(e,!1,i=>{Wc||(Wc=new TextEncoder),r(Wc.encode(i))})}const Wf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ds=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<Wf.length;e++)ds[Wf.charCodeAt(e)]=e;const nv=e=>{let r=e.length*.75,i=e.length,o,h=0,S,y,a,l;e[e.length-1]==="="&&(r--,e[e.length-2]==="="&&r--);const _=new ArrayBuffer(r),v=new Uint8Array(_);for(o=0;o<i;o+=4)S=ds[e.charCodeAt(o)],y=ds[e.charCodeAt(o+1)],a=ds[e.charCodeAt(o+2)],l=ds[e.charCodeAt(o+3)],v[h++]=S<<2|y>>4,v[h++]=(y&15)<<4|a>>2,v[h++]=(a&3)<<6|l&63;return _},iv=typeof ArrayBuffer=="function",ju=(e,r)=>{if(typeof e!="string")return{type:"message",data:o_(e,r)};const i=e.charAt(0);return i==="b"?{type:"message",data:sv(e.substring(1),r)}:ca[i]?e.length>1?{type:ca[i],data:e.substring(1)}:{type:ca[i]}:du},sv=(e,r)=>{if(iv){const i=nv(e);return o_(i,r)}else return{base64:!0,data:e}},o_=(e,r)=>{switch(r){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},a_="",ov=(e,r)=>{const i=e.length,o=new Array(i);let h=0;e.forEach((S,y)=>{Fu(S,!1,a=>{o[y]=a,++h===i&&r(o.join(a_))})})},av=(e,r)=>{const i=e.split(a_),o=[];for(let h=0;h<i.length;h++){const S=ju(i[h],r);if(o.push(S),S.type==="error")break}return o};function lv(){return new TransformStream({transform(e,r){rv(e,i=>{const o=i.length;let h;if(o<126)h=new Uint8Array(1),new DataView(h.buffer).setUint8(0,o);else if(o<65536){h=new Uint8Array(3);const S=new DataView(h.buffer);S.setUint8(0,126),S.setUint16(1,o)}else{h=new Uint8Array(9);const S=new DataView(h.buffer);S.setUint8(0,127),S.setBigUint64(1,BigInt(o))}e.data&&typeof e.data!="string"&&(h[0]|=128),r.enqueue(h),r.enqueue(i)})}})}let Uc;function Qo(e){return e.reduce((r,i)=>r+i.length,0)}function Jo(e,r){if(e[0].length===r)return e.shift();const i=new Uint8Array(r);let o=0;for(let h=0;h<r;h++)i[h]=e[0][o++],o===e[0].length&&(e.shift(),o=0);return e.length&&o<e[0].length&&(e[0]=e[0].slice(o)),i}function cv(e,r){Uc||(Uc=new TextDecoder);const i=[];let o=0,h=-1,S=!1;return new TransformStream({transform(y,a){for(i.push(y);;){if(o===0){if(Qo(i)<1)break;const l=Jo(i,1);S=(l[0]&128)===128,h=l[0]&127,h<126?o=3:h===126?o=1:o=2}else if(o===1){if(Qo(i)<2)break;const l=Jo(i,2);h=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),o=3}else if(o===2){if(Qo(i)<8)break;const l=Jo(i,8),_=new DataView(l.buffer,l.byteOffset,l.length),v=_.getUint32(0);if(v>Math.pow(2,21)-1){a.enqueue(du);break}h=v*Math.pow(2,32)+_.getUint32(4),o=3}else{if(Qo(i)<h)break;const l=Jo(i,h);a.enqueue(ju(S?l:Uc.decode(l),r)),o=0}if(h===0||h>e){a.enqueue(du);break}}}})}const l_=4;function tt(e){if(e)return uv(e)}function uv(e){for(var r in tt.prototype)e[r]=tt.prototype[r];return e}tt.prototype.on=tt.prototype.addEventListener=function(e,r){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(r),this};tt.prototype.once=function(e,r){function i(){this.off(e,i),r.apply(this,arguments)}return i.fn=r,this.on(e,i),this};tt.prototype.off=tt.prototype.removeListener=tt.prototype.removeAllListeners=tt.prototype.removeEventListener=function(e,r){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var i=this._callbacks["$"+e];if(!i)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var o,h=0;h<i.length;h++)if(o=i[h],o===r||o.fn===r){i.splice(h,1);break}return i.length===0&&delete this._callbacks["$"+e],this};tt.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var r=new Array(arguments.length-1),i=this._callbacks["$"+e],o=1;o<arguments.length;o++)r[o-1]=arguments[o];if(i){i=i.slice(0);for(var o=0,h=i.length;o<h;++o)i[o].apply(this,r)}return this};tt.prototype.emitReserved=tt.prototype.emit;tt.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};tt.prototype.hasListeners=function(e){return!!this.listeners(e).length};const Pa=typeof Promise=="function"&&typeof Promise.resolve=="function"?r=>Promise.resolve().then(r):(r,i)=>i(r,0),Wt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),hv="arraybuffer";function c_(e,...r){return r.reduce((i,o)=>(e.hasOwnProperty(o)&&(i[o]=e[o]),i),{})}const dv=Wt.setTimeout,fv=Wt.clearTimeout;function Na(e,r){r.useNativeTimers?(e.setTimeoutFn=dv.bind(Wt),e.clearTimeoutFn=fv.bind(Wt)):(e.setTimeoutFn=Wt.setTimeout.bind(Wt),e.clearTimeoutFn=Wt.clearTimeout.bind(Wt))}const pv=1.33;function _v(e){return typeof e=="string"?gv(e):Math.ceil((e.byteLength||e.size)*pv)}function gv(e){let r=0,i=0;for(let o=0,h=e.length;o<h;o++)r=e.charCodeAt(o),r<128?i+=1:r<2048?i+=2:r<55296||r>=57344?i+=3:(o++,i+=4);return i}function u_(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function mv(e){let r="";for(let i in e)e.hasOwnProperty(i)&&(r.length&&(r+="&"),r+=encodeURIComponent(i)+"="+encodeURIComponent(e[i]));return r}function vv(e){let r={},i=e.split("&");for(let o=0,h=i.length;o<h;o++){let S=i[o].split("=");r[decodeURIComponent(S[0])]=decodeURIComponent(S[1])}return r}class yv extends Error{constructor(r,i,o){super(r),this.description=i,this.context=o,this.type="TransportError"}}class zu extends tt{constructor(r){super(),this.writable=!1,Na(this,r),this.opts=r,this.query=r.query,this.socket=r.socket,this.supportsBinary=!r.forceBase64}onError(r,i,o){return super.emitReserved("error",new yv(r,i,o)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(r){this.readyState==="open"&&this.write(r)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(r){const i=ju(r,this.socket.binaryType);this.onPacket(i)}onPacket(r){super.emitReserved("packet",r)}onClose(r){this.readyState="closed",super.emitReserved("close",r)}pause(r){}createUri(r,i={}){return r+"://"+this._hostname()+this._port()+this.opts.path+this._query(i)}_hostname(){const r=this.opts.hostname;return r.indexOf(":")===-1?r:"["+r+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(r){const i=mv(r);return i.length?"?"+i:""}}class wv extends zu{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(r){this.readyState="pausing";const i=()=>{this.readyState="paused",r()};if(this._polling||!this.writable){let o=0;this._polling&&(o++,this.once("pollComplete",function(){--o||i()})),this.writable||(o++,this.once("drain",function(){--o||i()}))}else i()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(r){const i=o=>{if(this.readyState==="opening"&&o.type==="open"&&this.onOpen(),o.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(o)};av(r,this.socket.binaryType).forEach(i),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const r=()=>{this.write([{type:"close"}])};this.readyState==="open"?r():this.once("open",r)}write(r){this.writable=!1,ov(r,i=>{this.doWrite(i,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const r=this.opts.secure?"https":"http",i=this.query||{};return this.opts.timestampRequests!==!1&&(i[this.opts.timestampParam]=u_()),!this.supportsBinary&&!i.sid&&(i.b64=1),this.createUri(r,i)}}let h_=!1;try{h_=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Sv=h_;function Cv(){}class xv extends wv{constructor(r){if(super(r),typeof location<"u"){const i=location.protocol==="https:";let o=location.port;o||(o=i?"443":"80"),this.xd=typeof location<"u"&&r.hostname!==location.hostname||o!==r.port}}doWrite(r,i){const o=this.request({method:"POST",data:r});o.on("success",i),o.on("error",(h,S)=>{this.onError("xhr post error",h,S)})}doPoll(){const r=this.request();r.on("data",this.onData.bind(this)),r.on("error",(i,o)=>{this.onError("xhr poll error",i,o)}),this.pollXhr=r}}class cr extends tt{constructor(r,i,o){super(),this.createRequest=r,Na(this,o),this._opts=o,this._method=o.method||"GET",this._uri=i,this._data=o.data!==void 0?o.data:null,this._create()}_create(){var r;const i=c_(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");i.xdomain=!!this._opts.xd;const o=this._xhr=this.createRequest(i);try{o.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){o.setDisableHeaderCheck&&o.setDisableHeaderCheck(!0);for(let h in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(h)&&o.setRequestHeader(h,this._opts.extraHeaders[h])}}catch{}if(this._method==="POST")try{o.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{o.setRequestHeader("Accept","*/*")}catch{}(r=this._opts.cookieJar)===null||r===void 0||r.addCookies(o),"withCredentials"in o&&(o.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(o.timeout=this._opts.requestTimeout),o.onreadystatechange=()=>{var h;o.readyState===3&&((h=this._opts.cookieJar)===null||h===void 0||h.parseCookies(o.getResponseHeader("set-cookie"))),o.readyState===4&&(o.status===200||o.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof o.status=="number"?o.status:0)},0))},o.send(this._data)}catch(h){this.setTimeoutFn(()=>{this._onError(h)},0);return}typeof document<"u"&&(this._index=cr.requestsCount++,cr.requests[this._index]=this)}_onError(r){this.emitReserved("error",r,this._xhr),this._cleanup(!0)}_cleanup(r){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Cv,r)try{this._xhr.abort()}catch{}typeof document<"u"&&delete cr.requests[this._index],this._xhr=null}}_onLoad(){const r=this._xhr.responseText;r!==null&&(this.emitReserved("data",r),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}cr.requestsCount=0;cr.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Uf);else if(typeof addEventListener=="function"){const e="onpagehide"in Wt?"pagehide":"unload";addEventListener(e,Uf,!1)}}function Uf(){for(let e in cr.requests)cr.requests.hasOwnProperty(e)&&cr.requests[e].abort()}const bv=(function(){const e=d_({xdomain:!1});return e&&e.responseType!==null})();class Ev extends xv{constructor(r){super(r);const i=r&&r.forceBase64;this.supportsBinary=bv&&!i}request(r={}){return Object.assign(r,{xd:this.xd},this.opts),new cr(d_,this.uri(),r)}}function d_(e){const r=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!r||Sv))return new XMLHttpRequest}catch{}if(!r)try{return new Wt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const f_=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class kv extends zu{get name(){return"websocket"}doOpen(){const r=this.uri(),i=this.opts.protocols,o=f_?{}:c_(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(o.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(r,i,o)}catch(h){return this.emitReserved("error",h)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=r=>this.onClose({description:"websocket connection closed",context:r}),this.ws.onmessage=r=>this.onData(r.data),this.ws.onerror=r=>this.onError("websocket error",r)}write(r){this.writable=!1;for(let i=0;i<r.length;i++){const o=r[i],h=i===r.length-1;Fu(o,this.supportsBinary,S=>{try{this.doWrite(o,S)}catch{}h&&Pa(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const r=this.opts.secure?"wss":"ws",i=this.query||{};return this.opts.timestampRequests&&(i[this.opts.timestampParam]=u_()),this.supportsBinary||(i.b64=1),this.createUri(r,i)}}const Vc=Wt.WebSocket||Wt.MozWebSocket;class Lv extends kv{createSocket(r,i,o){return f_?new Vc(r,i,o):i?new Vc(r,i):new Vc(r)}doWrite(r,i){this.ws.send(i)}}class Rv extends zu{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(r){return this.emitReserved("error",r)}this._transport.closed.then(()=>{this.onClose()}).catch(r=>{this.onError("webtransport error",r)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(r=>{const i=cv(Number.MAX_SAFE_INTEGER,this.socket.binaryType),o=r.readable.pipeThrough(i).getReader(),h=lv();h.readable.pipeTo(r.writable),this._writer=h.writable.getWriter();const S=()=>{o.read().then(({done:a,value:l})=>{a||(this.onPacket(l),S())}).catch(a=>{})};S();const y={type:"open"};this.query.sid&&(y.data=`{"sid":"${this.query.sid}"}`),this._writer.write(y).then(()=>this.onOpen())})})}write(r){this.writable=!1;for(let i=0;i<r.length;i++){const o=r[i],h=i===r.length-1;this._writer.write(o).then(()=>{h&&Pa(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var r;(r=this._transport)===null||r===void 0||r.close()}}const Dv={websocket:Lv,webtransport:Rv,polling:Ev},Av=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Tv=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function fu(e){if(e.length>8e3)throw"URI too long";const r=e,i=e.indexOf("["),o=e.indexOf("]");i!=-1&&o!=-1&&(e=e.substring(0,i)+e.substring(i,o).replace(/:/g,";")+e.substring(o,e.length));let h=Av.exec(e||""),S={},y=14;for(;y--;)S[Tv[y]]=h[y]||"";return i!=-1&&o!=-1&&(S.source=r,S.host=S.host.substring(1,S.host.length-1).replace(/;/g,":"),S.authority=S.authority.replace("[","").replace("]","").replace(/;/g,":"),S.ipv6uri=!0),S.pathNames=Mv(S,S.path),S.queryKey=Pv(S,S.query),S}function Mv(e,r){const i=/\/{2,9}/g,o=r.replace(i,"/").split("/");return(r.slice(0,1)=="/"||r.length===0)&&o.splice(0,1),r.slice(-1)=="/"&&o.splice(o.length-1,1),o}function Pv(e,r){const i={};return r.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(o,h,S){h&&(i[h]=S)}),i}const pu=typeof addEventListener=="function"&&typeof removeEventListener=="function",ua=[];pu&&addEventListener("offline",()=>{ua.forEach(e=>e())},!1);class en extends tt{constructor(r,i){if(super(),this.binaryType=hv,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,r&&typeof r=="object"&&(i=r,r=null),r){const o=fu(r);i.hostname=o.host,i.secure=o.protocol==="https"||o.protocol==="wss",i.port=o.port,o.query&&(i.query=o.query)}else i.host&&(i.hostname=fu(i.host).host);Na(this,i),this.secure=i.secure!=null?i.secure:typeof location<"u"&&location.protocol==="https:",i.hostname&&!i.port&&(i.port=this.secure?"443":"80"),this.hostname=i.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=i.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},i.transports.forEach(o=>{const h=o.prototype.name;this.transports.push(h),this._transportsByName[h]=o}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},i),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=vv(this.opts.query)),pu&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},ua.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(r){const i=Object.assign({},this.opts.query);i.EIO=l_,i.transport=r,this.id&&(i.sid=this.id);const o=Object.assign({},this.opts,{query:i,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[r]);return new this._transportsByName[r](o)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const r=this.opts.rememberUpgrade&&en.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const i=this.createTransport(r);i.open(),this.setTransport(i)}setTransport(r){this.transport&&this.transport.removeAllListeners(),this.transport=r,r.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",i=>this._onClose("transport close",i))}onOpen(){this.readyState="open",en.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(r){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",r),this.emitReserved("heartbeat"),r.type){case"open":this.onHandshake(JSON.parse(r.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const i=new Error("server error");i.code=r.data,this._onError(i);break;case"message":this.emitReserved("data",r.data),this.emitReserved("message",r.data);break}}onHandshake(r){this.emitReserved("handshake",r),this.id=r.sid,this.transport.query.sid=r.sid,this._pingInterval=r.pingInterval,this._pingTimeout=r.pingTimeout,this._maxPayload=r.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const r=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+r,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},r),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const r=this._getWritablePackets();this.transport.send(r),this._prevBufferLen=r.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let i=1;for(let o=0;o<this.writeBuffer.length;o++){const h=this.writeBuffer[o].data;if(h&&(i+=_v(h)),o>0&&i>this._maxPayload)return this.writeBuffer.slice(0,o);i+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const r=Date.now()>this._pingTimeoutTime;return r&&(this._pingTimeoutTime=0,Pa(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),r}write(r,i,o){return this._sendPacket("message",r,i,o),this}send(r,i,o){return this._sendPacket("message",r,i,o),this}_sendPacket(r,i,o,h){if(typeof i=="function"&&(h=i,i=void 0),typeof o=="function"&&(h=o,o=null),this.readyState==="closing"||this.readyState==="closed")return;o=o||{},o.compress=o.compress!==!1;const S={type:r,data:i,options:o};this.emitReserved("packetCreate",S),this.writeBuffer.push(S),h&&this.once("flush",h),this.flush()}close(){const r=()=>{this._onClose("forced close"),this.transport.close()},i=()=>{this.off("upgrade",i),this.off("upgradeError",i),r()},o=()=>{this.once("upgrade",i),this.once("upgradeError",i)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?o():r()}):this.upgrading?o():r()),this}_onError(r){if(en.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",r),this._onClose("transport error",r)}_onClose(r,i){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),pu&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const o=ua.indexOf(this._offlineEventListener);o!==-1&&ua.splice(o,1)}this.readyState="closed",this.id=null,this.emitReserved("close",r,i),this.writeBuffer=[],this._prevBufferLen=0}}}en.protocol=l_;class Nv extends en{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let r=0;r<this._upgrades.length;r++)this._probe(this._upgrades[r])}_probe(r){let i=this.createTransport(r),o=!1;en.priorWebsocketSuccess=!1;const h=()=>{o||(i.send([{type:"ping",data:"probe"}]),i.once("packet",c=>{if(!o)if(c.type==="pong"&&c.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",i),!i)return;en.priorWebsocketSuccess=i.name==="websocket",this.transport.pause(()=>{o||this.readyState!=="closed"&&(v(),this.setTransport(i),i.send([{type:"upgrade"}]),this.emitReserved("upgrade",i),i=null,this.upgrading=!1,this.flush())})}else{const m=new Error("probe error");m.transport=i.name,this.emitReserved("upgradeError",m)}}))};function S(){o||(o=!0,v(),i.close(),i=null)}const y=c=>{const m=new Error("probe error: "+c);m.transport=i.name,S(),this.emitReserved("upgradeError",m)};function a(){y("transport closed")}function l(){y("socket closed")}function _(c){i&&c.name!==i.name&&S()}const v=()=>{i.removeListener("open",h),i.removeListener("error",y),i.removeListener("close",a),this.off("close",l),this.off("upgrading",_)};i.once("open",h),i.once("error",y),i.once("close",a),this.once("close",l),this.once("upgrading",_),this._upgrades.indexOf("webtransport")!==-1&&r!=="webtransport"?this.setTimeoutFn(()=>{o||i.open()},200):i.open()}onHandshake(r){this._upgrades=this._filterUpgrades(r.upgrades),super.onHandshake(r)}_filterUpgrades(r){const i=[];for(let o=0;o<r.length;o++)~this.transports.indexOf(r[o])&&i.push(r[o]);return i}}let Bv=class extends Nv{constructor(r,i={}){const o=typeof r=="object"?r:i;(!o.transports||o.transports&&typeof o.transports[0]=="string")&&(o.transports=(o.transports||["polling","websocket","webtransport"]).map(h=>Dv[h]).filter(h=>!!h)),super(r,o)}};function Iv(e,r="",i){let o=e;i=i||typeof location<"u"&&location,e==null&&(e=i.protocol+"//"+i.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=i.protocol+e:e=i.host+e),/^(https?|wss?):\/\//.test(e)||(typeof i<"u"?e=i.protocol+"//"+e:e="https://"+e),o=fu(e)),o.port||(/^(http|ws)$/.test(o.protocol)?o.port="80":/^(http|ws)s$/.test(o.protocol)&&(o.port="443")),o.path=o.path||"/";const S=o.host.indexOf(":")!==-1?"["+o.host+"]":o.host;return o.id=o.protocol+"://"+S+":"+o.port+r,o.href=o.protocol+"://"+S+(i&&i.port===o.port?"":":"+o.port),o}const Ov=typeof ArrayBuffer=="function",Hv=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,p_=Object.prototype.toString,Fv=typeof Blob=="function"||typeof Blob<"u"&&p_.call(Blob)==="[object BlobConstructor]",jv=typeof File=="function"||typeof File<"u"&&p_.call(File)==="[object FileConstructor]";function $u(e){return Ov&&(e instanceof ArrayBuffer||Hv(e))||Fv&&e instanceof Blob||jv&&e instanceof File}function ha(e,r){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let i=0,o=e.length;i<o;i++)if(ha(e[i]))return!0;return!1}if($u(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return ha(e.toJSON(),!0);for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&ha(e[i]))return!0;return!1}function zv(e){const r=[],i=e.data,o=e;return o.data=_u(i,r),o.attachments=r.length,{packet:o,buffers:r}}function _u(e,r){if(!e)return e;if($u(e)){const i={_placeholder:!0,num:r.length};return r.push(e),i}else if(Array.isArray(e)){const i=new Array(e.length);for(let o=0;o<e.length;o++)i[o]=_u(e[o],r);return i}else if(typeof e=="object"&&!(e instanceof Date)){const i={};for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(i[o]=_u(e[o],r));return i}return e}function $v(e,r){return e.data=gu(e.data,r),delete e.attachments,e}function gu(e,r){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<r.length)return r[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let i=0;i<e.length;i++)e[i]=gu(e[i],r);else if(typeof e=="object")for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(e[i]=gu(e[i],r));return e}const Wv=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Ae;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(Ae||(Ae={}));class Uv{constructor(r){this.replacer=r}encode(r){return(r.type===Ae.EVENT||r.type===Ae.ACK)&&ha(r)?this.encodeAsBinary({type:r.type===Ae.EVENT?Ae.BINARY_EVENT:Ae.BINARY_ACK,nsp:r.nsp,data:r.data,id:r.id}):[this.encodeAsString(r)]}encodeAsString(r){let i=""+r.type;return(r.type===Ae.BINARY_EVENT||r.type===Ae.BINARY_ACK)&&(i+=r.attachments+"-"),r.nsp&&r.nsp!=="/"&&(i+=r.nsp+","),r.id!=null&&(i+=r.id),r.data!=null&&(i+=JSON.stringify(r.data,this.replacer)),i}encodeAsBinary(r){const i=zv(r),o=this.encodeAsString(i.packet),h=i.buffers;return h.unshift(o),h}}class Wu extends tt{constructor(r){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof r=="function"?{reviver:r}:r)}add(r){let i;if(typeof r=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");i=this.decodeString(r);const o=i.type===Ae.BINARY_EVENT;o||i.type===Ae.BINARY_ACK?(i.type=o?Ae.EVENT:Ae.ACK,this.reconstructor=new Vv(i),i.attachments===0&&super.emitReserved("decoded",i)):super.emitReserved("decoded",i)}else if($u(r)||r.base64)if(this.reconstructor)i=this.reconstructor.takeBinaryData(r),i&&(this.reconstructor=null,super.emitReserved("decoded",i));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+r)}decodeString(r){let i=0;const o={type:Number(r.charAt(0))};if(Ae[o.type]===void 0)throw new Error("unknown packet type "+o.type);if(o.type===Ae.BINARY_EVENT||o.type===Ae.BINARY_ACK){const S=i+1;for(;r.charAt(++i)!=="-"&&i!=r.length;);const y=r.substring(S,i);if(y!=Number(y)||r.charAt(i)!=="-")throw new Error("Illegal attachments");const a=Number(y);if(!qv(a)||a<0)throw new Error("Illegal attachments");if(a>this.opts.maxAttachments)throw new Error("too many attachments");o.attachments=a}if(r.charAt(i+1)==="/"){const S=i+1;for(;++i&&!(r.charAt(i)===","||i===r.length););o.nsp=r.substring(S,i)}else o.nsp="/";const h=r.charAt(i+1);if(h!==""&&Number(h)==h){const S=i+1;for(;++i;){const y=r.charAt(i);if(y==null||Number(y)!=y){--i;break}if(i===r.length)break}o.id=Number(r.substring(S,i+1))}if(r.charAt(++i)){const S=this.tryParse(r.substr(i));if(Wu.isPayloadValid(o.type,S))o.data=S;else throw new Error("invalid payload")}return o}tryParse(r){try{return JSON.parse(r,this.opts.reviver)}catch{return!1}}static isPayloadValid(r,i){switch(r){case Ae.CONNECT:return Vf(i);case Ae.DISCONNECT:return i===void 0;case Ae.CONNECT_ERROR:return typeof i=="string"||Vf(i);case Ae.EVENT:case Ae.BINARY_EVENT:return Array.isArray(i)&&(typeof i[0]=="number"||typeof i[0]=="string"&&Wv.indexOf(i[0])===-1);case Ae.ACK:case Ae.BINARY_ACK:return Array.isArray(i)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Vv{constructor(r){this.packet=r,this.buffers=[],this.reconPack=r}takeBinaryData(r){if(this.buffers.push(r),this.buffers.length===this.reconPack.attachments){const i=$v(this.reconPack,this.buffers);return this.finishedReconstruction(),i}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const qv=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};function Vf(e){return Object.prototype.toString.call(e)==="[object Object]"}const Kv=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Wu,Encoder:Uv,get PacketType(){return Ae}},Symbol.toStringTag,{value:"Module"}));function Gt(e,r,i){return e.on(r,i),function(){e.off(r,i)}}const Xv=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class __ extends tt{constructor(r,i,o){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=r,this.nsp=i,o&&o.auth&&(this.auth=o.auth),this._opts=Object.assign({},o),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const r=this.io;this.subs=[Gt(r,"open",this.onopen.bind(this)),Gt(r,"packet",this.onpacket.bind(this)),Gt(r,"error",this.onerror.bind(this)),Gt(r,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...r){return r.unshift("message"),this.emit.apply(this,r),this}emit(r,...i){var o,h,S;if(Xv.hasOwnProperty(r))throw new Error('"'+r.toString()+'" is a reserved event name');if(i.unshift(r),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(i),this;const y={type:Ae.EVENT,data:i};if(y.options={},y.options.compress=this.flags.compress!==!1,typeof i[i.length-1]=="function"){const v=this.ids++,c=i.pop();this._registerAckCallback(v,c),y.id=v}const a=(h=(o=this.io.engine)===null||o===void 0?void 0:o.transport)===null||h===void 0?void 0:h.writable,l=this.connected&&!(!((S=this.io.engine)===null||S===void 0)&&S._hasPingExpired());return this.flags.volatile&&!a||(l?(this.notifyOutgoingListeners(y),this.packet(y)):this.sendBuffer.push(y)),this.flags={},this}_registerAckCallback(r,i){var o;const h=(o=this.flags.timeout)!==null&&o!==void 0?o:this._opts.ackTimeout;if(h===void 0){this.acks[r]=i;return}const S=this.io.setTimeoutFn(()=>{delete this.acks[r];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===r&&this.sendBuffer.splice(a,1);i.call(this,new Error("operation has timed out"))},h),y=(...a)=>{this.io.clearTimeoutFn(S),i.apply(this,a)};y.withError=!0,this.acks[r]=y}emitWithAck(r,...i){return new Promise((o,h)=>{const S=(y,a)=>y?h(y):o(a);S.withError=!0,i.push(S),this.emit(r,...i)})}_addToQueue(r){let i;typeof r[r.length-1]=="function"&&(i=r.pop());const o={id:this._queueSeq++,tryCount:0,pending:!1,args:r,flags:Object.assign({fromQueue:!0},this.flags)};r.push((h,...S)=>(this._queue[0],h!==null?o.tryCount>this._opts.retries&&(this._queue.shift(),i&&i(h)):(this._queue.shift(),i&&i(null,...S)),o.pending=!1,this._drainQueue())),this._queue.push(o),this._drainQueue()}_drainQueue(r=!1){if(!this.connected||this._queue.length===0)return;const i=this._queue[0];i.pending&&!r||(i.pending=!0,i.tryCount++,this.flags=i.flags,this.emit.apply(this,i.args))}packet(r){r.nsp=this.nsp,this.io._packet(r)}onopen(){typeof this.auth=="function"?this.auth(r=>{this._sendConnectPacket(r)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(r){this.packet({type:Ae.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},r):r})}onerror(r){this.connected||this.emitReserved("connect_error",r)}onclose(r,i){this.connected=!1,delete this.id,this.emitReserved("disconnect",r,i),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(r=>{if(!this.sendBuffer.some(o=>String(o.id)===r)){const o=this.acks[r];delete this.acks[r],o.withError&&o.call(this,new Error("socket has been disconnected"))}})}onpacket(r){if(r.nsp===this.nsp)switch(r.type){case Ae.CONNECT:r.data&&r.data.sid?this.onconnect(r.data.sid,r.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ae.EVENT:case Ae.BINARY_EVENT:this.onevent(r);break;case Ae.ACK:case Ae.BINARY_ACK:this.onack(r);break;case Ae.DISCONNECT:this.ondisconnect();break;case Ae.CONNECT_ERROR:this.destroy();const o=new Error(r.data.message);o.data=r.data.data,this.emitReserved("connect_error",o);break}}onevent(r){const i=r.data||[];r.id!=null&&i.push(this.ack(r.id)),this.connected?this.emitEvent(i):this.receiveBuffer.push(Object.freeze(i))}emitEvent(r){if(this._anyListeners&&this._anyListeners.length){const i=this._anyListeners.slice();for(const o of i)o.apply(this,r)}super.emit.apply(this,r),this._pid&&r.length&&typeof r[r.length-1]=="string"&&(this._lastOffset=r[r.length-1])}ack(r){const i=this;let o=!1;return function(...h){o||(o=!0,i.packet({type:Ae.ACK,id:r,data:h}))}}onack(r){const i=this.acks[r.id];typeof i=="function"&&(delete this.acks[r.id],i.withError&&r.data.unshift(null),i.apply(this,r.data))}onconnect(r,i){this.id=r,this.recovered=i&&this._pid===i,this._pid=i,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(r=>this.emitEvent(r)),this.receiveBuffer=[],this.sendBuffer.forEach(r=>{this.notifyOutgoingListeners(r),this.packet(r)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(r=>r()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ae.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(r){return this.flags.compress=r,this}get volatile(){return this.flags.volatile=!0,this}timeout(r){return this.flags.timeout=r,this}onAny(r){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(r),this}prependAny(r){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(r),this}offAny(r){if(!this._anyListeners)return this;if(r){const i=this._anyListeners;for(let o=0;o<i.length;o++)if(r===i[o])return i.splice(o,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(r){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(r),this}prependAnyOutgoing(r){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(r),this}offAnyOutgoing(r){if(!this._anyOutgoingListeners)return this;if(r){const i=this._anyOutgoingListeners;for(let o=0;o<i.length;o++)if(r===i[o])return i.splice(o,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(r){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const i=this._anyOutgoingListeners.slice();for(const o of i)o.apply(this,r.data)}}}function mi(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}mi.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var r=Math.random(),i=Math.floor(r*this.jitter*e);e=(Math.floor(r*10)&1)==0?e-i:e+i}return Math.min(e,this.max)|0};mi.prototype.reset=function(){this.attempts=0};mi.prototype.setMin=function(e){this.ms=e};mi.prototype.setMax=function(e){this.max=e};mi.prototype.setJitter=function(e){this.jitter=e};class mu extends tt{constructor(r,i){var o;super(),this.nsps={},this.subs=[],r&&typeof r=="object"&&(i=r,r=void 0),i=i||{},i.path=i.path||"/socket.io",this.opts=i,Na(this,i),this.reconnection(i.reconnection!==!1),this.reconnectionAttempts(i.reconnectionAttempts||1/0),this.reconnectionDelay(i.reconnectionDelay||1e3),this.reconnectionDelayMax(i.reconnectionDelayMax||5e3),this.randomizationFactor((o=i.randomizationFactor)!==null&&o!==void 0?o:.5),this.backoff=new mi({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(i.timeout==null?2e4:i.timeout),this._readyState="closed",this.uri=r;const h=i.parser||Kv;this.encoder=new h.Encoder,this.decoder=new h.Decoder,this._autoConnect=i.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(r){return arguments.length?(this._reconnection=!!r,r||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(r){return r===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=r,this)}reconnectionDelay(r){var i;return r===void 0?this._reconnectionDelay:(this._reconnectionDelay=r,(i=this.backoff)===null||i===void 0||i.setMin(r),this)}randomizationFactor(r){var i;return r===void 0?this._randomizationFactor:(this._randomizationFactor=r,(i=this.backoff)===null||i===void 0||i.setJitter(r),this)}reconnectionDelayMax(r){var i;return r===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=r,(i=this.backoff)===null||i===void 0||i.setMax(r),this)}timeout(r){return arguments.length?(this._timeout=r,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(r){if(~this._readyState.indexOf("open"))return this;this.engine=new Bv(this.uri,this.opts);const i=this.engine,o=this;this._readyState="opening",this.skipReconnect=!1;const h=Gt(i,"open",function(){o.onopen(),r&&r()}),S=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),r?r(a):this.maybeReconnectOnOpen()},y=Gt(i,"error",S);if(this._timeout!==!1){const a=this._timeout,l=this.setTimeoutFn(()=>{h(),S(new Error("timeout")),i.close()},a);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(h),this.subs.push(y),this}connect(r){return this.open(r)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const r=this.engine;this.subs.push(Gt(r,"ping",this.onping.bind(this)),Gt(r,"data",this.ondata.bind(this)),Gt(r,"error",this.onerror.bind(this)),Gt(r,"close",this.onclose.bind(this)),Gt(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(r){try{this.decoder.add(r)}catch(i){this.onclose("parse error",i)}}ondecoded(r){Pa(()=>{this.emitReserved("packet",r)},this.setTimeoutFn)}onerror(r){this.emitReserved("error",r)}socket(r,i){let o=this.nsps[r];return o?this._autoConnect&&!o.active&&o.connect():(o=new __(this,r,i),this.nsps[r]=o),o}_destroy(r){const i=Object.keys(this.nsps);for(const o of i)if(this.nsps[o].active)return;this._close()}_packet(r){const i=this.encoder.encode(r);for(let o=0;o<i.length;o++)this.engine.write(i[o],r.options)}cleanup(){this.subs.forEach(r=>r()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(r,i){var o;this.cleanup(),(o=this.engine)===null||o===void 0||o.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",r,i),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const r=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const i=this.backoff.duration();this._reconnecting=!0;const o=this.setTimeoutFn(()=>{r.skipReconnect||(this.emitReserved("reconnect_attempt",r.backoff.attempts),!r.skipReconnect&&r.open(h=>{h?(r._reconnecting=!1,r.reconnect(),this.emitReserved("reconnect_error",h)):r.onreconnect()}))},i);this.opts.autoUnref&&o.unref(),this.subs.push(()=>{this.clearTimeoutFn(o)})}}onreconnect(){const r=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",r)}}const cs={};function da(e,r){typeof e=="object"&&(r=e,e=void 0),r=r||{};const i=Iv(e,r.path||"/socket.io"),o=i.source,h=i.id,S=i.path,y=cs[h]&&S in cs[h].nsps,a=r.forceNew||r["force new connection"]||r.multiplex===!1||y;let l;return a?l=new mu(o,r):(cs[h]||(cs[h]=new mu(o,r)),l=cs[h]),i.query&&!r.query&&(r.query=i.queryKey),l.socket(i.path,r)}Object.assign(da,{Manager:mu,Socket:__,io:da,connect:da});function g_(){return new URLSearchParams(window.location.search).get("token")||""}function Er(e,r){const i=g_(),o=e.includes("?")?"&":"?";return fetch(i?`${e}${o}token=${encodeURIComponent(i)}`:e,r)}function Yv(){const e=J.useRef(null),[r,i]=J.useState([]),[o,h]=J.useState([]),[S,y]=J.useState([]),[a,l]=J.useState(""),[_,v]=J.useState([]);return J.useEffect(()=>{const c=g_(),m=da(window.location.origin,{path:"/socket.io",auth:c?{token:c}:void 0,query:c?{token:c}:void 0});return e.current=m,m.on("agents:updated",C=>{Array.isArray(C)&&i(C)}),m.on("messages:new",C=>{h(b=>[C,...b])}),m.on("messages:all",C=>{Array.isArray(C)&&h(C)}),m.on("context:updated",C=>{y(b=>{const x=b.findIndex(f=>f.key===C.key);if(x>=0){const f=[...b];return f[x]=C,f}return[...b,C]})}),m.on("context:removed",({key:C})=>{y(b=>b.filter(x=>x.key!==C))}),m.on("crewmd:updated",C=>{typeof C=="string"&&l(C)}),m.on("agent:cost",C=>{i(b=>b.map(x=>x.id===C.id?{...x,total_cost:C.total_cost,total_tokens:C.total_tokens}:x))}),m.on("file:changed",C=>{v(b=>[C,...b].slice(0,500))}),m.on("file:changes:cleared",()=>{v([])}),Er("/api/agents").then(C=>C.json()).then(C=>{Array.isArray(C)&&i(C)}).catch(()=>{}),Er("/api/file-changes").then(C=>C.json()).then(C=>{Array.isArray(C)&&v(C)}).catch(()=>{}),Er("/api/context").then(C=>C.json()).then(C=>{Array.isArray(C)&&y(C)}).catch(()=>{}),()=>{m.disconnect()}},[]),{socket:e,agents:r,messages:o,contextEntries:S,crewMd:a,setCrewMd:l,fileChanges:_,setFileChanges:v}}const Gv={running:"var(--green)",starting:"var(--yellow)",idle:"var(--yellow)",done:"var(--text-muted)",dead:"var(--red)"};function Qv({agents:e,selectedId:r,onSelect:i,onKill:o,onRemove:h,onRollback:S,onRestart:y}){return O.jsxs("div",{className:"agent-list",children:[O.jsxs("div",{className:"agent-list-header",children:["Agents (",e.length,")"]}),e.length===0&&O.jsx("div",{className:"agent-list-empty",children:"No agents running"}),e.map(a=>O.jsxs("div",{className:`agent-item ${a.id===r?"selected":""}`,onClick:()=>i(a),children:[O.jsxs("div",{className:"agent-item-header",children:[O.jsx("span",{className:"status-dot",style:{background:Gv[a.status]||"var(--text-muted)"}}),O.jsx("span",{className:"agent-name",children:a.name}),O.jsx("span",{className:`agent-service-badge service-${a.service||"claude"}`,children:a.service||"claude"}),a.total_cost>0&&O.jsxs("span",{className:"agent-cost",children:["$",a.total_cost.toFixed(4)]}),O.jsx("span",{className:"agent-status",children:a.status})]}),O.jsx("div",{className:"agent-task",children:a.task}),(a.status==="running"||a.status==="starting")&&O.jsx("div",{className:"agent-running-actions",children:O.jsx("button",{className:"stop-btn",onClick:l=>{l.stopPropagation(),o(a.id)},children:"Stop"})}),(a.status==="done"||a.status==="dead")&&O.jsxs("div",{className:"agent-done-actions",children:[O.jsx("button",{className:"restart-btn",onClick:l=>{l.stopPropagation(),y(a)},children:"Restart"}),a.checkpoint_hash&&O.jsx("button",{className:"rollback-btn",onClick:l=>{l.stopPropagation(),confirm(`Rollback all changes made by "${a.name}"? This will reset files to the state before the agent started.`)&&S(a.id)},children:"Rollback"}),O.jsx("button",{className:"remove-btn",onClick:l=>{l.stopPropagation(),h(a.id)},children:"Remove"})]})]},a.id))]})}function rt(e){if(typeof e=="string"||typeof e=="number")return""+e;let r="";if(Array.isArray(e))for(let i=0,o;i<e.length;i++)(o=rt(e[i]))!==""&&(r+=(r&&" ")+o);else for(let i in e)e[i]&&(r+=(r&&" ")+i);return r}var Jv={value:()=>{}};function Ba(){for(var e=0,r=arguments.length,i={},o;e<r;++e){if(!(o=arguments[e]+"")||o in i||/[\s.]/.test(o))throw new Error("illegal type: "+o);i[o]=[]}return new fa(i)}function fa(e){this._=e}function Zv(e,r){return e.trim().split(/^|\s+/).map(function(i){var o="",h=i.indexOf(".");if(h>=0&&(o=i.slice(h+1),i=i.slice(0,h)),i&&!r.hasOwnProperty(i))throw new Error("unknown type: "+i);return{type:i,name:o}})}fa.prototype=Ba.prototype={constructor:fa,on:function(e,r){var i=this._,o=Zv(e+"",i),h,S=-1,y=o.length;if(arguments.length<2){for(;++S<y;)if((h=(e=o[S]).type)&&(h=ey(i[h],e.name)))return h;return}if(r!=null&&typeof r!="function")throw new Error("invalid callback: "+r);for(;++S<y;)if(h=(e=o[S]).type)i[h]=qf(i[h],e.name,r);else if(r==null)for(h in i)i[h]=qf(i[h],e.name,null);return this},copy:function(){var e={},r=this._;for(var i in r)e[i]=r[i].slice();return new fa(e)},call:function(e,r){if((h=arguments.length-2)>0)for(var i=new Array(h),o=0,h,S;o<h;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(S=this._[e],o=0,h=S.length;o<h;++o)S[o].value.apply(r,i)},apply:function(e,r,i){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],h=0,S=o.length;h<S;++h)o[h].value.apply(r,i)}};function ey(e,r){for(var i=0,o=e.length,h;i<o;++i)if((h=e[i]).name===r)return h.value}function qf(e,r,i){for(var o=0,h=e.length;o<h;++o)if(e[o].name===r){e[o]=Jv,e=e.slice(0,o).concat(e.slice(o+1));break}return i!=null&&e.push({name:r,value:i}),e}var vu="http://www.w3.org/1999/xhtml";const Kf={svg:"http://www.w3.org/2000/svg",xhtml:vu,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ia(e){var r=e+="",i=r.indexOf(":");return i>=0&&(r=e.slice(0,i))!=="xmlns"&&(e=e.slice(i+1)),Kf.hasOwnProperty(r)?{space:Kf[r],local:e}:e}function ty(e){return function(){var r=this.ownerDocument,i=this.namespaceURI;return i===vu&&r.documentElement.namespaceURI===vu?r.createElement(e):r.createElementNS(i,e)}}function ry(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function m_(e){var r=Ia(e);return(r.local?ry:ty)(r)}function ny(){}function Uu(e){return e==null?ny:function(){return this.querySelector(e)}}function iy(e){typeof e!="function"&&(e=Uu(e));for(var r=this._groups,i=r.length,o=new Array(i),h=0;h<i;++h)for(var S=r[h],y=S.length,a=o[h]=new Array(y),l,_,v=0;v<y;++v)(l=S[v])&&(_=e.call(l,l.__data__,v,S))&&("__data__"in l&&(_.__data__=l.__data__),a[v]=_);return new Bt(o,this._parents)}function sy(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function oy(){return[]}function v_(e){return e==null?oy:function(){return this.querySelectorAll(e)}}function ay(e){return function(){return sy(e.apply(this,arguments))}}function ly(e){typeof e=="function"?e=ay(e):e=v_(e);for(var r=this._groups,i=r.length,o=[],h=[],S=0;S<i;++S)for(var y=r[S],a=y.length,l,_=0;_<a;++_)(l=y[_])&&(o.push(e.call(l,l.__data__,_,y)),h.push(l));return new Bt(o,h)}function y_(e){return function(){return this.matches(e)}}function w_(e){return function(r){return r.matches(e)}}var cy=Array.prototype.find;function uy(e){return function(){return cy.call(this.children,e)}}function hy(){return this.firstElementChild}function dy(e){return this.select(e==null?hy:uy(typeof e=="function"?e:w_(e)))}var fy=Array.prototype.filter;function py(){return Array.from(this.children)}function _y(e){return function(){return fy.call(this.children,e)}}function gy(e){return this.selectAll(e==null?py:_y(typeof e=="function"?e:w_(e)))}function my(e){typeof e!="function"&&(e=y_(e));for(var r=this._groups,i=r.length,o=new Array(i),h=0;h<i;++h)for(var S=r[h],y=S.length,a=o[h]=[],l,_=0;_<y;++_)(l=S[_])&&e.call(l,l.__data__,_,S)&&a.push(l);return new Bt(o,this._parents)}function S_(e){return new Array(e.length)}function vy(){return new Bt(this._enter||this._groups.map(S_),this._parents)}function wa(e,r){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=r}wa.prototype={constructor:wa,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,r){return this._parent.insertBefore(e,r)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function yy(e){return function(){return e}}function wy(e,r,i,o,h,S){for(var y=0,a,l=r.length,_=S.length;y<_;++y)(a=r[y])?(a.__data__=S[y],o[y]=a):i[y]=new wa(e,S[y]);for(;y<l;++y)(a=r[y])&&(h[y]=a)}function Sy(e,r,i,o,h,S,y){var a,l,_=new Map,v=r.length,c=S.length,m=new Array(v),C;for(a=0;a<v;++a)(l=r[a])&&(m[a]=C=y.call(l,l.__data__,a,r)+"",_.has(C)?h[a]=l:_.set(C,l));for(a=0;a<c;++a)C=y.call(e,S[a],a,S)+"",(l=_.get(C))?(o[a]=l,l.__data__=S[a],_.delete(C)):i[a]=new wa(e,S[a]);for(a=0;a<v;++a)(l=r[a])&&_.get(m[a])===l&&(h[a]=l)}function Cy(e){return e.__data__}function xy(e,r){if(!arguments.length)return Array.from(this,Cy);var i=r?Sy:wy,o=this._parents,h=this._groups;typeof e!="function"&&(e=yy(e));for(var S=h.length,y=new Array(S),a=new Array(S),l=new Array(S),_=0;_<S;++_){var v=o[_],c=h[_],m=c.length,C=by(e.call(v,v&&v.__data__,_,o)),b=C.length,x=a[_]=new Array(b),f=y[_]=new Array(b),p=l[_]=new Array(m);i(v,c,x,f,p,C,r);for(var d=0,u=0,w,L;d<b;++d)if(w=x[d]){for(d>=u&&(u=d+1);!(L=f[u])&&++u<b;);w._next=L||null}}return y=new Bt(y,o),y._enter=a,y._exit=l,y}function by(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ey(){return new Bt(this._exit||this._groups.map(S_),this._parents)}function ky(e,r,i){var o=this.enter(),h=this,S=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),r!=null&&(h=r(h),h&&(h=h.selection())),i==null?S.remove():i(S),o&&h?o.merge(h).order():h}function Ly(e){for(var r=e.selection?e.selection():e,i=this._groups,o=r._groups,h=i.length,S=o.length,y=Math.min(h,S),a=new Array(h),l=0;l<y;++l)for(var _=i[l],v=o[l],c=_.length,m=a[l]=new Array(c),C,b=0;b<c;++b)(C=_[b]||v[b])&&(m[b]=C);for(;l<h;++l)a[l]=i[l];return new Bt(a,this._parents)}function Ry(){for(var e=this._groups,r=-1,i=e.length;++r<i;)for(var o=e[r],h=o.length-1,S=o[h],y;--h>=0;)(y=o[h])&&(S&&y.compareDocumentPosition(S)^4&&S.parentNode.insertBefore(y,S),S=y);return this}function Dy(e){e||(e=Ay);function r(c,m){return c&&m?e(c.__data__,m.__data__):!c-!m}for(var i=this._groups,o=i.length,h=new Array(o),S=0;S<o;++S){for(var y=i[S],a=y.length,l=h[S]=new Array(a),_,v=0;v<a;++v)(_=y[v])&&(l[v]=_);l.sort(r)}return new Bt(h,this._parents).order()}function Ay(e,r){return e<r?-1:e>r?1:e>=r?0:NaN}function Ty(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function My(){return Array.from(this)}function Py(){for(var e=this._groups,r=0,i=e.length;r<i;++r)for(var o=e[r],h=0,S=o.length;h<S;++h){var y=o[h];if(y)return y}return null}function Ny(){let e=0;for(const r of this)++e;return e}function By(){return!this.node()}function Iy(e){for(var r=this._groups,i=0,o=r.length;i<o;++i)for(var h=r[i],S=0,y=h.length,a;S<y;++S)(a=h[S])&&e.call(a,a.__data__,S,h);return this}function Oy(e){return function(){this.removeAttribute(e)}}function Hy(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Fy(e,r){return function(){this.setAttribute(e,r)}}function jy(e,r){return function(){this.setAttributeNS(e.space,e.local,r)}}function zy(e,r){return function(){var i=r.apply(this,arguments);i==null?this.removeAttribute(e):this.setAttribute(e,i)}}function $y(e,r){return function(){var i=r.apply(this,arguments);i==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,i)}}function Wy(e,r){var i=Ia(e);if(arguments.length<2){var o=this.node();return i.local?o.getAttributeNS(i.space,i.local):o.getAttribute(i)}return this.each((r==null?i.local?Hy:Oy:typeof r=="function"?i.local?$y:zy:i.local?jy:Fy)(i,r))}function C_(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Uy(e){return function(){this.style.removeProperty(e)}}function Vy(e,r,i){return function(){this.style.setProperty(e,r,i)}}function qy(e,r,i){return function(){var o=r.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,i)}}function Ky(e,r,i){return arguments.length>1?this.each((r==null?Uy:typeof r=="function"?qy:Vy)(e,r,i??"")):ci(this.node(),e)}function ci(e,r){return e.style.getPropertyValue(r)||C_(e).getComputedStyle(e,null).getPropertyValue(r)}function Xy(e){return function(){delete this[e]}}function Yy(e,r){return function(){this[e]=r}}function Gy(e,r){return function(){var i=r.apply(this,arguments);i==null?delete this[e]:this[e]=i}}function Qy(e,r){return arguments.length>1?this.each((r==null?Xy:typeof r=="function"?Gy:Yy)(e,r)):this.node()[e]}function x_(e){return e.trim().split(/^|\s+/)}function Vu(e){return e.classList||new b_(e)}function b_(e){this._node=e,this._names=x_(e.getAttribute("class")||"")}b_.prototype={add:function(e){var r=this._names.indexOf(e);r<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var r=this._names.indexOf(e);r>=0&&(this._names.splice(r,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function E_(e,r){for(var i=Vu(e),o=-1,h=r.length;++o<h;)i.add(r[o])}function k_(e,r){for(var i=Vu(e),o=-1,h=r.length;++o<h;)i.remove(r[o])}function Jy(e){return function(){E_(this,e)}}function Zy(e){return function(){k_(this,e)}}function e1(e,r){return function(){(r.apply(this,arguments)?E_:k_)(this,e)}}function t1(e,r){var i=x_(e+"");if(arguments.length<2){for(var o=Vu(this.node()),h=-1,S=i.length;++h<S;)if(!o.contains(i[h]))return!1;return!0}return this.each((typeof r=="function"?e1:r?Jy:Zy)(i,r))}function r1(){this.textContent=""}function n1(e){return function(){this.textContent=e}}function i1(e){return function(){var r=e.apply(this,arguments);this.textContent=r??""}}function s1(e){return arguments.length?this.each(e==null?r1:(typeof e=="function"?i1:n1)(e)):this.node().textContent}function o1(){this.innerHTML=""}function a1(e){return function(){this.innerHTML=e}}function l1(e){return function(){var r=e.apply(this,arguments);this.innerHTML=r??""}}function c1(e){return arguments.length?this.each(e==null?o1:(typeof e=="function"?l1:a1)(e)):this.node().innerHTML}function u1(){this.nextSibling&&this.parentNode.appendChild(this)}function h1(){return this.each(u1)}function d1(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function f1(){return this.each(d1)}function p1(e){var r=typeof e=="function"?e:m_(e);return this.select(function(){return this.appendChild(r.apply(this,arguments))})}function _1(){return null}function g1(e,r){var i=typeof e=="function"?e:m_(e),o=r==null?_1:typeof r=="function"?r:Uu(r);return this.select(function(){return this.insertBefore(i.apply(this,arguments),o.apply(this,arguments)||null)})}function m1(){var e=this.parentNode;e&&e.removeChild(this)}function v1(){return this.each(m1)}function y1(){var e=this.cloneNode(!1),r=this.parentNode;return r?r.insertBefore(e,this.nextSibling):e}function w1(){var e=this.cloneNode(!0),r=this.parentNode;return r?r.insertBefore(e,this.nextSibling):e}function S1(e){return this.select(e?w1:y1)}function C1(e){return arguments.length?this.property("__data__",e):this.node().__data__}function x1(e){return function(r){e.call(this,r,this.__data__)}}function b1(e){return e.trim().split(/^|\s+/).map(function(r){var i="",o=r.indexOf(".");return o>=0&&(i=r.slice(o+1),r=r.slice(0,o)),{type:r,name:i}})}function E1(e){return function(){var r=this.__on;if(r){for(var i=0,o=-1,h=r.length,S;i<h;++i)S=r[i],(!e.type||S.type===e.type)&&S.name===e.name?this.removeEventListener(S.type,S.listener,S.options):r[++o]=S;++o?r.length=o:delete this.__on}}}function k1(e,r,i){return function(){var o=this.__on,h,S=x1(r);if(o){for(var y=0,a=o.length;y<a;++y)if((h=o[y]).type===e.type&&h.name===e.name){this.removeEventListener(h.type,h.listener,h.options),this.addEventListener(h.type,h.listener=S,h.options=i),h.value=r;return}}this.addEventListener(e.type,S,i),h={type:e.type,name:e.name,value:r,listener:S,options:i},o?o.push(h):this.__on=[h]}}function L1(e,r,i){var o=b1(e+""),h,S=o.length,y;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,_=a.length,v;l<_;++l)for(h=0,v=a[l];h<S;++h)if((y=o[h]).type===v.type&&y.name===v.name)return v.value}return}for(a=r?k1:E1,h=0;h<S;++h)this.each(a(o[h],r,i));return this}function L_(e,r,i){var o=C_(e),h=o.CustomEvent;typeof h=="function"?h=new h(r,i):(h=o.document.createEvent("Event"),i?(h.initEvent(r,i.bubbles,i.cancelable),h.detail=i.detail):h.initEvent(r,!1,!1)),e.dispatchEvent(h)}function R1(e,r){return function(){return L_(this,e,r)}}function D1(e,r){return function(){return L_(this,e,r.apply(this,arguments))}}function A1(e,r){return this.each((typeof r=="function"?D1:R1)(e,r))}function*T1(){for(var e=this._groups,r=0,i=e.length;r<i;++r)for(var o=e[r],h=0,S=o.length,y;h<S;++h)(y=o[h])&&(yield y)}var R_=[null];function Bt(e,r){this._groups=e,this._parents=r}function Ls(){return new Bt([[document.documentElement]],R_)}function M1(){return this}Bt.prototype=Ls.prototype={constructor:Bt,select:iy,selectAll:ly,selectChild:dy,selectChildren:gy,filter:my,data:xy,enter:vy,exit:Ey,join:ky,merge:Ly,selection:M1,order:Ry,sort:Dy,call:Ty,nodes:My,node:Py,size:Ny,empty:By,each:Iy,attr:Wy,style:Ky,property:Qy,classed:t1,text:s1,html:c1,raise:h1,lower:f1,append:p1,insert:g1,remove:v1,clone:S1,datum:C1,on:L1,dispatch:A1,[Symbol.iterator]:T1};function Nt(e){return typeof e=="string"?new Bt([[document.querySelector(e)]],[document.documentElement]):new Bt([[e]],R_)}function P1(e){let r;for(;r=e.sourceEvent;)e=r;return e}function Qt(e,r){if(e=P1(e),r===void 0&&(r=e.currentTarget),r){var i=r.ownerSVGElement||r;if(i.createSVGPoint){var o=i.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(r.getScreenCTM().inverse()),[o.x,o.y]}if(r.getBoundingClientRect){var h=r.getBoundingClientRect();return[e.clientX-h.left-r.clientLeft,e.clientY-h.top-r.clientTop]}}return[e.pageX,e.pageY]}const N1={passive:!1},ms={capture:!0,passive:!1};function qc(e){e.stopImmediatePropagation()}function ai(e){e.preventDefault(),e.stopImmediatePropagation()}function D_(e){var r=e.document.documentElement,i=Nt(e).on("dragstart.drag",ai,ms);"onselectstart"in r?i.on("selectstart.drag",ai,ms):(r.__noselect=r.style.MozUserSelect,r.style.MozUserSelect="none")}function A_(e,r){var i=e.document.documentElement,o=Nt(e).on("dragstart.drag",null);r&&(o.on("click.drag",ai,ms),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in i?o.on("selectstart.drag",null):(i.style.MozUserSelect=i.__noselect,delete i.__noselect)}const Zo=e=>()=>e;function yu(e,{sourceEvent:r,subject:i,target:o,identifier:h,active:S,x:y,y:a,dx:l,dy:_,dispatch:v}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:r,enumerable:!0,configurable:!0},subject:{value:i,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:h,enumerable:!0,configurable:!0},active:{value:S,enumerable:!0,configurable:!0},x:{value:y,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:_,enumerable:!0,configurable:!0},_:{value:v}})}yu.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function B1(e){return!e.ctrlKey&&!e.button}function I1(){return this.parentNode}function O1(e,r){return r??{x:e.x,y:e.y}}function H1(){return navigator.maxTouchPoints||"ontouchstart"in this}function T_(){var e=B1,r=I1,i=O1,o=H1,h={},S=Ba("start","drag","end"),y=0,a,l,_,v,c=0;function m(w){w.on("mousedown.drag",C).filter(o).on("touchstart.drag",f).on("touchmove.drag",p,N1).on("touchend.drag touchcancel.drag",d).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function C(w,L){if(!(v||!e.call(this,w,L))){var R=u(this,r.call(this,w,L),w,L,"mouse");R&&(Nt(w.view).on("mousemove.drag",b,ms).on("mouseup.drag",x,ms),D_(w.view),qc(w),_=!1,a=w.clientX,l=w.clientY,R("start",w))}}function b(w){if(ai(w),!_){var L=w.clientX-a,R=w.clientY-l;_=L*L+R*R>c}h.mouse("drag",w)}function x(w){Nt(w.view).on("mousemove.drag mouseup.drag",null),A_(w.view,_),ai(w),h.mouse("end",w)}function f(w,L){if(e.call(this,w,L)){var R=w.changedTouches,D=r.call(this,w,L),k=R.length,M,W;for(M=0;M<k;++M)(W=u(this,D,w,L,R[M].identifier,R[M]))&&(qc(w),W("start",w,R[M]))}}function p(w){var L=w.changedTouches,R=L.length,D,k;for(D=0;D<R;++D)(k=h[L[D].identifier])&&(ai(w),k("drag",w,L[D]))}function d(w){var L=w.changedTouches,R=L.length,D,k;for(v&&clearTimeout(v),v=setTimeout(function(){v=null},500),D=0;D<R;++D)(k=h[L[D].identifier])&&(qc(w),k("end",w,L[D]))}function u(w,L,R,D,k,M){var W=S.copy(),z=Qt(M||R,L),j,N,I;if((I=i.call(w,new yu("beforestart",{sourceEvent:R,target:m,identifier:k,active:y,x:z[0],y:z[1],dx:0,dy:0,dispatch:W}),D))!=null)return j=I.x-z[0]||0,N=I.y-z[1]||0,function q(U,K,V){var T=z,B;switch(U){case"start":h[k]=q,B=y++;break;case"end":delete h[k],--y;case"drag":z=Qt(V||K,L),B=y;break}W.call(U,w,new yu(U,{sourceEvent:K,subject:I,target:m,identifier:k,active:B,x:z[0]+j,y:z[1]+N,dx:z[0]-T[0],dy:z[1]-T[1],dispatch:W}),D)}}return m.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Zo(!!w),m):e},m.container=function(w){return arguments.length?(r=typeof w=="function"?w:Zo(w),m):r},m.subject=function(w){return arguments.length?(i=typeof w=="function"?w:Zo(w),m):i},m.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:Zo(!!w),m):o},m.on=function(){var w=S.on.apply(S,arguments);return w===S?m:w},m.clickDistance=function(w){return arguments.length?(c=(w=+w)*w,m):Math.sqrt(c)},m}function qu(e,r,i){e.prototype=r.prototype=i,i.constructor=e}function M_(e,r){var i=Object.create(e.prototype);for(var o in r)i[o]=r[o];return i}function Rs(){}var vs=.7,Sa=1/vs,li="\\s*([+-]?\\d+)\\s*",ys="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ur="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",F1=/^#([0-9a-f]{3,8})$/,j1=new RegExp(`^rgb\\(${li},${li},${li}\\)$`),z1=new RegExp(`^rgb\\(${ur},${ur},${ur}\\)$`),$1=new RegExp(`^rgba\\(${li},${li},${li},${ys}\\)$`),W1=new RegExp(`^rgba\\(${ur},${ur},${ur},${ys}\\)$`),U1=new RegExp(`^hsl\\(${ys},${ur},${ur}\\)$`),V1=new RegExp(`^hsla\\(${ys},${ur},${ur},${ys}\\)$`),Xf={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};qu(Rs,bn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Yf,formatHex:Yf,formatHex8:q1,formatHsl:K1,formatRgb:Gf,toString:Gf});function Yf(){return this.rgb().formatHex()}function q1(){return this.rgb().formatHex8()}function K1(){return P_(this).formatHsl()}function Gf(){return this.rgb().formatRgb()}function bn(e){var r,i;return e=(e+"").trim().toLowerCase(),(r=F1.exec(e))?(i=r[1].length,r=parseInt(r[1],16),i===6?Qf(r):i===3?new Lt(r>>8&15|r>>4&240,r>>4&15|r&240,(r&15)<<4|r&15,1):i===8?ea(r>>24&255,r>>16&255,r>>8&255,(r&255)/255):i===4?ea(r>>12&15|r>>8&240,r>>8&15|r>>4&240,r>>4&15|r&240,((r&15)<<4|r&15)/255):null):(r=j1.exec(e))?new Lt(r[1],r[2],r[3],1):(r=z1.exec(e))?new Lt(r[1]*255/100,r[2]*255/100,r[3]*255/100,1):(r=$1.exec(e))?ea(r[1],r[2],r[3],r[4]):(r=W1.exec(e))?ea(r[1]*255/100,r[2]*255/100,r[3]*255/100,r[4]):(r=U1.exec(e))?ep(r[1],r[2]/100,r[3]/100,1):(r=V1.exec(e))?ep(r[1],r[2]/100,r[3]/100,r[4]):Xf.hasOwnProperty(e)?Qf(Xf[e]):e==="transparent"?new Lt(NaN,NaN,NaN,0):null}function Qf(e){return new Lt(e>>16&255,e>>8&255,e&255,1)}function ea(e,r,i,o){return o<=0&&(e=r=i=NaN),new Lt(e,r,i,o)}function X1(e){return e instanceof Rs||(e=bn(e)),e?(e=e.rgb(),new Lt(e.r,e.g,e.b,e.opacity)):new Lt}function wu(e,r,i,o){return arguments.length===1?X1(e):new Lt(e,r,i,o??1)}function Lt(e,r,i,o){this.r=+e,this.g=+r,this.b=+i,this.opacity=+o}qu(Lt,wu,M_(Rs,{brighter(e){return e=e==null?Sa:Math.pow(Sa,e),new Lt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?vs:Math.pow(vs,e),new Lt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Lt(Cn(this.r),Cn(this.g),Cn(this.b),Ca(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:Jf,formatHex:Jf,formatHex8:Y1,formatRgb:Zf,toString:Zf}));function Jf(){return`#${Sn(this.r)}${Sn(this.g)}${Sn(this.b)}`}function Y1(){return`#${Sn(this.r)}${Sn(this.g)}${Sn(this.b)}${Sn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Zf(){const e=Ca(this.opacity);return`${e===1?"rgb(":"rgba("}${Cn(this.r)}, ${Cn(this.g)}, ${Cn(this.b)}${e===1?")":`, ${e})`}`}function Ca(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Cn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Sn(e){return e=Cn(e),(e<16?"0":"")+e.toString(16)}function ep(e,r,i,o){return o<=0?e=r=i=NaN:i<=0||i>=1?e=r=NaN:r<=0&&(e=NaN),new Jt(e,r,i,o)}function P_(e){if(e instanceof Jt)return new Jt(e.h,e.s,e.l,e.opacity);if(e instanceof Rs||(e=bn(e)),!e)return new Jt;if(e instanceof Jt)return e;e=e.rgb();var r=e.r/255,i=e.g/255,o=e.b/255,h=Math.min(r,i,o),S=Math.max(r,i,o),y=NaN,a=S-h,l=(S+h)/2;return a?(r===S?y=(i-o)/a+(i<o)*6:i===S?y=(o-r)/a+2:y=(r-i)/a+4,a/=l<.5?S+h:2-S-h,y*=60):a=l>0&&l<1?0:y,new Jt(y,a,l,e.opacity)}function G1(e,r,i,o){return arguments.length===1?P_(e):new Jt(e,r,i,o??1)}function Jt(e,r,i,o){this.h=+e,this.s=+r,this.l=+i,this.opacity=+o}qu(Jt,G1,M_(Rs,{brighter(e){return e=e==null?Sa:Math.pow(Sa,e),new Jt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?vs:Math.pow(vs,e),new Jt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,r=isNaN(e)||isNaN(this.s)?0:this.s,i=this.l,o=i+(i<.5?i:1-i)*r,h=2*i-o;return new Lt(Kc(e>=240?e-240:e+120,h,o),Kc(e,h,o),Kc(e<120?e+240:e-120,h,o),this.opacity)},clamp(){return new Jt(tp(this.h),ta(this.s),ta(this.l),Ca(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=Ca(this.opacity);return`${e===1?"hsl(":"hsla("}${tp(this.h)}, ${ta(this.s)*100}%, ${ta(this.l)*100}%${e===1?")":`, ${e})`}`}}));function tp(e){return e=(e||0)%360,e<0?e+360:e}function ta(e){return Math.max(0,Math.min(1,e||0))}function Kc(e,r,i){return(e<60?r+(i-r)*e/60:e<180?i:e<240?r+(i-r)*(240-e)/60:r)*255}const Ku=e=>()=>e;function Q1(e,r){return function(i){return e+i*r}}function J1(e,r,i){return e=Math.pow(e,i),r=Math.pow(r,i)-e,i=1/i,function(o){return Math.pow(e+o*r,i)}}function Z1(e){return(e=+e)==1?N_:function(r,i){return i-r?J1(r,i,e):Ku(isNaN(r)?i:r)}}function N_(e,r){var i=r-e;return i?Q1(e,i):Ku(isNaN(e)?r:e)}const xa=(function e(r){var i=Z1(r);function o(h,S){var y=i((h=wu(h)).r,(S=wu(S)).r),a=i(h.g,S.g),l=i(h.b,S.b),_=N_(h.opacity,S.opacity);return function(v){return h.r=y(v),h.g=a(v),h.b=l(v),h.opacity=_(v),h+""}}return o.gamma=e,o})(1);function ew(e,r){r||(r=[]);var i=e?Math.min(r.length,e.length):0,o=r.slice(),h;return function(S){for(h=0;h<i;++h)o[h]=e[h]*(1-S)+r[h]*S;return o}}function tw(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function rw(e,r){var i=r?r.length:0,o=e?Math.min(i,e.length):0,h=new Array(o),S=new Array(i),y;for(y=0;y<o;++y)h[y]=_s(e[y],r[y]);for(;y<i;++y)S[y]=r[y];return function(a){for(y=0;y<o;++y)S[y]=h[y](a);return S}}function nw(e,r){var i=new Date;return e=+e,r=+r,function(o){return i.setTime(e*(1-o)+r*o),i}}function lr(e,r){return e=+e,r=+r,function(i){return e*(1-i)+r*i}}function iw(e,r){var i={},o={},h;(e===null||typeof e!="object")&&(e={}),(r===null||typeof r!="object")&&(r={});for(h in r)h in e?i[h]=_s(e[h],r[h]):o[h]=r[h];return function(S){for(h in i)o[h]=i[h](S);return o}}var Su=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Xc=new RegExp(Su.source,"g");function sw(e){return function(){return e}}function ow(e){return function(r){return e(r)+""}}function B_(e,r){var i=Su.lastIndex=Xc.lastIndex=0,o,h,S,y=-1,a=[],l=[];for(e=e+"",r=r+"";(o=Su.exec(e))&&(h=Xc.exec(r));)(S=h.index)>i&&(S=r.slice(i,S),a[y]?a[y]+=S:a[++y]=S),(o=o[0])===(h=h[0])?a[y]?a[y]+=h:a[++y]=h:(a[++y]=null,l.push({i:y,x:lr(o,h)})),i=Xc.lastIndex;return i<r.length&&(S=r.slice(i),a[y]?a[y]+=S:a[++y]=S),a.length<2?l[0]?ow(l[0].x):sw(r):(r=l.length,function(_){for(var v=0,c;v<r;++v)a[(c=l[v]).i]=c.x(_);return a.join("")})}function _s(e,r){var i=typeof r,o;return r==null||i==="boolean"?Ku(r):(i==="number"?lr:i==="string"?(o=bn(r))?(r=o,xa):B_:r instanceof bn?xa:r instanceof Date?nw:tw(r)?ew:Array.isArray(r)?rw:typeof r.valueOf!="function"&&typeof r.toString!="function"||isNaN(r)?iw:lr)(e,r)}var rp=180/Math.PI,Cu={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function I_(e,r,i,o,h,S){var y,a,l;return(y=Math.sqrt(e*e+r*r))&&(e/=y,r/=y),(l=e*i+r*o)&&(i-=e*l,o-=r*l),(a=Math.sqrt(i*i+o*o))&&(i/=a,o/=a,l/=a),e*o<r*i&&(e=-e,r=-r,l=-l,y=-y),{translateX:h,translateY:S,rotate:Math.atan2(r,e)*rp,skewX:Math.atan(l)*rp,scaleX:y,scaleY:a}}var ra;function aw(e){const r=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return r.isIdentity?Cu:I_(r.a,r.b,r.c,r.d,r.e,r.f)}function lw(e){return e==null||(ra||(ra=document.createElementNS("http://www.w3.org/2000/svg","g")),ra.setAttribute("transform",e),!(e=ra.transform.baseVal.consolidate()))?Cu:(e=e.matrix,I_(e.a,e.b,e.c,e.d,e.e,e.f))}function O_(e,r,i,o){function h(_){return _.length?_.pop()+" ":""}function S(_,v,c,m,C,b){if(_!==c||v!==m){var x=C.push("translate(",null,r,null,i);b.push({i:x-4,x:lr(_,c)},{i:x-2,x:lr(v,m)})}else(c||m)&&C.push("translate("+c+r+m+i)}function y(_,v,c,m){_!==v?(_-v>180?v+=360:v-_>180&&(_+=360),m.push({i:c.push(h(c)+"rotate(",null,o)-2,x:lr(_,v)})):v&&c.push(h(c)+"rotate("+v+o)}function a(_,v,c,m){_!==v?m.push({i:c.push(h(c)+"skewX(",null,o)-2,x:lr(_,v)}):v&&c.push(h(c)+"skewX("+v+o)}function l(_,v,c,m,C,b){if(_!==c||v!==m){var x=C.push(h(C)+"scale(",null,",",null,")");b.push({i:x-4,x:lr(_,c)},{i:x-2,x:lr(v,m)})}else(c!==1||m!==1)&&C.push(h(C)+"scale("+c+","+m+")")}return function(_,v){var c=[],m=[];return _=e(_),v=e(v),S(_.translateX,_.translateY,v.translateX,v.translateY,c,m),y(_.rotate,v.rotate,c,m),a(_.skewX,v.skewX,c,m),l(_.scaleX,_.scaleY,v.scaleX,v.scaleY,c,m),_=v=null,function(C){for(var b=-1,x=m.length,f;++b<x;)c[(f=m[b]).i]=f.x(C);return c.join("")}}}var cw=O_(aw,"px, ","px)","deg)"),uw=O_(lw,", ",")",")"),hw=1e-12;function np(e){return((e=Math.exp(e))+1/e)/2}function dw(e){return((e=Math.exp(e))-1/e)/2}function fw(e){return((e=Math.exp(2*e))-1)/(e+1)}const pa=(function e(r,i,o){function h(S,y){var a=S[0],l=S[1],_=S[2],v=y[0],c=y[1],m=y[2],C=v-a,b=c-l,x=C*C+b*b,f,p;if(x<hw)p=Math.log(m/_)/r,f=function(D){return[a+D*C,l+D*b,_*Math.exp(r*D*p)]};else{var d=Math.sqrt(x),u=(m*m-_*_+o*x)/(2*_*i*d),w=(m*m-_*_-o*x)/(2*m*i*d),L=Math.log(Math.sqrt(u*u+1)-u),R=Math.log(Math.sqrt(w*w+1)-w);p=(R-L)/r,f=function(D){var k=D*p,M=np(L),W=_/(i*d)*(M*fw(r*k+L)-dw(L));return[a+W*C,l+W*b,_*M/np(r*k+L)]}}return f.duration=p*1e3*r/Math.SQRT2,f}return h.rho=function(S){var y=Math.max(.001,+S),a=y*y,l=a*a;return e(y,a,l)},h})(Math.SQRT2,2,4);var ui=0,fs=0,us=0,H_=1e3,ba,ps,Ea=0,En=0,Oa=0,ws=typeof performance=="object"&&performance.now?performance:Date,F_=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Xu(){return En||(F_(pw),En=ws.now()+Oa)}function pw(){En=0}function ka(){this._call=this._time=this._next=null}ka.prototype=j_.prototype={constructor:ka,restart:function(e,r,i){if(typeof e!="function")throw new TypeError("callback is not a function");i=(i==null?Xu():+i)+(r==null?0:+r),!this._next&&ps!==this&&(ps?ps._next=this:ba=this,ps=this),this._call=e,this._time=i,xu()},stop:function(){this._call&&(this._call=null,this._time=1/0,xu())}};function j_(e,r,i){var o=new ka;return o.restart(e,r,i),o}function _w(){Xu(),++ui;for(var e=ba,r;e;)(r=En-e._time)>=0&&e._call.call(void 0,r),e=e._next;--ui}function ip(){En=(Ea=ws.now())+Oa,ui=fs=0;try{_w()}finally{ui=0,mw(),En=0}}function gw(){var e=ws.now(),r=e-Ea;r>H_&&(Oa-=r,Ea=e)}function mw(){for(var e,r=ba,i,o=1/0;r;)r._call?(o>r._time&&(o=r._time),e=r,r=r._next):(i=r._next,r._next=null,r=e?e._next=i:ba=i);ps=e,xu(o)}function xu(e){if(!ui){fs&&(fs=clearTimeout(fs));var r=e-En;r>24?(e<1/0&&(fs=setTimeout(ip,e-ws.now()-Oa)),us&&(us=clearInterval(us))):(us||(Ea=ws.now(),us=setInterval(gw,H_)),ui=1,F_(ip))}}function sp(e,r,i){var o=new ka;return r=r==null?0:+r,o.restart(h=>{o.stop(),e(h+r)},r,i),o}var vw=Ba("start","end","cancel","interrupt"),yw=[],z_=0,op=1,bu=2,_a=3,ap=4,Eu=5,ga=6;function Ha(e,r,i,o,h,S){var y=e.__transition;if(!y)e.__transition={};else if(i in y)return;ww(e,i,{name:r,index:o,group:h,on:vw,tween:yw,time:S.time,delay:S.delay,duration:S.duration,ease:S.ease,timer:null,state:z_})}function Yu(e,r){var i=tr(e,r);if(i.state>z_)throw new Error("too late; already scheduled");return i}function fr(e,r){var i=tr(e,r);if(i.state>_a)throw new Error("too late; already running");return i}function tr(e,r){var i=e.__transition;if(!i||!(i=i[r]))throw new Error("transition not found");return i}function ww(e,r,i){var o=e.__transition,h;o[r]=i,i.timer=j_(S,0,i.time);function S(_){i.state=op,i.timer.restart(y,i.delay,i.time),i.delay<=_&&y(_-i.delay)}function y(_){var v,c,m,C;if(i.state!==op)return l();for(v in o)if(C=o[v],C.name===i.name){if(C.state===_a)return sp(y);C.state===ap?(C.state=ga,C.timer.stop(),C.on.call("interrupt",e,e.__data__,C.index,C.group),delete o[v]):+v<r&&(C.state=ga,C.timer.stop(),C.on.call("cancel",e,e.__data__,C.index,C.group),delete o[v])}if(sp(function(){i.state===_a&&(i.state=ap,i.timer.restart(a,i.delay,i.time),a(_))}),i.state=bu,i.on.call("start",e,e.__data__,i.index,i.group),i.state===bu){for(i.state=_a,h=new Array(m=i.tween.length),v=0,c=-1;v<m;++v)(C=i.tween[v].value.call(e,e.__data__,i.index,i.group))&&(h[++c]=C);h.length=c+1}}function a(_){for(var v=_<i.duration?i.ease.call(null,_/i.duration):(i.timer.restart(l),i.state=Eu,1),c=-1,m=h.length;++c<m;)h[c].call(e,v);i.state===Eu&&(i.on.call("end",e,e.__data__,i.index,i.group),l())}function l(){i.state=ga,i.timer.stop(),delete o[r];for(var _ in o)return;delete e.__transition}}function ma(e,r){var i=e.__transition,o,h,S=!0,y;if(i){r=r==null?null:r+"";for(y in i){if((o=i[y]).name!==r){S=!1;continue}h=o.state>bu&&o.state<Eu,o.state=ga,o.timer.stop(),o.on.call(h?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete i[y]}S&&delete e.__transition}}function Sw(e){return this.each(function(){ma(this,e)})}function Cw(e,r){var i,o;return function(){var h=fr(this,e),S=h.tween;if(S!==i){o=i=S;for(var y=0,a=o.length;y<a;++y)if(o[y].name===r){o=o.slice(),o.splice(y,1);break}}h.tween=o}}function xw(e,r,i){var o,h;if(typeof i!="function")throw new Error;return function(){var S=fr(this,e),y=S.tween;if(y!==o){h=(o=y).slice();for(var a={name:r,value:i},l=0,_=h.length;l<_;++l)if(h[l].name===r){h[l]=a;break}l===_&&h.push(a)}S.tween=h}}function bw(e,r){var i=this._id;if(e+="",arguments.length<2){for(var o=tr(this.node(),i).tween,h=0,S=o.length,y;h<S;++h)if((y=o[h]).name===e)return y.value;return null}return this.each((r==null?Cw:xw)(i,e,r))}function Gu(e,r,i){var o=e._id;return e.each(function(){var h=fr(this,o);(h.value||(h.value={}))[r]=i.apply(this,arguments)}),function(h){return tr(h,o).value[r]}}function $_(e,r){var i;return(typeof r=="number"?lr:r instanceof bn?xa:(i=bn(r))?(r=i,xa):B_)(e,r)}function Ew(e){return function(){this.removeAttribute(e)}}function kw(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Lw(e,r,i){var o,h=i+"",S;return function(){var y=this.getAttribute(e);return y===h?null:y===o?S:S=r(o=y,i)}}function Rw(e,r,i){var o,h=i+"",S;return function(){var y=this.getAttributeNS(e.space,e.local);return y===h?null:y===o?S:S=r(o=y,i)}}function Dw(e,r,i){var o,h,S;return function(){var y,a=i(this),l;return a==null?void this.removeAttribute(e):(y=this.getAttribute(e),l=a+"",y===l?null:y===o&&l===h?S:(h=l,S=r(o=y,a)))}}function Aw(e,r,i){var o,h,S;return function(){var y,a=i(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(y=this.getAttributeNS(e.space,e.local),l=a+"",y===l?null:y===o&&l===h?S:(h=l,S=r(o=y,a)))}}function Tw(e,r){var i=Ia(e),o=i==="transform"?uw:$_;return this.attrTween(e,typeof r=="function"?(i.local?Aw:Dw)(i,o,Gu(this,"attr."+e,r)):r==null?(i.local?kw:Ew)(i):(i.local?Rw:Lw)(i,o,r))}function Mw(e,r){return function(i){this.setAttribute(e,r.call(this,i))}}function Pw(e,r){return function(i){this.setAttributeNS(e.space,e.local,r.call(this,i))}}function Nw(e,r){var i,o;function h(){var S=r.apply(this,arguments);return S!==o&&(i=(o=S)&&Pw(e,S)),i}return h._value=r,h}function Bw(e,r){var i,o;function h(){var S=r.apply(this,arguments);return S!==o&&(i=(o=S)&&Mw(e,S)),i}return h._value=r,h}function Iw(e,r){var i="attr."+e;if(arguments.length<2)return(i=this.tween(i))&&i._value;if(r==null)return this.tween(i,null);if(typeof r!="function")throw new Error;var o=Ia(e);return this.tween(i,(o.local?Nw:Bw)(o,r))}function Ow(e,r){return function(){Yu(this,e).delay=+r.apply(this,arguments)}}function Hw(e,r){return r=+r,function(){Yu(this,e).delay=r}}function Fw(e){var r=this._id;return arguments.length?this.each((typeof e=="function"?Ow:Hw)(r,e)):tr(this.node(),r).delay}function jw(e,r){return function(){fr(this,e).duration=+r.apply(this,arguments)}}function zw(e,r){return r=+r,function(){fr(this,e).duration=r}}function $w(e){var r=this._id;return arguments.length?this.each((typeof e=="function"?jw:zw)(r,e)):tr(this.node(),r).duration}function Ww(e,r){if(typeof r!="function")throw new Error;return function(){fr(this,e).ease=r}}function Uw(e){var r=this._id;return arguments.length?this.each(Ww(r,e)):tr(this.node(),r).ease}function Vw(e,r){return function(){var i=r.apply(this,arguments);if(typeof i!="function")throw new Error;fr(this,e).ease=i}}function qw(e){if(typeof e!="function")throw new Error;return this.each(Vw(this._id,e))}function Kw(e){typeof e!="function"&&(e=y_(e));for(var r=this._groups,i=r.length,o=new Array(i),h=0;h<i;++h)for(var S=r[h],y=S.length,a=o[h]=[],l,_=0;_<y;++_)(l=S[_])&&e.call(l,l.__data__,_,S)&&a.push(l);return new Lr(o,this._parents,this._name,this._id)}function Xw(e){if(e._id!==this._id)throw new Error;for(var r=this._groups,i=e._groups,o=r.length,h=i.length,S=Math.min(o,h),y=new Array(o),a=0;a<S;++a)for(var l=r[a],_=i[a],v=l.length,c=y[a]=new Array(v),m,C=0;C<v;++C)(m=l[C]||_[C])&&(c[C]=m);for(;a<o;++a)y[a]=r[a];return new Lr(y,this._parents,this._name,this._id)}function Yw(e){return(e+"").trim().split(/^|\s+/).every(function(r){var i=r.indexOf(".");return i>=0&&(r=r.slice(0,i)),!r||r==="start"})}function Gw(e,r,i){var o,h,S=Yw(r)?Yu:fr;return function(){var y=S(this,e),a=y.on;a!==o&&(h=(o=a).copy()).on(r,i),y.on=h}}function Qw(e,r){var i=this._id;return arguments.length<2?tr(this.node(),i).on.on(e):this.each(Gw(i,e,r))}function Jw(e){return function(){var r=this.parentNode;for(var i in this.__transition)if(+i!==e)return;r&&r.removeChild(this)}}function Zw(){return this.on("end.remove",Jw(this._id))}function eS(e){var r=this._name,i=this._id;typeof e!="function"&&(e=Uu(e));for(var o=this._groups,h=o.length,S=new Array(h),y=0;y<h;++y)for(var a=o[y],l=a.length,_=S[y]=new Array(l),v,c,m=0;m<l;++m)(v=a[m])&&(c=e.call(v,v.__data__,m,a))&&("__data__"in v&&(c.__data__=v.__data__),_[m]=c,Ha(_[m],r,i,m,_,tr(v,i)));return new Lr(S,this._parents,r,i)}function tS(e){var r=this._name,i=this._id;typeof e!="function"&&(e=v_(e));for(var o=this._groups,h=o.length,S=[],y=[],a=0;a<h;++a)for(var l=o[a],_=l.length,v,c=0;c<_;++c)if(v=l[c]){for(var m=e.call(v,v.__data__,c,l),C,b=tr(v,i),x=0,f=m.length;x<f;++x)(C=m[x])&&Ha(C,r,i,x,m,b);S.push(m),y.push(v)}return new Lr(S,y,r,i)}var rS=Ls.prototype.constructor;function nS(){return new rS(this._groups,this._parents)}function iS(e,r){var i,o,h;return function(){var S=ci(this,e),y=(this.style.removeProperty(e),ci(this,e));return S===y?null:S===i&&y===o?h:h=r(i=S,o=y)}}function W_(e){return function(){this.style.removeProperty(e)}}function sS(e,r,i){var o,h=i+"",S;return function(){var y=ci(this,e);return y===h?null:y===o?S:S=r(o=y,i)}}function oS(e,r,i){var o,h,S;return function(){var y=ci(this,e),a=i(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),ci(this,e))),y===l?null:y===o&&l===h?S:(h=l,S=r(o=y,a))}}function aS(e,r){var i,o,h,S="style."+r,y="end."+S,a;return function(){var l=fr(this,e),_=l.on,v=l.value[S]==null?a||(a=W_(r)):void 0;(_!==i||h!==v)&&(o=(i=_).copy()).on(y,h=v),l.on=o}}function lS(e,r,i){var o=(e+="")=="transform"?cw:$_;return r==null?this.styleTween(e,iS(e,o)).on("end.style."+e,W_(e)):typeof r=="function"?this.styleTween(e,oS(e,o,Gu(this,"style."+e,r))).each(aS(this._id,e)):this.styleTween(e,sS(e,o,r),i).on("end.style."+e,null)}function cS(e,r,i){return function(o){this.style.setProperty(e,r.call(this,o),i)}}function uS(e,r,i){var o,h;function S(){var y=r.apply(this,arguments);return y!==h&&(o=(h=y)&&cS(e,y,i)),o}return S._value=r,S}function hS(e,r,i){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(r==null)return this.tween(o,null);if(typeof r!="function")throw new Error;return this.tween(o,uS(e,r,i??""))}function dS(e){return function(){this.textContent=e}}function fS(e){return function(){var r=e(this);this.textContent=r??""}}function pS(e){return this.tween("text",typeof e=="function"?fS(Gu(this,"text",e)):dS(e==null?"":e+""))}function _S(e){return function(r){this.textContent=e.call(this,r)}}function gS(e){var r,i;function o(){var h=e.apply(this,arguments);return h!==i&&(r=(i=h)&&_S(h)),r}return o._value=e,o}function mS(e){var r="text";if(arguments.length<1)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,gS(e))}function vS(){for(var e=this._name,r=this._id,i=U_(),o=this._groups,h=o.length,S=0;S<h;++S)for(var y=o[S],a=y.length,l,_=0;_<a;++_)if(l=y[_]){var v=tr(l,r);Ha(l,e,i,_,y,{time:v.time+v.delay+v.duration,delay:0,duration:v.duration,ease:v.ease})}return new Lr(o,this._parents,e,i)}function yS(){var e,r,i=this,o=i._id,h=i.size();return new Promise(function(S,y){var a={value:y},l={value:function(){--h===0&&S()}};i.each(function(){var _=fr(this,o),v=_.on;v!==e&&(r=(e=v).copy(),r._.cancel.push(a),r._.interrupt.push(a),r._.end.push(l)),_.on=r}),h===0&&S()})}var wS=0;function Lr(e,r,i,o){this._groups=e,this._parents=r,this._name=i,this._id=o}function U_(){return++wS}var xr=Ls.prototype;Lr.prototype={constructor:Lr,select:eS,selectAll:tS,selectChild:xr.selectChild,selectChildren:xr.selectChildren,filter:Kw,merge:Xw,selection:nS,transition:vS,call:xr.call,nodes:xr.nodes,node:xr.node,size:xr.size,empty:xr.empty,each:xr.each,on:Qw,attr:Tw,attrTween:Iw,style:lS,styleTween:hS,text:pS,textTween:mS,remove:Zw,tween:bw,delay:Fw,duration:$w,ease:Uw,easeVarying:qw,end:yS,[Symbol.iterator]:xr[Symbol.iterator]};function SS(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var CS={time:null,delay:0,duration:250,ease:SS};function xS(e,r){for(var i;!(i=e.__transition)||!(i=i[r]);)if(!(e=e.parentNode))throw new Error(`transition ${r} not found`);return i}function bS(e){var r,i;e instanceof Lr?(r=e._id,e=e._name):(r=U_(),(i=CS).time=Xu(),e=e==null?null:e+"");for(var o=this._groups,h=o.length,S=0;S<h;++S)for(var y=o[S],a=y.length,l,_=0;_<a;++_)(l=y[_])&&Ha(l,e,r,_,y,i||xS(l,r));return new Lr(o,this._parents,e,r)}Ls.prototype.interrupt=Sw;Ls.prototype.transition=bS;const na=e=>()=>e;function ES(e,{sourceEvent:r,target:i,transform:o,dispatch:h}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:r,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:h}})}function kr(e,r,i){this.k=e,this.x=r,this.y=i}kr.prototype={constructor:kr,scale:function(e){return e===1?this:new kr(this.k*e,this.x,this.y)},translate:function(e,r){return e===0&r===0?this:new kr(this.k,this.x+this.k*e,this.y+this.k*r)},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 Fa=new kr(1,0,0);V_.prototype=kr.prototype;function V_(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Fa;return e.__zoom}function Yc(e){e.stopImmediatePropagation()}function hs(e){e.preventDefault(),e.stopImmediatePropagation()}function kS(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function LS(){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 lp(){return this.__zoom||Fa}function RS(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function DS(){return navigator.maxTouchPoints||"ontouchstart"in this}function AS(e,r,i){var o=e.invertX(r[0][0])-i[0][0],h=e.invertX(r[1][0])-i[1][0],S=e.invertY(r[0][1])-i[0][1],y=e.invertY(r[1][1])-i[1][1];return e.translate(h>o?(o+h)/2:Math.min(0,o)||Math.max(0,h),y>S?(S+y)/2:Math.min(0,S)||Math.max(0,y))}function q_(){var e=kS,r=LS,i=AS,o=RS,h=DS,S=[0,1/0],y=[[-1/0,-1/0],[1/0,1/0]],a=250,l=pa,_=Ba("start","zoom","end"),v,c,m,C=500,b=150,x=0,f=10;function p(I){I.property("__zoom",lp).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",W).filter(h).on("touchstart.zoom",z).on("touchmove.zoom",j).on("touchend.zoom touchcancel.zoom",N).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}p.transform=function(I,q,U,K){var V=I.selection?I.selection():I;V.property("__zoom",lp),I!==V?L(I,q,U,K):V.interrupt().each(function(){R(this,arguments).event(K).start().zoom(null,typeof q=="function"?q.apply(this,arguments):q).end()})},p.scaleBy=function(I,q,U,K){p.scaleTo(I,function(){var V=this.__zoom.k,T=typeof q=="function"?q.apply(this,arguments):q;return V*T},U,K)},p.scaleTo=function(I,q,U,K){p.transform(I,function(){var V=r.apply(this,arguments),T=this.__zoom,B=U==null?w(V):typeof U=="function"?U.apply(this,arguments):U,P=T.invert(B),F=typeof q=="function"?q.apply(this,arguments):q;return i(u(d(T,F),B,P),V,y)},U,K)},p.translateBy=function(I,q,U,K){p.transform(I,function(){return i(this.__zoom.translate(typeof q=="function"?q.apply(this,arguments):q,typeof U=="function"?U.apply(this,arguments):U),r.apply(this,arguments),y)},null,K)},p.translateTo=function(I,q,U,K,V){p.transform(I,function(){var T=r.apply(this,arguments),B=this.__zoom,P=K==null?w(T):typeof K=="function"?K.apply(this,arguments):K;return i(Fa.translate(P[0],P[1]).scale(B.k).translate(typeof q=="function"?-q.apply(this,arguments):-q,typeof U=="function"?-U.apply(this,arguments):-U),T,y)},K,V)};function d(I,q){return q=Math.max(S[0],Math.min(S[1],q)),q===I.k?I:new kr(q,I.x,I.y)}function u(I,q,U){var K=q[0]-U[0]*I.k,V=q[1]-U[1]*I.k;return K===I.x&&V===I.y?I:new kr(I.k,K,V)}function w(I){return[(+I[0][0]+ +I[1][0])/2,(+I[0][1]+ +I[1][1])/2]}function L(I,q,U,K){I.on("start.zoom",function(){R(this,arguments).event(K).start()}).on("interrupt.zoom end.zoom",function(){R(this,arguments).event(K).end()}).tween("zoom",function(){var V=this,T=arguments,B=R(V,T).event(K),P=r.apply(V,T),F=U==null?w(P):typeof U=="function"?U.apply(V,T):U,G=Math.max(P[1][0]-P[0][0],P[1][1]-P[0][1]),Z=V.__zoom,ie=typeof q=="function"?q.apply(V,T):q,ae=l(Z.invert(F).concat(G/Z.k),ie.invert(F).concat(G/ie.k));return function(X){if(X===1)X=ie;else{var H=ae(X),re=G/H[2];X=new kr(re,F[0]-H[0]*re,F[1]-H[1]*re)}B.zoom(null,X)}})}function R(I,q,U){return!U&&I.__zooming||new D(I,q)}function D(I,q){this.that=I,this.args=q,this.active=0,this.sourceEvent=null,this.extent=r.apply(I,q),this.taps=0}D.prototype={event:function(I){return I&&(this.sourceEvent=I),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(I,q){return this.mouse&&I!=="mouse"&&(this.mouse[1]=q.invert(this.mouse[0])),this.touch0&&I!=="touch"&&(this.touch0[1]=q.invert(this.touch0[0])),this.touch1&&I!=="touch"&&(this.touch1[1]=q.invert(this.touch1[0])),this.that.__zoom=q,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(I){var q=Nt(this.that).datum();_.call(I,this.that,new ES(I,{sourceEvent:this.sourceEvent,target:p,transform:this.that.__zoom,dispatch:_}),q)}};function k(I,...q){if(!e.apply(this,arguments))return;var U=R(this,q).event(I),K=this.__zoom,V=Math.max(S[0],Math.min(S[1],K.k*Math.pow(2,o.apply(this,arguments)))),T=Qt(I);if(U.wheel)(U.mouse[0][0]!==T[0]||U.mouse[0][1]!==T[1])&&(U.mouse[1]=K.invert(U.mouse[0]=T)),clearTimeout(U.wheel);else{if(K.k===V)return;U.mouse=[T,K.invert(T)],ma(this),U.start()}hs(I),U.wheel=setTimeout(B,b),U.zoom("mouse",i(u(d(K,V),U.mouse[0],U.mouse[1]),U.extent,y));function B(){U.wheel=null,U.end()}}function M(I,...q){if(m||!e.apply(this,arguments))return;var U=I.currentTarget,K=R(this,q,!0).event(I),V=Nt(I.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",G,!0),T=Qt(I,U),B=I.clientX,P=I.clientY;D_(I.view),Yc(I),K.mouse=[T,this.__zoom.invert(T)],ma(this),K.start();function F(Z){if(hs(Z),!K.moved){var ie=Z.clientX-B,ae=Z.clientY-P;K.moved=ie*ie+ae*ae>x}K.event(Z).zoom("mouse",i(u(K.that.__zoom,K.mouse[0]=Qt(Z,U),K.mouse[1]),K.extent,y))}function G(Z){V.on("mousemove.zoom mouseup.zoom",null),A_(Z.view,K.moved),hs(Z),K.event(Z).end()}}function W(I,...q){if(e.apply(this,arguments)){var U=this.__zoom,K=Qt(I.changedTouches?I.changedTouches[0]:I,this),V=U.invert(K),T=U.k*(I.shiftKey?.5:2),B=i(u(d(U,T),K,V),r.apply(this,q),y);hs(I),a>0?Nt(this).transition().duration(a).call(L,B,K,I):Nt(this).call(p.transform,B,K,I)}}function z(I,...q){if(e.apply(this,arguments)){var U=I.touches,K=U.length,V=R(this,q,I.changedTouches.length===K).event(I),T,B,P,F;for(Yc(I),B=0;B<K;++B)P=U[B],F=Qt(P,this),F=[F,this.__zoom.invert(F),P.identifier],V.touch0?!V.touch1&&V.touch0[2]!==F[2]&&(V.touch1=F,V.taps=0):(V.touch0=F,T=!0,V.taps=1+!!v);v&&(v=clearTimeout(v)),T&&(V.taps<2&&(c=F[0],v=setTimeout(function(){v=null},C)),ma(this),V.start())}}function j(I,...q){if(this.__zooming){var U=R(this,q).event(I),K=I.changedTouches,V=K.length,T,B,P,F;for(hs(I),T=0;T<V;++T)B=K[T],P=Qt(B,this),U.touch0&&U.touch0[2]===B.identifier?U.touch0[0]=P:U.touch1&&U.touch1[2]===B.identifier&&(U.touch1[0]=P);if(B=U.that.__zoom,U.touch1){var G=U.touch0[0],Z=U.touch0[1],ie=U.touch1[0],ae=U.touch1[1],X=(X=ie[0]-G[0])*X+(X=ie[1]-G[1])*X,H=(H=ae[0]-Z[0])*H+(H=ae[1]-Z[1])*H;B=d(B,Math.sqrt(X/H)),P=[(G[0]+ie[0])/2,(G[1]+ie[1])/2],F=[(Z[0]+ae[0])/2,(Z[1]+ae[1])/2]}else if(U.touch0)P=U.touch0[0],F=U.touch0[1];else return;U.zoom("touch",i(u(B,P,F),U.extent,y))}}function N(I,...q){if(this.__zooming){var U=R(this,q).event(I),K=I.changedTouches,V=K.length,T,B;for(Yc(I),m&&clearTimeout(m),m=setTimeout(function(){m=null},C),T=0;T<V;++T)B=K[T],U.touch0&&U.touch0[2]===B.identifier?delete U.touch0:U.touch1&&U.touch1[2]===B.identifier&&delete U.touch1;if(U.touch1&&!U.touch0&&(U.touch0=U.touch1,delete U.touch1),U.touch0)U.touch0[1]=this.__zoom.invert(U.touch0[0]);else if(U.end(),U.taps===2&&(B=Qt(B,this),Math.hypot(c[0]-B[0],c[1]-B[1])<f)){var P=Nt(this).on("dblclick.zoom");P&&P.apply(this,arguments)}}}return p.wheelDelta=function(I){return arguments.length?(o=typeof I=="function"?I:na(+I),p):o},p.filter=function(I){return arguments.length?(e=typeof I=="function"?I:na(!!I),p):e},p.touchable=function(I){return arguments.length?(h=typeof I=="function"?I:na(!!I),p):h},p.extent=function(I){return arguments.length?(r=typeof I=="function"?I:na([[+I[0][0],+I[0][1]],[+I[1][0],+I[1][1]]]),p):r},p.scaleExtent=function(I){return arguments.length?(S[0]=+I[0],S[1]=+I[1],p):[S[0],S[1]]},p.translateExtent=function(I){return arguments.length?(y[0][0]=+I[0][0],y[1][0]=+I[1][0],y[0][1]=+I[0][1],y[1][1]=+I[1][1],p):[[y[0][0],y[0][1]],[y[1][0],y[1][1]]]},p.constrain=function(I){return arguments.length?(i=I,p):i},p.duration=function(I){return arguments.length?(a=+I,p):a},p.interpolate=function(I){return arguments.length?(l=I,p):l},p.on=function(){var I=_.on.apply(_,arguments);return I===_?p:I},p.clickDistance=function(I){return arguments.length?(x=(I=+I)*I,p):Math.sqrt(x)},p.tapDistance=function(I){return arguments.length?(f=+I,p):f},p}const dr={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:r,sourceHandle:i,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?i:o}", edge id: ${r}.`,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."},Ss=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],K_=["Enter"," ","Escape"],X_={"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:r,y:i})=>`Moved selected node ${e}. New position, x: ${r}, y: ${i}`,"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 hi;(function(e){e.Strict="strict",e.Loose="loose"})(hi||(hi={}));var xn;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(xn||(xn={}));var Cs;(function(e){e.Partial="partial",e.Full="full"})(Cs||(Cs={}));const Y_={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Zr;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Zr||(Zr={}));var La;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(La||(La={}));var xe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(xe||(xe={}));const cp={[xe.Left]:xe.Right,[xe.Right]:xe.Left,[xe.Top]:xe.Bottom,[xe.Bottom]:xe.Top};function G_(e){return e===null?null:e?"valid":"invalid"}const Q_=e=>"id"in e&&"source"in e&&"target"in e,TS=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Qu=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Ds=(e,r=[0,0])=>{const{width:i,height:o}=Rr(e),h=e.origin??r,S=i*h[0],y=o*h[1];return{x:e.position.x-S,y:e.position.y-y}},MS=(e,r={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const i=e.reduce((o,h)=>{const S=typeof h=="string";let y=!r.nodeLookup&&!S?h:void 0;r.nodeLookup&&(y=S?r.nodeLookup.get(h):Qu(h)?h:r.nodeLookup.get(h.id));const a=y?Ra(y,r.nodeOrigin):{x:0,y:0,x2:0,y2:0};return ja(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return za(i)},As=(e,r={})=>{let i={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(h=>{(r.filter===void 0||r.filter(h))&&(i=ja(i,Ra(h)),o=!0)}),o?za(i):{x:0,y:0,width:0,height:0}},Ju=(e,r,[i,o,h]=[0,0,1],S=!1,y=!1)=>{const a={...Ms(r,[i,o,h]),width:r.width/h,height:r.height/h},l=[];for(const _ of e.values()){const{measured:v,selectable:c=!0,hidden:m=!1}=_;if(y&&!c||m)continue;const C=v.width??_.width??_.initialWidth??null,b=v.height??_.height??_.initialHeight??null,x=xs(a,fi(_)),f=(C??0)*(b??0),p=S&&x>0;(!_.internals.handleBounds||p||x>=f||_.dragging)&&l.push(_)}return l},PS=(e,r)=>{const i=new Set;return e.forEach(o=>{i.add(o.id)}),r.filter(o=>i.has(o.source)||i.has(o.target))};function NS(e,r){const i=new Map,o=r!=null&&r.nodes?new Set(r.nodes.map(h=>h.id)):null;return e.forEach(h=>{h.measured.width&&h.measured.height&&((r==null?void 0:r.includeHiddenNodes)||!h.hidden)&&(!o||o.has(h.id))&&i.set(h.id,h)}),i}async function BS({nodes:e,width:r,height:i,panZoom:o,minZoom:h,maxZoom:S},y){if(e.size===0)return Promise.resolve(!0);const a=NS(e,y),l=As(a),_=Zu(l,r,i,(y==null?void 0:y.minZoom)??h,(y==null?void 0:y.maxZoom)??S,(y==null?void 0:y.padding)??.1);return await o.setViewport(_,{duration:y==null?void 0:y.duration,ease:y==null?void 0:y.ease,interpolate:y==null?void 0:y.interpolate}),Promise.resolve(!0)}function J_({nodeId:e,nextPosition:r,nodeLookup:i,nodeOrigin:o=[0,0],nodeExtent:h,onError:S}){const y=i.get(e),a=y.parentId?i.get(y.parentId):void 0,{x:l,y:_}=a?a.internals.positionAbsolute:{x:0,y:0},v=y.origin??o;let c=y.extent||h;if(y.extent==="parent"&&!y.expandParent)if(!a)S==null||S("005",dr.error005());else{const C=a.measured.width,b=a.measured.height;C&&b&&(c=[[l,_],[l+C,_+b]])}else a&&pi(y.extent)&&(c=[[y.extent[0][0]+l,y.extent[0][1]+_],[y.extent[1][0]+l,y.extent[1][1]+_]]);const m=pi(c)?kn(r,c,y.measured):r;return(y.measured.width===void 0||y.measured.height===void 0)&&(S==null||S("015",dr.error015())),{position:{x:m.x-l+(y.measured.width??0)*v[0],y:m.y-_+(y.measured.height??0)*v[1]},positionAbsolute:m}}async function IS({nodesToRemove:e=[],edgesToRemove:r=[],nodes:i,edges:o,onBeforeDelete:h}){const S=new Set(e.map(m=>m.id)),y=[];for(const m of i){if(m.deletable===!1)continue;const C=S.has(m.id),b=!C&&m.parentId&&y.find(x=>x.id===m.parentId);(C||b)&&y.push(m)}const a=new Set(r.map(m=>m.id)),l=o.filter(m=>m.deletable!==!1),v=PS(y,l);for(const m of l)a.has(m.id)&&!v.find(b=>b.id===m.id)&&v.push(m);if(!h)return{edges:v,nodes:y};const c=await h({nodes:y,edges:v});return typeof c=="boolean"?c?{edges:v,nodes:y}:{edges:[],nodes:[]}:c}const di=(e,r=0,i=1)=>Math.min(Math.max(e,r),i),kn=(e={x:0,y:0},r,i)=>({x:di(e.x,r[0][0],r[1][0]-((i==null?void 0:i.width)??0)),y:di(e.y,r[0][1],r[1][1]-((i==null?void 0:i.height)??0))});function Z_(e,r,i){const{width:o,height:h}=Rr(i),{x:S,y}=i.internals.positionAbsolute;return kn(e,[[S,y],[S+o,y+h]],r)}const up=(e,r,i)=>e<r?di(Math.abs(e-r),1,r)/r:e>i?-di(Math.abs(e-i),1,r)/r:0,eg=(e,r,i=15,o=40)=>{const h=up(e.x,o,r.width-o)*i,S=up(e.y,o,r.height-o)*i;return[h,S]},ja=(e,r)=>({x:Math.min(e.x,r.x),y:Math.min(e.y,r.y),x2:Math.max(e.x2,r.x2),y2:Math.max(e.y2,r.y2)}),ku=({x:e,y:r,width:i,height:o})=>({x:e,y:r,x2:e+i,y2:r+o}),za=({x:e,y:r,x2:i,y2:o})=>({x:e,y:r,width:i-e,height:o-r}),fi=(e,r=[0,0])=>{var h,S;const{x:i,y:o}=Qu(e)?e.internals.positionAbsolute:Ds(e,r);return{x:i,y:o,width:((h=e.measured)==null?void 0:h.width)??e.width??e.initialWidth??0,height:((S=e.measured)==null?void 0:S.height)??e.height??e.initialHeight??0}},Ra=(e,r=[0,0])=>{var h,S;const{x:i,y:o}=Qu(e)?e.internals.positionAbsolute:Ds(e,r);return{x:i,y:o,x2:i+(((h=e.measured)==null?void 0:h.width)??e.width??e.initialWidth??0),y2:o+(((S=e.measured)==null?void 0:S.height)??e.height??e.initialHeight??0)}},tg=(e,r)=>za(ja(ku(e),ku(r))),xs=(e,r)=>{const i=Math.max(0,Math.min(e.x+e.width,r.x+r.width)-Math.max(e.x,r.x)),o=Math.max(0,Math.min(e.y+e.height,r.y+r.height)-Math.max(e.y,r.y));return Math.ceil(i*o)},hp=e=>Zt(e.width)&&Zt(e.height)&&Zt(e.x)&&Zt(e.y),Zt=e=>!isNaN(e)&&isFinite(e),OS=(e,r)=>{},Ts=(e,r=[1,1])=>({x:r[0]*Math.round(e.x/r[0]),y:r[1]*Math.round(e.y/r[1])}),Ms=({x:e,y:r},[i,o,h],S=!1,y=[1,1])=>{const a={x:(e-i)/h,y:(r-o)/h};return S?Ts(a,y):a},Da=({x:e,y:r},[i,o,h])=>({x:e*h+i,y:r*h+o});function ii(e,r){if(typeof e=="number")return Math.floor((r-r/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const i=parseFloat(e);if(!Number.isNaN(i))return Math.floor(i)}if(typeof e=="string"&&e.endsWith("%")){const i=parseFloat(e);if(!Number.isNaN(i))return Math.floor(r*i*.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 HS(e,r,i){if(typeof e=="string"||typeof e=="number"){const o=ii(e,i),h=ii(e,r);return{top:o,right:h,bottom:o,left:h,x:h*2,y:o*2}}if(typeof e=="object"){const o=ii(e.top??e.y??0,i),h=ii(e.bottom??e.y??0,i),S=ii(e.left??e.x??0,r),y=ii(e.right??e.x??0,r);return{top:o,right:y,bottom:h,left:S,x:S+y,y:o+h}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function FS(e,r,i,o,h,S){const{x:y,y:a}=Da(e,[r,i,o]),{x:l,y:_}=Da({x:e.x+e.width,y:e.y+e.height},[r,i,o]),v=h-l,c=S-_;return{left:Math.floor(y),top:Math.floor(a),right:Math.floor(v),bottom:Math.floor(c)}}const Zu=(e,r,i,o,h,S)=>{const y=HS(S,r,i),a=(r-y.x)/e.width,l=(i-y.y)/e.height,_=Math.min(a,l),v=di(_,o,h),c=e.x+e.width/2,m=e.y+e.height/2,C=r/2-c*v,b=i/2-m*v,x=FS(e,C,b,v,r,i),f={left:Math.min(x.left-y.left,0),top:Math.min(x.top-y.top,0),right:Math.min(x.right-y.right,0),bottom:Math.min(x.bottom-y.bottom,0)};return{x:C-f.left+f.right,y:b-f.top+f.bottom,zoom:v}},bs=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function pi(e){return e!=null&&e!=="parent"}function Rr(e){var r,i;return{width:((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}}function rg(e){var r,i;return(((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth)!==void 0&&(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight)!==void 0}function ng(e,r={width:0,height:0},i,o,h){const S={...e},y=o.get(i);if(y){const a=y.origin||h;S.x+=y.internals.positionAbsolute.x-(r.width??0)*a[0],S.y+=y.internals.positionAbsolute.y-(r.height??0)*a[1]}return S}function dp(e,r){if(e.size!==r.size)return!1;for(const i of e)if(!r.has(i))return!1;return!0}function jS(){let e,r;return{promise:new Promise((o,h)=>{e=o,r=h}),resolve:e,reject:r}}function zS(e){return{...X_,...e||{}}}function gs(e,{snapGrid:r=[0,0],snapToGrid:i=!1,transform:o,containerBounds:h}){const{x:S,y}=er(e),a=Ms({x:S-((h==null?void 0:h.left)??0),y:y-((h==null?void 0:h.top)??0)},o),{x:l,y:_}=i?Ts(a,r):a;return{xSnapped:l,ySnapped:_,...a}}const eh=e=>({width:e.offsetWidth,height:e.offsetHeight}),ig=e=>{var r;return((r=e==null?void 0:e.getRootNode)==null?void 0:r.call(e))||(window==null?void 0:window.document)},$S=["INPUT","SELECT","TEXTAREA"];function sg(e){var o,h;const r=((h=(o=e.composedPath)==null?void 0:o.call(e))==null?void 0:h[0])||e.target;return(r==null?void 0:r.nodeType)!==1?!1:$S.includes(r.nodeName)||r.hasAttribute("contenteditable")||!!r.closest(".nokey")}const og=e=>"clientX"in e,er=(e,r)=>{var S,y;const i=og(e),o=i?e.clientX:(S=e.touches)==null?void 0:S[0].clientX,h=i?e.clientY:(y=e.touches)==null?void 0:y[0].clientY;return{x:o-((r==null?void 0:r.left)??0),y:h-((r==null?void 0:r.top)??0)}},fp=(e,r,i,o,h)=>{const S=r.querySelectorAll(`.${e}`);return!S||!S.length?null:Array.from(S).map(y=>{const a=y.getBoundingClientRect();return{id:y.getAttribute("data-handleid"),type:e,nodeId:h,position:y.getAttribute("data-handlepos"),x:(a.left-i.left)/o,y:(a.top-i.top)/o,...eh(y)}})};function ag({sourceX:e,sourceY:r,targetX:i,targetY:o,sourceControlX:h,sourceControlY:S,targetControlX:y,targetControlY:a}){const l=e*.125+h*.375+y*.375+i*.125,_=r*.125+S*.375+a*.375+o*.125,v=Math.abs(l-e),c=Math.abs(_-r);return[l,_,v,c]}function ia(e,r){return e>=0?.5*e:r*25*Math.sqrt(-e)}function pp({pos:e,x1:r,y1:i,x2:o,y2:h,c:S}){switch(e){case xe.Left:return[r-ia(r-o,S),i];case xe.Right:return[r+ia(o-r,S),i];case xe.Top:return[r,i-ia(i-h,S)];case xe.Bottom:return[r,i+ia(h-i,S)]}}function lg({sourceX:e,sourceY:r,sourcePosition:i=xe.Bottom,targetX:o,targetY:h,targetPosition:S=xe.Top,curvature:y=.25}){const[a,l]=pp({pos:i,x1:e,y1:r,x2:o,y2:h,c:y}),[_,v]=pp({pos:S,x1:o,y1:h,x2:e,y2:r,c:y}),[c,m,C,b]=ag({sourceX:e,sourceY:r,targetX:o,targetY:h,sourceControlX:a,sourceControlY:l,targetControlX:_,targetControlY:v});return[`M${e},${r} C${a},${l} ${_},${v} ${o},${h}`,c,m,C,b]}function cg({sourceX:e,sourceY:r,targetX:i,targetY:o}){const h=Math.abs(i-e)/2,S=i<e?i+h:i-h,y=Math.abs(o-r)/2,a=o<r?o+y:o-y;return[S,a,h,y]}function WS({sourceNode:e,targetNode:r,selected:i=!1,zIndex:o=0,elevateOnSelect:h=!1,zIndexMode:S="basic"}){if(S==="manual")return o;const y=h&&i?o+1e3:o,a=Math.max(e.parentId||h&&e.selected?e.internals.z:0,r.parentId||h&&r.selected?r.internals.z:0);return y+a}function US({sourceNode:e,targetNode:r,width:i,height:o,transform:h}){const S=ja(Ra(e),Ra(r));S.x===S.x2&&(S.x2+=1),S.y===S.y2&&(S.y2+=1);const y={x:-h[0]/h[2],y:-h[1]/h[2],width:i/h[2],height:o/h[2]};return xs(y,za(S))>0}const VS=({source:e,sourceHandle:r,target:i,targetHandle:o})=>`xy-edge__${e}${r||""}-${i}${o||""}`,qS=(e,r)=>r.some(i=>i.source===e.source&&i.target===e.target&&(i.sourceHandle===e.sourceHandle||!i.sourceHandle&&!e.sourceHandle)&&(i.targetHandle===e.targetHandle||!i.targetHandle&&!e.targetHandle)),KS=(e,r,i={})=>{if(!e.source||!e.target)return r;const o=i.getEdgeId||VS;let h;return Q_(e)?h={...e}:h={...e,id:o(e)},qS(h,r)?r:(h.sourceHandle===null&&delete h.sourceHandle,h.targetHandle===null&&delete h.targetHandle,r.concat(h))};function ug({sourceX:e,sourceY:r,targetX:i,targetY:o}){const[h,S,y,a]=cg({sourceX:e,sourceY:r,targetX:i,targetY:o});return[`M ${e},${r}L ${i},${o}`,h,S,y,a]}const _p={[xe.Left]:{x:-1,y:0},[xe.Right]:{x:1,y:0},[xe.Top]:{x:0,y:-1},[xe.Bottom]:{x:0,y:1}},XS=({source:e,sourcePosition:r=xe.Bottom,target:i})=>r===xe.Left||r===xe.Right?e.x<i.x?{x:1,y:0}:{x:-1,y:0}:e.y<i.y?{x:0,y:1}:{x:0,y:-1},gp=(e,r)=>Math.sqrt(Math.pow(r.x-e.x,2)+Math.pow(r.y-e.y,2));function YS({source:e,sourcePosition:r=xe.Bottom,target:i,targetPosition:o=xe.Top,center:h,offset:S,stepPosition:y}){const a=_p[r],l=_p[o],_={x:e.x+a.x*S,y:e.y+a.y*S},v={x:i.x+l.x*S,y:i.y+l.y*S},c=XS({source:_,sourcePosition:r,target:v}),m=c.x!==0?"x":"y",C=c[m];let b=[],x,f;const p={x:0,y:0},d={x:0,y:0},[,,u,w]=cg({sourceX:e.x,sourceY:e.y,targetX:i.x,targetY:i.y});if(a[m]*l[m]===-1){m==="x"?(x=h.x??_.x+(v.x-_.x)*y,f=h.y??(_.y+v.y)/2):(x=h.x??(_.x+v.x)/2,f=h.y??_.y+(v.y-_.y)*y);const k=[{x,y:_.y},{x,y:v.y}],M=[{x:_.x,y:f},{x:v.x,y:f}];a[m]===C?b=m==="x"?k:M:b=m==="x"?M:k}else{const k=[{x:_.x,y:v.y}],M=[{x:v.x,y:_.y}];if(m==="x"?b=a.x===C?M:k:b=a.y===C?k:M,r===o){const I=Math.abs(e[m]-i[m]);if(I<=S){const q=Math.min(S-1,S-I);a[m]===C?p[m]=(_[m]>e[m]?-1:1)*q:d[m]=(v[m]>i[m]?-1:1)*q}}if(r!==o){const I=m==="x"?"y":"x",q=a[m]===l[I],U=_[I]>v[I],K=_[I]<v[I];(a[m]===1&&(!q&&U||q&&K)||a[m]!==1&&(!q&&K||q&&U))&&(b=m==="x"?k:M)}const W={x:_.x+p.x,y:_.y+p.y},z={x:v.x+d.x,y:v.y+d.y},j=Math.max(Math.abs(W.x-b[0].x),Math.abs(z.x-b[0].x)),N=Math.max(Math.abs(W.y-b[0].y),Math.abs(z.y-b[0].y));j>=N?(x=(W.x+z.x)/2,f=b[0].y):(x=b[0].x,f=(W.y+z.y)/2)}const L={x:_.x+p.x,y:_.y+p.y},R={x:v.x+d.x,y:v.y+d.y};return[[e,...L.x!==b[0].x||L.y!==b[0].y?[L]:[],...b,...R.x!==b[b.length-1].x||R.y!==b[b.length-1].y?[R]:[],i],x,f,u,w]}function GS(e,r,i,o){const h=Math.min(gp(e,r)/2,gp(r,i)/2,o),{x:S,y}=r;if(e.x===S&&S===i.x||e.y===y&&y===i.y)return`L${S} ${y}`;if(e.y===y){const _=e.x<i.x?-1:1,v=e.y<i.y?1:-1;return`L ${S+h*_},${y}Q ${S},${y} ${S},${y+h*v}`}const a=e.x<i.x?1:-1,l=e.y<i.y?-1:1;return`L ${S},${y+h*l}Q ${S},${y} ${S+h*a},${y}`}function Lu({sourceX:e,sourceY:r,sourcePosition:i=xe.Bottom,targetX:o,targetY:h,targetPosition:S=xe.Top,borderRadius:y=5,centerX:a,centerY:l,offset:_=20,stepPosition:v=.5}){const[c,m,C,b,x]=YS({source:{x:e,y:r},sourcePosition:i,target:{x:o,y:h},targetPosition:S,center:{x:a,y:l},offset:_,stepPosition:v});let f=`M${c[0].x} ${c[0].y}`;for(let p=1;p<c.length-1;p++)f+=GS(c[p-1],c[p],c[p+1],y);return f+=`L${c[c.length-1].x} ${c[c.length-1].y}`,[f,m,C,b,x]}function mp(e){var r;return e&&!!(e.internals.handleBounds||(r=e.handles)!=null&&r.length)&&!!(e.measured.width||e.width||e.initialWidth)}function QS(e){var c;const{sourceNode:r,targetNode:i}=e;if(!mp(r)||!mp(i))return null;const o=r.internals.handleBounds||vp(r.handles),h=i.internals.handleBounds||vp(i.handles),S=yp((o==null?void 0:o.source)??[],e.sourceHandle),y=yp(e.connectionMode===hi.Strict?(h==null?void 0:h.target)??[]:((h==null?void 0:h.target)??[]).concat((h==null?void 0:h.source)??[]),e.targetHandle);if(!S||!y)return(c=e.onError)==null||c.call(e,"008",dr.error008(S?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(S==null?void 0:S.position)||xe.Bottom,l=(y==null?void 0:y.position)||xe.Top,_=Ln(r,S,a),v=Ln(i,y,l);return{sourceX:_.x,sourceY:_.y,targetX:v.x,targetY:v.y,sourcePosition:a,targetPosition:l}}function vp(e){if(!e)return null;const r=[],i=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?r.push(o):o.type==="target"&&i.push(o);return{source:r,target:i}}function Ln(e,r,i=xe.Left,o=!1){const h=((r==null?void 0:r.x)??0)+e.internals.positionAbsolute.x,S=((r==null?void 0:r.y)??0)+e.internals.positionAbsolute.y,{width:y,height:a}=r??Rr(e);if(o)return{x:h+y/2,y:S+a/2};switch((r==null?void 0:r.position)??i){case xe.Top:return{x:h+y/2,y:S};case xe.Right:return{x:h+y,y:S+a/2};case xe.Bottom:return{x:h+y/2,y:S+a};case xe.Left:return{x:h,y:S+a/2}}}function yp(e,r){return e&&(r?e.find(i=>i.id===r):e[0])||null}function Ru(e,r){return e?typeof e=="string"?e:`${r?`${r}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function JS(e,{id:r,defaultColor:i,defaultMarkerStart:o,defaultMarkerEnd:h}){const S=new Set;return e.reduce((y,a)=>([a.markerStart||o,a.markerEnd||h].forEach(l=>{if(l&&typeof l=="object"){const _=Ru(l,r);S.has(_)||(y.push({id:_,color:l.color||i,...l}),S.add(_))}}),y),[]).sort((y,a)=>y.id.localeCompare(a.id))}const hg=1e3,ZS=10,th={nodeOrigin:[0,0],nodeExtent:Ss,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},eC={...th,checkEquality:!0};function rh(e,r){const i={...e};for(const o in r)r[o]!==void 0&&(i[o]=r[o]);return i}function tC(e,r,i){const o=rh(th,i);for(const h of e.values())if(h.parentId)ih(h,e,r,o);else{const S=Ds(h,o.nodeOrigin),y=pi(h.extent)?h.extent:o.nodeExtent,a=kn(S,y,Rr(h));h.internals.positionAbsolute=a}}function rC(e,r){if(!e.handles)return e.measured?r==null?void 0:r.internals.handleBounds:void 0;const i=[],o=[];for(const h of e.handles){const S={id:h.id,width:h.width??1,height:h.height??1,nodeId:e.id,x:h.x,y:h.y,position:h.position,type:h.type};h.type==="source"?i.push(S):h.type==="target"&&o.push(S)}return{source:i,target:o}}function nh(e){return e==="manual"}function Du(e,r,i,o={}){var v,c;const h=rh(eC,o),S={i:0},y=new Map(r),a=h!=null&&h.elevateNodesOnSelect&&!nh(h.zIndexMode)?hg:0;let l=e.length>0,_=!1;r.clear(),i.clear();for(const m of e){let C=y.get(m.id);if(h.checkEquality&&m===(C==null?void 0:C.internals.userNode))r.set(m.id,C);else{const b=Ds(m,h.nodeOrigin),x=pi(m.extent)?m.extent:h.nodeExtent,f=kn(b,x,Rr(m));C={...h.defaults,...m,measured:{width:(v=m.measured)==null?void 0:v.width,height:(c=m.measured)==null?void 0:c.height},internals:{positionAbsolute:f,handleBounds:rC(m,C),z:dg(m,a,h.zIndexMode),userNode:m}},r.set(m.id,C)}(C.measured===void 0||C.measured.width===void 0||C.measured.height===void 0)&&!C.hidden&&(l=!1),m.parentId&&ih(C,r,i,o,S),_||(_=m.selected??!1)}return{nodesInitialized:l,hasSelectedNodes:_}}function nC(e,r){if(!e.parentId)return;const i=r.get(e.parentId);i?i.set(e.id,e):r.set(e.parentId,new Map([[e.id,e]]))}function ih(e,r,i,o,h){const{elevateNodesOnSelect:S,nodeOrigin:y,nodeExtent:a,zIndexMode:l}=rh(th,o),_=e.parentId,v=r.get(_);if(!v){console.warn(`Parent node ${_} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}nC(e,i),h&&!v.parentId&&v.internals.rootParentIndex===void 0&&l==="auto"&&(v.internals.rootParentIndex=++h.i,v.internals.z=v.internals.z+h.i*ZS),h&&v.internals.rootParentIndex!==void 0&&(h.i=v.internals.rootParentIndex);const c=S&&!nh(l)?hg:0,{x:m,y:C,z:b}=iC(e,v,y,a,c,l),{positionAbsolute:x}=e.internals,f=m!==x.x||C!==x.y;(f||b!==e.internals.z)&&r.set(e.id,{...e,internals:{...e.internals,positionAbsolute:f?{x:m,y:C}:x,z:b}})}function dg(e,r,i){const o=Zt(e.zIndex)?e.zIndex:0;return nh(i)?o:o+(e.selected?r:0)}function iC(e,r,i,o,h,S){const{x:y,y:a}=r.internals.positionAbsolute,l=Rr(e),_=Ds(e,i),v=pi(e.extent)?kn(_,e.extent,l):_;let c=kn({x:y+v.x,y:a+v.y},o,l);e.extent==="parent"&&(c=Z_(c,l,r));const m=dg(e,h,S),C=r.internals.z??0;return{x:c.x,y:c.y,z:C>=m?C+1:m}}function sh(e,r,i,o=[0,0]){var y;const h=[],S=new Map;for(const a of e){const l=r.get(a.parentId);if(!l)continue;const _=((y=S.get(a.parentId))==null?void 0:y.expandedRect)??fi(l),v=tg(_,a.rect);S.set(a.parentId,{expandedRect:v,parent:l})}return S.size>0&&S.forEach(({expandedRect:a,parent:l},_)=>{var u;const v=l.internals.positionAbsolute,c=Rr(l),m=l.origin??o,C=a.x<v.x?Math.round(Math.abs(v.x-a.x)):0,b=a.y<v.y?Math.round(Math.abs(v.y-a.y)):0,x=Math.max(c.width,Math.round(a.width)),f=Math.max(c.height,Math.round(a.height)),p=(x-c.width)*m[0],d=(f-c.height)*m[1];(C>0||b>0||p||d)&&(h.push({id:_,type:"position",position:{x:l.position.x-C+p,y:l.position.y-b+d}}),(u=i.get(_))==null||u.forEach(w=>{e.some(L=>L.id===w.id)||h.push({id:w.id,type:"position",position:{x:w.position.x+C,y:w.position.y+b}})})),(c.width<a.width||c.height<a.height||C||b)&&h.push({id:_,type:"dimensions",setAttributes:!0,dimensions:{width:x+(C?m[0]*C-p:0),height:f+(b?m[1]*b-d:0)}})}),h}function sC(e,r,i,o,h,S,y){const a=o==null?void 0:o.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const _=[],v=window.getComputedStyle(a),{m22:c}=new window.DOMMatrixReadOnly(v.transform),m=[];for(const C of e.values()){const b=r.get(C.id);if(!b)continue;if(b.hidden){r.set(b.id,{...b,internals:{...b.internals,handleBounds:void 0}}),l=!0;continue}const x=eh(C.nodeElement),f=b.measured.width!==x.width||b.measured.height!==x.height;if(!!(x.width&&x.height&&(f||!b.internals.handleBounds||C.force))){const d=C.nodeElement.getBoundingClientRect(),u=pi(b.extent)?b.extent:S;let{positionAbsolute:w}=b.internals;b.parentId&&b.extent==="parent"?w=Z_(w,x,r.get(b.parentId)):u&&(w=kn(w,u,x));const L={...b,measured:x,internals:{...b.internals,positionAbsolute:w,handleBounds:{source:fp("source",C.nodeElement,d,c,b.id),target:fp("target",C.nodeElement,d,c,b.id)}}};r.set(b.id,L),b.parentId&&ih(L,r,i,{nodeOrigin:h,zIndexMode:y}),l=!0,f&&(_.push({id:b.id,type:"dimensions",dimensions:x}),b.expandParent&&b.parentId&&m.push({id:b.id,parentId:b.parentId,rect:fi(L,h)}))}}if(m.length>0){const C=sh(m,r,i,h);_.push(...C)}return{changes:_,updatedInternals:l}}async function oC({delta:e,panZoom:r,transform:i,translateExtent:o,width:h,height:S}){if(!r||!e.x&&!e.y)return Promise.resolve(!1);const y=await r.setViewportConstrained({x:i[0]+e.x,y:i[1]+e.y,zoom:i[2]},[[0,0],[h,S]],o),a=!!y&&(y.x!==i[0]||y.y!==i[1]||y.k!==i[2]);return Promise.resolve(a)}function wp(e,r,i,o,h,S){let y=h;const a=o.get(y)||new Map;o.set(y,a.set(i,r)),y=`${h}-${e}`;const l=o.get(y)||new Map;if(o.set(y,l.set(i,r)),S){y=`${h}-${e}-${S}`;const _=o.get(y)||new Map;o.set(y,_.set(i,r))}}function fg(e,r,i){e.clear(),r.clear();for(const o of i){const{source:h,target:S,sourceHandle:y=null,targetHandle:a=null}=o,l={edgeId:o.id,source:h,target:S,sourceHandle:y,targetHandle:a},_=`${h}-${y}--${S}-${a}`,v=`${S}-${a}--${h}-${y}`;wp("source",l,v,e,h,y),wp("target",l,_,e,S,a),r.set(o.id,o)}}function pg(e,r){if(!e.parentId)return!1;const i=r.get(e.parentId);return i?i.selected?!0:pg(i,r):!1}function Sp(e,r,i){var h;let o=e;do{if((h=o==null?void 0:o.matches)!=null&&h.call(o,r))return!0;if(o===i)return!1;o=o==null?void 0:o.parentElement}while(o);return!1}function aC(e,r,i,o){const h=new Map;for(const[S,y]of e)if((y.selected||y.id===o)&&(!y.parentId||!pg(y,e))&&(y.draggable||r&&typeof y.draggable>"u")){const a=e.get(S);a&&h.set(S,{id:S,position:a.position||{x:0,y:0},distance:{x:i.x-a.internals.positionAbsolute.x,y:i.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return h}function Gc({nodeId:e,dragItems:r,nodeLookup:i,dragging:o=!0}){var y,a,l;const h=[];for(const[_,v]of r){const c=(y=i.get(_))==null?void 0:y.internals.userNode;c&&h.push({...c,position:v.position,dragging:o})}if(!e)return[h[0],h];const S=(a=i.get(e))==null?void 0:a.internals.userNode;return[S?{...S,position:((l=r.get(e))==null?void 0:l.position)||S.position,dragging:o}:h[0],h]}function lC({dragItems:e,snapGrid:r,x:i,y:o}){const h=e.values().next().value;if(!h)return null;const S={x:i-h.distance.x,y:o-h.distance.y},y=Ts(S,r);return{x:y.x-S.x,y:y.y-S.y}}function cC({onNodeMouseDown:e,getStoreItems:r,onDragStart:i,onDrag:o,onDragStop:h}){let S={x:null,y:null},y=0,a=new Map,l=!1,_={x:0,y:0},v=null,c=!1,m=null,C=!1,b=!1,x=null;function f({noDragClassName:d,handleSelector:u,domNode:w,isSelectable:L,nodeId:R,nodeClickDistance:D=0}){m=Nt(w);function k({x:j,y:N}){const{nodeLookup:I,nodeExtent:q,snapGrid:U,snapToGrid:K,nodeOrigin:V,onNodeDrag:T,onSelectionDrag:B,onError:P,updateNodePositions:F}=r();S={x:j,y:N};let G=!1;const Z=a.size>1,ie=Z&&q?ku(As(a)):null,ae=Z&&K?lC({dragItems:a,snapGrid:U,x:j,y:N}):null;for(const[X,H]of a){if(!I.has(X))continue;let re={x:j-H.distance.x,y:N-H.distance.y};K&&(re=ae?{x:Math.round(re.x+ae.x),y:Math.round(re.y+ae.y)}:Ts(re,U));let te=null;if(Z&&q&&!H.extent&&ie){const{positionAbsolute:pe}=H.internals,Se=pe.x-ie.x+q[0][0],be=pe.x+H.measured.width-ie.x2+q[1][0],ue=pe.y-ie.y+q[0][1],ge=pe.y+H.measured.height-ie.y2+q[1][1];te=[[Se,ue],[be,ge]]}const{position:ce,positionAbsolute:le}=J_({nodeId:X,nextPosition:re,nodeLookup:I,nodeExtent:te||q,nodeOrigin:V,onError:P});G=G||H.position.x!==ce.x||H.position.y!==ce.y,H.position=ce,H.internals.positionAbsolute=le}if(b=b||G,!!G&&(F(a,!0),x&&(o||T||!R&&B))){const[X,H]=Gc({nodeId:R,dragItems:a,nodeLookup:I});o==null||o(x,a,X,H),T==null||T(x,X,H),R||B==null||B(x,H)}}async function M(){if(!v)return;const{transform:j,panBy:N,autoPanSpeed:I,autoPanOnNodeDrag:q}=r();if(!q){l=!1,cancelAnimationFrame(y);return}const[U,K]=eg(_,v,I);(U!==0||K!==0)&&(S.x=(S.x??0)-U/j[2],S.y=(S.y??0)-K/j[2],await N({x:U,y:K})&&k(S)),y=requestAnimationFrame(M)}function W(j){var Z;const{nodeLookup:N,multiSelectionActive:I,nodesDraggable:q,transform:U,snapGrid:K,snapToGrid:V,selectNodesOnDrag:T,onNodeDragStart:B,onSelectionDragStart:P,unselectNodesAndEdges:F}=r();c=!0,(!T||!L)&&!I&&R&&((Z=N.get(R))!=null&&Z.selected||F()),L&&T&&R&&(e==null||e(R));const G=gs(j.sourceEvent,{transform:U,snapGrid:K,snapToGrid:V,containerBounds:v});if(S=G,a=aC(N,q,G,R),a.size>0&&(i||B||!R&&P)){const[ie,ae]=Gc({nodeId:R,dragItems:a,nodeLookup:N});i==null||i(j.sourceEvent,a,ie,ae),B==null||B(j.sourceEvent,ie,ae),R||P==null||P(j.sourceEvent,ae)}}const z=T_().clickDistance(D).on("start",j=>{const{domNode:N,nodeDragThreshold:I,transform:q,snapGrid:U,snapToGrid:K}=r();v=(N==null?void 0:N.getBoundingClientRect())||null,C=!1,b=!1,x=j.sourceEvent,I===0&&W(j),S=gs(j.sourceEvent,{transform:q,snapGrid:U,snapToGrid:K,containerBounds:v}),_=er(j.sourceEvent,v)}).on("drag",j=>{const{autoPanOnNodeDrag:N,transform:I,snapGrid:q,snapToGrid:U,nodeDragThreshold:K,nodeLookup:V}=r(),T=gs(j.sourceEvent,{transform:I,snapGrid:q,snapToGrid:U,containerBounds:v});if(x=j.sourceEvent,(j.sourceEvent.type==="touchmove"&&j.sourceEvent.touches.length>1||R&&!V.has(R))&&(C=!0),!C){if(!l&&N&&c&&(l=!0,M()),!c){const B=er(j.sourceEvent,v),P=B.x-_.x,F=B.y-_.y;Math.sqrt(P*P+F*F)>K&&W(j)}(S.x!==T.xSnapped||S.y!==T.ySnapped)&&a&&c&&(_=er(j.sourceEvent,v),k(T))}}).on("end",j=>{if(!(!c||C)&&(l=!1,c=!1,cancelAnimationFrame(y),a.size>0)){const{nodeLookup:N,updateNodePositions:I,onNodeDragStop:q,onSelectionDragStop:U}=r();if(b&&(I(a,!1),b=!1),h||q||!R&&U){const[K,V]=Gc({nodeId:R,dragItems:a,nodeLookup:N,dragging:!1});h==null||h(j.sourceEvent,a,K,V),q==null||q(j.sourceEvent,K,V),R||U==null||U(j.sourceEvent,V)}}}).filter(j=>{const N=j.target;return!j.button&&(!d||!Sp(N,`.${d}`,w))&&(!u||Sp(N,u,w))});m.call(z)}function p(){m==null||m.on(".drag",null)}return{update:f,destroy:p}}function uC(e,r,i){const o=[],h={x:e.x-i,y:e.y-i,width:i*2,height:i*2};for(const S of r.values())xs(h,fi(S))>0&&o.push(S);return o}const hC=250;function dC(e,r,i,o){var a,l;let h=[],S=1/0;const y=uC(e,i,r+hC);for(const _ of y){const v=[...((a=_.internals.handleBounds)==null?void 0:a.source)??[],...((l=_.internals.handleBounds)==null?void 0:l.target)??[]];for(const c of v){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;const{x:m,y:C}=Ln(_,c,c.position,!0),b=Math.sqrt(Math.pow(m-e.x,2)+Math.pow(C-e.y,2));b>r||(b<S?(h=[{...c,x:m,y:C}],S=b):b===S&&h.push({...c,x:m,y:C}))}}if(!h.length)return null;if(h.length>1){const _=o.type==="source"?"target":"source";return h.find(v=>v.type===_)??h[0]}return h[0]}function _g(e,r,i,o,h,S=!1){var _,v,c;const y=o.get(e);if(!y)return null;const a=h==="strict"?(_=y.internals.handleBounds)==null?void 0:_[r]:[...((v=y.internals.handleBounds)==null?void 0:v.source)??[],...((c=y.internals.handleBounds)==null?void 0:c.target)??[]],l=(i?a==null?void 0:a.find(m=>m.id===i):a==null?void 0:a[0])??null;return l&&S?{...l,...Ln(y,l,l.position,!0)}:l}function gg(e,r){return e||(r!=null&&r.classList.contains("target")?"target":r!=null&&r.classList.contains("source")?"source":null)}function fC(e,r){let i=null;return r?i=!0:e&&!r&&(i=!1),i}const mg=()=>!0;function pC(e,{connectionMode:r,connectionRadius:i,handleId:o,nodeId:h,edgeUpdaterType:S,isTarget:y,domNode:a,nodeLookup:l,lib:_,autoPanOnConnect:v,flowId:c,panBy:m,cancelConnection:C,onConnectStart:b,onConnect:x,onConnectEnd:f,isValidConnection:p=mg,onReconnectEnd:d,updateConnection:u,getTransform:w,getFromHandle:L,autoPanSpeed:R,dragThreshold:D=1,handleDomNode:k}){const M=ig(e.target);let W=0,z;const{x:j,y:N}=er(e),I=gg(S,k),q=a==null?void 0:a.getBoundingClientRect();let U=!1;if(!q||!I)return;const K=_g(h,I,o,l,r);if(!K)return;let V=er(e,q),T=!1,B=null,P=!1,F=null;function G(){if(!v||!q)return;const[ce,le]=eg(V,q,R);m({x:ce,y:le}),W=requestAnimationFrame(G)}const Z={...K,nodeId:h,type:I,position:K.position},ie=l.get(h);let X={inProgress:!0,isValid:null,from:Ln(ie,Z,xe.Left,!0),fromHandle:Z,fromPosition:Z.position,fromNode:ie,to:V,toHandle:null,toPosition:cp[Z.position],toNode:null,pointer:V};function H(){U=!0,u(X),b==null||b(e,{nodeId:h,handleId:o,handleType:I})}D===0&&H();function re(ce){if(!U){const{x:ge,y:Re}=er(ce),Ie=ge-j,ze=Re-N;if(!(Ie*Ie+ze*ze>D*D))return;H()}if(!L()||!Z){te(ce);return}const le=w();V=er(ce,q),z=dC(Ms(V,le,!1,[1,1]),i,l,Z),T||(G(),T=!0);const pe=vg(ce,{handle:z,connectionMode:r,fromNodeId:h,fromHandleId:o,fromType:y?"target":"source",isValidConnection:p,doc:M,lib:_,flowId:c,nodeLookup:l});F=pe.handleDomNode,B=pe.connection,P=fC(!!z,pe.isValid);const Se=l.get(h),be=Se?Ln(Se,Z,xe.Left,!0):X.from,ue={...X,from:be,isValid:P,to:pe.toHandle&&P?Da({x:pe.toHandle.x,y:pe.toHandle.y},le):V,toHandle:pe.toHandle,toPosition:P&&pe.toHandle?pe.toHandle.position:cp[Z.position],toNode:pe.toHandle?l.get(pe.toHandle.nodeId):null,pointer:V};u(ue),X=ue}function te(ce){if(!("touches"in ce&&ce.touches.length>0)){if(U){(z||F)&&B&&P&&(x==null||x(B));const{inProgress:le,...pe}=X,Se={...pe,toPosition:X.toHandle?X.toPosition:null};f==null||f(ce,Se),S&&(d==null||d(ce,Se))}C(),cancelAnimationFrame(W),T=!1,P=!1,B=null,F=null,M.removeEventListener("mousemove",re),M.removeEventListener("mouseup",te),M.removeEventListener("touchmove",re),M.removeEventListener("touchend",te)}}M.addEventListener("mousemove",re),M.addEventListener("mouseup",te),M.addEventListener("touchmove",re),M.addEventListener("touchend",te)}function vg(e,{handle:r,connectionMode:i,fromNodeId:o,fromHandleId:h,fromType:S,doc:y,lib:a,flowId:l,isValidConnection:_=mg,nodeLookup:v}){const c=S==="target",m=r?y.querySelector(`.${a}-flow__handle[data-id="${l}-${r==null?void 0:r.nodeId}-${r==null?void 0:r.id}-${r==null?void 0:r.type}"]`):null,{x:C,y:b}=er(e),x=y.elementFromPoint(C,b),f=x!=null&&x.classList.contains(`${a}-flow__handle`)?x:m,p={handleDomNode:f,isValid:!1,connection:null,toHandle:null};if(f){const d=gg(void 0,f),u=f.getAttribute("data-nodeid"),w=f.getAttribute("data-handleid"),L=f.classList.contains("connectable"),R=f.classList.contains("connectableend");if(!u||!d)return p;const D={source:c?u:o,sourceHandle:c?w:h,target:c?o:u,targetHandle:c?h:w};p.connection=D;const M=L&&R&&(i===hi.Strict?c&&d==="source"||!c&&d==="target":u!==o||w!==h);p.isValid=M&&_(D),p.toHandle=_g(u,d,w,v,i,!0)}return p}const Au={onPointerDown:pC,isValid:vg};function _C({domNode:e,panZoom:r,getTransform:i,getViewScale:o}){const h=Nt(e);function S({translateExtent:a,width:l,height:_,zoomStep:v=1,pannable:c=!0,zoomable:m=!0,inversePan:C=!1}){const b=u=>{if(u.sourceEvent.type!=="wheel"||!r)return;const w=i(),L=u.sourceEvent.ctrlKey&&bs()?10:1,R=-u.sourceEvent.deltaY*(u.sourceEvent.deltaMode===1?.05:u.sourceEvent.deltaMode?1:.002)*v,D=w[2]*Math.pow(2,R*L);r.scaleTo(D)};let x=[0,0];const f=u=>{(u.sourceEvent.type==="mousedown"||u.sourceEvent.type==="touchstart")&&(x=[u.sourceEvent.clientX??u.sourceEvent.touches[0].clientX,u.sourceEvent.clientY??u.sourceEvent.touches[0].clientY])},p=u=>{const w=i();if(u.sourceEvent.type!=="mousemove"&&u.sourceEvent.type!=="touchmove"||!r)return;const L=[u.sourceEvent.clientX??u.sourceEvent.touches[0].clientX,u.sourceEvent.clientY??u.sourceEvent.touches[0].clientY],R=[L[0]-x[0],L[1]-x[1]];x=L;const D=o()*Math.max(w[2],Math.log(w[2]))*(C?-1:1),k={x:w[0]-R[0]*D,y:w[1]-R[1]*D},M=[[0,0],[l,_]];r.setViewportConstrained({x:k.x,y:k.y,zoom:w[2]},M,a)},d=q_().on("start",f).on("zoom",c?p:null).on("zoom.wheel",m?b:null);h.call(d,{})}function y(){h.on("zoom",null)}return{update:S,destroy:y,pointer:Qt}}const $a=e=>({x:e.x,y:e.y,zoom:e.k}),Qc=({x:e,y:r,zoom:i})=>Fa.translate(e,r).scale(i),si=(e,r)=>e.target.closest(`.${r}`),yg=(e,r)=>r===2&&Array.isArray(e)&&e.includes(2),gC=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Jc=(e,r=0,i=gC,o=()=>{})=>{const h=typeof r=="number"&&r>0;return h||o(),h?e.transition().duration(r).ease(i).on("end",o):e},wg=e=>{const r=e.ctrlKey&&bs()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*r};function mC({zoomPanValues:e,noWheelClassName:r,d3Selection:i,d3Zoom:o,panOnScrollMode:h,panOnScrollSpeed:S,zoomOnPinch:y,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:_}){return v=>{if(si(v,r))return v.ctrlKey&&v.preventDefault(),!1;v.preventDefault(),v.stopImmediatePropagation();const c=i.property("__zoom").k||1;if(v.ctrlKey&&y){const f=Qt(v),p=wg(v),d=c*Math.pow(2,p);o.scaleTo(i,d,f,v);return}const m=v.deltaMode===1?20:1;let C=h===xn.Vertical?0:v.deltaX*m,b=h===xn.Horizontal?0:v.deltaY*m;!bs()&&v.shiftKey&&h!==xn.Vertical&&(C=v.deltaY*m,b=0),o.translateBy(i,-(C/c)*S,-(b/c)*S,{internal:!0});const x=$a(i.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l==null||l(v,x),e.panScrollTimeout=setTimeout(()=>{_==null||_(v,x),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a==null||a(v,x))}}function vC({noWheelClassName:e,preventScrolling:r,d3ZoomHandler:i}){return function(o,h){const S=o.type==="wheel",y=!r&&S&&!o.ctrlKey,a=si(o,e);if(o.ctrlKey&&S&&a&&o.preventDefault(),y||a)return null;o.preventDefault(),i.call(this,o,h)}}function yC({zoomPanValues:e,onDraggingChange:r,onPanZoomStart:i}){return o=>{var S,y,a;if((S=o.sourceEvent)!=null&&S.internal)return;const h=$a(o.transform);e.mouseButton=((y=o.sourceEvent)==null?void 0:y.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=h,((a=o.sourceEvent)==null?void 0:a.type)==="mousedown"&&r(!0),i&&(i==null||i(o.sourceEvent,h))}}function wC({zoomPanValues:e,panOnDrag:r,onPaneContextMenu:i,onTransformChange:o,onPanZoom:h}){return S=>{var y,a;e.usedRightMouseButton=!!(i&&yg(r,e.mouseButton??0)),(y=S.sourceEvent)!=null&&y.sync||o([S.transform.x,S.transform.y,S.transform.k]),h&&!((a=S.sourceEvent)!=null&&a.internal)&&(h==null||h(S.sourceEvent,$a(S.transform)))}}function SC({zoomPanValues:e,panOnDrag:r,panOnScroll:i,onDraggingChange:o,onPanZoomEnd:h,onPaneContextMenu:S}){return y=>{var a;if(!((a=y.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,S&&yg(r,e.mouseButton??0)&&!e.usedRightMouseButton&&y.sourceEvent&&S(y.sourceEvent),e.usedRightMouseButton=!1,o(!1),h)){const l=$a(y.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{h==null||h(y.sourceEvent,l)},i?150:0)}}}function CC({zoomActivationKeyPressed:e,zoomOnScroll:r,zoomOnPinch:i,panOnDrag:o,panOnScroll:h,zoomOnDoubleClick:S,userSelectionActive:y,noWheelClassName:a,noPanClassName:l,lib:_,connectionInProgress:v}){return c=>{var f;const m=e||r,C=i&&c.ctrlKey,b=c.type==="wheel";if(c.button===1&&c.type==="mousedown"&&(si(c,`${_}-flow__node`)||si(c,`${_}-flow__edge`)))return!0;if(!o&&!m&&!h&&!S&&!i||y||v&&!b||si(c,a)&&b||si(c,l)&&(!b||h&&b&&!e)||!i&&c.ctrlKey&&b)return!1;if(!i&&c.type==="touchstart"&&((f=c.touches)==null?void 0:f.length)>1)return c.preventDefault(),!1;if(!m&&!h&&!C&&b||!o&&(c.type==="mousedown"||c.type==="touchstart")||Array.isArray(o)&&!o.includes(c.button)&&c.type==="mousedown")return!1;const x=Array.isArray(o)&&o.includes(c.button)||!c.button||c.button<=1;return(!c.ctrlKey||b)&&x}}function xC({domNode:e,minZoom:r,maxZoom:i,translateExtent:o,viewport:h,onPanZoom:S,onPanZoomStart:y,onPanZoomEnd:a,onDraggingChange:l}){const _={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},v=e.getBoundingClientRect(),c=q_().scaleExtent([r,i]).translateExtent(o),m=Nt(e).call(c);d({x:h.x,y:h.y,zoom:di(h.zoom,r,i)},[[0,0],[v.width,v.height]],o);const C=m.on("wheel.zoom"),b=m.on("dblclick.zoom");c.wheelDelta(wg);function x(z,j){return m?new Promise(N=>{c==null||c.interpolate((j==null?void 0:j.interpolate)==="linear"?_s:pa).transform(Jc(m,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>N(!0)),z)}):Promise.resolve(!1)}function f({noWheelClassName:z,noPanClassName:j,onPaneContextMenu:N,userSelectionActive:I,panOnScroll:q,panOnDrag:U,panOnScrollMode:K,panOnScrollSpeed:V,preventScrolling:T,zoomOnPinch:B,zoomOnScroll:P,zoomOnDoubleClick:F,zoomActivationKeyPressed:G,lib:Z,onTransformChange:ie,connectionInProgress:ae,paneClickDistance:X,selectionOnDrag:H}){I&&!_.isZoomingOrPanning&&p();const re=q&&!G&&!I;c.clickDistance(H?1/0:!Zt(X)||X<0?0:X);const te=re?mC({zoomPanValues:_,noWheelClassName:z,d3Selection:m,d3Zoom:c,panOnScrollMode:K,panOnScrollSpeed:V,zoomOnPinch:B,onPanZoomStart:y,onPanZoom:S,onPanZoomEnd:a}):vC({noWheelClassName:z,preventScrolling:T,d3ZoomHandler:C});if(m.on("wheel.zoom",te,{passive:!1}),!I){const le=yC({zoomPanValues:_,onDraggingChange:l,onPanZoomStart:y});c.on("start",le);const pe=wC({zoomPanValues:_,panOnDrag:U,onPaneContextMenu:!!N,onPanZoom:S,onTransformChange:ie});c.on("zoom",pe);const Se=SC({zoomPanValues:_,panOnDrag:U,panOnScroll:q,onPaneContextMenu:N,onPanZoomEnd:a,onDraggingChange:l});c.on("end",Se)}const ce=CC({zoomActivationKeyPressed:G,panOnDrag:U,zoomOnScroll:P,panOnScroll:q,zoomOnDoubleClick:F,zoomOnPinch:B,userSelectionActive:I,noPanClassName:j,noWheelClassName:z,lib:Z,connectionInProgress:ae});c.filter(ce),F?m.on("dblclick.zoom",b):m.on("dblclick.zoom",null)}function p(){c.on("zoom",null)}async function d(z,j,N){const I=Qc(z),q=c==null?void 0:c.constrain()(I,j,N);return q&&await x(q),new Promise(U=>U(q))}async function u(z,j){const N=Qc(z);return await x(N,j),new Promise(I=>I(N))}function w(z){if(m){const j=Qc(z),N=m.property("__zoom");(N.k!==z.zoom||N.x!==z.x||N.y!==z.y)&&(c==null||c.transform(m,j,null,{sync:!0}))}}function L(){const z=m?V_(m.node()):{x:0,y:0,k:1};return{x:z.x,y:z.y,zoom:z.k}}function R(z,j){return m?new Promise(N=>{c==null||c.interpolate((j==null?void 0:j.interpolate)==="linear"?_s:pa).scaleTo(Jc(m,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>N(!0)),z)}):Promise.resolve(!1)}function D(z,j){return m?new Promise(N=>{c==null||c.interpolate((j==null?void 0:j.interpolate)==="linear"?_s:pa).scaleBy(Jc(m,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>N(!0)),z)}):Promise.resolve(!1)}function k(z){c==null||c.scaleExtent(z)}function M(z){c==null||c.translateExtent(z)}function W(z){const j=!Zt(z)||z<0?0:z;c==null||c.clickDistance(j)}return{update:f,destroy:p,setViewport:u,setViewportConstrained:d,getViewport:L,scaleTo:R,scaleBy:D,setScaleExtent:k,setTranslateExtent:M,syncViewport:w,setClickDistance:W}}var _i;(function(e){e.Line="line",e.Handle="handle"})(_i||(_i={}));function bC({width:e,prevWidth:r,height:i,prevHeight:o,affectsX:h,affectsY:S}){const y=e-r,a=i-o,l=[y>0?1:y<0?-1:0,a>0?1:a<0?-1:0];return y&&h&&(l[0]=l[0]*-1),a&&S&&(l[1]=l[1]*-1),l}function Cp(e){const r=e.includes("right")||e.includes("left"),i=e.includes("bottom")||e.includes("top"),o=e.includes("left"),h=e.includes("top");return{isHorizontal:r,isVertical:i,affectsX:o,affectsY:h}}function Gr(e,r){return Math.max(0,r-e)}function Qr(e,r){return Math.max(0,e-r)}function sa(e,r,i){return Math.max(0,r-e,e-i)}function xp(e,r){return e?!r:r}function EC(e,r,i,o,h,S,y,a){let{affectsX:l,affectsY:_}=r;const{isHorizontal:v,isVertical:c}=r,m=v&&c,{xSnapped:C,ySnapped:b}=i,{minWidth:x,maxWidth:f,minHeight:p,maxHeight:d}=o,{x:u,y:w,width:L,height:R,aspectRatio:D}=e;let k=Math.floor(v?C-e.pointerX:0),M=Math.floor(c?b-e.pointerY:0);const W=L+(l?-k:k),z=R+(_?-M:M),j=-S[0]*L,N=-S[1]*R;let I=sa(W,x,f),q=sa(z,p,d);if(y){let V=0,T=0;l&&k<0?V=Gr(u+k+j,y[0][0]):!l&&k>0&&(V=Qr(u+W+j,y[1][0])),_&&M<0?T=Gr(w+M+N,y[0][1]):!_&&M>0&&(T=Qr(w+z+N,y[1][1])),I=Math.max(I,V),q=Math.max(q,T)}if(a){let V=0,T=0;l&&k>0?V=Qr(u+k,a[0][0]):!l&&k<0&&(V=Gr(u+W,a[1][0])),_&&M>0?T=Qr(w+M,a[0][1]):!_&&M<0&&(T=Gr(w+z,a[1][1])),I=Math.max(I,V),q=Math.max(q,T)}if(h){if(v){const V=sa(W/D,p,d)*D;if(I=Math.max(I,V),y){let T=0;!l&&!_||l&&!_&&m?T=Qr(w+N+W/D,y[1][1])*D:T=Gr(w+N+(l?k:-k)/D,y[0][1])*D,I=Math.max(I,T)}if(a){let T=0;!l&&!_||l&&!_&&m?T=Gr(w+W/D,a[1][1])*D:T=Qr(w+(l?k:-k)/D,a[0][1])*D,I=Math.max(I,T)}}if(c){const V=sa(z*D,x,f)/D;if(q=Math.max(q,V),y){let T=0;!l&&!_||_&&!l&&m?T=Qr(u+z*D+j,y[1][0])/D:T=Gr(u+(_?M:-M)*D+j,y[0][0])/D,q=Math.max(q,T)}if(a){let T=0;!l&&!_||_&&!l&&m?T=Gr(u+z*D,a[1][0])/D:T=Qr(u+(_?M:-M)*D,a[0][0])/D,q=Math.max(q,T)}}}M=M+(M<0?q:-q),k=k+(k<0?I:-I),h&&(m?W>z*D?M=(xp(l,_)?-k:k)/D:k=(xp(l,_)?-M:M)*D:v?(M=k/D,_=l):(k=M*D,l=_));const U=l?u+k:u,K=_?w+M:w;return{width:L+(l?-k:k),height:R+(_?-M:M),x:S[0]*k*(l?-1:1)+U,y:S[1]*M*(_?-1:1)+K}}const Sg={width:0,height:0,x:0,y:0},kC={...Sg,pointerX:0,pointerY:0,aspectRatio:1};function LC(e){return[[0,0],[e.measured.width,e.measured.height]]}function RC(e,r,i){const o=r.position.x+e.position.x,h=r.position.y+e.position.y,S=e.measured.width??0,y=e.measured.height??0,a=i[0]*S,l=i[1]*y;return[[o-a,h-l],[o+S-a,h+y-l]]}function DC({domNode:e,nodeId:r,getStoreItems:i,onChange:o,onEnd:h}){const S=Nt(e);let y={controlDirection:Cp("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:_,boundaries:v,keepAspectRatio:c,resizeDirection:m,onResizeStart:C,onResize:b,onResizeEnd:x,shouldResize:f}){let p={...Sg},d={...kC};y={boundaries:v,resizeDirection:m,keepAspectRatio:c,controlDirection:Cp(_)};let u,w=null,L=[],R,D,k,M=!1;const W=T_().on("start",z=>{const{nodeLookup:j,transform:N,snapGrid:I,snapToGrid:q,nodeOrigin:U,paneDomNode:K}=i();if(u=j.get(r),!u)return;w=(K==null?void 0:K.getBoundingClientRect())??null;const{xSnapped:V,ySnapped:T}=gs(z.sourceEvent,{transform:N,snapGrid:I,snapToGrid:q,containerBounds:w});p={width:u.measured.width??0,height:u.measured.height??0,x:u.position.x??0,y:u.position.y??0},d={...p,pointerX:V,pointerY:T,aspectRatio:p.width/p.height},R=void 0,u.parentId&&(u.extent==="parent"||u.expandParent)&&(R=j.get(u.parentId),D=R&&u.extent==="parent"?LC(R):void 0),L=[],k=void 0;for(const[B,P]of j)if(P.parentId===r&&(L.push({id:B,position:{...P.position},extent:P.extent}),P.extent==="parent"||P.expandParent)){const F=RC(P,u,P.origin??U);k?k=[[Math.min(F[0][0],k[0][0]),Math.min(F[0][1],k[0][1])],[Math.max(F[1][0],k[1][0]),Math.max(F[1][1],k[1][1])]]:k=F}C==null||C(z,{...p})}).on("drag",z=>{const{transform:j,snapGrid:N,snapToGrid:I,nodeOrigin:q}=i(),U=gs(z.sourceEvent,{transform:j,snapGrid:N,snapToGrid:I,containerBounds:w}),K=[];if(!u)return;const{x:V,y:T,width:B,height:P}=p,F={},G=u.origin??q,{width:Z,height:ie,x:ae,y:X}=EC(d,y.controlDirection,U,y.boundaries,y.keepAspectRatio,G,D,k),H=Z!==B,re=ie!==P,te=ae!==V&&H,ce=X!==T&&re;if(!te&&!ce&&!H&&!re)return;if((te||ce||G[0]===1||G[1]===1)&&(F.x=te?ae:p.x,F.y=ce?X:p.y,p.x=F.x,p.y=F.y,L.length>0)){const be=ae-V,ue=X-T;for(const ge of L)ge.position={x:ge.position.x-be+G[0]*(Z-B),y:ge.position.y-ue+G[1]*(ie-P)},K.push(ge)}if((H||re)&&(F.width=H&&(!y.resizeDirection||y.resizeDirection==="horizontal")?Z:p.width,F.height=re&&(!y.resizeDirection||y.resizeDirection==="vertical")?ie:p.height,p.width=F.width,p.height=F.height),R&&u.expandParent){const be=G[0]*(F.width??0);F.x&&F.x<be&&(p.x=be,d.x=d.x-(F.x-be));const ue=G[1]*(F.height??0);F.y&&F.y<ue&&(p.y=ue,d.y=d.y-(F.y-ue))}const le=bC({width:p.width,prevWidth:B,height:p.height,prevHeight:P,affectsX:y.controlDirection.affectsX,affectsY:y.controlDirection.affectsY}),pe={...p,direction:le};(f==null?void 0:f(z,pe))!==!1&&(M=!0,b==null||b(z,pe),o(F,K))}).on("end",z=>{M&&(x==null||x(z,{...p}),h==null||h({...p}),M=!1)});S.call(W)}function l(){S.on(".drag",null)}return{update:a,destroy:l}}var Zc={exports:{}},eu={},tu={exports:{}},ru={};/**
40
+ `+A.stack}return{value:t,source:n,stack:E,digest:null}}function lc(t,n,s){return{value:t,source:null,stack:s??null,digest:n??null}}function cc(t,n){try{console.error(n.value)}catch(s){setTimeout(function(){throw s})}}var S0=typeof WeakMap=="function"?WeakMap:Map;function jd(t,n,s){s=wr(-1,s),s.tag=3,s.payload={element:null};var g=n.value;return s.callback=function(){Io||(Io=!0,bc=g),cc(t,n)},s}function zd(t,n,s){s=wr(-1,s),s.tag=3;var g=t.type.getDerivedStateFromError;if(typeof g=="function"){var E=n.value;s.payload=function(){return g(E)},s.callback=function(){cc(t,n)}}var A=t.stateNode;return A!==null&&typeof A.componentDidCatch=="function"&&(s.callback=function(){cc(t,n),typeof g!="function"&&(Ur===null?Ur=new Set([this]):Ur.add(this));var $=n.stack;this.componentDidCatch(n.value,{componentStack:$!==null?$:""})}),s}function $d(t,n,s){var g=t.pingCache;if(g===null){g=t.pingCache=new S0;var E=new Set;g.set(n,E)}else E=g.get(n),E===void 0&&(E=new Set,g.set(n,E));E.has(s)||(E.add(s),t=B0.bind(null,t,n,s),n.then(t,t))}function Wd(t){do{var n;if((n=t.tag===13)&&(n=t.memoizedState,n=n!==null?n.dehydrated!==null:!0),n)return t;t=t.return}while(t!==null);return null}function Ud(t,n,s,g,E){return(t.mode&1)===0?(t===n?t.flags|=65536:(t.flags|=128,s.flags|=131072,s.flags&=-52805,s.tag===1&&(s.alternate===null?s.tag=17:(n=wr(-1,1),n.tag=2,$r(s,n,1))),s.lanes|=1),t):(t.flags|=65536,t.lanes=E,t)}var C0=w.ReactCurrentOwner,xt=!1;function yt(t,n,s,g){n.child=t===null?ud(n,null,s,g):Yn(n,t.child,s,g)}function Vd(t,n,s,g,E){s=s.render;var A=n.ref;return Qn(n,E),g=ec(t,n,s,g,A,E),s=tc(),t!==null&&!xt?(n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~E,Sr(t,n,E)):(We&&s&&Ol(n),n.flags|=1,yt(t,n,g,E),n.child)}function qd(t,n,s,g,E){if(t===null){var A=s.type;return typeof A=="function"&&!Tc(A)&&A.defaultProps===void 0&&s.compare===null&&s.defaultProps===void 0?(n.tag=15,n.type=A,Kd(t,n,A,g,E)):(t=$o(s.type,null,g,n,n.mode,E),t.ref=n.ref,t.return=n,n.child=t)}if(A=t.child,(t.lanes&E)===0){var $=A.memoizedProps;if(s=s.compare,s=s!==null?s:zi,s($,g)&&t.ref===n.ref)return Sr(t,n,E)}return n.flags|=1,t=Xr(A,g),t.ref=n.ref,t.return=n,n.child=t}function Kd(t,n,s,g,E){if(t!==null){var A=t.memoizedProps;if(zi(A,g)&&t.ref===n.ref)if(xt=!1,n.pendingProps=g=A,(t.lanes&E)!==0)(t.flags&131072)!==0&&(xt=!0);else return n.lanes=t.lanes,Sr(t,n,E)}return uc(t,n,s,g,E)}function Xd(t,n,s){var g=n.pendingProps,E=g.children,A=t!==null?t.memoizedState:null;if(g.mode==="hidden")if((n.mode&1)===0)n.memoizedState={baseLanes:0,cachePool:null,transitions:null},He(ti,Pt),Pt|=s;else{if((s&1073741824)===0)return t=A!==null?A.baseLanes|s:s,n.lanes=n.childLanes=1073741824,n.memoizedState={baseLanes:t,cachePool:null,transitions:null},n.updateQueue=null,He(ti,Pt),Pt|=t,null;n.memoizedState={baseLanes:0,cachePool:null,transitions:null},g=A!==null?A.baseLanes:s,He(ti,Pt),Pt|=g}else A!==null?(g=A.baseLanes|s,n.memoizedState=null):g=s,He(ti,Pt),Pt|=g;return yt(t,n,E,s),n.child}function Yd(t,n){var s=n.ref;(t===null&&s!==null||t!==null&&t.ref!==s)&&(n.flags|=512,n.flags|=2097152)}function uc(t,n,s,g,E){var A=Ct(s)?cn:_t.current;return A=Vn(n,A),Qn(n,E),s=ec(t,n,s,g,A,E),g=tc(),t!==null&&!xt?(n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~E,Sr(t,n,E)):(We&&g&&Ol(n),n.flags|=1,yt(t,n,s,E),n.child)}function Gd(t,n,s,g,E){if(Ct(s)){var A=!0;fo(n)}else A=!1;if(Qn(n,E),n.stateNode===null)To(t,n),Hd(n,s,g),ac(n,s,g,E),g=!0;else if(t===null){var $=n.stateNode,G=n.memoizedProps;$.props=G;var Q=$.context,oe=s.contextType;typeof oe=="object"&&oe!==null?oe=Ft(oe):(oe=Ct(s)?cn:_t.current,oe=Vn(n,oe));var de=s.getDerivedStateFromProps,fe=typeof de=="function"||typeof $.getSnapshotBeforeUpdate=="function";fe||typeof $.UNSAFE_componentWillReceiveProps!="function"&&typeof $.componentWillReceiveProps!="function"||(G!==g||Q!==oe)&&Fd(n,$,g,oe),zr=!1;var he=n.memoizedState;$.state=he,Co(n,g,$,E),Q=n.memoizedState,G!==g||he!==Q||St.current||zr?(typeof de=="function"&&(oc(n,s,de,g),Q=n.memoizedState),(G=zr||Od(n,s,G,g,he,Q,oe))?(fe||typeof $.UNSAFE_componentWillMount!="function"&&typeof $.componentWillMount!="function"||(typeof $.componentWillMount=="function"&&$.componentWillMount(),typeof $.UNSAFE_componentWillMount=="function"&&$.UNSAFE_componentWillMount()),typeof $.componentDidMount=="function"&&(n.flags|=4194308)):(typeof $.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=g,n.memoizedState=Q),$.props=g,$.state=Q,$.context=oe,g=G):(typeof $.componentDidMount=="function"&&(n.flags|=4194308),g=!1)}else{$=n.stateNode,dd(t,n),G=n.memoizedProps,oe=n.type===n.elementType?G:qt(n.type,G),$.props=oe,fe=n.pendingProps,he=$.context,Q=s.contextType,typeof Q=="object"&&Q!==null?Q=Ft(Q):(Q=Ct(s)?cn:_t.current,Q=Vn(n,Q));var me=s.getDerivedStateFromProps;(de=typeof me=="function"||typeof $.getSnapshotBeforeUpdate=="function")||typeof $.UNSAFE_componentWillReceiveProps!="function"&&typeof $.componentWillReceiveProps!="function"||(G!==fe||he!==Q)&&Fd(n,$,g,Q),zr=!1,he=n.memoizedState,$.state=he,Co(n,g,$,E);var ye=n.memoizedState;G!==fe||he!==ye||St.current||zr?(typeof me=="function"&&(oc(n,s,me,g),ye=n.memoizedState),(oe=zr||Od(n,s,oe,g,he,ye,Q)||!1)?(de||typeof $.UNSAFE_componentWillUpdate!="function"&&typeof $.componentWillUpdate!="function"||(typeof $.componentWillUpdate=="function"&&$.componentWillUpdate(g,ye,Q),typeof $.UNSAFE_componentWillUpdate=="function"&&$.UNSAFE_componentWillUpdate(g,ye,Q)),typeof $.componentDidUpdate=="function"&&(n.flags|=4),typeof $.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof $.componentDidUpdate!="function"||G===t.memoizedProps&&he===t.memoizedState||(n.flags|=4),typeof $.getSnapshotBeforeUpdate!="function"||G===t.memoizedProps&&he===t.memoizedState||(n.flags|=1024),n.memoizedProps=g,n.memoizedState=ye),$.props=g,$.state=ye,$.context=Q,g=oe):(typeof $.componentDidUpdate!="function"||G===t.memoizedProps&&he===t.memoizedState||(n.flags|=4),typeof $.getSnapshotBeforeUpdate!="function"||G===t.memoizedProps&&he===t.memoizedState||(n.flags|=1024),g=!1)}return hc(t,n,s,g,A,E)}function hc(t,n,s,g,E,A){Yd(t,n);var $=(n.flags&128)!==0;if(!g&&!$)return E&&td(n,s,!1),Sr(t,n,A);g=n.stateNode,C0.current=n;var G=$&&typeof s.getDerivedStateFromError!="function"?null:g.render();return n.flags|=1,t!==null&&$?(n.child=Yn(n,t.child,null,A),n.child=Yn(n,null,G,A)):yt(t,n,G,A),n.memoizedState=g.state,E&&td(n,s,!0),n.child}function Qd(t){var n=t.stateNode;n.pendingContext?Zh(t,n.pendingContext,n.pendingContext!==n.context):n.context&&Zh(t,n.context,!1),Xl(t,n.containerInfo)}function Jd(t,n,s,g,E){return Xn(),zl(E),n.flags|=256,yt(t,n,s,g),n.child}var dc={dehydrated:null,treeContext:null,retryLane:0};function fc(t){return{baseLanes:t,cachePool:null,transitions:null}}function Zd(t,n,s){var g=n.pendingProps,E=Xe.current,A=!1,$=(n.flags&128)!==0,G;if((G=$)||(G=t!==null&&t.memoizedState===null?!1:(E&2)!==0),G?(A=!0,n.flags&=-129):(t===null||t.memoizedState!==null)&&(E|=1),He(Xe,E&1),t===null)return jl(n),t=n.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?((n.mode&1)===0?n.lanes=1:t.data==="$!"?n.lanes=8:n.lanes=1073741824,null):($=g.children,t=g.fallback,A?(g=n.mode,A=n.child,$={mode:"hidden",children:$},(g&1)===0&&A!==null?(A.childLanes=0,A.pendingProps=$):A=Wo($,g,0,null),t=yn(t,g,s,null),A.return=n,t.return=n,A.sibling=t,n.child=A,n.child.memoizedState=fc(s),n.memoizedState=dc,t):pc(n,$));if(E=t.memoizedState,E!==null&&(G=E.dehydrated,G!==null))return x0(t,n,$,g,G,E,s);if(A){A=g.fallback,$=n.mode,E=t.child,G=E.sibling;var Q={mode:"hidden",children:g.children};return($&1)===0&&n.child!==E?(g=n.child,g.childLanes=0,g.pendingProps=Q,n.deletions=null):(g=Xr(E,Q),g.subtreeFlags=E.subtreeFlags&14680064),G!==null?A=Xr(G,A):(A=yn(A,$,s,null),A.flags|=2),A.return=n,g.return=n,g.sibling=A,n.child=g,g=A,A=n.child,$=t.child.memoizedState,$=$===null?fc(s):{baseLanes:$.baseLanes|s,cachePool:null,transitions:$.transitions},A.memoizedState=$,A.childLanes=t.childLanes&~s,n.memoizedState=dc,g}return A=t.child,t=A.sibling,g=Xr(A,{mode:"visible",children:g.children}),(n.mode&1)===0&&(g.lanes=s),g.return=n,g.sibling=null,t!==null&&(s=n.deletions,s===null?(n.deletions=[t],n.flags|=16):s.push(t)),n.child=g,n.memoizedState=null,g}function pc(t,n){return n=Wo({mode:"visible",children:n},t.mode,0,null),n.return=t,t.child=n}function Ao(t,n,s,g){return g!==null&&zl(g),Yn(n,t.child,null,s),t=pc(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function x0(t,n,s,g,E,A,$){if(s)return n.flags&256?(n.flags&=-257,g=lc(Error(i(422))),Ao(t,n,$,g)):n.memoizedState!==null?(n.child=t.child,n.flags|=128,null):(A=g.fallback,E=n.mode,g=Wo({mode:"visible",children:g.children},E,0,null),A=yn(A,E,$,null),A.flags|=2,g.return=n,A.return=n,g.sibling=A,n.child=g,(n.mode&1)!==0&&Yn(n,t.child,null,$),n.child.memoizedState=fc($),n.memoizedState=dc,A);if((n.mode&1)===0)return Ao(t,n,$,null);if(E.data==="$!"){if(g=E.nextSibling&&E.nextSibling.dataset,g)var G=g.dgst;return g=G,A=Error(i(419)),g=lc(A,g,void 0),Ao(t,n,$,g)}if(G=($&t.childLanes)!==0,xt||G){if(g=lt,g!==null){switch($&-$){case 4:E=2;break;case 16:E=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:E=32;break;case 536870912:E=268435456;break;default:E=0}E=(E&(g.suspendedLanes|$))!==0?0:E,E!==0&&E!==A.retryLane&&(A.retryLane=E,yr(t,E),Yt(g,t,E,-1))}return Ac(),g=lc(Error(i(421))),Ao(t,n,$,g)}return E.data==="$?"?(n.flags|=128,n.child=t.child,n=I0.bind(null,t),E._reactRetry=n,null):(t=A.treeContext,Mt=Or(E.nextSibling),Tt=n,We=!0,Vt=null,t!==null&&(Ot[Ht++]=mr,Ot[Ht++]=vr,Ot[Ht++]=un,mr=t.id,vr=t.overflow,un=n),n=pc(n,g.children),n.flags|=4096,n)}function ef(t,n,s){t.lanes|=n;var g=t.alternate;g!==null&&(g.lanes|=n),Vl(t.return,n,s)}function _c(t,n,s,g,E){var A=t.memoizedState;A===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:g,tail:s,tailMode:E}:(A.isBackwards=n,A.rendering=null,A.renderingStartTime=0,A.last=g,A.tail=s,A.tailMode=E)}function tf(t,n,s){var g=n.pendingProps,E=g.revealOrder,A=g.tail;if(yt(t,n,g.children,s),g=Xe.current,(g&2)!==0)g=g&1|2,n.flags|=128;else{if(t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&ef(t,s,n);else if(t.tag===19)ef(t,s,n);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break e;for(;t.sibling===null;){if(t.return===null||t.return===n)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}g&=1}if(He(Xe,g),(n.mode&1)===0)n.memoizedState=null;else switch(E){case"forwards":for(s=n.child,E=null;s!==null;)t=s.alternate,t!==null&&xo(t)===null&&(E=s),s=s.sibling;s=E,s===null?(E=n.child,n.child=null):(E=s.sibling,s.sibling=null),_c(n,!1,E,s,A);break;case"backwards":for(s=null,E=n.child,n.child=null;E!==null;){if(t=E.alternate,t!==null&&xo(t)===null){n.child=E;break}t=E.sibling,E.sibling=s,s=E,E=t}_c(n,!0,s,null,A);break;case"together":_c(n,!1,null,null,void 0);break;default:n.memoizedState=null}return n.child}function To(t,n){(n.mode&1)===0&&t!==null&&(t.alternate=null,n.alternate=null,n.flags|=2)}function Sr(t,n,s){if(t!==null&&(n.dependencies=t.dependencies),_n|=n.lanes,(s&n.childLanes)===0)return null;if(t!==null&&n.child!==t.child)throw Error(i(153));if(n.child!==null){for(t=n.child,s=Xr(t,t.pendingProps),n.child=s,s.return=n;t.sibling!==null;)t=t.sibling,s=s.sibling=Xr(t,t.pendingProps),s.return=n;s.sibling=null}return n.child}function b0(t,n,s){switch(n.tag){case 3:Qd(n),Xn();break;case 5:_d(n);break;case 1:Ct(n.type)&&fo(n);break;case 4:Xl(n,n.stateNode.containerInfo);break;case 10:var g=n.type._context,E=n.memoizedProps.value;He(yo,g._currentValue),g._currentValue=E;break;case 13:if(g=n.memoizedState,g!==null)return g.dehydrated!==null?(He(Xe,Xe.current&1),n.flags|=128,null):(s&n.child.childLanes)!==0?Zd(t,n,s):(He(Xe,Xe.current&1),t=Sr(t,n,s),t!==null?t.sibling:null);He(Xe,Xe.current&1);break;case 19:if(g=(s&n.childLanes)!==0,(t.flags&128)!==0){if(g)return tf(t,n,s);n.flags|=128}if(E=n.memoizedState,E!==null&&(E.rendering=null,E.tail=null,E.lastEffect=null),He(Xe,Xe.current),g)break;return null;case 22:case 23:return n.lanes=0,Xd(t,n,s)}return Sr(t,n,s)}var rf,gc,nf,sf;rf=function(t,n){for(var s=n.child;s!==null;){if(s.tag===5||s.tag===6)t.appendChild(s.stateNode);else if(s.tag!==4&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return;s=s.return}s.sibling.return=s.return,s=s.sibling}},gc=function(){},nf=function(t,n,s,g){var E=t.memoizedProps;if(E!==g){t=n.stateNode,fn(sr.current);var A=null;switch(s){case"input":E=Se(t,E),g=Se(t,g),A=[];break;case"select":E=B({},E,{value:void 0}),g=B({},g,{value:void 0}),A=[];break;case"textarea":E=ut(t,E),g=ut(t,g),A=[];break;default:typeof E.onClick!="function"&&typeof g.onClick=="function"&&(t.onclick=co)}vi(s,g);var $;s=null;for(oe in E)if(!g.hasOwnProperty(oe)&&E.hasOwnProperty(oe)&&E[oe]!=null)if(oe==="style"){var G=E[oe];for($ in G)G.hasOwnProperty($)&&(s||(s={}),s[$]="")}else oe!=="dangerouslySetInnerHTML"&&oe!=="children"&&oe!=="suppressContentEditableWarning"&&oe!=="suppressHydrationWarning"&&oe!=="autoFocus"&&(h.hasOwnProperty(oe)?A||(A=[]):(A=A||[]).push(oe,null));for(oe in g){var Q=g[oe];if(G=E!=null?E[oe]:void 0,g.hasOwnProperty(oe)&&Q!==G&&(Q!=null||G!=null))if(oe==="style")if(G){for($ in G)!G.hasOwnProperty($)||Q&&Q.hasOwnProperty($)||(s||(s={}),s[$]="");for($ in Q)Q.hasOwnProperty($)&&G[$]!==Q[$]&&(s||(s={}),s[$]=Q[$])}else s||(A||(A=[]),A.push(oe,s)),s=Q;else oe==="dangerouslySetInnerHTML"?(Q=Q?Q.__html:void 0,G=G?G.__html:void 0,Q!=null&&G!==Q&&(A=A||[]).push(oe,Q)):oe==="children"?typeof Q!="string"&&typeof Q!="number"||(A=A||[]).push(oe,""+Q):oe!=="suppressContentEditableWarning"&&oe!=="suppressHydrationWarning"&&(h.hasOwnProperty(oe)?(Q!=null&&oe==="onScroll"&&Fe("scroll",t),A||G===Q||(A=[])):(A=A||[]).push(oe,Q))}s&&(A=A||[]).push("style",s);var oe=A;(n.updateQueue=oe)&&(n.flags|=4)}},sf=function(t,n,s,g){s!==g&&(n.flags|=4)};function rs(t,n){if(!We)switch(t.tailMode){case"hidden":n=t.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t.tail=null:s.sibling=null;break;case"collapsed":s=t.tail;for(var g=null;s!==null;)s.alternate!==null&&(g=s),s=s.sibling;g===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:g.sibling=null}}function mt(t){var n=t.alternate!==null&&t.alternate.child===t.child,s=0,g=0;if(n)for(var E=t.child;E!==null;)s|=E.lanes|E.childLanes,g|=E.subtreeFlags&14680064,g|=E.flags&14680064,E.return=t,E=E.sibling;else for(E=t.child;E!==null;)s|=E.lanes|E.childLanes,g|=E.subtreeFlags,g|=E.flags,E.return=t,E=E.sibling;return t.subtreeFlags|=g,t.childLanes=s,n}function E0(t,n,s){var g=n.pendingProps;switch(Hl(n),n.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mt(n),null;case 1:return Ct(n.type)&&ho(),mt(n),null;case 3:return g=n.stateNode,Jn(),je(St),je(_t),Ql(),g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null),(t===null||t.child===null)&&(mo(n)?n.flags|=4:t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Vt!==null&&(Lc(Vt),Vt=null))),gc(t,n),mt(n),null;case 5:Yl(n);var E=fn(Qi.current);if(s=n.type,t!==null&&n.stateNode!=null)nf(t,n,s,g,E),t.ref!==n.ref&&(n.flags|=512,n.flags|=2097152);else{if(!g){if(n.stateNode===null)throw Error(i(166));return mt(n),null}if(t=fn(sr.current),mo(n)){g=n.stateNode,s=n.type;var A=n.memoizedProps;switch(g[ir]=n,g[qi]=A,t=(n.mode&1)!==0,s){case"dialog":Fe("cancel",g),Fe("close",g);break;case"iframe":case"object":case"embed":Fe("load",g);break;case"video":case"audio":for(E=0;E<Wi.length;E++)Fe(Wi[E],g);break;case"source":Fe("error",g);break;case"img":case"image":case"link":Fe("error",g),Fe("load",g);break;case"details":Fe("toggle",g);break;case"input":be(g,A),Fe("invalid",g);break;case"select":g._wrapperState={wasMultiple:!!A.multiple},Fe("invalid",g);break;case"textarea":qe(g,A),Fe("invalid",g)}vi(s,A),E=null;for(var $ in A)if(A.hasOwnProperty($)){var G=A[$];$==="children"?typeof G=="string"?g.textContent!==G&&(A.suppressHydrationWarning!==!0&&lo(g.textContent,G,t),E=["children",G]):typeof G=="number"&&g.textContent!==""+G&&(A.suppressHydrationWarning!==!0&&lo(g.textContent,G,t),E=["children",""+G]):h.hasOwnProperty($)&&G!=null&&$==="onScroll"&&Fe("scroll",g)}switch(s){case"input":ce(g),Re(g,A,!0);break;case"textarea":ce(g),Ne(g);break;case"select":case"option":break;default:typeof A.onClick=="function"&&(g.onclick=co)}g=E,n.updateQueue=g,g!==null&&(n.flags|=4)}else{$=E.nodeType===9?E:E.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=Je(s)),t==="http://www.w3.org/1999/xhtml"?s==="script"?(t=$.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof g.is=="string"?t=$.createElement(s,{is:g.is}):(t=$.createElement(s),s==="select"&&($=t,g.multiple?$.multiple=!0:g.size&&($.size=g.size))):t=$.createElementNS(t,s),t[ir]=n,t[qi]=g,rf(t,n,!1,!1),n.stateNode=t;e:{switch($=yi(s,g),s){case"dialog":Fe("cancel",t),Fe("close",t),E=g;break;case"iframe":case"object":case"embed":Fe("load",t),E=g;break;case"video":case"audio":for(E=0;E<Wi.length;E++)Fe(Wi[E],t);E=g;break;case"source":Fe("error",t),E=g;break;case"img":case"image":case"link":Fe("error",t),Fe("load",t),E=g;break;case"details":Fe("toggle",t),E=g;break;case"input":be(t,g),E=Se(t,g),Fe("invalid",t);break;case"option":E=g;break;case"select":t._wrapperState={wasMultiple:!!g.multiple},E=B({},g,{value:void 0}),Fe("invalid",t);break;case"textarea":qe(t,g),E=ut(t,g),Fe("invalid",t);break;default:E=g}vi(s,E),G=E;for(A in G)if(G.hasOwnProperty(A)){var Q=G[A];A==="style"?Ps(t,Q):A==="dangerouslySetInnerHTML"?(Q=Q?Q.__html:void 0,Q!=null&&pr(t,Q)):A==="children"?typeof Q=="string"?(s!=="textarea"||Q!=="")&&ot(t,Q):typeof Q=="number"&&ot(t,""+Q):A!=="suppressContentEditableWarning"&&A!=="suppressHydrationWarning"&&A!=="autoFocus"&&(h.hasOwnProperty(A)?Q!=null&&A==="onScroll"&&Fe("scroll",t):Q!=null&&u(t,A,Q,$))}switch(s){case"input":ce(t),Re(t,g,!1);break;case"textarea":ce(t),Ne(t);break;case"option":g.value!=null&&t.setAttribute("value",""+H(g.value));break;case"select":t.multiple=!!g.multiple,A=g.value,A!=null?Qe(t,!!g.multiple,A,!1):g.defaultValue!=null&&Qe(t,!!g.multiple,g.defaultValue,!0);break;default:typeof E.onClick=="function"&&(t.onclick=co)}switch(s){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}}g&&(n.flags|=4)}n.ref!==null&&(n.flags|=512,n.flags|=2097152)}return mt(n),null;case 6:if(t&&n.stateNode!=null)sf(t,n,t.memoizedProps,g);else{if(typeof g!="string"&&n.stateNode===null)throw Error(i(166));if(s=fn(Qi.current),fn(sr.current),mo(n)){if(g=n.stateNode,s=n.memoizedProps,g[ir]=n,(A=g.nodeValue!==s)&&(t=Tt,t!==null))switch(t.tag){case 3:lo(g.nodeValue,s,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&lo(g.nodeValue,s,(t.mode&1)!==0)}A&&(n.flags|=4)}else g=(s.nodeType===9?s:s.ownerDocument).createTextNode(g),g[ir]=n,n.stateNode=g}return mt(n),null;case 13:if(je(Xe),g=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(We&&Mt!==null&&(n.mode&1)!==0&&(n.flags&128)===0)ad(),Xn(),n.flags|=98560,A=!1;else if(A=mo(n),g!==null&&g.dehydrated!==null){if(t===null){if(!A)throw Error(i(318));if(A=n.memoizedState,A=A!==null?A.dehydrated:null,!A)throw Error(i(317));A[ir]=n}else Xn(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;mt(n),A=!1}else Vt!==null&&(Lc(Vt),Vt=null),A=!0;if(!A)return n.flags&65536?n:null}return(n.flags&128)!==0?(n.lanes=s,n):(g=g!==null,g!==(t!==null&&t.memoizedState!==null)&&g&&(n.child.flags|=8192,(n.mode&1)!==0&&(t===null||(Xe.current&1)!==0?it===0&&(it=3):Ac())),n.updateQueue!==null&&(n.flags|=4),mt(n),null);case 4:return Jn(),gc(t,n),t===null&&Ui(n.stateNode.containerInfo),mt(n),null;case 10:return Ul(n.type._context),mt(n),null;case 17:return Ct(n.type)&&ho(),mt(n),null;case 19:if(je(Xe),A=n.memoizedState,A===null)return mt(n),null;if(g=(n.flags&128)!==0,$=A.rendering,$===null)if(g)rs(A,!1);else{if(it!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if($=xo(t),$!==null){for(n.flags|=128,rs(A,!1),g=$.updateQueue,g!==null&&(n.updateQueue=g,n.flags|=4),n.subtreeFlags=0,g=s,s=n.child;s!==null;)A=s,t=g,A.flags&=14680066,$=A.alternate,$===null?(A.childLanes=0,A.lanes=t,A.child=null,A.subtreeFlags=0,A.memoizedProps=null,A.memoizedState=null,A.updateQueue=null,A.dependencies=null,A.stateNode=null):(A.childLanes=$.childLanes,A.lanes=$.lanes,A.child=$.child,A.subtreeFlags=0,A.deletions=null,A.memoizedProps=$.memoizedProps,A.memoizedState=$.memoizedState,A.updateQueue=$.updateQueue,A.type=$.type,t=$.dependencies,A.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),s=s.sibling;return He(Xe,Xe.current&1|2),n.child}t=t.sibling}A.tail!==null&&Ke()>ri&&(n.flags|=128,g=!0,rs(A,!1),n.lanes=4194304)}else{if(!g)if(t=xo($),t!==null){if(n.flags|=128,g=!0,s=t.updateQueue,s!==null&&(n.updateQueue=s,n.flags|=4),rs(A,!0),A.tail===null&&A.tailMode==="hidden"&&!$.alternate&&!We)return mt(n),null}else 2*Ke()-A.renderingStartTime>ri&&s!==1073741824&&(n.flags|=128,g=!0,rs(A,!1),n.lanes=4194304);A.isBackwards?($.sibling=n.child,n.child=$):(s=A.last,s!==null?s.sibling=$:n.child=$,A.last=$)}return A.tail!==null?(n=A.tail,A.rendering=n,A.tail=n.sibling,A.renderingStartTime=Ke(),n.sibling=null,s=Xe.current,He(Xe,g?s&1|2:s&1),n):(mt(n),null);case 22:case 23:return Dc(),g=n.memoizedState!==null,t!==null&&t.memoizedState!==null!==g&&(n.flags|=8192),g&&(n.mode&1)!==0?(Pt&1073741824)!==0&&(mt(n),n.subtreeFlags&6&&(n.flags|=8192)):mt(n),null;case 24:return null;case 25:return null}throw Error(i(156,n.tag))}function k0(t,n){switch(Hl(n),n.tag){case 1:return Ct(n.type)&&ho(),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return Jn(),je(St),je(_t),Ql(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 5:return Yl(n),null;case 13:if(je(Xe),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(i(340));Xn()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return je(Xe),null;case 4:return Jn(),null;case 10:return Ul(n.type._context),null;case 22:case 23:return Dc(),null;case 24:return null;default:return null}}var Mo=!1,vt=!1,L0=typeof WeakSet=="function"?WeakSet:Set,ve=null;function ei(t,n){var s=t.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(g){Ge(t,n,g)}else s.current=null}function mc(t,n,s){try{s()}catch(g){Ge(t,n,g)}}var of=!1;function R0(t,n){if(Dl=Qs,t=Oh(),Sl(t)){if("selectionStart"in t)var s={start:t.selectionStart,end:t.selectionEnd};else e:{s=(s=t.ownerDocument)&&s.defaultView||window;var g=s.getSelection&&s.getSelection();if(g&&g.rangeCount!==0){s=g.anchorNode;var E=g.anchorOffset,A=g.focusNode;g=g.focusOffset;try{s.nodeType,A.nodeType}catch{s=null;break e}var $=0,G=-1,Q=-1,oe=0,de=0,fe=t,he=null;t:for(;;){for(var me;fe!==s||E!==0&&fe.nodeType!==3||(G=$+E),fe!==A||g!==0&&fe.nodeType!==3||(Q=$+g),fe.nodeType===3&&($+=fe.nodeValue.length),(me=fe.firstChild)!==null;)he=fe,fe=me;for(;;){if(fe===t)break t;if(he===s&&++oe===E&&(G=$),he===A&&++de===g&&(Q=$),(me=fe.nextSibling)!==null)break;fe=he,he=fe.parentNode}fe=me}s=G===-1||Q===-1?null:{start:G,end:Q}}else s=null}s=s||{start:0,end:0}}else s=null;for(Al={focusedElem:t,selectionRange:s},Qs=!1,ve=n;ve!==null;)if(n=ve,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,ve=t;else for(;ve!==null;){n=ve;try{var ye=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(ye!==null){var we=ye.memoizedProps,Ze=ye.memoizedState,ne=n.stateNode,ee=ne.getSnapshotBeforeUpdate(n.elementType===n.type?we:qt(n.type,we),Ze);ne.__reactInternalSnapshotBeforeUpdate=ee}break;case 3:var se=n.stateNode.containerInfo;se.nodeType===1?se.textContent="":se.nodeType===9&&se.documentElement&&se.removeChild(se.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(_e){Ge(n,n.return,_e)}if(t=n.sibling,t!==null){t.return=n.return,ve=t;break}ve=n.return}return ye=of,of=!1,ye}function ns(t,n,s){var g=n.updateQueue;if(g=g!==null?g.lastEffect:null,g!==null){var E=g=g.next;do{if((E.tag&t)===t){var A=E.destroy;E.destroy=void 0,A!==void 0&&mc(n,s,A)}E=E.next}while(E!==g)}}function Po(t,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&t)===t){var g=s.create;s.destroy=g()}s=s.next}while(s!==n)}}function vc(t){var n=t.ref;if(n!==null){var s=t.stateNode;switch(t.tag){case 5:t=s;break;default:t=s}typeof n=="function"?n(t):n.current=t}}function af(t){var n=t.alternate;n!==null&&(t.alternate=null,af(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&(delete n[ir],delete n[qi],delete n[Nl],delete n[u0],delete n[h0])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function lf(t){return t.tag===5||t.tag===3||t.tag===4}function cf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||lf(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function yc(t,n,s){var g=t.tag;if(g===5||g===6)t=t.stateNode,n?s.nodeType===8?s.parentNode.insertBefore(t,n):s.insertBefore(t,n):(s.nodeType===8?(n=s.parentNode,n.insertBefore(t,s)):(n=s,n.appendChild(t)),s=s._reactRootContainer,s!=null||n.onclick!==null||(n.onclick=co));else if(g!==4&&(t=t.child,t!==null))for(yc(t,n,s),t=t.sibling;t!==null;)yc(t,n,s),t=t.sibling}function wc(t,n,s){var g=t.tag;if(g===5||g===6)t=t.stateNode,n?s.insertBefore(t,n):s.appendChild(t);else if(g!==4&&(t=t.child,t!==null))for(wc(t,n,s),t=t.sibling;t!==null;)wc(t,n,s),t=t.sibling}var dt=null,Kt=!1;function Wr(t,n,s){for(s=s.child;s!==null;)uf(t,n,s),s=s.sibling}function uf(t,n,s){if(It&&typeof It.onCommitFiberUnmount=="function")try{It.onCommitFiberUnmount(on,s)}catch{}switch(s.tag){case 5:vt||ei(s,n);case 6:var g=dt,E=Kt;dt=null,Wr(t,n,s),dt=g,Kt=E,dt!==null&&(Kt?(t=dt,s=s.stateNode,t.nodeType===8?t.parentNode.removeChild(s):t.removeChild(s)):dt.removeChild(s.stateNode));break;case 18:dt!==null&&(Kt?(t=dt,s=s.stateNode,t.nodeType===8?Pl(t.parentNode,s):t.nodeType===1&&Pl(t,s),Bi(t)):Pl(dt,s.stateNode));break;case 4:g=dt,E=Kt,dt=s.stateNode.containerInfo,Kt=!0,Wr(t,n,s),dt=g,Kt=E;break;case 0:case 11:case 14:case 15:if(!vt&&(g=s.updateQueue,g!==null&&(g=g.lastEffect,g!==null))){E=g=g.next;do{var A=E,$=A.destroy;A=A.tag,$!==void 0&&((A&2)!==0||(A&4)!==0)&&mc(s,n,$),E=E.next}while(E!==g)}Wr(t,n,s);break;case 1:if(!vt&&(ei(s,n),g=s.stateNode,typeof g.componentWillUnmount=="function"))try{g.props=s.memoizedProps,g.state=s.memoizedState,g.componentWillUnmount()}catch(G){Ge(s,n,G)}Wr(t,n,s);break;case 21:Wr(t,n,s);break;case 22:s.mode&1?(vt=(g=vt)||s.memoizedState!==null,Wr(t,n,s),vt=g):Wr(t,n,s);break;default:Wr(t,n,s)}}function hf(t){var n=t.updateQueue;if(n!==null){t.updateQueue=null;var s=t.stateNode;s===null&&(s=t.stateNode=new L0),n.forEach(function(g){var E=O0.bind(null,t,g);s.has(g)||(s.add(g),g.then(E,E))})}}function Xt(t,n){var s=n.deletions;if(s!==null)for(var g=0;g<s.length;g++){var E=s[g];try{var A=t,$=n,G=$;e:for(;G!==null;){switch(G.tag){case 5:dt=G.stateNode,Kt=!1;break e;case 3:dt=G.stateNode.containerInfo,Kt=!0;break e;case 4:dt=G.stateNode.containerInfo,Kt=!0;break e}G=G.return}if(dt===null)throw Error(i(160));uf(A,$,E),dt=null,Kt=!1;var Q=E.alternate;Q!==null&&(Q.return=null),E.return=null}catch(oe){Ge(E,n,oe)}}if(n.subtreeFlags&12854)for(n=n.child;n!==null;)df(n,t),n=n.sibling}function df(t,n){var s=t.alternate,g=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Xt(n,t),ar(t),g&4){try{ns(3,t,t.return),Po(3,t)}catch(we){Ge(t,t.return,we)}try{ns(5,t,t.return)}catch(we){Ge(t,t.return,we)}}break;case 1:Xt(n,t),ar(t),g&512&&s!==null&&ei(s,s.return);break;case 5:if(Xt(n,t),ar(t),g&512&&s!==null&&ei(s,s.return),t.flags&32){var E=t.stateNode;try{ot(E,"")}catch(we){Ge(t,t.return,we)}}if(g&4&&(E=t.stateNode,E!=null)){var A=t.memoizedProps,$=s!==null?s.memoizedProps:A,G=t.type,Q=t.updateQueue;if(t.updateQueue=null,Q!==null)try{G==="input"&&A.type==="radio"&&A.name!=null&&ue(E,A),yi(G,$);var oe=yi(G,A);for($=0;$<Q.length;$+=2){var de=Q[$],fe=Q[$+1];de==="style"?Ps(E,fe):de==="dangerouslySetInnerHTML"?pr(E,fe):de==="children"?ot(E,fe):u(E,de,fe,oe)}switch(G){case"input":ge(E,A);break;case"textarea":pt(E,A);break;case"select":var he=E._wrapperState.wasMultiple;E._wrapperState.wasMultiple=!!A.multiple;var me=A.value;me!=null?Qe(E,!!A.multiple,me,!1):he!==!!A.multiple&&(A.defaultValue!=null?Qe(E,!!A.multiple,A.defaultValue,!0):Qe(E,!!A.multiple,A.multiple?[]:"",!1))}E[qi]=A}catch(we){Ge(t,t.return,we)}}break;case 6:if(Xt(n,t),ar(t),g&4){if(t.stateNode===null)throw Error(i(162));E=t.stateNode,A=t.memoizedProps;try{E.nodeValue=A}catch(we){Ge(t,t.return,we)}}break;case 3:if(Xt(n,t),ar(t),g&4&&s!==null&&s.memoizedState.isDehydrated)try{Bi(n.containerInfo)}catch(we){Ge(t,t.return,we)}break;case 4:Xt(n,t),ar(t);break;case 13:Xt(n,t),ar(t),E=t.child,E.flags&8192&&(A=E.memoizedState!==null,E.stateNode.isHidden=A,!A||E.alternate!==null&&E.alternate.memoizedState!==null||(xc=Ke())),g&4&&hf(t);break;case 22:if(de=s!==null&&s.memoizedState!==null,t.mode&1?(vt=(oe=vt)||de,Xt(n,t),vt=oe):Xt(n,t),ar(t),g&8192){if(oe=t.memoizedState!==null,(t.stateNode.isHidden=oe)&&!de&&(t.mode&1)!==0)for(ve=t,de=t.child;de!==null;){for(fe=ve=de;ve!==null;){switch(he=ve,me=he.child,he.tag){case 0:case 11:case 14:case 15:ns(4,he,he.return);break;case 1:ei(he,he.return);var ye=he.stateNode;if(typeof ye.componentWillUnmount=="function"){g=he,s=he.return;try{n=g,ye.props=n.memoizedProps,ye.state=n.memoizedState,ye.componentWillUnmount()}catch(we){Ge(g,s,we)}}break;case 5:ei(he,he.return);break;case 22:if(he.memoizedState!==null){_f(fe);continue}}me!==null?(me.return=he,ve=me):_f(fe)}de=de.sibling}e:for(de=null,fe=t;;){if(fe.tag===5){if(de===null){de=fe;try{E=fe.stateNode,oe?(A=E.style,typeof A.setProperty=="function"?A.setProperty("display","none","important"):A.display="none"):(G=fe.stateNode,Q=fe.memoizedProps.style,$=Q!=null&&Q.hasOwnProperty("display")?Q.display:null,G.style.display=Rn("display",$))}catch(we){Ge(t,t.return,we)}}}else if(fe.tag===6){if(de===null)try{fe.stateNode.nodeValue=oe?"":fe.memoizedProps}catch(we){Ge(t,t.return,we)}}else if((fe.tag!==22&&fe.tag!==23||fe.memoizedState===null||fe===t)&&fe.child!==null){fe.child.return=fe,fe=fe.child;continue}if(fe===t)break e;for(;fe.sibling===null;){if(fe.return===null||fe.return===t)break e;de===fe&&(de=null),fe=fe.return}de===fe&&(de=null),fe.sibling.return=fe.return,fe=fe.sibling}}break;case 19:Xt(n,t),ar(t),g&4&&hf(t);break;case 21:break;default:Xt(n,t),ar(t)}}function ar(t){var n=t.flags;if(n&2){try{e:{for(var s=t.return;s!==null;){if(lf(s)){var g=s;break e}s=s.return}throw Error(i(160))}switch(g.tag){case 5:var E=g.stateNode;g.flags&32&&(ot(E,""),g.flags&=-33);var A=cf(t);wc(t,A,E);break;case 3:case 4:var $=g.stateNode.containerInfo,G=cf(t);yc(t,G,$);break;default:throw Error(i(161))}}catch(Q){Ge(t,t.return,Q)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function D0(t,n,s){ve=t,ff(t)}function ff(t,n,s){for(var g=(t.mode&1)!==0;ve!==null;){var E=ve,A=E.child;if(E.tag===22&&g){var $=E.memoizedState!==null||Mo;if(!$){var G=E.alternate,Q=G!==null&&G.memoizedState!==null||vt;G=Mo;var oe=vt;if(Mo=$,(vt=Q)&&!oe)for(ve=E;ve!==null;)$=ve,Q=$.child,$.tag===22&&$.memoizedState!==null?gf(E):Q!==null?(Q.return=$,ve=Q):gf(E);for(;A!==null;)ve=A,ff(A),A=A.sibling;ve=E,Mo=G,vt=oe}pf(t)}else(E.subtreeFlags&8772)!==0&&A!==null?(A.return=E,ve=A):pf(t)}}function pf(t){for(;ve!==null;){var n=ve;if((n.flags&8772)!==0){var s=n.alternate;try{if((n.flags&8772)!==0)switch(n.tag){case 0:case 11:case 15:vt||Po(5,n);break;case 1:var g=n.stateNode;if(n.flags&4&&!vt)if(s===null)g.componentDidMount();else{var E=n.elementType===n.type?s.memoizedProps:qt(n.type,s.memoizedProps);g.componentDidUpdate(E,s.memoizedState,g.__reactInternalSnapshotBeforeUpdate)}var A=n.updateQueue;A!==null&&pd(n,A,g);break;case 3:var $=n.updateQueue;if($!==null){if(s=null,n.child!==null)switch(n.child.tag){case 5:s=n.child.stateNode;break;case 1:s=n.child.stateNode}pd(n,$,s)}break;case 5:var G=n.stateNode;if(s===null&&n.flags&4){s=G;var Q=n.memoizedProps;switch(n.type){case"button":case"input":case"select":case"textarea":Q.autoFocus&&s.focus();break;case"img":Q.src&&(s.src=Q.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(n.memoizedState===null){var oe=n.alternate;if(oe!==null){var de=oe.memoizedState;if(de!==null){var fe=de.dehydrated;fe!==null&&Bi(fe)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(i(163))}vt||n.flags&512&&vc(n)}catch(he){Ge(n,n.return,he)}}if(n===t){ve=null;break}if(s=n.sibling,s!==null){s.return=n.return,ve=s;break}ve=n.return}}function _f(t){for(;ve!==null;){var n=ve;if(n===t){ve=null;break}var s=n.sibling;if(s!==null){s.return=n.return,ve=s;break}ve=n.return}}function gf(t){for(;ve!==null;){var n=ve;try{switch(n.tag){case 0:case 11:case 15:var s=n.return;try{Po(4,n)}catch(Q){Ge(n,s,Q)}break;case 1:var g=n.stateNode;if(typeof g.componentDidMount=="function"){var E=n.return;try{g.componentDidMount()}catch(Q){Ge(n,E,Q)}}var A=n.return;try{vc(n)}catch(Q){Ge(n,A,Q)}break;case 5:var $=n.return;try{vc(n)}catch(Q){Ge(n,$,Q)}}}catch(Q){Ge(n,n.return,Q)}if(n===t){ve=null;break}var G=n.sibling;if(G!==null){G.return=n.return,ve=G;break}ve=n.return}}var A0=Math.ceil,No=w.ReactCurrentDispatcher,Sc=w.ReactCurrentOwner,zt=w.ReactCurrentBatchConfig,Me=0,lt=null,et=null,ft=0,Pt=0,ti=Hr(0),it=0,is=null,_n=0,Bo=0,Cc=0,ss=null,bt=null,xc=0,ri=1/0,Cr=null,Io=!1,bc=null,Ur=null,Oo=!1,Vr=null,Ho=0,os=0,Ec=null,Fo=-1,jo=0;function wt(){return(Me&6)!==0?Ke():Fo!==-1?Fo:Fo=Ke()}function qr(t){return(t.mode&1)===0?1:(Me&2)!==0&&ft!==0?ft&-ft:f0.transition!==null?(jo===0&&(jo=Bn()),jo):(t=Be,t!==0||(t=window.event,t=t===void 0?16:mh(t.type)),t)}function Yt(t,n,s,g){if(50<os)throw os=0,Ec=null,Error(i(185));an(t,s,g),((Me&2)===0||t!==lt)&&(t===lt&&((Me&2)===0&&(Bo|=s),it===4&&Kr(t,ft)),Et(t,g),s===1&&Me===0&&(n.mode&1)===0&&(ri=Ke()+500,po&&jr()))}function Et(t,n){var s=t.callbackNode;ol(t,n);var g=Nn(t,t===lt?ft:0);if(g===0)s!==null&&Ws(s),t.callbackNode=null,t.callbackPriority=0;else if(n=g&-g,t.callbackPriority!==n){if(s!=null&&Ws(s),n===1)t.tag===0?d0(vf.bind(null,t)):rd(vf.bind(null,t)),l0(function(){(Me&6)===0&&jr()}),s=null;else{switch(ch(g)){case 1:s=Ri;break;case 4:s=Vs;break;case 16:s=Tn;break;case 536870912:s=qs;break;default:s=Tn}s=kf(s,mf.bind(null,t))}t.callbackPriority=n,t.callbackNode=s}}function mf(t,n){if(Fo=-1,jo=0,(Me&6)!==0)throw Error(i(327));var s=t.callbackNode;if(ni()&&t.callbackNode!==s)return null;var g=Nn(t,t===lt?ft:0);if(g===0)return null;if((g&30)!==0||(g&t.expiredLanes)!==0||n)n=zo(t,g);else{n=g;var E=Me;Me|=2;var A=wf();(lt!==t||ft!==n)&&(Cr=null,ri=Ke()+500,mn(t,n));do try{P0();break}catch(G){yf(t,G)}while(!0);Wl(),No.current=A,Me=E,et!==null?n=0:(lt=null,ft=0,n=it)}if(n!==0){if(n===2&&(E=Di(t),E!==0&&(g=E,n=kc(t,E))),n===1)throw s=is,mn(t,0),Kr(t,g),Et(t,Ke()),s;if(n===6)Kr(t,g);else{if(E=t.current.alternate,(g&30)===0&&!T0(E)&&(n=zo(t,g),n===2&&(A=Di(t),A!==0&&(g=A,n=kc(t,A))),n===1))throw s=is,mn(t,0),Kr(t,g),Et(t,Ke()),s;switch(t.finishedWork=E,t.finishedLanes=g,n){case 0:case 1:throw Error(i(345));case 2:vn(t,bt,Cr);break;case 3:if(Kr(t,g),(g&130023424)===g&&(n=xc+500-Ke(),10<n)){if(Nn(t,0)!==0)break;if(E=t.suspendedLanes,(E&g)!==g){wt(),t.pingedLanes|=t.suspendedLanes&E;break}t.timeoutHandle=Ml(vn.bind(null,t,bt,Cr),n);break}vn(t,bt,Cr);break;case 4:if(Kr(t,g),(g&4194240)===g)break;for(n=t.eventTimes,E=-1;0<g;){var $=31-Dt(g);A=1<<$,$=n[$],$>E&&(E=$),g&=~A}if(g=E,g=Ke()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*A0(g/1960))-g,10<g){t.timeoutHandle=Ml(vn.bind(null,t,bt,Cr),g);break}vn(t,bt,Cr);break;case 5:vn(t,bt,Cr);break;default:throw Error(i(329))}}}return Et(t,Ke()),t.callbackNode===s?mf.bind(null,t):null}function kc(t,n){var s=ss;return t.current.memoizedState.isDehydrated&&(mn(t,n).flags|=256),t=zo(t,n),t!==2&&(n=bt,bt=s,n!==null&&Lc(n)),t}function Lc(t){bt===null?bt=t:bt.push.apply(bt,t)}function T0(t){for(var n=t;;){if(n.flags&16384){var s=n.updateQueue;if(s!==null&&(s=s.stores,s!==null))for(var g=0;g<s.length;g++){var E=s[g],A=E.getSnapshot;E=E.value;try{if(!Ut(A(),E))return!1}catch{return!1}}}if(s=n.child,n.subtreeFlags&16384&&s!==null)s.return=n,n=s;else{if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Kr(t,n){for(n&=~Cc,n&=~Bo,t.suspendedLanes|=n,t.pingedLanes&=~n,t=t.expirationTimes;0<n;){var s=31-Dt(n),g=1<<s;t[s]=-1,n&=~g}}function vf(t){if((Me&6)!==0)throw Error(i(327));ni();var n=Nn(t,0);if((n&1)===0)return Et(t,Ke()),null;var s=zo(t,n);if(t.tag!==0&&s===2){var g=Di(t);g!==0&&(n=g,s=kc(t,g))}if(s===1)throw s=is,mn(t,0),Kr(t,n),Et(t,Ke()),s;if(s===6)throw Error(i(345));return t.finishedWork=t.current.alternate,t.finishedLanes=n,vn(t,bt,Cr),Et(t,Ke()),null}function Rc(t,n){var s=Me;Me|=1;try{return t(n)}finally{Me=s,Me===0&&(ri=Ke()+500,po&&jr())}}function gn(t){Vr!==null&&Vr.tag===0&&(Me&6)===0&&ni();var n=Me;Me|=1;var s=zt.transition,g=Be;try{if(zt.transition=null,Be=1,t)return t()}finally{Be=g,zt.transition=s,Me=n,(Me&6)===0&&jr()}}function Dc(){Pt=ti.current,je(ti)}function mn(t,n){t.finishedWork=null,t.finishedLanes=0;var s=t.timeoutHandle;if(s!==-1&&(t.timeoutHandle=-1,a0(s)),et!==null)for(s=et.return;s!==null;){var g=s;switch(Hl(g),g.tag){case 1:g=g.type.childContextTypes,g!=null&&ho();break;case 3:Jn(),je(St),je(_t),Ql();break;case 5:Yl(g);break;case 4:Jn();break;case 13:je(Xe);break;case 19:je(Xe);break;case 10:Ul(g.type._context);break;case 22:case 23:Dc()}s=s.return}if(lt=t,et=t=Xr(t.current,null),ft=Pt=n,it=0,is=null,Cc=Bo=_n=0,bt=ss=null,dn!==null){for(n=0;n<dn.length;n++)if(s=dn[n],g=s.interleaved,g!==null){s.interleaved=null;var E=g.next,A=s.pending;if(A!==null){var $=A.next;A.next=E,g.next=$}s.pending=g}dn=null}return t}function yf(t,n){do{var s=et;try{if(Wl(),bo.current=Ro,Eo){for(var g=Ye.memoizedState;g!==null;){var E=g.queue;E!==null&&(E.pending=null),g=g.next}Eo=!1}if(pn=0,at=nt=Ye=null,Ji=!1,Zi=0,Sc.current=null,s===null||s.return===null){it=1,is=n,et=null;break}e:{var A=t,$=s.return,G=s,Q=n;if(n=ft,G.flags|=32768,Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var oe=Q,de=G,fe=de.tag;if((de.mode&1)===0&&(fe===0||fe===11||fe===15)){var he=de.alternate;he?(de.updateQueue=he.updateQueue,de.memoizedState=he.memoizedState,de.lanes=he.lanes):(de.updateQueue=null,de.memoizedState=null)}var me=Wd($);if(me!==null){me.flags&=-257,Ud(me,$,G,A,n),me.mode&1&&$d(A,oe,n),n=me,Q=oe;var ye=n.updateQueue;if(ye===null){var we=new Set;we.add(Q),n.updateQueue=we}else ye.add(Q);break e}else{if((n&1)===0){$d(A,oe,n),Ac();break e}Q=Error(i(426))}}else if(We&&G.mode&1){var Ze=Wd($);if(Ze!==null){(Ze.flags&65536)===0&&(Ze.flags|=256),Ud(Ze,$,G,A,n),zl(Zn(Q,G));break e}}A=Q=Zn(Q,G),it!==4&&(it=2),ss===null?ss=[A]:ss.push(A),A=$;do{switch(A.tag){case 3:A.flags|=65536,n&=-n,A.lanes|=n;var ne=jd(A,Q,n);fd(A,ne);break e;case 1:G=Q;var ee=A.type,se=A.stateNode;if((A.flags&128)===0&&(typeof ee.getDerivedStateFromError=="function"||se!==null&&typeof se.componentDidCatch=="function"&&(Ur===null||!Ur.has(se)))){A.flags|=65536,n&=-n,A.lanes|=n;var _e=zd(A,G,n);fd(A,_e);break e}}A=A.return}while(A!==null)}Cf(s)}catch(Ce){n=Ce,et===s&&s!==null&&(et=s=s.return);continue}break}while(!0)}function wf(){var t=No.current;return No.current=Ro,t===null?Ro:t}function Ac(){(it===0||it===3||it===2)&&(it=4),lt===null||(_n&268435455)===0&&(Bo&268435455)===0||Kr(lt,ft)}function zo(t,n){var s=Me;Me|=2;var g=wf();(lt!==t||ft!==n)&&(Cr=null,mn(t,n));do try{M0();break}catch(E){yf(t,E)}while(!0);if(Wl(),Me=s,No.current=g,et!==null)throw Error(i(261));return lt=null,ft=0,it}function M0(){for(;et!==null;)Sf(et)}function P0(){for(;et!==null&&!Za();)Sf(et)}function Sf(t){var n=Ef(t.alternate,t,Pt);t.memoizedProps=t.pendingProps,n===null?Cf(t):et=n,Sc.current=null}function Cf(t){var n=t;do{var s=n.alternate;if(t=n.return,(n.flags&32768)===0){if(s=E0(s,n,Pt),s!==null){et=s;return}}else{if(s=k0(s,n),s!==null){s.flags&=32767,et=s;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{it=6,et=null;return}}if(n=n.sibling,n!==null){et=n;return}et=n=t}while(n!==null);it===0&&(it=5)}function vn(t,n,s){var g=Be,E=zt.transition;try{zt.transition=null,Be=1,N0(t,n,s,g)}finally{zt.transition=E,Be=g}return null}function N0(t,n,s,g){do ni();while(Vr!==null);if((Me&6)!==0)throw Error(i(327));s=t.finishedWork;var E=t.finishedLanes;if(s===null)return null;if(t.finishedWork=null,t.finishedLanes=0,s===t.current)throw Error(i(177));t.callbackNode=null,t.callbackPriority=0;var A=s.lanes|s.childLanes;if(Xs(t,A),t===lt&&(et=lt=null,ft=0),(s.subtreeFlags&2064)===0&&(s.flags&2064)===0||Oo||(Oo=!0,kf(Tn,function(){return ni(),null})),A=(s.flags&15990)!==0,(s.subtreeFlags&15990)!==0||A){A=zt.transition,zt.transition=null;var $=Be;Be=1;var G=Me;Me|=4,Sc.current=null,R0(t,s),df(s,t),e0(Al),Qs=!!Dl,Al=Dl=null,t.current=s,D0(s),Us(),Me=G,Be=$,zt.transition=A}else t.current=s;if(Oo&&(Oo=!1,Vr=t,Ho=E),A=t.pendingLanes,A===0&&(Ur=null),rl(s.stateNode),Et(t,Ke()),n!==null)for(g=t.onRecoverableError,s=0;s<n.length;s++)E=n[s],g(E.value,{componentStack:E.stack,digest:E.digest});if(Io)throw Io=!1,t=bc,bc=null,t;return(Ho&1)!==0&&t.tag!==0&&ni(),A=t.pendingLanes,(A&1)!==0?t===Ec?os++:(os=0,Ec=t):os=0,jr(),null}function ni(){if(Vr!==null){var t=ch(Ho),n=zt.transition,s=Be;try{if(zt.transition=null,Be=16>t?16:t,Vr===null)var g=!1;else{if(t=Vr,Vr=null,Ho=0,(Me&6)!==0)throw Error(i(331));var E=Me;for(Me|=4,ve=t.current;ve!==null;){var A=ve,$=A.child;if((ve.flags&16)!==0){var G=A.deletions;if(G!==null){for(var Q=0;Q<G.length;Q++){var oe=G[Q];for(ve=oe;ve!==null;){var de=ve;switch(de.tag){case 0:case 11:case 15:ns(8,de,A)}var fe=de.child;if(fe!==null)fe.return=de,ve=fe;else for(;ve!==null;){de=ve;var he=de.sibling,me=de.return;if(af(de),de===oe){ve=null;break}if(he!==null){he.return=me,ve=he;break}ve=me}}}var ye=A.alternate;if(ye!==null){var we=ye.child;if(we!==null){ye.child=null;do{var Ze=we.sibling;we.sibling=null,we=Ze}while(we!==null)}}ve=A}}if((A.subtreeFlags&2064)!==0&&$!==null)$.return=A,ve=$;else e:for(;ve!==null;){if(A=ve,(A.flags&2048)!==0)switch(A.tag){case 0:case 11:case 15:ns(9,A,A.return)}var ne=A.sibling;if(ne!==null){ne.return=A.return,ve=ne;break e}ve=A.return}}var ee=t.current;for(ve=ee;ve!==null;){$=ve;var se=$.child;if(($.subtreeFlags&2064)!==0&&se!==null)se.return=$,ve=se;else e:for($=ee;ve!==null;){if(G=ve,(G.flags&2048)!==0)try{switch(G.tag){case 0:case 11:case 15:Po(9,G)}}catch(Ce){Ge(G,G.return,Ce)}if(G===$){ve=null;break e}var _e=G.sibling;if(_e!==null){_e.return=G.return,ve=_e;break e}ve=G.return}}if(Me=E,jr(),It&&typeof It.onPostCommitFiberRoot=="function")try{It.onPostCommitFiberRoot(on,t)}catch{}g=!0}return g}finally{Be=s,zt.transition=n}}return!1}function xf(t,n,s){n=Zn(s,n),n=jd(t,n,1),t=$r(t,n,1),n=wt(),t!==null&&(an(t,1,n),Et(t,n))}function Ge(t,n,s){if(t.tag===3)xf(t,t,s);else for(;n!==null;){if(n.tag===3){xf(n,t,s);break}else if(n.tag===1){var g=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Ur===null||!Ur.has(g))){t=Zn(s,t),t=zd(n,t,1),n=$r(n,t,1),t=wt(),n!==null&&(an(n,1,t),Et(n,t));break}}n=n.return}}function B0(t,n,s){var g=t.pingCache;g!==null&&g.delete(n),n=wt(),t.pingedLanes|=t.suspendedLanes&s,lt===t&&(ft&s)===s&&(it===4||it===3&&(ft&130023424)===ft&&500>Ke()-xc?mn(t,0):Cc|=s),Et(t,n)}function bf(t,n){n===0&&((t.mode&1)===0?n=1:(n=Pn,Pn<<=1,(Pn&130023424)===0&&(Pn=4194304)));var s=wt();t=yr(t,n),t!==null&&(an(t,n,s),Et(t,s))}function I0(t){var n=t.memoizedState,s=0;n!==null&&(s=n.retryLane),bf(t,s)}function O0(t,n){var s=0;switch(t.tag){case 13:var g=t.stateNode,E=t.memoizedState;E!==null&&(s=E.retryLane);break;case 19:g=t.stateNode;break;default:throw Error(i(314))}g!==null&&g.delete(n),bf(t,s)}var Ef;Ef=function(t,n,s){if(t!==null)if(t.memoizedProps!==n.pendingProps||St.current)xt=!0;else{if((t.lanes&s)===0&&(n.flags&128)===0)return xt=!1,b0(t,n,s);xt=(t.flags&131072)!==0}else xt=!1,We&&(n.flags&1048576)!==0&&nd(n,go,n.index);switch(n.lanes=0,n.tag){case 2:var g=n.type;To(t,n),t=n.pendingProps;var E=Vn(n,_t.current);Qn(n,s),E=ec(null,n,g,t,E,s);var A=tc();return n.flags|=1,typeof E=="object"&&E!==null&&typeof E.render=="function"&&E.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,Ct(g)?(A=!0,fo(n)):A=!1,n.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,Kl(n),E.updater=Do,n.stateNode=E,E._reactInternals=n,ac(n,g,t,s),n=hc(null,n,g,!0,A,s)):(n.tag=0,We&&A&&Ol(n),yt(null,n,E,s),n=n.child),n;case 16:g=n.elementType;e:{switch(To(t,n),t=n.pendingProps,E=g._init,g=E(g._payload),n.type=g,E=n.tag=F0(g),t=qt(g,t),E){case 0:n=uc(null,n,g,t,s);break e;case 1:n=Gd(null,n,g,t,s);break e;case 11:n=Vd(null,n,g,t,s);break e;case 14:n=qd(null,n,g,qt(g.type,t),s);break e}throw Error(i(306,g,""))}return n;case 0:return g=n.type,E=n.pendingProps,E=n.elementType===g?E:qt(g,E),uc(t,n,g,E,s);case 1:return g=n.type,E=n.pendingProps,E=n.elementType===g?E:qt(g,E),Gd(t,n,g,E,s);case 3:e:{if(Qd(n),t===null)throw Error(i(387));g=n.pendingProps,A=n.memoizedState,E=A.element,dd(t,n),Co(n,g,null,s);var $=n.memoizedState;if(g=$.element,A.isDehydrated)if(A={element:g,isDehydrated:!1,cache:$.cache,pendingSuspenseBoundaries:$.pendingSuspenseBoundaries,transitions:$.transitions},n.updateQueue.baseState=A,n.memoizedState=A,n.flags&256){E=Zn(Error(i(423)),n),n=Jd(t,n,g,s,E);break e}else if(g!==E){E=Zn(Error(i(424)),n),n=Jd(t,n,g,s,E);break e}else for(Mt=Or(n.stateNode.containerInfo.firstChild),Tt=n,We=!0,Vt=null,s=ud(n,null,g,s),n.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(Xn(),g===E){n=Sr(t,n,s);break e}yt(t,n,g,s)}n=n.child}return n;case 5:return _d(n),t===null&&jl(n),g=n.type,E=n.pendingProps,A=t!==null?t.memoizedProps:null,$=E.children,Tl(g,E)?$=null:A!==null&&Tl(g,A)&&(n.flags|=32),Yd(t,n),yt(t,n,$,s),n.child;case 6:return t===null&&jl(n),null;case 13:return Zd(t,n,s);case 4:return Xl(n,n.stateNode.containerInfo),g=n.pendingProps,t===null?n.child=Yn(n,null,g,s):yt(t,n,g,s),n.child;case 11:return g=n.type,E=n.pendingProps,E=n.elementType===g?E:qt(g,E),Vd(t,n,g,E,s);case 7:return yt(t,n,n.pendingProps,s),n.child;case 8:return yt(t,n,n.pendingProps.children,s),n.child;case 12:return yt(t,n,n.pendingProps.children,s),n.child;case 10:e:{if(g=n.type._context,E=n.pendingProps,A=n.memoizedProps,$=E.value,He(yo,g._currentValue),g._currentValue=$,A!==null)if(Ut(A.value,$)){if(A.children===E.children&&!St.current){n=Sr(t,n,s);break e}}else for(A=n.child,A!==null&&(A.return=n);A!==null;){var G=A.dependencies;if(G!==null){$=A.child;for(var Q=G.firstContext;Q!==null;){if(Q.context===g){if(A.tag===1){Q=wr(-1,s&-s),Q.tag=2;var oe=A.updateQueue;if(oe!==null){oe=oe.shared;var de=oe.pending;de===null?Q.next=Q:(Q.next=de.next,de.next=Q),oe.pending=Q}}A.lanes|=s,Q=A.alternate,Q!==null&&(Q.lanes|=s),Vl(A.return,s,n),G.lanes|=s;break}Q=Q.next}}else if(A.tag===10)$=A.type===n.type?null:A.child;else if(A.tag===18){if($=A.return,$===null)throw Error(i(341));$.lanes|=s,G=$.alternate,G!==null&&(G.lanes|=s),Vl($,s,n),$=A.sibling}else $=A.child;if($!==null)$.return=A;else for($=A;$!==null;){if($===n){$=null;break}if(A=$.sibling,A!==null){A.return=$.return,$=A;break}$=$.return}A=$}yt(t,n,E.children,s),n=n.child}return n;case 9:return E=n.type,g=n.pendingProps.children,Qn(n,s),E=Ft(E),g=g(E),n.flags|=1,yt(t,n,g,s),n.child;case 14:return g=n.type,E=qt(g,n.pendingProps),E=qt(g.type,E),qd(t,n,g,E,s);case 15:return Kd(t,n,n.type,n.pendingProps,s);case 17:return g=n.type,E=n.pendingProps,E=n.elementType===g?E:qt(g,E),To(t,n),n.tag=1,Ct(g)?(t=!0,fo(n)):t=!1,Qn(n,s),Hd(n,g,E),ac(n,g,E,s),hc(null,n,g,!0,t,s);case 19:return tf(t,n,s);case 22:return Xd(t,n,s)}throw Error(i(156,n.tag))};function kf(t,n){return $s(t,n)}function H0(t,n,s,g){this.tag=t,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $t(t,n,s,g){return new H0(t,n,s,g)}function Tc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function F0(t){if(typeof t=="function")return Tc(t)?1:0;if(t!=null){if(t=t.$$typeof,t===j)return 11;if(t===q)return 14}return 2}function Xr(t,n){var s=t.alternate;return s===null?(s=$t(t.tag,n,t.key,t.mode),s.elementType=t.elementType,s.type=t.type,s.stateNode=t.stateNode,s.alternate=t,t.alternate=s):(s.pendingProps=n,s.type=t.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=t.flags&14680064,s.childLanes=t.childLanes,s.lanes=t.lanes,s.child=t.child,s.memoizedProps=t.memoizedProps,s.memoizedState=t.memoizedState,s.updateQueue=t.updateQueue,n=t.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},s.sibling=t.sibling,s.index=t.index,s.ref=t.ref,s}function $o(t,n,s,g,E,A){var $=2;if(g=t,typeof t=="function")Tc(t)&&($=1);else if(typeof t=="string")$=5;else e:switch(t){case D:return yn(s.children,E,A,n);case k:$=8,E|=8;break;case M:return t=$t(12,s,n,E|2),t.elementType=M,t.lanes=A,t;case N:return t=$t(13,s,n,E),t.elementType=N,t.lanes=A,t;case I:return t=$t(19,s,n,E),t.elementType=I,t.lanes=A,t;case K:return Wo(s,E,A,n);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case W:$=10;break e;case z:$=9;break e;case j:$=11;break e;case q:$=14;break e;case U:$=16,g=null;break e}throw Error(i(130,t==null?t:typeof t,""))}return n=$t($,s,n,E),n.elementType=t,n.type=g,n.lanes=A,n}function yn(t,n,s,g){return t=$t(7,t,g,n),t.lanes=s,t}function Wo(t,n,s,g){return t=$t(22,t,g,n),t.elementType=K,t.lanes=s,t.stateNode={isHidden:!1},t}function Mc(t,n,s){return t=$t(6,t,null,n),t.lanes=s,t}function Pc(t,n,s){return n=$t(4,t.children!==null?t.children:[],t.key,n),n.lanes=s,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}function j0(t,n,s,g,E){this.tag=n,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ai(0),this.expirationTimes=Ai(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ai(0),this.identifierPrefix=g,this.onRecoverableError=E,this.mutableSourceEagerHydrationData=null}function Nc(t,n,s,g,E,A,$,G,Q){return t=new j0(t,n,s,G,Q),n===1?(n=1,A===!0&&(n|=8)):n=0,A=$t(3,null,null,n),t.current=A,A.stateNode=t,A.memoizedState={element:g,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},Kl(A),t}function z0(t,n,s){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:R,key:g==null?null:""+g,children:t,containerInfo:n,implementation:s}}function Lf(t){if(!t)return Fr;t=t._reactInternals;e:{if(rr(t)!==t||t.tag!==1)throw Error(i(170));var n=t;do{switch(n.tag){case 3:n=n.stateNode.context;break e;case 1:if(Ct(n.type)){n=n.stateNode.__reactInternalMemoizedMergedChildContext;break e}}n=n.return}while(n!==null);throw Error(i(171))}if(t.tag===1){var s=t.type;if(Ct(s))return ed(t,s,n)}return n}function Rf(t,n,s,g,E,A,$,G,Q){return t=Nc(s,g,!0,t,E,A,$,G,Q),t.context=Lf(null),s=t.current,g=wt(),E=qr(s),A=wr(g,E),A.callback=n??null,$r(s,A,E),t.current.lanes=E,an(t,E,g),Et(t,g),t}function Uo(t,n,s,g){var E=n.current,A=wt(),$=qr(E);return s=Lf(s),n.context===null?n.context=s:n.pendingContext=s,n=wr(A,$),n.payload={element:t},g=g===void 0?null:g,g!==null&&(n.callback=g),t=$r(E,n,$),t!==null&&(Yt(t,E,$,A),So(t,E,$)),$}function Vo(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function Df(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var s=t.retryLane;t.retryLane=s!==0&&s<n?s:n}}function Bc(t,n){Df(t,n),(t=t.alternate)&&Df(t,n)}function $0(){return null}var Af=typeof reportError=="function"?reportError:function(t){console.error(t)};function Ic(t){this._internalRoot=t}qo.prototype.render=Ic.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(i(409));Uo(t,n,null,null)},qo.prototype.unmount=Ic.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;gn(function(){Uo(null,t,null,null)}),n[_r]=null}};function qo(t){this._internalRoot=t}qo.prototype.unstable_scheduleHydration=function(t){if(t){var n=dh();t={blockedOn:null,target:t,priority:n};for(var s=0;s<Nr.length&&n!==0&&n<Nr[s].priority;s++);Nr.splice(s,0,t),s===0&&_h(t)}};function Oc(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Ko(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Tf(){}function W0(t,n,s,g,E){if(E){if(typeof g=="function"){var A=g;g=function(){var oe=Vo($);A.call(oe)}}var $=Rf(n,g,t,0,null,!1,!1,"",Tf);return t._reactRootContainer=$,t[_r]=$.current,Ui(t.nodeType===8?t.parentNode:t),gn(),$}for(;E=t.lastChild;)t.removeChild(E);if(typeof g=="function"){var G=g;g=function(){var oe=Vo(Q);G.call(oe)}}var Q=Nc(t,0,!1,null,null,!1,!1,"",Tf);return t._reactRootContainer=Q,t[_r]=Q.current,Ui(t.nodeType===8?t.parentNode:t),gn(function(){Uo(n,Q,s,g)}),Q}function Xo(t,n,s,g,E){var A=s._reactRootContainer;if(A){var $=A;if(typeof E=="function"){var G=E;E=function(){var Q=Vo($);G.call(Q)}}Uo(n,$,t,E)}else $=W0(s,n,t,E,g);return Vo($)}uh=function(t){switch(t.tag){case 3:var n=t.stateNode;if(n.current.memoizedState.isDehydrated){var s=nr(n.pendingLanes);s!==0&&(al(n,s|1),Et(n,Ke()),(Me&6)===0&&(ri=Ke()+500,jr()))}break;case 13:gn(function(){var g=yr(t,1);if(g!==null){var E=wt();Yt(g,t,1,E)}}),Bc(t,1)}},ll=function(t){if(t.tag===13){var n=yr(t,134217728);if(n!==null){var s=wt();Yt(n,t,134217728,s)}Bc(t,134217728)}},hh=function(t){if(t.tag===13){var n=qr(t),s=yr(t,n);if(s!==null){var g=wt();Yt(s,t,n,g)}Bc(t,n)}},dh=function(){return Be},fh=function(t,n){var s=Be;try{return Be=t,n()}finally{Be=s}},Ci=function(t,n,s){switch(n){case"input":if(ge(t,s),n=s.name,s.type==="radio"&&n!=null){for(s=t;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll("input[name="+JSON.stringify(""+n)+'][type="radio"]'),n=0;n<s.length;n++){var g=s[n];if(g!==t&&g.form===t.form){var E=uo(g);if(!E)throw Error(i(90));le(g),ge(g,E)}}}break;case"textarea":pt(t,s);break;case"select":n=s.value,n!=null&&Qe(t,!!s.multiple,n,!1)}},Os=Rc,Hs=gn;var U0={usingClientEntryPoint:!1,Events:[Ki,Wn,uo,Bs,Is,Rc]},as={findFiberByHostInstance:ln,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},V0={bundleType:as.bundleType,version:as.version,rendererPackageName:as.rendererPackageName,rendererConfig:as.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:w.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=js(t),t===null?null:t.stateNode},findFiberByHostInstance:as.findFiberByHostInstance||$0,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yo.isDisabled&&Yo.supportsFiber)try{on=Yo.inject(V0),It=Yo}catch{}}return kt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=U0,kt.createPortal=function(t,n){var s=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Oc(n))throw Error(i(200));return z0(t,n,null,s)},kt.createRoot=function(t,n){if(!Oc(t))throw Error(i(299));var s=!1,g="",E=Af;return n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(g=n.identifierPrefix),n.onRecoverableError!==void 0&&(E=n.onRecoverableError)),n=Nc(t,1,!1,null,null,s,!1,g,E),t[_r]=n.current,Ui(t.nodeType===8?t.parentNode:t),new Ic(n)},kt.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var n=t._reactInternals;if(n===void 0)throw typeof t.render=="function"?Error(i(188)):(t=Object.keys(t).join(","),Error(i(268,t)));return t=js(n),t=t===null?null:t.stateNode,t},kt.flushSync=function(t){return gn(t)},kt.hydrate=function(t,n,s){if(!Ko(n))throw Error(i(200));return Xo(null,t,n,!0,s)},kt.hydrateRoot=function(t,n,s){if(!Oc(t))throw Error(i(405));var g=s!=null&&s.hydratedSources||null,E=!1,A="",$=Af;if(s!=null&&(s.unstable_strictMode===!0&&(E=!0),s.identifierPrefix!==void 0&&(A=s.identifierPrefix),s.onRecoverableError!==void 0&&($=s.onRecoverableError)),n=Rf(n,null,t,1,s??null,E,!1,A,$),t[_r]=n.current,Ui(t),g)for(t=0;t<g.length;t++)s=g[t],E=s._getVersion,E=E(s._source),n.mutableSourceEagerHydrationData==null?n.mutableSourceEagerHydrationData=[s,E]:n.mutableSourceEagerHydrationData.push(s,E);return new qo(n)},kt.render=function(t,n,s){if(!Ko(n))throw Error(i(200));return Xo(null,t,n,!1,s)},kt.unmountComponentAtNode=function(t){if(!Ko(t))throw Error(i(40));return t._reactRootContainer?(gn(function(){Xo(null,null,t,!1,function(){t._reactRootContainer=null,t[_r]=null})}),!0):!1},kt.unstable_batchedUpdates=Rc,kt.unstable_renderSubtreeIntoContainer=function(t,n,s,g){if(!Ko(s))throw Error(i(200));if(t==null||t._reactInternals===void 0)throw Error(i(38));return Xo(t,n,s,!1,g)},kt.version="18.3.1-next-f1338f8080-20240426",kt}var Ff;function r_(){if(Ff)return jc.exports;Ff=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(r){console.error(r)}}return e(),jc.exports=J0(),jc.exports}var jf;function Z0(){if(jf)return Go;jf=1;var e=r_();return Go.createRoot=e.createRoot,Go.hydrateRoot=e.hydrateRoot,Go}var ev=Z0();const tv=Ou(ev),hr=Object.create(null);hr.open="0";hr.close="1";hr.ping="2";hr.pong="3";hr.message="4";hr.upgrade="5";hr.noop="6";const ca=Object.create(null);Object.keys(hr).forEach(e=>{ca[hr[e]]=e});const du={type:"error",data:"parser error"},n_=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",i_=typeof ArrayBuffer=="function",s_=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Fu=({type:e,data:r},i,o)=>n_&&r instanceof Blob?i?o(r):zf(r,o):i_&&(r instanceof ArrayBuffer||s_(r))?i?o(r):zf(new Blob([r]),o):o(hr[e]+(r||"")),zf=(e,r)=>{const i=new FileReader;return i.onload=function(){const o=i.result.split(",")[1];r("b"+(o||""))},i.readAsDataURL(e)};function $f(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Wc;function rv(e,r){if(n_&&e.data instanceof Blob)return e.data.arrayBuffer().then($f).then(r);if(i_&&(e.data instanceof ArrayBuffer||s_(e.data)))return r($f(e.data));Fu(e,!1,i=>{Wc||(Wc=new TextEncoder),r(Wc.encode(i))})}const Wf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ds=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<Wf.length;e++)ds[Wf.charCodeAt(e)]=e;const nv=e=>{let r=e.length*.75,i=e.length,o,h=0,S,y,a,l;e[e.length-1]==="="&&(r--,e[e.length-2]==="="&&r--);const _=new ArrayBuffer(r),v=new Uint8Array(_);for(o=0;o<i;o+=4)S=ds[e.charCodeAt(o)],y=ds[e.charCodeAt(o+1)],a=ds[e.charCodeAt(o+2)],l=ds[e.charCodeAt(o+3)],v[h++]=S<<2|y>>4,v[h++]=(y&15)<<4|a>>2,v[h++]=(a&3)<<6|l&63;return _},iv=typeof ArrayBuffer=="function",ju=(e,r)=>{if(typeof e!="string")return{type:"message",data:o_(e,r)};const i=e.charAt(0);return i==="b"?{type:"message",data:sv(e.substring(1),r)}:ca[i]?e.length>1?{type:ca[i],data:e.substring(1)}:{type:ca[i]}:du},sv=(e,r)=>{if(iv){const i=nv(e);return o_(i,r)}else return{base64:!0,data:e}},o_=(e,r)=>{switch(r){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},a_="",ov=(e,r)=>{const i=e.length,o=new Array(i);let h=0;e.forEach((S,y)=>{Fu(S,!1,a=>{o[y]=a,++h===i&&r(o.join(a_))})})},av=(e,r)=>{const i=e.split(a_),o=[];for(let h=0;h<i.length;h++){const S=ju(i[h],r);if(o.push(S),S.type==="error")break}return o};function lv(){return new TransformStream({transform(e,r){rv(e,i=>{const o=i.length;let h;if(o<126)h=new Uint8Array(1),new DataView(h.buffer).setUint8(0,o);else if(o<65536){h=new Uint8Array(3);const S=new DataView(h.buffer);S.setUint8(0,126),S.setUint16(1,o)}else{h=new Uint8Array(9);const S=new DataView(h.buffer);S.setUint8(0,127),S.setBigUint64(1,BigInt(o))}e.data&&typeof e.data!="string"&&(h[0]|=128),r.enqueue(h),r.enqueue(i)})}})}let Uc;function Qo(e){return e.reduce((r,i)=>r+i.length,0)}function Jo(e,r){if(e[0].length===r)return e.shift();const i=new Uint8Array(r);let o=0;for(let h=0;h<r;h++)i[h]=e[0][o++],o===e[0].length&&(e.shift(),o=0);return e.length&&o<e[0].length&&(e[0]=e[0].slice(o)),i}function cv(e,r){Uc||(Uc=new TextDecoder);const i=[];let o=0,h=-1,S=!1;return new TransformStream({transform(y,a){for(i.push(y);;){if(o===0){if(Qo(i)<1)break;const l=Jo(i,1);S=(l[0]&128)===128,h=l[0]&127,h<126?o=3:h===126?o=1:o=2}else if(o===1){if(Qo(i)<2)break;const l=Jo(i,2);h=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),o=3}else if(o===2){if(Qo(i)<8)break;const l=Jo(i,8),_=new DataView(l.buffer,l.byteOffset,l.length),v=_.getUint32(0);if(v>Math.pow(2,21)-1){a.enqueue(du);break}h=v*Math.pow(2,32)+_.getUint32(4),o=3}else{if(Qo(i)<h)break;const l=Jo(i,h);a.enqueue(ju(S?l:Uc.decode(l),r)),o=0}if(h===0||h>e){a.enqueue(du);break}}}})}const l_=4;function tt(e){if(e)return uv(e)}function uv(e){for(var r in tt.prototype)e[r]=tt.prototype[r];return e}tt.prototype.on=tt.prototype.addEventListener=function(e,r){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(r),this};tt.prototype.once=function(e,r){function i(){this.off(e,i),r.apply(this,arguments)}return i.fn=r,this.on(e,i),this};tt.prototype.off=tt.prototype.removeListener=tt.prototype.removeAllListeners=tt.prototype.removeEventListener=function(e,r){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var i=this._callbacks["$"+e];if(!i)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var o,h=0;h<i.length;h++)if(o=i[h],o===r||o.fn===r){i.splice(h,1);break}return i.length===0&&delete this._callbacks["$"+e],this};tt.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var r=new Array(arguments.length-1),i=this._callbacks["$"+e],o=1;o<arguments.length;o++)r[o-1]=arguments[o];if(i){i=i.slice(0);for(var o=0,h=i.length;o<h;++o)i[o].apply(this,r)}return this};tt.prototype.emitReserved=tt.prototype.emit;tt.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};tt.prototype.hasListeners=function(e){return!!this.listeners(e).length};const Pa=typeof Promise=="function"&&typeof Promise.resolve=="function"?r=>Promise.resolve().then(r):(r,i)=>i(r,0),Wt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),hv="arraybuffer";function c_(e,...r){return r.reduce((i,o)=>(e.hasOwnProperty(o)&&(i[o]=e[o]),i),{})}const dv=Wt.setTimeout,fv=Wt.clearTimeout;function Na(e,r){r.useNativeTimers?(e.setTimeoutFn=dv.bind(Wt),e.clearTimeoutFn=fv.bind(Wt)):(e.setTimeoutFn=Wt.setTimeout.bind(Wt),e.clearTimeoutFn=Wt.clearTimeout.bind(Wt))}const pv=1.33;function _v(e){return typeof e=="string"?gv(e):Math.ceil((e.byteLength||e.size)*pv)}function gv(e){let r=0,i=0;for(let o=0,h=e.length;o<h;o++)r=e.charCodeAt(o),r<128?i+=1:r<2048?i+=2:r<55296||r>=57344?i+=3:(o++,i+=4);return i}function u_(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function mv(e){let r="";for(let i in e)e.hasOwnProperty(i)&&(r.length&&(r+="&"),r+=encodeURIComponent(i)+"="+encodeURIComponent(e[i]));return r}function vv(e){let r={},i=e.split("&");for(let o=0,h=i.length;o<h;o++){let S=i[o].split("=");r[decodeURIComponent(S[0])]=decodeURIComponent(S[1])}return r}class yv extends Error{constructor(r,i,o){super(r),this.description=i,this.context=o,this.type="TransportError"}}class zu extends tt{constructor(r){super(),this.writable=!1,Na(this,r),this.opts=r,this.query=r.query,this.socket=r.socket,this.supportsBinary=!r.forceBase64}onError(r,i,o){return super.emitReserved("error",new yv(r,i,o)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(r){this.readyState==="open"&&this.write(r)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(r){const i=ju(r,this.socket.binaryType);this.onPacket(i)}onPacket(r){super.emitReserved("packet",r)}onClose(r){this.readyState="closed",super.emitReserved("close",r)}pause(r){}createUri(r,i={}){return r+"://"+this._hostname()+this._port()+this.opts.path+this._query(i)}_hostname(){const r=this.opts.hostname;return r.indexOf(":")===-1?r:"["+r+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(r){const i=mv(r);return i.length?"?"+i:""}}class wv extends zu{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(r){this.readyState="pausing";const i=()=>{this.readyState="paused",r()};if(this._polling||!this.writable){let o=0;this._polling&&(o++,this.once("pollComplete",function(){--o||i()})),this.writable||(o++,this.once("drain",function(){--o||i()}))}else i()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(r){const i=o=>{if(this.readyState==="opening"&&o.type==="open"&&this.onOpen(),o.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(o)};av(r,this.socket.binaryType).forEach(i),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const r=()=>{this.write([{type:"close"}])};this.readyState==="open"?r():this.once("open",r)}write(r){this.writable=!1,ov(r,i=>{this.doWrite(i,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const r=this.opts.secure?"https":"http",i=this.query||{};return this.opts.timestampRequests!==!1&&(i[this.opts.timestampParam]=u_()),!this.supportsBinary&&!i.sid&&(i.b64=1),this.createUri(r,i)}}let h_=!1;try{h_=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Sv=h_;function Cv(){}class xv extends wv{constructor(r){if(super(r),typeof location<"u"){const i=location.protocol==="https:";let o=location.port;o||(o=i?"443":"80"),this.xd=typeof location<"u"&&r.hostname!==location.hostname||o!==r.port}}doWrite(r,i){const o=this.request({method:"POST",data:r});o.on("success",i),o.on("error",(h,S)=>{this.onError("xhr post error",h,S)})}doPoll(){const r=this.request();r.on("data",this.onData.bind(this)),r.on("error",(i,o)=>{this.onError("xhr poll error",i,o)}),this.pollXhr=r}}class cr extends tt{constructor(r,i,o){super(),this.createRequest=r,Na(this,o),this._opts=o,this._method=o.method||"GET",this._uri=i,this._data=o.data!==void 0?o.data:null,this._create()}_create(){var r;const i=c_(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");i.xdomain=!!this._opts.xd;const o=this._xhr=this.createRequest(i);try{o.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){o.setDisableHeaderCheck&&o.setDisableHeaderCheck(!0);for(let h in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(h)&&o.setRequestHeader(h,this._opts.extraHeaders[h])}}catch{}if(this._method==="POST")try{o.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{o.setRequestHeader("Accept","*/*")}catch{}(r=this._opts.cookieJar)===null||r===void 0||r.addCookies(o),"withCredentials"in o&&(o.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(o.timeout=this._opts.requestTimeout),o.onreadystatechange=()=>{var h;o.readyState===3&&((h=this._opts.cookieJar)===null||h===void 0||h.parseCookies(o.getResponseHeader("set-cookie"))),o.readyState===4&&(o.status===200||o.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof o.status=="number"?o.status:0)},0))},o.send(this._data)}catch(h){this.setTimeoutFn(()=>{this._onError(h)},0);return}typeof document<"u"&&(this._index=cr.requestsCount++,cr.requests[this._index]=this)}_onError(r){this.emitReserved("error",r,this._xhr),this._cleanup(!0)}_cleanup(r){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Cv,r)try{this._xhr.abort()}catch{}typeof document<"u"&&delete cr.requests[this._index],this._xhr=null}}_onLoad(){const r=this._xhr.responseText;r!==null&&(this.emitReserved("data",r),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}cr.requestsCount=0;cr.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Uf);else if(typeof addEventListener=="function"){const e="onpagehide"in Wt?"pagehide":"unload";addEventListener(e,Uf,!1)}}function Uf(){for(let e in cr.requests)cr.requests.hasOwnProperty(e)&&cr.requests[e].abort()}const bv=(function(){const e=d_({xdomain:!1});return e&&e.responseType!==null})();class Ev extends xv{constructor(r){super(r);const i=r&&r.forceBase64;this.supportsBinary=bv&&!i}request(r={}){return Object.assign(r,{xd:this.xd},this.opts),new cr(d_,this.uri(),r)}}function d_(e){const r=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!r||Sv))return new XMLHttpRequest}catch{}if(!r)try{return new Wt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const f_=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class kv extends zu{get name(){return"websocket"}doOpen(){const r=this.uri(),i=this.opts.protocols,o=f_?{}:c_(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(o.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(r,i,o)}catch(h){return this.emitReserved("error",h)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=r=>this.onClose({description:"websocket connection closed",context:r}),this.ws.onmessage=r=>this.onData(r.data),this.ws.onerror=r=>this.onError("websocket error",r)}write(r){this.writable=!1;for(let i=0;i<r.length;i++){const o=r[i],h=i===r.length-1;Fu(o,this.supportsBinary,S=>{try{this.doWrite(o,S)}catch{}h&&Pa(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const r=this.opts.secure?"wss":"ws",i=this.query||{};return this.opts.timestampRequests&&(i[this.opts.timestampParam]=u_()),this.supportsBinary||(i.b64=1),this.createUri(r,i)}}const Vc=Wt.WebSocket||Wt.MozWebSocket;class Lv extends kv{createSocket(r,i,o){return f_?new Vc(r,i,o):i?new Vc(r,i):new Vc(r)}doWrite(r,i){this.ws.send(i)}}class Rv extends zu{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(r){return this.emitReserved("error",r)}this._transport.closed.then(()=>{this.onClose()}).catch(r=>{this.onError("webtransport error",r)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(r=>{const i=cv(Number.MAX_SAFE_INTEGER,this.socket.binaryType),o=r.readable.pipeThrough(i).getReader(),h=lv();h.readable.pipeTo(r.writable),this._writer=h.writable.getWriter();const S=()=>{o.read().then(({done:a,value:l})=>{a||(this.onPacket(l),S())}).catch(a=>{})};S();const y={type:"open"};this.query.sid&&(y.data=`{"sid":"${this.query.sid}"}`),this._writer.write(y).then(()=>this.onOpen())})})}write(r){this.writable=!1;for(let i=0;i<r.length;i++){const o=r[i],h=i===r.length-1;this._writer.write(o).then(()=>{h&&Pa(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var r;(r=this._transport)===null||r===void 0||r.close()}}const Dv={websocket:Lv,webtransport:Rv,polling:Ev},Av=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Tv=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function fu(e){if(e.length>8e3)throw"URI too long";const r=e,i=e.indexOf("["),o=e.indexOf("]");i!=-1&&o!=-1&&(e=e.substring(0,i)+e.substring(i,o).replace(/:/g,";")+e.substring(o,e.length));let h=Av.exec(e||""),S={},y=14;for(;y--;)S[Tv[y]]=h[y]||"";return i!=-1&&o!=-1&&(S.source=r,S.host=S.host.substring(1,S.host.length-1).replace(/;/g,":"),S.authority=S.authority.replace("[","").replace("]","").replace(/;/g,":"),S.ipv6uri=!0),S.pathNames=Mv(S,S.path),S.queryKey=Pv(S,S.query),S}function Mv(e,r){const i=/\/{2,9}/g,o=r.replace(i,"/").split("/");return(r.slice(0,1)=="/"||r.length===0)&&o.splice(0,1),r.slice(-1)=="/"&&o.splice(o.length-1,1),o}function Pv(e,r){const i={};return r.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(o,h,S){h&&(i[h]=S)}),i}const pu=typeof addEventListener=="function"&&typeof removeEventListener=="function",ua=[];pu&&addEventListener("offline",()=>{ua.forEach(e=>e())},!1);class en extends tt{constructor(r,i){if(super(),this.binaryType=hv,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,r&&typeof r=="object"&&(i=r,r=null),r){const o=fu(r);i.hostname=o.host,i.secure=o.protocol==="https"||o.protocol==="wss",i.port=o.port,o.query&&(i.query=o.query)}else i.host&&(i.hostname=fu(i.host).host);Na(this,i),this.secure=i.secure!=null?i.secure:typeof location<"u"&&location.protocol==="https:",i.hostname&&!i.port&&(i.port=this.secure?"443":"80"),this.hostname=i.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=i.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},i.transports.forEach(o=>{const h=o.prototype.name;this.transports.push(h),this._transportsByName[h]=o}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},i),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=vv(this.opts.query)),pu&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},ua.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(r){const i=Object.assign({},this.opts.query);i.EIO=l_,i.transport=r,this.id&&(i.sid=this.id);const o=Object.assign({},this.opts,{query:i,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[r]);return new this._transportsByName[r](o)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const r=this.opts.rememberUpgrade&&en.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const i=this.createTransport(r);i.open(),this.setTransport(i)}setTransport(r){this.transport&&this.transport.removeAllListeners(),this.transport=r,r.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",i=>this._onClose("transport close",i))}onOpen(){this.readyState="open",en.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(r){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",r),this.emitReserved("heartbeat"),r.type){case"open":this.onHandshake(JSON.parse(r.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const i=new Error("server error");i.code=r.data,this._onError(i);break;case"message":this.emitReserved("data",r.data),this.emitReserved("message",r.data);break}}onHandshake(r){this.emitReserved("handshake",r),this.id=r.sid,this.transport.query.sid=r.sid,this._pingInterval=r.pingInterval,this._pingTimeout=r.pingTimeout,this._maxPayload=r.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const r=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+r,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},r),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const r=this._getWritablePackets();this.transport.send(r),this._prevBufferLen=r.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let i=1;for(let o=0;o<this.writeBuffer.length;o++){const h=this.writeBuffer[o].data;if(h&&(i+=_v(h)),o>0&&i>this._maxPayload)return this.writeBuffer.slice(0,o);i+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const r=Date.now()>this._pingTimeoutTime;return r&&(this._pingTimeoutTime=0,Pa(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),r}write(r,i,o){return this._sendPacket("message",r,i,o),this}send(r,i,o){return this._sendPacket("message",r,i,o),this}_sendPacket(r,i,o,h){if(typeof i=="function"&&(h=i,i=void 0),typeof o=="function"&&(h=o,o=null),this.readyState==="closing"||this.readyState==="closed")return;o=o||{},o.compress=o.compress!==!1;const S={type:r,data:i,options:o};this.emitReserved("packetCreate",S),this.writeBuffer.push(S),h&&this.once("flush",h),this.flush()}close(){const r=()=>{this._onClose("forced close"),this.transport.close()},i=()=>{this.off("upgrade",i),this.off("upgradeError",i),r()},o=()=>{this.once("upgrade",i),this.once("upgradeError",i)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?o():r()}):this.upgrading?o():r()),this}_onError(r){if(en.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",r),this._onClose("transport error",r)}_onClose(r,i){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),pu&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const o=ua.indexOf(this._offlineEventListener);o!==-1&&ua.splice(o,1)}this.readyState="closed",this.id=null,this.emitReserved("close",r,i),this.writeBuffer=[],this._prevBufferLen=0}}}en.protocol=l_;class Nv extends en{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let r=0;r<this._upgrades.length;r++)this._probe(this._upgrades[r])}_probe(r){let i=this.createTransport(r),o=!1;en.priorWebsocketSuccess=!1;const h=()=>{o||(i.send([{type:"ping",data:"probe"}]),i.once("packet",c=>{if(!o)if(c.type==="pong"&&c.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",i),!i)return;en.priorWebsocketSuccess=i.name==="websocket",this.transport.pause(()=>{o||this.readyState!=="closed"&&(v(),this.setTransport(i),i.send([{type:"upgrade"}]),this.emitReserved("upgrade",i),i=null,this.upgrading=!1,this.flush())})}else{const m=new Error("probe error");m.transport=i.name,this.emitReserved("upgradeError",m)}}))};function S(){o||(o=!0,v(),i.close(),i=null)}const y=c=>{const m=new Error("probe error: "+c);m.transport=i.name,S(),this.emitReserved("upgradeError",m)};function a(){y("transport closed")}function l(){y("socket closed")}function _(c){i&&c.name!==i.name&&S()}const v=()=>{i.removeListener("open",h),i.removeListener("error",y),i.removeListener("close",a),this.off("close",l),this.off("upgrading",_)};i.once("open",h),i.once("error",y),i.once("close",a),this.once("close",l),this.once("upgrading",_),this._upgrades.indexOf("webtransport")!==-1&&r!=="webtransport"?this.setTimeoutFn(()=>{o||i.open()},200):i.open()}onHandshake(r){this._upgrades=this._filterUpgrades(r.upgrades),super.onHandshake(r)}_filterUpgrades(r){const i=[];for(let o=0;o<r.length;o++)~this.transports.indexOf(r[o])&&i.push(r[o]);return i}}let Bv=class extends Nv{constructor(r,i={}){const o=typeof r=="object"?r:i;(!o.transports||o.transports&&typeof o.transports[0]=="string")&&(o.transports=(o.transports||["polling","websocket","webtransport"]).map(h=>Dv[h]).filter(h=>!!h)),super(r,o)}};function Iv(e,r="",i){let o=e;i=i||typeof location<"u"&&location,e==null&&(e=i.protocol+"//"+i.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=i.protocol+e:e=i.host+e),/^(https?|wss?):\/\//.test(e)||(typeof i<"u"?e=i.protocol+"//"+e:e="https://"+e),o=fu(e)),o.port||(/^(http|ws)$/.test(o.protocol)?o.port="80":/^(http|ws)s$/.test(o.protocol)&&(o.port="443")),o.path=o.path||"/";const S=o.host.indexOf(":")!==-1?"["+o.host+"]":o.host;return o.id=o.protocol+"://"+S+":"+o.port+r,o.href=o.protocol+"://"+S+(i&&i.port===o.port?"":":"+o.port),o}const Ov=typeof ArrayBuffer=="function",Hv=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,p_=Object.prototype.toString,Fv=typeof Blob=="function"||typeof Blob<"u"&&p_.call(Blob)==="[object BlobConstructor]",jv=typeof File=="function"||typeof File<"u"&&p_.call(File)==="[object FileConstructor]";function $u(e){return Ov&&(e instanceof ArrayBuffer||Hv(e))||Fv&&e instanceof Blob||jv&&e instanceof File}function ha(e,r){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let i=0,o=e.length;i<o;i++)if(ha(e[i]))return!0;return!1}if($u(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return ha(e.toJSON(),!0);for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&ha(e[i]))return!0;return!1}function zv(e){const r=[],i=e.data,o=e;return o.data=_u(i,r),o.attachments=r.length,{packet:o,buffers:r}}function _u(e,r){if(!e)return e;if($u(e)){const i={_placeholder:!0,num:r.length};return r.push(e),i}else if(Array.isArray(e)){const i=new Array(e.length);for(let o=0;o<e.length;o++)i[o]=_u(e[o],r);return i}else if(typeof e=="object"&&!(e instanceof Date)){const i={};for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(i[o]=_u(e[o],r));return i}return e}function $v(e,r){return e.data=gu(e.data,r),delete e.attachments,e}function gu(e,r){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<r.length)return r[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let i=0;i<e.length;i++)e[i]=gu(e[i],r);else if(typeof e=="object")for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(e[i]=gu(e[i],r));return e}const Wv=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Ae;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(Ae||(Ae={}));class Uv{constructor(r){this.replacer=r}encode(r){return(r.type===Ae.EVENT||r.type===Ae.ACK)&&ha(r)?this.encodeAsBinary({type:r.type===Ae.EVENT?Ae.BINARY_EVENT:Ae.BINARY_ACK,nsp:r.nsp,data:r.data,id:r.id}):[this.encodeAsString(r)]}encodeAsString(r){let i=""+r.type;return(r.type===Ae.BINARY_EVENT||r.type===Ae.BINARY_ACK)&&(i+=r.attachments+"-"),r.nsp&&r.nsp!=="/"&&(i+=r.nsp+","),r.id!=null&&(i+=r.id),r.data!=null&&(i+=JSON.stringify(r.data,this.replacer)),i}encodeAsBinary(r){const i=zv(r),o=this.encodeAsString(i.packet),h=i.buffers;return h.unshift(o),h}}class Wu extends tt{constructor(r){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof r=="function"?{reviver:r}:r)}add(r){let i;if(typeof r=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");i=this.decodeString(r);const o=i.type===Ae.BINARY_EVENT;o||i.type===Ae.BINARY_ACK?(i.type=o?Ae.EVENT:Ae.ACK,this.reconstructor=new Vv(i),i.attachments===0&&super.emitReserved("decoded",i)):super.emitReserved("decoded",i)}else if($u(r)||r.base64)if(this.reconstructor)i=this.reconstructor.takeBinaryData(r),i&&(this.reconstructor=null,super.emitReserved("decoded",i));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+r)}decodeString(r){let i=0;const o={type:Number(r.charAt(0))};if(Ae[o.type]===void 0)throw new Error("unknown packet type "+o.type);if(o.type===Ae.BINARY_EVENT||o.type===Ae.BINARY_ACK){const S=i+1;for(;r.charAt(++i)!=="-"&&i!=r.length;);const y=r.substring(S,i);if(y!=Number(y)||r.charAt(i)!=="-")throw new Error("Illegal attachments");const a=Number(y);if(!qv(a)||a<0)throw new Error("Illegal attachments");if(a>this.opts.maxAttachments)throw new Error("too many attachments");o.attachments=a}if(r.charAt(i+1)==="/"){const S=i+1;for(;++i&&!(r.charAt(i)===","||i===r.length););o.nsp=r.substring(S,i)}else o.nsp="/";const h=r.charAt(i+1);if(h!==""&&Number(h)==h){const S=i+1;for(;++i;){const y=r.charAt(i);if(y==null||Number(y)!=y){--i;break}if(i===r.length)break}o.id=Number(r.substring(S,i+1))}if(r.charAt(++i)){const S=this.tryParse(r.substr(i));if(Wu.isPayloadValid(o.type,S))o.data=S;else throw new Error("invalid payload")}return o}tryParse(r){try{return JSON.parse(r,this.opts.reviver)}catch{return!1}}static isPayloadValid(r,i){switch(r){case Ae.CONNECT:return Vf(i);case Ae.DISCONNECT:return i===void 0;case Ae.CONNECT_ERROR:return typeof i=="string"||Vf(i);case Ae.EVENT:case Ae.BINARY_EVENT:return Array.isArray(i)&&(typeof i[0]=="number"||typeof i[0]=="string"&&Wv.indexOf(i[0])===-1);case Ae.ACK:case Ae.BINARY_ACK:return Array.isArray(i)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Vv{constructor(r){this.packet=r,this.buffers=[],this.reconPack=r}takeBinaryData(r){if(this.buffers.push(r),this.buffers.length===this.reconPack.attachments){const i=$v(this.reconPack,this.buffers);return this.finishedReconstruction(),i}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const qv=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};function Vf(e){return Object.prototype.toString.call(e)==="[object Object]"}const Kv=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Wu,Encoder:Uv,get PacketType(){return Ae}},Symbol.toStringTag,{value:"Module"}));function Gt(e,r,i){return e.on(r,i),function(){e.off(r,i)}}const Xv=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class __ extends tt{constructor(r,i,o){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=r,this.nsp=i,o&&o.auth&&(this.auth=o.auth),this._opts=Object.assign({},o),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const r=this.io;this.subs=[Gt(r,"open",this.onopen.bind(this)),Gt(r,"packet",this.onpacket.bind(this)),Gt(r,"error",this.onerror.bind(this)),Gt(r,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...r){return r.unshift("message"),this.emit.apply(this,r),this}emit(r,...i){var o,h,S;if(Xv.hasOwnProperty(r))throw new Error('"'+r.toString()+'" is a reserved event name');if(i.unshift(r),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(i),this;const y={type:Ae.EVENT,data:i};if(y.options={},y.options.compress=this.flags.compress!==!1,typeof i[i.length-1]=="function"){const v=this.ids++,c=i.pop();this._registerAckCallback(v,c),y.id=v}const a=(h=(o=this.io.engine)===null||o===void 0?void 0:o.transport)===null||h===void 0?void 0:h.writable,l=this.connected&&!(!((S=this.io.engine)===null||S===void 0)&&S._hasPingExpired());return this.flags.volatile&&!a||(l?(this.notifyOutgoingListeners(y),this.packet(y)):this.sendBuffer.push(y)),this.flags={},this}_registerAckCallback(r,i){var o;const h=(o=this.flags.timeout)!==null&&o!==void 0?o:this._opts.ackTimeout;if(h===void 0){this.acks[r]=i;return}const S=this.io.setTimeoutFn(()=>{delete this.acks[r];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===r&&this.sendBuffer.splice(a,1);i.call(this,new Error("operation has timed out"))},h),y=(...a)=>{this.io.clearTimeoutFn(S),i.apply(this,a)};y.withError=!0,this.acks[r]=y}emitWithAck(r,...i){return new Promise((o,h)=>{const S=(y,a)=>y?h(y):o(a);S.withError=!0,i.push(S),this.emit(r,...i)})}_addToQueue(r){let i;typeof r[r.length-1]=="function"&&(i=r.pop());const o={id:this._queueSeq++,tryCount:0,pending:!1,args:r,flags:Object.assign({fromQueue:!0},this.flags)};r.push((h,...S)=>(this._queue[0],h!==null?o.tryCount>this._opts.retries&&(this._queue.shift(),i&&i(h)):(this._queue.shift(),i&&i(null,...S)),o.pending=!1,this._drainQueue())),this._queue.push(o),this._drainQueue()}_drainQueue(r=!1){if(!this.connected||this._queue.length===0)return;const i=this._queue[0];i.pending&&!r||(i.pending=!0,i.tryCount++,this.flags=i.flags,this.emit.apply(this,i.args))}packet(r){r.nsp=this.nsp,this.io._packet(r)}onopen(){typeof this.auth=="function"?this.auth(r=>{this._sendConnectPacket(r)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(r){this.packet({type:Ae.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},r):r})}onerror(r){this.connected||this.emitReserved("connect_error",r)}onclose(r,i){this.connected=!1,delete this.id,this.emitReserved("disconnect",r,i),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(r=>{if(!this.sendBuffer.some(o=>String(o.id)===r)){const o=this.acks[r];delete this.acks[r],o.withError&&o.call(this,new Error("socket has been disconnected"))}})}onpacket(r){if(r.nsp===this.nsp)switch(r.type){case Ae.CONNECT:r.data&&r.data.sid?this.onconnect(r.data.sid,r.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ae.EVENT:case Ae.BINARY_EVENT:this.onevent(r);break;case Ae.ACK:case Ae.BINARY_ACK:this.onack(r);break;case Ae.DISCONNECT:this.ondisconnect();break;case Ae.CONNECT_ERROR:this.destroy();const o=new Error(r.data.message);o.data=r.data.data,this.emitReserved("connect_error",o);break}}onevent(r){const i=r.data||[];r.id!=null&&i.push(this.ack(r.id)),this.connected?this.emitEvent(i):this.receiveBuffer.push(Object.freeze(i))}emitEvent(r){if(this._anyListeners&&this._anyListeners.length){const i=this._anyListeners.slice();for(const o of i)o.apply(this,r)}super.emit.apply(this,r),this._pid&&r.length&&typeof r[r.length-1]=="string"&&(this._lastOffset=r[r.length-1])}ack(r){const i=this;let o=!1;return function(...h){o||(o=!0,i.packet({type:Ae.ACK,id:r,data:h}))}}onack(r){const i=this.acks[r.id];typeof i=="function"&&(delete this.acks[r.id],i.withError&&r.data.unshift(null),i.apply(this,r.data))}onconnect(r,i){this.id=r,this.recovered=i&&this._pid===i,this._pid=i,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(r=>this.emitEvent(r)),this.receiveBuffer=[],this.sendBuffer.forEach(r=>{this.notifyOutgoingListeners(r),this.packet(r)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(r=>r()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ae.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(r){return this.flags.compress=r,this}get volatile(){return this.flags.volatile=!0,this}timeout(r){return this.flags.timeout=r,this}onAny(r){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(r),this}prependAny(r){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(r),this}offAny(r){if(!this._anyListeners)return this;if(r){const i=this._anyListeners;for(let o=0;o<i.length;o++)if(r===i[o])return i.splice(o,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(r){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(r),this}prependAnyOutgoing(r){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(r),this}offAnyOutgoing(r){if(!this._anyOutgoingListeners)return this;if(r){const i=this._anyOutgoingListeners;for(let o=0;o<i.length;o++)if(r===i[o])return i.splice(o,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(r){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const i=this._anyOutgoingListeners.slice();for(const o of i)o.apply(this,r.data)}}}function mi(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}mi.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var r=Math.random(),i=Math.floor(r*this.jitter*e);e=(Math.floor(r*10)&1)==0?e-i:e+i}return Math.min(e,this.max)|0};mi.prototype.reset=function(){this.attempts=0};mi.prototype.setMin=function(e){this.ms=e};mi.prototype.setMax=function(e){this.max=e};mi.prototype.setJitter=function(e){this.jitter=e};class mu extends tt{constructor(r,i){var o;super(),this.nsps={},this.subs=[],r&&typeof r=="object"&&(i=r,r=void 0),i=i||{},i.path=i.path||"/socket.io",this.opts=i,Na(this,i),this.reconnection(i.reconnection!==!1),this.reconnectionAttempts(i.reconnectionAttempts||1/0),this.reconnectionDelay(i.reconnectionDelay||1e3),this.reconnectionDelayMax(i.reconnectionDelayMax||5e3),this.randomizationFactor((o=i.randomizationFactor)!==null&&o!==void 0?o:.5),this.backoff=new mi({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(i.timeout==null?2e4:i.timeout),this._readyState="closed",this.uri=r;const h=i.parser||Kv;this.encoder=new h.Encoder,this.decoder=new h.Decoder,this._autoConnect=i.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(r){return arguments.length?(this._reconnection=!!r,r||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(r){return r===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=r,this)}reconnectionDelay(r){var i;return r===void 0?this._reconnectionDelay:(this._reconnectionDelay=r,(i=this.backoff)===null||i===void 0||i.setMin(r),this)}randomizationFactor(r){var i;return r===void 0?this._randomizationFactor:(this._randomizationFactor=r,(i=this.backoff)===null||i===void 0||i.setJitter(r),this)}reconnectionDelayMax(r){var i;return r===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=r,(i=this.backoff)===null||i===void 0||i.setMax(r),this)}timeout(r){return arguments.length?(this._timeout=r,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(r){if(~this._readyState.indexOf("open"))return this;this.engine=new Bv(this.uri,this.opts);const i=this.engine,o=this;this._readyState="opening",this.skipReconnect=!1;const h=Gt(i,"open",function(){o.onopen(),r&&r()}),S=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),r?r(a):this.maybeReconnectOnOpen()},y=Gt(i,"error",S);if(this._timeout!==!1){const a=this._timeout,l=this.setTimeoutFn(()=>{h(),S(new Error("timeout")),i.close()},a);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(h),this.subs.push(y),this}connect(r){return this.open(r)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const r=this.engine;this.subs.push(Gt(r,"ping",this.onping.bind(this)),Gt(r,"data",this.ondata.bind(this)),Gt(r,"error",this.onerror.bind(this)),Gt(r,"close",this.onclose.bind(this)),Gt(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(r){try{this.decoder.add(r)}catch(i){this.onclose("parse error",i)}}ondecoded(r){Pa(()=>{this.emitReserved("packet",r)},this.setTimeoutFn)}onerror(r){this.emitReserved("error",r)}socket(r,i){let o=this.nsps[r];return o?this._autoConnect&&!o.active&&o.connect():(o=new __(this,r,i),this.nsps[r]=o),o}_destroy(r){const i=Object.keys(this.nsps);for(const o of i)if(this.nsps[o].active)return;this._close()}_packet(r){const i=this.encoder.encode(r);for(let o=0;o<i.length;o++)this.engine.write(i[o],r.options)}cleanup(){this.subs.forEach(r=>r()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(r,i){var o;this.cleanup(),(o=this.engine)===null||o===void 0||o.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",r,i),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const r=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const i=this.backoff.duration();this._reconnecting=!0;const o=this.setTimeoutFn(()=>{r.skipReconnect||(this.emitReserved("reconnect_attempt",r.backoff.attempts),!r.skipReconnect&&r.open(h=>{h?(r._reconnecting=!1,r.reconnect(),this.emitReserved("reconnect_error",h)):r.onreconnect()}))},i);this.opts.autoUnref&&o.unref(),this.subs.push(()=>{this.clearTimeoutFn(o)})}}onreconnect(){const r=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",r)}}const cs={};function da(e,r){typeof e=="object"&&(r=e,e=void 0),r=r||{};const i=Iv(e,r.path||"/socket.io"),o=i.source,h=i.id,S=i.path,y=cs[h]&&S in cs[h].nsps,a=r.forceNew||r["force new connection"]||r.multiplex===!1||y;let l;return a?l=new mu(o,r):(cs[h]||(cs[h]=new mu(o,r)),l=cs[h]),i.query&&!r.query&&(r.query=i.queryKey),l.socket(i.path,r)}Object.assign(da,{Manager:mu,Socket:__,io:da,connect:da});function g_(){return new URLSearchParams(window.location.search).get("token")||""}function Er(e,r){const i=g_(),o=e.includes("?")?"&":"?";return fetch(i?`${e}${o}token=${encodeURIComponent(i)}`:e,r)}function Yv(){const e=J.useRef(null),[r,i]=J.useState([]),[o,h]=J.useState([]),[S,y]=J.useState([]),[a,l]=J.useState(""),[_,v]=J.useState([]);return J.useEffect(()=>{const c=g_(),m=da(window.location.origin,{path:"/socket.io",auth:c?{token:c}:void 0,query:c?{token:c}:void 0});return e.current=m,m.on("agents:updated",C=>{Array.isArray(C)&&i(C)}),m.on("messages:new",C=>{h(b=>[C,...b])}),m.on("messages:all",C=>{Array.isArray(C)&&h(C)}),m.on("context:updated",C=>{y(b=>{const x=b.findIndex(f=>f.key===C.key);if(x>=0){const f=[...b];return f[x]=C,f}return[...b,C]})}),m.on("context:removed",({key:C})=>{y(b=>b.filter(x=>x.key!==C))}),m.on("crewmd:updated",C=>{typeof C=="string"&&l(C)}),m.on("agent:cost",C=>{i(b=>b.map(x=>x.id===C.id?{...x,total_cost:C.total_cost,total_tokens:C.total_tokens}:x))}),m.on("file:changed",C=>{v(b=>[C,...b].slice(0,500))}),m.on("file:changes:cleared",()=>{v([])}),Er("/api/agents").then(C=>C.json()).then(C=>{Array.isArray(C)&&i(C)}).catch(()=>{}),Er("/api/file-changes").then(C=>C.json()).then(C=>{Array.isArray(C)&&v(C)}).catch(()=>{}),Er("/api/context").then(C=>C.json()).then(C=>{Array.isArray(C)&&y(C)}).catch(()=>{}),()=>{m.disconnect()}},[]),{socket:e,agents:r,messages:o,contextEntries:S,crewMd:a,setCrewMd:l,fileChanges:_,setFileChanges:v}}const Gv={running:"var(--green)",starting:"var(--yellow)",idle:"var(--yellow)",done:"var(--text-muted)",dead:"var(--red)"};function Qv({agents:e,selectedId:r,onSelect:i,onKill:o,onRemove:h,onRollback:S,onRestart:y}){return O.jsxs("div",{className:"agent-list",children:[O.jsxs("div",{className:"agent-list-header",children:["Agents (",e.length,")"]}),e.length===0&&O.jsx("div",{className:"agent-list-empty",children:"No agents running"}),e.map(a=>O.jsxs("div",{className:`agent-item ${a.id===r?"selected":""}`,onClick:()=>i(a),children:[O.jsxs("div",{className:"agent-item-header",children:[O.jsx("span",{className:"status-dot",style:{background:Gv[a.status]||"var(--text-muted)"}}),O.jsx("span",{className:"agent-name",children:a.name}),O.jsx("span",{className:`agent-service-badge service-${a.service||"claude"}`,children:a.service||"claude"}),a.total_cost>0&&O.jsxs("span",{className:"agent-cost",children:["$",a.total_cost.toFixed(4)]}),O.jsx("span",{className:"agent-status",children:a.status})]}),O.jsx("div",{className:"agent-task",children:a.task}),(a.status==="running"||a.status==="starting")&&O.jsx("div",{className:"agent-running-actions",children:O.jsx("button",{className:"stop-btn",onClick:l=>{l.stopPropagation(),o(a.id)},children:"Stop"})}),(a.status==="done"||a.status==="dead")&&O.jsxs("div",{className:"agent-done-actions",children:[O.jsx("button",{className:"restart-btn",onClick:l=>{l.stopPropagation(),y(a)},children:"Restart"}),a.checkpoint_hash&&O.jsx("button",{className:"rollback-btn",onClick:l=>{l.stopPropagation(),confirm(`Rollback all changes made by "${a.name}"? This will reset files to the state before the agent started.`)&&S(a.id)},children:"Rollback"}),O.jsx("button",{className:"remove-btn",onClick:l=>{l.stopPropagation(),h(a.id)},children:"Remove"})]})]},a.id))]})}function rt(e){if(typeof e=="string"||typeof e=="number")return""+e;let r="";if(Array.isArray(e))for(let i=0,o;i<e.length;i++)(o=rt(e[i]))!==""&&(r+=(r&&" ")+o);else for(let i in e)e[i]&&(r+=(r&&" ")+i);return r}var Jv={value:()=>{}};function Ba(){for(var e=0,r=arguments.length,i={},o;e<r;++e){if(!(o=arguments[e]+"")||o in i||/[\s.]/.test(o))throw new Error("illegal type: "+o);i[o]=[]}return new fa(i)}function fa(e){this._=e}function Zv(e,r){return e.trim().split(/^|\s+/).map(function(i){var o="",h=i.indexOf(".");if(h>=0&&(o=i.slice(h+1),i=i.slice(0,h)),i&&!r.hasOwnProperty(i))throw new Error("unknown type: "+i);return{type:i,name:o}})}fa.prototype=Ba.prototype={constructor:fa,on:function(e,r){var i=this._,o=Zv(e+"",i),h,S=-1,y=o.length;if(arguments.length<2){for(;++S<y;)if((h=(e=o[S]).type)&&(h=ey(i[h],e.name)))return h;return}if(r!=null&&typeof r!="function")throw new Error("invalid callback: "+r);for(;++S<y;)if(h=(e=o[S]).type)i[h]=qf(i[h],e.name,r);else if(r==null)for(h in i)i[h]=qf(i[h],e.name,null);return this},copy:function(){var e={},r=this._;for(var i in r)e[i]=r[i].slice();return new fa(e)},call:function(e,r){if((h=arguments.length-2)>0)for(var i=new Array(h),o=0,h,S;o<h;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(S=this._[e],o=0,h=S.length;o<h;++o)S[o].value.apply(r,i)},apply:function(e,r,i){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],h=0,S=o.length;h<S;++h)o[h].value.apply(r,i)}};function ey(e,r){for(var i=0,o=e.length,h;i<o;++i)if((h=e[i]).name===r)return h.value}function qf(e,r,i){for(var o=0,h=e.length;o<h;++o)if(e[o].name===r){e[o]=Jv,e=e.slice(0,o).concat(e.slice(o+1));break}return i!=null&&e.push({name:r,value:i}),e}var vu="http://www.w3.org/1999/xhtml";const Kf={svg:"http://www.w3.org/2000/svg",xhtml:vu,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ia(e){var r=e+="",i=r.indexOf(":");return i>=0&&(r=e.slice(0,i))!=="xmlns"&&(e=e.slice(i+1)),Kf.hasOwnProperty(r)?{space:Kf[r],local:e}:e}function ty(e){return function(){var r=this.ownerDocument,i=this.namespaceURI;return i===vu&&r.documentElement.namespaceURI===vu?r.createElement(e):r.createElementNS(i,e)}}function ry(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function m_(e){var r=Ia(e);return(r.local?ry:ty)(r)}function ny(){}function Uu(e){return e==null?ny:function(){return this.querySelector(e)}}function iy(e){typeof e!="function"&&(e=Uu(e));for(var r=this._groups,i=r.length,o=new Array(i),h=0;h<i;++h)for(var S=r[h],y=S.length,a=o[h]=new Array(y),l,_,v=0;v<y;++v)(l=S[v])&&(_=e.call(l,l.__data__,v,S))&&("__data__"in l&&(_.__data__=l.__data__),a[v]=_);return new Bt(o,this._parents)}function sy(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function oy(){return[]}function v_(e){return e==null?oy:function(){return this.querySelectorAll(e)}}function ay(e){return function(){return sy(e.apply(this,arguments))}}function ly(e){typeof e=="function"?e=ay(e):e=v_(e);for(var r=this._groups,i=r.length,o=[],h=[],S=0;S<i;++S)for(var y=r[S],a=y.length,l,_=0;_<a;++_)(l=y[_])&&(o.push(e.call(l,l.__data__,_,y)),h.push(l));return new Bt(o,h)}function y_(e){return function(){return this.matches(e)}}function w_(e){return function(r){return r.matches(e)}}var cy=Array.prototype.find;function uy(e){return function(){return cy.call(this.children,e)}}function hy(){return this.firstElementChild}function dy(e){return this.select(e==null?hy:uy(typeof e=="function"?e:w_(e)))}var fy=Array.prototype.filter;function py(){return Array.from(this.children)}function _y(e){return function(){return fy.call(this.children,e)}}function gy(e){return this.selectAll(e==null?py:_y(typeof e=="function"?e:w_(e)))}function my(e){typeof e!="function"&&(e=y_(e));for(var r=this._groups,i=r.length,o=new Array(i),h=0;h<i;++h)for(var S=r[h],y=S.length,a=o[h]=[],l,_=0;_<y;++_)(l=S[_])&&e.call(l,l.__data__,_,S)&&a.push(l);return new Bt(o,this._parents)}function S_(e){return new Array(e.length)}function vy(){return new Bt(this._enter||this._groups.map(S_),this._parents)}function wa(e,r){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=r}wa.prototype={constructor:wa,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,r){return this._parent.insertBefore(e,r)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function yy(e){return function(){return e}}function wy(e,r,i,o,h,S){for(var y=0,a,l=r.length,_=S.length;y<_;++y)(a=r[y])?(a.__data__=S[y],o[y]=a):i[y]=new wa(e,S[y]);for(;y<l;++y)(a=r[y])&&(h[y]=a)}function Sy(e,r,i,o,h,S,y){var a,l,_=new Map,v=r.length,c=S.length,m=new Array(v),C;for(a=0;a<v;++a)(l=r[a])&&(m[a]=C=y.call(l,l.__data__,a,r)+"",_.has(C)?h[a]=l:_.set(C,l));for(a=0;a<c;++a)C=y.call(e,S[a],a,S)+"",(l=_.get(C))?(o[a]=l,l.__data__=S[a],_.delete(C)):i[a]=new wa(e,S[a]);for(a=0;a<v;++a)(l=r[a])&&_.get(m[a])===l&&(h[a]=l)}function Cy(e){return e.__data__}function xy(e,r){if(!arguments.length)return Array.from(this,Cy);var i=r?Sy:wy,o=this._parents,h=this._groups;typeof e!="function"&&(e=yy(e));for(var S=h.length,y=new Array(S),a=new Array(S),l=new Array(S),_=0;_<S;++_){var v=o[_],c=h[_],m=c.length,C=by(e.call(v,v&&v.__data__,_,o)),b=C.length,x=a[_]=new Array(b),f=y[_]=new Array(b),p=l[_]=new Array(m);i(v,c,x,f,p,C,r);for(var d=0,u=0,w,L;d<b;++d)if(w=x[d]){for(d>=u&&(u=d+1);!(L=f[u])&&++u<b;);w._next=L||null}}return y=new Bt(y,o),y._enter=a,y._exit=l,y}function by(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ey(){return new Bt(this._exit||this._groups.map(S_),this._parents)}function ky(e,r,i){var o=this.enter(),h=this,S=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),r!=null&&(h=r(h),h&&(h=h.selection())),i==null?S.remove():i(S),o&&h?o.merge(h).order():h}function Ly(e){for(var r=e.selection?e.selection():e,i=this._groups,o=r._groups,h=i.length,S=o.length,y=Math.min(h,S),a=new Array(h),l=0;l<y;++l)for(var _=i[l],v=o[l],c=_.length,m=a[l]=new Array(c),C,b=0;b<c;++b)(C=_[b]||v[b])&&(m[b]=C);for(;l<h;++l)a[l]=i[l];return new Bt(a,this._parents)}function Ry(){for(var e=this._groups,r=-1,i=e.length;++r<i;)for(var o=e[r],h=o.length-1,S=o[h],y;--h>=0;)(y=o[h])&&(S&&y.compareDocumentPosition(S)^4&&S.parentNode.insertBefore(y,S),S=y);return this}function Dy(e){e||(e=Ay);function r(c,m){return c&&m?e(c.__data__,m.__data__):!c-!m}for(var i=this._groups,o=i.length,h=new Array(o),S=0;S<o;++S){for(var y=i[S],a=y.length,l=h[S]=new Array(a),_,v=0;v<a;++v)(_=y[v])&&(l[v]=_);l.sort(r)}return new Bt(h,this._parents).order()}function Ay(e,r){return e<r?-1:e>r?1:e>=r?0:NaN}function Ty(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function My(){return Array.from(this)}function Py(){for(var e=this._groups,r=0,i=e.length;r<i;++r)for(var o=e[r],h=0,S=o.length;h<S;++h){var y=o[h];if(y)return y}return null}function Ny(){let e=0;for(const r of this)++e;return e}function By(){return!this.node()}function Iy(e){for(var r=this._groups,i=0,o=r.length;i<o;++i)for(var h=r[i],S=0,y=h.length,a;S<y;++S)(a=h[S])&&e.call(a,a.__data__,S,h);return this}function Oy(e){return function(){this.removeAttribute(e)}}function Hy(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Fy(e,r){return function(){this.setAttribute(e,r)}}function jy(e,r){return function(){this.setAttributeNS(e.space,e.local,r)}}function zy(e,r){return function(){var i=r.apply(this,arguments);i==null?this.removeAttribute(e):this.setAttribute(e,i)}}function $y(e,r){return function(){var i=r.apply(this,arguments);i==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,i)}}function Wy(e,r){var i=Ia(e);if(arguments.length<2){var o=this.node();return i.local?o.getAttributeNS(i.space,i.local):o.getAttribute(i)}return this.each((r==null?i.local?Hy:Oy:typeof r=="function"?i.local?$y:zy:i.local?jy:Fy)(i,r))}function C_(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Uy(e){return function(){this.style.removeProperty(e)}}function Vy(e,r,i){return function(){this.style.setProperty(e,r,i)}}function qy(e,r,i){return function(){var o=r.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,i)}}function Ky(e,r,i){return arguments.length>1?this.each((r==null?Uy:typeof r=="function"?qy:Vy)(e,r,i??"")):ci(this.node(),e)}function ci(e,r){return e.style.getPropertyValue(r)||C_(e).getComputedStyle(e,null).getPropertyValue(r)}function Xy(e){return function(){delete this[e]}}function Yy(e,r){return function(){this[e]=r}}function Gy(e,r){return function(){var i=r.apply(this,arguments);i==null?delete this[e]:this[e]=i}}function Qy(e,r){return arguments.length>1?this.each((r==null?Xy:typeof r=="function"?Gy:Yy)(e,r)):this.node()[e]}function x_(e){return e.trim().split(/^|\s+/)}function Vu(e){return e.classList||new b_(e)}function b_(e){this._node=e,this._names=x_(e.getAttribute("class")||"")}b_.prototype={add:function(e){var r=this._names.indexOf(e);r<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var r=this._names.indexOf(e);r>=0&&(this._names.splice(r,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function E_(e,r){for(var i=Vu(e),o=-1,h=r.length;++o<h;)i.add(r[o])}function k_(e,r){for(var i=Vu(e),o=-1,h=r.length;++o<h;)i.remove(r[o])}function Jy(e){return function(){E_(this,e)}}function Zy(e){return function(){k_(this,e)}}function e1(e,r){return function(){(r.apply(this,arguments)?E_:k_)(this,e)}}function t1(e,r){var i=x_(e+"");if(arguments.length<2){for(var o=Vu(this.node()),h=-1,S=i.length;++h<S;)if(!o.contains(i[h]))return!1;return!0}return this.each((typeof r=="function"?e1:r?Jy:Zy)(i,r))}function r1(){this.textContent=""}function n1(e){return function(){this.textContent=e}}function i1(e){return function(){var r=e.apply(this,arguments);this.textContent=r??""}}function s1(e){return arguments.length?this.each(e==null?r1:(typeof e=="function"?i1:n1)(e)):this.node().textContent}function o1(){this.innerHTML=""}function a1(e){return function(){this.innerHTML=e}}function l1(e){return function(){var r=e.apply(this,arguments);this.innerHTML=r??""}}function c1(e){return arguments.length?this.each(e==null?o1:(typeof e=="function"?l1:a1)(e)):this.node().innerHTML}function u1(){this.nextSibling&&this.parentNode.appendChild(this)}function h1(){return this.each(u1)}function d1(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function f1(){return this.each(d1)}function p1(e){var r=typeof e=="function"?e:m_(e);return this.select(function(){return this.appendChild(r.apply(this,arguments))})}function _1(){return null}function g1(e,r){var i=typeof e=="function"?e:m_(e),o=r==null?_1:typeof r=="function"?r:Uu(r);return this.select(function(){return this.insertBefore(i.apply(this,arguments),o.apply(this,arguments)||null)})}function m1(){var e=this.parentNode;e&&e.removeChild(this)}function v1(){return this.each(m1)}function y1(){var e=this.cloneNode(!1),r=this.parentNode;return r?r.insertBefore(e,this.nextSibling):e}function w1(){var e=this.cloneNode(!0),r=this.parentNode;return r?r.insertBefore(e,this.nextSibling):e}function S1(e){return this.select(e?w1:y1)}function C1(e){return arguments.length?this.property("__data__",e):this.node().__data__}function x1(e){return function(r){e.call(this,r,this.__data__)}}function b1(e){return e.trim().split(/^|\s+/).map(function(r){var i="",o=r.indexOf(".");return o>=0&&(i=r.slice(o+1),r=r.slice(0,o)),{type:r,name:i}})}function E1(e){return function(){var r=this.__on;if(r){for(var i=0,o=-1,h=r.length,S;i<h;++i)S=r[i],(!e.type||S.type===e.type)&&S.name===e.name?this.removeEventListener(S.type,S.listener,S.options):r[++o]=S;++o?r.length=o:delete this.__on}}}function k1(e,r,i){return function(){var o=this.__on,h,S=x1(r);if(o){for(var y=0,a=o.length;y<a;++y)if((h=o[y]).type===e.type&&h.name===e.name){this.removeEventListener(h.type,h.listener,h.options),this.addEventListener(h.type,h.listener=S,h.options=i),h.value=r;return}}this.addEventListener(e.type,S,i),h={type:e.type,name:e.name,value:r,listener:S,options:i},o?o.push(h):this.__on=[h]}}function L1(e,r,i){var o=b1(e+""),h,S=o.length,y;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,_=a.length,v;l<_;++l)for(h=0,v=a[l];h<S;++h)if((y=o[h]).type===v.type&&y.name===v.name)return v.value}return}for(a=r?k1:E1,h=0;h<S;++h)this.each(a(o[h],r,i));return this}function L_(e,r,i){var o=C_(e),h=o.CustomEvent;typeof h=="function"?h=new h(r,i):(h=o.document.createEvent("Event"),i?(h.initEvent(r,i.bubbles,i.cancelable),h.detail=i.detail):h.initEvent(r,!1,!1)),e.dispatchEvent(h)}function R1(e,r){return function(){return L_(this,e,r)}}function D1(e,r){return function(){return L_(this,e,r.apply(this,arguments))}}function A1(e,r){return this.each((typeof r=="function"?D1:R1)(e,r))}function*T1(){for(var e=this._groups,r=0,i=e.length;r<i;++r)for(var o=e[r],h=0,S=o.length,y;h<S;++h)(y=o[h])&&(yield y)}var R_=[null];function Bt(e,r){this._groups=e,this._parents=r}function Ls(){return new Bt([[document.documentElement]],R_)}function M1(){return this}Bt.prototype=Ls.prototype={constructor:Bt,select:iy,selectAll:ly,selectChild:dy,selectChildren:gy,filter:my,data:xy,enter:vy,exit:Ey,join:ky,merge:Ly,selection:M1,order:Ry,sort:Dy,call:Ty,nodes:My,node:Py,size:Ny,empty:By,each:Iy,attr:Wy,style:Ky,property:Qy,classed:t1,text:s1,html:c1,raise:h1,lower:f1,append:p1,insert:g1,remove:v1,clone:S1,datum:C1,on:L1,dispatch:A1,[Symbol.iterator]:T1};function Nt(e){return typeof e=="string"?new Bt([[document.querySelector(e)]],[document.documentElement]):new Bt([[e]],R_)}function P1(e){let r;for(;r=e.sourceEvent;)e=r;return e}function Qt(e,r){if(e=P1(e),r===void 0&&(r=e.currentTarget),r){var i=r.ownerSVGElement||r;if(i.createSVGPoint){var o=i.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(r.getScreenCTM().inverse()),[o.x,o.y]}if(r.getBoundingClientRect){var h=r.getBoundingClientRect();return[e.clientX-h.left-r.clientLeft,e.clientY-h.top-r.clientTop]}}return[e.pageX,e.pageY]}const N1={passive:!1},ms={capture:!0,passive:!1};function qc(e){e.stopImmediatePropagation()}function ai(e){e.preventDefault(),e.stopImmediatePropagation()}function D_(e){var r=e.document.documentElement,i=Nt(e).on("dragstart.drag",ai,ms);"onselectstart"in r?i.on("selectstart.drag",ai,ms):(r.__noselect=r.style.MozUserSelect,r.style.MozUserSelect="none")}function A_(e,r){var i=e.document.documentElement,o=Nt(e).on("dragstart.drag",null);r&&(o.on("click.drag",ai,ms),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in i?o.on("selectstart.drag",null):(i.style.MozUserSelect=i.__noselect,delete i.__noselect)}const Zo=e=>()=>e;function yu(e,{sourceEvent:r,subject:i,target:o,identifier:h,active:S,x:y,y:a,dx:l,dy:_,dispatch:v}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:r,enumerable:!0,configurable:!0},subject:{value:i,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:h,enumerable:!0,configurable:!0},active:{value:S,enumerable:!0,configurable:!0},x:{value:y,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:_,enumerable:!0,configurable:!0},_:{value:v}})}yu.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function B1(e){return!e.ctrlKey&&!e.button}function I1(){return this.parentNode}function O1(e,r){return r??{x:e.x,y:e.y}}function H1(){return navigator.maxTouchPoints||"ontouchstart"in this}function T_(){var e=B1,r=I1,i=O1,o=H1,h={},S=Ba("start","drag","end"),y=0,a,l,_,v,c=0;function m(w){w.on("mousedown.drag",C).filter(o).on("touchstart.drag",f).on("touchmove.drag",p,N1).on("touchend.drag touchcancel.drag",d).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function C(w,L){if(!(v||!e.call(this,w,L))){var R=u(this,r.call(this,w,L),w,L,"mouse");R&&(Nt(w.view).on("mousemove.drag",b,ms).on("mouseup.drag",x,ms),D_(w.view),qc(w),_=!1,a=w.clientX,l=w.clientY,R("start",w))}}function b(w){if(ai(w),!_){var L=w.clientX-a,R=w.clientY-l;_=L*L+R*R>c}h.mouse("drag",w)}function x(w){Nt(w.view).on("mousemove.drag mouseup.drag",null),A_(w.view,_),ai(w),h.mouse("end",w)}function f(w,L){if(e.call(this,w,L)){var R=w.changedTouches,D=r.call(this,w,L),k=R.length,M,W;for(M=0;M<k;++M)(W=u(this,D,w,L,R[M].identifier,R[M]))&&(qc(w),W("start",w,R[M]))}}function p(w){var L=w.changedTouches,R=L.length,D,k;for(D=0;D<R;++D)(k=h[L[D].identifier])&&(ai(w),k("drag",w,L[D]))}function d(w){var L=w.changedTouches,R=L.length,D,k;for(v&&clearTimeout(v),v=setTimeout(function(){v=null},500),D=0;D<R;++D)(k=h[L[D].identifier])&&(qc(w),k("end",w,L[D]))}function u(w,L,R,D,k,M){var W=S.copy(),z=Qt(M||R,L),j,N,I;if((I=i.call(w,new yu("beforestart",{sourceEvent:R,target:m,identifier:k,active:y,x:z[0],y:z[1],dx:0,dy:0,dispatch:W}),D))!=null)return j=I.x-z[0]||0,N=I.y-z[1]||0,function q(U,K,V){var T=z,B;switch(U){case"start":h[k]=q,B=y++;break;case"end":delete h[k],--y;case"drag":z=Qt(V||K,L),B=y;break}W.call(U,w,new yu(U,{sourceEvent:K,subject:I,target:m,identifier:k,active:B,x:z[0]+j,y:z[1]+N,dx:z[0]-T[0],dy:z[1]-T[1],dispatch:W}),D)}}return m.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Zo(!!w),m):e},m.container=function(w){return arguments.length?(r=typeof w=="function"?w:Zo(w),m):r},m.subject=function(w){return arguments.length?(i=typeof w=="function"?w:Zo(w),m):i},m.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:Zo(!!w),m):o},m.on=function(){var w=S.on.apply(S,arguments);return w===S?m:w},m.clickDistance=function(w){return arguments.length?(c=(w=+w)*w,m):Math.sqrt(c)},m}function qu(e,r,i){e.prototype=r.prototype=i,i.constructor=e}function M_(e,r){var i=Object.create(e.prototype);for(var o in r)i[o]=r[o];return i}function Rs(){}var vs=.7,Sa=1/vs,li="\\s*([+-]?\\d+)\\s*",ys="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ur="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",F1=/^#([0-9a-f]{3,8})$/,j1=new RegExp(`^rgb\\(${li},${li},${li}\\)$`),z1=new RegExp(`^rgb\\(${ur},${ur},${ur}\\)$`),$1=new RegExp(`^rgba\\(${li},${li},${li},${ys}\\)$`),W1=new RegExp(`^rgba\\(${ur},${ur},${ur},${ys}\\)$`),U1=new RegExp(`^hsl\\(${ys},${ur},${ur}\\)$`),V1=new RegExp(`^hsla\\(${ys},${ur},${ur},${ys}\\)$`),Xf={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};qu(Rs,bn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Yf,formatHex:Yf,formatHex8:q1,formatHsl:K1,formatRgb:Gf,toString:Gf});function Yf(){return this.rgb().formatHex()}function q1(){return this.rgb().formatHex8()}function K1(){return P_(this).formatHsl()}function Gf(){return this.rgb().formatRgb()}function bn(e){var r,i;return e=(e+"").trim().toLowerCase(),(r=F1.exec(e))?(i=r[1].length,r=parseInt(r[1],16),i===6?Qf(r):i===3?new Lt(r>>8&15|r>>4&240,r>>4&15|r&240,(r&15)<<4|r&15,1):i===8?ea(r>>24&255,r>>16&255,r>>8&255,(r&255)/255):i===4?ea(r>>12&15|r>>8&240,r>>8&15|r>>4&240,r>>4&15|r&240,((r&15)<<4|r&15)/255):null):(r=j1.exec(e))?new Lt(r[1],r[2],r[3],1):(r=z1.exec(e))?new Lt(r[1]*255/100,r[2]*255/100,r[3]*255/100,1):(r=$1.exec(e))?ea(r[1],r[2],r[3],r[4]):(r=W1.exec(e))?ea(r[1]*255/100,r[2]*255/100,r[3]*255/100,r[4]):(r=U1.exec(e))?ep(r[1],r[2]/100,r[3]/100,1):(r=V1.exec(e))?ep(r[1],r[2]/100,r[3]/100,r[4]):Xf.hasOwnProperty(e)?Qf(Xf[e]):e==="transparent"?new Lt(NaN,NaN,NaN,0):null}function Qf(e){return new Lt(e>>16&255,e>>8&255,e&255,1)}function ea(e,r,i,o){return o<=0&&(e=r=i=NaN),new Lt(e,r,i,o)}function X1(e){return e instanceof Rs||(e=bn(e)),e?(e=e.rgb(),new Lt(e.r,e.g,e.b,e.opacity)):new Lt}function wu(e,r,i,o){return arguments.length===1?X1(e):new Lt(e,r,i,o??1)}function Lt(e,r,i,o){this.r=+e,this.g=+r,this.b=+i,this.opacity=+o}qu(Lt,wu,M_(Rs,{brighter(e){return e=e==null?Sa:Math.pow(Sa,e),new Lt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?vs:Math.pow(vs,e),new Lt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Lt(Cn(this.r),Cn(this.g),Cn(this.b),Ca(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:Jf,formatHex:Jf,formatHex8:Y1,formatRgb:Zf,toString:Zf}));function Jf(){return`#${Sn(this.r)}${Sn(this.g)}${Sn(this.b)}`}function Y1(){return`#${Sn(this.r)}${Sn(this.g)}${Sn(this.b)}${Sn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Zf(){const e=Ca(this.opacity);return`${e===1?"rgb(":"rgba("}${Cn(this.r)}, ${Cn(this.g)}, ${Cn(this.b)}${e===1?")":`, ${e})`}`}function Ca(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Cn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Sn(e){return e=Cn(e),(e<16?"0":"")+e.toString(16)}function ep(e,r,i,o){return o<=0?e=r=i=NaN:i<=0||i>=1?e=r=NaN:r<=0&&(e=NaN),new Jt(e,r,i,o)}function P_(e){if(e instanceof Jt)return new Jt(e.h,e.s,e.l,e.opacity);if(e instanceof Rs||(e=bn(e)),!e)return new Jt;if(e instanceof Jt)return e;e=e.rgb();var r=e.r/255,i=e.g/255,o=e.b/255,h=Math.min(r,i,o),S=Math.max(r,i,o),y=NaN,a=S-h,l=(S+h)/2;return a?(r===S?y=(i-o)/a+(i<o)*6:i===S?y=(o-r)/a+2:y=(r-i)/a+4,a/=l<.5?S+h:2-S-h,y*=60):a=l>0&&l<1?0:y,new Jt(y,a,l,e.opacity)}function G1(e,r,i,o){return arguments.length===1?P_(e):new Jt(e,r,i,o??1)}function Jt(e,r,i,o){this.h=+e,this.s=+r,this.l=+i,this.opacity=+o}qu(Jt,G1,M_(Rs,{brighter(e){return e=e==null?Sa:Math.pow(Sa,e),new Jt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?vs:Math.pow(vs,e),new Jt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,r=isNaN(e)||isNaN(this.s)?0:this.s,i=this.l,o=i+(i<.5?i:1-i)*r,h=2*i-o;return new Lt(Kc(e>=240?e-240:e+120,h,o),Kc(e,h,o),Kc(e<120?e+240:e-120,h,o),this.opacity)},clamp(){return new Jt(tp(this.h),ta(this.s),ta(this.l),Ca(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=Ca(this.opacity);return`${e===1?"hsl(":"hsla("}${tp(this.h)}, ${ta(this.s)*100}%, ${ta(this.l)*100}%${e===1?")":`, ${e})`}`}}));function tp(e){return e=(e||0)%360,e<0?e+360:e}function ta(e){return Math.max(0,Math.min(1,e||0))}function Kc(e,r,i){return(e<60?r+(i-r)*e/60:e<180?i:e<240?r+(i-r)*(240-e)/60:r)*255}const Ku=e=>()=>e;function Q1(e,r){return function(i){return e+i*r}}function J1(e,r,i){return e=Math.pow(e,i),r=Math.pow(r,i)-e,i=1/i,function(o){return Math.pow(e+o*r,i)}}function Z1(e){return(e=+e)==1?N_:function(r,i){return i-r?J1(r,i,e):Ku(isNaN(r)?i:r)}}function N_(e,r){var i=r-e;return i?Q1(e,i):Ku(isNaN(e)?r:e)}const xa=(function e(r){var i=Z1(r);function o(h,S){var y=i((h=wu(h)).r,(S=wu(S)).r),a=i(h.g,S.g),l=i(h.b,S.b),_=N_(h.opacity,S.opacity);return function(v){return h.r=y(v),h.g=a(v),h.b=l(v),h.opacity=_(v),h+""}}return o.gamma=e,o})(1);function ew(e,r){r||(r=[]);var i=e?Math.min(r.length,e.length):0,o=r.slice(),h;return function(S){for(h=0;h<i;++h)o[h]=e[h]*(1-S)+r[h]*S;return o}}function tw(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function rw(e,r){var i=r?r.length:0,o=e?Math.min(i,e.length):0,h=new Array(o),S=new Array(i),y;for(y=0;y<o;++y)h[y]=_s(e[y],r[y]);for(;y<i;++y)S[y]=r[y];return function(a){for(y=0;y<o;++y)S[y]=h[y](a);return S}}function nw(e,r){var i=new Date;return e=+e,r=+r,function(o){return i.setTime(e*(1-o)+r*o),i}}function lr(e,r){return e=+e,r=+r,function(i){return e*(1-i)+r*i}}function iw(e,r){var i={},o={},h;(e===null||typeof e!="object")&&(e={}),(r===null||typeof r!="object")&&(r={});for(h in r)h in e?i[h]=_s(e[h],r[h]):o[h]=r[h];return function(S){for(h in i)o[h]=i[h](S);return o}}var Su=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Xc=new RegExp(Su.source,"g");function sw(e){return function(){return e}}function ow(e){return function(r){return e(r)+""}}function B_(e,r){var i=Su.lastIndex=Xc.lastIndex=0,o,h,S,y=-1,a=[],l=[];for(e=e+"",r=r+"";(o=Su.exec(e))&&(h=Xc.exec(r));)(S=h.index)>i&&(S=r.slice(i,S),a[y]?a[y]+=S:a[++y]=S),(o=o[0])===(h=h[0])?a[y]?a[y]+=h:a[++y]=h:(a[++y]=null,l.push({i:y,x:lr(o,h)})),i=Xc.lastIndex;return i<r.length&&(S=r.slice(i),a[y]?a[y]+=S:a[++y]=S),a.length<2?l[0]?ow(l[0].x):sw(r):(r=l.length,function(_){for(var v=0,c;v<r;++v)a[(c=l[v]).i]=c.x(_);return a.join("")})}function _s(e,r){var i=typeof r,o;return r==null||i==="boolean"?Ku(r):(i==="number"?lr:i==="string"?(o=bn(r))?(r=o,xa):B_:r instanceof bn?xa:r instanceof Date?nw:tw(r)?ew:Array.isArray(r)?rw:typeof r.valueOf!="function"&&typeof r.toString!="function"||isNaN(r)?iw:lr)(e,r)}var rp=180/Math.PI,Cu={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function I_(e,r,i,o,h,S){var y,a,l;return(y=Math.sqrt(e*e+r*r))&&(e/=y,r/=y),(l=e*i+r*o)&&(i-=e*l,o-=r*l),(a=Math.sqrt(i*i+o*o))&&(i/=a,o/=a,l/=a),e*o<r*i&&(e=-e,r=-r,l=-l,y=-y),{translateX:h,translateY:S,rotate:Math.atan2(r,e)*rp,skewX:Math.atan(l)*rp,scaleX:y,scaleY:a}}var ra;function aw(e){const r=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return r.isIdentity?Cu:I_(r.a,r.b,r.c,r.d,r.e,r.f)}function lw(e){return e==null||(ra||(ra=document.createElementNS("http://www.w3.org/2000/svg","g")),ra.setAttribute("transform",e),!(e=ra.transform.baseVal.consolidate()))?Cu:(e=e.matrix,I_(e.a,e.b,e.c,e.d,e.e,e.f))}function O_(e,r,i,o){function h(_){return _.length?_.pop()+" ":""}function S(_,v,c,m,C,b){if(_!==c||v!==m){var x=C.push("translate(",null,r,null,i);b.push({i:x-4,x:lr(_,c)},{i:x-2,x:lr(v,m)})}else(c||m)&&C.push("translate("+c+r+m+i)}function y(_,v,c,m){_!==v?(_-v>180?v+=360:v-_>180&&(_+=360),m.push({i:c.push(h(c)+"rotate(",null,o)-2,x:lr(_,v)})):v&&c.push(h(c)+"rotate("+v+o)}function a(_,v,c,m){_!==v?m.push({i:c.push(h(c)+"skewX(",null,o)-2,x:lr(_,v)}):v&&c.push(h(c)+"skewX("+v+o)}function l(_,v,c,m,C,b){if(_!==c||v!==m){var x=C.push(h(C)+"scale(",null,",",null,")");b.push({i:x-4,x:lr(_,c)},{i:x-2,x:lr(v,m)})}else(c!==1||m!==1)&&C.push(h(C)+"scale("+c+","+m+")")}return function(_,v){var c=[],m=[];return _=e(_),v=e(v),S(_.translateX,_.translateY,v.translateX,v.translateY,c,m),y(_.rotate,v.rotate,c,m),a(_.skewX,v.skewX,c,m),l(_.scaleX,_.scaleY,v.scaleX,v.scaleY,c,m),_=v=null,function(C){for(var b=-1,x=m.length,f;++b<x;)c[(f=m[b]).i]=f.x(C);return c.join("")}}}var cw=O_(aw,"px, ","px)","deg)"),uw=O_(lw,", ",")",")"),hw=1e-12;function np(e){return((e=Math.exp(e))+1/e)/2}function dw(e){return((e=Math.exp(e))-1/e)/2}function fw(e){return((e=Math.exp(2*e))-1)/(e+1)}const pa=(function e(r,i,o){function h(S,y){var a=S[0],l=S[1],_=S[2],v=y[0],c=y[1],m=y[2],C=v-a,b=c-l,x=C*C+b*b,f,p;if(x<hw)p=Math.log(m/_)/r,f=function(D){return[a+D*C,l+D*b,_*Math.exp(r*D*p)]};else{var d=Math.sqrt(x),u=(m*m-_*_+o*x)/(2*_*i*d),w=(m*m-_*_-o*x)/(2*m*i*d),L=Math.log(Math.sqrt(u*u+1)-u),R=Math.log(Math.sqrt(w*w+1)-w);p=(R-L)/r,f=function(D){var k=D*p,M=np(L),W=_/(i*d)*(M*fw(r*k+L)-dw(L));return[a+W*C,l+W*b,_*M/np(r*k+L)]}}return f.duration=p*1e3*r/Math.SQRT2,f}return h.rho=function(S){var y=Math.max(.001,+S),a=y*y,l=a*a;return e(y,a,l)},h})(Math.SQRT2,2,4);var ui=0,fs=0,us=0,H_=1e3,ba,ps,Ea=0,En=0,Oa=0,ws=typeof performance=="object"&&performance.now?performance:Date,F_=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Xu(){return En||(F_(pw),En=ws.now()+Oa)}function pw(){En=0}function ka(){this._call=this._time=this._next=null}ka.prototype=j_.prototype={constructor:ka,restart:function(e,r,i){if(typeof e!="function")throw new TypeError("callback is not a function");i=(i==null?Xu():+i)+(r==null?0:+r),!this._next&&ps!==this&&(ps?ps._next=this:ba=this,ps=this),this._call=e,this._time=i,xu()},stop:function(){this._call&&(this._call=null,this._time=1/0,xu())}};function j_(e,r,i){var o=new ka;return o.restart(e,r,i),o}function _w(){Xu(),++ui;for(var e=ba,r;e;)(r=En-e._time)>=0&&e._call.call(void 0,r),e=e._next;--ui}function ip(){En=(Ea=ws.now())+Oa,ui=fs=0;try{_w()}finally{ui=0,mw(),En=0}}function gw(){var e=ws.now(),r=e-Ea;r>H_&&(Oa-=r,Ea=e)}function mw(){for(var e,r=ba,i,o=1/0;r;)r._call?(o>r._time&&(o=r._time),e=r,r=r._next):(i=r._next,r._next=null,r=e?e._next=i:ba=i);ps=e,xu(o)}function xu(e){if(!ui){fs&&(fs=clearTimeout(fs));var r=e-En;r>24?(e<1/0&&(fs=setTimeout(ip,e-ws.now()-Oa)),us&&(us=clearInterval(us))):(us||(Ea=ws.now(),us=setInterval(gw,H_)),ui=1,F_(ip))}}function sp(e,r,i){var o=new ka;return r=r==null?0:+r,o.restart(h=>{o.stop(),e(h+r)},r,i),o}var vw=Ba("start","end","cancel","interrupt"),yw=[],z_=0,op=1,bu=2,_a=3,ap=4,Eu=5,ga=6;function Ha(e,r,i,o,h,S){var y=e.__transition;if(!y)e.__transition={};else if(i in y)return;ww(e,i,{name:r,index:o,group:h,on:vw,tween:yw,time:S.time,delay:S.delay,duration:S.duration,ease:S.ease,timer:null,state:z_})}function Yu(e,r){var i=tr(e,r);if(i.state>z_)throw new Error("too late; already scheduled");return i}function fr(e,r){var i=tr(e,r);if(i.state>_a)throw new Error("too late; already running");return i}function tr(e,r){var i=e.__transition;if(!i||!(i=i[r]))throw new Error("transition not found");return i}function ww(e,r,i){var o=e.__transition,h;o[r]=i,i.timer=j_(S,0,i.time);function S(_){i.state=op,i.timer.restart(y,i.delay,i.time),i.delay<=_&&y(_-i.delay)}function y(_){var v,c,m,C;if(i.state!==op)return l();for(v in o)if(C=o[v],C.name===i.name){if(C.state===_a)return sp(y);C.state===ap?(C.state=ga,C.timer.stop(),C.on.call("interrupt",e,e.__data__,C.index,C.group),delete o[v]):+v<r&&(C.state=ga,C.timer.stop(),C.on.call("cancel",e,e.__data__,C.index,C.group),delete o[v])}if(sp(function(){i.state===_a&&(i.state=ap,i.timer.restart(a,i.delay,i.time),a(_))}),i.state=bu,i.on.call("start",e,e.__data__,i.index,i.group),i.state===bu){for(i.state=_a,h=new Array(m=i.tween.length),v=0,c=-1;v<m;++v)(C=i.tween[v].value.call(e,e.__data__,i.index,i.group))&&(h[++c]=C);h.length=c+1}}function a(_){for(var v=_<i.duration?i.ease.call(null,_/i.duration):(i.timer.restart(l),i.state=Eu,1),c=-1,m=h.length;++c<m;)h[c].call(e,v);i.state===Eu&&(i.on.call("end",e,e.__data__,i.index,i.group),l())}function l(){i.state=ga,i.timer.stop(),delete o[r];for(var _ in o)return;delete e.__transition}}function ma(e,r){var i=e.__transition,o,h,S=!0,y;if(i){r=r==null?null:r+"";for(y in i){if((o=i[y]).name!==r){S=!1;continue}h=o.state>bu&&o.state<Eu,o.state=ga,o.timer.stop(),o.on.call(h?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete i[y]}S&&delete e.__transition}}function Sw(e){return this.each(function(){ma(this,e)})}function Cw(e,r){var i,o;return function(){var h=fr(this,e),S=h.tween;if(S!==i){o=i=S;for(var y=0,a=o.length;y<a;++y)if(o[y].name===r){o=o.slice(),o.splice(y,1);break}}h.tween=o}}function xw(e,r,i){var o,h;if(typeof i!="function")throw new Error;return function(){var S=fr(this,e),y=S.tween;if(y!==o){h=(o=y).slice();for(var a={name:r,value:i},l=0,_=h.length;l<_;++l)if(h[l].name===r){h[l]=a;break}l===_&&h.push(a)}S.tween=h}}function bw(e,r){var i=this._id;if(e+="",arguments.length<2){for(var o=tr(this.node(),i).tween,h=0,S=o.length,y;h<S;++h)if((y=o[h]).name===e)return y.value;return null}return this.each((r==null?Cw:xw)(i,e,r))}function Gu(e,r,i){var o=e._id;return e.each(function(){var h=fr(this,o);(h.value||(h.value={}))[r]=i.apply(this,arguments)}),function(h){return tr(h,o).value[r]}}function $_(e,r){var i;return(typeof r=="number"?lr:r instanceof bn?xa:(i=bn(r))?(r=i,xa):B_)(e,r)}function Ew(e){return function(){this.removeAttribute(e)}}function kw(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Lw(e,r,i){var o,h=i+"",S;return function(){var y=this.getAttribute(e);return y===h?null:y===o?S:S=r(o=y,i)}}function Rw(e,r,i){var o,h=i+"",S;return function(){var y=this.getAttributeNS(e.space,e.local);return y===h?null:y===o?S:S=r(o=y,i)}}function Dw(e,r,i){var o,h,S;return function(){var y,a=i(this),l;return a==null?void this.removeAttribute(e):(y=this.getAttribute(e),l=a+"",y===l?null:y===o&&l===h?S:(h=l,S=r(o=y,a)))}}function Aw(e,r,i){var o,h,S;return function(){var y,a=i(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(y=this.getAttributeNS(e.space,e.local),l=a+"",y===l?null:y===o&&l===h?S:(h=l,S=r(o=y,a)))}}function Tw(e,r){var i=Ia(e),o=i==="transform"?uw:$_;return this.attrTween(e,typeof r=="function"?(i.local?Aw:Dw)(i,o,Gu(this,"attr."+e,r)):r==null?(i.local?kw:Ew)(i):(i.local?Rw:Lw)(i,o,r))}function Mw(e,r){return function(i){this.setAttribute(e,r.call(this,i))}}function Pw(e,r){return function(i){this.setAttributeNS(e.space,e.local,r.call(this,i))}}function Nw(e,r){var i,o;function h(){var S=r.apply(this,arguments);return S!==o&&(i=(o=S)&&Pw(e,S)),i}return h._value=r,h}function Bw(e,r){var i,o;function h(){var S=r.apply(this,arguments);return S!==o&&(i=(o=S)&&Mw(e,S)),i}return h._value=r,h}function Iw(e,r){var i="attr."+e;if(arguments.length<2)return(i=this.tween(i))&&i._value;if(r==null)return this.tween(i,null);if(typeof r!="function")throw new Error;var o=Ia(e);return this.tween(i,(o.local?Nw:Bw)(o,r))}function Ow(e,r){return function(){Yu(this,e).delay=+r.apply(this,arguments)}}function Hw(e,r){return r=+r,function(){Yu(this,e).delay=r}}function Fw(e){var r=this._id;return arguments.length?this.each((typeof e=="function"?Ow:Hw)(r,e)):tr(this.node(),r).delay}function jw(e,r){return function(){fr(this,e).duration=+r.apply(this,arguments)}}function zw(e,r){return r=+r,function(){fr(this,e).duration=r}}function $w(e){var r=this._id;return arguments.length?this.each((typeof e=="function"?jw:zw)(r,e)):tr(this.node(),r).duration}function Ww(e,r){if(typeof r!="function")throw new Error;return function(){fr(this,e).ease=r}}function Uw(e){var r=this._id;return arguments.length?this.each(Ww(r,e)):tr(this.node(),r).ease}function Vw(e,r){return function(){var i=r.apply(this,arguments);if(typeof i!="function")throw new Error;fr(this,e).ease=i}}function qw(e){if(typeof e!="function")throw new Error;return this.each(Vw(this._id,e))}function Kw(e){typeof e!="function"&&(e=y_(e));for(var r=this._groups,i=r.length,o=new Array(i),h=0;h<i;++h)for(var S=r[h],y=S.length,a=o[h]=[],l,_=0;_<y;++_)(l=S[_])&&e.call(l,l.__data__,_,S)&&a.push(l);return new Lr(o,this._parents,this._name,this._id)}function Xw(e){if(e._id!==this._id)throw new Error;for(var r=this._groups,i=e._groups,o=r.length,h=i.length,S=Math.min(o,h),y=new Array(o),a=0;a<S;++a)for(var l=r[a],_=i[a],v=l.length,c=y[a]=new Array(v),m,C=0;C<v;++C)(m=l[C]||_[C])&&(c[C]=m);for(;a<o;++a)y[a]=r[a];return new Lr(y,this._parents,this._name,this._id)}function Yw(e){return(e+"").trim().split(/^|\s+/).every(function(r){var i=r.indexOf(".");return i>=0&&(r=r.slice(0,i)),!r||r==="start"})}function Gw(e,r,i){var o,h,S=Yw(r)?Yu:fr;return function(){var y=S(this,e),a=y.on;a!==o&&(h=(o=a).copy()).on(r,i),y.on=h}}function Qw(e,r){var i=this._id;return arguments.length<2?tr(this.node(),i).on.on(e):this.each(Gw(i,e,r))}function Jw(e){return function(){var r=this.parentNode;for(var i in this.__transition)if(+i!==e)return;r&&r.removeChild(this)}}function Zw(){return this.on("end.remove",Jw(this._id))}function eS(e){var r=this._name,i=this._id;typeof e!="function"&&(e=Uu(e));for(var o=this._groups,h=o.length,S=new Array(h),y=0;y<h;++y)for(var a=o[y],l=a.length,_=S[y]=new Array(l),v,c,m=0;m<l;++m)(v=a[m])&&(c=e.call(v,v.__data__,m,a))&&("__data__"in v&&(c.__data__=v.__data__),_[m]=c,Ha(_[m],r,i,m,_,tr(v,i)));return new Lr(S,this._parents,r,i)}function tS(e){var r=this._name,i=this._id;typeof e!="function"&&(e=v_(e));for(var o=this._groups,h=o.length,S=[],y=[],a=0;a<h;++a)for(var l=o[a],_=l.length,v,c=0;c<_;++c)if(v=l[c]){for(var m=e.call(v,v.__data__,c,l),C,b=tr(v,i),x=0,f=m.length;x<f;++x)(C=m[x])&&Ha(C,r,i,x,m,b);S.push(m),y.push(v)}return new Lr(S,y,r,i)}var rS=Ls.prototype.constructor;function nS(){return new rS(this._groups,this._parents)}function iS(e,r){var i,o,h;return function(){var S=ci(this,e),y=(this.style.removeProperty(e),ci(this,e));return S===y?null:S===i&&y===o?h:h=r(i=S,o=y)}}function W_(e){return function(){this.style.removeProperty(e)}}function sS(e,r,i){var o,h=i+"",S;return function(){var y=ci(this,e);return y===h?null:y===o?S:S=r(o=y,i)}}function oS(e,r,i){var o,h,S;return function(){var y=ci(this,e),a=i(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),ci(this,e))),y===l?null:y===o&&l===h?S:(h=l,S=r(o=y,a))}}function aS(e,r){var i,o,h,S="style."+r,y="end."+S,a;return function(){var l=fr(this,e),_=l.on,v=l.value[S]==null?a||(a=W_(r)):void 0;(_!==i||h!==v)&&(o=(i=_).copy()).on(y,h=v),l.on=o}}function lS(e,r,i){var o=(e+="")=="transform"?cw:$_;return r==null?this.styleTween(e,iS(e,o)).on("end.style."+e,W_(e)):typeof r=="function"?this.styleTween(e,oS(e,o,Gu(this,"style."+e,r))).each(aS(this._id,e)):this.styleTween(e,sS(e,o,r),i).on("end.style."+e,null)}function cS(e,r,i){return function(o){this.style.setProperty(e,r.call(this,o),i)}}function uS(e,r,i){var o,h;function S(){var y=r.apply(this,arguments);return y!==h&&(o=(h=y)&&cS(e,y,i)),o}return S._value=r,S}function hS(e,r,i){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(r==null)return this.tween(o,null);if(typeof r!="function")throw new Error;return this.tween(o,uS(e,r,i??""))}function dS(e){return function(){this.textContent=e}}function fS(e){return function(){var r=e(this);this.textContent=r??""}}function pS(e){return this.tween("text",typeof e=="function"?fS(Gu(this,"text",e)):dS(e==null?"":e+""))}function _S(e){return function(r){this.textContent=e.call(this,r)}}function gS(e){var r,i;function o(){var h=e.apply(this,arguments);return h!==i&&(r=(i=h)&&_S(h)),r}return o._value=e,o}function mS(e){var r="text";if(arguments.length<1)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,gS(e))}function vS(){for(var e=this._name,r=this._id,i=U_(),o=this._groups,h=o.length,S=0;S<h;++S)for(var y=o[S],a=y.length,l,_=0;_<a;++_)if(l=y[_]){var v=tr(l,r);Ha(l,e,i,_,y,{time:v.time+v.delay+v.duration,delay:0,duration:v.duration,ease:v.ease})}return new Lr(o,this._parents,e,i)}function yS(){var e,r,i=this,o=i._id,h=i.size();return new Promise(function(S,y){var a={value:y},l={value:function(){--h===0&&S()}};i.each(function(){var _=fr(this,o),v=_.on;v!==e&&(r=(e=v).copy(),r._.cancel.push(a),r._.interrupt.push(a),r._.end.push(l)),_.on=r}),h===0&&S()})}var wS=0;function Lr(e,r,i,o){this._groups=e,this._parents=r,this._name=i,this._id=o}function U_(){return++wS}var xr=Ls.prototype;Lr.prototype={constructor:Lr,select:eS,selectAll:tS,selectChild:xr.selectChild,selectChildren:xr.selectChildren,filter:Kw,merge:Xw,selection:nS,transition:vS,call:xr.call,nodes:xr.nodes,node:xr.node,size:xr.size,empty:xr.empty,each:xr.each,on:Qw,attr:Tw,attrTween:Iw,style:lS,styleTween:hS,text:pS,textTween:mS,remove:Zw,tween:bw,delay:Fw,duration:$w,ease:Uw,easeVarying:qw,end:yS,[Symbol.iterator]:xr[Symbol.iterator]};function SS(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var CS={time:null,delay:0,duration:250,ease:SS};function xS(e,r){for(var i;!(i=e.__transition)||!(i=i[r]);)if(!(e=e.parentNode))throw new Error(`transition ${r} not found`);return i}function bS(e){var r,i;e instanceof Lr?(r=e._id,e=e._name):(r=U_(),(i=CS).time=Xu(),e=e==null?null:e+"");for(var o=this._groups,h=o.length,S=0;S<h;++S)for(var y=o[S],a=y.length,l,_=0;_<a;++_)(l=y[_])&&Ha(l,e,r,_,y,i||xS(l,r));return new Lr(o,this._parents,e,r)}Ls.prototype.interrupt=Sw;Ls.prototype.transition=bS;const na=e=>()=>e;function ES(e,{sourceEvent:r,target:i,transform:o,dispatch:h}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:r,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:h}})}function kr(e,r,i){this.k=e,this.x=r,this.y=i}kr.prototype={constructor:kr,scale:function(e){return e===1?this:new kr(this.k*e,this.x,this.y)},translate:function(e,r){return e===0&r===0?this:new kr(this.k,this.x+this.k*e,this.y+this.k*r)},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 Fa=new kr(1,0,0);V_.prototype=kr.prototype;function V_(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Fa;return e.__zoom}function Yc(e){e.stopImmediatePropagation()}function hs(e){e.preventDefault(),e.stopImmediatePropagation()}function kS(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function LS(){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 lp(){return this.__zoom||Fa}function RS(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function DS(){return navigator.maxTouchPoints||"ontouchstart"in this}function AS(e,r,i){var o=e.invertX(r[0][0])-i[0][0],h=e.invertX(r[1][0])-i[1][0],S=e.invertY(r[0][1])-i[0][1],y=e.invertY(r[1][1])-i[1][1];return e.translate(h>o?(o+h)/2:Math.min(0,o)||Math.max(0,h),y>S?(S+y)/2:Math.min(0,S)||Math.max(0,y))}function q_(){var e=kS,r=LS,i=AS,o=RS,h=DS,S=[0,1/0],y=[[-1/0,-1/0],[1/0,1/0]],a=250,l=pa,_=Ba("start","zoom","end"),v,c,m,C=500,b=150,x=0,f=10;function p(I){I.property("__zoom",lp).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",W).filter(h).on("touchstart.zoom",z).on("touchmove.zoom",j).on("touchend.zoom touchcancel.zoom",N).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}p.transform=function(I,q,U,K){var V=I.selection?I.selection():I;V.property("__zoom",lp),I!==V?L(I,q,U,K):V.interrupt().each(function(){R(this,arguments).event(K).start().zoom(null,typeof q=="function"?q.apply(this,arguments):q).end()})},p.scaleBy=function(I,q,U,K){p.scaleTo(I,function(){var V=this.__zoom.k,T=typeof q=="function"?q.apply(this,arguments):q;return V*T},U,K)},p.scaleTo=function(I,q,U,K){p.transform(I,function(){var V=r.apply(this,arguments),T=this.__zoom,B=U==null?w(V):typeof U=="function"?U.apply(this,arguments):U,P=T.invert(B),F=typeof q=="function"?q.apply(this,arguments):q;return i(u(d(T,F),B,P),V,y)},U,K)},p.translateBy=function(I,q,U,K){p.transform(I,function(){return i(this.__zoom.translate(typeof q=="function"?q.apply(this,arguments):q,typeof U=="function"?U.apply(this,arguments):U),r.apply(this,arguments),y)},null,K)},p.translateTo=function(I,q,U,K,V){p.transform(I,function(){var T=r.apply(this,arguments),B=this.__zoom,P=K==null?w(T):typeof K=="function"?K.apply(this,arguments):K;return i(Fa.translate(P[0],P[1]).scale(B.k).translate(typeof q=="function"?-q.apply(this,arguments):-q,typeof U=="function"?-U.apply(this,arguments):-U),T,y)},K,V)};function d(I,q){return q=Math.max(S[0],Math.min(S[1],q)),q===I.k?I:new kr(q,I.x,I.y)}function u(I,q,U){var K=q[0]-U[0]*I.k,V=q[1]-U[1]*I.k;return K===I.x&&V===I.y?I:new kr(I.k,K,V)}function w(I){return[(+I[0][0]+ +I[1][0])/2,(+I[0][1]+ +I[1][1])/2]}function L(I,q,U,K){I.on("start.zoom",function(){R(this,arguments).event(K).start()}).on("interrupt.zoom end.zoom",function(){R(this,arguments).event(K).end()}).tween("zoom",function(){var V=this,T=arguments,B=R(V,T).event(K),P=r.apply(V,T),F=U==null?w(P):typeof U=="function"?U.apply(V,T):U,Y=Math.max(P[1][0]-P[0][0],P[1][1]-P[0][1]),Z=V.__zoom,ie=typeof q=="function"?q.apply(V,T):q,ae=l(Z.invert(F).concat(Y/Z.k),ie.invert(F).concat(Y/ie.k));return function(X){if(X===1)X=ie;else{var H=ae(X),re=Y/H[2];X=new kr(re,F[0]-H[0]*re,F[1]-H[1]*re)}B.zoom(null,X)}})}function R(I,q,U){return!U&&I.__zooming||new D(I,q)}function D(I,q){this.that=I,this.args=q,this.active=0,this.sourceEvent=null,this.extent=r.apply(I,q),this.taps=0}D.prototype={event:function(I){return I&&(this.sourceEvent=I),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(I,q){return this.mouse&&I!=="mouse"&&(this.mouse[1]=q.invert(this.mouse[0])),this.touch0&&I!=="touch"&&(this.touch0[1]=q.invert(this.touch0[0])),this.touch1&&I!=="touch"&&(this.touch1[1]=q.invert(this.touch1[0])),this.that.__zoom=q,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(I){var q=Nt(this.that).datum();_.call(I,this.that,new ES(I,{sourceEvent:this.sourceEvent,target:p,transform:this.that.__zoom,dispatch:_}),q)}};function k(I,...q){if(!e.apply(this,arguments))return;var U=R(this,q).event(I),K=this.__zoom,V=Math.max(S[0],Math.min(S[1],K.k*Math.pow(2,o.apply(this,arguments)))),T=Qt(I);if(U.wheel)(U.mouse[0][0]!==T[0]||U.mouse[0][1]!==T[1])&&(U.mouse[1]=K.invert(U.mouse[0]=T)),clearTimeout(U.wheel);else{if(K.k===V)return;U.mouse=[T,K.invert(T)],ma(this),U.start()}hs(I),U.wheel=setTimeout(B,b),U.zoom("mouse",i(u(d(K,V),U.mouse[0],U.mouse[1]),U.extent,y));function B(){U.wheel=null,U.end()}}function M(I,...q){if(m||!e.apply(this,arguments))return;var U=I.currentTarget,K=R(this,q,!0).event(I),V=Nt(I.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",Y,!0),T=Qt(I,U),B=I.clientX,P=I.clientY;D_(I.view),Yc(I),K.mouse=[T,this.__zoom.invert(T)],ma(this),K.start();function F(Z){if(hs(Z),!K.moved){var ie=Z.clientX-B,ae=Z.clientY-P;K.moved=ie*ie+ae*ae>x}K.event(Z).zoom("mouse",i(u(K.that.__zoom,K.mouse[0]=Qt(Z,U),K.mouse[1]),K.extent,y))}function Y(Z){V.on("mousemove.zoom mouseup.zoom",null),A_(Z.view,K.moved),hs(Z),K.event(Z).end()}}function W(I,...q){if(e.apply(this,arguments)){var U=this.__zoom,K=Qt(I.changedTouches?I.changedTouches[0]:I,this),V=U.invert(K),T=U.k*(I.shiftKey?.5:2),B=i(u(d(U,T),K,V),r.apply(this,q),y);hs(I),a>0?Nt(this).transition().duration(a).call(L,B,K,I):Nt(this).call(p.transform,B,K,I)}}function z(I,...q){if(e.apply(this,arguments)){var U=I.touches,K=U.length,V=R(this,q,I.changedTouches.length===K).event(I),T,B,P,F;for(Yc(I),B=0;B<K;++B)P=U[B],F=Qt(P,this),F=[F,this.__zoom.invert(F),P.identifier],V.touch0?!V.touch1&&V.touch0[2]!==F[2]&&(V.touch1=F,V.taps=0):(V.touch0=F,T=!0,V.taps=1+!!v);v&&(v=clearTimeout(v)),T&&(V.taps<2&&(c=F[0],v=setTimeout(function(){v=null},C)),ma(this),V.start())}}function j(I,...q){if(this.__zooming){var U=R(this,q).event(I),K=I.changedTouches,V=K.length,T,B,P,F;for(hs(I),T=0;T<V;++T)B=K[T],P=Qt(B,this),U.touch0&&U.touch0[2]===B.identifier?U.touch0[0]=P:U.touch1&&U.touch1[2]===B.identifier&&(U.touch1[0]=P);if(B=U.that.__zoom,U.touch1){var Y=U.touch0[0],Z=U.touch0[1],ie=U.touch1[0],ae=U.touch1[1],X=(X=ie[0]-Y[0])*X+(X=ie[1]-Y[1])*X,H=(H=ae[0]-Z[0])*H+(H=ae[1]-Z[1])*H;B=d(B,Math.sqrt(X/H)),P=[(Y[0]+ie[0])/2,(Y[1]+ie[1])/2],F=[(Z[0]+ae[0])/2,(Z[1]+ae[1])/2]}else if(U.touch0)P=U.touch0[0],F=U.touch0[1];else return;U.zoom("touch",i(u(B,P,F),U.extent,y))}}function N(I,...q){if(this.__zooming){var U=R(this,q).event(I),K=I.changedTouches,V=K.length,T,B;for(Yc(I),m&&clearTimeout(m),m=setTimeout(function(){m=null},C),T=0;T<V;++T)B=K[T],U.touch0&&U.touch0[2]===B.identifier?delete U.touch0:U.touch1&&U.touch1[2]===B.identifier&&delete U.touch1;if(U.touch1&&!U.touch0&&(U.touch0=U.touch1,delete U.touch1),U.touch0)U.touch0[1]=this.__zoom.invert(U.touch0[0]);else if(U.end(),U.taps===2&&(B=Qt(B,this),Math.hypot(c[0]-B[0],c[1]-B[1])<f)){var P=Nt(this).on("dblclick.zoom");P&&P.apply(this,arguments)}}}return p.wheelDelta=function(I){return arguments.length?(o=typeof I=="function"?I:na(+I),p):o},p.filter=function(I){return arguments.length?(e=typeof I=="function"?I:na(!!I),p):e},p.touchable=function(I){return arguments.length?(h=typeof I=="function"?I:na(!!I),p):h},p.extent=function(I){return arguments.length?(r=typeof I=="function"?I:na([[+I[0][0],+I[0][1]],[+I[1][0],+I[1][1]]]),p):r},p.scaleExtent=function(I){return arguments.length?(S[0]=+I[0],S[1]=+I[1],p):[S[0],S[1]]},p.translateExtent=function(I){return arguments.length?(y[0][0]=+I[0][0],y[1][0]=+I[1][0],y[0][1]=+I[0][1],y[1][1]=+I[1][1],p):[[y[0][0],y[0][1]],[y[1][0],y[1][1]]]},p.constrain=function(I){return arguments.length?(i=I,p):i},p.duration=function(I){return arguments.length?(a=+I,p):a},p.interpolate=function(I){return arguments.length?(l=I,p):l},p.on=function(){var I=_.on.apply(_,arguments);return I===_?p:I},p.clickDistance=function(I){return arguments.length?(x=(I=+I)*I,p):Math.sqrt(x)},p.tapDistance=function(I){return arguments.length?(f=+I,p):f},p}const dr={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:r,sourceHandle:i,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?i:o}", edge id: ${r}.`,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."},Ss=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],K_=["Enter"," ","Escape"],X_={"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:r,y:i})=>`Moved selected node ${e}. New position, x: ${r}, y: ${i}`,"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 hi;(function(e){e.Strict="strict",e.Loose="loose"})(hi||(hi={}));var xn;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(xn||(xn={}));var Cs;(function(e){e.Partial="partial",e.Full="full"})(Cs||(Cs={}));const Y_={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Zr;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Zr||(Zr={}));var La;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(La||(La={}));var xe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(xe||(xe={}));const cp={[xe.Left]:xe.Right,[xe.Right]:xe.Left,[xe.Top]:xe.Bottom,[xe.Bottom]:xe.Top};function G_(e){return e===null?null:e?"valid":"invalid"}const Q_=e=>"id"in e&&"source"in e&&"target"in e,TS=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Qu=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Ds=(e,r=[0,0])=>{const{width:i,height:o}=Rr(e),h=e.origin??r,S=i*h[0],y=o*h[1];return{x:e.position.x-S,y:e.position.y-y}},MS=(e,r={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const i=e.reduce((o,h)=>{const S=typeof h=="string";let y=!r.nodeLookup&&!S?h:void 0;r.nodeLookup&&(y=S?r.nodeLookup.get(h):Qu(h)?h:r.nodeLookup.get(h.id));const a=y?Ra(y,r.nodeOrigin):{x:0,y:0,x2:0,y2:0};return ja(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return za(i)},As=(e,r={})=>{let i={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(h=>{(r.filter===void 0||r.filter(h))&&(i=ja(i,Ra(h)),o=!0)}),o?za(i):{x:0,y:0,width:0,height:0}},Ju=(e,r,[i,o,h]=[0,0,1],S=!1,y=!1)=>{const a={...Ms(r,[i,o,h]),width:r.width/h,height:r.height/h},l=[];for(const _ of e.values()){const{measured:v,selectable:c=!0,hidden:m=!1}=_;if(y&&!c||m)continue;const C=v.width??_.width??_.initialWidth??null,b=v.height??_.height??_.initialHeight??null,x=xs(a,fi(_)),f=(C??0)*(b??0),p=S&&x>0;(!_.internals.handleBounds||p||x>=f||_.dragging)&&l.push(_)}return l},PS=(e,r)=>{const i=new Set;return e.forEach(o=>{i.add(o.id)}),r.filter(o=>i.has(o.source)||i.has(o.target))};function NS(e,r){const i=new Map,o=r!=null&&r.nodes?new Set(r.nodes.map(h=>h.id)):null;return e.forEach(h=>{h.measured.width&&h.measured.height&&((r==null?void 0:r.includeHiddenNodes)||!h.hidden)&&(!o||o.has(h.id))&&i.set(h.id,h)}),i}async function BS({nodes:e,width:r,height:i,panZoom:o,minZoom:h,maxZoom:S},y){if(e.size===0)return Promise.resolve(!0);const a=NS(e,y),l=As(a),_=Zu(l,r,i,(y==null?void 0:y.minZoom)??h,(y==null?void 0:y.maxZoom)??S,(y==null?void 0:y.padding)??.1);return await o.setViewport(_,{duration:y==null?void 0:y.duration,ease:y==null?void 0:y.ease,interpolate:y==null?void 0:y.interpolate}),Promise.resolve(!0)}function J_({nodeId:e,nextPosition:r,nodeLookup:i,nodeOrigin:o=[0,0],nodeExtent:h,onError:S}){const y=i.get(e),a=y.parentId?i.get(y.parentId):void 0,{x:l,y:_}=a?a.internals.positionAbsolute:{x:0,y:0},v=y.origin??o;let c=y.extent||h;if(y.extent==="parent"&&!y.expandParent)if(!a)S==null||S("005",dr.error005());else{const C=a.measured.width,b=a.measured.height;C&&b&&(c=[[l,_],[l+C,_+b]])}else a&&pi(y.extent)&&(c=[[y.extent[0][0]+l,y.extent[0][1]+_],[y.extent[1][0]+l,y.extent[1][1]+_]]);const m=pi(c)?kn(r,c,y.measured):r;return(y.measured.width===void 0||y.measured.height===void 0)&&(S==null||S("015",dr.error015())),{position:{x:m.x-l+(y.measured.width??0)*v[0],y:m.y-_+(y.measured.height??0)*v[1]},positionAbsolute:m}}async function IS({nodesToRemove:e=[],edgesToRemove:r=[],nodes:i,edges:o,onBeforeDelete:h}){const S=new Set(e.map(m=>m.id)),y=[];for(const m of i){if(m.deletable===!1)continue;const C=S.has(m.id),b=!C&&m.parentId&&y.find(x=>x.id===m.parentId);(C||b)&&y.push(m)}const a=new Set(r.map(m=>m.id)),l=o.filter(m=>m.deletable!==!1),v=PS(y,l);for(const m of l)a.has(m.id)&&!v.find(b=>b.id===m.id)&&v.push(m);if(!h)return{edges:v,nodes:y};const c=await h({nodes:y,edges:v});return typeof c=="boolean"?c?{edges:v,nodes:y}:{edges:[],nodes:[]}:c}const di=(e,r=0,i=1)=>Math.min(Math.max(e,r),i),kn=(e={x:0,y:0},r,i)=>({x:di(e.x,r[0][0],r[1][0]-((i==null?void 0:i.width)??0)),y:di(e.y,r[0][1],r[1][1]-((i==null?void 0:i.height)??0))});function Z_(e,r,i){const{width:o,height:h}=Rr(i),{x:S,y}=i.internals.positionAbsolute;return kn(e,[[S,y],[S+o,y+h]],r)}const up=(e,r,i)=>e<r?di(Math.abs(e-r),1,r)/r:e>i?-di(Math.abs(e-i),1,r)/r:0,eg=(e,r,i=15,o=40)=>{const h=up(e.x,o,r.width-o)*i,S=up(e.y,o,r.height-o)*i;return[h,S]},ja=(e,r)=>({x:Math.min(e.x,r.x),y:Math.min(e.y,r.y),x2:Math.max(e.x2,r.x2),y2:Math.max(e.y2,r.y2)}),ku=({x:e,y:r,width:i,height:o})=>({x:e,y:r,x2:e+i,y2:r+o}),za=({x:e,y:r,x2:i,y2:o})=>({x:e,y:r,width:i-e,height:o-r}),fi=(e,r=[0,0])=>{var h,S;const{x:i,y:o}=Qu(e)?e.internals.positionAbsolute:Ds(e,r);return{x:i,y:o,width:((h=e.measured)==null?void 0:h.width)??e.width??e.initialWidth??0,height:((S=e.measured)==null?void 0:S.height)??e.height??e.initialHeight??0}},Ra=(e,r=[0,0])=>{var h,S;const{x:i,y:o}=Qu(e)?e.internals.positionAbsolute:Ds(e,r);return{x:i,y:o,x2:i+(((h=e.measured)==null?void 0:h.width)??e.width??e.initialWidth??0),y2:o+(((S=e.measured)==null?void 0:S.height)??e.height??e.initialHeight??0)}},tg=(e,r)=>za(ja(ku(e),ku(r))),xs=(e,r)=>{const i=Math.max(0,Math.min(e.x+e.width,r.x+r.width)-Math.max(e.x,r.x)),o=Math.max(0,Math.min(e.y+e.height,r.y+r.height)-Math.max(e.y,r.y));return Math.ceil(i*o)},hp=e=>Zt(e.width)&&Zt(e.height)&&Zt(e.x)&&Zt(e.y),Zt=e=>!isNaN(e)&&isFinite(e),OS=(e,r)=>{},Ts=(e,r=[1,1])=>({x:r[0]*Math.round(e.x/r[0]),y:r[1]*Math.round(e.y/r[1])}),Ms=({x:e,y:r},[i,o,h],S=!1,y=[1,1])=>{const a={x:(e-i)/h,y:(r-o)/h};return S?Ts(a,y):a},Da=({x:e,y:r},[i,o,h])=>({x:e*h+i,y:r*h+o});function ii(e,r){if(typeof e=="number")return Math.floor((r-r/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const i=parseFloat(e);if(!Number.isNaN(i))return Math.floor(i)}if(typeof e=="string"&&e.endsWith("%")){const i=parseFloat(e);if(!Number.isNaN(i))return Math.floor(r*i*.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 HS(e,r,i){if(typeof e=="string"||typeof e=="number"){const o=ii(e,i),h=ii(e,r);return{top:o,right:h,bottom:o,left:h,x:h*2,y:o*2}}if(typeof e=="object"){const o=ii(e.top??e.y??0,i),h=ii(e.bottom??e.y??0,i),S=ii(e.left??e.x??0,r),y=ii(e.right??e.x??0,r);return{top:o,right:y,bottom:h,left:S,x:S+y,y:o+h}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function FS(e,r,i,o,h,S){const{x:y,y:a}=Da(e,[r,i,o]),{x:l,y:_}=Da({x:e.x+e.width,y:e.y+e.height},[r,i,o]),v=h-l,c=S-_;return{left:Math.floor(y),top:Math.floor(a),right:Math.floor(v),bottom:Math.floor(c)}}const Zu=(e,r,i,o,h,S)=>{const y=HS(S,r,i),a=(r-y.x)/e.width,l=(i-y.y)/e.height,_=Math.min(a,l),v=di(_,o,h),c=e.x+e.width/2,m=e.y+e.height/2,C=r/2-c*v,b=i/2-m*v,x=FS(e,C,b,v,r,i),f={left:Math.min(x.left-y.left,0),top:Math.min(x.top-y.top,0),right:Math.min(x.right-y.right,0),bottom:Math.min(x.bottom-y.bottom,0)};return{x:C-f.left+f.right,y:b-f.top+f.bottom,zoom:v}},bs=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function pi(e){return e!=null&&e!=="parent"}function Rr(e){var r,i;return{width:((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}}function rg(e){var r,i;return(((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth)!==void 0&&(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight)!==void 0}function ng(e,r={width:0,height:0},i,o,h){const S={...e},y=o.get(i);if(y){const a=y.origin||h;S.x+=y.internals.positionAbsolute.x-(r.width??0)*a[0],S.y+=y.internals.positionAbsolute.y-(r.height??0)*a[1]}return S}function dp(e,r){if(e.size!==r.size)return!1;for(const i of e)if(!r.has(i))return!1;return!0}function jS(){let e,r;return{promise:new Promise((o,h)=>{e=o,r=h}),resolve:e,reject:r}}function zS(e){return{...X_,...e||{}}}function gs(e,{snapGrid:r=[0,0],snapToGrid:i=!1,transform:o,containerBounds:h}){const{x:S,y}=er(e),a=Ms({x:S-((h==null?void 0:h.left)??0),y:y-((h==null?void 0:h.top)??0)},o),{x:l,y:_}=i?Ts(a,r):a;return{xSnapped:l,ySnapped:_,...a}}const eh=e=>({width:e.offsetWidth,height:e.offsetHeight}),ig=e=>{var r;return((r=e==null?void 0:e.getRootNode)==null?void 0:r.call(e))||(window==null?void 0:window.document)},$S=["INPUT","SELECT","TEXTAREA"];function sg(e){var o,h;const r=((h=(o=e.composedPath)==null?void 0:o.call(e))==null?void 0:h[0])||e.target;return(r==null?void 0:r.nodeType)!==1?!1:$S.includes(r.nodeName)||r.hasAttribute("contenteditable")||!!r.closest(".nokey")}const og=e=>"clientX"in e,er=(e,r)=>{var S,y;const i=og(e),o=i?e.clientX:(S=e.touches)==null?void 0:S[0].clientX,h=i?e.clientY:(y=e.touches)==null?void 0:y[0].clientY;return{x:o-((r==null?void 0:r.left)??0),y:h-((r==null?void 0:r.top)??0)}},fp=(e,r,i,o,h)=>{const S=r.querySelectorAll(`.${e}`);return!S||!S.length?null:Array.from(S).map(y=>{const a=y.getBoundingClientRect();return{id:y.getAttribute("data-handleid"),type:e,nodeId:h,position:y.getAttribute("data-handlepos"),x:(a.left-i.left)/o,y:(a.top-i.top)/o,...eh(y)}})};function ag({sourceX:e,sourceY:r,targetX:i,targetY:o,sourceControlX:h,sourceControlY:S,targetControlX:y,targetControlY:a}){const l=e*.125+h*.375+y*.375+i*.125,_=r*.125+S*.375+a*.375+o*.125,v=Math.abs(l-e),c=Math.abs(_-r);return[l,_,v,c]}function ia(e,r){return e>=0?.5*e:r*25*Math.sqrt(-e)}function pp({pos:e,x1:r,y1:i,x2:o,y2:h,c:S}){switch(e){case xe.Left:return[r-ia(r-o,S),i];case xe.Right:return[r+ia(o-r,S),i];case xe.Top:return[r,i-ia(i-h,S)];case xe.Bottom:return[r,i+ia(h-i,S)]}}function lg({sourceX:e,sourceY:r,sourcePosition:i=xe.Bottom,targetX:o,targetY:h,targetPosition:S=xe.Top,curvature:y=.25}){const[a,l]=pp({pos:i,x1:e,y1:r,x2:o,y2:h,c:y}),[_,v]=pp({pos:S,x1:o,y1:h,x2:e,y2:r,c:y}),[c,m,C,b]=ag({sourceX:e,sourceY:r,targetX:o,targetY:h,sourceControlX:a,sourceControlY:l,targetControlX:_,targetControlY:v});return[`M${e},${r} C${a},${l} ${_},${v} ${o},${h}`,c,m,C,b]}function cg({sourceX:e,sourceY:r,targetX:i,targetY:o}){const h=Math.abs(i-e)/2,S=i<e?i+h:i-h,y=Math.abs(o-r)/2,a=o<r?o+y:o-y;return[S,a,h,y]}function WS({sourceNode:e,targetNode:r,selected:i=!1,zIndex:o=0,elevateOnSelect:h=!1,zIndexMode:S="basic"}){if(S==="manual")return o;const y=h&&i?o+1e3:o,a=Math.max(e.parentId||h&&e.selected?e.internals.z:0,r.parentId||h&&r.selected?r.internals.z:0);return y+a}function US({sourceNode:e,targetNode:r,width:i,height:o,transform:h}){const S=ja(Ra(e),Ra(r));S.x===S.x2&&(S.x2+=1),S.y===S.y2&&(S.y2+=1);const y={x:-h[0]/h[2],y:-h[1]/h[2],width:i/h[2],height:o/h[2]};return xs(y,za(S))>0}const VS=({source:e,sourceHandle:r,target:i,targetHandle:o})=>`xy-edge__${e}${r||""}-${i}${o||""}`,qS=(e,r)=>r.some(i=>i.source===e.source&&i.target===e.target&&(i.sourceHandle===e.sourceHandle||!i.sourceHandle&&!e.sourceHandle)&&(i.targetHandle===e.targetHandle||!i.targetHandle&&!e.targetHandle)),KS=(e,r,i={})=>{if(!e.source||!e.target)return r;const o=i.getEdgeId||VS;let h;return Q_(e)?h={...e}:h={...e,id:o(e)},qS(h,r)?r:(h.sourceHandle===null&&delete h.sourceHandle,h.targetHandle===null&&delete h.targetHandle,r.concat(h))};function ug({sourceX:e,sourceY:r,targetX:i,targetY:o}){const[h,S,y,a]=cg({sourceX:e,sourceY:r,targetX:i,targetY:o});return[`M ${e},${r}L ${i},${o}`,h,S,y,a]}const _p={[xe.Left]:{x:-1,y:0},[xe.Right]:{x:1,y:0},[xe.Top]:{x:0,y:-1},[xe.Bottom]:{x:0,y:1}},XS=({source:e,sourcePosition:r=xe.Bottom,target:i})=>r===xe.Left||r===xe.Right?e.x<i.x?{x:1,y:0}:{x:-1,y:0}:e.y<i.y?{x:0,y:1}:{x:0,y:-1},gp=(e,r)=>Math.sqrt(Math.pow(r.x-e.x,2)+Math.pow(r.y-e.y,2));function YS({source:e,sourcePosition:r=xe.Bottom,target:i,targetPosition:o=xe.Top,center:h,offset:S,stepPosition:y}){const a=_p[r],l=_p[o],_={x:e.x+a.x*S,y:e.y+a.y*S},v={x:i.x+l.x*S,y:i.y+l.y*S},c=XS({source:_,sourcePosition:r,target:v}),m=c.x!==0?"x":"y",C=c[m];let b=[],x,f;const p={x:0,y:0},d={x:0,y:0},[,,u,w]=cg({sourceX:e.x,sourceY:e.y,targetX:i.x,targetY:i.y});if(a[m]*l[m]===-1){m==="x"?(x=h.x??_.x+(v.x-_.x)*y,f=h.y??(_.y+v.y)/2):(x=h.x??(_.x+v.x)/2,f=h.y??_.y+(v.y-_.y)*y);const k=[{x,y:_.y},{x,y:v.y}],M=[{x:_.x,y:f},{x:v.x,y:f}];a[m]===C?b=m==="x"?k:M:b=m==="x"?M:k}else{const k=[{x:_.x,y:v.y}],M=[{x:v.x,y:_.y}];if(m==="x"?b=a.x===C?M:k:b=a.y===C?k:M,r===o){const I=Math.abs(e[m]-i[m]);if(I<=S){const q=Math.min(S-1,S-I);a[m]===C?p[m]=(_[m]>e[m]?-1:1)*q:d[m]=(v[m]>i[m]?-1:1)*q}}if(r!==o){const I=m==="x"?"y":"x",q=a[m]===l[I],U=_[I]>v[I],K=_[I]<v[I];(a[m]===1&&(!q&&U||q&&K)||a[m]!==1&&(!q&&K||q&&U))&&(b=m==="x"?k:M)}const W={x:_.x+p.x,y:_.y+p.y},z={x:v.x+d.x,y:v.y+d.y},j=Math.max(Math.abs(W.x-b[0].x),Math.abs(z.x-b[0].x)),N=Math.max(Math.abs(W.y-b[0].y),Math.abs(z.y-b[0].y));j>=N?(x=(W.x+z.x)/2,f=b[0].y):(x=b[0].x,f=(W.y+z.y)/2)}const L={x:_.x+p.x,y:_.y+p.y},R={x:v.x+d.x,y:v.y+d.y};return[[e,...L.x!==b[0].x||L.y!==b[0].y?[L]:[],...b,...R.x!==b[b.length-1].x||R.y!==b[b.length-1].y?[R]:[],i],x,f,u,w]}function GS(e,r,i,o){const h=Math.min(gp(e,r)/2,gp(r,i)/2,o),{x:S,y}=r;if(e.x===S&&S===i.x||e.y===y&&y===i.y)return`L${S} ${y}`;if(e.y===y){const _=e.x<i.x?-1:1,v=e.y<i.y?1:-1;return`L ${S+h*_},${y}Q ${S},${y} ${S},${y+h*v}`}const a=e.x<i.x?1:-1,l=e.y<i.y?-1:1;return`L ${S},${y+h*l}Q ${S},${y} ${S+h*a},${y}`}function Lu({sourceX:e,sourceY:r,sourcePosition:i=xe.Bottom,targetX:o,targetY:h,targetPosition:S=xe.Top,borderRadius:y=5,centerX:a,centerY:l,offset:_=20,stepPosition:v=.5}){const[c,m,C,b,x]=YS({source:{x:e,y:r},sourcePosition:i,target:{x:o,y:h},targetPosition:S,center:{x:a,y:l},offset:_,stepPosition:v});let f=`M${c[0].x} ${c[0].y}`;for(let p=1;p<c.length-1;p++)f+=GS(c[p-1],c[p],c[p+1],y);return f+=`L${c[c.length-1].x} ${c[c.length-1].y}`,[f,m,C,b,x]}function mp(e){var r;return e&&!!(e.internals.handleBounds||(r=e.handles)!=null&&r.length)&&!!(e.measured.width||e.width||e.initialWidth)}function QS(e){var c;const{sourceNode:r,targetNode:i}=e;if(!mp(r)||!mp(i))return null;const o=r.internals.handleBounds||vp(r.handles),h=i.internals.handleBounds||vp(i.handles),S=yp((o==null?void 0:o.source)??[],e.sourceHandle),y=yp(e.connectionMode===hi.Strict?(h==null?void 0:h.target)??[]:((h==null?void 0:h.target)??[]).concat((h==null?void 0:h.source)??[]),e.targetHandle);if(!S||!y)return(c=e.onError)==null||c.call(e,"008",dr.error008(S?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(S==null?void 0:S.position)||xe.Bottom,l=(y==null?void 0:y.position)||xe.Top,_=Ln(r,S,a),v=Ln(i,y,l);return{sourceX:_.x,sourceY:_.y,targetX:v.x,targetY:v.y,sourcePosition:a,targetPosition:l}}function vp(e){if(!e)return null;const r=[],i=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?r.push(o):o.type==="target"&&i.push(o);return{source:r,target:i}}function Ln(e,r,i=xe.Left,o=!1){const h=((r==null?void 0:r.x)??0)+e.internals.positionAbsolute.x,S=((r==null?void 0:r.y)??0)+e.internals.positionAbsolute.y,{width:y,height:a}=r??Rr(e);if(o)return{x:h+y/2,y:S+a/2};switch((r==null?void 0:r.position)??i){case xe.Top:return{x:h+y/2,y:S};case xe.Right:return{x:h+y,y:S+a/2};case xe.Bottom:return{x:h+y/2,y:S+a};case xe.Left:return{x:h,y:S+a/2}}}function yp(e,r){return e&&(r?e.find(i=>i.id===r):e[0])||null}function Ru(e,r){return e?typeof e=="string"?e:`${r?`${r}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function JS(e,{id:r,defaultColor:i,defaultMarkerStart:o,defaultMarkerEnd:h}){const S=new Set;return e.reduce((y,a)=>([a.markerStart||o,a.markerEnd||h].forEach(l=>{if(l&&typeof l=="object"){const _=Ru(l,r);S.has(_)||(y.push({id:_,color:l.color||i,...l}),S.add(_))}}),y),[]).sort((y,a)=>y.id.localeCompare(a.id))}const hg=1e3,ZS=10,th={nodeOrigin:[0,0],nodeExtent:Ss,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},eC={...th,checkEquality:!0};function rh(e,r){const i={...e};for(const o in r)r[o]!==void 0&&(i[o]=r[o]);return i}function tC(e,r,i){const o=rh(th,i);for(const h of e.values())if(h.parentId)ih(h,e,r,o);else{const S=Ds(h,o.nodeOrigin),y=pi(h.extent)?h.extent:o.nodeExtent,a=kn(S,y,Rr(h));h.internals.positionAbsolute=a}}function rC(e,r){if(!e.handles)return e.measured?r==null?void 0:r.internals.handleBounds:void 0;const i=[],o=[];for(const h of e.handles){const S={id:h.id,width:h.width??1,height:h.height??1,nodeId:e.id,x:h.x,y:h.y,position:h.position,type:h.type};h.type==="source"?i.push(S):h.type==="target"&&o.push(S)}return{source:i,target:o}}function nh(e){return e==="manual"}function Du(e,r,i,o={}){var v,c;const h=rh(eC,o),S={i:0},y=new Map(r),a=h!=null&&h.elevateNodesOnSelect&&!nh(h.zIndexMode)?hg:0;let l=e.length>0,_=!1;r.clear(),i.clear();for(const m of e){let C=y.get(m.id);if(h.checkEquality&&m===(C==null?void 0:C.internals.userNode))r.set(m.id,C);else{const b=Ds(m,h.nodeOrigin),x=pi(m.extent)?m.extent:h.nodeExtent,f=kn(b,x,Rr(m));C={...h.defaults,...m,measured:{width:(v=m.measured)==null?void 0:v.width,height:(c=m.measured)==null?void 0:c.height},internals:{positionAbsolute:f,handleBounds:rC(m,C),z:dg(m,a,h.zIndexMode),userNode:m}},r.set(m.id,C)}(C.measured===void 0||C.measured.width===void 0||C.measured.height===void 0)&&!C.hidden&&(l=!1),m.parentId&&ih(C,r,i,o,S),_||(_=m.selected??!1)}return{nodesInitialized:l,hasSelectedNodes:_}}function nC(e,r){if(!e.parentId)return;const i=r.get(e.parentId);i?i.set(e.id,e):r.set(e.parentId,new Map([[e.id,e]]))}function ih(e,r,i,o,h){const{elevateNodesOnSelect:S,nodeOrigin:y,nodeExtent:a,zIndexMode:l}=rh(th,o),_=e.parentId,v=r.get(_);if(!v){console.warn(`Parent node ${_} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}nC(e,i),h&&!v.parentId&&v.internals.rootParentIndex===void 0&&l==="auto"&&(v.internals.rootParentIndex=++h.i,v.internals.z=v.internals.z+h.i*ZS),h&&v.internals.rootParentIndex!==void 0&&(h.i=v.internals.rootParentIndex);const c=S&&!nh(l)?hg:0,{x:m,y:C,z:b}=iC(e,v,y,a,c,l),{positionAbsolute:x}=e.internals,f=m!==x.x||C!==x.y;(f||b!==e.internals.z)&&r.set(e.id,{...e,internals:{...e.internals,positionAbsolute:f?{x:m,y:C}:x,z:b}})}function dg(e,r,i){const o=Zt(e.zIndex)?e.zIndex:0;return nh(i)?o:o+(e.selected?r:0)}function iC(e,r,i,o,h,S){const{x:y,y:a}=r.internals.positionAbsolute,l=Rr(e),_=Ds(e,i),v=pi(e.extent)?kn(_,e.extent,l):_;let c=kn({x:y+v.x,y:a+v.y},o,l);e.extent==="parent"&&(c=Z_(c,l,r));const m=dg(e,h,S),C=r.internals.z??0;return{x:c.x,y:c.y,z:C>=m?C+1:m}}function sh(e,r,i,o=[0,0]){var y;const h=[],S=new Map;for(const a of e){const l=r.get(a.parentId);if(!l)continue;const _=((y=S.get(a.parentId))==null?void 0:y.expandedRect)??fi(l),v=tg(_,a.rect);S.set(a.parentId,{expandedRect:v,parent:l})}return S.size>0&&S.forEach(({expandedRect:a,parent:l},_)=>{var u;const v=l.internals.positionAbsolute,c=Rr(l),m=l.origin??o,C=a.x<v.x?Math.round(Math.abs(v.x-a.x)):0,b=a.y<v.y?Math.round(Math.abs(v.y-a.y)):0,x=Math.max(c.width,Math.round(a.width)),f=Math.max(c.height,Math.round(a.height)),p=(x-c.width)*m[0],d=(f-c.height)*m[1];(C>0||b>0||p||d)&&(h.push({id:_,type:"position",position:{x:l.position.x-C+p,y:l.position.y-b+d}}),(u=i.get(_))==null||u.forEach(w=>{e.some(L=>L.id===w.id)||h.push({id:w.id,type:"position",position:{x:w.position.x+C,y:w.position.y+b}})})),(c.width<a.width||c.height<a.height||C||b)&&h.push({id:_,type:"dimensions",setAttributes:!0,dimensions:{width:x+(C?m[0]*C-p:0),height:f+(b?m[1]*b-d:0)}})}),h}function sC(e,r,i,o,h,S,y){const a=o==null?void 0:o.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const _=[],v=window.getComputedStyle(a),{m22:c}=new window.DOMMatrixReadOnly(v.transform),m=[];for(const C of e.values()){const b=r.get(C.id);if(!b)continue;if(b.hidden){r.set(b.id,{...b,internals:{...b.internals,handleBounds:void 0}}),l=!0;continue}const x=eh(C.nodeElement),f=b.measured.width!==x.width||b.measured.height!==x.height;if(!!(x.width&&x.height&&(f||!b.internals.handleBounds||C.force))){const d=C.nodeElement.getBoundingClientRect(),u=pi(b.extent)?b.extent:S;let{positionAbsolute:w}=b.internals;b.parentId&&b.extent==="parent"?w=Z_(w,x,r.get(b.parentId)):u&&(w=kn(w,u,x));const L={...b,measured:x,internals:{...b.internals,positionAbsolute:w,handleBounds:{source:fp("source",C.nodeElement,d,c,b.id),target:fp("target",C.nodeElement,d,c,b.id)}}};r.set(b.id,L),b.parentId&&ih(L,r,i,{nodeOrigin:h,zIndexMode:y}),l=!0,f&&(_.push({id:b.id,type:"dimensions",dimensions:x}),b.expandParent&&b.parentId&&m.push({id:b.id,parentId:b.parentId,rect:fi(L,h)}))}}if(m.length>0){const C=sh(m,r,i,h);_.push(...C)}return{changes:_,updatedInternals:l}}async function oC({delta:e,panZoom:r,transform:i,translateExtent:o,width:h,height:S}){if(!r||!e.x&&!e.y)return Promise.resolve(!1);const y=await r.setViewportConstrained({x:i[0]+e.x,y:i[1]+e.y,zoom:i[2]},[[0,0],[h,S]],o),a=!!y&&(y.x!==i[0]||y.y!==i[1]||y.k!==i[2]);return Promise.resolve(a)}function wp(e,r,i,o,h,S){let y=h;const a=o.get(y)||new Map;o.set(y,a.set(i,r)),y=`${h}-${e}`;const l=o.get(y)||new Map;if(o.set(y,l.set(i,r)),S){y=`${h}-${e}-${S}`;const _=o.get(y)||new Map;o.set(y,_.set(i,r))}}function fg(e,r,i){e.clear(),r.clear();for(const o of i){const{source:h,target:S,sourceHandle:y=null,targetHandle:a=null}=o,l={edgeId:o.id,source:h,target:S,sourceHandle:y,targetHandle:a},_=`${h}-${y}--${S}-${a}`,v=`${S}-${a}--${h}-${y}`;wp("source",l,v,e,h,y),wp("target",l,_,e,S,a),r.set(o.id,o)}}function pg(e,r){if(!e.parentId)return!1;const i=r.get(e.parentId);return i?i.selected?!0:pg(i,r):!1}function Sp(e,r,i){var h;let o=e;do{if((h=o==null?void 0:o.matches)!=null&&h.call(o,r))return!0;if(o===i)return!1;o=o==null?void 0:o.parentElement}while(o);return!1}function aC(e,r,i,o){const h=new Map;for(const[S,y]of e)if((y.selected||y.id===o)&&(!y.parentId||!pg(y,e))&&(y.draggable||r&&typeof y.draggable>"u")){const a=e.get(S);a&&h.set(S,{id:S,position:a.position||{x:0,y:0},distance:{x:i.x-a.internals.positionAbsolute.x,y:i.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return h}function Gc({nodeId:e,dragItems:r,nodeLookup:i,dragging:o=!0}){var y,a,l;const h=[];for(const[_,v]of r){const c=(y=i.get(_))==null?void 0:y.internals.userNode;c&&h.push({...c,position:v.position,dragging:o})}if(!e)return[h[0],h];const S=(a=i.get(e))==null?void 0:a.internals.userNode;return[S?{...S,position:((l=r.get(e))==null?void 0:l.position)||S.position,dragging:o}:h[0],h]}function lC({dragItems:e,snapGrid:r,x:i,y:o}){const h=e.values().next().value;if(!h)return null;const S={x:i-h.distance.x,y:o-h.distance.y},y=Ts(S,r);return{x:y.x-S.x,y:y.y-S.y}}function cC({onNodeMouseDown:e,getStoreItems:r,onDragStart:i,onDrag:o,onDragStop:h}){let S={x:null,y:null},y=0,a=new Map,l=!1,_={x:0,y:0},v=null,c=!1,m=null,C=!1,b=!1,x=null;function f({noDragClassName:d,handleSelector:u,domNode:w,isSelectable:L,nodeId:R,nodeClickDistance:D=0}){m=Nt(w);function k({x:j,y:N}){const{nodeLookup:I,nodeExtent:q,snapGrid:U,snapToGrid:K,nodeOrigin:V,onNodeDrag:T,onSelectionDrag:B,onError:P,updateNodePositions:F}=r();S={x:j,y:N};let Y=!1;const Z=a.size>1,ie=Z&&q?ku(As(a)):null,ae=Z&&K?lC({dragItems:a,snapGrid:U,x:j,y:N}):null;for(const[X,H]of a){if(!I.has(X))continue;let re={x:j-H.distance.x,y:N-H.distance.y};K&&(re=ae?{x:Math.round(re.x+ae.x),y:Math.round(re.y+ae.y)}:Ts(re,U));let te=null;if(Z&&q&&!H.extent&&ie){const{positionAbsolute:pe}=H.internals,Se=pe.x-ie.x+q[0][0],be=pe.x+H.measured.width-ie.x2+q[1][0],ue=pe.y-ie.y+q[0][1],ge=pe.y+H.measured.height-ie.y2+q[1][1];te=[[Se,ue],[be,ge]]}const{position:ce,positionAbsolute:le}=J_({nodeId:X,nextPosition:re,nodeLookup:I,nodeExtent:te||q,nodeOrigin:V,onError:P});Y=Y||H.position.x!==ce.x||H.position.y!==ce.y,H.position=ce,H.internals.positionAbsolute=le}if(b=b||Y,!!Y&&(F(a,!0),x&&(o||T||!R&&B))){const[X,H]=Gc({nodeId:R,dragItems:a,nodeLookup:I});o==null||o(x,a,X,H),T==null||T(x,X,H),R||B==null||B(x,H)}}async function M(){if(!v)return;const{transform:j,panBy:N,autoPanSpeed:I,autoPanOnNodeDrag:q}=r();if(!q){l=!1,cancelAnimationFrame(y);return}const[U,K]=eg(_,v,I);(U!==0||K!==0)&&(S.x=(S.x??0)-U/j[2],S.y=(S.y??0)-K/j[2],await N({x:U,y:K})&&k(S)),y=requestAnimationFrame(M)}function W(j){var Z;const{nodeLookup:N,multiSelectionActive:I,nodesDraggable:q,transform:U,snapGrid:K,snapToGrid:V,selectNodesOnDrag:T,onNodeDragStart:B,onSelectionDragStart:P,unselectNodesAndEdges:F}=r();c=!0,(!T||!L)&&!I&&R&&((Z=N.get(R))!=null&&Z.selected||F()),L&&T&&R&&(e==null||e(R));const Y=gs(j.sourceEvent,{transform:U,snapGrid:K,snapToGrid:V,containerBounds:v});if(S=Y,a=aC(N,q,Y,R),a.size>0&&(i||B||!R&&P)){const[ie,ae]=Gc({nodeId:R,dragItems:a,nodeLookup:N});i==null||i(j.sourceEvent,a,ie,ae),B==null||B(j.sourceEvent,ie,ae),R||P==null||P(j.sourceEvent,ae)}}const z=T_().clickDistance(D).on("start",j=>{const{domNode:N,nodeDragThreshold:I,transform:q,snapGrid:U,snapToGrid:K}=r();v=(N==null?void 0:N.getBoundingClientRect())||null,C=!1,b=!1,x=j.sourceEvent,I===0&&W(j),S=gs(j.sourceEvent,{transform:q,snapGrid:U,snapToGrid:K,containerBounds:v}),_=er(j.sourceEvent,v)}).on("drag",j=>{const{autoPanOnNodeDrag:N,transform:I,snapGrid:q,snapToGrid:U,nodeDragThreshold:K,nodeLookup:V}=r(),T=gs(j.sourceEvent,{transform:I,snapGrid:q,snapToGrid:U,containerBounds:v});if(x=j.sourceEvent,(j.sourceEvent.type==="touchmove"&&j.sourceEvent.touches.length>1||R&&!V.has(R))&&(C=!0),!C){if(!l&&N&&c&&(l=!0,M()),!c){const B=er(j.sourceEvent,v),P=B.x-_.x,F=B.y-_.y;Math.sqrt(P*P+F*F)>K&&W(j)}(S.x!==T.xSnapped||S.y!==T.ySnapped)&&a&&c&&(_=er(j.sourceEvent,v),k(T))}}).on("end",j=>{if(!(!c||C)&&(l=!1,c=!1,cancelAnimationFrame(y),a.size>0)){const{nodeLookup:N,updateNodePositions:I,onNodeDragStop:q,onSelectionDragStop:U}=r();if(b&&(I(a,!1),b=!1),h||q||!R&&U){const[K,V]=Gc({nodeId:R,dragItems:a,nodeLookup:N,dragging:!1});h==null||h(j.sourceEvent,a,K,V),q==null||q(j.sourceEvent,K,V),R||U==null||U(j.sourceEvent,V)}}}).filter(j=>{const N=j.target;return!j.button&&(!d||!Sp(N,`.${d}`,w))&&(!u||Sp(N,u,w))});m.call(z)}function p(){m==null||m.on(".drag",null)}return{update:f,destroy:p}}function uC(e,r,i){const o=[],h={x:e.x-i,y:e.y-i,width:i*2,height:i*2};for(const S of r.values())xs(h,fi(S))>0&&o.push(S);return o}const hC=250;function dC(e,r,i,o){var a,l;let h=[],S=1/0;const y=uC(e,i,r+hC);for(const _ of y){const v=[...((a=_.internals.handleBounds)==null?void 0:a.source)??[],...((l=_.internals.handleBounds)==null?void 0:l.target)??[]];for(const c of v){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;const{x:m,y:C}=Ln(_,c,c.position,!0),b=Math.sqrt(Math.pow(m-e.x,2)+Math.pow(C-e.y,2));b>r||(b<S?(h=[{...c,x:m,y:C}],S=b):b===S&&h.push({...c,x:m,y:C}))}}if(!h.length)return null;if(h.length>1){const _=o.type==="source"?"target":"source";return h.find(v=>v.type===_)??h[0]}return h[0]}function _g(e,r,i,o,h,S=!1){var _,v,c;const y=o.get(e);if(!y)return null;const a=h==="strict"?(_=y.internals.handleBounds)==null?void 0:_[r]:[...((v=y.internals.handleBounds)==null?void 0:v.source)??[],...((c=y.internals.handleBounds)==null?void 0:c.target)??[]],l=(i?a==null?void 0:a.find(m=>m.id===i):a==null?void 0:a[0])??null;return l&&S?{...l,...Ln(y,l,l.position,!0)}:l}function gg(e,r){return e||(r!=null&&r.classList.contains("target")?"target":r!=null&&r.classList.contains("source")?"source":null)}function fC(e,r){let i=null;return r?i=!0:e&&!r&&(i=!1),i}const mg=()=>!0;function pC(e,{connectionMode:r,connectionRadius:i,handleId:o,nodeId:h,edgeUpdaterType:S,isTarget:y,domNode:a,nodeLookup:l,lib:_,autoPanOnConnect:v,flowId:c,panBy:m,cancelConnection:C,onConnectStart:b,onConnect:x,onConnectEnd:f,isValidConnection:p=mg,onReconnectEnd:d,updateConnection:u,getTransform:w,getFromHandle:L,autoPanSpeed:R,dragThreshold:D=1,handleDomNode:k}){const M=ig(e.target);let W=0,z;const{x:j,y:N}=er(e),I=gg(S,k),q=a==null?void 0:a.getBoundingClientRect();let U=!1;if(!q||!I)return;const K=_g(h,I,o,l,r);if(!K)return;let V=er(e,q),T=!1,B=null,P=!1,F=null;function Y(){if(!v||!q)return;const[ce,le]=eg(V,q,R);m({x:ce,y:le}),W=requestAnimationFrame(Y)}const Z={...K,nodeId:h,type:I,position:K.position},ie=l.get(h);let X={inProgress:!0,isValid:null,from:Ln(ie,Z,xe.Left,!0),fromHandle:Z,fromPosition:Z.position,fromNode:ie,to:V,toHandle:null,toPosition:cp[Z.position],toNode:null,pointer:V};function H(){U=!0,u(X),b==null||b(e,{nodeId:h,handleId:o,handleType:I})}D===0&&H();function re(ce){if(!U){const{x:ge,y:Re}=er(ce),Ie=ge-j,ze=Re-N;if(!(Ie*Ie+ze*ze>D*D))return;H()}if(!L()||!Z){te(ce);return}const le=w();V=er(ce,q),z=dC(Ms(V,le,!1,[1,1]),i,l,Z),T||(Y(),T=!0);const pe=vg(ce,{handle:z,connectionMode:r,fromNodeId:h,fromHandleId:o,fromType:y?"target":"source",isValidConnection:p,doc:M,lib:_,flowId:c,nodeLookup:l});F=pe.handleDomNode,B=pe.connection,P=fC(!!z,pe.isValid);const Se=l.get(h),be=Se?Ln(Se,Z,xe.Left,!0):X.from,ue={...X,from:be,isValid:P,to:pe.toHandle&&P?Da({x:pe.toHandle.x,y:pe.toHandle.y},le):V,toHandle:pe.toHandle,toPosition:P&&pe.toHandle?pe.toHandle.position:cp[Z.position],toNode:pe.toHandle?l.get(pe.toHandle.nodeId):null,pointer:V};u(ue),X=ue}function te(ce){if(!("touches"in ce&&ce.touches.length>0)){if(U){(z||F)&&B&&P&&(x==null||x(B));const{inProgress:le,...pe}=X,Se={...pe,toPosition:X.toHandle?X.toPosition:null};f==null||f(ce,Se),S&&(d==null||d(ce,Se))}C(),cancelAnimationFrame(W),T=!1,P=!1,B=null,F=null,M.removeEventListener("mousemove",re),M.removeEventListener("mouseup",te),M.removeEventListener("touchmove",re),M.removeEventListener("touchend",te)}}M.addEventListener("mousemove",re),M.addEventListener("mouseup",te),M.addEventListener("touchmove",re),M.addEventListener("touchend",te)}function vg(e,{handle:r,connectionMode:i,fromNodeId:o,fromHandleId:h,fromType:S,doc:y,lib:a,flowId:l,isValidConnection:_=mg,nodeLookup:v}){const c=S==="target",m=r?y.querySelector(`.${a}-flow__handle[data-id="${l}-${r==null?void 0:r.nodeId}-${r==null?void 0:r.id}-${r==null?void 0:r.type}"]`):null,{x:C,y:b}=er(e),x=y.elementFromPoint(C,b),f=x!=null&&x.classList.contains(`${a}-flow__handle`)?x:m,p={handleDomNode:f,isValid:!1,connection:null,toHandle:null};if(f){const d=gg(void 0,f),u=f.getAttribute("data-nodeid"),w=f.getAttribute("data-handleid"),L=f.classList.contains("connectable"),R=f.classList.contains("connectableend");if(!u||!d)return p;const D={source:c?u:o,sourceHandle:c?w:h,target:c?o:u,targetHandle:c?h:w};p.connection=D;const M=L&&R&&(i===hi.Strict?c&&d==="source"||!c&&d==="target":u!==o||w!==h);p.isValid=M&&_(D),p.toHandle=_g(u,d,w,v,i,!0)}return p}const Au={onPointerDown:pC,isValid:vg};function _C({domNode:e,panZoom:r,getTransform:i,getViewScale:o}){const h=Nt(e);function S({translateExtent:a,width:l,height:_,zoomStep:v=1,pannable:c=!0,zoomable:m=!0,inversePan:C=!1}){const b=u=>{if(u.sourceEvent.type!=="wheel"||!r)return;const w=i(),L=u.sourceEvent.ctrlKey&&bs()?10:1,R=-u.sourceEvent.deltaY*(u.sourceEvent.deltaMode===1?.05:u.sourceEvent.deltaMode?1:.002)*v,D=w[2]*Math.pow(2,R*L);r.scaleTo(D)};let x=[0,0];const f=u=>{(u.sourceEvent.type==="mousedown"||u.sourceEvent.type==="touchstart")&&(x=[u.sourceEvent.clientX??u.sourceEvent.touches[0].clientX,u.sourceEvent.clientY??u.sourceEvent.touches[0].clientY])},p=u=>{const w=i();if(u.sourceEvent.type!=="mousemove"&&u.sourceEvent.type!=="touchmove"||!r)return;const L=[u.sourceEvent.clientX??u.sourceEvent.touches[0].clientX,u.sourceEvent.clientY??u.sourceEvent.touches[0].clientY],R=[L[0]-x[0],L[1]-x[1]];x=L;const D=o()*Math.max(w[2],Math.log(w[2]))*(C?-1:1),k={x:w[0]-R[0]*D,y:w[1]-R[1]*D},M=[[0,0],[l,_]];r.setViewportConstrained({x:k.x,y:k.y,zoom:w[2]},M,a)},d=q_().on("start",f).on("zoom",c?p:null).on("zoom.wheel",m?b:null);h.call(d,{})}function y(){h.on("zoom",null)}return{update:S,destroy:y,pointer:Qt}}const $a=e=>({x:e.x,y:e.y,zoom:e.k}),Qc=({x:e,y:r,zoom:i})=>Fa.translate(e,r).scale(i),si=(e,r)=>e.target.closest(`.${r}`),yg=(e,r)=>r===2&&Array.isArray(e)&&e.includes(2),gC=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Jc=(e,r=0,i=gC,o=()=>{})=>{const h=typeof r=="number"&&r>0;return h||o(),h?e.transition().duration(r).ease(i).on("end",o):e},wg=e=>{const r=e.ctrlKey&&bs()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*r};function mC({zoomPanValues:e,noWheelClassName:r,d3Selection:i,d3Zoom:o,panOnScrollMode:h,panOnScrollSpeed:S,zoomOnPinch:y,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:_}){return v=>{if(si(v,r))return v.ctrlKey&&v.preventDefault(),!1;v.preventDefault(),v.stopImmediatePropagation();const c=i.property("__zoom").k||1;if(v.ctrlKey&&y){const f=Qt(v),p=wg(v),d=c*Math.pow(2,p);o.scaleTo(i,d,f,v);return}const m=v.deltaMode===1?20:1;let C=h===xn.Vertical?0:v.deltaX*m,b=h===xn.Horizontal?0:v.deltaY*m;!bs()&&v.shiftKey&&h!==xn.Vertical&&(C=v.deltaY*m,b=0),o.translateBy(i,-(C/c)*S,-(b/c)*S,{internal:!0});const x=$a(i.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l==null||l(v,x),e.panScrollTimeout=setTimeout(()=>{_==null||_(v,x),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a==null||a(v,x))}}function vC({noWheelClassName:e,preventScrolling:r,d3ZoomHandler:i}){return function(o,h){const S=o.type==="wheel",y=!r&&S&&!o.ctrlKey,a=si(o,e);if(o.ctrlKey&&S&&a&&o.preventDefault(),y||a)return null;o.preventDefault(),i.call(this,o,h)}}function yC({zoomPanValues:e,onDraggingChange:r,onPanZoomStart:i}){return o=>{var S,y,a;if((S=o.sourceEvent)!=null&&S.internal)return;const h=$a(o.transform);e.mouseButton=((y=o.sourceEvent)==null?void 0:y.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=h,((a=o.sourceEvent)==null?void 0:a.type)==="mousedown"&&r(!0),i&&(i==null||i(o.sourceEvent,h))}}function wC({zoomPanValues:e,panOnDrag:r,onPaneContextMenu:i,onTransformChange:o,onPanZoom:h}){return S=>{var y,a;e.usedRightMouseButton=!!(i&&yg(r,e.mouseButton??0)),(y=S.sourceEvent)!=null&&y.sync||o([S.transform.x,S.transform.y,S.transform.k]),h&&!((a=S.sourceEvent)!=null&&a.internal)&&(h==null||h(S.sourceEvent,$a(S.transform)))}}function SC({zoomPanValues:e,panOnDrag:r,panOnScroll:i,onDraggingChange:o,onPanZoomEnd:h,onPaneContextMenu:S}){return y=>{var a;if(!((a=y.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,S&&yg(r,e.mouseButton??0)&&!e.usedRightMouseButton&&y.sourceEvent&&S(y.sourceEvent),e.usedRightMouseButton=!1,o(!1),h)){const l=$a(y.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{h==null||h(y.sourceEvent,l)},i?150:0)}}}function CC({zoomActivationKeyPressed:e,zoomOnScroll:r,zoomOnPinch:i,panOnDrag:o,panOnScroll:h,zoomOnDoubleClick:S,userSelectionActive:y,noWheelClassName:a,noPanClassName:l,lib:_,connectionInProgress:v}){return c=>{var f;const m=e||r,C=i&&c.ctrlKey,b=c.type==="wheel";if(c.button===1&&c.type==="mousedown"&&(si(c,`${_}-flow__node`)||si(c,`${_}-flow__edge`)))return!0;if(!o&&!m&&!h&&!S&&!i||y||v&&!b||si(c,a)&&b||si(c,l)&&(!b||h&&b&&!e)||!i&&c.ctrlKey&&b)return!1;if(!i&&c.type==="touchstart"&&((f=c.touches)==null?void 0:f.length)>1)return c.preventDefault(),!1;if(!m&&!h&&!C&&b||!o&&(c.type==="mousedown"||c.type==="touchstart")||Array.isArray(o)&&!o.includes(c.button)&&c.type==="mousedown")return!1;const x=Array.isArray(o)&&o.includes(c.button)||!c.button||c.button<=1;return(!c.ctrlKey||b)&&x}}function xC({domNode:e,minZoom:r,maxZoom:i,translateExtent:o,viewport:h,onPanZoom:S,onPanZoomStart:y,onPanZoomEnd:a,onDraggingChange:l}){const _={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},v=e.getBoundingClientRect(),c=q_().scaleExtent([r,i]).translateExtent(o),m=Nt(e).call(c);d({x:h.x,y:h.y,zoom:di(h.zoom,r,i)},[[0,0],[v.width,v.height]],o);const C=m.on("wheel.zoom"),b=m.on("dblclick.zoom");c.wheelDelta(wg);function x(z,j){return m?new Promise(N=>{c==null||c.interpolate((j==null?void 0:j.interpolate)==="linear"?_s:pa).transform(Jc(m,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>N(!0)),z)}):Promise.resolve(!1)}function f({noWheelClassName:z,noPanClassName:j,onPaneContextMenu:N,userSelectionActive:I,panOnScroll:q,panOnDrag:U,panOnScrollMode:K,panOnScrollSpeed:V,preventScrolling:T,zoomOnPinch:B,zoomOnScroll:P,zoomOnDoubleClick:F,zoomActivationKeyPressed:Y,lib:Z,onTransformChange:ie,connectionInProgress:ae,paneClickDistance:X,selectionOnDrag:H}){I&&!_.isZoomingOrPanning&&p();const re=q&&!Y&&!I;c.clickDistance(H?1/0:!Zt(X)||X<0?0:X);const te=re?mC({zoomPanValues:_,noWheelClassName:z,d3Selection:m,d3Zoom:c,panOnScrollMode:K,panOnScrollSpeed:V,zoomOnPinch:B,onPanZoomStart:y,onPanZoom:S,onPanZoomEnd:a}):vC({noWheelClassName:z,preventScrolling:T,d3ZoomHandler:C});if(m.on("wheel.zoom",te,{passive:!1}),!I){const le=yC({zoomPanValues:_,onDraggingChange:l,onPanZoomStart:y});c.on("start",le);const pe=wC({zoomPanValues:_,panOnDrag:U,onPaneContextMenu:!!N,onPanZoom:S,onTransformChange:ie});c.on("zoom",pe);const Se=SC({zoomPanValues:_,panOnDrag:U,panOnScroll:q,onPaneContextMenu:N,onPanZoomEnd:a,onDraggingChange:l});c.on("end",Se)}const ce=CC({zoomActivationKeyPressed:Y,panOnDrag:U,zoomOnScroll:P,panOnScroll:q,zoomOnDoubleClick:F,zoomOnPinch:B,userSelectionActive:I,noPanClassName:j,noWheelClassName:z,lib:Z,connectionInProgress:ae});c.filter(ce),F?m.on("dblclick.zoom",b):m.on("dblclick.zoom",null)}function p(){c.on("zoom",null)}async function d(z,j,N){const I=Qc(z),q=c==null?void 0:c.constrain()(I,j,N);return q&&await x(q),new Promise(U=>U(q))}async function u(z,j){const N=Qc(z);return await x(N,j),new Promise(I=>I(N))}function w(z){if(m){const j=Qc(z),N=m.property("__zoom");(N.k!==z.zoom||N.x!==z.x||N.y!==z.y)&&(c==null||c.transform(m,j,null,{sync:!0}))}}function L(){const z=m?V_(m.node()):{x:0,y:0,k:1};return{x:z.x,y:z.y,zoom:z.k}}function R(z,j){return m?new Promise(N=>{c==null||c.interpolate((j==null?void 0:j.interpolate)==="linear"?_s:pa).scaleTo(Jc(m,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>N(!0)),z)}):Promise.resolve(!1)}function D(z,j){return m?new Promise(N=>{c==null||c.interpolate((j==null?void 0:j.interpolate)==="linear"?_s:pa).scaleBy(Jc(m,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>N(!0)),z)}):Promise.resolve(!1)}function k(z){c==null||c.scaleExtent(z)}function M(z){c==null||c.translateExtent(z)}function W(z){const j=!Zt(z)||z<0?0:z;c==null||c.clickDistance(j)}return{update:f,destroy:p,setViewport:u,setViewportConstrained:d,getViewport:L,scaleTo:R,scaleBy:D,setScaleExtent:k,setTranslateExtent:M,syncViewport:w,setClickDistance:W}}var _i;(function(e){e.Line="line",e.Handle="handle"})(_i||(_i={}));function bC({width:e,prevWidth:r,height:i,prevHeight:o,affectsX:h,affectsY:S}){const y=e-r,a=i-o,l=[y>0?1:y<0?-1:0,a>0?1:a<0?-1:0];return y&&h&&(l[0]=l[0]*-1),a&&S&&(l[1]=l[1]*-1),l}function Cp(e){const r=e.includes("right")||e.includes("left"),i=e.includes("bottom")||e.includes("top"),o=e.includes("left"),h=e.includes("top");return{isHorizontal:r,isVertical:i,affectsX:o,affectsY:h}}function Gr(e,r){return Math.max(0,r-e)}function Qr(e,r){return Math.max(0,e-r)}function sa(e,r,i){return Math.max(0,r-e,e-i)}function xp(e,r){return e?!r:r}function EC(e,r,i,o,h,S,y,a){let{affectsX:l,affectsY:_}=r;const{isHorizontal:v,isVertical:c}=r,m=v&&c,{xSnapped:C,ySnapped:b}=i,{minWidth:x,maxWidth:f,minHeight:p,maxHeight:d}=o,{x:u,y:w,width:L,height:R,aspectRatio:D}=e;let k=Math.floor(v?C-e.pointerX:0),M=Math.floor(c?b-e.pointerY:0);const W=L+(l?-k:k),z=R+(_?-M:M),j=-S[0]*L,N=-S[1]*R;let I=sa(W,x,f),q=sa(z,p,d);if(y){let V=0,T=0;l&&k<0?V=Gr(u+k+j,y[0][0]):!l&&k>0&&(V=Qr(u+W+j,y[1][0])),_&&M<0?T=Gr(w+M+N,y[0][1]):!_&&M>0&&(T=Qr(w+z+N,y[1][1])),I=Math.max(I,V),q=Math.max(q,T)}if(a){let V=0,T=0;l&&k>0?V=Qr(u+k,a[0][0]):!l&&k<0&&(V=Gr(u+W,a[1][0])),_&&M>0?T=Qr(w+M,a[0][1]):!_&&M<0&&(T=Gr(w+z,a[1][1])),I=Math.max(I,V),q=Math.max(q,T)}if(h){if(v){const V=sa(W/D,p,d)*D;if(I=Math.max(I,V),y){let T=0;!l&&!_||l&&!_&&m?T=Qr(w+N+W/D,y[1][1])*D:T=Gr(w+N+(l?k:-k)/D,y[0][1])*D,I=Math.max(I,T)}if(a){let T=0;!l&&!_||l&&!_&&m?T=Gr(w+W/D,a[1][1])*D:T=Qr(w+(l?k:-k)/D,a[0][1])*D,I=Math.max(I,T)}}if(c){const V=sa(z*D,x,f)/D;if(q=Math.max(q,V),y){let T=0;!l&&!_||_&&!l&&m?T=Qr(u+z*D+j,y[1][0])/D:T=Gr(u+(_?M:-M)*D+j,y[0][0])/D,q=Math.max(q,T)}if(a){let T=0;!l&&!_||_&&!l&&m?T=Gr(u+z*D,a[1][0])/D:T=Qr(u+(_?M:-M)*D,a[0][0])/D,q=Math.max(q,T)}}}M=M+(M<0?q:-q),k=k+(k<0?I:-I),h&&(m?W>z*D?M=(xp(l,_)?-k:k)/D:k=(xp(l,_)?-M:M)*D:v?(M=k/D,_=l):(k=M*D,l=_));const U=l?u+k:u,K=_?w+M:w;return{width:L+(l?-k:k),height:R+(_?-M:M),x:S[0]*k*(l?-1:1)+U,y:S[1]*M*(_?-1:1)+K}}const Sg={width:0,height:0,x:0,y:0},kC={...Sg,pointerX:0,pointerY:0,aspectRatio:1};function LC(e){return[[0,0],[e.measured.width,e.measured.height]]}function RC(e,r,i){const o=r.position.x+e.position.x,h=r.position.y+e.position.y,S=e.measured.width??0,y=e.measured.height??0,a=i[0]*S,l=i[1]*y;return[[o-a,h-l],[o+S-a,h+y-l]]}function DC({domNode:e,nodeId:r,getStoreItems:i,onChange:o,onEnd:h}){const S=Nt(e);let y={controlDirection:Cp("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:_,boundaries:v,keepAspectRatio:c,resizeDirection:m,onResizeStart:C,onResize:b,onResizeEnd:x,shouldResize:f}){let p={...Sg},d={...kC};y={boundaries:v,resizeDirection:m,keepAspectRatio:c,controlDirection:Cp(_)};let u,w=null,L=[],R,D,k,M=!1;const W=T_().on("start",z=>{const{nodeLookup:j,transform:N,snapGrid:I,snapToGrid:q,nodeOrigin:U,paneDomNode:K}=i();if(u=j.get(r),!u)return;w=(K==null?void 0:K.getBoundingClientRect())??null;const{xSnapped:V,ySnapped:T}=gs(z.sourceEvent,{transform:N,snapGrid:I,snapToGrid:q,containerBounds:w});p={width:u.measured.width??0,height:u.measured.height??0,x:u.position.x??0,y:u.position.y??0},d={...p,pointerX:V,pointerY:T,aspectRatio:p.width/p.height},R=void 0,u.parentId&&(u.extent==="parent"||u.expandParent)&&(R=j.get(u.parentId),D=R&&u.extent==="parent"?LC(R):void 0),L=[],k=void 0;for(const[B,P]of j)if(P.parentId===r&&(L.push({id:B,position:{...P.position},extent:P.extent}),P.extent==="parent"||P.expandParent)){const F=RC(P,u,P.origin??U);k?k=[[Math.min(F[0][0],k[0][0]),Math.min(F[0][1],k[0][1])],[Math.max(F[1][0],k[1][0]),Math.max(F[1][1],k[1][1])]]:k=F}C==null||C(z,{...p})}).on("drag",z=>{const{transform:j,snapGrid:N,snapToGrid:I,nodeOrigin:q}=i(),U=gs(z.sourceEvent,{transform:j,snapGrid:N,snapToGrid:I,containerBounds:w}),K=[];if(!u)return;const{x:V,y:T,width:B,height:P}=p,F={},Y=u.origin??q,{width:Z,height:ie,x:ae,y:X}=EC(d,y.controlDirection,U,y.boundaries,y.keepAspectRatio,Y,D,k),H=Z!==B,re=ie!==P,te=ae!==V&&H,ce=X!==T&&re;if(!te&&!ce&&!H&&!re)return;if((te||ce||Y[0]===1||Y[1]===1)&&(F.x=te?ae:p.x,F.y=ce?X:p.y,p.x=F.x,p.y=F.y,L.length>0)){const be=ae-V,ue=X-T;for(const ge of L)ge.position={x:ge.position.x-be+Y[0]*(Z-B),y:ge.position.y-ue+Y[1]*(ie-P)},K.push(ge)}if((H||re)&&(F.width=H&&(!y.resizeDirection||y.resizeDirection==="horizontal")?Z:p.width,F.height=re&&(!y.resizeDirection||y.resizeDirection==="vertical")?ie:p.height,p.width=F.width,p.height=F.height),R&&u.expandParent){const be=Y[0]*(F.width??0);F.x&&F.x<be&&(p.x=be,d.x=d.x-(F.x-be));const ue=Y[1]*(F.height??0);F.y&&F.y<ue&&(p.y=ue,d.y=d.y-(F.y-ue))}const le=bC({width:p.width,prevWidth:B,height:p.height,prevHeight:P,affectsX:y.controlDirection.affectsX,affectsY:y.controlDirection.affectsY}),pe={...p,direction:le};(f==null?void 0:f(z,pe))!==!1&&(M=!0,b==null||b(z,pe),o(F,K))}).on("end",z=>{M&&(x==null||x(z,{...p}),h==null||h({...p}),M=!1)});S.call(W)}function l(){S.on(".drag",null)}return{update:a,destroy:l}}var Zc={exports:{}},eu={},tu={exports:{}},ru={};/**
41
41
  * @license React
42
42
  * use-sync-external-store-shim.production.js
43
43
  *
@@ -58,14 +58,14 @@ Error generating stack: `+A.message+`
58
58
 
59
59
  `,`
60
60
  +`).split(`
61
- `)),v=_.reduce((c,m)=>c.concat(...m),[]);return[_,v]}return[[],[]]},[e]);return J.useEffect(()=>{const l=(r==null?void 0:r.target)??Np,_=(r==null?void 0:r.actInsideInputWithModifier)??!0;if(e!==null){const v=C=>{var f,p;if(h.current=C.ctrlKey||C.metaKey||C.shiftKey||C.altKey,(!h.current||h.current&&!_)&&sg(C))return!1;const x=Ip(C.code,a);if(S.current.add(C[x]),Bp(y,S.current,!1)){const d=((p=(f=C.composedPath)==null?void 0:f.call(C))==null?void 0:p[0])||C.target,u=(d==null?void 0:d.nodeName)==="BUTTON"||(d==null?void 0:d.nodeName)==="A";r.preventDefault!==!1&&(h.current||!u)&&C.preventDefault(),o(!0)}},c=C=>{const b=Ip(C.code,a);Bp(y,S.current,!0)?(o(!1),S.current.clear()):S.current.delete(C[b]),C.key==="Meta"&&S.current.clear(),h.current=!1},m=()=>{S.current.clear(),o(!1)};return l==null||l.addEventListener("keydown",v),l==null||l.addEventListener("keyup",c),window.addEventListener("blur",m),window.addEventListener("contextmenu",m),()=>{l==null||l.removeEventListener("keydown",v),l==null||l.removeEventListener("keyup",c),window.removeEventListener("blur",m),window.removeEventListener("contextmenu",m)}}},[e,o]),i}function Bp(e,r,i){return e.filter(o=>i||o.length===r.size).some(o=>o.every(h=>r.has(h)))}function Ip(e,r){return r.includes(e)?"code":"key"}const ox=()=>{const e=Ve();return J.useMemo(()=>({zoomIn:r=>{const{panZoom:i}=e.getState();return i?i.scaleBy(1.2,r):Promise.resolve(!1)},zoomOut:r=>{const{panZoom:i}=e.getState();return i?i.scaleBy(1/1.2,r):Promise.resolve(!1)},zoomTo:(r,i)=>{const{panZoom:o}=e.getState();return o?o.scaleTo(r,i):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(r,i)=>{const{transform:[o,h,S],panZoom:y}=e.getState();return y?(await y.setViewport({x:r.x??o,y:r.y??h,zoom:r.zoom??S},i),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[r,i,o]=e.getState().transform;return{x:r,y:i,zoom:o}},setCenter:async(r,i,o)=>e.getState().setCenter(r,i,o),fitBounds:async(r,i)=>{const{width:o,height:h,minZoom:S,maxZoom:y,panZoom:a}=e.getState(),l=Zu(r,o,h,S,y,(i==null?void 0:i.padding)??.1);return a?(await a.setViewport(l,{duration:i==null?void 0:i.duration,ease:i==null?void 0:i.ease,interpolate:i==null?void 0:i.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(r,i={})=>{const{transform:o,snapGrid:h,snapToGrid:S,domNode:y}=e.getState();if(!y)return r;const{x:a,y:l}=y.getBoundingClientRect(),_={x:r.x-a,y:r.y-l},v=i.snapGrid??h,c=i.snapToGrid??S;return Ms(_,o,c,v)},flowToScreenPosition:r=>{const{transform:i,domNode:o}=e.getState();if(!o)return r;const{x:h,y:S}=o.getBoundingClientRect(),y=Da(r,i);return{x:y.x+h,y:y.y+S}}}),[])};function Lg(e,r){const i=[],o=new Map,h=[];for(const S of e)if(S.type==="add"){h.push(S);continue}else if(S.type==="remove"||S.type==="replace")o.set(S.id,[S]);else{const y=o.get(S.id);y?y.push(S):o.set(S.id,[S])}for(const S of r){const y=o.get(S.id);if(!y){i.push(S);continue}if(y[0].type==="remove")continue;if(y[0].type==="replace"){i.push({...y[0].item});continue}const a={...S};for(const l of y)ax(l,a);i.push(a)}return h.length&&h.forEach(S=>{S.index!==void 0?i.splice(S.index,0,{...S.item}):i.push({...S.item})}),i}function ax(e,r){switch(e.type){case"select":{r.selected=e.selected;break}case"position":{typeof e.position<"u"&&(r.position=e.position),typeof e.dragging<"u"&&(r.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(r.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(r.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(r.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(r.resizing=e.resizing);break}}}function lx(e,r){return Lg(e,r)}function cx(e,r){return Lg(e,r)}function wn(e,r){return{id:e,type:"select",selected:r}}function oi(e,r=new Set,i=!1){const o=[];for(const[h,S]of e){const y=r.has(h);!(S.selected===void 0&&!y)&&S.selected!==y&&(i&&(S.selected=y),o.push(wn(S.id,y)))}return o}function Op({items:e=[],lookup:r}){var h;const i=[],o=new Map(e.map(S=>[S.id,S]));for(const[S,y]of e.entries()){const a=r.get(y.id),l=((h=a==null?void 0:a.internals)==null?void 0:h.userNode)??a;l!==void 0&&l!==y&&i.push({id:y.id,item:y,type:"replace"}),l===void 0&&i.push({item:y,type:"add",index:S})}for(const[S]of r)o.get(S)===void 0&&i.push({id:S,type:"remove"});return i}function Hp(e){return{id:e.id,type:"remove"}}const Fp=e=>TS(e),ux=e=>Q_(e);function Rg(e){return J.forwardRef(e)}function jp(e){const[r,i]=J.useState(BigInt(0)),[o]=J.useState(()=>hx(()=>i(h=>h+BigInt(1))));return Tu(()=>{const h=o.get();h.length&&(e(h),o.reset())},[r]),o}function hx(e){let r=[];return{get:()=>r,reset:()=>{r=[]},push:i=>{r.push(i),e()}}}const Dg=J.createContext(null);function dx({children:e}){const r=Ve(),i=J.useCallback(a=>{const{nodes:l=[],setNodes:_,hasDefaultNodes:v,onNodesChange:c,nodeLookup:m,fitViewQueued:C,onNodesChangeMiddlewareMap:b}=r.getState();let x=l;for(const p of a)x=typeof p=="function"?p(x):p;let f=Op({items:x,lookup:m});for(const p of b.values())f=p(f);v&&_(x),f.length>0?c==null||c(f):C&&window.requestAnimationFrame(()=>{const{fitViewQueued:p,nodes:d,setNodes:u}=r.getState();p&&u(d)})},[]),o=jp(i),h=J.useCallback(a=>{const{edges:l=[],setEdges:_,hasDefaultEdges:v,onEdgesChange:c,edgeLookup:m}=r.getState();let C=l;for(const b of a)C=typeof b=="function"?b(C):b;v?_(C):c&&c(Op({items:C,lookup:m}))},[]),S=jp(h),y=J.useMemo(()=>({nodeQueue:o,edgeQueue:S}),[]);return O.jsx(Dg.Provider,{value:y,children:e})}function fx(){const e=J.useContext(Dg);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const px=e=>!!e.panZoom;function oh(){const e=ox(),r=Ve(),i=fx(),o=Te(px),h=J.useMemo(()=>{const S=c=>r.getState().nodeLookup.get(c),y=c=>{i.nodeQueue.push(c)},a=c=>{i.edgeQueue.push(c)},l=c=>{var p,d;const{nodeLookup:m,nodeOrigin:C}=r.getState(),b=Fp(c)?c:m.get(c.id),x=b.parentId?ng(b.position,b.measured,b.parentId,m,C):b.position,f={...b,position:x,width:((p=b.measured)==null?void 0:p.width)??b.width,height:((d=b.measured)==null?void 0:d.height)??b.height};return fi(f)},_=(c,m,C={replace:!1})=>{y(b=>b.map(x=>{if(x.id===c){const f=typeof m=="function"?m(x):m;return C.replace&&Fp(f)?f:{...x,...f}}return x}))},v=(c,m,C={replace:!1})=>{a(b=>b.map(x=>{if(x.id===c){const f=typeof m=="function"?m(x):m;return C.replace&&ux(f)?f:{...x,...f}}return x}))};return{getNodes:()=>r.getState().nodes.map(c=>({...c})),getNode:c=>{var m;return(m=S(c))==null?void 0:m.internals.userNode},getInternalNode:S,getEdges:()=>{const{edges:c=[]}=r.getState();return c.map(m=>({...m}))},getEdge:c=>r.getState().edgeLookup.get(c),setNodes:y,setEdges:a,addNodes:c=>{const m=Array.isArray(c)?c:[c];i.nodeQueue.push(C=>[...C,...m])},addEdges:c=>{const m=Array.isArray(c)?c:[c];i.edgeQueue.push(C=>[...C,...m])},toObject:()=>{const{nodes:c=[],edges:m=[],transform:C}=r.getState(),[b,x,f]=C;return{nodes:c.map(p=>({...p})),edges:m.map(p=>({...p})),viewport:{x:b,y:x,zoom:f}}},deleteElements:async({nodes:c=[],edges:m=[]})=>{const{nodes:C,edges:b,onNodesDelete:x,onEdgesDelete:f,triggerNodeChanges:p,triggerEdgeChanges:d,onDelete:u,onBeforeDelete:w}=r.getState(),{nodes:L,edges:R}=await IS({nodesToRemove:c,edgesToRemove:m,nodes:C,edges:b,onBeforeDelete:w}),D=R.length>0,k=L.length>0;if(D){const M=R.map(Hp);f==null||f(R),d(M)}if(k){const M=L.map(Hp);x==null||x(L),p(M)}return(k||D)&&(u==null||u({nodes:L,edges:R})),{deletedNodes:L,deletedEdges:R}},getIntersectingNodes:(c,m=!0,C)=>{const b=hp(c),x=b?c:l(c),f=C!==void 0;return x?(C||r.getState().nodes).filter(p=>{const d=r.getState().nodeLookup.get(p.id);if(d&&!b&&(p.id===c.id||!d.internals.positionAbsolute))return!1;const u=fi(f?p:d),w=xs(u,x);return m&&w>0||w>=u.width*u.height||w>=x.width*x.height}):[]},isNodeIntersecting:(c,m,C=!0)=>{const x=hp(c)?c:l(c);if(!x)return!1;const f=xs(x,m);return C&&f>0||f>=m.width*m.height||f>=x.width*x.height},updateNode:_,updateNodeData:(c,m,C={replace:!1})=>{_(c,b=>{const x=typeof m=="function"?m(b):m;return C.replace?{...b,data:x}:{...b,data:{...b.data,...x}}},C)},updateEdge:v,updateEdgeData:(c,m,C={replace:!1})=>{v(c,b=>{const x=typeof m=="function"?m(b):m;return C.replace?{...b,data:x}:{...b,data:{...b.data,...x}}},C)},getNodesBounds:c=>{const{nodeLookup:m,nodeOrigin:C}=r.getState();return MS(c,{nodeLookup:m,nodeOrigin:C})},getHandleConnections:({type:c,id:m,nodeId:C})=>{var b;return Array.from(((b=r.getState().connectionLookup.get(`${C}-${c}${m?`-${m}`:""}`))==null?void 0:b.values())??[])},getNodeConnections:({type:c,handleId:m,nodeId:C})=>{var b;return Array.from(((b=r.getState().connectionLookup.get(`${C}${c?m?`-${c}-${m}`:`-${c}`:""}`))==null?void 0:b.values())??[])},fitView:async c=>{const m=r.getState().fitViewResolver??jS();return r.setState({fitViewQueued:!0,fitViewOptions:c,fitViewResolver:m}),i.nodeQueue.push(C=>[...C]),m.promise}}},[]);return J.useMemo(()=>({...h,...e,viewportInitialized:o}),[o])}const zp=e=>e.selected,_x=typeof window<"u"?window:void 0;function gx({deleteKeyCode:e,multiSelectionKeyCode:r}){const i=Ve(),{deleteElements:o}=oh(),h=Es(e,{actInsideInputWithModifier:!1}),S=Es(r,{target:_x});J.useEffect(()=>{if(h){const{edges:y,nodes:a}=i.getState();o({nodes:a.filter(zp),edges:y.filter(zp)}),i.setState({nodesSelectionActive:!1})}},[h]),J.useEffect(()=>{i.setState({multiSelectionActive:S})},[S])}function mx(e){const r=Ve();J.useEffect(()=>{const i=()=>{var h,S,y,a;if(!e.current||!(((S=(h=e.current).checkVisibility)==null?void 0:S.call(h))??!0))return!1;const o=eh(e.current);(o.height===0||o.width===0)&&((a=(y=r.getState()).onError)==null||a.call(y,"004",dr.error004())),r.setState({width:o.width||500,height:o.height||500})};if(e.current){i(),window.addEventListener("resize",i);const o=new ResizeObserver(()=>i());return o.observe(e.current),()=>{window.removeEventListener("resize",i),o&&e.current&&o.unobserve(e.current)}}},[])}const Va={position:"absolute",width:"100%",height:"100%",top:0,left:0},vx=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function yx({onPaneContextMenu:e,zoomOnScroll:r=!0,zoomOnPinch:i=!0,panOnScroll:o=!1,panOnScrollSpeed:h=.5,panOnScrollMode:S=xn.Free,zoomOnDoubleClick:y=!0,panOnDrag:a=!0,defaultViewport:l,translateExtent:_,minZoom:v,maxZoom:c,zoomActivationKeyCode:m,preventScrolling:C=!0,children:b,noWheelClassName:x,noPanClassName:f,onViewportChange:p,isControlledViewport:d,paneClickDistance:u,selectionOnDrag:w}){const L=Ve(),R=J.useRef(null),{userSelectionActive:D,lib:k,connectionInProgress:M}=Te(vx,Ue),W=Es(m),z=J.useRef();mx(R);const j=J.useCallback(N=>{p==null||p({x:N[0],y:N[1],zoom:N[2]}),d||L.setState({transform:N})},[p,d]);return J.useEffect(()=>{if(R.current){z.current=xC({domNode:R.current,minZoom:v,maxZoom:c,translateExtent:_,viewport:l,onDraggingChange:U=>L.setState(K=>K.paneDragging===U?K:{paneDragging:U}),onPanZoomStart:(U,K)=>{const{onViewportChangeStart:V,onMoveStart:T}=L.getState();T==null||T(U,K),V==null||V(K)},onPanZoom:(U,K)=>{const{onViewportChange:V,onMove:T}=L.getState();T==null||T(U,K),V==null||V(K)},onPanZoomEnd:(U,K)=>{const{onViewportChangeEnd:V,onMoveEnd:T}=L.getState();T==null||T(U,K),V==null||V(K)}});const{x:N,y:I,zoom:q}=z.current.getViewport();return L.setState({panZoom:z.current,transform:[N,I,q],domNode:R.current.closest(".react-flow")}),()=>{var U;(U=z.current)==null||U.destroy()}}},[]),J.useEffect(()=>{var N;(N=z.current)==null||N.update({onPaneContextMenu:e,zoomOnScroll:r,zoomOnPinch:i,panOnScroll:o,panOnScrollSpeed:h,panOnScrollMode:S,zoomOnDoubleClick:y,panOnDrag:a,zoomActivationKeyPressed:W,preventScrolling:C,noPanClassName:f,userSelectionActive:D,noWheelClassName:x,lib:k,onTransformChange:j,connectionInProgress:M,selectionOnDrag:w,paneClickDistance:u})},[e,r,i,o,h,S,y,a,W,C,f,D,x,k,j,M,w,u]),O.jsx("div",{className:"react-flow__renderer",ref:R,style:Va,children:b})}const wx=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Sx(){const{userSelectionActive:e,userSelectionRect:r}=Te(wx,Ue);return e&&r?O.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:r.width,height:r.height,transform:`translate(${r.x}px, ${r.y}px)`}}):null}const nu=(e,r)=>i=>{i.target===r.current&&(e==null||e(i))},Cx=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function xx({isSelecting:e,selectionKeyPressed:r,selectionMode:i=Cs.Full,panOnDrag:o,paneClickDistance:h,selectionOnDrag:S,onSelectionStart:y,onSelectionEnd:a,onPaneClick:l,onPaneContextMenu:_,onPaneScroll:v,onPaneMouseEnter:c,onPaneMouseMove:m,onPaneMouseLeave:C,children:b}){const x=Ve(),{userSelectionActive:f,elementsSelectable:p,dragging:d,connectionInProgress:u}=Te(Cx,Ue),w=p&&(e||f),L=J.useRef(null),R=J.useRef(),D=J.useRef(new Set),k=J.useRef(new Set),M=J.useRef(!1),W=V=>{if(M.current||u){M.current=!1;return}l==null||l(V),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},z=V=>{if(Array.isArray(o)&&(o!=null&&o.includes(2))){V.preventDefault();return}_==null||_(V)},j=v?V=>v(V):void 0,N=V=>{M.current&&(V.stopPropagation(),M.current=!1)},I=V=>{var ie,ae;const{domNode:T}=x.getState();if(R.current=T==null?void 0:T.getBoundingClientRect(),!R.current)return;const B=V.target===L.current;if(!B&&!!V.target.closest(".nokey")||!e||!(S&&B||r)||V.button!==0||!V.isPrimary)return;(ae=(ie=V.target)==null?void 0:ie.setPointerCapture)==null||ae.call(ie,V.pointerId),M.current=!1;const{x:G,y:Z}=er(V.nativeEvent,R.current);x.setState({userSelectionRect:{width:0,height:0,startX:G,startY:Z,x:G,y:Z}}),B||(V.stopPropagation(),V.preventDefault())},q=V=>{const{userSelectionRect:T,transform:B,nodeLookup:P,edgeLookup:F,connectionLookup:G,triggerNodeChanges:Z,triggerEdgeChanges:ie,defaultEdgeOptions:ae,resetSelectedElements:X}=x.getState();if(!R.current||!T)return;const{x:H,y:re}=er(V.nativeEvent,R.current),{startX:te,startY:ce}=T;if(!M.current){const ue=r?0:h;if(Math.hypot(H-te,re-ce)<=ue)return;X(),y==null||y(V)}M.current=!0;const le={startX:te,startY:ce,x:H<te?H:te,y:re<ce?re:ce,width:Math.abs(H-te),height:Math.abs(re-ce)},pe=D.current,Se=k.current;D.current=new Set(Ju(P,le,B,i===Cs.Partial,!0).map(ue=>ue.id)),k.current=new Set;const be=(ae==null?void 0:ae.selectable)??!0;for(const ue of D.current){const ge=G.get(ue);if(ge)for(const{edgeId:Re}of ge.values()){const Ie=F.get(Re);Ie&&(Ie.selectable??be)&&k.current.add(Re)}}if(!dp(pe,D.current)){const ue=oi(P,D.current,!0);Z(ue)}if(!dp(Se,k.current)){const ue=oi(F,k.current);ie(ue)}x.setState({userSelectionRect:le,userSelectionActive:!0,nodesSelectionActive:!1})},U=V=>{var T,B;V.button===0&&((B=(T=V.target)==null?void 0:T.releasePointerCapture)==null||B.call(T,V.pointerId),!f&&V.target===L.current&&x.getState().userSelectionRect&&(W==null||W(V)),x.setState({userSelectionActive:!1,userSelectionRect:null}),M.current&&(a==null||a(V),x.setState({nodesSelectionActive:D.current.size>0})))},K=o===!0||Array.isArray(o)&&o.includes(0);return O.jsxs("div",{className:rt(["react-flow__pane",{draggable:K,dragging:d,selection:e}]),onClick:w?void 0:nu(W,L),onContextMenu:nu(z,L),onWheel:nu(j,L),onPointerEnter:w?void 0:c,onPointerMove:w?q:m,onPointerUp:w?U:void 0,onPointerDownCapture:w?I:void 0,onClickCapture:w?N:void 0,onPointerLeave:C,ref:L,style:Va,children:[b,O.jsx(Sx,{})]})}function Mu({id:e,store:r,unselect:i=!1,nodeRef:o}){const{addSelectedNodes:h,unselectNodesAndEdges:S,multiSelectionActive:y,nodeLookup:a,onError:l}=r.getState(),_=a.get(e);if(!_){l==null||l("012",dr.error012(e));return}r.setState({nodesSelectionActive:!1}),_.selected?(i||_.selected&&y)&&(S({nodes:[_],edges:[]}),requestAnimationFrame(()=>{var v;return(v=o==null?void 0:o.current)==null?void 0:v.blur()})):h([e])}function Ag({nodeRef:e,disabled:r=!1,noDragClassName:i,handleSelector:o,nodeId:h,isSelectable:S,nodeClickDistance:y}){const a=Ve(),[l,_]=J.useState(!1),v=J.useRef();return J.useEffect(()=>{v.current=cC({getStoreItems:()=>a.getState(),onNodeMouseDown:c=>{Mu({id:c,store:a,nodeRef:e})},onDragStart:()=>{_(!0)},onDragStop:()=>{_(!1)}})},[]),J.useEffect(()=>{if(!(r||!e.current||!v.current))return v.current.update({noDragClassName:i,handleSelector:o,domNode:e.current,isSelectable:S,nodeId:h,nodeClickDistance:y}),()=>{var c;(c=v.current)==null||c.destroy()}},[i,o,r,S,e,h,y]),l}const bx=e=>r=>r.selected&&(r.draggable||e&&typeof r.draggable>"u");function Tg(){const e=Ve();return J.useCallback(i=>{const{nodeExtent:o,snapToGrid:h,snapGrid:S,nodesDraggable:y,onError:a,updateNodePositions:l,nodeLookup:_,nodeOrigin:v}=e.getState(),c=new Map,m=bx(y),C=h?S[0]:5,b=h?S[1]:5,x=i.direction.x*C*i.factor,f=i.direction.y*b*i.factor;for(const[,p]of _){if(!m(p))continue;let d={x:p.internals.positionAbsolute.x+x,y:p.internals.positionAbsolute.y+f};h&&(d=Ts(d,S));const{position:u,positionAbsolute:w}=J_({nodeId:p.id,nextPosition:d,nodeLookup:_,nodeExtent:o,nodeOrigin:v,onError:a});p.position=u,p.internals.positionAbsolute=w,c.set(p.id,p)}l(c)},[])}const ah=J.createContext(null),Ex=ah.Provider;ah.Consumer;const Mg=()=>J.useContext(ah),kx=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Lx=(e,r,i)=>o=>{const{connectionClickStartHandle:h,connectionMode:S,connection:y}=o,{fromHandle:a,toHandle:l,isValid:_}=y,v=(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===r&&(l==null?void 0:l.type)===i;return{connectingFrom:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===r&&(a==null?void 0:a.type)===i,connectingTo:v,clickConnecting:(h==null?void 0:h.nodeId)===e&&(h==null?void 0:h.id)===r&&(h==null?void 0:h.type)===i,isPossibleEndHandle:S===hi.Strict?(a==null?void 0:a.type)!==i:e!==(a==null?void 0:a.nodeId)||r!==(a==null?void 0:a.id),connectionInProcess:!!a,clickConnectionInProcess:!!h,valid:v&&_}};function Rx({type:e="source",position:r=xe.Top,isValidConnection:i,isConnectable:o=!0,isConnectableStart:h=!0,isConnectableEnd:S=!0,id:y,onConnect:a,children:l,className:_,onMouseDown:v,onTouchStart:c,...m},C){var q,U;const b=y||null,x=e==="target",f=Ve(),p=Mg(),{connectOnClick:d,noPanClassName:u,rfId:w}=Te(kx,Ue),{connectingFrom:L,connectingTo:R,clickConnecting:D,isPossibleEndHandle:k,connectionInProcess:M,clickConnectionInProcess:W,valid:z}=Te(Lx(p,b,e),Ue);p||(U=(q=f.getState()).onError)==null||U.call(q,"010",dr.error010());const j=K=>{const{defaultEdgeOptions:V,onConnect:T,hasDefaultEdges:B}=f.getState(),P={...V,...K};if(B){const{edges:F,setEdges:G}=f.getState();G(KS(P,F))}T==null||T(P),a==null||a(P)},N=K=>{if(!p)return;const V=og(K.nativeEvent);if(h&&(V&&K.button===0||!V)){const T=f.getState();Au.onPointerDown(K.nativeEvent,{handleDomNode:K.currentTarget,autoPanOnConnect:T.autoPanOnConnect,connectionMode:T.connectionMode,connectionRadius:T.connectionRadius,domNode:T.domNode,nodeLookup:T.nodeLookup,lib:T.lib,isTarget:x,handleId:b,nodeId:p,flowId:T.rfId,panBy:T.panBy,cancelConnection:T.cancelConnection,onConnectStart:T.onConnectStart,onConnectEnd:(...B)=>{var P,F;return(F=(P=f.getState()).onConnectEnd)==null?void 0:F.call(P,...B)},updateConnection:T.updateConnection,onConnect:j,isValidConnection:i||((...B)=>{var P,F;return((F=(P=f.getState()).isValidConnection)==null?void 0:F.call(P,...B))??!0}),getTransform:()=>f.getState().transform,getFromHandle:()=>f.getState().connection.fromHandle,autoPanSpeed:T.autoPanSpeed,dragThreshold:T.connectionDragThreshold})}V?v==null||v(K):c==null||c(K)},I=K=>{const{onClickConnectStart:V,onClickConnectEnd:T,connectionClickStartHandle:B,connectionMode:P,isValidConnection:F,lib:G,rfId:Z,nodeLookup:ie,connection:ae}=f.getState();if(!p||!B&&!h)return;if(!B){V==null||V(K.nativeEvent,{nodeId:p,handleId:b,handleType:e}),f.setState({connectionClickStartHandle:{nodeId:p,type:e,id:b}});return}const X=ig(K.target),H=i||F,{connection:re,isValid:te}=Au.isValid(K.nativeEvent,{handle:{nodeId:p,id:b,type:e},connectionMode:P,fromNodeId:B.nodeId,fromHandleId:B.id||null,fromType:B.type,isValidConnection:H,flowId:Z,doc:X,lib:G,nodeLookup:ie});te&&re&&j(re);const ce=structuredClone(ae);delete ce.inProgress,ce.toPosition=ce.toHandle?ce.toHandle.position:null,T==null||T(K,ce),f.setState({connectionClickStartHandle:null})};return O.jsx("div",{"data-handleid":b,"data-nodeid":p,"data-handlepos":r,"data-id":`${w}-${p}-${b}-${e}`,className:rt(["react-flow__handle",`react-flow__handle-${r}`,"nodrag",u,_,{source:!x,target:x,connectable:o,connectablestart:h,connectableend:S,clickconnecting:D,connectingfrom:L,connectingto:R,valid:z,connectionindicator:o&&(!M||k)&&(M||W?S:h)}]),onMouseDown:N,onTouchStart:N,onClick:d?I:void 0,ref:C,...m,children:l})}const gi=J.memo(Rg(Rx));function Dx({data:e,isConnectable:r,sourcePosition:i=xe.Bottom}){return O.jsxs(O.Fragment,{children:[e==null?void 0:e.label,O.jsx(gi,{type:"source",position:i,isConnectable:r})]})}function Ax({data:e,isConnectable:r,targetPosition:i=xe.Top,sourcePosition:o=xe.Bottom}){return O.jsxs(O.Fragment,{children:[O.jsx(gi,{type:"target",position:i,isConnectable:r}),e==null?void 0:e.label,O.jsx(gi,{type:"source",position:o,isConnectable:r})]})}function Tx(){return null}function Mx({data:e,isConnectable:r,targetPosition:i=xe.Top}){return O.jsxs(O.Fragment,{children:[O.jsx(gi,{type:"target",position:i,isConnectable:r}),e==null?void 0:e.label]})}const Aa={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},$p={input:Dx,default:Ax,output:Mx,group:Tx};function Px(e){var r,i,o,h;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((r=e.style)==null?void 0:r.width),height:e.height??e.initialHeight??((i=e.style)==null?void 0:i.height)}:{width:e.width??((o=e.style)==null?void 0:o.width),height:e.height??((h=e.style)==null?void 0:h.height)}}const Nx=e=>{const{width:r,height:i,x:o,y:h}=As(e.nodeLookup,{filter:S=>!!S.selected});return{width:Zt(r)?r:null,height:Zt(i)?i:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${h}px)`}};function Bx({onSelectionContextMenu:e,noPanClassName:r,disableKeyboardA11y:i}){const o=Ve(),{width:h,height:S,transformString:y,userSelectionActive:a}=Te(Nx,Ue),l=Tg(),_=J.useRef(null);J.useEffect(()=>{var C;i||(C=_.current)==null||C.focus({preventScroll:!0})},[i]);const v=!a&&h!==null&&S!==null;if(Ag({nodeRef:_,disabled:!v}),!v)return null;const c=e?C=>{const b=o.getState().nodes.filter(x=>x.selected);e(C,b)}:void 0,m=C=>{Object.prototype.hasOwnProperty.call(Aa,C.key)&&(C.preventDefault(),l({direction:Aa[C.key],factor:C.shiftKey?4:1}))};return O.jsx("div",{className:rt(["react-flow__nodesselection","react-flow__container",r]),style:{transform:y},children:O.jsx("div",{ref:_,className:"react-flow__nodesselection-rect",onContextMenu:c,tabIndex:i?void 0:-1,onKeyDown:i?void 0:m,style:{width:h,height:S}})})}const Wp=typeof window<"u"?window:void 0,Ix=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Pg({children:e,onPaneClick:r,onPaneMouseEnter:i,onPaneMouseMove:o,onPaneMouseLeave:h,onPaneContextMenu:S,onPaneScroll:y,paneClickDistance:a,deleteKeyCode:l,selectionKeyCode:_,selectionOnDrag:v,selectionMode:c,onSelectionStart:m,onSelectionEnd:C,multiSelectionKeyCode:b,panActivationKeyCode:x,zoomActivationKeyCode:f,elementsSelectable:p,zoomOnScroll:d,zoomOnPinch:u,panOnScroll:w,panOnScrollSpeed:L,panOnScrollMode:R,zoomOnDoubleClick:D,panOnDrag:k,defaultViewport:M,translateExtent:W,minZoom:z,maxZoom:j,preventScrolling:N,onSelectionContextMenu:I,noWheelClassName:q,noPanClassName:U,disableKeyboardA11y:K,onViewportChange:V,isControlledViewport:T}){const{nodesSelectionActive:B,userSelectionActive:P}=Te(Ix,Ue),F=Es(_,{target:Wp}),G=Es(x,{target:Wp}),Z=G||k,ie=G||w,ae=v&&Z!==!0,X=F||P||ae;return gx({deleteKeyCode:l,multiSelectionKeyCode:b}),O.jsx(yx,{onPaneContextMenu:S,elementsSelectable:p,zoomOnScroll:d,zoomOnPinch:u,panOnScroll:ie,panOnScrollSpeed:L,panOnScrollMode:R,zoomOnDoubleClick:D,panOnDrag:!F&&Z,defaultViewport:M,translateExtent:W,minZoom:z,maxZoom:j,zoomActivationKeyCode:f,preventScrolling:N,noWheelClassName:q,noPanClassName:U,onViewportChange:V,isControlledViewport:T,paneClickDistance:a,selectionOnDrag:ae,children:O.jsxs(xx,{onSelectionStart:m,onSelectionEnd:C,onPaneClick:r,onPaneMouseEnter:i,onPaneMouseMove:o,onPaneMouseLeave:h,onPaneContextMenu:S,onPaneScroll:y,panOnDrag:Z,isSelecting:!!X,selectionMode:c,selectionKeyPressed:F,paneClickDistance:a,selectionOnDrag:ae,children:[e,B&&O.jsx(Bx,{onSelectionContextMenu:I,noPanClassName:U,disableKeyboardA11y:K})]})})}Pg.displayName="FlowRenderer";const Ox=J.memo(Pg),Hx=e=>r=>e?Ju(r.nodeLookup,{x:0,y:0,width:r.width,height:r.height},r.transform,!0).map(i=>i.id):Array.from(r.nodeLookup.keys());function Fx(e){return Te(J.useCallback(Hx(e),[e]),Ue)}const jx=e=>e.updateNodeInternals;function zx(){const e=Te(jx),[r]=J.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(i=>{const o=new Map;i.forEach(h=>{const S=h.target.getAttribute("data-id");o.set(S,{id:S,nodeElement:h.target,force:!0})}),e(o)}));return J.useEffect(()=>()=>{r==null||r.disconnect()},[r]),r}function $x({node:e,nodeType:r,hasDimensions:i,resizeObserver:o}){const h=Ve(),S=J.useRef(null),y=J.useRef(null),a=J.useRef(e.sourcePosition),l=J.useRef(e.targetPosition),_=J.useRef(r),v=i&&!!e.internals.handleBounds;return J.useEffect(()=>{S.current&&!e.hidden&&(!v||y.current!==S.current)&&(y.current&&(o==null||o.unobserve(y.current)),o==null||o.observe(S.current),y.current=S.current)},[v,e.hidden]),J.useEffect(()=>()=>{y.current&&(o==null||o.unobserve(y.current),y.current=null)},[]),J.useEffect(()=>{if(S.current){const c=_.current!==r,m=a.current!==e.sourcePosition,C=l.current!==e.targetPosition;(c||m||C)&&(_.current=r,a.current=e.sourcePosition,l.current=e.targetPosition,h.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:S.current,force:!0}]])))}},[e.id,r,e.sourcePosition,e.targetPosition]),S}function Wx({id:e,onClick:r,onMouseEnter:i,onMouseMove:o,onMouseLeave:h,onContextMenu:S,onDoubleClick:y,nodesDraggable:a,elementsSelectable:l,nodesConnectable:_,nodesFocusable:v,resizeObserver:c,noDragClassName:m,noPanClassName:C,disableKeyboardA11y:b,rfId:x,nodeTypes:f,nodeClickDistance:p,onError:d}){const{node:u,internals:w,isParent:L}=Te(H=>{const re=H.nodeLookup.get(e),te=H.parentLookup.has(e);return{node:re,internals:re.internals,isParent:te}},Ue);let R=u.type||"default",D=(f==null?void 0:f[R])||$p[R];D===void 0&&(d==null||d("003",dr.error003(R)),R="default",D=(f==null?void 0:f.default)||$p.default);const k=!!(u.draggable||a&&typeof u.draggable>"u"),M=!!(u.selectable||l&&typeof u.selectable>"u"),W=!!(u.connectable||_&&typeof u.connectable>"u"),z=!!(u.focusable||v&&typeof u.focusable>"u"),j=Ve(),N=rg(u),I=$x({node:u,nodeType:R,hasDimensions:N,resizeObserver:c}),q=Ag({nodeRef:I,disabled:u.hidden||!k,noDragClassName:m,handleSelector:u.dragHandle,nodeId:e,isSelectable:M,nodeClickDistance:p}),U=Tg();if(u.hidden)return null;const K=Rr(u),V=Px(u),T=M||k||r||i||o||h,B=i?H=>i(H,{...w.userNode}):void 0,P=o?H=>o(H,{...w.userNode}):void 0,F=h?H=>h(H,{...w.userNode}):void 0,G=S?H=>S(H,{...w.userNode}):void 0,Z=y?H=>y(H,{...w.userNode}):void 0,ie=H=>{const{selectNodesOnDrag:re,nodeDragThreshold:te}=j.getState();M&&(!re||!k||te>0)&&Mu({id:e,store:j,nodeRef:I}),r&&r(H,{...w.userNode})},ae=H=>{if(!(sg(H.nativeEvent)||b)){if(K_.includes(H.key)&&M){const re=H.key==="Escape";Mu({id:e,store:j,unselect:re,nodeRef:I})}else if(k&&u.selected&&Object.prototype.hasOwnProperty.call(Aa,H.key)){H.preventDefault();const{ariaLabelConfig:re}=j.getState();j.setState({ariaLiveMessage:re["node.a11yDescription.ariaLiveMessage"]({direction:H.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),U({direction:Aa[H.key],factor:H.shiftKey?4:1})}}},X=()=>{var Se;if(b||!((Se=I.current)!=null&&Se.matches(":focus-visible")))return;const{transform:H,width:re,height:te,autoPanOnNodeFocus:ce,setCenter:le}=j.getState();if(!ce)return;Ju(new Map([[e,u]]),{x:0,y:0,width:re,height:te},H,!0).length>0||le(u.position.x+K.width/2,u.position.y+K.height/2,{zoom:H[2]})};return O.jsx("div",{className:rt(["react-flow__node",`react-flow__node-${R}`,{[C]:k},u.className,{selected:u.selected,selectable:M,parent:L,draggable:k,dragging:q}]),ref:I,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:T?"all":"none",visibility:N?"visible":"hidden",...u.style,...V},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:B,onMouseMove:P,onMouseLeave:F,onContextMenu:G,onClick:ie,onDoubleClick:Z,onKeyDown:z?ae:void 0,tabIndex:z?0:void 0,onFocus:z?X:void 0,role:u.ariaRole??(z?"group":void 0),"aria-roledescription":"node","aria-describedby":b?void 0:`${bg}-${x}`,"aria-label":u.ariaLabel,...u.domAttributes,children:O.jsx(Ex,{value:e,children:O.jsx(D,{id:e,data:u.data,type:R,positionAbsoluteX:w.positionAbsolute.x,positionAbsoluteY:w.positionAbsolute.y,selected:u.selected??!1,selectable:M,draggable:k,deletable:u.deletable??!0,isConnectable:W,sourcePosition:u.sourcePosition,targetPosition:u.targetPosition,dragging:q,dragHandle:u.dragHandle,zIndex:w.z,parentId:u.parentId,...K})})})}var Ux=J.memo(Wx);const Vx=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Ng(e){const{nodesDraggable:r,nodesConnectable:i,nodesFocusable:o,elementsSelectable:h,onError:S}=Te(Vx,Ue),y=Fx(e.onlyRenderVisibleElements),a=zx();return O.jsx("div",{className:"react-flow__nodes",style:Va,children:y.map(l=>O.jsx(Ux,{id:l,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:a,nodesDraggable:r,nodesConnectable:i,nodesFocusable:o,elementsSelectable:h,nodeClickDistance:e.nodeClickDistance,onError:S},l))})}Ng.displayName="NodeRenderer";const qx=J.memo(Ng);function Kx(e){return Te(J.useCallback(i=>{if(!e)return i.edges.map(h=>h.id);const o=[];if(i.width&&i.height)for(const h of i.edges){const S=i.nodeLookup.get(h.source),y=i.nodeLookup.get(h.target);S&&y&&US({sourceNode:S,targetNode:y,width:i.width,height:i.height,transform:i.transform})&&o.push(h.id)}return o},[e]),Ue)}const Xx=({color:e="none",strokeWidth:r=1})=>{const i={strokeWidth:r,...e&&{stroke:e}};return O.jsx("polyline",{className:"arrow",style:i,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Yx=({color:e="none",strokeWidth:r=1})=>{const i={strokeWidth:r,...e&&{stroke:e,fill:e}};return O.jsx("polyline",{className:"arrowclosed",style:i,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Up={[La.Arrow]:Xx,[La.ArrowClosed]:Yx};function Gx(e){const r=Ve();return J.useMemo(()=>{var h,S;return Object.prototype.hasOwnProperty.call(Up,e)?Up[e]:((S=(h=r.getState()).onError)==null||S.call(h,"009",dr.error009(e)),null)},[e])}const Qx=({id:e,type:r,color:i,width:o=12.5,height:h=12.5,markerUnits:S="strokeWidth",strokeWidth:y,orient:a="auto-start-reverse"})=>{const l=Gx(r);return l?O.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${h}`,viewBox:"-10 -10 20 20",markerUnits:S,orient:a,refX:"0",refY:"0",children:O.jsx(l,{color:i,strokeWidth:y})}):null},Bg=({defaultColor:e,rfId:r})=>{const i=Te(S=>S.edges),o=Te(S=>S.defaultEdgeOptions),h=J.useMemo(()=>JS(i,{id:r,defaultColor:e,defaultMarkerStart:o==null?void 0:o.markerStart,defaultMarkerEnd:o==null?void 0:o.markerEnd}),[i,o,r,e]);return h.length?O.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:O.jsx("defs",{children:h.map(S=>O.jsx(Qx,{id:S.id,type:S.type,color:S.color,width:S.width,height:S.height,markerUnits:S.markerUnits,strokeWidth:S.strokeWidth,orient:S.orient},S.id))})}):null};Bg.displayName="MarkerDefinitions";var Jx=J.memo(Bg);function Ig({x:e,y:r,label:i,labelStyle:o,labelShowBg:h=!0,labelBgStyle:S,labelBgPadding:y=[2,4],labelBgBorderRadius:a=2,children:l,className:_,...v}){const[c,m]=J.useState({x:1,y:0,width:0,height:0}),C=rt(["react-flow__edge-textwrapper",_]),b=J.useRef(null);return J.useEffect(()=>{if(b.current){const x=b.current.getBBox();m({x:x.x,y:x.y,width:x.width,height:x.height})}},[i]),i?O.jsxs("g",{transform:`translate(${e-c.width/2} ${r-c.height/2})`,className:C,visibility:c.width?"visible":"hidden",...v,children:[h&&O.jsx("rect",{width:c.width+2*y[0],x:-y[0],y:-y[1],height:c.height+2*y[1],className:"react-flow__edge-textbg",style:S,rx:a,ry:a}),O.jsx("text",{className:"react-flow__edge-text",y:c.height/2,dy:"0.3em",ref:b,style:o,children:i}),l]}):null}Ig.displayName="EdgeText";const Zx=J.memo(Ig);function qa({path:e,labelX:r,labelY:i,label:o,labelStyle:h,labelShowBg:S,labelBgStyle:y,labelBgPadding:a,labelBgBorderRadius:l,interactionWidth:_=20,...v}){return O.jsxs(O.Fragment,{children:[O.jsx("path",{...v,d:e,fill:"none",className:rt(["react-flow__edge-path",v.className])}),_?O.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:_,className:"react-flow__edge-interaction"}):null,o&&Zt(r)&&Zt(i)?O.jsx(Zx,{x:r,y:i,label:o,labelStyle:h,labelShowBg:S,labelBgStyle:y,labelBgPadding:a,labelBgBorderRadius:l}):null]})}function Vp({pos:e,x1:r,y1:i,x2:o,y2:h}){return e===xe.Left||e===xe.Right?[.5*(r+o),i]:[r,.5*(i+h)]}function Og({sourceX:e,sourceY:r,sourcePosition:i=xe.Bottom,targetX:o,targetY:h,targetPosition:S=xe.Top}){const[y,a]=Vp({pos:i,x1:e,y1:r,x2:o,y2:h}),[l,_]=Vp({pos:S,x1:o,y1:h,x2:e,y2:r}),[v,c,m,C]=ag({sourceX:e,sourceY:r,targetX:o,targetY:h,sourceControlX:y,sourceControlY:a,targetControlX:l,targetControlY:_});return[`M${e},${r} C${y},${a} ${l},${_} ${o},${h}`,v,c,m,C]}function Hg(e){return J.memo(({id:r,sourceX:i,sourceY:o,targetX:h,targetY:S,sourcePosition:y,targetPosition:a,label:l,labelStyle:_,labelShowBg:v,labelBgStyle:c,labelBgPadding:m,labelBgBorderRadius:C,style:b,markerEnd:x,markerStart:f,interactionWidth:p})=>{const[d,u,w]=Og({sourceX:i,sourceY:o,sourcePosition:y,targetX:h,targetY:S,targetPosition:a}),L=e.isInternal?void 0:r;return O.jsx(qa,{id:L,path:d,labelX:u,labelY:w,label:l,labelStyle:_,labelShowBg:v,labelBgStyle:c,labelBgPadding:m,labelBgBorderRadius:C,style:b,markerEnd:x,markerStart:f,interactionWidth:p})})}const e2=Hg({isInternal:!1}),Fg=Hg({isInternal:!0});e2.displayName="SimpleBezierEdge";Fg.displayName="SimpleBezierEdgeInternal";function jg(e){return J.memo(({id:r,sourceX:i,sourceY:o,targetX:h,targetY:S,label:y,labelStyle:a,labelShowBg:l,labelBgStyle:_,labelBgPadding:v,labelBgBorderRadius:c,style:m,sourcePosition:C=xe.Bottom,targetPosition:b=xe.Top,markerEnd:x,markerStart:f,pathOptions:p,interactionWidth:d})=>{const[u,w,L]=Lu({sourceX:i,sourceY:o,sourcePosition:C,targetX:h,targetY:S,targetPosition:b,borderRadius:p==null?void 0:p.borderRadius,offset:p==null?void 0:p.offset,stepPosition:p==null?void 0:p.stepPosition}),R=e.isInternal?void 0:r;return O.jsx(qa,{id:R,path:u,labelX:w,labelY:L,label:y,labelStyle:a,labelShowBg:l,labelBgStyle:_,labelBgPadding:v,labelBgBorderRadius:c,style:m,markerEnd:x,markerStart:f,interactionWidth:d})})}const zg=jg({isInternal:!1}),$g=jg({isInternal:!0});zg.displayName="SmoothStepEdge";$g.displayName="SmoothStepEdgeInternal";function Wg(e){return J.memo(({id:r,...i})=>{var h;const o=e.isInternal?void 0:r;return O.jsx(zg,{...i,id:o,pathOptions:J.useMemo(()=>{var S;return{borderRadius:0,offset:(S=i.pathOptions)==null?void 0:S.offset}},[(h=i.pathOptions)==null?void 0:h.offset])})})}const t2=Wg({isInternal:!1}),Ug=Wg({isInternal:!0});t2.displayName="StepEdge";Ug.displayName="StepEdgeInternal";function Vg(e){return J.memo(({id:r,sourceX:i,sourceY:o,targetX:h,targetY:S,label:y,labelStyle:a,labelShowBg:l,labelBgStyle:_,labelBgPadding:v,labelBgBorderRadius:c,style:m,markerEnd:C,markerStart:b,interactionWidth:x})=>{const[f,p,d]=ug({sourceX:i,sourceY:o,targetX:h,targetY:S}),u=e.isInternal?void 0:r;return O.jsx(qa,{id:u,path:f,labelX:p,labelY:d,label:y,labelStyle:a,labelShowBg:l,labelBgStyle:_,labelBgPadding:v,labelBgBorderRadius:c,style:m,markerEnd:C,markerStart:b,interactionWidth:x})})}const r2=Vg({isInternal:!1}),qg=Vg({isInternal:!0});r2.displayName="StraightEdge";qg.displayName="StraightEdgeInternal";function Kg(e){return J.memo(({id:r,sourceX:i,sourceY:o,targetX:h,targetY:S,sourcePosition:y=xe.Bottom,targetPosition:a=xe.Top,label:l,labelStyle:_,labelShowBg:v,labelBgStyle:c,labelBgPadding:m,labelBgBorderRadius:C,style:b,markerEnd:x,markerStart:f,pathOptions:p,interactionWidth:d})=>{const[u,w,L]=lg({sourceX:i,sourceY:o,sourcePosition:y,targetX:h,targetY:S,targetPosition:a,curvature:p==null?void 0:p.curvature}),R=e.isInternal?void 0:r;return O.jsx(qa,{id:R,path:u,labelX:w,labelY:L,label:l,labelStyle:_,labelShowBg:v,labelBgStyle:c,labelBgPadding:m,labelBgBorderRadius:C,style:b,markerEnd:x,markerStart:f,interactionWidth:d})})}const n2=Kg({isInternal:!1}),Xg=Kg({isInternal:!0});n2.displayName="BezierEdge";Xg.displayName="BezierEdgeInternal";const qp={default:Xg,straight:qg,step:Ug,smoothstep:$g,simplebezier:Fg},Kp={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},i2=(e,r,i)=>i===xe.Left?e-r:i===xe.Right?e+r:e,s2=(e,r,i)=>i===xe.Top?e-r:i===xe.Bottom?e+r:e,Xp="react-flow__edgeupdater";function Yp({position:e,centerX:r,centerY:i,radius:o=10,onMouseDown:h,onMouseEnter:S,onMouseOut:y,type:a}){return O.jsx("circle",{onMouseDown:h,onMouseEnter:S,onMouseOut:y,className:rt([Xp,`${Xp}-${a}`]),cx:i2(r,o,e),cy:s2(i,o,e),r:o,stroke:"transparent",fill:"transparent"})}function o2({isReconnectable:e,reconnectRadius:r,edge:i,sourceX:o,sourceY:h,targetX:S,targetY:y,sourcePosition:a,targetPosition:l,onReconnect:_,onReconnectStart:v,onReconnectEnd:c,setReconnecting:m,setUpdateHover:C}){const b=Ve(),x=(w,L)=>{if(w.button!==0)return;const{autoPanOnConnect:R,domNode:D,connectionMode:k,connectionRadius:M,lib:W,onConnectStart:z,cancelConnection:j,nodeLookup:N,rfId:I,panBy:q,updateConnection:U}=b.getState(),K=L.type==="target",V=(P,F)=>{m(!1),c==null||c(P,i,L.type,F)},T=P=>_==null?void 0:_(i,P),B=(P,F)=>{m(!0),v==null||v(w,i,L.type),z==null||z(P,F)};Au.onPointerDown(w.nativeEvent,{autoPanOnConnect:R,connectionMode:k,connectionRadius:M,domNode:D,handleId:L.id,nodeId:L.nodeId,nodeLookup:N,isTarget:K,edgeUpdaterType:L.type,lib:W,flowId:I,cancelConnection:j,panBy:q,isValidConnection:(...P)=>{var F,G;return((G=(F=b.getState()).isValidConnection)==null?void 0:G.call(F,...P))??!0},onConnect:T,onConnectStart:B,onConnectEnd:(...P)=>{var F,G;return(G=(F=b.getState()).onConnectEnd)==null?void 0:G.call(F,...P)},onReconnectEnd:V,updateConnection:U,getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,dragThreshold:b.getState().connectionDragThreshold,handleDomNode:w.currentTarget})},f=w=>x(w,{nodeId:i.target,id:i.targetHandle??null,type:"target"}),p=w=>x(w,{nodeId:i.source,id:i.sourceHandle??null,type:"source"}),d=()=>C(!0),u=()=>C(!1);return O.jsxs(O.Fragment,{children:[(e===!0||e==="source")&&O.jsx(Yp,{position:a,centerX:o,centerY:h,radius:r,onMouseDown:f,onMouseEnter:d,onMouseOut:u,type:"source"}),(e===!0||e==="target")&&O.jsx(Yp,{position:l,centerX:S,centerY:y,radius:r,onMouseDown:p,onMouseEnter:d,onMouseOut:u,type:"target"})]})}function a2({id:e,edgesFocusable:r,edgesReconnectable:i,elementsSelectable:o,onClick:h,onDoubleClick:S,onContextMenu:y,onMouseEnter:a,onMouseMove:l,onMouseLeave:_,reconnectRadius:v,onReconnect:c,onReconnectStart:m,onReconnectEnd:C,rfId:b,edgeTypes:x,noPanClassName:f,onError:p,disableKeyboardA11y:d}){let u=Te(le=>le.edgeLookup.get(e));const w=Te(le=>le.defaultEdgeOptions);u=w?{...w,...u}:u;let L=u.type||"default",R=(x==null?void 0:x[L])||qp[L];R===void 0&&(p==null||p("011",dr.error011(L)),L="default",R=(x==null?void 0:x.default)||qp.default);const D=!!(u.focusable||r&&typeof u.focusable>"u"),k=typeof c<"u"&&(u.reconnectable||i&&typeof u.reconnectable>"u"),M=!!(u.selectable||o&&typeof u.selectable>"u"),W=J.useRef(null),[z,j]=J.useState(!1),[N,I]=J.useState(!1),q=Ve(),{zIndex:U,sourceX:K,sourceY:V,targetX:T,targetY:B,sourcePosition:P,targetPosition:F}=Te(J.useCallback(le=>{const pe=le.nodeLookup.get(u.source),Se=le.nodeLookup.get(u.target);if(!pe||!Se)return{zIndex:u.zIndex,...Kp};const be=QS({id:e,sourceNode:pe,targetNode:Se,sourceHandle:u.sourceHandle||null,targetHandle:u.targetHandle||null,connectionMode:le.connectionMode,onError:p});return{zIndex:WS({selected:u.selected,zIndex:u.zIndex,sourceNode:pe,targetNode:Se,elevateOnSelect:le.elevateEdgesOnSelect,zIndexMode:le.zIndexMode}),...be||Kp}},[u.source,u.target,u.sourceHandle,u.targetHandle,u.selected,u.zIndex]),Ue),G=J.useMemo(()=>u.markerStart?`url('#${Ru(u.markerStart,b)}')`:void 0,[u.markerStart,b]),Z=J.useMemo(()=>u.markerEnd?`url('#${Ru(u.markerEnd,b)}')`:void 0,[u.markerEnd,b]);if(u.hidden||K===null||V===null||T===null||B===null)return null;const ie=le=>{var ue;const{addSelectedEdges:pe,unselectNodesAndEdges:Se,multiSelectionActive:be}=q.getState();M&&(q.setState({nodesSelectionActive:!1}),u.selected&&be?(Se({nodes:[],edges:[u]}),(ue=W.current)==null||ue.blur()):pe([e])),h&&h(le,u)},ae=S?le=>{S(le,{...u})}:void 0,X=y?le=>{y(le,{...u})}:void 0,H=a?le=>{a(le,{...u})}:void 0,re=l?le=>{l(le,{...u})}:void 0,te=_?le=>{_(le,{...u})}:void 0,ce=le=>{var pe;if(!d&&K_.includes(le.key)&&M){const{unselectNodesAndEdges:Se,addSelectedEdges:be}=q.getState();le.key==="Escape"?((pe=W.current)==null||pe.blur(),Se({edges:[u]})):be([e])}};return O.jsx("svg",{style:{zIndex:U},children:O.jsxs("g",{className:rt(["react-flow__edge",`react-flow__edge-${L}`,u.className,f,{selected:u.selected,animated:u.animated,inactive:!M&&!h,updating:z,selectable:M}]),onClick:ie,onDoubleClick:ae,onContextMenu:X,onMouseEnter:H,onMouseMove:re,onMouseLeave:te,onKeyDown:D?ce:void 0,tabIndex:D?0:void 0,role:u.ariaRole??(D?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":u.ariaLabel===null?void 0:u.ariaLabel||`Edge from ${u.source} to ${u.target}`,"aria-describedby":D?`${Eg}-${b}`:void 0,ref:W,...u.domAttributes,children:[!N&&O.jsx(R,{id:e,source:u.source,target:u.target,type:u.type,selected:u.selected,animated:u.animated,selectable:M,deletable:u.deletable??!0,label:u.label,labelStyle:u.labelStyle,labelShowBg:u.labelShowBg,labelBgStyle:u.labelBgStyle,labelBgPadding:u.labelBgPadding,labelBgBorderRadius:u.labelBgBorderRadius,sourceX:K,sourceY:V,targetX:T,targetY:B,sourcePosition:P,targetPosition:F,data:u.data,style:u.style,sourceHandleId:u.sourceHandle,targetHandleId:u.targetHandle,markerStart:G,markerEnd:Z,pathOptions:"pathOptions"in u?u.pathOptions:void 0,interactionWidth:u.interactionWidth}),k&&O.jsx(o2,{edge:u,isReconnectable:k,reconnectRadius:v,onReconnect:c,onReconnectStart:m,onReconnectEnd:C,sourceX:K,sourceY:V,targetX:T,targetY:B,sourcePosition:P,targetPosition:F,setUpdateHover:j,setReconnecting:I})]})})}var l2=J.memo(a2);const c2=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Yg({defaultMarkerColor:e,onlyRenderVisibleElements:r,rfId:i,edgeTypes:o,noPanClassName:h,onReconnect:S,onEdgeContextMenu:y,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:_,onEdgeClick:v,reconnectRadius:c,onEdgeDoubleClick:m,onReconnectStart:C,onReconnectEnd:b,disableKeyboardA11y:x}){const{edgesFocusable:f,edgesReconnectable:p,elementsSelectable:d,onError:u}=Te(c2,Ue),w=Kx(r);return O.jsxs("div",{className:"react-flow__edges",children:[O.jsx(Jx,{defaultColor:e,rfId:i}),w.map(L=>O.jsx(l2,{id:L,edgesFocusable:f,edgesReconnectable:p,elementsSelectable:d,noPanClassName:h,onReconnect:S,onContextMenu:y,onMouseEnter:a,onMouseMove:l,onMouseLeave:_,onClick:v,reconnectRadius:c,onDoubleClick:m,onReconnectStart:C,onReconnectEnd:b,rfId:i,onError:u,edgeTypes:o,disableKeyboardA11y:x},L))]})}Yg.displayName="EdgeRenderer";const u2=J.memo(Yg),h2=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function d2({children:e}){const r=Te(h2);return O.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:r},children:e})}function f2(e){const r=oh(),i=J.useRef(!1);J.useEffect(()=>{!i.current&&r.viewportInitialized&&e&&(setTimeout(()=>e(r),1),i.current=!0)},[e,r.viewportInitialized])}const p2=e=>{var r;return(r=e.panZoom)==null?void 0:r.syncViewport};function _2(e){const r=Te(p2),i=Ve();return J.useEffect(()=>{e&&(r==null||r(e),i.setState({transform:[e.x,e.y,e.zoom]}))},[e,r]),null}function g2(e){return e.connection.inProgress?{...e.connection,to:Ms(e.connection.to,e.transform)}:{...e.connection}}function m2(e){return g2}function v2(e){const r=m2();return Te(r,Ue)}const y2=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function w2({containerStyle:e,style:r,type:i,component:o}){const{nodesConnectable:h,width:S,height:y,isValid:a,inProgress:l}=Te(y2,Ue);return!(S&&h&&l)?null:O.jsx("svg",{style:e,width:S,height:y,className:"react-flow__connectionline react-flow__container",children:O.jsx("g",{className:rt(["react-flow__connection",G_(a)]),children:O.jsx(Gg,{style:r,type:i,CustomComponent:o,isValid:a})})})}const Gg=({style:e,type:r=Zr.Bezier,CustomComponent:i,isValid:o})=>{const{inProgress:h,from:S,fromNode:y,fromHandle:a,fromPosition:l,to:_,toNode:v,toHandle:c,toPosition:m,pointer:C}=v2();if(!h)return;if(i)return O.jsx(i,{connectionLineType:r,connectionLineStyle:e,fromNode:y,fromHandle:a,fromX:S.x,fromY:S.y,toX:_.x,toY:_.y,fromPosition:l,toPosition:m,connectionStatus:G_(o),toNode:v,toHandle:c,pointer:C});let b="";const x={sourceX:S.x,sourceY:S.y,sourcePosition:l,targetX:_.x,targetY:_.y,targetPosition:m};switch(r){case Zr.Bezier:[b]=lg(x);break;case Zr.SimpleBezier:[b]=Og(x);break;case Zr.Step:[b]=Lu({...x,borderRadius:0});break;case Zr.SmoothStep:[b]=Lu(x);break;default:[b]=ug(x)}return O.jsx("path",{d:b,fill:"none",className:"react-flow__connection-path",style:e})};Gg.displayName="ConnectionLine";const S2={};function Gp(e=S2){J.useRef(e),Ve(),J.useEffect(()=>{},[e])}function C2(){Ve(),J.useRef(!1),J.useEffect(()=>{},[])}function Qg({nodeTypes:e,edgeTypes:r,onInit:i,onNodeClick:o,onEdgeClick:h,onNodeDoubleClick:S,onEdgeDoubleClick:y,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:_,onNodeContextMenu:v,onSelectionContextMenu:c,onSelectionStart:m,onSelectionEnd:C,connectionLineType:b,connectionLineStyle:x,connectionLineComponent:f,connectionLineContainerStyle:p,selectionKeyCode:d,selectionOnDrag:u,selectionMode:w,multiSelectionKeyCode:L,panActivationKeyCode:R,zoomActivationKeyCode:D,deleteKeyCode:k,onlyRenderVisibleElements:M,elementsSelectable:W,defaultViewport:z,translateExtent:j,minZoom:N,maxZoom:I,preventScrolling:q,defaultMarkerColor:U,zoomOnScroll:K,zoomOnPinch:V,panOnScroll:T,panOnScrollSpeed:B,panOnScrollMode:P,zoomOnDoubleClick:F,panOnDrag:G,onPaneClick:Z,onPaneMouseEnter:ie,onPaneMouseMove:ae,onPaneMouseLeave:X,onPaneScroll:H,onPaneContextMenu:re,paneClickDistance:te,nodeClickDistance:ce,onEdgeContextMenu:le,onEdgeMouseEnter:pe,onEdgeMouseMove:Se,onEdgeMouseLeave:be,reconnectRadius:ue,onReconnect:ge,onReconnectStart:Re,onReconnectEnd:Ie,noDragClassName:ze,noWheelClassName:Qe,noPanClassName:ut,disableKeyboardA11y:qe,nodeExtent:pt,rfId:Ne,viewport:Je,onViewportChange:ht}){return Gp(e),Gp(r),C2(),f2(i),_2(Je),O.jsx(Ox,{onPaneClick:Z,onPaneMouseEnter:ie,onPaneMouseMove:ae,onPaneMouseLeave:X,onPaneContextMenu:re,onPaneScroll:H,paneClickDistance:te,deleteKeyCode:k,selectionKeyCode:d,selectionOnDrag:u,selectionMode:w,onSelectionStart:m,onSelectionEnd:C,multiSelectionKeyCode:L,panActivationKeyCode:R,zoomActivationKeyCode:D,elementsSelectable:W,zoomOnScroll:K,zoomOnPinch:V,zoomOnDoubleClick:F,panOnScroll:T,panOnScrollSpeed:B,panOnScrollMode:P,panOnDrag:G,defaultViewport:z,translateExtent:j,minZoom:N,maxZoom:I,onSelectionContextMenu:c,preventScrolling:q,noDragClassName:ze,noWheelClassName:Qe,noPanClassName:ut,disableKeyboardA11y:qe,onViewportChange:ht,isControlledViewport:!!Je,children:O.jsxs(d2,{children:[O.jsx(u2,{edgeTypes:r,onEdgeClick:h,onEdgeDoubleClick:y,onReconnect:ge,onReconnectStart:Re,onReconnectEnd:Ie,onlyRenderVisibleElements:M,onEdgeContextMenu:le,onEdgeMouseEnter:pe,onEdgeMouseMove:Se,onEdgeMouseLeave:be,reconnectRadius:ue,defaultMarkerColor:U,noPanClassName:ut,disableKeyboardA11y:qe,rfId:Ne}),O.jsx(w2,{style:x,type:b,component:f,containerStyle:p}),O.jsx("div",{className:"react-flow__edgelabel-renderer"}),O.jsx(qx,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:S,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:_,onNodeContextMenu:v,nodeClickDistance:ce,onlyRenderVisibleElements:M,noPanClassName:ut,noDragClassName:ze,disableKeyboardA11y:qe,nodeExtent:pt,rfId:Ne}),O.jsx("div",{className:"react-flow__viewport-portal"})]})})}Qg.displayName="GraphView";const x2=J.memo(Qg),Qp=({nodes:e,edges:r,defaultNodes:i,defaultEdges:o,width:h,height:S,fitView:y,fitViewOptions:a,minZoom:l=.5,maxZoom:_=2,nodeOrigin:v,nodeExtent:c,zIndexMode:m="basic"}={})=>{const C=new Map,b=new Map,x=new Map,f=new Map,p=o??r??[],d=i??e??[],u=v??[0,0],w=c??Ss;fg(x,f,p);const{nodesInitialized:L}=Du(d,C,b,{nodeOrigin:u,nodeExtent:w,zIndexMode:m});let R=[0,0,1];if(y&&h&&S){const D=As(C,{filter:z=>!!((z.width||z.initialWidth)&&(z.height||z.initialHeight))}),{x:k,y:M,zoom:W}=Zu(D,h,S,l,_,(a==null?void 0:a.padding)??.1);R=[k,M,W]}return{rfId:"1",width:h??0,height:S??0,transform:R,nodes:d,nodesInitialized:L,nodeLookup:C,parentLookup:b,edges:p,edgeLookup:f,connectionLookup:x,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:i!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:l,maxZoom:_,translateExtent:Ss,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:hi.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:u,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:y??!1,fitViewOptions:a,fitViewResolver:null,connection:{...Y_},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:OS,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:X_,zIndexMode:m,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},b2=({nodes:e,edges:r,defaultNodes:i,defaultEdges:o,width:h,height:S,fitView:y,fitViewOptions:a,minZoom:l,maxZoom:_,nodeOrigin:v,nodeExtent:c,zIndexMode:m})=>zC((C,b)=>{async function x(){const{nodeLookup:f,panZoom:p,fitViewOptions:d,fitViewResolver:u,width:w,height:L,minZoom:R,maxZoom:D}=b();p&&(await BS({nodes:f,width:w,height:L,panZoom:p,minZoom:R,maxZoom:D},d),u==null||u.resolve(!0),C({fitViewResolver:null}))}return{...Qp({nodes:e,edges:r,width:h,height:S,fitView:y,fitViewOptions:a,minZoom:l,maxZoom:_,nodeOrigin:v,nodeExtent:c,defaultNodes:i,defaultEdges:o,zIndexMode:m}),setNodes:f=>{const{nodeLookup:p,parentLookup:d,nodeOrigin:u,elevateNodesOnSelect:w,fitViewQueued:L,zIndexMode:R,nodesSelectionActive:D}=b(),{nodesInitialized:k,hasSelectedNodes:M}=Du(f,p,d,{nodeOrigin:u,nodeExtent:c,elevateNodesOnSelect:w,checkEquality:!0,zIndexMode:R}),W=D&&M;L&&k?(x(),C({nodes:f,nodesInitialized:k,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:W})):C({nodes:f,nodesInitialized:k,nodesSelectionActive:W})},setEdges:f=>{const{connectionLookup:p,edgeLookup:d}=b();fg(p,d,f),C({edges:f})},setDefaultNodesAndEdges:(f,p)=>{if(f){const{setNodes:d}=b();d(f),C({hasDefaultNodes:!0})}if(p){const{setEdges:d}=b();d(p),C({hasDefaultEdges:!0})}},updateNodeInternals:f=>{const{triggerNodeChanges:p,nodeLookup:d,parentLookup:u,domNode:w,nodeOrigin:L,nodeExtent:R,debug:D,fitViewQueued:k,zIndexMode:M}=b(),{changes:W,updatedInternals:z}=sC(f,d,u,w,L,R,M);z&&(tC(d,u,{nodeOrigin:L,nodeExtent:R,zIndexMode:M}),k?(x(),C({fitViewQueued:!1,fitViewOptions:void 0})):C({}),(W==null?void 0:W.length)>0&&(D&&console.log("React Flow: trigger node changes",W),p==null||p(W)))},updateNodePositions:(f,p=!1)=>{const d=[];let u=[];const{nodeLookup:w,triggerNodeChanges:L,connection:R,updateConnection:D,onNodesChangeMiddlewareMap:k}=b();for(const[M,W]of f){const z=w.get(M),j=!!(z!=null&&z.expandParent&&(z!=null&&z.parentId)&&(W!=null&&W.position)),N={id:M,type:"position",position:j?{x:Math.max(0,W.position.x),y:Math.max(0,W.position.y)}:W.position,dragging:p};if(z&&R.inProgress&&R.fromNode.id===z.id){const I=Ln(z,R.fromHandle,xe.Left,!0);D({...R,from:I})}j&&z.parentId&&d.push({id:M,parentId:z.parentId,rect:{...W.internals.positionAbsolute,width:W.measured.width??0,height:W.measured.height??0}}),u.push(N)}if(d.length>0){const{parentLookup:M,nodeOrigin:W}=b(),z=sh(d,w,M,W);u.push(...z)}for(const M of k.values())u=M(u);L(u)},triggerNodeChanges:f=>{const{onNodesChange:p,setNodes:d,nodes:u,hasDefaultNodes:w,debug:L}=b();if(f!=null&&f.length){if(w){const R=lx(f,u);d(R)}L&&console.log("React Flow: trigger node changes",f),p==null||p(f)}},triggerEdgeChanges:f=>{const{onEdgesChange:p,setEdges:d,edges:u,hasDefaultEdges:w,debug:L}=b();if(f!=null&&f.length){if(w){const R=cx(f,u);d(R)}L&&console.log("React Flow: trigger edge changes",f),p==null||p(f)}},addSelectedNodes:f=>{const{multiSelectionActive:p,edgeLookup:d,nodeLookup:u,triggerNodeChanges:w,triggerEdgeChanges:L}=b();if(p){const R=f.map(D=>wn(D,!0));w(R);return}w(oi(u,new Set([...f]),!0)),L(oi(d))},addSelectedEdges:f=>{const{multiSelectionActive:p,edgeLookup:d,nodeLookup:u,triggerNodeChanges:w,triggerEdgeChanges:L}=b();if(p){const R=f.map(D=>wn(D,!0));L(R);return}L(oi(d,new Set([...f]))),w(oi(u,new Set,!0))},unselectNodesAndEdges:({nodes:f,edges:p}={})=>{const{edges:d,nodes:u,nodeLookup:w,triggerNodeChanges:L,triggerEdgeChanges:R}=b(),D=f||u,k=p||d,M=[];for(const z of D){if(!z.selected)continue;const j=w.get(z.id);j&&(j.selected=!1),M.push(wn(z.id,!1))}const W=[];for(const z of k)z.selected&&W.push(wn(z.id,!1));L(M),R(W)},setMinZoom:f=>{const{panZoom:p,maxZoom:d}=b();p==null||p.setScaleExtent([f,d]),C({minZoom:f})},setMaxZoom:f=>{const{panZoom:p,minZoom:d}=b();p==null||p.setScaleExtent([d,f]),C({maxZoom:f})},setTranslateExtent:f=>{var p;(p=b().panZoom)==null||p.setTranslateExtent(f),C({translateExtent:f})},resetSelectedElements:()=>{const{edges:f,nodes:p,triggerNodeChanges:d,triggerEdgeChanges:u,elementsSelectable:w}=b();if(!w)return;const L=p.reduce((D,k)=>k.selected?[...D,wn(k.id,!1)]:D,[]),R=f.reduce((D,k)=>k.selected?[...D,wn(k.id,!1)]:D,[]);d(L),u(R)},setNodeExtent:f=>{const{nodes:p,nodeLookup:d,parentLookup:u,nodeOrigin:w,elevateNodesOnSelect:L,nodeExtent:R,zIndexMode:D}=b();f[0][0]===R[0][0]&&f[0][1]===R[0][1]&&f[1][0]===R[1][0]&&f[1][1]===R[1][1]||(Du(p,d,u,{nodeOrigin:w,nodeExtent:f,elevateNodesOnSelect:L,checkEquality:!1,zIndexMode:D}),C({nodeExtent:f}))},panBy:f=>{const{transform:p,width:d,height:u,panZoom:w,translateExtent:L}=b();return oC({delta:f,panZoom:w,transform:p,translateExtent:L,width:d,height:u})},setCenter:async(f,p,d)=>{const{width:u,height:w,maxZoom:L,panZoom:R}=b();if(!R)return Promise.resolve(!1);const D=typeof(d==null?void 0:d.zoom)<"u"?d.zoom:L;return await R.setViewport({x:u/2-f*D,y:w/2-p*D,zoom:D},{duration:d==null?void 0:d.duration,ease:d==null?void 0:d.ease,interpolate:d==null?void 0:d.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{C({connection:{...Y_}})},updateConnection:f=>{C({connection:f})},reset:()=>C({...Qp()})}},Object.is);function E2({initialNodes:e,initialEdges:r,defaultNodes:i,defaultEdges:o,initialWidth:h,initialHeight:S,initialMinZoom:y,initialMaxZoom:a,initialFitViewOptions:l,fitView:_,nodeOrigin:v,nodeExtent:c,zIndexMode:m,children:C}){const[b]=J.useState(()=>b2({nodes:e,edges:r,defaultNodes:i,defaultEdges:o,width:h,height:S,fitView:_,minZoom:y,maxZoom:a,fitViewOptions:l,nodeOrigin:v,nodeExtent:c,zIndexMode:m}));return O.jsx($C,{value:b,children:O.jsx(dx,{children:C})})}function k2({children:e,nodes:r,edges:i,defaultNodes:o,defaultEdges:h,width:S,height:y,fitView:a,fitViewOptions:l,minZoom:_,maxZoom:v,nodeOrigin:c,nodeExtent:m,zIndexMode:C}){return J.useContext(Wa)?O.jsx(O.Fragment,{children:e}):O.jsx(E2,{initialNodes:r,initialEdges:i,defaultNodes:o,defaultEdges:h,initialWidth:S,initialHeight:y,fitView:a,initialFitViewOptions:l,initialMinZoom:_,initialMaxZoom:v,nodeOrigin:c,nodeExtent:m,zIndexMode:C,children:e})}const L2={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function R2({nodes:e,edges:r,defaultNodes:i,defaultEdges:o,className:h,nodeTypes:S,edgeTypes:y,onNodeClick:a,onEdgeClick:l,onInit:_,onMove:v,onMoveStart:c,onMoveEnd:m,onConnect:C,onConnectStart:b,onConnectEnd:x,onClickConnectStart:f,onClickConnectEnd:p,onNodeMouseEnter:d,onNodeMouseMove:u,onNodeMouseLeave:w,onNodeContextMenu:L,onNodeDoubleClick:R,onNodeDragStart:D,onNodeDrag:k,onNodeDragStop:M,onNodesDelete:W,onEdgesDelete:z,onDelete:j,onSelectionChange:N,onSelectionDragStart:I,onSelectionDrag:q,onSelectionDragStop:U,onSelectionContextMenu:K,onSelectionStart:V,onSelectionEnd:T,onBeforeDelete:B,connectionMode:P,connectionLineType:F=Zr.Bezier,connectionLineStyle:G,connectionLineComponent:Z,connectionLineContainerStyle:ie,deleteKeyCode:ae="Backspace",selectionKeyCode:X="Shift",selectionOnDrag:H=!1,selectionMode:re=Cs.Full,panActivationKeyCode:te="Space",multiSelectionKeyCode:ce=bs()?"Meta":"Control",zoomActivationKeyCode:le=bs()?"Meta":"Control",snapToGrid:pe,snapGrid:Se,onlyRenderVisibleElements:be=!1,selectNodesOnDrag:ue,nodesDraggable:ge,autoPanOnNodeFocus:Re,nodesConnectable:Ie,nodesFocusable:ze,nodeOrigin:Qe=kg,edgesFocusable:ut,edgesReconnectable:qe,elementsSelectable:pt=!0,defaultViewport:Ne=tx,minZoom:Je=.5,maxZoom:ht=2,translateExtent:$e=Ss,preventScrolling:pr=!0,nodeExtent:ot,defaultMarkerColor:Rt="#b1b1b7",zoomOnScroll:Oe=!0,zoomOnPinch:Rn=!0,panOnScroll:Ps=!1,panOnScrollSpeed:Ka=.5,panOnScrollMode:vi=xn.Free,zoomOnDoubleClick:yi=!0,panOnDrag:wi=!0,onPaneClick:Si,onPaneMouseEnter:Ci,onPaneMouseMove:Dr,onPaneMouseLeave:Ar,onPaneScroll:Ns,onPaneContextMenu:Bs,paneClickDistance:Is=1,nodeClickDistance:Os=0,children:Hs,onReconnect:xi,onReconnectStart:Fs,onReconnectEnd:rn,onEdgeContextMenu:bi,onEdgeDoubleClick:nn,onEdgeMouseEnter:Xa,onEdgeMouseMove:sn,onEdgeMouseLeave:Dn,reconnectRadius:An=10,onNodesChange:Ei,onEdgesChange:Ya,noDragClassName:Ga="nodrag",noWheelClassName:Qa="nowheel",noPanClassName:rr="nopan",fitView:ki,fitViewOptions:Li,connectOnClick:Ja,attributionPosition:js,proOptions:zs,defaultEdgeOptions:$s,elevateNodesOnSelect:Ws=!0,elevateEdgesOnSelect:Za=!1,disableKeyboardA11y:Us=!1,autoPanOnConnect:Ke,autoPanOnNodeDrag:el,autoPanSpeed:Ri,connectionRadius:Vs,isValidConnection:Tn,onError:tl,style:qs,id:on,nodeDragThreshold:It,connectionDragThreshold:rl,viewport:Dt,onViewportChange:nl,width:il,height:sl,colorMode:Mn="light",debug:Pn,onScroll:nr,ariaLabelConfig:Nn,zIndexMode:Ks="basic",...ol},Di){const Bn=on||"1",Ai=sx(Mn),an=J.useCallback(Xs=>{Xs.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),nr==null||nr(Xs)},[nr]);return O.jsx("div",{"data-testid":"rf__wrapper",...ol,onScroll:an,style:{...qs,...L2},ref:Di,className:rt(["react-flow",h,Ai]),id:on,role:"application",children:O.jsxs(k2,{nodes:e,edges:r,width:il,height:sl,fitView:ki,fitViewOptions:Li,minZoom:Je,maxZoom:ht,nodeOrigin:Qe,nodeExtent:ot,zIndexMode:Ks,children:[O.jsx(ix,{nodes:e,edges:r,defaultNodes:i,defaultEdges:o,onConnect:C,onConnectStart:b,onConnectEnd:x,onClickConnectStart:f,onClickConnectEnd:p,nodesDraggable:ge,autoPanOnNodeFocus:Re,nodesConnectable:Ie,nodesFocusable:ze,edgesFocusable:ut,edgesReconnectable:qe,elementsSelectable:pt,elevateNodesOnSelect:Ws,elevateEdgesOnSelect:Za,minZoom:Je,maxZoom:ht,nodeExtent:ot,onNodesChange:Ei,onEdgesChange:Ya,snapToGrid:pe,snapGrid:Se,connectionMode:P,translateExtent:$e,connectOnClick:Ja,defaultEdgeOptions:$s,fitView:ki,fitViewOptions:Li,onNodesDelete:W,onEdgesDelete:z,onDelete:j,onNodeDragStart:D,onNodeDrag:k,onNodeDragStop:M,onSelectionDrag:q,onSelectionDragStart:I,onSelectionDragStop:U,onMove:v,onMoveStart:c,onMoveEnd:m,noPanClassName:rr,nodeOrigin:Qe,rfId:Bn,autoPanOnConnect:Ke,autoPanOnNodeDrag:el,autoPanSpeed:Ri,onError:tl,connectionRadius:Vs,isValidConnection:Tn,selectNodesOnDrag:ue,nodeDragThreshold:It,connectionDragThreshold:rl,onBeforeDelete:B,debug:Pn,ariaLabelConfig:Nn,zIndexMode:Ks}),O.jsx(x2,{onInit:_,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:d,onNodeMouseMove:u,onNodeMouseLeave:w,onNodeContextMenu:L,onNodeDoubleClick:R,nodeTypes:S,edgeTypes:y,connectionLineType:F,connectionLineStyle:G,connectionLineComponent:Z,connectionLineContainerStyle:ie,selectionKeyCode:X,selectionOnDrag:H,selectionMode:re,deleteKeyCode:ae,multiSelectionKeyCode:ce,panActivationKeyCode:te,zoomActivationKeyCode:le,onlyRenderVisibleElements:be,defaultViewport:Ne,translateExtent:$e,minZoom:Je,maxZoom:ht,preventScrolling:pr,zoomOnScroll:Oe,zoomOnPinch:Rn,zoomOnDoubleClick:yi,panOnScroll:Ps,panOnScrollSpeed:Ka,panOnScrollMode:vi,panOnDrag:wi,onPaneClick:Si,onPaneMouseEnter:Ci,onPaneMouseMove:Dr,onPaneMouseLeave:Ar,onPaneScroll:Ns,onPaneContextMenu:Bs,paneClickDistance:Is,nodeClickDistance:Os,onSelectionContextMenu:K,onSelectionStart:V,onSelectionEnd:T,onReconnect:xi,onReconnectStart:Fs,onReconnectEnd:rn,onEdgeContextMenu:bi,onEdgeDoubleClick:nn,onEdgeMouseEnter:Xa,onEdgeMouseMove:sn,onEdgeMouseLeave:Dn,reconnectRadius:An,defaultMarkerColor:Rt,noDragClassName:Ga,noWheelClassName:Qa,noPanClassName:rr,rfId:Bn,disableKeyboardA11y:Us,nodeExtent:ot,viewport:Dt,onViewportChange:nl}),O.jsx(ex,{onSelectionChange:N}),Hs,O.jsx(YC,{proOptions:zs,position:js}),O.jsx(XC,{rfId:Bn,disableKeyboardA11y:Us})]})})}var D2=Rg(R2);function A2({dimensions:e,lineWidth:r,variant:i,className:o}){return O.jsx("path",{strokeWidth:r,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:rt(["react-flow__background-pattern",i,o])})}function T2({radius:e,className:r}){return O.jsx("circle",{cx:e,cy:e,r:e,className:rt(["react-flow__background-pattern","dots",r])})}var tn;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(tn||(tn={}));const M2={[tn.Dots]:1,[tn.Lines]:1,[tn.Cross]:6},P2=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Jg({id:e,variant:r=tn.Dots,gap:i=20,size:o,lineWidth:h=1,offset:S=0,color:y,bgColor:a,style:l,className:_,patternClassName:v}){const c=J.useRef(null),{transform:m,patternId:C}=Te(P2,Ue),b=o||M2[r],x=r===tn.Dots,f=r===tn.Cross,p=Array.isArray(i)?i:[i,i],d=[p[0]*m[2]||1,p[1]*m[2]||1],u=b*m[2],w=Array.isArray(S)?S:[S,S],L=f?[u,u]:d,R=[w[0]*m[2]||1+L[0]/2,w[1]*m[2]||1+L[1]/2],D=`${C}${e||""}`;return O.jsxs("svg",{className:rt(["react-flow__background",_]),style:{...l,...Va,"--xy-background-color-props":a,"--xy-background-pattern-color-props":y},ref:c,"data-testid":"rf__background",children:[O.jsx("pattern",{id:D,x:m[0]%d[0],y:m[1]%d[1],width:d[0],height:d[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${R[0]},-${R[1]})`,children:x?O.jsx(T2,{radius:u/2,className:v}):O.jsx(A2,{dimensions:L,lineWidth:h,variant:r,className:v})}),O.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${D})`})]})}Jg.displayName="Background";const N2=J.memo(Jg);function B2(){return O.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:O.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function I2(){return O.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:O.jsx("path",{d:"M0 0h32v4.2H0z"})})}function O2(){return O.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:O.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 H2(){return O.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:O.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 F2(){return O.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:O.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 aa({children:e,className:r,...i}){return O.jsx("button",{type:"button",className:rt(["react-flow__controls-button",r]),...i,children:e})}const j2=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Zg({style:e,showZoom:r=!0,showFitView:i=!0,showInteractive:o=!0,fitViewOptions:h,onZoomIn:S,onZoomOut:y,onFitView:a,onInteractiveChange:l,className:_,children:v,position:c="bottom-left",orientation:m="vertical","aria-label":C}){const b=Ve(),{isInteractive:x,minZoomReached:f,maxZoomReached:p,ariaLabelConfig:d}=Te(j2,Ue),{zoomIn:u,zoomOut:w,fitView:L}=oh(),R=()=>{u(),S==null||S()},D=()=>{w(),y==null||y()},k=()=>{L(h),a==null||a()},M=()=>{b.setState({nodesDraggable:!x,nodesConnectable:!x,elementsSelectable:!x}),l==null||l(!x)},W=m==="horizontal"?"horizontal":"vertical";return O.jsxs(Ua,{className:rt(["react-flow__controls",W,_]),position:c,style:e,"data-testid":"rf__controls","aria-label":C??d["controls.ariaLabel"],children:[r&&O.jsxs(O.Fragment,{children:[O.jsx(aa,{onClick:R,className:"react-flow__controls-zoomin",title:d["controls.zoomIn.ariaLabel"],"aria-label":d["controls.zoomIn.ariaLabel"],disabled:p,children:O.jsx(B2,{})}),O.jsx(aa,{onClick:D,className:"react-flow__controls-zoomout",title:d["controls.zoomOut.ariaLabel"],"aria-label":d["controls.zoomOut.ariaLabel"],disabled:f,children:O.jsx(I2,{})})]}),i&&O.jsx(aa,{className:"react-flow__controls-fitview",onClick:k,title:d["controls.fitView.ariaLabel"],"aria-label":d["controls.fitView.ariaLabel"],children:O.jsx(O2,{})}),o&&O.jsx(aa,{className:"react-flow__controls-interactive",onClick:M,title:d["controls.interactive.ariaLabel"],"aria-label":d["controls.interactive.ariaLabel"],children:x?O.jsx(F2,{}):O.jsx(H2,{})}),v]})}Zg.displayName="Controls";const z2=J.memo(Zg);function $2({id:e,x:r,y:i,width:o,height:h,style:S,color:y,strokeColor:a,strokeWidth:l,className:_,borderRadius:v,shapeRendering:c,selected:m,onClick:C}){const{background:b,backgroundColor:x}=S||{},f=y||b||x;return O.jsx("rect",{className:rt(["react-flow__minimap-node",{selected:m},_]),x:r,y:i,rx:v,ry:v,width:o,height:h,style:{fill:f,stroke:a,strokeWidth:l},shapeRendering:c,onClick:C?p=>C(p,e):void 0})}const W2=J.memo($2),U2=e=>e.nodes.map(r=>r.id),iu=e=>e instanceof Function?e:()=>e;function V2({nodeStrokeColor:e,nodeColor:r,nodeClassName:i="",nodeBorderRadius:o=5,nodeStrokeWidth:h,nodeComponent:S=W2,onClick:y}){const a=Te(U2,Ue),l=iu(r),_=iu(e),v=iu(i),c=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return O.jsx(O.Fragment,{children:a.map(m=>O.jsx(K2,{id:m,nodeColorFunc:l,nodeStrokeColorFunc:_,nodeClassNameFunc:v,nodeBorderRadius:o,nodeStrokeWidth:h,NodeComponent:S,onClick:y,shapeRendering:c},m))})}function q2({id:e,nodeColorFunc:r,nodeStrokeColorFunc:i,nodeClassNameFunc:o,nodeBorderRadius:h,nodeStrokeWidth:S,shapeRendering:y,NodeComponent:a,onClick:l}){const{node:_,x:v,y:c,width:m,height:C}=Te(b=>{const x=b.nodeLookup.get(e);if(!x)return{node:void 0,x:0,y:0,width:0,height:0};const f=x.internals.userNode,{x:p,y:d}=x.internals.positionAbsolute,{width:u,height:w}=Rr(f);return{node:f,x:p,y:d,width:u,height:w}},Ue);return!_||_.hidden||!rg(_)?null:O.jsx(a,{x:v,y:c,width:m,height:C,style:_.style,selected:!!_.selected,className:o(_),color:r(_),borderRadius:h,strokeColor:i(_),strokeWidth:S,shapeRendering:y,onClick:l,id:_.id})}const K2=J.memo(q2);var X2=J.memo(V2);const Y2=200,G2=150,Q2=e=>!e.hidden,J2=e=>{const r={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:r,boundingRect:e.nodeLookup.size>0?tg(As(e.nodeLookup,{filter:Q2}),r):r,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Z2="react-flow__minimap-desc";function em({style:e,className:r,nodeStrokeColor:i,nodeColor:o,nodeClassName:h="",nodeBorderRadius:S=5,nodeStrokeWidth:y,nodeComponent:a,bgColor:l,maskColor:_,maskStrokeColor:v,maskStrokeWidth:c,position:m="bottom-right",onClick:C,onNodeClick:b,pannable:x=!1,zoomable:f=!1,ariaLabel:p,inversePan:d,zoomStep:u=1,offsetScale:w=5}){const L=Ve(),R=J.useRef(null),{boundingRect:D,viewBB:k,rfId:M,panZoom:W,translateExtent:z,flowWidth:j,flowHeight:N,ariaLabelConfig:I}=Te(J2,Ue),q=(e==null?void 0:e.width)??Y2,U=(e==null?void 0:e.height)??G2,K=D.width/q,V=D.height/U,T=Math.max(K,V),B=T*q,P=T*U,F=w*T,G=D.x-(B-D.width)/2-F,Z=D.y-(P-D.height)/2-F,ie=B+F*2,ae=P+F*2,X=`${Z2}-${M}`,H=J.useRef(0),re=J.useRef();H.current=T,J.useEffect(()=>{if(R.current&&W)return re.current=_C({domNode:R.current,panZoom:W,getTransform:()=>L.getState().transform,getViewScale:()=>H.current}),()=>{var pe;(pe=re.current)==null||pe.destroy()}},[W]),J.useEffect(()=>{var pe;(pe=re.current)==null||pe.update({translateExtent:z,width:j,height:N,inversePan:d,pannable:x,zoomStep:u,zoomable:f})},[x,f,d,u,z,j,N]);const te=C?pe=>{var ue;const[Se,be]=((ue=re.current)==null?void 0:ue.pointer(pe))||[0,0];C(pe,{x:Se,y:be})}:void 0,ce=b?J.useCallback((pe,Se)=>{const be=L.getState().nodeLookup.get(Se).internals.userNode;b(pe,be)},[]):void 0,le=p??I["minimap.ariaLabel"];return O.jsx(Ua,{position:m,style:{...e,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof _=="string"?_:void 0,"--xy-minimap-mask-stroke-color-props":typeof v=="string"?v:void 0,"--xy-minimap-mask-stroke-width-props":typeof c=="number"?c*T:void 0,"--xy-minimap-node-background-color-props":typeof o=="string"?o:void 0,"--xy-minimap-node-stroke-color-props":typeof i=="string"?i:void 0,"--xy-minimap-node-stroke-width-props":typeof y=="number"?y:void 0},className:rt(["react-flow__minimap",r]),"data-testid":"rf__minimap",children:O.jsxs("svg",{width:q,height:U,viewBox:`${G} ${Z} ${ie} ${ae}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":X,ref:R,onClick:te,children:[le&&O.jsx("title",{id:X,children:le}),O.jsx(X2,{onClick:ce,nodeColor:o,nodeStrokeColor:i,nodeBorderRadius:S,nodeClassName:h,nodeStrokeWidth:y,nodeComponent:a}),O.jsx("path",{className:"react-flow__minimap-mask",d:`M${G-F},${Z-F}h${ie+F*2}v${ae+F*2}h${-ie-F*2}z
62
- M${k.x},${k.y}h${k.width}v${k.height}h${-k.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}em.displayName="MiniMap";J.memo(em);const eb=e=>r=>e?`${Math.max(1/r.transform[2],1)}`:void 0,tb={[_i.Line]:"right",[_i.Handle]:"bottom-right"};function rb({nodeId:e,position:r,variant:i=_i.Handle,className:o,style:h=void 0,children:S,color:y,minWidth:a=10,minHeight:l=10,maxWidth:_=Number.MAX_VALUE,maxHeight:v=Number.MAX_VALUE,keepAspectRatio:c=!1,resizeDirection:m,autoScale:C=!0,shouldResize:b,onResizeStart:x,onResize:f,onResizeEnd:p}){const d=Mg(),u=typeof e=="string"?e:d,w=Ve(),L=J.useRef(null),R=i===_i.Handle,D=Te(J.useCallback(eb(R&&C),[R,C]),Ue),k=J.useRef(null),M=r??tb[i];J.useEffect(()=>{if(!(!L.current||!u))return k.current||(k.current=DC({domNode:L.current,nodeId:u,getStoreItems:()=>{const{nodeLookup:z,transform:j,snapGrid:N,snapToGrid:I,nodeOrigin:q,domNode:U}=w.getState();return{nodeLookup:z,transform:j,snapGrid:N,snapToGrid:I,nodeOrigin:q,paneDomNode:U}},onChange:(z,j)=>{const{triggerNodeChanges:N,nodeLookup:I,parentLookup:q,nodeOrigin:U}=w.getState(),K=[],V={x:z.x,y:z.y},T=I.get(u);if(T&&T.expandParent&&T.parentId){const B=T.origin??U,P=z.width??T.measured.width??0,F=z.height??T.measured.height??0,G={id:T.id,parentId:T.parentId,rect:{width:P,height:F,...ng({x:z.x??T.position.x,y:z.y??T.position.y},{width:P,height:F},T.parentId,I,B)}},Z=sh([G],I,q,U);K.push(...Z),V.x=z.x?Math.max(B[0]*P,z.x):void 0,V.y=z.y?Math.max(B[1]*F,z.y):void 0}if(V.x!==void 0&&V.y!==void 0){const B={id:u,type:"position",position:{...V}};K.push(B)}if(z.width!==void 0&&z.height!==void 0){const P={id:u,type:"dimensions",resizing:!0,setAttributes:m?m==="horizontal"?"width":"height":!0,dimensions:{width:z.width,height:z.height}};K.push(P)}for(const B of j){const P={...B,type:"position"};K.push(P)}N(K)},onEnd:({width:z,height:j})=>{const N={id:u,type:"dimensions",resizing:!1,dimensions:{width:z,height:j}};w.getState().triggerNodeChanges([N])}})),k.current.update({controlPosition:M,boundaries:{minWidth:a,minHeight:l,maxWidth:_,maxHeight:v},keepAspectRatio:c,resizeDirection:m,onResizeStart:x,onResize:f,onResizeEnd:p,shouldResize:b}),()=>{var z;(z=k.current)==null||z.destroy()}},[M,a,l,_,v,c,x,f,p,b]);const W=M.split("-");return O.jsx("div",{className:rt(["react-flow__resize-control","nodrag",...W,i,o]),ref:L,style:{...h,scale:D,...y&&{[R?"backgroundColor":"borderColor"]:y}},children:S})}J.memo(rb);const nb={running:"#4ade80",starting:"#fbbf24",idle:"#fbbf24",done:"#555",dead:"#f87171"};function ib({data:e}){const r=e,i=nb[r.status]||"#555",o=r.status==="running"||r.status==="starting";return O.jsxs("div",{style:{background:"#0a0a0a",border:`1px solid ${o?"#333":"#1e1e1e"}`,borderRadius:8,padding:"12px 16px",minWidth:160,position:"relative",transition:"border-color 180ms ease"},children:[O.jsx(gi,{type:"target",position:xe.Left,style:{background:"#333",border:"none",width:6,height:6}}),O.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:5},children:[O.jsx("div",{style:{width:6,height:6,borderRadius:"50%",background:i,boxShadow:o?`0 0 6px ${i}40`:"none"}}),O.jsx("span",{style:{fontSize:13,fontWeight:500,color:"#e8e8e8",fontFamily:"'DM Sans', sans-serif"},children:r.label}),r.service&&r.service!=="claude"&&O.jsx("span",{style:{fontSize:9,fontWeight:600,color:r.service==="codex"?"#10b981":"#888",background:r.service==="codex"?"#10b98118":"#88888818",padding:"1px 5px",borderRadius:4,fontFamily:"'JetBrains Mono', monospace",textTransform:"uppercase",letterSpacing:"0.5px"},children:r.service})]}),O.jsx("div",{style:{fontSize:11,color:"#555",maxWidth:180,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"'DM Sans', sans-serif",lineHeight:1.4},children:r.task}),r.messageCount&&r.messageCount>0&&O.jsxs("div",{title:`${r.messageCount} message${r.messageCount>1?"s":""} received`,style:{position:"absolute",top:-6,right:-6,background:"#4ade80",color:"#000",borderRadius:8,padding:"2px 5px",display:"flex",alignItems:"center",justifyContent:"center",gap:2,fontSize:9,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:"default"},children:[O.jsx("span",{style:{fontSize:8},children:"✉"}),r.messageCount]}),O.jsx(gi,{type:"source",position:xe.Right,style:{background:"#333",border:"none",width:6,height:6}})]})}const sb={agent:ib};function ob({agents:e,messages:r,onSelectAgent:i}){const[o,h]=J.useState([]),S=J.useMemo(()=>{const _={};for(const v of r)v.to_agent&&v.to_agent!=="all"&&(_[v.to_agent]=(_[v.to_agent]||0)+1);return _},[r]),y=J.useMemo(()=>{const _=new Map,v=new Set(e.map(c=>c.id));for(const c of r){if(!v.has(c.from_agent)||!v.has(c.to_agent)||c.to_agent==="all")continue;const m=[c.from_agent,c.to_agent].sort().join("|");_.set(m,(_.get(m)||0)+1)}return Array.from(_.entries()).map(([c,m])=>{const[C,b]=c.split("|");return{id:`collab-${c}`,source:C,target:b,style:{stroke:"#333",strokeWidth:Math.min(1+m*.3,3)},label:`${m}`,labelStyle:{fill:"#666",fontSize:9},labelBgStyle:{fill:"#0a0a0a",fillOpacity:.9},labelBgPadding:[4,2]}})},[e,r]),a=J.useMemo(()=>{const _=Math.max(Math.ceil(Math.sqrt(e.length)),1);return e.map((v,c)=>({id:v.id,type:"agent",position:{x:80+c%_*240,y:80+Math.floor(c/_)*130},data:{label:v.name,status:v.status,task:v.task||"",service:v.service||"claude",messageCount:S[v.id]||0}}))},[e,S]);J.useEffect(()=>{if(r.length===0)return;const _=r[0];if(!_)return;const v=new Set(e.map(b=>b.id));if(!v.has(_.from_agent)||!v.has(_.to_agent))return;const c=`msg-${_.id}`,m={id:c,source:_.from_agent,target:_.to_agent,animated:!0,style:{stroke:"#4ade80",strokeWidth:1.5}};h(b=>[...b,m]);const C=setTimeout(()=>{h(b=>b.filter(x=>x.id!==c))},3e3);return()=>clearTimeout(C)},[r,e]);const l=J.useCallback((_,v)=>{const c=e.find(m=>m.id===v.id);c&&i(c)},[e,i]);return O.jsx("div",{style:{width:"100%",height:"100%"},children:O.jsxs(D2,{nodes:a,edges:[...y,...o],nodeTypes:sb,onNodeClick:l,fitView:!0,proOptions:{hideAttribution:!0},children:[O.jsx(N2,{color:"#1a1a1a",gap:24,size:1}),O.jsx(z2,{style:{background:"#0a0a0a",border:"1px solid #1e1e1e",borderRadius:6}})]})})}var su={exports:{}},Jp;function ab(){return Jp||(Jp=1,(function(e,r){(function(i,o){e.exports=o()})(globalThis,(()=>(()=>{var i={4567:function(y,a,l){var _=this&&this.__decorate||function(d,u,w,L){var R,D=arguments.length,k=D<3?u:L===null?L=Object.getOwnPropertyDescriptor(u,w):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(d,u,w,L);else for(var M=d.length-1;M>=0;M--)(R=d[M])&&(k=(D<3?R(k):D>3?R(u,w,k):R(u,w))||k);return D>3&&k&&Object.defineProperty(u,w,k),k},v=this&&this.__param||function(d,u){return function(w,L){u(w,L,d)}};Object.defineProperty(a,"__esModule",{value:!0}),a.AccessibilityManager=void 0;const c=l(9042),m=l(9924),C=l(844),b=l(4725),x=l(2585),f=l(3656);let p=a.AccessibilityManager=class extends C.Disposable{constructor(d,u,w,L){super(),this._terminal=d,this._coreBrowserService=w,this._renderService=L,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let R=0;R<this._terminal.rows;R++)this._rowElements[R]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[R]);if(this._topBoundaryFocusListener=R=>this._handleBoundaryFocus(R,0),this._bottomBoundaryFocusListener=R=>this._handleBoundaryFocus(R,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new m.TimeBasedDebouncer(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((R=>this._handleResize(R.rows)))),this.register(this._terminal.onRender((R=>this._refreshRows(R.start,R.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((R=>this._handleChar(R)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
61
+ `)),v=_.reduce((c,m)=>c.concat(...m),[]);return[_,v]}return[[],[]]},[e]);return J.useEffect(()=>{const l=(r==null?void 0:r.target)??Np,_=(r==null?void 0:r.actInsideInputWithModifier)??!0;if(e!==null){const v=C=>{var f,p;if(h.current=C.ctrlKey||C.metaKey||C.shiftKey||C.altKey,(!h.current||h.current&&!_)&&sg(C))return!1;const x=Ip(C.code,a);if(S.current.add(C[x]),Bp(y,S.current,!1)){const d=((p=(f=C.composedPath)==null?void 0:f.call(C))==null?void 0:p[0])||C.target,u=(d==null?void 0:d.nodeName)==="BUTTON"||(d==null?void 0:d.nodeName)==="A";r.preventDefault!==!1&&(h.current||!u)&&C.preventDefault(),o(!0)}},c=C=>{const b=Ip(C.code,a);Bp(y,S.current,!0)?(o(!1),S.current.clear()):S.current.delete(C[b]),C.key==="Meta"&&S.current.clear(),h.current=!1},m=()=>{S.current.clear(),o(!1)};return l==null||l.addEventListener("keydown",v),l==null||l.addEventListener("keyup",c),window.addEventListener("blur",m),window.addEventListener("contextmenu",m),()=>{l==null||l.removeEventListener("keydown",v),l==null||l.removeEventListener("keyup",c),window.removeEventListener("blur",m),window.removeEventListener("contextmenu",m)}}},[e,o]),i}function Bp(e,r,i){return e.filter(o=>i||o.length===r.size).some(o=>o.every(h=>r.has(h)))}function Ip(e,r){return r.includes(e)?"code":"key"}const ox=()=>{const e=Ve();return J.useMemo(()=>({zoomIn:r=>{const{panZoom:i}=e.getState();return i?i.scaleBy(1.2,r):Promise.resolve(!1)},zoomOut:r=>{const{panZoom:i}=e.getState();return i?i.scaleBy(1/1.2,r):Promise.resolve(!1)},zoomTo:(r,i)=>{const{panZoom:o}=e.getState();return o?o.scaleTo(r,i):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(r,i)=>{const{transform:[o,h,S],panZoom:y}=e.getState();return y?(await y.setViewport({x:r.x??o,y:r.y??h,zoom:r.zoom??S},i),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[r,i,o]=e.getState().transform;return{x:r,y:i,zoom:o}},setCenter:async(r,i,o)=>e.getState().setCenter(r,i,o),fitBounds:async(r,i)=>{const{width:o,height:h,minZoom:S,maxZoom:y,panZoom:a}=e.getState(),l=Zu(r,o,h,S,y,(i==null?void 0:i.padding)??.1);return a?(await a.setViewport(l,{duration:i==null?void 0:i.duration,ease:i==null?void 0:i.ease,interpolate:i==null?void 0:i.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(r,i={})=>{const{transform:o,snapGrid:h,snapToGrid:S,domNode:y}=e.getState();if(!y)return r;const{x:a,y:l}=y.getBoundingClientRect(),_={x:r.x-a,y:r.y-l},v=i.snapGrid??h,c=i.snapToGrid??S;return Ms(_,o,c,v)},flowToScreenPosition:r=>{const{transform:i,domNode:o}=e.getState();if(!o)return r;const{x:h,y:S}=o.getBoundingClientRect(),y=Da(r,i);return{x:y.x+h,y:y.y+S}}}),[])};function Lg(e,r){const i=[],o=new Map,h=[];for(const S of e)if(S.type==="add"){h.push(S);continue}else if(S.type==="remove"||S.type==="replace")o.set(S.id,[S]);else{const y=o.get(S.id);y?y.push(S):o.set(S.id,[S])}for(const S of r){const y=o.get(S.id);if(!y){i.push(S);continue}if(y[0].type==="remove")continue;if(y[0].type==="replace"){i.push({...y[0].item});continue}const a={...S};for(const l of y)ax(l,a);i.push(a)}return h.length&&h.forEach(S=>{S.index!==void 0?i.splice(S.index,0,{...S.item}):i.push({...S.item})}),i}function ax(e,r){switch(e.type){case"select":{r.selected=e.selected;break}case"position":{typeof e.position<"u"&&(r.position=e.position),typeof e.dragging<"u"&&(r.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(r.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(r.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(r.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(r.resizing=e.resizing);break}}}function lx(e,r){return Lg(e,r)}function cx(e,r){return Lg(e,r)}function wn(e,r){return{id:e,type:"select",selected:r}}function oi(e,r=new Set,i=!1){const o=[];for(const[h,S]of e){const y=r.has(h);!(S.selected===void 0&&!y)&&S.selected!==y&&(i&&(S.selected=y),o.push(wn(S.id,y)))}return o}function Op({items:e=[],lookup:r}){var h;const i=[],o=new Map(e.map(S=>[S.id,S]));for(const[S,y]of e.entries()){const a=r.get(y.id),l=((h=a==null?void 0:a.internals)==null?void 0:h.userNode)??a;l!==void 0&&l!==y&&i.push({id:y.id,item:y,type:"replace"}),l===void 0&&i.push({item:y,type:"add",index:S})}for(const[S]of r)o.get(S)===void 0&&i.push({id:S,type:"remove"});return i}function Hp(e){return{id:e.id,type:"remove"}}const Fp=e=>TS(e),ux=e=>Q_(e);function Rg(e){return J.forwardRef(e)}function jp(e){const[r,i]=J.useState(BigInt(0)),[o]=J.useState(()=>hx(()=>i(h=>h+BigInt(1))));return Tu(()=>{const h=o.get();h.length&&(e(h),o.reset())},[r]),o}function hx(e){let r=[];return{get:()=>r,reset:()=>{r=[]},push:i=>{r.push(i),e()}}}const Dg=J.createContext(null);function dx({children:e}){const r=Ve(),i=J.useCallback(a=>{const{nodes:l=[],setNodes:_,hasDefaultNodes:v,onNodesChange:c,nodeLookup:m,fitViewQueued:C,onNodesChangeMiddlewareMap:b}=r.getState();let x=l;for(const p of a)x=typeof p=="function"?p(x):p;let f=Op({items:x,lookup:m});for(const p of b.values())f=p(f);v&&_(x),f.length>0?c==null||c(f):C&&window.requestAnimationFrame(()=>{const{fitViewQueued:p,nodes:d,setNodes:u}=r.getState();p&&u(d)})},[]),o=jp(i),h=J.useCallback(a=>{const{edges:l=[],setEdges:_,hasDefaultEdges:v,onEdgesChange:c,edgeLookup:m}=r.getState();let C=l;for(const b of a)C=typeof b=="function"?b(C):b;v?_(C):c&&c(Op({items:C,lookup:m}))},[]),S=jp(h),y=J.useMemo(()=>({nodeQueue:o,edgeQueue:S}),[]);return O.jsx(Dg.Provider,{value:y,children:e})}function fx(){const e=J.useContext(Dg);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const px=e=>!!e.panZoom;function oh(){const e=ox(),r=Ve(),i=fx(),o=Te(px),h=J.useMemo(()=>{const S=c=>r.getState().nodeLookup.get(c),y=c=>{i.nodeQueue.push(c)},a=c=>{i.edgeQueue.push(c)},l=c=>{var p,d;const{nodeLookup:m,nodeOrigin:C}=r.getState(),b=Fp(c)?c:m.get(c.id),x=b.parentId?ng(b.position,b.measured,b.parentId,m,C):b.position,f={...b,position:x,width:((p=b.measured)==null?void 0:p.width)??b.width,height:((d=b.measured)==null?void 0:d.height)??b.height};return fi(f)},_=(c,m,C={replace:!1})=>{y(b=>b.map(x=>{if(x.id===c){const f=typeof m=="function"?m(x):m;return C.replace&&Fp(f)?f:{...x,...f}}return x}))},v=(c,m,C={replace:!1})=>{a(b=>b.map(x=>{if(x.id===c){const f=typeof m=="function"?m(x):m;return C.replace&&ux(f)?f:{...x,...f}}return x}))};return{getNodes:()=>r.getState().nodes.map(c=>({...c})),getNode:c=>{var m;return(m=S(c))==null?void 0:m.internals.userNode},getInternalNode:S,getEdges:()=>{const{edges:c=[]}=r.getState();return c.map(m=>({...m}))},getEdge:c=>r.getState().edgeLookup.get(c),setNodes:y,setEdges:a,addNodes:c=>{const m=Array.isArray(c)?c:[c];i.nodeQueue.push(C=>[...C,...m])},addEdges:c=>{const m=Array.isArray(c)?c:[c];i.edgeQueue.push(C=>[...C,...m])},toObject:()=>{const{nodes:c=[],edges:m=[],transform:C}=r.getState(),[b,x,f]=C;return{nodes:c.map(p=>({...p})),edges:m.map(p=>({...p})),viewport:{x:b,y:x,zoom:f}}},deleteElements:async({nodes:c=[],edges:m=[]})=>{const{nodes:C,edges:b,onNodesDelete:x,onEdgesDelete:f,triggerNodeChanges:p,triggerEdgeChanges:d,onDelete:u,onBeforeDelete:w}=r.getState(),{nodes:L,edges:R}=await IS({nodesToRemove:c,edgesToRemove:m,nodes:C,edges:b,onBeforeDelete:w}),D=R.length>0,k=L.length>0;if(D){const M=R.map(Hp);f==null||f(R),d(M)}if(k){const M=L.map(Hp);x==null||x(L),p(M)}return(k||D)&&(u==null||u({nodes:L,edges:R})),{deletedNodes:L,deletedEdges:R}},getIntersectingNodes:(c,m=!0,C)=>{const b=hp(c),x=b?c:l(c),f=C!==void 0;return x?(C||r.getState().nodes).filter(p=>{const d=r.getState().nodeLookup.get(p.id);if(d&&!b&&(p.id===c.id||!d.internals.positionAbsolute))return!1;const u=fi(f?p:d),w=xs(u,x);return m&&w>0||w>=u.width*u.height||w>=x.width*x.height}):[]},isNodeIntersecting:(c,m,C=!0)=>{const x=hp(c)?c:l(c);if(!x)return!1;const f=xs(x,m);return C&&f>0||f>=m.width*m.height||f>=x.width*x.height},updateNode:_,updateNodeData:(c,m,C={replace:!1})=>{_(c,b=>{const x=typeof m=="function"?m(b):m;return C.replace?{...b,data:x}:{...b,data:{...b.data,...x}}},C)},updateEdge:v,updateEdgeData:(c,m,C={replace:!1})=>{v(c,b=>{const x=typeof m=="function"?m(b):m;return C.replace?{...b,data:x}:{...b,data:{...b.data,...x}}},C)},getNodesBounds:c=>{const{nodeLookup:m,nodeOrigin:C}=r.getState();return MS(c,{nodeLookup:m,nodeOrigin:C})},getHandleConnections:({type:c,id:m,nodeId:C})=>{var b;return Array.from(((b=r.getState().connectionLookup.get(`${C}-${c}${m?`-${m}`:""}`))==null?void 0:b.values())??[])},getNodeConnections:({type:c,handleId:m,nodeId:C})=>{var b;return Array.from(((b=r.getState().connectionLookup.get(`${C}${c?m?`-${c}-${m}`:`-${c}`:""}`))==null?void 0:b.values())??[])},fitView:async c=>{const m=r.getState().fitViewResolver??jS();return r.setState({fitViewQueued:!0,fitViewOptions:c,fitViewResolver:m}),i.nodeQueue.push(C=>[...C]),m.promise}}},[]);return J.useMemo(()=>({...h,...e,viewportInitialized:o}),[o])}const zp=e=>e.selected,_x=typeof window<"u"?window:void 0;function gx({deleteKeyCode:e,multiSelectionKeyCode:r}){const i=Ve(),{deleteElements:o}=oh(),h=Es(e,{actInsideInputWithModifier:!1}),S=Es(r,{target:_x});J.useEffect(()=>{if(h){const{edges:y,nodes:a}=i.getState();o({nodes:a.filter(zp),edges:y.filter(zp)}),i.setState({nodesSelectionActive:!1})}},[h]),J.useEffect(()=>{i.setState({multiSelectionActive:S})},[S])}function mx(e){const r=Ve();J.useEffect(()=>{const i=()=>{var h,S,y,a;if(!e.current||!(((S=(h=e.current).checkVisibility)==null?void 0:S.call(h))??!0))return!1;const o=eh(e.current);(o.height===0||o.width===0)&&((a=(y=r.getState()).onError)==null||a.call(y,"004",dr.error004())),r.setState({width:o.width||500,height:o.height||500})};if(e.current){i(),window.addEventListener("resize",i);const o=new ResizeObserver(()=>i());return o.observe(e.current),()=>{window.removeEventListener("resize",i),o&&e.current&&o.unobserve(e.current)}}},[])}const Va={position:"absolute",width:"100%",height:"100%",top:0,left:0},vx=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function yx({onPaneContextMenu:e,zoomOnScroll:r=!0,zoomOnPinch:i=!0,panOnScroll:o=!1,panOnScrollSpeed:h=.5,panOnScrollMode:S=xn.Free,zoomOnDoubleClick:y=!0,panOnDrag:a=!0,defaultViewport:l,translateExtent:_,minZoom:v,maxZoom:c,zoomActivationKeyCode:m,preventScrolling:C=!0,children:b,noWheelClassName:x,noPanClassName:f,onViewportChange:p,isControlledViewport:d,paneClickDistance:u,selectionOnDrag:w}){const L=Ve(),R=J.useRef(null),{userSelectionActive:D,lib:k,connectionInProgress:M}=Te(vx,Ue),W=Es(m),z=J.useRef();mx(R);const j=J.useCallback(N=>{p==null||p({x:N[0],y:N[1],zoom:N[2]}),d||L.setState({transform:N})},[p,d]);return J.useEffect(()=>{if(R.current){z.current=xC({domNode:R.current,minZoom:v,maxZoom:c,translateExtent:_,viewport:l,onDraggingChange:U=>L.setState(K=>K.paneDragging===U?K:{paneDragging:U}),onPanZoomStart:(U,K)=>{const{onViewportChangeStart:V,onMoveStart:T}=L.getState();T==null||T(U,K),V==null||V(K)},onPanZoom:(U,K)=>{const{onViewportChange:V,onMove:T}=L.getState();T==null||T(U,K),V==null||V(K)},onPanZoomEnd:(U,K)=>{const{onViewportChangeEnd:V,onMoveEnd:T}=L.getState();T==null||T(U,K),V==null||V(K)}});const{x:N,y:I,zoom:q}=z.current.getViewport();return L.setState({panZoom:z.current,transform:[N,I,q],domNode:R.current.closest(".react-flow")}),()=>{var U;(U=z.current)==null||U.destroy()}}},[]),J.useEffect(()=>{var N;(N=z.current)==null||N.update({onPaneContextMenu:e,zoomOnScroll:r,zoomOnPinch:i,panOnScroll:o,panOnScrollSpeed:h,panOnScrollMode:S,zoomOnDoubleClick:y,panOnDrag:a,zoomActivationKeyPressed:W,preventScrolling:C,noPanClassName:f,userSelectionActive:D,noWheelClassName:x,lib:k,onTransformChange:j,connectionInProgress:M,selectionOnDrag:w,paneClickDistance:u})},[e,r,i,o,h,S,y,a,W,C,f,D,x,k,j,M,w,u]),O.jsx("div",{className:"react-flow__renderer",ref:R,style:Va,children:b})}const wx=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Sx(){const{userSelectionActive:e,userSelectionRect:r}=Te(wx,Ue);return e&&r?O.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:r.width,height:r.height,transform:`translate(${r.x}px, ${r.y}px)`}}):null}const nu=(e,r)=>i=>{i.target===r.current&&(e==null||e(i))},Cx=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function xx({isSelecting:e,selectionKeyPressed:r,selectionMode:i=Cs.Full,panOnDrag:o,paneClickDistance:h,selectionOnDrag:S,onSelectionStart:y,onSelectionEnd:a,onPaneClick:l,onPaneContextMenu:_,onPaneScroll:v,onPaneMouseEnter:c,onPaneMouseMove:m,onPaneMouseLeave:C,children:b}){const x=Ve(),{userSelectionActive:f,elementsSelectable:p,dragging:d,connectionInProgress:u}=Te(Cx,Ue),w=p&&(e||f),L=J.useRef(null),R=J.useRef(),D=J.useRef(new Set),k=J.useRef(new Set),M=J.useRef(!1),W=V=>{if(M.current||u){M.current=!1;return}l==null||l(V),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},z=V=>{if(Array.isArray(o)&&(o!=null&&o.includes(2))){V.preventDefault();return}_==null||_(V)},j=v?V=>v(V):void 0,N=V=>{M.current&&(V.stopPropagation(),M.current=!1)},I=V=>{var ie,ae;const{domNode:T}=x.getState();if(R.current=T==null?void 0:T.getBoundingClientRect(),!R.current)return;const B=V.target===L.current;if(!B&&!!V.target.closest(".nokey")||!e||!(S&&B||r)||V.button!==0||!V.isPrimary)return;(ae=(ie=V.target)==null?void 0:ie.setPointerCapture)==null||ae.call(ie,V.pointerId),M.current=!1;const{x:Y,y:Z}=er(V.nativeEvent,R.current);x.setState({userSelectionRect:{width:0,height:0,startX:Y,startY:Z,x:Y,y:Z}}),B||(V.stopPropagation(),V.preventDefault())},q=V=>{const{userSelectionRect:T,transform:B,nodeLookup:P,edgeLookup:F,connectionLookup:Y,triggerNodeChanges:Z,triggerEdgeChanges:ie,defaultEdgeOptions:ae,resetSelectedElements:X}=x.getState();if(!R.current||!T)return;const{x:H,y:re}=er(V.nativeEvent,R.current),{startX:te,startY:ce}=T;if(!M.current){const ue=r?0:h;if(Math.hypot(H-te,re-ce)<=ue)return;X(),y==null||y(V)}M.current=!0;const le={startX:te,startY:ce,x:H<te?H:te,y:re<ce?re:ce,width:Math.abs(H-te),height:Math.abs(re-ce)},pe=D.current,Se=k.current;D.current=new Set(Ju(P,le,B,i===Cs.Partial,!0).map(ue=>ue.id)),k.current=new Set;const be=(ae==null?void 0:ae.selectable)??!0;for(const ue of D.current){const ge=Y.get(ue);if(ge)for(const{edgeId:Re}of ge.values()){const Ie=F.get(Re);Ie&&(Ie.selectable??be)&&k.current.add(Re)}}if(!dp(pe,D.current)){const ue=oi(P,D.current,!0);Z(ue)}if(!dp(Se,k.current)){const ue=oi(F,k.current);ie(ue)}x.setState({userSelectionRect:le,userSelectionActive:!0,nodesSelectionActive:!1})},U=V=>{var T,B;V.button===0&&((B=(T=V.target)==null?void 0:T.releasePointerCapture)==null||B.call(T,V.pointerId),!f&&V.target===L.current&&x.getState().userSelectionRect&&(W==null||W(V)),x.setState({userSelectionActive:!1,userSelectionRect:null}),M.current&&(a==null||a(V),x.setState({nodesSelectionActive:D.current.size>0})))},K=o===!0||Array.isArray(o)&&o.includes(0);return O.jsxs("div",{className:rt(["react-flow__pane",{draggable:K,dragging:d,selection:e}]),onClick:w?void 0:nu(W,L),onContextMenu:nu(z,L),onWheel:nu(j,L),onPointerEnter:w?void 0:c,onPointerMove:w?q:m,onPointerUp:w?U:void 0,onPointerDownCapture:w?I:void 0,onClickCapture:w?N:void 0,onPointerLeave:C,ref:L,style:Va,children:[b,O.jsx(Sx,{})]})}function Mu({id:e,store:r,unselect:i=!1,nodeRef:o}){const{addSelectedNodes:h,unselectNodesAndEdges:S,multiSelectionActive:y,nodeLookup:a,onError:l}=r.getState(),_=a.get(e);if(!_){l==null||l("012",dr.error012(e));return}r.setState({nodesSelectionActive:!1}),_.selected?(i||_.selected&&y)&&(S({nodes:[_],edges:[]}),requestAnimationFrame(()=>{var v;return(v=o==null?void 0:o.current)==null?void 0:v.blur()})):h([e])}function Ag({nodeRef:e,disabled:r=!1,noDragClassName:i,handleSelector:o,nodeId:h,isSelectable:S,nodeClickDistance:y}){const a=Ve(),[l,_]=J.useState(!1),v=J.useRef();return J.useEffect(()=>{v.current=cC({getStoreItems:()=>a.getState(),onNodeMouseDown:c=>{Mu({id:c,store:a,nodeRef:e})},onDragStart:()=>{_(!0)},onDragStop:()=>{_(!1)}})},[]),J.useEffect(()=>{if(!(r||!e.current||!v.current))return v.current.update({noDragClassName:i,handleSelector:o,domNode:e.current,isSelectable:S,nodeId:h,nodeClickDistance:y}),()=>{var c;(c=v.current)==null||c.destroy()}},[i,o,r,S,e,h,y]),l}const bx=e=>r=>r.selected&&(r.draggable||e&&typeof r.draggable>"u");function Tg(){const e=Ve();return J.useCallback(i=>{const{nodeExtent:o,snapToGrid:h,snapGrid:S,nodesDraggable:y,onError:a,updateNodePositions:l,nodeLookup:_,nodeOrigin:v}=e.getState(),c=new Map,m=bx(y),C=h?S[0]:5,b=h?S[1]:5,x=i.direction.x*C*i.factor,f=i.direction.y*b*i.factor;for(const[,p]of _){if(!m(p))continue;let d={x:p.internals.positionAbsolute.x+x,y:p.internals.positionAbsolute.y+f};h&&(d=Ts(d,S));const{position:u,positionAbsolute:w}=J_({nodeId:p.id,nextPosition:d,nodeLookup:_,nodeExtent:o,nodeOrigin:v,onError:a});p.position=u,p.internals.positionAbsolute=w,c.set(p.id,p)}l(c)},[])}const ah=J.createContext(null),Ex=ah.Provider;ah.Consumer;const Mg=()=>J.useContext(ah),kx=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Lx=(e,r,i)=>o=>{const{connectionClickStartHandle:h,connectionMode:S,connection:y}=o,{fromHandle:a,toHandle:l,isValid:_}=y,v=(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===r&&(l==null?void 0:l.type)===i;return{connectingFrom:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===r&&(a==null?void 0:a.type)===i,connectingTo:v,clickConnecting:(h==null?void 0:h.nodeId)===e&&(h==null?void 0:h.id)===r&&(h==null?void 0:h.type)===i,isPossibleEndHandle:S===hi.Strict?(a==null?void 0:a.type)!==i:e!==(a==null?void 0:a.nodeId)||r!==(a==null?void 0:a.id),connectionInProcess:!!a,clickConnectionInProcess:!!h,valid:v&&_}};function Rx({type:e="source",position:r=xe.Top,isValidConnection:i,isConnectable:o=!0,isConnectableStart:h=!0,isConnectableEnd:S=!0,id:y,onConnect:a,children:l,className:_,onMouseDown:v,onTouchStart:c,...m},C){var q,U;const b=y||null,x=e==="target",f=Ve(),p=Mg(),{connectOnClick:d,noPanClassName:u,rfId:w}=Te(kx,Ue),{connectingFrom:L,connectingTo:R,clickConnecting:D,isPossibleEndHandle:k,connectionInProcess:M,clickConnectionInProcess:W,valid:z}=Te(Lx(p,b,e),Ue);p||(U=(q=f.getState()).onError)==null||U.call(q,"010",dr.error010());const j=K=>{const{defaultEdgeOptions:V,onConnect:T,hasDefaultEdges:B}=f.getState(),P={...V,...K};if(B){const{edges:F,setEdges:Y}=f.getState();Y(KS(P,F))}T==null||T(P),a==null||a(P)},N=K=>{if(!p)return;const V=og(K.nativeEvent);if(h&&(V&&K.button===0||!V)){const T=f.getState();Au.onPointerDown(K.nativeEvent,{handleDomNode:K.currentTarget,autoPanOnConnect:T.autoPanOnConnect,connectionMode:T.connectionMode,connectionRadius:T.connectionRadius,domNode:T.domNode,nodeLookup:T.nodeLookup,lib:T.lib,isTarget:x,handleId:b,nodeId:p,flowId:T.rfId,panBy:T.panBy,cancelConnection:T.cancelConnection,onConnectStart:T.onConnectStart,onConnectEnd:(...B)=>{var P,F;return(F=(P=f.getState()).onConnectEnd)==null?void 0:F.call(P,...B)},updateConnection:T.updateConnection,onConnect:j,isValidConnection:i||((...B)=>{var P,F;return((F=(P=f.getState()).isValidConnection)==null?void 0:F.call(P,...B))??!0}),getTransform:()=>f.getState().transform,getFromHandle:()=>f.getState().connection.fromHandle,autoPanSpeed:T.autoPanSpeed,dragThreshold:T.connectionDragThreshold})}V?v==null||v(K):c==null||c(K)},I=K=>{const{onClickConnectStart:V,onClickConnectEnd:T,connectionClickStartHandle:B,connectionMode:P,isValidConnection:F,lib:Y,rfId:Z,nodeLookup:ie,connection:ae}=f.getState();if(!p||!B&&!h)return;if(!B){V==null||V(K.nativeEvent,{nodeId:p,handleId:b,handleType:e}),f.setState({connectionClickStartHandle:{nodeId:p,type:e,id:b}});return}const X=ig(K.target),H=i||F,{connection:re,isValid:te}=Au.isValid(K.nativeEvent,{handle:{nodeId:p,id:b,type:e},connectionMode:P,fromNodeId:B.nodeId,fromHandleId:B.id||null,fromType:B.type,isValidConnection:H,flowId:Z,doc:X,lib:Y,nodeLookup:ie});te&&re&&j(re);const ce=structuredClone(ae);delete ce.inProgress,ce.toPosition=ce.toHandle?ce.toHandle.position:null,T==null||T(K,ce),f.setState({connectionClickStartHandle:null})};return O.jsx("div",{"data-handleid":b,"data-nodeid":p,"data-handlepos":r,"data-id":`${w}-${p}-${b}-${e}`,className:rt(["react-flow__handle",`react-flow__handle-${r}`,"nodrag",u,_,{source:!x,target:x,connectable:o,connectablestart:h,connectableend:S,clickconnecting:D,connectingfrom:L,connectingto:R,valid:z,connectionindicator:o&&(!M||k)&&(M||W?S:h)}]),onMouseDown:N,onTouchStart:N,onClick:d?I:void 0,ref:C,...m,children:l})}const gi=J.memo(Rg(Rx));function Dx({data:e,isConnectable:r,sourcePosition:i=xe.Bottom}){return O.jsxs(O.Fragment,{children:[e==null?void 0:e.label,O.jsx(gi,{type:"source",position:i,isConnectable:r})]})}function Ax({data:e,isConnectable:r,targetPosition:i=xe.Top,sourcePosition:o=xe.Bottom}){return O.jsxs(O.Fragment,{children:[O.jsx(gi,{type:"target",position:i,isConnectable:r}),e==null?void 0:e.label,O.jsx(gi,{type:"source",position:o,isConnectable:r})]})}function Tx(){return null}function Mx({data:e,isConnectable:r,targetPosition:i=xe.Top}){return O.jsxs(O.Fragment,{children:[O.jsx(gi,{type:"target",position:i,isConnectable:r}),e==null?void 0:e.label]})}const Aa={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},$p={input:Dx,default:Ax,output:Mx,group:Tx};function Px(e){var r,i,o,h;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((r=e.style)==null?void 0:r.width),height:e.height??e.initialHeight??((i=e.style)==null?void 0:i.height)}:{width:e.width??((o=e.style)==null?void 0:o.width),height:e.height??((h=e.style)==null?void 0:h.height)}}const Nx=e=>{const{width:r,height:i,x:o,y:h}=As(e.nodeLookup,{filter:S=>!!S.selected});return{width:Zt(r)?r:null,height:Zt(i)?i:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${h}px)`}};function Bx({onSelectionContextMenu:e,noPanClassName:r,disableKeyboardA11y:i}){const o=Ve(),{width:h,height:S,transformString:y,userSelectionActive:a}=Te(Nx,Ue),l=Tg(),_=J.useRef(null);J.useEffect(()=>{var C;i||(C=_.current)==null||C.focus({preventScroll:!0})},[i]);const v=!a&&h!==null&&S!==null;if(Ag({nodeRef:_,disabled:!v}),!v)return null;const c=e?C=>{const b=o.getState().nodes.filter(x=>x.selected);e(C,b)}:void 0,m=C=>{Object.prototype.hasOwnProperty.call(Aa,C.key)&&(C.preventDefault(),l({direction:Aa[C.key],factor:C.shiftKey?4:1}))};return O.jsx("div",{className:rt(["react-flow__nodesselection","react-flow__container",r]),style:{transform:y},children:O.jsx("div",{ref:_,className:"react-flow__nodesselection-rect",onContextMenu:c,tabIndex:i?void 0:-1,onKeyDown:i?void 0:m,style:{width:h,height:S}})})}const Wp=typeof window<"u"?window:void 0,Ix=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Pg({children:e,onPaneClick:r,onPaneMouseEnter:i,onPaneMouseMove:o,onPaneMouseLeave:h,onPaneContextMenu:S,onPaneScroll:y,paneClickDistance:a,deleteKeyCode:l,selectionKeyCode:_,selectionOnDrag:v,selectionMode:c,onSelectionStart:m,onSelectionEnd:C,multiSelectionKeyCode:b,panActivationKeyCode:x,zoomActivationKeyCode:f,elementsSelectable:p,zoomOnScroll:d,zoomOnPinch:u,panOnScroll:w,panOnScrollSpeed:L,panOnScrollMode:R,zoomOnDoubleClick:D,panOnDrag:k,defaultViewport:M,translateExtent:W,minZoom:z,maxZoom:j,preventScrolling:N,onSelectionContextMenu:I,noWheelClassName:q,noPanClassName:U,disableKeyboardA11y:K,onViewportChange:V,isControlledViewport:T}){const{nodesSelectionActive:B,userSelectionActive:P}=Te(Ix,Ue),F=Es(_,{target:Wp}),Y=Es(x,{target:Wp}),Z=Y||k,ie=Y||w,ae=v&&Z!==!0,X=F||P||ae;return gx({deleteKeyCode:l,multiSelectionKeyCode:b}),O.jsx(yx,{onPaneContextMenu:S,elementsSelectable:p,zoomOnScroll:d,zoomOnPinch:u,panOnScroll:ie,panOnScrollSpeed:L,panOnScrollMode:R,zoomOnDoubleClick:D,panOnDrag:!F&&Z,defaultViewport:M,translateExtent:W,minZoom:z,maxZoom:j,zoomActivationKeyCode:f,preventScrolling:N,noWheelClassName:q,noPanClassName:U,onViewportChange:V,isControlledViewport:T,paneClickDistance:a,selectionOnDrag:ae,children:O.jsxs(xx,{onSelectionStart:m,onSelectionEnd:C,onPaneClick:r,onPaneMouseEnter:i,onPaneMouseMove:o,onPaneMouseLeave:h,onPaneContextMenu:S,onPaneScroll:y,panOnDrag:Z,isSelecting:!!X,selectionMode:c,selectionKeyPressed:F,paneClickDistance:a,selectionOnDrag:ae,children:[e,B&&O.jsx(Bx,{onSelectionContextMenu:I,noPanClassName:U,disableKeyboardA11y:K})]})})}Pg.displayName="FlowRenderer";const Ox=J.memo(Pg),Hx=e=>r=>e?Ju(r.nodeLookup,{x:0,y:0,width:r.width,height:r.height},r.transform,!0).map(i=>i.id):Array.from(r.nodeLookup.keys());function Fx(e){return Te(J.useCallback(Hx(e),[e]),Ue)}const jx=e=>e.updateNodeInternals;function zx(){const e=Te(jx),[r]=J.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(i=>{const o=new Map;i.forEach(h=>{const S=h.target.getAttribute("data-id");o.set(S,{id:S,nodeElement:h.target,force:!0})}),e(o)}));return J.useEffect(()=>()=>{r==null||r.disconnect()},[r]),r}function $x({node:e,nodeType:r,hasDimensions:i,resizeObserver:o}){const h=Ve(),S=J.useRef(null),y=J.useRef(null),a=J.useRef(e.sourcePosition),l=J.useRef(e.targetPosition),_=J.useRef(r),v=i&&!!e.internals.handleBounds;return J.useEffect(()=>{S.current&&!e.hidden&&(!v||y.current!==S.current)&&(y.current&&(o==null||o.unobserve(y.current)),o==null||o.observe(S.current),y.current=S.current)},[v,e.hidden]),J.useEffect(()=>()=>{y.current&&(o==null||o.unobserve(y.current),y.current=null)},[]),J.useEffect(()=>{if(S.current){const c=_.current!==r,m=a.current!==e.sourcePosition,C=l.current!==e.targetPosition;(c||m||C)&&(_.current=r,a.current=e.sourcePosition,l.current=e.targetPosition,h.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:S.current,force:!0}]])))}},[e.id,r,e.sourcePosition,e.targetPosition]),S}function Wx({id:e,onClick:r,onMouseEnter:i,onMouseMove:o,onMouseLeave:h,onContextMenu:S,onDoubleClick:y,nodesDraggable:a,elementsSelectable:l,nodesConnectable:_,nodesFocusable:v,resizeObserver:c,noDragClassName:m,noPanClassName:C,disableKeyboardA11y:b,rfId:x,nodeTypes:f,nodeClickDistance:p,onError:d}){const{node:u,internals:w,isParent:L}=Te(H=>{const re=H.nodeLookup.get(e),te=H.parentLookup.has(e);return{node:re,internals:re.internals,isParent:te}},Ue);let R=u.type||"default",D=(f==null?void 0:f[R])||$p[R];D===void 0&&(d==null||d("003",dr.error003(R)),R="default",D=(f==null?void 0:f.default)||$p.default);const k=!!(u.draggable||a&&typeof u.draggable>"u"),M=!!(u.selectable||l&&typeof u.selectable>"u"),W=!!(u.connectable||_&&typeof u.connectable>"u"),z=!!(u.focusable||v&&typeof u.focusable>"u"),j=Ve(),N=rg(u),I=$x({node:u,nodeType:R,hasDimensions:N,resizeObserver:c}),q=Ag({nodeRef:I,disabled:u.hidden||!k,noDragClassName:m,handleSelector:u.dragHandle,nodeId:e,isSelectable:M,nodeClickDistance:p}),U=Tg();if(u.hidden)return null;const K=Rr(u),V=Px(u),T=M||k||r||i||o||h,B=i?H=>i(H,{...w.userNode}):void 0,P=o?H=>o(H,{...w.userNode}):void 0,F=h?H=>h(H,{...w.userNode}):void 0,Y=S?H=>S(H,{...w.userNode}):void 0,Z=y?H=>y(H,{...w.userNode}):void 0,ie=H=>{const{selectNodesOnDrag:re,nodeDragThreshold:te}=j.getState();M&&(!re||!k||te>0)&&Mu({id:e,store:j,nodeRef:I}),r&&r(H,{...w.userNode})},ae=H=>{if(!(sg(H.nativeEvent)||b)){if(K_.includes(H.key)&&M){const re=H.key==="Escape";Mu({id:e,store:j,unselect:re,nodeRef:I})}else if(k&&u.selected&&Object.prototype.hasOwnProperty.call(Aa,H.key)){H.preventDefault();const{ariaLabelConfig:re}=j.getState();j.setState({ariaLiveMessage:re["node.a11yDescription.ariaLiveMessage"]({direction:H.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),U({direction:Aa[H.key],factor:H.shiftKey?4:1})}}},X=()=>{var Se;if(b||!((Se=I.current)!=null&&Se.matches(":focus-visible")))return;const{transform:H,width:re,height:te,autoPanOnNodeFocus:ce,setCenter:le}=j.getState();if(!ce)return;Ju(new Map([[e,u]]),{x:0,y:0,width:re,height:te},H,!0).length>0||le(u.position.x+K.width/2,u.position.y+K.height/2,{zoom:H[2]})};return O.jsx("div",{className:rt(["react-flow__node",`react-flow__node-${R}`,{[C]:k},u.className,{selected:u.selected,selectable:M,parent:L,draggable:k,dragging:q}]),ref:I,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:T?"all":"none",visibility:N?"visible":"hidden",...u.style,...V},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:B,onMouseMove:P,onMouseLeave:F,onContextMenu:Y,onClick:ie,onDoubleClick:Z,onKeyDown:z?ae:void 0,tabIndex:z?0:void 0,onFocus:z?X:void 0,role:u.ariaRole??(z?"group":void 0),"aria-roledescription":"node","aria-describedby":b?void 0:`${bg}-${x}`,"aria-label":u.ariaLabel,...u.domAttributes,children:O.jsx(Ex,{value:e,children:O.jsx(D,{id:e,data:u.data,type:R,positionAbsoluteX:w.positionAbsolute.x,positionAbsoluteY:w.positionAbsolute.y,selected:u.selected??!1,selectable:M,draggable:k,deletable:u.deletable??!0,isConnectable:W,sourcePosition:u.sourcePosition,targetPosition:u.targetPosition,dragging:q,dragHandle:u.dragHandle,zIndex:w.z,parentId:u.parentId,...K})})})}var Ux=J.memo(Wx);const Vx=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Ng(e){const{nodesDraggable:r,nodesConnectable:i,nodesFocusable:o,elementsSelectable:h,onError:S}=Te(Vx,Ue),y=Fx(e.onlyRenderVisibleElements),a=zx();return O.jsx("div",{className:"react-flow__nodes",style:Va,children:y.map(l=>O.jsx(Ux,{id:l,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:a,nodesDraggable:r,nodesConnectable:i,nodesFocusable:o,elementsSelectable:h,nodeClickDistance:e.nodeClickDistance,onError:S},l))})}Ng.displayName="NodeRenderer";const qx=J.memo(Ng);function Kx(e){return Te(J.useCallback(i=>{if(!e)return i.edges.map(h=>h.id);const o=[];if(i.width&&i.height)for(const h of i.edges){const S=i.nodeLookup.get(h.source),y=i.nodeLookup.get(h.target);S&&y&&US({sourceNode:S,targetNode:y,width:i.width,height:i.height,transform:i.transform})&&o.push(h.id)}return o},[e]),Ue)}const Xx=({color:e="none",strokeWidth:r=1})=>{const i={strokeWidth:r,...e&&{stroke:e}};return O.jsx("polyline",{className:"arrow",style:i,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Yx=({color:e="none",strokeWidth:r=1})=>{const i={strokeWidth:r,...e&&{stroke:e,fill:e}};return O.jsx("polyline",{className:"arrowclosed",style:i,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Up={[La.Arrow]:Xx,[La.ArrowClosed]:Yx};function Gx(e){const r=Ve();return J.useMemo(()=>{var h,S;return Object.prototype.hasOwnProperty.call(Up,e)?Up[e]:((S=(h=r.getState()).onError)==null||S.call(h,"009",dr.error009(e)),null)},[e])}const Qx=({id:e,type:r,color:i,width:o=12.5,height:h=12.5,markerUnits:S="strokeWidth",strokeWidth:y,orient:a="auto-start-reverse"})=>{const l=Gx(r);return l?O.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${h}`,viewBox:"-10 -10 20 20",markerUnits:S,orient:a,refX:"0",refY:"0",children:O.jsx(l,{color:i,strokeWidth:y})}):null},Bg=({defaultColor:e,rfId:r})=>{const i=Te(S=>S.edges),o=Te(S=>S.defaultEdgeOptions),h=J.useMemo(()=>JS(i,{id:r,defaultColor:e,defaultMarkerStart:o==null?void 0:o.markerStart,defaultMarkerEnd:o==null?void 0:o.markerEnd}),[i,o,r,e]);return h.length?O.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:O.jsx("defs",{children:h.map(S=>O.jsx(Qx,{id:S.id,type:S.type,color:S.color,width:S.width,height:S.height,markerUnits:S.markerUnits,strokeWidth:S.strokeWidth,orient:S.orient},S.id))})}):null};Bg.displayName="MarkerDefinitions";var Jx=J.memo(Bg);function Ig({x:e,y:r,label:i,labelStyle:o,labelShowBg:h=!0,labelBgStyle:S,labelBgPadding:y=[2,4],labelBgBorderRadius:a=2,children:l,className:_,...v}){const[c,m]=J.useState({x:1,y:0,width:0,height:0}),C=rt(["react-flow__edge-textwrapper",_]),b=J.useRef(null);return J.useEffect(()=>{if(b.current){const x=b.current.getBBox();m({x:x.x,y:x.y,width:x.width,height:x.height})}},[i]),i?O.jsxs("g",{transform:`translate(${e-c.width/2} ${r-c.height/2})`,className:C,visibility:c.width?"visible":"hidden",...v,children:[h&&O.jsx("rect",{width:c.width+2*y[0],x:-y[0],y:-y[1],height:c.height+2*y[1],className:"react-flow__edge-textbg",style:S,rx:a,ry:a}),O.jsx("text",{className:"react-flow__edge-text",y:c.height/2,dy:"0.3em",ref:b,style:o,children:i}),l]}):null}Ig.displayName="EdgeText";const Zx=J.memo(Ig);function qa({path:e,labelX:r,labelY:i,label:o,labelStyle:h,labelShowBg:S,labelBgStyle:y,labelBgPadding:a,labelBgBorderRadius:l,interactionWidth:_=20,...v}){return O.jsxs(O.Fragment,{children:[O.jsx("path",{...v,d:e,fill:"none",className:rt(["react-flow__edge-path",v.className])}),_?O.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:_,className:"react-flow__edge-interaction"}):null,o&&Zt(r)&&Zt(i)?O.jsx(Zx,{x:r,y:i,label:o,labelStyle:h,labelShowBg:S,labelBgStyle:y,labelBgPadding:a,labelBgBorderRadius:l}):null]})}function Vp({pos:e,x1:r,y1:i,x2:o,y2:h}){return e===xe.Left||e===xe.Right?[.5*(r+o),i]:[r,.5*(i+h)]}function Og({sourceX:e,sourceY:r,sourcePosition:i=xe.Bottom,targetX:o,targetY:h,targetPosition:S=xe.Top}){const[y,a]=Vp({pos:i,x1:e,y1:r,x2:o,y2:h}),[l,_]=Vp({pos:S,x1:o,y1:h,x2:e,y2:r}),[v,c,m,C]=ag({sourceX:e,sourceY:r,targetX:o,targetY:h,sourceControlX:y,sourceControlY:a,targetControlX:l,targetControlY:_});return[`M${e},${r} C${y},${a} ${l},${_} ${o},${h}`,v,c,m,C]}function Hg(e){return J.memo(({id:r,sourceX:i,sourceY:o,targetX:h,targetY:S,sourcePosition:y,targetPosition:a,label:l,labelStyle:_,labelShowBg:v,labelBgStyle:c,labelBgPadding:m,labelBgBorderRadius:C,style:b,markerEnd:x,markerStart:f,interactionWidth:p})=>{const[d,u,w]=Og({sourceX:i,sourceY:o,sourcePosition:y,targetX:h,targetY:S,targetPosition:a}),L=e.isInternal?void 0:r;return O.jsx(qa,{id:L,path:d,labelX:u,labelY:w,label:l,labelStyle:_,labelShowBg:v,labelBgStyle:c,labelBgPadding:m,labelBgBorderRadius:C,style:b,markerEnd:x,markerStart:f,interactionWidth:p})})}const e2=Hg({isInternal:!1}),Fg=Hg({isInternal:!0});e2.displayName="SimpleBezierEdge";Fg.displayName="SimpleBezierEdgeInternal";function jg(e){return J.memo(({id:r,sourceX:i,sourceY:o,targetX:h,targetY:S,label:y,labelStyle:a,labelShowBg:l,labelBgStyle:_,labelBgPadding:v,labelBgBorderRadius:c,style:m,sourcePosition:C=xe.Bottom,targetPosition:b=xe.Top,markerEnd:x,markerStart:f,pathOptions:p,interactionWidth:d})=>{const[u,w,L]=Lu({sourceX:i,sourceY:o,sourcePosition:C,targetX:h,targetY:S,targetPosition:b,borderRadius:p==null?void 0:p.borderRadius,offset:p==null?void 0:p.offset,stepPosition:p==null?void 0:p.stepPosition}),R=e.isInternal?void 0:r;return O.jsx(qa,{id:R,path:u,labelX:w,labelY:L,label:y,labelStyle:a,labelShowBg:l,labelBgStyle:_,labelBgPadding:v,labelBgBorderRadius:c,style:m,markerEnd:x,markerStart:f,interactionWidth:d})})}const zg=jg({isInternal:!1}),$g=jg({isInternal:!0});zg.displayName="SmoothStepEdge";$g.displayName="SmoothStepEdgeInternal";function Wg(e){return J.memo(({id:r,...i})=>{var h;const o=e.isInternal?void 0:r;return O.jsx(zg,{...i,id:o,pathOptions:J.useMemo(()=>{var S;return{borderRadius:0,offset:(S=i.pathOptions)==null?void 0:S.offset}},[(h=i.pathOptions)==null?void 0:h.offset])})})}const t2=Wg({isInternal:!1}),Ug=Wg({isInternal:!0});t2.displayName="StepEdge";Ug.displayName="StepEdgeInternal";function Vg(e){return J.memo(({id:r,sourceX:i,sourceY:o,targetX:h,targetY:S,label:y,labelStyle:a,labelShowBg:l,labelBgStyle:_,labelBgPadding:v,labelBgBorderRadius:c,style:m,markerEnd:C,markerStart:b,interactionWidth:x})=>{const[f,p,d]=ug({sourceX:i,sourceY:o,targetX:h,targetY:S}),u=e.isInternal?void 0:r;return O.jsx(qa,{id:u,path:f,labelX:p,labelY:d,label:y,labelStyle:a,labelShowBg:l,labelBgStyle:_,labelBgPadding:v,labelBgBorderRadius:c,style:m,markerEnd:C,markerStart:b,interactionWidth:x})})}const r2=Vg({isInternal:!1}),qg=Vg({isInternal:!0});r2.displayName="StraightEdge";qg.displayName="StraightEdgeInternal";function Kg(e){return J.memo(({id:r,sourceX:i,sourceY:o,targetX:h,targetY:S,sourcePosition:y=xe.Bottom,targetPosition:a=xe.Top,label:l,labelStyle:_,labelShowBg:v,labelBgStyle:c,labelBgPadding:m,labelBgBorderRadius:C,style:b,markerEnd:x,markerStart:f,pathOptions:p,interactionWidth:d})=>{const[u,w,L]=lg({sourceX:i,sourceY:o,sourcePosition:y,targetX:h,targetY:S,targetPosition:a,curvature:p==null?void 0:p.curvature}),R=e.isInternal?void 0:r;return O.jsx(qa,{id:R,path:u,labelX:w,labelY:L,label:l,labelStyle:_,labelShowBg:v,labelBgStyle:c,labelBgPadding:m,labelBgBorderRadius:C,style:b,markerEnd:x,markerStart:f,interactionWidth:d})})}const n2=Kg({isInternal:!1}),Xg=Kg({isInternal:!0});n2.displayName="BezierEdge";Xg.displayName="BezierEdgeInternal";const qp={default:Xg,straight:qg,step:Ug,smoothstep:$g,simplebezier:Fg},Kp={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},i2=(e,r,i)=>i===xe.Left?e-r:i===xe.Right?e+r:e,s2=(e,r,i)=>i===xe.Top?e-r:i===xe.Bottom?e+r:e,Xp="react-flow__edgeupdater";function Yp({position:e,centerX:r,centerY:i,radius:o=10,onMouseDown:h,onMouseEnter:S,onMouseOut:y,type:a}){return O.jsx("circle",{onMouseDown:h,onMouseEnter:S,onMouseOut:y,className:rt([Xp,`${Xp}-${a}`]),cx:i2(r,o,e),cy:s2(i,o,e),r:o,stroke:"transparent",fill:"transparent"})}function o2({isReconnectable:e,reconnectRadius:r,edge:i,sourceX:o,sourceY:h,targetX:S,targetY:y,sourcePosition:a,targetPosition:l,onReconnect:_,onReconnectStart:v,onReconnectEnd:c,setReconnecting:m,setUpdateHover:C}){const b=Ve(),x=(w,L)=>{if(w.button!==0)return;const{autoPanOnConnect:R,domNode:D,connectionMode:k,connectionRadius:M,lib:W,onConnectStart:z,cancelConnection:j,nodeLookup:N,rfId:I,panBy:q,updateConnection:U}=b.getState(),K=L.type==="target",V=(P,F)=>{m(!1),c==null||c(P,i,L.type,F)},T=P=>_==null?void 0:_(i,P),B=(P,F)=>{m(!0),v==null||v(w,i,L.type),z==null||z(P,F)};Au.onPointerDown(w.nativeEvent,{autoPanOnConnect:R,connectionMode:k,connectionRadius:M,domNode:D,handleId:L.id,nodeId:L.nodeId,nodeLookup:N,isTarget:K,edgeUpdaterType:L.type,lib:W,flowId:I,cancelConnection:j,panBy:q,isValidConnection:(...P)=>{var F,Y;return((Y=(F=b.getState()).isValidConnection)==null?void 0:Y.call(F,...P))??!0},onConnect:T,onConnectStart:B,onConnectEnd:(...P)=>{var F,Y;return(Y=(F=b.getState()).onConnectEnd)==null?void 0:Y.call(F,...P)},onReconnectEnd:V,updateConnection:U,getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,dragThreshold:b.getState().connectionDragThreshold,handleDomNode:w.currentTarget})},f=w=>x(w,{nodeId:i.target,id:i.targetHandle??null,type:"target"}),p=w=>x(w,{nodeId:i.source,id:i.sourceHandle??null,type:"source"}),d=()=>C(!0),u=()=>C(!1);return O.jsxs(O.Fragment,{children:[(e===!0||e==="source")&&O.jsx(Yp,{position:a,centerX:o,centerY:h,radius:r,onMouseDown:f,onMouseEnter:d,onMouseOut:u,type:"source"}),(e===!0||e==="target")&&O.jsx(Yp,{position:l,centerX:S,centerY:y,radius:r,onMouseDown:p,onMouseEnter:d,onMouseOut:u,type:"target"})]})}function a2({id:e,edgesFocusable:r,edgesReconnectable:i,elementsSelectable:o,onClick:h,onDoubleClick:S,onContextMenu:y,onMouseEnter:a,onMouseMove:l,onMouseLeave:_,reconnectRadius:v,onReconnect:c,onReconnectStart:m,onReconnectEnd:C,rfId:b,edgeTypes:x,noPanClassName:f,onError:p,disableKeyboardA11y:d}){let u=Te(le=>le.edgeLookup.get(e));const w=Te(le=>le.defaultEdgeOptions);u=w?{...w,...u}:u;let L=u.type||"default",R=(x==null?void 0:x[L])||qp[L];R===void 0&&(p==null||p("011",dr.error011(L)),L="default",R=(x==null?void 0:x.default)||qp.default);const D=!!(u.focusable||r&&typeof u.focusable>"u"),k=typeof c<"u"&&(u.reconnectable||i&&typeof u.reconnectable>"u"),M=!!(u.selectable||o&&typeof u.selectable>"u"),W=J.useRef(null),[z,j]=J.useState(!1),[N,I]=J.useState(!1),q=Ve(),{zIndex:U,sourceX:K,sourceY:V,targetX:T,targetY:B,sourcePosition:P,targetPosition:F}=Te(J.useCallback(le=>{const pe=le.nodeLookup.get(u.source),Se=le.nodeLookup.get(u.target);if(!pe||!Se)return{zIndex:u.zIndex,...Kp};const be=QS({id:e,sourceNode:pe,targetNode:Se,sourceHandle:u.sourceHandle||null,targetHandle:u.targetHandle||null,connectionMode:le.connectionMode,onError:p});return{zIndex:WS({selected:u.selected,zIndex:u.zIndex,sourceNode:pe,targetNode:Se,elevateOnSelect:le.elevateEdgesOnSelect,zIndexMode:le.zIndexMode}),...be||Kp}},[u.source,u.target,u.sourceHandle,u.targetHandle,u.selected,u.zIndex]),Ue),Y=J.useMemo(()=>u.markerStart?`url('#${Ru(u.markerStart,b)}')`:void 0,[u.markerStart,b]),Z=J.useMemo(()=>u.markerEnd?`url('#${Ru(u.markerEnd,b)}')`:void 0,[u.markerEnd,b]);if(u.hidden||K===null||V===null||T===null||B===null)return null;const ie=le=>{var ue;const{addSelectedEdges:pe,unselectNodesAndEdges:Se,multiSelectionActive:be}=q.getState();M&&(q.setState({nodesSelectionActive:!1}),u.selected&&be?(Se({nodes:[],edges:[u]}),(ue=W.current)==null||ue.blur()):pe([e])),h&&h(le,u)},ae=S?le=>{S(le,{...u})}:void 0,X=y?le=>{y(le,{...u})}:void 0,H=a?le=>{a(le,{...u})}:void 0,re=l?le=>{l(le,{...u})}:void 0,te=_?le=>{_(le,{...u})}:void 0,ce=le=>{var pe;if(!d&&K_.includes(le.key)&&M){const{unselectNodesAndEdges:Se,addSelectedEdges:be}=q.getState();le.key==="Escape"?((pe=W.current)==null||pe.blur(),Se({edges:[u]})):be([e])}};return O.jsx("svg",{style:{zIndex:U},children:O.jsxs("g",{className:rt(["react-flow__edge",`react-flow__edge-${L}`,u.className,f,{selected:u.selected,animated:u.animated,inactive:!M&&!h,updating:z,selectable:M}]),onClick:ie,onDoubleClick:ae,onContextMenu:X,onMouseEnter:H,onMouseMove:re,onMouseLeave:te,onKeyDown:D?ce:void 0,tabIndex:D?0:void 0,role:u.ariaRole??(D?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":u.ariaLabel===null?void 0:u.ariaLabel||`Edge from ${u.source} to ${u.target}`,"aria-describedby":D?`${Eg}-${b}`:void 0,ref:W,...u.domAttributes,children:[!N&&O.jsx(R,{id:e,source:u.source,target:u.target,type:u.type,selected:u.selected,animated:u.animated,selectable:M,deletable:u.deletable??!0,label:u.label,labelStyle:u.labelStyle,labelShowBg:u.labelShowBg,labelBgStyle:u.labelBgStyle,labelBgPadding:u.labelBgPadding,labelBgBorderRadius:u.labelBgBorderRadius,sourceX:K,sourceY:V,targetX:T,targetY:B,sourcePosition:P,targetPosition:F,data:u.data,style:u.style,sourceHandleId:u.sourceHandle,targetHandleId:u.targetHandle,markerStart:Y,markerEnd:Z,pathOptions:"pathOptions"in u?u.pathOptions:void 0,interactionWidth:u.interactionWidth}),k&&O.jsx(o2,{edge:u,isReconnectable:k,reconnectRadius:v,onReconnect:c,onReconnectStart:m,onReconnectEnd:C,sourceX:K,sourceY:V,targetX:T,targetY:B,sourcePosition:P,targetPosition:F,setUpdateHover:j,setReconnecting:I})]})})}var l2=J.memo(a2);const c2=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Yg({defaultMarkerColor:e,onlyRenderVisibleElements:r,rfId:i,edgeTypes:o,noPanClassName:h,onReconnect:S,onEdgeContextMenu:y,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:_,onEdgeClick:v,reconnectRadius:c,onEdgeDoubleClick:m,onReconnectStart:C,onReconnectEnd:b,disableKeyboardA11y:x}){const{edgesFocusable:f,edgesReconnectable:p,elementsSelectable:d,onError:u}=Te(c2,Ue),w=Kx(r);return O.jsxs("div",{className:"react-flow__edges",children:[O.jsx(Jx,{defaultColor:e,rfId:i}),w.map(L=>O.jsx(l2,{id:L,edgesFocusable:f,edgesReconnectable:p,elementsSelectable:d,noPanClassName:h,onReconnect:S,onContextMenu:y,onMouseEnter:a,onMouseMove:l,onMouseLeave:_,onClick:v,reconnectRadius:c,onDoubleClick:m,onReconnectStart:C,onReconnectEnd:b,rfId:i,onError:u,edgeTypes:o,disableKeyboardA11y:x},L))]})}Yg.displayName="EdgeRenderer";const u2=J.memo(Yg),h2=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function d2({children:e}){const r=Te(h2);return O.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:r},children:e})}function f2(e){const r=oh(),i=J.useRef(!1);J.useEffect(()=>{!i.current&&r.viewportInitialized&&e&&(setTimeout(()=>e(r),1),i.current=!0)},[e,r.viewportInitialized])}const p2=e=>{var r;return(r=e.panZoom)==null?void 0:r.syncViewport};function _2(e){const r=Te(p2),i=Ve();return J.useEffect(()=>{e&&(r==null||r(e),i.setState({transform:[e.x,e.y,e.zoom]}))},[e,r]),null}function g2(e){return e.connection.inProgress?{...e.connection,to:Ms(e.connection.to,e.transform)}:{...e.connection}}function m2(e){return g2}function v2(e){const r=m2();return Te(r,Ue)}const y2=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function w2({containerStyle:e,style:r,type:i,component:o}){const{nodesConnectable:h,width:S,height:y,isValid:a,inProgress:l}=Te(y2,Ue);return!(S&&h&&l)?null:O.jsx("svg",{style:e,width:S,height:y,className:"react-flow__connectionline react-flow__container",children:O.jsx("g",{className:rt(["react-flow__connection",G_(a)]),children:O.jsx(Gg,{style:r,type:i,CustomComponent:o,isValid:a})})})}const Gg=({style:e,type:r=Zr.Bezier,CustomComponent:i,isValid:o})=>{const{inProgress:h,from:S,fromNode:y,fromHandle:a,fromPosition:l,to:_,toNode:v,toHandle:c,toPosition:m,pointer:C}=v2();if(!h)return;if(i)return O.jsx(i,{connectionLineType:r,connectionLineStyle:e,fromNode:y,fromHandle:a,fromX:S.x,fromY:S.y,toX:_.x,toY:_.y,fromPosition:l,toPosition:m,connectionStatus:G_(o),toNode:v,toHandle:c,pointer:C});let b="";const x={sourceX:S.x,sourceY:S.y,sourcePosition:l,targetX:_.x,targetY:_.y,targetPosition:m};switch(r){case Zr.Bezier:[b]=lg(x);break;case Zr.SimpleBezier:[b]=Og(x);break;case Zr.Step:[b]=Lu({...x,borderRadius:0});break;case Zr.SmoothStep:[b]=Lu(x);break;default:[b]=ug(x)}return O.jsx("path",{d:b,fill:"none",className:"react-flow__connection-path",style:e})};Gg.displayName="ConnectionLine";const S2={};function Gp(e=S2){J.useRef(e),Ve(),J.useEffect(()=>{},[e])}function C2(){Ve(),J.useRef(!1),J.useEffect(()=>{},[])}function Qg({nodeTypes:e,edgeTypes:r,onInit:i,onNodeClick:o,onEdgeClick:h,onNodeDoubleClick:S,onEdgeDoubleClick:y,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:_,onNodeContextMenu:v,onSelectionContextMenu:c,onSelectionStart:m,onSelectionEnd:C,connectionLineType:b,connectionLineStyle:x,connectionLineComponent:f,connectionLineContainerStyle:p,selectionKeyCode:d,selectionOnDrag:u,selectionMode:w,multiSelectionKeyCode:L,panActivationKeyCode:R,zoomActivationKeyCode:D,deleteKeyCode:k,onlyRenderVisibleElements:M,elementsSelectable:W,defaultViewport:z,translateExtent:j,minZoom:N,maxZoom:I,preventScrolling:q,defaultMarkerColor:U,zoomOnScroll:K,zoomOnPinch:V,panOnScroll:T,panOnScrollSpeed:B,panOnScrollMode:P,zoomOnDoubleClick:F,panOnDrag:Y,onPaneClick:Z,onPaneMouseEnter:ie,onPaneMouseMove:ae,onPaneMouseLeave:X,onPaneScroll:H,onPaneContextMenu:re,paneClickDistance:te,nodeClickDistance:ce,onEdgeContextMenu:le,onEdgeMouseEnter:pe,onEdgeMouseMove:Se,onEdgeMouseLeave:be,reconnectRadius:ue,onReconnect:ge,onReconnectStart:Re,onReconnectEnd:Ie,noDragClassName:ze,noWheelClassName:Qe,noPanClassName:ut,disableKeyboardA11y:qe,nodeExtent:pt,rfId:Ne,viewport:Je,onViewportChange:ht}){return Gp(e),Gp(r),C2(),f2(i),_2(Je),O.jsx(Ox,{onPaneClick:Z,onPaneMouseEnter:ie,onPaneMouseMove:ae,onPaneMouseLeave:X,onPaneContextMenu:re,onPaneScroll:H,paneClickDistance:te,deleteKeyCode:k,selectionKeyCode:d,selectionOnDrag:u,selectionMode:w,onSelectionStart:m,onSelectionEnd:C,multiSelectionKeyCode:L,panActivationKeyCode:R,zoomActivationKeyCode:D,elementsSelectable:W,zoomOnScroll:K,zoomOnPinch:V,zoomOnDoubleClick:F,panOnScroll:T,panOnScrollSpeed:B,panOnScrollMode:P,panOnDrag:Y,defaultViewport:z,translateExtent:j,minZoom:N,maxZoom:I,onSelectionContextMenu:c,preventScrolling:q,noDragClassName:ze,noWheelClassName:Qe,noPanClassName:ut,disableKeyboardA11y:qe,onViewportChange:ht,isControlledViewport:!!Je,children:O.jsxs(d2,{children:[O.jsx(u2,{edgeTypes:r,onEdgeClick:h,onEdgeDoubleClick:y,onReconnect:ge,onReconnectStart:Re,onReconnectEnd:Ie,onlyRenderVisibleElements:M,onEdgeContextMenu:le,onEdgeMouseEnter:pe,onEdgeMouseMove:Se,onEdgeMouseLeave:be,reconnectRadius:ue,defaultMarkerColor:U,noPanClassName:ut,disableKeyboardA11y:qe,rfId:Ne}),O.jsx(w2,{style:x,type:b,component:f,containerStyle:p}),O.jsx("div",{className:"react-flow__edgelabel-renderer"}),O.jsx(qx,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:S,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:_,onNodeContextMenu:v,nodeClickDistance:ce,onlyRenderVisibleElements:M,noPanClassName:ut,noDragClassName:ze,disableKeyboardA11y:qe,nodeExtent:pt,rfId:Ne}),O.jsx("div",{className:"react-flow__viewport-portal"})]})})}Qg.displayName="GraphView";const x2=J.memo(Qg),Qp=({nodes:e,edges:r,defaultNodes:i,defaultEdges:o,width:h,height:S,fitView:y,fitViewOptions:a,minZoom:l=.5,maxZoom:_=2,nodeOrigin:v,nodeExtent:c,zIndexMode:m="basic"}={})=>{const C=new Map,b=new Map,x=new Map,f=new Map,p=o??r??[],d=i??e??[],u=v??[0,0],w=c??Ss;fg(x,f,p);const{nodesInitialized:L}=Du(d,C,b,{nodeOrigin:u,nodeExtent:w,zIndexMode:m});let R=[0,0,1];if(y&&h&&S){const D=As(C,{filter:z=>!!((z.width||z.initialWidth)&&(z.height||z.initialHeight))}),{x:k,y:M,zoom:W}=Zu(D,h,S,l,_,(a==null?void 0:a.padding)??.1);R=[k,M,W]}return{rfId:"1",width:h??0,height:S??0,transform:R,nodes:d,nodesInitialized:L,nodeLookup:C,parentLookup:b,edges:p,edgeLookup:f,connectionLookup:x,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:i!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:l,maxZoom:_,translateExtent:Ss,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:hi.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:u,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:y??!1,fitViewOptions:a,fitViewResolver:null,connection:{...Y_},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:OS,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:X_,zIndexMode:m,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},b2=({nodes:e,edges:r,defaultNodes:i,defaultEdges:o,width:h,height:S,fitView:y,fitViewOptions:a,minZoom:l,maxZoom:_,nodeOrigin:v,nodeExtent:c,zIndexMode:m})=>zC((C,b)=>{async function x(){const{nodeLookup:f,panZoom:p,fitViewOptions:d,fitViewResolver:u,width:w,height:L,minZoom:R,maxZoom:D}=b();p&&(await BS({nodes:f,width:w,height:L,panZoom:p,minZoom:R,maxZoom:D},d),u==null||u.resolve(!0),C({fitViewResolver:null}))}return{...Qp({nodes:e,edges:r,width:h,height:S,fitView:y,fitViewOptions:a,minZoom:l,maxZoom:_,nodeOrigin:v,nodeExtent:c,defaultNodes:i,defaultEdges:o,zIndexMode:m}),setNodes:f=>{const{nodeLookup:p,parentLookup:d,nodeOrigin:u,elevateNodesOnSelect:w,fitViewQueued:L,zIndexMode:R,nodesSelectionActive:D}=b(),{nodesInitialized:k,hasSelectedNodes:M}=Du(f,p,d,{nodeOrigin:u,nodeExtent:c,elevateNodesOnSelect:w,checkEquality:!0,zIndexMode:R}),W=D&&M;L&&k?(x(),C({nodes:f,nodesInitialized:k,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:W})):C({nodes:f,nodesInitialized:k,nodesSelectionActive:W})},setEdges:f=>{const{connectionLookup:p,edgeLookup:d}=b();fg(p,d,f),C({edges:f})},setDefaultNodesAndEdges:(f,p)=>{if(f){const{setNodes:d}=b();d(f),C({hasDefaultNodes:!0})}if(p){const{setEdges:d}=b();d(p),C({hasDefaultEdges:!0})}},updateNodeInternals:f=>{const{triggerNodeChanges:p,nodeLookup:d,parentLookup:u,domNode:w,nodeOrigin:L,nodeExtent:R,debug:D,fitViewQueued:k,zIndexMode:M}=b(),{changes:W,updatedInternals:z}=sC(f,d,u,w,L,R,M);z&&(tC(d,u,{nodeOrigin:L,nodeExtent:R,zIndexMode:M}),k?(x(),C({fitViewQueued:!1,fitViewOptions:void 0})):C({}),(W==null?void 0:W.length)>0&&(D&&console.log("React Flow: trigger node changes",W),p==null||p(W)))},updateNodePositions:(f,p=!1)=>{const d=[];let u=[];const{nodeLookup:w,triggerNodeChanges:L,connection:R,updateConnection:D,onNodesChangeMiddlewareMap:k}=b();for(const[M,W]of f){const z=w.get(M),j=!!(z!=null&&z.expandParent&&(z!=null&&z.parentId)&&(W!=null&&W.position)),N={id:M,type:"position",position:j?{x:Math.max(0,W.position.x),y:Math.max(0,W.position.y)}:W.position,dragging:p};if(z&&R.inProgress&&R.fromNode.id===z.id){const I=Ln(z,R.fromHandle,xe.Left,!0);D({...R,from:I})}j&&z.parentId&&d.push({id:M,parentId:z.parentId,rect:{...W.internals.positionAbsolute,width:W.measured.width??0,height:W.measured.height??0}}),u.push(N)}if(d.length>0){const{parentLookup:M,nodeOrigin:W}=b(),z=sh(d,w,M,W);u.push(...z)}for(const M of k.values())u=M(u);L(u)},triggerNodeChanges:f=>{const{onNodesChange:p,setNodes:d,nodes:u,hasDefaultNodes:w,debug:L}=b();if(f!=null&&f.length){if(w){const R=lx(f,u);d(R)}L&&console.log("React Flow: trigger node changes",f),p==null||p(f)}},triggerEdgeChanges:f=>{const{onEdgesChange:p,setEdges:d,edges:u,hasDefaultEdges:w,debug:L}=b();if(f!=null&&f.length){if(w){const R=cx(f,u);d(R)}L&&console.log("React Flow: trigger edge changes",f),p==null||p(f)}},addSelectedNodes:f=>{const{multiSelectionActive:p,edgeLookup:d,nodeLookup:u,triggerNodeChanges:w,triggerEdgeChanges:L}=b();if(p){const R=f.map(D=>wn(D,!0));w(R);return}w(oi(u,new Set([...f]),!0)),L(oi(d))},addSelectedEdges:f=>{const{multiSelectionActive:p,edgeLookup:d,nodeLookup:u,triggerNodeChanges:w,triggerEdgeChanges:L}=b();if(p){const R=f.map(D=>wn(D,!0));L(R);return}L(oi(d,new Set([...f]))),w(oi(u,new Set,!0))},unselectNodesAndEdges:({nodes:f,edges:p}={})=>{const{edges:d,nodes:u,nodeLookup:w,triggerNodeChanges:L,triggerEdgeChanges:R}=b(),D=f||u,k=p||d,M=[];for(const z of D){if(!z.selected)continue;const j=w.get(z.id);j&&(j.selected=!1),M.push(wn(z.id,!1))}const W=[];for(const z of k)z.selected&&W.push(wn(z.id,!1));L(M),R(W)},setMinZoom:f=>{const{panZoom:p,maxZoom:d}=b();p==null||p.setScaleExtent([f,d]),C({minZoom:f})},setMaxZoom:f=>{const{panZoom:p,minZoom:d}=b();p==null||p.setScaleExtent([d,f]),C({maxZoom:f})},setTranslateExtent:f=>{var p;(p=b().panZoom)==null||p.setTranslateExtent(f),C({translateExtent:f})},resetSelectedElements:()=>{const{edges:f,nodes:p,triggerNodeChanges:d,triggerEdgeChanges:u,elementsSelectable:w}=b();if(!w)return;const L=p.reduce((D,k)=>k.selected?[...D,wn(k.id,!1)]:D,[]),R=f.reduce((D,k)=>k.selected?[...D,wn(k.id,!1)]:D,[]);d(L),u(R)},setNodeExtent:f=>{const{nodes:p,nodeLookup:d,parentLookup:u,nodeOrigin:w,elevateNodesOnSelect:L,nodeExtent:R,zIndexMode:D}=b();f[0][0]===R[0][0]&&f[0][1]===R[0][1]&&f[1][0]===R[1][0]&&f[1][1]===R[1][1]||(Du(p,d,u,{nodeOrigin:w,nodeExtent:f,elevateNodesOnSelect:L,checkEquality:!1,zIndexMode:D}),C({nodeExtent:f}))},panBy:f=>{const{transform:p,width:d,height:u,panZoom:w,translateExtent:L}=b();return oC({delta:f,panZoom:w,transform:p,translateExtent:L,width:d,height:u})},setCenter:async(f,p,d)=>{const{width:u,height:w,maxZoom:L,panZoom:R}=b();if(!R)return Promise.resolve(!1);const D=typeof(d==null?void 0:d.zoom)<"u"?d.zoom:L;return await R.setViewport({x:u/2-f*D,y:w/2-p*D,zoom:D},{duration:d==null?void 0:d.duration,ease:d==null?void 0:d.ease,interpolate:d==null?void 0:d.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{C({connection:{...Y_}})},updateConnection:f=>{C({connection:f})},reset:()=>C({...Qp()})}},Object.is);function E2({initialNodes:e,initialEdges:r,defaultNodes:i,defaultEdges:o,initialWidth:h,initialHeight:S,initialMinZoom:y,initialMaxZoom:a,initialFitViewOptions:l,fitView:_,nodeOrigin:v,nodeExtent:c,zIndexMode:m,children:C}){const[b]=J.useState(()=>b2({nodes:e,edges:r,defaultNodes:i,defaultEdges:o,width:h,height:S,fitView:_,minZoom:y,maxZoom:a,fitViewOptions:l,nodeOrigin:v,nodeExtent:c,zIndexMode:m}));return O.jsx($C,{value:b,children:O.jsx(dx,{children:C})})}function k2({children:e,nodes:r,edges:i,defaultNodes:o,defaultEdges:h,width:S,height:y,fitView:a,fitViewOptions:l,minZoom:_,maxZoom:v,nodeOrigin:c,nodeExtent:m,zIndexMode:C}){return J.useContext(Wa)?O.jsx(O.Fragment,{children:e}):O.jsx(E2,{initialNodes:r,initialEdges:i,defaultNodes:o,defaultEdges:h,initialWidth:S,initialHeight:y,fitView:a,initialFitViewOptions:l,initialMinZoom:_,initialMaxZoom:v,nodeOrigin:c,nodeExtent:m,zIndexMode:C,children:e})}const L2={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function R2({nodes:e,edges:r,defaultNodes:i,defaultEdges:o,className:h,nodeTypes:S,edgeTypes:y,onNodeClick:a,onEdgeClick:l,onInit:_,onMove:v,onMoveStart:c,onMoveEnd:m,onConnect:C,onConnectStart:b,onConnectEnd:x,onClickConnectStart:f,onClickConnectEnd:p,onNodeMouseEnter:d,onNodeMouseMove:u,onNodeMouseLeave:w,onNodeContextMenu:L,onNodeDoubleClick:R,onNodeDragStart:D,onNodeDrag:k,onNodeDragStop:M,onNodesDelete:W,onEdgesDelete:z,onDelete:j,onSelectionChange:N,onSelectionDragStart:I,onSelectionDrag:q,onSelectionDragStop:U,onSelectionContextMenu:K,onSelectionStart:V,onSelectionEnd:T,onBeforeDelete:B,connectionMode:P,connectionLineType:F=Zr.Bezier,connectionLineStyle:Y,connectionLineComponent:Z,connectionLineContainerStyle:ie,deleteKeyCode:ae="Backspace",selectionKeyCode:X="Shift",selectionOnDrag:H=!1,selectionMode:re=Cs.Full,panActivationKeyCode:te="Space",multiSelectionKeyCode:ce=bs()?"Meta":"Control",zoomActivationKeyCode:le=bs()?"Meta":"Control",snapToGrid:pe,snapGrid:Se,onlyRenderVisibleElements:be=!1,selectNodesOnDrag:ue,nodesDraggable:ge,autoPanOnNodeFocus:Re,nodesConnectable:Ie,nodesFocusable:ze,nodeOrigin:Qe=kg,edgesFocusable:ut,edgesReconnectable:qe,elementsSelectable:pt=!0,defaultViewport:Ne=tx,minZoom:Je=.5,maxZoom:ht=2,translateExtent:$e=Ss,preventScrolling:pr=!0,nodeExtent:ot,defaultMarkerColor:Rt="#b1b1b7",zoomOnScroll:Oe=!0,zoomOnPinch:Rn=!0,panOnScroll:Ps=!1,panOnScrollSpeed:Ka=.5,panOnScrollMode:vi=xn.Free,zoomOnDoubleClick:yi=!0,panOnDrag:wi=!0,onPaneClick:Si,onPaneMouseEnter:Ci,onPaneMouseMove:Dr,onPaneMouseLeave:Ar,onPaneScroll:Ns,onPaneContextMenu:Bs,paneClickDistance:Is=1,nodeClickDistance:Os=0,children:Hs,onReconnect:xi,onReconnectStart:Fs,onReconnectEnd:rn,onEdgeContextMenu:bi,onEdgeDoubleClick:nn,onEdgeMouseEnter:Xa,onEdgeMouseMove:sn,onEdgeMouseLeave:Dn,reconnectRadius:An=10,onNodesChange:Ei,onEdgesChange:Ya,noDragClassName:Ga="nodrag",noWheelClassName:Qa="nowheel",noPanClassName:rr="nopan",fitView:ki,fitViewOptions:Li,connectOnClick:Ja,attributionPosition:js,proOptions:zs,defaultEdgeOptions:$s,elevateNodesOnSelect:Ws=!0,elevateEdgesOnSelect:Za=!1,disableKeyboardA11y:Us=!1,autoPanOnConnect:Ke,autoPanOnNodeDrag:el,autoPanSpeed:Ri,connectionRadius:Vs,isValidConnection:Tn,onError:tl,style:qs,id:on,nodeDragThreshold:It,connectionDragThreshold:rl,viewport:Dt,onViewportChange:nl,width:il,height:sl,colorMode:Mn="light",debug:Pn,onScroll:nr,ariaLabelConfig:Nn,zIndexMode:Ks="basic",...ol},Di){const Bn=on||"1",Ai=sx(Mn),an=J.useCallback(Xs=>{Xs.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),nr==null||nr(Xs)},[nr]);return O.jsx("div",{"data-testid":"rf__wrapper",...ol,onScroll:an,style:{...qs,...L2},ref:Di,className:rt(["react-flow",h,Ai]),id:on,role:"application",children:O.jsxs(k2,{nodes:e,edges:r,width:il,height:sl,fitView:ki,fitViewOptions:Li,minZoom:Je,maxZoom:ht,nodeOrigin:Qe,nodeExtent:ot,zIndexMode:Ks,children:[O.jsx(ix,{nodes:e,edges:r,defaultNodes:i,defaultEdges:o,onConnect:C,onConnectStart:b,onConnectEnd:x,onClickConnectStart:f,onClickConnectEnd:p,nodesDraggable:ge,autoPanOnNodeFocus:Re,nodesConnectable:Ie,nodesFocusable:ze,edgesFocusable:ut,edgesReconnectable:qe,elementsSelectable:pt,elevateNodesOnSelect:Ws,elevateEdgesOnSelect:Za,minZoom:Je,maxZoom:ht,nodeExtent:ot,onNodesChange:Ei,onEdgesChange:Ya,snapToGrid:pe,snapGrid:Se,connectionMode:P,translateExtent:$e,connectOnClick:Ja,defaultEdgeOptions:$s,fitView:ki,fitViewOptions:Li,onNodesDelete:W,onEdgesDelete:z,onDelete:j,onNodeDragStart:D,onNodeDrag:k,onNodeDragStop:M,onSelectionDrag:q,onSelectionDragStart:I,onSelectionDragStop:U,onMove:v,onMoveStart:c,onMoveEnd:m,noPanClassName:rr,nodeOrigin:Qe,rfId:Bn,autoPanOnConnect:Ke,autoPanOnNodeDrag:el,autoPanSpeed:Ri,onError:tl,connectionRadius:Vs,isValidConnection:Tn,selectNodesOnDrag:ue,nodeDragThreshold:It,connectionDragThreshold:rl,onBeforeDelete:B,debug:Pn,ariaLabelConfig:Nn,zIndexMode:Ks}),O.jsx(x2,{onInit:_,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:d,onNodeMouseMove:u,onNodeMouseLeave:w,onNodeContextMenu:L,onNodeDoubleClick:R,nodeTypes:S,edgeTypes:y,connectionLineType:F,connectionLineStyle:Y,connectionLineComponent:Z,connectionLineContainerStyle:ie,selectionKeyCode:X,selectionOnDrag:H,selectionMode:re,deleteKeyCode:ae,multiSelectionKeyCode:ce,panActivationKeyCode:te,zoomActivationKeyCode:le,onlyRenderVisibleElements:be,defaultViewport:Ne,translateExtent:$e,minZoom:Je,maxZoom:ht,preventScrolling:pr,zoomOnScroll:Oe,zoomOnPinch:Rn,zoomOnDoubleClick:yi,panOnScroll:Ps,panOnScrollSpeed:Ka,panOnScrollMode:vi,panOnDrag:wi,onPaneClick:Si,onPaneMouseEnter:Ci,onPaneMouseMove:Dr,onPaneMouseLeave:Ar,onPaneScroll:Ns,onPaneContextMenu:Bs,paneClickDistance:Is,nodeClickDistance:Os,onSelectionContextMenu:K,onSelectionStart:V,onSelectionEnd:T,onReconnect:xi,onReconnectStart:Fs,onReconnectEnd:rn,onEdgeContextMenu:bi,onEdgeDoubleClick:nn,onEdgeMouseEnter:Xa,onEdgeMouseMove:sn,onEdgeMouseLeave:Dn,reconnectRadius:An,defaultMarkerColor:Rt,noDragClassName:Ga,noWheelClassName:Qa,noPanClassName:rr,rfId:Bn,disableKeyboardA11y:Us,nodeExtent:ot,viewport:Dt,onViewportChange:nl}),O.jsx(ex,{onSelectionChange:N}),Hs,O.jsx(YC,{proOptions:zs,position:js}),O.jsx(XC,{rfId:Bn,disableKeyboardA11y:Us})]})})}var D2=Rg(R2);function A2({dimensions:e,lineWidth:r,variant:i,className:o}){return O.jsx("path",{strokeWidth:r,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:rt(["react-flow__background-pattern",i,o])})}function T2({radius:e,className:r}){return O.jsx("circle",{cx:e,cy:e,r:e,className:rt(["react-flow__background-pattern","dots",r])})}var tn;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(tn||(tn={}));const M2={[tn.Dots]:1,[tn.Lines]:1,[tn.Cross]:6},P2=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Jg({id:e,variant:r=tn.Dots,gap:i=20,size:o,lineWidth:h=1,offset:S=0,color:y,bgColor:a,style:l,className:_,patternClassName:v}){const c=J.useRef(null),{transform:m,patternId:C}=Te(P2,Ue),b=o||M2[r],x=r===tn.Dots,f=r===tn.Cross,p=Array.isArray(i)?i:[i,i],d=[p[0]*m[2]||1,p[1]*m[2]||1],u=b*m[2],w=Array.isArray(S)?S:[S,S],L=f?[u,u]:d,R=[w[0]*m[2]||1+L[0]/2,w[1]*m[2]||1+L[1]/2],D=`${C}${e||""}`;return O.jsxs("svg",{className:rt(["react-flow__background",_]),style:{...l,...Va,"--xy-background-color-props":a,"--xy-background-pattern-color-props":y},ref:c,"data-testid":"rf__background",children:[O.jsx("pattern",{id:D,x:m[0]%d[0],y:m[1]%d[1],width:d[0],height:d[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${R[0]},-${R[1]})`,children:x?O.jsx(T2,{radius:u/2,className:v}):O.jsx(A2,{dimensions:L,lineWidth:h,variant:r,className:v})}),O.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${D})`})]})}Jg.displayName="Background";const N2=J.memo(Jg);function B2(){return O.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:O.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function I2(){return O.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:O.jsx("path",{d:"M0 0h32v4.2H0z"})})}function O2(){return O.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:O.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 H2(){return O.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:O.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 F2(){return O.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:O.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 aa({children:e,className:r,...i}){return O.jsx("button",{type:"button",className:rt(["react-flow__controls-button",r]),...i,children:e})}const j2=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Zg({style:e,showZoom:r=!0,showFitView:i=!0,showInteractive:o=!0,fitViewOptions:h,onZoomIn:S,onZoomOut:y,onFitView:a,onInteractiveChange:l,className:_,children:v,position:c="bottom-left",orientation:m="vertical","aria-label":C}){const b=Ve(),{isInteractive:x,minZoomReached:f,maxZoomReached:p,ariaLabelConfig:d}=Te(j2,Ue),{zoomIn:u,zoomOut:w,fitView:L}=oh(),R=()=>{u(),S==null||S()},D=()=>{w(),y==null||y()},k=()=>{L(h),a==null||a()},M=()=>{b.setState({nodesDraggable:!x,nodesConnectable:!x,elementsSelectable:!x}),l==null||l(!x)},W=m==="horizontal"?"horizontal":"vertical";return O.jsxs(Ua,{className:rt(["react-flow__controls",W,_]),position:c,style:e,"data-testid":"rf__controls","aria-label":C??d["controls.ariaLabel"],children:[r&&O.jsxs(O.Fragment,{children:[O.jsx(aa,{onClick:R,className:"react-flow__controls-zoomin",title:d["controls.zoomIn.ariaLabel"],"aria-label":d["controls.zoomIn.ariaLabel"],disabled:p,children:O.jsx(B2,{})}),O.jsx(aa,{onClick:D,className:"react-flow__controls-zoomout",title:d["controls.zoomOut.ariaLabel"],"aria-label":d["controls.zoomOut.ariaLabel"],disabled:f,children:O.jsx(I2,{})})]}),i&&O.jsx(aa,{className:"react-flow__controls-fitview",onClick:k,title:d["controls.fitView.ariaLabel"],"aria-label":d["controls.fitView.ariaLabel"],children:O.jsx(O2,{})}),o&&O.jsx(aa,{className:"react-flow__controls-interactive",onClick:M,title:d["controls.interactive.ariaLabel"],"aria-label":d["controls.interactive.ariaLabel"],children:x?O.jsx(F2,{}):O.jsx(H2,{})}),v]})}Zg.displayName="Controls";const z2=J.memo(Zg);function $2({id:e,x:r,y:i,width:o,height:h,style:S,color:y,strokeColor:a,strokeWidth:l,className:_,borderRadius:v,shapeRendering:c,selected:m,onClick:C}){const{background:b,backgroundColor:x}=S||{},f=y||b||x;return O.jsx("rect",{className:rt(["react-flow__minimap-node",{selected:m},_]),x:r,y:i,rx:v,ry:v,width:o,height:h,style:{fill:f,stroke:a,strokeWidth:l},shapeRendering:c,onClick:C?p=>C(p,e):void 0})}const W2=J.memo($2),U2=e=>e.nodes.map(r=>r.id),iu=e=>e instanceof Function?e:()=>e;function V2({nodeStrokeColor:e,nodeColor:r,nodeClassName:i="",nodeBorderRadius:o=5,nodeStrokeWidth:h,nodeComponent:S=W2,onClick:y}){const a=Te(U2,Ue),l=iu(r),_=iu(e),v=iu(i),c=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return O.jsx(O.Fragment,{children:a.map(m=>O.jsx(K2,{id:m,nodeColorFunc:l,nodeStrokeColorFunc:_,nodeClassNameFunc:v,nodeBorderRadius:o,nodeStrokeWidth:h,NodeComponent:S,onClick:y,shapeRendering:c},m))})}function q2({id:e,nodeColorFunc:r,nodeStrokeColorFunc:i,nodeClassNameFunc:o,nodeBorderRadius:h,nodeStrokeWidth:S,shapeRendering:y,NodeComponent:a,onClick:l}){const{node:_,x:v,y:c,width:m,height:C}=Te(b=>{const x=b.nodeLookup.get(e);if(!x)return{node:void 0,x:0,y:0,width:0,height:0};const f=x.internals.userNode,{x:p,y:d}=x.internals.positionAbsolute,{width:u,height:w}=Rr(f);return{node:f,x:p,y:d,width:u,height:w}},Ue);return!_||_.hidden||!rg(_)?null:O.jsx(a,{x:v,y:c,width:m,height:C,style:_.style,selected:!!_.selected,className:o(_),color:r(_),borderRadius:h,strokeColor:i(_),strokeWidth:S,shapeRendering:y,onClick:l,id:_.id})}const K2=J.memo(q2);var X2=J.memo(V2);const Y2=200,G2=150,Q2=e=>!e.hidden,J2=e=>{const r={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:r,boundingRect:e.nodeLookup.size>0?tg(As(e.nodeLookup,{filter:Q2}),r):r,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Z2="react-flow__minimap-desc";function em({style:e,className:r,nodeStrokeColor:i,nodeColor:o,nodeClassName:h="",nodeBorderRadius:S=5,nodeStrokeWidth:y,nodeComponent:a,bgColor:l,maskColor:_,maskStrokeColor:v,maskStrokeWidth:c,position:m="bottom-right",onClick:C,onNodeClick:b,pannable:x=!1,zoomable:f=!1,ariaLabel:p,inversePan:d,zoomStep:u=1,offsetScale:w=5}){const L=Ve(),R=J.useRef(null),{boundingRect:D,viewBB:k,rfId:M,panZoom:W,translateExtent:z,flowWidth:j,flowHeight:N,ariaLabelConfig:I}=Te(J2,Ue),q=(e==null?void 0:e.width)??Y2,U=(e==null?void 0:e.height)??G2,K=D.width/q,V=D.height/U,T=Math.max(K,V),B=T*q,P=T*U,F=w*T,Y=D.x-(B-D.width)/2-F,Z=D.y-(P-D.height)/2-F,ie=B+F*2,ae=P+F*2,X=`${Z2}-${M}`,H=J.useRef(0),re=J.useRef();H.current=T,J.useEffect(()=>{if(R.current&&W)return re.current=_C({domNode:R.current,panZoom:W,getTransform:()=>L.getState().transform,getViewScale:()=>H.current}),()=>{var pe;(pe=re.current)==null||pe.destroy()}},[W]),J.useEffect(()=>{var pe;(pe=re.current)==null||pe.update({translateExtent:z,width:j,height:N,inversePan:d,pannable:x,zoomStep:u,zoomable:f})},[x,f,d,u,z,j,N]);const te=C?pe=>{var ue;const[Se,be]=((ue=re.current)==null?void 0:ue.pointer(pe))||[0,0];C(pe,{x:Se,y:be})}:void 0,ce=b?J.useCallback((pe,Se)=>{const be=L.getState().nodeLookup.get(Se).internals.userNode;b(pe,be)},[]):void 0,le=p??I["minimap.ariaLabel"];return O.jsx(Ua,{position:m,style:{...e,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof _=="string"?_:void 0,"--xy-minimap-mask-stroke-color-props":typeof v=="string"?v:void 0,"--xy-minimap-mask-stroke-width-props":typeof c=="number"?c*T:void 0,"--xy-minimap-node-background-color-props":typeof o=="string"?o:void 0,"--xy-minimap-node-stroke-color-props":typeof i=="string"?i:void 0,"--xy-minimap-node-stroke-width-props":typeof y=="number"?y:void 0},className:rt(["react-flow__minimap",r]),"data-testid":"rf__minimap",children:O.jsxs("svg",{width:q,height:U,viewBox:`${Y} ${Z} ${ie} ${ae}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":X,ref:R,onClick:te,children:[le&&O.jsx("title",{id:X,children:le}),O.jsx(X2,{onClick:ce,nodeColor:o,nodeStrokeColor:i,nodeBorderRadius:S,nodeClassName:h,nodeStrokeWidth:y,nodeComponent:a}),O.jsx("path",{className:"react-flow__minimap-mask",d:`M${Y-F},${Z-F}h${ie+F*2}v${ae+F*2}h${-ie-F*2}z
62
+ M${k.x},${k.y}h${k.width}v${k.height}h${-k.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}em.displayName="MiniMap";J.memo(em);const eb=e=>r=>e?`${Math.max(1/r.transform[2],1)}`:void 0,tb={[_i.Line]:"right",[_i.Handle]:"bottom-right"};function rb({nodeId:e,position:r,variant:i=_i.Handle,className:o,style:h=void 0,children:S,color:y,minWidth:a=10,minHeight:l=10,maxWidth:_=Number.MAX_VALUE,maxHeight:v=Number.MAX_VALUE,keepAspectRatio:c=!1,resizeDirection:m,autoScale:C=!0,shouldResize:b,onResizeStart:x,onResize:f,onResizeEnd:p}){const d=Mg(),u=typeof e=="string"?e:d,w=Ve(),L=J.useRef(null),R=i===_i.Handle,D=Te(J.useCallback(eb(R&&C),[R,C]),Ue),k=J.useRef(null),M=r??tb[i];J.useEffect(()=>{if(!(!L.current||!u))return k.current||(k.current=DC({domNode:L.current,nodeId:u,getStoreItems:()=>{const{nodeLookup:z,transform:j,snapGrid:N,snapToGrid:I,nodeOrigin:q,domNode:U}=w.getState();return{nodeLookup:z,transform:j,snapGrid:N,snapToGrid:I,nodeOrigin:q,paneDomNode:U}},onChange:(z,j)=>{const{triggerNodeChanges:N,nodeLookup:I,parentLookup:q,nodeOrigin:U}=w.getState(),K=[],V={x:z.x,y:z.y},T=I.get(u);if(T&&T.expandParent&&T.parentId){const B=T.origin??U,P=z.width??T.measured.width??0,F=z.height??T.measured.height??0,Y={id:T.id,parentId:T.parentId,rect:{width:P,height:F,...ng({x:z.x??T.position.x,y:z.y??T.position.y},{width:P,height:F},T.parentId,I,B)}},Z=sh([Y],I,q,U);K.push(...Z),V.x=z.x?Math.max(B[0]*P,z.x):void 0,V.y=z.y?Math.max(B[1]*F,z.y):void 0}if(V.x!==void 0&&V.y!==void 0){const B={id:u,type:"position",position:{...V}};K.push(B)}if(z.width!==void 0&&z.height!==void 0){const P={id:u,type:"dimensions",resizing:!0,setAttributes:m?m==="horizontal"?"width":"height":!0,dimensions:{width:z.width,height:z.height}};K.push(P)}for(const B of j){const P={...B,type:"position"};K.push(P)}N(K)},onEnd:({width:z,height:j})=>{const N={id:u,type:"dimensions",resizing:!1,dimensions:{width:z,height:j}};w.getState().triggerNodeChanges([N])}})),k.current.update({controlPosition:M,boundaries:{minWidth:a,minHeight:l,maxWidth:_,maxHeight:v},keepAspectRatio:c,resizeDirection:m,onResizeStart:x,onResize:f,onResizeEnd:p,shouldResize:b}),()=>{var z;(z=k.current)==null||z.destroy()}},[M,a,l,_,v,c,x,f,p,b]);const W=M.split("-");return O.jsx("div",{className:rt(["react-flow__resize-control","nodrag",...W,i,o]),ref:L,style:{...h,scale:D,...y&&{[R?"backgroundColor":"borderColor"]:y}},children:S})}J.memo(rb);const nb={running:"#4ade80",starting:"#fbbf24",idle:"#fbbf24",done:"#555",dead:"#f87171"};function ib({data:e}){const r=e,i=nb[r.status]||"#555",o=r.status==="running"||r.status==="starting";return O.jsxs("div",{style:{background:"#0a0a0a",border:`1px solid ${o?"#333":"#1e1e1e"}`,borderRadius:8,padding:"12px 16px",minWidth:160,position:"relative",transition:"border-color 180ms ease"},children:[O.jsx(gi,{type:"target",position:xe.Left,style:{background:"#333",border:"none",width:6,height:6}}),O.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:5},children:[O.jsx("div",{style:{width:6,height:6,borderRadius:"50%",background:i,boxShadow:o?`0 0 6px ${i}40`:"none"}}),O.jsx("span",{style:{fontSize:13,fontWeight:500,color:"#e8e8e8",fontFamily:"'DM Sans', sans-serif"},children:r.label}),r.service&&r.service!=="claude"&&O.jsx("span",{style:{fontSize:9,fontWeight:600,color:r.service==="codex"?"#10b981":"#888",background:r.service==="codex"?"#10b98118":"#88888818",padding:"1px 5px",borderRadius:4,fontFamily:"'JetBrains Mono', monospace",textTransform:"uppercase",letterSpacing:"0.5px"},children:r.service})]}),O.jsx("div",{style:{fontSize:11,color:"#555",maxWidth:180,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"'DM Sans', sans-serif",lineHeight:1.4},children:r.task}),r.messageCount&&r.messageCount>0&&O.jsxs("div",{title:`${r.messageCount} message${r.messageCount>1?"s":""} received`,style:{position:"absolute",top:-6,right:-6,background:"#4ade80",color:"#000",borderRadius:8,padding:"2px 5px",display:"flex",alignItems:"center",justifyContent:"center",gap:2,fontSize:9,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:"default"},children:[O.jsx("span",{style:{fontSize:8},children:"✉"}),r.messageCount]}),O.jsx(gi,{type:"source",position:xe.Right,style:{background:"#333",border:"none",width:6,height:6}})]})}const sb={agent:ib};function ob({agents:e,messages:r,onSelectAgent:i}){const[o,h]=J.useState([]),S=J.useMemo(()=>{const _={};for(const v of r)v.to_agent&&v.to_agent!=="all"&&(_[v.to_agent]=(_[v.to_agent]||0)+1);return _},[r]),y=J.useMemo(()=>{const _=new Map,v=new Set(e.map(c=>c.id));for(const c of r){if(!v.has(c.from_agent)||!v.has(c.to_agent)||c.to_agent==="all")continue;const m=[c.from_agent,c.to_agent].sort().join("|");_.set(m,(_.get(m)||0)+1)}return Array.from(_.entries()).map(([c,m])=>{const[C,b]=c.split("|");return{id:`collab-${c}`,source:C,target:b,style:{stroke:"#333",strokeWidth:Math.min(1+m*.3,3)},label:`${m}`,labelStyle:{fill:"#666",fontSize:9},labelBgStyle:{fill:"#0a0a0a",fillOpacity:.9},labelBgPadding:[4,2]}})},[e,r]),a=J.useMemo(()=>{const _=Math.max(Math.ceil(Math.sqrt(e.length)),1);return e.map((v,c)=>({id:v.id,type:"agent",position:{x:80+c%_*240,y:80+Math.floor(c/_)*130},data:{label:v.name,status:v.status,task:v.task||"",service:v.service||"claude",messageCount:S[v.id]||0}}))},[e,S]);J.useEffect(()=>{if(r.length===0)return;const _=r[0];if(!_)return;const v=new Set(e.map(b=>b.id));if(!v.has(_.from_agent)||!v.has(_.to_agent))return;const c=`msg-${_.id}`,m={id:c,source:_.from_agent,target:_.to_agent,animated:!0,style:{stroke:"#4ade80",strokeWidth:1.5}};h(b=>[...b,m]);const C=setTimeout(()=>{h(b=>b.filter(x=>x.id!==c))},3e3);return()=>clearTimeout(C)},[r,e]);const l=J.useCallback((_,v)=>{const c=e.find(m=>m.id===v.id);c&&i(c)},[e,i]);return O.jsx("div",{style:{width:"100%",height:"100%"},children:O.jsxs(D2,{nodes:a,edges:[...y,...o],nodeTypes:sb,onNodeClick:l,fitView:!0,proOptions:{hideAttribution:!0},children:[O.jsx(N2,{color:"#1a1a1a",gap:24,size:1}),O.jsx(z2,{style:{background:"#0a0a0a",border:"1px solid #1e1e1e",borderRadius:6}})]})})}var su={exports:{}},Jp;function ab(){return Jp||(Jp=1,(function(e,r){(function(i,o){e.exports=o()})(globalThis,(()=>(()=>{var i={4567:function(y,a,l){var _=this&&this.__decorate||function(d,u,w,L){var R,D=arguments.length,k=D<3?u:L===null?L=Object.getOwnPropertyDescriptor(u,w):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(d,u,w,L);else for(var M=d.length-1;M>=0;M--)(R=d[M])&&(k=(D<3?R(k):D>3?R(u,w,k):R(u,w))||k);return D>3&&k&&Object.defineProperty(u,w,k),k},v=this&&this.__param||function(d,u){return function(w,L){u(w,L,d)}};Object.defineProperty(a,"__esModule",{value:!0}),a.AccessibilityManager=void 0;const c=l(9042),m=l(9924),C=l(844),b=l(4725),x=l(2585),f=l(3656);let p=a.AccessibilityManager=class extends C.Disposable{constructor(d,u,w,L){super(),this._terminal=d,this._coreBrowserService=w,this._renderService=L,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let R=0;R<this._terminal.rows;R++)this._rowElements[R]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[R]);if(this._topBoundaryFocusListener=R=>this._handleBoundaryFocus(R,0),this._bottomBoundaryFocusListener=R=>this._handleBoundaryFocus(R,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new m.TimeBasedDebouncer(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((R=>this._handleResize(R.rows)))),this.register(this._terminal.onRender((R=>this._refreshRows(R.start,R.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((R=>this._handleChar(R)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
63
63
  `)))),this.register(this._terminal.onA11yTab((R=>this._handleTab(R)))),this.register(this._terminal.onKey((R=>this._handleKey(R.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,f.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,C.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(d){for(let u=0;u<d;u++)this._handleChar(" ")}_handleChar(d){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==d&&(this._charsToAnnounce+=d):this._charsToAnnounce+=d,d===`
64
64
  `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=c.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(d){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(d)||this._charsToConsume.push(d)}_refreshRows(d,u){this._liveRegionDebouncer.refresh(d,u,this._terminal.rows)}_renderRows(d,u){const w=this._terminal.buffer,L=w.lines.length.toString();for(let R=d;R<=u;R++){const D=w.lines.get(w.ydisp+R),k=[],M=(D==null?void 0:D.translateToString(!0,void 0,void 0,k))||"",W=(w.ydisp+R+1).toString(),z=this._rowElements[R];z&&(M.length===0?(z.innerText=" ",this._rowColumns.set(z,[0,1])):(z.textContent=M,this._rowColumns.set(z,k)),z.setAttribute("aria-posinset",W),z.setAttribute("aria-setsize",L))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(d,u){const w=d.target,L=this._rowElements[u===0?1:this._rowElements.length-2];if(w.getAttribute("aria-posinset")===(u===0?"1":`${this._terminal.buffer.lines.length}`)||d.relatedTarget!==L)return;let R,D;if(u===0?(R=w,D=this._rowElements.pop(),this._rowContainer.removeChild(D)):(R=this._rowElements.shift(),D=w,this._rowContainer.removeChild(R)),R.removeEventListener("focus",this._topBoundaryFocusListener),D.removeEventListener("focus",this._bottomBoundaryFocusListener),u===0){const k=this._createAccessibilityTreeNode();this._rowElements.unshift(k),this._rowContainer.insertAdjacentElement("afterbegin",k)}else{const k=this._createAccessibilityTreeNode();this._rowElements.push(k),this._rowContainer.appendChild(k)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(u===0?-1:1),this._rowElements[u===0?1:this._rowElements.length-2].focus(),d.preventDefault(),d.stopImmediatePropagation()}_handleSelectionChange(){var M;if(this._rowElements.length===0)return;const d=document.getSelection();if(!d)return;if(d.isCollapsed)return void(this._rowContainer.contains(d.anchorNode)&&this._terminal.clearSelection());if(!d.anchorNode||!d.focusNode)return void console.error("anchorNode and/or focusNode are null");let u={node:d.anchorNode,offset:d.anchorOffset},w={node:d.focusNode,offset:d.focusOffset};if((u.node.compareDocumentPosition(w.node)&Node.DOCUMENT_POSITION_PRECEDING||u.node===w.node&&u.offset>w.offset)&&([u,w]=[w,u]),u.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(u={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(u.node))return;const L=this._rowElements.slice(-1)[0];if(w.node.compareDocumentPosition(L)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(w={node:L,offset:((M=L.textContent)==null?void 0:M.length)??0}),!this._rowContainer.contains(w.node))return;const R=({node:W,offset:z})=>{const j=W instanceof Text?W.parentNode:W;let N=parseInt(j==null?void 0:j.getAttribute("aria-posinset"),10)-1;if(isNaN(N))return console.warn("row is invalid. Race condition?"),null;const I=this._rowColumns.get(j);if(!I)return console.warn("columns is null. Race condition?"),null;let q=z<I.length?I[z]:I.slice(-1)[0]+1;return q>=this._terminal.cols&&(++N,q=0),{row:N,column:q}},D=R(u),k=R(w);if(D&&k){if(D.row>k.row||D.row===k.row&&D.column>=k.column)throw new Error("invalid range");this._terminal.select(D.column,D.row,(k.row-D.row)*this._terminal.cols-D.column+k.column)}}_handleResize(d){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let u=this._rowContainer.children.length;u<this._terminal.rows;u++)this._rowElements[u]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[u]);for(;this._rowElements.length>d;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const d=this._coreBrowserService.mainDocument.createElement("div");return d.setAttribute("role","listitem"),d.tabIndex=-1,this._refreshRowDimensions(d),d}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let d=0;d<this._terminal.rows;d++)this._refreshRowDimensions(this._rowElements[d])}}_refreshRowDimensions(d){d.style.height=`${this._renderService.dimensions.css.cell.height}px`}};a.AccessibilityManager=p=_([v(1,x.IInstantiationService),v(2,b.ICoreBrowserService),v(3,b.IRenderService)],p)},3614:(y,a)=>{function l(m){return m.replace(/\r?\n/g,"\r")}function _(m,C){return C?"\x1B[200~"+m+"\x1B[201~":m}function v(m,C,b,x){m=_(m=l(m),b.decPrivateModes.bracketedPasteMode&&x.rawOptions.ignoreBracketedPasteMode!==!0),b.triggerDataEvent(m,!0),C.value=""}function c(m,C,b){const x=b.getBoundingClientRect(),f=m.clientX-x.left-10,p=m.clientY-x.top-10;C.style.width="20px",C.style.height="20px",C.style.left=`${f}px`,C.style.top=`${p}px`,C.style.zIndex="1000",C.focus()}Object.defineProperty(a,"__esModule",{value:!0}),a.rightClickHandler=a.moveTextAreaUnderMouseCursor=a.paste=a.handlePasteEvent=a.copyHandler=a.bracketTextForPaste=a.prepareTextForTerminal=void 0,a.prepareTextForTerminal=l,a.bracketTextForPaste=_,a.copyHandler=function(m,C){m.clipboardData&&m.clipboardData.setData("text/plain",C.selectionText),m.preventDefault()},a.handlePasteEvent=function(m,C,b,x){m.stopPropagation(),m.clipboardData&&v(m.clipboardData.getData("text/plain"),C,b,x)},a.paste=v,a.moveTextAreaUnderMouseCursor=c,a.rightClickHandler=function(m,C,b,x,f){c(m,C,b),f&&x.rightClickSelect(m),C.value=x.selectionText,C.select()}},7239:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ColorContrastCache=void 0;const _=l(1505);a.ColorContrastCache=class{constructor(){this._color=new _.TwoKeyMap,this._css=new _.TwoKeyMap}setCss(v,c,m){this._css.set(v,c,m)}getCss(v,c){return this._css.get(v,c)}setColor(v,c,m){this._color.set(v,c,m)}getColor(v,c){return this._color.get(v,c)}clear(){this._color.clear(),this._css.clear()}}},3656:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.addDisposableDomListener=void 0,a.addDisposableDomListener=function(l,_,v,c){l.addEventListener(_,v,c);let m=!1;return{dispose:()=>{m||(m=!0,l.removeEventListener(_,v,c))}}}},3551:function(y,a,l){var _=this&&this.__decorate||function(p,d,u,w){var L,R=arguments.length,D=R<3?d:w===null?w=Object.getOwnPropertyDescriptor(d,u):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(p,d,u,w);else for(var k=p.length-1;k>=0;k--)(L=p[k])&&(D=(R<3?L(D):R>3?L(d,u,D):L(d,u))||D);return R>3&&D&&Object.defineProperty(d,u,D),D},v=this&&this.__param||function(p,d){return function(u,w){d(u,w,p)}};Object.defineProperty(a,"__esModule",{value:!0}),a.Linkifier=void 0;const c=l(3656),m=l(8460),C=l(844),b=l(2585),x=l(4725);let f=a.Linkifier=class extends C.Disposable{get currentLink(){return this._currentLink}constructor(p,d,u,w,L){super(),this._element=p,this._mouseService=d,this._renderService=u,this._bufferService=w,this._linkProviderService=L,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new m.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new m.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,C.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,C.toDisposable)((()=>{var R;this._lastMouseEvent=void 0,(R=this._activeProviderReplies)==null||R.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,c.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,c.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,c.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,c.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(p){this._lastMouseEvent=p;const d=this._positionFromMouseEvent(p,this._element,this._mouseService);if(!d)return;this._isMouseOut=!1;const u=p.composedPath();for(let w=0;w<u.length;w++){const L=u[w];if(L.classList.contains("xterm"))break;if(L.classList.contains("xterm-hover"))return}this._lastBufferCell&&d.x===this._lastBufferCell.x&&d.y===this._lastBufferCell.y||(this._handleHover(d),this._lastBufferCell=d)}_handleHover(p){if(this._activeLine!==p.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(p,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,p)||(this._clearCurrentLink(),this._askForLink(p,!0))}_askForLink(p,d){var w,L;this._activeProviderReplies&&d||((w=this._activeProviderReplies)==null||w.forEach((R=>{R==null||R.forEach((D=>{D.link.dispose&&D.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=p.y);let u=!1;for(const[R,D]of this._linkProviderService.linkProviders.entries())d?(L=this._activeProviderReplies)!=null&&L.get(R)&&(u=this._checkLinkProviderResult(R,p,u)):D.provideLinks(p.y,(k=>{var W,z;if(this._isMouseOut)return;const M=k==null?void 0:k.map((j=>({link:j})));(W=this._activeProviderReplies)==null||W.set(R,M),u=this._checkLinkProviderResult(R,p,u),((z=this._activeProviderReplies)==null?void 0:z.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(p.y,this._activeProviderReplies)}))}_removeIntersectingLinks(p,d){const u=new Set;for(let w=0;w<d.size;w++){const L=d.get(w);if(L)for(let R=0;R<L.length;R++){const D=L[R],k=D.link.range.start.y<p?0:D.link.range.start.x,M=D.link.range.end.y>p?this._bufferService.cols:D.link.range.end.x;for(let W=k;W<=M;W++){if(u.has(W)){L.splice(R--,1);break}u.add(W)}}}}_checkLinkProviderResult(p,d,u){var R;if(!this._activeProviderReplies)return u;const w=this._activeProviderReplies.get(p);let L=!1;for(let D=0;D<p;D++)this._activeProviderReplies.has(D)&&!this._activeProviderReplies.get(D)||(L=!0);if(!L&&w){const D=w.find((k=>this._linkAtPosition(k.link,d)));D&&(u=!0,this._handleNewLink(D))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!u)for(let D=0;D<this._activeProviderReplies.size;D++){const k=(R=this._activeProviderReplies.get(D))==null?void 0:R.find((M=>this._linkAtPosition(M.link,d)));if(k){u=!0,this._handleNewLink(k);break}}return u}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(p){if(!this._currentLink)return;const d=this._positionFromMouseEvent(p,this._element,this._mouseService);d&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,d)&&this._currentLink.link.activate(p,this._currentLink.link.text)}_clearCurrentLink(p,d){this._currentLink&&this._lastMouseEvent&&(!p||!d||this._currentLink.link.range.start.y>=p&&this._currentLink.link.range.end.y<=d)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,C.disposeArray)(this._linkCacheDisposables))}_handleNewLink(p){if(!this._lastMouseEvent)return;const d=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);d&&this._linkAtPosition(p.link,d)&&(this._currentLink=p,this._currentLink.state={decorations:{underline:p.link.decorations===void 0||p.link.decorations.underline,pointerCursor:p.link.decorations===void 0||p.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,p.link,this._lastMouseEvent),p.link.decorations={},Object.defineProperties(p.link.decorations,{pointerCursor:{get:()=>{var u,w;return(w=(u=this._currentLink)==null?void 0:u.state)==null?void 0:w.decorations.pointerCursor},set:u=>{var w;(w=this._currentLink)!=null&&w.state&&this._currentLink.state.decorations.pointerCursor!==u&&(this._currentLink.state.decorations.pointerCursor=u,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",u))}},underline:{get:()=>{var u,w;return(w=(u=this._currentLink)==null?void 0:u.state)==null?void 0:w.decorations.underline},set:u=>{var w,L,R;(w=this._currentLink)!=null&&w.state&&((R=(L=this._currentLink)==null?void 0:L.state)==null?void 0:R.decorations.underline)!==u&&(this._currentLink.state.decorations.underline=u,this._currentLink.state.isHovered&&this._fireUnderlineEvent(p.link,u))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((u=>{if(!this._currentLink)return;const w=u.start===0?0:u.start+1+this._bufferService.buffer.ydisp,L=this._bufferService.buffer.ydisp+1+u.end;if(this._currentLink.link.range.start.y>=w&&this._currentLink.link.range.end.y<=L&&(this._clearCurrentLink(w,L),this._lastMouseEvent)){const R=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);R&&this._askForLink(R,!1)}}))))}_linkHover(p,d,u){var w;(w=this._currentLink)!=null&&w.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(d,!0),this._currentLink.state.decorations.pointerCursor&&p.classList.add("xterm-cursor-pointer")),d.hover&&d.hover(u,d.text)}_fireUnderlineEvent(p,d){const u=p.range,w=this._bufferService.buffer.ydisp,L=this._createLinkUnderlineEvent(u.start.x-1,u.start.y-w-1,u.end.x,u.end.y-w-1,void 0);(d?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(L)}_linkLeave(p,d,u){var w;(w=this._currentLink)!=null&&w.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(d,!1),this._currentLink.state.decorations.pointerCursor&&p.classList.remove("xterm-cursor-pointer")),d.leave&&d.leave(u,d.text)}_linkAtPosition(p,d){const u=p.range.start.y*this._bufferService.cols+p.range.start.x,w=p.range.end.y*this._bufferService.cols+p.range.end.x,L=d.y*this._bufferService.cols+d.x;return u<=L&&L<=w}_positionFromMouseEvent(p,d,u){const w=u.getCoords(p,d,this._bufferService.cols,this._bufferService.rows);if(w)return{x:w[0],y:w[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(p,d,u,w,L){return{x1:p,y1:d,x2:u,y2:w,cols:this._bufferService.cols,fg:L}}};a.Linkifier=f=_([v(1,x.IMouseService),v(2,x.IRenderService),v(3,b.IBufferService),v(4,x.ILinkProviderService)],f)},9042:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.tooMuchOutput=a.promptLabel=void 0,a.promptLabel="Terminal input",a.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(y,a,l){var _=this&&this.__decorate||function(x,f,p,d){var u,w=arguments.length,L=w<3?f:d===null?d=Object.getOwnPropertyDescriptor(f,p):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(x,f,p,d);else for(var R=x.length-1;R>=0;R--)(u=x[R])&&(L=(w<3?u(L):w>3?u(f,p,L):u(f,p))||L);return w>3&&L&&Object.defineProperty(f,p,L),L},v=this&&this.__param||function(x,f){return function(p,d){f(p,d,x)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OscLinkProvider=void 0;const c=l(511),m=l(2585);let C=a.OscLinkProvider=class{constructor(x,f,p){this._bufferService=x,this._optionsService=f,this._oscLinkService=p}provideLinks(x,f){var M;const p=this._bufferService.buffer.lines.get(x-1);if(!p)return void f(void 0);const d=[],u=this._optionsService.rawOptions.linkHandler,w=new c.CellData,L=p.getTrimmedLength();let R=-1,D=-1,k=!1;for(let W=0;W<L;W++)if(D!==-1||p.hasContent(W)){if(p.loadCell(W,w),w.hasExtendedAttrs()&&w.extended.urlId){if(D===-1){D=W,R=w.extended.urlId;continue}k=w.extended.urlId!==R}else D!==-1&&(k=!0);if(k||D!==-1&&W===L-1){const z=(M=this._oscLinkService.getLinkData(R))==null?void 0:M.uri;if(z){const j={start:{x:D+1,y:x},end:{x:W+(k||W!==L-1?0:1),y:x}};let N=!1;if(!(u!=null&&u.allowNonHttpProtocols))try{const I=new URL(z);["http:","https:"].includes(I.protocol)||(N=!0)}catch{N=!0}N||d.push({text:z,range:j,activate:(I,q)=>u?u.activate(I,q,j):b(0,q),hover:(I,q)=>{var U;return(U=u==null?void 0:u.hover)==null?void 0:U.call(u,I,q,j)},leave:(I,q)=>{var U;return(U=u==null?void 0:u.leave)==null?void 0:U.call(u,I,q,j)}})}k=!1,w.hasExtendedAttrs()&&w.extended.urlId?(D=W,R=w.extended.urlId):(D=-1,R=-1)}}f(d)}};function b(x,f){if(confirm(`Do you want to navigate to ${f}?
65
65
 
66
- WARNING: This link could potentially be dangerous`)){const p=window.open();if(p){try{p.opener=null}catch{}p.location.href=f}else console.warn("Opening link blocked as opener could not be cleared")}}a.OscLinkProvider=C=_([v(0,m.IBufferService),v(1,m.IOptionsService),v(2,m.IOscLinkService)],C)},6193:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.RenderDebouncer=void 0,a.RenderDebouncer=class{constructor(l,_){this._renderCallback=l,this._coreBrowserService=_,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(l){return this._refreshCallbacks.push(l),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(l,_,v){this._rowCount=v,l=l!==void 0?l:0,_=_!==void 0?_:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,l):l,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,_):_,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)return void this._runRefreshCallbacks();const l=Math.max(this._rowStart,0),_=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(l,_),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const l of this._refreshCallbacks)l(0);this._refreshCallbacks=[]}}},3236:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Terminal=void 0;const _=l(3614),v=l(3656),c=l(3551),m=l(9042),C=l(3730),b=l(1680),x=l(3107),f=l(5744),p=l(2950),d=l(1296),u=l(428),w=l(4269),L=l(5114),R=l(8934),D=l(3230),k=l(9312),M=l(4725),W=l(6731),z=l(8055),j=l(8969),N=l(8460),I=l(844),q=l(6114),U=l(8437),K=l(2584),V=l(7399),T=l(5941),B=l(9074),P=l(2585),F=l(5435),G=l(4567),Z=l(779);class ie extends j.CoreTerminal{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}constructor(X={}){super(X),this.browser=q,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new I.MutableDisposable),this._onCursorMove=this.register(new N.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new N.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new N.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new N.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new N.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new N.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new N.EventEmitter),this._onBlur=this.register(new N.EventEmitter),this._onA11yCharEmitter=this.register(new N.EventEmitter),this._onA11yTabEmitter=this.register(new N.EventEmitter),this._onWillOpen=this.register(new N.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(B.DecorationService),this._instantiationService.setService(P.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Z.LinkProviderService),this._instantiationService.setService(M.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(C.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((H,re)=>this.refresh(H,re)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((H=>this._reportWindowsOptions(H)))),this.register(this._inputHandler.onColor((H=>this._handleColorEvent(H)))),this.register((0,N.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,N.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,N.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,N.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((H=>this._afterResize(H.cols,H.rows)))),this.register((0,I.toDisposable)((()=>{var H,re;this._customKeyEventHandler=void 0,(re=(H=this.element)==null?void 0:H.parentNode)==null||re.removeChild(this.element)})))}_handleColorEvent(X){if(this._themeService)for(const H of X){let re,te="";switch(H.index){case 256:re="foreground",te="10";break;case 257:re="background",te="11";break;case 258:re="cursor",te="12";break;default:re="ansi",te="4;"+H.index}switch(H.type){case 0:const ce=z.color.toColorRGB(re==="ansi"?this._themeService.colors.ansi[H.index]:this._themeService.colors[re]);this.coreService.triggerDataEvent(`${K.C0.ESC}]${te};${(0,T.toRgbString)(ce)}${K.C1_ESCAPED.ST}`);break;case 1:if(re==="ansi")this._themeService.modifyColors((le=>le.ansi[H.index]=z.channels.toColor(...H.color)));else{const le=re;this._themeService.modifyColors((pe=>pe[le]=z.channels.toColor(...H.color)))}break;case 2:this._themeService.restoreColor(H.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(X){X?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(G.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(X){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(K.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var X;return(X=this.textarea)==null?void 0:X.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(K.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const X=this.buffer.ybase+this.buffer.y,H=this.buffer.lines.get(X);if(!H)return;const re=Math.min(this.buffer.x,this.cols-1),te=this._renderService.dimensions.css.cell.height,ce=H.getWidth(re),le=this._renderService.dimensions.css.cell.width*ce,pe=this.buffer.y*this._renderService.dimensions.css.cell.height,Se=re*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Se+"px",this.textarea.style.top=pe+"px",this.textarea.style.width=le+"px",this.textarea.style.height=te+"px",this.textarea.style.lineHeight=te+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,v.addDisposableDomListener)(this.element,"copy",(H=>{this.hasSelection()&&(0,_.copyHandler)(H,this._selectionService)})));const X=H=>(0,_.handlePasteEvent)(H,this.textarea,this.coreService,this.optionsService);this.register((0,v.addDisposableDomListener)(this.textarea,"paste",X)),this.register((0,v.addDisposableDomListener)(this.element,"paste",X)),q.isFirefox?this.register((0,v.addDisposableDomListener)(this.element,"mousedown",(H=>{H.button===2&&(0,_.rightClickHandler)(H,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,v.addDisposableDomListener)(this.element,"contextmenu",(H=>{(0,_.rightClickHandler)(H,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),q.isLinux&&this.register((0,v.addDisposableDomListener)(this.element,"auxclick",(H=>{H.button===1&&(0,_.moveTextAreaUnderMouseCursor)(H,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,v.addDisposableDomListener)(this.textarea,"keyup",(X=>this._keyUp(X)),!0)),this.register((0,v.addDisposableDomListener)(this.textarea,"keydown",(X=>this._keyDown(X)),!0)),this.register((0,v.addDisposableDomListener)(this.textarea,"keypress",(X=>this._keyPress(X)),!0)),this.register((0,v.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,v.addDisposableDomListener)(this.textarea,"compositionupdate",(X=>this._compositionHelper.compositionupdate(X)))),this.register((0,v.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,v.addDisposableDomListener)(this.textarea,"input",(X=>this._inputEvent(X)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(X){var re;if(!X)throw new Error("Terminal requires a parent element.");if(X.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((re=this.element)==null?void 0:re.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=X.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"),X.appendChild(this.element);const H=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),H.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,v.addDisposableDomListener)(this.screenElement,"mousemove",(te=>this.updateCursorStyle(te)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),H.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",m.promptLabel),q.isChromeOS||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._coreBrowserService=this.register(this._instantiationService.createInstance(L.CoreBrowserService,this.textarea,X.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(M.ICoreBrowserService,this._coreBrowserService),this.register((0,v.addDisposableDomListener)(this.textarea,"focus",(te=>this._handleTextAreaFocus(te)))),this.register((0,v.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(u.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(M.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(W.ThemeService),this._instantiationService.setService(M.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(w.CharacterJoinerService),this._instantiationService.setService(M.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(D.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(M.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((te=>this._onRender.fire(te)))),this.onResize((te=>this._renderService.resize(te.cols,te.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(p.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(R.MouseService),this._instantiationService.setService(M.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(c.Linkifier,this.screenElement)),this.element.appendChild(H);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(b.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((te=>this.scrollLines(te.amount,te.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),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.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(k.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(M.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((te=>this.scrollLines(te.amount,te.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((te=>this._renderService.handleSelectionChanged(te.start,te.end,te.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((te=>{this.textarea.value=te,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((te=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,v.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(x.BufferDecorationRenderer,this.screenElement)),this.register((0,v.addDisposableDomListener)(this.element,"mousedown",(te=>this._selectionService.handleMouseDown(te)))),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(G.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(te=>this._handleScreenReaderModeOptionChange(te)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(f.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(te=>{!this._overviewRulerRenderer&&te&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(f.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(d.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const X=this,H=this.element;function re(le){const pe=X._mouseService.getMouseReportCoords(le,X.screenElement);if(!pe)return!1;let Se,be;switch(le.overrideType||le.type){case"mousemove":be=32,le.buttons===void 0?(Se=3,le.button!==void 0&&(Se=le.button<3?le.button:3)):Se=1&le.buttons?0:4&le.buttons?1:2&le.buttons?2:3;break;case"mouseup":be=0,Se=le.button<3?le.button:3;break;case"mousedown":be=1,Se=le.button<3?le.button:3;break;case"wheel":if(X._customWheelEventHandler&&X._customWheelEventHandler(le)===!1||X.viewport.getLinesScrolled(le)===0)return!1;be=le.deltaY<0?0:1,Se=4;break;default:return!1}return!(be===void 0||Se===void 0||Se>4)&&X.coreMouseService.triggerMouseEvent({col:pe.col,row:pe.row,x:pe.x,y:pe.y,button:Se,action:be,ctrl:le.ctrlKey,alt:le.altKey,shift:le.shiftKey})}const te={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ce={mouseup:le=>(re(le),le.buttons||(this._document.removeEventListener("mouseup",te.mouseup),te.mousedrag&&this._document.removeEventListener("mousemove",te.mousedrag)),this.cancel(le)),wheel:le=>(re(le),this.cancel(le,!0)),mousedrag:le=>{le.buttons&&re(le)},mousemove:le=>{le.buttons||re(le)}};this.register(this.coreMouseService.onProtocolChange((le=>{le?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(le)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&le?te.mousemove||(H.addEventListener("mousemove",ce.mousemove),te.mousemove=ce.mousemove):(H.removeEventListener("mousemove",te.mousemove),te.mousemove=null),16&le?te.wheel||(H.addEventListener("wheel",ce.wheel,{passive:!1}),te.wheel=ce.wheel):(H.removeEventListener("wheel",te.wheel),te.wheel=null),2&le?te.mouseup||(te.mouseup=ce.mouseup):(this._document.removeEventListener("mouseup",te.mouseup),te.mouseup=null),4&le?te.mousedrag||(te.mousedrag=ce.mousedrag):(this._document.removeEventListener("mousemove",te.mousedrag),te.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,v.addDisposableDomListener)(H,"mousedown",(le=>{if(le.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(le))return re(le),te.mouseup&&this._document.addEventListener("mouseup",te.mouseup),te.mousedrag&&this._document.addEventListener("mousemove",te.mousedrag),this.cancel(le)}))),this.register((0,v.addDisposableDomListener)(H,"wheel",(le=>{if(!te.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(le)===!1)return!1;if(!this.buffer.hasScrollback){const pe=this.viewport.getLinesScrolled(le);if(pe===0)return;const Se=K.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(le.deltaY<0?"A":"B");let be="";for(let ue=0;ue<Math.abs(pe);ue++)be+=Se;return this.coreService.triggerDataEvent(be,!0),this.cancel(le,!0)}return this.viewport.handleWheel(le)?this.cancel(le):void 0}}),{passive:!1})),this.register((0,v.addDisposableDomListener)(H,"touchstart",(le=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(le),this.cancel(le)}),{passive:!0})),this.register((0,v.addDisposableDomListener)(H,"touchmove",(le=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(le)?void 0:this.cancel(le)}),{passive:!1}))}refresh(X,H){var re;(re=this._renderService)==null||re.refreshRows(X,H)}updateCursorStyle(X){var H;(H=this._selectionService)!=null&&H.shouldColumnSelect(X)?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(X,H,re=0){var te;re===1?(super.scrollLines(X,H,re),this.refresh(0,this.rows-1)):(te=this.viewport)==null||te.scrollLines(X)}paste(X){(0,_.paste)(X,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(X){this._customKeyEventHandler=X}attachCustomWheelEventHandler(X){this._customWheelEventHandler=X}registerLinkProvider(X){return this._linkProviderService.registerLinkProvider(X)}registerCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const H=this._characterJoinerService.register(X);return this.refresh(0,this.rows-1),H}deregisterCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(X)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(X){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+X)}registerDecoration(X){return this._decorationService.registerDecoration(X)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(X,H,re){this._selectionService.setSelection(X,H,re)}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 X;(X=this._selectionService)==null||X.clearSelection()}selectAll(){var X;(X=this._selectionService)==null||X.selectAll()}selectLines(X,H){var re;(re=this._selectionService)==null||re.selectLines(X,H)}_keyDown(X){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;const H=this.browser.isMac&&this.options.macOptionIsMeta&&X.altKey;if(!H&&!this._compositionHelper.keydown(X))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;H||X.key!=="Dead"&&X.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const re=(0,V.evaluateKeyboardEvent)(X,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(X),re.type===3||re.type===2){const te=this.rows-1;return this.scrollLines(re.type===2?-te:te),this.cancel(X,!0)}return re.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,X)||(re.cancel&&this.cancel(X,!0),!re.key||!!(X.key&&!X.ctrlKey&&!X.altKey&&!X.metaKey&&X.key.length===1&&X.key.charCodeAt(0)>=65&&X.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(re.key!==K.C0.ETX&&re.key!==K.C0.CR||(this.textarea.value=""),this._onKey.fire({key:re.key,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(re.key,!0),!this.optionsService.rawOptions.screenReaderMode||X.altKey||X.ctrlKey?this.cancel(X,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(X,H){const re=X.isMac&&!this.options.macOptionIsMeta&&H.altKey&&!H.ctrlKey&&!H.metaKey||X.isWindows&&H.altKey&&H.ctrlKey&&!H.metaKey||X.isWindows&&H.getModifierState("AltGraph");return H.type==="keypress"?re:re&&(!H.keyCode||H.keyCode>47)}_keyUp(X){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1||((function(H){return H.keyCode===16||H.keyCode===17||H.keyCode===18})(X)||this.focus(),this.updateCursorStyle(X),this._keyPressHandled=!1)}_keyPress(X){let H;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;if(this.cancel(X),X.charCode)H=X.charCode;else if(X.which===null||X.which===void 0)H=X.keyCode;else{if(X.which===0||X.charCode===0)return!1;H=X.which}return!(!H||(X.altKey||X.ctrlKey||X.metaKey)&&!this._isThirdLevelShift(this.browser,X)||(H=String.fromCharCode(H),this._onKey.fire({key:H,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(H,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(X){if(X.data&&X.inputType==="insertText"&&(!X.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const H=X.data;return this.coreService.triggerDataEvent(H,!0),this.cancel(X),!0}return!1}resize(X,H){X!==this.cols||H!==this.rows?super.resize(X,H):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(X,H){var re,te;(re=this._charSizeService)==null||re.measure(),(te=this.viewport)==null||te.syncScrollArea(!0)}clear(){var X;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 H=1;H<this.rows;H++)this.buffer.lines.push(this.buffer.getBlankLine(U.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(X=this.viewport)==null||X.reset(),this.refresh(0,this.rows-1)}}reset(){var H,re;this.options.rows=this.rows,this.options.cols=this.cols;const X=this._customKeyEventHandler;this._setup(),super.reset(),(H=this._selectionService)==null||H.reset(),this._decorationService.reset(),(re=this.viewport)==null||re.reset(),this._customKeyEventHandler=X,this.refresh(0,this.rows-1)}clearTextureAtlas(){var X;(X=this._renderService)==null||X.clearTextureAtlas()}_reportFocus(){var X;(X=this.element)!=null&&X.classList.contains("focus")?this.coreService.triggerDataEvent(K.C0.ESC+"[I"):this.coreService.triggerDataEvent(K.C0.ESC+"[O")}_reportWindowsOptions(X){if(this._renderService)switch(X){case F.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const H=this._renderService.dimensions.css.canvas.width.toFixed(0),re=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${K.C0.ESC}[4;${re};${H}t`);break;case F.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const te=this._renderService.dimensions.css.cell.width.toFixed(0),ce=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${K.C0.ESC}[6;${ce};${te}t`)}}cancel(X,H){if(this.options.cancelEvents||H)return X.preventDefault(),X.stopPropagation(),!1}}a.Terminal=ie},9924:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.TimeBasedDebouncer=void 0,a.TimeBasedDebouncer=class{constructor(l,_=1e3){this._renderCallback=l,this._debounceThresholdMS=_,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(l,_,v){this._rowCount=v,l=l!==void 0?l:0,_=_!==void 0?_:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,l):l,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,_):_;const c=Date.now();if(c-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=c,this._innerRefresh();else if(!this._additionalRefreshRequested){const m=c-this._lastRefreshMs,C=this._debounceThresholdMS-m;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),C)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const l=Math.max(this._rowStart,0),_=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(l,_)}}},1680:function(y,a,l){var _=this&&this.__decorate||function(p,d,u,w){var L,R=arguments.length,D=R<3?d:w===null?w=Object.getOwnPropertyDescriptor(d,u):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(p,d,u,w);else for(var k=p.length-1;k>=0;k--)(L=p[k])&&(D=(R<3?L(D):R>3?L(d,u,D):L(d,u))||D);return R>3&&D&&Object.defineProperty(d,u,D),D},v=this&&this.__param||function(p,d){return function(u,w){d(u,w,p)}};Object.defineProperty(a,"__esModule",{value:!0}),a.Viewport=void 0;const c=l(3656),m=l(4725),C=l(8460),b=l(844),x=l(2585);let f=a.Viewport=class extends b.Disposable{constructor(p,d,u,w,L,R,D,k){super(),this._viewportElement=p,this._scrollArea=d,this._bufferService=u,this._optionsService=w,this._charSizeService=L,this._renderService=R,this._coreBrowserService=D,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new C.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,c.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((M=>this._activeBuffer=M.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((M=>this._renderDimensions=M))),this._handleThemeChange(k.colors),this.register(k.onChangeColors((M=>this._handleThemeChange(M)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(p){this._viewportElement.style.backgroundColor=p.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(p){if(p)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const d=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==d&&(this._lastRecordedBufferHeight=d,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const p=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==p&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=p),this._refreshAnimationFrame=null}syncScrollArea(p=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(p);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(p)}_handleScroll(p){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const d=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:d,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const p=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(p*(this._smoothScrollState.target-this._smoothScrollState.origin)),p<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(p,d){const u=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(d<0&&this._viewportElement.scrollTop!==0||d>0&&u<this._lastRecordedBufferHeight)||(p.cancelable&&p.preventDefault(),!1)}handleWheel(p){const d=this._getPixelsScrolled(p);return d!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+d:this._smoothScrollState.target+=d,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=d,this._bubbleScroll(p,d))}scrollLines(p){if(p!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const d=p*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+d,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:p,suppressScrollEvent:!1})}_getPixelsScrolled(p){if(p.deltaY===0||p.shiftKey)return 0;let d=this._applyScrollModifier(p.deltaY,p);return p.deltaMode===WheelEvent.DOM_DELTA_LINE?d*=this._currentRowHeight:p.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(d*=this._currentRowHeight*this._bufferService.rows),d}getBufferElements(p,d){var k;let u,w="";const L=[],R=d??this._bufferService.buffer.lines.length,D=this._bufferService.buffer.lines;for(let M=p;M<R;M++){const W=D.get(M);if(!W)continue;const z=(k=D.get(M+1))==null?void 0:k.isWrapped;if(w+=W.translateToString(!z),!z||M===D.length-1){const j=document.createElement("div");j.textContent=w,L.push(j),w.length>0&&(u=j),w=""}}return{bufferElements:L,cursorElement:u}}getLinesScrolled(p){if(p.deltaY===0||p.shiftKey)return 0;let d=this._applyScrollModifier(p.deltaY,p);return p.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(d/=this._currentRowHeight+0,this._wheelPartialScroll+=d,d=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):p.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(d*=this._bufferService.rows),d}_applyScrollModifier(p,d){const u=this._optionsService.rawOptions.fastScrollModifier;return u==="alt"&&d.altKey||u==="ctrl"&&d.ctrlKey||u==="shift"&&d.shiftKey?p*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:p*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(p){this._lastTouchY=p.touches[0].pageY}handleTouchMove(p){const d=this._lastTouchY-p.touches[0].pageY;return this._lastTouchY=p.touches[0].pageY,d!==0&&(this._viewportElement.scrollTop+=d,this._bubbleScroll(p,d))}};a.Viewport=f=_([v(2,x.IBufferService),v(3,x.IOptionsService),v(4,m.ICharSizeService),v(5,m.IRenderService),v(6,m.ICoreBrowserService),v(7,m.IThemeService)],f)},3107:function(y,a,l){var _=this&&this.__decorate||function(x,f,p,d){var u,w=arguments.length,L=w<3?f:d===null?d=Object.getOwnPropertyDescriptor(f,p):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(x,f,p,d);else for(var R=x.length-1;R>=0;R--)(u=x[R])&&(L=(w<3?u(L):w>3?u(f,p,L):u(f,p))||L);return w>3&&L&&Object.defineProperty(f,p,L),L},v=this&&this.__param||function(x,f){return function(p,d){f(p,d,x)}};Object.defineProperty(a,"__esModule",{value:!0}),a.BufferDecorationRenderer=void 0;const c=l(4725),m=l(844),C=l(2585);let b=a.BufferDecorationRenderer=class extends m.Disposable{constructor(x,f,p,d,u){super(),this._screenElement=x,this._bufferService=f,this._coreBrowserService=p,this._decorationService=d,this._renderService=u,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((w=>this._removeDecoration(w)))),this.register((0,m.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const x of this._decorationService.decorations)this._renderDecoration(x);this._dimensionsChanged=!1}_renderDecoration(x){this._refreshStyle(x),this._dimensionsChanged&&this._refreshXPosition(x)}_createElement(x){var d;const f=this._coreBrowserService.mainDocument.createElement("div");f.classList.add("xterm-decoration"),f.classList.toggle("xterm-decoration-top-layer",((d=x==null?void 0:x.options)==null?void 0:d.layer)==="top"),f.style.width=`${Math.round((x.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,f.style.height=(x.options.height||1)*this._renderService.dimensions.css.cell.height+"px",f.style.top=(x.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",f.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const p=x.options.x??0;return p&&p>this._bufferService.cols&&(f.style.display="none"),this._refreshXPosition(x,f),f}_refreshStyle(x){const f=x.marker.line-this._bufferService.buffers.active.ydisp;if(f<0||f>=this._bufferService.rows)x.element&&(x.element.style.display="none",x.onRenderEmitter.fire(x.element));else{let p=this._decorationElements.get(x);p||(p=this._createElement(x),x.element=p,this._decorationElements.set(x,p),this._container.appendChild(p),x.onDispose((()=>{this._decorationElements.delete(x),p.remove()}))),p.style.top=f*this._renderService.dimensions.css.cell.height+"px",p.style.display=this._altBufferIsActive?"none":"block",x.onRenderEmitter.fire(p)}}_refreshXPosition(x,f=x.element){if(!f)return;const p=x.options.x??0;(x.options.anchor||"left")==="right"?f.style.right=p?p*this._renderService.dimensions.css.cell.width+"px":"":f.style.left=p?p*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(x){var f;(f=this._decorationElements.get(x))==null||f.remove(),this._decorationElements.delete(x),x.dispose()}};a.BufferDecorationRenderer=b=_([v(1,C.IBufferService),v(2,c.ICoreBrowserService),v(3,C.IDecorationService),v(4,c.IRenderService)],b)},5871:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ColorZoneStore=void 0,a.ColorZoneStore=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(l){if(l.options.overviewRulerOptions){for(const _ of this._zones)if(_.color===l.options.overviewRulerOptions.color&&_.position===l.options.overviewRulerOptions.position){if(this._lineIntersectsZone(_,l.marker.line))return;if(this._lineAdjacentToZone(_,l.marker.line,l.options.overviewRulerOptions.position))return void this._addLineToZone(_,l.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=l.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=l.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=l.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=l.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:l.options.overviewRulerOptions.color,position:l.options.overviewRulerOptions.position,startBufferLine:l.marker.line,endBufferLine:l.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(l){this._linePadding=l}_lineIntersectsZone(l,_){return _>=l.startBufferLine&&_<=l.endBufferLine}_lineAdjacentToZone(l,_,v){return _>=l.startBufferLine-this._linePadding[v||"full"]&&_<=l.endBufferLine+this._linePadding[v||"full"]}_addLineToZone(l,_){l.startBufferLine=Math.min(l.startBufferLine,_),l.endBufferLine=Math.max(l.endBufferLine,_)}}},5744:function(y,a,l){var _=this&&this.__decorate||function(u,w,L,R){var D,k=arguments.length,M=k<3?w:R===null?R=Object.getOwnPropertyDescriptor(w,L):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(u,w,L,R);else for(var W=u.length-1;W>=0;W--)(D=u[W])&&(M=(k<3?D(M):k>3?D(w,L,M):D(w,L))||M);return k>3&&M&&Object.defineProperty(w,L,M),M},v=this&&this.__param||function(u,w){return function(L,R){w(L,R,u)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OverviewRulerRenderer=void 0;const c=l(5871),m=l(4725),C=l(844),b=l(2585),x={full:0,left:0,center:0,right:0},f={full:0,left:0,center:0,right:0},p={full:0,left:0,center:0,right:0};let d=a.OverviewRulerRenderer=class extends C.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(u,w,L,R,D,k,M){var z;super(),this._viewportElement=u,this._screenElement=w,this._bufferService=L,this._decorationService=R,this._renderService=D,this._optionsService=k,this._coreBrowserService=M,this._colorZoneStore=new c.ColorZoneStore,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(),(z=this._viewportElement.parentElement)==null||z.insertBefore(this._canvas,this._viewportElement);const W=this._canvas.getContext("2d");if(!W)throw new Error("Ctx cannot be null");this._ctx=W,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,C.toDisposable)((()=>{var j;(j=this._canvas)==null||j.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){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())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const u=Math.floor(this._canvas.width/3),w=Math.ceil(this._canvas.width/3);f.full=this._canvas.width,f.left=u,f.center=w,f.right=u,this._refreshDrawHeightConstants(),p.full=0,p.left=0,p.center=f.left,p.right=f.left+f.center}_refreshDrawHeightConstants(){x.full=Math.round(2*this._coreBrowserService.dpr);const u=this._canvas.height/this._bufferService.buffer.lines.length,w=Math.round(Math.max(Math.min(u,12),6)*this._coreBrowserService.dpr);x.left=w,x.center=w,x.right=w}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*x.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*x.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*x.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*x.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(const w of this._decorationService.decorations)this._colorZoneStore.addDecoration(w);this._ctx.lineWidth=1;const u=this._colorZoneStore.zones;for(const w of u)w.position!=="full"&&this._renderColorZone(w);for(const w of u)w.position==="full"&&this._renderColorZone(w);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(u){this._ctx.fillStyle=u.color,this._ctx.fillRect(p[u.position||"full"],Math.round((this._canvas.height-1)*(u.startBufferLine/this._bufferService.buffers.active.lines.length)-x[u.position||"full"]/2),f[u.position||"full"],Math.round((this._canvas.height-1)*((u.endBufferLine-u.startBufferLine)/this._bufferService.buffers.active.lines.length)+x[u.position||"full"]))}_queueRefresh(u,w){this._shouldUpdateDimensions=u||this._shouldUpdateDimensions,this._shouldUpdateAnchor=w||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};a.OverviewRulerRenderer=d=_([v(2,b.IBufferService),v(3,b.IDecorationService),v(4,m.IRenderService),v(5,b.IOptionsService),v(6,m.ICoreBrowserService)],d)},2950:function(y,a,l){var _=this&&this.__decorate||function(x,f,p,d){var u,w=arguments.length,L=w<3?f:d===null?d=Object.getOwnPropertyDescriptor(f,p):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(x,f,p,d);else for(var R=x.length-1;R>=0;R--)(u=x[R])&&(L=(w<3?u(L):w>3?u(f,p,L):u(f,p))||L);return w>3&&L&&Object.defineProperty(f,p,L),L},v=this&&this.__param||function(x,f){return function(p,d){f(p,d,x)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CompositionHelper=void 0;const c=l(4725),m=l(2585),C=l(2584);let b=a.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(x,f,p,d,u,w){this._textarea=x,this._compositionView=f,this._bufferService=p,this._optionsService=d,this._coreService=u,this._renderService=w,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(x){this._compositionView.textContent=x.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(x){if(this._isComposing||this._isSendingComposition){if(x.keyCode===229||x.keyCode===16||x.keyCode===17||x.keyCode===18)return!1;this._finalizeComposition(!1)}return x.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(x){if(this._compositionView.classList.remove("active"),this._isComposing=!1,x){const f={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let p;this._isSendingComposition=!1,f.start+=this._dataAlreadySent.length,p=this._isComposing?this._textarea.value.substring(f.start,f.end):this._textarea.value.substring(f.start),p.length>0&&this._coreService.triggerDataEvent(p,!0)}}),0)}else{this._isSendingComposition=!1;const f=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(f,!0)}}_handleAnyTextareaChanges(){const x=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const f=this._textarea.value,p=f.replace(x,"");this._dataAlreadySent=p,f.length>x.length?this._coreService.triggerDataEvent(p,!0):f.length<x.length?this._coreService.triggerDataEvent(`${C.C0.DEL}`,!0):f.length===x.length&&f!==x&&this._coreService.triggerDataEvent(f,!0)}}),0)}updateCompositionElements(x){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const f=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),p=this._renderService.dimensions.css.cell.height,d=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,u=f*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=u+"px",this._compositionView.style.top=d+"px",this._compositionView.style.height=p+"px",this._compositionView.style.lineHeight=p+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const w=this._compositionView.getBoundingClientRect();this._textarea.style.left=u+"px",this._textarea.style.top=d+"px",this._textarea.style.width=Math.max(w.width,1)+"px",this._textarea.style.height=Math.max(w.height,1)+"px",this._textarea.style.lineHeight=w.height+"px"}x||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};a.CompositionHelper=b=_([v(2,m.IBufferService),v(3,m.IOptionsService),v(4,m.ICoreService),v(5,c.IRenderService)],b)},9806:(y,a)=>{function l(_,v,c){const m=c.getBoundingClientRect(),C=_.getComputedStyle(c),b=parseInt(C.getPropertyValue("padding-left")),x=parseInt(C.getPropertyValue("padding-top"));return[v.clientX-m.left-b,v.clientY-m.top-x]}Object.defineProperty(a,"__esModule",{value:!0}),a.getCoords=a.getCoordsRelativeToElement=void 0,a.getCoordsRelativeToElement=l,a.getCoords=function(_,v,c,m,C,b,x,f,p){if(!b)return;const d=l(_,v,c);return d?(d[0]=Math.ceil((d[0]+(p?x/2:0))/x),d[1]=Math.ceil(d[1]/f),d[0]=Math.min(Math.max(d[0],1),m+(p?1:0)),d[1]=Math.min(Math.max(d[1],1),C),d):void 0}},9504:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.moveToCellSequence=void 0;const _=l(2584);function v(f,p,d,u){const w=f-c(f,d),L=p-c(p,d),R=Math.abs(w-L)-(function(D,k,M){let W=0;const z=D-c(D,M),j=k-c(k,M);for(let N=0;N<Math.abs(z-j);N++){const I=m(D,k)==="A"?-1:1,q=M.buffer.lines.get(z+I*N);q!=null&&q.isWrapped&&W++}return W})(f,p,d);return x(R,b(m(f,p),u))}function c(f,p){let d=0,u=p.buffer.lines.get(f),w=u==null?void 0:u.isWrapped;for(;w&&f>=0&&f<p.rows;)d++,u=p.buffer.lines.get(--f),w=u==null?void 0:u.isWrapped;return d}function m(f,p){return f>p?"A":"B"}function C(f,p,d,u,w,L){let R=f,D=p,k="";for(;R!==d||D!==u;)R+=w?1:-1,w&&R>L.cols-1?(k+=L.buffer.translateBufferLineToString(D,!1,f,R),R=0,f=0,D++):!w&&R<0&&(k+=L.buffer.translateBufferLineToString(D,!1,0,f+1),R=L.cols-1,f=R,D--);return k+L.buffer.translateBufferLineToString(D,!1,f,R)}function b(f,p){const d=p?"O":"[";return _.C0.ESC+d+f}function x(f,p){f=Math.floor(f);let d="";for(let u=0;u<f;u++)d+=p;return d}a.moveToCellSequence=function(f,p,d,u){const w=d.buffer.x,L=d.buffer.y;if(!d.buffer.hasScrollback)return(function(k,M,W,z,j,N){return v(M,z,j,N).length===0?"":x(C(k,M,k,M-c(M,j),!1,j).length,b("D",N))})(w,L,0,p,d,u)+v(L,p,d,u)+(function(k,M,W,z,j,N){let I;I=v(M,z,j,N).length>0?z-c(z,j):M;const q=z,U=(function(K,V,T,B,P,F){let G;return G=v(T,B,P,F).length>0?B-c(B,P):V,K<T&&G<=B||K>=T&&G<B?"C":"D"})(k,M,W,z,j,N);return x(C(k,I,W,q,U==="C",j).length,b(U,N))})(w,L,f,p,d,u);let R;if(L===p)return R=w>f?"D":"C",x(Math.abs(w-f),b(R,u));R=L>p?"D":"C";const D=Math.abs(L-p);return x((function(k,M){return M.cols-k})(L>p?f:w,d)+(D-1)*d.cols+1+((L>p?w:f)-1),b(R,u))}},1296:function(y,a,l){var _=this&&this.__decorate||function(N,I,q,U){var K,V=arguments.length,T=V<3?I:U===null?U=Object.getOwnPropertyDescriptor(I,q):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(N,I,q,U);else for(var B=N.length-1;B>=0;B--)(K=N[B])&&(T=(V<3?K(T):V>3?K(I,q,T):K(I,q))||T);return V>3&&T&&Object.defineProperty(I,q,T),T},v=this&&this.__param||function(N,I){return function(q,U){I(q,U,N)}};Object.defineProperty(a,"__esModule",{value:!0}),a.DomRenderer=void 0;const c=l(3787),m=l(2550),C=l(2223),b=l(6171),x=l(6052),f=l(4725),p=l(8055),d=l(8460),u=l(844),w=l(2585),L="xterm-dom-renderer-owner-",R="xterm-rows",D="xterm-fg-",k="xterm-bg-",M="xterm-focus",W="xterm-selection";let z=1,j=a.DomRenderer=class extends u.Disposable{constructor(N,I,q,U,K,V,T,B,P,F,G,Z,ie){super(),this._terminal=N,this._document=I,this._element=q,this._screenElement=U,this._viewportElement=K,this._helperContainer=V,this._linkifier2=T,this._charSizeService=P,this._optionsService=F,this._bufferService=G,this._coreBrowserService=Z,this._themeService=ie,this._terminalClass=z++,this._rowElements=[],this._selectionRenderModel=(0,x.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new d.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(R),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(W),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,b.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((ae=>this._injectCss(ae)))),this._injectCss(this._themeService.colors),this._rowFactory=B.createInstance(c.DomRendererRowFactory,document),this._element.classList.add(L+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((ae=>this._handleLinkHover(ae)))),this.register(this._linkifier2.onHideLinkUnderline((ae=>this._handleLinkLeave(ae)))),this.register((0,u.toDisposable)((()=>{this._element.classList.remove(L+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new m.WidthCache(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(){const N=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*N,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*N),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/N),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/N),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(const q of this._rowElements)q.style.width=`${this.dimensions.css.canvas.width}px`,q.style.height=`${this.dimensions.css.cell.height}px`,q.style.lineHeight=`${this.dimensions.css.cell.height}px`,q.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const I=`${this._terminalSelector} .${R} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=I,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(N){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let I=`${this._terminalSelector} .${R} { color: ${N.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;I+=`${this._terminalSelector} .${R} .xterm-dim { color: ${p.color.multiplyOpacity(N.foreground,.5).css};}`,I+=`${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;}`;const q=`blink_underline_${this._terminalClass}`,U=`blink_bar_${this._terminalClass}`,K=`blink_block_${this._terminalClass}`;I+=`@keyframes ${q} { 50% { border-bottom-style: hidden; }}`,I+=`@keyframes ${U} { 50% { box-shadow: none; }}`,I+=`@keyframes ${K} { 0% { background-color: ${N.cursor.css}; color: ${N.cursorAccent.css}; } 50% { background-color: inherit; color: ${N.cursor.css}; }}`,I+=`${this._terminalSelector} .${R}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${q} 1s step-end infinite;}${this._terminalSelector} .${R}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${R}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${K} 1s step-end infinite;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-block { background-color: ${N.cursor.css}; color: ${N.cursorAccent.css};}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${N.cursor.css} !important; color: ${N.cursorAccent.css} !important;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${N.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${N.cursor.css} inset;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${N.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,I+=`${this._terminalSelector} .${W} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${W} div { position: absolute; background-color: ${N.selectionBackgroundOpaque.css};}${this._terminalSelector} .${W} div { position: absolute; background-color: ${N.selectionInactiveBackgroundOpaque.css};}`;for(const[V,T]of N.ansi.entries())I+=`${this._terminalSelector} .${D}${V} { color: ${T.css}; }${this._terminalSelector} .${D}${V}.xterm-dim { color: ${p.color.multiplyOpacity(T,.5).css}; }${this._terminalSelector} .${k}${V} { background-color: ${T.css}; }`;I+=`${this._terminalSelector} .${D}${C.INVERTED_DEFAULT_COLOR} { color: ${p.color.opaque(N.background).css}; }${this._terminalSelector} .${D}${C.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${p.color.multiplyOpacity(p.color.opaque(N.background),.5).css}; }${this._terminalSelector} .${k}${C.INVERTED_DEFAULT_COLOR} { background-color: ${N.foreground.css}; }`,this._themeStyleElement.textContent=I}_setDefaultSpacing(){const N=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${N}px`,this._rowFactory.defaultSpacing=N}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(N,I){for(let q=this._rowElements.length;q<=I;q++){const U=this._document.createElement("div");this._rowContainer.appendChild(U),this._rowElements.push(U)}for(;this._rowElements.length>I;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(N,I){this._refreshRowElements(N,I),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(M),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(M),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(N,I,q){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(N,I,q),this.renderRows(0,this._bufferService.rows-1),!N||!I)return;this._selectionRenderModel.update(this._terminal,N,I,q);const U=this._selectionRenderModel.viewportStartRow,K=this._selectionRenderModel.viewportEndRow,V=this._selectionRenderModel.viewportCappedStartRow,T=this._selectionRenderModel.viewportCappedEndRow;if(V>=this._bufferService.rows||T<0)return;const B=this._document.createDocumentFragment();if(q){const P=N[0]>I[0];B.appendChild(this._createSelectionElement(V,P?I[0]:N[0],P?N[0]:I[0],T-V+1))}else{const P=U===V?N[0]:0,F=V===K?I[0]:this._bufferService.cols;B.appendChild(this._createSelectionElement(V,P,F));const G=T-V-1;if(B.appendChild(this._createSelectionElement(V+1,0,this._bufferService.cols,G)),V!==T){const Z=K===T?I[0]:this._bufferService.cols;B.appendChild(this._createSelectionElement(T,0,Z))}}this._selectionContainer.appendChild(B)}_createSelectionElement(N,I,q,U=1){const K=this._document.createElement("div"),V=I*this.dimensions.css.cell.width;let T=this.dimensions.css.cell.width*(q-I);return V+T>this.dimensions.css.canvas.width&&(T=this.dimensions.css.canvas.width-V),K.style.height=U*this.dimensions.css.cell.height+"px",K.style.top=N*this.dimensions.css.cell.height+"px",K.style.left=`${V}px`,K.style.width=`${T}px`,K}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(const N of this._rowElements)N.replaceChildren()}renderRows(N,I){const q=this._bufferService.buffer,U=q.ybase+q.y,K=Math.min(q.x,this._bufferService.cols-1),V=this._optionsService.rawOptions.cursorBlink,T=this._optionsService.rawOptions.cursorStyle,B=this._optionsService.rawOptions.cursorInactiveStyle;for(let P=N;P<=I;P++){const F=P+q.ydisp,G=this._rowElements[P],Z=q.lines.get(F);if(!G||!Z)break;G.replaceChildren(...this._rowFactory.createRow(Z,F,F===U,T,B,K,V,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${L}${this._terminalClass}`}_handleLinkHover(N){this._setCellUnderline(N.x1,N.x2,N.y1,N.y2,N.cols,!0)}_handleLinkLeave(N){this._setCellUnderline(N.x1,N.x2,N.y1,N.y2,N.cols,!1)}_setCellUnderline(N,I,q,U,K,V){q<0&&(N=0),U<0&&(I=0);const T=this._bufferService.rows-1;q=Math.max(Math.min(q,T),0),U=Math.max(Math.min(U,T),0),K=Math.min(K,this._bufferService.cols);const B=this._bufferService.buffer,P=B.ybase+B.y,F=Math.min(B.x,K-1),G=this._optionsService.rawOptions.cursorBlink,Z=this._optionsService.rawOptions.cursorStyle,ie=this._optionsService.rawOptions.cursorInactiveStyle;for(let ae=q;ae<=U;++ae){const X=ae+B.ydisp,H=this._rowElements[ae],re=B.lines.get(X);if(!H||!re)break;H.replaceChildren(...this._rowFactory.createRow(re,X,X===P,Z,ie,F,G,this.dimensions.css.cell.width,this._widthCache,V?ae===q?N:0:-1,V?(ae===U?I:K)-1:-1))}}};a.DomRenderer=j=_([v(7,w.IInstantiationService),v(8,f.ICharSizeService),v(9,w.IOptionsService),v(10,w.IBufferService),v(11,f.ICoreBrowserService),v(12,f.IThemeService)],j)},3787:function(y,a,l){var _=this&&this.__decorate||function(R,D,k,M){var W,z=arguments.length,j=z<3?D:M===null?M=Object.getOwnPropertyDescriptor(D,k):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(R,D,k,M);else for(var N=R.length-1;N>=0;N--)(W=R[N])&&(j=(z<3?W(j):z>3?W(D,k,j):W(D,k))||j);return z>3&&j&&Object.defineProperty(D,k,j),j},v=this&&this.__param||function(R,D){return function(k,M){D(k,M,R)}};Object.defineProperty(a,"__esModule",{value:!0}),a.DomRendererRowFactory=void 0;const c=l(2223),m=l(643),C=l(511),b=l(2585),x=l(8055),f=l(4725),p=l(4269),d=l(6171),u=l(3734);let w=a.DomRendererRowFactory=class{constructor(R,D,k,M,W,z,j){this._document=R,this._characterJoinerService=D,this._optionsService=k,this._coreBrowserService=M,this._coreService=W,this._decorationService=z,this._themeService=j,this._workCell=new C.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(R,D,k){this._selectionStart=R,this._selectionEnd=D,this._columnSelectMode=k}createRow(R,D,k,M,W,z,j,N,I,q,U){const K=[],V=this._characterJoinerService.getJoinedCharacters(D),T=this._themeService.colors;let B,P=R.getNoBgTrimmedLength();k&&P<z+1&&(P=z+1);let F=0,G="",Z=0,ie=0,ae=0,X=!1,H=0,re=!1,te=0;const ce=[],le=q!==-1&&U!==-1;for(let pe=0;pe<P;pe++){R.loadCell(pe,this._workCell);let Se=this._workCell.getWidth();if(Se===0)continue;let be=!1,ue=pe,ge=this._workCell;if(V.length>0&&pe===V[0][0]){be=!0;const Oe=V.shift();ge=new p.JoinedCellData(this._workCell,R.translateToString(!0,Oe[0],Oe[1]),Oe[1]-Oe[0]),ue=Oe[1]-1,Se=ge.getWidth()}const Re=this._isCellInSelection(pe,D),Ie=k&&pe===z,ze=le&&pe>=q&&pe<=U;let Qe=!1;this._decorationService.forEachDecorationAtCell(pe,D,void 0,(Oe=>{Qe=!0}));let ut=ge.getChars()||m.WHITESPACE_CELL_CHAR;if(ut===" "&&(ge.isUnderline()||ge.isOverline())&&(ut=" "),te=Se*N-I.get(ut,ge.isBold(),ge.isItalic()),B){if(F&&(Re&&re||!Re&&!re&&ge.bg===Z)&&(Re&&re&&T.selectionForeground||ge.fg===ie)&&ge.extended.ext===ae&&ze===X&&te===H&&!Ie&&!be&&!Qe){ge.isInvisible()?G+=m.WHITESPACE_CELL_CHAR:G+=ut,F++;continue}F&&(B.textContent=G),B=this._document.createElement("span"),F=0,G=""}else B=this._document.createElement("span");if(Z=ge.bg,ie=ge.fg,ae=ge.extended.ext,X=ze,H=te,re=Re,be&&z>=pe&&z<=ue&&(z=pe),!this._coreService.isCursorHidden&&Ie&&this._coreService.isCursorInitialized){if(ce.push("xterm-cursor"),this._coreBrowserService.isFocused)j&&ce.push("xterm-cursor-blink"),ce.push(M==="bar"?"xterm-cursor-bar":M==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(W)switch(W){case"outline":ce.push("xterm-cursor-outline");break;case"block":ce.push("xterm-cursor-block");break;case"bar":ce.push("xterm-cursor-bar");break;case"underline":ce.push("xterm-cursor-underline")}}if(ge.isBold()&&ce.push("xterm-bold"),ge.isItalic()&&ce.push("xterm-italic"),ge.isDim()&&ce.push("xterm-dim"),G=ge.isInvisible()?m.WHITESPACE_CELL_CHAR:ge.getChars()||m.WHITESPACE_CELL_CHAR,ge.isUnderline()&&(ce.push(`xterm-underline-${ge.extended.underlineStyle}`),G===" "&&(G=" "),!ge.isUnderlineColorDefault()))if(ge.isUnderlineColorRGB())B.style.textDecorationColor=`rgb(${u.AttributeData.toColorRGB(ge.getUnderlineColor()).join(",")})`;else{let Oe=ge.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ge.isBold()&&Oe<8&&(Oe+=8),B.style.textDecorationColor=T.ansi[Oe].css}ge.isOverline()&&(ce.push("xterm-overline"),G===" "&&(G=" ")),ge.isStrikethrough()&&ce.push("xterm-strikethrough"),ze&&(B.style.textDecoration="underline");let qe=ge.getFgColor(),pt=ge.getFgColorMode(),Ne=ge.getBgColor(),Je=ge.getBgColorMode();const ht=!!ge.isInverse();if(ht){const Oe=qe;qe=Ne,Ne=Oe;const Rn=pt;pt=Je,Je=Rn}let $e,pr,ot,Rt=!1;switch(this._decorationService.forEachDecorationAtCell(pe,D,void 0,(Oe=>{Oe.options.layer!=="top"&&Rt||(Oe.backgroundColorRGB&&(Je=50331648,Ne=Oe.backgroundColorRGB.rgba>>8&16777215,$e=Oe.backgroundColorRGB),Oe.foregroundColorRGB&&(pt=50331648,qe=Oe.foregroundColorRGB.rgba>>8&16777215,pr=Oe.foregroundColorRGB),Rt=Oe.options.layer==="top")})),!Rt&&Re&&($e=this._coreBrowserService.isFocused?T.selectionBackgroundOpaque:T.selectionInactiveBackgroundOpaque,Ne=$e.rgba>>8&16777215,Je=50331648,Rt=!0,T.selectionForeground&&(pt=50331648,qe=T.selectionForeground.rgba>>8&16777215,pr=T.selectionForeground)),Rt&&ce.push("xterm-decoration-top"),Je){case 16777216:case 33554432:ot=T.ansi[Ne],ce.push(`xterm-bg-${Ne}`);break;case 50331648:ot=x.channels.toColor(Ne>>16,Ne>>8&255,255&Ne),this._addStyle(B,`background-color:#${L((Ne>>>0).toString(16),"0",6)}`);break;default:ht?(ot=T.foreground,ce.push(`xterm-bg-${c.INVERTED_DEFAULT_COLOR}`)):ot=T.background}switch($e||ge.isDim()&&($e=x.color.multiplyOpacity(ot,.5)),pt){case 16777216:case 33554432:ge.isBold()&&qe<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(qe+=8),this._applyMinimumContrast(B,ot,T.ansi[qe],ge,$e,void 0)||ce.push(`xterm-fg-${qe}`);break;case 50331648:const Oe=x.channels.toColor(qe>>16&255,qe>>8&255,255&qe);this._applyMinimumContrast(B,ot,Oe,ge,$e,pr)||this._addStyle(B,`color:#${L(qe.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(B,ot,T.foreground,ge,$e,pr)||ht&&ce.push(`xterm-fg-${c.INVERTED_DEFAULT_COLOR}`)}ce.length&&(B.className=ce.join(" "),ce.length=0),Ie||be||Qe?B.textContent=G:F++,te!==this.defaultSpacing&&(B.style.letterSpacing=`${te}px`),K.push(B),pe=ue}return B&&F&&(B.textContent=G),K}_applyMinimumContrast(R,D,k,M,W,z){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,d.treatGlyphAsBackgroundColor)(M.getCode()))return!1;const j=this._getContrastCache(M);let N;if(W||z||(N=j.getColor(D.rgba,k.rgba)),N===void 0){const I=this._optionsService.rawOptions.minimumContrastRatio/(M.isDim()?2:1);N=x.color.ensureContrastRatio(W||D,z||k,I),j.setColor((W||D).rgba,(z||k).rgba,N??null)}return!!N&&(this._addStyle(R,`color:${N.css}`),!0)}_getContrastCache(R){return R.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(R,D){R.setAttribute("style",`${R.getAttribute("style")||""}${D};`)}_isCellInSelection(R,D){const k=this._selectionStart,M=this._selectionEnd;return!(!k||!M)&&(this._columnSelectMode?k[0]<=M[0]?R>=k[0]&&D>=k[1]&&R<M[0]&&D<=M[1]:R<k[0]&&D>=k[1]&&R>=M[0]&&D<=M[1]:D>k[1]&&D<M[1]||k[1]===M[1]&&D===k[1]&&R>=k[0]&&R<M[0]||k[1]<M[1]&&D===M[1]&&R<M[0]||k[1]<M[1]&&D===k[1]&&R>=k[0])}};function L(R,D,k){for(;R.length<k;)R=D+R;return R}a.DomRendererRowFactory=w=_([v(1,f.ICharacterJoinerService),v(2,b.IOptionsService),v(3,f.ICoreBrowserService),v(4,b.ICoreService),v(5,b.IDecorationService),v(6,f.IThemeService)],w)},2550:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WidthCache=void 0,a.WidthCache=class{constructor(l,_){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=l.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";const v=l.createElement("span");v.classList.add("xterm-char-measure-element");const c=l.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontWeight="bold";const m=l.createElement("span");m.classList.add("xterm-char-measure-element"),m.style.fontStyle="italic";const C=l.createElement("span");C.classList.add("xterm-char-measure-element"),C.style.fontWeight="bold",C.style.fontStyle="italic",this._measureElements=[v,c,m,C],this._container.appendChild(v),this._container.appendChild(c),this._container.appendChild(m),this._container.appendChild(C),_.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(l,_,v,c){l===this._font&&_===this._fontSize&&v===this._weight&&c===this._weightBold||(this._font=l,this._fontSize=_,this._weight=v,this._weightBold=c,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${v}`,this._measureElements[1].style.fontWeight=`${c}`,this._measureElements[2].style.fontWeight=`${v}`,this._measureElements[3].style.fontWeight=`${c}`,this.clear())}get(l,_,v){let c=0;if(!_&&!v&&l.length===1&&(c=l.charCodeAt(0))<256){if(this._flat[c]!==-9999)return this._flat[c];const b=this._measure(l,0);return b>0&&(this._flat[c]=b),b}let m=l;_&&(m+="B"),v&&(m+="I");let C=this._holey.get(m);if(C===void 0){let b=0;_&&(b|=1),v&&(b|=2),C=this._measure(l,b),C>0&&this._holey.set(m,C)}return C}_measure(l,_){const v=this._measureElements[_];return v.textContent=l.repeat(32),v.offsetWidth/32}}},2223:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.TEXT_BASELINE=a.DIM_OPACITY=a.INVERTED_DEFAULT_COLOR=void 0;const _=l(6114);a.INVERTED_DEFAULT_COLOR=257,a.DIM_OPACITY=.5,a.TEXT_BASELINE=_.isFirefox||_.isLegacyEdge?"bottom":"ideographic"},6171:(y,a)=>{function l(v){return 57508<=v&&v<=57558}function _(v){return v>=128512&&v<=128591||v>=127744&&v<=128511||v>=128640&&v<=128767||v>=9728&&v<=9983||v>=9984&&v<=10175||v>=65024&&v<=65039||v>=129280&&v<=129535||v>=127462&&v<=127487}Object.defineProperty(a,"__esModule",{value:!0}),a.computeNextVariantOffset=a.createRenderDimensions=a.treatGlyphAsBackgroundColor=a.allowRescaling=a.isEmoji=a.isRestrictedPowerlineGlyph=a.isPowerlineGlyph=a.throwIfFalsy=void 0,a.throwIfFalsy=function(v){if(!v)throw new Error("value must not be falsy");return v},a.isPowerlineGlyph=l,a.isRestrictedPowerlineGlyph=function(v){return 57520<=v&&v<=57527},a.isEmoji=_,a.allowRescaling=function(v,c,m,C){return c===1&&m>Math.ceil(1.5*C)&&v!==void 0&&v>255&&!_(v)&&!l(v)&&!(function(b){return 57344<=b&&b<=63743})(v)},a.treatGlyphAsBackgroundColor=function(v){return l(v)||(function(c){return 9472<=c&&c<=9631})(v)},a.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},a.computeNextVariantOffset=function(v,c,m=0){return(v-(2*Math.round(c)-m))%(2*Math.round(c))}},6052:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.createSelectionRenderModel=void 0;class l{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(v,c,m,C=!1){if(this.selectionStart=c,this.selectionEnd=m,!c||!m||c[0]===m[0]&&c[1]===m[1])return void this.clear();const b=v.buffers.active.ydisp,x=c[1]-b,f=m[1]-b,p=Math.max(x,0),d=Math.min(f,v.rows-1);p>=v.rows||d<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=C,this.viewportStartRow=x,this.viewportEndRow=f,this.viewportCappedStartRow=p,this.viewportCappedEndRow=d,this.startCol=c[0],this.endCol=m[0])}isCellSelected(v,c,m){return!!this.hasSelection&&(m-=v.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?c>=this.startCol&&m>=this.viewportCappedStartRow&&c<this.endCol&&m<=this.viewportCappedEndRow:c<this.startCol&&m>=this.viewportCappedStartRow&&c>=this.endCol&&m<=this.viewportCappedEndRow:m>this.viewportStartRow&&m<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&m===this.viewportStartRow&&c>=this.startCol&&c<this.endCol||this.viewportStartRow<this.viewportEndRow&&m===this.viewportEndRow&&c<this.endCol||this.viewportStartRow<this.viewportEndRow&&m===this.viewportStartRow&&c>=this.startCol)}}a.createSelectionRenderModel=function(){return new l}},456:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.SelectionModel=void 0,a.SelectionModel=class{constructor(l){this._bufferService=l,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const l=this.selectionStart[0]+this.selectionStartLength;return l>this._bufferService.cols?l%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)-1]:[l%this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)]:[l,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const l=this.selectionStart[0]+this.selectionStartLength;return l>this._bufferService.cols?[l%this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)]:[Math.max(l,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const l=this.selectionStart,_=this.selectionEnd;return!(!l||!_)&&(l[1]>_[1]||l[1]===_[1]&&l[0]>_[0])}handleTrim(l){return this.selectionStart&&(this.selectionStart[1]-=l),this.selectionEnd&&(this.selectionEnd[1]-=l),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(y,a,l){var _=this&&this.__decorate||function(d,u,w,L){var R,D=arguments.length,k=D<3?u:L===null?L=Object.getOwnPropertyDescriptor(u,w):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(d,u,w,L);else for(var M=d.length-1;M>=0;M--)(R=d[M])&&(k=(D<3?R(k):D>3?R(u,w,k):R(u,w))||k);return D>3&&k&&Object.defineProperty(u,w,k),k},v=this&&this.__param||function(d,u){return function(w,L){u(w,L,d)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CharSizeService=void 0;const c=l(2585),m=l(8460),C=l(844);let b=a.CharSizeService=class extends C.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(d,u,w){super(),this._optionsService=w,this.width=0,this.height=0,this._onCharSizeChange=this.register(new m.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new p(this._optionsService))}catch{this._measureStrategy=this.register(new f(d,u,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const d=this._measureStrategy.measure();d.width===this.width&&d.height===this.height||(this.width=d.width,this.height=d.height,this._onCharSizeChange.fire())}};a.CharSizeService=b=_([v(2,c.IOptionsService)],b);class x extends C.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(u,w){u!==void 0&&u>0&&w!==void 0&&w>0&&(this._result.width=u,this._result.height=w)}}class f extends x{constructor(u,w,L){super(),this._document=u,this._parentElement=w,this._optionsService=L,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}}class p extends x{constructor(u){super(),this._optionsService=u,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const w=this._ctx.measureText("W");if(!("width"in w&&"fontBoundingBoxAscent"in w&&"fontBoundingBoxDescent"in w))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const u=this._ctx.measureText("W");return this._validateAndSet(u.width,u.fontBoundingBoxAscent+u.fontBoundingBoxDescent),this._result}}},4269:function(y,a,l){var _=this&&this.__decorate||function(p,d,u,w){var L,R=arguments.length,D=R<3?d:w===null?w=Object.getOwnPropertyDescriptor(d,u):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(p,d,u,w);else for(var k=p.length-1;k>=0;k--)(L=p[k])&&(D=(R<3?L(D):R>3?L(d,u,D):L(d,u))||D);return R>3&&D&&Object.defineProperty(d,u,D),D},v=this&&this.__param||function(p,d){return function(u,w){d(u,w,p)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CharacterJoinerService=a.JoinedCellData=void 0;const c=l(3734),m=l(643),C=l(511),b=l(2585);class x extends c.AttributeData{constructor(d,u,w){super(),this.content=0,this.combinedData="",this.fg=d.fg,this.bg=d.bg,this.combinedData=u,this._width=w}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(d){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}a.JoinedCellData=x;let f=a.CharacterJoinerService=class tm{constructor(d){this._bufferService=d,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new C.CellData}register(d){const u={id:this._nextCharacterJoinerId++,handler:d};return this._characterJoiners.push(u),u.id}deregister(d){for(let u=0;u<this._characterJoiners.length;u++)if(this._characterJoiners[u].id===d)return this._characterJoiners.splice(u,1),!0;return!1}getJoinedCharacters(d){if(this._characterJoiners.length===0)return[];const u=this._bufferService.buffer.lines.get(d);if(!u||u.length===0)return[];const w=[],L=u.translateToString(!0);let R=0,D=0,k=0,M=u.getFg(0),W=u.getBg(0);for(let z=0;z<u.getTrimmedLength();z++)if(u.loadCell(z,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==M||this._workCell.bg!==W){if(z-R>1){const j=this._getJoinedRanges(L,k,D,u,R);for(let N=0;N<j.length;N++)w.push(j[N])}R=z,k=D,M=this._workCell.fg,W=this._workCell.bg}D+=this._workCell.getChars().length||m.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-R>1){const z=this._getJoinedRanges(L,k,D,u,R);for(let j=0;j<z.length;j++)w.push(z[j])}return w}_getJoinedRanges(d,u,w,L,R){const D=d.substring(u,w);let k=[];try{k=this._characterJoiners[0].handler(D)}catch(M){console.error(M)}for(let M=1;M<this._characterJoiners.length;M++)try{const W=this._characterJoiners[M].handler(D);for(let z=0;z<W.length;z++)tm._mergeRanges(k,W[z])}catch(W){console.error(W)}return this._stringRangesToCellRanges(k,L,R),k}_stringRangesToCellRanges(d,u,w){let L=0,R=!1,D=0,k=d[L];if(k){for(let M=w;M<this._bufferService.cols;M++){const W=u.getWidth(M),z=u.getString(M).length||m.WHITESPACE_CELL_CHAR.length;if(W!==0){if(!R&&k[0]<=D&&(k[0]=M,R=!0),k[1]<=D){if(k[1]=M,k=d[++L],!k)break;k[0]<=D?(k[0]=M,R=!0):R=!1}D+=z}}k&&(k[1]=this._bufferService.cols)}}static _mergeRanges(d,u){let w=!1;for(let L=0;L<d.length;L++){const R=d[L];if(w){if(u[1]<=R[0])return d[L-1][1]=u[1],d;if(u[1]<=R[1])return d[L-1][1]=Math.max(u[1],R[1]),d.splice(L,1),d;d.splice(L,1),L--}else{if(u[1]<=R[0])return d.splice(L,0,u),d;if(u[1]<=R[1])return R[0]=Math.min(u[0],R[0]),d;u[0]<R[1]&&(R[0]=Math.min(u[0],R[0]),w=!0)}}return w?d[d.length-1][1]=u[1]:d.push(u),d}};a.CharacterJoinerService=f=_([v(0,b.IBufferService)],f)},5114:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CoreBrowserService=void 0;const _=l(844),v=l(8460),c=l(3656);class m extends _.Disposable{constructor(x,f,p){super(),this._textarea=x,this._window=f,this.mainDocument=p,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new C(this._window),this._onDprChange=this.register(new v.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new v.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((d=>this._screenDprMonitor.setWindow(d)))),this.register((0,v.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(x){this._window!==x&&(this._window=x,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}}a.CoreBrowserService=m;class C extends _.Disposable{constructor(x){super(),this._parentWindow=x,this._windowResizeListener=this.register(new _.MutableDisposable),this._onDprChange=this.register(new v.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,_.toDisposable)((()=>this.clearListener())))}setWindow(x){this._parentWindow=x,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,c.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var x;this._outerListener&&((x=this._resolutionMediaMatchList)==null||x.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)}}},779:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.LinkProviderService=void 0;const _=l(844);class v extends _.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,_.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(m){return this.linkProviders.push(m),{dispose:()=>{const C=this.linkProviders.indexOf(m);C!==-1&&this.linkProviders.splice(C,1)}}}}a.LinkProviderService=v},8934:function(y,a,l){var _=this&&this.__decorate||function(b,x,f,p){var d,u=arguments.length,w=u<3?x:p===null?p=Object.getOwnPropertyDescriptor(x,f):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(b,x,f,p);else for(var L=b.length-1;L>=0;L--)(d=b[L])&&(w=(u<3?d(w):u>3?d(x,f,w):d(x,f))||w);return u>3&&w&&Object.defineProperty(x,f,w),w},v=this&&this.__param||function(b,x){return function(f,p){x(f,p,b)}};Object.defineProperty(a,"__esModule",{value:!0}),a.MouseService=void 0;const c=l(4725),m=l(9806);let C=a.MouseService=class{constructor(b,x){this._renderService=b,this._charSizeService=x}getCoords(b,x,f,p,d){return(0,m.getCoords)(window,b,x,f,p,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,d)}getMouseReportCoords(b,x){const f=(0,m.getCoordsRelativeToElement)(window,b,x);if(this._charSizeService.hasValidSize)return f[0]=Math.min(Math.max(f[0],0),this._renderService.dimensions.css.canvas.width-1),f[1]=Math.min(Math.max(f[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(f[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(f[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(f[0]),y:Math.floor(f[1])}}};a.MouseService=C=_([v(0,c.IRenderService),v(1,c.ICharSizeService)],C)},3230:function(y,a,l){var _=this&&this.__decorate||function(d,u,w,L){var R,D=arguments.length,k=D<3?u:L===null?L=Object.getOwnPropertyDescriptor(u,w):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(d,u,w,L);else for(var M=d.length-1;M>=0;M--)(R=d[M])&&(k=(D<3?R(k):D>3?R(u,w,k):R(u,w))||k);return D>3&&k&&Object.defineProperty(u,w,k),k},v=this&&this.__param||function(d,u){return function(w,L){u(w,L,d)}};Object.defineProperty(a,"__esModule",{value:!0}),a.RenderService=void 0;const c=l(6193),m=l(4725),C=l(8460),b=l(844),x=l(7226),f=l(2585);let p=a.RenderService=class extends b.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(d,u,w,L,R,D,k,M){super(),this._rowCount=d,this._charSizeService=L,this._renderer=this.register(new b.MutableDisposable),this._pausedResizeTask=new x.DebouncedIdleTask,this._observerDisposable=this.register(new b.MutableDisposable),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 C.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new C.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new C.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new C.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new c.RenderDebouncer(((W,z)=>this._renderRows(W,z)),k),this.register(this._renderDebouncer),this.register(k.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(D.onResize((()=>this._fullRefresh()))),this.register(D.buffers.onBufferActivate((()=>{var W;return(W=this._renderer.value)==null?void 0:W.clear()}))),this.register(w.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(R.onDecorationRegistered((()=>this._fullRefresh()))),this.register(R.onDecorationRemoved((()=>this._fullRefresh()))),this.register(w.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(D.cols,D.rows),this._fullRefresh()}))),this.register(w.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(D.buffer.y,D.buffer.y,!0)))),this.register(M.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(k.window,u),this.register(k.onWindowChange((W=>this._registerIntersectionObserver(W,u))))}_registerIntersectionObserver(d,u){if("IntersectionObserver"in d){const w=new d.IntersectionObserver((L=>this._handleIntersectionChange(L[L.length-1])),{threshold:0});w.observe(u),this._observerDisposable.value=(0,b.toDisposable)((()=>w.disconnect()))}}_handleIntersectionChange(d){this._isPaused=d.isIntersecting===void 0?d.intersectionRatio===0:!d.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(d,u,w=!1){this._isPaused?this._needsFullRefresh=!0:(w||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(d,u,this._rowCount))}_renderRows(d,u){this._renderer.value&&(d=Math.min(d,this._rowCount-1),u=Math.min(u,this._rowCount-1),this._renderer.value.renderRows(d,u),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:d,end:u}),this._onRender.fire({start:d,end:u}),this._isNextRenderRedrawOnly=!0)}resize(d,u){this._rowCount=u,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(d){this._renderer.value=d,this._renderer.value&&(this._renderer.value.onRequestRedraw((u=>this.refreshRows(u.start,u.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(d){return this._renderDebouncer.addRefreshCallback(d)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var d,u;this._renderer.value&&((u=(d=this._renderer.value).clearTextureAtlas)==null||u.call(d),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(d,u){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var w;return(w=this._renderer.value)==null?void 0:w.handleResize(d,u)})):this._renderer.value.handleResize(d,u),this._fullRefresh())}handleCharSizeChanged(){var d;(d=this._renderer.value)==null||d.handleCharSizeChanged()}handleBlur(){var d;(d=this._renderer.value)==null||d.handleBlur()}handleFocus(){var d;(d=this._renderer.value)==null||d.handleFocus()}handleSelectionChanged(d,u,w){var L;this._selectionState.start=d,this._selectionState.end=u,this._selectionState.columnSelectMode=w,(L=this._renderer.value)==null||L.handleSelectionChanged(d,u,w)}handleCursorMove(){var d;(d=this._renderer.value)==null||d.handleCursorMove()}clear(){var d;(d=this._renderer.value)==null||d.clear()}};a.RenderService=p=_([v(2,f.IOptionsService),v(3,m.ICharSizeService),v(4,f.IDecorationService),v(5,f.IBufferService),v(6,m.ICoreBrowserService),v(7,m.IThemeService)],p)},9312:function(y,a,l){var _=this&&this.__decorate||function(k,M,W,z){var j,N=arguments.length,I=N<3?M:z===null?z=Object.getOwnPropertyDescriptor(M,W):z;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(k,M,W,z);else for(var q=k.length-1;q>=0;q--)(j=k[q])&&(I=(N<3?j(I):N>3?j(M,W,I):j(M,W))||I);return N>3&&I&&Object.defineProperty(M,W,I),I},v=this&&this.__param||function(k,M){return function(W,z){M(W,z,k)}};Object.defineProperty(a,"__esModule",{value:!0}),a.SelectionService=void 0;const c=l(9806),m=l(9504),C=l(456),b=l(4725),x=l(8460),f=l(844),p=l(6114),d=l(4841),u=l(511),w=l(2585),L=" ",R=new RegExp(L,"g");let D=a.SelectionService=class extends f.Disposable{constructor(k,M,W,z,j,N,I,q,U){super(),this._element=k,this._screenElement=M,this._linkifier=W,this._bufferService=z,this._coreService=j,this._mouseService=N,this._optionsService=I,this._renderService=q,this._coreBrowserService=U,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new u.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new x.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new x.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new x.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new x.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=K=>this._handleMouseMove(K),this._mouseUpListener=K=>this._handleMouseUp(K),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((K=>this._handleTrim(K))),this.register(this._bufferService.buffers.onBufferActivate((K=>this._handleBufferActivate(K)))),this.enable(),this._model=new C.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,f.toDisposable)((()=>{this._removeMouseDownListeners()})))}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(){const k=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;return!(!k||!M||k[0]===M[0]&&k[1]===M[1])}get selectionText(){const k=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;if(!k||!M)return"";const W=this._bufferService.buffer,z=[];if(this._activeSelectionMode===3){if(k[0]===M[0])return"";const j=k[0]<M[0]?k[0]:M[0],N=k[0]<M[0]?M[0]:k[0];for(let I=k[1];I<=M[1];I++){const q=W.translateBufferLineToString(I,!0,j,N);z.push(q)}}else{const j=k[1]===M[1]?M[0]:void 0;z.push(W.translateBufferLineToString(k[1],!0,k[0],j));for(let N=k[1]+1;N<=M[1]-1;N++){const I=W.lines.get(N),q=W.translateBufferLineToString(N,!0);I!=null&&I.isWrapped?z[z.length-1]+=q:z.push(q)}if(k[1]!==M[1]){const N=W.lines.get(M[1]),I=W.translateBufferLineToString(M[1],!0,0,M[0]);N&&N.isWrapped?z[z.length-1]+=I:z.push(I)}}return z.map((j=>j.replace(R," "))).join(p.isWindows?`\r
66
+ WARNING: This link could potentially be dangerous`)){const p=window.open();if(p){try{p.opener=null}catch{}p.location.href=f}else console.warn("Opening link blocked as opener could not be cleared")}}a.OscLinkProvider=C=_([v(0,m.IBufferService),v(1,m.IOptionsService),v(2,m.IOscLinkService)],C)},6193:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.RenderDebouncer=void 0,a.RenderDebouncer=class{constructor(l,_){this._renderCallback=l,this._coreBrowserService=_,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(l){return this._refreshCallbacks.push(l),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(l,_,v){this._rowCount=v,l=l!==void 0?l:0,_=_!==void 0?_:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,l):l,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,_):_,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)return void this._runRefreshCallbacks();const l=Math.max(this._rowStart,0),_=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(l,_),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const l of this._refreshCallbacks)l(0);this._refreshCallbacks=[]}}},3236:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Terminal=void 0;const _=l(3614),v=l(3656),c=l(3551),m=l(9042),C=l(3730),b=l(1680),x=l(3107),f=l(5744),p=l(2950),d=l(1296),u=l(428),w=l(4269),L=l(5114),R=l(8934),D=l(3230),k=l(9312),M=l(4725),W=l(6731),z=l(8055),j=l(8969),N=l(8460),I=l(844),q=l(6114),U=l(8437),K=l(2584),V=l(7399),T=l(5941),B=l(9074),P=l(2585),F=l(5435),Y=l(4567),Z=l(779);class ie extends j.CoreTerminal{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}constructor(X={}){super(X),this.browser=q,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new I.MutableDisposable),this._onCursorMove=this.register(new N.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new N.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new N.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new N.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new N.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new N.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new N.EventEmitter),this._onBlur=this.register(new N.EventEmitter),this._onA11yCharEmitter=this.register(new N.EventEmitter),this._onA11yTabEmitter=this.register(new N.EventEmitter),this._onWillOpen=this.register(new N.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(B.DecorationService),this._instantiationService.setService(P.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Z.LinkProviderService),this._instantiationService.setService(M.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(C.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((H,re)=>this.refresh(H,re)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((H=>this._reportWindowsOptions(H)))),this.register(this._inputHandler.onColor((H=>this._handleColorEvent(H)))),this.register((0,N.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,N.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,N.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,N.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((H=>this._afterResize(H.cols,H.rows)))),this.register((0,I.toDisposable)((()=>{var H,re;this._customKeyEventHandler=void 0,(re=(H=this.element)==null?void 0:H.parentNode)==null||re.removeChild(this.element)})))}_handleColorEvent(X){if(this._themeService)for(const H of X){let re,te="";switch(H.index){case 256:re="foreground",te="10";break;case 257:re="background",te="11";break;case 258:re="cursor",te="12";break;default:re="ansi",te="4;"+H.index}switch(H.type){case 0:const ce=z.color.toColorRGB(re==="ansi"?this._themeService.colors.ansi[H.index]:this._themeService.colors[re]);this.coreService.triggerDataEvent(`${K.C0.ESC}]${te};${(0,T.toRgbString)(ce)}${K.C1_ESCAPED.ST}`);break;case 1:if(re==="ansi")this._themeService.modifyColors((le=>le.ansi[H.index]=z.channels.toColor(...H.color)));else{const le=re;this._themeService.modifyColors((pe=>pe[le]=z.channels.toColor(...H.color)))}break;case 2:this._themeService.restoreColor(H.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(X){X?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Y.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(X){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(K.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var X;return(X=this.textarea)==null?void 0:X.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(K.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const X=this.buffer.ybase+this.buffer.y,H=this.buffer.lines.get(X);if(!H)return;const re=Math.min(this.buffer.x,this.cols-1),te=this._renderService.dimensions.css.cell.height,ce=H.getWidth(re),le=this._renderService.dimensions.css.cell.width*ce,pe=this.buffer.y*this._renderService.dimensions.css.cell.height,Se=re*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Se+"px",this.textarea.style.top=pe+"px",this.textarea.style.width=le+"px",this.textarea.style.height=te+"px",this.textarea.style.lineHeight=te+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,v.addDisposableDomListener)(this.element,"copy",(H=>{this.hasSelection()&&(0,_.copyHandler)(H,this._selectionService)})));const X=H=>(0,_.handlePasteEvent)(H,this.textarea,this.coreService,this.optionsService);this.register((0,v.addDisposableDomListener)(this.textarea,"paste",X)),this.register((0,v.addDisposableDomListener)(this.element,"paste",X)),q.isFirefox?this.register((0,v.addDisposableDomListener)(this.element,"mousedown",(H=>{H.button===2&&(0,_.rightClickHandler)(H,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,v.addDisposableDomListener)(this.element,"contextmenu",(H=>{(0,_.rightClickHandler)(H,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),q.isLinux&&this.register((0,v.addDisposableDomListener)(this.element,"auxclick",(H=>{H.button===1&&(0,_.moveTextAreaUnderMouseCursor)(H,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,v.addDisposableDomListener)(this.textarea,"keyup",(X=>this._keyUp(X)),!0)),this.register((0,v.addDisposableDomListener)(this.textarea,"keydown",(X=>this._keyDown(X)),!0)),this.register((0,v.addDisposableDomListener)(this.textarea,"keypress",(X=>this._keyPress(X)),!0)),this.register((0,v.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,v.addDisposableDomListener)(this.textarea,"compositionupdate",(X=>this._compositionHelper.compositionupdate(X)))),this.register((0,v.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,v.addDisposableDomListener)(this.textarea,"input",(X=>this._inputEvent(X)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(X){var re;if(!X)throw new Error("Terminal requires a parent element.");if(X.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((re=this.element)==null?void 0:re.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=X.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"),X.appendChild(this.element);const H=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),H.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,v.addDisposableDomListener)(this.screenElement,"mousemove",(te=>this.updateCursorStyle(te)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),H.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",m.promptLabel),q.isChromeOS||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._coreBrowserService=this.register(this._instantiationService.createInstance(L.CoreBrowserService,this.textarea,X.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(M.ICoreBrowserService,this._coreBrowserService),this.register((0,v.addDisposableDomListener)(this.textarea,"focus",(te=>this._handleTextAreaFocus(te)))),this.register((0,v.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(u.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(M.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(W.ThemeService),this._instantiationService.setService(M.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(w.CharacterJoinerService),this._instantiationService.setService(M.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(D.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(M.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((te=>this._onRender.fire(te)))),this.onResize((te=>this._renderService.resize(te.cols,te.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(p.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(R.MouseService),this._instantiationService.setService(M.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(c.Linkifier,this.screenElement)),this.element.appendChild(H);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(b.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((te=>this.scrollLines(te.amount,te.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),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.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(k.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(M.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((te=>this.scrollLines(te.amount,te.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((te=>this._renderService.handleSelectionChanged(te.start,te.end,te.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((te=>{this.textarea.value=te,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((te=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,v.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(x.BufferDecorationRenderer,this.screenElement)),this.register((0,v.addDisposableDomListener)(this.element,"mousedown",(te=>this._selectionService.handleMouseDown(te)))),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(Y.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(te=>this._handleScreenReaderModeOptionChange(te)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(f.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(te=>{!this._overviewRulerRenderer&&te&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(f.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(d.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const X=this,H=this.element;function re(le){const pe=X._mouseService.getMouseReportCoords(le,X.screenElement);if(!pe)return!1;let Se,be;switch(le.overrideType||le.type){case"mousemove":be=32,le.buttons===void 0?(Se=3,le.button!==void 0&&(Se=le.button<3?le.button:3)):Se=1&le.buttons?0:4&le.buttons?1:2&le.buttons?2:3;break;case"mouseup":be=0,Se=le.button<3?le.button:3;break;case"mousedown":be=1,Se=le.button<3?le.button:3;break;case"wheel":if(X._customWheelEventHandler&&X._customWheelEventHandler(le)===!1||X.viewport.getLinesScrolled(le)===0)return!1;be=le.deltaY<0?0:1,Se=4;break;default:return!1}return!(be===void 0||Se===void 0||Se>4)&&X.coreMouseService.triggerMouseEvent({col:pe.col,row:pe.row,x:pe.x,y:pe.y,button:Se,action:be,ctrl:le.ctrlKey,alt:le.altKey,shift:le.shiftKey})}const te={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ce={mouseup:le=>(re(le),le.buttons||(this._document.removeEventListener("mouseup",te.mouseup),te.mousedrag&&this._document.removeEventListener("mousemove",te.mousedrag)),this.cancel(le)),wheel:le=>(re(le),this.cancel(le,!0)),mousedrag:le=>{le.buttons&&re(le)},mousemove:le=>{le.buttons||re(le)}};this.register(this.coreMouseService.onProtocolChange((le=>{le?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(le)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&le?te.mousemove||(H.addEventListener("mousemove",ce.mousemove),te.mousemove=ce.mousemove):(H.removeEventListener("mousemove",te.mousemove),te.mousemove=null),16&le?te.wheel||(H.addEventListener("wheel",ce.wheel,{passive:!1}),te.wheel=ce.wheel):(H.removeEventListener("wheel",te.wheel),te.wheel=null),2&le?te.mouseup||(te.mouseup=ce.mouseup):(this._document.removeEventListener("mouseup",te.mouseup),te.mouseup=null),4&le?te.mousedrag||(te.mousedrag=ce.mousedrag):(this._document.removeEventListener("mousemove",te.mousedrag),te.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,v.addDisposableDomListener)(H,"mousedown",(le=>{if(le.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(le))return re(le),te.mouseup&&this._document.addEventListener("mouseup",te.mouseup),te.mousedrag&&this._document.addEventListener("mousemove",te.mousedrag),this.cancel(le)}))),this.register((0,v.addDisposableDomListener)(H,"wheel",(le=>{if(!te.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(le)===!1)return!1;if(!this.buffer.hasScrollback){const pe=this.viewport.getLinesScrolled(le);if(pe===0)return;const Se=K.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(le.deltaY<0?"A":"B");let be="";for(let ue=0;ue<Math.abs(pe);ue++)be+=Se;return this.coreService.triggerDataEvent(be,!0),this.cancel(le,!0)}return this.viewport.handleWheel(le)?this.cancel(le):void 0}}),{passive:!1})),this.register((0,v.addDisposableDomListener)(H,"touchstart",(le=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(le),this.cancel(le)}),{passive:!0})),this.register((0,v.addDisposableDomListener)(H,"touchmove",(le=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(le)?void 0:this.cancel(le)}),{passive:!1}))}refresh(X,H){var re;(re=this._renderService)==null||re.refreshRows(X,H)}updateCursorStyle(X){var H;(H=this._selectionService)!=null&&H.shouldColumnSelect(X)?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(X,H,re=0){var te;re===1?(super.scrollLines(X,H,re),this.refresh(0,this.rows-1)):(te=this.viewport)==null||te.scrollLines(X)}paste(X){(0,_.paste)(X,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(X){this._customKeyEventHandler=X}attachCustomWheelEventHandler(X){this._customWheelEventHandler=X}registerLinkProvider(X){return this._linkProviderService.registerLinkProvider(X)}registerCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const H=this._characterJoinerService.register(X);return this.refresh(0,this.rows-1),H}deregisterCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(X)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(X){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+X)}registerDecoration(X){return this._decorationService.registerDecoration(X)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(X,H,re){this._selectionService.setSelection(X,H,re)}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 X;(X=this._selectionService)==null||X.clearSelection()}selectAll(){var X;(X=this._selectionService)==null||X.selectAll()}selectLines(X,H){var re;(re=this._selectionService)==null||re.selectLines(X,H)}_keyDown(X){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;const H=this.browser.isMac&&this.options.macOptionIsMeta&&X.altKey;if(!H&&!this._compositionHelper.keydown(X))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;H||X.key!=="Dead"&&X.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const re=(0,V.evaluateKeyboardEvent)(X,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(X),re.type===3||re.type===2){const te=this.rows-1;return this.scrollLines(re.type===2?-te:te),this.cancel(X,!0)}return re.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,X)||(re.cancel&&this.cancel(X,!0),!re.key||!!(X.key&&!X.ctrlKey&&!X.altKey&&!X.metaKey&&X.key.length===1&&X.key.charCodeAt(0)>=65&&X.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(re.key!==K.C0.ETX&&re.key!==K.C0.CR||(this.textarea.value=""),this._onKey.fire({key:re.key,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(re.key,!0),!this.optionsService.rawOptions.screenReaderMode||X.altKey||X.ctrlKey?this.cancel(X,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(X,H){const re=X.isMac&&!this.options.macOptionIsMeta&&H.altKey&&!H.ctrlKey&&!H.metaKey||X.isWindows&&H.altKey&&H.ctrlKey&&!H.metaKey||X.isWindows&&H.getModifierState("AltGraph");return H.type==="keypress"?re:re&&(!H.keyCode||H.keyCode>47)}_keyUp(X){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1||((function(H){return H.keyCode===16||H.keyCode===17||H.keyCode===18})(X)||this.focus(),this.updateCursorStyle(X),this._keyPressHandled=!1)}_keyPress(X){let H;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;if(this.cancel(X),X.charCode)H=X.charCode;else if(X.which===null||X.which===void 0)H=X.keyCode;else{if(X.which===0||X.charCode===0)return!1;H=X.which}return!(!H||(X.altKey||X.ctrlKey||X.metaKey)&&!this._isThirdLevelShift(this.browser,X)||(H=String.fromCharCode(H),this._onKey.fire({key:H,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(H,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(X){if(X.data&&X.inputType==="insertText"&&(!X.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const H=X.data;return this.coreService.triggerDataEvent(H,!0),this.cancel(X),!0}return!1}resize(X,H){X!==this.cols||H!==this.rows?super.resize(X,H):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(X,H){var re,te;(re=this._charSizeService)==null||re.measure(),(te=this.viewport)==null||te.syncScrollArea(!0)}clear(){var X;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 H=1;H<this.rows;H++)this.buffer.lines.push(this.buffer.getBlankLine(U.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(X=this.viewport)==null||X.reset(),this.refresh(0,this.rows-1)}}reset(){var H,re;this.options.rows=this.rows,this.options.cols=this.cols;const X=this._customKeyEventHandler;this._setup(),super.reset(),(H=this._selectionService)==null||H.reset(),this._decorationService.reset(),(re=this.viewport)==null||re.reset(),this._customKeyEventHandler=X,this.refresh(0,this.rows-1)}clearTextureAtlas(){var X;(X=this._renderService)==null||X.clearTextureAtlas()}_reportFocus(){var X;(X=this.element)!=null&&X.classList.contains("focus")?this.coreService.triggerDataEvent(K.C0.ESC+"[I"):this.coreService.triggerDataEvent(K.C0.ESC+"[O")}_reportWindowsOptions(X){if(this._renderService)switch(X){case F.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const H=this._renderService.dimensions.css.canvas.width.toFixed(0),re=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${K.C0.ESC}[4;${re};${H}t`);break;case F.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const te=this._renderService.dimensions.css.cell.width.toFixed(0),ce=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${K.C0.ESC}[6;${ce};${te}t`)}}cancel(X,H){if(this.options.cancelEvents||H)return X.preventDefault(),X.stopPropagation(),!1}}a.Terminal=ie},9924:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.TimeBasedDebouncer=void 0,a.TimeBasedDebouncer=class{constructor(l,_=1e3){this._renderCallback=l,this._debounceThresholdMS=_,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(l,_,v){this._rowCount=v,l=l!==void 0?l:0,_=_!==void 0?_:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,l):l,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,_):_;const c=Date.now();if(c-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=c,this._innerRefresh();else if(!this._additionalRefreshRequested){const m=c-this._lastRefreshMs,C=this._debounceThresholdMS-m;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),C)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const l=Math.max(this._rowStart,0),_=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(l,_)}}},1680:function(y,a,l){var _=this&&this.__decorate||function(p,d,u,w){var L,R=arguments.length,D=R<3?d:w===null?w=Object.getOwnPropertyDescriptor(d,u):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(p,d,u,w);else for(var k=p.length-1;k>=0;k--)(L=p[k])&&(D=(R<3?L(D):R>3?L(d,u,D):L(d,u))||D);return R>3&&D&&Object.defineProperty(d,u,D),D},v=this&&this.__param||function(p,d){return function(u,w){d(u,w,p)}};Object.defineProperty(a,"__esModule",{value:!0}),a.Viewport=void 0;const c=l(3656),m=l(4725),C=l(8460),b=l(844),x=l(2585);let f=a.Viewport=class extends b.Disposable{constructor(p,d,u,w,L,R,D,k){super(),this._viewportElement=p,this._scrollArea=d,this._bufferService=u,this._optionsService=w,this._charSizeService=L,this._renderService=R,this._coreBrowserService=D,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new C.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,c.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((M=>this._activeBuffer=M.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((M=>this._renderDimensions=M))),this._handleThemeChange(k.colors),this.register(k.onChangeColors((M=>this._handleThemeChange(M)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(p){this._viewportElement.style.backgroundColor=p.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(p){if(p)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const d=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==d&&(this._lastRecordedBufferHeight=d,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const p=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==p&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=p),this._refreshAnimationFrame=null}syncScrollArea(p=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(p);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(p)}_handleScroll(p){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const d=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:d,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const p=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(p*(this._smoothScrollState.target-this._smoothScrollState.origin)),p<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(p,d){const u=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(d<0&&this._viewportElement.scrollTop!==0||d>0&&u<this._lastRecordedBufferHeight)||(p.cancelable&&p.preventDefault(),!1)}handleWheel(p){const d=this._getPixelsScrolled(p);return d!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+d:this._smoothScrollState.target+=d,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=d,this._bubbleScroll(p,d))}scrollLines(p){if(p!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const d=p*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+d,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:p,suppressScrollEvent:!1})}_getPixelsScrolled(p){if(p.deltaY===0||p.shiftKey)return 0;let d=this._applyScrollModifier(p.deltaY,p);return p.deltaMode===WheelEvent.DOM_DELTA_LINE?d*=this._currentRowHeight:p.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(d*=this._currentRowHeight*this._bufferService.rows),d}getBufferElements(p,d){var k;let u,w="";const L=[],R=d??this._bufferService.buffer.lines.length,D=this._bufferService.buffer.lines;for(let M=p;M<R;M++){const W=D.get(M);if(!W)continue;const z=(k=D.get(M+1))==null?void 0:k.isWrapped;if(w+=W.translateToString(!z),!z||M===D.length-1){const j=document.createElement("div");j.textContent=w,L.push(j),w.length>0&&(u=j),w=""}}return{bufferElements:L,cursorElement:u}}getLinesScrolled(p){if(p.deltaY===0||p.shiftKey)return 0;let d=this._applyScrollModifier(p.deltaY,p);return p.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(d/=this._currentRowHeight+0,this._wheelPartialScroll+=d,d=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):p.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(d*=this._bufferService.rows),d}_applyScrollModifier(p,d){const u=this._optionsService.rawOptions.fastScrollModifier;return u==="alt"&&d.altKey||u==="ctrl"&&d.ctrlKey||u==="shift"&&d.shiftKey?p*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:p*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(p){this._lastTouchY=p.touches[0].pageY}handleTouchMove(p){const d=this._lastTouchY-p.touches[0].pageY;return this._lastTouchY=p.touches[0].pageY,d!==0&&(this._viewportElement.scrollTop+=d,this._bubbleScroll(p,d))}};a.Viewport=f=_([v(2,x.IBufferService),v(3,x.IOptionsService),v(4,m.ICharSizeService),v(5,m.IRenderService),v(6,m.ICoreBrowserService),v(7,m.IThemeService)],f)},3107:function(y,a,l){var _=this&&this.__decorate||function(x,f,p,d){var u,w=arguments.length,L=w<3?f:d===null?d=Object.getOwnPropertyDescriptor(f,p):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(x,f,p,d);else for(var R=x.length-1;R>=0;R--)(u=x[R])&&(L=(w<3?u(L):w>3?u(f,p,L):u(f,p))||L);return w>3&&L&&Object.defineProperty(f,p,L),L},v=this&&this.__param||function(x,f){return function(p,d){f(p,d,x)}};Object.defineProperty(a,"__esModule",{value:!0}),a.BufferDecorationRenderer=void 0;const c=l(4725),m=l(844),C=l(2585);let b=a.BufferDecorationRenderer=class extends m.Disposable{constructor(x,f,p,d,u){super(),this._screenElement=x,this._bufferService=f,this._coreBrowserService=p,this._decorationService=d,this._renderService=u,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((w=>this._removeDecoration(w)))),this.register((0,m.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const x of this._decorationService.decorations)this._renderDecoration(x);this._dimensionsChanged=!1}_renderDecoration(x){this._refreshStyle(x),this._dimensionsChanged&&this._refreshXPosition(x)}_createElement(x){var d;const f=this._coreBrowserService.mainDocument.createElement("div");f.classList.add("xterm-decoration"),f.classList.toggle("xterm-decoration-top-layer",((d=x==null?void 0:x.options)==null?void 0:d.layer)==="top"),f.style.width=`${Math.round((x.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,f.style.height=(x.options.height||1)*this._renderService.dimensions.css.cell.height+"px",f.style.top=(x.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",f.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const p=x.options.x??0;return p&&p>this._bufferService.cols&&(f.style.display="none"),this._refreshXPosition(x,f),f}_refreshStyle(x){const f=x.marker.line-this._bufferService.buffers.active.ydisp;if(f<0||f>=this._bufferService.rows)x.element&&(x.element.style.display="none",x.onRenderEmitter.fire(x.element));else{let p=this._decorationElements.get(x);p||(p=this._createElement(x),x.element=p,this._decorationElements.set(x,p),this._container.appendChild(p),x.onDispose((()=>{this._decorationElements.delete(x),p.remove()}))),p.style.top=f*this._renderService.dimensions.css.cell.height+"px",p.style.display=this._altBufferIsActive?"none":"block",x.onRenderEmitter.fire(p)}}_refreshXPosition(x,f=x.element){if(!f)return;const p=x.options.x??0;(x.options.anchor||"left")==="right"?f.style.right=p?p*this._renderService.dimensions.css.cell.width+"px":"":f.style.left=p?p*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(x){var f;(f=this._decorationElements.get(x))==null||f.remove(),this._decorationElements.delete(x),x.dispose()}};a.BufferDecorationRenderer=b=_([v(1,C.IBufferService),v(2,c.ICoreBrowserService),v(3,C.IDecorationService),v(4,c.IRenderService)],b)},5871:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ColorZoneStore=void 0,a.ColorZoneStore=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(l){if(l.options.overviewRulerOptions){for(const _ of this._zones)if(_.color===l.options.overviewRulerOptions.color&&_.position===l.options.overviewRulerOptions.position){if(this._lineIntersectsZone(_,l.marker.line))return;if(this._lineAdjacentToZone(_,l.marker.line,l.options.overviewRulerOptions.position))return void this._addLineToZone(_,l.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=l.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=l.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=l.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=l.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:l.options.overviewRulerOptions.color,position:l.options.overviewRulerOptions.position,startBufferLine:l.marker.line,endBufferLine:l.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(l){this._linePadding=l}_lineIntersectsZone(l,_){return _>=l.startBufferLine&&_<=l.endBufferLine}_lineAdjacentToZone(l,_,v){return _>=l.startBufferLine-this._linePadding[v||"full"]&&_<=l.endBufferLine+this._linePadding[v||"full"]}_addLineToZone(l,_){l.startBufferLine=Math.min(l.startBufferLine,_),l.endBufferLine=Math.max(l.endBufferLine,_)}}},5744:function(y,a,l){var _=this&&this.__decorate||function(u,w,L,R){var D,k=arguments.length,M=k<3?w:R===null?R=Object.getOwnPropertyDescriptor(w,L):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(u,w,L,R);else for(var W=u.length-1;W>=0;W--)(D=u[W])&&(M=(k<3?D(M):k>3?D(w,L,M):D(w,L))||M);return k>3&&M&&Object.defineProperty(w,L,M),M},v=this&&this.__param||function(u,w){return function(L,R){w(L,R,u)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OverviewRulerRenderer=void 0;const c=l(5871),m=l(4725),C=l(844),b=l(2585),x={full:0,left:0,center:0,right:0},f={full:0,left:0,center:0,right:0},p={full:0,left:0,center:0,right:0};let d=a.OverviewRulerRenderer=class extends C.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(u,w,L,R,D,k,M){var z;super(),this._viewportElement=u,this._screenElement=w,this._bufferService=L,this._decorationService=R,this._renderService=D,this._optionsService=k,this._coreBrowserService=M,this._colorZoneStore=new c.ColorZoneStore,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(),(z=this._viewportElement.parentElement)==null||z.insertBefore(this._canvas,this._viewportElement);const W=this._canvas.getContext("2d");if(!W)throw new Error("Ctx cannot be null");this._ctx=W,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,C.toDisposable)((()=>{var j;(j=this._canvas)==null||j.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){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())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const u=Math.floor(this._canvas.width/3),w=Math.ceil(this._canvas.width/3);f.full=this._canvas.width,f.left=u,f.center=w,f.right=u,this._refreshDrawHeightConstants(),p.full=0,p.left=0,p.center=f.left,p.right=f.left+f.center}_refreshDrawHeightConstants(){x.full=Math.round(2*this._coreBrowserService.dpr);const u=this._canvas.height/this._bufferService.buffer.lines.length,w=Math.round(Math.max(Math.min(u,12),6)*this._coreBrowserService.dpr);x.left=w,x.center=w,x.right=w}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*x.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*x.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*x.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*x.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(const w of this._decorationService.decorations)this._colorZoneStore.addDecoration(w);this._ctx.lineWidth=1;const u=this._colorZoneStore.zones;for(const w of u)w.position!=="full"&&this._renderColorZone(w);for(const w of u)w.position==="full"&&this._renderColorZone(w);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(u){this._ctx.fillStyle=u.color,this._ctx.fillRect(p[u.position||"full"],Math.round((this._canvas.height-1)*(u.startBufferLine/this._bufferService.buffers.active.lines.length)-x[u.position||"full"]/2),f[u.position||"full"],Math.round((this._canvas.height-1)*((u.endBufferLine-u.startBufferLine)/this._bufferService.buffers.active.lines.length)+x[u.position||"full"]))}_queueRefresh(u,w){this._shouldUpdateDimensions=u||this._shouldUpdateDimensions,this._shouldUpdateAnchor=w||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};a.OverviewRulerRenderer=d=_([v(2,b.IBufferService),v(3,b.IDecorationService),v(4,m.IRenderService),v(5,b.IOptionsService),v(6,m.ICoreBrowserService)],d)},2950:function(y,a,l){var _=this&&this.__decorate||function(x,f,p,d){var u,w=arguments.length,L=w<3?f:d===null?d=Object.getOwnPropertyDescriptor(f,p):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(x,f,p,d);else for(var R=x.length-1;R>=0;R--)(u=x[R])&&(L=(w<3?u(L):w>3?u(f,p,L):u(f,p))||L);return w>3&&L&&Object.defineProperty(f,p,L),L},v=this&&this.__param||function(x,f){return function(p,d){f(p,d,x)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CompositionHelper=void 0;const c=l(4725),m=l(2585),C=l(2584);let b=a.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(x,f,p,d,u,w){this._textarea=x,this._compositionView=f,this._bufferService=p,this._optionsService=d,this._coreService=u,this._renderService=w,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(x){this._compositionView.textContent=x.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(x){if(this._isComposing||this._isSendingComposition){if(x.keyCode===229||x.keyCode===16||x.keyCode===17||x.keyCode===18)return!1;this._finalizeComposition(!1)}return x.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(x){if(this._compositionView.classList.remove("active"),this._isComposing=!1,x){const f={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let p;this._isSendingComposition=!1,f.start+=this._dataAlreadySent.length,p=this._isComposing?this._textarea.value.substring(f.start,f.end):this._textarea.value.substring(f.start),p.length>0&&this._coreService.triggerDataEvent(p,!0)}}),0)}else{this._isSendingComposition=!1;const f=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(f,!0)}}_handleAnyTextareaChanges(){const x=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const f=this._textarea.value,p=f.replace(x,"");this._dataAlreadySent=p,f.length>x.length?this._coreService.triggerDataEvent(p,!0):f.length<x.length?this._coreService.triggerDataEvent(`${C.C0.DEL}`,!0):f.length===x.length&&f!==x&&this._coreService.triggerDataEvent(f,!0)}}),0)}updateCompositionElements(x){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const f=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),p=this._renderService.dimensions.css.cell.height,d=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,u=f*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=u+"px",this._compositionView.style.top=d+"px",this._compositionView.style.height=p+"px",this._compositionView.style.lineHeight=p+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const w=this._compositionView.getBoundingClientRect();this._textarea.style.left=u+"px",this._textarea.style.top=d+"px",this._textarea.style.width=Math.max(w.width,1)+"px",this._textarea.style.height=Math.max(w.height,1)+"px",this._textarea.style.lineHeight=w.height+"px"}x||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};a.CompositionHelper=b=_([v(2,m.IBufferService),v(3,m.IOptionsService),v(4,m.ICoreService),v(5,c.IRenderService)],b)},9806:(y,a)=>{function l(_,v,c){const m=c.getBoundingClientRect(),C=_.getComputedStyle(c),b=parseInt(C.getPropertyValue("padding-left")),x=parseInt(C.getPropertyValue("padding-top"));return[v.clientX-m.left-b,v.clientY-m.top-x]}Object.defineProperty(a,"__esModule",{value:!0}),a.getCoords=a.getCoordsRelativeToElement=void 0,a.getCoordsRelativeToElement=l,a.getCoords=function(_,v,c,m,C,b,x,f,p){if(!b)return;const d=l(_,v,c);return d?(d[0]=Math.ceil((d[0]+(p?x/2:0))/x),d[1]=Math.ceil(d[1]/f),d[0]=Math.min(Math.max(d[0],1),m+(p?1:0)),d[1]=Math.min(Math.max(d[1],1),C),d):void 0}},9504:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.moveToCellSequence=void 0;const _=l(2584);function v(f,p,d,u){const w=f-c(f,d),L=p-c(p,d),R=Math.abs(w-L)-(function(D,k,M){let W=0;const z=D-c(D,M),j=k-c(k,M);for(let N=0;N<Math.abs(z-j);N++){const I=m(D,k)==="A"?-1:1,q=M.buffer.lines.get(z+I*N);q!=null&&q.isWrapped&&W++}return W})(f,p,d);return x(R,b(m(f,p),u))}function c(f,p){let d=0,u=p.buffer.lines.get(f),w=u==null?void 0:u.isWrapped;for(;w&&f>=0&&f<p.rows;)d++,u=p.buffer.lines.get(--f),w=u==null?void 0:u.isWrapped;return d}function m(f,p){return f>p?"A":"B"}function C(f,p,d,u,w,L){let R=f,D=p,k="";for(;R!==d||D!==u;)R+=w?1:-1,w&&R>L.cols-1?(k+=L.buffer.translateBufferLineToString(D,!1,f,R),R=0,f=0,D++):!w&&R<0&&(k+=L.buffer.translateBufferLineToString(D,!1,0,f+1),R=L.cols-1,f=R,D--);return k+L.buffer.translateBufferLineToString(D,!1,f,R)}function b(f,p){const d=p?"O":"[";return _.C0.ESC+d+f}function x(f,p){f=Math.floor(f);let d="";for(let u=0;u<f;u++)d+=p;return d}a.moveToCellSequence=function(f,p,d,u){const w=d.buffer.x,L=d.buffer.y;if(!d.buffer.hasScrollback)return(function(k,M,W,z,j,N){return v(M,z,j,N).length===0?"":x(C(k,M,k,M-c(M,j),!1,j).length,b("D",N))})(w,L,0,p,d,u)+v(L,p,d,u)+(function(k,M,W,z,j,N){let I;I=v(M,z,j,N).length>0?z-c(z,j):M;const q=z,U=(function(K,V,T,B,P,F){let Y;return Y=v(T,B,P,F).length>0?B-c(B,P):V,K<T&&Y<=B||K>=T&&Y<B?"C":"D"})(k,M,W,z,j,N);return x(C(k,I,W,q,U==="C",j).length,b(U,N))})(w,L,f,p,d,u);let R;if(L===p)return R=w>f?"D":"C",x(Math.abs(w-f),b(R,u));R=L>p?"D":"C";const D=Math.abs(L-p);return x((function(k,M){return M.cols-k})(L>p?f:w,d)+(D-1)*d.cols+1+((L>p?w:f)-1),b(R,u))}},1296:function(y,a,l){var _=this&&this.__decorate||function(N,I,q,U){var K,V=arguments.length,T=V<3?I:U===null?U=Object.getOwnPropertyDescriptor(I,q):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(N,I,q,U);else for(var B=N.length-1;B>=0;B--)(K=N[B])&&(T=(V<3?K(T):V>3?K(I,q,T):K(I,q))||T);return V>3&&T&&Object.defineProperty(I,q,T),T},v=this&&this.__param||function(N,I){return function(q,U){I(q,U,N)}};Object.defineProperty(a,"__esModule",{value:!0}),a.DomRenderer=void 0;const c=l(3787),m=l(2550),C=l(2223),b=l(6171),x=l(6052),f=l(4725),p=l(8055),d=l(8460),u=l(844),w=l(2585),L="xterm-dom-renderer-owner-",R="xterm-rows",D="xterm-fg-",k="xterm-bg-",M="xterm-focus",W="xterm-selection";let z=1,j=a.DomRenderer=class extends u.Disposable{constructor(N,I,q,U,K,V,T,B,P,F,Y,Z,ie){super(),this._terminal=N,this._document=I,this._element=q,this._screenElement=U,this._viewportElement=K,this._helperContainer=V,this._linkifier2=T,this._charSizeService=P,this._optionsService=F,this._bufferService=Y,this._coreBrowserService=Z,this._themeService=ie,this._terminalClass=z++,this._rowElements=[],this._selectionRenderModel=(0,x.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new d.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(R),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(W),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,b.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((ae=>this._injectCss(ae)))),this._injectCss(this._themeService.colors),this._rowFactory=B.createInstance(c.DomRendererRowFactory,document),this._element.classList.add(L+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((ae=>this._handleLinkHover(ae)))),this.register(this._linkifier2.onHideLinkUnderline((ae=>this._handleLinkLeave(ae)))),this.register((0,u.toDisposable)((()=>{this._element.classList.remove(L+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new m.WidthCache(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(){const N=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*N,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*N),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/N),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/N),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(const q of this._rowElements)q.style.width=`${this.dimensions.css.canvas.width}px`,q.style.height=`${this.dimensions.css.cell.height}px`,q.style.lineHeight=`${this.dimensions.css.cell.height}px`,q.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const I=`${this._terminalSelector} .${R} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=I,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(N){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let I=`${this._terminalSelector} .${R} { color: ${N.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;I+=`${this._terminalSelector} .${R} .xterm-dim { color: ${p.color.multiplyOpacity(N.foreground,.5).css};}`,I+=`${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;}`;const q=`blink_underline_${this._terminalClass}`,U=`blink_bar_${this._terminalClass}`,K=`blink_block_${this._terminalClass}`;I+=`@keyframes ${q} { 50% { border-bottom-style: hidden; }}`,I+=`@keyframes ${U} { 50% { box-shadow: none; }}`,I+=`@keyframes ${K} { 0% { background-color: ${N.cursor.css}; color: ${N.cursorAccent.css}; } 50% { background-color: inherit; color: ${N.cursor.css}; }}`,I+=`${this._terminalSelector} .${R}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${q} 1s step-end infinite;}${this._terminalSelector} .${R}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${R}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${K} 1s step-end infinite;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-block { background-color: ${N.cursor.css}; color: ${N.cursorAccent.css};}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${N.cursor.css} !important; color: ${N.cursorAccent.css} !important;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${N.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${N.cursor.css} inset;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${N.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,I+=`${this._terminalSelector} .${W} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${W} div { position: absolute; background-color: ${N.selectionBackgroundOpaque.css};}${this._terminalSelector} .${W} div { position: absolute; background-color: ${N.selectionInactiveBackgroundOpaque.css};}`;for(const[V,T]of N.ansi.entries())I+=`${this._terminalSelector} .${D}${V} { color: ${T.css}; }${this._terminalSelector} .${D}${V}.xterm-dim { color: ${p.color.multiplyOpacity(T,.5).css}; }${this._terminalSelector} .${k}${V} { background-color: ${T.css}; }`;I+=`${this._terminalSelector} .${D}${C.INVERTED_DEFAULT_COLOR} { color: ${p.color.opaque(N.background).css}; }${this._terminalSelector} .${D}${C.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${p.color.multiplyOpacity(p.color.opaque(N.background),.5).css}; }${this._terminalSelector} .${k}${C.INVERTED_DEFAULT_COLOR} { background-color: ${N.foreground.css}; }`,this._themeStyleElement.textContent=I}_setDefaultSpacing(){const N=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${N}px`,this._rowFactory.defaultSpacing=N}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(N,I){for(let q=this._rowElements.length;q<=I;q++){const U=this._document.createElement("div");this._rowContainer.appendChild(U),this._rowElements.push(U)}for(;this._rowElements.length>I;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(N,I){this._refreshRowElements(N,I),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(M),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(M),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(N,I,q){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(N,I,q),this.renderRows(0,this._bufferService.rows-1),!N||!I)return;this._selectionRenderModel.update(this._terminal,N,I,q);const U=this._selectionRenderModel.viewportStartRow,K=this._selectionRenderModel.viewportEndRow,V=this._selectionRenderModel.viewportCappedStartRow,T=this._selectionRenderModel.viewportCappedEndRow;if(V>=this._bufferService.rows||T<0)return;const B=this._document.createDocumentFragment();if(q){const P=N[0]>I[0];B.appendChild(this._createSelectionElement(V,P?I[0]:N[0],P?N[0]:I[0],T-V+1))}else{const P=U===V?N[0]:0,F=V===K?I[0]:this._bufferService.cols;B.appendChild(this._createSelectionElement(V,P,F));const Y=T-V-1;if(B.appendChild(this._createSelectionElement(V+1,0,this._bufferService.cols,Y)),V!==T){const Z=K===T?I[0]:this._bufferService.cols;B.appendChild(this._createSelectionElement(T,0,Z))}}this._selectionContainer.appendChild(B)}_createSelectionElement(N,I,q,U=1){const K=this._document.createElement("div"),V=I*this.dimensions.css.cell.width;let T=this.dimensions.css.cell.width*(q-I);return V+T>this.dimensions.css.canvas.width&&(T=this.dimensions.css.canvas.width-V),K.style.height=U*this.dimensions.css.cell.height+"px",K.style.top=N*this.dimensions.css.cell.height+"px",K.style.left=`${V}px`,K.style.width=`${T}px`,K}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(const N of this._rowElements)N.replaceChildren()}renderRows(N,I){const q=this._bufferService.buffer,U=q.ybase+q.y,K=Math.min(q.x,this._bufferService.cols-1),V=this._optionsService.rawOptions.cursorBlink,T=this._optionsService.rawOptions.cursorStyle,B=this._optionsService.rawOptions.cursorInactiveStyle;for(let P=N;P<=I;P++){const F=P+q.ydisp,Y=this._rowElements[P],Z=q.lines.get(F);if(!Y||!Z)break;Y.replaceChildren(...this._rowFactory.createRow(Z,F,F===U,T,B,K,V,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${L}${this._terminalClass}`}_handleLinkHover(N){this._setCellUnderline(N.x1,N.x2,N.y1,N.y2,N.cols,!0)}_handleLinkLeave(N){this._setCellUnderline(N.x1,N.x2,N.y1,N.y2,N.cols,!1)}_setCellUnderline(N,I,q,U,K,V){q<0&&(N=0),U<0&&(I=0);const T=this._bufferService.rows-1;q=Math.max(Math.min(q,T),0),U=Math.max(Math.min(U,T),0),K=Math.min(K,this._bufferService.cols);const B=this._bufferService.buffer,P=B.ybase+B.y,F=Math.min(B.x,K-1),Y=this._optionsService.rawOptions.cursorBlink,Z=this._optionsService.rawOptions.cursorStyle,ie=this._optionsService.rawOptions.cursorInactiveStyle;for(let ae=q;ae<=U;++ae){const X=ae+B.ydisp,H=this._rowElements[ae],re=B.lines.get(X);if(!H||!re)break;H.replaceChildren(...this._rowFactory.createRow(re,X,X===P,Z,ie,F,Y,this.dimensions.css.cell.width,this._widthCache,V?ae===q?N:0:-1,V?(ae===U?I:K)-1:-1))}}};a.DomRenderer=j=_([v(7,w.IInstantiationService),v(8,f.ICharSizeService),v(9,w.IOptionsService),v(10,w.IBufferService),v(11,f.ICoreBrowserService),v(12,f.IThemeService)],j)},3787:function(y,a,l){var _=this&&this.__decorate||function(R,D,k,M){var W,z=arguments.length,j=z<3?D:M===null?M=Object.getOwnPropertyDescriptor(D,k):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(R,D,k,M);else for(var N=R.length-1;N>=0;N--)(W=R[N])&&(j=(z<3?W(j):z>3?W(D,k,j):W(D,k))||j);return z>3&&j&&Object.defineProperty(D,k,j),j},v=this&&this.__param||function(R,D){return function(k,M){D(k,M,R)}};Object.defineProperty(a,"__esModule",{value:!0}),a.DomRendererRowFactory=void 0;const c=l(2223),m=l(643),C=l(511),b=l(2585),x=l(8055),f=l(4725),p=l(4269),d=l(6171),u=l(3734);let w=a.DomRendererRowFactory=class{constructor(R,D,k,M,W,z,j){this._document=R,this._characterJoinerService=D,this._optionsService=k,this._coreBrowserService=M,this._coreService=W,this._decorationService=z,this._themeService=j,this._workCell=new C.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(R,D,k){this._selectionStart=R,this._selectionEnd=D,this._columnSelectMode=k}createRow(R,D,k,M,W,z,j,N,I,q,U){const K=[],V=this._characterJoinerService.getJoinedCharacters(D),T=this._themeService.colors;let B,P=R.getNoBgTrimmedLength();k&&P<z+1&&(P=z+1);let F=0,Y="",Z=0,ie=0,ae=0,X=!1,H=0,re=!1,te=0;const ce=[],le=q!==-1&&U!==-1;for(let pe=0;pe<P;pe++){R.loadCell(pe,this._workCell);let Se=this._workCell.getWidth();if(Se===0)continue;let be=!1,ue=pe,ge=this._workCell;if(V.length>0&&pe===V[0][0]){be=!0;const Oe=V.shift();ge=new p.JoinedCellData(this._workCell,R.translateToString(!0,Oe[0],Oe[1]),Oe[1]-Oe[0]),ue=Oe[1]-1,Se=ge.getWidth()}const Re=this._isCellInSelection(pe,D),Ie=k&&pe===z,ze=le&&pe>=q&&pe<=U;let Qe=!1;this._decorationService.forEachDecorationAtCell(pe,D,void 0,(Oe=>{Qe=!0}));let ut=ge.getChars()||m.WHITESPACE_CELL_CHAR;if(ut===" "&&(ge.isUnderline()||ge.isOverline())&&(ut=" "),te=Se*N-I.get(ut,ge.isBold(),ge.isItalic()),B){if(F&&(Re&&re||!Re&&!re&&ge.bg===Z)&&(Re&&re&&T.selectionForeground||ge.fg===ie)&&ge.extended.ext===ae&&ze===X&&te===H&&!Ie&&!be&&!Qe){ge.isInvisible()?Y+=m.WHITESPACE_CELL_CHAR:Y+=ut,F++;continue}F&&(B.textContent=Y),B=this._document.createElement("span"),F=0,Y=""}else B=this._document.createElement("span");if(Z=ge.bg,ie=ge.fg,ae=ge.extended.ext,X=ze,H=te,re=Re,be&&z>=pe&&z<=ue&&(z=pe),!this._coreService.isCursorHidden&&Ie&&this._coreService.isCursorInitialized){if(ce.push("xterm-cursor"),this._coreBrowserService.isFocused)j&&ce.push("xterm-cursor-blink"),ce.push(M==="bar"?"xterm-cursor-bar":M==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(W)switch(W){case"outline":ce.push("xterm-cursor-outline");break;case"block":ce.push("xterm-cursor-block");break;case"bar":ce.push("xterm-cursor-bar");break;case"underline":ce.push("xterm-cursor-underline")}}if(ge.isBold()&&ce.push("xterm-bold"),ge.isItalic()&&ce.push("xterm-italic"),ge.isDim()&&ce.push("xterm-dim"),Y=ge.isInvisible()?m.WHITESPACE_CELL_CHAR:ge.getChars()||m.WHITESPACE_CELL_CHAR,ge.isUnderline()&&(ce.push(`xterm-underline-${ge.extended.underlineStyle}`),Y===" "&&(Y=" "),!ge.isUnderlineColorDefault()))if(ge.isUnderlineColorRGB())B.style.textDecorationColor=`rgb(${u.AttributeData.toColorRGB(ge.getUnderlineColor()).join(",")})`;else{let Oe=ge.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ge.isBold()&&Oe<8&&(Oe+=8),B.style.textDecorationColor=T.ansi[Oe].css}ge.isOverline()&&(ce.push("xterm-overline"),Y===" "&&(Y=" ")),ge.isStrikethrough()&&ce.push("xterm-strikethrough"),ze&&(B.style.textDecoration="underline");let qe=ge.getFgColor(),pt=ge.getFgColorMode(),Ne=ge.getBgColor(),Je=ge.getBgColorMode();const ht=!!ge.isInverse();if(ht){const Oe=qe;qe=Ne,Ne=Oe;const Rn=pt;pt=Je,Je=Rn}let $e,pr,ot,Rt=!1;switch(this._decorationService.forEachDecorationAtCell(pe,D,void 0,(Oe=>{Oe.options.layer!=="top"&&Rt||(Oe.backgroundColorRGB&&(Je=50331648,Ne=Oe.backgroundColorRGB.rgba>>8&16777215,$e=Oe.backgroundColorRGB),Oe.foregroundColorRGB&&(pt=50331648,qe=Oe.foregroundColorRGB.rgba>>8&16777215,pr=Oe.foregroundColorRGB),Rt=Oe.options.layer==="top")})),!Rt&&Re&&($e=this._coreBrowserService.isFocused?T.selectionBackgroundOpaque:T.selectionInactiveBackgroundOpaque,Ne=$e.rgba>>8&16777215,Je=50331648,Rt=!0,T.selectionForeground&&(pt=50331648,qe=T.selectionForeground.rgba>>8&16777215,pr=T.selectionForeground)),Rt&&ce.push("xterm-decoration-top"),Je){case 16777216:case 33554432:ot=T.ansi[Ne],ce.push(`xterm-bg-${Ne}`);break;case 50331648:ot=x.channels.toColor(Ne>>16,Ne>>8&255,255&Ne),this._addStyle(B,`background-color:#${L((Ne>>>0).toString(16),"0",6)}`);break;default:ht?(ot=T.foreground,ce.push(`xterm-bg-${c.INVERTED_DEFAULT_COLOR}`)):ot=T.background}switch($e||ge.isDim()&&($e=x.color.multiplyOpacity(ot,.5)),pt){case 16777216:case 33554432:ge.isBold()&&qe<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(qe+=8),this._applyMinimumContrast(B,ot,T.ansi[qe],ge,$e,void 0)||ce.push(`xterm-fg-${qe}`);break;case 50331648:const Oe=x.channels.toColor(qe>>16&255,qe>>8&255,255&qe);this._applyMinimumContrast(B,ot,Oe,ge,$e,pr)||this._addStyle(B,`color:#${L(qe.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(B,ot,T.foreground,ge,$e,pr)||ht&&ce.push(`xterm-fg-${c.INVERTED_DEFAULT_COLOR}`)}ce.length&&(B.className=ce.join(" "),ce.length=0),Ie||be||Qe?B.textContent=Y:F++,te!==this.defaultSpacing&&(B.style.letterSpacing=`${te}px`),K.push(B),pe=ue}return B&&F&&(B.textContent=Y),K}_applyMinimumContrast(R,D,k,M,W,z){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,d.treatGlyphAsBackgroundColor)(M.getCode()))return!1;const j=this._getContrastCache(M);let N;if(W||z||(N=j.getColor(D.rgba,k.rgba)),N===void 0){const I=this._optionsService.rawOptions.minimumContrastRatio/(M.isDim()?2:1);N=x.color.ensureContrastRatio(W||D,z||k,I),j.setColor((W||D).rgba,(z||k).rgba,N??null)}return!!N&&(this._addStyle(R,`color:${N.css}`),!0)}_getContrastCache(R){return R.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(R,D){R.setAttribute("style",`${R.getAttribute("style")||""}${D};`)}_isCellInSelection(R,D){const k=this._selectionStart,M=this._selectionEnd;return!(!k||!M)&&(this._columnSelectMode?k[0]<=M[0]?R>=k[0]&&D>=k[1]&&R<M[0]&&D<=M[1]:R<k[0]&&D>=k[1]&&R>=M[0]&&D<=M[1]:D>k[1]&&D<M[1]||k[1]===M[1]&&D===k[1]&&R>=k[0]&&R<M[0]||k[1]<M[1]&&D===M[1]&&R<M[0]||k[1]<M[1]&&D===k[1]&&R>=k[0])}};function L(R,D,k){for(;R.length<k;)R=D+R;return R}a.DomRendererRowFactory=w=_([v(1,f.ICharacterJoinerService),v(2,b.IOptionsService),v(3,f.ICoreBrowserService),v(4,b.ICoreService),v(5,b.IDecorationService),v(6,f.IThemeService)],w)},2550:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WidthCache=void 0,a.WidthCache=class{constructor(l,_){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=l.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";const v=l.createElement("span");v.classList.add("xterm-char-measure-element");const c=l.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontWeight="bold";const m=l.createElement("span");m.classList.add("xterm-char-measure-element"),m.style.fontStyle="italic";const C=l.createElement("span");C.classList.add("xterm-char-measure-element"),C.style.fontWeight="bold",C.style.fontStyle="italic",this._measureElements=[v,c,m,C],this._container.appendChild(v),this._container.appendChild(c),this._container.appendChild(m),this._container.appendChild(C),_.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(l,_,v,c){l===this._font&&_===this._fontSize&&v===this._weight&&c===this._weightBold||(this._font=l,this._fontSize=_,this._weight=v,this._weightBold=c,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${v}`,this._measureElements[1].style.fontWeight=`${c}`,this._measureElements[2].style.fontWeight=`${v}`,this._measureElements[3].style.fontWeight=`${c}`,this.clear())}get(l,_,v){let c=0;if(!_&&!v&&l.length===1&&(c=l.charCodeAt(0))<256){if(this._flat[c]!==-9999)return this._flat[c];const b=this._measure(l,0);return b>0&&(this._flat[c]=b),b}let m=l;_&&(m+="B"),v&&(m+="I");let C=this._holey.get(m);if(C===void 0){let b=0;_&&(b|=1),v&&(b|=2),C=this._measure(l,b),C>0&&this._holey.set(m,C)}return C}_measure(l,_){const v=this._measureElements[_];return v.textContent=l.repeat(32),v.offsetWidth/32}}},2223:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.TEXT_BASELINE=a.DIM_OPACITY=a.INVERTED_DEFAULT_COLOR=void 0;const _=l(6114);a.INVERTED_DEFAULT_COLOR=257,a.DIM_OPACITY=.5,a.TEXT_BASELINE=_.isFirefox||_.isLegacyEdge?"bottom":"ideographic"},6171:(y,a)=>{function l(v){return 57508<=v&&v<=57558}function _(v){return v>=128512&&v<=128591||v>=127744&&v<=128511||v>=128640&&v<=128767||v>=9728&&v<=9983||v>=9984&&v<=10175||v>=65024&&v<=65039||v>=129280&&v<=129535||v>=127462&&v<=127487}Object.defineProperty(a,"__esModule",{value:!0}),a.computeNextVariantOffset=a.createRenderDimensions=a.treatGlyphAsBackgroundColor=a.allowRescaling=a.isEmoji=a.isRestrictedPowerlineGlyph=a.isPowerlineGlyph=a.throwIfFalsy=void 0,a.throwIfFalsy=function(v){if(!v)throw new Error("value must not be falsy");return v},a.isPowerlineGlyph=l,a.isRestrictedPowerlineGlyph=function(v){return 57520<=v&&v<=57527},a.isEmoji=_,a.allowRescaling=function(v,c,m,C){return c===1&&m>Math.ceil(1.5*C)&&v!==void 0&&v>255&&!_(v)&&!l(v)&&!(function(b){return 57344<=b&&b<=63743})(v)},a.treatGlyphAsBackgroundColor=function(v){return l(v)||(function(c){return 9472<=c&&c<=9631})(v)},a.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},a.computeNextVariantOffset=function(v,c,m=0){return(v-(2*Math.round(c)-m))%(2*Math.round(c))}},6052:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.createSelectionRenderModel=void 0;class l{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(v,c,m,C=!1){if(this.selectionStart=c,this.selectionEnd=m,!c||!m||c[0]===m[0]&&c[1]===m[1])return void this.clear();const b=v.buffers.active.ydisp,x=c[1]-b,f=m[1]-b,p=Math.max(x,0),d=Math.min(f,v.rows-1);p>=v.rows||d<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=C,this.viewportStartRow=x,this.viewportEndRow=f,this.viewportCappedStartRow=p,this.viewportCappedEndRow=d,this.startCol=c[0],this.endCol=m[0])}isCellSelected(v,c,m){return!!this.hasSelection&&(m-=v.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?c>=this.startCol&&m>=this.viewportCappedStartRow&&c<this.endCol&&m<=this.viewportCappedEndRow:c<this.startCol&&m>=this.viewportCappedStartRow&&c>=this.endCol&&m<=this.viewportCappedEndRow:m>this.viewportStartRow&&m<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&m===this.viewportStartRow&&c>=this.startCol&&c<this.endCol||this.viewportStartRow<this.viewportEndRow&&m===this.viewportEndRow&&c<this.endCol||this.viewportStartRow<this.viewportEndRow&&m===this.viewportStartRow&&c>=this.startCol)}}a.createSelectionRenderModel=function(){return new l}},456:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.SelectionModel=void 0,a.SelectionModel=class{constructor(l){this._bufferService=l,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const l=this.selectionStart[0]+this.selectionStartLength;return l>this._bufferService.cols?l%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)-1]:[l%this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)]:[l,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const l=this.selectionStart[0]+this.selectionStartLength;return l>this._bufferService.cols?[l%this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)]:[Math.max(l,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const l=this.selectionStart,_=this.selectionEnd;return!(!l||!_)&&(l[1]>_[1]||l[1]===_[1]&&l[0]>_[0])}handleTrim(l){return this.selectionStart&&(this.selectionStart[1]-=l),this.selectionEnd&&(this.selectionEnd[1]-=l),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(y,a,l){var _=this&&this.__decorate||function(d,u,w,L){var R,D=arguments.length,k=D<3?u:L===null?L=Object.getOwnPropertyDescriptor(u,w):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(d,u,w,L);else for(var M=d.length-1;M>=0;M--)(R=d[M])&&(k=(D<3?R(k):D>3?R(u,w,k):R(u,w))||k);return D>3&&k&&Object.defineProperty(u,w,k),k},v=this&&this.__param||function(d,u){return function(w,L){u(w,L,d)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CharSizeService=void 0;const c=l(2585),m=l(8460),C=l(844);let b=a.CharSizeService=class extends C.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(d,u,w){super(),this._optionsService=w,this.width=0,this.height=0,this._onCharSizeChange=this.register(new m.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new p(this._optionsService))}catch{this._measureStrategy=this.register(new f(d,u,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const d=this._measureStrategy.measure();d.width===this.width&&d.height===this.height||(this.width=d.width,this.height=d.height,this._onCharSizeChange.fire())}};a.CharSizeService=b=_([v(2,c.IOptionsService)],b);class x extends C.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(u,w){u!==void 0&&u>0&&w!==void 0&&w>0&&(this._result.width=u,this._result.height=w)}}class f extends x{constructor(u,w,L){super(),this._document=u,this._parentElement=w,this._optionsService=L,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}}class p extends x{constructor(u){super(),this._optionsService=u,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const w=this._ctx.measureText("W");if(!("width"in w&&"fontBoundingBoxAscent"in w&&"fontBoundingBoxDescent"in w))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const u=this._ctx.measureText("W");return this._validateAndSet(u.width,u.fontBoundingBoxAscent+u.fontBoundingBoxDescent),this._result}}},4269:function(y,a,l){var _=this&&this.__decorate||function(p,d,u,w){var L,R=arguments.length,D=R<3?d:w===null?w=Object.getOwnPropertyDescriptor(d,u):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(p,d,u,w);else for(var k=p.length-1;k>=0;k--)(L=p[k])&&(D=(R<3?L(D):R>3?L(d,u,D):L(d,u))||D);return R>3&&D&&Object.defineProperty(d,u,D),D},v=this&&this.__param||function(p,d){return function(u,w){d(u,w,p)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CharacterJoinerService=a.JoinedCellData=void 0;const c=l(3734),m=l(643),C=l(511),b=l(2585);class x extends c.AttributeData{constructor(d,u,w){super(),this.content=0,this.combinedData="",this.fg=d.fg,this.bg=d.bg,this.combinedData=u,this._width=w}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(d){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}a.JoinedCellData=x;let f=a.CharacterJoinerService=class tm{constructor(d){this._bufferService=d,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new C.CellData}register(d){const u={id:this._nextCharacterJoinerId++,handler:d};return this._characterJoiners.push(u),u.id}deregister(d){for(let u=0;u<this._characterJoiners.length;u++)if(this._characterJoiners[u].id===d)return this._characterJoiners.splice(u,1),!0;return!1}getJoinedCharacters(d){if(this._characterJoiners.length===0)return[];const u=this._bufferService.buffer.lines.get(d);if(!u||u.length===0)return[];const w=[],L=u.translateToString(!0);let R=0,D=0,k=0,M=u.getFg(0),W=u.getBg(0);for(let z=0;z<u.getTrimmedLength();z++)if(u.loadCell(z,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==M||this._workCell.bg!==W){if(z-R>1){const j=this._getJoinedRanges(L,k,D,u,R);for(let N=0;N<j.length;N++)w.push(j[N])}R=z,k=D,M=this._workCell.fg,W=this._workCell.bg}D+=this._workCell.getChars().length||m.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-R>1){const z=this._getJoinedRanges(L,k,D,u,R);for(let j=0;j<z.length;j++)w.push(z[j])}return w}_getJoinedRanges(d,u,w,L,R){const D=d.substring(u,w);let k=[];try{k=this._characterJoiners[0].handler(D)}catch(M){console.error(M)}for(let M=1;M<this._characterJoiners.length;M++)try{const W=this._characterJoiners[M].handler(D);for(let z=0;z<W.length;z++)tm._mergeRanges(k,W[z])}catch(W){console.error(W)}return this._stringRangesToCellRanges(k,L,R),k}_stringRangesToCellRanges(d,u,w){let L=0,R=!1,D=0,k=d[L];if(k){for(let M=w;M<this._bufferService.cols;M++){const W=u.getWidth(M),z=u.getString(M).length||m.WHITESPACE_CELL_CHAR.length;if(W!==0){if(!R&&k[0]<=D&&(k[0]=M,R=!0),k[1]<=D){if(k[1]=M,k=d[++L],!k)break;k[0]<=D?(k[0]=M,R=!0):R=!1}D+=z}}k&&(k[1]=this._bufferService.cols)}}static _mergeRanges(d,u){let w=!1;for(let L=0;L<d.length;L++){const R=d[L];if(w){if(u[1]<=R[0])return d[L-1][1]=u[1],d;if(u[1]<=R[1])return d[L-1][1]=Math.max(u[1],R[1]),d.splice(L,1),d;d.splice(L,1),L--}else{if(u[1]<=R[0])return d.splice(L,0,u),d;if(u[1]<=R[1])return R[0]=Math.min(u[0],R[0]),d;u[0]<R[1]&&(R[0]=Math.min(u[0],R[0]),w=!0)}}return w?d[d.length-1][1]=u[1]:d.push(u),d}};a.CharacterJoinerService=f=_([v(0,b.IBufferService)],f)},5114:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CoreBrowserService=void 0;const _=l(844),v=l(8460),c=l(3656);class m extends _.Disposable{constructor(x,f,p){super(),this._textarea=x,this._window=f,this.mainDocument=p,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new C(this._window),this._onDprChange=this.register(new v.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new v.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((d=>this._screenDprMonitor.setWindow(d)))),this.register((0,v.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(x){this._window!==x&&(this._window=x,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}}a.CoreBrowserService=m;class C extends _.Disposable{constructor(x){super(),this._parentWindow=x,this._windowResizeListener=this.register(new _.MutableDisposable),this._onDprChange=this.register(new v.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,_.toDisposable)((()=>this.clearListener())))}setWindow(x){this._parentWindow=x,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,c.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var x;this._outerListener&&((x=this._resolutionMediaMatchList)==null||x.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)}}},779:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.LinkProviderService=void 0;const _=l(844);class v extends _.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,_.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(m){return this.linkProviders.push(m),{dispose:()=>{const C=this.linkProviders.indexOf(m);C!==-1&&this.linkProviders.splice(C,1)}}}}a.LinkProviderService=v},8934:function(y,a,l){var _=this&&this.__decorate||function(b,x,f,p){var d,u=arguments.length,w=u<3?x:p===null?p=Object.getOwnPropertyDescriptor(x,f):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(b,x,f,p);else for(var L=b.length-1;L>=0;L--)(d=b[L])&&(w=(u<3?d(w):u>3?d(x,f,w):d(x,f))||w);return u>3&&w&&Object.defineProperty(x,f,w),w},v=this&&this.__param||function(b,x){return function(f,p){x(f,p,b)}};Object.defineProperty(a,"__esModule",{value:!0}),a.MouseService=void 0;const c=l(4725),m=l(9806);let C=a.MouseService=class{constructor(b,x){this._renderService=b,this._charSizeService=x}getCoords(b,x,f,p,d){return(0,m.getCoords)(window,b,x,f,p,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,d)}getMouseReportCoords(b,x){const f=(0,m.getCoordsRelativeToElement)(window,b,x);if(this._charSizeService.hasValidSize)return f[0]=Math.min(Math.max(f[0],0),this._renderService.dimensions.css.canvas.width-1),f[1]=Math.min(Math.max(f[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(f[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(f[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(f[0]),y:Math.floor(f[1])}}};a.MouseService=C=_([v(0,c.IRenderService),v(1,c.ICharSizeService)],C)},3230:function(y,a,l){var _=this&&this.__decorate||function(d,u,w,L){var R,D=arguments.length,k=D<3?u:L===null?L=Object.getOwnPropertyDescriptor(u,w):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(d,u,w,L);else for(var M=d.length-1;M>=0;M--)(R=d[M])&&(k=(D<3?R(k):D>3?R(u,w,k):R(u,w))||k);return D>3&&k&&Object.defineProperty(u,w,k),k},v=this&&this.__param||function(d,u){return function(w,L){u(w,L,d)}};Object.defineProperty(a,"__esModule",{value:!0}),a.RenderService=void 0;const c=l(6193),m=l(4725),C=l(8460),b=l(844),x=l(7226),f=l(2585);let p=a.RenderService=class extends b.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(d,u,w,L,R,D,k,M){super(),this._rowCount=d,this._charSizeService=L,this._renderer=this.register(new b.MutableDisposable),this._pausedResizeTask=new x.DebouncedIdleTask,this._observerDisposable=this.register(new b.MutableDisposable),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 C.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new C.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new C.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new C.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new c.RenderDebouncer(((W,z)=>this._renderRows(W,z)),k),this.register(this._renderDebouncer),this.register(k.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(D.onResize((()=>this._fullRefresh()))),this.register(D.buffers.onBufferActivate((()=>{var W;return(W=this._renderer.value)==null?void 0:W.clear()}))),this.register(w.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(R.onDecorationRegistered((()=>this._fullRefresh()))),this.register(R.onDecorationRemoved((()=>this._fullRefresh()))),this.register(w.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(D.cols,D.rows),this._fullRefresh()}))),this.register(w.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(D.buffer.y,D.buffer.y,!0)))),this.register(M.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(k.window,u),this.register(k.onWindowChange((W=>this._registerIntersectionObserver(W,u))))}_registerIntersectionObserver(d,u){if("IntersectionObserver"in d){const w=new d.IntersectionObserver((L=>this._handleIntersectionChange(L[L.length-1])),{threshold:0});w.observe(u),this._observerDisposable.value=(0,b.toDisposable)((()=>w.disconnect()))}}_handleIntersectionChange(d){this._isPaused=d.isIntersecting===void 0?d.intersectionRatio===0:!d.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(d,u,w=!1){this._isPaused?this._needsFullRefresh=!0:(w||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(d,u,this._rowCount))}_renderRows(d,u){this._renderer.value&&(d=Math.min(d,this._rowCount-1),u=Math.min(u,this._rowCount-1),this._renderer.value.renderRows(d,u),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:d,end:u}),this._onRender.fire({start:d,end:u}),this._isNextRenderRedrawOnly=!0)}resize(d,u){this._rowCount=u,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(d){this._renderer.value=d,this._renderer.value&&(this._renderer.value.onRequestRedraw((u=>this.refreshRows(u.start,u.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(d){return this._renderDebouncer.addRefreshCallback(d)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var d,u;this._renderer.value&&((u=(d=this._renderer.value).clearTextureAtlas)==null||u.call(d),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(d,u){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var w;return(w=this._renderer.value)==null?void 0:w.handleResize(d,u)})):this._renderer.value.handleResize(d,u),this._fullRefresh())}handleCharSizeChanged(){var d;(d=this._renderer.value)==null||d.handleCharSizeChanged()}handleBlur(){var d;(d=this._renderer.value)==null||d.handleBlur()}handleFocus(){var d;(d=this._renderer.value)==null||d.handleFocus()}handleSelectionChanged(d,u,w){var L;this._selectionState.start=d,this._selectionState.end=u,this._selectionState.columnSelectMode=w,(L=this._renderer.value)==null||L.handleSelectionChanged(d,u,w)}handleCursorMove(){var d;(d=this._renderer.value)==null||d.handleCursorMove()}clear(){var d;(d=this._renderer.value)==null||d.clear()}};a.RenderService=p=_([v(2,f.IOptionsService),v(3,m.ICharSizeService),v(4,f.IDecorationService),v(5,f.IBufferService),v(6,m.ICoreBrowserService),v(7,m.IThemeService)],p)},9312:function(y,a,l){var _=this&&this.__decorate||function(k,M,W,z){var j,N=arguments.length,I=N<3?M:z===null?z=Object.getOwnPropertyDescriptor(M,W):z;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(k,M,W,z);else for(var q=k.length-1;q>=0;q--)(j=k[q])&&(I=(N<3?j(I):N>3?j(M,W,I):j(M,W))||I);return N>3&&I&&Object.defineProperty(M,W,I),I},v=this&&this.__param||function(k,M){return function(W,z){M(W,z,k)}};Object.defineProperty(a,"__esModule",{value:!0}),a.SelectionService=void 0;const c=l(9806),m=l(9504),C=l(456),b=l(4725),x=l(8460),f=l(844),p=l(6114),d=l(4841),u=l(511),w=l(2585),L=" ",R=new RegExp(L,"g");let D=a.SelectionService=class extends f.Disposable{constructor(k,M,W,z,j,N,I,q,U){super(),this._element=k,this._screenElement=M,this._linkifier=W,this._bufferService=z,this._coreService=j,this._mouseService=N,this._optionsService=I,this._renderService=q,this._coreBrowserService=U,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new u.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new x.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new x.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new x.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new x.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=K=>this._handleMouseMove(K),this._mouseUpListener=K=>this._handleMouseUp(K),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((K=>this._handleTrim(K))),this.register(this._bufferService.buffers.onBufferActivate((K=>this._handleBufferActivate(K)))),this.enable(),this._model=new C.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,f.toDisposable)((()=>{this._removeMouseDownListeners()})))}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(){const k=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;return!(!k||!M||k[0]===M[0]&&k[1]===M[1])}get selectionText(){const k=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;if(!k||!M)return"";const W=this._bufferService.buffer,z=[];if(this._activeSelectionMode===3){if(k[0]===M[0])return"";const j=k[0]<M[0]?k[0]:M[0],N=k[0]<M[0]?M[0]:k[0];for(let I=k[1];I<=M[1];I++){const q=W.translateBufferLineToString(I,!0,j,N);z.push(q)}}else{const j=k[1]===M[1]?M[0]:void 0;z.push(W.translateBufferLineToString(k[1],!0,k[0],j));for(let N=k[1]+1;N<=M[1]-1;N++){const I=W.lines.get(N),q=W.translateBufferLineToString(N,!0);I!=null&&I.isWrapped?z[z.length-1]+=q:z.push(q)}if(k[1]!==M[1]){const N=W.lines.get(M[1]),I=W.translateBufferLineToString(M[1],!0,0,M[0]);N&&N.isWrapped?z[z.length-1]+=I:z.push(I)}}return z.map((j=>j.replace(R," "))).join(p.isWindows?`\r
67
67
  `:`
68
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(k){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),p.isLinux&&k&&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(k){const M=this._getMouseBufferCoords(k),W=this._model.finalSelectionStart,z=this._model.finalSelectionEnd;return!!(W&&z&&M)&&this._areCoordsInSelection(M,W,z)}isCellInSelection(k,M){const W=this._model.finalSelectionStart,z=this._model.finalSelectionEnd;return!(!W||!z)&&this._areCoordsInSelection([k,M],W,z)}_areCoordsInSelection(k,M,W){return k[1]>M[1]&&k[1]<W[1]||M[1]===W[1]&&k[1]===M[1]&&k[0]>=M[0]&&k[0]<W[0]||M[1]<W[1]&&k[1]===W[1]&&k[0]<W[0]||M[1]<W[1]&&k[1]===M[1]&&k[0]>=M[0]}_selectWordAtCursor(k,M){var j,N;const W=(N=(j=this._linkifier.currentLink)==null?void 0:j.link)==null?void 0:N.range;if(W)return this._model.selectionStart=[W.start.x-1,W.start.y-1],this._model.selectionStartLength=(0,d.getRangeLength)(W,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const z=this._getMouseBufferCoords(k);return!!z&&(this._selectWordAt(z,M),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(k,M){this._model.clearSelection(),k=Math.max(k,0),M=Math.min(M,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,k],this._model.selectionEnd=[this._bufferService.cols,M],this.refresh(),this._onSelectionChange.fire()}_handleTrim(k){this._model.handleTrim(k)&&this.refresh()}_getMouseBufferCoords(k){const M=this._mouseService.getCoords(k,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(M)return M[0]--,M[1]--,M[1]+=this._bufferService.buffer.ydisp,M}_getMouseEventScrollAmount(k){let M=(0,c.getCoordsRelativeToElement)(this._coreBrowserService.window,k,this._screenElement)[1];const W=this._renderService.dimensions.css.canvas.height;return M>=0&&M<=W?0:(M>W&&(M-=W),M=Math.min(Math.max(M,-50),50),M/=50,M/Math.abs(M)+Math.round(14*M))}shouldForceSelection(k){return p.isMac?k.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:k.shiftKey}handleMouseDown(k){if(this._mouseDownTimeStamp=k.timeStamp,(k.button!==2||!this.hasSelection)&&k.button===0){if(!this._enabled){if(!this.shouldForceSelection(k))return;k.stopPropagation()}k.preventDefault(),this._dragScrollAmount=0,this._enabled&&k.shiftKey?this._handleIncrementalClick(k):k.detail===1?this._handleSingleClick(k):k.detail===2?this._handleDoubleClick(k):k.detail===3&&this._handleTripleClick(k),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(k){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(k))}_handleSingleClick(k){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(k)?3:0,this._model.selectionStart=this._getMouseBufferCoords(k),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const M=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);M&&M.length!==this._model.selectionStart[0]&&M.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(k){this._selectWordAtCursor(k,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(k){const M=this._getMouseBufferCoords(k);M&&(this._activeSelectionMode=2,this._selectLineAt(M[1]))}shouldColumnSelect(k){return k.altKey&&!(p.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(k){if(k.stopImmediatePropagation(),!this._model.selectionStart)return;const M=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(k),!this._model.selectionEnd)return void this.refresh(!0);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(k),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const W=this._bufferService.buffer;if(this._model.selectionEnd[1]<W.lines.length){const z=W.lines.get(this._model.selectionEnd[1]);z&&z.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}M&&M[0]===this._model.selectionEnd[0]&&M[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});const k=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(k.ydisp+this._bufferService.rows,k.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=k.ydisp),this.refresh()}}_handleMouseUp(k){const M=k.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&M<500&&k.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const W=this._mouseService.getCoords(k,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(W&&W[0]!==void 0&&W[1]!==void 0){const z=(0,m.moveToCellSequence)(W[0]-1,W[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(z,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const k=this._model.finalSelectionStart,M=this._model.finalSelectionEnd,W=!(!k||!M||k[0]===M[0]&&k[1]===M[1]);W?k&&M&&(this._oldSelectionStart&&this._oldSelectionEnd&&k[0]===this._oldSelectionStart[0]&&k[1]===this._oldSelectionStart[1]&&M[0]===this._oldSelectionEnd[0]&&M[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(k,M,W)):this._oldHasSelection&&this._fireOnSelectionChange(k,M,W)}_fireOnSelectionChange(k,M,W){this._oldSelectionStart=k,this._oldSelectionEnd=M,this._oldHasSelection=W,this._onSelectionChange.fire()}_handleBufferActivate(k){this.clearSelection(),this._trimListener.dispose(),this._trimListener=k.activeBuffer.lines.onTrim((M=>this._handleTrim(M)))}_convertViewportColToCharacterIndex(k,M){let W=M;for(let z=0;M>=z;z++){const j=k.loadCell(z,this._workCell).getChars().length;this._workCell.getWidth()===0?W--:j>1&&M!==z&&(W+=j-1)}return W}setSelection(k,M,W){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[k,M],this._model.selectionStartLength=W,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(k){this._isClickInSelection(k)||(this._selectWordAtCursor(k,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(k,M,W=!0,z=!0){if(k[0]>=this._bufferService.cols)return;const j=this._bufferService.buffer,N=j.lines.get(k[1]);if(!N)return;const I=j.translateBufferLineToString(k[1],!1);let q=this._convertViewportColToCharacterIndex(N,k[0]),U=q;const K=k[0]-q;let V=0,T=0,B=0,P=0;if(I.charAt(q)===" "){for(;q>0&&I.charAt(q-1)===" ";)q--;for(;U<I.length&&I.charAt(U+1)===" ";)U++}else{let Z=k[0],ie=k[0];N.getWidth(Z)===0&&(V++,Z--),N.getWidth(ie)===2&&(T++,ie++);const ae=N.getString(ie).length;for(ae>1&&(P+=ae-1,U+=ae-1);Z>0&&q>0&&!this._isCharWordSeparator(N.loadCell(Z-1,this._workCell));){N.loadCell(Z-1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===0?(V++,Z--):X>1&&(B+=X-1,q-=X-1),q--,Z--}for(;ie<N.length&&U+1<I.length&&!this._isCharWordSeparator(N.loadCell(ie+1,this._workCell));){N.loadCell(ie+1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===2?(T++,ie++):X>1&&(P+=X-1,U+=X-1),U++,ie++}}U++;let F=q+K-V+B,G=Math.min(this._bufferService.cols,U-q+V+T-B-P);if(M||I.slice(q,U).trim()!==""){if(W&&F===0&&N.getCodePoint(0)!==32){const Z=j.lines.get(k[1]-1);if(Z&&N.isWrapped&&Z.getCodePoint(this._bufferService.cols-1)!==32){const ie=this._getWordAt([this._bufferService.cols-1,k[1]-1],!1,!0,!1);if(ie){const ae=this._bufferService.cols-ie.start;F-=ae,G+=ae}}}if(z&&F+G===this._bufferService.cols&&N.getCodePoint(this._bufferService.cols-1)!==32){const Z=j.lines.get(k[1]+1);if(Z!=null&&Z.isWrapped&&Z.getCodePoint(0)!==32){const ie=this._getWordAt([0,k[1]+1],!1,!1,!0);ie&&(G+=ie.length)}}return{start:F,length:G}}}_selectWordAt(k,M){const W=this._getWordAt(k,M);if(W){for(;W.start<0;)W.start+=this._bufferService.cols,k[1]--;this._model.selectionStart=[W.start,k[1]],this._model.selectionStartLength=W.length}}_selectToWordAt(k){const M=this._getWordAt(k,!0);if(M){let W=k[1];for(;M.start<0;)M.start+=this._bufferService.cols,W--;if(!this._model.areSelectionValuesReversed())for(;M.start+M.length>this._bufferService.cols;)M.length-=this._bufferService.cols,W++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?M.start:M.start+M.length,W]}}_isCharWordSeparator(k){return k.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(k.getChars())>=0}_selectLineAt(k){const M=this._bufferService.buffer.getWrappedRangeForLine(k),W={start:{x:0,y:M.first},end:{x:this._bufferService.cols-1,y:M.last}};this._model.selectionStart=[0,M.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,d.getRangeLength)(W,this._bufferService.cols)}};a.SelectionService=D=_([v(3,w.IBufferService),v(4,w.ICoreService),v(5,b.IMouseService),v(6,w.IOptionsService),v(7,b.IRenderService),v(8,b.ICoreBrowserService)],D)},4725:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ILinkProviderService=a.IThemeService=a.ICharacterJoinerService=a.ISelectionService=a.IRenderService=a.IMouseService=a.ICoreBrowserService=a.ICharSizeService=void 0;const _=l(8343);a.ICharSizeService=(0,_.createDecorator)("CharSizeService"),a.ICoreBrowserService=(0,_.createDecorator)("CoreBrowserService"),a.IMouseService=(0,_.createDecorator)("MouseService"),a.IRenderService=(0,_.createDecorator)("RenderService"),a.ISelectionService=(0,_.createDecorator)("SelectionService"),a.ICharacterJoinerService=(0,_.createDecorator)("CharacterJoinerService"),a.IThemeService=(0,_.createDecorator)("ThemeService"),a.ILinkProviderService=(0,_.createDecorator)("LinkProviderService")},6731:function(y,a,l){var _=this&&this.__decorate||function(D,k,M,W){var z,j=arguments.length,N=j<3?k:W===null?W=Object.getOwnPropertyDescriptor(k,M):W;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(D,k,M,W);else for(var I=D.length-1;I>=0;I--)(z=D[I])&&(N=(j<3?z(N):j>3?z(k,M,N):z(k,M))||N);return j>3&&N&&Object.defineProperty(k,M,N),N},v=this&&this.__param||function(D,k){return function(M,W){k(M,W,D)}};Object.defineProperty(a,"__esModule",{value:!0}),a.ThemeService=a.DEFAULT_ANSI_COLORS=void 0;const c=l(7239),m=l(8055),C=l(8460),b=l(844),x=l(2585),f=m.css.toColor("#ffffff"),p=m.css.toColor("#000000"),d=m.css.toColor("#ffffff"),u=m.css.toColor("#000000"),w={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};a.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const D=[m.css.toColor("#2e3436"),m.css.toColor("#cc0000"),m.css.toColor("#4e9a06"),m.css.toColor("#c4a000"),m.css.toColor("#3465a4"),m.css.toColor("#75507b"),m.css.toColor("#06989a"),m.css.toColor("#d3d7cf"),m.css.toColor("#555753"),m.css.toColor("#ef2929"),m.css.toColor("#8ae234"),m.css.toColor("#fce94f"),m.css.toColor("#729fcf"),m.css.toColor("#ad7fa8"),m.css.toColor("#34e2e2"),m.css.toColor("#eeeeec")],k=[0,95,135,175,215,255];for(let M=0;M<216;M++){const W=k[M/36%6|0],z=k[M/6%6|0],j=k[M%6];D.push({css:m.channels.toCss(W,z,j),rgba:m.channels.toRgba(W,z,j)})}for(let M=0;M<24;M++){const W=8+10*M;D.push({css:m.channels.toCss(W,W,W),rgba:m.channels.toRgba(W,W,W)})}return D})());let L=a.ThemeService=class extends b.Disposable{get colors(){return this._colors}constructor(D){super(),this._optionsService=D,this._contrastCache=new c.ColorContrastCache,this._halfContrastCache=new c.ColorContrastCache,this._onChangeColors=this.register(new C.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:f,background:p,cursor:d,cursorAccent:u,selectionForeground:void 0,selectionBackgroundTransparent:w,selectionBackgroundOpaque:m.color.blend(p,w),selectionInactiveBackgroundTransparent:w,selectionInactiveBackgroundOpaque:m.color.blend(p,w),ansi:a.DEFAULT_ANSI_COLORS.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))))}_setTheme(D={}){const k=this._colors;if(k.foreground=R(D.foreground,f),k.background=R(D.background,p),k.cursor=R(D.cursor,d),k.cursorAccent=R(D.cursorAccent,u),k.selectionBackgroundTransparent=R(D.selectionBackground,w),k.selectionBackgroundOpaque=m.color.blend(k.background,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundTransparent=R(D.selectionInactiveBackground,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundOpaque=m.color.blend(k.background,k.selectionInactiveBackgroundTransparent),k.selectionForeground=D.selectionForeground?R(D.selectionForeground,m.NULL_COLOR):void 0,k.selectionForeground===m.NULL_COLOR&&(k.selectionForeground=void 0),m.color.isOpaque(k.selectionBackgroundTransparent)&&(k.selectionBackgroundTransparent=m.color.opacity(k.selectionBackgroundTransparent,.3)),m.color.isOpaque(k.selectionInactiveBackgroundTransparent)&&(k.selectionInactiveBackgroundTransparent=m.color.opacity(k.selectionInactiveBackgroundTransparent,.3)),k.ansi=a.DEFAULT_ANSI_COLORS.slice(),k.ansi[0]=R(D.black,a.DEFAULT_ANSI_COLORS[0]),k.ansi[1]=R(D.red,a.DEFAULT_ANSI_COLORS[1]),k.ansi[2]=R(D.green,a.DEFAULT_ANSI_COLORS[2]),k.ansi[3]=R(D.yellow,a.DEFAULT_ANSI_COLORS[3]),k.ansi[4]=R(D.blue,a.DEFAULT_ANSI_COLORS[4]),k.ansi[5]=R(D.magenta,a.DEFAULT_ANSI_COLORS[5]),k.ansi[6]=R(D.cyan,a.DEFAULT_ANSI_COLORS[6]),k.ansi[7]=R(D.white,a.DEFAULT_ANSI_COLORS[7]),k.ansi[8]=R(D.brightBlack,a.DEFAULT_ANSI_COLORS[8]),k.ansi[9]=R(D.brightRed,a.DEFAULT_ANSI_COLORS[9]),k.ansi[10]=R(D.brightGreen,a.DEFAULT_ANSI_COLORS[10]),k.ansi[11]=R(D.brightYellow,a.DEFAULT_ANSI_COLORS[11]),k.ansi[12]=R(D.brightBlue,a.DEFAULT_ANSI_COLORS[12]),k.ansi[13]=R(D.brightMagenta,a.DEFAULT_ANSI_COLORS[13]),k.ansi[14]=R(D.brightCyan,a.DEFAULT_ANSI_COLORS[14]),k.ansi[15]=R(D.brightWhite,a.DEFAULT_ANSI_COLORS[15]),D.extendedAnsi){const M=Math.min(k.ansi.length-16,D.extendedAnsi.length);for(let W=0;W<M;W++)k.ansi[W+16]=R(D.extendedAnsi[W],a.DEFAULT_ANSI_COLORS[W+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(D){this._restoreColor(D),this._onChangeColors.fire(this.colors)}_restoreColor(D){if(D!==void 0)switch(D){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[D]=this._restoreColors.ansi[D]}else for(let k=0;k<this._restoreColors.ansi.length;++k)this._colors.ansi[k]=this._restoreColors.ansi[k]}modifyColors(D){D(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function R(D,k){if(D!==void 0)try{return m.css.toColor(D)}catch{}return k}a.ThemeService=L=_([v(0,x.IOptionsService)],L)},6349:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CircularList=void 0;const _=l(8460),v=l(844);class c extends v.Disposable{constructor(C){super(),this._maxLength=C,this.onDeleteEmitter=this.register(new _.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new _.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new _.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(C){if(this._maxLength===C)return;const b=new Array(C);for(let x=0;x<Math.min(C,this.length);x++)b[x]=this._array[this._getCyclicIndex(x)];this._array=b,this._maxLength=C,this._startIndex=0}get length(){return this._length}set length(C){if(C>this._length)for(let b=this._length;b<C;b++)this._array[b]=void 0;this._length=C}get(C){return this._array[this._getCyclicIndex(C)]}set(C,b){this._array[this._getCyclicIndex(C)]=b}push(C){this._array[this._getCyclicIndex(this._length)]=C,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(C,b,...x){if(b){for(let f=C;f<this._length-b;f++)this._array[this._getCyclicIndex(f)]=this._array[this._getCyclicIndex(f+b)];this._length-=b,this.onDeleteEmitter.fire({index:C,amount:b})}for(let f=this._length-1;f>=C;f--)this._array[this._getCyclicIndex(f+x.length)]=this._array[this._getCyclicIndex(f)];for(let f=0;f<x.length;f++)this._array[this._getCyclicIndex(C+f)]=x[f];if(x.length&&this.onInsertEmitter.fire({index:C,amount:x.length}),this._length+x.length>this._maxLength){const f=this._length+x.length-this._maxLength;this._startIndex+=f,this._length=this._maxLength,this.onTrimEmitter.fire(f)}else this._length+=x.length}trimStart(C){C>this._length&&(C=this._length),this._startIndex+=C,this._length-=C,this.onTrimEmitter.fire(C)}shiftElements(C,b,x){if(!(b<=0)){if(C<0||C>=this._length)throw new Error("start argument out of range");if(C+x<0)throw new Error("Cannot shift elements in list beyond index 0");if(x>0){for(let p=b-1;p>=0;p--)this.set(C+p+x,this.get(C+p));const f=C+b+x-this._length;if(f>0)for(this._length+=f;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let f=0;f<b;f++)this.set(C+f+x,this.get(C+f))}}_getCyclicIndex(C){return(this._startIndex+C)%this._maxLength}}a.CircularList=c},1439:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.clone=void 0,a.clone=function l(_,v=5){if(typeof _!="object")return _;const c=Array.isArray(_)?[]:{};for(const m in _)c[m]=v<=1?_[m]:_[m]&&l(_[m],v-1);return c}},8055:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.contrastRatio=a.toPaddedHex=a.rgba=a.rgb=a.css=a.color=a.channels=a.NULL_COLOR=void 0;let l=0,_=0,v=0,c=0;var m,C,b,x,f;function p(u){const w=u.toString(16);return w.length<2?"0"+w:w}function d(u,w){return u<w?(w+.05)/(u+.05):(u+.05)/(w+.05)}a.NULL_COLOR={css:"#00000000",rgba:0},(function(u){u.toCss=function(w,L,R,D){return D!==void 0?`#${p(w)}${p(L)}${p(R)}${p(D)}`:`#${p(w)}${p(L)}${p(R)}`},u.toRgba=function(w,L,R,D=255){return(w<<24|L<<16|R<<8|D)>>>0},u.toColor=function(w,L,R,D){return{css:u.toCss(w,L,R,D),rgba:u.toRgba(w,L,R,D)}}})(m||(a.channels=m={})),(function(u){function w(L,R){return c=Math.round(255*R),[l,_,v]=f.toChannels(L.rgba),{css:m.toCss(l,_,v,c),rgba:m.toRgba(l,_,v,c)}}u.blend=function(L,R){if(c=(255&R.rgba)/255,c===1)return{css:R.css,rgba:R.rgba};const D=R.rgba>>24&255,k=R.rgba>>16&255,M=R.rgba>>8&255,W=L.rgba>>24&255,z=L.rgba>>16&255,j=L.rgba>>8&255;return l=W+Math.round((D-W)*c),_=z+Math.round((k-z)*c),v=j+Math.round((M-j)*c),{css:m.toCss(l,_,v),rgba:m.toRgba(l,_,v)}},u.isOpaque=function(L){return(255&L.rgba)==255},u.ensureContrastRatio=function(L,R,D){const k=f.ensureContrastRatio(L.rgba,R.rgba,D);if(k)return m.toColor(k>>24&255,k>>16&255,k>>8&255)},u.opaque=function(L){const R=(255|L.rgba)>>>0;return[l,_,v]=f.toChannels(R),{css:m.toCss(l,_,v),rgba:R}},u.opacity=w,u.multiplyOpacity=function(L,R){return c=255&L.rgba,w(L,c*R/255)},u.toColorRGB=function(L){return[L.rgba>>24&255,L.rgba>>16&255,L.rgba>>8&255]}})(C||(a.color=C={})),(function(u){let w,L;try{const R=document.createElement("canvas");R.width=1,R.height=1;const D=R.getContext("2d",{willReadFrequently:!0});D&&(w=D,w.globalCompositeOperation="copy",L=w.createLinearGradient(0,0,1,1))}catch{}u.toColor=function(R){if(R.match(/#[\da-f]{3,8}/i))switch(R.length){case 4:return l=parseInt(R.slice(1,2).repeat(2),16),_=parseInt(R.slice(2,3).repeat(2),16),v=parseInt(R.slice(3,4).repeat(2),16),m.toColor(l,_,v);case 5:return l=parseInt(R.slice(1,2).repeat(2),16),_=parseInt(R.slice(2,3).repeat(2),16),v=parseInt(R.slice(3,4).repeat(2),16),c=parseInt(R.slice(4,5).repeat(2),16),m.toColor(l,_,v,c);case 7:return{css:R,rgba:(parseInt(R.slice(1),16)<<8|255)>>>0};case 9:return{css:R,rgba:parseInt(R.slice(1),16)>>>0}}const D=R.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(D)return l=parseInt(D[1]),_=parseInt(D[2]),v=parseInt(D[3]),c=Math.round(255*(D[5]===void 0?1:parseFloat(D[5]))),m.toColor(l,_,v,c);if(!w||!L)throw new Error("css.toColor: Unsupported css format");if(w.fillStyle=L,w.fillStyle=R,typeof w.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(w.fillRect(0,0,1,1),[l,_,v,c]=w.getImageData(0,0,1,1).data,c!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:m.toRgba(l,_,v,c),css:R}}})(b||(a.css=b={})),(function(u){function w(L,R,D){const k=L/255,M=R/255,W=D/255;return .2126*(k<=.03928?k/12.92:Math.pow((k+.055)/1.055,2.4))+.7152*(M<=.03928?M/12.92:Math.pow((M+.055)/1.055,2.4))+.0722*(W<=.03928?W/12.92:Math.pow((W+.055)/1.055,2.4))}u.relativeLuminance=function(L){return w(L>>16&255,L>>8&255,255&L)},u.relativeLuminance2=w})(x||(a.rgb=x={})),(function(u){function w(R,D,k){const M=R>>24&255,W=R>>16&255,z=R>>8&255;let j=D>>24&255,N=D>>16&255,I=D>>8&255,q=d(x.relativeLuminance2(j,N,I),x.relativeLuminance2(M,W,z));for(;q<k&&(j>0||N>0||I>0);)j-=Math.max(0,Math.ceil(.1*j)),N-=Math.max(0,Math.ceil(.1*N)),I-=Math.max(0,Math.ceil(.1*I)),q=d(x.relativeLuminance2(j,N,I),x.relativeLuminance2(M,W,z));return(j<<24|N<<16|I<<8|255)>>>0}function L(R,D,k){const M=R>>24&255,W=R>>16&255,z=R>>8&255;let j=D>>24&255,N=D>>16&255,I=D>>8&255,q=d(x.relativeLuminance2(j,N,I),x.relativeLuminance2(M,W,z));for(;q<k&&(j<255||N<255||I<255);)j=Math.min(255,j+Math.ceil(.1*(255-j))),N=Math.min(255,N+Math.ceil(.1*(255-N))),I=Math.min(255,I+Math.ceil(.1*(255-I))),q=d(x.relativeLuminance2(j,N,I),x.relativeLuminance2(M,W,z));return(j<<24|N<<16|I<<8|255)>>>0}u.blend=function(R,D){if(c=(255&D)/255,c===1)return D;const k=D>>24&255,M=D>>16&255,W=D>>8&255,z=R>>24&255,j=R>>16&255,N=R>>8&255;return l=z+Math.round((k-z)*c),_=j+Math.round((M-j)*c),v=N+Math.round((W-N)*c),m.toRgba(l,_,v)},u.ensureContrastRatio=function(R,D,k){const M=x.relativeLuminance(R>>8),W=x.relativeLuminance(D>>8);if(d(M,W)<k){if(W<M){const N=w(R,D,k),I=d(M,x.relativeLuminance(N>>8));if(I<k){const q=L(R,D,k);return I>d(M,x.relativeLuminance(q>>8))?N:q}return N}const z=L(R,D,k),j=d(M,x.relativeLuminance(z>>8));if(j<k){const N=w(R,D,k);return j>d(M,x.relativeLuminance(N>>8))?z:N}return z}},u.reduceLuminance=w,u.increaseLuminance=L,u.toChannels=function(R){return[R>>24&255,R>>16&255,R>>8&255,255&R]}})(f||(a.rgba=f={})),a.toPaddedHex=p,a.contrastRatio=d},8969:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CoreTerminal=void 0;const _=l(844),v=l(2585),c=l(4348),m=l(7866),C=l(744),b=l(7302),x=l(6975),f=l(8460),p=l(1753),d=l(1480),u=l(7994),w=l(9282),L=l(5435),R=l(5981),D=l(2660);let k=!1;class M extends _.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new f.EventEmitter),this._onScroll.event((z=>{var j;(j=this._onScrollApi)==null||j.fire(z.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(z){for(const j in z)this.optionsService.options[j]=z[j]}constructor(z){super(),this._windowsWrappingHeuristics=this.register(new _.MutableDisposable),this._onBinary=this.register(new f.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new f.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new f.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new f.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new f.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new f.EventEmitter),this._instantiationService=new c.InstantiationService,this.optionsService=this.register(new b.OptionsService(z)),this._instantiationService.setService(v.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(C.BufferService)),this._instantiationService.setService(v.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(m.LogService)),this._instantiationService.setService(v.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(x.CoreService)),this._instantiationService.setService(v.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(p.CoreMouseService)),this._instantiationService.setService(v.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(d.UnicodeService)),this._instantiationService.setService(v.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(u.CharsetService),this._instantiationService.setService(v.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(D.OscLinkService),this._instantiationService.setService(v.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new L.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,f.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,f.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,f.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,f.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((j=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((j=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new R.WriteBuffer(((j,N)=>this._inputHandler.parse(j,N)))),this.register((0,f.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(z,j){this._writeBuffer.write(z,j)}writeSync(z,j){this._logService.logLevel<=v.LogLevelEnum.WARN&&!k&&(this._logService.warn("writeSync is unreliable and will be removed soon."),k=!0),this._writeBuffer.writeSync(z,j)}input(z,j=!0){this.coreService.triggerDataEvent(z,j)}resize(z,j){isNaN(z)||isNaN(j)||(z=Math.max(z,C.MINIMUM_COLS),j=Math.max(j,C.MINIMUM_ROWS),this._bufferService.resize(z,j))}scroll(z,j=!1){this._bufferService.scroll(z,j)}scrollLines(z,j,N){this._bufferService.scrollLines(z,j,N)}scrollPages(z){this.scrollLines(z*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(z){const j=z-this._bufferService.buffer.ydisp;j!==0&&this.scrollLines(j)}registerEscHandler(z,j){return this._inputHandler.registerEscHandler(z,j)}registerDcsHandler(z,j){return this._inputHandler.registerDcsHandler(z,j)}registerCsiHandler(z,j){return this._inputHandler.registerCsiHandler(z,j)}registerOscHandler(z,j){return this._inputHandler.registerOscHandler(z,j)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let z=!1;const j=this.optionsService.rawOptions.windowsPty;j&&j.buildNumber!==void 0&&j.buildNumber!==void 0?z=j.backend==="conpty"&&j.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(z=!0),z?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const z=[];z.push(this.onLineFeed(w.updateWindowsModeWrappedState.bind(null,this._bufferService))),z.push(this.registerCsiHandler({final:"H"},(()=>((0,w.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,_.toDisposable)((()=>{for(const j of z)j.dispose()}))}}}a.CoreTerminal=M},8460:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.runAndSubscribe=a.forwardEvent=a.EventEmitter=void 0,a.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=l=>(this._listeners.push(l),{dispose:()=>{if(!this._disposed){for(let _=0;_<this._listeners.length;_++)if(this._listeners[_]===l)return void this._listeners.splice(_,1)}}})),this._event}fire(l,_){const v=[];for(let c=0;c<this._listeners.length;c++)v.push(this._listeners[c]);for(let c=0;c<v.length;c++)v[c].call(void 0,l,_)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},a.forwardEvent=function(l,_){return l((v=>_.fire(v)))},a.runAndSubscribe=function(l,_){return _(void 0),l((v=>_(v)))}},5435:function(y,a,l){var _=this&&this.__decorate||function(V,T,B,P){var F,G=arguments.length,Z=G<3?T:P===null?P=Object.getOwnPropertyDescriptor(T,B):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Z=Reflect.decorate(V,T,B,P);else for(var ie=V.length-1;ie>=0;ie--)(F=V[ie])&&(Z=(G<3?F(Z):G>3?F(T,B,Z):F(T,B))||Z);return G>3&&Z&&Object.defineProperty(T,B,Z),Z},v=this&&this.__param||function(V,T){return function(B,P){T(B,P,V)}};Object.defineProperty(a,"__esModule",{value:!0}),a.InputHandler=a.WindowsOptionsReportType=void 0;const c=l(2584),m=l(7116),C=l(2015),b=l(844),x=l(482),f=l(8437),p=l(8460),d=l(643),u=l(511),w=l(3734),L=l(2585),R=l(1480),D=l(6242),k=l(6351),M=l(5941),W={"(":0,")":1,"*":2,"+":3,"-":1,".":2},z=131072;function j(V,T){if(V>24)return T.setWinLines||!1;switch(V){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 N;(function(V){V[V.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",V[V.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(N||(a.WindowsOptionsReportType=N={}));let I=0;class q extends b.Disposable{getAttrData(){return this._curAttrData}constructor(T,B,P,F,G,Z,ie,ae,X=new C.EscapeSequenceParser){super(),this._bufferService=T,this._charsetService=B,this._coreService=P,this._logService=F,this._optionsService=G,this._oscLinkService=Z,this._coreMouseService=ie,this._unicodeService=ae,this._parser=X,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new x.StringToUtf32,this._utf8Decoder=new x.Utf8ToUtf32,this._workCell=new u.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=f.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=f.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new p.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new p.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new p.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new p.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new p.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new p.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new p.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new p.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new p.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new p.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new p.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new p.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new p.EventEmitter),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 U(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((H=>this._activeBuffer=H.activeBuffer))),this._parser.setCsiHandlerFallback(((H,re)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(H),params:re.toArray()})})),this._parser.setEscHandlerFallback((H=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(H)})})),this._parser.setExecuteHandlerFallback((H=>{this._logService.debug("Unknown EXECUTE code: ",{code:H})})),this._parser.setOscHandlerFallback(((H,re,te)=>{this._logService.debug("Unknown OSC code: ",{identifier:H,action:re,data:te})})),this._parser.setDcsHandlerFallback(((H,re,te)=>{re==="HOOK"&&(te=te.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(H),action:re,payload:te})})),this._parser.setPrintHandler(((H,re,te)=>this.print(H,re,te))),this._parser.registerCsiHandler({final:"@"},(H=>this.insertChars(H))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(H=>this.scrollLeft(H))),this._parser.registerCsiHandler({final:"A"},(H=>this.cursorUp(H))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(H=>this.scrollRight(H))),this._parser.registerCsiHandler({final:"B"},(H=>this.cursorDown(H))),this._parser.registerCsiHandler({final:"C"},(H=>this.cursorForward(H))),this._parser.registerCsiHandler({final:"D"},(H=>this.cursorBackward(H))),this._parser.registerCsiHandler({final:"E"},(H=>this.cursorNextLine(H))),this._parser.registerCsiHandler({final:"F"},(H=>this.cursorPrecedingLine(H))),this._parser.registerCsiHandler({final:"G"},(H=>this.cursorCharAbsolute(H))),this._parser.registerCsiHandler({final:"H"},(H=>this.cursorPosition(H))),this._parser.registerCsiHandler({final:"I"},(H=>this.cursorForwardTab(H))),this._parser.registerCsiHandler({final:"J"},(H=>this.eraseInDisplay(H,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(H=>this.eraseInDisplay(H,!0))),this._parser.registerCsiHandler({final:"K"},(H=>this.eraseInLine(H,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(H=>this.eraseInLine(H,!0))),this._parser.registerCsiHandler({final:"L"},(H=>this.insertLines(H))),this._parser.registerCsiHandler({final:"M"},(H=>this.deleteLines(H))),this._parser.registerCsiHandler({final:"P"},(H=>this.deleteChars(H))),this._parser.registerCsiHandler({final:"S"},(H=>this.scrollUp(H))),this._parser.registerCsiHandler({final:"T"},(H=>this.scrollDown(H))),this._parser.registerCsiHandler({final:"X"},(H=>this.eraseChars(H))),this._parser.registerCsiHandler({final:"Z"},(H=>this.cursorBackwardTab(H))),this._parser.registerCsiHandler({final:"`"},(H=>this.charPosAbsolute(H))),this._parser.registerCsiHandler({final:"a"},(H=>this.hPositionRelative(H))),this._parser.registerCsiHandler({final:"b"},(H=>this.repeatPrecedingCharacter(H))),this._parser.registerCsiHandler({final:"c"},(H=>this.sendDeviceAttributesPrimary(H))),this._parser.registerCsiHandler({prefix:">",final:"c"},(H=>this.sendDeviceAttributesSecondary(H))),this._parser.registerCsiHandler({final:"d"},(H=>this.linePosAbsolute(H))),this._parser.registerCsiHandler({final:"e"},(H=>this.vPositionRelative(H))),this._parser.registerCsiHandler({final:"f"},(H=>this.hVPosition(H))),this._parser.registerCsiHandler({final:"g"},(H=>this.tabClear(H))),this._parser.registerCsiHandler({final:"h"},(H=>this.setMode(H))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(H=>this.setModePrivate(H))),this._parser.registerCsiHandler({final:"l"},(H=>this.resetMode(H))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(H=>this.resetModePrivate(H))),this._parser.registerCsiHandler({final:"m"},(H=>this.charAttributes(H))),this._parser.registerCsiHandler({final:"n"},(H=>this.deviceStatus(H))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(H=>this.deviceStatusPrivate(H))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(H=>this.softReset(H))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(H=>this.setCursorStyle(H))),this._parser.registerCsiHandler({final:"r"},(H=>this.setScrollRegion(H))),this._parser.registerCsiHandler({final:"s"},(H=>this.saveCursor(H))),this._parser.registerCsiHandler({final:"t"},(H=>this.windowOptions(H))),this._parser.registerCsiHandler({final:"u"},(H=>this.restoreCursor(H))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(H=>this.insertColumns(H))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(H=>this.deleteColumns(H))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(H=>this.selectProtected(H))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(H=>this.requestMode(H,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(H=>this.requestMode(H,!1))),this._parser.setExecuteHandler(c.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(c.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(c.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(c.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(c.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(c.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(c.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(c.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(c.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(c.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(c.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(c.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new D.OscHandler((H=>(this.setTitle(H),this.setIconName(H),!0)))),this._parser.registerOscHandler(1,new D.OscHandler((H=>this.setIconName(H)))),this._parser.registerOscHandler(2,new D.OscHandler((H=>this.setTitle(H)))),this._parser.registerOscHandler(4,new D.OscHandler((H=>this.setOrReportIndexedColor(H)))),this._parser.registerOscHandler(8,new D.OscHandler((H=>this.setHyperlink(H)))),this._parser.registerOscHandler(10,new D.OscHandler((H=>this.setOrReportFgColor(H)))),this._parser.registerOscHandler(11,new D.OscHandler((H=>this.setOrReportBgColor(H)))),this._parser.registerOscHandler(12,new D.OscHandler((H=>this.setOrReportCursorColor(H)))),this._parser.registerOscHandler(104,new D.OscHandler((H=>this.restoreIndexedColor(H)))),this._parser.registerOscHandler(110,new D.OscHandler((H=>this.restoreFgColor(H)))),this._parser.registerOscHandler(111,new D.OscHandler((H=>this.restoreBgColor(H)))),this._parser.registerOscHandler(112,new D.OscHandler((H=>this.restoreCursorColor(H)))),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(const H in m.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:H},(()=>this.selectCharset("("+H))),this._parser.registerEscHandler({intermediates:")",final:H},(()=>this.selectCharset(")"+H))),this._parser.registerEscHandler({intermediates:"*",final:H},(()=>this.selectCharset("*"+H))),this._parser.registerEscHandler({intermediates:"+",final:H},(()=>this.selectCharset("+"+H))),this._parser.registerEscHandler({intermediates:"-",final:H},(()=>this.selectCharset("-"+H))),this._parser.registerEscHandler({intermediates:".",final:H},(()=>this.selectCharset("."+H))),this._parser.registerEscHandler({intermediates:"/",final:H},(()=>this.selectCharset("/"+H)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((H=>(this._logService.error("Parsing error: ",H),H))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new k.DcsHandler(((H,re)=>this.requestStatusString(H,re))))}_preserveStack(T,B,P,F){this._parseStack.paused=!0,this._parseStack.cursorStartX=T,this._parseStack.cursorStartY=B,this._parseStack.decodedLength=P,this._parseStack.position=F}_logSlowResolvingAsync(T){this._logService.logLevel<=L.LogLevelEnum.WARN&&Promise.race([T,new Promise(((B,P)=>setTimeout((()=>P("#SLOW_TIMEOUT")),5e3)))]).catch((B=>{if(B!=="#SLOW_TIMEOUT")throw B;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(T,B){let P,F=this._activeBuffer.x,G=this._activeBuffer.y,Z=0;const ie=this._parseStack.paused;if(ie){if(P=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,B))return this._logSlowResolvingAsync(P),P;F=this._parseStack.cursorStartX,G=this._parseStack.cursorStartY,this._parseStack.paused=!1,T.length>z&&(Z=this._parseStack.position+z)}if(this._logService.logLevel<=L.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof T=="string"?` "${T}"`:` "${Array.prototype.map.call(T,(H=>String.fromCharCode(H))).join("")}"`),typeof T=="string"?T.split("").map((H=>H.charCodeAt(0))):T),this._parseBuffer.length<T.length&&this._parseBuffer.length<z&&(this._parseBuffer=new Uint32Array(Math.min(T.length,z))),ie||this._dirtyRowTracker.clearRange(),T.length>z)for(let H=Z;H<T.length;H+=z){const re=H+z<T.length?H+z:T.length,te=typeof T=="string"?this._stringDecoder.decode(T.substring(H,re),this._parseBuffer):this._utf8Decoder.decode(T.subarray(H,re),this._parseBuffer);if(P=this._parser.parse(this._parseBuffer,te))return this._preserveStack(F,G,te,H),this._logSlowResolvingAsync(P),P}else if(!ie){const H=typeof T=="string"?this._stringDecoder.decode(T,this._parseBuffer):this._utf8Decoder.decode(T,this._parseBuffer);if(P=this._parser.parse(this._parseBuffer,H))return this._preserveStack(F,G,H,0),this._logSlowResolvingAsync(P),P}this._activeBuffer.x===F&&this._activeBuffer.y===G||this._onCursorMove.fire();const ae=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),X=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);X<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(X,this._bufferService.rows-1),Math.min(ae,this._bufferService.rows-1))}print(T,B,P){let F,G;const Z=this._charsetService.charset,ie=this._optionsService.rawOptions.screenReaderMode,ae=this._bufferService.cols,X=this._coreService.decPrivateModes.wraparound,H=this._coreService.modes.insertMode,re=this._curAttrData;let te=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&P-B>0&&te.getWidth(this._activeBuffer.x-1)===2&&te.setCellFromCodepoint(this._activeBuffer.x-1,0,1,re);let ce=this._parser.precedingJoinState;for(let le=B;le<P;++le){if(F=T[le],F<127&&Z){const ue=Z[String.fromCharCode(F)];ue&&(F=ue.charCodeAt(0))}const pe=this._unicodeService.charProperties(F,ce);G=R.UnicodeService.extractWidth(pe);const Se=R.UnicodeService.extractShouldJoin(pe),be=Se?R.UnicodeService.extractWidth(ce):0;if(ce=pe,ie&&this._onA11yChar.fire((0,x.stringFromCodePoint)(F)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+G-be>ae){if(X){const ue=te;let ge=this._activeBuffer.x-be;for(this._activeBuffer.x=be,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),te=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),be>0&&te instanceof f.BufferLine&&te.copyCellsFrom(ue,ge,0,be,!1);ge<ae;)ue.setCellFromCodepoint(ge++,0,1,re)}else if(this._activeBuffer.x=ae-1,G===2)continue}if(Se&&this._activeBuffer.x){const ue=te.getWidth(this._activeBuffer.x-1)?1:2;te.addCodepointToCell(this._activeBuffer.x-ue,F,G);for(let ge=G-be;--ge>=0;)te.setCellFromCodepoint(this._activeBuffer.x++,0,0,re)}else if(H&&(te.insertCells(this._activeBuffer.x,G-be,this._activeBuffer.getNullCell(re)),te.getWidth(ae-1)===2&&te.setCellFromCodepoint(ae-1,d.NULL_CELL_CODE,d.NULL_CELL_WIDTH,re)),te.setCellFromCodepoint(this._activeBuffer.x++,F,G,re),G>0)for(;--G;)te.setCellFromCodepoint(this._activeBuffer.x++,0,0,re)}this._parser.precedingJoinState=ce,this._activeBuffer.x<ae&&P-B>0&&te.getWidth(this._activeBuffer.x)===0&&!te.hasContent(this._activeBuffer.x)&&te.setCellFromCodepoint(this._activeBuffer.x,0,1,re),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(T,B){return T.final!=="t"||T.prefix||T.intermediates?this._parser.registerCsiHandler(T,B):this._parser.registerCsiHandler(T,(P=>!j(P.params[0],this._optionsService.rawOptions.windowOptions)||B(P)))}registerDcsHandler(T,B){return this._parser.registerDcsHandler(T,new k.DcsHandler(B))}registerEscHandler(T,B){return this._parser.registerEscHandler(T,B)}registerOscHandler(T,B){return this._parser.registerOscHandler(T,new D.OscHandler(B))}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 T;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&&((T=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&T.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);B.hasWidth(this._activeBuffer.x)&&!B.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const T=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-T),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(T=this._bufferService.cols-1){this._activeBuffer.x=Math.min(T,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(T,B){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=T,this._activeBuffer.y=this._activeBuffer.scrollTop+B):(this._activeBuffer.x=T,this._activeBuffer.y=B),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(T,B){this._restrictCursor(),this._setCursor(this._activeBuffer.x+T,this._activeBuffer.y+B)}cursorUp(T){const B=this._activeBuffer.y-this._activeBuffer.scrollTop;return B>=0?this._moveCursor(0,-Math.min(B,T.params[0]||1)):this._moveCursor(0,-(T.params[0]||1)),!0}cursorDown(T){const B=this._activeBuffer.scrollBottom-this._activeBuffer.y;return B>=0?this._moveCursor(0,Math.min(B,T.params[0]||1)):this._moveCursor(0,T.params[0]||1),!0}cursorForward(T){return this._moveCursor(T.params[0]||1,0),!0}cursorBackward(T){return this._moveCursor(-(T.params[0]||1),0),!0}cursorNextLine(T){return this.cursorDown(T),this._activeBuffer.x=0,!0}cursorPrecedingLine(T){return this.cursorUp(T),this._activeBuffer.x=0,!0}cursorCharAbsolute(T){return this._setCursor((T.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(T){return this._setCursor(T.length>=2?(T.params[1]||1)-1:0,(T.params[0]||1)-1),!0}charPosAbsolute(T){return this._setCursor((T.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(T){return this._moveCursor(T.params[0]||1,0),!0}linePosAbsolute(T){return this._setCursor(this._activeBuffer.x,(T.params[0]||1)-1),!0}vPositionRelative(T){return this._moveCursor(0,T.params[0]||1),!0}hVPosition(T){return this.cursorPosition(T),!0}tabClear(T){const B=T.params[0];return B===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:B===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(T){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let B=T.params[0]||1;for(;B--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(T){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let B=T.params[0]||1;for(;B--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(T){const B=T.params[0];return B===1&&(this._curAttrData.bg|=536870912),B!==2&&B!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(T,B,P,F=!1,G=!1){const Z=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);Z.replaceCells(B,P,this._activeBuffer.getNullCell(this._eraseAttrData()),G),F&&(Z.isWrapped=!1)}_resetBufferLine(T,B=!1){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);P&&(P.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),B),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+T),P.isWrapped=!1)}eraseInDisplay(T,B=!1){let P;switch(this._restrictCursor(this._bufferService.cols),T.params[0]){case 0:for(P=this._activeBuffer.y,this._dirtyRowTracker.markDirty(P),this._eraseInBufferLine(P++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,B);P<this._bufferService.rows;P++)this._resetBufferLine(P,B);this._dirtyRowTracker.markDirty(P);break;case 1:for(P=this._activeBuffer.y,this._dirtyRowTracker.markDirty(P),this._eraseInBufferLine(P,0,this._activeBuffer.x+1,!0,B),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(P+1).isWrapped=!1);P--;)this._resetBufferLine(P,B);this._dirtyRowTracker.markDirty(0);break;case 2:for(P=this._bufferService.rows,this._dirtyRowTracker.markDirty(P-1);P--;)this._resetBufferLine(P,B);this._dirtyRowTracker.markDirty(0);break;case 3:const F=this._activeBuffer.lines.length-this._bufferService.rows;F>0&&(this._activeBuffer.lines.trimStart(F),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-F,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-F,0),this._onScroll.fire(0))}return!0}eraseInLine(T,B=!1){switch(this._restrictCursor(this._bufferService.cols),T.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,B);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,B);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,B)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(T){this._restrictCursor();let B=T.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=this._activeBuffer.ybase+this._activeBuffer.y,F=this._bufferService.rows-1-this._activeBuffer.scrollBottom,G=this._bufferService.rows-1+this._activeBuffer.ybase-F+1;for(;B--;)this._activeBuffer.lines.splice(G-1,1),this._activeBuffer.lines.splice(P,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(T){this._restrictCursor();let B=T.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=this._activeBuffer.ybase+this._activeBuffer.y;let F;for(F=this._bufferService.rows-1-this._activeBuffer.scrollBottom,F=this._bufferService.rows-1+this._activeBuffer.ybase-F;B--;)this._activeBuffer.lines.splice(P,1),this._activeBuffer.lines.splice(F,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(T){this._restrictCursor();const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return B&&(B.insertCells(this._activeBuffer.x,T.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(T){this._restrictCursor();const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return B&&(B.deleteCells(this._activeBuffer.x,T.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(T){let B=T.params[0]||1;for(;B--;)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(T){let B=T.params[0]||1;for(;B--;)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(f.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(T){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=T.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);F.deleteCells(0,B,this._activeBuffer.getNullCell(this._eraseAttrData())),F.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(T){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=T.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);F.insertCells(0,B,this._activeBuffer.getNullCell(this._eraseAttrData())),F.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(T){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=T.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);F.insertCells(this._activeBuffer.x,B,this._activeBuffer.getNullCell(this._eraseAttrData())),F.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(T){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=T.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);F.deleteCells(this._activeBuffer.x,B,this._activeBuffer.getNullCell(this._eraseAttrData())),F.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(T){this._restrictCursor();const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return B&&(B.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(T.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(T){const B=this._parser.precedingJoinState;if(!B)return!0;const P=T.params[0]||1,F=R.UnicodeService.extractWidth(B),G=this._activeBuffer.x-F,Z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(G),ie=new Uint32Array(Z.length*P);let ae=0;for(let H=0;H<Z.length;){const re=Z.codePointAt(H)||0;ie[ae++]=re,H+=re>65535?2:1}let X=ae;for(let H=1;H<P;++H)ie.copyWithin(X,0,ae),X+=ae;return this.print(ie,0,X),!0}sendDeviceAttributesPrimary(T){return T.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(c.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(c.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(T){return T.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(c.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(c.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(T.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(c.C0.ESC+"[>83;40003;0c")),!0}_is(T){return(this._optionsService.rawOptions.termName+"").indexOf(T)===0}setMode(T){for(let B=0;B<T.length;B++)switch(T.params[B]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(T){for(let B=0;B<T.length;B++)switch(T.params[B]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,m.DEFAULT_CHARSET),this._charsetService.setgCharset(1,m.DEFAULT_CHARSET),this._charsetService.setgCharset(2,m.DEFAULT_CHARSET),this._charsetService.setgCharset(3,m.DEFAULT_CHARSET);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(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(T){for(let B=0;B<T.length;B++)switch(T.params[B]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(T){for(let B=0;B<T.length;B++)switch(T.params[B]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),T.params[B]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(T,B){const P=this._coreService.decPrivateModes,{activeProtocol:F,activeEncoding:G}=this._coreMouseService,Z=this._coreService,{buffers:ie,cols:ae}=this._bufferService,{active:X,alt:H}=ie,re=this._optionsService.rawOptions,te=Se=>Se?1:2,ce=T.params[0];return le=ce,pe=B?ce===2?4:ce===4?te(Z.modes.insertMode):ce===12?3:ce===20?te(re.convertEol):0:ce===1?te(P.applicationCursorKeys):ce===3?re.windowOptions.setWinLines?ae===80?2:ae===132?1:0:0:ce===6?te(P.origin):ce===7?te(P.wraparound):ce===8?3:ce===9?te(F==="X10"):ce===12?te(re.cursorBlink):ce===25?te(!Z.isCursorHidden):ce===45?te(P.reverseWraparound):ce===66?te(P.applicationKeypad):ce===67?4:ce===1e3?te(F==="VT200"):ce===1002?te(F==="DRAG"):ce===1003?te(F==="ANY"):ce===1004?te(P.sendFocus):ce===1005?4:ce===1006?te(G==="SGR"):ce===1015?4:ce===1016?te(G==="SGR_PIXELS"):ce===1048?1:ce===47||ce===1047||ce===1049?te(X===H):ce===2004?te(P.bracketedPasteMode):0,Z.triggerDataEvent(`${c.C0.ESC}[${B?"":"?"}${le};${pe}$y`),!0;var le,pe}_updateAttrColor(T,B,P,F,G){return B===2?(T|=50331648,T&=-16777216,T|=w.AttributeData.fromColorRGB([P,F,G])):B===5&&(T&=-50331904,T|=33554432|255&P),T}_extractColor(T,B,P){const F=[0,0,-1,0,0,0];let G=0,Z=0;do{if(F[Z+G]=T.params[B+Z],T.hasSubParams(B+Z)){const ie=T.getSubParams(B+Z);let ae=0;do F[1]===5&&(G=1),F[Z+ae+1+G]=ie[ae];while(++ae<ie.length&&ae+Z+1+G<F.length);break}if(F[1]===5&&Z+G>=2||F[1]===2&&Z+G>=5)break;F[1]&&(G=1)}while(++Z+B<T.length&&Z+G<F.length);for(let ie=2;ie<F.length;++ie)F[ie]===-1&&(F[ie]=0);switch(F[0]){case 38:P.fg=this._updateAttrColor(P.fg,F[1],F[3],F[4],F[5]);break;case 48:P.bg=this._updateAttrColor(P.bg,F[1],F[3],F[4],F[5]);break;case 58:P.extended=P.extended.clone(),P.extended.underlineColor=this._updateAttrColor(P.extended.underlineColor,F[1],F[3],F[4],F[5])}return Z}_processUnderline(T,B){B.extended=B.extended.clone(),(!~T||T>5)&&(T=1),B.extended.underlineStyle=T,B.fg|=268435456,T===0&&(B.fg&=-268435457),B.updateExtended()}_processSGR0(T){T.fg=f.DEFAULT_ATTR_DATA.fg,T.bg=f.DEFAULT_ATTR_DATA.bg,T.extended=T.extended.clone(),T.extended.underlineStyle=0,T.extended.underlineColor&=-67108864,T.updateExtended()}charAttributes(T){if(T.length===1&&T.params[0]===0)return this._processSGR0(this._curAttrData),!0;const B=T.length;let P;const F=this._curAttrData;for(let G=0;G<B;G++)P=T.params[G],P>=30&&P<=37?(F.fg&=-50331904,F.fg|=16777216|P-30):P>=40&&P<=47?(F.bg&=-50331904,F.bg|=16777216|P-40):P>=90&&P<=97?(F.fg&=-50331904,F.fg|=16777224|P-90):P>=100&&P<=107?(F.bg&=-50331904,F.bg|=16777224|P-100):P===0?this._processSGR0(F):P===1?F.fg|=134217728:P===3?F.bg|=67108864:P===4?(F.fg|=268435456,this._processUnderline(T.hasSubParams(G)?T.getSubParams(G)[0]:1,F)):P===5?F.fg|=536870912:P===7?F.fg|=67108864:P===8?F.fg|=1073741824:P===9?F.fg|=2147483648:P===2?F.bg|=134217728:P===21?this._processUnderline(2,F):P===22?(F.fg&=-134217729,F.bg&=-134217729):P===23?F.bg&=-67108865:P===24?(F.fg&=-268435457,this._processUnderline(0,F)):P===25?F.fg&=-536870913:P===27?F.fg&=-67108865:P===28?F.fg&=-1073741825:P===29?F.fg&=2147483647:P===39?(F.fg&=-67108864,F.fg|=16777215&f.DEFAULT_ATTR_DATA.fg):P===49?(F.bg&=-67108864,F.bg|=16777215&f.DEFAULT_ATTR_DATA.bg):P===38||P===48||P===58?G+=this._extractColor(T,G,F):P===53?F.bg|=1073741824:P===55?F.bg&=-1073741825:P===59?(F.extended=F.extended.clone(),F.extended.underlineColor=-1,F.updateExtended()):P===100?(F.fg&=-67108864,F.fg|=16777215&f.DEFAULT_ATTR_DATA.fg,F.bg&=-67108864,F.bg|=16777215&f.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",P);return!0}deviceStatus(T){switch(T.params[0]){case 5:this._coreService.triggerDataEvent(`${c.C0.ESC}[0n`);break;case 6:const B=this._activeBuffer.y+1,P=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${c.C0.ESC}[${B};${P}R`)}return!0}deviceStatusPrivate(T){if(T.params[0]===6){const B=this._activeBuffer.y+1,P=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${c.C0.ESC}[?${B};${P}R`)}return!0}softReset(T){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=f.DEFAULT_ATTR_DATA.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(T){const B=T.params[0]||1;switch(B){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const P=B%2==1;return this._optionsService.options.cursorBlink=P,!0}setScrollRegion(T){const B=T.params[0]||1;let P;return(T.length<2||(P=T.params[1])>this._bufferService.rows||P===0)&&(P=this._bufferService.rows),P>B&&(this._activeBuffer.scrollTop=B-1,this._activeBuffer.scrollBottom=P-1,this._setCursor(0,0)),!0}windowOptions(T){if(!j(T.params[0],this._optionsService.rawOptions.windowOptions))return!0;const B=T.length>1?T.params[1]:0;switch(T.params[0]){case 14:B!==2&&this._onRequestWindowsOptionsReport.fire(N.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(N.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${c.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:B!==0&&B!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),B!==0&&B!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:B!==0&&B!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),B!==0&&B!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(T){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(T){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(T){return this._windowTitle=T,this._onTitleChange.fire(T),!0}setIconName(T){return this._iconName=T,!0}setOrReportIndexedColor(T){const B=[],P=T.split(";");for(;P.length>1;){const F=P.shift(),G=P.shift();if(/^\d+$/.exec(F)){const Z=parseInt(F);if(K(Z))if(G==="?")B.push({type:0,index:Z});else{const ie=(0,M.parseColor)(G);ie&&B.push({type:1,index:Z,color:ie})}}}return B.length&&this._onColor.fire(B),!0}setHyperlink(T){const B=T.split(";");return!(B.length<2)&&(B[1]?this._createHyperlink(B[0],B[1]):!B[0]&&this._finishHyperlink())}_createHyperlink(T,B){this._getCurrentLinkId()&&this._finishHyperlink();const P=T.split(":");let F;const G=P.findIndex((Z=>Z.startsWith("id=")));return G!==-1&&(F=P[G].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:F,uri:B}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(T,B){const P=T.split(";");for(let F=0;F<P.length&&!(B>=this._specialColors.length);++F,++B)if(P[F]==="?")this._onColor.fire([{type:0,index:this._specialColors[B]}]);else{const G=(0,M.parseColor)(P[F]);G&&this._onColor.fire([{type:1,index:this._specialColors[B],color:G}])}return!0}setOrReportFgColor(T){return this._setOrReportSpecialColor(T,0)}setOrReportBgColor(T){return this._setOrReportSpecialColor(T,1)}setOrReportCursorColor(T){return this._setOrReportSpecialColor(T,2)}restoreIndexedColor(T){if(!T)return this._onColor.fire([{type:2}]),!0;const B=[],P=T.split(";");for(let F=0;F<P.length;++F)if(/^\d+$/.exec(P[F])){const G=parseInt(P[F]);K(G)&&B.push({type:2,index:G})}return B.length&&this._onColor.fire(B),!0}restoreFgColor(T){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(T){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(T){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,m.DEFAULT_CHARSET),!0}selectCharset(T){return T.length!==2?(this.selectDefaultCharset(),!0):(T[0]==="/"||this._charsetService.setgCharset(W[T[0]],m.CHARSETS[T[1]]||m.DEFAULT_CHARSET),!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){const T=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,T,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=f.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=f.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(T){return this._charsetService.setgLevel(T),!0}screenAlignmentPattern(){const T=new u.CellData;T.content=4194373,T.fg=this._curAttrData.fg,T.bg=this._curAttrData.bg,this._setCursor(0,0);for(let B=0;B<this._bufferService.rows;++B){const P=this._activeBuffer.ybase+this._activeBuffer.y+B,F=this._activeBuffer.lines.get(P);F&&(F.fill(T),F.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(T,B){const P=this._bufferService.buffer,F=this._optionsService.rawOptions;return(G=>(this._coreService.triggerDataEvent(`${c.C0.ESC}${G}${c.C0.ESC}\\`),!0))(T==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:T==='"p'?'P1$r61;1"p':T==="r"?`P1$r${P.scrollTop+1};${P.scrollBottom+1}r`:T==="m"?"P1$r0m":T===" q"?`P1$r${{block:2,underline:4,bar:6}[F.cursorStyle]-(F.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(T,B){this._dirtyRowTracker.markRangeDirty(T,B)}}a.InputHandler=q;let U=class{constructor(V){this._bufferService=V,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(V){V<this.start?this.start=V:V>this.end&&(this.end=V)}markRangeDirty(V,T){V>T&&(I=V,V=T,T=I),V<this.start&&(this.start=V),T>this.end&&(this.end=T)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function K(V){return 0<=V&&V<256}U=_([v(0,L.IBufferService)],U)},844:(y,a)=>{function l(_){for(const v of _)v.dispose();_.length=0}Object.defineProperty(a,"__esModule",{value:!0}),a.getDisposeArrayDisposable=a.disposeArray=a.toDisposable=a.MutableDisposable=a.Disposable=void 0,a.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const _ of this._disposables)_.dispose();this._disposables.length=0}register(_){return this._disposables.push(_),_}unregister(_){const v=this._disposables.indexOf(_);v!==-1&&this._disposables.splice(v,1)}},a.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(_){var v;this._isDisposed||_===this._value||((v=this._value)==null||v.dispose(),this._value=_)}clear(){this.value=void 0}dispose(){var _;this._isDisposed=!0,(_=this._value)==null||_.dispose(),this._value=void 0}},a.toDisposable=function(_){return{dispose:_}},a.disposeArray=l,a.getDisposeArrayDisposable=function(_){return{dispose:()=>l(_)}}},1505:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.FourKeyMap=a.TwoKeyMap=void 0;class l{constructor(){this._data={}}set(v,c,m){this._data[v]||(this._data[v]={}),this._data[v][c]=m}get(v,c){return this._data[v]?this._data[v][c]:void 0}clear(){this._data={}}}a.TwoKeyMap=l,a.FourKeyMap=class{constructor(){this._data=new l}set(_,v,c,m,C){this._data.get(_,v)||this._data.set(_,v,new l),this._data.get(_,v).set(c,m,C)}get(_,v,c,m){var C;return(C=this._data.get(_,v))==null?void 0:C.get(c,m)}clear(){this._data.clear()}}},6114:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.isChromeOS=a.isLinux=a.isWindows=a.isIphone=a.isIpad=a.isMac=a.getSafariVersion=a.isSafari=a.isLegacyEdge=a.isFirefox=a.isNode=void 0,a.isNode=typeof process<"u"&&"title"in process;const l=a.isNode?"node":navigator.userAgent,_=a.isNode?"node":navigator.platform;a.isFirefox=l.includes("Firefox"),a.isLegacyEdge=l.includes("Edge"),a.isSafari=/^((?!chrome|android).)*safari/i.test(l),a.getSafariVersion=function(){if(!a.isSafari)return 0;const v=l.match(/Version\/(\d+)/);return v===null||v.length<2?0:parseInt(v[1])},a.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(_),a.isIpad=_==="iPad",a.isIphone=_==="iPhone",a.isWindows=["Windows","Win16","Win32","WinCE"].includes(_),a.isLinux=_.indexOf("Linux")>=0,a.isChromeOS=/\bCrOS\b/.test(l)},6106:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.SortedList=void 0;let l=0;a.SortedList=class{constructor(_){this._getKey=_,this._array=[]}clear(){this._array.length=0}insert(_){this._array.length!==0?(l=this._search(this._getKey(_)),this._array.splice(l,0,_)):this._array.push(_)}delete(_){if(this._array.length===0)return!1;const v=this._getKey(_);if(v===void 0||(l=this._search(v),l===-1)||this._getKey(this._array[l])!==v)return!1;do if(this._array[l]===_)return this._array.splice(l,1),!0;while(++l<this._array.length&&this._getKey(this._array[l])===v);return!1}*getKeyIterator(_){if(this._array.length!==0&&(l=this._search(_),!(l<0||l>=this._array.length)&&this._getKey(this._array[l])===_))do yield this._array[l];while(++l<this._array.length&&this._getKey(this._array[l])===_)}forEachByKey(_,v){if(this._array.length!==0&&(l=this._search(_),!(l<0||l>=this._array.length)&&this._getKey(this._array[l])===_))do v(this._array[l]);while(++l<this._array.length&&this._getKey(this._array[l])===_)}values(){return[...this._array].values()}_search(_){let v=0,c=this._array.length-1;for(;c>=v;){let m=v+c>>1;const C=this._getKey(this._array[m]);if(C>_)c=m-1;else{if(!(C<_)){for(;m>0&&this._getKey(this._array[m-1])===_;)m--;return m}v=m+1}}return v}}},7226:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DebouncedIdleTask=a.IdleTaskQueue=a.PriorityTaskQueue=void 0;const _=l(6114);class v{constructor(){this._tasks=[],this._i=0}enqueue(C){this._tasks.push(C),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(C){this._idleCallback=void 0;let b=0,x=0,f=C.timeRemaining(),p=0;for(;this._i<this._tasks.length;){if(b=Date.now(),this._tasks[this._i]()||this._i++,b=Math.max(1,Date.now()-b),x=Math.max(b,x),p=C.timeRemaining(),1.5*x>p)return f-b<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(f-b))}ms`),void this._start();f=p}this.clear()}}class c extends v{_requestCallback(C){return setTimeout((()=>C(this._createDeadline(16))))}_cancelCallback(C){clearTimeout(C)}_createDeadline(C){const b=Date.now()+C;return{timeRemaining:()=>Math.max(0,b-Date.now())}}}a.PriorityTaskQueue=c,a.IdleTaskQueue=!_.isNode&&"requestIdleCallback"in window?class extends v{_requestCallback(m){return requestIdleCallback(m)}_cancelCallback(m){cancelIdleCallback(m)}}:c,a.DebouncedIdleTask=class{constructor(){this._queue=new a.IdleTaskQueue}set(m){this._queue.clear(),this._queue.enqueue(m)}flush(){this._queue.flush()}}},9282:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.updateWindowsModeWrappedState=void 0;const _=l(643);a.updateWindowsModeWrappedState=function(v){const c=v.buffer.lines.get(v.buffer.ybase+v.buffer.y-1),m=c==null?void 0:c.get(v.cols-1),C=v.buffer.lines.get(v.buffer.ybase+v.buffer.y);C&&m&&(C.isWrapped=m[_.CHAR_DATA_CODE_INDEX]!==_.NULL_CELL_CODE&&m[_.CHAR_DATA_CODE_INDEX]!==_.WHITESPACE_CELL_CODE)}},3734:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ExtendedAttrs=a.AttributeData=void 0;class l{constructor(){this.fg=0,this.bg=0,this.extended=new _}static toColorRGB(c){return[c>>>16&255,c>>>8&255,255&c]}static fromColorRGB(c){return(255&c[0])<<16|(255&c[1])<<8|255&c[2]}clone(){const c=new l;return c.fg=this.fg,c.bg=this.bg,c.extended=this.extended.clone(),c}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}a.AttributeData=l;class _{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(c){this._ext=c}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(c){this._ext&=-469762049,this._ext|=c<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(c){this._ext&=-67108864,this._ext|=67108863&c}get urlId(){return this._urlId}set urlId(c){this._urlId=c}get underlineVariantOffset(){const c=(3758096384&this._ext)>>29;return c<0?4294967288^c:c}set underlineVariantOffset(c){this._ext&=536870911,this._ext|=c<<29&3758096384}constructor(c=0,m=0){this._ext=0,this._urlId=0,this._ext=c,this._urlId=m}clone(){return new _(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}a.ExtendedAttrs=_},9092:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Buffer=a.MAX_BUFFER_SIZE=void 0;const _=l(6349),v=l(7226),c=l(3734),m=l(8437),C=l(4634),b=l(511),x=l(643),f=l(4863),p=l(7116);a.MAX_BUFFER_SIZE=4294967295,a.Buffer=class{constructor(d,u,w){this._hasScrollback=d,this._optionsService=u,this._bufferService=w,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=m.DEFAULT_ATTR_DATA.clone(),this.savedCharset=p.DEFAULT_CHARSET,this.markers=[],this._nullCell=b.CellData.fromCharData([0,x.NULL_CELL_CHAR,x.NULL_CELL_WIDTH,x.NULL_CELL_CODE]),this._whitespaceCell=b.CellData.fromCharData([0,x.WHITESPACE_CELL_CHAR,x.WHITESPACE_CELL_WIDTH,x.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new v.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new _.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(d){return d?(this._nullCell.fg=d.fg,this._nullCell.bg=d.bg,this._nullCell.extended=d.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new c.ExtendedAttrs),this._nullCell}getWhitespaceCell(d){return d?(this._whitespaceCell.fg=d.fg,this._whitespaceCell.bg=d.bg,this._whitespaceCell.extended=d.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new c.ExtendedAttrs),this._whitespaceCell}getBlankLine(d,u){return new m.BufferLine(this._bufferService.cols,this.getNullCell(d),u)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const d=this.ybase+this.y-this.ydisp;return d>=0&&d<this._rows}_getCorrectBufferLength(d){if(!this._hasScrollback)return d;const u=d+this._optionsService.rawOptions.scrollback;return u>a.MAX_BUFFER_SIZE?a.MAX_BUFFER_SIZE:u}fillViewportRows(d){if(this.lines.length===0){d===void 0&&(d=m.DEFAULT_ATTR_DATA);let u=this._rows;for(;u--;)this.lines.push(this.getBlankLine(d))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new _.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(d,u){const w=this.getNullCell(m.DEFAULT_ATTR_DATA);let L=0;const R=this._getCorrectBufferLength(u);if(R>this.lines.maxLength&&(this.lines.maxLength=R),this.lines.length>0){if(this._cols<d)for(let k=0;k<this.lines.length;k++)L+=+this.lines.get(k).resize(d,w);let D=0;if(this._rows<u)for(let k=this._rows;k<u;k++)this.lines.length<u+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new m.BufferLine(d,w)):this.ybase>0&&this.lines.length<=this.ybase+this.y+D+1?(this.ybase--,D++,this.ydisp>0&&this.ydisp--):this.lines.push(new m.BufferLine(d,w)));else for(let k=this._rows;k>u;k--)this.lines.length>u+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(R<this.lines.maxLength){const k=this.lines.length-R;k>0&&(this.lines.trimStart(k),this.ybase=Math.max(this.ybase-k,0),this.ydisp=Math.max(this.ydisp-k,0),this.savedY=Math.max(this.savedY-k,0)),this.lines.maxLength=R}this.x=Math.min(this.x,d-1),this.y=Math.min(this.y,u-1),D&&(this.y+=D),this.savedX=Math.min(this.savedX,d-1),this.scrollTop=0}if(this.scrollBottom=u-1,this._isReflowEnabled&&(this._reflow(d,u),this._cols>d))for(let D=0;D<this.lines.length;D++)L+=+this.lines.get(D).resize(d,w);this._cols=d,this._rows=u,this._memoryCleanupQueue.clear(),L>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let d=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,d=!1);let u=0;for(;this._memoryCleanupPosition<this.lines.length;)if(u+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),u>100)return!0;return d}get _isReflowEnabled(){const d=this._optionsService.rawOptions.windowsPty;return d&&d.buildNumber?this._hasScrollback&&d.backend==="conpty"&&d.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(d,u){this._cols!==d&&(d>this._cols?this._reflowLarger(d,u):this._reflowSmaller(d,u))}_reflowLarger(d,u){const w=(0,C.reflowLargerGetLinesToRemove)(this.lines,this._cols,d,this.ybase+this.y,this.getNullCell(m.DEFAULT_ATTR_DATA));if(w.length>0){const L=(0,C.reflowLargerCreateNewLayout)(this.lines,w);(0,C.reflowLargerApplyNewLayout)(this.lines,L.layout),this._reflowLargerAdjustViewport(d,u,L.countRemoved)}}_reflowLargerAdjustViewport(d,u,w){const L=this.getNullCell(m.DEFAULT_ATTR_DATA);let R=w;for(;R-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<u&&this.lines.push(new m.BufferLine(d,L))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-w,0)}_reflowSmaller(d,u){const w=this.getNullCell(m.DEFAULT_ATTR_DATA),L=[];let R=0;for(let D=this.lines.length-1;D>=0;D--){let k=this.lines.get(D);if(!k||!k.isWrapped&&k.getTrimmedLength()<=d)continue;const M=[k];for(;k.isWrapped&&D>0;)k=this.lines.get(--D),M.unshift(k);const W=this.ybase+this.y;if(W>=D&&W<D+M.length)continue;const z=M[M.length-1].getTrimmedLength(),j=(0,C.reflowSmallerGetNewLineLengths)(M,this._cols,d),N=j.length-M.length;let I;I=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+N):Math.max(0,this.lines.length-this.lines.maxLength+N);const q=[];for(let P=0;P<N;P++){const F=this.getBlankLine(m.DEFAULT_ATTR_DATA,!0);q.push(F)}q.length>0&&(L.push({start:D+M.length+R,newLines:q}),R+=q.length),M.push(...q);let U=j.length-1,K=j[U];K===0&&(U--,K=j[U]);let V=M.length-N-1,T=z;for(;V>=0;){const P=Math.min(T,K);if(M[U]===void 0)break;if(M[U].copyCellsFrom(M[V],T-P,K-P,P,!0),K-=P,K===0&&(U--,K=j[U]),T-=P,T===0){V--;const F=Math.max(V,0);T=(0,C.getWrappedLineTrimmedLength)(M,F,this._cols)}}for(let P=0;P<M.length;P++)j[P]<d&&M[P].setCell(j[P],w);let B=N-I;for(;B-- >0;)this.ybase===0?this.y<u-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+R)-u&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+N,this.ybase+u-1)}if(L.length>0){const D=[],k=[];for(let U=0;U<this.lines.length;U++)k.push(this.lines.get(U));const M=this.lines.length;let W=M-1,z=0,j=L[z];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+R);let N=0;for(let U=Math.min(this.lines.maxLength-1,M+R-1);U>=0;U--)if(j&&j.start>W+N){for(let K=j.newLines.length-1;K>=0;K--)this.lines.set(U--,j.newLines[K]);U++,D.push({index:W+1,amount:j.newLines.length}),N+=j.newLines.length,j=L[++z]}else this.lines.set(U,k[W--]);let I=0;for(let U=D.length-1;U>=0;U--)D[U].index+=I,this.lines.onInsertEmitter.fire(D[U]),I+=D[U].amount;const q=Math.max(0,M+R-this.lines.maxLength);q>0&&this.lines.onTrimEmitter.fire(q)}}translateBufferLineToString(d,u,w=0,L){const R=this.lines.get(d);return R?R.translateToString(u,w,L):""}getWrappedRangeForLine(d){let u=d,w=d;for(;u>0&&this.lines.get(u).isWrapped;)u--;for(;w+1<this.lines.length&&this.lines.get(w+1).isWrapped;)w++;return{first:u,last:w}}setupTabStops(d){for(d!=null?this.tabs[d]||(d=this.prevStop(d)):(this.tabs={},d=0);d<this._cols;d+=this._optionsService.rawOptions.tabStopWidth)this.tabs[d]=!0}prevStop(d){for(d==null&&(d=this.x);!this.tabs[--d]&&d>0;);return d>=this._cols?this._cols-1:d<0?0:d}nextStop(d){for(d==null&&(d=this.x);!this.tabs[++d]&&d<this._cols;);return d>=this._cols?this._cols-1:d<0?0:d}clearMarkers(d){this._isClearing=!0;for(let u=0;u<this.markers.length;u++)this.markers[u].line===d&&(this.markers[u].dispose(),this.markers.splice(u--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let d=0;d<this.markers.length;d++)this.markers[d].dispose(),this.markers.splice(d--,1);this._isClearing=!1}addMarker(d){const u=new f.Marker(d);return this.markers.push(u),u.register(this.lines.onTrim((w=>{u.line-=w,u.line<0&&u.dispose()}))),u.register(this.lines.onInsert((w=>{u.line>=w.index&&(u.line+=w.amount)}))),u.register(this.lines.onDelete((w=>{u.line>=w.index&&u.line<w.index+w.amount&&u.dispose(),u.line>w.index&&(u.line-=w.amount)}))),u.register(u.onDispose((()=>this._removeMarker(u)))),u}_removeMarker(d){this._isClearing||this.markers.splice(this.markers.indexOf(d),1)}}},8437:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferLine=a.DEFAULT_ATTR_DATA=void 0;const _=l(3734),v=l(511),c=l(643),m=l(482);a.DEFAULT_ATTR_DATA=Object.freeze(new _.AttributeData);let C=0;class b{constructor(f,p,d=!1){this.isWrapped=d,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*f);const u=p||v.CellData.fromCharData([0,c.NULL_CELL_CHAR,c.NULL_CELL_WIDTH,c.NULL_CELL_CODE]);for(let w=0;w<f;++w)this.setCell(w,u);this.length=f}get(f){const p=this._data[3*f+0],d=2097151&p;return[this._data[3*f+1],2097152&p?this._combined[f]:d?(0,m.stringFromCodePoint)(d):"",p>>22,2097152&p?this._combined[f].charCodeAt(this._combined[f].length-1):d]}set(f,p){this._data[3*f+1]=p[c.CHAR_DATA_ATTR_INDEX],p[c.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[f]=p[1],this._data[3*f+0]=2097152|f|p[c.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*f+0]=p[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|p[c.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(f){return this._data[3*f+0]>>22}hasWidth(f){return 12582912&this._data[3*f+0]}getFg(f){return this._data[3*f+1]}getBg(f){return this._data[3*f+2]}hasContent(f){return 4194303&this._data[3*f+0]}getCodePoint(f){const p=this._data[3*f+0];return 2097152&p?this._combined[f].charCodeAt(this._combined[f].length-1):2097151&p}isCombined(f){return 2097152&this._data[3*f+0]}getString(f){const p=this._data[3*f+0];return 2097152&p?this._combined[f]:2097151&p?(0,m.stringFromCodePoint)(2097151&p):""}isProtected(f){return 536870912&this._data[3*f+2]}loadCell(f,p){return C=3*f,p.content=this._data[C+0],p.fg=this._data[C+1],p.bg=this._data[C+2],2097152&p.content&&(p.combinedData=this._combined[f]),268435456&p.bg&&(p.extended=this._extendedAttrs[f]),p}setCell(f,p){2097152&p.content&&(this._combined[f]=p.combinedData),268435456&p.bg&&(this._extendedAttrs[f]=p.extended),this._data[3*f+0]=p.content,this._data[3*f+1]=p.fg,this._data[3*f+2]=p.bg}setCellFromCodepoint(f,p,d,u){268435456&u.bg&&(this._extendedAttrs[f]=u.extended),this._data[3*f+0]=p|d<<22,this._data[3*f+1]=u.fg,this._data[3*f+2]=u.bg}addCodepointToCell(f,p,d){let u=this._data[3*f+0];2097152&u?this._combined[f]+=(0,m.stringFromCodePoint)(p):2097151&u?(this._combined[f]=(0,m.stringFromCodePoint)(2097151&u)+(0,m.stringFromCodePoint)(p),u&=-2097152,u|=2097152):u=p|4194304,d&&(u&=-12582913,u|=d<<22),this._data[3*f+0]=u}insertCells(f,p,d){if((f%=this.length)&&this.getWidth(f-1)===2&&this.setCellFromCodepoint(f-1,0,1,d),p<this.length-f){const u=new v.CellData;for(let w=this.length-f-p-1;w>=0;--w)this.setCell(f+p+w,this.loadCell(f+w,u));for(let w=0;w<p;++w)this.setCell(f+w,d)}else for(let u=f;u<this.length;++u)this.setCell(u,d);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,d)}deleteCells(f,p,d){if(f%=this.length,p<this.length-f){const u=new v.CellData;for(let w=0;w<this.length-f-p;++w)this.setCell(f+w,this.loadCell(f+p+w,u));for(let w=this.length-p;w<this.length;++w)this.setCell(w,d)}else for(let u=f;u<this.length;++u)this.setCell(u,d);f&&this.getWidth(f-1)===2&&this.setCellFromCodepoint(f-1,0,1,d),this.getWidth(f)!==0||this.hasContent(f)||this.setCellFromCodepoint(f,0,1,d)}replaceCells(f,p,d,u=!1){if(u)for(f&&this.getWidth(f-1)===2&&!this.isProtected(f-1)&&this.setCellFromCodepoint(f-1,0,1,d),p<this.length&&this.getWidth(p-1)===2&&!this.isProtected(p)&&this.setCellFromCodepoint(p,0,1,d);f<p&&f<this.length;)this.isProtected(f)||this.setCell(f,d),f++;else for(f&&this.getWidth(f-1)===2&&this.setCellFromCodepoint(f-1,0,1,d),p<this.length&&this.getWidth(p-1)===2&&this.setCellFromCodepoint(p,0,1,d);f<p&&f<this.length;)this.setCell(f++,d)}resize(f,p){if(f===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const d=3*f;if(f>this.length){if(this._data.buffer.byteLength>=4*d)this._data=new Uint32Array(this._data.buffer,0,d);else{const u=new Uint32Array(d);u.set(this._data),this._data=u}for(let u=this.length;u<f;++u)this.setCell(u,p)}else{this._data=this._data.subarray(0,d);const u=Object.keys(this._combined);for(let L=0;L<u.length;L++){const R=parseInt(u[L],10);R>=f&&delete this._combined[R]}const w=Object.keys(this._extendedAttrs);for(let L=0;L<w.length;L++){const R=parseInt(w[L],10);R>=f&&delete this._extendedAttrs[R]}}return this.length=f,4*d*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const f=new Uint32Array(this._data.length);return f.set(this._data),this._data=f,1}return 0}fill(f,p=!1){if(p)for(let d=0;d<this.length;++d)this.isProtected(d)||this.setCell(d,f);else{this._combined={},this._extendedAttrs={};for(let d=0;d<this.length;++d)this.setCell(d,f)}}copyFrom(f){this.length!==f.length?this._data=new Uint32Array(f._data):this._data.set(f._data),this.length=f.length,this._combined={};for(const p in f._combined)this._combined[p]=f._combined[p];this._extendedAttrs={};for(const p in f._extendedAttrs)this._extendedAttrs[p]=f._extendedAttrs[p];this.isWrapped=f.isWrapped}clone(){const f=new b(0);f._data=new Uint32Array(this._data),f.length=this.length;for(const p in this._combined)f._combined[p]=this._combined[p];for(const p in this._extendedAttrs)f._extendedAttrs[p]=this._extendedAttrs[p];return f.isWrapped=this.isWrapped,f}getTrimmedLength(){for(let f=this.length-1;f>=0;--f)if(4194303&this._data[3*f+0])return f+(this._data[3*f+0]>>22);return 0}getNoBgTrimmedLength(){for(let f=this.length-1;f>=0;--f)if(4194303&this._data[3*f+0]||50331648&this._data[3*f+2])return f+(this._data[3*f+0]>>22);return 0}copyCellsFrom(f,p,d,u,w){const L=f._data;if(w)for(let D=u-1;D>=0;D--){for(let k=0;k<3;k++)this._data[3*(d+D)+k]=L[3*(p+D)+k];268435456&L[3*(p+D)+2]&&(this._extendedAttrs[d+D]=f._extendedAttrs[p+D])}else for(let D=0;D<u;D++){for(let k=0;k<3;k++)this._data[3*(d+D)+k]=L[3*(p+D)+k];268435456&L[3*(p+D)+2]&&(this._extendedAttrs[d+D]=f._extendedAttrs[p+D])}const R=Object.keys(f._combined);for(let D=0;D<R.length;D++){const k=parseInt(R[D],10);k>=p&&(this._combined[k-p+d]=f._combined[k])}}translateToString(f,p,d,u){p=p??0,d=d??this.length,f&&(d=Math.min(d,this.getTrimmedLength())),u&&(u.length=0);let w="";for(;p<d;){const L=this._data[3*p+0],R=2097151&L,D=2097152&L?this._combined[p]:R?(0,m.stringFromCodePoint)(R):c.WHITESPACE_CELL_CHAR;if(w+=D,u)for(let k=0;k<D.length;++k)u.push(p);p+=L>>22||1}return u&&u.push(p),w}}a.BufferLine=b},4841:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.getRangeLength=void 0,a.getRangeLength=function(l,_){if(l.start.y>l.end.y)throw new Error(`Buffer range end (${l.end.x}, ${l.end.y}) cannot be before start (${l.start.x}, ${l.start.y})`);return _*(l.end.y-l.start.y)+(l.end.x-l.start.x+1)}},4634:(y,a)=>{function l(_,v,c){if(v===_.length-1)return _[v].getTrimmedLength();const m=!_[v].hasContent(c-1)&&_[v].getWidth(c-1)===1,C=_[v+1].getWidth(0)===2;return m&&C?c-1:c}Object.defineProperty(a,"__esModule",{value:!0}),a.getWrappedLineTrimmedLength=a.reflowSmallerGetNewLineLengths=a.reflowLargerApplyNewLayout=a.reflowLargerCreateNewLayout=a.reflowLargerGetLinesToRemove=void 0,a.reflowLargerGetLinesToRemove=function(_,v,c,m,C){const b=[];for(let x=0;x<_.length-1;x++){let f=x,p=_.get(++f);if(!p.isWrapped)continue;const d=[_.get(x)];for(;f<_.length&&p.isWrapped;)d.push(p),p=_.get(++f);if(m>=x&&m<f){x+=d.length-1;continue}let u=0,w=l(d,u,v),L=1,R=0;for(;L<d.length;){const k=l(d,L,v),M=k-R,W=c-w,z=Math.min(M,W);d[u].copyCellsFrom(d[L],R,w,z,!1),w+=z,w===c&&(u++,w=0),R+=z,R===k&&(L++,R=0),w===0&&u!==0&&d[u-1].getWidth(c-1)===2&&(d[u].copyCellsFrom(d[u-1],c-1,w++,1,!1),d[u-1].setCell(c-1,C))}d[u].replaceCells(w,c,C);let D=0;for(let k=d.length-1;k>0&&(k>u||d[k].getTrimmedLength()===0);k--)D++;D>0&&(b.push(x+d.length-D),b.push(D)),x+=d.length-1}return b},a.reflowLargerCreateNewLayout=function(_,v){const c=[];let m=0,C=v[m],b=0;for(let x=0;x<_.length;x++)if(C===x){const f=v[++m];_.onDeleteEmitter.fire({index:x-b,amount:f}),x+=f-1,b+=f,C=v[++m]}else c.push(x);return{layout:c,countRemoved:b}},a.reflowLargerApplyNewLayout=function(_,v){const c=[];for(let m=0;m<v.length;m++)c.push(_.get(v[m]));for(let m=0;m<c.length;m++)_.set(m,c[m]);_.length=v.length},a.reflowSmallerGetNewLineLengths=function(_,v,c){const m=[],C=_.map(((p,d)=>l(_,d,v))).reduce(((p,d)=>p+d));let b=0,x=0,f=0;for(;f<C;){if(C-f<c){m.push(C-f);break}b+=c;const p=l(_,x,v);b>p&&(b-=p,x++);const d=_[x].getWidth(b-1)===2;d&&b--;const u=d?c-1:c;m.push(u),f+=u}return m},a.getWrappedLineTrimmedLength=l},5295:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferSet=void 0;const _=l(8460),v=l(844),c=l(9092);class m extends v.Disposable{constructor(b,x){super(),this._optionsService=b,this._bufferService=x,this._onBufferActivate=this.register(new _.EventEmitter),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 c.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new c.Buffer(!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(b){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(b),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(b,x){this._normal.resize(b,x),this._alt.resize(b,x),this.setupTabStops(b)}setupTabStops(b){this._normal.setupTabStops(b),this._alt.setupTabStops(b)}}a.BufferSet=m},511:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CellData=void 0;const _=l(482),v=l(643),c=l(3734);class m extends c.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new c.ExtendedAttrs,this.combinedData=""}static fromCharData(b){const x=new m;return x.setFromCharData(b),x}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,_.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(b){this.fg=b[v.CHAR_DATA_ATTR_INDEX],this.bg=0;let x=!1;if(b[v.CHAR_DATA_CHAR_INDEX].length>2)x=!0;else if(b[v.CHAR_DATA_CHAR_INDEX].length===2){const f=b[v.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=f&&f<=56319){const p=b[v.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=p&&p<=57343?this.content=1024*(f-55296)+p-56320+65536|b[v.CHAR_DATA_WIDTH_INDEX]<<22:x=!0}else x=!0}else this.content=b[v.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|b[v.CHAR_DATA_WIDTH_INDEX]<<22;x&&(this.combinedData=b[v.CHAR_DATA_CHAR_INDEX],this.content=2097152|b[v.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}a.CellData=m},643:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WHITESPACE_CELL_CODE=a.WHITESPACE_CELL_WIDTH=a.WHITESPACE_CELL_CHAR=a.NULL_CELL_CODE=a.NULL_CELL_WIDTH=a.NULL_CELL_CHAR=a.CHAR_DATA_CODE_INDEX=a.CHAR_DATA_WIDTH_INDEX=a.CHAR_DATA_CHAR_INDEX=a.CHAR_DATA_ATTR_INDEX=a.DEFAULT_EXT=a.DEFAULT_ATTR=a.DEFAULT_COLOR=void 0,a.DEFAULT_COLOR=0,a.DEFAULT_ATTR=256|a.DEFAULT_COLOR<<9,a.DEFAULT_EXT=0,a.CHAR_DATA_ATTR_INDEX=0,a.CHAR_DATA_CHAR_INDEX=1,a.CHAR_DATA_WIDTH_INDEX=2,a.CHAR_DATA_CODE_INDEX=3,a.NULL_CELL_CHAR="",a.NULL_CELL_WIDTH=1,a.NULL_CELL_CODE=0,a.WHITESPACE_CELL_CHAR=" ",a.WHITESPACE_CELL_WIDTH=1,a.WHITESPACE_CELL_CODE=32},4863:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Marker=void 0;const _=l(8460),v=l(844);class c{get id(){return this._id}constructor(C){this.line=C,this.isDisposed=!1,this._disposables=[],this._id=c._nextId++,this._onDispose=this.register(new _.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,v.disposeArray)(this._disposables),this._disposables.length=0)}register(C){return this._disposables.push(C),C}}a.Marker=c,c._nextId=1},7116:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DEFAULT_CHARSET=a.CHARSETS=void 0,a.CHARSETS={},a.DEFAULT_CHARSET=a.CHARSETS.B,a.CHARSETS[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:"≥","{":"π","|":"≠","}":"£","~":"·"},a.CHARSETS.A={"#":"£"},a.CHARSETS.B=void 0,a.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},a.CHARSETS.C=a.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},a.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},a.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},a.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},a.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},a.CHARSETS.E=a.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},a.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},a.CHARSETS.H=a.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},a.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(y,a)=>{var l,_,v;Object.defineProperty(a,"__esModule",{value:!0}),a.C1_ESCAPED=a.C1=a.C0=void 0,(function(c){c.NUL="\0",c.SOH="",c.STX="",c.ETX="",c.EOT="",c.ENQ="",c.ACK="",c.BEL="\x07",c.BS="\b",c.HT=" ",c.LF=`
68
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(k){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),p.isLinux&&k&&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(k){const M=this._getMouseBufferCoords(k),W=this._model.finalSelectionStart,z=this._model.finalSelectionEnd;return!!(W&&z&&M)&&this._areCoordsInSelection(M,W,z)}isCellInSelection(k,M){const W=this._model.finalSelectionStart,z=this._model.finalSelectionEnd;return!(!W||!z)&&this._areCoordsInSelection([k,M],W,z)}_areCoordsInSelection(k,M,W){return k[1]>M[1]&&k[1]<W[1]||M[1]===W[1]&&k[1]===M[1]&&k[0]>=M[0]&&k[0]<W[0]||M[1]<W[1]&&k[1]===W[1]&&k[0]<W[0]||M[1]<W[1]&&k[1]===M[1]&&k[0]>=M[0]}_selectWordAtCursor(k,M){var j,N;const W=(N=(j=this._linkifier.currentLink)==null?void 0:j.link)==null?void 0:N.range;if(W)return this._model.selectionStart=[W.start.x-1,W.start.y-1],this._model.selectionStartLength=(0,d.getRangeLength)(W,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const z=this._getMouseBufferCoords(k);return!!z&&(this._selectWordAt(z,M),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(k,M){this._model.clearSelection(),k=Math.max(k,0),M=Math.min(M,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,k],this._model.selectionEnd=[this._bufferService.cols,M],this.refresh(),this._onSelectionChange.fire()}_handleTrim(k){this._model.handleTrim(k)&&this.refresh()}_getMouseBufferCoords(k){const M=this._mouseService.getCoords(k,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(M)return M[0]--,M[1]--,M[1]+=this._bufferService.buffer.ydisp,M}_getMouseEventScrollAmount(k){let M=(0,c.getCoordsRelativeToElement)(this._coreBrowserService.window,k,this._screenElement)[1];const W=this._renderService.dimensions.css.canvas.height;return M>=0&&M<=W?0:(M>W&&(M-=W),M=Math.min(Math.max(M,-50),50),M/=50,M/Math.abs(M)+Math.round(14*M))}shouldForceSelection(k){return p.isMac?k.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:k.shiftKey}handleMouseDown(k){if(this._mouseDownTimeStamp=k.timeStamp,(k.button!==2||!this.hasSelection)&&k.button===0){if(!this._enabled){if(!this.shouldForceSelection(k))return;k.stopPropagation()}k.preventDefault(),this._dragScrollAmount=0,this._enabled&&k.shiftKey?this._handleIncrementalClick(k):k.detail===1?this._handleSingleClick(k):k.detail===2?this._handleDoubleClick(k):k.detail===3&&this._handleTripleClick(k),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(k){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(k))}_handleSingleClick(k){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(k)?3:0,this._model.selectionStart=this._getMouseBufferCoords(k),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const M=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);M&&M.length!==this._model.selectionStart[0]&&M.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(k){this._selectWordAtCursor(k,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(k){const M=this._getMouseBufferCoords(k);M&&(this._activeSelectionMode=2,this._selectLineAt(M[1]))}shouldColumnSelect(k){return k.altKey&&!(p.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(k){if(k.stopImmediatePropagation(),!this._model.selectionStart)return;const M=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(k),!this._model.selectionEnd)return void this.refresh(!0);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(k),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const W=this._bufferService.buffer;if(this._model.selectionEnd[1]<W.lines.length){const z=W.lines.get(this._model.selectionEnd[1]);z&&z.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}M&&M[0]===this._model.selectionEnd[0]&&M[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});const k=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(k.ydisp+this._bufferService.rows,k.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=k.ydisp),this.refresh()}}_handleMouseUp(k){const M=k.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&M<500&&k.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const W=this._mouseService.getCoords(k,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(W&&W[0]!==void 0&&W[1]!==void 0){const z=(0,m.moveToCellSequence)(W[0]-1,W[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(z,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const k=this._model.finalSelectionStart,M=this._model.finalSelectionEnd,W=!(!k||!M||k[0]===M[0]&&k[1]===M[1]);W?k&&M&&(this._oldSelectionStart&&this._oldSelectionEnd&&k[0]===this._oldSelectionStart[0]&&k[1]===this._oldSelectionStart[1]&&M[0]===this._oldSelectionEnd[0]&&M[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(k,M,W)):this._oldHasSelection&&this._fireOnSelectionChange(k,M,W)}_fireOnSelectionChange(k,M,W){this._oldSelectionStart=k,this._oldSelectionEnd=M,this._oldHasSelection=W,this._onSelectionChange.fire()}_handleBufferActivate(k){this.clearSelection(),this._trimListener.dispose(),this._trimListener=k.activeBuffer.lines.onTrim((M=>this._handleTrim(M)))}_convertViewportColToCharacterIndex(k,M){let W=M;for(let z=0;M>=z;z++){const j=k.loadCell(z,this._workCell).getChars().length;this._workCell.getWidth()===0?W--:j>1&&M!==z&&(W+=j-1)}return W}setSelection(k,M,W){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[k,M],this._model.selectionStartLength=W,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(k){this._isClickInSelection(k)||(this._selectWordAtCursor(k,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(k,M,W=!0,z=!0){if(k[0]>=this._bufferService.cols)return;const j=this._bufferService.buffer,N=j.lines.get(k[1]);if(!N)return;const I=j.translateBufferLineToString(k[1],!1);let q=this._convertViewportColToCharacterIndex(N,k[0]),U=q;const K=k[0]-q;let V=0,T=0,B=0,P=0;if(I.charAt(q)===" "){for(;q>0&&I.charAt(q-1)===" ";)q--;for(;U<I.length&&I.charAt(U+1)===" ";)U++}else{let Z=k[0],ie=k[0];N.getWidth(Z)===0&&(V++,Z--),N.getWidth(ie)===2&&(T++,ie++);const ae=N.getString(ie).length;for(ae>1&&(P+=ae-1,U+=ae-1);Z>0&&q>0&&!this._isCharWordSeparator(N.loadCell(Z-1,this._workCell));){N.loadCell(Z-1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===0?(V++,Z--):X>1&&(B+=X-1,q-=X-1),q--,Z--}for(;ie<N.length&&U+1<I.length&&!this._isCharWordSeparator(N.loadCell(ie+1,this._workCell));){N.loadCell(ie+1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===2?(T++,ie++):X>1&&(P+=X-1,U+=X-1),U++,ie++}}U++;let F=q+K-V+B,Y=Math.min(this._bufferService.cols,U-q+V+T-B-P);if(M||I.slice(q,U).trim()!==""){if(W&&F===0&&N.getCodePoint(0)!==32){const Z=j.lines.get(k[1]-1);if(Z&&N.isWrapped&&Z.getCodePoint(this._bufferService.cols-1)!==32){const ie=this._getWordAt([this._bufferService.cols-1,k[1]-1],!1,!0,!1);if(ie){const ae=this._bufferService.cols-ie.start;F-=ae,Y+=ae}}}if(z&&F+Y===this._bufferService.cols&&N.getCodePoint(this._bufferService.cols-1)!==32){const Z=j.lines.get(k[1]+1);if(Z!=null&&Z.isWrapped&&Z.getCodePoint(0)!==32){const ie=this._getWordAt([0,k[1]+1],!1,!1,!0);ie&&(Y+=ie.length)}}return{start:F,length:Y}}}_selectWordAt(k,M){const W=this._getWordAt(k,M);if(W){for(;W.start<0;)W.start+=this._bufferService.cols,k[1]--;this._model.selectionStart=[W.start,k[1]],this._model.selectionStartLength=W.length}}_selectToWordAt(k){const M=this._getWordAt(k,!0);if(M){let W=k[1];for(;M.start<0;)M.start+=this._bufferService.cols,W--;if(!this._model.areSelectionValuesReversed())for(;M.start+M.length>this._bufferService.cols;)M.length-=this._bufferService.cols,W++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?M.start:M.start+M.length,W]}}_isCharWordSeparator(k){return k.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(k.getChars())>=0}_selectLineAt(k){const M=this._bufferService.buffer.getWrappedRangeForLine(k),W={start:{x:0,y:M.first},end:{x:this._bufferService.cols-1,y:M.last}};this._model.selectionStart=[0,M.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,d.getRangeLength)(W,this._bufferService.cols)}};a.SelectionService=D=_([v(3,w.IBufferService),v(4,w.ICoreService),v(5,b.IMouseService),v(6,w.IOptionsService),v(7,b.IRenderService),v(8,b.ICoreBrowserService)],D)},4725:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ILinkProviderService=a.IThemeService=a.ICharacterJoinerService=a.ISelectionService=a.IRenderService=a.IMouseService=a.ICoreBrowserService=a.ICharSizeService=void 0;const _=l(8343);a.ICharSizeService=(0,_.createDecorator)("CharSizeService"),a.ICoreBrowserService=(0,_.createDecorator)("CoreBrowserService"),a.IMouseService=(0,_.createDecorator)("MouseService"),a.IRenderService=(0,_.createDecorator)("RenderService"),a.ISelectionService=(0,_.createDecorator)("SelectionService"),a.ICharacterJoinerService=(0,_.createDecorator)("CharacterJoinerService"),a.IThemeService=(0,_.createDecorator)("ThemeService"),a.ILinkProviderService=(0,_.createDecorator)("LinkProviderService")},6731:function(y,a,l){var _=this&&this.__decorate||function(D,k,M,W){var z,j=arguments.length,N=j<3?k:W===null?W=Object.getOwnPropertyDescriptor(k,M):W;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(D,k,M,W);else for(var I=D.length-1;I>=0;I--)(z=D[I])&&(N=(j<3?z(N):j>3?z(k,M,N):z(k,M))||N);return j>3&&N&&Object.defineProperty(k,M,N),N},v=this&&this.__param||function(D,k){return function(M,W){k(M,W,D)}};Object.defineProperty(a,"__esModule",{value:!0}),a.ThemeService=a.DEFAULT_ANSI_COLORS=void 0;const c=l(7239),m=l(8055),C=l(8460),b=l(844),x=l(2585),f=m.css.toColor("#ffffff"),p=m.css.toColor("#000000"),d=m.css.toColor("#ffffff"),u=m.css.toColor("#000000"),w={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};a.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const D=[m.css.toColor("#2e3436"),m.css.toColor("#cc0000"),m.css.toColor("#4e9a06"),m.css.toColor("#c4a000"),m.css.toColor("#3465a4"),m.css.toColor("#75507b"),m.css.toColor("#06989a"),m.css.toColor("#d3d7cf"),m.css.toColor("#555753"),m.css.toColor("#ef2929"),m.css.toColor("#8ae234"),m.css.toColor("#fce94f"),m.css.toColor("#729fcf"),m.css.toColor("#ad7fa8"),m.css.toColor("#34e2e2"),m.css.toColor("#eeeeec")],k=[0,95,135,175,215,255];for(let M=0;M<216;M++){const W=k[M/36%6|0],z=k[M/6%6|0],j=k[M%6];D.push({css:m.channels.toCss(W,z,j),rgba:m.channels.toRgba(W,z,j)})}for(let M=0;M<24;M++){const W=8+10*M;D.push({css:m.channels.toCss(W,W,W),rgba:m.channels.toRgba(W,W,W)})}return D})());let L=a.ThemeService=class extends b.Disposable{get colors(){return this._colors}constructor(D){super(),this._optionsService=D,this._contrastCache=new c.ColorContrastCache,this._halfContrastCache=new c.ColorContrastCache,this._onChangeColors=this.register(new C.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:f,background:p,cursor:d,cursorAccent:u,selectionForeground:void 0,selectionBackgroundTransparent:w,selectionBackgroundOpaque:m.color.blend(p,w),selectionInactiveBackgroundTransparent:w,selectionInactiveBackgroundOpaque:m.color.blend(p,w),ansi:a.DEFAULT_ANSI_COLORS.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))))}_setTheme(D={}){const k=this._colors;if(k.foreground=R(D.foreground,f),k.background=R(D.background,p),k.cursor=R(D.cursor,d),k.cursorAccent=R(D.cursorAccent,u),k.selectionBackgroundTransparent=R(D.selectionBackground,w),k.selectionBackgroundOpaque=m.color.blend(k.background,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundTransparent=R(D.selectionInactiveBackground,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundOpaque=m.color.blend(k.background,k.selectionInactiveBackgroundTransparent),k.selectionForeground=D.selectionForeground?R(D.selectionForeground,m.NULL_COLOR):void 0,k.selectionForeground===m.NULL_COLOR&&(k.selectionForeground=void 0),m.color.isOpaque(k.selectionBackgroundTransparent)&&(k.selectionBackgroundTransparent=m.color.opacity(k.selectionBackgroundTransparent,.3)),m.color.isOpaque(k.selectionInactiveBackgroundTransparent)&&(k.selectionInactiveBackgroundTransparent=m.color.opacity(k.selectionInactiveBackgroundTransparent,.3)),k.ansi=a.DEFAULT_ANSI_COLORS.slice(),k.ansi[0]=R(D.black,a.DEFAULT_ANSI_COLORS[0]),k.ansi[1]=R(D.red,a.DEFAULT_ANSI_COLORS[1]),k.ansi[2]=R(D.green,a.DEFAULT_ANSI_COLORS[2]),k.ansi[3]=R(D.yellow,a.DEFAULT_ANSI_COLORS[3]),k.ansi[4]=R(D.blue,a.DEFAULT_ANSI_COLORS[4]),k.ansi[5]=R(D.magenta,a.DEFAULT_ANSI_COLORS[5]),k.ansi[6]=R(D.cyan,a.DEFAULT_ANSI_COLORS[6]),k.ansi[7]=R(D.white,a.DEFAULT_ANSI_COLORS[7]),k.ansi[8]=R(D.brightBlack,a.DEFAULT_ANSI_COLORS[8]),k.ansi[9]=R(D.brightRed,a.DEFAULT_ANSI_COLORS[9]),k.ansi[10]=R(D.brightGreen,a.DEFAULT_ANSI_COLORS[10]),k.ansi[11]=R(D.brightYellow,a.DEFAULT_ANSI_COLORS[11]),k.ansi[12]=R(D.brightBlue,a.DEFAULT_ANSI_COLORS[12]),k.ansi[13]=R(D.brightMagenta,a.DEFAULT_ANSI_COLORS[13]),k.ansi[14]=R(D.brightCyan,a.DEFAULT_ANSI_COLORS[14]),k.ansi[15]=R(D.brightWhite,a.DEFAULT_ANSI_COLORS[15]),D.extendedAnsi){const M=Math.min(k.ansi.length-16,D.extendedAnsi.length);for(let W=0;W<M;W++)k.ansi[W+16]=R(D.extendedAnsi[W],a.DEFAULT_ANSI_COLORS[W+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(D){this._restoreColor(D),this._onChangeColors.fire(this.colors)}_restoreColor(D){if(D!==void 0)switch(D){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[D]=this._restoreColors.ansi[D]}else for(let k=0;k<this._restoreColors.ansi.length;++k)this._colors.ansi[k]=this._restoreColors.ansi[k]}modifyColors(D){D(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function R(D,k){if(D!==void 0)try{return m.css.toColor(D)}catch{}return k}a.ThemeService=L=_([v(0,x.IOptionsService)],L)},6349:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CircularList=void 0;const _=l(8460),v=l(844);class c extends v.Disposable{constructor(C){super(),this._maxLength=C,this.onDeleteEmitter=this.register(new _.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new _.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new _.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(C){if(this._maxLength===C)return;const b=new Array(C);for(let x=0;x<Math.min(C,this.length);x++)b[x]=this._array[this._getCyclicIndex(x)];this._array=b,this._maxLength=C,this._startIndex=0}get length(){return this._length}set length(C){if(C>this._length)for(let b=this._length;b<C;b++)this._array[b]=void 0;this._length=C}get(C){return this._array[this._getCyclicIndex(C)]}set(C,b){this._array[this._getCyclicIndex(C)]=b}push(C){this._array[this._getCyclicIndex(this._length)]=C,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(C,b,...x){if(b){for(let f=C;f<this._length-b;f++)this._array[this._getCyclicIndex(f)]=this._array[this._getCyclicIndex(f+b)];this._length-=b,this.onDeleteEmitter.fire({index:C,amount:b})}for(let f=this._length-1;f>=C;f--)this._array[this._getCyclicIndex(f+x.length)]=this._array[this._getCyclicIndex(f)];for(let f=0;f<x.length;f++)this._array[this._getCyclicIndex(C+f)]=x[f];if(x.length&&this.onInsertEmitter.fire({index:C,amount:x.length}),this._length+x.length>this._maxLength){const f=this._length+x.length-this._maxLength;this._startIndex+=f,this._length=this._maxLength,this.onTrimEmitter.fire(f)}else this._length+=x.length}trimStart(C){C>this._length&&(C=this._length),this._startIndex+=C,this._length-=C,this.onTrimEmitter.fire(C)}shiftElements(C,b,x){if(!(b<=0)){if(C<0||C>=this._length)throw new Error("start argument out of range");if(C+x<0)throw new Error("Cannot shift elements in list beyond index 0");if(x>0){for(let p=b-1;p>=0;p--)this.set(C+p+x,this.get(C+p));const f=C+b+x-this._length;if(f>0)for(this._length+=f;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let f=0;f<b;f++)this.set(C+f+x,this.get(C+f))}}_getCyclicIndex(C){return(this._startIndex+C)%this._maxLength}}a.CircularList=c},1439:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.clone=void 0,a.clone=function l(_,v=5){if(typeof _!="object")return _;const c=Array.isArray(_)?[]:{};for(const m in _)c[m]=v<=1?_[m]:_[m]&&l(_[m],v-1);return c}},8055:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.contrastRatio=a.toPaddedHex=a.rgba=a.rgb=a.css=a.color=a.channels=a.NULL_COLOR=void 0;let l=0,_=0,v=0,c=0;var m,C,b,x,f;function p(u){const w=u.toString(16);return w.length<2?"0"+w:w}function d(u,w){return u<w?(w+.05)/(u+.05):(u+.05)/(w+.05)}a.NULL_COLOR={css:"#00000000",rgba:0},(function(u){u.toCss=function(w,L,R,D){return D!==void 0?`#${p(w)}${p(L)}${p(R)}${p(D)}`:`#${p(w)}${p(L)}${p(R)}`},u.toRgba=function(w,L,R,D=255){return(w<<24|L<<16|R<<8|D)>>>0},u.toColor=function(w,L,R,D){return{css:u.toCss(w,L,R,D),rgba:u.toRgba(w,L,R,D)}}})(m||(a.channels=m={})),(function(u){function w(L,R){return c=Math.round(255*R),[l,_,v]=f.toChannels(L.rgba),{css:m.toCss(l,_,v,c),rgba:m.toRgba(l,_,v,c)}}u.blend=function(L,R){if(c=(255&R.rgba)/255,c===1)return{css:R.css,rgba:R.rgba};const D=R.rgba>>24&255,k=R.rgba>>16&255,M=R.rgba>>8&255,W=L.rgba>>24&255,z=L.rgba>>16&255,j=L.rgba>>8&255;return l=W+Math.round((D-W)*c),_=z+Math.round((k-z)*c),v=j+Math.round((M-j)*c),{css:m.toCss(l,_,v),rgba:m.toRgba(l,_,v)}},u.isOpaque=function(L){return(255&L.rgba)==255},u.ensureContrastRatio=function(L,R,D){const k=f.ensureContrastRatio(L.rgba,R.rgba,D);if(k)return m.toColor(k>>24&255,k>>16&255,k>>8&255)},u.opaque=function(L){const R=(255|L.rgba)>>>0;return[l,_,v]=f.toChannels(R),{css:m.toCss(l,_,v),rgba:R}},u.opacity=w,u.multiplyOpacity=function(L,R){return c=255&L.rgba,w(L,c*R/255)},u.toColorRGB=function(L){return[L.rgba>>24&255,L.rgba>>16&255,L.rgba>>8&255]}})(C||(a.color=C={})),(function(u){let w,L;try{const R=document.createElement("canvas");R.width=1,R.height=1;const D=R.getContext("2d",{willReadFrequently:!0});D&&(w=D,w.globalCompositeOperation="copy",L=w.createLinearGradient(0,0,1,1))}catch{}u.toColor=function(R){if(R.match(/#[\da-f]{3,8}/i))switch(R.length){case 4:return l=parseInt(R.slice(1,2).repeat(2),16),_=parseInt(R.slice(2,3).repeat(2),16),v=parseInt(R.slice(3,4).repeat(2),16),m.toColor(l,_,v);case 5:return l=parseInt(R.slice(1,2).repeat(2),16),_=parseInt(R.slice(2,3).repeat(2),16),v=parseInt(R.slice(3,4).repeat(2),16),c=parseInt(R.slice(4,5).repeat(2),16),m.toColor(l,_,v,c);case 7:return{css:R,rgba:(parseInt(R.slice(1),16)<<8|255)>>>0};case 9:return{css:R,rgba:parseInt(R.slice(1),16)>>>0}}const D=R.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(D)return l=parseInt(D[1]),_=parseInt(D[2]),v=parseInt(D[3]),c=Math.round(255*(D[5]===void 0?1:parseFloat(D[5]))),m.toColor(l,_,v,c);if(!w||!L)throw new Error("css.toColor: Unsupported css format");if(w.fillStyle=L,w.fillStyle=R,typeof w.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(w.fillRect(0,0,1,1),[l,_,v,c]=w.getImageData(0,0,1,1).data,c!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:m.toRgba(l,_,v,c),css:R}}})(b||(a.css=b={})),(function(u){function w(L,R,D){const k=L/255,M=R/255,W=D/255;return .2126*(k<=.03928?k/12.92:Math.pow((k+.055)/1.055,2.4))+.7152*(M<=.03928?M/12.92:Math.pow((M+.055)/1.055,2.4))+.0722*(W<=.03928?W/12.92:Math.pow((W+.055)/1.055,2.4))}u.relativeLuminance=function(L){return w(L>>16&255,L>>8&255,255&L)},u.relativeLuminance2=w})(x||(a.rgb=x={})),(function(u){function w(R,D,k){const M=R>>24&255,W=R>>16&255,z=R>>8&255;let j=D>>24&255,N=D>>16&255,I=D>>8&255,q=d(x.relativeLuminance2(j,N,I),x.relativeLuminance2(M,W,z));for(;q<k&&(j>0||N>0||I>0);)j-=Math.max(0,Math.ceil(.1*j)),N-=Math.max(0,Math.ceil(.1*N)),I-=Math.max(0,Math.ceil(.1*I)),q=d(x.relativeLuminance2(j,N,I),x.relativeLuminance2(M,W,z));return(j<<24|N<<16|I<<8|255)>>>0}function L(R,D,k){const M=R>>24&255,W=R>>16&255,z=R>>8&255;let j=D>>24&255,N=D>>16&255,I=D>>8&255,q=d(x.relativeLuminance2(j,N,I),x.relativeLuminance2(M,W,z));for(;q<k&&(j<255||N<255||I<255);)j=Math.min(255,j+Math.ceil(.1*(255-j))),N=Math.min(255,N+Math.ceil(.1*(255-N))),I=Math.min(255,I+Math.ceil(.1*(255-I))),q=d(x.relativeLuminance2(j,N,I),x.relativeLuminance2(M,W,z));return(j<<24|N<<16|I<<8|255)>>>0}u.blend=function(R,D){if(c=(255&D)/255,c===1)return D;const k=D>>24&255,M=D>>16&255,W=D>>8&255,z=R>>24&255,j=R>>16&255,N=R>>8&255;return l=z+Math.round((k-z)*c),_=j+Math.round((M-j)*c),v=N+Math.round((W-N)*c),m.toRgba(l,_,v)},u.ensureContrastRatio=function(R,D,k){const M=x.relativeLuminance(R>>8),W=x.relativeLuminance(D>>8);if(d(M,W)<k){if(W<M){const N=w(R,D,k),I=d(M,x.relativeLuminance(N>>8));if(I<k){const q=L(R,D,k);return I>d(M,x.relativeLuminance(q>>8))?N:q}return N}const z=L(R,D,k),j=d(M,x.relativeLuminance(z>>8));if(j<k){const N=w(R,D,k);return j>d(M,x.relativeLuminance(N>>8))?z:N}return z}},u.reduceLuminance=w,u.increaseLuminance=L,u.toChannels=function(R){return[R>>24&255,R>>16&255,R>>8&255,255&R]}})(f||(a.rgba=f={})),a.toPaddedHex=p,a.contrastRatio=d},8969:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CoreTerminal=void 0;const _=l(844),v=l(2585),c=l(4348),m=l(7866),C=l(744),b=l(7302),x=l(6975),f=l(8460),p=l(1753),d=l(1480),u=l(7994),w=l(9282),L=l(5435),R=l(5981),D=l(2660);let k=!1;class M extends _.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new f.EventEmitter),this._onScroll.event((z=>{var j;(j=this._onScrollApi)==null||j.fire(z.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(z){for(const j in z)this.optionsService.options[j]=z[j]}constructor(z){super(),this._windowsWrappingHeuristics=this.register(new _.MutableDisposable),this._onBinary=this.register(new f.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new f.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new f.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new f.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new f.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new f.EventEmitter),this._instantiationService=new c.InstantiationService,this.optionsService=this.register(new b.OptionsService(z)),this._instantiationService.setService(v.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(C.BufferService)),this._instantiationService.setService(v.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(m.LogService)),this._instantiationService.setService(v.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(x.CoreService)),this._instantiationService.setService(v.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(p.CoreMouseService)),this._instantiationService.setService(v.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(d.UnicodeService)),this._instantiationService.setService(v.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(u.CharsetService),this._instantiationService.setService(v.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(D.OscLinkService),this._instantiationService.setService(v.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new L.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,f.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,f.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,f.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,f.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((j=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((j=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new R.WriteBuffer(((j,N)=>this._inputHandler.parse(j,N)))),this.register((0,f.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(z,j){this._writeBuffer.write(z,j)}writeSync(z,j){this._logService.logLevel<=v.LogLevelEnum.WARN&&!k&&(this._logService.warn("writeSync is unreliable and will be removed soon."),k=!0),this._writeBuffer.writeSync(z,j)}input(z,j=!0){this.coreService.triggerDataEvent(z,j)}resize(z,j){isNaN(z)||isNaN(j)||(z=Math.max(z,C.MINIMUM_COLS),j=Math.max(j,C.MINIMUM_ROWS),this._bufferService.resize(z,j))}scroll(z,j=!1){this._bufferService.scroll(z,j)}scrollLines(z,j,N){this._bufferService.scrollLines(z,j,N)}scrollPages(z){this.scrollLines(z*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(z){const j=z-this._bufferService.buffer.ydisp;j!==0&&this.scrollLines(j)}registerEscHandler(z,j){return this._inputHandler.registerEscHandler(z,j)}registerDcsHandler(z,j){return this._inputHandler.registerDcsHandler(z,j)}registerCsiHandler(z,j){return this._inputHandler.registerCsiHandler(z,j)}registerOscHandler(z,j){return this._inputHandler.registerOscHandler(z,j)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let z=!1;const j=this.optionsService.rawOptions.windowsPty;j&&j.buildNumber!==void 0&&j.buildNumber!==void 0?z=j.backend==="conpty"&&j.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(z=!0),z?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const z=[];z.push(this.onLineFeed(w.updateWindowsModeWrappedState.bind(null,this._bufferService))),z.push(this.registerCsiHandler({final:"H"},(()=>((0,w.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,_.toDisposable)((()=>{for(const j of z)j.dispose()}))}}}a.CoreTerminal=M},8460:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.runAndSubscribe=a.forwardEvent=a.EventEmitter=void 0,a.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=l=>(this._listeners.push(l),{dispose:()=>{if(!this._disposed){for(let _=0;_<this._listeners.length;_++)if(this._listeners[_]===l)return void this._listeners.splice(_,1)}}})),this._event}fire(l,_){const v=[];for(let c=0;c<this._listeners.length;c++)v.push(this._listeners[c]);for(let c=0;c<v.length;c++)v[c].call(void 0,l,_)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},a.forwardEvent=function(l,_){return l((v=>_.fire(v)))},a.runAndSubscribe=function(l,_){return _(void 0),l((v=>_(v)))}},5435:function(y,a,l){var _=this&&this.__decorate||function(V,T,B,P){var F,Y=arguments.length,Z=Y<3?T:P===null?P=Object.getOwnPropertyDescriptor(T,B):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Z=Reflect.decorate(V,T,B,P);else for(var ie=V.length-1;ie>=0;ie--)(F=V[ie])&&(Z=(Y<3?F(Z):Y>3?F(T,B,Z):F(T,B))||Z);return Y>3&&Z&&Object.defineProperty(T,B,Z),Z},v=this&&this.__param||function(V,T){return function(B,P){T(B,P,V)}};Object.defineProperty(a,"__esModule",{value:!0}),a.InputHandler=a.WindowsOptionsReportType=void 0;const c=l(2584),m=l(7116),C=l(2015),b=l(844),x=l(482),f=l(8437),p=l(8460),d=l(643),u=l(511),w=l(3734),L=l(2585),R=l(1480),D=l(6242),k=l(6351),M=l(5941),W={"(":0,")":1,"*":2,"+":3,"-":1,".":2},z=131072;function j(V,T){if(V>24)return T.setWinLines||!1;switch(V){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 N;(function(V){V[V.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",V[V.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(N||(a.WindowsOptionsReportType=N={}));let I=0;class q extends b.Disposable{getAttrData(){return this._curAttrData}constructor(T,B,P,F,Y,Z,ie,ae,X=new C.EscapeSequenceParser){super(),this._bufferService=T,this._charsetService=B,this._coreService=P,this._logService=F,this._optionsService=Y,this._oscLinkService=Z,this._coreMouseService=ie,this._unicodeService=ae,this._parser=X,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new x.StringToUtf32,this._utf8Decoder=new x.Utf8ToUtf32,this._workCell=new u.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=f.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=f.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new p.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new p.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new p.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new p.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new p.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new p.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new p.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new p.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new p.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new p.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new p.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new p.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new p.EventEmitter),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 U(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((H=>this._activeBuffer=H.activeBuffer))),this._parser.setCsiHandlerFallback(((H,re)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(H),params:re.toArray()})})),this._parser.setEscHandlerFallback((H=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(H)})})),this._parser.setExecuteHandlerFallback((H=>{this._logService.debug("Unknown EXECUTE code: ",{code:H})})),this._parser.setOscHandlerFallback(((H,re,te)=>{this._logService.debug("Unknown OSC code: ",{identifier:H,action:re,data:te})})),this._parser.setDcsHandlerFallback(((H,re,te)=>{re==="HOOK"&&(te=te.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(H),action:re,payload:te})})),this._parser.setPrintHandler(((H,re,te)=>this.print(H,re,te))),this._parser.registerCsiHandler({final:"@"},(H=>this.insertChars(H))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(H=>this.scrollLeft(H))),this._parser.registerCsiHandler({final:"A"},(H=>this.cursorUp(H))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(H=>this.scrollRight(H))),this._parser.registerCsiHandler({final:"B"},(H=>this.cursorDown(H))),this._parser.registerCsiHandler({final:"C"},(H=>this.cursorForward(H))),this._parser.registerCsiHandler({final:"D"},(H=>this.cursorBackward(H))),this._parser.registerCsiHandler({final:"E"},(H=>this.cursorNextLine(H))),this._parser.registerCsiHandler({final:"F"},(H=>this.cursorPrecedingLine(H))),this._parser.registerCsiHandler({final:"G"},(H=>this.cursorCharAbsolute(H))),this._parser.registerCsiHandler({final:"H"},(H=>this.cursorPosition(H))),this._parser.registerCsiHandler({final:"I"},(H=>this.cursorForwardTab(H))),this._parser.registerCsiHandler({final:"J"},(H=>this.eraseInDisplay(H,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(H=>this.eraseInDisplay(H,!0))),this._parser.registerCsiHandler({final:"K"},(H=>this.eraseInLine(H,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(H=>this.eraseInLine(H,!0))),this._parser.registerCsiHandler({final:"L"},(H=>this.insertLines(H))),this._parser.registerCsiHandler({final:"M"},(H=>this.deleteLines(H))),this._parser.registerCsiHandler({final:"P"},(H=>this.deleteChars(H))),this._parser.registerCsiHandler({final:"S"},(H=>this.scrollUp(H))),this._parser.registerCsiHandler({final:"T"},(H=>this.scrollDown(H))),this._parser.registerCsiHandler({final:"X"},(H=>this.eraseChars(H))),this._parser.registerCsiHandler({final:"Z"},(H=>this.cursorBackwardTab(H))),this._parser.registerCsiHandler({final:"`"},(H=>this.charPosAbsolute(H))),this._parser.registerCsiHandler({final:"a"},(H=>this.hPositionRelative(H))),this._parser.registerCsiHandler({final:"b"},(H=>this.repeatPrecedingCharacter(H))),this._parser.registerCsiHandler({final:"c"},(H=>this.sendDeviceAttributesPrimary(H))),this._parser.registerCsiHandler({prefix:">",final:"c"},(H=>this.sendDeviceAttributesSecondary(H))),this._parser.registerCsiHandler({final:"d"},(H=>this.linePosAbsolute(H))),this._parser.registerCsiHandler({final:"e"},(H=>this.vPositionRelative(H))),this._parser.registerCsiHandler({final:"f"},(H=>this.hVPosition(H))),this._parser.registerCsiHandler({final:"g"},(H=>this.tabClear(H))),this._parser.registerCsiHandler({final:"h"},(H=>this.setMode(H))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(H=>this.setModePrivate(H))),this._parser.registerCsiHandler({final:"l"},(H=>this.resetMode(H))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(H=>this.resetModePrivate(H))),this._parser.registerCsiHandler({final:"m"},(H=>this.charAttributes(H))),this._parser.registerCsiHandler({final:"n"},(H=>this.deviceStatus(H))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(H=>this.deviceStatusPrivate(H))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(H=>this.softReset(H))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(H=>this.setCursorStyle(H))),this._parser.registerCsiHandler({final:"r"},(H=>this.setScrollRegion(H))),this._parser.registerCsiHandler({final:"s"},(H=>this.saveCursor(H))),this._parser.registerCsiHandler({final:"t"},(H=>this.windowOptions(H))),this._parser.registerCsiHandler({final:"u"},(H=>this.restoreCursor(H))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(H=>this.insertColumns(H))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(H=>this.deleteColumns(H))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(H=>this.selectProtected(H))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(H=>this.requestMode(H,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(H=>this.requestMode(H,!1))),this._parser.setExecuteHandler(c.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(c.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(c.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(c.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(c.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(c.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(c.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(c.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(c.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(c.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(c.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(c.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new D.OscHandler((H=>(this.setTitle(H),this.setIconName(H),!0)))),this._parser.registerOscHandler(1,new D.OscHandler((H=>this.setIconName(H)))),this._parser.registerOscHandler(2,new D.OscHandler((H=>this.setTitle(H)))),this._parser.registerOscHandler(4,new D.OscHandler((H=>this.setOrReportIndexedColor(H)))),this._parser.registerOscHandler(8,new D.OscHandler((H=>this.setHyperlink(H)))),this._parser.registerOscHandler(10,new D.OscHandler((H=>this.setOrReportFgColor(H)))),this._parser.registerOscHandler(11,new D.OscHandler((H=>this.setOrReportBgColor(H)))),this._parser.registerOscHandler(12,new D.OscHandler((H=>this.setOrReportCursorColor(H)))),this._parser.registerOscHandler(104,new D.OscHandler((H=>this.restoreIndexedColor(H)))),this._parser.registerOscHandler(110,new D.OscHandler((H=>this.restoreFgColor(H)))),this._parser.registerOscHandler(111,new D.OscHandler((H=>this.restoreBgColor(H)))),this._parser.registerOscHandler(112,new D.OscHandler((H=>this.restoreCursorColor(H)))),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(const H in m.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:H},(()=>this.selectCharset("("+H))),this._parser.registerEscHandler({intermediates:")",final:H},(()=>this.selectCharset(")"+H))),this._parser.registerEscHandler({intermediates:"*",final:H},(()=>this.selectCharset("*"+H))),this._parser.registerEscHandler({intermediates:"+",final:H},(()=>this.selectCharset("+"+H))),this._parser.registerEscHandler({intermediates:"-",final:H},(()=>this.selectCharset("-"+H))),this._parser.registerEscHandler({intermediates:".",final:H},(()=>this.selectCharset("."+H))),this._parser.registerEscHandler({intermediates:"/",final:H},(()=>this.selectCharset("/"+H)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((H=>(this._logService.error("Parsing error: ",H),H))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new k.DcsHandler(((H,re)=>this.requestStatusString(H,re))))}_preserveStack(T,B,P,F){this._parseStack.paused=!0,this._parseStack.cursorStartX=T,this._parseStack.cursorStartY=B,this._parseStack.decodedLength=P,this._parseStack.position=F}_logSlowResolvingAsync(T){this._logService.logLevel<=L.LogLevelEnum.WARN&&Promise.race([T,new Promise(((B,P)=>setTimeout((()=>P("#SLOW_TIMEOUT")),5e3)))]).catch((B=>{if(B!=="#SLOW_TIMEOUT")throw B;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(T,B){let P,F=this._activeBuffer.x,Y=this._activeBuffer.y,Z=0;const ie=this._parseStack.paused;if(ie){if(P=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,B))return this._logSlowResolvingAsync(P),P;F=this._parseStack.cursorStartX,Y=this._parseStack.cursorStartY,this._parseStack.paused=!1,T.length>z&&(Z=this._parseStack.position+z)}if(this._logService.logLevel<=L.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof T=="string"?` "${T}"`:` "${Array.prototype.map.call(T,(H=>String.fromCharCode(H))).join("")}"`),typeof T=="string"?T.split("").map((H=>H.charCodeAt(0))):T),this._parseBuffer.length<T.length&&this._parseBuffer.length<z&&(this._parseBuffer=new Uint32Array(Math.min(T.length,z))),ie||this._dirtyRowTracker.clearRange(),T.length>z)for(let H=Z;H<T.length;H+=z){const re=H+z<T.length?H+z:T.length,te=typeof T=="string"?this._stringDecoder.decode(T.substring(H,re),this._parseBuffer):this._utf8Decoder.decode(T.subarray(H,re),this._parseBuffer);if(P=this._parser.parse(this._parseBuffer,te))return this._preserveStack(F,Y,te,H),this._logSlowResolvingAsync(P),P}else if(!ie){const H=typeof T=="string"?this._stringDecoder.decode(T,this._parseBuffer):this._utf8Decoder.decode(T,this._parseBuffer);if(P=this._parser.parse(this._parseBuffer,H))return this._preserveStack(F,Y,H,0),this._logSlowResolvingAsync(P),P}this._activeBuffer.x===F&&this._activeBuffer.y===Y||this._onCursorMove.fire();const ae=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),X=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);X<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(X,this._bufferService.rows-1),Math.min(ae,this._bufferService.rows-1))}print(T,B,P){let F,Y;const Z=this._charsetService.charset,ie=this._optionsService.rawOptions.screenReaderMode,ae=this._bufferService.cols,X=this._coreService.decPrivateModes.wraparound,H=this._coreService.modes.insertMode,re=this._curAttrData;let te=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&P-B>0&&te.getWidth(this._activeBuffer.x-1)===2&&te.setCellFromCodepoint(this._activeBuffer.x-1,0,1,re);let ce=this._parser.precedingJoinState;for(let le=B;le<P;++le){if(F=T[le],F<127&&Z){const ue=Z[String.fromCharCode(F)];ue&&(F=ue.charCodeAt(0))}const pe=this._unicodeService.charProperties(F,ce);Y=R.UnicodeService.extractWidth(pe);const Se=R.UnicodeService.extractShouldJoin(pe),be=Se?R.UnicodeService.extractWidth(ce):0;if(ce=pe,ie&&this._onA11yChar.fire((0,x.stringFromCodePoint)(F)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+Y-be>ae){if(X){const ue=te;let ge=this._activeBuffer.x-be;for(this._activeBuffer.x=be,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),te=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),be>0&&te instanceof f.BufferLine&&te.copyCellsFrom(ue,ge,0,be,!1);ge<ae;)ue.setCellFromCodepoint(ge++,0,1,re)}else if(this._activeBuffer.x=ae-1,Y===2)continue}if(Se&&this._activeBuffer.x){const ue=te.getWidth(this._activeBuffer.x-1)?1:2;te.addCodepointToCell(this._activeBuffer.x-ue,F,Y);for(let ge=Y-be;--ge>=0;)te.setCellFromCodepoint(this._activeBuffer.x++,0,0,re)}else if(H&&(te.insertCells(this._activeBuffer.x,Y-be,this._activeBuffer.getNullCell(re)),te.getWidth(ae-1)===2&&te.setCellFromCodepoint(ae-1,d.NULL_CELL_CODE,d.NULL_CELL_WIDTH,re)),te.setCellFromCodepoint(this._activeBuffer.x++,F,Y,re),Y>0)for(;--Y;)te.setCellFromCodepoint(this._activeBuffer.x++,0,0,re)}this._parser.precedingJoinState=ce,this._activeBuffer.x<ae&&P-B>0&&te.getWidth(this._activeBuffer.x)===0&&!te.hasContent(this._activeBuffer.x)&&te.setCellFromCodepoint(this._activeBuffer.x,0,1,re),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(T,B){return T.final!=="t"||T.prefix||T.intermediates?this._parser.registerCsiHandler(T,B):this._parser.registerCsiHandler(T,(P=>!j(P.params[0],this._optionsService.rawOptions.windowOptions)||B(P)))}registerDcsHandler(T,B){return this._parser.registerDcsHandler(T,new k.DcsHandler(B))}registerEscHandler(T,B){return this._parser.registerEscHandler(T,B)}registerOscHandler(T,B){return this._parser.registerOscHandler(T,new D.OscHandler(B))}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 T;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&&((T=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&T.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);B.hasWidth(this._activeBuffer.x)&&!B.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const T=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-T),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(T=this._bufferService.cols-1){this._activeBuffer.x=Math.min(T,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(T,B){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=T,this._activeBuffer.y=this._activeBuffer.scrollTop+B):(this._activeBuffer.x=T,this._activeBuffer.y=B),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(T,B){this._restrictCursor(),this._setCursor(this._activeBuffer.x+T,this._activeBuffer.y+B)}cursorUp(T){const B=this._activeBuffer.y-this._activeBuffer.scrollTop;return B>=0?this._moveCursor(0,-Math.min(B,T.params[0]||1)):this._moveCursor(0,-(T.params[0]||1)),!0}cursorDown(T){const B=this._activeBuffer.scrollBottom-this._activeBuffer.y;return B>=0?this._moveCursor(0,Math.min(B,T.params[0]||1)):this._moveCursor(0,T.params[0]||1),!0}cursorForward(T){return this._moveCursor(T.params[0]||1,0),!0}cursorBackward(T){return this._moveCursor(-(T.params[0]||1),0),!0}cursorNextLine(T){return this.cursorDown(T),this._activeBuffer.x=0,!0}cursorPrecedingLine(T){return this.cursorUp(T),this._activeBuffer.x=0,!0}cursorCharAbsolute(T){return this._setCursor((T.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(T){return this._setCursor(T.length>=2?(T.params[1]||1)-1:0,(T.params[0]||1)-1),!0}charPosAbsolute(T){return this._setCursor((T.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(T){return this._moveCursor(T.params[0]||1,0),!0}linePosAbsolute(T){return this._setCursor(this._activeBuffer.x,(T.params[0]||1)-1),!0}vPositionRelative(T){return this._moveCursor(0,T.params[0]||1),!0}hVPosition(T){return this.cursorPosition(T),!0}tabClear(T){const B=T.params[0];return B===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:B===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(T){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let B=T.params[0]||1;for(;B--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(T){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let B=T.params[0]||1;for(;B--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(T){const B=T.params[0];return B===1&&(this._curAttrData.bg|=536870912),B!==2&&B!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(T,B,P,F=!1,Y=!1){const Z=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);Z.replaceCells(B,P,this._activeBuffer.getNullCell(this._eraseAttrData()),Y),F&&(Z.isWrapped=!1)}_resetBufferLine(T,B=!1){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);P&&(P.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),B),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+T),P.isWrapped=!1)}eraseInDisplay(T,B=!1){let P;switch(this._restrictCursor(this._bufferService.cols),T.params[0]){case 0:for(P=this._activeBuffer.y,this._dirtyRowTracker.markDirty(P),this._eraseInBufferLine(P++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,B);P<this._bufferService.rows;P++)this._resetBufferLine(P,B);this._dirtyRowTracker.markDirty(P);break;case 1:for(P=this._activeBuffer.y,this._dirtyRowTracker.markDirty(P),this._eraseInBufferLine(P,0,this._activeBuffer.x+1,!0,B),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(P+1).isWrapped=!1);P--;)this._resetBufferLine(P,B);this._dirtyRowTracker.markDirty(0);break;case 2:for(P=this._bufferService.rows,this._dirtyRowTracker.markDirty(P-1);P--;)this._resetBufferLine(P,B);this._dirtyRowTracker.markDirty(0);break;case 3:const F=this._activeBuffer.lines.length-this._bufferService.rows;F>0&&(this._activeBuffer.lines.trimStart(F),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-F,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-F,0),this._onScroll.fire(0))}return!0}eraseInLine(T,B=!1){switch(this._restrictCursor(this._bufferService.cols),T.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,B);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,B);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,B)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(T){this._restrictCursor();let B=T.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=this._activeBuffer.ybase+this._activeBuffer.y,F=this._bufferService.rows-1-this._activeBuffer.scrollBottom,Y=this._bufferService.rows-1+this._activeBuffer.ybase-F+1;for(;B--;)this._activeBuffer.lines.splice(Y-1,1),this._activeBuffer.lines.splice(P,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(T){this._restrictCursor();let B=T.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=this._activeBuffer.ybase+this._activeBuffer.y;let F;for(F=this._bufferService.rows-1-this._activeBuffer.scrollBottom,F=this._bufferService.rows-1+this._activeBuffer.ybase-F;B--;)this._activeBuffer.lines.splice(P,1),this._activeBuffer.lines.splice(F,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(T){this._restrictCursor();const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return B&&(B.insertCells(this._activeBuffer.x,T.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(T){this._restrictCursor();const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return B&&(B.deleteCells(this._activeBuffer.x,T.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(T){let B=T.params[0]||1;for(;B--;)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(T){let B=T.params[0]||1;for(;B--;)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(f.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(T){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=T.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);F.deleteCells(0,B,this._activeBuffer.getNullCell(this._eraseAttrData())),F.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(T){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=T.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);F.insertCells(0,B,this._activeBuffer.getNullCell(this._eraseAttrData())),F.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(T){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=T.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);F.insertCells(this._activeBuffer.x,B,this._activeBuffer.getNullCell(this._eraseAttrData())),F.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(T){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=T.params[0]||1;for(let P=this._activeBuffer.scrollTop;P<=this._activeBuffer.scrollBottom;++P){const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);F.deleteCells(this._activeBuffer.x,B,this._activeBuffer.getNullCell(this._eraseAttrData())),F.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(T){this._restrictCursor();const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return B&&(B.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(T.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(T){const B=this._parser.precedingJoinState;if(!B)return!0;const P=T.params[0]||1,F=R.UnicodeService.extractWidth(B),Y=this._activeBuffer.x-F,Z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(Y),ie=new Uint32Array(Z.length*P);let ae=0;for(let H=0;H<Z.length;){const re=Z.codePointAt(H)||0;ie[ae++]=re,H+=re>65535?2:1}let X=ae;for(let H=1;H<P;++H)ie.copyWithin(X,0,ae),X+=ae;return this.print(ie,0,X),!0}sendDeviceAttributesPrimary(T){return T.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(c.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(c.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(T){return T.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(c.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(c.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(T.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(c.C0.ESC+"[>83;40003;0c")),!0}_is(T){return(this._optionsService.rawOptions.termName+"").indexOf(T)===0}setMode(T){for(let B=0;B<T.length;B++)switch(T.params[B]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(T){for(let B=0;B<T.length;B++)switch(T.params[B]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,m.DEFAULT_CHARSET),this._charsetService.setgCharset(1,m.DEFAULT_CHARSET),this._charsetService.setgCharset(2,m.DEFAULT_CHARSET),this._charsetService.setgCharset(3,m.DEFAULT_CHARSET);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(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(T){for(let B=0;B<T.length;B++)switch(T.params[B]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(T){for(let B=0;B<T.length;B++)switch(T.params[B]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),T.params[B]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(T,B){const P=this._coreService.decPrivateModes,{activeProtocol:F,activeEncoding:Y}=this._coreMouseService,Z=this._coreService,{buffers:ie,cols:ae}=this._bufferService,{active:X,alt:H}=ie,re=this._optionsService.rawOptions,te=Se=>Se?1:2,ce=T.params[0];return le=ce,pe=B?ce===2?4:ce===4?te(Z.modes.insertMode):ce===12?3:ce===20?te(re.convertEol):0:ce===1?te(P.applicationCursorKeys):ce===3?re.windowOptions.setWinLines?ae===80?2:ae===132?1:0:0:ce===6?te(P.origin):ce===7?te(P.wraparound):ce===8?3:ce===9?te(F==="X10"):ce===12?te(re.cursorBlink):ce===25?te(!Z.isCursorHidden):ce===45?te(P.reverseWraparound):ce===66?te(P.applicationKeypad):ce===67?4:ce===1e3?te(F==="VT200"):ce===1002?te(F==="DRAG"):ce===1003?te(F==="ANY"):ce===1004?te(P.sendFocus):ce===1005?4:ce===1006?te(Y==="SGR"):ce===1015?4:ce===1016?te(Y==="SGR_PIXELS"):ce===1048?1:ce===47||ce===1047||ce===1049?te(X===H):ce===2004?te(P.bracketedPasteMode):0,Z.triggerDataEvent(`${c.C0.ESC}[${B?"":"?"}${le};${pe}$y`),!0;var le,pe}_updateAttrColor(T,B,P,F,Y){return B===2?(T|=50331648,T&=-16777216,T|=w.AttributeData.fromColorRGB([P,F,Y])):B===5&&(T&=-50331904,T|=33554432|255&P),T}_extractColor(T,B,P){const F=[0,0,-1,0,0,0];let Y=0,Z=0;do{if(F[Z+Y]=T.params[B+Z],T.hasSubParams(B+Z)){const ie=T.getSubParams(B+Z);let ae=0;do F[1]===5&&(Y=1),F[Z+ae+1+Y]=ie[ae];while(++ae<ie.length&&ae+Z+1+Y<F.length);break}if(F[1]===5&&Z+Y>=2||F[1]===2&&Z+Y>=5)break;F[1]&&(Y=1)}while(++Z+B<T.length&&Z+Y<F.length);for(let ie=2;ie<F.length;++ie)F[ie]===-1&&(F[ie]=0);switch(F[0]){case 38:P.fg=this._updateAttrColor(P.fg,F[1],F[3],F[4],F[5]);break;case 48:P.bg=this._updateAttrColor(P.bg,F[1],F[3],F[4],F[5]);break;case 58:P.extended=P.extended.clone(),P.extended.underlineColor=this._updateAttrColor(P.extended.underlineColor,F[1],F[3],F[4],F[5])}return Z}_processUnderline(T,B){B.extended=B.extended.clone(),(!~T||T>5)&&(T=1),B.extended.underlineStyle=T,B.fg|=268435456,T===0&&(B.fg&=-268435457),B.updateExtended()}_processSGR0(T){T.fg=f.DEFAULT_ATTR_DATA.fg,T.bg=f.DEFAULT_ATTR_DATA.bg,T.extended=T.extended.clone(),T.extended.underlineStyle=0,T.extended.underlineColor&=-67108864,T.updateExtended()}charAttributes(T){if(T.length===1&&T.params[0]===0)return this._processSGR0(this._curAttrData),!0;const B=T.length;let P;const F=this._curAttrData;for(let Y=0;Y<B;Y++)P=T.params[Y],P>=30&&P<=37?(F.fg&=-50331904,F.fg|=16777216|P-30):P>=40&&P<=47?(F.bg&=-50331904,F.bg|=16777216|P-40):P>=90&&P<=97?(F.fg&=-50331904,F.fg|=16777224|P-90):P>=100&&P<=107?(F.bg&=-50331904,F.bg|=16777224|P-100):P===0?this._processSGR0(F):P===1?F.fg|=134217728:P===3?F.bg|=67108864:P===4?(F.fg|=268435456,this._processUnderline(T.hasSubParams(Y)?T.getSubParams(Y)[0]:1,F)):P===5?F.fg|=536870912:P===7?F.fg|=67108864:P===8?F.fg|=1073741824:P===9?F.fg|=2147483648:P===2?F.bg|=134217728:P===21?this._processUnderline(2,F):P===22?(F.fg&=-134217729,F.bg&=-134217729):P===23?F.bg&=-67108865:P===24?(F.fg&=-268435457,this._processUnderline(0,F)):P===25?F.fg&=-536870913:P===27?F.fg&=-67108865:P===28?F.fg&=-1073741825:P===29?F.fg&=2147483647:P===39?(F.fg&=-67108864,F.fg|=16777215&f.DEFAULT_ATTR_DATA.fg):P===49?(F.bg&=-67108864,F.bg|=16777215&f.DEFAULT_ATTR_DATA.bg):P===38||P===48||P===58?Y+=this._extractColor(T,Y,F):P===53?F.bg|=1073741824:P===55?F.bg&=-1073741825:P===59?(F.extended=F.extended.clone(),F.extended.underlineColor=-1,F.updateExtended()):P===100?(F.fg&=-67108864,F.fg|=16777215&f.DEFAULT_ATTR_DATA.fg,F.bg&=-67108864,F.bg|=16777215&f.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",P);return!0}deviceStatus(T){switch(T.params[0]){case 5:this._coreService.triggerDataEvent(`${c.C0.ESC}[0n`);break;case 6:const B=this._activeBuffer.y+1,P=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${c.C0.ESC}[${B};${P}R`)}return!0}deviceStatusPrivate(T){if(T.params[0]===6){const B=this._activeBuffer.y+1,P=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${c.C0.ESC}[?${B};${P}R`)}return!0}softReset(T){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=f.DEFAULT_ATTR_DATA.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(T){const B=T.params[0]||1;switch(B){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const P=B%2==1;return this._optionsService.options.cursorBlink=P,!0}setScrollRegion(T){const B=T.params[0]||1;let P;return(T.length<2||(P=T.params[1])>this._bufferService.rows||P===0)&&(P=this._bufferService.rows),P>B&&(this._activeBuffer.scrollTop=B-1,this._activeBuffer.scrollBottom=P-1,this._setCursor(0,0)),!0}windowOptions(T){if(!j(T.params[0],this._optionsService.rawOptions.windowOptions))return!0;const B=T.length>1?T.params[1]:0;switch(T.params[0]){case 14:B!==2&&this._onRequestWindowsOptionsReport.fire(N.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(N.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${c.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:B!==0&&B!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),B!==0&&B!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:B!==0&&B!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),B!==0&&B!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(T){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(T){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(T){return this._windowTitle=T,this._onTitleChange.fire(T),!0}setIconName(T){return this._iconName=T,!0}setOrReportIndexedColor(T){const B=[],P=T.split(";");for(;P.length>1;){const F=P.shift(),Y=P.shift();if(/^\d+$/.exec(F)){const Z=parseInt(F);if(K(Z))if(Y==="?")B.push({type:0,index:Z});else{const ie=(0,M.parseColor)(Y);ie&&B.push({type:1,index:Z,color:ie})}}}return B.length&&this._onColor.fire(B),!0}setHyperlink(T){const B=T.split(";");return!(B.length<2)&&(B[1]?this._createHyperlink(B[0],B[1]):!B[0]&&this._finishHyperlink())}_createHyperlink(T,B){this._getCurrentLinkId()&&this._finishHyperlink();const P=T.split(":");let F;const Y=P.findIndex((Z=>Z.startsWith("id=")));return Y!==-1&&(F=P[Y].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:F,uri:B}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(T,B){const P=T.split(";");for(let F=0;F<P.length&&!(B>=this._specialColors.length);++F,++B)if(P[F]==="?")this._onColor.fire([{type:0,index:this._specialColors[B]}]);else{const Y=(0,M.parseColor)(P[F]);Y&&this._onColor.fire([{type:1,index:this._specialColors[B],color:Y}])}return!0}setOrReportFgColor(T){return this._setOrReportSpecialColor(T,0)}setOrReportBgColor(T){return this._setOrReportSpecialColor(T,1)}setOrReportCursorColor(T){return this._setOrReportSpecialColor(T,2)}restoreIndexedColor(T){if(!T)return this._onColor.fire([{type:2}]),!0;const B=[],P=T.split(";");for(let F=0;F<P.length;++F)if(/^\d+$/.exec(P[F])){const Y=parseInt(P[F]);K(Y)&&B.push({type:2,index:Y})}return B.length&&this._onColor.fire(B),!0}restoreFgColor(T){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(T){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(T){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,m.DEFAULT_CHARSET),!0}selectCharset(T){return T.length!==2?(this.selectDefaultCharset(),!0):(T[0]==="/"||this._charsetService.setgCharset(W[T[0]],m.CHARSETS[T[1]]||m.DEFAULT_CHARSET),!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){const T=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,T,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=f.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=f.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(T){return this._charsetService.setgLevel(T),!0}screenAlignmentPattern(){const T=new u.CellData;T.content=4194373,T.fg=this._curAttrData.fg,T.bg=this._curAttrData.bg,this._setCursor(0,0);for(let B=0;B<this._bufferService.rows;++B){const P=this._activeBuffer.ybase+this._activeBuffer.y+B,F=this._activeBuffer.lines.get(P);F&&(F.fill(T),F.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(T,B){const P=this._bufferService.buffer,F=this._optionsService.rawOptions;return(Y=>(this._coreService.triggerDataEvent(`${c.C0.ESC}${Y}${c.C0.ESC}\\`),!0))(T==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:T==='"p'?'P1$r61;1"p':T==="r"?`P1$r${P.scrollTop+1};${P.scrollBottom+1}r`:T==="m"?"P1$r0m":T===" q"?`P1$r${{block:2,underline:4,bar:6}[F.cursorStyle]-(F.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(T,B){this._dirtyRowTracker.markRangeDirty(T,B)}}a.InputHandler=q;let U=class{constructor(V){this._bufferService=V,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(V){V<this.start?this.start=V:V>this.end&&(this.end=V)}markRangeDirty(V,T){V>T&&(I=V,V=T,T=I),V<this.start&&(this.start=V),T>this.end&&(this.end=T)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function K(V){return 0<=V&&V<256}U=_([v(0,L.IBufferService)],U)},844:(y,a)=>{function l(_){for(const v of _)v.dispose();_.length=0}Object.defineProperty(a,"__esModule",{value:!0}),a.getDisposeArrayDisposable=a.disposeArray=a.toDisposable=a.MutableDisposable=a.Disposable=void 0,a.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const _ of this._disposables)_.dispose();this._disposables.length=0}register(_){return this._disposables.push(_),_}unregister(_){const v=this._disposables.indexOf(_);v!==-1&&this._disposables.splice(v,1)}},a.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(_){var v;this._isDisposed||_===this._value||((v=this._value)==null||v.dispose(),this._value=_)}clear(){this.value=void 0}dispose(){var _;this._isDisposed=!0,(_=this._value)==null||_.dispose(),this._value=void 0}},a.toDisposable=function(_){return{dispose:_}},a.disposeArray=l,a.getDisposeArrayDisposable=function(_){return{dispose:()=>l(_)}}},1505:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.FourKeyMap=a.TwoKeyMap=void 0;class l{constructor(){this._data={}}set(v,c,m){this._data[v]||(this._data[v]={}),this._data[v][c]=m}get(v,c){return this._data[v]?this._data[v][c]:void 0}clear(){this._data={}}}a.TwoKeyMap=l,a.FourKeyMap=class{constructor(){this._data=new l}set(_,v,c,m,C){this._data.get(_,v)||this._data.set(_,v,new l),this._data.get(_,v).set(c,m,C)}get(_,v,c,m){var C;return(C=this._data.get(_,v))==null?void 0:C.get(c,m)}clear(){this._data.clear()}}},6114:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.isChromeOS=a.isLinux=a.isWindows=a.isIphone=a.isIpad=a.isMac=a.getSafariVersion=a.isSafari=a.isLegacyEdge=a.isFirefox=a.isNode=void 0,a.isNode=typeof process<"u"&&"title"in process;const l=a.isNode?"node":navigator.userAgent,_=a.isNode?"node":navigator.platform;a.isFirefox=l.includes("Firefox"),a.isLegacyEdge=l.includes("Edge"),a.isSafari=/^((?!chrome|android).)*safari/i.test(l),a.getSafariVersion=function(){if(!a.isSafari)return 0;const v=l.match(/Version\/(\d+)/);return v===null||v.length<2?0:parseInt(v[1])},a.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(_),a.isIpad=_==="iPad",a.isIphone=_==="iPhone",a.isWindows=["Windows","Win16","Win32","WinCE"].includes(_),a.isLinux=_.indexOf("Linux")>=0,a.isChromeOS=/\bCrOS\b/.test(l)},6106:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.SortedList=void 0;let l=0;a.SortedList=class{constructor(_){this._getKey=_,this._array=[]}clear(){this._array.length=0}insert(_){this._array.length!==0?(l=this._search(this._getKey(_)),this._array.splice(l,0,_)):this._array.push(_)}delete(_){if(this._array.length===0)return!1;const v=this._getKey(_);if(v===void 0||(l=this._search(v),l===-1)||this._getKey(this._array[l])!==v)return!1;do if(this._array[l]===_)return this._array.splice(l,1),!0;while(++l<this._array.length&&this._getKey(this._array[l])===v);return!1}*getKeyIterator(_){if(this._array.length!==0&&(l=this._search(_),!(l<0||l>=this._array.length)&&this._getKey(this._array[l])===_))do yield this._array[l];while(++l<this._array.length&&this._getKey(this._array[l])===_)}forEachByKey(_,v){if(this._array.length!==0&&(l=this._search(_),!(l<0||l>=this._array.length)&&this._getKey(this._array[l])===_))do v(this._array[l]);while(++l<this._array.length&&this._getKey(this._array[l])===_)}values(){return[...this._array].values()}_search(_){let v=0,c=this._array.length-1;for(;c>=v;){let m=v+c>>1;const C=this._getKey(this._array[m]);if(C>_)c=m-1;else{if(!(C<_)){for(;m>0&&this._getKey(this._array[m-1])===_;)m--;return m}v=m+1}}return v}}},7226:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DebouncedIdleTask=a.IdleTaskQueue=a.PriorityTaskQueue=void 0;const _=l(6114);class v{constructor(){this._tasks=[],this._i=0}enqueue(C){this._tasks.push(C),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(C){this._idleCallback=void 0;let b=0,x=0,f=C.timeRemaining(),p=0;for(;this._i<this._tasks.length;){if(b=Date.now(),this._tasks[this._i]()||this._i++,b=Math.max(1,Date.now()-b),x=Math.max(b,x),p=C.timeRemaining(),1.5*x>p)return f-b<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(f-b))}ms`),void this._start();f=p}this.clear()}}class c extends v{_requestCallback(C){return setTimeout((()=>C(this._createDeadline(16))))}_cancelCallback(C){clearTimeout(C)}_createDeadline(C){const b=Date.now()+C;return{timeRemaining:()=>Math.max(0,b-Date.now())}}}a.PriorityTaskQueue=c,a.IdleTaskQueue=!_.isNode&&"requestIdleCallback"in window?class extends v{_requestCallback(m){return requestIdleCallback(m)}_cancelCallback(m){cancelIdleCallback(m)}}:c,a.DebouncedIdleTask=class{constructor(){this._queue=new a.IdleTaskQueue}set(m){this._queue.clear(),this._queue.enqueue(m)}flush(){this._queue.flush()}}},9282:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.updateWindowsModeWrappedState=void 0;const _=l(643);a.updateWindowsModeWrappedState=function(v){const c=v.buffer.lines.get(v.buffer.ybase+v.buffer.y-1),m=c==null?void 0:c.get(v.cols-1),C=v.buffer.lines.get(v.buffer.ybase+v.buffer.y);C&&m&&(C.isWrapped=m[_.CHAR_DATA_CODE_INDEX]!==_.NULL_CELL_CODE&&m[_.CHAR_DATA_CODE_INDEX]!==_.WHITESPACE_CELL_CODE)}},3734:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ExtendedAttrs=a.AttributeData=void 0;class l{constructor(){this.fg=0,this.bg=0,this.extended=new _}static toColorRGB(c){return[c>>>16&255,c>>>8&255,255&c]}static fromColorRGB(c){return(255&c[0])<<16|(255&c[1])<<8|255&c[2]}clone(){const c=new l;return c.fg=this.fg,c.bg=this.bg,c.extended=this.extended.clone(),c}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}a.AttributeData=l;class _{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(c){this._ext=c}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(c){this._ext&=-469762049,this._ext|=c<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(c){this._ext&=-67108864,this._ext|=67108863&c}get urlId(){return this._urlId}set urlId(c){this._urlId=c}get underlineVariantOffset(){const c=(3758096384&this._ext)>>29;return c<0?4294967288^c:c}set underlineVariantOffset(c){this._ext&=536870911,this._ext|=c<<29&3758096384}constructor(c=0,m=0){this._ext=0,this._urlId=0,this._ext=c,this._urlId=m}clone(){return new _(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}a.ExtendedAttrs=_},9092:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Buffer=a.MAX_BUFFER_SIZE=void 0;const _=l(6349),v=l(7226),c=l(3734),m=l(8437),C=l(4634),b=l(511),x=l(643),f=l(4863),p=l(7116);a.MAX_BUFFER_SIZE=4294967295,a.Buffer=class{constructor(d,u,w){this._hasScrollback=d,this._optionsService=u,this._bufferService=w,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=m.DEFAULT_ATTR_DATA.clone(),this.savedCharset=p.DEFAULT_CHARSET,this.markers=[],this._nullCell=b.CellData.fromCharData([0,x.NULL_CELL_CHAR,x.NULL_CELL_WIDTH,x.NULL_CELL_CODE]),this._whitespaceCell=b.CellData.fromCharData([0,x.WHITESPACE_CELL_CHAR,x.WHITESPACE_CELL_WIDTH,x.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new v.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new _.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(d){return d?(this._nullCell.fg=d.fg,this._nullCell.bg=d.bg,this._nullCell.extended=d.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new c.ExtendedAttrs),this._nullCell}getWhitespaceCell(d){return d?(this._whitespaceCell.fg=d.fg,this._whitespaceCell.bg=d.bg,this._whitespaceCell.extended=d.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new c.ExtendedAttrs),this._whitespaceCell}getBlankLine(d,u){return new m.BufferLine(this._bufferService.cols,this.getNullCell(d),u)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const d=this.ybase+this.y-this.ydisp;return d>=0&&d<this._rows}_getCorrectBufferLength(d){if(!this._hasScrollback)return d;const u=d+this._optionsService.rawOptions.scrollback;return u>a.MAX_BUFFER_SIZE?a.MAX_BUFFER_SIZE:u}fillViewportRows(d){if(this.lines.length===0){d===void 0&&(d=m.DEFAULT_ATTR_DATA);let u=this._rows;for(;u--;)this.lines.push(this.getBlankLine(d))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new _.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(d,u){const w=this.getNullCell(m.DEFAULT_ATTR_DATA);let L=0;const R=this._getCorrectBufferLength(u);if(R>this.lines.maxLength&&(this.lines.maxLength=R),this.lines.length>0){if(this._cols<d)for(let k=0;k<this.lines.length;k++)L+=+this.lines.get(k).resize(d,w);let D=0;if(this._rows<u)for(let k=this._rows;k<u;k++)this.lines.length<u+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new m.BufferLine(d,w)):this.ybase>0&&this.lines.length<=this.ybase+this.y+D+1?(this.ybase--,D++,this.ydisp>0&&this.ydisp--):this.lines.push(new m.BufferLine(d,w)));else for(let k=this._rows;k>u;k--)this.lines.length>u+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(R<this.lines.maxLength){const k=this.lines.length-R;k>0&&(this.lines.trimStart(k),this.ybase=Math.max(this.ybase-k,0),this.ydisp=Math.max(this.ydisp-k,0),this.savedY=Math.max(this.savedY-k,0)),this.lines.maxLength=R}this.x=Math.min(this.x,d-1),this.y=Math.min(this.y,u-1),D&&(this.y+=D),this.savedX=Math.min(this.savedX,d-1),this.scrollTop=0}if(this.scrollBottom=u-1,this._isReflowEnabled&&(this._reflow(d,u),this._cols>d))for(let D=0;D<this.lines.length;D++)L+=+this.lines.get(D).resize(d,w);this._cols=d,this._rows=u,this._memoryCleanupQueue.clear(),L>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let d=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,d=!1);let u=0;for(;this._memoryCleanupPosition<this.lines.length;)if(u+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),u>100)return!0;return d}get _isReflowEnabled(){const d=this._optionsService.rawOptions.windowsPty;return d&&d.buildNumber?this._hasScrollback&&d.backend==="conpty"&&d.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(d,u){this._cols!==d&&(d>this._cols?this._reflowLarger(d,u):this._reflowSmaller(d,u))}_reflowLarger(d,u){const w=(0,C.reflowLargerGetLinesToRemove)(this.lines,this._cols,d,this.ybase+this.y,this.getNullCell(m.DEFAULT_ATTR_DATA));if(w.length>0){const L=(0,C.reflowLargerCreateNewLayout)(this.lines,w);(0,C.reflowLargerApplyNewLayout)(this.lines,L.layout),this._reflowLargerAdjustViewport(d,u,L.countRemoved)}}_reflowLargerAdjustViewport(d,u,w){const L=this.getNullCell(m.DEFAULT_ATTR_DATA);let R=w;for(;R-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<u&&this.lines.push(new m.BufferLine(d,L))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-w,0)}_reflowSmaller(d,u){const w=this.getNullCell(m.DEFAULT_ATTR_DATA),L=[];let R=0;for(let D=this.lines.length-1;D>=0;D--){let k=this.lines.get(D);if(!k||!k.isWrapped&&k.getTrimmedLength()<=d)continue;const M=[k];for(;k.isWrapped&&D>0;)k=this.lines.get(--D),M.unshift(k);const W=this.ybase+this.y;if(W>=D&&W<D+M.length)continue;const z=M[M.length-1].getTrimmedLength(),j=(0,C.reflowSmallerGetNewLineLengths)(M,this._cols,d),N=j.length-M.length;let I;I=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+N):Math.max(0,this.lines.length-this.lines.maxLength+N);const q=[];for(let P=0;P<N;P++){const F=this.getBlankLine(m.DEFAULT_ATTR_DATA,!0);q.push(F)}q.length>0&&(L.push({start:D+M.length+R,newLines:q}),R+=q.length),M.push(...q);let U=j.length-1,K=j[U];K===0&&(U--,K=j[U]);let V=M.length-N-1,T=z;for(;V>=0;){const P=Math.min(T,K);if(M[U]===void 0)break;if(M[U].copyCellsFrom(M[V],T-P,K-P,P,!0),K-=P,K===0&&(U--,K=j[U]),T-=P,T===0){V--;const F=Math.max(V,0);T=(0,C.getWrappedLineTrimmedLength)(M,F,this._cols)}}for(let P=0;P<M.length;P++)j[P]<d&&M[P].setCell(j[P],w);let B=N-I;for(;B-- >0;)this.ybase===0?this.y<u-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+R)-u&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+N,this.ybase+u-1)}if(L.length>0){const D=[],k=[];for(let U=0;U<this.lines.length;U++)k.push(this.lines.get(U));const M=this.lines.length;let W=M-1,z=0,j=L[z];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+R);let N=0;for(let U=Math.min(this.lines.maxLength-1,M+R-1);U>=0;U--)if(j&&j.start>W+N){for(let K=j.newLines.length-1;K>=0;K--)this.lines.set(U--,j.newLines[K]);U++,D.push({index:W+1,amount:j.newLines.length}),N+=j.newLines.length,j=L[++z]}else this.lines.set(U,k[W--]);let I=0;for(let U=D.length-1;U>=0;U--)D[U].index+=I,this.lines.onInsertEmitter.fire(D[U]),I+=D[U].amount;const q=Math.max(0,M+R-this.lines.maxLength);q>0&&this.lines.onTrimEmitter.fire(q)}}translateBufferLineToString(d,u,w=0,L){const R=this.lines.get(d);return R?R.translateToString(u,w,L):""}getWrappedRangeForLine(d){let u=d,w=d;for(;u>0&&this.lines.get(u).isWrapped;)u--;for(;w+1<this.lines.length&&this.lines.get(w+1).isWrapped;)w++;return{first:u,last:w}}setupTabStops(d){for(d!=null?this.tabs[d]||(d=this.prevStop(d)):(this.tabs={},d=0);d<this._cols;d+=this._optionsService.rawOptions.tabStopWidth)this.tabs[d]=!0}prevStop(d){for(d==null&&(d=this.x);!this.tabs[--d]&&d>0;);return d>=this._cols?this._cols-1:d<0?0:d}nextStop(d){for(d==null&&(d=this.x);!this.tabs[++d]&&d<this._cols;);return d>=this._cols?this._cols-1:d<0?0:d}clearMarkers(d){this._isClearing=!0;for(let u=0;u<this.markers.length;u++)this.markers[u].line===d&&(this.markers[u].dispose(),this.markers.splice(u--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let d=0;d<this.markers.length;d++)this.markers[d].dispose(),this.markers.splice(d--,1);this._isClearing=!1}addMarker(d){const u=new f.Marker(d);return this.markers.push(u),u.register(this.lines.onTrim((w=>{u.line-=w,u.line<0&&u.dispose()}))),u.register(this.lines.onInsert((w=>{u.line>=w.index&&(u.line+=w.amount)}))),u.register(this.lines.onDelete((w=>{u.line>=w.index&&u.line<w.index+w.amount&&u.dispose(),u.line>w.index&&(u.line-=w.amount)}))),u.register(u.onDispose((()=>this._removeMarker(u)))),u}_removeMarker(d){this._isClearing||this.markers.splice(this.markers.indexOf(d),1)}}},8437:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferLine=a.DEFAULT_ATTR_DATA=void 0;const _=l(3734),v=l(511),c=l(643),m=l(482);a.DEFAULT_ATTR_DATA=Object.freeze(new _.AttributeData);let C=0;class b{constructor(f,p,d=!1){this.isWrapped=d,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*f);const u=p||v.CellData.fromCharData([0,c.NULL_CELL_CHAR,c.NULL_CELL_WIDTH,c.NULL_CELL_CODE]);for(let w=0;w<f;++w)this.setCell(w,u);this.length=f}get(f){const p=this._data[3*f+0],d=2097151&p;return[this._data[3*f+1],2097152&p?this._combined[f]:d?(0,m.stringFromCodePoint)(d):"",p>>22,2097152&p?this._combined[f].charCodeAt(this._combined[f].length-1):d]}set(f,p){this._data[3*f+1]=p[c.CHAR_DATA_ATTR_INDEX],p[c.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[f]=p[1],this._data[3*f+0]=2097152|f|p[c.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*f+0]=p[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|p[c.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(f){return this._data[3*f+0]>>22}hasWidth(f){return 12582912&this._data[3*f+0]}getFg(f){return this._data[3*f+1]}getBg(f){return this._data[3*f+2]}hasContent(f){return 4194303&this._data[3*f+0]}getCodePoint(f){const p=this._data[3*f+0];return 2097152&p?this._combined[f].charCodeAt(this._combined[f].length-1):2097151&p}isCombined(f){return 2097152&this._data[3*f+0]}getString(f){const p=this._data[3*f+0];return 2097152&p?this._combined[f]:2097151&p?(0,m.stringFromCodePoint)(2097151&p):""}isProtected(f){return 536870912&this._data[3*f+2]}loadCell(f,p){return C=3*f,p.content=this._data[C+0],p.fg=this._data[C+1],p.bg=this._data[C+2],2097152&p.content&&(p.combinedData=this._combined[f]),268435456&p.bg&&(p.extended=this._extendedAttrs[f]),p}setCell(f,p){2097152&p.content&&(this._combined[f]=p.combinedData),268435456&p.bg&&(this._extendedAttrs[f]=p.extended),this._data[3*f+0]=p.content,this._data[3*f+1]=p.fg,this._data[3*f+2]=p.bg}setCellFromCodepoint(f,p,d,u){268435456&u.bg&&(this._extendedAttrs[f]=u.extended),this._data[3*f+0]=p|d<<22,this._data[3*f+1]=u.fg,this._data[3*f+2]=u.bg}addCodepointToCell(f,p,d){let u=this._data[3*f+0];2097152&u?this._combined[f]+=(0,m.stringFromCodePoint)(p):2097151&u?(this._combined[f]=(0,m.stringFromCodePoint)(2097151&u)+(0,m.stringFromCodePoint)(p),u&=-2097152,u|=2097152):u=p|4194304,d&&(u&=-12582913,u|=d<<22),this._data[3*f+0]=u}insertCells(f,p,d){if((f%=this.length)&&this.getWidth(f-1)===2&&this.setCellFromCodepoint(f-1,0,1,d),p<this.length-f){const u=new v.CellData;for(let w=this.length-f-p-1;w>=0;--w)this.setCell(f+p+w,this.loadCell(f+w,u));for(let w=0;w<p;++w)this.setCell(f+w,d)}else for(let u=f;u<this.length;++u)this.setCell(u,d);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,d)}deleteCells(f,p,d){if(f%=this.length,p<this.length-f){const u=new v.CellData;for(let w=0;w<this.length-f-p;++w)this.setCell(f+w,this.loadCell(f+p+w,u));for(let w=this.length-p;w<this.length;++w)this.setCell(w,d)}else for(let u=f;u<this.length;++u)this.setCell(u,d);f&&this.getWidth(f-1)===2&&this.setCellFromCodepoint(f-1,0,1,d),this.getWidth(f)!==0||this.hasContent(f)||this.setCellFromCodepoint(f,0,1,d)}replaceCells(f,p,d,u=!1){if(u)for(f&&this.getWidth(f-1)===2&&!this.isProtected(f-1)&&this.setCellFromCodepoint(f-1,0,1,d),p<this.length&&this.getWidth(p-1)===2&&!this.isProtected(p)&&this.setCellFromCodepoint(p,0,1,d);f<p&&f<this.length;)this.isProtected(f)||this.setCell(f,d),f++;else for(f&&this.getWidth(f-1)===2&&this.setCellFromCodepoint(f-1,0,1,d),p<this.length&&this.getWidth(p-1)===2&&this.setCellFromCodepoint(p,0,1,d);f<p&&f<this.length;)this.setCell(f++,d)}resize(f,p){if(f===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const d=3*f;if(f>this.length){if(this._data.buffer.byteLength>=4*d)this._data=new Uint32Array(this._data.buffer,0,d);else{const u=new Uint32Array(d);u.set(this._data),this._data=u}for(let u=this.length;u<f;++u)this.setCell(u,p)}else{this._data=this._data.subarray(0,d);const u=Object.keys(this._combined);for(let L=0;L<u.length;L++){const R=parseInt(u[L],10);R>=f&&delete this._combined[R]}const w=Object.keys(this._extendedAttrs);for(let L=0;L<w.length;L++){const R=parseInt(w[L],10);R>=f&&delete this._extendedAttrs[R]}}return this.length=f,4*d*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const f=new Uint32Array(this._data.length);return f.set(this._data),this._data=f,1}return 0}fill(f,p=!1){if(p)for(let d=0;d<this.length;++d)this.isProtected(d)||this.setCell(d,f);else{this._combined={},this._extendedAttrs={};for(let d=0;d<this.length;++d)this.setCell(d,f)}}copyFrom(f){this.length!==f.length?this._data=new Uint32Array(f._data):this._data.set(f._data),this.length=f.length,this._combined={};for(const p in f._combined)this._combined[p]=f._combined[p];this._extendedAttrs={};for(const p in f._extendedAttrs)this._extendedAttrs[p]=f._extendedAttrs[p];this.isWrapped=f.isWrapped}clone(){const f=new b(0);f._data=new Uint32Array(this._data),f.length=this.length;for(const p in this._combined)f._combined[p]=this._combined[p];for(const p in this._extendedAttrs)f._extendedAttrs[p]=this._extendedAttrs[p];return f.isWrapped=this.isWrapped,f}getTrimmedLength(){for(let f=this.length-1;f>=0;--f)if(4194303&this._data[3*f+0])return f+(this._data[3*f+0]>>22);return 0}getNoBgTrimmedLength(){for(let f=this.length-1;f>=0;--f)if(4194303&this._data[3*f+0]||50331648&this._data[3*f+2])return f+(this._data[3*f+0]>>22);return 0}copyCellsFrom(f,p,d,u,w){const L=f._data;if(w)for(let D=u-1;D>=0;D--){for(let k=0;k<3;k++)this._data[3*(d+D)+k]=L[3*(p+D)+k];268435456&L[3*(p+D)+2]&&(this._extendedAttrs[d+D]=f._extendedAttrs[p+D])}else for(let D=0;D<u;D++){for(let k=0;k<3;k++)this._data[3*(d+D)+k]=L[3*(p+D)+k];268435456&L[3*(p+D)+2]&&(this._extendedAttrs[d+D]=f._extendedAttrs[p+D])}const R=Object.keys(f._combined);for(let D=0;D<R.length;D++){const k=parseInt(R[D],10);k>=p&&(this._combined[k-p+d]=f._combined[k])}}translateToString(f,p,d,u){p=p??0,d=d??this.length,f&&(d=Math.min(d,this.getTrimmedLength())),u&&(u.length=0);let w="";for(;p<d;){const L=this._data[3*p+0],R=2097151&L,D=2097152&L?this._combined[p]:R?(0,m.stringFromCodePoint)(R):c.WHITESPACE_CELL_CHAR;if(w+=D,u)for(let k=0;k<D.length;++k)u.push(p);p+=L>>22||1}return u&&u.push(p),w}}a.BufferLine=b},4841:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.getRangeLength=void 0,a.getRangeLength=function(l,_){if(l.start.y>l.end.y)throw new Error(`Buffer range end (${l.end.x}, ${l.end.y}) cannot be before start (${l.start.x}, ${l.start.y})`);return _*(l.end.y-l.start.y)+(l.end.x-l.start.x+1)}},4634:(y,a)=>{function l(_,v,c){if(v===_.length-1)return _[v].getTrimmedLength();const m=!_[v].hasContent(c-1)&&_[v].getWidth(c-1)===1,C=_[v+1].getWidth(0)===2;return m&&C?c-1:c}Object.defineProperty(a,"__esModule",{value:!0}),a.getWrappedLineTrimmedLength=a.reflowSmallerGetNewLineLengths=a.reflowLargerApplyNewLayout=a.reflowLargerCreateNewLayout=a.reflowLargerGetLinesToRemove=void 0,a.reflowLargerGetLinesToRemove=function(_,v,c,m,C){const b=[];for(let x=0;x<_.length-1;x++){let f=x,p=_.get(++f);if(!p.isWrapped)continue;const d=[_.get(x)];for(;f<_.length&&p.isWrapped;)d.push(p),p=_.get(++f);if(m>=x&&m<f){x+=d.length-1;continue}let u=0,w=l(d,u,v),L=1,R=0;for(;L<d.length;){const k=l(d,L,v),M=k-R,W=c-w,z=Math.min(M,W);d[u].copyCellsFrom(d[L],R,w,z,!1),w+=z,w===c&&(u++,w=0),R+=z,R===k&&(L++,R=0),w===0&&u!==0&&d[u-1].getWidth(c-1)===2&&(d[u].copyCellsFrom(d[u-1],c-1,w++,1,!1),d[u-1].setCell(c-1,C))}d[u].replaceCells(w,c,C);let D=0;for(let k=d.length-1;k>0&&(k>u||d[k].getTrimmedLength()===0);k--)D++;D>0&&(b.push(x+d.length-D),b.push(D)),x+=d.length-1}return b},a.reflowLargerCreateNewLayout=function(_,v){const c=[];let m=0,C=v[m],b=0;for(let x=0;x<_.length;x++)if(C===x){const f=v[++m];_.onDeleteEmitter.fire({index:x-b,amount:f}),x+=f-1,b+=f,C=v[++m]}else c.push(x);return{layout:c,countRemoved:b}},a.reflowLargerApplyNewLayout=function(_,v){const c=[];for(let m=0;m<v.length;m++)c.push(_.get(v[m]));for(let m=0;m<c.length;m++)_.set(m,c[m]);_.length=v.length},a.reflowSmallerGetNewLineLengths=function(_,v,c){const m=[],C=_.map(((p,d)=>l(_,d,v))).reduce(((p,d)=>p+d));let b=0,x=0,f=0;for(;f<C;){if(C-f<c){m.push(C-f);break}b+=c;const p=l(_,x,v);b>p&&(b-=p,x++);const d=_[x].getWidth(b-1)===2;d&&b--;const u=d?c-1:c;m.push(u),f+=u}return m},a.getWrappedLineTrimmedLength=l},5295:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferSet=void 0;const _=l(8460),v=l(844),c=l(9092);class m extends v.Disposable{constructor(b,x){super(),this._optionsService=b,this._bufferService=x,this._onBufferActivate=this.register(new _.EventEmitter),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 c.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new c.Buffer(!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(b){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(b),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(b,x){this._normal.resize(b,x),this._alt.resize(b,x),this.setupTabStops(b)}setupTabStops(b){this._normal.setupTabStops(b),this._alt.setupTabStops(b)}}a.BufferSet=m},511:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CellData=void 0;const _=l(482),v=l(643),c=l(3734);class m extends c.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new c.ExtendedAttrs,this.combinedData=""}static fromCharData(b){const x=new m;return x.setFromCharData(b),x}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,_.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(b){this.fg=b[v.CHAR_DATA_ATTR_INDEX],this.bg=0;let x=!1;if(b[v.CHAR_DATA_CHAR_INDEX].length>2)x=!0;else if(b[v.CHAR_DATA_CHAR_INDEX].length===2){const f=b[v.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=f&&f<=56319){const p=b[v.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=p&&p<=57343?this.content=1024*(f-55296)+p-56320+65536|b[v.CHAR_DATA_WIDTH_INDEX]<<22:x=!0}else x=!0}else this.content=b[v.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|b[v.CHAR_DATA_WIDTH_INDEX]<<22;x&&(this.combinedData=b[v.CHAR_DATA_CHAR_INDEX],this.content=2097152|b[v.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}a.CellData=m},643:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WHITESPACE_CELL_CODE=a.WHITESPACE_CELL_WIDTH=a.WHITESPACE_CELL_CHAR=a.NULL_CELL_CODE=a.NULL_CELL_WIDTH=a.NULL_CELL_CHAR=a.CHAR_DATA_CODE_INDEX=a.CHAR_DATA_WIDTH_INDEX=a.CHAR_DATA_CHAR_INDEX=a.CHAR_DATA_ATTR_INDEX=a.DEFAULT_EXT=a.DEFAULT_ATTR=a.DEFAULT_COLOR=void 0,a.DEFAULT_COLOR=0,a.DEFAULT_ATTR=256|a.DEFAULT_COLOR<<9,a.DEFAULT_EXT=0,a.CHAR_DATA_ATTR_INDEX=0,a.CHAR_DATA_CHAR_INDEX=1,a.CHAR_DATA_WIDTH_INDEX=2,a.CHAR_DATA_CODE_INDEX=3,a.NULL_CELL_CHAR="",a.NULL_CELL_WIDTH=1,a.NULL_CELL_CODE=0,a.WHITESPACE_CELL_CHAR=" ",a.WHITESPACE_CELL_WIDTH=1,a.WHITESPACE_CELL_CODE=32},4863:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Marker=void 0;const _=l(8460),v=l(844);class c{get id(){return this._id}constructor(C){this.line=C,this.isDisposed=!1,this._disposables=[],this._id=c._nextId++,this._onDispose=this.register(new _.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,v.disposeArray)(this._disposables),this._disposables.length=0)}register(C){return this._disposables.push(C),C}}a.Marker=c,c._nextId=1},7116:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DEFAULT_CHARSET=a.CHARSETS=void 0,a.CHARSETS={},a.DEFAULT_CHARSET=a.CHARSETS.B,a.CHARSETS[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:"≥","{":"π","|":"≠","}":"£","~":"·"},a.CHARSETS.A={"#":"£"},a.CHARSETS.B=void 0,a.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},a.CHARSETS.C=a.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},a.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},a.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},a.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},a.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},a.CHARSETS.E=a.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},a.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},a.CHARSETS.H=a.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},a.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(y,a)=>{var l,_,v;Object.defineProperty(a,"__esModule",{value:!0}),a.C1_ESCAPED=a.C1=a.C0=void 0,(function(c){c.NUL="\0",c.SOH="",c.STX="",c.ETX="",c.EOT="",c.ENQ="",c.ACK="",c.BEL="\x07",c.BS="\b",c.HT=" ",c.LF=`
69
69
  `,c.VT="\v",c.FF="\f",c.CR="\r",c.SO="",c.SI="",c.DLE="",c.DC1="",c.DC2="",c.DC3="",c.DC4="",c.NAK="",c.SYN="",c.ETB="",c.CAN="",c.EM="",c.SUB="",c.ESC="\x1B",c.FS="",c.GS="",c.RS="",c.US="",c.SP=" ",c.DEL=""})(l||(a.C0=l={})),(function(c){c.PAD="€",c.HOP="",c.BPH="‚",c.NBH="ƒ",c.IND="„",c.NEL="…",c.SSA="†",c.ESA="‡",c.HTS="ˆ",c.HTJ="‰",c.VTS="Š",c.PLD="‹",c.PLU="Œ",c.RI="",c.SS2="Ž",c.SS3="",c.DCS="",c.PU1="‘",c.PU2="’",c.STS="“",c.CCH="”",c.MW="•",c.SPA="–",c.EPA="—",c.SOS="˜",c.SGCI="™",c.SCI="š",c.CSI="›",c.ST="œ",c.OSC="",c.PM="ž",c.APC="Ÿ"})(_||(a.C1=_={})),(function(c){c.ST=`${l.ESC}\\`})(v||(a.C1_ESCAPED=v={}))},7399:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.evaluateKeyboardEvent=void 0;const _=l(2584),v={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:["'",'"']};a.evaluateKeyboardEvent=function(c,m,C,b){const x={type:0,cancel:!1,key:void 0},f=(c.shiftKey?1:0)|(c.altKey?2:0)|(c.ctrlKey?4:0)|(c.metaKey?8:0);switch(c.keyCode){case 0:c.key==="UIKeyInputUpArrow"?x.key=m?_.C0.ESC+"OA":_.C0.ESC+"[A":c.key==="UIKeyInputLeftArrow"?x.key=m?_.C0.ESC+"OD":_.C0.ESC+"[D":c.key==="UIKeyInputRightArrow"?x.key=m?_.C0.ESC+"OC":_.C0.ESC+"[C":c.key==="UIKeyInputDownArrow"&&(x.key=m?_.C0.ESC+"OB":_.C0.ESC+"[B");break;case 8:x.key=c.ctrlKey?"\b":_.C0.DEL,c.altKey&&(x.key=_.C0.ESC+x.key);break;case 9:if(c.shiftKey){x.key=_.C0.ESC+"[Z";break}x.key=_.C0.HT,x.cancel=!0;break;case 13:x.key=c.altKey?_.C0.ESC+_.C0.CR:_.C0.CR,x.cancel=!0;break;case 27:x.key=_.C0.ESC,c.altKey&&(x.key=_.C0.ESC+_.C0.ESC),x.cancel=!0;break;case 37:if(c.metaKey)break;f?(x.key=_.C0.ESC+"[1;"+(f+1)+"D",x.key===_.C0.ESC+"[1;3D"&&(x.key=_.C0.ESC+(C?"b":"[1;5D"))):x.key=m?_.C0.ESC+"OD":_.C0.ESC+"[D";break;case 39:if(c.metaKey)break;f?(x.key=_.C0.ESC+"[1;"+(f+1)+"C",x.key===_.C0.ESC+"[1;3C"&&(x.key=_.C0.ESC+(C?"f":"[1;5C"))):x.key=m?_.C0.ESC+"OC":_.C0.ESC+"[C";break;case 38:if(c.metaKey)break;f?(x.key=_.C0.ESC+"[1;"+(f+1)+"A",C||x.key!==_.C0.ESC+"[1;3A"||(x.key=_.C0.ESC+"[1;5A")):x.key=m?_.C0.ESC+"OA":_.C0.ESC+"[A";break;case 40:if(c.metaKey)break;f?(x.key=_.C0.ESC+"[1;"+(f+1)+"B",C||x.key!==_.C0.ESC+"[1;3B"||(x.key=_.C0.ESC+"[1;5B")):x.key=m?_.C0.ESC+"OB":_.C0.ESC+"[B";break;case 45:c.shiftKey||c.ctrlKey||(x.key=_.C0.ESC+"[2~");break;case 46:x.key=f?_.C0.ESC+"[3;"+(f+1)+"~":_.C0.ESC+"[3~";break;case 36:x.key=f?_.C0.ESC+"[1;"+(f+1)+"H":m?_.C0.ESC+"OH":_.C0.ESC+"[H";break;case 35:x.key=f?_.C0.ESC+"[1;"+(f+1)+"F":m?_.C0.ESC+"OF":_.C0.ESC+"[F";break;case 33:c.shiftKey?x.type=2:c.ctrlKey?x.key=_.C0.ESC+"[5;"+(f+1)+"~":x.key=_.C0.ESC+"[5~";break;case 34:c.shiftKey?x.type=3:c.ctrlKey?x.key=_.C0.ESC+"[6;"+(f+1)+"~":x.key=_.C0.ESC+"[6~";break;case 112:x.key=f?_.C0.ESC+"[1;"+(f+1)+"P":_.C0.ESC+"OP";break;case 113:x.key=f?_.C0.ESC+"[1;"+(f+1)+"Q":_.C0.ESC+"OQ";break;case 114:x.key=f?_.C0.ESC+"[1;"+(f+1)+"R":_.C0.ESC+"OR";break;case 115:x.key=f?_.C0.ESC+"[1;"+(f+1)+"S":_.C0.ESC+"OS";break;case 116:x.key=f?_.C0.ESC+"[15;"+(f+1)+"~":_.C0.ESC+"[15~";break;case 117:x.key=f?_.C0.ESC+"[17;"+(f+1)+"~":_.C0.ESC+"[17~";break;case 118:x.key=f?_.C0.ESC+"[18;"+(f+1)+"~":_.C0.ESC+"[18~";break;case 119:x.key=f?_.C0.ESC+"[19;"+(f+1)+"~":_.C0.ESC+"[19~";break;case 120:x.key=f?_.C0.ESC+"[20;"+(f+1)+"~":_.C0.ESC+"[20~";break;case 121:x.key=f?_.C0.ESC+"[21;"+(f+1)+"~":_.C0.ESC+"[21~";break;case 122:x.key=f?_.C0.ESC+"[23;"+(f+1)+"~":_.C0.ESC+"[23~";break;case 123:x.key=f?_.C0.ESC+"[24;"+(f+1)+"~":_.C0.ESC+"[24~";break;default:if(!c.ctrlKey||c.shiftKey||c.altKey||c.metaKey)if(C&&!b||!c.altKey||c.metaKey)!C||c.altKey||c.ctrlKey||c.shiftKey||!c.metaKey?c.key&&!c.ctrlKey&&!c.altKey&&!c.metaKey&&c.keyCode>=48&&c.key.length===1?x.key=c.key:c.key&&c.ctrlKey&&(c.key==="_"&&(x.key=_.C0.US),c.key==="@"&&(x.key=_.C0.NUL)):c.keyCode===65&&(x.type=1);else{const p=v[c.keyCode],d=p==null?void 0:p[c.shiftKey?1:0];if(d)x.key=_.C0.ESC+d;else if(c.keyCode>=65&&c.keyCode<=90){const u=c.ctrlKey?c.keyCode-64:c.keyCode+32;let w=String.fromCharCode(u);c.shiftKey&&(w=w.toUpperCase()),x.key=_.C0.ESC+w}else if(c.keyCode===32)x.key=_.C0.ESC+(c.ctrlKey?_.C0.NUL:" ");else if(c.key==="Dead"&&c.code.startsWith("Key")){let u=c.code.slice(3,4);c.shiftKey||(u=u.toLowerCase()),x.key=_.C0.ESC+u,x.cancel=!0}}else c.keyCode>=65&&c.keyCode<=90?x.key=String.fromCharCode(c.keyCode-64):c.keyCode===32?x.key=_.C0.NUL:c.keyCode>=51&&c.keyCode<=55?x.key=String.fromCharCode(c.keyCode-51+27):c.keyCode===56?x.key=_.C0.DEL:c.keyCode===219?x.key=_.C0.ESC:c.keyCode===220?x.key=_.C0.FS:c.keyCode===221&&(x.key=_.C0.GS)}return x}},482:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Utf8ToUtf32=a.StringToUtf32=a.utf32ToString=a.stringFromCodePoint=void 0,a.stringFromCodePoint=function(l){return l>65535?(l-=65536,String.fromCharCode(55296+(l>>10))+String.fromCharCode(l%1024+56320)):String.fromCharCode(l)},a.utf32ToString=function(l,_=0,v=l.length){let c="";for(let m=_;m<v;++m){let C=l[m];C>65535?(C-=65536,c+=String.fromCharCode(55296+(C>>10))+String.fromCharCode(C%1024+56320)):c+=String.fromCharCode(C)}return c},a.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(l,_){const v=l.length;if(!v)return 0;let c=0,m=0;if(this._interim){const C=l.charCodeAt(m++);56320<=C&&C<=57343?_[c++]=1024*(this._interim-55296)+C-56320+65536:(_[c++]=this._interim,_[c++]=C),this._interim=0}for(let C=m;C<v;++C){const b=l.charCodeAt(C);if(55296<=b&&b<=56319){if(++C>=v)return this._interim=b,c;const x=l.charCodeAt(C);56320<=x&&x<=57343?_[c++]=1024*(b-55296)+x-56320+65536:(_[c++]=b,_[c++]=x)}else b!==65279&&(_[c++]=b)}return c}},a.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(l,_){const v=l.length;if(!v)return 0;let c,m,C,b,x=0,f=0,p=0;if(this.interim[0]){let w=!1,L=this.interim[0];L&=(224&L)==192?31:(240&L)==224?15:7;let R,D=0;for(;(R=63&this.interim[++D])&&D<4;)L<<=6,L|=R;const k=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,M=k-D;for(;p<M;){if(p>=v)return 0;if(R=l[p++],(192&R)!=128){p--,w=!0;break}this.interim[D++]=R,L<<=6,L|=63&R}w||(k===2?L<128?p--:_[x++]=L:k===3?L<2048||L>=55296&&L<=57343||L===65279||(_[x++]=L):L<65536||L>1114111||(_[x++]=L)),this.interim.fill(0)}const d=v-4;let u=p;for(;u<v;){for(;!(!(u<d)||128&(c=l[u])||128&(m=l[u+1])||128&(C=l[u+2])||128&(b=l[u+3]));)_[x++]=c,_[x++]=m,_[x++]=C,_[x++]=b,u+=4;if(c=l[u++],c<128)_[x++]=c;else if((224&c)==192){if(u>=v)return this.interim[0]=c,x;if(m=l[u++],(192&m)!=128){u--;continue}if(f=(31&c)<<6|63&m,f<128){u--;continue}_[x++]=f}else if((240&c)==224){if(u>=v)return this.interim[0]=c,x;if(m=l[u++],(192&m)!=128){u--;continue}if(u>=v)return this.interim[0]=c,this.interim[1]=m,x;if(C=l[u++],(192&C)!=128){u--;continue}if(f=(15&c)<<12|(63&m)<<6|63&C,f<2048||f>=55296&&f<=57343||f===65279)continue;_[x++]=f}else if((248&c)==240){if(u>=v)return this.interim[0]=c,x;if(m=l[u++],(192&m)!=128){u--;continue}if(u>=v)return this.interim[0]=c,this.interim[1]=m,x;if(C=l[u++],(192&C)!=128){u--;continue}if(u>=v)return this.interim[0]=c,this.interim[1]=m,this.interim[2]=C,x;if(b=l[u++],(192&b)!=128){u--;continue}if(f=(7&c)<<18|(63&m)<<12|(63&C)<<6|63&b,f<65536||f>1114111)continue;_[x++]=f}}return x}}},225:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeV6=void 0;const _=l(1480),v=[[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]],c=[[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]];let m;a.UnicodeV6=class{constructor(){if(this.version="6",!m){m=new Uint8Array(65536),m.fill(1),m[0]=0,m.fill(0,1,32),m.fill(0,127,160),m.fill(2,4352,4448),m[9001]=2,m[9002]=2,m.fill(2,11904,42192),m[12351]=1,m.fill(2,44032,55204),m.fill(2,63744,64256),m.fill(2,65040,65050),m.fill(2,65072,65136),m.fill(2,65280,65377),m.fill(2,65504,65511);for(let C=0;C<v.length;++C)m.fill(0,v[C][0],v[C][1]+1)}}wcwidth(C){return C<32?0:C<127?1:C<65536?m[C]:(function(b,x){let f,p=0,d=x.length-1;if(b<x[0][0]||b>x[d][1])return!1;for(;d>=p;)if(f=p+d>>1,b>x[f][1])p=f+1;else{if(!(b<x[f][0]))return!0;d=f-1}return!1})(C,c)?0:C>=131072&&C<=196605||C>=196608&&C<=262141?2:1}charProperties(C,b){let x=this.wcwidth(C),f=x===0&&b!==0;if(f){const p=_.UnicodeService.extractWidth(b);p===0?f=!1:p>x&&(x=p)}return _.UnicodeService.createPropertyValue(0,x,f)}}},5981:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WriteBuffer=void 0;const _=l(8460),v=l(844);class c extends v.Disposable{constructor(C){super(),this._action=C,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new _.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(C,b){if(b!==void 0&&this._syncCalls>b)return void(this._syncCalls=0);if(this._pendingData+=C.length,this._writeBuffer.push(C),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let x;for(this._isSyncWriting=!0;x=this._writeBuffer.shift();){this._action(x);const f=this._callbacks.shift();f&&f()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(C,b){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=C.length,this._writeBuffer.push(C),this._callbacks.push(b),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=C.length,this._writeBuffer.push(C),this._callbacks.push(b)}_innerWrite(C=0,b=!0){const x=C||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const f=this._writeBuffer[this._bufferOffset],p=this._action(f,b);if(p){const u=w=>Date.now()-x>=12?setTimeout((()=>this._innerWrite(0,w))):this._innerWrite(x,w);return void p.catch((w=>(queueMicrotask((()=>{throw w})),Promise.resolve(!1)))).then(u)}const d=this._callbacks[this._bufferOffset];if(d&&d(),this._bufferOffset++,this._pendingData-=f.length,Date.now()-x>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}a.WriteBuffer=c},5941:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.toRgbString=a.parseColor=void 0;const l=/^([\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})$/,_=/^[\da-f]+$/;function v(c,m){const C=c.toString(16),b=C.length<2?"0"+C:C;switch(m){case 4:return C[0];case 8:return b;case 12:return(b+b).slice(0,3);default:return b+b}}a.parseColor=function(c){if(!c)return;let m=c.toLowerCase();if(m.indexOf("rgb:")===0){m=m.slice(4);const C=l.exec(m);if(C){const b=C[1]?15:C[4]?255:C[7]?4095:65535;return[Math.round(parseInt(C[1]||C[4]||C[7]||C[10],16)/b*255),Math.round(parseInt(C[2]||C[5]||C[8]||C[11],16)/b*255),Math.round(parseInt(C[3]||C[6]||C[9]||C[12],16)/b*255)]}}else if(m.indexOf("#")===0&&(m=m.slice(1),_.exec(m)&&[3,6,9,12].includes(m.length))){const C=m.length/3,b=[0,0,0];for(let x=0;x<3;++x){const f=parseInt(m.slice(C*x,C*x+C),16);b[x]=C===1?f<<4:C===2?f:C===3?f>>4:f>>8}return b}},a.toRgbString=function(c,m=16){const[C,b,x]=c;return`rgb:${v(C,m)}/${v(b,m)}/${v(x,m)}`}},5770:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.PAYLOAD_LIMIT=void 0,a.PAYLOAD_LIMIT=1e7},6351:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DcsHandler=a.DcsParser=void 0;const _=l(482),v=l(8742),c=l(5770),m=[];a.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=m,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=m}registerHandler(b,x){this._handlers[b]===void 0&&(this._handlers[b]=[]);const f=this._handlers[b];return f.push(x),{dispose:()=>{const p=f.indexOf(x);p!==-1&&f.splice(p,1)}}}clearHandler(b){this._handlers[b]&&delete this._handlers[b]}setHandlerFallback(b){this._handlerFb=b}reset(){if(this._active.length)for(let b=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;b>=0;--b)this._active[b].unhook(!1);this._stack.paused=!1,this._active=m,this._ident=0}hook(b,x){if(this.reset(),this._ident=b,this._active=this._handlers[b]||m,this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].hook(x);else this._handlerFb(this._ident,"HOOK",x)}put(b,x,f){if(this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].put(b,x,f);else this._handlerFb(this._ident,"PUT",(0,_.utf32ToString)(b,x,f))}unhook(b,x=!0){if(this._active.length){let f=!1,p=this._active.length-1,d=!1;if(this._stack.paused&&(p=this._stack.loopPosition-1,f=x,d=this._stack.fallThrough,this._stack.paused=!1),!d&&f===!1){for(;p>=0&&(f=this._active[p].unhook(b),f!==!0);p--)if(f instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!1,f;p--}for(;p>=0;p--)if(f=this._active[p].unhook(!1),f instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!0,f}else this._handlerFb(this._ident,"UNHOOK",b);this._active=m,this._ident=0}};const C=new v.Params;C.addParam(0),a.DcsHandler=class{constructor(b){this._handler=b,this._data="",this._params=C,this._hitLimit=!1}hook(b){this._params=b.length>1||b.params[0]?b.clone():C,this._data="",this._hitLimit=!1}put(b,x,f){this._hitLimit||(this._data+=(0,_.utf32ToString)(b,x,f),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(b){let x=!1;if(this._hitLimit)x=!1;else if(b&&(x=this._handler(this._data,this._params),x instanceof Promise))return x.then((f=>(this._params=C,this._data="",this._hitLimit=!1,f)));return this._params=C,this._data="",this._hitLimit=!1,x}}},2015:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.EscapeSequenceParser=a.VT500_TRANSITION_TABLE=a.TransitionTable=void 0;const _=l(844),v=l(8742),c=l(6242),m=l(6351);class C{constructor(p){this.table=new Uint8Array(p)}setDefault(p,d){this.table.fill(p<<4|d)}add(p,d,u,w){this.table[d<<8|p]=u<<4|w}addMany(p,d,u,w){for(let L=0;L<p.length;L++)this.table[d<<8|p[L]]=u<<4|w}}a.TransitionTable=C;const b=160;a.VT500_TRANSITION_TABLE=(function(){const f=new C(4095),p=Array.apply(null,Array(256)).map(((D,k)=>k)),d=(D,k)=>p.slice(D,k),u=d(32,127),w=d(0,24);w.push(25),w.push.apply(w,d(28,32));const L=d(0,14);let R;for(R in f.setDefault(1,0),f.addMany(u,0,2,0),L)f.addMany([24,26,153,154],R,3,0),f.addMany(d(128,144),R,3,0),f.addMany(d(144,152),R,3,0),f.add(156,R,0,0),f.add(27,R,11,1),f.add(157,R,4,8),f.addMany([152,158,159],R,0,7),f.add(155,R,11,3),f.add(144,R,11,9);return f.addMany(w,0,3,0),f.addMany(w,1,3,1),f.add(127,1,0,1),f.addMany(w,8,0,8),f.addMany(w,3,3,3),f.add(127,3,0,3),f.addMany(w,4,3,4),f.add(127,4,0,4),f.addMany(w,6,3,6),f.addMany(w,5,3,5),f.add(127,5,0,5),f.addMany(w,2,3,2),f.add(127,2,0,2),f.add(93,1,4,8),f.addMany(u,8,5,8),f.add(127,8,5,8),f.addMany([156,27,24,26,7],8,6,0),f.addMany(d(28,32),8,0,8),f.addMany([88,94,95],1,0,7),f.addMany(u,7,0,7),f.addMany(w,7,0,7),f.add(156,7,0,0),f.add(127,7,0,7),f.add(91,1,11,3),f.addMany(d(64,127),3,7,0),f.addMany(d(48,60),3,8,4),f.addMany([60,61,62,63],3,9,4),f.addMany(d(48,60),4,8,4),f.addMany(d(64,127),4,7,0),f.addMany([60,61,62,63],4,0,6),f.addMany(d(32,64),6,0,6),f.add(127,6,0,6),f.addMany(d(64,127),6,0,0),f.addMany(d(32,48),3,9,5),f.addMany(d(32,48),5,9,5),f.addMany(d(48,64),5,0,6),f.addMany(d(64,127),5,7,0),f.addMany(d(32,48),4,9,5),f.addMany(d(32,48),1,9,2),f.addMany(d(32,48),2,9,2),f.addMany(d(48,127),2,10,0),f.addMany(d(48,80),1,10,0),f.addMany(d(81,88),1,10,0),f.addMany([89,90,92],1,10,0),f.addMany(d(96,127),1,10,0),f.add(80,1,11,9),f.addMany(w,9,0,9),f.add(127,9,0,9),f.addMany(d(28,32),9,0,9),f.addMany(d(32,48),9,9,12),f.addMany(d(48,60),9,8,10),f.addMany([60,61,62,63],9,9,10),f.addMany(w,11,0,11),f.addMany(d(32,128),11,0,11),f.addMany(d(28,32),11,0,11),f.addMany(w,10,0,10),f.add(127,10,0,10),f.addMany(d(28,32),10,0,10),f.addMany(d(48,60),10,8,10),f.addMany([60,61,62,63],10,0,11),f.addMany(d(32,48),10,9,12),f.addMany(w,12,0,12),f.add(127,12,0,12),f.addMany(d(28,32),12,0,12),f.addMany(d(32,48),12,9,12),f.addMany(d(48,64),12,0,11),f.addMany(d(64,127),12,12,13),f.addMany(d(64,127),10,12,13),f.addMany(d(64,127),9,12,13),f.addMany(w,13,13,13),f.addMany(u,13,13,13),f.add(127,13,0,13),f.addMany([27,156,24,26],13,14,0),f.add(b,0,2,0),f.add(b,8,5,8),f.add(b,6,0,6),f.add(b,11,0,11),f.add(b,13,13,13),f})();class x extends _.Disposable{constructor(p=a.VT500_TRANSITION_TABLE){super(),this._transitions=p,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new v.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(d,u,w)=>{},this._executeHandlerFb=d=>{},this._csiHandlerFb=(d,u)=>{},this._escHandlerFb=d=>{},this._errorHandlerFb=d=>d,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,_.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new c.OscParser),this._dcsParser=this.register(new m.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(p,d=[64,126]){let u=0;if(p.prefix){if(p.prefix.length>1)throw new Error("only one byte as prefix supported");if(u=p.prefix.charCodeAt(0),u&&60>u||u>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(p.intermediates){if(p.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let L=0;L<p.intermediates.length;++L){const R=p.intermediates.charCodeAt(L);if(32>R||R>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");u<<=8,u|=R}}if(p.final.length!==1)throw new Error("final must be a single byte");const w=p.final.charCodeAt(0);if(d[0]>w||w>d[1])throw new Error(`final must be in range ${d[0]} .. ${d[1]}`);return u<<=8,u|=w,u}identToString(p){const d=[];for(;p;)d.push(String.fromCharCode(255&p)),p>>=8;return d.reverse().join("")}setPrintHandler(p){this._printHandler=p}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(p,d){const u=this._identifier(p,[48,126]);this._escHandlers[u]===void 0&&(this._escHandlers[u]=[]);const w=this._escHandlers[u];return w.push(d),{dispose:()=>{const L=w.indexOf(d);L!==-1&&w.splice(L,1)}}}clearEscHandler(p){this._escHandlers[this._identifier(p,[48,126])]&&delete this._escHandlers[this._identifier(p,[48,126])]}setEscHandlerFallback(p){this._escHandlerFb=p}setExecuteHandler(p,d){this._executeHandlers[p.charCodeAt(0)]=d}clearExecuteHandler(p){this._executeHandlers[p.charCodeAt(0)]&&delete this._executeHandlers[p.charCodeAt(0)]}setExecuteHandlerFallback(p){this._executeHandlerFb=p}registerCsiHandler(p,d){const u=this._identifier(p);this._csiHandlers[u]===void 0&&(this._csiHandlers[u]=[]);const w=this._csiHandlers[u];return w.push(d),{dispose:()=>{const L=w.indexOf(d);L!==-1&&w.splice(L,1)}}}clearCsiHandler(p){this._csiHandlers[this._identifier(p)]&&delete this._csiHandlers[this._identifier(p)]}setCsiHandlerFallback(p){this._csiHandlerFb=p}registerDcsHandler(p,d){return this._dcsParser.registerHandler(this._identifier(p),d)}clearDcsHandler(p){this._dcsParser.clearHandler(this._identifier(p))}setDcsHandlerFallback(p){this._dcsParser.setHandlerFallback(p)}registerOscHandler(p,d){return this._oscParser.registerHandler(p,d)}clearOscHandler(p){this._oscParser.clearHandler(p)}setOscHandlerFallback(p){this._oscParser.setHandlerFallback(p)}setErrorHandler(p){this._errorHandler=p}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(p,d,u,w,L){this._parseStack.state=p,this._parseStack.handlers=d,this._parseStack.handlerPos=u,this._parseStack.transition=w,this._parseStack.chunkPos=L}parse(p,d,u){let w,L=0,R=0,D=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,D=this._parseStack.chunkPos+1;else{if(u===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const k=this._parseStack.handlers;let M=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(u===!1&&M>-1){for(;M>=0&&(w=k[M](this._params),w!==!0);M--)if(w instanceof Promise)return this._parseStack.handlerPos=M,w}this._parseStack.handlers=[];break;case 4:if(u===!1&&M>-1){for(;M>=0&&(w=k[M](),w!==!0);M--)if(w instanceof Promise)return this._parseStack.handlerPos=M,w}this._parseStack.handlers=[];break;case 6:if(L=p[this._parseStack.chunkPos],w=this._dcsParser.unhook(L!==24&&L!==26,u),w)return w;L===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(L=p[this._parseStack.chunkPos],w=this._oscParser.end(L!==24&&L!==26,u),w)return w;L===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,D=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let k=D;k<d;++k){switch(L=p[k],R=this._transitions.table[this.currentState<<8|(L<160?L:b)],R>>4){case 2:for(let N=k+1;;++N){if(N>=d||(L=p[N])<32||L>126&&L<b){this._printHandler(p,k,N),k=N-1;break}if(++N>=d||(L=p[N])<32||L>126&&L<b){this._printHandler(p,k,N),k=N-1;break}if(++N>=d||(L=p[N])<32||L>126&&L<b){this._printHandler(p,k,N),k=N-1;break}if(++N>=d||(L=p[N])<32||L>126&&L<b){this._printHandler(p,k,N),k=N-1;break}}break;case 3:this._executeHandlers[L]?this._executeHandlers[L]():this._executeHandlerFb(L),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:k,code:L,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const M=this._csiHandlers[this._collect<<8|L];let W=M?M.length-1:-1;for(;W>=0&&(w=M[W](this._params),w!==!0);W--)if(w instanceof Promise)return this._preserveStack(3,M,W,R,k),w;W<0&&this._csiHandlerFb(this._collect<<8|L,this._params),this.precedingJoinState=0;break;case 8:do switch(L){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(L-48)}while(++k<d&&(L=p[k])>47&&L<60);k--;break;case 9:this._collect<<=8,this._collect|=L;break;case 10:const z=this._escHandlers[this._collect<<8|L];let j=z?z.length-1:-1;for(;j>=0&&(w=z[j](),w!==!0);j--)if(w instanceof Promise)return this._preserveStack(4,z,j,R,k),w;j<0&&this._escHandlerFb(this._collect<<8|L),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|L,this._params);break;case 13:for(let N=k+1;;++N)if(N>=d||(L=p[N])===24||L===26||L===27||L>127&&L<b){this._dcsParser.put(p,k,N),k=N-1;break}break;case 14:if(w=this._dcsParser.unhook(L!==24&&L!==26),w)return this._preserveStack(6,[],0,R,k),w;L===27&&(R|=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 N=k+1;;N++)if(N>=d||(L=p[N])<32||L>127&&L<b){this._oscParser.put(p,k,N),k=N-1;break}break;case 6:if(w=this._oscParser.end(L!==24&&L!==26),w)return this._preserveStack(5,[],0,R,k),w;L===27&&(R|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&R}}}a.EscapeSequenceParser=x},6242:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.OscHandler=a.OscParser=void 0;const _=l(5770),v=l(482),c=[];a.OscParser=class{constructor(){this._state=0,this._active=c,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(m,C){this._handlers[m]===void 0&&(this._handlers[m]=[]);const b=this._handlers[m];return b.push(C),{dispose:()=>{const x=b.indexOf(C);x!==-1&&b.splice(x,1)}}}clearHandler(m){this._handlers[m]&&delete this._handlers[m]}setHandlerFallback(m){this._handlerFb=m}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=c}reset(){if(this._state===2)for(let m=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;m>=0;--m)this._active[m].end(!1);this._stack.paused=!1,this._active=c,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||c,this._active.length)for(let m=this._active.length-1;m>=0;m--)this._active[m].start();else this._handlerFb(this._id,"START")}_put(m,C,b){if(this._active.length)for(let x=this._active.length-1;x>=0;x--)this._active[x].put(m,C,b);else this._handlerFb(this._id,"PUT",(0,v.utf32ToString)(m,C,b))}start(){this.reset(),this._state=1}put(m,C,b){if(this._state!==3){if(this._state===1)for(;C<b;){const x=m[C++];if(x===59){this._state=2,this._start();break}if(x<48||57<x)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+x-48}this._state===2&&b-C>0&&this._put(m,C,b)}}end(m,C=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let b=!1,x=this._active.length-1,f=!1;if(this._stack.paused&&(x=this._stack.loopPosition-1,b=C,f=this._stack.fallThrough,this._stack.paused=!1),!f&&b===!1){for(;x>=0&&(b=this._active[x].end(m),b!==!0);x--)if(b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=x,this._stack.fallThrough=!1,b;x--}for(;x>=0;x--)if(b=this._active[x].end(!1),b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=x,this._stack.fallThrough=!0,b}else this._handlerFb(this._id,"END",m);this._active=c,this._id=-1,this._state=0}}},a.OscHandler=class{constructor(m){this._handler=m,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(m,C,b){this._hitLimit||(this._data+=(0,v.utf32ToString)(m,C,b),this._data.length>_.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(m){let C=!1;if(this._hitLimit)C=!1;else if(m&&(C=this._handler(this._data),C instanceof Promise))return C.then((b=>(this._data="",this._hitLimit=!1,b)));return this._data="",this._hitLimit=!1,C}}},8742:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Params=void 0;const l=2147483647;class _{static fromArray(c){const m=new _;if(!c.length)return m;for(let C=Array.isArray(c[0])?1:0;C<c.length;++C){const b=c[C];if(Array.isArray(b))for(let x=0;x<b.length;++x)m.addSubParam(b[x]);else m.addParam(b)}return m}constructor(c=32,m=32){if(this.maxLength=c,this.maxSubParamsLength=m,m>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(c),this.length=0,this._subParams=new Int32Array(m),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(c),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const c=new _(this.maxLength,this.maxSubParamsLength);return c.params.set(this.params),c.length=this.length,c._subParams.set(this._subParams),c._subParamsLength=this._subParamsLength,c._subParamsIdx.set(this._subParamsIdx),c._rejectDigits=this._rejectDigits,c._rejectSubDigits=this._rejectSubDigits,c._digitIsSub=this._digitIsSub,c}toArray(){const c=[];for(let m=0;m<this.length;++m){c.push(this.params[m]);const C=this._subParamsIdx[m]>>8,b=255&this._subParamsIdx[m];b-C>0&&c.push(Array.prototype.slice.call(this._subParams,C,b))}return c}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(c){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(c<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=c>l?l:c}}addSubParam(c){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(c<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=c>l?l:c,this._subParamsIdx[this.length-1]++}}hasSubParams(c){return(255&this._subParamsIdx[c])-(this._subParamsIdx[c]>>8)>0}getSubParams(c){const m=this._subParamsIdx[c]>>8,C=255&this._subParamsIdx[c];return C-m>0?this._subParams.subarray(m,C):null}getSubParamsAll(){const c={};for(let m=0;m<this.length;++m){const C=this._subParamsIdx[m]>>8,b=255&this._subParamsIdx[m];b-C>0&&(c[m]=this._subParams.slice(C,b))}return c}addDigit(c){let m;if(this._rejectDigits||!(m=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const C=this._digitIsSub?this._subParams:this.params,b=C[m-1];C[m-1]=~b?Math.min(10*b+c,l):c}}a.Params=_},5741:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.AddonManager=void 0,a.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let l=this._addons.length-1;l>=0;l--)this._addons[l].instance.dispose()}loadAddon(l,_){const v={instance:_,dispose:_.dispose,isDisposed:!1};this._addons.push(v),_.dispose=()=>this._wrappedAddonDispose(v),_.activate(l)}_wrappedAddonDispose(l){if(l.isDisposed)return;let _=-1;for(let v=0;v<this._addons.length;v++)if(this._addons[v]===l){_=v;break}if(_===-1)throw new Error("Could not dispose an addon that has not been loaded");l.isDisposed=!0,l.dispose.apply(l.instance),this._addons.splice(_,1)}}},8771:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferApiView=void 0;const _=l(3785),v=l(511);a.BufferApiView=class{constructor(c,m){this._buffer=c,this.type=m}init(c){return this._buffer=c,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(c){const m=this._buffer.lines.get(c);if(m)return new _.BufferLineApiView(m)}getNullCell(){return new v.CellData}}},3785:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferLineApiView=void 0;const _=l(511);a.BufferLineApiView=class{constructor(v){this._line=v}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(v,c){if(!(v<0||v>=this._line.length))return c?(this._line.loadCell(v,c),c):this._line.loadCell(v,new _.CellData)}translateToString(v,c,m){return this._line.translateToString(v,c,m)}}},8285:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferNamespaceApi=void 0;const _=l(8771),v=l(8460),c=l(844);class m extends c.Disposable{constructor(b){super(),this._core=b,this._onBufferChange=this.register(new v.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new _.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new _.BufferApiView(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)}}a.BufferNamespaceApi=m},7975:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ParserApi=void 0,a.ParserApi=class{constructor(l){this._core=l}registerCsiHandler(l,_){return this._core.registerCsiHandler(l,(v=>_(v.toArray())))}addCsiHandler(l,_){return this.registerCsiHandler(l,_)}registerDcsHandler(l,_){return this._core.registerDcsHandler(l,((v,c)=>_(v,c.toArray())))}addDcsHandler(l,_){return this.registerDcsHandler(l,_)}registerEscHandler(l,_){return this._core.registerEscHandler(l,_)}addEscHandler(l,_){return this.registerEscHandler(l,_)}registerOscHandler(l,_){return this._core.registerOscHandler(l,_)}addOscHandler(l,_){return this.registerOscHandler(l,_)}}},7090:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeApi=void 0,a.UnicodeApi=class{constructor(l){this._core=l}register(l){this._core.unicodeService.register(l)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(l){this._core.unicodeService.activeVersion=l}}},744:function(y,a,l){var _=this&&this.__decorate||function(f,p,d,u){var w,L=arguments.length,R=L<3?p:u===null?u=Object.getOwnPropertyDescriptor(p,d):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(f,p,d,u);else for(var D=f.length-1;D>=0;D--)(w=f[D])&&(R=(L<3?w(R):L>3?w(p,d,R):w(p,d))||R);return L>3&&R&&Object.defineProperty(p,d,R),R},v=this&&this.__param||function(f,p){return function(d,u){p(d,u,f)}};Object.defineProperty(a,"__esModule",{value:!0}),a.BufferService=a.MINIMUM_ROWS=a.MINIMUM_COLS=void 0;const c=l(8460),m=l(844),C=l(5295),b=l(2585);a.MINIMUM_COLS=2,a.MINIMUM_ROWS=1;let x=a.BufferService=class extends m.Disposable{get buffer(){return this.buffers.active}constructor(f){super(),this.isUserScrolling=!1,this._onResize=this.register(new c.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new c.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(f.rawOptions.cols||0,a.MINIMUM_COLS),this.rows=Math.max(f.rawOptions.rows||0,a.MINIMUM_ROWS),this.buffers=this.register(new C.BufferSet(f,this))}resize(f,p){this.cols=f,this.rows=p,this.buffers.resize(f,p),this._onResize.fire({cols:f,rows:p})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(f,p=!1){const d=this.buffer;let u;u=this._cachedBlankLine,u&&u.length===this.cols&&u.getFg(0)===f.fg&&u.getBg(0)===f.bg||(u=d.getBlankLine(f,p),this._cachedBlankLine=u),u.isWrapped=p;const w=d.ybase+d.scrollTop,L=d.ybase+d.scrollBottom;if(d.scrollTop===0){const R=d.lines.isFull;L===d.lines.length-1?R?d.lines.recycle().copyFrom(u):d.lines.push(u.clone()):d.lines.splice(L+1,0,u.clone()),R?this.isUserScrolling&&(d.ydisp=Math.max(d.ydisp-1,0)):(d.ybase++,this.isUserScrolling||d.ydisp++)}else{const R=L-w+1;d.lines.shiftElements(w+1,R-1,-1),d.lines.set(L,u.clone())}this.isUserScrolling||(d.ydisp=d.ybase),this._onScroll.fire(d.ydisp)}scrollLines(f,p,d){const u=this.buffer;if(f<0){if(u.ydisp===0)return;this.isUserScrolling=!0}else f+u.ydisp>=u.ybase&&(this.isUserScrolling=!1);const w=u.ydisp;u.ydisp=Math.max(Math.min(u.ydisp+f,u.ybase),0),w!==u.ydisp&&(p||this._onScroll.fire(u.ydisp))}};a.BufferService=x=_([v(0,b.IOptionsService)],x)},7994:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CharsetService=void 0,a.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(l){this.glevel=l,this.charset=this._charsets[l]}setgCharset(l,_){this._charsets[l]=_,this.glevel===l&&(this.charset=_)}}},1753:function(y,a,l){var _=this&&this.__decorate||function(u,w,L,R){var D,k=arguments.length,M=k<3?w:R===null?R=Object.getOwnPropertyDescriptor(w,L):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(u,w,L,R);else for(var W=u.length-1;W>=0;W--)(D=u[W])&&(M=(k<3?D(M):k>3?D(w,L,M):D(w,L))||M);return k>3&&M&&Object.defineProperty(w,L,M),M},v=this&&this.__param||function(u,w){return function(L,R){w(L,R,u)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CoreMouseService=void 0;const c=l(2585),m=l(8460),C=l(844),b={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:u=>u.button!==4&&u.action===1&&(u.ctrl=!1,u.alt=!1,u.shift=!1,!0)},VT200:{events:19,restrict:u=>u.action!==32},DRAG:{events:23,restrict:u=>u.action!==32||u.button!==3},ANY:{events:31,restrict:u=>!0}};function x(u,w){let L=(u.ctrl?16:0)|(u.shift?4:0)|(u.alt?8:0);return u.button===4?(L|=64,L|=u.action):(L|=3&u.button,4&u.button&&(L|=64),8&u.button&&(L|=128),u.action===32?L|=32:u.action!==0||w||(L|=3)),L}const f=String.fromCharCode,p={DEFAULT:u=>{const w=[x(u,!1)+32,u.col+32,u.row+32];return w[0]>255||w[1]>255||w[2]>255?"":`\x1B[M${f(w[0])}${f(w[1])}${f(w[2])}`},SGR:u=>{const w=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${x(u,!0)};${u.col};${u.row}${w}`},SGR_PIXELS:u=>{const w=u.action===0&&u.button!==4?"m":"M";return`\x1B[<${x(u,!0)};${u.x};${u.y}${w}`}};let d=a.CoreMouseService=class extends C.Disposable{constructor(u,w){super(),this._bufferService=u,this._coreService=w,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new m.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const L of Object.keys(b))this.addProtocol(L,b[L]);for(const L of Object.keys(p))this.addEncoding(L,p[L]);this.reset()}addProtocol(u,w){this._protocols[u]=w}addEncoding(u,w){this._encodings[u]=w}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(u){if(!this._protocols[u])throw new Error(`unknown protocol "${u}"`);this._activeProtocol=u,this._onProtocolChange.fire(this._protocols[u].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(u){if(!this._encodings[u])throw new Error(`unknown encoding "${u}"`);this._activeEncoding=u}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(u){if(u.col<0||u.col>=this._bufferService.cols||u.row<0||u.row>=this._bufferService.rows||u.button===4&&u.action===32||u.button===3&&u.action!==32||u.button!==4&&(u.action===2||u.action===3)||(u.col++,u.row++,u.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,u,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(u))return!1;const w=this._encodings[this._activeEncoding](u);return w&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(w):this._coreService.triggerDataEvent(w,!0)),this._lastEvent=u,!0}explainEvents(u){return{down:!!(1&u),up:!!(2&u),drag:!!(4&u),move:!!(8&u),wheel:!!(16&u)}}_equalEvents(u,w,L){if(L){if(u.x!==w.x||u.y!==w.y)return!1}else if(u.col!==w.col||u.row!==w.row)return!1;return u.button===w.button&&u.action===w.action&&u.ctrl===w.ctrl&&u.alt===w.alt&&u.shift===w.shift}};a.CoreMouseService=d=_([v(0,c.IBufferService),v(1,c.ICoreService)],d)},6975:function(y,a,l){var _=this&&this.__decorate||function(d,u,w,L){var R,D=arguments.length,k=D<3?u:L===null?L=Object.getOwnPropertyDescriptor(u,w):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(d,u,w,L);else for(var M=d.length-1;M>=0;M--)(R=d[M])&&(k=(D<3?R(k):D>3?R(u,w,k):R(u,w))||k);return D>3&&k&&Object.defineProperty(u,w,k),k},v=this&&this.__param||function(d,u){return function(w,L){u(w,L,d)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CoreService=void 0;const c=l(1439),m=l(8460),C=l(844),b=l(2585),x=Object.freeze({insertMode:!1}),f=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let p=a.CoreService=class extends C.Disposable{constructor(d,u,w){super(),this._bufferService=d,this._logService=u,this._optionsService=w,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new m.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new m.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new m.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new m.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,c.clone)(x),this.decPrivateModes=(0,c.clone)(f)}reset(){this.modes=(0,c.clone)(x),this.decPrivateModes=(0,c.clone)(f)}triggerDataEvent(d,u=!1){if(this._optionsService.rawOptions.disableStdin)return;const w=this._bufferService.buffer;u&&this._optionsService.rawOptions.scrollOnUserInput&&w.ybase!==w.ydisp&&this._onRequestScrollToBottom.fire(),u&&this._onUserInput.fire(),this._logService.debug(`sending data "${d}"`,(()=>d.split("").map((L=>L.charCodeAt(0))))),this._onData.fire(d)}triggerBinaryEvent(d){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${d}"`,(()=>d.split("").map((u=>u.charCodeAt(0))))),this._onBinary.fire(d))}};a.CoreService=p=_([v(0,b.IBufferService),v(1,b.ILogService),v(2,b.IOptionsService)],p)},9074:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DecorationService=void 0;const _=l(8055),v=l(8460),c=l(844),m=l(6106);let C=0,b=0;class x extends c.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new m.SortedList((d=>d==null?void 0:d.marker.line)),this._onDecorationRegistered=this.register(new v.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new v.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,c.toDisposable)((()=>this.reset())))}registerDecoration(d){if(d.marker.isDisposed)return;const u=new f(d);if(u){const w=u.marker.onDispose((()=>u.dispose()));u.onDispose((()=>{u&&(this._decorations.delete(u)&&this._onDecorationRemoved.fire(u),w.dispose())})),this._decorations.insert(u),this._onDecorationRegistered.fire(u)}return u}reset(){for(const d of this._decorations.values())d.dispose();this._decorations.clear()}*getDecorationsAtCell(d,u,w){let L=0,R=0;for(const D of this._decorations.getKeyIterator(u))L=D.options.x??0,R=L+(D.options.width??1),d>=L&&d<R&&(!w||(D.options.layer??"bottom")===w)&&(yield D)}forEachDecorationAtCell(d,u,w,L){this._decorations.forEachByKey(u,(R=>{C=R.options.x??0,b=C+(R.options.width??1),d>=C&&d<b&&(!w||(R.options.layer??"bottom")===w)&&L(R)}))}}a.DecorationService=x;class f extends c.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=_.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=_.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(d){super(),this.options=d,this.onRenderEmitter=this.register(new v.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new v.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=d.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.InstantiationService=a.ServiceCollection=void 0;const _=l(2585),v=l(8343);class c{constructor(...C){this._entries=new Map;for(const[b,x]of C)this.set(b,x)}set(C,b){const x=this._entries.get(C);return this._entries.set(C,b),x}forEach(C){for(const[b,x]of this._entries.entries())C(b,x)}has(C){return this._entries.has(C)}get(C){return this._entries.get(C)}}a.ServiceCollection=c,a.InstantiationService=class{constructor(){this._services=new c,this._services.set(_.IInstantiationService,this)}setService(m,C){this._services.set(m,C)}getService(m){return this._services.get(m)}createInstance(m,...C){const b=(0,v.getServiceDependencies)(m).sort(((p,d)=>p.index-d.index)),x=[];for(const p of b){const d=this._services.get(p.id);if(!d)throw new Error(`[createInstance] ${m.name} depends on UNKNOWN service ${p.id}.`);x.push(d)}const f=b.length>0?b[0].index:C.length;if(C.length!==f)throw new Error(`[createInstance] First service dependency of ${m.name} at position ${f+1} conflicts with ${C.length} static arguments`);return new m(...C,...x)}}},7866:function(y,a,l){var _=this&&this.__decorate||function(f,p,d,u){var w,L=arguments.length,R=L<3?p:u===null?u=Object.getOwnPropertyDescriptor(p,d):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(f,p,d,u);else for(var D=f.length-1;D>=0;D--)(w=f[D])&&(R=(L<3?w(R):L>3?w(p,d,R):w(p,d))||R);return L>3&&R&&Object.defineProperty(p,d,R),R},v=this&&this.__param||function(f,p){return function(d,u){p(d,u,f)}};Object.defineProperty(a,"__esModule",{value:!0}),a.traceCall=a.setTraceLogger=a.LogService=void 0;const c=l(844),m=l(2585),C={trace:m.LogLevelEnum.TRACE,debug:m.LogLevelEnum.DEBUG,info:m.LogLevelEnum.INFO,warn:m.LogLevelEnum.WARN,error:m.LogLevelEnum.ERROR,off:m.LogLevelEnum.OFF};let b,x=a.LogService=class extends c.Disposable{get logLevel(){return this._logLevel}constructor(f){super(),this._optionsService=f,this._logLevel=m.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),b=this}_updateLogLevel(){this._logLevel=C[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(f){for(let p=0;p<f.length;p++)typeof f[p]=="function"&&(f[p]=f[p]())}_log(f,p,d){this._evalLazyOptionalParams(d),f.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+p,...d)}trace(f,...p){var d;this._logLevel<=m.LogLevelEnum.TRACE&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.trace.bind(this._optionsService.options.logger))??console.log,f,p)}debug(f,...p){var d;this._logLevel<=m.LogLevelEnum.DEBUG&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.debug.bind(this._optionsService.options.logger))??console.log,f,p)}info(f,...p){var d;this._logLevel<=m.LogLevelEnum.INFO&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.info.bind(this._optionsService.options.logger))??console.info,f,p)}warn(f,...p){var d;this._logLevel<=m.LogLevelEnum.WARN&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.warn.bind(this._optionsService.options.logger))??console.warn,f,p)}error(f,...p){var d;this._logLevel<=m.LogLevelEnum.ERROR&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.error.bind(this._optionsService.options.logger))??console.error,f,p)}};a.LogService=x=_([v(0,m.IOptionsService)],x),a.setTraceLogger=function(f){b=f},a.traceCall=function(f,p,d){if(typeof d.value!="function")throw new Error("not supported");const u=d.value;d.value=function(...w){if(b.logLevel!==m.LogLevelEnum.TRACE)return u.apply(this,w);b.trace(`GlyphRenderer#${u.name}(${w.map((R=>JSON.stringify(R))).join(", ")})`);const L=u.apply(this,w);return b.trace(`GlyphRenderer#${u.name} return`,L),L}}},7302:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.OptionsService=a.DEFAULT_OPTIONS=void 0;const _=l(8460),v=l(844),c=l(6114);a.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:c.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const m=["normal","bold","100","200","300","400","500","600","700","800","900"];class C extends v.Disposable{constructor(x){super(),this._onOptionChange=this.register(new _.EventEmitter),this.onOptionChange=this._onOptionChange.event;const f={...a.DEFAULT_OPTIONS};for(const p in x)if(p in f)try{const d=x[p];f[p]=this._sanitizeAndValidateOption(p,d)}catch(d){console.error(d)}this.rawOptions=f,this.options={...f},this._setupOptions(),this.register((0,v.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(x,f){return this.onOptionChange((p=>{p===x&&f(this.rawOptions[x])}))}onMultipleOptionChange(x,f){return this.onOptionChange((p=>{x.indexOf(p)!==-1&&f()}))}_setupOptions(){const x=p=>{if(!(p in a.DEFAULT_OPTIONS))throw new Error(`No option with key "${p}"`);return this.rawOptions[p]},f=(p,d)=>{if(!(p in a.DEFAULT_OPTIONS))throw new Error(`No option with key "${p}"`);d=this._sanitizeAndValidateOption(p,d),this.rawOptions[p]!==d&&(this.rawOptions[p]=d,this._onOptionChange.fire(p))};for(const p in this.rawOptions){const d={get:x.bind(this,p),set:f.bind(this,p)};Object.defineProperty(this.options,p,d)}}_sanitizeAndValidateOption(x,f){switch(x){case"cursorStyle":if(f||(f=a.DEFAULT_OPTIONS[x]),!(function(p){return p==="block"||p==="underline"||p==="bar"})(f))throw new Error(`"${f}" is not a valid value for ${x}`);break;case"wordSeparator":f||(f=a.DEFAULT_OPTIONS[x]);break;case"fontWeight":case"fontWeightBold":if(typeof f=="number"&&1<=f&&f<=1e3)break;f=m.includes(f)?f:a.DEFAULT_OPTIONS[x];break;case"cursorWidth":f=Math.floor(f);case"lineHeight":case"tabStopWidth":if(f<1)throw new Error(`${x} cannot be less than 1, value: ${f}`);break;case"minimumContrastRatio":f=Math.max(1,Math.min(21,Math.round(10*f)/10));break;case"scrollback":if((f=Math.min(f,4294967295))<0)throw new Error(`${x} cannot be less than 0, value: ${f}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(f<=0)throw new Error(`${x} cannot be less than or equal to 0, value: ${f}`);break;case"rows":case"cols":if(!f&&f!==0)throw new Error(`${x} must be numeric, value: ${f}`);break;case"windowsPty":f=f??{}}return f}}a.OptionsService=C},2660:function(y,a,l){var _=this&&this.__decorate||function(C,b,x,f){var p,d=arguments.length,u=d<3?b:f===null?f=Object.getOwnPropertyDescriptor(b,x):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(C,b,x,f);else for(var w=C.length-1;w>=0;w--)(p=C[w])&&(u=(d<3?p(u):d>3?p(b,x,u):p(b,x))||u);return d>3&&u&&Object.defineProperty(b,x,u),u},v=this&&this.__param||function(C,b){return function(x,f){b(x,f,C)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OscLinkService=void 0;const c=l(2585);let m=a.OscLinkService=class{constructor(C){this._bufferService=C,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(C){const b=this._bufferService.buffer;if(C.id===void 0){const w=b.addMarker(b.ybase+b.y),L={data:C,id:this._nextId++,lines:[w]};return w.onDispose((()=>this._removeMarkerFromLink(L,w))),this._dataByLinkId.set(L.id,L),L.id}const x=C,f=this._getEntryIdKey(x),p=this._entriesWithId.get(f);if(p)return this.addLineToLink(p.id,b.ybase+b.y),p.id;const d=b.addMarker(b.ybase+b.y),u={id:this._nextId++,key:this._getEntryIdKey(x),data:x,lines:[d]};return d.onDispose((()=>this._removeMarkerFromLink(u,d))),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.id}addLineToLink(C,b){const x=this._dataByLinkId.get(C);if(x&&x.lines.every((f=>f.line!==b))){const f=this._bufferService.buffer.addMarker(b);x.lines.push(f),f.onDispose((()=>this._removeMarkerFromLink(x,f)))}}getLinkData(C){var b;return(b=this._dataByLinkId.get(C))==null?void 0:b.data}_getEntryIdKey(C){return`${C.id};;${C.uri}`}_removeMarkerFromLink(C,b){const x=C.lines.indexOf(b);x!==-1&&(C.lines.splice(x,1),C.lines.length===0&&(C.data.id!==void 0&&this._entriesWithId.delete(C.key),this._dataByLinkId.delete(C.id)))}};a.OscLinkService=m=_([v(0,c.IBufferService)],m)},8343:(y,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.createDecorator=a.getServiceDependencies=a.serviceRegistry=void 0;const l="di$target",_="di$dependencies";a.serviceRegistry=new Map,a.getServiceDependencies=function(v){return v[_]||[]},a.createDecorator=function(v){if(a.serviceRegistry.has(v))return a.serviceRegistry.get(v);const c=function(m,C,b){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(x,f,p){f[l]===f?f[_].push({id:x,index:p}):(f[_]=[{id:x,index:p}],f[l]=f)})(c,m,b)};return c.toString=()=>v,a.serviceRegistry.set(v,c),c}},2585:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.IDecorationService=a.IUnicodeService=a.IOscLinkService=a.IOptionsService=a.ILogService=a.LogLevelEnum=a.IInstantiationService=a.ICharsetService=a.ICoreService=a.ICoreMouseService=a.IBufferService=void 0;const _=l(8343);var v;a.IBufferService=(0,_.createDecorator)("BufferService"),a.ICoreMouseService=(0,_.createDecorator)("CoreMouseService"),a.ICoreService=(0,_.createDecorator)("CoreService"),a.ICharsetService=(0,_.createDecorator)("CharsetService"),a.IInstantiationService=(0,_.createDecorator)("InstantiationService"),(function(c){c[c.TRACE=0]="TRACE",c[c.DEBUG=1]="DEBUG",c[c.INFO=2]="INFO",c[c.WARN=3]="WARN",c[c.ERROR=4]="ERROR",c[c.OFF=5]="OFF"})(v||(a.LogLevelEnum=v={})),a.ILogService=(0,_.createDecorator)("LogService"),a.IOptionsService=(0,_.createDecorator)("OptionsService"),a.IOscLinkService=(0,_.createDecorator)("OscLinkService"),a.IUnicodeService=(0,_.createDecorator)("UnicodeService"),a.IDecorationService=(0,_.createDecorator)("DecorationService")},1480:(y,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeService=void 0;const _=l(8460),v=l(225);class c{static extractShouldJoin(C){return(1&C)!=0}static extractWidth(C){return C>>1&3}static extractCharKind(C){return C>>3}static createPropertyValue(C,b,x=!1){return(16777215&C)<<3|(3&b)<<1|(x?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new _.EventEmitter,this.onChange=this._onChange.event;const C=new v.UnicodeV6;this.register(C),this._active=C.version,this._activeProvider=C}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(C){if(!this._providers[C])throw new Error(`unknown Unicode version "${C}"`);this._active=C,this._activeProvider=this._providers[C],this._onChange.fire(C)}register(C){this._providers[C.version]=C}wcwidth(C){return this._activeProvider.wcwidth(C)}getStringCellWidth(C){let b=0,x=0;const f=C.length;for(let p=0;p<f;++p){let d=C.charCodeAt(p);if(55296<=d&&d<=56319){if(++p>=f)return b+this.wcwidth(d);const L=C.charCodeAt(p);56320<=L&&L<=57343?d=1024*(d-55296)+L-56320+65536:b+=this.wcwidth(L)}const u=this.charProperties(d,x);let w=c.extractWidth(u);c.extractShouldJoin(u)&&(w-=c.extractWidth(x)),b+=w,x=u}return b}charProperties(C,b){return this._activeProvider.charProperties(C,b)}}a.UnicodeService=c}},o={};function h(y){var a=o[y];if(a!==void 0)return a.exports;var l=o[y]={exports:{}};return i[y].call(l.exports,l,l.exports,h),l.exports}var S={};return(()=>{var y=S;Object.defineProperty(y,"__esModule",{value:!0}),y.Terminal=void 0;const a=h(9042),l=h(3236),_=h(844),v=h(5741),c=h(8285),m=h(7975),C=h(7090),b=["cols","rows"];class x extends _.Disposable{constructor(p){super(),this._core=this.register(new l.Terminal(p)),this._addonManager=this.register(new v.AddonManager),this._publicOptions={...this._core.options};const d=w=>this._core.options[w],u=(w,L)=>{this._checkReadonlyOptions(w),this._core.options[w]=L};for(const w in this._core.options){const L={get:d.bind(this,w),set:u.bind(this,w)};Object.defineProperty(this._publicOptions,w,L)}}_checkReadonlyOptions(p){if(b.includes(p))throw new Error(`Option "${p}" 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 m.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new C.UnicodeApi(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 c.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const p=this._core.coreService.decPrivateModes;let d="none";switch(this._core.coreMouseService.activeProtocol){case"X10":d="x10";break;case"VT200":d="vt200";break;case"DRAG":d="drag";break;case"ANY":d="any"}return{applicationCursorKeysMode:p.applicationCursorKeys,applicationKeypadMode:p.applicationKeypad,bracketedPasteMode:p.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:d,originMode:p.origin,reverseWraparoundMode:p.reverseWraparound,sendFocusMode:p.sendFocus,wraparoundMode:p.wraparound}}get options(){return this._publicOptions}set options(p){for(const d in p)this._publicOptions[d]=p[d]}blur(){this._core.blur()}focus(){this._core.focus()}input(p,d=!0){this._core.input(p,d)}resize(p,d){this._verifyIntegers(p,d),this._core.resize(p,d)}open(p){this._core.open(p)}attachCustomKeyEventHandler(p){this._core.attachCustomKeyEventHandler(p)}attachCustomWheelEventHandler(p){this._core.attachCustomWheelEventHandler(p)}registerLinkProvider(p){return this._core.registerLinkProvider(p)}registerCharacterJoiner(p){return this._checkProposedApi(),this._core.registerCharacterJoiner(p)}deregisterCharacterJoiner(p){this._checkProposedApi(),this._core.deregisterCharacterJoiner(p)}registerMarker(p=0){return this._verifyIntegers(p),this._core.registerMarker(p)}registerDecoration(p){return this._checkProposedApi(),this._verifyPositiveIntegers(p.x??0,p.width??0,p.height??0),this._core.registerDecoration(p)}hasSelection(){return this._core.hasSelection()}select(p,d,u){this._verifyIntegers(p,d,u),this._core.select(p,d,u)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(p,d){this._verifyIntegers(p,d),this._core.selectLines(p,d)}dispose(){super.dispose()}scrollLines(p){this._verifyIntegers(p),this._core.scrollLines(p)}scrollPages(p){this._verifyIntegers(p),this._core.scrollPages(p)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(p){this._verifyIntegers(p),this._core.scrollToLine(p)}clear(){this._core.clear()}write(p,d){this._core.write(p,d)}writeln(p,d){this._core.write(p),this._core.write(`\r
70
70
  `,d)}paste(p){this._core.paste(p)}refresh(p,d){this._verifyIntegers(p,d),this._core.refresh(p,d)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(p){this._addonManager.loadAddon(this,p)}static get strings(){return a}_verifyIntegers(...p){for(const d of p)if(d===1/0||isNaN(d)||d%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...p){for(const d of p)if(d&&(d===1/0||isNaN(d)||d%1!=0||d<0))throw new Error("This API only accepts positive integers")}}y.Terminal=x})(),S})()))})(su)),su.exports}var rm=ab(),ou={exports:{}},Zp;function lb(){return Zp||(Zp=1,(function(e,r){(function(i,o){e.exports=o()})(self,(()=>(()=>{var i={};return(()=>{var o=i;Object.defineProperty(o,"__esModule",{value:!0}),o.FitAddon=void 0,o.FitAddon=class{activate(h){this._terminal=h}dispose(){}fit(){const h=this.proposeDimensions();if(!h||!this._terminal||isNaN(h.cols)||isNaN(h.rows))return;const S=this._terminal._core;this._terminal.rows===h.rows&&this._terminal.cols===h.cols||(S._renderService.clear(),this._terminal.resize(h.cols,h.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const h=this._terminal._core,S=h._renderService.dimensions;if(S.css.cell.width===0||S.css.cell.height===0)return;const y=this._terminal.options.scrollback===0?0:h.viewport.scrollBarWidth,a=window.getComputedStyle(this._terminal.element.parentElement),l=parseInt(a.getPropertyValue("height")),_=Math.max(0,parseInt(a.getPropertyValue("width"))),v=window.getComputedStyle(this._terminal.element),c=l-(parseInt(v.getPropertyValue("padding-top"))+parseInt(v.getPropertyValue("padding-bottom"))),m=_-(parseInt(v.getPropertyValue("padding-right"))+parseInt(v.getPropertyValue("padding-left")))-y;return{cols:Math.max(2,Math.floor(m/S.css.cell.width)),rows:Math.max(1,Math.floor(c/S.css.cell.height))}}}})(),i})()))})(ou)),ou.exports}var nm=lb();/**
71
71
  * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
@@ -82,7 +82,7 @@ WARNING: This link could potentially be dangerous`)){const p=window.open();if(p)
82
82
 
83
83
  `+e.stack):new Error(e.message+`
84
84
 
85
- `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(r=>{r(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)}},fb=new db;function lu(e){pb(e)||fb.onUnexpectedError(e)}var Pu="Canceled";function pb(e){return e instanceof _b?!0:e instanceof Error&&e.name===Pu&&e.message===Pu}var _b=class extends Error{constructor(){super(Pu),this.name=this.message}},e_=class Nu extends Error{constructor(r){super(r),this.name="CodeExpectedError"}static fromError(r){if(r instanceof Nu)return r;let i=new Nu;return i.message=r.message,i.stack=r.stack,i}static isErrorNoTelemetry(r){return r.name==="CodeExpectedError"}};function gb(e,r){let i=this,o=!1,h;return function(){return o||(o=!0,r||(h=e.apply(i,arguments))),h}}var mb;(e=>{function r(S){return S<0}e.isLessThan=r;function i(S){return S<=0}e.isLessThanOrEqual=i;function o(S){return S>0}e.isGreaterThan=o;function h(S){return S===0}e.isNeitherLessOrGreaterThan=h,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(mb||(mb={}));var im;(e=>{function r(w){return w&&typeof w=="object"&&typeof w[Symbol.iterator]=="function"}e.is=r;let i=Object.freeze([]);function o(){return i}e.empty=o;function*h(w){yield w}e.single=h;function S(w){return r(w)?w:h(w)}e.wrap=S;function y(w){return w||i}e.from=y;function*a(w){for(let L=w.length-1;L>=0;L--)yield w[L]}e.reverse=a;function l(w){return!w||w[Symbol.iterator]().next().done===!0}e.isEmpty=l;function _(w){return w[Symbol.iterator]().next().value}e.first=_;function v(w,L){let R=0;for(let D of w)if(L(D,R++))return!0;return!1}e.some=v;function c(w,L){for(let R of w)if(L(R))return R}e.find=c;function*m(w,L){for(let R of w)L(R)&&(yield R)}e.filter=m;function*C(w,L){let R=0;for(let D of w)yield L(D,R++)}e.map=C;function*b(w,L){let R=0;for(let D of w)yield*L(D,R++)}e.flatMap=b;function*x(...w){for(let L of w)yield*L}e.concat=x;function f(w,L,R){let D=R;for(let k of w)D=L(D,k);return D}e.reduce=f;function*p(w,L,R=w.length){for(L<0&&(L+=w.length),R<0?R+=w.length:R>w.length&&(R=w.length);L<R;L++)yield w[L]}e.slice=p;function d(w,L=Number.POSITIVE_INFINITY){let R=[];if(L===0)return[R,w];let D=w[Symbol.iterator]();for(let k=0;k<L;k++){let M=D.next();if(M.done)return[R,e.empty()];R.push(M.value)}return[R,{[Symbol.iterator](){return D}}]}e.consume=d;async function u(w){let L=[];for await(let R of w)L.push(R);return Promise.resolve(L)}e.asyncToArray=u})(im||(im={}));function sm(e){if(im.is(e)){let r=[];for(let i of e)if(i)try{i.dispose()}catch(o){r.push(o)}if(r.length===1)throw r[0];if(r.length>1)throw new AggregateError(r,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function vb(...e){return om(()=>sm(e))}function om(e){return{dispose:gb(()=>{e()})}}var am=class lm{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{sm(this._toDispose)}finally{this._toDispose.clear()}}add(r){if(!r)return r;if(r===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?lm.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(r),r}delete(r){if(r){if(r===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(r),r.dispose()}}deleteAndLeak(r){r&&this._toDispose.has(r)&&(this._toDispose.delete(r),void 0)}};am.DISABLE_DISPOSED_WARNING=!1;var lh=am,Ta=class{constructor(){this._store=new lh,this._store}dispose(){this._store.dispose()}_register(r){if(r===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(r)}};Ta.None=Object.freeze({dispose(){}});var yb=globalThis.performance&&typeof globalThis.performance.now=="function",wb=class cm{static create(r){return new cm(r)}constructor(r){this._now=yb&&r===!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}},Sb;(e=>{e.None=()=>Ta.None;function r(j,N){return c(j,()=>{},0,void 0,!0,void 0,N)}e.defer=r;function i(j){return(N,I=null,q)=>{let U=!1,K;return K=j(V=>{if(!U)return K?K.dispose():U=!0,N.call(I,V)},null,q),U&&K.dispose(),K}}e.once=i;function o(j,N,I){return _((q,U=null,K)=>j(V=>q.call(U,N(V)),null,K),I)}e.map=o;function h(j,N,I){return _((q,U=null,K)=>j(V=>{N(V),q.call(U,V)},null,K),I)}e.forEach=h;function S(j,N,I){return _((q,U=null,K)=>j(V=>N(V)&&q.call(U,V),null,K),I)}e.filter=S;function y(j){return j}e.signal=y;function a(...j){return(N,I=null,q)=>{let U=vb(...j.map(K=>K(V=>N.call(I,V))));return v(U,q)}}e.any=a;function l(j,N,I,q){let U=I;return o(j,K=>(U=N(U,K),U),q)}e.reduce=l;function _(j,N){let I,q={onWillAddFirstListener(){I=j(U.fire,U)},onDidRemoveLastListener(){I==null||I.dispose()}},U=new Jr(q);return N==null||N.add(U),U.event}function v(j,N){return N instanceof Array?N.push(j):N&&N.add(j),j}function c(j,N,I=100,q=!1,U=!1,K,V){let T,B,P,F=0,G,Z={leakWarningThreshold:K,onWillAddFirstListener(){T=j(ae=>{F++,B=N(B,ae),q&&!P&&(ie.fire(B),B=void 0),G=()=>{let X=B;B=void 0,P=void 0,(!q||F>1)&&ie.fire(X),F=0},typeof I=="number"?(clearTimeout(P),P=setTimeout(G,I)):P===void 0&&(P=0,queueMicrotask(G))})},onWillRemoveListener(){U&&F>0&&(G==null||G())},onDidRemoveLastListener(){G=void 0,T.dispose()}},ie=new Jr(Z);return V==null||V.add(ie),ie.event}e.debounce=c;function m(j,N=0,I){return e.debounce(j,(q,U)=>q?(q.push(U),q):[U],N,void 0,!0,void 0,I)}e.accumulate=m;function C(j,N=(q,U)=>q===U,I){let q=!0,U;return S(j,K=>{let V=q||!N(K,U);return q=!1,U=K,V},I)}e.latch=C;function b(j,N,I){return[e.filter(j,N,I),e.filter(j,q=>!N(q),I)]}e.split=b;function x(j,N=!1,I=[],q){let U=I.slice(),K=j(B=>{U?U.push(B):T.fire(B)});q&&q.add(K);let V=()=>{U==null||U.forEach(B=>T.fire(B)),U=null},T=new Jr({onWillAddFirstListener(){K||(K=j(B=>T.fire(B)),q&&q.add(K))},onDidAddFirstListener(){U&&(N?setTimeout(V):V())},onDidRemoveLastListener(){K&&K.dispose(),K=null}});return q&&q.add(T),T.event}e.buffer=x;function f(j,N){return(I,q,U)=>{let K=N(new d);return j(function(V){let T=K.evaluate(V);T!==p&&I.call(q,T)},void 0,U)}}e.chain=f;let p=Symbol("HaltChainable");class d{constructor(){this.steps=[]}map(N){return this.steps.push(N),this}forEach(N){return this.steps.push(I=>(N(I),I)),this}filter(N){return this.steps.push(I=>N(I)?I:p),this}reduce(N,I){let q=I;return this.steps.push(U=>(q=N(q,U),q)),this}latch(N=(I,q)=>I===q){let I=!0,q;return this.steps.push(U=>{let K=I||!N(U,q);return I=!1,q=U,K?U:p}),this}evaluate(N){for(let I of this.steps)if(N=I(N),N===p)break;return N}}function u(j,N,I=q=>q){let q=(...T)=>V.fire(I(...T)),U=()=>j.on(N,q),K=()=>j.removeListener(N,q),V=new Jr({onWillAddFirstListener:U,onDidRemoveLastListener:K});return V.event}e.fromNodeEventEmitter=u;function w(j,N,I=q=>q){let q=(...T)=>V.fire(I(...T)),U=()=>j.addEventListener(N,q),K=()=>j.removeEventListener(N,q),V=new Jr({onWillAddFirstListener:U,onDidRemoveLastListener:K});return V.event}e.fromDOMEventEmitter=w;function L(j){return new Promise(N=>i(j)(N))}e.toPromise=L;function R(j){let N=new Jr;return j.then(I=>{N.fire(I)},()=>{N.fire(void 0)}).finally(()=>{N.dispose()}),N.event}e.fromPromise=R;function D(j,N){return j(I=>N.fire(I))}e.forward=D;function k(j,N,I){return N(I),j(q=>N(q))}e.runAndSubscribe=k;class M{constructor(N,I){this._observable=N,this._counter=0,this._hasChanged=!1;let q={onWillAddFirstListener:()=>{N.addObserver(this)},onDidRemoveLastListener:()=>{N.removeObserver(this)}};this.emitter=new Jr(q),I&&I.add(this.emitter)}beginUpdate(N){this._counter++}handlePossibleChange(N){}handleChange(N,I){this._hasChanged=!0}endUpdate(N){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function W(j,N){return new M(j,N).emitter.event}e.fromObservable=W;function z(j){return(N,I,q)=>{let U=0,K=!1,V={beginUpdate(){U++},endUpdate(){U--,U===0&&(j.reportChanges(),K&&(K=!1,N.call(I)))},handlePossibleChange(){},handleChange(){K=!0}};j.addObserver(V),j.reportChanges();let T={dispose(){j.removeObserver(V)}};return q instanceof lh?q.add(T):Array.isArray(q)&&q.push(T),T}}e.fromObservableLight=z})(Sb||(Sb={}));var Bu=class Iu{constructor(r){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${r}_${Iu._idPool++}`,Iu.all.add(this)}start(r){this._stopWatch=new wb,this.listenerCount=r}stop(){if(this._stopWatch){let r=this._stopWatch.elapsed();this.durations.push(r),this.elapsedOverall+=r,this.invocationCount+=1,this._stopWatch=void 0}}};Bu.all=new Set,Bu._idPool=0;var Cb=Bu,xb=-1,um=class hm{constructor(r,i,o=(hm._idPool++).toString(16).padStart(3,"0")){this._errorHandler=r,this.threshold=i,this.name=o,this._warnCountdown=0}dispose(){var r;(r=this._stacks)==null||r.clear()}check(r,i){let o=this.threshold;if(o<=0||i<o)return;this._stacks||(this._stacks=new Map);let h=this._stacks.get(r.value)||0;if(this._stacks.set(r.value,h+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=o*.5;let[S,y]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${y}):`;console.warn(a),console.warn(S);let l=new kb(a,S);this._errorHandler(l)}return()=>{let S=this._stacks.get(r.value)||0;this._stacks.set(r.value,S-1)}}getMostFrequentStack(){if(!this._stacks)return;let r,i=0;for(let[o,h]of this._stacks)(!r||i<h)&&(r=[o,h],i=h);return r}};um._idPool=1;var bb=um,Eb=class dm{constructor(r){this.value=r}static create(){let r=new Error;return new dm(r.stack??"")}print(){console.warn(this.value.split(`
85
+ `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(r=>{r(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)}},fb=new db;function lu(e){pb(e)||fb.onUnexpectedError(e)}var Pu="Canceled";function pb(e){return e instanceof _b?!0:e instanceof Error&&e.name===Pu&&e.message===Pu}var _b=class extends Error{constructor(){super(Pu),this.name=this.message}},e_=class Nu extends Error{constructor(r){super(r),this.name="CodeExpectedError"}static fromError(r){if(r instanceof Nu)return r;let i=new Nu;return i.message=r.message,i.stack=r.stack,i}static isErrorNoTelemetry(r){return r.name==="CodeExpectedError"}};function gb(e,r){let i=this,o=!1,h;return function(){return o||(o=!0,r||(h=e.apply(i,arguments))),h}}var mb;(e=>{function r(S){return S<0}e.isLessThan=r;function i(S){return S<=0}e.isLessThanOrEqual=i;function o(S){return S>0}e.isGreaterThan=o;function h(S){return S===0}e.isNeitherLessOrGreaterThan=h,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(mb||(mb={}));var im;(e=>{function r(w){return w&&typeof w=="object"&&typeof w[Symbol.iterator]=="function"}e.is=r;let i=Object.freeze([]);function o(){return i}e.empty=o;function*h(w){yield w}e.single=h;function S(w){return r(w)?w:h(w)}e.wrap=S;function y(w){return w||i}e.from=y;function*a(w){for(let L=w.length-1;L>=0;L--)yield w[L]}e.reverse=a;function l(w){return!w||w[Symbol.iterator]().next().done===!0}e.isEmpty=l;function _(w){return w[Symbol.iterator]().next().value}e.first=_;function v(w,L){let R=0;for(let D of w)if(L(D,R++))return!0;return!1}e.some=v;function c(w,L){for(let R of w)if(L(R))return R}e.find=c;function*m(w,L){for(let R of w)L(R)&&(yield R)}e.filter=m;function*C(w,L){let R=0;for(let D of w)yield L(D,R++)}e.map=C;function*b(w,L){let R=0;for(let D of w)yield*L(D,R++)}e.flatMap=b;function*x(...w){for(let L of w)yield*L}e.concat=x;function f(w,L,R){let D=R;for(let k of w)D=L(D,k);return D}e.reduce=f;function*p(w,L,R=w.length){for(L<0&&(L+=w.length),R<0?R+=w.length:R>w.length&&(R=w.length);L<R;L++)yield w[L]}e.slice=p;function d(w,L=Number.POSITIVE_INFINITY){let R=[];if(L===0)return[R,w];let D=w[Symbol.iterator]();for(let k=0;k<L;k++){let M=D.next();if(M.done)return[R,e.empty()];R.push(M.value)}return[R,{[Symbol.iterator](){return D}}]}e.consume=d;async function u(w){let L=[];for await(let R of w)L.push(R);return Promise.resolve(L)}e.asyncToArray=u})(im||(im={}));function sm(e){if(im.is(e)){let r=[];for(let i of e)if(i)try{i.dispose()}catch(o){r.push(o)}if(r.length===1)throw r[0];if(r.length>1)throw new AggregateError(r,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function vb(...e){return om(()=>sm(e))}function om(e){return{dispose:gb(()=>{e()})}}var am=class lm{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{sm(this._toDispose)}finally{this._toDispose.clear()}}add(r){if(!r)return r;if(r===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?lm.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(r),r}delete(r){if(r){if(r===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(r),r.dispose()}}deleteAndLeak(r){r&&this._toDispose.has(r)&&(this._toDispose.delete(r),void 0)}};am.DISABLE_DISPOSED_WARNING=!1;var lh=am,Ta=class{constructor(){this._store=new lh,this._store}dispose(){this._store.dispose()}_register(r){if(r===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(r)}};Ta.None=Object.freeze({dispose(){}});var yb=globalThis.performance&&typeof globalThis.performance.now=="function",wb=class cm{static create(r){return new cm(r)}constructor(r){this._now=yb&&r===!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}},Sb;(e=>{e.None=()=>Ta.None;function r(j,N){return c(j,()=>{},0,void 0,!0,void 0,N)}e.defer=r;function i(j){return(N,I=null,q)=>{let U=!1,K;return K=j(V=>{if(!U)return K?K.dispose():U=!0,N.call(I,V)},null,q),U&&K.dispose(),K}}e.once=i;function o(j,N,I){return _((q,U=null,K)=>j(V=>q.call(U,N(V)),null,K),I)}e.map=o;function h(j,N,I){return _((q,U=null,K)=>j(V=>{N(V),q.call(U,V)},null,K),I)}e.forEach=h;function S(j,N,I){return _((q,U=null,K)=>j(V=>N(V)&&q.call(U,V),null,K),I)}e.filter=S;function y(j){return j}e.signal=y;function a(...j){return(N,I=null,q)=>{let U=vb(...j.map(K=>K(V=>N.call(I,V))));return v(U,q)}}e.any=a;function l(j,N,I,q){let U=I;return o(j,K=>(U=N(U,K),U),q)}e.reduce=l;function _(j,N){let I,q={onWillAddFirstListener(){I=j(U.fire,U)},onDidRemoveLastListener(){I==null||I.dispose()}},U=new Jr(q);return N==null||N.add(U),U.event}function v(j,N){return N instanceof Array?N.push(j):N&&N.add(j),j}function c(j,N,I=100,q=!1,U=!1,K,V){let T,B,P,F=0,Y,Z={leakWarningThreshold:K,onWillAddFirstListener(){T=j(ae=>{F++,B=N(B,ae),q&&!P&&(ie.fire(B),B=void 0),Y=()=>{let X=B;B=void 0,P=void 0,(!q||F>1)&&ie.fire(X),F=0},typeof I=="number"?(clearTimeout(P),P=setTimeout(Y,I)):P===void 0&&(P=0,queueMicrotask(Y))})},onWillRemoveListener(){U&&F>0&&(Y==null||Y())},onDidRemoveLastListener(){Y=void 0,T.dispose()}},ie=new Jr(Z);return V==null||V.add(ie),ie.event}e.debounce=c;function m(j,N=0,I){return e.debounce(j,(q,U)=>q?(q.push(U),q):[U],N,void 0,!0,void 0,I)}e.accumulate=m;function C(j,N=(q,U)=>q===U,I){let q=!0,U;return S(j,K=>{let V=q||!N(K,U);return q=!1,U=K,V},I)}e.latch=C;function b(j,N,I){return[e.filter(j,N,I),e.filter(j,q=>!N(q),I)]}e.split=b;function x(j,N=!1,I=[],q){let U=I.slice(),K=j(B=>{U?U.push(B):T.fire(B)});q&&q.add(K);let V=()=>{U==null||U.forEach(B=>T.fire(B)),U=null},T=new Jr({onWillAddFirstListener(){K||(K=j(B=>T.fire(B)),q&&q.add(K))},onDidAddFirstListener(){U&&(N?setTimeout(V):V())},onDidRemoveLastListener(){K&&K.dispose(),K=null}});return q&&q.add(T),T.event}e.buffer=x;function f(j,N){return(I,q,U)=>{let K=N(new d);return j(function(V){let T=K.evaluate(V);T!==p&&I.call(q,T)},void 0,U)}}e.chain=f;let p=Symbol("HaltChainable");class d{constructor(){this.steps=[]}map(N){return this.steps.push(N),this}forEach(N){return this.steps.push(I=>(N(I),I)),this}filter(N){return this.steps.push(I=>N(I)?I:p),this}reduce(N,I){let q=I;return this.steps.push(U=>(q=N(q,U),q)),this}latch(N=(I,q)=>I===q){let I=!0,q;return this.steps.push(U=>{let K=I||!N(U,q);return I=!1,q=U,K?U:p}),this}evaluate(N){for(let I of this.steps)if(N=I(N),N===p)break;return N}}function u(j,N,I=q=>q){let q=(...T)=>V.fire(I(...T)),U=()=>j.on(N,q),K=()=>j.removeListener(N,q),V=new Jr({onWillAddFirstListener:U,onDidRemoveLastListener:K});return V.event}e.fromNodeEventEmitter=u;function w(j,N,I=q=>q){let q=(...T)=>V.fire(I(...T)),U=()=>j.addEventListener(N,q),K=()=>j.removeEventListener(N,q),V=new Jr({onWillAddFirstListener:U,onDidRemoveLastListener:K});return V.event}e.fromDOMEventEmitter=w;function L(j){return new Promise(N=>i(j)(N))}e.toPromise=L;function R(j){let N=new Jr;return j.then(I=>{N.fire(I)},()=>{N.fire(void 0)}).finally(()=>{N.dispose()}),N.event}e.fromPromise=R;function D(j,N){return j(I=>N.fire(I))}e.forward=D;function k(j,N,I){return N(I),j(q=>N(q))}e.runAndSubscribe=k;class M{constructor(N,I){this._observable=N,this._counter=0,this._hasChanged=!1;let q={onWillAddFirstListener:()=>{N.addObserver(this)},onDidRemoveLastListener:()=>{N.removeObserver(this)}};this.emitter=new Jr(q),I&&I.add(this.emitter)}beginUpdate(N){this._counter++}handlePossibleChange(N){}handleChange(N,I){this._hasChanged=!0}endUpdate(N){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function W(j,N){return new M(j,N).emitter.event}e.fromObservable=W;function z(j){return(N,I,q)=>{let U=0,K=!1,V={beginUpdate(){U++},endUpdate(){U--,U===0&&(j.reportChanges(),K&&(K=!1,N.call(I)))},handlePossibleChange(){},handleChange(){K=!0}};j.addObserver(V),j.reportChanges();let T={dispose(){j.removeObserver(V)}};return q instanceof lh?q.add(T):Array.isArray(q)&&q.push(T),T}}e.fromObservableLight=z})(Sb||(Sb={}));var Bu=class Iu{constructor(r){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${r}_${Iu._idPool++}`,Iu.all.add(this)}start(r){this._stopWatch=new wb,this.listenerCount=r}stop(){if(this._stopWatch){let r=this._stopWatch.elapsed();this.durations.push(r),this.elapsedOverall+=r,this.invocationCount+=1,this._stopWatch=void 0}}};Bu.all=new Set,Bu._idPool=0;var Cb=Bu,xb=-1,um=class hm{constructor(r,i,o=(hm._idPool++).toString(16).padStart(3,"0")){this._errorHandler=r,this.threshold=i,this.name=o,this._warnCountdown=0}dispose(){var r;(r=this._stacks)==null||r.clear()}check(r,i){let o=this.threshold;if(o<=0||i<o)return;this._stacks||(this._stacks=new Map);let h=this._stacks.get(r.value)||0;if(this._stacks.set(r.value,h+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=o*.5;let[S,y]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${y}):`;console.warn(a),console.warn(S);let l=new kb(a,S);this._errorHandler(l)}return()=>{let S=this._stacks.get(r.value)||0;this._stacks.set(r.value,S-1)}}getMostFrequentStack(){if(!this._stacks)return;let r,i=0;for(let[o,h]of this._stacks)(!r||i<h)&&(r=[o,h],i=h);return r}};um._idPool=1;var bb=um,Eb=class dm{constructor(r){this.value=r}static create(){let r=new Error;return new dm(r.stack??"")}print(){console.warn(this.value.split(`
86
86
  `).slice(2).join(`
87
87
  `))}},kb=class extends Error{constructor(e,r){super(e),this.name="ListenerLeakError",this.stack=r}},Lb=class extends Error{constructor(e,r){super(e),this.name="ListenerRefusalError",this.stack=r}},Rb=0,cu=class{constructor(e){this.value=e,this.id=Rb++}},Db=2,Ab,Jr=class{constructor(e){var r,i,o,h;this._size=0,this._options=e,this._leakageMon=(r=this._options)!=null&&r.leakWarningThreshold?new bb((e==null?void 0:e.onListenerError)??lu,((i=this._options)==null?void 0:i.leakWarningThreshold)??xb):void 0,this._perfMon=(o=this._options)!=null&&o._profName?new Cb(this._options._profName):void 0,this._deliveryQueue=(h=this._options)==null?void 0:h.deliveryQueue}dispose(){var e,r,i,o;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(i=(r=this._options)==null?void 0:r.onDidRemoveLastListener)==null||i.call(r),(o=this._leakageMon)==null||o.dispose())}get event(){return this._event??(this._event=(e,r,i)=>{var y,a,l,_,v;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let c=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(c);let m=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],C=new Lb(`${c}. HINT: Stack shows most frequent listener (${m[1]}-times)`,m[0]);return(((y=this._options)==null?void 0:y.onListenerError)||lu)(C),Ta.None}if(this._disposed)return Ta.None;r&&(e=e.bind(r));let o=new cu(e),h;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(o.stack=Eb.create(),h=this._leakageMon.check(o.stack,this._size+1)),this._listeners?this._listeners instanceof cu?(this._deliveryQueue??(this._deliveryQueue=new Tb),this._listeners=[this._listeners,o]):this._listeners.push(o):((l=(a=this._options)==null?void 0:a.onWillAddFirstListener)==null||l.call(a,this),this._listeners=o,(v=(_=this._options)==null?void 0:_.onDidAddFirstListener)==null||v.call(_,this)),this._size++;let S=om(()=>{h==null||h(),this._removeListener(o)});return i instanceof lh?i.add(S):Array.isArray(i)&&i.push(S),S}),this._event}_removeListener(e){var h,S,y,a;if((S=(h=this._options)==null?void 0:h.onWillRemoveListener)==null||S.call(h,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(a=(y=this._options)==null?void 0:y.onDidRemoveLastListener)==null||a.call(y,this),this._size=0;return}let r=this._listeners,i=r.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,r[i]=void 0;let o=this._deliveryQueue.current===this;if(this._size*Db<=r.length){let l=0;for(let _=0;_<r.length;_++)r[_]?r[l++]=r[_]:o&&(this._deliveryQueue.end--,l<this._deliveryQueue.i&&this._deliveryQueue.i--);r.length=l}}_deliver(e,r){var o;if(!e)return;let i=((o=this._options)==null?void 0:o.onListenerError)||lu;if(!i){e.value(r);return}try{e.value(r)}catch(h){i(h)}}_deliverQueue(e){let r=e.current._listeners;for(;e.i<e.end;)this._deliver(r[e.i++],e.value);e.reset()}fire(e){var r,i,o,h;if((r=this._deliveryQueue)!=null&&r.current&&(this._deliverQueue(this._deliveryQueue),(i=this._perfMon)==null||i.stop()),(o=this._perfMon)==null||o.start(this._size),this._listeners)if(this._listeners instanceof cu)this._deliver(this._listeners,e);else{let S=this._deliveryQueue;S.enqueue(this,e,this._listeners.length),this._deliverQueue(S)}(h=this._perfMon)==null||h.stop()}hasListeners(){return this._size>0}},Tb=class{constructor(){this.i=-1,this.end=0}enqueue(e,r,i){this.i=0,this.end=i,this.current=e,this.value=r}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Ma=class va{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Jr,this.onChange=this._onChange.event;let r=new hb;this.register(r),this._active=r.version,this._activeProvider=r}static extractShouldJoin(r){return(r&1)!==0}static extractWidth(r){return r>>1&3}static extractCharKind(r){return r>>3}static createPropertyValue(r,i,o=!1){return(r&16777215)<<3|(i&3)<<1|(o?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(r){if(!this._providers[r])throw new Error(`unknown Unicode version "${r}"`);this._active=r,this._activeProvider=this._providers[r],this._onChange.fire(r)}register(r){this._providers[r.version]=r}wcwidth(r){return this._activeProvider.wcwidth(r)}getStringCellWidth(r){let i=0,o=0,h=r.length;for(let S=0;S<h;++S){let y=r.charCodeAt(S);if(55296<=y&&y<=56319){if(++S>=h)return i+this.wcwidth(y);let _=r.charCodeAt(S);56320<=_&&_<=57343?y=(y-55296)*1024+_-56320+65536:i+=this.wcwidth(_)}let a=this.charProperties(y,o),l=va.extractWidth(a);va.extractShouldJoin(a)&&(l-=va.extractWidth(o)),i+=l,o=a}return i}charProperties(r,i){return this._activeProvider.charProperties(r,i)}},uu=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],Mb=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],hu=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],Pb=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]],br;function t_(e,r){let i=0,o=r.length-1,h;if(e<r[0][0]||e>r[o][1])return!1;for(;o>=i;)if(h=i+o>>1,e>r[h][1])i=h+1;else if(e<r[h][0])o=h-1;else return!0;return!1}var Nb=class{constructor(){if(this.version="11",!br){br=new Uint8Array(65536),br.fill(1),br[0]=0,br.fill(0,1,32),br.fill(0,127,160);for(let e=0;e<uu.length;++e)br.fill(0,uu[e][0],uu[e][1]+1);for(let e=0;e<hu.length;++e)br.fill(2,hu[e][0],hu[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?br[e]:t_(e,Mb)?0:t_(e,Pb)?2:1}charProperties(e,r){let i=this.wcwidth(e),o=i===0&&r!==0;if(o){let h=Ma.extractWidth(r);h===0?o=!1:h>i&&(i=h)}return Ma.createPropertyValue(0,i,o)}},fm=class{activate(e){e.unicode.register(new Nb)}dispose(){}};/**
88
88
  * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
@@ -95,15 +95,17 @@ WARNING: This link could potentially be dangerous`)){const p=window.open();if(p)
95
95
  * Fabrice Bellard's javascript vt100 for jslinux:
96
96
  * http://bellard.org/jslinux/
97
97
  * Copyright (c) 2011 Fabrice Bellard
98
- */var Bb=class{constructor(e,r,i,o={}){this._terminal=e,this._regex=r,this._handler=i,this._options=o}provideLinks(e,r){let i=Ob.computeLink(e,this._regex,this._terminal,this._handler);r(this._addCallbacks(i))}_addCallbacks(e){return e.map(r=>(r.leave=this._options.leave,r.hover=(i,o)=>{if(this._options.hover){let{range:h}=r;this._options.hover(i,o,h)}},r))}};function Ib(e){try{let r=new URL(e),i=r.password&&r.username?`${r.protocol}//${r.username}:${r.password}@${r.host}`:r.username?`${r.protocol}//${r.username}@${r.host}`:`${r.protocol}//${r.host}`;return e.toLocaleLowerCase().startsWith(i.toLocaleLowerCase())}catch{return!1}}var Ob=class ya{static computeLink(r,i,o,h){let S=new RegExp(i.source,(i.flags||"")+"g"),[y,a]=ya._getWindowedLineStrings(r-1,o),l=y.join(""),_,v=[];for(;_=S.exec(l);){let c=_[0];if(!Ib(c))continue;let[m,C]=ya._mapStrIdx(o,a,0,_.index),[b,x]=ya._mapStrIdx(o,m,C,c.length);if(m===-1||C===-1||b===-1||x===-1)continue;let f={start:{x:C+1,y:m+1},end:{x,y:b+1}};v.push({range:f,text:c,activate:h})}return v}static _getWindowedLineStrings(r,i){let o,h=r,S=r,y=0,a="",l=[];if(o=i.buffer.active.getLine(r)){let _=o.translateToString(!0);if(o.isWrapped&&_[0]!==" "){for(y=0;(o=i.buffer.active.getLine(--h))&&y<2048&&(a=o.translateToString(!0),y+=a.length,l.push(a),!(!o.isWrapped||a.indexOf(" ")!==-1)););l.reverse()}for(l.push(_),y=0;(o=i.buffer.active.getLine(++S))&&o.isWrapped&&y<2048&&(a=o.translateToString(!0),y+=a.length,l.push(a),a.indexOf(" ")===-1););}return[l,h]}static _mapStrIdx(r,i,o,h){let S=r.buffer.active,y=S.getNullCell(),a=o;for(;h;){let l=S.getLine(i);if(!l)return[-1,-1];for(let _=a;_<l.length;++_){l.getCell(_,y);let v=y.getChars();if(y.getWidth()&&(h-=v.length||1,_===l.length-1&&v==="")){let c=S.getLine(i+1);c&&c.isWrapped&&(c.getCell(0,y),y.getWidth()===2&&(h+=1))}if(h<0)return[i,_]}i++,a=0}return[i,a]}},Hb=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function Fb(e,r){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=r}else console.warn("Opening link blocked as opener could not be cleared")}var pm=class{constructor(e=Fb,r={}){this._handler=e,this._options=r}activate(e){this._terminal=e;let r=this._options,i=r.urlRegex||Hb;this._linkProvider=this._terminal.registerLinkProvider(new Bb(this._terminal,i,this._handler,r))}dispose(){var e;(e=this._linkProvider)==null||e.dispose()}};async function jb(e){try{const r=await e.arrayBuffer(),i=new Uint8Array(r);let o="";const h=8192;for(let l=0;l<i.length;l+=h)o+=String.fromCharCode(...i.subarray(l,l+h));const S=btoa(o);return(await(await fetch("/api/upload-image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:S,mimeType:e.type})})).json()).path||null}catch{return null}}function zb({agent:e,socket:r}){const i=J.useRef(null),o=J.useRef(null),h=J.useRef(null),S=J.useRef(null),y=J.useRef(!1),a=()=>{if(o.current||!i.current||y.current)return;y.current=!0;const _=new rm.Terminal({theme:{background:"#000000",foreground:"#b0b0b0",cursor:"#e8e8e8",cursorAccent:"#000000",selectionBackground:"rgba(255, 255, 255, 0.1)",selectionForeground:"#e8e8e8",black:"#0a0a0a",red:"#f87171",green:"#4ade80",yellow:"#fbbf24",blue:"#93c5fd",magenta:"#c4b5fd",cyan:"#67e8f9",white:"#b0b0b0",brightBlack:"#444444",brightRed:"#fca5a5",brightGreen:"#86efac",brightYellow:"#fde68a",brightBlue:"#bfdbfe",brightMagenta:"#ddd6fe",brightCyan:"#a5f3fc",brightWhite:"#e8e8e8"},fontSize:13,fontFamily:'"JetBrains Mono", "SF Mono", "Fira Code", "Cascadia Code", monospace',fontWeight:"400",fontWeightBold:"500",lineHeight:1.3,cursorBlink:!0,cursorStyle:"bar",cursorWidth:1,scrollback:15e3,allowProposedApi:!0,minimumContrastRatio:1,drawBoldTextInBrightColors:!0}),v=new nm.FitAddon;_.loadAddon(v);try{const c=new fm;_.loadAddon(c),_.unicode.activeVersion="11"}catch{}try{const c=new pm;_.loadAddon(c)}catch{}_.open(i.current);try{v.fit()}catch{}o.current=_,h.current=v};J.useEffect(()=>{a();const _=i.current;if(!_)return;const v=new ResizeObserver(()=>{var m;try{(m=h.current)==null||m.fit()}catch{}const c=S.current;if(c&&r.current){const C=o.current;C&&r.current.emit("agent:resize",c,C.cols,C.rows)}});return v.observe(_),()=>{var c;v.disconnect(),(c=o.current)==null||c.dispose(),o.current=null,h.current=null,y.current=!1}},[]),J.useEffect(()=>{var R;a();const _=o.current,v=r.current;if(!e||!_||!v){S.current=null;return}const c=S.current;S.current=e.id,c!==e.id&&_.write("\x1B[2J\x1B[3J\x1B[H");let m=!1;fetch(`/api/agents/${e.id}/scrollback`).then(D=>D.ok?D.json():null).then(D=>{if(D!=null&&D.scrollback&&S.current===e.id&&_){const M=D.scrollback;let W=0;const z=()=>{if(W>=M.length){m=!0,_.scrollToBottom(),setTimeout(()=>_.scrollToBottom(),50);return}const j=M.slice(W,W+16384);W+=16384,_.write(j,z)};z()}else m=!0}).catch(()=>{m=!0});const C=`agent:pty:${e.id}`,b=D=>{if(S.current===e.id&&_){const k=_.buffer.active,M=k.viewportY>=k.baseY-1;_.write(D),m&&M&&_.scrollToBottom()}};v.on(C,b);const x=_.onData(D=>{v.emit("agent:input",e.id,D)});try{(R=h.current)==null||R.fit(),v.emit("agent:resize",e.id,_.cols,_.rows)}catch{}const f=i.current,p=e.id,d=async D=>{_.write(`\r
98
+ */var Bb=class{constructor(e,r,i,o={}){this._terminal=e,this._regex=r,this._handler=i,this._options=o}provideLinks(e,r){let i=Ob.computeLink(e,this._regex,this._terminal,this._handler);r(this._addCallbacks(i))}_addCallbacks(e){return e.map(r=>(r.leave=this._options.leave,r.hover=(i,o)=>{if(this._options.hover){let{range:h}=r;this._options.hover(i,o,h)}},r))}};function Ib(e){try{let r=new URL(e),i=r.password&&r.username?`${r.protocol}//${r.username}:${r.password}@${r.host}`:r.username?`${r.protocol}//${r.username}@${r.host}`:`${r.protocol}//${r.host}`;return e.toLocaleLowerCase().startsWith(i.toLocaleLowerCase())}catch{return!1}}var Ob=class ya{static computeLink(r,i,o,h){let S=new RegExp(i.source,(i.flags||"")+"g"),[y,a]=ya._getWindowedLineStrings(r-1,o),l=y.join(""),_,v=[];for(;_=S.exec(l);){let c=_[0];if(!Ib(c))continue;let[m,C]=ya._mapStrIdx(o,a,0,_.index),[b,x]=ya._mapStrIdx(o,m,C,c.length);if(m===-1||C===-1||b===-1||x===-1)continue;let f={start:{x:C+1,y:m+1},end:{x,y:b+1}};v.push({range:f,text:c,activate:h})}return v}static _getWindowedLineStrings(r,i){let o,h=r,S=r,y=0,a="",l=[];if(o=i.buffer.active.getLine(r)){let _=o.translateToString(!0);if(o.isWrapped&&_[0]!==" "){for(y=0;(o=i.buffer.active.getLine(--h))&&y<2048&&(a=o.translateToString(!0),y+=a.length,l.push(a),!(!o.isWrapped||a.indexOf(" ")!==-1)););l.reverse()}for(l.push(_),y=0;(o=i.buffer.active.getLine(++S))&&o.isWrapped&&y<2048&&(a=o.translateToString(!0),y+=a.length,l.push(a),a.indexOf(" ")===-1););}return[l,h]}static _mapStrIdx(r,i,o,h){let S=r.buffer.active,y=S.getNullCell(),a=o;for(;h;){let l=S.getLine(i);if(!l)return[-1,-1];for(let _=a;_<l.length;++_){l.getCell(_,y);let v=y.getChars();if(y.getWidth()&&(h-=v.length||1,_===l.length-1&&v==="")){let c=S.getLine(i+1);c&&c.isWrapped&&(c.getCell(0,y),y.getWidth()===2&&(h+=1))}if(h<0)return[i,_]}i++,a=0}return[i,a]}},Hb=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function Fb(e,r){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=r}else console.warn("Opening link blocked as opener could not be cleared")}var pm=class{constructor(e=Fb,r={}){this._handler=e,this._options=r}activate(e){this._terminal=e;let r=this._options,i=r.urlRegex||Hb;this._linkProvider=this._terminal.registerLinkProvider(new Bb(this._terminal,i,this._handler,r))}dispose(){var e;(e=this._linkProvider)==null||e.dispose()}};async function jb(e){try{const r=await e.arrayBuffer(),i=new Uint8Array(r);let o="";const h=8192;for(let l=0;l<i.length;l+=h)o+=String.fromCharCode(...i.subarray(l,l+h));const S=btoa(o);return(await(await fetch("/api/upload-image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:S,mimeType:e.type})})).json()).path||null}catch{return null}}function zb({agent:e,socket:r}){const i=J.useRef(null),o=J.useRef(null),h=J.useRef(null),S=J.useRef(null),y=J.useRef(!1),a=()=>{if(o.current||!i.current||y.current)return;y.current=!0;const _=new rm.Terminal({theme:{background:"#000000",foreground:"#b0b0b0",cursor:"#e8e8e8",cursorAccent:"#000000",selectionBackground:"rgba(255, 255, 255, 0.1)",selectionForeground:"#e8e8e8",black:"#0a0a0a",red:"#f87171",green:"#4ade80",yellow:"#fbbf24",blue:"#93c5fd",magenta:"#c4b5fd",cyan:"#67e8f9",white:"#b0b0b0",brightBlack:"#444444",brightRed:"#fca5a5",brightGreen:"#86efac",brightYellow:"#fde68a",brightBlue:"#bfdbfe",brightMagenta:"#ddd6fe",brightCyan:"#a5f3fc",brightWhite:"#e8e8e8"},fontSize:13,fontFamily:'"JetBrains Mono", "SF Mono", "Fira Code", "Cascadia Code", monospace',fontWeight:"400",fontWeightBold:"500",lineHeight:1.3,cursorBlink:!0,cursorStyle:"bar",cursorWidth:1,scrollback:15e3,allowProposedApi:!0,minimumContrastRatio:1,drawBoldTextInBrightColors:!0}),v=new nm.FitAddon;_.loadAddon(v);try{const c=new fm;_.loadAddon(c),_.unicode.activeVersion="11"}catch{}try{const c=new pm;_.loadAddon(c)}catch{}_.open(i.current);try{v.fit()}catch{}o.current=_,h.current=v};J.useEffect(()=>{a();const _=i.current;if(!_)return;const v=new ResizeObserver(()=>{var m;try{(m=h.current)==null||m.fit()}catch{}const c=S.current;if(c&&r.current){const C=o.current;C&&r.current.emit("agent:resize",c,C.cols,C.rows)}});return v.observe(_),()=>{var c;v.disconnect(),(c=o.current)==null||c.dispose(),o.current=null,h.current=null,y.current=!1}},[]),J.useEffect(()=>{var R;a();const _=o.current,v=r.current;if(!e||!_||!v){S.current=null;return}const c=S.current;S.current=e.id,c!==e.id&&_.write("\x1B[2J\x1B[3J\x1B[H");let m=!1;fetch(`/api/agents/${e.id}/scrollback`).then(D=>D.ok?D.json():null).then(D=>{if(D!=null&&D.scrollback&&S.current===e.id&&_){const M=D.scrollback;let W=0;const z=()=>{if(W>=M.length){m=!0,_.scrollToBottom(),setTimeout(()=>_.scrollToBottom(),50);return}const j=M.slice(W,W+16384);W+=16384,_.write(j,z)};z()}else m=!0}).catch(()=>{m=!0});const C=`agent:pty:${e.id}`,b=D=>{if(S.current===e.id&&_){const k=_.buffer.active,M=k.viewportY>=k.baseY-1;_.write(D),m&&M&&_.scrollToBottom()}};v.on(C,b);const x=_.onData(D=>{v.emit("agent:input",e.id,D)});_.attachCustomKeyEventHandler(D=>D.type==="keydown"&&D.key==="Enter"&&D.shiftKey?(D.preventDefault(),v.emit("agent:input",e.id,`
99
+ `),!1):!0);try{(R=h.current)==null||R.fit(),v.emit("agent:resize",e.id,_.cols,_.rows)}catch{}const f=i.current,p=e.id,d=async D=>{_.write(`\r
99
100
  \x1B[33mUploading image...\x1B[0m`);const k=await jb(D);k&&S.current===p?(v.emit("agent:input",p,k+"\r"),_.write(`\r
100
101
  \x1B[32mImage ready: `+k+`\x1B[0m\r
101
102
  `)):_.write(`\r
102
103
  \x1B[31mFailed to upload image\x1B[0m\r
103
- `)},u=D=>{var M;const k=(M=D.clipboardData)==null?void 0:M.items;if(k){for(const W of k)if(W.type.startsWith("image/")){D.preventDefault(),D.stopPropagation();const z=W.getAsFile();z&&d(z);return}}},w=D=>{var k,M;(M=(k=D.dataTransfer)==null?void 0:k.types)!=null&&M.includes("Files")&&(D.preventDefault(),D.stopPropagation())},L=D=>{var M;const k=(M=D.dataTransfer)==null?void 0:M.files;if(!(!k||k.length===0)){for(const W of k)if(W.type.startsWith("image/")){D.preventDefault(),D.stopPropagation(),d(W);return}}};return f==null||f.addEventListener("paste",u,!0),f==null||f.addEventListener("dragover",w,!0),f==null||f.addEventListener("drop",L,!0),_.focus(),()=>{v.off(C,b),x.dispose(),f==null||f.removeEventListener("paste",u,!0),f==null||f.removeEventListener("dragover",w,!0),f==null||f.removeEventListener("drop",L,!0)}},[e,r]);const l=()=>{var _;(_=o.current)==null||_.focus()};return O.jsxs("div",{style:{width:"100%",height:"100%",position:"relative"},children:[O.jsx("div",{ref:i,onClick:l,style:{width:"100%",height:"100%",display:e?"block":"none",padding:"2px 0",overscrollBehavior:"contain"}}),!e&&O.jsxs("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:12,color:"#333"},children:[O.jsx("div",{style:{fontSize:28,fontFamily:"'JetBrains Mono', monospace",fontWeight:400,letterSpacing:"0.05em"},children:"_"}),O.jsx("div",{style:{fontSize:12,color:"#444",fontFamily:"'DM Sans', sans-serif",letterSpacing:"0.02em"},children:"Select an agent to view its terminal"})]})]})}async function $b(e){try{const r=await e.arrayBuffer(),i=new Uint8Array(r);let o="";const h=8192;for(let l=0;l<i.length;l+=h)o+=String.fromCharCode(...i.subarray(l,l+h));const S=btoa(o);return(await(await fetch("/api/upload-image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:S,mimeType:e.type})})).json()).path||null}catch{return null}}const Wb={background:"#0a0a0a",foreground:"#b0b0b0",cursor:"#e8e8e8",cursorAccent:"#000000",selectionBackground:"rgba(255, 255, 255, 0.1)",selectionForeground:"#e8e8e8",black:"#0a0a0a",red:"#f87171",green:"#4ade80",yellow:"#fbbf24",blue:"#93c5fd",magenta:"#c4b5fd",cyan:"#67e8f9",white:"#b0b0b0",brightBlack:"#444444",brightRed:"#fca5a5",brightGreen:"#86efac",brightYellow:"#fde68a",brightBlue:"#bfdbfe",brightMagenta:"#ddd6fe",brightCyan:"#a5f3fc",brightWhite:"#e8e8e8"};function Ub(e){switch(e){case"running":return"#4ade80";case"starting":return"#fbbf24";case"done":return"#666";case"dead":return"#f87171";default:return"#666"}}function Vb({orientation:e,onDrag:r}){const i=J.useCallback(o=>{o.preventDefault();let h=e==="horizontal"?o.clientX:o.clientY;const S=a=>{const l=e==="horizontal"?a.clientX:a.clientY,_=l-h;h=l,r(_)},y=()=>{document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",y),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",S),document.addEventListener("mouseup",y),document.body.style.cursor=e==="horizontal"?"col-resize":"row-resize",document.body.style.userSelect="none"},[e,r]);return O.jsx("div",{className:`multi-term-divider ${e}`,onMouseDown:i})}function qb({agents:e,socket:r,onSelectAgent:i}){const o=J.useRef(new Map),h=J.useRef(new Map),S=J.useRef(null),[y,a]=J.useState(null),[l,_]=J.useState([]),v=J.useRef(""),c=e.filter(d=>d.status==="running"||d.status==="starting"),m=c.map(d=>d.id).join(",");J.useEffect(()=>{if(m!==v.current){v.current=m;const d=c.length;d>0&&_(Array(d).fill(100/d))}},[m,c.length]);const C=J.useCallback(d=>u=>{u?h.current.set(d,u):h.current.delete(d)},[]);J.useEffect(()=>{var L,R;const d=r.current;if(!d)return;const u=new Set(c.map(D=>D.id)),w=o.current;for(const[D,k]of w)u.has(D)||((L=k.cleanup)==null||L.call(k),k.term.dispose(),w.delete(D));for(const D of c){const k=h.current.get(D.id);if(!k)continue;if(w.has(D.id)){const G=w.get(D.id);try{G.fit.fit()}catch{}continue}const M=new rm.Terminal({theme:Wb,fontSize:12,fontFamily:'"JetBrains Mono", "SF Mono", "Fira Code", "Cascadia Code", monospace',fontWeight:"400",fontWeightBold:"500",lineHeight:1.25,cursorBlink:!0,cursorStyle:"bar",cursorWidth:1,scrollback:1e4,allowProposedApi:!0,minimumContrastRatio:1,drawBoldTextInBrightColors:!0}),W=new nm.FitAddon;M.loadAddon(W);try{const G=new fm;M.loadAddon(G),M.unicode.activeVersion="11"}catch{}try{M.loadAddon(new pm)}catch{}M.open(k);try{W.fit()}catch{}let z=!1;fetch(`/api/agents/${D.id}/scrollback`).then(G=>G.ok?G.json():null).then(G=>{if(G!=null&&G.scrollback&&M){const ie=G.scrollback;let ae=0;const X=()=>{if(ae>=ie.length){z=!0,M.scrollToBottom(),setTimeout(()=>M.scrollToBottom(),50);return}const H=ie.slice(ae,ae+16384);ae+=16384,M.write(H,X)};X()}else z=!0}).catch(()=>{z=!0});const j=`agent:pty:${D.id}`,N=G=>{const Z=M.buffer.active,ie=Z.viewportY>=Z.baseY-1;M.write(G),z&&ie&&M.scrollToBottom()};d.on(j,N);const I=M.onData(G=>{d.emit("agent:input",D.id,G)}),q=new ResizeObserver(()=>{try{W.fit(),d.emit("agent:resize",D.id,M.cols,M.rows)}catch{}});q.observe(k);const U=(R=h.current.get(D.id))==null?void 0:R.parentElement,K=D.id,V=async G=>{M.write(`\r
104
- \x1B[33mUploading image...\x1B[0m`);const Z=await $b(G);Z?(d.emit("agent:input",K,Z+"\r"),M.write(`\r
104
+ `)},u=D=>{var W,z;const k=(W=D.clipboardData)==null?void 0:W.items;if(!k)return;for(const j of k)if(j.type.startsWith("image/")){D.preventDefault(),D.stopPropagation();const N=j.getAsFile();N&&d(N);return}const M=(z=D.clipboardData)==null?void 0:z.getData("text/plain");if(M){D.preventDefault(),D.stopPropagation();const j=M.replace(/\r\n|\r|\n/g," ");v.emit("agent:input",p,j)}},w=D=>{var k,M;(M=(k=D.dataTransfer)==null?void 0:k.types)!=null&&M.includes("Files")&&(D.preventDefault(),D.stopPropagation())},L=D=>{var M;const k=(M=D.dataTransfer)==null?void 0:M.files;if(!(!k||k.length===0)){for(const W of k)if(W.type.startsWith("image/")){D.preventDefault(),D.stopPropagation(),d(W);return}}};return f==null||f.addEventListener("paste",u,!0),f==null||f.addEventListener("dragover",w,!0),f==null||f.addEventListener("drop",L,!0),_.focus(),()=>{v.off(C,b),x.dispose(),f==null||f.removeEventListener("paste",u,!0),f==null||f.removeEventListener("dragover",w,!0),f==null||f.removeEventListener("drop",L,!0)}},[e,r]);const l=()=>{var _;(_=o.current)==null||_.focus()};return O.jsxs("div",{style:{width:"100%",height:"100%",position:"relative"},children:[O.jsx("div",{ref:i,onClick:l,style:{width:"100%",height:"100%",display:e?"block":"none",padding:"2px 0",overscrollBehavior:"contain"}}),!e&&O.jsxs("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:12,color:"#333"},children:[O.jsx("div",{style:{fontSize:28,fontFamily:"'JetBrains Mono', monospace",fontWeight:400,letterSpacing:"0.05em"},children:"_"}),O.jsx("div",{style:{fontSize:12,color:"#444",fontFamily:"'DM Sans', sans-serif",letterSpacing:"0.02em"},children:"Select an agent to view its terminal"})]})]})}async function $b(e){try{const r=await e.arrayBuffer(),i=new Uint8Array(r);let o="";const h=8192;for(let l=0;l<i.length;l+=h)o+=String.fromCharCode(...i.subarray(l,l+h));const S=btoa(o);return(await(await fetch("/api/upload-image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:S,mimeType:e.type})})).json()).path||null}catch{return null}}const Wb={background:"#0a0a0a",foreground:"#b0b0b0",cursor:"#e8e8e8",cursorAccent:"#000000",selectionBackground:"rgba(255, 255, 255, 0.1)",selectionForeground:"#e8e8e8",black:"#0a0a0a",red:"#f87171",green:"#4ade80",yellow:"#fbbf24",blue:"#93c5fd",magenta:"#c4b5fd",cyan:"#67e8f9",white:"#b0b0b0",brightBlack:"#444444",brightRed:"#fca5a5",brightGreen:"#86efac",brightYellow:"#fde68a",brightBlue:"#bfdbfe",brightMagenta:"#ddd6fe",brightCyan:"#a5f3fc",brightWhite:"#e8e8e8"};function Ub(e){switch(e){case"running":return"#4ade80";case"starting":return"#fbbf24";case"done":return"#666";case"dead":return"#f87171";default:return"#666"}}function Vb({orientation:e,onDrag:r}){const i=J.useCallback(o=>{o.preventDefault();let h=e==="horizontal"?o.clientX:o.clientY;const S=a=>{const l=e==="horizontal"?a.clientX:a.clientY,_=l-h;h=l,r(_)},y=()=>{document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",y),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",S),document.addEventListener("mouseup",y),document.body.style.cursor=e==="horizontal"?"col-resize":"row-resize",document.body.style.userSelect="none"},[e,r]);return O.jsx("div",{className:`multi-term-divider ${e}`,onMouseDown:i})}function qb({agents:e,socket:r,onSelectAgent:i}){const o=J.useRef(new Map),h=J.useRef(new Map),S=J.useRef(null),[y,a]=J.useState(null),[l,_]=J.useState([]),v=J.useRef(""),c=e.filter(d=>d.status==="running"||d.status==="starting"),m=c.map(d=>d.id).join(",");J.useEffect(()=>{if(m!==v.current){v.current=m;const d=c.length;d>0&&_(Array(d).fill(100/d))}},[m,c.length]);const C=J.useCallback(d=>u=>{u?h.current.set(d,u):h.current.delete(d)},[]);J.useEffect(()=>{var L,R;const d=r.current;if(!d)return;const u=new Set(c.map(D=>D.id)),w=o.current;for(const[D,k]of w)u.has(D)||((L=k.cleanup)==null||L.call(k),k.term.dispose(),w.delete(D));for(const D of c){const k=h.current.get(D.id);if(!k)continue;if(w.has(D.id)){const Y=w.get(D.id);try{Y.fit.fit()}catch{}continue}const M=new rm.Terminal({theme:Wb,fontSize:12,fontFamily:'"JetBrains Mono", "SF Mono", "Fira Code", "Cascadia Code", monospace',fontWeight:"400",fontWeightBold:"500",lineHeight:1.25,cursorBlink:!0,cursorStyle:"bar",cursorWidth:1,scrollback:1e4,allowProposedApi:!0,minimumContrastRatio:1,drawBoldTextInBrightColors:!0}),W=new nm.FitAddon;M.loadAddon(W);try{const Y=new fm;M.loadAddon(Y),M.unicode.activeVersion="11"}catch{}try{M.loadAddon(new pm)}catch{}M.open(k);try{W.fit()}catch{}let z=!1;fetch(`/api/agents/${D.id}/scrollback`).then(Y=>Y.ok?Y.json():null).then(Y=>{if(Y!=null&&Y.scrollback&&M){const ie=Y.scrollback;let ae=0;const X=()=>{if(ae>=ie.length){z=!0,M.scrollToBottom(),setTimeout(()=>M.scrollToBottom(),50);return}const H=ie.slice(ae,ae+16384);ae+=16384,M.write(H,X)};X()}else z=!0}).catch(()=>{z=!0});const j=`agent:pty:${D.id}`,N=Y=>{const Z=M.buffer.active,ie=Z.viewportY>=Z.baseY-1;M.write(Y),z&&ie&&M.scrollToBottom()};d.on(j,N);const I=M.onData(Y=>{d.emit("agent:input",D.id,Y)});M.attachCustomKeyEventHandler(Y=>Y.type==="keydown"&&Y.key==="Enter"&&Y.shiftKey?(Y.preventDefault(),d.emit("agent:input",D.id,`
105
+ `),!1):!0);const q=new ResizeObserver(()=>{try{W.fit(),d.emit("agent:resize",D.id,M.cols,M.rows)}catch{}});q.observe(k);const U=(R=h.current.get(D.id))==null?void 0:R.parentElement,K=D.id,V=async Y=>{M.write(`\r
106
+ \x1B[33mUploading image...\x1B[0m`);const Z=await $b(Y);Z?(d.emit("agent:input",K,Z+"\r"),M.write(`\r
105
107
  \x1B[32mImage ready: `+Z+`\x1B[0m\r
106
108
  `)):M.write(`\r
107
109
  \x1B[31mFailed to upload image\x1B[0m\r
108
- `)},T=G=>{var ie;const Z=(ie=G.clipboardData)==null?void 0:ie.items;if(Z){for(const ae of Z)if(ae.type.startsWith("image/")){G.preventDefault(),G.stopPropagation();const X=ae.getAsFile();X&&V(X);return}}},B=G=>{var Z,ie;(ie=(Z=G.dataTransfer)==null?void 0:Z.types)!=null&&ie.includes("Files")&&(G.preventDefault(),G.stopPropagation())},P=G=>{var ie;const Z=(ie=G.dataTransfer)==null?void 0:ie.files;if(!(!Z||Z.length===0)){for(const ae of Z)if(ae.type.startsWith("image/")){G.preventDefault(),G.stopPropagation(),V(ae);return}}};U==null||U.addEventListener("paste",T,!0),U==null||U.addEventListener("dragover",B,!0),U==null||U.addEventListener("drop",P,!0);const F=()=>{d.off(j,N),I.dispose(),q.disconnect(),U==null||U.removeEventListener("paste",T,!0),U==null||U.removeEventListener("dragover",B,!0),U==null||U.removeEventListener("drop",P,!0)};w.set(D.id,{term:M,fit:W,cleanup:F})}return()=>{var D;for(const[,k]of w)(D=k.cleanup)==null||D.call(k),k.term.dispose();w.clear()}},[c.map(d=>d.id).join(","),r.current]);const b=J.useCallback(d=>{a(d.id);const u=o.current.get(d.id);u&&u.term.focus(),i==null||i(d)},[i]),x=J.useCallback((d,u)=>{if(!S.current)return;const w=S.current.offsetWidth,L=u/w*100;_(R=>{const D=[...R],k=10,M=D[d]+L,W=D[d+1]-L;return M>=k&&W>=k&&(D[d]=M,D[d+1]=W),D})},[]),f=c.length;if(f===0)return O.jsxs("div",{className:"multi-term-empty",children:[O.jsx("div",{className:"multi-term-empty-icon",children:"_"}),O.jsx("div",{className:"multi-term-empty-text",children:"No running agents"})]});const p=l.length===f?l:Array(f).fill(100/f);return O.jsx("div",{className:"multi-term-container",ref:S,children:c.map((d,u)=>O.jsxs(Hu.Fragment,{children:[O.jsxs("div",{className:`multi-term-pane ${y===d.id?"focused":""}`,style:{flexBasis:`${p[u]}%`},onClick:()=>b(d),children:[O.jsxs("div",{className:"multi-term-pane-header",children:[O.jsx("span",{className:"multi-term-status-dot",style:{background:Ub(d.status)}}),O.jsx("span",{className:"multi-term-pane-name",children:d.name}),O.jsx("span",{className:"multi-term-pane-task",children:d.task})]}),O.jsx("div",{className:"multi-term-pane-body",ref:C(d.id)})]}),u<f-1&&O.jsx(Vb,{orientation:"horizontal",onDrag:w=>x(u,w)})]},d.id))})}function Kb({messages:e,agents:r,selectedAgentId:i,onClear:o}){const h=J.useRef(null),S=J.useMemo(()=>{const a={user:"User"};return r.forEach(l=>{a[l.id]=l.name}),a},[r]),y=J.useMemo(()=>i?e.filter(a=>a.from_agent===i||a.to_agent===i):e,[e,i]);return J.useEffect(()=>{var a;(a=h.current)==null||a.scrollIntoView({behavior:"smooth"})},[y]),O.jsxs("div",{className:"message-feed",children:[O.jsxs("div",{className:"message-feed-header",children:[O.jsx("span",{children:i?`Messages for ${S[i]||i}`:"All Messages"}),y.length>0&&O.jsx("button",{className:"clear-messages-btn",onClick:o,children:"Clear All"})]}),O.jsxs("div",{className:"message-feed-list",children:[y.length===0&&O.jsx("div",{className:"message-feed-empty",children:"No messages yet"}),[...y].reverse().map(a=>O.jsxs("div",{className:"message-item",children:[O.jsxs("div",{className:"message-meta",children:[O.jsx("span",{className:"message-from",children:S[a.from_agent]||a.from_agent.slice(0,8)}),O.jsx("span",{className:"message-arrow",children:" → "}),O.jsx("span",{className:"message-to",children:a.to_agent==="all"?"All":S[a.to_agent]||a.to_agent.slice(0,8)}),O.jsx("span",{className:"message-time",children:new Date(a.created_at).toLocaleTimeString()})]}),O.jsx("div",{className:"message-content",children:a.content})]},a.id)),O.jsx("div",{ref:h})]})]})}function Xb({entries:e,onRemove:r}){return O.jsxs("div",{className:"context-viewer",children:[O.jsx("div",{className:"context-header",children:"Shared Context"}),e.length===0&&O.jsx("div",{className:"context-empty",children:"No context entries yet"}),O.jsxs("table",{className:"context-table",children:[O.jsx("thead",{children:O.jsxs("tr",{children:[O.jsx("th",{children:"Key"}),O.jsx("th",{children:"Value"}),O.jsx("th",{children:"Updated By"}),O.jsx("th",{children:"Updated At"}),O.jsx("th",{})]})}),O.jsx("tbody",{children:e.map(i=>O.jsxs("tr",{children:[O.jsx("td",{className:"context-key",children:i.key}),O.jsx("td",{className:"context-value",children:i.value}),O.jsx("td",{children:i.updated_by||"—"}),O.jsx("td",{className:"context-time",children:i.updated_at?new Date(i.updated_at).toLocaleTimeString():"—"}),O.jsx("td",{children:O.jsx("button",{className:"context-remove-btn",onClick:()=>r(i.key),title:`Remove "${i.key}"`,children:"✕"})})]},i.key))})]})]})}function Yb({diff:e,fileName:r}){const i=e.split(`
109
- `);return O.jsxs("div",{className:"diff-viewer",children:[r&&O.jsx("div",{className:"diff-filename",children:r}),O.jsx("pre",{className:"diff-content",children:i.map((o,h)=>{let S="diff-line";return o.startsWith("+")&&!o.startsWith("+++")?S+=" diff-add":o.startsWith("-")&&!o.startsWith("---")?S+=" diff-del":o.startsWith("@@")?S+=" diff-hunk":o.startsWith("\\")&&(S+=" diff-meta"),O.jsx("div",{className:S,children:o},h)})})]})}function Gb(e){switch(e){case"add":return"A";case"change":return"M";case"unlink":return"D";default:return"?"}}function Qb(e){switch(e){case"add":return"#4ade80";case"change":return"#fbbf24";case"unlink":return"#f87171";default:return"#666"}}function Jb({changes:e,agents:r,onClear:i}){const[o,h]=J.useState(null),S=J.useMemo(()=>{const y=new Map;for(const a of r)y.set(a.id,a.name);return y},[r]);return O.jsxs("div",{className:"file-changes",children:[O.jsxs("div",{className:"file-changes-header",children:[O.jsxs("span",{children:["File Changes (",e.length,")"]}),e.length>0&&O.jsx("button",{className:"file-changes-clear-btn",onClick:i,children:"Clear"})]}),O.jsxs("div",{className:"file-changes-list",children:[e.length===0&&O.jsx("div",{className:"file-changes-empty",children:"No file changes detected yet. Changes will appear here as agents edit files."}),e.map(y=>{const a=y.agent_id?S.get(y.agent_id):null;return O.jsxs("div",{className:"file-change-item",children:[O.jsxs("div",{className:"file-change-row",onClick:()=>h(o===y.id?null:y.id),children:[O.jsx("span",{className:"file-change-type",style:{color:Qb(y.change_type)},children:Gb(y.change_type)}),O.jsx("span",{className:"file-change-path",children:y.file_path}),a&&O.jsx("span",{className:"file-change-agent",title:"Agent that made this change",children:a}),O.jsx("span",{className:"file-change-time",children:new Date(y.created_at).toLocaleTimeString()}),O.jsx("span",{className:"file-change-expand",children:y.diff_text?o===y.id?"▼":"▶":""})]}),o===y.id&&y.diff_text&&O.jsx(Yb,{diff:y.diff_text})]},y.id)})]})]})}function la(e){const r=Date.now()-new Date(e).getTime(),i=Math.floor(r/6e4);if(i<1)return"just now";if(i<60)return`${i}m ago`;const o=Math.floor(i/60);if(o<24)return`${o}h ago`;const h=Math.floor(o/24);return h<30?`${h}d ago`:`${Math.floor(h/30)}mo ago`}function Zb(e){return!e||e.length===0?{icon:"",cls:""}:e.some(o=>o.conclusion==="FAILURE"||o.conclusion==="failure")?{icon:"✗",cls:"failure"}:e.some(o=>!o.conclusion||o.status==="IN_PROGRESS"||o.status==="QUEUED")?{icon:"○",cls:"pending"}:{icon:"✓",cls:"success"}}function eE(e){switch(e){case"APPROVED":return{text:"Approved",cls:"approved"};case"CHANGES_REQUESTED":return{text:"Changes",cls:"changes_requested"};case"REVIEW_REQUIRED":return{text:"Review",cls:"review_required"};default:return null}}function tE({prs:e,branches:r,currentBranch:i,ghAvailable:o,repoInfo:h,agents:S,fetchPRDetail:y}){const[a,l]=J.useState("all"),[_,v]=J.useState(null),[c,m]=J.useState(null),[C,b]=J.useState(!1),[x,f]=J.useState(!0),p=J.useMemo(()=>a==="all"?e:e.filter(L=>L.state.toUpperCase()===a.toUpperCase()),[e,a]),d=J.useMemo(()=>new Set(S.map(L=>L.name.toLowerCase())),[S]),u=async L=>{if(_===L){v(null),m(null);return}v(L),m(null),b(!0);const R=await y(L);m(R),b(!1)},w=L=>{const R=L.name.toLowerCase();for(const k of d)if(R.includes(k))return k;const D=L.author.toLowerCase();for(const k of d)if(D.includes(k))return k;return null};return O.jsxs("div",{className:"prs-tab",children:[O.jsxs("div",{className:"prs-header",children:[O.jsxs("div",{className:"prs-header-left",children:[O.jsxs("span",{children:["Pull Requests (",p.length,")"]}),O.jsxs("select",{className:"prs-filter",value:a,onChange:L=>l(L.target.value),children:[O.jsx("option",{value:"all",children:"All"}),O.jsx("option",{value:"open",children:"Open"}),O.jsx("option",{value:"closed",children:"Closed"}),O.jsx("option",{value:"merged",children:"Merged"})]})]}),h&&O.jsx("a",{className:"prs-repo-link",href:h.url,target:"_blank",rel:"noopener noreferrer",onClick:L=>{L.preventDefault(),window.open(h.url,"_blank")},children:h.nameWithOwner})]}),O.jsxs("div",{className:"prs-list",children:[o===!1&&O.jsxs("div",{className:"prs-unavailable",children:["GitHub CLI not available.",O.jsx("br",{}),"Install ",O.jsx("code",{children:"gh"})," and run ",O.jsx("code",{children:"gh auth login"})," to see PRs."]}),o!==!1&&p.length===0&&O.jsx("div",{className:"prs-empty",children:"No pull requests found."}),p.map(L=>{const R=L.isDraft?"draft":L.state.toLowerCase(),D=Zb(L.statusCheckRollup),k=eE(L.reviewDecision),M=_===L.number;return O.jsxs("div",{className:"pr-item",children:[O.jsxs("div",{className:"pr-row",onClick:()=>u(L.number),children:[O.jsx("span",{className:"pr-expand",children:M?"▼":"▶"}),O.jsx("span",{className:`pr-status-badge ${R}`}),O.jsxs("span",{className:"pr-number",children:["#",L.number]}),O.jsx("span",{className:"pr-title",children:L.title}),k&&O.jsx("span",{className:`pr-review ${k.cls}`,children:k.text}),D.icon&&O.jsx("span",{className:`pr-ci ${D.cls}`,children:D.icon}),O.jsx("span",{className:"pr-branch",title:L.headRefName,children:L.headRefName}),O.jsx("span",{className:"pr-author",children:L.author.login}),O.jsx("span",{className:"pr-time",children:la(L.createdAt)}),O.jsx("button",{className:"pr-link-btn",title:"Open in GitHub",onClick:W=>{W.stopPropagation(),window.open(L.url,"_blank")},children:"↗"})]}),M&&O.jsxs("div",{className:"pr-detail",children:[C&&O.jsx("div",{className:"pr-detail-loading",children:"Loading..."}),c&&c.number===L.number&&O.jsxs(O.Fragment,{children:[c.body&&O.jsx("div",{className:"pr-detail-body",children:c.body}),c.statusCheckRollup&&c.statusCheckRollup.length>0&&O.jsxs(O.Fragment,{children:[O.jsx("div",{className:"pr-detail-section-title",children:"Checks"}),O.jsx("div",{className:"pr-detail-checks",children:c.statusCheckRollup.map((W,z)=>{var j,N,I,q;return O.jsxs("span",{className:`pr-check ${((j=W.conclusion)==null?void 0:j.toLowerCase())==="success"?"success":((N=W.conclusion)==null?void 0:N.toLowerCase())==="failure"?"failure":"pending"}`,children:[((I=W.conclusion)==null?void 0:I.toLowerCase())==="success"?"✓":((q=W.conclusion)==null?void 0:q.toLowerCase())==="failure"?"✗":"○"," ",W.name]},z)})})]}),c.reviews&&c.reviews.length>0&&O.jsxs(O.Fragment,{children:[O.jsx("div",{className:"pr-detail-section-title",children:"Reviews"}),c.reviews.map((W,z)=>O.jsxs("div",{className:"pr-comment",children:[O.jsxs("div",{className:"pr-comment-header",children:[O.jsx("strong",{children:W.author.login})," ",W.state.toLowerCase().replace("_"," ")," ",la(W.submittedAt)]}),W.body&&O.jsx("div",{className:"pr-comment-body",children:W.body})]},z))]}),c.comments&&c.comments.length>0&&O.jsxs(O.Fragment,{children:[O.jsx("div",{className:"pr-detail-section-title",children:"Comments"}),c.comments.map((W,z)=>O.jsxs("div",{className:"pr-comment",children:[O.jsxs("div",{className:"pr-comment-header",children:[O.jsx("strong",{children:W.author.login})," ",la(W.createdAt)]}),O.jsx("div",{className:"pr-comment-body",children:W.body})]},z))]}),(!c.reviews||c.reviews.length===0)&&(!c.comments||c.comments.length===0)&&!c.body&&O.jsx("div",{className:"pr-detail-loading",children:"No details available."})]})]})]},L.number)})]}),O.jsxs("div",{className:"branches-section",children:[O.jsxs("div",{className:"branches-header",onClick:()=>f(L=>!L),children:[O.jsxs("span",{children:["Branches (",r.length,")",i?` — ${i}`:""]}),O.jsx("span",{className:"branches-toggle",children:x?"▼":"▶"})]}),x&&O.jsxs("div",{className:"branches-list",children:[r.length===0&&O.jsx("div",{className:"prs-empty",children:"No branches found."}),r.map(L=>{const R=w(L);return O.jsxs("div",{className:`branch-item ${L.isCurrent?"current":""}`,children:[O.jsx("span",{className:"branch-current-marker",children:L.isCurrent?"●":""}),O.jsx("span",{className:`branch-name ${L.isCurrent?"current":""}`,title:L.name,children:L.name}),O.jsx("span",{className:"branch-message",children:L.lastCommitMessage}),R&&O.jsx("span",{className:"pr-branch",children:R}),O.jsx("span",{className:"branch-author",children:L.author}),O.jsxs("div",{className:"branch-ahead-behind",children:[L.ahead>0&&O.jsxs("span",{className:"branch-badge ahead",children:[L.ahead,"\\u2191"]}),L.behind>0&&O.jsxs("span",{className:"branch-badge behind",children:[L.behind,"\\u2193"]})]}),O.jsx("span",{className:"branch-time",children:L.lastCommitDate?la(L.lastCommitDate):""})]},L.name)})]})]})]})}function rE({content:e,onChange:r}){const[i,o]=J.useState(e),[h,S]=J.useState(!1),[y,a]=J.useState(!1),l=J.useRef(null);J.useEffect(()=>{y||o(e)},[e,y]);const _=m=>{o(m),a(!0)},v=async()=>{S(!0);try{await fetch("/api/crewmd",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i})}),r(i),a(!1)}catch{}S(!1)},c=m=>{(m.metaKey||m.ctrlKey)&&m.key==="s"&&(m.preventDefault(),y&&v())};return O.jsxs("div",{className:"crewmd-editor",children:[O.jsxs("div",{className:"crewmd-header",children:[O.jsx("span",{className:"crewmd-title",children:"Rules"}),O.jsxs("div",{className:"crewmd-actions",children:[y&&O.jsx("span",{className:"crewmd-dirty",children:"unsaved"}),O.jsx("button",{className:"crewmd-save-btn",onClick:v,disabled:!y||h,children:h?"Saving...":"Save"})]})]}),O.jsx("textarea",{ref:l,className:"crewmd-textarea",value:i,onChange:m=>_(m.target.value),onKeyDown:c,spellCheck:!1,placeholder:"Write global instructions for all agents..."})]})}function nE(e){const[r,i]=J.useState([]),[o,h]=J.useState([]),[S,y]=J.useState(""),[a,l]=J.useState(null),[_,v]=J.useState(null),[c,m]=J.useState(!0);J.useEffect(()=>{fetch("/api/github/status").then(b=>b.json()).then(b=>{l(b.available),v(b.repo||null)}).catch(()=>l(!1)),fetch("/api/github/prs?state=all").then(b=>b.json()).then(b=>{Array.isArray(b)&&i(b)}).catch(()=>{}),fetch("/api/git/branches").then(b=>b.json()).then(b=>{b.current&&y(b.current),Array.isArray(b.branches)&&h(b.branches)}).catch(()=>{}).finally(()=>m(!1))},[]),J.useEffect(()=>{const b=e.current;if(!b)return;const x=p=>{Array.isArray(p)&&i(p)},f=p=>{p.current&&y(p.current),Array.isArray(p.branches)&&h(p.branches)};return b.on("github:prs:updated",x),b.on("git:branches:updated",f),()=>{b.off("github:prs:updated",x),b.off("git:branches:updated",f)}},[e]);const C=J.useCallback(async b=>{try{const x=await fetch(`/api/github/prs/${b}`);return x.ok?await x.json():null}catch{return null}},[]);return{prs:r,branches:o,currentBranch:S,ghAvailable:a,repoInfo:_,loading:c,fetchPRDetail:C}}function iE({onSpawn:e,onClose:r,initialMode:i="spawn",error:o}){const[h,S]=J.useState(i),[y,a]=J.useState(""),[l,_]=J.useState(""),[v,c]=J.useState(""),[m,C]=J.useState("claude"),[b,x]=J.useState(!1),f=async()=>{x(!0);try{const u=await(await fetch("/api/pick-folder",{method:"POST"})).json();u.path&&c(u.path)}catch{}x(!1)},p=()=>{if(h==="open"){if(!v.trim())return;const d=v.trim().split("/").filter(Boolean).pop()||"project";e(y.trim()||d,l.trim()||`Work on the project at ${v.trim()}. Explore the codebase and wait for instructions.`,v.trim(),m)}else{if(!y.trim()||!l.trim())return;e(y.trim(),l.trim(),v.trim()||void 0,m)}};return O.jsx("div",{className:"dialog-overlay",onClick:r,children:O.jsxs("div",{className:"dialog",onClick:d=>d.stopPropagation(),children:[O.jsxs("div",{className:"dialog-mode-tabs",children:[O.jsx("button",{className:`dialog-mode-tab ${h==="spawn"?"active":""}`,onClick:()=>S("spawn"),children:"Spawn Agent"}),O.jsx("button",{className:`dialog-mode-tab ${h==="open"?"active":""}`,onClick:()=>S("open"),children:"Open Project"})]}),O.jsxs("label",{children:["Agent Service",O.jsxs("div",{className:"service-selector",children:[O.jsx("button",{type:"button",className:`service-btn ${m==="claude"?"active":""}`,onClick:()=>C("claude"),children:"Claude"}),O.jsx("button",{type:"button",className:`service-btn ${m==="codex"?"active":""}`,onClick:()=>C("codex"),children:"Codex"})]})]}),h==="open"?O.jsxs(O.Fragment,{children:[O.jsxs("label",{children:["Project Directory",O.jsxs("div",{className:"browse-row",children:[O.jsx("input",{type:"text",value:v,onChange:d=>c(d.target.value),placeholder:"/Users/you/your-project",autoFocus:!0}),O.jsx("button",{type:"button",className:"browse-btn",onClick:f,disabled:b,children:b?"...":"Browse"})]})]}),O.jsxs("label",{children:["Agent Name ",O.jsx("span",{className:"optional",children:"(optional)"}),O.jsx("input",{type:"text",value:y,onChange:d=>a(d.target.value),placeholder:"Auto-detected from path"})]}),O.jsxs("label",{children:["Initial Task ",O.jsx("span",{className:"optional",children:"(optional)"}),O.jsx("textarea",{value:l,onChange:d=>_(d.target.value),placeholder:"Explore the codebase and wait for instructions...",rows:3})]})]}):O.jsxs(O.Fragment,{children:[O.jsxs("label",{children:["Name",O.jsx("input",{type:"text",value:y,onChange:d=>a(d.target.value),placeholder:"e.g. researcher",autoFocus:!0})]}),O.jsxs("label",{children:["Task",O.jsx("textarea",{value:l,onChange:d=>_(d.target.value),placeholder:"Describe what this agent should do...",rows:4})]}),O.jsxs("label",{children:["Working Directory ",O.jsx("span",{className:"optional",children:"(optional)"}),O.jsxs("div",{className:"browse-row",children:[O.jsx("input",{type:"text",value:v,onChange:d=>c(d.target.value),placeholder:"e.g. /Users/you/project (leave blank for server cwd)"}),O.jsx("button",{type:"button",className:"browse-btn",onClick:f,disabled:b,children:b?"...":"Browse"})]})]})]}),o&&O.jsx("div",{className:"dialog-error",children:o}),O.jsxs("div",{className:"dialog-actions",children:[O.jsx("button",{onClick:r,children:"Cancel"}),O.jsx("button",{className:"primary",onClick:p,children:h==="open"?"Open":"Spawn"})]})]})})}function sE({size:e=28}){return O.jsxs("svg",{width:e,height:e,viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[O.jsx("path",{d:"M50 5 A45 45 0 1 1 15 75",stroke:"currentColor",strokeWidth:"6",strokeLinecap:"round",fill:"none"}),O.jsx("path",{d:"M30 18 Q55 45 78 30",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round",fill:"none"}),O.jsx("path",{d:"M20 55 Q50 35 75 65",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round",fill:"none"}),O.jsx("path",{d:"M22 72 Q50 60 50 90",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round",fill:"none"}),O.jsx("circle",{cx:"30",cy:"18",r:"6",fill:"currentColor"}),O.jsx("circle",{cx:"78",cy:"30",r:"6",fill:"currentColor"}),O.jsx("circle",{cx:"75",cy:"65",r:"6",fill:"currentColor"}),O.jsx("circle",{cx:"22",cy:"72",r:"6",fill:"currentColor"}),O.jsx("circle",{cx:"50",cy:"90",r:"5.5",fill:"currentColor"})]})}function oE(){var be;const{socket:e,agents:r,messages:i,contextEntries:o,crewMd:h,setCrewMd:S,fileChanges:y}=Yv(),{prs:a,branches:l,currentBranch:_,ghAvailable:v,repoInfo:c,fetchPRDetail:m}=nE(e),[C,b]=J.useState(null),x=r.find(ue=>ue.id===C)??null,[f,p]=J.useState("graph"),[d,u]=J.useState(!1),[w,L]=J.useState("spawn"),[R,D]=J.useState(""),[k,M]=J.useState("all"),[W,z]=J.useState("multi"),[j,N]=J.useState(()=>window.innerWidth>=768),[I,q]=J.useState(!1),[U,K]=J.useState(null),[V,T]=J.useState(null),B=J.useCallback(async()=>{q(!0),T(null);try{const ue=await fetch("/api/pair");if(!ue.ok){const Re=await ue.text();T(Re||`Error ${ue.status}`);return}const ge=await ue.json();K(ge)}catch(ue){T(ue.message||"Failed to load pairing info")}},[]),[P,F]=J.useState(null),G=J.useCallback(async(ue,ge,Re,Ie)=>{F(null);try{const ze=await Er("/api/spawn",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:ue,task:ge,cwd:Re,service:Ie||"claude"})}),Qe=await ze.json();if(!ze.ok){F(Qe.error||"Unknown error");return}u(!1),F(null)}catch(ze){F(ze.message||"Failed to connect to server")}},[]),Z=J.useCallback(async ue=>{await fetch(`/api/agents/${ue}`,{method:"DELETE"})},[]),ie=J.useCallback(async ue=>{await fetch(`/api/agents/${ue}/remove`,{method:"DELETE"}),C===ue&&b(null)},[C]),ae=J.useCallback(async ue=>{await fetch(`/api/agents/${ue}/rollback`,{method:"POST"})},[]),X=J.useCallback(async ue=>{await fetch(`/api/agents/${ue.id}/remove`,{method:"DELETE"});const Re=await(await Er("/api/spawn",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:ue.name,task:ue.task,cwd:ue.agent_cwd||void 0,service:ue.service||"claude"})})).json();Re.id&&(b(Re.id),p("terminal"))},[]),H=J.useCallback(async ue=>{await fetch(`/api/context/${encodeURIComponent(ue)}`,{method:"DELETE"})},[]),re=J.useCallback(async()=>{if(!R.trim())return;const ue=k,ge=R;if(D(""),ue!=="all")await fetch(`/api/agents/${ue}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:ge})}).catch(()=>{}),await Er("/api/messages",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:"user",to:ue,content:ge})});else{const Re=r.filter(Ie=>Ie.status==="running");await Promise.all(Re.map(Ie=>fetch(`/api/agents/${Ie.id}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:ge})}).catch(()=>{}))),await Er("/api/messages",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:"user",to:"all",content:ge})})}},[R,k,r]),te=J.useCallback(async()=>{await Er("/api/messages",{method:"DELETE"})},[]),ce=J.useCallback(async()=>{await Er("/api/file-changes",{method:"DELETE"})},[]),le=J.useCallback(ue=>{b(ue.id),p("terminal")},[]),pe=J.useCallback(ue=>{L(ue),u(!0)},[]);J.useEffect(()=>{const ue=["graph","terminal","files","prs","messages","context","crewmd"],ge=Re=>{const Ie=Re.target,ze=Ie.tagName==="INPUT"||Ie.tagName==="TEXTAREA"||Ie.tagName==="SELECT",Qe=Ie.closest(".xterm"),ut=Re.metaKey||Re.ctrlKey;if(Re.key==="Escape"){u(!1);return}const qe=ut&&(Re.key==="["||Re.key==="]"||Re.key==="\\");if(Qe&&qe)Re.stopPropagation();else if(ze||Qe)return;if(!ut)return;const pt=parseInt(Re.key);if(pt>=1&&pt<=ue.length){Re.preventDefault(),p(ue[pt-1]);return}switch(Re.key){case"n":Re.preventDefault(),L("spawn"),u(!0);break;case"o":Re.preventDefault(),L("open"),u(!0);break;case"[":{Re.preventDefault();const Ne=r.filter($e=>$e.status!=="dead");if(Ne.length===0)break;const Je=Ne.findIndex($e=>$e.id===C),ht=Je<=0?Ne.length-1:Je-1;b(Ne[ht].id),p("terminal");break}case"]":{Re.preventDefault();const Ne=r.filter($e=>$e.status!=="dead");if(Ne.length===0)break;const Je=Ne.findIndex($e=>$e.id===C),ht=Je>=Ne.length-1?0:Je+1;b(Ne[ht].id),p("terminal");break}case"\\":Re.preventDefault(),z(Ne=>Ne==="multi"?"single":"multi");break}};return document.addEventListener("keydown",ge,!0),()=>document.removeEventListener("keydown",ge,!0)},[r,C]);const Se=[{key:"graph",label:"Graph"},{key:"terminal",label:"Terminal"},{key:"files",label:"Files"},{key:"prs",label:"PRs"},{key:"messages",label:"Messages"},{key:"context",label:"Context"},{key:"crewmd",label:"Rules"}];return O.jsxs("div",{className:"app",children:[O.jsxs("header",{className:"app-header",children:[O.jsx("button",{className:"header-hamburger",onClick:()=>N(ue=>!ue),title:"Toggle sidebar",children:"☰"}),O.jsxs("div",{className:"header-brand",children:[O.jsx(sE,{size:26}),O.jsx("h1",{children:"Clustr"})]}),(()=>{const ue=r.reduce((ge,Re)=>ge+(Re.total_cost||0),0);return ue>0?O.jsxs("span",{className:"header-total-cost",children:["Total: $",ue.toFixed(4)]}):null})(),O.jsxs("div",{className:"header-actions",children:[window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"?O.jsx("button",{className:"header-connect-phone",onClick:B,title:"Connect phone",children:"Connect Phone"}):null,O.jsx("button",{onClick:()=>pe("open"),children:"Open Project"}),O.jsx("button",{className:"primary",onClick:()=>pe("spawn"),children:"New Agent"})]})]}),O.jsxs("div",{className:"app-body",children:[j&&O.jsx("div",{className:"sidebar-backdrop",onClick:()=>N(!1)}),O.jsxs("aside",{className:`sidebar ${j?"":"collapsed"}`,children:[O.jsx("button",{className:"sidebar-toggle",onClick:()=>N(ue=>!ue),title:j?"Collapse sidebar":"Expand sidebar",children:j?"‹":"›"}),j&&O.jsx(Qv,{agents:r,selectedId:C,onSelect:ue=>{b(ue.id),p("terminal"),window.innerWidth<768&&N(!1)},onKill:Z,onRemove:ie,onRollback:ae,onRestart:X})]}),O.jsxs("main",{className:"main-content",children:[O.jsxs("nav",{className:"tabs",children:[Se.map(ue=>O.jsx("button",{className:f===ue.key?"tab active":"tab",onClick:()=>p(ue.key),children:ue.label},ue.key)),f==="terminal"&&O.jsxs("div",{className:"terminal-view-toggle",children:[O.jsx("button",{className:`view-toggle-btn ${W==="multi"?"active":""}`,onClick:()=>z("multi"),title:"Split view — all agents",children:"⊞"}),O.jsx("button",{className:`view-toggle-btn ${W==="single"?"active":""}`,onClick:()=>z("single"),title:"Single view — selected agent",children:"☐"})]})]}),O.jsxs("div",{className:"tab-content",children:[f==="graph"&&O.jsx(ob,{agents:r,messages:i,onSelectAgent:le}),f==="terminal"&&W==="multi"&&O.jsx(qb,{agents:r,socket:e,onSelectAgent:ue=>b(ue.id)}),f==="terminal"&&W==="single"&&O.jsx(zb,{agent:x,socket:e}),f==="messages"&&O.jsx(Kb,{messages:i,agents:r,selectedAgentId:(x==null?void 0:x.id)??null,onClear:te}),f==="context"&&O.jsx(Xb,{entries:o,onRemove:H}),f==="files"&&O.jsx(Jb,{changes:y,agents:r,onClear:ce}),f==="prs"&&O.jsx(tE,{prs:a,branches:l,currentBranch:_,ghAvailable:v,repoInfo:c,agents:r,fetchPRDetail:m}),f==="crewmd"&&O.jsx(rE,{content:h,onChange:S})]})]})]}),O.jsxs("footer",{className:"app-footer",children:[O.jsxs("select",{value:k,onChange:ue=>M(ue.target.value),children:[O.jsx("option",{value:"all",children:"All Agents"}),r.filter(ue=>ue.status==="running").map(ue=>O.jsx("option",{value:ue.id,children:ue.name},ue.id))]}),O.jsx("input",{type:"text",placeholder:k==="all"?"Broadcast message to all agents...":`Send message to ${((be=r.find(ue=>ue.id===k))==null?void 0:be.name)||"agent"}...`,value:R,onChange:ue=>D(ue.target.value),onKeyDown:ue=>ue.key==="Enter"&&re()}),O.jsx("button",{className:"primary",onClick:re,disabled:!R.trim(),children:"Send"})]}),d&&O.jsx(iE,{onSpawn:G,onClose:()=>{u(!1),F(null)},initialMode:w,error:P}),I&&O.jsx("div",{className:"pair-modal-overlay",onClick:()=>q(!1),children:O.jsxs("div",{className:"pair-modal",onClick:ue=>ue.stopPropagation(),children:[O.jsxs("div",{className:"pair-modal-header",children:[O.jsx("h2",{children:"Connect Phone"}),O.jsx("button",{className:"pair-modal-close",onClick:()=>q(!1),children:"✕"})]}),V?O.jsx("p",{className:"pair-modal-error",children:V}):U?O.jsxs(O.Fragment,{children:[O.jsx("p",{className:"pair-modal-hint",children:"Scan to open Clustr on your phone's browser"}),O.jsx("img",{className:"pair-qr",src:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(U.qrSvg)}`,alt:"QR code to connect phone"}),O.jsxs("div",{className:"pair-urls",children:[O.jsxs("div",{className:"pair-url-row",children:[O.jsx("span",{className:"pair-url-label",children:"Local"}),O.jsxs("span",{className:"pair-url-text",children:[U.localUrl,"?token=…"]}),O.jsx("button",{onClick:()=>navigator.clipboard.writeText(`${U.localUrl}?token=${U.token}`),children:"Copy"})]}),U.remoteUrl&&O.jsxs("div",{className:"pair-url-row",children:[O.jsx("span",{className:"pair-url-label",children:"Remote"}),O.jsxs("span",{className:"pair-url-text",children:[U.remoteUrl,"?token=…"]}),O.jsx("button",{onClick:()=>navigator.clipboard.writeText(`${U.remoteUrl}?token=${U.token}`),children:"Copy"})]}),!U.remoteUrl&&O.jsxs("p",{className:"pair-tunnel-hint",children:["Set ",O.jsx("code",{children:"CLUSTR_TUNNEL=1"})," to enable remote access via Cloudflare Tunnel."]})]})]}):O.jsx("p",{className:"pair-modal-loading",children:"Loading pairing info…"})]})})]})}tv.createRoot(document.getElementById("root")).render(O.jsx(Hu.StrictMode,{children:O.jsx(oE,{})}));
110
+ `)},T=Y=>{var ae,X;const Z=(ae=Y.clipboardData)==null?void 0:ae.items;if(!Z)return;for(const H of Z)if(H.type.startsWith("image/")){Y.preventDefault(),Y.stopPropagation();const re=H.getAsFile();re&&V(re);return}const ie=(X=Y.clipboardData)==null?void 0:X.getData("text/plain");if(ie){Y.preventDefault(),Y.stopPropagation();const H=ie.replace(/\r\n|\r|\n/g," ");d.emit("agent:input",K,H)}},B=Y=>{var Z,ie;(ie=(Z=Y.dataTransfer)==null?void 0:Z.types)!=null&&ie.includes("Files")&&(Y.preventDefault(),Y.stopPropagation())},P=Y=>{var ie;const Z=(ie=Y.dataTransfer)==null?void 0:ie.files;if(!(!Z||Z.length===0)){for(const ae of Z)if(ae.type.startsWith("image/")){Y.preventDefault(),Y.stopPropagation(),V(ae);return}}};U==null||U.addEventListener("paste",T,!0),U==null||U.addEventListener("dragover",B,!0),U==null||U.addEventListener("drop",P,!0);const F=()=>{d.off(j,N),I.dispose(),q.disconnect(),U==null||U.removeEventListener("paste",T,!0),U==null||U.removeEventListener("dragover",B,!0),U==null||U.removeEventListener("drop",P,!0)};w.set(D.id,{term:M,fit:W,cleanup:F})}return()=>{var D;for(const[,k]of w)(D=k.cleanup)==null||D.call(k),k.term.dispose();w.clear()}},[c.map(d=>d.id).join(","),r.current]);const b=J.useCallback(d=>{a(d.id);const u=o.current.get(d.id);u&&u.term.focus(),i==null||i(d)},[i]),x=J.useCallback((d,u)=>{if(!S.current)return;const w=S.current.offsetWidth,L=u/w*100;_(R=>{const D=[...R],k=10,M=D[d]+L,W=D[d+1]-L;return M>=k&&W>=k&&(D[d]=M,D[d+1]=W),D})},[]),f=c.length;if(f===0)return O.jsxs("div",{className:"multi-term-empty",children:[O.jsx("div",{className:"multi-term-empty-icon",children:"_"}),O.jsx("div",{className:"multi-term-empty-text",children:"No running agents"})]});const p=l.length===f?l:Array(f).fill(100/f);return O.jsx("div",{className:"multi-term-container",ref:S,children:c.map((d,u)=>O.jsxs(Hu.Fragment,{children:[O.jsxs("div",{className:`multi-term-pane ${y===d.id?"focused":""}`,style:{flexBasis:`${p[u]}%`},onClick:()=>b(d),children:[O.jsxs("div",{className:"multi-term-pane-header",children:[O.jsx("span",{className:"multi-term-status-dot",style:{background:Ub(d.status)}}),O.jsx("span",{className:"multi-term-pane-name",children:d.name}),O.jsx("span",{className:"multi-term-pane-task",children:d.task})]}),O.jsx("div",{className:"multi-term-pane-body",ref:C(d.id)})]}),u<f-1&&O.jsx(Vb,{orientation:"horizontal",onDrag:w=>x(u,w)})]},d.id))})}function Kb({messages:e,agents:r,selectedAgentId:i,onClear:o}){const h=J.useRef(null),S=J.useMemo(()=>{const a={user:"User"};return r.forEach(l=>{a[l.id]=l.name}),a},[r]),y=J.useMemo(()=>i?e.filter(a=>a.from_agent===i||a.to_agent===i):e,[e,i]);return J.useEffect(()=>{var a;(a=h.current)==null||a.scrollIntoView({behavior:"smooth"})},[y]),O.jsxs("div",{className:"message-feed",children:[O.jsxs("div",{className:"message-feed-header",children:[O.jsx("span",{children:i?`Messages for ${S[i]||i}`:"All Messages"}),y.length>0&&O.jsx("button",{className:"clear-messages-btn",onClick:o,children:"Clear All"})]}),O.jsxs("div",{className:"message-feed-list",children:[y.length===0&&O.jsx("div",{className:"message-feed-empty",children:"No messages yet"}),[...y].reverse().map(a=>O.jsxs("div",{className:"message-item",children:[O.jsxs("div",{className:"message-meta",children:[O.jsx("span",{className:"message-from",children:S[a.from_agent]||a.from_agent.slice(0,8)}),O.jsx("span",{className:"message-arrow",children:" → "}),O.jsx("span",{className:"message-to",children:a.to_agent==="all"?"All":S[a.to_agent]||a.to_agent.slice(0,8)}),O.jsx("span",{className:"message-time",children:new Date(a.created_at).toLocaleTimeString()})]}),O.jsx("div",{className:"message-content",children:a.content})]},a.id)),O.jsx("div",{ref:h})]})]})}function Xb({entries:e,onRemove:r}){return O.jsxs("div",{className:"context-viewer",children:[O.jsx("div",{className:"context-header",children:"Shared Context"}),e.length===0&&O.jsx("div",{className:"context-empty",children:"No context entries yet"}),O.jsxs("table",{className:"context-table",children:[O.jsx("thead",{children:O.jsxs("tr",{children:[O.jsx("th",{children:"Key"}),O.jsx("th",{children:"Value"}),O.jsx("th",{children:"Updated By"}),O.jsx("th",{children:"Updated At"}),O.jsx("th",{})]})}),O.jsx("tbody",{children:e.map(i=>O.jsxs("tr",{children:[O.jsx("td",{className:"context-key",children:i.key}),O.jsx("td",{className:"context-value",children:i.value}),O.jsx("td",{children:i.updated_by||"—"}),O.jsx("td",{className:"context-time",children:i.updated_at?new Date(i.updated_at).toLocaleTimeString():"—"}),O.jsx("td",{children:O.jsx("button",{className:"context-remove-btn",onClick:()=>r(i.key),title:`Remove "${i.key}"`,children:"✕"})})]},i.key))})]})]})}function Yb({diff:e,fileName:r}){const i=e.split(`
111
+ `);return O.jsxs("div",{className:"diff-viewer",children:[r&&O.jsx("div",{className:"diff-filename",children:r}),O.jsx("pre",{className:"diff-content",children:i.map((o,h)=>{let S="diff-line";return o.startsWith("+")&&!o.startsWith("+++")?S+=" diff-add":o.startsWith("-")&&!o.startsWith("---")?S+=" diff-del":o.startsWith("@@")?S+=" diff-hunk":o.startsWith("\\")&&(S+=" diff-meta"),O.jsx("div",{className:S,children:o},h)})})]})}function Gb(e){switch(e){case"add":return"A";case"change":return"M";case"unlink":return"D";default:return"?"}}function Qb(e){switch(e){case"add":return"#4ade80";case"change":return"#fbbf24";case"unlink":return"#f87171";default:return"#666"}}function Jb({changes:e,agents:r,onClear:i}){const[o,h]=J.useState(null),S=J.useMemo(()=>{const y=new Map;for(const a of r)y.set(a.id,a.name);return y},[r]);return O.jsxs("div",{className:"file-changes",children:[O.jsxs("div",{className:"file-changes-header",children:[O.jsxs("span",{children:["File Changes (",e.length,")"]}),e.length>0&&O.jsx("button",{className:"file-changes-clear-btn",onClick:i,children:"Clear"})]}),O.jsxs("div",{className:"file-changes-list",children:[e.length===0&&O.jsx("div",{className:"file-changes-empty",children:"No file changes detected yet. Changes will appear here as agents edit files."}),e.map(y=>{const a=y.agent_id?S.get(y.agent_id):null;return O.jsxs("div",{className:"file-change-item",children:[O.jsxs("div",{className:"file-change-row",onClick:()=>h(o===y.id?null:y.id),children:[O.jsx("span",{className:"file-change-type",style:{color:Qb(y.change_type)},children:Gb(y.change_type)}),O.jsx("span",{className:"file-change-path",children:y.file_path}),a&&O.jsx("span",{className:"file-change-agent",title:"Agent that made this change",children:a}),O.jsx("span",{className:"file-change-time",children:new Date(y.created_at).toLocaleTimeString()}),O.jsx("span",{className:"file-change-expand",children:y.diff_text?o===y.id?"▼":"▶":""})]}),o===y.id&&y.diff_text&&O.jsx(Yb,{diff:y.diff_text})]},y.id)})]})]})}function la(e){const r=Date.now()-new Date(e).getTime(),i=Math.floor(r/6e4);if(i<1)return"just now";if(i<60)return`${i}m ago`;const o=Math.floor(i/60);if(o<24)return`${o}h ago`;const h=Math.floor(o/24);return h<30?`${h}d ago`:`${Math.floor(h/30)}mo ago`}function Zb(e){return!e||e.length===0?{icon:"",cls:""}:e.some(o=>o.conclusion==="FAILURE"||o.conclusion==="failure")?{icon:"✗",cls:"failure"}:e.some(o=>!o.conclusion||o.status==="IN_PROGRESS"||o.status==="QUEUED")?{icon:"○",cls:"pending"}:{icon:"✓",cls:"success"}}function eE(e){switch(e){case"APPROVED":return{text:"Approved",cls:"approved"};case"CHANGES_REQUESTED":return{text:"Changes",cls:"changes_requested"};case"REVIEW_REQUIRED":return{text:"Review",cls:"review_required"};default:return null}}function tE({prs:e,branches:r,currentBranch:i,ghAvailable:o,repoInfo:h,agents:S,fetchPRDetail:y}){const[a,l]=J.useState("all"),[_,v]=J.useState(null),[c,m]=J.useState(null),[C,b]=J.useState(!1),[x,f]=J.useState(!0),p=J.useMemo(()=>a==="all"?e:e.filter(L=>L.state.toUpperCase()===a.toUpperCase()),[e,a]),d=J.useMemo(()=>new Set(S.map(L=>L.name.toLowerCase())),[S]),u=async L=>{if(_===L){v(null),m(null);return}v(L),m(null),b(!0);const R=await y(L);m(R),b(!1)},w=L=>{const R=L.name.toLowerCase();for(const k of d)if(R.includes(k))return k;const D=L.author.toLowerCase();for(const k of d)if(D.includes(k))return k;return null};return O.jsxs("div",{className:"prs-tab",children:[O.jsxs("div",{className:"prs-header",children:[O.jsxs("div",{className:"prs-header-left",children:[O.jsxs("span",{children:["Pull Requests (",p.length,")"]}),O.jsxs("select",{className:"prs-filter",value:a,onChange:L=>l(L.target.value),children:[O.jsx("option",{value:"all",children:"All"}),O.jsx("option",{value:"open",children:"Open"}),O.jsx("option",{value:"closed",children:"Closed"}),O.jsx("option",{value:"merged",children:"Merged"})]})]}),h&&O.jsx("a",{className:"prs-repo-link",href:h.url,target:"_blank",rel:"noopener noreferrer",onClick:L=>{L.preventDefault(),window.open(h.url,"_blank")},children:h.nameWithOwner})]}),O.jsxs("div",{className:"prs-list",children:[o===!1&&O.jsxs("div",{className:"prs-unavailable",children:["GitHub CLI not available.",O.jsx("br",{}),"Install ",O.jsx("code",{children:"gh"})," and run ",O.jsx("code",{children:"gh auth login"})," to see PRs."]}),o!==!1&&p.length===0&&O.jsx("div",{className:"prs-empty",children:"No pull requests found."}),p.map(L=>{const R=L.isDraft?"draft":L.state.toLowerCase(),D=Zb(L.statusCheckRollup),k=eE(L.reviewDecision),M=_===L.number;return O.jsxs("div",{className:"pr-item",children:[O.jsxs("div",{className:"pr-row",onClick:()=>u(L.number),children:[O.jsx("span",{className:"pr-expand",children:M?"▼":"▶"}),O.jsx("span",{className:`pr-status-badge ${R}`}),O.jsxs("span",{className:"pr-number",children:["#",L.number]}),O.jsx("span",{className:"pr-title",children:L.title}),k&&O.jsx("span",{className:`pr-review ${k.cls}`,children:k.text}),D.icon&&O.jsx("span",{className:`pr-ci ${D.cls}`,children:D.icon}),O.jsx("span",{className:"pr-branch",title:L.headRefName,children:L.headRefName}),O.jsx("span",{className:"pr-author",children:L.author.login}),O.jsx("span",{className:"pr-time",children:la(L.createdAt)}),O.jsx("button",{className:"pr-link-btn",title:"Open in GitHub",onClick:W=>{W.stopPropagation(),window.open(L.url,"_blank")},children:"↗"})]}),M&&O.jsxs("div",{className:"pr-detail",children:[C&&O.jsx("div",{className:"pr-detail-loading",children:"Loading..."}),c&&c.number===L.number&&O.jsxs(O.Fragment,{children:[c.body&&O.jsx("div",{className:"pr-detail-body",children:c.body}),c.statusCheckRollup&&c.statusCheckRollup.length>0&&O.jsxs(O.Fragment,{children:[O.jsx("div",{className:"pr-detail-section-title",children:"Checks"}),O.jsx("div",{className:"pr-detail-checks",children:c.statusCheckRollup.map((W,z)=>{var j,N,I,q;return O.jsxs("span",{className:`pr-check ${((j=W.conclusion)==null?void 0:j.toLowerCase())==="success"?"success":((N=W.conclusion)==null?void 0:N.toLowerCase())==="failure"?"failure":"pending"}`,children:[((I=W.conclusion)==null?void 0:I.toLowerCase())==="success"?"✓":((q=W.conclusion)==null?void 0:q.toLowerCase())==="failure"?"✗":"○"," ",W.name]},z)})})]}),c.reviews&&c.reviews.length>0&&O.jsxs(O.Fragment,{children:[O.jsx("div",{className:"pr-detail-section-title",children:"Reviews"}),c.reviews.map((W,z)=>O.jsxs("div",{className:"pr-comment",children:[O.jsxs("div",{className:"pr-comment-header",children:[O.jsx("strong",{children:W.author.login})," ",W.state.toLowerCase().replace("_"," ")," ",la(W.submittedAt)]}),W.body&&O.jsx("div",{className:"pr-comment-body",children:W.body})]},z))]}),c.comments&&c.comments.length>0&&O.jsxs(O.Fragment,{children:[O.jsx("div",{className:"pr-detail-section-title",children:"Comments"}),c.comments.map((W,z)=>O.jsxs("div",{className:"pr-comment",children:[O.jsxs("div",{className:"pr-comment-header",children:[O.jsx("strong",{children:W.author.login})," ",la(W.createdAt)]}),O.jsx("div",{className:"pr-comment-body",children:W.body})]},z))]}),(!c.reviews||c.reviews.length===0)&&(!c.comments||c.comments.length===0)&&!c.body&&O.jsx("div",{className:"pr-detail-loading",children:"No details available."})]})]})]},L.number)})]}),O.jsxs("div",{className:"branches-section",children:[O.jsxs("div",{className:"branches-header",onClick:()=>f(L=>!L),children:[O.jsxs("span",{children:["Branches (",r.length,")",i?` — ${i}`:""]}),O.jsx("span",{className:"branches-toggle",children:x?"▼":"▶"})]}),x&&O.jsxs("div",{className:"branches-list",children:[r.length===0&&O.jsx("div",{className:"prs-empty",children:"No branches found."}),r.map(L=>{const R=w(L);return O.jsxs("div",{className:`branch-item ${L.isCurrent?"current":""}`,children:[O.jsx("span",{className:"branch-current-marker",children:L.isCurrent?"●":""}),O.jsx("span",{className:`branch-name ${L.isCurrent?"current":""}`,title:L.name,children:L.name}),O.jsx("span",{className:"branch-message",children:L.lastCommitMessage}),R&&O.jsx("span",{className:"pr-branch",children:R}),O.jsx("span",{className:"branch-author",children:L.author}),O.jsxs("div",{className:"branch-ahead-behind",children:[L.ahead>0&&O.jsxs("span",{className:"branch-badge ahead",children:[L.ahead,"\\u2191"]}),L.behind>0&&O.jsxs("span",{className:"branch-badge behind",children:[L.behind,"\\u2193"]})]}),O.jsx("span",{className:"branch-time",children:L.lastCommitDate?la(L.lastCommitDate):""})]},L.name)})]})]})]})}function rE({content:e,onChange:r}){const[i,o]=J.useState(e),[h,S]=J.useState(!1),[y,a]=J.useState(!1),l=J.useRef(null);J.useEffect(()=>{y||o(e)},[e,y]);const _=m=>{o(m),a(!0)},v=async()=>{S(!0);try{await fetch("/api/crewmd",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i})}),r(i),a(!1)}catch{}S(!1)},c=m=>{(m.metaKey||m.ctrlKey)&&m.key==="s"&&(m.preventDefault(),y&&v())};return O.jsxs("div",{className:"crewmd-editor",children:[O.jsxs("div",{className:"crewmd-header",children:[O.jsx("span",{className:"crewmd-title",children:"Rules"}),O.jsxs("div",{className:"crewmd-actions",children:[y&&O.jsx("span",{className:"crewmd-dirty",children:"unsaved"}),O.jsx("button",{className:"crewmd-save-btn",onClick:v,disabled:!y||h,children:h?"Saving...":"Save"})]})]}),O.jsx("textarea",{ref:l,className:"crewmd-textarea",value:i,onChange:m=>_(m.target.value),onKeyDown:c,spellCheck:!1,placeholder:"Write global instructions for all agents..."})]})}function nE(e){const[r,i]=J.useState([]),[o,h]=J.useState([]),[S,y]=J.useState(""),[a,l]=J.useState(null),[_,v]=J.useState(null),[c,m]=J.useState(!0);J.useEffect(()=>{fetch("/api/github/status").then(b=>b.json()).then(b=>{l(b.available),v(b.repo||null)}).catch(()=>l(!1)),fetch("/api/github/prs?state=all").then(b=>b.json()).then(b=>{Array.isArray(b)&&i(b)}).catch(()=>{}),fetch("/api/git/branches").then(b=>b.json()).then(b=>{b.current&&y(b.current),Array.isArray(b.branches)&&h(b.branches)}).catch(()=>{}).finally(()=>m(!1))},[]),J.useEffect(()=>{const b=e.current;if(!b)return;const x=p=>{Array.isArray(p)&&i(p)},f=p=>{p.current&&y(p.current),Array.isArray(p.branches)&&h(p.branches)};return b.on("github:prs:updated",x),b.on("git:branches:updated",f),()=>{b.off("github:prs:updated",x),b.off("git:branches:updated",f)}},[e]);const C=J.useCallback(async b=>{try{const x=await fetch(`/api/github/prs/${b}`);return x.ok?await x.json():null}catch{return null}},[]);return{prs:r,branches:o,currentBranch:S,ghAvailable:a,repoInfo:_,loading:c,fetchPRDetail:C}}function iE({onSpawn:e,onClose:r,initialMode:i="spawn",error:o}){const[h,S]=J.useState(i),[y,a]=J.useState(""),[l,_]=J.useState(""),[v,c]=J.useState(""),[m,C]=J.useState("claude"),[b,x]=J.useState(!1),f=async()=>{x(!0);try{const u=await(await fetch("/api/pick-folder",{method:"POST"})).json();u.path&&c(u.path)}catch{}x(!1)},p=()=>{if(h==="open"){if(!v.trim())return;const d=v.trim().split("/").filter(Boolean).pop()||"project";e(y.trim()||d,l.trim()||`Work on the project at ${v.trim()}. Explore the codebase and wait for instructions.`,v.trim(),m)}else{if(!y.trim()||!l.trim())return;e(y.trim(),l.trim(),v.trim()||void 0,m)}};return O.jsx("div",{className:"dialog-overlay",onClick:r,children:O.jsxs("div",{className:"dialog",onClick:d=>d.stopPropagation(),children:[O.jsxs("div",{className:"dialog-mode-tabs",children:[O.jsx("button",{className:`dialog-mode-tab ${h==="spawn"?"active":""}`,onClick:()=>S("spawn"),children:"Spawn Agent"}),O.jsx("button",{className:`dialog-mode-tab ${h==="open"?"active":""}`,onClick:()=>S("open"),children:"Open Project"})]}),O.jsxs("label",{children:["Agent Service",O.jsxs("div",{className:"service-selector",children:[O.jsx("button",{type:"button",className:`service-btn ${m==="claude"?"active":""}`,onClick:()=>C("claude"),children:"Claude"}),O.jsx("button",{type:"button",className:`service-btn ${m==="codex"?"active":""}`,onClick:()=>C("codex"),children:"Codex"})]})]}),h==="open"?O.jsxs(O.Fragment,{children:[O.jsxs("label",{children:["Project Directory",O.jsxs("div",{className:"browse-row",children:[O.jsx("input",{type:"text",value:v,onChange:d=>c(d.target.value),placeholder:"/Users/you/your-project",autoFocus:!0}),O.jsx("button",{type:"button",className:"browse-btn",onClick:f,disabled:b,children:b?"...":"Browse"})]})]}),O.jsxs("label",{children:["Agent Name ",O.jsx("span",{className:"optional",children:"(optional)"}),O.jsx("input",{type:"text",value:y,onChange:d=>a(d.target.value),placeholder:"Auto-detected from path"})]}),O.jsxs("label",{children:["Initial Task ",O.jsx("span",{className:"optional",children:"(optional)"}),O.jsx("textarea",{value:l,onChange:d=>_(d.target.value),placeholder:"Explore the codebase and wait for instructions...",rows:3})]})]}):O.jsxs(O.Fragment,{children:[O.jsxs("label",{children:["Name",O.jsx("input",{type:"text",value:y,onChange:d=>a(d.target.value),placeholder:"e.g. researcher",autoFocus:!0})]}),O.jsxs("label",{children:["Task",O.jsx("textarea",{value:l,onChange:d=>_(d.target.value),placeholder:"Describe what this agent should do...",rows:4})]}),O.jsxs("label",{children:["Working Directory ",O.jsx("span",{className:"optional",children:"(optional)"}),O.jsxs("div",{className:"browse-row",children:[O.jsx("input",{type:"text",value:v,onChange:d=>c(d.target.value),placeholder:"e.g. /Users/you/project (leave blank for server cwd)"}),O.jsx("button",{type:"button",className:"browse-btn",onClick:f,disabled:b,children:b?"...":"Browse"})]})]})]}),o&&O.jsx("div",{className:"dialog-error",children:o}),O.jsxs("div",{className:"dialog-actions",children:[O.jsx("button",{onClick:r,children:"Cancel"}),O.jsx("button",{className:"primary",onClick:p,children:h==="open"?"Open":"Spawn"})]})]})})}function sE({size:e=28}){return O.jsxs("svg",{width:e,height:e,viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[O.jsx("path",{d:"M50 5 A45 45 0 1 1 15 75",stroke:"currentColor",strokeWidth:"6",strokeLinecap:"round",fill:"none"}),O.jsx("path",{d:"M30 18 Q55 45 78 30",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round",fill:"none"}),O.jsx("path",{d:"M20 55 Q50 35 75 65",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round",fill:"none"}),O.jsx("path",{d:"M22 72 Q50 60 50 90",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round",fill:"none"}),O.jsx("circle",{cx:"30",cy:"18",r:"6",fill:"currentColor"}),O.jsx("circle",{cx:"78",cy:"30",r:"6",fill:"currentColor"}),O.jsx("circle",{cx:"75",cy:"65",r:"6",fill:"currentColor"}),O.jsx("circle",{cx:"22",cy:"72",r:"6",fill:"currentColor"}),O.jsx("circle",{cx:"50",cy:"90",r:"5.5",fill:"currentColor"})]})}function oE(){var be;const{socket:e,agents:r,messages:i,contextEntries:o,crewMd:h,setCrewMd:S,fileChanges:y}=Yv(),{prs:a,branches:l,currentBranch:_,ghAvailable:v,repoInfo:c,fetchPRDetail:m}=nE(e),[C,b]=J.useState(null),x=r.find(ue=>ue.id===C)??null,[f,p]=J.useState("graph"),[d,u]=J.useState(!1),[w,L]=J.useState("spawn"),[R,D]=J.useState(""),[k,M]=J.useState("all"),[W,z]=J.useState("multi"),[j,N]=J.useState(()=>window.innerWidth>=768),[I,q]=J.useState(!1),[U,K]=J.useState(null),[V,T]=J.useState(null),B=J.useCallback(async()=>{q(!0),T(null);try{const ue=await fetch("/api/pair");if(!ue.ok){const Re=await ue.text();T(Re||`Error ${ue.status}`);return}const ge=await ue.json();K(ge)}catch(ue){T(ue.message||"Failed to load pairing info")}},[]),[P,F]=J.useState(null),Y=J.useCallback(async(ue,ge,Re,Ie)=>{F(null);try{const ze=await Er("/api/spawn",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:ue,task:ge,cwd:Re,service:Ie||"claude"})}),Qe=await ze.json();if(!ze.ok){F(Qe.error||"Unknown error");return}u(!1),F(null)}catch(ze){F(ze.message||"Failed to connect to server")}},[]),Z=J.useCallback(async ue=>{await fetch(`/api/agents/${ue}`,{method:"DELETE"})},[]),ie=J.useCallback(async ue=>{await fetch(`/api/agents/${ue}/remove`,{method:"DELETE"}),C===ue&&b(null)},[C]),ae=J.useCallback(async ue=>{await fetch(`/api/agents/${ue}/rollback`,{method:"POST"})},[]),X=J.useCallback(async ue=>{await fetch(`/api/agents/${ue.id}/remove`,{method:"DELETE"});const Re=await(await Er("/api/spawn",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:ue.name,task:ue.task,cwd:ue.agent_cwd||void 0,service:ue.service||"claude"})})).json();Re.id&&(b(Re.id),p("terminal"))},[]),H=J.useCallback(async ue=>{await fetch(`/api/context/${encodeURIComponent(ue)}`,{method:"DELETE"})},[]),re=J.useCallback(async()=>{if(!R.trim())return;const ue=k,ge=R;if(D(""),ue!=="all")await fetch(`/api/agents/${ue}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:ge})}).catch(()=>{}),await Er("/api/messages",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:"user",to:ue,content:ge})});else{const Re=r.filter(Ie=>Ie.status==="running");await Promise.all(Re.map(Ie=>fetch(`/api/agents/${Ie.id}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:ge})}).catch(()=>{}))),await Er("/api/messages",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:"user",to:"all",content:ge})})}},[R,k,r]),te=J.useCallback(async()=>{await Er("/api/messages",{method:"DELETE"})},[]),ce=J.useCallback(async()=>{await Er("/api/file-changes",{method:"DELETE"})},[]),le=J.useCallback(ue=>{b(ue.id),p("terminal")},[]),pe=J.useCallback(ue=>{L(ue),u(!0)},[]);J.useEffect(()=>{const ue=["graph","terminal","files","prs","messages","context","crewmd"],ge=Re=>{const Ie=Re.target,ze=Ie.tagName==="INPUT"||Ie.tagName==="TEXTAREA"||Ie.tagName==="SELECT",Qe=Ie.closest(".xterm"),ut=Re.metaKey||Re.ctrlKey;if(Re.key==="Escape"){u(!1);return}const qe=ut&&(Re.key==="["||Re.key==="]"||Re.key==="\\");if(Qe&&qe)Re.stopPropagation();else if(ze||Qe)return;if(!ut)return;const pt=parseInt(Re.key);if(pt>=1&&pt<=ue.length){Re.preventDefault(),p(ue[pt-1]);return}switch(Re.key){case"n":Re.preventDefault(),L("spawn"),u(!0);break;case"o":Re.preventDefault(),L("open"),u(!0);break;case"[":{Re.preventDefault();const Ne=r.filter($e=>$e.status!=="dead");if(Ne.length===0)break;const Je=Ne.findIndex($e=>$e.id===C),ht=Je<=0?Ne.length-1:Je-1;b(Ne[ht].id),p("terminal");break}case"]":{Re.preventDefault();const Ne=r.filter($e=>$e.status!=="dead");if(Ne.length===0)break;const Je=Ne.findIndex($e=>$e.id===C),ht=Je>=Ne.length-1?0:Je+1;b(Ne[ht].id),p("terminal");break}case"\\":Re.preventDefault(),z(Ne=>Ne==="multi"?"single":"multi");break}};return document.addEventListener("keydown",ge,!0),()=>document.removeEventListener("keydown",ge,!0)},[r,C]);const Se=[{key:"graph",label:"Graph"},{key:"terminal",label:"Terminal"},{key:"files",label:"Files"},{key:"prs",label:"PRs"},{key:"messages",label:"Messages"},{key:"context",label:"Context"},{key:"crewmd",label:"Rules"}];return O.jsxs("div",{className:"app",children:[O.jsxs("header",{className:"app-header",children:[O.jsx("button",{className:"header-hamburger",onClick:()=>N(ue=>!ue),title:"Toggle sidebar",children:"☰"}),O.jsxs("div",{className:"header-brand",children:[O.jsx(sE,{size:26}),O.jsx("h1",{children:"Clustr"})]}),(()=>{const ue=r.reduce((ge,Re)=>ge+(Re.total_cost||0),0);return ue>0?O.jsxs("span",{className:"header-total-cost",children:["Total: $",ue.toFixed(4)]}):null})(),O.jsxs("div",{className:"header-actions",children:[window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"?O.jsx("button",{className:"header-connect-phone",onClick:B,title:"Connect phone",children:"Connect Phone"}):null,O.jsx("button",{onClick:()=>pe("open"),children:"Open Project"}),O.jsx("button",{className:"primary",onClick:()=>pe("spawn"),children:"New Agent"})]})]}),O.jsxs("div",{className:"app-body",children:[j&&O.jsx("div",{className:"sidebar-backdrop",onClick:()=>N(!1)}),O.jsxs("aside",{className:`sidebar ${j?"":"collapsed"}`,children:[O.jsx("button",{className:"sidebar-toggle",onClick:()=>N(ue=>!ue),title:j?"Collapse sidebar":"Expand sidebar",children:j?"‹":"›"}),j&&O.jsx(Qv,{agents:r,selectedId:C,onSelect:ue=>{b(ue.id),p("terminal"),window.innerWidth<768&&N(!1)},onKill:Z,onRemove:ie,onRollback:ae,onRestart:X})]}),O.jsxs("main",{className:"main-content",children:[O.jsxs("nav",{className:"tabs",children:[Se.map(ue=>O.jsx("button",{className:f===ue.key?"tab active":"tab",onClick:()=>p(ue.key),children:ue.label},ue.key)),f==="terminal"&&O.jsxs("div",{className:"terminal-view-toggle",children:[O.jsx("button",{className:`view-toggle-btn ${W==="multi"?"active":""}`,onClick:()=>z("multi"),title:"Split view — all agents",children:"⊞"}),O.jsx("button",{className:`view-toggle-btn ${W==="single"?"active":""}`,onClick:()=>z("single"),title:"Single view — selected agent",children:"☐"})]})]}),O.jsxs("div",{className:"tab-content",children:[f==="graph"&&O.jsx(ob,{agents:r,messages:i,onSelectAgent:le}),f==="terminal"&&W==="multi"&&O.jsx(qb,{agents:r,socket:e,onSelectAgent:ue=>b(ue.id)}),f==="terminal"&&W==="single"&&O.jsx(zb,{agent:x,socket:e}),f==="messages"&&O.jsx(Kb,{messages:i,agents:r,selectedAgentId:(x==null?void 0:x.id)??null,onClear:te}),f==="context"&&O.jsx(Xb,{entries:o,onRemove:H}),f==="files"&&O.jsx(Jb,{changes:y,agents:r,onClear:ce}),f==="prs"&&O.jsx(tE,{prs:a,branches:l,currentBranch:_,ghAvailable:v,repoInfo:c,agents:r,fetchPRDetail:m}),f==="crewmd"&&O.jsx(rE,{content:h,onChange:S})]})]})]}),O.jsxs("footer",{className:"app-footer",children:[O.jsxs("select",{value:k,onChange:ue=>M(ue.target.value),children:[O.jsx("option",{value:"all",children:"All Agents"}),r.filter(ue=>ue.status==="running").map(ue=>O.jsx("option",{value:ue.id,children:ue.name},ue.id))]}),O.jsx("input",{type:"text",placeholder:k==="all"?"Broadcast message to all agents...":`Send message to ${((be=r.find(ue=>ue.id===k))==null?void 0:be.name)||"agent"}...`,value:R,onChange:ue=>D(ue.target.value),onKeyDown:ue=>ue.key==="Enter"&&re()}),O.jsx("button",{className:"primary",onClick:re,disabled:!R.trim(),children:"Send"})]}),d&&O.jsx(iE,{onSpawn:Y,onClose:()=>{u(!1),F(null)},initialMode:w,error:P}),I&&O.jsx("div",{className:"pair-modal-overlay",onClick:()=>q(!1),children:O.jsxs("div",{className:"pair-modal",onClick:ue=>ue.stopPropagation(),children:[O.jsxs("div",{className:"pair-modal-header",children:[O.jsx("h2",{children:"Connect Phone"}),O.jsx("button",{className:"pair-modal-close",onClick:()=>q(!1),children:"✕"})]}),V?O.jsx("p",{className:"pair-modal-error",children:V}):U?O.jsxs(O.Fragment,{children:[O.jsx("p",{className:"pair-modal-hint",children:"Scan to open Clustr on your phone's browser"}),O.jsx("img",{className:"pair-qr",src:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(U.qrSvg)}`,alt:"QR code to connect phone"}),O.jsxs("div",{className:"pair-urls",children:[O.jsxs("div",{className:"pair-url-row",children:[O.jsx("span",{className:"pair-url-label",children:"Local"}),O.jsxs("span",{className:"pair-url-text",children:[U.localUrl,"?token=…"]}),O.jsx("button",{onClick:()=>navigator.clipboard.writeText(`${U.localUrl}?token=${U.token}`),children:"Copy"})]}),U.remoteUrl&&O.jsxs("div",{className:"pair-url-row",children:[O.jsx("span",{className:"pair-url-label",children:"Remote"}),O.jsxs("span",{className:"pair-url-text",children:[U.remoteUrl,"?token=…"]}),O.jsx("button",{onClick:()=>navigator.clipboard.writeText(`${U.remoteUrl}?token=${U.token}`),children:"Copy"})]}),!U.remoteUrl&&O.jsxs("p",{className:"pair-tunnel-hint",children:["Set ",O.jsx("code",{children:"CLUSTR_TUNNEL=1"})," to enable remote access via Cloudflare Tunnel."]})]})]}):O.jsx("p",{className:"pair-modal-loading",children:"Loading pairing info…"})]})})]})}tv.createRoot(document.getElementById("root")).render(O.jsx(Hu.StrictMode,{children:O.jsx(oE,{})}));