agent-dag 1.34.2 → 1.34.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function r(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(o){if(o.ep)return;o.ep=!0;const l=r(o);fetch(o.href,l)}})();var zl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Av(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xd={exports:{}},ua={},_d={exports:{}},Le={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Rw;function Fj(){if(Rw)return Le;Rw=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(M){return M===null||typeof M!="object"?null:(M=m&&M[m]||M["@@iterator"],typeof M=="function"?M:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,_={};function b(M,V,Y){this.props=M,this.context=V,this.refs=_,this.updater=Y||w}b.prototype.isReactComponent={},b.prototype.setState=function(M,V){if(typeof M!="object"&&typeof M!="function"&&M!=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,M,V,"setState")},b.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function S(){}S.prototype=b.prototype;function k(M,V,Y){this.props=M,this.context=V,this.refs=_,this.updater=Y||w}var E=k.prototype=new S;E.constructor=k,N(E,b.prototype),E.isPureReactComponent=!0;var C=Array.isArray,I=Object.prototype.hasOwnProperty,P={current:null},A={key:!0,ref:!0,__self:!0,__source:!0};function U(M,V,Y){var H,J={},re=null,le=null;if(V!=null)for(H in V.ref!==void 0&&(le=V.ref),V.key!==void 0&&(re=""+V.key),V)I.call(V,H)&&!A.hasOwnProperty(H)&&(J[H]=V[H]);var fe=arguments.length-2;if(fe===1)J.children=Y;else if(1<fe){for(var te=Array(fe),ce=0;ce<fe;ce++)te[ce]=arguments[ce+2];J.children=te}if(M&&M.defaultProps)for(H in fe=M.defaultProps,fe)J[H]===void 0&&(J[H]=fe[H]);return{$$typeof:e,type:M,key:re,ref:le,props:J,_owner:P.current}}function L(M,V){return{$$typeof:e,type:M.type,key:V,ref:M.ref,props:M.props,_owner:M._owner}}function O(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function q(M){var V={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(Y){return V[Y]})}var G=/\/+/g;function F(M,V){return typeof M=="object"&&M!==null&&M.key!=null?q(""+M.key):V.toString(36)}function T(M,V,Y,H,J){var re=typeof M;(re==="undefined"||re==="boolean")&&(M=null);var le=!1;if(M===null)le=!0;else switch(re){case"string":case"number":le=!0;break;case"object":switch(M.$$typeof){case e:case n:le=!0}}if(le)return le=M,J=J(le),M=H===""?"."+F(le,0):H,C(J)?(Y="",M!=null&&(Y=M.replace(G,"$&/")+"/"),T(J,V,Y,"",function(ce){return ce})):J!=null&&(O(J)&&(J=L(J,Y+(!J.key||le&&le.key===J.key?"":(""+J.key).replace(G,"$&/")+"/")+M)),V.push(J)),1;if(le=0,H=H===""?".":H+":",C(M))for(var fe=0;fe<M.length;fe++){re=M[fe];var te=H+F(re,fe);le+=T(re,V,Y,te,J)}else if(te=y(M),typeof te=="function")for(M=te.call(M),fe=0;!(re=M.next()).done;)re=re.value,te=H+F(re,fe++),le+=T(re,V,Y,te,J);else if(re==="object")throw V=String(M),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.");return le}function B(M,V,Y){if(M==null)return M;var H=[],J=0;return T(M,H,"","",function(re){return V.call(Y,re,J++)}),H}function z(M){if(M._status===-1){var V=M._result;V=V(),V.then(function(Y){(M._status===0||M._status===-1)&&(M._status=1,M._result=Y)},function(Y){(M._status===0||M._status===-1)&&(M._status=2,M._result=Y)}),M._status===-1&&(M._status=0,M._result=V)}if(M._status===1)return M._result.default;throw M._result}var ne={current:null},Z={transition:null},$={ReactCurrentDispatcher:ne,ReactCurrentBatchConfig:Z,ReactCurrentOwner:P};function Q(){throw Error("act(...) is not supported in production builds of React.")}return Le.Children={map:B,forEach:function(M,V,Y){B(M,function(){V.apply(this,arguments)},Y)},count:function(M){var V=0;return B(M,function(){V++}),V},toArray:function(M){return B(M,function(V){return V})||[]},only:function(M){if(!O(M))throw Error("React.Children.only expected to receive a single React element child.");return M}},Le.Component=b,Le.Fragment=r,Le.Profiler=o,Le.PureComponent=k,Le.StrictMode=i,Le.Suspense=h,Le.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=$,Le.act=Q,Le.cloneElement=function(M,V,Y){if(M==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+M+".");var H=N({},M.props),J=M.key,re=M.ref,le=M._owner;if(V!=null){if(V.ref!==void 0&&(re=V.ref,le=P.current),V.key!==void 0&&(J=""+V.key),M.type&&M.type.defaultProps)var fe=M.type.defaultProps;for(te in V)I.call(V,te)&&!A.hasOwnProperty(te)&&(H[te]=V[te]===void 0&&fe!==void 0?fe[te]:V[te])}var te=arguments.length-2;if(te===1)H.children=Y;else if(1<te){fe=Array(te);for(var ce=0;ce<te;ce++)fe[ce]=arguments[ce+2];H.children=fe}return{$$typeof:e,type:M.type,key:J,ref:re,props:H,_owner:le}},Le.createContext=function(M){return M={$$typeof:u,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},M.Provider={$$typeof:l,_context:M},M.Consumer=M},Le.createElement=U,Le.createFactory=function(M){var V=U.bind(null,M);return V.type=M,V},Le.createRef=function(){return{current:null}},Le.forwardRef=function(M){return{$$typeof:c,render:M}},Le.isValidElement=O,Le.lazy=function(M){return{$$typeof:d,_payload:{_status:-1,_result:M},_init:z}},Le.memo=function(M,V){return{$$typeof:p,type:M,compare:V===void 0?null:V}},Le.startTransition=function(M){var V=Z.transition;Z.transition={};try{M()}finally{Z.transition=V}},Le.unstable_act=Q,Le.useCallback=function(M,V){return ne.current.useCallback(M,V)},Le.useContext=function(M){return ne.current.useContext(M)},Le.useDebugValue=function(){},Le.useDeferredValue=function(M){return ne.current.useDeferredValue(M)},Le.useEffect=function(M,V){return ne.current.useEffect(M,V)},Le.useId=function(){return ne.current.useId()},Le.useImperativeHandle=function(M,V,Y){return ne.current.useImperativeHandle(M,V,Y)},Le.useInsertionEffect=function(M,V){return ne.current.useInsertionEffect(M,V)},Le.useLayoutEffect=function(M,V){return ne.current.useLayoutEffect(M,V)},Le.useMemo=function(M,V){return ne.current.useMemo(M,V)},Le.useReducer=function(M,V,Y){return ne.current.useReducer(M,V,Y)},Le.useRef=function(M){return ne.current.useRef(M)},Le.useState=function(M){return ne.current.useState(M)},Le.useSyncExternalStore=function(M,V,Y){return ne.current.useSyncExternalStore(M,V,Y)},Le.useTransition=function(){return ne.current.useTransition()},Le.version="18.3.1",Le}var jw;function Ia(){return jw||(jw=1,_d.exports=Fj()),_d.exports}/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var Tw;function zj(){if(Tw)return ua;Tw=1;var e=Ia(),n=Symbol.for("react.element"),r=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function u(c,h,p){var d,m={},y=null,w=null;p!==void 0&&(y=""+p),h.key!==void 0&&(y=""+h.key),h.ref!==void 0&&(w=h.ref);for(d in h)i.call(h,d)&&!l.hasOwnProperty(d)&&(m[d]=h[d]);if(c&&c.defaultProps)for(d in h=c.defaultProps,h)m[d]===void 0&&(m[d]=h[d]);return{$$typeof:n,type:c,key:y,ref:w,props:m,_owner:o.current}}return ua.Fragment=r,ua.jsx=u,ua.jsxs=u,ua}var Aw;function Bj(){return Aw||(Aw=1,xd.exports=zj()),xd.exports}var g=Bj(),Bl={},bd={exports:{}},cn={},Sd={exports:{}},kd={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.min.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/var Iw;function Uj(){return Iw||(Iw=1,(function(e){function n(Z,$){var Q=Z.length;Z.push($);e:for(;0<Q;){var M=Q-1>>>1,V=Z[M];if(0<o(V,$))Z[M]=$,Z[Q]=V,Q=M;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],Q=Z.pop();if(Q!==$){Z[0]=Q;e:for(var M=0,V=Z.length,Y=V>>>1;M<Y;){var H=2*(M+1)-1,J=Z[H],re=H+1,le=Z[re];if(0>o(J,Q))re<V&&0>o(le,J)?(Z[M]=le,Z[re]=Q,M=re):(Z[M]=J,Z[H]=Q,M=H);else if(re<V&&0>o(le,Q))Z[M]=le,Z[re]=Q,M=re;else break e}}return $}function o(Z,$){var Q=Z.sortIndex-$.sortIndex;return Q!==0?Q: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,b=typeof setTimeout=="function"?setTimeout:null,S=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(I);else{var $=r(p);$!==null&&ne(C,$.startTime-Z)}}function I(Z,$){N=!1,_&&(_=!1,S(U),U=-1),w=!0;var Q=y;try{for(E($),m=r(h);m!==null&&(!(m.expirationTime>$)||Z&&!q());){var M=m.callback;if(typeof M=="function"){m.callback=null,y=m.priorityLevel;var V=M(m.expirationTime<=$);$=e.unstable_now(),typeof V=="function"?m.callback=V:m===r(h)&&i(h),E($)}else i(h);m=r(h)}if(m!==null)var Y=!0;else{var H=r(p);H!==null&&ne(C,H.startTime-$),Y=!1}return Y}finally{m=null,y=Q,w=!1}}var P=!1,A=null,U=-1,L=5,O=-1;function q(){return!(e.unstable_now()-O<L)}function G(){if(A!==null){var Z=e.unstable_now();O=Z;var $=!0;try{$=A(!0,Z)}finally{$?F():(P=!1,A=null)}}else P=!1}var F;if(typeof k=="function")F=function(){k(G)};else if(typeof MessageChannel<"u"){var T=new MessageChannel,B=T.port2;T.port1.onmessage=G,F=function(){B.postMessage(null)}}else F=function(){b(G,0)};function z(Z){A=Z,P||(P=!0,F())}function ne(Z,$){U=b(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(I))},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"):L=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 Q=y;y=$;try{return Z()}finally{y=Q}},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 Q=y;y=Z;try{return $()}finally{y=Q}},e.unstable_scheduleCallback=function(Z,$,Q){var M=e.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?M+Q:M):Q=M,Z){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=Q+V,Z={id:d++,callback:$,priorityLevel:Z,startTime:Q,expirationTime:V,sortIndex:-1},Q>M?(Z.sortIndex=Q,n(p,Z),r(h)===null&&Z===r(p)&&(_?(S(U),U=-1):_=!0,ne(C,Q-M))):(Z.sortIndex=V,n(h,Z),N||w||(N=!0,z(I))),Z},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(Z){var $=y;return function(){var Q=y;y=$;try{return Z.apply(this,arguments)}finally{y=Q}}}})(kd)),kd}var Mw;function Hj(){return Mw||(Mw=1,Sd.exports=Uj()),Sd.exports}/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.min.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var Ow;function Wj(){if(Ow)return cn;Ow=1;var e=Ia(),n=Hj();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,R){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=R}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){b[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];b[s]=new _(s,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){b[t]=new _(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){b[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){b[t]=new _(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){b[t]=new _(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){b[t]=new _(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){b[t]=new _(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){b[t]=new _(t,5,!1,t.toLowerCase(),null,!1,!1)});var S=/[\-:]([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(S,k);b[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(S,k);b[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(S,k);b[s]=new _(s,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){b[t]=new _(t,1,!1,t.toLowerCase(),null,!1,!1)}),b.xlinkHref=new _("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){b[t]=new _(t,1,!1,t.toLowerCase(),null,!0,!0)});function E(t,s,a,f){var v=b.hasOwnProperty(s)?b[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,I=Symbol.for("react.element"),P=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),U=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),O=Symbol.for("react.provider"),q=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),B=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 Q=Object.assign,M;function V(t){if(M===void 0)try{throw Error()}catch(a){var s=a.stack.trim().match(/\n( *(at )?)/);M=s&&s[1]||""}return`
|
|
34
|
+
`+M+t}var Y=!1;function H(t,s){if(!t||Y)return"";Y=!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(oe){var f=oe}Reflect.construct(t,[],s)}else{try{s.call()}catch(oe){f=oe}t.call(s.prototype)}else{try{throw Error()}catch(oe){f=oe}t()}}catch(oe){if(oe&&f&&typeof oe.stack=="string"){for(var v=oe.stack.split(`
|
|
35
|
+
`),x=f.stack.split(`
|
|
36
|
+
`),R=v.length-1,D=x.length-1;1<=R&&0<=D&&v[R]!==x[D];)D--;for(;1<=R&&0<=D;R--,D--)if(v[R]!==x[D]){if(R!==1||D!==1)do if(R--,D--,0>D||v[R]!==x[D]){var X=`
|
|
37
|
+
`+v[R].replace(" at new "," at ");return t.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",t.displayName)),X}while(1<=R&&0<=D);break}}}finally{Y=!1,Error.prepareStackTrace=a}return(t=t?t.displayName||t.name:"")?V(t):""}function J(t){switch(t.tag){case 5:return V(t.type);case 16:return V("Lazy");case 13:return V("Suspense");case 19:return V("SuspenseList");case 0:case 2:case 15:return t=H(t.type,!1),t;case 11:return t=H(t.type.render,!1),t;case 1:return t=H(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 A:return"Fragment";case P:return"Portal";case L:return"Profiler";case U:return"StrictMode";case F:return"Suspense";case T:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case q:return(t.displayName||"Context")+".Consumer";case O: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 B: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===U?"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(R){f=""+R,x.call(this,R)}}),Object.defineProperty(t,s,{enumerable:a.enumerable}),{getValue:function(){return f},setValue:function(R){f=""+R},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 Q({},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 Ke(t,s){s=s.checked,s!=null&&E(t,"checked",s,!1)}function we(t,s){Ke(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")?Be(t,s.type,a):s.hasOwnProperty("defaultValue")&&Be(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 Be(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 We(t,s){if(s.dangerouslySetInnerHTML!=null)throw Error(r(91));return Q({},s,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function $e(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 Je(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 Xe(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,Gt=(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 It(t,s){if(s){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=s;return}}t.textContent=s}var Ze={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(Ze).forEach(function(t){wt.forEach(function(s){s=s+t.charAt(0).toUpperCase()+t.substring(1),Ze[s]=Ze[t]})});function pt(t,s,a){return s==null||typeof s=="boolean"||s===""?"":a||typeof s!="number"||s===0||Ze.hasOwnProperty(t)&&Ze[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=Q({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 Yt(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 Mt(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 Kt=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,Xt=null,pn=null;function Sn(t){if(t=Yo(t)){if(typeof bn!="function")throw Error(r(280));var s=t.stateNode;s&&(s=nl(s),bn(t.stateNode,t.type,s))}}function Gr(t){Xt?pn?pn.push(t):pn=[t]:Xt=t}function ut(){if(Xt){var t=Xt,s=pn;if(pn=Xt=null,Sn(t),s)for(t=0;t<s.length;t++)Sn(s[t])}}function hi(t,s){return t(s)}function rr(){}var ks=!1;function pi(t,s,a){if(ks)return t(s,a);ks=!0;try{return hi(t,s,a)}finally{ks=!1,(Xt!==null||pn!==null)&&(rr(),ut())}}function Qt(t,s){var a=t.stateNode;if(a===null)return null;var f=nl(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 sr=!1;if(c)try{var wr={};Object.defineProperty(wr,"passive",{get:function(){sr=!0}}),window.addEventListener("test",wr,wr),window.removeEventListener("test",wr,wr)}catch{sr=!1}function No(t,s,a,f,v,x,R,D,X){var oe=Array.prototype.slice.call(arguments,3);try{s.apply(a,oe)}catch(pe){this.onError(pe)}}var ir=!1,xr=null,mn=!1,Yr=null,mi={onError:function(t){ir=!0,xr=t}};function Kr(t,s,a,f,v,x,R,D,X){ir=!1,xr=null,No.apply(mi,arguments)}function Es(t,s,a,f,v,x,R,D,X){if(Kr.apply(this,arguments),ir){if(ir){var oe=xr;ir=!1,xr=null}else throw Error(r(198));mn||(mn=!0,Yr=oe)}}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 Rt(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 R=!1,D=v.child;D;){if(D===a){R=!0,a=v,f=x;break}if(D===f){R=!0,f=v,a=x;break}D=D.sibling}if(!R){for(D=x.child;D;){if(D===a){R=!0,a=x,f=v;break}if(D===f){R=!0,f=x,a=v;break}D=D.sibling}if(!R)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 Zt(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 Ns=n.unstable_scheduleCallback,gi=n.unstable_cancelCallback,or=n.unstable_shouldYield,vi=n.unstable_requestPaint,et=n.unstable_now,Co=n.unstable_getCurrentPriorityLevel,br=n.unstable_ImmediatePriority,Cs=n.unstable_UserBlockingPriority,ar=n.unstable_NormalPriority,$n=n.unstable_LowPriority,yi=n.unstable_IdlePriority,Ot=null,zt=null;function Sr(t){if(zt&&typeof zt.onCommitFiberRoot=="function")try{zt.onCommitFiberRoot(Ot,t,void 0,(t.current.flags&128)===128)}catch{}}var nn=Math.clz32?Math.clz32:kr,wi=Math.log,Ro=Math.LN2;function kr(t){return t>>>=0,t===0?32:31-(wi(t)/Ro|0)|0}var Rs=64,js=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,R=a&268435455;if(R!==0){var D=R&~v;D!==0?f=Zr(D):(x&=R,x!==0&&(f=Zr(x)))}else R=a&~v,R!==0?f=Zr(R):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-nn(s),v=1<<a,f|=t[a],s&=~v;return f}function jo(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 R=31-nn(x),D=1<<R,X=v[R];X===-1?((D&a)===0||(D&f)!==0)&&(v[R]=jo(D,s)):X<=s&&(t.expiredLanes|=D),x&=~D}}function _i(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Ua(){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-nn(s),t[s]=a}function Qu(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-nn(a),x=1<<v;s[v]=0,f[v]=-1,t[v]=-1,a&=~x}}function Bt(t,s){var a=t.entangledLanes|=s;for(t=t.entanglements;a;){var f=31-nn(a),v=1<<f;v&s|t[f]&s&&(t[f]|=s),a&=~v}}var Ge=0;function Si(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var Er,Nr,ki,lr,To,ts=!1,Ts=[],ur=null,Dn=null,cr=null,As=new Map,Cr=new Map,Pt=[],Ao="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 Io(t,s){switch(t){case"focusin":case"focusout":ur=null;break;case"dragenter":case"dragleave":Dn=null;break;case"mouseover":case"mouseout":cr=null;break;case"pointerover":case"pointerout":As.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Cr.delete(s.pointerId)}}function Is(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=Yo(s),s!==null&&Nr(s)),t):(t.eventSystemFlags|=f,s=t.targetContainers,v!==null&&s.indexOf(v)===-1&&s.push(v),t)}function Zu(t,s,a,f,v){switch(s){case"focusin":return ur=Is(ur,t,s,a,f,v),!0;case"dragenter":return Dn=Is(Dn,t,s,a,f,v),!0;case"mouseover":return cr=Is(cr,t,s,a,f,v),!0;case"pointerover":var x=v.pointerId;return As.set(x,Is(As.get(x)||null,t,s,a,f,v)),!0;case"gotpointercapture":return x=v.pointerId,Cr.set(x,Is(Cr.get(x)||null,t,s,a,f,v)),!0}return!1}function Mo(t){var s=Bs(t.target);if(s!==null){var a=gn(s);if(a!==null){if(s=a.tag,s===13){if(s=Rt(a),s!==null){t.blockedOn=s,To(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 Ms(t){if(t.blockedOn!==null)return!1;for(var s=t.targetContainers;0<s.length;){var a=Ls(t.domEventName,t.eventSystemFlags,s[0],t.nativeEvent);if(a===null){a=t.nativeEvent;var f=new a.constructor(a.type,a);Kt=f,a.target.dispatchEvent(f),Kt=null}else return s=Yo(a),s!==null&&Nr(s),t.blockedOn=a,!1;s.shift()}return!0}function Fn(t,s,a){Ms(t)&&a.delete(s)}function Ju(){ts=!1,ur!==null&&Ms(ur)&&(ur=null),Dn!==null&&Ms(Dn)&&(Dn=null),cr!==null&&Ms(cr)&&(cr=null),As.forEach(Fn),Cr.forEach(Fn)}function ns(t,s){t.blockedOn===s&&(t.blockedOn=null,ts||(ts=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Ju)))}function Os(t){function s(v){return ns(v,t)}if(0<Ts.length){ns(Ts[0],t);for(var a=1;a<Ts.length;a++){var f=Ts[a];f.blockedOn===t&&(f.blockedOn=null)}}for(ur!==null&&ns(ur,t),Dn!==null&&ns(Dn,t),cr!==null&&ns(cr,t),As.forEach(s),Cr.forEach(s),a=0;a<Pt.length;a++)f=Pt[a],f.blockedOn===t&&(f.blockedOn=null);for(;0<Pt.length&&(a=Pt[0],a.blockedOn===null);)Mo(a),a.blockedOn===null&&Pt.shift()}var kn=C.ReactCurrentBatchConfig,En=!0;function Ei(t,s,a,f){var v=Ge,x=kn.transition;kn.transition=null;try{Ge=1,Oo(t,s,a,f)}finally{Ge=v,kn.transition=x}}function Ps(t,s,a,f){var v=Ge,x=kn.transition;kn.transition=null;try{Ge=4,Oo(t,s,a,f)}finally{Ge=v,kn.transition=x}}function Oo(t,s,a,f){if(En){var v=Ls(t,s,a,f);if(v===null)cc(t,s,f,St,a),Io(t,f);else if(Zu(v,t,s,a,f))f.stopPropagation();else if(Io(t,f),s&4&&-1<Ao.indexOf(t)){for(;v!==null;){var x=Yo(v);if(x!==null&&Er(x),x=Ls(t,s,a,f),x===null&&cc(t,s,f,St,a),x===v)break;v=x}v!==null&&f.stopPropagation()}else cc(t,s,f,null,a)}}var St=null;function Ls(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=Rt(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 Po(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(Co()){case br:return 1;case Cs:return 4;case ar:case $n:return 16;case yi:return 536870912;default:return 16}default:return 16}}var zn=null,Ni=null,Rr=null;function Ci(){if(Rr)return Rr;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 R=a-t;for(f=1;f<=R&&s[a-f]===v[x-f];f++);return Rr=v.slice(t,1<f?1-f:void 0)}function qs(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 jr(){return!0}function Lo(){return!1}function Lt(t){function s(a,f,v,x,R){this._reactName=a,this._targetInst=v,this.type=f,this.nativeEvent=x,this.target=R,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)?jr:Lo,this.isPropagationStopped=Lo,this}return Q(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=jr)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=jr)},persist:function(){},isPersistent:jr}),s}var Tr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ar=Lt(Tr),$s=Q({},Tr,{view:0,detail:0}),Bn=Lt($s),Ri,ji,Ds,Ti=Q({},$s,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ue,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!==Ds&&(Ds&&t.type==="mousemove"?(Ri=t.screenX-Ds.screenX,ji=t.screenY-Ds.screenY):ji=Ri=0,Ds=t),Ri)},movementY:function(t){return"movementY"in t?t.movementY:ji}}),qo=Lt(Ti),rn=Q({},Ti,{dataTransfer:0}),Ha=Lt(rn),Wa=Q({},$s,{relatedTarget:0}),Ai=Lt(Wa),Va=Q({},Tr,{animationName:0,elapsedTime:0,pseudoElement:0}),W=Lt(Va),K=Q({},Tr,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),ae=Lt(K),de=Q({},Tr,{data:0}),xe=Lt(de),Ee={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Pe={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"},De={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ye(t){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(t):(t=De[t])?!!s[t]:!1}function Ue(){return Ye}var Fe=Q({},$s,{key:function(t){if(t.key){var s=Ee[t.key]||t.key;if(s!=="Unidentified")return s}return t.type==="keypress"?(t=qs(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Pe[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ue,charCode:function(t){return t.type==="keypress"?qs(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?qs(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Nn=Lt(Fe),Fs=Q({},Ti,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ii=Lt(Fs),zs=Q({},$s,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ue}),$o=Lt(zs),Ga=Q({},Tr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Mi=Lt(Ga),Un=Q({},Ti,{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}),xt=Lt(Un),Ya=[9,13,27,32],ec=c&&"CompositionEvent"in window,Do=null;c&&"documentMode"in document&&(Do=document.documentMode);var LR=c&&"TextEvent"in window&&!Do,xy=c&&(!ec||Do&&8<Do&&11>=Do),_y=" ",by=!1;function Sy(t,s){switch(t){case"keyup":return Ya.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ky(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Oi=!1;function qR(t,s){switch(t){case"compositionend":return ky(s);case"keypress":return s.which!==32?null:(by=!0,_y);case"textInput":return t=s.data,t===_y&&by?null:t;default:return null}}function $R(t,s){if(Oi)return t==="compositionend"||!ec&&Sy(t,s)?(t=Ci(),Rr=Ni=zn=null,Oi=!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 xy&&s.locale!=="ko"?null:s.data;default:return null}}var DR={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 Ey(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s==="input"?!!DR[t.type]:s==="textarea"}function Ny(t,s,a,f){Gr(f),s=Ja(s,"onChange"),0<s.length&&(a=new Ar("onChange","change",null,a,f),t.push({event:a,listeners:s}))}var Fo=null,zo=null;function FR(t){Hy(t,0)}function Ka(t){var s=Di(t);if(ve(s))return t}function zR(t,s){if(t==="change")return s}var Cy=!1;if(c){var tc;if(c){var nc="oninput"in document;if(!nc){var Ry=document.createElement("div");Ry.setAttribute("oninput","return;"),nc=typeof Ry.oninput=="function"}tc=nc}else tc=!1;Cy=tc&&(!document.documentMode||9<document.documentMode)}function jy(){Fo&&(Fo.detachEvent("onpropertychange",Ty),zo=Fo=null)}function Ty(t){if(t.propertyName==="value"&&Ka(zo)){var s=[];Ny(s,zo,t,yr(t)),pi(FR,s)}}function BR(t,s,a){t==="focusin"?(jy(),Fo=s,zo=a,Fo.attachEvent("onpropertychange",Ty)):t==="focusout"&&jy()}function UR(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Ka(zo)}function HR(t,s){if(t==="click")return Ka(s)}function WR(t,s){if(t==="input"||t==="change")return Ka(s)}function VR(t,s){return t===s&&(t!==0||1/t===1/s)||t!==t&&s!==s}var Hn=typeof Object.is=="function"?Object.is:VR;function Bo(t,s){if(Hn(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)||!Hn(t[v],s[v]))return!1}return!0}function Ay(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Iy(t,s){var a=Ay(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=Ay(a)}}function My(t,s){return t&&s?t===s?!0:t&&t.nodeType===3?!1:s&&s.nodeType===3?My(t,s.parentNode):"contains"in t?t.contains(s):t.compareDocumentPosition?!!(t.compareDocumentPosition(s)&16):!1:!1}function Oy(){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 rc(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 GR(t){var s=Oy(),a=t.focusedElem,f=t.selectionRange;if(s!==a&&a&&a.ownerDocument&&My(a.ownerDocument.documentElement,a)){if(f!==null&&rc(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=Iy(a,x);var R=Iy(a,f);v&&R&&(t.rangeCount!==1||t.anchorNode!==v.node||t.anchorOffset!==v.offset||t.focusNode!==R.node||t.focusOffset!==R.offset)&&(s=s.createRange(),s.setStart(v.node,v.offset),t.removeAllRanges(),x>f?(t.addRange(s),t.extend(R.node,R.offset)):(s.setEnd(R.node,R.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 YR=c&&"documentMode"in document&&11>=document.documentMode,Pi=null,sc=null,Uo=null,ic=!1;function Py(t,s,a){var f=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;ic||Pi==null||Pi!==Te(f)||(f=Pi,"selectionStart"in f&&rc(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}),Uo&&Bo(Uo,f)||(Uo=f,f=Ja(sc,"onSelect"),0<f.length&&(s=new Ar("onSelect","select",null,s,a),t.push({event:s,listeners:f}),s.target=Pi)))}function Xa(t,s){var a={};return a[t.toLowerCase()]=s.toLowerCase(),a["Webkit"+t]="webkit"+s,a["Moz"+t]="moz"+s,a}var Li={animationend:Xa("Animation","AnimationEnd"),animationiteration:Xa("Animation","AnimationIteration"),animationstart:Xa("Animation","AnimationStart"),transitionend:Xa("Transition","TransitionEnd")},oc={},Ly={};c&&(Ly=document.createElement("div").style,"AnimationEvent"in window||(delete Li.animationend.animation,delete Li.animationiteration.animation,delete Li.animationstart.animation),"TransitionEvent"in window||delete Li.transitionend.transition);function Qa(t){if(oc[t])return oc[t];if(!Li[t])return t;var s=Li[t],a;for(a in s)if(s.hasOwnProperty(a)&&a in Ly)return oc[t]=s[a];return t}var qy=Qa("animationend"),$y=Qa("animationiteration"),Dy=Qa("animationstart"),Fy=Qa("transitionend"),zy=new Map,By="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 rs(t,s){zy.set(t,s),l(s,[t])}for(var ac=0;ac<By.length;ac++){var lc=By[ac],KR=lc.toLowerCase(),XR=lc[0].toUpperCase()+lc.slice(1);rs(KR,"on"+XR)}rs(qy,"onAnimationEnd"),rs($y,"onAnimationIteration"),rs(Dy,"onAnimationStart"),rs("dblclick","onDoubleClick"),rs("focusin","onFocus"),rs("focusout","onBlur"),rs(Fy,"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 Ho="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(" "),QR=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ho));function Uy(t,s,a){var f=t.type||"unknown-event";t.currentTarget=a,Es(f,s,void 0,t),t.currentTarget=null}function Hy(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 R=f.length-1;0<=R;R--){var D=f[R],X=D.instance,oe=D.currentTarget;if(D=D.listener,X!==x&&v.isPropagationStopped())break e;Uy(v,D,oe),x=X}else for(R=0;R<f.length;R++){if(D=f[R],X=D.instance,oe=D.currentTarget,D=D.listener,X!==x&&v.isPropagationStopped())break e;Uy(v,D,oe),x=X}}}if(mn)throw t=Yr,mn=!1,Yr=null,t}function nt(t,s){var a=s[gc];a===void 0&&(a=s[gc]=new Set);var f=t+"__bubble";a.has(f)||(Wy(s,t,2,!1),a.add(f))}function uc(t,s,a){var f=0;s&&(f|=4),Wy(a,t,f,s)}var Za="_reactListening"+Math.random().toString(36).slice(2);function Wo(t){if(!t[Za]){t[Za]=!0,i.forEach(function(a){a!=="selectionchange"&&(QR.has(a)||uc(a,!1,t),uc(a,!0,t))});var s=t.nodeType===9?t:t.ownerDocument;s===null||s[Za]||(s[Za]=!0,uc("selectionchange",!1,s))}}function Wy(t,s,a,f){switch(Po(s)){case 1:var v=Ei;break;case 4:v=Ps;break;default:v=Oo}a=v.bind(null,s,a,t),v=void 0,!sr||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 cc(t,s,a,f,v){var x=f;if((s&1)===0&&(s&2)===0&&f!==null)e:for(;;){if(f===null)return;var R=f.tag;if(R===3||R===4){var D=f.stateNode.containerInfo;if(D===v||D.nodeType===8&&D.parentNode===v)break;if(R===4)for(R=f.return;R!==null;){var X=R.tag;if((X===3||X===4)&&(X=R.stateNode.containerInfo,X===v||X.nodeType===8&&X.parentNode===v))return;R=R.return}for(;D!==null;){if(R=Bs(D),R===null)return;if(X=R.tag,X===5||X===6){f=x=R;continue e}D=D.parentNode}}f=f.return}pi(function(){var oe=x,pe=yr(a),me=[];e:{var he=zy.get(t);if(he!==void 0){var be=Ar,Ne=t;switch(t){case"keypress":if(qs(a)===0)break e;case"keydown":case"keyup":be=Nn;break;case"focusin":Ne="focus",be=Ai;break;case"focusout":Ne="blur",be=Ai;break;case"beforeblur":case"afterblur":be=Ai;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=qo;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=$o;break;case qy:case $y:case Dy:be=W;break;case Fy:be=Mi;break;case"scroll":be=Bn;break;case"wheel":be=xt;break;case"copy":case"cut":case"paste":be=ae;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":be=Ii}var Re=(s&4)!==0,gt=!Re&&t==="scroll",se=Re?he!==null?he+"Capture":null:he;Re=[];for(var ee=oe,ie;ee!==null;){ie=ee;var ge=ie.stateNode;if(ie.tag===5&&ge!==null&&(ie=ge,se!==null&&(ge=Qt(ee,se),ge!=null&&Re.push(Vo(ee,ge,ie)))),gt)break;ee=ee.return}0<Re.length&&(he=new be(he,Ne,null,a,pe),me.push({event:he,listeners:Re}))}}if((s&7)===0){e:{if(he=t==="mouseover"||t==="pointerover",be=t==="mouseout"||t==="pointerout",he&&a!==Kt&&(Ne=a.relatedTarget||a.fromElement)&&(Bs(Ne)||Ne[Ir]))break e;if((be||he)&&(he=pe.window===pe?pe:(he=pe.ownerDocument)?he.defaultView||he.parentWindow:window,be?(Ne=a.relatedTarget||a.toElement,be=oe,Ne=Ne?Bs(Ne):null,Ne!==null&&(gt=gn(Ne),Ne!==gt||Ne.tag!==5&&Ne.tag!==6)&&(Ne=null)):(be=null,Ne=oe),be!==Ne)){if(Re=qo,ge="onMouseLeave",se="onMouseEnter",ee="mouse",(t==="pointerout"||t==="pointerover")&&(Re=Ii,ge="onPointerLeave",se="onPointerEnter",ee="pointer"),gt=be==null?he:Di(be),ie=Ne==null?he:Di(Ne),he=new Re(ge,ee+"leave",be,a,pe),he.target=gt,he.relatedTarget=ie,ge=null,Bs(pe)===oe&&(Re=new Re(se,ee+"enter",Ne,a,pe),Re.target=ie,Re.relatedTarget=gt,ge=Re),gt=ge,be&&Ne)t:{for(Re=be,se=Ne,ee=0,ie=Re;ie;ie=qi(ie))ee++;for(ie=0,ge=se;ge;ge=qi(ge))ie++;for(;0<ee-ie;)Re=qi(Re),ee--;for(;0<ie-ee;)se=qi(se),ie--;for(;ee--;){if(Re===se||se!==null&&Re===se.alternate)break t;Re=qi(Re),se=qi(se)}Re=null}else Re=null;be!==null&&Vy(me,he,be,Re,!1),Ne!==null&>!==null&&Vy(me,gt,Ne,Re,!0)}}e:{if(he=oe?Di(oe):window,be=he.nodeName&&he.nodeName.toLowerCase(),be==="select"||be==="input"&&he.type==="file")var je=zR;else if(Ey(he))if(Cy)je=WR;else{je=UR;var Ie=BR}else(be=he.nodeName)&&be.toLowerCase()==="input"&&(he.type==="checkbox"||he.type==="radio")&&(je=HR);if(je&&(je=je(t,oe))){Ny(me,je,a,pe);break e}Ie&&Ie(t,he,oe),t==="focusout"&&(Ie=he._wrapperState)&&Ie.controlled&&he.type==="number"&&Be(he,"number",he.value)}switch(Ie=oe?Di(oe):window,t){case"focusin":(Ey(Ie)||Ie.contentEditable==="true")&&(Pi=Ie,sc=oe,Uo=null);break;case"focusout":Uo=sc=Pi=null;break;case"mousedown":ic=!0;break;case"contextmenu":case"mouseup":case"dragend":ic=!1,Py(me,a,pe);break;case"selectionchange":if(YR)break;case"keydown":case"keyup":Py(me,a,pe)}var Me;if(ec)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 Oi?Sy(t,a)&&(Oe="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(Oe="onCompositionStart");Oe&&(xy&&a.locale!=="ko"&&(Oi||Oe!=="onCompositionStart"?Oe==="onCompositionEnd"&&Oi&&(Me=Ci()):(zn=pe,Ni="value"in zn?zn.value:zn.textContent,Oi=!0)),Ie=Ja(oe,Oe),0<Ie.length&&(Oe=new xe(Oe,t,null,a,pe),me.push({event:Oe,listeners:Ie}),Me?Oe.data=Me:(Me=ky(a),Me!==null&&(Oe.data=Me)))),(Me=LR?qR(t,a):$R(t,a))&&(oe=Ja(oe,"onBeforeInput"),0<oe.length&&(pe=new xe("onBeforeInput","beforeinput",null,a,pe),me.push({event:pe,listeners:oe}),pe.data=Me))}Hy(me,s)})}function Vo(t,s,a){return{instance:t,listener:s,currentTarget:a}}function Ja(t,s){for(var a=s+"Capture",f=[];t!==null;){var v=t,x=v.stateNode;v.tag===5&&x!==null&&(v=x,x=Qt(t,a),x!=null&&f.unshift(Vo(t,x,v)),x=Qt(t,s),x!=null&&f.push(Vo(t,x,v))),t=t.return}return f}function qi(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Vy(t,s,a,f,v){for(var x=s._reactName,R=[];a!==null&&a!==f;){var D=a,X=D.alternate,oe=D.stateNode;if(X!==null&&X===f)break;D.tag===5&&oe!==null&&(D=oe,v?(X=Qt(a,x),X!=null&&R.unshift(Vo(a,X,D))):v||(X=Qt(a,x),X!=null&&R.push(Vo(a,X,D)))),a=a.return}R.length!==0&&t.push({event:s,listeners:R})}var ZR=/\r\n?/g,JR=/\u0000|\uFFFD/g;function Gy(t){return(typeof t=="string"?t:""+t).replace(ZR,`
|
|
38
|
+
`).replace(JR,"")}function el(t,s,a){if(s=Gy(s),Gy(t)!==s&&a)throw Error(r(425))}function tl(){}var dc=null,fc=null;function hc(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 pc=typeof setTimeout=="function"?setTimeout:void 0,ej=typeof clearTimeout=="function"?clearTimeout:void 0,Yy=typeof Promise=="function"?Promise:void 0,tj=typeof queueMicrotask=="function"?queueMicrotask:typeof Yy<"u"?function(t){return Yy.resolve(null).then(t).catch(nj)}:pc;function nj(t){setTimeout(function(){throw t})}function mc(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 ss(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 Ky(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 $i=Math.random().toString(36).slice(2),dr="__reactFiber$"+$i,Go="__reactProps$"+$i,Ir="__reactContainer$"+$i,gc="__reactEvents$"+$i,rj="__reactListeners$"+$i,sj="__reactHandles$"+$i;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=Ky(t);t!==null;){if(a=t[dr])return a;t=Ky(t)}return s}t=a,a=t.parentNode}return null}function Yo(t){return t=t[dr]||t[Ir],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Di(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(r(33))}function nl(t){return t[Go]||null}var vc=[],Fi=-1;function is(t){return{current:t}}function rt(t){0>Fi||(t.current=vc[Fi],vc[Fi]=null,Fi--)}function tt(t,s){Fi++,vc[Fi]=t.current,t.current=s}var os={},Ut=is(os),sn=is(!1),Us=os;function zi(t,s){var a=t.type.contextTypes;if(!a)return os;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 rl(){rt(sn),rt(Ut)}function Xy(t,s,a){if(Ut.current!==os)throw Error(r(168));tt(Ut,s),tt(sn,a)}function Qy(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 Q({},a,f)}function sl(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||os,Us=Ut.current,tt(Ut,t),tt(sn,sn.current),!0}function Zy(t,s,a){var f=t.stateNode;if(!f)throw Error(r(169));a?(t=Qy(t,s,Us),f.__reactInternalMemoizedMergedChildContext=t,rt(sn),rt(Ut),tt(Ut,t)):rt(sn),tt(sn,a)}var Mr=null,il=!1,yc=!1;function Jy(t){Mr===null?Mr=[t]:Mr.push(t)}function ij(t){il=!0,Jy(t)}function as(){if(!yc&&Mr!==null){yc=!0;var t=0,s=Ge;try{var a=Mr;for(Ge=1;t<a.length;t++){var f=a[t];do f=f(!0);while(f!==null)}Mr=null,il=!1}catch(v){throw Mr!==null&&(Mr=Mr.slice(t+1)),Ns(br,as),v}finally{Ge=s,yc=!1}}return null}var Bi=[],Ui=0,ol=null,al=0,Cn=[],Rn=0,Hs=null,Or=1,Pr="";function Ws(t,s){Bi[Ui++]=al,Bi[Ui++]=ol,ol=t,al=s}function e0(t,s,a){Cn[Rn++]=Or,Cn[Rn++]=Pr,Cn[Rn++]=Hs,Hs=t;var f=Or;t=Pr;var v=32-nn(f)-1;f&=~(1<<v),a+=1;var x=32-nn(s)+v;if(30<x){var R=v-v%5;x=(f&(1<<R)-1).toString(32),f>>=R,v-=R,Or=1<<32-nn(s)+v|a<<v|f,Pr=x+t}else Or=1<<x|a<<v|f,Pr=t}function wc(t){t.return!==null&&(Ws(t,1),e0(t,1,0))}function xc(t){for(;t===ol;)ol=Bi[--Ui],Bi[Ui]=null,al=Bi[--Ui],Bi[Ui]=null;for(;t===Hs;)Hs=Cn[--Rn],Cn[Rn]=null,Pr=Cn[--Rn],Cn[Rn]=null,Or=Cn[--Rn],Cn[Rn]=null}var vn=null,yn=null,st=!1,Wn=null;function t0(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 n0(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=ss(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:Or,overflow:Pr}: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 _c(t){return(t.mode&1)!==0&&(t.flags&128)===0}function bc(t){if(st){var s=yn;if(s){var a=s;if(!n0(t,s)){if(_c(t))throw Error(r(418));s=ss(a.nextSibling);var f=vn;s&&n0(t,s)?t0(f,a):(t.flags=t.flags&-4097|2,st=!1,vn=t)}}else{if(_c(t))throw Error(r(418));t.flags=t.flags&-4097|2,st=!1,vn=t}}}function r0(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;vn=t}function ll(t){if(t!==vn)return!1;if(!st)return r0(t),st=!0,!1;var s;if((s=t.tag!==3)&&!(s=t.tag!==5)&&(s=t.type,s=s!=="head"&&s!=="body"&&!hc(t.type,t.memoizedProps)),s&&(s=yn)){if(_c(t))throw s0(),Error(r(418));for(;s;)t0(t,s),s=ss(s.nextSibling)}if(r0(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=ss(t.nextSibling);break e}s--}else a!=="$"&&a!=="$!"&&a!=="$?"||s++}t=t.nextSibling}yn=null}}else yn=vn?ss(t.stateNode.nextSibling):null;return!0}function s0(){for(var t=yn;t;)t=ss(t.nextSibling)}function Hi(){yn=vn=null,st=!1}function Sc(t){Wn===null?Wn=[t]:Wn.push(t)}var oj=C.ReactCurrentBatchConfig;function Ko(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(R){var D=v.refs;R===null?delete D[x]:D[x]=R},s._stringRef=x,s)}if(typeof t!="string")throw Error(r(284));if(!a._owner)throw Error(r(290,t))}return t}function ul(t,s){throw t=Object.prototype.toString.call(s),Error(r(31,t==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":t))}function i0(t){var s=t._init;return s(t._payload)}function o0(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=ms(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 R(se){return t&&se.alternate===null&&(se.flags|=2),se}function D(se,ee,ie,ge){return ee===null||ee.tag!==6?(ee=pd(ie,se.mode,ge),ee.return=se,ee):(ee=v(ee,ie),ee.return=se,ee)}function X(se,ee,ie,ge){var je=ie.type;return je===A?pe(se,ee,ie.props.children,ge,ie.key):ee!==null&&(ee.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===z&&i0(je)===ee.type)?(ge=v(ee,ie.props),ge.ref=Ko(se,ee,ie),ge.return=se,ge):(ge=Ml(ie.type,ie.key,ie.props,null,se.mode,ge),ge.ref=Ko(se,ee,ie),ge.return=se,ge)}function oe(se,ee,ie,ge){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==ie.containerInfo||ee.stateNode.implementation!==ie.implementation?(ee=md(ie,se.mode,ge),ee.return=se,ee):(ee=v(ee,ie.children||[]),ee.return=se,ee)}function pe(se,ee,ie,ge,je){return ee===null||ee.tag!==7?(ee=Js(ie,se.mode,ge,je),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=pd(""+ee,se.mode,ie),ee.return=se,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case I:return ie=Ml(ee.type,ee.key,ee.props,null,se.mode,ie),ie.ref=Ko(se,null,ee),ie.return=se,ie;case P:return ee=md(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;ul(se,ee)}return null}function he(se,ee,ie,ge){var je=ee!==null?ee.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number")return je!==null?null:D(se,ee,""+ie,ge);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case I:return ie.key===je?X(se,ee,ie,ge):null;case P:return ie.key===je?oe(se,ee,ie,ge):null;case z:return je=ie._init,he(se,ee,je(ie._payload),ge)}if(ft(ie)||$(ie))return je!==null?null:pe(se,ee,ie,ge,null);ul(se,ie)}return null}function be(se,ee,ie,ge,je){if(typeof ge=="string"&&ge!==""||typeof ge=="number")return se=se.get(ie)||null,D(ee,se,""+ge,je);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case I:return se=se.get(ge.key===null?ie:ge.key)||null,X(ee,se,ge,je);case P:return se=se.get(ge.key===null?ie:ge.key)||null,oe(ee,se,ge,je);case z:var Ie=ge._init;return be(se,ee,ie,Ie(ge._payload),je)}if(ft(ge)||$(ge))return se=se.get(ie)||null,pe(ee,se,ge,je,null);ul(ee,ge)}return null}function Ne(se,ee,ie,ge){for(var je=null,Ie=null,Me=ee,Oe=ee=0,At=null;Me!==null&&Oe<ie.length;Oe++){Me.index>Oe?(At=Me,Me=null):At=Me.sibling;var Ve=he(se,Me,ie[Oe],ge);if(Ve===null){Me===null&&(Me=At);break}t&&Me&&Ve.alternate===null&&s(se,Me),ee=x(Ve,ee,Oe),Ie===null?je=Ve:Ie.sibling=Ve,Ie=Ve,Me=At}if(Oe===ie.length)return a(se,Me),st&&Ws(se,Oe),je;if(Me===null){for(;Oe<ie.length;Oe++)Me=me(se,ie[Oe],ge),Me!==null&&(ee=x(Me,ee,Oe),Ie===null?je=Me:Ie.sibling=Me,Ie=Me);return st&&Ws(se,Oe),je}for(Me=f(se,Me);Oe<ie.length;Oe++)At=be(Me,se,Oe,ie[Oe],ge),At!==null&&(t&&At.alternate!==null&&Me.delete(At.key===null?Oe:At.key),ee=x(At,ee,Oe),Ie===null?je=At:Ie.sibling=At,Ie=At);return t&&Me.forEach(function(gs){return s(se,gs)}),st&&Ws(se,Oe),je}function Re(se,ee,ie,ge){var je=$(ie);if(typeof je!="function")throw Error(r(150));if(ie=je.call(ie),ie==null)throw Error(r(151));for(var Ie=je=null,Me=ee,Oe=ee=0,At=null,Ve=ie.next();Me!==null&&!Ve.done;Oe++,Ve=ie.next()){Me.index>Oe?(At=Me,Me=null):At=Me.sibling;var gs=he(se,Me,Ve.value,ge);if(gs===null){Me===null&&(Me=At);break}t&&Me&&gs.alternate===null&&s(se,Me),ee=x(gs,ee,Oe),Ie===null?je=gs:Ie.sibling=gs,Ie=gs,Me=At}if(Ve.done)return a(se,Me),st&&Ws(se,Oe),je;if(Me===null){for(;!Ve.done;Oe++,Ve=ie.next())Ve=me(se,Ve.value,ge),Ve!==null&&(ee=x(Ve,ee,Oe),Ie===null?je=Ve:Ie.sibling=Ve,Ie=Ve);return st&&Ws(se,Oe),je}for(Me=f(se,Me);!Ve.done;Oe++,Ve=ie.next())Ve=be(Me,se,Oe,Ve.value,ge),Ve!==null&&(t&&Ve.alternate!==null&&Me.delete(Ve.key===null?Oe:Ve.key),ee=x(Ve,ee,Oe),Ie===null?je=Ve:Ie.sibling=Ve,Ie=Ve);return t&&Me.forEach(function(Dj){return s(se,Dj)}),st&&Ws(se,Oe),je}function gt(se,ee,ie,ge){if(typeof ie=="object"&&ie!==null&&ie.type===A&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case I:e:{for(var je=ie.key,Ie=ee;Ie!==null;){if(Ie.key===je){if(je=ie.type,je===A){if(Ie.tag===7){a(se,Ie.sibling),ee=v(Ie,ie.props.children),ee.return=se,se=ee;break e}}else if(Ie.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===z&&i0(je)===Ie.type){a(se,Ie.sibling),ee=v(Ie,ie.props),ee.ref=Ko(se,Ie,ie),ee.return=se,se=ee;break e}a(se,Ie);break}else s(se,Ie);Ie=Ie.sibling}ie.type===A?(ee=Js(ie.props.children,se.mode,ge,ie.key),ee.return=se,se=ee):(ge=Ml(ie.type,ie.key,ie.props,null,se.mode,ge),ge.ref=Ko(se,ee,ie),ge.return=se,se=ge)}return R(se);case P:e:{for(Ie=ie.key;ee!==null;){if(ee.key===Ie)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=md(ie,se.mode,ge),ee.return=se,se=ee}return R(se);case z:return Ie=ie._init,gt(se,ee,Ie(ie._payload),ge)}if(ft(ie))return Ne(se,ee,ie,ge);if($(ie))return Re(se,ee,ie,ge);ul(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=pd(ie,se.mode,ge),ee.return=se,se=ee),R(se)):a(se,ee)}return gt}var Wi=o0(!0),a0=o0(!1),cl=is(null),dl=null,Vi=null,kc=null;function Ec(){kc=Vi=dl=null}function Nc(t){var s=cl.current;rt(cl),t._currentValue=s}function Cc(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 Gi(t,s){dl=t,kc=Vi=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&s)!==0&&(an=!0),t.firstContext=null)}function jn(t){var s=t._currentValue;if(kc!==t)if(t={context:t,memoizedValue:s,next:null},Vi===null){if(dl===null)throw Error(r(308));Vi=t,dl.dependencies={lanes:0,firstContext:t}}else Vi=Vi.next=t;return s}var Vs=null;function Rc(t){Vs===null?Vs=[t]:Vs.push(t)}function l0(t,s,a,f){var v=s.interleaved;return v===null?(a.next=a,Rc(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 ls=!1;function jc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function u0(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 us(t,s,a){var f=t.updateQueue;if(f===null)return null;if(f=f.shared,(He&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,Rc(f)):(s.next=v.next,v.next=s),f.interleaved=s,Lr(t,a)}function fl(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,Bt(t,a)}}function c0(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 R={eventTime:a.eventTime,lane:a.lane,tag:a.tag,payload:a.payload,callback:a.callback,next:null};x===null?v=x=R:x=x.next=R,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 hl(t,s,a,f){var v=t.updateQueue;ls=!1;var x=v.firstBaseUpdate,R=v.lastBaseUpdate,D=v.shared.pending;if(D!==null){v.shared.pending=null;var X=D,oe=X.next;X.next=null,R===null?x=oe:R.next=oe,R=X;var pe=t.alternate;pe!==null&&(pe=pe.updateQueue,D=pe.lastBaseUpdate,D!==R&&(D===null?pe.firstBaseUpdate=oe:D.next=oe,pe.lastBaseUpdate=X))}if(x!==null){var me=v.baseState;R=0,pe=oe=X=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 Ne=t,Re=D;switch(he=s,be=a,Re.tag){case 1:if(Ne=Re.payload,typeof Ne=="function"){me=Ne.call(be,me,he);break e}me=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=Re.payload,he=typeof Ne=="function"?Ne.call(be,me,he):Ne,he==null)break e;me=Q({},me,he);break e;case 2:ls=!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?(oe=pe=be,X=me):pe=pe.next=be,R|=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&&(X=me),v.baseState=X,v.firstBaseUpdate=oe,v.lastBaseUpdate=pe,s=v.shared.interleaved,s!==null){v=s;do R|=v.lane,v=v.next;while(v!==s)}else x===null&&(v.shared.lanes=0);Ks|=R,t.lanes=R,t.memoizedState=me}}function d0(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 Xo={},fr=is(Xo),Qo=is(Xo),Zo=is(Xo);function Gs(t){if(t===Xo)throw Error(r(174));return t}function Tc(t,s){switch(tt(Zo,s),tt(Qo,t),tt(fr,Xo),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)}rt(fr),tt(fr,s)}function Yi(){rt(fr),rt(Qo),rt(Zo)}function f0(t){Gs(Zo.current);var s=Gs(fr.current),a=ot(s,t.type);s!==a&&(tt(Qo,t),tt(fr,a))}function Ac(t){Qo.current===t&&(rt(fr),rt(Qo))}var at=is(0);function pl(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 Ic=[];function Mc(){for(var t=0;t<Ic.length;t++)Ic[t]._workInProgressVersionPrimary=null;Ic.length=0}var ml=C.ReactCurrentDispatcher,Oc=C.ReactCurrentBatchConfig,Ys=0,lt=null,kt=null,jt=null,gl=!1,Jo=!1,ea=0,aj=0;function Ht(){throw Error(r(321))}function Pc(t,s){if(s===null)return!1;for(var a=0;a<s.length&&a<t.length;a++)if(!Hn(t[a],s[a]))return!1;return!0}function Lc(t,s,a,f,v,x){if(Ys=x,lt=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,ml.current=t===null||t.memoizedState===null?dj:fj,t=a(f,v),Jo){x=0;do{if(Jo=!1,ea=0,25<=x)throw Error(r(301));x+=1,jt=kt=null,s.updateQueue=null,ml.current=hj,t=a(f,v)}while(Jo)}if(ml.current=wl,s=kt!==null&&kt.next!==null,Ys=0,jt=kt=lt=null,gl=!1,s)throw Error(r(300));return t}function qc(){var t=ea!==0;return ea=0,t}function hr(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return jt===null?lt.memoizedState=jt=t:jt=jt.next=t,jt}function Tn(){if(kt===null){var t=lt.alternate;t=t!==null?t.memoizedState:null}else t=kt.next;var s=jt===null?lt.memoizedState:jt.next;if(s!==null)jt=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},jt===null?lt.memoizedState=jt=t:jt=jt.next=t}return jt}function ta(t,s){return typeof s=="function"?s(t):s}function $c(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 R=v.next;v.next=x.next,x.next=R}f.baseQueue=v=x,a.pending=null}if(v!==null){x=v.next,f=f.baseState;var D=R=null,X=null,oe=x;do{var pe=oe.lane;if((Ys&pe)===pe)X!==null&&(X=X.next={lane:0,action:oe.action,hasEagerState:oe.hasEagerState,eagerState:oe.eagerState,next:null}),f=oe.hasEagerState?oe.eagerState:t(f,oe.action);else{var me={lane:pe,action:oe.action,hasEagerState:oe.hasEagerState,eagerState:oe.eagerState,next:null};X===null?(D=X=me,R=f):X=X.next=me,lt.lanes|=pe,Ks|=pe}oe=oe.next}while(oe!==null&&oe!==x);X===null?R=f:X.next=D,Hn(f,s.memoizedState)||(an=!0),s.memoizedState=f,s.baseState=R,s.baseQueue=X,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 Dc(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 R=v=v.next;do x=t(x,R.action),R=R.next;while(R!==v);Hn(x,s.memoizedState)||(an=!0),s.memoizedState=x,s.baseQueue===null&&(s.baseState=x),a.lastRenderedState=x}return[x,f]}function h0(){}function p0(t,s){var a=lt,f=Tn(),v=s(),x=!Hn(f.memoizedState,v);if(x&&(f.memoizedState=v,an=!0),f=f.queue,Fc(v0.bind(null,a,f,t),[t]),f.getSnapshot!==s||x||jt!==null&&jt.memoizedState.tag&1){if(a.flags|=2048,na(9,g0.bind(null,a,f,v,s),void 0,null),Tt===null)throw Error(r(349));(Ys&30)!==0||m0(a,s,v)}return v}function m0(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 g0(t,s,a,f){s.value=a,s.getSnapshot=f,y0(s)&&w0(t)}function v0(t,s,a){return a(function(){y0(s)&&w0(t)})}function y0(t){var s=t.getSnapshot;t=t.value;try{var a=s();return!Hn(t,a)}catch{return!0}}function w0(t){var s=Lr(t,1);s!==null&&Kn(s,t,1,-1)}function x0(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:ta,lastRenderedState:t},s.queue=t,t=t.dispatch=cj.bind(null,lt,t),[s.memoizedState,t]}function na(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 _0(){return Tn().memoizedState}function vl(t,s,a,f){var v=hr();lt.flags|=t,v.memoizedState=na(1|s,a,void 0,f===void 0?null:f)}function yl(t,s,a,f){var v=Tn();f=f===void 0?null:f;var x=void 0;if(kt!==null){var R=kt.memoizedState;if(x=R.destroy,f!==null&&Pc(f,R.deps)){v.memoizedState=na(s,a,x,f);return}}lt.flags|=t,v.memoizedState=na(1|s,a,x,f)}function b0(t,s){return vl(8390656,8,t,s)}function Fc(t,s){return yl(2048,8,t,s)}function S0(t,s){return yl(4,2,t,s)}function k0(t,s){return yl(4,4,t,s)}function E0(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 N0(t,s,a){return a=a!=null?a.concat([t]):null,yl(4,4,E0.bind(null,s,t),a)}function zc(){}function C0(t,s){var a=Tn();s=s===void 0?null:s;var f=a.memoizedState;return f!==null&&s!==null&&Pc(s,f[1])?f[0]:(a.memoizedState=[t,s],t)}function R0(t,s){var a=Tn();s=s===void 0?null:s;var f=a.memoizedState;return f!==null&&s!==null&&Pc(s,f[1])?f[0]:(t=t(),a.memoizedState=[t,s],t)}function j0(t,s,a){return(Ys&21)===0?(t.baseState&&(t.baseState=!1,an=!0),t.memoizedState=a):(Hn(a,s)||(a=Ua(),lt.lanes|=a,Ks|=a,t.baseState=!0),s)}function lj(t,s){var a=Ge;Ge=a!==0&&4>a?a:4,t(!0);var f=Oc.transition;Oc.transition={};try{t(!1),s()}finally{Ge=a,Oc.transition=f}}function T0(){return Tn().memoizedState}function uj(t,s,a){var f=hs(t);if(a={lane:f,action:a,hasEagerState:!1,eagerState:null,next:null},A0(t))I0(s,a);else if(a=l0(t,s,a,f),a!==null){var v=en();Kn(a,t,f,v),M0(a,s,f)}}function cj(t,s,a){var f=hs(t),v={lane:f,action:a,hasEagerState:!1,eagerState:null,next:null};if(A0(t))I0(s,v);else{var x=t.alternate;if(t.lanes===0&&(x===null||x.lanes===0)&&(x=s.lastRenderedReducer,x!==null))try{var R=s.lastRenderedState,D=x(R,a);if(v.hasEagerState=!0,v.eagerState=D,Hn(D,R)){var X=s.interleaved;X===null?(v.next=v,Rc(s)):(v.next=X.next,X.next=v),s.interleaved=v;return}}catch{}finally{}a=l0(t,s,v,f),a!==null&&(v=en(),Kn(a,t,f,v),M0(a,s,f))}}function A0(t){var s=t.alternate;return t===lt||s!==null&&s===lt}function I0(t,s){Jo=gl=!0;var a=t.pending;a===null?s.next=s:(s.next=a.next,a.next=s),t.pending=s}function M0(t,s,a){if((a&4194240)!==0){var f=s.lanes;f&=t.pendingLanes,a|=f,s.lanes=a,Bt(t,a)}}var wl={readContext:jn,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useInsertionEffect:Ht,useLayoutEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useMutableSource:Ht,useSyncExternalStore:Ht,useId:Ht,unstable_isNewReconciler:!1},dj={readContext:jn,useCallback:function(t,s){return hr().memoizedState=[t,s===void 0?null:s],t},useContext:jn,useEffect:b0,useImperativeHandle:function(t,s,a){return a=a!=null?a.concat([t]):null,vl(4194308,4,E0.bind(null,s,t),a)},useLayoutEffect:function(t,s){return vl(4194308,4,t,s)},useInsertionEffect:function(t,s){return vl(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=uj.bind(null,lt,t),[f.memoizedState,t]},useRef:function(t){var s=hr();return t={current:t},s.memoizedState=t},useState:x0,useDebugValue:zc,useDeferredValue:function(t){return hr().memoizedState=t},useTransition:function(){var t=x0(!1),s=t[0];return t=lj.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(),Tt===null)throw Error(r(349));(Ys&30)!==0||m0(f,s,a)}v.memoizedState=a;var x={value:a,getSnapshot:s};return v.queue=x,b0(v0.bind(null,f,x,t),[t]),f.flags|=2048,na(9,g0.bind(null,f,x,a,s),void 0,null),a},useId:function(){var t=hr(),s=Tt.identifierPrefix;if(st){var a=Pr,f=Or;a=(f&~(1<<32-nn(f)-1)).toString(32)+a,s=":"+s+"R"+a,a=ea++,0<a&&(s+="H"+a.toString(32)),s+=":"}else a=aj++,s=":"+s+"r"+a.toString(32)+":";return t.memoizedState=s},unstable_isNewReconciler:!1},fj={readContext:jn,useCallback:C0,useContext:jn,useEffect:Fc,useImperativeHandle:N0,useInsertionEffect:S0,useLayoutEffect:k0,useMemo:R0,useReducer:$c,useRef:_0,useState:function(){return $c(ta)},useDebugValue:zc,useDeferredValue:function(t){var s=Tn();return j0(s,kt.memoizedState,t)},useTransition:function(){var t=$c(ta)[0],s=Tn().memoizedState;return[t,s]},useMutableSource:h0,useSyncExternalStore:p0,useId:T0,unstable_isNewReconciler:!1},hj={readContext:jn,useCallback:C0,useContext:jn,useEffect:Fc,useImperativeHandle:N0,useInsertionEffect:S0,useLayoutEffect:k0,useMemo:R0,useReducer:Dc,useRef:_0,useState:function(){return Dc(ta)},useDebugValue:zc,useDeferredValue:function(t){var s=Tn();return kt===null?s.memoizedState=t:j0(s,kt.memoizedState,t)},useTransition:function(){var t=Dc(ta)[0],s=Tn().memoizedState;return[t,s]},useMutableSource:h0,useSyncExternalStore:p0,useId:T0,unstable_isNewReconciler:!1};function Vn(t,s){if(t&&t.defaultProps){s=Q({},s),t=t.defaultProps;for(var a in t)s[a]===void 0&&(s[a]=t[a]);return s}return s}function Bc(t,s,a,f){s=t.memoizedState,a=a(f,s),a=a==null?s:Q({},s,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var xl={isMounted:function(t){return(t=t._reactInternals)?gn(t)===t:!1},enqueueSetState:function(t,s,a){t=t._reactInternals;var f=en(),v=hs(t),x=qr(f,v);x.payload=s,a!=null&&(x.callback=a),s=us(t,x,v),s!==null&&(Kn(s,t,v,f),fl(s,t,v))},enqueueReplaceState:function(t,s,a){t=t._reactInternals;var f=en(),v=hs(t),x=qr(f,v);x.tag=1,x.payload=s,a!=null&&(x.callback=a),s=us(t,x,v),s!==null&&(Kn(s,t,v,f),fl(s,t,v))},enqueueForceUpdate:function(t,s){t=t._reactInternals;var a=en(),f=hs(t),v=qr(a,f);v.tag=2,s!=null&&(v.callback=s),s=us(t,v,f),s!==null&&(Kn(s,t,f,a),fl(s,t,f))}};function O0(t,s,a,f,v,x,R){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(f,x,R):s.prototype&&s.prototype.isPureReactComponent?!Bo(a,f)||!Bo(v,x):!0}function P0(t,s,a){var f=!1,v=os,x=s.contextType;return typeof x=="object"&&x!==null?x=jn(x):(v=on(s)?Us:Ut.current,f=s.contextTypes,x=(f=f!=null)?zi(t,v):os),s=new s(a,x),t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=xl,t.stateNode=s,s._reactInternals=t,f&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=v,t.__reactInternalMemoizedMaskedChildContext=x),s}function L0(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&&xl.enqueueReplaceState(s,s.state,null)}function Uc(t,s,a,f){var v=t.stateNode;v.props=a,v.state=t.memoizedState,v.refs={},jc(t);var x=s.contextType;typeof x=="object"&&x!==null?v.context=jn(x):(x=on(s)?Us:Ut.current,v.context=zi(t,x)),v.state=t.memoizedState,x=s.getDerivedStateFromProps,typeof x=="function"&&(Bc(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&&xl.enqueueReplaceState(v,v.state,null),hl(t,a,v,f),v.state=t.memoizedState),typeof v.componentDidMount=="function"&&(t.flags|=4194308)}function Ki(t,s){try{var a="",f=s;do a+=J(f),f=f.return;while(f);var v=a}catch(x){v=`
|
|
39
|
+
Error generating stack: `+x.message+`
|
|
40
|
+
`+x.stack}return{value:t,source:s,stack:v,digest:null}}function Hc(t,s,a){return{value:t,source:null,stack:a??null,digest:s??null}}function Wc(t,s){try{console.error(s.value)}catch(a){setTimeout(function(){throw a})}}var pj=typeof WeakMap=="function"?WeakMap:Map;function q0(t,s,a){a=qr(-1,a),a.tag=3,a.payload={element:null};var f=s.value;return a.callback=function(){Cl||(Cl=!0,od=f),Wc(t,s)},a}function $0(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(){Wc(t,s)}}var x=t.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(a.callback=function(){Wc(t,s),typeof f!="function"&&(ds===null?ds=new Set([this]):ds.add(this));var R=s.stack;this.componentDidCatch(s.value,{componentStack:R!==null?R:""})}),a}function D0(t,s,a){var f=t.pingCache;if(f===null){f=t.pingCache=new pj;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=Rj.bind(null,t,s,a),s.then(t,t))}function F0(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 z0(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,us(a,s,1))),a.lanes|=1),t):(t.flags|=65536,t.lanes=v,t)}var mj=C.ReactCurrentOwner,an=!1;function Jt(t,s,a,f){s.child=t===null?a0(s,null,a,f):Wi(s,t.child,a,f)}function B0(t,s,a,f,v){a=a.render;var x=s.ref;return Gi(s,v),f=Lc(t,s,a,f,x,v),a=qc(),t!==null&&!an?(s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~v,$r(t,s,v)):(st&&a&&wc(s),s.flags|=1,Jt(t,s,f,v),s.child)}function U0(t,s,a,f,v){if(t===null){var x=a.type;return typeof x=="function"&&!hd(x)&&x.defaultProps===void 0&&a.compare===null&&a.defaultProps===void 0?(s.tag=15,s.type=x,H0(t,s,x,f,v)):(t=Ml(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 R=x.memoizedProps;if(a=a.compare,a=a!==null?a:Bo,a(R,f)&&t.ref===s.ref)return $r(t,s,v)}return s.flags|=1,t=ms(x,f),t.ref=s.ref,t.return=s,s.child=t}function H0(t,s,a,f,v){if(t!==null){var x=t.memoizedProps;if(Bo(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 Vc(t,s,a,f,v)}function W0(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},tt(Qi,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,tt(Qi,wn),wn|=t,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},f=x!==null?x.baseLanes:a,tt(Qi,wn),wn|=f}else x!==null?(f=x.baseLanes|a,s.memoizedState=null):f=a,tt(Qi,wn),wn|=f;return Jt(t,s,v,a),s.child}function V0(t,s){var a=s.ref;(t===null&&a!==null||t!==null&&t.ref!==a)&&(s.flags|=512,s.flags|=2097152)}function Vc(t,s,a,f,v){var x=on(a)?Us:Ut.current;return x=zi(s,x),Gi(s,v),a=Lc(t,s,a,f,x,v),f=qc(),t!==null&&!an?(s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~v,$r(t,s,v)):(st&&f&&wc(s),s.flags|=1,Jt(t,s,a,v),s.child)}function G0(t,s,a,f,v){if(on(a)){var x=!0;sl(s)}else x=!1;if(Gi(s,v),s.stateNode===null)bl(t,s),P0(s,a,f),Uc(s,a,f,v),f=!0;else if(t===null){var R=s.stateNode,D=s.memoizedProps;R.props=D;var X=R.context,oe=a.contextType;typeof oe=="object"&&oe!==null?oe=jn(oe):(oe=on(a)?Us:Ut.current,oe=zi(s,oe));var pe=a.getDerivedStateFromProps,me=typeof pe=="function"||typeof R.getSnapshotBeforeUpdate=="function";me||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(D!==f||X!==oe)&&L0(s,R,f,oe),ls=!1;var he=s.memoizedState;R.state=he,hl(s,f,R,v),X=s.memoizedState,D!==f||he!==X||sn.current||ls?(typeof pe=="function"&&(Bc(s,a,pe,f),X=s.memoizedState),(D=ls||O0(s,a,D,f,he,X,oe))?(me||typeof R.UNSAFE_componentWillMount!="function"&&typeof R.componentWillMount!="function"||(typeof R.componentWillMount=="function"&&R.componentWillMount(),typeof R.UNSAFE_componentWillMount=="function"&&R.UNSAFE_componentWillMount()),typeof R.componentDidMount=="function"&&(s.flags|=4194308)):(typeof R.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=f,s.memoizedState=X),R.props=f,R.state=X,R.context=oe,f=D):(typeof R.componentDidMount=="function"&&(s.flags|=4194308),f=!1)}else{R=s.stateNode,u0(t,s),D=s.memoizedProps,oe=s.type===s.elementType?D:Vn(s.type,D),R.props=oe,me=s.pendingProps,he=R.context,X=a.contextType,typeof X=="object"&&X!==null?X=jn(X):(X=on(a)?Us:Ut.current,X=zi(s,X));var be=a.getDerivedStateFromProps;(pe=typeof be=="function"||typeof R.getSnapshotBeforeUpdate=="function")||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(D!==me||he!==X)&&L0(s,R,f,X),ls=!1,he=s.memoizedState,R.state=he,hl(s,f,R,v);var Ne=s.memoizedState;D!==me||he!==Ne||sn.current||ls?(typeof be=="function"&&(Bc(s,a,be,f),Ne=s.memoizedState),(oe=ls||O0(s,a,oe,f,he,Ne,X)||!1)?(pe||typeof R.UNSAFE_componentWillUpdate!="function"&&typeof R.componentWillUpdate!="function"||(typeof R.componentWillUpdate=="function"&&R.componentWillUpdate(f,Ne,X),typeof R.UNSAFE_componentWillUpdate=="function"&&R.UNSAFE_componentWillUpdate(f,Ne,X)),typeof R.componentDidUpdate=="function"&&(s.flags|=4),typeof R.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof R.componentDidUpdate!="function"||D===t.memoizedProps&&he===t.memoizedState||(s.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||D===t.memoizedProps&&he===t.memoizedState||(s.flags|=1024),s.memoizedProps=f,s.memoizedState=Ne),R.props=f,R.state=Ne,R.context=X,f=oe):(typeof R.componentDidUpdate!="function"||D===t.memoizedProps&&he===t.memoizedState||(s.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||D===t.memoizedProps&&he===t.memoizedState||(s.flags|=1024),f=!1)}return Gc(t,s,a,f,x,v)}function Gc(t,s,a,f,v,x){V0(t,s);var R=(s.flags&128)!==0;if(!f&&!R)return v&&Zy(s,a,!1),$r(t,s,x);f=s.stateNode,mj.current=s;var D=R&&typeof a.getDerivedStateFromError!="function"?null:f.render();return s.flags|=1,t!==null&&R?(s.child=Wi(s,t.child,null,x),s.child=Wi(s,null,D,x)):Jt(t,s,D,x),s.memoizedState=f.state,v&&Zy(s,a,!0),s.child}function Y0(t){var s=t.stateNode;s.pendingContext?Xy(t,s.pendingContext,s.pendingContext!==s.context):s.context&&Xy(t,s.context,!1),Tc(t,s.containerInfo)}function K0(t,s,a,f,v){return Hi(),Sc(v),s.flags|=256,Jt(t,s,a,f),s.child}var Yc={dehydrated:null,treeContext:null,retryLane:0};function Kc(t){return{baseLanes:t,cachePool:null,transitions:null}}function X0(t,s,a){var f=s.pendingProps,v=at.current,x=!1,R=(s.flags&128)!==0,D;if((D=R)||(D=t!==null&&t.memoizedState===null?!1:(v&2)!==0),D?(x=!0,s.flags&=-129):(t===null||t.memoizedState!==null)&&(v|=1),tt(at,v&1),t===null)return bc(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):(R=f.children,t=f.fallback,x?(f=s.mode,x=s.child,R={mode:"hidden",children:R},(f&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=R):x=Ol(R,f,0,null),t=Js(t,f,a,null),x.return=s,t.return=s,x.sibling=t,s.child=x,s.child.memoizedState=Kc(a),s.memoizedState=Yc,t):Xc(s,R));if(v=t.memoizedState,v!==null&&(D=v.dehydrated,D!==null))return gj(t,s,R,f,D,v,a);if(x){x=f.fallback,R=s.mode,v=t.child,D=v.sibling;var X={mode:"hidden",children:f.children};return(R&1)===0&&s.child!==v?(f=s.child,f.childLanes=0,f.pendingProps=X,s.deletions=null):(f=ms(v,X),f.subtreeFlags=v.subtreeFlags&14680064),D!==null?x=ms(D,x):(x=Js(x,R,a,null),x.flags|=2),x.return=s,f.return=s,f.sibling=x,s.child=f,f=x,x=s.child,R=t.child.memoizedState,R=R===null?Kc(a):{baseLanes:R.baseLanes|a,cachePool:null,transitions:R.transitions},x.memoizedState=R,x.childLanes=t.childLanes&~a,s.memoizedState=Yc,f}return x=t.child,t=x.sibling,f=ms(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 Xc(t,s){return s=Ol({mode:"visible",children:s},t.mode,0,null),s.return=t,t.child=s}function _l(t,s,a,f){return f!==null&&Sc(f),Wi(s,t.child,null,a),t=Xc(s,s.pendingProps.children),t.flags|=2,s.memoizedState=null,t}function gj(t,s,a,f,v,x,R){if(a)return s.flags&256?(s.flags&=-257,f=Hc(Error(r(422))),_l(t,s,R,f)):s.memoizedState!==null?(s.child=t.child,s.flags|=128,null):(x=f.fallback,v=s.mode,f=Ol({mode:"visible",children:f.children},v,0,null),x=Js(x,v,R,null),x.flags|=2,f.return=s,x.return=s,f.sibling=x,s.child=f,(s.mode&1)!==0&&Wi(s,t.child,null,R),s.child.memoizedState=Kc(R),s.memoizedState=Yc,x);if((s.mode&1)===0)return _l(t,s,R,null);if(v.data==="$!"){if(f=v.nextSibling&&v.nextSibling.dataset,f)var D=f.dgst;return f=D,x=Error(r(419)),f=Hc(x,f,void 0),_l(t,s,R,f)}if(D=(R&t.childLanes)!==0,an||D){if(f=Tt,f!==null){switch(R&-R){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|R))!==0?0:v,v!==0&&v!==x.retryLane&&(x.retryLane=v,Lr(t,v),Kn(f,t,v,-1))}return fd(),f=Hc(Error(r(421))),_l(t,s,R,f)}return v.data==="$?"?(s.flags|=128,s.child=t.child,s=jj.bind(null,t),v._reactRetry=s,null):(t=x.treeContext,yn=ss(v.nextSibling),vn=s,st=!0,Wn=null,t!==null&&(Cn[Rn++]=Or,Cn[Rn++]=Pr,Cn[Rn++]=Hs,Or=t.id,Pr=t.overflow,Hs=s),s=Xc(s,f.children),s.flags|=4096,s)}function Q0(t,s,a){t.lanes|=s;var f=t.alternate;f!==null&&(f.lanes|=s),Cc(t.return,s,a)}function Qc(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 Z0(t,s,a){var f=s.pendingProps,v=f.revealOrder,x=f.tail;if(Jt(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&&Q0(t,a,s);else if(t.tag===19)Q0(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(tt(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&&pl(t)===null&&(v=a),a=a.sibling;a=v,a===null?(v=s.child,s.child=null):(v=a.sibling,a.sibling=null),Qc(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&&pl(t)===null){s.child=v;break}t=v.sibling,v.sibling=a,a=v,v=t}Qc(s,!0,a,null,x);break;case"together":Qc(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function bl(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=ms(t,t.pendingProps),s.child=a,a.return=s;t.sibling!==null;)t=t.sibling,a=a.sibling=ms(t,t.pendingProps),a.return=s;a.sibling=null}return s.child}function vj(t,s,a){switch(s.tag){case 3:Y0(s),Hi();break;case 5:f0(s);break;case 1:on(s.type)&&sl(s);break;case 4:Tc(s,s.stateNode.containerInfo);break;case 10:var f=s.type._context,v=s.memoizedProps.value;tt(cl,f._currentValue),f._currentValue=v;break;case 13:if(f=s.memoizedState,f!==null)return f.dehydrated!==null?(tt(at,at.current&1),s.flags|=128,null):(a&s.child.childLanes)!==0?X0(t,s,a):(tt(at,at.current&1),t=$r(t,s,a),t!==null?t.sibling:null);tt(at,at.current&1);break;case 19:if(f=(a&s.childLanes)!==0,(t.flags&128)!==0){if(f)return Z0(t,s,a);s.flags|=128}if(v=s.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),tt(at,at.current),f)break;return null;case 22:case 23:return s.lanes=0,W0(t,s,a)}return $r(t,s,a)}var J0,Zc,ew,tw;J0=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}},Zc=function(){},ew=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=Q({},v,{value:void 0}),f=Q({},f,{value:void 0}),x=[];break;case"textarea":v=We(t,v),f=We(t,f),x=[];break;default:typeof v.onClick!="function"&&typeof f.onClick=="function"&&(t.onclick=tl)}Yt(a,f);var R;a=null;for(oe in v)if(!f.hasOwnProperty(oe)&&v.hasOwnProperty(oe)&&v[oe]!=null)if(oe==="style"){var D=v[oe];for(R in D)D.hasOwnProperty(R)&&(a||(a={}),a[R]="")}else oe!=="dangerouslySetInnerHTML"&&oe!=="children"&&oe!=="suppressContentEditableWarning"&&oe!=="suppressHydrationWarning"&&oe!=="autoFocus"&&(o.hasOwnProperty(oe)?x||(x=[]):(x=x||[]).push(oe,null));for(oe in f){var X=f[oe];if(D=v!=null?v[oe]:void 0,f.hasOwnProperty(oe)&&X!==D&&(X!=null||D!=null))if(oe==="style")if(D){for(R in D)!D.hasOwnProperty(R)||X&&X.hasOwnProperty(R)||(a||(a={}),a[R]="");for(R in X)X.hasOwnProperty(R)&&D[R]!==X[R]&&(a||(a={}),a[R]=X[R])}else a||(x||(x=[]),x.push(oe,a)),a=X;else oe==="dangerouslySetInnerHTML"?(X=X?X.__html:void 0,D=D?D.__html:void 0,X!=null&&D!==X&&(x=x||[]).push(oe,X)):oe==="children"?typeof X!="string"&&typeof X!="number"||(x=x||[]).push(oe,""+X):oe!=="suppressContentEditableWarning"&&oe!=="suppressHydrationWarning"&&(o.hasOwnProperty(oe)?(X!=null&&oe==="onScroll"&&nt("scroll",t),x||D===X||(x=[])):(x=x||[]).push(oe,X))}a&&(x=x||[]).push("style",a);var oe=x;(s.updateQueue=oe)&&(s.flags|=4)}},tw=function(t,s,a,f){a!==f&&(s.flags|=4)};function ra(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 Wt(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 yj(t,s,a){var f=s.pendingProps;switch(xc(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wt(s),null;case 1:return on(s.type)&&rl(),Wt(s),null;case 3:return f=s.stateNode,Yi(),rt(sn),rt(Ut),Mc(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(t===null||t.child===null)&&(ll(s)?s.flags|=4:t===null||t.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Wn!==null&&(ud(Wn),Wn=null))),Zc(t,s),Wt(s),null;case 5:Ac(s);var v=Gs(Zo.current);if(a=s.type,t!==null&&s.stateNode!=null)ew(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 Wt(s),null}if(t=Gs(fr.current),ll(s)){f=s.stateNode,a=s.type;var x=s.memoizedProps;switch(f[dr]=s,f[Go]=x,t=(s.mode&1)!==0,a){case"dialog":nt("cancel",f),nt("close",f);break;case"iframe":case"object":case"embed":nt("load",f);break;case"video":case"audio":for(v=0;v<Ho.length;v++)nt(Ho[v],f);break;case"source":nt("error",f);break;case"img":case"image":case"link":nt("error",f),nt("load",f);break;case"details":nt("toggle",f);break;case"input":ke(f,x),nt("invalid",f);break;case"select":f._wrapperState={wasMultiple:!!x.multiple},nt("invalid",f);break;case"textarea":$e(f,x),nt("invalid",f)}Yt(a,x),v=null;for(var R in x)if(x.hasOwnProperty(R)){var D=x[R];R==="children"?typeof D=="string"?f.textContent!==D&&(x.suppressHydrationWarning!==!0&&el(f.textContent,D,t),v=["children",D]):typeof D=="number"&&f.textContent!==""+D&&(x.suppressHydrationWarning!==!0&&el(f.textContent,D,t),v=["children",""+D]):o.hasOwnProperty(R)&&D!=null&&R==="onScroll"&&nt("scroll",f)}switch(a){case"input":Ce(f),_e(f,x,!0);break;case"textarea":Ce(f),Xe(f);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(f.onclick=tl)}f=v,s.updateQueue=f,f!==null&&(s.flags|=4)}else{R=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=R.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof f.is=="string"?t=R.createElement(a,{is:f.is}):(t=R.createElement(a),a==="select"&&(R=t,f.multiple?R.multiple=!0:f.size&&(R.size=f.size))):t=R.createElementNS(t,a),t[dr]=s,t[Go]=f,J0(t,s,!1,!1),s.stateNode=t;e:{switch(R=Mt(a,f),a){case"dialog":nt("cancel",t),nt("close",t),v=f;break;case"iframe":case"object":case"embed":nt("load",t),v=f;break;case"video":case"audio":for(v=0;v<Ho.length;v++)nt(Ho[v],t);v=f;break;case"source":nt("error",t),v=f;break;case"img":case"image":case"link":nt("error",t),nt("load",t),v=f;break;case"details":nt("toggle",t),v=f;break;case"input":ke(t,f),v=ye(t,f),nt("invalid",t);break;case"option":v=f;break;case"select":t._wrapperState={wasMultiple:!!f.multiple},v=Q({},f,{value:void 0}),nt("invalid",t);break;case"textarea":$e(t,f),v=We(t,f),nt("invalid",t);break;default:v=f}Yt(a,v),D=v;for(x in D)if(D.hasOwnProperty(x)){var X=D[x];x==="style"?mt(t,X):x==="dangerouslySetInnerHTML"?(X=X?X.__html:void 0,X!=null&&Gt(t,X)):x==="children"?typeof X=="string"?(a!=="textarea"||X!=="")&&It(t,X):typeof X=="number"&&It(t,""+X):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(o.hasOwnProperty(x)?X!=null&&x==="onScroll"&&nt("scroll",t):X!=null&&E(t,x,X,R))}switch(a){case"input":Ce(t),_e(t,f,!1);break;case"textarea":Ce(t),Xe(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=tl)}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 Wt(s),null;case 6:if(t&&s.stateNode!=null)tw(t,s,t.memoizedProps,f);else{if(typeof f!="string"&&s.stateNode===null)throw Error(r(166));if(a=Gs(Zo.current),Gs(fr.current),ll(s)){if(f=s.stateNode,a=s.memoizedProps,f[dr]=s,(x=f.nodeValue!==a)&&(t=vn,t!==null))switch(t.tag){case 3:el(f.nodeValue,a,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&el(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 Wt(s),null;case 13:if(rt(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)s0(),Hi(),s.flags|=98560,x=!1;else if(x=ll(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 Hi(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Wt(s),x=!1}else Wn!==null&&(ud(Wn),Wn=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):fd())),s.updateQueue!==null&&(s.flags|=4),Wt(s),null);case 4:return Yi(),Zc(t,s),t===null&&Wo(s.stateNode.containerInfo),Wt(s),null;case 10:return Nc(s.type._context),Wt(s),null;case 17:return on(s.type)&&rl(),Wt(s),null;case 19:if(rt(at),x=s.memoizedState,x===null)return Wt(s),null;if(f=(s.flags&128)!==0,R=x.rendering,R===null)if(f)ra(x,!1);else{if(Et!==0||t!==null&&(t.flags&128)!==0)for(t=s.child;t!==null;){if(R=pl(t),R!==null){for(s.flags|=128,ra(x,!1),f=R.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,R=x.alternate,R===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=R.childLanes,x.lanes=R.lanes,x.child=R.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=R.memoizedProps,x.memoizedState=R.memoizedState,x.updateQueue=R.updateQueue,x.type=R.type,t=R.dependencies,x.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),a=a.sibling;return tt(at,at.current&1|2),s.child}t=t.sibling}x.tail!==null&&et()>Zi&&(s.flags|=128,f=!0,ra(x,!1),s.lanes=4194304)}else{if(!f)if(t=pl(R),t!==null){if(s.flags|=128,f=!0,a=t.updateQueue,a!==null&&(s.updateQueue=a,s.flags|=4),ra(x,!0),x.tail===null&&x.tailMode==="hidden"&&!R.alternate&&!st)return Wt(s),null}else 2*et()-x.renderingStartTime>Zi&&a!==1073741824&&(s.flags|=128,f=!0,ra(x,!1),s.lanes=4194304);x.isBackwards?(R.sibling=s.child,s.child=R):(a=x.last,a!==null?a.sibling=R:s.child=R,x.last=R)}return x.tail!==null?(s=x.tail,x.rendering=s,x.tail=s.sibling,x.renderingStartTime=et(),s.sibling=null,a=at.current,tt(at,f?a&1|2:a&1),s):(Wt(s),null);case 22:case 23:return dd(),f=s.memoizedState!==null,t!==null&&t.memoizedState!==null!==f&&(s.flags|=8192),f&&(s.mode&1)!==0?(wn&1073741824)!==0&&(Wt(s),s.subtreeFlags&6&&(s.flags|=8192)):Wt(s),null;case 24:return null;case 25:return null}throw Error(r(156,s.tag))}function wj(t,s){switch(xc(s),s.tag){case 1:return on(s.type)&&rl(),t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 3:return Yi(),rt(sn),rt(Ut),Mc(),t=s.flags,(t&65536)!==0&&(t&128)===0?(s.flags=t&-65537|128,s):null;case 5:return Ac(s),null;case 13:if(rt(at),t=s.memoizedState,t!==null&&t.dehydrated!==null){if(s.alternate===null)throw Error(r(340));Hi()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 19:return rt(at),null;case 4:return Yi(),null;case 10:return Nc(s.type._context),null;case 22:case 23:return dd(),null;case 24:return null;default:return null}}var Sl=!1,Vt=!1,xj=typeof WeakSet=="function"?WeakSet:Set,Se=null;function Xi(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 Jc(t,s,a){try{a()}catch(f){ct(t,s,f)}}var nw=!1;function _j(t,s){if(dc=En,t=Oy(),rc(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 R=0,D=-1,X=-1,oe=0,pe=0,me=t,he=null;t:for(;;){for(var be;me!==a||v!==0&&me.nodeType!==3||(D=R+v),me!==x||f!==0&&me.nodeType!==3||(X=R+f),me.nodeType===3&&(R+=me.nodeValue.length),(be=me.firstChild)!==null;)he=me,me=be;for(;;){if(me===t)break t;if(he===a&&++oe===v&&(D=R),he===x&&++pe===f&&(X=R),(be=me.nextSibling)!==null)break;me=he,he=me.parentNode}me=be}a=D===-1||X===-1?null:{start:D,end:X}}else a=null}a=a||{start:0,end:0}}else a=null;for(fc={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 Ne=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(Ne!==null){var Re=Ne.memoizedProps,gt=Ne.memoizedState,se=s.stateNode,ee=se.getSnapshotBeforeUpdate(s.elementType===s.type?Re:Vn(s.type,Re),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 Ne=nw,nw=!1,Ne}function sa(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&&Jc(s,a,x)}v=v.next}while(v!==f)}}function kl(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 ed(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 rw(t){var s=t.alternate;s!==null&&(t.alternate=null,rw(s)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(s=t.stateNode,s!==null&&(delete s[dr],delete s[Go],delete s[gc],delete s[rj],delete s[sj])),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 sw(t){return t.tag===5||t.tag===3||t.tag===4}function iw(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||sw(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 td(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=tl));else if(f!==4&&(t=t.child,t!==null))for(td(t,s,a),t=t.sibling;t!==null;)td(t,s,a),t=t.sibling}function nd(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(nd(t,s,a),t=t.sibling;t!==null;)nd(t,s,a),t=t.sibling}var qt=null,Gn=!1;function cs(t,s,a){for(a=a.child;a!==null;)ow(t,s,a),a=a.sibling}function ow(t,s,a){if(zt&&typeof zt.onCommitFiberUnmount=="function")try{zt.onCommitFiberUnmount(Ot,a)}catch{}switch(a.tag){case 5:Vt||Xi(a,s);case 6:var f=qt,v=Gn;qt=null,cs(t,s,a),qt=f,Gn=v,qt!==null&&(Gn?(t=qt,a=a.stateNode,t.nodeType===8?t.parentNode.removeChild(a):t.removeChild(a)):qt.removeChild(a.stateNode));break;case 18:qt!==null&&(Gn?(t=qt,a=a.stateNode,t.nodeType===8?mc(t.parentNode,a):t.nodeType===1&&mc(t,a),Os(t)):mc(qt,a.stateNode));break;case 4:f=qt,v=Gn,qt=a.stateNode.containerInfo,Gn=!0,cs(t,s,a),qt=f,Gn=v;break;case 0:case 11:case 14:case 15:if(!Vt&&(f=a.updateQueue,f!==null&&(f=f.lastEffect,f!==null))){v=f=f.next;do{var x=v,R=x.destroy;x=x.tag,R!==void 0&&((x&2)!==0||(x&4)!==0)&&Jc(a,s,R),v=v.next}while(v!==f)}cs(t,s,a);break;case 1:if(!Vt&&(Xi(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)}cs(t,s,a);break;case 21:cs(t,s,a);break;case 22:a.mode&1?(Vt=(f=Vt)||a.memoizedState!==null,cs(t,s,a),Vt=f):cs(t,s,a);break;default:cs(t,s,a)}}function aw(t){var s=t.updateQueue;if(s!==null){t.updateQueue=null;var a=t.stateNode;a===null&&(a=t.stateNode=new xj),s.forEach(function(f){var v=Tj.bind(null,t,f);a.has(f)||(a.add(f),f.then(v,v))})}}function Yn(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,R=s,D=R;e:for(;D!==null;){switch(D.tag){case 5:qt=D.stateNode,Gn=!1;break e;case 3:qt=D.stateNode.containerInfo,Gn=!0;break e;case 4:qt=D.stateNode.containerInfo,Gn=!0;break e}D=D.return}if(qt===null)throw Error(r(160));ow(x,R,v),qt=null,Gn=!1;var X=v.alternate;X!==null&&(X.return=null),v.return=null}catch(oe){ct(v,s,oe)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)lw(s,t),s=s.sibling}function lw(t,s){var a=t.alternate,f=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Yn(s,t),pr(t),f&4){try{sa(3,t,t.return),kl(3,t)}catch(Re){ct(t,t.return,Re)}try{sa(5,t,t.return)}catch(Re){ct(t,t.return,Re)}}break;case 1:Yn(s,t),pr(t),f&512&&a!==null&&Xi(a,a.return);break;case 5:if(Yn(s,t),pr(t),f&512&&a!==null&&Xi(a,a.return),t.flags&32){var v=t.stateNode;try{It(v,"")}catch(Re){ct(t,t.return,Re)}}if(f&4&&(v=t.stateNode,v!=null)){var x=t.memoizedProps,R=a!==null?a.memoizedProps:x,D=t.type,X=t.updateQueue;if(t.updateQueue=null,X!==null)try{D==="input"&&x.type==="radio"&&x.name!=null&&Ke(v,x),Mt(D,R);var oe=Mt(D,x);for(R=0;R<X.length;R+=2){var pe=X[R],me=X[R+1];pe==="style"?mt(v,me):pe==="dangerouslySetInnerHTML"?Gt(v,me):pe==="children"?It(v,me):E(v,pe,me,oe)}switch(D){case"input":we(v,x);break;case"textarea":Je(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[Go]=x}catch(Re){ct(t,t.return,Re)}}break;case 6:if(Yn(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(Re){ct(t,t.return,Re)}}break;case 3:if(Yn(s,t),pr(t),f&4&&a!==null&&a.memoizedState.isDehydrated)try{Os(s.containerInfo)}catch(Re){ct(t,t.return,Re)}break;case 4:Yn(s,t),pr(t);break;case 13:Yn(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||(id=et())),f&4&&aw(t);break;case 22:if(pe=a!==null&&a.memoizedState!==null,t.mode&1?(Vt=(oe=Vt)||pe,Yn(s,t),Vt=oe):Yn(s,t),pr(t),f&8192){if(oe=t.memoizedState!==null,(t.stateNode.isHidden=oe)&&!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:sa(4,he,he.return);break;case 1:Xi(he,he.return);var Ne=he.stateNode;if(typeof Ne.componentWillUnmount=="function"){f=he,a=he.return;try{s=f,Ne.props=s.memoizedProps,Ne.state=s.memoizedState,Ne.componentWillUnmount()}catch(Re){ct(f,a,Re)}}break;case 5:Xi(he,he.return);break;case 22:if(he.memoizedState!==null){dw(me);continue}}be!==null?(be.return=he,Se=be):dw(me)}pe=pe.sibling}e:for(pe=null,me=t;;){if(me.tag===5){if(pe===null){pe=me;try{v=me.stateNode,oe?(x=v.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(D=me.stateNode,X=me.memoizedProps.style,R=X!=null&&X.hasOwnProperty("display")?X.display:null,D.style.display=pt("display",R))}catch(Re){ct(t,t.return,Re)}}}else if(me.tag===6){if(pe===null)try{me.stateNode.nodeValue=oe?"":me.memoizedProps}catch(Re){ct(t,t.return,Re)}}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:Yn(s,t),pr(t),f&4&&aw(t);break;case 21:break;default:Yn(s,t),pr(t)}}function pr(t){var s=t.flags;if(s&2){try{e:{for(var a=t.return;a!==null;){if(sw(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&&(It(v,""),f.flags&=-33);var x=iw(t);nd(t,x,v);break;case 3:case 4:var R=f.stateNode.containerInfo,D=iw(t);td(t,D,R);break;default:throw Error(r(161))}}catch(X){ct(t,t.return,X)}t.flags&=-3}s&4096&&(t.flags&=-4097)}function bj(t,s,a){Se=t,uw(t)}function uw(t,s,a){for(var f=(t.mode&1)!==0;Se!==null;){var v=Se,x=v.child;if(v.tag===22&&f){var R=v.memoizedState!==null||Sl;if(!R){var D=v.alternate,X=D!==null&&D.memoizedState!==null||Vt;D=Sl;var oe=Vt;if(Sl=R,(Vt=X)&&!oe)for(Se=v;Se!==null;)R=Se,X=R.child,R.tag===22&&R.memoizedState!==null?fw(v):X!==null?(X.return=R,Se=X):fw(v);for(;x!==null;)Se=x,uw(x),x=x.sibling;Se=v,Sl=D,Vt=oe}cw(t)}else(v.subtreeFlags&8772)!==0&&x!==null?(x.return=v,Se=x):cw(t)}}function cw(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:Vt||kl(5,s);break;case 1:var f=s.stateNode;if(s.flags&4&&!Vt)if(a===null)f.componentDidMount();else{var v=s.elementType===s.type?a.memoizedProps:Vn(s.type,a.memoizedProps);f.componentDidUpdate(v,a.memoizedState,f.__reactInternalSnapshotBeforeUpdate)}var x=s.updateQueue;x!==null&&d0(s,x,f);break;case 3:var R=s.updateQueue;if(R!==null){if(a=null,s.child!==null)switch(s.child.tag){case 5:a=s.child.stateNode;break;case 1:a=s.child.stateNode}d0(s,R,a)}break;case 5:var D=s.stateNode;if(a===null&&s.flags&4){a=D;var X=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":X.autoFocus&&a.focus();break;case"img":X.src&&(a.src=X.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var oe=s.alternate;if(oe!==null){var pe=oe.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))}Vt||s.flags&512&&ed(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 dw(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 fw(t){for(;Se!==null;){var s=Se;try{switch(s.tag){case 0:case 11:case 15:var a=s.return;try{kl(4,s)}catch(X){ct(s,a,X)}break;case 1:var f=s.stateNode;if(typeof f.componentDidMount=="function"){var v=s.return;try{f.componentDidMount()}catch(X){ct(s,v,X)}}var x=s.return;try{ed(s)}catch(X){ct(s,x,X)}break;case 5:var R=s.return;try{ed(s)}catch(X){ct(s,R,X)}}}catch(X){ct(s,s.return,X)}if(s===t){Se=null;break}var D=s.sibling;if(D!==null){D.return=s.return,Se=D;break}Se=s.return}}var Sj=Math.ceil,El=C.ReactCurrentDispatcher,rd=C.ReactCurrentOwner,An=C.ReactCurrentBatchConfig,He=0,Tt=null,_t=null,$t=0,wn=0,Qi=is(0),Et=0,ia=null,Ks=0,Nl=0,sd=0,oa=null,ln=null,id=0,Zi=1/0,Dr=null,Cl=!1,od=null,ds=null,Rl=!1,fs=null,jl=0,aa=0,ad=null,Tl=-1,Al=0;function en(){return(He&6)!==0?et():Tl!==-1?Tl:Tl=et()}function hs(t){return(t.mode&1)===0?1:(He&2)!==0&&$t!==0?$t&-$t:oj.transition!==null?(Al===0&&(Al=Ua()),Al):(t=Ge,t!==0||(t=window.event,t=t===void 0?16:Po(t.type)),t)}function Kn(t,s,a,f){if(50<aa)throw aa=0,ad=null,Error(r(185));es(t,a,f),((He&2)===0||t!==Tt)&&(t===Tt&&((He&2)===0&&(Nl|=a),Et===4&&ps(t,$t)),un(t,f),a===1&&He===0&&(s.mode&1)===0&&(Zi=et()+500,il&&as()))}function un(t,s){var a=t.callbackNode;Jr(t,s);var f=xi(t,t===Tt?$t: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?ij(pw.bind(null,t)):Jy(pw.bind(null,t)),tj(function(){(He&6)===0&&as()}),a=null;else{switch(Si(f)){case 1:a=br;break;case 4:a=Cs;break;case 16:a=ar;break;case 536870912:a=yi;break;default:a=ar}a=bw(a,hw.bind(null,t))}t.callbackPriority=s,t.callbackNode=a}}function hw(t,s){if(Tl=-1,Al=0,(He&6)!==0)throw Error(r(327));var a=t.callbackNode;if(Ji()&&t.callbackNode!==a)return null;var f=xi(t,t===Tt?$t:0);if(f===0)return null;if((f&30)!==0||(f&t.expiredLanes)!==0||s)s=Il(t,f);else{s=f;var v=He;He|=2;var x=gw();(Tt!==t||$t!==s)&&(Dr=null,Zi=et()+500,Qs(t,s));do try{Nj();break}catch(D){mw(t,D)}while(!0);Ec(),El.current=x,He=v,_t!==null?s=0:(Tt=null,$t=0,s=Et)}if(s!==0){if(s===2&&(v=_i(t),v!==0&&(f=v,s=ld(t,v))),s===1)throw a=ia,Qs(t,0),ps(t,f),un(t,et()),a;if(s===6)ps(t,f);else{if(v=t.current.alternate,(f&30)===0&&!kj(v)&&(s=Il(t,f),s===2&&(x=_i(t),x!==0&&(f=x,s=ld(t,x))),s===1))throw a=ia,Qs(t,0),ps(t,f),un(t,et()),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(ps(t,f),(f&130023424)===f&&(s=id+500-et(),10<s)){if(xi(t,0)!==0)break;if(v=t.suspendedLanes,(v&f)!==f){en(),t.pingedLanes|=t.suspendedLanes&v;break}t.timeoutHandle=pc(Zs.bind(null,t,ln,Dr),s);break}Zs(t,ln,Dr);break;case 4:if(ps(t,f),(f&4194240)===f)break;for(s=t.eventTimes,v=-1;0<f;){var R=31-nn(f);x=1<<R,R=s[R],R>v&&(v=R),f&=~x}if(f=v,f=et()-f,f=(120>f?120:480>f?480:1080>f?1080:1920>f?1920:3e3>f?3e3:4320>f?4320:1960*Sj(f/1960))-f,10<f){t.timeoutHandle=pc(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,et()),t.callbackNode===a?hw.bind(null,t):null}function ld(t,s){var a=oa;return t.current.memoizedState.isDehydrated&&(Qs(t,s).flags|=256),t=Il(t,s),t!==2&&(s=ln,ln=a,s!==null&&ud(s)),t}function ud(t){ln===null?ln=t:ln.push.apply(ln,t)}function kj(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(!Hn(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 ps(t,s){for(s&=~sd,s&=~Nl,t.suspendedLanes|=s,t.pingedLanes&=~s,t=t.expirationTimes;0<s;){var a=31-nn(s),f=1<<a;t[a]=-1,s&=~f}}function pw(t){if((He&6)!==0)throw Error(r(327));Ji();var s=xi(t,0);if((s&1)===0)return un(t,et()),null;var a=Il(t,s);if(t.tag!==0&&a===2){var f=_i(t);f!==0&&(s=f,a=ld(t,f))}if(a===1)throw a=ia,Qs(t,0),ps(t,s),un(t,et()),a;if(a===6)throw Error(r(345));return t.finishedWork=t.current.alternate,t.finishedLanes=s,Zs(t,ln,Dr),un(t,et()),null}function cd(t,s){var a=He;He|=1;try{return t(s)}finally{He=a,He===0&&(Zi=et()+500,il&&as())}}function Xs(t){fs!==null&&fs.tag===0&&(He&6)===0&&Ji();var s=He;He|=1;var a=An.transition,f=Ge;try{if(An.transition=null,Ge=1,t)return t()}finally{Ge=f,An.transition=a,He=s,(He&6)===0&&as()}}function dd(){wn=Qi.current,rt(Qi)}function Qs(t,s){t.finishedWork=null,t.finishedLanes=0;var a=t.timeoutHandle;if(a!==-1&&(t.timeoutHandle=-1,ej(a)),_t!==null)for(a=_t.return;a!==null;){var f=a;switch(xc(f),f.tag){case 1:f=f.type.childContextTypes,f!=null&&rl();break;case 3:Yi(),rt(sn),rt(Ut),Mc();break;case 5:Ac(f);break;case 4:Yi();break;case 13:rt(at);break;case 19:rt(at);break;case 10:Nc(f.type._context);break;case 22:case 23:dd()}a=a.return}if(Tt=t,_t=t=ms(t.current,null),$t=wn=s,Et=0,ia=null,sd=Nl=Ks=0,ln=oa=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 R=x.next;x.next=v,f.next=R}a.pending=f}Vs=null}return t}function mw(t,s){do{var a=_t;try{if(Ec(),ml.current=wl,gl){for(var f=lt.memoizedState;f!==null;){var v=f.queue;v!==null&&(v.pending=null),f=f.next}gl=!1}if(Ys=0,jt=kt=lt=null,Jo=!1,ea=0,rd.current=null,a===null||a.return===null){Et=1,ia=s,_t=null;break}e:{var x=t,R=a.return,D=a,X=s;if(s=$t,D.flags|=32768,X!==null&&typeof X=="object"&&typeof X.then=="function"){var oe=X,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=F0(R);if(be!==null){be.flags&=-257,z0(be,R,D,x,s),be.mode&1&&D0(x,oe,s),s=be,X=oe;var Ne=s.updateQueue;if(Ne===null){var Re=new Set;Re.add(X),s.updateQueue=Re}else Ne.add(X);break e}else{if((s&1)===0){D0(x,oe,s),fd();break e}X=Error(r(426))}}else if(st&&D.mode&1){var gt=F0(R);if(gt!==null){(gt.flags&65536)===0&&(gt.flags|=256),z0(gt,R,D,x,s),Sc(Ki(X,D));break e}}x=X=Ki(X,D),Et!==4&&(Et=2),oa===null?oa=[x]:oa.push(x),x=R;do{switch(x.tag){case 3:x.flags|=65536,s&=-s,x.lanes|=s;var se=q0(x,X,s);c0(x,se);break e;case 1:D=X;var ee=x.type,ie=x.stateNode;if((x.flags&128)===0&&(typeof ee.getDerivedStateFromError=="function"||ie!==null&&typeof ie.componentDidCatch=="function"&&(ds===null||!ds.has(ie)))){x.flags|=65536,s&=-s,x.lanes|=s;var ge=$0(x,D,s);c0(x,ge);break e}}x=x.return}while(x!==null)}yw(a)}catch(je){s=je,_t===a&&a!==null&&(_t=a=a.return);continue}break}while(!0)}function gw(){var t=El.current;return El.current=wl,t===null?wl:t}function fd(){(Et===0||Et===3||Et===2)&&(Et=4),Tt===null||(Ks&268435455)===0&&(Nl&268435455)===0||ps(Tt,$t)}function Il(t,s){var a=He;He|=2;var f=gw();(Tt!==t||$t!==s)&&(Dr=null,Qs(t,s));do try{Ej();break}catch(v){mw(t,v)}while(!0);if(Ec(),He=a,El.current=f,_t!==null)throw Error(r(261));return Tt=null,$t=0,Et}function Ej(){for(;_t!==null;)vw(_t)}function Nj(){for(;_t!==null&&!or();)vw(_t)}function vw(t){var s=_w(t.alternate,t,wn);t.memoizedProps=t.pendingProps,s===null?yw(t):_t=s,rd.current=null}function yw(t){var s=t;do{var a=s.alternate;if(t=s.return,(s.flags&32768)===0){if(a=yj(a,s,wn),a!==null){_t=a;return}}else{if(a=wj(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=Ge,v=An.transition;try{An.transition=null,Ge=1,Cj(t,s,a,f)}finally{An.transition=v,Ge=f}return null}function Cj(t,s,a,f){do Ji();while(fs!==null);if((He&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(Qu(t,x),t===Tt&&(_t=Tt=null,$t=0),(a.subtreeFlags&2064)===0&&(a.flags&2064)===0||Rl||(Rl=!0,bw(ar,function(){return Ji(),null})),x=(a.flags&15990)!==0,(a.subtreeFlags&15990)!==0||x){x=An.transition,An.transition=null;var R=Ge;Ge=1;var D=He;He|=4,rd.current=null,_j(t,a),lw(a,t),GR(fc),En=!!dc,fc=dc=null,t.current=a,bj(a),vi(),He=D,Ge=R,An.transition=x}else t.current=a;if(Rl&&(Rl=!1,fs=t,jl=v),x=t.pendingLanes,x===0&&(ds=null),Sr(a.stateNode),un(t,et()),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(Cl)throw Cl=!1,t=od,od=null,t;return(jl&1)!==0&&t.tag!==0&&Ji(),x=t.pendingLanes,(x&1)!==0?t===ad?aa++:(aa=0,ad=t):aa=0,as(),null}function Ji(){if(fs!==null){var t=Si(jl),s=An.transition,a=Ge;try{if(An.transition=null,Ge=16>t?16:t,fs===null)var f=!1;else{if(t=fs,fs=null,jl=0,(He&6)!==0)throw Error(r(331));var v=He;for(He|=4,Se=t.current;Se!==null;){var x=Se,R=x.child;if((Se.flags&16)!==0){var D=x.deletions;if(D!==null){for(var X=0;X<D.length;X++){var oe=D[X];for(Se=oe;Se!==null;){var pe=Se;switch(pe.tag){case 0:case 11:case 15:sa(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(rw(pe),pe===oe){Se=null;break}if(he!==null){he.return=be,Se=he;break}Se=be}}}var Ne=x.alternate;if(Ne!==null){var Re=Ne.child;if(Re!==null){Ne.child=null;do{var gt=Re.sibling;Re.sibling=null,Re=gt}while(Re!==null)}}Se=x}}if((x.subtreeFlags&2064)!==0&&R!==null)R.return=x,Se=R;else e:for(;Se!==null;){if(x=Se,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:sa(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;){R=Se;var ie=R.child;if((R.subtreeFlags&2064)!==0&&ie!==null)ie.return=R,Se=ie;else e:for(R=ee;Se!==null;){if(D=Se,(D.flags&2048)!==0)try{switch(D.tag){case 0:case 11:case 15:kl(9,D)}}catch(je){ct(D,D.return,je)}if(D===R){Se=null;break e}var ge=D.sibling;if(ge!==null){ge.return=D.return,Se=ge;break e}Se=D.return}}if(He=v,as(),zt&&typeof zt.onPostCommitFiberRoot=="function")try{zt.onPostCommitFiberRoot(Ot,t)}catch{}f=!0}return f}finally{Ge=a,An.transition=s}}return!1}function ww(t,s,a){s=Ki(a,s),s=q0(t,s,1),t=us(t,s,1),s=en(),t!==null&&(es(t,1,s),un(t,s))}function ct(t,s,a){if(t.tag===3)ww(t,t,a);else for(;s!==null;){if(s.tag===3){ww(s,t,a);break}else if(s.tag===1){var f=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(ds===null||!ds.has(f))){t=Ki(a,t),t=$0(s,t,1),s=us(s,t,1),t=en(),s!==null&&(es(s,1,t),un(s,t));break}}s=s.return}}function Rj(t,s,a){var f=t.pingCache;f!==null&&f.delete(s),s=en(),t.pingedLanes|=t.suspendedLanes&a,Tt===t&&($t&a)===a&&(Et===4||Et===3&&($t&130023424)===$t&&500>et()-id?Qs(t,0):sd|=a),un(t,s)}function xw(t,s){s===0&&((t.mode&1)===0?s=1:(s=js,js<<=1,(js&130023424)===0&&(js=4194304)));var a=en();t=Lr(t,s),t!==null&&(es(t,s,a),un(t,a))}function jj(t){var s=t.memoizedState,a=0;s!==null&&(a=s.retryLane),xw(t,a)}function Tj(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),xw(t,a)}var _w;_w=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,vj(t,s,a);an=(t.flags&131072)!==0}else an=!1,st&&(s.flags&1048576)!==0&&e0(s,al,s.index);switch(s.lanes=0,s.tag){case 2:var f=s.type;bl(t,s),t=s.pendingProps;var v=zi(s,Ut.current);Gi(s,a),v=Lc(null,s,f,t,v,a);var x=qc();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,sl(s)):x=!1,s.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,jc(s),v.updater=xl,s.stateNode=v,v._reactInternals=s,Uc(s,f,t,a),s=Gc(null,s,f,!0,x,a)):(s.tag=0,st&&x&&wc(s),Jt(null,s,v,a),s=s.child),s;case 16:f=s.elementType;e:{switch(bl(t,s),t=s.pendingProps,v=f._init,f=v(f._payload),s.type=f,v=s.tag=Ij(f),t=Vn(f,t),v){case 0:s=Vc(null,s,f,t,a);break e;case 1:s=G0(null,s,f,t,a);break e;case 11:s=B0(null,s,f,t,a);break e;case 14:s=U0(null,s,f,Vn(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:Vn(f,v),Vc(t,s,f,v,a);case 1:return f=s.type,v=s.pendingProps,v=s.elementType===f?v:Vn(f,v),G0(t,s,f,v,a);case 3:e:{if(Y0(s),t===null)throw Error(r(387));f=s.pendingProps,x=s.memoizedState,v=x.element,u0(t,s),hl(s,f,null,a);var R=s.memoizedState;if(f=R.element,x.isDehydrated)if(x={element:f,isDehydrated:!1,cache:R.cache,pendingSuspenseBoundaries:R.pendingSuspenseBoundaries,transitions:R.transitions},s.updateQueue.baseState=x,s.memoizedState=x,s.flags&256){v=Ki(Error(r(423)),s),s=K0(t,s,f,a,v);break e}else if(f!==v){v=Ki(Error(r(424)),s),s=K0(t,s,f,a,v);break e}else for(yn=ss(s.stateNode.containerInfo.firstChild),vn=s,st=!0,Wn=null,a=a0(s,null,f,a),s.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(Hi(),f===v){s=$r(t,s,a);break e}Jt(t,s,f,a)}s=s.child}return s;case 5:return f0(s),t===null&&bc(s),f=s.type,v=s.pendingProps,x=t!==null?t.memoizedProps:null,R=v.children,hc(f,v)?R=null:x!==null&&hc(f,x)&&(s.flags|=32),V0(t,s),Jt(t,s,R,a),s.child;case 6:return t===null&&bc(s),null;case 13:return X0(t,s,a);case 4:return Tc(s,s.stateNode.containerInfo),f=s.pendingProps,t===null?s.child=Wi(s,null,f,a):Jt(t,s,f,a),s.child;case 11:return f=s.type,v=s.pendingProps,v=s.elementType===f?v:Vn(f,v),B0(t,s,f,v,a);case 7:return Jt(t,s,s.pendingProps,a),s.child;case 8:return Jt(t,s,s.pendingProps.children,a),s.child;case 12:return Jt(t,s,s.pendingProps.children,a),s.child;case 10:e:{if(f=s.type._context,v=s.pendingProps,x=s.memoizedProps,R=v.value,tt(cl,f._currentValue),f._currentValue=R,x!==null)if(Hn(x.value,R)){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){R=x.child;for(var X=D.firstContext;X!==null;){if(X.context===f){if(x.tag===1){X=qr(-1,a&-a),X.tag=2;var oe=x.updateQueue;if(oe!==null){oe=oe.shared;var pe=oe.pending;pe===null?X.next=X:(X.next=pe.next,pe.next=X),oe.pending=X}}x.lanes|=a,X=x.alternate,X!==null&&(X.lanes|=a),Cc(x.return,a,s),D.lanes|=a;break}X=X.next}}else if(x.tag===10)R=x.type===s.type?null:x.child;else if(x.tag===18){if(R=x.return,R===null)throw Error(r(341));R.lanes|=a,D=R.alternate,D!==null&&(D.lanes|=a),Cc(R,a,s),R=x.sibling}else R=x.child;if(R!==null)R.return=x;else for(R=x;R!==null;){if(R===s){R=null;break}if(x=R.sibling,x!==null){x.return=R.return,R=x;break}R=R.return}x=R}Jt(t,s,v.children,a),s=s.child}return s;case 9:return v=s.type,f=s.pendingProps.children,Gi(s,a),v=jn(v),f=f(v),s.flags|=1,Jt(t,s,f,a),s.child;case 14:return f=s.type,v=Vn(f,s.pendingProps),v=Vn(f.type,v),U0(t,s,f,v,a);case 15:return H0(t,s,s.type,s.pendingProps,a);case 17:return f=s.type,v=s.pendingProps,v=s.elementType===f?v:Vn(f,v),bl(t,s),s.tag=1,on(f)?(t=!0,sl(s)):t=!1,Gi(s,a),P0(s,f,v),Uc(s,f,v,a),Gc(null,s,f,!0,t,a);case 19:return Z0(t,s,a);case 22:return W0(t,s,a)}throw Error(r(156,s.tag))};function bw(t,s){return Ns(t,s)}function Aj(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 Aj(t,s,a,f)}function hd(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Ij(t){if(typeof t=="function")return hd(t)?1:0;if(t!=null){if(t=t.$$typeof,t===G)return 11;if(t===B)return 14}return 2}function ms(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 Ml(t,s,a,f,v,x){var R=2;if(f=t,typeof t=="function")hd(t)&&(R=1);else if(typeof t=="string")R=5;else e:switch(t){case A:return Js(a.children,v,x,s);case U:R=8,v|=8;break;case L:return t=In(12,a,s,v|2),t.elementType=L,t.lanes=x,t;case F:return t=In(13,a,s,v),t.elementType=F,t.lanes=x,t;case T:return t=In(19,a,s,v),t.elementType=T,t.lanes=x,t;case ne:return Ol(a,v,x,s);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case O:R=10;break e;case q:R=9;break e;case G:R=11;break e;case B:R=14;break e;case z:R=16,f=null;break e}throw Error(r(130,t==null?t:typeof t,""))}return s=In(R,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 Ol(t,s,a,f){return t=In(22,t,f,s),t.elementType=ne,t.lanes=a,t.stateNode={isHidden:!1},t}function pd(t,s,a){return t=In(6,t,null,s),t.lanes=a,t}function md(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 Mj(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 gd(t,s,a,f,v,x,R,D,X){return t=new Mj(t,s,a,D,X),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},jc(x),t}function Oj(t,s,a){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:P,key:f==null?null:""+f,children:t,containerInfo:s,implementation:a}}function Sw(t){if(!t)return os;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 Qy(t,a,s)}return s}function kw(t,s,a,f,v,x,R,D,X){return t=gd(a,f,!0,t,v,x,R,D,X),t.context=Sw(null),a=t.current,f=en(),v=hs(a),x=qr(f,v),x.callback=s??null,us(a,x,v),t.current.lanes=v,es(t,v,f),un(t,f),t}function Pl(t,s,a,f){var v=s.current,x=en(),R=hs(v);return a=Sw(a),s.context===null?s.context=a:s.pendingContext=a,s=qr(x,R),s.payload={element:t},f=f===void 0?null:f,f!==null&&(s.callback=f),t=us(v,s,R),t!==null&&(Kn(t,v,R,x),fl(t,v,R)),R}function Ll(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 Ew(t,s){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<s?a:s}}function vd(t,s){Ew(t,s),(t=t.alternate)&&Ew(t,s)}function Pj(){return null}var Nw=typeof reportError=="function"?reportError:function(t){console.error(t)};function yd(t){this._internalRoot=t}ql.prototype.render=yd.prototype.render=function(t){var s=this._internalRoot;if(s===null)throw Error(r(409));Pl(t,s,null,null)},ql.prototype.unmount=yd.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var s=t.containerInfo;Xs(function(){Pl(null,t,null,null)}),s[Ir]=null}};function ql(t){this._internalRoot=t}ql.prototype.unstable_scheduleHydration=function(t){if(t){var s=lr();t={blockedOn:null,target:t,priority:s};for(var a=0;a<Pt.length&&s!==0&&s<Pt[a].priority;a++);Pt.splice(a,0,t),a===0&&Mo(t)}};function wd(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function $l(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Cw(){}function Lj(t,s,a,f,v){if(v){if(typeof f=="function"){var x=f;f=function(){var oe=Ll(R);x.call(oe)}}var R=kw(s,f,t,0,null,!1,!1,"",Cw);return t._reactRootContainer=R,t[Ir]=R.current,Wo(t.nodeType===8?t.parentNode:t),Xs(),R}for(;v=t.lastChild;)t.removeChild(v);if(typeof f=="function"){var D=f;f=function(){var oe=Ll(X);D.call(oe)}}var X=gd(t,0,!1,null,null,!1,!1,"",Cw);return t._reactRootContainer=X,t[Ir]=X.current,Wo(t.nodeType===8?t.parentNode:t),Xs(function(){Pl(s,X,a,f)}),X}function Dl(t,s,a,f,v){var x=a._reactRootContainer;if(x){var R=x;if(typeof v=="function"){var D=v;v=function(){var X=Ll(R);D.call(X)}}Pl(s,R,t,v)}else R=Lj(a,s,t,v,f);return Ll(R)}Er=function(t){switch(t.tag){case 3:var s=t.stateNode;if(s.current.memoizedState.isDehydrated){var a=Zr(s.pendingLanes);a!==0&&(Bt(s,a|1),un(s,et()),(He&6)===0&&(Zi=et()+500,as()))}break;case 13:Xs(function(){var f=Lr(t,1);if(f!==null){var v=en();Kn(f,t,1,v)}}),vd(t,1)}},Nr=function(t){if(t.tag===13){var s=Lr(t,134217728);if(s!==null){var a=en();Kn(s,t,134217728,a)}vd(t,134217728)}},ki=function(t){if(t.tag===13){var s=hs(t),a=Lr(t,s);if(a!==null){var f=en();Kn(a,t,s,f)}vd(t,s)}},lr=function(){return Ge},To=function(t,s){var a=Ge;try{return Ge=t,s()}finally{Ge=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=nl(f);if(!v)throw Error(r(90));ve(f),we(f,v)}}}break;case"textarea":Je(t,a);break;case"select":s=a.value,s!=null&&ht(t,!!a.multiple,s,!1)}},hi=cd,rr=Xs;var qj={usingClientEntryPoint:!1,Events:[Yo,Di,nl,Gr,ut,cd]},la={findFiberByHostInstance:Bs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},$j={bundleType:la.bundleType,version:la.version,rendererPackageName:la.rendererPackageName,rendererConfig:la.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=Zt(t),t===null?null:t.stateNode},findFiberByHostInstance:la.findFiberByHostInstance||Pj,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 Fl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Fl.isDisabled&&Fl.supportsFiber)try{Ot=Fl.inject($j),zt=Fl}catch{}}return cn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=qj,cn.createPortal=function(t,s){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!wd(s))throw Error(r(200));return Oj(t,s,null,a)},cn.createRoot=function(t,s){if(!wd(t))throw Error(r(299));var a=!1,f="",v=Nw;return s!=null&&(s.unstable_strictMode===!0&&(a=!0),s.identifierPrefix!==void 0&&(f=s.identifierPrefix),s.onRecoverableError!==void 0&&(v=s.onRecoverableError)),s=gd(t,1,!1,null,null,a,!1,f,v),t[Ir]=s.current,Wo(t.nodeType===8?t.parentNode:t),new yd(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=Zt(s),t=t===null?null:t.stateNode,t},cn.flushSync=function(t){return Xs(t)},cn.hydrate=function(t,s,a){if(!$l(s))throw Error(r(200));return Dl(null,t,s,!0,a)},cn.hydrateRoot=function(t,s,a){if(!wd(t))throw Error(r(405));var f=a!=null&&a.hydratedSources||null,v=!1,x="",R=Nw;if(a!=null&&(a.unstable_strictMode===!0&&(v=!0),a.identifierPrefix!==void 0&&(x=a.identifierPrefix),a.onRecoverableError!==void 0&&(R=a.onRecoverableError)),s=kw(s,null,t,1,a??null,v,!1,x,R),t[Ir]=s.current,Wo(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 ql(s)},cn.render=function(t,s,a){if(!$l(s))throw Error(r(200));return Dl(null,t,s,!1,a)},cn.unmountComponentAtNode=function(t){if(!$l(t))throw Error(r(40));return t._reactRootContainer?(Xs(function(){Dl(null,null,t,!1,function(){t._reactRootContainer=null,t[Ir]=null})}),!0):!1},cn.unstable_batchedUpdates=cd,cn.unstable_renderSubtreeIntoContainer=function(t,s,a,f){if(!$l(a))throw Error(r(200));if(t==null||t._reactInternals===void 0)throw Error(r(38));return Dl(t,s,a,!1,f)},cn.version="18.3.1-next-f1338f8080-20240426",cn}var Pw;function PE(){if(Pw)return bd.exports;Pw=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(),bd.exports=Wj(),bd.exports}var Lw;function Vj(){if(Lw)return Bl;Lw=1;var e=PE();return Bl.createRoot=e.createRoot,Bl.hydrateRoot=e.hydrateRoot,Bl}var Gj=Vj(),j=Ia();const ue=Av(j);function Ft(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=Ft(e[r]))!==""&&(n+=(n&&" ")+i);else for(let r in e)e[r]&&(n+=(n&&" ")+r);return n}var Ed={exports:{}},Nd={},Cd={exports:{}},Rd={};/**
|
|
41
|
+
* @license React
|
|
42
|
+
* use-sync-external-store-shim.production.js
|
|
43
|
+
*
|
|
44
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
45
|
+
*
|
|
46
|
+
* This source code is licensed under the MIT license found in the
|
|
47
|
+
* LICENSE file in the root directory of this source tree.
|
|
48
|
+
*/var qw;function Yj(){if(qw)return Rd;qw=1;var e=Ia();function n(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var r=typeof Object.is=="function"?Object.is:n,i=e.useState,o=e.useEffect,l=e.useLayoutEffect,u=e.useDebugValue;function c(m,y){var w=y(),N=i({inst:{value:w,getSnapshot:y}}),_=N[0].inst,b=N[1];return l(function(){_.value=w,_.getSnapshot=y,h(_)&&b({inst:_})},[m,w,y]),o(function(){return h(_)&&b({inst:_}),m(function(){h(_)&&b({inst:_})})},[m]),u(w),w}function h(m){var y=m.getSnapshot;m=m.value;try{var w=y();return!r(m,w)}catch{return!0}}function p(m,y){return y()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:c;return Rd.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,Rd}var $w;function Kj(){return $w||($w=1,Cd.exports=Yj()),Cd.exports}/**
|
|
49
|
+
* @license React
|
|
50
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
51
|
+
*
|
|
52
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the MIT license found in the
|
|
55
|
+
* LICENSE file in the root directory of this source tree.
|
|
56
|
+
*/var Dw;function Xj(){if(Dw)return Nd;Dw=1;var e=Ia(),n=Kj();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 Nd.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 S(P){if(!k){if(k=!0,E=P,P=y(P),w!==void 0&&_.hasValue){var A=_.value;if(w(A,P))return C=A}return C=P}if(A=C,i(E,P))return A;var U=y(P);return w!==void 0&&w(A,U)?(E=P,A):(E=P,C=U)}var k=!1,E,C,I=m===void 0?null:m;return[function(){return S(d())},I===null?void 0:function(){return S(I())}]},[d,m,y,w]);var b=o(p,N[0],N[1]);return u(function(){_.hasValue=!0,_.value=b},[b]),h(b),b},Nd}var Fw;function Qj(){return Fw||(Fw=1,Ed.exports=Xj()),Ed.exports}var Zj=Qj();const Jj=Av(Zj),eT={},zw=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:()=>{(eT?"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},tT=e=>e?zw(e):zw,{useDebugValue:nT}=ue,{useSyncExternalStoreWithSelector:rT}=Jj,sT=e=>e;function LE(e,n=sT,r){const i=rT(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,r);return nT(i),i}const Bw=(e,n)=>{const r=tT(e),i=(o,l=n)=>LE(r,o,l);return Object.assign(i,r),i},iT=(e,n)=>e?Bw(e,n):Bw;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 oT={value:()=>{}};function Eu(){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 ou(r)}function ou(e){this._=e}function aT(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}})}ou.prototype=Eu.prototype={constructor:ou,on:function(e,n){var r=this._,i=aT(e+"",r),o,l=-1,u=i.length;if(arguments.length<2){for(;++l<u;)if((o=(e=i[l]).type)&&(o=lT(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]=Uw(r[o],e.name,n);else if(n==null)for(o in r)r[o]=Uw(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 ou(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 lT(e,n){for(var r=0,i=e.length,o;r<i;++r)if((o=e[r]).name===n)return o.value}function Uw(e,n,r){for(var i=0,o=e.length;i<o;++i)if(e[i].name===n){e[i]=oT,e=e.slice(0,i).concat(e.slice(i+1));break}return r!=null&&e.push({name:n,value:r}),e}var ov="http://www.w3.org/1999/xhtml";const Hw={svg:"http://www.w3.org/2000/svg",xhtml:ov,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Nu(e){var n=e+="",r=n.indexOf(":");return r>=0&&(n=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),Hw.hasOwnProperty(n)?{space:Hw[n],local:e}:e}function uT(e){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===ov&&n.documentElement.namespaceURI===ov?n.createElement(e):n.createElementNS(r,e)}}function cT(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function qE(e){var n=Nu(e);return(n.local?cT:uT)(n)}function dT(){}function Iv(e){return e==null?dT:function(){return this.querySelector(e)}}function fT(e){typeof e!="function"&&(e=Iv(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 hT(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function pT(){return[]}function $E(e){return e==null?pT:function(){return this.querySelectorAll(e)}}function mT(e){return function(){return hT(e.apply(this,arguments))}}function gT(e){typeof e=="function"?e=mT(e):e=$E(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 DE(e){return function(){return this.matches(e)}}function FE(e){return function(n){return n.matches(e)}}var vT=Array.prototype.find;function yT(e){return function(){return vT.call(this.children,e)}}function wT(){return this.firstElementChild}function xT(e){return this.select(e==null?wT:yT(typeof e=="function"?e:FE(e)))}var _T=Array.prototype.filter;function bT(){return Array.from(this.children)}function ST(e){return function(){return _T.call(this.children,e)}}function kT(e){return this.selectAll(e==null?bT:ST(typeof e=="function"?e:FE(e)))}function ET(e){typeof e!="function"&&(e=DE(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 zE(e){return new Array(e.length)}function NT(){return new xn(this._enter||this._groups.map(zE),this._parents)}function du(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}du.prototype={constructor:du,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 CT(e){return function(){return e}}function RT(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 du(e,l[u]);for(;u<h;++u)(c=n[u])&&(o[u]=c)}function jT(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 du(e,l[c]);for(c=0;c<d;++c)(h=n[c])&&p.get(y[c])===h&&(o[c]=h)}function TT(e){return e.__data__}function AT(e,n){if(!arguments.length)return Array.from(this,TT);var r=n?jT:RT,i=this._parents,o=this._groups;typeof e!="function"&&(e=CT(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=IT(e.call(d,d&&d.__data__,p,i)),N=w.length,_=c[p]=new Array(N),b=u[p]=new Array(N),S=h[p]=new Array(y);r(d,m,_,b,S,w,n);for(var k=0,E=0,C,I;k<N;++k)if(C=_[k]){for(k>=E&&(E=k+1);!(I=b[E])&&++E<N;);C._next=I||null}}return u=new xn(u,i),u._enter=c,u._exit=h,u}function IT(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function MT(){return new xn(this._exit||this._groups.map(zE),this._parents)}function OT(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 PT(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 LT(){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 qT(e){e||(e=$T);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 $T(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function DT(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function FT(){return Array.from(this)}function zT(){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 BT(){let e=0;for(const n of this)++e;return e}function UT(){return!this.node()}function HT(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 WT(e){return function(){this.removeAttribute(e)}}function VT(e){return function(){this.removeAttributeNS(e.space,e.local)}}function GT(e,n){return function(){this.setAttribute(e,n)}}function YT(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function KT(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function XT(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 QT(e,n){var r=Nu(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?VT:WT:typeof n=="function"?r.local?XT:KT:r.local?YT:GT)(r,n))}function BE(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ZT(e){return function(){this.style.removeProperty(e)}}function JT(e,n,r){return function(){this.style.setProperty(e,n,r)}}function eA(e,n,r){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,r)}}function tA(e,n,r){return arguments.length>1?this.each((n==null?ZT:typeof n=="function"?eA:JT)(e,n,r??"")):po(this.node(),e)}function po(e,n){return e.style.getPropertyValue(n)||BE(e).getComputedStyle(e,null).getPropertyValue(n)}function nA(e){return function(){delete this[e]}}function rA(e,n){return function(){this[e]=n}}function sA(e,n){return function(){var r=n.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function iA(e,n){return arguments.length>1?this.each((n==null?nA:typeof n=="function"?sA:rA)(e,n)):this.node()[e]}function UE(e){return e.trim().split(/^|\s+/)}function Mv(e){return e.classList||new HE(e)}function HE(e){this._node=e,this._names=UE(e.getAttribute("class")||"")}HE.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 WE(e,n){for(var r=Mv(e),i=-1,o=n.length;++i<o;)r.add(n[i])}function VE(e,n){for(var r=Mv(e),i=-1,o=n.length;++i<o;)r.remove(n[i])}function oA(e){return function(){WE(this,e)}}function aA(e){return function(){VE(this,e)}}function lA(e,n){return function(){(n.apply(this,arguments)?WE:VE)(this,e)}}function uA(e,n){var r=UE(e+"");if(arguments.length<2){for(var i=Mv(this.node()),o=-1,l=r.length;++o<l;)if(!i.contains(r[o]))return!1;return!0}return this.each((typeof n=="function"?lA:n?oA:aA)(r,n))}function cA(){this.textContent=""}function dA(e){return function(){this.textContent=e}}function fA(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function hA(e){return arguments.length?this.each(e==null?cA:(typeof e=="function"?fA:dA)(e)):this.node().textContent}function pA(){this.innerHTML=""}function mA(e){return function(){this.innerHTML=e}}function gA(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function vA(e){return arguments.length?this.each(e==null?pA:(typeof e=="function"?gA:mA)(e)):this.node().innerHTML}function yA(){this.nextSibling&&this.parentNode.appendChild(this)}function wA(){return this.each(yA)}function xA(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function _A(){return this.each(xA)}function bA(e){var n=typeof e=="function"?e:qE(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function SA(){return null}function kA(e,n){var r=typeof e=="function"?e:qE(e),i=n==null?SA:typeof n=="function"?n:Iv(n);return this.select(function(){return this.insertBefore(r.apply(this,arguments),i.apply(this,arguments)||null)})}function EA(){var e=this.parentNode;e&&e.removeChild(this)}function NA(){return this.each(EA)}function CA(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function RA(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function jA(e){return this.select(e?RA:CA)}function TA(e){return arguments.length?this.property("__data__",e):this.node().__data__}function AA(e){return function(n){e.call(this,n,this.__data__)}}function IA(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 MA(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 OA(e,n,r){return function(){var i=this.__on,o,l=AA(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 PA(e,n,r){var i=IA(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?OA:MA,o=0;o<l;++o)this.each(c(i[o],n,r));return this}function GE(e,n,r){var i=BE(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 LA(e,n){return function(){return GE(this,e,n)}}function qA(e,n){return function(){return GE(this,e,n.apply(this,arguments))}}function $A(e,n){return this.each((typeof n=="function"?qA:LA)(e,n))}function*DA(){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 YE=[null];function xn(e,n){this._groups=e,this._parents=n}function Ma(){return new xn([[document.documentElement]],YE)}function FA(){return this}xn.prototype=Ma.prototype={constructor:xn,select:fT,selectAll:gT,selectChild:xT,selectChildren:kT,filter:ET,data:AT,enter:NT,exit:MT,join:OT,merge:PT,selection:FA,order:LT,sort:qT,call:DT,nodes:FT,node:zT,size:BT,empty:UT,each:HT,attr:QT,style:tA,property:iA,classed:uA,text:hA,html:vA,raise:wA,lower:_A,append:bA,insert:kA,remove:NA,clone:jA,datum:TA,on:PA,dispatch:$A,[Symbol.iterator]:DA};function On(e){return typeof e=="string"?new xn([[document.querySelector(e)]],[document.documentElement]):new xn([[e]],YE)}function zA(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Qn(e,n){if(e=zA(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 BA={passive:!1},ba={capture:!0,passive:!1};function jd(e){e.stopImmediatePropagation()}function uo(e){e.preventDefault(),e.stopImmediatePropagation()}function KE(e){var n=e.document.documentElement,r=On(e).on("dragstart.drag",uo,ba);"onselectstart"in n?r.on("selectstart.drag",uo,ba):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function XE(e,n){var r=e.document.documentElement,i=On(e).on("dragstart.drag",null);n&&(i.on("click.drag",uo,ba),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 Ul=e=>()=>e;function av(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}})}av.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function UA(e){return!e.ctrlKey&&!e.button}function HA(){return this.parentNode}function WA(e,n){return n??{x:e.x,y:e.y}}function VA(){return navigator.maxTouchPoints||"ontouchstart"in this}function GA(){var e=UA,n=HA,r=WA,i=VA,o={},l=Eu("start","drag","end"),u=0,c,h,p,d,m=0;function y(C){C.on("mousedown.drag",w).filter(i).on("touchstart.drag",b).on("touchmove.drag",S,BA).on("touchend.drag touchcancel.drag",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(C,I){if(!(d||!e.call(this,C,I))){var P=E(this,n.call(this,C,I),C,I,"mouse");P&&(On(C.view).on("mousemove.drag",N,ba).on("mouseup.drag",_,ba),KE(C.view),jd(C),p=!1,c=C.clientX,h=C.clientY,P("start",C))}}function N(C){if(uo(C),!p){var I=C.clientX-c,P=C.clientY-h;p=I*I+P*P>m}o.mouse("drag",C)}function _(C){On(C.view).on("mousemove.drag mouseup.drag",null),XE(C.view,p),uo(C),o.mouse("end",C)}function b(C,I){if(e.call(this,C,I)){var P=C.changedTouches,A=n.call(this,C,I),U=P.length,L,O;for(L=0;L<U;++L)(O=E(this,A,C,I,P[L].identifier,P[L]))&&(jd(C),O("start",C,P[L]))}}function S(C){var I=C.changedTouches,P=I.length,A,U;for(A=0;A<P;++A)(U=o[I[A].identifier])&&(uo(C),U("drag",C,I[A]))}function k(C){var I=C.changedTouches,P=I.length,A,U;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),A=0;A<P;++A)(U=o[I[A].identifier])&&(jd(C),U("end",C,I[A]))}function E(C,I,P,A,U,L){var O=l.copy(),q=Qn(L||P,I),G,F,T;if((T=r.call(C,new av("beforestart",{sourceEvent:P,target:y,identifier:U,active:u,x:q[0],y:q[1],dx:0,dy:0,dispatch:O}),A))!=null)return G=T.x-q[0]||0,F=T.y-q[1]||0,function B(z,ne,Z){var $=q,Q;switch(z){case"start":o[U]=B,Q=u++;break;case"end":delete o[U],--u;case"drag":q=Qn(Z||ne,I),Q=u;break}O.call(z,C,new av(z,{sourceEvent:ne,subject:T,target:y,identifier:U,active:Q,x:q[0]+G,y:q[1]+F,dx:q[0]-$[0],dy:q[1]-$[1],dispatch:O}),A)}}return y.filter=function(C){return arguments.length?(e=typeof C=="function"?C:Ul(!!C),y):e},y.container=function(C){return arguments.length?(n=typeof C=="function"?C:Ul(C),y):n},y.subject=function(C){return arguments.length?(r=typeof C=="function"?C:Ul(C),y):r},y.touchable=function(C){return arguments.length?(i=typeof C=="function"?C:Ul(!!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 Ov(e,n,r){e.prototype=n.prototype=r,r.constructor=e}function QE(e,n){var r=Object.create(e.prototype);for(var i in n)r[i]=n[i];return r}function Oa(){}var Sa=.7,fu=1/Sa,co="\\s*([+-]?\\d+)\\s*",ka="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",mr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",YA=/^#([0-9a-f]{3,8})$/,KA=new RegExp(`^rgb\\(${co},${co},${co}\\)$`),XA=new RegExp(`^rgb\\(${mr},${mr},${mr}\\)$`),QA=new RegExp(`^rgba\\(${co},${co},${co},${ka}\\)$`),ZA=new RegExp(`^rgba\\(${mr},${mr},${mr},${ka}\\)$`),JA=new RegExp(`^hsl\\(${ka},${mr},${mr}\\)$`),e2=new RegExp(`^hsla\\(${ka},${mr},${mr},${ka}\\)$`),Ww={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};Ov(Oa,Ea,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Vw,formatHex:Vw,formatHex8:t2,formatHsl:n2,formatRgb:Gw,toString:Gw});function Vw(){return this.rgb().formatHex()}function t2(){return this.rgb().formatHex8()}function n2(){return ZE(this).formatHsl()}function Gw(){return this.rgb().formatRgb()}function Ea(e){var n,r;return e=(e+"").trim().toLowerCase(),(n=YA.exec(e))?(r=n[1].length,n=parseInt(n[1],16),r===6?Yw(n):r===3?new dn(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):r===8?Hl(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):r===4?Hl(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=KA.exec(e))?new dn(n[1],n[2],n[3],1):(n=XA.exec(e))?new dn(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=QA.exec(e))?Hl(n[1],n[2],n[3],n[4]):(n=ZA.exec(e))?Hl(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=JA.exec(e))?Qw(n[1],n[2]/100,n[3]/100,1):(n=e2.exec(e))?Qw(n[1],n[2]/100,n[3]/100,n[4]):Ww.hasOwnProperty(e)?Yw(Ww[e]):e==="transparent"?new dn(NaN,NaN,NaN,0):null}function Yw(e){return new dn(e>>16&255,e>>8&255,e&255,1)}function Hl(e,n,r,i){return i<=0&&(e=n=r=NaN),new dn(e,n,r,i)}function r2(e){return e instanceof Oa||(e=Ea(e)),e?(e=e.rgb(),new dn(e.r,e.g,e.b,e.opacity)):new dn}function lv(e,n,r,i){return arguments.length===1?r2(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}Ov(dn,lv,QE(Oa,{brighter(e){return e=e==null?fu:Math.pow(fu,e),new dn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Sa:Math.pow(Sa,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),hu(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:Kw,formatHex:Kw,formatHex8:s2,formatRgb:Xw,toString:Xw}));function Kw(){return`#${ni(this.r)}${ni(this.g)}${ni(this.b)}`}function s2(){return`#${ni(this.r)}${ni(this.g)}${ni(this.b)}${ni((isNaN(this.opacity)?1:this.opacity)*255)}`}function Xw(){const e=hu(this.opacity);return`${e===1?"rgb(":"rgba("}${si(this.r)}, ${si(this.g)}, ${si(this.b)}${e===1?")":`, ${e})`}`}function hu(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 Qw(e,n,r,i){return i<=0?e=n=r=NaN:r<=0||r>=1?e=n=NaN:n<=0&&(e=NaN),new Zn(e,n,r,i)}function ZE(e){if(e instanceof Zn)return new Zn(e.h,e.s,e.l,e.opacity);if(e instanceof Oa||(e=Ea(e)),!e)return new Zn;if(e instanceof Zn)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 Zn(u,c,h,e.opacity)}function i2(e,n,r,i){return arguments.length===1?ZE(e):new Zn(e,n,r,i??1)}function Zn(e,n,r,i){this.h=+e,this.s=+n,this.l=+r,this.opacity=+i}Ov(Zn,i2,QE(Oa,{brighter(e){return e=e==null?fu:Math.pow(fu,e),new Zn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Sa:Math.pow(Sa,e),new Zn(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(Td(e>=240?e-240:e+120,o,i),Td(e,o,i),Td(e<120?e+240:e-120,o,i),this.opacity)},clamp(){return new Zn(Zw(this.h),Wl(this.s),Wl(this.l),hu(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=hu(this.opacity);return`${e===1?"hsl(":"hsla("}${Zw(this.h)}, ${Wl(this.s)*100}%, ${Wl(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Zw(e){return e=(e||0)%360,e<0?e+360:e}function Wl(e){return Math.max(0,Math.min(1,e||0))}function Td(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 JE=e=>()=>e;function o2(e,n){return function(r){return e+r*n}}function a2(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 l2(e){return(e=+e)==1?eN:function(n,r){return r-n?a2(n,r,e):JE(isNaN(n)?r:n)}}function eN(e,n){var r=n-e;return r?o2(e,r):JE(isNaN(e)?n:e)}const Jw=(function e(n){var r=l2(n);function i(o,l){var u=r((o=lv(o)).r,(l=lv(l)).r),c=r(o.g,l.g),h=r(o.b,l.b),p=eN(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 ys(e,n){return e=+e,n=+n,function(r){return e*(1-r)+n*r}}var uv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ad=new RegExp(uv.source,"g");function u2(e){return function(){return e}}function c2(e){return function(n){return e(n)+""}}function d2(e,n){var r=uv.lastIndex=Ad.lastIndex=0,i,o,l,u=-1,c=[],h=[];for(e=e+"",n=n+"";(i=uv.exec(e))&&(o=Ad.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:ys(i,o)})),r=Ad.lastIndex;return r<n.length&&(l=n.slice(r),c[u]?c[u]+=l:c[++u]=l),c.length<2?h[0]?c2(h[0].x):u2(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 ex=180/Math.PI,cv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function tN(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)*ex,skewX:Math.atan(h)*ex,scaleX:u,scaleY:c}}var Vl;function f2(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?cv:tN(n.a,n.b,n.c,n.d,n.e,n.f)}function h2(e){return e==null||(Vl||(Vl=document.createElementNS("http://www.w3.org/2000/svg","g")),Vl.setAttribute("transform",e),!(e=Vl.transform.baseVal.consolidate()))?cv:(e=e.matrix,tN(e.a,e.b,e.c,e.d,e.e,e.f))}function nN(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:ys(p,m)},{i:_-2,x:ys(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:ys(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:ys(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:ys(p,m)},{i:_-2,x:ys(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,b;++N<_;)m[(b=y[N]).i]=b.x(w);return m.join("")}}}var p2=nN(f2,"px, ","px)","deg)"),m2=nN(h2,", ",")",")"),g2=1e-12;function tx(e){return((e=Math.exp(e))+1/e)/2}function v2(e){return((e=Math.exp(e))-1/e)/2}function y2(e){return((e=Math.exp(2*e))-1)/(e+1)}const w2=(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,b,S;if(_<g2)S=Math.log(y/p)/n,b=function(A){return[c+A*w,h+A*N,p*Math.exp(n*A*S)]};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),I=Math.log(Math.sqrt(E*E+1)-E),P=Math.log(Math.sqrt(C*C+1)-C);S=(P-I)/n,b=function(A){var U=A*S,L=tx(I),O=p/(r*k)*(L*y2(n*U+I)-v2(I));return[c+O*w,h+O*N,p*L/tx(n*U+I)]}}return b.duration=S*1e3*n/Math.SQRT2,b}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 mo=0,ga=0,ca=0,rN=1e3,pu,va,mu=0,oi=0,Cu=0,Na=typeof performance=="object"&&performance.now?performance:Date,sN=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Pv(){return oi||(sN(x2),oi=Na.now()+Cu)}function x2(){oi=0}function gu(){this._call=this._time=this._next=null}gu.prototype=iN.prototype={constructor:gu,restart:function(e,n,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?Pv():+r)+(n==null?0:+n),!this._next&&va!==this&&(va?va._next=this:pu=this,va=this),this._call=e,this._time=r,dv()},stop:function(){this._call&&(this._call=null,this._time=1/0,dv())}};function iN(e,n,r){var i=new gu;return i.restart(e,n,r),i}function _2(){Pv(),++mo;for(var e=pu,n;e;)(n=oi-e._time)>=0&&e._call.call(void 0,n),e=e._next;--mo}function nx(){oi=(mu=Na.now())+Cu,mo=ga=0;try{_2()}finally{mo=0,S2(),oi=0}}function b2(){var e=Na.now(),n=e-mu;n>rN&&(Cu-=n,mu=e)}function S2(){for(var e,n=pu,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:pu=r);va=e,dv(i)}function dv(e){if(!mo){ga&&(ga=clearTimeout(ga));var n=e-oi;n>24?(e<1/0&&(ga=setTimeout(nx,e-Na.now()-Cu)),ca&&(ca=clearInterval(ca))):(ca||(mu=Na.now(),ca=setInterval(b2,rN)),mo=1,sN(nx))}}function rx(e,n,r){var i=new gu;return n=n==null?0:+n,i.restart(o=>{i.stop(),e(o+n)},n,r),i}var k2=Eu("start","end","cancel","interrupt"),E2=[],oN=0,sx=1,fv=2,au=3,ix=4,hv=5,lu=6;function Ru(e,n,r,i,o,l){var u=e.__transition;if(!u)e.__transition={};else if(r in u)return;N2(e,r,{name:n,index:i,group:o,on:k2,tween:E2,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:oN})}function Lv(e,n){var r=tr(e,n);if(r.state>oN)throw new Error("too late; already scheduled");return r}function gr(e,n){var r=tr(e,n);if(r.state>au)throw new Error("too late; already running");return r}function tr(e,n){var r=e.__transition;if(!r||!(r=r[n]))throw new Error("transition not found");return r}function N2(e,n,r){var i=e.__transition,o;i[n]=r,r.timer=iN(l,0,r.time);function l(p){r.state=sx,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!==sx)return h();for(d in i)if(w=i[d],w.name===r.name){if(w.state===au)return rx(u);w.state===ix?(w.state=lu,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete i[d]):+d<n&&(w.state=lu,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete i[d])}if(rx(function(){r.state===au&&(r.state=ix,r.timer.restart(c,r.delay,r.time),c(p))}),r.state=fv,r.on.call("start",e,e.__data__,r.index,r.group),r.state===fv){for(r.state=au,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=hv,1),m=-1,y=o.length;++m<y;)o[m].call(e,d);r.state===hv&&(r.on.call("end",e,e.__data__,r.index,r.group),h())}function h(){r.state=lu,r.timer.stop(),delete i[n];for(var p in i)return;delete e.__transition}}function uu(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>fv&&i.state<hv,i.state=lu,i.timer.stop(),i.on.call(o?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete r[u]}l&&delete e.__transition}}function C2(e){return this.each(function(){uu(this,e)})}function R2(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 j2(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 T2(e,n){var r=this._id;if(e+="",arguments.length<2){for(var i=tr(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?R2:j2)(r,e,n))}function qv(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 tr(o,i).value[n]}}function aN(e,n){var r;return(typeof n=="number"?ys:n instanceof Ea?Jw:(r=Ea(n))?(n=r,Jw):d2)(e,n)}function A2(e){return function(){this.removeAttribute(e)}}function I2(e){return function(){this.removeAttributeNS(e.space,e.local)}}function M2(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 O2(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 P2(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 L2(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 q2(e,n){var r=Nu(e),i=r==="transform"?m2:aN;return this.attrTween(e,typeof n=="function"?(r.local?L2:P2)(r,i,qv(this,"attr."+e,n)):n==null?(r.local?I2:A2)(r):(r.local?O2:M2)(r,i,n))}function $2(e,n){return function(r){this.setAttribute(e,n.call(this,r))}}function D2(e,n){return function(r){this.setAttributeNS(e.space,e.local,n.call(this,r))}}function F2(e,n){var r,i;function o(){var l=n.apply(this,arguments);return l!==i&&(r=(i=l)&&D2(e,l)),r}return o._value=n,o}function z2(e,n){var r,i;function o(){var l=n.apply(this,arguments);return l!==i&&(r=(i=l)&&$2(e,l)),r}return o._value=n,o}function B2(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=Nu(e);return this.tween(r,(i.local?F2:z2)(i,n))}function U2(e,n){return function(){Lv(this,e).delay=+n.apply(this,arguments)}}function H2(e,n){return n=+n,function(){Lv(this,e).delay=n}}function W2(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?U2:H2)(n,e)):tr(this.node(),n).delay}function V2(e,n){return function(){gr(this,e).duration=+n.apply(this,arguments)}}function G2(e,n){return n=+n,function(){gr(this,e).duration=n}}function Y2(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?V2:G2)(n,e)):tr(this.node(),n).duration}function K2(e,n){if(typeof n!="function")throw new Error;return function(){gr(this,e).ease=n}}function X2(e){var n=this._id;return arguments.length?this.each(K2(n,e)):tr(this.node(),n).ease}function Q2(e,n){return function(){var r=n.apply(this,arguments);if(typeof r!="function")throw new Error;gr(this,e).ease=r}}function Z2(e){if(typeof e!="function")throw new Error;return this.each(Q2(this._id,e))}function J2(e){typeof e!="function"&&(e=DE(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 eI(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 tI(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 nI(e,n,r){var i,o,l=tI(n)?Lv:gr;return function(){var u=l(this,e),c=u.on;c!==i&&(o=(i=c).copy()).on(n,r),u.on=o}}function rI(e,n){var r=this._id;return arguments.length<2?tr(this.node(),r).on.on(e):this.each(nI(r,e,n))}function sI(e){return function(){var n=this.parentNode;for(var r in this.__transition)if(+r!==e)return;n&&n.removeChild(this)}}function iI(){return this.on("end.remove",sI(this._id))}function oI(e){var n=this._name,r=this._id;typeof e!="function"&&(e=Iv(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,Ru(p[y],n,r,y,p,tr(d,r)));return new Ur(l,this._parents,n,r)}function aI(e){var n=this._name,r=this._id;typeof e!="function"&&(e=$E(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=tr(d,r),_=0,b=y.length;_<b;++_)(w=y[_])&&Ru(w,n,r,_,y,N);l.push(y),u.push(d)}return new Ur(l,u,n,r)}var lI=Ma.prototype.constructor;function uI(){return new lI(this._groups,this._parents)}function cI(e,n){var r,i,o;return function(){var l=po(this,e),u=(this.style.removeProperty(e),po(this,e));return l===u?null:l===r&&u===i?o:o=n(r=l,i=u)}}function lN(e){return function(){this.style.removeProperty(e)}}function dI(e,n,r){var i,o=r+"",l;return function(){var u=po(this,e);return u===o?null:u===i?l:l=n(i=u,r)}}function fI(e,n,r){var i,o,l;return function(){var u=po(this,e),c=r(this),h=c+"";return c==null&&(h=c=(this.style.removeProperty(e),po(this,e))),u===h?null:u===i&&h===o?l:(o=h,l=n(i=u,c))}}function hI(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=lN(n)):void 0;(p!==r||o!==d)&&(i=(r=p).copy()).on(u,o=d),h.on=i}}function pI(e,n,r){var i=(e+="")=="transform"?p2:aN;return n==null?this.styleTween(e,cI(e,i)).on("end.style."+e,lN(e)):typeof n=="function"?this.styleTween(e,fI(e,i,qv(this,"style."+e,n))).each(hI(this._id,e)):this.styleTween(e,dI(e,i,n),r).on("end.style."+e,null)}function mI(e,n,r){return function(i){this.style.setProperty(e,n.call(this,i),r)}}function gI(e,n,r){var i,o;function l(){var u=n.apply(this,arguments);return u!==o&&(i=(o=u)&&mI(e,u,r)),i}return l._value=n,l}function vI(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,gI(e,n,r??""))}function yI(e){return function(){this.textContent=e}}function wI(e){return function(){var n=e(this);this.textContent=n??""}}function xI(e){return this.tween("text",typeof e=="function"?wI(qv(this,"text",e)):yI(e==null?"":e+""))}function _I(e){return function(n){this.textContent=e.call(this,n)}}function bI(e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&_I(o)),n}return i._value=e,i}function SI(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,bI(e))}function kI(){for(var e=this._name,n=this._id,r=uN(),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=tr(h,n);Ru(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 EI(){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 NI=0;function Ur(e,n,r,i){this._groups=e,this._parents=n,this._name=r,this._id=i}function uN(){return++NI}var Fr=Ma.prototype;Ur.prototype={constructor:Ur,select:oI,selectAll:aI,selectChild:Fr.selectChild,selectChildren:Fr.selectChildren,filter:J2,merge:eI,selection:uI,transition:kI,call:Fr.call,nodes:Fr.nodes,node:Fr.node,size:Fr.size,empty:Fr.empty,each:Fr.each,on:rI,attr:q2,attrTween:B2,style:pI,styleTween:vI,text:xI,textTween:SI,remove:iI,tween:T2,delay:W2,duration:Y2,ease:X2,easeVarying:Z2,end:EI,[Symbol.iterator]:Fr[Symbol.iterator]};function CI(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var RI={time:null,delay:0,duration:250,ease:CI};function jI(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 TI(e){var n,r;e instanceof Ur?(n=e._id,e=e._name):(n=uN(),(r=RI).time=Pv(),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])&&Ru(h,e,n,p,u,r||jI(h,n));return new Ur(i,this._parents,e,n)}Ma.prototype.interrupt=C2;Ma.prototype.transition=TI;const Gl=e=>()=>e;function AI(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 Id(e){e.stopImmediatePropagation()}function da(e){e.preventDefault(),e.stopImmediatePropagation()}function II(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function MI(){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 ox(){return this.__zoom||Br}function OI(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function PI(){return navigator.maxTouchPoints||"ontouchstart"in this}function LI(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 cN(){var e=II,n=MI,r=LI,i=OI,o=PI,l=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],c=250,h=w2,p=Eu("start","zoom","end"),d,m,y,w=500,N=150,_=0,b=10;function S(T){T.property("__zoom",ox).on("wheel.zoom",U,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",O).filter(o).on("touchstart.zoom",q).on("touchmove.zoom",G).on("touchend.zoom touchcancel.zoom",F).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(T,B,z,ne){var Z=T.selection?T.selection():T;Z.property("__zoom",ox),T!==Z?I(T,B,z,ne):Z.interrupt().each(function(){P(this,arguments).event(ne).start().zoom(null,typeof B=="function"?B.apply(this,arguments):B).end()})},S.scaleBy=function(T,B,z,ne){S.scaleTo(T,function(){var Z=this.__zoom.k,$=typeof B=="function"?B.apply(this,arguments):B;return Z*$},z,ne)},S.scaleTo=function(T,B,z,ne){S.transform(T,function(){var Z=n.apply(this,arguments),$=this.__zoom,Q=z==null?C(Z):typeof z=="function"?z.apply(this,arguments):z,M=$.invert(Q),V=typeof B=="function"?B.apply(this,arguments):B;return r(E(k($,V),Q,M),Z,u)},z,ne)},S.translateBy=function(T,B,z,ne){S.transform(T,function(){return r(this.__zoom.translate(typeof B=="function"?B.apply(this,arguments):B,typeof z=="function"?z.apply(this,arguments):z),n.apply(this,arguments),u)},null,ne)},S.translateTo=function(T,B,z,ne,Z){S.transform(T,function(){var $=n.apply(this,arguments),Q=this.__zoom,M=ne==null?C($):typeof ne=="function"?ne.apply(this,arguments):ne;return r(Br.translate(M[0],M[1]).scale(Q.k).translate(typeof B=="function"?-B.apply(this,arguments):-B,typeof z=="function"?-z.apply(this,arguments):-z),$,u)},ne,Z)};function k(T,B){return B=Math.max(l[0],Math.min(l[1],B)),B===T.k?T:new zr(B,T.x,T.y)}function E(T,B,z){var ne=B[0]-z[0]*T.k,Z=B[1]-z[1]*T.k;return ne===T.x&&Z===T.y?T:new zr(T.k,ne,Z)}function C(T){return[(+T[0][0]+ +T[1][0])/2,(+T[0][1]+ +T[1][1])/2]}function I(T,B,z,ne){T.on("start.zoom",function(){P(this,arguments).event(ne).start()}).on("interrupt.zoom end.zoom",function(){P(this,arguments).event(ne).end()}).tween("zoom",function(){var Z=this,$=arguments,Q=P(Z,$).event(ne),M=n.apply(Z,$),V=z==null?C(M):typeof z=="function"?z.apply(Z,$):z,Y=Math.max(M[1][0]-M[0][0],M[1][1]-M[0][1]),H=Z.__zoom,J=typeof B=="function"?B.apply(Z,$):B,re=h(H.invert(V).concat(Y/H.k),J.invert(V).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,V[0]-fe[0]*te,V[1]-fe[1]*te)}Q.zoom(null,le)}})}function P(T,B,z){return!z&&T.__zooming||new A(T,B)}function A(T,B){this.that=T,this.args=B,this.active=0,this.sourceEvent=null,this.extent=n.apply(T,B),this.taps=0}A.prototype={event:function(T){return T&&(this.sourceEvent=T),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(T,B){return this.mouse&&T!=="mouse"&&(this.mouse[1]=B.invert(this.mouse[0])),this.touch0&&T!=="touch"&&(this.touch0[1]=B.invert(this.touch0[0])),this.touch1&&T!=="touch"&&(this.touch1[1]=B.invert(this.touch1[0])),this.that.__zoom=B,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(T){var B=On(this.that).datum();p.call(T,this.that,new AI(T,{sourceEvent:this.sourceEvent,target:S,transform:this.that.__zoom,dispatch:p}),B)}};function U(T,...B){if(!e.apply(this,arguments))return;var z=P(this,B).event(T),ne=this.__zoom,Z=Math.max(l[0],Math.min(l[1],ne.k*Math.pow(2,i.apply(this,arguments)))),$=Qn(T);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($)],uu(this),z.start()}da(T),z.wheel=setTimeout(Q,N),z.zoom("mouse",r(E(k(ne,Z),z.mouse[0],z.mouse[1]),z.extent,u));function Q(){z.wheel=null,z.end()}}function L(T,...B){if(y||!e.apply(this,arguments))return;var z=T.currentTarget,ne=P(this,B,!0).event(T),Z=On(T.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",Y,!0),$=Qn(T,z),Q=T.clientX,M=T.clientY;KE(T.view),Id(T),ne.mouse=[$,this.__zoom.invert($)],uu(this),ne.start();function V(H){if(da(H),!ne.moved){var J=H.clientX-Q,re=H.clientY-M;ne.moved=J*J+re*re>_}ne.event(H).zoom("mouse",r(E(ne.that.__zoom,ne.mouse[0]=Qn(H,z),ne.mouse[1]),ne.extent,u))}function Y(H){Z.on("mousemove.zoom mouseup.zoom",null),XE(H.view,ne.moved),da(H),ne.event(H).end()}}function O(T,...B){if(e.apply(this,arguments)){var z=this.__zoom,ne=Qn(T.changedTouches?T.changedTouches[0]:T,this),Z=z.invert(ne),$=z.k*(T.shiftKey?.5:2),Q=r(E(k(z,$),ne,Z),n.apply(this,B),u);da(T),c>0?On(this).transition().duration(c).call(I,Q,ne,T):On(this).call(S.transform,Q,ne,T)}}function q(T,...B){if(e.apply(this,arguments)){var z=T.touches,ne=z.length,Z=P(this,B,T.changedTouches.length===ne).event(T),$,Q,M,V;for(Id(T),Q=0;Q<ne;++Q)M=z[Q],V=Qn(M,this),V=[V,this.__zoom.invert(V),M.identifier],Z.touch0?!Z.touch1&&Z.touch0[2]!==V[2]&&(Z.touch1=V,Z.taps=0):(Z.touch0=V,$=!0,Z.taps=1+!!d);d&&(d=clearTimeout(d)),$&&(Z.taps<2&&(m=V[0],d=setTimeout(function(){d=null},w)),uu(this),Z.start())}}function G(T,...B){if(this.__zooming){var z=P(this,B).event(T),ne=T.changedTouches,Z=ne.length,$,Q,M,V;for(da(T),$=0;$<Z;++$)Q=ne[$],M=Qn(Q,this),z.touch0&&z.touch0[2]===Q.identifier?z.touch0[0]=M:z.touch1&&z.touch1[2]===Q.identifier&&(z.touch1[0]=M);if(Q=z.that.__zoom,z.touch1){var Y=z.touch0[0],H=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]-H[0])*fe+(fe=re[1]-H[1])*fe;Q=k(Q,Math.sqrt(le/fe)),M=[(Y[0]+J[0])/2,(Y[1]+J[1])/2],V=[(H[0]+re[0])/2,(H[1]+re[1])/2]}else if(z.touch0)M=z.touch0[0],V=z.touch0[1];else return;z.zoom("touch",r(E(Q,M,V),z.extent,u))}}function F(T,...B){if(this.__zooming){var z=P(this,B).event(T),ne=T.changedTouches,Z=ne.length,$,Q;for(Id(T),y&&clearTimeout(y),y=setTimeout(function(){y=null},w),$=0;$<Z;++$)Q=ne[$],z.touch0&&z.touch0[2]===Q.identifier?delete z.touch0:z.touch1&&z.touch1[2]===Q.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&&(Q=Qn(Q,this),Math.hypot(m[0]-Q[0],m[1]-Q[1])<b)){var M=On(this).on("dblclick.zoom");M&&M.apply(this,arguments)}}}return S.wheelDelta=function(T){return arguments.length?(i=typeof T=="function"?T:Gl(+T),S):i},S.filter=function(T){return arguments.length?(e=typeof T=="function"?T:Gl(!!T),S):e},S.touchable=function(T){return arguments.length?(o=typeof T=="function"?T:Gl(!!T),S):o},S.extent=function(T){return arguments.length?(n=typeof T=="function"?T:Gl([[+T[0][0],+T[0][1]],[+T[1][0],+T[1][1]]]),S):n},S.scaleExtent=function(T){return arguments.length?(l[0]=+T[0],l[1]=+T[1],S):[l[0],l[1]]},S.translateExtent=function(T){return arguments.length?(u[0][0]=+T[0][0],u[1][0]=+T[1][0],u[0][1]=+T[0][1],u[1][1]=+T[1][1],S):[[u[0][0],u[0][1]],[u[1][0],u[1][1]]]},S.constrain=function(T){return arguments.length?(r=T,S):r},S.duration=function(T){return arguments.length?(c=+T,S):c},S.interpolate=function(T){return arguments.length?(h=T,S):h},S.on=function(){var T=p.on.apply(p,arguments);return T===p?S:T},S.clickDistance=function(T){return arguments.length?(_=(T=+T)*T,S):Math.sqrt(_)},S.tapDistance=function(T){return arguments.length?(b=+T,S):b},S}var qI=PE();const ju=j.createContext(null),$I=ju.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.`},dN=Hr.error001();function Qe(e,n){const r=j.useContext(ju);if(r===null)throw new Error(dN);return LE(r,e,n)}const Ct=()=>{const e=j.useContext(ju);if(e===null)throw new Error(dN);return j.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},DI=e=>e.userSelectionActive?"none":"all";function $v({position:e,children:n,className:r,style:i,...o}){const l=Qe(DI),u=`${e}`.split("-");return ue.createElement("div",{className:Ft(["react-flow__panel",r,...u]),style:{...i,pointerEvents:l},...o},n)}function FI({proOptions:e,position:n="bottom-right"}){return e!=null&&e.hideAttribution?null:ue.createElement($v,{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 zI=({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=j.useRef(null),[y,w]=j.useState({x:0,y:0,width:0,height:0}),N=Ft(["react-flow__edge-textwrapper",p]);return j.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 BI=j.memo(zI);const Dv=e=>({width:e.offsetWidth,height:e.offsetHeight}),go=(e,n=0,r=1)=>Math.min(Math.max(e,n),r),Fv=(e={x:0,y:0},n)=>({x:go(e.x,n[0][0],n[1][0]),y:go(e.y,n[0][1],n[1][1])}),ax=(e,n,r)=>e<n?go(Math.abs(e-n),1,50)/50:e>r?-go(Math.abs(e-r),1,50)/50:0,fN=(e,n)=>{const r=ax(e.x,35,n.width-35)*20,i=ax(e.y,35,n.height-35)*20;return[r,i]},hN=e=>{var n;return((n=e.getRootNode)==null?void 0:n.call(e))||(window==null?void 0:window.document)},pN=(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)}),Ca=({x:e,y:n,width:r,height:i})=>({x:e,y:n,x2:e+r,y2:n+i}),mN=({x:e,y:n,x2:r,y2:i})=>({x:e,y:n,width:r-e,height:i-n}),lx=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),UI=(e,n)=>mN(pN(Ca(e),Ca(n))),pv=(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)},HI=e=>Pn(e.width)&&Pn(e.height)&&Pn(e.x)&&Pn(e.y),Pn=e=>!isNaN(e)&&isFinite(e),dt=Symbol.for("internals"),gN=["Enter"," ","Escape"],WI=(e,n)=>{},VI=e=>"nativeEvent"in e;function mv(e){var o,l;const n=VI(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 vN=e=>"clientX"in e,_s=(e,n)=>{var l,u;const r=vN(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)}},vu=()=>{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&&Pn(r)&&Pn(i)?ue.createElement(BI,{x:r,y:i,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p}):null);Pa.displayName="BaseEdge";function fa(e,n,r){return r===void 0?r:i=>{const o=n().edges.find(l=>l.id===e);o&&r(i,{...o})}}function yN({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 wN({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 Ra;(function(e){e.Partial="partial",e.Full="full"})(Ra||(Ra={}));var xs;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(xs||(xs={}));var yu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(yu||(yu={}));var Ae;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ae||(Ae={}));function ux({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 xN({sourceX:e,sourceY:n,sourcePosition:r=Ae.Bottom,targetX:i,targetY:o,targetPosition:l=Ae.Top}){const[u,c]=ux({pos:r,x1:e,y1:n,x2:i,y2:o}),[h,p]=ux({pos:l,x1:i,y1:o,x2:e,y2:n}),[d,m,y,w]=wN({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 zv=j.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[b,S,k]=xN({sourceX:e,sourceY:n,sourcePosition:o,targetX:r,targetY:i,targetPosition:l});return ue.createElement(Pa,{path:b,labelX:S,labelY:k,label:u,labelStyle:c,labelShowBg:h,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:_})});zv.displayName="SimpleBezierEdge";const cx={[Ae.Left]:{x:-1,y:0},[Ae.Right]:{x:1,y:0},[Ae.Top]:{x:0,y:-1},[Ae.Bottom]:{x:0,y:1}},GI=({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},dx=(e,n)=>Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2));function YI({source:e,sourcePosition:n=Ae.Bottom,target:r,targetPosition:i=Ae.Top,center:o,offset:l}){const u=cx[n],c=cx[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=GI({source:h,sourcePosition:n,target:p}),m=d.x!==0?"x":"y",y=d[m];let w=[],N,_;const b={x:0,y:0},S={x:0,y:0},[k,E,C,I]=yN({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 A=[{x:N,y:h.y},{x:N,y:p.y}],U=[{x:h.x,y:_},{x:p.x,y:_}];u[m]===y?w=m==="x"?A:U:w=m==="x"?U:A}else{const A=[{x:h.x,y:p.y}],U=[{x:p.x,y:h.y}];if(m==="x"?w=u.x===y?U:A:w=u.y===y?A:U,n===i){const F=Math.abs(e[m]-r[m]);if(F<=l){const T=Math.min(l-1,l-F);u[m]===y?b[m]=(h[m]>e[m]?-1:1)*T:S[m]=(p[m]>r[m]?-1:1)*T}}if(n!==i){const F=m==="x"?"y":"x",T=u[m]===c[F],B=h[F]>p[F],z=h[F]<p[F];(u[m]===1&&(!T&&B||T&&z)||u[m]!==1&&(!T&&z||T&&B))&&(w=m==="x"?A:U)}const L={x:h.x+b.x,y:h.y+b.y},O={x:p.x+S.x,y:p.y+S.y},q=Math.max(Math.abs(L.x-w[0].x),Math.abs(O.x-w[0].x)),G=Math.max(Math.abs(L.y-w[0].y),Math.abs(O.y-w[0].y));q>=G?(N=(L.x+O.x)/2,_=w[0].y):(N=w[0].x,_=(L.y+O.y)/2)}return[[e,{x:h.x+b.x,y:h.y+b.y},...w,{x:p.x+S.x,y:p.y+S.y},r],N,_,C,I]}function KI(e,n,r,i){const o=Math.min(dx(e,n)/2,dx(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 gv({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]=YI({source:{x:e,y:n},sourcePosition:r,target:{x:i,y:o},targetPosition:l,center:{x:c,y:h},offset:p});return[d.reduce((b,S,k)=>{let E="";return k>0&&k<d.length-1?E=KI(d[k-1],S,d[k+1],u):E=`${k===0?"M":"L"}${S.x} ${S.y}`,b+=E,b},""),m,y,w,N]}const Tu=j.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:b})=>{const[S,k,E]=gv({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:S,labelX:k,labelY:E,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,markerEnd:w,markerStart:N,interactionWidth:b})});Tu.displayName="SmoothStepEdge";const Bv=j.memo(e=>{var n;return ue.createElement(Tu,{...e,pathOptions:j.useMemo(()=>{var r;return{borderRadius:0,offset:(r=e.pathOptions)==null?void 0:r.offset}},[(n=e.pathOptions)==null?void 0:n.offset])})});Bv.displayName="StepEdge";function XI({sourceX:e,sourceY:n,targetX:r,targetY:i}){const[o,l,u,c]=yN({sourceX:e,sourceY:n,targetX:r,targetY:i});return[`M ${e},${n}L ${r},${i}`,o,l,u,c]}const Uv=j.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,_,b]=XI({sourceX:e,sourceY:n,targetX:r,targetY:i});return ue.createElement(Pa,{path:N,labelX:_,labelY:b,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:p,style:d,markerEnd:m,markerStart:y,interactionWidth:w})});Uv.displayName="StraightEdge";function Yl(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function fx({pos:e,x1:n,y1:r,x2:i,y2:o,c:l}){switch(e){case Ae.Left:return[n-Yl(n-i,l),r];case Ae.Right:return[n+Yl(i-n,l),r];case Ae.Top:return[n,r-Yl(r-o,l)];case Ae.Bottom:return[n,r+Yl(o-r,l)]}}function _N({sourceX:e,sourceY:n,sourcePosition:r=Ae.Bottom,targetX:i,targetY:o,targetPosition:l=Ae.Top,curvature:u=.25}){const[c,h]=fx({pos:r,x1:e,y1:n,x2:i,y2:o,c:u}),[p,d]=fx({pos:l,x1:i,y1:o,x2:e,y2:n,c:u}),[m,y,w,N]=wN({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 wu=j.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:b})=>{const[S,k,E]=_N({sourceX:e,sourceY:n,sourcePosition:o,targetX:r,targetY:i,targetPosition:l,curvature:_==null?void 0:_.curvature});return ue.createElement(Pa,{path:S,labelX:k,labelY:E,label:u,labelStyle:c,labelShowBg:h,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:N,interactionWidth:b})});wu.displayName="BezierEdge";const Hv=j.createContext(null),QI=Hv.Provider;Hv.Consumer;const ZI=()=>j.useContext(Hv),JI=e=>"id"in e&&"source"in e&&"target"in e,eM=({source:e,sourceHandle:n,target:r,targetHandle:i})=>`reactflow__edge-${e}${n||""}-${r}${i||""}`,vv=(e,n)=>typeof e>"u"?"":typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`,tM=(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)),nM=(e,n)=>{if(!e.source||!e.target)return n;let r;return JI(e)?r={...e}:r={...e,id:eM(e)},tM(r,n)?n:n.concat(r)},yv=({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},bN=({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}},Au=(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 pN(i,Ca({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 mN(r)},SN=(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),b={x:_.x,y:_.y,width:m||0,height:y||0},S=pv(h,b),k=typeof m>"u"||typeof y>"u"||m===null||y===null,E=l&&S>0,C=(m||0)*(y||0);(k||E||S>=C||d.dragging)&&p.push(d)}),p},kN=(e,n)=>{const r=e.map(i=>i.id);return n.filter(i=>r.includes(i.source)||r.includes(i.target))},EN=(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=go(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 hx(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 rM(e,n,r,i,o,l){const{x:u,y:c}=_s(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 _=Wv(void 0,p),b=p.getAttribute("data-handleid"),S=l({nodeId:N,id:b,type:_});if(S){const k=o.find(E=>E.nodeId===N&&E.type===_&&E.id===b);return{handle:{id:b,type:_,nodeId:N,x:(k==null?void 0:k.x)||r.x,y:(k==null?void 0:k.y)||r.y},validHandleResult:S}}}}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 b=l(N);_<=m&&(_<m?d=[{handle:N,validHandleResult:b}]:_===m&&d.push({handle:N,validHandleResult:b}),m=_)}}),!d.length)return{handle:null,validHandleResult:NN()};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 sM={source:null,target:null,sourceHandle:null,targetHandle:null},NN=()=>({handleDomNode:null,isValid:!1,connection:sM,endHandle:null});function CN(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={...NN(),handleDomNode:h};if(h){const d=Wv(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 iM({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=hx(l,u,"source",`${n}-${r}-${i}`),h=hx(l,u,"target",`${n}-${r}-${i}`)),o.push(...c,...h)}return o},[])}function Wv(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function Md(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function oM(e,n){let r=null;return n?r="valid":e&&!n&&(r="invalid"),r}function RN({event:e,handleId:n,nodeId:r,onConnect:i,isTarget:o,getState:l,setState:u,isValidConnection:c,edgeUpdaterType:h,onReconnectEnd:p}){const d=hN(e.target),{connectionMode:m,domNode:y,autoPanOnConnect:w,connectionRadius:N,onConnectStart:_,panBy:b,getNodes:S,cancelConnection:k}=l();let E=0,C;const{x:I,y:P}=_s(e),A=d==null?void 0:d.elementFromPoint(I,P),U=Wv(h,A),L=y==null?void 0:y.getBoundingClientRect();if(!L||!U)return;let O,q=_s(e,L),G=!1,F=null,T=!1,B=null;const z=iM({nodes:S(),nodeId:r,handleId:n,handleType:U}),ne=()=>{if(!w)return;const[Q,M]=fN(q,L);b({x:Q,y:M}),E=requestAnimationFrame(ne)};u({connectionPosition:q,connectionStatus:null,connectionNodeId:r,connectionHandleId:n,connectionHandleType:U,connectionStartHandle:{nodeId:r,handleId:n,type:U},connectionEndHandle:null}),_==null||_(e,{nodeId:r,handleId:n,handleType:U});function Z(Q){const{transform:M}=l();q=_s(Q,L);const{handle:V,validHandleResult:Y}=rM(Q,d,yv(q,M,!1,[1,1]),N,z,H=>CN(H,m,r,n,o?"target":"source",c,d));if(C=V,G||(ne(),G=!0),B=Y.handleDomNode,F=Y.connection,T=Y.isValid,u({connectionPosition:C&&T?bN({x:C.x,y:C.y},M):q,connectionStatus:oM(!!C,T),connectionEndHandle:Y.endHandle}),!C&&!T&&!B)return Md(O);F.source!==F.target&&B&&(Md(O),O=B,B.classList.add("connecting","react-flow__handle-connecting"),B.classList.toggle("valid",T),B.classList.toggle("react-flow__handle-valid",T))}function $(Q){var M,V;(C||B)&&F&&T&&(i==null||i(F)),(V=(M=l()).onConnectEnd)==null||V.call(M,Q),h&&(p==null||p(Q)),Md(O),k(),cancelAnimationFrame(E),G=!1,T=!1,F=null,B=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 px=()=>!0,aM=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),lM=(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}},jN=j.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 L,O;const N=u||null,_=e==="target",b=Ct(),S=ZI(),{connectOnClick:k,noPanClassName:E}=Qe(aM,Nt),{connecting:C,clickConnecting:I}=Qe(lM(S,N,e),Nt);S||(O=(L=b.getState()).onError)==null||O.call(L,"010",Hr.error010());const P=q=>{const{defaultEdgeOptions:G,onConnect:F,hasDefaultEdges:T}=b.getState(),B={...G,...q};if(T){const{edges:z,setEdges:ne}=b.getState();ne(nM(B,z))}F==null||F(B),c==null||c(B)},A=q=>{if(!S)return;const G=vN(q);o&&(G&&q.button===0||!G)&&RN({event:q,handleId:N,nodeId:S,onConnect:P,isTarget:_,getState:b.getState,setState:b.setState,isValidConnection:r||b.getState().isValidConnection||px}),G?d==null||d(q):m==null||m(q)},U=q=>{const{onClickConnectStart:G,onClickConnectEnd:F,connectionClickStartHandle:T,connectionMode:B,isValidConnection:z}=b.getState();if(!S||!T&&!o)return;if(!T){G==null||G(q,{nodeId:S,handleId:N,handleType:e}),b.setState({connectionClickStartHandle:{nodeId:S,type:e,handleId:N}});return}const ne=hN(q.target),Z=r||z||px,{connection:$,isValid:Q}=CN({nodeId:S,id:N,type:e},B,T.nodeId,T.handleId||null,T.type,Z,ne);Q&&P($),F==null||F(q),b.setState({connectionClickStartHandle:null})};return ue.createElement("div",{"data-handleid":N,"data-nodeid":S,"data-handlepos":n,"data-id":`${S}-${N}-${e}`,className:Ft(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",E,p,{source:!_,target:_,connectable:i,connectablestart:o,connectableend:l,connecting:I,connectionindicator:i&&(o&&!C||l&&C)}]),onMouseDown:A,onTouchStart:A,onClick:k?U:void 0,ref:w,...y},h)});jN.displayName="Handle";var vo=j.memo(jN);const TN=({data:e,isConnectable:n,targetPosition:r=Ae.Top,sourcePosition:i=Ae.Bottom})=>ue.createElement(ue.Fragment,null,ue.createElement(vo,{type:"target",position:r,isConnectable:n}),e==null?void 0:e.label,ue.createElement(vo,{type:"source",position:i,isConnectable:n}));TN.displayName="DefaultNode";var wv=j.memo(TN);const AN=({data:e,isConnectable:n,sourcePosition:r=Ae.Bottom})=>ue.createElement(ue.Fragment,null,e==null?void 0:e.label,ue.createElement(vo,{type:"source",position:r,isConnectable:n}));AN.displayName="InputNode";var IN=j.memo(AN);const MN=({data:e,isConnectable:n,targetPosition:r=Ae.Top})=>ue.createElement(ue.Fragment,null,ue.createElement(vo,{type:"target",position:r,isConnectable:n}),e==null?void 0:e.label);MN.displayName="OutputNode";var ON=j.memo(MN);const Vv=()=>null;Vv.displayName="GroupNode";const uM=e=>({selectedNodes:e.getNodes().filter(n=>n.selected),selectedEdges:e.edges.filter(n=>n.selected).map(n=>({...n}))}),Kl=e=>e.id;function cM(e,n){return Nt(e.selectedNodes.map(Kl),n.selectedNodes.map(Kl))&&Nt(e.selectedEdges.map(Kl),n.selectedEdges.map(Kl))}const PN=j.memo(({onSelectionChange:e})=>{const n=Ct(),{selectedNodes:r,selectedEdges:i}=Qe(uM,cM);return j.useEffect(()=>{const o={nodes:r,edges:i};e==null||e(o),n.getState().onSelectionChange.forEach(l=>l(o))},[r,i,e]),null});PN.displayName="SelectionListener";const dM=e=>!!e.onSelectionChange;function fM({onSelectionChange:e}){const n=Qe(dM);return e||n?ue.createElement(PN,{onSelectionChange:e}):null}const hM=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 eo(e,n){j.useEffect(()=>{typeof e<"u"&&n(e)},[e])}function qe(e,n,r){j.useEffect(()=>{typeof n<"u"&&r({[e]:n})},[n])}const pM=({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:b,nodeExtent:S,onNodesChange:k,onEdgesChange:E,elementsSelectable:C,connectionMode:I,snapGrid:P,snapToGrid:A,translateExtent:U,connectOnClick:L,defaultEdgeOptions:O,fitView:q,fitViewOptions:G,onNodesDelete:F,onEdgesDelete:T,onNodeDrag:B,onNodeDragStart:z,onNodeDragStop:ne,onSelectionDrag:Z,onSelectionDragStart:$,onSelectionDragStop:Q,noPanClassName:M,nodeOrigin:V,rfId:Y,autoPanOnConnect:H,autoPanOnNodeDrag:J,onError:re,connectionRadius:le,isValidConnection:fe,nodeDragThreshold:te})=>{const{setNodes:ce,setEdges:Ce,setDefaultNodesAndEdges:ve,setMinZoom:Te,setMaxZoom:ye,setTranslateExtent:ke,setNodeExtent:Ke,reset:we}=Qe(hM,Nt),_e=Ct();return j.useEffect(()=>{const Be=i==null?void 0:i.map(ft=>({...ft,...O}));return ve(r,Be),()=>{we()}},[]),qe("defaultEdgeOptions",O,_e.setState),qe("connectionMode",I,_e.setState),qe("onConnect",o,_e.setState),qe("onConnectStart",l,_e.setState),qe("onConnectEnd",u,_e.setState),qe("onClickConnectStart",c,_e.setState),qe("onClickConnectEnd",h,_e.setState),qe("nodesDraggable",p,_e.setState),qe("nodesConnectable",d,_e.setState),qe("nodesFocusable",m,_e.setState),qe("edgesFocusable",y,_e.setState),qe("edgesUpdatable",w,_e.setState),qe("elementsSelectable",C,_e.setState),qe("elevateNodesOnSelect",N,_e.setState),qe("snapToGrid",A,_e.setState),qe("snapGrid",P,_e.setState),qe("onNodesChange",k,_e.setState),qe("onEdgesChange",E,_e.setState),qe("connectOnClick",L,_e.setState),qe("fitViewOnInit",q,_e.setState),qe("fitViewOnInitOptions",G,_e.setState),qe("onNodesDelete",F,_e.setState),qe("onEdgesDelete",T,_e.setState),qe("onNodeDrag",B,_e.setState),qe("onNodeDragStart",z,_e.setState),qe("onNodeDragStop",ne,_e.setState),qe("onSelectionDrag",Z,_e.setState),qe("onSelectionDragStart",$,_e.setState),qe("onSelectionDragStop",Q,_e.setState),qe("noPanClassName",M,_e.setState),qe("nodeOrigin",V,_e.setState),qe("rfId",Y,_e.setState),qe("autoPanOnConnect",H,_e.setState),qe("autoPanOnNodeDrag",J,_e.setState),qe("onError",re,_e.setState),qe("connectionRadius",le,_e.setState),qe("isValidConnection",fe,_e.setState),qe("nodeDragThreshold",te,_e.setState),eo(e,ce),eo(n,Ce),eo(_,Te),eo(b,ye),eo(U,ke),eo(S,Ke),null},mx={display:"none"},mM={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},LN="react-flow__node-desc",qN="react-flow__edge-desc",gM="react-flow__aria-live",vM=e=>e.ariaLiveMessage;function yM({rfId:e}){const n=Qe(vM);return ue.createElement("div",{id:`${gM}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:mM},n)}function wM({rfId:e,disableKeyboardA11y:n}){return ue.createElement(ue.Fragment,null,ue.createElement("div",{id:`${LN}-${e}`,style:mx},"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:`${qN}-${e}`,style:mx},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!n&&ue.createElement(yM,{rfId:e}))}var ja=(e=null,n={actInsideInputWithModifier:!0})=>{const[r,i]=j.useState(!1),o=j.useRef(!1),l=j.useRef(new Set([])),[u,c]=j.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 j.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)&&mv(w))return!1;const _=vx(w.code,c);l.current.add(w[_]),gx(u,l.current,!1)&&(w.preventDefault(),i(!0))},m=w=>{if((!o.current||o.current&&!n.actInsideInputWithModifier)&&mv(w))return!1;const _=vx(w.code,c);gx(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 gx(e,n,r){return e.filter(i=>r||i.length===n.size).some(i=>i.every(o=>n.has(o)))}function vx(e,n){return n.includes(e)?"code":"key"}function $N(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 $N(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 DN(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}=$N(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 Od(e,n,r,i){const o=new Map,l={},u=i?1e3:0;return e.forEach(c=>{var w;const h=(Pn(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)}),DN(o,r,l),o}function FN(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(b=>{var k;const S=n.includeHiddenNodes?b.width&&b.height:!b.hidden;return(k=n.nodes)!=null&&k.length?S&&n.nodes.some(E=>E.id===b.id):S}),_=N.every(b=>b.width&&b.height);if(N.length>0&&_){const b=Au(N,m),{x:S,y:k,zoom:E}=EN(b,i,o,n.minZoom??l,n.maxZoom??u,n.padding??.1),C=Br.translate(S,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 xM(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 _M(e,n){return n.map(r=>{const i=e.find(o=>o.id===r.id);return i&&(r.selected=i.selected),r})}function Xl({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:xM(e,o)}),u==null||u(e)),n!=null&&n.length&&(p&&i({edges:_M(n,l)}),c==null||c(n))}const to=()=>{},bM={zoomIn:to,zoomOut:to,zoomTo:to,getZoom:()=>1,setViewport:to,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:to,fitBounds:to,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},SM=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),kM=()=>{const e=Ct(),{d3Zoom:n,d3Selection:r}=Qe(SM,Nt);return j.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=>FN(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}=EN(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"),yv(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 yv(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=bN(o,l);return{x:p.x+c,y:p.y+h}},viewportInitialized:!0}:bM,[n,r])};function La(){const e=kM(),n=Ct(),r=j.useCallback(()=>n.getState().getNodes().map(_=>({..._})),[]),i=j.useCallback(_=>n.getState().nodeInternals.get(_),[]),o=j.useCallback(()=>{const{edges:_=[]}=n.getState();return _.map(b=>({...b}))},[]),l=j.useCallback(_=>{const{edges:b=[]}=n.getState();return b.find(S=>S.id===_)},[]),u=j.useCallback(_=>{const{getNodes:b,setNodes:S,hasDefaultNodes:k,onNodesChange:E}=n.getState(),C=b(),I=typeof _=="function"?_(C):_;if(k)S(I);else if(E){const P=I.length===0?C.map(A=>({type:"remove",id:A.id})):I.map(A=>({item:A,type:"reset"}));E(P)}},[]),c=j.useCallback(_=>{const{edges:b=[],setEdges:S,hasDefaultEdges:k,onEdgesChange:E}=n.getState(),C=typeof _=="function"?_(b):_;if(k)S(C);else if(E){const I=C.length===0?b.map(P=>({type:"remove",id:P.id})):C.map(P=>({item:P,type:"reset"}));E(I)}},[]),h=j.useCallback(_=>{const b=Array.isArray(_)?_:[_],{getNodes:S,setNodes:k,hasDefaultNodes:E,onNodesChange:C}=n.getState();if(E){const P=[...S(),...b];k(P)}else if(C){const I=b.map(P=>({item:P,type:"add"}));C(I)}},[]),p=j.useCallback(_=>{const b=Array.isArray(_)?_:[_],{edges:S=[],setEdges:k,hasDefaultEdges:E,onEdgesChange:C}=n.getState();if(E)k([...S,...b]);else if(C){const I=b.map(P=>({item:P,type:"add"}));C(I)}},[]),d=j.useCallback(()=>{const{getNodes:_,edges:b=[],transform:S}=n.getState(),[k,E,C]=S;return{nodes:_().map(I=>({...I})),edges:b.map(I=>({...I})),viewport:{x:k,y:E,zoom:C}}},[]),m=j.useCallback(({nodes:_,edges:b})=>{const{nodeInternals:S,getNodes:k,edges:E,hasDefaultNodes:C,hasDefaultEdges:I,onNodesDelete:P,onEdgesDelete:A,onNodesChange:U,onEdgesChange:L}=n.getState(),O=(_||[]).map(B=>B.id),q=(b||[]).map(B=>B.id),G=k().reduce((B,z)=>{const ne=z.parentNode||z.parentId,Z=!O.includes(z.id)&&ne&&B.find(Q=>Q.id===ne);return(typeof z.deletable=="boolean"?z.deletable:!0)&&(O.includes(z.id)||Z)&&B.push(z),B},[]),F=E.filter(B=>typeof B.deletable=="boolean"?B.deletable:!0),T=F.filter(B=>q.includes(B.id));if(G||T){const B=kN(G,F),z=[...T,...B],ne=z.reduce((Z,$)=>(Z.includes($.id)||Z.push($.id),Z),[]);if((I||C)&&(I&&n.setState({edges:E.filter(Z=>!ne.includes(Z.id))}),C&&(G.forEach(Z=>{S.delete(Z.id)}),n.setState({nodeInternals:new Map(S)}))),ne.length>0&&(A==null||A(z),L&&L(ne.map(Z=>({id:Z,type:"remove"})))),G.length>0&&(P==null||P(G),U)){const Z=G.map($=>({id:$.id,type:"remove"}));U(Z)}}},[]),y=j.useCallback(_=>{const b=HI(_),S=b?null:n.getState().nodeInternals.get(_.id);return!b&&!S?[null,null,b]:[b?_:lx(S),S,b]},[]),w=j.useCallback((_,b=!0,S)=>{const[k,E,C]=y(_);return k?(S||n.getState().getNodes()).filter(I=>{if(!C&&(I.id===E.id||!I.positionAbsolute))return!1;const P=lx(I),A=pv(P,k);return b&&A>0||A>=k.width*k.height}):[]},[]),N=j.useCallback((_,b,S=!0)=>{const[k]=y(_);if(!k)return!1;const E=pv(k,b);return S&&E>0||E>=k.width*k.height},[]);return j.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 EM={actInsideInputWithModifier:!1};var NM=({deleteKeyCode:e,multiSelectionKeyCode:n})=>{const r=Ct(),{deleteElements:i}=La(),o=ja(e,EM),l=ja(n);j.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]),j.useEffect(()=>{r.setState({multiSelectionActive:l})},[l])};function CM(e){const n=Ct();j.useEffect(()=>{let r;const i=()=>{var l,u;if(!e.current)return;const o=Dv(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 Gv={position:"absolute",width:"100%",height:"100%",top:0,left:0},RM=(e,n)=>e.x!==n.x||e.y!==n.y||e.zoom!==n.k,Ql=e=>({x:e.x,y:e.y,zoom:e.k}),no=(e,n)=>e.target.closest(`.${n}`),yx=(e,n)=>n===2&&Array.isArray(e)&&e.includes(2),wx=e=>{const n=e.ctrlKey&&vu()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n},jM=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),TM=({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:b,preventScrolling:S=!0,children:k,noWheelClassName:E,noPanClassName:C})=>{const I=j.useRef(),P=Ct(),A=j.useRef(!1),U=j.useRef(!1),L=j.useRef(null),O=j.useRef({x:0,y:0,zoom:0}),{d3Zoom:q,d3Selection:G,d3ZoomHandler:F,userSelectionActive:T}=Qe(jM,Nt),B=ja(b),z=j.useRef(0),ne=j.useRef(!1),Z=j.useRef();return CM(L),j.useEffect(()=>{if(L.current){const $=L.current.getBoundingClientRect(),Q=cN().scaleExtent([N,_]).translateExtent(w),M=On(L.current).call(Q),V=Br.translate(y.x,y.y).scale(go(y.zoom,N,_)),Y=[[0,0],[$.width,$.height]],H=Q.constrain()(V,Y,w);Q.transform(M,H),Q.wheelDelta(wx),P.setState({d3Zoom:Q,d3Selection:M,d3ZoomHandler:M.on("wheel.zoom"),transform:[H.x,H.y,H.k],domNode:L.current.closest(".react-flow")})}},[]),j.useEffect(()=>{G&&q&&(u&&!B&&!T?G.on("wheel.zoom",$=>{if(no($,E))return!1;$.preventDefault(),$.stopImmediatePropagation();const Q=G.property("__zoom").k||1;if($.ctrlKey&&l){const fe=Qn($),te=wx($),ce=Q*Math.pow(2,te);q.scaleTo(G,ce,fe,$);return}const M=$.deltaMode===1?20:1;let V=h===ri.Vertical?0:$.deltaX*M,Y=h===ri.Horizontal?0:$.deltaY*M;!vu()&&$.shiftKey&&h!==ri.Vertical&&(V=$.deltaY*M,Y=0),q.translateBy(G,-(V/Q)*c,-(Y/Q)*c,{internal:!0});const H=Ql(G.property("__zoom")),{onViewportChangeStart:J,onViewportChange:re,onViewportChangeEnd:le}=P.getState();clearTimeout(Z.current),ne.current||(ne.current=!0,n==null||n($,H),J==null||J(H)),ne.current&&(e==null||e($,H),re==null||re(H),Z.current=setTimeout(()=>{r==null||r($,H),le==null||le(H),ne.current=!1},150))},{passive:!1}):typeof F<"u"&&G.on("wheel.zoom",function($,Q){if(!S&&$.type==="wheel"&&!$.ctrlKey||no($,E))return null;$.preventDefault(),F.call(this,$,Q)},{passive:!1}))},[T,u,h,G,q,F,B,l,S,E,n,e,r]),j.useEffect(()=>{q&&q.on("start",$=>{var V,Y;if(!$.sourceEvent||$.sourceEvent.internal)return null;z.current=(V=$.sourceEvent)==null?void 0:V.button;const{onViewportChangeStart:Q}=P.getState(),M=Ql($.transform);A.current=!0,O.current=M,((Y=$.sourceEvent)==null?void 0:Y.type)==="mousedown"&&P.setState({paneDragging:!0}),Q==null||Q(M),n==null||n($.sourceEvent,M)})},[q,n]),j.useEffect(()=>{q&&(T&&!A.current?q.on("zoom",null):T||q.on("zoom",$=>{var M;const{onViewportChange:Q}=P.getState();if(P.setState({transform:[$.transform.x,$.transform.y,$.transform.k]}),U.current=!!(i&&yx(m,z.current??0)),(e||Q)&&!((M=$.sourceEvent)!=null&&M.internal)){const V=Ql($.transform);Q==null||Q(V),e==null||e($.sourceEvent,V)}}))},[T,q,e,m,i]),j.useEffect(()=>{q&&q.on("end",$=>{if(!$.sourceEvent||$.sourceEvent.internal)return null;const{onViewportChangeEnd:Q}=P.getState();if(A.current=!1,P.setState({paneDragging:!1}),i&&yx(m,z.current??0)&&!U.current&&i($.sourceEvent),U.current=!1,(r||Q)&&RM(O.current,$.transform)){const M=Ql($.transform);O.current=M,clearTimeout(I.current),I.current=setTimeout(()=>{Q==null||Q(M),r==null||r($.sourceEvent,M)},u?150:0)}})},[q,u,m,r,i]),j.useEffect(()=>{q&&q.filter($=>{const Q=B||o,M=l&&$.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&$.button===1&&$.type==="mousedown"&&(no($,"react-flow__node")||no($,"react-flow__edge")))return!0;if(!m&&!Q&&!u&&!p&&!l||T||!p&&$.type==="dblclick"||no($,E)&&$.type==="wheel"||no($,C)&&($.type!=="wheel"||u&&$.type==="wheel"&&!B)||!l&&$.ctrlKey&&$.type==="wheel"||!Q&&!u&&!M&&$.type==="wheel"||!m&&($.type==="mousedown"||$.type==="touchstart")||Array.isArray(m)&&!m.includes($.button)&&$.type==="mousedown")return!1;const V=Array.isArray(m)&&m.includes($.button)||!$.button||$.button<=1;return(!$.ctrlKey||$.type==="wheel")&&V})},[T,q,o,l,u,p,m,d,B]),ue.createElement("div",{className:"react-flow__renderer",ref:L,style:Gv},k)},AM=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function IM(){const{userSelectionActive:e,userSelectionRect:n}=Qe(AM,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 xx(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 MM(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&&xx(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&&xx(i,u);break}case"remove":return i}return i.push(u),i},r)}function OM(e,n){return MM(e,n)}const ws=(e,n)=>({id:e,type:"select",selected:n});function oo(e,n){return e.reduce((r,i)=>{const o=n.includes(i.id);return!i.selected&&o?(i.selected=!0,r.push(ws(i.id,!0))):i.selected&&!o&&(i.selected=!1,r.push(ws(i.id,!1))),r},[])}const Pd=(e,n)=>r=>{r.target===n.current&&(e==null||e(r))},PM=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),zN=j.memo(({isSelecting:e,selectionMode:n=Ra.Full,panOnDrag:r,onSelectionStart:i,onSelectionEnd:o,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:c,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:d,children:m})=>{const y=j.useRef(null),w=Ct(),N=j.useRef(0),_=j.useRef(0),b=j.useRef(),{userSelectionActive:S,elementsSelectable:k,dragging:E}=Qe(PM,Nt),C=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),N.current=0,_.current=0},I=F=>{l==null||l(F),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},P=F=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){F.preventDefault();return}u==null||u(F)},A=c?F=>c(F):void 0,U=F=>{const{resetSelectedElements:T,domNode:B}=w.getState();if(b.current=B==null?void 0:B.getBoundingClientRect(),!k||!e||F.button!==0||F.target!==y.current||!b.current)return;const{x:z,y:ne}=_s(F,b.current);T(),w.setState({userSelectionRect:{width:0,height:0,startX:z,startY:ne,x:z,y:ne}}),i==null||i(F)},L=F=>{const{userSelectionRect:T,nodeInternals:B,edges:z,transform:ne,onNodesChange:Z,onEdgesChange:$,nodeOrigin:Q,getNodes:M}=w.getState();if(!e||!b.current||!T)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const V=_s(F,b.current),Y=T.startX??0,H=T.startY??0,J={...T,x:V.x<Y?V.x:Y,y:V.y<H?V.y:H,width:Math.abs(V.x-Y),height:Math.abs(V.y-H)},re=M(),le=SN(B,J,ne,n===Ra.Partial,!0,Q),fe=kN(le,z).map(ce=>ce.id),te=le.map(ce=>ce.id);if(N.current!==te.length){N.current=te.length;const ce=oo(re,te);ce.length&&(Z==null||Z(ce))}if(_.current!==fe.length){_.current=fe.length;const ce=oo(z,fe);ce.length&&($==null||$(ce))}w.setState({userSelectionRect:J})},O=F=>{if(F.button!==0)return;const{userSelectionRect:T}=w.getState();!S&&T&&F.target===y.current&&(I==null||I(F)),w.setState({nodesSelectionActive:N.current>0}),C(),o==null||o(F)},q=F=>{S&&(w.setState({nodesSelectionActive:N.current>0}),o==null||o(F)),C()},G=k&&(e||S);return ue.createElement("div",{className:Ft(["react-flow__pane",{dragging:E,selection:e}]),onClick:G?void 0:Pd(I,y),onContextMenu:Pd(P,y),onWheel:Pd(A,y),onMouseEnter:G?void 0:h,onMouseDown:G?U:void 0,onMouseMove:G?L:p,onMouseUp:G?O:void 0,onMouseLeave:G?q:d,ref:y,style:Gv},m,ue.createElement(IM,null))});zN.displayName="Pane";function BN(e,n){const r=e.parentNode||e.parentId;if(!r)return!1;const i=n.get(r);return i?i.selected?!0:BN(i,n):!1}function _x(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 LM(e,n,r,i){return Array.from(e.values()).filter(o=>(o.selected||o.id===i)&&(!o.parentNode||o.parentId||!BN(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 qM(e,n){return!n||n==="parent"?n:[n[0],[n[1][0]-(e.width||0),n[1][1]-(e.height||0)]]}function UN(e,n,r,i,o=[0,0],l){const u=qM(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&&Pn(y)&&Pn(w)&&Pn(m.width)&&Pn(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"?Fv(n,c):n;return{position:{x:d.x-p.x,y:d.y-p.y},positionAbsolute:d}}function Ld({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 bx=(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,...Dv(h)}})};function ha(e,n,r){return r===void 0?r:i=>{const o=n().nodeInternals.get(e);o&&r(i,{...o})}}function xv({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 $M(){const e=Ct();return j.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 qd(e){return(n,r,i)=>e==null?void 0:e(n,i)}function HN({nodeRef:e,disabled:n=!1,noDragClassName:r,handleSelector:i,nodeId:o,isSelectable:l,selectNodesOnDrag:u}){const c=Ct(),[h,p]=j.useState(!1),d=j.useRef([]),m=j.useRef({x:null,y:null}),y=j.useRef(0),w=j.useRef(null),N=j.useRef({x:0,y:0}),_=j.useRef(null),b=j.useRef(!1),S=j.useRef(!1),k=j.useRef(!1),E=$M();return j.useEffect(()=>{if(e!=null&&e.current){const C=On(e.current),I=({x:U,y:L})=>{const{nodeInternals:O,onNodeDrag:q,onSelectionDrag:G,updateNodePositions:F,nodeExtent:T,snapGrid:B,snapToGrid:z,nodeOrigin:ne,onError:Z}=c.getState();m.current={x:U,y:L};let $=!1,Q={x:0,y:0,x2:0,y2:0};if(d.current.length>1&&T){const V=Au(d.current,ne);Q=Ca(V)}if(d.current=d.current.map(V=>{const Y={x:U-V.distance.x,y:L-V.distance.y};z&&(Y.x=B[0]*Math.round(Y.x/B[0]),Y.y=B[1]*Math.round(Y.y/B[1]));const H=[[T[0][0],T[0][1]],[T[1][0],T[1][1]]];d.current.length>1&&T&&!V.extent&&(H[0][0]=V.positionAbsolute.x-Q.x+T[0][0],H[1][0]=V.positionAbsolute.x+(V.width??0)-Q.x2+T[1][0],H[0][1]=V.positionAbsolute.y-Q.y+T[0][1],H[1][1]=V.positionAbsolute.y+(V.height??0)-Q.y2+T[1][1]);const J=UN(V,Y,O,H,ne,Z);return $=$||V.position.x!==J.position.x||V.position.y!==J.position.y,V.position=J.position,V.positionAbsolute=J.positionAbsolute,V}),!$)return;F(d.current,!0,!0),p(!0);const M=o?q:qd(G);if(M&&_.current){const[V,Y]=Ld({nodeId:o,dragItems:d.current,nodeInternals:O});M(_.current,V,Y)}},P=()=>{if(!w.current)return;const[U,L]=fN(N.current,w.current);if(U!==0||L!==0){const{transform:O,panBy:q}=c.getState();m.current.x=(m.current.x??0)-U/O[2],m.current.y=(m.current.y??0)-L/O[2],q({x:U,y:L})&&I(m.current)}y.current=requestAnimationFrame(P)},A=U=>{var ne;const{nodeInternals:L,multiSelectionActive:O,nodesDraggable:q,unselectNodesAndEdges:G,onNodeDragStart:F,onSelectionDragStart:T}=c.getState();S.current=!0;const B=o?F:qd(T);(!u||!l)&&!O&&o&&((ne=L.get(o))!=null&&ne.selected||G()),o&&l&&u&&xv({id:o,store:c,nodeRef:e});const z=E(U);if(m.current=z,d.current=LM(L,q,z,o),B&&d.current){const[Z,$]=Ld({nodeId:o,dragItems:d.current,nodeInternals:L});B(U.sourceEvent,Z,$)}};if(n)C.on(".drag",null);else{const U=GA().on("start",L=>{const{domNode:O,nodeDragThreshold:q}=c.getState();q===0&&A(L),k.current=!1;const G=E(L);m.current=G,w.current=(O==null?void 0:O.getBoundingClientRect())||null,N.current=_s(L.sourceEvent,w.current)}).on("drag",L=>{var F,T;const O=E(L),{autoPanOnNodeDrag:q,nodeDragThreshold:G}=c.getState();if(L.sourceEvent.type==="touchmove"&&L.sourceEvent.touches.length>1&&(k.current=!0),!k.current){if(!b.current&&S.current&&q&&(b.current=!0,P()),!S.current){const B=O.xSnapped-(((F=m==null?void 0:m.current)==null?void 0:F.x)??0),z=O.ySnapped-(((T=m==null?void 0:m.current)==null?void 0:T.y)??0);Math.sqrt(B*B+z*z)>G&&A(L)}(m.current.x!==O.xSnapped||m.current.y!==O.ySnapped)&&d.current&&S.current&&(_.current=L.sourceEvent,N.current=_s(L.sourceEvent,w.current),I(O))}}).on("end",L=>{if(!(!S.current||k.current)&&(p(!1),b.current=!1,S.current=!1,cancelAnimationFrame(y.current),d.current)){const{updateNodePositions:O,nodeInternals:q,onNodeDragStop:G,onSelectionDragStop:F}=c.getState(),T=o?G:qd(F);if(O(d.current,!1,!1),T){const[B,z]=Ld({nodeId:o,dragItems:d.current,nodeInternals:q});T(L.sourceEvent,B,z)}}}).filter(L=>{const O=L.target;return!L.button&&(!r||!_x(O,`.${r}`,e))&&(!i||_x(O,i,e))});return C.call(U),()=>{C.on(".drag",null)}}}},[e,n,r,i,l,c,o,u,E]),h}function WN(){const e=Ct();return j.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,b=r.y*w*N,S=m.map(k=>{if(k.positionAbsolute){const E={x:k.positionAbsolute.x+_,y:k.positionAbsolute.y+b};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:I}=UN(k,E,i,o,void 0,p);k.position=I,k.positionAbsolute=C}return k});l(S,!0,!1)},[])}const fo={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var pa=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:b,className:S,isDraggable:k,isSelectable:E,isConnectable:C,isFocusable:I,selectNodesOnDrag:P,sourcePosition:A,targetPosition:U,hidden:L,resizeObserver:O,dragHandle:q,zIndex:G,isParent:F,noDragClassName:T,noPanClassName:B,initialized:z,disableKeyboardA11y:ne,ariaLabel:Z,rfId:$,hasHandleBounds:Q})=>{const M=Ct(),V=j.useRef(null),Y=j.useRef(null),H=j.useRef(A),J=j.useRef(U),re=j.useRef(i),le=E||k||d||m||y||w,fe=WN(),te=ha(r,M.getState,m),ce=ha(r,M.getState,y),Ce=ha(r,M.getState,w),ve=ha(r,M.getState,N),Te=ha(r,M.getState,_),ye=we=>{const{nodeDragThreshold:_e}=M.getState();if(E&&(!P||!k||_e>0)&&xv({id:r,store:M,nodeRef:V}),d){const Be=M.getState().nodeInternals.get(r);Be&&d(we,{...Be})}},ke=we=>{if(!mv(we)&&!ne)if(gN.includes(we.key)&&E){const _e=we.key==="Escape";xv({id:r,store:M,unselect:_e,nodeRef:V})}else k&&p&&Object.prototype.hasOwnProperty.call(fo,we.key)&&(M.setState({ariaLiveMessage:`Moved selected node ${we.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~l}, y: ${~~u}`}),fe({x:fo[we.key].x,y:fo[we.key].y,isShiftPressed:we.shiftKey}))};j.useEffect(()=>()=>{Y.current&&(O==null||O.unobserve(Y.current),Y.current=null)},[]),j.useEffect(()=>{if(V.current&&!L){const we=V.current;(!z||!Q||Y.current!==we)&&(Y.current&&(O==null||O.unobserve(Y.current)),O==null||O.observe(we),Y.current=we)}},[L,z,Q]),j.useEffect(()=>{const we=re.current!==i,_e=H.current!==A,Be=J.current!==U;V.current&&(we||_e||Be)&&(we&&(re.current=i),_e&&(H.current=A),Be&&(J.current=U),M.getState().updateNodeDimensions([{id:r,nodeElement:V.current,forceUpdate:!0}]))},[r,i,A,U]);const Ke=HN({nodeRef:V,disabled:L||!k,noDragClassName:T,handleSelector:q,nodeId:r,isSelectable:E,selectNodesOnDrag:P});return L?null:ue.createElement("div",{className:Ft(["react-flow__node",`react-flow__node-${i}`,{[B]:k},S,{selected:p,selectable:E,parent:F,dragging:Ke}]),ref:V,style:{zIndex:G,transform:`translate(${c}px,${h}px)`,pointerEvents:le?"all":"none",visibility:z?"visible":"hidden",...b},"data-id":r,"data-testid":`rf__node-${r}`,onMouseEnter:te,onMouseMove:ce,onMouseLeave:Ce,onContextMenu:ve,onClick:ye,onDoubleClick:Te,onKeyDown:I?ke:void 0,tabIndex:I?0:void 0,role:I?"button":void 0,"aria-describedby":ne?void 0:`${LN}-${$}`,"aria-label":Z},ue.createElement(QI,{value:r},ue.createElement(e,{id:r,data:o,type:i,xPos:l,yPos:u,selected:p,isConnectable:C,sourcePosition:A,targetPosition:U,dragging:Ke,dragHandle:q,zIndex:G})))};return n.displayName="NodeWrapper",j.memo(n)};const DM=e=>{const n=e.getNodes().filter(r=>r.selected);return{...Au(n,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function FM({onSelectionContextMenu:e,noPanClassName:n,disableKeyboardA11y:r}){const i=Ct(),{width:o,height:l,x:u,y:c,transformString:h,userSelectionActive:p}=Qe(DM,Nt),d=WN(),m=j.useRef(null);if(j.useEffect(()=>{var N;r||(N=m.current)==null||N.focus({preventScroll:!0})},[r]),HN({nodeRef:m}),p||!o||!l)return null;const y=e?N=>{const _=i.getState().getNodes().filter(b=>b.selected);e(N,_)}:void 0,w=N=>{Object.prototype.hasOwnProperty.call(fo,N.key)&&d({x:fo[N.key].x,y:fo[N.key].y,isShiftPressed:N.shiftKey})};return ue.createElement("div",{className:Ft(["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 zM=j.memo(FM);const BM=e=>e.nodesSelectionActive,VN=({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:b,panActivationKeyCode:S,zoomActivationKeyCode:k,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:I,panOnScroll:P,panOnScrollSpeed:A,panOnScrollMode:U,zoomOnDoubleClick:L,panOnDrag:O,defaultViewport:q,translateExtent:G,minZoom:F,maxZoom:T,preventScrolling:B,onSelectionContextMenu:z,noWheelClassName:ne,noPanClassName:Z,disableKeyboardA11y:$})=>{const Q=Qe(BM),M=ja(m),V=ja(S),Y=V||O,H=V||P,J=M||y&&Y!==!0;return NM({deleteKeyCode:c,multiSelectionKeyCode:b}),ue.createElement(TM,{onMove:h,onMoveStart:p,onMoveEnd:d,onPaneContextMenu:l,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:I,panOnScroll:H,panOnScrollSpeed:A,panOnScrollMode:U,zoomOnDoubleClick:L,panOnDrag:!M&&Y,defaultViewport:q,translateExtent:G,minZoom:F,maxZoom:T,zoomActivationKeyCode:k,preventScrolling:B,noWheelClassName:ne,noPanClassName:Z},ue.createElement(zN,{onSelectionStart:N,onSelectionEnd:_,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:o,onPaneContextMenu:l,onPaneScroll:u,panOnDrag:Y,isSelecting:!!J,selectionMode:w},e,Q&&ue.createElement(zM,{onSelectionContextMenu:z,noPanClassName:Z,disableKeyboardA11y:$})))};VN.displayName="FlowRenderer";var UM=j.memo(VN);function HM(e){return Qe(j.useCallback(r=>e?SN(r.nodeInternals,{x:0,y:0,width:r.width,height:r.height},r.transform,!0):r.getNodes(),[e]))}function WM(e){const n={input:pa(e.input||IN),default:pa(e.default||wv),output:pa(e.output||ON),group:pa(e.group||Vv)},r={},i=Object.keys(e).filter(o=>!["input","default","output","group"].includes(o)).reduce((o,l)=>(o[l]=pa(e[l]||wv),o),r);return{...n,...i}}const VM=({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]},GM=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),GN=e=>{const{nodesDraggable:n,nodesConnectable:r,nodesFocusable:i,elementsSelectable:o,updateNodeDimensions:l,onError:u}=Qe(GM,Nt),c=HM(e.onlyRenderVisibleElements),h=j.useRef(),p=j.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 j.useEffect(()=>()=>{var d;(d=h==null?void 0:h.current)==null||d.disconnect()},[]),ue.createElement("div",{className:"react-flow__nodes",style:Gv},c.map(d=>{var I,P,A;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"),b=!!(d.focusable||i&&typeof d.focusable>"u"),S=e.nodeExtent?Fv(d.positionAbsolute,e.nodeExtent):d.positionAbsolute,k=(S==null?void 0:S.x)??0,E=(S==null?void 0:S.y)??0,C=VM({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:b,resizeObserver:p,dragHandle:d.dragHandle,zIndex:((I=d[dt])==null?void 0:I.z)??0,isParent:!!((P=d[dt])!=null&&P.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!d.width&&!!d.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:d.ariaLabel,hasHandleBounds:!!((A=d[dt])!=null&&A.handleBounds)})}))};GN.displayName="NodeRenderer";var YM=j.memo(GN);const KM=(e,n,r)=>r===Ae.Left?e-n:r===Ae.Right?e+n:e,XM=(e,n,r)=>r===Ae.Top?e-n:r===Ae.Bottom?e+n:e,Sx="react-flow__edgeupdater",kx=({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:Ft([Sx,`${Sx}-${c}`]),cx:KM(n,i,e),cy:XM(r,i,e),r:i,stroke:"transparent",fill:"transparent"}),QM=()=>!0;var ro=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:b,source:S,target:k,sourceX:E,sourceY:C,targetX:I,targetY:P,sourcePosition:A,targetPosition:U,elementsSelectable:L,hidden:O,sourceHandleId:q,targetHandleId:G,onContextMenu:F,onMouseEnter:T,onMouseMove:B,onMouseLeave:z,reconnectRadius:ne,onReconnect:Z,onReconnectStart:$,onReconnectEnd:Q,markerEnd:M,markerStart:V,rfId:Y,ariaLabel:H,isFocusable:J,isReconnectable:re,pathOptions:le,interactionWidth:fe,disableKeyboardA11y:te})=>{const ce=j.useRef(null),[Ce,ve]=j.useState(!1),[Te,ye]=j.useState(!1),ke=Ct(),Ke=j.useMemo(()=>`url('#${vv(V,Y)}')`,[V,Y]),we=j.useMemo(()=>`url('#${vv(M,Y)}')`,[M,Y]);if(O)return null;const _e=Ze=>{var Mt;const{edges:wt,addSelectedEdges:pt,unselectNodesAndEdges:mt,multiSelectionActive:_n}=ke.getState(),Yt=wt.find(Kt=>Kt.id===r);Yt&&(L&&(ke.setState({nodesSelectionActive:!1}),Yt.selected&&_n?(mt({nodes:[],edges:[Yt]}),(Mt=ce.current)==null||Mt.blur()):pt([r])),u&&u(Ze,Yt))},Be=fa(r,ke.getState,c),ft=fa(r,ke.getState,F),ht=fa(r,ke.getState,T),We=fa(r,ke.getState,B),$e=fa(r,ke.getState,z),Je=(Ze,wt)=>{if(Ze.button!==0)return;const{edges:pt,isValidConnection:mt}=ke.getState(),_n=wt?k:S,Yt=(wt?G:q)||null,Mt=wt?"target":"source",Kt=mt||QM,yr=wt,bn=pt.find(Sn=>Sn.id===r);ye(!0),$==null||$(Ze,bn,Mt);const Xt=Sn=>{ye(!1),Q==null||Q(Sn,bn,Mt)};RN({event:Ze,handleId:Yt,nodeId:_n,onConnect:Sn=>Z==null?void 0:Z(bn,Sn),isTarget:yr,getState:ke.getState,setState:ke.setState,isValidConnection:Kt,edgeUpdaterType:Mt,onReconnectEnd:Xt})},Xe=Ze=>Je(Ze,!0),vt=Ze=>Je(Ze,!1),ot=()=>ve(!0),yt=()=>ve(!1),Gt=!L&&!u,It=Ze=>{var wt;if(!te&&gN.includes(Ze.key)&&L){const{unselectNodesAndEdges:pt,addSelectedEdges:mt,edges:_n}=ke.getState();Ze.key==="Escape"?((wt=ce.current)==null||wt.blur(),pt({edges:[_n.find(Mt=>Mt.id===r)]})):mt([r])}};return ue.createElement("g",{className:Ft(["react-flow__edge",`react-flow__edge-${o}`,i,{selected:h,animated:p,inactive:Gt,updating:Ce}]),onClick:_e,onDoubleClick:Be,onContextMenu:ft,onMouseEnter:ht,onMouseMove:We,onMouseLeave:$e,onKeyDown:J?It:void 0,tabIndex:J?0:void 0,role:J?"button":"img","data-testid":`rf__edge-${r}`,"aria-label":H===null?void 0:H||`Edge from ${S} to ${k}`,"aria-describedby":J?`${qN}-${Y}`:void 0,ref:ce},!Te&&ue.createElement(e,{id:r,source:S,target:k,selected:h,animated:p,label:d,labelStyle:m,labelShowBg:y,labelBgStyle:w,labelBgPadding:N,labelBgBorderRadius:_,data:l,style:b,sourceX:E,sourceY:C,targetX:I,targetY:P,sourcePosition:A,targetPosition:U,sourceHandleId:q,targetHandleId:G,markerStart:Ke,markerEnd:we,pathOptions:le,interactionWidth:fe}),re&&ue.createElement(ue.Fragment,null,(re==="source"||re===!0)&&ue.createElement(kx,{position:A,centerX:E,centerY:C,radius:ne,onMouseDown:Xe,onMouseEnter:ot,onMouseOut:yt,type:"source"}),(re==="target"||re===!0)&&ue.createElement(kx,{position:U,centerX:I,centerY:P,radius:ne,onMouseDown:vt,onMouseEnter:ot,onMouseOut:yt,type:"target"})))};return n.displayName="EdgeWrapper",j.memo(n)};function ZM(e){const n={default:ro(e.default||wu),straight:ro(e.bezier||Uv),step:ro(e.step||Bv),smoothstep:ro(e.step||Tu),simplebezier:ro(e.simplebezier||zv)},r={},i=Object.keys(e).filter(o=>!["default","bezier"].includes(o)).reduce((o,l)=>(o[l]=ro(e[l]||wu),o),r);return{...n,...i}}function Ex(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 Nx(e,n){return e?e.length===1||!n?e[0]:n&&e.find(r=>r.id===n)||null:null}const JM=(e,n,r,i,o,l)=>{const u=Ex(r,e,n),c=Ex(l,i,o);return{sourceX:u.x,sourceY:u.y,targetX:c.x,targetY:c.y}};function eO({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=Ca({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 Cx(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 tO=[{level:0,isMaxLevel:!0,edges:[]}];function nO(e,n,r=!1){let i=-1;const o=e.reduce((u,c)=>{var d,m;const h=Pn(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?tO:l}function rO(e,n,r){const i=Qe(j.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)&&eO({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 nO(i,n,r)}const sO=({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"}),iO=({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"}),Rx={[yu.Arrow]:sO,[yu.ArrowClosed]:iO};function oO(e){const n=Ct();return j.useMemo(()=>{var o,l;return Object.prototype.hasOwnProperty.call(Rx,e)?Rx[e]:((l=(o=n.getState()).onError)==null||l.call(o,"009",Hr.error009(e)),null)},[e])}const aO=({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=oO(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},lO=({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=vv(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))},YN=({defaultColor:e,rfId:n})=>{const r=Qe(j.useCallback(lO({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(aO,{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})))};YN.displayName="MarkerDefinitions";var uO=j.memo(YN);const cO=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}),KN=({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:b,disableKeyboardA11y:S})=>{const{edgesFocusable:k,edgesUpdatable:E,elementsSelectable:C,width:I,height:P,connectionMode:A,nodeInternals:U,onError:L}=Qe(cO,Nt),O=rO(n,U,r);return I?ue.createElement(ue.Fragment,null,O.map(({level:q,edges:G,isMaxLevel:F})=>ue.createElement("svg",{key:q,style:{zIndex:q},width:I,height:P,className:"react-flow__edges react-flow__container"},F&&ue.createElement(uO,{defaultColor:e,rfId:i}),ue.createElement("g",null,G.map(T=>{const[B,z,ne]=Cx(U.get(T.source)),[Z,$,Q]=Cx(U.get(T.target));if(!ne||!Q)return null;let M=T.type||"default";o[M]||(L==null||L("011",Hr.error011(M)),M="default");const V=o[M]||o.default,Y=A===ai.Strict?$.target:($.target??[]).concat($.source??[]),H=Nx(z.source,T.sourceHandle),J=Nx(Y,T.targetHandle),re=(H==null?void 0:H.position)||Ae.Bottom,le=(J==null?void 0:J.position)||Ae.Top,fe=!!(T.focusable||k&&typeof T.focusable>"u"),te=T.reconnectable||T.updatable,ce=typeof y<"u"&&(te||E&&typeof te>"u");if(!H||!J)return L==null||L("008",Hr.error008(H,T)),null;const{sourceX:Ce,sourceY:ve,targetX:Te,targetY:ye}=JM(B,H,re,Z,J,le);return ue.createElement(V,{key:T.id,id:T.id,className:Ft([T.className,l]),type:M,data:T.data,selected:!!T.selected,animated:!!T.animated,hidden:!!T.hidden,label:T.label,labelStyle:T.labelStyle,labelShowBg:T.labelShowBg,labelBgStyle:T.labelBgStyle,labelBgPadding:T.labelBgPadding,labelBgBorderRadius:T.labelBgBorderRadius,style:T.style,source:T.source,target:T.target,sourceHandleId:T.sourceHandle,targetHandleId:T.targetHandle,markerEnd:T.markerEnd,markerStart:T.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:T.ariaLabel,isFocusable:fe,isReconnectable:ce,pathOptions:"pathOptions"in T?T.pathOptions:void 0,interactionWidth:T.interactionWidth,disableKeyboardA11y:S})})))),b):null};KN.displayName="EdgeRenderer";var dO=j.memo(KN);const fO=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function hO({children:e}){const n=Qe(fO);return ue.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:n}},e)}function pO(e){const n=La(),r=j.useRef(!1);j.useEffect(()=>{!r.current&&n.viewportInitialized&&e&&(setTimeout(()=>e(n),1),r.current=!0)},[e,n.viewportInitialized])}const mO={[Ae.Left]:Ae.Right,[Ae.Right]:Ae.Left,[Ae.Top]:Ae.Bottom,[Ae.Bottom]:Ae.Top},XN=({nodeId:e,handleType:n,style:r,type:i=xs.Bezier,CustomComponent:o,connectionStatus:l})=>{var P,A,U;const{fromNode:u,handleId:c,toX:h,toY:p,connectionMode:d}=Qe(j.useCallback(L=>({fromNode:L.nodeInternals.get(e),handleId:L.connectionHandleId,toX:(L.connectionPosition.x-L.transform[0])/L.transform[2],toY:(L.connectionPosition.y-L.transform[1])/L.transform[2],connectionMode:L.connectionMode}),[e]),Nt),m=(P=u==null?void 0:u[dt])==null?void 0:P.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(L=>L.id===c):y[0],N=w?w.x+w.width/2:(u.width??0)/2,_=w?w.y+w.height/2:u.height??0,b=(((A=u.positionAbsolute)==null?void 0:A.x)??0)+N,S=(((U=u.positionAbsolute)==null?void 0:U.y)??0)+_,k=w==null?void 0:w.position,E=k?mO[k]:null;if(!k||!E)return null;if(o)return ue.createElement(o,{connectionLineType:i,connectionLineStyle:r,fromNode:u,fromHandle:w,fromX:b,fromY:S,toX:h,toY:p,fromPosition:k,toPosition:E,connectionStatus:l});let C="";const I={sourceX:b,sourceY:S,sourcePosition:k,targetX:h,targetY:p,targetPosition:E};return i===xs.Bezier?[C]=_N(I):i===xs.Step?[C]=gv({...I,borderRadius:0}):i===xs.SmoothStep?[C]=gv(I):i===xs.SimpleBezier?[C]=xN(I):C=`M${b},${S} ${h},${p}`,ue.createElement("path",{d:C,fill:"none",className:"react-flow__connection-path",style:r})};XN.displayName="ConnectionLine";const gO=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function vO({containerStyle:e,style:n,type:r,component:i}){const{nodeId:o,handleType:l,nodesConnectable:u,width:c,height:h,connectionStatus:p}=Qe(gO,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:Ft(["react-flow__connection",p])},ue.createElement(XN,{nodeId:o,handleType:l,style:n,type:r,CustomComponent:i,connectionStatus:p})))}function jx(e,n){return j.useRef(null),Ct(),j.useMemo(()=>n(e),[e])}const QN=({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:b,connectionLineType:S,connectionLineStyle:k,connectionLineComponent:E,connectionLineContainerStyle:C,selectionKeyCode:I,selectionOnDrag:P,selectionMode:A,multiSelectionKeyCode:U,panActivationKeyCode:L,zoomActivationKeyCode:O,deleteKeyCode:q,onlyRenderVisibleElements:G,elementsSelectable:F,selectNodesOnDrag:T,defaultViewport:B,translateExtent:z,minZoom:ne,maxZoom:Z,preventScrolling:$,defaultMarkerColor:Q,zoomOnScroll:M,zoomOnPinch:V,panOnScroll:Y,panOnScrollSpeed:H,panOnScrollMode:J,zoomOnDoubleClick:re,panOnDrag:le,onPaneClick:fe,onPaneMouseEnter:te,onPaneMouseMove:ce,onPaneMouseLeave:Ce,onPaneScroll:ve,onPaneContextMenu:Te,onEdgeContextMenu:ye,onEdgeMouseEnter:ke,onEdgeMouseMove:Ke,onEdgeMouseLeave:we,onReconnect:_e,onReconnectStart:Be,onReconnectEnd:ft,reconnectRadius:ht,noDragClassName:We,noWheelClassName:$e,noPanClassName:Je,elevateEdgesOnSelect:Xe,disableKeyboardA11y:vt,nodeOrigin:ot,nodeExtent:yt,rfId:Gt})=>{const It=jx(e,WM),Ze=jx(n,ZM);return pO(l),ue.createElement(UM,{onPaneClick:fe,onPaneMouseEnter:te,onPaneMouseMove:ce,onPaneMouseLeave:Ce,onPaneContextMenu:Te,onPaneScroll:ve,deleteKeyCode:q,selectionKeyCode:I,selectionOnDrag:P,selectionMode:A,onSelectionStart:_,onSelectionEnd:b,multiSelectionKeyCode:U,panActivationKeyCode:L,zoomActivationKeyCode:O,elementsSelectable:F,onMove:r,onMoveStart:i,onMoveEnd:o,zoomOnScroll:M,zoomOnPinch:V,zoomOnDoubleClick:re,panOnScroll:Y,panOnScrollSpeed:H,panOnScrollMode:J,panOnDrag:le,defaultViewport:B,translateExtent:z,minZoom:ne,maxZoom:Z,onSelectionContextMenu:N,preventScrolling:$,noDragClassName:We,noWheelClassName:$e,noPanClassName:Je,disableKeyboardA11y:vt},ue.createElement(hO,null,ue.createElement(dO,{edgeTypes:Ze,onEdgeClick:c,onEdgeDoubleClick:p,onlyRenderVisibleElements:G,onEdgeContextMenu:ye,onEdgeMouseEnter:ke,onEdgeMouseMove:Ke,onEdgeMouseLeave:we,onReconnect:_e,onReconnectStart:Be,onReconnectEnd:ft,reconnectRadius:ht,defaultMarkerColor:Q,noPanClassName:Je,elevateEdgesOnSelect:!!Xe,disableKeyboardA11y:vt,rfId:Gt},ue.createElement(vO,{style:k,type:S,component:E,containerStyle:C})),ue.createElement("div",{className:"react-flow__edgelabel-renderer"}),ue.createElement(YM,{nodeTypes:It,onNodeClick:u,onNodeDoubleClick:h,onNodeMouseEnter:d,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:w,selectNodesOnDrag:T,onlyRenderVisibleElements:G,noPanClassName:Je,noDragClassName:We,disableKeyboardA11y:vt,nodeOrigin:ot,nodeExtent:yt,rfId:Gt})))};QN.displayName="GraphView";var yO=j.memo(QN);const _v=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],vs={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:_v,nodeExtent:_v,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:WI,isValidConnection:void 0},wO=()=>iT((e,n)=>({...vs,setNodes:r=>{const{nodeInternals:i,nodeOrigin:o,elevateNodesOnSelect:l}=n();e({nodeInternals:Od(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?Od(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((_,b)=>{const S=o.get(b.id);if(S!=null&&S.hidden)o.set(S.id,{...S,[dt]:{...S[dt],handleBounds:void 0}});else if(S){const k=Dv(b.nodeElement);!!(k.width&&k.height&&(S.width!==k.width||S.height!==k.height||b.forceUpdate))&&(o.set(S.id,{...S,[dt]:{...S[dt],handleBounds:{source:bx(".source",b.nodeElement,y,p),target:bx(".target",b.nodeElement,y,p)}},...k}),_.push({id:S.id,type:"dimensions",dimensions:k}))}return _},[]);DN(o,p);const N=u||l&&!u&&FN(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=OM(r,c()),d=Od(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=>ws(h,!0)):(u=oo(l(),r),c=oo(o,[])),Xl({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=>ws(h,!0)):(u=oo(o,r),c=oo(l(),[])),Xl({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,ws(d.id,!1))),p=c.map(d=>ws(d.id,!1));Xl({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=>ws(c.id,!1)),u=r.filter(c=>c.selected).map(c=>ws(c.id,!1));Xl({changedNodes:l,changedEdges:u,get:n,set:e})},setNodeExtent:r=>{const{nodeInternals:i}=n();i.forEach(o=>{o.positionAbsolute=Fv(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:vs.connectionNodeId,connectionHandleId:vs.connectionHandleId,connectionHandleType:vs.connectionHandleType,connectionStatus:vs.connectionStatus,connectionStartHandle:vs.connectionStartHandle,connectionEndHandle:vs.connectionEndHandle}),reset:()=>e({...vs})}),Object.is),Yv=({children:e})=>{const n=j.useRef(null);return n.current||(n.current=wO()),ue.createElement($I,{value:n.current},e)};Yv.displayName="ReactFlowProvider";const ZN=({children:e})=>j.useContext(ju)?ue.createElement(ue.Fragment,null,e):ue.createElement(Yv,null,e);ZN.displayName="ReactFlowWrapper";const xO={input:IN,default:wv,output:ON,group:Vv},_O={default:wu,straight:Uv,step:Bv,smoothstep:Tu,simplebezier:zv},bO=[0,0],SO=[15,15],kO={x:0,y:0,zoom:1},EO={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},JN=j.forwardRef(({nodes:e,edges:n,defaultNodes:r,defaultEdges:i,className:o,nodeTypes:l=xO,edgeTypes:u=_O,onNodeClick:c,onEdgeClick:h,onInit:p,onMove:d,onMoveStart:m,onMoveEnd:y,onConnect:w,onConnectStart:N,onConnectEnd:_,onClickConnectStart:b,onClickConnectEnd:S,onNodeMouseEnter:k,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:I,onNodeDoubleClick:P,onNodeDragStart:A,onNodeDrag:U,onNodeDragStop:L,onNodesDelete:O,onEdgesDelete:q,onSelectionChange:G,onSelectionDragStart:F,onSelectionDrag:T,onSelectionDragStop:B,onSelectionContextMenu:z,onSelectionStart:ne,onSelectionEnd:Z,connectionMode:$=ai.Strict,connectionLineType:Q=xs.Bezier,connectionLineStyle:M,connectionLineComponent:V,connectionLineContainerStyle:Y,deleteKeyCode:H="Backspace",selectionKeyCode:J="Shift",selectionOnDrag:re=!1,selectionMode:le=Ra.Full,panActivationKeyCode:fe="Space",multiSelectionKeyCode:te=vu()?"Meta":"Control",zoomActivationKeyCode:ce=vu()?"Meta":"Control",snapToGrid:Ce=!1,snapGrid:ve=SO,onlyRenderVisibleElements:Te=!1,selectNodesOnDrag:ye=!0,nodesDraggable:ke,nodesConnectable:Ke,nodesFocusable:we,nodeOrigin:_e=bO,edgesFocusable:Be,edgesUpdatable:ft,elementsSelectable:ht,defaultViewport:We=kO,minZoom:$e=.5,maxZoom:Je=2,translateExtent:Xe=_v,preventScrolling:vt=!0,nodeExtent:ot,defaultMarkerColor:yt="#b1b1b7",zoomOnScroll:Gt=!0,zoomOnPinch:It=!0,panOnScroll:Ze=!1,panOnScrollSpeed:wt=.5,panOnScrollMode:pt=ri.Free,zoomOnDoubleClick:mt=!0,panOnDrag:_n=!0,onPaneClick:Yt,onPaneMouseEnter:Mt,onPaneMouseMove:Kt,onPaneMouseLeave:yr,onPaneScroll:bn,onPaneContextMenu:Xt,children:pn,onEdgeContextMenu:Sn,onEdgeDoubleClick:Gr,onEdgeMouseEnter:ut,onEdgeMouseMove:hi,onEdgeMouseLeave:rr,onEdgeUpdate:ks,onEdgeUpdateStart:pi,onEdgeUpdateEnd:Qt,onReconnect:sr,onReconnectStart:wr,onReconnectEnd:No,reconnectRadius:ir=10,edgeUpdaterRadius:xr=10,onNodesChange:mn,onEdgesChange:Yr,noDragClassName:mi="nodrag",noWheelClassName:Kr="nowheel",noPanClassName:Es="nopan",fitView:gn=!1,fitViewOptions:Rt,connectOnClick:_r=!0,attributionPosition:Xr,proOptions:Zt,defaultEdgeOptions:Qr,elevateNodesOnSelect:Ns=!0,elevateEdgesOnSelect:gi=!1,disableKeyboardA11y:or=!1,autoPanOnConnect:vi=!0,autoPanOnNodeDrag:et=!0,connectionRadius:Co=20,isValidConnection:br,onError:Cs,style:ar,id:$n,nodeDragThreshold:yi,...Ot},zt)=>{const Sr=$n||"1";return ue.createElement("div",{...Ot,style:{...ar,...EO},ref:zt,className:Ft(["react-flow",o]),"data-testid":"rf__wrapper",id:$n},ue.createElement(ZN,null,ue.createElement(yO,{onInit:p,onMove:d,onMoveStart:m,onMoveEnd:y,onNodeClick:c,onEdgeClick:h,onNodeMouseEnter:k,onNodeMouseMove:E,onNodeMouseLeave:C,onNodeContextMenu:I,onNodeDoubleClick:P,nodeTypes:l,edgeTypes:u,connectionLineType:Q,connectionLineStyle:M,connectionLineComponent:V,connectionLineContainerStyle:Y,selectionKeyCode:J,selectionOnDrag:re,selectionMode:le,deleteKeyCode:H,multiSelectionKeyCode:te,panActivationKeyCode:fe,zoomActivationKeyCode:ce,onlyRenderVisibleElements:Te,selectNodesOnDrag:ye,defaultViewport:We,translateExtent:Xe,minZoom:$e,maxZoom:Je,preventScrolling:vt,zoomOnScroll:Gt,zoomOnPinch:It,zoomOnDoubleClick:mt,panOnScroll:Ze,panOnScrollSpeed:wt,panOnScrollMode:pt,panOnDrag:_n,onPaneClick:Yt,onPaneMouseEnter:Mt,onPaneMouseMove:Kt,onPaneMouseLeave:yr,onPaneScroll:bn,onPaneContextMenu:Xt,onSelectionContextMenu:z,onSelectionStart:ne,onSelectionEnd:Z,onEdgeContextMenu:Sn,onEdgeDoubleClick:Gr,onEdgeMouseEnter:ut,onEdgeMouseMove:hi,onEdgeMouseLeave:rr,onReconnect:sr??ks,onReconnectStart:wr??pi,onReconnectEnd:No??Qt,reconnectRadius:ir??xr,defaultMarkerColor:yt,noDragClassName:mi,noWheelClassName:Kr,noPanClassName:Es,elevateEdgesOnSelect:gi,rfId:Sr,disableKeyboardA11y:or,nodeOrigin:_e,nodeExtent:ot}),ue.createElement(pM,{nodes:e,edges:n,defaultNodes:r,defaultEdges:i,onConnect:w,onConnectStart:N,onConnectEnd:_,onClickConnectStart:b,onClickConnectEnd:S,nodesDraggable:ke,nodesConnectable:Ke,nodesFocusable:we,edgesFocusable:Be,edgesUpdatable:ft,elementsSelectable:ht,elevateNodesOnSelect:Ns,minZoom:$e,maxZoom:Je,nodeExtent:ot,onNodesChange:mn,onEdgesChange:Yr,snapToGrid:Ce,snapGrid:ve,connectionMode:$,translateExtent:Xe,connectOnClick:_r,defaultEdgeOptions:Qr,fitView:gn,fitViewOptions:Rt,onNodesDelete:O,onEdgesDelete:q,onNodeDragStart:A,onNodeDrag:U,onNodeDragStop:L,onSelectionDrag:T,onSelectionDragStart:F,onSelectionDragStop:B,noPanClassName:Es,nodeOrigin:_e,rfId:Sr,autoPanOnConnect:vi,autoPanOnNodeDrag:et,onError:Cs,connectionRadius:Co,isValidConnection:br,nodeDragThreshold:yi}),ue.createElement(fM,{onSelectionChange:G}),pn,ue.createElement(FI,{proOptions:Zt,position:Xr}),ue.createElement(wM,{rfId:Sr,disableKeyboardA11y:or})))});JN.displayName="ReactFlow";const NO=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function eC(){return Qe(NO,Nt)}const tC=({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||{},b=u||N||_;return ue.createElement("rect",{className:Ft(["react-flow__minimap-node",{selected:w},p]),x:n,y:r,rx:d,ry:d,width:i,height:o,fill:b,stroke:c,strokeWidth:h,shapeRendering:m,onClick:y?S=>y(S,e):void 0})};tC.displayName="MiniMapNode";var CO=j.memo(tC);const RO=e=>e.nodeOrigin,jO=e=>e.getNodes().filter(n=>!n.hidden&&n.width&&n.height),$d=e=>e instanceof Function?e:()=>e;function TO({nodeStrokeColor:e="transparent",nodeColor:n="#e2e2e2",nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:o=2,nodeComponent:l=CO,onClick:u}){const c=Qe(jO,Nt),h=Qe(RO),p=$d(n),d=$d(e),m=$d(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 AO=j.memo(TO);const IO=200,MO=150,OO=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?UI(Au(n,e.nodeOrigin),r):r,rfId:e.rfId}},PO="react-flow__minimap-desc";function nC({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:b="React Flow mini map",inversePan:S=!1,zoomStep:k=10,offsetScale:E=5}){const C=Ct(),I=j.useRef(null),{boundingRect:P,viewBB:A,rfId:U}=Qe(OO,Nt),L=(e==null?void 0:e.width)??IO,O=(e==null?void 0:e.height)??MO,q=P.width/L,G=P.height/O,F=Math.max(q,G),T=F*L,B=F*O,z=E*F,ne=P.x-(T-P.width)/2-z,Z=P.y-(B-P.height)/2-z,$=T+z*2,Q=B+z*2,M=`${PO}-${U}`,V=j.useRef(0);V.current=F,j.useEffect(()=>{if(I.current){const J=On(I.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 Ke=V.current*Math.max(1,ce[2])*(S?-1:1),we={x:ce[0]-te.sourceEvent.movementX*Ke,y:ce[1]-te.sourceEvent.movementY*Ke},_e=[[0,0],[ye,ke]],Be=Br.translate(we.x,we.y).scale(ce[2]),ft=ve.constrain()(Be,_e,Te);ve.transform(Ce,ft)},fe=cN().on("zoom",N?le:null).on("zoom.wheel",_?re:null);return J.call(fe),()=>{J.on("zoom",null)}}},[N,_,S,k]);const Y=y?J=>{const re=Qn(J);y(J,{x:re[0],y:re[1]})}:void 0,H=w?(J,re)=>{const le=C.getState().nodeInternals.get(re);w(J,le)}:void 0;return ue.createElement($v,{position:m,style:e,className:Ft(["react-flow__minimap",n]),"data-testid":"rf__minimap"},ue.createElement("svg",{width:L,height:O,viewBox:`${ne} ${Z} ${$} ${Q}`,role:"img","aria-labelledby":M,ref:I,onClick:Y},b&&ue.createElement("title",{id:M},b),ue.createElement(AO,{onClick:H,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${Q+z*2}h${-$-z*2}z
|
|
57
|
+
M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fill:h,fillRule:"evenodd",stroke:p,strokeWidth:d,pointerEvents:"none"})))}nC.displayName="MiniMap";var LO=j.memo(nC);function qO(){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 $O(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},ue.createElement("path",{d:"M0 0h32v4.2H0z"}))}function DO(){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 FO(){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 zO(){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 ao=({children:e,className:n,...r})=>ue.createElement("button",{type:"button",className:Ft(["react-flow__controls-button",n]),...r},e);ao.displayName="ControlButton";const BO=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),rC=({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]=j.useState(!1),{isInteractive:_,minZoomReached:b,maxZoomReached:S}=Qe(BO,Nt),{zoomIn:k,zoomOut:E,fitView:C}=La();if(j.useEffect(()=>{N(!0)},[]),!w)return null;const I=()=>{k(),l==null||l()},P=()=>{E(),u==null||u()},A=()=>{C(o),c==null||c()},U=()=>{y.setState({nodesDraggable:!_,nodesConnectable:!_,elementsSelectable:!_}),h==null||h(!_)};return ue.createElement($v,{className:Ft(["react-flow__controls",p]),position:m,style:e,"data-testid":"rf__controls"},n&&ue.createElement(ue.Fragment,null,ue.createElement(ao,{onClick:I,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:S},ue.createElement(qO,null)),ue.createElement(ao,{onClick:P,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:b},ue.createElement($O,null))),r&&ue.createElement(ao,{className:"react-flow__controls-fitview",onClick:A,title:"fit view","aria-label":"fit view"},ue.createElement(DO,null)),i&&ue.createElement(ao,{className:"react-flow__controls-interactive",onClick:U,title:"toggle interactivity","aria-label":"toggle interactivity"},_?ue.createElement(zO,null):ue.createElement(FO,null)),d)};rC.displayName="Controls";var UO=j.memo(rC),Jn;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Jn||(Jn={}));function HO({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 WO({color:e,radius:n}){return ue.createElement("circle",{cx:n,cy:n,r:n,fill:e})}const VO={[Jn.Dots]:"#91919a",[Jn.Lines]:"#eee",[Jn.Cross]:"#e2e2e2"},GO={[Jn.Dots]:1,[Jn.Lines]:1,[Jn.Cross]:6},YO=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function sC({id:e,variant:n=Jn.Dots,gap:r=20,size:i,lineWidth:o=1,offset:l=2,color:u,style:c,className:h}){const p=j.useRef(null),{transform:d,patternId:m}=Qe(YO,Nt),y=u||VO[n],w=i||GO[n],N=n===Jn.Dots,_=n===Jn.Cross,b=Array.isArray(r)?r:[r,r],S=[b[0]*d[2]||1,b[1]*d[2]||1],k=w*d[2],E=_?[k,k]:S,C=N?[k/l,k/l]:[E[0]/l,E[1]/l];return ue.createElement("svg",{className:Ft(["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]%S[0],y:d[1]%S[1],width:S[0],height:S[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`},N?ue.createElement(WO,{color:y,radius:k/l}):ue.createElement(HO,{dimensions:E,color:y,lineWidth:o})),ue.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}sC.displayName="Background";var KO=j.memo(sC);function iC(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function oC(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 aC(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),...oC(r)};for(const i of Object.values(r)){const o=aC(i,n+1);if(o)return o}return null}function XO(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 QO=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function lC(e,n=0){if(!e||typeof e!="object"||n>6)return null;const r=e;if(typeof r.model=="string"&&QO.test(r.model))return r.model;for(const i of Object.values(r)){const o=lC(i,n+1);if(o)return o}return null}function bv(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,seqEpoch:null,totalEvents:0}}function bs(e){if(!e)return;const n=e.replace(/\\/g,"/").split("/").filter(Boolean);return n[n.length-1]}function qa(e,n){return`${e}::${n}`}function xu(e){return e.agent_type??e.subagent_type??"subagent"}function _a(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function lo(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:iC()},e.agents.set(o,l),l)}function uC(e,n,r,i){const o=qa(n,r),l=e.agents.get(o);if(!l)return null;!l.cwd&&i.cwd&&(l.cwd=i.cwd,l.cwdBasename=bs(i.cwd));const u=xu(i);return u&&(l.label==="subagent"||!l.label)&&(l.label=u),l}function Tx(e,n,r){const i=n.session_id??"unknown",o=_a(n);if(o){const h=uC(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(qa(i,u));if(h)return!h.cwd&&n.cwd&&(h.cwd=n.cwd,h.cwdBasename=bs(n.cwd)),h}const c=lo(e,i,r,!1);return c.synthetic&&(c.synthetic=!1,c.startedAt=r),!c.cwd&&n.cwd&&(c.cwd=n.cwd,c.cwdBasename=bs(n.cwd)),c.label==="session"&&n.cwd&&(c.label=bs(n.cwd)??"session"),c}function ZO(e,n,r,i,o){const l=qa(n,r),u=lo(e,n,o,!0);let c=e.agents.get(l);if(c){!c.cwd&&i.cwd&&(c.cwd=i.cwd,c.cwdBasename=bs(i.cwd));const h=xu(i);return h&&(c.label==="subagent"||!c.label)&&(c.label=h),c}return c={id:l,sessionId:n,label:xu(i),kind:"subagent",parentId:u.id,state:"active",startedAt:o,tools:[],prompts:[],cwd:i.cwd,cwdBasename:bs(i.cwd),toolCount:0,childCount:0,usage:iC()},e.agents.set(l,c),u.childCount+=1,c}function JO(e,n,r){const i=e.activeSubagentStack.get(n)??[];i.includes(r)||(i.push(r),e.activeSubagentStack.set(n,i))}function eP(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 Zl(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 Ax=200,tP=25;function nP(e,n){const r=n.tools;if(r.length>Ax){const i=r.splice(0,r.length-Ax);for(const o of i)e.toolIndex.delete(o.id),e.toolOwner.delete(o.id)}for(let i=r.length-tP-1;i>=0;i--){const o=r[i];if(o.trimmed)break;o.input=void 0,o.response=void 0,o.trimmed=!0}}function rP(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 Ix=2e3;function sP(e,n,r){for(let i=e.prompts.length-1;i>=0;i--){const o=e.prompts[i];if(o.at<n-Ix)return!1;if(o.text===r&&o.at<=n+Ix)return!0}return!1}function iP(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 oP(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 aP(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 lP=90*6e4;function uP(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 cP(e){return e==="permission_prompt"?"permission":e==="idle_prompt"?"idle":null}const dP=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved"]);function fP(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 hP(e,n,r,i,o){const l=r==="permission"?fP(e,n):void 0;return l?{kind:r,message:i,since:o,subagentId:l}:{kind:r,message:i,since:o}}function pP(e,n,r){if(e.kind!=="permission")return!0;const i=_a(n);return i==null?!0:e.subagentId!=null&&qa(r,i)===e.subagentId}function Mx(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{...bv(),lastSeq:n.seq,seqEpoch:e.seqEpoch};e.totalEvents+=1,e.lastSeq=n.seq;const u=i.session_id??"unknown";if(!dP.has(l)){const d=e.agents.get(u);d!=null&&d.waiting&&pP(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=oC(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=Tx(e,i,o);h.provider||(h.provider=i.provider==="codex"?"codex":"claude");const p=lC(i);switch(p&&(h.model=p),l){case"SessionStart":{const d=lo(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=bs(i.cwd)),d.label==="session"&&i.cwd&&(d.label=bs(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=lo(e,u,o,!1);d.state="active",d.endedAt=void 0,d.exitAt=void 0;const m=Tx(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&&!sP(m,o,y)&&(m.prompts.push({at:o,text:y}),m.firstPrompt||(m.firstPrompt=Zl(y,120)));break}case"PreToolUse":{const d=i.tool_use_id?rP(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=Zl(i.tool_input));break}const m=i.tool_use_id??`${h.id}:${h.toolCount}`,y=_a(i),w={id:m,name:i.tool_name??"?",input:i.tool_input,inputPreview:Zl(i.tool_input),agentId:h.id,explicitSubagentId:y?qa(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),nP(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 b=_.tools.find(S=>S.id===d);if(b){m=b,y=!0;break}}if(!m)break;m.endedAt=o,m.ok=l==="PostToolUse",m.trimmed||(m.response=i.tool_response),l==="PostToolUseFailure"?m.errorPreview=Zl(i.tool_response):y&&(m.errorPreview=void 0);const w=aC(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);_&&XO(_.usage,w)}break}case"SubagentStart":{const d=_a(i);if(!d)break;const m=ZO(e,u,d,i,o);m.state="active",m.startedAt=m.startedAt||o,m.exitAt=void 0,m.endedAt=void 0;const y=xu(i);y&&(m.label=y),JO(e,u,d);break}case"SubagentStop":{const d=_a(i);if(!d)break;const m=uC(e,u,d,i);if(!m)break;m.state="done",m.endedAt=o,eP(e,u,d);break}case"Stop":case"SessionEnd":{const d=lo(e,u,o,!1);d.state="done",d.endedAt=o,e.activeSubagentStack.delete(u);break}case"Notification":{const d=cP(i.notification_type);if(!d)break;const m=lo(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)}:hP(e,u,d,y,o);break}}return e}function Kv(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 mP=Date.UTC(2026,8,1);function gP(e){return e<mP?{input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4}:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}}const vP=[{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:gP},{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 yP(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function Xv(e,n=Date.now()){if(!e)return null;for(const r of vP)if(r.match.test(e))return typeof r.rates=="function"?r.rates(n):r.rates;return null}function cC(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 dC(e,n){return yP(n)?Math.max(0,e.inputTokens-e.cacheReadTokens):e.inputTokens}function fn(e,n,r=Date.now()){const i=Xv(n,r);if(!i)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const o=dC(e,n)*i.input/1e6,l=e.outputTokens*i.output/1e6,u=e.cacheReadTokens*i.cacheRead/1e6,c=cC(e,i),h=c.usd5m+c.usd1h;return{input:o,output:l,cacheRead:u,cacheWrite:h,total:o+l+u+h}}const Ox=2e5,wP=1e6,xP=[/\[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],_P=[{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 bP(e){if(!e)return Ox;for(const n of xP)if(n.test(e))return wP;for(const n of _P)if(n.match.test(e))return n.window;return Ox}function fC(e,n){return typeof e=="number"&&e>0?e:bP(n)}function ze(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 _u(e,n){if(e<=0||n<10)return null;const r=e/n,i=r*60;return i>=.01?`${ze(i)}/min`:`${ze(r*3600)}/hr`}const SP=1;function kP(){const e=[];let n=0;function r(){let i;for(const o of e)(!i||o.layer>i.layer||o.layer===i.layer&&o.seq>i.seq)&&(i=o);return i}return{push(i,o=0){const l={dismiss:i,layer:o,seq:n++};return e.push(l),()=>{const u=e.indexOf(l);u!==-1&&e.splice(u,1)}},dismissTop(){const i=r();return i?(i.dismiss(),!0):!1},isTop(i){const o=r();return o!=null&&o.dismiss===i},depth(){return e.length}}}const bu=kP();function EP(e){return e.overlayOpen?"dismiss":e.typing?"blur":"clear-selection"}function Px(e){return String(e.tagName??"").toUpperCase()==="BODY"}function NP(e,n){return!e||!e.isConnected||Px(e)?!1:n==null||Px(n)}const Lx="a[href], button, input, select, textarea, [tabindex]";function CP(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function RP(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const n=String(e.overflow??"").toLowerCase();return n==="auto"||n==="scroll"}function jP({count:e,index:n,shiftKey:r}){return e<=0?{kind:"hold"}:n<0||n>=e?{kind:"focus",index:r?e-1:0}:!r&&n===e-1?{kind:"focus",index:0}:r&&n===0?{kind:"focus",index:e-1}:{kind:"allow"}}function hC(e){return e.ctrlKey||e.metaKey||e.altKey}const TP=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),AP=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),IP=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function pC(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function Qv(e){if(!e)return!1;if(e.isContentEditable)return!0;const n=pC(e);return n==="TEXTAREA"?!0:n!=="INPUT"?!1:!TP.has(String(e.type??"text").toLowerCase())}function MP(e){if(!e)return!1;if(Qv(e)||AP.has(pC(e)))return!0;const n=typeof e.role=="string"?e.role.trim().toLowerCase():"";return n!==""&&n.split(/\s+/).some(r=>IP.has(r))}function mC(e){return e?Array.from(e.querySelectorAll("*")).filter(n=>{if(n.matches(Lx))return CP({disabled:n.disabled,tabIndex:n.tabIndex,rendered:n.getClientRects().length>0});const r=n.scrollHeight>n.clientHeight;return r&&RP({overflowing:r,overflow:getComputedStyle(n).overflowY,hasFocusable:n.querySelector(Lx)!=null})}):[]}function OP(e,n){const r=mC(e);if(!n||!e.contains(n)||r.includes(n))return r;const i=r.findIndex(o=>(n.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return i===-1?[...r,n]:[...r.slice(0,i),n,...r.slice(i)]}function xo(e,n={}){const{focusRef:r,layer:i}=n,o=j.useRef(null),l=j.useRef(e);l.current=e;const u=j.useRef(null);u.current===null&&(u.current=()=>l.current());const c=u.current;return j.useEffect(()=>bu.push(c,i),[c,i]),j.useEffect(()=>{var p;const h=document.activeElement;return(p=(r==null?void 0:r.current)??mC(o.current)[0])==null||p.focus(),()=>{NP(h,document.activeElement)&&h.focus()}},[]),j.useEffect(()=>{const h=p=>{var _;if(p.key!=="Tab"||hC(p))return;const d=o.current;if(!d)return;const m=document.activeElement;if(!(m!=null&&d.contains(m))&&!bu.isTop(c))return;const w=OP(d,m),N=jP({count:w.length,index:m?w.indexOf(m):-1,shiftKey:p.shiftKey});N.kind!=="allow"&&(p.preventDefault(),N.kind==="focus"&&((_=w[N.index])==null||_.focus()))};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[c]),o}function Mn(e){return e.toLocaleString()}function PP(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const LP=60;function qP(e,n=LP){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 $P({agent:e,onClose:n}){var m;const r=j.useRef(null),i=xo(n,{focusRef:r}),o=e.context,l=e.usage,u=(o==null?void 0:o.currentContextTokens)??0,c=fC(e.contextWindow,e.model),h=Math.min(100,u/c*100),p=fn(l,e.model),d=l.inputTokens+l.cacheReadTokens+l.cacheCreateTokens;return g.jsx("div",{className:"ctx-modal-backdrop",onClick:n,role:"presentation",children:g.jsxs("div",{ref:i,className:"ctx-modal",onClick:y=>y.stopPropagation(),role:"dialog","aria-modal":"true","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(h),children:g.jsx("div",{className:"ctx-window-fill",style:{width:`${h}%`}})}),g.jsxs("div",{className:"ctx-window-meta",children:[g.jsxs("span",{className:"ctx-window-pct",children:[h.toFixed(1),"%"]}),g.jsxs("span",{children:[Mn(u)," / ",Mn(c)," tok (current turn)"]})]})]}),g.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),g.jsxs("div",{className:"ctx-grid",children:[g.jsx(Xn,{label:"input tokens",val:Mn(l.inputTokens)}),g.jsx(Xn,{label:"output tokens",val:Mn(l.outputTokens)}),g.jsx(Xn,{label:"cache reads",val:Mn(l.cacheReadTokens)}),g.jsx(Xn,{label:"cache writes",val:Mn(l.cacheCreateTokens)}),g.jsx(Xn,{label:"cumulative total",val:Mn(d)}),g.jsx(Xn,{label:"estimated cost",val:ze(p.total),accent:!0})]}),g.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),g.jsxs("div",{className:"ctx-grid",children:[g.jsx(Xn,{label:"user messages",val:Mn((o==null?void 0:o.msgsUser)??0)}),g.jsx(Xn,{label:"assistant messages",val:Mn((o==null?void 0:o.msgsAssistant)??0)}),g.jsx(Xn,{label:"tool uses",val:Mn((o==null?void 0:o.toolUses)??0)}),g.jsx(Xn,{label:"tool results",val:Mn((o==null?void 0:o.toolResults)??0)}),g.jsx(Xn,{label:"system-reminders",val:Mn((o==null?void 0:o.systemReminders)??0)})]}),g.jsx("h3",{className:"ctx-section-title",children:"CLAUDE.md files in scope"}),(((m=o==null?void 0:o.claudeMdFiles)==null?void 0:m.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:o.claudeMdFiles.map(y=>g.jsxs("li",{children:[g.jsx("span",{className:"ctx-md-path",title:y.path,children:qP(y.path)}),g.jsx("span",{className:"ctx-md-size",children:PP(y.bytes)})]},y.path))})]})})}function Xn({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 DP({currentContextTokens:e,modelId:n,contextWindow:r,size:i=26,onClick:o,title:l}){const u=fC(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 FP(e,n){const r=Xv(n);if(!r)return"no rates for this model";const i=d=>d.toLocaleString(),o=d=>`$${d}/MTok`,l=fn(e,n),u=cC(e,r),c=u.tokens1h>0?[`cache w5m${i(u.tokens5m).padStart(14)} × ${o(r.cacheWrite).padEnd(11)} = ${ze(u.usd5m)}`,`cache w1h${i(u.tokens1h).padStart(14)} × ${o(r.cacheWrite1h??r.cacheWrite).padEnd(11)} = ${ze(u.usd1h)}`]:[`cache w ${i(u.tokens5m).padStart(14)} × ${o(r.cacheWrite).padEnd(11)} = ${ze(u.usd5m)}`],h=dC(e,n),p=h===e.inputTokens?"input":"uncached";return[`model: ${n}`,`${p.padEnd(9)}${i(h).padStart(14)} × ${o(r.input).padEnd(11)} = ${ze(l.input)}`,`output ${i(e.outputTokens).padStart(14)} × ${o(r.output).padEnd(11)} = ${ze(l.output)}`,`cache r ${i(e.cacheReadTokens).padStart(14)} × ${o(r.cacheRead).padEnd(11)} = ${ze(l.cacheRead)}`,...c,"─────────────────────────────────────────",`total = ${ze(l.total)}`].join(`
|
|
58
|
+
`)}function Sv(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 zP({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=Kv(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(vo,{type:"target",position:Ae.Left,style:{background:"transparent",border:"none"}}),g.jsxs("div",{className:"head",children:[g.jsxs("div",{className:"title",children:[g.jsx(BP,{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(DP,{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:Sv(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(HP,{waiting:e.waiting,now:r}),e.tools.length>0&&g.jsx(VP,{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:WP(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&Xv(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"?_u(p.total,d):null,y=FP(e.usage,e.model)+(m?`
|
|
59
|
+
burn: ${m}`:"");return g.jsxs("span",{className:"cost-meta",title:y,children:[g.jsx("b",{children:ze(p.total)}),m&&g.jsx("span",{className:"cost-rate",children:m})]})})()]}),g.jsx(vo,{type:"source",position:Ae.Right,style:{background:"transparent",border:"none"}})]})}function Zv(e){return e==="active"?"live":e==="done"?"done":"err"}function BP({state:e}){return g.jsx("span",{className:`state-pill state-${e}`,children:Zv(e)})}function Iu(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function UP(e){return e.kind==="permission"?Iu(e):"Your turn"}function HP({waiting:e,now:n}){const r=e.kind==="permission",i=Iu(e);return g.jsxs("div",{className:r?"waiting-row permission":"waiting-row idle",title:`${i}
|
|
60
|
+
Blocked for ${Sv(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:UP(e)}),g.jsx("b",{children:Sv(e.since,void 0,n)})]})}function WP(e){return e<1e3?`${e}`:e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(2)}M`}function VP({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,S=`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:S},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 qx(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function GP(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 YP({tool:e,onClose:n}){const r=xo(n),i=e.endedAt==null?"inflight":e.ok===!1?"err":"done";return g.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:g.jsxs("div",{ref:r,className:"modal",onClick:o=>o.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 ${i}`,"aria-hidden":!0}),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:GP(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:qx(e.input??e.inputPreview)})]}),g.jsxs("div",{className:"modal-section",children:[g.jsxs("h4",{children:["Response ",i==="err"&&g.jsx("span",{className:"err-tag",children:"error"})]}),g.jsx("pre",{children:e.endedAt==null?"(waiting…)":qx(e.response??e.errorPreview)})]})]})]})})}const Jl=18,$x=26,KP=12;function XP(e){return QP(e.nodeInternals.values())}function QP(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=Dx(l)??d.label)):n.set(l.sessionId,{minX:u,minY:c,maxX:h,maxY:p,label:Dx(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} · ${ZP(o)}`:l.label;i.push({sessionId:o,label:c,x:l.minX-Jl,y:l.minY-Jl-$x,w:l.maxX-l.minX+Jl*2,h:l.maxY-l.minY+Jl*2+$x})}return i}function ZP(e){const n=e.match(/[a-zA-Z0-9]{4}/);return n?n[0]:e.slice(0,4)}function Dx(e){if(e.kind==="root")return e.label}function JP(){const{x:e,y:n,zoom:r}=eC(),i=La(),o=Qe(XP,e3);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=Kv(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-KP)*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 e3(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 t3({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 gC=600,n3=4,r3=36,kv=16,s3=60,i3=6,Fx=220,zx=96,o3=28,a3={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 l3(e){return e.startsWith("mcp__")?"mcp":a3[e]??"other"}const u3={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 Bx(e){return e.startsWith("mcp__")?"🔌":u3[e]??"✨"}const c3={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 vC(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 vC(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 d3(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 f3=new Set(["Bash","PowerShell","shell","exec_command","shell_command","write_stdin","wait"]),h3=new Set(["shell","exec_command","shell_command","write_stdin","wait","apply_patch","update_plan"]);function p3(e,n){return h3.has(e)||e.startsWith("mcp__")?Math.max(zx,34+n.length*7.5):zx}function m3(e,n){if(!f3.has(e))return null;const r=d3(n);if(!r)return null;const i=vC(r);return i?{emoji:c3[i]??"⚙️",label:i,category:"shell",detail:r}:null}const g3=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),Ux={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:"🗄️"},Hx={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 v3(e){const r=e.replace(/\\/g,"/").replace(/\/+$/,""),i=r.lastIndexOf("/");return i>=0?r.slice(i+1):r}function y3(e){const n=e.toLowerCase();if(Hx[n])return Hx[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(Ux[i])return Ux[i]}return"📄"}function w3(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 x3(e,n){if(!g3.has(e))return null;const r=w3(e,n);if(!r)return null;const i=v3(r);return i?{emoji:e==="LS"?"📂":y3(i),label:i,category:"file",detail:r}:null}const yC={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 wC(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 _3(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 b3(e,n){const r=wC(e);if(!r)return null;const{server:i,method:o}=r;if(!o)return null;const l=yC[i.toLowerCase()];return{emoji:(l==null?void 0:l.emoji)??"🔌",label:o,category:"mcp",detail:l?`${l.name} · ${o}`:`${i} · ${o}`}}function S3(e,n){return m3(e,n)??x3(e,n)??b3(e)}const k3={shell:"Shell",exec_command:"Shell",shell_command:"Shell",write_stdin:"stdin",wait:"wait",apply_patch:"Edit",update_plan:"Plan"};function E3(e){const n=wC(e);if(n){const i=yC[n.server.toLowerCase()];return i?{emoji:i.emoji,label:i.name}:{emoji:"🔌",label:n.server,hue:_3(n.server)}}const r=k3[e];return r?{emoji:Bx(e),label:r}:{emoji:Bx(e),label:e}}function N3(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function C3(e,n,r){if(r==null)return 1;const i=n-r;return i<0?1:Math.max(0,1-i/gC)}function R3(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 j3(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>gC)continue;const h=i.get(c.id)??r.get(c.id);if(!h)continue;const p=R3(c.tools,n3);if(p.length===0)continue;const d=c.exitAt??null,m=o.get(c.id),y=Math.max((m==null?void 0:m.width)??Fx,Fx),w=(m==null?void 0:m.height)??130,N=h.x,_=h.y,b=N+y,S=_+w/2;p.forEach((k,E)=>{const C=E*r3,I=N+y+s3,P=_+i3+C,A=C3(k,l,d),U=k.inputPreview??"",L=N3(k),O=A<.999,q=E3(k.name);u.push({id:`${c.id}::${k.id}`,toolId:k.id,agentId:c.id,toolName:k.name,name:q.label,emoji:q.emoji,status:L,category:l3(k.name),mcpHue:q.hue,inputPreview:U,fade:A,fading:O,worldX:I,worldY:P,anchorX:b,anchorY:S,spawnDx:b-I,spawnDy:S-(P+kv)});const G=S3(k.name,k.input);if(G){const F=p3(k.name,q.label),T=I+F+o3,B=P,z=I+F,ne=P+kv;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:L,category:G.category,inputPreview:G.detail??U,fade:A,fading:O,worldX:T,worldY:B,anchorX:z,anchorY:ne,spawnDx:z-T,spawnDy:0})}})}return u}function T3({agents:e,visibleAgentIds:n,positions:r,pinned:i,measured:o,dimUnmatched:l,spotlight:u,hiddenCategories:c,now:h,onOpenTool:p}){const d=j3(e,n,r,i,o,h),m=c&&c.size>0?d.filter(y=>!c.has(y.category)):d;return g.jsx(A3,{bursts:m,dimUnmatched:l,spotlight:u,onOpenTool:p})}function A3({bursts:e,dimUnmatched:n,spotlight:r,onOpenTool:i}){const{x:o,y:l,zoom:u}=eC();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+kv)*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),b=r!=null&&!r.has(c.agentId),S=_||b?" 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":""}${S}`,style:N,title:y,onClick:w?()=>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 I3({state:e,sessionId:n,onClose:r}){const i=j.useMemo(()=>O3(e,n),[e,n]),o=j.useRef(null),l=xo(r,{focusRef:o});return i?g.jsx("div",{className:"modal-backdrop",onClick:r,role:"presentation",children:g.jsxs("div",{ref:l,className:"modal session-summary",onClick:u=>u.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:ze(i.cost.total)}),i.modelChips.length>0&&g.jsx("div",{className:"ss-models",children:i.modelChips.map(u=>g.jsx("span",{className:"model-chip",title:u,children:li(u)},u))})]}),g.jsx("div",{className:"ss-hero-right",children:i.cost.total>0&&g.jsxs(g.Fragment,{children:[g.jsx(M3,{cost:i.cost}),g.jsxs("div",{className:"ss-cost-legend",children:[g.jsxs("span",{className:"ssl ssl-in",children:["input ",g.jsx("b",{children:ze(i.cost.input)})]}),g.jsxs("span",{className:"ssl ssl-out",children:["output ",g.jsx("b",{children:ze(i.cost.output)})]}),g.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",g.jsx("b",{children:ze(i.cost.cacheRead)})]}),g.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",g.jsx("b",{children:ze(i.cost.cacheWrite)})]})]})]})})]}),g.jsxs("section",{className:"ss-stats",children:[g.jsx(so,{label:"agents",value:i.agentCount}),g.jsx(so,{label:"subagents",value:i.subagentCount}),g.jsx(so,{label:"tool calls",value:i.toolCount}),g.jsx(so,{label:"prompts",value:i.promptCount}),g.jsx(so,{label:"tokens",value:i.tokensSum.toLocaleString()}),i.errCount>0&&g.jsx(so,{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(([u,c])=>g.jsxs("div",{className:"ss-tt",children:[g.jsx("span",{className:"ss-tt-name",children:u}),g.jsx("span",{className:"ss-tt-bar",children:g.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${c/i.topTools[0][1]*100}%`}})}),g.jsx("span",{className:"ss-tt-count",children:c})]},u))})]}),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 so({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 M3({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}: ${ze(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 O3(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 I of E.tools)u.set(I.name,(u.get(I.name)??0)+1),I.ok===!1&&d++}const _=Math.max(0,N-w),b=Math.floor(_/1e3),S=b<60?`${b}s`:b<3600?`${Math.floor(b/60)}m ${String(b%60).padStart(2,"0")}s`:`${Math.floor(b/3600)}h ${Math.floor(b%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:S,cost:o,modelChips:Array.from(l),agentCount:i.length,subagentCount:m,toolCount:c,promptCount:h,tokensSum:p,errCount:d,topTools:k,firstPrompt:y}}function Jv(e){return(e==null?void 0:e.kind)==="permission"}function P3(e){const n=[];for(const r of e)r.kind==="root"&&Jv(r.waiting)&&n.push({id:r.id,label:r.label,waiting:r.waiting});return n.sort((r,i)=>r.waiting.since-i.waiting.since)}function L3(e){const n=new Set;for(const r of e)r.state==="active"&&n.add(r.sessionId);return n.size}function Wx(e){return e.waiting?Jv(e.waiting)?0:1:e.state==="active"?2:3}function q3(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=Wx(i),u=Wx(o);return l!==u?l-u:i.waiting&&o.waiting?i.waiting.since-o.waiting.since:o.lastActivity-i.lastActivity}),r}function Vx(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=j.useMemo(()=>q3(e),[e,e.lastSeq,n]),u=l.filter(h=>h.state==="active").length,c=l.filter(h=>Jv(h.waiting)).length;return g.jsxs("aside",{className:"session-list",id:"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.jsx("span",{className:"vis-hidden",children:Zv(h.state)}),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:ze(h.cost)})}),h.waiting?g.jsxs("span",{className:"sl-waiting",title:`${Iu(h.waiting)}
|
|
61
|
+
Blocked since ${new Date(h.waiting.since).toLocaleTimeString()} · started ${new Date(h.startedAt).toLocaleString()}`,children:["waiting ",Vx(h.waiting.since,void 0,n)]}):g.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(h.startedAt).toLocaleString()}`,children:Vx(h.startedAt,h.state==="active"?void 0:h.lastActivity,n)})]})]})]},h.sessionId)})]})]})}const tn="ccdeck";function Dt(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 Gx(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 D3(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 F3({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}: ${ze(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 z3(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 B3(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?z3(i,u):null,w=i&&o?B3(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 U3=6e4;function H3(){const[e,n]=j.useState(null),[r,i]=j.useState(!1),o=j.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 j.useEffect(()=>(l(!0),o.current=window.setInterval(()=>l(!1),U3),()=>{o.current!=null&&window.clearInterval(o.current)}),[]),{quota:e,loading:r,refresh:()=>l(!0)}}function W3(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.";case"untrusted_base_url":return"chatgpt_base_url in ~/.codex/config.toml is not an https OpenAI host, so the token was not sent.";default:return"ChatGPT API unreachable — click ↻ to retry."}}const xC=6e4;function V3(){const[e,n]=j.useState(null),[r,i]=j.useState(!1),o=j.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 j.useEffect(()=>(l(!0),o.current=window.setInterval(()=>l(!1),xC),()=>{o.current!=null&&window.clearInterval(o.current)}),[]),{data:e,loading:r,refresh:()=>l(!0)}}function G3(){const[e,n]=j.useState(null),r=j.useRef(null),i=async()=>{try{const o=await fetch("/api/codex-usage");o.ok&&n(await o.json())}catch{}};return j.useEffect(()=>(i(),r.current=window.setInterval(i,xC),()=>{r.current!=null&&window.clearInterval(r.current)}),[]),{data:e}}function Y3({state:e,now:n,onClose:r}){var A,U;const{quota:i,loading:o,refresh:l}=H3(),{data:u,loading:c,refresh:h}=V3(),{data:p}=G3(),[d,m]=j.useState(()=>Math.floor(Date.now()/1e3));j.useEffect(()=>{const L=window.setInterval(()=>m(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(L)},[]);const{byModel:y,totalCost:w,totalTokens:N,burnRate:_}=j.useMemo(()=>{const L=new Map,O={total:0,input:0,output:0,cacheRead:0,cacheWrite:0};let q=0,G=0,F=0,T=0;for(const $ of e.agents.values()){const Q=$.model??"__unknown__",M=fn($.usage,$.model),V=L.get(Q);V?(V.inputTokens+=$.usage.inputTokens,V.outputTokens+=$.usage.outputTokens,V.cacheReadTokens+=$.usage.cacheReadTokens,V.cacheCreateTokens+=$.usage.cacheCreateTokens,V.cost.total+=M.total,V.cost.input+=M.input,V.cost.output+=M.output,V.cost.cacheRead+=M.cacheRead,V.cost.cacheWrite+=M.cacheWrite,V.agentCount++):L.set(Q,{model:Q,inputTokens:$.usage.inputTokens,outputTokens:$.usage.outputTokens,cacheReadTokens:$.usage.cacheReadTokens,cacheCreateTokens:$.usage.cacheCreateTokens,cost:{...M},agentCount:1}),O.total+=M.total,O.input+=M.input,O.output+=M.output,O.cacheRead+=M.cacheRead,O.cacheWrite+=M.cacheWrite,q+=$.usage.inputTokens,G+=$.usage.outputTokens,F+=$.usage.cacheReadTokens,T+=$.usage.cacheCreateTokens}const B=Array.from(L.values()).sort(($,Q)=>Q.cost.total-$.cost.total);let z=0,ne=0;for(const $ of e.agents.values()){if($.state!=="active")continue;const Q=fn($.usage,$.model);z+=Q.total,ne=Math.max(ne,(($.endedAt??n)-$.startedAt)/1e3)}const Z=ne>0?_u(z,ne):null;return{byModel:B,totalCost:O,totalTokens:{in:q,out:G,cacheR:F,cacheC:T},burnRate:Z}},[e,e.lastSeq,n]),b=j.useMemo(()=>{const L=[];for(const O of e.agents.values()){if(O.kind!=="root")continue;let q=fn(O.usage,O.model).total,G=O.usage.inputTokens,F=O.usage.outputTokens;for(const T of e.agents.values())T.sessionId!==O.sessionId||T.kind==="root"||(q+=fn(T.usage,T.model).total,G+=T.usage.inputTokens,F+=T.usage.outputTokens);L.push({sessionId:O.sessionId,label:O.label||O.cwdBasename||"session",state:O.state,cost:q,inputTokens:G,outputTokens:F})}return L.sort((O,q)=>q.cost-O.cost).slice(0,12)},[e,e.lastSeq]),S=w.total>0,k=N.in+N.out,E=o||c,C=Gx(i==null?void 0:i.fetchedAt,d),I=Gx(u==null?void 0:u.fetchedAt,d),P=()=>{l(),h()};return g.jsxs("div",{className:"usage-panel",id:"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:P,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:D3(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}),I&&!c&&g.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:I})]}),u!=null&&u.ok?g.jsxs("div",{className:"up-quota-bars",children:[(A=u.windows)==null?void 0:A.map(L=>g.jsx(ei,{label:L.label,pct:L.pct,reset:L.reset??void 0,resetAt:L.resetAt??void 0,windowSec:L.windowSec??void 0,limitReached:u.limitReached&&L.pct>=100,nowSec:d},L.id)),(U=u.extraWindows)==null?void 0:U.map(L=>g.jsx(ei,{label:L.label,pct:L.pct,reset:L.reset??void 0,resetAt:L.resetAt??void 0,windowSec:L.windowSec??void 0,nowSec:d},L.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:[Dt(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 — ${tn} 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:W3(u.reason)})]}):g.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),S?g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"up-total",children:[g.jsx("span",{className:"up-total-value",children:ze(w.total)}),g.jsx("span",{className:"up-total-label",children:"total spend"})]}),g.jsx(F3,{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"}),Dt(N.in)]}),g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"out"}),Dt(N.out)]}),N.cacheR>0&&g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"cache r"}),Dt(N.cacheR)]}),N.cacheC>0&&g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"cache c"}),Dt(N.cacheC)]})]}),y.filter(L=>L.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(L=>L.cost.total>0).map(L=>g.jsxs("tr",{children:[g.jsx("td",{className:"up-model-name",title:L.model,children:li(L.model)}),g.jsx("td",{className:"up-num",children:Dt(L.inputTokens+L.outputTokens)}),g.jsx("td",{className:"up-num up-cost-val",children:ze(L.cost.total)})]},L.model))})]})]}),b.filter(L=>L.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:b.filter(L=>L.cost>0).map(L=>g.jsxs("div",{className:"up-session-row",children:[g.jsx("span",{className:`sl-dot state-${L.state}`,"aria-hidden":!0}),g.jsx("span",{className:"vis-hidden",children:Zv(L.state)}),g.jsx("span",{className:"up-session-label",children:L.label}),g.jsx("span",{className:"up-session-tokens",children:Dt(L.inputTokens+L.outputTokens)}),g.jsx("span",{className:"up-session-cost",children:ze(L.cost)})]},L.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"}),Dt(N.in)]}),g.jsxs("span",{className:"up-tok",children:[g.jsx("span",{className:"up-k",children:"out"}),Dt(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 Yx=18,K3=1100,io=(e,n)=>{const r=Math.sin(e*12.9898+n*78.233)*43758.5453;return r-Math.floor(r)},X3=Array.from({length:Yx},(e,n)=>{const r=-72+144*n/(Yx-1)+(io(n,1)-.5)*9,i=(r-90)*(Math.PI/180),o=(54+32*Math.cos(r*Math.PI/180))*(.74+io(n,2)*.52);return{dx:Math.cos(i)*o,dy:Math.sin(i)*o,rot:(n%2?1:-1)*(100+io(n,3)*260),delay:Math.round(io(n,4)*90),dur:760+Math.round(io(n,5)*260),scale:.8+io(n,6)*.45,hue:n%4,round:n%3===0}});function Kx({anchor:e,lifetimeMs:n=K3}){var l;const[r,i]=j.useState(null),o=typeof window<"u"&&((l=window.matchMedia)==null?void 0:l.call(window,"(prefers-reduced-motion: reduce)").matches);return j.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:qI.createPortal(g.jsx("div",{className:"confetti",style:{left:`${r.x}px`,top:`${r.y}px`},"aria-hidden":!0,children:X3.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 _C=new Set(["awaiting_url","awaiting_code","registering"]);function Q3(e){return e!=null&&_C.has(e)}function bC(e){return e!=null&&e!=="done"&&!_C.has(e)}const Z3="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",J3="the sign-in did not complete";function eL({state:e,serverError:n,localError:r}){const i=e==="idle";return{title:i?"Sign-in ended":"Sign-in failed",message:r||n||(i?Z3:J3)}}const tL="done";function nL(){let e=!1;return{shouldAnnounce(n){return n!==tL?(e=!1,!1):e?!1:(e=!0,!0)}}}const Xx={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 ${tn}`,expired:"that share has expired — make a new one",import_failed:"claude-swap refused the import",bad_value:"an alias can only use letters, numbers, spaces, dots, dashes and underscores, up to 64 characters"},Qx={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"},rL=`claude-swap could not read the login keychain — start ${tn} from a Terminal window rather than a background service`;function Ev(e,n){return(e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(yo(e))?rL:e!=null&&e.reason&&Qx[e.reason]?Qx[e.reason]:(e==null?void 0:e.reason)||n}function yo(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const Zx={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"},sL="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 iL(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}function oL(e,n){return iL(yo(e))?sL:e!=null&&e.reason&&Zx[e.reason]?Zx[e.reason]:(e==null?void 0:e.reason)||n}function cu(e,n){return e!=null&&e.detail?e.detail:e!=null&&e.error&&bC(e.state)?e.error:e!=null&&e.reason&&Xx[e.reason]?Xx[e.reason]:e!=null&&e.error?e.error:(e==null?void 0:e.reason)||n}const aL=1500;async function eu(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const Nv=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"})]}));Nv.displayName="SuccessMark";function lL({onClose:e,onChanged:n}){const[r,i]=j.useState("login"),[o,l]=j.useState(null),[u,c]=j.useState(""),[h,p]=j.useState(""),[d,m]=j.useState(!1),[y,w]=j.useState(null),[N,_]=j.useState(null),b=j.useRef(!1),S=j.useRef(null),k=j.useRef(null),E=j.useRef(null),C=j.useRef(null),I=j.useCallback(()=>{b.current&&eu({action:"login-cancel"}).catch(()=>{}),e()},[e]),P=xo(I,{focusRef:E}),A=j.useCallback(async()=>{m(!0),w(null),b.current=!0;const B=await eu({action:"login"}).catch(()=>null);if(m(!1),!(B!=null&&B.ok)){w(cu(B,"could not start the sign-in"));return}l(B)},[]);j.useEffect(()=>{if(!Q3(o==null?void 0:o.state))return;const B=window.setInterval(async()=>{try{const z=await fetch("/api/claude-accounts/login");z.ok&&l(await z.json())}catch{}},aL);return()=>window.clearInterval(B)},[o]);const U=j.useRef(n);U.current=n;const L=j.useRef(nL());j.useEffect(()=>{var B;(o==null?void 0:o.state)==="awaiting_code"&&((B=S.current)==null||B.focus()),L.current.shouldAnnounce(o==null?void 0:o.state)&&U.current()},[o==null?void 0:o.state]),j.useEffect(()=>{var B;r==="paste"&&((B=k.current)==null||B.focus())},[r]);const O=j.useCallback(async()=>{var z;m(!0),w(null);const B=await eu({action:"login-code",code:u}).catch(()=>null);if(m(!1),!(B!=null&&B.ok)){w(cu(B,"the code was not accepted")),B!=null&&B.state&&l(B),(z=S.current)==null||z.select();return}c(""),l(B)},[u,o]),q=j.useCallback(async()=>{m(!0),w(null);const B=await eu({action:"import",blob:h}).catch(()=>null);if(m(!1),!(B!=null&&B.ok)){w(cu(B,"the import failed"));return}p(""),_({added:B.added===!0,num:B.num??null,email:B.email??null}),n()},[h,n]),G=(o==null?void 0:o.state)==="done"?o.account:null,F=bC(o==null?void 0:o.state)||!!(y&&b.current&&!d),T=eL({state:o==null?void 0:o.state,serverError:o==null?void 0:o.error,localError:y});return g.jsx("div",{className:"modal-backdrop",onClick:I,role:"presentation",children:g.jsxs("div",{ref:P,className:"modal aa-modal",onClick:B=>B.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:I,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),g.jsx("section",{className:"modal-body aa-body",children:r==="login"?G?g.jsxs("div",{className:"aa-done",children:[g.jsx(Nv,{ref:C}),g.jsx(Kx,{anchor:C}),g.jsx("h4",{children:G.added?`Account ${G.num} added`:"Credentials refreshed"}),g.jsxs("p",{className:"aa-note",children:[g.jsx("strong",{children:G.email}),G.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:S,type:"text",value:u,onChange:B=>c(B.target.value),onKeyDown:B=>{B.key==="Enter"&&u.trim()&&!d&&O()},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:O,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:T.title}),g.jsx("p",{className:"aa-err",children:T.message}),g.jsx("button",{type:"button",className:"btn",onClick:()=>{b.current=!1,l(null),w(null),A()},children:"Try again"})]}):d||b.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",ref:E,className:"btn primary",onClick:A,disabled:d,children:"Open the sign-in page"})})]}):N?g.jsxs("div",{className:"aa-done",children:[g.jsx(Nv,{ref:C}),N.added&&g.jsx(Kx,{anchor:C}),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:B=>p(B.target.value),onKeyDown:B=>{B.key==="Enter"&&h.trim()&&!d&&q()},placeholder:"ccdeck1:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),g.jsx("button",{type:"button",className:"btn primary",disabled:d||!h.trim(),onClick:q,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 uL(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 cL(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 dL(e,n){const r=e.trim();return{alias:r,commit:r!==(n??"").trim()}}const fL=Object.freeze({text:"couldn't reach the deck server",reload:!0});async function Jx(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function hL(e){const n=e.find(i=>!i.ok);if(!n)return null;const r=yo(n.body);return{text:Ev(n.body,`the deck server answered ${n.status}`),...r?{raw:r}:{},reload:!0}}function e_(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 t_=15e3,pL=8e3,mL=1800,gL=3e4,vL=[70,80,85,90,95];function yL(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 n_(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 wL(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 xL(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 _L({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?yL(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 bL(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 SL(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 kL({onClose:e}){var re,le,fe;const[n,r]=j.useState(null),[i,o]=j.useState(null),[l,u]=j.useState(null),[c,h]=j.useState(!1),[p,d]=j.useState(null),[m,y]=j.useState(null),[w,N]=j.useState(()=>Math.floor(Date.now()/1e3)),_=j.useRef(null),[b,S]=j.useState(null),[k,E]=j.useState(!1),[C,I]=j.useState(""),[P,A]=j.useState(null),[U,L]=j.useState(null),[O,q]=j.useState(null),[G,F]=j.useState(!1),[T,B]=j.useState(null),z=j.useCallback(async(te=!1)=>{te&&h(!0);const ce=new AbortController,Ce=window.setTimeout(()=>ce.abort(),gL);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=hL([await Jx(ve),await Jx(Te)]);y(ke=>e_(ke,ye))}catch{y(ve=>e_(ve,fL))}finally{window.clearTimeout(Ce),te&&h(!1)}},[]),ne=j.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:Ev(ve,"command failed"),raw:yo(ve)}),ve}catch{return y({text:"server unreachable"}),null}finally{u(null)}},[]),Z=j.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:cu(ve,"command failed")}),ve}catch{return y({text:"server unreachable"}),null}finally{u(null)}},[]);j.useEffect(()=>(z(!0),_.current=window.setInterval(()=>z(!1),t_),()=>{_.current!=null&&window.clearInterval(_.current)}),[z]),j.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",Q=(le=n==null?void 0:n.accounts)==null?void 0:le.find(te=>te.active),M=Q!=null&&Q.lanes.length?Math.max(...Q.lanes.map(te=>te.pct)):null,V=M!=null&&M>=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:Ev(Ce,"the switch failed"),raw:yo(Ce)}),await z(!0)}catch{y({text:"server unreachable"})}finally{d(null)}},H=async(te,ce)=>{const{commit:Ce,alias:ve}=dL(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;I(ve)}A(te),window.setTimeout(()=>A(Te=>Te===te?null:Te),mL)},J=async(te,ce)=>{const Ce=await Z({action:"move",account:te,slot:ce},`move-${te}`),ve=cL({menuFor:b,shareFor:(O==null?void 0:O.num)??null},te,Ce);if(await z(!0),ve){S(ve.menuFor),L(ve.confirmRemove),ve.shareFor==null&&(q(null),F(!1)),B(ve.swapNote);const Te=ve.swapNote;Te&&window.setTimeout(()=>B(ye=>ye===Te?null:ye),pL)}};return g.jsxs("div",{className:"accounts-panel",id:"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 ",t_/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${b===te.num?" on":""}`,"aria-label":`Manage account ${te.num}`,"aria-expanded":b===te.num,"aria-controls":b===te.num?`ap-manage-${te.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{S(b===te.num?null:te.num),I(te.alias??""),L(null),q(null),F(!1),B(null),A(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(_L,{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=xL(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 ",n_(te.fetchedAt,w),wL(te.nextAt,w)]}):g.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),b===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:"vis-hidden",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=>I(ce.target.value),onKeyDown:ce=>{ce.key==="Enter"&&H(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:()=>H(te.num,te.alias),title:"A short name to show instead of the email",children:P===te.num?"saved":"save"})]}),g.jsxs("div",{className:"ap-manage-acts",children:[g.jsx("label",{className:"vis-hidden",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:uL((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 ${tn}. Anyone who has the text can use the account — treat it as the password. The other deck stops accepting it after 10 minutes; that does not make an escaped copy safe.`,onClick:async()=>{F(!1);const ce=await Z({action:"share",account:te.num},`share-${te.num}`);ce!=null&&ce.ok&&q({num:te.num,blob:ce.blob,expiresAt:ce.expiresAt})},children:"share"}),g.jsx("button",{type:"button",className:`ap-manage-btn danger${U===te.num?" armed":""}`,disabled:l!=null,title:U===te.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(U!==te.num){L(te.num),window.setTimeout(()=>L(ce=>ce===te.num?null:ce),4e3);return}L(null),Z({action:"remove",account:te.num},`rm-${te.num}`).then(()=>{S(null),z(!0)})},children:U===te.num?"confirm":"remove"})]}),(T==null?void 0:T.at)===te.num&&(()=>{var ve;const ce=(ve=n.accounts)==null?void 0:ve.find(Te=>Te.num===T.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 ${T.at} was taken, so the two accounts traded places: ${Ce} now holds slot ${T.displaced}.`,children:["swapped with slot ",T.displaced]})})(),(O==null?void 0:O.num)===te.num&&(()=>{const ce=SL(O.expiresAt,w),Ce=ce.tone==="gone";return g.jsxs("div",{className:`ap-share${Ce?" expired":""}`,children:[g.jsx("code",{className:"ap-share-blob",children:O.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){F(!1);const ve=await Z({action:"share",account:te.num},`share-${te.num}`);ve!=null&&ve.ok&&q({num:te.num,blob:ve.blob,expiresAt:ve.expiresAt});return}await bL(O.blob)&&(F(!0),window.setTimeout(()=>F(!1),1800))},children:Ce?"make a new share":G?"copied":"copy"}),g.jsxs("span",{className:"ap-manage-hint",title:"This text is the account's password. It is base64 of plain JSON — the expiry inside it is not signed, so anyone holding a copy can change it, and the login itself is in there in the clear either way. The countdown only says how long another deck's import dialog will still accept it. If a copy escapes, sign the account out and back in.",children:[g.jsx("span",{className:"ap-share-warn",children:"this is the password"})," · ",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:[M!=null&&g.jsxs("span",{className:`ap-auto-now${V?" near":""}`,children:[Math.round(M),"%"]}),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:vL.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 ",n_(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(lL,{onClose:()=>E(!1),onChanged:()=>z(!0)})]})}const EL=3e4;function NL({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?NL({bundle:e,running:n,lastTried:i})?"reload":r==null||r&&r!==n?"wait":"confirm":"wait"}function RL(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function jL({asked:e,reported:n}){return n?n!==e:!1}function TL(e){const n=e.thresholdMs??EL;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 AL({agentCount:e,onConfirm:n,onCancel:r}){const i=j.useRef(null),o=xo(r,{focusRef:i,layer:SP}),l=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",{ref:o,className:"modal clear-confirm",onClick:u=>u.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:[l," — 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 IL(e,n){return e==="confirmation"?n.confirmOpen?"clear":"ignore":n.modalOpen||n.confirmOpen?"ignore":"confirm"}function ML(e){return e.slice().sort((n,r)=>n.y-r.y||n.x-r.x)}function OL(e,n,r){var u;if(e.length===0)return null;const i=ML(e),o=n?i.findIndex(c=>c.id===n):-1,l=o===-1?r===1?0:i.length-1:(o+r+i.length)%i.length;return((u=i[l])==null?void 0:u.id)??null}const PL=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function LL(e,n){return n==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:n,additive:e.shiftKey}:PL.has(e.key)?{kind:"node",nodeId:n}:{kind:"deck",nodeId:n}}const qL=new Set(["","BODY","HTML","#DOCUMENT"]);function $L(e){return!e||Qv(e)?!1:!qL.has(String(e.tagName??"").toUpperCase())}function tu(e,n){if(n.size!==0)for(const r of Array.from(e.keys()))n.has(r)||e.delete(r)}function DL(e){const n=new Set;for(const r of e)n.add(r.id),n.add(`group:${r.sessionId}`);return n}function SC(e,n,r){return!n.has(e)||r.has(e)}function FL(e,n,r,i){return!n.has(e)&&SC(e,r,i)}function zL(e,n,r){const i={x:0,y:0};return n.set(e,i),r.add(e),i}function BL(e,n,r,i){r.set(e,n),i.delete(e)}const UL=40,HL=120;function WL(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=UL){const p=n.now(),d=Math.max(o+h,p);if(d<=p){u(),l();return}c(d,p,h)},replay(h=HL){u(),i=n.now()+h,r=n.setTimeout(l,h)},flush(){u(),l()},cancel(){u()}}}function VL(){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 GL="1",r_="agent-dag.schema",YL=["agent-dag.layout","agent-dag.viewport"];function kC(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function KL(e,n=GL){let r=null;try{r=e.getItem(r_)}catch{return[]}if(r===n)return[];const i=[];if(r!==null)for(const o of YL)try{e.getItem(o)!==null&&(e.removeItem(o),i.push(o))}catch{}try{e.setItem(r_,n)}catch{}return i}const EC="agent-dag.theme";function XL(e){return e==="light"?"light":"dark"}function QL(){return XL(kC(EC))}function ZL({waiting:e,running:n}){return{title:e>0?`(${e}) ${tn}`:tn,icon:e>0?"waiting":n>0?"running":"idle"}}const Dd={waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function Fd(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 JL=Object.freeze({waiting:`data:image/svg+xml,${encodeURIComponent(Fd(Dd.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(Fd(Dd.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(Fd(Dd.idle,"idle"))}`}),eq="No sessions are waiting for you.";function tq(e){if(e.length===0)return"";const[n,...r]=e;if(r.length===0)return`${n.label} is waiting for your permission.`;const i=`${r.length} more session${r.length===1?"":"s"}`;return`${n.label} and ${i} are waiting for your permission.`}function nq(e,n){return n!==""?n:e===""?"":eq}function rq(){let e=0;return{begin(){const n=++e;return()=>n===e},cancel(){e++}}}function sq(e,n=new Date){return new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}function iq(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 nu(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 oq=[7,14,30,90];function aq(e){const[n,r]=j.useState(null),[i,o]=j.useState(!1),l=j.useRef(rq()).current,u=(c=!1)=>{const h=l.begin(),p=e;o(!0);const m=`/api/ccusage?since=${sq(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 j.useEffect(()=>(u(!1),()=>l.cancel()),[e]),{landed:n,loading:i,reload:()=>u(!0)}}function lq({onClose:e}){var C,I,P;const[n,r]=j.useState(30),[i,o]=j.useState(null),{landed:l,loading:u,reload:c}=aq(n),h=j.useRef(null),p=xo(e,{focusRef:h}),d=iq({loading:u,want:n,answer:l&&{range:l.range,ok:l.resp.ok===!0,days:((C=l.resp.days)==null?void 0:C.length)??0}}),m=d.phase==="chart"?l.resp.days??[]:[],y=j.useMemo(()=>m.reduce((A,U)=>Math.max(A,U.totalCost),0),[m]),{totalCost:w,totalTok:N,inOut:_,cacheRead:b,modelCosts:S}=j.useMemo(()=>{let A=0,U=0,L=0,O=0;const q=new Map;for(const G of m){A+=G.totalCost,U+=G.totalTokens,L+=G.inputTokens+G.outputTokens,O+=G.cacheReadTokens;for(const F of G.modelBreakdowns)q.set(F.modelName,(q.get(F.modelName)??0)+F.cost)}return{totalCost:A,totalTok:U,inOut:L,cacheRead:O,modelCosts:q}},[m]),k=j.useMemo(()=>Array.from(S.entries()).sort((A,U)=>U[1]-A[1]),[S]),E=i?m.find(A=>A.period===i)??null:null;return g.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:g.jsxs("div",{ref:p,className:"uh-modal",onClick:A=>A.stopPropagation(),role:"dialog","aria-modal":"true","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:oq.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",{ref:h,className:"uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),d.phase==="busy"?g.jsx("div",{className:"uh-status","aria-busy":"true",children:l?"running ccusage…":"running ccusage… (first run downloads the package)"}):d.phase==="error"?g.jsxs("div",{className:"uh-status uh-err",title:yo(l.resp)||void 0,children:[oL(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"})})]}):d.phase==="empty"?g.jsx("div",{className:`uh-status${d.stale?" uh-stale":""}`,"aria-busy":d.stale||void 0,children:"no usage in this range"}):g.jsxs("div",{className:d.stale?"uh-stale":void 0,"aria-busy":d.stale||void 0,children:[g.jsxs("div",{className:"uh-totals",children:[g.jsx(ru,{label:"total cost",val:ze(w),accent:!0}),g.jsx(ru,{label:"tokens",val:Dt(N)}),g.jsx(ru,{label:"input+output",val:Dt(_)}),g.jsx(ru,{label:"cache reads",val:Dt(b)})]}),g.jsx("div",{className:"uh-chart",role:"img","aria-label":"Daily cost by model",children:m.map(A=>{const U=y>0?A.totalCost/y*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} · ${ze(A.totalCost)}`,style:{flexBasis:`${100/m.length}%`},children:[g.jsx("div",{className:"uh-bar",style:{height:`${Math.max(U,A.totalCost>0?2:0)}%`},children:A.modelBreakdowns.slice().sort((O,q)=>q.cost-O.cost).map(O=>{const q=A.totalCost>0?O.cost/A.totalCost*100:0;return g.jsx("div",{className:"uh-bar-seg",style:{height:`${q}%`,background:nu(O.modelName)}},O.modelName)})}),g.jsx("span",{className:"uh-bar-label",children:A.period.slice(5)})]},A.period)})}),g.jsx("div",{className:"uh-legend",children:k.map(([A,U])=>g.jsxs("span",{className:"uh-legend-item",children:[g.jsx("span",{className:"uh-legend-dot",style:{background:nu(A)}}),li(A)," ",g.jsx("span",{className:"uh-legend-cost",children:ze(U)})]},A))}),E&&g.jsxs("div",{className:"uh-detail",children:[g.jsxs("div",{className:"uh-detail-head",children:[g.jsx("span",{className:"uh-detail-date",children:E.period}),g.jsx("span",{className:"uh-detail-cost",children:ze(E.totalCost)}),(P=(I=E.metadata)==null?void 0:I.agents)!=null&&P.length?g.jsx("span",{className:"uh-detail-agents",children:E.metadata.agents.join(" · ")}):null]}),g.jsxs("div",{className:"uh-detail-mini",children:[g.jsx(su,{label:"input",val:Dt(E.inputTokens)}),g.jsx(su,{label:"output",val:Dt(E.outputTokens)}),g.jsx(su,{label:"cache write",val:Dt(E.cacheCreationTokens)}),g.jsx(su,{label:"cache read",val:Dt(E.cacheReadTokens)})]}),g.jsx("div",{className:"uh-detail-models",children:E.modelBreakdowns.slice().sort((A,U)=>U.cost-A.cost).map(A=>{const U=E.totalCost>0?A.cost/E.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:nu(A.modelName)}}),li(A.modelName)]}),g.jsx("span",{className:"uh-model-bar",children:g.jsx("span",{className:"uh-model-bar-fill",style:{width:`${U}%`,background:nu(A.modelName)}})}),g.jsx("span",{className:"uh-model-cost",children:ze(A.cost)})]},A.modelName)})})]})]})]})})}function ru({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 su({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 ey(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 zd,s_;function uq(){if(s_)return zd;s_=1;function e(){this.__data__=[],this.size=0}return zd=e,zd}var Bd,i_;function _o(){if(i_)return Bd;i_=1;function e(n,r){return n===r||n!==n&&r!==r}return Bd=e,Bd}var Ud,o_;function Mu(){if(o_)return Ud;o_=1;var e=_o();function n(r,i){for(var o=r.length;o--;)if(e(r[o][0],i))return o;return-1}return Ud=n,Ud}var Hd,a_;function cq(){if(a_)return Hd;a_=1;var e=Mu(),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 Hd=i,Hd}var Wd,l_;function dq(){if(l_)return Wd;l_=1;var e=Mu();function n(r){var i=this.__data__,o=e(i,r);return o<0?void 0:i[o][1]}return Wd=n,Wd}var Vd,u_;function fq(){if(u_)return Vd;u_=1;var e=Mu();function n(r){return e(this.__data__,r)>-1}return Vd=n,Vd}var Gd,c_;function hq(){if(c_)return Gd;c_=1;var e=Mu();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 Gd=n,Gd}var Yd,d_;function Ou(){if(d_)return Yd;d_=1;var e=uq(),n=cq(),r=dq(),i=fq(),o=hq();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,Yd=l,Yd}var Kd,f_;function pq(){if(f_)return Kd;f_=1;var e=Ou();function n(){this.__data__=new e,this.size=0}return Kd=n,Kd}var Xd,h_;function mq(){if(h_)return Xd;h_=1;function e(n){var r=this.__data__,i=r.delete(n);return this.size=r.size,i}return Xd=e,Xd}var Qd,p_;function gq(){if(p_)return Qd;p_=1;function e(n){return this.__data__.get(n)}return Qd=e,Qd}var Zd,m_;function vq(){if(m_)return Zd;m_=1;function e(n){return this.__data__.has(n)}return Zd=e,Zd}var Jd,g_;function NC(){if(g_)return Jd;g_=1;var e=typeof zl=="object"&&zl&&zl.Object===Object&&zl;return Jd=e,Jd}var ef,v_;function nr(){if(v_)return ef;v_=1;var e=NC(),n=typeof self=="object"&&self&&self.Object===Object&&self,r=e||n||Function("return this")();return ef=r,ef}var tf,y_;function bo(){if(y_)return tf;y_=1;var e=nr(),n=e.Symbol;return tf=n,tf}var nf,w_;function yq(){if(w_)return nf;w_=1;var e=bo(),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 nf=l,nf}var rf,x_;function wq(){if(x_)return rf;x_=1;var e=Object.prototype,n=e.toString;function r(i){return n.call(i)}return rf=r,rf}var sf,__;function ui(){if(__)return sf;__=1;var e=bo(),n=yq(),r=wq(),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 sf=u,sf}var of,b_;function Ln(){if(b_)return of;b_=1;function e(n){var r=typeof n;return n!=null&&(r=="object"||r=="function")}return of=e,of}var af,S_;function $a(){if(S_)return af;S_=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 af=u,af}var lf,k_;function xq(){if(k_)return lf;k_=1;var e=nr(),n=e["__core-js_shared__"];return lf=n,lf}var uf,E_;function _q(){if(E_)return uf;E_=1;var e=xq(),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 uf=r,uf}var cf,N_;function CC(){if(N_)return cf;N_=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 cf=r,cf}var df,C_;function bq(){if(C_)return df;C_=1;var e=$a(),n=_q(),r=Ln(),i=CC(),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 df=m,df}var ff,R_;function Sq(){if(R_)return ff;R_=1;function e(n,r){return n==null?void 0:n[r]}return ff=e,ff}var hf,j_;function ci(){if(j_)return hf;j_=1;var e=bq(),n=Sq();function r(i,o){var l=n(i,o);return e(l)?l:void 0}return hf=r,hf}var pf,T_;function ty(){if(T_)return pf;T_=1;var e=ci(),n=nr(),r=e(n,"Map");return pf=r,pf}var mf,A_;function Pu(){if(A_)return mf;A_=1;var e=ci(),n=e(Object,"create");return mf=n,mf}var gf,I_;function kq(){if(I_)return gf;I_=1;var e=Pu();function n(){this.__data__=e?e(null):{},this.size=0}return gf=n,gf}var vf,M_;function Eq(){if(M_)return vf;M_=1;function e(n){var r=this.has(n)&&delete this.__data__[n];return this.size-=r?1:0,r}return vf=e,vf}var yf,O_;function Nq(){if(O_)return yf;O_=1;var e=Pu(),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 yf=o,yf}var wf,P_;function Cq(){if(P_)return wf;P_=1;var e=Pu(),n=Object.prototype,r=n.hasOwnProperty;function i(o){var l=this.__data__;return e?l[o]!==void 0:r.call(l,o)}return wf=i,wf}var xf,L_;function Rq(){if(L_)return xf;L_=1;var e=Pu(),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 xf=r,xf}var _f,q_;function jq(){if(q_)return _f;q_=1;var e=kq(),n=Eq(),r=Nq(),i=Cq(),o=Rq();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,_f=l,_f}var bf,$_;function Tq(){if($_)return bf;$_=1;var e=jq(),n=Ou(),r=ty();function i(){this.size=0,this.__data__={hash:new e,map:new(r||n),string:new e}}return bf=i,bf}var Sf,D_;function Aq(){if(D_)return Sf;D_=1;function e(n){var r=typeof n;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?n!=="__proto__":n===null}return Sf=e,Sf}var kf,F_;function Lu(){if(F_)return kf;F_=1;var e=Aq();function n(r,i){var o=r.__data__;return e(i)?o[typeof i=="string"?"string":"hash"]:o.map}return kf=n,kf}var Ef,z_;function Iq(){if(z_)return Ef;z_=1;var e=Lu();function n(r){var i=e(this,r).delete(r);return this.size-=i?1:0,i}return Ef=n,Ef}var Nf,B_;function Mq(){if(B_)return Nf;B_=1;var e=Lu();function n(r){return e(this,r).get(r)}return Nf=n,Nf}var Cf,U_;function Oq(){if(U_)return Cf;U_=1;var e=Lu();function n(r){return e(this,r).has(r)}return Cf=n,Cf}var Rf,H_;function Pq(){if(H_)return Rf;H_=1;var e=Lu();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 Rf=n,Rf}var jf,W_;function ny(){if(W_)return jf;W_=1;var e=Tq(),n=Iq(),r=Mq(),i=Oq(),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,jf=l,jf}var Tf,V_;function Lq(){if(V_)return Tf;V_=1;var e=Ou(),n=ty(),r=ny(),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 Tf=o,Tf}var Af,G_;function qu(){if(G_)return Af;G_=1;var e=Ou(),n=pq(),r=mq(),i=gq(),o=vq(),l=Lq();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,Af=u,Af}var If,Y_;function ry(){if(Y_)return If;Y_=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 If=e,If}var Mf,K_;function RC(){if(K_)return Mf;K_=1;var e=ci(),n=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return Mf=n,Mf}var Of,X_;function $u(){if(X_)return Of;X_=1;var e=RC();function n(r,i,o){i=="__proto__"&&e?e(r,i,{configurable:!0,enumerable:!0,value:o,writable:!0}):r[i]=o}return Of=n,Of}var Pf,Q_;function Du(){if(Q_)return Pf;Q_=1;var e=$u(),n=_o(),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 Pf=o,Pf}var Lf,Z_;function Da(){if(Z_)return Lf;Z_=1;var e=Du(),n=$u();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 Lf=r,Lf}var qf,J_;function qq(){if(J_)return qf;J_=1;function e(n,r){for(var i=-1,o=Array(n);++i<n;)o[i]=r(i);return o}return qf=e,qf}var $f,e1;function vr(){if(e1)return $f;e1=1;function e(n){return n!=null&&typeof n=="object"}return $f=e,$f}var Df,t1;function $q(){if(t1)return Df;t1=1;var e=ui(),n=vr(),r="[object Arguments]";function i(o){return n(o)&&e(o)==r}return Df=i,Df}var Ff,n1;function Fa(){if(n1)return Ff;n1=1;var e=$q(),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 Ff=l,Ff}var zf,r1;function bt(){if(r1)return zf;r1=1;var e=Array.isArray;return zf=e,zf}var ya={exports:{}},Bf,s1;function Dq(){if(s1)return Bf;s1=1;function e(){return!1}return Bf=e,Bf}ya.exports;var i1;function So(){return i1||(i1=1,(function(e,n){var r=nr(),i=Dq(),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})(ya,ya.exports)),ya.exports}var Uf,o1;function Fu(){if(o1)return Uf;o1=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 Uf=r,Uf}var Hf,a1;function sy(){if(a1)return Hf;a1=1;var e=9007199254740991;function n(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return Hf=n,Hf}var Wf,l1;function Fq(){if(l1)return Wf;l1=1;var e=ui(),n=sy(),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]",b="[object ArrayBuffer]",S="[object DataView]",k="[object Float32Array]",E="[object Float64Array]",C="[object Int8Array]",I="[object Int16Array]",P="[object Int32Array]",A="[object Uint8Array]",U="[object Uint8ClampedArray]",L="[object Uint16Array]",O="[object Uint32Array]",q={};q[k]=q[E]=q[C]=q[I]=q[P]=q[A]=q[U]=q[L]=q[O]=!0,q[i]=q[o]=q[b]=q[l]=q[S]=q[u]=q[c]=q[h]=q[p]=q[d]=q[m]=q[y]=q[w]=q[N]=q[_]=!1;function G(F){return r(F)&&n(F.length)&&!!q[e(F)]}return Wf=G,Wf}var Vf,u1;function zu(){if(u1)return Vf;u1=1;function e(n){return function(r){return n(r)}}return Vf=e,Vf}var wa={exports:{}};wa.exports;var c1;function iy(){return c1||(c1=1,(function(e,n){var r=NC(),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})(wa,wa.exports)),wa.exports}var Gf,d1;function za(){if(d1)return Gf;d1=1;var e=Fq(),n=zu(),r=iy(),i=r&&r.isTypedArray,o=i?n(i):e;return Gf=o,Gf}var Yf,f1;function jC(){if(f1)return Yf;f1=1;var e=qq(),n=Fa(),r=bt(),i=So(),o=Fu(),l=za(),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,b=_?e(p.length,String):[],S=b.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,S)))&&b.push(k);return b}return Yf=h,Yf}var Kf,h1;function Bu(){if(h1)return Kf;h1=1;var e=Object.prototype;function n(r){var i=r&&r.constructor,o=typeof i=="function"&&i.prototype||e;return r===o}return Kf=n,Kf}var Xf,p1;function TC(){if(p1)return Xf;p1=1;function e(n,r){return function(i){return n(r(i))}}return Xf=e,Xf}var Qf,m1;function zq(){if(m1)return Qf;m1=1;var e=TC(),n=e(Object.keys,Object);return Qf=n,Qf}var Zf,g1;function oy(){if(g1)return Zf;g1=1;var e=Bu(),n=zq(),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 Zf=o,Zf}var Jf,v1;function Wr(){if(v1)return Jf;v1=1;var e=$a(),n=sy();function r(i){return i!=null&&n(i.length)&&!e(i)}return Jf=r,Jf}var eh,y1;function Ss(){if(y1)return eh;y1=1;var e=jC(),n=oy(),r=Wr();function i(o){return r(o)?e(o):n(o)}return eh=i,eh}var th,w1;function Bq(){if(w1)return th;w1=1;var e=Da(),n=Ss();function r(i,o){return i&&e(o,n(o),i)}return th=r,th}var nh,x1;function Uq(){if(x1)return nh;x1=1;function e(n){var r=[];if(n!=null)for(var i in Object(n))r.push(i);return r}return nh=e,nh}var rh,_1;function Hq(){if(_1)return rh;_1=1;var e=Ln(),n=Bu(),r=Uq(),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 rh=l,rh}var sh,b1;function di(){if(b1)return sh;b1=1;var e=jC(),n=Hq(),r=Wr();function i(o){return r(o)?e(o,!0):n(o)}return sh=i,sh}var ih,S1;function Wq(){if(S1)return ih;S1=1;var e=Da(),n=di();function r(i,o){return i&&e(o,n(o),i)}return ih=r,ih}var xa={exports:{}};xa.exports;var k1;function AC(){return k1||(k1=1,(function(e,n){var r=nr(),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})(xa,xa.exports)),xa.exports}var oh,E1;function IC(){if(E1)return oh;E1=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 oh=e,oh}var ah,N1;function MC(){if(N1)return ah;N1=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 ah=e,ah}var lh,C1;function OC(){if(C1)return lh;C1=1;function e(){return[]}return lh=e,lh}var uh,R1;function ay(){if(R1)return uh;R1=1;var e=MC(),n=OC(),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 uh=l,uh}var ch,j1;function Vq(){if(j1)return ch;j1=1;var e=Da(),n=ay();function r(i,o){return e(i,n(i),o)}return ch=r,ch}var dh,T1;function ly(){if(T1)return dh;T1=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 dh=e,dh}var fh,A1;function Uu(){if(A1)return fh;A1=1;var e=TC(),n=e(Object.getPrototypeOf,Object);return fh=n,fh}var hh,I1;function PC(){if(I1)return hh;I1=1;var e=ly(),n=Uu(),r=ay(),i=OC(),o=Object.getOwnPropertySymbols,l=o?function(u){for(var c=[];u;)e(c,r(u)),u=n(u);return c}:i;return hh=l,hh}var ph,M1;function Gq(){if(M1)return ph;M1=1;var e=Da(),n=PC();function r(i,o){return e(i,n(i),o)}return ph=r,ph}var mh,O1;function LC(){if(O1)return mh;O1=1;var e=ly(),n=bt();function r(i,o,l){var u=o(i);return n(i)?u:e(u,l(i))}return mh=r,mh}var gh,P1;function qC(){if(P1)return gh;P1=1;var e=LC(),n=ay(),r=Ss();function i(o){return e(o,r,n)}return gh=i,gh}var vh,L1;function Yq(){if(L1)return vh;L1=1;var e=LC(),n=PC(),r=di();function i(o){return e(o,r,n)}return vh=i,vh}var yh,q1;function Kq(){if(q1)return yh;q1=1;var e=ci(),n=nr(),r=e(n,"DataView");return yh=r,yh}var wh,$1;function Xq(){if($1)return wh;$1=1;var e=ci(),n=nr(),r=e(n,"Promise");return wh=r,wh}var xh,D1;function $C(){if(D1)return xh;D1=1;var e=ci(),n=nr(),r=e(n,"Set");return xh=r,xh}var _h,F1;function Qq(){if(F1)return _h;F1=1;var e=ci(),n=nr(),r=e(n,"WeakMap");return _h=r,_h}var bh,z1;function ko(){if(z1)return bh;z1=1;var e=Kq(),n=ty(),r=Xq(),i=$C(),o=Qq(),l=ui(),u=CC(),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),b=u(i),S=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),I=C==h?E.constructor:void 0,P=I?u(I):"";if(P)switch(P){case w:return y;case N:return c;case _:return p;case b:return d;case S:return m}return C}),bh=k,bh}var Sh,B1;function Zq(){if(B1)return Sh;B1=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 Sh=r,Sh}var kh,U1;function DC(){if(U1)return kh;U1=1;var e=nr(),n=e.Uint8Array;return kh=n,kh}var Eh,H1;function uy(){if(H1)return Eh;H1=1;var e=DC();function n(r){var i=new r.constructor(r.byteLength);return new e(i).set(new e(r)),i}return Eh=n,Eh}var Nh,W1;function Jq(){if(W1)return Nh;W1=1;var e=uy();function n(r,i){var o=i?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.byteLength)}return Nh=n,Nh}var Ch,V1;function e$(){if(V1)return Ch;V1=1;var e=/\w*$/;function n(r){var i=new r.constructor(r.source,e.exec(r));return i.lastIndex=r.lastIndex,i}return Ch=n,Ch}var Rh,G1;function t$(){if(G1)return Rh;G1=1;var e=bo(),n=e?e.prototype:void 0,r=n?n.valueOf:void 0;function i(o){return r?Object(r.call(o)):{}}return Rh=i,Rh}var jh,Y1;function FC(){if(Y1)return jh;Y1=1;var e=uy();function n(r,i){var o=i?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.length)}return jh=n,jh}var Th,K1;function n$(){if(K1)return Th;K1=1;var e=uy(),n=Jq(),r=e$(),i=t$(),o=FC(),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]",b="[object Float64Array]",S="[object Int8Array]",k="[object Int16Array]",E="[object Int32Array]",C="[object Uint8Array]",I="[object Uint8ClampedArray]",P="[object Uint16Array]",A="[object Uint32Array]";function U(L,O,q){var G=L.constructor;switch(O){case w:return e(L);case l:case u:return new G(+L);case N:return n(L,q);case _:case b:case S:case k:case E:case C:case I:case P:case A:return o(L,q);case c:return new G;case h:case m:return new G(L);case p:return r(L);case d:return new G;case y:return i(L)}}return Th=U,Th}var Ah,X1;function zC(){if(X1)return Ah;X1=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 Ah=r,Ah}var Ih,Q1;function BC(){if(Q1)return Ih;Q1=1;var e=zC(),n=Uu(),r=Bu();function i(o){return typeof o.constructor=="function"&&!r(o)?e(n(o)):{}}return Ih=i,Ih}var Mh,Z1;function r$(){if(Z1)return Mh;Z1=1;var e=ko(),n=vr(),r="[object Map]";function i(o){return n(o)&&e(o)==r}return Mh=i,Mh}var Oh,J1;function s$(){if(J1)return Oh;J1=1;var e=r$(),n=zu(),r=iy(),i=r&&r.isMap,o=i?n(i):e;return Oh=o,Oh}var Ph,eb;function i$(){if(eb)return Ph;eb=1;var e=ko(),n=vr(),r="[object Set]";function i(o){return n(o)&&e(o)==r}return Ph=i,Ph}var Lh,tb;function o$(){if(tb)return Lh;tb=1;var e=i$(),n=zu(),r=iy(),i=r&&r.isSet,o=i?n(i):e;return Lh=o,Lh}var qh,nb;function UC(){if(nb)return qh;nb=1;var e=qu(),n=ry(),r=Du(),i=Bq(),o=Wq(),l=AC(),u=IC(),c=Vq(),h=Gq(),p=qC(),d=Yq(),m=ko(),y=Zq(),w=n$(),N=BC(),_=bt(),b=So(),S=s$(),k=Ln(),E=o$(),C=Ss(),I=di(),P=1,A=2,U=4,L="[object Arguments]",O="[object Array]",q="[object Boolean]",G="[object Date]",F="[object Error]",T="[object Function]",B="[object GeneratorFunction]",z="[object Map]",ne="[object Number]",Z="[object Object]",$="[object RegExp]",Q="[object Set]",M="[object String]",V="[object Symbol]",Y="[object WeakMap]",H="[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[L]=ke[O]=ke[H]=ke[J]=ke[q]=ke[G]=ke[re]=ke[le]=ke[fe]=ke[te]=ke[ce]=ke[z]=ke[ne]=ke[Z]=ke[$]=ke[Q]=ke[M]=ke[V]=ke[Ce]=ke[ve]=ke[Te]=ke[ye]=!0,ke[F]=ke[T]=ke[Y]=!1;function Ke(we,_e,Be,ft,ht,We){var $e,Je=_e&P,Xe=_e&A,vt=_e&U;if(Be&&($e=ht?Be(we,ft,ht,We):Be(we)),$e!==void 0)return $e;if(!k(we))return we;var ot=_(we);if(ot){if($e=y(we),!Je)return u(we,$e)}else{var yt=m(we),Gt=yt==T||yt==B;if(b(we))return l(we,Je);if(yt==Z||yt==L||Gt&&!ht){if($e=Xe||Gt?{}:N(we),!Je)return Xe?h(we,o($e,we)):c(we,i($e,we))}else{if(!ke[yt])return ht?we:{};$e=w(we,yt,Je)}}We||(We=new e);var It=We.get(we);if(It)return It;We.set(we,$e),E(we)?we.forEach(function(pt){$e.add(Ke(pt,_e,Be,pt,we,We))}):S(we)&&we.forEach(function(pt,mt){$e.set(mt,Ke(pt,_e,Be,mt,we,We))});var Ze=vt?Xe?d:p:Xe?I:C,wt=ot?void 0:Ze(we);return n(wt||we,function(pt,mt){wt&&(mt=pt,pt=we[mt]),r($e,mt,Ke(pt,_e,Be,mt,we,We))}),$e}return qh=Ke,qh}var $h,rb;function a$(){if(rb)return $h;rb=1;var e=UC(),n=4;function r(i){return e(i,n)}return $h=r,$h}var Dh,sb;function cy(){if(sb)return Dh;sb=1;function e(n){return function(){return n}}return Dh=e,Dh}var Fh,ib;function l$(){if(ib)return Fh;ib=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 Fh=e,Fh}var zh,ob;function dy(){if(ob)return zh;ob=1;var e=l$(),n=e();return zh=n,zh}var Bh,ab;function fy(){if(ab)return Bh;ab=1;var e=dy(),n=Ss();function r(i,o){return i&&e(i,o,n)}return Bh=r,Bh}var Uh,lb;function u$(){if(lb)return Uh;lb=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 Uh=n,Uh}var Hh,ub;function Hu(){if(ub)return Hh;ub=1;var e=fy(),n=u$(),r=n(e);return Hh=r,Hh}var Wh,cb;function fi(){if(cb)return Wh;cb=1;function e(n){return n}return Wh=e,Wh}var Vh,db;function HC(){if(db)return Vh;db=1;var e=fi();function n(r){return typeof r=="function"?r:e}return Vh=n,Vh}var Gh,fb;function WC(){if(fb)return Gh;fb=1;var e=ry(),n=Hu(),r=HC(),i=bt();function o(l,u){var c=i(l)?e:n;return c(l,r(u))}return Gh=o,Gh}var Yh,hb;function VC(){return hb||(hb=1,Yh=WC()),Yh}var Kh,pb;function c$(){if(pb)return Kh;pb=1;var e=Hu();function n(r,i){var o=[];return e(r,function(l,u,c){i(l,u,c)&&o.push(l)}),o}return Kh=n,Kh}var Xh,mb;function d$(){if(mb)return Xh;mb=1;var e="__lodash_hash_undefined__";function n(r){return this.__data__.set(r,e),this}return Xh=n,Xh}var Qh,gb;function f$(){if(gb)return Qh;gb=1;function e(n){return this.__data__.has(n)}return Qh=e,Qh}var Zh,vb;function GC(){if(vb)return Zh;vb=1;var e=ny(),n=d$(),r=f$();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,Zh=i,Zh}var Jh,yb;function h$(){if(yb)return Jh;yb=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 Jh=e,Jh}var ep,wb;function YC(){if(wb)return ep;wb=1;function e(n,r){return n.has(r)}return ep=e,ep}var tp,xb;function KC(){if(xb)return tp;xb=1;var e=GC(),n=h$(),r=YC(),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),b=m.get(c);if(_&&b)return _==c&&b==u;var S=-1,k=!0,E=h&o?new e:void 0;for(m.set(u,c),m.set(c,u);++S<w;){var C=u[S],I=c[S];if(p)var P=y?p(I,C,S,c,u,m):p(C,I,S,u,c,m);if(P!==void 0){if(P)continue;k=!1;break}if(E){if(!n(c,function(A,U){if(!r(E,U)&&(C===A||d(C,A,h,p,m)))return E.push(U)})){k=!1;break}}else if(!(C===I||d(C,I,h,p,m))){k=!1;break}}return m.delete(u),m.delete(c),k}return tp=l,tp}var np,_b;function p$(){if(_b)return np;_b=1;function e(n){var r=-1,i=Array(n.size);return n.forEach(function(o,l){i[++r]=[l,o]}),i}return np=e,np}var rp,bb;function hy(){if(bb)return rp;bb=1;function e(n){var r=-1,i=Array(n.size);return n.forEach(function(o){i[++r]=o}),i}return rp=e,rp}var sp,Sb;function m$(){if(Sb)return sp;Sb=1;var e=bo(),n=DC(),r=_o(),i=KC(),o=p$(),l=hy(),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]",b="[object Symbol]",S="[object ArrayBuffer]",k="[object DataView]",E=e?e.prototype:void 0,C=E?E.valueOf:void 0;function I(P,A,U,L,O,q,G){switch(U){case k:if(P.byteLength!=A.byteLength||P.byteOffset!=A.byteOffset)return!1;P=P.buffer,A=A.buffer;case S:return!(P.byteLength!=A.byteLength||!q(new n(P),new n(A)));case h:case p:case y:return r(+P,+A);case d:return P.name==A.name&&P.message==A.message;case w:case _:return P==A+"";case m:var F=o;case N:var T=L&u;if(F||(F=l),P.size!=A.size&&!T)return!1;var B=G.get(P);if(B)return B==A;L|=c,G.set(P,A);var z=i(F(P),F(A),L,O,q,G);return G.delete(P),z;case b:if(C)return C.call(P)==C.call(A)}return!1}return sp=I,sp}var ip,kb;function g$(){if(kb)return ip;kb=1;var e=qC(),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 b=w;b--;){var S=y[b];if(!(m?S in u:i.call(u,S)))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 I=m;++b<w;){S=y[b];var P=l[S],A=u[S];if(h)var U=m?h(A,P,S,u,l,d):h(P,A,S,l,u,d);if(!(U===void 0?P===A||p(P,A,c,h,d):U)){C=!1;break}I||(I=S=="constructor")}if(C&&!I){var L=l.constructor,O=u.constructor;L!=O&&"constructor"in l&&"constructor"in u&&!(typeof L=="function"&&L instanceof L&&typeof O=="function"&&O instanceof O)&&(C=!1)}return d.delete(l),d.delete(u),C}return ip=o,ip}var op,Eb;function v$(){if(Eb)return op;Eb=1;var e=qu(),n=KC(),r=m$(),i=g$(),o=ko(),l=bt(),u=So(),c=za(),h=1,p="[object Arguments]",d="[object Array]",m="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function N(_,b,S,k,E,C){var I=l(_),P=l(b),A=I?d:o(_),U=P?d:o(b);A=A==p?m:A,U=U==p?m:U;var L=A==m,O=U==m,q=A==U;if(q&&u(_)){if(!u(b))return!1;I=!0,L=!1}if(q&&!L)return C||(C=new e),I||c(_)?n(_,b,S,k,E,C):r(_,b,A,S,k,E,C);if(!(S&h)){var G=L&&w.call(_,"__wrapped__"),F=O&&w.call(b,"__wrapped__");if(G||F){var T=G?_.value():_,B=F?b.value():b;return C||(C=new e),E(T,B,S,k,C)}}return q?(C||(C=new e),i(_,b,S,k,E,C)):!1}return op=N,op}var ap,Nb;function XC(){if(Nb)return ap;Nb=1;var e=v$(),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 ap=r,ap}var lp,Cb;function y$(){if(Cb)return lp;Cb=1;var e=qu(),n=XC(),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 b=new e;if(h)var S=h(N,_,w,l,u,b);if(!(S===void 0?n(_,N,r|i,h,b):S))return!1}}return!0}return lp=o,lp}var up,Rb;function QC(){if(Rb)return up;Rb=1;var e=Ln();function n(r){return r===r&&!e(r)}return up=n,up}var cp,jb;function w$(){if(jb)return cp;jb=1;var e=QC(),n=Ss();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 cp=r,cp}var dp,Tb;function ZC(){if(Tb)return dp;Tb=1;function e(n,r){return function(i){return i==null?!1:i[n]===r&&(r!==void 0||n in Object(i))}}return dp=e,dp}var fp,Ab;function x$(){if(Ab)return fp;Ab=1;var e=y$(),n=w$(),r=ZC();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 fp=i,fp}var hp,Ib;function Eo(){if(Ib)return hp;Ib=1;var e=ui(),n=vr(),r="[object Symbol]";function i(o){return typeof o=="symbol"||n(o)&&e(o)==r}return hp=i,hp}var pp,Mb;function py(){if(Mb)return pp;Mb=1;var e=bt(),n=Eo(),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 pp=o,pp}var mp,Ob;function _$(){if(Ob)return mp;Ob=1;var e=ny(),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,mp=r,mp}var gp,Pb;function b$(){if(Pb)return gp;Pb=1;var 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 gp=r,gp}var vp,Lb;function S$(){if(Lb)return vp;Lb=1;var e=b$(),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 vp=i,vp}var yp,qb;function Wu(){if(qb)return yp;qb=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 yp=e,yp}var wp,$b;function k$(){if($b)return wp;$b=1;var e=bo(),n=Wu(),r=bt(),i=Eo(),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 wp=u,wp}var xp,Db;function JC(){if(Db)return xp;Db=1;var e=k$();function n(r){return r==null?"":e(r)}return xp=n,xp}var _p,Fb;function Vu(){if(Fb)return _p;Fb=1;var e=bt(),n=py(),r=S$(),i=JC();function o(l,u){return e(l)?l:n(l,u)?[l]:r(i(l))}return _p=o,_p}var bp,zb;function Ba(){if(zb)return bp;zb=1;var e=Eo();function n(r){if(typeof r=="string"||e(r))return r;var i=r+"";return i=="0"&&1/r==-1/0?"-0":i}return bp=n,bp}var Sp,Bb;function Gu(){if(Bb)return Sp;Bb=1;var e=Vu(),n=Ba();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 Sp=r,Sp}var kp,Ub;function E$(){if(Ub)return kp;Ub=1;var e=Gu();function n(r,i,o){var l=r==null?void 0:e(r,i);return l===void 0?o:l}return kp=n,kp}var Ep,Hb;function N$(){if(Hb)return Ep;Hb=1;function e(n,r){return n!=null&&r in Object(n)}return Ep=e,Ep}var Np,Wb;function eR(){if(Wb)return Np;Wb=1;var e=Vu(),n=Fa(),r=bt(),i=Fu(),o=sy(),l=Ba();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 Np=u,Np}var Cp,Vb;function tR(){if(Vb)return Cp;Vb=1;var e=N$(),n=eR();function r(i,o){return i!=null&&n(i,o,e)}return Cp=r,Cp}var Rp,Gb;function C$(){if(Gb)return Rp;Gb=1;var e=XC(),n=E$(),r=tR(),i=py(),o=QC(),l=ZC(),u=Ba(),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 Rp=p,Rp}var jp,Yb;function nR(){if(Yb)return jp;Yb=1;function e(n){return function(r){return r==null?void 0:r[n]}}return jp=e,jp}var Tp,Kb;function R$(){if(Kb)return Tp;Kb=1;var e=Gu();function n(r){return function(i){return e(i,r)}}return Tp=n,Tp}var Ap,Xb;function j$(){if(Xb)return Ap;Xb=1;var e=nR(),n=R$(),r=py(),i=Ba();function o(l){return r(l)?e(i(l)):n(l)}return Ap=o,Ap}var Ip,Qb;function Vr(){if(Qb)return Ip;Qb=1;var e=x$(),n=C$(),r=fi(),i=bt(),o=j$();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 Ip=l,Ip}var Mp,Zb;function rR(){if(Zb)return Mp;Zb=1;var e=MC(),n=c$(),r=Vr(),i=bt();function o(l,u){var c=i(l)?e:n;return c(l,r(u,3))}return Mp=o,Mp}var Op,Jb;function T$(){if(Jb)return Op;Jb=1;var e=Object.prototype,n=e.hasOwnProperty;function r(i,o){return i!=null&&n.call(i,o)}return Op=r,Op}var Pp,eS;function sR(){if(eS)return Pp;eS=1;var e=T$(),n=eR();function r(i,o){return i!=null&&n(i,o,e)}return Pp=r,Pp}var Lp,tS;function A$(){if(tS)return Lp;tS=1;var e=oy(),n=ko(),r=Fa(),i=bt(),o=Wr(),l=So(),u=Bu(),c=za(),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 Lp=y,Lp}var qp,nS;function iR(){if(nS)return qp;nS=1;function e(n){return n===void 0}return qp=e,qp}var $p,rS;function oR(){if(rS)return $p;rS=1;var e=Hu(),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 $p=r,$p}var Dp,sS;function aR(){if(sS)return Dp;sS=1;var e=Wu(),n=Vr(),r=oR(),i=bt();function o(l,u){var c=i(l)?e:r;return c(l,n(u,3))}return Dp=o,Dp}var Fp,iS;function I$(){if(iS)return Fp;iS=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 Fp=e,Fp}var zp,oS;function M$(){if(oS)return zp;oS=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 zp=e,zp}var Bp,aS;function lR(){if(aS)return Bp;aS=1;var e=I$(),n=Hu(),r=Vr(),i=M$(),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 Bp=l,Bp}var Up,lS;function O$(){if(lS)return Up;lS=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 Up=o,Up}var Hp,uS;function P$(){if(uS)return Hp;uS=1;var e=nR(),n=e("length");return Hp=n,Hp}var Wp,cS;function L$(){if(cS)return Wp;cS=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 Wp=h,Wp}var Vp,dS;function q$(){if(dS)return Vp;dS=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+"]?",b="(?:"+w+"(?:"+[d,m,y].join("|")+")"+_+N+")*",S=_+N+b,k="(?:"+[d+c+"?",c,m,y,u].join("|")+")",E=RegExp(h+"(?="+h+")|"+k+S,"g");function C(I){for(var P=E.lastIndex=0;E.test(I);)++P;return P}return Vp=C,Vp}var Gp,fS;function $$(){if(fS)return Gp;fS=1;var e=P$(),n=L$(),r=q$();function i(o){return n(o)?r(o):e(o)}return Gp=i,Gp}var Yp,hS;function D$(){if(hS)return Yp;hS=1;var e=oy(),n=ko(),r=Wr(),i=O$(),o=$$(),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 Yp=c,Yp}var Kp,pS;function F$(){if(pS)return Kp;pS=1;var e=ry(),n=zC(),r=fy(),i=Vr(),o=Uu(),l=bt(),u=So(),c=$a(),h=Ln(),p=za();function d(m,y,w){var N=l(m),_=N||u(m)||p(m);if(y=i(y,4),w==null){var b=m&&m.constructor;_?w=N?new b:[]:h(m)?w=c(b)?n(o(m)):{}:w={}}return(_?e:r)(m,function(S,k,E){return y(w,S,k,E)}),w}return Kp=d,Kp}var Xp,mS;function z$(){if(mS)return Xp;mS=1;var e=bo(),n=Fa(),r=bt(),i=e?e.isConcatSpreadable:void 0;function o(l){return r(l)||n(l)||!!(i&&l&&l[i])}return Xp=o,Xp}var Qp,gS;function my(){if(gS)return Qp;gS=1;var e=ly(),n=z$();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 Qp=r,Qp}var Zp,vS;function B$(){if(vS)return Zp;vS=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 Zp=e,Zp}var Jp,yS;function uR(){if(yS)return Jp;yS=1;var e=B$(),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 Jp=r,Jp}var em,wS;function U$(){if(wS)return em;wS=1;var e=cy(),n=RC(),r=fi(),i=n?function(o,l){return n(o,"toString",{configurable:!0,enumerable:!1,value:e(l),writable:!0})}:r;return em=i,em}var tm,xS;function H$(){if(xS)return tm;xS=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 tm=i,tm}var nm,_S;function cR(){if(_S)return nm;_S=1;var e=U$(),n=H$(),r=n(e);return nm=r,nm}var rm,bS;function Yu(){if(bS)return rm;bS=1;var e=fi(),n=uR(),r=cR();function i(o,l){return r(n(o,l,e),o+"")}return rm=i,rm}var sm,SS;function dR(){if(SS)return sm;SS=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 sm=e,sm}var im,kS;function W$(){if(kS)return im;kS=1;function e(n){return n!==n}return im=e,im}var om,ES;function V$(){if(ES)return om;ES=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 om=e,om}var am,NS;function G$(){if(NS)return am;NS=1;var e=dR(),n=W$(),r=V$();function i(o,l,u){return l===l?r(o,l,u):e(o,n,u)}return am=i,am}var lm,CS;function Y$(){if(CS)return lm;CS=1;var e=G$();function n(r,i){var o=r==null?0:r.length;return!!o&&e(r,i,0)>-1}return lm=n,lm}var um,RS;function K$(){if(RS)return um;RS=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 um=e,um}var cm,jS;function X$(){if(jS)return cm;jS=1;function e(){}return cm=e,cm}var dm,TS;function Q$(){if(TS)return dm;TS=1;var e=$C(),n=X$(),r=hy(),i=1/0,o=e&&1/r(new e([,-0]))[1]==i?function(l){return new e(l)}:n;return dm=o,dm}var fm,AS;function Z$(){if(AS)return fm;AS=1;var e=GC(),n=Y$(),r=K$(),i=YC(),o=Q$(),l=hy(),u=200;function c(h,p,d){var m=-1,y=n,w=h.length,N=!0,_=[],b=_;if(d)N=!1,y=r;else if(w>=u){var S=p?null:o(h);if(S)return l(S);N=!1,y=i,b=new e}else b=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=b.length;C--;)if(b[C]===E)continue e;p&&b.push(E),_.push(k)}else y(b,E,d)||(b!==_&&b.push(E),_.push(k))}return _}return fm=c,fm}var hm,IS;function fR(){if(IS)return hm;IS=1;var e=Wr(),n=vr();function r(i){return n(i)&&e(i)}return hm=r,hm}var pm,MS;function J$(){if(MS)return pm;MS=1;var e=my(),n=Yu(),r=Z$(),i=fR(),o=n(function(l){return r(e(l,1,i,!0))});return pm=o,pm}var mm,OS;function e4(){if(OS)return mm;OS=1;var e=Wu();function n(r,i){return e(i,function(o){return r[o]})}return mm=n,mm}var gm,PS;function hR(){if(PS)return gm;PS=1;var e=e4(),n=Ss();function r(i){return i==null?[]:e(i,n(i))}return gm=r,gm}var vm,LS;function qn(){if(LS)return vm;LS=1;var e;if(typeof ey=="function")try{e={clone:a$(),constant:cy(),each:VC(),filter:rR(),has:sR(),isArray:bt(),isEmpty:A$(),isFunction:$a(),isUndefined:iR(),keys:Ss(),map:aR(),reduce:lR(),size:D$(),transform:F$(),union:J$(),values:hR()}}catch{}return e||(e=window._),vm=e,vm}var ym,qS;function gy(){if(qS)return ym;qS=1;var e=qn();ym=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(_,b){d(b)&&m.setNode(b,_)}),e.each(this._edgeObjs,function(_){m.hasNode(_.v)&&m.hasNode(_.w)&&m.setEdge(_,y.edge(_))});var w={};function N(_){var b=y.parent(_);return b===void 0||m.hasNode(b)?(w[_]=b,b):b in w?w[b]:N(b)}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 b=c(this._isDirected,d,m,y);if(e.has(this._edgeLabels,b))return N&&(this._edgeLabels[b]=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[b]=N?w:this._defaultEdgeLabelFn(d,m,y);var S=h(this._isDirected,d,m,y);return d=S.v,m=S.w,Object.freeze(S),this._edgeObjs[b]=S,l(this._preds[m],d),l(this._sucs[d],m),this._in[m][b]=S,this._out[d][b]=S,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 b=N;N=_,_=b}return N+i+_+i+(e.isUndefined(w)?n:w)}function h(d,m,y,w){var N=""+m,_=""+y;if(!d&&N>_){var b=N;N=_,_=b}var S={v:N,w:_};return w&&(S.name=w),S}function p(d,m){return c(d,m.v,m.w,m.name)}return ym}var wm,$S;function t4(){return $S||($S=1,wm="2.1.8"),wm}var xm,DS;function n4(){return DS||(DS=1,xm={Graph:gy(),version:t4()}),xm}var _m,FS;function r4(){if(FS)return _m;FS=1;var e=qn(),n=gy();_m={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 _m}var bm,zS;function s4(){if(zS)return bm;zS=1;var e=qn();bm=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 bm}var Sm,BS;function pR(){if(BS)return Sm;BS=1;var e=qn();Sm=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},Sm}var km,US;function mR(){if(US)return km;US=1;var e=qn(),n=pR();km=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,b=p[_],S=c(N),k=y.distance+S;if(S<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+N+" Weight: "+S);k<b.distance&&(b.distance=k,b.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 km}var Em,HS;function i4(){if(HS)return Em;HS=1;var e=mR(),n=qn();Em=r;function r(i,o,l){return n.transform(i.nodes(),function(u,c){u[c]=e(i,c,o,l)},{})}return Em}var Nm,WS;function gR(){if(WS)return Nm;WS=1;var e=qn();Nm=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 Nm}var Cm,VS;function o4(){if(VS)return Cm;VS=1;var e=qn(),n=gR();Cm=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 Cm}var Rm,GS;function a4(){if(GS)return Rm;GS=1;var e=qn();Rm=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],b=y[w],S=N.distance+_.distance;S<b.distance&&(b.distance=S,b.predecessor=_.predecessor)})})}),c}return Rm}var jm,YS;function vR(){if(YS)return jm;YS=1;var e=qn();jm=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,jm}var Tm,KS;function l4(){if(KS)return Tm;KS=1;var e=vR();Tm=n;function n(r){try{e(r)}catch(i){if(i instanceof e.CycleException)return!1;throw i}return!0}return Tm}var Am,XS;function yR(){if(XS)return Am;XS=1;var e=qn();Am=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 Am}var Im,QS;function u4(){if(QS)return Im;QS=1;var e=yR();Im=n;function n(r,i){return e(r,i,"post")}return Im}var Mm,ZS;function c4(){if(ZS)return Mm;ZS=1;var e=yR();Mm=n;function n(r,i){return e(r,i,"pre")}return Mm}var Om,JS;function d4(){if(JS)return Om;JS=1;var e=qn(),n=gy(),r=pR();Om=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 Om}var Pm,ek;function f4(){return ek||(ek=1,Pm={components:s4(),dijkstra:mR(),dijkstraAll:i4(),findCycles:o4(),floydWarshall:a4(),isAcyclic:l4(),postorder:u4(),preorder:c4(),prim:d4(),tarjan:gR(),topsort:vR()}),Pm}var Lm,tk;function h4(){if(tk)return Lm;tk=1;var e=n4();return Lm={Graph:e.Graph,json:r4(),alg:f4(),version:e.version},Lm}var qm,nk;function er(){if(nk)return qm;nk=1;var e;if(typeof ey=="function")try{e=h4()}catch{}return e||(e=window.graphlib),qm=e,qm}var $m,rk;function p4(){if(rk)return $m;rk=1;var e=UC(),n=1,r=4;function i(o){return e(o,n|r)}return $m=i,$m}var Dm,sk;function Ku(){if(sk)return Dm;sk=1;var e=_o(),n=Wr(),r=Fu(),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 Dm=o,Dm}var Fm,ik;function m4(){if(ik)return Fm;ik=1;var e=Yu(),n=_o(),r=Ku(),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 b=w[N],S=c[b];(S===void 0||n(S,o[b])&&!l.call(c,b))&&(c[b]=y[b])}return c});return Fm=u,Fm}var zm,ok;function g4(){if(ok)return zm;ok=1;var e=Vr(),n=Wr(),r=Ss();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 zm=i,zm}var Bm,ak;function v4(){if(ak)return Bm;ak=1;var e=/\s/;function n(r){for(var i=r.length;i--&&e.test(r.charAt(i)););return i}return Bm=n,Bm}var Um,lk;function y4(){if(lk)return Um;lk=1;var e=v4(),n=/^\s+/;function r(i){return i&&i.slice(0,e(i)+1).replace(n,"")}return Um=r,Um}var Hm,uk;function w4(){if(uk)return Hm;uk=1;var e=y4(),n=Ln(),r=Eo(),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 Hm=h,Hm}var Wm,ck;function wR(){if(ck)return Wm;ck=1;var e=w4(),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 Wm=i,Wm}var Vm,dk;function x4(){if(dk)return Vm;dk=1;var e=wR();function n(r){var i=e(r),o=i%1;return i===i?o?i-o:i:0}return Vm=n,Vm}var Gm,fk;function _4(){if(fk)return Gm;fk=1;var e=dR(),n=Vr(),r=x4(),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 Gm=o,Gm}var Ym,hk;function b4(){if(hk)return Ym;hk=1;var e=g4(),n=_4(),r=e(n);return Ym=r,Ym}var Km,pk;function xR(){if(pk)return Km;pk=1;var e=my();function n(r){var i=r==null?0:r.length;return i?e(r,1):[]}return Km=n,Km}var Xm,mk;function S4(){if(mk)return Xm;mk=1;var e=dy(),n=HC(),r=di();function i(o,l){return o==null?o:e(o,n(l),r)}return Xm=i,Xm}var Qm,gk;function k4(){if(gk)return Qm;gk=1;function e(n){var r=n==null?0:n.length;return r?n[r-1]:void 0}return Qm=e,Qm}var Zm,vk;function E4(){if(vk)return Zm;vk=1;var e=$u(),n=fy(),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 Zm=i,Zm}var Jm,yk;function vy(){if(yk)return Jm;yk=1;var e=Eo();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 Jm=n,Jm}var eg,wk;function N4(){if(wk)return eg;wk=1;function e(n,r){return n>r}return eg=e,eg}var tg,xk;function C4(){if(xk)return tg;xk=1;var e=vy(),n=N4(),r=fi();function i(o){return o&&o.length?e(o,r,n):void 0}return tg=i,tg}var ng,_k;function _R(){if(_k)return ng;_k=1;var e=$u(),n=_o();function r(i,o,l){(l!==void 0&&!n(i[o],l)||l===void 0&&!(o in i))&&e(i,o,l)}return ng=r,ng}var rg,bk;function R4(){if(bk)return rg;bk=1;var e=ui(),n=Uu(),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 rg=p,rg}var sg,Sk;function bR(){if(Sk)return sg;Sk=1;function e(n,r){if(!(r==="constructor"&&typeof n[r]=="function")&&r!="__proto__")return n[r]}return sg=e,sg}var ig,kk;function j4(){if(kk)return ig;kk=1;var e=Da(),n=di();function r(i){return e(i,n(i))}return ig=r,ig}var og,Ek;function T4(){if(Ek)return og;Ek=1;var e=_R(),n=AC(),r=FC(),i=IC(),o=BC(),l=Fa(),u=bt(),c=fR(),h=So(),p=$a(),d=Ln(),m=R4(),y=za(),w=bR(),N=j4();function _(b,S,k,E,C,I,P){var A=w(b,k),U=w(S,k),L=P.get(U);if(L){e(b,k,L);return}var O=I?I(A,U,k+"",b,S,P):void 0,q=O===void 0;if(q){var G=u(U),F=!G&&h(U),T=!G&&!F&&y(U);O=U,G||F||T?u(A)?O=A:c(A)?O=i(A):F?(q=!1,O=n(U,!0)):T?(q=!1,O=r(U,!0)):O=[]:m(U)||l(U)?(O=A,l(A)?O=N(A):(!d(A)||p(A))&&(O=o(U))):q=!1}q&&(P.set(U,O),C(O,U,E,I,P),P.delete(U)),e(b,k,O)}return og=_,og}var ag,Nk;function A4(){if(Nk)return ag;Nk=1;var e=qu(),n=_R(),r=dy(),i=T4(),o=Ln(),l=di(),u=bR();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 ag=c,ag}var lg,Ck;function I4(){if(Ck)return lg;Ck=1;var e=Yu(),n=Ku();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 lg=r,lg}var ug,Rk;function M4(){if(Rk)return ug;Rk=1;var e=A4(),n=I4(),r=n(function(i,o,l){e(i,o,l)});return ug=r,ug}var cg,jk;function SR(){if(jk)return cg;jk=1;function e(n,r){return n<r}return cg=e,cg}var dg,Tk;function O4(){if(Tk)return dg;Tk=1;var e=vy(),n=SR(),r=fi();function i(o){return o&&o.length?e(o,r,n):void 0}return dg=i,dg}var fg,Ak;function P4(){if(Ak)return fg;Ak=1;var e=vy(),n=Vr(),r=SR();function i(o,l){return o&&o.length?e(o,n(l,2),r):void 0}return fg=i,fg}var hg,Ik;function L4(){if(Ik)return hg;Ik=1;var e=nr(),n=function(){return e.Date.now()};return hg=n,hg}var pg,Mk;function q4(){if(Mk)return pg;Mk=1;var e=Du(),n=Vu(),r=Fu(),i=Ln(),o=Ba();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 b=w[N];_=p?p(b,N,w):void 0,_===void 0&&(_=i(b)?b:r(c[d+1])?[]:{})}e(w,N,_),w=w[N]}return u}return pg=l,pg}var mg,Ok;function $4(){if(Ok)return mg;Ok=1;var e=Gu(),n=q4(),r=Vu();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 mg=i,mg}var gg,Pk;function D4(){if(Pk)return gg;Pk=1;var e=$4(),n=tR();function r(i,o){return e(i,o,function(l,u){return n(i,u)})}return gg=r,gg}var vg,Lk;function F4(){if(Lk)return vg;Lk=1;var e=xR(),n=uR(),r=cR();function i(o){return r(n(o,void 0,e),o+"")}return vg=i,vg}var yg,qk;function z4(){if(qk)return yg;qk=1;var e=D4(),n=F4(),r=n(function(i,o){return i==null?{}:e(i,o)});return yg=r,yg}var wg,$k;function B4(){if($k)return wg;$k=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 wg=r,wg}var xg,Dk;function U4(){if(Dk)return xg;Dk=1;var e=B4(),n=Ku(),r=wR();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 xg=i,xg}var _g,Fk;function H4(){if(Fk)return _g;Fk=1;var e=U4(),n=e();return _g=n,_g}var bg,zk;function W4(){if(zk)return bg;zk=1;function e(n,r){var i=n.length;for(n.sort(r);i--;)n[i]=n[i].value;return n}return bg=e,bg}var Sg,Bk;function V4(){if(Bk)return Sg;Bk=1;var e=Eo();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 Sg=n,Sg}var kg,Uk;function G4(){if(Uk)return kg;Uk=1;var e=V4();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 kg=n,kg}var Eg,Hk;function Y4(){if(Hk)return Eg;Hk=1;var e=Wu(),n=Gu(),r=Vr(),i=oR(),o=W4(),l=zu(),u=G4(),c=fi(),h=bt();function p(d,m,y){m.length?m=e(m,function(_){return h(_)?function(b){return n(b,_.length===1?_[0]:_)}:_}):m=[c];var w=-1;m=e(m,l(r));var N=i(d,function(_,b,S){var k=e(m,function(E){return E(_)});return{criteria:k,index:++w,value:_}});return o(N,function(_,b){return u(_,b,y)})}return Eg=p,Eg}var Ng,Wk;function K4(){if(Wk)return Ng;Wk=1;var e=my(),n=Y4(),r=Yu(),i=Ku(),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 Ng=o,Ng}var Cg,Vk;function X4(){if(Vk)return Cg;Vk=1;var e=JC(),n=0;function r(i){var o=++n;return e(i)+o}return Cg=r,Cg}var Rg,Gk;function Q4(){if(Gk)return Rg;Gk=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 Rg=e,Rg}var jg,Yk;function Z4(){if(Yk)return jg;Yk=1;var e=Du(),n=Q4();function r(i,o){return n(i||[],o||[],e)}return jg=r,jg}var Tg,Kk;function it(){if(Kk)return Tg;Kk=1;var e;if(typeof ey=="function")try{e={cloneDeep:p4(),constant:cy(),defaults:m4(),each:VC(),filter:rR(),find:b4(),flatten:xR(),forEach:WC(),forIn:S4(),has:sR(),isUndefined:iR(),last:k4(),map:aR(),mapValues:E4(),max:C4(),merge:M4(),min:O4(),minBy:P4(),now:L4(),pick:z4(),range:H4(),reduce:lR(),sortBy:K4(),uniqueId:X4(),values:hR(),zipObject:Z4()}}catch{}return e||(e=window._),Tg=e,Tg}var Ag,Xk;function J4(){if(Xk)return Ag;Xk=1,Ag=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 Ag}var Ig,Qk;function eD(){if(Qk)return Ig;Qk=1;var e=it(),n=er().Graph,r=J4();Ig=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 b=d.length-2;b>0;--b)if(_=d[b].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 b=p.edge(_),S=p.node(_.v);w&&N.push({v:_.v,w:_.w}),S.out-=b,h(d,m,S)}),e.forEach(p.outEdges(y.v),function(_){var b=p.edge(_),S=_.w,k=p.node(S);k.in-=b,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(b){m.setNode(b,{v:b,in:0,out:0})}),e.forEach(p.edges(),function(b){var S=m.edge(b.v,b.w)||0,k=d(b),E=S+k;m.setEdge(b.v,b.w,E),w=Math.max(w,m.node(b.v).out+=k),y=Math.max(y,m.node(b.w).in+=k)});var N=e.range(w+y+3).map(function(){return new r}),_=y+1;return e.forEach(m.nodes(),function(b){h(N,_,m.node(b))}),{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 Ig}var Mg,Zk;function tD(){if(Zk)return Mg;Zk=1;var e=it(),n=eD();Mg={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 Mg}var Og,Jk;function hn(){if(Jk)return Og;Jk=1;var e=it(),n=er().Graph;Og={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(b,S,k,E){var C;do C=e.uniqueId(E);while(b.hasNode(C));return k.dummy=S,b.setNode(C,k),C}function i(b){var S=new n().setGraph(b.graph());return e.forEach(b.nodes(),function(k){S.setNode(k,b.node(k))}),e.forEach(b.edges(),function(k){var E=S.edge(k.v,k.w)||{weight:0,minlen:1},C=b.edge(k);S.setEdge(k.v,k.w,{weight:E.weight+C.weight,minlen:Math.max(E.minlen,C.minlen)})}),S}function o(b){var S=new n({multigraph:b.isMultigraph()}).setGraph(b.graph());return e.forEach(b.nodes(),function(k){b.children(k).length||S.setNode(k,b.node(k))}),e.forEach(b.edges(),function(k){S.setEdge(k,b.edge(k))}),S}function l(b){var S=e.map(b.nodes(),function(k){var E={};return e.forEach(b.outEdges(k),function(C){E[C.w]=(E[C.w]||0)+b.edge(C).weight}),E});return e.zipObject(b.nodes(),S)}function u(b){var S=e.map(b.nodes(),function(k){var E={};return e.forEach(b.inEdges(k),function(C){E[C.v]=(E[C.v]||0)+b.edge(C).weight}),E});return e.zipObject(b.nodes(),S)}function c(b,S){var k=b.x,E=b.y,C=S.x-k,I=S.y-E,P=b.width/2,A=b.height/2;if(!C&&!I)throw new Error("Not possible to find intersection inside of the rectangle");var U,L;return Math.abs(I)*P>Math.abs(C)*A?(I<0&&(A=-A),U=A*C/I,L=A):(C<0&&(P=-P),U=P,L=P*I/C),{x:k+U,y:E+L}}function h(b){var S=e.map(e.range(y(b)+1),function(){return[]});return e.forEach(b.nodes(),function(k){var E=b.node(k),C=E.rank;e.isUndefined(C)||(S[C][E.order]=k)}),S}function p(b){var S=e.min(e.map(b.nodes(),function(k){return b.node(k).rank}));e.forEach(b.nodes(),function(k){var E=b.node(k);e.has(E,"rank")&&(E.rank-=S)})}function d(b){var S=e.min(e.map(b.nodes(),function(I){return b.node(I).rank})),k=[];e.forEach(b.nodes(),function(I){var P=b.node(I).rank-S;k[P]||(k[P]=[]),k[P].push(I)});var E=0,C=b.graph().nodeRankFactor;e.forEach(k,function(I,P){e.isUndefined(I)&&P%C!==0?--E:E&&e.forEach(I,function(A){b.node(A).rank+=E})})}function m(b,S,k,E){var C={width:0,height:0};return arguments.length>=4&&(C.rank=k,C.order=E),r(b,"border",C,S)}function y(b){return e.max(e.map(b.nodes(),function(S){var k=b.node(S).rank;if(!e.isUndefined(k))return k}))}function w(b,S){var k={lhs:[],rhs:[]};return e.forEach(b,function(E){S(E)?k.lhs.push(E):k.rhs.push(E)}),k}function N(b,S){var k=e.now();try{return S()}finally{console.log(b+" time: "+(e.now()-k)+"ms")}}function _(b,S){return S()}return Og}var Pg,eE;function nD(){if(eE)return Pg;eE=1;var e=it(),n=hn();Pg={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,_,b;for(b=0,++h;h<d;++b,++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),b===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 Pg}var Lg,tE;function Su(){if(tE)return Lg;tE=1;var e=it();Lg={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 Lg}var qg,nE;function kR(){if(nE)return qg;nE=1;var e=it(),n=er().Graph,r=Su().slack;qg=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 qg}var $g,rE;function rD(){if(rE)return $g;rE=1;var e=it(),n=kR(),r=Su().slack,i=Su().longestPath,o=er().alg.preorder,l=er().alg.postorder,u=hn().simplify;$g=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 I,P;I=w(C);)P=N(C,E,I),_(C,E,I,P)}function h(E,C){var I=l(E,E.nodes());I=I.slice(0,I.length-1),e.forEach(I,function(P){p(E,C,P)})}function p(E,C,I){var P=E.node(I),A=P.parent;E.edge(I,A).cutvalue=d(E,C,I)}function d(E,C,I){var P=E.node(I),A=P.parent,U=!0,L=C.edge(I,A),O=0;return L||(U=!1,L=C.edge(A,I)),O=L.weight,e.forEach(C.nodeEdges(I),function(q){var G=q.v===I,F=G?q.w:q.v;if(F!==A){var T=G===U,B=C.edge(q).weight;if(O+=T?B:-B,S(E,I,F)){var z=E.edge(I,F).cutvalue;O+=T?-z:z}}}),O}function m(E,C){arguments.length<2&&(C=E.nodes()[0]),y(E,{},1,C)}function y(E,C,I,P,A){var U=I,L=E.node(P);return C[P]=!0,e.forEach(E.neighbors(P),function(O){e.has(C,O)||(I=y(E,C,I,O,P))}),L.low=U,L.lim=I++,A?L.parent=A:delete L.parent,I}function w(E){return e.find(E.edges(),function(C){return E.edge(C).cutvalue<0})}function N(E,C,I){var P=I.v,A=I.w;C.hasEdge(P,A)||(P=I.w,A=I.v);var U=E.node(P),L=E.node(A),O=U,q=!1;U.lim>L.lim&&(O=L,q=!0);var G=e.filter(C.edges(),function(F){return q===k(E,E.node(F.v),O)&&q!==k(E,E.node(F.w),O)});return e.minBy(G,function(F){return r(C,F)})}function _(E,C,I,P){var A=I.v,U=I.w;E.removeEdge(A,U),E.setEdge(P.v,P.w,{}),m(E),h(E,C),b(E,C)}function b(E,C){var I=e.find(E.nodes(),function(A){return!C.node(A).parent}),P=o(E,I);P=P.slice(1),e.forEach(P,function(A){var U=E.node(A).parent,L=C.edge(A,U),O=!1;L||(L=C.edge(U,A),O=!0),C.node(A).rank=C.node(U).rank+(O?L.minlen:-L.minlen)})}function S(E,C,I){return E.hasEdge(C,I)}function k(E,C,I){return I.low<=C.lim&&C.lim<=I.lim}return $g}var Dg,sE;function sD(){if(sE)return Dg;sE=1;var e=Su(),n=e.longestPath,r=kR(),i=rD();Dg=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 Dg}var Fg,iE;function iD(){if(iE)return Fg;iE=1;var e=it();Fg=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 Fg}var zg,oE;function oD(){if(oE)return zg;oE=1;var e=it(),n=hn();zg={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"),b=n.addBorderNode(c,"_bb"),S=c.node(w);c.setParent(_,w),S.borderTop=_,c.setParent(b,w),S.borderBottom=b,e.forEach(N,function(k){i(c,h,p,d,m,y,k);var E=c.node(k),C=E.borderTop?E.borderTop:k,I=E.borderBottom?E.borderBottom:k,P=E.borderTop?d:2*d,A=C!==I?1:m-y[w]+1;c.setEdge(_,C,{weight:P,minlen:A,nestingEdge:!0}),c.setEdge(I,b,{weight:P,minlen:A,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 zg}var Bg,aE;function aD(){if(aE)return Bg;aE=1;var e=it(),n=hn();Bg=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 Bg}var Ug,lE;function lD(){if(lE)return Ug;lE=1;var e=it();Ug={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 Ug}var Hg,uE;function uD(){if(uE)return Hg;uE=1;var e=it();Hg=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 Hg}var Wg,cE;function cD(){if(cE)return Wg;cE=1;var e=it();Wg=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 Wg}var Vg,dE;function dD(){if(dE)return Vg;dE=1;var e=it();Vg=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 Vg}var Gg,fE;function fD(){if(fE)return Gg;fE=1;var e=it();Gg=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 Gg}var Yg,hE;function hD(){if(hE)return Yg;hE=1;var e=it(),n=hn();Yg=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 Yg}var Kg,pE;function pD(){if(pE)return Kg;pE=1;var e=it(),n=dD(),r=fD(),i=hD();Kg=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(I){return I!==w&&I!==N}));var b=n(c,m);e.forEach(b,function(I){if(c.children(I.v).length){var P=o(c,I.v,p,d);_[I.v]=P,e.has(P,"barycenter")&&u(I,P)}});var S=r(b,p);l(S,_);var k=i(S,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 Kg}var Xg,mE;function mD(){if(mE)return Xg;mE=1;var e=it(),n=er().Graph;Xg=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 Xg}var Qg,gE;function gD(){if(gE)return Qg;gE=1;var e=it();Qg=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 Qg}var Zg,vE;function vD(){if(vE)return Zg;vE=1;var e=it(),n=uD(),r=cD(),i=pD(),o=mD(),l=gD(),u=er().Graph,c=hn();Zg=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"),b=n(y);m(y,b);for(var S=Number.POSITIVE_INFINITY,k,E=0,C=0;C<4;++E,++C){d(E%2?N:_,E%4>=2),b=c.buildLayerMatrix(y);var I=r(y,b);I<S&&(C=0,k=e.cloneDeep(b),S=I)}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 b=_.graph().root,S=i(_,b,N,w);e.forEach(S.vs,function(k,E){_.node(k).order=E}),l(_,N,S.vs)})}function m(y,w){e.forEach(w,function(N){e.forEach(N,function(_,b){y.node(_).order=b})})}return Zg}var Jg,yE;function yD(){if(yE)return Jg;yE=1;var e=it(),n=er().Graph,r=hn();Jg={positionX:N,findType1Conflicts:i,findType2Conflicts:o,addConflict:u,hasConflict:c,verticalAlignment:h,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:m,balance:w};function i(S,k){var E={};function C(I,P){var A=0,U=0,L=I.length,O=e.last(P);return e.forEach(P,function(q,G){var F=l(S,q),T=F?S.node(F).order:L;(F||q===O)&&(e.forEach(P.slice(U,G+1),function(B){e.forEach(S.predecessors(B),function(z){var ne=S.node(z),Z=ne.order;(Z<A||T<Z)&&!(ne.dummy&&S.node(B).dummy)&&u(E,z,B)})}),U=G+1,A=T)}),P}return e.reduce(k,C),E}function o(S,k){var E={};function C(P,A,U,L,O){var q;e.forEach(e.range(A,U),function(G){q=P[G],S.node(q).dummy&&e.forEach(S.predecessors(q),function(F){var T=S.node(F);T.dummy&&(T.order<L||T.order>O)&&u(E,F,q)})})}function I(P,A){var U=-1,L,O=0;return e.forEach(A,function(q,G){if(S.node(q).dummy==="border"){var F=S.predecessors(q);F.length&&(L=S.node(F[0]).order,C(A,O,G,U,L),O=G,U=L)}C(A,O,A.length,L,P.length)}),A}return e.reduce(k,I),E}function l(S,k){if(S.node(k).dummy)return e.find(S.predecessors(k),function(E){return S.node(E).dummy})}function u(S,k,E){if(k>E){var C=k;k=E,E=C}var I=S[k];I||(S[k]=I={}),I[E]=!0}function c(S,k,E){if(k>E){var C=k;k=E,E=C}return e.has(S[k],E)}function h(S,k,E,C){var I={},P={},A={};return e.forEach(k,function(U){e.forEach(U,function(L,O){I[L]=L,P[L]=L,A[L]=O})}),e.forEach(k,function(U){var L=-1;e.forEach(U,function(O){var q=C(O);if(q.length){q=e.sortBy(q,function(z){return A[z]});for(var G=(q.length-1)/2,F=Math.floor(G),T=Math.ceil(G);F<=T;++F){var B=q[F];P[O]===O&&L<A[B]&&!c(E,O,B)&&(P[B]=O,P[O]=I[O]=I[B],L=A[B])}}})}),{root:I,align:P}}function p(S,k,E,C,I){var P={},A=d(S,k,E,I),U=I?"borderLeft":"borderRight";function L(G,F){for(var T=A.nodes(),B=T.pop(),z={};B;)z[B]?G(B):(z[B]=!0,T.push(B),T=T.concat(F(B))),B=T.pop()}function O(G){P[G]=A.inEdges(G).reduce(function(F,T){return Math.max(F,P[T.v]+A.edge(T))},0)}function q(G){var F=A.outEdges(G).reduce(function(B,z){return Math.min(B,P[z.w]-A.edge(z))},Number.POSITIVE_INFINITY),T=S.node(G);F!==Number.POSITIVE_INFINITY&&T.borderType!==U&&(P[G]=Math.max(P[G],F))}return L(O,A.predecessors.bind(A)),L(q,A.successors.bind(A)),e.forEach(C,function(G){P[G]=P[E[G]]}),P}function d(S,k,E,C){var I=new n,P=S.graph(),A=_(P.nodesep,P.edgesep,C);return e.forEach(k,function(U){var L;e.forEach(U,function(O){var q=E[O];if(I.setNode(q),L){var G=E[L],F=I.edge(G,q);I.setEdge(G,q,Math.max(A(S,O,L),F||0))}L=O})}),I}function m(S,k){return e.minBy(e.values(k),function(E){var C=Number.NEGATIVE_INFINITY,I=Number.POSITIVE_INFINITY;return e.forIn(E,function(P,A){var U=b(S,A)/2;C=Math.max(P+U,C),I=Math.min(P-U,I)}),C-I})}function y(S,k){var E=e.values(k),C=e.min(E),I=e.max(E);e.forEach(["u","d"],function(P){e.forEach(["l","r"],function(A){var U=P+A,L=S[U],O;if(L!==k){var q=e.values(L);O=A==="l"?C-e.min(q):I-e.max(q),O&&(S[U]=e.mapValues(L,function(G){return G+O}))}})})}function w(S,k){return e.mapValues(S.ul,function(E,C){if(k)return S[k.toLowerCase()][C];var I=e.sortBy(e.map(S,C));return(I[1]+I[2])/2})}function N(S){var k=r.buildLayerMatrix(S),E=e.merge(i(S,k),o(S,k)),C={},I;e.forEach(["u","d"],function(A){I=A==="u"?k:e.values(k).reverse(),e.forEach(["l","r"],function(U){U==="r"&&(I=e.map(I,function(G){return e.values(G).reverse()}));var L=(A==="u"?S.predecessors:S.successors).bind(S),O=h(S,I,E,L),q=p(S,I,O.root,O.align,U==="r");U==="r"&&(q=e.mapValues(q,function(G){return-G})),C[A+U]=q})});var P=m(S,C);return y(C,P),w(C,S.graph().align)}function _(S,k,E){return function(C,I,P){var A=C.node(I),U=C.node(P),L=0,O;if(L+=A.width/2,e.has(A,"labelpos"))switch(A.labelpos.toLowerCase()){case"l":O=-A.width/2;break;case"r":O=A.width/2;break}if(O&&(L+=E?O:-O),O=0,L+=(A.dummy?k:S)/2,L+=(U.dummy?k:S)/2,L+=U.width/2,e.has(U,"labelpos"))switch(U.labelpos.toLowerCase()){case"l":O=U.width/2;break;case"r":O=-U.width/2;break}return O&&(L+=E?O:-O),O=0,L}}function b(S,k){return S.node(k).width}return Jg}var ev,wE;function wD(){if(wE)return ev;wE=1;var e=it(),n=hn(),r=yD().positionX;ev=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 ev}var tv,xE;function xD(){if(xE)return tv;xE=1;var e=it(),n=tD(),r=nD(),i=sD(),o=hn().normalizeRanks,l=iD(),u=hn().removeEmptyRanks,c=oD(),h=aD(),p=lD(),d=vD(),m=wD(),y=hn(),w=er().Graph;tv=N;function N(H,J){var re=J&&J.debugTiming?y.time:y.notime;re("layout",function(){var le=re(" buildLayoutGraph",function(){return L(H)});re(" runLayout",function(){_(le,re)}),re(" updateInputGraph",function(){b(H,le)})})}function _(H,J){J(" makeSpaceForEdgeLabels",function(){O(H)}),J(" removeSelfEdges",function(){$(H)}),J(" acyclic",function(){n.run(H)}),J(" nestingGraph.run",function(){c.run(H)}),J(" rank",function(){i(y.asNonCompoundGraph(H))}),J(" injectEdgeLabelProxies",function(){q(H)}),J(" removeEmptyRanks",function(){u(H)}),J(" nestingGraph.cleanup",function(){c.cleanup(H)}),J(" normalizeRanks",function(){o(H)}),J(" assignRankMinMax",function(){G(H)}),J(" removeEdgeLabelProxies",function(){F(H)}),J(" normalize.run",function(){r.run(H)}),J(" parentDummyChains",function(){l(H)}),J(" addBorderSegments",function(){h(H)}),J(" order",function(){d(H)}),J(" insertSelfEdges",function(){Q(H)}),J(" adjustCoordinateSystem",function(){p.adjust(H)}),J(" position",function(){m(H)}),J(" positionSelfEdges",function(){M(H)}),J(" removeBorderNodes",function(){Z(H)}),J(" normalize.undo",function(){r.undo(H)}),J(" fixupEdgeLabelCoords",function(){z(H)}),J(" undoCoordinateSystem",function(){p.undo(H)}),J(" translateGraph",function(){T(H)}),J(" assignNodeIntersects",function(){B(H)}),J(" reversePoints",function(){ne(H)}),J(" acyclic.undo",function(){n.undo(H)})}function b(H,J){e.forEach(H.nodes(),function(re){var le=H.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(H.edges(),function(re){var le=H.edge(re),fe=J.edge(re);le.points=fe.points,e.has(fe,"x")&&(le.x=fe.x,le.y=fe.y)}),H.graph().width=J.graph().width,H.graph().height=J.graph().height}var S=["nodesep","edgesep","ranksep","marginx","marginy"],k={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},E=["acyclicer","ranker","rankdir","align"],C=["width","height"],I={width:0,height:0},P=["minlen","weight","width","height","labeloffset"],A={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},U=["labelpos"];function L(H){var J=new w({multigraph:!0,compound:!0}),re=Y(H.graph());return J.setGraph(e.merge({},k,V(re,S),e.pick(re,E))),e.forEach(H.nodes(),function(le){var fe=Y(H.node(le));J.setNode(le,e.defaults(V(fe,C),I)),J.setParent(le,H.parent(le))}),e.forEach(H.edges(),function(le){var fe=Y(H.edge(le));J.setEdge(le,e.merge({},A,V(fe,P),e.pick(fe,U)))}),J}function O(H){var J=H.graph();J.ranksep/=2,e.forEach(H.edges(),function(re){var le=H.edge(re);le.minlen*=2,le.labelpos.toLowerCase()!=="c"&&(J.rankdir==="TB"||J.rankdir==="BT"?le.width+=le.labeloffset:le.height+=le.labeloffset)})}function q(H){e.forEach(H.edges(),function(J){var re=H.edge(J);if(re.width&&re.height){var le=H.node(J.v),fe=H.node(J.w),te={rank:(fe.rank-le.rank)/2+le.rank,e:J};y.addDummyNode(H,"edge-proxy",te,"_ep")}})}function G(H){var J=0;e.forEach(H.nodes(),function(re){var le=H.node(re);le.borderTop&&(le.minRank=H.node(le.borderTop).rank,le.maxRank=H.node(le.borderBottom).rank,J=e.max(J,le.maxRank))}),H.graph().maxRank=J}function F(H){e.forEach(H.nodes(),function(J){var re=H.node(J);re.dummy==="edge-proxy"&&(H.edge(re.e).labelRank=re.rank,H.removeNode(J))})}function T(H){var J=Number.POSITIVE_INFINITY,re=0,le=Number.POSITIVE_INFINITY,fe=0,te=H.graph(),ce=te.marginx||0,Ce=te.marginy||0;function ve(Te){var ye=Te.x,ke=Te.y,Ke=Te.width,we=Te.height;J=Math.min(J,ye-Ke/2),re=Math.max(re,ye+Ke/2),le=Math.min(le,ke-we/2),fe=Math.max(fe,ke+we/2)}e.forEach(H.nodes(),function(Te){ve(H.node(Te))}),e.forEach(H.edges(),function(Te){var ye=H.edge(Te);e.has(ye,"x")&&ve(ye)}),J-=ce,le-=Ce,e.forEach(H.nodes(),function(Te){var ye=H.node(Te);ye.x-=J,ye.y-=le}),e.forEach(H.edges(),function(Te){var ye=H.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 B(H){e.forEach(H.edges(),function(J){var re=H.edge(J),le=H.node(J.v),fe=H.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(H){e.forEach(H.edges(),function(J){var re=H.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(H){e.forEach(H.edges(),function(J){var re=H.edge(J);re.reversed&&re.points.reverse()})}function Z(H){e.forEach(H.nodes(),function(J){if(H.children(J).length){var re=H.node(J),le=H.node(re.borderTop),fe=H.node(re.borderBottom),te=H.node(e.last(re.borderLeft)),ce=H.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(H.nodes(),function(J){H.node(J).dummy==="border"&&H.removeNode(J)})}function $(H){e.forEach(H.edges(),function(J){if(J.v===J.w){var re=H.node(J.v);re.selfEdges||(re.selfEdges=[]),re.selfEdges.push({e:J,label:H.edge(J)}),H.removeEdge(J)}})}function Q(H){var J=y.buildLayerMatrix(H);e.forEach(J,function(re){var le=0;e.forEach(re,function(fe,te){var ce=H.node(fe);ce.order=te+le,e.forEach(ce.selfEdges,function(Ce){y.addDummyNode(H,"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 M(H){e.forEach(H.nodes(),function(J){var re=H.node(J);if(re.dummy==="selfedge"){var le=H.node(re.e.v),fe=le.x+le.width/2,te=le.y,ce=re.x-fe,Ce=le.height/2;H.setEdge(re.e,re.label),H.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 V(H,J){return e.mapValues(e.pick(H,J),Number)}function Y(H){var J={};return e.forEach(H,function(re,le){J[le.toLowerCase()]=re}),J}return tv}var nv,_E;function _D(){if(_E)return nv;_E=1;var e=it(),n=hn(),r=er().Graph;nv={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 nv}var rv,bE;function bD(){return bE||(bE=1,rv="0.8.5"),rv}var sv,SE;function SD(){return SE||(SE=1,sv={graphlib:er(),layout:xD(),debug:_D(),util:{time:hn().time,notime:hn().notime},version:bD()}),sv}var kD=SD();const kE=Av(kD),wo=240,ku=130,ho=74,Xu=72,EE=ho+Xu;function ED(e,n){var i;let r=wo;for(const o of e)r=Math.max(r,((i=n.get(o.id))==null?void 0:i.width)??wo);return r}const ER=420,ND=2;function Ta(e){var r;return((r=e.data)==null?void 0:r.sessionId)??"_default"}function CD(e,n){return((n==null?void 0:n.get(e))??0)>0?ER:0}function RD(e,n){const r=(n==null?void 0:n.get(e))??0;return r>0?6+r*36:0}function Aa(e,n,r){const i=n.get(e);return{w:((i==null?void 0:i.width)??wo)+CD(e,r),h:Math.max((i==null?void 0:i.height)??ku,RD(e,r))}}function jD(e){return[...e.keys()].sort().map(n=>`${n}:${e.get(n)}`).join("|")}function TD(e,n,r,i,o,l){const u=new kE.graphlib.Graph;u.setDefaultEdgeLabel(()=>({})),u.setGraph({rankdir:r,marginx:0,marginy:0,nodesep:70,ranksep:160,edgesep:30});const c=e.filter(S=>!o.has(S)),h=new Set(c);for(const S of c){const{w:k,h:E}=Aa(S,i,l);u.setNode(S,{width:k,height:E})}for(const S of n)h.has(S.source)&&h.has(S.target)&&u.setEdge(S.source,S.target);kE.layout(u);const p=new Map;let d=1/0,m=1/0,y=-1/0,w=-1/0;for(const S of c){const k=u.node(S);if(!k)continue;const E=i.get(S),C=(E==null?void 0:E.width)??wo,I=(E==null?void 0:E.height)??ku,P=Aa(S,i,l),A=k.x-P.w/2,U=k.y-P.h/2;p.set(S,{x:A,y:U}),A<d&&(d=A),U<m&&(m=U),A+C>y&&(y=A+C),U+I>w&&(w=U+I)}if(Number.isFinite(d)&&Number.isFinite(m))for(const[S,k]of p)p.set(S,{x:k.x-d,y:k.y-m});const N=Number.isFinite(y)?y-d:0,_=Number.isFinite(w)?w-m:0;let b=null;for(const S of e){const k=o.get(S);if(!k)continue;const E=i.get(S),C=(E==null?void 0:E.width)??wo,I=(E==null?void 0:E.height)??ku;b=b===null?{minX:k.x,minY:k.y,maxX:k.x+C,maxY:k.y+I}:{minX:Math.min(b.minX,k.x),minY:Math.min(b.minY,k.y),maxX:Math.max(b.maxX,k.x+C),maxY:Math.max(b.maxY,k.y+I)}}return{positions:p,width:N,height:_,pinnedBox:b}}function AD(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 S of e){const k=Ta(S),E=c.get(k);E?E.push(S.id):c.set(k,[S.id])}const p=Array.from(c.keys()).sort().map(S=>({sid:S,...TD(c.get(S),n,i,l,o,u)})),d=ED(e,l),m=r.availableHeight&&r.availableHeight>0?r.availableHeight:Number.POSITIVE_INFINITY,y=S=>{const k=[[]];let E=0;for(const C of p)k.length<S&&E>0&&E+C.height>m&&(k.push([]),E=0),k[k.length-1].push(C),E+=C.height+EE;return k},w=S=>S.reduce((k,E)=>Math.max(k,E.width),0)+ER;let N=y(r.availableWidth?ND: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 b=0;for(const S of N){const k=w(S);let E=0;for(const{positions:C,height:I,pinnedBox:P}of S){for(const[U,L]of C)_.set(U,{x:L.x+b,y:L.y+E});let A=E+I;P&&P.maxY>A&&P.minX<b+k&&b<P.maxX&&(A=P.maxY),E=A+EE}b+=k+d}return e.map(S=>{const k=o.get(S.id);if(k)return{...S,position:k};const E=_.get(S.id);return E?{...S,position:E}:S})}function ID(e,n,r,i,o){const u=ho+Xu,c=60,h=w=>Aa(w,i,o),p=new Map(e.map(w=>[w.id,Ta(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:b}=h(w),S=p.get(w)??"_default";if(r.has(w)){d.push({x:N.x,y:N.y,w:_,h:b,sid:S});continue}let k=N.y;for(let E=0;E<d.length+1;E++){const C=d.find(I=>{const P=I.sid===S?24:c,A=I.sid===S?24:u;return N.x<I.x+I.w+P&&I.x<N.x+_+P&&k<I.y+I.h+A&&I.y<k+b+A});if(!C)break;k=C.y+C.h+(C.sid===S?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:b,sid:S})}return y}function MD(e,n,r,i,o,l){const u=_=>Aa(_,i,l),c=_=>r.get(_)??n.get(_),h=new Map;for(const _ of e){if(!c(_.id))continue;const b=Ta(_),S=h.get(b);S?S.push(_):h.set(b,[_])}const p=new Set;for(const[_,b]of h)b.every(S=>o.has(S.id)&&!r.has(S.id))&&p.add(_);const d=new Map,m=[];for(const _ of e){const b=c(_.id);if(!b)continue;const{w:S,h:k}=u(_.id),E=Ta(_);p.has(E)?(d.get(E)??d.set(E,[]).get(E)).push(_):m.push({x:b.x,y:b.y,w:S,h:k})}if(d.size===0)return[];const y=ho+Xu,w=(_,b,S,k)=>m.some(E=>_<E.x+E.w+ho&&E.x<_+S+ho&&b<E.y+E.h+y&&E.y<b+k+y),N=[];for(const _ of[...d.keys()].sort()){const b=d.get(_);let S=1/0,k=1/0,E=-1/0,C=-1/0;for(const q of b){const G=c(q.id),{w:F,h:T}=u(q.id);S=Math.min(S,G.x),k=Math.min(k,G.y),E=Math.max(E,G.x+F),C=Math.max(C,G.y+T)}const I=E-S,P=C-k,A=[...new Set(m.map(q=>Math.round(q.x)))].sort((q,G)=>q-G),U=A.length?A:[S],L=[0,...m.map(q=>q.y+q.h+y)].sort((q,G)=>q-G);let O=null;e:for(const q of U)for(const G of L){if(G>=k)break;if(!w(q,G,I,P)){O={x:q,y:G};break e}}if(O){const q=O.x-S,G=O.y-k;for(const F of b){const T=c(F.id);n.set(F.id,{x:T.x+q,y:T.y+G})}N.push(_)}for(const q of b){const G=c(q.id),{w:F,h:T}=u(q.id);m.push({x:G.x,y:G.y,w:F,h:T})}}return N}function OD(e,n,r,i,o,l=!1,u){const p=ho+Xu+1,d=8,m=1.75,y=200,w=.7,N=.01,_=O=>Aa(O,i,u),b=O=>r.get(O)??n.get(O),S=new Map;for(const O of e){if(!b(O.id))continue;const q=Ta(O),G=S.get(q);G?G.push(O):S.set(q,[O])}const k=[],E=new Set,C=new Set,I=o.size===0;for(const O of[...S.keys()].sort()){const q=S.get(O);let G=1/0,F=1/0,T=-1/0,B=-1/0,z=!1;for(const Q of q){const M=b(Q.id),{w:V,h:Y}=_(Q.id);G=Math.min(G,M.x),F=Math.min(F,M.y),T=Math.max(T,M.x+V),B=Math.max(B,M.y+Y),r.has(Q.id)&&(z=!0)}const ne=T-G,Z=B-F;C.add(O);const $=o.get(O);$&&(ne>$.w+d||Z>$.h+d)&&E.add(O),o.set(O,{w:ne,h:Z}),k.push({sid:O,members:q.map(Q=>Q.id),x:G,y:F,w:ne,h:Z,anchored:z,mass:1})}for(const O of[...o.keys()])C.has(O)||o.delete(O);if(l||I)return[];let P=!1;for(let O=0;O<k.length&&!P;O++)for(let q=O+1;q<k.length;q++){const G=k[O],F=k[q];if(!(G.anchored&&F.anchored)&&Math.abs(G.x+G.w/2-(F.x+F.w/2))<(G.w+F.w)/2+61&&Math.abs(G.y+G.h/2-(F.y+F.h/2))<(G.h+F.h)/2+p){P=!0;break}}if(E.size===0&&!P)return[];if(E.size>0)for(const O of k)E.has(O.sid)&&(O.mass=8);else for(const O of k)O.mass=Math.max(1,O.w*O.h/(wo*ku));const A=new Map(k.map(O=>[O.sid,O.x])),U=new Map(k.map(O=>[O.sid,O.y]));for(let O=0;O<y;O++){const q=new Map,G=new Map;let F=0;for(let T=0;T<k.length;T++)for(let B=T+1;B<k.length;B++){const z=k[T],ne=k[B];if(z.anchored&&ne.anchored)continue;const Z=z.x+z.w/2,$=z.y+z.h/2,Q=ne.x+ne.w/2,M=ne.y+ne.h/2,V=(z.w+ne.w)/2+61-Math.abs(Z-Q),Y=(z.h+ne.h)/2+p-Math.abs($-M);if(V<=0||Y<=0)continue;const H=($e,Je)=>!$e.anchored&&!(Je<0&&$e.x<=0),J=($e,Je)=>!$e.anchored&&!(Je<0&&$e.y<=0),re=($e,Je,Xe)=>{const vt=$e===Je,ot=vt?z.sid<ne.sid?-1:1:Math.sign($e-Je);return Xe(z,ot)||Xe(ne,-ot)?ot:vt&&(Xe(z,-ot)||Xe(ne,ot))?-ot:0},le=re(Z,Q,H),fe=re($,M,J),te=le!==0,ce=fe!==0;if(!te&&!ce)continue;const Ce=te&&(!ce||V*m<Y),[ve,Te,ye,ke]=Ce?[le,V,q,H]:[fe,Y,G,J],Ke=ke(z,ve),we=ke(ne,-ve),_e=z.mass,Be=ne.mass,ft=Ke?we?Be/(_e+Be):1:0,ht=we?Ke?_e/(_e+Be):1:0,We=Te*w;ye.set(z.sid,(ye.get(z.sid)??0)+ve*We*ft),ye.set(ne.sid,(ye.get(ne.sid)??0)-ve*We*ht),F+=We}for(const T of k)T.anchored||(T.x=Math.max(0,T.x+(q.get(T.sid)??0)),T.y=Math.max(0,T.y+(G.get(T.sid)??0)));if(F<N)break}const L=[];for(const O of k){const q=O.x-A.get(O.sid),G=O.y-U.get(O.sid);if(!(Math.abs(q)<1&&Math.abs(G)<1)){for(const F of O.members){if(r.has(F))continue;const T=n.get(F);T&&n.set(F,{x:T.x+q,y:T.y+G})}L.push(O.sid)}}return L}const PD=600;function Cv(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 LD(e,n){const r=new Set;for(const i of e.agents.values())Cv(i,n)&&r.add(i.id);return r}function qD(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 $D(e,n,r=0){if(!e)return!1;for(const i of n)if(qD(e,i,r))return!0;return!1}const NR="sessionGroup";function DD(e,n){var i;if(e.type===NR)return"transparent";const r=(i=e.data)==null?void 0:i.state;return n(r==="err"?"--err":r==="active"?"--inflight":"--ok")}const FD="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1).";function zD(e){if(e.checkDisabled)return FD;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 BD(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 UD(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 CR(e){const n=Math.max(0,Math.floor(e));return`${n} event${n===1?"":"s"}`}function HD(e){return e.connected?e.paused?{tone:"paused",label:"paused",title:e.held>0?`Connected — ${CR(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 WD(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:`${CR(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 RR(e,n){return e!==""&&n>0}function VD(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:RR(e,n)}}function Rv(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 GD(e,n){return e.getFullYear()===n.getFullYear()&&e.getMonth()===n.getMonth()&&e.getDate()===n.getDate()}function YD(e,n,r){const i=new Date(e),o=Rv(n-e);return{label:GD(i,new Date(n))?o:`${o} · ${i.toLocaleDateString(r,{month:"short",day:"numeric"})}`,title:i.toLocaleString(r,{dateStyle:"medium",timeStyle:"medium"})}}function ma(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const KD={agent:zP,sessionGroup:t3},jR="react-flow__node";function NE(e){var n,r;return!!e&&((r=(n=e.classList)==null?void 0:n.contains)==null?void 0:r.call(n,jR))===!0}function XD(e){try{const n=document.querySelector(`.${jR}[data-id="${CSS.escape(e)}"]`);n==null||n.focus({preventScroll:!0})}catch{}}const QD=420,iu=18,ZD=9e4,JD=200,e5=5*6e4,t5=6,n5=2*6e4,yy="agent-dag.layout",wy="agent-dag.viewport",TR="agent-dag.summariesDismissed",AR="agent-dag.sessionListOpen",IR="agent-dag.detailOpen",MR="agent-dag.usagePanelOpen",CE="agent-dag.accountsPanelOpen",RE="agent-dag.versionNoticeDismissed",jE="agent-dag.oldNameNoticeDismissed",r5=15*6e4,TE={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:"},AE="agent-dag.autoRestart",IE="agent-dag.bundleReloadedFor";function s5(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(AR)==="1"}catch{return!1}}function i5(e){if(!(typeof window>"u"))try{window.localStorage.setItem(AR,e?"1":"0")}catch{}}function o5(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(IR)==="1"}catch{return!1}}function a5(e){if(!(typeof window>"u"))try{window.localStorage.setItem(IR,e?"1":"0")}catch{}}function l5(){const e=kC(MR);return e===null?!0:e==="1"}function u5(e){if(!(typeof window>"u"))try{window.localStorage.setItem(MR,e?"1":"0")}catch{}}function c5(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(TR);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 ME(e){if(!(typeof window>"u"))try{const n=Array.from(e),r=n.length>200?n.slice(-200):n;window.localStorage.setItem(TR,JSON.stringify(r))}catch{}}function d5(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const n=window.localStorage.getItem(yy);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 iv(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(yy,JSON.stringify({v:2,positions:r,pins:Array.from(n.keys())}))}catch{}}function f5(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(wy);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 h5(e){if(!(typeof window>"u"))try{window.localStorage.setItem(wy,JSON.stringify(e))}catch{}}function OE(){if(!(typeof window>"u")){try{window.localStorage.removeItem(yy)}catch{}try{window.localStorage.removeItem(wy)}catch{}}}function p5(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=`${tn}-${p}-${n.slice(0,8)}.json`,document.body.appendChild(h),h.click(),document.body.removeChild(h),setTimeout(()=>URL.revokeObjectURL(c),1e3)}const jv={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},Tv={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},m5={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 OR(e){return e.startsWith("mcp__")?"mcp":m5[e]??"other"}function PR(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 g5(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 v5(e,n,r,i,o,l,u,c,h,p,d,m,y,w,N,_,b,S,k){const E=[],C=[],I=new Set;if(l)for(const F of e.agents.values())S.has(F.id)&&PR(F,l)&&I.add(F.id);const P=RR(l,I.size);for(const F of e.agents.values()){if(!S.has(F.id))continue;const T=P&&!I.has(F.id),B=F.exitAt!=null,z=b!=null&&!b.has(F.id),ne=[T?"rf-dim":"",B?"rf-exiting":"",z?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,Z=u.get(F.id);if(E.push({id:F.id,type:"agent",position:{x:0,y:0},data:{...F,now:n,onOpenContext:k},className:ne,...Z?{width:Z.width,height:Z.height}:null}),F.parentId&&S.has(F.parentId)){const $=Kv(F.sessionId),Q=l&&!I.has(F.id)&&!I.has(F.parentId),M=B,V=_.size>0&&(_.has(F.id)||_.has(F.parentId)),Y=b!=null&&!b.has(F.id)&&!b.has(F.parentId),H=F.state==="active"?2:1.5,J=V?H+1.5:H,re=Q||M?.2:Y?.12:1,le=["sess-edge",F.state==="active"?"sess-live":"sess-idle",M?"rf-edge-exiting":"",V?"rf-edge-selected":""].filter(Boolean).join(" ");C.push({id:`e:${F.parentId}->${F.id}`,source:F.parentId,target:F.id,animated:(F.state==="active"||V)&&!Q&&!M,type:"smoothstep",style:{"--session-hue":$,strokeWidth:J,opacity:re,transition:"opacity 500ms ease, stroke-width 200ms ease"},className:le})}}const A=new Map;for(const F of e.agents.values())F.tools.length>0&&A.set(F.id,Math.min(4,F.tools.length));const U=`${w}#lanes:${jD(A)}`,L=E.filter(F=>FL(F.id,o,m,y));if(L.length>0||U!==N.current){if(L.length>0){const F=AD(E,C,{direction:"LR",pinned:o,measured:u,availableWidth:r,availableHeight:i,lanes:A});for(const T of F)SC(T.id,m,y)&&BL(T.id,T.position,m,y);MD(E,m,o,u,new Set(L.map(T=>T.id)),A)}ID(E,m,o,u,A),N.current=U}const O=OD(E,m,o,u,c,!p||d,A);O.length>0&&h(O),tu(m,e.agents),tu(y,e.agents),tu(o,e.agents),tu(u,DL(e.agents.values()));const q=[];let G=!1;for(const F of E){let T=o.get(F.id)??m.get(F.id);T||(T=zL(F.id,m,y),G=!0),q.push({...F,position:T})}return G&&(N.current=""),{nodes:q,edges:C}}function y5(){return g.jsx(Yv,{children:g.jsx(w5,{})})}function w5(){var Ha,Wa,Ai,Va;const e=La(),n=j.useRef(bv()),[,r]=j.useState(0),i=j.useCallback(()=>r(W=>W+1),[]),[o,l]=j.useState(()=>new Set),[u,c]=j.useState(null),[h,p]=j.useState(null),d=j.useCallback((W,K)=>{l(ae=>{if(!K)return new Set([W]);const de=new Set(ae);return de.has(W)?de.delete(W):de.add(W),de}),c(ae=>K&&ae===W?ae:W)},[]),m=j.useCallback(()=>{l(new Set),c(null)},[]),[y,w]=j.useState(null),[N,_]=j.useState(null),b=j.useCallback(W=>_(W),[]),[S,k]=j.useState(!1),E=j.useRef(c5()),[C,I]=j.useState(s5);j.useEffect(()=>{i5(C)},[C]);const[P,A]=j.useState(o5);j.useEffect(()=>{a5(P)},[P]);const[U,L]=j.useState(l5);j.useEffect(()=>{u5(U)},[U]);const[O,q]=j.useState(()=>{try{const W=window.localStorage.getItem(CE);return W===null?!0:W==="1"}catch{return!0}});j.useEffect(()=>{try{window.localStorage.setItem(CE,O?"1":"0")}catch{}},[O]);const[G,F]=j.useState(null),[T,B]=j.useState(!1),[z,ne]=j.useState(0),[Z,$]=j.useState(0);j.useEffect(()=>{fetch("/api/sound-hook").then(W=>W.ok?W.json():null).then(W=>{W!=null&&W.ok&&(F(W.enabled===!0),ne((W.foreign??[]).filter(K=>K.worksHere).length),$(typeof W.parked=="number"?W.parked:0))}).catch(()=>{})},[]);const Q=j.useCallback(async()=>{B(!0);try{const K=await(await fetch("/api/sound-hook",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:!G})})).json().catch(()=>null);K!=null&&K.ok&&F(K.enabled===!0),fetch("/api/sound-hook").then(ae=>ae.ok?ae.json():null).then(ae=>{ae!=null&&ae.ok&&(ne((ae.foreign??[]).filter(de=>de.worksHere).length),$(typeof ae.parked=="number"?ae.parked:0))}).catch(()=>{})}catch{}finally{B(!1)}},[G]),[M,V]=j.useState(!1),[Y,H]=j.useState(null),[J,re]=j.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(RE)??""}catch{return""}}),[le,fe]=j.useState(!1),te=j.useRef(0),[ce,Ce]=j.useState(!1),ve=j.useCallback((W=!1)=>{W&&(te.current=Date.now(),Ce(!0)),fetch(W?"/api/version?refresh=1":"/api/version").then(K=>K.ok?K.json():null).then(K=>{K&&H(K)}).catch(()=>{}).finally(()=>{W&&Ce(!1)})},[]),Te=j.useCallback(()=>{ve(Date.now()-te.current>=r5)},[ve]);j.useEffect(()=>{ve();const W=window.setInterval(Te,5*6e4),K=()=>{document.visibilityState==="visible"&&Te()};return document.addEventListener("visibilitychange",K),()=>{window.clearInterval(W),document.removeEventListener("visibilitychange",K)}},[ve,Te]),j.useEffect(()=>{M&&ve()},[M,ve]);const ye=(Y==null?void 0:Y.notice)??null,[ke,Ke]=j.useState(null);j.useEffect(()=>{let W=!1;return fetch("/api/health").then(K=>K.ok?K.json():null).then(K=>{W||!K||typeof K.workspace!="string"||Ke(K.workspace)}).catch(()=>{}),()=>{W=!0}},[M]);const we=ye?`${ye.kind}:${ye.to}`:"",_e=ye!=null&&J!==we,Be=j.useCallback(()=>{if(!ye)return;const W=J===we?"":we;re(W);try{window.localStorage.setItem(RE,W)}catch{}},[ye,we,J]),[ft,ht]=j.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(jE)??""}catch{return""}}),We=Y!=null&&Y.invokedAs&&Y.invokedAs!==tn?Y.invokedAs:null,$e=We!=null&&ft!==We,Je=j.useCallback(()=>{if(We){ht(We);try{window.localStorage.setItem(jE,We)}catch{}}},[We]),Xe=((Ha=Y==null?void 0:Y.upgrade)==null?void 0:Ha.state)??"idle",vt=RL(Y==null?void 0:Y.upgrade),ot=j.useCallback(async()=>{try{await fetch("/api/upgrade",{method:"POST"})}catch{}ve()},[ve]);j.useEffect(()=>{if(Xe!=="running")return;const W=window.setInterval(ve,3e3);return()=>window.clearInterval(W)},[Xe,ve]);const yt=j.useCallback(async()=>{var ae;const W=Y==null?void 0:Y.command;if(!W)return;let K=!1;try{K=await Promise.race([((ae=navigator.clipboard)==null?void 0:ae.writeText(W).then(()=>!0))??Promise.resolve(!1),new Promise(de=>window.setTimeout(()=>de(!1),500))])}catch{K=!1}if(!K)try{const de=document.createElement("textarea");de.value=W,de.setAttribute("readonly",""),de.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(de),de.select(),K=document.execCommand("copy"),de.remove()}catch{K=!1}K&&(fe(!0),window.setTimeout(()=>fe(!1),1600))},[Y==null?void 0:Y.command]),Gt=j.useCallback(()=>{I(W=>(W||q(!1),!W))},[]),It=j.useCallback(()=>{q(W=>(W||I(!1),!W))},[]),[Ze,wt]=j.useState(!1),[pt,mt]=j.useState(0),_n=j.useRef(null),[Yt,Mt]=j.useState(!1),Kt=j.useRef(null),[yr,bn]=j.useState(0),Xt=j.useRef(VL()),[pn,Sn]=j.useState(!1),Gr=j.useCallback(()=>{const W=Xt.current,K=W.setPaused(!W.paused);for(const ae of K)n.current=Mx(n.current,ae);Sn(W.paused)},[]),[ut,hi]=j.useState(Date.now()),[rr,ks]=j.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(AE)!=="0"}catch{return!0}}),pi=j.useCallback(()=>{ks(W=>{const K=!W;try{window.localStorage.setItem(AE,K?"1":"0")}catch{}return K})},[]),[Qt,sr]=j.useState(!1),[wr,No]=j.useState("restart"),[ir,xr]=j.useState(null),mn=j.useRef(!1),Yr=j.useRef(null),mi=j.useRef(0),Kr=j.useCallback(async W=>{if(mn.current)return;const K=(W==null?void 0:W.upgrade)===!0;mn.current=!0,Yr.current=vt;const ae=++mi.current;No(K?"npx":"restart"),sr(!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:K})})}catch{}window.setTimeout(()=>{if(mi.current===ae&&mn.current){mn.current=!1,sr(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},K?18e4:3e4)},[ye==null?void 0:ye.to,vt]),Es=j.useRef(null);j.useEffect(()=>{let W=!1;for(const ae of n.current.agents.values())if(ae.state==="active"){W=!0;break}const K=TL({enabled:rr,kind:ye==null?void 0:ye.kind,canRestart:(Y==null?void 0:Y.canRestart)===!0,busy:W,idleSince:Es.current,now:ut});Es.current=K.idleSince,K.restart&&Kr()},[rr,ye==null?void 0:ye.kind,Y==null?void 0:Y.canRestart,ut,Kr]),j.useEffect(()=>{const W=Y==null?void 0:Y.running;let K=null,ae=null;try{K=window.sessionStorage.getItem("agent-dag.restartPending"),ae=window.sessionStorage.getItem(IE)}catch{return}const de=CL({bundle:"1.34.3",running:W,pending:K,lastTried:ae});if(de==="reload"){try{window.sessionStorage.setItem(IE,W??"")}catch{return}window.location.reload();return}if(de!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}mn.current=!1,sr(!1),xr(W??null);const xe=window.setTimeout(()=>xr(null),6e3);return()=>window.clearTimeout(xe)},[Y==null?void 0:Y.running]),j.useEffect(()=>{if(Qt&&jL({asked:Yr.current,reported:vt})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}mn.current=!1,sr(!1)}},[Qt,vt]);const gn=j.useRef(d5()).current;j.useRef(!1);const Rt=j.useRef(new Map(gn.positions.filter(([W])=>gn.pins.includes(W)))),_r=j.useRef(null),Xr=j.useState(()=>f5())[0],[Zt,Qr]=j.useState(""),[Ns,gi]=j.useState(()=>new Set),[or,vi]=j.useState(QL),[et,Co]=j.useState(!1),br=j.useRef(null);j.useEffect(()=>{document.documentElement.dataset.theme=or;try{window.localStorage.setItem(EC,or)}catch{}},[or]),j.useEffect(()=>{if(!Xr)return;const W=window.setTimeout(()=>{try{e.setViewport(Xr,{duration:0})}catch{}},60);return()=>window.clearTimeout(W)},[e,Xr]);const Cs=j.useRef(!0);j.useEffect(()=>{const W=new EventSource("/events"),K=WL(i,{now:()=>Date.now(),setTimeout:(ae,de)=>window.setTimeout(ae,de),clearTimeout:ae=>window.clearTimeout(ae)});return W.addEventListener("open",()=>{V(!0),Co(!0)}),W.addEventListener("error",()=>V(!1)),W.addEventListener("replay-end",()=>{Cs.current=!1,K.flush()}),W.addEventListener("hook",ae=>{try{const de=JSON.parse(ae.data);if(!Xt.current.accept(de))return;n.current=Mx(n.current,de),de.replay===!0||Cs.current||Date.now()-de.receivedAt>3e4?K.replay():K.live()}catch{}}),()=>{W.close(),K.cancel()}},[i]),j.useEffect(()=>{const W=setInterval(()=>{const K=Date.now();hi(K);let ae=aP(n.current,K,ZD);uP(n.current,K,lP)&&(ae=!0),iP(n.current,K,JD,e5)&&(ae=!0),oP(n.current,K,t5,n5)&&(ae=!0),ae&&i()},250);return()=>clearInterval(W)},[i]);const ar=j.useRef(null),$n=j.useRef(0),yi=420,Ot=j.useCallback((W=500)=>{try{const Ee=document.querySelector(".canvas-wrap"),Pe=Array.from(document.querySelectorAll(".react-flow__node")).filter(xt=>xt.offsetWidth>0);if(!Ee||Pe.length===0)return;const De=Ee.getBoundingClientRect(),Ye=e.getViewport();if(!Number.isFinite(Ye.zoom)||Ye.zoom<=0)return;const Ue=xt=>(xt-De.left-Ye.x)/Ye.zoom,Fe=xt=>(xt-De.top-Ye.y)/Ye.zoom,Nn=Pe.map(xt=>xt.getBoundingClientRect()),Fs=Math.min(...Nn.map(xt=>Ue(xt.left))),Ii=Math.max(...Nn.map(xt=>Ue(xt.right))),zs=Math.min(...Nn.map(xt=>Fe(xt.top))),$o=Math.max(...Nn.map(xt=>Fe(xt.bottom))),Ga=Ii-Fs,Mi=$o-zs;if(!(Ga>0&&Mi>0))return;const Un=Math.max(.2,Math.min(1,(De.width-160)/(Ga+yi)*.86,(De.height-160)/Mi*.86));e.setViewport({x:80-Fs*Un,y:Math.max(80,(De.height-Mi*Un)/2)-zs*Un,zoom:Un},{duration:W}),$n.current=Date.now(),window.setTimeout(()=>{try{const xt={x:80-Fs*Un,y:Math.max(80,(De.height-Mi*Un)/2)-zs*Un,zoom:Un},Ya=e.getViewport();(Math.abs(Ya.zoom-Un)>.01||Math.abs(Ya.x-xt.x)>2)&&e.setViewport(xt,{duration:0})}catch{}},W+60)}catch{}},[e]),zt=j.useRef(""),Sr=j.useRef(null),nn=j.useRef(0),wi=j.useCallback(()=>{nn.current=Date.now()},[]),Ro="agent-dag.autoFitDisabled",kr=j.useRef((()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(Ro)==="1"}catch{return!1}})()),[Rs,js]=j.useState(kr.current),Zr=j.useCallback(()=>{if(!kr.current){kr.current=!0,js(!0);try{window.localStorage.setItem(Ro,"1")}catch{}}},[]),xi=j.useCallback(()=>{kr.current=!1,js(!1);try{window.localStorage.removeItem(Ro)}catch{}Ot(400)},[e,Ot]);j.useEffect(()=>{const W=setInterval(()=>{if(kr.current||Date.now()-nn.current<800)return;const K=n.current,ae=Date.now(),de=[];for(const Ue of K.agents.values())Cv(Ue,ae)&&de.push({id:Ue.id});if(de.length===0)return;const xe=e.getViewport(),Ee=window.innerWidth-360,Pe=window.innerHeight-52;let De=!1,Ye=!1;for(const{id:Ue}of de){const Fe=Jr.current.get(Ue),Nn=Rt.current.get(Ue)??Bt.current.get(Ue);if(!Fe||!Nn)continue;Ye=!0;const Fs=Nn.x*xe.zoom+xe.x,Ii=Nn.y*xe.zoom+xe.y,zs=(Nn.x+Fe.width)*xe.zoom+xe.x,$o=(Nn.y+Fe.height)*xe.zoom+xe.y;if(zs>0&&Fs<Ee&&$o>0&&Ii<Pe){De=!0;break}}Ye&&!De&&Ot(600)},1500);return()=>clearInterval(W)},[e]);const jo=j.useRef(!1),Jr=j.useRef(new Map),_i=j.useRef(0),Ua=j.useCallback(W=>{const K=Jr.current;let ae=!1;for(const de of W.nodeInternals.values()){const xe=de.width,Ee=de.height;if(xe==null||Ee==null)continue;const Pe=K.get(de.id);Pe?(Math.abs(Pe.height-Ee)>4||Math.abs(Pe.width-xe)>4)&&(K.set(de.id,{width:xe,height:Ee}),ae=!0):(K.set(de.id,{width:xe,height:Ee}),ae=!0)}return ae&&(_i.current+=1),_i.current},[]),bi=Qe(Ua),[es,Qu]=j.useState(0);j.useEffect(()=>{let W=0;const K=()=>{const de=Jr.current;let xe=!1;for(const Ee of document.querySelectorAll(".react-flow__node[data-id]")){const Pe=Ee.getAttribute("data-id");if(!Pe)continue;const De=Ee.offsetWidth,Ye=Ee.offsetHeight;if(!De||!Ye)continue;const Ue=de.get(Pe);(!Ue||Math.abs(Ue.width-De)>4||Math.abs(Ue.height-Ye)>4)&&(de.set(Pe,{width:De,height:Ye}),xe=!0)}xe&&Qu(Ee=>Ee+1)};if(jo.current)return;let ae=0;return document.visibilityState==="hidden"?ae=window.setTimeout(K,32):W=requestAnimationFrame(K),()=>{cancelAnimationFrame(W),window.clearTimeout(ae)}});const Bt=j.useRef(new Map(gn.positions)),Ge=j.useRef(new Set),Si=j.useRef(""),Er=j.useMemo(()=>{const W=[];for(const K of n.current.agents.values())Cv(K,ut)&&W.push(K.id+(K.parentId?`>${K.parentId}`:""));return W.sort(),`${W.join("|")}#sv${bi}.${es}`},[n.current,n.current.lastSeq,ut,bi,es]),Nr=j.useRef(null);j.useEffect(()=>(Nr.current!=null&&window.clearTimeout(Nr.current),Nr.current=window.setTimeout(()=>{iv(Bt.current,Rt.current)},1500),()=>{Nr.current!=null&&window.clearTimeout(Nr.current)}),[Er]),j.useEffect(()=>{if(zt.current===Er)return;const W=zt.current;if(zt.current=Er,!W||kr.current)return;Date.now()-$n.current>1200&&Ot(400),ar.current&&window.clearTimeout(ar.current),ar.current=window.setTimeout(()=>{kr.current||Ot(500)},280)},[Er,e,Ot]);const ki=j.useMemo(()=>{if(o.size===0)return null;const W=new Set;for(const K of o){const ae=g5(n.current,K);if(ae)for(const de of ae)W.add(de)}return W.size>0?W:null},[n.current,n.current.lastSeq,o]),lr=j.useMemo(()=>LD(n.current,ut),[n.current,n.current.lastSeq,ut]),To=j.useRef(null),[ts,Ts]=j.useState({w:0,h:0});j.useEffect(()=>{const W=To.current;if(!W||typeof ResizeObserver>"u")return;const K=new ResizeObserver(ae=>{var xe;const de=(xe=ae[0])==null?void 0:xe.contentRect;de&&Ts(Ee=>Math.abs(Ee.w-de.width)>40||Math.abs(Ee.h-de.height)>40?{w:de.width,h:de.height}:Ee)});return K.observe(W),Ts({w:W.clientWidth,h:W.clientHeight}),()=>K.disconnect()},[]);const ur=j.useRef(new Map),[Dn,cr]=j.useState(!1);j.useEffect(()=>{const W=window.setTimeout(()=>cr(!0),2500);return()=>window.clearTimeout(W)},[]);const[As,Cr]=j.useState(!1),Pt=j.useRef(null),[Ao,Io]=j.useState(!1),Is=j.useCallback(()=>{Pt.current&&(window.clearTimeout(Pt.current),Pt.current=null),Cr(!1)},[]),Zu=j.useCallback(W=>{W.length!==0&&queueMicrotask(()=>{Cr(!0),Pt.current&&window.clearTimeout(Pt.current),Pt.current=window.setTimeout(()=>Cr(!1),QD+80)})},[]);j.useEffect(()=>()=>{Pt.current&&window.clearTimeout(Pt.current)},[]);const Mo=ts.w>0?ts.w*.92:0,Ms=ts.h>0?ts.h:0,{nodes:Fn,edges:Ju}=j.useMemo(()=>v5(n.current,ut,Mo,Ms,Rt.current,Zt,Jr.current,ur.current,Zu,Dn,Ao,Bt.current,Ge.current,Er,Si,o,ki,lr,b),[n.current,n.current.lastSeq,ut,Mo,Ms,Dn,Ao,Zt,Er,o,ki,lr,b,pt]),ns=j.useMemo(()=>{const W=new Map;for(const ae of Fn){const de=ae.data;if(!(de!=null&&de.sessionId)||de.exitAt!=null)continue;const xe=ae.width,Ee=ae.height;if(xe==null||Ee==null)continue;const Pe=ae.position.x,De=ae.position.y,Ye=Pe+xe,Ue=De+Ee,Fe=W.get(de.sessionId);Fe?(Fe.minX=Math.min(Fe.minX,Pe),Fe.minY=Math.min(Fe.minY,De),Fe.maxX=Math.max(Fe.maxX,Ye),Fe.maxY=Math.max(Fe.maxY,Ue)):W.set(de.sessionId,{minX:Pe,minY:De,maxX:Ye,maxY:Ue})}const K=[];for(const[ae,de]of W){const xe=de.maxX-de.minX+iu*2,Ee=de.maxY-de.minY+iu*2;K.push({id:`group:${ae}`,type:NR,position:{x:de.minX-iu,y:de.minY-iu},data:{sessionId:ae,w:xe,h:Ee},width:xe,height:Ee,style:{width:xe,height:Ee},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return K},[Fn,ut]),Os=j.useMemo(()=>{const W=[...ns,...Fn],K=Kt.current;return!K||K.size===0?W:W.map(ae=>{const de=K.get(ae.id);return de?{...ae,position:de}:ae})},[ns,Fn,yr]),kn=j.useMemo(()=>{if(!Zt)return null;const W=new Set;for(const K of n.current.agents.values())lr.has(K.id)&&PR(K,Zt)&&W.add(K.id);return W},[n.current,n.current.lastSeq,Zt,lr]),En=j.useMemo(()=>VD(Zt,(kn==null?void 0:kn.size)??0,lr.size),[Zt,kn,lr]),Ei=j.useMemo(()=>{const W=new Set;for(const K of n.current.agents.values())for(const ae of K.tools)W.add(OR(ae.name));return Object.keys(jv).filter(K=>W.has(K))},[n.current,n.current.lastSeq]);j.useEffect(()=>{if(Ei.length<=1){Mt(!1);return}let W=0;const K=()=>{const ae=_n.current;if(ae&&!document.hidden){const de=ae.getBoundingClientRect(),xe=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Pe=>Pe.getBoundingClientRect()),Ee=$D(de,xe,8);Mt(Pe=>Pe===Ee?Pe:Ee)}W=window.setTimeout(K,300)};return K(),()=>window.clearTimeout(W)},[Ei.length]);const Ps=j.useMemo(()=>{const W=new Map;for(const ae of n.current.agents.values())for(const de of ae.tools){if(!de.name.startsWith("mcp__"))continue;const xe=de.name.slice(5),Ee=xe.indexOf("__"),Pe=Ee>0?xe.slice(0,Ee):xe;W.set(Pe,(W.get(Pe)??0)+1)}const K=[];for(const[ae,de]of W){let xe=5381;for(let Ee=0;Ee<ae.length;Ee++)xe=(xe<<5)+xe^ae.charCodeAt(Ee);K.push({server:ae,count:de,hue:Math.abs(xe)%360})}return K.sort((ae,de)=>de.count-ae.count),K},[n.current,n.current.lastSeq]),Oo=j.useCallback(W=>{gi(K=>{const ae=new Set(K);return ae.has(W)?ae.delete(W):ae.add(W),ae})},[]),St=u?n.current.agents.get(u):null,Ls=h?Array.from(n.current.agents.values()).flatMap(W=>W.tools).find(W=>W.id===h)??null:null,Po=j.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}n.current=bv(),Rt.current.clear(),Jr.current.clear(),Bt.current.clear(),Si.current="",OE(),m(),i()},[i,m]),zn=j.useRef(S);zn.current=S;const Ni=j.useRef(!1);Ni.current=Ls!=null||Ze||N!=null||y!=null;const Rr=j.useCallback(W=>{const K=IL(W,{confirmOpen:zn.current,modalOpen:Ni.current});K==="confirm"?k(!0):K==="clear"&&(k(!1),Po())},[Po]),Ci=j.useCallback(()=>{Rt.current.clear(),Bt.current.clear(),Si.current="",OE(),i(),window.setTimeout(()=>Ot(500),80)},[i,e,Ot]),qs=j.useCallback(()=>Ot(500),[Ot]),jr=j.useRef(Fn);jr.current=Fn;const Lo=j.useRef(u);Lo.current=u;const Lt=j.useCallback(W=>{const K=jr.current,ae=OL(K.map(Ee=>({id:Ee.id,x:Ee.position.x,y:Ee.position.y})),Lo.current,W),de=ae?K.find(Ee=>Ee.id===ae):void 0;if(!de)return;const xe=NE(document.activeElement);d(de.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[de]})}catch{}$n.current=Date.now(),xe&&XD(de.id)},30)},[d,e]),Tr=j.useCallback(W=>{d(W,!1),window.setTimeout(()=>{try{const K=jr.current.find(ae=>ae.id===W);K&&e.fitView({padding:.3,duration:500,nodes:[K]}),$n.current=Date.now()}catch{}},60)},[d,e]);j.useEffect(()=>{const W=K=>{var De,Ye,Ue;const ae=K.target,de={tagName:ae==null?void 0:ae.tagName,isContentEditable:ae==null?void 0:ae.isContentEditable,role:(De=ae==null?void 0:ae.getAttribute)==null?void 0:De.call(ae,"role"),type:ae==null?void 0:ae.type};if(K.key==="Escape"){const Fe=EP({overlayOpen:bu.depth()>0,typing:Qv(de)});Fe==="dismiss"?bu.dismissTop():Fe==="blur"?ae==null||ae.blur():($L(de)&&(ae==null||ae.blur()),m());return}if(hC(K))return;const xe=NE(ae)?(Ye=ae==null?void 0:ae.getAttribute)==null?void 0:Ye.call(ae,"data-id"):null,Ee=xe&&jr.current.some(Fe=>Fe.id===xe)?xe:null,Pe=LL(K,Ee);if(Pe.kind==="activate"){K.preventDefault(),d(Pe.nodeId,Pe.additive);return}if(Pe.kind!=="node"&&!(Pe.nodeId==null&&MP(de))){if(K.key==="/"){K.preventDefault(),(Ue=br.current)==null||Ue.focus();return}K.key===" "&&(K.preventDefault(),Gr()),(K.key==="c"||K.key==="C")&&Rr("shortcut"),(K.key==="r"||K.key==="R")&&Ci(),(K.key==="f"||K.key==="F")&&qs(),(K.key==="l"||K.key==="L")&&Gt(),(K.key==="h"||K.key==="H")&&wt(Fe=>!Fe),(K.key==="u"||K.key==="U")&&L(Fe=>!Fe),(K.key==="a"||K.key==="A")&&It(),(K.key==="j"||K.key==="J")&&Lt(1),(K.key==="k"||K.key==="K")&&Lt(-1),(K.key==="t"||K.key==="T")&&vi(Fe=>Fe==="dark"?"light":"dark")}};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[Rr,Ci,qs,m,d,Lt,Gr]);const Ar=n.current.agents.size,$s=new Set(Array.from(n.current.agents.values()).map(W=>W.sessionId)).size,Bn=j.useMemo(()=>P3(n.current.agents.values()),[n.current,n.current.lastSeq]),Ri=j.useMemo(()=>L3(n.current.agents.values()),[n.current,n.current.lastSeq]),ji=j.useRef(null);j.useEffect(()=>{const W=ZL({waiting:Bn.length,running:Ri}),K=ji.current;if(ji.current=W,(K==null?void 0:K.title)!==W.title&&(document.title=W.title),(K==null?void 0:K.icon)!==W.icon){const ae=document.querySelector('link[rel="icon"]');ae&&(ae.href=JL[W.icon])}},[Bn.length,Ri]);const[Ds,Ti]=j.useState(""),qo=tq(Bn);j.useEffect(()=>{Ti(W=>nq(W,qo))},[qo]);const rn=j.useMemo(()=>{let W=0,K=0,ae=0,de=0,xe=0,Ee=0,Pe=0,De=0,Ye=0;for(const Ue of n.current.agents.values()){W+=Ue.usage.inputTokens,K+=Ue.usage.outputTokens,ae+=Ue.usage.cacheReadTokens,de+=Ue.usage.cacheCreateTokens;const Fe=fn(Ue.usage,Ue.model);xe+=Fe.total,Ee+=Fe.input,Pe+=Fe.output,De+=Fe.cacheRead,Ye+=Fe.cacheWrite}return{inT:W,outT:K,cacheR:ae,cacheC:de,sum:W+K,cost:{total:xe,input:Ee,output:Pe,cacheRead:De,cacheWrite:Ye}}},[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"}),tn,ye?g.jsxs("button",{type:"button",className:"v stale",onClick:Be,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 W={running:(Y==null?void 0:Y.running)??"1.34.3",latest:Y==null?void 0:Y.latest,latestPending:Y==null?void 0:Y.latestPending,checkedAgo:Y!=null&&Y.checkedAt?Rv(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":BD(W),title:zD(W),children:["v",W.running]})})()]}),St&&(()=>{const W=fn(St.usage,St.model),K=Math.max(0,((St.endedAt??ut)-St.startedAt)/1e3),ae=St.state==="active"?_u(W.total,K):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(Ee=>Ee.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}),W.total>0&&g.jsxs("span",{className:"selected-cost",children:[ze(W.total),ae?g.jsxs("span",{className:"selected-rate",children:[" · ",ae]}):null]}),de>0&&g.jsxs("span",{className:"selected-extra",children:["+",de]}),g.jsx("span",{"aria-hidden":!0,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:Zt,onChange:W=>Qr(W.target.value),spellCheck:!1,"aria-label":"Filter the graph"}),Zt?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 “${Zt}”`,children:En.count})]}),g.jsxs("span",{className:"status",children:[(()=>{const W=HD({connected:M,paused:pn,held:Xt.current.size});return g.jsx("span",{className:`pill ${W.tone}`,title:W.title,children:W.label})})(),g.jsxs("span",{className:"stat",title:"Distinct CC sessions",children:[g.jsx("span",{className:"count",children:$s}),g.jsx("span",{className:"lbl",children:"sessions"})]}),g.jsxs("span",{className:"stat",title:"Total agents (root + subagents)",children:[g.jsx("span",{className:"count",children:Ar}),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"})]}),rn.sum>0&&g.jsxs("span",{className:"stat",title:`in:${rn.inT.toLocaleString()} out:${rn.outT.toLocaleString()} cache-r:${rn.cacheR.toLocaleString()} cache-c:${rn.cacheC.toLocaleString()}`,children:[g.jsx("span",{className:"count",children:Dt(rn.sum)}),g.jsx("span",{className:"lbl",children:"tokens"})]}),Ps.length>0&&g.jsxs("span",{className:"stat mcp-legend",title:`MCP servers seen this session:
|
|
62
|
+
${Ps.map(W=>` ${W.server}: ${W.count} call${W.count===1?"":"s"}`).join(`
|
|
63
|
+
`)}`,children:[Ps.slice(0,6).map(W=>g.jsx("span",{className:"mcp-dot",style:{"--mcp-hue":W.hue}},W.server)),Ps.length>6&&g.jsxs("span",{className:"mcp-more",children:["+",Ps.length-6]}),g.jsx("span",{className:"lbl",children:"mcp"})]}),rn.cost.total>0&&(()=>{let W=0,K=0;for(const xe of n.current.agents.values()){if(xe.state!=="active")continue;const Ee=fn(xe.usage,xe.model);W+=Ee.total,K=Math.max(K,((xe.endedAt??ut)-xe.startedAt)/1e3)}const ae=K>0?_u(W,K):null,de=`input ${ze(rn.cost.input)} + output ${ze(rn.cost.output)} + cache r ${ze(rn.cost.cacheRead)} + cache w ${ze(rn.cost.cacheWrite)}${ae?`
|
|
64
|
+
active burn: ${ae}`:""}`;return g.jsxs("span",{className:"stat",title:de,children:[g.jsx("span",{className:"count",children:ze(rn.cost.total)}),g.jsxs("span",{className:"lbl",children:["cost",ae?` · ${ae}`:""]})]})})()]}),g.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:Ds}),Bn.length>0&&g.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>Tr(Bn[0].id),title:`Blocked waiting for you — click to go to the one that has been stuck longest:
|
|
65
|
+
${Bn.map(W=>` ${W.label}: ${Iu(W.waiting)} (${Rv(ut-W.waiting.since)})`).join(`
|
|
66
|
+
`)}`,"aria-label":`${Bn.length} session${Bn.length===1?"":"s"} waiting for you`,children:[g.jsx("span",{className:"ap-pulse","aria-hidden":!0}),g.jsx("b",{children:Bn.length})," waiting"]}),(()=>{const W=WD({paused:pn,held:Xt.current.size});return g.jsx("button",{className:`btn ${pn?"warn":""}`,onClick:Gr,title:W.title,children:W.label})})(),g.jsx("button",{className:"btn icon-btn",onClick:()=>L(W=>!W),title:`${U?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":U,"aria-controls":U?"usage-panel":void 0,children:"$"}),G!==null&&g.jsx("button",{className:"btn icon-btn",onClick:W=>{if(W.shiftKey&&Z>0){B(!0),fetch("/api/sound-hook",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"restore"})}).then(()=>fetch("/api/sound-hook")).then(K=>K.ok?K.json():null).then(K=>{K!=null&&K.ok&&(F(K.enabled===!0),$(K.parked??0))}).catch(()=>{}).finally(()=>B(!1));return}Q()},disabled:T,title:(G?"Sound on turn finish: on — click to remove the hook":"Sound on turn finish: off — click to add a Stop hook")+(z>0?`
|
|
67
|
+
|
|
68
|
+
${z} sound hook${z>1?"s":""} of your own in settings.json also run${z>1?"":"s"} here.`:"")+(Z>0?`
|
|
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",onClick:It,title:`${O?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":O,"aria-controls":O?"accounts-panel":void 0,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",onClick:Gt,title:`${C?"Hide":"Show"} session list (L)`,"aria-label":"Toggle session list","aria-expanded":C,"aria-controls":C?"session-list":void 0,children:"☰"}),g.jsx("button",{className:"btn icon-btn",onClick:()=>wt(W=>!W),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",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:()=>Rr("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(W=>W==="dark"?"light":"dark"),title:`Switch to ${or==="dark"?"light":"dark"} mode (T)`,"aria-label":"Toggle theme",children:or==="dark"?"☀":"☾"})]})]}),ir?g.jsxs("div",{className:"ver-banner done",role:"status",children:[g.jsx("span",{className:"ver-dot"}),g.jsxs("strong",{children:["Restarted — now running v",ir,"."]}),g.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):et&&!M?g.jsxs("div",{className:"conn-banner",role:"alert",children:[g.jsx("span",{className:"conn-dot"}),Qt?wr==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${tn}…`:`Lost connection to the ${tn} 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:Qt,title:"Stop this process and bring it back on the same port. The canvas replays from the event log.",children:Qt?"restarting…":"Restart now"}),g.jsxs("button",{type:"button",className:`ver-auto${rr?" on":""}`,role:"switch","aria-checked":rr,onClick:pi,title:rr?"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:[tn," v",ye.to," is out — you are on v",ye.from,"."]}),(Y==null?void 0:Y.upgradeMode)==="install"&&Xe!=="failed"&&g.jsx("button",{type:"button",className:"ver-act",onClick:ot,disabled:Xe==="running"||Xe==="done",title:`Runs ${((Wa=Y==null?void 0:Y.upgrade)==null?void 0:Wa.command)??(Y==null?void 0:Y.command)??"npm i -g"} here, then restarts once nothing is running.`,children:Xe==="running"?"installing…":Xe==="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:Qt,title:`Runs ${Y==null?void 0:Y.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:Qt?"fetching…":Xe==="failed"?"Retry update":"Update & restart"}),Xe==="failed"?g.jsxs("span",{className:"ver-sub fail",title:((Ai=Y==null?void 0:Y.upgrade)==null?void 0:Ai.error)??"",children:[(Y==null?void 0:Y.upgradeMode)==="npx"?"update failed":"install failed",": ",((Va=Y==null?void 0:Y.upgrade)==null?void 0:Va.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:":TE.npx}):Y!=null&&Y.upgradeBlocked?g.jsx("span",{className:"ver-sub",children:TE[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:Be,children:"×"})]}):$e&&We?g.jsxs("div",{className:"ver-banner",role:"status",children:[g.jsx("span",{className:"ver-dot"}),g.jsxs("strong",{children:[We," still works — the deck is called ",tn," now."]}),Y!=null&&Y.renameFix?g.jsx("span",{className:"ver-sub",children:Y.renameFix}):null,g.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:Je,children:"×"})]}):null,U&&g.jsx(Y3,{state:n.current,now:ut,onClose:()=>L(!1)}),O&&g.jsx(kL,{onClose:()=>q(!1)}),C&&g.jsx($3,{state:n.current,now:ut,selectedIds:o,onSelect:Tr,onClose:()=>I(!1)}),g.jsxs("div",{className:`canvas-wrap${As?" bubbling":""}${Ao?" dragging-any":""}`,ref:To,children:[Ar===0&&g.jsx(x5,{live:M,everConnected:et}),En.empty&&Ar>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 W;Qr(""),(W=br.current)==null||W.focus()},children:"Clear search"})]}),Ei.length>1&&g.jsx("div",{ref:_n,className:`cat-filter-bar${Yt?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:Ei.map(W=>{const K=Ns.has(W);return g.jsxs("button",{type:"button",className:`cat-filter${K?" off":""}`,onClick:()=>Oo(W),"aria-pressed":!K,title:`${K?"Show":"Hide"} ${Tv[W]} tools`,children:[g.jsx("span",{className:"cat-emoji",children:jv[W]}),g.jsx("span",{className:"cat-name",children:Tv[W]})]},W)})}),g.jsxs(JN,{nodes:Os,edges:Ju,nodeTypes:KD,fitView:!Xr,fitViewOptions:{padding:.25,duration:400},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,onNodeClick:(W,K)=>{if(K.type==="sessionGroup"){m();return}d(K.id,W.shiftKey)},onPaneClick:()=>m(),onMoveStart:()=>{Date.now()-$n.current<1200||Zr()},onMove:(W,K)=>{wi(),Sr.current&&window.clearTimeout(Sr.current),Sr.current=window.setTimeout(()=>h5(K),250)},onNodeDragStart:(W,K)=>{var ae;if(Is(),jo.current=!0,Kt.current=new Map,Io(!0),wi(),Zr(),K.type==="sessionGroup"){const de=(ae=K.data)==null?void 0:ae.sessionId,xe=new Map;if(de)for(const Ee of Fn){const Pe=Ee.data;(Pe==null?void 0:Pe.sessionId)===de&&xe.set(Ee.id,{x:Ee.position.x,y:Ee.position.y})}_r.current={start:{x:K.position.x,y:K.position.y},members:xe};return}Rt.current.set(K.id,{x:K.position.x,y:K.position.y})},onNodeDrag:(W,K)=>{var ae;if(wi(),K.type==="sessionGroup"){const de=_r.current;if(!de)return;const xe=K.position.x-de.start.x,Ee=K.position.y-de.start.y;for(const[De,Ye]of de.members){const Ue={x:Ye.x+xe,y:Ye.y+Ee};Rt.current.set(De,Ue),Bt.current.set(De,Ue)}const Pe=Kt.current;if(Pe){for(const[De,Ye]of de.members)Pe.set(De,{x:Ye.x+xe,y:Ye.y+Ee});Pe.set(K.id,{x:K.position.x,y:K.position.y})}bn(De=>De+1);return}Rt.current.set(K.id,{x:K.position.x,y:K.position.y}),Bt.current.set(K.id,{x:K.position.x,y:K.position.y}),(ae=Kt.current)==null||ae.set(K.id,{x:K.position.x,y:K.position.y}),bn(de=>de+1)},onNodeDragStop:(W,K)=>{if(wi(),jo.current=!1,Kt.current=null,Io(!1),mt(ae=>ae+1),K.type==="sessionGroup"){const ae=_r.current;if(ae){const de=K.position.x-ae.start.x,xe=K.position.y-ae.start.y;for(const[Ee,Pe]of ae.members){const De={x:Pe.x+de,y:Pe.y+xe};Rt.current.set(Ee,De),Bt.current.set(Ee,De)}}_r.current=null,iv(Bt.current,Rt.current),mt(de=>de+1);return}Rt.current.set(K.id,{x:K.position.x,y:K.position.y}),Bt.current.set(K.id,{x:K.position.x,y:K.position.y}),iv(Bt.current,Rt.current)},children:[g.jsx(KO,{gap:28,size:1,color:ma("--grid-line")}),g.jsx(JP,{}),g.jsx(T3,{agents:n.current.agents,visibleAgentIds:lr,positions:Bt.current,pinned:Rt.current,measured:Jr.current,dimUnmatched:En.dim?kn:null,spotlight:ki,hiddenCategories:Ns,now:ut,onOpenTool:p}),g.jsx(UO,{showInteractive:!1,children:g.jsx(ao,{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(LO,{zoomable:!0,pannable:!0,nodeColor:W=>DD(W,ma),nodeStrokeWidth:2,maskColor:ma("--minimap-mask"),style:{background:ma("--panel"),border:`1px solid ${ma("--line")}`,borderRadius:8}})]})]}),P?g.jsxs("aside",{className:"detail",children:[g.jsx("button",{type:"button",className:"detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>A(!1),children:"×"}),St?g.jsx(S5,{agent:St,now:ut,onOpenTool:p,onShowSummary:W=>{E.current.has(W)&&(E.current.delete(W),ME(E.current)),w(W)},onExportSession:W=>p5(n.current,W)}):g.jsx(b5,{count:Ar,workspace:ke})]}):g.jsx("button",{type:"button",className:"detail-reopen",title:"Show detail panel","aria-label":"Show detail panel",onClick:()=>A(!0),children:"‹"}),Ls&&g.jsx(YP,{tool:Ls,onClose:()=>p(null)}),Ze&&g.jsx(lq,{onClose:()=>wt(!1)}),N&&(()=>{const W=n.current.agents.get(N);return W?g.jsx($P,{agent:W,onClose:()=>_(null)}):null})(),y&&g.jsx(I3,{state:n.current,sessionId:y,onClose:()=>{E.current.add(y),ME(E.current),w(null)}}),S&&g.jsx(AL,{agentCount:Ar,onConfirm:()=>Rr("confirmation"),onCancel:()=>k(!1)})]})}function x5({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:tn})," is still running in your terminal, then this page will resume automatically."]})]}):_5()]})}function _5(){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:tn})," 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 b5({count:e,workspace:n}){const r=UD(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:"tab"}),g.jsx("span",{children:"reach the cards"})]}),g.jsxs("div",{className:"sc",children:[g.jsx("kbd",{children:"enter"}),g.jsx("span",{children:"select the focused card"})]}),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, release focus"})]})]})]})}function S5({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 b=OR(_.name);m.set(b,(m.get(b)??0)+1)}const y=e.tools.filter(_=>_.ok===!1).length,w=e.tools.filter(_=>!_.endedAt).length,N=Array.from(m.entries()).sort((_,b)=>b[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:ze(h.total)}),g.jsx("span",{className:"hero-cost-label",children:"spend"})]}),g.jsx(k5,{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(([_,b])=>g.jsxs("span",{className:`cat-chip cat-${_}`,title:`${b} ${Tv[_]} call${b===1?"":"s"}`,children:[g.jsx("span",{className:"cat-emoji",children:jv[_]}),g.jsx("span",{className:"cat-count",children:b})]},_))})]})]}),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((_,b)=>{const S=YD(_.at,n);return g.jsxs("div",{className:"prompt-entry",children:[g.jsx("div",{className:"prompt-time",title:S.title,children:S.label}),g.jsx("div",{className:"prompt-text",children:_.text})]},b)})})]}),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(N5,{t:_,now:n,onClick:()=>r(_.id)},_.id))})]})]})}function k5({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}: ${ze(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")]})}const E5={inflight:"in-flight",done:"done",err:"error"};function N5({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}`,"aria-hidden":!0}),g.jsx("span",{className:"vis-hidden",children:E5[i]}),e.name]}),g.jsx("span",{style:{color:"var(--muted)"},children:l})]})}try{KL(window.localStorage)}catch{}const C5=Gj.createRoot(document.getElementById("root"));C5.render(g.jsx(y5,{}));
|