agent-dag 1.33.147 → 1.33.148
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 bw;function MR(){if(bw)return qe;bw=1;var e=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),u=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),m=Symbol.iterator;function y(I){return I===null||typeof I!="object"?null:(I=m&&I[m]||I["@@iterator"],typeof I=="function"?I:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,_={};function S(I,W,
|
|
9
|
+
*/var bw;function MR(){if(bw)return qe;bw=1;var e=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),u=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),m=Symbol.iterator;function y(I){return I===null||typeof I!="object"?null:(I=m&&I[m]||I["@@iterator"],typeof I=="function"?I:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,_={};function S(I,W,G){this.props=I,this.context=W,this.refs=_,this.updater=G||w}S.prototype.isReactComponent={},S.prototype.setState=function(I,W){if(typeof I!="object"&&typeof I!="function"&&I!=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,I,W,"setState")},S.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function b(){}b.prototype=S.prototype;function k(I,W,G){this.props=I,this.context=W,this.refs=_,this.updater=G||w}var E=k.prototype=new b;E.constructor=k,N(E,S.prototype),E.isPureReactComponent=!0;var C=Array.isArray,A=Object.prototype.hasOwnProperty,M={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};function H(I,W,G){var U,J={},re=null,le=null;if(W!=null)for(U in W.ref!==void 0&&(le=W.ref),W.key!==void 0&&(re=""+W.key),W)A.call(W,U)&&!L.hasOwnProperty(U)&&(J[U]=W[U]);var fe=arguments.length-2;if(fe===1)J.children=G;else if(1<fe){for(var te=Array(fe),ce=0;ce<fe;ce++)te[ce]=arguments[ce+2];J.children=te}if(I&&I.defaultProps)for(U in fe=I.defaultProps,fe)J[U]===void 0&&(J[U]=fe[U]);return{$$typeof:e,type:I,key:re,ref:le,props:J,_owner:M.current}}function O(I,W){return{$$typeof:e,type:I.type,key:W,ref:I.ref,props:I.props,_owner:I._owner}}function P(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function F(I){var W={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(G){return W[G]})}var Y=/\/+/g;function q(I,W){return typeof I=="object"&&I!==null&&I.key!=null?F(""+I.key):W.toString(36)}function R(I,W,G,U,J){var re=typeof I;(re==="undefined"||re==="boolean")&&(I=null);var le=!1;if(I===null)le=!0;else switch(re){case"string":case"number":le=!0;break;case"object":switch(I.$$typeof){case e:case n:le=!0}}if(le)return le=I,J=J(le),I=U===""?"."+q(le,0):U,C(J)?(G="",I!=null&&(G=I.replace(Y,"$&/")+"/"),R(J,W,G,"",function(ce){return ce})):J!=null&&(P(J)&&(J=O(J,G+(!J.key||le&&le.key===J.key?"":(""+J.key).replace(Y,"$&/")+"/")+I)),W.push(J)),1;if(le=0,U=U===""?".":U+":",C(I))for(var fe=0;fe<I.length;fe++){re=I[fe];var te=U+q(re,fe);le+=R(re,W,G,te,J)}else if(te=y(I),typeof te=="function")for(I=te.call(I),fe=0;!(re=I.next()).done;)re=re.value,te=U+q(re,fe++),le+=R(re,W,G,te,J);else if(re==="object")throw W=String(I),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.");return le}function Q(I,W,G){if(I==null)return I;var U=[],J=0;return R(I,U,"","",function(re){return W.call(G,re,J++)}),U}function z(I){if(I._status===-1){var W=I._result;W=W(),W.then(function(G){(I._status===0||I._status===-1)&&(I._status=1,I._result=G)},function(G){(I._status===0||I._status===-1)&&(I._status=2,I._result=G)}),I._status===-1&&(I._status=0,I._result=W)}if(I._status===1)return I._result.default;throw I._result}var ne={current:null},Z={transition:null},$={ReactCurrentDispatcher:ne,ReactCurrentBatchConfig:Z,ReactCurrentOwner:M};function X(){throw Error("act(...) is not supported in production builds of React.")}return qe.Children={map:Q,forEach:function(I,W,G){Q(I,function(){W.apply(this,arguments)},G)},count:function(I){var W=0;return Q(I,function(){W++}),W},toArray:function(I){return Q(I,function(W){return W})||[]},only:function(I){if(!P(I))throw Error("React.Children.only expected to receive a single React element child.");return I}},qe.Component=S,qe.Fragment=r,qe.Profiler=o,qe.PureComponent=k,qe.StrictMode=i,qe.Suspense=h,qe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=$,qe.act=X,qe.cloneElement=function(I,W,G){if(I==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+I+".");var U=N({},I.props),J=I.key,re=I.ref,le=I._owner;if(W!=null){if(W.ref!==void 0&&(re=W.ref,le=M.current),W.key!==void 0&&(J=""+W.key),I.type&&I.type.defaultProps)var fe=I.type.defaultProps;for(te in W)A.call(W,te)&&!L.hasOwnProperty(te)&&(U[te]=W[te]===void 0&&fe!==void 0?fe[te]:W[te])}var te=arguments.length-2;if(te===1)U.children=G;else if(1<te){fe=Array(te);for(var ce=0;ce<te;ce++)fe[ce]=arguments[ce+2];U.children=fe}return{$$typeof:e,type:I.type,key:J,ref:re,props:U,_owner:le}},qe.createContext=function(I){return I={$$typeof:u,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},I.Provider={$$typeof:l,_context:I},I.Consumer=I},qe.createElement=H,qe.createFactory=function(I){var W=H.bind(null,I);return W.type=I,W},qe.createRef=function(){return{current:null}},qe.forwardRef=function(I){return{$$typeof:c,render:I}},qe.isValidElement=P,qe.lazy=function(I){return{$$typeof:d,_payload:{_status:-1,_result:I},_init:z}},qe.memo=function(I,W){return{$$typeof:p,type:I,compare:W===void 0?null:W}},qe.startTransition=function(I){var W=Z.transition;Z.transition={};try{I()}finally{Z.transition=W}},qe.unstable_act=X,qe.useCallback=function(I,W){return ne.current.useCallback(I,W)},qe.useContext=function(I){return ne.current.useContext(I)},qe.useDebugValue=function(){},qe.useDeferredValue=function(I){return ne.current.useDeferredValue(I)},qe.useEffect=function(I,W){return ne.current.useEffect(I,W)},qe.useId=function(){return ne.current.useId()},qe.useImperativeHandle=function(I,W,G){return ne.current.useImperativeHandle(I,W,G)},qe.useInsertionEffect=function(I,W){return ne.current.useInsertionEffect(I,W)},qe.useLayoutEffect=function(I,W){return ne.current.useLayoutEffect(I,W)},qe.useMemo=function(I,W){return ne.current.useMemo(I,W)},qe.useReducer=function(I,W,G){return ne.current.useReducer(I,W,G)},qe.useRef=function(I){return ne.current.useRef(I)},qe.useState=function(I){return ne.current.useState(I)},qe.useSyncExternalStore=function(I,W,G){return ne.current.useSyncExternalStore(I,W,G)},qe.useTransition=function(){return ne.current.useTransition()},qe.version="18.3.1",qe}var Sw;function Aa(){return Sw||(Sw=1,vd.exports=MR()),vd.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 Nw;function LR(){return Nw||(Nw=1,(function(e){function n(Z,$){var X=Z.length;Z.push($);e:for(;0<X;){var I=X-1>>>1,W=Z[I];if(0<o(W,$))Z[I]=$,Z[X]=W,X=I;else break e}}function r(Z){return Z.length===0?null:Z[0]}function i(Z){if(Z.length===0)return null;var $=Z[0],X=Z.pop();if(X!==$){Z[0]=X;e:for(var I=0,W=Z.length,
|
|
25
|
+
*/var Nw;function LR(){return Nw||(Nw=1,(function(e){function n(Z,$){var X=Z.length;Z.push($);e:for(;0<X;){var I=X-1>>>1,W=Z[I];if(0<o(W,$))Z[I]=$,Z[X]=W,X=I;else break e}}function r(Z){return Z.length===0?null:Z[0]}function i(Z){if(Z.length===0)return null;var $=Z[0],X=Z.pop();if(X!==$){Z[0]=X;e:for(var I=0,W=Z.length,G=W>>>1;I<G;){var U=2*(I+1)-1,J=Z[U],re=U+1,le=Z[re];if(0>o(J,X))re<W&&0>o(le,J)?(Z[I]=le,Z[re]=X,I=re):(Z[I]=J,Z[U]=X,I=U);else if(re<W&&0>o(le,X))Z[I]=le,Z[re]=X,I=re;else break e}}return $}function o(Z,$){var X=Z.sortIndex-$.sortIndex;return X!==0?X:Z.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,c=u.now();e.unstable_now=function(){return u.now()-c}}var h=[],p=[],d=1,m=null,y=3,w=!1,N=!1,_=!1,S=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(Z){for(var $=r(p);$!==null;){if($.callback===null)i(p);else if($.startTime<=Z)i(p),$.sortIndex=$.expirationTime,n(h,$);else break;$=r(p)}}function C(Z){if(_=!1,E(Z),!N)if(r(h)!==null)N=!0,z(A);else{var $=r(p);$!==null&&ne(C,$.startTime-Z)}}function A(Z,$){N=!1,_&&(_=!1,b(H),H=-1),w=!0;var X=y;try{for(E($),m=r(h);m!==null&&(!(m.expirationTime>$)||Z&&!F());){var I=m.callback;if(typeof I=="function"){m.callback=null,y=m.priorityLevel;var W=I(m.expirationTime<=$);$=e.unstable_now(),typeof W=="function"?m.callback=W:m===r(h)&&i(h),E($)}else i(h);m=r(h)}if(m!==null)var G=!0;else{var U=r(p);U!==null&&ne(C,U.startTime-$),G=!1}return G}finally{m=null,y=X,w=!1}}var M=!1,L=null,H=-1,O=5,P=-1;function F(){return!(e.unstable_now()-P<O)}function Y(){if(L!==null){var Z=e.unstable_now();P=Z;var $=!0;try{$=L(!0,Z)}finally{$?q():(M=!1,L=null)}}else M=!1}var q;if(typeof k=="function")q=function(){k(Y)};else if(typeof MessageChannel<"u"){var R=new MessageChannel,Q=R.port2;R.port1.onmessage=Y,q=function(){Q.postMessage(null)}}else q=function(){S(Y,0)};function z(Z){L=Z,M||(M=!0,q())}function ne(Z,$){H=S(function(){Z(e.unstable_now())},$)}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(Z){Z.callback=null},e.unstable_continueExecution=function(){N||w||(N=!0,z(A))},e.unstable_forceFrameRate=function(Z){0>Z||125<Z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<Z?Math.floor(1e3/Z):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return r(h)},e.unstable_next=function(Z){switch(y){case 1:case 2:case 3:var $=3;break;default:$=y}var X=y;y=$;try{return Z()}finally{y=X}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(Z,$){switch(Z){case 1:case 2:case 3:case 4:case 5:break;default:Z=3}var X=y;y=Z;try{return $()}finally{y=X}},e.unstable_scheduleCallback=function(Z,$,X){var I=e.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?I+X:I):X=I,Z){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=X+W,Z={id:d++,callback:$,priorityLevel:Z,startTime:X,expirationTime:W,sortIndex:-1},X>I?(Z.sortIndex=X,n(p,Z),r(h)===null&&Z===r(p)&&(_?(b(H),H=-1):_=!0,ne(C,X-I))):(Z.sortIndex=W,n(h,Z),N||w||(N=!0,z(A))),Z},e.unstable_shouldYield=F,e.unstable_wrapCallback=function(Z){var $=y;return function(){var X=y;y=$;try{return Z.apply(this,arguments)}finally{y=X}}}})(xd)),xd}var Cw;function qR(){return Cw||(Cw=1,wd.exports=LR()),wd.exports}/**
|
|
26
26
|
* @license React
|
|
27
27
|
* react-dom.production.min.js
|
|
28
28
|
*
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
*
|
|
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
|
-
*/var jw;function $R(){if(jw)return cn;jw=1;var e=Aa(),n=qR();function r(t){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+t,a=1;a<arguments.length;a++)s+="&args[]="+encodeURIComponent(arguments[a]);return"Minified React error #"+t+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var i=new Set,o={};function l(t,s){u(t,s),u(t+"Capture",s)}function u(t,s){for(o[t]=s,t=0;t<s.length;t++)i.add(s[t])}var c=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,p=/^[: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]*$/,d={},m={};function y(t){return h.call(m,t)?!0:h.call(d,t)?!1:p.test(t)?m[t]=!0:(d[t]=!0,!1)}function w(t,s,a,f){if(a!==null&&a.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return f?!1:a!==null?!a.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function N(t,s,a,f){if(s===null||typeof s>"u"||w(t,s,a,f))return!0;if(f)return!1;if(a!==null)switch(a.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function _(t,s,a,f,v,x,j){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=f,this.attributeNamespace=v,this.mustUseProperty=a,this.propertyName=t,this.type=s,this.sanitizeURL=x,this.removeEmptyString=j}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){S[t]=new _(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var s=t[0];S[s]=new _(s,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){S[t]=new _(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){S[t]=new _(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){S[t]=new _(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){S[t]=new _(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){S[t]=new _(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){S[t]=new _(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){S[t]=new _(t,5,!1,t.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function k(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 s=t.replace(b,k);S[s]=new _(s,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var s=t.replace(b,k);S[s]=new _(s,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var s=t.replace(b,k);S[s]=new _(s,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){S[t]=new _(t,1,!1,t.toLowerCase(),null,!1,!1)}),S.xlinkHref=new _("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){S[t]=new _(t,1,!1,t.toLowerCase(),null,!0,!0)});function E(t,s,a,f){var v=S.hasOwnProperty(s)?S[s]:null;(v!==null?v.type!==0:f||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(N(s,a,v,f)&&(a=null),f||v===null?y(s)&&(a===null?t.removeAttribute(s):t.setAttribute(s,""+a)):v.mustUseProperty?t[v.propertyName]=a===null?v.type===3?!1:"":a:(s=v.attributeName,f=v.attributeNamespace,a===null?t.removeAttribute(s):(v=v.type,a=v===3||v===4&&a===!0?"":""+a,f?t.setAttributeNS(f,s,a):t.setAttribute(s,a))))}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,A=Symbol.for("react.element"),M=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),H=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),P=Symbol.for("react.provider"),F=Symbol.for("react.context"),
|
|
34
|
-
`+I+t}var
|
|
33
|
+
*/var jw;function $R(){if(jw)return cn;jw=1;var e=Aa(),n=qR();function r(t){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+t,a=1;a<arguments.length;a++)s+="&args[]="+encodeURIComponent(arguments[a]);return"Minified React error #"+t+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var i=new Set,o={};function l(t,s){u(t,s),u(t+"Capture",s)}function u(t,s){for(o[t]=s,t=0;t<s.length;t++)i.add(s[t])}var c=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,p=/^[: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]*$/,d={},m={};function y(t){return h.call(m,t)?!0:h.call(d,t)?!1:p.test(t)?m[t]=!0:(d[t]=!0,!1)}function w(t,s,a,f){if(a!==null&&a.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return f?!1:a!==null?!a.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function N(t,s,a,f){if(s===null||typeof s>"u"||w(t,s,a,f))return!0;if(f)return!1;if(a!==null)switch(a.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function _(t,s,a,f,v,x,j){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=f,this.attributeNamespace=v,this.mustUseProperty=a,this.propertyName=t,this.type=s,this.sanitizeURL=x,this.removeEmptyString=j}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){S[t]=new _(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var s=t[0];S[s]=new _(s,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){S[t]=new _(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){S[t]=new _(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){S[t]=new _(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){S[t]=new _(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){S[t]=new _(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){S[t]=new _(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){S[t]=new _(t,5,!1,t.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function k(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 s=t.replace(b,k);S[s]=new _(s,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var s=t.replace(b,k);S[s]=new _(s,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var s=t.replace(b,k);S[s]=new _(s,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){S[t]=new _(t,1,!1,t.toLowerCase(),null,!1,!1)}),S.xlinkHref=new _("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){S[t]=new _(t,1,!1,t.toLowerCase(),null,!0,!0)});function E(t,s,a,f){var v=S.hasOwnProperty(s)?S[s]:null;(v!==null?v.type!==0:f||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(N(s,a,v,f)&&(a=null),f||v===null?y(s)&&(a===null?t.removeAttribute(s):t.setAttribute(s,""+a)):v.mustUseProperty?t[v.propertyName]=a===null?v.type===3?!1:"":a:(s=v.attributeName,f=v.attributeNamespace,a===null?t.removeAttribute(s):(v=v.type,a=v===3||v===4&&a===!0?"":""+a,f?t.setAttributeNS(f,s,a):t.setAttribute(s,a))))}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,A=Symbol.for("react.element"),M=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),H=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),P=Symbol.for("react.provider"),F=Symbol.for("react.context"),Y=Symbol.for("react.forward_ref"),q=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),Q=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),ne=Symbol.for("react.offscreen"),Z=Symbol.iterator;function $(t){return t===null||typeof t!="object"?null:(t=Z&&t[Z]||t["@@iterator"],typeof t=="function"?t:null)}var X=Object.assign,I;function W(t){if(I===void 0)try{throw Error()}catch(a){var s=a.stack.trim().match(/\n( *(at )?)/);I=s&&s[1]||""}return`
|
|
34
|
+
`+I+t}var G=!1;function U(t,s){if(!t||G)return"";G=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(s)if(s=function(){throw Error()},Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(ae){var f=ae}Reflect.construct(t,[],s)}else{try{s.call()}catch(ae){f=ae}t.call(s.prototype)}else{try{throw Error()}catch(ae){f=ae}t()}}catch(ae){if(ae&&f&&typeof ae.stack=="string"){for(var v=ae.stack.split(`
|
|
35
35
|
`),x=f.stack.split(`
|
|
36
36
|
`),j=v.length-1,D=x.length-1;1<=j&&0<=D&&v[j]!==x[D];)D--;for(;1<=j&&0<=D;j--,D--)if(v[j]!==x[D]){if(j!==1||D!==1)do if(j--,D--,0>D||v[j]!==x[D]){var K=`
|
|
37
|
-
`+v[j].replace(" at new "," at ");return t.displayName&&K.includes("<anonymous>")&&(K=K.replace("<anonymous>",t.displayName)),K}while(1<=j&&0<=D);break}}}finally{Y=!1,Error.prepareStackTrace=a}return(t=t?t.displayName||t.name:"")?W(t):""}function J(t){switch(t.tag){case 5:return W(t.type);case 16:return W("Lazy");case 13:return W("Suspense");case 19:return W("SuspenseList");case 0:case 2:case 15:return t=U(t.type,!1),t;case 11:return t=U(t.type.render,!1),t;case 1:return t=U(t.type,!0),t;default:return""}}function re(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 L:return"Fragment";case M:return"Portal";case O:return"Profiler";case H:return"StrictMode";case q:return"Suspense";case R:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case F:return(t.displayName||"Context")+".Consumer";case P:return(t._context.displayName||"Context")+".Provider";case G:var s=t.render;return t=t.displayName,t||(t=s.displayName||s.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Q:return s=t.displayName||null,s!==null?s:re(t.type)||"Memo";case z:s=t._payload,t=t._init;try{return re(t(s))}catch{}}return null}function le(t){var s=t.type;switch(t.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=s.render,t=t.displayName||t.name||"",s.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return re(s);case 8:return s===H?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function fe(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function te(t){var s=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function ce(t){var s=te(t)?"checked":"value",a=Object.getOwnPropertyDescriptor(t.constructor.prototype,s),f=""+t[s];if(!t.hasOwnProperty(s)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var v=a.get,x=a.set;return Object.defineProperty(t,s,{configurable:!0,get:function(){return v.call(this)},set:function(j){f=""+j,x.call(this,j)}}),Object.defineProperty(t,s,{enumerable:a.enumerable}),{getValue:function(){return f},setValue:function(j){f=""+j},stopTracking:function(){t._valueTracker=null,delete t[s]}}}}function Ce(t){t._valueTracker||(t._valueTracker=ce(t))}function ve(t){if(!t)return!1;var s=t._valueTracker;if(!s)return!0;var a=s.getValue(),f="";return t&&(f=te(t)?t.checked?"true":"false":t.value),t=f,t!==a?(s.setValue(t),!0):!1}function Te(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 ye(t,s){var a=s.checked;return X({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:a??t._wrapperState.initialChecked})}function ke(t,s){var a=s.defaultValue==null?"":s.defaultValue,f=s.checked!=null?s.checked:s.defaultChecked;a=fe(s.value!=null?s.value:a),t._wrapperState={initialChecked:f,initialValue:a,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function Ge(t,s){s=s.checked,s!=null&&E(t,"checked",s,!1)}function we(t,s){Ge(t,s);var a=fe(s.value),f=s.type;if(a!=null)f==="number"?(a===0&&t.value===""||t.value!=a)&&(t.value=""+a):t.value!==""+a&&(t.value=""+a);else if(f==="submit"||f==="reset"){t.removeAttribute("value");return}s.hasOwnProperty("value")?ze(t,s.type,a):s.hasOwnProperty("defaultValue")&&ze(t,s.type,fe(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(t.defaultChecked=!!s.defaultChecked)}function _e(t,s,a){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var f=s.type;if(!(f!=="submit"&&f!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+t._wrapperState.initialValue,a||s===t.value||(t.value=s),t.defaultValue=s}a=t.name,a!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,a!==""&&(t.name=a)}function ze(t,s,a){(s!=="number"||Te(t.ownerDocument)!==t)&&(a==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+a&&(t.defaultValue=""+a))}var ft=Array.isArray;function ht(t,s,a,f){if(t=t.options,s){s={};for(var v=0;v<a.length;v++)s["$"+a[v]]=!0;for(a=0;a<t.length;a++)v=s.hasOwnProperty("$"+t[a].value),t[a].selected!==v&&(t[a].selected=v),v&&f&&(t[a].defaultSelected=!0)}else{for(a=""+fe(a),s=null,v=0;v<t.length;v++){if(t[v].value===a){t[v].selected=!0,f&&(t[v].defaultSelected=!0);return}s!==null||t[v].disabled||(s=t[v])}s!==null&&(s.selected=!0)}}function Ue(t,s){if(s.dangerouslySetInnerHTML!=null)throw Error(r(91));return X({},s,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function De(t,s){var a=s.value;if(a==null){if(a=s.children,s=s.defaultValue,a!=null){if(s!=null)throw Error(r(92));if(ft(a)){if(1<a.length)throw Error(r(93));a=a[0]}s=a}s==null&&(s=""),a=s}t._wrapperState={initialValue:fe(a)}}function Ze(t,s){var a=fe(s.value),f=fe(s.defaultValue);a!=null&&(a=""+a,a!==t.value&&(t.value=a),s.defaultValue==null&&t.defaultValue!==a&&(t.defaultValue=a)),f!=null&&(t.defaultValue=""+f)}function Ye(t){var s=t.textContent;s===t._wrapperState.initialValue&&s!==""&&s!==null&&(t.value=s)}function vt(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 ot(t,s){return t==null||t==="http://www.w3.org/1999/xhtml"?vt(s):t==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var yt,Kt=(function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,a,f,v){MSApp.execUnsafeLocalFunction(function(){return t(s,a,f,v)})}:t})(function(t,s){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=s;else{for(yt=yt||document.createElement("div"),yt.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=yt.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;s.firstChild;)t.appendChild(s.firstChild)}});function Mt(t,s){if(s){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=s;return}}t.textContent=s}var Xe={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},wt=["Webkit","ms","Moz","O"];Object.keys(Xe).forEach(function(t){wt.forEach(function(s){s=s+t.charAt(0).toUpperCase()+t.substring(1),Xe[s]=Xe[t]})});function pt(t,s,a){return s==null||typeof s=="boolean"||s===""?"":a||typeof s!="number"||s===0||Xe.hasOwnProperty(t)&&Xe[t]?(""+s).trim():s+"px"}function mt(t,s){t=t.style;for(var a in s)if(s.hasOwnProperty(a)){var f=a.indexOf("--")===0,v=pt(a,s[a],f);a==="float"&&(a="cssFloat"),f?t.setProperty(a,v):t[a]=v}}var _n=X({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 Xt(t,s){if(s){if(_n[t]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(r(137,t));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(r(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(r(61))}if(s.style!=null&&typeof s.style!="object")throw Error(r(62))}}function Pt(t,s){if(t.indexOf("-")===-1)return typeof s.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 Qt=null;function yr(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var bn=null,Zt=null,pn=null;function Sn(t){if(t=Go(t)){if(typeof bn!="function")throw Error(r(280));var s=t.stateNode;s&&(s=Ja(s),bn(t.stateNode,t.type,s))}}function Gr(t){Zt?pn?pn.push(t):pn=[t]:Zt=t}function ut(){if(Zt){var t=Zt,s=pn;if(pn=Zt=null,Sn(t),s)for(t=0;t<s.length;t++)Sn(s[t])}}function hi(t,s){return t(s)}function nr(){}var Es=!1;function pi(t,s,a){if(Es)return t(s,a);Es=!0;try{return hi(t,s,a)}finally{Es=!1,(Zt!==null||pn!==null)&&(nr(),ut())}}function Jt(t,s){var a=t.stateNode;if(a===null)return null;var f=Ja(a);if(f===null)return null;a=f[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(t=t.type,f=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!f;break e;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(r(231,s,typeof a));return a}var rr=!1;if(c)try{var wr={};Object.defineProperty(wr,"passive",{get:function(){rr=!0}}),window.addEventListener("test",wr,wr),window.removeEventListener("test",wr,wr)}catch{rr=!1}function So(t,s,a,f,v,x,j,D,K){var ae=Array.prototype.slice.call(arguments,3);try{s.apply(a,ae)}catch(pe){this.onError(pe)}}var sr=!1,xr=null,mn=!1,Yr=null,mi={onError:function(t){sr=!0,xr=t}};function Kr(t,s,a,f,v,x,j,D,K){sr=!1,xr=null,So.apply(mi,arguments)}function Ns(t,s,a,f,v,x,j,D,K){if(Kr.apply(this,arguments),sr){if(sr){var ae=xr;sr=!1,xr=null}else throw Error(r(198));mn||(mn=!0,Yr=ae)}}function gn(t){var s=t,a=t;if(t.alternate)for(;s.return;)s=s.return;else{t=s;do s=t,(s.flags&4098)!==0&&(a=s.return),t=s.return;while(t)}return s.tag===3?a:null}function jt(t){if(t.tag===13){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function _r(t){if(gn(t)!==t)throw Error(r(188))}function Xr(t){var s=t.alternate;if(!s){if(s=gn(t),s===null)throw Error(r(188));return s!==t?null:t}for(var a=t,f=s;;){var v=a.return;if(v===null)break;var x=v.alternate;if(x===null){if(f=v.return,f!==null){a=f;continue}break}if(v.child===x.child){for(x=v.child;x;){if(x===a)return _r(v),t;if(x===f)return _r(v),s;x=x.sibling}throw Error(r(188))}if(a.return!==f.return)a=v,f=x;else{for(var j=!1,D=v.child;D;){if(D===a){j=!0,a=v,f=x;break}if(D===f){j=!0,f=v,a=x;break}D=D.sibling}if(!j){for(D=x.child;D;){if(D===a){j=!0,a=x,f=v;break}if(D===f){j=!0,f=x,a=v;break}D=D.sibling}if(!j)throw Error(r(189))}}if(a.alternate!==f)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?t:s}function en(t){return t=Xr(t),t!==null?Qr(t):null}function Qr(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var s=Qr(t);if(s!==null)return s;t=t.sibling}return null}var Cs=n.unstable_scheduleCallback,gi=n.unstable_cancelCallback,ir=n.unstable_shouldYield,vi=n.unstable_requestPaint,Je=n.unstable_now,ko=n.unstable_getCurrentPriorityLevel,br=n.unstable_ImmediatePriority,js=n.unstable_UserBlockingPriority,or=n.unstable_NormalPriority,$n=n.unstable_LowPriority,yi=n.unstable_IdlePriority,Ot=null,Ut=null;function Sr(t){if(Ut&&typeof Ut.onCommitFiberRoot=="function")try{Ut.onCommitFiberRoot(Ot,t,void 0,(t.current.flags&128)===128)}catch{}}var rn=Math.clz32?Math.clz32:kr,wi=Math.log,Eo=Math.LN2;function kr(t){return t>>>=0,t===0?32:31-(wi(t)/Eo|0)|0}var Rs=64,Ts=4194304;function Zr(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 xi(t,s){var a=t.pendingLanes;if(a===0)return 0;var f=0,v=t.suspendedLanes,x=t.pingedLanes,j=a&268435455;if(j!==0){var D=j&~v;D!==0?f=Zr(D):(x&=j,x!==0&&(f=Zr(x)))}else j=a&~v,j!==0?f=Zr(j):x!==0&&(f=Zr(x));if(f===0)return 0;if(s!==0&&s!==f&&(s&v)===0&&(v=f&-f,x=s&-s,v>=x||v===16&&(x&4194240)!==0))return s;if((f&4)!==0&&(f|=a&16),s=t.entangledLanes,s!==0)for(t=t.entanglements,s&=f;0<s;)a=31-rn(s),v=1<<a,f|=t[a],s&=~v;return f}function No(t,s){switch(t){case 1:case 2:case 4:return s+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 s+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 Jr(t,s){for(var a=t.suspendedLanes,f=t.pingedLanes,v=t.expirationTimes,x=t.pendingLanes;0<x;){var j=31-rn(x),D=1<<j,K=v[j];K===-1?((D&a)===0||(D&f)!==0)&&(v[j]=No(D,s)):K<=s&&(t.expiredLanes|=D),x&=~D}}function _i(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Ba(){var t=Rs;return Rs<<=1,(Rs&4194240)===0&&(Rs=64),t}function bi(t){for(var s=[],a=0;31>a;a++)s.push(t);return s}function es(t,s,a){t.pendingLanes|=s,s!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,s=31-rn(s),t[s]=a}function Gu(t,s){var a=t.pendingLanes&~s;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=s,t.mutableReadLanes&=s,t.entangledLanes&=s,s=t.entanglements;var f=t.eventTimes;for(t=t.expirationTimes;0<a;){var v=31-rn(a),x=1<<v;s[v]=0,f[v]=-1,t[v]=-1,a&=~x}}function Ht(t,s){var a=t.entangledLanes|=s;for(t=t.entanglements;a;){var f=31-rn(a),v=1<<f;v&s|t[f]&s&&(t[f]|=s),a&=~v}}var We=0;function Si(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var Er,Nr,ki,ar,Co,ts=!1,As=[],lr=null,Dn=null,ur=null,Is=new Map,Cr=new Map,Lt=[],jo="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 Ro(t,s){switch(t){case"focusin":case"focusout":lr=null;break;case"dragenter":case"dragleave":Dn=null;break;case"mouseover":case"mouseout":ur=null;break;case"pointerover":case"pointerout":Is.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Cr.delete(s.pointerId)}}function Ms(t,s,a,f,v,x){return t===null||t.nativeEvent!==x?(t={blockedOn:s,domEventName:a,eventSystemFlags:f,nativeEvent:x,targetContainers:[v]},s!==null&&(s=Go(s),s!==null&&Nr(s)),t):(t.eventSystemFlags|=f,s=t.targetContainers,v!==null&&s.indexOf(v)===-1&&s.push(v),t)}function Yu(t,s,a,f,v){switch(s){case"focusin":return lr=Ms(lr,t,s,a,f,v),!0;case"dragenter":return Dn=Ms(Dn,t,s,a,f,v),!0;case"mouseover":return ur=Ms(ur,t,s,a,f,v),!0;case"pointerover":var x=v.pointerId;return Is.set(x,Ms(Is.get(x)||null,t,s,a,f,v)),!0;case"gotpointercapture":return x=v.pointerId,Cr.set(x,Ms(Cr.get(x)||null,t,s,a,f,v)),!0}return!1}function To(t){var s=Bs(t.target);if(s!==null){var a=gn(s);if(a!==null){if(s=a.tag,s===13){if(s=jt(a),s!==null){t.blockedOn=s,Co(t.priority,function(){ki(a)});return}}else if(s===3&&a.stateNode.current.memoizedState.isDehydrated){t.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Ps(t){if(t.blockedOn!==null)return!1;for(var s=t.targetContainers;0<s.length;){var a=qs(t.domEventName,t.eventSystemFlags,s[0],t.nativeEvent);if(a===null){a=t.nativeEvent;var f=new a.constructor(a.type,a);Qt=f,a.target.dispatchEvent(f),Qt=null}else return s=Go(a),s!==null&&Nr(s),t.blockedOn=a,!1;s.shift()}return!0}function Fn(t,s,a){Ps(t)&&a.delete(s)}function Ku(){ts=!1,lr!==null&&Ps(lr)&&(lr=null),Dn!==null&&Ps(Dn)&&(Dn=null),ur!==null&&Ps(ur)&&(ur=null),Is.forEach(Fn),Cr.forEach(Fn)}function ns(t,s){t.blockedOn===s&&(t.blockedOn=null,ts||(ts=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Ku)))}function Os(t){function s(v){return ns(v,t)}if(0<As.length){ns(As[0],t);for(var a=1;a<As.length;a++){var f=As[a];f.blockedOn===t&&(f.blockedOn=null)}}for(lr!==null&&ns(lr,t),Dn!==null&&ns(Dn,t),ur!==null&&ns(ur,t),Is.forEach(s),Cr.forEach(s),a=0;a<Lt.length;a++)f=Lt[a],f.blockedOn===t&&(f.blockedOn=null);for(;0<Lt.length&&(a=Lt[0],a.blockedOn===null);)To(a),a.blockedOn===null&&Lt.shift()}var kn=C.ReactCurrentBatchConfig,En=!0;function Ei(t,s,a,f){var v=We,x=kn.transition;kn.transition=null;try{We=1,Ao(t,s,a,f)}finally{We=v,kn.transition=x}}function Ls(t,s,a,f){var v=We,x=kn.transition;kn.transition=null;try{We=4,Ao(t,s,a,f)}finally{We=v,kn.transition=x}}function Ao(t,s,a,f){if(En){var v=qs(t,s,a,f);if(v===null)oc(t,s,f,St,a),Ro(t,f);else if(Yu(v,t,s,a,f))f.stopPropagation();else if(Ro(t,f),s&4&&-1<jo.indexOf(t)){for(;v!==null;){var x=Go(v);if(x!==null&&Er(x),x=qs(t,s,a,f),x===null&&oc(t,s,f,St,a),x===v)break;v=x}v!==null&&f.stopPropagation()}else oc(t,s,f,null,a)}}var St=null;function qs(t,s,a,f){if(St=null,t=yr(f),t=Bs(t),t!==null)if(s=gn(t),s===null)t=null;else if(a=s.tag,a===13){if(t=jt(s),t!==null)return t;t=null}else if(a===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;t=null}else s!==t&&(t=null);return St=t,null}function Io(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(ko()){case br:return 1;case js:return 4;case or:case $n:return 16;case yi:return 536870912;default:return 16}default:return 16}}var zn=null,Ni=null,jr=null;function Ci(){if(jr)return jr;var t,s=Ni,a=s.length,f,v="value"in zn?zn.value:zn.textContent,x=v.length;for(t=0;t<a&&s[t]===v[t];t++);var j=a-t;for(f=1;f<=j&&s[a-f]===v[x-f];f++);return jr=v.slice(t,1<f?1-f:void 0)}function $s(t){var s=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&s===13&&(t=13)):t=s,t===10&&(t=13),32<=t||t===13?t:0}function rs(){return!0}function Mo(){return!1}function qt(t){function s(a,f,v,x,j){this._reactName=a,this._targetInst=v,this.type=f,this.nativeEvent=x,this.target=j,this.currentTarget=null;for(var D in t)t.hasOwnProperty(D)&&(a=t[D],this[D]=a?a(x):x[D]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?rs:Mo,this.isPropagationStopped=Mo,this}return X(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=rs)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=rs)},persist:function(){},isPersistent:rs}),s}var Rr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Tr=qt(Rr),Ds=X({},Rr,{view:0,detail:0}),cr=qt(Ds),ji,Ri,Rt,Fs=X({},Ds,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ar,button:0,buttons:0,relatedTarget:function(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!==Rt&&(Rt&&t.type==="mousemove"?(ji=t.screenX-Rt.screenX,Ri=t.screenY-Rt.screenY):Ri=ji=0,Rt=t),ji)},movementY:function(t){return"movementY"in t?t.movementY:Ri}}),Po=qt(Fs),Ua=X({},Fs,{dataTransfer:0}),Ha=qt(Ua),B=X({},Ds,{relatedTarget:0}),V=qt(B),oe=X({},Rr,{animationName:0,elapsedTime:0,pseudoElement:0}),de=qt(oe),xe=X({},Rr,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Ne=qt(xe),Ie=X({},Rr,{data:0}),Le=qt(Ie),Ve={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Qe={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"},rt={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Nn(t){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(t):(t=rt[t])?!!s[t]:!1}function Ar(){return Nn}var Oo=X({},Ds,{key:function(t){if(t.key){var s=Ve[t.key]||t.key;if(s!=="Unidentified")return s}return t.type==="keypress"?(t=$s(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Qe[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ar,charCode:function(t){return t.type==="keypress"?$s(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?$s(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),zs=qt(Oo),Lo=X({},Fs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),qo=qt(Lo),Ti=X({},Ds,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ar}),Bn=qt(Ti),xt=X({},Rr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Wa=qt(xt),Nj=X({},Fs,{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}),Cj=qt(Nj),jj=[9,13,27,32],Xu=c&&"CompositionEvent"in window,$o=null;c&&"documentMode"in document&&($o=document.documentMode);var Rj=c&&"TextEvent"in window&&!$o,py=c&&(!Xu||$o&&8<$o&&11>=$o),my=" ",gy=!1;function vy(t,s){switch(t){case"keyup":return jj.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yy(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ai=!1;function Tj(t,s){switch(t){case"compositionend":return yy(s);case"keypress":return s.which!==32?null:(gy=!0,my);case"textInput":return t=s.data,t===my&&gy?null:t;default:return null}}function Aj(t,s){if(Ai)return t==="compositionend"||!Xu&&vy(t,s)?(t=Ci(),jr=Ni=zn=null,Ai=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return py&&s.locale!=="ko"?null:s.data;default:return null}}var Ij={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 wy(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s==="input"?!!Ij[t.type]:s==="textarea"}function xy(t,s,a,f){Gr(f),s=Xa(s,"onChange"),0<s.length&&(a=new Tr("onChange","change",null,a,f),t.push({event:a,listeners:s}))}var Do=null,Fo=null;function Mj(t){$y(t,0)}function Va(t){var s=Li(t);if(ve(s))return t}function Pj(t,s){if(t==="change")return s}var _y=!1;if(c){var Qu;if(c){var Zu="oninput"in document;if(!Zu){var by=document.createElement("div");by.setAttribute("oninput","return;"),Zu=typeof by.oninput=="function"}Qu=Zu}else Qu=!1;_y=Qu&&(!document.documentMode||9<document.documentMode)}function Sy(){Do&&(Do.detachEvent("onpropertychange",ky),Fo=Do=null)}function ky(t){if(t.propertyName==="value"&&Va(Fo)){var s=[];xy(s,Fo,t,yr(t)),pi(Mj,s)}}function Oj(t,s,a){t==="focusin"?(Sy(),Do=s,Fo=a,Do.attachEvent("onpropertychange",ky)):t==="focusout"&&Sy()}function Lj(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Va(Fo)}function qj(t,s){if(t==="click")return Va(s)}function $j(t,s){if(t==="input"||t==="change")return Va(s)}function Dj(t,s){return t===s&&(t!==0||1/t===1/s)||t!==t&&s!==s}var Un=typeof Object.is=="function"?Object.is:Dj;function zo(t,s){if(Un(t,s))return!0;if(typeof t!="object"||t===null||typeof s!="object"||s===null)return!1;var a=Object.keys(t),f=Object.keys(s);if(a.length!==f.length)return!1;for(f=0;f<a.length;f++){var v=a[f];if(!h.call(s,v)||!Un(t[v],s[v]))return!1}return!0}function Ey(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Ny(t,s){var a=Ey(t);t=0;for(var f;a;){if(a.nodeType===3){if(f=t+a.textContent.length,t<=s&&f>=s)return{node:a,offset:s-t};t=f}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Ey(a)}}function Cy(t,s){return t&&s?t===s?!0:t&&t.nodeType===3?!1:s&&s.nodeType===3?Cy(t,s.parentNode):"contains"in t?t.contains(s):t.compareDocumentPosition?!!(t.compareDocumentPosition(s)&16):!1:!1}function jy(){for(var t=window,s=Te();s instanceof t.HTMLIFrameElement;){try{var a=typeof s.contentWindow.location.href=="string"}catch{a=!1}if(a)t=s.contentWindow;else break;s=Te(t.document)}return s}function Ju(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s&&(s==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||s==="textarea"||t.contentEditable==="true")}function Fj(t){var s=jy(),a=t.focusedElem,f=t.selectionRange;if(s!==a&&a&&a.ownerDocument&&Cy(a.ownerDocument.documentElement,a)){if(f!==null&&Ju(a)){if(s=f.start,t=f.end,t===void 0&&(t=s),"selectionStart"in a)a.selectionStart=s,a.selectionEnd=Math.min(t,a.value.length);else if(t=(s=a.ownerDocument||document)&&s.defaultView||window,t.getSelection){t=t.getSelection();var v=a.textContent.length,x=Math.min(f.start,v);f=f.end===void 0?x:Math.min(f.end,v),!t.extend&&x>f&&(v=f,f=x,x=v),v=Ny(a,x);var j=Ny(a,f);v&&j&&(t.rangeCount!==1||t.anchorNode!==v.node||t.anchorOffset!==v.offset||t.focusNode!==j.node||t.focusOffset!==j.offset)&&(s=s.createRange(),s.setStart(v.node,v.offset),t.removeAllRanges(),x>f?(t.addRange(s),t.extend(j.node,j.offset)):(s.setEnd(j.node,j.offset),t.addRange(s)))}}for(s=[],t=a;t=t.parentNode;)t.nodeType===1&&s.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<s.length;a++)t=s[a],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var zj=c&&"documentMode"in document&&11>=document.documentMode,Ii=null,ec=null,Bo=null,tc=!1;function Ry(t,s,a){var f=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;tc||Ii==null||Ii!==Te(f)||(f=Ii,"selectionStart"in f&&Ju(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),Bo&&zo(Bo,f)||(Bo=f,f=Xa(ec,"onSelect"),0<f.length&&(s=new Tr("onSelect","select",null,s,a),t.push({event:s,listeners:f}),s.target=Ii)))}function Ga(t,s){var a={};return a[t.toLowerCase()]=s.toLowerCase(),a["Webkit"+t]="webkit"+s,a["Moz"+t]="moz"+s,a}var Mi={animationend:Ga("Animation","AnimationEnd"),animationiteration:Ga("Animation","AnimationIteration"),animationstart:Ga("Animation","AnimationStart"),transitionend:Ga("Transition","TransitionEnd")},nc={},Ty={};c&&(Ty=document.createElement("div").style,"AnimationEvent"in window||(delete Mi.animationend.animation,delete Mi.animationiteration.animation,delete Mi.animationstart.animation),"TransitionEvent"in window||delete Mi.transitionend.transition);function Ya(t){if(nc[t])return nc[t];if(!Mi[t])return t;var s=Mi[t],a;for(a in s)if(s.hasOwnProperty(a)&&a in Ty)return nc[t]=s[a];return t}var Ay=Ya("animationend"),Iy=Ya("animationiteration"),My=Ya("animationstart"),Py=Ya("transitionend"),Oy=new Map,Ly="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 ss(t,s){Oy.set(t,s),l(s,[t])}for(var rc=0;rc<Ly.length;rc++){var sc=Ly[rc],Bj=sc.toLowerCase(),Uj=sc[0].toUpperCase()+sc.slice(1);ss(Bj,"on"+Uj)}ss(Ay,"onAnimationEnd"),ss(Iy,"onAnimationIteration"),ss(My,"onAnimationStart"),ss("dblclick","onDoubleClick"),ss("focusin","onFocus"),ss("focusout","onBlur"),ss(Py,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Uo="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(" "),Hj=new Set("cancel close invalid load scroll toggle".split(" ").concat(Uo));function qy(t,s,a){var f=t.type||"unknown-event";t.currentTarget=a,Ns(f,s,void 0,t),t.currentTarget=null}function $y(t,s){s=(s&4)!==0;for(var a=0;a<t.length;a++){var f=t[a],v=f.event;f=f.listeners;e:{var x=void 0;if(s)for(var j=f.length-1;0<=j;j--){var D=f[j],K=D.instance,ae=D.currentTarget;if(D=D.listener,K!==x&&v.isPropagationStopped())break e;qy(v,D,ae),x=K}else for(j=0;j<f.length;j++){if(D=f[j],K=D.instance,ae=D.currentTarget,D=D.listener,K!==x&&v.isPropagationStopped())break e;qy(v,D,ae),x=K}}}if(mn)throw t=Yr,mn=!1,Yr=null,t}function tt(t,s){var a=s[fc];a===void 0&&(a=s[fc]=new Set);var f=t+"__bubble";a.has(f)||(Dy(s,t,2,!1),a.add(f))}function ic(t,s,a){var f=0;s&&(f|=4),Dy(a,t,f,s)}var Ka="_reactListening"+Math.random().toString(36).slice(2);function Ho(t){if(!t[Ka]){t[Ka]=!0,i.forEach(function(a){a!=="selectionchange"&&(Hj.has(a)||ic(a,!1,t),ic(a,!0,t))});var s=t.nodeType===9?t:t.ownerDocument;s===null||s[Ka]||(s[Ka]=!0,ic("selectionchange",!1,s))}}function Dy(t,s,a,f){switch(Io(s)){case 1:var v=Ei;break;case 4:v=Ls;break;default:v=Ao}a=v.bind(null,s,a,t),v=void 0,!rr||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(v=!0),f?v!==void 0?t.addEventListener(s,a,{capture:!0,passive:v}):t.addEventListener(s,a,!0):v!==void 0?t.addEventListener(s,a,{passive:v}):t.addEventListener(s,a,!1)}function oc(t,s,a,f,v){var x=f;if((s&1)===0&&(s&2)===0&&f!==null)e:for(;;){if(f===null)return;var j=f.tag;if(j===3||j===4){var D=f.stateNode.containerInfo;if(D===v||D.nodeType===8&&D.parentNode===v)break;if(j===4)for(j=f.return;j!==null;){var K=j.tag;if((K===3||K===4)&&(K=j.stateNode.containerInfo,K===v||K.nodeType===8&&K.parentNode===v))return;j=j.return}for(;D!==null;){if(j=Bs(D),j===null)return;if(K=j.tag,K===5||K===6){f=x=j;continue e}D=D.parentNode}}f=f.return}pi(function(){var ae=x,pe=yr(a),me=[];e:{var he=Oy.get(t);if(he!==void 0){var be=Tr,Ee=t;switch(t){case"keypress":if($s(a)===0)break e;case"keydown":case"keyup":be=zs;break;case"focusin":Ee="focus",be=V;break;case"focusout":Ee="blur",be=V;break;case"beforeblur":case"afterblur":be=V;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":be=Po;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":be=Ha;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":be=Bn;break;case Ay:case Iy:case My:be=de;break;case Py:be=Wa;break;case"scroll":be=cr;break;case"wheel":be=Cj;break;case"copy":case"cut":case"paste":be=Ne;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":be=qo}var je=(s&4)!==0,gt=!je&&t==="scroll",se=je?he!==null?he+"Capture":null:he;je=[];for(var ee=ae,ie;ee!==null;){ie=ee;var ge=ie.stateNode;if(ie.tag===5&&ge!==null&&(ie=ge,se!==null&&(ge=Jt(ee,se),ge!=null&&je.push(Wo(ee,ge,ie)))),gt)break;ee=ee.return}0<je.length&&(he=new be(he,Ee,null,a,pe),me.push({event:he,listeners:je}))}}if((s&7)===0){e:{if(he=t==="mouseover"||t==="pointerover",be=t==="mouseout"||t==="pointerout",he&&a!==Qt&&(Ee=a.relatedTarget||a.fromElement)&&(Bs(Ee)||Ee[Ir]))break e;if((be||he)&&(he=pe.window===pe?pe:(he=pe.ownerDocument)?he.defaultView||he.parentWindow:window,be?(Ee=a.relatedTarget||a.toElement,be=ae,Ee=Ee?Bs(Ee):null,Ee!==null&&(gt=gn(Ee),Ee!==gt||Ee.tag!==5&&Ee.tag!==6)&&(Ee=null)):(be=null,Ee=ae),be!==Ee)){if(je=Po,ge="onMouseLeave",se="onMouseEnter",ee="mouse",(t==="pointerout"||t==="pointerover")&&(je=qo,ge="onPointerLeave",se="onPointerEnter",ee="pointer"),gt=be==null?he:Li(be),ie=Ee==null?he:Li(Ee),he=new je(ge,ee+"leave",be,a,pe),he.target=gt,he.relatedTarget=ie,ge=null,Bs(pe)===ae&&(je=new je(se,ee+"enter",Ee,a,pe),je.target=ie,je.relatedTarget=gt,ge=je),gt=ge,be&&Ee)t:{for(je=be,se=Ee,ee=0,ie=je;ie;ie=Pi(ie))ee++;for(ie=0,ge=se;ge;ge=Pi(ge))ie++;for(;0<ee-ie;)je=Pi(je),ee--;for(;0<ie-ee;)se=Pi(se),ie--;for(;ee--;){if(je===se||se!==null&&je===se.alternate)break t;je=Pi(je),se=Pi(se)}je=null}else je=null;be!==null&&Fy(me,he,be,je,!1),Ee!==null&>!==null&&Fy(me,gt,Ee,je,!0)}}e:{if(he=ae?Li(ae):window,be=he.nodeName&&he.nodeName.toLowerCase(),be==="select"||be==="input"&&he.type==="file")var Re=Pj;else if(wy(he))if(_y)Re=$j;else{Re=Lj;var Me=Oj}else(be=he.nodeName)&&be.toLowerCase()==="input"&&(he.type==="checkbox"||he.type==="radio")&&(Re=qj);if(Re&&(Re=Re(t,ae))){xy(me,Re,a,pe);break e}Me&&Me(t,he,ae),t==="focusout"&&(Me=he._wrapperState)&&Me.controlled&&he.type==="number"&&ze(he,"number",he.value)}switch(Me=ae?Li(ae):window,t){case"focusin":(wy(Me)||Me.contentEditable==="true")&&(Ii=Me,ec=ae,Bo=null);break;case"focusout":Bo=ec=Ii=null;break;case"mousedown":tc=!0;break;case"contextmenu":case"mouseup":case"dragend":tc=!1,Ry(me,a,pe);break;case"selectionchange":if(zj)break;case"keydown":case"keyup":Ry(me,a,pe)}var Pe;if(Xu)e:{switch(t){case"compositionstart":var Oe="onCompositionStart";break e;case"compositionend":Oe="onCompositionEnd";break e;case"compositionupdate":Oe="onCompositionUpdate";break e}Oe=void 0}else Ai?vy(t,a)&&(Oe="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(Oe="onCompositionStart");Oe&&(py&&a.locale!=="ko"&&(Ai||Oe!=="onCompositionStart"?Oe==="onCompositionEnd"&&Ai&&(Pe=Ci()):(zn=pe,Ni="value"in zn?zn.value:zn.textContent,Ai=!0)),Me=Xa(ae,Oe),0<Me.length&&(Oe=new Le(Oe,t,null,a,pe),me.push({event:Oe,listeners:Me}),Pe?Oe.data=Pe:(Pe=yy(a),Pe!==null&&(Oe.data=Pe)))),(Pe=Rj?Tj(t,a):Aj(t,a))&&(ae=Xa(ae,"onBeforeInput"),0<ae.length&&(pe=new Le("onBeforeInput","beforeinput",null,a,pe),me.push({event:pe,listeners:ae}),pe.data=Pe))}$y(me,s)})}function Wo(t,s,a){return{instance:t,listener:s,currentTarget:a}}function Xa(t,s){for(var a=s+"Capture",f=[];t!==null;){var v=t,x=v.stateNode;v.tag===5&&x!==null&&(v=x,x=Jt(t,a),x!=null&&f.unshift(Wo(t,x,v)),x=Jt(t,s),x!=null&&f.push(Wo(t,x,v))),t=t.return}return f}function Pi(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Fy(t,s,a,f,v){for(var x=s._reactName,j=[];a!==null&&a!==f;){var D=a,K=D.alternate,ae=D.stateNode;if(K!==null&&K===f)break;D.tag===5&&ae!==null&&(D=ae,v?(K=Jt(a,x),K!=null&&j.unshift(Wo(a,K,D))):v||(K=Jt(a,x),K!=null&&j.push(Wo(a,K,D)))),a=a.return}j.length!==0&&t.push({event:s,listeners:j})}var Wj=/\r\n?/g,Vj=/\u0000|\uFFFD/g;function zy(t){return(typeof t=="string"?t:""+t).replace(Wj,`
|
|
37
|
+
`+v[j].replace(" at new "," at ");return t.displayName&&K.includes("<anonymous>")&&(K=K.replace("<anonymous>",t.displayName)),K}while(1<=j&&0<=D);break}}}finally{G=!1,Error.prepareStackTrace=a}return(t=t?t.displayName||t.name:"")?W(t):""}function J(t){switch(t.tag){case 5:return W(t.type);case 16:return W("Lazy");case 13:return W("Suspense");case 19:return W("SuspenseList");case 0:case 2:case 15:return t=U(t.type,!1),t;case 11:return t=U(t.type.render,!1),t;case 1:return t=U(t.type,!0),t;default:return""}}function re(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 L:return"Fragment";case M:return"Portal";case O:return"Profiler";case H:return"StrictMode";case q:return"Suspense";case R:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case F:return(t.displayName||"Context")+".Consumer";case P:return(t._context.displayName||"Context")+".Provider";case Y:var s=t.render;return t=t.displayName,t||(t=s.displayName||s.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Q:return s=t.displayName||null,s!==null?s:re(t.type)||"Memo";case z:s=t._payload,t=t._init;try{return re(t(s))}catch{}}return null}function le(t){var s=t.type;switch(t.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=s.render,t=t.displayName||t.name||"",s.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return re(s);case 8:return s===H?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function fe(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function te(t){var s=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function ce(t){var s=te(t)?"checked":"value",a=Object.getOwnPropertyDescriptor(t.constructor.prototype,s),f=""+t[s];if(!t.hasOwnProperty(s)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var v=a.get,x=a.set;return Object.defineProperty(t,s,{configurable:!0,get:function(){return v.call(this)},set:function(j){f=""+j,x.call(this,j)}}),Object.defineProperty(t,s,{enumerable:a.enumerable}),{getValue:function(){return f},setValue:function(j){f=""+j},stopTracking:function(){t._valueTracker=null,delete t[s]}}}}function Ce(t){t._valueTracker||(t._valueTracker=ce(t))}function ve(t){if(!t)return!1;var s=t._valueTracker;if(!s)return!0;var a=s.getValue(),f="";return t&&(f=te(t)?t.checked?"true":"false":t.value),t=f,t!==a?(s.setValue(t),!0):!1}function Te(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 ye(t,s){var a=s.checked;return X({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:a??t._wrapperState.initialChecked})}function ke(t,s){var a=s.defaultValue==null?"":s.defaultValue,f=s.checked!=null?s.checked:s.defaultChecked;a=fe(s.value!=null?s.value:a),t._wrapperState={initialChecked:f,initialValue:a,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function Ge(t,s){s=s.checked,s!=null&&E(t,"checked",s,!1)}function we(t,s){Ge(t,s);var a=fe(s.value),f=s.type;if(a!=null)f==="number"?(a===0&&t.value===""||t.value!=a)&&(t.value=""+a):t.value!==""+a&&(t.value=""+a);else if(f==="submit"||f==="reset"){t.removeAttribute("value");return}s.hasOwnProperty("value")?ze(t,s.type,a):s.hasOwnProperty("defaultValue")&&ze(t,s.type,fe(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(t.defaultChecked=!!s.defaultChecked)}function _e(t,s,a){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var f=s.type;if(!(f!=="submit"&&f!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+t._wrapperState.initialValue,a||s===t.value||(t.value=s),t.defaultValue=s}a=t.name,a!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,a!==""&&(t.name=a)}function ze(t,s,a){(s!=="number"||Te(t.ownerDocument)!==t)&&(a==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+a&&(t.defaultValue=""+a))}var ft=Array.isArray;function ht(t,s,a,f){if(t=t.options,s){s={};for(var v=0;v<a.length;v++)s["$"+a[v]]=!0;for(a=0;a<t.length;a++)v=s.hasOwnProperty("$"+t[a].value),t[a].selected!==v&&(t[a].selected=v),v&&f&&(t[a].defaultSelected=!0)}else{for(a=""+fe(a),s=null,v=0;v<t.length;v++){if(t[v].value===a){t[v].selected=!0,f&&(t[v].defaultSelected=!0);return}s!==null||t[v].disabled||(s=t[v])}s!==null&&(s.selected=!0)}}function Ue(t,s){if(s.dangerouslySetInnerHTML!=null)throw Error(r(91));return X({},s,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function De(t,s){var a=s.value;if(a==null){if(a=s.children,s=s.defaultValue,a!=null){if(s!=null)throw Error(r(92));if(ft(a)){if(1<a.length)throw Error(r(93));a=a[0]}s=a}s==null&&(s=""),a=s}t._wrapperState={initialValue:fe(a)}}function Ze(t,s){var a=fe(s.value),f=fe(s.defaultValue);a!=null&&(a=""+a,a!==t.value&&(t.value=a),s.defaultValue==null&&t.defaultValue!==a&&(t.defaultValue=a)),f!=null&&(t.defaultValue=""+f)}function Ye(t){var s=t.textContent;s===t._wrapperState.initialValue&&s!==""&&s!==null&&(t.value=s)}function vt(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 ot(t,s){return t==null||t==="http://www.w3.org/1999/xhtml"?vt(s):t==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var yt,Kt=(function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,a,f,v){MSApp.execUnsafeLocalFunction(function(){return t(s,a,f,v)})}:t})(function(t,s){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=s;else{for(yt=yt||document.createElement("div"),yt.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=yt.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;s.firstChild;)t.appendChild(s.firstChild)}});function Mt(t,s){if(s){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=s;return}}t.textContent=s}var Xe={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},wt=["Webkit","ms","Moz","O"];Object.keys(Xe).forEach(function(t){wt.forEach(function(s){s=s+t.charAt(0).toUpperCase()+t.substring(1),Xe[s]=Xe[t]})});function pt(t,s,a){return s==null||typeof s=="boolean"||s===""?"":a||typeof s!="number"||s===0||Xe.hasOwnProperty(t)&&Xe[t]?(""+s).trim():s+"px"}function mt(t,s){t=t.style;for(var a in s)if(s.hasOwnProperty(a)){var f=a.indexOf("--")===0,v=pt(a,s[a],f);a==="float"&&(a="cssFloat"),f?t.setProperty(a,v):t[a]=v}}var _n=X({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 Xt(t,s){if(s){if(_n[t]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(r(137,t));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(r(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(r(61))}if(s.style!=null&&typeof s.style!="object")throw Error(r(62))}}function Pt(t,s){if(t.indexOf("-")===-1)return typeof s.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 Qt=null;function yr(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var bn=null,Zt=null,pn=null;function Sn(t){if(t=Go(t)){if(typeof bn!="function")throw Error(r(280));var s=t.stateNode;s&&(s=Ja(s),bn(t.stateNode,t.type,s))}}function Gr(t){Zt?pn?pn.push(t):pn=[t]:Zt=t}function ut(){if(Zt){var t=Zt,s=pn;if(pn=Zt=null,Sn(t),s)for(t=0;t<s.length;t++)Sn(s[t])}}function hi(t,s){return t(s)}function nr(){}var Es=!1;function pi(t,s,a){if(Es)return t(s,a);Es=!0;try{return hi(t,s,a)}finally{Es=!1,(Zt!==null||pn!==null)&&(nr(),ut())}}function Jt(t,s){var a=t.stateNode;if(a===null)return null;var f=Ja(a);if(f===null)return null;a=f[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(t=t.type,f=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!f;break e;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(r(231,s,typeof a));return a}var rr=!1;if(c)try{var wr={};Object.defineProperty(wr,"passive",{get:function(){rr=!0}}),window.addEventListener("test",wr,wr),window.removeEventListener("test",wr,wr)}catch{rr=!1}function So(t,s,a,f,v,x,j,D,K){var ae=Array.prototype.slice.call(arguments,3);try{s.apply(a,ae)}catch(pe){this.onError(pe)}}var sr=!1,xr=null,mn=!1,Yr=null,mi={onError:function(t){sr=!0,xr=t}};function Kr(t,s,a,f,v,x,j,D,K){sr=!1,xr=null,So.apply(mi,arguments)}function Ns(t,s,a,f,v,x,j,D,K){if(Kr.apply(this,arguments),sr){if(sr){var ae=xr;sr=!1,xr=null}else throw Error(r(198));mn||(mn=!0,Yr=ae)}}function gn(t){var s=t,a=t;if(t.alternate)for(;s.return;)s=s.return;else{t=s;do s=t,(s.flags&4098)!==0&&(a=s.return),t=s.return;while(t)}return s.tag===3?a:null}function jt(t){if(t.tag===13){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function _r(t){if(gn(t)!==t)throw Error(r(188))}function Xr(t){var s=t.alternate;if(!s){if(s=gn(t),s===null)throw Error(r(188));return s!==t?null:t}for(var a=t,f=s;;){var v=a.return;if(v===null)break;var x=v.alternate;if(x===null){if(f=v.return,f!==null){a=f;continue}break}if(v.child===x.child){for(x=v.child;x;){if(x===a)return _r(v),t;if(x===f)return _r(v),s;x=x.sibling}throw Error(r(188))}if(a.return!==f.return)a=v,f=x;else{for(var j=!1,D=v.child;D;){if(D===a){j=!0,a=v,f=x;break}if(D===f){j=!0,f=v,a=x;break}D=D.sibling}if(!j){for(D=x.child;D;){if(D===a){j=!0,a=x,f=v;break}if(D===f){j=!0,f=x,a=v;break}D=D.sibling}if(!j)throw Error(r(189))}}if(a.alternate!==f)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?t:s}function en(t){return t=Xr(t),t!==null?Qr(t):null}function Qr(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var s=Qr(t);if(s!==null)return s;t=t.sibling}return null}var Cs=n.unstable_scheduleCallback,gi=n.unstable_cancelCallback,ir=n.unstable_shouldYield,vi=n.unstable_requestPaint,Je=n.unstable_now,ko=n.unstable_getCurrentPriorityLevel,br=n.unstable_ImmediatePriority,js=n.unstable_UserBlockingPriority,or=n.unstable_NormalPriority,$n=n.unstable_LowPriority,yi=n.unstable_IdlePriority,Ot=null,Ut=null;function Sr(t){if(Ut&&typeof Ut.onCommitFiberRoot=="function")try{Ut.onCommitFiberRoot(Ot,t,void 0,(t.current.flags&128)===128)}catch{}}var rn=Math.clz32?Math.clz32:kr,wi=Math.log,Eo=Math.LN2;function kr(t){return t>>>=0,t===0?32:31-(wi(t)/Eo|0)|0}var Rs=64,Ts=4194304;function Zr(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 xi(t,s){var a=t.pendingLanes;if(a===0)return 0;var f=0,v=t.suspendedLanes,x=t.pingedLanes,j=a&268435455;if(j!==0){var D=j&~v;D!==0?f=Zr(D):(x&=j,x!==0&&(f=Zr(x)))}else j=a&~v,j!==0?f=Zr(j):x!==0&&(f=Zr(x));if(f===0)return 0;if(s!==0&&s!==f&&(s&v)===0&&(v=f&-f,x=s&-s,v>=x||v===16&&(x&4194240)!==0))return s;if((f&4)!==0&&(f|=a&16),s=t.entangledLanes,s!==0)for(t=t.entanglements,s&=f;0<s;)a=31-rn(s),v=1<<a,f|=t[a],s&=~v;return f}function No(t,s){switch(t){case 1:case 2:case 4:return s+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 s+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 Jr(t,s){for(var a=t.suspendedLanes,f=t.pingedLanes,v=t.expirationTimes,x=t.pendingLanes;0<x;){var j=31-rn(x),D=1<<j,K=v[j];K===-1?((D&a)===0||(D&f)!==0)&&(v[j]=No(D,s)):K<=s&&(t.expiredLanes|=D),x&=~D}}function _i(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Ba(){var t=Rs;return Rs<<=1,(Rs&4194240)===0&&(Rs=64),t}function bi(t){for(var s=[],a=0;31>a;a++)s.push(t);return s}function es(t,s,a){t.pendingLanes|=s,s!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,s=31-rn(s),t[s]=a}function Gu(t,s){var a=t.pendingLanes&~s;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=s,t.mutableReadLanes&=s,t.entangledLanes&=s,s=t.entanglements;var f=t.eventTimes;for(t=t.expirationTimes;0<a;){var v=31-rn(a),x=1<<v;s[v]=0,f[v]=-1,t[v]=-1,a&=~x}}function Ht(t,s){var a=t.entangledLanes|=s;for(t=t.entanglements;a;){var f=31-rn(a),v=1<<f;v&s|t[f]&s&&(t[f]|=s),a&=~v}}var We=0;function Si(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var Er,Nr,ki,ar,Co,ts=!1,As=[],lr=null,Dn=null,ur=null,Is=new Map,Cr=new Map,Lt=[],jo="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 Ro(t,s){switch(t){case"focusin":case"focusout":lr=null;break;case"dragenter":case"dragleave":Dn=null;break;case"mouseover":case"mouseout":ur=null;break;case"pointerover":case"pointerout":Is.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Cr.delete(s.pointerId)}}function Ms(t,s,a,f,v,x){return t===null||t.nativeEvent!==x?(t={blockedOn:s,domEventName:a,eventSystemFlags:f,nativeEvent:x,targetContainers:[v]},s!==null&&(s=Go(s),s!==null&&Nr(s)),t):(t.eventSystemFlags|=f,s=t.targetContainers,v!==null&&s.indexOf(v)===-1&&s.push(v),t)}function Yu(t,s,a,f,v){switch(s){case"focusin":return lr=Ms(lr,t,s,a,f,v),!0;case"dragenter":return Dn=Ms(Dn,t,s,a,f,v),!0;case"mouseover":return ur=Ms(ur,t,s,a,f,v),!0;case"pointerover":var x=v.pointerId;return Is.set(x,Ms(Is.get(x)||null,t,s,a,f,v)),!0;case"gotpointercapture":return x=v.pointerId,Cr.set(x,Ms(Cr.get(x)||null,t,s,a,f,v)),!0}return!1}function To(t){var s=Bs(t.target);if(s!==null){var a=gn(s);if(a!==null){if(s=a.tag,s===13){if(s=jt(a),s!==null){t.blockedOn=s,Co(t.priority,function(){ki(a)});return}}else if(s===3&&a.stateNode.current.memoizedState.isDehydrated){t.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Ps(t){if(t.blockedOn!==null)return!1;for(var s=t.targetContainers;0<s.length;){var a=qs(t.domEventName,t.eventSystemFlags,s[0],t.nativeEvent);if(a===null){a=t.nativeEvent;var f=new a.constructor(a.type,a);Qt=f,a.target.dispatchEvent(f),Qt=null}else return s=Go(a),s!==null&&Nr(s),t.blockedOn=a,!1;s.shift()}return!0}function Fn(t,s,a){Ps(t)&&a.delete(s)}function Ku(){ts=!1,lr!==null&&Ps(lr)&&(lr=null),Dn!==null&&Ps(Dn)&&(Dn=null),ur!==null&&Ps(ur)&&(ur=null),Is.forEach(Fn),Cr.forEach(Fn)}function ns(t,s){t.blockedOn===s&&(t.blockedOn=null,ts||(ts=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Ku)))}function Os(t){function s(v){return ns(v,t)}if(0<As.length){ns(As[0],t);for(var a=1;a<As.length;a++){var f=As[a];f.blockedOn===t&&(f.blockedOn=null)}}for(lr!==null&&ns(lr,t),Dn!==null&&ns(Dn,t),ur!==null&&ns(ur,t),Is.forEach(s),Cr.forEach(s),a=0;a<Lt.length;a++)f=Lt[a],f.blockedOn===t&&(f.blockedOn=null);for(;0<Lt.length&&(a=Lt[0],a.blockedOn===null);)To(a),a.blockedOn===null&&Lt.shift()}var kn=C.ReactCurrentBatchConfig,En=!0;function Ei(t,s,a,f){var v=We,x=kn.transition;kn.transition=null;try{We=1,Ao(t,s,a,f)}finally{We=v,kn.transition=x}}function Ls(t,s,a,f){var v=We,x=kn.transition;kn.transition=null;try{We=4,Ao(t,s,a,f)}finally{We=v,kn.transition=x}}function Ao(t,s,a,f){if(En){var v=qs(t,s,a,f);if(v===null)oc(t,s,f,St,a),Ro(t,f);else if(Yu(v,t,s,a,f))f.stopPropagation();else if(Ro(t,f),s&4&&-1<jo.indexOf(t)){for(;v!==null;){var x=Go(v);if(x!==null&&Er(x),x=qs(t,s,a,f),x===null&&oc(t,s,f,St,a),x===v)break;v=x}v!==null&&f.stopPropagation()}else oc(t,s,f,null,a)}}var St=null;function qs(t,s,a,f){if(St=null,t=yr(f),t=Bs(t),t!==null)if(s=gn(t),s===null)t=null;else if(a=s.tag,a===13){if(t=jt(s),t!==null)return t;t=null}else if(a===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;t=null}else s!==t&&(t=null);return St=t,null}function Io(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(ko()){case br:return 1;case js:return 4;case or:case $n:return 16;case yi:return 536870912;default:return 16}default:return 16}}var zn=null,Ni=null,jr=null;function Ci(){if(jr)return jr;var t,s=Ni,a=s.length,f,v="value"in zn?zn.value:zn.textContent,x=v.length;for(t=0;t<a&&s[t]===v[t];t++);var j=a-t;for(f=1;f<=j&&s[a-f]===v[x-f];f++);return jr=v.slice(t,1<f?1-f:void 0)}function $s(t){var s=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&s===13&&(t=13)):t=s,t===10&&(t=13),32<=t||t===13?t:0}function rs(){return!0}function Mo(){return!1}function qt(t){function s(a,f,v,x,j){this._reactName=a,this._targetInst=v,this.type=f,this.nativeEvent=x,this.target=j,this.currentTarget=null;for(var D in t)t.hasOwnProperty(D)&&(a=t[D],this[D]=a?a(x):x[D]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?rs:Mo,this.isPropagationStopped=Mo,this}return X(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=rs)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=rs)},persist:function(){},isPersistent:rs}),s}var Rr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Tr=qt(Rr),Ds=X({},Rr,{view:0,detail:0}),cr=qt(Ds),ji,Ri,Rt,Fs=X({},Ds,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ar,button:0,buttons:0,relatedTarget:function(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!==Rt&&(Rt&&t.type==="mousemove"?(ji=t.screenX-Rt.screenX,Ri=t.screenY-Rt.screenY):Ri=ji=0,Rt=t),ji)},movementY:function(t){return"movementY"in t?t.movementY:Ri}}),Po=qt(Fs),Ua=X({},Fs,{dataTransfer:0}),Ha=qt(Ua),B=X({},Ds,{relatedTarget:0}),V=qt(B),oe=X({},Rr,{animationName:0,elapsedTime:0,pseudoElement:0}),de=qt(oe),xe=X({},Rr,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Ne=qt(xe),Ie=X({},Rr,{data:0}),Le=qt(Ie),Ve={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Qe={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"},rt={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Nn(t){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(t):(t=rt[t])?!!s[t]:!1}function Ar(){return Nn}var Oo=X({},Ds,{key:function(t){if(t.key){var s=Ve[t.key]||t.key;if(s!=="Unidentified")return s}return t.type==="keypress"?(t=$s(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Qe[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ar,charCode:function(t){return t.type==="keypress"?$s(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?$s(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),zs=qt(Oo),Lo=X({},Fs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),qo=qt(Lo),Ti=X({},Ds,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ar}),Bn=qt(Ti),xt=X({},Rr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Wa=qt(xt),Nj=X({},Fs,{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}),Cj=qt(Nj),jj=[9,13,27,32],Xu=c&&"CompositionEvent"in window,$o=null;c&&"documentMode"in document&&($o=document.documentMode);var Rj=c&&"TextEvent"in window&&!$o,py=c&&(!Xu||$o&&8<$o&&11>=$o),my=" ",gy=!1;function vy(t,s){switch(t){case"keyup":return jj.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yy(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ai=!1;function Tj(t,s){switch(t){case"compositionend":return yy(s);case"keypress":return s.which!==32?null:(gy=!0,my);case"textInput":return t=s.data,t===my&&gy?null:t;default:return null}}function Aj(t,s){if(Ai)return t==="compositionend"||!Xu&&vy(t,s)?(t=Ci(),jr=Ni=zn=null,Ai=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return py&&s.locale!=="ko"?null:s.data;default:return null}}var Ij={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 wy(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s==="input"?!!Ij[t.type]:s==="textarea"}function xy(t,s,a,f){Gr(f),s=Xa(s,"onChange"),0<s.length&&(a=new Tr("onChange","change",null,a,f),t.push({event:a,listeners:s}))}var Do=null,Fo=null;function Mj(t){$y(t,0)}function Va(t){var s=Li(t);if(ve(s))return t}function Pj(t,s){if(t==="change")return s}var _y=!1;if(c){var Qu;if(c){var Zu="oninput"in document;if(!Zu){var by=document.createElement("div");by.setAttribute("oninput","return;"),Zu=typeof by.oninput=="function"}Qu=Zu}else Qu=!1;_y=Qu&&(!document.documentMode||9<document.documentMode)}function Sy(){Do&&(Do.detachEvent("onpropertychange",ky),Fo=Do=null)}function ky(t){if(t.propertyName==="value"&&Va(Fo)){var s=[];xy(s,Fo,t,yr(t)),pi(Mj,s)}}function Oj(t,s,a){t==="focusin"?(Sy(),Do=s,Fo=a,Do.attachEvent("onpropertychange",ky)):t==="focusout"&&Sy()}function Lj(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Va(Fo)}function qj(t,s){if(t==="click")return Va(s)}function $j(t,s){if(t==="input"||t==="change")return Va(s)}function Dj(t,s){return t===s&&(t!==0||1/t===1/s)||t!==t&&s!==s}var Un=typeof Object.is=="function"?Object.is:Dj;function zo(t,s){if(Un(t,s))return!0;if(typeof t!="object"||t===null||typeof s!="object"||s===null)return!1;var a=Object.keys(t),f=Object.keys(s);if(a.length!==f.length)return!1;for(f=0;f<a.length;f++){var v=a[f];if(!h.call(s,v)||!Un(t[v],s[v]))return!1}return!0}function Ey(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Ny(t,s){var a=Ey(t);t=0;for(var f;a;){if(a.nodeType===3){if(f=t+a.textContent.length,t<=s&&f>=s)return{node:a,offset:s-t};t=f}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Ey(a)}}function Cy(t,s){return t&&s?t===s?!0:t&&t.nodeType===3?!1:s&&s.nodeType===3?Cy(t,s.parentNode):"contains"in t?t.contains(s):t.compareDocumentPosition?!!(t.compareDocumentPosition(s)&16):!1:!1}function jy(){for(var t=window,s=Te();s instanceof t.HTMLIFrameElement;){try{var a=typeof s.contentWindow.location.href=="string"}catch{a=!1}if(a)t=s.contentWindow;else break;s=Te(t.document)}return s}function Ju(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s&&(s==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||s==="textarea"||t.contentEditable==="true")}function Fj(t){var s=jy(),a=t.focusedElem,f=t.selectionRange;if(s!==a&&a&&a.ownerDocument&&Cy(a.ownerDocument.documentElement,a)){if(f!==null&&Ju(a)){if(s=f.start,t=f.end,t===void 0&&(t=s),"selectionStart"in a)a.selectionStart=s,a.selectionEnd=Math.min(t,a.value.length);else if(t=(s=a.ownerDocument||document)&&s.defaultView||window,t.getSelection){t=t.getSelection();var v=a.textContent.length,x=Math.min(f.start,v);f=f.end===void 0?x:Math.min(f.end,v),!t.extend&&x>f&&(v=f,f=x,x=v),v=Ny(a,x);var j=Ny(a,f);v&&j&&(t.rangeCount!==1||t.anchorNode!==v.node||t.anchorOffset!==v.offset||t.focusNode!==j.node||t.focusOffset!==j.offset)&&(s=s.createRange(),s.setStart(v.node,v.offset),t.removeAllRanges(),x>f?(t.addRange(s),t.extend(j.node,j.offset)):(s.setEnd(j.node,j.offset),t.addRange(s)))}}for(s=[],t=a;t=t.parentNode;)t.nodeType===1&&s.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<s.length;a++)t=s[a],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var zj=c&&"documentMode"in document&&11>=document.documentMode,Ii=null,ec=null,Bo=null,tc=!1;function Ry(t,s,a){var f=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;tc||Ii==null||Ii!==Te(f)||(f=Ii,"selectionStart"in f&&Ju(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),Bo&&zo(Bo,f)||(Bo=f,f=Xa(ec,"onSelect"),0<f.length&&(s=new Tr("onSelect","select",null,s,a),t.push({event:s,listeners:f}),s.target=Ii)))}function Ga(t,s){var a={};return a[t.toLowerCase()]=s.toLowerCase(),a["Webkit"+t]="webkit"+s,a["Moz"+t]="moz"+s,a}var Mi={animationend:Ga("Animation","AnimationEnd"),animationiteration:Ga("Animation","AnimationIteration"),animationstart:Ga("Animation","AnimationStart"),transitionend:Ga("Transition","TransitionEnd")},nc={},Ty={};c&&(Ty=document.createElement("div").style,"AnimationEvent"in window||(delete Mi.animationend.animation,delete Mi.animationiteration.animation,delete Mi.animationstart.animation),"TransitionEvent"in window||delete Mi.transitionend.transition);function Ya(t){if(nc[t])return nc[t];if(!Mi[t])return t;var s=Mi[t],a;for(a in s)if(s.hasOwnProperty(a)&&a in Ty)return nc[t]=s[a];return t}var Ay=Ya("animationend"),Iy=Ya("animationiteration"),My=Ya("animationstart"),Py=Ya("transitionend"),Oy=new Map,Ly="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 ss(t,s){Oy.set(t,s),l(s,[t])}for(var rc=0;rc<Ly.length;rc++){var sc=Ly[rc],Bj=sc.toLowerCase(),Uj=sc[0].toUpperCase()+sc.slice(1);ss(Bj,"on"+Uj)}ss(Ay,"onAnimationEnd"),ss(Iy,"onAnimationIteration"),ss(My,"onAnimationStart"),ss("dblclick","onDoubleClick"),ss("focusin","onFocus"),ss("focusout","onBlur"),ss(Py,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Uo="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(" "),Hj=new Set("cancel close invalid load scroll toggle".split(" ").concat(Uo));function qy(t,s,a){var f=t.type||"unknown-event";t.currentTarget=a,Ns(f,s,void 0,t),t.currentTarget=null}function $y(t,s){s=(s&4)!==0;for(var a=0;a<t.length;a++){var f=t[a],v=f.event;f=f.listeners;e:{var x=void 0;if(s)for(var j=f.length-1;0<=j;j--){var D=f[j],K=D.instance,ae=D.currentTarget;if(D=D.listener,K!==x&&v.isPropagationStopped())break e;qy(v,D,ae),x=K}else for(j=0;j<f.length;j++){if(D=f[j],K=D.instance,ae=D.currentTarget,D=D.listener,K!==x&&v.isPropagationStopped())break e;qy(v,D,ae),x=K}}}if(mn)throw t=Yr,mn=!1,Yr=null,t}function tt(t,s){var a=s[fc];a===void 0&&(a=s[fc]=new Set);var f=t+"__bubble";a.has(f)||(Dy(s,t,2,!1),a.add(f))}function ic(t,s,a){var f=0;s&&(f|=4),Dy(a,t,f,s)}var Ka="_reactListening"+Math.random().toString(36).slice(2);function Ho(t){if(!t[Ka]){t[Ka]=!0,i.forEach(function(a){a!=="selectionchange"&&(Hj.has(a)||ic(a,!1,t),ic(a,!0,t))});var s=t.nodeType===9?t:t.ownerDocument;s===null||s[Ka]||(s[Ka]=!0,ic("selectionchange",!1,s))}}function Dy(t,s,a,f){switch(Io(s)){case 1:var v=Ei;break;case 4:v=Ls;break;default:v=Ao}a=v.bind(null,s,a,t),v=void 0,!rr||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(v=!0),f?v!==void 0?t.addEventListener(s,a,{capture:!0,passive:v}):t.addEventListener(s,a,!0):v!==void 0?t.addEventListener(s,a,{passive:v}):t.addEventListener(s,a,!1)}function oc(t,s,a,f,v){var x=f;if((s&1)===0&&(s&2)===0&&f!==null)e:for(;;){if(f===null)return;var j=f.tag;if(j===3||j===4){var D=f.stateNode.containerInfo;if(D===v||D.nodeType===8&&D.parentNode===v)break;if(j===4)for(j=f.return;j!==null;){var K=j.tag;if((K===3||K===4)&&(K=j.stateNode.containerInfo,K===v||K.nodeType===8&&K.parentNode===v))return;j=j.return}for(;D!==null;){if(j=Bs(D),j===null)return;if(K=j.tag,K===5||K===6){f=x=j;continue e}D=D.parentNode}}f=f.return}pi(function(){var ae=x,pe=yr(a),me=[];e:{var he=Oy.get(t);if(he!==void 0){var be=Tr,Ee=t;switch(t){case"keypress":if($s(a)===0)break e;case"keydown":case"keyup":be=zs;break;case"focusin":Ee="focus",be=V;break;case"focusout":Ee="blur",be=V;break;case"beforeblur":case"afterblur":be=V;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":be=Po;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":be=Ha;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":be=Bn;break;case Ay:case Iy:case My:be=de;break;case Py:be=Wa;break;case"scroll":be=cr;break;case"wheel":be=Cj;break;case"copy":case"cut":case"paste":be=Ne;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":be=qo}var je=(s&4)!==0,gt=!je&&t==="scroll",se=je?he!==null?he+"Capture":null:he;je=[];for(var ee=ae,ie;ee!==null;){ie=ee;var ge=ie.stateNode;if(ie.tag===5&&ge!==null&&(ie=ge,se!==null&&(ge=Jt(ee,se),ge!=null&&je.push(Wo(ee,ge,ie)))),gt)break;ee=ee.return}0<je.length&&(he=new be(he,Ee,null,a,pe),me.push({event:he,listeners:je}))}}if((s&7)===0){e:{if(he=t==="mouseover"||t==="pointerover",be=t==="mouseout"||t==="pointerout",he&&a!==Qt&&(Ee=a.relatedTarget||a.fromElement)&&(Bs(Ee)||Ee[Ir]))break e;if((be||he)&&(he=pe.window===pe?pe:(he=pe.ownerDocument)?he.defaultView||he.parentWindow:window,be?(Ee=a.relatedTarget||a.toElement,be=ae,Ee=Ee?Bs(Ee):null,Ee!==null&&(gt=gn(Ee),Ee!==gt||Ee.tag!==5&&Ee.tag!==6)&&(Ee=null)):(be=null,Ee=ae),be!==Ee)){if(je=Po,ge="onMouseLeave",se="onMouseEnter",ee="mouse",(t==="pointerout"||t==="pointerover")&&(je=qo,ge="onPointerLeave",se="onPointerEnter",ee="pointer"),gt=be==null?he:Li(be),ie=Ee==null?he:Li(Ee),he=new je(ge,ee+"leave",be,a,pe),he.target=gt,he.relatedTarget=ie,ge=null,Bs(pe)===ae&&(je=new je(se,ee+"enter",Ee,a,pe),je.target=ie,je.relatedTarget=gt,ge=je),gt=ge,be&&Ee)t:{for(je=be,se=Ee,ee=0,ie=je;ie;ie=Pi(ie))ee++;for(ie=0,ge=se;ge;ge=Pi(ge))ie++;for(;0<ee-ie;)je=Pi(je),ee--;for(;0<ie-ee;)se=Pi(se),ie--;for(;ee--;){if(je===se||se!==null&&je===se.alternate)break t;je=Pi(je),se=Pi(se)}je=null}else je=null;be!==null&&Fy(me,he,be,je,!1),Ee!==null&>!==null&&Fy(me,gt,Ee,je,!0)}}e:{if(he=ae?Li(ae):window,be=he.nodeName&&he.nodeName.toLowerCase(),be==="select"||be==="input"&&he.type==="file")var Re=Pj;else if(wy(he))if(_y)Re=$j;else{Re=Lj;var Me=Oj}else(be=he.nodeName)&&be.toLowerCase()==="input"&&(he.type==="checkbox"||he.type==="radio")&&(Re=qj);if(Re&&(Re=Re(t,ae))){xy(me,Re,a,pe);break e}Me&&Me(t,he,ae),t==="focusout"&&(Me=he._wrapperState)&&Me.controlled&&he.type==="number"&&ze(he,"number",he.value)}switch(Me=ae?Li(ae):window,t){case"focusin":(wy(Me)||Me.contentEditable==="true")&&(Ii=Me,ec=ae,Bo=null);break;case"focusout":Bo=ec=Ii=null;break;case"mousedown":tc=!0;break;case"contextmenu":case"mouseup":case"dragend":tc=!1,Ry(me,a,pe);break;case"selectionchange":if(zj)break;case"keydown":case"keyup":Ry(me,a,pe)}var Pe;if(Xu)e:{switch(t){case"compositionstart":var Oe="onCompositionStart";break e;case"compositionend":Oe="onCompositionEnd";break e;case"compositionupdate":Oe="onCompositionUpdate";break e}Oe=void 0}else Ai?vy(t,a)&&(Oe="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(Oe="onCompositionStart");Oe&&(py&&a.locale!=="ko"&&(Ai||Oe!=="onCompositionStart"?Oe==="onCompositionEnd"&&Ai&&(Pe=Ci()):(zn=pe,Ni="value"in zn?zn.value:zn.textContent,Ai=!0)),Me=Xa(ae,Oe),0<Me.length&&(Oe=new Le(Oe,t,null,a,pe),me.push({event:Oe,listeners:Me}),Pe?Oe.data=Pe:(Pe=yy(a),Pe!==null&&(Oe.data=Pe)))),(Pe=Rj?Tj(t,a):Aj(t,a))&&(ae=Xa(ae,"onBeforeInput"),0<ae.length&&(pe=new Le("onBeforeInput","beforeinput",null,a,pe),me.push({event:pe,listeners:ae}),pe.data=Pe))}$y(me,s)})}function Wo(t,s,a){return{instance:t,listener:s,currentTarget:a}}function Xa(t,s){for(var a=s+"Capture",f=[];t!==null;){var v=t,x=v.stateNode;v.tag===5&&x!==null&&(v=x,x=Jt(t,a),x!=null&&f.unshift(Wo(t,x,v)),x=Jt(t,s),x!=null&&f.push(Wo(t,x,v))),t=t.return}return f}function Pi(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Fy(t,s,a,f,v){for(var x=s._reactName,j=[];a!==null&&a!==f;){var D=a,K=D.alternate,ae=D.stateNode;if(K!==null&&K===f)break;D.tag===5&&ae!==null&&(D=ae,v?(K=Jt(a,x),K!=null&&j.unshift(Wo(a,K,D))):v||(K=Jt(a,x),K!=null&&j.push(Wo(a,K,D)))),a=a.return}j.length!==0&&t.push({event:s,listeners:j})}var Wj=/\r\n?/g,Vj=/\u0000|\uFFFD/g;function zy(t){return(typeof t=="string"?t:""+t).replace(Wj,`
|
|
38
38
|
`).replace(Vj,"")}function Qa(t,s,a){if(s=zy(s),zy(t)!==s&&a)throw Error(r(425))}function Za(){}var ac=null,lc=null;function uc(t,s){return t==="textarea"||t==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var cc=typeof setTimeout=="function"?setTimeout:void 0,Gj=typeof clearTimeout=="function"?clearTimeout:void 0,By=typeof Promise=="function"?Promise:void 0,Yj=typeof queueMicrotask=="function"?queueMicrotask:typeof By<"u"?function(t){return By.resolve(null).then(t).catch(Kj)}:cc;function Kj(t){setTimeout(function(){throw t})}function dc(t,s){var a=s,f=0;do{var v=a.nextSibling;if(t.removeChild(a),v&&v.nodeType===8)if(a=v.data,a==="/$"){if(f===0){t.removeChild(v),Os(s);return}f--}else a!=="$"&&a!=="$?"&&a!=="$!"||f++;a=v}while(a);Os(s)}function is(t){for(;t!=null;t=t.nextSibling){var s=t.nodeType;if(s===1||s===3)break;if(s===8){if(s=t.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return t}function Uy(t){t=t.previousSibling;for(var s=0;t;){if(t.nodeType===8){var a=t.data;if(a==="$"||a==="$!"||a==="$?"){if(s===0)return t;s--}else a==="/$"&&s++}t=t.previousSibling}return null}var Oi=Math.random().toString(36).slice(2),dr="__reactFiber$"+Oi,Vo="__reactProps$"+Oi,Ir="__reactContainer$"+Oi,fc="__reactEvents$"+Oi,Xj="__reactListeners$"+Oi,Qj="__reactHandles$"+Oi;function Bs(t){var s=t[dr];if(s)return s;for(var a=t.parentNode;a;){if(s=a[Ir]||a[dr]){if(a=s.alternate,s.child!==null||a!==null&&a.child!==null)for(t=Uy(t);t!==null;){if(a=t[dr])return a;t=Uy(t)}return s}t=a,a=t.parentNode}return null}function Go(t){return t=t[dr]||t[Ir],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Li(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(r(33))}function Ja(t){return t[Vo]||null}var hc=[],qi=-1;function os(t){return{current:t}}function nt(t){0>qi||(t.current=hc[qi],hc[qi]=null,qi--)}function et(t,s){qi++,hc[qi]=t.current,t.current=s}var as={},Wt=os(as),sn=os(!1),Us=as;function $i(t,s){var a=t.type.contextTypes;if(!a)return as;var f=t.stateNode;if(f&&f.__reactInternalMemoizedUnmaskedChildContext===s)return f.__reactInternalMemoizedMaskedChildContext;var v={},x;for(x in a)v[x]=s[x];return f&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=v),v}function on(t){return t=t.childContextTypes,t!=null}function el(){nt(sn),nt(Wt)}function Hy(t,s,a){if(Wt.current!==as)throw Error(r(168));et(Wt,s),et(sn,a)}function Wy(t,s,a){var f=t.stateNode;if(s=s.childContextTypes,typeof f.getChildContext!="function")return a;f=f.getChildContext();for(var v in f)if(!(v in s))throw Error(r(108,le(t)||"Unknown",v));return X({},a,f)}function tl(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||as,Us=Wt.current,et(Wt,t),et(sn,sn.current),!0}function Vy(t,s,a){var f=t.stateNode;if(!f)throw Error(r(169));a?(t=Wy(t,s,Us),f.__reactInternalMemoizedMergedChildContext=t,nt(sn),nt(Wt),et(Wt,t)):nt(sn),et(sn,a)}var Mr=null,nl=!1,pc=!1;function Gy(t){Mr===null?Mr=[t]:Mr.push(t)}function Zj(t){nl=!0,Gy(t)}function ls(){if(!pc&&Mr!==null){pc=!0;var t=0,s=We;try{var a=Mr;for(We=1;t<a.length;t++){var f=a[t];do f=f(!0);while(f!==null)}Mr=null,nl=!1}catch(v){throw Mr!==null&&(Mr=Mr.slice(t+1)),Cs(br,ls),v}finally{We=s,pc=!1}}return null}var Di=[],Fi=0,rl=null,sl=0,Cn=[],jn=0,Hs=null,Pr=1,Or="";function Ws(t,s){Di[Fi++]=sl,Di[Fi++]=rl,rl=t,sl=s}function Yy(t,s,a){Cn[jn++]=Pr,Cn[jn++]=Or,Cn[jn++]=Hs,Hs=t;var f=Pr;t=Or;var v=32-rn(f)-1;f&=~(1<<v),a+=1;var x=32-rn(s)+v;if(30<x){var j=v-v%5;x=(f&(1<<j)-1).toString(32),f>>=j,v-=j,Pr=1<<32-rn(s)+v|a<<v|f,Or=x+t}else Pr=1<<x|a<<v|f,Or=t}function mc(t){t.return!==null&&(Ws(t,1),Yy(t,1,0))}function gc(t){for(;t===rl;)rl=Di[--Fi],Di[Fi]=null,sl=Di[--Fi],Di[Fi]=null;for(;t===Hs;)Hs=Cn[--jn],Cn[jn]=null,Or=Cn[--jn],Cn[jn]=null,Pr=Cn[--jn],Cn[jn]=null}var vn=null,yn=null,st=!1,Hn=null;function Ky(t,s){var a=In(5,null,null,0);a.elementType="DELETED",a.stateNode=s,a.return=t,s=t.deletions,s===null?(t.deletions=[a],t.flags|=16):s.push(a)}function Xy(t,s){switch(t.tag){case 5:var a=t.type;return s=s.nodeType!==1||a.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(t.stateNode=s,vn=t,yn=is(s.firstChild),!0):!1;case 6:return s=t.pendingProps===""||s.nodeType!==3?null:s,s!==null?(t.stateNode=s,vn=t,yn=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(a=Hs!==null?{id:Pr,overflow:Or}:null,t.memoizedState={dehydrated:s,treeContext:a,retryLane:1073741824},a=In(18,null,null,0),a.stateNode=s,a.return=t,t.child=a,vn=t,yn=null,!0):!1;default:return!1}}function vc(t){return(t.mode&1)!==0&&(t.flags&128)===0}function yc(t){if(st){var s=yn;if(s){var a=s;if(!Xy(t,s)){if(vc(t))throw Error(r(418));s=is(a.nextSibling);var f=vn;s&&Xy(t,s)?Ky(f,a):(t.flags=t.flags&-4097|2,st=!1,vn=t)}}else{if(vc(t))throw Error(r(418));t.flags=t.flags&-4097|2,st=!1,vn=t}}}function Qy(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;vn=t}function il(t){if(t!==vn)return!1;if(!st)return Qy(t),st=!0,!1;var s;if((s=t.tag!==3)&&!(s=t.tag!==5)&&(s=t.type,s=s!=="head"&&s!=="body"&&!uc(t.type,t.memoizedProps)),s&&(s=yn)){if(vc(t))throw Zy(),Error(r(418));for(;s;)Ky(t,s),s=is(s.nextSibling)}if(Qy(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));e:{for(t=t.nextSibling,s=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"){if(s===0){yn=is(t.nextSibling);break e}s--}else a!=="$"&&a!=="$!"&&a!=="$?"||s++}t=t.nextSibling}yn=null}}else yn=vn?is(t.stateNode.nextSibling):null;return!0}function Zy(){for(var t=yn;t;)t=is(t.nextSibling)}function zi(){yn=vn=null,st=!1}function wc(t){Hn===null?Hn=[t]:Hn.push(t)}var Jj=C.ReactCurrentBatchConfig;function Yo(t,s,a){if(t=a.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(a._owner){if(a=a._owner,a){if(a.tag!==1)throw Error(r(309));var f=a.stateNode}if(!f)throw Error(r(147,t));var v=f,x=""+t;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===x?s.ref:(s=function(j){var D=v.refs;j===null?delete D[x]:D[x]=j},s._stringRef=x,s)}if(typeof t!="string")throw Error(r(284));if(!a._owner)throw Error(r(290,t))}return t}function ol(t,s){throw t=Object.prototype.toString.call(s),Error(r(31,t==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":t))}function Jy(t){var s=t._init;return s(t._payload)}function e0(t){function s(se,ee){if(t){var ie=se.deletions;ie===null?(se.deletions=[ee],se.flags|=16):ie.push(ee)}}function a(se,ee){if(!t)return null;for(;ee!==null;)s(se,ee),ee=ee.sibling;return null}function f(se,ee){for(se=new Map;ee!==null;)ee.key!==null?se.set(ee.key,ee):se.set(ee.index,ee),ee=ee.sibling;return se}function v(se,ee){return se=gs(se,ee),se.index=0,se.sibling=null,se}function x(se,ee,ie){return se.index=ie,t?(ie=se.alternate,ie!==null?(ie=ie.index,ie<ee?(se.flags|=2,ee):ie):(se.flags|=2,ee)):(se.flags|=1048576,ee)}function j(se){return t&&se.alternate===null&&(se.flags|=2),se}function D(se,ee,ie,ge){return ee===null||ee.tag!==6?(ee=cd(ie,se.mode,ge),ee.return=se,ee):(ee=v(ee,ie),ee.return=se,ee)}function K(se,ee,ie,ge){var Re=ie.type;return Re===L?pe(se,ee,ie.props.children,ge,ie.key):ee!==null&&(ee.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===z&&Jy(Re)===ee.type)?(ge=v(ee,ie.props),ge.ref=Yo(se,ee,ie),ge.return=se,ge):(ge=Tl(ie.type,ie.key,ie.props,null,se.mode,ge),ge.ref=Yo(se,ee,ie),ge.return=se,ge)}function ae(se,ee,ie,ge){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==ie.containerInfo||ee.stateNode.implementation!==ie.implementation?(ee=dd(ie,se.mode,ge),ee.return=se,ee):(ee=v(ee,ie.children||[]),ee.return=se,ee)}function pe(se,ee,ie,ge,Re){return ee===null||ee.tag!==7?(ee=Js(ie,se.mode,ge,Re),ee.return=se,ee):(ee=v(ee,ie),ee.return=se,ee)}function me(se,ee,ie){if(typeof ee=="string"&&ee!==""||typeof ee=="number")return ee=cd(""+ee,se.mode,ie),ee.return=se,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case A:return ie=Tl(ee.type,ee.key,ee.props,null,se.mode,ie),ie.ref=Yo(se,null,ee),ie.return=se,ie;case M:return ee=dd(ee,se.mode,ie),ee.return=se,ee;case z:var ge=ee._init;return me(se,ge(ee._payload),ie)}if(ft(ee)||$(ee))return ee=Js(ee,se.mode,ie,null),ee.return=se,ee;ol(se,ee)}return null}function he(se,ee,ie,ge){var Re=ee!==null?ee.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number")return Re!==null?null:D(se,ee,""+ie,ge);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case A:return ie.key===Re?K(se,ee,ie,ge):null;case M:return ie.key===Re?ae(se,ee,ie,ge):null;case z:return Re=ie._init,he(se,ee,Re(ie._payload),ge)}if(ft(ie)||$(ie))return Re!==null?null:pe(se,ee,ie,ge,null);ol(se,ie)}return null}function be(se,ee,ie,ge,Re){if(typeof ge=="string"&&ge!==""||typeof ge=="number")return se=se.get(ie)||null,D(ee,se,""+ge,Re);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case A:return se=se.get(ge.key===null?ie:ge.key)||null,K(ee,se,ge,Re);case M:return se=se.get(ge.key===null?ie:ge.key)||null,ae(ee,se,ge,Re);case z:var Me=ge._init;return be(se,ee,ie,Me(ge._payload),Re)}if(ft(ge)||$(ge))return se=se.get(ie)||null,pe(ee,se,ge,Re,null);ol(ee,ge)}return null}function Ee(se,ee,ie,ge){for(var Re=null,Me=null,Pe=ee,Oe=ee=0,It=null;Pe!==null&&Oe<ie.length;Oe++){Pe.index>Oe?(It=Pe,Pe=null):It=Pe.sibling;var He=he(se,Pe,ie[Oe],ge);if(He===null){Pe===null&&(Pe=It);break}t&&Pe&&He.alternate===null&&s(se,Pe),ee=x(He,ee,Oe),Me===null?Re=He:Me.sibling=He,Me=He,Pe=It}if(Oe===ie.length)return a(se,Pe),st&&Ws(se,Oe),Re;if(Pe===null){for(;Oe<ie.length;Oe++)Pe=me(se,ie[Oe],ge),Pe!==null&&(ee=x(Pe,ee,Oe),Me===null?Re=Pe:Me.sibling=Pe,Me=Pe);return st&&Ws(se,Oe),Re}for(Pe=f(se,Pe);Oe<ie.length;Oe++)It=be(Pe,se,Oe,ie[Oe],ge),It!==null&&(t&&It.alternate!==null&&Pe.delete(It.key===null?Oe:It.key),ee=x(It,ee,Oe),Me===null?Re=It:Me.sibling=It,Me=It);return t&&Pe.forEach(function(vs){return s(se,vs)}),st&&Ws(se,Oe),Re}function je(se,ee,ie,ge){var Re=$(ie);if(typeof Re!="function")throw Error(r(150));if(ie=Re.call(ie),ie==null)throw Error(r(151));for(var Me=Re=null,Pe=ee,Oe=ee=0,It=null,He=ie.next();Pe!==null&&!He.done;Oe++,He=ie.next()){Pe.index>Oe?(It=Pe,Pe=null):It=Pe.sibling;var vs=he(se,Pe,He.value,ge);if(vs===null){Pe===null&&(Pe=It);break}t&&Pe&&vs.alternate===null&&s(se,Pe),ee=x(vs,ee,Oe),Me===null?Re=vs:Me.sibling=vs,Me=vs,Pe=It}if(He.done)return a(se,Pe),st&&Ws(se,Oe),Re;if(Pe===null){for(;!He.done;Oe++,He=ie.next())He=me(se,He.value,ge),He!==null&&(ee=x(He,ee,Oe),Me===null?Re=He:Me.sibling=He,Me=He);return st&&Ws(se,Oe),Re}for(Pe=f(se,Pe);!He.done;Oe++,He=ie.next())He=be(Pe,se,Oe,He.value,ge),He!==null&&(t&&He.alternate!==null&&Pe.delete(He.key===null?Oe:He.key),ee=x(He,ee,Oe),Me===null?Re=He:Me.sibling=He,Me=He);return t&&Pe.forEach(function(IR){return s(se,IR)}),st&&Ws(se,Oe),Re}function gt(se,ee,ie,ge){if(typeof ie=="object"&&ie!==null&&ie.type===L&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case A:e:{for(var Re=ie.key,Me=ee;Me!==null;){if(Me.key===Re){if(Re=ie.type,Re===L){if(Me.tag===7){a(se,Me.sibling),ee=v(Me,ie.props.children),ee.return=se,se=ee;break e}}else if(Me.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===z&&Jy(Re)===Me.type){a(se,Me.sibling),ee=v(Me,ie.props),ee.ref=Yo(se,Me,ie),ee.return=se,se=ee;break e}a(se,Me);break}else s(se,Me);Me=Me.sibling}ie.type===L?(ee=Js(ie.props.children,se.mode,ge,ie.key),ee.return=se,se=ee):(ge=Tl(ie.type,ie.key,ie.props,null,se.mode,ge),ge.ref=Yo(se,ee,ie),ge.return=se,se=ge)}return j(se);case M:e:{for(Me=ie.key;ee!==null;){if(ee.key===Me)if(ee.tag===4&&ee.stateNode.containerInfo===ie.containerInfo&&ee.stateNode.implementation===ie.implementation){a(se,ee.sibling),ee=v(ee,ie.children||[]),ee.return=se,se=ee;break e}else{a(se,ee);break}else s(se,ee);ee=ee.sibling}ee=dd(ie,se.mode,ge),ee.return=se,se=ee}return j(se);case z:return Me=ie._init,gt(se,ee,Me(ie._payload),ge)}if(ft(ie))return Ee(se,ee,ie,ge);if($(ie))return je(se,ee,ie,ge);ol(se,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"?(ie=""+ie,ee!==null&&ee.tag===6?(a(se,ee.sibling),ee=v(ee,ie),ee.return=se,se=ee):(a(se,ee),ee=cd(ie,se.mode,ge),ee.return=se,se=ee),j(se)):a(se,ee)}return gt}var Bi=e0(!0),t0=e0(!1),al=os(null),ll=null,Ui=null,xc=null;function _c(){xc=Ui=ll=null}function bc(t){var s=al.current;nt(al),t._currentValue=s}function Sc(t,s,a){for(;t!==null;){var f=t.alternate;if((t.childLanes&s)!==s?(t.childLanes|=s,f!==null&&(f.childLanes|=s)):f!==null&&(f.childLanes&s)!==s&&(f.childLanes|=s),t===a)break;t=t.return}}function Hi(t,s){ll=t,xc=Ui=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&s)!==0&&(an=!0),t.firstContext=null)}function Rn(t){var s=t._currentValue;if(xc!==t)if(t={context:t,memoizedValue:s,next:null},Ui===null){if(ll===null)throw Error(r(308));Ui=t,ll.dependencies={lanes:0,firstContext:t}}else Ui=Ui.next=t;return s}var Vs=null;function kc(t){Vs===null?Vs=[t]:Vs.push(t)}function n0(t,s,a,f){var v=s.interleaved;return v===null?(a.next=a,kc(s)):(a.next=v.next,v.next=a),s.interleaved=a,Lr(t,f)}function Lr(t,s){t.lanes|=s;var a=t.alternate;for(a!==null&&(a.lanes|=s),a=t,t=t.return;t!==null;)t.childLanes|=s,a=t.alternate,a!==null&&(a.childLanes|=s),a=t,t=t.return;return a.tag===3?a.stateNode:null}var us=!1;function Ec(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function r0(t,s){t=t.updateQueue,s.updateQueue===t&&(s.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function qr(t,s){return{eventTime:t,lane:s,tag:0,payload:null,callback:null,next:null}}function cs(t,s,a){var f=t.updateQueue;if(f===null)return null;if(f=f.shared,(Be&2)!==0){var v=f.pending;return v===null?s.next=s:(s.next=v.next,v.next=s),f.pending=s,Lr(t,a)}return v=f.interleaved,v===null?(s.next=s,kc(f)):(s.next=v.next,v.next=s),f.interleaved=s,Lr(t,a)}function ul(t,s,a){if(s=s.updateQueue,s!==null&&(s=s.shared,(a&4194240)!==0)){var f=s.lanes;f&=t.pendingLanes,a|=f,s.lanes=a,Ht(t,a)}}function s0(t,s){var a=t.updateQueue,f=t.alternate;if(f!==null&&(f=f.updateQueue,a===f)){var v=null,x=null;if(a=a.firstBaseUpdate,a!==null){do{var j={eventTime:a.eventTime,lane:a.lane,tag:a.tag,payload:a.payload,callback:a.callback,next:null};x===null?v=x=j:x=x.next=j,a=a.next}while(a!==null);x===null?v=x=s:x=x.next=s}else v=x=s;a={baseState:f.baseState,firstBaseUpdate:v,lastBaseUpdate:x,shared:f.shared,effects:f.effects},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=s:t.next=s,a.lastBaseUpdate=s}function cl(t,s,a,f){var v=t.updateQueue;us=!1;var x=v.firstBaseUpdate,j=v.lastBaseUpdate,D=v.shared.pending;if(D!==null){v.shared.pending=null;var K=D,ae=K.next;K.next=null,j===null?x=ae:j.next=ae,j=K;var pe=t.alternate;pe!==null&&(pe=pe.updateQueue,D=pe.lastBaseUpdate,D!==j&&(D===null?pe.firstBaseUpdate=ae:D.next=ae,pe.lastBaseUpdate=K))}if(x!==null){var me=v.baseState;j=0,pe=ae=K=null,D=x;do{var he=D.lane,be=D.eventTime;if((f&he)===he){pe!==null&&(pe=pe.next={eventTime:be,lane:0,tag:D.tag,payload:D.payload,callback:D.callback,next:null});e:{var Ee=t,je=D;switch(he=s,be=a,je.tag){case 1:if(Ee=je.payload,typeof Ee=="function"){me=Ee.call(be,me,he);break e}me=Ee;break e;case 3:Ee.flags=Ee.flags&-65537|128;case 0:if(Ee=je.payload,he=typeof Ee=="function"?Ee.call(be,me,he):Ee,he==null)break e;me=X({},me,he);break e;case 2:us=!0}}D.callback!==null&&D.lane!==0&&(t.flags|=64,he=v.effects,he===null?v.effects=[D]:he.push(D))}else be={eventTime:be,lane:he,tag:D.tag,payload:D.payload,callback:D.callback,next:null},pe===null?(ae=pe=be,K=me):pe=pe.next=be,j|=he;if(D=D.next,D===null){if(D=v.shared.pending,D===null)break;he=D,D=he.next,he.next=null,v.lastBaseUpdate=he,v.shared.pending=null}}while(!0);if(pe===null&&(K=me),v.baseState=K,v.firstBaseUpdate=ae,v.lastBaseUpdate=pe,s=v.shared.interleaved,s!==null){v=s;do j|=v.lane,v=v.next;while(v!==s)}else x===null&&(v.shared.lanes=0);Ks|=j,t.lanes=j,t.memoizedState=me}}function i0(t,s,a){if(t=s.effects,s.effects=null,t!==null)for(s=0;s<t.length;s++){var f=t[s],v=f.callback;if(v!==null){if(f.callback=null,f=a,typeof v!="function")throw Error(r(191,v));v.call(f)}}}var Ko={},fr=os(Ko),Xo=os(Ko),Qo=os(Ko);function Gs(t){if(t===Ko)throw Error(r(174));return t}function Nc(t,s){switch(et(Qo,s),et(Xo,t),et(fr,Ko),t=s.nodeType,t){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:ot(null,"");break;default:t=t===8?s.parentNode:s,s=t.namespaceURI||null,t=t.tagName,s=ot(s,t)}nt(fr),et(fr,s)}function Wi(){nt(fr),nt(Xo),nt(Qo)}function o0(t){Gs(Qo.current);var s=Gs(fr.current),a=ot(s,t.type);s!==a&&(et(Xo,t),et(fr,a))}function Cc(t){Xo.current===t&&(nt(fr),nt(Xo))}var at=os(0);function dl(t){for(var s=t;s!==null;){if(s.tag===13){var a=s.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||a.data==="$?"||a.data==="$!"))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var jc=[];function Rc(){for(var t=0;t<jc.length;t++)jc[t]._workInProgressVersionPrimary=null;jc.length=0}var fl=C.ReactCurrentDispatcher,Tc=C.ReactCurrentBatchConfig,Ys=0,lt=null,kt=null,Tt=null,hl=!1,Zo=!1,Jo=0,eR=0;function Vt(){throw Error(r(321))}function Ac(t,s){if(s===null)return!1;for(var a=0;a<s.length&&a<t.length;a++)if(!Un(t[a],s[a]))return!1;return!0}function Ic(t,s,a,f,v,x){if(Ys=x,lt=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,fl.current=t===null||t.memoizedState===null?sR:iR,t=a(f,v),Zo){x=0;do{if(Zo=!1,Jo=0,25<=x)throw Error(r(301));x+=1,Tt=kt=null,s.updateQueue=null,fl.current=oR,t=a(f,v)}while(Zo)}if(fl.current=gl,s=kt!==null&&kt.next!==null,Ys=0,Tt=kt=lt=null,hl=!1,s)throw Error(r(300));return t}function Mc(){var t=Jo!==0;return Jo=0,t}function hr(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Tt===null?lt.memoizedState=Tt=t:Tt=Tt.next=t,Tt}function Tn(){if(kt===null){var t=lt.alternate;t=t!==null?t.memoizedState:null}else t=kt.next;var s=Tt===null?lt.memoizedState:Tt.next;if(s!==null)Tt=s,kt=t;else{if(t===null)throw Error(r(310));kt=t,t={memoizedState:kt.memoizedState,baseState:kt.baseState,baseQueue:kt.baseQueue,queue:kt.queue,next:null},Tt===null?lt.memoizedState=Tt=t:Tt=Tt.next=t}return Tt}function ea(t,s){return typeof s=="function"?s(t):s}function Pc(t){var s=Tn(),a=s.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=t;var f=kt,v=f.baseQueue,x=a.pending;if(x!==null){if(v!==null){var j=v.next;v.next=x.next,x.next=j}f.baseQueue=v=x,a.pending=null}if(v!==null){x=v.next,f=f.baseState;var D=j=null,K=null,ae=x;do{var pe=ae.lane;if((Ys&pe)===pe)K!==null&&(K=K.next={lane:0,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),f=ae.hasEagerState?ae.eagerState:t(f,ae.action);else{var me={lane:pe,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null};K===null?(D=K=me,j=f):K=K.next=me,lt.lanes|=pe,Ks|=pe}ae=ae.next}while(ae!==null&&ae!==x);K===null?j=f:K.next=D,Un(f,s.memoizedState)||(an=!0),s.memoizedState=f,s.baseState=j,s.baseQueue=K,a.lastRenderedState=f}if(t=a.interleaved,t!==null){v=t;do x=v.lane,lt.lanes|=x,Ks|=x,v=v.next;while(v!==t)}else v===null&&(a.lanes=0);return[s.memoizedState,a.dispatch]}function Oc(t){var s=Tn(),a=s.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=t;var f=a.dispatch,v=a.pending,x=s.memoizedState;if(v!==null){a.pending=null;var j=v=v.next;do x=t(x,j.action),j=j.next;while(j!==v);Un(x,s.memoizedState)||(an=!0),s.memoizedState=x,s.baseQueue===null&&(s.baseState=x),a.lastRenderedState=x}return[x,f]}function a0(){}function l0(t,s){var a=lt,f=Tn(),v=s(),x=!Un(f.memoizedState,v);if(x&&(f.memoizedState=v,an=!0),f=f.queue,Lc(d0.bind(null,a,f,t),[t]),f.getSnapshot!==s||x||Tt!==null&&Tt.memoizedState.tag&1){if(a.flags|=2048,ta(9,c0.bind(null,a,f,v,s),void 0,null),At===null)throw Error(r(349));(Ys&30)!==0||u0(a,s,v)}return v}function u0(t,s,a){t.flags|=16384,t={getSnapshot:s,value:a},s=lt.updateQueue,s===null?(s={lastEffect:null,stores:null},lt.updateQueue=s,s.stores=[t]):(a=s.stores,a===null?s.stores=[t]:a.push(t))}function c0(t,s,a,f){s.value=a,s.getSnapshot=f,f0(s)&&h0(t)}function d0(t,s,a){return a(function(){f0(s)&&h0(t)})}function f0(t){var s=t.getSnapshot;t=t.value;try{var a=s();return!Un(t,a)}catch{return!0}}function h0(t){var s=Lr(t,1);s!==null&&Yn(s,t,1,-1)}function p0(t){var s=hr();return typeof t=="function"&&(t=t()),s.memoizedState=s.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ea,lastRenderedState:t},s.queue=t,t=t.dispatch=rR.bind(null,lt,t),[s.memoizedState,t]}function ta(t,s,a,f){return t={tag:t,create:s,destroy:a,deps:f,next:null},s=lt.updateQueue,s===null?(s={lastEffect:null,stores:null},lt.updateQueue=s,s.lastEffect=t.next=t):(a=s.lastEffect,a===null?s.lastEffect=t.next=t:(f=a.next,a.next=t,t.next=f,s.lastEffect=t)),t}function m0(){return Tn().memoizedState}function pl(t,s,a,f){var v=hr();lt.flags|=t,v.memoizedState=ta(1|s,a,void 0,f===void 0?null:f)}function ml(t,s,a,f){var v=Tn();f=f===void 0?null:f;var x=void 0;if(kt!==null){var j=kt.memoizedState;if(x=j.destroy,f!==null&&Ac(f,j.deps)){v.memoizedState=ta(s,a,x,f);return}}lt.flags|=t,v.memoizedState=ta(1|s,a,x,f)}function g0(t,s){return pl(8390656,8,t,s)}function Lc(t,s){return ml(2048,8,t,s)}function v0(t,s){return ml(4,2,t,s)}function y0(t,s){return ml(4,4,t,s)}function w0(t,s){if(typeof s=="function")return t=t(),s(t),function(){s(null)};if(s!=null)return t=t(),s.current=t,function(){s.current=null}}function x0(t,s,a){return a=a!=null?a.concat([t]):null,ml(4,4,w0.bind(null,s,t),a)}function qc(){}function _0(t,s){var a=Tn();s=s===void 0?null:s;var f=a.memoizedState;return f!==null&&s!==null&&Ac(s,f[1])?f[0]:(a.memoizedState=[t,s],t)}function b0(t,s){var a=Tn();s=s===void 0?null:s;var f=a.memoizedState;return f!==null&&s!==null&&Ac(s,f[1])?f[0]:(t=t(),a.memoizedState=[t,s],t)}function S0(t,s,a){return(Ys&21)===0?(t.baseState&&(t.baseState=!1,an=!0),t.memoizedState=a):(Un(a,s)||(a=Ba(),lt.lanes|=a,Ks|=a,t.baseState=!0),s)}function tR(t,s){var a=We;We=a!==0&&4>a?a:4,t(!0);var f=Tc.transition;Tc.transition={};try{t(!1),s()}finally{We=a,Tc.transition=f}}function k0(){return Tn().memoizedState}function nR(t,s,a){var f=ps(t);if(a={lane:f,action:a,hasEagerState:!1,eagerState:null,next:null},E0(t))N0(s,a);else if(a=n0(t,s,a,f),a!==null){var v=nn();Yn(a,t,f,v),C0(a,s,f)}}function rR(t,s,a){var f=ps(t),v={lane:f,action:a,hasEagerState:!1,eagerState:null,next:null};if(E0(t))N0(s,v);else{var x=t.alternate;if(t.lanes===0&&(x===null||x.lanes===0)&&(x=s.lastRenderedReducer,x!==null))try{var j=s.lastRenderedState,D=x(j,a);if(v.hasEagerState=!0,v.eagerState=D,Un(D,j)){var K=s.interleaved;K===null?(v.next=v,kc(s)):(v.next=K.next,K.next=v),s.interleaved=v;return}}catch{}finally{}a=n0(t,s,v,f),a!==null&&(v=nn(),Yn(a,t,f,v),C0(a,s,f))}}function E0(t){var s=t.alternate;return t===lt||s!==null&&s===lt}function N0(t,s){Zo=hl=!0;var a=t.pending;a===null?s.next=s:(s.next=a.next,a.next=s),t.pending=s}function C0(t,s,a){if((a&4194240)!==0){var f=s.lanes;f&=t.pendingLanes,a|=f,s.lanes=a,Ht(t,a)}}var gl={readContext:Rn,useCallback:Vt,useContext:Vt,useEffect:Vt,useImperativeHandle:Vt,useInsertionEffect:Vt,useLayoutEffect:Vt,useMemo:Vt,useReducer:Vt,useRef:Vt,useState:Vt,useDebugValue:Vt,useDeferredValue:Vt,useTransition:Vt,useMutableSource:Vt,useSyncExternalStore:Vt,useId:Vt,unstable_isNewReconciler:!1},sR={readContext:Rn,useCallback:function(t,s){return hr().memoizedState=[t,s===void 0?null:s],t},useContext:Rn,useEffect:g0,useImperativeHandle:function(t,s,a){return a=a!=null?a.concat([t]):null,pl(4194308,4,w0.bind(null,s,t),a)},useLayoutEffect:function(t,s){return pl(4194308,4,t,s)},useInsertionEffect:function(t,s){return pl(4,2,t,s)},useMemo:function(t,s){var a=hr();return s=s===void 0?null:s,t=t(),a.memoizedState=[t,s],t},useReducer:function(t,s,a){var f=hr();return s=a!==void 0?a(s):s,f.memoizedState=f.baseState=s,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:s},f.queue=t,t=t.dispatch=nR.bind(null,lt,t),[f.memoizedState,t]},useRef:function(t){var s=hr();return t={current:t},s.memoizedState=t},useState:p0,useDebugValue:qc,useDeferredValue:function(t){return hr().memoizedState=t},useTransition:function(){var t=p0(!1),s=t[0];return t=tR.bind(null,t[1]),hr().memoizedState=t,[s,t]},useMutableSource:function(){},useSyncExternalStore:function(t,s,a){var f=lt,v=hr();if(st){if(a===void 0)throw Error(r(407));a=a()}else{if(a=s(),At===null)throw Error(r(349));(Ys&30)!==0||u0(f,s,a)}v.memoizedState=a;var x={value:a,getSnapshot:s};return v.queue=x,g0(d0.bind(null,f,x,t),[t]),f.flags|=2048,ta(9,c0.bind(null,f,x,a,s),void 0,null),a},useId:function(){var t=hr(),s=At.identifierPrefix;if(st){var a=Or,f=Pr;a=(f&~(1<<32-rn(f)-1)).toString(32)+a,s=":"+s+"R"+a,a=Jo++,0<a&&(s+="H"+a.toString(32)),s+=":"}else a=eR++,s=":"+s+"r"+a.toString(32)+":";return t.memoizedState=s},unstable_isNewReconciler:!1},iR={readContext:Rn,useCallback:_0,useContext:Rn,useEffect:Lc,useImperativeHandle:x0,useInsertionEffect:v0,useLayoutEffect:y0,useMemo:b0,useReducer:Pc,useRef:m0,useState:function(){return Pc(ea)},useDebugValue:qc,useDeferredValue:function(t){var s=Tn();return S0(s,kt.memoizedState,t)},useTransition:function(){var t=Pc(ea)[0],s=Tn().memoizedState;return[t,s]},useMutableSource:a0,useSyncExternalStore:l0,useId:k0,unstable_isNewReconciler:!1},oR={readContext:Rn,useCallback:_0,useContext:Rn,useEffect:Lc,useImperativeHandle:x0,useInsertionEffect:v0,useLayoutEffect:y0,useMemo:b0,useReducer:Oc,useRef:m0,useState:function(){return Oc(ea)},useDebugValue:qc,useDeferredValue:function(t){var s=Tn();return kt===null?s.memoizedState=t:S0(s,kt.memoizedState,t)},useTransition:function(){var t=Oc(ea)[0],s=Tn().memoizedState;return[t,s]},useMutableSource:a0,useSyncExternalStore:l0,useId:k0,unstable_isNewReconciler:!1};function Wn(t,s){if(t&&t.defaultProps){s=X({},s),t=t.defaultProps;for(var a in t)s[a]===void 0&&(s[a]=t[a]);return s}return s}function $c(t,s,a,f){s=t.memoizedState,a=a(f,s),a=a==null?s:X({},s,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var vl={isMounted:function(t){return(t=t._reactInternals)?gn(t)===t:!1},enqueueSetState:function(t,s,a){t=t._reactInternals;var f=nn(),v=ps(t),x=qr(f,v);x.payload=s,a!=null&&(x.callback=a),s=cs(t,x,v),s!==null&&(Yn(s,t,v,f),ul(s,t,v))},enqueueReplaceState:function(t,s,a){t=t._reactInternals;var f=nn(),v=ps(t),x=qr(f,v);x.tag=1,x.payload=s,a!=null&&(x.callback=a),s=cs(t,x,v),s!==null&&(Yn(s,t,v,f),ul(s,t,v))},enqueueForceUpdate:function(t,s){t=t._reactInternals;var a=nn(),f=ps(t),v=qr(a,f);v.tag=2,s!=null&&(v.callback=s),s=cs(t,v,f),s!==null&&(Yn(s,t,f,a),ul(s,t,f))}};function j0(t,s,a,f,v,x,j){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(f,x,j):s.prototype&&s.prototype.isPureReactComponent?!zo(a,f)||!zo(v,x):!0}function R0(t,s,a){var f=!1,v=as,x=s.contextType;return typeof x=="object"&&x!==null?x=Rn(x):(v=on(s)?Us:Wt.current,f=s.contextTypes,x=(f=f!=null)?$i(t,v):as),s=new s(a,x),t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=vl,t.stateNode=s,s._reactInternals=t,f&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=v,t.__reactInternalMemoizedMaskedChildContext=x),s}function T0(t,s,a,f){t=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(a,f),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(a,f),s.state!==t&&vl.enqueueReplaceState(s,s.state,null)}function Dc(t,s,a,f){var v=t.stateNode;v.props=a,v.state=t.memoizedState,v.refs={},Ec(t);var x=s.contextType;typeof x=="object"&&x!==null?v.context=Rn(x):(x=on(s)?Us:Wt.current,v.context=$i(t,x)),v.state=t.memoizedState,x=s.getDerivedStateFromProps,typeof x=="function"&&($c(t,s,x,a),v.state=t.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(s=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),s!==v.state&&vl.enqueueReplaceState(v,v.state,null),cl(t,a,v,f),v.state=t.memoizedState),typeof v.componentDidMount=="function"&&(t.flags|=4194308)}function Vi(t,s){try{var a="",f=s;do a+=J(f),f=f.return;while(f);var v=a}catch(x){v=`
|
|
39
39
|
Error generating stack: `+x.message+`
|
|
40
|
-
`+x.stack}return{value:t,source:s,stack:v,digest:null}}function Fc(t,s,a){return{value:t,source:null,stack:a??null,digest:s??null}}function zc(t,s){try{console.error(s.value)}catch(a){setTimeout(function(){throw a})}}var aR=typeof WeakMap=="function"?WeakMap:Map;function A0(t,s,a){a=qr(-1,a),a.tag=3,a.payload={element:null};var f=s.value;return a.callback=function(){kl||(kl=!0,nd=f),zc(t,s)},a}function I0(t,s,a){a=qr(-1,a),a.tag=3;var f=t.type.getDerivedStateFromError;if(typeof f=="function"){var v=s.value;a.payload=function(){return f(v)},a.callback=function(){zc(t,s)}}var x=t.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(a.callback=function(){zc(t,s),typeof f!="function"&&(fs===null?fs=new Set([this]):fs.add(this));var j=s.stack;this.componentDidCatch(s.value,{componentStack:j!==null?j:""})}),a}function M0(t,s,a){var f=t.pingCache;if(f===null){f=t.pingCache=new aR;var v=new Set;f.set(s,v)}else v=f.get(s),v===void 0&&(v=new Set,f.set(s,v));v.has(a)||(v.add(a),t=_R.bind(null,t,s,a),s.then(t,t))}function P0(t){do{var s;if((s=t.tag===13)&&(s=t.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return t;t=t.return}while(t!==null);return null}function O0(t,s,a,f,v){return(t.mode&1)===0?(t===s?t.flags|=65536:(t.flags|=128,a.flags|=131072,a.flags&=-52805,a.tag===1&&(a.alternate===null?a.tag=17:(s=qr(-1,1),s.tag=2,cs(a,s,1))),a.lanes|=1),t):(t.flags|=65536,t.lanes=v,t)}var lR=C.ReactCurrentOwner,an=!1;function tn(t,s,a,f){s.child=t===null?t0(s,null,a,f):Bi(s,t.child,a,f)}function L0(t,s,a,f,v){a=a.render;var x=s.ref;return Hi(s,v),f=Ic(t,s,a,f,x,v),a=Mc(),t!==null&&!an?(s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~v,$r(t,s,v)):(st&&a&&mc(s),s.flags|=1,tn(t,s,f,v),s.child)}function q0(t,s,a,f,v){if(t===null){var x=a.type;return typeof x=="function"&&!ud(x)&&x.defaultProps===void 0&&a.compare===null&&a.defaultProps===void 0?(s.tag=15,s.type=x,$0(t,s,x,f,v)):(t=Tl(a.type,null,f,s,s.mode,v),t.ref=s.ref,t.return=s,s.child=t)}if(x=t.child,(t.lanes&v)===0){var j=x.memoizedProps;if(a=a.compare,a=a!==null?a:zo,a(j,f)&&t.ref===s.ref)return $r(t,s,v)}return s.flags|=1,t=gs(x,f),t.ref=s.ref,t.return=s,s.child=t}function $0(t,s,a,f,v){if(t!==null){var x=t.memoizedProps;if(zo(x,f)&&t.ref===s.ref)if(an=!1,s.pendingProps=f=x,(t.lanes&v)!==0)(t.flags&131072)!==0&&(an=!0);else return s.lanes=t.lanes,$r(t,s,v)}return Bc(t,s,a,f,v)}function D0(t,s,a){var f=s.pendingProps,v=f.children,x=t!==null?t.memoizedState:null;if(f.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},et(Yi,wn),wn|=a;else{if((a&1073741824)===0)return t=x!==null?x.baseLanes|a:a,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:t,cachePool:null,transitions:null},s.updateQueue=null,et(Yi,wn),wn|=t,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},f=x!==null?x.baseLanes:a,et(Yi,wn),wn|=f}else x!==null?(f=x.baseLanes|a,s.memoizedState=null):f=a,et(Yi,wn),wn|=f;return tn(t,s,v,a),s.child}function F0(t,s){var a=s.ref;(t===null&&a!==null||t!==null&&t.ref!==a)&&(s.flags|=512,s.flags|=2097152)}function Bc(t,s,a,f,v){var x=on(a)?Us:Wt.current;return x=$i(s,x),Hi(s,v),a=Ic(t,s,a,f,x,v),f=Mc(),t!==null&&!an?(s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~v,$r(t,s,v)):(st&&f&&mc(s),s.flags|=1,tn(t,s,a,v),s.child)}function z0(t,s,a,f,v){if(on(a)){var x=!0;tl(s)}else x=!1;if(Hi(s,v),s.stateNode===null)wl(t,s),R0(s,a,f),Dc(s,a,f,v),f=!0;else if(t===null){var j=s.stateNode,D=s.memoizedProps;j.props=D;var K=j.context,ae=a.contextType;typeof ae=="object"&&ae!==null?ae=Rn(ae):(ae=on(a)?Us:Wt.current,ae=$i(s,ae));var pe=a.getDerivedStateFromProps,me=typeof pe=="function"||typeof j.getSnapshotBeforeUpdate=="function";me||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(D!==f||K!==ae)&&T0(s,j,f,ae),us=!1;var he=s.memoizedState;j.state=he,cl(s,f,j,v),K=s.memoizedState,D!==f||he!==K||sn.current||us?(typeof pe=="function"&&($c(s,a,pe,f),K=s.memoizedState),(D=us||j0(s,a,D,f,he,K,ae))?(me||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount()),typeof j.componentDidMount=="function"&&(s.flags|=4194308)):(typeof j.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=f,s.memoizedState=K),j.props=f,j.state=K,j.context=ae,f=D):(typeof j.componentDidMount=="function"&&(s.flags|=4194308),f=!1)}else{j=s.stateNode,r0(t,s),D=s.memoizedProps,ae=s.type===s.elementType?D:Wn(s.type,D),j.props=ae,me=s.pendingProps,he=j.context,K=a.contextType,typeof K=="object"&&K!==null?K=Rn(K):(K=on(a)?Us:Wt.current,K=$i(s,K));var be=a.getDerivedStateFromProps;(pe=typeof be=="function"||typeof j.getSnapshotBeforeUpdate=="function")||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(D!==me||he!==K)&&T0(s,j,f,K),us=!1,he=s.memoizedState,j.state=he,cl(s,f,j,v);var Ee=s.memoizedState;D!==me||he!==Ee||sn.current||us?(typeof be=="function"&&($c(s,a,be,f),Ee=s.memoizedState),(ae=us||j0(s,a,ae,f,he,Ee,K)||!1)?(pe||typeof j.UNSAFE_componentWillUpdate!="function"&&typeof j.componentWillUpdate!="function"||(typeof j.componentWillUpdate=="function"&&j.componentWillUpdate(f,Ee,K),typeof j.UNSAFE_componentWillUpdate=="function"&&j.UNSAFE_componentWillUpdate(f,Ee,K)),typeof j.componentDidUpdate=="function"&&(s.flags|=4),typeof j.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof j.componentDidUpdate!="function"||D===t.memoizedProps&&he===t.memoizedState||(s.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||D===t.memoizedProps&&he===t.memoizedState||(s.flags|=1024),s.memoizedProps=f,s.memoizedState=Ee),j.props=f,j.state=Ee,j.context=K,f=ae):(typeof j.componentDidUpdate!="function"||D===t.memoizedProps&&he===t.memoizedState||(s.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||D===t.memoizedProps&&he===t.memoizedState||(s.flags|=1024),f=!1)}return Uc(t,s,a,f,x,v)}function Uc(t,s,a,f,v,x){F0(t,s);var j=(s.flags&128)!==0;if(!f&&!j)return v&&Vy(s,a,!1),$r(t,s,x);f=s.stateNode,lR.current=s;var D=j&&typeof a.getDerivedStateFromError!="function"?null:f.render();return s.flags|=1,t!==null&&j?(s.child=Bi(s,t.child,null,x),s.child=Bi(s,null,D,x)):tn(t,s,D,x),s.memoizedState=f.state,v&&Vy(s,a,!0),s.child}function B0(t){var s=t.stateNode;s.pendingContext?Hy(t,s.pendingContext,s.pendingContext!==s.context):s.context&&Hy(t,s.context,!1),Nc(t,s.containerInfo)}function U0(t,s,a,f,v){return zi(),wc(v),s.flags|=256,tn(t,s,a,f),s.child}var Hc={dehydrated:null,treeContext:null,retryLane:0};function Wc(t){return{baseLanes:t,cachePool:null,transitions:null}}function H0(t,s,a){var f=s.pendingProps,v=at.current,x=!1,j=(s.flags&128)!==0,D;if((D=j)||(D=t!==null&&t.memoizedState===null?!1:(v&2)!==0),D?(x=!0,s.flags&=-129):(t===null||t.memoizedState!==null)&&(v|=1),et(at,v&1),t===null)return yc(s),t=s.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?((s.mode&1)===0?s.lanes=1:t.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(j=f.children,t=f.fallback,x?(f=s.mode,x=s.child,j={mode:"hidden",children:j},(f&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=j):x=Al(j,f,0,null),t=Js(t,f,a,null),x.return=s,t.return=s,x.sibling=t,s.child=x,s.child.memoizedState=Wc(a),s.memoizedState=Hc,t):Vc(s,j));if(v=t.memoizedState,v!==null&&(D=v.dehydrated,D!==null))return uR(t,s,j,f,D,v,a);if(x){x=f.fallback,j=s.mode,v=t.child,D=v.sibling;var K={mode:"hidden",children:f.children};return(j&1)===0&&s.child!==v?(f=s.child,f.childLanes=0,f.pendingProps=K,s.deletions=null):(f=gs(v,K),f.subtreeFlags=v.subtreeFlags&14680064),D!==null?x=gs(D,x):(x=Js(x,j,a,null),x.flags|=2),x.return=s,f.return=s,f.sibling=x,s.child=f,f=x,x=s.child,j=t.child.memoizedState,j=j===null?Wc(a):{baseLanes:j.baseLanes|a,cachePool:null,transitions:j.transitions},x.memoizedState=j,x.childLanes=t.childLanes&~a,s.memoizedState=Hc,f}return x=t.child,t=x.sibling,f=gs(x,{mode:"visible",children:f.children}),(s.mode&1)===0&&(f.lanes=a),f.return=s,f.sibling=null,t!==null&&(a=s.deletions,a===null?(s.deletions=[t],s.flags|=16):a.push(t)),s.child=f,s.memoizedState=null,f}function Vc(t,s){return s=Al({mode:"visible",children:s},t.mode,0,null),s.return=t,t.child=s}function yl(t,s,a,f){return f!==null&&wc(f),Bi(s,t.child,null,a),t=Vc(s,s.pendingProps.children),t.flags|=2,s.memoizedState=null,t}function uR(t,s,a,f,v,x,j){if(a)return s.flags&256?(s.flags&=-257,f=Fc(Error(r(422))),yl(t,s,j,f)):s.memoizedState!==null?(s.child=t.child,s.flags|=128,null):(x=f.fallback,v=s.mode,f=Al({mode:"visible",children:f.children},v,0,null),x=Js(x,v,j,null),x.flags|=2,f.return=s,x.return=s,f.sibling=x,s.child=f,(s.mode&1)!==0&&Bi(s,t.child,null,j),s.child.memoizedState=Wc(j),s.memoizedState=Hc,x);if((s.mode&1)===0)return yl(t,s,j,null);if(v.data==="$!"){if(f=v.nextSibling&&v.nextSibling.dataset,f)var D=f.dgst;return f=D,x=Error(r(419)),f=Fc(x,f,void 0),yl(t,s,j,f)}if(D=(j&t.childLanes)!==0,an||D){if(f=At,f!==null){switch(j&-j){case 4:v=2;break;case 16:v=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:v=32;break;case 536870912:v=268435456;break;default:v=0}v=(v&(f.suspendedLanes|j))!==0?0:v,v!==0&&v!==x.retryLane&&(x.retryLane=v,Lr(t,v),Yn(f,t,v,-1))}return ld(),f=Fc(Error(r(421))),yl(t,s,j,f)}return v.data==="$?"?(s.flags|=128,s.child=t.child,s=bR.bind(null,t),v._reactRetry=s,null):(t=x.treeContext,yn=is(v.nextSibling),vn=s,st=!0,Hn=null,t!==null&&(Cn[jn++]=Pr,Cn[jn++]=Or,Cn[jn++]=Hs,Pr=t.id,Or=t.overflow,Hs=s),s=Vc(s,f.children),s.flags|=4096,s)}function W0(t,s,a){t.lanes|=s;var f=t.alternate;f!==null&&(f.lanes|=s),Sc(t.return,s,a)}function Gc(t,s,a,f,v){var x=t.memoizedState;x===null?t.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:f,tail:a,tailMode:v}:(x.isBackwards=s,x.rendering=null,x.renderingStartTime=0,x.last=f,x.tail=a,x.tailMode=v)}function V0(t,s,a){var f=s.pendingProps,v=f.revealOrder,x=f.tail;if(tn(t,s,f.children,a),f=at.current,(f&2)!==0)f=f&1|2,s.flags|=128;else{if(t!==null&&(t.flags&128)!==0)e:for(t=s.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&W0(t,a,s);else if(t.tag===19)W0(t,a,s);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===s)break e;for(;t.sibling===null;){if(t.return===null||t.return===s)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}f&=1}if(et(at,f),(s.mode&1)===0)s.memoizedState=null;else switch(v){case"forwards":for(a=s.child,v=null;a!==null;)t=a.alternate,t!==null&&dl(t)===null&&(v=a),a=a.sibling;a=v,a===null?(v=s.child,s.child=null):(v=a.sibling,a.sibling=null),Gc(s,!1,v,a,x);break;case"backwards":for(a=null,v=s.child,s.child=null;v!==null;){if(t=v.alternate,t!==null&&dl(t)===null){s.child=v;break}t=v.sibling,v.sibling=a,a=v,v=t}Gc(s,!0,a,null,x);break;case"together":Gc(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function wl(t,s){(s.mode&1)===0&&t!==null&&(t.alternate=null,s.alternate=null,s.flags|=2)}function $r(t,s,a){if(t!==null&&(s.dependencies=t.dependencies),Ks|=s.lanes,(a&s.childLanes)===0)return null;if(t!==null&&s.child!==t.child)throw Error(r(153));if(s.child!==null){for(t=s.child,a=gs(t,t.pendingProps),s.child=a,a.return=s;t.sibling!==null;)t=t.sibling,a=a.sibling=gs(t,t.pendingProps),a.return=s;a.sibling=null}return s.child}function cR(t,s,a){switch(s.tag){case 3:B0(s),zi();break;case 5:o0(s);break;case 1:on(s.type)&&tl(s);break;case 4:Nc(s,s.stateNode.containerInfo);break;case 10:var f=s.type._context,v=s.memoizedProps.value;et(al,f._currentValue),f._currentValue=v;break;case 13:if(f=s.memoizedState,f!==null)return f.dehydrated!==null?(et(at,at.current&1),s.flags|=128,null):(a&s.child.childLanes)!==0?H0(t,s,a):(et(at,at.current&1),t=$r(t,s,a),t!==null?t.sibling:null);et(at,at.current&1);break;case 19:if(f=(a&s.childLanes)!==0,(t.flags&128)!==0){if(f)return V0(t,s,a);s.flags|=128}if(v=s.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),et(at,at.current),f)break;return null;case 22:case 23:return s.lanes=0,D0(t,s,a)}return $r(t,s,a)}var G0,Yc,Y0,K0;G0=function(t,s){for(var a=s.child;a!==null;){if(a.tag===5||a.tag===6)t.appendChild(a.stateNode);else if(a.tag!==4&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return;a=a.return}a.sibling.return=a.return,a=a.sibling}},Yc=function(){},Y0=function(t,s,a,f){var v=t.memoizedProps;if(v!==f){t=s.stateNode,Gs(fr.current);var x=null;switch(a){case"input":v=ye(t,v),f=ye(t,f),x=[];break;case"select":v=X({},v,{value:void 0}),f=X({},f,{value:void 0}),x=[];break;case"textarea":v=Ue(t,v),f=Ue(t,f),x=[];break;default:typeof v.onClick!="function"&&typeof f.onClick=="function"&&(t.onclick=Za)}Xt(a,f);var j;a=null;for(ae in v)if(!f.hasOwnProperty(ae)&&v.hasOwnProperty(ae)&&v[ae]!=null)if(ae==="style"){var D=v[ae];for(j in D)D.hasOwnProperty(j)&&(a||(a={}),a[j]="")}else ae!=="dangerouslySetInnerHTML"&&ae!=="children"&&ae!=="suppressContentEditableWarning"&&ae!=="suppressHydrationWarning"&&ae!=="autoFocus"&&(o.hasOwnProperty(ae)?x||(x=[]):(x=x||[]).push(ae,null));for(ae in f){var K=f[ae];if(D=v!=null?v[ae]:void 0,f.hasOwnProperty(ae)&&K!==D&&(K!=null||D!=null))if(ae==="style")if(D){for(j in D)!D.hasOwnProperty(j)||K&&K.hasOwnProperty(j)||(a||(a={}),a[j]="");for(j in K)K.hasOwnProperty(j)&&D[j]!==K[j]&&(a||(a={}),a[j]=K[j])}else a||(x||(x=[]),x.push(ae,a)),a=K;else ae==="dangerouslySetInnerHTML"?(K=K?K.__html:void 0,D=D?D.__html:void 0,K!=null&&D!==K&&(x=x||[]).push(ae,K)):ae==="children"?typeof K!="string"&&typeof K!="number"||(x=x||[]).push(ae,""+K):ae!=="suppressContentEditableWarning"&&ae!=="suppressHydrationWarning"&&(o.hasOwnProperty(ae)?(K!=null&&ae==="onScroll"&&tt("scroll",t),x||D===K||(x=[])):(x=x||[]).push(ae,K))}a&&(x=x||[]).push("style",a);var ae=x;(s.updateQueue=ae)&&(s.flags|=4)}},K0=function(t,s,a,f){a!==f&&(s.flags|=4)};function na(t,s){if(!st)switch(t.tailMode){case"hidden":s=t.tail;for(var a=null;s!==null;)s.alternate!==null&&(a=s),s=s.sibling;a===null?t.tail=null:a.sibling=null;break;case"collapsed":a=t.tail;for(var f=null;a!==null;)a.alternate!==null&&(f=a),a=a.sibling;f===null?s||t.tail===null?t.tail=null:t.tail.sibling=null:f.sibling=null}}function Gt(t){var s=t.alternate!==null&&t.alternate.child===t.child,a=0,f=0;if(s)for(var v=t.child;v!==null;)a|=v.lanes|v.childLanes,f|=v.subtreeFlags&14680064,f|=v.flags&14680064,v.return=t,v=v.sibling;else for(v=t.child;v!==null;)a|=v.lanes|v.childLanes,f|=v.subtreeFlags,f|=v.flags,v.return=t,v=v.sibling;return t.subtreeFlags|=f,t.childLanes=a,s}function dR(t,s,a){var f=s.pendingProps;switch(gc(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Gt(s),null;case 1:return on(s.type)&&el(),Gt(s),null;case 3:return f=s.stateNode,Wi(),nt(sn),nt(Wt),Rc(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(t===null||t.child===null)&&(il(s)?s.flags|=4:t===null||t.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Hn!==null&&(id(Hn),Hn=null))),Yc(t,s),Gt(s),null;case 5:Cc(s);var v=Gs(Qo.current);if(a=s.type,t!==null&&s.stateNode!=null)Y0(t,s,a,f,v),t.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!f){if(s.stateNode===null)throw Error(r(166));return Gt(s),null}if(t=Gs(fr.current),il(s)){f=s.stateNode,a=s.type;var x=s.memoizedProps;switch(f[dr]=s,f[Vo]=x,t=(s.mode&1)!==0,a){case"dialog":tt("cancel",f),tt("close",f);break;case"iframe":case"object":case"embed":tt("load",f);break;case"video":case"audio":for(v=0;v<Uo.length;v++)tt(Uo[v],f);break;case"source":tt("error",f);break;case"img":case"image":case"link":tt("error",f),tt("load",f);break;case"details":tt("toggle",f);break;case"input":ke(f,x),tt("invalid",f);break;case"select":f._wrapperState={wasMultiple:!!x.multiple},tt("invalid",f);break;case"textarea":De(f,x),tt("invalid",f)}Xt(a,x),v=null;for(var j in x)if(x.hasOwnProperty(j)){var D=x[j];j==="children"?typeof D=="string"?f.textContent!==D&&(x.suppressHydrationWarning!==!0&&Qa(f.textContent,D,t),v=["children",D]):typeof D=="number"&&f.textContent!==""+D&&(x.suppressHydrationWarning!==!0&&Qa(f.textContent,D,t),v=["children",""+D]):o.hasOwnProperty(j)&&D!=null&&j==="onScroll"&&tt("scroll",f)}switch(a){case"input":Ce(f),_e(f,x,!0);break;case"textarea":Ce(f),Ye(f);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(f.onclick=Za)}f=v,s.updateQueue=f,f!==null&&(s.flags|=4)}else{j=v.nodeType===9?v:v.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=vt(a)),t==="http://www.w3.org/1999/xhtml"?a==="script"?(t=j.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof f.is=="string"?t=j.createElement(a,{is:f.is}):(t=j.createElement(a),a==="select"&&(j=t,f.multiple?j.multiple=!0:f.size&&(j.size=f.size))):t=j.createElementNS(t,a),t[dr]=s,t[Vo]=f,G0(t,s,!1,!1),s.stateNode=t;e:{switch(j=Pt(a,f),a){case"dialog":tt("cancel",t),tt("close",t),v=f;break;case"iframe":case"object":case"embed":tt("load",t),v=f;break;case"video":case"audio":for(v=0;v<Uo.length;v++)tt(Uo[v],t);v=f;break;case"source":tt("error",t),v=f;break;case"img":case"image":case"link":tt("error",t),tt("load",t),v=f;break;case"details":tt("toggle",t),v=f;break;case"input":ke(t,f),v=ye(t,f),tt("invalid",t);break;case"option":v=f;break;case"select":t._wrapperState={wasMultiple:!!f.multiple},v=X({},f,{value:void 0}),tt("invalid",t);break;case"textarea":De(t,f),v=Ue(t,f),tt("invalid",t);break;default:v=f}Xt(a,v),D=v;for(x in D)if(D.hasOwnProperty(x)){var K=D[x];x==="style"?mt(t,K):x==="dangerouslySetInnerHTML"?(K=K?K.__html:void 0,K!=null&&Kt(t,K)):x==="children"?typeof K=="string"?(a!=="textarea"||K!=="")&&Mt(t,K):typeof K=="number"&&Mt(t,""+K):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(o.hasOwnProperty(x)?K!=null&&x==="onScroll"&&tt("scroll",t):K!=null&&E(t,x,K,j))}switch(a){case"input":Ce(t),_e(t,f,!1);break;case"textarea":Ce(t),Ye(t);break;case"option":f.value!=null&&t.setAttribute("value",""+fe(f.value));break;case"select":t.multiple=!!f.multiple,x=f.value,x!=null?ht(t,!!f.multiple,x,!1):f.defaultValue!=null&&ht(t,!!f.multiple,f.defaultValue,!0);break;default:typeof v.onClick=="function"&&(t.onclick=Za)}switch(a){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}}f&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return Gt(s),null;case 6:if(t&&s.stateNode!=null)K0(t,s,t.memoizedProps,f);else{if(typeof f!="string"&&s.stateNode===null)throw Error(r(166));if(a=Gs(Qo.current),Gs(fr.current),il(s)){if(f=s.stateNode,a=s.memoizedProps,f[dr]=s,(x=f.nodeValue!==a)&&(t=vn,t!==null))switch(t.tag){case 3:Qa(f.nodeValue,a,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Qa(f.nodeValue,a,(t.mode&1)!==0)}x&&(s.flags|=4)}else f=(a.nodeType===9?a:a.ownerDocument).createTextNode(f),f[dr]=s,s.stateNode=f}return Gt(s),null;case 13:if(nt(at),f=s.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(st&&yn!==null&&(s.mode&1)!==0&&(s.flags&128)===0)Zy(),zi(),s.flags|=98560,x=!1;else if(x=il(s),f!==null&&f.dehydrated!==null){if(t===null){if(!x)throw Error(r(318));if(x=s.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(r(317));x[dr]=s}else zi(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Gt(s),x=!1}else Hn!==null&&(id(Hn),Hn=null),x=!0;if(!x)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=a,s):(f=f!==null,f!==(t!==null&&t.memoizedState!==null)&&f&&(s.child.flags|=8192,(s.mode&1)!==0&&(t===null||(at.current&1)!==0?Et===0&&(Et=3):ld())),s.updateQueue!==null&&(s.flags|=4),Gt(s),null);case 4:return Wi(),Yc(t,s),t===null&&Ho(s.stateNode.containerInfo),Gt(s),null;case 10:return bc(s.type._context),Gt(s),null;case 17:return on(s.type)&&el(),Gt(s),null;case 19:if(nt(at),x=s.memoizedState,x===null)return Gt(s),null;if(f=(s.flags&128)!==0,j=x.rendering,j===null)if(f)na(x,!1);else{if(Et!==0||t!==null&&(t.flags&128)!==0)for(t=s.child;t!==null;){if(j=dl(t),j!==null){for(s.flags|=128,na(x,!1),f=j.updateQueue,f!==null&&(s.updateQueue=f,s.flags|=4),s.subtreeFlags=0,f=a,a=s.child;a!==null;)x=a,t=f,x.flags&=14680066,j=x.alternate,j===null?(x.childLanes=0,x.lanes=t,x.child=null,x.subtreeFlags=0,x.memoizedProps=null,x.memoizedState=null,x.updateQueue=null,x.dependencies=null,x.stateNode=null):(x.childLanes=j.childLanes,x.lanes=j.lanes,x.child=j.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=j.memoizedProps,x.memoizedState=j.memoizedState,x.updateQueue=j.updateQueue,x.type=j.type,t=j.dependencies,x.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),a=a.sibling;return et(at,at.current&1|2),s.child}t=t.sibling}x.tail!==null&&Je()>Ki&&(s.flags|=128,f=!0,na(x,!1),s.lanes=4194304)}else{if(!f)if(t=dl(j),t!==null){if(s.flags|=128,f=!0,a=t.updateQueue,a!==null&&(s.updateQueue=a,s.flags|=4),na(x,!0),x.tail===null&&x.tailMode==="hidden"&&!j.alternate&&!st)return Gt(s),null}else 2*Je()-x.renderingStartTime>Ki&&a!==1073741824&&(s.flags|=128,f=!0,na(x,!1),s.lanes=4194304);x.isBackwards?(j.sibling=s.child,s.child=j):(a=x.last,a!==null?a.sibling=j:s.child=j,x.last=j)}return x.tail!==null?(s=x.tail,x.rendering=s,x.tail=s.sibling,x.renderingStartTime=Je(),s.sibling=null,a=at.current,et(at,f?a&1|2:a&1),s):(Gt(s),null);case 22:case 23:return ad(),f=s.memoizedState!==null,t!==null&&t.memoizedState!==null!==f&&(s.flags|=8192),f&&(s.mode&1)!==0?(wn&1073741824)!==0&&(Gt(s),s.subtreeFlags&6&&(s.flags|=8192)):Gt(s),null;case 24:return null;case 25:return null}throw Error(r(156,s.tag))}function fR(t,s){switch(gc(s),s.tag){case 1:return on(s.type)&&el(),t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 3:return Wi(),nt(sn),nt(Wt),Rc(),t=s.flags,(t&65536)!==0&&(t&128)===0?(s.flags=t&-65537|128,s):null;case 5:return Cc(s),null;case 13:if(nt(at),t=s.memoizedState,t!==null&&t.dehydrated!==null){if(s.alternate===null)throw Error(r(340));zi()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 19:return nt(at),null;case 4:return Wi(),null;case 10:return bc(s.type._context),null;case 22:case 23:return ad(),null;case 24:return null;default:return null}}var xl=!1,Yt=!1,hR=typeof WeakSet=="function"?WeakSet:Set,Se=null;function Gi(t,s){var a=t.ref;if(a!==null)if(typeof a=="function")try{a(null)}catch(f){ct(t,s,f)}else a.current=null}function Kc(t,s,a){try{a()}catch(f){ct(t,s,f)}}var X0=!1;function pR(t,s){if(ac=En,t=jy(),Ju(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var f=a.getSelection&&a.getSelection();if(f&&f.rangeCount!==0){a=f.anchorNode;var v=f.anchorOffset,x=f.focusNode;f=f.focusOffset;try{a.nodeType,x.nodeType}catch{a=null;break e}var j=0,D=-1,K=-1,ae=0,pe=0,me=t,he=null;t:for(;;){for(var be;me!==a||v!==0&&me.nodeType!==3||(D=j+v),me!==x||f!==0&&me.nodeType!==3||(K=j+f),me.nodeType===3&&(j+=me.nodeValue.length),(be=me.firstChild)!==null;)he=me,me=be;for(;;){if(me===t)break t;if(he===a&&++ae===v&&(D=j),he===x&&++pe===f&&(K=j),(be=me.nextSibling)!==null)break;me=he,he=me.parentNode}me=be}a=D===-1||K===-1?null:{start:D,end:K}}else a=null}a=a||{start:0,end:0}}else a=null;for(lc={focusedElem:t,selectionRange:a},En=!1,Se=s;Se!==null;)if(s=Se,t=s.child,(s.subtreeFlags&1028)!==0&&t!==null)t.return=s,Se=t;else for(;Se!==null;){s=Se;try{var Ee=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(Ee!==null){var je=Ee.memoizedProps,gt=Ee.memoizedState,se=s.stateNode,ee=se.getSnapshotBeforeUpdate(s.elementType===s.type?je:Wn(s.type,je),gt);se.__reactInternalSnapshotBeforeUpdate=ee}break;case 3:var ie=s.stateNode.containerInfo;ie.nodeType===1?ie.textContent="":ie.nodeType===9&&ie.documentElement&&ie.removeChild(ie.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(ge){ct(s,s.return,ge)}if(t=s.sibling,t!==null){t.return=s.return,Se=t;break}Se=s.return}return Ee=X0,X0=!1,Ee}function ra(t,s,a){var f=s.updateQueue;if(f=f!==null?f.lastEffect:null,f!==null){var v=f=f.next;do{if((v.tag&t)===t){var x=v.destroy;v.destroy=void 0,x!==void 0&&Kc(s,a,x)}v=v.next}while(v!==f)}}function _l(t,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var a=s=s.next;do{if((a.tag&t)===t){var f=a.create;a.destroy=f()}a=a.next}while(a!==s)}}function Xc(t){var s=t.ref;if(s!==null){var a=t.stateNode;switch(t.tag){case 5:t=a;break;default:t=a}typeof s=="function"?s(t):s.current=t}}function Q0(t){var s=t.alternate;s!==null&&(t.alternate=null,Q0(s)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(s=t.stateNode,s!==null&&(delete s[dr],delete s[Vo],delete s[fc],delete s[Xj],delete s[Qj])),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 Z0(t){return t.tag===5||t.tag===3||t.tag===4}function J0(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Z0(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 Qc(t,s,a){var f=t.tag;if(f===5||f===6)t=t.stateNode,s?a.nodeType===8?a.parentNode.insertBefore(t,s):a.insertBefore(t,s):(a.nodeType===8?(s=a.parentNode,s.insertBefore(t,a)):(s=a,s.appendChild(t)),a=a._reactRootContainer,a!=null||s.onclick!==null||(s.onclick=Za));else if(f!==4&&(t=t.child,t!==null))for(Qc(t,s,a),t=t.sibling;t!==null;)Qc(t,s,a),t=t.sibling}function Zc(t,s,a){var f=t.tag;if(f===5||f===6)t=t.stateNode,s?a.insertBefore(t,s):a.appendChild(t);else if(f!==4&&(t=t.child,t!==null))for(Zc(t,s,a),t=t.sibling;t!==null;)Zc(t,s,a),t=t.sibling}var $t=null,Vn=!1;function ds(t,s,a){for(a=a.child;a!==null;)ew(t,s,a),a=a.sibling}function ew(t,s,a){if(Ut&&typeof Ut.onCommitFiberUnmount=="function")try{Ut.onCommitFiberUnmount(Ot,a)}catch{}switch(a.tag){case 5:Yt||Gi(a,s);case 6:var f=$t,v=Vn;$t=null,ds(t,s,a),$t=f,Vn=v,$t!==null&&(Vn?(t=$t,a=a.stateNode,t.nodeType===8?t.parentNode.removeChild(a):t.removeChild(a)):$t.removeChild(a.stateNode));break;case 18:$t!==null&&(Vn?(t=$t,a=a.stateNode,t.nodeType===8?dc(t.parentNode,a):t.nodeType===1&&dc(t,a),Os(t)):dc($t,a.stateNode));break;case 4:f=$t,v=Vn,$t=a.stateNode.containerInfo,Vn=!0,ds(t,s,a),$t=f,Vn=v;break;case 0:case 11:case 14:case 15:if(!Yt&&(f=a.updateQueue,f!==null&&(f=f.lastEffect,f!==null))){v=f=f.next;do{var x=v,j=x.destroy;x=x.tag,j!==void 0&&((x&2)!==0||(x&4)!==0)&&Kc(a,s,j),v=v.next}while(v!==f)}ds(t,s,a);break;case 1:if(!Yt&&(Gi(a,s),f=a.stateNode,typeof f.componentWillUnmount=="function"))try{f.props=a.memoizedProps,f.state=a.memoizedState,f.componentWillUnmount()}catch(D){ct(a,s,D)}ds(t,s,a);break;case 21:ds(t,s,a);break;case 22:a.mode&1?(Yt=(f=Yt)||a.memoizedState!==null,ds(t,s,a),Yt=f):ds(t,s,a);break;default:ds(t,s,a)}}function tw(t){var s=t.updateQueue;if(s!==null){t.updateQueue=null;var a=t.stateNode;a===null&&(a=t.stateNode=new hR),s.forEach(function(f){var v=SR.bind(null,t,f);a.has(f)||(a.add(f),f.then(v,v))})}}function Gn(t,s){var a=s.deletions;if(a!==null)for(var f=0;f<a.length;f++){var v=a[f];try{var x=t,j=s,D=j;e:for(;D!==null;){switch(D.tag){case 5:$t=D.stateNode,Vn=!1;break e;case 3:$t=D.stateNode.containerInfo,Vn=!0;break e;case 4:$t=D.stateNode.containerInfo,Vn=!0;break e}D=D.return}if($t===null)throw Error(r(160));ew(x,j,v),$t=null,Vn=!1;var K=v.alternate;K!==null&&(K.return=null),v.return=null}catch(ae){ct(v,s,ae)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)nw(s,t),s=s.sibling}function nw(t,s){var a=t.alternate,f=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Gn(s,t),pr(t),f&4){try{ra(3,t,t.return),_l(3,t)}catch(je){ct(t,t.return,je)}try{ra(5,t,t.return)}catch(je){ct(t,t.return,je)}}break;case 1:Gn(s,t),pr(t),f&512&&a!==null&&Gi(a,a.return);break;case 5:if(Gn(s,t),pr(t),f&512&&a!==null&&Gi(a,a.return),t.flags&32){var v=t.stateNode;try{Mt(v,"")}catch(je){ct(t,t.return,je)}}if(f&4&&(v=t.stateNode,v!=null)){var x=t.memoizedProps,j=a!==null?a.memoizedProps:x,D=t.type,K=t.updateQueue;if(t.updateQueue=null,K!==null)try{D==="input"&&x.type==="radio"&&x.name!=null&&Ge(v,x),Pt(D,j);var ae=Pt(D,x);for(j=0;j<K.length;j+=2){var pe=K[j],me=K[j+1];pe==="style"?mt(v,me):pe==="dangerouslySetInnerHTML"?Kt(v,me):pe==="children"?Mt(v,me):E(v,pe,me,ae)}switch(D){case"input":we(v,x);break;case"textarea":Ze(v,x);break;case"select":var he=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!x.multiple;var be=x.value;be!=null?ht(v,!!x.multiple,be,!1):he!==!!x.multiple&&(x.defaultValue!=null?ht(v,!!x.multiple,x.defaultValue,!0):ht(v,!!x.multiple,x.multiple?[]:"",!1))}v[Vo]=x}catch(je){ct(t,t.return,je)}}break;case 6:if(Gn(s,t),pr(t),f&4){if(t.stateNode===null)throw Error(r(162));v=t.stateNode,x=t.memoizedProps;try{v.nodeValue=x}catch(je){ct(t,t.return,je)}}break;case 3:if(Gn(s,t),pr(t),f&4&&a!==null&&a.memoizedState.isDehydrated)try{Os(s.containerInfo)}catch(je){ct(t,t.return,je)}break;case 4:Gn(s,t),pr(t);break;case 13:Gn(s,t),pr(t),v=t.child,v.flags&8192&&(x=v.memoizedState!==null,v.stateNode.isHidden=x,!x||v.alternate!==null&&v.alternate.memoizedState!==null||(td=Je())),f&4&&tw(t);break;case 22:if(pe=a!==null&&a.memoizedState!==null,t.mode&1?(Yt=(ae=Yt)||pe,Gn(s,t),Yt=ae):Gn(s,t),pr(t),f&8192){if(ae=t.memoizedState!==null,(t.stateNode.isHidden=ae)&&!pe&&(t.mode&1)!==0)for(Se=t,pe=t.child;pe!==null;){for(me=Se=pe;Se!==null;){switch(he=Se,be=he.child,he.tag){case 0:case 11:case 14:case 15:ra(4,he,he.return);break;case 1:Gi(he,he.return);var Ee=he.stateNode;if(typeof Ee.componentWillUnmount=="function"){f=he,a=he.return;try{s=f,Ee.props=s.memoizedProps,Ee.state=s.memoizedState,Ee.componentWillUnmount()}catch(je){ct(f,a,je)}}break;case 5:Gi(he,he.return);break;case 22:if(he.memoizedState!==null){iw(me);continue}}be!==null?(be.return=he,Se=be):iw(me)}pe=pe.sibling}e:for(pe=null,me=t;;){if(me.tag===5){if(pe===null){pe=me;try{v=me.stateNode,ae?(x=v.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(D=me.stateNode,K=me.memoizedProps.style,j=K!=null&&K.hasOwnProperty("display")?K.display:null,D.style.display=pt("display",j))}catch(je){ct(t,t.return,je)}}}else if(me.tag===6){if(pe===null)try{me.stateNode.nodeValue=ae?"":me.memoizedProps}catch(je){ct(t,t.return,je)}}else if((me.tag!==22&&me.tag!==23||me.memoizedState===null||me===t)&&me.child!==null){me.child.return=me,me=me.child;continue}if(me===t)break e;for(;me.sibling===null;){if(me.return===null||me.return===t)break e;pe===me&&(pe=null),me=me.return}pe===me&&(pe=null),me.sibling.return=me.return,me=me.sibling}}break;case 19:Gn(s,t),pr(t),f&4&&tw(t);break;case 21:break;default:Gn(s,t),pr(t)}}function pr(t){var s=t.flags;if(s&2){try{e:{for(var a=t.return;a!==null;){if(Z0(a)){var f=a;break e}a=a.return}throw Error(r(160))}switch(f.tag){case 5:var v=f.stateNode;f.flags&32&&(Mt(v,""),f.flags&=-33);var x=J0(t);Zc(t,x,v);break;case 3:case 4:var j=f.stateNode.containerInfo,D=J0(t);Qc(t,D,j);break;default:throw Error(r(161))}}catch(K){ct(t,t.return,K)}t.flags&=-3}s&4096&&(t.flags&=-4097)}function mR(t,s,a){Se=t,rw(t)}function rw(t,s,a){for(var f=(t.mode&1)!==0;Se!==null;){var v=Se,x=v.child;if(v.tag===22&&f){var j=v.memoizedState!==null||xl;if(!j){var D=v.alternate,K=D!==null&&D.memoizedState!==null||Yt;D=xl;var ae=Yt;if(xl=j,(Yt=K)&&!ae)for(Se=v;Se!==null;)j=Se,K=j.child,j.tag===22&&j.memoizedState!==null?ow(v):K!==null?(K.return=j,Se=K):ow(v);for(;x!==null;)Se=x,rw(x),x=x.sibling;Se=v,xl=D,Yt=ae}sw(t)}else(v.subtreeFlags&8772)!==0&&x!==null?(x.return=v,Se=x):sw(t)}}function sw(t){for(;Se!==null;){var s=Se;if((s.flags&8772)!==0){var a=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:Yt||_l(5,s);break;case 1:var f=s.stateNode;if(s.flags&4&&!Yt)if(a===null)f.componentDidMount();else{var v=s.elementType===s.type?a.memoizedProps:Wn(s.type,a.memoizedProps);f.componentDidUpdate(v,a.memoizedState,f.__reactInternalSnapshotBeforeUpdate)}var x=s.updateQueue;x!==null&&i0(s,x,f);break;case 3:var j=s.updateQueue;if(j!==null){if(a=null,s.child!==null)switch(s.child.tag){case 5:a=s.child.stateNode;break;case 1:a=s.child.stateNode}i0(s,j,a)}break;case 5:var D=s.stateNode;if(a===null&&s.flags&4){a=D;var K=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":K.autoFocus&&a.focus();break;case"img":K.src&&(a.src=K.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var ae=s.alternate;if(ae!==null){var pe=ae.memoizedState;if(pe!==null){var me=pe.dehydrated;me!==null&&Os(me)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}Yt||s.flags&512&&Xc(s)}catch(he){ct(s,s.return,he)}}if(s===t){Se=null;break}if(a=s.sibling,a!==null){a.return=s.return,Se=a;break}Se=s.return}}function iw(t){for(;Se!==null;){var s=Se;if(s===t){Se=null;break}var a=s.sibling;if(a!==null){a.return=s.return,Se=a;break}Se=s.return}}function ow(t){for(;Se!==null;){var s=Se;try{switch(s.tag){case 0:case 11:case 15:var a=s.return;try{_l(4,s)}catch(K){ct(s,a,K)}break;case 1:var f=s.stateNode;if(typeof f.componentDidMount=="function"){var v=s.return;try{f.componentDidMount()}catch(K){ct(s,v,K)}}var x=s.return;try{Xc(s)}catch(K){ct(s,x,K)}break;case 5:var j=s.return;try{Xc(s)}catch(K){ct(s,j,K)}}}catch(K){ct(s,s.return,K)}if(s===t){Se=null;break}var D=s.sibling;if(D!==null){D.return=s.return,Se=D;break}Se=s.return}}var gR=Math.ceil,bl=C.ReactCurrentDispatcher,Jc=C.ReactCurrentOwner,An=C.ReactCurrentBatchConfig,Be=0,At=null,_t=null,Dt=0,wn=0,Yi=os(0),Et=0,sa=null,Ks=0,Sl=0,ed=0,ia=null,ln=null,td=0,Ki=1/0,Dr=null,kl=!1,nd=null,fs=null,El=!1,hs=null,Nl=0,oa=0,rd=null,Cl=-1,jl=0;function nn(){return(Be&6)!==0?Je():Cl!==-1?Cl:Cl=Je()}function ps(t){return(t.mode&1)===0?1:(Be&2)!==0&&Dt!==0?Dt&-Dt:Jj.transition!==null?(jl===0&&(jl=Ba()),jl):(t=We,t!==0||(t=window.event,t=t===void 0?16:Io(t.type)),t)}function Yn(t,s,a,f){if(50<oa)throw oa=0,rd=null,Error(r(185));es(t,a,f),((Be&2)===0||t!==At)&&(t===At&&((Be&2)===0&&(Sl|=a),Et===4&&ms(t,Dt)),un(t,f),a===1&&Be===0&&(s.mode&1)===0&&(Ki=Je()+500,nl&&ls()))}function un(t,s){var a=t.callbackNode;Jr(t,s);var f=xi(t,t===At?Dt:0);if(f===0)a!==null&&gi(a),t.callbackNode=null,t.callbackPriority=0;else if(s=f&-f,t.callbackPriority!==s){if(a!=null&&gi(a),s===1)t.tag===0?Zj(lw.bind(null,t)):Gy(lw.bind(null,t)),Yj(function(){(Be&6)===0&&ls()}),a=null;else{switch(Si(f)){case 1:a=br;break;case 4:a=js;break;case 16:a=or;break;case 536870912:a=yi;break;default:a=or}a=gw(a,aw.bind(null,t))}t.callbackPriority=s,t.callbackNode=a}}function aw(t,s){if(Cl=-1,jl=0,(Be&6)!==0)throw Error(r(327));var a=t.callbackNode;if(Xi()&&t.callbackNode!==a)return null;var f=xi(t,t===At?Dt:0);if(f===0)return null;if((f&30)!==0||(f&t.expiredLanes)!==0||s)s=Rl(t,f);else{s=f;var v=Be;Be|=2;var x=cw();(At!==t||Dt!==s)&&(Dr=null,Ki=Je()+500,Qs(t,s));do try{wR();break}catch(D){uw(t,D)}while(!0);_c(),bl.current=x,Be=v,_t!==null?s=0:(At=null,Dt=0,s=Et)}if(s!==0){if(s===2&&(v=_i(t),v!==0&&(f=v,s=sd(t,v))),s===1)throw a=sa,Qs(t,0),ms(t,f),un(t,Je()),a;if(s===6)ms(t,f);else{if(v=t.current.alternate,(f&30)===0&&!vR(v)&&(s=Rl(t,f),s===2&&(x=_i(t),x!==0&&(f=x,s=sd(t,x))),s===1))throw a=sa,Qs(t,0),ms(t,f),un(t,Je()),a;switch(t.finishedWork=v,t.finishedLanes=f,s){case 0:case 1:throw Error(r(345));case 2:Zs(t,ln,Dr);break;case 3:if(ms(t,f),(f&130023424)===f&&(s=td+500-Je(),10<s)){if(xi(t,0)!==0)break;if(v=t.suspendedLanes,(v&f)!==f){nn(),t.pingedLanes|=t.suspendedLanes&v;break}t.timeoutHandle=cc(Zs.bind(null,t,ln,Dr),s);break}Zs(t,ln,Dr);break;case 4:if(ms(t,f),(f&4194240)===f)break;for(s=t.eventTimes,v=-1;0<f;){var j=31-rn(f);x=1<<j,j=s[j],j>v&&(v=j),f&=~x}if(f=v,f=Je()-f,f=(120>f?120:480>f?480:1080>f?1080:1920>f?1920:3e3>f?3e3:4320>f?4320:1960*gR(f/1960))-f,10<f){t.timeoutHandle=cc(Zs.bind(null,t,ln,Dr),f);break}Zs(t,ln,Dr);break;case 5:Zs(t,ln,Dr);break;default:throw Error(r(329))}}}return un(t,Je()),t.callbackNode===a?aw.bind(null,t):null}function sd(t,s){var a=ia;return t.current.memoizedState.isDehydrated&&(Qs(t,s).flags|=256),t=Rl(t,s),t!==2&&(s=ln,ln=a,s!==null&&id(s)),t}function id(t){ln===null?ln=t:ln.push.apply(ln,t)}function vR(t){for(var s=t;;){if(s.flags&16384){var a=s.updateQueue;if(a!==null&&(a=a.stores,a!==null))for(var f=0;f<a.length;f++){var v=a[f],x=v.getSnapshot;v=v.value;try{if(!Un(x(),v))return!1}catch{return!1}}}if(a=s.child,s.subtreeFlags&16384&&a!==null)a.return=s,s=a;else{if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function ms(t,s){for(s&=~ed,s&=~Sl,t.suspendedLanes|=s,t.pingedLanes&=~s,t=t.expirationTimes;0<s;){var a=31-rn(s),f=1<<a;t[a]=-1,s&=~f}}function lw(t){if((Be&6)!==0)throw Error(r(327));Xi();var s=xi(t,0);if((s&1)===0)return un(t,Je()),null;var a=Rl(t,s);if(t.tag!==0&&a===2){var f=_i(t);f!==0&&(s=f,a=sd(t,f))}if(a===1)throw a=sa,Qs(t,0),ms(t,s),un(t,Je()),a;if(a===6)throw Error(r(345));return t.finishedWork=t.current.alternate,t.finishedLanes=s,Zs(t,ln,Dr),un(t,Je()),null}function od(t,s){var a=Be;Be|=1;try{return t(s)}finally{Be=a,Be===0&&(Ki=Je()+500,nl&&ls())}}function Xs(t){hs!==null&&hs.tag===0&&(Be&6)===0&&Xi();var s=Be;Be|=1;var a=An.transition,f=We;try{if(An.transition=null,We=1,t)return t()}finally{We=f,An.transition=a,Be=s,(Be&6)===0&&ls()}}function ad(){wn=Yi.current,nt(Yi)}function Qs(t,s){t.finishedWork=null,t.finishedLanes=0;var a=t.timeoutHandle;if(a!==-1&&(t.timeoutHandle=-1,Gj(a)),_t!==null)for(a=_t.return;a!==null;){var f=a;switch(gc(f),f.tag){case 1:f=f.type.childContextTypes,f!=null&&el();break;case 3:Wi(),nt(sn),nt(Wt),Rc();break;case 5:Cc(f);break;case 4:Wi();break;case 13:nt(at);break;case 19:nt(at);break;case 10:bc(f.type._context);break;case 22:case 23:ad()}a=a.return}if(At=t,_t=t=gs(t.current,null),Dt=wn=s,Et=0,sa=null,ed=Sl=Ks=0,ln=ia=null,Vs!==null){for(s=0;s<Vs.length;s++)if(a=Vs[s],f=a.interleaved,f!==null){a.interleaved=null;var v=f.next,x=a.pending;if(x!==null){var j=x.next;x.next=v,f.next=j}a.pending=f}Vs=null}return t}function uw(t,s){do{var a=_t;try{if(_c(),fl.current=gl,hl){for(var f=lt.memoizedState;f!==null;){var v=f.queue;v!==null&&(v.pending=null),f=f.next}hl=!1}if(Ys=0,Tt=kt=lt=null,Zo=!1,Jo=0,Jc.current=null,a===null||a.return===null){Et=1,sa=s,_t=null;break}e:{var x=t,j=a.return,D=a,K=s;if(s=Dt,D.flags|=32768,K!==null&&typeof K=="object"&&typeof K.then=="function"){var ae=K,pe=D,me=pe.tag;if((pe.mode&1)===0&&(me===0||me===11||me===15)){var he=pe.alternate;he?(pe.updateQueue=he.updateQueue,pe.memoizedState=he.memoizedState,pe.lanes=he.lanes):(pe.updateQueue=null,pe.memoizedState=null)}var be=P0(j);if(be!==null){be.flags&=-257,O0(be,j,D,x,s),be.mode&1&&M0(x,ae,s),s=be,K=ae;var Ee=s.updateQueue;if(Ee===null){var je=new Set;je.add(K),s.updateQueue=je}else Ee.add(K);break e}else{if((s&1)===0){M0(x,ae,s),ld();break e}K=Error(r(426))}}else if(st&&D.mode&1){var gt=P0(j);if(gt!==null){(gt.flags&65536)===0&&(gt.flags|=256),O0(gt,j,D,x,s),wc(Vi(K,D));break e}}x=K=Vi(K,D),Et!==4&&(Et=2),ia===null?ia=[x]:ia.push(x),x=j;do{switch(x.tag){case 3:x.flags|=65536,s&=-s,x.lanes|=s;var se=A0(x,K,s);s0(x,se);break e;case 1:D=K;var ee=x.type,ie=x.stateNode;if((x.flags&128)===0&&(typeof ee.getDerivedStateFromError=="function"||ie!==null&&typeof ie.componentDidCatch=="function"&&(fs===null||!fs.has(ie)))){x.flags|=65536,s&=-s,x.lanes|=s;var ge=I0(x,D,s);s0(x,ge);break e}}x=x.return}while(x!==null)}fw(a)}catch(Re){s=Re,_t===a&&a!==null&&(_t=a=a.return);continue}break}while(!0)}function cw(){var t=bl.current;return bl.current=gl,t===null?gl:t}function ld(){(Et===0||Et===3||Et===2)&&(Et=4),At===null||(Ks&268435455)===0&&(Sl&268435455)===0||ms(At,Dt)}function Rl(t,s){var a=Be;Be|=2;var f=cw();(At!==t||Dt!==s)&&(Dr=null,Qs(t,s));do try{yR();break}catch(v){uw(t,v)}while(!0);if(_c(),Be=a,bl.current=f,_t!==null)throw Error(r(261));return At=null,Dt=0,Et}function yR(){for(;_t!==null;)dw(_t)}function wR(){for(;_t!==null&&!ir();)dw(_t)}function dw(t){var s=mw(t.alternate,t,wn);t.memoizedProps=t.pendingProps,s===null?fw(t):_t=s,Jc.current=null}function fw(t){var s=t;do{var a=s.alternate;if(t=s.return,(s.flags&32768)===0){if(a=dR(a,s,wn),a!==null){_t=a;return}}else{if(a=fR(a,s),a!==null){a.flags&=32767,_t=a;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Et=6,_t=null;return}}if(s=s.sibling,s!==null){_t=s;return}_t=s=t}while(s!==null);Et===0&&(Et=5)}function Zs(t,s,a){var f=We,v=An.transition;try{An.transition=null,We=1,xR(t,s,a,f)}finally{An.transition=v,We=f}return null}function xR(t,s,a,f){do Xi();while(hs!==null);if((Be&6)!==0)throw Error(r(327));a=t.finishedWork;var v=t.finishedLanes;if(a===null)return null;if(t.finishedWork=null,t.finishedLanes=0,a===t.current)throw Error(r(177));t.callbackNode=null,t.callbackPriority=0;var x=a.lanes|a.childLanes;if(Gu(t,x),t===At&&(_t=At=null,Dt=0),(a.subtreeFlags&2064)===0&&(a.flags&2064)===0||El||(El=!0,gw(or,function(){return Xi(),null})),x=(a.flags&15990)!==0,(a.subtreeFlags&15990)!==0||x){x=An.transition,An.transition=null;var j=We;We=1;var D=Be;Be|=4,Jc.current=null,pR(t,a),nw(a,t),Fj(lc),En=!!ac,lc=ac=null,t.current=a,mR(a),vi(),Be=D,We=j,An.transition=x}else t.current=a;if(El&&(El=!1,hs=t,Nl=v),x=t.pendingLanes,x===0&&(fs=null),Sr(a.stateNode),un(t,Je()),s!==null)for(f=t.onRecoverableError,a=0;a<s.length;a++)v=s[a],f(v.value,{componentStack:v.stack,digest:v.digest});if(kl)throw kl=!1,t=nd,nd=null,t;return(Nl&1)!==0&&t.tag!==0&&Xi(),x=t.pendingLanes,(x&1)!==0?t===rd?oa++:(oa=0,rd=t):oa=0,ls(),null}function Xi(){if(hs!==null){var t=Si(Nl),s=An.transition,a=We;try{if(An.transition=null,We=16>t?16:t,hs===null)var f=!1;else{if(t=hs,hs=null,Nl=0,(Be&6)!==0)throw Error(r(331));var v=Be;for(Be|=4,Se=t.current;Se!==null;){var x=Se,j=x.child;if((Se.flags&16)!==0){var D=x.deletions;if(D!==null){for(var K=0;K<D.length;K++){var ae=D[K];for(Se=ae;Se!==null;){var pe=Se;switch(pe.tag){case 0:case 11:case 15:ra(8,pe,x)}var me=pe.child;if(me!==null)me.return=pe,Se=me;else for(;Se!==null;){pe=Se;var he=pe.sibling,be=pe.return;if(Q0(pe),pe===ae){Se=null;break}if(he!==null){he.return=be,Se=he;break}Se=be}}}var Ee=x.alternate;if(Ee!==null){var je=Ee.child;if(je!==null){Ee.child=null;do{var gt=je.sibling;je.sibling=null,je=gt}while(je!==null)}}Se=x}}if((x.subtreeFlags&2064)!==0&&j!==null)j.return=x,Se=j;else e:for(;Se!==null;){if(x=Se,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:ra(9,x,x.return)}var se=x.sibling;if(se!==null){se.return=x.return,Se=se;break e}Se=x.return}}var ee=t.current;for(Se=ee;Se!==null;){j=Se;var ie=j.child;if((j.subtreeFlags&2064)!==0&&ie!==null)ie.return=j,Se=ie;else e:for(j=ee;Se!==null;){if(D=Se,(D.flags&2048)!==0)try{switch(D.tag){case 0:case 11:case 15:_l(9,D)}}catch(Re){ct(D,D.return,Re)}if(D===j){Se=null;break e}var ge=D.sibling;if(ge!==null){ge.return=D.return,Se=ge;break e}Se=D.return}}if(Be=v,ls(),Ut&&typeof Ut.onPostCommitFiberRoot=="function")try{Ut.onPostCommitFiberRoot(Ot,t)}catch{}f=!0}return f}finally{We=a,An.transition=s}}return!1}function hw(t,s,a){s=Vi(a,s),s=A0(t,s,1),t=cs(t,s,1),s=nn(),t!==null&&(es(t,1,s),un(t,s))}function ct(t,s,a){if(t.tag===3)hw(t,t,a);else for(;s!==null;){if(s.tag===3){hw(s,t,a);break}else if(s.tag===1){var f=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(fs===null||!fs.has(f))){t=Vi(a,t),t=I0(s,t,1),s=cs(s,t,1),t=nn(),s!==null&&(es(s,1,t),un(s,t));break}}s=s.return}}function _R(t,s,a){var f=t.pingCache;f!==null&&f.delete(s),s=nn(),t.pingedLanes|=t.suspendedLanes&a,At===t&&(Dt&a)===a&&(Et===4||Et===3&&(Dt&130023424)===Dt&&500>Je()-td?Qs(t,0):ed|=a),un(t,s)}function pw(t,s){s===0&&((t.mode&1)===0?s=1:(s=Ts,Ts<<=1,(Ts&130023424)===0&&(Ts=4194304)));var a=nn();t=Lr(t,s),t!==null&&(es(t,s,a),un(t,a))}function bR(t){var s=t.memoizedState,a=0;s!==null&&(a=s.retryLane),pw(t,a)}function SR(t,s){var a=0;switch(t.tag){case 13:var f=t.stateNode,v=t.memoizedState;v!==null&&(a=v.retryLane);break;case 19:f=t.stateNode;break;default:throw Error(r(314))}f!==null&&f.delete(s),pw(t,a)}var mw;mw=function(t,s,a){if(t!==null)if(t.memoizedProps!==s.pendingProps||sn.current)an=!0;else{if((t.lanes&a)===0&&(s.flags&128)===0)return an=!1,cR(t,s,a);an=(t.flags&131072)!==0}else an=!1,st&&(s.flags&1048576)!==0&&Yy(s,sl,s.index);switch(s.lanes=0,s.tag){case 2:var f=s.type;wl(t,s),t=s.pendingProps;var v=$i(s,Wt.current);Hi(s,a),v=Ic(null,s,f,t,v,a);var x=Mc();return s.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,on(f)?(x=!0,tl(s)):x=!1,s.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,Ec(s),v.updater=vl,s.stateNode=v,v._reactInternals=s,Dc(s,f,t,a),s=Uc(null,s,f,!0,x,a)):(s.tag=0,st&&x&&mc(s),tn(null,s,v,a),s=s.child),s;case 16:f=s.elementType;e:{switch(wl(t,s),t=s.pendingProps,v=f._init,f=v(f._payload),s.type=f,v=s.tag=ER(f),t=Wn(f,t),v){case 0:s=Bc(null,s,f,t,a);break e;case 1:s=z0(null,s,f,t,a);break e;case 11:s=L0(null,s,f,t,a);break e;case 14:s=q0(null,s,f,Wn(f.type,t),a);break e}throw Error(r(306,f,""))}return s;case 0:return f=s.type,v=s.pendingProps,v=s.elementType===f?v:Wn(f,v),Bc(t,s,f,v,a);case 1:return f=s.type,v=s.pendingProps,v=s.elementType===f?v:Wn(f,v),z0(t,s,f,v,a);case 3:e:{if(B0(s),t===null)throw Error(r(387));f=s.pendingProps,x=s.memoizedState,v=x.element,r0(t,s),cl(s,f,null,a);var j=s.memoizedState;if(f=j.element,x.isDehydrated)if(x={element:f,isDehydrated:!1,cache:j.cache,pendingSuspenseBoundaries:j.pendingSuspenseBoundaries,transitions:j.transitions},s.updateQueue.baseState=x,s.memoizedState=x,s.flags&256){v=Vi(Error(r(423)),s),s=U0(t,s,f,a,v);break e}else if(f!==v){v=Vi(Error(r(424)),s),s=U0(t,s,f,a,v);break e}else for(yn=is(s.stateNode.containerInfo.firstChild),vn=s,st=!0,Hn=null,a=t0(s,null,f,a),s.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(zi(),f===v){s=$r(t,s,a);break e}tn(t,s,f,a)}s=s.child}return s;case 5:return o0(s),t===null&&yc(s),f=s.type,v=s.pendingProps,x=t!==null?t.memoizedProps:null,j=v.children,uc(f,v)?j=null:x!==null&&uc(f,x)&&(s.flags|=32),F0(t,s),tn(t,s,j,a),s.child;case 6:return t===null&&yc(s),null;case 13:return H0(t,s,a);case 4:return Nc(s,s.stateNode.containerInfo),f=s.pendingProps,t===null?s.child=Bi(s,null,f,a):tn(t,s,f,a),s.child;case 11:return f=s.type,v=s.pendingProps,v=s.elementType===f?v:Wn(f,v),L0(t,s,f,v,a);case 7:return tn(t,s,s.pendingProps,a),s.child;case 8:return tn(t,s,s.pendingProps.children,a),s.child;case 12:return tn(t,s,s.pendingProps.children,a),s.child;case 10:e:{if(f=s.type._context,v=s.pendingProps,x=s.memoizedProps,j=v.value,et(al,f._currentValue),f._currentValue=j,x!==null)if(Un(x.value,j)){if(x.children===v.children&&!sn.current){s=$r(t,s,a);break e}}else for(x=s.child,x!==null&&(x.return=s);x!==null;){var D=x.dependencies;if(D!==null){j=x.child;for(var K=D.firstContext;K!==null;){if(K.context===f){if(x.tag===1){K=qr(-1,a&-a),K.tag=2;var ae=x.updateQueue;if(ae!==null){ae=ae.shared;var pe=ae.pending;pe===null?K.next=K:(K.next=pe.next,pe.next=K),ae.pending=K}}x.lanes|=a,K=x.alternate,K!==null&&(K.lanes|=a),Sc(x.return,a,s),D.lanes|=a;break}K=K.next}}else if(x.tag===10)j=x.type===s.type?null:x.child;else if(x.tag===18){if(j=x.return,j===null)throw Error(r(341));j.lanes|=a,D=j.alternate,D!==null&&(D.lanes|=a),Sc(j,a,s),j=x.sibling}else j=x.child;if(j!==null)j.return=x;else for(j=x;j!==null;){if(j===s){j=null;break}if(x=j.sibling,x!==null){x.return=j.return,j=x;break}j=j.return}x=j}tn(t,s,v.children,a),s=s.child}return s;case 9:return v=s.type,f=s.pendingProps.children,Hi(s,a),v=Rn(v),f=f(v),s.flags|=1,tn(t,s,f,a),s.child;case 14:return f=s.type,v=Wn(f,s.pendingProps),v=Wn(f.type,v),q0(t,s,f,v,a);case 15:return $0(t,s,s.type,s.pendingProps,a);case 17:return f=s.type,v=s.pendingProps,v=s.elementType===f?v:Wn(f,v),wl(t,s),s.tag=1,on(f)?(t=!0,tl(s)):t=!1,Hi(s,a),R0(s,f,v),Dc(s,f,v,a),Uc(null,s,f,!0,t,a);case 19:return V0(t,s,a);case 22:return D0(t,s,a)}throw Error(r(156,s.tag))};function gw(t,s){return Cs(t,s)}function kR(t,s,a,f){this.tag=t,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function In(t,s,a,f){return new kR(t,s,a,f)}function ud(t){return t=t.prototype,!(!t||!t.isReactComponent)}function ER(t){if(typeof t=="function")return ud(t)?1:0;if(t!=null){if(t=t.$$typeof,t===G)return 11;if(t===Q)return 14}return 2}function gs(t,s){var a=t.alternate;return a===null?(a=In(t.tag,s,t.key,t.mode),a.elementType=t.elementType,a.type=t.type,a.stateNode=t.stateNode,a.alternate=t,t.alternate=a):(a.pendingProps=s,a.type=t.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=t.flags&14680064,a.childLanes=t.childLanes,a.lanes=t.lanes,a.child=t.child,a.memoizedProps=t.memoizedProps,a.memoizedState=t.memoizedState,a.updateQueue=t.updateQueue,s=t.dependencies,a.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},a.sibling=t.sibling,a.index=t.index,a.ref=t.ref,a}function Tl(t,s,a,f,v,x){var j=2;if(f=t,typeof t=="function")ud(t)&&(j=1);else if(typeof t=="string")j=5;else e:switch(t){case L:return Js(a.children,v,x,s);case H:j=8,v|=8;break;case O:return t=In(12,a,s,v|2),t.elementType=O,t.lanes=x,t;case q:return t=In(13,a,s,v),t.elementType=q,t.lanes=x,t;case R:return t=In(19,a,s,v),t.elementType=R,t.lanes=x,t;case ne:return Al(a,v,x,s);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case P:j=10;break e;case F:j=9;break e;case G:j=11;break e;case Q:j=14;break e;case z:j=16,f=null;break e}throw Error(r(130,t==null?t:typeof t,""))}return s=In(j,a,s,v),s.elementType=t,s.type=f,s.lanes=x,s}function Js(t,s,a,f){return t=In(7,t,f,s),t.lanes=a,t}function Al(t,s,a,f){return t=In(22,t,f,s),t.elementType=ne,t.lanes=a,t.stateNode={isHidden:!1},t}function cd(t,s,a){return t=In(6,t,null,s),t.lanes=a,t}function dd(t,s,a){return s=In(4,t.children!==null?t.children:[],t.key,s),s.lanes=a,s.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},s}function NR(t,s,a,f,v){this.tag=s,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=bi(0),this.expirationTimes=bi(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=bi(0),this.identifierPrefix=f,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function fd(t,s,a,f,v,x,j,D,K){return t=new NR(t,s,a,D,K),s===1?(s=1,x===!0&&(s|=8)):s=0,x=In(3,null,null,s),t.current=x,x.stateNode=t,x.memoizedState={element:f,isDehydrated:a,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ec(x),t}function CR(t,s,a){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:M,key:f==null?null:""+f,children:t,containerInfo:s,implementation:a}}function vw(t){if(!t)return as;t=t._reactInternals;e:{if(gn(t)!==t||t.tag!==1)throw Error(r(170));var s=t;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(on(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(r(171))}if(t.tag===1){var a=t.type;if(on(a))return Wy(t,a,s)}return s}function yw(t,s,a,f,v,x,j,D,K){return t=fd(a,f,!0,t,v,x,j,D,K),t.context=vw(null),a=t.current,f=nn(),v=ps(a),x=qr(f,v),x.callback=s??null,cs(a,x,v),t.current.lanes=v,es(t,v,f),un(t,f),t}function Il(t,s,a,f){var v=s.current,x=nn(),j=ps(v);return a=vw(a),s.context===null?s.context=a:s.pendingContext=a,s=qr(x,j),s.payload={element:t},f=f===void 0?null:f,f!==null&&(s.callback=f),t=cs(v,s,j),t!==null&&(Yn(t,v,j,x),ul(t,v,j)),j}function Ml(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 ww(t,s){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<s?a:s}}function hd(t,s){ww(t,s),(t=t.alternate)&&ww(t,s)}function jR(){return null}var xw=typeof reportError=="function"?reportError:function(t){console.error(t)};function pd(t){this._internalRoot=t}Pl.prototype.render=pd.prototype.render=function(t){var s=this._internalRoot;if(s===null)throw Error(r(409));Il(t,s,null,null)},Pl.prototype.unmount=pd.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var s=t.containerInfo;Xs(function(){Il(null,t,null,null)}),s[Ir]=null}};function Pl(t){this._internalRoot=t}Pl.prototype.unstable_scheduleHydration=function(t){if(t){var s=ar();t={blockedOn:null,target:t,priority:s};for(var a=0;a<Lt.length&&s!==0&&s<Lt[a].priority;a++);Lt.splice(a,0,t),a===0&&To(t)}};function md(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Ol(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function _w(){}function RR(t,s,a,f,v){if(v){if(typeof f=="function"){var x=f;f=function(){var ae=Ml(j);x.call(ae)}}var j=yw(s,f,t,0,null,!1,!1,"",_w);return t._reactRootContainer=j,t[Ir]=j.current,Ho(t.nodeType===8?t.parentNode:t),Xs(),j}for(;v=t.lastChild;)t.removeChild(v);if(typeof f=="function"){var D=f;f=function(){var ae=Ml(K);D.call(ae)}}var K=fd(t,0,!1,null,null,!1,!1,"",_w);return t._reactRootContainer=K,t[Ir]=K.current,Ho(t.nodeType===8?t.parentNode:t),Xs(function(){Il(s,K,a,f)}),K}function Ll(t,s,a,f,v){var x=a._reactRootContainer;if(x){var j=x;if(typeof v=="function"){var D=v;v=function(){var K=Ml(j);D.call(K)}}Il(s,j,t,v)}else j=RR(a,s,t,v,f);return Ml(j)}Er=function(t){switch(t.tag){case 3:var s=t.stateNode;if(s.current.memoizedState.isDehydrated){var a=Zr(s.pendingLanes);a!==0&&(Ht(s,a|1),un(s,Je()),(Be&6)===0&&(Ki=Je()+500,ls()))}break;case 13:Xs(function(){var f=Lr(t,1);if(f!==null){var v=nn();Yn(f,t,1,v)}}),hd(t,1)}},Nr=function(t){if(t.tag===13){var s=Lr(t,134217728);if(s!==null){var a=nn();Yn(s,t,134217728,a)}hd(t,134217728)}},ki=function(t){if(t.tag===13){var s=ps(t),a=Lr(t,s);if(a!==null){var f=nn();Yn(a,t,s,f)}hd(t,s)}},ar=function(){return We},Co=function(t,s){var a=We;try{return We=t,s()}finally{We=a}},bn=function(t,s,a){switch(s){case"input":if(we(t,a),s=a.name,a.type==="radio"&&s!=null){for(a=t;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<a.length;s++){var f=a[s];if(f!==t&&f.form===t.form){var v=Ja(f);if(!v)throw Error(r(90));ve(f),we(f,v)}}}break;case"textarea":Ze(t,a);break;case"select":s=a.value,s!=null&&ht(t,!!a.multiple,s,!1)}},hi=od,nr=Xs;var TR={usingClientEntryPoint:!1,Events:[Go,Li,Ja,Gr,ut,od]},aa={findFiberByHostInstance:Bs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},AR={bundleType:aa.bundleType,version:aa.version,rendererPackageName:aa.rendererPackageName,rendererConfig:aa.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=en(t),t===null?null:t.stateNode},findFiberByHostInstance:aa.findFiberByHostInstance||jR,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 ql=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ql.isDisabled&&ql.supportsFiber)try{Ot=ql.inject(AR),Ut=ql}catch{}}return cn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=TR,cn.createPortal=function(t,s){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!md(s))throw Error(r(200));return CR(t,s,null,a)},cn.createRoot=function(t,s){if(!md(t))throw Error(r(299));var a=!1,f="",v=xw;return s!=null&&(s.unstable_strictMode===!0&&(a=!0),s.identifierPrefix!==void 0&&(f=s.identifierPrefix),s.onRecoverableError!==void 0&&(v=s.onRecoverableError)),s=fd(t,1,!1,null,null,a,!1,f,v),t[Ir]=s.current,Ho(t.nodeType===8?t.parentNode:t),new pd(s)},cn.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var s=t._reactInternals;if(s===void 0)throw typeof t.render=="function"?Error(r(188)):(t=Object.keys(t).join(","),Error(r(268,t)));return t=en(s),t=t===null?null:t.stateNode,t},cn.flushSync=function(t){return Xs(t)},cn.hydrate=function(t,s,a){if(!Ol(s))throw Error(r(200));return Ll(null,t,s,!0,a)},cn.hydrateRoot=function(t,s,a){if(!md(t))throw Error(r(405));var f=a!=null&&a.hydratedSources||null,v=!1,x="",j=xw;if(a!=null&&(a.unstable_strictMode===!0&&(v=!0),a.identifierPrefix!==void 0&&(x=a.identifierPrefix),a.onRecoverableError!==void 0&&(j=a.onRecoverableError)),s=yw(s,null,t,1,a??null,v,!1,x,j),t[Ir]=s.current,Ho(t),f)for(t=0;t<f.length;t++)a=f[t],v=a._getVersion,v=v(a._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[a,v]:s.mutableSourceEagerHydrationData.push(a,v);return new Pl(s)},cn.render=function(t,s,a){if(!Ol(s))throw Error(r(200));return Ll(null,t,s,!1,a)},cn.unmountComponentAtNode=function(t){if(!Ol(t))throw Error(r(40));return t._reactRootContainer?(Xs(function(){Ll(null,null,t,!1,function(){t._reactRootContainer=null,t[Ir]=null})}),!0):!1},cn.unstable_batchedUpdates=od,cn.unstable_renderSubtreeIntoContainer=function(t,s,a,f){if(!Ol(a))throw Error(r(200));if(t==null||t._reactInternals===void 0)throw Error(r(38));return Ll(t,s,a,!1,f)},cn.version="18.3.1-next-f1338f8080-20240426",cn}var Rw;function CE(){if(Rw)return yd.exports;Rw=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(n){console.error(n)}}return e(),yd.exports=$R(),yd.exports}var Tw;function DR(){if(Tw)return Dl;Tw=1;var e=CE();return Dl.createRoot=e.createRoot,Dl.hydrateRoot=e.hydrateRoot,Dl}var FR=DR(),T=Aa();const ue=jv(T);function Bt(e){if(typeof e=="string"||typeof e=="number")return""+e;let n="";if(Array.isArray(e))for(let r=0,i;r<e.length;r++)(i=Bt(e[r]))!==""&&(n+=(n&&" ")+i);else for(let r in e)e[r]&&(n+=(n&&" ")+r);return n}var _d={exports:{}},bd={},Sd={exports:{}},kd={};/**
|
|
40
|
+
`+x.stack}return{value:t,source:s,stack:v,digest:null}}function Fc(t,s,a){return{value:t,source:null,stack:a??null,digest:s??null}}function zc(t,s){try{console.error(s.value)}catch(a){setTimeout(function(){throw a})}}var aR=typeof WeakMap=="function"?WeakMap:Map;function A0(t,s,a){a=qr(-1,a),a.tag=3,a.payload={element:null};var f=s.value;return a.callback=function(){kl||(kl=!0,nd=f),zc(t,s)},a}function I0(t,s,a){a=qr(-1,a),a.tag=3;var f=t.type.getDerivedStateFromError;if(typeof f=="function"){var v=s.value;a.payload=function(){return f(v)},a.callback=function(){zc(t,s)}}var x=t.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(a.callback=function(){zc(t,s),typeof f!="function"&&(fs===null?fs=new Set([this]):fs.add(this));var j=s.stack;this.componentDidCatch(s.value,{componentStack:j!==null?j:""})}),a}function M0(t,s,a){var f=t.pingCache;if(f===null){f=t.pingCache=new aR;var v=new Set;f.set(s,v)}else v=f.get(s),v===void 0&&(v=new Set,f.set(s,v));v.has(a)||(v.add(a),t=_R.bind(null,t,s,a),s.then(t,t))}function P0(t){do{var s;if((s=t.tag===13)&&(s=t.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return t;t=t.return}while(t!==null);return null}function O0(t,s,a,f,v){return(t.mode&1)===0?(t===s?t.flags|=65536:(t.flags|=128,a.flags|=131072,a.flags&=-52805,a.tag===1&&(a.alternate===null?a.tag=17:(s=qr(-1,1),s.tag=2,cs(a,s,1))),a.lanes|=1),t):(t.flags|=65536,t.lanes=v,t)}var lR=C.ReactCurrentOwner,an=!1;function tn(t,s,a,f){s.child=t===null?t0(s,null,a,f):Bi(s,t.child,a,f)}function L0(t,s,a,f,v){a=a.render;var x=s.ref;return Hi(s,v),f=Ic(t,s,a,f,x,v),a=Mc(),t!==null&&!an?(s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~v,$r(t,s,v)):(st&&a&&mc(s),s.flags|=1,tn(t,s,f,v),s.child)}function q0(t,s,a,f,v){if(t===null){var x=a.type;return typeof x=="function"&&!ud(x)&&x.defaultProps===void 0&&a.compare===null&&a.defaultProps===void 0?(s.tag=15,s.type=x,$0(t,s,x,f,v)):(t=Tl(a.type,null,f,s,s.mode,v),t.ref=s.ref,t.return=s,s.child=t)}if(x=t.child,(t.lanes&v)===0){var j=x.memoizedProps;if(a=a.compare,a=a!==null?a:zo,a(j,f)&&t.ref===s.ref)return $r(t,s,v)}return s.flags|=1,t=gs(x,f),t.ref=s.ref,t.return=s,s.child=t}function $0(t,s,a,f,v){if(t!==null){var x=t.memoizedProps;if(zo(x,f)&&t.ref===s.ref)if(an=!1,s.pendingProps=f=x,(t.lanes&v)!==0)(t.flags&131072)!==0&&(an=!0);else return s.lanes=t.lanes,$r(t,s,v)}return Bc(t,s,a,f,v)}function D0(t,s,a){var f=s.pendingProps,v=f.children,x=t!==null?t.memoizedState:null;if(f.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},et(Yi,wn),wn|=a;else{if((a&1073741824)===0)return t=x!==null?x.baseLanes|a:a,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:t,cachePool:null,transitions:null},s.updateQueue=null,et(Yi,wn),wn|=t,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},f=x!==null?x.baseLanes:a,et(Yi,wn),wn|=f}else x!==null?(f=x.baseLanes|a,s.memoizedState=null):f=a,et(Yi,wn),wn|=f;return tn(t,s,v,a),s.child}function F0(t,s){var a=s.ref;(t===null&&a!==null||t!==null&&t.ref!==a)&&(s.flags|=512,s.flags|=2097152)}function Bc(t,s,a,f,v){var x=on(a)?Us:Wt.current;return x=$i(s,x),Hi(s,v),a=Ic(t,s,a,f,x,v),f=Mc(),t!==null&&!an?(s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~v,$r(t,s,v)):(st&&f&&mc(s),s.flags|=1,tn(t,s,a,v),s.child)}function z0(t,s,a,f,v){if(on(a)){var x=!0;tl(s)}else x=!1;if(Hi(s,v),s.stateNode===null)wl(t,s),R0(s,a,f),Dc(s,a,f,v),f=!0;else if(t===null){var j=s.stateNode,D=s.memoizedProps;j.props=D;var K=j.context,ae=a.contextType;typeof ae=="object"&&ae!==null?ae=Rn(ae):(ae=on(a)?Us:Wt.current,ae=$i(s,ae));var pe=a.getDerivedStateFromProps,me=typeof pe=="function"||typeof j.getSnapshotBeforeUpdate=="function";me||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(D!==f||K!==ae)&&T0(s,j,f,ae),us=!1;var he=s.memoizedState;j.state=he,cl(s,f,j,v),K=s.memoizedState,D!==f||he!==K||sn.current||us?(typeof pe=="function"&&($c(s,a,pe,f),K=s.memoizedState),(D=us||j0(s,a,D,f,he,K,ae))?(me||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount()),typeof j.componentDidMount=="function"&&(s.flags|=4194308)):(typeof j.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=f,s.memoizedState=K),j.props=f,j.state=K,j.context=ae,f=D):(typeof j.componentDidMount=="function"&&(s.flags|=4194308),f=!1)}else{j=s.stateNode,r0(t,s),D=s.memoizedProps,ae=s.type===s.elementType?D:Wn(s.type,D),j.props=ae,me=s.pendingProps,he=j.context,K=a.contextType,typeof K=="object"&&K!==null?K=Rn(K):(K=on(a)?Us:Wt.current,K=$i(s,K));var be=a.getDerivedStateFromProps;(pe=typeof be=="function"||typeof j.getSnapshotBeforeUpdate=="function")||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(D!==me||he!==K)&&T0(s,j,f,K),us=!1,he=s.memoizedState,j.state=he,cl(s,f,j,v);var Ee=s.memoizedState;D!==me||he!==Ee||sn.current||us?(typeof be=="function"&&($c(s,a,be,f),Ee=s.memoizedState),(ae=us||j0(s,a,ae,f,he,Ee,K)||!1)?(pe||typeof j.UNSAFE_componentWillUpdate!="function"&&typeof j.componentWillUpdate!="function"||(typeof j.componentWillUpdate=="function"&&j.componentWillUpdate(f,Ee,K),typeof j.UNSAFE_componentWillUpdate=="function"&&j.UNSAFE_componentWillUpdate(f,Ee,K)),typeof j.componentDidUpdate=="function"&&(s.flags|=4),typeof j.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof j.componentDidUpdate!="function"||D===t.memoizedProps&&he===t.memoizedState||(s.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||D===t.memoizedProps&&he===t.memoizedState||(s.flags|=1024),s.memoizedProps=f,s.memoizedState=Ee),j.props=f,j.state=Ee,j.context=K,f=ae):(typeof j.componentDidUpdate!="function"||D===t.memoizedProps&&he===t.memoizedState||(s.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||D===t.memoizedProps&&he===t.memoizedState||(s.flags|=1024),f=!1)}return Uc(t,s,a,f,x,v)}function Uc(t,s,a,f,v,x){F0(t,s);var j=(s.flags&128)!==0;if(!f&&!j)return v&&Vy(s,a,!1),$r(t,s,x);f=s.stateNode,lR.current=s;var D=j&&typeof a.getDerivedStateFromError!="function"?null:f.render();return s.flags|=1,t!==null&&j?(s.child=Bi(s,t.child,null,x),s.child=Bi(s,null,D,x)):tn(t,s,D,x),s.memoizedState=f.state,v&&Vy(s,a,!0),s.child}function B0(t){var s=t.stateNode;s.pendingContext?Hy(t,s.pendingContext,s.pendingContext!==s.context):s.context&&Hy(t,s.context,!1),Nc(t,s.containerInfo)}function U0(t,s,a,f,v){return zi(),wc(v),s.flags|=256,tn(t,s,a,f),s.child}var Hc={dehydrated:null,treeContext:null,retryLane:0};function Wc(t){return{baseLanes:t,cachePool:null,transitions:null}}function H0(t,s,a){var f=s.pendingProps,v=at.current,x=!1,j=(s.flags&128)!==0,D;if((D=j)||(D=t!==null&&t.memoizedState===null?!1:(v&2)!==0),D?(x=!0,s.flags&=-129):(t===null||t.memoizedState!==null)&&(v|=1),et(at,v&1),t===null)return yc(s),t=s.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?((s.mode&1)===0?s.lanes=1:t.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(j=f.children,t=f.fallback,x?(f=s.mode,x=s.child,j={mode:"hidden",children:j},(f&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=j):x=Al(j,f,0,null),t=Js(t,f,a,null),x.return=s,t.return=s,x.sibling=t,s.child=x,s.child.memoizedState=Wc(a),s.memoizedState=Hc,t):Vc(s,j));if(v=t.memoizedState,v!==null&&(D=v.dehydrated,D!==null))return uR(t,s,j,f,D,v,a);if(x){x=f.fallback,j=s.mode,v=t.child,D=v.sibling;var K={mode:"hidden",children:f.children};return(j&1)===0&&s.child!==v?(f=s.child,f.childLanes=0,f.pendingProps=K,s.deletions=null):(f=gs(v,K),f.subtreeFlags=v.subtreeFlags&14680064),D!==null?x=gs(D,x):(x=Js(x,j,a,null),x.flags|=2),x.return=s,f.return=s,f.sibling=x,s.child=f,f=x,x=s.child,j=t.child.memoizedState,j=j===null?Wc(a):{baseLanes:j.baseLanes|a,cachePool:null,transitions:j.transitions},x.memoizedState=j,x.childLanes=t.childLanes&~a,s.memoizedState=Hc,f}return x=t.child,t=x.sibling,f=gs(x,{mode:"visible",children:f.children}),(s.mode&1)===0&&(f.lanes=a),f.return=s,f.sibling=null,t!==null&&(a=s.deletions,a===null?(s.deletions=[t],s.flags|=16):a.push(t)),s.child=f,s.memoizedState=null,f}function Vc(t,s){return s=Al({mode:"visible",children:s},t.mode,0,null),s.return=t,t.child=s}function yl(t,s,a,f){return f!==null&&wc(f),Bi(s,t.child,null,a),t=Vc(s,s.pendingProps.children),t.flags|=2,s.memoizedState=null,t}function uR(t,s,a,f,v,x,j){if(a)return s.flags&256?(s.flags&=-257,f=Fc(Error(r(422))),yl(t,s,j,f)):s.memoizedState!==null?(s.child=t.child,s.flags|=128,null):(x=f.fallback,v=s.mode,f=Al({mode:"visible",children:f.children},v,0,null),x=Js(x,v,j,null),x.flags|=2,f.return=s,x.return=s,f.sibling=x,s.child=f,(s.mode&1)!==0&&Bi(s,t.child,null,j),s.child.memoizedState=Wc(j),s.memoizedState=Hc,x);if((s.mode&1)===0)return yl(t,s,j,null);if(v.data==="$!"){if(f=v.nextSibling&&v.nextSibling.dataset,f)var D=f.dgst;return f=D,x=Error(r(419)),f=Fc(x,f,void 0),yl(t,s,j,f)}if(D=(j&t.childLanes)!==0,an||D){if(f=At,f!==null){switch(j&-j){case 4:v=2;break;case 16:v=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:v=32;break;case 536870912:v=268435456;break;default:v=0}v=(v&(f.suspendedLanes|j))!==0?0:v,v!==0&&v!==x.retryLane&&(x.retryLane=v,Lr(t,v),Yn(f,t,v,-1))}return ld(),f=Fc(Error(r(421))),yl(t,s,j,f)}return v.data==="$?"?(s.flags|=128,s.child=t.child,s=bR.bind(null,t),v._reactRetry=s,null):(t=x.treeContext,yn=is(v.nextSibling),vn=s,st=!0,Hn=null,t!==null&&(Cn[jn++]=Pr,Cn[jn++]=Or,Cn[jn++]=Hs,Pr=t.id,Or=t.overflow,Hs=s),s=Vc(s,f.children),s.flags|=4096,s)}function W0(t,s,a){t.lanes|=s;var f=t.alternate;f!==null&&(f.lanes|=s),Sc(t.return,s,a)}function Gc(t,s,a,f,v){var x=t.memoizedState;x===null?t.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:f,tail:a,tailMode:v}:(x.isBackwards=s,x.rendering=null,x.renderingStartTime=0,x.last=f,x.tail=a,x.tailMode=v)}function V0(t,s,a){var f=s.pendingProps,v=f.revealOrder,x=f.tail;if(tn(t,s,f.children,a),f=at.current,(f&2)!==0)f=f&1|2,s.flags|=128;else{if(t!==null&&(t.flags&128)!==0)e:for(t=s.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&W0(t,a,s);else if(t.tag===19)W0(t,a,s);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===s)break e;for(;t.sibling===null;){if(t.return===null||t.return===s)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}f&=1}if(et(at,f),(s.mode&1)===0)s.memoizedState=null;else switch(v){case"forwards":for(a=s.child,v=null;a!==null;)t=a.alternate,t!==null&&dl(t)===null&&(v=a),a=a.sibling;a=v,a===null?(v=s.child,s.child=null):(v=a.sibling,a.sibling=null),Gc(s,!1,v,a,x);break;case"backwards":for(a=null,v=s.child,s.child=null;v!==null;){if(t=v.alternate,t!==null&&dl(t)===null){s.child=v;break}t=v.sibling,v.sibling=a,a=v,v=t}Gc(s,!0,a,null,x);break;case"together":Gc(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function wl(t,s){(s.mode&1)===0&&t!==null&&(t.alternate=null,s.alternate=null,s.flags|=2)}function $r(t,s,a){if(t!==null&&(s.dependencies=t.dependencies),Ks|=s.lanes,(a&s.childLanes)===0)return null;if(t!==null&&s.child!==t.child)throw Error(r(153));if(s.child!==null){for(t=s.child,a=gs(t,t.pendingProps),s.child=a,a.return=s;t.sibling!==null;)t=t.sibling,a=a.sibling=gs(t,t.pendingProps),a.return=s;a.sibling=null}return s.child}function cR(t,s,a){switch(s.tag){case 3:B0(s),zi();break;case 5:o0(s);break;case 1:on(s.type)&&tl(s);break;case 4:Nc(s,s.stateNode.containerInfo);break;case 10:var f=s.type._context,v=s.memoizedProps.value;et(al,f._currentValue),f._currentValue=v;break;case 13:if(f=s.memoizedState,f!==null)return f.dehydrated!==null?(et(at,at.current&1),s.flags|=128,null):(a&s.child.childLanes)!==0?H0(t,s,a):(et(at,at.current&1),t=$r(t,s,a),t!==null?t.sibling:null);et(at,at.current&1);break;case 19:if(f=(a&s.childLanes)!==0,(t.flags&128)!==0){if(f)return V0(t,s,a);s.flags|=128}if(v=s.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),et(at,at.current),f)break;return null;case 22:case 23:return s.lanes=0,D0(t,s,a)}return $r(t,s,a)}var G0,Yc,Y0,K0;G0=function(t,s){for(var a=s.child;a!==null;){if(a.tag===5||a.tag===6)t.appendChild(a.stateNode);else if(a.tag!==4&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return;a=a.return}a.sibling.return=a.return,a=a.sibling}},Yc=function(){},Y0=function(t,s,a,f){var v=t.memoizedProps;if(v!==f){t=s.stateNode,Gs(fr.current);var x=null;switch(a){case"input":v=ye(t,v),f=ye(t,f),x=[];break;case"select":v=X({},v,{value:void 0}),f=X({},f,{value:void 0}),x=[];break;case"textarea":v=Ue(t,v),f=Ue(t,f),x=[];break;default:typeof v.onClick!="function"&&typeof f.onClick=="function"&&(t.onclick=Za)}Xt(a,f);var j;a=null;for(ae in v)if(!f.hasOwnProperty(ae)&&v.hasOwnProperty(ae)&&v[ae]!=null)if(ae==="style"){var D=v[ae];for(j in D)D.hasOwnProperty(j)&&(a||(a={}),a[j]="")}else ae!=="dangerouslySetInnerHTML"&&ae!=="children"&&ae!=="suppressContentEditableWarning"&&ae!=="suppressHydrationWarning"&&ae!=="autoFocus"&&(o.hasOwnProperty(ae)?x||(x=[]):(x=x||[]).push(ae,null));for(ae in f){var K=f[ae];if(D=v!=null?v[ae]:void 0,f.hasOwnProperty(ae)&&K!==D&&(K!=null||D!=null))if(ae==="style")if(D){for(j in D)!D.hasOwnProperty(j)||K&&K.hasOwnProperty(j)||(a||(a={}),a[j]="");for(j in K)K.hasOwnProperty(j)&&D[j]!==K[j]&&(a||(a={}),a[j]=K[j])}else a||(x||(x=[]),x.push(ae,a)),a=K;else ae==="dangerouslySetInnerHTML"?(K=K?K.__html:void 0,D=D?D.__html:void 0,K!=null&&D!==K&&(x=x||[]).push(ae,K)):ae==="children"?typeof K!="string"&&typeof K!="number"||(x=x||[]).push(ae,""+K):ae!=="suppressContentEditableWarning"&&ae!=="suppressHydrationWarning"&&(o.hasOwnProperty(ae)?(K!=null&&ae==="onScroll"&&tt("scroll",t),x||D===K||(x=[])):(x=x||[]).push(ae,K))}a&&(x=x||[]).push("style",a);var ae=x;(s.updateQueue=ae)&&(s.flags|=4)}},K0=function(t,s,a,f){a!==f&&(s.flags|=4)};function na(t,s){if(!st)switch(t.tailMode){case"hidden":s=t.tail;for(var a=null;s!==null;)s.alternate!==null&&(a=s),s=s.sibling;a===null?t.tail=null:a.sibling=null;break;case"collapsed":a=t.tail;for(var f=null;a!==null;)a.alternate!==null&&(f=a),a=a.sibling;f===null?s||t.tail===null?t.tail=null:t.tail.sibling=null:f.sibling=null}}function Gt(t){var s=t.alternate!==null&&t.alternate.child===t.child,a=0,f=0;if(s)for(var v=t.child;v!==null;)a|=v.lanes|v.childLanes,f|=v.subtreeFlags&14680064,f|=v.flags&14680064,v.return=t,v=v.sibling;else for(v=t.child;v!==null;)a|=v.lanes|v.childLanes,f|=v.subtreeFlags,f|=v.flags,v.return=t,v=v.sibling;return t.subtreeFlags|=f,t.childLanes=a,s}function dR(t,s,a){var f=s.pendingProps;switch(gc(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Gt(s),null;case 1:return on(s.type)&&el(),Gt(s),null;case 3:return f=s.stateNode,Wi(),nt(sn),nt(Wt),Rc(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(t===null||t.child===null)&&(il(s)?s.flags|=4:t===null||t.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Hn!==null&&(id(Hn),Hn=null))),Yc(t,s),Gt(s),null;case 5:Cc(s);var v=Gs(Qo.current);if(a=s.type,t!==null&&s.stateNode!=null)Y0(t,s,a,f,v),t.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!f){if(s.stateNode===null)throw Error(r(166));return Gt(s),null}if(t=Gs(fr.current),il(s)){f=s.stateNode,a=s.type;var x=s.memoizedProps;switch(f[dr]=s,f[Vo]=x,t=(s.mode&1)!==0,a){case"dialog":tt("cancel",f),tt("close",f);break;case"iframe":case"object":case"embed":tt("load",f);break;case"video":case"audio":for(v=0;v<Uo.length;v++)tt(Uo[v],f);break;case"source":tt("error",f);break;case"img":case"image":case"link":tt("error",f),tt("load",f);break;case"details":tt("toggle",f);break;case"input":ke(f,x),tt("invalid",f);break;case"select":f._wrapperState={wasMultiple:!!x.multiple},tt("invalid",f);break;case"textarea":De(f,x),tt("invalid",f)}Xt(a,x),v=null;for(var j in x)if(x.hasOwnProperty(j)){var D=x[j];j==="children"?typeof D=="string"?f.textContent!==D&&(x.suppressHydrationWarning!==!0&&Qa(f.textContent,D,t),v=["children",D]):typeof D=="number"&&f.textContent!==""+D&&(x.suppressHydrationWarning!==!0&&Qa(f.textContent,D,t),v=["children",""+D]):o.hasOwnProperty(j)&&D!=null&&j==="onScroll"&&tt("scroll",f)}switch(a){case"input":Ce(f),_e(f,x,!0);break;case"textarea":Ce(f),Ye(f);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(f.onclick=Za)}f=v,s.updateQueue=f,f!==null&&(s.flags|=4)}else{j=v.nodeType===9?v:v.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=vt(a)),t==="http://www.w3.org/1999/xhtml"?a==="script"?(t=j.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof f.is=="string"?t=j.createElement(a,{is:f.is}):(t=j.createElement(a),a==="select"&&(j=t,f.multiple?j.multiple=!0:f.size&&(j.size=f.size))):t=j.createElementNS(t,a),t[dr]=s,t[Vo]=f,G0(t,s,!1,!1),s.stateNode=t;e:{switch(j=Pt(a,f),a){case"dialog":tt("cancel",t),tt("close",t),v=f;break;case"iframe":case"object":case"embed":tt("load",t),v=f;break;case"video":case"audio":for(v=0;v<Uo.length;v++)tt(Uo[v],t);v=f;break;case"source":tt("error",t),v=f;break;case"img":case"image":case"link":tt("error",t),tt("load",t),v=f;break;case"details":tt("toggle",t),v=f;break;case"input":ke(t,f),v=ye(t,f),tt("invalid",t);break;case"option":v=f;break;case"select":t._wrapperState={wasMultiple:!!f.multiple},v=X({},f,{value:void 0}),tt("invalid",t);break;case"textarea":De(t,f),v=Ue(t,f),tt("invalid",t);break;default:v=f}Xt(a,v),D=v;for(x in D)if(D.hasOwnProperty(x)){var K=D[x];x==="style"?mt(t,K):x==="dangerouslySetInnerHTML"?(K=K?K.__html:void 0,K!=null&&Kt(t,K)):x==="children"?typeof K=="string"?(a!=="textarea"||K!=="")&&Mt(t,K):typeof K=="number"&&Mt(t,""+K):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(o.hasOwnProperty(x)?K!=null&&x==="onScroll"&&tt("scroll",t):K!=null&&E(t,x,K,j))}switch(a){case"input":Ce(t),_e(t,f,!1);break;case"textarea":Ce(t),Ye(t);break;case"option":f.value!=null&&t.setAttribute("value",""+fe(f.value));break;case"select":t.multiple=!!f.multiple,x=f.value,x!=null?ht(t,!!f.multiple,x,!1):f.defaultValue!=null&&ht(t,!!f.multiple,f.defaultValue,!0);break;default:typeof v.onClick=="function"&&(t.onclick=Za)}switch(a){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}}f&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return Gt(s),null;case 6:if(t&&s.stateNode!=null)K0(t,s,t.memoizedProps,f);else{if(typeof f!="string"&&s.stateNode===null)throw Error(r(166));if(a=Gs(Qo.current),Gs(fr.current),il(s)){if(f=s.stateNode,a=s.memoizedProps,f[dr]=s,(x=f.nodeValue!==a)&&(t=vn,t!==null))switch(t.tag){case 3:Qa(f.nodeValue,a,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Qa(f.nodeValue,a,(t.mode&1)!==0)}x&&(s.flags|=4)}else f=(a.nodeType===9?a:a.ownerDocument).createTextNode(f),f[dr]=s,s.stateNode=f}return Gt(s),null;case 13:if(nt(at),f=s.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(st&&yn!==null&&(s.mode&1)!==0&&(s.flags&128)===0)Zy(),zi(),s.flags|=98560,x=!1;else if(x=il(s),f!==null&&f.dehydrated!==null){if(t===null){if(!x)throw Error(r(318));if(x=s.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(r(317));x[dr]=s}else zi(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Gt(s),x=!1}else Hn!==null&&(id(Hn),Hn=null),x=!0;if(!x)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=a,s):(f=f!==null,f!==(t!==null&&t.memoizedState!==null)&&f&&(s.child.flags|=8192,(s.mode&1)!==0&&(t===null||(at.current&1)!==0?Et===0&&(Et=3):ld())),s.updateQueue!==null&&(s.flags|=4),Gt(s),null);case 4:return Wi(),Yc(t,s),t===null&&Ho(s.stateNode.containerInfo),Gt(s),null;case 10:return bc(s.type._context),Gt(s),null;case 17:return on(s.type)&&el(),Gt(s),null;case 19:if(nt(at),x=s.memoizedState,x===null)return Gt(s),null;if(f=(s.flags&128)!==0,j=x.rendering,j===null)if(f)na(x,!1);else{if(Et!==0||t!==null&&(t.flags&128)!==0)for(t=s.child;t!==null;){if(j=dl(t),j!==null){for(s.flags|=128,na(x,!1),f=j.updateQueue,f!==null&&(s.updateQueue=f,s.flags|=4),s.subtreeFlags=0,f=a,a=s.child;a!==null;)x=a,t=f,x.flags&=14680066,j=x.alternate,j===null?(x.childLanes=0,x.lanes=t,x.child=null,x.subtreeFlags=0,x.memoizedProps=null,x.memoizedState=null,x.updateQueue=null,x.dependencies=null,x.stateNode=null):(x.childLanes=j.childLanes,x.lanes=j.lanes,x.child=j.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=j.memoizedProps,x.memoizedState=j.memoizedState,x.updateQueue=j.updateQueue,x.type=j.type,t=j.dependencies,x.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),a=a.sibling;return et(at,at.current&1|2),s.child}t=t.sibling}x.tail!==null&&Je()>Ki&&(s.flags|=128,f=!0,na(x,!1),s.lanes=4194304)}else{if(!f)if(t=dl(j),t!==null){if(s.flags|=128,f=!0,a=t.updateQueue,a!==null&&(s.updateQueue=a,s.flags|=4),na(x,!0),x.tail===null&&x.tailMode==="hidden"&&!j.alternate&&!st)return Gt(s),null}else 2*Je()-x.renderingStartTime>Ki&&a!==1073741824&&(s.flags|=128,f=!0,na(x,!1),s.lanes=4194304);x.isBackwards?(j.sibling=s.child,s.child=j):(a=x.last,a!==null?a.sibling=j:s.child=j,x.last=j)}return x.tail!==null?(s=x.tail,x.rendering=s,x.tail=s.sibling,x.renderingStartTime=Je(),s.sibling=null,a=at.current,et(at,f?a&1|2:a&1),s):(Gt(s),null);case 22:case 23:return ad(),f=s.memoizedState!==null,t!==null&&t.memoizedState!==null!==f&&(s.flags|=8192),f&&(s.mode&1)!==0?(wn&1073741824)!==0&&(Gt(s),s.subtreeFlags&6&&(s.flags|=8192)):Gt(s),null;case 24:return null;case 25:return null}throw Error(r(156,s.tag))}function fR(t,s){switch(gc(s),s.tag){case 1:return on(s.type)&&el(),t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 3:return Wi(),nt(sn),nt(Wt),Rc(),t=s.flags,(t&65536)!==0&&(t&128)===0?(s.flags=t&-65537|128,s):null;case 5:return Cc(s),null;case 13:if(nt(at),t=s.memoizedState,t!==null&&t.dehydrated!==null){if(s.alternate===null)throw Error(r(340));zi()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 19:return nt(at),null;case 4:return Wi(),null;case 10:return bc(s.type._context),null;case 22:case 23:return ad(),null;case 24:return null;default:return null}}var xl=!1,Yt=!1,hR=typeof WeakSet=="function"?WeakSet:Set,Se=null;function Gi(t,s){var a=t.ref;if(a!==null)if(typeof a=="function")try{a(null)}catch(f){ct(t,s,f)}else a.current=null}function Kc(t,s,a){try{a()}catch(f){ct(t,s,f)}}var X0=!1;function pR(t,s){if(ac=En,t=jy(),Ju(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var f=a.getSelection&&a.getSelection();if(f&&f.rangeCount!==0){a=f.anchorNode;var v=f.anchorOffset,x=f.focusNode;f=f.focusOffset;try{a.nodeType,x.nodeType}catch{a=null;break e}var j=0,D=-1,K=-1,ae=0,pe=0,me=t,he=null;t:for(;;){for(var be;me!==a||v!==0&&me.nodeType!==3||(D=j+v),me!==x||f!==0&&me.nodeType!==3||(K=j+f),me.nodeType===3&&(j+=me.nodeValue.length),(be=me.firstChild)!==null;)he=me,me=be;for(;;){if(me===t)break t;if(he===a&&++ae===v&&(D=j),he===x&&++pe===f&&(K=j),(be=me.nextSibling)!==null)break;me=he,he=me.parentNode}me=be}a=D===-1||K===-1?null:{start:D,end:K}}else a=null}a=a||{start:0,end:0}}else a=null;for(lc={focusedElem:t,selectionRange:a},En=!1,Se=s;Se!==null;)if(s=Se,t=s.child,(s.subtreeFlags&1028)!==0&&t!==null)t.return=s,Se=t;else for(;Se!==null;){s=Se;try{var Ee=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(Ee!==null){var je=Ee.memoizedProps,gt=Ee.memoizedState,se=s.stateNode,ee=se.getSnapshotBeforeUpdate(s.elementType===s.type?je:Wn(s.type,je),gt);se.__reactInternalSnapshotBeforeUpdate=ee}break;case 3:var ie=s.stateNode.containerInfo;ie.nodeType===1?ie.textContent="":ie.nodeType===9&&ie.documentElement&&ie.removeChild(ie.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(ge){ct(s,s.return,ge)}if(t=s.sibling,t!==null){t.return=s.return,Se=t;break}Se=s.return}return Ee=X0,X0=!1,Ee}function ra(t,s,a){var f=s.updateQueue;if(f=f!==null?f.lastEffect:null,f!==null){var v=f=f.next;do{if((v.tag&t)===t){var x=v.destroy;v.destroy=void 0,x!==void 0&&Kc(s,a,x)}v=v.next}while(v!==f)}}function _l(t,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var a=s=s.next;do{if((a.tag&t)===t){var f=a.create;a.destroy=f()}a=a.next}while(a!==s)}}function Xc(t){var s=t.ref;if(s!==null){var a=t.stateNode;switch(t.tag){case 5:t=a;break;default:t=a}typeof s=="function"?s(t):s.current=t}}function Q0(t){var s=t.alternate;s!==null&&(t.alternate=null,Q0(s)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(s=t.stateNode,s!==null&&(delete s[dr],delete s[Vo],delete s[fc],delete s[Xj],delete s[Qj])),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 Z0(t){return t.tag===5||t.tag===3||t.tag===4}function J0(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Z0(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 Qc(t,s,a){var f=t.tag;if(f===5||f===6)t=t.stateNode,s?a.nodeType===8?a.parentNode.insertBefore(t,s):a.insertBefore(t,s):(a.nodeType===8?(s=a.parentNode,s.insertBefore(t,a)):(s=a,s.appendChild(t)),a=a._reactRootContainer,a!=null||s.onclick!==null||(s.onclick=Za));else if(f!==4&&(t=t.child,t!==null))for(Qc(t,s,a),t=t.sibling;t!==null;)Qc(t,s,a),t=t.sibling}function Zc(t,s,a){var f=t.tag;if(f===5||f===6)t=t.stateNode,s?a.insertBefore(t,s):a.appendChild(t);else if(f!==4&&(t=t.child,t!==null))for(Zc(t,s,a),t=t.sibling;t!==null;)Zc(t,s,a),t=t.sibling}var $t=null,Vn=!1;function ds(t,s,a){for(a=a.child;a!==null;)ew(t,s,a),a=a.sibling}function ew(t,s,a){if(Ut&&typeof Ut.onCommitFiberUnmount=="function")try{Ut.onCommitFiberUnmount(Ot,a)}catch{}switch(a.tag){case 5:Yt||Gi(a,s);case 6:var f=$t,v=Vn;$t=null,ds(t,s,a),$t=f,Vn=v,$t!==null&&(Vn?(t=$t,a=a.stateNode,t.nodeType===8?t.parentNode.removeChild(a):t.removeChild(a)):$t.removeChild(a.stateNode));break;case 18:$t!==null&&(Vn?(t=$t,a=a.stateNode,t.nodeType===8?dc(t.parentNode,a):t.nodeType===1&&dc(t,a),Os(t)):dc($t,a.stateNode));break;case 4:f=$t,v=Vn,$t=a.stateNode.containerInfo,Vn=!0,ds(t,s,a),$t=f,Vn=v;break;case 0:case 11:case 14:case 15:if(!Yt&&(f=a.updateQueue,f!==null&&(f=f.lastEffect,f!==null))){v=f=f.next;do{var x=v,j=x.destroy;x=x.tag,j!==void 0&&((x&2)!==0||(x&4)!==0)&&Kc(a,s,j),v=v.next}while(v!==f)}ds(t,s,a);break;case 1:if(!Yt&&(Gi(a,s),f=a.stateNode,typeof f.componentWillUnmount=="function"))try{f.props=a.memoizedProps,f.state=a.memoizedState,f.componentWillUnmount()}catch(D){ct(a,s,D)}ds(t,s,a);break;case 21:ds(t,s,a);break;case 22:a.mode&1?(Yt=(f=Yt)||a.memoizedState!==null,ds(t,s,a),Yt=f):ds(t,s,a);break;default:ds(t,s,a)}}function tw(t){var s=t.updateQueue;if(s!==null){t.updateQueue=null;var a=t.stateNode;a===null&&(a=t.stateNode=new hR),s.forEach(function(f){var v=SR.bind(null,t,f);a.has(f)||(a.add(f),f.then(v,v))})}}function Gn(t,s){var a=s.deletions;if(a!==null)for(var f=0;f<a.length;f++){var v=a[f];try{var x=t,j=s,D=j;e:for(;D!==null;){switch(D.tag){case 5:$t=D.stateNode,Vn=!1;break e;case 3:$t=D.stateNode.containerInfo,Vn=!0;break e;case 4:$t=D.stateNode.containerInfo,Vn=!0;break e}D=D.return}if($t===null)throw Error(r(160));ew(x,j,v),$t=null,Vn=!1;var K=v.alternate;K!==null&&(K.return=null),v.return=null}catch(ae){ct(v,s,ae)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)nw(s,t),s=s.sibling}function nw(t,s){var a=t.alternate,f=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Gn(s,t),pr(t),f&4){try{ra(3,t,t.return),_l(3,t)}catch(je){ct(t,t.return,je)}try{ra(5,t,t.return)}catch(je){ct(t,t.return,je)}}break;case 1:Gn(s,t),pr(t),f&512&&a!==null&&Gi(a,a.return);break;case 5:if(Gn(s,t),pr(t),f&512&&a!==null&&Gi(a,a.return),t.flags&32){var v=t.stateNode;try{Mt(v,"")}catch(je){ct(t,t.return,je)}}if(f&4&&(v=t.stateNode,v!=null)){var x=t.memoizedProps,j=a!==null?a.memoizedProps:x,D=t.type,K=t.updateQueue;if(t.updateQueue=null,K!==null)try{D==="input"&&x.type==="radio"&&x.name!=null&&Ge(v,x),Pt(D,j);var ae=Pt(D,x);for(j=0;j<K.length;j+=2){var pe=K[j],me=K[j+1];pe==="style"?mt(v,me):pe==="dangerouslySetInnerHTML"?Kt(v,me):pe==="children"?Mt(v,me):E(v,pe,me,ae)}switch(D){case"input":we(v,x);break;case"textarea":Ze(v,x);break;case"select":var he=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!x.multiple;var be=x.value;be!=null?ht(v,!!x.multiple,be,!1):he!==!!x.multiple&&(x.defaultValue!=null?ht(v,!!x.multiple,x.defaultValue,!0):ht(v,!!x.multiple,x.multiple?[]:"",!1))}v[Vo]=x}catch(je){ct(t,t.return,je)}}break;case 6:if(Gn(s,t),pr(t),f&4){if(t.stateNode===null)throw Error(r(162));v=t.stateNode,x=t.memoizedProps;try{v.nodeValue=x}catch(je){ct(t,t.return,je)}}break;case 3:if(Gn(s,t),pr(t),f&4&&a!==null&&a.memoizedState.isDehydrated)try{Os(s.containerInfo)}catch(je){ct(t,t.return,je)}break;case 4:Gn(s,t),pr(t);break;case 13:Gn(s,t),pr(t),v=t.child,v.flags&8192&&(x=v.memoizedState!==null,v.stateNode.isHidden=x,!x||v.alternate!==null&&v.alternate.memoizedState!==null||(td=Je())),f&4&&tw(t);break;case 22:if(pe=a!==null&&a.memoizedState!==null,t.mode&1?(Yt=(ae=Yt)||pe,Gn(s,t),Yt=ae):Gn(s,t),pr(t),f&8192){if(ae=t.memoizedState!==null,(t.stateNode.isHidden=ae)&&!pe&&(t.mode&1)!==0)for(Se=t,pe=t.child;pe!==null;){for(me=Se=pe;Se!==null;){switch(he=Se,be=he.child,he.tag){case 0:case 11:case 14:case 15:ra(4,he,he.return);break;case 1:Gi(he,he.return);var Ee=he.stateNode;if(typeof Ee.componentWillUnmount=="function"){f=he,a=he.return;try{s=f,Ee.props=s.memoizedProps,Ee.state=s.memoizedState,Ee.componentWillUnmount()}catch(je){ct(f,a,je)}}break;case 5:Gi(he,he.return);break;case 22:if(he.memoizedState!==null){iw(me);continue}}be!==null?(be.return=he,Se=be):iw(me)}pe=pe.sibling}e:for(pe=null,me=t;;){if(me.tag===5){if(pe===null){pe=me;try{v=me.stateNode,ae?(x=v.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(D=me.stateNode,K=me.memoizedProps.style,j=K!=null&&K.hasOwnProperty("display")?K.display:null,D.style.display=pt("display",j))}catch(je){ct(t,t.return,je)}}}else if(me.tag===6){if(pe===null)try{me.stateNode.nodeValue=ae?"":me.memoizedProps}catch(je){ct(t,t.return,je)}}else if((me.tag!==22&&me.tag!==23||me.memoizedState===null||me===t)&&me.child!==null){me.child.return=me,me=me.child;continue}if(me===t)break e;for(;me.sibling===null;){if(me.return===null||me.return===t)break e;pe===me&&(pe=null),me=me.return}pe===me&&(pe=null),me.sibling.return=me.return,me=me.sibling}}break;case 19:Gn(s,t),pr(t),f&4&&tw(t);break;case 21:break;default:Gn(s,t),pr(t)}}function pr(t){var s=t.flags;if(s&2){try{e:{for(var a=t.return;a!==null;){if(Z0(a)){var f=a;break e}a=a.return}throw Error(r(160))}switch(f.tag){case 5:var v=f.stateNode;f.flags&32&&(Mt(v,""),f.flags&=-33);var x=J0(t);Zc(t,x,v);break;case 3:case 4:var j=f.stateNode.containerInfo,D=J0(t);Qc(t,D,j);break;default:throw Error(r(161))}}catch(K){ct(t,t.return,K)}t.flags&=-3}s&4096&&(t.flags&=-4097)}function mR(t,s,a){Se=t,rw(t)}function rw(t,s,a){for(var f=(t.mode&1)!==0;Se!==null;){var v=Se,x=v.child;if(v.tag===22&&f){var j=v.memoizedState!==null||xl;if(!j){var D=v.alternate,K=D!==null&&D.memoizedState!==null||Yt;D=xl;var ae=Yt;if(xl=j,(Yt=K)&&!ae)for(Se=v;Se!==null;)j=Se,K=j.child,j.tag===22&&j.memoizedState!==null?ow(v):K!==null?(K.return=j,Se=K):ow(v);for(;x!==null;)Se=x,rw(x),x=x.sibling;Se=v,xl=D,Yt=ae}sw(t)}else(v.subtreeFlags&8772)!==0&&x!==null?(x.return=v,Se=x):sw(t)}}function sw(t){for(;Se!==null;){var s=Se;if((s.flags&8772)!==0){var a=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:Yt||_l(5,s);break;case 1:var f=s.stateNode;if(s.flags&4&&!Yt)if(a===null)f.componentDidMount();else{var v=s.elementType===s.type?a.memoizedProps:Wn(s.type,a.memoizedProps);f.componentDidUpdate(v,a.memoizedState,f.__reactInternalSnapshotBeforeUpdate)}var x=s.updateQueue;x!==null&&i0(s,x,f);break;case 3:var j=s.updateQueue;if(j!==null){if(a=null,s.child!==null)switch(s.child.tag){case 5:a=s.child.stateNode;break;case 1:a=s.child.stateNode}i0(s,j,a)}break;case 5:var D=s.stateNode;if(a===null&&s.flags&4){a=D;var K=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":K.autoFocus&&a.focus();break;case"img":K.src&&(a.src=K.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var ae=s.alternate;if(ae!==null){var pe=ae.memoizedState;if(pe!==null){var me=pe.dehydrated;me!==null&&Os(me)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}Yt||s.flags&512&&Xc(s)}catch(he){ct(s,s.return,he)}}if(s===t){Se=null;break}if(a=s.sibling,a!==null){a.return=s.return,Se=a;break}Se=s.return}}function iw(t){for(;Se!==null;){var s=Se;if(s===t){Se=null;break}var a=s.sibling;if(a!==null){a.return=s.return,Se=a;break}Se=s.return}}function ow(t){for(;Se!==null;){var s=Se;try{switch(s.tag){case 0:case 11:case 15:var a=s.return;try{_l(4,s)}catch(K){ct(s,a,K)}break;case 1:var f=s.stateNode;if(typeof f.componentDidMount=="function"){var v=s.return;try{f.componentDidMount()}catch(K){ct(s,v,K)}}var x=s.return;try{Xc(s)}catch(K){ct(s,x,K)}break;case 5:var j=s.return;try{Xc(s)}catch(K){ct(s,j,K)}}}catch(K){ct(s,s.return,K)}if(s===t){Se=null;break}var D=s.sibling;if(D!==null){D.return=s.return,Se=D;break}Se=s.return}}var gR=Math.ceil,bl=C.ReactCurrentDispatcher,Jc=C.ReactCurrentOwner,An=C.ReactCurrentBatchConfig,Be=0,At=null,_t=null,Dt=0,wn=0,Yi=os(0),Et=0,sa=null,Ks=0,Sl=0,ed=0,ia=null,ln=null,td=0,Ki=1/0,Dr=null,kl=!1,nd=null,fs=null,El=!1,hs=null,Nl=0,oa=0,rd=null,Cl=-1,jl=0;function nn(){return(Be&6)!==0?Je():Cl!==-1?Cl:Cl=Je()}function ps(t){return(t.mode&1)===0?1:(Be&2)!==0&&Dt!==0?Dt&-Dt:Jj.transition!==null?(jl===0&&(jl=Ba()),jl):(t=We,t!==0||(t=window.event,t=t===void 0?16:Io(t.type)),t)}function Yn(t,s,a,f){if(50<oa)throw oa=0,rd=null,Error(r(185));es(t,a,f),((Be&2)===0||t!==At)&&(t===At&&((Be&2)===0&&(Sl|=a),Et===4&&ms(t,Dt)),un(t,f),a===1&&Be===0&&(s.mode&1)===0&&(Ki=Je()+500,nl&&ls()))}function un(t,s){var a=t.callbackNode;Jr(t,s);var f=xi(t,t===At?Dt:0);if(f===0)a!==null&&gi(a),t.callbackNode=null,t.callbackPriority=0;else if(s=f&-f,t.callbackPriority!==s){if(a!=null&&gi(a),s===1)t.tag===0?Zj(lw.bind(null,t)):Gy(lw.bind(null,t)),Yj(function(){(Be&6)===0&&ls()}),a=null;else{switch(Si(f)){case 1:a=br;break;case 4:a=js;break;case 16:a=or;break;case 536870912:a=yi;break;default:a=or}a=gw(a,aw.bind(null,t))}t.callbackPriority=s,t.callbackNode=a}}function aw(t,s){if(Cl=-1,jl=0,(Be&6)!==0)throw Error(r(327));var a=t.callbackNode;if(Xi()&&t.callbackNode!==a)return null;var f=xi(t,t===At?Dt:0);if(f===0)return null;if((f&30)!==0||(f&t.expiredLanes)!==0||s)s=Rl(t,f);else{s=f;var v=Be;Be|=2;var x=cw();(At!==t||Dt!==s)&&(Dr=null,Ki=Je()+500,Qs(t,s));do try{wR();break}catch(D){uw(t,D)}while(!0);_c(),bl.current=x,Be=v,_t!==null?s=0:(At=null,Dt=0,s=Et)}if(s!==0){if(s===2&&(v=_i(t),v!==0&&(f=v,s=sd(t,v))),s===1)throw a=sa,Qs(t,0),ms(t,f),un(t,Je()),a;if(s===6)ms(t,f);else{if(v=t.current.alternate,(f&30)===0&&!vR(v)&&(s=Rl(t,f),s===2&&(x=_i(t),x!==0&&(f=x,s=sd(t,x))),s===1))throw a=sa,Qs(t,0),ms(t,f),un(t,Je()),a;switch(t.finishedWork=v,t.finishedLanes=f,s){case 0:case 1:throw Error(r(345));case 2:Zs(t,ln,Dr);break;case 3:if(ms(t,f),(f&130023424)===f&&(s=td+500-Je(),10<s)){if(xi(t,0)!==0)break;if(v=t.suspendedLanes,(v&f)!==f){nn(),t.pingedLanes|=t.suspendedLanes&v;break}t.timeoutHandle=cc(Zs.bind(null,t,ln,Dr),s);break}Zs(t,ln,Dr);break;case 4:if(ms(t,f),(f&4194240)===f)break;for(s=t.eventTimes,v=-1;0<f;){var j=31-rn(f);x=1<<j,j=s[j],j>v&&(v=j),f&=~x}if(f=v,f=Je()-f,f=(120>f?120:480>f?480:1080>f?1080:1920>f?1920:3e3>f?3e3:4320>f?4320:1960*gR(f/1960))-f,10<f){t.timeoutHandle=cc(Zs.bind(null,t,ln,Dr),f);break}Zs(t,ln,Dr);break;case 5:Zs(t,ln,Dr);break;default:throw Error(r(329))}}}return un(t,Je()),t.callbackNode===a?aw.bind(null,t):null}function sd(t,s){var a=ia;return t.current.memoizedState.isDehydrated&&(Qs(t,s).flags|=256),t=Rl(t,s),t!==2&&(s=ln,ln=a,s!==null&&id(s)),t}function id(t){ln===null?ln=t:ln.push.apply(ln,t)}function vR(t){for(var s=t;;){if(s.flags&16384){var a=s.updateQueue;if(a!==null&&(a=a.stores,a!==null))for(var f=0;f<a.length;f++){var v=a[f],x=v.getSnapshot;v=v.value;try{if(!Un(x(),v))return!1}catch{return!1}}}if(a=s.child,s.subtreeFlags&16384&&a!==null)a.return=s,s=a;else{if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function ms(t,s){for(s&=~ed,s&=~Sl,t.suspendedLanes|=s,t.pingedLanes&=~s,t=t.expirationTimes;0<s;){var a=31-rn(s),f=1<<a;t[a]=-1,s&=~f}}function lw(t){if((Be&6)!==0)throw Error(r(327));Xi();var s=xi(t,0);if((s&1)===0)return un(t,Je()),null;var a=Rl(t,s);if(t.tag!==0&&a===2){var f=_i(t);f!==0&&(s=f,a=sd(t,f))}if(a===1)throw a=sa,Qs(t,0),ms(t,s),un(t,Je()),a;if(a===6)throw Error(r(345));return t.finishedWork=t.current.alternate,t.finishedLanes=s,Zs(t,ln,Dr),un(t,Je()),null}function od(t,s){var a=Be;Be|=1;try{return t(s)}finally{Be=a,Be===0&&(Ki=Je()+500,nl&&ls())}}function Xs(t){hs!==null&&hs.tag===0&&(Be&6)===0&&Xi();var s=Be;Be|=1;var a=An.transition,f=We;try{if(An.transition=null,We=1,t)return t()}finally{We=f,An.transition=a,Be=s,(Be&6)===0&&ls()}}function ad(){wn=Yi.current,nt(Yi)}function Qs(t,s){t.finishedWork=null,t.finishedLanes=0;var a=t.timeoutHandle;if(a!==-1&&(t.timeoutHandle=-1,Gj(a)),_t!==null)for(a=_t.return;a!==null;){var f=a;switch(gc(f),f.tag){case 1:f=f.type.childContextTypes,f!=null&&el();break;case 3:Wi(),nt(sn),nt(Wt),Rc();break;case 5:Cc(f);break;case 4:Wi();break;case 13:nt(at);break;case 19:nt(at);break;case 10:bc(f.type._context);break;case 22:case 23:ad()}a=a.return}if(At=t,_t=t=gs(t.current,null),Dt=wn=s,Et=0,sa=null,ed=Sl=Ks=0,ln=ia=null,Vs!==null){for(s=0;s<Vs.length;s++)if(a=Vs[s],f=a.interleaved,f!==null){a.interleaved=null;var v=f.next,x=a.pending;if(x!==null){var j=x.next;x.next=v,f.next=j}a.pending=f}Vs=null}return t}function uw(t,s){do{var a=_t;try{if(_c(),fl.current=gl,hl){for(var f=lt.memoizedState;f!==null;){var v=f.queue;v!==null&&(v.pending=null),f=f.next}hl=!1}if(Ys=0,Tt=kt=lt=null,Zo=!1,Jo=0,Jc.current=null,a===null||a.return===null){Et=1,sa=s,_t=null;break}e:{var x=t,j=a.return,D=a,K=s;if(s=Dt,D.flags|=32768,K!==null&&typeof K=="object"&&typeof K.then=="function"){var ae=K,pe=D,me=pe.tag;if((pe.mode&1)===0&&(me===0||me===11||me===15)){var he=pe.alternate;he?(pe.updateQueue=he.updateQueue,pe.memoizedState=he.memoizedState,pe.lanes=he.lanes):(pe.updateQueue=null,pe.memoizedState=null)}var be=P0(j);if(be!==null){be.flags&=-257,O0(be,j,D,x,s),be.mode&1&&M0(x,ae,s),s=be,K=ae;var Ee=s.updateQueue;if(Ee===null){var je=new Set;je.add(K),s.updateQueue=je}else Ee.add(K);break e}else{if((s&1)===0){M0(x,ae,s),ld();break e}K=Error(r(426))}}else if(st&&D.mode&1){var gt=P0(j);if(gt!==null){(gt.flags&65536)===0&&(gt.flags|=256),O0(gt,j,D,x,s),wc(Vi(K,D));break e}}x=K=Vi(K,D),Et!==4&&(Et=2),ia===null?ia=[x]:ia.push(x),x=j;do{switch(x.tag){case 3:x.flags|=65536,s&=-s,x.lanes|=s;var se=A0(x,K,s);s0(x,se);break e;case 1:D=K;var ee=x.type,ie=x.stateNode;if((x.flags&128)===0&&(typeof ee.getDerivedStateFromError=="function"||ie!==null&&typeof ie.componentDidCatch=="function"&&(fs===null||!fs.has(ie)))){x.flags|=65536,s&=-s,x.lanes|=s;var ge=I0(x,D,s);s0(x,ge);break e}}x=x.return}while(x!==null)}fw(a)}catch(Re){s=Re,_t===a&&a!==null&&(_t=a=a.return);continue}break}while(!0)}function cw(){var t=bl.current;return bl.current=gl,t===null?gl:t}function ld(){(Et===0||Et===3||Et===2)&&(Et=4),At===null||(Ks&268435455)===0&&(Sl&268435455)===0||ms(At,Dt)}function Rl(t,s){var a=Be;Be|=2;var f=cw();(At!==t||Dt!==s)&&(Dr=null,Qs(t,s));do try{yR();break}catch(v){uw(t,v)}while(!0);if(_c(),Be=a,bl.current=f,_t!==null)throw Error(r(261));return At=null,Dt=0,Et}function yR(){for(;_t!==null;)dw(_t)}function wR(){for(;_t!==null&&!ir();)dw(_t)}function dw(t){var s=mw(t.alternate,t,wn);t.memoizedProps=t.pendingProps,s===null?fw(t):_t=s,Jc.current=null}function fw(t){var s=t;do{var a=s.alternate;if(t=s.return,(s.flags&32768)===0){if(a=dR(a,s,wn),a!==null){_t=a;return}}else{if(a=fR(a,s),a!==null){a.flags&=32767,_t=a;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Et=6,_t=null;return}}if(s=s.sibling,s!==null){_t=s;return}_t=s=t}while(s!==null);Et===0&&(Et=5)}function Zs(t,s,a){var f=We,v=An.transition;try{An.transition=null,We=1,xR(t,s,a,f)}finally{An.transition=v,We=f}return null}function xR(t,s,a,f){do Xi();while(hs!==null);if((Be&6)!==0)throw Error(r(327));a=t.finishedWork;var v=t.finishedLanes;if(a===null)return null;if(t.finishedWork=null,t.finishedLanes=0,a===t.current)throw Error(r(177));t.callbackNode=null,t.callbackPriority=0;var x=a.lanes|a.childLanes;if(Gu(t,x),t===At&&(_t=At=null,Dt=0),(a.subtreeFlags&2064)===0&&(a.flags&2064)===0||El||(El=!0,gw(or,function(){return Xi(),null})),x=(a.flags&15990)!==0,(a.subtreeFlags&15990)!==0||x){x=An.transition,An.transition=null;var j=We;We=1;var D=Be;Be|=4,Jc.current=null,pR(t,a),nw(a,t),Fj(lc),En=!!ac,lc=ac=null,t.current=a,mR(a),vi(),Be=D,We=j,An.transition=x}else t.current=a;if(El&&(El=!1,hs=t,Nl=v),x=t.pendingLanes,x===0&&(fs=null),Sr(a.stateNode),un(t,Je()),s!==null)for(f=t.onRecoverableError,a=0;a<s.length;a++)v=s[a],f(v.value,{componentStack:v.stack,digest:v.digest});if(kl)throw kl=!1,t=nd,nd=null,t;return(Nl&1)!==0&&t.tag!==0&&Xi(),x=t.pendingLanes,(x&1)!==0?t===rd?oa++:(oa=0,rd=t):oa=0,ls(),null}function Xi(){if(hs!==null){var t=Si(Nl),s=An.transition,a=We;try{if(An.transition=null,We=16>t?16:t,hs===null)var f=!1;else{if(t=hs,hs=null,Nl=0,(Be&6)!==0)throw Error(r(331));var v=Be;for(Be|=4,Se=t.current;Se!==null;){var x=Se,j=x.child;if((Se.flags&16)!==0){var D=x.deletions;if(D!==null){for(var K=0;K<D.length;K++){var ae=D[K];for(Se=ae;Se!==null;){var pe=Se;switch(pe.tag){case 0:case 11:case 15:ra(8,pe,x)}var me=pe.child;if(me!==null)me.return=pe,Se=me;else for(;Se!==null;){pe=Se;var he=pe.sibling,be=pe.return;if(Q0(pe),pe===ae){Se=null;break}if(he!==null){he.return=be,Se=he;break}Se=be}}}var Ee=x.alternate;if(Ee!==null){var je=Ee.child;if(je!==null){Ee.child=null;do{var gt=je.sibling;je.sibling=null,je=gt}while(je!==null)}}Se=x}}if((x.subtreeFlags&2064)!==0&&j!==null)j.return=x,Se=j;else e:for(;Se!==null;){if(x=Se,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:ra(9,x,x.return)}var se=x.sibling;if(se!==null){se.return=x.return,Se=se;break e}Se=x.return}}var ee=t.current;for(Se=ee;Se!==null;){j=Se;var ie=j.child;if((j.subtreeFlags&2064)!==0&&ie!==null)ie.return=j,Se=ie;else e:for(j=ee;Se!==null;){if(D=Se,(D.flags&2048)!==0)try{switch(D.tag){case 0:case 11:case 15:_l(9,D)}}catch(Re){ct(D,D.return,Re)}if(D===j){Se=null;break e}var ge=D.sibling;if(ge!==null){ge.return=D.return,Se=ge;break e}Se=D.return}}if(Be=v,ls(),Ut&&typeof Ut.onPostCommitFiberRoot=="function")try{Ut.onPostCommitFiberRoot(Ot,t)}catch{}f=!0}return f}finally{We=a,An.transition=s}}return!1}function hw(t,s,a){s=Vi(a,s),s=A0(t,s,1),t=cs(t,s,1),s=nn(),t!==null&&(es(t,1,s),un(t,s))}function ct(t,s,a){if(t.tag===3)hw(t,t,a);else for(;s!==null;){if(s.tag===3){hw(s,t,a);break}else if(s.tag===1){var f=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(fs===null||!fs.has(f))){t=Vi(a,t),t=I0(s,t,1),s=cs(s,t,1),t=nn(),s!==null&&(es(s,1,t),un(s,t));break}}s=s.return}}function _R(t,s,a){var f=t.pingCache;f!==null&&f.delete(s),s=nn(),t.pingedLanes|=t.suspendedLanes&a,At===t&&(Dt&a)===a&&(Et===4||Et===3&&(Dt&130023424)===Dt&&500>Je()-td?Qs(t,0):ed|=a),un(t,s)}function pw(t,s){s===0&&((t.mode&1)===0?s=1:(s=Ts,Ts<<=1,(Ts&130023424)===0&&(Ts=4194304)));var a=nn();t=Lr(t,s),t!==null&&(es(t,s,a),un(t,a))}function bR(t){var s=t.memoizedState,a=0;s!==null&&(a=s.retryLane),pw(t,a)}function SR(t,s){var a=0;switch(t.tag){case 13:var f=t.stateNode,v=t.memoizedState;v!==null&&(a=v.retryLane);break;case 19:f=t.stateNode;break;default:throw Error(r(314))}f!==null&&f.delete(s),pw(t,a)}var mw;mw=function(t,s,a){if(t!==null)if(t.memoizedProps!==s.pendingProps||sn.current)an=!0;else{if((t.lanes&a)===0&&(s.flags&128)===0)return an=!1,cR(t,s,a);an=(t.flags&131072)!==0}else an=!1,st&&(s.flags&1048576)!==0&&Yy(s,sl,s.index);switch(s.lanes=0,s.tag){case 2:var f=s.type;wl(t,s),t=s.pendingProps;var v=$i(s,Wt.current);Hi(s,a),v=Ic(null,s,f,t,v,a);var x=Mc();return s.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,on(f)?(x=!0,tl(s)):x=!1,s.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,Ec(s),v.updater=vl,s.stateNode=v,v._reactInternals=s,Dc(s,f,t,a),s=Uc(null,s,f,!0,x,a)):(s.tag=0,st&&x&&mc(s),tn(null,s,v,a),s=s.child),s;case 16:f=s.elementType;e:{switch(wl(t,s),t=s.pendingProps,v=f._init,f=v(f._payload),s.type=f,v=s.tag=ER(f),t=Wn(f,t),v){case 0:s=Bc(null,s,f,t,a);break e;case 1:s=z0(null,s,f,t,a);break e;case 11:s=L0(null,s,f,t,a);break e;case 14:s=q0(null,s,f,Wn(f.type,t),a);break e}throw Error(r(306,f,""))}return s;case 0:return f=s.type,v=s.pendingProps,v=s.elementType===f?v:Wn(f,v),Bc(t,s,f,v,a);case 1:return f=s.type,v=s.pendingProps,v=s.elementType===f?v:Wn(f,v),z0(t,s,f,v,a);case 3:e:{if(B0(s),t===null)throw Error(r(387));f=s.pendingProps,x=s.memoizedState,v=x.element,r0(t,s),cl(s,f,null,a);var j=s.memoizedState;if(f=j.element,x.isDehydrated)if(x={element:f,isDehydrated:!1,cache:j.cache,pendingSuspenseBoundaries:j.pendingSuspenseBoundaries,transitions:j.transitions},s.updateQueue.baseState=x,s.memoizedState=x,s.flags&256){v=Vi(Error(r(423)),s),s=U0(t,s,f,a,v);break e}else if(f!==v){v=Vi(Error(r(424)),s),s=U0(t,s,f,a,v);break e}else for(yn=is(s.stateNode.containerInfo.firstChild),vn=s,st=!0,Hn=null,a=t0(s,null,f,a),s.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(zi(),f===v){s=$r(t,s,a);break e}tn(t,s,f,a)}s=s.child}return s;case 5:return o0(s),t===null&&yc(s),f=s.type,v=s.pendingProps,x=t!==null?t.memoizedProps:null,j=v.children,uc(f,v)?j=null:x!==null&&uc(f,x)&&(s.flags|=32),F0(t,s),tn(t,s,j,a),s.child;case 6:return t===null&&yc(s),null;case 13:return H0(t,s,a);case 4:return Nc(s,s.stateNode.containerInfo),f=s.pendingProps,t===null?s.child=Bi(s,null,f,a):tn(t,s,f,a),s.child;case 11:return f=s.type,v=s.pendingProps,v=s.elementType===f?v:Wn(f,v),L0(t,s,f,v,a);case 7:return tn(t,s,s.pendingProps,a),s.child;case 8:return tn(t,s,s.pendingProps.children,a),s.child;case 12:return tn(t,s,s.pendingProps.children,a),s.child;case 10:e:{if(f=s.type._context,v=s.pendingProps,x=s.memoizedProps,j=v.value,et(al,f._currentValue),f._currentValue=j,x!==null)if(Un(x.value,j)){if(x.children===v.children&&!sn.current){s=$r(t,s,a);break e}}else for(x=s.child,x!==null&&(x.return=s);x!==null;){var D=x.dependencies;if(D!==null){j=x.child;for(var K=D.firstContext;K!==null;){if(K.context===f){if(x.tag===1){K=qr(-1,a&-a),K.tag=2;var ae=x.updateQueue;if(ae!==null){ae=ae.shared;var pe=ae.pending;pe===null?K.next=K:(K.next=pe.next,pe.next=K),ae.pending=K}}x.lanes|=a,K=x.alternate,K!==null&&(K.lanes|=a),Sc(x.return,a,s),D.lanes|=a;break}K=K.next}}else if(x.tag===10)j=x.type===s.type?null:x.child;else if(x.tag===18){if(j=x.return,j===null)throw Error(r(341));j.lanes|=a,D=j.alternate,D!==null&&(D.lanes|=a),Sc(j,a,s),j=x.sibling}else j=x.child;if(j!==null)j.return=x;else for(j=x;j!==null;){if(j===s){j=null;break}if(x=j.sibling,x!==null){x.return=j.return,j=x;break}j=j.return}x=j}tn(t,s,v.children,a),s=s.child}return s;case 9:return v=s.type,f=s.pendingProps.children,Hi(s,a),v=Rn(v),f=f(v),s.flags|=1,tn(t,s,f,a),s.child;case 14:return f=s.type,v=Wn(f,s.pendingProps),v=Wn(f.type,v),q0(t,s,f,v,a);case 15:return $0(t,s,s.type,s.pendingProps,a);case 17:return f=s.type,v=s.pendingProps,v=s.elementType===f?v:Wn(f,v),wl(t,s),s.tag=1,on(f)?(t=!0,tl(s)):t=!1,Hi(s,a),R0(s,f,v),Dc(s,f,v,a),Uc(null,s,f,!0,t,a);case 19:return V0(t,s,a);case 22:return D0(t,s,a)}throw Error(r(156,s.tag))};function gw(t,s){return Cs(t,s)}function kR(t,s,a,f){this.tag=t,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function In(t,s,a,f){return new kR(t,s,a,f)}function ud(t){return t=t.prototype,!(!t||!t.isReactComponent)}function ER(t){if(typeof t=="function")return ud(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Y)return 11;if(t===Q)return 14}return 2}function gs(t,s){var a=t.alternate;return a===null?(a=In(t.tag,s,t.key,t.mode),a.elementType=t.elementType,a.type=t.type,a.stateNode=t.stateNode,a.alternate=t,t.alternate=a):(a.pendingProps=s,a.type=t.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=t.flags&14680064,a.childLanes=t.childLanes,a.lanes=t.lanes,a.child=t.child,a.memoizedProps=t.memoizedProps,a.memoizedState=t.memoizedState,a.updateQueue=t.updateQueue,s=t.dependencies,a.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},a.sibling=t.sibling,a.index=t.index,a.ref=t.ref,a}function Tl(t,s,a,f,v,x){var j=2;if(f=t,typeof t=="function")ud(t)&&(j=1);else if(typeof t=="string")j=5;else e:switch(t){case L:return Js(a.children,v,x,s);case H:j=8,v|=8;break;case O:return t=In(12,a,s,v|2),t.elementType=O,t.lanes=x,t;case q:return t=In(13,a,s,v),t.elementType=q,t.lanes=x,t;case R:return t=In(19,a,s,v),t.elementType=R,t.lanes=x,t;case ne:return Al(a,v,x,s);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case P:j=10;break e;case F:j=9;break e;case Y:j=11;break e;case Q:j=14;break e;case z:j=16,f=null;break e}throw Error(r(130,t==null?t:typeof t,""))}return s=In(j,a,s,v),s.elementType=t,s.type=f,s.lanes=x,s}function Js(t,s,a,f){return t=In(7,t,f,s),t.lanes=a,t}function Al(t,s,a,f){return t=In(22,t,f,s),t.elementType=ne,t.lanes=a,t.stateNode={isHidden:!1},t}function cd(t,s,a){return t=In(6,t,null,s),t.lanes=a,t}function dd(t,s,a){return s=In(4,t.children!==null?t.children:[],t.key,s),s.lanes=a,s.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},s}function NR(t,s,a,f,v){this.tag=s,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=bi(0),this.expirationTimes=bi(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=bi(0),this.identifierPrefix=f,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function fd(t,s,a,f,v,x,j,D,K){return t=new NR(t,s,a,D,K),s===1?(s=1,x===!0&&(s|=8)):s=0,x=In(3,null,null,s),t.current=x,x.stateNode=t,x.memoizedState={element:f,isDehydrated:a,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ec(x),t}function CR(t,s,a){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:M,key:f==null?null:""+f,children:t,containerInfo:s,implementation:a}}function vw(t){if(!t)return as;t=t._reactInternals;e:{if(gn(t)!==t||t.tag!==1)throw Error(r(170));var s=t;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(on(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(r(171))}if(t.tag===1){var a=t.type;if(on(a))return Wy(t,a,s)}return s}function yw(t,s,a,f,v,x,j,D,K){return t=fd(a,f,!0,t,v,x,j,D,K),t.context=vw(null),a=t.current,f=nn(),v=ps(a),x=qr(f,v),x.callback=s??null,cs(a,x,v),t.current.lanes=v,es(t,v,f),un(t,f),t}function Il(t,s,a,f){var v=s.current,x=nn(),j=ps(v);return a=vw(a),s.context===null?s.context=a:s.pendingContext=a,s=qr(x,j),s.payload={element:t},f=f===void 0?null:f,f!==null&&(s.callback=f),t=cs(v,s,j),t!==null&&(Yn(t,v,j,x),ul(t,v,j)),j}function Ml(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 ww(t,s){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<s?a:s}}function hd(t,s){ww(t,s),(t=t.alternate)&&ww(t,s)}function jR(){return null}var xw=typeof reportError=="function"?reportError:function(t){console.error(t)};function pd(t){this._internalRoot=t}Pl.prototype.render=pd.prototype.render=function(t){var s=this._internalRoot;if(s===null)throw Error(r(409));Il(t,s,null,null)},Pl.prototype.unmount=pd.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var s=t.containerInfo;Xs(function(){Il(null,t,null,null)}),s[Ir]=null}};function Pl(t){this._internalRoot=t}Pl.prototype.unstable_scheduleHydration=function(t){if(t){var s=ar();t={blockedOn:null,target:t,priority:s};for(var a=0;a<Lt.length&&s!==0&&s<Lt[a].priority;a++);Lt.splice(a,0,t),a===0&&To(t)}};function md(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Ol(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function _w(){}function RR(t,s,a,f,v){if(v){if(typeof f=="function"){var x=f;f=function(){var ae=Ml(j);x.call(ae)}}var j=yw(s,f,t,0,null,!1,!1,"",_w);return t._reactRootContainer=j,t[Ir]=j.current,Ho(t.nodeType===8?t.parentNode:t),Xs(),j}for(;v=t.lastChild;)t.removeChild(v);if(typeof f=="function"){var D=f;f=function(){var ae=Ml(K);D.call(ae)}}var K=fd(t,0,!1,null,null,!1,!1,"",_w);return t._reactRootContainer=K,t[Ir]=K.current,Ho(t.nodeType===8?t.parentNode:t),Xs(function(){Il(s,K,a,f)}),K}function Ll(t,s,a,f,v){var x=a._reactRootContainer;if(x){var j=x;if(typeof v=="function"){var D=v;v=function(){var K=Ml(j);D.call(K)}}Il(s,j,t,v)}else j=RR(a,s,t,v,f);return Ml(j)}Er=function(t){switch(t.tag){case 3:var s=t.stateNode;if(s.current.memoizedState.isDehydrated){var a=Zr(s.pendingLanes);a!==0&&(Ht(s,a|1),un(s,Je()),(Be&6)===0&&(Ki=Je()+500,ls()))}break;case 13:Xs(function(){var f=Lr(t,1);if(f!==null){var v=nn();Yn(f,t,1,v)}}),hd(t,1)}},Nr=function(t){if(t.tag===13){var s=Lr(t,134217728);if(s!==null){var a=nn();Yn(s,t,134217728,a)}hd(t,134217728)}},ki=function(t){if(t.tag===13){var s=ps(t),a=Lr(t,s);if(a!==null){var f=nn();Yn(a,t,s,f)}hd(t,s)}},ar=function(){return We},Co=function(t,s){var a=We;try{return We=t,s()}finally{We=a}},bn=function(t,s,a){switch(s){case"input":if(we(t,a),s=a.name,a.type==="radio"&&s!=null){for(a=t;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<a.length;s++){var f=a[s];if(f!==t&&f.form===t.form){var v=Ja(f);if(!v)throw Error(r(90));ve(f),we(f,v)}}}break;case"textarea":Ze(t,a);break;case"select":s=a.value,s!=null&&ht(t,!!a.multiple,s,!1)}},hi=od,nr=Xs;var TR={usingClientEntryPoint:!1,Events:[Go,Li,Ja,Gr,ut,od]},aa={findFiberByHostInstance:Bs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},AR={bundleType:aa.bundleType,version:aa.version,rendererPackageName:aa.rendererPackageName,rendererConfig:aa.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=en(t),t===null?null:t.stateNode},findFiberByHostInstance:aa.findFiberByHostInstance||jR,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 ql=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ql.isDisabled&&ql.supportsFiber)try{Ot=ql.inject(AR),Ut=ql}catch{}}return cn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=TR,cn.createPortal=function(t,s){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!md(s))throw Error(r(200));return CR(t,s,null,a)},cn.createRoot=function(t,s){if(!md(t))throw Error(r(299));var a=!1,f="",v=xw;return s!=null&&(s.unstable_strictMode===!0&&(a=!0),s.identifierPrefix!==void 0&&(f=s.identifierPrefix),s.onRecoverableError!==void 0&&(v=s.onRecoverableError)),s=fd(t,1,!1,null,null,a,!1,f,v),t[Ir]=s.current,Ho(t.nodeType===8?t.parentNode:t),new pd(s)},cn.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var s=t._reactInternals;if(s===void 0)throw typeof t.render=="function"?Error(r(188)):(t=Object.keys(t).join(","),Error(r(268,t)));return t=en(s),t=t===null?null:t.stateNode,t},cn.flushSync=function(t){return Xs(t)},cn.hydrate=function(t,s,a){if(!Ol(s))throw Error(r(200));return Ll(null,t,s,!0,a)},cn.hydrateRoot=function(t,s,a){if(!md(t))throw Error(r(405));var f=a!=null&&a.hydratedSources||null,v=!1,x="",j=xw;if(a!=null&&(a.unstable_strictMode===!0&&(v=!0),a.identifierPrefix!==void 0&&(x=a.identifierPrefix),a.onRecoverableError!==void 0&&(j=a.onRecoverableError)),s=yw(s,null,t,1,a??null,v,!1,x,j),t[Ir]=s.current,Ho(t),f)for(t=0;t<f.length;t++)a=f[t],v=a._getVersion,v=v(a._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[a,v]:s.mutableSourceEagerHydrationData.push(a,v);return new Pl(s)},cn.render=function(t,s,a){if(!Ol(s))throw Error(r(200));return Ll(null,t,s,!1,a)},cn.unmountComponentAtNode=function(t){if(!Ol(t))throw Error(r(40));return t._reactRootContainer?(Xs(function(){Ll(null,null,t,!1,function(){t._reactRootContainer=null,t[Ir]=null})}),!0):!1},cn.unstable_batchedUpdates=od,cn.unstable_renderSubtreeIntoContainer=function(t,s,a,f){if(!Ol(a))throw Error(r(200));if(t==null||t._reactInternals===void 0)throw Error(r(38));return Ll(t,s,a,!1,f)},cn.version="18.3.1-next-f1338f8080-20240426",cn}var Rw;function CE(){if(Rw)return yd.exports;Rw=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(n){console.error(n)}}return e(),yd.exports=$R(),yd.exports}var Tw;function DR(){if(Tw)return Dl;Tw=1;var e=CE();return Dl.createRoot=e.createRoot,Dl.hydrateRoot=e.hydrateRoot,Dl}var FR=DR(),T=Aa();const ue=jv(T);function Bt(e){if(typeof e=="string"||typeof e=="number")return""+e;let n="";if(Array.isArray(e))for(let r=0,i;r<e.length;r++)(i=Bt(e[r]))!==""&&(n+=(n&&" ")+i);else for(let r in e)e[r]&&(n+=(n&&" ")+r);return n}var _d={exports:{}},bd={},Sd={exports:{}},kd={};/**
|
|
41
41
|
* @license React
|
|
42
42
|
* use-sync-external-store-shim.production.js
|
|
43
43
|
*
|
|
@@ -53,18 +53,18 @@ Error generating stack: `+x.message+`
|
|
|
53
53
|
*
|
|
54
54
|
* This source code is licensed under the MIT license found in the
|
|
55
55
|
* LICENSE file in the root directory of this source tree.
|
|
56
|
-
*/var Mw;function UR(){if(Mw)return bd;Mw=1;var e=Aa(),n=BR();function r(p,d){return p===d&&(p!==0||1/p===1/d)||p!==p&&d!==d}var i=typeof Object.is=="function"?Object.is:r,o=n.useSyncExternalStore,l=e.useRef,u=e.useEffect,c=e.useMemo,h=e.useDebugValue;return bd.useSyncExternalStoreWithSelector=function(p,d,m,y,w){var N=l(null);if(N.current===null){var _={hasValue:!1,value:null};N.current=_}else _=N.current;N=c(function(){function b(M){if(!k){if(k=!0,E=M,M=y(M),w!==void 0&&_.hasValue){var L=_.value;if(w(L,M))return C=L}return C=M}if(L=C,i(E,M))return L;var H=y(M);return w!==void 0&&w(L,H)?(E=M,L):(E=M,C=H)}var k=!1,E,C,A=m===void 0?null:m;return[function(){return b(d())},A===null?void 0:function(){return b(A())}]},[d,m,y,w]);var S=o(p,N[0],N[1]);return u(function(){_.hasValue=!0,_.value=S},[S]),h(S),S},bd}var Pw;function HR(){return Pw||(Pw=1,_d.exports=UR()),_d.exports}var WR=HR();const VR=jv(WR),GR={},Ow=e=>{let n;const r=new Set,i=(d,m)=>{const y=typeof d=="function"?d(n):d;if(!Object.is(y,n)){const w=n;n=m??(typeof y!="object"||y===null)?y:Object.assign({},n,y),r.forEach(N=>N(n,w))}},o=()=>n,h={setState:i,getState:o,getInitialState:()=>p,subscribe:d=>(r.add(d),()=>r.delete(d)),destroy:()=>{(GR?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},p=n=e(i,o,h);return h},YR=e=>e?Ow(e):Ow,{useDebugValue:KR}=ue,{useSyncExternalStoreWithSelector:XR}=VR,QR=e=>e;function jE(e,n=QR,r){const i=XR(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,r);return KR(i),i}const Lw=(e,n)=>{const r=YR(e),i=(o,l=n)=>jE(r,o,l);return Object.assign(i,r),i},ZR=(e,n)=>e?Lw(e,n):Lw;function Nt(e,n){if(Object.is(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[i,o]of e)if(!Object.is(o,n.get(i)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const i of e)if(!n.has(i))return!1;return!0}const r=Object.keys(e);if(r.length!==Object.keys(n).length)return!1;for(const i of r)if(!Object.prototype.hasOwnProperty.call(n,i)||!Object.is(e[i],n[i]))return!1;return!0}var JR={value:()=>{}};function _u(){for(var e=0,n=arguments.length,r={},i;e<n;++e){if(!(i=arguments[e]+"")||i in r||/[\s.]/.test(i))throw new Error("illegal type: "+i);r[i]=[]}return new ru(r)}function ru(e){this._=e}function eT(e,n){return e.trim().split(/^|\s+/).map(function(r){var i="",o=r.indexOf(".");if(o>=0&&(i=r.slice(o+1),r=r.slice(0,o)),r&&!n.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}ru.prototype=_u.prototype={constructor:ru,on:function(e,n){var r=this._,i=eT(e+"",r),o,l=-1,u=i.length;if(arguments.length<2){for(;++l<u;)if((o=(e=i[l]).type)&&(o=tT(r[o],e.name)))return o;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++l<u;)if(o=(e=i[l]).type)r[o]=qw(r[o],e.name,n);else if(n==null)for(o in r)r[o]=qw(r[o],e.name,null);return this},copy:function(){var e={},n=this._;for(var r in n)e[r]=n[r].slice();return new ru(e)},call:function(e,n){if((o=arguments.length-2)>0)for(var r=new Array(o),i=0,o,l;i<o;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],i=0,o=l.length;i<o;++i)l[i].value.apply(n,r)},apply:function(e,n,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],o=0,l=i.length;o<l;++o)i[o].value.apply(n,r)}};function tT(e,n){for(var r=0,i=e.length,o;r<i;++r)if((o=e[r]).name===n)return o.value}function qw(e,n,r){for(var i=0,o=e.length;i<o;++i)if(e[i].name===n){e[i]=JR,e=e.slice(0,i).concat(e.slice(i+1));break}return r!=null&&e.push({name:n,value:r}),e}var nv="http://www.w3.org/1999/xhtml";const $w={svg:"http://www.w3.org/2000/svg",xhtml:nv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function bu(e){var n=e+="",r=n.indexOf(":");return r>=0&&(n=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),$w.hasOwnProperty(n)?{space:$w[n],local:e}:e}function nT(e){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===nv&&n.documentElement.namespaceURI===nv?n.createElement(e):n.createElementNS(r,e)}}function rT(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function RE(e){var n=bu(e);return(n.local?rT:nT)(n)}function sT(){}function Rv(e){return e==null?sT:function(){return this.querySelector(e)}}function iT(e){typeof e!="function"&&(e=Rv(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o)for(var l=n[o],u=l.length,c=i[o]=new Array(u),h,p,d=0;d<u;++d)(h=l[d])&&(p=e.call(h,h.__data__,d,l))&&("__data__"in h&&(p.__data__=h.__data__),c[d]=p);return new xn(i,this._parents)}function oT(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function aT(){return[]}function TE(e){return e==null?aT:function(){return this.querySelectorAll(e)}}function lT(e){return function(){return oT(e.apply(this,arguments))}}function uT(e){typeof e=="function"?e=lT(e):e=TE(e);for(var n=this._groups,r=n.length,i=[],o=[],l=0;l<r;++l)for(var u=n[l],c=u.length,h,p=0;p<c;++p)(h=u[p])&&(i.push(e.call(h,h.__data__,p,u)),o.push(h));return new xn(i,o)}function AE(e){return function(){return this.matches(e)}}function IE(e){return function(n){return n.matches(e)}}var cT=Array.prototype.find;function dT(e){return function(){return cT.call(this.children,e)}}function fT(){return this.firstElementChild}function hT(e){return this.select(e==null?fT:dT(typeof e=="function"?e:IE(e)))}var pT=Array.prototype.filter;function mT(){return Array.from(this.children)}function gT(e){return function(){return pT.call(this.children,e)}}function vT(e){return this.selectAll(e==null?mT:gT(typeof e=="function"?e:IE(e)))}function yT(e){typeof e!="function"&&(e=AE(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o)for(var l=n[o],u=l.length,c=i[o]=[],h,p=0;p<u;++p)(h=l[p])&&e.call(h,h.__data__,p,l)&&c.push(h);return new xn(i,this._parents)}function ME(e){return new Array(e.length)}function wT(){return new xn(this._enter||this._groups.map(ME),this._parents)}function lu(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}lu.prototype={constructor:lu,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function xT(e){return function(){return e}}function _T(e,n,r,i,o,l){for(var u=0,c,h=n.length,p=l.length;u<p;++u)(c=n[u])?(c.__data__=l[u],i[u]=c):r[u]=new lu(e,l[u]);for(;u<h;++u)(c=n[u])&&(o[u]=c)}function bT(e,n,r,i,o,l,u){var c,h,p=new Map,d=n.length,m=l.length,y=new Array(d),w;for(c=0;c<d;++c)(h=n[c])&&(y[c]=w=u.call(h,h.__data__,c,n)+"",p.has(w)?o[c]=h:p.set(w,h));for(c=0;c<m;++c)w=u.call(e,l[c],c,l)+"",(h=p.get(w))?(i[c]=h,h.__data__=l[c],p.delete(w)):r[c]=new lu(e,l[c]);for(c=0;c<d;++c)(h=n[c])&&p.get(y[c])===h&&(o[c]=h)}function ST(e){return e.__data__}function kT(e,n){if(!arguments.length)return Array.from(this,ST);var r=n?bT:_T,i=this._parents,o=this._groups;typeof e!="function"&&(e=xT(e));for(var l=o.length,u=new Array(l),c=new Array(l),h=new Array(l),p=0;p<l;++p){var d=i[p],m=o[p],y=m.length,w=ET(e.call(d,d&&d.__data__,p,i)),N=w.length,_=c[p]=new Array(N),S=u[p]=new Array(N),b=h[p]=new Array(y);r(d,m,_,S,b,w,n);for(var k=0,E=0,C,A;k<N;++k)if(C=_[k]){for(k>=E&&(E=k+1);!(A=S[E])&&++E<N;);C._next=A||null}}return u=new xn(u,i),u._enter=c,u._exit=h,u}function ET(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function NT(){return new xn(this._exit||this._groups.map(ME),this._parents)}function CT(e,n,r){var i=this.enter(),o=this,l=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),n!=null&&(o=n(o),o&&(o=o.selection())),r==null?l.remove():r(l),i&&o?i.merge(o).order():o}function jT(e){for(var n=e.selection?e.selection():e,r=this._groups,i=n._groups,o=r.length,l=i.length,u=Math.min(o,l),c=new Array(o),h=0;h<u;++h)for(var p=r[h],d=i[h],m=p.length,y=c[h]=new Array(m),w,N=0;N<m;++N)(w=p[N]||d[N])&&(y[N]=w);for(;h<o;++h)c[h]=r[h];return new xn(c,this._parents)}function RT(){for(var e=this._groups,n=-1,r=e.length;++n<r;)for(var i=e[n],o=i.length-1,l=i[o],u;--o>=0;)(u=i[o])&&(l&&u.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(u,l),l=u);return this}function TT(e){e||(e=AT);function n(m,y){return m&&y?e(m.__data__,y.__data__):!m-!y}for(var r=this._groups,i=r.length,o=new Array(i),l=0;l<i;++l){for(var u=r[l],c=u.length,h=o[l]=new Array(c),p,d=0;d<c;++d)(p=u[d])&&(h[d]=p);h.sort(n)}return new xn(o,this._parents).order()}function AT(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function IT(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function MT(){return Array.from(this)}function PT(){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,l=i.length;o<l;++o){var u=i[o];if(u)return u}return null}function OT(){let e=0;for(const n of this)++e;return e}function LT(){return!this.node()}function qT(e){for(var n=this._groups,r=0,i=n.length;r<i;++r)for(var o=n[r],l=0,u=o.length,c;l<u;++l)(c=o[l])&&e.call(c,c.__data__,l,o);return this}function $T(e){return function(){this.removeAttribute(e)}}function DT(e){return function(){this.removeAttributeNS(e.space,e.local)}}function FT(e,n){return function(){this.setAttribute(e,n)}}function zT(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function BT(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function UT(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function HT(e,n){var r=bu(e);if(arguments.length<2){var i=this.node();return r.local?i.getAttributeNS(r.space,r.local):i.getAttribute(r)}return this.each((n==null?r.local?DT:$T:typeof n=="function"?r.local?UT:BT:r.local?zT:FT)(r,n))}function PE(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function WT(e){return function(){this.style.removeProperty(e)}}function VT(e,n,r){return function(){this.style.setProperty(e,n,r)}}function GT(e,n,r){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,r)}}function YT(e,n,r){return arguments.length>1?this.each((n==null?WT:typeof n=="function"?GT:VT)(e,n,r??"")):co(this.node(),e)}function co(e,n){return e.style.getPropertyValue(n)||PE(e).getComputedStyle(e,null).getPropertyValue(n)}function KT(e){return function(){delete this[e]}}function XT(e,n){return function(){this[e]=n}}function QT(e,n){return function(){var r=n.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function ZT(e,n){return arguments.length>1?this.each((n==null?KT:typeof n=="function"?QT:XT)(e,n)):this.node()[e]}function OE(e){return e.trim().split(/^|\s+/)}function Tv(e){return e.classList||new LE(e)}function LE(e){this._node=e,this._names=OE(e.getAttribute("class")||"")}LE.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function qE(e,n){for(var r=Tv(e),i=-1,o=n.length;++i<o;)r.add(n[i])}function $E(e,n){for(var r=Tv(e),i=-1,o=n.length;++i<o;)r.remove(n[i])}function JT(e){return function(){qE(this,e)}}function e2(e){return function(){$E(this,e)}}function t2(e,n){return function(){(n.apply(this,arguments)?qE:$E)(this,e)}}function n2(e,n){var r=OE(e+"");if(arguments.length<2){for(var i=Tv(this.node()),o=-1,l=r.length;++o<l;)if(!i.contains(r[o]))return!1;return!0}return this.each((typeof n=="function"?t2:n?JT:e2)(r,n))}function r2(){this.textContent=""}function s2(e){return function(){this.textContent=e}}function i2(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function o2(e){return arguments.length?this.each(e==null?r2:(typeof e=="function"?i2:s2)(e)):this.node().textContent}function a2(){this.innerHTML=""}function l2(e){return function(){this.innerHTML=e}}function u2(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function c2(e){return arguments.length?this.each(e==null?a2:(typeof e=="function"?u2:l2)(e)):this.node().innerHTML}function d2(){this.nextSibling&&this.parentNode.appendChild(this)}function f2(){return this.each(d2)}function h2(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function p2(){return this.each(h2)}function m2(e){var n=typeof e=="function"?e:RE(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function g2(){return null}function v2(e,n){var r=typeof e=="function"?e:RE(e),i=n==null?g2:typeof n=="function"?n:Rv(n);return this.select(function(){return this.insertBefore(r.apply(this,arguments),i.apply(this,arguments)||null)})}function y2(){var e=this.parentNode;e&&e.removeChild(this)}function w2(){return this.each(y2)}function x2(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function _2(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function b2(e){return this.select(e?_2:x2)}function S2(e){return arguments.length?this.property("__data__",e):this.node().__data__}function k2(e){return function(n){e.call(this,n,this.__data__)}}function E2(e){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");return i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),{type:n,name:r}})}function N2(e){return function(){var n=this.__on;if(n){for(var r=0,i=-1,o=n.length,l;r<o;++r)l=n[r],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):n[++i]=l;++i?n.length=i:delete this.__on}}}function C2(e,n,r){return function(){var i=this.__on,o,l=k2(n);if(i){for(var u=0,c=i.length;u<c;++u)if((o=i[u]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=l,o.options=r),o.value=n;return}}this.addEventListener(e.type,l,r),o={type:e.type,name:e.name,value:n,listener:l,options:r},i?i.push(o):this.__on=[o]}}function j2(e,n,r){var i=E2(e+""),o,l=i.length,u;if(arguments.length<2){var c=this.node().__on;if(c){for(var h=0,p=c.length,d;h<p;++h)for(o=0,d=c[h];o<l;++o)if((u=i[o]).type===d.type&&u.name===d.name)return d.value}return}for(c=n?C2:N2,o=0;o<l;++o)this.each(c(i[o],n,r));return this}function DE(e,n,r){var i=PE(e),o=i.CustomEvent;typeof o=="function"?o=new o(n,r):(o=i.document.createEvent("Event"),r?(o.initEvent(n,r.bubbles,r.cancelable),o.detail=r.detail):o.initEvent(n,!1,!1)),e.dispatchEvent(o)}function R2(e,n){return function(){return DE(this,e,n)}}function T2(e,n){return function(){return DE(this,e,n.apply(this,arguments))}}function A2(e,n){return this.each((typeof n=="function"?T2:R2)(e,n))}function*I2(){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,l=i.length,u;o<l;++o)(u=i[o])&&(yield u)}var FE=[null];function xn(e,n){this._groups=e,this._parents=n}function Ia(){return new xn([[document.documentElement]],FE)}function M2(){return this}xn.prototype=Ia.prototype={constructor:xn,select:iT,selectAll:uT,selectChild:hT,selectChildren:vT,filter:yT,data:kT,enter:wT,exit:NT,join:CT,merge:jT,selection:M2,order:RT,sort:TT,call:IT,nodes:MT,node:PT,size:OT,empty:LT,each:qT,attr:HT,style:YT,property:ZT,classed:n2,text:o2,html:c2,raise:f2,lower:p2,append:m2,insert:v2,remove:w2,clone:b2,datum:S2,on:j2,dispatch:A2,[Symbol.iterator]:I2};function Pn(e){return typeof e=="string"?new xn([[document.querySelector(e)]],[document.documentElement]):new xn([[e]],FE)}function P2(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Xn(e,n){if(e=P2(e),n===void 0&&(n=e.currentTarget),n){var r=n.ownerSVGElement||n;if(r.createSVGPoint){var i=r.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}if(n.getBoundingClientRect){var o=n.getBoundingClientRect();return[e.clientX-o.left-n.clientLeft,e.clientY-o.top-n.clientTop]}}return[e.pageX,e.pageY]}const O2={passive:!1},_a={capture:!0,passive:!1};function Ed(e){e.stopImmediatePropagation()}function oo(e){e.preventDefault(),e.stopImmediatePropagation()}function zE(e){var n=e.document.documentElement,r=Pn(e).on("dragstart.drag",oo,_a);"onselectstart"in n?r.on("selectstart.drag",oo,_a):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function BE(e,n){var r=e.document.documentElement,i=Pn(e).on("dragstart.drag",null);n&&(i.on("click.drag",oo,_a),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in r?i.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}const Fl=e=>()=>e;function rv(e,{sourceEvent:n,subject:r,target:i,identifier:o,active:l,x:u,y:c,dx:h,dy:p,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:u,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:h,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:d}})}rv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function L2(e){return!e.ctrlKey&&!e.button}function q2(){return this.parentNode}function $2(e,n){return n??{x:e.x,y:e.y}}function D2(){return navigator.maxTouchPoints||"ontouchstart"in this}function F2(){var e=L2,n=q2,r=$2,i=D2,o={},l=_u("start","drag","end"),u=0,c,h,p,d,m=0;function y(C){C.on("mousedown.drag",w).filter(i).on("touchstart.drag",S).on("touchmove.drag",b,O2).on("touchend.drag touchcancel.drag",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(C,A){if(!(d||!e.call(this,C,A))){var M=E(this,n.call(this,C,A),C,A,"mouse");M&&(Pn(C.view).on("mousemove.drag",N,_a).on("mouseup.drag",_,_a),zE(C.view),Ed(C),p=!1,c=C.clientX,h=C.clientY,M("start",C))}}function N(C){if(oo(C),!p){var A=C.clientX-c,M=C.clientY-h;p=A*A+M*M>m}o.mouse("drag",C)}function _(C){Pn(C.view).on("mousemove.drag mouseup.drag",null),BE(C.view,p),oo(C),o.mouse("end",C)}function S(C,A){if(e.call(this,C,A)){var M=C.changedTouches,L=n.call(this,C,A),H=M.length,O,P;for(O=0;O<H;++O)(P=E(this,L,C,A,M[O].identifier,M[O]))&&(Ed(C),P("start",C,M[O]))}}function b(C){var A=C.changedTouches,M=A.length,L,H;for(L=0;L<M;++L)(H=o[A[L].identifier])&&(oo(C),H("drag",C,A[L]))}function k(C){var A=C.changedTouches,M=A.length,L,H;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),L=0;L<M;++L)(H=o[A[L].identifier])&&(Ed(C),H("end",C,A[L]))}function E(C,A,M,L,H,O){var P=l.copy(),F=Xn(O||M,A),G,q,R;if((R=r.call(C,new rv("beforestart",{sourceEvent:M,target:y,identifier:H,active:u,x:F[0],y:F[1],dx:0,dy:0,dispatch:P}),L))!=null)return G=R.x-F[0]||0,q=R.y-F[1]||0,function Q(z,ne,Z){var $=F,X;switch(z){case"start":o[H]=Q,X=u++;break;case"end":delete o[H],--u;case"drag":F=Xn(Z||ne,A),X=u;break}P.call(z,C,new rv(z,{sourceEvent:ne,subject:R,target:y,identifier:H,active:X,x:F[0]+G,y:F[1]+q,dx:F[0]-$[0],dy:F[1]-$[1],dispatch:P}),L)}}return y.filter=function(C){return arguments.length?(e=typeof C=="function"?C:Fl(!!C),y):e},y.container=function(C){return arguments.length?(n=typeof C=="function"?C:Fl(C),y):n},y.subject=function(C){return arguments.length?(r=typeof C=="function"?C:Fl(C),y):r},y.touchable=function(C){return arguments.length?(i=typeof C=="function"?C:Fl(!!C),y):i},y.on=function(){var C=l.on.apply(l,arguments);return C===l?y:C},y.clickDistance=function(C){return arguments.length?(m=(C=+C)*C,y):Math.sqrt(m)},y}function Av(e,n,r){e.prototype=n.prototype=r,r.constructor=e}function UE(e,n){var r=Object.create(e.prototype);for(var i in n)r[i]=n[i];return r}function Ma(){}var ba=.7,uu=1/ba,ao="\\s*([+-]?\\d+)\\s*",Sa="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",mr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",z2=/^#([0-9a-f]{3,8})$/,B2=new RegExp(`^rgb\\(${ao},${ao},${ao}\\)$`),U2=new RegExp(`^rgb\\(${mr},${mr},${mr}\\)$`),H2=new RegExp(`^rgba\\(${ao},${ao},${ao},${Sa}\\)$`),W2=new RegExp(`^rgba\\(${mr},${mr},${mr},${Sa}\\)$`),V2=new RegExp(`^hsl\\(${Sa},${mr},${mr}\\)$`),G2=new RegExp(`^hsla\\(${Sa},${mr},${mr},${Sa}\\)$`),Dw={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};Av(Ma,ka,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Fw,formatHex:Fw,formatHex8:Y2,formatHsl:K2,formatRgb:zw,toString:zw});function Fw(){return this.rgb().formatHex()}function Y2(){return this.rgb().formatHex8()}function K2(){return HE(this).formatHsl()}function zw(){return this.rgb().formatRgb()}function ka(e){var n,r;return e=(e+"").trim().toLowerCase(),(n=z2.exec(e))?(r=n[1].length,n=parseInt(n[1],16),r===6?Bw(n):r===3?new dn(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):r===8?zl(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):r===4?zl(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=B2.exec(e))?new dn(n[1],n[2],n[3],1):(n=U2.exec(e))?new dn(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=H2.exec(e))?zl(n[1],n[2],n[3],n[4]):(n=W2.exec(e))?zl(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=V2.exec(e))?Ww(n[1],n[2]/100,n[3]/100,1):(n=G2.exec(e))?Ww(n[1],n[2]/100,n[3]/100,n[4]):Dw.hasOwnProperty(e)?Bw(Dw[e]):e==="transparent"?new dn(NaN,NaN,NaN,0):null}function Bw(e){return new dn(e>>16&255,e>>8&255,e&255,1)}function zl(e,n,r,i){return i<=0&&(e=n=r=NaN),new dn(e,n,r,i)}function X2(e){return e instanceof Ma||(e=ka(e)),e?(e=e.rgb(),new dn(e.r,e.g,e.b,e.opacity)):new dn}function sv(e,n,r,i){return arguments.length===1?X2(e):new dn(e,n,r,i??1)}function dn(e,n,r,i){this.r=+e,this.g=+n,this.b=+r,this.opacity=+i}Av(dn,sv,UE(Ma,{brighter(e){return e=e==null?uu:Math.pow(uu,e),new dn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ba:Math.pow(ba,e),new dn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new dn(si(this.r),si(this.g),si(this.b),cu(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:Uw,formatHex:Uw,formatHex8:Q2,formatRgb:Hw,toString:Hw}));function Uw(){return`#${ni(this.r)}${ni(this.g)}${ni(this.b)}`}function Q2(){return`#${ni(this.r)}${ni(this.g)}${ni(this.b)}${ni((isNaN(this.opacity)?1:this.opacity)*255)}`}function Hw(){const e=cu(this.opacity);return`${e===1?"rgb(":"rgba("}${si(this.r)}, ${si(this.g)}, ${si(this.b)}${e===1?")":`, ${e})`}`}function cu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function si(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ni(e){return e=si(e),(e<16?"0":"")+e.toString(16)}function Ww(e,n,r,i){return i<=0?e=n=r=NaN:r<=0||r>=1?e=n=NaN:n<=0&&(e=NaN),new Qn(e,n,r,i)}function HE(e){if(e instanceof Qn)return new Qn(e.h,e.s,e.l,e.opacity);if(e instanceof Ma||(e=ka(e)),!e)return new Qn;if(e instanceof Qn)return e;e=e.rgb();var n=e.r/255,r=e.g/255,i=e.b/255,o=Math.min(n,r,i),l=Math.max(n,r,i),u=NaN,c=l-o,h=(l+o)/2;return c?(n===l?u=(r-i)/c+(r<i)*6:r===l?u=(i-n)/c+2:u=(n-r)/c+4,c/=h<.5?l+o:2-l-o,u*=60):c=h>0&&h<1?0:u,new Qn(u,c,h,e.opacity)}function Z2(e,n,r,i){return arguments.length===1?HE(e):new Qn(e,n,r,i??1)}function Qn(e,n,r,i){this.h=+e,this.s=+n,this.l=+r,this.opacity=+i}Av(Qn,Z2,UE(Ma,{brighter(e){return e=e==null?uu:Math.pow(uu,e),new Qn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ba:Math.pow(ba,e),new Qn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,i=r+(r<.5?r:1-r)*n,o=2*r-i;return new dn(Nd(e>=240?e-240:e+120,o,i),Nd(e,o,i),Nd(e<120?e+240:e-120,o,i),this.opacity)},clamp(){return new Qn(Vw(this.h),Bl(this.s),Bl(this.l),cu(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=cu(this.opacity);return`${e===1?"hsl(":"hsla("}${Vw(this.h)}, ${Bl(this.s)*100}%, ${Bl(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Vw(e){return e=(e||0)%360,e<0?e+360:e}function Bl(e){return Math.max(0,Math.min(1,e||0))}function Nd(e,n,r){return(e<60?n+(r-n)*e/60:e<180?r:e<240?n+(r-n)*(240-e)/60:n)*255}const WE=e=>()=>e;function J2(e,n){return function(r){return e+r*n}}function eA(e,n,r){return e=Math.pow(e,r),n=Math.pow(n,r)-e,r=1/r,function(i){return Math.pow(e+i*n,r)}}function tA(e){return(e=+e)==1?VE:function(n,r){return r-n?eA(n,r,e):WE(isNaN(n)?r:n)}}function VE(e,n){var r=n-e;return r?J2(e,r):WE(isNaN(e)?n:e)}const Gw=(function e(n){var r=tA(n);function i(o,l){var u=r((o=sv(o)).r,(l=sv(l)).r),c=r(o.g,l.g),h=r(o.b,l.b),p=VE(o.opacity,l.opacity);return function(d){return o.r=u(d),o.g=c(d),o.b=h(d),o.opacity=p(d),o+""}}return i.gamma=e,i})(1);function ws(e,n){return e=+e,n=+n,function(r){return e*(1-r)+n*r}}var iv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Cd=new RegExp(iv.source,"g");function nA(e){return function(){return e}}function rA(e){return function(n){return e(n)+""}}function sA(e,n){var r=iv.lastIndex=Cd.lastIndex=0,i,o,l,u=-1,c=[],h=[];for(e=e+"",n=n+"";(i=iv.exec(e))&&(o=Cd.exec(n));)(l=o.index)>r&&(l=n.slice(r,l),c[u]?c[u]+=l:c[++u]=l),(i=i[0])===(o=o[0])?c[u]?c[u]+=o:c[++u]=o:(c[++u]=null,h.push({i:u,x:ws(i,o)})),r=Cd.lastIndex;return r<n.length&&(l=n.slice(r),c[u]?c[u]+=l:c[++u]=l),c.length<2?h[0]?rA(h[0].x):nA(n):(n=h.length,function(p){for(var d=0,m;d<n;++d)c[(m=h[d]).i]=m.x(p);return c.join("")})}var Yw=180/Math.PI,ov={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function GE(e,n,r,i,o,l){var u,c,h;return(u=Math.sqrt(e*e+n*n))&&(e/=u,n/=u),(h=e*r+n*i)&&(r-=e*h,i-=n*h),(c=Math.sqrt(r*r+i*i))&&(r/=c,i/=c,h/=c),e*i<n*r&&(e=-e,n=-n,h=-h,u=-u),{translateX:o,translateY:l,rotate:Math.atan2(n,e)*Yw,skewX:Math.atan(h)*Yw,scaleX:u,scaleY:c}}var Ul;function iA(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?ov:GE(n.a,n.b,n.c,n.d,n.e,n.f)}function oA(e){return e==null||(Ul||(Ul=document.createElementNS("http://www.w3.org/2000/svg","g")),Ul.setAttribute("transform",e),!(e=Ul.transform.baseVal.consolidate()))?ov:(e=e.matrix,GE(e.a,e.b,e.c,e.d,e.e,e.f))}function YE(e,n,r,i){function o(p){return p.length?p.pop()+" ":""}function l(p,d,m,y,w,N){if(p!==m||d!==y){var _=w.push("translate(",null,n,null,r);N.push({i:_-4,x:ws(p,m)},{i:_-2,x:ws(d,y)})}else(m||y)&&w.push("translate("+m+n+y+r)}function u(p,d,m,y){p!==d?(p-d>180?d+=360:d-p>180&&(p+=360),y.push({i:m.push(o(m)+"rotate(",null,i)-2,x:ws(p,d)})):d&&m.push(o(m)+"rotate("+d+i)}function c(p,d,m,y){p!==d?y.push({i:m.push(o(m)+"skewX(",null,i)-2,x:ws(p,d)}):d&&m.push(o(m)+"skewX("+d+i)}function h(p,d,m,y,w,N){if(p!==m||d!==y){var _=w.push(o(w)+"scale(",null,",",null,")");N.push({i:_-4,x:ws(p,m)},{i:_-2,x:ws(d,y)})}else(m!==1||y!==1)&&w.push(o(w)+"scale("+m+","+y+")")}return function(p,d){var m=[],y=[];return p=e(p),d=e(d),l(p.translateX,p.translateY,d.translateX,d.translateY,m,y),u(p.rotate,d.rotate,m,y),c(p.skewX,d.skewX,m,y),h(p.scaleX,p.scaleY,d.scaleX,d.scaleY,m,y),p=d=null,function(w){for(var N=-1,_=y.length,S;++N<_;)m[(S=y[N]).i]=S.x(w);return m.join("")}}}var aA=YE(iA,"px, ","px)","deg)"),lA=YE(oA,", ",")",")"),uA=1e-12;function Kw(e){return((e=Math.exp(e))+1/e)/2}function cA(e){return((e=Math.exp(e))-1/e)/2}function dA(e){return((e=Math.exp(2*e))-1)/(e+1)}const fA=(function e(n,r,i){function o(l,u){var c=l[0],h=l[1],p=l[2],d=u[0],m=u[1],y=u[2],w=d-c,N=m-h,_=w*w+N*N,S,b;if(_<uA)b=Math.log(y/p)/n,S=function(L){return[c+L*w,h+L*N,p*Math.exp(n*L*b)]};else{var k=Math.sqrt(_),E=(y*y-p*p+i*_)/(2*p*r*k),C=(y*y-p*p-i*_)/(2*y*r*k),A=Math.log(Math.sqrt(E*E+1)-E),M=Math.log(Math.sqrt(C*C+1)-C);b=(M-A)/n,S=function(L){var H=L*b,O=Kw(A),P=p/(r*k)*(O*dA(n*H+A)-cA(A));return[c+P*w,h+P*N,p*O/Kw(n*H+A)]}}return S.duration=b*1e3*n/Math.SQRT2,S}return o.rho=function(l){var u=Math.max(.001,+l),c=u*u,h=c*c;return e(u,c,h)},o})(Math.SQRT2,2,4);var fo=0,ma=0,ua=0,KE=1e3,du,ga,fu=0,oi=0,Su=0,Ea=typeof performance=="object"&&performance.now?performance:Date,XE=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Iv(){return oi||(XE(hA),oi=Ea.now()+Su)}function hA(){oi=0}function hu(){this._call=this._time=this._next=null}hu.prototype=QE.prototype={constructor:hu,restart:function(e,n,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?Iv():+r)+(n==null?0:+n),!this._next&&ga!==this&&(ga?ga._next=this:du=this,ga=this),this._call=e,this._time=r,av()},stop:function(){this._call&&(this._call=null,this._time=1/0,av())}};function QE(e,n,r){var i=new hu;return i.restart(e,n,r),i}function pA(){Iv(),++fo;for(var e=du,n;e;)(n=oi-e._time)>=0&&e._call.call(void 0,n),e=e._next;--fo}function Xw(){oi=(fu=Ea.now())+Su,fo=ma=0;try{pA()}finally{fo=0,gA(),oi=0}}function mA(){var e=Ea.now(),n=e-fu;n>KE&&(Su-=n,fu=e)}function gA(){for(var e,n=du,r,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(r=n._next,n._next=null,n=e?e._next=r:du=r);ga=e,av(i)}function av(e){if(!fo){ma&&(ma=clearTimeout(ma));var n=e-oi;n>24?(e<1/0&&(ma=setTimeout(Xw,e-Ea.now()-Su)),ua&&(ua=clearInterval(ua))):(ua||(fu=Ea.now(),ua=setInterval(mA,KE)),fo=1,XE(Xw))}}function Qw(e,n,r){var i=new hu;return n=n==null?0:+n,i.restart(o=>{i.stop(),e(o+n)},n,r),i}var vA=_u("start","end","cancel","interrupt"),yA=[],ZE=0,Zw=1,lv=2,su=3,Jw=4,uv=5,iu=6;function ku(e,n,r,i,o,l){var u=e.__transition;if(!u)e.__transition={};else if(r in u)return;wA(e,r,{name:n,index:i,group:o,on:vA,tween:yA,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:ZE})}function Mv(e,n){var r=er(e,n);if(r.state>ZE)throw new Error("too late; already scheduled");return r}function gr(e,n){var r=er(e,n);if(r.state>su)throw new Error("too late; already running");return r}function er(e,n){var r=e.__transition;if(!r||!(r=r[n]))throw new Error("transition not found");return r}function wA(e,n,r){var i=e.__transition,o;i[n]=r,r.timer=QE(l,0,r.time);function l(p){r.state=Zw,r.timer.restart(u,r.delay,r.time),r.delay<=p&&u(p-r.delay)}function u(p){var d,m,y,w;if(r.state!==Zw)return h();for(d in i)if(w=i[d],w.name===r.name){if(w.state===su)return Qw(u);w.state===Jw?(w.state=iu,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete i[d]):+d<n&&(w.state=iu,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete i[d])}if(Qw(function(){r.state===su&&(r.state=Jw,r.timer.restart(c,r.delay,r.time),c(p))}),r.state=lv,r.on.call("start",e,e.__data__,r.index,r.group),r.state===lv){for(r.state=su,o=new Array(y=r.tween.length),d=0,m=-1;d<y;++d)(w=r.tween[d].value.call(e,e.__data__,r.index,r.group))&&(o[++m]=w);o.length=m+1}}function c(p){for(var d=p<r.duration?r.ease.call(null,p/r.duration):(r.timer.restart(h),r.state=uv,1),m=-1,y=o.length;++m<y;)o[m].call(e,d);r.state===uv&&(r.on.call("end",e,e.__data__,r.index,r.group),h())}function h(){r.state=iu,r.timer.stop(),delete i[n];for(var p in i)return;delete e.__transition}}function ou(e,n){var r=e.__transition,i,o,l=!0,u;if(r){n=n==null?null:n+"";for(u in r){if((i=r[u]).name!==n){l=!1;continue}o=i.state>lv&&i.state<uv,i.state=iu,i.timer.stop(),i.on.call(o?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete r[u]}l&&delete e.__transition}}function xA(e){return this.each(function(){ou(this,e)})}function _A(e,n){var r,i;return function(){var o=gr(this,e),l=o.tween;if(l!==r){i=r=l;for(var u=0,c=i.length;u<c;++u)if(i[u].name===n){i=i.slice(),i.splice(u,1);break}}o.tween=i}}function bA(e,n,r){var i,o;if(typeof r!="function")throw new Error;return function(){var l=gr(this,e),u=l.tween;if(u!==i){o=(i=u).slice();for(var c={name:n,value:r},h=0,p=o.length;h<p;++h)if(o[h].name===n){o[h]=c;break}h===p&&o.push(c)}l.tween=o}}function SA(e,n){var r=this._id;if(e+="",arguments.length<2){for(var i=er(this.node(),r).tween,o=0,l=i.length,u;o<l;++o)if((u=i[o]).name===e)return u.value;return null}return this.each((n==null?_A:bA)(r,e,n))}function Pv(e,n,r){var i=e._id;return e.each(function(){var o=gr(this,i);(o.value||(o.value={}))[n]=r.apply(this,arguments)}),function(o){return er(o,i).value[n]}}function JE(e,n){var r;return(typeof n=="number"?ws:n instanceof ka?Gw:(r=ka(n))?(n=r,Gw):sA)(e,n)}function kA(e){return function(){this.removeAttribute(e)}}function EA(e){return function(){this.removeAttributeNS(e.space,e.local)}}function NA(e,n,r){var i,o=r+"",l;return function(){var u=this.getAttribute(e);return u===o?null:u===i?l:l=n(i=u,r)}}function CA(e,n,r){var i,o=r+"",l;return function(){var u=this.getAttributeNS(e.space,e.local);return u===o?null:u===i?l:l=n(i=u,r)}}function jA(e,n,r){var i,o,l;return function(){var u,c=r(this),h;return c==null?void this.removeAttribute(e):(u=this.getAttribute(e),h=c+"",u===h?null:u===i&&h===o?l:(o=h,l=n(i=u,c)))}}function RA(e,n,r){var i,o,l;return function(){var u,c=r(this),h;return c==null?void this.removeAttributeNS(e.space,e.local):(u=this.getAttributeNS(e.space,e.local),h=c+"",u===h?null:u===i&&h===o?l:(o=h,l=n(i=u,c)))}}function TA(e,n){var r=bu(e),i=r==="transform"?lA:JE;return this.attrTween(e,typeof n=="function"?(r.local?RA:jA)(r,i,Pv(this,"attr."+e,n)):n==null?(r.local?EA:kA)(r):(r.local?CA:NA)(r,i,n))}function AA(e,n){return function(r){this.setAttribute(e,n.call(this,r))}}function IA(e,n){return function(r){this.setAttributeNS(e.space,e.local,n.call(this,r))}}function MA(e,n){var r,i;function o(){var l=n.apply(this,arguments);return l!==i&&(r=(i=l)&&IA(e,l)),r}return o._value=n,o}function PA(e,n){var r,i;function o(){var l=n.apply(this,arguments);return l!==i&&(r=(i=l)&&AA(e,l)),r}return o._value=n,o}function OA(e,n){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(n==null)return this.tween(r,null);if(typeof n!="function")throw new Error;var i=bu(e);return this.tween(r,(i.local?MA:PA)(i,n))}function LA(e,n){return function(){Mv(this,e).delay=+n.apply(this,arguments)}}function qA(e,n){return n=+n,function(){Mv(this,e).delay=n}}function $A(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?LA:qA)(n,e)):er(this.node(),n).delay}function DA(e,n){return function(){gr(this,e).duration=+n.apply(this,arguments)}}function FA(e,n){return n=+n,function(){gr(this,e).duration=n}}function zA(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?DA:FA)(n,e)):er(this.node(),n).duration}function BA(e,n){if(typeof n!="function")throw new Error;return function(){gr(this,e).ease=n}}function UA(e){var n=this._id;return arguments.length?this.each(BA(n,e)):er(this.node(),n).ease}function HA(e,n){return function(){var r=n.apply(this,arguments);if(typeof r!="function")throw new Error;gr(this,e).ease=r}}function WA(e){if(typeof e!="function")throw new Error;return this.each(HA(this._id,e))}function VA(e){typeof e!="function"&&(e=AE(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o)for(var l=n[o],u=l.length,c=i[o]=[],h,p=0;p<u;++p)(h=l[p])&&e.call(h,h.__data__,p,l)&&c.push(h);return new Ur(i,this._parents,this._name,this._id)}function GA(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,r=e._groups,i=n.length,o=r.length,l=Math.min(i,o),u=new Array(i),c=0;c<l;++c)for(var h=n[c],p=r[c],d=h.length,m=u[c]=new Array(d),y,w=0;w<d;++w)(y=h[w]||p[w])&&(m[w]=y);for(;c<i;++c)u[c]=n[c];return new Ur(u,this._parents,this._name,this._id)}function YA(e){return(e+"").trim().split(/^|\s+/).every(function(n){var r=n.indexOf(".");return r>=0&&(n=n.slice(0,r)),!n||n==="start"})}function KA(e,n,r){var i,o,l=YA(n)?Mv:gr;return function(){var u=l(this,e),c=u.on;c!==i&&(o=(i=c).copy()).on(n,r),u.on=o}}function XA(e,n){var r=this._id;return arguments.length<2?er(this.node(),r).on.on(e):this.each(KA(r,e,n))}function QA(e){return function(){var n=this.parentNode;for(var r in this.__transition)if(+r!==e)return;n&&n.removeChild(this)}}function ZA(){return this.on("end.remove",QA(this._id))}function JA(e){var n=this._name,r=this._id;typeof e!="function"&&(e=Rv(e));for(var i=this._groups,o=i.length,l=new Array(o),u=0;u<o;++u)for(var c=i[u],h=c.length,p=l[u]=new Array(h),d,m,y=0;y<h;++y)(d=c[y])&&(m=e.call(d,d.__data__,y,c))&&("__data__"in d&&(m.__data__=d.__data__),p[y]=m,ku(p[y],n,r,y,p,er(d,r)));return new Ur(l,this._parents,n,r)}function eI(e){var n=this._name,r=this._id;typeof e!="function"&&(e=TE(e));for(var i=this._groups,o=i.length,l=[],u=[],c=0;c<o;++c)for(var h=i[c],p=h.length,d,m=0;m<p;++m)if(d=h[m]){for(var y=e.call(d,d.__data__,m,h),w,N=er(d,r),_=0,S=y.length;_<S;++_)(w=y[_])&&ku(w,n,r,_,y,N);l.push(y),u.push(d)}return new Ur(l,u,n,r)}var tI=Ia.prototype.constructor;function nI(){return new tI(this._groups,this._parents)}function rI(e,n){var r,i,o;return function(){var l=co(this,e),u=(this.style.removeProperty(e),co(this,e));return l===u?null:l===r&&u===i?o:o=n(r=l,i=u)}}function eN(e){return function(){this.style.removeProperty(e)}}function sI(e,n,r){var i,o=r+"",l;return function(){var u=co(this,e);return u===o?null:u===i?l:l=n(i=u,r)}}function iI(e,n,r){var i,o,l;return function(){var u=co(this,e),c=r(this),h=c+"";return c==null&&(h=c=(this.style.removeProperty(e),co(this,e))),u===h?null:u===i&&h===o?l:(o=h,l=n(i=u,c))}}function oI(e,n){var r,i,o,l="style."+n,u="end."+l,c;return function(){var h=gr(this,e),p=h.on,d=h.value[l]==null?c||(c=eN(n)):void 0;(p!==r||o!==d)&&(i=(r=p).copy()).on(u,o=d),h.on=i}}function aI(e,n,r){var i=(e+="")=="transform"?aA:JE;return n==null?this.styleTween(e,rI(e,i)).on("end.style."+e,eN(e)):typeof n=="function"?this.styleTween(e,iI(e,i,Pv(this,"style."+e,n))).each(oI(this._id,e)):this.styleTween(e,sI(e,i,n),r).on("end.style."+e,null)}function lI(e,n,r){return function(i){this.style.setProperty(e,n.call(this,i),r)}}function uI(e,n,r){var i,o;function l(){var u=n.apply(this,arguments);return u!==o&&(i=(o=u)&&lI(e,u,r)),i}return l._value=n,l}function cI(e,n,r){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,uI(e,n,r??""))}function dI(e){return function(){this.textContent=e}}function fI(e){return function(){var n=e(this);this.textContent=n??""}}function hI(e){return this.tween("text",typeof e=="function"?fI(Pv(this,"text",e)):dI(e==null?"":e+""))}function pI(e){return function(n){this.textContent=e.call(this,n)}}function mI(e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&pI(o)),n}return i._value=e,i}function gI(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,mI(e))}function vI(){for(var e=this._name,n=this._id,r=tN(),i=this._groups,o=i.length,l=0;l<o;++l)for(var u=i[l],c=u.length,h,p=0;p<c;++p)if(h=u[p]){var d=er(h,n);ku(h,e,r,p,u,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Ur(i,this._parents,e,r)}function yI(){var e,n,r=this,i=r._id,o=r.size();return new Promise(function(l,u){var c={value:u},h={value:function(){--o===0&&l()}};r.each(function(){var p=gr(this,i),d=p.on;d!==e&&(n=(e=d).copy(),n._.cancel.push(c),n._.interrupt.push(c),n._.end.push(h)),p.on=n}),o===0&&l()})}var wI=0;function Ur(e,n,r,i){this._groups=e,this._parents=n,this._name=r,this._id=i}function tN(){return++wI}var Fr=Ia.prototype;Ur.prototype={constructor:Ur,select:JA,selectAll:eI,selectChild:Fr.selectChild,selectChildren:Fr.selectChildren,filter:VA,merge:GA,selection:nI,transition:vI,call:Fr.call,nodes:Fr.nodes,node:Fr.node,size:Fr.size,empty:Fr.empty,each:Fr.each,on:XA,attr:TA,attrTween:OA,style:aI,styleTween:cI,text:hI,textTween:gI,remove:ZA,tween:SA,delay:$A,duration:zA,ease:UA,easeVarying:WA,end:yI,[Symbol.iterator]:Fr[Symbol.iterator]};function xI(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var _I={time:null,delay:0,duration:250,ease:xI};function bI(e,n){for(var r;!(r=e.__transition)||!(r=r[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return r}function SI(e){var n,r;e instanceof Ur?(n=e._id,e=e._name):(n=tN(),(r=_I).time=Iv(),e=e==null?null:e+"");for(var i=this._groups,o=i.length,l=0;l<o;++l)for(var u=i[l],c=u.length,h,p=0;p<c;++p)(h=u[p])&&ku(h,e,n,p,u,r||bI(h,n));return new Ur(i,this._parents,e,n)}Ia.prototype.interrupt=xA;Ia.prototype.transition=SI;const Hl=e=>()=>e;function kI(e,{sourceEvent:n,target:r,transform:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function zr(e,n,r){this.k=e,this.x=n,this.y=r}zr.prototype={constructor:zr,scale:function(e){return e===1?this:new zr(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new zr(this.k,this.x+this.k*e,this.y+this.k*n)},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 Br=new zr(1,0,0);zr.prototype;function jd(e){e.stopImmediatePropagation()}function ca(e){e.preventDefault(),e.stopImmediatePropagation()}function EI(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function NI(){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 ex(){return this.__zoom||Br}function CI(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function jI(){return navigator.maxTouchPoints||"ontouchstart"in this}function RI(e,n,r){var i=e.invertX(n[0][0])-r[0][0],o=e.invertX(n[1][0])-r[1][0],l=e.invertY(n[0][1])-r[0][1],u=e.invertY(n[1][1])-r[1][1];return e.translate(o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o),u>l?(l+u)/2:Math.min(0,l)||Math.max(0,u))}function nN(){var e=EI,n=NI,r=RI,i=CI,o=jI,l=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],c=250,h=fA,p=_u("start","zoom","end"),d,m,y,w=500,N=150,_=0,S=10;function b(R){R.property("__zoom",ex).on("wheel.zoom",H,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",P).filter(o).on("touchstart.zoom",F).on("touchmove.zoom",G).on("touchend.zoom touchcancel.zoom",q).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(R,Q,z,ne){var Z=R.selection?R.selection():R;Z.property("__zoom",ex),R!==Z?A(R,Q,z,ne):Z.interrupt().each(function(){M(this,arguments).event(ne).start().zoom(null,typeof Q=="function"?Q.apply(this,arguments):Q).end()})},b.scaleBy=function(R,Q,z,ne){b.scaleTo(R,function(){var Z=this.__zoom.k,$=typeof Q=="function"?Q.apply(this,arguments):Q;return Z*$},z,ne)},b.scaleTo=function(R,Q,z,ne){b.transform(R,function(){var Z=n.apply(this,arguments),$=this.__zoom,X=z==null?C(Z):typeof z=="function"?z.apply(this,arguments):z,I=$.invert(X),W=typeof Q=="function"?Q.apply(this,arguments):Q;return r(E(k($,W),X,I),Z,u)},z,ne)},b.translateBy=function(R,Q,z,ne){b.transform(R,function(){return r(this.__zoom.translate(typeof Q=="function"?Q.apply(this,arguments):Q,typeof z=="function"?z.apply(this,arguments):z),n.apply(this,arguments),u)},null,ne)},b.translateTo=function(R,Q,z,ne,Z){b.transform(R,function(){var $=n.apply(this,arguments),X=this.__zoom,I=ne==null?C($):typeof ne=="function"?ne.apply(this,arguments):ne;return r(Br.translate(I[0],I[1]).scale(X.k).translate(typeof Q=="function"?-Q.apply(this,arguments):-Q,typeof z=="function"?-z.apply(this,arguments):-z),$,u)},ne,Z)};function k(R,Q){return Q=Math.max(l[0],Math.min(l[1],Q)),Q===R.k?R:new zr(Q,R.x,R.y)}function E(R,Q,z){var ne=Q[0]-z[0]*R.k,Z=Q[1]-z[1]*R.k;return ne===R.x&&Z===R.y?R:new zr(R.k,ne,Z)}function C(R){return[(+R[0][0]+ +R[1][0])/2,(+R[0][1]+ +R[1][1])/2]}function A(R,Q,z,ne){R.on("start.zoom",function(){M(this,arguments).event(ne).start()}).on("interrupt.zoom end.zoom",function(){M(this,arguments).event(ne).end()}).tween("zoom",function(){var Z=this,$=arguments,X=M(Z,$).event(ne),I=n.apply(Z,$),W=z==null?C(I):typeof z=="function"?z.apply(Z,$):z,Y=Math.max(I[1][0]-I[0][0],I[1][1]-I[0][1]),U=Z.__zoom,J=typeof Q=="function"?Q.apply(Z,$):Q,re=h(U.invert(W).concat(Y/U.k),J.invert(W).concat(Y/J.k));return function(le){if(le===1)le=J;else{var fe=re(le),te=Y/fe[2];le=new zr(te,W[0]-fe[0]*te,W[1]-fe[1]*te)}X.zoom(null,le)}})}function M(R,Q,z){return!z&&R.__zooming||new L(R,Q)}function L(R,Q){this.that=R,this.args=Q,this.active=0,this.sourceEvent=null,this.extent=n.apply(R,Q),this.taps=0}L.prototype={event:function(R){return R&&(this.sourceEvent=R),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(R,Q){return this.mouse&&R!=="mouse"&&(this.mouse[1]=Q.invert(this.mouse[0])),this.touch0&&R!=="touch"&&(this.touch0[1]=Q.invert(this.touch0[0])),this.touch1&&R!=="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(R){var Q=Pn(this.that).datum();p.call(R,this.that,new kI(R,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:p}),Q)}};function H(R,...Q){if(!e.apply(this,arguments))return;var z=M(this,Q).event(R),ne=this.__zoom,Z=Math.max(l[0],Math.min(l[1],ne.k*Math.pow(2,i.apply(this,arguments)))),$=Xn(R);if(z.wheel)(z.mouse[0][0]!==$[0]||z.mouse[0][1]!==$[1])&&(z.mouse[1]=ne.invert(z.mouse[0]=$)),clearTimeout(z.wheel);else{if(ne.k===Z)return;z.mouse=[$,ne.invert($)],ou(this),z.start()}ca(R),z.wheel=setTimeout(X,N),z.zoom("mouse",r(E(k(ne,Z),z.mouse[0],z.mouse[1]),z.extent,u));function X(){z.wheel=null,z.end()}}function O(R,...Q){if(y||!e.apply(this,arguments))return;var z=R.currentTarget,ne=M(this,Q,!0).event(R),Z=Pn(R.view).on("mousemove.zoom",W,!0).on("mouseup.zoom",Y,!0),$=Xn(R,z),X=R.clientX,I=R.clientY;zE(R.view),jd(R),ne.mouse=[$,this.__zoom.invert($)],ou(this),ne.start();function W(U){if(ca(U),!ne.moved){var J=U.clientX-X,re=U.clientY-I;ne.moved=J*J+re*re>_}ne.event(U).zoom("mouse",r(E(ne.that.__zoom,ne.mouse[0]=Xn(U,z),ne.mouse[1]),ne.extent,u))}function Y(U){Z.on("mousemove.zoom mouseup.zoom",null),BE(U.view,ne.moved),ca(U),ne.event(U).end()}}function P(R,...Q){if(e.apply(this,arguments)){var z=this.__zoom,ne=Xn(R.changedTouches?R.changedTouches[0]:R,this),Z=z.invert(ne),$=z.k*(R.shiftKey?.5:2),X=r(E(k(z,$),ne,Z),n.apply(this,Q),u);ca(R),c>0?Pn(this).transition().duration(c).call(A,X,ne,R):Pn(this).call(b.transform,X,ne,R)}}function F(R,...Q){if(e.apply(this,arguments)){var z=R.touches,ne=z.length,Z=M(this,Q,R.changedTouches.length===ne).event(R),$,X,I,W;for(jd(R),X=0;X<ne;++X)I=z[X],W=Xn(I,this),W=[W,this.__zoom.invert(W),I.identifier],Z.touch0?!Z.touch1&&Z.touch0[2]!==W[2]&&(Z.touch1=W,Z.taps=0):(Z.touch0=W,$=!0,Z.taps=1+!!d);d&&(d=clearTimeout(d)),$&&(Z.taps<2&&(m=W[0],d=setTimeout(function(){d=null},w)),ou(this),Z.start())}}function G(R,...Q){if(this.__zooming){var z=M(this,Q).event(R),ne=R.changedTouches,Z=ne.length,$,X,I,W;for(ca(R),$=0;$<Z;++$)X=ne[$],I=Xn(X,this),z.touch0&&z.touch0[2]===X.identifier?z.touch0[0]=I:z.touch1&&z.touch1[2]===X.identifier&&(z.touch1[0]=I);if(X=z.that.__zoom,z.touch1){var Y=z.touch0[0],U=z.touch0[1],J=z.touch1[0],re=z.touch1[1],le=(le=J[0]-Y[0])*le+(le=J[1]-Y[1])*le,fe=(fe=re[0]-U[0])*fe+(fe=re[1]-U[1])*fe;X=k(X,Math.sqrt(le/fe)),I=[(Y[0]+J[0])/2,(Y[1]+J[1])/2],W=[(U[0]+re[0])/2,(U[1]+re[1])/2]}else if(z.touch0)I=z.touch0[0],W=z.touch0[1];else return;z.zoom("touch",r(E(X,I,W),z.extent,u))}}function q(R,...Q){if(this.__zooming){var z=M(this,Q).event(R),ne=R.changedTouches,Z=ne.length,$,X;for(jd(R),y&&clearTimeout(y),y=setTimeout(function(){y=null},w),$=0;$<Z;++$)X=ne[$],z.touch0&&z.touch0[2]===X.identifier?delete z.touch0:z.touch1&&z.touch1[2]===X.identifier&&delete z.touch1;if(z.touch1&&!z.touch0&&(z.touch0=z.touch1,delete z.touch1),z.touch0)z.touch0[1]=this.__zoom.invert(z.touch0[0]);else if(z.end(),z.taps===2&&(X=Xn(X,this),Math.hypot(m[0]-X[0],m[1]-X[1])<S)){var I=Pn(this).on("dblclick.zoom");I&&I.apply(this,arguments)}}}return b.wheelDelta=function(R){return arguments.length?(i=typeof R=="function"?R:Hl(+R),b):i},b.filter=function(R){return arguments.length?(e=typeof R=="function"?R:Hl(!!R),b):e},b.touchable=function(R){return arguments.length?(o=typeof R=="function"?R:Hl(!!R),b):o},b.extent=function(R){return arguments.length?(n=typeof R=="function"?R:Hl([[+R[0][0],+R[0][1]],[+R[1][0],+R[1][1]]]),b):n},b.scaleExtent=function(R){return arguments.length?(l[0]=+R[0],l[1]=+R[1],b):[l[0],l[1]]},b.translateExtent=function(R){return arguments.length?(u[0][0]=+R[0][0],u[1][0]=+R[1][0],u[0][1]=+R[0][1],u[1][1]=+R[1][1],b):[[u[0][0],u[0][1]],[u[1][0],u[1][1]]]},b.constrain=function(R){return arguments.length?(r=R,b):r},b.duration=function(R){return arguments.length?(c=+R,b):c},b.interpolate=function(R){return arguments.length?(h=R,b):h},b.on=function(){var R=p.on.apply(p,arguments);return R===p?b:R},b.clickDistance=function(R){return arguments.length?(_=(R=+R)*R,b):Math.sqrt(_)},b.tapDistance=function(R){return arguments.length?(S=+R,b):S},b}var TI=CE();const Eu=T.createContext(null),AI=Eu.Provider,Hr={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,n)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?n.targetHandle:n.sourceHandle}", edge id: ${n.id}.`,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.`},rN=Hr.error001();function Ke(e,n){const r=T.useContext(Eu);if(r===null)throw new Error(rN);return jE(r,e,n)}const Ct=()=>{const e=T.useContext(Eu);if(e===null)throw new Error(rN);return T.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},II=e=>e.userSelectionActive?"none":"all";function Ov({position:e,children:n,className:r,style:i,...o}){const l=Ke(II),u=`${e}`.split("-");return ue.createElement("div",{className:Bt(["react-flow__panel",r,...u]),style:{...i,pointerEvents:l},...o},n)}function MI({proOptions:e,position:n="bottom-right"}){return e!=null&&e.hideAttribution?null:ue.createElement(Ov,{position:n,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},ue.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const PI=({x:e,y:n,label:r,labelStyle:i={},labelShowBg:o=!0,labelBgStyle:l={},labelBgPadding:u=[2,4],labelBgBorderRadius:c=2,children:h,className:p,...d})=>{const m=T.useRef(null),[y,w]=T.useState({x:0,y:0,width:0,height:0}),N=Bt(["react-flow__edge-textwrapper",p]);return T.useEffect(()=>{if(m.current){const _=m.current.getBBox();w({x:_.x,y:_.y,width:_.width,height:_.height})}},[r]),typeof r>"u"||!r?null:ue.createElement("g",{transform:`translate(${e-y.width/2} ${n-y.height/2})`,className:N,visibility:y.width?"visible":"hidden",...d},o&&ue.createElement("rect",{width:y.width+2*u[0],x:-u[0],y:-u[1],height:y.height+2*u[1],className:"react-flow__edge-textbg",style:l,rx:c,ry:c}),ue.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:m,style:i},r),h)};var OI=T.memo(PI);const Lv=e=>({width:e.offsetWidth,height:e.offsetHeight}),ho=(e,n=0,r=1)=>Math.min(Math.max(e,n),r),qv=(e={x:0,y:0},n)=>({x:ho(e.x,n[0][0],n[1][0]),y:ho(e.y,n[0][1],n[1][1])}),tx=(e,n,r)=>e<n?ho(Math.abs(e-n),1,50)/50:e>r?-ho(Math.abs(e-r),1,50)/50:0,sN=(e,n)=>{const r=tx(e.x,35,n.width-35)*20,i=tx(e.y,35,n.height-35)*20;return[r,i]},iN=e=>{var n;return((n=e.getRootNode)==null?void 0:n.call(e))||(window==null?void 0:window.document)},oN=(e,n)=>({x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}),Na=({x:e,y:n,width:r,height:i})=>({x:e,y:n,x2:e+r,y2:n+i}),aN=({x:e,y:n,x2:r,y2:i})=>({x:e,y:n,width:r-e,height:i-n}),nx=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),LI=(e,n)=>aN(oN(Na(e),Na(n))),cv=(e,n)=>{const r=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),i=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(r*i)},qI=e=>On(e.width)&&On(e.height)&&On(e.x)&&On(e.y),On=e=>!isNaN(e)&&isFinite(e),dt=Symbol.for("internals"),lN=["Enter"," ","Escape"],$I=(e,n)=>{},DI=e=>"nativeEvent"in e;function dv(e){var o,l;const n=DI(e)?e.nativeEvent:e,r=((l=(o=n.composedPath)==null?void 0:o.call(n))==null?void 0:l[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(r==null?void 0:r.nodeName)||(r==null?void 0:r.hasAttribute("contenteditable"))||!!(r!=null&&r.closest(".nokey"))}const uN=e=>"clientX"in e,bs=(e,n)=>{var l,u;const r=uN(e),i=r?e.clientX:(l=e.touches)==null?void 0:l[0].clientX,o=r?e.clientY:(u=e.touches)==null?void 0:u[0].clientY;return{x:i-((n==null?void 0:n.left)??0),y:o-((n==null?void 0:n.top)??0)}},pu=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Pa=({id:e,path:n,labelX:r,labelY:i,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,markerEnd:m,markerStart:y,interactionWidth:w=20})=>ue.createElement(ue.Fragment,null,ue.createElement("path",{id:e,style:d,d:n,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:y}),w&&ue.createElement("path",{d:n,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),o&&On(r)&&On(i)?ue.createElement(OI,{x:r,y:i,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p}):null);Pa.displayName="BaseEdge";function da(e,n,r){return r===void 0?r:i=>{const o=n().edges.find(l=>l.id===e);o&&r(i,{...o})}}function cN({sourceX:e,sourceY:n,targetX:r,targetY:i}){const o=Math.abs(r-e)/2,l=r<e?r+o:r-o,u=Math.abs(i-n)/2,c=i<n?i+u:i-u;return[l,c,o,u]}function dN({sourceX:e,sourceY:n,targetX:r,targetY:i,sourceControlX:o,sourceControlY:l,targetControlX:u,targetControlY:c}){const h=e*.125+o*.375+u*.375+r*.125,p=n*.125+l*.375+c*.375+i*.125,d=Math.abs(h-e),m=Math.abs(p-n);return[h,p,d,m]}var ai;(function(e){e.Strict="strict",e.Loose="loose"})(ai||(ai={}));var ri;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ri||(ri={}));var Ca;(function(e){e.Partial="partial",e.Full="full"})(Ca||(Ca={}));var _s;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(_s||(_s={}));var mu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(mu||(mu={}));var Ae;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ae||(Ae={}));function rx({pos:e,x1:n,y1:r,x2:i,y2:o}){return e===Ae.Left||e===Ae.Right?[.5*(n+i),r]:[n,.5*(r+o)]}function fN({sourceX:e,sourceY:n,sourcePosition:r=Ae.Bottom,targetX:i,targetY:o,targetPosition:l=Ae.Top}){const[u,c]=rx({pos:r,x1:e,y1:n,x2:i,y2:o}),[h,p]=rx({pos:l,x1:i,y1:o,x2:e,y2:n}),[d,m,y,w]=dN({sourceX:e,sourceY:n,targetX:i,targetY:o,sourceControlX:u,sourceControlY:c,targetControlX:h,targetControlY:p});return[`M${e},${n} C${u},${c} ${h},${p} ${i},${o}`,d,m,y,w]}const $v=T.memo(({sourceX:e,sourceY:n,targetX:r,targetY:i,sourcePosition:o=Ae.Bottom,targetPosition:l=Ae.Top,label:u,labelStyle:c,labelShowBg:h,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:_})=>{const[S,b,k]=fN({sourceX:e,sourceY:n,sourcePosition:o,targetX:r,targetY:i,targetPosition:l});return ue.createElement(Pa,{path:S,labelX:b,labelY:k,label:u,labelStyle:c,labelShowBg:h,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:_})});$v.displayName="SimpleBezierEdge";const sx={[Ae.Left]:{x:-1,y:0},[Ae.Right]:{x:1,y:0},[Ae.Top]:{x:0,y:-1},[Ae.Bottom]:{x:0,y:1}},FI=({source:e,sourcePosition:n=Ae.Bottom,target:r})=>n===Ae.Left||n===Ae.Right?e.x<r.x?{x:1,y:0}:{x:-1,y:0}:e.y<r.y?{x:0,y:1}:{x:0,y:-1},ix=(e,n)=>Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2));function zI({source:e,sourcePosition:n=Ae.Bottom,target:r,targetPosition:i=Ae.Top,center:o,offset:l}){const u=sx[n],c=sx[i],h={x:e.x+u.x*l,y:e.y+u.y*l},p={x:r.x+c.x*l,y:r.y+c.y*l},d=FI({source:h,sourcePosition:n,target:p}),m=d.x!==0?"x":"y",y=d[m];let w=[],N,_;const S={x:0,y:0},b={x:0,y:0},[k,E,C,A]=cN({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(u[m]*c[m]===-1){N=o.x??k,_=o.y??E;const L=[{x:N,y:h.y},{x:N,y:p.y}],H=[{x:h.x,y:_},{x:p.x,y:_}];u[m]===y?w=m==="x"?L:H:w=m==="x"?H:L}else{const L=[{x:h.x,y:p.y}],H=[{x:p.x,y:h.y}];if(m==="x"?w=u.x===y?H:L:w=u.y===y?L:H,n===i){const q=Math.abs(e[m]-r[m]);if(q<=l){const R=Math.min(l-1,l-q);u[m]===y?S[m]=(h[m]>e[m]?-1:1)*R:b[m]=(p[m]>r[m]?-1:1)*R}}if(n!==i){const q=m==="x"?"y":"x",R=u[m]===c[q],Q=h[q]>p[q],z=h[q]<p[q];(u[m]===1&&(!R&&Q||R&&z)||u[m]!==1&&(!R&&z||R&&Q))&&(w=m==="x"?L:H)}const O={x:h.x+S.x,y:h.y+S.y},P={x:p.x+b.x,y:p.y+b.y},F=Math.max(Math.abs(O.x-w[0].x),Math.abs(P.x-w[0].x)),G=Math.max(Math.abs(O.y-w[0].y),Math.abs(P.y-w[0].y));F>=G?(N=(O.x+P.x)/2,_=w[0].y):(N=w[0].x,_=(O.y+P.y)/2)}return[[e,{x:h.x+S.x,y:h.y+S.y},...w,{x:p.x+b.x,y:p.y+b.y},r],N,_,C,A]}function BI(e,n,r,i){const o=Math.min(ix(e,n)/2,ix(n,r)/2,i),{x:l,y:u}=n;if(e.x===l&&l===r.x||e.y===u&&u===r.y)return`L${l} ${u}`;if(e.y===u){const p=e.x<r.x?-1:1,d=e.y<r.y?1:-1;return`L ${l+o*p},${u}Q ${l},${u} ${l},${u+o*d}`}const c=e.x<r.x?1:-1,h=e.y<r.y?-1:1;return`L ${l},${u+o*h}Q ${l},${u} ${l+o*c},${u}`}function fv({sourceX:e,sourceY:n,sourcePosition:r=Ae.Bottom,targetX:i,targetY:o,targetPosition:l=Ae.Top,borderRadius:u=5,centerX:c,centerY:h,offset:p=20}){const[d,m,y,w,N]=zI({source:{x:e,y:n},sourcePosition:r,target:{x:i,y:o},targetPosition:l,center:{x:c,y:h},offset:p});return[d.reduce((S,b,k)=>{let E="";return k>0&&k<d.length-1?E=BI(d[k-1],b,d[k+1],u):E=`${k===0?"M":"L"}${b.x} ${b.y}`,S+=E,S},""),m,y,w,N]}const Nu=T.memo(({sourceX:e,sourceY:n,targetX:r,targetY:i,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,sourcePosition:m=Ae.Bottom,targetPosition:y=Ae.Top,markerEnd:w,markerStart:N,pathOptions:_,interactionWidth:S})=>{const[b,k,E]=fv({sourceX:e,sourceY:n,sourcePosition:m,targetX:r,targetY:i,targetPosition:y,borderRadius:_==null?void 0:_.borderRadius,offset:_==null?void 0:_.offset});return ue.createElement(Pa,{path:b,labelX:k,labelY:E,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,markerEnd:w,markerStart:N,interactionWidth:S})});Nu.displayName="SmoothStepEdge";const Dv=T.memo(e=>{var n;return ue.createElement(Nu,{...e,pathOptions:T.useMemo(()=>{var r;return{borderRadius:0,offset:(r=e.pathOptions)==null?void 0:r.offset}},[(n=e.pathOptions)==null?void 0:n.offset])})});Dv.displayName="StepEdge";function UI({sourceX:e,sourceY:n,targetX:r,targetY:i}){const[o,l,u,c]=cN({sourceX:e,sourceY:n,targetX:r,targetY:i});return[`M ${e},${n}L ${r},${i}`,o,l,u,c]}const Fv=T.memo(({sourceX:e,sourceY:n,targetX:r,targetY:i,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,markerEnd:m,markerStart:y,interactionWidth:w})=>{const[N,_,S]=UI({sourceX:e,sourceY:n,targetX:r,targetY:i});return ue.createElement(Pa,{path:N,labelX:_,labelY:S,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,markerEnd:m,markerStart:y,interactionWidth:w})});Fv.displayName="StraightEdge";function Wl(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function ox({pos:e,x1:n,y1:r,x2:i,y2:o,c:l}){switch(e){case Ae.Left:return[n-Wl(n-i,l),r];case Ae.Right:return[n+Wl(i-n,l),r];case Ae.Top:return[n,r-Wl(r-o,l)];case Ae.Bottom:return[n,r+Wl(o-r,l)]}}function hN({sourceX:e,sourceY:n,sourcePosition:r=Ae.Bottom,targetX:i,targetY:o,targetPosition:l=Ae.Top,curvature:u=.25}){const[c,h]=ox({pos:r,x1:e,y1:n,x2:i,y2:o,c:u}),[p,d]=ox({pos:l,x1:i,y1:o,x2:e,y2:n,c:u}),[m,y,w,N]=dN({sourceX:e,sourceY:n,targetX:i,targetY:o,sourceControlX:c,sourceControlY:h,targetControlX:p,targetControlY:d});return[`M${e},${n} C${c},${h} ${p},${d} ${i},${o}`,m,y,w,N]}const gu=T.memo(({sourceX:e,sourceY:n,targetX:r,targetY:i,sourcePosition:o=Ae.Bottom,targetPosition:l=Ae.Top,label:u,labelStyle:c,labelShowBg:h,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,pathOptions:_,interactionWidth:S})=>{const[b,k,E]=hN({sourceX:e,sourceY:n,sourcePosition:o,targetX:r,targetY:i,targetPosition:l,curvature:_==null?void 0:_.curvature});return ue.createElement(Pa,{path:b,labelX:k,labelY:E,label:u,labelStyle:c,labelShowBg:h,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:S})});gu.displayName="BezierEdge";const zv=T.createContext(null),HI=zv.Provider;zv.Consumer;const WI=()=>T.useContext(zv),VI=e=>"id"in e&&"source"in e&&"target"in e,GI=({source:e,sourceHandle:n,target:r,targetHandle:i})=>`reactflow__edge-${e}${n||""}-${r}${i||""}`,hv=(e,n)=>typeof e>"u"?"":typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`,YI=(e,n)=>n.some(r=>r.source===e.source&&r.target===e.target&&(r.sourceHandle===e.sourceHandle||!r.sourceHandle&&!e.sourceHandle)&&(r.targetHandle===e.targetHandle||!r.targetHandle&&!e.targetHandle)),KI=(e,n)=>{if(!e.source||!e.target)return n;let r;return VI(e)?r={...e}:r={...e,id:GI(e)},YI(r,n)?n:n.concat(r)},pv=({x:e,y:n},[r,i,o],l,[u,c])=>{const h={x:(e-r)/o,y:(n-i)/o};return l?{x:u*Math.round(h.x/u),y:c*Math.round(h.y/c)}:h},pN=({x:e,y:n},[r,i,o])=>({x:e*o+r,y:n*o+i}),ii=(e,n=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const r=(e.width??0)*n[0],i=(e.height??0)*n[1],o={x:e.position.x-r,y:e.position.y-i};return{...o,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-r,y:e.positionAbsolute.y-i}:o}},Cu=(e,n=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const r=e.reduce((i,o)=>{const{x:l,y:u}=ii(o,n).positionAbsolute;return oN(i,Na({x:l,y:u,width:o.width||0,height:o.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return aN(r)},mN=(e,n,[r,i,o]=[0,0,1],l=!1,u=!1,c=[0,0])=>{const h={x:(n.x-r)/o,y:(n.y-i)/o,width:n.width/o,height:n.height/o},p=[];return e.forEach(d=>{const{width:m,height:y,selectable:w=!0,hidden:N=!1}=d;if(u&&!w||N)return!1;const{positionAbsolute:_}=ii(d,c),S={x:_.x,y:_.y,width:m||0,height:y||0},b=cv(h,S),k=typeof m>"u"||typeof y>"u"||m===null||y===null,E=l&&b>0,C=(m||0)*(y||0);(k||E||b>=C||d.dragging)&&p.push(d)}),p},gN=(e,n)=>{const r=e.map(i=>i.id);return n.filter(i=>r.includes(i.source)||r.includes(i.target))},vN=(e,n,r,i,o,l=.1)=>{const u=n/(e.width*(1+l)),c=r/(e.height*(1+l)),h=Math.min(u,c),p=ho(h,i,o),d=e.x+e.width/2,m=e.y+e.height/2,y=n/2-d*p,w=r/2-m*p;return{x:y,y:w,zoom:p}},ti=(e,n=0)=>e.transition().duration(n);function ax(e,n,r,i){return(n[r]||[]).reduce((o,l)=>{var u,c;return`${e.id}-${l.id}-${r}`!==i&&o.push({id:l.id||null,type:r,nodeId:e.id,x:(((u=e.positionAbsolute)==null?void 0:u.x)??0)+l.x+l.width/2,y:(((c=e.positionAbsolute)==null?void 0:c.y)??0)+l.y+l.height/2}),o},[])}function XI(e,n,r,i,o,l){const{x:u,y:c}=bs(e),p=n.elementsFromPoint(u,c).find(N=>N.classList.contains("react-flow__handle"));if(p){const N=p.getAttribute("data-nodeid");if(N){const _=Bv(void 0,p),S=p.getAttribute("data-handleid"),b=l({nodeId:N,id:S,type:_});if(b){const k=o.find(E=>E.nodeId===N&&E.type===_&&E.id===S);return{handle:{id:S,type:_,nodeId:N,x:(k==null?void 0:k.x)||r.x,y:(k==null?void 0:k.y)||r.y},validHandleResult:b}}}}let d=[],m=1/0;if(o.forEach(N=>{const _=Math.sqrt((N.x-r.x)**2+(N.y-r.y)**2);if(_<=i){const S=l(N);_<=m&&(_<m?d=[{handle:N,validHandleResult:S}]:_===m&&d.push({handle:N,validHandleResult:S}),m=_)}}),!d.length)return{handle:null,validHandleResult:yN()};if(d.length===1)return d[0];const y=d.some(({validHandleResult:N})=>N.isValid),w=d.some(({handle:N})=>N.type==="target");return d.find(({handle:N,validHandleResult:_})=>w?N.type==="target":y?_.isValid:!0)||d[0]}const QI={source:null,target:null,sourceHandle:null,targetHandle:null},yN=()=>({handleDomNode:null,isValid:!1,connection:QI,endHandle:null});function wN(e,n,r,i,o,l,u){const c=o==="target",h=u.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),p={...yN(),handleDomNode:h};if(h){const d=Bv(void 0,h),m=h.getAttribute("data-nodeid"),y=h.getAttribute("data-handleid"),w=h.classList.contains("connectable"),N=h.classList.contains("connectableend"),_={source:c?m:r,sourceHandle:c?y:i,target:c?r:m,targetHandle:c?i:y};p.connection=_,w&&N&&(n===ai.Strict?c&&d==="source"||!c&&d==="target":m!==r||y!==i)&&(p.endHandle={nodeId:m,handleId:y,type:d},p.isValid=l(_))}return p}function ZI({nodes:e,nodeId:n,handleId:r,handleType:i}){return e.reduce((o,l)=>{if(l[dt]){const{handleBounds:u}=l[dt];let c=[],h=[];u&&(c=ax(l,u,"source",`${n}-${r}-${i}`),h=ax(l,u,"target",`${n}-${r}-${i}`)),o.push(...c,...h)}return o},[])}function Bv(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function Rd(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function JI(e,n){let r=null;return n?r="valid":e&&!n&&(r="invalid"),r}function xN({event:e,handleId:n,nodeId:r,onConnect:i,isTarget:o,getState:l,setState:u,isValidConnection:c,edgeUpdaterType:h,onReconnectEnd:p}){const d=iN(e.target),{connectionMode:m,domNode:y,autoPanOnConnect:w,connectionRadius:N,onConnectStart:_,panBy:S,getNodes:b,cancelConnection:k}=l();let E=0,C;const{x:A,y:M}=bs(e),L=d==null?void 0:d.elementFromPoint(A,M),H=Bv(h,L),O=y==null?void 0:y.getBoundingClientRect();if(!O||!H)return;let P,F=bs(e,O),G=!1,q=null,R=!1,Q=null;const z=ZI({nodes:b(),nodeId:r,handleId:n,handleType:H}),ne=()=>{if(!w)return;const[X,I]=sN(F,O);S({x:X,y:I}),E=requestAnimationFrame(ne)};u({connectionPosition:F,connectionStatus:null,connectionNodeId:r,connectionHandleId:n,connectionHandleType:H,connectionStartHandle:{nodeId:r,handleId:n,type:H},connectionEndHandle:null}),_==null||_(e,{nodeId:r,handleId:n,handleType:H});function Z(X){const{transform:I}=l();F=bs(X,O);const{handle:W,validHandleResult:Y}=XI(X,d,pv(F,I,!1,[1,1]),N,z,U=>wN(U,m,r,n,o?"target":"source",c,d));if(C=W,G||(ne(),G=!0),Q=Y.handleDomNode,q=Y.connection,R=Y.isValid,u({connectionPosition:C&&R?pN({x:C.x,y:C.y},I):F,connectionStatus:JI(!!C,R),connectionEndHandle:Y.endHandle}),!C&&!R&&!Q)return Rd(P);q.source!==q.target&&Q&&(Rd(P),P=Q,Q.classList.add("connecting","react-flow__handle-connecting"),Q.classList.toggle("valid",R),Q.classList.toggle("react-flow__handle-valid",R))}function $(X){var I,W;(C||Q)&&q&&R&&(i==null||i(q)),(W=(I=l()).onConnectEnd)==null||W.call(I,X),h&&(p==null||p(X)),Rd(P),k(),cancelAnimationFrame(E),G=!1,R=!1,q=null,Q=null,d.removeEventListener("mousemove",Z),d.removeEventListener("mouseup",$),d.removeEventListener("touchmove",Z),d.removeEventListener("touchend",$)}d.addEventListener("mousemove",Z),d.addEventListener("mouseup",$),d.addEventListener("touchmove",Z),d.addEventListener("touchend",$)}const lx=()=>!0,eM=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),tM=(e,n,r)=>i=>{const{connectionStartHandle:o,connectionEndHandle:l,connectionClickStartHandle:u}=i;return{connecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.handleId)===n&&(o==null?void 0:o.type)===r||(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===n&&(l==null?void 0:l.type)===r,clickConnecting:(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.handleId)===n&&(u==null?void 0:u.type)===r}},_N=T.forwardRef(({type:e="source",position:n=Ae.Top,isValidConnection:r,isConnectable:i=!0,isConnectableStart:o=!0,isConnectableEnd:l=!0,id:u,onConnect:c,children:h,className:p,onMouseDown:d,onTouchStart:m,...y},w)=>{var O,P;const N=u||null,_=e==="target",S=Ct(),b=WI(),{connectOnClick:k,noPanClassName:E}=Ke(eM,Nt),{connecting:C,clickConnecting:A}=Ke(tM(b,N,e),Nt);b||(P=(O=S.getState()).onError)==null||P.call(O,"010",Hr.error010());const M=F=>{const{defaultEdgeOptions:G,onConnect:q,hasDefaultEdges:R}=S.getState(),Q={...G,...F};if(R){const{edges:z,setEdges:ne}=S.getState();ne(KI(Q,z))}q==null||q(Q),c==null||c(Q)},L=F=>{if(!b)return;const G=uN(F);o&&(G&&F.button===0||!G)&&xN({event:F,handleId:N,nodeId:b,onConnect:M,isTarget:_,getState:S.getState,setState:S.setState,isValidConnection:r||S.getState().isValidConnection||lx}),G?d==null||d(F):m==null||m(F)},H=F=>{const{onClickConnectStart:G,onClickConnectEnd:q,connectionClickStartHandle:R,connectionMode:Q,isValidConnection:z}=S.getState();if(!b||!R&&!o)return;if(!R){G==null||G(F,{nodeId:b,handleId:N,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:b,type:e,handleId:N}});return}const ne=iN(F.target),Z=r||z||lx,{connection:$,isValid:X}=wN({nodeId:b,id:N,type:e},Q,R.nodeId,R.handleId||null,R.type,Z,ne);X&&M($),q==null||q(F),S.setState({connectionClickStartHandle:null})};return ue.createElement("div",{"data-handleid":N,"data-nodeid":b,"data-handlepos":n,"data-id":`${b}-${N}-${e}`,className:Bt(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",E,p,{source:!_,target:_,connectable:i,connectablestart:o,connectableend:l,connecting:A,connectionindicator:i&&(o&&!C||l&&C)}]),onMouseDown:L,onTouchStart:L,onClick:k?H:void 0,ref:w,...y},h)});_N.displayName="Handle";var po=T.memo(_N);const bN=({data:e,isConnectable:n,targetPosition:r=Ae.Top,sourcePosition:i=Ae.Bottom})=>ue.createElement(ue.Fragment,null,ue.createElement(po,{type:"target",position:r,isConnectable:n}),e==null?void 0:e.label,ue.createElement(po,{type:"source",position:i,isConnectable:n}));bN.displayName="DefaultNode";var mv=T.memo(bN);const SN=({data:e,isConnectable:n,sourcePosition:r=Ae.Bottom})=>ue.createElement(ue.Fragment,null,e==null?void 0:e.label,ue.createElement(po,{type:"source",position:r,isConnectable:n}));SN.displayName="InputNode";var kN=T.memo(SN);const EN=({data:e,isConnectable:n,targetPosition:r=Ae.Top})=>ue.createElement(ue.Fragment,null,ue.createElement(po,{type:"target",position:r,isConnectable:n}),e==null?void 0:e.label);EN.displayName="OutputNode";var NN=T.memo(EN);const Uv=()=>null;Uv.displayName="GroupNode";const nM=e=>({selectedNodes:e.getNodes().filter(n=>n.selected),selectedEdges:e.edges.filter(n=>n.selected).map(n=>({...n}))}),Vl=e=>e.id;function rM(e,n){return Nt(e.selectedNodes.map(Vl),n.selectedNodes.map(Vl))&&Nt(e.selectedEdges.map(Vl),n.selectedEdges.map(Vl))}const CN=T.memo(({onSelectionChange:e})=>{const n=Ct(),{selectedNodes:r,selectedEdges:i}=Ke(nM,rM);return T.useEffect(()=>{const o={nodes:r,edges:i};e==null||e(o),n.getState().onSelectionChange.forEach(l=>l(o))},[r,i,e]),null});CN.displayName="SelectionListener";const sM=e=>!!e.onSelectionChange;function iM({onSelectionChange:e}){const n=Ke(sM);return e||n?ue.createElement(CN,{onSelectionChange:e}):null}const oM=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function Qi(e,n){T.useEffect(()=>{typeof e<"u"&&n(e)},[e])}function $e(e,n,r){T.useEffect(()=>{typeof n<"u"&&r({[e]:n})},[n])}const aM=({nodes:e,edges:n,defaultNodes:r,defaultEdges:i,onConnect:o,onConnectStart:l,onConnectEnd:u,onClickConnectStart:c,onClickConnectEnd:h,nodesDraggable:p,nodesConnectable:d,nodesFocusable:m,edgesFocusable:y,edgesUpdatable:w,elevateNodesOnSelect:N,minZoom:_,maxZoom:S,nodeExtent:b,onNodesChange:k,onEdgesChange:E,elementsSelectable:C,connectionMode:A,snapGrid:M,snapToGrid:L,translateExtent:H,connectOnClick:O,defaultEdgeOptions:P,fitView:F,fitViewOptions:G,onNodesDelete:q,onEdgesDelete:R,onNodeDrag:Q,onNodeDragStart:z,onNodeDragStop:ne,onSelectionDrag:Z,onSelectionDragStart:$,onSelectionDragStop:X,noPanClassName:I,nodeOrigin:W,rfId:Y,autoPanOnConnect:U,autoPanOnNodeDrag:J,onError:re,connectionRadius:le,isValidConnection:fe,nodeDragThreshold:te})=>{const{setNodes:ce,setEdges:Ce,setDefaultNodesAndEdges:ve,setMinZoom:Te,setMaxZoom:ye,setTranslateExtent:ke,setNodeExtent:Ge,reset:we}=Ke(oM,Nt),_e=Ct();return T.useEffect(()=>{const ze=i==null?void 0:i.map(ft=>({...ft,...P}));return ve(r,ze),()=>{we()}},[]),$e("defaultEdgeOptions",P,_e.setState),$e("connectionMode",A,_e.setState),$e("onConnect",o,_e.setState),$e("onConnectStart",l,_e.setState),$e("onConnectEnd",u,_e.setState),$e("onClickConnectStart",c,_e.setState),$e("onClickConnectEnd",h,_e.setState),$e("nodesDraggable",p,_e.setState),$e("nodesConnectable",d,_e.setState),$e("nodesFocusable",m,_e.setState),$e("edgesFocusable",y,_e.setState),$e("edgesUpdatable",w,_e.setState),$e("elementsSelectable",C,_e.setState),$e("elevateNodesOnSelect",N,_e.setState),$e("snapToGrid",L,_e.setState),$e("snapGrid",M,_e.setState),$e("onNodesChange",k,_e.setState),$e("onEdgesChange",E,_e.setState),$e("connectOnClick",O,_e.setState),$e("fitViewOnInit",F,_e.setState),$e("fitViewOnInitOptions",G,_e.setState),$e("onNodesDelete",q,_e.setState),$e("onEdgesDelete",R,_e.setState),$e("onNodeDrag",Q,_e.setState),$e("onNodeDragStart",z,_e.setState),$e("onNodeDragStop",ne,_e.setState),$e("onSelectionDrag",Z,_e.setState),$e("onSelectionDragStart",$,_e.setState),$e("onSelectionDragStop",X,_e.setState),$e("noPanClassName",I,_e.setState),$e("nodeOrigin",W,_e.setState),$e("rfId",Y,_e.setState),$e("autoPanOnConnect",U,_e.setState),$e("autoPanOnNodeDrag",J,_e.setState),$e("onError",re,_e.setState),$e("connectionRadius",le,_e.setState),$e("isValidConnection",fe,_e.setState),$e("nodeDragThreshold",te,_e.setState),Qi(e,ce),Qi(n,Ce),Qi(_,Te),Qi(S,ye),Qi(H,ke),Qi(b,Ge),null},ux={display:"none"},lM={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},jN="react-flow__node-desc",RN="react-flow__edge-desc",uM="react-flow__aria-live",cM=e=>e.ariaLiveMessage;function dM({rfId:e}){const n=Ke(cM);return ue.createElement("div",{id:`${uM}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:lM},n)}function fM({rfId:e,disableKeyboardA11y:n}){return ue.createElement(ue.Fragment,null,ue.createElement("div",{id:`${jN}-${e}`,style:ux},"Press enter or space to select a node.",!n&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),ue.createElement("div",{id:`${RN}-${e}`,style:ux},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!n&&ue.createElement(dM,{rfId:e}))}var ja=(e=null,n={actInsideInputWithModifier:!0})=>{const[r,i]=T.useState(!1),o=T.useRef(!1),l=T.useRef(new Set([])),[u,c]=T.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(m=>typeof m=="string").map(m=>m.split("+")),d=p.reduce((m,y)=>m.concat(...y),[]);return[p,d]}return[[],[]]},[e]);return T.useEffect(()=>{const h=typeof document<"u"?document:null,p=(n==null?void 0:n.target)||h;if(e!==null){const d=w=>{if(o.current=w.ctrlKey||w.metaKey||w.shiftKey,(!o.current||o.current&&!n.actInsideInputWithModifier)&&dv(w))return!1;const _=dx(w.code,c);l.current.add(w[_]),cx(u,l.current,!1)&&(w.preventDefault(),i(!0))},m=w=>{if((!o.current||o.current&&!n.actInsideInputWithModifier)&&dv(w))return!1;const _=dx(w.code,c);cx(u,l.current,!0)?(i(!1),l.current.clear()):l.current.delete(w[_]),w.key==="Meta"&&l.current.clear(),o.current=!1},y=()=>{l.current.clear(),i(!1)};return p==null||p.addEventListener("keydown",d),p==null||p.addEventListener("keyup",m),window.addEventListener("blur",y),()=>{p==null||p.removeEventListener("keydown",d),p==null||p.removeEventListener("keyup",m),window.removeEventListener("blur",y)}}},[e,i]),r};function cx(e,n,r){return e.filter(i=>r||i.length===n.size).some(i=>i.every(o=>n.has(o)))}function dx(e,n){return n.includes(e)?"code":"key"}function TN(e,n,r,i){var c,h;const o=e.parentNode||e.parentId;if(!o)return r;const l=n.get(o),u=ii(l,i);return TN(l,n,{x:(r.x??0)+u.x,y:(r.y??0)+u.y,z:(((c=l[dt])==null?void 0:c.z)??0)>(r.z??0)?((h=l[dt])==null?void 0:h.z)??0:r.z??0},i)}function AN(e,n,r){e.forEach(i=>{var l;const o=i.parentNode||i.parentId;if(o&&!e.has(o))throw new Error(`Parent node ${o} not found`);if(o||r!=null&&r[i.id]){const{x:u,y:c,z:h}=TN(i,e,{...i.position,z:((l=i[dt])==null?void 0:l.z)??0},n);i.positionAbsolute={x:u,y:c},i[dt].z=h,r!=null&&r[i.id]&&(i[dt].isParent=!0)}})}function Td(e,n,r,i){const o=new Map,l={},u=i?1e3:0;return e.forEach(c=>{var w;const h=(On(c.zIndex)?c.zIndex:0)+(c.selected?u:0),p=n.get(c.id),d={...c,positionAbsolute:{x:c.position.x,y:c.position.y}},m=c.parentNode||c.parentId;m&&(l[m]=!0);const y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==c.type;Object.defineProperty(d,dt,{enumerable:!1,value:{handleBounds:y||(w=p==null?void 0:p[dt])==null?void 0:w.handleBounds,z:h}}),o.set(c.id,d)}),AN(o,r,l),o}function IN(e,n={}){const{getNodes:r,width:i,height:o,minZoom:l,maxZoom:u,d3Zoom:c,d3Selection:h,fitViewOnInitDone:p,fitViewOnInit:d,nodeOrigin:m}=e(),y=n.initial&&!p&&d;if(c&&h&&(y||!n.initial)){const N=r().filter(S=>{var k;const b=n.includeHiddenNodes?S.width&&S.height:!S.hidden;return(k=n.nodes)!=null&&k.length?b&&n.nodes.some(E=>E.id===S.id):b}),_=N.every(S=>S.width&&S.height);if(N.length>0&&_){const S=Cu(N,m),{x:b,y:k,zoom:E}=vN(S,i,o,n.minZoom??l,n.maxZoom??u,n.padding??.1),C=Br.translate(b,k).scale(E);return typeof n.duration=="number"&&n.duration>0?c.transform(ti(h,n.duration),C):c.transform(h,C),!0}}return!1}function hM(e,n){return e.forEach(r=>{const i=n.get(r.id);i&&n.set(i.id,{...i,[dt]:i[dt],selected:r.selected})}),new Map(n)}function pM(e,n){return n.map(r=>{const i=e.find(o=>o.id===r.id);return i&&(r.selected=i.selected),r})}function Gl({changedNodes:e,changedEdges:n,get:r,set:i}){const{nodeInternals:o,edges:l,onNodesChange:u,onEdgesChange:c,hasDefaultNodes:h,hasDefaultEdges:p}=r();e!=null&&e.length&&(h&&i({nodeInternals:hM(e,o)}),u==null||u(e)),n!=null&&n.length&&(p&&i({edges:pM(n,l)}),c==null||c(n))}const Zi=()=>{},mM={zoomIn:Zi,zoomOut:Zi,zoomTo:Zi,getZoom:()=>1,setViewport:Zi,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Zi,fitBounds:Zi,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},gM=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),vM=()=>{const e=Ct(),{d3Zoom:n,d3Selection:r}=Ke(gM,Nt);return T.useMemo(()=>r&&n?{zoomIn:o=>n.scaleBy(ti(r,o==null?void 0:o.duration),1.2),zoomOut:o=>n.scaleBy(ti(r,o==null?void 0:o.duration),1/1.2),zoomTo:(o,l)=>n.scaleTo(ti(r,l==null?void 0:l.duration),o),getZoom:()=>e.getState().transform[2],setViewport:(o,l)=>{const[u,c,h]=e.getState().transform,p=Br.translate(o.x??u,o.y??c).scale(o.zoom??h);n.transform(ti(r,l==null?void 0:l.duration),p)},getViewport:()=>{const[o,l,u]=e.getState().transform;return{x:o,y:l,zoom:u}},fitView:o=>IN(e.getState,o),setCenter:(o,l,u)=>{const{width:c,height:h,maxZoom:p}=e.getState(),d=typeof(u==null?void 0:u.zoom)<"u"?u.zoom:p,m=c/2-o*d,y=h/2-l*d,w=Br.translate(m,y).scale(d);n.transform(ti(r,u==null?void 0:u.duration),w)},fitBounds:(o,l)=>{const{width:u,height:c,minZoom:h,maxZoom:p}=e.getState(),{x:d,y:m,zoom:y}=vN(o,u,c,h,p,(l==null?void 0:l.padding)??.1),w=Br.translate(d,m).scale(y);n.transform(ti(r,l==null?void 0:l.duration),w)},project:o=>{const{transform:l,snapToGrid:u,snapGrid:c}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),pv(o,l,u,c)},screenToFlowPosition:o=>{const{transform:l,snapToGrid:u,snapGrid:c,domNode:h}=e.getState();if(!h)return o;const{x:p,y:d}=h.getBoundingClientRect(),m={x:o.x-p,y:o.y-d};return pv(m,l,u,c)},flowToScreenPosition:o=>{const{transform:l,domNode:u}=e.getState();if(!u)return o;const{x:c,y:h}=u.getBoundingClientRect(),p=pN(o,l);return{x:p.x+c,y:p.y+h}},viewportInitialized:!0}:mM,[n,r])};function Oa(){const e=vM(),n=Ct(),r=T.useCallback(()=>n.getState().getNodes().map(_=>({..._})),[]),i=T.useCallback(_=>n.getState().nodeInternals.get(_),[]),o=T.useCallback(()=>{const{edges:_=[]}=n.getState();return _.map(S=>({...S}))},[]),l=T.useCallback(_=>{const{edges:S=[]}=n.getState();return S.find(b=>b.id===_)},[]),u=T.useCallback(_=>{const{getNodes:S,setNodes:b,hasDefaultNodes:k,onNodesChange:E}=n.getState(),C=S(),A=typeof _=="function"?_(C):_;if(k)b(A);else if(E){const M=A.length===0?C.map(L=>({type:"remove",id:L.id})):A.map(L=>({item:L,type:"reset"}));E(M)}},[]),c=T.useCallback(_=>{const{edges:S=[],setEdges:b,hasDefaultEdges:k,onEdgesChange:E}=n.getState(),C=typeof _=="function"?_(S):_;if(k)b(C);else if(E){const A=C.length===0?S.map(M=>({type:"remove",id:M.id})):C.map(M=>({item:M,type:"reset"}));E(A)}},[]),h=T.useCallback(_=>{const S=Array.isArray(_)?_:[_],{getNodes:b,setNodes:k,hasDefaultNodes:E,onNodesChange:C}=n.getState();if(E){const M=[...b(),...S];k(M)}else if(C){const A=S.map(M=>({item:M,type:"add"}));C(A)}},[]),p=T.useCallback(_=>{const S=Array.isArray(_)?_:[_],{edges:b=[],setEdges:k,hasDefaultEdges:E,onEdgesChange:C}=n.getState();if(E)k([...b,...S]);else if(C){const A=S.map(M=>({item:M,type:"add"}));C(A)}},[]),d=T.useCallback(()=>{const{getNodes:_,edges:S=[],transform:b}=n.getState(),[k,E,C]=b;return{nodes:_().map(A=>({...A})),edges:S.map(A=>({...A})),viewport:{x:k,y:E,zoom:C}}},[]),m=T.useCallback(({nodes:_,edges:S})=>{const{nodeInternals:b,getNodes:k,edges:E,hasDefaultNodes:C,hasDefaultEdges:A,onNodesDelete:M,onEdgesDelete:L,onNodesChange:H,onEdgesChange:O}=n.getState(),P=(_||[]).map(Q=>Q.id),F=(S||[]).map(Q=>Q.id),G=k().reduce((Q,z)=>{const ne=z.parentNode||z.parentId,Z=!P.includes(z.id)&&ne&&Q.find(X=>X.id===ne);return(typeof z.deletable=="boolean"?z.deletable:!0)&&(P.includes(z.id)||Z)&&Q.push(z),Q},[]),q=E.filter(Q=>typeof Q.deletable=="boolean"?Q.deletable:!0),R=q.filter(Q=>F.includes(Q.id));if(G||R){const Q=gN(G,q),z=[...R,...Q],ne=z.reduce((Z,$)=>(Z.includes($.id)||Z.push($.id),Z),[]);if((A||C)&&(A&&n.setState({edges:E.filter(Z=>!ne.includes(Z.id))}),C&&(G.forEach(Z=>{b.delete(Z.id)}),n.setState({nodeInternals:new Map(b)}))),ne.length>0&&(L==null||L(z),O&&O(ne.map(Z=>({id:Z,type:"remove"})))),G.length>0&&(M==null||M(G),H)){const Z=G.map($=>({id:$.id,type:"remove"}));H(Z)}}},[]),y=T.useCallback(_=>{const S=qI(_),b=S?null:n.getState().nodeInternals.get(_.id);return!S&&!b?[null,null,S]:[S?_:nx(b),b,S]},[]),w=T.useCallback((_,S=!0,b)=>{const[k,E,C]=y(_);return k?(b||n.getState().getNodes()).filter(A=>{if(!C&&(A.id===E.id||!A.positionAbsolute))return!1;const M=nx(A),L=cv(M,k);return S&&L>0||L>=k.width*k.height}):[]},[]),N=T.useCallback((_,S,b=!0)=>{const[k]=y(_);if(!k)return!1;const E=cv(k,S);return b&&E>0||E>=k.width*k.height},[]);return T.useMemo(()=>({...e,getNodes:r,getNode:i,getEdges:o,getEdge:l,setNodes:u,setEdges:c,addNodes:h,addEdges:p,toObject:d,deleteElements:m,getIntersectingNodes:w,isNodeIntersecting:N}),[e,r,i,o,l,u,c,h,p,d,m,w,N])}const yM={actInsideInputWithModifier:!1};var wM=({deleteKeyCode:e,multiSelectionKeyCode:n})=>{const r=Ct(),{deleteElements:i}=Oa(),o=ja(e,yM),l=ja(n);T.useEffect(()=>{if(o){const{edges:u,getNodes:c}=r.getState(),h=c().filter(d=>d.selected),p=u.filter(d=>d.selected);i({nodes:h,edges:p}),r.setState({nodesSelectionActive:!1})}},[o]),T.useEffect(()=>{r.setState({multiSelectionActive:l})},[l])};function xM(e){const n=Ct();T.useEffect(()=>{let r;const i=()=>{var l,u;if(!e.current)return;const o=Lv(e.current);(o.height===0||o.width===0)&&((u=(l=n.getState()).onError)==null||u.call(l,"004",Hr.error004())),n.setState({width:o.width||500,height:o.height||500})};return i(),window.addEventListener("resize",i),e.current&&(r=new ResizeObserver(()=>i()),r.observe(e.current)),()=>{window.removeEventListener("resize",i),r&&e.current&&r.unobserve(e.current)}},[])}const Hv={position:"absolute",width:"100%",height:"100%",top:0,left:0},_M=(e,n)=>e.x!==n.x||e.y!==n.y||e.zoom!==n.k,Yl=e=>({x:e.x,y:e.y,zoom:e.k}),Ji=(e,n)=>e.target.closest(`.${n}`),fx=(e,n)=>n===2&&Array.isArray(e)&&e.includes(2),hx=e=>{const n=e.ctrlKey&&pu()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n},bM=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),SM=({onMove:e,onMoveStart:n,onMoveEnd:r,onPaneContextMenu:i,zoomOnScroll:o=!0,zoomOnPinch:l=!0,panOnScroll:u=!1,panOnScrollSpeed:c=.5,panOnScrollMode:h=ri.Free,zoomOnDoubleClick:p=!0,elementsSelectable:d,panOnDrag:m=!0,defaultViewport:y,translateExtent:w,minZoom:N,maxZoom:_,zoomActivationKeyCode:S,preventScrolling:b=!0,children:k,noWheelClassName:E,noPanClassName:C})=>{const A=T.useRef(),M=Ct(),L=T.useRef(!1),H=T.useRef(!1),O=T.useRef(null),P=T.useRef({x:0,y:0,zoom:0}),{d3Zoom:F,d3Selection:G,d3ZoomHandler:q,userSelectionActive:R}=Ke(bM,Nt),Q=ja(S),z=T.useRef(0),ne=T.useRef(!1),Z=T.useRef();return xM(O),T.useEffect(()=>{if(O.current){const $=O.current.getBoundingClientRect(),X=nN().scaleExtent([N,_]).translateExtent(w),I=Pn(O.current).call(X),W=Br.translate(y.x,y.y).scale(ho(y.zoom,N,_)),Y=[[0,0],[$.width,$.height]],U=X.constrain()(W,Y,w);X.transform(I,U),X.wheelDelta(hx),M.setState({d3Zoom:X,d3Selection:I,d3ZoomHandler:I.on("wheel.zoom"),transform:[U.x,U.y,U.k],domNode:O.current.closest(".react-flow")})}},[]),T.useEffect(()=>{G&&F&&(u&&!Q&&!R?G.on("wheel.zoom",$=>{if(Ji($,E))return!1;$.preventDefault(),$.stopImmediatePropagation();const X=G.property("__zoom").k||1;if($.ctrlKey&&l){const fe=Xn($),te=hx($),ce=X*Math.pow(2,te);F.scaleTo(G,ce,fe,$);return}const I=$.deltaMode===1?20:1;let W=h===ri.Vertical?0:$.deltaX*I,Y=h===ri.Horizontal?0:$.deltaY*I;!pu()&&$.shiftKey&&h!==ri.Vertical&&(W=$.deltaY*I,Y=0),F.translateBy(G,-(W/X)*c,-(Y/X)*c,{internal:!0});const U=Yl(G.property("__zoom")),{onViewportChangeStart:J,onViewportChange:re,onViewportChangeEnd:le}=M.getState();clearTimeout(Z.current),ne.current||(ne.current=!0,n==null||n($,U),J==null||J(U)),ne.current&&(e==null||e($,U),re==null||re(U),Z.current=setTimeout(()=>{r==null||r($,U),le==null||le(U),ne.current=!1},150))},{passive:!1}):typeof q<"u"&&G.on("wheel.zoom",function($,X){if(!b&&$.type==="wheel"&&!$.ctrlKey||Ji($,E))return null;$.preventDefault(),q.call(this,$,X)},{passive:!1}))},[R,u,h,G,F,q,Q,l,b,E,n,e,r]),T.useEffect(()=>{F&&F.on("start",$=>{var W,Y;if(!$.sourceEvent||$.sourceEvent.internal)return null;z.current=(W=$.sourceEvent)==null?void 0:W.button;const{onViewportChangeStart:X}=M.getState(),I=Yl($.transform);L.current=!0,P.current=I,((Y=$.sourceEvent)==null?void 0:Y.type)==="mousedown"&&M.setState({paneDragging:!0}),X==null||X(I),n==null||n($.sourceEvent,I)})},[F,n]),T.useEffect(()=>{F&&(R&&!L.current?F.on("zoom",null):R||F.on("zoom",$=>{var I;const{onViewportChange:X}=M.getState();if(M.setState({transform:[$.transform.x,$.transform.y,$.transform.k]}),H.current=!!(i&&fx(m,z.current??0)),(e||X)&&!((I=$.sourceEvent)!=null&&I.internal)){const W=Yl($.transform);X==null||X(W),e==null||e($.sourceEvent,W)}}))},[R,F,e,m,i]),T.useEffect(()=>{F&&F.on("end",$=>{if(!$.sourceEvent||$.sourceEvent.internal)return null;const{onViewportChangeEnd:X}=M.getState();if(L.current=!1,M.setState({paneDragging:!1}),i&&fx(m,z.current??0)&&!H.current&&i($.sourceEvent),H.current=!1,(r||X)&&_M(P.current,$.transform)){const I=Yl($.transform);P.current=I,clearTimeout(A.current),A.current=setTimeout(()=>{X==null||X(I),r==null||r($.sourceEvent,I)},u?150:0)}})},[F,u,m,r,i]),T.useEffect(()=>{F&&F.filter($=>{const X=Q||o,I=l&&$.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&$.button===1&&$.type==="mousedown"&&(Ji($,"react-flow__node")||Ji($,"react-flow__edge")))return!0;if(!m&&!X&&!u&&!p&&!l||R||!p&&$.type==="dblclick"||Ji($,E)&&$.type==="wheel"||Ji($,C)&&($.type!=="wheel"||u&&$.type==="wheel"&&!Q)||!l&&$.ctrlKey&&$.type==="wheel"||!X&&!u&&!I&&$.type==="wheel"||!m&&($.type==="mousedown"||$.type==="touchstart")||Array.isArray(m)&&!m.includes($.button)&&$.type==="mousedown")return!1;const W=Array.isArray(m)&&m.includes($.button)||!$.button||$.button<=1;return(!$.ctrlKey||$.type==="wheel")&&W})},[R,F,o,l,u,p,m,d,Q]),ue.createElement("div",{className:"react-flow__renderer",ref:O,style:Hv},k)},kM=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function EM(){const{userSelectionActive:e,userSelectionRect:n}=Ke(kM,Nt);return e&&n?ue.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:n.width,height:n.height,transform:`translate(${n.x}px, ${n.y}px)`}}):null}function px(e,n){const r=n.parentNode||n.parentId,i=e.find(o=>o.id===r);if(i){const o=n.position.x+n.width-i.width,l=n.position.y+n.height-i.height;if(o>0||l>0||n.position.x<0||n.position.y<0){if(i.style={...i.style},i.style.width=i.style.width??i.width,i.style.height=i.style.height??i.height,o>0&&(i.style.width+=o),l>0&&(i.style.height+=l),n.position.x<0){const u=Math.abs(n.position.x);i.position.x=i.position.x-u,i.style.width+=u,n.position.x=0}if(n.position.y<0){const u=Math.abs(n.position.y);i.position.y=i.position.y-u,i.style.height+=u,n.position.y=0}i.width=i.style.width,i.height=i.style.height}}}function NM(e,n){if(e.some(i=>i.type==="reset"))return e.filter(i=>i.type==="reset").map(i=>i.item);const r=e.filter(i=>i.type==="add").map(i=>i.item);return n.reduce((i,o)=>{const l=e.filter(c=>c.id===o.id);if(l.length===0)return i.push(o),i;const u={...o};for(const c of l)if(c)switch(c.type){case"select":{u.selected=c.selected;break}case"position":{typeof c.position<"u"&&(u.position=c.position),typeof c.positionAbsolute<"u"&&(u.positionAbsolute=c.positionAbsolute),typeof c.dragging<"u"&&(u.dragging=c.dragging),u.expandParent&&px(i,u);break}case"dimensions":{typeof c.dimensions<"u"&&(u.width=c.dimensions.width,u.height=c.dimensions.height),typeof c.updateStyle<"u"&&(u.style={...u.style||{},...c.dimensions}),typeof c.resizing=="boolean"&&(u.resizing=c.resizing),u.expandParent&&px(i,u);break}case"remove":return i}return i.push(u),i},r)}function CM(e,n){return NM(e,n)}const xs=(e,n)=>({id:e,type:"select",selected:n});function ro(e,n){return e.reduce((r,i)=>{const o=n.includes(i.id);return!i.selected&&o?(i.selected=!0,r.push(xs(i.id,!0))):i.selected&&!o&&(i.selected=!1,r.push(xs(i.id,!1))),r},[])}const Ad=(e,n)=>r=>{r.target===n.current&&(e==null||e(r))},jM=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),MN=T.memo(({isSelecting:e,selectionMode:n=Ca.Full,panOnDrag:r,onSelectionStart:i,onSelectionEnd:o,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:c,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:d,children:m})=>{const y=T.useRef(null),w=Ct(),N=T.useRef(0),_=T.useRef(0),S=T.useRef(),{userSelectionActive:b,elementsSelectable:k,dragging:E}=Ke(jM,Nt),C=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),N.current=0,_.current=0},A=q=>{l==null||l(q),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},M=q=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){q.preventDefault();return}u==null||u(q)},L=c?q=>c(q):void 0,H=q=>{const{resetSelectedElements:R,domNode:Q}=w.getState();if(S.current=Q==null?void 0:Q.getBoundingClientRect(),!k||!e||q.button!==0||q.target!==y.current||!S.current)return;const{x:z,y:ne}=bs(q,S.current);R(),w.setState({userSelectionRect:{width:0,height:0,startX:z,startY:ne,x:z,y:ne}}),i==null||i(q)},O=q=>{const{userSelectionRect:R,nodeInternals:Q,edges:z,transform:ne,onNodesChange:Z,onEdgesChange:$,nodeOrigin:X,getNodes:I}=w.getState();if(!e||!S.current||!R)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const W=bs(q,S.current),Y=R.startX??0,U=R.startY??0,J={...R,x:W.x<Y?W.x:Y,y:W.y<U?W.y:U,width:Math.abs(W.x-Y),height:Math.abs(W.y-U)},re=I(),le=mN(Q,J,ne,n===Ca.Partial,!0,X),fe=gN(le,z).map(ce=>ce.id),te=le.map(ce=>ce.id);if(N.current!==te.length){N.current=te.length;const ce=ro(re,te);ce.length&&(Z==null||Z(ce))}if(_.current!==fe.length){_.current=fe.length;const ce=ro(z,fe);ce.length&&($==null||$(ce))}w.setState({userSelectionRect:J})},P=q=>{if(q.button!==0)return;const{userSelectionRect:R}=w.getState();!b&&R&&q.target===y.current&&(A==null||A(q)),w.setState({nodesSelectionActive:N.current>0}),C(),o==null||o(q)},F=q=>{b&&(w.setState({nodesSelectionActive:N.current>0}),o==null||o(q)),C()},G=k&&(e||b);return ue.createElement("div",{className:Bt(["react-flow__pane",{dragging:E,selection:e}]),onClick:G?void 0:Ad(A,y),onContextMenu:Ad(M,y),onWheel:Ad(L,y),onMouseEnter:G?void 0:h,onMouseDown:G?H:void 0,onMouseMove:G?O:p,onMouseUp:G?P:void 0,onMouseLeave:G?F:d,ref:y,style:Hv},m,ue.createElement(EM,null))});MN.displayName="Pane";function PN(e,n){const r=e.parentNode||e.parentId;if(!r)return!1;const i=n.get(r);return i?i.selected?!0:PN(i,n):!1}function mx(e,n,r){let i=e;do{if(i!=null&&i.matches(n))return!0;if(i===r.current)return!1;i=i.parentElement}while(i);return!1}function RM(e,n,r,i){return Array.from(e.values()).filter(o=>(o.selected||o.id===i)&&(!o.parentNode||o.parentId||!PN(o,e))&&(o.draggable||n&&typeof o.draggable>"u")).map(o=>{var l,u;return{id:o.id,position:o.position||{x:0,y:0},positionAbsolute:o.positionAbsolute||{x:0,y:0},distance:{x:r.x-(((l=o.positionAbsolute)==null?void 0:l.x)??0),y:r.y-(((u=o.positionAbsolute)==null?void 0:u.y)??0)},delta:{x:0,y:0},extent:o.extent,parentNode:o.parentNode||o.parentId,parentId:o.parentNode||o.parentId,width:o.width,height:o.height,expandParent:o.expandParent}})}function TM(e,n){return!n||n==="parent"?n:[n[0],[n[1][0]-(e.width||0),n[1][1]-(e.height||0)]]}function ON(e,n,r,i,o=[0,0],l){const u=TM(e,e.extent||i);let c=u;const h=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(h&&e.width&&e.height){const m=r.get(h),{x:y,y:w}=ii(m,o).positionAbsolute;c=m&&On(y)&&On(w)&&On(m.width)&&On(m.height)?[[y+e.width*o[0],w+e.height*o[1]],[y+m.width-e.width+e.width*o[0],w+m.height-e.height+e.height*o[1]]]:c}else l==null||l("005",Hr.error005()),c=u;else if(e.extent&&h&&e.extent!=="parent"){const m=r.get(h),{x:y,y:w}=ii(m,o).positionAbsolute;c=[[e.extent[0][0]+y,e.extent[0][1]+w],[e.extent[1][0]+y,e.extent[1][1]+w]]}let p={x:0,y:0};if(h){const m=r.get(h);p=ii(m,o).positionAbsolute}const d=c&&c!=="parent"?qv(n,c):n;return{position:{x:d.x-p.x,y:d.y-p.y},positionAbsolute:d}}function Id({nodeId:e,dragItems:n,nodeInternals:r}){const i=n.map(o=>({...r.get(o.id),position:o.position,positionAbsolute:o.positionAbsolute}));return[e?i.find(o=>o.id===e):i[0],i]}const gx=(e,n,r,i)=>{const o=n.querySelectorAll(e);if(!o||!o.length)return null;const l=Array.from(o),u=n.getBoundingClientRect(),c={x:u.width*i[0],y:u.height*i[1]};return l.map(h=>{const p=h.getBoundingClientRect();return{id:h.getAttribute("data-handleid"),position:h.getAttribute("data-handlepos"),x:(p.left-u.left-c.x)/r,y:(p.top-u.top-c.y)/r,...Lv(h)}})};function fa(e,n,r){return r===void 0?r:i=>{const o=n().nodeInternals.get(e);o&&r(i,{...o})}}function gv({id:e,store:n,unselect:r=!1,nodeRef:i}){const{addSelectedNodes:o,unselectNodesAndEdges:l,multiSelectionActive:u,nodeInternals:c,onError:h}=n.getState(),p=c.get(e);if(!p){h==null||h("012",Hr.error012(e));return}n.setState({nodesSelectionActive:!1}),p.selected?(r||p.selected&&u)&&(l({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var d;return(d=i==null?void 0:i.current)==null?void 0:d.blur()})):o([e])}function AM(){const e=Ct();return T.useCallback(({sourceEvent:r})=>{const{transform:i,snapGrid:o,snapToGrid:l}=e.getState(),u=r.touches?r.touches[0].clientX:r.clientX,c=r.touches?r.touches[0].clientY:r.clientY,h={x:(u-i[0])/i[2],y:(c-i[1])/i[2]};return{xSnapped:l?o[0]*Math.round(h.x/o[0]):h.x,ySnapped:l?o[1]*Math.round(h.y/o[1]):h.y,...h}},[])}function Md(e){return(n,r,i)=>e==null?void 0:e(n,i)}function LN({nodeRef:e,disabled:n=!1,noDragClassName:r,handleSelector:i,nodeId:o,isSelectable:l,selectNodesOnDrag:u}){const c=Ct(),[h,p]=T.useState(!1),d=T.useRef([]),m=T.useRef({x:null,y:null}),y=T.useRef(0),w=T.useRef(null),N=T.useRef({x:0,y:0}),_=T.useRef(null),S=T.useRef(!1),b=T.useRef(!1),k=T.useRef(!1),E=AM();return T.useEffect(()=>{if(e!=null&&e.current){const C=Pn(e.current),A=({x:H,y:O})=>{const{nodeInternals:P,onNodeDrag:F,onSelectionDrag:G,updateNodePositions:q,nodeExtent:R,snapGrid:Q,snapToGrid:z,nodeOrigin:ne,onError:Z}=c.getState();m.current={x:H,y:O};let $=!1,X={x:0,y:0,x2:0,y2:0};if(d.current.length>1&&R){const W=Cu(d.current,ne);X=Na(W)}if(d.current=d.current.map(W=>{const Y={x:H-W.distance.x,y:O-W.distance.y};z&&(Y.x=Q[0]*Math.round(Y.x/Q[0]),Y.y=Q[1]*Math.round(Y.y/Q[1]));const U=[[R[0][0],R[0][1]],[R[1][0],R[1][1]]];d.current.length>1&&R&&!W.extent&&(U[0][0]=W.positionAbsolute.x-X.x+R[0][0],U[1][0]=W.positionAbsolute.x+(W.width??0)-X.x2+R[1][0],U[0][1]=W.positionAbsolute.y-X.y+R[0][1],U[1][1]=W.positionAbsolute.y+(W.height??0)-X.y2+R[1][1]);const J=ON(W,Y,P,U,ne,Z);return $=$||W.position.x!==J.position.x||W.position.y!==J.position.y,W.position=J.position,W.positionAbsolute=J.positionAbsolute,W}),!$)return;q(d.current,!0,!0),p(!0);const I=o?F:Md(G);if(I&&_.current){const[W,Y]=Id({nodeId:o,dragItems:d.current,nodeInternals:P});I(_.current,W,Y)}},M=()=>{if(!w.current)return;const[H,O]=sN(N.current,w.current);if(H!==0||O!==0){const{transform:P,panBy:F}=c.getState();m.current.x=(m.current.x??0)-H/P[2],m.current.y=(m.current.y??0)-O/P[2],F({x:H,y:O})&&A(m.current)}y.current=requestAnimationFrame(M)},L=H=>{var ne;const{nodeInternals:O,multiSelectionActive:P,nodesDraggable:F,unselectNodesAndEdges:G,onNodeDragStart:q,onSelectionDragStart:R}=c.getState();b.current=!0;const Q=o?q:Md(R);(!u||!l)&&!P&&o&&((ne=O.get(o))!=null&&ne.selected||G()),o&&l&&u&&gv({id:o,store:c,nodeRef:e});const z=E(H);if(m.current=z,d.current=RM(O,F,z,o),Q&&d.current){const[Z,$]=Id({nodeId:o,dragItems:d.current,nodeInternals:O});Q(H.sourceEvent,Z,$)}};if(n)C.on(".drag",null);else{const H=F2().on("start",O=>{const{domNode:P,nodeDragThreshold:F}=c.getState();F===0&&L(O),k.current=!1;const G=E(O);m.current=G,w.current=(P==null?void 0:P.getBoundingClientRect())||null,N.current=bs(O.sourceEvent,w.current)}).on("drag",O=>{var q,R;const P=E(O),{autoPanOnNodeDrag:F,nodeDragThreshold:G}=c.getState();if(O.sourceEvent.type==="touchmove"&&O.sourceEvent.touches.length>1&&(k.current=!0),!k.current){if(!S.current&&b.current&&F&&(S.current=!0,M()),!b.current){const Q=P.xSnapped-(((q=m==null?void 0:m.current)==null?void 0:q.x)??0),z=P.ySnapped-(((R=m==null?void 0:m.current)==null?void 0:R.y)??0);Math.sqrt(Q*Q+z*z)>G&&L(O)}(m.current.x!==P.xSnapped||m.current.y!==P.ySnapped)&&d.current&&b.current&&(_.current=O.sourceEvent,N.current=bs(O.sourceEvent,w.current),A(P))}}).on("end",O=>{if(!(!b.current||k.current)&&(p(!1),S.current=!1,b.current=!1,cancelAnimationFrame(y.current),d.current)){const{updateNodePositions:P,nodeInternals:F,onNodeDragStop:G,onSelectionDragStop:q}=c.getState(),R=o?G:Md(q);if(P(d.current,!1,!1),R){const[Q,z]=Id({nodeId:o,dragItems:d.current,nodeInternals:F});R(O.sourceEvent,Q,z)}}}).filter(O=>{const P=O.target;return!O.button&&(!r||!mx(P,`.${r}`,e))&&(!i||mx(P,i,e))});return C.call(H),()=>{C.on(".drag",null)}}}},[e,n,r,i,l,c,o,u,E]),h}function qN(){const e=Ct();return T.useCallback(r=>{const{nodeInternals:i,nodeExtent:o,updateNodePositions:l,getNodes:u,snapToGrid:c,snapGrid:h,onError:p,nodesDraggable:d}=e.getState(),m=u().filter(k=>k.selected&&(k.draggable||d&&typeof k.draggable>"u")),y=c?h[0]:5,w=c?h[1]:5,N=r.isShiftPressed?4:1,_=r.x*y*N,S=r.y*w*N,b=m.map(k=>{if(k.positionAbsolute){const E={x:k.positionAbsolute.x+_,y:k.positionAbsolute.y+S};c&&(E.x=h[0]*Math.round(E.x/h[0]),E.y=h[1]*Math.round(E.y/h[1]));const{positionAbsolute:C,position:A}=ON(k,E,i,o,void 0,p);k.position=A,k.positionAbsolute=C}return k});l(b,!0,!1)},[])}const lo={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var ha=e=>{const n=({id:r,type:i,data:o,xPos:l,yPos:u,xPosOrigin:c,yPosOrigin:h,selected:p,onClick:d,onMouseEnter:m,onMouseMove:y,onMouseLeave:w,onContextMenu:N,onDoubleClick:_,style:S,className:b,isDraggable:k,isSelectable:E,isConnectable:C,isFocusable:A,selectNodesOnDrag:M,sourcePosition:L,targetPosition:H,hidden:O,resizeObserver:P,dragHandle:F,zIndex:G,isParent:q,noDragClassName:R,noPanClassName:Q,initialized:z,disableKeyboardA11y:ne,ariaLabel:Z,rfId:$,hasHandleBounds:X})=>{const I=Ct(),W=T.useRef(null),Y=T.useRef(null),U=T.useRef(L),J=T.useRef(H),re=T.useRef(i),le=E||k||d||m||y||w,fe=qN(),te=fa(r,I.getState,m),ce=fa(r,I.getState,y),Ce=fa(r,I.getState,w),ve=fa(r,I.getState,N),Te=fa(r,I.getState,_),ye=we=>{const{nodeDragThreshold:_e}=I.getState();if(E&&(!M||!k||_e>0)&&gv({id:r,store:I,nodeRef:W}),d){const ze=I.getState().nodeInternals.get(r);ze&&d(we,{...ze})}},ke=we=>{if(!dv(we)&&!ne)if(lN.includes(we.key)&&E){const _e=we.key==="Escape";gv({id:r,store:I,unselect:_e,nodeRef:W})}else k&&p&&Object.prototype.hasOwnProperty.call(lo,we.key)&&(I.setState({ariaLiveMessage:`Moved selected node ${we.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~l}, y: ${~~u}`}),fe({x:lo[we.key].x,y:lo[we.key].y,isShiftPressed:we.shiftKey}))};T.useEffect(()=>()=>{Y.current&&(P==null||P.unobserve(Y.current),Y.current=null)},[]),T.useEffect(()=>{if(W.current&&!O){const we=W.current;(!z||!X||Y.current!==we)&&(Y.current&&(P==null||P.unobserve(Y.current)),P==null||P.observe(we),Y.current=we)}},[O,z,X]),T.useEffect(()=>{const we=re.current!==i,_e=U.current!==L,ze=J.current!==H;W.current&&(we||_e||ze)&&(we&&(re.current=i),_e&&(U.current=L),ze&&(J.current=H),I.getState().updateNodeDimensions([{id:r,nodeElement:W.current,forceUpdate:!0}]))},[r,i,L,H]);const Ge=LN({nodeRef:W,disabled:O||!k,noDragClassName:R,handleSelector:F,nodeId:r,isSelectable:E,selectNodesOnDrag:M});return O?null:ue.createElement("div",{className:Bt(["react-flow__node",`react-flow__node-${i}`,{[Q]:k},b,{selected:p,selectable:E,parent:q,dragging:Ge}]),ref:W,style:{zIndex:G,transform:`translate(${c}px,${h}px)`,pointerEvents:le?"all":"none",visibility:z?"visible":"hidden",...S},"data-id":r,"data-testid":`rf__node-${r}`,onMouseEnter:te,onMouseMove:ce,onMouseLeave:Ce,onContextMenu:ve,onClick:ye,onDoubleClick:Te,onKeyDown:A?ke:void 0,tabIndex:A?0:void 0,role:A?"button":void 0,"aria-describedby":ne?void 0:`${jN}-${$}`,"aria-label":Z},ue.createElement(HI,{value:r},ue.createElement(e,{id:r,data:o,type:i,xPos:l,yPos:u,selected:p,isConnectable:C,sourcePosition:L,targetPosition:H,dragging:Ge,dragHandle:F,zIndex:G})))};return n.displayName="NodeWrapper",T.memo(n)};const IM=e=>{const n=e.getNodes().filter(r=>r.selected);return{...Cu(n,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function MM({onSelectionContextMenu:e,noPanClassName:n,disableKeyboardA11y:r}){const i=Ct(),{width:o,height:l,x:u,y:c,transformString:h,userSelectionActive:p}=Ke(IM,Nt),d=qN(),m=T.useRef(null);if(T.useEffect(()=>{var N;r||(N=m.current)==null||N.focus({preventScroll:!0})},[r]),LN({nodeRef:m}),p||!o||!l)return null;const y=e?N=>{const _=i.getState().getNodes().filter(S=>S.selected);e(N,_)}:void 0,w=N=>{Object.prototype.hasOwnProperty.call(lo,N.key)&&d({x:lo[N.key].x,y:lo[N.key].y,isShiftPressed:N.shiftKey})};return ue.createElement("div",{className:Bt(["react-flow__nodesselection","react-flow__container",n]),style:{transform:h}},ue.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:r?void 0:-1,onKeyDown:r?void 0:w,style:{width:o,height:l,top:c,left:u}}))}var PM=T.memo(MM);const OM=e=>e.nodesSelectionActive,$N=({children:e,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:o,onPaneContextMenu:l,onPaneScroll:u,deleteKeyCode:c,onMove:h,onMoveStart:p,onMoveEnd:d,selectionKeyCode:m,selectionOnDrag:y,selectionMode:w,onSelectionStart:N,onSelectionEnd:_,multiSelectionKeyCode:S,panActivationKeyCode:b,zoomActivationKeyCode:k,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:A,panOnScroll:M,panOnScrollSpeed:L,panOnScrollMode:H,zoomOnDoubleClick:O,panOnDrag:P,defaultViewport:F,translateExtent:G,minZoom:q,maxZoom:R,preventScrolling:Q,onSelectionContextMenu:z,noWheelClassName:ne,noPanClassName:Z,disableKeyboardA11y:$})=>{const X=Ke(OM),I=ja(m),W=ja(b),Y=W||P,U=W||M,J=I||y&&Y!==!0;return wM({deleteKeyCode:c,multiSelectionKeyCode:S}),ue.createElement(SM,{onMove:h,onMoveStart:p,onMoveEnd:d,onPaneContextMenu:l,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:A,panOnScroll:U,panOnScrollSpeed:L,panOnScrollMode:H,zoomOnDoubleClick:O,panOnDrag:!I&&Y,defaultViewport:F,translateExtent:G,minZoom:q,maxZoom:R,zoomActivationKeyCode:k,preventScrolling:Q,noWheelClassName:ne,noPanClassName:Z},ue.createElement(MN,{onSelectionStart:N,onSelectionEnd:_,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:o,onPaneContextMenu:l,onPaneScroll:u,panOnDrag:Y,isSelecting:!!J,selectionMode:w},e,X&&ue.createElement(PM,{onSelectionContextMenu:z,noPanClassName:Z,disableKeyboardA11y:$})))};$N.displayName="FlowRenderer";var LM=T.memo($N);function qM(e){return Ke(T.useCallback(r=>e?mN(r.nodeInternals,{x:0,y:0,width:r.width,height:r.height},r.transform,!0):r.getNodes(),[e]))}function $M(e){const n={input:ha(e.input||kN),default:ha(e.default||mv),output:ha(e.output||NN),group:ha(e.group||Uv)},r={},i=Object.keys(e).filter(o=>!["input","default","output","group"].includes(o)).reduce((o,l)=>(o[l]=ha(e[l]||mv),o),r);return{...n,...i}}const DM=({x:e,y:n,width:r,height:i,origin:o})=>!r||!i?{x:e,y:n}:o[0]<0||o[1]<0||o[0]>1||o[1]>1?{x:e,y:n}:{x:e-r*o[0],y:n-i*o[1]},FM=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),DN=e=>{const{nodesDraggable:n,nodesConnectable:r,nodesFocusable:i,elementsSelectable:o,updateNodeDimensions:l,onError:u}=Ke(FM,Nt),c=qM(e.onlyRenderVisibleElements),h=T.useRef(),p=T.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const d=new ResizeObserver(m=>{const y=m.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));l(y)});return h.current=d,d},[]);return T.useEffect(()=>()=>{var d;(d=h==null?void 0:h.current)==null||d.disconnect()},[]),ue.createElement("div",{className:"react-flow__nodes",style:Hv},c.map(d=>{var A,M,L;let m=d.type||"default";e.nodeTypes[m]||(u==null||u("003",Hr.error003(m)),m="default");const y=e.nodeTypes[m]||e.nodeTypes.default,w=!!(d.draggable||n&&typeof d.draggable>"u"),N=!!(d.selectable||o&&typeof d.selectable>"u"),_=!!(d.connectable||r&&typeof d.connectable>"u"),S=!!(d.focusable||i&&typeof d.focusable>"u"),b=e.nodeExtent?qv(d.positionAbsolute,e.nodeExtent):d.positionAbsolute,k=(b==null?void 0:b.x)??0,E=(b==null?void 0:b.y)??0,C=DM({x:k,y:E,width:d.width??0,height:d.height??0,origin:e.nodeOrigin});return ue.createElement(y,{key:d.id,id:d.id,className:d.className,style:d.style,type:m,data:d.data,sourcePosition:d.sourcePosition||Ae.Bottom,targetPosition:d.targetPosition||Ae.Top,hidden:d.hidden,xPos:k,yPos:E,xPosOrigin:C.x,yPosOrigin:C.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!d.selected,isDraggable:w,isSelectable:N,isConnectable:_,isFocusable:S,resizeObserver:p,dragHandle:d.dragHandle,zIndex:((A=d[dt])==null?void 0:A.z)??0,isParent:!!((M=d[dt])!=null&&M.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!d.width&&!!d.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:d.ariaLabel,hasHandleBounds:!!((L=d[dt])!=null&&L.handleBounds)})}))};DN.displayName="NodeRenderer";var zM=T.memo(DN);const BM=(e,n,r)=>r===Ae.Left?e-n:r===Ae.Right?e+n:e,UM=(e,n,r)=>r===Ae.Top?e-n:r===Ae.Bottom?e+n:e,vx="react-flow__edgeupdater",yx=({position:e,centerX:n,centerY:r,radius:i=10,onMouseDown:o,onMouseEnter:l,onMouseOut:u,type:c})=>ue.createElement("circle",{onMouseDown:o,onMouseEnter:l,onMouseOut:u,className:Bt([vx,`${vx}-${c}`]),cx:BM(n,i,e),cy:UM(r,i,e),r:i,stroke:"transparent",fill:"transparent"}),HM=()=>!0;var eo=e=>{const n=({id:r,className:i,type:o,data:l,onClick:u,onEdgeDoubleClick:c,selected:h,animated:p,label:d,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:_,style:S,source:b,target:k,sourceX:E,sourceY:C,targetX:A,targetY:M,sourcePosition:L,targetPosition:H,elementsSelectable:O,hidden:P,sourceHandleId:F,targetHandleId:G,onContextMenu:q,onMouseEnter:R,onMouseMove:Q,onMouseLeave:z,reconnectRadius:ne,onReconnect:Z,onReconnectStart:$,onReconnectEnd:X,markerEnd:I,markerStart:W,rfId:Y,ariaLabel:U,isFocusable:J,isReconnectable:re,pathOptions:le,interactionWidth:fe,disableKeyboardA11y:te})=>{const ce=T.useRef(null),[Ce,ve]=T.useState(!1),[Te,ye]=T.useState(!1),ke=Ct(),Ge=T.useMemo(()=>`url('#${hv(W,Y)}')`,[W,Y]),we=T.useMemo(()=>`url('#${hv(I,Y)}')`,[I,Y]);if(P)return null;const _e=Xe=>{var Pt;const{edges:wt,addSelectedEdges:pt,unselectNodesAndEdges:mt,multiSelectionActive:_n}=ke.getState(),Xt=wt.find(Qt=>Qt.id===r);Xt&&(O&&(ke.setState({nodesSelectionActive:!1}),Xt.selected&&_n?(mt({nodes:[],edges:[Xt]}),(Pt=ce.current)==null||Pt.blur()):pt([r])),u&&u(Xe,Xt))},ze=da(r,ke.getState,c),ft=da(r,ke.getState,q),ht=da(r,ke.getState,R),Ue=da(r,ke.getState,Q),De=da(r,ke.getState,z),Ze=(Xe,wt)=>{if(Xe.button!==0)return;const{edges:pt,isValidConnection:mt}=ke.getState(),_n=wt?k:b,Xt=(wt?G:F)||null,Pt=wt?"target":"source",Qt=mt||HM,yr=wt,bn=pt.find(Sn=>Sn.id===r);ye(!0),$==null||$(Xe,bn,Pt);const Zt=Sn=>{ye(!1),X==null||X(Sn,bn,Pt)};xN({event:Xe,handleId:Xt,nodeId:_n,onConnect:Sn=>Z==null?void 0:Z(bn,Sn),isTarget:yr,getState:ke.getState,setState:ke.setState,isValidConnection:Qt,edgeUpdaterType:Pt,onReconnectEnd:Zt})},Ye=Xe=>Ze(Xe,!0),vt=Xe=>Ze(Xe,!1),ot=()=>ve(!0),yt=()=>ve(!1),Kt=!O&&!u,Mt=Xe=>{var wt;if(!te&&lN.includes(Xe.key)&&O){const{unselectNodesAndEdges:pt,addSelectedEdges:mt,edges:_n}=ke.getState();Xe.key==="Escape"?((wt=ce.current)==null||wt.blur(),pt({edges:[_n.find(Pt=>Pt.id===r)]})):mt([r])}};return ue.createElement("g",{className:Bt(["react-flow__edge",`react-flow__edge-${o}`,i,{selected:h,animated:p,inactive:Kt,updating:Ce}]),onClick:_e,onDoubleClick:ze,onContextMenu:ft,onMouseEnter:ht,onMouseMove:Ue,onMouseLeave:De,onKeyDown:J?Mt:void 0,tabIndex:J?0:void 0,role:J?"button":"img","data-testid":`rf__edge-${r}`,"aria-label":U===null?void 0:U||`Edge from ${b} to ${k}`,"aria-describedby":J?`${RN}-${Y}`:void 0,ref:ce},!Te&&ue.createElement(e,{id:r,source:b,target:k,selected:h,animated:p,label:d,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:_,data:l,style:S,sourceX:E,sourceY:C,targetX:A,targetY:M,sourcePosition:L,targetPosition:H,sourceHandleId:F,targetHandleId:G,markerStart:Ge,markerEnd:we,pathOptions:le,interactionWidth:fe}),re&&ue.createElement(ue.Fragment,null,(re==="source"||re===!0)&&ue.createElement(yx,{position:L,centerX:E,centerY:C,radius:ne,onMouseDown:Ye,onMouseEnter:ot,onMouseOut:yt,type:"source"}),(re==="target"||re===!0)&&ue.createElement(yx,{position:H,centerX:A,centerY:M,radius:ne,onMouseDown:vt,onMouseEnter:ot,onMouseOut:yt,type:"target"})))};return n.displayName="EdgeWrapper",T.memo(n)};function WM(e){const n={default:eo(e.default||gu),straight:eo(e.bezier||Fv),step:eo(e.step||Dv),smoothstep:eo(e.step||Nu),simplebezier:eo(e.simplebezier||$v)},r={},i=Object.keys(e).filter(o=>!["default","bezier"].includes(o)).reduce((o,l)=>(o[l]=eo(e[l]||gu),o),r);return{...n,...i}}function wx(e,n,r=null){const i=((r==null?void 0:r.x)||0)+n.x,o=((r==null?void 0:r.y)||0)+n.y,l=(r==null?void 0:r.width)||n.width,u=(r==null?void 0:r.height)||n.height;switch(e){case Ae.Top:return{x:i+l/2,y:o};case Ae.Right:return{x:i+l,y:o+u/2};case Ae.Bottom:return{x:i+l/2,y:o+u};case Ae.Left:return{x:i,y:o+u/2}}}function xx(e,n){return e?e.length===1||!n?e[0]:n&&e.find(r=>r.id===n)||null:null}const VM=(e,n,r,i,o,l)=>{const u=wx(r,e,n),c=wx(l,i,o);return{sourceX:u.x,sourceY:u.y,targetX:c.x,targetY:c.y}};function GM({sourcePos:e,targetPos:n,sourceWidth:r,sourceHeight:i,targetWidth:o,targetHeight:l,width:u,height:c,transform:h}){const p={x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x+r,n.x+o),y2:Math.max(e.y+i,n.y+l)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const d=Na({x:(0-h[0])/h[2],y:(0-h[1])/h[2],width:u/h[2],height:c/h[2]}),m=Math.max(0,Math.min(d.x2,p.x2)-Math.max(d.x,p.x)),y=Math.max(0,Math.min(d.y2,p.y2)-Math.max(d.y,p.y));return Math.ceil(m*y)>0}function _x(e){var i,o,l,u,c;const n=((i=e==null?void 0:e[dt])==null?void 0:i.handleBounds)||null,r=n&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((o=e==null?void 0:e.positionAbsolute)==null?void 0:o.x)<"u"&&typeof((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.y)<"u";return[{x:((u=e==null?void 0:e.positionAbsolute)==null?void 0:u.x)||0,y:((c=e==null?void 0:e.positionAbsolute)==null?void 0:c.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},n,!!r]}const YM=[{level:0,isMaxLevel:!0,edges:[]}];function KM(e,n,r=!1){let i=-1;const o=e.reduce((u,c)=>{var d,m;const h=On(c.zIndex);let p=h?c.zIndex:0;if(r){const y=n.get(c.target),w=n.get(c.source),N=c.selected||(y==null?void 0:y.selected)||(w==null?void 0:w.selected),_=Math.max(((d=w==null?void 0:w[dt])==null?void 0:d.z)||0,((m=y==null?void 0:y[dt])==null?void 0:m.z)||0,1e3);p=(h?c.zIndex:0)+(N?_:0)}return u[p]?u[p].push(c):u[p]=[c],i=p>i?p:i,u},{}),l=Object.entries(o).map(([u,c])=>{const h=+u;return{edges:c,level:h,isMaxLevel:h===i}});return l.length===0?YM:l}function XM(e,n,r){const i=Ke(T.useCallback(o=>e?o.edges.filter(l=>{const u=n.get(l.source),c=n.get(l.target);return(u==null?void 0:u.width)&&(u==null?void 0:u.height)&&(c==null?void 0:c.width)&&(c==null?void 0:c.height)&&GM({sourcePos:u.positionAbsolute||{x:0,y:0},targetPos:c.positionAbsolute||{x:0,y:0},sourceWidth:u.width,sourceHeight:u.height,targetWidth:c.width,targetHeight:c.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[e,n]));return KM(i,n,r)}const QM=({color:e="none",strokeWidth:n=1})=>ue.createElement("polyline",{style:{stroke:e,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),ZM=({color:e="none",strokeWidth:n=1})=>ue.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),bx={[mu.Arrow]:QM,[mu.ArrowClosed]:ZM};function JM(e){const n=Ct();return T.useMemo(()=>{var o,l;return Object.prototype.hasOwnProperty.call(bx,e)?bx[e]:((l=(o=n.getState()).onError)==null||l.call(o,"009",Hr.error009(e)),null)},[e])}const eP=({id:e,type:n,color:r,width:i=12.5,height:o=12.5,markerUnits:l="strokeWidth",strokeWidth:u,orient:c="auto-start-reverse"})=>{const h=JM(n);return h?ue.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${i}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:c,refX:"0",refY:"0"},ue.createElement(h,{color:r,strokeWidth:u})):null},tP=({defaultColor:e,rfId:n})=>r=>{const i=[];return r.edges.reduce((o,l)=>([l.markerStart,l.markerEnd].forEach(u=>{if(u&&typeof u=="object"){const c=hv(u,n);i.includes(c)||(o.push({id:c,color:u.color||e,...u}),i.push(c))}}),o),[]).sort((o,l)=>o.id.localeCompare(l.id))},FN=({defaultColor:e,rfId:n})=>{const r=Ke(T.useCallback(tP({defaultColor:e,rfId:n}),[e,n]),(i,o)=>!(i.length!==o.length||i.some((l,u)=>l.id!==o[u].id)));return ue.createElement("defs",null,r.map(i=>ue.createElement(eP,{id:i.id,key:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient})))};FN.displayName="MarkerDefinitions";var nP=T.memo(FN);const rP=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),zN=({defaultMarkerColor:e,onlyRenderVisibleElements:n,elevateEdgesOnSelect:r,rfId:i,edgeTypes:o,noPanClassName:l,onEdgeContextMenu:u,onEdgeMouseEnter:c,onEdgeMouseMove:h,onEdgeMouseLeave:p,onEdgeClick:d,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:_,children:S,disableKeyboardA11y:b})=>{const{edgesFocusable:k,edgesUpdatable:E,elementsSelectable:C,width:A,height:M,connectionMode:L,nodeInternals:H,onError:O}=Ke(rP,Nt),P=XM(n,H,r);return A?ue.createElement(ue.Fragment,null,P.map(({level:F,edges:G,isMaxLevel:q})=>ue.createElement("svg",{key:F,style:{zIndex:F},width:A,height:M,className:"react-flow__edges react-flow__container"},q&&ue.createElement(nP,{defaultColor:e,rfId:i}),ue.createElement("g",null,G.map(R=>{const[Q,z,ne]=_x(H.get(R.source)),[Z,$,X]=_x(H.get(R.target));if(!ne||!X)return null;let I=R.type||"default";o[I]||(O==null||O("011",Hr.error011(I)),I="default");const W=o[I]||o.default,Y=L===ai.Strict?$.target:($.target??[]).concat($.source??[]),U=xx(z.source,R.sourceHandle),J=xx(Y,R.targetHandle),re=(U==null?void 0:U.position)||Ae.Bottom,le=(J==null?void 0:J.position)||Ae.Top,fe=!!(R.focusable||k&&typeof R.focusable>"u"),te=R.reconnectable||R.updatable,ce=typeof y<"u"&&(te||E&&typeof te>"u");if(!U||!J)return O==null||O("008",Hr.error008(U,R)),null;const{sourceX:Ce,sourceY:ve,targetX:Te,targetY:ye}=VM(Q,U,re,Z,J,le);return ue.createElement(W,{key:R.id,id:R.id,className:Bt([R.className,l]),type:I,data:R.data,selected:!!R.selected,animated:!!R.animated,hidden:!!R.hidden,label:R.label,labelStyle:R.labelStyle,labelShowBg:R.labelShowBg,labelBgStyle:R.labelBgStyle,labelBgPadding:R.labelBgPadding,labelBgBorderRadius:R.labelBgBorderRadius,style:R.style,source:R.source,target:R.target,sourceHandleId:R.sourceHandle,targetHandleId:R.targetHandle,markerEnd:R.markerEnd,markerStart:R.markerStart,sourceX:Ce,sourceY:ve,targetX:Te,targetY:ye,sourcePosition:re,targetPosition:le,elementsSelectable:C,onContextMenu:u,onMouseEnter:c,onMouseMove:h,onMouseLeave:p,onClick:d,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:_,rfId:i,ariaLabel:R.ariaLabel,isFocusable:fe,isReconnectable:ce,pathOptions:"pathOptions"in R?R.pathOptions:void 0,interactionWidth:R.interactionWidth,disableKeyboardA11y:b})})))),S):null};zN.displayName="EdgeRenderer";var sP=T.memo(zN);const iP=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function oP({children:e}){const n=Ke(iP);return ue.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:n}},e)}function aP(e){const n=Oa(),r=T.useRef(!1);T.useEffect(()=>{!r.current&&n.viewportInitialized&&e&&(setTimeout(()=>e(n),1),r.current=!0)},[e,n.viewportInitialized])}const lP={[Ae.Left]:Ae.Right,[Ae.Right]:Ae.Left,[Ae.Top]:Ae.Bottom,[Ae.Bottom]:Ae.Top},BN=({nodeId:e,handleType:n,style:r,type:i=_s.Bezier,CustomComponent:o,connectionStatus:l})=>{var M,L,H;const{fromNode:u,handleId:c,toX:h,toY:p,connectionMode:d}=Ke(T.useCallback(O=>({fromNode:O.nodeInternals.get(e),handleId:O.connectionHandleId,toX:(O.connectionPosition.x-O.transform[0])/O.transform[2],toY:(O.connectionPosition.y-O.transform[1])/O.transform[2],connectionMode:O.connectionMode}),[e]),Nt),m=(M=u==null?void 0:u[dt])==null?void 0:M.handleBounds;let y=m==null?void 0:m[n];if(d===ai.Loose&&(y=y||(m==null?void 0:m[n==="source"?"target":"source"])),!u||!y)return null;const w=c?y.find(O=>O.id===c):y[0],N=w?w.x+w.width/2:(u.width??0)/2,_=w?w.y+w.height/2:u.height??0,S=(((L=u.positionAbsolute)==null?void 0:L.x)??0)+N,b=(((H=u.positionAbsolute)==null?void 0:H.y)??0)+_,k=w==null?void 0:w.position,E=k?lP[k]:null;if(!k||!E)return null;if(o)return ue.createElement(o,{connectionLineType:i,connectionLineStyle:r,fromNode:u,fromHandle:w,fromX:S,fromY:b,toX:h,toY:p,fromPosition:k,toPosition:E,connectionStatus:l});let C="";const A={sourceX:S,sourceY:b,sourcePosition:k,targetX:h,targetY:p,targetPosition:E};return i===_s.Bezier?[C]=hN(A):i===_s.Step?[C]=fv({...A,borderRadius:0}):i===_s.SmoothStep?[C]=fv(A):i===_s.SimpleBezier?[C]=fN(A):C=`M${S},${b} ${h},${p}`,ue.createElement("path",{d:C,fill:"none",className:"react-flow__connection-path",style:r})};BN.displayName="ConnectionLine";const uP=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function cP({containerStyle:e,style:n,type:r,component:i}){const{nodeId:o,handleType:l,nodesConnectable:u,width:c,height:h,connectionStatus:p}=Ke(uP,Nt);return!(o&&l&&c&&u)?null:ue.createElement("svg",{style:e,width:c,height:h,className:"react-flow__edges react-flow__connectionline react-flow__container"},ue.createElement("g",{className:Bt(["react-flow__connection",p])},ue.createElement(BN,{nodeId:o,handleType:l,style:n,type:r,CustomComponent:i,connectionStatus:p})))}function Sx(e,n){return T.useRef(null),Ct(),T.useMemo(()=>n(e),[e])}const UN=({nodeTypes:e,edgeTypes:n,onMove:r,onMoveStart:i,onMoveEnd:o,onInit:l,onNodeClick:u,onEdgeClick:c,onNodeDoubleClick:h,onEdgeDoubleClick:p,onNodeMouseEnter:d,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,onSelectionContextMenu:N,onSelectionStart:_,onSelectionEnd:S,connectionLineType:b,connectionLineStyle:k,connectionLineComponent:E,connectionLineContainerStyle:C,selectionKeyCode:A,selectionOnDrag:M,selectionMode:L,multiSelectionKeyCode:H,panActivationKeyCode:O,zoomActivationKeyCode:P,deleteKeyCode:F,onlyRenderVisibleElements:G,elementsSelectable:q,selectNodesOnDrag:R,defaultViewport:Q,translateExtent:z,minZoom:ne,maxZoom:Z,preventScrolling:$,defaultMarkerColor:X,zoomOnScroll:I,zoomOnPinch:W,panOnScroll:Y,panOnScrollSpeed:U,panOnScrollMode:J,zoomOnDoubleClick:re,panOnDrag:le,onPaneClick:fe,onPaneMouseEnter:te,onPaneMouseMove:ce,onPaneMouseLeave:Ce,onPaneScroll:ve,onPaneContextMenu:Te,onEdgeContextMenu:ye,onEdgeMouseEnter:ke,onEdgeMouseMove:Ge,onEdgeMouseLeave:we,onReconnect:_e,onReconnectStart:ze,onReconnectEnd:ft,reconnectRadius:ht,noDragClassName:Ue,noWheelClassName:De,noPanClassName:Ze,elevateEdgesOnSelect:Ye,disableKeyboardA11y:vt,nodeOrigin:ot,nodeExtent:yt,rfId:Kt})=>{const Mt=Sx(e,$M),Xe=Sx(n,WM);return aP(l),ue.createElement(LM,{onPaneClick:fe,onPaneMouseEnter:te,onPaneMouseMove:ce,onPaneMouseLeave:Ce,onPaneContextMenu:Te,onPaneScroll:ve,deleteKeyCode:F,selectionKeyCode:A,selectionOnDrag:M,selectionMode:L,onSelectionStart:_,onSelectionEnd:S,multiSelectionKeyCode:H,panActivationKeyCode:O,zoomActivationKeyCode:P,elementsSelectable:q,onMove:r,onMoveStart:i,onMoveEnd:o,zoomOnScroll:I,zoomOnPinch:W,zoomOnDoubleClick:re,panOnScroll:Y,panOnScrollSpeed:U,panOnScrollMode:J,panOnDrag:le,defaultViewport:Q,translateExtent:z,minZoom:ne,maxZoom:Z,onSelectionContextMenu:N,preventScrolling:$,noDragClassName:Ue,noWheelClassName:De,noPanClassName:Ze,disableKeyboardA11y:vt},ue.createElement(oP,null,ue.createElement(sP,{edgeTypes:Xe,onEdgeClick:c,onEdgeDoubleClick:p,onlyRenderVisibleElements:G,onEdgeContextMenu:ye,onEdgeMouseEnter:ke,onEdgeMouseMove:Ge,onEdgeMouseLeave:we,onReconnect:_e,onReconnectStart:ze,onReconnectEnd:ft,reconnectRadius:ht,defaultMarkerColor:X,noPanClassName:Ze,elevateEdgesOnSelect:!!Ye,disableKeyboardA11y:vt,rfId:Kt},ue.createElement(cP,{style:k,type:b,component:E,containerStyle:C})),ue.createElement("div",{className:"react-flow__edgelabel-renderer"}),ue.createElement(zM,{nodeTypes:Mt,onNodeClick:u,onNodeDoubleClick:h,onNodeMouseEnter:d,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,selectNodesOnDrag:R,onlyRenderVisibleElements:G,noPanClassName:Ze,noDragClassName:Ue,disableKeyboardA11y:vt,nodeOrigin:ot,nodeExtent:yt,rfId:Kt})))};UN.displayName="GraphView";var dP=T.memo(UN);const vv=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ys={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:vv,nodeExtent:vv,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:ai.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:$I,isValidConnection:void 0},fP=()=>ZR((e,n)=>({...ys,setNodes:r=>{const{nodeInternals:i,nodeOrigin:o,elevateNodesOnSelect:l}=n();e({nodeInternals:Td(r,i,o,l)})},getNodes:()=>Array.from(n().nodeInternals.values()),setEdges:r=>{const{defaultEdgeOptions:i={}}=n();e({edges:r.map(o=>({...i,...o}))})},setDefaultNodesAndEdges:(r,i)=>{const o=typeof r<"u",l=typeof i<"u",u=o?Td(r,new Map,n().nodeOrigin,n().elevateNodesOnSelect):new Map;e({nodeInternals:u,edges:l?i:[],hasDefaultNodes:o,hasDefaultEdges:l})},updateNodeDimensions:r=>{const{onNodesChange:i,nodeInternals:o,fitViewOnInit:l,fitViewOnInitDone:u,fitViewOnInitOptions:c,domNode:h,nodeOrigin:p}=n(),d=h==null?void 0:h.querySelector(".react-flow__viewport");if(!d)return;const m=window.getComputedStyle(d),{m22:y}=new window.DOMMatrixReadOnly(m.transform),w=r.reduce((_,S)=>{const b=o.get(S.id);if(b!=null&&b.hidden)o.set(b.id,{...b,[dt]:{...b[dt],handleBounds:void 0}});else if(b){const k=Lv(S.nodeElement);!!(k.width&&k.height&&(b.width!==k.width||b.height!==k.height||S.forceUpdate))&&(o.set(b.id,{...b,[dt]:{...b[dt],handleBounds:{source:gx(".source",S.nodeElement,y,p),target:gx(".target",S.nodeElement,y,p)}},...k}),_.push({id:b.id,type:"dimensions",dimensions:k}))}return _},[]);AN(o,p);const N=u||l&&!u&&IN(n,{initial:!0,...c});e({nodeInternals:new Map(o),fitViewOnInitDone:N}),(w==null?void 0:w.length)>0&&(i==null||i(w))},updateNodePositions:(r,i=!0,o=!1)=>{const{triggerNodeChanges:l}=n(),u=r.map(c=>{const h={id:c.id,type:"position",dragging:o};return i&&(h.positionAbsolute=c.positionAbsolute,h.position=c.position),h});l(u)},triggerNodeChanges:r=>{const{onNodesChange:i,nodeInternals:o,hasDefaultNodes:l,nodeOrigin:u,getNodes:c,elevateNodesOnSelect:h}=n();if(r!=null&&r.length){if(l){const p=CM(r,c()),d=Td(p,o,u,h);e({nodeInternals:d})}i==null||i(r)}},addSelectedNodes:r=>{const{multiSelectionActive:i,edges:o,getNodes:l}=n();let u,c=null;i?u=r.map(h=>xs(h,!0)):(u=ro(l(),r),c=ro(o,[])),Gl({changedNodes:u,changedEdges:c,get:n,set:e})},addSelectedEdges:r=>{const{multiSelectionActive:i,edges:o,getNodes:l}=n();let u,c=null;i?u=r.map(h=>xs(h,!0)):(u=ro(o,r),c=ro(l(),[])),Gl({changedNodes:c,changedEdges:u,get:n,set:e})},unselectNodesAndEdges:({nodes:r,edges:i}={})=>{const{edges:o,getNodes:l}=n(),u=r||l(),c=i||o,h=u.map(d=>(d.selected=!1,xs(d.id,!1))),p=c.map(d=>xs(d.id,!1));Gl({changedNodes:h,changedEdges:p,get:n,set:e})},setMinZoom:r=>{const{d3Zoom:i,maxZoom:o}=n();i==null||i.scaleExtent([r,o]),e({minZoom:r})},setMaxZoom:r=>{const{d3Zoom:i,minZoom:o}=n();i==null||i.scaleExtent([o,r]),e({maxZoom:r})},setTranslateExtent:r=>{var i;(i=n().d3Zoom)==null||i.translateExtent(r),e({translateExtent:r})},resetSelectedElements:()=>{const{edges:r,getNodes:i}=n(),l=i().filter(c=>c.selected).map(c=>xs(c.id,!1)),u=r.filter(c=>c.selected).map(c=>xs(c.id,!1));Gl({changedNodes:l,changedEdges:u,get:n,set:e})},setNodeExtent:r=>{const{nodeInternals:i}=n();i.forEach(o=>{o.positionAbsolute=qv(o.position,r)}),e({nodeExtent:r,nodeInternals:new Map(i)})},panBy:r=>{const{transform:i,width:o,height:l,d3Zoom:u,d3Selection:c,translateExtent:h}=n();if(!u||!c||!r.x&&!r.y)return!1;const p=Br.translate(i[0]+r.x,i[1]+r.y).scale(i[2]),d=[[0,0],[o,l]],m=u==null?void 0:u.constrain()(p,d,h);return u.transform(c,m),i[0]!==m.x||i[1]!==m.y||i[2]!==m.k},cancelConnection:()=>e({connectionNodeId:ys.connectionNodeId,connectionHandleId:ys.connectionHandleId,connectionHandleType:ys.connectionHandleType,connectionStatus:ys.connectionStatus,connectionStartHandle:ys.connectionStartHandle,connectionEndHandle:ys.connectionEndHandle}),reset:()=>e({...ys})}),Object.is),Wv=({children:e})=>{const n=T.useRef(null);return n.current||(n.current=fP()),ue.createElement(AI,{value:n.current},e)};Wv.displayName="ReactFlowProvider";const HN=({children:e})=>T.useContext(Eu)?ue.createElement(ue.Fragment,null,e):ue.createElement(Wv,null,e);HN.displayName="ReactFlowWrapper";const hP={input:kN,default:mv,output:NN,group:Uv},pP={default:gu,straight:Fv,step:Dv,smoothstep:Nu,simplebezier:$v},mP=[0,0],gP=[15,15],vP={x:0,y:0,zoom:1},yP={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},WN=T.forwardRef(({nodes:e,edges:n,defaultNodes:r,defaultEdges:i,className:o,nodeTypes:l=hP,edgeTypes:u=pP,onNodeClick:c,onEdgeClick:h,onInit:p,onMove:d,onMoveStart:m,onMoveEnd:y,onConnect:w,onConnectStart:N,onConnectEnd:_,onClickConnectStart:S,onClickConnectEnd:b,onNodeMouseEnter:k,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:A,onNodeDoubleClick:M,onNodeDragStart:L,onNodeDrag:H,onNodeDragStop:O,onNodesDelete:P,onEdgesDelete:F,onSelectionChange:G,onSelectionDragStart:q,onSelectionDrag:R,onSelectionDragStop:Q,onSelectionContextMenu:z,onSelectionStart:ne,onSelectionEnd:Z,connectionMode:$=ai.Strict,connectionLineType:X=_s.Bezier,connectionLineStyle:I,connectionLineComponent:W,connectionLineContainerStyle:Y,deleteKeyCode:U="Backspace",selectionKeyCode:J="Shift",selectionOnDrag:re=!1,selectionMode:le=Ca.Full,panActivationKeyCode:fe="Space",multiSelectionKeyCode:te=pu()?"Meta":"Control",zoomActivationKeyCode:ce=pu()?"Meta":"Control",snapToGrid:Ce=!1,snapGrid:ve=gP,onlyRenderVisibleElements:Te=!1,selectNodesOnDrag:ye=!0,nodesDraggable:ke,nodesConnectable:Ge,nodesFocusable:we,nodeOrigin:_e=mP,edgesFocusable:ze,edgesUpdatable:ft,elementsSelectable:ht,defaultViewport:Ue=vP,minZoom:De=.5,maxZoom:Ze=2,translateExtent:Ye=vv,preventScrolling:vt=!0,nodeExtent:ot,defaultMarkerColor:yt="#b1b1b7",zoomOnScroll:Kt=!0,zoomOnPinch:Mt=!0,panOnScroll:Xe=!1,panOnScrollSpeed:wt=.5,panOnScrollMode:pt=ri.Free,zoomOnDoubleClick:mt=!0,panOnDrag:_n=!0,onPaneClick:Xt,onPaneMouseEnter:Pt,onPaneMouseMove:Qt,onPaneMouseLeave:yr,onPaneScroll:bn,onPaneContextMenu:Zt,children:pn,onEdgeContextMenu:Sn,onEdgeDoubleClick:Gr,onEdgeMouseEnter:ut,onEdgeMouseMove:hi,onEdgeMouseLeave:nr,onEdgeUpdate:Es,onEdgeUpdateStart:pi,onEdgeUpdateEnd:Jt,onReconnect:rr,onReconnectStart:wr,onReconnectEnd:So,reconnectRadius:sr=10,edgeUpdaterRadius:xr=10,onNodesChange:mn,onEdgesChange:Yr,noDragClassName:mi="nodrag",noWheelClassName:Kr="nowheel",noPanClassName:Ns="nopan",fitView:gn=!1,fitViewOptions:jt,connectOnClick:_r=!0,attributionPosition:Xr,proOptions:en,defaultEdgeOptions:Qr,elevateNodesOnSelect:Cs=!0,elevateEdgesOnSelect:gi=!1,disableKeyboardA11y:ir=!1,autoPanOnConnect:vi=!0,autoPanOnNodeDrag:Je=!0,connectionRadius:ko=20,isValidConnection:br,onError:js,style:or,id:$n,nodeDragThreshold:yi,...Ot},Ut)=>{const Sr=$n||"1";return ue.createElement("div",{...Ot,style:{...or,...yP},ref:Ut,className:Bt(["react-flow",o]),"data-testid":"rf__wrapper",id:$n},ue.createElement(HN,null,ue.createElement(dP,{onInit:p,onMove:d,onMoveStart:m,onMoveEnd:y,onNodeClick:c,onEdgeClick:h,onNodeMouseEnter:k,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:A,onNodeDoubleClick:M,nodeTypes:l,edgeTypes:u,connectionLineType:X,connectionLineStyle:I,connectionLineComponent:W,connectionLineContainerStyle:Y,selectionKeyCode:J,selectionOnDrag:re,selectionMode:le,deleteKeyCode:U,multiSelectionKeyCode:te,panActivationKeyCode:fe,zoomActivationKeyCode:ce,onlyRenderVisibleElements:Te,selectNodesOnDrag:ye,defaultViewport:Ue,translateExtent:Ye,minZoom:De,maxZoom:Ze,preventScrolling:vt,zoomOnScroll:Kt,zoomOnPinch:Mt,zoomOnDoubleClick:mt,panOnScroll:Xe,panOnScrollSpeed:wt,panOnScrollMode:pt,panOnDrag:_n,onPaneClick:Xt,onPaneMouseEnter:Pt,onPaneMouseMove:Qt,onPaneMouseLeave:yr,onPaneScroll:bn,onPaneContextMenu:Zt,onSelectionContextMenu:z,onSelectionStart:ne,onSelectionEnd:Z,onEdgeContextMenu:Sn,onEdgeDoubleClick:Gr,onEdgeMouseEnter:ut,onEdgeMouseMove:hi,onEdgeMouseLeave:nr,onReconnect:rr??Es,onReconnectStart:wr??pi,onReconnectEnd:So??Jt,reconnectRadius:sr??xr,defaultMarkerColor:yt,noDragClassName:mi,noWheelClassName:Kr,noPanClassName:Ns,elevateEdgesOnSelect:gi,rfId:Sr,disableKeyboardA11y:ir,nodeOrigin:_e,nodeExtent:ot}),ue.createElement(aM,{nodes:e,edges:n,defaultNodes:r,defaultEdges:i,onConnect:w,onConnectStart:N,onConnectEnd:_,onClickConnectStart:S,onClickConnectEnd:b,nodesDraggable:ke,nodesConnectable:Ge,nodesFocusable:we,edgesFocusable:ze,edgesUpdatable:ft,elementsSelectable:ht,elevateNodesOnSelect:Cs,minZoom:De,maxZoom:Ze,nodeExtent:ot,onNodesChange:mn,onEdgesChange:Yr,snapToGrid:Ce,snapGrid:ve,connectionMode:$,translateExtent:Ye,connectOnClick:_r,defaultEdgeOptions:Qr,fitView:gn,fitViewOptions:jt,onNodesDelete:P,onEdgesDelete:F,onNodeDragStart:L,onNodeDrag:H,onNodeDragStop:O,onSelectionDrag:R,onSelectionDragStart:q,onSelectionDragStop:Q,noPanClassName:Ns,nodeOrigin:_e,rfId:Sr,autoPanOnConnect:vi,autoPanOnNodeDrag:Je,onError:js,connectionRadius:ko,isValidConnection:br,nodeDragThreshold:yi}),ue.createElement(iM,{onSelectionChange:G}),pn,ue.createElement(MI,{proOptions:en,position:Xr}),ue.createElement(fM,{rfId:Sr,disableKeyboardA11y:ir})))});WN.displayName="ReactFlow";const wP=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function VN(){return Ke(wP,Nt)}const GN=({id:e,x:n,y:r,width:i,height:o,style:l,color:u,strokeColor:c,strokeWidth:h,className:p,borderRadius:d,shapeRendering:m,onClick:y,selected:w})=>{const{background:N,backgroundColor:_}=l||{},S=u||N||_;return ue.createElement("rect",{className:Bt(["react-flow__minimap-node",{selected:w},p]),x:n,y:r,rx:d,ry:d,width:i,height:o,fill:S,stroke:c,strokeWidth:h,shapeRendering:m,onClick:y?b=>y(b,e):void 0})};GN.displayName="MiniMapNode";var xP=T.memo(GN);const _P=e=>e.nodeOrigin,bP=e=>e.getNodes().filter(n=>!n.hidden&&n.width&&n.height),Pd=e=>e instanceof Function?e:()=>e;function SP({nodeStrokeColor:e="transparent",nodeColor:n="#e2e2e2",nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:o=2,nodeComponent:l=xP,onClick:u}){const c=Ke(bP,Nt),h=Ke(_P),p=Pd(n),d=Pd(e),m=Pd(r),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return ue.createElement(ue.Fragment,null,c.map(w=>{const{x:N,y:_}=ii(w,h).positionAbsolute;return ue.createElement(l,{key:w.id,x:N,y:_,width:w.width,height:w.height,style:w.style,selected:w.selected,className:m(w),color:p(w),borderRadius:i,strokeColor:d(w),strokeWidth:o,shapeRendering:y,onClick:u,id:w.id})}))}var kP=T.memo(SP);const EP=200,NP=150,CP=e=>{const n=e.getNodes(),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:n.length>0?LI(Cu(n,e.nodeOrigin),r):r,rfId:e.rfId}},jP="react-flow__minimap-desc";function YN({style:e,className:n,nodeStrokeColor:r="transparent",nodeColor:i="#e2e2e2",nodeClassName:o="",nodeBorderRadius:l=5,nodeStrokeWidth:u=2,nodeComponent:c,maskColor:h="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:d=1,position:m="bottom-right",onClick:y,onNodeClick:w,pannable:N=!1,zoomable:_=!1,ariaLabel:S="React Flow mini map",inversePan:b=!1,zoomStep:k=10,offsetScale:E=5}){const C=Ct(),A=T.useRef(null),{boundingRect:M,viewBB:L,rfId:H}=Ke(CP,Nt),O=(e==null?void 0:e.width)??EP,P=(e==null?void 0:e.height)??NP,F=M.width/O,G=M.height/P,q=Math.max(F,G),R=q*O,Q=q*P,z=E*q,ne=M.x-(R-M.width)/2-z,Z=M.y-(Q-M.height)/2-z,$=R+z*2,X=Q+z*2,I=`${jP}-${H}`,W=T.useRef(0);W.current=q,T.useEffect(()=>{if(A.current){const J=Pn(A.current),re=te=>{const{transform:ce,d3Selection:Ce,d3Zoom:ve}=C.getState();if(te.sourceEvent.type!=="wheel"||!Ce||!ve)return;const Te=-te.sourceEvent.deltaY*(te.sourceEvent.deltaMode===1?.05:te.sourceEvent.deltaMode?1:.002)*k,ye=ce[2]*Math.pow(2,Te);ve.scaleTo(Ce,ye)},le=te=>{const{transform:ce,d3Selection:Ce,d3Zoom:ve,translateExtent:Te,width:ye,height:ke}=C.getState();if(te.sourceEvent.type!=="mousemove"||!Ce||!ve)return;const Ge=W.current*Math.max(1,ce[2])*(b?-1:1),we={x:ce[0]-te.sourceEvent.movementX*Ge,y:ce[1]-te.sourceEvent.movementY*Ge},_e=[[0,0],[ye,ke]],ze=Br.translate(we.x,we.y).scale(ce[2]),ft=ve.constrain()(ze,_e,Te);ve.transform(Ce,ft)},fe=nN().on("zoom",N?le:null).on("zoom.wheel",_?re:null);return J.call(fe),()=>{J.on("zoom",null)}}},[N,_,b,k]);const Y=y?J=>{const re=Xn(J);y(J,{x:re[0],y:re[1]})}:void 0,U=w?(J,re)=>{const le=C.getState().nodeInternals.get(re);w(J,le)}:void 0;return ue.createElement(Ov,{position:m,style:e,className:Bt(["react-flow__minimap",n]),"data-testid":"rf__minimap"},ue.createElement("svg",{width:O,height:P,viewBox:`${ne} ${Z} ${$} ${X}`,role:"img","aria-labelledby":I,ref:A,onClick:Y},S&&ue.createElement("title",{id:I},S),ue.createElement(kP,{onClick:U,nodeColor:i,nodeStrokeColor:r,nodeBorderRadius:l,nodeClassName:o,nodeStrokeWidth:u,nodeComponent:c}),ue.createElement("path",{className:"react-flow__minimap-mask",d:`M${ne-z},${Z-z}h${$+z*2}v${X+z*2}h${-$-z*2}z
|
|
56
|
+
*/var Mw;function UR(){if(Mw)return bd;Mw=1;var e=Aa(),n=BR();function r(p,d){return p===d&&(p!==0||1/p===1/d)||p!==p&&d!==d}var i=typeof Object.is=="function"?Object.is:r,o=n.useSyncExternalStore,l=e.useRef,u=e.useEffect,c=e.useMemo,h=e.useDebugValue;return bd.useSyncExternalStoreWithSelector=function(p,d,m,y,w){var N=l(null);if(N.current===null){var _={hasValue:!1,value:null};N.current=_}else _=N.current;N=c(function(){function b(M){if(!k){if(k=!0,E=M,M=y(M),w!==void 0&&_.hasValue){var L=_.value;if(w(L,M))return C=L}return C=M}if(L=C,i(E,M))return L;var H=y(M);return w!==void 0&&w(L,H)?(E=M,L):(E=M,C=H)}var k=!1,E,C,A=m===void 0?null:m;return[function(){return b(d())},A===null?void 0:function(){return b(A())}]},[d,m,y,w]);var S=o(p,N[0],N[1]);return u(function(){_.hasValue=!0,_.value=S},[S]),h(S),S},bd}var Pw;function HR(){return Pw||(Pw=1,_d.exports=UR()),_d.exports}var WR=HR();const VR=jv(WR),GR={},Ow=e=>{let n;const r=new Set,i=(d,m)=>{const y=typeof d=="function"?d(n):d;if(!Object.is(y,n)){const w=n;n=m??(typeof y!="object"||y===null)?y:Object.assign({},n,y),r.forEach(N=>N(n,w))}},o=()=>n,h={setState:i,getState:o,getInitialState:()=>p,subscribe:d=>(r.add(d),()=>r.delete(d)),destroy:()=>{(GR?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},p=n=e(i,o,h);return h},YR=e=>e?Ow(e):Ow,{useDebugValue:KR}=ue,{useSyncExternalStoreWithSelector:XR}=VR,QR=e=>e;function jE(e,n=QR,r){const i=XR(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,r);return KR(i),i}const Lw=(e,n)=>{const r=YR(e),i=(o,l=n)=>jE(r,o,l);return Object.assign(i,r),i},ZR=(e,n)=>e?Lw(e,n):Lw;function Nt(e,n){if(Object.is(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[i,o]of e)if(!Object.is(o,n.get(i)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const i of e)if(!n.has(i))return!1;return!0}const r=Object.keys(e);if(r.length!==Object.keys(n).length)return!1;for(const i of r)if(!Object.prototype.hasOwnProperty.call(n,i)||!Object.is(e[i],n[i]))return!1;return!0}var JR={value:()=>{}};function _u(){for(var e=0,n=arguments.length,r={},i;e<n;++e){if(!(i=arguments[e]+"")||i in r||/[\s.]/.test(i))throw new Error("illegal type: "+i);r[i]=[]}return new ru(r)}function ru(e){this._=e}function eT(e,n){return e.trim().split(/^|\s+/).map(function(r){var i="",o=r.indexOf(".");if(o>=0&&(i=r.slice(o+1),r=r.slice(0,o)),r&&!n.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}ru.prototype=_u.prototype={constructor:ru,on:function(e,n){var r=this._,i=eT(e+"",r),o,l=-1,u=i.length;if(arguments.length<2){for(;++l<u;)if((o=(e=i[l]).type)&&(o=tT(r[o],e.name)))return o;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++l<u;)if(o=(e=i[l]).type)r[o]=qw(r[o],e.name,n);else if(n==null)for(o in r)r[o]=qw(r[o],e.name,null);return this},copy:function(){var e={},n=this._;for(var r in n)e[r]=n[r].slice();return new ru(e)},call:function(e,n){if((o=arguments.length-2)>0)for(var r=new Array(o),i=0,o,l;i<o;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],i=0,o=l.length;i<o;++i)l[i].value.apply(n,r)},apply:function(e,n,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],o=0,l=i.length;o<l;++o)i[o].value.apply(n,r)}};function tT(e,n){for(var r=0,i=e.length,o;r<i;++r)if((o=e[r]).name===n)return o.value}function qw(e,n,r){for(var i=0,o=e.length;i<o;++i)if(e[i].name===n){e[i]=JR,e=e.slice(0,i).concat(e.slice(i+1));break}return r!=null&&e.push({name:n,value:r}),e}var nv="http://www.w3.org/1999/xhtml";const $w={svg:"http://www.w3.org/2000/svg",xhtml:nv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function bu(e){var n=e+="",r=n.indexOf(":");return r>=0&&(n=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),$w.hasOwnProperty(n)?{space:$w[n],local:e}:e}function nT(e){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===nv&&n.documentElement.namespaceURI===nv?n.createElement(e):n.createElementNS(r,e)}}function rT(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function RE(e){var n=bu(e);return(n.local?rT:nT)(n)}function sT(){}function Rv(e){return e==null?sT:function(){return this.querySelector(e)}}function iT(e){typeof e!="function"&&(e=Rv(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o)for(var l=n[o],u=l.length,c=i[o]=new Array(u),h,p,d=0;d<u;++d)(h=l[d])&&(p=e.call(h,h.__data__,d,l))&&("__data__"in h&&(p.__data__=h.__data__),c[d]=p);return new xn(i,this._parents)}function oT(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function aT(){return[]}function TE(e){return e==null?aT:function(){return this.querySelectorAll(e)}}function lT(e){return function(){return oT(e.apply(this,arguments))}}function uT(e){typeof e=="function"?e=lT(e):e=TE(e);for(var n=this._groups,r=n.length,i=[],o=[],l=0;l<r;++l)for(var u=n[l],c=u.length,h,p=0;p<c;++p)(h=u[p])&&(i.push(e.call(h,h.__data__,p,u)),o.push(h));return new xn(i,o)}function AE(e){return function(){return this.matches(e)}}function IE(e){return function(n){return n.matches(e)}}var cT=Array.prototype.find;function dT(e){return function(){return cT.call(this.children,e)}}function fT(){return this.firstElementChild}function hT(e){return this.select(e==null?fT:dT(typeof e=="function"?e:IE(e)))}var pT=Array.prototype.filter;function mT(){return Array.from(this.children)}function gT(e){return function(){return pT.call(this.children,e)}}function vT(e){return this.selectAll(e==null?mT:gT(typeof e=="function"?e:IE(e)))}function yT(e){typeof e!="function"&&(e=AE(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o)for(var l=n[o],u=l.length,c=i[o]=[],h,p=0;p<u;++p)(h=l[p])&&e.call(h,h.__data__,p,l)&&c.push(h);return new xn(i,this._parents)}function ME(e){return new Array(e.length)}function wT(){return new xn(this._enter||this._groups.map(ME),this._parents)}function lu(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}lu.prototype={constructor:lu,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function xT(e){return function(){return e}}function _T(e,n,r,i,o,l){for(var u=0,c,h=n.length,p=l.length;u<p;++u)(c=n[u])?(c.__data__=l[u],i[u]=c):r[u]=new lu(e,l[u]);for(;u<h;++u)(c=n[u])&&(o[u]=c)}function bT(e,n,r,i,o,l,u){var c,h,p=new Map,d=n.length,m=l.length,y=new Array(d),w;for(c=0;c<d;++c)(h=n[c])&&(y[c]=w=u.call(h,h.__data__,c,n)+"",p.has(w)?o[c]=h:p.set(w,h));for(c=0;c<m;++c)w=u.call(e,l[c],c,l)+"",(h=p.get(w))?(i[c]=h,h.__data__=l[c],p.delete(w)):r[c]=new lu(e,l[c]);for(c=0;c<d;++c)(h=n[c])&&p.get(y[c])===h&&(o[c]=h)}function ST(e){return e.__data__}function kT(e,n){if(!arguments.length)return Array.from(this,ST);var r=n?bT:_T,i=this._parents,o=this._groups;typeof e!="function"&&(e=xT(e));for(var l=o.length,u=new Array(l),c=new Array(l),h=new Array(l),p=0;p<l;++p){var d=i[p],m=o[p],y=m.length,w=ET(e.call(d,d&&d.__data__,p,i)),N=w.length,_=c[p]=new Array(N),S=u[p]=new Array(N),b=h[p]=new Array(y);r(d,m,_,S,b,w,n);for(var k=0,E=0,C,A;k<N;++k)if(C=_[k]){for(k>=E&&(E=k+1);!(A=S[E])&&++E<N;);C._next=A||null}}return u=new xn(u,i),u._enter=c,u._exit=h,u}function ET(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function NT(){return new xn(this._exit||this._groups.map(ME),this._parents)}function CT(e,n,r){var i=this.enter(),o=this,l=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),n!=null&&(o=n(o),o&&(o=o.selection())),r==null?l.remove():r(l),i&&o?i.merge(o).order():o}function jT(e){for(var n=e.selection?e.selection():e,r=this._groups,i=n._groups,o=r.length,l=i.length,u=Math.min(o,l),c=new Array(o),h=0;h<u;++h)for(var p=r[h],d=i[h],m=p.length,y=c[h]=new Array(m),w,N=0;N<m;++N)(w=p[N]||d[N])&&(y[N]=w);for(;h<o;++h)c[h]=r[h];return new xn(c,this._parents)}function RT(){for(var e=this._groups,n=-1,r=e.length;++n<r;)for(var i=e[n],o=i.length-1,l=i[o],u;--o>=0;)(u=i[o])&&(l&&u.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(u,l),l=u);return this}function TT(e){e||(e=AT);function n(m,y){return m&&y?e(m.__data__,y.__data__):!m-!y}for(var r=this._groups,i=r.length,o=new Array(i),l=0;l<i;++l){for(var u=r[l],c=u.length,h=o[l]=new Array(c),p,d=0;d<c;++d)(p=u[d])&&(h[d]=p);h.sort(n)}return new xn(o,this._parents).order()}function AT(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function IT(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function MT(){return Array.from(this)}function PT(){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,l=i.length;o<l;++o){var u=i[o];if(u)return u}return null}function OT(){let e=0;for(const n of this)++e;return e}function LT(){return!this.node()}function qT(e){for(var n=this._groups,r=0,i=n.length;r<i;++r)for(var o=n[r],l=0,u=o.length,c;l<u;++l)(c=o[l])&&e.call(c,c.__data__,l,o);return this}function $T(e){return function(){this.removeAttribute(e)}}function DT(e){return function(){this.removeAttributeNS(e.space,e.local)}}function FT(e,n){return function(){this.setAttribute(e,n)}}function zT(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function BT(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function UT(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function HT(e,n){var r=bu(e);if(arguments.length<2){var i=this.node();return r.local?i.getAttributeNS(r.space,r.local):i.getAttribute(r)}return this.each((n==null?r.local?DT:$T:typeof n=="function"?r.local?UT:BT:r.local?zT:FT)(r,n))}function PE(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function WT(e){return function(){this.style.removeProperty(e)}}function VT(e,n,r){return function(){this.style.setProperty(e,n,r)}}function GT(e,n,r){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,r)}}function YT(e,n,r){return arguments.length>1?this.each((n==null?WT:typeof n=="function"?GT:VT)(e,n,r??"")):co(this.node(),e)}function co(e,n){return e.style.getPropertyValue(n)||PE(e).getComputedStyle(e,null).getPropertyValue(n)}function KT(e){return function(){delete this[e]}}function XT(e,n){return function(){this[e]=n}}function QT(e,n){return function(){var r=n.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function ZT(e,n){return arguments.length>1?this.each((n==null?KT:typeof n=="function"?QT:XT)(e,n)):this.node()[e]}function OE(e){return e.trim().split(/^|\s+/)}function Tv(e){return e.classList||new LE(e)}function LE(e){this._node=e,this._names=OE(e.getAttribute("class")||"")}LE.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function qE(e,n){for(var r=Tv(e),i=-1,o=n.length;++i<o;)r.add(n[i])}function $E(e,n){for(var r=Tv(e),i=-1,o=n.length;++i<o;)r.remove(n[i])}function JT(e){return function(){qE(this,e)}}function e2(e){return function(){$E(this,e)}}function t2(e,n){return function(){(n.apply(this,arguments)?qE:$E)(this,e)}}function n2(e,n){var r=OE(e+"");if(arguments.length<2){for(var i=Tv(this.node()),o=-1,l=r.length;++o<l;)if(!i.contains(r[o]))return!1;return!0}return this.each((typeof n=="function"?t2:n?JT:e2)(r,n))}function r2(){this.textContent=""}function s2(e){return function(){this.textContent=e}}function i2(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function o2(e){return arguments.length?this.each(e==null?r2:(typeof e=="function"?i2:s2)(e)):this.node().textContent}function a2(){this.innerHTML=""}function l2(e){return function(){this.innerHTML=e}}function u2(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function c2(e){return arguments.length?this.each(e==null?a2:(typeof e=="function"?u2:l2)(e)):this.node().innerHTML}function d2(){this.nextSibling&&this.parentNode.appendChild(this)}function f2(){return this.each(d2)}function h2(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function p2(){return this.each(h2)}function m2(e){var n=typeof e=="function"?e:RE(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function g2(){return null}function v2(e,n){var r=typeof e=="function"?e:RE(e),i=n==null?g2:typeof n=="function"?n:Rv(n);return this.select(function(){return this.insertBefore(r.apply(this,arguments),i.apply(this,arguments)||null)})}function y2(){var e=this.parentNode;e&&e.removeChild(this)}function w2(){return this.each(y2)}function x2(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function _2(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function b2(e){return this.select(e?_2:x2)}function S2(e){return arguments.length?this.property("__data__",e):this.node().__data__}function k2(e){return function(n){e.call(this,n,this.__data__)}}function E2(e){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");return i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),{type:n,name:r}})}function N2(e){return function(){var n=this.__on;if(n){for(var r=0,i=-1,o=n.length,l;r<o;++r)l=n[r],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):n[++i]=l;++i?n.length=i:delete this.__on}}}function C2(e,n,r){return function(){var i=this.__on,o,l=k2(n);if(i){for(var u=0,c=i.length;u<c;++u)if((o=i[u]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=l,o.options=r),o.value=n;return}}this.addEventListener(e.type,l,r),o={type:e.type,name:e.name,value:n,listener:l,options:r},i?i.push(o):this.__on=[o]}}function j2(e,n,r){var i=E2(e+""),o,l=i.length,u;if(arguments.length<2){var c=this.node().__on;if(c){for(var h=0,p=c.length,d;h<p;++h)for(o=0,d=c[h];o<l;++o)if((u=i[o]).type===d.type&&u.name===d.name)return d.value}return}for(c=n?C2:N2,o=0;o<l;++o)this.each(c(i[o],n,r));return this}function DE(e,n,r){var i=PE(e),o=i.CustomEvent;typeof o=="function"?o=new o(n,r):(o=i.document.createEvent("Event"),r?(o.initEvent(n,r.bubbles,r.cancelable),o.detail=r.detail):o.initEvent(n,!1,!1)),e.dispatchEvent(o)}function R2(e,n){return function(){return DE(this,e,n)}}function T2(e,n){return function(){return DE(this,e,n.apply(this,arguments))}}function A2(e,n){return this.each((typeof n=="function"?T2:R2)(e,n))}function*I2(){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,l=i.length,u;o<l;++o)(u=i[o])&&(yield u)}var FE=[null];function xn(e,n){this._groups=e,this._parents=n}function Ia(){return new xn([[document.documentElement]],FE)}function M2(){return this}xn.prototype=Ia.prototype={constructor:xn,select:iT,selectAll:uT,selectChild:hT,selectChildren:vT,filter:yT,data:kT,enter:wT,exit:NT,join:CT,merge:jT,selection:M2,order:RT,sort:TT,call:IT,nodes:MT,node:PT,size:OT,empty:LT,each:qT,attr:HT,style:YT,property:ZT,classed:n2,text:o2,html:c2,raise:f2,lower:p2,append:m2,insert:v2,remove:w2,clone:b2,datum:S2,on:j2,dispatch:A2,[Symbol.iterator]:I2};function Pn(e){return typeof e=="string"?new xn([[document.querySelector(e)]],[document.documentElement]):new xn([[e]],FE)}function P2(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Xn(e,n){if(e=P2(e),n===void 0&&(n=e.currentTarget),n){var r=n.ownerSVGElement||n;if(r.createSVGPoint){var i=r.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}if(n.getBoundingClientRect){var o=n.getBoundingClientRect();return[e.clientX-o.left-n.clientLeft,e.clientY-o.top-n.clientTop]}}return[e.pageX,e.pageY]}const O2={passive:!1},_a={capture:!0,passive:!1};function Ed(e){e.stopImmediatePropagation()}function oo(e){e.preventDefault(),e.stopImmediatePropagation()}function zE(e){var n=e.document.documentElement,r=Pn(e).on("dragstart.drag",oo,_a);"onselectstart"in n?r.on("selectstart.drag",oo,_a):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function BE(e,n){var r=e.document.documentElement,i=Pn(e).on("dragstart.drag",null);n&&(i.on("click.drag",oo,_a),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in r?i.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}const Fl=e=>()=>e;function rv(e,{sourceEvent:n,subject:r,target:i,identifier:o,active:l,x:u,y:c,dx:h,dy:p,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:u,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:h,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:d}})}rv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function L2(e){return!e.ctrlKey&&!e.button}function q2(){return this.parentNode}function $2(e,n){return n??{x:e.x,y:e.y}}function D2(){return navigator.maxTouchPoints||"ontouchstart"in this}function F2(){var e=L2,n=q2,r=$2,i=D2,o={},l=_u("start","drag","end"),u=0,c,h,p,d,m=0;function y(C){C.on("mousedown.drag",w).filter(i).on("touchstart.drag",S).on("touchmove.drag",b,O2).on("touchend.drag touchcancel.drag",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(C,A){if(!(d||!e.call(this,C,A))){var M=E(this,n.call(this,C,A),C,A,"mouse");M&&(Pn(C.view).on("mousemove.drag",N,_a).on("mouseup.drag",_,_a),zE(C.view),Ed(C),p=!1,c=C.clientX,h=C.clientY,M("start",C))}}function N(C){if(oo(C),!p){var A=C.clientX-c,M=C.clientY-h;p=A*A+M*M>m}o.mouse("drag",C)}function _(C){Pn(C.view).on("mousemove.drag mouseup.drag",null),BE(C.view,p),oo(C),o.mouse("end",C)}function S(C,A){if(e.call(this,C,A)){var M=C.changedTouches,L=n.call(this,C,A),H=M.length,O,P;for(O=0;O<H;++O)(P=E(this,L,C,A,M[O].identifier,M[O]))&&(Ed(C),P("start",C,M[O]))}}function b(C){var A=C.changedTouches,M=A.length,L,H;for(L=0;L<M;++L)(H=o[A[L].identifier])&&(oo(C),H("drag",C,A[L]))}function k(C){var A=C.changedTouches,M=A.length,L,H;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),L=0;L<M;++L)(H=o[A[L].identifier])&&(Ed(C),H("end",C,A[L]))}function E(C,A,M,L,H,O){var P=l.copy(),F=Xn(O||M,A),Y,q,R;if((R=r.call(C,new rv("beforestart",{sourceEvent:M,target:y,identifier:H,active:u,x:F[0],y:F[1],dx:0,dy:0,dispatch:P}),L))!=null)return Y=R.x-F[0]||0,q=R.y-F[1]||0,function Q(z,ne,Z){var $=F,X;switch(z){case"start":o[H]=Q,X=u++;break;case"end":delete o[H],--u;case"drag":F=Xn(Z||ne,A),X=u;break}P.call(z,C,new rv(z,{sourceEvent:ne,subject:R,target:y,identifier:H,active:X,x:F[0]+Y,y:F[1]+q,dx:F[0]-$[0],dy:F[1]-$[1],dispatch:P}),L)}}return y.filter=function(C){return arguments.length?(e=typeof C=="function"?C:Fl(!!C),y):e},y.container=function(C){return arguments.length?(n=typeof C=="function"?C:Fl(C),y):n},y.subject=function(C){return arguments.length?(r=typeof C=="function"?C:Fl(C),y):r},y.touchable=function(C){return arguments.length?(i=typeof C=="function"?C:Fl(!!C),y):i},y.on=function(){var C=l.on.apply(l,arguments);return C===l?y:C},y.clickDistance=function(C){return arguments.length?(m=(C=+C)*C,y):Math.sqrt(m)},y}function Av(e,n,r){e.prototype=n.prototype=r,r.constructor=e}function UE(e,n){var r=Object.create(e.prototype);for(var i in n)r[i]=n[i];return r}function Ma(){}var ba=.7,uu=1/ba,ao="\\s*([+-]?\\d+)\\s*",Sa="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",mr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",z2=/^#([0-9a-f]{3,8})$/,B2=new RegExp(`^rgb\\(${ao},${ao},${ao}\\)$`),U2=new RegExp(`^rgb\\(${mr},${mr},${mr}\\)$`),H2=new RegExp(`^rgba\\(${ao},${ao},${ao},${Sa}\\)$`),W2=new RegExp(`^rgba\\(${mr},${mr},${mr},${Sa}\\)$`),V2=new RegExp(`^hsl\\(${Sa},${mr},${mr}\\)$`),G2=new RegExp(`^hsla\\(${Sa},${mr},${mr},${Sa}\\)$`),Dw={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};Av(Ma,ka,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Fw,formatHex:Fw,formatHex8:Y2,formatHsl:K2,formatRgb:zw,toString:zw});function Fw(){return this.rgb().formatHex()}function Y2(){return this.rgb().formatHex8()}function K2(){return HE(this).formatHsl()}function zw(){return this.rgb().formatRgb()}function ka(e){var n,r;return e=(e+"").trim().toLowerCase(),(n=z2.exec(e))?(r=n[1].length,n=parseInt(n[1],16),r===6?Bw(n):r===3?new dn(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):r===8?zl(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):r===4?zl(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=B2.exec(e))?new dn(n[1],n[2],n[3],1):(n=U2.exec(e))?new dn(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=H2.exec(e))?zl(n[1],n[2],n[3],n[4]):(n=W2.exec(e))?zl(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=V2.exec(e))?Ww(n[1],n[2]/100,n[3]/100,1):(n=G2.exec(e))?Ww(n[1],n[2]/100,n[3]/100,n[4]):Dw.hasOwnProperty(e)?Bw(Dw[e]):e==="transparent"?new dn(NaN,NaN,NaN,0):null}function Bw(e){return new dn(e>>16&255,e>>8&255,e&255,1)}function zl(e,n,r,i){return i<=0&&(e=n=r=NaN),new dn(e,n,r,i)}function X2(e){return e instanceof Ma||(e=ka(e)),e?(e=e.rgb(),new dn(e.r,e.g,e.b,e.opacity)):new dn}function sv(e,n,r,i){return arguments.length===1?X2(e):new dn(e,n,r,i??1)}function dn(e,n,r,i){this.r=+e,this.g=+n,this.b=+r,this.opacity=+i}Av(dn,sv,UE(Ma,{brighter(e){return e=e==null?uu:Math.pow(uu,e),new dn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ba:Math.pow(ba,e),new dn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new dn(si(this.r),si(this.g),si(this.b),cu(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:Uw,formatHex:Uw,formatHex8:Q2,formatRgb:Hw,toString:Hw}));function Uw(){return`#${ni(this.r)}${ni(this.g)}${ni(this.b)}`}function Q2(){return`#${ni(this.r)}${ni(this.g)}${ni(this.b)}${ni((isNaN(this.opacity)?1:this.opacity)*255)}`}function Hw(){const e=cu(this.opacity);return`${e===1?"rgb(":"rgba("}${si(this.r)}, ${si(this.g)}, ${si(this.b)}${e===1?")":`, ${e})`}`}function cu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function si(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ni(e){return e=si(e),(e<16?"0":"")+e.toString(16)}function Ww(e,n,r,i){return i<=0?e=n=r=NaN:r<=0||r>=1?e=n=NaN:n<=0&&(e=NaN),new Qn(e,n,r,i)}function HE(e){if(e instanceof Qn)return new Qn(e.h,e.s,e.l,e.opacity);if(e instanceof Ma||(e=ka(e)),!e)return new Qn;if(e instanceof Qn)return e;e=e.rgb();var n=e.r/255,r=e.g/255,i=e.b/255,o=Math.min(n,r,i),l=Math.max(n,r,i),u=NaN,c=l-o,h=(l+o)/2;return c?(n===l?u=(r-i)/c+(r<i)*6:r===l?u=(i-n)/c+2:u=(n-r)/c+4,c/=h<.5?l+o:2-l-o,u*=60):c=h>0&&h<1?0:u,new Qn(u,c,h,e.opacity)}function Z2(e,n,r,i){return arguments.length===1?HE(e):new Qn(e,n,r,i??1)}function Qn(e,n,r,i){this.h=+e,this.s=+n,this.l=+r,this.opacity=+i}Av(Qn,Z2,UE(Ma,{brighter(e){return e=e==null?uu:Math.pow(uu,e),new Qn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ba:Math.pow(ba,e),new Qn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,i=r+(r<.5?r:1-r)*n,o=2*r-i;return new dn(Nd(e>=240?e-240:e+120,o,i),Nd(e,o,i),Nd(e<120?e+240:e-120,o,i),this.opacity)},clamp(){return new Qn(Vw(this.h),Bl(this.s),Bl(this.l),cu(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=cu(this.opacity);return`${e===1?"hsl(":"hsla("}${Vw(this.h)}, ${Bl(this.s)*100}%, ${Bl(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Vw(e){return e=(e||0)%360,e<0?e+360:e}function Bl(e){return Math.max(0,Math.min(1,e||0))}function Nd(e,n,r){return(e<60?n+(r-n)*e/60:e<180?r:e<240?n+(r-n)*(240-e)/60:n)*255}const WE=e=>()=>e;function J2(e,n){return function(r){return e+r*n}}function eA(e,n,r){return e=Math.pow(e,r),n=Math.pow(n,r)-e,r=1/r,function(i){return Math.pow(e+i*n,r)}}function tA(e){return(e=+e)==1?VE:function(n,r){return r-n?eA(n,r,e):WE(isNaN(n)?r:n)}}function VE(e,n){var r=n-e;return r?J2(e,r):WE(isNaN(e)?n:e)}const Gw=(function e(n){var r=tA(n);function i(o,l){var u=r((o=sv(o)).r,(l=sv(l)).r),c=r(o.g,l.g),h=r(o.b,l.b),p=VE(o.opacity,l.opacity);return function(d){return o.r=u(d),o.g=c(d),o.b=h(d),o.opacity=p(d),o+""}}return i.gamma=e,i})(1);function ws(e,n){return e=+e,n=+n,function(r){return e*(1-r)+n*r}}var iv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Cd=new RegExp(iv.source,"g");function nA(e){return function(){return e}}function rA(e){return function(n){return e(n)+""}}function sA(e,n){var r=iv.lastIndex=Cd.lastIndex=0,i,o,l,u=-1,c=[],h=[];for(e=e+"",n=n+"";(i=iv.exec(e))&&(o=Cd.exec(n));)(l=o.index)>r&&(l=n.slice(r,l),c[u]?c[u]+=l:c[++u]=l),(i=i[0])===(o=o[0])?c[u]?c[u]+=o:c[++u]=o:(c[++u]=null,h.push({i:u,x:ws(i,o)})),r=Cd.lastIndex;return r<n.length&&(l=n.slice(r),c[u]?c[u]+=l:c[++u]=l),c.length<2?h[0]?rA(h[0].x):nA(n):(n=h.length,function(p){for(var d=0,m;d<n;++d)c[(m=h[d]).i]=m.x(p);return c.join("")})}var Yw=180/Math.PI,ov={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function GE(e,n,r,i,o,l){var u,c,h;return(u=Math.sqrt(e*e+n*n))&&(e/=u,n/=u),(h=e*r+n*i)&&(r-=e*h,i-=n*h),(c=Math.sqrt(r*r+i*i))&&(r/=c,i/=c,h/=c),e*i<n*r&&(e=-e,n=-n,h=-h,u=-u),{translateX:o,translateY:l,rotate:Math.atan2(n,e)*Yw,skewX:Math.atan(h)*Yw,scaleX:u,scaleY:c}}var Ul;function iA(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?ov:GE(n.a,n.b,n.c,n.d,n.e,n.f)}function oA(e){return e==null||(Ul||(Ul=document.createElementNS("http://www.w3.org/2000/svg","g")),Ul.setAttribute("transform",e),!(e=Ul.transform.baseVal.consolidate()))?ov:(e=e.matrix,GE(e.a,e.b,e.c,e.d,e.e,e.f))}function YE(e,n,r,i){function o(p){return p.length?p.pop()+" ":""}function l(p,d,m,y,w,N){if(p!==m||d!==y){var _=w.push("translate(",null,n,null,r);N.push({i:_-4,x:ws(p,m)},{i:_-2,x:ws(d,y)})}else(m||y)&&w.push("translate("+m+n+y+r)}function u(p,d,m,y){p!==d?(p-d>180?d+=360:d-p>180&&(p+=360),y.push({i:m.push(o(m)+"rotate(",null,i)-2,x:ws(p,d)})):d&&m.push(o(m)+"rotate("+d+i)}function c(p,d,m,y){p!==d?y.push({i:m.push(o(m)+"skewX(",null,i)-2,x:ws(p,d)}):d&&m.push(o(m)+"skewX("+d+i)}function h(p,d,m,y,w,N){if(p!==m||d!==y){var _=w.push(o(w)+"scale(",null,",",null,")");N.push({i:_-4,x:ws(p,m)},{i:_-2,x:ws(d,y)})}else(m!==1||y!==1)&&w.push(o(w)+"scale("+m+","+y+")")}return function(p,d){var m=[],y=[];return p=e(p),d=e(d),l(p.translateX,p.translateY,d.translateX,d.translateY,m,y),u(p.rotate,d.rotate,m,y),c(p.skewX,d.skewX,m,y),h(p.scaleX,p.scaleY,d.scaleX,d.scaleY,m,y),p=d=null,function(w){for(var N=-1,_=y.length,S;++N<_;)m[(S=y[N]).i]=S.x(w);return m.join("")}}}var aA=YE(iA,"px, ","px)","deg)"),lA=YE(oA,", ",")",")"),uA=1e-12;function Kw(e){return((e=Math.exp(e))+1/e)/2}function cA(e){return((e=Math.exp(e))-1/e)/2}function dA(e){return((e=Math.exp(2*e))-1)/(e+1)}const fA=(function e(n,r,i){function o(l,u){var c=l[0],h=l[1],p=l[2],d=u[0],m=u[1],y=u[2],w=d-c,N=m-h,_=w*w+N*N,S,b;if(_<uA)b=Math.log(y/p)/n,S=function(L){return[c+L*w,h+L*N,p*Math.exp(n*L*b)]};else{var k=Math.sqrt(_),E=(y*y-p*p+i*_)/(2*p*r*k),C=(y*y-p*p-i*_)/(2*y*r*k),A=Math.log(Math.sqrt(E*E+1)-E),M=Math.log(Math.sqrt(C*C+1)-C);b=(M-A)/n,S=function(L){var H=L*b,O=Kw(A),P=p/(r*k)*(O*dA(n*H+A)-cA(A));return[c+P*w,h+P*N,p*O/Kw(n*H+A)]}}return S.duration=b*1e3*n/Math.SQRT2,S}return o.rho=function(l){var u=Math.max(.001,+l),c=u*u,h=c*c;return e(u,c,h)},o})(Math.SQRT2,2,4);var fo=0,ma=0,ua=0,KE=1e3,du,ga,fu=0,oi=0,Su=0,Ea=typeof performance=="object"&&performance.now?performance:Date,XE=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Iv(){return oi||(XE(hA),oi=Ea.now()+Su)}function hA(){oi=0}function hu(){this._call=this._time=this._next=null}hu.prototype=QE.prototype={constructor:hu,restart:function(e,n,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?Iv():+r)+(n==null?0:+n),!this._next&&ga!==this&&(ga?ga._next=this:du=this,ga=this),this._call=e,this._time=r,av()},stop:function(){this._call&&(this._call=null,this._time=1/0,av())}};function QE(e,n,r){var i=new hu;return i.restart(e,n,r),i}function pA(){Iv(),++fo;for(var e=du,n;e;)(n=oi-e._time)>=0&&e._call.call(void 0,n),e=e._next;--fo}function Xw(){oi=(fu=Ea.now())+Su,fo=ma=0;try{pA()}finally{fo=0,gA(),oi=0}}function mA(){var e=Ea.now(),n=e-fu;n>KE&&(Su-=n,fu=e)}function gA(){for(var e,n=du,r,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(r=n._next,n._next=null,n=e?e._next=r:du=r);ga=e,av(i)}function av(e){if(!fo){ma&&(ma=clearTimeout(ma));var n=e-oi;n>24?(e<1/0&&(ma=setTimeout(Xw,e-Ea.now()-Su)),ua&&(ua=clearInterval(ua))):(ua||(fu=Ea.now(),ua=setInterval(mA,KE)),fo=1,XE(Xw))}}function Qw(e,n,r){var i=new hu;return n=n==null?0:+n,i.restart(o=>{i.stop(),e(o+n)},n,r),i}var vA=_u("start","end","cancel","interrupt"),yA=[],ZE=0,Zw=1,lv=2,su=3,Jw=4,uv=5,iu=6;function ku(e,n,r,i,o,l){var u=e.__transition;if(!u)e.__transition={};else if(r in u)return;wA(e,r,{name:n,index:i,group:o,on:vA,tween:yA,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:ZE})}function Mv(e,n){var r=er(e,n);if(r.state>ZE)throw new Error("too late; already scheduled");return r}function gr(e,n){var r=er(e,n);if(r.state>su)throw new Error("too late; already running");return r}function er(e,n){var r=e.__transition;if(!r||!(r=r[n]))throw new Error("transition not found");return r}function wA(e,n,r){var i=e.__transition,o;i[n]=r,r.timer=QE(l,0,r.time);function l(p){r.state=Zw,r.timer.restart(u,r.delay,r.time),r.delay<=p&&u(p-r.delay)}function u(p){var d,m,y,w;if(r.state!==Zw)return h();for(d in i)if(w=i[d],w.name===r.name){if(w.state===su)return Qw(u);w.state===Jw?(w.state=iu,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete i[d]):+d<n&&(w.state=iu,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete i[d])}if(Qw(function(){r.state===su&&(r.state=Jw,r.timer.restart(c,r.delay,r.time),c(p))}),r.state=lv,r.on.call("start",e,e.__data__,r.index,r.group),r.state===lv){for(r.state=su,o=new Array(y=r.tween.length),d=0,m=-1;d<y;++d)(w=r.tween[d].value.call(e,e.__data__,r.index,r.group))&&(o[++m]=w);o.length=m+1}}function c(p){for(var d=p<r.duration?r.ease.call(null,p/r.duration):(r.timer.restart(h),r.state=uv,1),m=-1,y=o.length;++m<y;)o[m].call(e,d);r.state===uv&&(r.on.call("end",e,e.__data__,r.index,r.group),h())}function h(){r.state=iu,r.timer.stop(),delete i[n];for(var p in i)return;delete e.__transition}}function ou(e,n){var r=e.__transition,i,o,l=!0,u;if(r){n=n==null?null:n+"";for(u in r){if((i=r[u]).name!==n){l=!1;continue}o=i.state>lv&&i.state<uv,i.state=iu,i.timer.stop(),i.on.call(o?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete r[u]}l&&delete e.__transition}}function xA(e){return this.each(function(){ou(this,e)})}function _A(e,n){var r,i;return function(){var o=gr(this,e),l=o.tween;if(l!==r){i=r=l;for(var u=0,c=i.length;u<c;++u)if(i[u].name===n){i=i.slice(),i.splice(u,1);break}}o.tween=i}}function bA(e,n,r){var i,o;if(typeof r!="function")throw new Error;return function(){var l=gr(this,e),u=l.tween;if(u!==i){o=(i=u).slice();for(var c={name:n,value:r},h=0,p=o.length;h<p;++h)if(o[h].name===n){o[h]=c;break}h===p&&o.push(c)}l.tween=o}}function SA(e,n){var r=this._id;if(e+="",arguments.length<2){for(var i=er(this.node(),r).tween,o=0,l=i.length,u;o<l;++o)if((u=i[o]).name===e)return u.value;return null}return this.each((n==null?_A:bA)(r,e,n))}function Pv(e,n,r){var i=e._id;return e.each(function(){var o=gr(this,i);(o.value||(o.value={}))[n]=r.apply(this,arguments)}),function(o){return er(o,i).value[n]}}function JE(e,n){var r;return(typeof n=="number"?ws:n instanceof ka?Gw:(r=ka(n))?(n=r,Gw):sA)(e,n)}function kA(e){return function(){this.removeAttribute(e)}}function EA(e){return function(){this.removeAttributeNS(e.space,e.local)}}function NA(e,n,r){var i,o=r+"",l;return function(){var u=this.getAttribute(e);return u===o?null:u===i?l:l=n(i=u,r)}}function CA(e,n,r){var i,o=r+"",l;return function(){var u=this.getAttributeNS(e.space,e.local);return u===o?null:u===i?l:l=n(i=u,r)}}function jA(e,n,r){var i,o,l;return function(){var u,c=r(this),h;return c==null?void this.removeAttribute(e):(u=this.getAttribute(e),h=c+"",u===h?null:u===i&&h===o?l:(o=h,l=n(i=u,c)))}}function RA(e,n,r){var i,o,l;return function(){var u,c=r(this),h;return c==null?void this.removeAttributeNS(e.space,e.local):(u=this.getAttributeNS(e.space,e.local),h=c+"",u===h?null:u===i&&h===o?l:(o=h,l=n(i=u,c)))}}function TA(e,n){var r=bu(e),i=r==="transform"?lA:JE;return this.attrTween(e,typeof n=="function"?(r.local?RA:jA)(r,i,Pv(this,"attr."+e,n)):n==null?(r.local?EA:kA)(r):(r.local?CA:NA)(r,i,n))}function AA(e,n){return function(r){this.setAttribute(e,n.call(this,r))}}function IA(e,n){return function(r){this.setAttributeNS(e.space,e.local,n.call(this,r))}}function MA(e,n){var r,i;function o(){var l=n.apply(this,arguments);return l!==i&&(r=(i=l)&&IA(e,l)),r}return o._value=n,o}function PA(e,n){var r,i;function o(){var l=n.apply(this,arguments);return l!==i&&(r=(i=l)&&AA(e,l)),r}return o._value=n,o}function OA(e,n){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(n==null)return this.tween(r,null);if(typeof n!="function")throw new Error;var i=bu(e);return this.tween(r,(i.local?MA:PA)(i,n))}function LA(e,n){return function(){Mv(this,e).delay=+n.apply(this,arguments)}}function qA(e,n){return n=+n,function(){Mv(this,e).delay=n}}function $A(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?LA:qA)(n,e)):er(this.node(),n).delay}function DA(e,n){return function(){gr(this,e).duration=+n.apply(this,arguments)}}function FA(e,n){return n=+n,function(){gr(this,e).duration=n}}function zA(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?DA:FA)(n,e)):er(this.node(),n).duration}function BA(e,n){if(typeof n!="function")throw new Error;return function(){gr(this,e).ease=n}}function UA(e){var n=this._id;return arguments.length?this.each(BA(n,e)):er(this.node(),n).ease}function HA(e,n){return function(){var r=n.apply(this,arguments);if(typeof r!="function")throw new Error;gr(this,e).ease=r}}function WA(e){if(typeof e!="function")throw new Error;return this.each(HA(this._id,e))}function VA(e){typeof e!="function"&&(e=AE(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o)for(var l=n[o],u=l.length,c=i[o]=[],h,p=0;p<u;++p)(h=l[p])&&e.call(h,h.__data__,p,l)&&c.push(h);return new Ur(i,this._parents,this._name,this._id)}function GA(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,r=e._groups,i=n.length,o=r.length,l=Math.min(i,o),u=new Array(i),c=0;c<l;++c)for(var h=n[c],p=r[c],d=h.length,m=u[c]=new Array(d),y,w=0;w<d;++w)(y=h[w]||p[w])&&(m[w]=y);for(;c<i;++c)u[c]=n[c];return new Ur(u,this._parents,this._name,this._id)}function YA(e){return(e+"").trim().split(/^|\s+/).every(function(n){var r=n.indexOf(".");return r>=0&&(n=n.slice(0,r)),!n||n==="start"})}function KA(e,n,r){var i,o,l=YA(n)?Mv:gr;return function(){var u=l(this,e),c=u.on;c!==i&&(o=(i=c).copy()).on(n,r),u.on=o}}function XA(e,n){var r=this._id;return arguments.length<2?er(this.node(),r).on.on(e):this.each(KA(r,e,n))}function QA(e){return function(){var n=this.parentNode;for(var r in this.__transition)if(+r!==e)return;n&&n.removeChild(this)}}function ZA(){return this.on("end.remove",QA(this._id))}function JA(e){var n=this._name,r=this._id;typeof e!="function"&&(e=Rv(e));for(var i=this._groups,o=i.length,l=new Array(o),u=0;u<o;++u)for(var c=i[u],h=c.length,p=l[u]=new Array(h),d,m,y=0;y<h;++y)(d=c[y])&&(m=e.call(d,d.__data__,y,c))&&("__data__"in d&&(m.__data__=d.__data__),p[y]=m,ku(p[y],n,r,y,p,er(d,r)));return new Ur(l,this._parents,n,r)}function eI(e){var n=this._name,r=this._id;typeof e!="function"&&(e=TE(e));for(var i=this._groups,o=i.length,l=[],u=[],c=0;c<o;++c)for(var h=i[c],p=h.length,d,m=0;m<p;++m)if(d=h[m]){for(var y=e.call(d,d.__data__,m,h),w,N=er(d,r),_=0,S=y.length;_<S;++_)(w=y[_])&&ku(w,n,r,_,y,N);l.push(y),u.push(d)}return new Ur(l,u,n,r)}var tI=Ia.prototype.constructor;function nI(){return new tI(this._groups,this._parents)}function rI(e,n){var r,i,o;return function(){var l=co(this,e),u=(this.style.removeProperty(e),co(this,e));return l===u?null:l===r&&u===i?o:o=n(r=l,i=u)}}function eN(e){return function(){this.style.removeProperty(e)}}function sI(e,n,r){var i,o=r+"",l;return function(){var u=co(this,e);return u===o?null:u===i?l:l=n(i=u,r)}}function iI(e,n,r){var i,o,l;return function(){var u=co(this,e),c=r(this),h=c+"";return c==null&&(h=c=(this.style.removeProperty(e),co(this,e))),u===h?null:u===i&&h===o?l:(o=h,l=n(i=u,c))}}function oI(e,n){var r,i,o,l="style."+n,u="end."+l,c;return function(){var h=gr(this,e),p=h.on,d=h.value[l]==null?c||(c=eN(n)):void 0;(p!==r||o!==d)&&(i=(r=p).copy()).on(u,o=d),h.on=i}}function aI(e,n,r){var i=(e+="")=="transform"?aA:JE;return n==null?this.styleTween(e,rI(e,i)).on("end.style."+e,eN(e)):typeof n=="function"?this.styleTween(e,iI(e,i,Pv(this,"style."+e,n))).each(oI(this._id,e)):this.styleTween(e,sI(e,i,n),r).on("end.style."+e,null)}function lI(e,n,r){return function(i){this.style.setProperty(e,n.call(this,i),r)}}function uI(e,n,r){var i,o;function l(){var u=n.apply(this,arguments);return u!==o&&(i=(o=u)&&lI(e,u,r)),i}return l._value=n,l}function cI(e,n,r){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,uI(e,n,r??""))}function dI(e){return function(){this.textContent=e}}function fI(e){return function(){var n=e(this);this.textContent=n??""}}function hI(e){return this.tween("text",typeof e=="function"?fI(Pv(this,"text",e)):dI(e==null?"":e+""))}function pI(e){return function(n){this.textContent=e.call(this,n)}}function mI(e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&pI(o)),n}return i._value=e,i}function gI(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,mI(e))}function vI(){for(var e=this._name,n=this._id,r=tN(),i=this._groups,o=i.length,l=0;l<o;++l)for(var u=i[l],c=u.length,h,p=0;p<c;++p)if(h=u[p]){var d=er(h,n);ku(h,e,r,p,u,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Ur(i,this._parents,e,r)}function yI(){var e,n,r=this,i=r._id,o=r.size();return new Promise(function(l,u){var c={value:u},h={value:function(){--o===0&&l()}};r.each(function(){var p=gr(this,i),d=p.on;d!==e&&(n=(e=d).copy(),n._.cancel.push(c),n._.interrupt.push(c),n._.end.push(h)),p.on=n}),o===0&&l()})}var wI=0;function Ur(e,n,r,i){this._groups=e,this._parents=n,this._name=r,this._id=i}function tN(){return++wI}var Fr=Ia.prototype;Ur.prototype={constructor:Ur,select:JA,selectAll:eI,selectChild:Fr.selectChild,selectChildren:Fr.selectChildren,filter:VA,merge:GA,selection:nI,transition:vI,call:Fr.call,nodes:Fr.nodes,node:Fr.node,size:Fr.size,empty:Fr.empty,each:Fr.each,on:XA,attr:TA,attrTween:OA,style:aI,styleTween:cI,text:hI,textTween:gI,remove:ZA,tween:SA,delay:$A,duration:zA,ease:UA,easeVarying:WA,end:yI,[Symbol.iterator]:Fr[Symbol.iterator]};function xI(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var _I={time:null,delay:0,duration:250,ease:xI};function bI(e,n){for(var r;!(r=e.__transition)||!(r=r[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return r}function SI(e){var n,r;e instanceof Ur?(n=e._id,e=e._name):(n=tN(),(r=_I).time=Iv(),e=e==null?null:e+"");for(var i=this._groups,o=i.length,l=0;l<o;++l)for(var u=i[l],c=u.length,h,p=0;p<c;++p)(h=u[p])&&ku(h,e,n,p,u,r||bI(h,n));return new Ur(i,this._parents,e,n)}Ia.prototype.interrupt=xA;Ia.prototype.transition=SI;const Hl=e=>()=>e;function kI(e,{sourceEvent:n,target:r,transform:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function zr(e,n,r){this.k=e,this.x=n,this.y=r}zr.prototype={constructor:zr,scale:function(e){return e===1?this:new zr(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new zr(this.k,this.x+this.k*e,this.y+this.k*n)},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 Br=new zr(1,0,0);zr.prototype;function jd(e){e.stopImmediatePropagation()}function ca(e){e.preventDefault(),e.stopImmediatePropagation()}function EI(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function NI(){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 ex(){return this.__zoom||Br}function CI(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function jI(){return navigator.maxTouchPoints||"ontouchstart"in this}function RI(e,n,r){var i=e.invertX(n[0][0])-r[0][0],o=e.invertX(n[1][0])-r[1][0],l=e.invertY(n[0][1])-r[0][1],u=e.invertY(n[1][1])-r[1][1];return e.translate(o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o),u>l?(l+u)/2:Math.min(0,l)||Math.max(0,u))}function nN(){var e=EI,n=NI,r=RI,i=CI,o=jI,l=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],c=250,h=fA,p=_u("start","zoom","end"),d,m,y,w=500,N=150,_=0,S=10;function b(R){R.property("__zoom",ex).on("wheel.zoom",H,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",P).filter(o).on("touchstart.zoom",F).on("touchmove.zoom",Y).on("touchend.zoom touchcancel.zoom",q).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(R,Q,z,ne){var Z=R.selection?R.selection():R;Z.property("__zoom",ex),R!==Z?A(R,Q,z,ne):Z.interrupt().each(function(){M(this,arguments).event(ne).start().zoom(null,typeof Q=="function"?Q.apply(this,arguments):Q).end()})},b.scaleBy=function(R,Q,z,ne){b.scaleTo(R,function(){var Z=this.__zoom.k,$=typeof Q=="function"?Q.apply(this,arguments):Q;return Z*$},z,ne)},b.scaleTo=function(R,Q,z,ne){b.transform(R,function(){var Z=n.apply(this,arguments),$=this.__zoom,X=z==null?C(Z):typeof z=="function"?z.apply(this,arguments):z,I=$.invert(X),W=typeof Q=="function"?Q.apply(this,arguments):Q;return r(E(k($,W),X,I),Z,u)},z,ne)},b.translateBy=function(R,Q,z,ne){b.transform(R,function(){return r(this.__zoom.translate(typeof Q=="function"?Q.apply(this,arguments):Q,typeof z=="function"?z.apply(this,arguments):z),n.apply(this,arguments),u)},null,ne)},b.translateTo=function(R,Q,z,ne,Z){b.transform(R,function(){var $=n.apply(this,arguments),X=this.__zoom,I=ne==null?C($):typeof ne=="function"?ne.apply(this,arguments):ne;return r(Br.translate(I[0],I[1]).scale(X.k).translate(typeof Q=="function"?-Q.apply(this,arguments):-Q,typeof z=="function"?-z.apply(this,arguments):-z),$,u)},ne,Z)};function k(R,Q){return Q=Math.max(l[0],Math.min(l[1],Q)),Q===R.k?R:new zr(Q,R.x,R.y)}function E(R,Q,z){var ne=Q[0]-z[0]*R.k,Z=Q[1]-z[1]*R.k;return ne===R.x&&Z===R.y?R:new zr(R.k,ne,Z)}function C(R){return[(+R[0][0]+ +R[1][0])/2,(+R[0][1]+ +R[1][1])/2]}function A(R,Q,z,ne){R.on("start.zoom",function(){M(this,arguments).event(ne).start()}).on("interrupt.zoom end.zoom",function(){M(this,arguments).event(ne).end()}).tween("zoom",function(){var Z=this,$=arguments,X=M(Z,$).event(ne),I=n.apply(Z,$),W=z==null?C(I):typeof z=="function"?z.apply(Z,$):z,G=Math.max(I[1][0]-I[0][0],I[1][1]-I[0][1]),U=Z.__zoom,J=typeof Q=="function"?Q.apply(Z,$):Q,re=h(U.invert(W).concat(G/U.k),J.invert(W).concat(G/J.k));return function(le){if(le===1)le=J;else{var fe=re(le),te=G/fe[2];le=new zr(te,W[0]-fe[0]*te,W[1]-fe[1]*te)}X.zoom(null,le)}})}function M(R,Q,z){return!z&&R.__zooming||new L(R,Q)}function L(R,Q){this.that=R,this.args=Q,this.active=0,this.sourceEvent=null,this.extent=n.apply(R,Q),this.taps=0}L.prototype={event:function(R){return R&&(this.sourceEvent=R),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(R,Q){return this.mouse&&R!=="mouse"&&(this.mouse[1]=Q.invert(this.mouse[0])),this.touch0&&R!=="touch"&&(this.touch0[1]=Q.invert(this.touch0[0])),this.touch1&&R!=="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(R){var Q=Pn(this.that).datum();p.call(R,this.that,new kI(R,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:p}),Q)}};function H(R,...Q){if(!e.apply(this,arguments))return;var z=M(this,Q).event(R),ne=this.__zoom,Z=Math.max(l[0],Math.min(l[1],ne.k*Math.pow(2,i.apply(this,arguments)))),$=Xn(R);if(z.wheel)(z.mouse[0][0]!==$[0]||z.mouse[0][1]!==$[1])&&(z.mouse[1]=ne.invert(z.mouse[0]=$)),clearTimeout(z.wheel);else{if(ne.k===Z)return;z.mouse=[$,ne.invert($)],ou(this),z.start()}ca(R),z.wheel=setTimeout(X,N),z.zoom("mouse",r(E(k(ne,Z),z.mouse[0],z.mouse[1]),z.extent,u));function X(){z.wheel=null,z.end()}}function O(R,...Q){if(y||!e.apply(this,arguments))return;var z=R.currentTarget,ne=M(this,Q,!0).event(R),Z=Pn(R.view).on("mousemove.zoom",W,!0).on("mouseup.zoom",G,!0),$=Xn(R,z),X=R.clientX,I=R.clientY;zE(R.view),jd(R),ne.mouse=[$,this.__zoom.invert($)],ou(this),ne.start();function W(U){if(ca(U),!ne.moved){var J=U.clientX-X,re=U.clientY-I;ne.moved=J*J+re*re>_}ne.event(U).zoom("mouse",r(E(ne.that.__zoom,ne.mouse[0]=Xn(U,z),ne.mouse[1]),ne.extent,u))}function G(U){Z.on("mousemove.zoom mouseup.zoom",null),BE(U.view,ne.moved),ca(U),ne.event(U).end()}}function P(R,...Q){if(e.apply(this,arguments)){var z=this.__zoom,ne=Xn(R.changedTouches?R.changedTouches[0]:R,this),Z=z.invert(ne),$=z.k*(R.shiftKey?.5:2),X=r(E(k(z,$),ne,Z),n.apply(this,Q),u);ca(R),c>0?Pn(this).transition().duration(c).call(A,X,ne,R):Pn(this).call(b.transform,X,ne,R)}}function F(R,...Q){if(e.apply(this,arguments)){var z=R.touches,ne=z.length,Z=M(this,Q,R.changedTouches.length===ne).event(R),$,X,I,W;for(jd(R),X=0;X<ne;++X)I=z[X],W=Xn(I,this),W=[W,this.__zoom.invert(W),I.identifier],Z.touch0?!Z.touch1&&Z.touch0[2]!==W[2]&&(Z.touch1=W,Z.taps=0):(Z.touch0=W,$=!0,Z.taps=1+!!d);d&&(d=clearTimeout(d)),$&&(Z.taps<2&&(m=W[0],d=setTimeout(function(){d=null},w)),ou(this),Z.start())}}function Y(R,...Q){if(this.__zooming){var z=M(this,Q).event(R),ne=R.changedTouches,Z=ne.length,$,X,I,W;for(ca(R),$=0;$<Z;++$)X=ne[$],I=Xn(X,this),z.touch0&&z.touch0[2]===X.identifier?z.touch0[0]=I:z.touch1&&z.touch1[2]===X.identifier&&(z.touch1[0]=I);if(X=z.that.__zoom,z.touch1){var G=z.touch0[0],U=z.touch0[1],J=z.touch1[0],re=z.touch1[1],le=(le=J[0]-G[0])*le+(le=J[1]-G[1])*le,fe=(fe=re[0]-U[0])*fe+(fe=re[1]-U[1])*fe;X=k(X,Math.sqrt(le/fe)),I=[(G[0]+J[0])/2,(G[1]+J[1])/2],W=[(U[0]+re[0])/2,(U[1]+re[1])/2]}else if(z.touch0)I=z.touch0[0],W=z.touch0[1];else return;z.zoom("touch",r(E(X,I,W),z.extent,u))}}function q(R,...Q){if(this.__zooming){var z=M(this,Q).event(R),ne=R.changedTouches,Z=ne.length,$,X;for(jd(R),y&&clearTimeout(y),y=setTimeout(function(){y=null},w),$=0;$<Z;++$)X=ne[$],z.touch0&&z.touch0[2]===X.identifier?delete z.touch0:z.touch1&&z.touch1[2]===X.identifier&&delete z.touch1;if(z.touch1&&!z.touch0&&(z.touch0=z.touch1,delete z.touch1),z.touch0)z.touch0[1]=this.__zoom.invert(z.touch0[0]);else if(z.end(),z.taps===2&&(X=Xn(X,this),Math.hypot(m[0]-X[0],m[1]-X[1])<S)){var I=Pn(this).on("dblclick.zoom");I&&I.apply(this,arguments)}}}return b.wheelDelta=function(R){return arguments.length?(i=typeof R=="function"?R:Hl(+R),b):i},b.filter=function(R){return arguments.length?(e=typeof R=="function"?R:Hl(!!R),b):e},b.touchable=function(R){return arguments.length?(o=typeof R=="function"?R:Hl(!!R),b):o},b.extent=function(R){return arguments.length?(n=typeof R=="function"?R:Hl([[+R[0][0],+R[0][1]],[+R[1][0],+R[1][1]]]),b):n},b.scaleExtent=function(R){return arguments.length?(l[0]=+R[0],l[1]=+R[1],b):[l[0],l[1]]},b.translateExtent=function(R){return arguments.length?(u[0][0]=+R[0][0],u[1][0]=+R[1][0],u[0][1]=+R[0][1],u[1][1]=+R[1][1],b):[[u[0][0],u[0][1]],[u[1][0],u[1][1]]]},b.constrain=function(R){return arguments.length?(r=R,b):r},b.duration=function(R){return arguments.length?(c=+R,b):c},b.interpolate=function(R){return arguments.length?(h=R,b):h},b.on=function(){var R=p.on.apply(p,arguments);return R===p?b:R},b.clickDistance=function(R){return arguments.length?(_=(R=+R)*R,b):Math.sqrt(_)},b.tapDistance=function(R){return arguments.length?(S=+R,b):S},b}var TI=CE();const Eu=T.createContext(null),AI=Eu.Provider,Hr={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,n)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?n.targetHandle:n.sourceHandle}", edge id: ${n.id}.`,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.`},rN=Hr.error001();function Ke(e,n){const r=T.useContext(Eu);if(r===null)throw new Error(rN);return jE(r,e,n)}const Ct=()=>{const e=T.useContext(Eu);if(e===null)throw new Error(rN);return T.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},II=e=>e.userSelectionActive?"none":"all";function Ov({position:e,children:n,className:r,style:i,...o}){const l=Ke(II),u=`${e}`.split("-");return ue.createElement("div",{className:Bt(["react-flow__panel",r,...u]),style:{...i,pointerEvents:l},...o},n)}function MI({proOptions:e,position:n="bottom-right"}){return e!=null&&e.hideAttribution?null:ue.createElement(Ov,{position:n,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},ue.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const PI=({x:e,y:n,label:r,labelStyle:i={},labelShowBg:o=!0,labelBgStyle:l={},labelBgPadding:u=[2,4],labelBgBorderRadius:c=2,children:h,className:p,...d})=>{const m=T.useRef(null),[y,w]=T.useState({x:0,y:0,width:0,height:0}),N=Bt(["react-flow__edge-textwrapper",p]);return T.useEffect(()=>{if(m.current){const _=m.current.getBBox();w({x:_.x,y:_.y,width:_.width,height:_.height})}},[r]),typeof r>"u"||!r?null:ue.createElement("g",{transform:`translate(${e-y.width/2} ${n-y.height/2})`,className:N,visibility:y.width?"visible":"hidden",...d},o&&ue.createElement("rect",{width:y.width+2*u[0],x:-u[0],y:-u[1],height:y.height+2*u[1],className:"react-flow__edge-textbg",style:l,rx:c,ry:c}),ue.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:m,style:i},r),h)};var OI=T.memo(PI);const Lv=e=>({width:e.offsetWidth,height:e.offsetHeight}),ho=(e,n=0,r=1)=>Math.min(Math.max(e,n),r),qv=(e={x:0,y:0},n)=>({x:ho(e.x,n[0][0],n[1][0]),y:ho(e.y,n[0][1],n[1][1])}),tx=(e,n,r)=>e<n?ho(Math.abs(e-n),1,50)/50:e>r?-ho(Math.abs(e-r),1,50)/50:0,sN=(e,n)=>{const r=tx(e.x,35,n.width-35)*20,i=tx(e.y,35,n.height-35)*20;return[r,i]},iN=e=>{var n;return((n=e.getRootNode)==null?void 0:n.call(e))||(window==null?void 0:window.document)},oN=(e,n)=>({x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}),Na=({x:e,y:n,width:r,height:i})=>({x:e,y:n,x2:e+r,y2:n+i}),aN=({x:e,y:n,x2:r,y2:i})=>({x:e,y:n,width:r-e,height:i-n}),nx=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),LI=(e,n)=>aN(oN(Na(e),Na(n))),cv=(e,n)=>{const r=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),i=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(r*i)},qI=e=>On(e.width)&&On(e.height)&&On(e.x)&&On(e.y),On=e=>!isNaN(e)&&isFinite(e),dt=Symbol.for("internals"),lN=["Enter"," ","Escape"],$I=(e,n)=>{},DI=e=>"nativeEvent"in e;function dv(e){var o,l;const n=DI(e)?e.nativeEvent:e,r=((l=(o=n.composedPath)==null?void 0:o.call(n))==null?void 0:l[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(r==null?void 0:r.nodeName)||(r==null?void 0:r.hasAttribute("contenteditable"))||!!(r!=null&&r.closest(".nokey"))}const uN=e=>"clientX"in e,bs=(e,n)=>{var l,u;const r=uN(e),i=r?e.clientX:(l=e.touches)==null?void 0:l[0].clientX,o=r?e.clientY:(u=e.touches)==null?void 0:u[0].clientY;return{x:i-((n==null?void 0:n.left)??0),y:o-((n==null?void 0:n.top)??0)}},pu=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Pa=({id:e,path:n,labelX:r,labelY:i,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,markerEnd:m,markerStart:y,interactionWidth:w=20})=>ue.createElement(ue.Fragment,null,ue.createElement("path",{id:e,style:d,d:n,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:y}),w&&ue.createElement("path",{d:n,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),o&&On(r)&&On(i)?ue.createElement(OI,{x:r,y:i,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p}):null);Pa.displayName="BaseEdge";function da(e,n,r){return r===void 0?r:i=>{const o=n().edges.find(l=>l.id===e);o&&r(i,{...o})}}function cN({sourceX:e,sourceY:n,targetX:r,targetY:i}){const o=Math.abs(r-e)/2,l=r<e?r+o:r-o,u=Math.abs(i-n)/2,c=i<n?i+u:i-u;return[l,c,o,u]}function dN({sourceX:e,sourceY:n,targetX:r,targetY:i,sourceControlX:o,sourceControlY:l,targetControlX:u,targetControlY:c}){const h=e*.125+o*.375+u*.375+r*.125,p=n*.125+l*.375+c*.375+i*.125,d=Math.abs(h-e),m=Math.abs(p-n);return[h,p,d,m]}var ai;(function(e){e.Strict="strict",e.Loose="loose"})(ai||(ai={}));var ri;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ri||(ri={}));var Ca;(function(e){e.Partial="partial",e.Full="full"})(Ca||(Ca={}));var _s;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(_s||(_s={}));var mu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(mu||(mu={}));var Ae;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ae||(Ae={}));function rx({pos:e,x1:n,y1:r,x2:i,y2:o}){return e===Ae.Left||e===Ae.Right?[.5*(n+i),r]:[n,.5*(r+o)]}function fN({sourceX:e,sourceY:n,sourcePosition:r=Ae.Bottom,targetX:i,targetY:o,targetPosition:l=Ae.Top}){const[u,c]=rx({pos:r,x1:e,y1:n,x2:i,y2:o}),[h,p]=rx({pos:l,x1:i,y1:o,x2:e,y2:n}),[d,m,y,w]=dN({sourceX:e,sourceY:n,targetX:i,targetY:o,sourceControlX:u,sourceControlY:c,targetControlX:h,targetControlY:p});return[`M${e},${n} C${u},${c} ${h},${p} ${i},${o}`,d,m,y,w]}const $v=T.memo(({sourceX:e,sourceY:n,targetX:r,targetY:i,sourcePosition:o=Ae.Bottom,targetPosition:l=Ae.Top,label:u,labelStyle:c,labelShowBg:h,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:_})=>{const[S,b,k]=fN({sourceX:e,sourceY:n,sourcePosition:o,targetX:r,targetY:i,targetPosition:l});return ue.createElement(Pa,{path:S,labelX:b,labelY:k,label:u,labelStyle:c,labelShowBg:h,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:_})});$v.displayName="SimpleBezierEdge";const sx={[Ae.Left]:{x:-1,y:0},[Ae.Right]:{x:1,y:0},[Ae.Top]:{x:0,y:-1},[Ae.Bottom]:{x:0,y:1}},FI=({source:e,sourcePosition:n=Ae.Bottom,target:r})=>n===Ae.Left||n===Ae.Right?e.x<r.x?{x:1,y:0}:{x:-1,y:0}:e.y<r.y?{x:0,y:1}:{x:0,y:-1},ix=(e,n)=>Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2));function zI({source:e,sourcePosition:n=Ae.Bottom,target:r,targetPosition:i=Ae.Top,center:o,offset:l}){const u=sx[n],c=sx[i],h={x:e.x+u.x*l,y:e.y+u.y*l},p={x:r.x+c.x*l,y:r.y+c.y*l},d=FI({source:h,sourcePosition:n,target:p}),m=d.x!==0?"x":"y",y=d[m];let w=[],N,_;const S={x:0,y:0},b={x:0,y:0},[k,E,C,A]=cN({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(u[m]*c[m]===-1){N=o.x??k,_=o.y??E;const L=[{x:N,y:h.y},{x:N,y:p.y}],H=[{x:h.x,y:_},{x:p.x,y:_}];u[m]===y?w=m==="x"?L:H:w=m==="x"?H:L}else{const L=[{x:h.x,y:p.y}],H=[{x:p.x,y:h.y}];if(m==="x"?w=u.x===y?H:L:w=u.y===y?L:H,n===i){const q=Math.abs(e[m]-r[m]);if(q<=l){const R=Math.min(l-1,l-q);u[m]===y?S[m]=(h[m]>e[m]?-1:1)*R:b[m]=(p[m]>r[m]?-1:1)*R}}if(n!==i){const q=m==="x"?"y":"x",R=u[m]===c[q],Q=h[q]>p[q],z=h[q]<p[q];(u[m]===1&&(!R&&Q||R&&z)||u[m]!==1&&(!R&&z||R&&Q))&&(w=m==="x"?L:H)}const O={x:h.x+S.x,y:h.y+S.y},P={x:p.x+b.x,y:p.y+b.y},F=Math.max(Math.abs(O.x-w[0].x),Math.abs(P.x-w[0].x)),Y=Math.max(Math.abs(O.y-w[0].y),Math.abs(P.y-w[0].y));F>=Y?(N=(O.x+P.x)/2,_=w[0].y):(N=w[0].x,_=(O.y+P.y)/2)}return[[e,{x:h.x+S.x,y:h.y+S.y},...w,{x:p.x+b.x,y:p.y+b.y},r],N,_,C,A]}function BI(e,n,r,i){const o=Math.min(ix(e,n)/2,ix(n,r)/2,i),{x:l,y:u}=n;if(e.x===l&&l===r.x||e.y===u&&u===r.y)return`L${l} ${u}`;if(e.y===u){const p=e.x<r.x?-1:1,d=e.y<r.y?1:-1;return`L ${l+o*p},${u}Q ${l},${u} ${l},${u+o*d}`}const c=e.x<r.x?1:-1,h=e.y<r.y?-1:1;return`L ${l},${u+o*h}Q ${l},${u} ${l+o*c},${u}`}function fv({sourceX:e,sourceY:n,sourcePosition:r=Ae.Bottom,targetX:i,targetY:o,targetPosition:l=Ae.Top,borderRadius:u=5,centerX:c,centerY:h,offset:p=20}){const[d,m,y,w,N]=zI({source:{x:e,y:n},sourcePosition:r,target:{x:i,y:o},targetPosition:l,center:{x:c,y:h},offset:p});return[d.reduce((S,b,k)=>{let E="";return k>0&&k<d.length-1?E=BI(d[k-1],b,d[k+1],u):E=`${k===0?"M":"L"}${b.x} ${b.y}`,S+=E,S},""),m,y,w,N]}const Nu=T.memo(({sourceX:e,sourceY:n,targetX:r,targetY:i,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,sourcePosition:m=Ae.Bottom,targetPosition:y=Ae.Top,markerEnd:w,markerStart:N,pathOptions:_,interactionWidth:S})=>{const[b,k,E]=fv({sourceX:e,sourceY:n,sourcePosition:m,targetX:r,targetY:i,targetPosition:y,borderRadius:_==null?void 0:_.borderRadius,offset:_==null?void 0:_.offset});return ue.createElement(Pa,{path:b,labelX:k,labelY:E,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,markerEnd:w,markerStart:N,interactionWidth:S})});Nu.displayName="SmoothStepEdge";const Dv=T.memo(e=>{var n;return ue.createElement(Nu,{...e,pathOptions:T.useMemo(()=>{var r;return{borderRadius:0,offset:(r=e.pathOptions)==null?void 0:r.offset}},[(n=e.pathOptions)==null?void 0:n.offset])})});Dv.displayName="StepEdge";function UI({sourceX:e,sourceY:n,targetX:r,targetY:i}){const[o,l,u,c]=cN({sourceX:e,sourceY:n,targetX:r,targetY:i});return[`M ${e},${n}L ${r},${i}`,o,l,u,c]}const Fv=T.memo(({sourceX:e,sourceY:n,targetX:r,targetY:i,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,markerEnd:m,markerStart:y,interactionWidth:w})=>{const[N,_,S]=UI({sourceX:e,sourceY:n,targetX:r,targetY:i});return ue.createElement(Pa,{path:N,labelX:_,labelY:S,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,markerEnd:m,markerStart:y,interactionWidth:w})});Fv.displayName="StraightEdge";function Wl(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function ox({pos:e,x1:n,y1:r,x2:i,y2:o,c:l}){switch(e){case Ae.Left:return[n-Wl(n-i,l),r];case Ae.Right:return[n+Wl(i-n,l),r];case Ae.Top:return[n,r-Wl(r-o,l)];case Ae.Bottom:return[n,r+Wl(o-r,l)]}}function hN({sourceX:e,sourceY:n,sourcePosition:r=Ae.Bottom,targetX:i,targetY:o,targetPosition:l=Ae.Top,curvature:u=.25}){const[c,h]=ox({pos:r,x1:e,y1:n,x2:i,y2:o,c:u}),[p,d]=ox({pos:l,x1:i,y1:o,x2:e,y2:n,c:u}),[m,y,w,N]=dN({sourceX:e,sourceY:n,targetX:i,targetY:o,sourceControlX:c,sourceControlY:h,targetControlX:p,targetControlY:d});return[`M${e},${n} C${c},${h} ${p},${d} ${i},${o}`,m,y,w,N]}const gu=T.memo(({sourceX:e,sourceY:n,targetX:r,targetY:i,sourcePosition:o=Ae.Bottom,targetPosition:l=Ae.Top,label:u,labelStyle:c,labelShowBg:h,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,pathOptions:_,interactionWidth:S})=>{const[b,k,E]=hN({sourceX:e,sourceY:n,sourcePosition:o,targetX:r,targetY:i,targetPosition:l,curvature:_==null?void 0:_.curvature});return ue.createElement(Pa,{path:b,labelX:k,labelY:E,label:u,labelStyle:c,labelShowBg:h,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:S})});gu.displayName="BezierEdge";const zv=T.createContext(null),HI=zv.Provider;zv.Consumer;const WI=()=>T.useContext(zv),VI=e=>"id"in e&&"source"in e&&"target"in e,GI=({source:e,sourceHandle:n,target:r,targetHandle:i})=>`reactflow__edge-${e}${n||""}-${r}${i||""}`,hv=(e,n)=>typeof e>"u"?"":typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`,YI=(e,n)=>n.some(r=>r.source===e.source&&r.target===e.target&&(r.sourceHandle===e.sourceHandle||!r.sourceHandle&&!e.sourceHandle)&&(r.targetHandle===e.targetHandle||!r.targetHandle&&!e.targetHandle)),KI=(e,n)=>{if(!e.source||!e.target)return n;let r;return VI(e)?r={...e}:r={...e,id:GI(e)},YI(r,n)?n:n.concat(r)},pv=({x:e,y:n},[r,i,o],l,[u,c])=>{const h={x:(e-r)/o,y:(n-i)/o};return l?{x:u*Math.round(h.x/u),y:c*Math.round(h.y/c)}:h},pN=({x:e,y:n},[r,i,o])=>({x:e*o+r,y:n*o+i}),ii=(e,n=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const r=(e.width??0)*n[0],i=(e.height??0)*n[1],o={x:e.position.x-r,y:e.position.y-i};return{...o,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-r,y:e.positionAbsolute.y-i}:o}},Cu=(e,n=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const r=e.reduce((i,o)=>{const{x:l,y:u}=ii(o,n).positionAbsolute;return oN(i,Na({x:l,y:u,width:o.width||0,height:o.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return aN(r)},mN=(e,n,[r,i,o]=[0,0,1],l=!1,u=!1,c=[0,0])=>{const h={x:(n.x-r)/o,y:(n.y-i)/o,width:n.width/o,height:n.height/o},p=[];return e.forEach(d=>{const{width:m,height:y,selectable:w=!0,hidden:N=!1}=d;if(u&&!w||N)return!1;const{positionAbsolute:_}=ii(d,c),S={x:_.x,y:_.y,width:m||0,height:y||0},b=cv(h,S),k=typeof m>"u"||typeof y>"u"||m===null||y===null,E=l&&b>0,C=(m||0)*(y||0);(k||E||b>=C||d.dragging)&&p.push(d)}),p},gN=(e,n)=>{const r=e.map(i=>i.id);return n.filter(i=>r.includes(i.source)||r.includes(i.target))},vN=(e,n,r,i,o,l=.1)=>{const u=n/(e.width*(1+l)),c=r/(e.height*(1+l)),h=Math.min(u,c),p=ho(h,i,o),d=e.x+e.width/2,m=e.y+e.height/2,y=n/2-d*p,w=r/2-m*p;return{x:y,y:w,zoom:p}},ti=(e,n=0)=>e.transition().duration(n);function ax(e,n,r,i){return(n[r]||[]).reduce((o,l)=>{var u,c;return`${e.id}-${l.id}-${r}`!==i&&o.push({id:l.id||null,type:r,nodeId:e.id,x:(((u=e.positionAbsolute)==null?void 0:u.x)??0)+l.x+l.width/2,y:(((c=e.positionAbsolute)==null?void 0:c.y)??0)+l.y+l.height/2}),o},[])}function XI(e,n,r,i,o,l){const{x:u,y:c}=bs(e),p=n.elementsFromPoint(u,c).find(N=>N.classList.contains("react-flow__handle"));if(p){const N=p.getAttribute("data-nodeid");if(N){const _=Bv(void 0,p),S=p.getAttribute("data-handleid"),b=l({nodeId:N,id:S,type:_});if(b){const k=o.find(E=>E.nodeId===N&&E.type===_&&E.id===S);return{handle:{id:S,type:_,nodeId:N,x:(k==null?void 0:k.x)||r.x,y:(k==null?void 0:k.y)||r.y},validHandleResult:b}}}}let d=[],m=1/0;if(o.forEach(N=>{const _=Math.sqrt((N.x-r.x)**2+(N.y-r.y)**2);if(_<=i){const S=l(N);_<=m&&(_<m?d=[{handle:N,validHandleResult:S}]:_===m&&d.push({handle:N,validHandleResult:S}),m=_)}}),!d.length)return{handle:null,validHandleResult:yN()};if(d.length===1)return d[0];const y=d.some(({validHandleResult:N})=>N.isValid),w=d.some(({handle:N})=>N.type==="target");return d.find(({handle:N,validHandleResult:_})=>w?N.type==="target":y?_.isValid:!0)||d[0]}const QI={source:null,target:null,sourceHandle:null,targetHandle:null},yN=()=>({handleDomNode:null,isValid:!1,connection:QI,endHandle:null});function wN(e,n,r,i,o,l,u){const c=o==="target",h=u.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),p={...yN(),handleDomNode:h};if(h){const d=Bv(void 0,h),m=h.getAttribute("data-nodeid"),y=h.getAttribute("data-handleid"),w=h.classList.contains("connectable"),N=h.classList.contains("connectableend"),_={source:c?m:r,sourceHandle:c?y:i,target:c?r:m,targetHandle:c?i:y};p.connection=_,w&&N&&(n===ai.Strict?c&&d==="source"||!c&&d==="target":m!==r||y!==i)&&(p.endHandle={nodeId:m,handleId:y,type:d},p.isValid=l(_))}return p}function ZI({nodes:e,nodeId:n,handleId:r,handleType:i}){return e.reduce((o,l)=>{if(l[dt]){const{handleBounds:u}=l[dt];let c=[],h=[];u&&(c=ax(l,u,"source",`${n}-${r}-${i}`),h=ax(l,u,"target",`${n}-${r}-${i}`)),o.push(...c,...h)}return o},[])}function Bv(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function Rd(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function JI(e,n){let r=null;return n?r="valid":e&&!n&&(r="invalid"),r}function xN({event:e,handleId:n,nodeId:r,onConnect:i,isTarget:o,getState:l,setState:u,isValidConnection:c,edgeUpdaterType:h,onReconnectEnd:p}){const d=iN(e.target),{connectionMode:m,domNode:y,autoPanOnConnect:w,connectionRadius:N,onConnectStart:_,panBy:S,getNodes:b,cancelConnection:k}=l();let E=0,C;const{x:A,y:M}=bs(e),L=d==null?void 0:d.elementFromPoint(A,M),H=Bv(h,L),O=y==null?void 0:y.getBoundingClientRect();if(!O||!H)return;let P,F=bs(e,O),Y=!1,q=null,R=!1,Q=null;const z=ZI({nodes:b(),nodeId:r,handleId:n,handleType:H}),ne=()=>{if(!w)return;const[X,I]=sN(F,O);S({x:X,y:I}),E=requestAnimationFrame(ne)};u({connectionPosition:F,connectionStatus:null,connectionNodeId:r,connectionHandleId:n,connectionHandleType:H,connectionStartHandle:{nodeId:r,handleId:n,type:H},connectionEndHandle:null}),_==null||_(e,{nodeId:r,handleId:n,handleType:H});function Z(X){const{transform:I}=l();F=bs(X,O);const{handle:W,validHandleResult:G}=XI(X,d,pv(F,I,!1,[1,1]),N,z,U=>wN(U,m,r,n,o?"target":"source",c,d));if(C=W,Y||(ne(),Y=!0),Q=G.handleDomNode,q=G.connection,R=G.isValid,u({connectionPosition:C&&R?pN({x:C.x,y:C.y},I):F,connectionStatus:JI(!!C,R),connectionEndHandle:G.endHandle}),!C&&!R&&!Q)return Rd(P);q.source!==q.target&&Q&&(Rd(P),P=Q,Q.classList.add("connecting","react-flow__handle-connecting"),Q.classList.toggle("valid",R),Q.classList.toggle("react-flow__handle-valid",R))}function $(X){var I,W;(C||Q)&&q&&R&&(i==null||i(q)),(W=(I=l()).onConnectEnd)==null||W.call(I,X),h&&(p==null||p(X)),Rd(P),k(),cancelAnimationFrame(E),Y=!1,R=!1,q=null,Q=null,d.removeEventListener("mousemove",Z),d.removeEventListener("mouseup",$),d.removeEventListener("touchmove",Z),d.removeEventListener("touchend",$)}d.addEventListener("mousemove",Z),d.addEventListener("mouseup",$),d.addEventListener("touchmove",Z),d.addEventListener("touchend",$)}const lx=()=>!0,eM=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),tM=(e,n,r)=>i=>{const{connectionStartHandle:o,connectionEndHandle:l,connectionClickStartHandle:u}=i;return{connecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.handleId)===n&&(o==null?void 0:o.type)===r||(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===n&&(l==null?void 0:l.type)===r,clickConnecting:(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.handleId)===n&&(u==null?void 0:u.type)===r}},_N=T.forwardRef(({type:e="source",position:n=Ae.Top,isValidConnection:r,isConnectable:i=!0,isConnectableStart:o=!0,isConnectableEnd:l=!0,id:u,onConnect:c,children:h,className:p,onMouseDown:d,onTouchStart:m,...y},w)=>{var O,P;const N=u||null,_=e==="target",S=Ct(),b=WI(),{connectOnClick:k,noPanClassName:E}=Ke(eM,Nt),{connecting:C,clickConnecting:A}=Ke(tM(b,N,e),Nt);b||(P=(O=S.getState()).onError)==null||P.call(O,"010",Hr.error010());const M=F=>{const{defaultEdgeOptions:Y,onConnect:q,hasDefaultEdges:R}=S.getState(),Q={...Y,...F};if(R){const{edges:z,setEdges:ne}=S.getState();ne(KI(Q,z))}q==null||q(Q),c==null||c(Q)},L=F=>{if(!b)return;const Y=uN(F);o&&(Y&&F.button===0||!Y)&&xN({event:F,handleId:N,nodeId:b,onConnect:M,isTarget:_,getState:S.getState,setState:S.setState,isValidConnection:r||S.getState().isValidConnection||lx}),Y?d==null||d(F):m==null||m(F)},H=F=>{const{onClickConnectStart:Y,onClickConnectEnd:q,connectionClickStartHandle:R,connectionMode:Q,isValidConnection:z}=S.getState();if(!b||!R&&!o)return;if(!R){Y==null||Y(F,{nodeId:b,handleId:N,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:b,type:e,handleId:N}});return}const ne=iN(F.target),Z=r||z||lx,{connection:$,isValid:X}=wN({nodeId:b,id:N,type:e},Q,R.nodeId,R.handleId||null,R.type,Z,ne);X&&M($),q==null||q(F),S.setState({connectionClickStartHandle:null})};return ue.createElement("div",{"data-handleid":N,"data-nodeid":b,"data-handlepos":n,"data-id":`${b}-${N}-${e}`,className:Bt(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",E,p,{source:!_,target:_,connectable:i,connectablestart:o,connectableend:l,connecting:A,connectionindicator:i&&(o&&!C||l&&C)}]),onMouseDown:L,onTouchStart:L,onClick:k?H:void 0,ref:w,...y},h)});_N.displayName="Handle";var po=T.memo(_N);const bN=({data:e,isConnectable:n,targetPosition:r=Ae.Top,sourcePosition:i=Ae.Bottom})=>ue.createElement(ue.Fragment,null,ue.createElement(po,{type:"target",position:r,isConnectable:n}),e==null?void 0:e.label,ue.createElement(po,{type:"source",position:i,isConnectable:n}));bN.displayName="DefaultNode";var mv=T.memo(bN);const SN=({data:e,isConnectable:n,sourcePosition:r=Ae.Bottom})=>ue.createElement(ue.Fragment,null,e==null?void 0:e.label,ue.createElement(po,{type:"source",position:r,isConnectable:n}));SN.displayName="InputNode";var kN=T.memo(SN);const EN=({data:e,isConnectable:n,targetPosition:r=Ae.Top})=>ue.createElement(ue.Fragment,null,ue.createElement(po,{type:"target",position:r,isConnectable:n}),e==null?void 0:e.label);EN.displayName="OutputNode";var NN=T.memo(EN);const Uv=()=>null;Uv.displayName="GroupNode";const nM=e=>({selectedNodes:e.getNodes().filter(n=>n.selected),selectedEdges:e.edges.filter(n=>n.selected).map(n=>({...n}))}),Vl=e=>e.id;function rM(e,n){return Nt(e.selectedNodes.map(Vl),n.selectedNodes.map(Vl))&&Nt(e.selectedEdges.map(Vl),n.selectedEdges.map(Vl))}const CN=T.memo(({onSelectionChange:e})=>{const n=Ct(),{selectedNodes:r,selectedEdges:i}=Ke(nM,rM);return T.useEffect(()=>{const o={nodes:r,edges:i};e==null||e(o),n.getState().onSelectionChange.forEach(l=>l(o))},[r,i,e]),null});CN.displayName="SelectionListener";const sM=e=>!!e.onSelectionChange;function iM({onSelectionChange:e}){const n=Ke(sM);return e||n?ue.createElement(CN,{onSelectionChange:e}):null}const oM=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function Qi(e,n){T.useEffect(()=>{typeof e<"u"&&n(e)},[e])}function $e(e,n,r){T.useEffect(()=>{typeof n<"u"&&r({[e]:n})},[n])}const aM=({nodes:e,edges:n,defaultNodes:r,defaultEdges:i,onConnect:o,onConnectStart:l,onConnectEnd:u,onClickConnectStart:c,onClickConnectEnd:h,nodesDraggable:p,nodesConnectable:d,nodesFocusable:m,edgesFocusable:y,edgesUpdatable:w,elevateNodesOnSelect:N,minZoom:_,maxZoom:S,nodeExtent:b,onNodesChange:k,onEdgesChange:E,elementsSelectable:C,connectionMode:A,snapGrid:M,snapToGrid:L,translateExtent:H,connectOnClick:O,defaultEdgeOptions:P,fitView:F,fitViewOptions:Y,onNodesDelete:q,onEdgesDelete:R,onNodeDrag:Q,onNodeDragStart:z,onNodeDragStop:ne,onSelectionDrag:Z,onSelectionDragStart:$,onSelectionDragStop:X,noPanClassName:I,nodeOrigin:W,rfId:G,autoPanOnConnect:U,autoPanOnNodeDrag:J,onError:re,connectionRadius:le,isValidConnection:fe,nodeDragThreshold:te})=>{const{setNodes:ce,setEdges:Ce,setDefaultNodesAndEdges:ve,setMinZoom:Te,setMaxZoom:ye,setTranslateExtent:ke,setNodeExtent:Ge,reset:we}=Ke(oM,Nt),_e=Ct();return T.useEffect(()=>{const ze=i==null?void 0:i.map(ft=>({...ft,...P}));return ve(r,ze),()=>{we()}},[]),$e("defaultEdgeOptions",P,_e.setState),$e("connectionMode",A,_e.setState),$e("onConnect",o,_e.setState),$e("onConnectStart",l,_e.setState),$e("onConnectEnd",u,_e.setState),$e("onClickConnectStart",c,_e.setState),$e("onClickConnectEnd",h,_e.setState),$e("nodesDraggable",p,_e.setState),$e("nodesConnectable",d,_e.setState),$e("nodesFocusable",m,_e.setState),$e("edgesFocusable",y,_e.setState),$e("edgesUpdatable",w,_e.setState),$e("elementsSelectable",C,_e.setState),$e("elevateNodesOnSelect",N,_e.setState),$e("snapToGrid",L,_e.setState),$e("snapGrid",M,_e.setState),$e("onNodesChange",k,_e.setState),$e("onEdgesChange",E,_e.setState),$e("connectOnClick",O,_e.setState),$e("fitViewOnInit",F,_e.setState),$e("fitViewOnInitOptions",Y,_e.setState),$e("onNodesDelete",q,_e.setState),$e("onEdgesDelete",R,_e.setState),$e("onNodeDrag",Q,_e.setState),$e("onNodeDragStart",z,_e.setState),$e("onNodeDragStop",ne,_e.setState),$e("onSelectionDrag",Z,_e.setState),$e("onSelectionDragStart",$,_e.setState),$e("onSelectionDragStop",X,_e.setState),$e("noPanClassName",I,_e.setState),$e("nodeOrigin",W,_e.setState),$e("rfId",G,_e.setState),$e("autoPanOnConnect",U,_e.setState),$e("autoPanOnNodeDrag",J,_e.setState),$e("onError",re,_e.setState),$e("connectionRadius",le,_e.setState),$e("isValidConnection",fe,_e.setState),$e("nodeDragThreshold",te,_e.setState),Qi(e,ce),Qi(n,Ce),Qi(_,Te),Qi(S,ye),Qi(H,ke),Qi(b,Ge),null},ux={display:"none"},lM={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},jN="react-flow__node-desc",RN="react-flow__edge-desc",uM="react-flow__aria-live",cM=e=>e.ariaLiveMessage;function dM({rfId:e}){const n=Ke(cM);return ue.createElement("div",{id:`${uM}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:lM},n)}function fM({rfId:e,disableKeyboardA11y:n}){return ue.createElement(ue.Fragment,null,ue.createElement("div",{id:`${jN}-${e}`,style:ux},"Press enter or space to select a node.",!n&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),ue.createElement("div",{id:`${RN}-${e}`,style:ux},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!n&&ue.createElement(dM,{rfId:e}))}var ja=(e=null,n={actInsideInputWithModifier:!0})=>{const[r,i]=T.useState(!1),o=T.useRef(!1),l=T.useRef(new Set([])),[u,c]=T.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(m=>typeof m=="string").map(m=>m.split("+")),d=p.reduce((m,y)=>m.concat(...y),[]);return[p,d]}return[[],[]]},[e]);return T.useEffect(()=>{const h=typeof document<"u"?document:null,p=(n==null?void 0:n.target)||h;if(e!==null){const d=w=>{if(o.current=w.ctrlKey||w.metaKey||w.shiftKey,(!o.current||o.current&&!n.actInsideInputWithModifier)&&dv(w))return!1;const _=dx(w.code,c);l.current.add(w[_]),cx(u,l.current,!1)&&(w.preventDefault(),i(!0))},m=w=>{if((!o.current||o.current&&!n.actInsideInputWithModifier)&&dv(w))return!1;const _=dx(w.code,c);cx(u,l.current,!0)?(i(!1),l.current.clear()):l.current.delete(w[_]),w.key==="Meta"&&l.current.clear(),o.current=!1},y=()=>{l.current.clear(),i(!1)};return p==null||p.addEventListener("keydown",d),p==null||p.addEventListener("keyup",m),window.addEventListener("blur",y),()=>{p==null||p.removeEventListener("keydown",d),p==null||p.removeEventListener("keyup",m),window.removeEventListener("blur",y)}}},[e,i]),r};function cx(e,n,r){return e.filter(i=>r||i.length===n.size).some(i=>i.every(o=>n.has(o)))}function dx(e,n){return n.includes(e)?"code":"key"}function TN(e,n,r,i){var c,h;const o=e.parentNode||e.parentId;if(!o)return r;const l=n.get(o),u=ii(l,i);return TN(l,n,{x:(r.x??0)+u.x,y:(r.y??0)+u.y,z:(((c=l[dt])==null?void 0:c.z)??0)>(r.z??0)?((h=l[dt])==null?void 0:h.z)??0:r.z??0},i)}function AN(e,n,r){e.forEach(i=>{var l;const o=i.parentNode||i.parentId;if(o&&!e.has(o))throw new Error(`Parent node ${o} not found`);if(o||r!=null&&r[i.id]){const{x:u,y:c,z:h}=TN(i,e,{...i.position,z:((l=i[dt])==null?void 0:l.z)??0},n);i.positionAbsolute={x:u,y:c},i[dt].z=h,r!=null&&r[i.id]&&(i[dt].isParent=!0)}})}function Td(e,n,r,i){const o=new Map,l={},u=i?1e3:0;return e.forEach(c=>{var w;const h=(On(c.zIndex)?c.zIndex:0)+(c.selected?u:0),p=n.get(c.id),d={...c,positionAbsolute:{x:c.position.x,y:c.position.y}},m=c.parentNode||c.parentId;m&&(l[m]=!0);const y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==c.type;Object.defineProperty(d,dt,{enumerable:!1,value:{handleBounds:y||(w=p==null?void 0:p[dt])==null?void 0:w.handleBounds,z:h}}),o.set(c.id,d)}),AN(o,r,l),o}function IN(e,n={}){const{getNodes:r,width:i,height:o,minZoom:l,maxZoom:u,d3Zoom:c,d3Selection:h,fitViewOnInitDone:p,fitViewOnInit:d,nodeOrigin:m}=e(),y=n.initial&&!p&&d;if(c&&h&&(y||!n.initial)){const N=r().filter(S=>{var k;const b=n.includeHiddenNodes?S.width&&S.height:!S.hidden;return(k=n.nodes)!=null&&k.length?b&&n.nodes.some(E=>E.id===S.id):b}),_=N.every(S=>S.width&&S.height);if(N.length>0&&_){const S=Cu(N,m),{x:b,y:k,zoom:E}=vN(S,i,o,n.minZoom??l,n.maxZoom??u,n.padding??.1),C=Br.translate(b,k).scale(E);return typeof n.duration=="number"&&n.duration>0?c.transform(ti(h,n.duration),C):c.transform(h,C),!0}}return!1}function hM(e,n){return e.forEach(r=>{const i=n.get(r.id);i&&n.set(i.id,{...i,[dt]:i[dt],selected:r.selected})}),new Map(n)}function pM(e,n){return n.map(r=>{const i=e.find(o=>o.id===r.id);return i&&(r.selected=i.selected),r})}function Gl({changedNodes:e,changedEdges:n,get:r,set:i}){const{nodeInternals:o,edges:l,onNodesChange:u,onEdgesChange:c,hasDefaultNodes:h,hasDefaultEdges:p}=r();e!=null&&e.length&&(h&&i({nodeInternals:hM(e,o)}),u==null||u(e)),n!=null&&n.length&&(p&&i({edges:pM(n,l)}),c==null||c(n))}const Zi=()=>{},mM={zoomIn:Zi,zoomOut:Zi,zoomTo:Zi,getZoom:()=>1,setViewport:Zi,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Zi,fitBounds:Zi,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},gM=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),vM=()=>{const e=Ct(),{d3Zoom:n,d3Selection:r}=Ke(gM,Nt);return T.useMemo(()=>r&&n?{zoomIn:o=>n.scaleBy(ti(r,o==null?void 0:o.duration),1.2),zoomOut:o=>n.scaleBy(ti(r,o==null?void 0:o.duration),1/1.2),zoomTo:(o,l)=>n.scaleTo(ti(r,l==null?void 0:l.duration),o),getZoom:()=>e.getState().transform[2],setViewport:(o,l)=>{const[u,c,h]=e.getState().transform,p=Br.translate(o.x??u,o.y??c).scale(o.zoom??h);n.transform(ti(r,l==null?void 0:l.duration),p)},getViewport:()=>{const[o,l,u]=e.getState().transform;return{x:o,y:l,zoom:u}},fitView:o=>IN(e.getState,o),setCenter:(o,l,u)=>{const{width:c,height:h,maxZoom:p}=e.getState(),d=typeof(u==null?void 0:u.zoom)<"u"?u.zoom:p,m=c/2-o*d,y=h/2-l*d,w=Br.translate(m,y).scale(d);n.transform(ti(r,u==null?void 0:u.duration),w)},fitBounds:(o,l)=>{const{width:u,height:c,minZoom:h,maxZoom:p}=e.getState(),{x:d,y:m,zoom:y}=vN(o,u,c,h,p,(l==null?void 0:l.padding)??.1),w=Br.translate(d,m).scale(y);n.transform(ti(r,l==null?void 0:l.duration),w)},project:o=>{const{transform:l,snapToGrid:u,snapGrid:c}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),pv(o,l,u,c)},screenToFlowPosition:o=>{const{transform:l,snapToGrid:u,snapGrid:c,domNode:h}=e.getState();if(!h)return o;const{x:p,y:d}=h.getBoundingClientRect(),m={x:o.x-p,y:o.y-d};return pv(m,l,u,c)},flowToScreenPosition:o=>{const{transform:l,domNode:u}=e.getState();if(!u)return o;const{x:c,y:h}=u.getBoundingClientRect(),p=pN(o,l);return{x:p.x+c,y:p.y+h}},viewportInitialized:!0}:mM,[n,r])};function Oa(){const e=vM(),n=Ct(),r=T.useCallback(()=>n.getState().getNodes().map(_=>({..._})),[]),i=T.useCallback(_=>n.getState().nodeInternals.get(_),[]),o=T.useCallback(()=>{const{edges:_=[]}=n.getState();return _.map(S=>({...S}))},[]),l=T.useCallback(_=>{const{edges:S=[]}=n.getState();return S.find(b=>b.id===_)},[]),u=T.useCallback(_=>{const{getNodes:S,setNodes:b,hasDefaultNodes:k,onNodesChange:E}=n.getState(),C=S(),A=typeof _=="function"?_(C):_;if(k)b(A);else if(E){const M=A.length===0?C.map(L=>({type:"remove",id:L.id})):A.map(L=>({item:L,type:"reset"}));E(M)}},[]),c=T.useCallback(_=>{const{edges:S=[],setEdges:b,hasDefaultEdges:k,onEdgesChange:E}=n.getState(),C=typeof _=="function"?_(S):_;if(k)b(C);else if(E){const A=C.length===0?S.map(M=>({type:"remove",id:M.id})):C.map(M=>({item:M,type:"reset"}));E(A)}},[]),h=T.useCallback(_=>{const S=Array.isArray(_)?_:[_],{getNodes:b,setNodes:k,hasDefaultNodes:E,onNodesChange:C}=n.getState();if(E){const M=[...b(),...S];k(M)}else if(C){const A=S.map(M=>({item:M,type:"add"}));C(A)}},[]),p=T.useCallback(_=>{const S=Array.isArray(_)?_:[_],{edges:b=[],setEdges:k,hasDefaultEdges:E,onEdgesChange:C}=n.getState();if(E)k([...b,...S]);else if(C){const A=S.map(M=>({item:M,type:"add"}));C(A)}},[]),d=T.useCallback(()=>{const{getNodes:_,edges:S=[],transform:b}=n.getState(),[k,E,C]=b;return{nodes:_().map(A=>({...A})),edges:S.map(A=>({...A})),viewport:{x:k,y:E,zoom:C}}},[]),m=T.useCallback(({nodes:_,edges:S})=>{const{nodeInternals:b,getNodes:k,edges:E,hasDefaultNodes:C,hasDefaultEdges:A,onNodesDelete:M,onEdgesDelete:L,onNodesChange:H,onEdgesChange:O}=n.getState(),P=(_||[]).map(Q=>Q.id),F=(S||[]).map(Q=>Q.id),Y=k().reduce((Q,z)=>{const ne=z.parentNode||z.parentId,Z=!P.includes(z.id)&&ne&&Q.find(X=>X.id===ne);return(typeof z.deletable=="boolean"?z.deletable:!0)&&(P.includes(z.id)||Z)&&Q.push(z),Q},[]),q=E.filter(Q=>typeof Q.deletable=="boolean"?Q.deletable:!0),R=q.filter(Q=>F.includes(Q.id));if(Y||R){const Q=gN(Y,q),z=[...R,...Q],ne=z.reduce((Z,$)=>(Z.includes($.id)||Z.push($.id),Z),[]);if((A||C)&&(A&&n.setState({edges:E.filter(Z=>!ne.includes(Z.id))}),C&&(Y.forEach(Z=>{b.delete(Z.id)}),n.setState({nodeInternals:new Map(b)}))),ne.length>0&&(L==null||L(z),O&&O(ne.map(Z=>({id:Z,type:"remove"})))),Y.length>0&&(M==null||M(Y),H)){const Z=Y.map($=>({id:$.id,type:"remove"}));H(Z)}}},[]),y=T.useCallback(_=>{const S=qI(_),b=S?null:n.getState().nodeInternals.get(_.id);return!S&&!b?[null,null,S]:[S?_:nx(b),b,S]},[]),w=T.useCallback((_,S=!0,b)=>{const[k,E,C]=y(_);return k?(b||n.getState().getNodes()).filter(A=>{if(!C&&(A.id===E.id||!A.positionAbsolute))return!1;const M=nx(A),L=cv(M,k);return S&&L>0||L>=k.width*k.height}):[]},[]),N=T.useCallback((_,S,b=!0)=>{const[k]=y(_);if(!k)return!1;const E=cv(k,S);return b&&E>0||E>=k.width*k.height},[]);return T.useMemo(()=>({...e,getNodes:r,getNode:i,getEdges:o,getEdge:l,setNodes:u,setEdges:c,addNodes:h,addEdges:p,toObject:d,deleteElements:m,getIntersectingNodes:w,isNodeIntersecting:N}),[e,r,i,o,l,u,c,h,p,d,m,w,N])}const yM={actInsideInputWithModifier:!1};var wM=({deleteKeyCode:e,multiSelectionKeyCode:n})=>{const r=Ct(),{deleteElements:i}=Oa(),o=ja(e,yM),l=ja(n);T.useEffect(()=>{if(o){const{edges:u,getNodes:c}=r.getState(),h=c().filter(d=>d.selected),p=u.filter(d=>d.selected);i({nodes:h,edges:p}),r.setState({nodesSelectionActive:!1})}},[o]),T.useEffect(()=>{r.setState({multiSelectionActive:l})},[l])};function xM(e){const n=Ct();T.useEffect(()=>{let r;const i=()=>{var l,u;if(!e.current)return;const o=Lv(e.current);(o.height===0||o.width===0)&&((u=(l=n.getState()).onError)==null||u.call(l,"004",Hr.error004())),n.setState({width:o.width||500,height:o.height||500})};return i(),window.addEventListener("resize",i),e.current&&(r=new ResizeObserver(()=>i()),r.observe(e.current)),()=>{window.removeEventListener("resize",i),r&&e.current&&r.unobserve(e.current)}},[])}const Hv={position:"absolute",width:"100%",height:"100%",top:0,left:0},_M=(e,n)=>e.x!==n.x||e.y!==n.y||e.zoom!==n.k,Yl=e=>({x:e.x,y:e.y,zoom:e.k}),Ji=(e,n)=>e.target.closest(`.${n}`),fx=(e,n)=>n===2&&Array.isArray(e)&&e.includes(2),hx=e=>{const n=e.ctrlKey&&pu()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n},bM=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),SM=({onMove:e,onMoveStart:n,onMoveEnd:r,onPaneContextMenu:i,zoomOnScroll:o=!0,zoomOnPinch:l=!0,panOnScroll:u=!1,panOnScrollSpeed:c=.5,panOnScrollMode:h=ri.Free,zoomOnDoubleClick:p=!0,elementsSelectable:d,panOnDrag:m=!0,defaultViewport:y,translateExtent:w,minZoom:N,maxZoom:_,zoomActivationKeyCode:S,preventScrolling:b=!0,children:k,noWheelClassName:E,noPanClassName:C})=>{const A=T.useRef(),M=Ct(),L=T.useRef(!1),H=T.useRef(!1),O=T.useRef(null),P=T.useRef({x:0,y:0,zoom:0}),{d3Zoom:F,d3Selection:Y,d3ZoomHandler:q,userSelectionActive:R}=Ke(bM,Nt),Q=ja(S),z=T.useRef(0),ne=T.useRef(!1),Z=T.useRef();return xM(O),T.useEffect(()=>{if(O.current){const $=O.current.getBoundingClientRect(),X=nN().scaleExtent([N,_]).translateExtent(w),I=Pn(O.current).call(X),W=Br.translate(y.x,y.y).scale(ho(y.zoom,N,_)),G=[[0,0],[$.width,$.height]],U=X.constrain()(W,G,w);X.transform(I,U),X.wheelDelta(hx),M.setState({d3Zoom:X,d3Selection:I,d3ZoomHandler:I.on("wheel.zoom"),transform:[U.x,U.y,U.k],domNode:O.current.closest(".react-flow")})}},[]),T.useEffect(()=>{Y&&F&&(u&&!Q&&!R?Y.on("wheel.zoom",$=>{if(Ji($,E))return!1;$.preventDefault(),$.stopImmediatePropagation();const X=Y.property("__zoom").k||1;if($.ctrlKey&&l){const fe=Xn($),te=hx($),ce=X*Math.pow(2,te);F.scaleTo(Y,ce,fe,$);return}const I=$.deltaMode===1?20:1;let W=h===ri.Vertical?0:$.deltaX*I,G=h===ri.Horizontal?0:$.deltaY*I;!pu()&&$.shiftKey&&h!==ri.Vertical&&(W=$.deltaY*I,G=0),F.translateBy(Y,-(W/X)*c,-(G/X)*c,{internal:!0});const U=Yl(Y.property("__zoom")),{onViewportChangeStart:J,onViewportChange:re,onViewportChangeEnd:le}=M.getState();clearTimeout(Z.current),ne.current||(ne.current=!0,n==null||n($,U),J==null||J(U)),ne.current&&(e==null||e($,U),re==null||re(U),Z.current=setTimeout(()=>{r==null||r($,U),le==null||le(U),ne.current=!1},150))},{passive:!1}):typeof q<"u"&&Y.on("wheel.zoom",function($,X){if(!b&&$.type==="wheel"&&!$.ctrlKey||Ji($,E))return null;$.preventDefault(),q.call(this,$,X)},{passive:!1}))},[R,u,h,Y,F,q,Q,l,b,E,n,e,r]),T.useEffect(()=>{F&&F.on("start",$=>{var W,G;if(!$.sourceEvent||$.sourceEvent.internal)return null;z.current=(W=$.sourceEvent)==null?void 0:W.button;const{onViewportChangeStart:X}=M.getState(),I=Yl($.transform);L.current=!0,P.current=I,((G=$.sourceEvent)==null?void 0:G.type)==="mousedown"&&M.setState({paneDragging:!0}),X==null||X(I),n==null||n($.sourceEvent,I)})},[F,n]),T.useEffect(()=>{F&&(R&&!L.current?F.on("zoom",null):R||F.on("zoom",$=>{var I;const{onViewportChange:X}=M.getState();if(M.setState({transform:[$.transform.x,$.transform.y,$.transform.k]}),H.current=!!(i&&fx(m,z.current??0)),(e||X)&&!((I=$.sourceEvent)!=null&&I.internal)){const W=Yl($.transform);X==null||X(W),e==null||e($.sourceEvent,W)}}))},[R,F,e,m,i]),T.useEffect(()=>{F&&F.on("end",$=>{if(!$.sourceEvent||$.sourceEvent.internal)return null;const{onViewportChangeEnd:X}=M.getState();if(L.current=!1,M.setState({paneDragging:!1}),i&&fx(m,z.current??0)&&!H.current&&i($.sourceEvent),H.current=!1,(r||X)&&_M(P.current,$.transform)){const I=Yl($.transform);P.current=I,clearTimeout(A.current),A.current=setTimeout(()=>{X==null||X(I),r==null||r($.sourceEvent,I)},u?150:0)}})},[F,u,m,r,i]),T.useEffect(()=>{F&&F.filter($=>{const X=Q||o,I=l&&$.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&$.button===1&&$.type==="mousedown"&&(Ji($,"react-flow__node")||Ji($,"react-flow__edge")))return!0;if(!m&&!X&&!u&&!p&&!l||R||!p&&$.type==="dblclick"||Ji($,E)&&$.type==="wheel"||Ji($,C)&&($.type!=="wheel"||u&&$.type==="wheel"&&!Q)||!l&&$.ctrlKey&&$.type==="wheel"||!X&&!u&&!I&&$.type==="wheel"||!m&&($.type==="mousedown"||$.type==="touchstart")||Array.isArray(m)&&!m.includes($.button)&&$.type==="mousedown")return!1;const W=Array.isArray(m)&&m.includes($.button)||!$.button||$.button<=1;return(!$.ctrlKey||$.type==="wheel")&&W})},[R,F,o,l,u,p,m,d,Q]),ue.createElement("div",{className:"react-flow__renderer",ref:O,style:Hv},k)},kM=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function EM(){const{userSelectionActive:e,userSelectionRect:n}=Ke(kM,Nt);return e&&n?ue.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:n.width,height:n.height,transform:`translate(${n.x}px, ${n.y}px)`}}):null}function px(e,n){const r=n.parentNode||n.parentId,i=e.find(o=>o.id===r);if(i){const o=n.position.x+n.width-i.width,l=n.position.y+n.height-i.height;if(o>0||l>0||n.position.x<0||n.position.y<0){if(i.style={...i.style},i.style.width=i.style.width??i.width,i.style.height=i.style.height??i.height,o>0&&(i.style.width+=o),l>0&&(i.style.height+=l),n.position.x<0){const u=Math.abs(n.position.x);i.position.x=i.position.x-u,i.style.width+=u,n.position.x=0}if(n.position.y<0){const u=Math.abs(n.position.y);i.position.y=i.position.y-u,i.style.height+=u,n.position.y=0}i.width=i.style.width,i.height=i.style.height}}}function NM(e,n){if(e.some(i=>i.type==="reset"))return e.filter(i=>i.type==="reset").map(i=>i.item);const r=e.filter(i=>i.type==="add").map(i=>i.item);return n.reduce((i,o)=>{const l=e.filter(c=>c.id===o.id);if(l.length===0)return i.push(o),i;const u={...o};for(const c of l)if(c)switch(c.type){case"select":{u.selected=c.selected;break}case"position":{typeof c.position<"u"&&(u.position=c.position),typeof c.positionAbsolute<"u"&&(u.positionAbsolute=c.positionAbsolute),typeof c.dragging<"u"&&(u.dragging=c.dragging),u.expandParent&&px(i,u);break}case"dimensions":{typeof c.dimensions<"u"&&(u.width=c.dimensions.width,u.height=c.dimensions.height),typeof c.updateStyle<"u"&&(u.style={...u.style||{},...c.dimensions}),typeof c.resizing=="boolean"&&(u.resizing=c.resizing),u.expandParent&&px(i,u);break}case"remove":return i}return i.push(u),i},r)}function CM(e,n){return NM(e,n)}const xs=(e,n)=>({id:e,type:"select",selected:n});function ro(e,n){return e.reduce((r,i)=>{const o=n.includes(i.id);return!i.selected&&o?(i.selected=!0,r.push(xs(i.id,!0))):i.selected&&!o&&(i.selected=!1,r.push(xs(i.id,!1))),r},[])}const Ad=(e,n)=>r=>{r.target===n.current&&(e==null||e(r))},jM=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),MN=T.memo(({isSelecting:e,selectionMode:n=Ca.Full,panOnDrag:r,onSelectionStart:i,onSelectionEnd:o,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:c,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:d,children:m})=>{const y=T.useRef(null),w=Ct(),N=T.useRef(0),_=T.useRef(0),S=T.useRef(),{userSelectionActive:b,elementsSelectable:k,dragging:E}=Ke(jM,Nt),C=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),N.current=0,_.current=0},A=q=>{l==null||l(q),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},M=q=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){q.preventDefault();return}u==null||u(q)},L=c?q=>c(q):void 0,H=q=>{const{resetSelectedElements:R,domNode:Q}=w.getState();if(S.current=Q==null?void 0:Q.getBoundingClientRect(),!k||!e||q.button!==0||q.target!==y.current||!S.current)return;const{x:z,y:ne}=bs(q,S.current);R(),w.setState({userSelectionRect:{width:0,height:0,startX:z,startY:ne,x:z,y:ne}}),i==null||i(q)},O=q=>{const{userSelectionRect:R,nodeInternals:Q,edges:z,transform:ne,onNodesChange:Z,onEdgesChange:$,nodeOrigin:X,getNodes:I}=w.getState();if(!e||!S.current||!R)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const W=bs(q,S.current),G=R.startX??0,U=R.startY??0,J={...R,x:W.x<G?W.x:G,y:W.y<U?W.y:U,width:Math.abs(W.x-G),height:Math.abs(W.y-U)},re=I(),le=mN(Q,J,ne,n===Ca.Partial,!0,X),fe=gN(le,z).map(ce=>ce.id),te=le.map(ce=>ce.id);if(N.current!==te.length){N.current=te.length;const ce=ro(re,te);ce.length&&(Z==null||Z(ce))}if(_.current!==fe.length){_.current=fe.length;const ce=ro(z,fe);ce.length&&($==null||$(ce))}w.setState({userSelectionRect:J})},P=q=>{if(q.button!==0)return;const{userSelectionRect:R}=w.getState();!b&&R&&q.target===y.current&&(A==null||A(q)),w.setState({nodesSelectionActive:N.current>0}),C(),o==null||o(q)},F=q=>{b&&(w.setState({nodesSelectionActive:N.current>0}),o==null||o(q)),C()},Y=k&&(e||b);return ue.createElement("div",{className:Bt(["react-flow__pane",{dragging:E,selection:e}]),onClick:Y?void 0:Ad(A,y),onContextMenu:Ad(M,y),onWheel:Ad(L,y),onMouseEnter:Y?void 0:h,onMouseDown:Y?H:void 0,onMouseMove:Y?O:p,onMouseUp:Y?P:void 0,onMouseLeave:Y?F:d,ref:y,style:Hv},m,ue.createElement(EM,null))});MN.displayName="Pane";function PN(e,n){const r=e.parentNode||e.parentId;if(!r)return!1;const i=n.get(r);return i?i.selected?!0:PN(i,n):!1}function mx(e,n,r){let i=e;do{if(i!=null&&i.matches(n))return!0;if(i===r.current)return!1;i=i.parentElement}while(i);return!1}function RM(e,n,r,i){return Array.from(e.values()).filter(o=>(o.selected||o.id===i)&&(!o.parentNode||o.parentId||!PN(o,e))&&(o.draggable||n&&typeof o.draggable>"u")).map(o=>{var l,u;return{id:o.id,position:o.position||{x:0,y:0},positionAbsolute:o.positionAbsolute||{x:0,y:0},distance:{x:r.x-(((l=o.positionAbsolute)==null?void 0:l.x)??0),y:r.y-(((u=o.positionAbsolute)==null?void 0:u.y)??0)},delta:{x:0,y:0},extent:o.extent,parentNode:o.parentNode||o.parentId,parentId:o.parentNode||o.parentId,width:o.width,height:o.height,expandParent:o.expandParent}})}function TM(e,n){return!n||n==="parent"?n:[n[0],[n[1][0]-(e.width||0),n[1][1]-(e.height||0)]]}function ON(e,n,r,i,o=[0,0],l){const u=TM(e,e.extent||i);let c=u;const h=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(h&&e.width&&e.height){const m=r.get(h),{x:y,y:w}=ii(m,o).positionAbsolute;c=m&&On(y)&&On(w)&&On(m.width)&&On(m.height)?[[y+e.width*o[0],w+e.height*o[1]],[y+m.width-e.width+e.width*o[0],w+m.height-e.height+e.height*o[1]]]:c}else l==null||l("005",Hr.error005()),c=u;else if(e.extent&&h&&e.extent!=="parent"){const m=r.get(h),{x:y,y:w}=ii(m,o).positionAbsolute;c=[[e.extent[0][0]+y,e.extent[0][1]+w],[e.extent[1][0]+y,e.extent[1][1]+w]]}let p={x:0,y:0};if(h){const m=r.get(h);p=ii(m,o).positionAbsolute}const d=c&&c!=="parent"?qv(n,c):n;return{position:{x:d.x-p.x,y:d.y-p.y},positionAbsolute:d}}function Id({nodeId:e,dragItems:n,nodeInternals:r}){const i=n.map(o=>({...r.get(o.id),position:o.position,positionAbsolute:o.positionAbsolute}));return[e?i.find(o=>o.id===e):i[0],i]}const gx=(e,n,r,i)=>{const o=n.querySelectorAll(e);if(!o||!o.length)return null;const l=Array.from(o),u=n.getBoundingClientRect(),c={x:u.width*i[0],y:u.height*i[1]};return l.map(h=>{const p=h.getBoundingClientRect();return{id:h.getAttribute("data-handleid"),position:h.getAttribute("data-handlepos"),x:(p.left-u.left-c.x)/r,y:(p.top-u.top-c.y)/r,...Lv(h)}})};function fa(e,n,r){return r===void 0?r:i=>{const o=n().nodeInternals.get(e);o&&r(i,{...o})}}function gv({id:e,store:n,unselect:r=!1,nodeRef:i}){const{addSelectedNodes:o,unselectNodesAndEdges:l,multiSelectionActive:u,nodeInternals:c,onError:h}=n.getState(),p=c.get(e);if(!p){h==null||h("012",Hr.error012(e));return}n.setState({nodesSelectionActive:!1}),p.selected?(r||p.selected&&u)&&(l({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var d;return(d=i==null?void 0:i.current)==null?void 0:d.blur()})):o([e])}function AM(){const e=Ct();return T.useCallback(({sourceEvent:r})=>{const{transform:i,snapGrid:o,snapToGrid:l}=e.getState(),u=r.touches?r.touches[0].clientX:r.clientX,c=r.touches?r.touches[0].clientY:r.clientY,h={x:(u-i[0])/i[2],y:(c-i[1])/i[2]};return{xSnapped:l?o[0]*Math.round(h.x/o[0]):h.x,ySnapped:l?o[1]*Math.round(h.y/o[1]):h.y,...h}},[])}function Md(e){return(n,r,i)=>e==null?void 0:e(n,i)}function LN({nodeRef:e,disabled:n=!1,noDragClassName:r,handleSelector:i,nodeId:o,isSelectable:l,selectNodesOnDrag:u}){const c=Ct(),[h,p]=T.useState(!1),d=T.useRef([]),m=T.useRef({x:null,y:null}),y=T.useRef(0),w=T.useRef(null),N=T.useRef({x:0,y:0}),_=T.useRef(null),S=T.useRef(!1),b=T.useRef(!1),k=T.useRef(!1),E=AM();return T.useEffect(()=>{if(e!=null&&e.current){const C=Pn(e.current),A=({x:H,y:O})=>{const{nodeInternals:P,onNodeDrag:F,onSelectionDrag:Y,updateNodePositions:q,nodeExtent:R,snapGrid:Q,snapToGrid:z,nodeOrigin:ne,onError:Z}=c.getState();m.current={x:H,y:O};let $=!1,X={x:0,y:0,x2:0,y2:0};if(d.current.length>1&&R){const W=Cu(d.current,ne);X=Na(W)}if(d.current=d.current.map(W=>{const G={x:H-W.distance.x,y:O-W.distance.y};z&&(G.x=Q[0]*Math.round(G.x/Q[0]),G.y=Q[1]*Math.round(G.y/Q[1]));const U=[[R[0][0],R[0][1]],[R[1][0],R[1][1]]];d.current.length>1&&R&&!W.extent&&(U[0][0]=W.positionAbsolute.x-X.x+R[0][0],U[1][0]=W.positionAbsolute.x+(W.width??0)-X.x2+R[1][0],U[0][1]=W.positionAbsolute.y-X.y+R[0][1],U[1][1]=W.positionAbsolute.y+(W.height??0)-X.y2+R[1][1]);const J=ON(W,G,P,U,ne,Z);return $=$||W.position.x!==J.position.x||W.position.y!==J.position.y,W.position=J.position,W.positionAbsolute=J.positionAbsolute,W}),!$)return;q(d.current,!0,!0),p(!0);const I=o?F:Md(Y);if(I&&_.current){const[W,G]=Id({nodeId:o,dragItems:d.current,nodeInternals:P});I(_.current,W,G)}},M=()=>{if(!w.current)return;const[H,O]=sN(N.current,w.current);if(H!==0||O!==0){const{transform:P,panBy:F}=c.getState();m.current.x=(m.current.x??0)-H/P[2],m.current.y=(m.current.y??0)-O/P[2],F({x:H,y:O})&&A(m.current)}y.current=requestAnimationFrame(M)},L=H=>{var ne;const{nodeInternals:O,multiSelectionActive:P,nodesDraggable:F,unselectNodesAndEdges:Y,onNodeDragStart:q,onSelectionDragStart:R}=c.getState();b.current=!0;const Q=o?q:Md(R);(!u||!l)&&!P&&o&&((ne=O.get(o))!=null&&ne.selected||Y()),o&&l&&u&&gv({id:o,store:c,nodeRef:e});const z=E(H);if(m.current=z,d.current=RM(O,F,z,o),Q&&d.current){const[Z,$]=Id({nodeId:o,dragItems:d.current,nodeInternals:O});Q(H.sourceEvent,Z,$)}};if(n)C.on(".drag",null);else{const H=F2().on("start",O=>{const{domNode:P,nodeDragThreshold:F}=c.getState();F===0&&L(O),k.current=!1;const Y=E(O);m.current=Y,w.current=(P==null?void 0:P.getBoundingClientRect())||null,N.current=bs(O.sourceEvent,w.current)}).on("drag",O=>{var q,R;const P=E(O),{autoPanOnNodeDrag:F,nodeDragThreshold:Y}=c.getState();if(O.sourceEvent.type==="touchmove"&&O.sourceEvent.touches.length>1&&(k.current=!0),!k.current){if(!S.current&&b.current&&F&&(S.current=!0,M()),!b.current){const Q=P.xSnapped-(((q=m==null?void 0:m.current)==null?void 0:q.x)??0),z=P.ySnapped-(((R=m==null?void 0:m.current)==null?void 0:R.y)??0);Math.sqrt(Q*Q+z*z)>Y&&L(O)}(m.current.x!==P.xSnapped||m.current.y!==P.ySnapped)&&d.current&&b.current&&(_.current=O.sourceEvent,N.current=bs(O.sourceEvent,w.current),A(P))}}).on("end",O=>{if(!(!b.current||k.current)&&(p(!1),S.current=!1,b.current=!1,cancelAnimationFrame(y.current),d.current)){const{updateNodePositions:P,nodeInternals:F,onNodeDragStop:Y,onSelectionDragStop:q}=c.getState(),R=o?Y:Md(q);if(P(d.current,!1,!1),R){const[Q,z]=Id({nodeId:o,dragItems:d.current,nodeInternals:F});R(O.sourceEvent,Q,z)}}}).filter(O=>{const P=O.target;return!O.button&&(!r||!mx(P,`.${r}`,e))&&(!i||mx(P,i,e))});return C.call(H),()=>{C.on(".drag",null)}}}},[e,n,r,i,l,c,o,u,E]),h}function qN(){const e=Ct();return T.useCallback(r=>{const{nodeInternals:i,nodeExtent:o,updateNodePositions:l,getNodes:u,snapToGrid:c,snapGrid:h,onError:p,nodesDraggable:d}=e.getState(),m=u().filter(k=>k.selected&&(k.draggable||d&&typeof k.draggable>"u")),y=c?h[0]:5,w=c?h[1]:5,N=r.isShiftPressed?4:1,_=r.x*y*N,S=r.y*w*N,b=m.map(k=>{if(k.positionAbsolute){const E={x:k.positionAbsolute.x+_,y:k.positionAbsolute.y+S};c&&(E.x=h[0]*Math.round(E.x/h[0]),E.y=h[1]*Math.round(E.y/h[1]));const{positionAbsolute:C,position:A}=ON(k,E,i,o,void 0,p);k.position=A,k.positionAbsolute=C}return k});l(b,!0,!1)},[])}const lo={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var ha=e=>{const n=({id:r,type:i,data:o,xPos:l,yPos:u,xPosOrigin:c,yPosOrigin:h,selected:p,onClick:d,onMouseEnter:m,onMouseMove:y,onMouseLeave:w,onContextMenu:N,onDoubleClick:_,style:S,className:b,isDraggable:k,isSelectable:E,isConnectable:C,isFocusable:A,selectNodesOnDrag:M,sourcePosition:L,targetPosition:H,hidden:O,resizeObserver:P,dragHandle:F,zIndex:Y,isParent:q,noDragClassName:R,noPanClassName:Q,initialized:z,disableKeyboardA11y:ne,ariaLabel:Z,rfId:$,hasHandleBounds:X})=>{const I=Ct(),W=T.useRef(null),G=T.useRef(null),U=T.useRef(L),J=T.useRef(H),re=T.useRef(i),le=E||k||d||m||y||w,fe=qN(),te=fa(r,I.getState,m),ce=fa(r,I.getState,y),Ce=fa(r,I.getState,w),ve=fa(r,I.getState,N),Te=fa(r,I.getState,_),ye=we=>{const{nodeDragThreshold:_e}=I.getState();if(E&&(!M||!k||_e>0)&&gv({id:r,store:I,nodeRef:W}),d){const ze=I.getState().nodeInternals.get(r);ze&&d(we,{...ze})}},ke=we=>{if(!dv(we)&&!ne)if(lN.includes(we.key)&&E){const _e=we.key==="Escape";gv({id:r,store:I,unselect:_e,nodeRef:W})}else k&&p&&Object.prototype.hasOwnProperty.call(lo,we.key)&&(I.setState({ariaLiveMessage:`Moved selected node ${we.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~l}, y: ${~~u}`}),fe({x:lo[we.key].x,y:lo[we.key].y,isShiftPressed:we.shiftKey}))};T.useEffect(()=>()=>{G.current&&(P==null||P.unobserve(G.current),G.current=null)},[]),T.useEffect(()=>{if(W.current&&!O){const we=W.current;(!z||!X||G.current!==we)&&(G.current&&(P==null||P.unobserve(G.current)),P==null||P.observe(we),G.current=we)}},[O,z,X]),T.useEffect(()=>{const we=re.current!==i,_e=U.current!==L,ze=J.current!==H;W.current&&(we||_e||ze)&&(we&&(re.current=i),_e&&(U.current=L),ze&&(J.current=H),I.getState().updateNodeDimensions([{id:r,nodeElement:W.current,forceUpdate:!0}]))},[r,i,L,H]);const Ge=LN({nodeRef:W,disabled:O||!k,noDragClassName:R,handleSelector:F,nodeId:r,isSelectable:E,selectNodesOnDrag:M});return O?null:ue.createElement("div",{className:Bt(["react-flow__node",`react-flow__node-${i}`,{[Q]:k},b,{selected:p,selectable:E,parent:q,dragging:Ge}]),ref:W,style:{zIndex:Y,transform:`translate(${c}px,${h}px)`,pointerEvents:le?"all":"none",visibility:z?"visible":"hidden",...S},"data-id":r,"data-testid":`rf__node-${r}`,onMouseEnter:te,onMouseMove:ce,onMouseLeave:Ce,onContextMenu:ve,onClick:ye,onDoubleClick:Te,onKeyDown:A?ke:void 0,tabIndex:A?0:void 0,role:A?"button":void 0,"aria-describedby":ne?void 0:`${jN}-${$}`,"aria-label":Z},ue.createElement(HI,{value:r},ue.createElement(e,{id:r,data:o,type:i,xPos:l,yPos:u,selected:p,isConnectable:C,sourcePosition:L,targetPosition:H,dragging:Ge,dragHandle:F,zIndex:Y})))};return n.displayName="NodeWrapper",T.memo(n)};const IM=e=>{const n=e.getNodes().filter(r=>r.selected);return{...Cu(n,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function MM({onSelectionContextMenu:e,noPanClassName:n,disableKeyboardA11y:r}){const i=Ct(),{width:o,height:l,x:u,y:c,transformString:h,userSelectionActive:p}=Ke(IM,Nt),d=qN(),m=T.useRef(null);if(T.useEffect(()=>{var N;r||(N=m.current)==null||N.focus({preventScroll:!0})},[r]),LN({nodeRef:m}),p||!o||!l)return null;const y=e?N=>{const _=i.getState().getNodes().filter(S=>S.selected);e(N,_)}:void 0,w=N=>{Object.prototype.hasOwnProperty.call(lo,N.key)&&d({x:lo[N.key].x,y:lo[N.key].y,isShiftPressed:N.shiftKey})};return ue.createElement("div",{className:Bt(["react-flow__nodesselection","react-flow__container",n]),style:{transform:h}},ue.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:r?void 0:-1,onKeyDown:r?void 0:w,style:{width:o,height:l,top:c,left:u}}))}var PM=T.memo(MM);const OM=e=>e.nodesSelectionActive,$N=({children:e,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:o,onPaneContextMenu:l,onPaneScroll:u,deleteKeyCode:c,onMove:h,onMoveStart:p,onMoveEnd:d,selectionKeyCode:m,selectionOnDrag:y,selectionMode:w,onSelectionStart:N,onSelectionEnd:_,multiSelectionKeyCode:S,panActivationKeyCode:b,zoomActivationKeyCode:k,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:A,panOnScroll:M,panOnScrollSpeed:L,panOnScrollMode:H,zoomOnDoubleClick:O,panOnDrag:P,defaultViewport:F,translateExtent:Y,minZoom:q,maxZoom:R,preventScrolling:Q,onSelectionContextMenu:z,noWheelClassName:ne,noPanClassName:Z,disableKeyboardA11y:$})=>{const X=Ke(OM),I=ja(m),W=ja(b),G=W||P,U=W||M,J=I||y&&G!==!0;return wM({deleteKeyCode:c,multiSelectionKeyCode:S}),ue.createElement(SM,{onMove:h,onMoveStart:p,onMoveEnd:d,onPaneContextMenu:l,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:A,panOnScroll:U,panOnScrollSpeed:L,panOnScrollMode:H,zoomOnDoubleClick:O,panOnDrag:!I&&G,defaultViewport:F,translateExtent:Y,minZoom:q,maxZoom:R,zoomActivationKeyCode:k,preventScrolling:Q,noWheelClassName:ne,noPanClassName:Z},ue.createElement(MN,{onSelectionStart:N,onSelectionEnd:_,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:o,onPaneContextMenu:l,onPaneScroll:u,panOnDrag:G,isSelecting:!!J,selectionMode:w},e,X&&ue.createElement(PM,{onSelectionContextMenu:z,noPanClassName:Z,disableKeyboardA11y:$})))};$N.displayName="FlowRenderer";var LM=T.memo($N);function qM(e){return Ke(T.useCallback(r=>e?mN(r.nodeInternals,{x:0,y:0,width:r.width,height:r.height},r.transform,!0):r.getNodes(),[e]))}function $M(e){const n={input:ha(e.input||kN),default:ha(e.default||mv),output:ha(e.output||NN),group:ha(e.group||Uv)},r={},i=Object.keys(e).filter(o=>!["input","default","output","group"].includes(o)).reduce((o,l)=>(o[l]=ha(e[l]||mv),o),r);return{...n,...i}}const DM=({x:e,y:n,width:r,height:i,origin:o})=>!r||!i?{x:e,y:n}:o[0]<0||o[1]<0||o[0]>1||o[1]>1?{x:e,y:n}:{x:e-r*o[0],y:n-i*o[1]},FM=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),DN=e=>{const{nodesDraggable:n,nodesConnectable:r,nodesFocusable:i,elementsSelectable:o,updateNodeDimensions:l,onError:u}=Ke(FM,Nt),c=qM(e.onlyRenderVisibleElements),h=T.useRef(),p=T.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const d=new ResizeObserver(m=>{const y=m.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));l(y)});return h.current=d,d},[]);return T.useEffect(()=>()=>{var d;(d=h==null?void 0:h.current)==null||d.disconnect()},[]),ue.createElement("div",{className:"react-flow__nodes",style:Hv},c.map(d=>{var A,M,L;let m=d.type||"default";e.nodeTypes[m]||(u==null||u("003",Hr.error003(m)),m="default");const y=e.nodeTypes[m]||e.nodeTypes.default,w=!!(d.draggable||n&&typeof d.draggable>"u"),N=!!(d.selectable||o&&typeof d.selectable>"u"),_=!!(d.connectable||r&&typeof d.connectable>"u"),S=!!(d.focusable||i&&typeof d.focusable>"u"),b=e.nodeExtent?qv(d.positionAbsolute,e.nodeExtent):d.positionAbsolute,k=(b==null?void 0:b.x)??0,E=(b==null?void 0:b.y)??0,C=DM({x:k,y:E,width:d.width??0,height:d.height??0,origin:e.nodeOrigin});return ue.createElement(y,{key:d.id,id:d.id,className:d.className,style:d.style,type:m,data:d.data,sourcePosition:d.sourcePosition||Ae.Bottom,targetPosition:d.targetPosition||Ae.Top,hidden:d.hidden,xPos:k,yPos:E,xPosOrigin:C.x,yPosOrigin:C.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!d.selected,isDraggable:w,isSelectable:N,isConnectable:_,isFocusable:S,resizeObserver:p,dragHandle:d.dragHandle,zIndex:((A=d[dt])==null?void 0:A.z)??0,isParent:!!((M=d[dt])!=null&&M.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!d.width&&!!d.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:d.ariaLabel,hasHandleBounds:!!((L=d[dt])!=null&&L.handleBounds)})}))};DN.displayName="NodeRenderer";var zM=T.memo(DN);const BM=(e,n,r)=>r===Ae.Left?e-n:r===Ae.Right?e+n:e,UM=(e,n,r)=>r===Ae.Top?e-n:r===Ae.Bottom?e+n:e,vx="react-flow__edgeupdater",yx=({position:e,centerX:n,centerY:r,radius:i=10,onMouseDown:o,onMouseEnter:l,onMouseOut:u,type:c})=>ue.createElement("circle",{onMouseDown:o,onMouseEnter:l,onMouseOut:u,className:Bt([vx,`${vx}-${c}`]),cx:BM(n,i,e),cy:UM(r,i,e),r:i,stroke:"transparent",fill:"transparent"}),HM=()=>!0;var eo=e=>{const n=({id:r,className:i,type:o,data:l,onClick:u,onEdgeDoubleClick:c,selected:h,animated:p,label:d,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:_,style:S,source:b,target:k,sourceX:E,sourceY:C,targetX:A,targetY:M,sourcePosition:L,targetPosition:H,elementsSelectable:O,hidden:P,sourceHandleId:F,targetHandleId:Y,onContextMenu:q,onMouseEnter:R,onMouseMove:Q,onMouseLeave:z,reconnectRadius:ne,onReconnect:Z,onReconnectStart:$,onReconnectEnd:X,markerEnd:I,markerStart:W,rfId:G,ariaLabel:U,isFocusable:J,isReconnectable:re,pathOptions:le,interactionWidth:fe,disableKeyboardA11y:te})=>{const ce=T.useRef(null),[Ce,ve]=T.useState(!1),[Te,ye]=T.useState(!1),ke=Ct(),Ge=T.useMemo(()=>`url('#${hv(W,G)}')`,[W,G]),we=T.useMemo(()=>`url('#${hv(I,G)}')`,[I,G]);if(P)return null;const _e=Xe=>{var Pt;const{edges:wt,addSelectedEdges:pt,unselectNodesAndEdges:mt,multiSelectionActive:_n}=ke.getState(),Xt=wt.find(Qt=>Qt.id===r);Xt&&(O&&(ke.setState({nodesSelectionActive:!1}),Xt.selected&&_n?(mt({nodes:[],edges:[Xt]}),(Pt=ce.current)==null||Pt.blur()):pt([r])),u&&u(Xe,Xt))},ze=da(r,ke.getState,c),ft=da(r,ke.getState,q),ht=da(r,ke.getState,R),Ue=da(r,ke.getState,Q),De=da(r,ke.getState,z),Ze=(Xe,wt)=>{if(Xe.button!==0)return;const{edges:pt,isValidConnection:mt}=ke.getState(),_n=wt?k:b,Xt=(wt?Y:F)||null,Pt=wt?"target":"source",Qt=mt||HM,yr=wt,bn=pt.find(Sn=>Sn.id===r);ye(!0),$==null||$(Xe,bn,Pt);const Zt=Sn=>{ye(!1),X==null||X(Sn,bn,Pt)};xN({event:Xe,handleId:Xt,nodeId:_n,onConnect:Sn=>Z==null?void 0:Z(bn,Sn),isTarget:yr,getState:ke.getState,setState:ke.setState,isValidConnection:Qt,edgeUpdaterType:Pt,onReconnectEnd:Zt})},Ye=Xe=>Ze(Xe,!0),vt=Xe=>Ze(Xe,!1),ot=()=>ve(!0),yt=()=>ve(!1),Kt=!O&&!u,Mt=Xe=>{var wt;if(!te&&lN.includes(Xe.key)&&O){const{unselectNodesAndEdges:pt,addSelectedEdges:mt,edges:_n}=ke.getState();Xe.key==="Escape"?((wt=ce.current)==null||wt.blur(),pt({edges:[_n.find(Pt=>Pt.id===r)]})):mt([r])}};return ue.createElement("g",{className:Bt(["react-flow__edge",`react-flow__edge-${o}`,i,{selected:h,animated:p,inactive:Kt,updating:Ce}]),onClick:_e,onDoubleClick:ze,onContextMenu:ft,onMouseEnter:ht,onMouseMove:Ue,onMouseLeave:De,onKeyDown:J?Mt:void 0,tabIndex:J?0:void 0,role:J?"button":"img","data-testid":`rf__edge-${r}`,"aria-label":U===null?void 0:U||`Edge from ${b} to ${k}`,"aria-describedby":J?`${RN}-${G}`:void 0,ref:ce},!Te&&ue.createElement(e,{id:r,source:b,target:k,selected:h,animated:p,label:d,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:_,data:l,style:S,sourceX:E,sourceY:C,targetX:A,targetY:M,sourcePosition:L,targetPosition:H,sourceHandleId:F,targetHandleId:Y,markerStart:Ge,markerEnd:we,pathOptions:le,interactionWidth:fe}),re&&ue.createElement(ue.Fragment,null,(re==="source"||re===!0)&&ue.createElement(yx,{position:L,centerX:E,centerY:C,radius:ne,onMouseDown:Ye,onMouseEnter:ot,onMouseOut:yt,type:"source"}),(re==="target"||re===!0)&&ue.createElement(yx,{position:H,centerX:A,centerY:M,radius:ne,onMouseDown:vt,onMouseEnter:ot,onMouseOut:yt,type:"target"})))};return n.displayName="EdgeWrapper",T.memo(n)};function WM(e){const n={default:eo(e.default||gu),straight:eo(e.bezier||Fv),step:eo(e.step||Dv),smoothstep:eo(e.step||Nu),simplebezier:eo(e.simplebezier||$v)},r={},i=Object.keys(e).filter(o=>!["default","bezier"].includes(o)).reduce((o,l)=>(o[l]=eo(e[l]||gu),o),r);return{...n,...i}}function wx(e,n,r=null){const i=((r==null?void 0:r.x)||0)+n.x,o=((r==null?void 0:r.y)||0)+n.y,l=(r==null?void 0:r.width)||n.width,u=(r==null?void 0:r.height)||n.height;switch(e){case Ae.Top:return{x:i+l/2,y:o};case Ae.Right:return{x:i+l,y:o+u/2};case Ae.Bottom:return{x:i+l/2,y:o+u};case Ae.Left:return{x:i,y:o+u/2}}}function xx(e,n){return e?e.length===1||!n?e[0]:n&&e.find(r=>r.id===n)||null:null}const VM=(e,n,r,i,o,l)=>{const u=wx(r,e,n),c=wx(l,i,o);return{sourceX:u.x,sourceY:u.y,targetX:c.x,targetY:c.y}};function GM({sourcePos:e,targetPos:n,sourceWidth:r,sourceHeight:i,targetWidth:o,targetHeight:l,width:u,height:c,transform:h}){const p={x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x+r,n.x+o),y2:Math.max(e.y+i,n.y+l)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const d=Na({x:(0-h[0])/h[2],y:(0-h[1])/h[2],width:u/h[2],height:c/h[2]}),m=Math.max(0,Math.min(d.x2,p.x2)-Math.max(d.x,p.x)),y=Math.max(0,Math.min(d.y2,p.y2)-Math.max(d.y,p.y));return Math.ceil(m*y)>0}function _x(e){var i,o,l,u,c;const n=((i=e==null?void 0:e[dt])==null?void 0:i.handleBounds)||null,r=n&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((o=e==null?void 0:e.positionAbsolute)==null?void 0:o.x)<"u"&&typeof((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.y)<"u";return[{x:((u=e==null?void 0:e.positionAbsolute)==null?void 0:u.x)||0,y:((c=e==null?void 0:e.positionAbsolute)==null?void 0:c.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},n,!!r]}const YM=[{level:0,isMaxLevel:!0,edges:[]}];function KM(e,n,r=!1){let i=-1;const o=e.reduce((u,c)=>{var d,m;const h=On(c.zIndex);let p=h?c.zIndex:0;if(r){const y=n.get(c.target),w=n.get(c.source),N=c.selected||(y==null?void 0:y.selected)||(w==null?void 0:w.selected),_=Math.max(((d=w==null?void 0:w[dt])==null?void 0:d.z)||0,((m=y==null?void 0:y[dt])==null?void 0:m.z)||0,1e3);p=(h?c.zIndex:0)+(N?_:0)}return u[p]?u[p].push(c):u[p]=[c],i=p>i?p:i,u},{}),l=Object.entries(o).map(([u,c])=>{const h=+u;return{edges:c,level:h,isMaxLevel:h===i}});return l.length===0?YM:l}function XM(e,n,r){const i=Ke(T.useCallback(o=>e?o.edges.filter(l=>{const u=n.get(l.source),c=n.get(l.target);return(u==null?void 0:u.width)&&(u==null?void 0:u.height)&&(c==null?void 0:c.width)&&(c==null?void 0:c.height)&&GM({sourcePos:u.positionAbsolute||{x:0,y:0},targetPos:c.positionAbsolute||{x:0,y:0},sourceWidth:u.width,sourceHeight:u.height,targetWidth:c.width,targetHeight:c.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[e,n]));return KM(i,n,r)}const QM=({color:e="none",strokeWidth:n=1})=>ue.createElement("polyline",{style:{stroke:e,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),ZM=({color:e="none",strokeWidth:n=1})=>ue.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),bx={[mu.Arrow]:QM,[mu.ArrowClosed]:ZM};function JM(e){const n=Ct();return T.useMemo(()=>{var o,l;return Object.prototype.hasOwnProperty.call(bx,e)?bx[e]:((l=(o=n.getState()).onError)==null||l.call(o,"009",Hr.error009(e)),null)},[e])}const eP=({id:e,type:n,color:r,width:i=12.5,height:o=12.5,markerUnits:l="strokeWidth",strokeWidth:u,orient:c="auto-start-reverse"})=>{const h=JM(n);return h?ue.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${i}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:c,refX:"0",refY:"0"},ue.createElement(h,{color:r,strokeWidth:u})):null},tP=({defaultColor:e,rfId:n})=>r=>{const i=[];return r.edges.reduce((o,l)=>([l.markerStart,l.markerEnd].forEach(u=>{if(u&&typeof u=="object"){const c=hv(u,n);i.includes(c)||(o.push({id:c,color:u.color||e,...u}),i.push(c))}}),o),[]).sort((o,l)=>o.id.localeCompare(l.id))},FN=({defaultColor:e,rfId:n})=>{const r=Ke(T.useCallback(tP({defaultColor:e,rfId:n}),[e,n]),(i,o)=>!(i.length!==o.length||i.some((l,u)=>l.id!==o[u].id)));return ue.createElement("defs",null,r.map(i=>ue.createElement(eP,{id:i.id,key:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient})))};FN.displayName="MarkerDefinitions";var nP=T.memo(FN);const rP=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),zN=({defaultMarkerColor:e,onlyRenderVisibleElements:n,elevateEdgesOnSelect:r,rfId:i,edgeTypes:o,noPanClassName:l,onEdgeContextMenu:u,onEdgeMouseEnter:c,onEdgeMouseMove:h,onEdgeMouseLeave:p,onEdgeClick:d,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:_,children:S,disableKeyboardA11y:b})=>{const{edgesFocusable:k,edgesUpdatable:E,elementsSelectable:C,width:A,height:M,connectionMode:L,nodeInternals:H,onError:O}=Ke(rP,Nt),P=XM(n,H,r);return A?ue.createElement(ue.Fragment,null,P.map(({level:F,edges:Y,isMaxLevel:q})=>ue.createElement("svg",{key:F,style:{zIndex:F},width:A,height:M,className:"react-flow__edges react-flow__container"},q&&ue.createElement(nP,{defaultColor:e,rfId:i}),ue.createElement("g",null,Y.map(R=>{const[Q,z,ne]=_x(H.get(R.source)),[Z,$,X]=_x(H.get(R.target));if(!ne||!X)return null;let I=R.type||"default";o[I]||(O==null||O("011",Hr.error011(I)),I="default");const W=o[I]||o.default,G=L===ai.Strict?$.target:($.target??[]).concat($.source??[]),U=xx(z.source,R.sourceHandle),J=xx(G,R.targetHandle),re=(U==null?void 0:U.position)||Ae.Bottom,le=(J==null?void 0:J.position)||Ae.Top,fe=!!(R.focusable||k&&typeof R.focusable>"u"),te=R.reconnectable||R.updatable,ce=typeof y<"u"&&(te||E&&typeof te>"u");if(!U||!J)return O==null||O("008",Hr.error008(U,R)),null;const{sourceX:Ce,sourceY:ve,targetX:Te,targetY:ye}=VM(Q,U,re,Z,J,le);return ue.createElement(W,{key:R.id,id:R.id,className:Bt([R.className,l]),type:I,data:R.data,selected:!!R.selected,animated:!!R.animated,hidden:!!R.hidden,label:R.label,labelStyle:R.labelStyle,labelShowBg:R.labelShowBg,labelBgStyle:R.labelBgStyle,labelBgPadding:R.labelBgPadding,labelBgBorderRadius:R.labelBgBorderRadius,style:R.style,source:R.source,target:R.target,sourceHandleId:R.sourceHandle,targetHandleId:R.targetHandle,markerEnd:R.markerEnd,markerStart:R.markerStart,sourceX:Ce,sourceY:ve,targetX:Te,targetY:ye,sourcePosition:re,targetPosition:le,elementsSelectable:C,onContextMenu:u,onMouseEnter:c,onMouseMove:h,onMouseLeave:p,onClick:d,onEdgeDoubleClick:m,onReconnect:y,onReconnectStart:w,onReconnectEnd:N,reconnectRadius:_,rfId:i,ariaLabel:R.ariaLabel,isFocusable:fe,isReconnectable:ce,pathOptions:"pathOptions"in R?R.pathOptions:void 0,interactionWidth:R.interactionWidth,disableKeyboardA11y:b})})))),S):null};zN.displayName="EdgeRenderer";var sP=T.memo(zN);const iP=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function oP({children:e}){const n=Ke(iP);return ue.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:n}},e)}function aP(e){const n=Oa(),r=T.useRef(!1);T.useEffect(()=>{!r.current&&n.viewportInitialized&&e&&(setTimeout(()=>e(n),1),r.current=!0)},[e,n.viewportInitialized])}const lP={[Ae.Left]:Ae.Right,[Ae.Right]:Ae.Left,[Ae.Top]:Ae.Bottom,[Ae.Bottom]:Ae.Top},BN=({nodeId:e,handleType:n,style:r,type:i=_s.Bezier,CustomComponent:o,connectionStatus:l})=>{var M,L,H;const{fromNode:u,handleId:c,toX:h,toY:p,connectionMode:d}=Ke(T.useCallback(O=>({fromNode:O.nodeInternals.get(e),handleId:O.connectionHandleId,toX:(O.connectionPosition.x-O.transform[0])/O.transform[2],toY:(O.connectionPosition.y-O.transform[1])/O.transform[2],connectionMode:O.connectionMode}),[e]),Nt),m=(M=u==null?void 0:u[dt])==null?void 0:M.handleBounds;let y=m==null?void 0:m[n];if(d===ai.Loose&&(y=y||(m==null?void 0:m[n==="source"?"target":"source"])),!u||!y)return null;const w=c?y.find(O=>O.id===c):y[0],N=w?w.x+w.width/2:(u.width??0)/2,_=w?w.y+w.height/2:u.height??0,S=(((L=u.positionAbsolute)==null?void 0:L.x)??0)+N,b=(((H=u.positionAbsolute)==null?void 0:H.y)??0)+_,k=w==null?void 0:w.position,E=k?lP[k]:null;if(!k||!E)return null;if(o)return ue.createElement(o,{connectionLineType:i,connectionLineStyle:r,fromNode:u,fromHandle:w,fromX:S,fromY:b,toX:h,toY:p,fromPosition:k,toPosition:E,connectionStatus:l});let C="";const A={sourceX:S,sourceY:b,sourcePosition:k,targetX:h,targetY:p,targetPosition:E};return i===_s.Bezier?[C]=hN(A):i===_s.Step?[C]=fv({...A,borderRadius:0}):i===_s.SmoothStep?[C]=fv(A):i===_s.SimpleBezier?[C]=fN(A):C=`M${S},${b} ${h},${p}`,ue.createElement("path",{d:C,fill:"none",className:"react-flow__connection-path",style:r})};BN.displayName="ConnectionLine";const uP=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function cP({containerStyle:e,style:n,type:r,component:i}){const{nodeId:o,handleType:l,nodesConnectable:u,width:c,height:h,connectionStatus:p}=Ke(uP,Nt);return!(o&&l&&c&&u)?null:ue.createElement("svg",{style:e,width:c,height:h,className:"react-flow__edges react-flow__connectionline react-flow__container"},ue.createElement("g",{className:Bt(["react-flow__connection",p])},ue.createElement(BN,{nodeId:o,handleType:l,style:n,type:r,CustomComponent:i,connectionStatus:p})))}function Sx(e,n){return T.useRef(null),Ct(),T.useMemo(()=>n(e),[e])}const UN=({nodeTypes:e,edgeTypes:n,onMove:r,onMoveStart:i,onMoveEnd:o,onInit:l,onNodeClick:u,onEdgeClick:c,onNodeDoubleClick:h,onEdgeDoubleClick:p,onNodeMouseEnter:d,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,onSelectionContextMenu:N,onSelectionStart:_,onSelectionEnd:S,connectionLineType:b,connectionLineStyle:k,connectionLineComponent:E,connectionLineContainerStyle:C,selectionKeyCode:A,selectionOnDrag:M,selectionMode:L,multiSelectionKeyCode:H,panActivationKeyCode:O,zoomActivationKeyCode:P,deleteKeyCode:F,onlyRenderVisibleElements:Y,elementsSelectable:q,selectNodesOnDrag:R,defaultViewport:Q,translateExtent:z,minZoom:ne,maxZoom:Z,preventScrolling:$,defaultMarkerColor:X,zoomOnScroll:I,zoomOnPinch:W,panOnScroll:G,panOnScrollSpeed:U,panOnScrollMode:J,zoomOnDoubleClick:re,panOnDrag:le,onPaneClick:fe,onPaneMouseEnter:te,onPaneMouseMove:ce,onPaneMouseLeave:Ce,onPaneScroll:ve,onPaneContextMenu:Te,onEdgeContextMenu:ye,onEdgeMouseEnter:ke,onEdgeMouseMove:Ge,onEdgeMouseLeave:we,onReconnect:_e,onReconnectStart:ze,onReconnectEnd:ft,reconnectRadius:ht,noDragClassName:Ue,noWheelClassName:De,noPanClassName:Ze,elevateEdgesOnSelect:Ye,disableKeyboardA11y:vt,nodeOrigin:ot,nodeExtent:yt,rfId:Kt})=>{const Mt=Sx(e,$M),Xe=Sx(n,WM);return aP(l),ue.createElement(LM,{onPaneClick:fe,onPaneMouseEnter:te,onPaneMouseMove:ce,onPaneMouseLeave:Ce,onPaneContextMenu:Te,onPaneScroll:ve,deleteKeyCode:F,selectionKeyCode:A,selectionOnDrag:M,selectionMode:L,onSelectionStart:_,onSelectionEnd:S,multiSelectionKeyCode:H,panActivationKeyCode:O,zoomActivationKeyCode:P,elementsSelectable:q,onMove:r,onMoveStart:i,onMoveEnd:o,zoomOnScroll:I,zoomOnPinch:W,zoomOnDoubleClick:re,panOnScroll:G,panOnScrollSpeed:U,panOnScrollMode:J,panOnDrag:le,defaultViewport:Q,translateExtent:z,minZoom:ne,maxZoom:Z,onSelectionContextMenu:N,preventScrolling:$,noDragClassName:Ue,noWheelClassName:De,noPanClassName:Ze,disableKeyboardA11y:vt},ue.createElement(oP,null,ue.createElement(sP,{edgeTypes:Xe,onEdgeClick:c,onEdgeDoubleClick:p,onlyRenderVisibleElements:Y,onEdgeContextMenu:ye,onEdgeMouseEnter:ke,onEdgeMouseMove:Ge,onEdgeMouseLeave:we,onReconnect:_e,onReconnectStart:ze,onReconnectEnd:ft,reconnectRadius:ht,defaultMarkerColor:X,noPanClassName:Ze,elevateEdgesOnSelect:!!Ye,disableKeyboardA11y:vt,rfId:Kt},ue.createElement(cP,{style:k,type:b,component:E,containerStyle:C})),ue.createElement("div",{className:"react-flow__edgelabel-renderer"}),ue.createElement(zM,{nodeTypes:Mt,onNodeClick:u,onNodeDoubleClick:h,onNodeMouseEnter:d,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,selectNodesOnDrag:R,onlyRenderVisibleElements:Y,noPanClassName:Ze,noDragClassName:Ue,disableKeyboardA11y:vt,nodeOrigin:ot,nodeExtent:yt,rfId:Kt})))};UN.displayName="GraphView";var dP=T.memo(UN);const vv=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ys={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:vv,nodeExtent:vv,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:ai.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:$I,isValidConnection:void 0},fP=()=>ZR((e,n)=>({...ys,setNodes:r=>{const{nodeInternals:i,nodeOrigin:o,elevateNodesOnSelect:l}=n();e({nodeInternals:Td(r,i,o,l)})},getNodes:()=>Array.from(n().nodeInternals.values()),setEdges:r=>{const{defaultEdgeOptions:i={}}=n();e({edges:r.map(o=>({...i,...o}))})},setDefaultNodesAndEdges:(r,i)=>{const o=typeof r<"u",l=typeof i<"u",u=o?Td(r,new Map,n().nodeOrigin,n().elevateNodesOnSelect):new Map;e({nodeInternals:u,edges:l?i:[],hasDefaultNodes:o,hasDefaultEdges:l})},updateNodeDimensions:r=>{const{onNodesChange:i,nodeInternals:o,fitViewOnInit:l,fitViewOnInitDone:u,fitViewOnInitOptions:c,domNode:h,nodeOrigin:p}=n(),d=h==null?void 0:h.querySelector(".react-flow__viewport");if(!d)return;const m=window.getComputedStyle(d),{m22:y}=new window.DOMMatrixReadOnly(m.transform),w=r.reduce((_,S)=>{const b=o.get(S.id);if(b!=null&&b.hidden)o.set(b.id,{...b,[dt]:{...b[dt],handleBounds:void 0}});else if(b){const k=Lv(S.nodeElement);!!(k.width&&k.height&&(b.width!==k.width||b.height!==k.height||S.forceUpdate))&&(o.set(b.id,{...b,[dt]:{...b[dt],handleBounds:{source:gx(".source",S.nodeElement,y,p),target:gx(".target",S.nodeElement,y,p)}},...k}),_.push({id:b.id,type:"dimensions",dimensions:k}))}return _},[]);AN(o,p);const N=u||l&&!u&&IN(n,{initial:!0,...c});e({nodeInternals:new Map(o),fitViewOnInitDone:N}),(w==null?void 0:w.length)>0&&(i==null||i(w))},updateNodePositions:(r,i=!0,o=!1)=>{const{triggerNodeChanges:l}=n(),u=r.map(c=>{const h={id:c.id,type:"position",dragging:o};return i&&(h.positionAbsolute=c.positionAbsolute,h.position=c.position),h});l(u)},triggerNodeChanges:r=>{const{onNodesChange:i,nodeInternals:o,hasDefaultNodes:l,nodeOrigin:u,getNodes:c,elevateNodesOnSelect:h}=n();if(r!=null&&r.length){if(l){const p=CM(r,c()),d=Td(p,o,u,h);e({nodeInternals:d})}i==null||i(r)}},addSelectedNodes:r=>{const{multiSelectionActive:i,edges:o,getNodes:l}=n();let u,c=null;i?u=r.map(h=>xs(h,!0)):(u=ro(l(),r),c=ro(o,[])),Gl({changedNodes:u,changedEdges:c,get:n,set:e})},addSelectedEdges:r=>{const{multiSelectionActive:i,edges:o,getNodes:l}=n();let u,c=null;i?u=r.map(h=>xs(h,!0)):(u=ro(o,r),c=ro(l(),[])),Gl({changedNodes:c,changedEdges:u,get:n,set:e})},unselectNodesAndEdges:({nodes:r,edges:i}={})=>{const{edges:o,getNodes:l}=n(),u=r||l(),c=i||o,h=u.map(d=>(d.selected=!1,xs(d.id,!1))),p=c.map(d=>xs(d.id,!1));Gl({changedNodes:h,changedEdges:p,get:n,set:e})},setMinZoom:r=>{const{d3Zoom:i,maxZoom:o}=n();i==null||i.scaleExtent([r,o]),e({minZoom:r})},setMaxZoom:r=>{const{d3Zoom:i,minZoom:o}=n();i==null||i.scaleExtent([o,r]),e({maxZoom:r})},setTranslateExtent:r=>{var i;(i=n().d3Zoom)==null||i.translateExtent(r),e({translateExtent:r})},resetSelectedElements:()=>{const{edges:r,getNodes:i}=n(),l=i().filter(c=>c.selected).map(c=>xs(c.id,!1)),u=r.filter(c=>c.selected).map(c=>xs(c.id,!1));Gl({changedNodes:l,changedEdges:u,get:n,set:e})},setNodeExtent:r=>{const{nodeInternals:i}=n();i.forEach(o=>{o.positionAbsolute=qv(o.position,r)}),e({nodeExtent:r,nodeInternals:new Map(i)})},panBy:r=>{const{transform:i,width:o,height:l,d3Zoom:u,d3Selection:c,translateExtent:h}=n();if(!u||!c||!r.x&&!r.y)return!1;const p=Br.translate(i[0]+r.x,i[1]+r.y).scale(i[2]),d=[[0,0],[o,l]],m=u==null?void 0:u.constrain()(p,d,h);return u.transform(c,m),i[0]!==m.x||i[1]!==m.y||i[2]!==m.k},cancelConnection:()=>e({connectionNodeId:ys.connectionNodeId,connectionHandleId:ys.connectionHandleId,connectionHandleType:ys.connectionHandleType,connectionStatus:ys.connectionStatus,connectionStartHandle:ys.connectionStartHandle,connectionEndHandle:ys.connectionEndHandle}),reset:()=>e({...ys})}),Object.is),Wv=({children:e})=>{const n=T.useRef(null);return n.current||(n.current=fP()),ue.createElement(AI,{value:n.current},e)};Wv.displayName="ReactFlowProvider";const HN=({children:e})=>T.useContext(Eu)?ue.createElement(ue.Fragment,null,e):ue.createElement(Wv,null,e);HN.displayName="ReactFlowWrapper";const hP={input:kN,default:mv,output:NN,group:Uv},pP={default:gu,straight:Fv,step:Dv,smoothstep:Nu,simplebezier:$v},mP=[0,0],gP=[15,15],vP={x:0,y:0,zoom:1},yP={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},WN=T.forwardRef(({nodes:e,edges:n,defaultNodes:r,defaultEdges:i,className:o,nodeTypes:l=hP,edgeTypes:u=pP,onNodeClick:c,onEdgeClick:h,onInit:p,onMove:d,onMoveStart:m,onMoveEnd:y,onConnect:w,onConnectStart:N,onConnectEnd:_,onClickConnectStart:S,onClickConnectEnd:b,onNodeMouseEnter:k,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:A,onNodeDoubleClick:M,onNodeDragStart:L,onNodeDrag:H,onNodeDragStop:O,onNodesDelete:P,onEdgesDelete:F,onSelectionChange:Y,onSelectionDragStart:q,onSelectionDrag:R,onSelectionDragStop:Q,onSelectionContextMenu:z,onSelectionStart:ne,onSelectionEnd:Z,connectionMode:$=ai.Strict,connectionLineType:X=_s.Bezier,connectionLineStyle:I,connectionLineComponent:W,connectionLineContainerStyle:G,deleteKeyCode:U="Backspace",selectionKeyCode:J="Shift",selectionOnDrag:re=!1,selectionMode:le=Ca.Full,panActivationKeyCode:fe="Space",multiSelectionKeyCode:te=pu()?"Meta":"Control",zoomActivationKeyCode:ce=pu()?"Meta":"Control",snapToGrid:Ce=!1,snapGrid:ve=gP,onlyRenderVisibleElements:Te=!1,selectNodesOnDrag:ye=!0,nodesDraggable:ke,nodesConnectable:Ge,nodesFocusable:we,nodeOrigin:_e=mP,edgesFocusable:ze,edgesUpdatable:ft,elementsSelectable:ht,defaultViewport:Ue=vP,minZoom:De=.5,maxZoom:Ze=2,translateExtent:Ye=vv,preventScrolling:vt=!0,nodeExtent:ot,defaultMarkerColor:yt="#b1b1b7",zoomOnScroll:Kt=!0,zoomOnPinch:Mt=!0,panOnScroll:Xe=!1,panOnScrollSpeed:wt=.5,panOnScrollMode:pt=ri.Free,zoomOnDoubleClick:mt=!0,panOnDrag:_n=!0,onPaneClick:Xt,onPaneMouseEnter:Pt,onPaneMouseMove:Qt,onPaneMouseLeave:yr,onPaneScroll:bn,onPaneContextMenu:Zt,children:pn,onEdgeContextMenu:Sn,onEdgeDoubleClick:Gr,onEdgeMouseEnter:ut,onEdgeMouseMove:hi,onEdgeMouseLeave:nr,onEdgeUpdate:Es,onEdgeUpdateStart:pi,onEdgeUpdateEnd:Jt,onReconnect:rr,onReconnectStart:wr,onReconnectEnd:So,reconnectRadius:sr=10,edgeUpdaterRadius:xr=10,onNodesChange:mn,onEdgesChange:Yr,noDragClassName:mi="nodrag",noWheelClassName:Kr="nowheel",noPanClassName:Ns="nopan",fitView:gn=!1,fitViewOptions:jt,connectOnClick:_r=!0,attributionPosition:Xr,proOptions:en,defaultEdgeOptions:Qr,elevateNodesOnSelect:Cs=!0,elevateEdgesOnSelect:gi=!1,disableKeyboardA11y:ir=!1,autoPanOnConnect:vi=!0,autoPanOnNodeDrag:Je=!0,connectionRadius:ko=20,isValidConnection:br,onError:js,style:or,id:$n,nodeDragThreshold:yi,...Ot},Ut)=>{const Sr=$n||"1";return ue.createElement("div",{...Ot,style:{...or,...yP},ref:Ut,className:Bt(["react-flow",o]),"data-testid":"rf__wrapper",id:$n},ue.createElement(HN,null,ue.createElement(dP,{onInit:p,onMove:d,onMoveStart:m,onMoveEnd:y,onNodeClick:c,onEdgeClick:h,onNodeMouseEnter:k,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:A,onNodeDoubleClick:M,nodeTypes:l,edgeTypes:u,connectionLineType:X,connectionLineStyle:I,connectionLineComponent:W,connectionLineContainerStyle:G,selectionKeyCode:J,selectionOnDrag:re,selectionMode:le,deleteKeyCode:U,multiSelectionKeyCode:te,panActivationKeyCode:fe,zoomActivationKeyCode:ce,onlyRenderVisibleElements:Te,selectNodesOnDrag:ye,defaultViewport:Ue,translateExtent:Ye,minZoom:De,maxZoom:Ze,preventScrolling:vt,zoomOnScroll:Kt,zoomOnPinch:Mt,zoomOnDoubleClick:mt,panOnScroll:Xe,panOnScrollSpeed:wt,panOnScrollMode:pt,panOnDrag:_n,onPaneClick:Xt,onPaneMouseEnter:Pt,onPaneMouseMove:Qt,onPaneMouseLeave:yr,onPaneScroll:bn,onPaneContextMenu:Zt,onSelectionContextMenu:z,onSelectionStart:ne,onSelectionEnd:Z,onEdgeContextMenu:Sn,onEdgeDoubleClick:Gr,onEdgeMouseEnter:ut,onEdgeMouseMove:hi,onEdgeMouseLeave:nr,onReconnect:rr??Es,onReconnectStart:wr??pi,onReconnectEnd:So??Jt,reconnectRadius:sr??xr,defaultMarkerColor:yt,noDragClassName:mi,noWheelClassName:Kr,noPanClassName:Ns,elevateEdgesOnSelect:gi,rfId:Sr,disableKeyboardA11y:ir,nodeOrigin:_e,nodeExtent:ot}),ue.createElement(aM,{nodes:e,edges:n,defaultNodes:r,defaultEdges:i,onConnect:w,onConnectStart:N,onConnectEnd:_,onClickConnectStart:S,onClickConnectEnd:b,nodesDraggable:ke,nodesConnectable:Ge,nodesFocusable:we,edgesFocusable:ze,edgesUpdatable:ft,elementsSelectable:ht,elevateNodesOnSelect:Cs,minZoom:De,maxZoom:Ze,nodeExtent:ot,onNodesChange:mn,onEdgesChange:Yr,snapToGrid:Ce,snapGrid:ve,connectionMode:$,translateExtent:Ye,connectOnClick:_r,defaultEdgeOptions:Qr,fitView:gn,fitViewOptions:jt,onNodesDelete:P,onEdgesDelete:F,onNodeDragStart:L,onNodeDrag:H,onNodeDragStop:O,onSelectionDrag:R,onSelectionDragStart:q,onSelectionDragStop:Q,noPanClassName:Ns,nodeOrigin:_e,rfId:Sr,autoPanOnConnect:vi,autoPanOnNodeDrag:Je,onError:js,connectionRadius:ko,isValidConnection:br,nodeDragThreshold:yi}),ue.createElement(iM,{onSelectionChange:Y}),pn,ue.createElement(MI,{proOptions:en,position:Xr}),ue.createElement(fM,{rfId:Sr,disableKeyboardA11y:ir})))});WN.displayName="ReactFlow";const wP=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function VN(){return Ke(wP,Nt)}const GN=({id:e,x:n,y:r,width:i,height:o,style:l,color:u,strokeColor:c,strokeWidth:h,className:p,borderRadius:d,shapeRendering:m,onClick:y,selected:w})=>{const{background:N,backgroundColor:_}=l||{},S=u||N||_;return ue.createElement("rect",{className:Bt(["react-flow__minimap-node",{selected:w},p]),x:n,y:r,rx:d,ry:d,width:i,height:o,fill:S,stroke:c,strokeWidth:h,shapeRendering:m,onClick:y?b=>y(b,e):void 0})};GN.displayName="MiniMapNode";var xP=T.memo(GN);const _P=e=>e.nodeOrigin,bP=e=>e.getNodes().filter(n=>!n.hidden&&n.width&&n.height),Pd=e=>e instanceof Function?e:()=>e;function SP({nodeStrokeColor:e="transparent",nodeColor:n="#e2e2e2",nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:o=2,nodeComponent:l=xP,onClick:u}){const c=Ke(bP,Nt),h=Ke(_P),p=Pd(n),d=Pd(e),m=Pd(r),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return ue.createElement(ue.Fragment,null,c.map(w=>{const{x:N,y:_}=ii(w,h).positionAbsolute;return ue.createElement(l,{key:w.id,x:N,y:_,width:w.width,height:w.height,style:w.style,selected:w.selected,className:m(w),color:p(w),borderRadius:i,strokeColor:d(w),strokeWidth:o,shapeRendering:y,onClick:u,id:w.id})}))}var kP=T.memo(SP);const EP=200,NP=150,CP=e=>{const n=e.getNodes(),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:n.length>0?LI(Cu(n,e.nodeOrigin),r):r,rfId:e.rfId}},jP="react-flow__minimap-desc";function YN({style:e,className:n,nodeStrokeColor:r="transparent",nodeColor:i="#e2e2e2",nodeClassName:o="",nodeBorderRadius:l=5,nodeStrokeWidth:u=2,nodeComponent:c,maskColor:h="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:d=1,position:m="bottom-right",onClick:y,onNodeClick:w,pannable:N=!1,zoomable:_=!1,ariaLabel:S="React Flow mini map",inversePan:b=!1,zoomStep:k=10,offsetScale:E=5}){const C=Ct(),A=T.useRef(null),{boundingRect:M,viewBB:L,rfId:H}=Ke(CP,Nt),O=(e==null?void 0:e.width)??EP,P=(e==null?void 0:e.height)??NP,F=M.width/O,Y=M.height/P,q=Math.max(F,Y),R=q*O,Q=q*P,z=E*q,ne=M.x-(R-M.width)/2-z,Z=M.y-(Q-M.height)/2-z,$=R+z*2,X=Q+z*2,I=`${jP}-${H}`,W=T.useRef(0);W.current=q,T.useEffect(()=>{if(A.current){const J=Pn(A.current),re=te=>{const{transform:ce,d3Selection:Ce,d3Zoom:ve}=C.getState();if(te.sourceEvent.type!=="wheel"||!Ce||!ve)return;const Te=-te.sourceEvent.deltaY*(te.sourceEvent.deltaMode===1?.05:te.sourceEvent.deltaMode?1:.002)*k,ye=ce[2]*Math.pow(2,Te);ve.scaleTo(Ce,ye)},le=te=>{const{transform:ce,d3Selection:Ce,d3Zoom:ve,translateExtent:Te,width:ye,height:ke}=C.getState();if(te.sourceEvent.type!=="mousemove"||!Ce||!ve)return;const Ge=W.current*Math.max(1,ce[2])*(b?-1:1),we={x:ce[0]-te.sourceEvent.movementX*Ge,y:ce[1]-te.sourceEvent.movementY*Ge},_e=[[0,0],[ye,ke]],ze=Br.translate(we.x,we.y).scale(ce[2]),ft=ve.constrain()(ze,_e,Te);ve.transform(Ce,ft)},fe=nN().on("zoom",N?le:null).on("zoom.wheel",_?re:null);return J.call(fe),()=>{J.on("zoom",null)}}},[N,_,b,k]);const G=y?J=>{const re=Xn(J);y(J,{x:re[0],y:re[1]})}:void 0,U=w?(J,re)=>{const le=C.getState().nodeInternals.get(re);w(J,le)}:void 0;return ue.createElement(Ov,{position:m,style:e,className:Bt(["react-flow__minimap",n]),"data-testid":"rf__minimap"},ue.createElement("svg",{width:O,height:P,viewBox:`${ne} ${Z} ${$} ${X}`,role:"img","aria-labelledby":I,ref:A,onClick:G},S&&ue.createElement("title",{id:I},S),ue.createElement(kP,{onClick:U,nodeColor:i,nodeStrokeColor:r,nodeBorderRadius:l,nodeClassName:o,nodeStrokeWidth:u,nodeComponent:c}),ue.createElement("path",{className:"react-flow__minimap-mask",d:`M${ne-z},${Z-z}h${$+z*2}v${X+z*2}h${-$-z*2}z
|
|
57
57
|
M${L.x},${L.y}h${L.width}v${L.height}h${-L.width}z`,fill:h,fillRule:"evenodd",stroke:p,strokeWidth:d,pointerEvents:"none"})))}YN.displayName="MiniMap";var RP=T.memo(YN);function TP(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},ue.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function AP(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},ue.createElement("path",{d:"M0 0h32v4.2H0z"}))}function IP(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},ue.createElement("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 MP(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ue.createElement("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 PP(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ue.createElement("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"}))}const so=({children:e,className:n,...r})=>ue.createElement("button",{type:"button",className:Bt(["react-flow__controls-button",n]),...r},e);so.displayName="ControlButton";const OP=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),KN=({style:e,showZoom:n=!0,showFitView:r=!0,showInteractive:i=!0,fitViewOptions:o,onZoomIn:l,onZoomOut:u,onFitView:c,onInteractiveChange:h,className:p,children:d,position:m="bottom-left"})=>{const y=Ct(),[w,N]=T.useState(!1),{isInteractive:_,minZoomReached:S,maxZoomReached:b}=Ke(OP,Nt),{zoomIn:k,zoomOut:E,fitView:C}=Oa();if(T.useEffect(()=>{N(!0)},[]),!w)return null;const A=()=>{k(),l==null||l()},M=()=>{E(),u==null||u()},L=()=>{C(o),c==null||c()},H=()=>{y.setState({nodesDraggable:!_,nodesConnectable:!_,elementsSelectable:!_}),h==null||h(!_)};return ue.createElement(Ov,{className:Bt(["react-flow__controls",p]),position:m,style:e,"data-testid":"rf__controls"},n&&ue.createElement(ue.Fragment,null,ue.createElement(so,{onClick:A,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:b},ue.createElement(TP,null)),ue.createElement(so,{onClick:M,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:S},ue.createElement(AP,null))),r&&ue.createElement(so,{className:"react-flow__controls-fitview",onClick:L,title:"fit view","aria-label":"fit view"},ue.createElement(IP,null)),i&&ue.createElement(so,{className:"react-flow__controls-interactive",onClick:H,title:"toggle interactivity","aria-label":"toggle interactivity"},_?ue.createElement(PP,null):ue.createElement(MP,null)),d)};KN.displayName="Controls";var LP=T.memo(KN),Zn;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Zn||(Zn={}));function qP({color:e,dimensions:n,lineWidth:r}){return ue.createElement("path",{stroke:e,strokeWidth:r,d:`M${n[0]/2} 0 V${n[1]} M0 ${n[1]/2} H${n[0]}`})}function $P({color:e,radius:n}){return ue.createElement("circle",{cx:n,cy:n,r:n,fill:e})}const DP={[Zn.Dots]:"#91919a",[Zn.Lines]:"#eee",[Zn.Cross]:"#e2e2e2"},FP={[Zn.Dots]:1,[Zn.Lines]:1,[Zn.Cross]:6},zP=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function XN({id:e,variant:n=Zn.Dots,gap:r=20,size:i,lineWidth:o=1,offset:l=2,color:u,style:c,className:h}){const p=T.useRef(null),{transform:d,patternId:m}=Ke(zP,Nt),y=u||DP[n],w=i||FP[n],N=n===Zn.Dots,_=n===Zn.Cross,S=Array.isArray(r)?r:[r,r],b=[S[0]*d[2]||1,S[1]*d[2]||1],k=w*d[2],E=_?[k,k]:b,C=N?[k/l,k/l]:[E[0]/l,E[1]/l];return ue.createElement("svg",{className:Bt(["react-flow__background",h]),style:{...c,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},ue.createElement("pattern",{id:m+e,x:d[0]%b[0],y:d[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`},N?ue.createElement($P,{color:y,radius:k/l}):ue.createElement(qP,{dimensions:E,color:y,lineWidth:o})),ue.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}XN.displayName="Background";var BP=T.memo(XN);function QN(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function ZN(e){const n=e.cache_creation,r=n&&typeof n=="object"?n:e,i=r.ephemeral_1h_input_tokens,o=r.ephemeral_5m_input_tokens;return typeof i!="number"&&typeof o!="number"?{}:{cacheCreate1hTokens:Number(i??0),cacheCreate5mTokens:Number(o??0)}}function JN(e,n=0){if(!e||typeof e!="object"||n>6)return null;const r=e;if(typeof r.input_tokens=="number"||typeof r.output_tokens=="number"||typeof r.cache_read_input_tokens=="number"||typeof r.cache_creation_input_tokens=="number")return{inputTokens:Number(r.input_tokens??0),outputTokens:Number(r.output_tokens??0),cacheReadTokens:Number(r.cache_read_input_tokens??0),cacheCreateTokens:Number(r.cache_creation_input_tokens??0),...ZN(r)};for(const i of Object.values(r)){const o=JN(i,n+1);if(o)return o}return null}function UP(e,n){e.inputTokens+=n.inputTokens,e.outputTokens+=n.outputTokens,e.cacheReadTokens+=n.cacheReadTokens,e.cacheCreateTokens+=n.cacheCreateTokens,(n.cacheCreate1hTokens!==void 0||n.cacheCreate5mTokens!==void 0)&&(e.cacheCreate1hTokens=(e.cacheCreate1hTokens??0)+(n.cacheCreate1hTokens??0),e.cacheCreate5mTokens=(e.cacheCreate5mTokens??0)+(n.cacheCreate5mTokens??0))}const HP=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function eC(e,n=0){if(!e||typeof e!="object"||n>6)return null;const r=e;if(typeof r.model=="string"&&HP.test(r.model))return r.model;for(const i of Object.values(r)){const o=eC(i,n+1);if(o)return o}return null}function yv(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,seqEpoch:null,totalEvents:0}}function Ss(e){if(!e)return;const n=e.replace(/\\/g,"/").split("/").filter(Boolean);return n[n.length-1]}function La(e,n){return`${e}::${n}`}function vu(e){return e.agent_type??e.subagent_type??"subagent"}function xa(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function io(e,n,r,i){const o=n;let l=e.agents.get(o);return l||(l={id:o,sessionId:n,label:"session",kind:"root",state:"active",startedAt:r,lastEventAt:r,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:i,usage:QN()},e.agents.set(o,l),l)}function tC(e,n,r,i){const o=La(n,r),l=e.agents.get(o);if(!l)return null;!l.cwd&&i.cwd&&(l.cwd=i.cwd,l.cwdBasename=Ss(i.cwd));const u=vu(i);return u&&(l.label==="subagent"||!l.label)&&(l.label=u),l}function kx(e,n,r){const i=n.session_id??"unknown",o=xa(n);if(o){const h=tC(e,i,o,n);if(h)return h}const l=e.activeSubagentStack.get(i),u=l&&l.length>0?l[l.length-1]:null;if(u){const h=e.agents.get(La(i,u));if(h)return!h.cwd&&n.cwd&&(h.cwd=n.cwd,h.cwdBasename=Ss(n.cwd)),h}const c=io(e,i,r,!1);return c.synthetic&&(c.synthetic=!1,c.startedAt=r),!c.cwd&&n.cwd&&(c.cwd=n.cwd,c.cwdBasename=Ss(n.cwd)),c.label==="session"&&n.cwd&&(c.label=Ss(n.cwd)??"session"),c}function WP(e,n,r,i,o){const l=La(n,r),u=io(e,n,o,!0);let c=e.agents.get(l);if(c){!c.cwd&&i.cwd&&(c.cwd=i.cwd,c.cwdBasename=Ss(i.cwd));const h=vu(i);return h&&(c.label==="subagent"||!c.label)&&(c.label=h),c}return c={id:l,sessionId:n,label:vu(i),kind:"subagent",parentId:u.id,state:"active",startedAt:o,tools:[],prompts:[],cwd:i.cwd,cwdBasename:Ss(i.cwd),toolCount:0,childCount:0,usage:QN()},e.agents.set(l,c),u.childCount+=1,c}function VP(e,n,r){const i=e.activeSubagentStack.get(n)??[];i.includes(r)||(i.push(r),e.activeSubagentStack.set(n,i))}function GP(e,n,r){const i=e.activeSubagentStack.get(n);if(i){for(let o=i.length-1;o>=0;o--)if(i[o]===r){i.splice(o,1);break}i.length===0&&e.activeSubagentStack.delete(n)}}function Kl(e,n=80){if(e==null)return"";if(typeof e=="string")return e.length>n?e.slice(0,n-1)+"…":e;try{const r=JSON.stringify(e);return r.length>n?r.slice(0,n-1)+"…":r}catch{return String(e)}}const Ex=200,YP=25;function KP(e,n){const r=n.tools;if(r.length>Ex){const i=r.splice(0,r.length-Ex);for(const o of i)e.toolIndex.delete(o.id),e.toolOwner.delete(o.id)}for(let i=r.length-YP-1;i>=0;i--){const o=r[i];if(o.trimmed)break;o.input=void 0,o.response=void 0,o.trimmed=!0}}function XP(e,n,r){const i=e.toolIndex.get(r);if(i)return i;for(let o=n.tools.length-1;o>=0;o--)if(n.tools[o].id===r)return n.tools[o];return null}const Nx=2e3;function QP(e,n,r){for(let i=e.prompts.length-1;i>=0;i--){const o=e.prompts[i];if(o.at<n-Nx)return!1;if(o.text===r&&o.at<=n+Nx)return!0}return!1}function ZP(e,n,r,i){if(e.agents.size<=r)return!1;const o=[];for(const[u,c]of e.agents)c.state==="done"&&c.endedAt!=null&&n-c.endedAt>i&&o.push({id:u,endedAt:c.endedAt});if(o.length===0)return!1;o.sort((u,c)=>u.endedAt-c.endedAt);let l=0;for(const u of o){if(e.agents.size<=r)break;e.agents.delete(u.id),l++}return l>0}function JP(e,n,r,i){const o=new Map;for(const[p,d]of e.agents){let m=o.get(d.sessionId);m||(m={ids:[],endedAt:0,live:!1},o.set(d.sessionId,m)),m.ids.push(p),d.state==="done"&&d.endedAt!=null?m.endedAt=Math.max(m.endedAt,d.endedAt):m.live=!0}const l=[...o.values()].filter(p=>!p.live&&p.endedAt>0&&n-p.endedAt>i).sort((p,d)=>p.endedAt-d.endedAt);let c=[...o.values()].filter(p=>!p.live).length-r;if(c<=0)return!1;let h=!1;for(const p of l){if(c<=0)break;for(const d of p.ids)e.agents.delete(d);c--,h=!0}return h}function eO(e,n,r){let i=!1;for(const o of e.agents.values())for(const l of o.tools)l.endedAt==null&&n-l.startedAt>r&&(l.endedAt=l.startedAt+r,l.ok=!1,l.errorPreview="stale (no PostToolUse received)",e.toolIndex.delete(l.id),e.toolOwner.delete(l.id),i=!0);return i}const tO=90*6e4;function nO(e,n,r){let i=!1;for(const o of e.agents.values()){if(o.kind!=="root")continue;const l=o.lastEventAt??o.startedAt;if(!(n-l<=r)){o.waiting&&(o.waiting=null,i=!0),o.state==="active"&&(o.state="done",o.endedAt=l,o.reaped=!0,i=!0);for(const u of e.agents.values())u.sessionId!==o.sessionId||u.kind==="root"||u.state!=="active"||(u.state="done",u.endedAt=l,i=!0)}}return i}function rO(e){return e==="permission_prompt"?"permission":e==="idle_prompt"?"idle":null}const sO=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved"]);function iO(e,n){let r=null;for(const i of e.toolIndex.values()){const o=i.agentId?e.agents.get(i.agentId):void 0;!o||o.sessionId!==n||(!r||i.startedAt>r.startedAt)&&(r=i)}return r==null?void 0:r.explicitSubagentId}function oO(e,n,r,i,o){const l=r==="permission"?iO(e,n):void 0;return l?{kind:r,message:i,since:o,subagentId:l}:{kind:r,message:i,since:o}}function aO(e,n,r){if(e.kind!=="permission")return!0;const i=xa(n);return i==null?!0:e.subagentId!=null&&La(r,i)===e.subagentId}function Cx(e,n){const r=n.epoch??null;if(r!==null&&r!==e.seqEpoch)e.seqEpoch=r,e.lastSeq=0;else if(n.seq<=e.lastSeq)return e;const i=n.payload??{},o=n.receivedAt,l=i.hook_event_name??"Unknown";if(l==="__clear")return{...yv(),lastSeq:n.seq,seqEpoch:e.seqEpoch};e.totalEvents+=1,e.lastSeq=n.seq;const u=i.session_id??"unknown";if(!sO.has(l)){const d=e.agents.get(u);d!=null&&d.waiting&&aO(d.waiting,i,u)&&(d.waiting=null)}const c=e.agents.get(u);if(c&&o>(c.lastEventAt??0)&&(c.lastEventAt=o,c.reaped&&(c.reaped=!1,c.state="active",c.endedAt=void 0)),typeof i.model_context_window=="number"&&i.model_context_window>0){const d=e.agents.get(u);d&&(d.contextWindow=i.model_context_window)}if(l==="ModelObserved"){const d=typeof i.model=="string"?i.model:null;if(d){const y=e.agents.get(u);y&&(y.model=d)}const m=i.subagentModels;if(m&&typeof m=="object")for(const[y,w]of Object.entries(m)){if(typeof w!="string")continue;const N=`${u}::${y}`,_=e.agents.get(N);_&&(_.model=w)}return e}if(l==="ContextObserved"){const d=i.context??null;if(d){const m=e.agents.get(u);m&&(m.context={msgsUser:Number(d.msgsUser??0),msgsAssistant:Number(d.msgsAssistant??0),toolUses:Number(d.toolUses??0),toolResults:Number(d.toolResults??0),systemReminders:Number(d.systemReminders??0),currentContextTokens:Number(d.currentContextTokens??0),claudeMdFiles:Array.isArray(d.claudeMdFiles)?d.claudeMdFiles:[]})}return e}if(l==="UsageObserved"){const d=i.usage??null;if(d){const m=e.agents.get(u);if(m){m.usage.inputTokens=Number(d.input_tokens??0),m.usage.outputTokens=Number(d.output_tokens??0),m.usage.cacheReadTokens=Number(d.cache_read_input_tokens??d.cached_input_tokens??0),m.usage.cacheCreateTokens=Number(d.cache_creation_input_tokens??0);const y=ZN(d);m.usage.cacheCreate1hTokens=y.cacheCreate1hTokens,m.usage.cacheCreate5mTokens=y.cacheCreate5mTokens,typeof d.reasoning_output_tokens=="number"&&(m.usage.reasoningOutputTokens=Number(d.reasoning_output_tokens))}}return e}const h=kx(e,i,o);h.provider||(h.provider=i.provider==="codex"?"codex":"claude");const p=eC(i);switch(p&&(h.model=p),l){case"SessionStart":{const d=io(e,u,o,!1);d.synthetic=!1,d.state="active",d.startedAt=d.startedAt||o,!d.cwd&&i.cwd&&(d.cwd=i.cwd,d.cwdBasename=Ss(i.cwd)),d.label==="session"&&i.cwd&&(d.label=Ss(i.cwd)??"session");break}case"UserPromptSubmit":{for(const w of e.agents.values())w.sessionId===u&&w.kind==="subagent"&&w.state==="done"&&w.exitAt==null&&w.endedAt!=null&&w.endedAt<o&&(w.exitAt=o);const d=io(e,u,o,!1);d.state="active",d.endedAt=void 0,d.exitAt=void 0;const m=kx(e,i,o);m.state="active",m.exitAt=void 0,m.endedAt=void 0;const y=(typeof i.prompt=="string"?i.prompt:typeof i.message=="string"?i.message:"")??"";y&&!QP(m,o,y)&&(m.prompts.push({at:o,text:y}),m.firstPrompt||(m.firstPrompt=Kl(y,120)));break}case"PreToolUse":{const d=i.tool_use_id?XP(e,h,i.tool_use_id):null;if(d){i.tool_name&&d.name==="?"&&(d.name=i.tool_name),d.endedAt==null&&!d.trimmed&&i.tool_input!==void 0&&(d.input=i.tool_input,d.inputPreview=Kl(i.tool_input));break}const m=i.tool_use_id??`${h.id}:${h.toolCount}`,y=xa(i),w={id:m,name:i.tool_name??"?",input:i.tool_input,inputPreview:Kl(i.tool_input),agentId:h.id,explicitSubagentId:y?La(u,y):void 0,startedAt:o};h.tools.push(w),h.toolCount+=1,h.state="active",e.toolIndex.set(m,w),e.toolOwner.set(m,h.id),KP(e,h);break}case"PostToolUse":case"PostToolUseFailure":{const d=i.tool_use_id;if(!d)break;let m=e.toolIndex.get(d),y=!1;if(!m)for(const _ of e.agents.values()){const S=_.tools.find(b=>b.id===d);if(S){m=S,y=!0;break}}if(!m)break;m.endedAt=o,m.ok=l==="PostToolUse",m.trimmed||(m.response=i.tool_response),l==="PostToolUseFailure"?m.errorPreview=Kl(i.tool_response):y&&(m.errorPreview=void 0);const w=JN(i.tool_response);w&&(m.usage=w),e.toolIndex.delete(d);const N=e.toolOwner.get(d)??m.agentId;if(e.toolOwner.delete(d),N&&w){const _=e.agents.get(N);_&&UP(_.usage,w)}break}case"SubagentStart":{const d=xa(i);if(!d)break;const m=WP(e,u,d,i,o);m.state="active",m.startedAt=m.startedAt||o,m.exitAt=void 0,m.endedAt=void 0;const y=vu(i);y&&(m.label=y),VP(e,u,d);break}case"SubagentStop":{const d=xa(i);if(!d)break;const m=tC(e,u,d,i);if(!m)break;m.state="done",m.endedAt=o,GP(e,u,d);break}case"Stop":case"SessionEnd":{const d=io(e,u,o,!1);d.state="done",d.endedAt=o,e.activeSubagentStack.delete(u);break}case"Notification":{const d=rO(i.notification_type);if(!d)break;const m=io(e,u,o,!1),y=typeof i.message=="string"?i.message:"",w=m.waiting;m.waiting=w&&w.kind===d&&w.message===y?{...w,since:Math.min(w.since,o)}:oO(e,u,d,y,o);break}}return e}function Vv(e){let n=5381;for(let r=0;r<e.length;r++)n=(n<<5)+n^e.charCodeAt(r);return Math.abs(n)%360}const lO=Date.UTC(2026,8,1);function uO(e){return e<lO?{input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4}:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}}const cO=[{match:/^claude[-_](fable|mythos)[-_]5\b/i,rates:{input:10,output:50,cacheRead:1,cacheWrite:12.5,cacheWrite1h:20}},{match:/^claude[-_]opus[-_]5\b/i,rates:{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}},{match:/^claude[-_]sonnet[-_]5\b/i,rates:uO},{match:/^claude[-_]opus[-_]4[-_.](?:5|6|7|8)\b/i,rates:{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}},{match:/^claude[-_]opus[-_]4(?:[-_.]1)?\b/i,rates:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75,cacheWrite1h:30}},{match:/^claude[-_]sonnet[-_]4[-_.](?:5|6)\b/i,rates:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}},{match:/^claude[-_]sonnet[-_]4\b/i,rates:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}},{match:/^claude[-_]haiku[-_]4[-_.]5\b/i,rates:{input:1,output:5,cacheRead:.1,cacheWrite:1.25,cacheWrite1h:2}},{match:/^claude[-_]haiku[-_]3[-_.]5\b/i,rates:{input:.8,output:4,cacheRead:.08,cacheWrite:1,cacheWrite1h:1.6}},{match:/^gpt[-_]5[-_.]6[-_]cyber/i,rates:{input:12.5,output:75,cacheRead:1.25,cacheWrite:0}},{match:/^gpt[-_]5[-_.]6[-_]luna/i,rates:{input:.2,output:1.2,cacheRead:.02,cacheWrite:.25}},{match:/^gpt[-_]5[-_.]6[-_]terra/i,rates:{input:2,output:12,cacheRead:.2,cacheWrite:2.5}},{match:/^gpt[-_]5[-_.]6(?:[-_]sol)?\b/i,rates:{input:5,output:30,cacheRead:.5,cacheWrite:6.25}},{match:/^gpt[-_]5[-_.]5[-_]pro/i,rates:{input:30,output:180,cacheRead:30,cacheWrite:0}},{match:/^gpt[-_]5[-_.]5\b/i,rates:{input:5,output:30,cacheRead:.5,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]pro/i,rates:{input:30,output:180,cacheRead:3,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]mini/i,rates:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4[-_]nano/i,rates:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0}},{match:/^gpt[-_]5[-_.]4\b/i,rates:{input:2.5,output:15,cacheRead:.25,cacheWrite:0}},{match:/^gpt[-_]5[-_.]3[-_]codex/i,rates:{input:1.75,output:14,cacheRead:.175,cacheWrite:0}},{match:/^gpt[-_]5[-_.]2[-_]pro/i,rates:{input:21,output:168,cacheRead:21,cacheWrite:0}},{match:/^gpt[-_]5[-_.]2\b/i,rates:{input:1.75,output:14,cacheRead:.175,cacheWrite:0}},{match:/^codex[-_]mini/i,rates:{input:1.5,output:6,cacheRead:.375,cacheWrite:0}},{match:/^o1[-_]pro/i,rates:{input:150,output:600,cacheRead:150,cacheWrite:0}},{match:/^o1\b/i,rates:{input:15,output:60,cacheRead:7.5,cacheWrite:0}},{match:/^o3[-_]mini/i,rates:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0}},{match:/^o3[-_]pro/i,rates:{input:20,output:80,cacheRead:20,cacheWrite:0}},{match:/^o4[-_]mini/i,rates:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0}},{match:/^o3\b/i,rates:{input:2,output:8,cacheRead:.5,cacheWrite:0}}];function dO(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function Gv(e,n=Date.now()){if(!e)return null;for(const r of cO)if(r.match.test(e))return typeof r.rates=="function"?r.rates(n):r.rates;return null}function nC(e,n){const r=Math.max(0,e.cacheCreate1hTokens??0),i=Math.max(0,e.cacheCreate5mTokens??0),o=Math.max(0,e.cacheCreateTokens-r-i),l=i+o,u=n.cacheWrite1h??n.cacheWrite;return{tokens5m:l,tokens1h:r,usd5m:l*n.cacheWrite/1e6,usd1h:r*u/1e6}}function rC(e,n){return dO(n)?Math.max(0,e.inputTokens-e.cacheReadTokens):e.inputTokens}function fn(e,n,r=Date.now()){const i=Gv(n,r);if(!i)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const o=rC(e,n)*i.input/1e6,l=e.outputTokens*i.output/1e6,u=e.cacheReadTokens*i.cacheRead/1e6,c=nC(e,i),h=c.usd5m+c.usd1h;return{input:o,output:l,cacheRead:u,cacheWrite:h,total:o+l+u+h}}const jx=2e5,fO=1e6,hO=[/\[1m\]/i,/^claude[-_]opus[-_]5\b/i,/^claude[-_]sonnet[-_]5\b/i,/^claude[-_]opus[-_]4[-_.](?:5|6|7|8)\b/i,/^claude[-_]sonnet[-_]4[-_.]6\b/i,/^claude[-_](fable|mythos)[-_]5\b/i],pO=[{match:/^gpt[-_]5[-_.]6[-_]cyber/i,window:4e5},{match:/^gpt[-_]5[-_.]6/i,window:105e4},{match:/^gpt[-_]5[-_.]5/i,window:105e4},{match:/^gpt[-_]5[-_.]4[-_](?:mini|nano)/i,window:4e5},{match:/^gpt[-_]5[-_.]4/i,window:105e4},{match:/^gpt[-_]5[-_.]3[-_]codex[-_]spark/i,window:128e3},{match:/^gpt[-_]5[-_.]3[-_]codex/i,window:4e5},{match:/^gpt[-_]5[-_.]2/i,window:4e5},{match:/^gpt[-_]5/i,window:4e5},{match:/^codex[-_]mini/i,window:2e5},{match:/^o\d/i,window:2e5}];function mO(e){if(!e)return jx;for(const n of hO)if(n.test(e))return fO;for(const n of pO)if(n.match.test(e))return n.window;return jx}function sC(e,n){return typeof e=="number"&&e>0?e:mO(n)}function Fe(e){if(e<=0)return"—";if(e<.005)return"<1¢";if(e<1){const n=(e*100).toFixed(e<.1?1:0);if(Number(n)<100)return`${n}¢`}return e<100?`$${e.toFixed(2)}`:e<1e4?`$${e.toFixed(0)}`:`$${(e/1e3).toFixed(1)}k`}function yu(e,n){if(e<=0||n<10)return null;const r=e/n,i=r*60;return i>=.01?`${Fe(i)}/min`:`${Fe(r*3600)}/hr`}const gO=1;function vO(){const e=[];let n=0;return{push(r,i=0){const o={dismiss:r,layer:i,seq:n++};return e.push(o),()=>{const l=e.indexOf(o);l!==-1&&e.splice(l,1)}},dismissTop(){let r;for(const i of e)(!r||i.layer>r.layer||i.layer===r.layer&&i.seq>r.seq)&&(r=i);return r?(r.dismiss(),!0):!1},depth(){return e.length}}}const wv=vO();function yO(e){return e.overlayOpen?"dismiss":e.typing?"blur":"clear-selection"}function Rx(e){return String(e.tagName??"").toUpperCase()==="BODY"}function wO(e,n){return!e||!e.isConnected||Rx(e)?!1:n==null||Rx(n)}function vo(e,n={}){const{focusRef:r,layer:i}=n,o=T.useRef(e);o.current=e,T.useEffect(()=>wv.push(()=>o.current(),i),[i]),T.useEffect(()=>{var u;const l=document.activeElement;return(u=r==null?void 0:r.current)==null||u.focus(),()=>{wO(l,document.activeElement)&&l.focus()}},[])}function Mn(e){return e.toLocaleString()}function xO(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const _O=60;function bO(e,n=_O){if(e.length<=n)return e;const r=e.slice(e.length-(n-1)),i=r.search(/[/\\]/);return"…"+(i===-1?r:r.slice(i))}function SO({agent:e,onClose:n}){var d;const r=T.useRef(null);vo(n,{focusRef:r});const i=e.context,o=e.usage,l=(i==null?void 0:i.currentContextTokens)??0,u=sC(e.contextWindow,e.model),c=Math.min(100,l/u*100),h=fn(o,e.model),p=o.inputTokens+o.cacheReadTokens+o.cacheCreateTokens;return g.jsx("div",{className:"ctx-modal-backdrop",onClick:n,role:"presentation",children:g.jsxs("div",{className:"ctx-modal",onClick:m=>m.stopPropagation(),role:"dialog","aria-label":"Context breakdown",children:[g.jsxs("header",{className:"ctx-modal-head",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),g.jsx("div",{className:"ctx-modal-sub",children:"approximation — CC's /context isn't hook-exposed"})]}),g.jsx("button",{type:"button",ref:r,className:"ctx-modal-close",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),g.jsxs("section",{className:"ctx-window-row",children:[g.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(c),children:g.jsx("div",{className:"ctx-window-fill",style:{width:`${c}%`}})}),g.jsxs("div",{className:"ctx-window-meta",children:[g.jsxs("span",{className:"ctx-window-pct",children:[c.toFixed(1),"%"]}),g.jsxs("span",{children:[Mn(l)," / ",Mn(u)," tok (current turn)"]})]})]}),g.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),g.jsxs("div",{className:"ctx-grid",children:[g.jsx(Kn,{label:"input tokens",val:Mn(o.inputTokens)}),g.jsx(Kn,{label:"output tokens",val:Mn(o.outputTokens)}),g.jsx(Kn,{label:"cache reads",val:Mn(o.cacheReadTokens)}),g.jsx(Kn,{label:"cache writes",val:Mn(o.cacheCreateTokens)}),g.jsx(Kn,{label:"cumulative total",val:Mn(p)}),g.jsx(Kn,{label:"estimated cost",val:Fe(h.total),accent:!0})]}),g.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),g.jsxs("div",{className:"ctx-grid",children:[g.jsx(Kn,{label:"user messages",val:Mn((i==null?void 0:i.msgsUser)??0)}),g.jsx(Kn,{label:"assistant messages",val:Mn((i==null?void 0:i.msgsAssistant)??0)}),g.jsx(Kn,{label:"tool uses",val:Mn((i==null?void 0:i.toolUses)??0)}),g.jsx(Kn,{label:"tool results",val:Mn((i==null?void 0:i.toolResults)??0)}),g.jsx(Kn,{label:"system-reminders",val:Mn((i==null?void 0:i.systemReminders)??0)})]}),g.jsx("h3",{className:"ctx-section-title",children:"CLAUDE.md files in scope"}),(((d=i==null?void 0:i.claudeMdFiles)==null?void 0:d.length)??0)===0?g.jsx("div",{className:"ctx-empty",children:"No CLAUDE.md files found on the path from cwd to ~/.claude."}):g.jsx("ul",{className:"ctx-md-list",children:i.claudeMdFiles.map(m=>g.jsxs("li",{children:[g.jsx("span",{className:"ctx-md-path",title:m.path,children:bO(m.path)}),g.jsx("span",{className:"ctx-md-size",children:xO(m.bytes)})]},m.path))})]})})}function Kn({label:e,val:n,accent:r}){return g.jsxs("div",{className:`ctx-row${r?" accent":""}`,children:[g.jsx("span",{className:"ctx-row-label",children:e}),g.jsx("span",{className:"ctx-row-val",children:n})]})}function kO({currentContextTokens:e,modelId:n,contextWindow:r,size:i=26,onClick:o,title:l}){const u=sC(r,n),c=Math.min(1,e/u),h=i/2-3,p=i/2,d=2*Math.PI*h,m=d*c,y=c>.9?"var(--err)":c>.7?"var(--inflight)":"var(--accent)";return g.jsx("button",{type:"button",className:"ctx-donut",onClick:o,title:l??`context: ${e.toLocaleString()} / ${u.toLocaleString()} (${(c*100).toFixed(1)}%)`,"aria-label":"Show context breakdown",children:g.jsxs("svg",{width:i,height:i,viewBox:`0 0 ${i} ${i}`,children:[g.jsx("circle",{cx:p,cy:p,r:h,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),g.jsx("circle",{cx:p,cy:p,r:h,stroke:y,strokeWidth:"2.5",fill:"none",strokeDasharray:`${m} ${d-m}`,strokeDashoffset:d/4,strokeLinecap:"round",style:{transition:"stroke-dasharray 400ms ease"}}),g.jsx("text",{x:p,y:p+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(c*100)})]})})}function EO(e,n){const r=Gv(n);if(!r)return"no rates for this model";const i=d=>d.toLocaleString(),o=d=>`$${d}/MTok`,l=fn(e,n),u=nC(e,r),c=u.tokens1h>0?[`cache w5m${i(u.tokens5m).padStart(14)} × ${o(r.cacheWrite).padEnd(11)} = ${Fe(u.usd5m)}`,`cache w1h${i(u.tokens1h).padStart(14)} × ${o(r.cacheWrite1h??r.cacheWrite).padEnd(11)} = ${Fe(u.usd1h)}`]:[`cache w ${i(u.tokens5m).padStart(14)} × ${o(r.cacheWrite).padEnd(11)} = ${Fe(u.usd5m)}`],h=rC(e,n),p=h===e.inputTokens?"input":"uncached";return[`model: ${n}`,`${p.padEnd(9)}${i(h).padStart(14)} × ${o(r.input).padEnd(11)} = ${Fe(l.input)}`,`output ${i(e.outputTokens).padStart(14)} × ${o(r.output).padEnd(11)} = ${Fe(l.output)}`,`cache r ${i(e.cacheReadTokens).padStart(14)} × ${o(r.cacheRead).padEnd(11)} = ${Fe(l.cacheRead)}`,...c,"─────────────────────────────────────────",`total = ${Fe(l.total)}`].join(`
|
|
58
58
|
`)}function xv(e,n,r){const i=(n??r)-e;if(i<1e3)return`${Math.max(0,i)}ms`;const o=Math.floor(i/1e3);if(o<60)return`${o}s`;const l=Math.floor(o/60),u=o%60;return`${l}m ${String(u).padStart(2,"0")}s`}function NO({data:e,selected:n}){var h;const r=e.now??Date.now(),i=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",n?"selected":""].filter(Boolean).join(" "),o=e.tools.filter(p=>!p.endedAt).length,l=Vv(e.sessionId),u=((h=e.context)==null?void 0:h.currentContextTokens)??0,c=e.kind==="root"&&u>0;return g.jsxs("div",{className:i,style:{"--session-hue":l},children:[g.jsx("span",{className:"accent-stripe"}),g.jsx(po,{type:"target",position:Ae.Left,style:{background:"transparent",border:"none"}}),g.jsxs("div",{className:"head",children:[g.jsxs("div",{className:"title",children:[g.jsx(CO,{state:e.state}),g.jsx("span",{className:"label",title:e.cwd,children:e.label}),e.synthetic&&g.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"})]}),g.jsxs("div",{className:"head-right",children:[c&&e.onOpenContext&&g.jsx(kO,{currentContextTokens:u,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),g.jsx("div",{className:"time",title:`Started ${new Date(e.startedAt).toLocaleTimeString()}`,children:xv(e.startedAt,e.endedAt,r)})]})]}),g.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&g.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model&&g.jsx("span",{className:"model-chip",title:e.model,children:li(e.model)})]}),e.waiting&&g.jsx(RO,{waiting:e.waiting,now:r}),e.tools.length>0&&g.jsx(AO,{tools:e.tools,now:r}),g.jsxs("div",{className:"meta",children:[g.jsxs("span",{children:[g.jsx("b",{children:e.toolCount})," tools"]}),o>0&&g.jsxs("span",{className:"inflight-meta",children:[g.jsx("b",{children:o})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&g.jsxs("span",{className:"tokens-meta",title:`in:${e.usage.inputTokens} out:${e.usage.outputTokens} cache-r:${e.usage.cacheReadTokens} cache-c:${e.usage.cacheCreateTokens}${(e.usage.reasoningOutputTokens??0)>0?` reasoning:${e.usage.reasoningOutputTokens}`:""}`,children:[g.jsx("b",{children:TO(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&Gv(e.model)&&(()=>{const p=fn(e.usage,e.model);if(p.total<=0)return null;const d=Math.max(0,((e.endedAt??r)-e.startedAt)/1e3),m=e.state==="active"?yu(p.total,d):null,y=EO(e.usage,e.model)+(m?`
|
|
59
59
|
burn: ${m}`:"");return g.jsxs("span",{className:"cost-meta",title:y,children:[g.jsx("b",{children:Fe(p.total)}),m&&g.jsx("span",{className:"cost-rate",children:m})]})})()]}),g.jsx(po,{type:"source",position:Ae.Right,style:{background:"transparent",border:"none"}})]})}function CO({state:e}){const n=e==="active"?"live":e==="done"?"done":"err";return g.jsx("span",{className:`state-pill state-${e}`,children:n})}function ju(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function jO(e){return e.kind==="permission"?ju(e):"Your turn"}function RO({waiting:e,now:n}){const r=e.kind==="permission",i=ju(e);return g.jsxs("div",{className:r?"waiting-row permission":"waiting-row idle",title:`${i}
|
|
60
|
-
Blocked for ${xv(e.since,void 0,n)} — the answer goes in the terminal, not here.`,children:[r?g.jsx("span",{className:"ap-pulse","aria-hidden":!0}):g.jsx("span",{className:"waiting-dot","aria-hidden":!0}),g.jsx("span",{className:"waiting-said",children:jO(e)}),g.jsx("b",{children:xv(e.since,void 0,n)})]})}function TO(e){return e<1e3?`${e}`:e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(2)}M`}function AO({tools:e,now:n}){const l=new Array(24).fill(0);let u=0;for(const y of e){const w=n-y.startedAt;if(w<0||w>=6e4)continue;const N=23-Math.floor(w/2500);N>=0&&N<24&&(l[N]+=1,u+=1)}const c=Math.max(1,...l),h=132,p=14,d=h/24,m=c/(2500/1e3);return g.jsxs("div",{className:"tool-spark-row",title:`${u} tool calls in last 60s · peak ${m.toFixed(1)}/s`,children:[g.jsx("svg",{className:"tool-spark",width:h,height:p,viewBox:`0 0 ${h} ${p}`,"aria-hidden":!0,children:l.map((y,w)=>{const N=y===0?1.5:Math.max(1.5,y/c*p),_=w===23&&y>0,b=`tool-spark-bar${y>0?" active":""}${_?" latest":""}`;return g.jsx("rect",{x:w*d+.4,y:p-N,width:Math.max(.5,d-1),height:N,rx:.8,className:b},w)})}),g.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function li(e){const n=e.replace(/^anthropic\./,"").replace(/[-_]\d{8}(?!\d)/,""),r=n.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(r){const l=r[1][0].toUpperCase()+r[1].slice(1).toLowerCase(),u=r[2].replace(/[-_]/g,".");return`${l} ${u}`}const i=n.match(/^gpt[-_](\d+(?:[-_.]\d+)*)[-_]codex\b/i);if(i)return`GPT-${i[1].replace(/[-_]/g,".")} Codex`;const o=n.match(/^gpt[-_](\d+(?:[-_.]\d+)*)/i);return o?`GPT-${o[1].replace(/[-_]/g,".")}`:e}function Tx(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function IO(e){if(e.endedAt==null)return"in-flight…";const n=e.endedAt-e.startedAt;return n<1e3?`${n}ms`:`${(n/1e3).toFixed(2)}s`}function MO({tool:e,onClose:n}){vo(n);const r=e.endedAt==null?"inflight":e.ok===!1?"err":"done";return g.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:g.jsxs("div",{className:"modal",onClick:i=>i.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[g.jsxs("header",{className:"modal-head",children:[g.jsxs("div",{className:"modal-title",children:[g.jsx("span",{className:`status-dot ${r}`}),g.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),g.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),g.jsxs("div",{className:"modal-actions",children:[g.jsx("span",{className:"modal-dur",children:IO(e)}),g.jsx("button",{className:"btn icon-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),g.jsxs("section",{className:"modal-body",children:[e.trimmed&&g.jsx("div",{className:"modal-section",children:g.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),g.jsxs("div",{className:"modal-section",children:[g.jsx("h4",{children:"Input"}),g.jsx("pre",{children:Tx(e.input??e.inputPreview)})]}),g.jsxs("div",{className:"modal-section",children:[g.jsxs("h4",{children:["Response ",r==="err"&&g.jsx("span",{className:"err-tag",children:"error"})]}),g.jsx("pre",{children:e.endedAt==null?"(waiting…)":Tx(e.response??e.errorPreview)})]})]})]})})}const Xl=18,Ax=26,PO=12;function OO(e){return LO(e.nodeInternals.values())}function LO(e){const n=new Map;for(const o of e){if(o.type!=="agent")continue;const l=o.data;if(!(l!=null&&l.sessionId)||l.exitAt!=null||o.width==null||o.height==null)continue;const u=o.position.x,c=o.position.y,h=u+o.width,p=c+o.height,d=n.get(l.sessionId);d?(d.minX=Math.min(d.minX,u),d.minY=Math.min(d.minY,c),d.maxX=Math.max(d.maxX,h),d.maxY=Math.max(d.maxY,p),l.kind==="root"&&(d.label=Ix(l)??d.label)):n.set(l.sessionId,{minX:u,minY:c,maxX:h,maxY:p,label:Ix(l)??l.sessionId})}const r=new Map;for(const o of n.values())r.set(o.label,(r.get(o.label)??0)+1);const i=[];for(const[o,l]of n){const c=(r.get(l.label)??0)>1?`${l.label} · ${qO(o)}`:l.label;i.push({sessionId:o,label:c,x:l.minX-Xl,y:l.minY-Xl-Ax,w:l.maxX-l.minX+Xl*2,h:l.maxY-l.minY+Xl*2+Ax})}return i}function qO(e){const n=e.match(/[a-zA-Z0-9]{4}/);return n?n[0]:e.slice(0,4)}function Ix(e){if(e.kind==="root")return e.label}function $O(){const{x:e,y:n,zoom:r}=VN(),i=Oa(),o=Ke(OO,DO);if(o.length<=1)return null;const l=u=>{try{const c=i.getNodes().filter(h=>{const p=h.data;return(p==null?void 0:p.sessionId)===u});if(c.length===0)return;i.fitView({padding:.3,duration:500,nodes:c})}catch{}};return g.jsx("div",{className:"session-clusters",children:o.map(u=>{const c=Vv(u.sessionId),h={position:"absolute",left:u.x*r+e,top:u.y*r+n,width:u.w*r,height:u.h*r,"--session-hue":c},p={position:"absolute",left:u.x*r+e+16*r,top:(u.y-PO)*r+n,transform:`scale(${Math.min(1,r)})`,transformOrigin:"left top","--session-hue":c};return g.jsxs(ue.Fragment,{children:[g.jsx("div",{className:"cluster-card",style:h,"aria-hidden":!0}),g.jsx("button",{type:"button",className:"cluster-label",style:p,title:`Fit view to ${u.label} · drag the wrapper to move the whole session`,onClick:()=>l(u.sessionId),children:u.label})]},u.sessionId)})})}function DO(e,n){if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++){const i=e[r],o=n[r];if(i.sessionId!==o.sessionId||i.label!==o.label||i.x!==o.x||i.y!==o.y||i.w!==o.w||i.h!==o.h)return!1}return!0}function FO({data:e}){return g.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}const iC=600,zO=4,BO=36,_v=16,UO=60,HO=6,Mx=220,Px=96,WO=28,VO={Read:"file",Write:"file",Edit:"file",MultiEdit:"file",Glob:"file",Grep:"file",LS:"file",NotebookEdit:"file",Bash:"shell",PowerShell:"shell",shell:"shell",exec_command:"shell",shell_command:"shell",write_stdin:"shell",wait:"shell",apply_patch:"file",update_plan:"task",WebFetch:"web",WebSearch:"web",Task:"agent",Agent:"agent",TodoWrite:"task",TaskCreate:"task",TaskUpdate:"task",TaskList:"task",TaskGet:"task",TaskOutput:"task",TaskStop:"task",EnterPlanMode:"plan",ExitPlanMode:"plan",AskUserQuestion:"plan",Skill:"plan",Workflow:"plan",ScheduleWakeup:"other",CronCreate:"other",CronList:"other",CronDelete:"other",Monitor:"other",PushNotification:"other",RemoteTrigger:"other",ToolSearch:"other"};function GO(e){return e.startsWith("mcp__")?"mcp":VO[e]??"other"}const YO={Read:"📖",Write:"💾",Edit:"✏️",MultiEdit:"🔧",Glob:"🗺️",Grep:"🔎",Bash:"⚡",PowerShell:"💻",shell:"⚡",exec_command:"⚡",shell_command:"⚡",write_stdin:"💻",wait:"⏳",apply_patch:"🩹",update_plan:"📋",LS:"📂",Task:"🤖",Agent:"🤖",TodoWrite:"📋",TaskCreate:"📋",TaskUpdate:"📝",TaskList:"🗂️",TaskGet:"🗂️",TaskOutput:"📤",TaskStop:"🛑",WebFetch:"🌐",WebSearch:"🔭",ToolSearch:"🧰",NotebookEdit:"📓",EnterPlanMode:"🧭",ExitPlanMode:"🏁",AskUserQuestion:"❓",ScheduleWakeup:"⏰",CronCreate:"⏰",CronList:"📅",CronDelete:"🗑️",Skill:"🎯",Workflow:"🎬",Monitor:"📡",PushNotification:"🔔",RemoteTrigger:"📡"};function Ox(e){return e.startsWith("mcp__")?"🔌":YO[e]??"✨"}const KO={git:"🐙",gh:"🐙",glab:"🐙",npm:"📦",pnpm:"📦",yarn:"📦",bun:"📦",brew:"🍺",node:"🟢",deno:"🟢",python:"🐍",python3:"🐍",py:"🐍",pip:"🐍",pip3:"🐍",uv:"🐍",ruby:"💎",bundle:"💎",gem:"💎",cargo:"🦀",rustc:"🦀",rustup:"🦀",go:"🐹",docker:"🐳","docker-compose":"🐳",podman:"🐳",kubectl:"☸️",helm:"☸️",k9s:"☸️",grep:"🔎",rg:"🔎",ag:"🔎",ack:"🔎",find:"🔍",fd:"🔍",locate:"🔍",which:"🔍",ls:"📂",dir:"📂",tree:"📂",cat:"📄",head:"📄",tail:"📄",less:"📄",more:"📄",bat:"📄",cp:"📋",mv:"✂️",rm:"🗑️",rmdir:"🗑️",mkdir:"📁",touch:"📁",sed:"✏️",awk:"✏️",tr:"✏️",curl:"🌐",wget:"🌐",http:"🌐",httpie:"🌐",ssh:"🔐",scp:"🔐",rsync:"🔐",ping:"📡",make:"🔨",cmake:"🔨",ninja:"🔨",bazel:"🔨",just:"🔨",terraform:"🏗️",ansible:"📕",pulumi:"🏗️",ps:"📊",top:"📊",htop:"📊",btm:"📊",kill:"💀",pkill:"💀",systemctl:"⚙️",service:"⚙️",tar:"🗜️",zip:"🗜️",unzip:"🗜️",gzip:"🗜️","7z":"🗜️",vim:"📝",nvim:"📝",nano:"📝",emacs:"📝",code:"📝",jq:"🪺",yq:"🪺",echo:"💬",printf:"💬",ffmpeg:"🎞️",ffprobe:"🎞️",imagemagick:"🖼️",convert:"🖼️","Get-ChildItem":"📂","Get-Content":"📄","Set-Content":"💾","Out-File":"💾","Add-Content":"💾","Set-Location":"📍","Get-Location":"📍","Get-Process":"📊","Start-Process":"▶️","Stop-Process":"💀","Invoke-WebRequest":"🌐","Invoke-RestMethod":"🌐","New-Item":"📁","Remove-Item":"🗑️","Copy-Item":"📋","Move-Item":"✂️","Test-Path":"🔍","Where-Object":"🔎","ForEach-Object":"🔁","Select-Object":"🎯","Measure-Object":"📊","Get-Service":"⚙️","Restart-Service":"⚙️","ConvertTo-Json":"🪺","ConvertFrom-Json":"🪺"};function oC(e){if(!e)return null;let n=e.trim();if(!n)return null;const r=n.match(/^(?:bash|sh|zsh|fish|powershell|pwsh)(?:\.exe)?\s+(?:-c|-Command|-NoProfile|-NonInteractive|\s)+["']([^"']+)["']/i);if(r)return oC(r[1]);for(;;){const l=n.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!l)break;n=n.slice(l[0].length)}n=n.replace(/^sudo(?:\s+-\S+)*\s+/,""),n=n.replace(/^(?:time|nohup|xargs)\s+/,"");const i=n.match(/^([^\s|;&<>(]+)/);if(!i)return null;let o=i[1];return o=o.replace(/^.*[/\\]/,""),o=o.replace(/\.(exe|cmd|bat|ps1)$/i,""),o||null}function XO(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const n=e;if(typeof n.cmd=="string")return n.cmd;if(typeof n.command=="string")return n.command;if(Array.isArray(n.command)&&n.command.every(r=>typeof r=="string")){const r=n.command;if(/powershell|cmd|bash|sh(\.exe)?$/i.test(r[0]??"")){const i=r.findIndex(o=>/^(-Command|-c)$/i.test(o));if(i>=0&&i+1<r.length)return r[i+1]}return r.join(" ")}return typeof n.script=="string"?n.script:null}const QO=new Set(["Bash","PowerShell","shell","exec_command","shell_command","write_stdin","wait"]),ZO=new Set(["shell","exec_command","shell_command","write_stdin","wait","apply_patch","update_plan"]);function JO(e,n){return ZO.has(e)||e.startsWith("mcp__")?Math.max(Px,34+n.length*7.5):Px}function e3(e,n){if(!QO.has(e))return null;const r=XO(n);if(!r)return null;const i=oC(r);return i?{emoji:KO[i]??"⚙️",label:i,category:"shell",detail:r}:null}const t3=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),Lx={ts:"🟦",tsx:"🟦",d:"🟦",js:"🟨",jsx:"🟨",mjs:"🟨",cjs:"🟨",py:"🐍",pyi:"🐍",ipynb:"📓",rs:"🦀",go:"🐹",rb:"💎",erb:"💎",java:"☕",kt:"☕",scala:"☕",gradle:"☕",cs:"🔷",fs:"🔷",php:"🐘",swift:"🦅",c:"🇨",cpp:"🇨",cc:"🇨",h:"🇨",hpp:"🇨",md:"📝",mdx:"📝",rst:"📝",json:"🪺",json5:"🪺",jsonl:"🪺",yaml:"⚙️",yml:"⚙️",toml:"⚙️",ini:"⚙️",conf:"⚙️",cfg:"⚙️",xml:"📰",html:"🌐",htm:"🌐",vue:"🌐",svelte:"🌐",css:"🎨",scss:"🎨",sass:"🎨",less:"🎨",sh:"⚡",bash:"⚡",zsh:"⚡",fish:"⚡",ps1:"⚡",txt:"📄",log:"📄",out:"📄",csv:"📊",tsv:"📊",xlsx:"📊",xls:"📊",pdf:"📕",png:"🖼️",jpg:"🖼️",jpeg:"🖼️",gif:"🖼️",webp:"🖼️",svg:"🖼️",ico:"🖼️",mp4:"🎬",mov:"🎬",avi:"🎬",mkv:"🎬",webm:"🎬",mp3:"🎵",wav:"🎵",ogg:"🎵",flac:"🎵",zip:"🗜️",tar:"🗜️",gz:"🗜️",bz2:"🗜️","7z":"🗜️",xz:"🗜️",rar:"🗜️",env:"🔐",lock:"🔐",pem:"🔐",key:"🔐",crt:"🔐",sql:"🗄️",db:"🗄️",sqlite:"🗄️",parquet:"🗄️"},qx={dockerfile:"🐳",makefile:"🔨",rakefile:"💎","package.json":"📦","pnpm-lock.yaml":"📦","yarn.lock":"📦","cargo.toml":"🦀","cargo.lock":"🦀","go.mod":"🐹","go.sum":"🐹","pyproject.toml":"🐍","requirements.txt":"🐍","readme.md":"📖",readme:"📖",license:"📜",".gitignore":"🐙",".gitattributes":"🐙",".env":"🔐",".dockerignore":"🐳"};function n3(e){const r=e.replace(/\\/g,"/").replace(/\/+$/,""),i=r.lastIndexOf("/");return i>=0?r.slice(i+1):r}function r3(e){const n=e.toLowerCase();if(qx[n])return qx[n];if(n.startsWith("dockerfile."))return"🐳";if(/\.(test|spec)\.[a-z]+$/.test(n))return"🧪";const r=n.lastIndexOf(".");if(r>0&&r<n.length-1){const i=n.slice(r+1);if(Lx[i])return Lx[i]}return"📄"}function s3(e,n){if(!n||typeof n!="object")return null;const r=n;if(e==="apply_patch"&&typeof r.patch=="string"){const i=r.patch.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/m);return i?i[1].trim():null}return typeof r.file_path=="string"?r.file_path:typeof r.notebook_path=="string"?r.notebook_path:typeof r.path=="string"?r.path:e==="Glob"&&typeof r.pattern=="string"?r.pattern:null}function i3(e,n){if(!t3.has(e))return null;const r=s3(e,n);if(!r)return null;const i=n3(r);return i?{emoji:e==="LS"?"📂":r3(i),label:i,category:"file",detail:r}:null}const aC={github:{emoji:"🐙",name:"GitHub"},git:{emoji:"🐙",name:"Git"},gitlab:{emoji:"🦊",name:"GitLab"},slack:{emoji:"💬",name:"Slack"},discord:{emoji:"💬",name:"Discord"},linear:{emoji:"📐",name:"Linear"},jira:{emoji:"🅹",name:"Jira"},atlassian:{emoji:"🅰️",name:"Atlassian"},notion:{emoji:"📓",name:"Notion"},asana:{emoji:"📋",name:"Asana"},intercom:{emoji:"💬",name:"Intercom"},figma:{emoji:"🎨",name:"Figma"},gmail:{emoji:"📧",name:"Gmail"},calendar:{emoji:"📅",name:"Calendar"},drive:{emoji:"☁️",name:"Drive"},zoom:{emoji:"📹",name:"Zoom"},spotify:{emoji:"🎵",name:"Spotify"},youtube:{emoji:"📺",name:"YouTube"},ccd_session:{emoji:"📡",name:"Session"},ccd_directory:{emoji:"📂",name:"Directory"},ccd_session_mgmt:{emoji:"📡",name:"Sessions"},mcp_registry:{emoji:"🧰",name:"Registry"},"computer-use":{emoji:"🖱️",name:"Computer"},"claude-in-chrome":{emoji:"🌐",name:"Chrome"},"claude-preview":{emoji:"👀",name:"Preview"},"scheduled-tasks":{emoji:"⏰",name:"Scheduler"},visualize:{emoji:"🎨",name:"Visualize"},"plugin-design-asana":{emoji:"📋",name:"Asana"},"plugin-design-atlassian":{emoji:"🅰️",name:"Atlassian"},"plugin-design-figma":{emoji:"🎨",name:"Figma"},"plugin-design-intercom":{emoji:"💬",name:"Intercom"},"plugin-design-linear":{emoji:"📐",name:"Linear"},"plugin-design-notion":{emoji:"📓",name:"Notion"},"plugin-design-slack":{emoji:"💬",name:"Slack"}};function lC(e){if(!e.startsWith("mcp__"))return null;const n=e.slice(5),r=n.indexOf("__");return r<=0?{server:n,method:""}:{server:n.slice(0,r),method:n.slice(r+2)}}function o3(e){let n=5381;for(let r=0;r<e.length;r++)n=(n<<5)+n^e.charCodeAt(r);return Math.abs(n)%360}function a3(e,n){const r=lC(e);if(!r)return null;const{server:i,method:o}=r;if(!o)return null;const l=aC[i.toLowerCase()];return{emoji:(l==null?void 0:l.emoji)??"🔌",label:o,category:"mcp",detail:l?`${l.name} · ${o}`:`${i} · ${o}`}}function l3(e,n){return e3(e,n)??i3(e,n)??a3(e)}const u3={shell:"Shell",exec_command:"Shell",shell_command:"Shell",write_stdin:"stdin",wait:"wait",apply_patch:"Edit",update_plan:"Plan"};function c3(e){const n=lC(e);if(n){const i=aC[n.server.toLowerCase()];return i?{emoji:i.emoji,label:i.name}:{emoji:"🔌",label:n.server,hue:o3(n.server)}}const r=u3[e];return r?{emoji:Ox(e),label:r}:{emoji:Ox(e),label:e}}function d3(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function f3(e,n,r){if(r==null)return 1;const i=n-r;return i<0?1:Math.max(0,1-i/iC)}function h3(e,n){const r=[],i=new Set;for(let o=e.length-1;o>=0&&r.length<n;o--){const l=e[o];i.has(l.id)||(i.add(l.id),r.push(l))}return r.reverse()}function p3(e,n,r,i,o,l){const u=[];for(const c of e.values()){if(!n.has(c.id)||c.exitAt!=null&&l-c.exitAt>iC)continue;const h=i.get(c.id)??r.get(c.id);if(!h)continue;const p=h3(c.tools,zO);if(p.length===0)continue;const d=c.exitAt??null,m=o.get(c.id),y=Math.max((m==null?void 0:m.width)??Mx,Mx),w=(m==null?void 0:m.height)??130,N=h.x,_=h.y,S=N+y,b=_+w/2;p.forEach((k,E)=>{const C=E*BO,A=N+y+UO,M=_+HO+C,L=f3(k,l,d),H=k.inputPreview??"",O=d3(k),P=L<.999,F=c3(k.name);u.push({id:`${c.id}::${k.id}`,toolId:k.id,agentId:c.id,toolName:k.name,name:F.label,emoji:F.emoji,status:O,category:GO(k.name),mcpHue:F.hue,inputPreview:H,fade:L,fading:P,worldX:A,worldY:M,anchorX:S,anchorY:b,spawnDx:S-A,spawnDy:b-(M+_v)});const G=l3(k.name,k.input);if(G){const q=JO(k.name,F.label),R=A+q+WO,Q=M,z=A+q,ne=M+_v;u.push({id:`sub:${c.id}::${k.id}`,toolId:k.id,agentId:c.id,toolName:k.name,name:G.label,emoji:G.emoji,isSub:!0,status:O,category:G.category,inputPreview:G.detail??H,fade:L,fading:P,worldX:R,worldY:Q,anchorX:z,anchorY:ne,spawnDx:z-R,spawnDy:0})}})}return u}function m3({agents:e,visibleAgentIds:n,positions:r,pinned:i,measured:o,dimUnmatched:l,spotlight:u,hiddenCategories:c,now:h,onOpenTool:p}){const d=p3(e,n,r,i,o,h),m=c&&c.size>0?d.filter(y=>!c.has(y.category)):d;return g.jsx(g3,{bursts:m,dimUnmatched:l,spotlight:u,onOpenTool:p})}function g3({bursts:e,dimUnmatched:n,spotlight:r,onOpenTool:i}){const{x:o,y:l,zoom:u}=VN();return g.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[g.jsx("svg",{className:"tool-bursts-svg",children:e.map(c=>{const h=c.anchorX*u+o,p=c.anchorY*u+l,d=(c.worldX+6)*u+o,m=(c.worldY+_v)*u+l,y=h+(d-h)*.55,w=n!=null&&!n.has(c.agentId),N=r!=null&&!r.has(c.agentId),_=c.fade*(w||N?.14:1);return g.jsx("path",{d:`M ${h} ${p} Q ${y} ${p}, ${d} ${m}`,className:`tool-conn status-${c.status}${c.fading?" fading":""}`,opacity:_},`l:${c.id}`)})}),e.map(c=>{const h=c.worldX*u+o,p=c.worldY*u+l,d={left:`${h}px`,top:`${p}px`,transform:`scale(${u})`,transformOrigin:"left top","--spawn-dx":`${c.spawnDx}px`,"--spawn-dy":`${c.spawnDy}px`},m=c.isSub?`${c.toolName} · ${c.name}`:c.toolName,y=c.inputPreview?`${m} · ${c.inputPreview}`:m,w=i!=null,N=c.mcpHue!=null?{"--mcp-hue":c.mcpHue}:{},_=n!=null&&!n.has(c.agentId),S=r!=null&&!r.has(c.agentId),b=_||S?" dim":"";return g.jsx("div",{className:"tool-burst-wrap",style:d,children:g.jsxs("div",{className:`tool-burst cat-${c.category}${c.mcpHue!=null?" mcp-hue":""} status-${c.status}${c.fading?" fading":""}${w?" clickable":""}${c.isSub?" sub":""}${b}`,style:N,title:y,role:w?"button":void 0,tabIndex:w?0:void 0,"aria-label":w?`Open ${c.toolName} ${c.status==="inflight"?"in flight":c.status} — click for details`:void 0,onClick:w?()=>i(c.toolId):void 0,onKeyDown:w?k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),i(c.toolId))}:void 0,children:[g.jsx("span",{className:"tb-emoji",children:c.emoji}),g.jsx("span",{className:"tb-name",children:c.name}),c.status==="inflight"&&g.jsx("span",{className:"tb-spin"}),c.status==="done"&&g.jsx("span",{className:"tb-mark done",children:"✓"}),c.status==="err"&&g.jsx("span",{className:"tb-mark err",children:"×"})]})},c.id)})]})}function v3({state:e,sessionId:n,onClose:r}){const i=T.useMemo(()=>w3(e,n),[e,n]),o=T.useRef(null);return vo(r,{focusRef:o}),i?g.jsx("div",{className:"modal-backdrop",onClick:r,role:"presentation",children:g.jsxs("div",{className:"modal session-summary",onClick:l=>l.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[g.jsxs("div",{className:"modal-head",children:[g.jsxs("div",{className:"modal-title",children:[g.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),g.jsx("span",{id:"ss-title",className:"modal-tool-name",title:i.cwd??i.sessionId,children:i.label}),g.jsxs("span",{className:"modal-tool-id",children:["· ",i.sessionId.slice(0,8)]})]}),g.jsxs("div",{className:"modal-actions",children:[g.jsx("span",{className:"modal-dur",title:"Total wall time",children:i.durationLabel}),g.jsx("button",{type:"button",ref:o,className:"btn",onClick:r,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),g.jsxs("div",{className:"modal-body",children:[g.jsxs("section",{className:"ss-hero",children:[g.jsxs("div",{className:"ss-hero-left",children:[g.jsx("div",{className:"ss-cost-label",children:"total spend"}),g.jsx("div",{className:"ss-cost",children:Fe(i.cost.total)}),i.modelChips.length>0&&g.jsx("div",{className:"ss-models",children:i.modelChips.map(l=>g.jsx("span",{className:"model-chip",title:l,children:li(l)},l))})]}),g.jsx("div",{className:"ss-hero-right",children:i.cost.total>0&&g.jsxs(g.Fragment,{children:[g.jsx(y3,{cost:i.cost}),g.jsxs("div",{className:"ss-cost-legend",children:[g.jsxs("span",{className:"ssl ssl-in",children:["input ",g.jsx("b",{children:Fe(i.cost.input)})]}),g.jsxs("span",{className:"ssl ssl-out",children:["output ",g.jsx("b",{children:Fe(i.cost.output)})]}),g.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",g.jsx("b",{children:Fe(i.cost.cacheRead)})]}),g.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",g.jsx("b",{children:Fe(i.cost.cacheWrite)})]})]})]})})]}),g.jsxs("section",{className:"ss-stats",children:[g.jsx(to,{label:"agents",value:i.agentCount}),g.jsx(to,{label:"subagents",value:i.subagentCount}),g.jsx(to,{label:"tool calls",value:i.toolCount}),g.jsx(to,{label:"prompts",value:i.promptCount}),g.jsx(to,{label:"tokens",value:i.tokensSum.toLocaleString()}),i.errCount>0&&g.jsx(to,{label:"errors",value:i.errCount,tone:"err"})]}),i.topTools.length>0&&g.jsxs("section",{className:"modal-section",children:[g.jsx("h4",{children:"Most-used tools"}),g.jsx("div",{className:"ss-top-tools",children:i.topTools.map(([l,u])=>g.jsxs("div",{className:"ss-tt",children:[g.jsx("span",{className:"ss-tt-name",children:l}),g.jsx("span",{className:"ss-tt-bar",children:g.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${u/i.topTools[0][1]*100}%`}})}),g.jsx("span",{className:"ss-tt-count",children:u})]},l))})]}),i.firstPrompt&&g.jsxs("section",{className:"modal-section",children:[g.jsx("h4",{children:"Opening prompt"}),g.jsx("div",{className:"ss-prompt",children:i.firstPrompt})]})]})]})}):null}function to({label:e,value:n,tone:r}){return g.jsxs("div",{className:`ss-stat${r?` tone-${r}`:""}`,children:[g.jsx("div",{className:"ss-stat-value",children:n}),g.jsx("div",{className:"ss-stat-label",children:e})]})}function y3({cost:e}){const n=e.total;if(n<=0)return null;const r=(i,o,l)=>{if(i<=0)return null;const u=i/n*100;return g.jsx("span",{className:`cb-seg ${o}`,style:{width:`${u}%`},title:`${l}: ${Fe(i)} (${u.toFixed(0)}%)`},o)};return g.jsxs("div",{className:"cost-bar cost-bar-lg","aria-label":"Cost breakdown",children:[r(e.input,"cb-input","input"),r(e.output,"cb-output","output"),r(e.cacheRead,"cb-cache-r","cache read"),r(e.cacheWrite,"cb-cache-w","cache write")]})}function w3(e,n){const r=e.agents.get(n);if(!r)return null;const i=[];for(const E of e.agents.values())E.sessionId===n&&i.push(E);if(i.length===0)return null;const o={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},l=new Set,u=new Map;let c=0,h=0,p=0,d=0,m=0,y,w=1/0,N=0;for(const E of i){const C=fn(E.usage,E.model);o.input+=C.input,o.output+=C.output,o.cacheRead+=C.cacheRead,o.cacheWrite+=C.cacheWrite,o.total+=C.total,E.model&&l.add(E.model),E.kind==="subagent"&&m++,h+=E.prompts.length,!y&&E.prompts.length>0&&(y=E.prompts[0].text),p+=E.usage.inputTokens+E.usage.outputTokens,c+=E.toolCount,w=Math.min(w,E.startedAt),N=Math.max(N,E.endedAt??Date.now());for(const A of E.tools)u.set(A.name,(u.get(A.name)??0)+1),A.ok===!1&&d++}const _=Math.max(0,N-w),S=Math.floor(_/1e3),b=S<60?`${S}s`:S<3600?`${Math.floor(S/60)}m ${String(S%60).padStart(2,"0")}s`:`${Math.floor(S/3600)}h ${Math.floor(S%3600/60)}m`,k=Array.from(u.entries()).sort((E,C)=>C[1]-E[1]).slice(0,5);return{sessionId:n,label:r.label||r.cwdBasename||"session",cwd:r.cwd,durationLabel:b,cost:o,modelChips:Array.from(l),agentCount:i.length,subagentCount:m,toolCount:c,promptCount:h,tokensSum:p,errCount:d,topTools:k,firstPrompt:y}}function $x(e){return e.waiting?e.waiting.kind==="permission"?0:1:e.state==="active"?2:3}function x3(e,n){const r=[];for(const i of e.agents.values()){if(i.kind!=="root")continue;let o=i.toolCount,l=fn(i.usage,i.model).total,u=i.endedAt??i.startedAt;for(const c of e.agents.values()){if(c.sessionId!==i.sessionId||c.kind==="root")continue;o+=c.toolCount,l+=fn(c.usage,c.model).total;const h=c.endedAt??c.startedAt;h>u&&(u=h)}r.push({sessionId:i.sessionId,label:i.label||i.cwdBasename||"session",cwdBasename:i.cwdBasename,state:i.state,waiting:i.waiting,modelId:i.model,toolCount:o,cost:l,startedAt:i.startedAt,lastActivity:u})}return r.sort((i,o)=>{const l=$x(i),u=$x(o);return l!==u?l-u:i.waiting&&o.waiting?i.waiting.since-o.waiting.since:o.lastActivity-i.lastActivity}),r}function Dx(e,n,r){const i=(n??r)-e;if(i<1e3)return"<1s";const o=Math.floor(i/1e3);if(o<60)return`${o}s`;const l=Math.floor(o/60);return l<60?`${l}m`:`${Math.floor(l/60)}h ${l%60}m`}function _3({state:e,now:n,selectedIds:r,onSelect:i,onClose:o}){const l=T.useMemo(()=>x3(e),[e,e.lastSeq,n]),u=l.filter(h=>h.state==="active").length,c=l.filter(h=>{var p;return((p=h.waiting)==null?void 0:p.kind)==="permission"}).length;return g.jsxs("aside",{className:"session-list","aria-label":"Sessions",children:[g.jsxs("div",{className:"sl-header",children:[g.jsxs("h3",{children:["Sessions ",g.jsx("span",{className:"sl-count",children:l.length})]}),c>0&&g.jsxs("span",{className:"sl-waiting-count",children:[c," waiting"]}),u>0&&g.jsxs("span",{className:"sl-live-count",children:[u," live"]}),g.jsx("button",{className:"btn icon-btn sl-close",onClick:o,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),g.jsxs("div",{className:"sl-rows",children:[l.length===0&&g.jsx("div",{className:"sl-empty",children:"No sessions yet."}),l.map(h=>{const p=r.has(h.sessionId);return g.jsxs("button",{type:"button",className:`sl-row state-${h.state}${p?" selected":""}`,onClick:()=>i(h.sessionId),title:`Focus ${h.label}`,children:[g.jsx("span",{className:`sl-dot state-${h.state}`,"aria-hidden":!0}),g.jsxs("div",{className:"sl-row-body",children:[g.jsxs("div",{className:"sl-row-head",children:[g.jsx("span",{className:"sl-label",children:h.label}),h.modelId&&g.jsx("span",{className:"model-chip",title:h.modelId,children:li(h.modelId)})]}),g.jsxs("div",{className:"sl-row-meta",children:[g.jsxs("span",{title:"tool calls",children:[g.jsx("b",{children:h.toolCount})," tools"]}),h.cost>0&&g.jsx("span",{className:"sl-cost",title:"total spend",children:g.jsx("b",{children:Fe(h.cost)})}),h.waiting?g.jsxs("span",{className:"sl-waiting",title:`${ju(h.waiting)}
|
|
61
|
-
Blocked since ${new Date(h.waiting.since).toLocaleTimeString()} · started ${new Date(h.startedAt).toLocaleString()}`,children:["waiting ",Dx(h.waiting.since,void 0,n)]}):g.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(h.startedAt).toLocaleString()}`,children:Dx(h.startedAt,h.state==="active"?void 0:h.lastActivity,n)})]})]})]},h.sessionId)})]})]})}const zt="ccdeck";function Ft(e){return e<1e3?`${e}`:e<1e6?`${(e/1e3).toFixed(1)}k`:e<1e9?`${(e/1e6).toFixed(2)}M`:`${(e/1e9).toFixed(2)}B`}function Fx(e,n){if(!e)return null;const r=n-Math.floor(e/1e3);return r<10?"just now":r<60?`${r}s ago`:r<3600?`${Math.floor(r/60)}m ago`:`${Math.floor(r/3600)}h ago`}function b3(e){return e==="claude-swap"?"Read from claude-swap's last collection — costs no request against your usage-endpoint budget":e==="api"?"Fetched from Anthropic's usage endpoint, at most once every 5 minutes":e==="cli"?"Parsed from `claude /usage`, at most once every 5 minutes":"Last update"}function S3({cost:e}){const n=e.total;if(n<=0)return null;const r=(i,o,l)=>{if(i<=0)return null;const u=i/n*100;return g.jsx("span",{className:`cb-seg ${o}`,style:{width:`${u}%`},title:`${l}: ${Fe(i)} (${u.toFixed(0)}%)`},o)};return g.jsxs("div",{className:"cost-bar","aria-label":"Cost breakdown",children:[r(e.input,"cb-input","input"),r(e.output,"cb-output","output"),r(e.cacheRead,"cb-cache-r","cache read"),r(e.cacheWrite,"cb-cache-w","cache write")]})}function k3(e,n){const r=e-n;if(r<=0)return null;const i=Math.floor(r/3600),o=Math.floor(r%3600/60);if(i>23){const l=Math.floor(r/86400),u=Math.floor(r%86400/3600);return`${l}d ${u}h`}return i>0?`${i}h ${o}m`:`${o}m`}function E3(e,n,r,i){const o=Math.max(0,n-i),l=Math.max(0,r-o);if(l<120)return null;const u=Math.min(100,l/r*100),c=e-u;if(Math.abs(c)<3)return{label:"on pace",color:"var(--ok)",expectedPct:u,isDeficit:!1};if(c>0){const h=100-e,p=l>0?e/l:0,d=p>0?h/p:1/0,m={label:`${Math.round(c)}% ahead`,color:"var(--warn)",expectedPct:u,isDeficit:!0};if(d<o&&d<86400){const y=Math.floor(d/3600),w=Math.floor(d%3600/60);m.runsOutIn=y>0?`${y}h ${w}m`:`${w}m`}return m}return{label:`${Math.round(-c)}% reserve`,color:"var(--ok)",expectedPct:u,isDeficit:!1}}function ei({pct:e,label:n,reset:r,resetAt:i,windowSec:o,limitReached:l,nowSec:u}){const c=Math.min(100,Math.max(0,e)),p=l||c>=90?"var(--err)":c>=70?"var(--warn)":"var(--accent)",d=c===0?"< 1%":`${c}%`,m=c===0?2:c,y=i?k3(i,u):null,w=i&&o?E3(c,i,o,u):null;return g.jsxs("div",{className:"qb-row",children:[g.jsxs("div",{className:"qb-meta",children:[g.jsxs("span",{className:"qb-label",children:[n,l&&g.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),g.jsx("span",{className:"qb-pct",style:{color:p},children:d})]}),g.jsxs("div",{className:"qb-track",children:[g.jsx("div",{className:"qb-fill",style:{width:`${m}%`,background:p,opacity:c===0?.4:1}}),w&&g.jsx("div",{className:"qb-pace-marker",style:{left:`${w.expectedPct}%`,background:w.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(w.expectedPct)}% by now`})]}),g.jsxs("div",{className:"qb-reset-row",children:[y?g.jsxs("span",{className:"qb-reset",children:["resets in ",y]}):r?g.jsxs("span",{className:"qb-reset",children:["resets ",r]}):null,w&&g.jsx("span",{className:"qb-pace",style:{color:w.color},children:w.runsOutIn?`runs out in ${w.runsOutIn}`:w.label})]})]})}const N3=6e4;function C3(){const[e,n]=T.useState(null),[r,i]=T.useState(!1),o=T.useRef(null),l=async(c=!1)=>{c&&i(!0);try{const p=await fetch(c?"/api/quota?refresh=1":"/api/quota");p.ok&&n(await p.json())}catch{}finally{c&&i(!1)}};return T.useEffect(()=>(l(!0),o.current=window.setInterval(()=>l(!1),N3),()=>{o.current!=null&&window.clearInterval(o.current)}),[]),{quota:e,loading:r,refresh:()=>l(!0)}}function j3(e){switch(e){case"no_token":return"Run codex login to authenticate.";case"api_key_mode":return"API-key login — ChatGPT quota is only available for codex login.";case"refresh_rejected":return"Codex session expired — run codex login.";case"refresh_failed":return"Couldn't refresh the Codex token — click ↻ to retry.";default:return"ChatGPT API unreachable — click ↻ to retry."}}const uC=6e4;function R3(){const[e,n]=T.useState(null),[r,i]=T.useState(!1),o=T.useRef(null),l=async(c=!1)=>{c&&i(!0);try{const p=await fetch(c?"/api/codex-quota?refresh=1":"/api/codex-quota");p.ok&&n(await p.json())}catch{}finally{c&&i(!1)}};return T.useEffect(()=>(l(!0),o.current=window.setInterval(()=>l(!1),uC),()=>{o.current!=null&&window.clearInterval(o.current)}),[]),{data:e,loading:r,refresh:()=>l(!0)}}function T3(){const[e,n]=T.useState(null),r=T.useRef(null),i=async()=>{try{const o=await fetch("/api/codex-usage");o.ok&&n(await o.json())}catch{}};return T.useEffect(()=>(i(),r.current=window.setInterval(i,uC),()=>{r.current!=null&&window.clearInterval(r.current)}),[]),{data:e}}function A3({state:e,now:n,onClose:r}){var L,H;const{quota:i,loading:o,refresh:l}=C3(),{data:u,loading:c,refresh:h}=R3(),{data:p}=T3(),[d,m]=T.useState(()=>Math.floor(Date.now()/1e3));T.useEffect(()=>{const O=window.setInterval(()=>m(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(O)},[]);const{byModel:y,totalCost:w,totalTokens:N,burnRate:_}=T.useMemo(()=>{const O=new Map,P={total:0,input:0,output:0,cacheRead:0,cacheWrite:0};let F=0,G=0,q=0,R=0;for(const $ of e.agents.values()){const X=$.model??"__unknown__",I=fn($.usage,$.model),W=O.get(X);W?(W.inputTokens+=$.usage.inputTokens,W.outputTokens+=$.usage.outputTokens,W.cacheReadTokens+=$.usage.cacheReadTokens,W.cacheCreateTokens+=$.usage.cacheCreateTokens,W.cost.total+=I.total,W.cost.input+=I.input,W.cost.output+=I.output,W.cost.cacheRead+=I.cacheRead,W.cost.cacheWrite+=I.cacheWrite,W.agentCount++):O.set(X,{model:X,inputTokens:$.usage.inputTokens,outputTokens:$.usage.outputTokens,cacheReadTokens:$.usage.cacheReadTokens,cacheCreateTokens:$.usage.cacheCreateTokens,cost:{...I},agentCount:1}),P.total+=I.total,P.input+=I.input,P.output+=I.output,P.cacheRead+=I.cacheRead,P.cacheWrite+=I.cacheWrite,F+=$.usage.inputTokens,G+=$.usage.outputTokens,q+=$.usage.cacheReadTokens,R+=$.usage.cacheCreateTokens}const Q=Array.from(O.values()).sort(($,X)=>X.cost.total-$.cost.total);let z=0,ne=0;for(const $ of e.agents.values()){if($.state!=="active")continue;const X=fn($.usage,$.model);z+=X.total,ne=Math.max(ne,(($.endedAt??n)-$.startedAt)/1e3)}const Z=ne>0?yu(z,ne):null;return{byModel:Q,totalCost:P,totalTokens:{in:F,out:G,cacheR:q,cacheC:R},burnRate:Z}},[e,e.lastSeq,n]),S=T.useMemo(()=>{const O=[];for(const P of e.agents.values()){if(P.kind!=="root")continue;let F=fn(P.usage,P.model).total,G=P.usage.inputTokens,q=P.usage.outputTokens;for(const R of e.agents.values())R.sessionId!==P.sessionId||R.kind==="root"||(F+=fn(R.usage,R.model).total,G+=R.usage.inputTokens,q+=R.usage.outputTokens);O.push({sessionId:P.sessionId,label:P.label||P.cwdBasename||"session",state:P.state,cost:F,inputTokens:G,outputTokens:q})}return O.sort((P,F)=>F.cost-P.cost).slice(0,12)},[e,e.lastSeq]),b=w.total>0,k=N.in+N.out,E=o||c,C=Fx(i==null?void 0:i.fetchedAt,d),A=Fx(u==null?void 0:u.fetchedAt,d),M=()=>{l(),h()};return g.jsxs("div",{className:"usage-panel","aria-label":"Usage",children:[g.jsxs("div",{className:"up-header",children:[g.jsx("h3",{children:"Usage"}),_&&g.jsx("span",{className:"up-rate",children:_}),g.jsxs("div",{className:"up-header-right",children:[g.jsx("button",{type:"button",className:"btn up-refresh-btn",onClick:M,disabled:E,title:"Refresh Claude + Codex quota",children:E?"…":"↻"}),g.jsx("button",{type:"button",className:"btn icon-btn up-close",onClick:r,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),g.jsxs("section",{className:"up-section up-quota-section",children:[g.jsxs("h4",{className:"up-section-title",children:["Claude quota",C&&!o&&g.jsx("span",{className:"up-section-age",title:b3(i==null?void 0:i.source),children:C})]}),i!=null&&i.ok?g.jsxs("div",{className:"up-quota-bars",children:[i.session5hPct!=null&&g.jsx(ei,{label:"5-hour window",pct:i.session5hPct,reset:i.session5hReset,resetAt:i.session5hResetAt,windowSec:i.session5hWindowSec,nowSec:d}),i.week7dPct!=null&&g.jsx(ei,{label:"7-day window",pct:i.week7dPct,reset:i.week7dReset,resetAt:i.week7dResetAt,windowSec:i.week7dWindowSec,nowSec:d}),i.weekSonnetPct!=null&&g.jsx(ei,{label:"Sonnet (7d)",pct:i.weekSonnetPct,nowSec:d}),i.weekOpusPct!=null&&g.jsx(ei,{label:"Opus (7d)",pct:i.weekOpusPct,nowSec:d})]}):(i==null?void 0:i.ok)===!1?g.jsxs("div",{className:"up-quota-na",children:[g.jsx("span",{children:"Quota unavailable."}),g.jsxs("span",{className:"up-quota-hint",children:["Run ",g.jsx("code",{children:"/usage"})," in a claude session, then click ↻"]})]}):g.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),g.jsxs("section",{className:"up-section up-quota-section",children:[g.jsxs("h4",{className:"up-section-title",children:["Codex quota",(u==null?void 0:u.ok)&&u.planLabel&&g.jsx("span",{className:"up-plan-badge",children:u.planLabel}),A&&!c&&g.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:A})]}),u!=null&&u.ok?g.jsxs("div",{className:"up-quota-bars",children:[(L=u.windows)==null?void 0:L.map(O=>g.jsx(ei,{label:O.label,pct:O.pct,reset:O.reset??void 0,resetAt:O.resetAt??void 0,windowSec:O.windowSec??void 0,limitReached:u.limitReached&&O.pct>=100,nowSec:d},O.id)),(H=u.extraWindows)==null?void 0:H.map(O=>g.jsx(ei,{label:O.label,pct:O.pct,reset:O.reset??void 0,resetAt:O.resetAt??void 0,windowSec:O.windowSec??void 0,nowSec:d},O.id)),u.creditLimit&&g.jsx(ei,{label:`spend cap · $${Math.round(u.creditLimit.used)} of $${Math.round(u.creditLimit.limit)}`,pct:u.creditLimit.usedPct,reset:u.creditLimit.reset??void 0,resetAt:u.creditLimit.resetAt??void 0,limitReached:u.spendControlReached,nowSec:d}),(p==null?void 0:p.ok)&&p.window7d&&p.window7d.sessionCount>0&&g.jsxs("div",{className:"up-quota-sub",children:[Ft(p.window7d.totalTokens)," tokens · ",p.window7d.sessionCount," session",p.window7d.sessionCount!==1?"s":""," (7d)"]}),u.creditsBalance&&!u.creditsUnlimited&&g.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",u.creditsBalance,u.overageReached&&" · overage limit reached"]}),u.creditsUnlimited&&g.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),u.resetCredits&&u.resetCredits.availableCount>0&&g.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${zt} only reports them`,children:[u.resetCredits.availableCount," rate-limit reset",u.resetCredits.availableCount!==1?"s":""," available",u.resetCredits.nextExpiryAt&&` · expires ${new Date(u.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),u.promo&&g.jsx("div",{className:"up-quota-sub",children:u.promo}),u.partial&&g.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(u==null?void 0:u.ok)===!1?g.jsxs("div",{className:"up-quota-na",children:[g.jsx("span",{children:"Quota unavailable."}),g.jsx("span",{className:"up-quota-hint",children:j3(u.reason)})]}):g.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),b?g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"up-total",children:[g.jsx("span",{className:"up-total-value",children:Fe(w.total)}),g.jsx("span",{className:"up-total-label",children:"total spend"})]}),g.jsx(S3,{cost:w}),k>0&&g.jsxs("div",{className:"up-tokens-row",children:[g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"in"}),Ft(N.in)]}),g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"out"}),Ft(N.out)]}),N.cacheR>0&&g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"cache r"}),Ft(N.cacheR)]}),N.cacheC>0&&g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"cache c"}),Ft(N.cacheC)]})]}),y.filter(O=>O.cost.total>0).length>0&&g.jsxs("section",{className:"up-section",children:[g.jsx("h4",{className:"up-section-title",children:"By model"}),g.jsxs("table",{className:"up-table",children:[g.jsx("thead",{children:g.jsxs("tr",{children:[g.jsx("th",{children:"Model"}),g.jsx("th",{children:"Tokens"}),g.jsx("th",{children:"Cost"})]})}),g.jsx("tbody",{children:y.filter(O=>O.cost.total>0).map(O=>g.jsxs("tr",{children:[g.jsx("td",{className:"up-model-name",title:O.model,children:li(O.model)}),g.jsx("td",{className:"up-num",children:Ft(O.inputTokens+O.outputTokens)}),g.jsx("td",{className:"up-num up-cost-val",children:Fe(O.cost.total)})]},O.model))})]})]}),S.filter(O=>O.cost>0).length>0&&g.jsxs("section",{className:"up-section",children:[g.jsx("h4",{className:"up-section-title",children:"By session"}),g.jsx("div",{className:"up-sessions",children:S.filter(O=>O.cost>0).map(O=>g.jsxs("div",{className:"up-session-row",children:[g.jsx("span",{className:`sl-dot state-${O.state}`,"aria-hidden":!0}),g.jsx("span",{className:"up-session-label",children:O.label}),g.jsx("span",{className:"up-session-tokens",children:Ft(O.inputTokens+O.outputTokens)}),g.jsx("span",{className:"up-session-cost",children:Fe(O.cost)})]},O.sessionId))})]})]}):k>0?g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"up-tokens-row",children:[g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"in"}),Ft(N.in)]}),g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"out"}),Ft(N.out)]})]}),g.jsx("div",{className:"up-hint",children:"Cost appears once a known model is detected."})]}):g.jsxs("div",{className:"up-empty",children:["No usage data yet.",g.jsx("br",{}),"Start a Claude Code or Codex session."]})]})}const zx=18,I3=1100,no=(e,n)=>{const r=Math.sin(e*12.9898+n*78.233)*43758.5453;return r-Math.floor(r)},M3=Array.from({length:zx},(e,n)=>{const r=-72+144*n/(zx-1)+(no(n,1)-.5)*9,i=(r-90)*(Math.PI/180),o=(54+32*Math.cos(r*Math.PI/180))*(.74+no(n,2)*.52);return{dx:Math.cos(i)*o,dy:Math.sin(i)*o,rot:(n%2?1:-1)*(100+no(n,3)*260),delay:Math.round(no(n,4)*90),dur:760+Math.round(no(n,5)*260),scale:.8+no(n,6)*.45,hue:n%4,round:n%3===0}});function Bx({anchor:e,lifetimeMs:n=I3}){var l;const[r,i]=T.useState(null),o=typeof window<"u"&&((l=window.matchMedia)==null?void 0:l.call(window,"(prefers-reduced-motion: reduce)").matches);return T.useEffect(()=>{if(o)return;const u=e.current;if(!u)return;const c=u.getBoundingClientRect();i({x:c.left+c.width/2,y:c.top+c.height/2});const h=window.setTimeout(()=>i(null),n);return()=>window.clearTimeout(h)},[e,n,o]),o||!r?null:TI.createPortal(g.jsx("div",{className:"confetti",style:{left:`${r.x}px`,top:`${r.y}px`},"aria-hidden":!0,children:M3.map((u,c)=>g.jsx("span",{className:`confetti-bit${u.round?" round":""}`,"data-hue":u.hue,style:{"--dx":`${u.dx.toFixed(1)}px`,"--dy":`${u.dy.toFixed(1)}px`,"--rot":`${u.rot}deg`,"--s":u.scale.toFixed(2),animationDelay:`${u.delay}ms`,animationDuration:`${u.dur}ms, ${u.dur}ms`}},c))}),document.body)}const cC=new Set(["awaiting_url","awaiting_code","registering"]);function P3(e){return e!=null&&cC.has(e)}function dC(e){return e!=null&&e!=="done"&&!cC.has(e)}const O3="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",L3="the sign-in did not complete";function q3({state:e,serverError:n,localError:r}){const i=e==="idle";return{title:i?"Sign-in ended":"Sign-in failed",message:r||n||(i?O3:L3)}}const $3="done";function D3(){let e=!1;return{shouldAnnounce(n){return n!==$3?(e=!1,!1):e?!1:(e=!0,!0)}}}const Ux={already_running:"a sign-in is already in progress",no_url:"the claude CLI did not offer a sign-in link — is it installed?",not_waiting:"that sign-in is no longer waiting for a code",not_prompted:"the CLI has not asked for a code yet",code_rejected:"that code was not accepted — copy it again from the browser",no_verdict:"the claude CLI has not answered — try the code again",empty_code:"paste the code from the browser first",login_failed:"the code was not accepted",no_identity:"signed in, but the CLI still reports nobody logged in",add_failed:"signed in, but claude-swap could not record the account",not_a_share:"that does not look like a shared account — it should start with ccdeck1:",corrupt:"that share is incomplete — copy the whole thing",wrong_version:`that share was made by a newer ${zt}`,expired:"that share has expired — make a new one",import_failed:"claude-swap refused the import"},Hx={no_cswap:"claude-swap could not be run — it is not on this deck's PATH. Set AGENTS_DECK_CSWAP to its full path",timeout:"claude-swap took too long and was stopped — try again",switch_failed:"claude-swap refused the switch",bad_account:"that is not an account claude-swap has",unknown_setting:"claude-swap has no such setting",out_of_range:"that value is outside what the setting allows",bad_value:"claude-swap does not accept that value",set_failed:"claude-swap refused the change",command_failed:"claude-swap refused the command"},F3=`claude-swap could not read the login keychain — start ${zt} from a Terminal window rather than a background service`;function bv(e,n){return(e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(mo(e))?F3:e!=null&&e.reason&&Hx[e.reason]?Hx[e.reason]:(e==null?void 0:e.reason)||n}function mo(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const Wx={no_install:"ccusage is not installed, and AGENTS_DECK_NO_INSTALL=1 forbids fetching it — unset that variable and restart the deck, or install ccusage yourself",timeout:"ccusage took more than 90 seconds and was stopped — a narrower range usually finishes",bad_output:"ccusage ran but printed no usage data — try again, and run ccusage daily --json in a terminal if it keeps happening",run_failed:"ccusage could not report usage — try again",bad_range:"that date range is not a YYYYMMDD date — reopen the modal and pick one of the presets",unreachable:"the deck did not answer — check it is still running, then try again"},z3="ccusage could not be started — npx is not on this deck's PATH. Install Node's npm/npx, or put ccusage on PATH yourself";function B3(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}function U3(e,n){return B3(mo(e))?z3:e!=null&&e.reason&&Wx[e.reason]?Wx[e.reason]:(e==null?void 0:e.reason)||n}function au(e,n){return e!=null&&e.detail?e.detail:e!=null&&e.error&&dC(e.state)?e.error:e!=null&&e.reason&&Ux[e.reason]?Ux[e.reason]:e!=null&&e.error?e.error:(e==null?void 0:e.reason)||n}const H3=1500;async function Ql(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const Sv=ue.forwardRef((e,n)=>g.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:n,children:[g.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),g.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));Sv.displayName="SuccessMark";function W3({onClose:e,onChanged:n}){const[r,i]=T.useState("login"),[o,l]=T.useState(null),[u,c]=T.useState(""),[h,p]=T.useState(""),[d,m]=T.useState(!1),[y,w]=T.useState(null),[N,_]=T.useState(null),S=T.useRef(!1),b=T.useRef(null),k=T.useRef(null),E=T.useRef(null),C=T.useCallback(()=>{S.current&&Ql({action:"login-cancel"}).catch(()=>{}),e()},[e]);vo(C);const A=T.useCallback(async()=>{m(!0),w(null),S.current=!0;const q=await Ql({action:"login"}).catch(()=>null);if(m(!1),!(q!=null&&q.ok)){w(au(q,"could not start the sign-in"));return}l(q)},[]);T.useEffect(()=>{if(!P3(o==null?void 0:o.state))return;const q=window.setInterval(async()=>{try{const R=await fetch("/api/claude-accounts/login");R.ok&&l(await R.json())}catch{}},H3);return()=>window.clearInterval(q)},[o]);const M=T.useRef(n);M.current=n;const L=T.useRef(D3());T.useEffect(()=>{var q;(o==null?void 0:o.state)==="awaiting_code"&&((q=b.current)==null||q.focus()),L.current.shouldAnnounce(o==null?void 0:o.state)&&M.current()},[o==null?void 0:o.state]),T.useEffect(()=>{var q;r==="paste"&&((q=k.current)==null||q.focus())},[r]);const H=T.useCallback(async()=>{var R;m(!0),w(null);const q=await Ql({action:"login-code",code:u}).catch(()=>null);if(m(!1),!(q!=null&&q.ok)){w(au(q,"the code was not accepted")),q!=null&&q.state&&l(q),(R=b.current)==null||R.select();return}c(""),l(q)},[u,o]),O=T.useCallback(async()=>{m(!0),w(null);const q=await Ql({action:"import",blob:h}).catch(()=>null);if(m(!1),!(q!=null&&q.ok)){w(au(q,"the import failed"));return}p(""),_({added:q.added===!0,num:q.num??null,email:q.email??null}),n()},[h,n]),P=(o==null?void 0:o.state)==="done"?o.account:null,F=dC(o==null?void 0:o.state)||!!(y&&S.current&&!d),G=q3({state:o==null?void 0:o.state,serverError:o==null?void 0:o.error,localError:y});return g.jsx("div",{className:"modal-backdrop",onClick:C,role:"presentation",children:g.jsxs("div",{className:"modal aa-modal",onClick:q=>q.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[g.jsxs("header",{className:"modal-head",children:[g.jsx("div",{className:"modal-title",children:g.jsxs("span",{className:"aa-tabs",role:"tablist",children:[g.jsx("button",{type:"button",role:"tab","aria-selected":r==="login",className:`aa-tab${r==="login"?" on":""}`,onClick:()=>i("login"),children:"Sign in"}),g.jsx("button",{type:"button",role:"tab","aria-selected":r==="paste",className:`aa-tab${r==="paste"?" on":""}`,onClick:()=>i("paste"),children:"Paste a share"})]})}),g.jsx("div",{className:"modal-actions",children:g.jsx("button",{type:"button",className:"btn icon-btn",onClick:C,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),g.jsx("section",{className:"modal-body aa-body",children:r==="login"?P?g.jsxs("div",{className:"aa-done",children:[g.jsx(Sv,{ref:E}),g.jsx(Bx,{anchor:E}),g.jsx("h4",{children:P.added?`Account ${P.num} added`:"Credentials refreshed"}),g.jsxs("p",{className:"aa-note",children:[g.jsx("strong",{children:P.email}),P.added?" is in the rotation. The account you were using is still active.":" was already managed, so its stored credentials were replaced."]}),g.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"})]}):(o==null?void 0:o.state)==="awaiting_code"||(o==null?void 0:o.state)==="registering"?g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"aa-step",children:[g.jsx("h4",{children:"1 · Approve in the browser"}),g.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),g.jsx("a",{className:"aa-link",href:o.url??"#",target:"_blank",rel:"noreferrer noopener",children:o.url})]}),g.jsxs("div",{className:"aa-step",children:[g.jsx("h4",{children:"2 · Paste the code it gives you"}),g.jsxs("div",{className:"aa-field",children:[g.jsx("input",{ref:b,type:"text",value:u,onChange:q=>c(q.target.value),onKeyDown:q=>{q.key==="Enter"&&u.trim()&&!d&&H()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:o.state==="registering"}),g.jsx("button",{type:"button",className:"btn primary",disabled:d||!u.trim()||o.state==="registering",onClick:H,children:o.state==="registering"?"registering…":"Continue"})]}),(y||o.error)&&g.jsx("p",{className:"aa-err",children:y??o.error}),g.jsx("p",{className:"aa-note",children:"The code goes straight to the claude CLI on this machine. It is never stored or sent anywhere else."})]})]}):F?g.jsxs("div",{className:"aa-step",children:[g.jsx("h4",{children:G.title}),g.jsx("p",{className:"aa-err",children:G.message}),g.jsx("button",{type:"button",className:"btn",onClick:()=>{S.current=!1,l(null),w(null),A()},children:"Try again"})]}):d||S.current?g.jsx("div",{className:"aa-step",children:g.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):g.jsxs("div",{className:"aa-step aa-primer",children:[g.jsx("h4",{children:"Sign in to Anthropic"}),g.jsx("p",{className:"aa-note",children:"Opens a browser tab where you approve the sign-in, then asks for the code it shows you. claude-swap records the account when it completes, and the account you are using now stays active."}),g.jsx("div",{className:"aa-actions",children:g.jsx("button",{type:"button",className:"btn primary",onClick:A,disabled:d,children:"Open the sign-in page"})})]}):N?g.jsxs("div",{className:"aa-done",children:[g.jsx(Sv,{ref:E}),N.added&&g.jsx(Bx,{anchor:E}),g.jsx("h4",{children:N.added?`Account ${N.num} imported`:"Already here"}),g.jsx("p",{className:"aa-note",children:N.added?g.jsxs(g.Fragment,{children:[N.email?g.jsx("strong",{children:N.email}):"That account"," is in the rotation now. Nothing changed on the deck you copied it from."]}):"This deck already holds that account, so nothing changed."}),g.jsxs("div",{className:"aa-actions",children:[g.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"}),g.jsx("button",{type:"button",className:"btn",onClick:()=>_(null),children:"Import another"})]})]}):g.jsxs("div",{className:"aa-step",children:[g.jsx("h4",{children:"Paste an account shared from another deck"}),g.jsxs("div",{className:"aa-field",children:[g.jsx("input",{ref:k,type:"text",value:h,onChange:q=>p(q.target.value),onKeyDown:q=>{q.key==="Enter"&&h.trim()&&!d&&O()},placeholder:"ccdeck1:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),g.jsx("button",{type:"button",className:"btn primary",disabled:d||!h.trim(),onClick:O,children:d?"importing…":"Import"})]}),y&&g.jsx("p",{className:"aa-err",children:y}),g.jsxs("p",{className:"aa-note",children:["Use ",g.jsx("strong",{children:"share"})," on an account in the other deck. A share carries a live login and expires ten minutes after it is made."]})]})})]})})}function V3(e,n){const r=new Set(e),i=e.length?Math.max(...e):0;return[...new Set([...e,i+1])].sort((o,l)=>o-l).map(o=>{const l=o===n?"here":r.has(o)?"swap":"free";return{slot:o,kind:l,label:l==="here"?`slot ${o}`:`slot ${o} · ${l}`}})}function G3(e,n,r){if(!(r!=null&&r.ok))return null;const i=Number.isInteger(r.to)?r.to:null;if(i==null)return{menuFor:null,confirmRemove:null,shareFor:null,swapNote:null};const o=r.swapped===!0&&i!==n;return{menuFor:e.menuFor===n?i:o&&e.menuFor===i?n:e.menuFor,confirmRemove:null,shareFor:null,swapNote:o?{at:i,displaced:n}:null}}function Y3(e,n){const r=e.trim();return{alias:r,commit:r!==(n??"").trim()}}const K3=Object.freeze({text:"couldn't reach the deck server",reload:!0});async function Vx(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function X3(e){const n=e.find(i=>!i.ok);if(!n)return null;const r=mo(n.body);return{text:bv(n.body,`the deck server answered ${n.status}`),...r?{raw:r}:{},reload:!0}}function Gx(e,n){return n?e!=null&&e.reload&&e.text===n.text&&e.raw===n.raw?e:n:e!=null&&e.reload?null:e}const Yx=15e3,Q3=8e3,Z3=1800,J3=3e4,eL=[70,80,85,90,95];function tL(e,n){const r=e-n;if(r<=0)return null;const i=Math.floor(r/86400),o=Math.floor(r%86400/3600),l=Math.floor(r%3600/60);return i>0?`${i}d ${o}h`:o>0?`${o}h ${l}m`:`${l}m`}function Kx(e,n){const r=n-Math.floor(e/1e3);return r<60?"just now":r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:`${Math.floor(r/86400)}d ago`}function nL(e,n){if(!e)return"";const r=Math.floor(e/1e3)-n;return r<=0?" · due":r<60?` · next in ${r}s`:` · next in ${Math.round(r/60)}m`}function rL(e){switch(e){case"invalid_grant":case"no_refresh_token":return{text:"login expired",hint:"claude-swap's stored login for this account was rejected and cannot be refreshed. Signing in again replaces it — the account keeps its slot, its alias and its history.",fixable:!0};case"http-401":return{text:"re-login needed",hint:"Anthropic refused this account's token.",fixable:!0};case"http-429":return{text:"rate limited",hint:"Anthropic is throttling requests for this account. It clears on its own.",fixable:!1};case"transient":return{text:"temporary error",hint:"A network or server hiccup while reading usage. The next collection retries.",fixable:!1};case"timeout":return{text:"timed out",hint:"Reading this account's usage took too long. The next collection retries.",fixable:!1};case"network":return{text:"unreachable",hint:"Could not reach Anthropic to read this account's usage.",fixable:!1};default:return{text:e,hint:`claude-swap reported "${e}" for this account.`,fixable:!1}}}function sL({lane:e,nowSec:n}){const r=Math.min(100,Math.max(0,e.pct)),i=r>=90?"var(--err)":r>=70?"var(--warn)":"var(--accent)",o=e.resetAt?tL(e.resetAt,n):null;return g.jsxs("div",{className:"ap-lane",children:[g.jsx("span",{className:"ap-lane-label",children:e.label}),g.jsx("div",{className:"ap-lane-track",children:g.jsx("div",{className:"ap-lane-fill",style:{width:`${r===0?1.5:r}%`,background:i,opacity:r===0?.4:1}})}),g.jsxs("span",{className:"ap-lane-pct",style:{color:i},children:[r,"%"]}),g.jsx("span",{className:"ap-lane-reset",children:o?`resets ${o}`:""})]})}async function iL(e){var r;let n=!1;try{n=await Promise.race([((r=navigator.clipboard)==null?void 0:r.writeText(e).then(()=>!0))??Promise.resolve(!1),new Promise(i=>window.setTimeout(()=>i(!1),500))])}catch{n=!1}if(n)return!0;try{const i=document.createElement("textarea");i.value=e,i.setAttribute("readonly",""),i.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(i),i.select(),n=document.execCommand("copy"),i.remove()}catch{n=!1}return n}function oL(e,n){const r=Math.round(e/1e3)-n;return r<=0?{text:"expired",tone:"gone"}:r<60?{text:`expires in ${r}s`,tone:"soon"}:{text:`expires in ${Math.round(r/60)}m`,tone:"ok"}}function aL({onClose:e}){var re,le,fe;const[n,r]=T.useState(null),[i,o]=T.useState(null),[l,u]=T.useState(null),[c,h]=T.useState(!1),[p,d]=T.useState(null),[m,y]=T.useState(null),[w,N]=T.useState(()=>Math.floor(Date.now()/1e3)),_=T.useRef(null),[S,b]=T.useState(null),[k,E]=T.useState(!1),[C,A]=T.useState(""),[M,L]=T.useState(null),[H,O]=T.useState(null),[P,F]=T.useState(null),[G,q]=T.useState(!1),[R,Q]=T.useState(null),z=T.useCallback(async(te=!1)=>{te&&h(!0);const ce=new AbortController,Ce=window.setTimeout(()=>ce.abort(),J3);try{const[ve,Te]=await Promise.all([fetch(`/api/claude-accounts${te?"?refresh=1":""}`,{signal:ce.signal}),fetch("/api/cswap-auto",{signal:ce.signal})]);ve.ok&&r(await ve.json()),Te.ok&&o(await Te.json());const ye=X3([await Vx(ve),await Vx(Te)]);y(ke=>Gx(ke,ye))}catch{y(ve=>Gx(ve,K3))}finally{window.clearTimeout(Ce),te&&h(!1)}},[]),ne=T.useCallback(async(te,ce)=>{u(ce),y(null);try{const ve=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(te)})).json().catch(()=>null);return ve!=null&&ve.ok||y({text:bv(ve,"command failed"),raw:mo(ve)}),ve}catch{return y({text:"server unreachable"}),null}finally{u(null)}},[]),Z=T.useCallback(async(te,ce)=>{u(ce),y(null);try{const ve=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(te)})).json().catch(()=>null);return ve!=null&&ve.ok||y({text:au(ve,"command failed")}),ve}catch{return y({text:"server unreachable"}),null}finally{u(null)}},[]);T.useEffect(()=>(z(!0),_.current=window.setInterval(()=>z(!1),Yx),()=>{_.current!=null&&window.clearInterval(_.current)}),[z]),T.useEffect(()=>{const te=window.setInterval(()=>N(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(te)},[]);const $=((re=i==null?void 0:i.settings["autoswitch.threshold"])==null?void 0:re.value)??"90",X=(le=n==null?void 0:n.accounts)==null?void 0:le.find(te=>te.active),I=X!=null&&X.lanes.length?Math.max(...X.lanes.map(te=>te.pct)):null,W=I!=null&&I>=Number($)-15,Y=async te=>{d(te),y(null);try{const Ce=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:te})})).json().catch(()=>null);Ce!=null&&Ce.ok||y({text:bv(Ce,"the switch failed"),raw:mo(Ce)}),await z(!0)}catch{y({text:"server unreachable"})}finally{d(null)}},U=async(te,ce)=>{const{commit:Ce,alias:ve}=Y3(C,ce);if(Ce){const Te=await Z({action:"alias",account:te,alias:ve},`alias-${te}`);if(await z(!0),!(Te!=null&&Te.ok))return;A(ve)}L(te),window.setTimeout(()=>L(Te=>Te===te?null:Te),Z3)},J=async(te,ce)=>{const Ce=await Z({action:"move",account:te,slot:ce},`move-${te}`),ve=G3({menuFor:S,shareFor:(P==null?void 0:P.num)??null},te,Ce);if(await z(!0),ve){b(ve.menuFor),O(ve.confirmRemove),ve.shareFor==null&&(F(null),q(!1)),Q(ve.swapNote);const Te=ve.swapNote;Te&&window.setTimeout(()=>Q(ye=>ye===Te?null:ye),Q3)}};return g.jsxs("div",{className:"accounts-panel","aria-label":"Claude accounts",children:[g.jsxs("div",{className:"ap-header",children:[g.jsx("h3",{children:"Accounts"}),g.jsxs("div",{className:"ap-header-right",children:[g.jsx("button",{type:"button",className:"btn ap-add",onClick:()=>E(!0),title:"Sign in to another Claude account, or paste one shared from another deck",children:"+"}),g.jsx("button",{type:"button",className:"btn ap-refresh",onClick:()=>z(!0),disabled:c,"aria-label":"Reload accounts",title:"Reload from claude-swap",children:c?"…":"↻"}),g.jsx("button",{type:"button",className:"btn icon-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:"×"})]})]}),n==null?m?g.jsxs("div",{className:"ap-empty",role:"alert",children:[g.jsx("span",{title:m.raw||void 0,children:m.text}),g.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",Yx/1e3," seconds."]}),g.jsx("button",{type:"button",className:"ap-fix",disabled:c,onClick:()=>z(!0),children:c?"trying…":"try again"})]}):g.jsx("div",{className:"ap-empty",children:"Checking…"}):n.ok?g.jsxs(g.Fragment,{children:[(fe=n.accounts)==null?void 0:fe.map(te=>g.jsxs("div",{className:`ap-account${te.active?" active":""}${te.disabled?" disabled":""}`,children:[g.jsxs("div",{className:"ap-account-head",children:[g.jsx("span",{className:"ap-num",children:te.num}),te.alias&&g.jsx("span",{className:"ap-alias",children:te.alias}),g.jsx("span",{className:"ap-email",title:te.org??void 0,children:te.email}),g.jsx("button",{type:"button",className:`ap-more${S===te.num?" on":""}`,"aria-label":`Manage account ${te.num}`,"aria-expanded":S===te.num,"aria-controls":S===te.num?`ap-manage-${te.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{b(S===te.num?null:te.num),A(te.alias??""),O(null),F(null),q(!1),Q(null),L(null)},children:"⋯"}),te.active?g.jsx("span",{className:"ap-badge-active",children:"● active"}):g.jsx("button",{type:"button",className:"btn ap-switch",disabled:p!=null||te.disabled,onClick:()=>Y(te.num),title:te.disabled?"Held out of rotation":`Switch to ${te.alias??te.email}`,children:p===te.num?"…":"switch"})]}),te.lanes.length>0?te.lanes.map(ce=>g.jsx(sL,{lane:ce,nowSec:w},ce.id)):g.jsx("div",{className:"ap-hint",children:"No usage recorded yet."}),g.jsxs("div",{className:"ap-meta",children:[te.error&&(()=>{const ce=rL(te.error);return g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"ap-err",title:ce.hint,children:ce.text}),ce.fixable&&g.jsx("button",{type:"button",className:"ap-fix",onClick:()=>E(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"sign in again"})]})})(),((i==null?void 0:i.enabled)||(i==null?void 0:i.external))&&!te.active&&g.jsx("button",{type:"button",className:"ap-rotate",disabled:l!=null,onClick:()=>ne({action:"account",account:te.num,enabled:te.disabled},`rot-${te.num}`).then(()=>z(!0)),title:te.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",children:te.disabled?"held out":"in rotation"}),te.fetchedAt?g.jsxs("span",{className:`ap-age${te.stale?" ap-stale":""}`,title:"When claude-swap last read this account's usage, and when it plans to read it again. It sets that interval itself — 3 minutes at the fastest, wider while an account is recovering from a rate limit — and every surface, including `cswap watch`, follows the same plan.",children:["collected ",Kx(te.fetchedAt,w),nL(te.nextAt,w)]}):g.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),S===te.num&&g.jsxs("div",{className:"ap-manage",id:`ap-manage-${te.num}`,role:"group","aria-label":`Manage account ${te.num}`,children:[g.jsxs("div",{className:"ap-manage-name",children:[g.jsx("label",{className:"ap-vh",htmlFor:`ap-alias-${te.num}`,children:"Alias"}),g.jsx("input",{id:`ap-alias-${te.num}`,className:"ap-manage-input",type:"text",value:C,onChange:ce=>A(ce.target.value),onKeyDown:ce=>{ce.key==="Enter"&&U(te.num,te.alias)},placeholder:"e.g. work",spellCheck:!1,autoFocus:!0}),g.jsx("button",{type:"button",className:"ap-manage-btn",disabled:l!=null,onClick:()=>U(te.num,te.alias),title:"A short name to show instead of the email",children:M===te.num?"saved":"save"})]}),g.jsxs("div",{className:"ap-manage-acts",children:[g.jsx("label",{className:"ap-vh",htmlFor:`ap-slot-${te.num}`,children:"Slot"}),g.jsx("span",{className:"ap-field",children:g.jsx("select",{id:`ap-slot-${te.num}`,value:String(te.num),disabled:l!=null,onChange:ce=>J(te.num,Number(ce.target.value)),children:V3((n.accounts??[]).map(ce=>ce.num),te.num).map(ce=>g.jsx("option",{value:ce.slot,children:ce.label},ce.slot))})}),g.jsx("button",{type:"button",className:"ap-manage-btn",disabled:l!=null,title:`Copy this account to another ${zt}. The share carries a live login and expires in 10 minutes.`,onClick:async()=>{q(!1);const ce=await Z({action:"share",account:te.num},`share-${te.num}`);ce!=null&&ce.ok&&F({num:te.num,blob:ce.blob,expiresAt:ce.expiresAt})},children:"share"}),g.jsx("button",{type:"button",className:`ap-manage-btn danger${H===te.num?" armed":""}`,disabled:l!=null,title:H===te.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(H!==te.num){O(te.num),window.setTimeout(()=>O(ce=>ce===te.num?null:ce),4e3);return}O(null),Z({action:"remove",account:te.num},`rm-${te.num}`).then(()=>{b(null),z(!0)})},children:H===te.num?"confirm":"remove"})]}),(R==null?void 0:R.at)===te.num&&(()=>{var ve;const ce=(ve=n.accounts)==null?void 0:ve.find(Te=>Te.num===R.displaced),Ce=(ce==null?void 0:ce.alias)??(ce==null?void 0:ce.email)??"the account that was there";return g.jsxs("span",{className:"ap-manage-hint ap-manage-swap",title:`Slot ${R.at} was taken, so the two accounts traded places: ${Ce} now holds slot ${R.displaced}.`,children:["swapped with slot ",R.displaced]})})(),(P==null?void 0:P.num)===te.num&&(()=>{const ce=oL(P.expiresAt,w),Ce=ce.tone==="gone";return g.jsxs("div",{className:`ap-share${Ce?" expired":""}`,children:[g.jsx("code",{className:"ap-share-blob",children:P.blob}),g.jsxs("div",{className:"ap-share-foot",children:[g.jsx("button",{type:"button",className:"ap-manage-btn",disabled:l!=null,onClick:async()=>{if(Ce){q(!1);const ve=await Z({action:"share",account:te.num},`share-${te.num}`);ve!=null&&ve.ok&&F({num:te.num,blob:ve.blob,expiresAt:ve.expiresAt});return}await iL(P.blob)&&(q(!0),window.setTimeout(()=>q(!1),1800))},children:Ce?"make a new share":G?"copied":"copy"}),g.jsxs("span",{className:"ap-manage-hint",children:["carries a live login · ",g.jsx("span",{className:`ap-share-expiry ${ce.tone}`,children:ce.text})]})]})]})})()]})]},te.num)),(i==null?void 0:i.ok)&&g.jsxs("div",{className:"ap-auto",children:[g.jsxs("div",{className:"ap-auto-head",children:[g.jsx("span",{className:"ap-auto-title",children:"Auto-switch"}),g.jsxs("span",{className:"ap-auto-ctl",children:[I!=null&&g.jsxs("span",{className:`ap-auto-now${W?" near":""}`,children:[Math.round(I),"%"]}),g.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:g.jsx("select",{"aria-label":"Switch threshold",value:$,disabled:l!=null,onChange:te=>ne({action:"setting",key:"autoswitch.threshold",value:te.target.value},"threshold").then(()=>z(!0)),children:eL.map(te=>g.jsxs("option",{value:te,children:[te,"%"]},te))})}),g.jsxs("button",{type:"button",className:`ap-auto-state${i.enabled?" live":""}`,role:"switch","aria-checked":i.enabled,disabled:l!=null,onClick:()=>ne({action:"enable",enabled:!i.enabled},"enable").then(()=>z(!0)),title:i.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:[g.jsx("i",{className:i.enabled?"ap-pulse":"ap-dot","aria-hidden":!0}),i.enabled?"on":"off"]})]})]}),i.external&&g.jsxs("p",{className:"ap-auto-note",children:[g.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",g.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",i.enabled?" — this toggle takes over when you stop it.":"."]}),i.lastTick&&g.jsx("div",{className:"ap-auto-foot",children:g.jsxs("span",{className:"ap-auto-result",children:["checked ",Kx(i.lastTick.at,w)]})})]}),m&&g.jsxs("div",{className:"ap-failure",role:"alert",children:[g.jsx("span",{className:"ap-failure-text",title:m.raw||void 0,children:m.text}),g.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>y(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),g.jsx("p",{className:"ap-footnote",title:"Anthropic's usage endpoint allows roughly 28–30 requests per hour per account, shared by every tool on this machine — polling it from here would rate-limit your account. So the deck never fetches: it asks claude-swap to collect while this panel is open, at most once every three minutes, and claude-swap decides whether that touches the network at all.",children:"Collected by claude-swap while this panel is open."})]}):g.jsx("div",{className:"ap-empty",children:n.reason==="no_cswap"?g.jsxs(g.Fragment,{children:[g.jsx("span",{children:"claude-swap isn't installed."}),g.jsx("span",{className:"ap-hint",children:"This panel reads the account store claude-swap keeps — without it there is nothing to show. It is a separate tool, published on PyPI, so it does not come with this package."}),n.hint&&g.jsx("code",{className:"ap-cmd",children:n.hint}),g.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",g.jsx("strong",{children:"+"})," button above."]})]}):n.reason==="no_accounts"?g.jsxs(g.Fragment,{children:[g.jsx("span",{children:"No accounts added yet."}),g.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",g.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):g.jsxs(g.Fragment,{children:[g.jsx("span",{children:"Couldn't read the account store."}),g.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",n.reason?` (${n.reason})`:"","."]})]})}),k&&g.jsx(W3,{onClose:()=>E(!1),onChanged:()=>z(!0)})]})}const lL=3e4;function uL({bundle:e,running:n,lastTried:r}){return!n||e===n?!1:r!==n}function cL({bundle:e,running:n,pending:r,lastTried:i}){return n?uL({bundle:e,running:n,lastTried:i})?"reload":r==null||r&&r!==n?"wait":"confirm":"wait"}function dL(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function fL({asked:e,reported:n}){return n?n!==e:!1}function hL(e){const n=e.thresholdMs??lL;return!e.enabled||e.kind!=="restart"||!e.canRestart?{idleSince:null,restart:!1}:e.busy?{idleSince:null,restart:!1}:e.idleSince==null?{idleSince:e.now,restart:!1}:e.now<e.idleSince?{idleSince:e.now,restart:!1}:{idleSince:e.idleSince,restart:e.now-e.idleSince>=n}}function pL(e){return e.ctrlKey||e.metaKey||e.altKey}const mL=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),gL=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),vL=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function fC(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function hC(e){if(!e)return!1;if(e.isContentEditable)return!0;const n=fC(e);return n==="TEXTAREA"?!0:n!=="INPUT"?!1:!mL.has(String(e.type??"text").toLowerCase())}function yL(e){if(!e)return!1;if(hC(e)||gL.has(fC(e)))return!0;const n=typeof e.role=="string"?e.role.trim().toLowerCase():"";return n!==""&&n.split(/\s+/).some(r=>vL.has(r))}function wL({agentCount:e,onConfirm:n,onCancel:r}){const i=T.useRef(null);vo(r,{focusRef:i,layer:gO});const o=e===0?"This deletes the server's event log":`This removes ${e===1?"the one agent":`all ${e} agents`} on the canvas and deletes the server's event log`;return g.jsx("div",{className:"modal-backdrop",onClick:r,role:"presentation",children:g.jsxs("div",{className:"modal clear-confirm",onClick:l=>l.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[g.jsxs("header",{className:"modal-head",children:[g.jsxs("div",{className:"modal-title",children:[g.jsx("span",{className:"status-dot err","aria-hidden":!0}),g.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),g.jsx("div",{className:"modal-actions",children:g.jsx("button",{type:"button",className:"btn icon-btn",onClick:r,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),g.jsxs("section",{className:"modal-body",children:[g.jsxs("p",{className:"modal-note",children:[o," — the file a restarted deck replays to rebuild what you see. Layout, pins and selection go with it. This cannot be undone."]}),g.jsxs("div",{className:"cc-actions",children:[g.jsx("button",{type:"button",ref:i,className:"btn",onClick:r,children:"Cancel"}),g.jsx("button",{type:"button",className:"btn danger",onClick:n,children:"Clear everything"})]})]})]})})}function xL(e,n){return e==="confirmation"?n.confirmOpen?"clear":"ignore":n.modalOpen||n.confirmOpen?"ignore":"confirm"}function Zl(e,n){if(n.size!==0)for(const r of Array.from(e.keys()))n.has(r)||e.delete(r)}function _L(e){const n=new Set;for(const r of e)n.add(r.id),n.add(`group:${r.sessionId}`);return n}function pC(e,n,r){return!n.has(e)||r.has(e)}function bL(e,n,r,i){return!n.has(e)&&pC(e,r,i)}function SL(e,n,r){const i={x:0,y:0};return n.set(e,i),r.add(e),i}function kL(e,n,r,i){r.set(e,n),i.delete(e)}const EL=40,NL=120;function CL(e,n){let r=null,i=0,o=Number.NEGATIVE_INFINITY;const l=()=>{r=null,o=n.now(),e()},u=()=>{r!=null&&(n.clearTimeout(r),r=null)},c=(h,p,d)=>{if(r!=null){if(i<=h)return;u()}const m=Math.min(d,Math.max(0,h-p));i=h,r=n.setTimeout(l,m)};return{live(h=EL){const p=n.now(),d=Math.max(o+h,p);if(d<=p){u(),l();return}c(d,p,h)},replay(h=NL){u(),i=n.now()+h,r=n.setTimeout(l,h)},flush(){u(),l()},cancel(){u()}}}function jL(){let e=!1,n=[];return{get paused(){return e},get size(){return n.length},accept(r){return e?(n.push(r),!1):!0},setPaused(r){if(e=r,r||n.length===0)return[];const i=n;return n=[],i}}}const RL="1",Xx="agent-dag.schema",TL=["agent-dag.layout","agent-dag.viewport"];function mC(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function AL(e,n=RL){let r=null;try{r=e.getItem(Xx)}catch{return[]}if(r===n)return[];const i=[];if(r!==null)for(const o of TL)try{e.getItem(o)!==null&&(e.removeItem(o),i.push(o))}catch{}try{e.setItem(Xx,n)}catch{}return i}const gC="agent-dag.theme";function IL(e){return e==="light"?"light":"dark"}function ML(){return IL(mC(gC))}function PL({waiting:e,running:n}){return{title:e>0?`(${e}) ${zt}`:zt,icon:e>0?"waiting":n>0?"running":"idle"}}const Od={waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function Ld(e,n){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">${n==="waiting"?`<circle cx="16" cy="16" r="14.5" fill="${e}"/>`:`<circle cx="16" cy="16" r="12" fill="none" stroke="${e}" stroke-width="5"/>`+(n==="running"?`<circle cx="16" cy="16" r="5" fill="${e}"/>`:"")}</svg>`}const OL=Object.freeze({waiting:`data:image/svg+xml,${encodeURIComponent(Ld(Od.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(Ld(Od.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(Ld(Od.idle,"idle"))}`});function LL(){let e=0;return{begin(){const n=++e;return()=>n===e},cancel(){e++}}}function qL(e,n=new Date){return new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}function $L(e){return!e.answer||e.answer.range!==e.want?{phase:"busy",stale:!1}:e.answer.ok?{phase:e.answer.days>0?"chart":"empty",stale:e.loading}:{phase:"error",stale:e.loading}}function Jl(e){const n=e.toLowerCase();return n.includes("opus")?"#c4b5fd":n.includes("sonnet")?"#7dd3fc":n.includes("haiku")?"#86efac":n.includes("gpt-5")||n.includes("gpt5")?"#fcd34d":n.includes("gpt")?"#fca5a5":n.includes("gemini")?"#a5b4fc":n.includes("codex")?"#fdba74":"#94a3b8"}const DL=[7,14,30,90];function FL(e){const[n,r]=T.useState(null),[i,o]=T.useState(!1),l=T.useRef(LL()).current,u=(c=!1)=>{const h=l.begin(),p=e;o(!0);const m=`/api/ccusage?since=${qL(p)}${c?"&refresh=1":""}`;fetch(m).then(y=>y.json()).then(y=>{h()&&r({range:p,resp:y})}).catch(()=>{h()&&r({range:p,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{h()&&o(!1)})};return T.useEffect(()=>(u(!1),()=>l.cancel()),[e]),{landed:n,loading:i,reload:()=>u(!0)}}function zL({onClose:e}){var k,E,C;const[n,r]=T.useState(30),[i,o]=T.useState(null),{landed:l,loading:u,reload:c}=FL(n);vo(e);const h=$L({loading:u,want:n,answer:l&&{range:l.range,ok:l.resp.ok===!0,days:((k=l.resp.days)==null?void 0:k.length)??0}}),p=h.phase==="chart"?l.resp.days??[]:[],d=T.useMemo(()=>p.reduce((A,M)=>Math.max(A,M.totalCost),0),[p]),{totalCost:m,totalTok:y,inOut:w,cacheRead:N,modelCosts:_}=T.useMemo(()=>{let A=0,M=0,L=0,H=0;const O=new Map;for(const P of p){A+=P.totalCost,M+=P.totalTokens,L+=P.inputTokens+P.outputTokens,H+=P.cacheReadTokens;for(const F of P.modelBreakdowns)O.set(F.modelName,(O.get(F.modelName)??0)+F.cost)}return{totalCost:A,totalTok:M,inOut:L,cacheRead:H,modelCosts:O}},[p]),S=T.useMemo(()=>Array.from(_.entries()).sort((A,M)=>M[1]-A[1]),[_]),b=i?p.find(A=>A.period===i)??null:null;return g.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:g.jsxs("div",{className:"uh-modal",onClick:A=>A.stopPropagation(),role:"dialog","aria-label":"Usage history",children:[g.jsxs("header",{className:"uh-head",children:[g.jsxs("div",{className:"uh-titlewrap",children:[g.jsx("div",{className:"uh-title",children:"Usage history"}),g.jsx("div",{className:"uh-sub",children:"via ccusage · local Claude / Codex logs"})]}),g.jsx("div",{className:"uh-range",role:"tablist","aria-label":"Range",children:DL.map(A=>g.jsxs("button",{role:"tab","aria-selected":n===A,className:`uh-range-btn${n===A?" on":""}`,onClick:()=>{r(A),o(null)},children:[A,"d"]},A))}),g.jsx("button",{className:"btn icon-btn uh-reload",onClick:c,disabled:u,title:"Re-run ccusage","aria-label":"Reload",children:u?"…":"↻"}),g.jsx("button",{className:"uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),h.phase==="busy"?g.jsx("div",{className:"uh-status","aria-busy":"true",children:l?"running ccusage…":"running ccusage… (first run downloads the package)"}):h.phase==="error"?g.jsxs("div",{className:"uh-status uh-err",title:mo(l.resp)||void 0,children:[U3(l.resp,"ccusage did not report usage"),g.jsx("div",{children:g.jsx("button",{className:"btn uh-retry",onClick:c,disabled:u,children:u?"trying…":"Try again"})})]}):h.phase==="empty"?g.jsx("div",{className:`uh-status${h.stale?" uh-stale":""}`,"aria-busy":h.stale||void 0,children:"no usage in this range"}):g.jsxs("div",{className:h.stale?"uh-stale":void 0,"aria-busy":h.stale||void 0,children:[g.jsxs("div",{className:"uh-totals",children:[g.jsx(eu,{label:"total cost",val:Fe(m),accent:!0}),g.jsx(eu,{label:"tokens",val:Ft(y)}),g.jsx(eu,{label:"input+output",val:Ft(w)}),g.jsx(eu,{label:"cache reads",val:Ft(N)})]}),g.jsx("div",{className:"uh-chart",role:"img","aria-label":"Daily cost by model",children:p.map(A=>{const M=d>0?A.totalCost/d*100:0,L=A.period===i;return g.jsxs("button",{className:`uh-bar-col${L?" sel":""}`,onClick:()=>o(L?null:A.period),title:`${A.period} · ${Fe(A.totalCost)}`,style:{flexBasis:`${100/p.length}%`},children:[g.jsx("div",{className:"uh-bar",style:{height:`${Math.max(M,A.totalCost>0?2:0)}%`},children:A.modelBreakdowns.slice().sort((H,O)=>O.cost-H.cost).map(H=>{const O=A.totalCost>0?H.cost/A.totalCost*100:0;return g.jsx("div",{className:"uh-bar-seg",style:{height:`${O}%`,background:Jl(H.modelName)}},H.modelName)})}),g.jsx("span",{className:"uh-bar-label",children:A.period.slice(5)})]},A.period)})}),g.jsx("div",{className:"uh-legend",children:S.map(([A,M])=>g.jsxs("span",{className:"uh-legend-item",children:[g.jsx("span",{className:"uh-legend-dot",style:{background:Jl(A)}}),li(A)," ",g.jsx("span",{className:"uh-legend-cost",children:Fe(M)})]},A))}),b&&g.jsxs("div",{className:"uh-detail",children:[g.jsxs("div",{className:"uh-detail-head",children:[g.jsx("span",{className:"uh-detail-date",children:b.period}),g.jsx("span",{className:"uh-detail-cost",children:Fe(b.totalCost)}),(C=(E=b.metadata)==null?void 0:E.agents)!=null&&C.length?g.jsx("span",{className:"uh-detail-agents",children:b.metadata.agents.join(" · ")}):null]}),g.jsxs("div",{className:"uh-detail-mini",children:[g.jsx(tu,{label:"input",val:Ft(b.inputTokens)}),g.jsx(tu,{label:"output",val:Ft(b.outputTokens)}),g.jsx(tu,{label:"cache write",val:Ft(b.cacheCreationTokens)}),g.jsx(tu,{label:"cache read",val:Ft(b.cacheReadTokens)})]}),g.jsx("div",{className:"uh-detail-models",children:b.modelBreakdowns.slice().sort((A,M)=>M.cost-A.cost).map(A=>{const M=b.totalCost>0?A.cost/b.totalCost*100:0;return g.jsxs("div",{className:"uh-model-row",children:[g.jsxs("span",{className:"uh-model-name",children:[g.jsx("span",{className:"uh-legend-dot",style:{background:Jl(A.modelName)}}),li(A.modelName)]}),g.jsx("span",{className:"uh-model-bar",children:g.jsx("span",{className:"uh-model-bar-fill",style:{width:`${M}%`,background:Jl(A.modelName)}})}),g.jsx("span",{className:"uh-model-cost",children:Fe(A.cost)})]},A.modelName)})})]})]})]})})}function eu({label:e,val:n,accent:r}){return g.jsxs("div",{className:"uh-stat",children:[g.jsx("span",{className:`uh-stat-val${r?" accent":""}`,children:n}),g.jsx("span",{className:"uh-stat-label",children:e})]})}function tu({label:e,val:n}){return g.jsxs("div",{className:"uh-ministat",children:[g.jsx("span",{className:"uh-ministat-val",children:n}),g.jsx("span",{className:"uh-ministat-label",children:e})]})}function Yv(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var qd,Qx;function BL(){if(Qx)return qd;Qx=1;function e(){this.__data__=[],this.size=0}return qd=e,qd}var $d,Zx;function yo(){if(Zx)return $d;Zx=1;function e(n,r){return n===r||n!==n&&r!==r}return $d=e,$d}var Dd,Jx;function Ru(){if(Jx)return Dd;Jx=1;var e=yo();function n(r,i){for(var o=r.length;o--;)if(e(r[o][0],i))return o;return-1}return Dd=n,Dd}var Fd,e_;function UL(){if(e_)return Fd;e_=1;var e=Ru(),n=Array.prototype,r=n.splice;function i(o){var l=this.__data__,u=e(l,o);if(u<0)return!1;var c=l.length-1;return u==c?l.pop():r.call(l,u,1),--this.size,!0}return Fd=i,Fd}var zd,t_;function HL(){if(t_)return zd;t_=1;var e=Ru();function n(r){var i=this.__data__,o=e(i,r);return o<0?void 0:i[o][1]}return zd=n,zd}var Bd,n_;function WL(){if(n_)return Bd;n_=1;var e=Ru();function n(r){return e(this.__data__,r)>-1}return Bd=n,Bd}var Ud,r_;function VL(){if(r_)return Ud;r_=1;var e=Ru();function n(r,i){var o=this.__data__,l=e(o,r);return l<0?(++this.size,o.push([r,i])):o[l][1]=i,this}return Ud=n,Ud}var Hd,s_;function Tu(){if(s_)return Hd;s_=1;var e=BL(),n=UL(),r=HL(),i=WL(),o=VL();function l(u){var c=-1,h=u==null?0:u.length;for(this.clear();++c<h;){var p=u[c];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=n,l.prototype.get=r,l.prototype.has=i,l.prototype.set=o,Hd=l,Hd}var Wd,i_;function GL(){if(i_)return Wd;i_=1;var e=Tu();function n(){this.__data__=new e,this.size=0}return Wd=n,Wd}var Vd,o_;function YL(){if(o_)return Vd;o_=1;function e(n){var r=this.__data__,i=r.delete(n);return this.size=r.size,i}return Vd=e,Vd}var Gd,a_;function KL(){if(a_)return Gd;a_=1;function e(n){return this.__data__.get(n)}return Gd=e,Gd}var Yd,l_;function XL(){if(l_)return Yd;l_=1;function e(n){return this.__data__.has(n)}return Yd=e,Yd}var Kd,u_;function vC(){if(u_)return Kd;u_=1;var e=typeof $l=="object"&&$l&&$l.Object===Object&&$l;return Kd=e,Kd}var Xd,c_;function tr(){if(c_)return Xd;c_=1;var e=vC(),n=typeof self=="object"&&self&&self.Object===Object&&self,r=e||n||Function("return this")();return Xd=r,Xd}var Qd,d_;function wo(){if(d_)return Qd;d_=1;var e=tr(),n=e.Symbol;return Qd=n,Qd}var Zd,f_;function QL(){if(f_)return Zd;f_=1;var e=wo(),n=Object.prototype,r=n.hasOwnProperty,i=n.toString,o=e?e.toStringTag:void 0;function l(u){var c=r.call(u,o),h=u[o];try{u[o]=void 0;var p=!0}catch{}var d=i.call(u);return p&&(c?u[o]=h:delete u[o]),d}return Zd=l,Zd}var Jd,h_;function ZL(){if(h_)return Jd;h_=1;var e=Object.prototype,n=e.toString;function r(i){return n.call(i)}return Jd=r,Jd}var ef,p_;function ui(){if(p_)return ef;p_=1;var e=wo(),n=QL(),r=ZL(),i="[object Null]",o="[object Undefined]",l=e?e.toStringTag:void 0;function u(c){return c==null?c===void 0?o:i:l&&l in Object(c)?n(c):r(c)}return ef=u,ef}var tf,m_;function Ln(){if(m_)return tf;m_=1;function e(n){var r=typeof n;return n!=null&&(r=="object"||r=="function")}return tf=e,tf}var nf,g_;function qa(){if(g_)return nf;g_=1;var e=ui(),n=Ln(),r="[object AsyncFunction]",i="[object Function]",o="[object GeneratorFunction]",l="[object Proxy]";function u(c){if(!n(c))return!1;var h=e(c);return h==i||h==o||h==r||h==l}return nf=u,nf}var rf,v_;function JL(){if(v_)return rf;v_=1;var e=tr(),n=e["__core-js_shared__"];return rf=n,rf}var sf,y_;function eq(){if(y_)return sf;y_=1;var e=JL(),n=(function(){var i=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""})();function r(i){return!!n&&n in i}return sf=r,sf}var of,w_;function yC(){if(w_)return of;w_=1;var e=Function.prototype,n=e.toString;function r(i){if(i!=null){try{return n.call(i)}catch{}try{return i+""}catch{}}return""}return of=r,of}var af,x_;function tq(){if(x_)return af;x_=1;var e=qa(),n=eq(),r=Ln(),i=yC(),o=/[\\^$.*+?()[\]{}|]/g,l=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,h=u.toString,p=c.hasOwnProperty,d=RegExp("^"+h.call(p).replace(o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(y){if(!r(y)||n(y))return!1;var w=e(y)?d:l;return w.test(i(y))}return af=m,af}var lf,__;function nq(){if(__)return lf;__=1;function e(n,r){return n==null?void 0:n[r]}return lf=e,lf}var uf,b_;function ci(){if(b_)return uf;b_=1;var e=tq(),n=nq();function r(i,o){var l=n(i,o);return e(l)?l:void 0}return uf=r,uf}var cf,S_;function Kv(){if(S_)return cf;S_=1;var e=ci(),n=tr(),r=e(n,"Map");return cf=r,cf}var df,k_;function Au(){if(k_)return df;k_=1;var e=ci(),n=e(Object,"create");return df=n,df}var ff,E_;function rq(){if(E_)return ff;E_=1;var e=Au();function n(){this.__data__=e?e(null):{},this.size=0}return ff=n,ff}var hf,N_;function sq(){if(N_)return hf;N_=1;function e(n){var r=this.has(n)&&delete this.__data__[n];return this.size-=r?1:0,r}return hf=e,hf}var pf,C_;function iq(){if(C_)return pf;C_=1;var e=Au(),n="__lodash_hash_undefined__",r=Object.prototype,i=r.hasOwnProperty;function o(l){var u=this.__data__;if(e){var c=u[l];return c===n?void 0:c}return i.call(u,l)?u[l]:void 0}return pf=o,pf}var mf,j_;function oq(){if(j_)return mf;j_=1;var e=Au(),n=Object.prototype,r=n.hasOwnProperty;function i(o){var l=this.__data__;return e?l[o]!==void 0:r.call(l,o)}return mf=i,mf}var gf,R_;function aq(){if(R_)return gf;R_=1;var e=Au(),n="__lodash_hash_undefined__";function r(i,o){var l=this.__data__;return this.size+=this.has(i)?0:1,l[i]=e&&o===void 0?n:o,this}return gf=r,gf}var vf,T_;function lq(){if(T_)return vf;T_=1;var e=rq(),n=sq(),r=iq(),i=oq(),o=aq();function l(u){var c=-1,h=u==null?0:u.length;for(this.clear();++c<h;){var p=u[c];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=n,l.prototype.get=r,l.prototype.has=i,l.prototype.set=o,vf=l,vf}var yf,A_;function uq(){if(A_)return yf;A_=1;var e=lq(),n=Tu(),r=Kv();function i(){this.size=0,this.__data__={hash:new e,map:new(r||n),string:new e}}return yf=i,yf}var wf,I_;function cq(){if(I_)return wf;I_=1;function e(n){var r=typeof n;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?n!=="__proto__":n===null}return wf=e,wf}var xf,M_;function Iu(){if(M_)return xf;M_=1;var e=cq();function n(r,i){var o=r.__data__;return e(i)?o[typeof i=="string"?"string":"hash"]:o.map}return xf=n,xf}var _f,P_;function dq(){if(P_)return _f;P_=1;var e=Iu();function n(r){var i=e(this,r).delete(r);return this.size-=i?1:0,i}return _f=n,_f}var bf,O_;function fq(){if(O_)return bf;O_=1;var e=Iu();function n(r){return e(this,r).get(r)}return bf=n,bf}var Sf,L_;function hq(){if(L_)return Sf;L_=1;var e=Iu();function n(r){return e(this,r).has(r)}return Sf=n,Sf}var kf,q_;function pq(){if(q_)return kf;q_=1;var e=Iu();function n(r,i){var o=e(this,r),l=o.size;return o.set(r,i),this.size+=o.size==l?0:1,this}return kf=n,kf}var Ef,$_;function Xv(){if($_)return Ef;$_=1;var e=uq(),n=dq(),r=fq(),i=hq(),o=pq();function l(u){var c=-1,h=u==null?0:u.length;for(this.clear();++c<h;){var p=u[c];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=n,l.prototype.get=r,l.prototype.has=i,l.prototype.set=o,Ef=l,Ef}var Nf,D_;function mq(){if(D_)return Nf;D_=1;var e=Tu(),n=Kv(),r=Xv(),i=200;function o(l,u){var c=this.__data__;if(c instanceof e){var h=c.__data__;if(!n||h.length<i-1)return h.push([l,u]),this.size=++c.size,this;c=this.__data__=new r(h)}return c.set(l,u),this.size=c.size,this}return Nf=o,Nf}var Cf,F_;function Mu(){if(F_)return Cf;F_=1;var e=Tu(),n=GL(),r=YL(),i=KL(),o=XL(),l=mq();function u(c){var h=this.__data__=new e(c);this.size=h.size}return u.prototype.clear=n,u.prototype.delete=r,u.prototype.get=i,u.prototype.has=o,u.prototype.set=l,Cf=u,Cf}var jf,z_;function Qv(){if(z_)return jf;z_=1;function e(n,r){for(var i=-1,o=n==null?0:n.length;++i<o&&r(n[i],i,n)!==!1;);return n}return jf=e,jf}var Rf,B_;function wC(){if(B_)return Rf;B_=1;var e=ci(),n=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return Rf=n,Rf}var Tf,U_;function Pu(){if(U_)return Tf;U_=1;var e=wC();function n(r,i,o){i=="__proto__"&&e?e(r,i,{configurable:!0,enumerable:!0,value:o,writable:!0}):r[i]=o}return Tf=n,Tf}var Af,H_;function Ou(){if(H_)return Af;H_=1;var e=Pu(),n=yo(),r=Object.prototype,i=r.hasOwnProperty;function o(l,u,c){var h=l[u];(!(i.call(l,u)&&n(h,c))||c===void 0&&!(u in l))&&e(l,u,c)}return Af=o,Af}var If,W_;function $a(){if(W_)return If;W_=1;var e=Ou(),n=Pu();function r(i,o,l,u){var c=!l;l||(l={});for(var h=-1,p=o.length;++h<p;){var d=o[h],m=u?u(l[d],i[d],d,l,i):void 0;m===void 0&&(m=i[d]),c?n(l,d,m):e(l,d,m)}return l}return If=r,If}var Mf,V_;function gq(){if(V_)return Mf;V_=1;function e(n,r){for(var i=-1,o=Array(n);++i<n;)o[i]=r(i);return o}return Mf=e,Mf}var Pf,G_;function vr(){if(G_)return Pf;G_=1;function e(n){return n!=null&&typeof n=="object"}return Pf=e,Pf}var Of,Y_;function vq(){if(Y_)return Of;Y_=1;var e=ui(),n=vr(),r="[object Arguments]";function i(o){return n(o)&&e(o)==r}return Of=i,Of}var Lf,K_;function Da(){if(K_)return Lf;K_=1;var e=vq(),n=vr(),r=Object.prototype,i=r.hasOwnProperty,o=r.propertyIsEnumerable,l=e((function(){return arguments})())?e:function(u){return n(u)&&i.call(u,"callee")&&!o.call(u,"callee")};return Lf=l,Lf}var qf,X_;function bt(){if(X_)return qf;X_=1;var e=Array.isArray;return qf=e,qf}var va={exports:{}},$f,Q_;function yq(){if(Q_)return $f;Q_=1;function e(){return!1}return $f=e,$f}va.exports;var Z_;function xo(){return Z_||(Z_=1,(function(e,n){var r=tr(),i=yq(),o=n&&!n.nodeType&&n,l=o&&!0&&e&&!e.nodeType&&e,u=l&&l.exports===o,c=u?r.Buffer:void 0,h=c?c.isBuffer:void 0,p=h||i;e.exports=p})(va,va.exports)),va.exports}var Df,J_;function Lu(){if(J_)return Df;J_=1;var e=9007199254740991,n=/^(?:0|[1-9]\d*)$/;function r(i,o){var l=typeof i;return o=o??e,!!o&&(l=="number"||l!="symbol"&&n.test(i))&&i>-1&&i%1==0&&i<o}return Df=r,Df}var Ff,e1;function Zv(){if(e1)return Ff;e1=1;var e=9007199254740991;function n(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return Ff=n,Ff}var zf,t1;function wq(){if(t1)return zf;t1=1;var e=ui(),n=Zv(),r=vr(),i="[object Arguments]",o="[object Array]",l="[object Boolean]",u="[object Date]",c="[object Error]",h="[object Function]",p="[object Map]",d="[object Number]",m="[object Object]",y="[object RegExp]",w="[object Set]",N="[object String]",_="[object WeakMap]",S="[object ArrayBuffer]",b="[object DataView]",k="[object Float32Array]",E="[object Float64Array]",C="[object Int8Array]",A="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",H="[object Uint8ClampedArray]",O="[object Uint16Array]",P="[object Uint32Array]",F={};F[k]=F[E]=F[C]=F[A]=F[M]=F[L]=F[H]=F[O]=F[P]=!0,F[i]=F[o]=F[S]=F[l]=F[b]=F[u]=F[c]=F[h]=F[p]=F[d]=F[m]=F[y]=F[w]=F[N]=F[_]=!1;function G(q){return r(q)&&n(q.length)&&!!F[e(q)]}return zf=G,zf}var Bf,n1;function qu(){if(n1)return Bf;n1=1;function e(n){return function(r){return n(r)}}return Bf=e,Bf}var ya={exports:{}};ya.exports;var r1;function Jv(){return r1||(r1=1,(function(e,n){var r=vC(),i=n&&!n.nodeType&&n,o=i&&!0&&e&&!e.nodeType&&e,l=o&&o.exports===i,u=l&&r.process,c=(function(){try{var h=o&&o.require&&o.require("util").types;return h||u&&u.binding&&u.binding("util")}catch{}})();e.exports=c})(ya,ya.exports)),ya.exports}var Uf,s1;function Fa(){if(s1)return Uf;s1=1;var e=wq(),n=qu(),r=Jv(),i=r&&r.isTypedArray,o=i?n(i):e;return Uf=o,Uf}var Hf,i1;function xC(){if(i1)return Hf;i1=1;var e=gq(),n=Da(),r=bt(),i=xo(),o=Lu(),l=Fa(),u=Object.prototype,c=u.hasOwnProperty;function h(p,d){var m=r(p),y=!m&&n(p),w=!m&&!y&&i(p),N=!m&&!y&&!w&&l(p),_=m||y||w||N,S=_?e(p.length,String):[],b=S.length;for(var k in p)(d||c.call(p,k))&&!(_&&(k=="length"||w&&(k=="offset"||k=="parent")||N&&(k=="buffer"||k=="byteLength"||k=="byteOffset")||o(k,b)))&&S.push(k);return S}return Hf=h,Hf}var Wf,o1;function $u(){if(o1)return Wf;o1=1;var e=Object.prototype;function n(r){var i=r&&r.constructor,o=typeof i=="function"&&i.prototype||e;return r===o}return Wf=n,Wf}var Vf,a1;function _C(){if(a1)return Vf;a1=1;function e(n,r){return function(i){return n(r(i))}}return Vf=e,Vf}var Gf,l1;function xq(){if(l1)return Gf;l1=1;var e=_C(),n=e(Object.keys,Object);return Gf=n,Gf}var Yf,u1;function ey(){if(u1)return Yf;u1=1;var e=$u(),n=xq(),r=Object.prototype,i=r.hasOwnProperty;function o(l){if(!e(l))return n(l);var u=[];for(var c in Object(l))i.call(l,c)&&c!="constructor"&&u.push(c);return u}return Yf=o,Yf}var Kf,c1;function Wr(){if(c1)return Kf;c1=1;var e=qa(),n=Zv();function r(i){return i!=null&&n(i.length)&&!e(i)}return Kf=r,Kf}var Xf,d1;function ks(){if(d1)return Xf;d1=1;var e=xC(),n=ey(),r=Wr();function i(o){return r(o)?e(o):n(o)}return Xf=i,Xf}var Qf,f1;function _q(){if(f1)return Qf;f1=1;var e=$a(),n=ks();function r(i,o){return i&&e(o,n(o),i)}return Qf=r,Qf}var Zf,h1;function bq(){if(h1)return Zf;h1=1;function e(n){var r=[];if(n!=null)for(var i in Object(n))r.push(i);return r}return Zf=e,Zf}var Jf,p1;function Sq(){if(p1)return Jf;p1=1;var e=Ln(),n=$u(),r=bq(),i=Object.prototype,o=i.hasOwnProperty;function l(u){if(!e(u))return r(u);var c=n(u),h=[];for(var p in u)p=="constructor"&&(c||!o.call(u,p))||h.push(p);return h}return Jf=l,Jf}var eh,m1;function di(){if(m1)return eh;m1=1;var e=xC(),n=Sq(),r=Wr();function i(o){return r(o)?e(o,!0):n(o)}return eh=i,eh}var th,g1;function kq(){if(g1)return th;g1=1;var e=$a(),n=di();function r(i,o){return i&&e(o,n(o),i)}return th=r,th}var wa={exports:{}};wa.exports;var v1;function bC(){return v1||(v1=1,(function(e,n){var r=tr(),i=n&&!n.nodeType&&n,o=i&&!0&&e&&!e.nodeType&&e,l=o&&o.exports===i,u=l?r.Buffer:void 0,c=u?u.allocUnsafe:void 0;function h(p,d){if(d)return p.slice();var m=p.length,y=c?c(m):new p.constructor(m);return p.copy(y),y}e.exports=h})(wa,wa.exports)),wa.exports}var nh,y1;function SC(){if(y1)return nh;y1=1;function e(n,r){var i=-1,o=n.length;for(r||(r=Array(o));++i<o;)r[i]=n[i];return r}return nh=e,nh}var rh,w1;function kC(){if(w1)return rh;w1=1;function e(n,r){for(var i=-1,o=n==null?0:n.length,l=0,u=[];++i<o;){var c=n[i];r(c,i,n)&&(u[l++]=c)}return u}return rh=e,rh}var sh,x1;function EC(){if(x1)return sh;x1=1;function e(){return[]}return sh=e,sh}var ih,_1;function ty(){if(_1)return ih;_1=1;var e=kC(),n=EC(),r=Object.prototype,i=r.propertyIsEnumerable,o=Object.getOwnPropertySymbols,l=o?function(u){return u==null?[]:(u=Object(u),e(o(u),function(c){return i.call(u,c)}))}:n;return ih=l,ih}var oh,b1;function Eq(){if(b1)return oh;b1=1;var e=$a(),n=ty();function r(i,o){return e(i,n(i),o)}return oh=r,oh}var ah,S1;function ny(){if(S1)return ah;S1=1;function e(n,r){for(var i=-1,o=r.length,l=n.length;++i<o;)n[l+i]=r[i];return n}return ah=e,ah}var lh,k1;function Du(){if(k1)return lh;k1=1;var e=_C(),n=e(Object.getPrototypeOf,Object);return lh=n,lh}var uh,E1;function NC(){if(E1)return uh;E1=1;var e=ny(),n=Du(),r=ty(),i=EC(),o=Object.getOwnPropertySymbols,l=o?function(u){for(var c=[];u;)e(c,r(u)),u=n(u);return c}:i;return uh=l,uh}var ch,N1;function Nq(){if(N1)return ch;N1=1;var e=$a(),n=NC();function r(i,o){return e(i,n(i),o)}return ch=r,ch}var dh,C1;function CC(){if(C1)return dh;C1=1;var e=ny(),n=bt();function r(i,o,l){var u=o(i);return n(i)?u:e(u,l(i))}return dh=r,dh}var fh,j1;function jC(){if(j1)return fh;j1=1;var e=CC(),n=ty(),r=ks();function i(o){return e(o,r,n)}return fh=i,fh}var hh,R1;function Cq(){if(R1)return hh;R1=1;var e=CC(),n=NC(),r=di();function i(o){return e(o,r,n)}return hh=i,hh}var ph,T1;function jq(){if(T1)return ph;T1=1;var e=ci(),n=tr(),r=e(n,"DataView");return ph=r,ph}var mh,A1;function Rq(){if(A1)return mh;A1=1;var e=ci(),n=tr(),r=e(n,"Promise");return mh=r,mh}var gh,I1;function RC(){if(I1)return gh;I1=1;var e=ci(),n=tr(),r=e(n,"Set");return gh=r,gh}var vh,M1;function Tq(){if(M1)return vh;M1=1;var e=ci(),n=tr(),r=e(n,"WeakMap");return vh=r,vh}var yh,P1;function _o(){if(P1)return yh;P1=1;var e=jq(),n=Kv(),r=Rq(),i=RC(),o=Tq(),l=ui(),u=yC(),c="[object Map]",h="[object Object]",p="[object Promise]",d="[object Set]",m="[object WeakMap]",y="[object DataView]",w=u(e),N=u(n),_=u(r),S=u(i),b=u(o),k=l;return(e&&k(new e(new ArrayBuffer(1)))!=y||n&&k(new n)!=c||r&&k(r.resolve())!=p||i&&k(new i)!=d||o&&k(new o)!=m)&&(k=function(E){var C=l(E),A=C==h?E.constructor:void 0,M=A?u(A):"";if(M)switch(M){case w:return y;case N:return c;case _:return p;case S:return d;case b:return m}return C}),yh=k,yh}var wh,O1;function Aq(){if(O1)return wh;O1=1;var e=Object.prototype,n=e.hasOwnProperty;function r(i){var o=i.length,l=new i.constructor(o);return o&&typeof i[0]=="string"&&n.call(i,"index")&&(l.index=i.index,l.input=i.input),l}return wh=r,wh}var xh,L1;function TC(){if(L1)return xh;L1=1;var e=tr(),n=e.Uint8Array;return xh=n,xh}var _h,q1;function ry(){if(q1)return _h;q1=1;var e=TC();function n(r){var i=new r.constructor(r.byteLength);return new e(i).set(new e(r)),i}return _h=n,_h}var bh,$1;function Iq(){if($1)return bh;$1=1;var e=ry();function n(r,i){var o=i?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.byteLength)}return bh=n,bh}var Sh,D1;function Mq(){if(D1)return Sh;D1=1;var e=/\w*$/;function n(r){var i=new r.constructor(r.source,e.exec(r));return i.lastIndex=r.lastIndex,i}return Sh=n,Sh}var kh,F1;function Pq(){if(F1)return kh;F1=1;var e=wo(),n=e?e.prototype:void 0,r=n?n.valueOf:void 0;function i(o){return r?Object(r.call(o)):{}}return kh=i,kh}var Eh,z1;function AC(){if(z1)return Eh;z1=1;var e=ry();function n(r,i){var o=i?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.length)}return Eh=n,Eh}var Nh,B1;function Oq(){if(B1)return Nh;B1=1;var e=ry(),n=Iq(),r=Mq(),i=Pq(),o=AC(),l="[object Boolean]",u="[object Date]",c="[object Map]",h="[object Number]",p="[object RegExp]",d="[object Set]",m="[object String]",y="[object Symbol]",w="[object ArrayBuffer]",N="[object DataView]",_="[object Float32Array]",S="[object Float64Array]",b="[object Int8Array]",k="[object Int16Array]",E="[object Int32Array]",C="[object Uint8Array]",A="[object Uint8ClampedArray]",M="[object Uint16Array]",L="[object Uint32Array]";function H(O,P,F){var G=O.constructor;switch(P){case w:return e(O);case l:case u:return new G(+O);case N:return n(O,F);case _:case S:case b:case k:case E:case C:case A:case M:case L:return o(O,F);case c:return new G;case h:case m:return new G(O);case p:return r(O);case d:return new G;case y:return i(O)}}return Nh=H,Nh}var Ch,U1;function IC(){if(U1)return Ch;U1=1;var e=Ln(),n=Object.create,r=(function(){function i(){}return function(o){if(!e(o))return{};if(n)return n(o);i.prototype=o;var l=new i;return i.prototype=void 0,l}})();return Ch=r,Ch}var jh,H1;function MC(){if(H1)return jh;H1=1;var e=IC(),n=Du(),r=$u();function i(o){return typeof o.constructor=="function"&&!r(o)?e(n(o)):{}}return jh=i,jh}var Rh,W1;function Lq(){if(W1)return Rh;W1=1;var e=_o(),n=vr(),r="[object Map]";function i(o){return n(o)&&e(o)==r}return Rh=i,Rh}var Th,V1;function qq(){if(V1)return Th;V1=1;var e=Lq(),n=qu(),r=Jv(),i=r&&r.isMap,o=i?n(i):e;return Th=o,Th}var Ah,G1;function $q(){if(G1)return Ah;G1=1;var e=_o(),n=vr(),r="[object Set]";function i(o){return n(o)&&e(o)==r}return Ah=i,Ah}var Ih,Y1;function Dq(){if(Y1)return Ih;Y1=1;var e=$q(),n=qu(),r=Jv(),i=r&&r.isSet,o=i?n(i):e;return Ih=o,Ih}var Mh,K1;function PC(){if(K1)return Mh;K1=1;var e=Mu(),n=Qv(),r=Ou(),i=_q(),o=kq(),l=bC(),u=SC(),c=Eq(),h=Nq(),p=jC(),d=Cq(),m=_o(),y=Aq(),w=Oq(),N=MC(),_=bt(),S=xo(),b=qq(),k=Ln(),E=Dq(),C=ks(),A=di(),M=1,L=2,H=4,O="[object Arguments]",P="[object Array]",F="[object Boolean]",G="[object Date]",q="[object Error]",R="[object Function]",Q="[object GeneratorFunction]",z="[object Map]",ne="[object Number]",Z="[object Object]",$="[object RegExp]",X="[object Set]",I="[object String]",W="[object Symbol]",Y="[object WeakMap]",U="[object ArrayBuffer]",J="[object DataView]",re="[object Float32Array]",le="[object Float64Array]",fe="[object Int8Array]",te="[object Int16Array]",ce="[object Int32Array]",Ce="[object Uint8Array]",ve="[object Uint8ClampedArray]",Te="[object Uint16Array]",ye="[object Uint32Array]",ke={};ke[O]=ke[P]=ke[U]=ke[J]=ke[F]=ke[G]=ke[re]=ke[le]=ke[fe]=ke[te]=ke[ce]=ke[z]=ke[ne]=ke[Z]=ke[$]=ke[X]=ke[I]=ke[W]=ke[Ce]=ke[ve]=ke[Te]=ke[ye]=!0,ke[q]=ke[R]=ke[Y]=!1;function Ge(we,_e,ze,ft,ht,Ue){var De,Ze=_e&M,Ye=_e&L,vt=_e&H;if(ze&&(De=ht?ze(we,ft,ht,Ue):ze(we)),De!==void 0)return De;if(!k(we))return we;var ot=_(we);if(ot){if(De=y(we),!Ze)return u(we,De)}else{var yt=m(we),Kt=yt==R||yt==Q;if(S(we))return l(we,Ze);if(yt==Z||yt==O||Kt&&!ht){if(De=Ye||Kt?{}:N(we),!Ze)return Ye?h(we,o(De,we)):c(we,i(De,we))}else{if(!ke[yt])return ht?we:{};De=w(we,yt,Ze)}}Ue||(Ue=new e);var Mt=Ue.get(we);if(Mt)return Mt;Ue.set(we,De),E(we)?we.forEach(function(pt){De.add(Ge(pt,_e,ze,pt,we,Ue))}):b(we)&&we.forEach(function(pt,mt){De.set(mt,Ge(pt,_e,ze,mt,we,Ue))});var Xe=vt?Ye?d:p:Ye?A:C,wt=ot?void 0:Xe(we);return n(wt||we,function(pt,mt){wt&&(mt=pt,pt=we[mt]),r(De,mt,Ge(pt,_e,ze,mt,we,Ue))}),De}return Mh=Ge,Mh}var Ph,X1;function Fq(){if(X1)return Ph;X1=1;var e=PC(),n=4;function r(i){return e(i,n)}return Ph=r,Ph}var Oh,Q1;function sy(){if(Q1)return Oh;Q1=1;function e(n){return function(){return n}}return Oh=e,Oh}var Lh,Z1;function zq(){if(Z1)return Lh;Z1=1;function e(n){return function(r,i,o){for(var l=-1,u=Object(r),c=o(r),h=c.length;h--;){var p=c[n?h:++l];if(i(u[p],p,u)===!1)break}return r}}return Lh=e,Lh}var qh,J1;function iy(){if(J1)return qh;J1=1;var e=zq(),n=e();return qh=n,qh}var $h,eb;function oy(){if(eb)return $h;eb=1;var e=iy(),n=ks();function r(i,o){return i&&e(i,o,n)}return $h=r,$h}var Dh,tb;function Bq(){if(tb)return Dh;tb=1;var e=Wr();function n(r,i){return function(o,l){if(o==null)return o;if(!e(o))return r(o,l);for(var u=o.length,c=i?u:-1,h=Object(o);(i?c--:++c<u)&&l(h[c],c,h)!==!1;);return o}}return Dh=n,Dh}var Fh,nb;function Fu(){if(nb)return Fh;nb=1;var e=oy(),n=Bq(),r=n(e);return Fh=r,Fh}var zh,rb;function fi(){if(rb)return zh;rb=1;function e(n){return n}return zh=e,zh}var Bh,sb;function OC(){if(sb)return Bh;sb=1;var e=fi();function n(r){return typeof r=="function"?r:e}return Bh=n,Bh}var Uh,ib;function LC(){if(ib)return Uh;ib=1;var e=Qv(),n=Fu(),r=OC(),i=bt();function o(l,u){var c=i(l)?e:n;return c(l,r(u))}return Uh=o,Uh}var Hh,ob;function qC(){return ob||(ob=1,Hh=LC()),Hh}var Wh,ab;function Uq(){if(ab)return Wh;ab=1;var e=Fu();function n(r,i){var o=[];return e(r,function(l,u,c){i(l,u,c)&&o.push(l)}),o}return Wh=n,Wh}var Vh,lb;function Hq(){if(lb)return Vh;lb=1;var e="__lodash_hash_undefined__";function n(r){return this.__data__.set(r,e),this}return Vh=n,Vh}var Gh,ub;function Wq(){if(ub)return Gh;ub=1;function e(n){return this.__data__.has(n)}return Gh=e,Gh}var Yh,cb;function $C(){if(cb)return Yh;cb=1;var e=Xv(),n=Hq(),r=Wq();function i(o){var l=-1,u=o==null?0:o.length;for(this.__data__=new e;++l<u;)this.add(o[l])}return i.prototype.add=i.prototype.push=n,i.prototype.has=r,Yh=i,Yh}var Kh,db;function Vq(){if(db)return Kh;db=1;function e(n,r){for(var i=-1,o=n==null?0:n.length;++i<o;)if(r(n[i],i,n))return!0;return!1}return Kh=e,Kh}var Xh,fb;function DC(){if(fb)return Xh;fb=1;function e(n,r){return n.has(r)}return Xh=e,Xh}var Qh,hb;function FC(){if(hb)return Qh;hb=1;var e=$C(),n=Vq(),r=DC(),i=1,o=2;function l(u,c,h,p,d,m){var y=h&i,w=u.length,N=c.length;if(w!=N&&!(y&&N>w))return!1;var _=m.get(u),S=m.get(c);if(_&&S)return _==c&&S==u;var b=-1,k=!0,E=h&o?new e:void 0;for(m.set(u,c),m.set(c,u);++b<w;){var C=u[b],A=c[b];if(p)var M=y?p(A,C,b,c,u,m):p(C,A,b,u,c,m);if(M!==void 0){if(M)continue;k=!1;break}if(E){if(!n(c,function(L,H){if(!r(E,H)&&(C===L||d(C,L,h,p,m)))return E.push(H)})){k=!1;break}}else if(!(C===A||d(C,A,h,p,m))){k=!1;break}}return m.delete(u),m.delete(c),k}return Qh=l,Qh}var Zh,pb;function Gq(){if(pb)return Zh;pb=1;function e(n){var r=-1,i=Array(n.size);return n.forEach(function(o,l){i[++r]=[l,o]}),i}return Zh=e,Zh}var Jh,mb;function ay(){if(mb)return Jh;mb=1;function e(n){var r=-1,i=Array(n.size);return n.forEach(function(o){i[++r]=o}),i}return Jh=e,Jh}var ep,gb;function Yq(){if(gb)return ep;gb=1;var e=wo(),n=TC(),r=yo(),i=FC(),o=Gq(),l=ay(),u=1,c=2,h="[object Boolean]",p="[object Date]",d="[object Error]",m="[object Map]",y="[object Number]",w="[object RegExp]",N="[object Set]",_="[object String]",S="[object Symbol]",b="[object ArrayBuffer]",k="[object DataView]",E=e?e.prototype:void 0,C=E?E.valueOf:void 0;function A(M,L,H,O,P,F,G){switch(H){case k:if(M.byteLength!=L.byteLength||M.byteOffset!=L.byteOffset)return!1;M=M.buffer,L=L.buffer;case b:return!(M.byteLength!=L.byteLength||!F(new n(M),new n(L)));case h:case p:case y:return r(+M,+L);case d:return M.name==L.name&&M.message==L.message;case w:case _:return M==L+"";case m:var q=o;case N:var R=O&u;if(q||(q=l),M.size!=L.size&&!R)return!1;var Q=G.get(M);if(Q)return Q==L;O|=c,G.set(M,L);var z=i(q(M),q(L),O,P,F,G);return G.delete(M),z;case S:if(C)return C.call(M)==C.call(L)}return!1}return ep=A,ep}var tp,vb;function Kq(){if(vb)return tp;vb=1;var e=jC(),n=1,r=Object.prototype,i=r.hasOwnProperty;function o(l,u,c,h,p,d){var m=c&n,y=e(l),w=y.length,N=e(u),_=N.length;if(w!=_&&!m)return!1;for(var S=w;S--;){var b=y[S];if(!(m?b in u:i.call(u,b)))return!1}var k=d.get(l),E=d.get(u);if(k&&E)return k==u&&E==l;var C=!0;d.set(l,u),d.set(u,l);for(var A=m;++S<w;){b=y[S];var M=l[b],L=u[b];if(h)var H=m?h(L,M,b,u,l,d):h(M,L,b,l,u,d);if(!(H===void 0?M===L||p(M,L,c,h,d):H)){C=!1;break}A||(A=b=="constructor")}if(C&&!A){var O=l.constructor,P=u.constructor;O!=P&&"constructor"in l&&"constructor"in u&&!(typeof O=="function"&&O instanceof O&&typeof P=="function"&&P instanceof P)&&(C=!1)}return d.delete(l),d.delete(u),C}return tp=o,tp}var np,yb;function Xq(){if(yb)return np;yb=1;var e=Mu(),n=FC(),r=Yq(),i=Kq(),o=_o(),l=bt(),u=xo(),c=Fa(),h=1,p="[object Arguments]",d="[object Array]",m="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function N(_,S,b,k,E,C){var A=l(_),M=l(S),L=A?d:o(_),H=M?d:o(S);L=L==p?m:L,H=H==p?m:H;var O=L==m,P=H==m,F=L==H;if(F&&u(_)){if(!u(S))return!1;A=!0,O=!1}if(F&&!O)return C||(C=new e),A||c(_)?n(_,S,b,k,E,C):r(_,S,L,b,k,E,C);if(!(b&h)){var G=O&&w.call(_,"__wrapped__"),q=P&&w.call(S,"__wrapped__");if(G||q){var R=G?_.value():_,Q=q?S.value():S;return C||(C=new e),E(R,Q,b,k,C)}}return F?(C||(C=new e),i(_,S,b,k,E,C)):!1}return np=N,np}var rp,wb;function zC(){if(wb)return rp;wb=1;var e=Xq(),n=vr();function r(i,o,l,u,c){return i===o?!0:i==null||o==null||!n(i)&&!n(o)?i!==i&&o!==o:e(i,o,l,u,r,c)}return rp=r,rp}var sp,xb;function Qq(){if(xb)return sp;xb=1;var e=Mu(),n=zC(),r=1,i=2;function o(l,u,c,h){var p=c.length,d=p,m=!h;if(l==null)return!d;for(l=Object(l);p--;){var y=c[p];if(m&&y[2]?y[1]!==l[y[0]]:!(y[0]in l))return!1}for(;++p<d;){y=c[p];var w=y[0],N=l[w],_=y[1];if(m&&y[2]){if(N===void 0&&!(w in l))return!1}else{var S=new e;if(h)var b=h(N,_,w,l,u,S);if(!(b===void 0?n(_,N,r|i,h,S):b))return!1}}return!0}return sp=o,sp}var ip,_b;function BC(){if(_b)return ip;_b=1;var e=Ln();function n(r){return r===r&&!e(r)}return ip=n,ip}var op,bb;function Zq(){if(bb)return op;bb=1;var e=BC(),n=ks();function r(i){for(var o=n(i),l=o.length;l--;){var u=o[l],c=i[u];o[l]=[u,c,e(c)]}return o}return op=r,op}var ap,Sb;function UC(){if(Sb)return ap;Sb=1;function e(n,r){return function(i){return i==null?!1:i[n]===r&&(r!==void 0||n in Object(i))}}return ap=e,ap}var lp,kb;function Jq(){if(kb)return lp;kb=1;var e=Qq(),n=Zq(),r=UC();function i(o){var l=n(o);return l.length==1&&l[0][2]?r(l[0][0],l[0][1]):function(u){return u===o||e(u,o,l)}}return lp=i,lp}var up,Eb;function bo(){if(Eb)return up;Eb=1;var e=ui(),n=vr(),r="[object Symbol]";function i(o){return typeof o=="symbol"||n(o)&&e(o)==r}return up=i,up}var cp,Nb;function ly(){if(Nb)return cp;Nb=1;var e=bt(),n=bo(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,i=/^\w*$/;function o(l,u){if(e(l))return!1;var c=typeof l;return c=="number"||c=="symbol"||c=="boolean"||l==null||n(l)?!0:i.test(l)||!r.test(l)||u!=null&&l in Object(u)}return cp=o,cp}var dp,Cb;function e$(){if(Cb)return dp;Cb=1;var e=Xv(),n="Expected a function";function r(i,o){if(typeof i!="function"||o!=null&&typeof o!="function")throw new TypeError(n);var l=function(){var u=arguments,c=o?o.apply(this,u):u[0],h=l.cache;if(h.has(c))return h.get(c);var p=i.apply(this,u);return l.cache=h.set(c,p)||h,p};return l.cache=new(r.Cache||e),l}return r.Cache=e,dp=r,dp}var fp,jb;function t$(){if(jb)return fp;jb=1;var e=e$(),n=500;function r(i){var o=e(i,function(u){return l.size===n&&l.clear(),u}),l=o.cache;return o}return fp=r,fp}var hp,Rb;function n$(){if(Rb)return hp;Rb=1;var e=t$(),n=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,i=e(function(o){var l=[];return o.charCodeAt(0)===46&&l.push(""),o.replace(n,function(u,c,h,p){l.push(h?p.replace(r,"$1"):c||u)}),l});return hp=i,hp}var pp,Tb;function zu(){if(Tb)return pp;Tb=1;function e(n,r){for(var i=-1,o=n==null?0:n.length,l=Array(o);++i<o;)l[i]=r(n[i],i,n);return l}return pp=e,pp}var mp,Ab;function r$(){if(Ab)return mp;Ab=1;var e=wo(),n=zu(),r=bt(),i=bo(),o=e?e.prototype:void 0,l=o?o.toString:void 0;function u(c){if(typeof c=="string")return c;if(r(c))return n(c,u)+"";if(i(c))return l?l.call(c):"";var h=c+"";return h=="0"&&1/c==-1/0?"-0":h}return mp=u,mp}var gp,Ib;function HC(){if(Ib)return gp;Ib=1;var e=r$();function n(r){return r==null?"":e(r)}return gp=n,gp}var vp,Mb;function Bu(){if(Mb)return vp;Mb=1;var e=bt(),n=ly(),r=n$(),i=HC();function o(l,u){return e(l)?l:n(l,u)?[l]:r(i(l))}return vp=o,vp}var yp,Pb;function za(){if(Pb)return yp;Pb=1;var e=bo();function n(r){if(typeof r=="string"||e(r))return r;var i=r+"";return i=="0"&&1/r==-1/0?"-0":i}return yp=n,yp}var wp,Ob;function Uu(){if(Ob)return wp;Ob=1;var e=Bu(),n=za();function r(i,o){o=e(o,i);for(var l=0,u=o.length;i!=null&&l<u;)i=i[n(o[l++])];return l&&l==u?i:void 0}return wp=r,wp}var xp,Lb;function s$(){if(Lb)return xp;Lb=1;var e=Uu();function n(r,i,o){var l=r==null?void 0:e(r,i);return l===void 0?o:l}return xp=n,xp}var _p,qb;function i$(){if(qb)return _p;qb=1;function e(n,r){return n!=null&&r in Object(n)}return _p=e,_p}var bp,$b;function WC(){if($b)return bp;$b=1;var e=Bu(),n=Da(),r=bt(),i=Lu(),o=Zv(),l=za();function u(c,h,p){h=e(h,c);for(var d=-1,m=h.length,y=!1;++d<m;){var w=l(h[d]);if(!(y=c!=null&&p(c,w)))break;c=c[w]}return y||++d!=m?y:(m=c==null?0:c.length,!!m&&o(m)&&i(w,m)&&(r(c)||n(c)))}return bp=u,bp}var Sp,Db;function VC(){if(Db)return Sp;Db=1;var e=i$(),n=WC();function r(i,o){return i!=null&&n(i,o,e)}return Sp=r,Sp}var kp,Fb;function o$(){if(Fb)return kp;Fb=1;var e=zC(),n=s$(),r=VC(),i=ly(),o=BC(),l=UC(),u=za(),c=1,h=2;function p(d,m){return i(d)&&o(m)?l(u(d),m):function(y){var w=n(y,d);return w===void 0&&w===m?r(y,d):e(m,w,c|h)}}return kp=p,kp}var Ep,zb;function GC(){if(zb)return Ep;zb=1;function e(n){return function(r){return r==null?void 0:r[n]}}return Ep=e,Ep}var Np,Bb;function a$(){if(Bb)return Np;Bb=1;var e=Uu();function n(r){return function(i){return e(i,r)}}return Np=n,Np}var Cp,Ub;function l$(){if(Ub)return Cp;Ub=1;var e=GC(),n=a$(),r=ly(),i=za();function o(l){return r(l)?e(i(l)):n(l)}return Cp=o,Cp}var jp,Hb;function Vr(){if(Hb)return jp;Hb=1;var e=Jq(),n=o$(),r=fi(),i=bt(),o=l$();function l(u){return typeof u=="function"?u:u==null?r:typeof u=="object"?i(u)?n(u[0],u[1]):e(u):o(u)}return jp=l,jp}var Rp,Wb;function YC(){if(Wb)return Rp;Wb=1;var e=kC(),n=Uq(),r=Vr(),i=bt();function o(l,u){var c=i(l)?e:n;return c(l,r(u,3))}return Rp=o,Rp}var Tp,Vb;function u$(){if(Vb)return Tp;Vb=1;var e=Object.prototype,n=e.hasOwnProperty;function r(i,o){return i!=null&&n.call(i,o)}return Tp=r,Tp}var Ap,Gb;function KC(){if(Gb)return Ap;Gb=1;var e=u$(),n=WC();function r(i,o){return i!=null&&n(i,o,e)}return Ap=r,Ap}var Ip,Yb;function c$(){if(Yb)return Ip;Yb=1;var e=ey(),n=_o(),r=Da(),i=bt(),o=Wr(),l=xo(),u=$u(),c=Fa(),h="[object Map]",p="[object Set]",d=Object.prototype,m=d.hasOwnProperty;function y(w){if(w==null)return!0;if(o(w)&&(i(w)||typeof w=="string"||typeof w.splice=="function"||l(w)||c(w)||r(w)))return!w.length;var N=n(w);if(N==h||N==p)return!w.size;if(u(w))return!e(w).length;for(var _ in w)if(m.call(w,_))return!1;return!0}return Ip=y,Ip}var Mp,Kb;function XC(){if(Kb)return Mp;Kb=1;function e(n){return n===void 0}return Mp=e,Mp}var Pp,Xb;function QC(){if(Xb)return Pp;Xb=1;var e=Fu(),n=Wr();function r(i,o){var l=-1,u=n(i)?Array(i.length):[];return e(i,function(c,h,p){u[++l]=o(c,h,p)}),u}return Pp=r,Pp}var Op,Qb;function ZC(){if(Qb)return Op;Qb=1;var e=zu(),n=Vr(),r=QC(),i=bt();function o(l,u){var c=i(l)?e:r;return c(l,n(u,3))}return Op=o,Op}var Lp,Zb;function d$(){if(Zb)return Lp;Zb=1;function e(n,r,i,o){var l=-1,u=n==null?0:n.length;for(o&&u&&(i=n[++l]);++l<u;)i=r(i,n[l],l,n);return i}return Lp=e,Lp}var qp,Jb;function f$(){if(Jb)return qp;Jb=1;function e(n,r,i,o,l){return l(n,function(u,c,h){i=o?(o=!1,u):r(i,u,c,h)}),i}return qp=e,qp}var $p,eS;function JC(){if(eS)return $p;eS=1;var e=d$(),n=Fu(),r=Vr(),i=f$(),o=bt();function l(u,c,h){var p=o(u)?e:i,d=arguments.length<3;return p(u,r(c,4),h,d,n)}return $p=l,$p}var Dp,tS;function h$(){if(tS)return Dp;tS=1;var e=ui(),n=bt(),r=vr(),i="[object String]";function o(l){return typeof l=="string"||!n(l)&&r(l)&&e(l)==i}return Dp=o,Dp}var Fp,nS;function p$(){if(nS)return Fp;nS=1;var e=GC(),n=e("length");return Fp=n,Fp}var zp,rS;function m$(){if(rS)return zp;rS=1;var e="\\ud800-\\udfff",n="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",o=n+r+i,l="\\ufe0e\\ufe0f",u="\\u200d",c=RegExp("["+u+e+o+l+"]");function h(p){return c.test(p)}return zp=h,zp}var Bp,sS;function g$(){if(sS)return Bp;sS=1;var e="\\ud800-\\udfff",n="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",o=n+r+i,l="\\ufe0e\\ufe0f",u="["+e+"]",c="["+o+"]",h="\\ud83c[\\udffb-\\udfff]",p="(?:"+c+"|"+h+")",d="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",N=p+"?",_="["+l+"]?",S="(?:"+w+"(?:"+[d,m,y].join("|")+")"+_+N+")*",b=_+N+S,k="(?:"+[d+c+"?",c,m,y,u].join("|")+")",E=RegExp(h+"(?="+h+")|"+k+b,"g");function C(A){for(var M=E.lastIndex=0;E.test(A);)++M;return M}return Bp=C,Bp}var Up,iS;function v$(){if(iS)return Up;iS=1;var e=p$(),n=m$(),r=g$();function i(o){return n(o)?r(o):e(o)}return Up=i,Up}var Hp,oS;function y$(){if(oS)return Hp;oS=1;var e=ey(),n=_o(),r=Wr(),i=h$(),o=v$(),l="[object Map]",u="[object Set]";function c(h){if(h==null)return 0;if(r(h))return i(h)?o(h):h.length;var p=n(h);return p==l||p==u?h.size:e(h).length}return Hp=c,Hp}var Wp,aS;function w$(){if(aS)return Wp;aS=1;var e=Qv(),n=IC(),r=oy(),i=Vr(),o=Du(),l=bt(),u=xo(),c=qa(),h=Ln(),p=Fa();function d(m,y,w){var N=l(m),_=N||u(m)||p(m);if(y=i(y,4),w==null){var S=m&&m.constructor;_?w=N?new S:[]:h(m)?w=c(S)?n(o(m)):{}:w={}}return(_?e:r)(m,function(b,k,E){return y(w,b,k,E)}),w}return Wp=d,Wp}var Vp,lS;function x$(){if(lS)return Vp;lS=1;var e=wo(),n=Da(),r=bt(),i=e?e.isConcatSpreadable:void 0;function o(l){return r(l)||n(l)||!!(i&&l&&l[i])}return Vp=o,Vp}var Gp,uS;function uy(){if(uS)return Gp;uS=1;var e=ny(),n=x$();function r(i,o,l,u,c){var h=-1,p=i.length;for(l||(l=n),c||(c=[]);++h<p;){var d=i[h];o>0&&l(d)?o>1?r(d,o-1,l,u,c):e(c,d):u||(c[c.length]=d)}return c}return Gp=r,Gp}var Yp,cS;function _$(){if(cS)return Yp;cS=1;function e(n,r,i){switch(i.length){case 0:return n.call(r);case 1:return n.call(r,i[0]);case 2:return n.call(r,i[0],i[1]);case 3:return n.call(r,i[0],i[1],i[2])}return n.apply(r,i)}return Yp=e,Yp}var Kp,dS;function ej(){if(dS)return Kp;dS=1;var e=_$(),n=Math.max;function r(i,o,l){return o=n(o===void 0?i.length-1:o,0),function(){for(var u=arguments,c=-1,h=n(u.length-o,0),p=Array(h);++c<h;)p[c]=u[o+c];c=-1;for(var d=Array(o+1);++c<o;)d[c]=u[c];return d[o]=l(p),e(i,this,d)}}return Kp=r,Kp}var Xp,fS;function b$(){if(fS)return Xp;fS=1;var e=sy(),n=wC(),r=fi(),i=n?function(o,l){return n(o,"toString",{configurable:!0,enumerable:!1,value:e(l),writable:!0})}:r;return Xp=i,Xp}var Qp,hS;function S$(){if(hS)return Qp;hS=1;var e=800,n=16,r=Date.now;function i(o){var l=0,u=0;return function(){var c=r(),h=n-(c-u);if(u=c,h>0){if(++l>=e)return arguments[0]}else l=0;return o.apply(void 0,arguments)}}return Qp=i,Qp}var Zp,pS;function tj(){if(pS)return Zp;pS=1;var e=b$(),n=S$(),r=n(e);return Zp=r,Zp}var Jp,mS;function Hu(){if(mS)return Jp;mS=1;var e=fi(),n=ej(),r=tj();function i(o,l){return r(n(o,l,e),o+"")}return Jp=i,Jp}var em,gS;function nj(){if(gS)return em;gS=1;function e(n,r,i,o){for(var l=n.length,u=i+(o?1:-1);o?u--:++u<l;)if(r(n[u],u,n))return u;return-1}return em=e,em}var tm,vS;function k$(){if(vS)return tm;vS=1;function e(n){return n!==n}return tm=e,tm}var nm,yS;function E$(){if(yS)return nm;yS=1;function e(n,r,i){for(var o=i-1,l=n.length;++o<l;)if(n[o]===r)return o;return-1}return nm=e,nm}var rm,wS;function N$(){if(wS)return rm;wS=1;var e=nj(),n=k$(),r=E$();function i(o,l,u){return l===l?r(o,l,u):e(o,n,u)}return rm=i,rm}var sm,xS;function C$(){if(xS)return sm;xS=1;var e=N$();function n(r,i){var o=r==null?0:r.length;return!!o&&e(r,i,0)>-1}return sm=n,sm}var im,_S;function j$(){if(_S)return im;_S=1;function e(n,r,i){for(var o=-1,l=n==null?0:n.length;++o<l;)if(i(r,n[o]))return!0;return!1}return im=e,im}var om,bS;function R$(){if(bS)return om;bS=1;function e(){}return om=e,om}var am,SS;function T$(){if(SS)return am;SS=1;var e=RC(),n=R$(),r=ay(),i=1/0,o=e&&1/r(new e([,-0]))[1]==i?function(l){return new e(l)}:n;return am=o,am}var lm,kS;function A$(){if(kS)return lm;kS=1;var e=$C(),n=C$(),r=j$(),i=DC(),o=T$(),l=ay(),u=200;function c(h,p,d){var m=-1,y=n,w=h.length,N=!0,_=[],S=_;if(d)N=!1,y=r;else if(w>=u){var b=p?null:o(h);if(b)return l(b);N=!1,y=i,S=new e}else S=p?[]:_;e:for(;++m<w;){var k=h[m],E=p?p(k):k;if(k=d||k!==0?k:0,N&&E===E){for(var C=S.length;C--;)if(S[C]===E)continue e;p&&S.push(E),_.push(k)}else y(S,E,d)||(S!==_&&S.push(E),_.push(k))}return _}return lm=c,lm}var um,ES;function rj(){if(ES)return um;ES=1;var e=Wr(),n=vr();function r(i){return n(i)&&e(i)}return um=r,um}var cm,NS;function I$(){if(NS)return cm;NS=1;var e=uy(),n=Hu(),r=A$(),i=rj(),o=n(function(l){return r(e(l,1,i,!0))});return cm=o,cm}var dm,CS;function M$(){if(CS)return dm;CS=1;var e=zu();function n(r,i){return e(i,function(o){return r[o]})}return dm=n,dm}var fm,jS;function sj(){if(jS)return fm;jS=1;var e=M$(),n=ks();function r(i){return i==null?[]:e(i,n(i))}return fm=r,fm}var hm,RS;function qn(){if(RS)return hm;RS=1;var e;if(typeof Yv=="function")try{e={clone:Fq(),constant:sy(),each:qC(),filter:YC(),has:KC(),isArray:bt(),isEmpty:c$(),isFunction:qa(),isUndefined:XC(),keys:ks(),map:ZC(),reduce:JC(),size:y$(),transform:w$(),union:I$(),values:sj()}}catch{}return e||(e=window._),hm=e,hm}var pm,TS;function cy(){if(TS)return pm;TS=1;var e=qn();pm=o;var n="\0",r="\0",i="";function o(d){this._isDirected=e.has(d,"directed")?d.directed:!0,this._isMultigraph=e.has(d,"multigraph")?d.multigraph:!1,this._isCompound=e.has(d,"compound")?d.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[r]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}o.prototype._nodeCount=0,o.prototype._edgeCount=0,o.prototype.isDirected=function(){return this._isDirected},o.prototype.isMultigraph=function(){return this._isMultigraph},o.prototype.isCompound=function(){return this._isCompound},o.prototype.setGraph=function(d){return this._label=d,this},o.prototype.graph=function(){return this._label},o.prototype.setDefaultNodeLabel=function(d){return e.isFunction(d)||(d=e.constant(d)),this._defaultNodeLabelFn=d,this},o.prototype.nodeCount=function(){return this._nodeCount},o.prototype.nodes=function(){return e.keys(this._nodes)},o.prototype.sources=function(){var d=this;return e.filter(this.nodes(),function(m){return e.isEmpty(d._in[m])})},o.prototype.sinks=function(){var d=this;return e.filter(this.nodes(),function(m){return e.isEmpty(d._out[m])})},o.prototype.setNodes=function(d,m){var y=arguments,w=this;return e.each(d,function(N){y.length>1?w.setNode(N,m):w.setNode(N)}),this},o.prototype.setNode=function(d,m){return e.has(this._nodes,d)?(arguments.length>1&&(this._nodes[d]=m),this):(this._nodes[d]=arguments.length>1?m:this._defaultNodeLabelFn(d),this._isCompound&&(this._parent[d]=r,this._children[d]={},this._children[r][d]=!0),this._in[d]={},this._preds[d]={},this._out[d]={},this._sucs[d]={},++this._nodeCount,this)},o.prototype.node=function(d){return this._nodes[d]},o.prototype.hasNode=function(d){return e.has(this._nodes,d)},o.prototype.removeNode=function(d){var m=this;if(e.has(this._nodes,d)){var y=function(w){m.removeEdge(m._edgeObjs[w])};delete this._nodes[d],this._isCompound&&(this._removeFromParentsChildList(d),delete this._parent[d],e.each(this.children(d),function(w){m.setParent(w)}),delete this._children[d]),e.each(e.keys(this._in[d]),y),delete this._in[d],delete this._preds[d],e.each(e.keys(this._out[d]),y),delete this._out[d],delete this._sucs[d],--this._nodeCount}return this},o.prototype.setParent=function(d,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(m))m=r;else{m+="";for(var y=m;!e.isUndefined(y);y=this.parent(y))if(y===d)throw new Error("Setting "+m+" as parent of "+d+" would create a cycle");this.setNode(m)}return this.setNode(d),this._removeFromParentsChildList(d),this._parent[d]=m,this._children[m][d]=!0,this},o.prototype._removeFromParentsChildList=function(d){delete this._children[this._parent[d]][d]},o.prototype.parent=function(d){if(this._isCompound){var m=this._parent[d];if(m!==r)return m}},o.prototype.children=function(d){if(e.isUndefined(d)&&(d=r),this._isCompound){var m=this._children[d];if(m)return e.keys(m)}else{if(d===r)return this.nodes();if(this.hasNode(d))return[]}},o.prototype.predecessors=function(d){var m=this._preds[d];if(m)return e.keys(m)},o.prototype.successors=function(d){var m=this._sucs[d];if(m)return e.keys(m)},o.prototype.neighbors=function(d){var m=this.predecessors(d);if(m)return e.union(m,this.successors(d))},o.prototype.isLeaf=function(d){var m;return this.isDirected()?m=this.successors(d):m=this.neighbors(d),m.length===0},o.prototype.filterNodes=function(d){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var y=this;e.each(this._nodes,function(_,S){d(S)&&m.setNode(S,_)}),e.each(this._edgeObjs,function(_){m.hasNode(_.v)&&m.hasNode(_.w)&&m.setEdge(_,y.edge(_))});var w={};function N(_){var S=y.parent(_);return S===void 0||m.hasNode(S)?(w[_]=S,S):S in w?w[S]:N(S)}return this._isCompound&&e.each(m.nodes(),function(_){m.setParent(_,N(_))}),m},o.prototype.setDefaultEdgeLabel=function(d){return e.isFunction(d)||(d=e.constant(d)),this._defaultEdgeLabelFn=d,this},o.prototype.edgeCount=function(){return this._edgeCount},o.prototype.edges=function(){return e.values(this._edgeObjs)},o.prototype.setPath=function(d,m){var y=this,w=arguments;return e.reduce(d,function(N,_){return w.length>1?y.setEdge(N,_,m):y.setEdge(N,_),_}),this},o.prototype.setEdge=function(){var d,m,y,w,N=!1,_=arguments[0];typeof _=="object"&&_!==null&&"v"in _?(d=_.v,m=_.w,y=_.name,arguments.length===2&&(w=arguments[1],N=!0)):(d=_,m=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],N=!0)),d=""+d,m=""+m,e.isUndefined(y)||(y=""+y);var S=c(this._isDirected,d,m,y);if(e.has(this._edgeLabels,S))return N&&(this._edgeLabels[S]=w),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(d),this.setNode(m),this._edgeLabels[S]=N?w:this._defaultEdgeLabelFn(d,m,y);var b=h(this._isDirected,d,m,y);return d=b.v,m=b.w,Object.freeze(b),this._edgeObjs[S]=b,l(this._preds[m],d),l(this._sucs[d],m),this._in[m][S]=b,this._out[d][S]=b,this._edgeCount++,this},o.prototype.edge=function(d,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,m,y);return this._edgeLabels[w]},o.prototype.hasEdge=function(d,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,m,y);return e.has(this._edgeLabels,w)},o.prototype.removeEdge=function(d,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,m,y),N=this._edgeObjs[w];return N&&(d=N.v,m=N.w,delete this._edgeLabels[w],delete this._edgeObjs[w],u(this._preds[m],d),u(this._sucs[d],m),delete this._in[m][w],delete this._out[d][w],this._edgeCount--),this},o.prototype.inEdges=function(d,m){var y=this._in[d];if(y){var w=e.values(y);return m?e.filter(w,function(N){return N.v===m}):w}},o.prototype.outEdges=function(d,m){var y=this._out[d];if(y){var w=e.values(y);return m?e.filter(w,function(N){return N.w===m}):w}},o.prototype.nodeEdges=function(d,m){var y=this.inEdges(d,m);if(y)return y.concat(this.outEdges(d,m))};function l(d,m){d[m]?d[m]++:d[m]=1}function u(d,m){--d[m]||delete d[m]}function c(d,m,y,w){var N=""+m,_=""+y;if(!d&&N>_){var S=N;N=_,_=S}return N+i+_+i+(e.isUndefined(w)?n:w)}function h(d,m,y,w){var N=""+m,_=""+y;if(!d&&N>_){var S=N;N=_,_=S}var b={v:N,w:_};return w&&(b.name=w),b}function p(d,m){return c(d,m.v,m.w,m.name)}return pm}var mm,AS;function P$(){return AS||(AS=1,mm="2.1.8"),mm}var gm,IS;function O$(){return IS||(IS=1,gm={Graph:cy(),version:P$()}),gm}var vm,MS;function L$(){if(MS)return vm;MS=1;var e=qn(),n=cy();vm={write:r,read:l};function r(u){var c={options:{directed:u.isDirected(),multigraph:u.isMultigraph(),compound:u.isCompound()},nodes:i(u),edges:o(u)};return e.isUndefined(u.graph())||(c.value=e.clone(u.graph())),c}function i(u){return e.map(u.nodes(),function(c){var h=u.node(c),p=u.parent(c),d={v:c};return e.isUndefined(h)||(d.value=h),e.isUndefined(p)||(d.parent=p),d})}function o(u){return e.map(u.edges(),function(c){var h=u.edge(c),p={v:c.v,w:c.w};return e.isUndefined(c.name)||(p.name=c.name),e.isUndefined(h)||(p.value=h),p})}function l(u){var c=new n(u.options).setGraph(u.value);return e.each(u.nodes,function(h){c.setNode(h.v,h.value),h.parent&&c.setParent(h.v,h.parent)}),e.each(u.edges,function(h){c.setEdge({v:h.v,w:h.w,name:h.name},h.value)}),c}return vm}var ym,PS;function q$(){if(PS)return ym;PS=1;var e=qn();ym=n;function n(r){var i={},o=[],l;function u(c){e.has(i,c)||(i[c]=!0,l.push(c),e.each(r.successors(c),u),e.each(r.predecessors(c),u))}return e.each(r.nodes(),function(c){l=[],u(c),l.length&&o.push(l)}),o}return ym}var wm,OS;function ij(){if(OS)return wm;OS=1;var e=qn();wm=n;function n(){this._arr=[],this._keyIndices={}}return n.prototype.size=function(){return this._arr.length},n.prototype.keys=function(){return this._arr.map(function(r){return r.key})},n.prototype.has=function(r){return e.has(this._keyIndices,r)},n.prototype.priority=function(r){var i=this._keyIndices[r];if(i!==void 0)return this._arr[i].priority},n.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},n.prototype.add=function(r,i){var o=this._keyIndices;if(r=String(r),!e.has(o,r)){var l=this._arr,u=l.length;return o[r]=u,l.push({key:r,priority:i}),this._decrease(u),!0}return!1},n.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var r=this._arr.pop();return delete this._keyIndices[r.key],this._heapify(0),r.key},n.prototype.decrease=function(r,i){var o=this._keyIndices[r];if(i>this._arr[o].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[o].priority+" New: "+i);this._arr[o].priority=i,this._decrease(o)},n.prototype._heapify=function(r){var i=this._arr,o=2*r,l=o+1,u=r;o<i.length&&(u=i[o].priority<i[u].priority?o:u,l<i.length&&(u=i[l].priority<i[u].priority?l:u),u!==r&&(this._swap(r,u),this._heapify(u)))},n.prototype._decrease=function(r){for(var i=this._arr,o=i[r].priority,l;r!==0&&(l=r>>1,!(i[l].priority<o));)this._swap(r,l),r=l},n.prototype._swap=function(r,i){var o=this._arr,l=this._keyIndices,u=o[r],c=o[i];o[r]=c,o[i]=u,l[c.key]=r,l[u.key]=i},wm}var xm,LS;function oj(){if(LS)return xm;LS=1;var e=qn(),n=ij();xm=i;var r=e.constant(1);function i(l,u,c,h){return o(l,String(u),c||r,h||function(p){return l.outEdges(p)})}function o(l,u,c,h){var p={},d=new n,m,y,w=function(N){var _=N.v!==m?N.v:N.w,S=p[_],b=c(N),k=y.distance+b;if(b<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+N+" Weight: "+b);k<S.distance&&(S.distance=k,S.predecessor=m,d.decrease(_,k))};for(l.nodes().forEach(function(N){var _=N===u?0:Number.POSITIVE_INFINITY;p[N]={distance:_},d.add(N,_)});d.size()>0&&(m=d.removeMin(),y=p[m],y.distance!==Number.POSITIVE_INFINITY);)h(m).forEach(w);return p}return xm}var _m,qS;function $$(){if(qS)return _m;qS=1;var e=oj(),n=qn();_m=r;function r(i,o,l){return n.transform(i.nodes(),function(u,c){u[c]=e(i,c,o,l)},{})}return _m}var bm,$S;function aj(){if($S)return bm;$S=1;var e=qn();bm=n;function n(r){var i=0,o=[],l={},u=[];function c(h){var p=l[h]={onStack:!0,lowlink:i,index:i++};if(o.push(h),r.successors(h).forEach(function(y){e.has(l,y)?l[y].onStack&&(p.lowlink=Math.min(p.lowlink,l[y].index)):(c(y),p.lowlink=Math.min(p.lowlink,l[y].lowlink))}),p.lowlink===p.index){var d=[],m;do m=o.pop(),l[m].onStack=!1,d.push(m);while(h!==m);u.push(d)}}return r.nodes().forEach(function(h){e.has(l,h)||c(h)}),u}return bm}var Sm,DS;function D$(){if(DS)return Sm;DS=1;var e=qn(),n=aj();Sm=r;function r(i){return e.filter(n(i),function(o){return o.length>1||o.length===1&&i.hasEdge(o[0],o[0])})}return Sm}var km,FS;function F$(){if(FS)return km;FS=1;var e=qn();km=r;var n=e.constant(1);function r(o,l,u){return i(o,l||n,u||function(c){return o.outEdges(c)})}function i(o,l,u){var c={},h=o.nodes();return h.forEach(function(p){c[p]={},c[p][p]={distance:0},h.forEach(function(d){p!==d&&(c[p][d]={distance:Number.POSITIVE_INFINITY})}),u(p).forEach(function(d){var m=d.v===p?d.w:d.v,y=l(d);c[p][m]={distance:y,predecessor:p}})}),h.forEach(function(p){var d=c[p];h.forEach(function(m){var y=c[m];h.forEach(function(w){var N=y[p],_=d[w],S=y[w],b=N.distance+_.distance;b<S.distance&&(S.distance=b,S.predecessor=_.predecessor)})})}),c}return km}var Em,zS;function lj(){if(zS)return Em;zS=1;var e=qn();Em=n,n.CycleException=r;function n(i){var o={},l={},u=[];function c(h){if(e.has(l,h))throw new r;e.has(o,h)||(l[h]=!0,o[h]=!0,e.each(i.predecessors(h),c),delete l[h],u.push(h))}if(e.each(i.sinks(),c),e.size(o)!==i.nodeCount())throw new r;return u}function r(){}return r.prototype=new Error,Em}var Nm,BS;function z$(){if(BS)return Nm;BS=1;var e=lj();Nm=n;function n(r){try{e(r)}catch(i){if(i instanceof e.CycleException)return!1;throw i}return!0}return Nm}var Cm,US;function uj(){if(US)return Cm;US=1;var e=qn();Cm=n;function n(i,o,l){e.isArray(o)||(o=[o]);var u=(i.isDirected()?i.successors:i.neighbors).bind(i),c=[],h={};return e.each(o,function(p){if(!i.hasNode(p))throw new Error("Graph does not have node: "+p);r(i,p,l==="post",h,u,c)}),c}function r(i,o,l,u,c,h){e.has(u,o)||(u[o]=!0,l||h.push(o),e.each(c(o),function(p){r(i,p,l,u,c,h)}),l&&h.push(o))}return Cm}var jm,HS;function B$(){if(HS)return jm;HS=1;var e=uj();jm=n;function n(r,i){return e(r,i,"post")}return jm}var Rm,WS;function U$(){if(WS)return Rm;WS=1;var e=uj();Rm=n;function n(r,i){return e(r,i,"pre")}return Rm}var Tm,VS;function H$(){if(VS)return Tm;VS=1;var e=qn(),n=cy(),r=ij();Tm=i;function i(o,l){var u=new n,c={},h=new r,p;function d(y){var w=y.v===p?y.w:y.v,N=h.priority(w);if(N!==void 0){var _=l(y);_<N&&(c[w]=p,h.decrease(w,_))}}if(o.nodeCount()===0)return u;e.each(o.nodes(),function(y){h.add(y,Number.POSITIVE_INFINITY),u.setNode(y)}),h.decrease(o.nodes()[0],0);for(var m=!1;h.size()>0;){if(p=h.removeMin(),e.has(c,p))u.setEdge(p,c[p]);else{if(m)throw new Error("Input graph is not connected: "+o);m=!0}o.nodeEdges(p).forEach(d)}return u}return Tm}var Am,GS;function W$(){return GS||(GS=1,Am={components:q$(),dijkstra:oj(),dijkstraAll:$$(),findCycles:D$(),floydWarshall:F$(),isAcyclic:z$(),postorder:B$(),preorder:U$(),prim:H$(),tarjan:aj(),topsort:lj()}),Am}var Im,YS;function V$(){if(YS)return Im;YS=1;var e=O$();return Im={Graph:e.Graph,json:L$(),alg:W$(),version:e.version},Im}var Mm,KS;function Jn(){if(KS)return Mm;KS=1;var e;if(typeof Yv=="function")try{e=V$()}catch{}return e||(e=window.graphlib),Mm=e,Mm}var Pm,XS;function G$(){if(XS)return Pm;XS=1;var e=PC(),n=1,r=4;function i(o){return e(o,n|r)}return Pm=i,Pm}var Om,QS;function Wu(){if(QS)return Om;QS=1;var e=yo(),n=Wr(),r=Lu(),i=Ln();function o(l,u,c){if(!i(c))return!1;var h=typeof u;return(h=="number"?n(c)&&r(u,c.length):h=="string"&&u in c)?e(c[u],l):!1}return Om=o,Om}var Lm,ZS;function Y$(){if(ZS)return Lm;ZS=1;var e=Hu(),n=yo(),r=Wu(),i=di(),o=Object.prototype,l=o.hasOwnProperty,u=e(function(c,h){c=Object(c);var p=-1,d=h.length,m=d>2?h[2]:void 0;for(m&&r(h[0],h[1],m)&&(d=1);++p<d;)for(var y=h[p],w=i(y),N=-1,_=w.length;++N<_;){var S=w[N],b=c[S];(b===void 0||n(b,o[S])&&!l.call(c,S))&&(c[S]=y[S])}return c});return Lm=u,Lm}var qm,JS;function K$(){if(JS)return qm;JS=1;var e=Vr(),n=Wr(),r=ks();function i(o){return function(l,u,c){var h=Object(l);if(!n(l)){var p=e(u,3);l=r(l),u=function(m){return p(h[m],m,h)}}var d=o(l,u,c);return d>-1?h[p?l[d]:d]:void 0}}return qm=i,qm}var $m,ek;function X$(){if(ek)return $m;ek=1;var e=/\s/;function n(r){for(var i=r.length;i--&&e.test(r.charAt(i)););return i}return $m=n,$m}var Dm,tk;function Q$(){if(tk)return Dm;tk=1;var e=X$(),n=/^\s+/;function r(i){return i&&i.slice(0,e(i)+1).replace(n,"")}return Dm=r,Dm}var Fm,nk;function Z$(){if(nk)return Fm;nk=1;var e=Q$(),n=Ln(),r=bo(),i=NaN,o=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt;function h(p){if(typeof p=="number")return p;if(r(p))return i;if(n(p)){var d=typeof p.valueOf=="function"?p.valueOf():p;p=n(d)?d+"":d}if(typeof p!="string")return p===0?p:+p;p=e(p);var m=l.test(p);return m||u.test(p)?c(p.slice(2),m?2:8):o.test(p)?i:+p}return Fm=h,Fm}var zm,rk;function cj(){if(rk)return zm;rk=1;var e=Z$(),n=1/0,r=17976931348623157e292;function i(o){if(!o)return o===0?o:0;if(o=e(o),o===n||o===-n){var l=o<0?-1:1;return l*r}return o===o?o:0}return zm=i,zm}var Bm,sk;function J$(){if(sk)return Bm;sk=1;var e=cj();function n(r){var i=e(r),o=i%1;return i===i?o?i-o:i:0}return Bm=n,Bm}var Um,ik;function e4(){if(ik)return Um;ik=1;var e=nj(),n=Vr(),r=J$(),i=Math.max;function o(l,u,c){var h=l==null?0:l.length;if(!h)return-1;var p=c==null?0:r(c);return p<0&&(p=i(h+p,0)),e(l,n(u,3),p)}return Um=o,Um}var Hm,ok;function t4(){if(ok)return Hm;ok=1;var e=K$(),n=e4(),r=e(n);return Hm=r,Hm}var Wm,ak;function dj(){if(ak)return Wm;ak=1;var e=uy();function n(r){var i=r==null?0:r.length;return i?e(r,1):[]}return Wm=n,Wm}var Vm,lk;function n4(){if(lk)return Vm;lk=1;var e=iy(),n=OC(),r=di();function i(o,l){return o==null?o:e(o,n(l),r)}return Vm=i,Vm}var Gm,uk;function r4(){if(uk)return Gm;uk=1;function e(n){var r=n==null?0:n.length;return r?n[r-1]:void 0}return Gm=e,Gm}var Ym,ck;function s4(){if(ck)return Ym;ck=1;var e=Pu(),n=oy(),r=Vr();function i(o,l){var u={};return l=r(l,3),n(o,function(c,h,p){e(u,h,l(c,h,p))}),u}return Ym=i,Ym}var Km,dk;function dy(){if(dk)return Km;dk=1;var e=bo();function n(r,i,o){for(var l=-1,u=r.length;++l<u;){var c=r[l],h=i(c);if(h!=null&&(p===void 0?h===h&&!e(h):o(h,p)))var p=h,d=c}return d}return Km=n,Km}var Xm,fk;function i4(){if(fk)return Xm;fk=1;function e(n,r){return n>r}return Xm=e,Xm}var Qm,hk;function o4(){if(hk)return Qm;hk=1;var e=dy(),n=i4(),r=fi();function i(o){return o&&o.length?e(o,r,n):void 0}return Qm=i,Qm}var Zm,pk;function fj(){if(pk)return Zm;pk=1;var e=Pu(),n=yo();function r(i,o,l){(l!==void 0&&!n(i[o],l)||l===void 0&&!(o in i))&&e(i,o,l)}return Zm=r,Zm}var Jm,mk;function a4(){if(mk)return Jm;mk=1;var e=ui(),n=Du(),r=vr(),i="[object Object]",o=Function.prototype,l=Object.prototype,u=o.toString,c=l.hasOwnProperty,h=u.call(Object);function p(d){if(!r(d)||e(d)!=i)return!1;var m=n(d);if(m===null)return!0;var y=c.call(m,"constructor")&&m.constructor;return typeof y=="function"&&y instanceof y&&u.call(y)==h}return Jm=p,Jm}var eg,gk;function hj(){if(gk)return eg;gk=1;function e(n,r){if(!(r==="constructor"&&typeof n[r]=="function")&&r!="__proto__")return n[r]}return eg=e,eg}var tg,vk;function l4(){if(vk)return tg;vk=1;var e=$a(),n=di();function r(i){return e(i,n(i))}return tg=r,tg}var ng,yk;function u4(){if(yk)return ng;yk=1;var e=fj(),n=bC(),r=AC(),i=SC(),o=MC(),l=Da(),u=bt(),c=rj(),h=xo(),p=qa(),d=Ln(),m=a4(),y=Fa(),w=hj(),N=l4();function _(S,b,k,E,C,A,M){var L=w(S,k),H=w(b,k),O=M.get(H);if(O){e(S,k,O);return}var P=A?A(L,H,k+"",S,b,M):void 0,F=P===void 0;if(F){var G=u(H),q=!G&&h(H),R=!G&&!q&&y(H);P=H,G||q||R?u(L)?P=L:c(L)?P=i(L):q?(F=!1,P=n(H,!0)):R?(F=!1,P=r(H,!0)):P=[]:m(H)||l(H)?(P=L,l(L)?P=N(L):(!d(L)||p(L))&&(P=o(H))):F=!1}F&&(M.set(H,P),C(P,H,E,A,M),M.delete(H)),e(S,k,P)}return ng=_,ng}var rg,wk;function c4(){if(wk)return rg;wk=1;var e=Mu(),n=fj(),r=iy(),i=u4(),o=Ln(),l=di(),u=hj();function c(h,p,d,m,y){h!==p&&r(p,function(w,N){if(y||(y=new e),o(w))i(h,p,N,d,c,m,y);else{var _=m?m(u(h,N),w,N+"",h,p,y):void 0;_===void 0&&(_=w),n(h,N,_)}},l)}return rg=c,rg}var sg,xk;function d4(){if(xk)return sg;xk=1;var e=Hu(),n=Wu();function r(i){return e(function(o,l){var u=-1,c=l.length,h=c>1?l[c-1]:void 0,p=c>2?l[2]:void 0;for(h=i.length>3&&typeof h=="function"?(c--,h):void 0,p&&n(l[0],l[1],p)&&(h=c<3?void 0:h,c=1),o=Object(o);++u<c;){var d=l[u];d&&i(o,d,u,h)}return o})}return sg=r,sg}var ig,_k;function f4(){if(_k)return ig;_k=1;var e=c4(),n=d4(),r=n(function(i,o,l){e(i,o,l)});return ig=r,ig}var og,bk;function pj(){if(bk)return og;bk=1;function e(n,r){return n<r}return og=e,og}var ag,Sk;function h4(){if(Sk)return ag;Sk=1;var e=dy(),n=pj(),r=fi();function i(o){return o&&o.length?e(o,r,n):void 0}return ag=i,ag}var lg,kk;function p4(){if(kk)return lg;kk=1;var e=dy(),n=Vr(),r=pj();function i(o,l){return o&&o.length?e(o,n(l,2),r):void 0}return lg=i,lg}var ug,Ek;function m4(){if(Ek)return ug;Ek=1;var e=tr(),n=function(){return e.Date.now()};return ug=n,ug}var cg,Nk;function g4(){if(Nk)return cg;Nk=1;var e=Ou(),n=Bu(),r=Lu(),i=Ln(),o=za();function l(u,c,h,p){if(!i(u))return u;c=n(c,u);for(var d=-1,m=c.length,y=m-1,w=u;w!=null&&++d<m;){var N=o(c[d]),_=h;if(N==="__proto__"||N==="constructor"||N==="prototype")return u;if(d!=y){var S=w[N];_=p?p(S,N,w):void 0,_===void 0&&(_=i(S)?S:r(c[d+1])?[]:{})}e(w,N,_),w=w[N]}return u}return cg=l,cg}var dg,Ck;function v4(){if(Ck)return dg;Ck=1;var e=Uu(),n=g4(),r=Bu();function i(o,l,u){for(var c=-1,h=l.length,p={};++c<h;){var d=l[c],m=e(o,d);u(m,d)&&n(p,r(d,o),m)}return p}return dg=i,dg}var fg,jk;function y4(){if(jk)return fg;jk=1;var e=v4(),n=VC();function r(i,o){return e(i,o,function(l,u){return n(i,u)})}return fg=r,fg}var hg,Rk;function w4(){if(Rk)return hg;Rk=1;var e=dj(),n=ej(),r=tj();function i(o){return r(n(o,void 0,e),o+"")}return hg=i,hg}var pg,Tk;function x4(){if(Tk)return pg;Tk=1;var e=y4(),n=w4(),r=n(function(i,o){return i==null?{}:e(i,o)});return pg=r,pg}var mg,Ak;function _4(){if(Ak)return mg;Ak=1;var e=Math.ceil,n=Math.max;function r(i,o,l,u){for(var c=-1,h=n(e((o-i)/(l||1)),0),p=Array(h);h--;)p[u?h:++c]=i,i+=l;return p}return mg=r,mg}var gg,Ik;function b4(){if(Ik)return gg;Ik=1;var e=_4(),n=Wu(),r=cj();function i(o){return function(l,u,c){return c&&typeof c!="number"&&n(l,u,c)&&(u=c=void 0),l=r(l),u===void 0?(u=l,l=0):u=r(u),c=c===void 0?l<u?1:-1:r(c),e(l,u,c,o)}}return gg=i,gg}var vg,Mk;function S4(){if(Mk)return vg;Mk=1;var e=b4(),n=e();return vg=n,vg}var yg,Pk;function k4(){if(Pk)return yg;Pk=1;function e(n,r){var i=n.length;for(n.sort(r);i--;)n[i]=n[i].value;return n}return yg=e,yg}var wg,Ok;function E4(){if(Ok)return wg;Ok=1;var e=bo();function n(r,i){if(r!==i){var o=r!==void 0,l=r===null,u=r===r,c=e(r),h=i!==void 0,p=i===null,d=i===i,m=e(i);if(!p&&!m&&!c&&r>i||c&&h&&d&&!p&&!m||l&&h&&d||!o&&d||!u)return 1;if(!l&&!c&&!m&&r<i||m&&o&&u&&!l&&!c||p&&o&&u||!h&&u||!d)return-1}return 0}return wg=n,wg}var xg,Lk;function N4(){if(Lk)return xg;Lk=1;var e=E4();function n(r,i,o){for(var l=-1,u=r.criteria,c=i.criteria,h=u.length,p=o.length;++l<h;){var d=e(u[l],c[l]);if(d){if(l>=p)return d;var m=o[l];return d*(m=="desc"?-1:1)}}return r.index-i.index}return xg=n,xg}var _g,qk;function C4(){if(qk)return _g;qk=1;var e=zu(),n=Uu(),r=Vr(),i=QC(),o=k4(),l=qu(),u=N4(),c=fi(),h=bt();function p(d,m,y){m.length?m=e(m,function(_){return h(_)?function(S){return n(S,_.length===1?_[0]:_)}:_}):m=[c];var w=-1;m=e(m,l(r));var N=i(d,function(_,S,b){var k=e(m,function(E){return E(_)});return{criteria:k,index:++w,value:_}});return o(N,function(_,S){return u(_,S,y)})}return _g=p,_g}var bg,$k;function j4(){if($k)return bg;$k=1;var e=uy(),n=C4(),r=Hu(),i=Wu(),o=r(function(l,u){if(l==null)return[];var c=u.length;return c>1&&i(l,u[0],u[1])?u=[]:c>2&&i(u[0],u[1],u[2])&&(u=[u[0]]),n(l,e(u,1),[])});return bg=o,bg}var Sg,Dk;function R4(){if(Dk)return Sg;Dk=1;var e=HC(),n=0;function r(i){var o=++n;return e(i)+o}return Sg=r,Sg}var kg,Fk;function T4(){if(Fk)return kg;Fk=1;function e(n,r,i){for(var o=-1,l=n.length,u=r.length,c={};++o<l;){var h=o<u?r[o]:void 0;i(c,n[o],h)}return c}return kg=e,kg}var Eg,zk;function A4(){if(zk)return Eg;zk=1;var e=Ou(),n=T4();function r(i,o){return n(i||[],o||[],e)}return Eg=r,Eg}var Ng,Bk;function it(){if(Bk)return Ng;Bk=1;var e;if(typeof Yv=="function")try{e={cloneDeep:G$(),constant:sy(),defaults:Y$(),each:qC(),filter:YC(),find:t4(),flatten:dj(),forEach:LC(),forIn:n4(),has:KC(),isUndefined:XC(),last:r4(),map:ZC(),mapValues:s4(),max:o4(),merge:f4(),min:h4(),minBy:p4(),now:m4(),pick:x4(),range:S4(),reduce:JC(),sortBy:j4(),uniqueId:R4(),values:sj(),zipObject:A4()}}catch{}return e||(e=window._),Ng=e,Ng}var Cg,Uk;function I4(){if(Uk)return Cg;Uk=1,Cg=e;function e(){var i={};i._next=i._prev=i,this._sentinel=i}e.prototype.dequeue=function(){var i=this._sentinel,o=i._prev;if(o!==i)return n(o),o},e.prototype.enqueue=function(i){var o=this._sentinel;i._prev&&i._next&&n(i),i._next=o._next,o._next._prev=i,o._next=i,i._prev=o},e.prototype.toString=function(){for(var i=[],o=this._sentinel,l=o._prev;l!==o;)i.push(JSON.stringify(l,r)),l=l._prev;return"["+i.join(", ")+"]"};function n(i){i._prev._next=i._next,i._next._prev=i._prev,delete i._next,delete i._prev}function r(i,o){if(i!=="_next"&&i!=="_prev")return o}return Cg}var jg,Hk;function M4(){if(Hk)return jg;Hk=1;var e=it(),n=Jn().Graph,r=I4();jg=o;var i=e.constant(1);function o(p,d){if(p.nodeCount()<=1)return[];var m=c(p,d||i),y=l(m.graph,m.buckets,m.zeroIdx);return e.flatten(e.map(y,function(w){return p.outEdges(w.v,w.w)}),!0)}function l(p,d,m){for(var y=[],w=d[d.length-1],N=d[0],_;p.nodeCount();){for(;_=N.dequeue();)u(p,d,m,_);for(;_=w.dequeue();)u(p,d,m,_);if(p.nodeCount()){for(var S=d.length-2;S>0;--S)if(_=d[S].dequeue(),_){y=y.concat(u(p,d,m,_,!0));break}}}return y}function u(p,d,m,y,w){var N=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(_){var S=p.edge(_),b=p.node(_.v);w&&N.push({v:_.v,w:_.w}),b.out-=S,h(d,m,b)}),e.forEach(p.outEdges(y.v),function(_){var S=p.edge(_),b=_.w,k=p.node(b);k.in-=S,h(d,m,k)}),p.removeNode(y.v),N}function c(p,d){var m=new n,y=0,w=0;e.forEach(p.nodes(),function(S){m.setNode(S,{v:S,in:0,out:0})}),e.forEach(p.edges(),function(S){var b=m.edge(S.v,S.w)||0,k=d(S),E=b+k;m.setEdge(S.v,S.w,E),w=Math.max(w,m.node(S.v).out+=k),y=Math.max(y,m.node(S.w).in+=k)});var N=e.range(w+y+3).map(function(){return new r}),_=y+1;return e.forEach(m.nodes(),function(S){h(N,_,m.node(S))}),{graph:m,buckets:N,zeroIdx:_}}function h(p,d,m){m.out?m.in?p[m.out-m.in+d].enqueue(m):p[p.length-1].enqueue(m):p[0].enqueue(m)}return jg}var Rg,Wk;function P4(){if(Wk)return Rg;Wk=1;var e=it(),n=M4();Rg={run:r,undo:o};function r(l){var u=l.graph().acyclicer==="greedy"?n(l,c(l)):i(l);e.forEach(u,function(h){var p=l.edge(h);l.removeEdge(h),p.forwardName=h.name,p.reversed=!0,l.setEdge(h.w,h.v,p,e.uniqueId("rev"))});function c(h){return function(p){return h.edge(p).weight}}}function i(l){var u=[],c={},h={};function p(d){e.has(h,d)||(h[d]=!0,c[d]=!0,e.forEach(l.outEdges(d),function(m){e.has(c,m.w)?u.push(m):p(m.w)}),delete c[d])}return e.forEach(l.nodes(),p),u}function o(l){e.forEach(l.edges(),function(u){var c=l.edge(u);if(c.reversed){l.removeEdge(u);var h=c.forwardName;delete c.reversed,delete c.forwardName,l.setEdge(u.w,u.v,c,h)}})}return Rg}var Tg,Vk;function hn(){if(Vk)return Tg;Vk=1;var e=it(),n=Jn().Graph;Tg={addDummyNode:r,simplify:i,asNonCompoundGraph:o,successorWeights:l,predecessorWeights:u,intersectRect:c,buildLayerMatrix:h,normalizeRanks:p,removeEmptyRanks:d,addBorderNode:m,maxRank:y,partition:w,time:N,notime:_};function r(S,b,k,E){var C;do C=e.uniqueId(E);while(S.hasNode(C));return k.dummy=b,S.setNode(C,k),C}function i(S){var b=new n().setGraph(S.graph());return e.forEach(S.nodes(),function(k){b.setNode(k,S.node(k))}),e.forEach(S.edges(),function(k){var E=b.edge(k.v,k.w)||{weight:0,minlen:1},C=S.edge(k);b.setEdge(k.v,k.w,{weight:E.weight+C.weight,minlen:Math.max(E.minlen,C.minlen)})}),b}function o(S){var b=new n({multigraph:S.isMultigraph()}).setGraph(S.graph());return e.forEach(S.nodes(),function(k){S.children(k).length||b.setNode(k,S.node(k))}),e.forEach(S.edges(),function(k){b.setEdge(k,S.edge(k))}),b}function l(S){var b=e.map(S.nodes(),function(k){var E={};return e.forEach(S.outEdges(k),function(C){E[C.w]=(E[C.w]||0)+S.edge(C).weight}),E});return e.zipObject(S.nodes(),b)}function u(S){var b=e.map(S.nodes(),function(k){var E={};return e.forEach(S.inEdges(k),function(C){E[C.v]=(E[C.v]||0)+S.edge(C).weight}),E});return e.zipObject(S.nodes(),b)}function c(S,b){var k=S.x,E=S.y,C=b.x-k,A=b.y-E,M=S.width/2,L=S.height/2;if(!C&&!A)throw new Error("Not possible to find intersection inside of the rectangle");var H,O;return Math.abs(A)*M>Math.abs(C)*L?(A<0&&(L=-L),H=L*C/A,O=L):(C<0&&(M=-M),H=M,O=M*A/C),{x:k+H,y:E+O}}function h(S){var b=e.map(e.range(y(S)+1),function(){return[]});return e.forEach(S.nodes(),function(k){var E=S.node(k),C=E.rank;e.isUndefined(C)||(b[C][E.order]=k)}),b}function p(S){var b=e.min(e.map(S.nodes(),function(k){return S.node(k).rank}));e.forEach(S.nodes(),function(k){var E=S.node(k);e.has(E,"rank")&&(E.rank-=b)})}function d(S){var b=e.min(e.map(S.nodes(),function(A){return S.node(A).rank})),k=[];e.forEach(S.nodes(),function(A){var M=S.node(A).rank-b;k[M]||(k[M]=[]),k[M].push(A)});var E=0,C=S.graph().nodeRankFactor;e.forEach(k,function(A,M){e.isUndefined(A)&&M%C!==0?--E:E&&e.forEach(A,function(L){S.node(L).rank+=E})})}function m(S,b,k,E){var C={width:0,height:0};return arguments.length>=4&&(C.rank=k,C.order=E),r(S,"border",C,b)}function y(S){return e.max(e.map(S.nodes(),function(b){var k=S.node(b).rank;if(!e.isUndefined(k))return k}))}function w(S,b){var k={lhs:[],rhs:[]};return e.forEach(S,function(E){b(E)?k.lhs.push(E):k.rhs.push(E)}),k}function N(S,b){var k=e.now();try{return b()}finally{console.log(S+" time: "+(e.now()-k)+"ms")}}function _(S,b){return b()}return Tg}var Ag,Gk;function O4(){if(Gk)return Ag;Gk=1;var e=it(),n=hn();Ag={run:r,undo:o};function r(l){l.graph().dummyChains=[],e.forEach(l.edges(),function(u){i(l,u)})}function i(l,u){var c=u.v,h=l.node(c).rank,p=u.w,d=l.node(p).rank,m=u.name,y=l.edge(u),w=y.labelRank;if(d!==h+1){l.removeEdge(u);var N,_,S;for(S=0,++h;h<d;++S,++h)y.points=[],_={width:0,height:0,edgeLabel:y,edgeObj:u,rank:h},N=n.addDummyNode(l,"edge",_,"_d"),h===w&&(_.width=y.width,_.height=y.height,_.dummy="edge-label",_.labelpos=y.labelpos),l.setEdge(c,N,{weight:y.weight},m),S===0&&l.graph().dummyChains.push(N),c=N;l.setEdge(c,p,{weight:y.weight},m)}}function o(l){e.forEach(l.graph().dummyChains,function(u){var c=l.node(u),h=c.edgeLabel,p;for(l.setEdge(c.edgeObj,h);c.dummy;)p=l.successors(u)[0],l.removeNode(u),h.points.push({x:c.x,y:c.y}),c.dummy==="edge-label"&&(h.x=c.x,h.y=c.y,h.width=c.width,h.height=c.height),u=p,c=l.node(u)})}return Ag}var Ig,Yk;function wu(){if(Yk)return Ig;Yk=1;var e=it();Ig={longestPath:n,slack:r};function n(i){var o={};function l(u){var c=i.node(u);if(e.has(o,u))return c.rank;o[u]=!0;var h=e.min(e.map(i.outEdges(u),function(p){return l(p.w)-i.edge(p).minlen}));return(h===Number.POSITIVE_INFINITY||h===void 0||h===null)&&(h=0),c.rank=h}e.forEach(i.sources(),l)}function r(i,o){return i.node(o.w).rank-i.node(o.v).rank-i.edge(o).minlen}return Ig}var Mg,Kk;function mj(){if(Kk)return Mg;Kk=1;var e=it(),n=Jn().Graph,r=wu().slack;Mg=i;function i(c){var h=new n({directed:!1}),p=c.nodes()[0],d=c.nodeCount();h.setNode(p,{});for(var m,y;o(h,c)<d;)m=l(h,c),y=h.hasNode(m.v)?r(c,m):-r(c,m),u(h,c,y);return h}function o(c,h){function p(d){e.forEach(h.nodeEdges(d),function(m){var y=m.v,w=d===y?m.w:y;!c.hasNode(w)&&!r(h,m)&&(c.setNode(w,{}),c.setEdge(d,w,{}),p(w))})}return e.forEach(c.nodes(),p),c.nodeCount()}function l(c,h){return e.minBy(h.edges(),function(p){if(c.hasNode(p.v)!==c.hasNode(p.w))return r(h,p)})}function u(c,h,p){e.forEach(c.nodes(),function(d){h.node(d).rank+=p})}return Mg}var Pg,Xk;function L4(){if(Xk)return Pg;Xk=1;var e=it(),n=mj(),r=wu().slack,i=wu().longestPath,o=Jn().alg.preorder,l=Jn().alg.postorder,u=hn().simplify;Pg=c,c.initLowLimValues=m,c.initCutValues=h,c.calcCutValue=d,c.leaveEdge=w,c.enterEdge=N,c.exchangeEdges=_;function c(E){E=u(E),i(E);var C=n(E);m(C),h(C,E);for(var A,M;A=w(C);)M=N(C,E,A),_(C,E,A,M)}function h(E,C){var A=l(E,E.nodes());A=A.slice(0,A.length-1),e.forEach(A,function(M){p(E,C,M)})}function p(E,C,A){var M=E.node(A),L=M.parent;E.edge(A,L).cutvalue=d(E,C,A)}function d(E,C,A){var M=E.node(A),L=M.parent,H=!0,O=C.edge(A,L),P=0;return O||(H=!1,O=C.edge(L,A)),P=O.weight,e.forEach(C.nodeEdges(A),function(F){var G=F.v===A,q=G?F.w:F.v;if(q!==L){var R=G===H,Q=C.edge(F).weight;if(P+=R?Q:-Q,b(E,A,q)){var z=E.edge(A,q).cutvalue;P+=R?-z:z}}}),P}function m(E,C){arguments.length<2&&(C=E.nodes()[0]),y(E,{},1,C)}function y(E,C,A,M,L){var H=A,O=E.node(M);return C[M]=!0,e.forEach(E.neighbors(M),function(P){e.has(C,P)||(A=y(E,C,A,P,M))}),O.low=H,O.lim=A++,L?O.parent=L:delete O.parent,A}function w(E){return e.find(E.edges(),function(C){return E.edge(C).cutvalue<0})}function N(E,C,A){var M=A.v,L=A.w;C.hasEdge(M,L)||(M=A.w,L=A.v);var H=E.node(M),O=E.node(L),P=H,F=!1;H.lim>O.lim&&(P=O,F=!0);var G=e.filter(C.edges(),function(q){return F===k(E,E.node(q.v),P)&&F!==k(E,E.node(q.w),P)});return e.minBy(G,function(q){return r(C,q)})}function _(E,C,A,M){var L=A.v,H=A.w;E.removeEdge(L,H),E.setEdge(M.v,M.w,{}),m(E),h(E,C),S(E,C)}function S(E,C){var A=e.find(E.nodes(),function(L){return!C.node(L).parent}),M=o(E,A);M=M.slice(1),e.forEach(M,function(L){var H=E.node(L).parent,O=C.edge(L,H),P=!1;O||(O=C.edge(H,L),P=!0),C.node(L).rank=C.node(H).rank+(P?O.minlen:-O.minlen)})}function b(E,C,A){return E.hasEdge(C,A)}function k(E,C,A){return A.low<=C.lim&&C.lim<=A.lim}return Pg}var Og,Qk;function q4(){if(Qk)return Og;Qk=1;var e=wu(),n=e.longestPath,r=mj(),i=L4();Og=o;function o(h){switch(h.graph().ranker){case"network-simplex":c(h);break;case"tight-tree":u(h);break;case"longest-path":l(h);break;default:c(h)}}var l=n;function u(h){n(h),r(h)}function c(h){i(h)}return Og}var Lg,Zk;function $4(){if(Zk)return Lg;Zk=1;var e=it();Lg=n;function n(o){var l=i(o);e.forEach(o.graph().dummyChains,function(u){for(var c=o.node(u),h=c.edgeObj,p=r(o,l,h.v,h.w),d=p.path,m=p.lca,y=0,w=d[y],N=!0;u!==h.w;){if(c=o.node(u),N){for(;(w=d[y])!==m&&o.node(w).maxRank<c.rank;)y++;w===m&&(N=!1)}if(!N){for(;y<d.length-1&&o.node(w=d[y+1]).minRank<=c.rank;)y++;w=d[y]}o.setParent(u,w),u=o.successors(u)[0]}})}function r(o,l,u,c){var h=[],p=[],d=Math.min(l[u].low,l[c].low),m=Math.max(l[u].lim,l[c].lim),y,w;y=u;do y=o.parent(y),h.push(y);while(y&&(l[y].low>d||m>l[y].lim));for(w=y,y=c;(y=o.parent(y))!==w;)p.push(y);return{path:h.concat(p.reverse()),lca:w}}function i(o){var l={},u=0;function c(h){var p=u;e.forEach(o.children(h),c),l[h]={low:p,lim:u++}}return e.forEach(o.children(),c),l}return Lg}var qg,Jk;function D4(){if(Jk)return qg;Jk=1;var e=it(),n=hn();qg={run:r,cleanup:u};function r(c){var h=n.addDummyNode(c,"root",{},"_root"),p=o(c),d=e.max(e.values(p))-1,m=2*d+1;c.graph().nestingRoot=h,e.forEach(c.edges(),function(w){c.edge(w).minlen*=m});var y=l(c)+1;e.forEach(c.children(),function(w){i(c,h,m,y,d,p,w)}),c.graph().nodeRankFactor=m}function i(c,h,p,d,m,y,w){var N=c.children(w);if(!N.length){w!==h&&c.setEdge(h,w,{weight:0,minlen:p});return}var _=n.addBorderNode(c,"_bt"),S=n.addBorderNode(c,"_bb"),b=c.node(w);c.setParent(_,w),b.borderTop=_,c.setParent(S,w),b.borderBottom=S,e.forEach(N,function(k){i(c,h,p,d,m,y,k);var E=c.node(k),C=E.borderTop?E.borderTop:k,A=E.borderBottom?E.borderBottom:k,M=E.borderTop?d:2*d,L=C!==A?1:m-y[w]+1;c.setEdge(_,C,{weight:M,minlen:L,nestingEdge:!0}),c.setEdge(A,S,{weight:M,minlen:L,nestingEdge:!0})}),c.parent(w)||c.setEdge(h,_,{weight:0,minlen:m+y[w]})}function o(c){var h={};function p(d,m){var y=c.children(d);y&&y.length&&e.forEach(y,function(w){p(w,m+1)}),h[d]=m}return e.forEach(c.children(),function(d){p(d,1)}),h}function l(c){return e.reduce(c.edges(),function(h,p){return h+c.edge(p).weight},0)}function u(c){var h=c.graph();c.removeNode(h.nestingRoot),delete h.nestingRoot,e.forEach(c.edges(),function(p){var d=c.edge(p);d.nestingEdge&&c.removeEdge(p)})}return qg}var $g,eE;function F4(){if(eE)return $g;eE=1;var e=it(),n=hn();$g=r;function r(o){function l(u){var c=o.children(u),h=o.node(u);if(c.length&&e.forEach(c,l),e.has(h,"minRank")){h.borderLeft=[],h.borderRight=[];for(var p=h.minRank,d=h.maxRank+1;p<d;++p)i(o,"borderLeft","_bl",u,h,p),i(o,"borderRight","_br",u,h,p)}}e.forEach(o.children(),l)}function i(o,l,u,c,h,p){var d={width:0,height:0,rank:p,borderType:l},m=h[l][p-1],y=n.addDummyNode(o,"border",d,u);h[l][p]=y,o.setParent(y,c),m&&o.setEdge(m,y,{weight:1})}return $g}var Dg,tE;function z4(){if(tE)return Dg;tE=1;var e=it();Dg={adjust:n,undo:r};function n(p){var d=p.graph().rankdir.toLowerCase();(d==="lr"||d==="rl")&&i(p)}function r(p){var d=p.graph().rankdir.toLowerCase();(d==="bt"||d==="rl")&&l(p),(d==="lr"||d==="rl")&&(c(p),i(p))}function i(p){e.forEach(p.nodes(),function(d){o(p.node(d))}),e.forEach(p.edges(),function(d){o(p.edge(d))})}function o(p){var d=p.width;p.width=p.height,p.height=d}function l(p){e.forEach(p.nodes(),function(d){u(p.node(d))}),e.forEach(p.edges(),function(d){var m=p.edge(d);e.forEach(m.points,u),e.has(m,"y")&&u(m)})}function u(p){p.y=-p.y}function c(p){e.forEach(p.nodes(),function(d){h(p.node(d))}),e.forEach(p.edges(),function(d){var m=p.edge(d);e.forEach(m.points,h),e.has(m,"x")&&h(m)})}function h(p){var d=p.x;p.x=p.y,p.y=d}return Dg}var Fg,nE;function B4(){if(nE)return Fg;nE=1;var e=it();Fg=n;function n(r){var i={},o=e.filter(r.nodes(),function(p){return!r.children(p).length}),l=e.max(e.map(o,function(p){return r.node(p).rank})),u=e.map(e.range(l+1),function(){return[]});function c(p){if(!e.has(i,p)){i[p]=!0;var d=r.node(p);u[d.rank].push(p),e.forEach(r.successors(p),c)}}var h=e.sortBy(o,function(p){return r.node(p).rank});return e.forEach(h,c),u}return Fg}var zg,rE;function U4(){if(rE)return zg;rE=1;var e=it();zg=n;function n(i,o){for(var l=0,u=1;u<o.length;++u)l+=r(i,o[u-1],o[u]);return l}function r(i,o,l){for(var u=e.zipObject(l,e.map(l,function(y,w){return w})),c=e.flatten(e.map(o,function(y){return e.sortBy(e.map(i.outEdges(y),function(w){return{pos:u[w.w],weight:i.edge(w).weight}}),"pos")}),!0),h=1;h<l.length;)h<<=1;var p=2*h-1;h-=1;var d=e.map(new Array(p),function(){return 0}),m=0;return e.forEach(c.forEach(function(y){var w=y.pos+h;d[w]+=y.weight;for(var N=0;w>0;)w%2&&(N+=d[w+1]),w=w-1>>1,d[w]+=y.weight;m+=y.weight*N})),m}return zg}var Bg,sE;function H4(){if(sE)return Bg;sE=1;var e=it();Bg=n;function n(r,i){return e.map(i,function(o){var l=r.inEdges(o);if(l.length){var u=e.reduce(l,function(c,h){var p=r.edge(h),d=r.node(h.v);return{sum:c.sum+p.weight*d.order,weight:c.weight+p.weight}},{sum:0,weight:0});return{v:o,barycenter:u.sum/u.weight,weight:u.weight}}else return{v:o}})}return Bg}var Ug,iE;function W4(){if(iE)return Ug;iE=1;var e=it();Ug=n;function n(o,l){var u={};e.forEach(o,function(h,p){var d=u[h.v]={indegree:0,in:[],out:[],vs:[h.v],i:p};e.isUndefined(h.barycenter)||(d.barycenter=h.barycenter,d.weight=h.weight)}),e.forEach(l.edges(),function(h){var p=u[h.v],d=u[h.w];!e.isUndefined(p)&&!e.isUndefined(d)&&(d.indegree++,p.out.push(u[h.w]))});var c=e.filter(u,function(h){return!h.indegree});return r(c)}function r(o){var l=[];function u(p){return function(d){d.merged||(e.isUndefined(d.barycenter)||e.isUndefined(p.barycenter)||d.barycenter>=p.barycenter)&&i(p,d)}}function c(p){return function(d){d.in.push(p),--d.indegree===0&&o.push(d)}}for(;o.length;){var h=o.pop();l.push(h),e.forEach(h.in.reverse(),u(h)),e.forEach(h.out,c(h))}return e.map(e.filter(l,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function i(o,l){var u=0,c=0;o.weight&&(u+=o.barycenter*o.weight,c+=o.weight),l.weight&&(u+=l.barycenter*l.weight,c+=l.weight),o.vs=l.vs.concat(o.vs),o.barycenter=u/c,o.weight=c,o.i=Math.min(l.i,o.i),l.merged=!0}return Ug}var Hg,oE;function V4(){if(oE)return Hg;oE=1;var e=it(),n=hn();Hg=r;function r(l,u){var c=n.partition(l,function(_){return e.has(_,"barycenter")}),h=c.lhs,p=e.sortBy(c.rhs,function(_){return-_.i}),d=[],m=0,y=0,w=0;h.sort(o(!!u)),w=i(d,p,w),e.forEach(h,function(_){w+=_.vs.length,d.push(_.vs),m+=_.barycenter*_.weight,y+=_.weight,w=i(d,p,w)});var N={vs:e.flatten(d,!0)};return y&&(N.barycenter=m/y,N.weight=y),N}function i(l,u,c){for(var h;u.length&&(h=e.last(u)).i<=c;)u.pop(),l.push(h.vs),c++;return c}function o(l){return function(u,c){return u.barycenter<c.barycenter?-1:u.barycenter>c.barycenter?1:l?c.i-u.i:u.i-c.i}}return Hg}var Wg,aE;function G4(){if(aE)return Wg;aE=1;var e=it(),n=H4(),r=W4(),i=V4();Wg=o;function o(c,h,p,d){var m=c.children(h),y=c.node(h),w=y?y.borderLeft:void 0,N=y?y.borderRight:void 0,_={};w&&(m=e.filter(m,function(A){return A!==w&&A!==N}));var S=n(c,m);e.forEach(S,function(A){if(c.children(A.v).length){var M=o(c,A.v,p,d);_[A.v]=M,e.has(M,"barycenter")&&u(A,M)}});var b=r(S,p);l(b,_);var k=i(b,d);if(w&&(k.vs=e.flatten([w,k.vs,N],!0),c.predecessors(w).length)){var E=c.node(c.predecessors(w)[0]),C=c.node(c.predecessors(N)[0]);e.has(k,"barycenter")||(k.barycenter=0,k.weight=0),k.barycenter=(k.barycenter*k.weight+E.order+C.order)/(k.weight+2),k.weight+=2}return k}function l(c,h){e.forEach(c,function(p){p.vs=e.flatten(p.vs.map(function(d){return h[d]?h[d].vs:d}),!0)})}function u(c,h){e.isUndefined(c.barycenter)?(c.barycenter=h.barycenter,c.weight=h.weight):(c.barycenter=(c.barycenter*c.weight+h.barycenter*h.weight)/(c.weight+h.weight),c.weight+=h.weight)}return Wg}var Vg,lE;function Y4(){if(lE)return Vg;lE=1;var e=it(),n=Jn().Graph;Vg=r;function r(o,l,u){var c=i(o),h=new n({compound:!0}).setGraph({root:c}).setDefaultNodeLabel(function(p){return o.node(p)});return e.forEach(o.nodes(),function(p){var d=o.node(p),m=o.parent(p);(d.rank===l||d.minRank<=l&&l<=d.maxRank)&&(h.setNode(p),h.setParent(p,m||c),e.forEach(o[u](p),function(y){var w=y.v===p?y.w:y.v,N=h.edge(w,p),_=e.isUndefined(N)?0:N.weight;h.setEdge(w,p,{weight:o.edge(y).weight+_})}),e.has(d,"minRank")&&h.setNode(p,{borderLeft:d.borderLeft[l],borderRight:d.borderRight[l]}))}),h}function i(o){for(var l;o.hasNode(l=e.uniqueId("_root")););return l}return Vg}var Gg,uE;function K4(){if(uE)return Gg;uE=1;var e=it();Gg=n;function n(r,i,o){var l={},u;e.forEach(o,function(c){for(var h=r.parent(c),p,d;h;){if(p=r.parent(h),p?(d=l[p],l[p]=h):(d=u,u=h),d&&d!==h){i.setEdge(d,h);return}h=p}})}return Gg}var Yg,cE;function X4(){if(cE)return Yg;cE=1;var e=it(),n=B4(),r=U4(),i=G4(),o=Y4(),l=K4(),u=Jn().Graph,c=hn();Yg=h;function h(y){var w=c.maxRank(y),N=p(y,e.range(1,w+1),"inEdges"),_=p(y,e.range(w-1,-1,-1),"outEdges"),S=n(y);m(y,S);for(var b=Number.POSITIVE_INFINITY,k,E=0,C=0;C<4;++E,++C){d(E%2?N:_,E%4>=2),S=c.buildLayerMatrix(y);var A=r(y,S);A<b&&(C=0,k=e.cloneDeep(S),b=A)}m(y,k)}function p(y,w,N){return e.map(w,function(_){return o(y,_,N)})}function d(y,w){var N=new u;e.forEach(y,function(_){var S=_.graph().root,b=i(_,S,N,w);e.forEach(b.vs,function(k,E){_.node(k).order=E}),l(_,N,b.vs)})}function m(y,w){e.forEach(w,function(N){e.forEach(N,function(_,S){y.node(_).order=S})})}return Yg}var Kg,dE;function Q4(){if(dE)return Kg;dE=1;var e=it(),n=Jn().Graph,r=hn();Kg={positionX:N,findType1Conflicts:i,findType2Conflicts:o,addConflict:u,hasConflict:c,verticalAlignment:h,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:m,balance:w};function i(b,k){var E={};function C(A,M){var L=0,H=0,O=A.length,P=e.last(M);return e.forEach(M,function(F,G){var q=l(b,F),R=q?b.node(q).order:O;(q||F===P)&&(e.forEach(M.slice(H,G+1),function(Q){e.forEach(b.predecessors(Q),function(z){var ne=b.node(z),Z=ne.order;(Z<L||R<Z)&&!(ne.dummy&&b.node(Q).dummy)&&u(E,z,Q)})}),H=G+1,L=R)}),M}return e.reduce(k,C),E}function o(b,k){var E={};function C(M,L,H,O,P){var F;e.forEach(e.range(L,H),function(G){F=M[G],b.node(F).dummy&&e.forEach(b.predecessors(F),function(q){var R=b.node(q);R.dummy&&(R.order<O||R.order>P)&&u(E,q,F)})})}function A(M,L){var H=-1,O,P=0;return e.forEach(L,function(F,G){if(b.node(F).dummy==="border"){var q=b.predecessors(F);q.length&&(O=b.node(q[0]).order,C(L,P,G,H,O),P=G,H=O)}C(L,P,L.length,O,M.length)}),L}return e.reduce(k,A),E}function l(b,k){if(b.node(k).dummy)return e.find(b.predecessors(k),function(E){return b.node(E).dummy})}function u(b,k,E){if(k>E){var C=k;k=E,E=C}var A=b[k];A||(b[k]=A={}),A[E]=!0}function c(b,k,E){if(k>E){var C=k;k=E,E=C}return e.has(b[k],E)}function h(b,k,E,C){var A={},M={},L={};return e.forEach(k,function(H){e.forEach(H,function(O,P){A[O]=O,M[O]=O,L[O]=P})}),e.forEach(k,function(H){var O=-1;e.forEach(H,function(P){var F=C(P);if(F.length){F=e.sortBy(F,function(z){return L[z]});for(var G=(F.length-1)/2,q=Math.floor(G),R=Math.ceil(G);q<=R;++q){var Q=F[q];M[P]===P&&O<L[Q]&&!c(E,P,Q)&&(M[Q]=P,M[P]=A[P]=A[Q],O=L[Q])}}})}),{root:A,align:M}}function p(b,k,E,C,A){var M={},L=d(b,k,E,A),H=A?"borderLeft":"borderRight";function O(G,q){for(var R=L.nodes(),Q=R.pop(),z={};Q;)z[Q]?G(Q):(z[Q]=!0,R.push(Q),R=R.concat(q(Q))),Q=R.pop()}function P(G){M[G]=L.inEdges(G).reduce(function(q,R){return Math.max(q,M[R.v]+L.edge(R))},0)}function F(G){var q=L.outEdges(G).reduce(function(Q,z){return Math.min(Q,M[z.w]-L.edge(z))},Number.POSITIVE_INFINITY),R=b.node(G);q!==Number.POSITIVE_INFINITY&&R.borderType!==H&&(M[G]=Math.max(M[G],q))}return O(P,L.predecessors.bind(L)),O(F,L.successors.bind(L)),e.forEach(C,function(G){M[G]=M[E[G]]}),M}function d(b,k,E,C){var A=new n,M=b.graph(),L=_(M.nodesep,M.edgesep,C);return e.forEach(k,function(H){var O;e.forEach(H,function(P){var F=E[P];if(A.setNode(F),O){var G=E[O],q=A.edge(G,F);A.setEdge(G,F,Math.max(L(b,P,O),q||0))}O=P})}),A}function m(b,k){return e.minBy(e.values(k),function(E){var C=Number.NEGATIVE_INFINITY,A=Number.POSITIVE_INFINITY;return e.forIn(E,function(M,L){var H=S(b,L)/2;C=Math.max(M+H,C),A=Math.min(M-H,A)}),C-A})}function y(b,k){var E=e.values(k),C=e.min(E),A=e.max(E);e.forEach(["u","d"],function(M){e.forEach(["l","r"],function(L){var H=M+L,O=b[H],P;if(O!==k){var F=e.values(O);P=L==="l"?C-e.min(F):A-e.max(F),P&&(b[H]=e.mapValues(O,function(G){return G+P}))}})})}function w(b,k){return e.mapValues(b.ul,function(E,C){if(k)return b[k.toLowerCase()][C];var A=e.sortBy(e.map(b,C));return(A[1]+A[2])/2})}function N(b){var k=r.buildLayerMatrix(b),E=e.merge(i(b,k),o(b,k)),C={},A;e.forEach(["u","d"],function(L){A=L==="u"?k:e.values(k).reverse(),e.forEach(["l","r"],function(H){H==="r"&&(A=e.map(A,function(G){return e.values(G).reverse()}));var O=(L==="u"?b.predecessors:b.successors).bind(b),P=h(b,A,E,O),F=p(b,A,P.root,P.align,H==="r");H==="r"&&(F=e.mapValues(F,function(G){return-G})),C[L+H]=F})});var M=m(b,C);return y(C,M),w(C,b.graph().align)}function _(b,k,E){return function(C,A,M){var L=C.node(A),H=C.node(M),O=0,P;if(O+=L.width/2,e.has(L,"labelpos"))switch(L.labelpos.toLowerCase()){case"l":P=-L.width/2;break;case"r":P=L.width/2;break}if(P&&(O+=E?P:-P),P=0,O+=(L.dummy?k:b)/2,O+=(H.dummy?k:b)/2,O+=H.width/2,e.has(H,"labelpos"))switch(H.labelpos.toLowerCase()){case"l":P=H.width/2;break;case"r":P=-H.width/2;break}return P&&(O+=E?P:-P),P=0,O}}function S(b,k){return b.node(k).width}return Kg}var Xg,fE;function Z4(){if(fE)return Xg;fE=1;var e=it(),n=hn(),r=Q4().positionX;Xg=i;function i(l){l=n.asNonCompoundGraph(l),o(l),e.forEach(r(l),function(u,c){l.node(c).x=u})}function o(l){var u=n.buildLayerMatrix(l),c=l.graph().ranksep,h=0;e.forEach(u,function(p){var d=e.max(e.map(p,function(m){return l.node(m).height}));e.forEach(p,function(m){l.node(m).y=h+d/2}),h+=d+c})}return Xg}var Qg,hE;function J4(){if(hE)return Qg;hE=1;var e=it(),n=P4(),r=O4(),i=q4(),o=hn().normalizeRanks,l=$4(),u=hn().removeEmptyRanks,c=D4(),h=F4(),p=z4(),d=X4(),m=Z4(),y=hn(),w=Jn().Graph;Qg=N;function N(U,J){var re=J&&J.debugTiming?y.time:y.notime;re("layout",function(){var le=re(" buildLayoutGraph",function(){return O(U)});re(" runLayout",function(){_(le,re)}),re(" updateInputGraph",function(){S(U,le)})})}function _(U,J){J(" makeSpaceForEdgeLabels",function(){P(U)}),J(" removeSelfEdges",function(){$(U)}),J(" acyclic",function(){n.run(U)}),J(" nestingGraph.run",function(){c.run(U)}),J(" rank",function(){i(y.asNonCompoundGraph(U))}),J(" injectEdgeLabelProxies",function(){F(U)}),J(" removeEmptyRanks",function(){u(U)}),J(" nestingGraph.cleanup",function(){c.cleanup(U)}),J(" normalizeRanks",function(){o(U)}),J(" assignRankMinMax",function(){G(U)}),J(" removeEdgeLabelProxies",function(){q(U)}),J(" normalize.run",function(){r.run(U)}),J(" parentDummyChains",function(){l(U)}),J(" addBorderSegments",function(){h(U)}),J(" order",function(){d(U)}),J(" insertSelfEdges",function(){X(U)}),J(" adjustCoordinateSystem",function(){p.adjust(U)}),J(" position",function(){m(U)}),J(" positionSelfEdges",function(){I(U)}),J(" removeBorderNodes",function(){Z(U)}),J(" normalize.undo",function(){r.undo(U)}),J(" fixupEdgeLabelCoords",function(){z(U)}),J(" undoCoordinateSystem",function(){p.undo(U)}),J(" translateGraph",function(){R(U)}),J(" assignNodeIntersects",function(){Q(U)}),J(" reversePoints",function(){ne(U)}),J(" acyclic.undo",function(){n.undo(U)})}function S(U,J){e.forEach(U.nodes(),function(re){var le=U.node(re),fe=J.node(re);le&&(le.x=fe.x,le.y=fe.y,J.children(re).length&&(le.width=fe.width,le.height=fe.height))}),e.forEach(U.edges(),function(re){var le=U.edge(re),fe=J.edge(re);le.points=fe.points,e.has(fe,"x")&&(le.x=fe.x,le.y=fe.y)}),U.graph().width=J.graph().width,U.graph().height=J.graph().height}var b=["nodesep","edgesep","ranksep","marginx","marginy"],k={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},E=["acyclicer","ranker","rankdir","align"],C=["width","height"],A={width:0,height:0},M=["minlen","weight","width","height","labeloffset"],L={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},H=["labelpos"];function O(U){var J=new w({multigraph:!0,compound:!0}),re=Y(U.graph());return J.setGraph(e.merge({},k,W(re,b),e.pick(re,E))),e.forEach(U.nodes(),function(le){var fe=Y(U.node(le));J.setNode(le,e.defaults(W(fe,C),A)),J.setParent(le,U.parent(le))}),e.forEach(U.edges(),function(le){var fe=Y(U.edge(le));J.setEdge(le,e.merge({},L,W(fe,M),e.pick(fe,H)))}),J}function P(U){var J=U.graph();J.ranksep/=2,e.forEach(U.edges(),function(re){var le=U.edge(re);le.minlen*=2,le.labelpos.toLowerCase()!=="c"&&(J.rankdir==="TB"||J.rankdir==="BT"?le.width+=le.labeloffset:le.height+=le.labeloffset)})}function F(U){e.forEach(U.edges(),function(J){var re=U.edge(J);if(re.width&&re.height){var le=U.node(J.v),fe=U.node(J.w),te={rank:(fe.rank-le.rank)/2+le.rank,e:J};y.addDummyNode(U,"edge-proxy",te,"_ep")}})}function G(U){var J=0;e.forEach(U.nodes(),function(re){var le=U.node(re);le.borderTop&&(le.minRank=U.node(le.borderTop).rank,le.maxRank=U.node(le.borderBottom).rank,J=e.max(J,le.maxRank))}),U.graph().maxRank=J}function q(U){e.forEach(U.nodes(),function(J){var re=U.node(J);re.dummy==="edge-proxy"&&(U.edge(re.e).labelRank=re.rank,U.removeNode(J))})}function R(U){var J=Number.POSITIVE_INFINITY,re=0,le=Number.POSITIVE_INFINITY,fe=0,te=U.graph(),ce=te.marginx||0,Ce=te.marginy||0;function ve(Te){var ye=Te.x,ke=Te.y,Ge=Te.width,we=Te.height;J=Math.min(J,ye-Ge/2),re=Math.max(re,ye+Ge/2),le=Math.min(le,ke-we/2),fe=Math.max(fe,ke+we/2)}e.forEach(U.nodes(),function(Te){ve(U.node(Te))}),e.forEach(U.edges(),function(Te){var ye=U.edge(Te);e.has(ye,"x")&&ve(ye)}),J-=ce,le-=Ce,e.forEach(U.nodes(),function(Te){var ye=U.node(Te);ye.x-=J,ye.y-=le}),e.forEach(U.edges(),function(Te){var ye=U.edge(Te);e.forEach(ye.points,function(ke){ke.x-=J,ke.y-=le}),e.has(ye,"x")&&(ye.x-=J),e.has(ye,"y")&&(ye.y-=le)}),te.width=re-J+ce,te.height=fe-le+Ce}function Q(U){e.forEach(U.edges(),function(J){var re=U.edge(J),le=U.node(J.v),fe=U.node(J.w),te,ce;re.points?(te=re.points[0],ce=re.points[re.points.length-1]):(re.points=[],te=fe,ce=le),re.points.unshift(y.intersectRect(le,te)),re.points.push(y.intersectRect(fe,ce))})}function z(U){e.forEach(U.edges(),function(J){var re=U.edge(J);if(e.has(re,"x"))switch((re.labelpos==="l"||re.labelpos==="r")&&(re.width-=re.labeloffset),re.labelpos){case"l":re.x-=re.width/2+re.labeloffset;break;case"r":re.x+=re.width/2+re.labeloffset;break}})}function ne(U){e.forEach(U.edges(),function(J){var re=U.edge(J);re.reversed&&re.points.reverse()})}function Z(U){e.forEach(U.nodes(),function(J){if(U.children(J).length){var re=U.node(J),le=U.node(re.borderTop),fe=U.node(re.borderBottom),te=U.node(e.last(re.borderLeft)),ce=U.node(e.last(re.borderRight));re.width=Math.abs(ce.x-te.x),re.height=Math.abs(fe.y-le.y),re.x=te.x+re.width/2,re.y=le.y+re.height/2}}),e.forEach(U.nodes(),function(J){U.node(J).dummy==="border"&&U.removeNode(J)})}function $(U){e.forEach(U.edges(),function(J){if(J.v===J.w){var re=U.node(J.v);re.selfEdges||(re.selfEdges=[]),re.selfEdges.push({e:J,label:U.edge(J)}),U.removeEdge(J)}})}function X(U){var J=y.buildLayerMatrix(U);e.forEach(J,function(re){var le=0;e.forEach(re,function(fe,te){var ce=U.node(fe);ce.order=te+le,e.forEach(ce.selfEdges,function(Ce){y.addDummyNode(U,"selfedge",{width:Ce.label.width,height:Ce.label.height,rank:ce.rank,order:te+ ++le,e:Ce.e,label:Ce.label},"_se")}),delete ce.selfEdges})})}function I(U){e.forEach(U.nodes(),function(J){var re=U.node(J);if(re.dummy==="selfedge"){var le=U.node(re.e.v),fe=le.x+le.width/2,te=le.y,ce=re.x-fe,Ce=le.height/2;U.setEdge(re.e,re.label),U.removeNode(J),re.label.points=[{x:fe+2*ce/3,y:te-Ce},{x:fe+5*ce/6,y:te-Ce},{x:fe+ce,y:te},{x:fe+5*ce/6,y:te+Ce},{x:fe+2*ce/3,y:te+Ce}],re.label.x=re.x,re.label.y=re.y}})}function W(U,J){return e.mapValues(e.pick(U,J),Number)}function Y(U){var J={};return e.forEach(U,function(re,le){J[le.toLowerCase()]=re}),J}return Qg}var Zg,pE;function eD(){if(pE)return Zg;pE=1;var e=it(),n=hn(),r=Jn().Graph;Zg={debugOrdering:i};function i(o){var l=n.buildLayerMatrix(o),u=new r({compound:!0,multigraph:!0}).setGraph({});return e.forEach(o.nodes(),function(c){u.setNode(c,{label:c}),u.setParent(c,"layer"+o.node(c).rank)}),e.forEach(o.edges(),function(c){u.setEdge(c.v,c.w,{},c.name)}),e.forEach(l,function(c,h){var p="layer"+h;u.setNode(p,{rank:"same"}),e.reduce(c,function(d,m){return u.setEdge(d,m,{style:"invis"}),m})}),u}return Zg}var Jg,mE;function tD(){return mE||(mE=1,Jg="0.8.5"),Jg}var ev,gE;function nD(){return gE||(gE=1,ev={graphlib:Jn(),layout:J4(),debug:eD(),util:{time:hn().time,notime:hn().notime},version:tD()}),ev}var rD=nD();const vE=jv(rD),go=240,xu=130,uo=74,Vu=72,yE=uo+Vu;function sD(e,n){var i;let r=go;for(const o of e)r=Math.max(r,((i=n.get(o.id))==null?void 0:i.width)??go);return r}const gj=420,iD=2;function Ra(e){var r;return((r=e.data)==null?void 0:r.sessionId)??"_default"}function oD(e,n){return((n==null?void 0:n.get(e))??0)>0?gj:0}function aD(e,n){const r=(n==null?void 0:n.get(e))??0;return r>0?6+r*36:0}function Ta(e,n,r){const i=n.get(e);return{w:((i==null?void 0:i.width)??go)+oD(e,r),h:Math.max((i==null?void 0:i.height)??xu,aD(e,r))}}function lD(e){return[...e.keys()].sort().map(n=>`${n}:${e.get(n)}`).join("|")}function uD(e,n,r,i,o,l){const u=new vE.graphlib.Graph;u.setDefaultEdgeLabel(()=>({})),u.setGraph({rankdir:r,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const c=e.filter(b=>!o.has(b)),h=new Set(c);for(const b of c){const{w:k,h:E}=Ta(b,i,l);u.setNode(b,{width:k,height:E})}for(const b of n)h.has(b.source)&&h.has(b.target)&&u.setEdge(b.source,b.target);vE.layout(u);const p=new Map;let d=1/0,m=1/0,y=-1/0,w=-1/0;for(const b of c){const k=u.node(b);if(!k)continue;const E=i.get(b),C=(E==null?void 0:E.width)??go,A=(E==null?void 0:E.height)??xu,M=Ta(b,i,l),L=k.x-M.w/2,H=k.y-M.h/2;p.set(b,{x:L,y:H}),L<d&&(d=L),H<m&&(m=H),L+C>y&&(y=L+C),H+A>w&&(w=H+A)}if(Number.isFinite(d)&&Number.isFinite(m))for(const[b,k]of p)p.set(b,{x:k.x-d,y:k.y-m});const N=Number.isFinite(y)?y-d:0,_=Number.isFinite(w)?w-m:0;let S=null;for(const b of e){const k=o.get(b);if(!k)continue;const E=i.get(b),C=(E==null?void 0:E.width)??go,A=(E==null?void 0:E.height)??xu;S=S===null?{minX:k.x,minY:k.y,maxX:k.x+C,maxY:k.y+A}:{minX:Math.min(S.minX,k.x),minY:Math.min(S.minY,k.y),maxX:Math.max(S.maxX,k.x+C),maxY:Math.max(S.maxY,k.y+A)}}return{positions:p,width:N,height:_,pinnedBox:S}}function cD(e,n,r={}){const i=r.direction??"LR",o=r.pinned??new Map,l=r.measured??new Map,u=r.lanes,c=new Map;for(const b of e){const k=Ra(b),E=c.get(k);E?E.push(b.id):c.set(k,[b.id])}const p=Array.from(c.keys()).sort().map(b=>({sid:b,...uD(c.get(b),n,i,l,o,u)})),d=sD(e,l),m=r.availableHeight&&r.availableHeight>0?r.availableHeight:Number.POSITIVE_INFINITY,y=b=>{const k=[[]];let E=0;for(const C of p)k.length<b&&E>0&&E+C.height>m&&(k.push([]),E=0),k[k.length-1].push(C),E+=C.height+yE;return k},w=b=>b.reduce((k,E)=>Math.max(k,E.width),0)+gj;let N=y(r.availableWidth?iD:1);N.length>1&&N.reduce((k,E)=>k+w(E),0)+d*(N.length-1)>(r.availableWidth??0)&&(N=y(1));const _=new Map;let S=0;for(const b of N){const k=w(b);let E=0;for(const{positions:C,height:A,pinnedBox:M}of b){for(const[H,O]of C)_.set(H,{x:O.x+S,y:O.y+E});let L=E+A;M&&M.maxY>L&&M.minX<S+k&&S<M.maxX&&(L=M.maxY),E=L+yE}S+=k+d}return e.map(b=>{const k=o.get(b.id);if(k)return{...b,position:k};const E=_.get(b.id);return E?{...b,position:E}:b})}function dD(e,n,r,i,o){const u=uo+Vu,c=60,h=w=>Ta(w,i,o),p=new Map(e.map(w=>[w.id,Ra(w)])),d=[],m=e.map(w=>({id:w.id,pos:r.get(w.id)??n.get(w.id)})).filter(w=>w.pos!=null).sort((w,N)=>w.pos.y-N.pos.y||w.pos.x-N.pos.x||w.id.localeCompare(N.id)),y=[];for(const{id:w,pos:N}of m){const{w:_,h:S}=h(w),b=p.get(w)??"_default";if(r.has(w)){d.push({x:N.x,y:N.y,w:_,h:S,sid:b});continue}let k=N.y;for(let E=0;E<d.length+1;E++){const C=d.find(A=>{const M=A.sid===b?24:c,L=A.sid===b?24:u;return N.x<A.x+A.w+M&&A.x<N.x+_+M&&k<A.y+A.h+L&&A.y<k+S+L});if(!C)break;k=C.y+C.h+(C.sid===b?24:u)}k!==N.y&&(n.set(w,{x:N.x,y:k}),y.push(w)),d.push({x:N.x,y:k,w:_,h:S,sid:b})}return y}function fD(e,n,r,i,o,l){const u=_=>Ta(_,i,l),c=_=>r.get(_)??n.get(_),h=new Map;for(const _ of e){if(!c(_.id))continue;const S=Ra(_),b=h.get(S);b?b.push(_):h.set(S,[_])}const p=new Set;for(const[_,S]of h)S.every(b=>o.has(b.id)&&!r.has(b.id))&&p.add(_);const d=new Map,m=[];for(const _ of e){const S=c(_.id);if(!S)continue;const{w:b,h:k}=u(_.id),E=Ra(_);p.has(E)?(d.get(E)??d.set(E,[]).get(E)).push(_):m.push({x:S.x,y:S.y,w:b,h:k})}if(d.size===0)return[];const y=uo+Vu,w=(_,S,b,k)=>m.some(E=>_<E.x+E.w+uo&&E.x<_+b+uo&&S<E.y+E.h+y&&E.y<S+k+y),N=[];for(const _ of[...d.keys()].sort()){const S=d.get(_);let b=1/0,k=1/0,E=-1/0,C=-1/0;for(const F of S){const G=c(F.id),{w:q,h:R}=u(F.id);b=Math.min(b,G.x),k=Math.min(k,G.y),E=Math.max(E,G.x+q),C=Math.max(C,G.y+R)}const A=E-b,M=C-k,L=[...new Set(m.map(F=>Math.round(F.x)))].sort((F,G)=>F-G),H=L.length?L:[b],O=[0,...m.map(F=>F.y+F.h+y)].sort((F,G)=>F-G);let P=null;e:for(const F of H)for(const G of O){if(G>=k)break;if(!w(F,G,A,M)){P={x:F,y:G};break e}}if(P){const F=P.x-b,G=P.y-k;for(const q of S){const R=c(q.id);n.set(q.id,{x:R.x+F,y:R.y+G})}N.push(_)}for(const F of S){const G=c(F.id),{w:q,h:R}=u(F.id);m.push({x:G.x,y:G.y,w:q,h:R})}}return N}function hD(e,n,r,i,o,l=!1,u){const p=uo+Vu+1,d=8,m=1.75,y=200,w=.7,N=.01,_=P=>Ta(P,i,u),S=P=>r.get(P)??n.get(P),b=new Map;for(const P of e){if(!S(P.id))continue;const F=Ra(P),G=b.get(F);G?G.push(P):b.set(F,[P])}const k=[],E=new Set,C=new Set,A=o.size===0;for(const P of[...b.keys()].sort()){const F=b.get(P);let G=1/0,q=1/0,R=-1/0,Q=-1/0,z=!1;for(const X of F){const I=S(X.id),{w:W,h:Y}=_(X.id);G=Math.min(G,I.x),q=Math.min(q,I.y),R=Math.max(R,I.x+W),Q=Math.max(Q,I.y+Y),r.has(X.id)&&(z=!0)}const ne=R-G,Z=Q-q;C.add(P);const $=o.get(P);$&&(ne>$.w+d||Z>$.h+d)&&E.add(P),o.set(P,{w:ne,h:Z}),k.push({sid:P,members:F.map(X=>X.id),x:G,y:q,w:ne,h:Z,anchored:z,mass:1})}for(const P of[...o.keys()])C.has(P)||o.delete(P);if(l||A)return[];let M=!1;for(let P=0;P<k.length&&!M;P++)for(let F=P+1;F<k.length;F++){const G=k[P],q=k[F];if(!(G.anchored&&q.anchored)&&Math.abs(G.x+G.w/2-(q.x+q.w/2))<(G.w+q.w)/2+61&&Math.abs(G.y+G.h/2-(q.y+q.h/2))<(G.h+q.h)/2+p){M=!0;break}}if(E.size===0&&!M)return[];if(E.size>0)for(const P of k)E.has(P.sid)&&(P.mass=8);else for(const P of k)P.mass=Math.max(1,P.w*P.h/(go*xu));const L=new Map(k.map(P=>[P.sid,P.x])),H=new Map(k.map(P=>[P.sid,P.y]));for(let P=0;P<y;P++){const F=new Map,G=new Map;let q=0;for(let R=0;R<k.length;R++)for(let Q=R+1;Q<k.length;Q++){const z=k[R],ne=k[Q];if(z.anchored&&ne.anchored)continue;const Z=z.x+z.w/2,$=z.y+z.h/2,X=ne.x+ne.w/2,I=ne.y+ne.h/2,W=(z.w+ne.w)/2+61-Math.abs(Z-X),Y=(z.h+ne.h)/2+p-Math.abs($-I);if(W<=0||Y<=0)continue;const U=(De,Ze)=>!De.anchored&&!(Ze<0&&De.x<=0),J=(De,Ze)=>!De.anchored&&!(Ze<0&&De.y<=0),re=(De,Ze,Ye)=>{const vt=De===Ze,ot=vt?z.sid<ne.sid?-1:1:Math.sign(De-Ze);return Ye(z,ot)||Ye(ne,-ot)?ot:vt&&(Ye(z,-ot)||Ye(ne,ot))?-ot:0},le=re(Z,X,U),fe=re($,I,J),te=le!==0,ce=fe!==0;if(!te&&!ce)continue;const Ce=te&&(!ce||W*m<Y),[ve,Te,ye,ke]=Ce?[le,W,F,U]:[fe,Y,G,J],Ge=ke(z,ve),we=ke(ne,-ve),_e=z.mass,ze=ne.mass,ft=Ge?we?ze/(_e+ze):1:0,ht=we?Ge?_e/(_e+ze):1:0,Ue=Te*w;ye.set(z.sid,(ye.get(z.sid)??0)+ve*Ue*ft),ye.set(ne.sid,(ye.get(ne.sid)??0)-ve*Ue*ht),q+=Ue}for(const R of k)R.anchored||(R.x=Math.max(0,R.x+(F.get(R.sid)??0)),R.y=Math.max(0,R.y+(G.get(R.sid)??0)));if(q<N)break}const O=[];for(const P of k){const F=P.x-L.get(P.sid),G=P.y-H.get(P.sid);if(!(Math.abs(F)<1&&Math.abs(G)<1)){for(const q of P.members){if(r.has(q))continue;const R=n.get(q);R&&n.set(q,{x:R.x+F,y:R.y+G})}O.push(P.sid)}}return O}const pD=600;function kv(e,n){return!(e.exitAt!=null&&n-e.exitAt>pD||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function mD(e,n){const r=new Set;for(const i of e.agents.values())kv(i,n)&&r.add(i.id);return r}function gD(e,n,r=0){return e.right+r>n.left&&e.left-r<n.right&&e.bottom+r>n.top&&e.top-r<n.bottom}function vD(e,n,r=0){if(!e)return!1;for(const i of n)if(gD(e,i,r))return!0;return!1}const vj="sessionGroup";function yD(e,n){var i;if(e.type===vj)return"transparent";const r=(i=e.data)==null?void 0:i.state;return n(r==="err"?"--err":r==="active"?"--inflight":"--ok")}const wD="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1).";function xD(e){if(e.checkDisabled)return wD;if(e.checking)return"Asking npm for the newest release…";const n=e.latest?`npm has v${e.latest}`:e.latestPending?`npm's latest tag names v${e.latestPending}, which it cannot serve yet`:"npm not reached yet",r=e.checkedAgo?` · checked ${e.checkedAgo}`:"";return`${n}${r} · re-checked periodically · click to check npm now`}function _D(e){const n=`Version v${e.running}`;return e.checkDisabled?`${n}, update checks are off`:e.checking?`${n}, checking npm for a newer release`:`${n}, check npm for a newer release`}function bD(e){if(e==null)return{kind:"unknown",lead:"No data yet. Start a Claude Code or Codex session — it appears here as soon as its first hook fires.",workspace:null,tail:""};const n=e.trim();return n===""?{kind:"machine",lead:"No data yet. Start a Claude Code or Codex session anywhere on this machine — this deck is unscoped and captures every workspace.",workspace:null,tail:""}:{kind:"scoped",lead:"No data yet. This deck only captures sessions running under",workspace:n,tail:" — start one there, or restart it without --workspace/--scope to watch the whole machine."}}function yj(e){const n=Math.max(0,Math.floor(e));return`${n} event${n===1?"":"s"}`}function SD(e){return e.connected?e.paused?{tone:"paused",label:"paused",title:e.held>0?`Connected — ${yj(e.held)} held until you resume (Space)`:"Connected — updates held until you resume (Space)"}:{tone:"live",label:"live",title:"Receiving events"}:{tone:"dead",label:"offline",title:e.paused?"SSE disconnected — and the canvas is paused, so resuming will not bring events back until it reconnects":"SSE disconnected"}}function kD(e){return e.paused?e.held<=0?{label:"Resume",title:"Nothing has arrived since you paused. Resume to follow the canvas again (Space)"}:{label:`Resume · ${e.held} held`,title:`${yj(e.held)} arrived while paused and will be applied in order when you resume (Space)`}:{label:"Pause",title:"Pause live updates — events keep arriving and are applied when you resume (Space)"}}function wj(e,n){return e!==""&&n>0}function ED(e,n,r){return e===""?{active:!1,matched:n,total:r,count:null,empty:!1,message:null,dim:!1}:{active:!0,matched:n,total:r,count:`${n} of ${r}`,empty:n===0,message:n===0?`No agents match “${e}”`:null,dim:wj(e,n)}}function Ev(e){const n=Math.max(0,Math.floor(e/1e3));return n<60?"just now":n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}function ND(e,n){return e.getFullYear()===n.getFullYear()&&e.getMonth()===n.getMonth()&&e.getDate()===n.getDate()}function CD(e,n,r){const i=new Date(e),o=Ev(n-e);return{label:ND(i,new Date(n))?o:`${o} · ${i.toLocaleDateString(r,{month:"short",day:"numeric"})}`,title:i.toLocaleString(r,{dateStyle:"medium",timeStyle:"medium"})}}function pa(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const jD={agent:NO,sessionGroup:FO},RD=420,nu=18,TD=9e4,AD=200,ID=5*6e4,MD=6,PD=2*6e4,fy="agent-dag.layout",hy="agent-dag.viewport",xj="agent-dag.summariesDismissed",_j="agent-dag.sessionListOpen",bj="agent-dag.detailOpen",Sj="agent-dag.usagePanelOpen",wE="agent-dag.accountsPanelOpen",xE="agent-dag.versionNoticeDismissed",_E="agent-dag.oldNameNoticeDismissed",OD=15*6e4,bE={git_checkout:"this deck runs from a git checkout — pull instead:",npx:"npx runs from a cache that cannot be upgraded in place — run:",not_writable:"the install directory is not writable by this user — run:",opted_out:"installs are off (AGENTS_DECK_NO_INSTALL=1) — run:"},SE="agent-dag.autoRestart",kE="agent-dag.bundleReloadedFor";function LD(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(_j)==="1"}catch{return!1}}function qD(e){if(!(typeof window>"u"))try{window.localStorage.setItem(_j,e?"1":"0")}catch{}}function $D(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(bj)==="1"}catch{return!1}}function DD(e){if(!(typeof window>"u"))try{window.localStorage.setItem(bj,e?"1":"0")}catch{}}function FD(){const e=mC(Sj);return e===null?!0:e==="1"}function zD(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Sj,e?"1":"0")}catch{}}function BD(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(xj);if(!e)return new Set;const n=JSON.parse(e);return new Set(Array.isArray(n)?n.filter(r=>typeof r=="string"):[])}catch{return new Set}}function EE(e){if(!(typeof window>"u"))try{const n=Array.from(e),r=n.length>200?n.slice(-200):n;window.localStorage.setItem(xj,JSON.stringify(r))}catch{}}function UD(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const n=window.localStorage.getItem(fy);if(!n)return e;const r=JSON.parse(n);if(!("v"in r)){const o=Object.entries(r).filter(([,l])=>l&&typeof l.x=="number"&&typeof l.y=="number");return{positions:o,pins:o.map(([l])=>l)}}return{positions:Object.entries(r.positions??{}).filter(([,o])=>o&&typeof o.x=="number"&&typeof o.y=="number"),pins:Array.isArray(r.pins)?r.pins:[]}}catch{return e}}function tv(e,n){if(!(typeof window>"u"))try{const r={};for(const[i,o]of e)r[i]=o;for(const[i,o]of n)r[i]=o;window.localStorage.setItem(fy,JSON.stringify({v:2,positions:r,pins:Array.from(n.keys())}))}catch{}}function HD(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(hy);if(!e)return null;const n=JSON.parse(e);return typeof(n==null?void 0:n.x)!="number"||typeof(n==null?void 0:n.y)!="number"||typeof(n==null?void 0:n.zoom)!="number"?null:n}catch{return null}}function WD(e){if(!(typeof window>"u"))try{window.localStorage.setItem(hy,JSON.stringify(e))}catch{}}function NE(){if(!(typeof window>"u")){try{window.localStorage.removeItem(fy)}catch{}try{window.localStorage.removeItem(hy)}catch{}}}function VD(e,n){const r=e.agents.get(n);if(!r)return;const i=[];for(const d of e.agents.values())d.sessionId===n&&i.push(d);const o={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:n,label:r.label,cwd:r.cwd,startedAt:r.startedAt,endedAt:r.endedAt,model:r.model,agents:i.map(d=>({id:d.id,kind:d.kind,label:d.label,parentId:d.parentId,state:d.state,startedAt:d.startedAt,endedAt:d.endedAt,model:d.model,cwd:d.cwd,usage:d.usage,prompts:d.prompts,tools:d.tools.map(m=>({id:m.id,name:m.name,inputPreview:m.inputPreview,startedAt:m.startedAt,endedAt:m.endedAt,ok:m.ok,errorPreview:m.errorPreview,usage:m.usage}))}))},l=JSON.stringify(o,null,2),u=new Blob([l],{type:"application/json"}),c=URL.createObjectURL(u),h=document.createElement("a"),p=(r.label||"session").replace(/[^a-z0-9._-]/gi,"_");h.href=c,h.download=`${zt}-${p}-${n.slice(0,8)}.json`,document.body.appendChild(h),h.click(),document.body.removeChild(h),setTimeout(()=>URL.revokeObjectURL(c),1e3)}const Nv={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},Cv={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},GD={Read:"file",Write:"file",Edit:"file",MultiEdit:"file",Glob:"file",Grep:"file",LS:"file",NotebookEdit:"file",Bash:"shell",PowerShell:"shell",shell:"shell",exec_command:"shell",shell_command:"shell",write_stdin:"shell",wait:"shell",apply_patch:"file",update_plan:"task",WebFetch:"web",WebSearch:"web",Task:"agent",Agent:"agent",TodoWrite:"task",TaskCreate:"task",TaskUpdate:"task",TaskList:"task",TaskGet:"task",TaskOutput:"task",TaskStop:"task",EnterPlanMode:"plan",ExitPlanMode:"plan",AskUserQuestion:"plan",Skill:"plan",Workflow:"plan"};function kj(e){return e.startsWith("mcp__")?"mcp":GD[e]??"other"}function Ej(e,n){var i,o,l;if(!n)return!0;const r=n.toLowerCase();if(e.label.toLowerCase().includes(r)||(i=e.cwd)!=null&&i.toLowerCase().includes(r)||(o=e.cwdBasename)!=null&&o.toLowerCase().includes(r)||e.sessionId.toLowerCase().includes(r)||(l=e.firstPrompt)!=null&&l.toLowerCase().includes(r))return!0;for(const u of e.tools)if(u.name.toLowerCase().includes(r))return!0;return!1}function YD(e,n){if(!n)return null;const r=new Set([n]);let i=n;for(;i;){const l=e.agents.get(i);if(!(l!=null&&l.parentId)||r.has(l.parentId))break;r.add(l.parentId),i=l.parentId}let o=!0;for(;o;){o=!1;for(const l of e.agents.values())l.parentId&&r.has(l.parentId)&&!r.has(l.id)&&(r.add(l.id),o=!0)}return r}function KD(e,n,r,i,o,l,u,c,h,p,d,m,y,w,N,_,S,b,k){const E=[],C=[],A=new Set;if(l)for(const q of e.agents.values())b.has(q.id)&&Ej(q,l)&&A.add(q.id);const M=wj(l,A.size);for(const q of e.agents.values()){if(!b.has(q.id))continue;const R=M&&!A.has(q.id),Q=q.exitAt!=null,z=S!=null&&!S.has(q.id),ne=[R?"rf-dim":"",Q?"rf-exiting":"",z?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,Z=u.get(q.id);if(E.push({id:q.id,type:"agent",position:{x:0,y:0},data:{...q,now:n,onOpenContext:k},className:ne,...Z?{width:Z.width,height:Z.height}:null}),q.parentId&&b.has(q.parentId)){const $=Vv(q.sessionId),X=l&&!A.has(q.id)&&!A.has(q.parentId),I=Q,W=_.size>0&&(_.has(q.id)||_.has(q.parentId)),Y=S!=null&&!S.has(q.id)&&!S.has(q.parentId),U=q.state==="active"?2:1.5,J=W?U+1.5:U,re=X||I?.2:Y?.12:1,le=["sess-edge",q.state==="active"?"sess-live":"sess-idle",I?"rf-edge-exiting":"",W?"rf-edge-selected":""].filter(Boolean).join(" ");C.push({id:`e:${q.parentId}->${q.id}`,source:q.parentId,target:q.id,animated:(q.state==="active"||W)&&!X&&!I,type:"smoothstep",style:{"--session-hue":$,strokeWidth:J,opacity:re,transition:"opacity 500ms ease, stroke-width 200ms ease"},className:le})}}const L=new Map;for(const q of e.agents.values())q.tools.length>0&&L.set(q.id,Math.min(4,q.tools.length));const H=`${w}#lanes:${lD(L)}`,O=E.filter(q=>bL(q.id,o,m,y));if(O.length>0||H!==N.current){if(O.length>0){const q=cD(E,C,{direction:"LR",pinned:o,measured:u,availableWidth:r,availableHeight:i,lanes:L});for(const R of q)pC(R.id,m,y)&&kL(R.id,R.position,m,y);fD(E,m,o,u,new Set(O.map(R=>R.id)),L)}dD(E,m,o,u,L),N.current=H}const P=hD(E,m,o,u,c,!p||d,L);P.length>0&&h(P),Zl(m,e.agents),Zl(y,e.agents),Zl(o,e.agents),Zl(u,_L(e.agents.values()));const F=[];let G=!1;for(const q of E){let R=o.get(q.id)??m.get(q.id);R||(R=SL(q.id,m,y),G=!0),F.push({...q,position:R})}return G&&(N.current=""),{nodes:F,edges:C}}function XD(){return g.jsx(Wv,{children:g.jsx(QD,{})})}function QD(){var Fs,Po,Ua,Ha;const e=Oa(),n=T.useRef(yv()),[,r]=T.useState(0),i=T.useCallback(()=>r(B=>B+1),[]),[o,l]=T.useState(()=>new Set),[u,c]=T.useState(null),[h,p]=T.useState(null),d=T.useCallback((B,V)=>{l(oe=>{if(!V)return new Set([B]);const de=new Set(oe);return de.has(B)?de.delete(B):de.add(B),de}),c(oe=>V&&oe===B?oe:B)},[]),m=T.useCallback(()=>{l(new Set),c(null)},[]),[y,w]=T.useState(null),[N,_]=T.useState(null),S=T.useCallback(B=>_(B),[]),[b,k]=T.useState(!1),E=T.useRef(BD()),[C,A]=T.useState(LD);T.useEffect(()=>{qD(C)},[C]);const[M,L]=T.useState($D);T.useEffect(()=>{DD(M)},[M]);const[H,O]=T.useState(FD);T.useEffect(()=>{zD(H)},[H]);const[P,F]=T.useState(()=>{try{const B=window.localStorage.getItem(wE);return B===null?!0:B==="1"}catch{return!0}});T.useEffect(()=>{try{window.localStorage.setItem(wE,P?"1":"0")}catch{}},[P]);const[G,q]=T.useState(null),[R,Q]=T.useState(!1),[z,ne]=T.useState(0),[Z,$]=T.useState(0);T.useEffect(()=>{fetch("/api/sound-hook").then(B=>B.ok?B.json():null).then(B=>{B!=null&&B.ok&&(q(B.enabled===!0),ne((B.foreign??[]).filter(V=>V.worksHere).length),$(typeof B.parked=="number"?B.parked:0))}).catch(()=>{})},[]);const X=T.useCallback(async()=>{Q(!0);try{const V=await(await fetch("/api/sound-hook",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:!G})})).json().catch(()=>null);V!=null&&V.ok&&q(V.enabled===!0),fetch("/api/sound-hook").then(oe=>oe.ok?oe.json():null).then(oe=>{oe!=null&&oe.ok&&(ne((oe.foreign??[]).filter(de=>de.worksHere).length),$(typeof oe.parked=="number"?oe.parked:0))}).catch(()=>{})}catch{}finally{Q(!1)}},[G]),[I,W]=T.useState(!1),[Y,U]=T.useState(null),[J,re]=T.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(xE)??""}catch{return""}}),[le,fe]=T.useState(!1),te=T.useRef(0),[ce,Ce]=T.useState(!1),ve=T.useCallback((B=!1)=>{B&&(te.current=Date.now(),Ce(!0)),fetch(B?"/api/version?refresh=1":"/api/version").then(V=>V.ok?V.json():null).then(V=>{V&&U(V)}).catch(()=>{}).finally(()=>{B&&Ce(!1)})},[]),Te=T.useCallback(()=>{ve(Date.now()-te.current>=OD)},[ve]);T.useEffect(()=>{ve();const B=window.setInterval(Te,5*6e4),V=()=>{document.visibilityState==="visible"&&Te()};return document.addEventListener("visibilitychange",V),()=>{window.clearInterval(B),document.removeEventListener("visibilitychange",V)}},[ve,Te]),T.useEffect(()=>{I&&ve()},[I,ve]);const ye=(Y==null?void 0:Y.notice)??null,[ke,Ge]=T.useState(null);T.useEffect(()=>{let B=!1;return fetch("/api/health").then(V=>V.ok?V.json():null).then(V=>{B||!V||typeof V.workspace!="string"||Ge(V.workspace)}).catch(()=>{}),()=>{B=!0}},[I]);const we=ye?`${ye.kind}:${ye.to}`:"",_e=ye!=null&&J!==we,ze=T.useCallback(()=>{if(!ye)return;const B=J===we?"":we;re(B);try{window.localStorage.setItem(xE,B)}catch{}},[ye,we,J]),[ft,ht]=T.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(_E)??""}catch{return""}}),Ue=Y!=null&&Y.invokedAs&&Y.invokedAs!==zt?Y.invokedAs:null,De=Ue!=null&&ft!==Ue,Ze=T.useCallback(()=>{if(Ue){ht(Ue);try{window.localStorage.setItem(_E,Ue)}catch{}}},[Ue]),Ye=((Fs=Y==null?void 0:Y.upgrade)==null?void 0:Fs.state)??"idle",vt=dL(Y==null?void 0:Y.upgrade),ot=T.useCallback(async()=>{try{await fetch("/api/upgrade",{method:"POST"})}catch{}ve()},[ve]);T.useEffect(()=>{if(Ye!=="running")return;const B=window.setInterval(ve,3e3);return()=>window.clearInterval(B)},[Ye,ve]);const yt=T.useCallback(async()=>{var oe;const B=Y==null?void 0:Y.command;if(!B)return;let V=!1;try{V=await Promise.race([((oe=navigator.clipboard)==null?void 0:oe.writeText(B).then(()=>!0))??Promise.resolve(!1),new Promise(de=>window.setTimeout(()=>de(!1),500))])}catch{V=!1}if(!V)try{const de=document.createElement("textarea");de.value=B,de.setAttribute("readonly",""),de.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(de),de.select(),V=document.execCommand("copy"),de.remove()}catch{V=!1}V&&(fe(!0),window.setTimeout(()=>fe(!1),1600))},[Y==null?void 0:Y.command]),Kt=T.useCallback(()=>{A(B=>(B||F(!1),!B))},[]),Mt=T.useCallback(()=>{F(B=>(B||A(!1),!B))},[]),[Xe,wt]=T.useState(!1),[pt,mt]=T.useState(0),_n=T.useRef(null),[Xt,Pt]=T.useState(!1),Qt=T.useRef(null),[yr,bn]=T.useState(0),Zt=T.useRef(jL()),[pn,Sn]=T.useState(!1),Gr=T.useCallback(()=>{const B=Zt.current,V=B.setPaused(!B.paused);for(const oe of V)n.current=Cx(n.current,oe);Sn(B.paused)},[]),[ut,hi]=T.useState(Date.now()),[nr,Es]=T.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(SE)!=="0"}catch{return!0}}),pi=T.useCallback(()=>{Es(B=>{const V=!B;try{window.localStorage.setItem(SE,V?"1":"0")}catch{}return V})},[]),[Jt,rr]=T.useState(!1),[wr,So]=T.useState("restart"),[sr,xr]=T.useState(null),mn=T.useRef(!1),Yr=T.useRef(null),mi=T.useRef(0),Kr=T.useCallback(async B=>{if(mn.current)return;const V=(B==null?void 0:B.upgrade)===!0;mn.current=!0,Yr.current=vt;const oe=++mi.current;So(V?"npx":"restart"),rr(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(ye==null?void 0:ye.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:V})})}catch{}window.setTimeout(()=>{if(mi.current===oe&&mn.current){mn.current=!1,rr(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},V?18e4:3e4)},[ye==null?void 0:ye.to,vt]),Ns=T.useRef(null);T.useEffect(()=>{let B=!1;for(const oe of n.current.agents.values())if(oe.state==="active"){B=!0;break}const V=hL({enabled:nr,kind:ye==null?void 0:ye.kind,canRestart:(Y==null?void 0:Y.canRestart)===!0,busy:B,idleSince:Ns.current,now:ut});Ns.current=V.idleSince,V.restart&&Kr()},[nr,ye==null?void 0:ye.kind,Y==null?void 0:Y.canRestart,ut,Kr]),T.useEffect(()=>{const B=Y==null?void 0:Y.running;let V=null,oe=null;try{V=window.sessionStorage.getItem("agent-dag.restartPending"),oe=window.sessionStorage.getItem(kE)}catch{return}const de=cL({bundle:"1.33.147",running:B,pending:V,lastTried:oe});if(de==="reload"){try{window.sessionStorage.setItem(kE,B??"")}catch{return}window.location.reload();return}if(de!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}mn.current=!1,rr(!1),xr(B??null);const xe=window.setTimeout(()=>xr(null),6e3);return()=>window.clearTimeout(xe)},[Y==null?void 0:Y.running]),T.useEffect(()=>{if(Jt&&fL({asked:Yr.current,reported:vt})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}mn.current=!1,rr(!1)}},[Jt,vt]);const gn=T.useRef(UD()).current;T.useRef(!1);const jt=T.useRef(new Map(gn.positions.filter(([B])=>gn.pins.includes(B)))),_r=T.useRef(null),Xr=T.useState(()=>HD())[0],[en,Qr]=T.useState(""),[Cs,gi]=T.useState(()=>new Set),[ir,vi]=T.useState(ML),[Je,ko]=T.useState(!1),br=T.useRef(null);T.useEffect(()=>{document.documentElement.dataset.theme=ir;try{window.localStorage.setItem(gC,ir)}catch{}},[ir]),T.useEffect(()=>{if(!Xr)return;const B=window.setTimeout(()=>{try{e.setViewport(Xr,{duration:0})}catch{}},60);return()=>window.clearTimeout(B)},[e,Xr]);const js=T.useRef(!0);T.useEffect(()=>{const B=new EventSource("/events"),V=CL(i,{now:()=>Date.now(),setTimeout:(oe,de)=>window.setTimeout(oe,de),clearTimeout:oe=>window.clearTimeout(oe)});return B.addEventListener("open",()=>{W(!0),ko(!0)}),B.addEventListener("error",()=>W(!1)),B.addEventListener("replay-end",()=>{js.current=!1,V.flush()}),B.addEventListener("hook",oe=>{try{const de=JSON.parse(oe.data);if(!Zt.current.accept(de))return;n.current=Cx(n.current,de),de.replay===!0||js.current||Date.now()-de.receivedAt>3e4?V.replay():V.live()}catch{}}),()=>{B.close(),V.cancel()}},[i]),T.useEffect(()=>{const B=setInterval(()=>{const V=Date.now();hi(V);let oe=eO(n.current,V,TD);nO(n.current,V,tO)&&(oe=!0),ZP(n.current,V,AD,ID)&&(oe=!0),JP(n.current,V,MD,PD)&&(oe=!0),oe&&i()},250);return()=>clearInterval(B)},[i]);const or=T.useRef(null),$n=T.useRef(0),yi=420,Ot=T.useCallback((B=500)=>{try{const Ne=document.querySelector(".canvas-wrap"),Ie=Array.from(document.querySelectorAll(".react-flow__node")).filter(xt=>xt.offsetWidth>0);if(!Ne||Ie.length===0)return;const Le=Ne.getBoundingClientRect(),Ve=e.getViewport();if(!Number.isFinite(Ve.zoom)||Ve.zoom<=0)return;const Qe=xt=>(xt-Le.left-Ve.x)/Ve.zoom,rt=xt=>(xt-Le.top-Ve.y)/Ve.zoom,Nn=Ie.map(xt=>xt.getBoundingClientRect()),Ar=Math.min(...Nn.map(xt=>Qe(xt.left))),Oo=Math.max(...Nn.map(xt=>Qe(xt.right))),zs=Math.min(...Nn.map(xt=>rt(xt.top))),Lo=Math.max(...Nn.map(xt=>rt(xt.bottom))),qo=Oo-Ar,Ti=Lo-zs;if(!(qo>0&&Ti>0))return;const Bn=Math.max(.2,Math.min(1,(Le.width-160)/(qo+yi)*.86,(Le.height-160)/Ti*.86));e.setViewport({x:80-Ar*Bn,y:Math.max(80,(Le.height-Ti*Bn)/2)-zs*Bn,zoom:Bn},{duration:B}),$n.current=Date.now(),window.setTimeout(()=>{try{const xt={x:80-Ar*Bn,y:Math.max(80,(Le.height-Ti*Bn)/2)-zs*Bn,zoom:Bn},Wa=e.getViewport();(Math.abs(Wa.zoom-Bn)>.01||Math.abs(Wa.x-xt.x)>2)&&e.setViewport(xt,{duration:0})}catch{}},B+60)}catch{}},[e]),Ut=T.useRef(""),Sr=T.useRef(null),rn=T.useRef(0),wi=T.useCallback(()=>{rn.current=Date.now()},[]),Eo="agent-dag.autoFitDisabled",kr=T.useRef((()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(Eo)==="1"}catch{return!1}})()),[Rs,Ts]=T.useState(kr.current),Zr=T.useCallback(()=>{if(!kr.current){kr.current=!0,Ts(!0);try{window.localStorage.setItem(Eo,"1")}catch{}}},[]),xi=T.useCallback(()=>{kr.current=!1,Ts(!1);try{window.localStorage.removeItem(Eo)}catch{}Ot(400)},[e,Ot]);T.useEffect(()=>{const B=setInterval(()=>{if(kr.current||Date.now()-rn.current<800)return;const V=n.current,oe=Date.now(),de=[];for(const Qe of V.agents.values())kv(Qe,oe)&&de.push({id:Qe.id});if(de.length===0)return;const xe=e.getViewport(),Ne=window.innerWidth-360,Ie=window.innerHeight-52;let Le=!1,Ve=!1;for(const{id:Qe}of de){const rt=Jr.current.get(Qe),Nn=jt.current.get(Qe)??Ht.current.get(Qe);if(!rt||!Nn)continue;Ve=!0;const Ar=Nn.x*xe.zoom+xe.x,Oo=Nn.y*xe.zoom+xe.y,zs=(Nn.x+rt.width)*xe.zoom+xe.x,Lo=(Nn.y+rt.height)*xe.zoom+xe.y;if(zs>0&&Ar<Ne&&Lo>0&&Oo<Ie){Le=!0;break}}Ve&&!Le&&Ot(600)},1500);return()=>clearInterval(B)},[e]);const No=T.useRef(!1),Jr=T.useRef(new Map),_i=T.useRef(0),Ba=T.useCallback(B=>{const V=Jr.current;let oe=!1;for(const de of B.nodeInternals.values()){const xe=de.width,Ne=de.height;if(xe==null||Ne==null)continue;const Ie=V.get(de.id);Ie?(Math.abs(Ie.height-Ne)>4||Math.abs(Ie.width-xe)>4)&&(V.set(de.id,{width:xe,height:Ne}),oe=!0):(V.set(de.id,{width:xe,height:Ne}),oe=!0)}return oe&&(_i.current+=1),_i.current},[]),bi=Ke(Ba),[es,Gu]=T.useState(0);T.useEffect(()=>{let B=0;const V=()=>{const de=Jr.current;let xe=!1;for(const Ne of document.querySelectorAll(".react-flow__node[data-id]")){const Ie=Ne.getAttribute("data-id");if(!Ie)continue;const Le=Ne.offsetWidth,Ve=Ne.offsetHeight;if(!Le||!Ve)continue;const Qe=de.get(Ie);(!Qe||Math.abs(Qe.width-Le)>4||Math.abs(Qe.height-Ve)>4)&&(de.set(Ie,{width:Le,height:Ve}),xe=!0)}xe&&Gu(Ne=>Ne+1)};if(No.current)return;let oe=0;return document.visibilityState==="hidden"?oe=window.setTimeout(V,32):B=requestAnimationFrame(V),()=>{cancelAnimationFrame(B),window.clearTimeout(oe)}});const Ht=T.useRef(new Map(gn.positions)),We=T.useRef(new Set),Si=T.useRef(""),Er=T.useMemo(()=>{const B=[];for(const V of n.current.agents.values())kv(V,ut)&&B.push(V.id+(V.parentId?`>${V.parentId}`:""));return B.sort(),`${B.join("|")}#sv${bi}.${es}`},[n.current,n.current.lastSeq,ut,bi,es]),Nr=T.useRef(null);T.useEffect(()=>(Nr.current!=null&&window.clearTimeout(Nr.current),Nr.current=window.setTimeout(()=>{tv(Ht.current,jt.current)},1500),()=>{Nr.current!=null&&window.clearTimeout(Nr.current)}),[Er]),T.useEffect(()=>{if(Ut.current===Er)return;const B=Ut.current;if(Ut.current=Er,!B||kr.current)return;Date.now()-$n.current>1200&&Ot(400),or.current&&window.clearTimeout(or.current),or.current=window.setTimeout(()=>{kr.current||Ot(500)},280)},[Er,e,Ot]);const ki=T.useMemo(()=>{if(o.size===0)return null;const B=new Set;for(const V of o){const oe=YD(n.current,V);if(oe)for(const de of oe)B.add(de)}return B.size>0?B:null},[n.current,n.current.lastSeq,o]),ar=T.useMemo(()=>mD(n.current,ut),[n.current,n.current.lastSeq,ut]),Co=T.useRef(null),[ts,As]=T.useState({w:0,h:0});T.useEffect(()=>{const B=Co.current;if(!B||typeof ResizeObserver>"u")return;const V=new ResizeObserver(oe=>{var xe;const de=(xe=oe[0])==null?void 0:xe.contentRect;de&&As(Ne=>Math.abs(Ne.w-de.width)>40||Math.abs(Ne.h-de.height)>40?{w:de.width,h:de.height}:Ne)});return V.observe(B),As({w:B.clientWidth,h:B.clientHeight}),()=>V.disconnect()},[]);const lr=T.useRef(new Map),[Dn,ur]=T.useState(!1);T.useEffect(()=>{const B=window.setTimeout(()=>ur(!0),2500);return()=>window.clearTimeout(B)},[]);const[Is,Cr]=T.useState(!1),Lt=T.useRef(null),[jo,Ro]=T.useState(!1),Ms=T.useCallback(()=>{Lt.current&&(window.clearTimeout(Lt.current),Lt.current=null),Cr(!1)},[]),Yu=T.useCallback(B=>{B.length!==0&&queueMicrotask(()=>{Cr(!0),Lt.current&&window.clearTimeout(Lt.current),Lt.current=window.setTimeout(()=>Cr(!1),RD+80)})},[]);T.useEffect(()=>()=>{Lt.current&&window.clearTimeout(Lt.current)},[]);const To=ts.w>0?ts.w*.92:0,Ps=ts.h>0?ts.h:0,{nodes:Fn,edges:Ku}=T.useMemo(()=>KD(n.current,ut,To,Ps,jt.current,en,Jr.current,lr.current,Yu,Dn,jo,Ht.current,We.current,Er,Si,o,ki,ar,S),[n.current,n.current.lastSeq,ut,To,Ps,Dn,jo,en,Er,o,ki,ar,S,pt]),ns=T.useMemo(()=>{const B=new Map;for(const oe of Fn){const de=oe.data;if(!(de!=null&&de.sessionId)||de.exitAt!=null)continue;const xe=oe.width,Ne=oe.height;if(xe==null||Ne==null)continue;const Ie=oe.position.x,Le=oe.position.y,Ve=Ie+xe,Qe=Le+Ne,rt=B.get(de.sessionId);rt?(rt.minX=Math.min(rt.minX,Ie),rt.minY=Math.min(rt.minY,Le),rt.maxX=Math.max(rt.maxX,Ve),rt.maxY=Math.max(rt.maxY,Qe)):B.set(de.sessionId,{minX:Ie,minY:Le,maxX:Ve,maxY:Qe})}const V=[];for(const[oe,de]of B){const xe=de.maxX-de.minX+nu*2,Ne=de.maxY-de.minY+nu*2;V.push({id:`group:${oe}`,type:vj,position:{x:de.minX-nu,y:de.minY-nu},data:{sessionId:oe,w:xe,h:Ne},width:xe,height:Ne,style:{width:xe,height:Ne},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return V},[Fn,ut]),Os=T.useMemo(()=>{const B=[...ns,...Fn],V=Qt.current;return!V||V.size===0?B:B.map(oe=>{const de=V.get(oe.id);return de?{...oe,position:de}:oe})},[ns,Fn,yr]),kn=T.useMemo(()=>{if(!en)return null;const B=new Set;for(const V of n.current.agents.values())ar.has(V.id)&&Ej(V,en)&&B.add(V.id);return B},[n.current,n.current.lastSeq,en,ar]),En=T.useMemo(()=>ED(en,(kn==null?void 0:kn.size)??0,ar.size),[en,kn,ar]),Ei=T.useMemo(()=>{const B=new Set;for(const V of n.current.agents.values())for(const oe of V.tools)B.add(kj(oe.name));return Object.keys(Nv).filter(V=>B.has(V))},[n.current,n.current.lastSeq]);T.useEffect(()=>{if(Ei.length<=1){Pt(!1);return}let B=0;const V=()=>{const oe=_n.current;if(oe&&!document.hidden){const de=oe.getBoundingClientRect(),xe=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Ie=>Ie.getBoundingClientRect()),Ne=vD(de,xe,8);Pt(Ie=>Ie===Ne?Ie:Ne)}B=window.setTimeout(V,300)};return V(),()=>window.clearTimeout(B)},[Ei.length]);const Ls=T.useMemo(()=>{const B=new Map;for(const oe of n.current.agents.values())for(const de of oe.tools){if(!de.name.startsWith("mcp__"))continue;const xe=de.name.slice(5),Ne=xe.indexOf("__"),Ie=Ne>0?xe.slice(0,Ne):xe;B.set(Ie,(B.get(Ie)??0)+1)}const V=[];for(const[oe,de]of B){let xe=5381;for(let Ne=0;Ne<oe.length;Ne++)xe=(xe<<5)+xe^oe.charCodeAt(Ne);V.push({server:oe,count:de,hue:Math.abs(xe)%360})}return V.sort((oe,de)=>de.count-oe.count),V},[n.current,n.current.lastSeq]),Ao=T.useCallback(B=>{gi(V=>{const oe=new Set(V);return oe.has(B)?oe.delete(B):oe.add(B),oe})},[]),St=u?n.current.agents.get(u):null,qs=h?Array.from(n.current.agents.values()).flatMap(B=>B.tools).find(B=>B.id===h)??null:null,Io=T.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}n.current=yv(),jt.current.clear(),Jr.current.clear(),Ht.current.clear(),Si.current="",NE(),m(),i()},[i,m]),zn=T.useRef(b);zn.current=b;const Ni=T.useRef(!1);Ni.current=qs!=null||Xe||N!=null||y!=null;const jr=T.useCallback(B=>{const V=xL(B,{confirmOpen:zn.current,modalOpen:Ni.current});V==="confirm"?k(!0):V==="clear"&&(k(!1),Io())},[Io]),Ci=T.useCallback(()=>{jt.current.clear(),Ht.current.clear(),Si.current="",NE(),i(),window.setTimeout(()=>Ot(500),80)},[i,e,Ot]),$s=T.useCallback(()=>Ot(500),[Ot]),rs=T.useRef(Fn);rs.current=Fn;const Mo=T.useRef(u);Mo.current=u;const qt=T.useCallback(B=>{const V=rs.current;if(V.length===0)return;const oe=V.slice().sort((Le,Ve)=>Le.position.y-Ve.position.y||Le.position.x-Ve.position.x),de=Mo.current,xe=de?oe.findIndex(Le=>Le.id===de):-1;let Ne;xe===-1?Ne=B===1?0:oe.length-1:Ne=(xe+B+oe.length)%oe.length;const Ie=oe[Ne];Ie&&(d(Ie.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[Ie]})}catch{}$n.current=Date.now()},30))},[d,e]),Rr=T.useCallback(B=>{d(B,!1),window.setTimeout(()=>{try{const V=rs.current.find(oe=>oe.id===B);V&&e.fitView({padding:.3,duration:500,nodes:[V]}),$n.current=Date.now()}catch{}},60)},[d,e]);T.useEffect(()=>{const B=V=>{var xe,Ne;const oe=V.target,de={tagName:oe==null?void 0:oe.tagName,isContentEditable:oe==null?void 0:oe.isContentEditable,role:(xe=oe==null?void 0:oe.getAttribute)==null?void 0:xe.call(oe,"role"),type:oe==null?void 0:oe.type};if(V.key==="Escape"){const Ie=yO({overlayOpen:wv.depth()>0,typing:hC(de)});Ie==="dismiss"?wv.dismissTop():Ie==="blur"?oe==null||oe.blur():m();return}if(!yL(de)&&!pL(V)){if(V.key==="/"){V.preventDefault(),(Ne=br.current)==null||Ne.focus();return}V.key===" "&&(V.preventDefault(),Gr()),(V.key==="c"||V.key==="C")&&jr("shortcut"),(V.key==="r"||V.key==="R")&&Ci(),(V.key==="f"||V.key==="F")&&$s(),(V.key==="l"||V.key==="L")&&Kt(),(V.key==="h"||V.key==="H")&&wt(Ie=>!Ie),(V.key==="u"||V.key==="U")&&O(Ie=>!Ie),(V.key==="a"||V.key==="A")&&Mt(),(V.key==="j"||V.key==="J")&&qt(1),(V.key==="k"||V.key==="K")&&qt(-1),(V.key==="t"||V.key==="T")&&vi(Ie=>Ie==="dark"?"light":"dark")}};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[jr,Ci,$s,m,qt,Gr]);const Tr=n.current.agents.size,Ds=new Set(Array.from(n.current.agents.values()).map(B=>B.sessionId)).size,cr=T.useMemo(()=>{var V;const B=[];for(const oe of n.current.agents.values())oe.kind==="root"&&((V=oe.waiting)==null?void 0:V.kind)==="permission"&&B.push({id:oe.id,label:oe.label,waiting:oe.waiting});return B.sort((oe,de)=>oe.waiting.since-de.waiting.since)},[n.current,n.current.lastSeq]),ji=T.useMemo(()=>{const B=new Set;for(const V of n.current.agents.values())V.state==="active"&&B.add(V.sessionId);return B.size},[n.current,n.current.lastSeq]),Ri=T.useRef(null);T.useEffect(()=>{const B=PL({waiting:cr.length,running:ji}),V=Ri.current;if(Ri.current=B,(V==null?void 0:V.title)!==B.title&&(document.title=B.title),(V==null?void 0:V.icon)!==B.icon){const oe=document.querySelector('link[rel="icon"]');oe&&(oe.href=OL[B.icon])}},[cr.length,ji]);const Rt=T.useMemo(()=>{let B=0,V=0,oe=0,de=0,xe=0,Ne=0,Ie=0,Le=0,Ve=0;for(const Qe of n.current.agents.values()){B+=Qe.usage.inputTokens,V+=Qe.usage.outputTokens,oe+=Qe.usage.cacheReadTokens,de+=Qe.usage.cacheCreateTokens;const rt=fn(Qe.usage,Qe.model);xe+=rt.total,Ne+=rt.input,Ie+=rt.output,Le+=rt.cacheRead,Ve+=rt.cacheWrite}return{inT:B,outT:V,cacheR:oe,cacheC:de,sum:B+V,cost:{total:xe,input:Ne,output:Ie,cacheRead:Le,cacheWrite:Ve}}},[n.current,n.current.lastSeq]);return g.jsxs("div",{className:"app",children:[g.jsxs("header",{className:"topbar",children:[g.jsxs("div",{className:"brand",children:[g.jsx("span",{className:"logo"}),zt,ye?g.jsxs("button",{type:"button",className:"v stale",onClick:ze,title:ye.kind==="restart"?`Running v${ye.from}; v${ye.to} is installed on disk. Restart to pick it up.`:`Running v${ye.from}; v${ye.to} is on npm.`,children:["v",ye.from,g.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const B={running:(Y==null?void 0:Y.running)??"1.33.147",latest:Y==null?void 0:Y.latest,latestPending:Y==null?void 0:Y.latestPending,checkedAgo:Y!=null&&Y.checkedAt?Ev(ut-Y.checkedAt):null,checkDisabled:Y==null?void 0:Y.checkDisabled,checking:ce};return g.jsxs("button",{type:"button",className:ce?"v checking":"v",onClick:()=>ve(!0),"aria-busy":ce||void 0,"aria-label":_D(B),title:xD(B),children:["v",B.running]})})()]}),St&&(()=>{const B=fn(St.usage,St.model),V=Math.max(0,((St.endedAt??ut)-St.startedAt)/1e3),oe=St.state==="active"?yu(B.total,V):null,de=o.size-1;return g.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${St.label}`,onClick:()=>{try{const xe=Fn.find(Ne=>Ne.id===St.id);xe&&e.fitView({padding:.35,duration:500,nodes:[xe]}),$n.current=Date.now()}catch{}},children:[g.jsx("span",{className:`state-pill state-${St.state}`,children:St.state==="active"?"live":St.state}),g.jsx("span",{className:"selected-label",children:St.label}),B.total>0&&g.jsxs("span",{className:"selected-cost",children:[Fe(B.total),oe?g.jsxs("span",{className:"selected-rate",children:[" · ",oe]}):null]}),de>0&&g.jsxs("span",{className:"selected-extra",children:["+",de]}),g.jsx("span",{role:"button","aria-label":"Deselect",className:"selected-close",onClick:xe=>{xe.stopPropagation(),m()},children:"×"})]})})(),g.jsxs("div",{className:"actions",children:[g.jsxs("div",{className:"search",children:[g.jsx("span",{className:"search-icon","aria-hidden":!0,children:"⌕"}),g.jsx("input",{ref:br,type:"text",placeholder:"Search agents, cwd, tools…",value:en,onChange:B=>Qr(B.target.value),spellCheck:!1,"aria-label":"Filter the graph"}),en?g.jsx("button",{className:"search-clear","aria-label":"Clear search",onClick:()=>Qr(""),children:"×"}):g.jsx("kbd",{className:"search-kbd","aria-hidden":!0,children:"/"}),En.count&&g.jsx("span",{className:`search-count${En.empty?" none":""}`,"aria-live":"polite",title:`${En.count} agents on the canvas match “${en}”`,children:En.count})]}),g.jsxs("span",{className:"status",role:"status",children:[(()=>{const B=SD({connected:I,paused:pn,held:Zt.current.size});return g.jsx("span",{className:`pill ${B.tone}`,title:B.title,children:B.label})})(),g.jsxs("span",{className:"stat",title:"Distinct CC sessions",children:[g.jsx("span",{className:"count",children:Ds}),g.jsx("span",{className:"lbl",children:"sessions"})]}),g.jsxs("span",{className:"stat",title:"Total agents (root + subagents)",children:[g.jsx("span",{className:"count",children:Tr}),g.jsx("span",{className:"lbl",children:"agents"})]}),g.jsxs("span",{className:"stat",title:"Total hook events received",children:[g.jsx("span",{className:"count",children:n.current.totalEvents}),g.jsx("span",{className:"lbl",children:"events"})]}),Rt.sum>0&&g.jsxs("span",{className:"stat",title:`in:${Rt.inT.toLocaleString()} out:${Rt.outT.toLocaleString()} cache-r:${Rt.cacheR.toLocaleString()} cache-c:${Rt.cacheC.toLocaleString()}`,children:[g.jsx("span",{className:"count",children:Ft(Rt.sum)}),g.jsx("span",{className:"lbl",children:"tokens"})]}),Ls.length>0&&g.jsxs("span",{className:"stat mcp-legend",title:`MCP servers seen this session:
|
|
60
|
+
Blocked for ${xv(e.since,void 0,n)} — the answer goes in the terminal, not here.`,children:[r?g.jsx("span",{className:"ap-pulse","aria-hidden":!0}):g.jsx("span",{className:"waiting-dot","aria-hidden":!0}),g.jsx("span",{className:"waiting-said",children:jO(e)}),g.jsx("b",{children:xv(e.since,void 0,n)})]})}function TO(e){return e<1e3?`${e}`:e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(2)}M`}function AO({tools:e,now:n}){const l=new Array(24).fill(0);let u=0;for(const y of e){const w=n-y.startedAt;if(w<0||w>=6e4)continue;const N=23-Math.floor(w/2500);N>=0&&N<24&&(l[N]+=1,u+=1)}const c=Math.max(1,...l),h=132,p=14,d=h/24,m=c/(2500/1e3);return g.jsxs("div",{className:"tool-spark-row",title:`${u} tool calls in last 60s · peak ${m.toFixed(1)}/s`,children:[g.jsx("svg",{className:"tool-spark",width:h,height:p,viewBox:`0 0 ${h} ${p}`,"aria-hidden":!0,children:l.map((y,w)=>{const N=y===0?1.5:Math.max(1.5,y/c*p),_=w===23&&y>0,b=`tool-spark-bar${y>0?" active":""}${_?" latest":""}`;return g.jsx("rect",{x:w*d+.4,y:p-N,width:Math.max(.5,d-1),height:N,rx:.8,className:b},w)})}),g.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function li(e){const n=e.replace(/^anthropic\./,"").replace(/[-_]\d{8}(?!\d)/,""),r=n.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(r){const l=r[1][0].toUpperCase()+r[1].slice(1).toLowerCase(),u=r[2].replace(/[-_]/g,".");return`${l} ${u}`}const i=n.match(/^gpt[-_](\d+(?:[-_.]\d+)*)[-_]codex\b/i);if(i)return`GPT-${i[1].replace(/[-_]/g,".")} Codex`;const o=n.match(/^gpt[-_](\d+(?:[-_.]\d+)*)/i);return o?`GPT-${o[1].replace(/[-_]/g,".")}`:e}function Tx(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function IO(e){if(e.endedAt==null)return"in-flight…";const n=e.endedAt-e.startedAt;return n<1e3?`${n}ms`:`${(n/1e3).toFixed(2)}s`}function MO({tool:e,onClose:n}){vo(n);const r=e.endedAt==null?"inflight":e.ok===!1?"err":"done";return g.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:g.jsxs("div",{className:"modal",onClick:i=>i.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[g.jsxs("header",{className:"modal-head",children:[g.jsxs("div",{className:"modal-title",children:[g.jsx("span",{className:`status-dot ${r}`}),g.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),g.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),g.jsxs("div",{className:"modal-actions",children:[g.jsx("span",{className:"modal-dur",children:IO(e)}),g.jsx("button",{className:"btn icon-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),g.jsxs("section",{className:"modal-body",children:[e.trimmed&&g.jsx("div",{className:"modal-section",children:g.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),g.jsxs("div",{className:"modal-section",children:[g.jsx("h4",{children:"Input"}),g.jsx("pre",{children:Tx(e.input??e.inputPreview)})]}),g.jsxs("div",{className:"modal-section",children:[g.jsxs("h4",{children:["Response ",r==="err"&&g.jsx("span",{className:"err-tag",children:"error"})]}),g.jsx("pre",{children:e.endedAt==null?"(waiting…)":Tx(e.response??e.errorPreview)})]})]})]})})}const Xl=18,Ax=26,PO=12;function OO(e){return LO(e.nodeInternals.values())}function LO(e){const n=new Map;for(const o of e){if(o.type!=="agent")continue;const l=o.data;if(!(l!=null&&l.sessionId)||l.exitAt!=null||o.width==null||o.height==null)continue;const u=o.position.x,c=o.position.y,h=u+o.width,p=c+o.height,d=n.get(l.sessionId);d?(d.minX=Math.min(d.minX,u),d.minY=Math.min(d.minY,c),d.maxX=Math.max(d.maxX,h),d.maxY=Math.max(d.maxY,p),l.kind==="root"&&(d.label=Ix(l)??d.label)):n.set(l.sessionId,{minX:u,minY:c,maxX:h,maxY:p,label:Ix(l)??l.sessionId})}const r=new Map;for(const o of n.values())r.set(o.label,(r.get(o.label)??0)+1);const i=[];for(const[o,l]of n){const c=(r.get(l.label)??0)>1?`${l.label} · ${qO(o)}`:l.label;i.push({sessionId:o,label:c,x:l.minX-Xl,y:l.minY-Xl-Ax,w:l.maxX-l.minX+Xl*2,h:l.maxY-l.minY+Xl*2+Ax})}return i}function qO(e){const n=e.match(/[a-zA-Z0-9]{4}/);return n?n[0]:e.slice(0,4)}function Ix(e){if(e.kind==="root")return e.label}function $O(){const{x:e,y:n,zoom:r}=VN(),i=Oa(),o=Ke(OO,DO);if(o.length<=1)return null;const l=u=>{try{const c=i.getNodes().filter(h=>{const p=h.data;return(p==null?void 0:p.sessionId)===u});if(c.length===0)return;i.fitView({padding:.3,duration:500,nodes:c})}catch{}};return g.jsx("div",{className:"session-clusters",children:o.map(u=>{const c=Vv(u.sessionId),h={position:"absolute",left:u.x*r+e,top:u.y*r+n,width:u.w*r,height:u.h*r,"--session-hue":c},p={position:"absolute",left:u.x*r+e+16*r,top:(u.y-PO)*r+n,transform:`scale(${Math.min(1,r)})`,transformOrigin:"left top","--session-hue":c};return g.jsxs(ue.Fragment,{children:[g.jsx("div",{className:"cluster-card",style:h,"aria-hidden":!0}),g.jsx("button",{type:"button",className:"cluster-label",style:p,title:`Fit view to ${u.label} · drag the wrapper to move the whole session`,onClick:()=>l(u.sessionId),children:u.label})]},u.sessionId)})})}function DO(e,n){if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++){const i=e[r],o=n[r];if(i.sessionId!==o.sessionId||i.label!==o.label||i.x!==o.x||i.y!==o.y||i.w!==o.w||i.h!==o.h)return!1}return!0}function FO({data:e}){return g.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}const iC=600,zO=4,BO=36,_v=16,UO=60,HO=6,Mx=220,Px=96,WO=28,VO={Read:"file",Write:"file",Edit:"file",MultiEdit:"file",Glob:"file",Grep:"file",LS:"file",NotebookEdit:"file",Bash:"shell",PowerShell:"shell",shell:"shell",exec_command:"shell",shell_command:"shell",write_stdin:"shell",wait:"shell",apply_patch:"file",update_plan:"task",WebFetch:"web",WebSearch:"web",Task:"agent",Agent:"agent",TodoWrite:"task",TaskCreate:"task",TaskUpdate:"task",TaskList:"task",TaskGet:"task",TaskOutput:"task",TaskStop:"task",EnterPlanMode:"plan",ExitPlanMode:"plan",AskUserQuestion:"plan",Skill:"plan",Workflow:"plan",ScheduleWakeup:"other",CronCreate:"other",CronList:"other",CronDelete:"other",Monitor:"other",PushNotification:"other",RemoteTrigger:"other",ToolSearch:"other"};function GO(e){return e.startsWith("mcp__")?"mcp":VO[e]??"other"}const YO={Read:"📖",Write:"💾",Edit:"✏️",MultiEdit:"🔧",Glob:"🗺️",Grep:"🔎",Bash:"⚡",PowerShell:"💻",shell:"⚡",exec_command:"⚡",shell_command:"⚡",write_stdin:"💻",wait:"⏳",apply_patch:"🩹",update_plan:"📋",LS:"📂",Task:"🤖",Agent:"🤖",TodoWrite:"📋",TaskCreate:"📋",TaskUpdate:"📝",TaskList:"🗂️",TaskGet:"🗂️",TaskOutput:"📤",TaskStop:"🛑",WebFetch:"🌐",WebSearch:"🔭",ToolSearch:"🧰",NotebookEdit:"📓",EnterPlanMode:"🧭",ExitPlanMode:"🏁",AskUserQuestion:"❓",ScheduleWakeup:"⏰",CronCreate:"⏰",CronList:"📅",CronDelete:"🗑️",Skill:"🎯",Workflow:"🎬",Monitor:"📡",PushNotification:"🔔",RemoteTrigger:"📡"};function Ox(e){return e.startsWith("mcp__")?"🔌":YO[e]??"✨"}const KO={git:"🐙",gh:"🐙",glab:"🐙",npm:"📦",pnpm:"📦",yarn:"📦",bun:"📦",brew:"🍺",node:"🟢",deno:"🟢",python:"🐍",python3:"🐍",py:"🐍",pip:"🐍",pip3:"🐍",uv:"🐍",ruby:"💎",bundle:"💎",gem:"💎",cargo:"🦀",rustc:"🦀",rustup:"🦀",go:"🐹",docker:"🐳","docker-compose":"🐳",podman:"🐳",kubectl:"☸️",helm:"☸️",k9s:"☸️",grep:"🔎",rg:"🔎",ag:"🔎",ack:"🔎",find:"🔍",fd:"🔍",locate:"🔍",which:"🔍",ls:"📂",dir:"📂",tree:"📂",cat:"📄",head:"📄",tail:"📄",less:"📄",more:"📄",bat:"📄",cp:"📋",mv:"✂️",rm:"🗑️",rmdir:"🗑️",mkdir:"📁",touch:"📁",sed:"✏️",awk:"✏️",tr:"✏️",curl:"🌐",wget:"🌐",http:"🌐",httpie:"🌐",ssh:"🔐",scp:"🔐",rsync:"🔐",ping:"📡",make:"🔨",cmake:"🔨",ninja:"🔨",bazel:"🔨",just:"🔨",terraform:"🏗️",ansible:"📕",pulumi:"🏗️",ps:"📊",top:"📊",htop:"📊",btm:"📊",kill:"💀",pkill:"💀",systemctl:"⚙️",service:"⚙️",tar:"🗜️",zip:"🗜️",unzip:"🗜️",gzip:"🗜️","7z":"🗜️",vim:"📝",nvim:"📝",nano:"📝",emacs:"📝",code:"📝",jq:"🪺",yq:"🪺",echo:"💬",printf:"💬",ffmpeg:"🎞️",ffprobe:"🎞️",imagemagick:"🖼️",convert:"🖼️","Get-ChildItem":"📂","Get-Content":"📄","Set-Content":"💾","Out-File":"💾","Add-Content":"💾","Set-Location":"📍","Get-Location":"📍","Get-Process":"📊","Start-Process":"▶️","Stop-Process":"💀","Invoke-WebRequest":"🌐","Invoke-RestMethod":"🌐","New-Item":"📁","Remove-Item":"🗑️","Copy-Item":"📋","Move-Item":"✂️","Test-Path":"🔍","Where-Object":"🔎","ForEach-Object":"🔁","Select-Object":"🎯","Measure-Object":"📊","Get-Service":"⚙️","Restart-Service":"⚙️","ConvertTo-Json":"🪺","ConvertFrom-Json":"🪺"};function oC(e){if(!e)return null;let n=e.trim();if(!n)return null;const r=n.match(/^(?:bash|sh|zsh|fish|powershell|pwsh)(?:\.exe)?\s+(?:-c|-Command|-NoProfile|-NonInteractive|\s)+["']([^"']+)["']/i);if(r)return oC(r[1]);for(;;){const l=n.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!l)break;n=n.slice(l[0].length)}n=n.replace(/^sudo(?:\s+-\S+)*\s+/,""),n=n.replace(/^(?:time|nohup|xargs)\s+/,"");const i=n.match(/^([^\s|;&<>(]+)/);if(!i)return null;let o=i[1];return o=o.replace(/^.*[/\\]/,""),o=o.replace(/\.(exe|cmd|bat|ps1)$/i,""),o||null}function XO(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const n=e;if(typeof n.cmd=="string")return n.cmd;if(typeof n.command=="string")return n.command;if(Array.isArray(n.command)&&n.command.every(r=>typeof r=="string")){const r=n.command;if(/powershell|cmd|bash|sh(\.exe)?$/i.test(r[0]??"")){const i=r.findIndex(o=>/^(-Command|-c)$/i.test(o));if(i>=0&&i+1<r.length)return r[i+1]}return r.join(" ")}return typeof n.script=="string"?n.script:null}const QO=new Set(["Bash","PowerShell","shell","exec_command","shell_command","write_stdin","wait"]),ZO=new Set(["shell","exec_command","shell_command","write_stdin","wait","apply_patch","update_plan"]);function JO(e,n){return ZO.has(e)||e.startsWith("mcp__")?Math.max(Px,34+n.length*7.5):Px}function e3(e,n){if(!QO.has(e))return null;const r=XO(n);if(!r)return null;const i=oC(r);return i?{emoji:KO[i]??"⚙️",label:i,category:"shell",detail:r}:null}const t3=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),Lx={ts:"🟦",tsx:"🟦",d:"🟦",js:"🟨",jsx:"🟨",mjs:"🟨",cjs:"🟨",py:"🐍",pyi:"🐍",ipynb:"📓",rs:"🦀",go:"🐹",rb:"💎",erb:"💎",java:"☕",kt:"☕",scala:"☕",gradle:"☕",cs:"🔷",fs:"🔷",php:"🐘",swift:"🦅",c:"🇨",cpp:"🇨",cc:"🇨",h:"🇨",hpp:"🇨",md:"📝",mdx:"📝",rst:"📝",json:"🪺",json5:"🪺",jsonl:"🪺",yaml:"⚙️",yml:"⚙️",toml:"⚙️",ini:"⚙️",conf:"⚙️",cfg:"⚙️",xml:"📰",html:"🌐",htm:"🌐",vue:"🌐",svelte:"🌐",css:"🎨",scss:"🎨",sass:"🎨",less:"🎨",sh:"⚡",bash:"⚡",zsh:"⚡",fish:"⚡",ps1:"⚡",txt:"📄",log:"📄",out:"📄",csv:"📊",tsv:"📊",xlsx:"📊",xls:"📊",pdf:"📕",png:"🖼️",jpg:"🖼️",jpeg:"🖼️",gif:"🖼️",webp:"🖼️",svg:"🖼️",ico:"🖼️",mp4:"🎬",mov:"🎬",avi:"🎬",mkv:"🎬",webm:"🎬",mp3:"🎵",wav:"🎵",ogg:"🎵",flac:"🎵",zip:"🗜️",tar:"🗜️",gz:"🗜️",bz2:"🗜️","7z":"🗜️",xz:"🗜️",rar:"🗜️",env:"🔐",lock:"🔐",pem:"🔐",key:"🔐",crt:"🔐",sql:"🗄️",db:"🗄️",sqlite:"🗄️",parquet:"🗄️"},qx={dockerfile:"🐳",makefile:"🔨",rakefile:"💎","package.json":"📦","pnpm-lock.yaml":"📦","yarn.lock":"📦","cargo.toml":"🦀","cargo.lock":"🦀","go.mod":"🐹","go.sum":"🐹","pyproject.toml":"🐍","requirements.txt":"🐍","readme.md":"📖",readme:"📖",license:"📜",".gitignore":"🐙",".gitattributes":"🐙",".env":"🔐",".dockerignore":"🐳"};function n3(e){const r=e.replace(/\\/g,"/").replace(/\/+$/,""),i=r.lastIndexOf("/");return i>=0?r.slice(i+1):r}function r3(e){const n=e.toLowerCase();if(qx[n])return qx[n];if(n.startsWith("dockerfile."))return"🐳";if(/\.(test|spec)\.[a-z]+$/.test(n))return"🧪";const r=n.lastIndexOf(".");if(r>0&&r<n.length-1){const i=n.slice(r+1);if(Lx[i])return Lx[i]}return"📄"}function s3(e,n){if(!n||typeof n!="object")return null;const r=n;if(e==="apply_patch"&&typeof r.patch=="string"){const i=r.patch.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/m);return i?i[1].trim():null}return typeof r.file_path=="string"?r.file_path:typeof r.notebook_path=="string"?r.notebook_path:typeof r.path=="string"?r.path:e==="Glob"&&typeof r.pattern=="string"?r.pattern:null}function i3(e,n){if(!t3.has(e))return null;const r=s3(e,n);if(!r)return null;const i=n3(r);return i?{emoji:e==="LS"?"📂":r3(i),label:i,category:"file",detail:r}:null}const aC={github:{emoji:"🐙",name:"GitHub"},git:{emoji:"🐙",name:"Git"},gitlab:{emoji:"🦊",name:"GitLab"},slack:{emoji:"💬",name:"Slack"},discord:{emoji:"💬",name:"Discord"},linear:{emoji:"📐",name:"Linear"},jira:{emoji:"🅹",name:"Jira"},atlassian:{emoji:"🅰️",name:"Atlassian"},notion:{emoji:"📓",name:"Notion"},asana:{emoji:"📋",name:"Asana"},intercom:{emoji:"💬",name:"Intercom"},figma:{emoji:"🎨",name:"Figma"},gmail:{emoji:"📧",name:"Gmail"},calendar:{emoji:"📅",name:"Calendar"},drive:{emoji:"☁️",name:"Drive"},zoom:{emoji:"📹",name:"Zoom"},spotify:{emoji:"🎵",name:"Spotify"},youtube:{emoji:"📺",name:"YouTube"},ccd_session:{emoji:"📡",name:"Session"},ccd_directory:{emoji:"📂",name:"Directory"},ccd_session_mgmt:{emoji:"📡",name:"Sessions"},mcp_registry:{emoji:"🧰",name:"Registry"},"computer-use":{emoji:"🖱️",name:"Computer"},"claude-in-chrome":{emoji:"🌐",name:"Chrome"},"claude-preview":{emoji:"👀",name:"Preview"},"scheduled-tasks":{emoji:"⏰",name:"Scheduler"},visualize:{emoji:"🎨",name:"Visualize"},"plugin-design-asana":{emoji:"📋",name:"Asana"},"plugin-design-atlassian":{emoji:"🅰️",name:"Atlassian"},"plugin-design-figma":{emoji:"🎨",name:"Figma"},"plugin-design-intercom":{emoji:"💬",name:"Intercom"},"plugin-design-linear":{emoji:"📐",name:"Linear"},"plugin-design-notion":{emoji:"📓",name:"Notion"},"plugin-design-slack":{emoji:"💬",name:"Slack"}};function lC(e){if(!e.startsWith("mcp__"))return null;const n=e.slice(5),r=n.indexOf("__");return r<=0?{server:n,method:""}:{server:n.slice(0,r),method:n.slice(r+2)}}function o3(e){let n=5381;for(let r=0;r<e.length;r++)n=(n<<5)+n^e.charCodeAt(r);return Math.abs(n)%360}function a3(e,n){const r=lC(e);if(!r)return null;const{server:i,method:o}=r;if(!o)return null;const l=aC[i.toLowerCase()];return{emoji:(l==null?void 0:l.emoji)??"🔌",label:o,category:"mcp",detail:l?`${l.name} · ${o}`:`${i} · ${o}`}}function l3(e,n){return e3(e,n)??i3(e,n)??a3(e)}const u3={shell:"Shell",exec_command:"Shell",shell_command:"Shell",write_stdin:"stdin",wait:"wait",apply_patch:"Edit",update_plan:"Plan"};function c3(e){const n=lC(e);if(n){const i=aC[n.server.toLowerCase()];return i?{emoji:i.emoji,label:i.name}:{emoji:"🔌",label:n.server,hue:o3(n.server)}}const r=u3[e];return r?{emoji:Ox(e),label:r}:{emoji:Ox(e),label:e}}function d3(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function f3(e,n,r){if(r==null)return 1;const i=n-r;return i<0?1:Math.max(0,1-i/iC)}function h3(e,n){const r=[],i=new Set;for(let o=e.length-1;o>=0&&r.length<n;o--){const l=e[o];i.has(l.id)||(i.add(l.id),r.push(l))}return r.reverse()}function p3(e,n,r,i,o,l){const u=[];for(const c of e.values()){if(!n.has(c.id)||c.exitAt!=null&&l-c.exitAt>iC)continue;const h=i.get(c.id)??r.get(c.id);if(!h)continue;const p=h3(c.tools,zO);if(p.length===0)continue;const d=c.exitAt??null,m=o.get(c.id),y=Math.max((m==null?void 0:m.width)??Mx,Mx),w=(m==null?void 0:m.height)??130,N=h.x,_=h.y,S=N+y,b=_+w/2;p.forEach((k,E)=>{const C=E*BO,A=N+y+UO,M=_+HO+C,L=f3(k,l,d),H=k.inputPreview??"",O=d3(k),P=L<.999,F=c3(k.name);u.push({id:`${c.id}::${k.id}`,toolId:k.id,agentId:c.id,toolName:k.name,name:F.label,emoji:F.emoji,status:O,category:GO(k.name),mcpHue:F.hue,inputPreview:H,fade:L,fading:P,worldX:A,worldY:M,anchorX:S,anchorY:b,spawnDx:S-A,spawnDy:b-(M+_v)});const Y=l3(k.name,k.input);if(Y){const q=JO(k.name,F.label),R=A+q+WO,Q=M,z=A+q,ne=M+_v;u.push({id:`sub:${c.id}::${k.id}`,toolId:k.id,agentId:c.id,toolName:k.name,name:Y.label,emoji:Y.emoji,isSub:!0,status:O,category:Y.category,inputPreview:Y.detail??H,fade:L,fading:P,worldX:R,worldY:Q,anchorX:z,anchorY:ne,spawnDx:z-R,spawnDy:0})}})}return u}function m3({agents:e,visibleAgentIds:n,positions:r,pinned:i,measured:o,dimUnmatched:l,spotlight:u,hiddenCategories:c,now:h,onOpenTool:p}){const d=p3(e,n,r,i,o,h),m=c&&c.size>0?d.filter(y=>!c.has(y.category)):d;return g.jsx(g3,{bursts:m,dimUnmatched:l,spotlight:u,onOpenTool:p})}function g3({bursts:e,dimUnmatched:n,spotlight:r,onOpenTool:i}){const{x:o,y:l,zoom:u}=VN();return g.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[g.jsx("svg",{className:"tool-bursts-svg",children:e.map(c=>{const h=c.anchorX*u+o,p=c.anchorY*u+l,d=(c.worldX+6)*u+o,m=(c.worldY+_v)*u+l,y=h+(d-h)*.55,w=n!=null&&!n.has(c.agentId),N=r!=null&&!r.has(c.agentId),_=c.fade*(w||N?.14:1);return g.jsx("path",{d:`M ${h} ${p} Q ${y} ${p}, ${d} ${m}`,className:`tool-conn status-${c.status}${c.fading?" fading":""}`,opacity:_},`l:${c.id}`)})}),e.map(c=>{const h=c.worldX*u+o,p=c.worldY*u+l,d={left:`${h}px`,top:`${p}px`,transform:`scale(${u})`,transformOrigin:"left top","--spawn-dx":`${c.spawnDx}px`,"--spawn-dy":`${c.spawnDy}px`},m=c.isSub?`${c.toolName} · ${c.name}`:c.toolName,y=c.inputPreview?`${m} · ${c.inputPreview}`:m,w=i!=null,N=c.mcpHue!=null?{"--mcp-hue":c.mcpHue}:{},_=n!=null&&!n.has(c.agentId),S=r!=null&&!r.has(c.agentId),b=_||S?" dim":"";return g.jsx("div",{className:"tool-burst-wrap",style:d,children:g.jsxs("div",{className:`tool-burst cat-${c.category}${c.mcpHue!=null?" mcp-hue":""} status-${c.status}${c.fading?" fading":""}${w?" clickable":""}${c.isSub?" sub":""}${b}`,style:N,title:y,role:w?"button":void 0,tabIndex:w?0:void 0,"aria-label":w?`Open ${c.toolName} ${c.status==="inflight"?"in flight":c.status} — click for details`:void 0,onClick:w?()=>i(c.toolId):void 0,onKeyDown:w?k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),i(c.toolId))}:void 0,children:[g.jsx("span",{className:"tb-emoji",children:c.emoji}),g.jsx("span",{className:"tb-name",children:c.name}),c.status==="inflight"&&g.jsx("span",{className:"tb-spin"}),c.status==="done"&&g.jsx("span",{className:"tb-mark done",children:"✓"}),c.status==="err"&&g.jsx("span",{className:"tb-mark err",children:"×"})]})},c.id)})]})}function v3({state:e,sessionId:n,onClose:r}){const i=T.useMemo(()=>w3(e,n),[e,n]),o=T.useRef(null);return vo(r,{focusRef:o}),i?g.jsx("div",{className:"modal-backdrop",onClick:r,role:"presentation",children:g.jsxs("div",{className:"modal session-summary",onClick:l=>l.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[g.jsxs("div",{className:"modal-head",children:[g.jsxs("div",{className:"modal-title",children:[g.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),g.jsx("span",{id:"ss-title",className:"modal-tool-name",title:i.cwd??i.sessionId,children:i.label}),g.jsxs("span",{className:"modal-tool-id",children:["· ",i.sessionId.slice(0,8)]})]}),g.jsxs("div",{className:"modal-actions",children:[g.jsx("span",{className:"modal-dur",title:"Total wall time",children:i.durationLabel}),g.jsx("button",{type:"button",ref:o,className:"btn",onClick:r,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),g.jsxs("div",{className:"modal-body",children:[g.jsxs("section",{className:"ss-hero",children:[g.jsxs("div",{className:"ss-hero-left",children:[g.jsx("div",{className:"ss-cost-label",children:"total spend"}),g.jsx("div",{className:"ss-cost",children:Fe(i.cost.total)}),i.modelChips.length>0&&g.jsx("div",{className:"ss-models",children:i.modelChips.map(l=>g.jsx("span",{className:"model-chip",title:l,children:li(l)},l))})]}),g.jsx("div",{className:"ss-hero-right",children:i.cost.total>0&&g.jsxs(g.Fragment,{children:[g.jsx(y3,{cost:i.cost}),g.jsxs("div",{className:"ss-cost-legend",children:[g.jsxs("span",{className:"ssl ssl-in",children:["input ",g.jsx("b",{children:Fe(i.cost.input)})]}),g.jsxs("span",{className:"ssl ssl-out",children:["output ",g.jsx("b",{children:Fe(i.cost.output)})]}),g.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",g.jsx("b",{children:Fe(i.cost.cacheRead)})]}),g.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",g.jsx("b",{children:Fe(i.cost.cacheWrite)})]})]})]})})]}),g.jsxs("section",{className:"ss-stats",children:[g.jsx(to,{label:"agents",value:i.agentCount}),g.jsx(to,{label:"subagents",value:i.subagentCount}),g.jsx(to,{label:"tool calls",value:i.toolCount}),g.jsx(to,{label:"prompts",value:i.promptCount}),g.jsx(to,{label:"tokens",value:i.tokensSum.toLocaleString()}),i.errCount>0&&g.jsx(to,{label:"errors",value:i.errCount,tone:"err"})]}),i.topTools.length>0&&g.jsxs("section",{className:"modal-section",children:[g.jsx("h4",{children:"Most-used tools"}),g.jsx("div",{className:"ss-top-tools",children:i.topTools.map(([l,u])=>g.jsxs("div",{className:"ss-tt",children:[g.jsx("span",{className:"ss-tt-name",children:l}),g.jsx("span",{className:"ss-tt-bar",children:g.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${u/i.topTools[0][1]*100}%`}})}),g.jsx("span",{className:"ss-tt-count",children:u})]},l))})]}),i.firstPrompt&&g.jsxs("section",{className:"modal-section",children:[g.jsx("h4",{children:"Opening prompt"}),g.jsx("div",{className:"ss-prompt",children:i.firstPrompt})]})]})]})}):null}function to({label:e,value:n,tone:r}){return g.jsxs("div",{className:`ss-stat${r?` tone-${r}`:""}`,children:[g.jsx("div",{className:"ss-stat-value",children:n}),g.jsx("div",{className:"ss-stat-label",children:e})]})}function y3({cost:e}){const n=e.total;if(n<=0)return null;const r=(i,o,l)=>{if(i<=0)return null;const u=i/n*100;return g.jsx("span",{className:`cb-seg ${o}`,style:{width:`${u}%`},title:`${l}: ${Fe(i)} (${u.toFixed(0)}%)`},o)};return g.jsxs("div",{className:"cost-bar cost-bar-lg","aria-label":"Cost breakdown",children:[r(e.input,"cb-input","input"),r(e.output,"cb-output","output"),r(e.cacheRead,"cb-cache-r","cache read"),r(e.cacheWrite,"cb-cache-w","cache write")]})}function w3(e,n){const r=e.agents.get(n);if(!r)return null;const i=[];for(const E of e.agents.values())E.sessionId===n&&i.push(E);if(i.length===0)return null;const o={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},l=new Set,u=new Map;let c=0,h=0,p=0,d=0,m=0,y,w=1/0,N=0;for(const E of i){const C=fn(E.usage,E.model);o.input+=C.input,o.output+=C.output,o.cacheRead+=C.cacheRead,o.cacheWrite+=C.cacheWrite,o.total+=C.total,E.model&&l.add(E.model),E.kind==="subagent"&&m++,h+=E.prompts.length,!y&&E.prompts.length>0&&(y=E.prompts[0].text),p+=E.usage.inputTokens+E.usage.outputTokens,c+=E.toolCount,w=Math.min(w,E.startedAt),N=Math.max(N,E.endedAt??Date.now());for(const A of E.tools)u.set(A.name,(u.get(A.name)??0)+1),A.ok===!1&&d++}const _=Math.max(0,N-w),S=Math.floor(_/1e3),b=S<60?`${S}s`:S<3600?`${Math.floor(S/60)}m ${String(S%60).padStart(2,"0")}s`:`${Math.floor(S/3600)}h ${Math.floor(S%3600/60)}m`,k=Array.from(u.entries()).sort((E,C)=>C[1]-E[1]).slice(0,5);return{sessionId:n,label:r.label||r.cwdBasename||"session",cwd:r.cwd,durationLabel:b,cost:o,modelChips:Array.from(l),agentCount:i.length,subagentCount:m,toolCount:c,promptCount:h,tokensSum:p,errCount:d,topTools:k,firstPrompt:y}}function $x(e){return e.waiting?e.waiting.kind==="permission"?0:1:e.state==="active"?2:3}function x3(e,n){const r=[];for(const i of e.agents.values()){if(i.kind!=="root")continue;let o=i.toolCount,l=fn(i.usage,i.model).total,u=i.endedAt??i.startedAt;for(const c of e.agents.values()){if(c.sessionId!==i.sessionId||c.kind==="root")continue;o+=c.toolCount,l+=fn(c.usage,c.model).total;const h=c.endedAt??c.startedAt;h>u&&(u=h)}r.push({sessionId:i.sessionId,label:i.label||i.cwdBasename||"session",cwdBasename:i.cwdBasename,state:i.state,waiting:i.waiting,modelId:i.model,toolCount:o,cost:l,startedAt:i.startedAt,lastActivity:u})}return r.sort((i,o)=>{const l=$x(i),u=$x(o);return l!==u?l-u:i.waiting&&o.waiting?i.waiting.since-o.waiting.since:o.lastActivity-i.lastActivity}),r}function Dx(e,n,r){const i=(n??r)-e;if(i<1e3)return"<1s";const o=Math.floor(i/1e3);if(o<60)return`${o}s`;const l=Math.floor(o/60);return l<60?`${l}m`:`${Math.floor(l/60)}h ${l%60}m`}function _3({state:e,now:n,selectedIds:r,onSelect:i,onClose:o}){const l=T.useMemo(()=>x3(e),[e,e.lastSeq,n]),u=l.filter(h=>h.state==="active").length,c=l.filter(h=>{var p;return((p=h.waiting)==null?void 0:p.kind)==="permission"}).length;return g.jsxs("aside",{className:"session-list","aria-label":"Sessions",children:[g.jsxs("div",{className:"sl-header",children:[g.jsxs("h3",{children:["Sessions ",g.jsx("span",{className:"sl-count",children:l.length})]}),c>0&&g.jsxs("span",{className:"sl-waiting-count",children:[c," waiting"]}),u>0&&g.jsxs("span",{className:"sl-live-count",children:[u," live"]}),g.jsx("button",{className:"btn icon-btn sl-close",onClick:o,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),g.jsxs("div",{className:"sl-rows",children:[l.length===0&&g.jsx("div",{className:"sl-empty",children:"No sessions yet."}),l.map(h=>{const p=r.has(h.sessionId);return g.jsxs("button",{type:"button",className:`sl-row state-${h.state}${p?" selected":""}`,onClick:()=>i(h.sessionId),title:`Focus ${h.label}`,children:[g.jsx("span",{className:`sl-dot state-${h.state}`,"aria-hidden":!0}),g.jsxs("div",{className:"sl-row-body",children:[g.jsxs("div",{className:"sl-row-head",children:[g.jsx("span",{className:"sl-label",children:h.label}),h.modelId&&g.jsx("span",{className:"model-chip",title:h.modelId,children:li(h.modelId)})]}),g.jsxs("div",{className:"sl-row-meta",children:[g.jsxs("span",{title:"tool calls",children:[g.jsx("b",{children:h.toolCount})," tools"]}),h.cost>0&&g.jsx("span",{className:"sl-cost",title:"total spend",children:g.jsx("b",{children:Fe(h.cost)})}),h.waiting?g.jsxs("span",{className:"sl-waiting",title:`${ju(h.waiting)}
|
|
61
|
+
Blocked since ${new Date(h.waiting.since).toLocaleTimeString()} · started ${new Date(h.startedAt).toLocaleString()}`,children:["waiting ",Dx(h.waiting.since,void 0,n)]}):g.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(h.startedAt).toLocaleString()}`,children:Dx(h.startedAt,h.state==="active"?void 0:h.lastActivity,n)})]})]})]},h.sessionId)})]})]})}const zt="ccdeck";function Ft(e){return e<1e3?`${e}`:e<1e6?`${(e/1e3).toFixed(1)}k`:e<1e9?`${(e/1e6).toFixed(2)}M`:`${(e/1e9).toFixed(2)}B`}function Fx(e,n){if(!e)return null;const r=n-Math.floor(e/1e3);return r<10?"just now":r<60?`${r}s ago`:r<3600?`${Math.floor(r/60)}m ago`:`${Math.floor(r/3600)}h ago`}function b3(e){return e==="claude-swap"?"Read from claude-swap's last collection — costs no request against your usage-endpoint budget":e==="api"?"Fetched from Anthropic's usage endpoint, at most once every 5 minutes":e==="cli"?"Parsed from `claude /usage`, at most once every 5 minutes":"Last update"}function S3({cost:e}){const n=e.total;if(n<=0)return null;const r=(i,o,l)=>{if(i<=0)return null;const u=i/n*100;return g.jsx("span",{className:`cb-seg ${o}`,style:{width:`${u}%`},title:`${l}: ${Fe(i)} (${u.toFixed(0)}%)`},o)};return g.jsxs("div",{className:"cost-bar","aria-label":"Cost breakdown",children:[r(e.input,"cb-input","input"),r(e.output,"cb-output","output"),r(e.cacheRead,"cb-cache-r","cache read"),r(e.cacheWrite,"cb-cache-w","cache write")]})}function k3(e,n){const r=e-n;if(r<=0)return null;const i=Math.floor(r/3600),o=Math.floor(r%3600/60);if(i>23){const l=Math.floor(r/86400),u=Math.floor(r%86400/3600);return`${l}d ${u}h`}return i>0?`${i}h ${o}m`:`${o}m`}function E3(e,n,r,i){const o=Math.max(0,n-i),l=Math.max(0,r-o);if(l<120)return null;const u=Math.min(100,l/r*100),c=e-u;if(Math.abs(c)<3)return{label:"on pace",color:"var(--ok)",expectedPct:u,isDeficit:!1};if(c>0){const h=100-e,p=l>0?e/l:0,d=p>0?h/p:1/0,m={label:`${Math.round(c)}% ahead`,color:"var(--warn)",expectedPct:u,isDeficit:!0};if(d<o&&d<86400){const y=Math.floor(d/3600),w=Math.floor(d%3600/60);m.runsOutIn=y>0?`${y}h ${w}m`:`${w}m`}return m}return{label:`${Math.round(-c)}% reserve`,color:"var(--ok)",expectedPct:u,isDeficit:!1}}function ei({pct:e,label:n,reset:r,resetAt:i,windowSec:o,limitReached:l,nowSec:u}){const c=Math.min(100,Math.max(0,e)),p=l||c>=90?"var(--err)":c>=70?"var(--warn)":"var(--accent)",d=c===0?"< 1%":`${c}%`,m=c===0?2:c,y=i?k3(i,u):null,w=i&&o?E3(c,i,o,u):null;return g.jsxs("div",{className:"qb-row",children:[g.jsxs("div",{className:"qb-meta",children:[g.jsxs("span",{className:"qb-label",children:[n,l&&g.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),g.jsx("span",{className:"qb-pct",style:{color:p},children:d})]}),g.jsxs("div",{className:"qb-track",children:[g.jsx("div",{className:"qb-fill",style:{width:`${m}%`,background:p,opacity:c===0?.4:1}}),w&&g.jsx("div",{className:"qb-pace-marker",style:{left:`${w.expectedPct}%`,background:w.isDeficit?"var(--err)":"var(--ok)"},title:`To last until reset, stay near ${Math.round(w.expectedPct)}% by now`})]}),g.jsxs("div",{className:"qb-reset-row",children:[y?g.jsxs("span",{className:"qb-reset",children:["resets in ",y]}):r?g.jsxs("span",{className:"qb-reset",children:["resets ",r]}):null,w&&g.jsx("span",{className:"qb-pace",style:{color:w.color},children:w.runsOutIn?`runs out in ${w.runsOutIn}`:w.label})]})]})}const N3=6e4;function C3(){const[e,n]=T.useState(null),[r,i]=T.useState(!1),o=T.useRef(null),l=async(c=!1)=>{c&&i(!0);try{const p=await fetch(c?"/api/quota?refresh=1":"/api/quota");p.ok&&n(await p.json())}catch{}finally{c&&i(!1)}};return T.useEffect(()=>(l(!0),o.current=window.setInterval(()=>l(!1),N3),()=>{o.current!=null&&window.clearInterval(o.current)}),[]),{quota:e,loading:r,refresh:()=>l(!0)}}function j3(e){switch(e){case"no_token":return"Run codex login to authenticate.";case"api_key_mode":return"API-key login — ChatGPT quota is only available for codex login.";case"refresh_rejected":return"Codex session expired — run codex login.";case"refresh_failed":return"Couldn't refresh the Codex token — click ↻ to retry.";default:return"ChatGPT API unreachable — click ↻ to retry."}}const uC=6e4;function R3(){const[e,n]=T.useState(null),[r,i]=T.useState(!1),o=T.useRef(null),l=async(c=!1)=>{c&&i(!0);try{const p=await fetch(c?"/api/codex-quota?refresh=1":"/api/codex-quota");p.ok&&n(await p.json())}catch{}finally{c&&i(!1)}};return T.useEffect(()=>(l(!0),o.current=window.setInterval(()=>l(!1),uC),()=>{o.current!=null&&window.clearInterval(o.current)}),[]),{data:e,loading:r,refresh:()=>l(!0)}}function T3(){const[e,n]=T.useState(null),r=T.useRef(null),i=async()=>{try{const o=await fetch("/api/codex-usage");o.ok&&n(await o.json())}catch{}};return T.useEffect(()=>(i(),r.current=window.setInterval(i,uC),()=>{r.current!=null&&window.clearInterval(r.current)}),[]),{data:e}}function A3({state:e,now:n,onClose:r}){var L,H;const{quota:i,loading:o,refresh:l}=C3(),{data:u,loading:c,refresh:h}=R3(),{data:p}=T3(),[d,m]=T.useState(()=>Math.floor(Date.now()/1e3));T.useEffect(()=>{const O=window.setInterval(()=>m(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(O)},[]);const{byModel:y,totalCost:w,totalTokens:N,burnRate:_}=T.useMemo(()=>{const O=new Map,P={total:0,input:0,output:0,cacheRead:0,cacheWrite:0};let F=0,Y=0,q=0,R=0;for(const $ of e.agents.values()){const X=$.model??"__unknown__",I=fn($.usage,$.model),W=O.get(X);W?(W.inputTokens+=$.usage.inputTokens,W.outputTokens+=$.usage.outputTokens,W.cacheReadTokens+=$.usage.cacheReadTokens,W.cacheCreateTokens+=$.usage.cacheCreateTokens,W.cost.total+=I.total,W.cost.input+=I.input,W.cost.output+=I.output,W.cost.cacheRead+=I.cacheRead,W.cost.cacheWrite+=I.cacheWrite,W.agentCount++):O.set(X,{model:X,inputTokens:$.usage.inputTokens,outputTokens:$.usage.outputTokens,cacheReadTokens:$.usage.cacheReadTokens,cacheCreateTokens:$.usage.cacheCreateTokens,cost:{...I},agentCount:1}),P.total+=I.total,P.input+=I.input,P.output+=I.output,P.cacheRead+=I.cacheRead,P.cacheWrite+=I.cacheWrite,F+=$.usage.inputTokens,Y+=$.usage.outputTokens,q+=$.usage.cacheReadTokens,R+=$.usage.cacheCreateTokens}const Q=Array.from(O.values()).sort(($,X)=>X.cost.total-$.cost.total);let z=0,ne=0;for(const $ of e.agents.values()){if($.state!=="active")continue;const X=fn($.usage,$.model);z+=X.total,ne=Math.max(ne,(($.endedAt??n)-$.startedAt)/1e3)}const Z=ne>0?yu(z,ne):null;return{byModel:Q,totalCost:P,totalTokens:{in:F,out:Y,cacheR:q,cacheC:R},burnRate:Z}},[e,e.lastSeq,n]),S=T.useMemo(()=>{const O=[];for(const P of e.agents.values()){if(P.kind!=="root")continue;let F=fn(P.usage,P.model).total,Y=P.usage.inputTokens,q=P.usage.outputTokens;for(const R of e.agents.values())R.sessionId!==P.sessionId||R.kind==="root"||(F+=fn(R.usage,R.model).total,Y+=R.usage.inputTokens,q+=R.usage.outputTokens);O.push({sessionId:P.sessionId,label:P.label||P.cwdBasename||"session",state:P.state,cost:F,inputTokens:Y,outputTokens:q})}return O.sort((P,F)=>F.cost-P.cost).slice(0,12)},[e,e.lastSeq]),b=w.total>0,k=N.in+N.out,E=o||c,C=Fx(i==null?void 0:i.fetchedAt,d),A=Fx(u==null?void 0:u.fetchedAt,d),M=()=>{l(),h()};return g.jsxs("div",{className:"usage-panel","aria-label":"Usage",children:[g.jsxs("div",{className:"up-header",children:[g.jsx("h3",{children:"Usage"}),_&&g.jsx("span",{className:"up-rate",children:_}),g.jsxs("div",{className:"up-header-right",children:[g.jsx("button",{type:"button",className:"btn up-refresh-btn",onClick:M,disabled:E,title:"Refresh Claude + Codex quota",children:E?"…":"↻"}),g.jsx("button",{type:"button",className:"btn icon-btn up-close",onClick:r,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),g.jsxs("section",{className:"up-section up-quota-section",children:[g.jsxs("h4",{className:"up-section-title",children:["Claude quota",C&&!o&&g.jsx("span",{className:"up-section-age",title:b3(i==null?void 0:i.source),children:C})]}),i!=null&&i.ok?g.jsxs("div",{className:"up-quota-bars",children:[i.session5hPct!=null&&g.jsx(ei,{label:"5-hour window",pct:i.session5hPct,reset:i.session5hReset,resetAt:i.session5hResetAt,windowSec:i.session5hWindowSec,nowSec:d}),i.week7dPct!=null&&g.jsx(ei,{label:"7-day window",pct:i.week7dPct,reset:i.week7dReset,resetAt:i.week7dResetAt,windowSec:i.week7dWindowSec,nowSec:d}),i.weekSonnetPct!=null&&g.jsx(ei,{label:"Sonnet (7d)",pct:i.weekSonnetPct,nowSec:d}),i.weekOpusPct!=null&&g.jsx(ei,{label:"Opus (7d)",pct:i.weekOpusPct,nowSec:d})]}):(i==null?void 0:i.ok)===!1?g.jsxs("div",{className:"up-quota-na",children:[g.jsx("span",{children:"Quota unavailable."}),g.jsxs("span",{className:"up-quota-hint",children:["Run ",g.jsx("code",{children:"/usage"})," in a claude session, then click ↻"]})]}):g.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),g.jsxs("section",{className:"up-section up-quota-section",children:[g.jsxs("h4",{className:"up-section-title",children:["Codex quota",(u==null?void 0:u.ok)&&u.planLabel&&g.jsx("span",{className:"up-plan-badge",children:u.planLabel}),A&&!c&&g.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:A})]}),u!=null&&u.ok?g.jsxs("div",{className:"up-quota-bars",children:[(L=u.windows)==null?void 0:L.map(O=>g.jsx(ei,{label:O.label,pct:O.pct,reset:O.reset??void 0,resetAt:O.resetAt??void 0,windowSec:O.windowSec??void 0,limitReached:u.limitReached&&O.pct>=100,nowSec:d},O.id)),(H=u.extraWindows)==null?void 0:H.map(O=>g.jsx(ei,{label:O.label,pct:O.pct,reset:O.reset??void 0,resetAt:O.resetAt??void 0,windowSec:O.windowSec??void 0,nowSec:d},O.id)),u.creditLimit&&g.jsx(ei,{label:`spend cap · $${Math.round(u.creditLimit.used)} of $${Math.round(u.creditLimit.limit)}`,pct:u.creditLimit.usedPct,reset:u.creditLimit.reset??void 0,resetAt:u.creditLimit.resetAt??void 0,limitReached:u.spendControlReached,nowSec:d}),(p==null?void 0:p.ok)&&p.window7d&&p.window7d.sessionCount>0&&g.jsxs("div",{className:"up-quota-sub",children:[Ft(p.window7d.totalTokens)," tokens · ",p.window7d.sessionCount," session",p.window7d.sessionCount!==1?"s":""," (7d)"]}),u.creditsBalance&&!u.creditsUnlimited&&g.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",u.creditsBalance,u.overageReached&&" · overage limit reached"]}),u.creditsUnlimited&&g.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),u.resetCredits&&u.resetCredits.availableCount>0&&g.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${zt} only reports them`,children:[u.resetCredits.availableCount," rate-limit reset",u.resetCredits.availableCount!==1?"s":""," available",u.resetCredits.nextExpiryAt&&` · expires ${new Date(u.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),u.promo&&g.jsx("div",{className:"up-quota-sub",children:u.promo}),u.partial&&g.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(u==null?void 0:u.ok)===!1?g.jsxs("div",{className:"up-quota-na",children:[g.jsx("span",{children:"Quota unavailable."}),g.jsx("span",{className:"up-quota-hint",children:j3(u.reason)})]}):g.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),b?g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"up-total",children:[g.jsx("span",{className:"up-total-value",children:Fe(w.total)}),g.jsx("span",{className:"up-total-label",children:"total spend"})]}),g.jsx(S3,{cost:w}),k>0&&g.jsxs("div",{className:"up-tokens-row",children:[g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"in"}),Ft(N.in)]}),g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"out"}),Ft(N.out)]}),N.cacheR>0&&g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"cache r"}),Ft(N.cacheR)]}),N.cacheC>0&&g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"cache c"}),Ft(N.cacheC)]})]}),y.filter(O=>O.cost.total>0).length>0&&g.jsxs("section",{className:"up-section",children:[g.jsx("h4",{className:"up-section-title",children:"By model"}),g.jsxs("table",{className:"up-table",children:[g.jsx("thead",{children:g.jsxs("tr",{children:[g.jsx("th",{children:"Model"}),g.jsx("th",{children:"Tokens"}),g.jsx("th",{children:"Cost"})]})}),g.jsx("tbody",{children:y.filter(O=>O.cost.total>0).map(O=>g.jsxs("tr",{children:[g.jsx("td",{className:"up-model-name",title:O.model,children:li(O.model)}),g.jsx("td",{className:"up-num",children:Ft(O.inputTokens+O.outputTokens)}),g.jsx("td",{className:"up-num up-cost-val",children:Fe(O.cost.total)})]},O.model))})]})]}),S.filter(O=>O.cost>0).length>0&&g.jsxs("section",{className:"up-section",children:[g.jsx("h4",{className:"up-section-title",children:"By session"}),g.jsx("div",{className:"up-sessions",children:S.filter(O=>O.cost>0).map(O=>g.jsxs("div",{className:"up-session-row",children:[g.jsx("span",{className:`sl-dot state-${O.state}`,"aria-hidden":!0}),g.jsx("span",{className:"up-session-label",children:O.label}),g.jsx("span",{className:"up-session-tokens",children:Ft(O.inputTokens+O.outputTokens)}),g.jsx("span",{className:"up-session-cost",children:Fe(O.cost)})]},O.sessionId))})]})]}):k>0?g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"up-tokens-row",children:[g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"in"}),Ft(N.in)]}),g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"out"}),Ft(N.out)]})]}),g.jsx("div",{className:"up-hint",children:"Cost appears once a known model is detected."})]}):g.jsxs("div",{className:"up-empty",children:["No usage data yet.",g.jsx("br",{}),"Start a Claude Code or Codex session."]})]})}const zx=18,I3=1100,no=(e,n)=>{const r=Math.sin(e*12.9898+n*78.233)*43758.5453;return r-Math.floor(r)},M3=Array.from({length:zx},(e,n)=>{const r=-72+144*n/(zx-1)+(no(n,1)-.5)*9,i=(r-90)*(Math.PI/180),o=(54+32*Math.cos(r*Math.PI/180))*(.74+no(n,2)*.52);return{dx:Math.cos(i)*o,dy:Math.sin(i)*o,rot:(n%2?1:-1)*(100+no(n,3)*260),delay:Math.round(no(n,4)*90),dur:760+Math.round(no(n,5)*260),scale:.8+no(n,6)*.45,hue:n%4,round:n%3===0}});function Bx({anchor:e,lifetimeMs:n=I3}){var l;const[r,i]=T.useState(null),o=typeof window<"u"&&((l=window.matchMedia)==null?void 0:l.call(window,"(prefers-reduced-motion: reduce)").matches);return T.useEffect(()=>{if(o)return;const u=e.current;if(!u)return;const c=u.getBoundingClientRect();i({x:c.left+c.width/2,y:c.top+c.height/2});const h=window.setTimeout(()=>i(null),n);return()=>window.clearTimeout(h)},[e,n,o]),o||!r?null:TI.createPortal(g.jsx("div",{className:"confetti",style:{left:`${r.x}px`,top:`${r.y}px`},"aria-hidden":!0,children:M3.map((u,c)=>g.jsx("span",{className:`confetti-bit${u.round?" round":""}`,"data-hue":u.hue,style:{"--dx":`${u.dx.toFixed(1)}px`,"--dy":`${u.dy.toFixed(1)}px`,"--rot":`${u.rot}deg`,"--s":u.scale.toFixed(2),animationDelay:`${u.delay}ms`,animationDuration:`${u.dur}ms, ${u.dur}ms`}},c))}),document.body)}const cC=new Set(["awaiting_url","awaiting_code","registering"]);function P3(e){return e!=null&&cC.has(e)}function dC(e){return e!=null&&e!=="done"&&!cC.has(e)}const O3="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",L3="the sign-in did not complete";function q3({state:e,serverError:n,localError:r}){const i=e==="idle";return{title:i?"Sign-in ended":"Sign-in failed",message:r||n||(i?O3:L3)}}const $3="done";function D3(){let e=!1;return{shouldAnnounce(n){return n!==$3?(e=!1,!1):e?!1:(e=!0,!0)}}}const Ux={already_running:"a sign-in is already in progress",no_url:"the claude CLI did not offer a sign-in link — is it installed?",not_waiting:"that sign-in is no longer waiting for a code",not_prompted:"the CLI has not asked for a code yet",code_rejected:"that code was not accepted — copy it again from the browser",no_verdict:"the claude CLI has not answered — try the code again",empty_code:"paste the code from the browser first",login_failed:"the code was not accepted",no_identity:"signed in, but the CLI still reports nobody logged in",add_failed:"signed in, but claude-swap could not record the account",not_a_share:"that does not look like a shared account — it should start with ccdeck1:",corrupt:"that share is incomplete — copy the whole thing",wrong_version:`that share was made by a newer ${zt}`,expired:"that share has expired — make a new one",import_failed:"claude-swap refused the import"},Hx={no_cswap:"claude-swap could not be run — it is not on this deck's PATH. Set AGENTS_DECK_CSWAP to its full path",timeout:"claude-swap took too long and was stopped — try again",switch_failed:"claude-swap refused the switch",bad_account:"that is not an account claude-swap has",unknown_setting:"claude-swap has no such setting",out_of_range:"that value is outside what the setting allows",bad_value:"claude-swap does not accept that value",set_failed:"claude-swap refused the change",command_failed:"claude-swap refused the command"},F3=`claude-swap could not read the login keychain — start ${zt} from a Terminal window rather than a background service`;function bv(e,n){return(e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(mo(e))?F3:e!=null&&e.reason&&Hx[e.reason]?Hx[e.reason]:(e==null?void 0:e.reason)||n}function mo(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const Wx={no_install:"ccusage is not installed, and AGENTS_DECK_NO_INSTALL=1 forbids fetching it — unset that variable and restart the deck, or install ccusage yourself",timeout:"ccusage took more than 90 seconds and was stopped — a narrower range usually finishes",bad_output:"ccusage ran but printed no usage data — try again, and run ccusage daily --json in a terminal if it keeps happening",run_failed:"ccusage could not report usage — try again",bad_range:"that date range is not a YYYYMMDD date — reopen the modal and pick one of the presets",unreachable:"the deck did not answer — check it is still running, then try again"},z3="ccusage could not be started — npx is not on this deck's PATH. Install Node's npm/npx, or put ccusage on PATH yourself";function B3(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}function U3(e,n){return B3(mo(e))?z3:e!=null&&e.reason&&Wx[e.reason]?Wx[e.reason]:(e==null?void 0:e.reason)||n}function au(e,n){return e!=null&&e.detail?e.detail:e!=null&&e.error&&dC(e.state)?e.error:e!=null&&e.reason&&Ux[e.reason]?Ux[e.reason]:e!=null&&e.error?e.error:(e==null?void 0:e.reason)||n}const H3=1500;async function Ql(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const Sv=ue.forwardRef((e,n)=>g.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:n,children:[g.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),g.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));Sv.displayName="SuccessMark";function W3({onClose:e,onChanged:n}){const[r,i]=T.useState("login"),[o,l]=T.useState(null),[u,c]=T.useState(""),[h,p]=T.useState(""),[d,m]=T.useState(!1),[y,w]=T.useState(null),[N,_]=T.useState(null),S=T.useRef(!1),b=T.useRef(null),k=T.useRef(null),E=T.useRef(null),C=T.useCallback(()=>{S.current&&Ql({action:"login-cancel"}).catch(()=>{}),e()},[e]);vo(C);const A=T.useCallback(async()=>{m(!0),w(null),S.current=!0;const q=await Ql({action:"login"}).catch(()=>null);if(m(!1),!(q!=null&&q.ok)){w(au(q,"could not start the sign-in"));return}l(q)},[]);T.useEffect(()=>{if(!P3(o==null?void 0:o.state))return;const q=window.setInterval(async()=>{try{const R=await fetch("/api/claude-accounts/login");R.ok&&l(await R.json())}catch{}},H3);return()=>window.clearInterval(q)},[o]);const M=T.useRef(n);M.current=n;const L=T.useRef(D3());T.useEffect(()=>{var q;(o==null?void 0:o.state)==="awaiting_code"&&((q=b.current)==null||q.focus()),L.current.shouldAnnounce(o==null?void 0:o.state)&&M.current()},[o==null?void 0:o.state]),T.useEffect(()=>{var q;r==="paste"&&((q=k.current)==null||q.focus())},[r]);const H=T.useCallback(async()=>{var R;m(!0),w(null);const q=await Ql({action:"login-code",code:u}).catch(()=>null);if(m(!1),!(q!=null&&q.ok)){w(au(q,"the code was not accepted")),q!=null&&q.state&&l(q),(R=b.current)==null||R.select();return}c(""),l(q)},[u,o]),O=T.useCallback(async()=>{m(!0),w(null);const q=await Ql({action:"import",blob:h}).catch(()=>null);if(m(!1),!(q!=null&&q.ok)){w(au(q,"the import failed"));return}p(""),_({added:q.added===!0,num:q.num??null,email:q.email??null}),n()},[h,n]),P=(o==null?void 0:o.state)==="done"?o.account:null,F=dC(o==null?void 0:o.state)||!!(y&&S.current&&!d),Y=q3({state:o==null?void 0:o.state,serverError:o==null?void 0:o.error,localError:y});return g.jsx("div",{className:"modal-backdrop",onClick:C,role:"presentation",children:g.jsxs("div",{className:"modal aa-modal",onClick:q=>q.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[g.jsxs("header",{className:"modal-head",children:[g.jsx("div",{className:"modal-title",children:g.jsxs("span",{className:"aa-tabs",role:"tablist",children:[g.jsx("button",{type:"button",role:"tab","aria-selected":r==="login",className:`aa-tab${r==="login"?" on":""}`,onClick:()=>i("login"),children:"Sign in"}),g.jsx("button",{type:"button",role:"tab","aria-selected":r==="paste",className:`aa-tab${r==="paste"?" on":""}`,onClick:()=>i("paste"),children:"Paste a share"})]})}),g.jsx("div",{className:"modal-actions",children:g.jsx("button",{type:"button",className:"btn icon-btn",onClick:C,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),g.jsx("section",{className:"modal-body aa-body",children:r==="login"?P?g.jsxs("div",{className:"aa-done",children:[g.jsx(Sv,{ref:E}),g.jsx(Bx,{anchor:E}),g.jsx("h4",{children:P.added?`Account ${P.num} added`:"Credentials refreshed"}),g.jsxs("p",{className:"aa-note",children:[g.jsx("strong",{children:P.email}),P.added?" is in the rotation. The account you were using is still active.":" was already managed, so its stored credentials were replaced."]}),g.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"})]}):(o==null?void 0:o.state)==="awaiting_code"||(o==null?void 0:o.state)==="registering"?g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"aa-step",children:[g.jsx("h4",{children:"1 · Approve in the browser"}),g.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),g.jsx("a",{className:"aa-link",href:o.url??"#",target:"_blank",rel:"noreferrer noopener",children:o.url})]}),g.jsxs("div",{className:"aa-step",children:[g.jsx("h4",{children:"2 · Paste the code it gives you"}),g.jsxs("div",{className:"aa-field",children:[g.jsx("input",{ref:b,type:"text",value:u,onChange:q=>c(q.target.value),onKeyDown:q=>{q.key==="Enter"&&u.trim()&&!d&&H()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:o.state==="registering"}),g.jsx("button",{type:"button",className:"btn primary",disabled:d||!u.trim()||o.state==="registering",onClick:H,children:o.state==="registering"?"registering…":"Continue"})]}),(y||o.error)&&g.jsx("p",{className:"aa-err",children:y??o.error}),g.jsx("p",{className:"aa-note",children:"The code goes straight to the claude CLI on this machine. It is never stored or sent anywhere else."})]})]}):F?g.jsxs("div",{className:"aa-step",children:[g.jsx("h4",{children:Y.title}),g.jsx("p",{className:"aa-err",children:Y.message}),g.jsx("button",{type:"button",className:"btn",onClick:()=>{S.current=!1,l(null),w(null),A()},children:"Try again"})]}):d||S.current?g.jsx("div",{className:"aa-step",children:g.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):g.jsxs("div",{className:"aa-step aa-primer",children:[g.jsx("h4",{children:"Sign in to Anthropic"}),g.jsx("p",{className:"aa-note",children:"Opens a browser tab where you approve the sign-in, then asks for the code it shows you. claude-swap records the account when it completes, and the account you are using now stays active."}),g.jsx("div",{className:"aa-actions",children:g.jsx("button",{type:"button",className:"btn primary",onClick:A,disabled:d,children:"Open the sign-in page"})})]}):N?g.jsxs("div",{className:"aa-done",children:[g.jsx(Sv,{ref:E}),N.added&&g.jsx(Bx,{anchor:E}),g.jsx("h4",{children:N.added?`Account ${N.num} imported`:"Already here"}),g.jsx("p",{className:"aa-note",children:N.added?g.jsxs(g.Fragment,{children:[N.email?g.jsx("strong",{children:N.email}):"That account"," is in the rotation now. Nothing changed on the deck you copied it from."]}):"This deck already holds that account, so nothing changed."}),g.jsxs("div",{className:"aa-actions",children:[g.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"}),g.jsx("button",{type:"button",className:"btn",onClick:()=>_(null),children:"Import another"})]})]}):g.jsxs("div",{className:"aa-step",children:[g.jsx("h4",{children:"Paste an account shared from another deck"}),g.jsxs("div",{className:"aa-field",children:[g.jsx("input",{ref:k,type:"text",value:h,onChange:q=>p(q.target.value),onKeyDown:q=>{q.key==="Enter"&&h.trim()&&!d&&O()},placeholder:"ccdeck1:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),g.jsx("button",{type:"button",className:"btn primary",disabled:d||!h.trim(),onClick:O,children:d?"importing…":"Import"})]}),y&&g.jsx("p",{className:"aa-err",children:y}),g.jsxs("p",{className:"aa-note",children:["Use ",g.jsx("strong",{children:"share"})," on an account in the other deck. A share carries a live login and expires ten minutes after it is made."]})]})})]})})}function V3(e,n){const r=new Set(e),i=e.length?Math.max(...e):0;return[...new Set([...e,i+1])].sort((o,l)=>o-l).map(o=>{const l=o===n?"here":r.has(o)?"swap":"free";return{slot:o,kind:l,label:l==="here"?`slot ${o}`:`slot ${o} · ${l}`}})}function G3(e,n,r){if(!(r!=null&&r.ok))return null;const i=Number.isInteger(r.to)?r.to:null;if(i==null)return{menuFor:null,confirmRemove:null,shareFor:null,swapNote:null};const o=r.swapped===!0&&i!==n;return{menuFor:e.menuFor===n?i:o&&e.menuFor===i?n:e.menuFor,confirmRemove:null,shareFor:null,swapNote:o?{at:i,displaced:n}:null}}function Y3(e,n){const r=e.trim();return{alias:r,commit:r!==(n??"").trim()}}const K3=Object.freeze({text:"couldn't reach the deck server",reload:!0});async function Vx(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function X3(e){const n=e.find(i=>!i.ok);if(!n)return null;const r=mo(n.body);return{text:bv(n.body,`the deck server answered ${n.status}`),...r?{raw:r}:{},reload:!0}}function Gx(e,n){return n?e!=null&&e.reload&&e.text===n.text&&e.raw===n.raw?e:n:e!=null&&e.reload?null:e}const Yx=15e3,Q3=8e3,Z3=1800,J3=3e4,eL=[70,80,85,90,95];function tL(e,n){const r=e-n;if(r<=0)return null;const i=Math.floor(r/86400),o=Math.floor(r%86400/3600),l=Math.floor(r%3600/60);return i>0?`${i}d ${o}h`:o>0?`${o}h ${l}m`:`${l}m`}function Kx(e,n){const r=n-Math.floor(e/1e3);return r<60?"just now":r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:`${Math.floor(r/86400)}d ago`}function nL(e,n){if(!e)return"";const r=Math.floor(e/1e3)-n;return r<=0?" · due":r<60?` · next in ${r}s`:` · next in ${Math.round(r/60)}m`}function rL(e){switch(e){case"invalid_grant":case"no_refresh_token":return{text:"login expired",hint:"claude-swap's stored login for this account was rejected and cannot be refreshed. Signing in again replaces it — the account keeps its slot, its alias and its history.",fixable:!0};case"http-401":return{text:"re-login needed",hint:"Anthropic refused this account's token.",fixable:!0};case"http-429":return{text:"rate limited",hint:"Anthropic is throttling requests for this account. It clears on its own.",fixable:!1};case"transient":return{text:"temporary error",hint:"A network or server hiccup while reading usage. The next collection retries.",fixable:!1};case"timeout":return{text:"timed out",hint:"Reading this account's usage took too long. The next collection retries.",fixable:!1};case"network":return{text:"unreachable",hint:"Could not reach Anthropic to read this account's usage.",fixable:!1};default:return{text:e,hint:`claude-swap reported "${e}" for this account.`,fixable:!1}}}function sL({lane:e,nowSec:n}){const r=Math.min(100,Math.max(0,e.pct)),i=r>=90?"var(--err)":r>=70?"var(--warn)":"var(--accent)",o=e.resetAt?tL(e.resetAt,n):null;return g.jsxs("div",{className:"ap-lane",children:[g.jsx("span",{className:"ap-lane-label",children:e.label}),g.jsx("div",{className:"ap-lane-track",children:g.jsx("div",{className:"ap-lane-fill",style:{width:`${r===0?1.5:r}%`,background:i,opacity:r===0?.4:1}})}),g.jsxs("span",{className:"ap-lane-pct",style:{color:i},children:[r,"%"]}),g.jsx("span",{className:"ap-lane-reset",children:o?`resets ${o}`:""})]})}async function iL(e){var r;let n=!1;try{n=await Promise.race([((r=navigator.clipboard)==null?void 0:r.writeText(e).then(()=>!0))??Promise.resolve(!1),new Promise(i=>window.setTimeout(()=>i(!1),500))])}catch{n=!1}if(n)return!0;try{const i=document.createElement("textarea");i.value=e,i.setAttribute("readonly",""),i.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(i),i.select(),n=document.execCommand("copy"),i.remove()}catch{n=!1}return n}function oL(e,n){const r=Math.round(e/1e3)-n;return r<=0?{text:"expired",tone:"gone"}:r<60?{text:`expires in ${r}s`,tone:"soon"}:{text:`expires in ${Math.round(r/60)}m`,tone:"ok"}}function aL({onClose:e}){var re,le,fe;const[n,r]=T.useState(null),[i,o]=T.useState(null),[l,u]=T.useState(null),[c,h]=T.useState(!1),[p,d]=T.useState(null),[m,y]=T.useState(null),[w,N]=T.useState(()=>Math.floor(Date.now()/1e3)),_=T.useRef(null),[S,b]=T.useState(null),[k,E]=T.useState(!1),[C,A]=T.useState(""),[M,L]=T.useState(null),[H,O]=T.useState(null),[P,F]=T.useState(null),[Y,q]=T.useState(!1),[R,Q]=T.useState(null),z=T.useCallback(async(te=!1)=>{te&&h(!0);const ce=new AbortController,Ce=window.setTimeout(()=>ce.abort(),J3);try{const[ve,Te]=await Promise.all([fetch(`/api/claude-accounts${te?"?refresh=1":""}`,{signal:ce.signal}),fetch("/api/cswap-auto",{signal:ce.signal})]);ve.ok&&r(await ve.json()),Te.ok&&o(await Te.json());const ye=X3([await Vx(ve),await Vx(Te)]);y(ke=>Gx(ke,ye))}catch{y(ve=>Gx(ve,K3))}finally{window.clearTimeout(Ce),te&&h(!1)}},[]),ne=T.useCallback(async(te,ce)=>{u(ce),y(null);try{const ve=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(te)})).json().catch(()=>null);return ve!=null&&ve.ok||y({text:bv(ve,"command failed"),raw:mo(ve)}),ve}catch{return y({text:"server unreachable"}),null}finally{u(null)}},[]),Z=T.useCallback(async(te,ce)=>{u(ce),y(null);try{const ve=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(te)})).json().catch(()=>null);return ve!=null&&ve.ok||y({text:au(ve,"command failed")}),ve}catch{return y({text:"server unreachable"}),null}finally{u(null)}},[]);T.useEffect(()=>(z(!0),_.current=window.setInterval(()=>z(!1),Yx),()=>{_.current!=null&&window.clearInterval(_.current)}),[z]),T.useEffect(()=>{const te=window.setInterval(()=>N(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(te)},[]);const $=((re=i==null?void 0:i.settings["autoswitch.threshold"])==null?void 0:re.value)??"90",X=(le=n==null?void 0:n.accounts)==null?void 0:le.find(te=>te.active),I=X!=null&&X.lanes.length?Math.max(...X.lanes.map(te=>te.pct)):null,W=I!=null&&I>=Number($)-15,G=async te=>{d(te),y(null);try{const Ce=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:te})})).json().catch(()=>null);Ce!=null&&Ce.ok||y({text:bv(Ce,"the switch failed"),raw:mo(Ce)}),await z(!0)}catch{y({text:"server unreachable"})}finally{d(null)}},U=async(te,ce)=>{const{commit:Ce,alias:ve}=Y3(C,ce);if(Ce){const Te=await Z({action:"alias",account:te,alias:ve},`alias-${te}`);if(await z(!0),!(Te!=null&&Te.ok))return;A(ve)}L(te),window.setTimeout(()=>L(Te=>Te===te?null:Te),Z3)},J=async(te,ce)=>{const Ce=await Z({action:"move",account:te,slot:ce},`move-${te}`),ve=G3({menuFor:S,shareFor:(P==null?void 0:P.num)??null},te,Ce);if(await z(!0),ve){b(ve.menuFor),O(ve.confirmRemove),ve.shareFor==null&&(F(null),q(!1)),Q(ve.swapNote);const Te=ve.swapNote;Te&&window.setTimeout(()=>Q(ye=>ye===Te?null:ye),Q3)}};return g.jsxs("div",{className:"accounts-panel","aria-label":"Claude accounts",children:[g.jsxs("div",{className:"ap-header",children:[g.jsx("h3",{children:"Accounts"}),g.jsxs("div",{className:"ap-header-right",children:[g.jsx("button",{type:"button",className:"btn ap-add",onClick:()=>E(!0),title:"Sign in to another Claude account, or paste one shared from another deck",children:"+"}),g.jsx("button",{type:"button",className:"btn ap-refresh",onClick:()=>z(!0),disabled:c,"aria-label":"Reload accounts",title:"Reload from claude-swap",children:c?"…":"↻"}),g.jsx("button",{type:"button",className:"btn icon-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:"×"})]})]}),n==null?m?g.jsxs("div",{className:"ap-empty",role:"alert",children:[g.jsx("span",{title:m.raw||void 0,children:m.text}),g.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",Yx/1e3," seconds."]}),g.jsx("button",{type:"button",className:"ap-fix",disabled:c,onClick:()=>z(!0),children:c?"trying…":"try again"})]}):g.jsx("div",{className:"ap-empty",children:"Checking…"}):n.ok?g.jsxs(g.Fragment,{children:[(fe=n.accounts)==null?void 0:fe.map(te=>g.jsxs("div",{className:`ap-account${te.active?" active":""}${te.disabled?" disabled":""}`,children:[g.jsxs("div",{className:"ap-account-head",children:[g.jsx("span",{className:"ap-num",children:te.num}),te.alias&&g.jsx("span",{className:"ap-alias",children:te.alias}),g.jsx("span",{className:"ap-email",title:te.org??void 0,children:te.email}),g.jsx("button",{type:"button",className:`ap-more${S===te.num?" on":""}`,"aria-label":`Manage account ${te.num}`,"aria-expanded":S===te.num,"aria-controls":S===te.num?`ap-manage-${te.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{b(S===te.num?null:te.num),A(te.alias??""),O(null),F(null),q(!1),Q(null),L(null)},children:"⋯"}),te.active?g.jsx("span",{className:"ap-badge-active",children:"● active"}):g.jsx("button",{type:"button",className:"btn ap-switch",disabled:p!=null||te.disabled,onClick:()=>G(te.num),title:te.disabled?"Held out of rotation":`Switch to ${te.alias??te.email}`,children:p===te.num?"…":"switch"})]}),te.lanes.length>0?te.lanes.map(ce=>g.jsx(sL,{lane:ce,nowSec:w},ce.id)):g.jsx("div",{className:"ap-hint",children:"No usage recorded yet."}),g.jsxs("div",{className:"ap-meta",children:[te.error&&(()=>{const ce=rL(te.error);return g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"ap-err",title:ce.hint,children:ce.text}),ce.fixable&&g.jsx("button",{type:"button",className:"ap-fix",onClick:()=>E(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"sign in again"})]})})(),((i==null?void 0:i.enabled)||(i==null?void 0:i.external))&&!te.active&&g.jsx("button",{type:"button",className:"ap-rotate",disabled:l!=null,onClick:()=>ne({action:"account",account:te.num,enabled:te.disabled},`rot-${te.num}`).then(()=>z(!0)),title:te.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",children:te.disabled?"held out":"in rotation"}),te.fetchedAt?g.jsxs("span",{className:`ap-age${te.stale?" ap-stale":""}`,title:"When claude-swap last read this account's usage, and when it plans to read it again. It sets that interval itself — 3 minutes at the fastest, wider while an account is recovering from a rate limit — and every surface, including `cswap watch`, follows the same plan.",children:["collected ",Kx(te.fetchedAt,w),nL(te.nextAt,w)]}):g.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),S===te.num&&g.jsxs("div",{className:"ap-manage",id:`ap-manage-${te.num}`,role:"group","aria-label":`Manage account ${te.num}`,children:[g.jsxs("div",{className:"ap-manage-name",children:[g.jsx("label",{className:"ap-vh",htmlFor:`ap-alias-${te.num}`,children:"Alias"}),g.jsx("input",{id:`ap-alias-${te.num}`,className:"ap-manage-input",type:"text",value:C,onChange:ce=>A(ce.target.value),onKeyDown:ce=>{ce.key==="Enter"&&U(te.num,te.alias)},placeholder:"e.g. work",spellCheck:!1,autoFocus:!0}),g.jsx("button",{type:"button",className:"ap-manage-btn",disabled:l!=null,onClick:()=>U(te.num,te.alias),title:"A short name to show instead of the email",children:M===te.num?"saved":"save"})]}),g.jsxs("div",{className:"ap-manage-acts",children:[g.jsx("label",{className:"ap-vh",htmlFor:`ap-slot-${te.num}`,children:"Slot"}),g.jsx("span",{className:"ap-field",children:g.jsx("select",{id:`ap-slot-${te.num}`,value:String(te.num),disabled:l!=null,onChange:ce=>J(te.num,Number(ce.target.value)),children:V3((n.accounts??[]).map(ce=>ce.num),te.num).map(ce=>g.jsx("option",{value:ce.slot,children:ce.label},ce.slot))})}),g.jsx("button",{type:"button",className:"ap-manage-btn",disabled:l!=null,title:`Copy this account to another ${zt}. The share carries a live login and expires in 10 minutes.`,onClick:async()=>{q(!1);const ce=await Z({action:"share",account:te.num},`share-${te.num}`);ce!=null&&ce.ok&&F({num:te.num,blob:ce.blob,expiresAt:ce.expiresAt})},children:"share"}),g.jsx("button",{type:"button",className:`ap-manage-btn danger${H===te.num?" armed":""}`,disabled:l!=null,title:H===te.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(H!==te.num){O(te.num),window.setTimeout(()=>O(ce=>ce===te.num?null:ce),4e3);return}O(null),Z({action:"remove",account:te.num},`rm-${te.num}`).then(()=>{b(null),z(!0)})},children:H===te.num?"confirm":"remove"})]}),(R==null?void 0:R.at)===te.num&&(()=>{var ve;const ce=(ve=n.accounts)==null?void 0:ve.find(Te=>Te.num===R.displaced),Ce=(ce==null?void 0:ce.alias)??(ce==null?void 0:ce.email)??"the account that was there";return g.jsxs("span",{className:"ap-manage-hint ap-manage-swap",title:`Slot ${R.at} was taken, so the two accounts traded places: ${Ce} now holds slot ${R.displaced}.`,children:["swapped with slot ",R.displaced]})})(),(P==null?void 0:P.num)===te.num&&(()=>{const ce=oL(P.expiresAt,w),Ce=ce.tone==="gone";return g.jsxs("div",{className:`ap-share${Ce?" expired":""}`,children:[g.jsx("code",{className:"ap-share-blob",children:P.blob}),g.jsxs("div",{className:"ap-share-foot",children:[g.jsx("button",{type:"button",className:"ap-manage-btn",disabled:l!=null,onClick:async()=>{if(Ce){q(!1);const ve=await Z({action:"share",account:te.num},`share-${te.num}`);ve!=null&&ve.ok&&F({num:te.num,blob:ve.blob,expiresAt:ve.expiresAt});return}await iL(P.blob)&&(q(!0),window.setTimeout(()=>q(!1),1800))},children:Ce?"make a new share":Y?"copied":"copy"}),g.jsxs("span",{className:"ap-manage-hint",children:["carries a live login · ",g.jsx("span",{className:`ap-share-expiry ${ce.tone}`,children:ce.text})]})]})]})})()]})]},te.num)),(i==null?void 0:i.ok)&&g.jsxs("div",{className:"ap-auto",children:[g.jsxs("div",{className:"ap-auto-head",children:[g.jsx("span",{className:"ap-auto-title",children:"Auto-switch"}),g.jsxs("span",{className:"ap-auto-ctl",children:[I!=null&&g.jsxs("span",{className:`ap-auto-now${W?" near":""}`,children:[Math.round(I),"%"]}),g.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:g.jsx("select",{"aria-label":"Switch threshold",value:$,disabled:l!=null,onChange:te=>ne({action:"setting",key:"autoswitch.threshold",value:te.target.value},"threshold").then(()=>z(!0)),children:eL.map(te=>g.jsxs("option",{value:te,children:[te,"%"]},te))})}),g.jsxs("button",{type:"button",className:`ap-auto-state${i.enabled?" live":""}`,role:"switch","aria-checked":i.enabled,disabled:l!=null,onClick:()=>ne({action:"enable",enabled:!i.enabled},"enable").then(()=>z(!0)),title:i.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:[g.jsx("i",{className:i.enabled?"ap-pulse":"ap-dot","aria-hidden":!0}),i.enabled?"on":"off"]})]})]}),i.external&&g.jsxs("p",{className:"ap-auto-note",children:[g.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",g.jsx("code",{children:"cswap auto"})," loop in your terminal is doing the switching. The deck stands down while it runs",i.enabled?" — this toggle takes over when you stop it.":"."]}),i.lastTick&&g.jsx("div",{className:"ap-auto-foot",children:g.jsxs("span",{className:"ap-auto-result",children:["checked ",Kx(i.lastTick.at,w)]})})]}),m&&g.jsxs("div",{className:"ap-failure",role:"alert",children:[g.jsx("span",{className:"ap-failure-text",title:m.raw||void 0,children:m.text}),g.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>y(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),g.jsx("p",{className:"ap-footnote",title:"Anthropic's usage endpoint allows roughly 28–30 requests per hour per account, shared by every tool on this machine — polling it from here would rate-limit your account. So the deck never fetches: it asks claude-swap to collect while this panel is open, at most once every three minutes, and claude-swap decides whether that touches the network at all.",children:"Collected by claude-swap while this panel is open."})]}):g.jsx("div",{className:"ap-empty",children:n.reason==="no_cswap"?g.jsxs(g.Fragment,{children:[g.jsx("span",{children:"claude-swap isn't installed."}),g.jsx("span",{className:"ap-hint",children:"This panel reads the account store claude-swap keeps — without it there is nothing to show. It is a separate tool, published on PyPI, so it does not come with this package."}),n.hint&&g.jsx("code",{className:"ap-cmd",children:n.hint}),g.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",g.jsx("strong",{children:"+"})," button above."]})]}):n.reason==="no_accounts"?g.jsxs(g.Fragment,{children:[g.jsx("span",{children:"No accounts added yet."}),g.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",g.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):g.jsxs(g.Fragment,{children:[g.jsx("span",{children:"Couldn't read the account store."}),g.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",n.reason?` (${n.reason})`:"","."]})]})}),k&&g.jsx(W3,{onClose:()=>E(!1),onChanged:()=>z(!0)})]})}const lL=3e4;function uL({bundle:e,running:n,lastTried:r}){return!n||e===n?!1:r!==n}function cL({bundle:e,running:n,pending:r,lastTried:i}){return n?uL({bundle:e,running:n,lastTried:i})?"reload":r==null||r&&r!==n?"wait":"confirm":"wait"}function dL(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function fL({asked:e,reported:n}){return n?n!==e:!1}function hL(e){const n=e.thresholdMs??lL;return!e.enabled||e.kind!=="restart"||!e.canRestart?{idleSince:null,restart:!1}:e.busy?{idleSince:null,restart:!1}:e.idleSince==null?{idleSince:e.now,restart:!1}:e.now<e.idleSince?{idleSince:e.now,restart:!1}:{idleSince:e.idleSince,restart:e.now-e.idleSince>=n}}function pL(e){return e.ctrlKey||e.metaKey||e.altKey}const mL=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),gL=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),vL=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function fC(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function hC(e){if(!e)return!1;if(e.isContentEditable)return!0;const n=fC(e);return n==="TEXTAREA"?!0:n!=="INPUT"?!1:!mL.has(String(e.type??"text").toLowerCase())}function yL(e){if(!e)return!1;if(hC(e)||gL.has(fC(e)))return!0;const n=typeof e.role=="string"?e.role.trim().toLowerCase():"";return n!==""&&n.split(/\s+/).some(r=>vL.has(r))}function wL({agentCount:e,onConfirm:n,onCancel:r}){const i=T.useRef(null);vo(r,{focusRef:i,layer:gO});const o=e===0?"This deletes the server's event log":`This removes ${e===1?"the one agent":`all ${e} agents`} on the canvas and deletes the server's event log`;return g.jsx("div",{className:"modal-backdrop",onClick:r,role:"presentation",children:g.jsxs("div",{className:"modal clear-confirm",onClick:l=>l.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[g.jsxs("header",{className:"modal-head",children:[g.jsxs("div",{className:"modal-title",children:[g.jsx("span",{className:"status-dot err","aria-hidden":!0}),g.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),g.jsx("div",{className:"modal-actions",children:g.jsx("button",{type:"button",className:"btn icon-btn",onClick:r,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),g.jsxs("section",{className:"modal-body",children:[g.jsxs("p",{className:"modal-note",children:[o," — the file a restarted deck replays to rebuild what you see. Layout, pins and selection go with it. This cannot be undone."]}),g.jsxs("div",{className:"cc-actions",children:[g.jsx("button",{type:"button",ref:i,className:"btn",onClick:r,children:"Cancel"}),g.jsx("button",{type:"button",className:"btn danger",onClick:n,children:"Clear everything"})]})]})]})})}function xL(e,n){return e==="confirmation"?n.confirmOpen?"clear":"ignore":n.modalOpen||n.confirmOpen?"ignore":"confirm"}function Zl(e,n){if(n.size!==0)for(const r of Array.from(e.keys()))n.has(r)||e.delete(r)}function _L(e){const n=new Set;for(const r of e)n.add(r.id),n.add(`group:${r.sessionId}`);return n}function pC(e,n,r){return!n.has(e)||r.has(e)}function bL(e,n,r,i){return!n.has(e)&&pC(e,r,i)}function SL(e,n,r){const i={x:0,y:0};return n.set(e,i),r.add(e),i}function kL(e,n,r,i){r.set(e,n),i.delete(e)}const EL=40,NL=120;function CL(e,n){let r=null,i=0,o=Number.NEGATIVE_INFINITY;const l=()=>{r=null,o=n.now(),e()},u=()=>{r!=null&&(n.clearTimeout(r),r=null)},c=(h,p,d)=>{if(r!=null){if(i<=h)return;u()}const m=Math.min(d,Math.max(0,h-p));i=h,r=n.setTimeout(l,m)};return{live(h=EL){const p=n.now(),d=Math.max(o+h,p);if(d<=p){u(),l();return}c(d,p,h)},replay(h=NL){u(),i=n.now()+h,r=n.setTimeout(l,h)},flush(){u(),l()},cancel(){u()}}}function jL(){let e=!1,n=[];return{get paused(){return e},get size(){return n.length},accept(r){return e?(n.push(r),!1):!0},setPaused(r){if(e=r,r||n.length===0)return[];const i=n;return n=[],i}}}const RL="1",Xx="agent-dag.schema",TL=["agent-dag.layout","agent-dag.viewport"];function mC(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function AL(e,n=RL){let r=null;try{r=e.getItem(Xx)}catch{return[]}if(r===n)return[];const i=[];if(r!==null)for(const o of TL)try{e.getItem(o)!==null&&(e.removeItem(o),i.push(o))}catch{}try{e.setItem(Xx,n)}catch{}return i}const gC="agent-dag.theme";function IL(e){return e==="light"?"light":"dark"}function ML(){return IL(mC(gC))}function PL({waiting:e,running:n}){return{title:e>0?`(${e}) ${zt}`:zt,icon:e>0?"waiting":n>0?"running":"idle"}}const Od={waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function Ld(e,n){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">${n==="waiting"?`<circle cx="16" cy="16" r="14.5" fill="${e}"/>`:`<circle cx="16" cy="16" r="12" fill="none" stroke="${e}" stroke-width="5"/>`+(n==="running"?`<circle cx="16" cy="16" r="5" fill="${e}"/>`:"")}</svg>`}const OL=Object.freeze({waiting:`data:image/svg+xml,${encodeURIComponent(Ld(Od.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(Ld(Od.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(Ld(Od.idle,"idle"))}`});function LL(){let e=0;return{begin(){const n=++e;return()=>n===e},cancel(){e++}}}function qL(e,n=new Date){return new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}function $L(e){return!e.answer||e.answer.range!==e.want?{phase:"busy",stale:!1}:e.answer.ok?{phase:e.answer.days>0?"chart":"empty",stale:e.loading}:{phase:"error",stale:e.loading}}function Jl(e){const n=e.toLowerCase();return n.includes("opus")?"#c4b5fd":n.includes("sonnet")?"#7dd3fc":n.includes("haiku")?"#86efac":n.includes("gpt-5")||n.includes("gpt5")?"#fcd34d":n.includes("gpt")?"#fca5a5":n.includes("gemini")?"#a5b4fc":n.includes("codex")?"#fdba74":"#94a3b8"}const DL=[7,14,30,90];function FL(e){const[n,r]=T.useState(null),[i,o]=T.useState(!1),l=T.useRef(LL()).current,u=(c=!1)=>{const h=l.begin(),p=e;o(!0);const m=`/api/ccusage?since=${qL(p)}${c?"&refresh=1":""}`;fetch(m).then(y=>y.json()).then(y=>{h()&&r({range:p,resp:y})}).catch(()=>{h()&&r({range:p,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{h()&&o(!1)})};return T.useEffect(()=>(u(!1),()=>l.cancel()),[e]),{landed:n,loading:i,reload:()=>u(!0)}}function zL({onClose:e}){var k,E,C;const[n,r]=T.useState(30),[i,o]=T.useState(null),{landed:l,loading:u,reload:c}=FL(n);vo(e);const h=$L({loading:u,want:n,answer:l&&{range:l.range,ok:l.resp.ok===!0,days:((k=l.resp.days)==null?void 0:k.length)??0}}),p=h.phase==="chart"?l.resp.days??[]:[],d=T.useMemo(()=>p.reduce((A,M)=>Math.max(A,M.totalCost),0),[p]),{totalCost:m,totalTok:y,inOut:w,cacheRead:N,modelCosts:_}=T.useMemo(()=>{let A=0,M=0,L=0,H=0;const O=new Map;for(const P of p){A+=P.totalCost,M+=P.totalTokens,L+=P.inputTokens+P.outputTokens,H+=P.cacheReadTokens;for(const F of P.modelBreakdowns)O.set(F.modelName,(O.get(F.modelName)??0)+F.cost)}return{totalCost:A,totalTok:M,inOut:L,cacheRead:H,modelCosts:O}},[p]),S=T.useMemo(()=>Array.from(_.entries()).sort((A,M)=>M[1]-A[1]),[_]),b=i?p.find(A=>A.period===i)??null:null;return g.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:g.jsxs("div",{className:"uh-modal",onClick:A=>A.stopPropagation(),role:"dialog","aria-label":"Usage history",children:[g.jsxs("header",{className:"uh-head",children:[g.jsxs("div",{className:"uh-titlewrap",children:[g.jsx("div",{className:"uh-title",children:"Usage history"}),g.jsx("div",{className:"uh-sub",children:"via ccusage · local Claude / Codex logs"})]}),g.jsx("div",{className:"uh-range",role:"tablist","aria-label":"Range",children:DL.map(A=>g.jsxs("button",{role:"tab","aria-selected":n===A,className:`uh-range-btn${n===A?" on":""}`,onClick:()=>{r(A),o(null)},children:[A,"d"]},A))}),g.jsx("button",{className:"btn icon-btn uh-reload",onClick:c,disabled:u,title:"Re-run ccusage","aria-label":"Reload",children:u?"…":"↻"}),g.jsx("button",{className:"uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),h.phase==="busy"?g.jsx("div",{className:"uh-status","aria-busy":"true",children:l?"running ccusage…":"running ccusage… (first run downloads the package)"}):h.phase==="error"?g.jsxs("div",{className:"uh-status uh-err",title:mo(l.resp)||void 0,children:[U3(l.resp,"ccusage did not report usage"),g.jsx("div",{children:g.jsx("button",{className:"btn uh-retry",onClick:c,disabled:u,children:u?"trying…":"Try again"})})]}):h.phase==="empty"?g.jsx("div",{className:`uh-status${h.stale?" uh-stale":""}`,"aria-busy":h.stale||void 0,children:"no usage in this range"}):g.jsxs("div",{className:h.stale?"uh-stale":void 0,"aria-busy":h.stale||void 0,children:[g.jsxs("div",{className:"uh-totals",children:[g.jsx(eu,{label:"total cost",val:Fe(m),accent:!0}),g.jsx(eu,{label:"tokens",val:Ft(y)}),g.jsx(eu,{label:"input+output",val:Ft(w)}),g.jsx(eu,{label:"cache reads",val:Ft(N)})]}),g.jsx("div",{className:"uh-chart",role:"img","aria-label":"Daily cost by model",children:p.map(A=>{const M=d>0?A.totalCost/d*100:0,L=A.period===i;return g.jsxs("button",{className:`uh-bar-col${L?" sel":""}`,onClick:()=>o(L?null:A.period),title:`${A.period} · ${Fe(A.totalCost)}`,style:{flexBasis:`${100/p.length}%`},children:[g.jsx("div",{className:"uh-bar",style:{height:`${Math.max(M,A.totalCost>0?2:0)}%`},children:A.modelBreakdowns.slice().sort((H,O)=>O.cost-H.cost).map(H=>{const O=A.totalCost>0?H.cost/A.totalCost*100:0;return g.jsx("div",{className:"uh-bar-seg",style:{height:`${O}%`,background:Jl(H.modelName)}},H.modelName)})}),g.jsx("span",{className:"uh-bar-label",children:A.period.slice(5)})]},A.period)})}),g.jsx("div",{className:"uh-legend",children:S.map(([A,M])=>g.jsxs("span",{className:"uh-legend-item",children:[g.jsx("span",{className:"uh-legend-dot",style:{background:Jl(A)}}),li(A)," ",g.jsx("span",{className:"uh-legend-cost",children:Fe(M)})]},A))}),b&&g.jsxs("div",{className:"uh-detail",children:[g.jsxs("div",{className:"uh-detail-head",children:[g.jsx("span",{className:"uh-detail-date",children:b.period}),g.jsx("span",{className:"uh-detail-cost",children:Fe(b.totalCost)}),(C=(E=b.metadata)==null?void 0:E.agents)!=null&&C.length?g.jsx("span",{className:"uh-detail-agents",children:b.metadata.agents.join(" · ")}):null]}),g.jsxs("div",{className:"uh-detail-mini",children:[g.jsx(tu,{label:"input",val:Ft(b.inputTokens)}),g.jsx(tu,{label:"output",val:Ft(b.outputTokens)}),g.jsx(tu,{label:"cache write",val:Ft(b.cacheCreationTokens)}),g.jsx(tu,{label:"cache read",val:Ft(b.cacheReadTokens)})]}),g.jsx("div",{className:"uh-detail-models",children:b.modelBreakdowns.slice().sort((A,M)=>M.cost-A.cost).map(A=>{const M=b.totalCost>0?A.cost/b.totalCost*100:0;return g.jsxs("div",{className:"uh-model-row",children:[g.jsxs("span",{className:"uh-model-name",children:[g.jsx("span",{className:"uh-legend-dot",style:{background:Jl(A.modelName)}}),li(A.modelName)]}),g.jsx("span",{className:"uh-model-bar",children:g.jsx("span",{className:"uh-model-bar-fill",style:{width:`${M}%`,background:Jl(A.modelName)}})}),g.jsx("span",{className:"uh-model-cost",children:Fe(A.cost)})]},A.modelName)})})]})]})]})})}function eu({label:e,val:n,accent:r}){return g.jsxs("div",{className:"uh-stat",children:[g.jsx("span",{className:`uh-stat-val${r?" accent":""}`,children:n}),g.jsx("span",{className:"uh-stat-label",children:e})]})}function tu({label:e,val:n}){return g.jsxs("div",{className:"uh-ministat",children:[g.jsx("span",{className:"uh-ministat-val",children:n}),g.jsx("span",{className:"uh-ministat-label",children:e})]})}function Yv(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var qd,Qx;function BL(){if(Qx)return qd;Qx=1;function e(){this.__data__=[],this.size=0}return qd=e,qd}var $d,Zx;function yo(){if(Zx)return $d;Zx=1;function e(n,r){return n===r||n!==n&&r!==r}return $d=e,$d}var Dd,Jx;function Ru(){if(Jx)return Dd;Jx=1;var e=yo();function n(r,i){for(var o=r.length;o--;)if(e(r[o][0],i))return o;return-1}return Dd=n,Dd}var Fd,e_;function UL(){if(e_)return Fd;e_=1;var e=Ru(),n=Array.prototype,r=n.splice;function i(o){var l=this.__data__,u=e(l,o);if(u<0)return!1;var c=l.length-1;return u==c?l.pop():r.call(l,u,1),--this.size,!0}return Fd=i,Fd}var zd,t_;function HL(){if(t_)return zd;t_=1;var e=Ru();function n(r){var i=this.__data__,o=e(i,r);return o<0?void 0:i[o][1]}return zd=n,zd}var Bd,n_;function WL(){if(n_)return Bd;n_=1;var e=Ru();function n(r){return e(this.__data__,r)>-1}return Bd=n,Bd}var Ud,r_;function VL(){if(r_)return Ud;r_=1;var e=Ru();function n(r,i){var o=this.__data__,l=e(o,r);return l<0?(++this.size,o.push([r,i])):o[l][1]=i,this}return Ud=n,Ud}var Hd,s_;function Tu(){if(s_)return Hd;s_=1;var e=BL(),n=UL(),r=HL(),i=WL(),o=VL();function l(u){var c=-1,h=u==null?0:u.length;for(this.clear();++c<h;){var p=u[c];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=n,l.prototype.get=r,l.prototype.has=i,l.prototype.set=o,Hd=l,Hd}var Wd,i_;function GL(){if(i_)return Wd;i_=1;var e=Tu();function n(){this.__data__=new e,this.size=0}return Wd=n,Wd}var Vd,o_;function YL(){if(o_)return Vd;o_=1;function e(n){var r=this.__data__,i=r.delete(n);return this.size=r.size,i}return Vd=e,Vd}var Gd,a_;function KL(){if(a_)return Gd;a_=1;function e(n){return this.__data__.get(n)}return Gd=e,Gd}var Yd,l_;function XL(){if(l_)return Yd;l_=1;function e(n){return this.__data__.has(n)}return Yd=e,Yd}var Kd,u_;function vC(){if(u_)return Kd;u_=1;var e=typeof $l=="object"&&$l&&$l.Object===Object&&$l;return Kd=e,Kd}var Xd,c_;function tr(){if(c_)return Xd;c_=1;var e=vC(),n=typeof self=="object"&&self&&self.Object===Object&&self,r=e||n||Function("return this")();return Xd=r,Xd}var Qd,d_;function wo(){if(d_)return Qd;d_=1;var e=tr(),n=e.Symbol;return Qd=n,Qd}var Zd,f_;function QL(){if(f_)return Zd;f_=1;var e=wo(),n=Object.prototype,r=n.hasOwnProperty,i=n.toString,o=e?e.toStringTag:void 0;function l(u){var c=r.call(u,o),h=u[o];try{u[o]=void 0;var p=!0}catch{}var d=i.call(u);return p&&(c?u[o]=h:delete u[o]),d}return Zd=l,Zd}var Jd,h_;function ZL(){if(h_)return Jd;h_=1;var e=Object.prototype,n=e.toString;function r(i){return n.call(i)}return Jd=r,Jd}var ef,p_;function ui(){if(p_)return ef;p_=1;var e=wo(),n=QL(),r=ZL(),i="[object Null]",o="[object Undefined]",l=e?e.toStringTag:void 0;function u(c){return c==null?c===void 0?o:i:l&&l in Object(c)?n(c):r(c)}return ef=u,ef}var tf,m_;function Ln(){if(m_)return tf;m_=1;function e(n){var r=typeof n;return n!=null&&(r=="object"||r=="function")}return tf=e,tf}var nf,g_;function qa(){if(g_)return nf;g_=1;var e=ui(),n=Ln(),r="[object AsyncFunction]",i="[object Function]",o="[object GeneratorFunction]",l="[object Proxy]";function u(c){if(!n(c))return!1;var h=e(c);return h==i||h==o||h==r||h==l}return nf=u,nf}var rf,v_;function JL(){if(v_)return rf;v_=1;var e=tr(),n=e["__core-js_shared__"];return rf=n,rf}var sf,y_;function eq(){if(y_)return sf;y_=1;var e=JL(),n=(function(){var i=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""})();function r(i){return!!n&&n in i}return sf=r,sf}var of,w_;function yC(){if(w_)return of;w_=1;var e=Function.prototype,n=e.toString;function r(i){if(i!=null){try{return n.call(i)}catch{}try{return i+""}catch{}}return""}return of=r,of}var af,x_;function tq(){if(x_)return af;x_=1;var e=qa(),n=eq(),r=Ln(),i=yC(),o=/[\\^$.*+?()[\]{}|]/g,l=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,h=u.toString,p=c.hasOwnProperty,d=RegExp("^"+h.call(p).replace(o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(y){if(!r(y)||n(y))return!1;var w=e(y)?d:l;return w.test(i(y))}return af=m,af}var lf,__;function nq(){if(__)return lf;__=1;function e(n,r){return n==null?void 0:n[r]}return lf=e,lf}var uf,b_;function ci(){if(b_)return uf;b_=1;var e=tq(),n=nq();function r(i,o){var l=n(i,o);return e(l)?l:void 0}return uf=r,uf}var cf,S_;function Kv(){if(S_)return cf;S_=1;var e=ci(),n=tr(),r=e(n,"Map");return cf=r,cf}var df,k_;function Au(){if(k_)return df;k_=1;var e=ci(),n=e(Object,"create");return df=n,df}var ff,E_;function rq(){if(E_)return ff;E_=1;var e=Au();function n(){this.__data__=e?e(null):{},this.size=0}return ff=n,ff}var hf,N_;function sq(){if(N_)return hf;N_=1;function e(n){var r=this.has(n)&&delete this.__data__[n];return this.size-=r?1:0,r}return hf=e,hf}var pf,C_;function iq(){if(C_)return pf;C_=1;var e=Au(),n="__lodash_hash_undefined__",r=Object.prototype,i=r.hasOwnProperty;function o(l){var u=this.__data__;if(e){var c=u[l];return c===n?void 0:c}return i.call(u,l)?u[l]:void 0}return pf=o,pf}var mf,j_;function oq(){if(j_)return mf;j_=1;var e=Au(),n=Object.prototype,r=n.hasOwnProperty;function i(o){var l=this.__data__;return e?l[o]!==void 0:r.call(l,o)}return mf=i,mf}var gf,R_;function aq(){if(R_)return gf;R_=1;var e=Au(),n="__lodash_hash_undefined__";function r(i,o){var l=this.__data__;return this.size+=this.has(i)?0:1,l[i]=e&&o===void 0?n:o,this}return gf=r,gf}var vf,T_;function lq(){if(T_)return vf;T_=1;var e=rq(),n=sq(),r=iq(),i=oq(),o=aq();function l(u){var c=-1,h=u==null?0:u.length;for(this.clear();++c<h;){var p=u[c];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=n,l.prototype.get=r,l.prototype.has=i,l.prototype.set=o,vf=l,vf}var yf,A_;function uq(){if(A_)return yf;A_=1;var e=lq(),n=Tu(),r=Kv();function i(){this.size=0,this.__data__={hash:new e,map:new(r||n),string:new e}}return yf=i,yf}var wf,I_;function cq(){if(I_)return wf;I_=1;function e(n){var r=typeof n;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?n!=="__proto__":n===null}return wf=e,wf}var xf,M_;function Iu(){if(M_)return xf;M_=1;var e=cq();function n(r,i){var o=r.__data__;return e(i)?o[typeof i=="string"?"string":"hash"]:o.map}return xf=n,xf}var _f,P_;function dq(){if(P_)return _f;P_=1;var e=Iu();function n(r){var i=e(this,r).delete(r);return this.size-=i?1:0,i}return _f=n,_f}var bf,O_;function fq(){if(O_)return bf;O_=1;var e=Iu();function n(r){return e(this,r).get(r)}return bf=n,bf}var Sf,L_;function hq(){if(L_)return Sf;L_=1;var e=Iu();function n(r){return e(this,r).has(r)}return Sf=n,Sf}var kf,q_;function pq(){if(q_)return kf;q_=1;var e=Iu();function n(r,i){var o=e(this,r),l=o.size;return o.set(r,i),this.size+=o.size==l?0:1,this}return kf=n,kf}var Ef,$_;function Xv(){if($_)return Ef;$_=1;var e=uq(),n=dq(),r=fq(),i=hq(),o=pq();function l(u){var c=-1,h=u==null?0:u.length;for(this.clear();++c<h;){var p=u[c];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=n,l.prototype.get=r,l.prototype.has=i,l.prototype.set=o,Ef=l,Ef}var Nf,D_;function mq(){if(D_)return Nf;D_=1;var e=Tu(),n=Kv(),r=Xv(),i=200;function o(l,u){var c=this.__data__;if(c instanceof e){var h=c.__data__;if(!n||h.length<i-1)return h.push([l,u]),this.size=++c.size,this;c=this.__data__=new r(h)}return c.set(l,u),this.size=c.size,this}return Nf=o,Nf}var Cf,F_;function Mu(){if(F_)return Cf;F_=1;var e=Tu(),n=GL(),r=YL(),i=KL(),o=XL(),l=mq();function u(c){var h=this.__data__=new e(c);this.size=h.size}return u.prototype.clear=n,u.prototype.delete=r,u.prototype.get=i,u.prototype.has=o,u.prototype.set=l,Cf=u,Cf}var jf,z_;function Qv(){if(z_)return jf;z_=1;function e(n,r){for(var i=-1,o=n==null?0:n.length;++i<o&&r(n[i],i,n)!==!1;);return n}return jf=e,jf}var Rf,B_;function wC(){if(B_)return Rf;B_=1;var e=ci(),n=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return Rf=n,Rf}var Tf,U_;function Pu(){if(U_)return Tf;U_=1;var e=wC();function n(r,i,o){i=="__proto__"&&e?e(r,i,{configurable:!0,enumerable:!0,value:o,writable:!0}):r[i]=o}return Tf=n,Tf}var Af,H_;function Ou(){if(H_)return Af;H_=1;var e=Pu(),n=yo(),r=Object.prototype,i=r.hasOwnProperty;function o(l,u,c){var h=l[u];(!(i.call(l,u)&&n(h,c))||c===void 0&&!(u in l))&&e(l,u,c)}return Af=o,Af}var If,W_;function $a(){if(W_)return If;W_=1;var e=Ou(),n=Pu();function r(i,o,l,u){var c=!l;l||(l={});for(var h=-1,p=o.length;++h<p;){var d=o[h],m=u?u(l[d],i[d],d,l,i):void 0;m===void 0&&(m=i[d]),c?n(l,d,m):e(l,d,m)}return l}return If=r,If}var Mf,V_;function gq(){if(V_)return Mf;V_=1;function e(n,r){for(var i=-1,o=Array(n);++i<n;)o[i]=r(i);return o}return Mf=e,Mf}var Pf,G_;function vr(){if(G_)return Pf;G_=1;function e(n){return n!=null&&typeof n=="object"}return Pf=e,Pf}var Of,Y_;function vq(){if(Y_)return Of;Y_=1;var e=ui(),n=vr(),r="[object Arguments]";function i(o){return n(o)&&e(o)==r}return Of=i,Of}var Lf,K_;function Da(){if(K_)return Lf;K_=1;var e=vq(),n=vr(),r=Object.prototype,i=r.hasOwnProperty,o=r.propertyIsEnumerable,l=e((function(){return arguments})())?e:function(u){return n(u)&&i.call(u,"callee")&&!o.call(u,"callee")};return Lf=l,Lf}var qf,X_;function bt(){if(X_)return qf;X_=1;var e=Array.isArray;return qf=e,qf}var va={exports:{}},$f,Q_;function yq(){if(Q_)return $f;Q_=1;function e(){return!1}return $f=e,$f}va.exports;var Z_;function xo(){return Z_||(Z_=1,(function(e,n){var r=tr(),i=yq(),o=n&&!n.nodeType&&n,l=o&&!0&&e&&!e.nodeType&&e,u=l&&l.exports===o,c=u?r.Buffer:void 0,h=c?c.isBuffer:void 0,p=h||i;e.exports=p})(va,va.exports)),va.exports}var Df,J_;function Lu(){if(J_)return Df;J_=1;var e=9007199254740991,n=/^(?:0|[1-9]\d*)$/;function r(i,o){var l=typeof i;return o=o??e,!!o&&(l=="number"||l!="symbol"&&n.test(i))&&i>-1&&i%1==0&&i<o}return Df=r,Df}var Ff,e1;function Zv(){if(e1)return Ff;e1=1;var e=9007199254740991;function n(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return Ff=n,Ff}var zf,t1;function wq(){if(t1)return zf;t1=1;var e=ui(),n=Zv(),r=vr(),i="[object Arguments]",o="[object Array]",l="[object Boolean]",u="[object Date]",c="[object Error]",h="[object Function]",p="[object Map]",d="[object Number]",m="[object Object]",y="[object RegExp]",w="[object Set]",N="[object String]",_="[object WeakMap]",S="[object ArrayBuffer]",b="[object DataView]",k="[object Float32Array]",E="[object Float64Array]",C="[object Int8Array]",A="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",H="[object Uint8ClampedArray]",O="[object Uint16Array]",P="[object Uint32Array]",F={};F[k]=F[E]=F[C]=F[A]=F[M]=F[L]=F[H]=F[O]=F[P]=!0,F[i]=F[o]=F[S]=F[l]=F[b]=F[u]=F[c]=F[h]=F[p]=F[d]=F[m]=F[y]=F[w]=F[N]=F[_]=!1;function Y(q){return r(q)&&n(q.length)&&!!F[e(q)]}return zf=Y,zf}var Bf,n1;function qu(){if(n1)return Bf;n1=1;function e(n){return function(r){return n(r)}}return Bf=e,Bf}var ya={exports:{}};ya.exports;var r1;function Jv(){return r1||(r1=1,(function(e,n){var r=vC(),i=n&&!n.nodeType&&n,o=i&&!0&&e&&!e.nodeType&&e,l=o&&o.exports===i,u=l&&r.process,c=(function(){try{var h=o&&o.require&&o.require("util").types;return h||u&&u.binding&&u.binding("util")}catch{}})();e.exports=c})(ya,ya.exports)),ya.exports}var Uf,s1;function Fa(){if(s1)return Uf;s1=1;var e=wq(),n=qu(),r=Jv(),i=r&&r.isTypedArray,o=i?n(i):e;return Uf=o,Uf}var Hf,i1;function xC(){if(i1)return Hf;i1=1;var e=gq(),n=Da(),r=bt(),i=xo(),o=Lu(),l=Fa(),u=Object.prototype,c=u.hasOwnProperty;function h(p,d){var m=r(p),y=!m&&n(p),w=!m&&!y&&i(p),N=!m&&!y&&!w&&l(p),_=m||y||w||N,S=_?e(p.length,String):[],b=S.length;for(var k in p)(d||c.call(p,k))&&!(_&&(k=="length"||w&&(k=="offset"||k=="parent")||N&&(k=="buffer"||k=="byteLength"||k=="byteOffset")||o(k,b)))&&S.push(k);return S}return Hf=h,Hf}var Wf,o1;function $u(){if(o1)return Wf;o1=1;var e=Object.prototype;function n(r){var i=r&&r.constructor,o=typeof i=="function"&&i.prototype||e;return r===o}return Wf=n,Wf}var Vf,a1;function _C(){if(a1)return Vf;a1=1;function e(n,r){return function(i){return n(r(i))}}return Vf=e,Vf}var Gf,l1;function xq(){if(l1)return Gf;l1=1;var e=_C(),n=e(Object.keys,Object);return Gf=n,Gf}var Yf,u1;function ey(){if(u1)return Yf;u1=1;var e=$u(),n=xq(),r=Object.prototype,i=r.hasOwnProperty;function o(l){if(!e(l))return n(l);var u=[];for(var c in Object(l))i.call(l,c)&&c!="constructor"&&u.push(c);return u}return Yf=o,Yf}var Kf,c1;function Wr(){if(c1)return Kf;c1=1;var e=qa(),n=Zv();function r(i){return i!=null&&n(i.length)&&!e(i)}return Kf=r,Kf}var Xf,d1;function ks(){if(d1)return Xf;d1=1;var e=xC(),n=ey(),r=Wr();function i(o){return r(o)?e(o):n(o)}return Xf=i,Xf}var Qf,f1;function _q(){if(f1)return Qf;f1=1;var e=$a(),n=ks();function r(i,o){return i&&e(o,n(o),i)}return Qf=r,Qf}var Zf,h1;function bq(){if(h1)return Zf;h1=1;function e(n){var r=[];if(n!=null)for(var i in Object(n))r.push(i);return r}return Zf=e,Zf}var Jf,p1;function Sq(){if(p1)return Jf;p1=1;var e=Ln(),n=$u(),r=bq(),i=Object.prototype,o=i.hasOwnProperty;function l(u){if(!e(u))return r(u);var c=n(u),h=[];for(var p in u)p=="constructor"&&(c||!o.call(u,p))||h.push(p);return h}return Jf=l,Jf}var eh,m1;function di(){if(m1)return eh;m1=1;var e=xC(),n=Sq(),r=Wr();function i(o){return r(o)?e(o,!0):n(o)}return eh=i,eh}var th,g1;function kq(){if(g1)return th;g1=1;var e=$a(),n=di();function r(i,o){return i&&e(o,n(o),i)}return th=r,th}var wa={exports:{}};wa.exports;var v1;function bC(){return v1||(v1=1,(function(e,n){var r=tr(),i=n&&!n.nodeType&&n,o=i&&!0&&e&&!e.nodeType&&e,l=o&&o.exports===i,u=l?r.Buffer:void 0,c=u?u.allocUnsafe:void 0;function h(p,d){if(d)return p.slice();var m=p.length,y=c?c(m):new p.constructor(m);return p.copy(y),y}e.exports=h})(wa,wa.exports)),wa.exports}var nh,y1;function SC(){if(y1)return nh;y1=1;function e(n,r){var i=-1,o=n.length;for(r||(r=Array(o));++i<o;)r[i]=n[i];return r}return nh=e,nh}var rh,w1;function kC(){if(w1)return rh;w1=1;function e(n,r){for(var i=-1,o=n==null?0:n.length,l=0,u=[];++i<o;){var c=n[i];r(c,i,n)&&(u[l++]=c)}return u}return rh=e,rh}var sh,x1;function EC(){if(x1)return sh;x1=1;function e(){return[]}return sh=e,sh}var ih,_1;function ty(){if(_1)return ih;_1=1;var e=kC(),n=EC(),r=Object.prototype,i=r.propertyIsEnumerable,o=Object.getOwnPropertySymbols,l=o?function(u){return u==null?[]:(u=Object(u),e(o(u),function(c){return i.call(u,c)}))}:n;return ih=l,ih}var oh,b1;function Eq(){if(b1)return oh;b1=1;var e=$a(),n=ty();function r(i,o){return e(i,n(i),o)}return oh=r,oh}var ah,S1;function ny(){if(S1)return ah;S1=1;function e(n,r){for(var i=-1,o=r.length,l=n.length;++i<o;)n[l+i]=r[i];return n}return ah=e,ah}var lh,k1;function Du(){if(k1)return lh;k1=1;var e=_C(),n=e(Object.getPrototypeOf,Object);return lh=n,lh}var uh,E1;function NC(){if(E1)return uh;E1=1;var e=ny(),n=Du(),r=ty(),i=EC(),o=Object.getOwnPropertySymbols,l=o?function(u){for(var c=[];u;)e(c,r(u)),u=n(u);return c}:i;return uh=l,uh}var ch,N1;function Nq(){if(N1)return ch;N1=1;var e=$a(),n=NC();function r(i,o){return e(i,n(i),o)}return ch=r,ch}var dh,C1;function CC(){if(C1)return dh;C1=1;var e=ny(),n=bt();function r(i,o,l){var u=o(i);return n(i)?u:e(u,l(i))}return dh=r,dh}var fh,j1;function jC(){if(j1)return fh;j1=1;var e=CC(),n=ty(),r=ks();function i(o){return e(o,r,n)}return fh=i,fh}var hh,R1;function Cq(){if(R1)return hh;R1=1;var e=CC(),n=NC(),r=di();function i(o){return e(o,r,n)}return hh=i,hh}var ph,T1;function jq(){if(T1)return ph;T1=1;var e=ci(),n=tr(),r=e(n,"DataView");return ph=r,ph}var mh,A1;function Rq(){if(A1)return mh;A1=1;var e=ci(),n=tr(),r=e(n,"Promise");return mh=r,mh}var gh,I1;function RC(){if(I1)return gh;I1=1;var e=ci(),n=tr(),r=e(n,"Set");return gh=r,gh}var vh,M1;function Tq(){if(M1)return vh;M1=1;var e=ci(),n=tr(),r=e(n,"WeakMap");return vh=r,vh}var yh,P1;function _o(){if(P1)return yh;P1=1;var e=jq(),n=Kv(),r=Rq(),i=RC(),o=Tq(),l=ui(),u=yC(),c="[object Map]",h="[object Object]",p="[object Promise]",d="[object Set]",m="[object WeakMap]",y="[object DataView]",w=u(e),N=u(n),_=u(r),S=u(i),b=u(o),k=l;return(e&&k(new e(new ArrayBuffer(1)))!=y||n&&k(new n)!=c||r&&k(r.resolve())!=p||i&&k(new i)!=d||o&&k(new o)!=m)&&(k=function(E){var C=l(E),A=C==h?E.constructor:void 0,M=A?u(A):"";if(M)switch(M){case w:return y;case N:return c;case _:return p;case S:return d;case b:return m}return C}),yh=k,yh}var wh,O1;function Aq(){if(O1)return wh;O1=1;var e=Object.prototype,n=e.hasOwnProperty;function r(i){var o=i.length,l=new i.constructor(o);return o&&typeof i[0]=="string"&&n.call(i,"index")&&(l.index=i.index,l.input=i.input),l}return wh=r,wh}var xh,L1;function TC(){if(L1)return xh;L1=1;var e=tr(),n=e.Uint8Array;return xh=n,xh}var _h,q1;function ry(){if(q1)return _h;q1=1;var e=TC();function n(r){var i=new r.constructor(r.byteLength);return new e(i).set(new e(r)),i}return _h=n,_h}var bh,$1;function Iq(){if($1)return bh;$1=1;var e=ry();function n(r,i){var o=i?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.byteLength)}return bh=n,bh}var Sh,D1;function Mq(){if(D1)return Sh;D1=1;var e=/\w*$/;function n(r){var i=new r.constructor(r.source,e.exec(r));return i.lastIndex=r.lastIndex,i}return Sh=n,Sh}var kh,F1;function Pq(){if(F1)return kh;F1=1;var e=wo(),n=e?e.prototype:void 0,r=n?n.valueOf:void 0;function i(o){return r?Object(r.call(o)):{}}return kh=i,kh}var Eh,z1;function AC(){if(z1)return Eh;z1=1;var e=ry();function n(r,i){var o=i?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.length)}return Eh=n,Eh}var Nh,B1;function Oq(){if(B1)return Nh;B1=1;var e=ry(),n=Iq(),r=Mq(),i=Pq(),o=AC(),l="[object Boolean]",u="[object Date]",c="[object Map]",h="[object Number]",p="[object RegExp]",d="[object Set]",m="[object String]",y="[object Symbol]",w="[object ArrayBuffer]",N="[object DataView]",_="[object Float32Array]",S="[object Float64Array]",b="[object Int8Array]",k="[object Int16Array]",E="[object Int32Array]",C="[object Uint8Array]",A="[object Uint8ClampedArray]",M="[object Uint16Array]",L="[object Uint32Array]";function H(O,P,F){var Y=O.constructor;switch(P){case w:return e(O);case l:case u:return new Y(+O);case N:return n(O,F);case _:case S:case b:case k:case E:case C:case A:case M:case L:return o(O,F);case c:return new Y;case h:case m:return new Y(O);case p:return r(O);case d:return new Y;case y:return i(O)}}return Nh=H,Nh}var Ch,U1;function IC(){if(U1)return Ch;U1=1;var e=Ln(),n=Object.create,r=(function(){function i(){}return function(o){if(!e(o))return{};if(n)return n(o);i.prototype=o;var l=new i;return i.prototype=void 0,l}})();return Ch=r,Ch}var jh,H1;function MC(){if(H1)return jh;H1=1;var e=IC(),n=Du(),r=$u();function i(o){return typeof o.constructor=="function"&&!r(o)?e(n(o)):{}}return jh=i,jh}var Rh,W1;function Lq(){if(W1)return Rh;W1=1;var e=_o(),n=vr(),r="[object Map]";function i(o){return n(o)&&e(o)==r}return Rh=i,Rh}var Th,V1;function qq(){if(V1)return Th;V1=1;var e=Lq(),n=qu(),r=Jv(),i=r&&r.isMap,o=i?n(i):e;return Th=o,Th}var Ah,G1;function $q(){if(G1)return Ah;G1=1;var e=_o(),n=vr(),r="[object Set]";function i(o){return n(o)&&e(o)==r}return Ah=i,Ah}var Ih,Y1;function Dq(){if(Y1)return Ih;Y1=1;var e=$q(),n=qu(),r=Jv(),i=r&&r.isSet,o=i?n(i):e;return Ih=o,Ih}var Mh,K1;function PC(){if(K1)return Mh;K1=1;var e=Mu(),n=Qv(),r=Ou(),i=_q(),o=kq(),l=bC(),u=SC(),c=Eq(),h=Nq(),p=jC(),d=Cq(),m=_o(),y=Aq(),w=Oq(),N=MC(),_=bt(),S=xo(),b=qq(),k=Ln(),E=Dq(),C=ks(),A=di(),M=1,L=2,H=4,O="[object Arguments]",P="[object Array]",F="[object Boolean]",Y="[object Date]",q="[object Error]",R="[object Function]",Q="[object GeneratorFunction]",z="[object Map]",ne="[object Number]",Z="[object Object]",$="[object RegExp]",X="[object Set]",I="[object String]",W="[object Symbol]",G="[object WeakMap]",U="[object ArrayBuffer]",J="[object DataView]",re="[object Float32Array]",le="[object Float64Array]",fe="[object Int8Array]",te="[object Int16Array]",ce="[object Int32Array]",Ce="[object Uint8Array]",ve="[object Uint8ClampedArray]",Te="[object Uint16Array]",ye="[object Uint32Array]",ke={};ke[O]=ke[P]=ke[U]=ke[J]=ke[F]=ke[Y]=ke[re]=ke[le]=ke[fe]=ke[te]=ke[ce]=ke[z]=ke[ne]=ke[Z]=ke[$]=ke[X]=ke[I]=ke[W]=ke[Ce]=ke[ve]=ke[Te]=ke[ye]=!0,ke[q]=ke[R]=ke[G]=!1;function Ge(we,_e,ze,ft,ht,Ue){var De,Ze=_e&M,Ye=_e&L,vt=_e&H;if(ze&&(De=ht?ze(we,ft,ht,Ue):ze(we)),De!==void 0)return De;if(!k(we))return we;var ot=_(we);if(ot){if(De=y(we),!Ze)return u(we,De)}else{var yt=m(we),Kt=yt==R||yt==Q;if(S(we))return l(we,Ze);if(yt==Z||yt==O||Kt&&!ht){if(De=Ye||Kt?{}:N(we),!Ze)return Ye?h(we,o(De,we)):c(we,i(De,we))}else{if(!ke[yt])return ht?we:{};De=w(we,yt,Ze)}}Ue||(Ue=new e);var Mt=Ue.get(we);if(Mt)return Mt;Ue.set(we,De),E(we)?we.forEach(function(pt){De.add(Ge(pt,_e,ze,pt,we,Ue))}):b(we)&&we.forEach(function(pt,mt){De.set(mt,Ge(pt,_e,ze,mt,we,Ue))});var Xe=vt?Ye?d:p:Ye?A:C,wt=ot?void 0:Xe(we);return n(wt||we,function(pt,mt){wt&&(mt=pt,pt=we[mt]),r(De,mt,Ge(pt,_e,ze,mt,we,Ue))}),De}return Mh=Ge,Mh}var Ph,X1;function Fq(){if(X1)return Ph;X1=1;var e=PC(),n=4;function r(i){return e(i,n)}return Ph=r,Ph}var Oh,Q1;function sy(){if(Q1)return Oh;Q1=1;function e(n){return function(){return n}}return Oh=e,Oh}var Lh,Z1;function zq(){if(Z1)return Lh;Z1=1;function e(n){return function(r,i,o){for(var l=-1,u=Object(r),c=o(r),h=c.length;h--;){var p=c[n?h:++l];if(i(u[p],p,u)===!1)break}return r}}return Lh=e,Lh}var qh,J1;function iy(){if(J1)return qh;J1=1;var e=zq(),n=e();return qh=n,qh}var $h,eb;function oy(){if(eb)return $h;eb=1;var e=iy(),n=ks();function r(i,o){return i&&e(i,o,n)}return $h=r,$h}var Dh,tb;function Bq(){if(tb)return Dh;tb=1;var e=Wr();function n(r,i){return function(o,l){if(o==null)return o;if(!e(o))return r(o,l);for(var u=o.length,c=i?u:-1,h=Object(o);(i?c--:++c<u)&&l(h[c],c,h)!==!1;);return o}}return Dh=n,Dh}var Fh,nb;function Fu(){if(nb)return Fh;nb=1;var e=oy(),n=Bq(),r=n(e);return Fh=r,Fh}var zh,rb;function fi(){if(rb)return zh;rb=1;function e(n){return n}return zh=e,zh}var Bh,sb;function OC(){if(sb)return Bh;sb=1;var e=fi();function n(r){return typeof r=="function"?r:e}return Bh=n,Bh}var Uh,ib;function LC(){if(ib)return Uh;ib=1;var e=Qv(),n=Fu(),r=OC(),i=bt();function o(l,u){var c=i(l)?e:n;return c(l,r(u))}return Uh=o,Uh}var Hh,ob;function qC(){return ob||(ob=1,Hh=LC()),Hh}var Wh,ab;function Uq(){if(ab)return Wh;ab=1;var e=Fu();function n(r,i){var o=[];return e(r,function(l,u,c){i(l,u,c)&&o.push(l)}),o}return Wh=n,Wh}var Vh,lb;function Hq(){if(lb)return Vh;lb=1;var e="__lodash_hash_undefined__";function n(r){return this.__data__.set(r,e),this}return Vh=n,Vh}var Gh,ub;function Wq(){if(ub)return Gh;ub=1;function e(n){return this.__data__.has(n)}return Gh=e,Gh}var Yh,cb;function $C(){if(cb)return Yh;cb=1;var e=Xv(),n=Hq(),r=Wq();function i(o){var l=-1,u=o==null?0:o.length;for(this.__data__=new e;++l<u;)this.add(o[l])}return i.prototype.add=i.prototype.push=n,i.prototype.has=r,Yh=i,Yh}var Kh,db;function Vq(){if(db)return Kh;db=1;function e(n,r){for(var i=-1,o=n==null?0:n.length;++i<o;)if(r(n[i],i,n))return!0;return!1}return Kh=e,Kh}var Xh,fb;function DC(){if(fb)return Xh;fb=1;function e(n,r){return n.has(r)}return Xh=e,Xh}var Qh,hb;function FC(){if(hb)return Qh;hb=1;var e=$C(),n=Vq(),r=DC(),i=1,o=2;function l(u,c,h,p,d,m){var y=h&i,w=u.length,N=c.length;if(w!=N&&!(y&&N>w))return!1;var _=m.get(u),S=m.get(c);if(_&&S)return _==c&&S==u;var b=-1,k=!0,E=h&o?new e:void 0;for(m.set(u,c),m.set(c,u);++b<w;){var C=u[b],A=c[b];if(p)var M=y?p(A,C,b,c,u,m):p(C,A,b,u,c,m);if(M!==void 0){if(M)continue;k=!1;break}if(E){if(!n(c,function(L,H){if(!r(E,H)&&(C===L||d(C,L,h,p,m)))return E.push(H)})){k=!1;break}}else if(!(C===A||d(C,A,h,p,m))){k=!1;break}}return m.delete(u),m.delete(c),k}return Qh=l,Qh}var Zh,pb;function Gq(){if(pb)return Zh;pb=1;function e(n){var r=-1,i=Array(n.size);return n.forEach(function(o,l){i[++r]=[l,o]}),i}return Zh=e,Zh}var Jh,mb;function ay(){if(mb)return Jh;mb=1;function e(n){var r=-1,i=Array(n.size);return n.forEach(function(o){i[++r]=o}),i}return Jh=e,Jh}var ep,gb;function Yq(){if(gb)return ep;gb=1;var e=wo(),n=TC(),r=yo(),i=FC(),o=Gq(),l=ay(),u=1,c=2,h="[object Boolean]",p="[object Date]",d="[object Error]",m="[object Map]",y="[object Number]",w="[object RegExp]",N="[object Set]",_="[object String]",S="[object Symbol]",b="[object ArrayBuffer]",k="[object DataView]",E=e?e.prototype:void 0,C=E?E.valueOf:void 0;function A(M,L,H,O,P,F,Y){switch(H){case k:if(M.byteLength!=L.byteLength||M.byteOffset!=L.byteOffset)return!1;M=M.buffer,L=L.buffer;case b:return!(M.byteLength!=L.byteLength||!F(new n(M),new n(L)));case h:case p:case y:return r(+M,+L);case d:return M.name==L.name&&M.message==L.message;case w:case _:return M==L+"";case m:var q=o;case N:var R=O&u;if(q||(q=l),M.size!=L.size&&!R)return!1;var Q=Y.get(M);if(Q)return Q==L;O|=c,Y.set(M,L);var z=i(q(M),q(L),O,P,F,Y);return Y.delete(M),z;case S:if(C)return C.call(M)==C.call(L)}return!1}return ep=A,ep}var tp,vb;function Kq(){if(vb)return tp;vb=1;var e=jC(),n=1,r=Object.prototype,i=r.hasOwnProperty;function o(l,u,c,h,p,d){var m=c&n,y=e(l),w=y.length,N=e(u),_=N.length;if(w!=_&&!m)return!1;for(var S=w;S--;){var b=y[S];if(!(m?b in u:i.call(u,b)))return!1}var k=d.get(l),E=d.get(u);if(k&&E)return k==u&&E==l;var C=!0;d.set(l,u),d.set(u,l);for(var A=m;++S<w;){b=y[S];var M=l[b],L=u[b];if(h)var H=m?h(L,M,b,u,l,d):h(M,L,b,l,u,d);if(!(H===void 0?M===L||p(M,L,c,h,d):H)){C=!1;break}A||(A=b=="constructor")}if(C&&!A){var O=l.constructor,P=u.constructor;O!=P&&"constructor"in l&&"constructor"in u&&!(typeof O=="function"&&O instanceof O&&typeof P=="function"&&P instanceof P)&&(C=!1)}return d.delete(l),d.delete(u),C}return tp=o,tp}var np,yb;function Xq(){if(yb)return np;yb=1;var e=Mu(),n=FC(),r=Yq(),i=Kq(),o=_o(),l=bt(),u=xo(),c=Fa(),h=1,p="[object Arguments]",d="[object Array]",m="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function N(_,S,b,k,E,C){var A=l(_),M=l(S),L=A?d:o(_),H=M?d:o(S);L=L==p?m:L,H=H==p?m:H;var O=L==m,P=H==m,F=L==H;if(F&&u(_)){if(!u(S))return!1;A=!0,O=!1}if(F&&!O)return C||(C=new e),A||c(_)?n(_,S,b,k,E,C):r(_,S,L,b,k,E,C);if(!(b&h)){var Y=O&&w.call(_,"__wrapped__"),q=P&&w.call(S,"__wrapped__");if(Y||q){var R=Y?_.value():_,Q=q?S.value():S;return C||(C=new e),E(R,Q,b,k,C)}}return F?(C||(C=new e),i(_,S,b,k,E,C)):!1}return np=N,np}var rp,wb;function zC(){if(wb)return rp;wb=1;var e=Xq(),n=vr();function r(i,o,l,u,c){return i===o?!0:i==null||o==null||!n(i)&&!n(o)?i!==i&&o!==o:e(i,o,l,u,r,c)}return rp=r,rp}var sp,xb;function Qq(){if(xb)return sp;xb=1;var e=Mu(),n=zC(),r=1,i=2;function o(l,u,c,h){var p=c.length,d=p,m=!h;if(l==null)return!d;for(l=Object(l);p--;){var y=c[p];if(m&&y[2]?y[1]!==l[y[0]]:!(y[0]in l))return!1}for(;++p<d;){y=c[p];var w=y[0],N=l[w],_=y[1];if(m&&y[2]){if(N===void 0&&!(w in l))return!1}else{var S=new e;if(h)var b=h(N,_,w,l,u,S);if(!(b===void 0?n(_,N,r|i,h,S):b))return!1}}return!0}return sp=o,sp}var ip,_b;function BC(){if(_b)return ip;_b=1;var e=Ln();function n(r){return r===r&&!e(r)}return ip=n,ip}var op,bb;function Zq(){if(bb)return op;bb=1;var e=BC(),n=ks();function r(i){for(var o=n(i),l=o.length;l--;){var u=o[l],c=i[u];o[l]=[u,c,e(c)]}return o}return op=r,op}var ap,Sb;function UC(){if(Sb)return ap;Sb=1;function e(n,r){return function(i){return i==null?!1:i[n]===r&&(r!==void 0||n in Object(i))}}return ap=e,ap}var lp,kb;function Jq(){if(kb)return lp;kb=1;var e=Qq(),n=Zq(),r=UC();function i(o){var l=n(o);return l.length==1&&l[0][2]?r(l[0][0],l[0][1]):function(u){return u===o||e(u,o,l)}}return lp=i,lp}var up,Eb;function bo(){if(Eb)return up;Eb=1;var e=ui(),n=vr(),r="[object Symbol]";function i(o){return typeof o=="symbol"||n(o)&&e(o)==r}return up=i,up}var cp,Nb;function ly(){if(Nb)return cp;Nb=1;var e=bt(),n=bo(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,i=/^\w*$/;function o(l,u){if(e(l))return!1;var c=typeof l;return c=="number"||c=="symbol"||c=="boolean"||l==null||n(l)?!0:i.test(l)||!r.test(l)||u!=null&&l in Object(u)}return cp=o,cp}var dp,Cb;function e$(){if(Cb)return dp;Cb=1;var e=Xv(),n="Expected a function";function r(i,o){if(typeof i!="function"||o!=null&&typeof o!="function")throw new TypeError(n);var l=function(){var u=arguments,c=o?o.apply(this,u):u[0],h=l.cache;if(h.has(c))return h.get(c);var p=i.apply(this,u);return l.cache=h.set(c,p)||h,p};return l.cache=new(r.Cache||e),l}return r.Cache=e,dp=r,dp}var fp,jb;function t$(){if(jb)return fp;jb=1;var e=e$(),n=500;function r(i){var o=e(i,function(u){return l.size===n&&l.clear(),u}),l=o.cache;return o}return fp=r,fp}var hp,Rb;function n$(){if(Rb)return hp;Rb=1;var e=t$(),n=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,i=e(function(o){var l=[];return o.charCodeAt(0)===46&&l.push(""),o.replace(n,function(u,c,h,p){l.push(h?p.replace(r,"$1"):c||u)}),l});return hp=i,hp}var pp,Tb;function zu(){if(Tb)return pp;Tb=1;function e(n,r){for(var i=-1,o=n==null?0:n.length,l=Array(o);++i<o;)l[i]=r(n[i],i,n);return l}return pp=e,pp}var mp,Ab;function r$(){if(Ab)return mp;Ab=1;var e=wo(),n=zu(),r=bt(),i=bo(),o=e?e.prototype:void 0,l=o?o.toString:void 0;function u(c){if(typeof c=="string")return c;if(r(c))return n(c,u)+"";if(i(c))return l?l.call(c):"";var h=c+"";return h=="0"&&1/c==-1/0?"-0":h}return mp=u,mp}var gp,Ib;function HC(){if(Ib)return gp;Ib=1;var e=r$();function n(r){return r==null?"":e(r)}return gp=n,gp}var vp,Mb;function Bu(){if(Mb)return vp;Mb=1;var e=bt(),n=ly(),r=n$(),i=HC();function o(l,u){return e(l)?l:n(l,u)?[l]:r(i(l))}return vp=o,vp}var yp,Pb;function za(){if(Pb)return yp;Pb=1;var e=bo();function n(r){if(typeof r=="string"||e(r))return r;var i=r+"";return i=="0"&&1/r==-1/0?"-0":i}return yp=n,yp}var wp,Ob;function Uu(){if(Ob)return wp;Ob=1;var e=Bu(),n=za();function r(i,o){o=e(o,i);for(var l=0,u=o.length;i!=null&&l<u;)i=i[n(o[l++])];return l&&l==u?i:void 0}return wp=r,wp}var xp,Lb;function s$(){if(Lb)return xp;Lb=1;var e=Uu();function n(r,i,o){var l=r==null?void 0:e(r,i);return l===void 0?o:l}return xp=n,xp}var _p,qb;function i$(){if(qb)return _p;qb=1;function e(n,r){return n!=null&&r in Object(n)}return _p=e,_p}var bp,$b;function WC(){if($b)return bp;$b=1;var e=Bu(),n=Da(),r=bt(),i=Lu(),o=Zv(),l=za();function u(c,h,p){h=e(h,c);for(var d=-1,m=h.length,y=!1;++d<m;){var w=l(h[d]);if(!(y=c!=null&&p(c,w)))break;c=c[w]}return y||++d!=m?y:(m=c==null?0:c.length,!!m&&o(m)&&i(w,m)&&(r(c)||n(c)))}return bp=u,bp}var Sp,Db;function VC(){if(Db)return Sp;Db=1;var e=i$(),n=WC();function r(i,o){return i!=null&&n(i,o,e)}return Sp=r,Sp}var kp,Fb;function o$(){if(Fb)return kp;Fb=1;var e=zC(),n=s$(),r=VC(),i=ly(),o=BC(),l=UC(),u=za(),c=1,h=2;function p(d,m){return i(d)&&o(m)?l(u(d),m):function(y){var w=n(y,d);return w===void 0&&w===m?r(y,d):e(m,w,c|h)}}return kp=p,kp}var Ep,zb;function GC(){if(zb)return Ep;zb=1;function e(n){return function(r){return r==null?void 0:r[n]}}return Ep=e,Ep}var Np,Bb;function a$(){if(Bb)return Np;Bb=1;var e=Uu();function n(r){return function(i){return e(i,r)}}return Np=n,Np}var Cp,Ub;function l$(){if(Ub)return Cp;Ub=1;var e=GC(),n=a$(),r=ly(),i=za();function o(l){return r(l)?e(i(l)):n(l)}return Cp=o,Cp}var jp,Hb;function Vr(){if(Hb)return jp;Hb=1;var e=Jq(),n=o$(),r=fi(),i=bt(),o=l$();function l(u){return typeof u=="function"?u:u==null?r:typeof u=="object"?i(u)?n(u[0],u[1]):e(u):o(u)}return jp=l,jp}var Rp,Wb;function YC(){if(Wb)return Rp;Wb=1;var e=kC(),n=Uq(),r=Vr(),i=bt();function o(l,u){var c=i(l)?e:n;return c(l,r(u,3))}return Rp=o,Rp}var Tp,Vb;function u$(){if(Vb)return Tp;Vb=1;var e=Object.prototype,n=e.hasOwnProperty;function r(i,o){return i!=null&&n.call(i,o)}return Tp=r,Tp}var Ap,Gb;function KC(){if(Gb)return Ap;Gb=1;var e=u$(),n=WC();function r(i,o){return i!=null&&n(i,o,e)}return Ap=r,Ap}var Ip,Yb;function c$(){if(Yb)return Ip;Yb=1;var e=ey(),n=_o(),r=Da(),i=bt(),o=Wr(),l=xo(),u=$u(),c=Fa(),h="[object Map]",p="[object Set]",d=Object.prototype,m=d.hasOwnProperty;function y(w){if(w==null)return!0;if(o(w)&&(i(w)||typeof w=="string"||typeof w.splice=="function"||l(w)||c(w)||r(w)))return!w.length;var N=n(w);if(N==h||N==p)return!w.size;if(u(w))return!e(w).length;for(var _ in w)if(m.call(w,_))return!1;return!0}return Ip=y,Ip}var Mp,Kb;function XC(){if(Kb)return Mp;Kb=1;function e(n){return n===void 0}return Mp=e,Mp}var Pp,Xb;function QC(){if(Xb)return Pp;Xb=1;var e=Fu(),n=Wr();function r(i,o){var l=-1,u=n(i)?Array(i.length):[];return e(i,function(c,h,p){u[++l]=o(c,h,p)}),u}return Pp=r,Pp}var Op,Qb;function ZC(){if(Qb)return Op;Qb=1;var e=zu(),n=Vr(),r=QC(),i=bt();function o(l,u){var c=i(l)?e:r;return c(l,n(u,3))}return Op=o,Op}var Lp,Zb;function d$(){if(Zb)return Lp;Zb=1;function e(n,r,i,o){var l=-1,u=n==null?0:n.length;for(o&&u&&(i=n[++l]);++l<u;)i=r(i,n[l],l,n);return i}return Lp=e,Lp}var qp,Jb;function f$(){if(Jb)return qp;Jb=1;function e(n,r,i,o,l){return l(n,function(u,c,h){i=o?(o=!1,u):r(i,u,c,h)}),i}return qp=e,qp}var $p,eS;function JC(){if(eS)return $p;eS=1;var e=d$(),n=Fu(),r=Vr(),i=f$(),o=bt();function l(u,c,h){var p=o(u)?e:i,d=arguments.length<3;return p(u,r(c,4),h,d,n)}return $p=l,$p}var Dp,tS;function h$(){if(tS)return Dp;tS=1;var e=ui(),n=bt(),r=vr(),i="[object String]";function o(l){return typeof l=="string"||!n(l)&&r(l)&&e(l)==i}return Dp=o,Dp}var Fp,nS;function p$(){if(nS)return Fp;nS=1;var e=GC(),n=e("length");return Fp=n,Fp}var zp,rS;function m$(){if(rS)return zp;rS=1;var e="\\ud800-\\udfff",n="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",o=n+r+i,l="\\ufe0e\\ufe0f",u="\\u200d",c=RegExp("["+u+e+o+l+"]");function h(p){return c.test(p)}return zp=h,zp}var Bp,sS;function g$(){if(sS)return Bp;sS=1;var e="\\ud800-\\udfff",n="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",o=n+r+i,l="\\ufe0e\\ufe0f",u="["+e+"]",c="["+o+"]",h="\\ud83c[\\udffb-\\udfff]",p="(?:"+c+"|"+h+")",d="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",N=p+"?",_="["+l+"]?",S="(?:"+w+"(?:"+[d,m,y].join("|")+")"+_+N+")*",b=_+N+S,k="(?:"+[d+c+"?",c,m,y,u].join("|")+")",E=RegExp(h+"(?="+h+")|"+k+b,"g");function C(A){for(var M=E.lastIndex=0;E.test(A);)++M;return M}return Bp=C,Bp}var Up,iS;function v$(){if(iS)return Up;iS=1;var e=p$(),n=m$(),r=g$();function i(o){return n(o)?r(o):e(o)}return Up=i,Up}var Hp,oS;function y$(){if(oS)return Hp;oS=1;var e=ey(),n=_o(),r=Wr(),i=h$(),o=v$(),l="[object Map]",u="[object Set]";function c(h){if(h==null)return 0;if(r(h))return i(h)?o(h):h.length;var p=n(h);return p==l||p==u?h.size:e(h).length}return Hp=c,Hp}var Wp,aS;function w$(){if(aS)return Wp;aS=1;var e=Qv(),n=IC(),r=oy(),i=Vr(),o=Du(),l=bt(),u=xo(),c=qa(),h=Ln(),p=Fa();function d(m,y,w){var N=l(m),_=N||u(m)||p(m);if(y=i(y,4),w==null){var S=m&&m.constructor;_?w=N?new S:[]:h(m)?w=c(S)?n(o(m)):{}:w={}}return(_?e:r)(m,function(b,k,E){return y(w,b,k,E)}),w}return Wp=d,Wp}var Vp,lS;function x$(){if(lS)return Vp;lS=1;var e=wo(),n=Da(),r=bt(),i=e?e.isConcatSpreadable:void 0;function o(l){return r(l)||n(l)||!!(i&&l&&l[i])}return Vp=o,Vp}var Gp,uS;function uy(){if(uS)return Gp;uS=1;var e=ny(),n=x$();function r(i,o,l,u,c){var h=-1,p=i.length;for(l||(l=n),c||(c=[]);++h<p;){var d=i[h];o>0&&l(d)?o>1?r(d,o-1,l,u,c):e(c,d):u||(c[c.length]=d)}return c}return Gp=r,Gp}var Yp,cS;function _$(){if(cS)return Yp;cS=1;function e(n,r,i){switch(i.length){case 0:return n.call(r);case 1:return n.call(r,i[0]);case 2:return n.call(r,i[0],i[1]);case 3:return n.call(r,i[0],i[1],i[2])}return n.apply(r,i)}return Yp=e,Yp}var Kp,dS;function ej(){if(dS)return Kp;dS=1;var e=_$(),n=Math.max;function r(i,o,l){return o=n(o===void 0?i.length-1:o,0),function(){for(var u=arguments,c=-1,h=n(u.length-o,0),p=Array(h);++c<h;)p[c]=u[o+c];c=-1;for(var d=Array(o+1);++c<o;)d[c]=u[c];return d[o]=l(p),e(i,this,d)}}return Kp=r,Kp}var Xp,fS;function b$(){if(fS)return Xp;fS=1;var e=sy(),n=wC(),r=fi(),i=n?function(o,l){return n(o,"toString",{configurable:!0,enumerable:!1,value:e(l),writable:!0})}:r;return Xp=i,Xp}var Qp,hS;function S$(){if(hS)return Qp;hS=1;var e=800,n=16,r=Date.now;function i(o){var l=0,u=0;return function(){var c=r(),h=n-(c-u);if(u=c,h>0){if(++l>=e)return arguments[0]}else l=0;return o.apply(void 0,arguments)}}return Qp=i,Qp}var Zp,pS;function tj(){if(pS)return Zp;pS=1;var e=b$(),n=S$(),r=n(e);return Zp=r,Zp}var Jp,mS;function Hu(){if(mS)return Jp;mS=1;var e=fi(),n=ej(),r=tj();function i(o,l){return r(n(o,l,e),o+"")}return Jp=i,Jp}var em,gS;function nj(){if(gS)return em;gS=1;function e(n,r,i,o){for(var l=n.length,u=i+(o?1:-1);o?u--:++u<l;)if(r(n[u],u,n))return u;return-1}return em=e,em}var tm,vS;function k$(){if(vS)return tm;vS=1;function e(n){return n!==n}return tm=e,tm}var nm,yS;function E$(){if(yS)return nm;yS=1;function e(n,r,i){for(var o=i-1,l=n.length;++o<l;)if(n[o]===r)return o;return-1}return nm=e,nm}var rm,wS;function N$(){if(wS)return rm;wS=1;var e=nj(),n=k$(),r=E$();function i(o,l,u){return l===l?r(o,l,u):e(o,n,u)}return rm=i,rm}var sm,xS;function C$(){if(xS)return sm;xS=1;var e=N$();function n(r,i){var o=r==null?0:r.length;return!!o&&e(r,i,0)>-1}return sm=n,sm}var im,_S;function j$(){if(_S)return im;_S=1;function e(n,r,i){for(var o=-1,l=n==null?0:n.length;++o<l;)if(i(r,n[o]))return!0;return!1}return im=e,im}var om,bS;function R$(){if(bS)return om;bS=1;function e(){}return om=e,om}var am,SS;function T$(){if(SS)return am;SS=1;var e=RC(),n=R$(),r=ay(),i=1/0,o=e&&1/r(new e([,-0]))[1]==i?function(l){return new e(l)}:n;return am=o,am}var lm,kS;function A$(){if(kS)return lm;kS=1;var e=$C(),n=C$(),r=j$(),i=DC(),o=T$(),l=ay(),u=200;function c(h,p,d){var m=-1,y=n,w=h.length,N=!0,_=[],S=_;if(d)N=!1,y=r;else if(w>=u){var b=p?null:o(h);if(b)return l(b);N=!1,y=i,S=new e}else S=p?[]:_;e:for(;++m<w;){var k=h[m],E=p?p(k):k;if(k=d||k!==0?k:0,N&&E===E){for(var C=S.length;C--;)if(S[C]===E)continue e;p&&S.push(E),_.push(k)}else y(S,E,d)||(S!==_&&S.push(E),_.push(k))}return _}return lm=c,lm}var um,ES;function rj(){if(ES)return um;ES=1;var e=Wr(),n=vr();function r(i){return n(i)&&e(i)}return um=r,um}var cm,NS;function I$(){if(NS)return cm;NS=1;var e=uy(),n=Hu(),r=A$(),i=rj(),o=n(function(l){return r(e(l,1,i,!0))});return cm=o,cm}var dm,CS;function M$(){if(CS)return dm;CS=1;var e=zu();function n(r,i){return e(i,function(o){return r[o]})}return dm=n,dm}var fm,jS;function sj(){if(jS)return fm;jS=1;var e=M$(),n=ks();function r(i){return i==null?[]:e(i,n(i))}return fm=r,fm}var hm,RS;function qn(){if(RS)return hm;RS=1;var e;if(typeof Yv=="function")try{e={clone:Fq(),constant:sy(),each:qC(),filter:YC(),has:KC(),isArray:bt(),isEmpty:c$(),isFunction:qa(),isUndefined:XC(),keys:ks(),map:ZC(),reduce:JC(),size:y$(),transform:w$(),union:I$(),values:sj()}}catch{}return e||(e=window._),hm=e,hm}var pm,TS;function cy(){if(TS)return pm;TS=1;var e=qn();pm=o;var n="\0",r="\0",i="";function o(d){this._isDirected=e.has(d,"directed")?d.directed:!0,this._isMultigraph=e.has(d,"multigraph")?d.multigraph:!1,this._isCompound=e.has(d,"compound")?d.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[r]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}o.prototype._nodeCount=0,o.prototype._edgeCount=0,o.prototype.isDirected=function(){return this._isDirected},o.prototype.isMultigraph=function(){return this._isMultigraph},o.prototype.isCompound=function(){return this._isCompound},o.prototype.setGraph=function(d){return this._label=d,this},o.prototype.graph=function(){return this._label},o.prototype.setDefaultNodeLabel=function(d){return e.isFunction(d)||(d=e.constant(d)),this._defaultNodeLabelFn=d,this},o.prototype.nodeCount=function(){return this._nodeCount},o.prototype.nodes=function(){return e.keys(this._nodes)},o.prototype.sources=function(){var d=this;return e.filter(this.nodes(),function(m){return e.isEmpty(d._in[m])})},o.prototype.sinks=function(){var d=this;return e.filter(this.nodes(),function(m){return e.isEmpty(d._out[m])})},o.prototype.setNodes=function(d,m){var y=arguments,w=this;return e.each(d,function(N){y.length>1?w.setNode(N,m):w.setNode(N)}),this},o.prototype.setNode=function(d,m){return e.has(this._nodes,d)?(arguments.length>1&&(this._nodes[d]=m),this):(this._nodes[d]=arguments.length>1?m:this._defaultNodeLabelFn(d),this._isCompound&&(this._parent[d]=r,this._children[d]={},this._children[r][d]=!0),this._in[d]={},this._preds[d]={},this._out[d]={},this._sucs[d]={},++this._nodeCount,this)},o.prototype.node=function(d){return this._nodes[d]},o.prototype.hasNode=function(d){return e.has(this._nodes,d)},o.prototype.removeNode=function(d){var m=this;if(e.has(this._nodes,d)){var y=function(w){m.removeEdge(m._edgeObjs[w])};delete this._nodes[d],this._isCompound&&(this._removeFromParentsChildList(d),delete this._parent[d],e.each(this.children(d),function(w){m.setParent(w)}),delete this._children[d]),e.each(e.keys(this._in[d]),y),delete this._in[d],delete this._preds[d],e.each(e.keys(this._out[d]),y),delete this._out[d],delete this._sucs[d],--this._nodeCount}return this},o.prototype.setParent=function(d,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(m))m=r;else{m+="";for(var y=m;!e.isUndefined(y);y=this.parent(y))if(y===d)throw new Error("Setting "+m+" as parent of "+d+" would create a cycle");this.setNode(m)}return this.setNode(d),this._removeFromParentsChildList(d),this._parent[d]=m,this._children[m][d]=!0,this},o.prototype._removeFromParentsChildList=function(d){delete this._children[this._parent[d]][d]},o.prototype.parent=function(d){if(this._isCompound){var m=this._parent[d];if(m!==r)return m}},o.prototype.children=function(d){if(e.isUndefined(d)&&(d=r),this._isCompound){var m=this._children[d];if(m)return e.keys(m)}else{if(d===r)return this.nodes();if(this.hasNode(d))return[]}},o.prototype.predecessors=function(d){var m=this._preds[d];if(m)return e.keys(m)},o.prototype.successors=function(d){var m=this._sucs[d];if(m)return e.keys(m)},o.prototype.neighbors=function(d){var m=this.predecessors(d);if(m)return e.union(m,this.successors(d))},o.prototype.isLeaf=function(d){var m;return this.isDirected()?m=this.successors(d):m=this.neighbors(d),m.length===0},o.prototype.filterNodes=function(d){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var y=this;e.each(this._nodes,function(_,S){d(S)&&m.setNode(S,_)}),e.each(this._edgeObjs,function(_){m.hasNode(_.v)&&m.hasNode(_.w)&&m.setEdge(_,y.edge(_))});var w={};function N(_){var S=y.parent(_);return S===void 0||m.hasNode(S)?(w[_]=S,S):S in w?w[S]:N(S)}return this._isCompound&&e.each(m.nodes(),function(_){m.setParent(_,N(_))}),m},o.prototype.setDefaultEdgeLabel=function(d){return e.isFunction(d)||(d=e.constant(d)),this._defaultEdgeLabelFn=d,this},o.prototype.edgeCount=function(){return this._edgeCount},o.prototype.edges=function(){return e.values(this._edgeObjs)},o.prototype.setPath=function(d,m){var y=this,w=arguments;return e.reduce(d,function(N,_){return w.length>1?y.setEdge(N,_,m):y.setEdge(N,_),_}),this},o.prototype.setEdge=function(){var d,m,y,w,N=!1,_=arguments[0];typeof _=="object"&&_!==null&&"v"in _?(d=_.v,m=_.w,y=_.name,arguments.length===2&&(w=arguments[1],N=!0)):(d=_,m=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],N=!0)),d=""+d,m=""+m,e.isUndefined(y)||(y=""+y);var S=c(this._isDirected,d,m,y);if(e.has(this._edgeLabels,S))return N&&(this._edgeLabels[S]=w),this;if(!e.isUndefined(y)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(d),this.setNode(m),this._edgeLabels[S]=N?w:this._defaultEdgeLabelFn(d,m,y);var b=h(this._isDirected,d,m,y);return d=b.v,m=b.w,Object.freeze(b),this._edgeObjs[S]=b,l(this._preds[m],d),l(this._sucs[d],m),this._in[m][S]=b,this._out[d][S]=b,this._edgeCount++,this},o.prototype.edge=function(d,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,m,y);return this._edgeLabels[w]},o.prototype.hasEdge=function(d,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,m,y);return e.has(this._edgeLabels,w)},o.prototype.removeEdge=function(d,m,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,m,y),N=this._edgeObjs[w];return N&&(d=N.v,m=N.w,delete this._edgeLabels[w],delete this._edgeObjs[w],u(this._preds[m],d),u(this._sucs[d],m),delete this._in[m][w],delete this._out[d][w],this._edgeCount--),this},o.prototype.inEdges=function(d,m){var y=this._in[d];if(y){var w=e.values(y);return m?e.filter(w,function(N){return N.v===m}):w}},o.prototype.outEdges=function(d,m){var y=this._out[d];if(y){var w=e.values(y);return m?e.filter(w,function(N){return N.w===m}):w}},o.prototype.nodeEdges=function(d,m){var y=this.inEdges(d,m);if(y)return y.concat(this.outEdges(d,m))};function l(d,m){d[m]?d[m]++:d[m]=1}function u(d,m){--d[m]||delete d[m]}function c(d,m,y,w){var N=""+m,_=""+y;if(!d&&N>_){var S=N;N=_,_=S}return N+i+_+i+(e.isUndefined(w)?n:w)}function h(d,m,y,w){var N=""+m,_=""+y;if(!d&&N>_){var S=N;N=_,_=S}var b={v:N,w:_};return w&&(b.name=w),b}function p(d,m){return c(d,m.v,m.w,m.name)}return pm}var mm,AS;function P$(){return AS||(AS=1,mm="2.1.8"),mm}var gm,IS;function O$(){return IS||(IS=1,gm={Graph:cy(),version:P$()}),gm}var vm,MS;function L$(){if(MS)return vm;MS=1;var e=qn(),n=cy();vm={write:r,read:l};function r(u){var c={options:{directed:u.isDirected(),multigraph:u.isMultigraph(),compound:u.isCompound()},nodes:i(u),edges:o(u)};return e.isUndefined(u.graph())||(c.value=e.clone(u.graph())),c}function i(u){return e.map(u.nodes(),function(c){var h=u.node(c),p=u.parent(c),d={v:c};return e.isUndefined(h)||(d.value=h),e.isUndefined(p)||(d.parent=p),d})}function o(u){return e.map(u.edges(),function(c){var h=u.edge(c),p={v:c.v,w:c.w};return e.isUndefined(c.name)||(p.name=c.name),e.isUndefined(h)||(p.value=h),p})}function l(u){var c=new n(u.options).setGraph(u.value);return e.each(u.nodes,function(h){c.setNode(h.v,h.value),h.parent&&c.setParent(h.v,h.parent)}),e.each(u.edges,function(h){c.setEdge({v:h.v,w:h.w,name:h.name},h.value)}),c}return vm}var ym,PS;function q$(){if(PS)return ym;PS=1;var e=qn();ym=n;function n(r){var i={},o=[],l;function u(c){e.has(i,c)||(i[c]=!0,l.push(c),e.each(r.successors(c),u),e.each(r.predecessors(c),u))}return e.each(r.nodes(),function(c){l=[],u(c),l.length&&o.push(l)}),o}return ym}var wm,OS;function ij(){if(OS)return wm;OS=1;var e=qn();wm=n;function n(){this._arr=[],this._keyIndices={}}return n.prototype.size=function(){return this._arr.length},n.prototype.keys=function(){return this._arr.map(function(r){return r.key})},n.prototype.has=function(r){return e.has(this._keyIndices,r)},n.prototype.priority=function(r){var i=this._keyIndices[r];if(i!==void 0)return this._arr[i].priority},n.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},n.prototype.add=function(r,i){var o=this._keyIndices;if(r=String(r),!e.has(o,r)){var l=this._arr,u=l.length;return o[r]=u,l.push({key:r,priority:i}),this._decrease(u),!0}return!1},n.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var r=this._arr.pop();return delete this._keyIndices[r.key],this._heapify(0),r.key},n.prototype.decrease=function(r,i){var o=this._keyIndices[r];if(i>this._arr[o].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[o].priority+" New: "+i);this._arr[o].priority=i,this._decrease(o)},n.prototype._heapify=function(r){var i=this._arr,o=2*r,l=o+1,u=r;o<i.length&&(u=i[o].priority<i[u].priority?o:u,l<i.length&&(u=i[l].priority<i[u].priority?l:u),u!==r&&(this._swap(r,u),this._heapify(u)))},n.prototype._decrease=function(r){for(var i=this._arr,o=i[r].priority,l;r!==0&&(l=r>>1,!(i[l].priority<o));)this._swap(r,l),r=l},n.prototype._swap=function(r,i){var o=this._arr,l=this._keyIndices,u=o[r],c=o[i];o[r]=c,o[i]=u,l[c.key]=r,l[u.key]=i},wm}var xm,LS;function oj(){if(LS)return xm;LS=1;var e=qn(),n=ij();xm=i;var r=e.constant(1);function i(l,u,c,h){return o(l,String(u),c||r,h||function(p){return l.outEdges(p)})}function o(l,u,c,h){var p={},d=new n,m,y,w=function(N){var _=N.v!==m?N.v:N.w,S=p[_],b=c(N),k=y.distance+b;if(b<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+N+" Weight: "+b);k<S.distance&&(S.distance=k,S.predecessor=m,d.decrease(_,k))};for(l.nodes().forEach(function(N){var _=N===u?0:Number.POSITIVE_INFINITY;p[N]={distance:_},d.add(N,_)});d.size()>0&&(m=d.removeMin(),y=p[m],y.distance!==Number.POSITIVE_INFINITY);)h(m).forEach(w);return p}return xm}var _m,qS;function $$(){if(qS)return _m;qS=1;var e=oj(),n=qn();_m=r;function r(i,o,l){return n.transform(i.nodes(),function(u,c){u[c]=e(i,c,o,l)},{})}return _m}var bm,$S;function aj(){if($S)return bm;$S=1;var e=qn();bm=n;function n(r){var i=0,o=[],l={},u=[];function c(h){var p=l[h]={onStack:!0,lowlink:i,index:i++};if(o.push(h),r.successors(h).forEach(function(y){e.has(l,y)?l[y].onStack&&(p.lowlink=Math.min(p.lowlink,l[y].index)):(c(y),p.lowlink=Math.min(p.lowlink,l[y].lowlink))}),p.lowlink===p.index){var d=[],m;do m=o.pop(),l[m].onStack=!1,d.push(m);while(h!==m);u.push(d)}}return r.nodes().forEach(function(h){e.has(l,h)||c(h)}),u}return bm}var Sm,DS;function D$(){if(DS)return Sm;DS=1;var e=qn(),n=aj();Sm=r;function r(i){return e.filter(n(i),function(o){return o.length>1||o.length===1&&i.hasEdge(o[0],o[0])})}return Sm}var km,FS;function F$(){if(FS)return km;FS=1;var e=qn();km=r;var n=e.constant(1);function r(o,l,u){return i(o,l||n,u||function(c){return o.outEdges(c)})}function i(o,l,u){var c={},h=o.nodes();return h.forEach(function(p){c[p]={},c[p][p]={distance:0},h.forEach(function(d){p!==d&&(c[p][d]={distance:Number.POSITIVE_INFINITY})}),u(p).forEach(function(d){var m=d.v===p?d.w:d.v,y=l(d);c[p][m]={distance:y,predecessor:p}})}),h.forEach(function(p){var d=c[p];h.forEach(function(m){var y=c[m];h.forEach(function(w){var N=y[p],_=d[w],S=y[w],b=N.distance+_.distance;b<S.distance&&(S.distance=b,S.predecessor=_.predecessor)})})}),c}return km}var Em,zS;function lj(){if(zS)return Em;zS=1;var e=qn();Em=n,n.CycleException=r;function n(i){var o={},l={},u=[];function c(h){if(e.has(l,h))throw new r;e.has(o,h)||(l[h]=!0,o[h]=!0,e.each(i.predecessors(h),c),delete l[h],u.push(h))}if(e.each(i.sinks(),c),e.size(o)!==i.nodeCount())throw new r;return u}function r(){}return r.prototype=new Error,Em}var Nm,BS;function z$(){if(BS)return Nm;BS=1;var e=lj();Nm=n;function n(r){try{e(r)}catch(i){if(i instanceof e.CycleException)return!1;throw i}return!0}return Nm}var Cm,US;function uj(){if(US)return Cm;US=1;var e=qn();Cm=n;function n(i,o,l){e.isArray(o)||(o=[o]);var u=(i.isDirected()?i.successors:i.neighbors).bind(i),c=[],h={};return e.each(o,function(p){if(!i.hasNode(p))throw new Error("Graph does not have node: "+p);r(i,p,l==="post",h,u,c)}),c}function r(i,o,l,u,c,h){e.has(u,o)||(u[o]=!0,l||h.push(o),e.each(c(o),function(p){r(i,p,l,u,c,h)}),l&&h.push(o))}return Cm}var jm,HS;function B$(){if(HS)return jm;HS=1;var e=uj();jm=n;function n(r,i){return e(r,i,"post")}return jm}var Rm,WS;function U$(){if(WS)return Rm;WS=1;var e=uj();Rm=n;function n(r,i){return e(r,i,"pre")}return Rm}var Tm,VS;function H$(){if(VS)return Tm;VS=1;var e=qn(),n=cy(),r=ij();Tm=i;function i(o,l){var u=new n,c={},h=new r,p;function d(y){var w=y.v===p?y.w:y.v,N=h.priority(w);if(N!==void 0){var _=l(y);_<N&&(c[w]=p,h.decrease(w,_))}}if(o.nodeCount()===0)return u;e.each(o.nodes(),function(y){h.add(y,Number.POSITIVE_INFINITY),u.setNode(y)}),h.decrease(o.nodes()[0],0);for(var m=!1;h.size()>0;){if(p=h.removeMin(),e.has(c,p))u.setEdge(p,c[p]);else{if(m)throw new Error("Input graph is not connected: "+o);m=!0}o.nodeEdges(p).forEach(d)}return u}return Tm}var Am,GS;function W$(){return GS||(GS=1,Am={components:q$(),dijkstra:oj(),dijkstraAll:$$(),findCycles:D$(),floydWarshall:F$(),isAcyclic:z$(),postorder:B$(),preorder:U$(),prim:H$(),tarjan:aj(),topsort:lj()}),Am}var Im,YS;function V$(){if(YS)return Im;YS=1;var e=O$();return Im={Graph:e.Graph,json:L$(),alg:W$(),version:e.version},Im}var Mm,KS;function Jn(){if(KS)return Mm;KS=1;var e;if(typeof Yv=="function")try{e=V$()}catch{}return e||(e=window.graphlib),Mm=e,Mm}var Pm,XS;function G$(){if(XS)return Pm;XS=1;var e=PC(),n=1,r=4;function i(o){return e(o,n|r)}return Pm=i,Pm}var Om,QS;function Wu(){if(QS)return Om;QS=1;var e=yo(),n=Wr(),r=Lu(),i=Ln();function o(l,u,c){if(!i(c))return!1;var h=typeof u;return(h=="number"?n(c)&&r(u,c.length):h=="string"&&u in c)?e(c[u],l):!1}return Om=o,Om}var Lm,ZS;function Y$(){if(ZS)return Lm;ZS=1;var e=Hu(),n=yo(),r=Wu(),i=di(),o=Object.prototype,l=o.hasOwnProperty,u=e(function(c,h){c=Object(c);var p=-1,d=h.length,m=d>2?h[2]:void 0;for(m&&r(h[0],h[1],m)&&(d=1);++p<d;)for(var y=h[p],w=i(y),N=-1,_=w.length;++N<_;){var S=w[N],b=c[S];(b===void 0||n(b,o[S])&&!l.call(c,S))&&(c[S]=y[S])}return c});return Lm=u,Lm}var qm,JS;function K$(){if(JS)return qm;JS=1;var e=Vr(),n=Wr(),r=ks();function i(o){return function(l,u,c){var h=Object(l);if(!n(l)){var p=e(u,3);l=r(l),u=function(m){return p(h[m],m,h)}}var d=o(l,u,c);return d>-1?h[p?l[d]:d]:void 0}}return qm=i,qm}var $m,ek;function X$(){if(ek)return $m;ek=1;var e=/\s/;function n(r){for(var i=r.length;i--&&e.test(r.charAt(i)););return i}return $m=n,$m}var Dm,tk;function Q$(){if(tk)return Dm;tk=1;var e=X$(),n=/^\s+/;function r(i){return i&&i.slice(0,e(i)+1).replace(n,"")}return Dm=r,Dm}var Fm,nk;function Z$(){if(nk)return Fm;nk=1;var e=Q$(),n=Ln(),r=bo(),i=NaN,o=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt;function h(p){if(typeof p=="number")return p;if(r(p))return i;if(n(p)){var d=typeof p.valueOf=="function"?p.valueOf():p;p=n(d)?d+"":d}if(typeof p!="string")return p===0?p:+p;p=e(p);var m=l.test(p);return m||u.test(p)?c(p.slice(2),m?2:8):o.test(p)?i:+p}return Fm=h,Fm}var zm,rk;function cj(){if(rk)return zm;rk=1;var e=Z$(),n=1/0,r=17976931348623157e292;function i(o){if(!o)return o===0?o:0;if(o=e(o),o===n||o===-n){var l=o<0?-1:1;return l*r}return o===o?o:0}return zm=i,zm}var Bm,sk;function J$(){if(sk)return Bm;sk=1;var e=cj();function n(r){var i=e(r),o=i%1;return i===i?o?i-o:i:0}return Bm=n,Bm}var Um,ik;function e4(){if(ik)return Um;ik=1;var e=nj(),n=Vr(),r=J$(),i=Math.max;function o(l,u,c){var h=l==null?0:l.length;if(!h)return-1;var p=c==null?0:r(c);return p<0&&(p=i(h+p,0)),e(l,n(u,3),p)}return Um=o,Um}var Hm,ok;function t4(){if(ok)return Hm;ok=1;var e=K$(),n=e4(),r=e(n);return Hm=r,Hm}var Wm,ak;function dj(){if(ak)return Wm;ak=1;var e=uy();function n(r){var i=r==null?0:r.length;return i?e(r,1):[]}return Wm=n,Wm}var Vm,lk;function n4(){if(lk)return Vm;lk=1;var e=iy(),n=OC(),r=di();function i(o,l){return o==null?o:e(o,n(l),r)}return Vm=i,Vm}var Gm,uk;function r4(){if(uk)return Gm;uk=1;function e(n){var r=n==null?0:n.length;return r?n[r-1]:void 0}return Gm=e,Gm}var Ym,ck;function s4(){if(ck)return Ym;ck=1;var e=Pu(),n=oy(),r=Vr();function i(o,l){var u={};return l=r(l,3),n(o,function(c,h,p){e(u,h,l(c,h,p))}),u}return Ym=i,Ym}var Km,dk;function dy(){if(dk)return Km;dk=1;var e=bo();function n(r,i,o){for(var l=-1,u=r.length;++l<u;){var c=r[l],h=i(c);if(h!=null&&(p===void 0?h===h&&!e(h):o(h,p)))var p=h,d=c}return d}return Km=n,Km}var Xm,fk;function i4(){if(fk)return Xm;fk=1;function e(n,r){return n>r}return Xm=e,Xm}var Qm,hk;function o4(){if(hk)return Qm;hk=1;var e=dy(),n=i4(),r=fi();function i(o){return o&&o.length?e(o,r,n):void 0}return Qm=i,Qm}var Zm,pk;function fj(){if(pk)return Zm;pk=1;var e=Pu(),n=yo();function r(i,o,l){(l!==void 0&&!n(i[o],l)||l===void 0&&!(o in i))&&e(i,o,l)}return Zm=r,Zm}var Jm,mk;function a4(){if(mk)return Jm;mk=1;var e=ui(),n=Du(),r=vr(),i="[object Object]",o=Function.prototype,l=Object.prototype,u=o.toString,c=l.hasOwnProperty,h=u.call(Object);function p(d){if(!r(d)||e(d)!=i)return!1;var m=n(d);if(m===null)return!0;var y=c.call(m,"constructor")&&m.constructor;return typeof y=="function"&&y instanceof y&&u.call(y)==h}return Jm=p,Jm}var eg,gk;function hj(){if(gk)return eg;gk=1;function e(n,r){if(!(r==="constructor"&&typeof n[r]=="function")&&r!="__proto__")return n[r]}return eg=e,eg}var tg,vk;function l4(){if(vk)return tg;vk=1;var e=$a(),n=di();function r(i){return e(i,n(i))}return tg=r,tg}var ng,yk;function u4(){if(yk)return ng;yk=1;var e=fj(),n=bC(),r=AC(),i=SC(),o=MC(),l=Da(),u=bt(),c=rj(),h=xo(),p=qa(),d=Ln(),m=a4(),y=Fa(),w=hj(),N=l4();function _(S,b,k,E,C,A,M){var L=w(S,k),H=w(b,k),O=M.get(H);if(O){e(S,k,O);return}var P=A?A(L,H,k+"",S,b,M):void 0,F=P===void 0;if(F){var Y=u(H),q=!Y&&h(H),R=!Y&&!q&&y(H);P=H,Y||q||R?u(L)?P=L:c(L)?P=i(L):q?(F=!1,P=n(H,!0)):R?(F=!1,P=r(H,!0)):P=[]:m(H)||l(H)?(P=L,l(L)?P=N(L):(!d(L)||p(L))&&(P=o(H))):F=!1}F&&(M.set(H,P),C(P,H,E,A,M),M.delete(H)),e(S,k,P)}return ng=_,ng}var rg,wk;function c4(){if(wk)return rg;wk=1;var e=Mu(),n=fj(),r=iy(),i=u4(),o=Ln(),l=di(),u=hj();function c(h,p,d,m,y){h!==p&&r(p,function(w,N){if(y||(y=new e),o(w))i(h,p,N,d,c,m,y);else{var _=m?m(u(h,N),w,N+"",h,p,y):void 0;_===void 0&&(_=w),n(h,N,_)}},l)}return rg=c,rg}var sg,xk;function d4(){if(xk)return sg;xk=1;var e=Hu(),n=Wu();function r(i){return e(function(o,l){var u=-1,c=l.length,h=c>1?l[c-1]:void 0,p=c>2?l[2]:void 0;for(h=i.length>3&&typeof h=="function"?(c--,h):void 0,p&&n(l[0],l[1],p)&&(h=c<3?void 0:h,c=1),o=Object(o);++u<c;){var d=l[u];d&&i(o,d,u,h)}return o})}return sg=r,sg}var ig,_k;function f4(){if(_k)return ig;_k=1;var e=c4(),n=d4(),r=n(function(i,o,l){e(i,o,l)});return ig=r,ig}var og,bk;function pj(){if(bk)return og;bk=1;function e(n,r){return n<r}return og=e,og}var ag,Sk;function h4(){if(Sk)return ag;Sk=1;var e=dy(),n=pj(),r=fi();function i(o){return o&&o.length?e(o,r,n):void 0}return ag=i,ag}var lg,kk;function p4(){if(kk)return lg;kk=1;var e=dy(),n=Vr(),r=pj();function i(o,l){return o&&o.length?e(o,n(l,2),r):void 0}return lg=i,lg}var ug,Ek;function m4(){if(Ek)return ug;Ek=1;var e=tr(),n=function(){return e.Date.now()};return ug=n,ug}var cg,Nk;function g4(){if(Nk)return cg;Nk=1;var e=Ou(),n=Bu(),r=Lu(),i=Ln(),o=za();function l(u,c,h,p){if(!i(u))return u;c=n(c,u);for(var d=-1,m=c.length,y=m-1,w=u;w!=null&&++d<m;){var N=o(c[d]),_=h;if(N==="__proto__"||N==="constructor"||N==="prototype")return u;if(d!=y){var S=w[N];_=p?p(S,N,w):void 0,_===void 0&&(_=i(S)?S:r(c[d+1])?[]:{})}e(w,N,_),w=w[N]}return u}return cg=l,cg}var dg,Ck;function v4(){if(Ck)return dg;Ck=1;var e=Uu(),n=g4(),r=Bu();function i(o,l,u){for(var c=-1,h=l.length,p={};++c<h;){var d=l[c],m=e(o,d);u(m,d)&&n(p,r(d,o),m)}return p}return dg=i,dg}var fg,jk;function y4(){if(jk)return fg;jk=1;var e=v4(),n=VC();function r(i,o){return e(i,o,function(l,u){return n(i,u)})}return fg=r,fg}var hg,Rk;function w4(){if(Rk)return hg;Rk=1;var e=dj(),n=ej(),r=tj();function i(o){return r(n(o,void 0,e),o+"")}return hg=i,hg}var pg,Tk;function x4(){if(Tk)return pg;Tk=1;var e=y4(),n=w4(),r=n(function(i,o){return i==null?{}:e(i,o)});return pg=r,pg}var mg,Ak;function _4(){if(Ak)return mg;Ak=1;var e=Math.ceil,n=Math.max;function r(i,o,l,u){for(var c=-1,h=n(e((o-i)/(l||1)),0),p=Array(h);h--;)p[u?h:++c]=i,i+=l;return p}return mg=r,mg}var gg,Ik;function b4(){if(Ik)return gg;Ik=1;var e=_4(),n=Wu(),r=cj();function i(o){return function(l,u,c){return c&&typeof c!="number"&&n(l,u,c)&&(u=c=void 0),l=r(l),u===void 0?(u=l,l=0):u=r(u),c=c===void 0?l<u?1:-1:r(c),e(l,u,c,o)}}return gg=i,gg}var vg,Mk;function S4(){if(Mk)return vg;Mk=1;var e=b4(),n=e();return vg=n,vg}var yg,Pk;function k4(){if(Pk)return yg;Pk=1;function e(n,r){var i=n.length;for(n.sort(r);i--;)n[i]=n[i].value;return n}return yg=e,yg}var wg,Ok;function E4(){if(Ok)return wg;Ok=1;var e=bo();function n(r,i){if(r!==i){var o=r!==void 0,l=r===null,u=r===r,c=e(r),h=i!==void 0,p=i===null,d=i===i,m=e(i);if(!p&&!m&&!c&&r>i||c&&h&&d&&!p&&!m||l&&h&&d||!o&&d||!u)return 1;if(!l&&!c&&!m&&r<i||m&&o&&u&&!l&&!c||p&&o&&u||!h&&u||!d)return-1}return 0}return wg=n,wg}var xg,Lk;function N4(){if(Lk)return xg;Lk=1;var e=E4();function n(r,i,o){for(var l=-1,u=r.criteria,c=i.criteria,h=u.length,p=o.length;++l<h;){var d=e(u[l],c[l]);if(d){if(l>=p)return d;var m=o[l];return d*(m=="desc"?-1:1)}}return r.index-i.index}return xg=n,xg}var _g,qk;function C4(){if(qk)return _g;qk=1;var e=zu(),n=Uu(),r=Vr(),i=QC(),o=k4(),l=qu(),u=N4(),c=fi(),h=bt();function p(d,m,y){m.length?m=e(m,function(_){return h(_)?function(S){return n(S,_.length===1?_[0]:_)}:_}):m=[c];var w=-1;m=e(m,l(r));var N=i(d,function(_,S,b){var k=e(m,function(E){return E(_)});return{criteria:k,index:++w,value:_}});return o(N,function(_,S){return u(_,S,y)})}return _g=p,_g}var bg,$k;function j4(){if($k)return bg;$k=1;var e=uy(),n=C4(),r=Hu(),i=Wu(),o=r(function(l,u){if(l==null)return[];var c=u.length;return c>1&&i(l,u[0],u[1])?u=[]:c>2&&i(u[0],u[1],u[2])&&(u=[u[0]]),n(l,e(u,1),[])});return bg=o,bg}var Sg,Dk;function R4(){if(Dk)return Sg;Dk=1;var e=HC(),n=0;function r(i){var o=++n;return e(i)+o}return Sg=r,Sg}var kg,Fk;function T4(){if(Fk)return kg;Fk=1;function e(n,r,i){for(var o=-1,l=n.length,u=r.length,c={};++o<l;){var h=o<u?r[o]:void 0;i(c,n[o],h)}return c}return kg=e,kg}var Eg,zk;function A4(){if(zk)return Eg;zk=1;var e=Ou(),n=T4();function r(i,o){return n(i||[],o||[],e)}return Eg=r,Eg}var Ng,Bk;function it(){if(Bk)return Ng;Bk=1;var e;if(typeof Yv=="function")try{e={cloneDeep:G$(),constant:sy(),defaults:Y$(),each:qC(),filter:YC(),find:t4(),flatten:dj(),forEach:LC(),forIn:n4(),has:KC(),isUndefined:XC(),last:r4(),map:ZC(),mapValues:s4(),max:o4(),merge:f4(),min:h4(),minBy:p4(),now:m4(),pick:x4(),range:S4(),reduce:JC(),sortBy:j4(),uniqueId:R4(),values:sj(),zipObject:A4()}}catch{}return e||(e=window._),Ng=e,Ng}var Cg,Uk;function I4(){if(Uk)return Cg;Uk=1,Cg=e;function e(){var i={};i._next=i._prev=i,this._sentinel=i}e.prototype.dequeue=function(){var i=this._sentinel,o=i._prev;if(o!==i)return n(o),o},e.prototype.enqueue=function(i){var o=this._sentinel;i._prev&&i._next&&n(i),i._next=o._next,o._next._prev=i,o._next=i,i._prev=o},e.prototype.toString=function(){for(var i=[],o=this._sentinel,l=o._prev;l!==o;)i.push(JSON.stringify(l,r)),l=l._prev;return"["+i.join(", ")+"]"};function n(i){i._prev._next=i._next,i._next._prev=i._prev,delete i._next,delete i._prev}function r(i,o){if(i!=="_next"&&i!=="_prev")return o}return Cg}var jg,Hk;function M4(){if(Hk)return jg;Hk=1;var e=it(),n=Jn().Graph,r=I4();jg=o;var i=e.constant(1);function o(p,d){if(p.nodeCount()<=1)return[];var m=c(p,d||i),y=l(m.graph,m.buckets,m.zeroIdx);return e.flatten(e.map(y,function(w){return p.outEdges(w.v,w.w)}),!0)}function l(p,d,m){for(var y=[],w=d[d.length-1],N=d[0],_;p.nodeCount();){for(;_=N.dequeue();)u(p,d,m,_);for(;_=w.dequeue();)u(p,d,m,_);if(p.nodeCount()){for(var S=d.length-2;S>0;--S)if(_=d[S].dequeue(),_){y=y.concat(u(p,d,m,_,!0));break}}}return y}function u(p,d,m,y,w){var N=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(_){var S=p.edge(_),b=p.node(_.v);w&&N.push({v:_.v,w:_.w}),b.out-=S,h(d,m,b)}),e.forEach(p.outEdges(y.v),function(_){var S=p.edge(_),b=_.w,k=p.node(b);k.in-=S,h(d,m,k)}),p.removeNode(y.v),N}function c(p,d){var m=new n,y=0,w=0;e.forEach(p.nodes(),function(S){m.setNode(S,{v:S,in:0,out:0})}),e.forEach(p.edges(),function(S){var b=m.edge(S.v,S.w)||0,k=d(S),E=b+k;m.setEdge(S.v,S.w,E),w=Math.max(w,m.node(S.v).out+=k),y=Math.max(y,m.node(S.w).in+=k)});var N=e.range(w+y+3).map(function(){return new r}),_=y+1;return e.forEach(m.nodes(),function(S){h(N,_,m.node(S))}),{graph:m,buckets:N,zeroIdx:_}}function h(p,d,m){m.out?m.in?p[m.out-m.in+d].enqueue(m):p[p.length-1].enqueue(m):p[0].enqueue(m)}return jg}var Rg,Wk;function P4(){if(Wk)return Rg;Wk=1;var e=it(),n=M4();Rg={run:r,undo:o};function r(l){var u=l.graph().acyclicer==="greedy"?n(l,c(l)):i(l);e.forEach(u,function(h){var p=l.edge(h);l.removeEdge(h),p.forwardName=h.name,p.reversed=!0,l.setEdge(h.w,h.v,p,e.uniqueId("rev"))});function c(h){return function(p){return h.edge(p).weight}}}function i(l){var u=[],c={},h={};function p(d){e.has(h,d)||(h[d]=!0,c[d]=!0,e.forEach(l.outEdges(d),function(m){e.has(c,m.w)?u.push(m):p(m.w)}),delete c[d])}return e.forEach(l.nodes(),p),u}function o(l){e.forEach(l.edges(),function(u){var c=l.edge(u);if(c.reversed){l.removeEdge(u);var h=c.forwardName;delete c.reversed,delete c.forwardName,l.setEdge(u.w,u.v,c,h)}})}return Rg}var Tg,Vk;function hn(){if(Vk)return Tg;Vk=1;var e=it(),n=Jn().Graph;Tg={addDummyNode:r,simplify:i,asNonCompoundGraph:o,successorWeights:l,predecessorWeights:u,intersectRect:c,buildLayerMatrix:h,normalizeRanks:p,removeEmptyRanks:d,addBorderNode:m,maxRank:y,partition:w,time:N,notime:_};function r(S,b,k,E){var C;do C=e.uniqueId(E);while(S.hasNode(C));return k.dummy=b,S.setNode(C,k),C}function i(S){var b=new n().setGraph(S.graph());return e.forEach(S.nodes(),function(k){b.setNode(k,S.node(k))}),e.forEach(S.edges(),function(k){var E=b.edge(k.v,k.w)||{weight:0,minlen:1},C=S.edge(k);b.setEdge(k.v,k.w,{weight:E.weight+C.weight,minlen:Math.max(E.minlen,C.minlen)})}),b}function o(S){var b=new n({multigraph:S.isMultigraph()}).setGraph(S.graph());return e.forEach(S.nodes(),function(k){S.children(k).length||b.setNode(k,S.node(k))}),e.forEach(S.edges(),function(k){b.setEdge(k,S.edge(k))}),b}function l(S){var b=e.map(S.nodes(),function(k){var E={};return e.forEach(S.outEdges(k),function(C){E[C.w]=(E[C.w]||0)+S.edge(C).weight}),E});return e.zipObject(S.nodes(),b)}function u(S){var b=e.map(S.nodes(),function(k){var E={};return e.forEach(S.inEdges(k),function(C){E[C.v]=(E[C.v]||0)+S.edge(C).weight}),E});return e.zipObject(S.nodes(),b)}function c(S,b){var k=S.x,E=S.y,C=b.x-k,A=b.y-E,M=S.width/2,L=S.height/2;if(!C&&!A)throw new Error("Not possible to find intersection inside of the rectangle");var H,O;return Math.abs(A)*M>Math.abs(C)*L?(A<0&&(L=-L),H=L*C/A,O=L):(C<0&&(M=-M),H=M,O=M*A/C),{x:k+H,y:E+O}}function h(S){var b=e.map(e.range(y(S)+1),function(){return[]});return e.forEach(S.nodes(),function(k){var E=S.node(k),C=E.rank;e.isUndefined(C)||(b[C][E.order]=k)}),b}function p(S){var b=e.min(e.map(S.nodes(),function(k){return S.node(k).rank}));e.forEach(S.nodes(),function(k){var E=S.node(k);e.has(E,"rank")&&(E.rank-=b)})}function d(S){var b=e.min(e.map(S.nodes(),function(A){return S.node(A).rank})),k=[];e.forEach(S.nodes(),function(A){var M=S.node(A).rank-b;k[M]||(k[M]=[]),k[M].push(A)});var E=0,C=S.graph().nodeRankFactor;e.forEach(k,function(A,M){e.isUndefined(A)&&M%C!==0?--E:E&&e.forEach(A,function(L){S.node(L).rank+=E})})}function m(S,b,k,E){var C={width:0,height:0};return arguments.length>=4&&(C.rank=k,C.order=E),r(S,"border",C,b)}function y(S){return e.max(e.map(S.nodes(),function(b){var k=S.node(b).rank;if(!e.isUndefined(k))return k}))}function w(S,b){var k={lhs:[],rhs:[]};return e.forEach(S,function(E){b(E)?k.lhs.push(E):k.rhs.push(E)}),k}function N(S,b){var k=e.now();try{return b()}finally{console.log(S+" time: "+(e.now()-k)+"ms")}}function _(S,b){return b()}return Tg}var Ag,Gk;function O4(){if(Gk)return Ag;Gk=1;var e=it(),n=hn();Ag={run:r,undo:o};function r(l){l.graph().dummyChains=[],e.forEach(l.edges(),function(u){i(l,u)})}function i(l,u){var c=u.v,h=l.node(c).rank,p=u.w,d=l.node(p).rank,m=u.name,y=l.edge(u),w=y.labelRank;if(d!==h+1){l.removeEdge(u);var N,_,S;for(S=0,++h;h<d;++S,++h)y.points=[],_={width:0,height:0,edgeLabel:y,edgeObj:u,rank:h},N=n.addDummyNode(l,"edge",_,"_d"),h===w&&(_.width=y.width,_.height=y.height,_.dummy="edge-label",_.labelpos=y.labelpos),l.setEdge(c,N,{weight:y.weight},m),S===0&&l.graph().dummyChains.push(N),c=N;l.setEdge(c,p,{weight:y.weight},m)}}function o(l){e.forEach(l.graph().dummyChains,function(u){var c=l.node(u),h=c.edgeLabel,p;for(l.setEdge(c.edgeObj,h);c.dummy;)p=l.successors(u)[0],l.removeNode(u),h.points.push({x:c.x,y:c.y}),c.dummy==="edge-label"&&(h.x=c.x,h.y=c.y,h.width=c.width,h.height=c.height),u=p,c=l.node(u)})}return Ag}var Ig,Yk;function wu(){if(Yk)return Ig;Yk=1;var e=it();Ig={longestPath:n,slack:r};function n(i){var o={};function l(u){var c=i.node(u);if(e.has(o,u))return c.rank;o[u]=!0;var h=e.min(e.map(i.outEdges(u),function(p){return l(p.w)-i.edge(p).minlen}));return(h===Number.POSITIVE_INFINITY||h===void 0||h===null)&&(h=0),c.rank=h}e.forEach(i.sources(),l)}function r(i,o){return i.node(o.w).rank-i.node(o.v).rank-i.edge(o).minlen}return Ig}var Mg,Kk;function mj(){if(Kk)return Mg;Kk=1;var e=it(),n=Jn().Graph,r=wu().slack;Mg=i;function i(c){var h=new n({directed:!1}),p=c.nodes()[0],d=c.nodeCount();h.setNode(p,{});for(var m,y;o(h,c)<d;)m=l(h,c),y=h.hasNode(m.v)?r(c,m):-r(c,m),u(h,c,y);return h}function o(c,h){function p(d){e.forEach(h.nodeEdges(d),function(m){var y=m.v,w=d===y?m.w:y;!c.hasNode(w)&&!r(h,m)&&(c.setNode(w,{}),c.setEdge(d,w,{}),p(w))})}return e.forEach(c.nodes(),p),c.nodeCount()}function l(c,h){return e.minBy(h.edges(),function(p){if(c.hasNode(p.v)!==c.hasNode(p.w))return r(h,p)})}function u(c,h,p){e.forEach(c.nodes(),function(d){h.node(d).rank+=p})}return Mg}var Pg,Xk;function L4(){if(Xk)return Pg;Xk=1;var e=it(),n=mj(),r=wu().slack,i=wu().longestPath,o=Jn().alg.preorder,l=Jn().alg.postorder,u=hn().simplify;Pg=c,c.initLowLimValues=m,c.initCutValues=h,c.calcCutValue=d,c.leaveEdge=w,c.enterEdge=N,c.exchangeEdges=_;function c(E){E=u(E),i(E);var C=n(E);m(C),h(C,E);for(var A,M;A=w(C);)M=N(C,E,A),_(C,E,A,M)}function h(E,C){var A=l(E,E.nodes());A=A.slice(0,A.length-1),e.forEach(A,function(M){p(E,C,M)})}function p(E,C,A){var M=E.node(A),L=M.parent;E.edge(A,L).cutvalue=d(E,C,A)}function d(E,C,A){var M=E.node(A),L=M.parent,H=!0,O=C.edge(A,L),P=0;return O||(H=!1,O=C.edge(L,A)),P=O.weight,e.forEach(C.nodeEdges(A),function(F){var Y=F.v===A,q=Y?F.w:F.v;if(q!==L){var R=Y===H,Q=C.edge(F).weight;if(P+=R?Q:-Q,b(E,A,q)){var z=E.edge(A,q).cutvalue;P+=R?-z:z}}}),P}function m(E,C){arguments.length<2&&(C=E.nodes()[0]),y(E,{},1,C)}function y(E,C,A,M,L){var H=A,O=E.node(M);return C[M]=!0,e.forEach(E.neighbors(M),function(P){e.has(C,P)||(A=y(E,C,A,P,M))}),O.low=H,O.lim=A++,L?O.parent=L:delete O.parent,A}function w(E){return e.find(E.edges(),function(C){return E.edge(C).cutvalue<0})}function N(E,C,A){var M=A.v,L=A.w;C.hasEdge(M,L)||(M=A.w,L=A.v);var H=E.node(M),O=E.node(L),P=H,F=!1;H.lim>O.lim&&(P=O,F=!0);var Y=e.filter(C.edges(),function(q){return F===k(E,E.node(q.v),P)&&F!==k(E,E.node(q.w),P)});return e.minBy(Y,function(q){return r(C,q)})}function _(E,C,A,M){var L=A.v,H=A.w;E.removeEdge(L,H),E.setEdge(M.v,M.w,{}),m(E),h(E,C),S(E,C)}function S(E,C){var A=e.find(E.nodes(),function(L){return!C.node(L).parent}),M=o(E,A);M=M.slice(1),e.forEach(M,function(L){var H=E.node(L).parent,O=C.edge(L,H),P=!1;O||(O=C.edge(H,L),P=!0),C.node(L).rank=C.node(H).rank+(P?O.minlen:-O.minlen)})}function b(E,C,A){return E.hasEdge(C,A)}function k(E,C,A){return A.low<=C.lim&&C.lim<=A.lim}return Pg}var Og,Qk;function q4(){if(Qk)return Og;Qk=1;var e=wu(),n=e.longestPath,r=mj(),i=L4();Og=o;function o(h){switch(h.graph().ranker){case"network-simplex":c(h);break;case"tight-tree":u(h);break;case"longest-path":l(h);break;default:c(h)}}var l=n;function u(h){n(h),r(h)}function c(h){i(h)}return Og}var Lg,Zk;function $4(){if(Zk)return Lg;Zk=1;var e=it();Lg=n;function n(o){var l=i(o);e.forEach(o.graph().dummyChains,function(u){for(var c=o.node(u),h=c.edgeObj,p=r(o,l,h.v,h.w),d=p.path,m=p.lca,y=0,w=d[y],N=!0;u!==h.w;){if(c=o.node(u),N){for(;(w=d[y])!==m&&o.node(w).maxRank<c.rank;)y++;w===m&&(N=!1)}if(!N){for(;y<d.length-1&&o.node(w=d[y+1]).minRank<=c.rank;)y++;w=d[y]}o.setParent(u,w),u=o.successors(u)[0]}})}function r(o,l,u,c){var h=[],p=[],d=Math.min(l[u].low,l[c].low),m=Math.max(l[u].lim,l[c].lim),y,w;y=u;do y=o.parent(y),h.push(y);while(y&&(l[y].low>d||m>l[y].lim));for(w=y,y=c;(y=o.parent(y))!==w;)p.push(y);return{path:h.concat(p.reverse()),lca:w}}function i(o){var l={},u=0;function c(h){var p=u;e.forEach(o.children(h),c),l[h]={low:p,lim:u++}}return e.forEach(o.children(),c),l}return Lg}var qg,Jk;function D4(){if(Jk)return qg;Jk=1;var e=it(),n=hn();qg={run:r,cleanup:u};function r(c){var h=n.addDummyNode(c,"root",{},"_root"),p=o(c),d=e.max(e.values(p))-1,m=2*d+1;c.graph().nestingRoot=h,e.forEach(c.edges(),function(w){c.edge(w).minlen*=m});var y=l(c)+1;e.forEach(c.children(),function(w){i(c,h,m,y,d,p,w)}),c.graph().nodeRankFactor=m}function i(c,h,p,d,m,y,w){var N=c.children(w);if(!N.length){w!==h&&c.setEdge(h,w,{weight:0,minlen:p});return}var _=n.addBorderNode(c,"_bt"),S=n.addBorderNode(c,"_bb"),b=c.node(w);c.setParent(_,w),b.borderTop=_,c.setParent(S,w),b.borderBottom=S,e.forEach(N,function(k){i(c,h,p,d,m,y,k);var E=c.node(k),C=E.borderTop?E.borderTop:k,A=E.borderBottom?E.borderBottom:k,M=E.borderTop?d:2*d,L=C!==A?1:m-y[w]+1;c.setEdge(_,C,{weight:M,minlen:L,nestingEdge:!0}),c.setEdge(A,S,{weight:M,minlen:L,nestingEdge:!0})}),c.parent(w)||c.setEdge(h,_,{weight:0,minlen:m+y[w]})}function o(c){var h={};function p(d,m){var y=c.children(d);y&&y.length&&e.forEach(y,function(w){p(w,m+1)}),h[d]=m}return e.forEach(c.children(),function(d){p(d,1)}),h}function l(c){return e.reduce(c.edges(),function(h,p){return h+c.edge(p).weight},0)}function u(c){var h=c.graph();c.removeNode(h.nestingRoot),delete h.nestingRoot,e.forEach(c.edges(),function(p){var d=c.edge(p);d.nestingEdge&&c.removeEdge(p)})}return qg}var $g,eE;function F4(){if(eE)return $g;eE=1;var e=it(),n=hn();$g=r;function r(o){function l(u){var c=o.children(u),h=o.node(u);if(c.length&&e.forEach(c,l),e.has(h,"minRank")){h.borderLeft=[],h.borderRight=[];for(var p=h.minRank,d=h.maxRank+1;p<d;++p)i(o,"borderLeft","_bl",u,h,p),i(o,"borderRight","_br",u,h,p)}}e.forEach(o.children(),l)}function i(o,l,u,c,h,p){var d={width:0,height:0,rank:p,borderType:l},m=h[l][p-1],y=n.addDummyNode(o,"border",d,u);h[l][p]=y,o.setParent(y,c),m&&o.setEdge(m,y,{weight:1})}return $g}var Dg,tE;function z4(){if(tE)return Dg;tE=1;var e=it();Dg={adjust:n,undo:r};function n(p){var d=p.graph().rankdir.toLowerCase();(d==="lr"||d==="rl")&&i(p)}function r(p){var d=p.graph().rankdir.toLowerCase();(d==="bt"||d==="rl")&&l(p),(d==="lr"||d==="rl")&&(c(p),i(p))}function i(p){e.forEach(p.nodes(),function(d){o(p.node(d))}),e.forEach(p.edges(),function(d){o(p.edge(d))})}function o(p){var d=p.width;p.width=p.height,p.height=d}function l(p){e.forEach(p.nodes(),function(d){u(p.node(d))}),e.forEach(p.edges(),function(d){var m=p.edge(d);e.forEach(m.points,u),e.has(m,"y")&&u(m)})}function u(p){p.y=-p.y}function c(p){e.forEach(p.nodes(),function(d){h(p.node(d))}),e.forEach(p.edges(),function(d){var m=p.edge(d);e.forEach(m.points,h),e.has(m,"x")&&h(m)})}function h(p){var d=p.x;p.x=p.y,p.y=d}return Dg}var Fg,nE;function B4(){if(nE)return Fg;nE=1;var e=it();Fg=n;function n(r){var i={},o=e.filter(r.nodes(),function(p){return!r.children(p).length}),l=e.max(e.map(o,function(p){return r.node(p).rank})),u=e.map(e.range(l+1),function(){return[]});function c(p){if(!e.has(i,p)){i[p]=!0;var d=r.node(p);u[d.rank].push(p),e.forEach(r.successors(p),c)}}var h=e.sortBy(o,function(p){return r.node(p).rank});return e.forEach(h,c),u}return Fg}var zg,rE;function U4(){if(rE)return zg;rE=1;var e=it();zg=n;function n(i,o){for(var l=0,u=1;u<o.length;++u)l+=r(i,o[u-1],o[u]);return l}function r(i,o,l){for(var u=e.zipObject(l,e.map(l,function(y,w){return w})),c=e.flatten(e.map(o,function(y){return e.sortBy(e.map(i.outEdges(y),function(w){return{pos:u[w.w],weight:i.edge(w).weight}}),"pos")}),!0),h=1;h<l.length;)h<<=1;var p=2*h-1;h-=1;var d=e.map(new Array(p),function(){return 0}),m=0;return e.forEach(c.forEach(function(y){var w=y.pos+h;d[w]+=y.weight;for(var N=0;w>0;)w%2&&(N+=d[w+1]),w=w-1>>1,d[w]+=y.weight;m+=y.weight*N})),m}return zg}var Bg,sE;function H4(){if(sE)return Bg;sE=1;var e=it();Bg=n;function n(r,i){return e.map(i,function(o){var l=r.inEdges(o);if(l.length){var u=e.reduce(l,function(c,h){var p=r.edge(h),d=r.node(h.v);return{sum:c.sum+p.weight*d.order,weight:c.weight+p.weight}},{sum:0,weight:0});return{v:o,barycenter:u.sum/u.weight,weight:u.weight}}else return{v:o}})}return Bg}var Ug,iE;function W4(){if(iE)return Ug;iE=1;var e=it();Ug=n;function n(o,l){var u={};e.forEach(o,function(h,p){var d=u[h.v]={indegree:0,in:[],out:[],vs:[h.v],i:p};e.isUndefined(h.barycenter)||(d.barycenter=h.barycenter,d.weight=h.weight)}),e.forEach(l.edges(),function(h){var p=u[h.v],d=u[h.w];!e.isUndefined(p)&&!e.isUndefined(d)&&(d.indegree++,p.out.push(u[h.w]))});var c=e.filter(u,function(h){return!h.indegree});return r(c)}function r(o){var l=[];function u(p){return function(d){d.merged||(e.isUndefined(d.barycenter)||e.isUndefined(p.barycenter)||d.barycenter>=p.barycenter)&&i(p,d)}}function c(p){return function(d){d.in.push(p),--d.indegree===0&&o.push(d)}}for(;o.length;){var h=o.pop();l.push(h),e.forEach(h.in.reverse(),u(h)),e.forEach(h.out,c(h))}return e.map(e.filter(l,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function i(o,l){var u=0,c=0;o.weight&&(u+=o.barycenter*o.weight,c+=o.weight),l.weight&&(u+=l.barycenter*l.weight,c+=l.weight),o.vs=l.vs.concat(o.vs),o.barycenter=u/c,o.weight=c,o.i=Math.min(l.i,o.i),l.merged=!0}return Ug}var Hg,oE;function V4(){if(oE)return Hg;oE=1;var e=it(),n=hn();Hg=r;function r(l,u){var c=n.partition(l,function(_){return e.has(_,"barycenter")}),h=c.lhs,p=e.sortBy(c.rhs,function(_){return-_.i}),d=[],m=0,y=0,w=0;h.sort(o(!!u)),w=i(d,p,w),e.forEach(h,function(_){w+=_.vs.length,d.push(_.vs),m+=_.barycenter*_.weight,y+=_.weight,w=i(d,p,w)});var N={vs:e.flatten(d,!0)};return y&&(N.barycenter=m/y,N.weight=y),N}function i(l,u,c){for(var h;u.length&&(h=e.last(u)).i<=c;)u.pop(),l.push(h.vs),c++;return c}function o(l){return function(u,c){return u.barycenter<c.barycenter?-1:u.barycenter>c.barycenter?1:l?c.i-u.i:u.i-c.i}}return Hg}var Wg,aE;function G4(){if(aE)return Wg;aE=1;var e=it(),n=H4(),r=W4(),i=V4();Wg=o;function o(c,h,p,d){var m=c.children(h),y=c.node(h),w=y?y.borderLeft:void 0,N=y?y.borderRight:void 0,_={};w&&(m=e.filter(m,function(A){return A!==w&&A!==N}));var S=n(c,m);e.forEach(S,function(A){if(c.children(A.v).length){var M=o(c,A.v,p,d);_[A.v]=M,e.has(M,"barycenter")&&u(A,M)}});var b=r(S,p);l(b,_);var k=i(b,d);if(w&&(k.vs=e.flatten([w,k.vs,N],!0),c.predecessors(w).length)){var E=c.node(c.predecessors(w)[0]),C=c.node(c.predecessors(N)[0]);e.has(k,"barycenter")||(k.barycenter=0,k.weight=0),k.barycenter=(k.barycenter*k.weight+E.order+C.order)/(k.weight+2),k.weight+=2}return k}function l(c,h){e.forEach(c,function(p){p.vs=e.flatten(p.vs.map(function(d){return h[d]?h[d].vs:d}),!0)})}function u(c,h){e.isUndefined(c.barycenter)?(c.barycenter=h.barycenter,c.weight=h.weight):(c.barycenter=(c.barycenter*c.weight+h.barycenter*h.weight)/(c.weight+h.weight),c.weight+=h.weight)}return Wg}var Vg,lE;function Y4(){if(lE)return Vg;lE=1;var e=it(),n=Jn().Graph;Vg=r;function r(o,l,u){var c=i(o),h=new n({compound:!0}).setGraph({root:c}).setDefaultNodeLabel(function(p){return o.node(p)});return e.forEach(o.nodes(),function(p){var d=o.node(p),m=o.parent(p);(d.rank===l||d.minRank<=l&&l<=d.maxRank)&&(h.setNode(p),h.setParent(p,m||c),e.forEach(o[u](p),function(y){var w=y.v===p?y.w:y.v,N=h.edge(w,p),_=e.isUndefined(N)?0:N.weight;h.setEdge(w,p,{weight:o.edge(y).weight+_})}),e.has(d,"minRank")&&h.setNode(p,{borderLeft:d.borderLeft[l],borderRight:d.borderRight[l]}))}),h}function i(o){for(var l;o.hasNode(l=e.uniqueId("_root")););return l}return Vg}var Gg,uE;function K4(){if(uE)return Gg;uE=1;var e=it();Gg=n;function n(r,i,o){var l={},u;e.forEach(o,function(c){for(var h=r.parent(c),p,d;h;){if(p=r.parent(h),p?(d=l[p],l[p]=h):(d=u,u=h),d&&d!==h){i.setEdge(d,h);return}h=p}})}return Gg}var Yg,cE;function X4(){if(cE)return Yg;cE=1;var e=it(),n=B4(),r=U4(),i=G4(),o=Y4(),l=K4(),u=Jn().Graph,c=hn();Yg=h;function h(y){var w=c.maxRank(y),N=p(y,e.range(1,w+1),"inEdges"),_=p(y,e.range(w-1,-1,-1),"outEdges"),S=n(y);m(y,S);for(var b=Number.POSITIVE_INFINITY,k,E=0,C=0;C<4;++E,++C){d(E%2?N:_,E%4>=2),S=c.buildLayerMatrix(y);var A=r(y,S);A<b&&(C=0,k=e.cloneDeep(S),b=A)}m(y,k)}function p(y,w,N){return e.map(w,function(_){return o(y,_,N)})}function d(y,w){var N=new u;e.forEach(y,function(_){var S=_.graph().root,b=i(_,S,N,w);e.forEach(b.vs,function(k,E){_.node(k).order=E}),l(_,N,b.vs)})}function m(y,w){e.forEach(w,function(N){e.forEach(N,function(_,S){y.node(_).order=S})})}return Yg}var Kg,dE;function Q4(){if(dE)return Kg;dE=1;var e=it(),n=Jn().Graph,r=hn();Kg={positionX:N,findType1Conflicts:i,findType2Conflicts:o,addConflict:u,hasConflict:c,verticalAlignment:h,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:m,balance:w};function i(b,k){var E={};function C(A,M){var L=0,H=0,O=A.length,P=e.last(M);return e.forEach(M,function(F,Y){var q=l(b,F),R=q?b.node(q).order:O;(q||F===P)&&(e.forEach(M.slice(H,Y+1),function(Q){e.forEach(b.predecessors(Q),function(z){var ne=b.node(z),Z=ne.order;(Z<L||R<Z)&&!(ne.dummy&&b.node(Q).dummy)&&u(E,z,Q)})}),H=Y+1,L=R)}),M}return e.reduce(k,C),E}function o(b,k){var E={};function C(M,L,H,O,P){var F;e.forEach(e.range(L,H),function(Y){F=M[Y],b.node(F).dummy&&e.forEach(b.predecessors(F),function(q){var R=b.node(q);R.dummy&&(R.order<O||R.order>P)&&u(E,q,F)})})}function A(M,L){var H=-1,O,P=0;return e.forEach(L,function(F,Y){if(b.node(F).dummy==="border"){var q=b.predecessors(F);q.length&&(O=b.node(q[0]).order,C(L,P,Y,H,O),P=Y,H=O)}C(L,P,L.length,O,M.length)}),L}return e.reduce(k,A),E}function l(b,k){if(b.node(k).dummy)return e.find(b.predecessors(k),function(E){return b.node(E).dummy})}function u(b,k,E){if(k>E){var C=k;k=E,E=C}var A=b[k];A||(b[k]=A={}),A[E]=!0}function c(b,k,E){if(k>E){var C=k;k=E,E=C}return e.has(b[k],E)}function h(b,k,E,C){var A={},M={},L={};return e.forEach(k,function(H){e.forEach(H,function(O,P){A[O]=O,M[O]=O,L[O]=P})}),e.forEach(k,function(H){var O=-1;e.forEach(H,function(P){var F=C(P);if(F.length){F=e.sortBy(F,function(z){return L[z]});for(var Y=(F.length-1)/2,q=Math.floor(Y),R=Math.ceil(Y);q<=R;++q){var Q=F[q];M[P]===P&&O<L[Q]&&!c(E,P,Q)&&(M[Q]=P,M[P]=A[P]=A[Q],O=L[Q])}}})}),{root:A,align:M}}function p(b,k,E,C,A){var M={},L=d(b,k,E,A),H=A?"borderLeft":"borderRight";function O(Y,q){for(var R=L.nodes(),Q=R.pop(),z={};Q;)z[Q]?Y(Q):(z[Q]=!0,R.push(Q),R=R.concat(q(Q))),Q=R.pop()}function P(Y){M[Y]=L.inEdges(Y).reduce(function(q,R){return Math.max(q,M[R.v]+L.edge(R))},0)}function F(Y){var q=L.outEdges(Y).reduce(function(Q,z){return Math.min(Q,M[z.w]-L.edge(z))},Number.POSITIVE_INFINITY),R=b.node(Y);q!==Number.POSITIVE_INFINITY&&R.borderType!==H&&(M[Y]=Math.max(M[Y],q))}return O(P,L.predecessors.bind(L)),O(F,L.successors.bind(L)),e.forEach(C,function(Y){M[Y]=M[E[Y]]}),M}function d(b,k,E,C){var A=new n,M=b.graph(),L=_(M.nodesep,M.edgesep,C);return e.forEach(k,function(H){var O;e.forEach(H,function(P){var F=E[P];if(A.setNode(F),O){var Y=E[O],q=A.edge(Y,F);A.setEdge(Y,F,Math.max(L(b,P,O),q||0))}O=P})}),A}function m(b,k){return e.minBy(e.values(k),function(E){var C=Number.NEGATIVE_INFINITY,A=Number.POSITIVE_INFINITY;return e.forIn(E,function(M,L){var H=S(b,L)/2;C=Math.max(M+H,C),A=Math.min(M-H,A)}),C-A})}function y(b,k){var E=e.values(k),C=e.min(E),A=e.max(E);e.forEach(["u","d"],function(M){e.forEach(["l","r"],function(L){var H=M+L,O=b[H],P;if(O!==k){var F=e.values(O);P=L==="l"?C-e.min(F):A-e.max(F),P&&(b[H]=e.mapValues(O,function(Y){return Y+P}))}})})}function w(b,k){return e.mapValues(b.ul,function(E,C){if(k)return b[k.toLowerCase()][C];var A=e.sortBy(e.map(b,C));return(A[1]+A[2])/2})}function N(b){var k=r.buildLayerMatrix(b),E=e.merge(i(b,k),o(b,k)),C={},A;e.forEach(["u","d"],function(L){A=L==="u"?k:e.values(k).reverse(),e.forEach(["l","r"],function(H){H==="r"&&(A=e.map(A,function(Y){return e.values(Y).reverse()}));var O=(L==="u"?b.predecessors:b.successors).bind(b),P=h(b,A,E,O),F=p(b,A,P.root,P.align,H==="r");H==="r"&&(F=e.mapValues(F,function(Y){return-Y})),C[L+H]=F})});var M=m(b,C);return y(C,M),w(C,b.graph().align)}function _(b,k,E){return function(C,A,M){var L=C.node(A),H=C.node(M),O=0,P;if(O+=L.width/2,e.has(L,"labelpos"))switch(L.labelpos.toLowerCase()){case"l":P=-L.width/2;break;case"r":P=L.width/2;break}if(P&&(O+=E?P:-P),P=0,O+=(L.dummy?k:b)/2,O+=(H.dummy?k:b)/2,O+=H.width/2,e.has(H,"labelpos"))switch(H.labelpos.toLowerCase()){case"l":P=H.width/2;break;case"r":P=-H.width/2;break}return P&&(O+=E?P:-P),P=0,O}}function S(b,k){return b.node(k).width}return Kg}var Xg,fE;function Z4(){if(fE)return Xg;fE=1;var e=it(),n=hn(),r=Q4().positionX;Xg=i;function i(l){l=n.asNonCompoundGraph(l),o(l),e.forEach(r(l),function(u,c){l.node(c).x=u})}function o(l){var u=n.buildLayerMatrix(l),c=l.graph().ranksep,h=0;e.forEach(u,function(p){var d=e.max(e.map(p,function(m){return l.node(m).height}));e.forEach(p,function(m){l.node(m).y=h+d/2}),h+=d+c})}return Xg}var Qg,hE;function J4(){if(hE)return Qg;hE=1;var e=it(),n=P4(),r=O4(),i=q4(),o=hn().normalizeRanks,l=$4(),u=hn().removeEmptyRanks,c=D4(),h=F4(),p=z4(),d=X4(),m=Z4(),y=hn(),w=Jn().Graph;Qg=N;function N(U,J){var re=J&&J.debugTiming?y.time:y.notime;re("layout",function(){var le=re(" buildLayoutGraph",function(){return O(U)});re(" runLayout",function(){_(le,re)}),re(" updateInputGraph",function(){S(U,le)})})}function _(U,J){J(" makeSpaceForEdgeLabels",function(){P(U)}),J(" removeSelfEdges",function(){$(U)}),J(" acyclic",function(){n.run(U)}),J(" nestingGraph.run",function(){c.run(U)}),J(" rank",function(){i(y.asNonCompoundGraph(U))}),J(" injectEdgeLabelProxies",function(){F(U)}),J(" removeEmptyRanks",function(){u(U)}),J(" nestingGraph.cleanup",function(){c.cleanup(U)}),J(" normalizeRanks",function(){o(U)}),J(" assignRankMinMax",function(){Y(U)}),J(" removeEdgeLabelProxies",function(){q(U)}),J(" normalize.run",function(){r.run(U)}),J(" parentDummyChains",function(){l(U)}),J(" addBorderSegments",function(){h(U)}),J(" order",function(){d(U)}),J(" insertSelfEdges",function(){X(U)}),J(" adjustCoordinateSystem",function(){p.adjust(U)}),J(" position",function(){m(U)}),J(" positionSelfEdges",function(){I(U)}),J(" removeBorderNodes",function(){Z(U)}),J(" normalize.undo",function(){r.undo(U)}),J(" fixupEdgeLabelCoords",function(){z(U)}),J(" undoCoordinateSystem",function(){p.undo(U)}),J(" translateGraph",function(){R(U)}),J(" assignNodeIntersects",function(){Q(U)}),J(" reversePoints",function(){ne(U)}),J(" acyclic.undo",function(){n.undo(U)})}function S(U,J){e.forEach(U.nodes(),function(re){var le=U.node(re),fe=J.node(re);le&&(le.x=fe.x,le.y=fe.y,J.children(re).length&&(le.width=fe.width,le.height=fe.height))}),e.forEach(U.edges(),function(re){var le=U.edge(re),fe=J.edge(re);le.points=fe.points,e.has(fe,"x")&&(le.x=fe.x,le.y=fe.y)}),U.graph().width=J.graph().width,U.graph().height=J.graph().height}var b=["nodesep","edgesep","ranksep","marginx","marginy"],k={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},E=["acyclicer","ranker","rankdir","align"],C=["width","height"],A={width:0,height:0},M=["minlen","weight","width","height","labeloffset"],L={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},H=["labelpos"];function O(U){var J=new w({multigraph:!0,compound:!0}),re=G(U.graph());return J.setGraph(e.merge({},k,W(re,b),e.pick(re,E))),e.forEach(U.nodes(),function(le){var fe=G(U.node(le));J.setNode(le,e.defaults(W(fe,C),A)),J.setParent(le,U.parent(le))}),e.forEach(U.edges(),function(le){var fe=G(U.edge(le));J.setEdge(le,e.merge({},L,W(fe,M),e.pick(fe,H)))}),J}function P(U){var J=U.graph();J.ranksep/=2,e.forEach(U.edges(),function(re){var le=U.edge(re);le.minlen*=2,le.labelpos.toLowerCase()!=="c"&&(J.rankdir==="TB"||J.rankdir==="BT"?le.width+=le.labeloffset:le.height+=le.labeloffset)})}function F(U){e.forEach(U.edges(),function(J){var re=U.edge(J);if(re.width&&re.height){var le=U.node(J.v),fe=U.node(J.w),te={rank:(fe.rank-le.rank)/2+le.rank,e:J};y.addDummyNode(U,"edge-proxy",te,"_ep")}})}function Y(U){var J=0;e.forEach(U.nodes(),function(re){var le=U.node(re);le.borderTop&&(le.minRank=U.node(le.borderTop).rank,le.maxRank=U.node(le.borderBottom).rank,J=e.max(J,le.maxRank))}),U.graph().maxRank=J}function q(U){e.forEach(U.nodes(),function(J){var re=U.node(J);re.dummy==="edge-proxy"&&(U.edge(re.e).labelRank=re.rank,U.removeNode(J))})}function R(U){var J=Number.POSITIVE_INFINITY,re=0,le=Number.POSITIVE_INFINITY,fe=0,te=U.graph(),ce=te.marginx||0,Ce=te.marginy||0;function ve(Te){var ye=Te.x,ke=Te.y,Ge=Te.width,we=Te.height;J=Math.min(J,ye-Ge/2),re=Math.max(re,ye+Ge/2),le=Math.min(le,ke-we/2),fe=Math.max(fe,ke+we/2)}e.forEach(U.nodes(),function(Te){ve(U.node(Te))}),e.forEach(U.edges(),function(Te){var ye=U.edge(Te);e.has(ye,"x")&&ve(ye)}),J-=ce,le-=Ce,e.forEach(U.nodes(),function(Te){var ye=U.node(Te);ye.x-=J,ye.y-=le}),e.forEach(U.edges(),function(Te){var ye=U.edge(Te);e.forEach(ye.points,function(ke){ke.x-=J,ke.y-=le}),e.has(ye,"x")&&(ye.x-=J),e.has(ye,"y")&&(ye.y-=le)}),te.width=re-J+ce,te.height=fe-le+Ce}function Q(U){e.forEach(U.edges(),function(J){var re=U.edge(J),le=U.node(J.v),fe=U.node(J.w),te,ce;re.points?(te=re.points[0],ce=re.points[re.points.length-1]):(re.points=[],te=fe,ce=le),re.points.unshift(y.intersectRect(le,te)),re.points.push(y.intersectRect(fe,ce))})}function z(U){e.forEach(U.edges(),function(J){var re=U.edge(J);if(e.has(re,"x"))switch((re.labelpos==="l"||re.labelpos==="r")&&(re.width-=re.labeloffset),re.labelpos){case"l":re.x-=re.width/2+re.labeloffset;break;case"r":re.x+=re.width/2+re.labeloffset;break}})}function ne(U){e.forEach(U.edges(),function(J){var re=U.edge(J);re.reversed&&re.points.reverse()})}function Z(U){e.forEach(U.nodes(),function(J){if(U.children(J).length){var re=U.node(J),le=U.node(re.borderTop),fe=U.node(re.borderBottom),te=U.node(e.last(re.borderLeft)),ce=U.node(e.last(re.borderRight));re.width=Math.abs(ce.x-te.x),re.height=Math.abs(fe.y-le.y),re.x=te.x+re.width/2,re.y=le.y+re.height/2}}),e.forEach(U.nodes(),function(J){U.node(J).dummy==="border"&&U.removeNode(J)})}function $(U){e.forEach(U.edges(),function(J){if(J.v===J.w){var re=U.node(J.v);re.selfEdges||(re.selfEdges=[]),re.selfEdges.push({e:J,label:U.edge(J)}),U.removeEdge(J)}})}function X(U){var J=y.buildLayerMatrix(U);e.forEach(J,function(re){var le=0;e.forEach(re,function(fe,te){var ce=U.node(fe);ce.order=te+le,e.forEach(ce.selfEdges,function(Ce){y.addDummyNode(U,"selfedge",{width:Ce.label.width,height:Ce.label.height,rank:ce.rank,order:te+ ++le,e:Ce.e,label:Ce.label},"_se")}),delete ce.selfEdges})})}function I(U){e.forEach(U.nodes(),function(J){var re=U.node(J);if(re.dummy==="selfedge"){var le=U.node(re.e.v),fe=le.x+le.width/2,te=le.y,ce=re.x-fe,Ce=le.height/2;U.setEdge(re.e,re.label),U.removeNode(J),re.label.points=[{x:fe+2*ce/3,y:te-Ce},{x:fe+5*ce/6,y:te-Ce},{x:fe+ce,y:te},{x:fe+5*ce/6,y:te+Ce},{x:fe+2*ce/3,y:te+Ce}],re.label.x=re.x,re.label.y=re.y}})}function W(U,J){return e.mapValues(e.pick(U,J),Number)}function G(U){var J={};return e.forEach(U,function(re,le){J[le.toLowerCase()]=re}),J}return Qg}var Zg,pE;function eD(){if(pE)return Zg;pE=1;var e=it(),n=hn(),r=Jn().Graph;Zg={debugOrdering:i};function i(o){var l=n.buildLayerMatrix(o),u=new r({compound:!0,multigraph:!0}).setGraph({});return e.forEach(o.nodes(),function(c){u.setNode(c,{label:c}),u.setParent(c,"layer"+o.node(c).rank)}),e.forEach(o.edges(),function(c){u.setEdge(c.v,c.w,{},c.name)}),e.forEach(l,function(c,h){var p="layer"+h;u.setNode(p,{rank:"same"}),e.reduce(c,function(d,m){return u.setEdge(d,m,{style:"invis"}),m})}),u}return Zg}var Jg,mE;function tD(){return mE||(mE=1,Jg="0.8.5"),Jg}var ev,gE;function nD(){return gE||(gE=1,ev={graphlib:Jn(),layout:J4(),debug:eD(),util:{time:hn().time,notime:hn().notime},version:tD()}),ev}var rD=nD();const vE=jv(rD),go=240,xu=130,uo=74,Vu=72,yE=uo+Vu;function sD(e,n){var i;let r=go;for(const o of e)r=Math.max(r,((i=n.get(o.id))==null?void 0:i.width)??go);return r}const gj=420,iD=2;function Ra(e){var r;return((r=e.data)==null?void 0:r.sessionId)??"_default"}function oD(e,n){return((n==null?void 0:n.get(e))??0)>0?gj:0}function aD(e,n){const r=(n==null?void 0:n.get(e))??0;return r>0?6+r*36:0}function Ta(e,n,r){const i=n.get(e);return{w:((i==null?void 0:i.width)??go)+oD(e,r),h:Math.max((i==null?void 0:i.height)??xu,aD(e,r))}}function lD(e){return[...e.keys()].sort().map(n=>`${n}:${e.get(n)}`).join("|")}function uD(e,n,r,i,o,l){const u=new vE.graphlib.Graph;u.setDefaultEdgeLabel(()=>({})),u.setGraph({rankdir:r,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const c=e.filter(b=>!o.has(b)),h=new Set(c);for(const b of c){const{w:k,h:E}=Ta(b,i,l);u.setNode(b,{width:k,height:E})}for(const b of n)h.has(b.source)&&h.has(b.target)&&u.setEdge(b.source,b.target);vE.layout(u);const p=new Map;let d=1/0,m=1/0,y=-1/0,w=-1/0;for(const b of c){const k=u.node(b);if(!k)continue;const E=i.get(b),C=(E==null?void 0:E.width)??go,A=(E==null?void 0:E.height)??xu,M=Ta(b,i,l),L=k.x-M.w/2,H=k.y-M.h/2;p.set(b,{x:L,y:H}),L<d&&(d=L),H<m&&(m=H),L+C>y&&(y=L+C),H+A>w&&(w=H+A)}if(Number.isFinite(d)&&Number.isFinite(m))for(const[b,k]of p)p.set(b,{x:k.x-d,y:k.y-m});const N=Number.isFinite(y)?y-d:0,_=Number.isFinite(w)?w-m:0;let S=null;for(const b of e){const k=o.get(b);if(!k)continue;const E=i.get(b),C=(E==null?void 0:E.width)??go,A=(E==null?void 0:E.height)??xu;S=S===null?{minX:k.x,minY:k.y,maxX:k.x+C,maxY:k.y+A}:{minX:Math.min(S.minX,k.x),minY:Math.min(S.minY,k.y),maxX:Math.max(S.maxX,k.x+C),maxY:Math.max(S.maxY,k.y+A)}}return{positions:p,width:N,height:_,pinnedBox:S}}function cD(e,n,r={}){const i=r.direction??"LR",o=r.pinned??new Map,l=r.measured??new Map,u=r.lanes,c=new Map;for(const b of e){const k=Ra(b),E=c.get(k);E?E.push(b.id):c.set(k,[b.id])}const p=Array.from(c.keys()).sort().map(b=>({sid:b,...uD(c.get(b),n,i,l,o,u)})),d=sD(e,l),m=r.availableHeight&&r.availableHeight>0?r.availableHeight:Number.POSITIVE_INFINITY,y=b=>{const k=[[]];let E=0;for(const C of p)k.length<b&&E>0&&E+C.height>m&&(k.push([]),E=0),k[k.length-1].push(C),E+=C.height+yE;return k},w=b=>b.reduce((k,E)=>Math.max(k,E.width),0)+gj;let N=y(r.availableWidth?iD:1);N.length>1&&N.reduce((k,E)=>k+w(E),0)+d*(N.length-1)>(r.availableWidth??0)&&(N=y(1));const _=new Map;let S=0;for(const b of N){const k=w(b);let E=0;for(const{positions:C,height:A,pinnedBox:M}of b){for(const[H,O]of C)_.set(H,{x:O.x+S,y:O.y+E});let L=E+A;M&&M.maxY>L&&M.minX<S+k&&S<M.maxX&&(L=M.maxY),E=L+yE}S+=k+d}return e.map(b=>{const k=o.get(b.id);if(k)return{...b,position:k};const E=_.get(b.id);return E?{...b,position:E}:b})}function dD(e,n,r,i,o){const u=uo+Vu,c=60,h=w=>Ta(w,i,o),p=new Map(e.map(w=>[w.id,Ra(w)])),d=[],m=e.map(w=>({id:w.id,pos:r.get(w.id)??n.get(w.id)})).filter(w=>w.pos!=null).sort((w,N)=>w.pos.y-N.pos.y||w.pos.x-N.pos.x||w.id.localeCompare(N.id)),y=[];for(const{id:w,pos:N}of m){const{w:_,h:S}=h(w),b=p.get(w)??"_default";if(r.has(w)){d.push({x:N.x,y:N.y,w:_,h:S,sid:b});continue}let k=N.y;for(let E=0;E<d.length+1;E++){const C=d.find(A=>{const M=A.sid===b?24:c,L=A.sid===b?24:u;return N.x<A.x+A.w+M&&A.x<N.x+_+M&&k<A.y+A.h+L&&A.y<k+S+L});if(!C)break;k=C.y+C.h+(C.sid===b?24:u)}k!==N.y&&(n.set(w,{x:N.x,y:k}),y.push(w)),d.push({x:N.x,y:k,w:_,h:S,sid:b})}return y}function fD(e,n,r,i,o,l){const u=_=>Ta(_,i,l),c=_=>r.get(_)??n.get(_),h=new Map;for(const _ of e){if(!c(_.id))continue;const S=Ra(_),b=h.get(S);b?b.push(_):h.set(S,[_])}const p=new Set;for(const[_,S]of h)S.every(b=>o.has(b.id)&&!r.has(b.id))&&p.add(_);const d=new Map,m=[];for(const _ of e){const S=c(_.id);if(!S)continue;const{w:b,h:k}=u(_.id),E=Ra(_);p.has(E)?(d.get(E)??d.set(E,[]).get(E)).push(_):m.push({x:S.x,y:S.y,w:b,h:k})}if(d.size===0)return[];const y=uo+Vu,w=(_,S,b,k)=>m.some(E=>_<E.x+E.w+uo&&E.x<_+b+uo&&S<E.y+E.h+y&&E.y<S+k+y),N=[];for(const _ of[...d.keys()].sort()){const S=d.get(_);let b=1/0,k=1/0,E=-1/0,C=-1/0;for(const F of S){const Y=c(F.id),{w:q,h:R}=u(F.id);b=Math.min(b,Y.x),k=Math.min(k,Y.y),E=Math.max(E,Y.x+q),C=Math.max(C,Y.y+R)}const A=E-b,M=C-k,L=[...new Set(m.map(F=>Math.round(F.x)))].sort((F,Y)=>F-Y),H=L.length?L:[b],O=[0,...m.map(F=>F.y+F.h+y)].sort((F,Y)=>F-Y);let P=null;e:for(const F of H)for(const Y of O){if(Y>=k)break;if(!w(F,Y,A,M)){P={x:F,y:Y};break e}}if(P){const F=P.x-b,Y=P.y-k;for(const q of S){const R=c(q.id);n.set(q.id,{x:R.x+F,y:R.y+Y})}N.push(_)}for(const F of S){const Y=c(F.id),{w:q,h:R}=u(F.id);m.push({x:Y.x,y:Y.y,w:q,h:R})}}return N}function hD(e,n,r,i,o,l=!1,u){const p=uo+Vu+1,d=8,m=1.75,y=200,w=.7,N=.01,_=P=>Ta(P,i,u),S=P=>r.get(P)??n.get(P),b=new Map;for(const P of e){if(!S(P.id))continue;const F=Ra(P),Y=b.get(F);Y?Y.push(P):b.set(F,[P])}const k=[],E=new Set,C=new Set,A=o.size===0;for(const P of[...b.keys()].sort()){const F=b.get(P);let Y=1/0,q=1/0,R=-1/0,Q=-1/0,z=!1;for(const X of F){const I=S(X.id),{w:W,h:G}=_(X.id);Y=Math.min(Y,I.x),q=Math.min(q,I.y),R=Math.max(R,I.x+W),Q=Math.max(Q,I.y+G),r.has(X.id)&&(z=!0)}const ne=R-Y,Z=Q-q;C.add(P);const $=o.get(P);$&&(ne>$.w+d||Z>$.h+d)&&E.add(P),o.set(P,{w:ne,h:Z}),k.push({sid:P,members:F.map(X=>X.id),x:Y,y:q,w:ne,h:Z,anchored:z,mass:1})}for(const P of[...o.keys()])C.has(P)||o.delete(P);if(l||A)return[];let M=!1;for(let P=0;P<k.length&&!M;P++)for(let F=P+1;F<k.length;F++){const Y=k[P],q=k[F];if(!(Y.anchored&&q.anchored)&&Math.abs(Y.x+Y.w/2-(q.x+q.w/2))<(Y.w+q.w)/2+61&&Math.abs(Y.y+Y.h/2-(q.y+q.h/2))<(Y.h+q.h)/2+p){M=!0;break}}if(E.size===0&&!M)return[];if(E.size>0)for(const P of k)E.has(P.sid)&&(P.mass=8);else for(const P of k)P.mass=Math.max(1,P.w*P.h/(go*xu));const L=new Map(k.map(P=>[P.sid,P.x])),H=new Map(k.map(P=>[P.sid,P.y]));for(let P=0;P<y;P++){const F=new Map,Y=new Map;let q=0;for(let R=0;R<k.length;R++)for(let Q=R+1;Q<k.length;Q++){const z=k[R],ne=k[Q];if(z.anchored&&ne.anchored)continue;const Z=z.x+z.w/2,$=z.y+z.h/2,X=ne.x+ne.w/2,I=ne.y+ne.h/2,W=(z.w+ne.w)/2+61-Math.abs(Z-X),G=(z.h+ne.h)/2+p-Math.abs($-I);if(W<=0||G<=0)continue;const U=(De,Ze)=>!De.anchored&&!(Ze<0&&De.x<=0),J=(De,Ze)=>!De.anchored&&!(Ze<0&&De.y<=0),re=(De,Ze,Ye)=>{const vt=De===Ze,ot=vt?z.sid<ne.sid?-1:1:Math.sign(De-Ze);return Ye(z,ot)||Ye(ne,-ot)?ot:vt&&(Ye(z,-ot)||Ye(ne,ot))?-ot:0},le=re(Z,X,U),fe=re($,I,J),te=le!==0,ce=fe!==0;if(!te&&!ce)continue;const Ce=te&&(!ce||W*m<G),[ve,Te,ye,ke]=Ce?[le,W,F,U]:[fe,G,Y,J],Ge=ke(z,ve),we=ke(ne,-ve),_e=z.mass,ze=ne.mass,ft=Ge?we?ze/(_e+ze):1:0,ht=we?Ge?_e/(_e+ze):1:0,Ue=Te*w;ye.set(z.sid,(ye.get(z.sid)??0)+ve*Ue*ft),ye.set(ne.sid,(ye.get(ne.sid)??0)-ve*Ue*ht),q+=Ue}for(const R of k)R.anchored||(R.x=Math.max(0,R.x+(F.get(R.sid)??0)),R.y=Math.max(0,R.y+(Y.get(R.sid)??0)));if(q<N)break}const O=[];for(const P of k){const F=P.x-L.get(P.sid),Y=P.y-H.get(P.sid);if(!(Math.abs(F)<1&&Math.abs(Y)<1)){for(const q of P.members){if(r.has(q))continue;const R=n.get(q);R&&n.set(q,{x:R.x+F,y:R.y+Y})}O.push(P.sid)}}return O}const pD=600;function kv(e,n){return!(e.exitAt!=null&&n-e.exitAt>pD||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function mD(e,n){const r=new Set;for(const i of e.agents.values())kv(i,n)&&r.add(i.id);return r}function gD(e,n,r=0){return e.right+r>n.left&&e.left-r<n.right&&e.bottom+r>n.top&&e.top-r<n.bottom}function vD(e,n,r=0){if(!e)return!1;for(const i of n)if(gD(e,i,r))return!0;return!1}const vj="sessionGroup";function yD(e,n){var i;if(e.type===vj)return"transparent";const r=(i=e.data)==null?void 0:i.state;return n(r==="err"?"--err":r==="active"?"--inflight":"--ok")}const wD="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1).";function xD(e){if(e.checkDisabled)return wD;if(e.checking)return"Asking npm for the newest release…";const n=e.latest?`npm has v${e.latest}`:e.latestPending?`npm's latest tag names v${e.latestPending}, which it cannot serve yet`:"npm not reached yet",r=e.checkedAgo?` · checked ${e.checkedAgo}`:"";return`${n}${r} · re-checked periodically · click to check npm now`}function _D(e){const n=`Version v${e.running}`;return e.checkDisabled?`${n}, update checks are off`:e.checking?`${n}, checking npm for a newer release`:`${n}, check npm for a newer release`}function bD(e){if(e==null)return{kind:"unknown",lead:"No data yet. Start a Claude Code or Codex session — it appears here as soon as its first hook fires.",workspace:null,tail:""};const n=e.trim();return n===""?{kind:"machine",lead:"No data yet. Start a Claude Code or Codex session anywhere on this machine — this deck is unscoped and captures every workspace.",workspace:null,tail:""}:{kind:"scoped",lead:"No data yet. This deck only captures sessions running under",workspace:n,tail:" — start one there, or restart it without --workspace/--scope to watch the whole machine."}}function yj(e){const n=Math.max(0,Math.floor(e));return`${n} event${n===1?"":"s"}`}function SD(e){return e.connected?e.paused?{tone:"paused",label:"paused",title:e.held>0?`Connected — ${yj(e.held)} held until you resume (Space)`:"Connected — updates held until you resume (Space)"}:{tone:"live",label:"live",title:"Receiving events"}:{tone:"dead",label:"offline",title:e.paused?"SSE disconnected — and the canvas is paused, so resuming will not bring events back until it reconnects":"SSE disconnected"}}function kD(e){return e.paused?e.held<=0?{label:"Resume",title:"Nothing has arrived since you paused. Resume to follow the canvas again (Space)"}:{label:`Resume · ${e.held} held`,title:`${yj(e.held)} arrived while paused and will be applied in order when you resume (Space)`}:{label:"Pause",title:"Pause live updates — events keep arriving and are applied when you resume (Space)"}}function wj(e,n){return e!==""&&n>0}function ED(e,n,r){return e===""?{active:!1,matched:n,total:r,count:null,empty:!1,message:null,dim:!1}:{active:!0,matched:n,total:r,count:`${n} of ${r}`,empty:n===0,message:n===0?`No agents match “${e}”`:null,dim:wj(e,n)}}function Ev(e){const n=Math.max(0,Math.floor(e/1e3));return n<60?"just now":n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}function ND(e,n){return e.getFullYear()===n.getFullYear()&&e.getMonth()===n.getMonth()&&e.getDate()===n.getDate()}function CD(e,n,r){const i=new Date(e),o=Ev(n-e);return{label:ND(i,new Date(n))?o:`${o} · ${i.toLocaleDateString(r,{month:"short",day:"numeric"})}`,title:i.toLocaleString(r,{dateStyle:"medium",timeStyle:"medium"})}}function pa(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const jD={agent:NO,sessionGroup:FO},RD=420,nu=18,TD=9e4,AD=200,ID=5*6e4,MD=6,PD=2*6e4,fy="agent-dag.layout",hy="agent-dag.viewport",xj="agent-dag.summariesDismissed",_j="agent-dag.sessionListOpen",bj="agent-dag.detailOpen",Sj="agent-dag.usagePanelOpen",wE="agent-dag.accountsPanelOpen",xE="agent-dag.versionNoticeDismissed",_E="agent-dag.oldNameNoticeDismissed",OD=15*6e4,bE={git_checkout:"this deck runs from a git checkout — pull instead:",npx:"npx runs from a cache that cannot be upgraded in place — run:",not_writable:"the install directory is not writable by this user — run:",opted_out:"installs are off (AGENTS_DECK_NO_INSTALL=1) — run:"},SE="agent-dag.autoRestart",kE="agent-dag.bundleReloadedFor";function LD(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(_j)==="1"}catch{return!1}}function qD(e){if(!(typeof window>"u"))try{window.localStorage.setItem(_j,e?"1":"0")}catch{}}function $D(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(bj)==="1"}catch{return!1}}function DD(e){if(!(typeof window>"u"))try{window.localStorage.setItem(bj,e?"1":"0")}catch{}}function FD(){const e=mC(Sj);return e===null?!0:e==="1"}function zD(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Sj,e?"1":"0")}catch{}}function BD(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(xj);if(!e)return new Set;const n=JSON.parse(e);return new Set(Array.isArray(n)?n.filter(r=>typeof r=="string"):[])}catch{return new Set}}function EE(e){if(!(typeof window>"u"))try{const n=Array.from(e),r=n.length>200?n.slice(-200):n;window.localStorage.setItem(xj,JSON.stringify(r))}catch{}}function UD(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const n=window.localStorage.getItem(fy);if(!n)return e;const r=JSON.parse(n);if(!("v"in r)){const o=Object.entries(r).filter(([,l])=>l&&typeof l.x=="number"&&typeof l.y=="number");return{positions:o,pins:o.map(([l])=>l)}}return{positions:Object.entries(r.positions??{}).filter(([,o])=>o&&typeof o.x=="number"&&typeof o.y=="number"),pins:Array.isArray(r.pins)?r.pins:[]}}catch{return e}}function tv(e,n){if(!(typeof window>"u"))try{const r={};for(const[i,o]of e)r[i]=o;for(const[i,o]of n)r[i]=o;window.localStorage.setItem(fy,JSON.stringify({v:2,positions:r,pins:Array.from(n.keys())}))}catch{}}function HD(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(hy);if(!e)return null;const n=JSON.parse(e);return typeof(n==null?void 0:n.x)!="number"||typeof(n==null?void 0:n.y)!="number"||typeof(n==null?void 0:n.zoom)!="number"?null:n}catch{return null}}function WD(e){if(!(typeof window>"u"))try{window.localStorage.setItem(hy,JSON.stringify(e))}catch{}}function NE(){if(!(typeof window>"u")){try{window.localStorage.removeItem(fy)}catch{}try{window.localStorage.removeItem(hy)}catch{}}}function VD(e,n){const r=e.agents.get(n);if(!r)return;const i=[];for(const d of e.agents.values())d.sessionId===n&&i.push(d);const o={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:n,label:r.label,cwd:r.cwd,startedAt:r.startedAt,endedAt:r.endedAt,model:r.model,agents:i.map(d=>({id:d.id,kind:d.kind,label:d.label,parentId:d.parentId,state:d.state,startedAt:d.startedAt,endedAt:d.endedAt,model:d.model,cwd:d.cwd,usage:d.usage,prompts:d.prompts,tools:d.tools.map(m=>({id:m.id,name:m.name,inputPreview:m.inputPreview,startedAt:m.startedAt,endedAt:m.endedAt,ok:m.ok,errorPreview:m.errorPreview,usage:m.usage}))}))},l=JSON.stringify(o,null,2),u=new Blob([l],{type:"application/json"}),c=URL.createObjectURL(u),h=document.createElement("a"),p=(r.label||"session").replace(/[^a-z0-9._-]/gi,"_");h.href=c,h.download=`${zt}-${p}-${n.slice(0,8)}.json`,document.body.appendChild(h),h.click(),document.body.removeChild(h),setTimeout(()=>URL.revokeObjectURL(c),1e3)}const Nv={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},Cv={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},GD={Read:"file",Write:"file",Edit:"file",MultiEdit:"file",Glob:"file",Grep:"file",LS:"file",NotebookEdit:"file",Bash:"shell",PowerShell:"shell",shell:"shell",exec_command:"shell",shell_command:"shell",write_stdin:"shell",wait:"shell",apply_patch:"file",update_plan:"task",WebFetch:"web",WebSearch:"web",Task:"agent",Agent:"agent",TodoWrite:"task",TaskCreate:"task",TaskUpdate:"task",TaskList:"task",TaskGet:"task",TaskOutput:"task",TaskStop:"task",EnterPlanMode:"plan",ExitPlanMode:"plan",AskUserQuestion:"plan",Skill:"plan",Workflow:"plan"};function kj(e){return e.startsWith("mcp__")?"mcp":GD[e]??"other"}function Ej(e,n){var i,o,l;if(!n)return!0;const r=n.toLowerCase();if(e.label.toLowerCase().includes(r)||(i=e.cwd)!=null&&i.toLowerCase().includes(r)||(o=e.cwdBasename)!=null&&o.toLowerCase().includes(r)||e.sessionId.toLowerCase().includes(r)||(l=e.firstPrompt)!=null&&l.toLowerCase().includes(r))return!0;for(const u of e.tools)if(u.name.toLowerCase().includes(r))return!0;return!1}function YD(e,n){if(!n)return null;const r=new Set([n]);let i=n;for(;i;){const l=e.agents.get(i);if(!(l!=null&&l.parentId)||r.has(l.parentId))break;r.add(l.parentId),i=l.parentId}let o=!0;for(;o;){o=!1;for(const l of e.agents.values())l.parentId&&r.has(l.parentId)&&!r.has(l.id)&&(r.add(l.id),o=!0)}return r}function KD(e,n,r,i,o,l,u,c,h,p,d,m,y,w,N,_,S,b,k){const E=[],C=[],A=new Set;if(l)for(const q of e.agents.values())b.has(q.id)&&Ej(q,l)&&A.add(q.id);const M=wj(l,A.size);for(const q of e.agents.values()){if(!b.has(q.id))continue;const R=M&&!A.has(q.id),Q=q.exitAt!=null,z=S!=null&&!S.has(q.id),ne=[R?"rf-dim":"",Q?"rf-exiting":"",z?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,Z=u.get(q.id);if(E.push({id:q.id,type:"agent",position:{x:0,y:0},data:{...q,now:n,onOpenContext:k},className:ne,...Z?{width:Z.width,height:Z.height}:null}),q.parentId&&b.has(q.parentId)){const $=Vv(q.sessionId),X=l&&!A.has(q.id)&&!A.has(q.parentId),I=Q,W=_.size>0&&(_.has(q.id)||_.has(q.parentId)),G=S!=null&&!S.has(q.id)&&!S.has(q.parentId),U=q.state==="active"?2:1.5,J=W?U+1.5:U,re=X||I?.2:G?.12:1,le=["sess-edge",q.state==="active"?"sess-live":"sess-idle",I?"rf-edge-exiting":"",W?"rf-edge-selected":""].filter(Boolean).join(" ");C.push({id:`e:${q.parentId}->${q.id}`,source:q.parentId,target:q.id,animated:(q.state==="active"||W)&&!X&&!I,type:"smoothstep",style:{"--session-hue":$,strokeWidth:J,opacity:re,transition:"opacity 500ms ease, stroke-width 200ms ease"},className:le})}}const L=new Map;for(const q of e.agents.values())q.tools.length>0&&L.set(q.id,Math.min(4,q.tools.length));const H=`${w}#lanes:${lD(L)}`,O=E.filter(q=>bL(q.id,o,m,y));if(O.length>0||H!==N.current){if(O.length>0){const q=cD(E,C,{direction:"LR",pinned:o,measured:u,availableWidth:r,availableHeight:i,lanes:L});for(const R of q)pC(R.id,m,y)&&kL(R.id,R.position,m,y);fD(E,m,o,u,new Set(O.map(R=>R.id)),L)}dD(E,m,o,u,L),N.current=H}const P=hD(E,m,o,u,c,!p||d,L);P.length>0&&h(P),Zl(m,e.agents),Zl(y,e.agents),Zl(o,e.agents),Zl(u,_L(e.agents.values()));const F=[];let Y=!1;for(const q of E){let R=o.get(q.id)??m.get(q.id);R||(R=SL(q.id,m,y),Y=!0),F.push({...q,position:R})}return Y&&(N.current=""),{nodes:F,edges:C}}function XD(){return g.jsx(Wv,{children:g.jsx(QD,{})})}function QD(){var Fs,Po,Ua,Ha;const e=Oa(),n=T.useRef(yv()),[,r]=T.useState(0),i=T.useCallback(()=>r(B=>B+1),[]),[o,l]=T.useState(()=>new Set),[u,c]=T.useState(null),[h,p]=T.useState(null),d=T.useCallback((B,V)=>{l(oe=>{if(!V)return new Set([B]);const de=new Set(oe);return de.has(B)?de.delete(B):de.add(B),de}),c(oe=>V&&oe===B?oe:B)},[]),m=T.useCallback(()=>{l(new Set),c(null)},[]),[y,w]=T.useState(null),[N,_]=T.useState(null),S=T.useCallback(B=>_(B),[]),[b,k]=T.useState(!1),E=T.useRef(BD()),[C,A]=T.useState(LD);T.useEffect(()=>{qD(C)},[C]);const[M,L]=T.useState($D);T.useEffect(()=>{DD(M)},[M]);const[H,O]=T.useState(FD);T.useEffect(()=>{zD(H)},[H]);const[P,F]=T.useState(()=>{try{const B=window.localStorage.getItem(wE);return B===null?!0:B==="1"}catch{return!0}});T.useEffect(()=>{try{window.localStorage.setItem(wE,P?"1":"0")}catch{}},[P]);const[Y,q]=T.useState(null),[R,Q]=T.useState(!1),[z,ne]=T.useState(0),[Z,$]=T.useState(0);T.useEffect(()=>{fetch("/api/sound-hook").then(B=>B.ok?B.json():null).then(B=>{B!=null&&B.ok&&(q(B.enabled===!0),ne((B.foreign??[]).filter(V=>V.worksHere).length),$(typeof B.parked=="number"?B.parked:0))}).catch(()=>{})},[]);const X=T.useCallback(async()=>{Q(!0);try{const V=await(await fetch("/api/sound-hook",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:!Y})})).json().catch(()=>null);V!=null&&V.ok&&q(V.enabled===!0),fetch("/api/sound-hook").then(oe=>oe.ok?oe.json():null).then(oe=>{oe!=null&&oe.ok&&(ne((oe.foreign??[]).filter(de=>de.worksHere).length),$(typeof oe.parked=="number"?oe.parked:0))}).catch(()=>{})}catch{}finally{Q(!1)}},[Y]),[I,W]=T.useState(!1),[G,U]=T.useState(null),[J,re]=T.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(xE)??""}catch{return""}}),[le,fe]=T.useState(!1),te=T.useRef(0),[ce,Ce]=T.useState(!1),ve=T.useCallback((B=!1)=>{B&&(te.current=Date.now(),Ce(!0)),fetch(B?"/api/version?refresh=1":"/api/version").then(V=>V.ok?V.json():null).then(V=>{V&&U(V)}).catch(()=>{}).finally(()=>{B&&Ce(!1)})},[]),Te=T.useCallback(()=>{ve(Date.now()-te.current>=OD)},[ve]);T.useEffect(()=>{ve();const B=window.setInterval(Te,5*6e4),V=()=>{document.visibilityState==="visible"&&Te()};return document.addEventListener("visibilitychange",V),()=>{window.clearInterval(B),document.removeEventListener("visibilitychange",V)}},[ve,Te]),T.useEffect(()=>{I&&ve()},[I,ve]);const ye=(G==null?void 0:G.notice)??null,[ke,Ge]=T.useState(null);T.useEffect(()=>{let B=!1;return fetch("/api/health").then(V=>V.ok?V.json():null).then(V=>{B||!V||typeof V.workspace!="string"||Ge(V.workspace)}).catch(()=>{}),()=>{B=!0}},[I]);const we=ye?`${ye.kind}:${ye.to}`:"",_e=ye!=null&&J!==we,ze=T.useCallback(()=>{if(!ye)return;const B=J===we?"":we;re(B);try{window.localStorage.setItem(xE,B)}catch{}},[ye,we,J]),[ft,ht]=T.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(_E)??""}catch{return""}}),Ue=G!=null&&G.invokedAs&&G.invokedAs!==zt?G.invokedAs:null,De=Ue!=null&&ft!==Ue,Ze=T.useCallback(()=>{if(Ue){ht(Ue);try{window.localStorage.setItem(_E,Ue)}catch{}}},[Ue]),Ye=((Fs=G==null?void 0:G.upgrade)==null?void 0:Fs.state)??"idle",vt=dL(G==null?void 0:G.upgrade),ot=T.useCallback(async()=>{try{await fetch("/api/upgrade",{method:"POST"})}catch{}ve()},[ve]);T.useEffect(()=>{if(Ye!=="running")return;const B=window.setInterval(ve,3e3);return()=>window.clearInterval(B)},[Ye,ve]);const yt=T.useCallback(async()=>{var oe;const B=G==null?void 0:G.command;if(!B)return;let V=!1;try{V=await Promise.race([((oe=navigator.clipboard)==null?void 0:oe.writeText(B).then(()=>!0))??Promise.resolve(!1),new Promise(de=>window.setTimeout(()=>de(!1),500))])}catch{V=!1}if(!V)try{const de=document.createElement("textarea");de.value=B,de.setAttribute("readonly",""),de.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(de),de.select(),V=document.execCommand("copy"),de.remove()}catch{V=!1}V&&(fe(!0),window.setTimeout(()=>fe(!1),1600))},[G==null?void 0:G.command]),Kt=T.useCallback(()=>{A(B=>(B||F(!1),!B))},[]),Mt=T.useCallback(()=>{F(B=>(B||A(!1),!B))},[]),[Xe,wt]=T.useState(!1),[pt,mt]=T.useState(0),_n=T.useRef(null),[Xt,Pt]=T.useState(!1),Qt=T.useRef(null),[yr,bn]=T.useState(0),Zt=T.useRef(jL()),[pn,Sn]=T.useState(!1),Gr=T.useCallback(()=>{const B=Zt.current,V=B.setPaused(!B.paused);for(const oe of V)n.current=Cx(n.current,oe);Sn(B.paused)},[]),[ut,hi]=T.useState(Date.now()),[nr,Es]=T.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(SE)!=="0"}catch{return!0}}),pi=T.useCallback(()=>{Es(B=>{const V=!B;try{window.localStorage.setItem(SE,V?"1":"0")}catch{}return V})},[]),[Jt,rr]=T.useState(!1),[wr,So]=T.useState("restart"),[sr,xr]=T.useState(null),mn=T.useRef(!1),Yr=T.useRef(null),mi=T.useRef(0),Kr=T.useCallback(async B=>{if(mn.current)return;const V=(B==null?void 0:B.upgrade)===!0;mn.current=!0,Yr.current=vt;const oe=++mi.current;So(V?"npx":"restart"),rr(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(ye==null?void 0:ye.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:V})})}catch{}window.setTimeout(()=>{if(mi.current===oe&&mn.current){mn.current=!1,rr(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},V?18e4:3e4)},[ye==null?void 0:ye.to,vt]),Ns=T.useRef(null);T.useEffect(()=>{let B=!1;for(const oe of n.current.agents.values())if(oe.state==="active"){B=!0;break}const V=hL({enabled:nr,kind:ye==null?void 0:ye.kind,canRestart:(G==null?void 0:G.canRestart)===!0,busy:B,idleSince:Ns.current,now:ut});Ns.current=V.idleSince,V.restart&&Kr()},[nr,ye==null?void 0:ye.kind,G==null?void 0:G.canRestart,ut,Kr]),T.useEffect(()=>{const B=G==null?void 0:G.running;let V=null,oe=null;try{V=window.sessionStorage.getItem("agent-dag.restartPending"),oe=window.sessionStorage.getItem(kE)}catch{return}const de=cL({bundle:"1.33.148",running:B,pending:V,lastTried:oe});if(de==="reload"){try{window.sessionStorage.setItem(kE,B??"")}catch{return}window.location.reload();return}if(de!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}mn.current=!1,rr(!1),xr(B??null);const xe=window.setTimeout(()=>xr(null),6e3);return()=>window.clearTimeout(xe)},[G==null?void 0:G.running]),T.useEffect(()=>{if(Jt&&fL({asked:Yr.current,reported:vt})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}mn.current=!1,rr(!1)}},[Jt,vt]);const gn=T.useRef(UD()).current;T.useRef(!1);const jt=T.useRef(new Map(gn.positions.filter(([B])=>gn.pins.includes(B)))),_r=T.useRef(null),Xr=T.useState(()=>HD())[0],[en,Qr]=T.useState(""),[Cs,gi]=T.useState(()=>new Set),[ir,vi]=T.useState(ML),[Je,ko]=T.useState(!1),br=T.useRef(null);T.useEffect(()=>{document.documentElement.dataset.theme=ir;try{window.localStorage.setItem(gC,ir)}catch{}},[ir]),T.useEffect(()=>{if(!Xr)return;const B=window.setTimeout(()=>{try{e.setViewport(Xr,{duration:0})}catch{}},60);return()=>window.clearTimeout(B)},[e,Xr]);const js=T.useRef(!0);T.useEffect(()=>{const B=new EventSource("/events"),V=CL(i,{now:()=>Date.now(),setTimeout:(oe,de)=>window.setTimeout(oe,de),clearTimeout:oe=>window.clearTimeout(oe)});return B.addEventListener("open",()=>{W(!0),ko(!0)}),B.addEventListener("error",()=>W(!1)),B.addEventListener("replay-end",()=>{js.current=!1,V.flush()}),B.addEventListener("hook",oe=>{try{const de=JSON.parse(oe.data);if(!Zt.current.accept(de))return;n.current=Cx(n.current,de),de.replay===!0||js.current||Date.now()-de.receivedAt>3e4?V.replay():V.live()}catch{}}),()=>{B.close(),V.cancel()}},[i]),T.useEffect(()=>{const B=setInterval(()=>{const V=Date.now();hi(V);let oe=eO(n.current,V,TD);nO(n.current,V,tO)&&(oe=!0),ZP(n.current,V,AD,ID)&&(oe=!0),JP(n.current,V,MD,PD)&&(oe=!0),oe&&i()},250);return()=>clearInterval(B)},[i]);const or=T.useRef(null),$n=T.useRef(0),yi=420,Ot=T.useCallback((B=500)=>{try{const Ne=document.querySelector(".canvas-wrap"),Ie=Array.from(document.querySelectorAll(".react-flow__node")).filter(xt=>xt.offsetWidth>0);if(!Ne||Ie.length===0)return;const Le=Ne.getBoundingClientRect(),Ve=e.getViewport();if(!Number.isFinite(Ve.zoom)||Ve.zoom<=0)return;const Qe=xt=>(xt-Le.left-Ve.x)/Ve.zoom,rt=xt=>(xt-Le.top-Ve.y)/Ve.zoom,Nn=Ie.map(xt=>xt.getBoundingClientRect()),Ar=Math.min(...Nn.map(xt=>Qe(xt.left))),Oo=Math.max(...Nn.map(xt=>Qe(xt.right))),zs=Math.min(...Nn.map(xt=>rt(xt.top))),Lo=Math.max(...Nn.map(xt=>rt(xt.bottom))),qo=Oo-Ar,Ti=Lo-zs;if(!(qo>0&&Ti>0))return;const Bn=Math.max(.2,Math.min(1,(Le.width-160)/(qo+yi)*.86,(Le.height-160)/Ti*.86));e.setViewport({x:80-Ar*Bn,y:Math.max(80,(Le.height-Ti*Bn)/2)-zs*Bn,zoom:Bn},{duration:B}),$n.current=Date.now(),window.setTimeout(()=>{try{const xt={x:80-Ar*Bn,y:Math.max(80,(Le.height-Ti*Bn)/2)-zs*Bn,zoom:Bn},Wa=e.getViewport();(Math.abs(Wa.zoom-Bn)>.01||Math.abs(Wa.x-xt.x)>2)&&e.setViewport(xt,{duration:0})}catch{}},B+60)}catch{}},[e]),Ut=T.useRef(""),Sr=T.useRef(null),rn=T.useRef(0),wi=T.useCallback(()=>{rn.current=Date.now()},[]),Eo="agent-dag.autoFitDisabled",kr=T.useRef((()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(Eo)==="1"}catch{return!1}})()),[Rs,Ts]=T.useState(kr.current),Zr=T.useCallback(()=>{if(!kr.current){kr.current=!0,Ts(!0);try{window.localStorage.setItem(Eo,"1")}catch{}}},[]),xi=T.useCallback(()=>{kr.current=!1,Ts(!1);try{window.localStorage.removeItem(Eo)}catch{}Ot(400)},[e,Ot]);T.useEffect(()=>{const B=setInterval(()=>{if(kr.current||Date.now()-rn.current<800)return;const V=n.current,oe=Date.now(),de=[];for(const Qe of V.agents.values())kv(Qe,oe)&&de.push({id:Qe.id});if(de.length===0)return;const xe=e.getViewport(),Ne=window.innerWidth-360,Ie=window.innerHeight-52;let Le=!1,Ve=!1;for(const{id:Qe}of de){const rt=Jr.current.get(Qe),Nn=jt.current.get(Qe)??Ht.current.get(Qe);if(!rt||!Nn)continue;Ve=!0;const Ar=Nn.x*xe.zoom+xe.x,Oo=Nn.y*xe.zoom+xe.y,zs=(Nn.x+rt.width)*xe.zoom+xe.x,Lo=(Nn.y+rt.height)*xe.zoom+xe.y;if(zs>0&&Ar<Ne&&Lo>0&&Oo<Ie){Le=!0;break}}Ve&&!Le&&Ot(600)},1500);return()=>clearInterval(B)},[e]);const No=T.useRef(!1),Jr=T.useRef(new Map),_i=T.useRef(0),Ba=T.useCallback(B=>{const V=Jr.current;let oe=!1;for(const de of B.nodeInternals.values()){const xe=de.width,Ne=de.height;if(xe==null||Ne==null)continue;const Ie=V.get(de.id);Ie?(Math.abs(Ie.height-Ne)>4||Math.abs(Ie.width-xe)>4)&&(V.set(de.id,{width:xe,height:Ne}),oe=!0):(V.set(de.id,{width:xe,height:Ne}),oe=!0)}return oe&&(_i.current+=1),_i.current},[]),bi=Ke(Ba),[es,Gu]=T.useState(0);T.useEffect(()=>{let B=0;const V=()=>{const de=Jr.current;let xe=!1;for(const Ne of document.querySelectorAll(".react-flow__node[data-id]")){const Ie=Ne.getAttribute("data-id");if(!Ie)continue;const Le=Ne.offsetWidth,Ve=Ne.offsetHeight;if(!Le||!Ve)continue;const Qe=de.get(Ie);(!Qe||Math.abs(Qe.width-Le)>4||Math.abs(Qe.height-Ve)>4)&&(de.set(Ie,{width:Le,height:Ve}),xe=!0)}xe&&Gu(Ne=>Ne+1)};if(No.current)return;let oe=0;return document.visibilityState==="hidden"?oe=window.setTimeout(V,32):B=requestAnimationFrame(V),()=>{cancelAnimationFrame(B),window.clearTimeout(oe)}});const Ht=T.useRef(new Map(gn.positions)),We=T.useRef(new Set),Si=T.useRef(""),Er=T.useMemo(()=>{const B=[];for(const V of n.current.agents.values())kv(V,ut)&&B.push(V.id+(V.parentId?`>${V.parentId}`:""));return B.sort(),`${B.join("|")}#sv${bi}.${es}`},[n.current,n.current.lastSeq,ut,bi,es]),Nr=T.useRef(null);T.useEffect(()=>(Nr.current!=null&&window.clearTimeout(Nr.current),Nr.current=window.setTimeout(()=>{tv(Ht.current,jt.current)},1500),()=>{Nr.current!=null&&window.clearTimeout(Nr.current)}),[Er]),T.useEffect(()=>{if(Ut.current===Er)return;const B=Ut.current;if(Ut.current=Er,!B||kr.current)return;Date.now()-$n.current>1200&&Ot(400),or.current&&window.clearTimeout(or.current),or.current=window.setTimeout(()=>{kr.current||Ot(500)},280)},[Er,e,Ot]);const ki=T.useMemo(()=>{if(o.size===0)return null;const B=new Set;for(const V of o){const oe=YD(n.current,V);if(oe)for(const de of oe)B.add(de)}return B.size>0?B:null},[n.current,n.current.lastSeq,o]),ar=T.useMemo(()=>mD(n.current,ut),[n.current,n.current.lastSeq,ut]),Co=T.useRef(null),[ts,As]=T.useState({w:0,h:0});T.useEffect(()=>{const B=Co.current;if(!B||typeof ResizeObserver>"u")return;const V=new ResizeObserver(oe=>{var xe;const de=(xe=oe[0])==null?void 0:xe.contentRect;de&&As(Ne=>Math.abs(Ne.w-de.width)>40||Math.abs(Ne.h-de.height)>40?{w:de.width,h:de.height}:Ne)});return V.observe(B),As({w:B.clientWidth,h:B.clientHeight}),()=>V.disconnect()},[]);const lr=T.useRef(new Map),[Dn,ur]=T.useState(!1);T.useEffect(()=>{const B=window.setTimeout(()=>ur(!0),2500);return()=>window.clearTimeout(B)},[]);const[Is,Cr]=T.useState(!1),Lt=T.useRef(null),[jo,Ro]=T.useState(!1),Ms=T.useCallback(()=>{Lt.current&&(window.clearTimeout(Lt.current),Lt.current=null),Cr(!1)},[]),Yu=T.useCallback(B=>{B.length!==0&&queueMicrotask(()=>{Cr(!0),Lt.current&&window.clearTimeout(Lt.current),Lt.current=window.setTimeout(()=>Cr(!1),RD+80)})},[]);T.useEffect(()=>()=>{Lt.current&&window.clearTimeout(Lt.current)},[]);const To=ts.w>0?ts.w*.92:0,Ps=ts.h>0?ts.h:0,{nodes:Fn,edges:Ku}=T.useMemo(()=>KD(n.current,ut,To,Ps,jt.current,en,Jr.current,lr.current,Yu,Dn,jo,Ht.current,We.current,Er,Si,o,ki,ar,S),[n.current,n.current.lastSeq,ut,To,Ps,Dn,jo,en,Er,o,ki,ar,S,pt]),ns=T.useMemo(()=>{const B=new Map;for(const oe of Fn){const de=oe.data;if(!(de!=null&&de.sessionId)||de.exitAt!=null)continue;const xe=oe.width,Ne=oe.height;if(xe==null||Ne==null)continue;const Ie=oe.position.x,Le=oe.position.y,Ve=Ie+xe,Qe=Le+Ne,rt=B.get(de.sessionId);rt?(rt.minX=Math.min(rt.minX,Ie),rt.minY=Math.min(rt.minY,Le),rt.maxX=Math.max(rt.maxX,Ve),rt.maxY=Math.max(rt.maxY,Qe)):B.set(de.sessionId,{minX:Ie,minY:Le,maxX:Ve,maxY:Qe})}const V=[];for(const[oe,de]of B){const xe=de.maxX-de.minX+nu*2,Ne=de.maxY-de.minY+nu*2;V.push({id:`group:${oe}`,type:vj,position:{x:de.minX-nu,y:de.minY-nu},data:{sessionId:oe,w:xe,h:Ne},width:xe,height:Ne,style:{width:xe,height:Ne},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return V},[Fn,ut]),Os=T.useMemo(()=>{const B=[...ns,...Fn],V=Qt.current;return!V||V.size===0?B:B.map(oe=>{const de=V.get(oe.id);return de?{...oe,position:de}:oe})},[ns,Fn,yr]),kn=T.useMemo(()=>{if(!en)return null;const B=new Set;for(const V of n.current.agents.values())ar.has(V.id)&&Ej(V,en)&&B.add(V.id);return B},[n.current,n.current.lastSeq,en,ar]),En=T.useMemo(()=>ED(en,(kn==null?void 0:kn.size)??0,ar.size),[en,kn,ar]),Ei=T.useMemo(()=>{const B=new Set;for(const V of n.current.agents.values())for(const oe of V.tools)B.add(kj(oe.name));return Object.keys(Nv).filter(V=>B.has(V))},[n.current,n.current.lastSeq]);T.useEffect(()=>{if(Ei.length<=1){Pt(!1);return}let B=0;const V=()=>{const oe=_n.current;if(oe&&!document.hidden){const de=oe.getBoundingClientRect(),xe=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Ie=>Ie.getBoundingClientRect()),Ne=vD(de,xe,8);Pt(Ie=>Ie===Ne?Ie:Ne)}B=window.setTimeout(V,300)};return V(),()=>window.clearTimeout(B)},[Ei.length]);const Ls=T.useMemo(()=>{const B=new Map;for(const oe of n.current.agents.values())for(const de of oe.tools){if(!de.name.startsWith("mcp__"))continue;const xe=de.name.slice(5),Ne=xe.indexOf("__"),Ie=Ne>0?xe.slice(0,Ne):xe;B.set(Ie,(B.get(Ie)??0)+1)}const V=[];for(const[oe,de]of B){let xe=5381;for(let Ne=0;Ne<oe.length;Ne++)xe=(xe<<5)+xe^oe.charCodeAt(Ne);V.push({server:oe,count:de,hue:Math.abs(xe)%360})}return V.sort((oe,de)=>de.count-oe.count),V},[n.current,n.current.lastSeq]),Ao=T.useCallback(B=>{gi(V=>{const oe=new Set(V);return oe.has(B)?oe.delete(B):oe.add(B),oe})},[]),St=u?n.current.agents.get(u):null,qs=h?Array.from(n.current.agents.values()).flatMap(B=>B.tools).find(B=>B.id===h)??null:null,Io=T.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}n.current=yv(),jt.current.clear(),Jr.current.clear(),Ht.current.clear(),Si.current="",NE(),m(),i()},[i,m]),zn=T.useRef(b);zn.current=b;const Ni=T.useRef(!1);Ni.current=qs!=null||Xe||N!=null||y!=null;const jr=T.useCallback(B=>{const V=xL(B,{confirmOpen:zn.current,modalOpen:Ni.current});V==="confirm"?k(!0):V==="clear"&&(k(!1),Io())},[Io]),Ci=T.useCallback(()=>{jt.current.clear(),Ht.current.clear(),Si.current="",NE(),i(),window.setTimeout(()=>Ot(500),80)},[i,e,Ot]),$s=T.useCallback(()=>Ot(500),[Ot]),rs=T.useRef(Fn);rs.current=Fn;const Mo=T.useRef(u);Mo.current=u;const qt=T.useCallback(B=>{const V=rs.current;if(V.length===0)return;const oe=V.slice().sort((Le,Ve)=>Le.position.y-Ve.position.y||Le.position.x-Ve.position.x),de=Mo.current,xe=de?oe.findIndex(Le=>Le.id===de):-1;let Ne;xe===-1?Ne=B===1?0:oe.length-1:Ne=(xe+B+oe.length)%oe.length;const Ie=oe[Ne];Ie&&(d(Ie.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[Ie]})}catch{}$n.current=Date.now()},30))},[d,e]),Rr=T.useCallback(B=>{d(B,!1),window.setTimeout(()=>{try{const V=rs.current.find(oe=>oe.id===B);V&&e.fitView({padding:.3,duration:500,nodes:[V]}),$n.current=Date.now()}catch{}},60)},[d,e]);T.useEffect(()=>{const B=V=>{var xe,Ne;const oe=V.target,de={tagName:oe==null?void 0:oe.tagName,isContentEditable:oe==null?void 0:oe.isContentEditable,role:(xe=oe==null?void 0:oe.getAttribute)==null?void 0:xe.call(oe,"role"),type:oe==null?void 0:oe.type};if(V.key==="Escape"){const Ie=yO({overlayOpen:wv.depth()>0,typing:hC(de)});Ie==="dismiss"?wv.dismissTop():Ie==="blur"?oe==null||oe.blur():m();return}if(!yL(de)&&!pL(V)){if(V.key==="/"){V.preventDefault(),(Ne=br.current)==null||Ne.focus();return}V.key===" "&&(V.preventDefault(),Gr()),(V.key==="c"||V.key==="C")&&jr("shortcut"),(V.key==="r"||V.key==="R")&&Ci(),(V.key==="f"||V.key==="F")&&$s(),(V.key==="l"||V.key==="L")&&Kt(),(V.key==="h"||V.key==="H")&&wt(Ie=>!Ie),(V.key==="u"||V.key==="U")&&O(Ie=>!Ie),(V.key==="a"||V.key==="A")&&Mt(),(V.key==="j"||V.key==="J")&&qt(1),(V.key==="k"||V.key==="K")&&qt(-1),(V.key==="t"||V.key==="T")&&vi(Ie=>Ie==="dark"?"light":"dark")}};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[jr,Ci,$s,m,qt,Gr]);const Tr=n.current.agents.size,Ds=new Set(Array.from(n.current.agents.values()).map(B=>B.sessionId)).size,cr=T.useMemo(()=>{var V;const B=[];for(const oe of n.current.agents.values())oe.kind==="root"&&((V=oe.waiting)==null?void 0:V.kind)==="permission"&&B.push({id:oe.id,label:oe.label,waiting:oe.waiting});return B.sort((oe,de)=>oe.waiting.since-de.waiting.since)},[n.current,n.current.lastSeq]),ji=T.useMemo(()=>{const B=new Set;for(const V of n.current.agents.values())V.state==="active"&&B.add(V.sessionId);return B.size},[n.current,n.current.lastSeq]),Ri=T.useRef(null);T.useEffect(()=>{const B=PL({waiting:cr.length,running:ji}),V=Ri.current;if(Ri.current=B,(V==null?void 0:V.title)!==B.title&&(document.title=B.title),(V==null?void 0:V.icon)!==B.icon){const oe=document.querySelector('link[rel="icon"]');oe&&(oe.href=OL[B.icon])}},[cr.length,ji]);const Rt=T.useMemo(()=>{let B=0,V=0,oe=0,de=0,xe=0,Ne=0,Ie=0,Le=0,Ve=0;for(const Qe of n.current.agents.values()){B+=Qe.usage.inputTokens,V+=Qe.usage.outputTokens,oe+=Qe.usage.cacheReadTokens,de+=Qe.usage.cacheCreateTokens;const rt=fn(Qe.usage,Qe.model);xe+=rt.total,Ne+=rt.input,Ie+=rt.output,Le+=rt.cacheRead,Ve+=rt.cacheWrite}return{inT:B,outT:V,cacheR:oe,cacheC:de,sum:B+V,cost:{total:xe,input:Ne,output:Ie,cacheRead:Le,cacheWrite:Ve}}},[n.current,n.current.lastSeq]);return g.jsxs("div",{className:"app",children:[g.jsxs("header",{className:"topbar",children:[g.jsxs("div",{className:"brand",children:[g.jsx("span",{className:"logo"}),zt,ye?g.jsxs("button",{type:"button",className:"v stale",onClick:ze,title:ye.kind==="restart"?`Running v${ye.from}; v${ye.to} is installed on disk. Restart to pick it up.`:`Running v${ye.from}; v${ye.to} is on npm.`,children:["v",ye.from,g.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const B={running:(G==null?void 0:G.running)??"1.33.148",latest:G==null?void 0:G.latest,latestPending:G==null?void 0:G.latestPending,checkedAgo:G!=null&&G.checkedAt?Ev(ut-G.checkedAt):null,checkDisabled:G==null?void 0:G.checkDisabled,checking:ce};return g.jsxs("button",{type:"button",className:ce?"v checking":"v",onClick:()=>ve(!0),"aria-busy":ce||void 0,"aria-label":_D(B),title:xD(B),children:["v",B.running]})})()]}),St&&(()=>{const B=fn(St.usage,St.model),V=Math.max(0,((St.endedAt??ut)-St.startedAt)/1e3),oe=St.state==="active"?yu(B.total,V):null,de=o.size-1;return g.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${St.label}`,onClick:()=>{try{const xe=Fn.find(Ne=>Ne.id===St.id);xe&&e.fitView({padding:.35,duration:500,nodes:[xe]}),$n.current=Date.now()}catch{}},children:[g.jsx("span",{className:`state-pill state-${St.state}`,children:St.state==="active"?"live":St.state}),g.jsx("span",{className:"selected-label",children:St.label}),B.total>0&&g.jsxs("span",{className:"selected-cost",children:[Fe(B.total),oe?g.jsxs("span",{className:"selected-rate",children:[" · ",oe]}):null]}),de>0&&g.jsxs("span",{className:"selected-extra",children:["+",de]}),g.jsx("span",{role:"button","aria-label":"Deselect",className:"selected-close",onClick:xe=>{xe.stopPropagation(),m()},children:"×"})]})})(),g.jsxs("div",{className:"actions",children:[g.jsxs("div",{className:"search",children:[g.jsx("span",{className:"search-icon","aria-hidden":!0,children:"⌕"}),g.jsx("input",{ref:br,type:"text",placeholder:"Search agents, cwd, tools…",value:en,onChange:B=>Qr(B.target.value),spellCheck:!1,"aria-label":"Filter the graph"}),en?g.jsx("button",{className:"search-clear","aria-label":"Clear search",onClick:()=>Qr(""),children:"×"}):g.jsx("kbd",{className:"search-kbd","aria-hidden":!0,children:"/"}),En.count&&g.jsx("span",{className:`search-count${En.empty?" none":""}`,"aria-live":"polite",title:`${En.count} agents on the canvas match “${en}”`,children:En.count})]}),g.jsxs("span",{className:"status",role:"status",children:[(()=>{const B=SD({connected:I,paused:pn,held:Zt.current.size});return g.jsx("span",{className:`pill ${B.tone}`,title:B.title,children:B.label})})(),g.jsxs("span",{className:"stat",title:"Distinct CC sessions",children:[g.jsx("span",{className:"count",children:Ds}),g.jsx("span",{className:"lbl",children:"sessions"})]}),g.jsxs("span",{className:"stat",title:"Total agents (root + subagents)",children:[g.jsx("span",{className:"count",children:Tr}),g.jsx("span",{className:"lbl",children:"agents"})]}),g.jsxs("span",{className:"stat",title:"Total hook events received",children:[g.jsx("span",{className:"count",children:n.current.totalEvents}),g.jsx("span",{className:"lbl",children:"events"})]}),Rt.sum>0&&g.jsxs("span",{className:"stat",title:`in:${Rt.inT.toLocaleString()} out:${Rt.outT.toLocaleString()} cache-r:${Rt.cacheR.toLocaleString()} cache-c:${Rt.cacheC.toLocaleString()}`,children:[g.jsx("span",{className:"count",children:Ft(Rt.sum)}),g.jsx("span",{className:"lbl",children:"tokens"})]}),Ls.length>0&&g.jsxs("span",{className:"stat mcp-legend",title:`MCP servers seen this session:
|
|
62
62
|
${Ls.map(B=>` ${B.server}: ${B.count} call${B.count===1?"":"s"}`).join(`
|
|
63
63
|
`)}`,children:[Ls.slice(0,6).map(B=>g.jsx("span",{className:"mcp-dot",style:{"--mcp-hue":B.hue}},B.server)),Ls.length>6&&g.jsxs("span",{className:"mcp-more",children:["+",Ls.length-6]}),g.jsx("span",{className:"lbl",children:"mcp"})]}),Rt.cost.total>0&&(()=>{let B=0,V=0;for(const xe of n.current.agents.values()){if(xe.state!=="active")continue;const Ne=fn(xe.usage,xe.model);B+=Ne.total,V=Math.max(V,((xe.endedAt??ut)-xe.startedAt)/1e3)}const oe=V>0?yu(B,V):null,de=`input ${Fe(Rt.cost.input)} + output ${Fe(Rt.cost.output)} + cache r ${Fe(Rt.cost.cacheRead)} + cache w ${Fe(Rt.cost.cacheWrite)}${oe?`
|
|
64
64
|
active burn: ${oe}`:""}`;return g.jsxs("span",{className:"stat",title:de,children:[g.jsx("span",{className:"count",children:Fe(Rt.cost.total)}),g.jsxs("span",{className:"lbl",children:["cost",oe?` · ${oe}`:""]})]})})()]}),cr.length>0&&g.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>Rr(cr[0].id),title:`Blocked waiting for you — click to go to the one that has been stuck longest:
|
|
65
65
|
${cr.map(B=>` ${B.label}: ${ju(B.waiting)} (${Ev(ut-B.waiting.since)})`).join(`
|
|
66
|
-
`)}`,"aria-label":`${cr.length} session${cr.length===1?"":"s"} waiting for you`,children:[g.jsx("span",{className:"ap-pulse","aria-hidden":!0}),g.jsx("b",{children:cr.length})," waiting"]}),(()=>{const B=kD({paused:pn,held:Zt.current.size});return g.jsx("button",{className:`btn ${pn?"warn":""}`,onClick:Gr,title:B.title,children:B.label})})(),g.jsx("button",{className:`btn icon-btn ${H?"primary":""}`,onClick:()=>O(B=>!B),title:`${H?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel",children:"$"}),
|
|
66
|
+
`)}`,"aria-label":`${cr.length} session${cr.length===1?"":"s"} waiting for you`,children:[g.jsx("span",{className:"ap-pulse","aria-hidden":!0}),g.jsx("b",{children:cr.length})," waiting"]}),(()=>{const B=kD({paused:pn,held:Zt.current.size});return g.jsx("button",{className:`btn ${pn?"warn":""}`,onClick:Gr,title:B.title,children:B.label})})(),g.jsx("button",{className:`btn icon-btn ${H?"primary":""}`,onClick:()=>O(B=>!B),title:`${H?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel",children:"$"}),Y!==null&&g.jsx("button",{className:`btn icon-btn ${Y?"primary":""}`,onClick:B=>{if(B.shiftKey&&Z>0){Q(!0),fetch("/api/sound-hook",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"restore"})}).then(()=>fetch("/api/sound-hook")).then(V=>V.ok?V.json():null).then(V=>{V!=null&&V.ok&&(q(V.enabled===!0),$(V.parked??0))}).catch(()=>{}).finally(()=>Q(!1));return}X()},disabled:R,title:(Y?"Sound on turn finish: on — click to remove the hook":"Sound on turn finish: off — click to add a Stop hook")+(z>0?`
|
|
67
67
|
|
|
68
68
|
${z} sound hook${z>1?"s":""} of your own in settings.json also run${z>1?"":"s"} here.`:"")+(Z>0?`
|
|
69
69
|
|
|
70
|
-
${Z} of your own sound hook${Z>1?"s were":" was"} set aside so this switch actually controls the sound. Nothing was deleted — shift-click to put ${Z>1?"them":"it"} back.`:""),"aria-label":"Toggle finish sound","aria-pressed":G,children:g.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[g.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),G?g.jsxs(g.Fragment,{children:[g.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),g.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):g.jsxs(g.Fragment,{children:[g.jsx("path",{d:"M10 5.6l2.6 2.8"}),g.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]})}),g.jsx("button",{className:`btn icon-btn ${P?"primary":""}`,onClick:Mt,title:`${P?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel",children:g.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[g.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),g.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]})}),g.jsx("button",{className:`btn icon-btn ${C?"primary":""}`,onClick:Kt,title:`${C?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list",children:"☰"}),g.jsx("button",{className:`btn icon-btn ${Xe?"primary":""}`,onClick:()=>wt(B=>!B),title:"Usage history — ccusage (H)","aria-label":"Open usage history",children:g.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":!0,children:[g.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),g.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),g.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]})}),g.jsx("button",{className:"btn",onClick:Ci,title:"Auto-arrange — clear pins (R)",children:"Re-layout"}),g.jsx("button",{className:"btn",onClick:()=>jr("button"),title:"Clear the canvas and the server's event log — asks first (C)",children:"Clear"}),g.jsx("button",{className:"btn icon-btn",onClick:()=>vi(B=>B==="dark"?"light":"dark"),title:`Switch to ${ir==="dark"?"light":"dark"} mode (T)`,"aria-label":"Toggle theme",children:ir==="dark"?"☀":"☾"})]})]}),sr?g.jsxs("div",{className:"ver-banner done",role:"status",children:[g.jsx("span",{className:"ver-dot"}),g.jsxs("strong",{children:["Restarted — now running v",sr,"."]}),g.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):Je&&!I?g.jsxs("div",{className:"conn-banner",role:"alert",children:[g.jsx("span",{className:"conn-dot"}),Jt?wr==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${zt}…`:`Lost connection to the ${zt} server. Reconnecting…`]}):_e&&ye?g.jsxs("div",{className:`ver-banner ${ye.kind}`,role:"status",children:[g.jsx("span",{className:"ver-dot"}),ye.kind==="restart"?g.jsxs(g.Fragment,{children:[g.jsxs("strong",{children:["v",ye.to," is installed — this deck still runs v",ye.from,"."]}),Y!=null&&Y.canRestart?g.jsxs(g.Fragment,{children:[g.jsx("button",{type:"button",className:"ver-act",onClick:()=>Kr(),disabled:Jt,title:"Stop this process and bring it back on the same port. The canvas replays from the event log.",children:Jt?"restarting…":"Restart now"}),g.jsxs("button",{type:"button",className:`ver-auto${nr?" on":""}`,role:"switch","aria-checked":nr,onClick:pi,title:nr?"Restarts on its own once nothing has been running for 30 seconds. Click to require a click instead.":"Only restarts when you click. Click to let it restart itself while idle.",children:[g.jsx("i",{"aria-hidden":!0}),"auto when idle"]})]}):g.jsx("span",{className:"ver-sub",title:"Node loads every module once, at startup. An upgrade replaces the files on disk but not the code already in memory, so this process keeps running the old version until it is restarted.",children:"Restart it to pick up the new code."})]}):g.jsxs(g.Fragment,{children:[g.jsxs("strong",{children:[zt," v",ye.to," is out — you are on v",ye.from,"."]}),(Y==null?void 0:Y.upgradeMode)==="install"&&Ye!=="failed"&&g.jsx("button",{type:"button",className:"ver-act",onClick:ot,disabled:Ye==="running"||Ye==="done",title:`Runs ${((Po=Y==null?void 0:Y.upgrade)==null?void 0:Po.command)??"npm install -g agents-deck@latest"} here, then restarts once nothing is running.`,children:Ye==="running"?"installing…":Ye==="done"?"installed":"Update now"}),(Y==null?void 0:Y.upgradeMode)==="npx"&&(Y==null?void 0:Y.canRestart)&&g.jsx("button",{type:"button",className:"ver-act",onClick:()=>Kr({upgrade:!0}),disabled:Jt,title:`Runs ${Y==null?void 0:Y.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:Jt?"fetching…":Ye==="failed"?"Retry update":"Update & restart"}),Ye==="failed"?g.jsxs("span",{className:"ver-sub fail",title:((Ua=Y==null?void 0:Y.upgrade)==null?void 0:Ua.error)??"",children:[(Y==null?void 0:Y.upgradeMode)==="npx"?"update failed":"install failed",": ",((Ha=Y==null?void 0:Y.upgrade)==null?void 0:Ha.error)??"unknown error"," — run it yourself:"]}):(Y==null?void 0:Y.upgradeMode)==="npx"?g.jsx("span",{className:"ver-sub",children:Y!=null&&Y.canRestart?"npx cannot upgrade in place, so the deck re-runs:":bE.npx}):Y!=null&&Y.upgradeBlocked?g.jsx("span",{className:"ver-sub",children:bE[Y.upgradeBlocked]??"cannot install from here"}):null,g.jsxs("button",{type:"button",className:"ver-cmd",onClick:yt,title:"Copy to clipboard",children:[g.jsx("code",{children:Y==null?void 0:Y.command}),g.jsx("span",{className:"ver-cmd-hint",children:le?"copied":"copy"})]})]}),g.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:ze,children:"×"})]}):De&&Ue?g.jsxs("div",{className:"ver-banner",role:"status",children:[g.jsx("span",{className:"ver-dot"}),g.jsxs("strong",{children:[Ue," still works — the deck is called ",zt," now."]}),g.jsx("span",{className:"ver-sub",children:(Y==null?void 0:Y.upgradeMode)==="npx"?`Run npx ${zt} next time.`:`${zt} already works here — same install, no download.`}),g.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Ze,children:"×"})]}):null,H&&g.jsx(A3,{state:n.current,now:ut,onClose:()=>O(!1)}),P&&g.jsx(aL,{onClose:()=>F(!1)}),C&&g.jsx(_3,{state:n.current,now:ut,selectedIds:o,onSelect:Rr,onClose:()=>A(!1)}),g.jsxs("div",{className:`canvas-wrap${Is?" bubbling":""}${jo?" dragging-any":""}`,ref:Co,children:[Tr===0&&g.jsx(ZD,{live:I,everConnected:Je}),En.empty&&Tr>0&&g.jsxs("div",{className:"search-empty",role:"status",children:[g.jsx("span",{className:"search-empty-text",children:En.message}),g.jsx("button",{type:"button",className:"btn",onClick:()=>{var B;Qr(""),(B=br.current)==null||B.focus()},children:"Clear search"})]}),Ei.length>1&&g.jsx("div",{ref:_n,className:`cat-filter-bar${Xt?" occluded":""}`,role:"toolbar","aria-label":"Filter tools by category",children:Ei.map(B=>{const V=Cs.has(B);return g.jsxs("button",{type:"button",className:`cat-filter${V?" off":""}`,onClick:()=>Ao(B),title:`${V?"Show":"Hide"} ${Cv[B]} tools`,children:[g.jsx("span",{className:"cat-emoji",children:Nv[B]}),g.jsx("span",{className:"cat-name",children:Cv[B]})]},B)})}),g.jsxs(WN,{nodes:Os,edges:Ku,nodeTypes:jD,fitView:!Xr,fitViewOptions:{padding:.25,duration:400},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,onNodeClick:(B,V)=>{if(V.type==="sessionGroup"){m();return}d(V.id,B.shiftKey)},onPaneClick:()=>m(),onMoveStart:()=>{Date.now()-$n.current<1200||Zr()},onMove:(B,V)=>{wi(),Sr.current&&window.clearTimeout(Sr.current),Sr.current=window.setTimeout(()=>WD(V),250)},onNodeDragStart:(B,V)=>{var oe;if(Ms(),No.current=!0,Qt.current=new Map,Ro(!0),wi(),Zr(),V.type==="sessionGroup"){const de=(oe=V.data)==null?void 0:oe.sessionId,xe=new Map;if(de)for(const Ne of Fn){const Ie=Ne.data;(Ie==null?void 0:Ie.sessionId)===de&&xe.set(Ne.id,{x:Ne.position.x,y:Ne.position.y})}_r.current={start:{x:V.position.x,y:V.position.y},members:xe};return}jt.current.set(V.id,{x:V.position.x,y:V.position.y})},onNodeDrag:(B,V)=>{var oe;if(wi(),V.type==="sessionGroup"){const de=_r.current;if(!de)return;const xe=V.position.x-de.start.x,Ne=V.position.y-de.start.y;for(const[Le,Ve]of de.members){const Qe={x:Ve.x+xe,y:Ve.y+Ne};jt.current.set(Le,Qe),Ht.current.set(Le,Qe)}const Ie=Qt.current;if(Ie){for(const[Le,Ve]of de.members)Ie.set(Le,{x:Ve.x+xe,y:Ve.y+Ne});Ie.set(V.id,{x:V.position.x,y:V.position.y})}bn(Le=>Le+1);return}jt.current.set(V.id,{x:V.position.x,y:V.position.y}),Ht.current.set(V.id,{x:V.position.x,y:V.position.y}),(oe=Qt.current)==null||oe.set(V.id,{x:V.position.x,y:V.position.y}),bn(de=>de+1)},onNodeDragStop:(B,V)=>{if(wi(),No.current=!1,Qt.current=null,Ro(!1),mt(oe=>oe+1),V.type==="sessionGroup"){const oe=_r.current;if(oe){const de=V.position.x-oe.start.x,xe=V.position.y-oe.start.y;for(const[Ne,Ie]of oe.members){const Le={x:Ie.x+de,y:Ie.y+xe};jt.current.set(Ne,Le),Ht.current.set(Ne,Le)}}_r.current=null,tv(Ht.current,jt.current),mt(de=>de+1);return}jt.current.set(V.id,{x:V.position.x,y:V.position.y}),Ht.current.set(V.id,{x:V.position.x,y:V.position.y}),tv(Ht.current,jt.current)},children:[g.jsx(BP,{gap:28,size:1,color:pa("--grid-line")}),g.jsx($O,{}),g.jsx(m3,{agents:n.current.agents,visibleAgentIds:ar,positions:Ht.current,pinned:jt.current,measured:Jr.current,dimUnmatched:En.dim?kn:null,spotlight:ki,hiddenCategories:Cs,now:ut,onOpenTool:p}),g.jsx(LP,{showInteractive:!1,children:g.jsx(so,{onClick:xi,title:Rs?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view",style:Rs?{color:"var(--accent)"}:void 0,children:g.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[g.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),g.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})})}),g.jsx(RP,{zoomable:!0,pannable:!0,nodeColor:B=>yD(B,pa),nodeStrokeWidth:2,maskColor:pa("--minimap-mask"),style:{background:pa("--panel"),border:`1px solid ${pa("--line")}`,borderRadius:8}})]})]}),M?g.jsxs("aside",{className:"detail",children:[g.jsx("button",{type:"button",className:"detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>L(!1),children:"×"}),St?g.jsx(t5,{agent:St,now:ut,onOpenTool:p,onShowSummary:B=>{E.current.has(B)&&(E.current.delete(B),EE(E.current)),w(B)},onExportSession:B=>VD(n.current,B)}):g.jsx(e5,{count:Tr,workspace:ke})]}):g.jsx("button",{type:"button",className:"detail-reopen",title:"Show detail panel","aria-label":"Show detail panel",onClick:()=>L(!0),children:"‹"}),qs&&g.jsx(MO,{tool:qs,onClose:()=>p(null)}),Xe&&g.jsx(zL,{onClose:()=>wt(!1)}),N&&(()=>{const B=n.current.agents.get(N);return B?g.jsx(SO,{agent:B,onClose:()=>_(null)}):null})(),y&&g.jsx(v3,{state:n.current,sessionId:y,onClose:()=>{E.current.add(y),EE(E.current),w(null)}}),b&&g.jsx(wL,{agentCount:Tr,onConfirm:()=>jr("confirmation"),onCancel:()=>k(!1)})]})}function ZD({live:e,everConnected:n}){const r=!e;return g.jsxs("div",{className:"empty-hero",children:[g.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[g.jsx("div",{className:"core"}),g.jsxs("div",{className:"orbit r1",children:[g.jsx("span",{className:"dot"}),g.jsx("span",{className:"dot b"})]}),g.jsxs("div",{className:"orbit r2",children:[g.jsx("span",{className:"dot"}),g.jsx("span",{className:"dot b"})]}),g.jsxs("div",{className:"orbit r3",children:[g.jsx("span",{className:"dot"}),g.jsx("span",{className:"dot b"})]})]}),r?g.jsxs(g.Fragment,{children:[g.jsx("h2",{children:n?"Disconnected from server":"Server unreachable"}),g.jsxs("p",{children:["The browser cannot reach ",g.jsx("code",{children:"/events"}),". Check that",g.jsx("code",{children:zt})," is still running in your terminal, then this page will resume automatically."]})]}):JD()]})}function JD(){return g.jsxs(g.Fragment,{children:[g.jsx("h2",{children:"Waiting for Claude Code or Codex"}),g.jsxs("p",{children:["Run ",g.jsx("code",{children:"claude"})," or ",g.jsx("code",{children:"codex"})," in any folder. As soon as a session sends an event, a node appears here and grows as subagents fork and tools are called."]}),g.jsxs("p",{className:"hint-row",children:["Not seeing anything? Make sure ",g.jsx("code",{children:zt})," is running and that hooks are installed in your Claude settings (",g.jsx("code",{children:"$CLAUDE_CONFIG_DIR"})," ","if you set it, otherwise ",g.jsx("code",{children:"~/.claude/settings.json"}),") and"," ",g.jsx("code",{children:"~/.codex/hooks.json"}),". (Codex requires"," ",g.jsx("code",{children:"/hooks"})," trust on first run.)"]})]})}function e5({count:e,workspace:n}){const r=bD(n);return g.jsxs(g.Fragment,{children:[g.jsx("h3",{children:"Detail"}),e===0?g.jsxs("div",{className:"hint",children:[r.lead,r.workspace!==null&&g.jsxs(g.Fragment,{children:[" ",g.jsx("code",{children:r.workspace}),r.tail]})]}):g.jsx("div",{className:"empty",children:"Click an agent to see its tools."}),g.jsx("h3",{style:{marginTop:4},children:"Shortcuts"}),g.jsxs("div",{className:"shortcuts",children:[g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"drag"}),g.jsx("span",{children:"move a node"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"/"}),g.jsx("span",{children:"focus search"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"space"}),g.jsx("span",{children:"pause / resume"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"J"}),g.jsx("span",{children:"next agent"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"K"}),g.jsx("span",{children:"previous agent"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"R"}),g.jsx("span",{children:"re-arrange"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"F"}),g.jsx("span",{children:"fit view"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"L"}),g.jsx("span",{children:"session list"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"H"}),g.jsx("span",{children:"usage history"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"U"}),g.jsx("span",{children:"usage panel"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"C"}),g.jsx("span",{children:"clear canvas"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"T"}),g.jsx("span",{children:"toggle theme"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"Esc"}),g.jsx("span",{children:"deselect"})]})]})]})}function t5({agent:e,now:n,onOpenTool:r,onShowSummary:i,onExportSession:o}){const l=(e.endedAt??n)-e.startedAt,u=Math.max(0,Math.floor(l/1e3)),c=u<60?`${u}s`:`${Math.floor(u/60)}m ${String(u%60).padStart(2,"0")}s`,h=fn(e.usage,e.model),p=h.total>0,d=e.usage.inputTokens+e.usage.outputTokens,m=new Map;for(const _ of e.tools){const S=kj(_.name);m.set(S,(m.get(S)??0)+1)}const y=e.tools.filter(_=>_.ok===!1).length,w=e.tools.filter(_=>!_.endedAt).length,N=Array.from(m.entries()).sort((_,S)=>S[1]-_[1]);return g.jsxs(g.Fragment,{children:[g.jsxs("header",{className:"detail-hero",children:[g.jsxs("div",{className:"hero-line",children:[g.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),g.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),g.jsxs("div",{className:"hero-meta",children:[g.jsx("span",{className:"hero-meta-item",children:e.kind}),g.jsx("span",{className:"hero-sep",children:"·"}),g.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:c}),e.model&&g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"hero-sep",children:"·"}),g.jsx("span",{className:"model-chip",title:e.model,children:li(e.model)})]})]}),p&&g.jsxs("div",{className:"hero-cost",children:[g.jsxs("div",{className:"hero-cost-headline",children:[g.jsx("span",{className:"hero-cost-value",children:Fe(h.total)}),g.jsx("span",{className:"hero-cost-label",children:"spend"})]}),g.jsx(n5,{cost:h})]}),g.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&i&&g.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>i(e.sessionId),title:"Reopen the end-of-session recap modal",children:"Show recap"}),o&&g.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>o(e.sessionId),title:"Download this session as JSON",children:"Export JSON"})]})]}),e.tools.length>0&&g.jsxs("section",{className:"detail-section",children:[g.jsx("h3",{children:"Activity"}),g.jsxs("div",{className:"activity-row",children:[g.jsxs("div",{className:"activity-counters",children:[g.jsxs("span",{className:"ac-item",children:[g.jsx("b",{children:e.toolCount})," calls"]}),w>0&&g.jsxs("span",{className:"ac-item ac-live",children:[g.jsx("b",{children:w})," live"]}),y>0&&g.jsxs("span",{className:"ac-item ac-err",children:[g.jsx("b",{children:y})," err"]})]}),g.jsx("div",{className:"cat-strip",children:N.map(([_,S])=>g.jsxs("span",{className:`cat-chip cat-${_}`,title:`${S} ${Cv[_]} call${S===1?"":"s"}`,children:[g.jsx("span",{className:"cat-emoji",children:Nv[_]}),g.jsx("span",{className:"cat-count",children:S})]},_))})]})]}),d>0&&g.jsxs("section",{className:"detail-section",children:[g.jsx("h3",{children:"Tokens"}),g.jsxs("div",{className:"tokens-grid",children:[g.jsxs("div",{children:[g.jsx("span",{className:"k",children:"in"}),g.jsx("b",{children:e.usage.inputTokens.toLocaleString()})]}),g.jsxs("div",{children:[g.jsx("span",{className:"k",children:"out"}),g.jsx("b",{children:e.usage.outputTokens.toLocaleString()})]}),g.jsxs("div",{children:[g.jsx("span",{className:"k",children:"cache r"}),g.jsx("b",{children:e.usage.cacheReadTokens.toLocaleString()})]}),g.jsxs("div",{children:[g.jsx("span",{className:"k",children:"cache c"}),g.jsx("b",{children:e.usage.cacheCreateTokens.toLocaleString()})]})]})]}),g.jsxs("section",{className:"detail-section",children:[g.jsx("h3",{children:"Identity"}),g.jsxs("div",{children:[e.cwd&&g.jsxs("div",{className:"row",children:[g.jsx("span",{className:"k",children:"cwd"}),g.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),g.jsxs("div",{className:"row",children:[g.jsx("span",{className:"k",children:"session"}),g.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&g.jsxs("div",{className:"row",children:[g.jsx("span",{className:"k",children:"parent"}),g.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&g.jsxs("section",{className:"detail-section",children:[g.jsxs("h3",{children:["Prompts ",g.jsx("span",{className:"section-count",children:e.prompts.length})]}),g.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((_,S)=>{const b=CD(_.at,n);return g.jsxs("div",{className:"prompt-entry",children:[g.jsx("div",{className:"prompt-time",title:b.title,children:b.label}),g.jsx("div",{className:"prompt-text",children:_.text})]},S)})})]}),g.jsxs("section",{className:"detail-section",children:[g.jsxs("h3",{children:["Tool calls ",g.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&g.jsx("div",{className:"empty",children:"No tool calls yet."}),g.jsx("div",{children:e.tools.slice().reverse().map(_=>g.jsx(r5,{t:_,now:n,onClick:()=>r(_.id)},_.id))})]})]})}function n5({cost:e}){const n=e.total;if(n<=0)return null;const r=(i,o,l)=>{if(i<=0)return null;const u=i/n*100;return g.jsx("span",{className:`cb-seg ${o}`,style:{width:`${u}%`},title:`${l}: ${Fe(i)} (${u.toFixed(0)}%)`},o)};return g.jsxs("div",{className:"cost-bar","aria-label":"Cost breakdown",children:[r(e.input,"cb-input","input"),r(e.output,"cb-output","output"),r(e.cacheRead,"cb-cache-r","cache read"),r(e.cacheWrite,"cb-cache-w","cache write")]})}function r5({t:e,now:n,onClick:r}){const i=e.endedAt==null?"inflight":e.ok===!1?"err":"done",o=(e.endedAt??n)-e.startedAt,l=e.endedAt==null?"…":o<1e3?`${o}ms`:`${(o/1e3).toFixed(1)}s`;return g.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:r,children:[g.jsxs("span",{className:"name",children:[g.jsx("span",{className:`status-dot ${i}`}),e.name]}),g.jsx("span",{style:{color:"var(--muted)"},children:l})]})}try{AL(window.localStorage)}catch{}const s5=FR.createRoot(document.getElementById("root"));s5.render(g.jsx(XD,{}));
|
|
70
|
+
${Z} of your own sound hook${Z>1?"s were":" was"} set aside so this switch actually controls the sound. Nothing was deleted — shift-click to put ${Z>1?"them":"it"} back.`:""),"aria-label":"Toggle finish sound","aria-pressed":Y,children:g.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[g.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),Y?g.jsxs(g.Fragment,{children:[g.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),g.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):g.jsxs(g.Fragment,{children:[g.jsx("path",{d:"M10 5.6l2.6 2.8"}),g.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]})}),g.jsx("button",{className:`btn icon-btn ${P?"primary":""}`,onClick:Mt,title:`${P?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel",children:g.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[g.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),g.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]})}),g.jsx("button",{className:`btn icon-btn ${C?"primary":""}`,onClick:Kt,title:`${C?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list",children:"☰"}),g.jsx("button",{className:`btn icon-btn ${Xe?"primary":""}`,onClick:()=>wt(B=>!B),title:"Usage history — ccusage (H)","aria-label":"Open usage history",children:g.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":!0,children:[g.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),g.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),g.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]})}),g.jsx("button",{className:"btn",onClick:Ci,title:"Auto-arrange — clear pins (R)",children:"Re-layout"}),g.jsx("button",{className:"btn",onClick:()=>jr("button"),title:"Clear the canvas and the server's event log — asks first (C)",children:"Clear"}),g.jsx("button",{className:"btn icon-btn",onClick:()=>vi(B=>B==="dark"?"light":"dark"),title:`Switch to ${ir==="dark"?"light":"dark"} mode (T)`,"aria-label":"Toggle theme",children:ir==="dark"?"☀":"☾"})]})]}),sr?g.jsxs("div",{className:"ver-banner done",role:"status",children:[g.jsx("span",{className:"ver-dot"}),g.jsxs("strong",{children:["Restarted — now running v",sr,"."]}),g.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):Je&&!I?g.jsxs("div",{className:"conn-banner",role:"alert",children:[g.jsx("span",{className:"conn-dot"}),Jt?wr==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${zt}…`:`Lost connection to the ${zt} server. Reconnecting…`]}):_e&&ye?g.jsxs("div",{className:`ver-banner ${ye.kind}`,role:"status",children:[g.jsx("span",{className:"ver-dot"}),ye.kind==="restart"?g.jsxs(g.Fragment,{children:[g.jsxs("strong",{children:["v",ye.to," is installed — this deck still runs v",ye.from,"."]}),G!=null&&G.canRestart?g.jsxs(g.Fragment,{children:[g.jsx("button",{type:"button",className:"ver-act",onClick:()=>Kr(),disabled:Jt,title:"Stop this process and bring it back on the same port. The canvas replays from the event log.",children:Jt?"restarting…":"Restart now"}),g.jsxs("button",{type:"button",className:`ver-auto${nr?" on":""}`,role:"switch","aria-checked":nr,onClick:pi,title:nr?"Restarts on its own once nothing has been running for 30 seconds. Click to require a click instead.":"Only restarts when you click. Click to let it restart itself while idle.",children:[g.jsx("i",{"aria-hidden":!0}),"auto when idle"]})]}):g.jsx("span",{className:"ver-sub",title:"Node loads every module once, at startup. An upgrade replaces the files on disk but not the code already in memory, so this process keeps running the old version until it is restarted.",children:"Restart it to pick up the new code."})]}):g.jsxs(g.Fragment,{children:[g.jsxs("strong",{children:[zt," v",ye.to," is out — you are on v",ye.from,"."]}),(G==null?void 0:G.upgradeMode)==="install"&&Ye!=="failed"&&g.jsx("button",{type:"button",className:"ver-act",onClick:ot,disabled:Ye==="running"||Ye==="done",title:`Runs ${((Po=G==null?void 0:G.upgrade)==null?void 0:Po.command)??(G==null?void 0:G.command)??"npm i -g"} here, then restarts once nothing is running.`,children:Ye==="running"?"installing…":Ye==="done"?"installed":"Update now"}),(G==null?void 0:G.upgradeMode)==="npx"&&(G==null?void 0:G.canRestart)&&g.jsx("button",{type:"button",className:"ver-act",onClick:()=>Kr({upgrade:!0}),disabled:Jt,title:`Runs ${G==null?void 0:G.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:Jt?"fetching…":Ye==="failed"?"Retry update":"Update & restart"}),Ye==="failed"?g.jsxs("span",{className:"ver-sub fail",title:((Ua=G==null?void 0:G.upgrade)==null?void 0:Ua.error)??"",children:[(G==null?void 0:G.upgradeMode)==="npx"?"update failed":"install failed",": ",((Ha=G==null?void 0:G.upgrade)==null?void 0:Ha.error)??"unknown error"," — run it yourself:"]}):(G==null?void 0:G.upgradeMode)==="npx"?g.jsx("span",{className:"ver-sub",children:G!=null&&G.canRestart?"npx cannot upgrade in place, so the deck re-runs:":bE.npx}):G!=null&&G.upgradeBlocked?g.jsx("span",{className:"ver-sub",children:bE[G.upgradeBlocked]??"cannot install from here"}):null,g.jsxs("button",{type:"button",className:"ver-cmd",onClick:yt,title:"Copy to clipboard",children:[g.jsx("code",{children:G==null?void 0:G.command}),g.jsx("span",{className:"ver-cmd-hint",children:le?"copied":"copy"})]})]}),g.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:ze,children:"×"})]}):De&&Ue?g.jsxs("div",{className:"ver-banner",role:"status",children:[g.jsx("span",{className:"ver-dot"}),g.jsxs("strong",{children:[Ue," still works — the deck is called ",zt," now."]}),g.jsx("span",{className:"ver-sub",children:(G==null?void 0:G.upgradeMode)==="npx"?`Run npx ${zt} next time.`:`${zt} already works here — same install, no download.`}),g.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Ze,children:"×"})]}):null,H&&g.jsx(A3,{state:n.current,now:ut,onClose:()=>O(!1)}),P&&g.jsx(aL,{onClose:()=>F(!1)}),C&&g.jsx(_3,{state:n.current,now:ut,selectedIds:o,onSelect:Rr,onClose:()=>A(!1)}),g.jsxs("div",{className:`canvas-wrap${Is?" bubbling":""}${jo?" dragging-any":""}`,ref:Co,children:[Tr===0&&g.jsx(ZD,{live:I,everConnected:Je}),En.empty&&Tr>0&&g.jsxs("div",{className:"search-empty",role:"status",children:[g.jsx("span",{className:"search-empty-text",children:En.message}),g.jsx("button",{type:"button",className:"btn",onClick:()=>{var B;Qr(""),(B=br.current)==null||B.focus()},children:"Clear search"})]}),Ei.length>1&&g.jsx("div",{ref:_n,className:`cat-filter-bar${Xt?" occluded":""}`,role:"toolbar","aria-label":"Filter tools by category",children:Ei.map(B=>{const V=Cs.has(B);return g.jsxs("button",{type:"button",className:`cat-filter${V?" off":""}`,onClick:()=>Ao(B),title:`${V?"Show":"Hide"} ${Cv[B]} tools`,children:[g.jsx("span",{className:"cat-emoji",children:Nv[B]}),g.jsx("span",{className:"cat-name",children:Cv[B]})]},B)})}),g.jsxs(WN,{nodes:Os,edges:Ku,nodeTypes:jD,fitView:!Xr,fitViewOptions:{padding:.25,duration:400},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,onNodeClick:(B,V)=>{if(V.type==="sessionGroup"){m();return}d(V.id,B.shiftKey)},onPaneClick:()=>m(),onMoveStart:()=>{Date.now()-$n.current<1200||Zr()},onMove:(B,V)=>{wi(),Sr.current&&window.clearTimeout(Sr.current),Sr.current=window.setTimeout(()=>WD(V),250)},onNodeDragStart:(B,V)=>{var oe;if(Ms(),No.current=!0,Qt.current=new Map,Ro(!0),wi(),Zr(),V.type==="sessionGroup"){const de=(oe=V.data)==null?void 0:oe.sessionId,xe=new Map;if(de)for(const Ne of Fn){const Ie=Ne.data;(Ie==null?void 0:Ie.sessionId)===de&&xe.set(Ne.id,{x:Ne.position.x,y:Ne.position.y})}_r.current={start:{x:V.position.x,y:V.position.y},members:xe};return}jt.current.set(V.id,{x:V.position.x,y:V.position.y})},onNodeDrag:(B,V)=>{var oe;if(wi(),V.type==="sessionGroup"){const de=_r.current;if(!de)return;const xe=V.position.x-de.start.x,Ne=V.position.y-de.start.y;for(const[Le,Ve]of de.members){const Qe={x:Ve.x+xe,y:Ve.y+Ne};jt.current.set(Le,Qe),Ht.current.set(Le,Qe)}const Ie=Qt.current;if(Ie){for(const[Le,Ve]of de.members)Ie.set(Le,{x:Ve.x+xe,y:Ve.y+Ne});Ie.set(V.id,{x:V.position.x,y:V.position.y})}bn(Le=>Le+1);return}jt.current.set(V.id,{x:V.position.x,y:V.position.y}),Ht.current.set(V.id,{x:V.position.x,y:V.position.y}),(oe=Qt.current)==null||oe.set(V.id,{x:V.position.x,y:V.position.y}),bn(de=>de+1)},onNodeDragStop:(B,V)=>{if(wi(),No.current=!1,Qt.current=null,Ro(!1),mt(oe=>oe+1),V.type==="sessionGroup"){const oe=_r.current;if(oe){const de=V.position.x-oe.start.x,xe=V.position.y-oe.start.y;for(const[Ne,Ie]of oe.members){const Le={x:Ie.x+de,y:Ie.y+xe};jt.current.set(Ne,Le),Ht.current.set(Ne,Le)}}_r.current=null,tv(Ht.current,jt.current),mt(de=>de+1);return}jt.current.set(V.id,{x:V.position.x,y:V.position.y}),Ht.current.set(V.id,{x:V.position.x,y:V.position.y}),tv(Ht.current,jt.current)},children:[g.jsx(BP,{gap:28,size:1,color:pa("--grid-line")}),g.jsx($O,{}),g.jsx(m3,{agents:n.current.agents,visibleAgentIds:ar,positions:Ht.current,pinned:jt.current,measured:Jr.current,dimUnmatched:En.dim?kn:null,spotlight:ki,hiddenCategories:Cs,now:ut,onOpenTool:p}),g.jsx(LP,{showInteractive:!1,children:g.jsx(so,{onClick:xi,title:Rs?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view",style:Rs?{color:"var(--accent)"}:void 0,children:g.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[g.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),g.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})})}),g.jsx(RP,{zoomable:!0,pannable:!0,nodeColor:B=>yD(B,pa),nodeStrokeWidth:2,maskColor:pa("--minimap-mask"),style:{background:pa("--panel"),border:`1px solid ${pa("--line")}`,borderRadius:8}})]})]}),M?g.jsxs("aside",{className:"detail",children:[g.jsx("button",{type:"button",className:"detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>L(!1),children:"×"}),St?g.jsx(t5,{agent:St,now:ut,onOpenTool:p,onShowSummary:B=>{E.current.has(B)&&(E.current.delete(B),EE(E.current)),w(B)},onExportSession:B=>VD(n.current,B)}):g.jsx(e5,{count:Tr,workspace:ke})]}):g.jsx("button",{type:"button",className:"detail-reopen",title:"Show detail panel","aria-label":"Show detail panel",onClick:()=>L(!0),children:"‹"}),qs&&g.jsx(MO,{tool:qs,onClose:()=>p(null)}),Xe&&g.jsx(zL,{onClose:()=>wt(!1)}),N&&(()=>{const B=n.current.agents.get(N);return B?g.jsx(SO,{agent:B,onClose:()=>_(null)}):null})(),y&&g.jsx(v3,{state:n.current,sessionId:y,onClose:()=>{E.current.add(y),EE(E.current),w(null)}}),b&&g.jsx(wL,{agentCount:Tr,onConfirm:()=>jr("confirmation"),onCancel:()=>k(!1)})]})}function ZD({live:e,everConnected:n}){const r=!e;return g.jsxs("div",{className:"empty-hero",children:[g.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[g.jsx("div",{className:"core"}),g.jsxs("div",{className:"orbit r1",children:[g.jsx("span",{className:"dot"}),g.jsx("span",{className:"dot b"})]}),g.jsxs("div",{className:"orbit r2",children:[g.jsx("span",{className:"dot"}),g.jsx("span",{className:"dot b"})]}),g.jsxs("div",{className:"orbit r3",children:[g.jsx("span",{className:"dot"}),g.jsx("span",{className:"dot b"})]})]}),r?g.jsxs(g.Fragment,{children:[g.jsx("h2",{children:n?"Disconnected from server":"Server unreachable"}),g.jsxs("p",{children:["The browser cannot reach ",g.jsx("code",{children:"/events"}),". Check that",g.jsx("code",{children:zt})," is still running in your terminal, then this page will resume automatically."]})]}):JD()]})}function JD(){return g.jsxs(g.Fragment,{children:[g.jsx("h2",{children:"Waiting for Claude Code or Codex"}),g.jsxs("p",{children:["Run ",g.jsx("code",{children:"claude"})," or ",g.jsx("code",{children:"codex"})," in any folder. As soon as a session sends an event, a node appears here and grows as subagents fork and tools are called."]}),g.jsxs("p",{className:"hint-row",children:["Not seeing anything? Make sure ",g.jsx("code",{children:zt})," is running and that hooks are installed in your Claude settings (",g.jsx("code",{children:"$CLAUDE_CONFIG_DIR"})," ","if you set it, otherwise ",g.jsx("code",{children:"~/.claude/settings.json"}),") and"," ",g.jsx("code",{children:"~/.codex/hooks.json"}),". (Codex requires"," ",g.jsx("code",{children:"/hooks"})," trust on first run.)"]})]})}function e5({count:e,workspace:n}){const r=bD(n);return g.jsxs(g.Fragment,{children:[g.jsx("h3",{children:"Detail"}),e===0?g.jsxs("div",{className:"hint",children:[r.lead,r.workspace!==null&&g.jsxs(g.Fragment,{children:[" ",g.jsx("code",{children:r.workspace}),r.tail]})]}):g.jsx("div",{className:"empty",children:"Click an agent to see its tools."}),g.jsx("h3",{style:{marginTop:4},children:"Shortcuts"}),g.jsxs("div",{className:"shortcuts",children:[g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"drag"}),g.jsx("span",{children:"move a node"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"/"}),g.jsx("span",{children:"focus search"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"space"}),g.jsx("span",{children:"pause / resume"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"J"}),g.jsx("span",{children:"next agent"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"K"}),g.jsx("span",{children:"previous agent"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"R"}),g.jsx("span",{children:"re-arrange"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"F"}),g.jsx("span",{children:"fit view"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"L"}),g.jsx("span",{children:"session list"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"H"}),g.jsx("span",{children:"usage history"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"U"}),g.jsx("span",{children:"usage panel"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"C"}),g.jsx("span",{children:"clear canvas"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"T"}),g.jsx("span",{children:"toggle theme"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"Esc"}),g.jsx("span",{children:"deselect"})]})]})]})}function t5({agent:e,now:n,onOpenTool:r,onShowSummary:i,onExportSession:o}){const l=(e.endedAt??n)-e.startedAt,u=Math.max(0,Math.floor(l/1e3)),c=u<60?`${u}s`:`${Math.floor(u/60)}m ${String(u%60).padStart(2,"0")}s`,h=fn(e.usage,e.model),p=h.total>0,d=e.usage.inputTokens+e.usage.outputTokens,m=new Map;for(const _ of e.tools){const S=kj(_.name);m.set(S,(m.get(S)??0)+1)}const y=e.tools.filter(_=>_.ok===!1).length,w=e.tools.filter(_=>!_.endedAt).length,N=Array.from(m.entries()).sort((_,S)=>S[1]-_[1]);return g.jsxs(g.Fragment,{children:[g.jsxs("header",{className:"detail-hero",children:[g.jsxs("div",{className:"hero-line",children:[g.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),g.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),g.jsxs("div",{className:"hero-meta",children:[g.jsx("span",{className:"hero-meta-item",children:e.kind}),g.jsx("span",{className:"hero-sep",children:"·"}),g.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:c}),e.model&&g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"hero-sep",children:"·"}),g.jsx("span",{className:"model-chip",title:e.model,children:li(e.model)})]})]}),p&&g.jsxs("div",{className:"hero-cost",children:[g.jsxs("div",{className:"hero-cost-headline",children:[g.jsx("span",{className:"hero-cost-value",children:Fe(h.total)}),g.jsx("span",{className:"hero-cost-label",children:"spend"})]}),g.jsx(n5,{cost:h})]}),g.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&i&&g.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>i(e.sessionId),title:"Reopen the end-of-session recap modal",children:"Show recap"}),o&&g.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>o(e.sessionId),title:"Download this session as JSON",children:"Export JSON"})]})]}),e.tools.length>0&&g.jsxs("section",{className:"detail-section",children:[g.jsx("h3",{children:"Activity"}),g.jsxs("div",{className:"activity-row",children:[g.jsxs("div",{className:"activity-counters",children:[g.jsxs("span",{className:"ac-item",children:[g.jsx("b",{children:e.toolCount})," calls"]}),w>0&&g.jsxs("span",{className:"ac-item ac-live",children:[g.jsx("b",{children:w})," live"]}),y>0&&g.jsxs("span",{className:"ac-item ac-err",children:[g.jsx("b",{children:y})," err"]})]}),g.jsx("div",{className:"cat-strip",children:N.map(([_,S])=>g.jsxs("span",{className:`cat-chip cat-${_}`,title:`${S} ${Cv[_]} call${S===1?"":"s"}`,children:[g.jsx("span",{className:"cat-emoji",children:Nv[_]}),g.jsx("span",{className:"cat-count",children:S})]},_))})]})]}),d>0&&g.jsxs("section",{className:"detail-section",children:[g.jsx("h3",{children:"Tokens"}),g.jsxs("div",{className:"tokens-grid",children:[g.jsxs("div",{children:[g.jsx("span",{className:"k",children:"in"}),g.jsx("b",{children:e.usage.inputTokens.toLocaleString()})]}),g.jsxs("div",{children:[g.jsx("span",{className:"k",children:"out"}),g.jsx("b",{children:e.usage.outputTokens.toLocaleString()})]}),g.jsxs("div",{children:[g.jsx("span",{className:"k",children:"cache r"}),g.jsx("b",{children:e.usage.cacheReadTokens.toLocaleString()})]}),g.jsxs("div",{children:[g.jsx("span",{className:"k",children:"cache c"}),g.jsx("b",{children:e.usage.cacheCreateTokens.toLocaleString()})]})]})]}),g.jsxs("section",{className:"detail-section",children:[g.jsx("h3",{children:"Identity"}),g.jsxs("div",{children:[e.cwd&&g.jsxs("div",{className:"row",children:[g.jsx("span",{className:"k",children:"cwd"}),g.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),g.jsxs("div",{className:"row",children:[g.jsx("span",{className:"k",children:"session"}),g.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&g.jsxs("div",{className:"row",children:[g.jsx("span",{className:"k",children:"parent"}),g.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&g.jsxs("section",{className:"detail-section",children:[g.jsxs("h3",{children:["Prompts ",g.jsx("span",{className:"section-count",children:e.prompts.length})]}),g.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((_,S)=>{const b=CD(_.at,n);return g.jsxs("div",{className:"prompt-entry",children:[g.jsx("div",{className:"prompt-time",title:b.title,children:b.label}),g.jsx("div",{className:"prompt-text",children:_.text})]},S)})})]}),g.jsxs("section",{className:"detail-section",children:[g.jsxs("h3",{children:["Tool calls ",g.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&g.jsx("div",{className:"empty",children:"No tool calls yet."}),g.jsx("div",{children:e.tools.slice().reverse().map(_=>g.jsx(r5,{t:_,now:n,onClick:()=>r(_.id)},_.id))})]})]})}function n5({cost:e}){const n=e.total;if(n<=0)return null;const r=(i,o,l)=>{if(i<=0)return null;const u=i/n*100;return g.jsx("span",{className:`cb-seg ${o}`,style:{width:`${u}%`},title:`${l}: ${Fe(i)} (${u.toFixed(0)}%)`},o)};return g.jsxs("div",{className:"cost-bar","aria-label":"Cost breakdown",children:[r(e.input,"cb-input","input"),r(e.output,"cb-output","output"),r(e.cacheRead,"cb-cache-r","cache read"),r(e.cacheWrite,"cb-cache-w","cache write")]})}function r5({t:e,now:n,onClick:r}){const i=e.endedAt==null?"inflight":e.ok===!1?"err":"done",o=(e.endedAt??n)-e.startedAt,l=e.endedAt==null?"…":o<1e3?`${o}ms`:`${(o/1e3).toFixed(1)}s`;return g.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:r,children:[g.jsxs("span",{className:"name",children:[g.jsx("span",{className:`status-dot ${i}`}),e.name]}),g.jsx("span",{style:{color:"var(--muted)"},children:l})]})}try{AL(window.localStorage)}catch{}const s5=FR.createRoot(document.getElementById("root"));s5.render(g.jsx(XD,{}));
|