agent-dag 1.41.0 → 1.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/deck.js +8 -1
- package/dist/web/assets/index-BxAZQc7O.css +1 -0
- package/dist/web/assets/index-DRgZVqF-.js +78 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/src/server/ccusage.mjs +9 -1
- package/src/server/codex-usage.mjs +10 -1
- package/src/server/index.mjs +139 -0
- package/src/server/installer.mjs +64 -14
- package/src/server/sound-hook.mjs +6 -4
- package/src/server/uv-bootstrap.mjs +6 -1
- package/dist/web/assets/index-BmQSe1xi.css +0 -1
- package/dist/web/assets/index-xvxaZnO0.js +0 -76
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const u of a.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function r(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(o){if(o.ep)return;o.ep=!0;const a=r(o);fetch(o.href,a)}})();var Kl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Yv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ad={exports:{}},ra={},Id={exports:{}},Ve={};/**
|
|
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 Yw;function SR(){if(Yw)return Ve;Yw=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),u=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),g=Symbol.iterator;function y(O){return O===null||typeof O!="object"?null:(O=g&&O[g]||O["@@iterator"],typeof O=="function"?O:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,_={};function b(O,V,ce){this.props=O,this.context=V,this.refs=_,this.updater=ce||w}b.prototype.isReactComponent={},b.prototype.setState=function(O,V){if(typeof O!="object"&&typeof O!="function"&&O!=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,O,V,"setState")},b.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function S(){}S.prototype=b.prototype;function E(O,V,ce){this.props=O,this.context=V,this.refs=_,this.updater=ce||w}var N=E.prototype=new S;N.constructor=E,k(N,b.prototype),N.isPureReactComponent=!0;var j=Array.isArray,A=Object.prototype.hasOwnProperty,I={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};function P(O,V,ce){var $,G={},ee=null,ie=null;if(V!=null)for($ in V.ref!==void 0&&(ie=V.ref),V.key!==void 0&&(ee=""+V.key),V)A.call(V,$)&&!L.hasOwnProperty($)&&(G[$]=V[$]);var de=arguments.length-2;if(de===1)G.children=ce;else if(1<de){for(var pe=Array(de),ne=0;ne<de;ne++)pe[ne]=arguments[ne+2];G.children=pe}if(O&&O.defaultProps)for($ in de=O.defaultProps,de)G[$]===void 0&&(G[$]=de[$]);return{$$typeof:e,type:O,key:ee,ref:ie,props:G,_owner:I.current}}function D(O,V){return{$$typeof:e,type:O.type,key:V,ref:O.ref,props:O.props,_owner:O._owner}}function M(O){return typeof O=="object"&&O!==null&&O.$$typeof===e}function q(O){var V={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(ce){return V[ce]})}var W=/\/+/g;function K(O,V){return typeof O=="object"&&O!==null&&O.key!=null?q(""+O.key):V.toString(36)}function C(O,V,ce,$,G){var ee=typeof O;(ee==="undefined"||ee==="boolean")&&(O=null);var ie=!1;if(O===null)ie=!0;else switch(ee){case"string":case"number":ie=!0;break;case"object":switch(O.$$typeof){case e:case t:ie=!0}}if(ie)return ie=O,G=G(ie),O=$===""?"."+K(ie,0):$,j(G)?(ce="",O!=null&&(ce=O.replace(W,"$&/")+"/"),C(G,V,ce,"",function(ne){return ne})):G!=null&&(M(G)&&(G=D(G,ce+(!G.key||ie&&ie.key===G.key?"":(""+G.key).replace(W,"$&/")+"/")+O)),V.push(G)),1;if(ie=0,$=$===""?".":$+":",j(O))for(var de=0;de<O.length;de++){ee=O[de];var pe=$+K(ee,de);ie+=C(ee,V,ce,pe,G)}else if(pe=y(O),typeof pe=="function")for(O=pe.call(O),de=0;!(ee=O.next()).done;)ee=ee.value,pe=$+K(ee,de++),ie+=C(ee,V,ce,pe,G);else if(ee==="object")throw V=String(O),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.");return ie}function z(O,V,ce){if(O==null)return O;var $=[],G=0;return C(O,$,"","",function(ee){return V.call(ce,ee,G++)}),$}function F(O){if(O._status===-1){var V=O._result;V=V(),V.then(function(ce){(O._status===0||O._status===-1)&&(O._status=1,O._result=ce)},function(ce){(O._status===0||O._status===-1)&&(O._status=2,O._result=ce)}),O._status===-1&&(O._status=0,O._result=V)}if(O._status===1)return O._result.default;throw O._result}var te={current:null},Z={transition:null},U={ReactCurrentDispatcher:te,ReactCurrentBatchConfig:Z,ReactCurrentOwner:I};function Q(){throw Error("act(...) is not supported in production builds of React.")}return Ve.Children={map:z,forEach:function(O,V,ce){z(O,function(){V.apply(this,arguments)},ce)},count:function(O){var V=0;return z(O,function(){V++}),V},toArray:function(O){return z(O,function(V){return V})||[]},only:function(O){if(!M(O))throw Error("React.Children.only expected to receive a single React element child.");return O}},Ve.Component=b,Ve.Fragment=r,Ve.Profiler=o,Ve.PureComponent=E,Ve.StrictMode=i,Ve.Suspense=f,Ve.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=U,Ve.act=Q,Ve.cloneElement=function(O,V,ce){if(O==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+O+".");var $=k({},O.props),G=O.key,ee=O.ref,ie=O._owner;if(V!=null){if(V.ref!==void 0&&(ee=V.ref,ie=I.current),V.key!==void 0&&(G=""+V.key),O.type&&O.type.defaultProps)var de=O.type.defaultProps;for(pe in V)A.call(V,pe)&&!L.hasOwnProperty(pe)&&($[pe]=V[pe]===void 0&&de!==void 0?de[pe]:V[pe])}var pe=arguments.length-2;if(pe===1)$.children=ce;else if(1<pe){de=Array(pe);for(var ne=0;ne<pe;ne++)de[ne]=arguments[ne+2];$.children=de}return{$$typeof:e,type:O.type,key:G,ref:ee,props:$,_owner:ie}},Ve.createContext=function(O){return O={$$typeof:u,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},O.Provider={$$typeof:a,_context:O},O.Consumer=O},Ve.createElement=P,Ve.createFactory=function(O){var V=P.bind(null,O);return V.type=O,V},Ve.createRef=function(){return{current:null}},Ve.forwardRef=function(O){return{$$typeof:c,render:O}},Ve.isValidElement=M,Ve.lazy=function(O){return{$$typeof:d,_payload:{_status:-1,_result:O},_init:F}},Ve.memo=function(O,V){return{$$typeof:p,type:O,compare:V===void 0?null:V}},Ve.startTransition=function(O){var V=Z.transition;Z.transition={};try{O()}finally{Z.transition=V}},Ve.unstable_act=Q,Ve.useCallback=function(O,V){return te.current.useCallback(O,V)},Ve.useContext=function(O){return te.current.useContext(O)},Ve.useDebugValue=function(){},Ve.useDeferredValue=function(O){return te.current.useDeferredValue(O)},Ve.useEffect=function(O,V){return te.current.useEffect(O,V)},Ve.useId=function(){return te.current.useId()},Ve.useImperativeHandle=function(O,V,ce){return te.current.useImperativeHandle(O,V,ce)},Ve.useInsertionEffect=function(O,V){return te.current.useInsertionEffect(O,V)},Ve.useLayoutEffect=function(O,V){return te.current.useLayoutEffect(O,V)},Ve.useMemo=function(O,V){return te.current.useMemo(O,V)},Ve.useReducer=function(O,V,ce){return te.current.useReducer(O,V,ce)},Ve.useRef=function(O){return te.current.useRef(O)},Ve.useState=function(O){return te.current.useState(O)},Ve.useSyncExternalStore=function(O,V,ce){return te.current.useSyncExternalStore(O,V,ce)},Ve.useTransition=function(){return te.current.useTransition()},Ve.version="18.3.1",Ve}var Kw;function Ta(){return Kw||(Kw=1,Id.exports=SR()),Id.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 Xw;function kR(){if(Xw)return ra;Xw=1;var e=Ta(),t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function u(c,f,p){var d,g={},y=null,w=null;p!==void 0&&(y=""+p),f.key!==void 0&&(y=""+f.key),f.ref!==void 0&&(w=f.ref);for(d in f)i.call(f,d)&&!a.hasOwnProperty(d)&&(g[d]=f[d]);if(c&&c.defaultProps)for(d in f=c.defaultProps,f)g[d]===void 0&&(g[d]=f[d]);return{$$typeof:t,type:c,key:y,ref:w,props:g,_owner:o.current}}return ra.Fragment=r,ra.jsx=u,ra.jsxs=u,ra}var Qw;function ER(){return Qw||(Qw=1,Ad.exports=kR()),Ad.exports}var m=ER(),Xl={},Md={exports:{}},dn={},Od={exports:{}},Pd={};/**
|
|
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 Zw;function NR(){return Zw||(Zw=1,(function(e){function t(Z,U){var Q=Z.length;Z.push(U);e:for(;0<Q;){var O=Q-1>>>1,V=Z[O];if(0<o(V,U))Z[O]=U,Z[Q]=V,Q=O;else break e}}function r(Z){return Z.length===0?null:Z[0]}function i(Z){if(Z.length===0)return null;var U=Z[0],Q=Z.pop();if(Q!==U){Z[0]=Q;e:for(var O=0,V=Z.length,ce=V>>>1;O<ce;){var $=2*(O+1)-1,G=Z[$],ee=$+1,ie=Z[ee];if(0>o(G,Q))ee<V&&0>o(ie,G)?(Z[O]=ie,Z[ee]=Q,O=ee):(Z[O]=G,Z[$]=Q,O=$);else if(ee<V&&0>o(ie,Q))Z[O]=ie,Z[ee]=Q,O=ee;else break e}}return U}function o(Z,U){var Q=Z.sortIndex-U.sortIndex;return Q!==0?Q:Z.id-U.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var u=Date,c=u.now();e.unstable_now=function(){return u.now()-c}}var f=[],p=[],d=1,g=null,y=3,w=!1,k=!1,_=!1,b=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function N(Z){for(var U=r(p);U!==null;){if(U.callback===null)i(p);else if(U.startTime<=Z)i(p),U.sortIndex=U.expirationTime,t(f,U);else break;U=r(p)}}function j(Z){if(_=!1,N(Z),!k)if(r(f)!==null)k=!0,F(A);else{var U=r(p);U!==null&&te(j,U.startTime-Z)}}function A(Z,U){k=!1,_&&(_=!1,S(P),P=-1),w=!0;var Q=y;try{for(N(U),g=r(f);g!==null&&(!(g.expirationTime>U)||Z&&!q());){var O=g.callback;if(typeof O=="function"){g.callback=null,y=g.priorityLevel;var V=O(g.expirationTime<=U);U=e.unstable_now(),typeof V=="function"?g.callback=V:g===r(f)&&i(f),N(U)}else i(f);g=r(f)}if(g!==null)var ce=!0;else{var $=r(p);$!==null&&te(j,$.startTime-U),ce=!1}return ce}finally{g=null,y=Q,w=!1}}var I=!1,L=null,P=-1,D=5,M=-1;function q(){return!(e.unstable_now()-M<D)}function W(){if(L!==null){var Z=e.unstable_now();M=Z;var U=!0;try{U=L(!0,Z)}finally{U?K():(I=!1,L=null)}}else I=!1}var K;if(typeof E=="function")K=function(){E(W)};else if(typeof MessageChannel<"u"){var C=new MessageChannel,z=C.port2;C.port1.onmessage=W,K=function(){z.postMessage(null)}}else K=function(){b(W,0)};function F(Z){L=Z,I||(I=!0,K())}function te(Z,U){P=b(function(){Z(e.unstable_now())},U)}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(){k||w||(k=!0,F(A))},e.unstable_forceFrameRate=function(Z){0>Z||125<Z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<Z?Math.floor(1e3/Z):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return r(f)},e.unstable_next=function(Z){switch(y){case 1:case 2:case 3:var U=3;break;default:U=y}var Q=y;y=U;try{return Z()}finally{y=Q}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(Z,U){switch(Z){case 1:case 2:case 3:case 4:case 5:break;default:Z=3}var Q=y;y=Z;try{return U()}finally{y=Q}},e.unstable_scheduleCallback=function(Z,U,Q){var O=e.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?O+Q:O):Q=O,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:U,priorityLevel:Z,startTime:Q,expirationTime:V,sortIndex:-1},Q>O?(Z.sortIndex=Q,t(p,Z),r(f)===null&&Z===r(p)&&(_?(S(P),P=-1):_=!0,te(j,Q-O))):(Z.sortIndex=V,t(f,Z),k||w||(k=!0,F(A))),Z},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(Z){var U=y;return function(){var Q=y;y=U;try{return Z.apply(this,arguments)}finally{y=Q}}}})(Pd)),Pd}var Jw;function CR(){return Jw||(Jw=1,Od.exports=NR()),Od.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 ex;function jR(){if(ex)return dn;ex=1;var e=Ta(),t=CR();function r(n){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+n,l=1;l<arguments.length;l++)s+="&args[]="+encodeURIComponent(arguments[l]);return"Minified React error #"+n+"; 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 a(n,s){u(n,s),u(n+"Capture",s)}function u(n,s){for(o[n]=s,n=0;n<s.length;n++)i.add(s[n])}var c=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f=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={},g={};function y(n){return f.call(g,n)?!0:f.call(d,n)?!1:p.test(n)?g[n]=!0:(d[n]=!0,!1)}function w(n,s,l,h){if(l!==null&&l.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return h?!1:l!==null?!l.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function k(n,s,l,h){if(s===null||typeof s>"u"||w(n,s,l,h))return!0;if(h)return!1;if(l!==null)switch(l.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 _(n,s,l,h,v,x,T){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=h,this.attributeNamespace=v,this.mustUseProperty=l,this.propertyName=n,this.type=s,this.sanitizeURL=x,this.removeEmptyString=T}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){b[n]=new _(n,0,!1,n,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var s=n[0];b[s]=new _(s,1,!1,n[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(n){b[n]=new _(n,2,!1,n.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){b[n]=new _(n,2,!1,n,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(n){b[n]=new _(n,3,!1,n.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(n){b[n]=new _(n,3,!0,n,null,!1,!1)}),["capture","download"].forEach(function(n){b[n]=new _(n,4,!1,n,null,!1,!1)}),["cols","rows","size","span"].forEach(function(n){b[n]=new _(n,6,!1,n,null,!1,!1)}),["rowSpan","start"].forEach(function(n){b[n]=new _(n,5,!1,n.toLowerCase(),null,!1,!1)});var S=/[\-:]([a-z])/g;function E(n){return n[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(n){var s=n.replace(S,E);b[s]=new _(s,1,!1,n,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var s=n.replace(S,E);b[s]=new _(s,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(n){var s=n.replace(S,E);b[s]=new _(s,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(n){b[n]=new _(n,1,!1,n.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(n){b[n]=new _(n,1,!1,n.toLowerCase(),null,!0,!0)});function N(n,s,l,h){var v=b.hasOwnProperty(s)?b[s]:null;(v!==null?v.type!==0:h||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(k(s,l,v,h)&&(l=null),h||v===null?y(s)&&(l===null?n.removeAttribute(s):n.setAttribute(s,""+l)):v.mustUseProperty?n[v.propertyName]=l===null?v.type===3?!1:"":l:(s=v.attributeName,h=v.attributeNamespace,l===null?n.removeAttribute(s):(v=v.type,l=v===3||v===4&&l===!0?"":""+l,h?n.setAttributeNS(h,s,l):n.setAttribute(s,l))))}var j=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,A=Symbol.for("react.element"),I=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),M=Symbol.for("react.provider"),q=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),K=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),te=Symbol.for("react.offscreen"),Z=Symbol.iterator;function U(n){return n===null||typeof n!="object"?null:(n=Z&&n[Z]||n["@@iterator"],typeof n=="function"?n:null)}var Q=Object.assign,O;function V(n){if(O===void 0)try{throw Error()}catch(l){var s=l.stack.trim().match(/\n( *(at )?)/);O=s&&s[1]||""}return`
|
|
34
|
+
`+O+n}var ce=!1;function $(n,s){if(!n||ce)return"";ce=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(s)if(s=function(){throw Error()},Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(ae){var h=ae}Reflect.construct(n,[],s)}else{try{s.call()}catch(ae){h=ae}n.call(s.prototype)}else{try{throw Error()}catch(ae){h=ae}n()}}catch(ae){if(ae&&h&&typeof ae.stack=="string"){for(var v=ae.stack.split(`
|
|
35
|
+
`),x=h.stack.split(`
|
|
36
|
+
`),T=v.length-1,B=x.length-1;1<=T&&0<=B&&v[T]!==x[B];)B--;for(;1<=T&&0<=B;T--,B--)if(v[T]!==x[B]){if(T!==1||B!==1)do if(T--,B--,0>B||v[T]!==x[B]){var Y=`
|
|
37
|
+
`+v[T].replace(" at new "," at ");return n.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",n.displayName)),Y}while(1<=T&&0<=B);break}}}finally{ce=!1,Error.prepareStackTrace=l}return(n=n?n.displayName||n.name:"")?V(n):""}function G(n){switch(n.tag){case 5:return V(n.type);case 16:return V("Lazy");case 13:return V("Suspense");case 19:return V("SuspenseList");case 0:case 2:case 15:return n=$(n.type,!1),n;case 11:return n=$(n.type.render,!1),n;case 1:return n=$(n.type,!0),n;default:return""}}function ee(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case L:return"Fragment";case I:return"Portal";case D:return"Profiler";case P:return"StrictMode";case K:return"Suspense";case C:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case q:return(n.displayName||"Context")+".Consumer";case M:return(n._context.displayName||"Context")+".Provider";case W:var s=n.render;return n=n.displayName,n||(n=s.displayName||s.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case z:return s=n.displayName||null,s!==null?s:ee(n.type)||"Memo";case F:s=n._payload,n=n._init;try{return ee(n(s))}catch{}}return null}function ie(n){var s=n.type;switch(n.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 n=s.render,n=n.displayName||n.name||"",s.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ee(s);case 8:return s===P?"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 de(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function pe(n){var s=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function ne(n){var s=pe(n)?"checked":"value",l=Object.getOwnPropertyDescriptor(n.constructor.prototype,s),h=""+n[s];if(!n.hasOwnProperty(s)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var v=l.get,x=l.set;return Object.defineProperty(n,s,{configurable:!0,get:function(){return v.call(this)},set:function(T){h=""+T,x.call(this,T)}}),Object.defineProperty(n,s,{enumerable:l.enumerable}),{getValue:function(){return h},setValue:function(T){h=""+T},stopTracking:function(){n._valueTracker=null,delete n[s]}}}}function Pe(n){n._valueTracker||(n._valueTracker=ne(n))}function He(n){if(!n)return!1;var s=n._valueTracker;if(!s)return!0;var l=s.getValue(),h="";return n&&(h=pe(n)?n.checked?"true":"false":n.value),n=h,n!==l?(s.setValue(n),!0):!1}function ze(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function Oe(n,s){var l=s.checked;return Q({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:l??n._wrapperState.initialChecked})}function _e(n,s){var l=s.defaultValue==null?"":s.defaultValue,h=s.checked!=null?s.checked:s.defaultChecked;l=de(s.value!=null?s.value:l),n._wrapperState={initialChecked:h,initialValue:l,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function Qe(n,s){s=s.checked,s!=null&&N(n,"checked",s,!1)}function ye(n,s){Qe(n,s);var l=de(s.value),h=s.type;if(l!=null)h==="number"?(l===0&&n.value===""||n.value!=l)&&(n.value=""+l):n.value!==""+l&&(n.value=""+l);else if(h==="submit"||h==="reset"){n.removeAttribute("value");return}s.hasOwnProperty("value")?qe(n,s.type,l):s.hasOwnProperty("defaultValue")&&qe(n,s.type,de(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(n.defaultChecked=!!s.defaultChecked)}function we(n,s,l){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var h=s.type;if(!(h!=="submit"&&h!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+n._wrapperState.initialValue,l||s===n.value||(n.value=s),n.defaultValue=s}l=n.name,l!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,l!==""&&(n.name=l)}function qe(n,s,l){(s!=="number"||ze(n.ownerDocument)!==n)&&(l==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+l&&(n.defaultValue=""+l))}var dt=Array.isArray;function Ae(n,s,l,h){if(n=n.options,s){s={};for(var v=0;v<l.length;v++)s["$"+l[v]]=!0;for(l=0;l<n.length;l++)v=s.hasOwnProperty("$"+n[l].value),n[l].selected!==v&&(n[l].selected=v),v&&h&&(n[l].defaultSelected=!0)}else{for(l=""+de(l),s=null,v=0;v<n.length;v++){if(n[v].value===l){n[v].selected=!0,h&&(n[v].defaultSelected=!0);return}s!==null||n[v].disabled||(s=n[v])}s!==null&&(s.selected=!0)}}function ot(n,s){if(s.dangerouslySetInnerHTML!=null)throw Error(r(91));return Q({},s,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function We(n,s){var l=s.value;if(l==null){if(l=s.children,s=s.defaultValue,l!=null){if(s!=null)throw Error(r(92));if(dt(l)){if(1<l.length)throw Error(r(93));l=l[0]}s=l}s==null&&(s=""),l=s}n._wrapperState={initialValue:de(l)}}function Ye(n,s){var l=de(s.value),h=de(s.defaultValue);l!=null&&(l=""+l,l!==n.value&&(n.value=l),s.defaultValue==null&&n.defaultValue!==l&&(n.defaultValue=l)),h!=null&&(n.defaultValue=""+h)}function pt(n){var s=n.textContent;s===n._wrapperState.initialValue&&s!==""&&s!==null&&(n.value=s)}function _t(n){switch(n){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 se(n,s){return n==null||n==="http://www.w3.org/1999/xhtml"?_t(s):n==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var $e,De=(function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,l,h,v){MSApp.execUnsafeLocalFunction(function(){return n(s,l,h,v)})}:n})(function(n,s){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=s;else{for($e=$e||document.createElement("div"),$e.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=$e.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;s.firstChild;)n.appendChild(s.firstChild)}});function Te(n,s){if(s){var l=n.firstChild;if(l&&l===n.lastChild&&l.nodeType===3){l.nodeValue=s;return}}n.textContent=s}var Fe={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},Ze=["Webkit","ms","Moz","O"];Object.keys(Fe).forEach(function(n){Ze.forEach(function(s){s=s+n.charAt(0).toUpperCase()+n.substring(1),Fe[s]=Fe[n]})});function lt(n,s,l){return s==null||typeof s=="boolean"||s===""?"":l||typeof s!="number"||s===0||Fe.hasOwnProperty(n)&&Fe[n]?(""+s).trim():s+"px"}function ke(n,s){n=n.style;for(var l in s)if(s.hasOwnProperty(l)){var h=l.indexOf("--")===0,v=lt(l,s[l],h);l==="float"&&(l="cssFloat"),h?n.setProperty(l,v):n[l]=v}}var rt=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 tt(n,s){if(s){if(rt[n]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(r(137,n));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 ut(n,s){if(n.indexOf("-")===-1)return typeof s.is=="string";switch(n){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 zn=null;function _r(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Sn=null,mn=null,gn=null;function kn(n){if(n=Bo(n)){if(typeof Sn!="function")throw Error(r(280));var s=n.stateNode;s&&(s=cl(s),Sn(n.stateNode,n.type,s))}}function _s(n){mn?gn?gn.push(n):gn=[n]:mn=n}function bs(){if(mn){var n=mn,s=gn;if(gn=mn=null,kn(n),s)for(n=0;n<s.length;n++)kn(s[n])}}function li(n,s){return n(s)}function Ss(){}var Bn=!1;function ui(n,s,l){if(Bn)return n(s,l);Bn=!0;try{return li(n,s,l)}finally{Bn=!1,(mn!==null||gn!==null)&&(Ss(),bs())}}function or(n,s){var l=n.stateNode;if(l===null)return null;var h=cl(l);if(h===null)return null;l=h[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":(h=!h.disabled)||(n=n.type,h=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!h;break e;default:n=!1}if(n)return null;if(l&&typeof l!="function")throw Error(r(231,s,typeof l));return l}var ar=!1;if(c)try{var En={};Object.defineProperty(En,"passive",{get:function(){ar=!0}}),window.addEventListener("test",En,En),window.removeEventListener("test",En,En)}catch{ar=!1}function wo(n,s,l,h,v,x,T,B,Y){var ae=Array.prototype.slice.call(arguments,3);try{s.apply(l,ae)}catch(me){this.onError(me)}}var Un=!1,mt=null,Wr=!1,Hn=null,xo={onError:function(n){Un=!0,mt=n}};function _o(n,s,l,h,v,x,T,B,Y){Un=!1,mt=null,wo.apply(xo,arguments)}function Nn(n,s,l,h,v,x,T,B,Y){if(_o.apply(this,arguments),Un){if(Un){var ae=mt;Un=!1,mt=null}else throw Error(r(198));Wr||(Wr=!0,Hn=ae)}}function en(n){var s=n,l=n;if(n.alternate)for(;s.return;)s=s.return;else{n=s;do s=n,(s.flags&4098)!==0&&(l=s.return),n=s.return;while(n)}return s.tag===3?l:null}function ci(n){if(n.tag===13){var s=n.memoizedState;if(s===null&&(n=n.alternate,n!==null&&(s=n.memoizedState)),s!==null)return s.dehydrated}return null}function di(n){if(en(n)!==n)throw Error(r(188))}function fi(n){var s=n.alternate;if(!s){if(s=en(n),s===null)throw Error(r(188));return s!==n?null:n}for(var l=n,h=s;;){var v=l.return;if(v===null)break;var x=v.alternate;if(x===null){if(h=v.return,h!==null){l=h;continue}break}if(v.child===x.child){for(x=v.child;x;){if(x===l)return di(v),n;if(x===h)return di(v),s;x=x.sibling}throw Error(r(188))}if(l.return!==h.return)l=v,h=x;else{for(var T=!1,B=v.child;B;){if(B===l){T=!0,l=v,h=x;break}if(B===h){T=!0,h=v,l=x;break}B=B.sibling}if(!T){for(B=x.child;B;){if(B===l){T=!0,l=x,h=v;break}if(B===h){T=!0,h=x,l=v;break}B=B.sibling}if(!T)throw Error(r(189))}}if(l.alternate!==h)throw Error(r(190))}if(l.tag!==3)throw Error(r(188));return l.stateNode.current===l?n:s}function ks(n){return n=fi(n),n!==null?Wn(n):null}function Wn(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var s=Wn(n);if(s!==null)return s;n=n.sibling}return null}var Es=t.unstable_scheduleCallback,Ns=t.unstable_cancelCallback,br=t.unstable_shouldYield,hi=t.unstable_requestPaint,at=t.unstable_now,qt=t.unstable_getCurrentPriorityLevel,lr=t.unstable_ImmediatePriority,Sr=t.unstable_UserBlockingPriority,kr=t.unstable_NormalPriority,pi=t.unstable_LowPriority,ur=t.unstable_IdlePriority,Er=null,Gt=null;function Cs(n){if(Gt&&typeof Gt.onCommitFiberRoot=="function")try{Gt.onCommitFiberRoot(Er,n,void 0,(n.current.flags&128)===128)}catch{}}var tn=Math.clz32?Math.clz32:lc,bo=Math.log,Vr=Math.LN2;function lc(n){return n>>>=0,n===0?32:31-(bo(n)/Vr|0)|0}var Yt=64,Gr=4194304;function Nr(n){switch(n&-n){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 n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function js(n,s){var l=n.pendingLanes;if(l===0)return 0;var h=0,v=n.suspendedLanes,x=n.pingedLanes,T=l&268435455;if(T!==0){var B=T&~v;B!==0?h=Nr(B):(x&=T,x!==0&&(h=Nr(x)))}else T=l&~v,T!==0?h=Nr(T):x!==0&&(h=Nr(x));if(h===0)return 0;if(s!==0&&s!==h&&(s&v)===0&&(v=h&-h,x=s&-s,v>=x||v===16&&(x&4194240)!==0))return s;if((h&4)!==0&&(h|=l&16),s=n.entangledLanes,s!==0)for(n=n.entanglements,s&=h;0<s;)l=31-tn(s),v=1<<l,h|=n[l],s&=~v;return h}function mi(n,s){switch(n){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 So(n,s){for(var l=n.suspendedLanes,h=n.pingedLanes,v=n.expirationTimes,x=n.pendingLanes;0<x;){var T=31-tn(x),B=1<<T,Y=v[T];Y===-1?((B&l)===0||(B&h)!==0)&&(v[T]=mi(B,s)):Y<=s&&(n.expiredLanes|=B),x&=~B}}function Vn(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function ko(){var n=Yt;return Yt<<=1,(Yt&4194240)===0&&(Yt=64),n}function gi(n){for(var s=[],l=0;31>l;l++)s.push(n);return s}function Yr(n,s,l){n.pendingLanes|=s,s!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,s=31-tn(s),n[s]=l}function uc(n,s){var l=n.pendingLanes&~s;n.pendingLanes=s,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=s,n.mutableReadLanes&=s,n.entangledLanes&=s,s=n.entanglements;var h=n.eventTimes;for(n=n.expirationTimes;0<l;){var v=31-tn(l),x=1<<v;s[v]=0,h[v]=-1,n[v]=-1,l&=~x}}function Ts(n,s){var l=n.entangledLanes|=s;for(n=n.entanglements;l;){var h=31-tn(l),v=1<<h;v&s|n[h]&s&&(n[h]|=s),l&=~v}}var Ke=0;function Eo(n){return n&=-n,1<n?4<n?(n&268435455)!==0?16:536870912:4:1}var za,vi,No,Ba,Kt,Co=!1,Kr=[],Xt=null,nn=null,Cn=null,Cr=new Map,Xr=new Map,vn=[],Ua="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 Ha(n,s){switch(n){case"focusin":case"focusout":Xt=null;break;case"dragenter":case"dragleave":nn=null;break;case"mouseover":case"mouseout":Cn=null;break;case"pointerover":case"pointerout":Cr.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Xr.delete(s.pointerId)}}function Rs(n,s,l,h,v,x){return n===null||n.nativeEvent!==x?(n={blockedOn:s,domEventName:l,eventSystemFlags:h,nativeEvent:x,targetContainers:[v]},s!==null&&(s=Bo(s),s!==null&&vi(s)),n):(n.eventSystemFlags|=h,s=n.targetContainers,v!==null&&s.indexOf(v)===-1&&s.push(v),n)}function Wa(n,s,l,h,v){switch(s){case"focusin":return Xt=Rs(Xt,n,s,l,h,v),!0;case"dragenter":return nn=Rs(nn,n,s,l,h,v),!0;case"mouseover":return Cn=Rs(Cn,n,s,l,h,v),!0;case"pointerover":var x=v.pointerId;return Cr.set(x,Rs(Cr.get(x)||null,n,s,l,h,v)),!0;case"gotpointercapture":return x=v.pointerId,Xr.set(x,Rs(Xr.get(x)||null,n,s,l,h,v)),!0}return!1}function Va(n){var s=Ls(n.target);if(s!==null){var l=en(s);if(l!==null){if(s=l.tag,s===13){if(s=ci(l),s!==null){n.blockedOn=s,Kt(n.priority,function(){No(l)});return}}else if(s===3&&l.stateNode.current.memoizedState.isDehydrated){n.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}n.blockedOn=null}function yi(n){if(n.blockedOn!==null)return!1;for(var s=n.targetContainers;0<s.length;){var l=bi(n.domEventName,n.eventSystemFlags,s[0],n.nativeEvent);if(l===null){l=n.nativeEvent;var h=new l.constructor(l.type,l);zn=h,l.target.dispatchEvent(h),zn=null}else return s=Bo(l),s!==null&&vi(s),n.blockedOn=l,!1;s.shift()}return!0}function wi(n,s,l){yi(n)&&l.delete(s)}function cr(){Co=!1,Xt!==null&&yi(Xt)&&(Xt=null),nn!==null&&yi(nn)&&(nn=null),Cn!==null&&yi(Cn)&&(Cn=null),Cr.forEach(wi),Xr.forEach(wi)}function jr(n,s){n.blockedOn===s&&(n.blockedOn=null,Co||(Co=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,cr)))}function Qr(n){function s(v){return jr(v,n)}if(0<Kr.length){jr(Kr[0],n);for(var l=1;l<Kr.length;l++){var h=Kr[l];h.blockedOn===n&&(h.blockedOn=null)}}for(Xt!==null&&jr(Xt,n),nn!==null&&jr(nn,n),Cn!==null&&jr(Cn,n),Cr.forEach(s),Xr.forEach(s),l=0;l<vn.length;l++)h=vn[l],h.blockedOn===n&&(h.blockedOn=null);for(;0<vn.length&&(l=vn[0],l.blockedOn===null);)Va(l),l.blockedOn===null&&vn.shift()}var Zr=j.ReactCurrentBatchConfig,xi=!0;function Ga(n,s,l,h){var v=Ke,x=Zr.transition;Zr.transition=null;try{Ke=1,jn(n,s,l,h)}finally{Ke=v,Zr.transition=x}}function Ya(n,s,l,h){var v=Ke,x=Zr.transition;Zr.transition=null;try{Ke=4,jn(n,s,l,h)}finally{Ke=v,Zr.transition=x}}function jn(n,s,l,h){if(xi){var v=bi(n,s,l,h);if(v===null)_c(n,s,h,_i,l),Ha(n,h);else if(Wa(v,n,s,l,h))h.stopPropagation();else if(Ha(n,h),s&4&&-1<Ua.indexOf(n)){for(;v!==null;){var x=Bo(v);if(x!==null&&za(x),x=bi(n,s,l,h),x===null&&_c(n,s,h,_i,l),x===v)break;v=x}v!==null&&h.stopPropagation()}else _c(n,s,h,null,l)}}var _i=null;function bi(n,s,l,h){if(_i=null,n=_r(h),n=Ls(n),n!==null)if(s=en(n),s===null)n=null;else if(l=s.tag,l===13){if(n=ci(s),n!==null)return n;n=null}else if(l===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;n=null}else s!==n&&(n=null);return _i=n,null}function Ka(n){switch(n){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(qt()){case lr:return 1;case Sr:return 4;case kr:case pi:return 16;case ur:return 536870912;default:return 16}default:return 16}}var yn=null,jo=null,jt=null;function Si(){if(jt)return jt;var n,s=jo,l=s.length,h,v="value"in yn?yn.value:yn.textContent,x=v.length;for(n=0;n<l&&s[n]===v[n];n++);var T=l-n;for(h=1;h<=T&&s[l-h]===v[x-h];h++);return jt=v.slice(n,1<h?1-h:void 0)}function As(n){var s=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&s===13&&(n=13)):n=s,n===10&&(n=13),32<=n||n===13?n:0}function Is(){return!0}function To(){return!1}function Ot(n){function s(l,h,v,x,T){this._reactName=l,this._targetInst=v,this.type=h,this.nativeEvent=x,this.target=T,this.currentTarget=null;for(var B in n)n.hasOwnProperty(B)&&(l=n[B],this[B]=l?l(x):x[B]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Is:To,this.isPropagationStopped=To,this}return Q(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Is)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Is)},persist:function(){},isPersistent:Is}),s}var dr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ki=Ot(dr),fr=Q({},dr,{view:0,detail:0}),Xa=Ot(fr),Ms,Ei,Tr,rn=Q({},fr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:je,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Tr&&(Tr&&n.type==="mousemove"?(Ms=n.screenX-Tr.screenX,Ei=n.screenY-Tr.screenY):Ei=Ms=0,Tr=n),Ms)},movementY:function(n){return"movementY"in n?n.movementY:Ei}}),Ro=Ot(rn),Qa=Q({},rn,{dataTransfer:0}),cc=Ot(Qa),dc=Q({},fr,{relatedTarget:0}),Ni=Ot(dc),sn=Q({},dr,{animationName:0,elapsedTime:0,pseudoElement:0}),Za=Ot(sn),Ja=Q({},dr,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),el=Ot(Ja),tl=Q({},dr,{data:0}),H=Ot(tl),X={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},le={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"},fe={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ee(n){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(n):(n=fe[n])?!!s[n]:!1}function je(){return Ee}var Be=Q({},fr,{key:function(n){if(n.key){var s=X[n.key]||n.key;if(s!=="Unidentified")return s}return n.type==="keypress"?(n=As(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?le[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:je,charCode:function(n){return n.type==="keypress"?As(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?As(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),Je=Ot(Be),st=Q({},rn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ue=Ot(st),gt=Q({},fr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:je}),Tn=Ot(gt),Os=Q({},dr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ao=Ot(Os),Ps=Q({},rn,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),Io=Ot(Ps),nl=[9,13,27,32],Jr=c&&"CompositionEvent"in window,Qt=null;c&&"documentMode"in document&&(Qt=document.documentMode);var Et=c&&"TextEvent"in window&&!Qt,Mo=c&&(!Jr||Qt&&8<Qt&&11>=Qt),zy=" ",By=!1;function Uy(n,s){switch(n){case"keyup":return nl.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hy(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Ci=!1;function xT(n,s){switch(n){case"compositionend":return Hy(s);case"keypress":return s.which!==32?null:(By=!0,zy);case"textInput":return n=s.data,n===zy&&By?null:n;default:return null}}function _T(n,s){if(Ci)return n==="compositionend"||!Jr&&Uy(n,s)?(n=Si(),jt=jo=yn=null,Ci=!1,n):null;switch(n){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 Mo&&s.locale!=="ko"?null:s.data;default:return null}}var bT={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Wy(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s==="input"?!!bT[n.type]:s==="textarea"}function Vy(n,s,l,h){_s(h),s=al(s,"onChange"),0<s.length&&(l=new ki("onChange","change",null,l,h),n.push({event:l,listeners:s}))}var Oo=null,Po=null;function ST(n){c0(n,0)}function rl(n){var s=Ii(n);if(He(s))return n}function kT(n,s){if(n==="change")return s}var Gy=!1;if(c){var fc;if(c){var hc="oninput"in document;if(!hc){var Yy=document.createElement("div");Yy.setAttribute("oninput","return;"),hc=typeof Yy.oninput=="function"}fc=hc}else fc=!1;Gy=fc&&(!document.documentMode||9<document.documentMode)}function Ky(){Oo&&(Oo.detachEvent("onpropertychange",Xy),Po=Oo=null)}function Xy(n){if(n.propertyName==="value"&&rl(Po)){var s=[];Vy(s,Po,n,_r(n)),ui(ST,s)}}function ET(n,s,l){n==="focusin"?(Ky(),Oo=s,Po=l,Oo.attachEvent("onpropertychange",Xy)):n==="focusout"&&Ky()}function NT(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return rl(Po)}function CT(n,s){if(n==="click")return rl(s)}function jT(n,s){if(n==="input"||n==="change")return rl(s)}function TT(n,s){return n===s&&(n!==0||1/n===1/s)||n!==n&&s!==s}var Gn=typeof Object.is=="function"?Object.is:TT;function Lo(n,s){if(Gn(n,s))return!0;if(typeof n!="object"||n===null||typeof s!="object"||s===null)return!1;var l=Object.keys(n),h=Object.keys(s);if(l.length!==h.length)return!1;for(h=0;h<l.length;h++){var v=l[h];if(!f.call(s,v)||!Gn(n[v],s[v]))return!1}return!0}function Qy(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Zy(n,s){var l=Qy(n);n=0;for(var h;l;){if(l.nodeType===3){if(h=n+l.textContent.length,n<=s&&h>=s)return{node:l,offset:s-n};n=h}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Qy(l)}}function Jy(n,s){return n&&s?n===s?!0:n&&n.nodeType===3?!1:s&&s.nodeType===3?Jy(n,s.parentNode):"contains"in n?n.contains(s):n.compareDocumentPosition?!!(n.compareDocumentPosition(s)&16):!1:!1}function e0(){for(var n=window,s=ze();s instanceof n.HTMLIFrameElement;){try{var l=typeof s.contentWindow.location.href=="string"}catch{l=!1}if(l)n=s.contentWindow;else break;s=ze(n.document)}return s}function pc(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s&&(s==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||s==="textarea"||n.contentEditable==="true")}function RT(n){var s=e0(),l=n.focusedElem,h=n.selectionRange;if(s!==l&&l&&l.ownerDocument&&Jy(l.ownerDocument.documentElement,l)){if(h!==null&&pc(l)){if(s=h.start,n=h.end,n===void 0&&(n=s),"selectionStart"in l)l.selectionStart=s,l.selectionEnd=Math.min(n,l.value.length);else if(n=(s=l.ownerDocument||document)&&s.defaultView||window,n.getSelection){n=n.getSelection();var v=l.textContent.length,x=Math.min(h.start,v);h=h.end===void 0?x:Math.min(h.end,v),!n.extend&&x>h&&(v=h,h=x,x=v),v=Zy(l,x);var T=Zy(l,h);v&&T&&(n.rangeCount!==1||n.anchorNode!==v.node||n.anchorOffset!==v.offset||n.focusNode!==T.node||n.focusOffset!==T.offset)&&(s=s.createRange(),s.setStart(v.node,v.offset),n.removeAllRanges(),x>h?(n.addRange(s),n.extend(T.node,T.offset)):(s.setEnd(T.node,T.offset),n.addRange(s)))}}for(s=[],n=l;n=n.parentNode;)n.nodeType===1&&s.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;l<s.length;l++)n=s[l],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var AT=c&&"documentMode"in document&&11>=document.documentMode,ji=null,mc=null,$o=null,gc=!1;function t0(n,s,l){var h=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;gc||ji==null||ji!==ze(h)||(h=ji,"selectionStart"in h&&pc(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),$o&&Lo($o,h)||($o=h,h=al(mc,"onSelect"),0<h.length&&(s=new ki("onSelect","select",null,s,l),n.push({event:s,listeners:h}),s.target=ji)))}function sl(n,s){var l={};return l[n.toLowerCase()]=s.toLowerCase(),l["Webkit"+n]="webkit"+s,l["Moz"+n]="moz"+s,l}var Ti={animationend:sl("Animation","AnimationEnd"),animationiteration:sl("Animation","AnimationIteration"),animationstart:sl("Animation","AnimationStart"),transitionend:sl("Transition","TransitionEnd")},vc={},n0={};c&&(n0=document.createElement("div").style,"AnimationEvent"in window||(delete Ti.animationend.animation,delete Ti.animationiteration.animation,delete Ti.animationstart.animation),"TransitionEvent"in window||delete Ti.transitionend.transition);function il(n){if(vc[n])return vc[n];if(!Ti[n])return n;var s=Ti[n],l;for(l in s)if(s.hasOwnProperty(l)&&l in n0)return vc[n]=s[l];return n}var r0=il("animationend"),s0=il("animationiteration"),i0=il("animationstart"),o0=il("transitionend"),a0=new Map,l0="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 es(n,s){a0.set(n,s),a(s,[n])}for(var yc=0;yc<l0.length;yc++){var wc=l0[yc],IT=wc.toLowerCase(),MT=wc[0].toUpperCase()+wc.slice(1);es(IT,"on"+MT)}es(r0,"onAnimationEnd"),es(s0,"onAnimationIteration"),es(i0,"onAnimationStart"),es("dblclick","onDoubleClick"),es("focusin","onFocus"),es("focusout","onBlur"),es(o0,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),a("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),a("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),a("onBeforeInput",["compositionend","keypress","textInput","paste"]),a("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var qo="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(" "),OT=new Set("cancel close invalid load scroll toggle".split(" ").concat(qo));function u0(n,s,l){var h=n.type||"unknown-event";n.currentTarget=l,Nn(h,s,void 0,n),n.currentTarget=null}function c0(n,s){s=(s&4)!==0;for(var l=0;l<n.length;l++){var h=n[l],v=h.event;h=h.listeners;e:{var x=void 0;if(s)for(var T=h.length-1;0<=T;T--){var B=h[T],Y=B.instance,ae=B.currentTarget;if(B=B.listener,Y!==x&&v.isPropagationStopped())break e;u0(v,B,ae),x=Y}else for(T=0;T<h.length;T++){if(B=h[T],Y=B.instance,ae=B.currentTarget,B=B.listener,Y!==x&&v.isPropagationStopped())break e;u0(v,B,ae),x=Y}}}if(Wr)throw n=Hn,Wr=!1,Hn=null,n}function ft(n,s){var l=s[Cc];l===void 0&&(l=s[Cc]=new Set);var h=n+"__bubble";l.has(h)||(d0(s,n,2,!1),l.add(h))}function xc(n,s,l){var h=0;s&&(h|=4),d0(l,n,h,s)}var ol="_reactListening"+Math.random().toString(36).slice(2);function Do(n){if(!n[ol]){n[ol]=!0,i.forEach(function(l){l!=="selectionchange"&&(OT.has(l)||xc(l,!1,n),xc(l,!0,n))});var s=n.nodeType===9?n:n.ownerDocument;s===null||s[ol]||(s[ol]=!0,xc("selectionchange",!1,s))}}function d0(n,s,l,h){switch(Ka(s)){case 1:var v=Ga;break;case 4:v=Ya;break;default:v=jn}l=v.bind(null,s,l,n),v=void 0,!ar||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(v=!0),h?v!==void 0?n.addEventListener(s,l,{capture:!0,passive:v}):n.addEventListener(s,l,!0):v!==void 0?n.addEventListener(s,l,{passive:v}):n.addEventListener(s,l,!1)}function _c(n,s,l,h,v){var x=h;if((s&1)===0&&(s&2)===0&&h!==null)e:for(;;){if(h===null)return;var T=h.tag;if(T===3||T===4){var B=h.stateNode.containerInfo;if(B===v||B.nodeType===8&&B.parentNode===v)break;if(T===4)for(T=h.return;T!==null;){var Y=T.tag;if((Y===3||Y===4)&&(Y=T.stateNode.containerInfo,Y===v||Y.nodeType===8&&Y.parentNode===v))return;T=T.return}for(;B!==null;){if(T=Ls(B),T===null)return;if(Y=T.tag,Y===5||Y===6){h=x=T;continue e}B=B.parentNode}}h=h.return}ui(function(){var ae=x,me=_r(l),ge=[];e:{var he=a0.get(n);if(he!==void 0){var xe=ki,Se=n;switch(n){case"keypress":if(As(l)===0)break e;case"keydown":case"keyup":xe=Je;break;case"focusin":Se="focus",xe=Ni;break;case"focusout":Se="blur",xe=Ni;break;case"beforeblur":case"afterblur":xe=Ni;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":xe=Ro;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":xe=cc;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":xe=Tn;break;case r0:case s0:case i0:xe=Za;break;case o0:xe=Ao;break;case"scroll":xe=Xa;break;case"wheel":xe=Io;break;case"copy":case"cut":case"paste":xe=el;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":xe=Ue}var Ne=(s&4)!==0,kt=!Ne&&n==="scroll",re=Ne?he!==null?he+"Capture":null:he;Ne=[];for(var J=ae,oe;J!==null;){oe=J;var ve=oe.stateNode;if(oe.tag===5&&ve!==null&&(oe=ve,re!==null&&(ve=or(J,re),ve!=null&&Ne.push(Fo(J,ve,oe)))),kt)break;J=J.return}0<Ne.length&&(he=new xe(he,Se,null,l,me),ge.push({event:he,listeners:Ne}))}}if((s&7)===0){e:{if(he=n==="mouseover"||n==="pointerover",xe=n==="mouseout"||n==="pointerout",he&&l!==zn&&(Se=l.relatedTarget||l.fromElement)&&(Ls(Se)||Se[Rr]))break e;if((xe||he)&&(he=me.window===me?me:(he=me.ownerDocument)?he.defaultView||he.parentWindow:window,xe?(Se=l.relatedTarget||l.toElement,xe=ae,Se=Se?Ls(Se):null,Se!==null&&(kt=en(Se),Se!==kt||Se.tag!==5&&Se.tag!==6)&&(Se=null)):(xe=null,Se=ae),xe!==Se)){if(Ne=Ro,ve="onMouseLeave",re="onMouseEnter",J="mouse",(n==="pointerout"||n==="pointerover")&&(Ne=Ue,ve="onPointerLeave",re="onPointerEnter",J="pointer"),kt=xe==null?he:Ii(xe),oe=Se==null?he:Ii(Se),he=new Ne(ve,J+"leave",xe,l,me),he.target=kt,he.relatedTarget=oe,ve=null,Ls(me)===ae&&(Ne=new Ne(re,J+"enter",Se,l,me),Ne.target=oe,Ne.relatedTarget=kt,ve=Ne),kt=ve,xe&&Se)t:{for(Ne=xe,re=Se,J=0,oe=Ne;oe;oe=Ri(oe))J++;for(oe=0,ve=re;ve;ve=Ri(ve))oe++;for(;0<J-oe;)Ne=Ri(Ne),J--;for(;0<oe-J;)re=Ri(re),oe--;for(;J--;){if(Ne===re||re!==null&&Ne===re.alternate)break t;Ne=Ri(Ne),re=Ri(re)}Ne=null}else Ne=null;xe!==null&&f0(ge,he,xe,Ne,!1),Se!==null&&kt!==null&&f0(ge,kt,Se,Ne,!0)}}e:{if(he=ae?Ii(ae):window,xe=he.nodeName&&he.nodeName.toLowerCase(),xe==="select"||xe==="input"&&he.type==="file")var Ce=kT;else if(Wy(he))if(Gy)Ce=jT;else{Ce=NT;var Ie=ET}else(xe=he.nodeName)&&xe.toLowerCase()==="input"&&(he.type==="checkbox"||he.type==="radio")&&(Ce=CT);if(Ce&&(Ce=Ce(n,ae))){Vy(ge,Ce,l,me);break e}Ie&&Ie(n,he,ae),n==="focusout"&&(Ie=he._wrapperState)&&Ie.controlled&&he.type==="number"&&qe(he,"number",he.value)}switch(Ie=ae?Ii(ae):window,n){case"focusin":(Wy(Ie)||Ie.contentEditable==="true")&&(ji=Ie,mc=ae,$o=null);break;case"focusout":$o=mc=ji=null;break;case"mousedown":gc=!0;break;case"contextmenu":case"mouseup":case"dragend":gc=!1,t0(ge,l,me);break;case"selectionchange":if(AT)break;case"keydown":case"keyup":t0(ge,l,me)}var Me;if(Jr)e:{switch(n){case"compositionstart":var Le="onCompositionStart";break e;case"compositionend":Le="onCompositionEnd";break e;case"compositionupdate":Le="onCompositionUpdate";break e}Le=void 0}else Ci?Uy(n,l)&&(Le="onCompositionEnd"):n==="keydown"&&l.keyCode===229&&(Le="onCompositionStart");Le&&(Mo&&l.locale!=="ko"&&(Ci||Le!=="onCompositionStart"?Le==="onCompositionEnd"&&Ci&&(Me=Si()):(yn=me,jo="value"in yn?yn.value:yn.textContent,Ci=!0)),Ie=al(ae,Le),0<Ie.length&&(Le=new H(Le,n,null,l,me),ge.push({event:Le,listeners:Ie}),Me?Le.data=Me:(Me=Hy(l),Me!==null&&(Le.data=Me)))),(Me=Et?xT(n,l):_T(n,l))&&(ae=al(ae,"onBeforeInput"),0<ae.length&&(me=new H("onBeforeInput","beforeinput",null,l,me),ge.push({event:me,listeners:ae}),me.data=Me))}c0(ge,s)})}function Fo(n,s,l){return{instance:n,listener:s,currentTarget:l}}function al(n,s){for(var l=s+"Capture",h=[];n!==null;){var v=n,x=v.stateNode;v.tag===5&&x!==null&&(v=x,x=or(n,l),x!=null&&h.unshift(Fo(n,x,v)),x=or(n,s),x!=null&&h.push(Fo(n,x,v))),n=n.return}return h}function Ri(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function f0(n,s,l,h,v){for(var x=s._reactName,T=[];l!==null&&l!==h;){var B=l,Y=B.alternate,ae=B.stateNode;if(Y!==null&&Y===h)break;B.tag===5&&ae!==null&&(B=ae,v?(Y=or(l,x),Y!=null&&T.unshift(Fo(l,Y,B))):v||(Y=or(l,x),Y!=null&&T.push(Fo(l,Y,B)))),l=l.return}T.length!==0&&n.push({event:s,listeners:T})}var PT=/\r\n?/g,LT=/\u0000|\uFFFD/g;function h0(n){return(typeof n=="string"?n:""+n).replace(PT,`
|
|
38
|
+
`).replace(LT,"")}function ll(n,s,l){if(s=h0(s),h0(n)!==s&&l)throw Error(r(425))}function ul(){}var bc=null,Sc=null;function kc(n,s){return n==="textarea"||n==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Ec=typeof setTimeout=="function"?setTimeout:void 0,$T=typeof clearTimeout=="function"?clearTimeout:void 0,p0=typeof Promise=="function"?Promise:void 0,qT=typeof queueMicrotask=="function"?queueMicrotask:typeof p0<"u"?function(n){return p0.resolve(null).then(n).catch(DT)}:Ec;function DT(n){setTimeout(function(){throw n})}function Nc(n,s){var l=s,h=0;do{var v=l.nextSibling;if(n.removeChild(l),v&&v.nodeType===8)if(l=v.data,l==="/$"){if(h===0){n.removeChild(v),Qr(s);return}h--}else l!=="$"&&l!=="$?"&&l!=="$!"||h++;l=v}while(l);Qr(s)}function ts(n){for(;n!=null;n=n.nextSibling){var s=n.nodeType;if(s===1||s===3)break;if(s===8){if(s=n.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return n}function m0(n){n=n.previousSibling;for(var s=0;n;){if(n.nodeType===8){var l=n.data;if(l==="$"||l==="$!"||l==="$?"){if(s===0)return n;s--}else l==="/$"&&s++}n=n.previousSibling}return null}var Ai=Math.random().toString(36).slice(2),hr="__reactFiber$"+Ai,zo="__reactProps$"+Ai,Rr="__reactContainer$"+Ai,Cc="__reactEvents$"+Ai,FT="__reactListeners$"+Ai,zT="__reactHandles$"+Ai;function Ls(n){var s=n[hr];if(s)return s;for(var l=n.parentNode;l;){if(s=l[Rr]||l[hr]){if(l=s.alternate,s.child!==null||l!==null&&l.child!==null)for(n=m0(n);n!==null;){if(l=n[hr])return l;n=m0(n)}return s}n=l,l=n.parentNode}return null}function Bo(n){return n=n[hr]||n[Rr],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function Ii(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(r(33))}function cl(n){return n[zo]||null}var jc=[],Mi=-1;function ns(n){return{current:n}}function ht(n){0>Mi||(n.current=jc[Mi],jc[Mi]=null,Mi--)}function ct(n,s){Mi++,jc[Mi]=n.current,n.current=s}var rs={},Bt=ns(rs),on=ns(!1),$s=rs;function Oi(n,s){var l=n.type.contextTypes;if(!l)return rs;var h=n.stateNode;if(h&&h.__reactInternalMemoizedUnmaskedChildContext===s)return h.__reactInternalMemoizedMaskedChildContext;var v={},x;for(x in l)v[x]=s[x];return h&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=s,n.__reactInternalMemoizedMaskedChildContext=v),v}function an(n){return n=n.childContextTypes,n!=null}function dl(){ht(on),ht(Bt)}function g0(n,s,l){if(Bt.current!==rs)throw Error(r(168));ct(Bt,s),ct(on,l)}function v0(n,s,l){var h=n.stateNode;if(s=s.childContextTypes,typeof h.getChildContext!="function")return l;h=h.getChildContext();for(var v in h)if(!(v in s))throw Error(r(108,ie(n)||"Unknown",v));return Q({},l,h)}function fl(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||rs,$s=Bt.current,ct(Bt,n),ct(on,on.current),!0}function y0(n,s,l){var h=n.stateNode;if(!h)throw Error(r(169));l?(n=v0(n,s,$s),h.__reactInternalMemoizedMergedChildContext=n,ht(on),ht(Bt),ct(Bt,n)):ht(on),ct(on,l)}var Ar=null,hl=!1,Tc=!1;function w0(n){Ar===null?Ar=[n]:Ar.push(n)}function BT(n){hl=!0,w0(n)}function ss(){if(!Tc&&Ar!==null){Tc=!0;var n=0,s=Ke;try{var l=Ar;for(Ke=1;n<l.length;n++){var h=l[n];do h=h(!0);while(h!==null)}Ar=null,hl=!1}catch(v){throw Ar!==null&&(Ar=Ar.slice(n+1)),Es(lr,ss),v}finally{Ke=s,Tc=!1}}return null}var Pi=[],Li=0,pl=null,ml=0,Rn=[],An=0,qs=null,Ir=1,Mr="";function Ds(n,s){Pi[Li++]=ml,Pi[Li++]=pl,pl=n,ml=s}function x0(n,s,l){Rn[An++]=Ir,Rn[An++]=Mr,Rn[An++]=qs,qs=n;var h=Ir;n=Mr;var v=32-tn(h)-1;h&=~(1<<v),l+=1;var x=32-tn(s)+v;if(30<x){var T=v-v%5;x=(h&(1<<T)-1).toString(32),h>>=T,v-=T,Ir=1<<32-tn(s)+v|l<<v|h,Mr=x+n}else Ir=1<<x|l<<v|h,Mr=n}function Rc(n){n.return!==null&&(Ds(n,1),x0(n,1,0))}function Ac(n){for(;n===pl;)pl=Pi[--Li],Pi[Li]=null,ml=Pi[--Li],Pi[Li]=null;for(;n===qs;)qs=Rn[--An],Rn[An]=null,Mr=Rn[--An],Rn[An]=null,Ir=Rn[--An],Rn[An]=null}var wn=null,xn=null,vt=!1,Yn=null;function _0(n,s){var l=Pn(5,null,null,0);l.elementType="DELETED",l.stateNode=s,l.return=n,s=n.deletions,s===null?(n.deletions=[l],n.flags|=16):s.push(l)}function b0(n,s){switch(n.tag){case 5:var l=n.type;return s=s.nodeType!==1||l.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(n.stateNode=s,wn=n,xn=ts(s.firstChild),!0):!1;case 6:return s=n.pendingProps===""||s.nodeType!==3?null:s,s!==null?(n.stateNode=s,wn=n,xn=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(l=qs!==null?{id:Ir,overflow:Mr}:null,n.memoizedState={dehydrated:s,treeContext:l,retryLane:1073741824},l=Pn(18,null,null,0),l.stateNode=s,l.return=n,n.child=l,wn=n,xn=null,!0):!1;default:return!1}}function Ic(n){return(n.mode&1)!==0&&(n.flags&128)===0}function Mc(n){if(vt){var s=xn;if(s){var l=s;if(!b0(n,s)){if(Ic(n))throw Error(r(418));s=ts(l.nextSibling);var h=wn;s&&b0(n,s)?_0(h,l):(n.flags=n.flags&-4097|2,vt=!1,wn=n)}}else{if(Ic(n))throw Error(r(418));n.flags=n.flags&-4097|2,vt=!1,wn=n}}}function S0(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;wn=n}function gl(n){if(n!==wn)return!1;if(!vt)return S0(n),vt=!0,!1;var s;if((s=n.tag!==3)&&!(s=n.tag!==5)&&(s=n.type,s=s!=="head"&&s!=="body"&&!kc(n.type,n.memoizedProps)),s&&(s=xn)){if(Ic(n))throw k0(),Error(r(418));for(;s;)_0(n,s),s=ts(s.nextSibling)}if(S0(n),n.tag===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));e:{for(n=n.nextSibling,s=0;n;){if(n.nodeType===8){var l=n.data;if(l==="/$"){if(s===0){xn=ts(n.nextSibling);break e}s--}else l!=="$"&&l!=="$!"&&l!=="$?"||s++}n=n.nextSibling}xn=null}}else xn=wn?ts(n.stateNode.nextSibling):null;return!0}function k0(){for(var n=xn;n;)n=ts(n.nextSibling)}function $i(){xn=wn=null,vt=!1}function Oc(n){Yn===null?Yn=[n]:Yn.push(n)}var UT=j.ReactCurrentBatchConfig;function Uo(n,s,l){if(n=l.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(l._owner){if(l=l._owner,l){if(l.tag!==1)throw Error(r(309));var h=l.stateNode}if(!h)throw Error(r(147,n));var v=h,x=""+n;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===x?s.ref:(s=function(T){var B=v.refs;T===null?delete B[x]:B[x]=T},s._stringRef=x,s)}if(typeof n!="string")throw Error(r(284));if(!l._owner)throw Error(r(290,n))}return n}function vl(n,s){throw n=Object.prototype.toString.call(s),Error(r(31,n==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":n))}function E0(n){var s=n._init;return s(n._payload)}function N0(n){function s(re,J){if(n){var oe=re.deletions;oe===null?(re.deletions=[J],re.flags|=16):oe.push(J)}}function l(re,J){if(!n)return null;for(;J!==null;)s(re,J),J=J.sibling;return null}function h(re,J){for(re=new Map;J!==null;)J.key!==null?re.set(J.key,J):re.set(J.index,J),J=J.sibling;return re}function v(re,J){return re=fs(re,J),re.index=0,re.sibling=null,re}function x(re,J,oe){return re.index=oe,n?(oe=re.alternate,oe!==null?(oe=oe.index,oe<J?(re.flags|=2,J):oe):(re.flags|=2,J)):(re.flags|=1048576,J)}function T(re){return n&&re.alternate===null&&(re.flags|=2),re}function B(re,J,oe,ve){return J===null||J.tag!==6?(J=Ed(oe,re.mode,ve),J.return=re,J):(J=v(J,oe),J.return=re,J)}function Y(re,J,oe,ve){var Ce=oe.type;return Ce===L?me(re,J,oe.props.children,ve,oe.key):J!==null&&(J.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===F&&E0(Ce)===J.type)?(ve=v(J,oe.props),ve.ref=Uo(re,J,oe),ve.return=re,ve):(ve=zl(oe.type,oe.key,oe.props,null,re.mode,ve),ve.ref=Uo(re,J,oe),ve.return=re,ve)}function ae(re,J,oe,ve){return J===null||J.tag!==4||J.stateNode.containerInfo!==oe.containerInfo||J.stateNode.implementation!==oe.implementation?(J=Nd(oe,re.mode,ve),J.return=re,J):(J=v(J,oe.children||[]),J.return=re,J)}function me(re,J,oe,ve,Ce){return J===null||J.tag!==7?(J=Gs(oe,re.mode,ve,Ce),J.return=re,J):(J=v(J,oe),J.return=re,J)}function ge(re,J,oe){if(typeof J=="string"&&J!==""||typeof J=="number")return J=Ed(""+J,re.mode,oe),J.return=re,J;if(typeof J=="object"&&J!==null){switch(J.$$typeof){case A:return oe=zl(J.type,J.key,J.props,null,re.mode,oe),oe.ref=Uo(re,null,J),oe.return=re,oe;case I:return J=Nd(J,re.mode,oe),J.return=re,J;case F:var ve=J._init;return ge(re,ve(J._payload),oe)}if(dt(J)||U(J))return J=Gs(J,re.mode,oe,null),J.return=re,J;vl(re,J)}return null}function he(re,J,oe,ve){var Ce=J!==null?J.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number")return Ce!==null?null:B(re,J,""+oe,ve);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case A:return oe.key===Ce?Y(re,J,oe,ve):null;case I:return oe.key===Ce?ae(re,J,oe,ve):null;case F:return Ce=oe._init,he(re,J,Ce(oe._payload),ve)}if(dt(oe)||U(oe))return Ce!==null?null:me(re,J,oe,ve,null);vl(re,oe)}return null}function xe(re,J,oe,ve,Ce){if(typeof ve=="string"&&ve!==""||typeof ve=="number")return re=re.get(oe)||null,B(J,re,""+ve,Ce);if(typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case A:return re=re.get(ve.key===null?oe:ve.key)||null,Y(J,re,ve,Ce);case I:return re=re.get(ve.key===null?oe:ve.key)||null,ae(J,re,ve,Ce);case F:var Ie=ve._init;return xe(re,J,oe,Ie(ve._payload),Ce)}if(dt(ve)||U(ve))return re=re.get(oe)||null,me(J,re,ve,Ce,null);vl(J,ve)}return null}function Se(re,J,oe,ve){for(var Ce=null,Ie=null,Me=J,Le=J=0,$t=null;Me!==null&&Le<oe.length;Le++){Me.index>Le?($t=Me,Me=null):$t=Me.sibling;var nt=he(re,Me,oe[Le],ve);if(nt===null){Me===null&&(Me=$t);break}n&&Me&&nt.alternate===null&&s(re,Me),J=x(nt,J,Le),Ie===null?Ce=nt:Ie.sibling=nt,Ie=nt,Me=$t}if(Le===oe.length)return l(re,Me),vt&&Ds(re,Le),Ce;if(Me===null){for(;Le<oe.length;Le++)Me=ge(re,oe[Le],ve),Me!==null&&(J=x(Me,J,Le),Ie===null?Ce=Me:Ie.sibling=Me,Ie=Me);return vt&&Ds(re,Le),Ce}for(Me=h(re,Me);Le<oe.length;Le++)$t=xe(Me,re,Le,oe[Le],ve),$t!==null&&(n&&$t.alternate!==null&&Me.delete($t.key===null?Le:$t.key),J=x($t,J,Le),Ie===null?Ce=$t:Ie.sibling=$t,Ie=$t);return n&&Me.forEach(function(hs){return s(re,hs)}),vt&&Ds(re,Le),Ce}function Ne(re,J,oe,ve){var Ce=U(oe);if(typeof Ce!="function")throw Error(r(150));if(oe=Ce.call(oe),oe==null)throw Error(r(151));for(var Ie=Ce=null,Me=J,Le=J=0,$t=null,nt=oe.next();Me!==null&&!nt.done;Le++,nt=oe.next()){Me.index>Le?($t=Me,Me=null):$t=Me.sibling;var hs=he(re,Me,nt.value,ve);if(hs===null){Me===null&&(Me=$t);break}n&&Me&&hs.alternate===null&&s(re,Me),J=x(hs,J,Le),Ie===null?Ce=hs:Ie.sibling=hs,Ie=hs,Me=$t}if(nt.done)return l(re,Me),vt&&Ds(re,Le),Ce;if(Me===null){for(;!nt.done;Le++,nt=oe.next())nt=ge(re,nt.value,ve),nt!==null&&(J=x(nt,J,Le),Ie===null?Ce=nt:Ie.sibling=nt,Ie=nt);return vt&&Ds(re,Le),Ce}for(Me=h(re,Me);!nt.done;Le++,nt=oe.next())nt=xe(Me,re,Le,nt.value,ve),nt!==null&&(n&&nt.alternate!==null&&Me.delete(nt.key===null?Le:nt.key),J=x(nt,J,Le),Ie===null?Ce=nt:Ie.sibling=nt,Ie=nt);return n&&Me.forEach(function(bR){return s(re,bR)}),vt&&Ds(re,Le),Ce}function kt(re,J,oe,ve){if(typeof oe=="object"&&oe!==null&&oe.type===L&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case A:e:{for(var Ce=oe.key,Ie=J;Ie!==null;){if(Ie.key===Ce){if(Ce=oe.type,Ce===L){if(Ie.tag===7){l(re,Ie.sibling),J=v(Ie,oe.props.children),J.return=re,re=J;break e}}else if(Ie.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===F&&E0(Ce)===Ie.type){l(re,Ie.sibling),J=v(Ie,oe.props),J.ref=Uo(re,Ie,oe),J.return=re,re=J;break e}l(re,Ie);break}else s(re,Ie);Ie=Ie.sibling}oe.type===L?(J=Gs(oe.props.children,re.mode,ve,oe.key),J.return=re,re=J):(ve=zl(oe.type,oe.key,oe.props,null,re.mode,ve),ve.ref=Uo(re,J,oe),ve.return=re,re=ve)}return T(re);case I:e:{for(Ie=oe.key;J!==null;){if(J.key===Ie)if(J.tag===4&&J.stateNode.containerInfo===oe.containerInfo&&J.stateNode.implementation===oe.implementation){l(re,J.sibling),J=v(J,oe.children||[]),J.return=re,re=J;break e}else{l(re,J);break}else s(re,J);J=J.sibling}J=Nd(oe,re.mode,ve),J.return=re,re=J}return T(re);case F:return Ie=oe._init,kt(re,J,Ie(oe._payload),ve)}if(dt(oe))return Se(re,J,oe,ve);if(U(oe))return Ne(re,J,oe,ve);vl(re,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"?(oe=""+oe,J!==null&&J.tag===6?(l(re,J.sibling),J=v(J,oe),J.return=re,re=J):(l(re,J),J=Ed(oe,re.mode,ve),J.return=re,re=J),T(re)):l(re,J)}return kt}var qi=N0(!0),C0=N0(!1),yl=ns(null),wl=null,Di=null,Pc=null;function Lc(){Pc=Di=wl=null}function $c(n){var s=yl.current;ht(yl),n._currentValue=s}function qc(n,s,l){for(;n!==null;){var h=n.alternate;if((n.childLanes&s)!==s?(n.childLanes|=s,h!==null&&(h.childLanes|=s)):h!==null&&(h.childLanes&s)!==s&&(h.childLanes|=s),n===l)break;n=n.return}}function Fi(n,s){wl=n,Pc=Di=null,n=n.dependencies,n!==null&&n.firstContext!==null&&((n.lanes&s)!==0&&(ln=!0),n.firstContext=null)}function In(n){var s=n._currentValue;if(Pc!==n)if(n={context:n,memoizedValue:s,next:null},Di===null){if(wl===null)throw Error(r(308));Di=n,wl.dependencies={lanes:0,firstContext:n}}else Di=Di.next=n;return s}var Fs=null;function Dc(n){Fs===null?Fs=[n]:Fs.push(n)}function j0(n,s,l,h){var v=s.interleaved;return v===null?(l.next=l,Dc(s)):(l.next=v.next,v.next=l),s.interleaved=l,Or(n,h)}function Or(n,s){n.lanes|=s;var l=n.alternate;for(l!==null&&(l.lanes|=s),l=n,n=n.return;n!==null;)n.childLanes|=s,l=n.alternate,l!==null&&(l.childLanes|=s),l=n,n=n.return;return l.tag===3?l.stateNode:null}var is=!1;function Fc(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function T0(n,s){n=n.updateQueue,s.updateQueue===n&&(s.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function Pr(n,s){return{eventTime:n,lane:s,tag:0,payload:null,callback:null,next:null}}function os(n,s,l){var h=n.updateQueue;if(h===null)return null;if(h=h.shared,(et&2)!==0){var v=h.pending;return v===null?s.next=s:(s.next=v.next,v.next=s),h.pending=s,Or(n,l)}return v=h.interleaved,v===null?(s.next=s,Dc(h)):(s.next=v.next,v.next=s),h.interleaved=s,Or(n,l)}function xl(n,s,l){if(s=s.updateQueue,s!==null&&(s=s.shared,(l&4194240)!==0)){var h=s.lanes;h&=n.pendingLanes,l|=h,s.lanes=l,Ts(n,l)}}function R0(n,s){var l=n.updateQueue,h=n.alternate;if(h!==null&&(h=h.updateQueue,l===h)){var v=null,x=null;if(l=l.firstBaseUpdate,l!==null){do{var T={eventTime:l.eventTime,lane:l.lane,tag:l.tag,payload:l.payload,callback:l.callback,next:null};x===null?v=x=T:x=x.next=T,l=l.next}while(l!==null);x===null?v=x=s:x=x.next=s}else v=x=s;l={baseState:h.baseState,firstBaseUpdate:v,lastBaseUpdate:x,shared:h.shared,effects:h.effects},n.updateQueue=l;return}n=l.lastBaseUpdate,n===null?l.firstBaseUpdate=s:n.next=s,l.lastBaseUpdate=s}function _l(n,s,l,h){var v=n.updateQueue;is=!1;var x=v.firstBaseUpdate,T=v.lastBaseUpdate,B=v.shared.pending;if(B!==null){v.shared.pending=null;var Y=B,ae=Y.next;Y.next=null,T===null?x=ae:T.next=ae,T=Y;var me=n.alternate;me!==null&&(me=me.updateQueue,B=me.lastBaseUpdate,B!==T&&(B===null?me.firstBaseUpdate=ae:B.next=ae,me.lastBaseUpdate=Y))}if(x!==null){var ge=v.baseState;T=0,me=ae=Y=null,B=x;do{var he=B.lane,xe=B.eventTime;if((h&he)===he){me!==null&&(me=me.next={eventTime:xe,lane:0,tag:B.tag,payload:B.payload,callback:B.callback,next:null});e:{var Se=n,Ne=B;switch(he=s,xe=l,Ne.tag){case 1:if(Se=Ne.payload,typeof Se=="function"){ge=Se.call(xe,ge,he);break e}ge=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=Ne.payload,he=typeof Se=="function"?Se.call(xe,ge,he):Se,he==null)break e;ge=Q({},ge,he);break e;case 2:is=!0}}B.callback!==null&&B.lane!==0&&(n.flags|=64,he=v.effects,he===null?v.effects=[B]:he.push(B))}else xe={eventTime:xe,lane:he,tag:B.tag,payload:B.payload,callback:B.callback,next:null},me===null?(ae=me=xe,Y=ge):me=me.next=xe,T|=he;if(B=B.next,B===null){if(B=v.shared.pending,B===null)break;he=B,B=he.next,he.next=null,v.lastBaseUpdate=he,v.shared.pending=null}}while(!0);if(me===null&&(Y=ge),v.baseState=Y,v.firstBaseUpdate=ae,v.lastBaseUpdate=me,s=v.shared.interleaved,s!==null){v=s;do T|=v.lane,v=v.next;while(v!==s)}else x===null&&(v.shared.lanes=0);Us|=T,n.lanes=T,n.memoizedState=ge}}function A0(n,s,l){if(n=s.effects,s.effects=null,n!==null)for(s=0;s<n.length;s++){var h=n[s],v=h.callback;if(v!==null){if(h.callback=null,h=l,typeof v!="function")throw Error(r(191,v));v.call(h)}}}var Ho={},pr=ns(Ho),Wo=ns(Ho),Vo=ns(Ho);function zs(n){if(n===Ho)throw Error(r(174));return n}function zc(n,s){switch(ct(Vo,s),ct(Wo,n),ct(pr,Ho),n=s.nodeType,n){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:se(null,"");break;default:n=n===8?s.parentNode:s,s=n.namespaceURI||null,n=n.tagName,s=se(s,n)}ht(pr),ct(pr,s)}function zi(){ht(pr),ht(Wo),ht(Vo)}function I0(n){zs(Vo.current);var s=zs(pr.current),l=se(s,n.type);s!==l&&(ct(Wo,n),ct(pr,l))}function Bc(n){Wo.current===n&&(ht(pr),ht(Wo))}var wt=ns(0);function bl(n){for(var s=n;s!==null;){if(s.tag===13){var l=s.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||l.data==="$?"||l.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===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Uc=[];function Hc(){for(var n=0;n<Uc.length;n++)Uc[n]._workInProgressVersionPrimary=null;Uc.length=0}var Sl=j.ReactCurrentDispatcher,Wc=j.ReactCurrentBatchConfig,Bs=0,xt=null,Tt=null,Pt=null,kl=!1,Go=!1,Yo=0,HT=0;function Ut(){throw Error(r(321))}function Vc(n,s){if(s===null)return!1;for(var l=0;l<s.length&&l<n.length;l++)if(!Gn(n[l],s[l]))return!1;return!0}function Gc(n,s,l,h,v,x){if(Bs=x,xt=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,Sl.current=n===null||n.memoizedState===null?YT:KT,n=l(h,v),Go){x=0;do{if(Go=!1,Yo=0,25<=x)throw Error(r(301));x+=1,Pt=Tt=null,s.updateQueue=null,Sl.current=XT,n=l(h,v)}while(Go)}if(Sl.current=Cl,s=Tt!==null&&Tt.next!==null,Bs=0,Pt=Tt=xt=null,kl=!1,s)throw Error(r(300));return n}function Yc(){var n=Yo!==0;return Yo=0,n}function mr(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Pt===null?xt.memoizedState=Pt=n:Pt=Pt.next=n,Pt}function Mn(){if(Tt===null){var n=xt.alternate;n=n!==null?n.memoizedState:null}else n=Tt.next;var s=Pt===null?xt.memoizedState:Pt.next;if(s!==null)Pt=s,Tt=n;else{if(n===null)throw Error(r(310));Tt=n,n={memoizedState:Tt.memoizedState,baseState:Tt.baseState,baseQueue:Tt.baseQueue,queue:Tt.queue,next:null},Pt===null?xt.memoizedState=Pt=n:Pt=Pt.next=n}return Pt}function Ko(n,s){return typeof s=="function"?s(n):s}function Kc(n){var s=Mn(),l=s.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=n;var h=Tt,v=h.baseQueue,x=l.pending;if(x!==null){if(v!==null){var T=v.next;v.next=x.next,x.next=T}h.baseQueue=v=x,l.pending=null}if(v!==null){x=v.next,h=h.baseState;var B=T=null,Y=null,ae=x;do{var me=ae.lane;if((Bs&me)===me)Y!==null&&(Y=Y.next={lane:0,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),h=ae.hasEagerState?ae.eagerState:n(h,ae.action);else{var ge={lane:me,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null};Y===null?(B=Y=ge,T=h):Y=Y.next=ge,xt.lanes|=me,Us|=me}ae=ae.next}while(ae!==null&&ae!==x);Y===null?T=h:Y.next=B,Gn(h,s.memoizedState)||(ln=!0),s.memoizedState=h,s.baseState=T,s.baseQueue=Y,l.lastRenderedState=h}if(n=l.interleaved,n!==null){v=n;do x=v.lane,xt.lanes|=x,Us|=x,v=v.next;while(v!==n)}else v===null&&(l.lanes=0);return[s.memoizedState,l.dispatch]}function Xc(n){var s=Mn(),l=s.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=n;var h=l.dispatch,v=l.pending,x=s.memoizedState;if(v!==null){l.pending=null;var T=v=v.next;do x=n(x,T.action),T=T.next;while(T!==v);Gn(x,s.memoizedState)||(ln=!0),s.memoizedState=x,s.baseQueue===null&&(s.baseState=x),l.lastRenderedState=x}return[x,h]}function M0(){}function O0(n,s){var l=xt,h=Mn(),v=s(),x=!Gn(h.memoizedState,v);if(x&&(h.memoizedState=v,ln=!0),h=h.queue,Qc($0.bind(null,l,h,n),[n]),h.getSnapshot!==s||x||Pt!==null&&Pt.memoizedState.tag&1){if(l.flags|=2048,Xo(9,L0.bind(null,l,h,v,s),void 0,null),Lt===null)throw Error(r(349));(Bs&30)!==0||P0(l,s,v)}return v}function P0(n,s,l){n.flags|=16384,n={getSnapshot:s,value:l},s=xt.updateQueue,s===null?(s={lastEffect:null,stores:null},xt.updateQueue=s,s.stores=[n]):(l=s.stores,l===null?s.stores=[n]:l.push(n))}function L0(n,s,l,h){s.value=l,s.getSnapshot=h,q0(s)&&D0(n)}function $0(n,s,l){return l(function(){q0(s)&&D0(n)})}function q0(n){var s=n.getSnapshot;n=n.value;try{var l=s();return!Gn(n,l)}catch{return!0}}function D0(n){var s=Or(n,1);s!==null&&Zn(s,n,1,-1)}function F0(n){var s=mr();return typeof n=="function"&&(n=n()),s.memoizedState=s.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ko,lastRenderedState:n},s.queue=n,n=n.dispatch=GT.bind(null,xt,n),[s.memoizedState,n]}function Xo(n,s,l,h){return n={tag:n,create:s,destroy:l,deps:h,next:null},s=xt.updateQueue,s===null?(s={lastEffect:null,stores:null},xt.updateQueue=s,s.lastEffect=n.next=n):(l=s.lastEffect,l===null?s.lastEffect=n.next=n:(h=l.next,l.next=n,n.next=h,s.lastEffect=n)),n}function z0(){return Mn().memoizedState}function El(n,s,l,h){var v=mr();xt.flags|=n,v.memoizedState=Xo(1|s,l,void 0,h===void 0?null:h)}function Nl(n,s,l,h){var v=Mn();h=h===void 0?null:h;var x=void 0;if(Tt!==null){var T=Tt.memoizedState;if(x=T.destroy,h!==null&&Vc(h,T.deps)){v.memoizedState=Xo(s,l,x,h);return}}xt.flags|=n,v.memoizedState=Xo(1|s,l,x,h)}function B0(n,s){return El(8390656,8,n,s)}function Qc(n,s){return Nl(2048,8,n,s)}function U0(n,s){return Nl(4,2,n,s)}function H0(n,s){return Nl(4,4,n,s)}function W0(n,s){if(typeof s=="function")return n=n(),s(n),function(){s(null)};if(s!=null)return n=n(),s.current=n,function(){s.current=null}}function V0(n,s,l){return l=l!=null?l.concat([n]):null,Nl(4,4,W0.bind(null,s,n),l)}function Zc(){}function G0(n,s){var l=Mn();s=s===void 0?null:s;var h=l.memoizedState;return h!==null&&s!==null&&Vc(s,h[1])?h[0]:(l.memoizedState=[n,s],n)}function Y0(n,s){var l=Mn();s=s===void 0?null:s;var h=l.memoizedState;return h!==null&&s!==null&&Vc(s,h[1])?h[0]:(n=n(),l.memoizedState=[n,s],n)}function K0(n,s,l){return(Bs&21)===0?(n.baseState&&(n.baseState=!1,ln=!0),n.memoizedState=l):(Gn(l,s)||(l=ko(),xt.lanes|=l,Us|=l,n.baseState=!0),s)}function WT(n,s){var l=Ke;Ke=l!==0&&4>l?l:4,n(!0);var h=Wc.transition;Wc.transition={};try{n(!1),s()}finally{Ke=l,Wc.transition=h}}function X0(){return Mn().memoizedState}function VT(n,s,l){var h=cs(n);if(l={lane:h,action:l,hasEagerState:!1,eagerState:null,next:null},Q0(n))Z0(s,l);else if(l=j0(n,s,l,h),l!==null){var v=Jt();Zn(l,n,h,v),J0(l,s,h)}}function GT(n,s,l){var h=cs(n),v={lane:h,action:l,hasEagerState:!1,eagerState:null,next:null};if(Q0(n))Z0(s,v);else{var x=n.alternate;if(n.lanes===0&&(x===null||x.lanes===0)&&(x=s.lastRenderedReducer,x!==null))try{var T=s.lastRenderedState,B=x(T,l);if(v.hasEagerState=!0,v.eagerState=B,Gn(B,T)){var Y=s.interleaved;Y===null?(v.next=v,Dc(s)):(v.next=Y.next,Y.next=v),s.interleaved=v;return}}catch{}finally{}l=j0(n,s,v,h),l!==null&&(v=Jt(),Zn(l,n,h,v),J0(l,s,h))}}function Q0(n){var s=n.alternate;return n===xt||s!==null&&s===xt}function Z0(n,s){Go=kl=!0;var l=n.pending;l===null?s.next=s:(s.next=l.next,l.next=s),n.pending=s}function J0(n,s,l){if((l&4194240)!==0){var h=s.lanes;h&=n.pendingLanes,l|=h,s.lanes=l,Ts(n,l)}}var Cl={readContext:In,useCallback:Ut,useContext:Ut,useEffect:Ut,useImperativeHandle:Ut,useInsertionEffect:Ut,useLayoutEffect:Ut,useMemo:Ut,useReducer:Ut,useRef:Ut,useState:Ut,useDebugValue:Ut,useDeferredValue:Ut,useTransition:Ut,useMutableSource:Ut,useSyncExternalStore:Ut,useId:Ut,unstable_isNewReconciler:!1},YT={readContext:In,useCallback:function(n,s){return mr().memoizedState=[n,s===void 0?null:s],n},useContext:In,useEffect:B0,useImperativeHandle:function(n,s,l){return l=l!=null?l.concat([n]):null,El(4194308,4,W0.bind(null,s,n),l)},useLayoutEffect:function(n,s){return El(4194308,4,n,s)},useInsertionEffect:function(n,s){return El(4,2,n,s)},useMemo:function(n,s){var l=mr();return s=s===void 0?null:s,n=n(),l.memoizedState=[n,s],n},useReducer:function(n,s,l){var h=mr();return s=l!==void 0?l(s):s,h.memoizedState=h.baseState=s,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:s},h.queue=n,n=n.dispatch=VT.bind(null,xt,n),[h.memoizedState,n]},useRef:function(n){var s=mr();return n={current:n},s.memoizedState=n},useState:F0,useDebugValue:Zc,useDeferredValue:function(n){return mr().memoizedState=n},useTransition:function(){var n=F0(!1),s=n[0];return n=WT.bind(null,n[1]),mr().memoizedState=n,[s,n]},useMutableSource:function(){},useSyncExternalStore:function(n,s,l){var h=xt,v=mr();if(vt){if(l===void 0)throw Error(r(407));l=l()}else{if(l=s(),Lt===null)throw Error(r(349));(Bs&30)!==0||P0(h,s,l)}v.memoizedState=l;var x={value:l,getSnapshot:s};return v.queue=x,B0($0.bind(null,h,x,n),[n]),h.flags|=2048,Xo(9,L0.bind(null,h,x,l,s),void 0,null),l},useId:function(){var n=mr(),s=Lt.identifierPrefix;if(vt){var l=Mr,h=Ir;l=(h&~(1<<32-tn(h)-1)).toString(32)+l,s=":"+s+"R"+l,l=Yo++,0<l&&(s+="H"+l.toString(32)),s+=":"}else l=HT++,s=":"+s+"r"+l.toString(32)+":";return n.memoizedState=s},unstable_isNewReconciler:!1},KT={readContext:In,useCallback:G0,useContext:In,useEffect:Qc,useImperativeHandle:V0,useInsertionEffect:U0,useLayoutEffect:H0,useMemo:Y0,useReducer:Kc,useRef:z0,useState:function(){return Kc(Ko)},useDebugValue:Zc,useDeferredValue:function(n){var s=Mn();return K0(s,Tt.memoizedState,n)},useTransition:function(){var n=Kc(Ko)[0],s=Mn().memoizedState;return[n,s]},useMutableSource:M0,useSyncExternalStore:O0,useId:X0,unstable_isNewReconciler:!1},XT={readContext:In,useCallback:G0,useContext:In,useEffect:Qc,useImperativeHandle:V0,useInsertionEffect:U0,useLayoutEffect:H0,useMemo:Y0,useReducer:Xc,useRef:z0,useState:function(){return Xc(Ko)},useDebugValue:Zc,useDeferredValue:function(n){var s=Mn();return Tt===null?s.memoizedState=n:K0(s,Tt.memoizedState,n)},useTransition:function(){var n=Xc(Ko)[0],s=Mn().memoizedState;return[n,s]},useMutableSource:M0,useSyncExternalStore:O0,useId:X0,unstable_isNewReconciler:!1};function Kn(n,s){if(n&&n.defaultProps){s=Q({},s),n=n.defaultProps;for(var l in n)s[l]===void 0&&(s[l]=n[l]);return s}return s}function Jc(n,s,l,h){s=n.memoizedState,l=l(h,s),l=l==null?s:Q({},s,l),n.memoizedState=l,n.lanes===0&&(n.updateQueue.baseState=l)}var jl={isMounted:function(n){return(n=n._reactInternals)?en(n)===n:!1},enqueueSetState:function(n,s,l){n=n._reactInternals;var h=Jt(),v=cs(n),x=Pr(h,v);x.payload=s,l!=null&&(x.callback=l),s=os(n,x,v),s!==null&&(Zn(s,n,v,h),xl(s,n,v))},enqueueReplaceState:function(n,s,l){n=n._reactInternals;var h=Jt(),v=cs(n),x=Pr(h,v);x.tag=1,x.payload=s,l!=null&&(x.callback=l),s=os(n,x,v),s!==null&&(Zn(s,n,v,h),xl(s,n,v))},enqueueForceUpdate:function(n,s){n=n._reactInternals;var l=Jt(),h=cs(n),v=Pr(l,h);v.tag=2,s!=null&&(v.callback=s),s=os(n,v,h),s!==null&&(Zn(s,n,h,l),xl(s,n,h))}};function ew(n,s,l,h,v,x,T){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(h,x,T):s.prototype&&s.prototype.isPureReactComponent?!Lo(l,h)||!Lo(v,x):!0}function tw(n,s,l){var h=!1,v=rs,x=s.contextType;return typeof x=="object"&&x!==null?x=In(x):(v=an(s)?$s:Bt.current,h=s.contextTypes,x=(h=h!=null)?Oi(n,v):rs),s=new s(l,x),n.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=jl,n.stateNode=s,s._reactInternals=n,h&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=v,n.__reactInternalMemoizedMaskedChildContext=x),s}function nw(n,s,l,h){n=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(l,h),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(l,h),s.state!==n&&jl.enqueueReplaceState(s,s.state,null)}function ed(n,s,l,h){var v=n.stateNode;v.props=l,v.state=n.memoizedState,v.refs={},Fc(n);var x=s.contextType;typeof x=="object"&&x!==null?v.context=In(x):(x=an(s)?$s:Bt.current,v.context=Oi(n,x)),v.state=n.memoizedState,x=s.getDerivedStateFromProps,typeof x=="function"&&(Jc(n,s,x,l),v.state=n.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&&jl.enqueueReplaceState(v,v.state,null),_l(n,l,v,h),v.state=n.memoizedState),typeof v.componentDidMount=="function"&&(n.flags|=4194308)}function Bi(n,s){try{var l="",h=s;do l+=G(h),h=h.return;while(h);var v=l}catch(x){v=`
|
|
39
|
+
Error generating stack: `+x.message+`
|
|
40
|
+
`+x.stack}return{value:n,source:s,stack:v,digest:null}}function td(n,s,l){return{value:n,source:null,stack:l??null,digest:s??null}}function nd(n,s){try{console.error(s.value)}catch(l){setTimeout(function(){throw l})}}var QT=typeof WeakMap=="function"?WeakMap:Map;function rw(n,s,l){l=Pr(-1,l),l.tag=3,l.payload={element:null};var h=s.value;return l.callback=function(){Pl||(Pl=!0,vd=h),nd(n,s)},l}function sw(n,s,l){l=Pr(-1,l),l.tag=3;var h=n.type.getDerivedStateFromError;if(typeof h=="function"){var v=s.value;l.payload=function(){return h(v)},l.callback=function(){nd(n,s)}}var x=n.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(l.callback=function(){nd(n,s),typeof h!="function"&&(ls===null?ls=new Set([this]):ls.add(this));var T=s.stack;this.componentDidCatch(s.value,{componentStack:T!==null?T:""})}),l}function iw(n,s,l){var h=n.pingCache;if(h===null){h=n.pingCache=new QT;var v=new Set;h.set(s,v)}else v=h.get(s),v===void 0&&(v=new Set,h.set(s,v));v.has(l)||(v.add(l),n=dR.bind(null,n,s,l),s.then(n,n))}function ow(n){do{var s;if((s=n.tag===13)&&(s=n.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return n;n=n.return}while(n!==null);return null}function aw(n,s,l,h,v){return(n.mode&1)===0?(n===s?n.flags|=65536:(n.flags|=128,l.flags|=131072,l.flags&=-52805,l.tag===1&&(l.alternate===null?l.tag=17:(s=Pr(-1,1),s.tag=2,os(l,s,1))),l.lanes|=1),n):(n.flags|=65536,n.lanes=v,n)}var ZT=j.ReactCurrentOwner,ln=!1;function Zt(n,s,l,h){s.child=n===null?C0(s,null,l,h):qi(s,n.child,l,h)}function lw(n,s,l,h,v){l=l.render;var x=s.ref;return Fi(s,v),h=Gc(n,s,l,h,x,v),l=Yc(),n!==null&&!ln?(s.updateQueue=n.updateQueue,s.flags&=-2053,n.lanes&=~v,Lr(n,s,v)):(vt&&l&&Rc(s),s.flags|=1,Zt(n,s,h,v),s.child)}function uw(n,s,l,h,v){if(n===null){var x=l.type;return typeof x=="function"&&!kd(x)&&x.defaultProps===void 0&&l.compare===null&&l.defaultProps===void 0?(s.tag=15,s.type=x,cw(n,s,x,h,v)):(n=zl(l.type,null,h,s,s.mode,v),n.ref=s.ref,n.return=s,s.child=n)}if(x=n.child,(n.lanes&v)===0){var T=x.memoizedProps;if(l=l.compare,l=l!==null?l:Lo,l(T,h)&&n.ref===s.ref)return Lr(n,s,v)}return s.flags|=1,n=fs(x,h),n.ref=s.ref,n.return=s,s.child=n}function cw(n,s,l,h,v){if(n!==null){var x=n.memoizedProps;if(Lo(x,h)&&n.ref===s.ref)if(ln=!1,s.pendingProps=h=x,(n.lanes&v)!==0)(n.flags&131072)!==0&&(ln=!0);else return s.lanes=n.lanes,Lr(n,s,v)}return rd(n,s,l,h,v)}function dw(n,s,l){var h=s.pendingProps,v=h.children,x=n!==null?n.memoizedState:null;if(h.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},ct(Hi,_n),_n|=l;else{if((l&1073741824)===0)return n=x!==null?x.baseLanes|l:l,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:n,cachePool:null,transitions:null},s.updateQueue=null,ct(Hi,_n),_n|=n,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},h=x!==null?x.baseLanes:l,ct(Hi,_n),_n|=h}else x!==null?(h=x.baseLanes|l,s.memoizedState=null):h=l,ct(Hi,_n),_n|=h;return Zt(n,s,v,l),s.child}function fw(n,s){var l=s.ref;(n===null&&l!==null||n!==null&&n.ref!==l)&&(s.flags|=512,s.flags|=2097152)}function rd(n,s,l,h,v){var x=an(l)?$s:Bt.current;return x=Oi(s,x),Fi(s,v),l=Gc(n,s,l,h,x,v),h=Yc(),n!==null&&!ln?(s.updateQueue=n.updateQueue,s.flags&=-2053,n.lanes&=~v,Lr(n,s,v)):(vt&&h&&Rc(s),s.flags|=1,Zt(n,s,l,v),s.child)}function hw(n,s,l,h,v){if(an(l)){var x=!0;fl(s)}else x=!1;if(Fi(s,v),s.stateNode===null)Rl(n,s),tw(s,l,h),ed(s,l,h,v),h=!0;else if(n===null){var T=s.stateNode,B=s.memoizedProps;T.props=B;var Y=T.context,ae=l.contextType;typeof ae=="object"&&ae!==null?ae=In(ae):(ae=an(l)?$s:Bt.current,ae=Oi(s,ae));var me=l.getDerivedStateFromProps,ge=typeof me=="function"||typeof T.getSnapshotBeforeUpdate=="function";ge||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(B!==h||Y!==ae)&&nw(s,T,h,ae),is=!1;var he=s.memoizedState;T.state=he,_l(s,h,T,v),Y=s.memoizedState,B!==h||he!==Y||on.current||is?(typeof me=="function"&&(Jc(s,l,me,h),Y=s.memoizedState),(B=is||ew(s,l,B,h,he,Y,ae))?(ge||typeof T.UNSAFE_componentWillMount!="function"&&typeof T.componentWillMount!="function"||(typeof T.componentWillMount=="function"&&T.componentWillMount(),typeof T.UNSAFE_componentWillMount=="function"&&T.UNSAFE_componentWillMount()),typeof T.componentDidMount=="function"&&(s.flags|=4194308)):(typeof T.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=h,s.memoizedState=Y),T.props=h,T.state=Y,T.context=ae,h=B):(typeof T.componentDidMount=="function"&&(s.flags|=4194308),h=!1)}else{T=s.stateNode,T0(n,s),B=s.memoizedProps,ae=s.type===s.elementType?B:Kn(s.type,B),T.props=ae,ge=s.pendingProps,he=T.context,Y=l.contextType,typeof Y=="object"&&Y!==null?Y=In(Y):(Y=an(l)?$s:Bt.current,Y=Oi(s,Y));var xe=l.getDerivedStateFromProps;(me=typeof xe=="function"||typeof T.getSnapshotBeforeUpdate=="function")||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(B!==ge||he!==Y)&&nw(s,T,h,Y),is=!1,he=s.memoizedState,T.state=he,_l(s,h,T,v);var Se=s.memoizedState;B!==ge||he!==Se||on.current||is?(typeof xe=="function"&&(Jc(s,l,xe,h),Se=s.memoizedState),(ae=is||ew(s,l,ae,h,he,Se,Y)||!1)?(me||typeof T.UNSAFE_componentWillUpdate!="function"&&typeof T.componentWillUpdate!="function"||(typeof T.componentWillUpdate=="function"&&T.componentWillUpdate(h,Se,Y),typeof T.UNSAFE_componentWillUpdate=="function"&&T.UNSAFE_componentWillUpdate(h,Se,Y)),typeof T.componentDidUpdate=="function"&&(s.flags|=4),typeof T.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof T.componentDidUpdate!="function"||B===n.memoizedProps&&he===n.memoizedState||(s.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||B===n.memoizedProps&&he===n.memoizedState||(s.flags|=1024),s.memoizedProps=h,s.memoizedState=Se),T.props=h,T.state=Se,T.context=Y,h=ae):(typeof T.componentDidUpdate!="function"||B===n.memoizedProps&&he===n.memoizedState||(s.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||B===n.memoizedProps&&he===n.memoizedState||(s.flags|=1024),h=!1)}return sd(n,s,l,h,x,v)}function sd(n,s,l,h,v,x){fw(n,s);var T=(s.flags&128)!==0;if(!h&&!T)return v&&y0(s,l,!1),Lr(n,s,x);h=s.stateNode,ZT.current=s;var B=T&&typeof l.getDerivedStateFromError!="function"?null:h.render();return s.flags|=1,n!==null&&T?(s.child=qi(s,n.child,null,x),s.child=qi(s,null,B,x)):Zt(n,s,B,x),s.memoizedState=h.state,v&&y0(s,l,!0),s.child}function pw(n){var s=n.stateNode;s.pendingContext?g0(n,s.pendingContext,s.pendingContext!==s.context):s.context&&g0(n,s.context,!1),zc(n,s.containerInfo)}function mw(n,s,l,h,v){return $i(),Oc(v),s.flags|=256,Zt(n,s,l,h),s.child}var id={dehydrated:null,treeContext:null,retryLane:0};function od(n){return{baseLanes:n,cachePool:null,transitions:null}}function gw(n,s,l){var h=s.pendingProps,v=wt.current,x=!1,T=(s.flags&128)!==0,B;if((B=T)||(B=n!==null&&n.memoizedState===null?!1:(v&2)!==0),B?(x=!0,s.flags&=-129):(n===null||n.memoizedState!==null)&&(v|=1),ct(wt,v&1),n===null)return Mc(s),n=s.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?((s.mode&1)===0?s.lanes=1:n.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(T=h.children,n=h.fallback,x?(h=s.mode,x=s.child,T={mode:"hidden",children:T},(h&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=T):x=Bl(T,h,0,null),n=Gs(n,h,l,null),x.return=s,n.return=s,x.sibling=n,s.child=x,s.child.memoizedState=od(l),s.memoizedState=id,n):ad(s,T));if(v=n.memoizedState,v!==null&&(B=v.dehydrated,B!==null))return JT(n,s,T,h,B,v,l);if(x){x=h.fallback,T=s.mode,v=n.child,B=v.sibling;var Y={mode:"hidden",children:h.children};return(T&1)===0&&s.child!==v?(h=s.child,h.childLanes=0,h.pendingProps=Y,s.deletions=null):(h=fs(v,Y),h.subtreeFlags=v.subtreeFlags&14680064),B!==null?x=fs(B,x):(x=Gs(x,T,l,null),x.flags|=2),x.return=s,h.return=s,h.sibling=x,s.child=h,h=x,x=s.child,T=n.child.memoizedState,T=T===null?od(l):{baseLanes:T.baseLanes|l,cachePool:null,transitions:T.transitions},x.memoizedState=T,x.childLanes=n.childLanes&~l,s.memoizedState=id,h}return x=n.child,n=x.sibling,h=fs(x,{mode:"visible",children:h.children}),(s.mode&1)===0&&(h.lanes=l),h.return=s,h.sibling=null,n!==null&&(l=s.deletions,l===null?(s.deletions=[n],s.flags|=16):l.push(n)),s.child=h,s.memoizedState=null,h}function ad(n,s){return s=Bl({mode:"visible",children:s},n.mode,0,null),s.return=n,n.child=s}function Tl(n,s,l,h){return h!==null&&Oc(h),qi(s,n.child,null,l),n=ad(s,s.pendingProps.children),n.flags|=2,s.memoizedState=null,n}function JT(n,s,l,h,v,x,T){if(l)return s.flags&256?(s.flags&=-257,h=td(Error(r(422))),Tl(n,s,T,h)):s.memoizedState!==null?(s.child=n.child,s.flags|=128,null):(x=h.fallback,v=s.mode,h=Bl({mode:"visible",children:h.children},v,0,null),x=Gs(x,v,T,null),x.flags|=2,h.return=s,x.return=s,h.sibling=x,s.child=h,(s.mode&1)!==0&&qi(s,n.child,null,T),s.child.memoizedState=od(T),s.memoizedState=id,x);if((s.mode&1)===0)return Tl(n,s,T,null);if(v.data==="$!"){if(h=v.nextSibling&&v.nextSibling.dataset,h)var B=h.dgst;return h=B,x=Error(r(419)),h=td(x,h,void 0),Tl(n,s,T,h)}if(B=(T&n.childLanes)!==0,ln||B){if(h=Lt,h!==null){switch(T&-T){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&(h.suspendedLanes|T))!==0?0:v,v!==0&&v!==x.retryLane&&(x.retryLane=v,Or(n,v),Zn(h,n,v,-1))}return Sd(),h=td(Error(r(421))),Tl(n,s,T,h)}return v.data==="$?"?(s.flags|=128,s.child=n.child,s=fR.bind(null,n),v._reactRetry=s,null):(n=x.treeContext,xn=ts(v.nextSibling),wn=s,vt=!0,Yn=null,n!==null&&(Rn[An++]=Ir,Rn[An++]=Mr,Rn[An++]=qs,Ir=n.id,Mr=n.overflow,qs=s),s=ad(s,h.children),s.flags|=4096,s)}function vw(n,s,l){n.lanes|=s;var h=n.alternate;h!==null&&(h.lanes|=s),qc(n.return,s,l)}function ld(n,s,l,h,v){var x=n.memoizedState;x===null?n.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:h,tail:l,tailMode:v}:(x.isBackwards=s,x.rendering=null,x.renderingStartTime=0,x.last=h,x.tail=l,x.tailMode=v)}function yw(n,s,l){var h=s.pendingProps,v=h.revealOrder,x=h.tail;if(Zt(n,s,h.children,l),h=wt.current,(h&2)!==0)h=h&1|2,s.flags|=128;else{if(n!==null&&(n.flags&128)!==0)e:for(n=s.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&vw(n,l,s);else if(n.tag===19)vw(n,l,s);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===s)break e;for(;n.sibling===null;){if(n.return===null||n.return===s)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}h&=1}if(ct(wt,h),(s.mode&1)===0)s.memoizedState=null;else switch(v){case"forwards":for(l=s.child,v=null;l!==null;)n=l.alternate,n!==null&&bl(n)===null&&(v=l),l=l.sibling;l=v,l===null?(v=s.child,s.child=null):(v=l.sibling,l.sibling=null),ld(s,!1,v,l,x);break;case"backwards":for(l=null,v=s.child,s.child=null;v!==null;){if(n=v.alternate,n!==null&&bl(n)===null){s.child=v;break}n=v.sibling,v.sibling=l,l=v,v=n}ld(s,!0,l,null,x);break;case"together":ld(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function Rl(n,s){(s.mode&1)===0&&n!==null&&(n.alternate=null,s.alternate=null,s.flags|=2)}function Lr(n,s,l){if(n!==null&&(s.dependencies=n.dependencies),Us|=s.lanes,(l&s.childLanes)===0)return null;if(n!==null&&s.child!==n.child)throw Error(r(153));if(s.child!==null){for(n=s.child,l=fs(n,n.pendingProps),s.child=l,l.return=s;n.sibling!==null;)n=n.sibling,l=l.sibling=fs(n,n.pendingProps),l.return=s;l.sibling=null}return s.child}function eR(n,s,l){switch(s.tag){case 3:pw(s),$i();break;case 5:I0(s);break;case 1:an(s.type)&&fl(s);break;case 4:zc(s,s.stateNode.containerInfo);break;case 10:var h=s.type._context,v=s.memoizedProps.value;ct(yl,h._currentValue),h._currentValue=v;break;case 13:if(h=s.memoizedState,h!==null)return h.dehydrated!==null?(ct(wt,wt.current&1),s.flags|=128,null):(l&s.child.childLanes)!==0?gw(n,s,l):(ct(wt,wt.current&1),n=Lr(n,s,l),n!==null?n.sibling:null);ct(wt,wt.current&1);break;case 19:if(h=(l&s.childLanes)!==0,(n.flags&128)!==0){if(h)return yw(n,s,l);s.flags|=128}if(v=s.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),ct(wt,wt.current),h)break;return null;case 22:case 23:return s.lanes=0,dw(n,s,l)}return Lr(n,s,l)}var ww,ud,xw,_w;ww=function(n,s){for(var l=s.child;l!==null;){if(l.tag===5||l.tag===6)n.appendChild(l.stateNode);else if(l.tag!==4&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return;l=l.return}l.sibling.return=l.return,l=l.sibling}},ud=function(){},xw=function(n,s,l,h){var v=n.memoizedProps;if(v!==h){n=s.stateNode,zs(pr.current);var x=null;switch(l){case"input":v=Oe(n,v),h=Oe(n,h),x=[];break;case"select":v=Q({},v,{value:void 0}),h=Q({},h,{value:void 0}),x=[];break;case"textarea":v=ot(n,v),h=ot(n,h),x=[];break;default:typeof v.onClick!="function"&&typeof h.onClick=="function"&&(n.onclick=ul)}tt(l,h);var T;l=null;for(ae in v)if(!h.hasOwnProperty(ae)&&v.hasOwnProperty(ae)&&v[ae]!=null)if(ae==="style"){var B=v[ae];for(T in B)B.hasOwnProperty(T)&&(l||(l={}),l[T]="")}else ae!=="dangerouslySetInnerHTML"&&ae!=="children"&&ae!=="suppressContentEditableWarning"&&ae!=="suppressHydrationWarning"&&ae!=="autoFocus"&&(o.hasOwnProperty(ae)?x||(x=[]):(x=x||[]).push(ae,null));for(ae in h){var Y=h[ae];if(B=v!=null?v[ae]:void 0,h.hasOwnProperty(ae)&&Y!==B&&(Y!=null||B!=null))if(ae==="style")if(B){for(T in B)!B.hasOwnProperty(T)||Y&&Y.hasOwnProperty(T)||(l||(l={}),l[T]="");for(T in Y)Y.hasOwnProperty(T)&&B[T]!==Y[T]&&(l||(l={}),l[T]=Y[T])}else l||(x||(x=[]),x.push(ae,l)),l=Y;else ae==="dangerouslySetInnerHTML"?(Y=Y?Y.__html:void 0,B=B?B.__html:void 0,Y!=null&&B!==Y&&(x=x||[]).push(ae,Y)):ae==="children"?typeof Y!="string"&&typeof Y!="number"||(x=x||[]).push(ae,""+Y):ae!=="suppressContentEditableWarning"&&ae!=="suppressHydrationWarning"&&(o.hasOwnProperty(ae)?(Y!=null&&ae==="onScroll"&&ft("scroll",n),x||B===Y||(x=[])):(x=x||[]).push(ae,Y))}l&&(x=x||[]).push("style",l);var ae=x;(s.updateQueue=ae)&&(s.flags|=4)}},_w=function(n,s,l,h){l!==h&&(s.flags|=4)};function Qo(n,s){if(!vt)switch(n.tailMode){case"hidden":s=n.tail;for(var l=null;s!==null;)s.alternate!==null&&(l=s),s=s.sibling;l===null?n.tail=null:l.sibling=null;break;case"collapsed":l=n.tail;for(var h=null;l!==null;)l.alternate!==null&&(h=l),l=l.sibling;h===null?s||n.tail===null?n.tail=null:n.tail.sibling=null:h.sibling=null}}function Ht(n){var s=n.alternate!==null&&n.alternate.child===n.child,l=0,h=0;if(s)for(var v=n.child;v!==null;)l|=v.lanes|v.childLanes,h|=v.subtreeFlags&14680064,h|=v.flags&14680064,v.return=n,v=v.sibling;else for(v=n.child;v!==null;)l|=v.lanes|v.childLanes,h|=v.subtreeFlags,h|=v.flags,v.return=n,v=v.sibling;return n.subtreeFlags|=h,n.childLanes=l,s}function tR(n,s,l){var h=s.pendingProps;switch(Ac(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ht(s),null;case 1:return an(s.type)&&dl(),Ht(s),null;case 3:return h=s.stateNode,zi(),ht(on),ht(Bt),Hc(),h.pendingContext&&(h.context=h.pendingContext,h.pendingContext=null),(n===null||n.child===null)&&(gl(s)?s.flags|=4:n===null||n.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Yn!==null&&(xd(Yn),Yn=null))),ud(n,s),Ht(s),null;case 5:Bc(s);var v=zs(Vo.current);if(l=s.type,n!==null&&s.stateNode!=null)xw(n,s,l,h,v),n.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!h){if(s.stateNode===null)throw Error(r(166));return Ht(s),null}if(n=zs(pr.current),gl(s)){h=s.stateNode,l=s.type;var x=s.memoizedProps;switch(h[hr]=s,h[zo]=x,n=(s.mode&1)!==0,l){case"dialog":ft("cancel",h),ft("close",h);break;case"iframe":case"object":case"embed":ft("load",h);break;case"video":case"audio":for(v=0;v<qo.length;v++)ft(qo[v],h);break;case"source":ft("error",h);break;case"img":case"image":case"link":ft("error",h),ft("load",h);break;case"details":ft("toggle",h);break;case"input":_e(h,x),ft("invalid",h);break;case"select":h._wrapperState={wasMultiple:!!x.multiple},ft("invalid",h);break;case"textarea":We(h,x),ft("invalid",h)}tt(l,x),v=null;for(var T in x)if(x.hasOwnProperty(T)){var B=x[T];T==="children"?typeof B=="string"?h.textContent!==B&&(x.suppressHydrationWarning!==!0&&ll(h.textContent,B,n),v=["children",B]):typeof B=="number"&&h.textContent!==""+B&&(x.suppressHydrationWarning!==!0&&ll(h.textContent,B,n),v=["children",""+B]):o.hasOwnProperty(T)&&B!=null&&T==="onScroll"&&ft("scroll",h)}switch(l){case"input":Pe(h),we(h,x,!0);break;case"textarea":Pe(h),pt(h);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(h.onclick=ul)}h=v,s.updateQueue=h,h!==null&&(s.flags|=4)}else{T=v.nodeType===9?v:v.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=_t(l)),n==="http://www.w3.org/1999/xhtml"?l==="script"?(n=T.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof h.is=="string"?n=T.createElement(l,{is:h.is}):(n=T.createElement(l),l==="select"&&(T=n,h.multiple?T.multiple=!0:h.size&&(T.size=h.size))):n=T.createElementNS(n,l),n[hr]=s,n[zo]=h,ww(n,s,!1,!1),s.stateNode=n;e:{switch(T=ut(l,h),l){case"dialog":ft("cancel",n),ft("close",n),v=h;break;case"iframe":case"object":case"embed":ft("load",n),v=h;break;case"video":case"audio":for(v=0;v<qo.length;v++)ft(qo[v],n);v=h;break;case"source":ft("error",n),v=h;break;case"img":case"image":case"link":ft("error",n),ft("load",n),v=h;break;case"details":ft("toggle",n),v=h;break;case"input":_e(n,h),v=Oe(n,h),ft("invalid",n);break;case"option":v=h;break;case"select":n._wrapperState={wasMultiple:!!h.multiple},v=Q({},h,{value:void 0}),ft("invalid",n);break;case"textarea":We(n,h),v=ot(n,h),ft("invalid",n);break;default:v=h}tt(l,v),B=v;for(x in B)if(B.hasOwnProperty(x)){var Y=B[x];x==="style"?ke(n,Y):x==="dangerouslySetInnerHTML"?(Y=Y?Y.__html:void 0,Y!=null&&De(n,Y)):x==="children"?typeof Y=="string"?(l!=="textarea"||Y!=="")&&Te(n,Y):typeof Y=="number"&&Te(n,""+Y):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(o.hasOwnProperty(x)?Y!=null&&x==="onScroll"&&ft("scroll",n):Y!=null&&N(n,x,Y,T))}switch(l){case"input":Pe(n),we(n,h,!1);break;case"textarea":Pe(n),pt(n);break;case"option":h.value!=null&&n.setAttribute("value",""+de(h.value));break;case"select":n.multiple=!!h.multiple,x=h.value,x!=null?Ae(n,!!h.multiple,x,!1):h.defaultValue!=null&&Ae(n,!!h.multiple,h.defaultValue,!0);break;default:typeof v.onClick=="function"&&(n.onclick=ul)}switch(l){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}}h&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return Ht(s),null;case 6:if(n&&s.stateNode!=null)_w(n,s,n.memoizedProps,h);else{if(typeof h!="string"&&s.stateNode===null)throw Error(r(166));if(l=zs(Vo.current),zs(pr.current),gl(s)){if(h=s.stateNode,l=s.memoizedProps,h[hr]=s,(x=h.nodeValue!==l)&&(n=wn,n!==null))switch(n.tag){case 3:ll(h.nodeValue,l,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&ll(h.nodeValue,l,(n.mode&1)!==0)}x&&(s.flags|=4)}else h=(l.nodeType===9?l:l.ownerDocument).createTextNode(h),h[hr]=s,s.stateNode=h}return Ht(s),null;case 13:if(ht(wt),h=s.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(vt&&xn!==null&&(s.mode&1)!==0&&(s.flags&128)===0)k0(),$i(),s.flags|=98560,x=!1;else if(x=gl(s),h!==null&&h.dehydrated!==null){if(n===null){if(!x)throw Error(r(318));if(x=s.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(r(317));x[hr]=s}else $i(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Ht(s),x=!1}else Yn!==null&&(xd(Yn),Yn=null),x=!0;if(!x)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=l,s):(h=h!==null,h!==(n!==null&&n.memoizedState!==null)&&h&&(s.child.flags|=8192,(s.mode&1)!==0&&(n===null||(wt.current&1)!==0?Rt===0&&(Rt=3):Sd())),s.updateQueue!==null&&(s.flags|=4),Ht(s),null);case 4:return zi(),ud(n,s),n===null&&Do(s.stateNode.containerInfo),Ht(s),null;case 10:return $c(s.type._context),Ht(s),null;case 17:return an(s.type)&&dl(),Ht(s),null;case 19:if(ht(wt),x=s.memoizedState,x===null)return Ht(s),null;if(h=(s.flags&128)!==0,T=x.rendering,T===null)if(h)Qo(x,!1);else{if(Rt!==0||n!==null&&(n.flags&128)!==0)for(n=s.child;n!==null;){if(T=bl(n),T!==null){for(s.flags|=128,Qo(x,!1),h=T.updateQueue,h!==null&&(s.updateQueue=h,s.flags|=4),s.subtreeFlags=0,h=l,l=s.child;l!==null;)x=l,n=h,x.flags&=14680066,T=x.alternate,T===null?(x.childLanes=0,x.lanes=n,x.child=null,x.subtreeFlags=0,x.memoizedProps=null,x.memoizedState=null,x.updateQueue=null,x.dependencies=null,x.stateNode=null):(x.childLanes=T.childLanes,x.lanes=T.lanes,x.child=T.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=T.memoizedProps,x.memoizedState=T.memoizedState,x.updateQueue=T.updateQueue,x.type=T.type,n=T.dependencies,x.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),l=l.sibling;return ct(wt,wt.current&1|2),s.child}n=n.sibling}x.tail!==null&&at()>Wi&&(s.flags|=128,h=!0,Qo(x,!1),s.lanes=4194304)}else{if(!h)if(n=bl(T),n!==null){if(s.flags|=128,h=!0,l=n.updateQueue,l!==null&&(s.updateQueue=l,s.flags|=4),Qo(x,!0),x.tail===null&&x.tailMode==="hidden"&&!T.alternate&&!vt)return Ht(s),null}else 2*at()-x.renderingStartTime>Wi&&l!==1073741824&&(s.flags|=128,h=!0,Qo(x,!1),s.lanes=4194304);x.isBackwards?(T.sibling=s.child,s.child=T):(l=x.last,l!==null?l.sibling=T:s.child=T,x.last=T)}return x.tail!==null?(s=x.tail,x.rendering=s,x.tail=s.sibling,x.renderingStartTime=at(),s.sibling=null,l=wt.current,ct(wt,h?l&1|2:l&1),s):(Ht(s),null);case 22:case 23:return bd(),h=s.memoizedState!==null,n!==null&&n.memoizedState!==null!==h&&(s.flags|=8192),h&&(s.mode&1)!==0?(_n&1073741824)!==0&&(Ht(s),s.subtreeFlags&6&&(s.flags|=8192)):Ht(s),null;case 24:return null;case 25:return null}throw Error(r(156,s.tag))}function nR(n,s){switch(Ac(s),s.tag){case 1:return an(s.type)&&dl(),n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 3:return zi(),ht(on),ht(Bt),Hc(),n=s.flags,(n&65536)!==0&&(n&128)===0?(s.flags=n&-65537|128,s):null;case 5:return Bc(s),null;case 13:if(ht(wt),n=s.memoizedState,n!==null&&n.dehydrated!==null){if(s.alternate===null)throw Error(r(340));$i()}return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 19:return ht(wt),null;case 4:return zi(),null;case 10:return $c(s.type._context),null;case 22:case 23:return bd(),null;case 24:return null;default:return null}}var Al=!1,Wt=!1,rR=typeof WeakSet=="function"?WeakSet:Set,be=null;function Ui(n,s){var l=n.ref;if(l!==null)if(typeof l=="function")try{l(null)}catch(h){bt(n,s,h)}else l.current=null}function cd(n,s,l){try{l()}catch(h){bt(n,s,h)}}var bw=!1;function sR(n,s){if(bc=xi,n=e0(),pc(n)){if("selectionStart"in n)var l={start:n.selectionStart,end:n.selectionEnd};else e:{l=(l=n.ownerDocument)&&l.defaultView||window;var h=l.getSelection&&l.getSelection();if(h&&h.rangeCount!==0){l=h.anchorNode;var v=h.anchorOffset,x=h.focusNode;h=h.focusOffset;try{l.nodeType,x.nodeType}catch{l=null;break e}var T=0,B=-1,Y=-1,ae=0,me=0,ge=n,he=null;t:for(;;){for(var xe;ge!==l||v!==0&&ge.nodeType!==3||(B=T+v),ge!==x||h!==0&&ge.nodeType!==3||(Y=T+h),ge.nodeType===3&&(T+=ge.nodeValue.length),(xe=ge.firstChild)!==null;)he=ge,ge=xe;for(;;){if(ge===n)break t;if(he===l&&++ae===v&&(B=T),he===x&&++me===h&&(Y=T),(xe=ge.nextSibling)!==null)break;ge=he,he=ge.parentNode}ge=xe}l=B===-1||Y===-1?null:{start:B,end:Y}}else l=null}l=l||{start:0,end:0}}else l=null;for(Sc={focusedElem:n,selectionRange:l},xi=!1,be=s;be!==null;)if(s=be,n=s.child,(s.subtreeFlags&1028)!==0&&n!==null)n.return=s,be=n;else for(;be!==null;){s=be;try{var Se=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(Se!==null){var Ne=Se.memoizedProps,kt=Se.memoizedState,re=s.stateNode,J=re.getSnapshotBeforeUpdate(s.elementType===s.type?Ne:Kn(s.type,Ne),kt);re.__reactInternalSnapshotBeforeUpdate=J}break;case 3:var oe=s.stateNode.containerInfo;oe.nodeType===1?oe.textContent="":oe.nodeType===9&&oe.documentElement&&oe.removeChild(oe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(ve){bt(s,s.return,ve)}if(n=s.sibling,n!==null){n.return=s.return,be=n;break}be=s.return}return Se=bw,bw=!1,Se}function Zo(n,s,l){var h=s.updateQueue;if(h=h!==null?h.lastEffect:null,h!==null){var v=h=h.next;do{if((v.tag&n)===n){var x=v.destroy;v.destroy=void 0,x!==void 0&&cd(s,l,x)}v=v.next}while(v!==h)}}function Il(n,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var l=s=s.next;do{if((l.tag&n)===n){var h=l.create;l.destroy=h()}l=l.next}while(l!==s)}}function dd(n){var s=n.ref;if(s!==null){var l=n.stateNode;switch(n.tag){case 5:n=l;break;default:n=l}typeof s=="function"?s(n):s.current=n}}function Sw(n){var s=n.alternate;s!==null&&(n.alternate=null,Sw(s)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(s=n.stateNode,s!==null&&(delete s[hr],delete s[zo],delete s[Cc],delete s[FT],delete s[zT])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function kw(n){return n.tag===5||n.tag===3||n.tag===4}function Ew(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||kw(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function fd(n,s,l){var h=n.tag;if(h===5||h===6)n=n.stateNode,s?l.nodeType===8?l.parentNode.insertBefore(n,s):l.insertBefore(n,s):(l.nodeType===8?(s=l.parentNode,s.insertBefore(n,l)):(s=l,s.appendChild(n)),l=l._reactRootContainer,l!=null||s.onclick!==null||(s.onclick=ul));else if(h!==4&&(n=n.child,n!==null))for(fd(n,s,l),n=n.sibling;n!==null;)fd(n,s,l),n=n.sibling}function hd(n,s,l){var h=n.tag;if(h===5||h===6)n=n.stateNode,s?l.insertBefore(n,s):l.appendChild(n);else if(h!==4&&(n=n.child,n!==null))for(hd(n,s,l),n=n.sibling;n!==null;)hd(n,s,l),n=n.sibling}var Dt=null,Xn=!1;function as(n,s,l){for(l=l.child;l!==null;)Nw(n,s,l),l=l.sibling}function Nw(n,s,l){if(Gt&&typeof Gt.onCommitFiberUnmount=="function")try{Gt.onCommitFiberUnmount(Er,l)}catch{}switch(l.tag){case 5:Wt||Ui(l,s);case 6:var h=Dt,v=Xn;Dt=null,as(n,s,l),Dt=h,Xn=v,Dt!==null&&(Xn?(n=Dt,l=l.stateNode,n.nodeType===8?n.parentNode.removeChild(l):n.removeChild(l)):Dt.removeChild(l.stateNode));break;case 18:Dt!==null&&(Xn?(n=Dt,l=l.stateNode,n.nodeType===8?Nc(n.parentNode,l):n.nodeType===1&&Nc(n,l),Qr(n)):Nc(Dt,l.stateNode));break;case 4:h=Dt,v=Xn,Dt=l.stateNode.containerInfo,Xn=!0,as(n,s,l),Dt=h,Xn=v;break;case 0:case 11:case 14:case 15:if(!Wt&&(h=l.updateQueue,h!==null&&(h=h.lastEffect,h!==null))){v=h=h.next;do{var x=v,T=x.destroy;x=x.tag,T!==void 0&&((x&2)!==0||(x&4)!==0)&&cd(l,s,T),v=v.next}while(v!==h)}as(n,s,l);break;case 1:if(!Wt&&(Ui(l,s),h=l.stateNode,typeof h.componentWillUnmount=="function"))try{h.props=l.memoizedProps,h.state=l.memoizedState,h.componentWillUnmount()}catch(B){bt(l,s,B)}as(n,s,l);break;case 21:as(n,s,l);break;case 22:l.mode&1?(Wt=(h=Wt)||l.memoizedState!==null,as(n,s,l),Wt=h):as(n,s,l);break;default:as(n,s,l)}}function Cw(n){var s=n.updateQueue;if(s!==null){n.updateQueue=null;var l=n.stateNode;l===null&&(l=n.stateNode=new rR),s.forEach(function(h){var v=hR.bind(null,n,h);l.has(h)||(l.add(h),h.then(v,v))})}}function Qn(n,s){var l=s.deletions;if(l!==null)for(var h=0;h<l.length;h++){var v=l[h];try{var x=n,T=s,B=T;e:for(;B!==null;){switch(B.tag){case 5:Dt=B.stateNode,Xn=!1;break e;case 3:Dt=B.stateNode.containerInfo,Xn=!0;break e;case 4:Dt=B.stateNode.containerInfo,Xn=!0;break e}B=B.return}if(Dt===null)throw Error(r(160));Nw(x,T,v),Dt=null,Xn=!1;var Y=v.alternate;Y!==null&&(Y.return=null),v.return=null}catch(ae){bt(v,s,ae)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)jw(s,n),s=s.sibling}function jw(n,s){var l=n.alternate,h=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(Qn(s,n),gr(n),h&4){try{Zo(3,n,n.return),Il(3,n)}catch(Ne){bt(n,n.return,Ne)}try{Zo(5,n,n.return)}catch(Ne){bt(n,n.return,Ne)}}break;case 1:Qn(s,n),gr(n),h&512&&l!==null&&Ui(l,l.return);break;case 5:if(Qn(s,n),gr(n),h&512&&l!==null&&Ui(l,l.return),n.flags&32){var v=n.stateNode;try{Te(v,"")}catch(Ne){bt(n,n.return,Ne)}}if(h&4&&(v=n.stateNode,v!=null)){var x=n.memoizedProps,T=l!==null?l.memoizedProps:x,B=n.type,Y=n.updateQueue;if(n.updateQueue=null,Y!==null)try{B==="input"&&x.type==="radio"&&x.name!=null&&Qe(v,x),ut(B,T);var ae=ut(B,x);for(T=0;T<Y.length;T+=2){var me=Y[T],ge=Y[T+1];me==="style"?ke(v,ge):me==="dangerouslySetInnerHTML"?De(v,ge):me==="children"?Te(v,ge):N(v,me,ge,ae)}switch(B){case"input":ye(v,x);break;case"textarea":Ye(v,x);break;case"select":var he=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!x.multiple;var xe=x.value;xe!=null?Ae(v,!!x.multiple,xe,!1):he!==!!x.multiple&&(x.defaultValue!=null?Ae(v,!!x.multiple,x.defaultValue,!0):Ae(v,!!x.multiple,x.multiple?[]:"",!1))}v[zo]=x}catch(Ne){bt(n,n.return,Ne)}}break;case 6:if(Qn(s,n),gr(n),h&4){if(n.stateNode===null)throw Error(r(162));v=n.stateNode,x=n.memoizedProps;try{v.nodeValue=x}catch(Ne){bt(n,n.return,Ne)}}break;case 3:if(Qn(s,n),gr(n),h&4&&l!==null&&l.memoizedState.isDehydrated)try{Qr(s.containerInfo)}catch(Ne){bt(n,n.return,Ne)}break;case 4:Qn(s,n),gr(n);break;case 13:Qn(s,n),gr(n),v=n.child,v.flags&8192&&(x=v.memoizedState!==null,v.stateNode.isHidden=x,!x||v.alternate!==null&&v.alternate.memoizedState!==null||(gd=at())),h&4&&Cw(n);break;case 22:if(me=l!==null&&l.memoizedState!==null,n.mode&1?(Wt=(ae=Wt)||me,Qn(s,n),Wt=ae):Qn(s,n),gr(n),h&8192){if(ae=n.memoizedState!==null,(n.stateNode.isHidden=ae)&&!me&&(n.mode&1)!==0)for(be=n,me=n.child;me!==null;){for(ge=be=me;be!==null;){switch(he=be,xe=he.child,he.tag){case 0:case 11:case 14:case 15:Zo(4,he,he.return);break;case 1:Ui(he,he.return);var Se=he.stateNode;if(typeof Se.componentWillUnmount=="function"){h=he,l=he.return;try{s=h,Se.props=s.memoizedProps,Se.state=s.memoizedState,Se.componentWillUnmount()}catch(Ne){bt(h,l,Ne)}}break;case 5:Ui(he,he.return);break;case 22:if(he.memoizedState!==null){Aw(ge);continue}}xe!==null?(xe.return=he,be=xe):Aw(ge)}me=me.sibling}e:for(me=null,ge=n;;){if(ge.tag===5){if(me===null){me=ge;try{v=ge.stateNode,ae?(x=v.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(B=ge.stateNode,Y=ge.memoizedProps.style,T=Y!=null&&Y.hasOwnProperty("display")?Y.display:null,B.style.display=lt("display",T))}catch(Ne){bt(n,n.return,Ne)}}}else if(ge.tag===6){if(me===null)try{ge.stateNode.nodeValue=ae?"":ge.memoizedProps}catch(Ne){bt(n,n.return,Ne)}}else if((ge.tag!==22&&ge.tag!==23||ge.memoizedState===null||ge===n)&&ge.child!==null){ge.child.return=ge,ge=ge.child;continue}if(ge===n)break e;for(;ge.sibling===null;){if(ge.return===null||ge.return===n)break e;me===ge&&(me=null),ge=ge.return}me===ge&&(me=null),ge.sibling.return=ge.return,ge=ge.sibling}}break;case 19:Qn(s,n),gr(n),h&4&&Cw(n);break;case 21:break;default:Qn(s,n),gr(n)}}function gr(n){var s=n.flags;if(s&2){try{e:{for(var l=n.return;l!==null;){if(kw(l)){var h=l;break e}l=l.return}throw Error(r(160))}switch(h.tag){case 5:var v=h.stateNode;h.flags&32&&(Te(v,""),h.flags&=-33);var x=Ew(n);hd(n,x,v);break;case 3:case 4:var T=h.stateNode.containerInfo,B=Ew(n);fd(n,B,T);break;default:throw Error(r(161))}}catch(Y){bt(n,n.return,Y)}n.flags&=-3}s&4096&&(n.flags&=-4097)}function iR(n,s,l){be=n,Tw(n)}function Tw(n,s,l){for(var h=(n.mode&1)!==0;be!==null;){var v=be,x=v.child;if(v.tag===22&&h){var T=v.memoizedState!==null||Al;if(!T){var B=v.alternate,Y=B!==null&&B.memoizedState!==null||Wt;B=Al;var ae=Wt;if(Al=T,(Wt=Y)&&!ae)for(be=v;be!==null;)T=be,Y=T.child,T.tag===22&&T.memoizedState!==null?Iw(v):Y!==null?(Y.return=T,be=Y):Iw(v);for(;x!==null;)be=x,Tw(x),x=x.sibling;be=v,Al=B,Wt=ae}Rw(n)}else(v.subtreeFlags&8772)!==0&&x!==null?(x.return=v,be=x):Rw(n)}}function Rw(n){for(;be!==null;){var s=be;if((s.flags&8772)!==0){var l=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:Wt||Il(5,s);break;case 1:var h=s.stateNode;if(s.flags&4&&!Wt)if(l===null)h.componentDidMount();else{var v=s.elementType===s.type?l.memoizedProps:Kn(s.type,l.memoizedProps);h.componentDidUpdate(v,l.memoizedState,h.__reactInternalSnapshotBeforeUpdate)}var x=s.updateQueue;x!==null&&A0(s,x,h);break;case 3:var T=s.updateQueue;if(T!==null){if(l=null,s.child!==null)switch(s.child.tag){case 5:l=s.child.stateNode;break;case 1:l=s.child.stateNode}A0(s,T,l)}break;case 5:var B=s.stateNode;if(l===null&&s.flags&4){l=B;var Y=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":Y.autoFocus&&l.focus();break;case"img":Y.src&&(l.src=Y.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var ae=s.alternate;if(ae!==null){var me=ae.memoizedState;if(me!==null){var ge=me.dehydrated;ge!==null&&Qr(ge)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}Wt||s.flags&512&&dd(s)}catch(he){bt(s,s.return,he)}}if(s===n){be=null;break}if(l=s.sibling,l!==null){l.return=s.return,be=l;break}be=s.return}}function Aw(n){for(;be!==null;){var s=be;if(s===n){be=null;break}var l=s.sibling;if(l!==null){l.return=s.return,be=l;break}be=s.return}}function Iw(n){for(;be!==null;){var s=be;try{switch(s.tag){case 0:case 11:case 15:var l=s.return;try{Il(4,s)}catch(Y){bt(s,l,Y)}break;case 1:var h=s.stateNode;if(typeof h.componentDidMount=="function"){var v=s.return;try{h.componentDidMount()}catch(Y){bt(s,v,Y)}}var x=s.return;try{dd(s)}catch(Y){bt(s,x,Y)}break;case 5:var T=s.return;try{dd(s)}catch(Y){bt(s,T,Y)}}}catch(Y){bt(s,s.return,Y)}if(s===n){be=null;break}var B=s.sibling;if(B!==null){B.return=s.return,be=B;break}be=s.return}}var oR=Math.ceil,Ml=j.ReactCurrentDispatcher,pd=j.ReactCurrentOwner,On=j.ReactCurrentBatchConfig,et=0,Lt=null,Nt=null,Ft=0,_n=0,Hi=ns(0),Rt=0,Jo=null,Us=0,Ol=0,md=0,ea=null,un=null,gd=0,Wi=1/0,$r=null,Pl=!1,vd=null,ls=null,Ll=!1,us=null,$l=0,ta=0,yd=null,ql=-1,Dl=0;function Jt(){return(et&6)!==0?at():ql!==-1?ql:ql=at()}function cs(n){return(n.mode&1)===0?1:(et&2)!==0&&Ft!==0?Ft&-Ft:UT.transition!==null?(Dl===0&&(Dl=ko()),Dl):(n=Ke,n!==0||(n=window.event,n=n===void 0?16:Ka(n.type)),n)}function Zn(n,s,l,h){if(50<ta)throw ta=0,yd=null,Error(r(185));Yr(n,l,h),((et&2)===0||n!==Lt)&&(n===Lt&&((et&2)===0&&(Ol|=l),Rt===4&&ds(n,Ft)),cn(n,h),l===1&&et===0&&(s.mode&1)===0&&(Wi=at()+500,hl&&ss()))}function cn(n,s){var l=n.callbackNode;So(n,s);var h=js(n,n===Lt?Ft:0);if(h===0)l!==null&&Ns(l),n.callbackNode=null,n.callbackPriority=0;else if(s=h&-h,n.callbackPriority!==s){if(l!=null&&Ns(l),s===1)n.tag===0?BT(Ow.bind(null,n)):w0(Ow.bind(null,n)),qT(function(){(et&6)===0&&ss()}),l=null;else{switch(Eo(h)){case 1:l=lr;break;case 4:l=Sr;break;case 16:l=kr;break;case 536870912:l=ur;break;default:l=kr}l=Bw(l,Mw.bind(null,n))}n.callbackPriority=s,n.callbackNode=l}}function Mw(n,s){if(ql=-1,Dl=0,(et&6)!==0)throw Error(r(327));var l=n.callbackNode;if(Vi()&&n.callbackNode!==l)return null;var h=js(n,n===Lt?Ft:0);if(h===0)return null;if((h&30)!==0||(h&n.expiredLanes)!==0||s)s=Fl(n,h);else{s=h;var v=et;et|=2;var x=Lw();(Lt!==n||Ft!==s)&&($r=null,Wi=at()+500,Ws(n,s));do try{uR();break}catch(B){Pw(n,B)}while(!0);Lc(),Ml.current=x,et=v,Nt!==null?s=0:(Lt=null,Ft=0,s=Rt)}if(s!==0){if(s===2&&(v=Vn(n),v!==0&&(h=v,s=wd(n,v))),s===1)throw l=Jo,Ws(n,0),ds(n,h),cn(n,at()),l;if(s===6)ds(n,h);else{if(v=n.current.alternate,(h&30)===0&&!aR(v)&&(s=Fl(n,h),s===2&&(x=Vn(n),x!==0&&(h=x,s=wd(n,x))),s===1))throw l=Jo,Ws(n,0),ds(n,h),cn(n,at()),l;switch(n.finishedWork=v,n.finishedLanes=h,s){case 0:case 1:throw Error(r(345));case 2:Vs(n,un,$r);break;case 3:if(ds(n,h),(h&130023424)===h&&(s=gd+500-at(),10<s)){if(js(n,0)!==0)break;if(v=n.suspendedLanes,(v&h)!==h){Jt(),n.pingedLanes|=n.suspendedLanes&v;break}n.timeoutHandle=Ec(Vs.bind(null,n,un,$r),s);break}Vs(n,un,$r);break;case 4:if(ds(n,h),(h&4194240)===h)break;for(s=n.eventTimes,v=-1;0<h;){var T=31-tn(h);x=1<<T,T=s[T],T>v&&(v=T),h&=~x}if(h=v,h=at()-h,h=(120>h?120:480>h?480:1080>h?1080:1920>h?1920:3e3>h?3e3:4320>h?4320:1960*oR(h/1960))-h,10<h){n.timeoutHandle=Ec(Vs.bind(null,n,un,$r),h);break}Vs(n,un,$r);break;case 5:Vs(n,un,$r);break;default:throw Error(r(329))}}}return cn(n,at()),n.callbackNode===l?Mw.bind(null,n):null}function wd(n,s){var l=ea;return n.current.memoizedState.isDehydrated&&(Ws(n,s).flags|=256),n=Fl(n,s),n!==2&&(s=un,un=l,s!==null&&xd(s)),n}function xd(n){un===null?un=n:un.push.apply(un,n)}function aR(n){for(var s=n;;){if(s.flags&16384){var l=s.updateQueue;if(l!==null&&(l=l.stores,l!==null))for(var h=0;h<l.length;h++){var v=l[h],x=v.getSnapshot;v=v.value;try{if(!Gn(x(),v))return!1}catch{return!1}}}if(l=s.child,s.subtreeFlags&16384&&l!==null)l.return=s,s=l;else{if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function ds(n,s){for(s&=~md,s&=~Ol,n.suspendedLanes|=s,n.pingedLanes&=~s,n=n.expirationTimes;0<s;){var l=31-tn(s),h=1<<l;n[l]=-1,s&=~h}}function Ow(n){if((et&6)!==0)throw Error(r(327));Vi();var s=js(n,0);if((s&1)===0)return cn(n,at()),null;var l=Fl(n,s);if(n.tag!==0&&l===2){var h=Vn(n);h!==0&&(s=h,l=wd(n,h))}if(l===1)throw l=Jo,Ws(n,0),ds(n,s),cn(n,at()),l;if(l===6)throw Error(r(345));return n.finishedWork=n.current.alternate,n.finishedLanes=s,Vs(n,un,$r),cn(n,at()),null}function _d(n,s){var l=et;et|=1;try{return n(s)}finally{et=l,et===0&&(Wi=at()+500,hl&&ss())}}function Hs(n){us!==null&&us.tag===0&&(et&6)===0&&Vi();var s=et;et|=1;var l=On.transition,h=Ke;try{if(On.transition=null,Ke=1,n)return n()}finally{Ke=h,On.transition=l,et=s,(et&6)===0&&ss()}}function bd(){_n=Hi.current,ht(Hi)}function Ws(n,s){n.finishedWork=null,n.finishedLanes=0;var l=n.timeoutHandle;if(l!==-1&&(n.timeoutHandle=-1,$T(l)),Nt!==null)for(l=Nt.return;l!==null;){var h=l;switch(Ac(h),h.tag){case 1:h=h.type.childContextTypes,h!=null&&dl();break;case 3:zi(),ht(on),ht(Bt),Hc();break;case 5:Bc(h);break;case 4:zi();break;case 13:ht(wt);break;case 19:ht(wt);break;case 10:$c(h.type._context);break;case 22:case 23:bd()}l=l.return}if(Lt=n,Nt=n=fs(n.current,null),Ft=_n=s,Rt=0,Jo=null,md=Ol=Us=0,un=ea=null,Fs!==null){for(s=0;s<Fs.length;s++)if(l=Fs[s],h=l.interleaved,h!==null){l.interleaved=null;var v=h.next,x=l.pending;if(x!==null){var T=x.next;x.next=v,h.next=T}l.pending=h}Fs=null}return n}function Pw(n,s){do{var l=Nt;try{if(Lc(),Sl.current=Cl,kl){for(var h=xt.memoizedState;h!==null;){var v=h.queue;v!==null&&(v.pending=null),h=h.next}kl=!1}if(Bs=0,Pt=Tt=xt=null,Go=!1,Yo=0,pd.current=null,l===null||l.return===null){Rt=1,Jo=s,Nt=null;break}e:{var x=n,T=l.return,B=l,Y=s;if(s=Ft,B.flags|=32768,Y!==null&&typeof Y=="object"&&typeof Y.then=="function"){var ae=Y,me=B,ge=me.tag;if((me.mode&1)===0&&(ge===0||ge===11||ge===15)){var he=me.alternate;he?(me.updateQueue=he.updateQueue,me.memoizedState=he.memoizedState,me.lanes=he.lanes):(me.updateQueue=null,me.memoizedState=null)}var xe=ow(T);if(xe!==null){xe.flags&=-257,aw(xe,T,B,x,s),xe.mode&1&&iw(x,ae,s),s=xe,Y=ae;var Se=s.updateQueue;if(Se===null){var Ne=new Set;Ne.add(Y),s.updateQueue=Ne}else Se.add(Y);break e}else{if((s&1)===0){iw(x,ae,s),Sd();break e}Y=Error(r(426))}}else if(vt&&B.mode&1){var kt=ow(T);if(kt!==null){(kt.flags&65536)===0&&(kt.flags|=256),aw(kt,T,B,x,s),Oc(Bi(Y,B));break e}}x=Y=Bi(Y,B),Rt!==4&&(Rt=2),ea===null?ea=[x]:ea.push(x),x=T;do{switch(x.tag){case 3:x.flags|=65536,s&=-s,x.lanes|=s;var re=rw(x,Y,s);R0(x,re);break e;case 1:B=Y;var J=x.type,oe=x.stateNode;if((x.flags&128)===0&&(typeof J.getDerivedStateFromError=="function"||oe!==null&&typeof oe.componentDidCatch=="function"&&(ls===null||!ls.has(oe)))){x.flags|=65536,s&=-s,x.lanes|=s;var ve=sw(x,B,s);R0(x,ve);break e}}x=x.return}while(x!==null)}qw(l)}catch(Ce){s=Ce,Nt===l&&l!==null&&(Nt=l=l.return);continue}break}while(!0)}function Lw(){var n=Ml.current;return Ml.current=Cl,n===null?Cl:n}function Sd(){(Rt===0||Rt===3||Rt===2)&&(Rt=4),Lt===null||(Us&268435455)===0&&(Ol&268435455)===0||ds(Lt,Ft)}function Fl(n,s){var l=et;et|=2;var h=Lw();(Lt!==n||Ft!==s)&&($r=null,Ws(n,s));do try{lR();break}catch(v){Pw(n,v)}while(!0);if(Lc(),et=l,Ml.current=h,Nt!==null)throw Error(r(261));return Lt=null,Ft=0,Rt}function lR(){for(;Nt!==null;)$w(Nt)}function uR(){for(;Nt!==null&&!br();)$w(Nt)}function $w(n){var s=zw(n.alternate,n,_n);n.memoizedProps=n.pendingProps,s===null?qw(n):Nt=s,pd.current=null}function qw(n){var s=n;do{var l=s.alternate;if(n=s.return,(s.flags&32768)===0){if(l=tR(l,s,_n),l!==null){Nt=l;return}}else{if(l=nR(l,s),l!==null){l.flags&=32767,Nt=l;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{Rt=6,Nt=null;return}}if(s=s.sibling,s!==null){Nt=s;return}Nt=s=n}while(s!==null);Rt===0&&(Rt=5)}function Vs(n,s,l){var h=Ke,v=On.transition;try{On.transition=null,Ke=1,cR(n,s,l,h)}finally{On.transition=v,Ke=h}return null}function cR(n,s,l,h){do Vi();while(us!==null);if((et&6)!==0)throw Error(r(327));l=n.finishedWork;var v=n.finishedLanes;if(l===null)return null;if(n.finishedWork=null,n.finishedLanes=0,l===n.current)throw Error(r(177));n.callbackNode=null,n.callbackPriority=0;var x=l.lanes|l.childLanes;if(uc(n,x),n===Lt&&(Nt=Lt=null,Ft=0),(l.subtreeFlags&2064)===0&&(l.flags&2064)===0||Ll||(Ll=!0,Bw(kr,function(){return Vi(),null})),x=(l.flags&15990)!==0,(l.subtreeFlags&15990)!==0||x){x=On.transition,On.transition=null;var T=Ke;Ke=1;var B=et;et|=4,pd.current=null,sR(n,l),jw(l,n),RT(Sc),xi=!!bc,Sc=bc=null,n.current=l,iR(l),hi(),et=B,Ke=T,On.transition=x}else n.current=l;if(Ll&&(Ll=!1,us=n,$l=v),x=n.pendingLanes,x===0&&(ls=null),Cs(l.stateNode),cn(n,at()),s!==null)for(h=n.onRecoverableError,l=0;l<s.length;l++)v=s[l],h(v.value,{componentStack:v.stack,digest:v.digest});if(Pl)throw Pl=!1,n=vd,vd=null,n;return($l&1)!==0&&n.tag!==0&&Vi(),x=n.pendingLanes,(x&1)!==0?n===yd?ta++:(ta=0,yd=n):ta=0,ss(),null}function Vi(){if(us!==null){var n=Eo($l),s=On.transition,l=Ke;try{if(On.transition=null,Ke=16>n?16:n,us===null)var h=!1;else{if(n=us,us=null,$l=0,(et&6)!==0)throw Error(r(331));var v=et;for(et|=4,be=n.current;be!==null;){var x=be,T=x.child;if((be.flags&16)!==0){var B=x.deletions;if(B!==null){for(var Y=0;Y<B.length;Y++){var ae=B[Y];for(be=ae;be!==null;){var me=be;switch(me.tag){case 0:case 11:case 15:Zo(8,me,x)}var ge=me.child;if(ge!==null)ge.return=me,be=ge;else for(;be!==null;){me=be;var he=me.sibling,xe=me.return;if(Sw(me),me===ae){be=null;break}if(he!==null){he.return=xe,be=he;break}be=xe}}}var Se=x.alternate;if(Se!==null){var Ne=Se.child;if(Ne!==null){Se.child=null;do{var kt=Ne.sibling;Ne.sibling=null,Ne=kt}while(Ne!==null)}}be=x}}if((x.subtreeFlags&2064)!==0&&T!==null)T.return=x,be=T;else e:for(;be!==null;){if(x=be,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:Zo(9,x,x.return)}var re=x.sibling;if(re!==null){re.return=x.return,be=re;break e}be=x.return}}var J=n.current;for(be=J;be!==null;){T=be;var oe=T.child;if((T.subtreeFlags&2064)!==0&&oe!==null)oe.return=T,be=oe;else e:for(T=J;be!==null;){if(B=be,(B.flags&2048)!==0)try{switch(B.tag){case 0:case 11:case 15:Il(9,B)}}catch(Ce){bt(B,B.return,Ce)}if(B===T){be=null;break e}var ve=B.sibling;if(ve!==null){ve.return=B.return,be=ve;break e}be=B.return}}if(et=v,ss(),Gt&&typeof Gt.onPostCommitFiberRoot=="function")try{Gt.onPostCommitFiberRoot(Er,n)}catch{}h=!0}return h}finally{Ke=l,On.transition=s}}return!1}function Dw(n,s,l){s=Bi(l,s),s=rw(n,s,1),n=os(n,s,1),s=Jt(),n!==null&&(Yr(n,1,s),cn(n,s))}function bt(n,s,l){if(n.tag===3)Dw(n,n,l);else for(;s!==null;){if(s.tag===3){Dw(s,n,l);break}else if(s.tag===1){var h=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(ls===null||!ls.has(h))){n=Bi(l,n),n=sw(s,n,1),s=os(s,n,1),n=Jt(),s!==null&&(Yr(s,1,n),cn(s,n));break}}s=s.return}}function dR(n,s,l){var h=n.pingCache;h!==null&&h.delete(s),s=Jt(),n.pingedLanes|=n.suspendedLanes&l,Lt===n&&(Ft&l)===l&&(Rt===4||Rt===3&&(Ft&130023424)===Ft&&500>at()-gd?Ws(n,0):md|=l),cn(n,s)}function Fw(n,s){s===0&&((n.mode&1)===0?s=1:(s=Gr,Gr<<=1,(Gr&130023424)===0&&(Gr=4194304)));var l=Jt();n=Or(n,s),n!==null&&(Yr(n,s,l),cn(n,l))}function fR(n){var s=n.memoizedState,l=0;s!==null&&(l=s.retryLane),Fw(n,l)}function hR(n,s){var l=0;switch(n.tag){case 13:var h=n.stateNode,v=n.memoizedState;v!==null&&(l=v.retryLane);break;case 19:h=n.stateNode;break;default:throw Error(r(314))}h!==null&&h.delete(s),Fw(n,l)}var zw;zw=function(n,s,l){if(n!==null)if(n.memoizedProps!==s.pendingProps||on.current)ln=!0;else{if((n.lanes&l)===0&&(s.flags&128)===0)return ln=!1,eR(n,s,l);ln=(n.flags&131072)!==0}else ln=!1,vt&&(s.flags&1048576)!==0&&x0(s,ml,s.index);switch(s.lanes=0,s.tag){case 2:var h=s.type;Rl(n,s),n=s.pendingProps;var v=Oi(s,Bt.current);Fi(s,l),v=Gc(null,s,h,n,v,l);var x=Yc();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,an(h)?(x=!0,fl(s)):x=!1,s.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,Fc(s),v.updater=jl,s.stateNode=v,v._reactInternals=s,ed(s,h,n,l),s=sd(null,s,h,!0,x,l)):(s.tag=0,vt&&x&&Rc(s),Zt(null,s,v,l),s=s.child),s;case 16:h=s.elementType;e:{switch(Rl(n,s),n=s.pendingProps,v=h._init,h=v(h._payload),s.type=h,v=s.tag=mR(h),n=Kn(h,n),v){case 0:s=rd(null,s,h,n,l);break e;case 1:s=hw(null,s,h,n,l);break e;case 11:s=lw(null,s,h,n,l);break e;case 14:s=uw(null,s,h,Kn(h.type,n),l);break e}throw Error(r(306,h,""))}return s;case 0:return h=s.type,v=s.pendingProps,v=s.elementType===h?v:Kn(h,v),rd(n,s,h,v,l);case 1:return h=s.type,v=s.pendingProps,v=s.elementType===h?v:Kn(h,v),hw(n,s,h,v,l);case 3:e:{if(pw(s),n===null)throw Error(r(387));h=s.pendingProps,x=s.memoizedState,v=x.element,T0(n,s),_l(s,h,null,l);var T=s.memoizedState;if(h=T.element,x.isDehydrated)if(x={element:h,isDehydrated:!1,cache:T.cache,pendingSuspenseBoundaries:T.pendingSuspenseBoundaries,transitions:T.transitions},s.updateQueue.baseState=x,s.memoizedState=x,s.flags&256){v=Bi(Error(r(423)),s),s=mw(n,s,h,l,v);break e}else if(h!==v){v=Bi(Error(r(424)),s),s=mw(n,s,h,l,v);break e}else for(xn=ts(s.stateNode.containerInfo.firstChild),wn=s,vt=!0,Yn=null,l=C0(s,null,h,l),s.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if($i(),h===v){s=Lr(n,s,l);break e}Zt(n,s,h,l)}s=s.child}return s;case 5:return I0(s),n===null&&Mc(s),h=s.type,v=s.pendingProps,x=n!==null?n.memoizedProps:null,T=v.children,kc(h,v)?T=null:x!==null&&kc(h,x)&&(s.flags|=32),fw(n,s),Zt(n,s,T,l),s.child;case 6:return n===null&&Mc(s),null;case 13:return gw(n,s,l);case 4:return zc(s,s.stateNode.containerInfo),h=s.pendingProps,n===null?s.child=qi(s,null,h,l):Zt(n,s,h,l),s.child;case 11:return h=s.type,v=s.pendingProps,v=s.elementType===h?v:Kn(h,v),lw(n,s,h,v,l);case 7:return Zt(n,s,s.pendingProps,l),s.child;case 8:return Zt(n,s,s.pendingProps.children,l),s.child;case 12:return Zt(n,s,s.pendingProps.children,l),s.child;case 10:e:{if(h=s.type._context,v=s.pendingProps,x=s.memoizedProps,T=v.value,ct(yl,h._currentValue),h._currentValue=T,x!==null)if(Gn(x.value,T)){if(x.children===v.children&&!on.current){s=Lr(n,s,l);break e}}else for(x=s.child,x!==null&&(x.return=s);x!==null;){var B=x.dependencies;if(B!==null){T=x.child;for(var Y=B.firstContext;Y!==null;){if(Y.context===h){if(x.tag===1){Y=Pr(-1,l&-l),Y.tag=2;var ae=x.updateQueue;if(ae!==null){ae=ae.shared;var me=ae.pending;me===null?Y.next=Y:(Y.next=me.next,me.next=Y),ae.pending=Y}}x.lanes|=l,Y=x.alternate,Y!==null&&(Y.lanes|=l),qc(x.return,l,s),B.lanes|=l;break}Y=Y.next}}else if(x.tag===10)T=x.type===s.type?null:x.child;else if(x.tag===18){if(T=x.return,T===null)throw Error(r(341));T.lanes|=l,B=T.alternate,B!==null&&(B.lanes|=l),qc(T,l,s),T=x.sibling}else T=x.child;if(T!==null)T.return=x;else for(T=x;T!==null;){if(T===s){T=null;break}if(x=T.sibling,x!==null){x.return=T.return,T=x;break}T=T.return}x=T}Zt(n,s,v.children,l),s=s.child}return s;case 9:return v=s.type,h=s.pendingProps.children,Fi(s,l),v=In(v),h=h(v),s.flags|=1,Zt(n,s,h,l),s.child;case 14:return h=s.type,v=Kn(h,s.pendingProps),v=Kn(h.type,v),uw(n,s,h,v,l);case 15:return cw(n,s,s.type,s.pendingProps,l);case 17:return h=s.type,v=s.pendingProps,v=s.elementType===h?v:Kn(h,v),Rl(n,s),s.tag=1,an(h)?(n=!0,fl(s)):n=!1,Fi(s,l),tw(s,h,v),ed(s,h,v,l),sd(null,s,h,!0,n,l);case 19:return yw(n,s,l);case 22:return dw(n,s,l)}throw Error(r(156,s.tag))};function Bw(n,s){return Es(n,s)}function pR(n,s,l,h){this.tag=n,this.key=l,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=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pn(n,s,l,h){return new pR(n,s,l,h)}function kd(n){return n=n.prototype,!(!n||!n.isReactComponent)}function mR(n){if(typeof n=="function")return kd(n)?1:0;if(n!=null){if(n=n.$$typeof,n===W)return 11;if(n===z)return 14}return 2}function fs(n,s){var l=n.alternate;return l===null?(l=Pn(n.tag,s,n.key,n.mode),l.elementType=n.elementType,l.type=n.type,l.stateNode=n.stateNode,l.alternate=n,n.alternate=l):(l.pendingProps=s,l.type=n.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=n.flags&14680064,l.childLanes=n.childLanes,l.lanes=n.lanes,l.child=n.child,l.memoizedProps=n.memoizedProps,l.memoizedState=n.memoizedState,l.updateQueue=n.updateQueue,s=n.dependencies,l.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},l.sibling=n.sibling,l.index=n.index,l.ref=n.ref,l}function zl(n,s,l,h,v,x){var T=2;if(h=n,typeof n=="function")kd(n)&&(T=1);else if(typeof n=="string")T=5;else e:switch(n){case L:return Gs(l.children,v,x,s);case P:T=8,v|=8;break;case D:return n=Pn(12,l,s,v|2),n.elementType=D,n.lanes=x,n;case K:return n=Pn(13,l,s,v),n.elementType=K,n.lanes=x,n;case C:return n=Pn(19,l,s,v),n.elementType=C,n.lanes=x,n;case te:return Bl(l,v,x,s);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case M:T=10;break e;case q:T=9;break e;case W:T=11;break e;case z:T=14;break e;case F:T=16,h=null;break e}throw Error(r(130,n==null?n:typeof n,""))}return s=Pn(T,l,s,v),s.elementType=n,s.type=h,s.lanes=x,s}function Gs(n,s,l,h){return n=Pn(7,n,h,s),n.lanes=l,n}function Bl(n,s,l,h){return n=Pn(22,n,h,s),n.elementType=te,n.lanes=l,n.stateNode={isHidden:!1},n}function Ed(n,s,l){return n=Pn(6,n,null,s),n.lanes=l,n}function Nd(n,s,l){return s=Pn(4,n.children!==null?n.children:[],n.key,s),s.lanes=l,s.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},s}function gR(n,s,l,h,v){this.tag=s,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=gi(0),this.expirationTimes=gi(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gi(0),this.identifierPrefix=h,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function Cd(n,s,l,h,v,x,T,B,Y){return n=new gR(n,s,l,B,Y),s===1?(s=1,x===!0&&(s|=8)):s=0,x=Pn(3,null,null,s),n.current=x,x.stateNode=n,x.memoizedState={element:h,isDehydrated:l,cache:null,transitions:null,pendingSuspenseBoundaries:null},Fc(x),n}function vR(n,s,l){var h=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:I,key:h==null?null:""+h,children:n,containerInfo:s,implementation:l}}function Uw(n){if(!n)return rs;n=n._reactInternals;e:{if(en(n)!==n||n.tag!==1)throw Error(r(170));var s=n;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(an(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(r(171))}if(n.tag===1){var l=n.type;if(an(l))return v0(n,l,s)}return s}function Hw(n,s,l,h,v,x,T,B,Y){return n=Cd(l,h,!0,n,v,x,T,B,Y),n.context=Uw(null),l=n.current,h=Jt(),v=cs(l),x=Pr(h,v),x.callback=s??null,os(l,x,v),n.current.lanes=v,Yr(n,v,h),cn(n,h),n}function Ul(n,s,l,h){var v=s.current,x=Jt(),T=cs(v);return l=Uw(l),s.context===null?s.context=l:s.pendingContext=l,s=Pr(x,T),s.payload={element:n},h=h===void 0?null:h,h!==null&&(s.callback=h),n=os(v,s,T),n!==null&&(Zn(n,v,T,x),xl(n,v,T)),T}function Hl(n){if(n=n.current,!n.child)return null;switch(n.child.tag){case 5:return n.child.stateNode;default:return n.child.stateNode}}function Ww(n,s){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var l=n.retryLane;n.retryLane=l!==0&&l<s?l:s}}function jd(n,s){Ww(n,s),(n=n.alternate)&&Ww(n,s)}function yR(){return null}var Vw=typeof reportError=="function"?reportError:function(n){console.error(n)};function Td(n){this._internalRoot=n}Wl.prototype.render=Td.prototype.render=function(n){var s=this._internalRoot;if(s===null)throw Error(r(409));Ul(n,s,null,null)},Wl.prototype.unmount=Td.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var s=n.containerInfo;Hs(function(){Ul(null,n,null,null)}),s[Rr]=null}};function Wl(n){this._internalRoot=n}Wl.prototype.unstable_scheduleHydration=function(n){if(n){var s=Ba();n={blockedOn:null,target:n,priority:s};for(var l=0;l<vn.length&&s!==0&&s<vn[l].priority;l++);vn.splice(l,0,n),l===0&&Va(n)}};function Rd(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function Vl(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function Gw(){}function wR(n,s,l,h,v){if(v){if(typeof h=="function"){var x=h;h=function(){var ae=Hl(T);x.call(ae)}}var T=Hw(s,h,n,0,null,!1,!1,"",Gw);return n._reactRootContainer=T,n[Rr]=T.current,Do(n.nodeType===8?n.parentNode:n),Hs(),T}for(;v=n.lastChild;)n.removeChild(v);if(typeof h=="function"){var B=h;h=function(){var ae=Hl(Y);B.call(ae)}}var Y=Cd(n,0,!1,null,null,!1,!1,"",Gw);return n._reactRootContainer=Y,n[Rr]=Y.current,Do(n.nodeType===8?n.parentNode:n),Hs(function(){Ul(s,Y,l,h)}),Y}function Gl(n,s,l,h,v){var x=l._reactRootContainer;if(x){var T=x;if(typeof v=="function"){var B=v;v=function(){var Y=Hl(T);B.call(Y)}}Ul(s,T,n,v)}else T=wR(l,s,n,v,h);return Hl(T)}za=function(n){switch(n.tag){case 3:var s=n.stateNode;if(s.current.memoizedState.isDehydrated){var l=Nr(s.pendingLanes);l!==0&&(Ts(s,l|1),cn(s,at()),(et&6)===0&&(Wi=at()+500,ss()))}break;case 13:Hs(function(){var h=Or(n,1);if(h!==null){var v=Jt();Zn(h,n,1,v)}}),jd(n,1)}},vi=function(n){if(n.tag===13){var s=Or(n,134217728);if(s!==null){var l=Jt();Zn(s,n,134217728,l)}jd(n,134217728)}},No=function(n){if(n.tag===13){var s=cs(n),l=Or(n,s);if(l!==null){var h=Jt();Zn(l,n,s,h)}jd(n,s)}},Ba=function(){return Ke},Kt=function(n,s){var l=Ke;try{return Ke=n,s()}finally{Ke=l}},Sn=function(n,s,l){switch(s){case"input":if(ye(n,l),s=l.name,l.type==="radio"&&s!=null){for(l=n;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<l.length;s++){var h=l[s];if(h!==n&&h.form===n.form){var v=cl(h);if(!v)throw Error(r(90));He(h),ye(h,v)}}}break;case"textarea":Ye(n,l);break;case"select":s=l.value,s!=null&&Ae(n,!!l.multiple,s,!1)}},li=_d,Ss=Hs;var xR={usingClientEntryPoint:!1,Events:[Bo,Ii,cl,_s,bs,_d]},na={findFiberByHostInstance:Ls,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},_R={bundleType:na.bundleType,version:na.version,rendererPackageName:na.rendererPackageName,rendererConfig:na.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:j.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=ks(n),n===null?null:n.stateNode},findFiberByHostInstance:na.findFiberByHostInstance||yR,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 Yl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yl.isDisabled&&Yl.supportsFiber)try{Er=Yl.inject(_R),Gt=Yl}catch{}}return dn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=xR,dn.createPortal=function(n,s){var l=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Rd(s))throw Error(r(200));return vR(n,s,null,l)},dn.createRoot=function(n,s){if(!Rd(n))throw Error(r(299));var l=!1,h="",v=Vw;return s!=null&&(s.unstable_strictMode===!0&&(l=!0),s.identifierPrefix!==void 0&&(h=s.identifierPrefix),s.onRecoverableError!==void 0&&(v=s.onRecoverableError)),s=Cd(n,1,!1,null,null,l,!1,h,v),n[Rr]=s.current,Do(n.nodeType===8?n.parentNode:n),new Td(s)},dn.findDOMNode=function(n){if(n==null)return null;if(n.nodeType===1)return n;var s=n._reactInternals;if(s===void 0)throw typeof n.render=="function"?Error(r(188)):(n=Object.keys(n).join(","),Error(r(268,n)));return n=ks(s),n=n===null?null:n.stateNode,n},dn.flushSync=function(n){return Hs(n)},dn.hydrate=function(n,s,l){if(!Vl(s))throw Error(r(200));return Gl(null,n,s,!0,l)},dn.hydrateRoot=function(n,s,l){if(!Rd(n))throw Error(r(405));var h=l!=null&&l.hydratedSources||null,v=!1,x="",T=Vw;if(l!=null&&(l.unstable_strictMode===!0&&(v=!0),l.identifierPrefix!==void 0&&(x=l.identifierPrefix),l.onRecoverableError!==void 0&&(T=l.onRecoverableError)),s=Hw(s,null,n,1,l??null,v,!1,x,T),n[Rr]=s.current,Do(n),h)for(n=0;n<h.length;n++)l=h[n],v=l._getVersion,v=v(l._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[l,v]:s.mutableSourceEagerHydrationData.push(l,v);return new Wl(s)},dn.render=function(n,s,l){if(!Vl(s))throw Error(r(200));return Gl(null,n,s,!1,l)},dn.unmountComponentAtNode=function(n){if(!Vl(n))throw Error(r(40));return n._reactRootContainer?(Hs(function(){Gl(null,null,n,!1,function(){n._reactRootContainer=null,n[Rr]=null})}),!0):!1},dn.unstable_batchedUpdates=_d,dn.unstable_renderSubtreeIntoContainer=function(n,s,l,h){if(!Vl(l))throw Error(r(200));if(n==null||n._reactInternals===void 0)throw Error(r(38));return Gl(n,s,l,!1,h)},dn.version="18.3.1-next-f1338f8080-20240426",dn}var tx;function pN(){if(tx)return Md.exports;tx=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Md.exports=jR(),Md.exports}var nx;function TR(){if(nx)return Xl;nx=1;var e=pN();return Xl.createRoot=e.createRoot,Xl.hydrateRoot=e.hydrateRoot,Xl}var RR=TR(),R=Ta();const ue=Yv(R);function zt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let r=0,i;r<e.length;r++)(i=zt(e[r]))!==""&&(t+=(t&&" ")+i);else for(let r in e)e[r]&&(t+=(t&&" ")+r);return t}var Ld={exports:{}},$d={},qd={exports:{}},Dd={};/**
|
|
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 rx;function AR(){if(rx)return Dd;rx=1;var e=Ta();function t(g,y){return g===y&&(g!==0||1/g===1/y)||g!==g&&y!==y}var r=typeof Object.is=="function"?Object.is:t,i=e.useState,o=e.useEffect,a=e.useLayoutEffect,u=e.useDebugValue;function c(g,y){var w=y(),k=i({inst:{value:w,getSnapshot:y}}),_=k[0].inst,b=k[1];return a(function(){_.value=w,_.getSnapshot=y,f(_)&&b({inst:_})},[g,w,y]),o(function(){return f(_)&&b({inst:_}),g(function(){f(_)&&b({inst:_})})},[g]),u(w),w}function f(g){var y=g.getSnapshot;g=g.value;try{var w=y();return!r(g,w)}catch{return!0}}function p(g,y){return y()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:c;return Dd.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,Dd}var sx;function IR(){return sx||(sx=1,qd.exports=AR()),qd.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 ix;function MR(){if(ix)return $d;ix=1;var e=Ta(),t=IR();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=t.useSyncExternalStore,a=e.useRef,u=e.useEffect,c=e.useMemo,f=e.useDebugValue;return $d.useSyncExternalStoreWithSelector=function(p,d,g,y,w){var k=a(null);if(k.current===null){var _={hasValue:!1,value:null};k.current=_}else _=k.current;k=c(function(){function S(I){if(!E){if(E=!0,N=I,I=y(I),w!==void 0&&_.hasValue){var L=_.value;if(w(L,I))return j=L}return j=I}if(L=j,i(N,I))return L;var P=y(I);return w!==void 0&&w(L,P)?(N=I,L):(N=I,j=P)}var E=!1,N,j,A=g===void 0?null:g;return[function(){return S(d())},A===null?void 0:function(){return S(A())}]},[d,g,y,w]);var b=o(p,k[0],k[1]);return u(function(){_.hasValue=!0,_.value=b},[b]),f(b),b},$d}var ox;function OR(){return ox||(ox=1,Ld.exports=MR()),Ld.exports}var PR=OR();const LR=Yv(PR),$R={},ax=e=>{let t;const r=new Set,i=(d,g)=>{const y=typeof d=="function"?d(t):d;if(!Object.is(y,t)){const w=t;t=g??(typeof y!="object"||y===null)?y:Object.assign({},t,y),r.forEach(k=>k(t,w))}},o=()=>t,f={setState:i,getState:o,getInitialState:()=>p,subscribe:d=>(r.add(d),()=>r.delete(d)),destroy:()=>{($R?"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=t=e(i,o,f);return f},qR=e=>e?ax(e):ax,{useDebugValue:DR}=ue,{useSyncExternalStoreWithSelector:FR}=LR,zR=e=>e;function mN(e,t=zR,r){const i=FR(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return DR(i),i}const lx=(e,t)=>{const r=qR(e),i=(o,a=t)=>mN(r,o,a);return Object.assign(i,r),i},BR=(e,t)=>e?lx(e,t):lx;function It(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[i,o]of e)if(!Object.is(o,t.get(i)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const i of e)if(!t.has(i))return!1;return!0}const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(const i of r)if(!Object.prototype.hasOwnProperty.call(t,i)||!Object.is(e[i],t[i]))return!1;return!0}var UR={value:()=>{}};function Pu(){for(var e=0,t=arguments.length,r={},i;e<t;++e){if(!(i=arguments[e]+"")||i in r||/[\s.]/.test(i))throw new Error("illegal type: "+i);r[i]=[]}return new pu(r)}function pu(e){this._=e}function HR(e,t){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&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}pu.prototype=Pu.prototype={constructor:pu,on:function(e,t){var r=this._,i=HR(e+"",r),o,a=-1,u=i.length;if(arguments.length<2){for(;++a<u;)if((o=(e=i[a]).type)&&(o=WR(r[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<u;)if(o=(e=i[a]).type)r[o]=ux(r[o],e.name,t);else if(t==null)for(o in r)r[o]=ux(r[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new pu(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var r=new Array(o),i=0,o,a;i<o;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],i=0,o=a.length;i<o;++i)a[i].value.apply(t,r)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],o=0,a=i.length;o<a;++o)i[o].value.apply(t,r)}};function WR(e,t){for(var r=0,i=e.length,o;r<i;++r)if((o=e[r]).name===t)return o.value}function ux(e,t,r){for(var i=0,o=e.length;i<o;++i)if(e[i].name===t){e[i]=UR,e=e.slice(0,i).concat(e.slice(i+1));break}return r!=null&&e.push({name:t,value:r}),e}var _v="http://www.w3.org/1999/xhtml";const cx={svg:"http://www.w3.org/2000/svg",xhtml:_v,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Lu(e){var t=e+="",r=t.indexOf(":");return r>=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),cx.hasOwnProperty(t)?{space:cx[t],local:e}:e}function VR(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===_v&&t.documentElement.namespaceURI===_v?t.createElement(e):t.createElementNS(r,e)}}function GR(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function gN(e){var t=Lu(e);return(t.local?GR:VR)(t)}function YR(){}function Kv(e){return e==null?YR:function(){return this.querySelector(e)}}function KR(e){typeof e!="function"&&(e=Kv(e));for(var t=this._groups,r=t.length,i=new Array(r),o=0;o<r;++o)for(var a=t[o],u=a.length,c=i[o]=new Array(u),f,p,d=0;d<u;++d)(f=a[d])&&(p=e.call(f,f.__data__,d,a))&&("__data__"in f&&(p.__data__=f.__data__),c[d]=p);return new bn(i,this._parents)}function XR(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function QR(){return[]}function vN(e){return e==null?QR:function(){return this.querySelectorAll(e)}}function ZR(e){return function(){return XR(e.apply(this,arguments))}}function JR(e){typeof e=="function"?e=ZR(e):e=vN(e);for(var t=this._groups,r=t.length,i=[],o=[],a=0;a<r;++a)for(var u=t[a],c=u.length,f,p=0;p<c;++p)(f=u[p])&&(i.push(e.call(f,f.__data__,p,u)),o.push(f));return new bn(i,o)}function yN(e){return function(){return this.matches(e)}}function wN(e){return function(t){return t.matches(e)}}var eA=Array.prototype.find;function tA(e){return function(){return eA.call(this.children,e)}}function nA(){return this.firstElementChild}function rA(e){return this.select(e==null?nA:tA(typeof e=="function"?e:wN(e)))}var sA=Array.prototype.filter;function iA(){return Array.from(this.children)}function oA(e){return function(){return sA.call(this.children,e)}}function aA(e){return this.selectAll(e==null?iA:oA(typeof e=="function"?e:wN(e)))}function lA(e){typeof e!="function"&&(e=yN(e));for(var t=this._groups,r=t.length,i=new Array(r),o=0;o<r;++o)for(var a=t[o],u=a.length,c=i[o]=[],f,p=0;p<u;++p)(f=a[p])&&e.call(f,f.__data__,p,a)&&c.push(f);return new bn(i,this._parents)}function xN(e){return new Array(e.length)}function uA(){return new bn(this._enter||this._groups.map(xN),this._parents)}function xu(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}xu.prototype={constructor:xu,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function cA(e){return function(){return e}}function dA(e,t,r,i,o,a){for(var u=0,c,f=t.length,p=a.length;u<p;++u)(c=t[u])?(c.__data__=a[u],i[u]=c):r[u]=new xu(e,a[u]);for(;u<f;++u)(c=t[u])&&(o[u]=c)}function fA(e,t,r,i,o,a,u){var c,f,p=new Map,d=t.length,g=a.length,y=new Array(d),w;for(c=0;c<d;++c)(f=t[c])&&(y[c]=w=u.call(f,f.__data__,c,t)+"",p.has(w)?o[c]=f:p.set(w,f));for(c=0;c<g;++c)w=u.call(e,a[c],c,a)+"",(f=p.get(w))?(i[c]=f,f.__data__=a[c],p.delete(w)):r[c]=new xu(e,a[c]);for(c=0;c<d;++c)(f=t[c])&&p.get(y[c])===f&&(o[c]=f)}function hA(e){return e.__data__}function pA(e,t){if(!arguments.length)return Array.from(this,hA);var r=t?fA:dA,i=this._parents,o=this._groups;typeof e!="function"&&(e=cA(e));for(var a=o.length,u=new Array(a),c=new Array(a),f=new Array(a),p=0;p<a;++p){var d=i[p],g=o[p],y=g.length,w=mA(e.call(d,d&&d.__data__,p,i)),k=w.length,_=c[p]=new Array(k),b=u[p]=new Array(k),S=f[p]=new Array(y);r(d,g,_,b,S,w,t);for(var E=0,N=0,j,A;E<k;++E)if(j=_[E]){for(E>=N&&(N=E+1);!(A=b[N])&&++N<k;);j._next=A||null}}return u=new bn(u,i),u._enter=c,u._exit=f,u}function mA(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function gA(){return new bn(this._exit||this._groups.map(xN),this._parents)}function vA(e,t,r){var i=this.enter(),o=this,a=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),r==null?a.remove():r(a),i&&o?i.merge(o).order():o}function yA(e){for(var t=e.selection?e.selection():e,r=this._groups,i=t._groups,o=r.length,a=i.length,u=Math.min(o,a),c=new Array(o),f=0;f<u;++f)for(var p=r[f],d=i[f],g=p.length,y=c[f]=new Array(g),w,k=0;k<g;++k)(w=p[k]||d[k])&&(y[k]=w);for(;f<o;++f)c[f]=r[f];return new bn(c,this._parents)}function wA(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var i=e[t],o=i.length-1,a=i[o],u;--o>=0;)(u=i[o])&&(a&&u.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(u,a),a=u);return this}function xA(e){e||(e=_A);function t(g,y){return g&&y?e(g.__data__,y.__data__):!g-!y}for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a){for(var u=r[a],c=u.length,f=o[a]=new Array(c),p,d=0;d<c;++d)(p=u[d])&&(f[d]=p);f.sort(t)}return new bn(o,this._parents).order()}function _A(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function bA(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function SA(){return Array.from(this)}function kA(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var i=e[t],o=0,a=i.length;o<a;++o){var u=i[o];if(u)return u}return null}function EA(){let e=0;for(const t of this)++e;return e}function NA(){return!this.node()}function CA(e){for(var t=this._groups,r=0,i=t.length;r<i;++r)for(var o=t[r],a=0,u=o.length,c;a<u;++a)(c=o[a])&&e.call(c,c.__data__,a,o);return this}function jA(e){return function(){this.removeAttribute(e)}}function TA(e){return function(){this.removeAttributeNS(e.space,e.local)}}function RA(e,t){return function(){this.setAttribute(e,t)}}function AA(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function IA(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function MA(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function OA(e,t){var r=Lu(e);if(arguments.length<2){var i=this.node();return r.local?i.getAttributeNS(r.space,r.local):i.getAttribute(r)}return this.each((t==null?r.local?TA:jA:typeof t=="function"?r.local?MA:IA:r.local?AA:RA)(r,t))}function _N(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function PA(e){return function(){this.style.removeProperty(e)}}function LA(e,t,r){return function(){this.style.setProperty(e,t,r)}}function $A(e,t,r){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,r)}}function qA(e,t,r){return arguments.length>1?this.each((t==null?PA:typeof t=="function"?$A:LA)(e,t,r??"")):oo(this.node(),e)}function oo(e,t){return e.style.getPropertyValue(t)||_N(e).getComputedStyle(e,null).getPropertyValue(t)}function DA(e){return function(){delete this[e]}}function FA(e,t){return function(){this[e]=t}}function zA(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function BA(e,t){return arguments.length>1?this.each((t==null?DA:typeof t=="function"?zA:FA)(e,t)):this.node()[e]}function bN(e){return e.trim().split(/^|\s+/)}function Xv(e){return e.classList||new SN(e)}function SN(e){this._node=e,this._names=bN(e.getAttribute("class")||"")}SN.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function kN(e,t){for(var r=Xv(e),i=-1,o=t.length;++i<o;)r.add(t[i])}function EN(e,t){for(var r=Xv(e),i=-1,o=t.length;++i<o;)r.remove(t[i])}function UA(e){return function(){kN(this,e)}}function HA(e){return function(){EN(this,e)}}function WA(e,t){return function(){(t.apply(this,arguments)?kN:EN)(this,e)}}function VA(e,t){var r=bN(e+"");if(arguments.length<2){for(var i=Xv(this.node()),o=-1,a=r.length;++o<a;)if(!i.contains(r[o]))return!1;return!0}return this.each((typeof t=="function"?WA:t?UA:HA)(r,t))}function GA(){this.textContent=""}function YA(e){return function(){this.textContent=e}}function KA(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function XA(e){return arguments.length?this.each(e==null?GA:(typeof e=="function"?KA:YA)(e)):this.node().textContent}function QA(){this.innerHTML=""}function ZA(e){return function(){this.innerHTML=e}}function JA(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function e2(e){return arguments.length?this.each(e==null?QA:(typeof e=="function"?JA:ZA)(e)):this.node().innerHTML}function t2(){this.nextSibling&&this.parentNode.appendChild(this)}function n2(){return this.each(t2)}function r2(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function s2(){return this.each(r2)}function i2(e){var t=typeof e=="function"?e:gN(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function o2(){return null}function a2(e,t){var r=typeof e=="function"?e:gN(e),i=t==null?o2:typeof t=="function"?t:Kv(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),i.apply(this,arguments)||null)})}function l2(){var e=this.parentNode;e&&e.removeChild(this)}function u2(){return this.each(l2)}function c2(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function d2(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function f2(e){return this.select(e?d2:c2)}function h2(e){return arguments.length?this.property("__data__",e):this.node().__data__}function p2(e){return function(t){e.call(this,t,this.__data__)}}function m2(e){return e.trim().split(/^|\s+/).map(function(t){var r="",i=t.indexOf(".");return i>=0&&(r=t.slice(i+1),t=t.slice(0,i)),{type:t,name:r}})}function g2(e){return function(){var t=this.__on;if(t){for(var r=0,i=-1,o=t.length,a;r<o;++r)a=t[r],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++i]=a;++i?t.length=i:delete this.__on}}}function v2(e,t,r){return function(){var i=this.__on,o,a=p2(t);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=a,o.options=r),o.value=t;return}}this.addEventListener(e.type,a,r),o={type:e.type,name:e.name,value:t,listener:a,options:r},i?i.push(o):this.__on=[o]}}function y2(e,t,r){var i=m2(e+""),o,a=i.length,u;if(arguments.length<2){var c=this.node().__on;if(c){for(var f=0,p=c.length,d;f<p;++f)for(o=0,d=c[f];o<a;++o)if((u=i[o]).type===d.type&&u.name===d.name)return d.value}return}for(c=t?v2:g2,o=0;o<a;++o)this.each(c(i[o],t,r));return this}function NN(e,t,r){var i=_N(e),o=i.CustomEvent;typeof o=="function"?o=new o(t,r):(o=i.document.createEvent("Event"),r?(o.initEvent(t,r.bubbles,r.cancelable),o.detail=r.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function w2(e,t){return function(){return NN(this,e,t)}}function x2(e,t){return function(){return NN(this,e,t.apply(this,arguments))}}function _2(e,t){return this.each((typeof t=="function"?x2:w2)(e,t))}function*b2(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var i=e[t],o=0,a=i.length,u;o<a;++o)(u=i[o])&&(yield u)}var CN=[null];function bn(e,t){this._groups=e,this._parents=t}function Ra(){return new bn([[document.documentElement]],CN)}function S2(){return this}bn.prototype=Ra.prototype={constructor:bn,select:KR,selectAll:JR,selectChild:rA,selectChildren:aA,filter:lA,data:pA,enter:uA,exit:gA,join:vA,merge:yA,selection:S2,order:wA,sort:xA,call:bA,nodes:SA,node:kA,size:EA,empty:NA,each:CA,attr:OA,style:qA,property:BA,classed:VA,text:XA,html:e2,raise:n2,lower:s2,append:i2,insert:a2,remove:u2,clone:f2,datum:h2,on:y2,dispatch:_2,[Symbol.iterator]:b2};function $n(e){return typeof e=="string"?new bn([[document.querySelector(e)]],[document.documentElement]):new bn([[e]],CN)}function k2(e){let t;for(;t=e.sourceEvent;)e=t;return e}function er(e,t){if(e=k2(e),t===void 0&&(t=e.currentTarget),t){var r=t.ownerSVGElement||t;if(r.createSVGPoint){var i=r.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const E2={passive:!1},ya={capture:!0,passive:!1};function Fd(e){e.stopImmediatePropagation()}function no(e){e.preventDefault(),e.stopImmediatePropagation()}function jN(e){var t=e.document.documentElement,r=$n(e).on("dragstart.drag",no,ya);"onselectstart"in t?r.on("selectstart.drag",no,ya):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function TN(e,t){var r=e.document.documentElement,i=$n(e).on("dragstart.drag",null);t&&(i.on("click.drag",no,ya),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 Ql=e=>()=>e;function bv(e,{sourceEvent:t,subject:r,target:i,identifier:o,active:a,x:u,y:c,dx:f,dy:p,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,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:a,enumerable:!0,configurable:!0},x:{value:u,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:d}})}bv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function N2(e){return!e.ctrlKey&&!e.button}function C2(){return this.parentNode}function j2(e,t){return t??{x:e.x,y:e.y}}function T2(){return navigator.maxTouchPoints||"ontouchstart"in this}function R2(){var e=N2,t=C2,r=j2,i=T2,o={},a=Pu("start","drag","end"),u=0,c,f,p,d,g=0;function y(j){j.on("mousedown.drag",w).filter(i).on("touchstart.drag",b).on("touchmove.drag",S,E2).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(j,A){if(!(d||!e.call(this,j,A))){var I=N(this,t.call(this,j,A),j,A,"mouse");I&&($n(j.view).on("mousemove.drag",k,ya).on("mouseup.drag",_,ya),jN(j.view),Fd(j),p=!1,c=j.clientX,f=j.clientY,I("start",j))}}function k(j){if(no(j),!p){var A=j.clientX-c,I=j.clientY-f;p=A*A+I*I>g}o.mouse("drag",j)}function _(j){$n(j.view).on("mousemove.drag mouseup.drag",null),TN(j.view,p),no(j),o.mouse("end",j)}function b(j,A){if(e.call(this,j,A)){var I=j.changedTouches,L=t.call(this,j,A),P=I.length,D,M;for(D=0;D<P;++D)(M=N(this,L,j,A,I[D].identifier,I[D]))&&(Fd(j),M("start",j,I[D]))}}function S(j){var A=j.changedTouches,I=A.length,L,P;for(L=0;L<I;++L)(P=o[A[L].identifier])&&(no(j),P("drag",j,A[L]))}function E(j){var A=j.changedTouches,I=A.length,L,P;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),L=0;L<I;++L)(P=o[A[L].identifier])&&(Fd(j),P("end",j,A[L]))}function N(j,A,I,L,P,D){var M=a.copy(),q=er(D||I,A),W,K,C;if((C=r.call(j,new bv("beforestart",{sourceEvent:I,target:y,identifier:P,active:u,x:q[0],y:q[1],dx:0,dy:0,dispatch:M}),L))!=null)return W=C.x-q[0]||0,K=C.y-q[1]||0,function z(F,te,Z){var U=q,Q;switch(F){case"start":o[P]=z,Q=u++;break;case"end":delete o[P],--u;case"drag":q=er(Z||te,A),Q=u;break}M.call(F,j,new bv(F,{sourceEvent:te,subject:C,target:y,identifier:P,active:Q,x:q[0]+W,y:q[1]+K,dx:q[0]-U[0],dy:q[1]-U[1],dispatch:M}),L)}}return y.filter=function(j){return arguments.length?(e=typeof j=="function"?j:Ql(!!j),y):e},y.container=function(j){return arguments.length?(t=typeof j=="function"?j:Ql(j),y):t},y.subject=function(j){return arguments.length?(r=typeof j=="function"?j:Ql(j),y):r},y.touchable=function(j){return arguments.length?(i=typeof j=="function"?j:Ql(!!j),y):i},y.on=function(){var j=a.on.apply(a,arguments);return j===a?y:j},y.clickDistance=function(j){return arguments.length?(g=(j=+j)*j,y):Math.sqrt(g)},y}function Qv(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function RN(e,t){var r=Object.create(e.prototype);for(var i in t)r[i]=t[i];return r}function Aa(){}var wa=.7,_u=1/wa,ro="\\s*([+-]?\\d+)\\s*",xa="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",yr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",A2=/^#([0-9a-f]{3,8})$/,I2=new RegExp(`^rgb\\(${ro},${ro},${ro}\\)$`),M2=new RegExp(`^rgb\\(${yr},${yr},${yr}\\)$`),O2=new RegExp(`^rgba\\(${ro},${ro},${ro},${xa}\\)$`),P2=new RegExp(`^rgba\\(${yr},${yr},${yr},${xa}\\)$`),L2=new RegExp(`^hsl\\(${xa},${yr},${yr}\\)$`),$2=new RegExp(`^hsla\\(${xa},${yr},${yr},${xa}\\)$`),dx={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};Qv(Aa,_a,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:fx,formatHex:fx,formatHex8:q2,formatHsl:D2,formatRgb:hx,toString:hx});function fx(){return this.rgb().formatHex()}function q2(){return this.rgb().formatHex8()}function D2(){return AN(this).formatHsl()}function hx(){return this.rgb().formatRgb()}function _a(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=A2.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?px(t):r===3?new fn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?Zl(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Zl(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=I2.exec(e))?new fn(t[1],t[2],t[3],1):(t=M2.exec(e))?new fn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=O2.exec(e))?Zl(t[1],t[2],t[3],t[4]):(t=P2.exec(e))?Zl(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=L2.exec(e))?vx(t[1],t[2]/100,t[3]/100,1):(t=$2.exec(e))?vx(t[1],t[2]/100,t[3]/100,t[4]):dx.hasOwnProperty(e)?px(dx[e]):e==="transparent"?new fn(NaN,NaN,NaN,0):null}function px(e){return new fn(e>>16&255,e>>8&255,e&255,1)}function Zl(e,t,r,i){return i<=0&&(e=t=r=NaN),new fn(e,t,r,i)}function F2(e){return e instanceof Aa||(e=_a(e)),e?(e=e.rgb(),new fn(e.r,e.g,e.b,e.opacity)):new fn}function Sv(e,t,r,i){return arguments.length===1?F2(e):new fn(e,t,r,i??1)}function fn(e,t,r,i){this.r=+e,this.g=+t,this.b=+r,this.opacity=+i}Qv(fn,Sv,RN(Aa,{brighter(e){return e=e==null?_u:Math.pow(_u,e),new fn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?wa:Math.pow(wa,e),new fn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new fn(Zs(this.r),Zs(this.g),Zs(this.b),bu(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:mx,formatHex:mx,formatHex8:z2,formatRgb:gx,toString:gx}));function mx(){return`#${Xs(this.r)}${Xs(this.g)}${Xs(this.b)}`}function z2(){return`#${Xs(this.r)}${Xs(this.g)}${Xs(this.b)}${Xs((isNaN(this.opacity)?1:this.opacity)*255)}`}function gx(){const e=bu(this.opacity);return`${e===1?"rgb(":"rgba("}${Zs(this.r)}, ${Zs(this.g)}, ${Zs(this.b)}${e===1?")":`, ${e})`}`}function bu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Zs(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Xs(e){return e=Zs(e),(e<16?"0":"")+e.toString(16)}function vx(e,t,r,i){return i<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new tr(e,t,r,i)}function AN(e){if(e instanceof tr)return new tr(e.h,e.s,e.l,e.opacity);if(e instanceof Aa||(e=_a(e)),!e)return new tr;if(e instanceof tr)return e;e=e.rgb();var t=e.r/255,r=e.g/255,i=e.b/255,o=Math.min(t,r,i),a=Math.max(t,r,i),u=NaN,c=a-o,f=(a+o)/2;return c?(t===a?u=(r-i)/c+(r<i)*6:r===a?u=(i-t)/c+2:u=(t-r)/c+4,c/=f<.5?a+o:2-a-o,u*=60):c=f>0&&f<1?0:u,new tr(u,c,f,e.opacity)}function B2(e,t,r,i){return arguments.length===1?AN(e):new tr(e,t,r,i??1)}function tr(e,t,r,i){this.h=+e,this.s=+t,this.l=+r,this.opacity=+i}Qv(tr,B2,RN(Aa,{brighter(e){return e=e==null?_u:Math.pow(_u,e),new tr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?wa:Math.pow(wa,e),new tr(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,i=r+(r<.5?r:1-r)*t,o=2*r-i;return new fn(zd(e>=240?e-240:e+120,o,i),zd(e,o,i),zd(e<120?e+240:e-120,o,i),this.opacity)},clamp(){return new tr(yx(this.h),Jl(this.s),Jl(this.l),bu(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=bu(this.opacity);return`${e===1?"hsl(":"hsla("}${yx(this.h)}, ${Jl(this.s)*100}%, ${Jl(this.l)*100}%${e===1?")":`, ${e})`}`}}));function yx(e){return e=(e||0)%360,e<0?e+360:e}function Jl(e){return Math.max(0,Math.min(1,e||0))}function zd(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const IN=e=>()=>e;function U2(e,t){return function(r){return e+r*t}}function H2(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(i){return Math.pow(e+i*t,r)}}function W2(e){return(e=+e)==1?MN:function(t,r){return r-t?H2(t,r,e):IN(isNaN(t)?r:t)}}function MN(e,t){var r=t-e;return r?U2(e,r):IN(isNaN(e)?t:e)}const wx=(function e(t){var r=W2(t);function i(o,a){var u=r((o=Sv(o)).r,(a=Sv(a)).r),c=r(o.g,a.g),f=r(o.b,a.b),p=MN(o.opacity,a.opacity);return function(d){return o.r=u(d),o.g=c(d),o.b=f(d),o.opacity=p(d),o+""}}return i.gamma=e,i})(1);function ms(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}var kv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Bd=new RegExp(kv.source,"g");function V2(e){return function(){return e}}function G2(e){return function(t){return e(t)+""}}function Y2(e,t){var r=kv.lastIndex=Bd.lastIndex=0,i,o,a,u=-1,c=[],f=[];for(e=e+"",t=t+"";(i=kv.exec(e))&&(o=Bd.exec(t));)(a=o.index)>r&&(a=t.slice(r,a),c[u]?c[u]+=a:c[++u]=a),(i=i[0])===(o=o[0])?c[u]?c[u]+=o:c[++u]=o:(c[++u]=null,f.push({i:u,x:ms(i,o)})),r=Bd.lastIndex;return r<t.length&&(a=t.slice(r),c[u]?c[u]+=a:c[++u]=a),c.length<2?f[0]?G2(f[0].x):V2(t):(t=f.length,function(p){for(var d=0,g;d<t;++d)c[(g=f[d]).i]=g.x(p);return c.join("")})}var xx=180/Math.PI,Ev={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ON(e,t,r,i,o,a){var u,c,f;return(u=Math.sqrt(e*e+t*t))&&(e/=u,t/=u),(f=e*r+t*i)&&(r-=e*f,i-=t*f),(c=Math.sqrt(r*r+i*i))&&(r/=c,i/=c,f/=c),e*i<t*r&&(e=-e,t=-t,f=-f,u=-u),{translateX:o,translateY:a,rotate:Math.atan2(t,e)*xx,skewX:Math.atan(f)*xx,scaleX:u,scaleY:c}}var eu;function K2(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Ev:ON(t.a,t.b,t.c,t.d,t.e,t.f)}function X2(e){return e==null||(eu||(eu=document.createElementNS("http://www.w3.org/2000/svg","g")),eu.setAttribute("transform",e),!(e=eu.transform.baseVal.consolidate()))?Ev:(e=e.matrix,ON(e.a,e.b,e.c,e.d,e.e,e.f))}function PN(e,t,r,i){function o(p){return p.length?p.pop()+" ":""}function a(p,d,g,y,w,k){if(p!==g||d!==y){var _=w.push("translate(",null,t,null,r);k.push({i:_-4,x:ms(p,g)},{i:_-2,x:ms(d,y)})}else(g||y)&&w.push("translate("+g+t+y+r)}function u(p,d,g,y){p!==d?(p-d>180?d+=360:d-p>180&&(p+=360),y.push({i:g.push(o(g)+"rotate(",null,i)-2,x:ms(p,d)})):d&&g.push(o(g)+"rotate("+d+i)}function c(p,d,g,y){p!==d?y.push({i:g.push(o(g)+"skewX(",null,i)-2,x:ms(p,d)}):d&&g.push(o(g)+"skewX("+d+i)}function f(p,d,g,y,w,k){if(p!==g||d!==y){var _=w.push(o(w)+"scale(",null,",",null,")");k.push({i:_-4,x:ms(p,g)},{i:_-2,x:ms(d,y)})}else(g!==1||y!==1)&&w.push(o(w)+"scale("+g+","+y+")")}return function(p,d){var g=[],y=[];return p=e(p),d=e(d),a(p.translateX,p.translateY,d.translateX,d.translateY,g,y),u(p.rotate,d.rotate,g,y),c(p.skewX,d.skewX,g,y),f(p.scaleX,p.scaleY,d.scaleX,d.scaleY,g,y),p=d=null,function(w){for(var k=-1,_=y.length,b;++k<_;)g[(b=y[k]).i]=b.x(w);return g.join("")}}}var Q2=PN(K2,"px, ","px)","deg)"),Z2=PN(X2,", ",")",")"),J2=1e-12;function _x(e){return((e=Math.exp(e))+1/e)/2}function eI(e){return((e=Math.exp(e))-1/e)/2}function tI(e){return((e=Math.exp(2*e))-1)/(e+1)}const nI=(function e(t,r,i){function o(a,u){var c=a[0],f=a[1],p=a[2],d=u[0],g=u[1],y=u[2],w=d-c,k=g-f,_=w*w+k*k,b,S;if(_<J2)S=Math.log(y/p)/t,b=function(L){return[c+L*w,f+L*k,p*Math.exp(t*L*S)]};else{var E=Math.sqrt(_),N=(y*y-p*p+i*_)/(2*p*r*E),j=(y*y-p*p-i*_)/(2*y*r*E),A=Math.log(Math.sqrt(N*N+1)-N),I=Math.log(Math.sqrt(j*j+1)-j);S=(I-A)/t,b=function(L){var P=L*S,D=_x(A),M=p/(r*E)*(D*tI(t*P+A)-eI(A));return[c+M*w,f+M*k,p*D/_x(t*P+A)]}}return b.duration=S*1e3*t/Math.SQRT2,b}return o.rho=function(a){var u=Math.max(.001,+a),c=u*u,f=c*c;return e(u,c,f)},o})(Math.SQRT2,2,4);var ao=0,fa=0,sa=0,LN=1e3,Su,ha,ku=0,ei=0,$u=0,ba=typeof performance=="object"&&performance.now?performance:Date,$N=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Zv(){return ei||($N(rI),ei=ba.now()+$u)}function rI(){ei=0}function Eu(){this._call=this._time=this._next=null}Eu.prototype=qN.prototype={constructor:Eu,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?Zv():+r)+(t==null?0:+t),!this._next&&ha!==this&&(ha?ha._next=this:Su=this,ha=this),this._call=e,this._time=r,Nv()},stop:function(){this._call&&(this._call=null,this._time=1/0,Nv())}};function qN(e,t,r){var i=new Eu;return i.restart(e,t,r),i}function sI(){Zv(),++ao;for(var e=Su,t;e;)(t=ei-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ao}function bx(){ei=(ku=ba.now())+$u,ao=fa=0;try{sI()}finally{ao=0,oI(),ei=0}}function iI(){var e=ba.now(),t=e-ku;t>LN&&($u-=t,ku=e)}function oI(){for(var e,t=Su,r,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:Su=r);ha=e,Nv(i)}function Nv(e){if(!ao){fa&&(fa=clearTimeout(fa));var t=e-ei;t>24?(e<1/0&&(fa=setTimeout(bx,e-ba.now()-$u)),sa&&(sa=clearInterval(sa))):(sa||(ku=ba.now(),sa=setInterval(iI,LN)),ao=1,$N(bx))}}function Sx(e,t,r){var i=new Eu;return t=t==null?0:+t,i.restart(o=>{i.stop(),e(o+t)},t,r),i}var aI=Pu("start","end","cancel","interrupt"),lI=[],DN=0,kx=1,Cv=2,mu=3,Ex=4,jv=5,gu=6;function qu(e,t,r,i,o,a){var u=e.__transition;if(!u)e.__transition={};else if(r in u)return;uI(e,r,{name:t,index:i,group:o,on:aI,tween:lI,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:DN})}function Jv(e,t){var r=sr(e,t);if(r.state>DN)throw new Error("too late; already scheduled");return r}function wr(e,t){var r=sr(e,t);if(r.state>mu)throw new Error("too late; already running");return r}function sr(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function uI(e,t,r){var i=e.__transition,o;i[t]=r,r.timer=qN(a,0,r.time);function a(p){r.state=kx,r.timer.restart(u,r.delay,r.time),r.delay<=p&&u(p-r.delay)}function u(p){var d,g,y,w;if(r.state!==kx)return f();for(d in i)if(w=i[d],w.name===r.name){if(w.state===mu)return Sx(u);w.state===Ex?(w.state=gu,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete i[d]):+d<t&&(w.state=gu,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete i[d])}if(Sx(function(){r.state===mu&&(r.state=Ex,r.timer.restart(c,r.delay,r.time),c(p))}),r.state=Cv,r.on.call("start",e,e.__data__,r.index,r.group),r.state===Cv){for(r.state=mu,o=new Array(y=r.tween.length),d=0,g=-1;d<y;++d)(w=r.tween[d].value.call(e,e.__data__,r.index,r.group))&&(o[++g]=w);o.length=g+1}}function c(p){for(var d=p<r.duration?r.ease.call(null,p/r.duration):(r.timer.restart(f),r.state=jv,1),g=-1,y=o.length;++g<y;)o[g].call(e,d);r.state===jv&&(r.on.call("end",e,e.__data__,r.index,r.group),f())}function f(){r.state=gu,r.timer.stop(),delete i[t];for(var p in i)return;delete e.__transition}}function vu(e,t){var r=e.__transition,i,o,a=!0,u;if(r){t=t==null?null:t+"";for(u in r){if((i=r[u]).name!==t){a=!1;continue}o=i.state>Cv&&i.state<jv,i.state=gu,i.timer.stop(),i.on.call(o?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete r[u]}a&&delete e.__transition}}function cI(e){return this.each(function(){vu(this,e)})}function dI(e,t){var r,i;return function(){var o=wr(this,e),a=o.tween;if(a!==r){i=r=a;for(var u=0,c=i.length;u<c;++u)if(i[u].name===t){i=i.slice(),i.splice(u,1);break}}o.tween=i}}function fI(e,t,r){var i,o;if(typeof r!="function")throw new Error;return function(){var a=wr(this,e),u=a.tween;if(u!==i){o=(i=u).slice();for(var c={name:t,value:r},f=0,p=o.length;f<p;++f)if(o[f].name===t){o[f]=c;break}f===p&&o.push(c)}a.tween=o}}function hI(e,t){var r=this._id;if(e+="",arguments.length<2){for(var i=sr(this.node(),r).tween,o=0,a=i.length,u;o<a;++o)if((u=i[o]).name===e)return u.value;return null}return this.each((t==null?dI:fI)(r,e,t))}function ey(e,t,r){var i=e._id;return e.each(function(){var o=wr(this,i);(o.value||(o.value={}))[t]=r.apply(this,arguments)}),function(o){return sr(o,i).value[t]}}function FN(e,t){var r;return(typeof t=="number"?ms:t instanceof _a?wx:(r=_a(t))?(t=r,wx):Y2)(e,t)}function pI(e){return function(){this.removeAttribute(e)}}function mI(e){return function(){this.removeAttributeNS(e.space,e.local)}}function gI(e,t,r){var i,o=r+"",a;return function(){var u=this.getAttribute(e);return u===o?null:u===i?a:a=t(i=u,r)}}function vI(e,t,r){var i,o=r+"",a;return function(){var u=this.getAttributeNS(e.space,e.local);return u===o?null:u===i?a:a=t(i=u,r)}}function yI(e,t,r){var i,o,a;return function(){var u,c=r(this),f;return c==null?void this.removeAttribute(e):(u=this.getAttribute(e),f=c+"",u===f?null:u===i&&f===o?a:(o=f,a=t(i=u,c)))}}function wI(e,t,r){var i,o,a;return function(){var u,c=r(this),f;return c==null?void this.removeAttributeNS(e.space,e.local):(u=this.getAttributeNS(e.space,e.local),f=c+"",u===f?null:u===i&&f===o?a:(o=f,a=t(i=u,c)))}}function xI(e,t){var r=Lu(e),i=r==="transform"?Z2:FN;return this.attrTween(e,typeof t=="function"?(r.local?wI:yI)(r,i,ey(this,"attr."+e,t)):t==null?(r.local?mI:pI)(r):(r.local?vI:gI)(r,i,t))}function _I(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function bI(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function SI(e,t){var r,i;function o(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&bI(e,a)),r}return o._value=t,o}function kI(e,t){var r,i;function o(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&_I(e,a)),r}return o._value=t,o}function EI(e,t){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;var i=Lu(e);return this.tween(r,(i.local?SI:kI)(i,t))}function NI(e,t){return function(){Jv(this,e).delay=+t.apply(this,arguments)}}function CI(e,t){return t=+t,function(){Jv(this,e).delay=t}}function jI(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?NI:CI)(t,e)):sr(this.node(),t).delay}function TI(e,t){return function(){wr(this,e).duration=+t.apply(this,arguments)}}function RI(e,t){return t=+t,function(){wr(this,e).duration=t}}function AI(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?TI:RI)(t,e)):sr(this.node(),t).duration}function II(e,t){if(typeof t!="function")throw new Error;return function(){wr(this,e).ease=t}}function MI(e){var t=this._id;return arguments.length?this.each(II(t,e)):sr(this.node(),t).ease}function OI(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;wr(this,e).ease=r}}function PI(e){if(typeof e!="function")throw new Error;return this.each(OI(this._id,e))}function LI(e){typeof e!="function"&&(e=yN(e));for(var t=this._groups,r=t.length,i=new Array(r),o=0;o<r;++o)for(var a=t[o],u=a.length,c=i[o]=[],f,p=0;p<u;++p)(f=a[p])&&e.call(f,f.__data__,p,a)&&c.push(f);return new zr(i,this._parents,this._name,this._id)}function $I(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,r=e._groups,i=t.length,o=r.length,a=Math.min(i,o),u=new Array(i),c=0;c<a;++c)for(var f=t[c],p=r[c],d=f.length,g=u[c]=new Array(d),y,w=0;w<d;++w)(y=f[w]||p[w])&&(g[w]=y);for(;c<i;++c)u[c]=t[c];return new zr(u,this._parents,this._name,this._id)}function qI(e){return(e+"").trim().split(/^|\s+/).every(function(t){var r=t.indexOf(".");return r>=0&&(t=t.slice(0,r)),!t||t==="start"})}function DI(e,t,r){var i,o,a=qI(t)?Jv:wr;return function(){var u=a(this,e),c=u.on;c!==i&&(o=(i=c).copy()).on(t,r),u.on=o}}function FI(e,t){var r=this._id;return arguments.length<2?sr(this.node(),r).on.on(e):this.each(DI(r,e,t))}function zI(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function BI(){return this.on("end.remove",zI(this._id))}function UI(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Kv(e));for(var i=this._groups,o=i.length,a=new Array(o),u=0;u<o;++u)for(var c=i[u],f=c.length,p=a[u]=new Array(f),d,g,y=0;y<f;++y)(d=c[y])&&(g=e.call(d,d.__data__,y,c))&&("__data__"in d&&(g.__data__=d.__data__),p[y]=g,qu(p[y],t,r,y,p,sr(d,r)));return new zr(a,this._parents,t,r)}function HI(e){var t=this._name,r=this._id;typeof e!="function"&&(e=vN(e));for(var i=this._groups,o=i.length,a=[],u=[],c=0;c<o;++c)for(var f=i[c],p=f.length,d,g=0;g<p;++g)if(d=f[g]){for(var y=e.call(d,d.__data__,g,f),w,k=sr(d,r),_=0,b=y.length;_<b;++_)(w=y[_])&&qu(w,t,r,_,y,k);a.push(y),u.push(d)}return new zr(a,u,t,r)}var WI=Ra.prototype.constructor;function VI(){return new WI(this._groups,this._parents)}function GI(e,t){var r,i,o;return function(){var a=oo(this,e),u=(this.style.removeProperty(e),oo(this,e));return a===u?null:a===r&&u===i?o:o=t(r=a,i=u)}}function zN(e){return function(){this.style.removeProperty(e)}}function YI(e,t,r){var i,o=r+"",a;return function(){var u=oo(this,e);return u===o?null:u===i?a:a=t(i=u,r)}}function KI(e,t,r){var i,o,a;return function(){var u=oo(this,e),c=r(this),f=c+"";return c==null&&(f=c=(this.style.removeProperty(e),oo(this,e))),u===f?null:u===i&&f===o?a:(o=f,a=t(i=u,c))}}function XI(e,t){var r,i,o,a="style."+t,u="end."+a,c;return function(){var f=wr(this,e),p=f.on,d=f.value[a]==null?c||(c=zN(t)):void 0;(p!==r||o!==d)&&(i=(r=p).copy()).on(u,o=d),f.on=i}}function QI(e,t,r){var i=(e+="")=="transform"?Q2:FN;return t==null?this.styleTween(e,GI(e,i)).on("end.style."+e,zN(e)):typeof t=="function"?this.styleTween(e,KI(e,i,ey(this,"style."+e,t))).each(XI(this._id,e)):this.styleTween(e,YI(e,i,t),r).on("end.style."+e,null)}function ZI(e,t,r){return function(i){this.style.setProperty(e,t.call(this,i),r)}}function JI(e,t,r){var i,o;function a(){var u=t.apply(this,arguments);return u!==o&&(i=(o=u)&&ZI(e,u,r)),i}return a._value=t,a}function eM(e,t,r){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,JI(e,t,r??""))}function tM(e){return function(){this.textContent=e}}function nM(e){return function(){var t=e(this);this.textContent=t??""}}function rM(e){return this.tween("text",typeof e=="function"?nM(ey(this,"text",e)):tM(e==null?"":e+""))}function sM(e){return function(t){this.textContent=e.call(this,t)}}function iM(e){var t,r;function i(){var o=e.apply(this,arguments);return o!==r&&(t=(r=o)&&sM(o)),t}return i._value=e,i}function oM(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,iM(e))}function aM(){for(var e=this._name,t=this._id,r=BN(),i=this._groups,o=i.length,a=0;a<o;++a)for(var u=i[a],c=u.length,f,p=0;p<c;++p)if(f=u[p]){var d=sr(f,t);qu(f,e,r,p,u,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new zr(i,this._parents,e,r)}function lM(){var e,t,r=this,i=r._id,o=r.size();return new Promise(function(a,u){var c={value:u},f={value:function(){--o===0&&a()}};r.each(function(){var p=wr(this,i),d=p.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(c),t._.interrupt.push(c),t._.end.push(f)),p.on=t}),o===0&&a()})}var uM=0;function zr(e,t,r,i){this._groups=e,this._parents=t,this._name=r,this._id=i}function BN(){return++uM}var qr=Ra.prototype;zr.prototype={constructor:zr,select:UI,selectAll:HI,selectChild:qr.selectChild,selectChildren:qr.selectChildren,filter:LI,merge:$I,selection:VI,transition:aM,call:qr.call,nodes:qr.nodes,node:qr.node,size:qr.size,empty:qr.empty,each:qr.each,on:FI,attr:xI,attrTween:EI,style:QI,styleTween:eM,text:rM,textTween:oM,remove:BI,tween:hI,delay:jI,duration:AI,ease:MI,easeVarying:PI,end:lM,[Symbol.iterator]:qr[Symbol.iterator]};function cM(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var dM={time:null,delay:0,duration:250,ease:cM};function fM(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return r}function hM(e){var t,r;e instanceof zr?(t=e._id,e=e._name):(t=BN(),(r=dM).time=Zv(),e=e==null?null:e+"");for(var i=this._groups,o=i.length,a=0;a<o;++a)for(var u=i[a],c=u.length,f,p=0;p<c;++p)(f=u[p])&&qu(f,e,t,p,u,r||fM(f,t));return new zr(i,this._parents,e,t)}Ra.prototype.interrupt=cI;Ra.prototype.transition=hM;const tu=e=>()=>e;function pM(e,{sourceEvent:t,target:r,transform:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function Dr(e,t,r){this.k=e,this.x=t,this.y=r}Dr.prototype={constructor:Dr,scale:function(e){return e===1?this:new Dr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Dr(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Fr=new Dr(1,0,0);Dr.prototype;function Ud(e){e.stopImmediatePropagation()}function ia(e){e.preventDefault(),e.stopImmediatePropagation()}function mM(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function gM(){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 Nx(){return this.__zoom||Fr}function vM(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function yM(){return navigator.maxTouchPoints||"ontouchstart"in this}function wM(e,t,r){var i=e.invertX(t[0][0])-r[0][0],o=e.invertX(t[1][0])-r[1][0],a=e.invertY(t[0][1])-r[0][1],u=e.invertY(t[1][1])-r[1][1];return e.translate(o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o),u>a?(a+u)/2:Math.min(0,a)||Math.max(0,u))}function UN(){var e=mM,t=gM,r=wM,i=vM,o=yM,a=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],c=250,f=nI,p=Pu("start","zoom","end"),d,g,y,w=500,k=150,_=0,b=10;function S(C){C.property("__zoom",Nx).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",M).filter(o).on("touchstart.zoom",q).on("touchmove.zoom",W).on("touchend.zoom touchcancel.zoom",K).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(C,z,F,te){var Z=C.selection?C.selection():C;Z.property("__zoom",Nx),C!==Z?A(C,z,F,te):Z.interrupt().each(function(){I(this,arguments).event(te).start().zoom(null,typeof z=="function"?z.apply(this,arguments):z).end()})},S.scaleBy=function(C,z,F,te){S.scaleTo(C,function(){var Z=this.__zoom.k,U=typeof z=="function"?z.apply(this,arguments):z;return Z*U},F,te)},S.scaleTo=function(C,z,F,te){S.transform(C,function(){var Z=t.apply(this,arguments),U=this.__zoom,Q=F==null?j(Z):typeof F=="function"?F.apply(this,arguments):F,O=U.invert(Q),V=typeof z=="function"?z.apply(this,arguments):z;return r(N(E(U,V),Q,O),Z,u)},F,te)},S.translateBy=function(C,z,F,te){S.transform(C,function(){return r(this.__zoom.translate(typeof z=="function"?z.apply(this,arguments):z,typeof F=="function"?F.apply(this,arguments):F),t.apply(this,arguments),u)},null,te)},S.translateTo=function(C,z,F,te,Z){S.transform(C,function(){var U=t.apply(this,arguments),Q=this.__zoom,O=te==null?j(U):typeof te=="function"?te.apply(this,arguments):te;return r(Fr.translate(O[0],O[1]).scale(Q.k).translate(typeof z=="function"?-z.apply(this,arguments):-z,typeof F=="function"?-F.apply(this,arguments):-F),U,u)},te,Z)};function E(C,z){return z=Math.max(a[0],Math.min(a[1],z)),z===C.k?C:new Dr(z,C.x,C.y)}function N(C,z,F){var te=z[0]-F[0]*C.k,Z=z[1]-F[1]*C.k;return te===C.x&&Z===C.y?C:new Dr(C.k,te,Z)}function j(C){return[(+C[0][0]+ +C[1][0])/2,(+C[0][1]+ +C[1][1])/2]}function A(C,z,F,te){C.on("start.zoom",function(){I(this,arguments).event(te).start()}).on("interrupt.zoom end.zoom",function(){I(this,arguments).event(te).end()}).tween("zoom",function(){var Z=this,U=arguments,Q=I(Z,U).event(te),O=t.apply(Z,U),V=F==null?j(O):typeof F=="function"?F.apply(Z,U):F,ce=Math.max(O[1][0]-O[0][0],O[1][1]-O[0][1]),$=Z.__zoom,G=typeof z=="function"?z.apply(Z,U):z,ee=f($.invert(V).concat(ce/$.k),G.invert(V).concat(ce/G.k));return function(ie){if(ie===1)ie=G;else{var de=ee(ie),pe=ce/de[2];ie=new Dr(pe,V[0]-de[0]*pe,V[1]-de[1]*pe)}Q.zoom(null,ie)}})}function I(C,z,F){return!F&&C.__zooming||new L(C,z)}function L(C,z){this.that=C,this.args=z,this.active=0,this.sourceEvent=null,this.extent=t.apply(C,z),this.taps=0}L.prototype={event:function(C){return C&&(this.sourceEvent=C),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(C,z){return this.mouse&&C!=="mouse"&&(this.mouse[1]=z.invert(this.mouse[0])),this.touch0&&C!=="touch"&&(this.touch0[1]=z.invert(this.touch0[0])),this.touch1&&C!=="touch"&&(this.touch1[1]=z.invert(this.touch1[0])),this.that.__zoom=z,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(C){var z=$n(this.that).datum();p.call(C,this.that,new pM(C,{sourceEvent:this.sourceEvent,target:S,transform:this.that.__zoom,dispatch:p}),z)}};function P(C,...z){if(!e.apply(this,arguments))return;var F=I(this,z).event(C),te=this.__zoom,Z=Math.max(a[0],Math.min(a[1],te.k*Math.pow(2,i.apply(this,arguments)))),U=er(C);if(F.wheel)(F.mouse[0][0]!==U[0]||F.mouse[0][1]!==U[1])&&(F.mouse[1]=te.invert(F.mouse[0]=U)),clearTimeout(F.wheel);else{if(te.k===Z)return;F.mouse=[U,te.invert(U)],vu(this),F.start()}ia(C),F.wheel=setTimeout(Q,k),F.zoom("mouse",r(N(E(te,Z),F.mouse[0],F.mouse[1]),F.extent,u));function Q(){F.wheel=null,F.end()}}function D(C,...z){if(y||!e.apply(this,arguments))return;var F=C.currentTarget,te=I(this,z,!0).event(C),Z=$n(C.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",ce,!0),U=er(C,F),Q=C.clientX,O=C.clientY;jN(C.view),Ud(C),te.mouse=[U,this.__zoom.invert(U)],vu(this),te.start();function V($){if(ia($),!te.moved){var G=$.clientX-Q,ee=$.clientY-O;te.moved=G*G+ee*ee>_}te.event($).zoom("mouse",r(N(te.that.__zoom,te.mouse[0]=er($,F),te.mouse[1]),te.extent,u))}function ce($){Z.on("mousemove.zoom mouseup.zoom",null),TN($.view,te.moved),ia($),te.event($).end()}}function M(C,...z){if(e.apply(this,arguments)){var F=this.__zoom,te=er(C.changedTouches?C.changedTouches[0]:C,this),Z=F.invert(te),U=F.k*(C.shiftKey?.5:2),Q=r(N(E(F,U),te,Z),t.apply(this,z),u);ia(C),c>0?$n(this).transition().duration(c).call(A,Q,te,C):$n(this).call(S.transform,Q,te,C)}}function q(C,...z){if(e.apply(this,arguments)){var F=C.touches,te=F.length,Z=I(this,z,C.changedTouches.length===te).event(C),U,Q,O,V;for(Ud(C),Q=0;Q<te;++Q)O=F[Q],V=er(O,this),V=[V,this.__zoom.invert(V),O.identifier],Z.touch0?!Z.touch1&&Z.touch0[2]!==V[2]&&(Z.touch1=V,Z.taps=0):(Z.touch0=V,U=!0,Z.taps=1+!!d);d&&(d=clearTimeout(d)),U&&(Z.taps<2&&(g=V[0],d=setTimeout(function(){d=null},w)),vu(this),Z.start())}}function W(C,...z){if(this.__zooming){var F=I(this,z).event(C),te=C.changedTouches,Z=te.length,U,Q,O,V;for(ia(C),U=0;U<Z;++U)Q=te[U],O=er(Q,this),F.touch0&&F.touch0[2]===Q.identifier?F.touch0[0]=O:F.touch1&&F.touch1[2]===Q.identifier&&(F.touch1[0]=O);if(Q=F.that.__zoom,F.touch1){var ce=F.touch0[0],$=F.touch0[1],G=F.touch1[0],ee=F.touch1[1],ie=(ie=G[0]-ce[0])*ie+(ie=G[1]-ce[1])*ie,de=(de=ee[0]-$[0])*de+(de=ee[1]-$[1])*de;Q=E(Q,Math.sqrt(ie/de)),O=[(ce[0]+G[0])/2,(ce[1]+G[1])/2],V=[($[0]+ee[0])/2,($[1]+ee[1])/2]}else if(F.touch0)O=F.touch0[0],V=F.touch0[1];else return;F.zoom("touch",r(N(Q,O,V),F.extent,u))}}function K(C,...z){if(this.__zooming){var F=I(this,z).event(C),te=C.changedTouches,Z=te.length,U,Q;for(Ud(C),y&&clearTimeout(y),y=setTimeout(function(){y=null},w),U=0;U<Z;++U)Q=te[U],F.touch0&&F.touch0[2]===Q.identifier?delete F.touch0:F.touch1&&F.touch1[2]===Q.identifier&&delete F.touch1;if(F.touch1&&!F.touch0&&(F.touch0=F.touch1,delete F.touch1),F.touch0)F.touch0[1]=this.__zoom.invert(F.touch0[0]);else if(F.end(),F.taps===2&&(Q=er(Q,this),Math.hypot(g[0]-Q[0],g[1]-Q[1])<b)){var O=$n(this).on("dblclick.zoom");O&&O.apply(this,arguments)}}}return S.wheelDelta=function(C){return arguments.length?(i=typeof C=="function"?C:tu(+C),S):i},S.filter=function(C){return arguments.length?(e=typeof C=="function"?C:tu(!!C),S):e},S.touchable=function(C){return arguments.length?(o=typeof C=="function"?C:tu(!!C),S):o},S.extent=function(C){return arguments.length?(t=typeof C=="function"?C:tu([[+C[0][0],+C[0][1]],[+C[1][0],+C[1][1]]]),S):t},S.scaleExtent=function(C){return arguments.length?(a[0]=+C[0],a[1]=+C[1],S):[a[0],a[1]]},S.translateExtent=function(C){return arguments.length?(u[0][0]=+C[0][0],u[1][0]=+C[1][0],u[0][1]=+C[0][1],u[1][1]=+C[1][1],S):[[u[0][0],u[0][1]],[u[1][0],u[1][1]]]},S.constrain=function(C){return arguments.length?(r=C,S):r},S.duration=function(C){return arguments.length?(c=+C,S):c},S.interpolate=function(C){return arguments.length?(f=C,S):f},S.on=function(){var C=p.on.apply(p,arguments);return C===p?S:C},S.clickDistance=function(C){return arguments.length?(_=(C=+C)*C,S):Math.sqrt(_)},S.tapDistance=function(C){return arguments.length?(b=+C,S):b},S}var xM=pN();const Du=R.createContext(null),_M=Du.Provider,Br={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,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.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.`},HN=Br.error001();function it(e,t){const r=R.useContext(Du);if(r===null)throw new Error(HN);return mN(r,e,t)}const Mt=()=>{const e=R.useContext(Du);if(e===null)throw new Error(HN);return R.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},bM=e=>e.userSelectionActive?"none":"all";function ty({position:e,children:t,className:r,style:i,...o}){const a=it(bM),u=`${e}`.split("-");return ue.createElement("div",{className:zt(["react-flow__panel",r,...u]),style:{...i,pointerEvents:a},...o},t)}function SM({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:ue.createElement(ty,{position:t,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 kM=({x:e,y:t,label:r,labelStyle:i={},labelShowBg:o=!0,labelBgStyle:a={},labelBgPadding:u=[2,4],labelBgBorderRadius:c=2,children:f,className:p,...d})=>{const g=R.useRef(null),[y,w]=R.useState({x:0,y:0,width:0,height:0}),k=zt(["react-flow__edge-textwrapper",p]);return R.useEffect(()=>{if(g.current){const _=g.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} ${t-y.height/2})`,className:k,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:a,rx:c,ry:c}),ue.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:g,style:i},r),f)};var EM=R.memo(kM);const ny=e=>({width:e.offsetWidth,height:e.offsetHeight}),lo=(e,t=0,r=1)=>Math.min(Math.max(e,t),r),ry=(e={x:0,y:0},t)=>({x:lo(e.x,t[0][0],t[1][0]),y:lo(e.y,t[0][1],t[1][1])}),Cx=(e,t,r)=>e<t?lo(Math.abs(e-t),1,50)/50:e>r?-lo(Math.abs(e-r),1,50)/50:0,WN=(e,t)=>{const r=Cx(e.x,35,t.width-35)*20,i=Cx(e.y,35,t.height-35)*20;return[r,i]},VN=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},GN=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Sa=({x:e,y:t,width:r,height:i})=>({x:e,y:t,x2:e+r,y2:t+i}),YN=({x:e,y:t,x2:r,y2:i})=>({x:e,y:t,width:r-e,height:i-t}),jx=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),NM=(e,t)=>YN(GN(Sa(e),Sa(t))),Tv=(e,t)=>{const r=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),i=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(r*i)},CM=e=>qn(e.width)&&qn(e.height)&&qn(e.x)&&qn(e.y),qn=e=>!isNaN(e)&&isFinite(e),St=Symbol.for("internals"),KN=["Enter"," ","Escape"],jM=(e,t)=>{},TM=e=>"nativeEvent"in e;function Rv(e){var o,a;const t=TM(e)?e.nativeEvent:e,r=((a=(o=t.composedPath)==null?void 0:o.call(t))==null?void 0:a[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 XN=e=>"clientX"in e,ys=(e,t)=>{var a,u;const r=XN(e),i=r?e.clientX:(a=e.touches)==null?void 0:a[0].clientX,o=r?e.clientY:(u=e.touches)==null?void 0:u[0].clientY;return{x:i-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},Nu=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Ia=({id:e,path:t,labelX:r,labelY:i,label:o,labelStyle:a,labelShowBg:u,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:p,style:d,markerEnd:g,markerStart:y,interactionWidth:w=20})=>ue.createElement(ue.Fragment,null,ue.createElement("path",{id:e,style:d,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:g,markerStart:y}),w&&ue.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:w,className:"react-flow__edge-interaction"}),o&&qn(r)&&qn(i)?ue.createElement(EM,{x:r,y:i,label:o,labelStyle:a,labelShowBg:u,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:p}):null);Ia.displayName="BaseEdge";function oa(e,t,r){return r===void 0?r:i=>{const o=t().edges.find(a=>a.id===e);o&&r(i,{...o})}}function QN({sourceX:e,sourceY:t,targetX:r,targetY:i}){const o=Math.abs(r-e)/2,a=r<e?r+o:r-o,u=Math.abs(i-t)/2,c=i<t?i+u:i-u;return[a,c,o,u]}function ZN({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:a,targetControlX:u,targetControlY:c}){const f=e*.125+o*.375+u*.375+r*.125,p=t*.125+a*.375+c*.375+i*.125,d=Math.abs(f-e),g=Math.abs(p-t);return[f,p,d,g]}var ti;(function(e){e.Strict="strict",e.Loose="loose"})(ti||(ti={}));var Qs;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Qs||(Qs={}));var ka;(function(e){e.Partial="partial",e.Full="full"})(ka||(ka={}));var vs;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(vs||(vs={}));var Cu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Cu||(Cu={}));var Re;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Re||(Re={}));function Tx({pos:e,x1:t,y1:r,x2:i,y2:o}){return e===Re.Left||e===Re.Right?[.5*(t+i),r]:[t,.5*(r+o)]}function JN({sourceX:e,sourceY:t,sourcePosition:r=Re.Bottom,targetX:i,targetY:o,targetPosition:a=Re.Top}){const[u,c]=Tx({pos:r,x1:e,y1:t,x2:i,y2:o}),[f,p]=Tx({pos:a,x1:i,y1:o,x2:e,y2:t}),[d,g,y,w]=ZN({sourceX:e,sourceY:t,targetX:i,targetY:o,sourceControlX:u,sourceControlY:c,targetControlX:f,targetControlY:p});return[`M${e},${t} C${u},${c} ${f},${p} ${i},${o}`,d,g,y,w]}const sy=R.memo(({sourceX:e,sourceY:t,targetX:r,targetY:i,sourcePosition:o=Re.Bottom,targetPosition:a=Re.Top,label:u,labelStyle:c,labelShowBg:f,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:k,interactionWidth:_})=>{const[b,S,E]=JN({sourceX:e,sourceY:t,sourcePosition:o,targetX:r,targetY:i,targetPosition:a});return ue.createElement(Ia,{path:b,labelX:S,labelY:E,label:u,labelStyle:c,labelShowBg:f,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:k,interactionWidth:_})});sy.displayName="SimpleBezierEdge";const Rx={[Re.Left]:{x:-1,y:0},[Re.Right]:{x:1,y:0},[Re.Top]:{x:0,y:-1},[Re.Bottom]:{x:0,y:1}},RM=({source:e,sourcePosition:t=Re.Bottom,target:r})=>t===Re.Left||t===Re.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},Ax=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function AM({source:e,sourcePosition:t=Re.Bottom,target:r,targetPosition:i=Re.Top,center:o,offset:a}){const u=Rx[t],c=Rx[i],f={x:e.x+u.x*a,y:e.y+u.y*a},p={x:r.x+c.x*a,y:r.y+c.y*a},d=RM({source:f,sourcePosition:t,target:p}),g=d.x!==0?"x":"y",y=d[g];let w=[],k,_;const b={x:0,y:0},S={x:0,y:0},[E,N,j,A]=QN({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(u[g]*c[g]===-1){k=o.x??E,_=o.y??N;const L=[{x:k,y:f.y},{x:k,y:p.y}],P=[{x:f.x,y:_},{x:p.x,y:_}];u[g]===y?w=g==="x"?L:P:w=g==="x"?P:L}else{const L=[{x:f.x,y:p.y}],P=[{x:p.x,y:f.y}];if(g==="x"?w=u.x===y?P:L:w=u.y===y?L:P,t===i){const K=Math.abs(e[g]-r[g]);if(K<=a){const C=Math.min(a-1,a-K);u[g]===y?b[g]=(f[g]>e[g]?-1:1)*C:S[g]=(p[g]>r[g]?-1:1)*C}}if(t!==i){const K=g==="x"?"y":"x",C=u[g]===c[K],z=f[K]>p[K],F=f[K]<p[K];(u[g]===1&&(!C&&z||C&&F)||u[g]!==1&&(!C&&F||C&&z))&&(w=g==="x"?L:P)}const D={x:f.x+b.x,y:f.y+b.y},M={x:p.x+S.x,y:p.y+S.y},q=Math.max(Math.abs(D.x-w[0].x),Math.abs(M.x-w[0].x)),W=Math.max(Math.abs(D.y-w[0].y),Math.abs(M.y-w[0].y));q>=W?(k=(D.x+M.x)/2,_=w[0].y):(k=w[0].x,_=(D.y+M.y)/2)}return[[e,{x:f.x+b.x,y:f.y+b.y},...w,{x:p.x+S.x,y:p.y+S.y},r],k,_,j,A]}function IM(e,t,r,i){const o=Math.min(Ax(e,t)/2,Ax(t,r)/2,i),{x:a,y:u}=t;if(e.x===a&&a===r.x||e.y===u&&u===r.y)return`L${a} ${u}`;if(e.y===u){const p=e.x<r.x?-1:1,d=e.y<r.y?1:-1;return`L ${a+o*p},${u}Q ${a},${u} ${a},${u+o*d}`}const c=e.x<r.x?1:-1,f=e.y<r.y?-1:1;return`L ${a},${u+o*f}Q ${a},${u} ${a+o*c},${u}`}function Av({sourceX:e,sourceY:t,sourcePosition:r=Re.Bottom,targetX:i,targetY:o,targetPosition:a=Re.Top,borderRadius:u=5,centerX:c,centerY:f,offset:p=20}){const[d,g,y,w,k]=AM({source:{x:e,y:t},sourcePosition:r,target:{x:i,y:o},targetPosition:a,center:{x:c,y:f},offset:p});return[d.reduce((b,S,E)=>{let N="";return E>0&&E<d.length-1?N=IM(d[E-1],S,d[E+1],u):N=`${E===0?"M":"L"}${S.x} ${S.y}`,b+=N,b},""),g,y,w,k]}const Fu=R.memo(({sourceX:e,sourceY:t,targetX:r,targetY:i,label:o,labelStyle:a,labelShowBg:u,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:p,style:d,sourcePosition:g=Re.Bottom,targetPosition:y=Re.Top,markerEnd:w,markerStart:k,pathOptions:_,interactionWidth:b})=>{const[S,E,N]=Av({sourceX:e,sourceY:t,sourcePosition:g,targetX:r,targetY:i,targetPosition:y,borderRadius:_==null?void 0:_.borderRadius,offset:_==null?void 0:_.offset});return ue.createElement(Ia,{path:S,labelX:E,labelY:N,label:o,labelStyle:a,labelShowBg:u,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:p,style:d,markerEnd:w,markerStart:k,interactionWidth:b})});Fu.displayName="SmoothStepEdge";const iy=R.memo(e=>{var t;return ue.createElement(Fu,{...e,pathOptions:R.useMemo(()=>{var r;return{borderRadius:0,offset:(r=e.pathOptions)==null?void 0:r.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});iy.displayName="StepEdge";function MM({sourceX:e,sourceY:t,targetX:r,targetY:i}){const[o,a,u,c]=QN({sourceX:e,sourceY:t,targetX:r,targetY:i});return[`M ${e},${t}L ${r},${i}`,o,a,u,c]}const oy=R.memo(({sourceX:e,sourceY:t,targetX:r,targetY:i,label:o,labelStyle:a,labelShowBg:u,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:p,style:d,markerEnd:g,markerStart:y,interactionWidth:w})=>{const[k,_,b]=MM({sourceX:e,sourceY:t,targetX:r,targetY:i});return ue.createElement(Ia,{path:k,labelX:_,labelY:b,label:o,labelStyle:a,labelShowBg:u,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:p,style:d,markerEnd:g,markerStart:y,interactionWidth:w})});oy.displayName="StraightEdge";function nu(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Ix({pos:e,x1:t,y1:r,x2:i,y2:o,c:a}){switch(e){case Re.Left:return[t-nu(t-i,a),r];case Re.Right:return[t+nu(i-t,a),r];case Re.Top:return[t,r-nu(r-o,a)];case Re.Bottom:return[t,r+nu(o-r,a)]}}function eC({sourceX:e,sourceY:t,sourcePosition:r=Re.Bottom,targetX:i,targetY:o,targetPosition:a=Re.Top,curvature:u=.25}){const[c,f]=Ix({pos:r,x1:e,y1:t,x2:i,y2:o,c:u}),[p,d]=Ix({pos:a,x1:i,y1:o,x2:e,y2:t,c:u}),[g,y,w,k]=ZN({sourceX:e,sourceY:t,targetX:i,targetY:o,sourceControlX:c,sourceControlY:f,targetControlX:p,targetControlY:d});return[`M${e},${t} C${c},${f} ${p},${d} ${i},${o}`,g,y,w,k]}const ju=R.memo(({sourceX:e,sourceY:t,targetX:r,targetY:i,sourcePosition:o=Re.Bottom,targetPosition:a=Re.Top,label:u,labelStyle:c,labelShowBg:f,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:k,pathOptions:_,interactionWidth:b})=>{const[S,E,N]=eC({sourceX:e,sourceY:t,sourcePosition:o,targetX:r,targetY:i,targetPosition:a,curvature:_==null?void 0:_.curvature});return ue.createElement(Ia,{path:S,labelX:E,labelY:N,label:u,labelStyle:c,labelShowBg:f,labelBgStyle:p,labelBgPadding:d,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:k,interactionWidth:b})});ju.displayName="BezierEdge";const ay=R.createContext(null),OM=ay.Provider;ay.Consumer;const PM=()=>R.useContext(ay),LM=e=>"id"in e&&"source"in e&&"target"in e,$M=({source:e,sourceHandle:t,target:r,targetHandle:i})=>`reactflow__edge-${e}${t||""}-${r}${i||""}`,Iv=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`,qM=(e,t)=>t.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)),DM=(e,t)=>{if(!e.source||!e.target)return t;let r;return LM(e)?r={...e}:r={...e,id:$M(e)},qM(r,t)?t:t.concat(r)},Mv=({x:e,y:t},[r,i,o],a,[u,c])=>{const f={x:(e-r)/o,y:(t-i)/o};return a?{x:u*Math.round(f.x/u),y:c*Math.round(f.y/c)}:f},tC=({x:e,y:t},[r,i,o])=>({x:e*o+r,y:t*o+i}),Js=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const r=(e.width??0)*t[0],i=(e.height??0)*t[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}},zu=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const r=e.reduce((i,o)=>{const{x:a,y:u}=Js(o,t).positionAbsolute;return GN(i,Sa({x:a,y:u,width:o.width||0,height:o.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return YN(r)},nC=(e,t,[r,i,o]=[0,0,1],a=!1,u=!1,c=[0,0])=>{const f={x:(t.x-r)/o,y:(t.y-i)/o,width:t.width/o,height:t.height/o},p=[];return e.forEach(d=>{const{width:g,height:y,selectable:w=!0,hidden:k=!1}=d;if(u&&!w||k)return!1;const{positionAbsolute:_}=Js(d,c),b={x:_.x,y:_.y,width:g||0,height:y||0},S=Tv(f,b),E=typeof g>"u"||typeof y>"u"||g===null||y===null,N=a&&S>0,j=(g||0)*(y||0);(E||N||S>=j||d.dragging)&&p.push(d)}),p},rC=(e,t)=>{const r=e.map(i=>i.id);return t.filter(i=>r.includes(i.source)||r.includes(i.target))},sC=(e,t,r,i,o,a=.1)=>{const u=t/(e.width*(1+a)),c=r/(e.height*(1+a)),f=Math.min(u,c),p=lo(f,i,o),d=e.x+e.width/2,g=e.y+e.height/2,y=t/2-d*p,w=r/2-g*p;return{x:y,y:w,zoom:p}},Ks=(e,t=0)=>e.transition().duration(t);function Mx(e,t,r,i){return(t[r]||[]).reduce((o,a)=>{var u,c;return`${e.id}-${a.id}-${r}`!==i&&o.push({id:a.id||null,type:r,nodeId:e.id,x:(((u=e.positionAbsolute)==null?void 0:u.x)??0)+a.x+a.width/2,y:(((c=e.positionAbsolute)==null?void 0:c.y)??0)+a.y+a.height/2}),o},[])}function FM(e,t,r,i,o,a){const{x:u,y:c}=ys(e),p=t.elementsFromPoint(u,c).find(k=>k.classList.contains("react-flow__handle"));if(p){const k=p.getAttribute("data-nodeid");if(k){const _=ly(void 0,p),b=p.getAttribute("data-handleid"),S=a({nodeId:k,id:b,type:_});if(S){const E=o.find(N=>N.nodeId===k&&N.type===_&&N.id===b);return{handle:{id:b,type:_,nodeId:k,x:(E==null?void 0:E.x)||r.x,y:(E==null?void 0:E.y)||r.y},validHandleResult:S}}}}let d=[],g=1/0;if(o.forEach(k=>{const _=Math.sqrt((k.x-r.x)**2+(k.y-r.y)**2);if(_<=i){const b=a(k);_<=g&&(_<g?d=[{handle:k,validHandleResult:b}]:_===g&&d.push({handle:k,validHandleResult:b}),g=_)}}),!d.length)return{handle:null,validHandleResult:iC()};if(d.length===1)return d[0];const y=d.some(({validHandleResult:k})=>k.isValid),w=d.some(({handle:k})=>k.type==="target");return d.find(({handle:k,validHandleResult:_})=>w?k.type==="target":y?_.isValid:!0)||d[0]}const zM={source:null,target:null,sourceHandle:null,targetHandle:null},iC=()=>({handleDomNode:null,isValid:!1,connection:zM,endHandle:null});function oC(e,t,r,i,o,a,u){const c=o==="target",f=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={...iC(),handleDomNode:f};if(f){const d=ly(void 0,f),g=f.getAttribute("data-nodeid"),y=f.getAttribute("data-handleid"),w=f.classList.contains("connectable"),k=f.classList.contains("connectableend"),_={source:c?g:r,sourceHandle:c?y:i,target:c?r:g,targetHandle:c?i:y};p.connection=_,w&&k&&(t===ti.Strict?c&&d==="source"||!c&&d==="target":g!==r||y!==i)&&(p.endHandle={nodeId:g,handleId:y,type:d},p.isValid=a(_))}return p}function BM({nodes:e,nodeId:t,handleId:r,handleType:i}){return e.reduce((o,a)=>{if(a[St]){const{handleBounds:u}=a[St];let c=[],f=[];u&&(c=Mx(a,u,"source",`${t}-${r}-${i}`),f=Mx(a,u,"target",`${t}-${r}-${i}`)),o.push(...c,...f)}return o},[])}function ly(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Hd(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function UM(e,t){let r=null;return t?r="valid":e&&!t&&(r="invalid"),r}function aC({event:e,handleId:t,nodeId:r,onConnect:i,isTarget:o,getState:a,setState:u,isValidConnection:c,edgeUpdaterType:f,onReconnectEnd:p}){const d=VN(e.target),{connectionMode:g,domNode:y,autoPanOnConnect:w,connectionRadius:k,onConnectStart:_,panBy:b,getNodes:S,cancelConnection:E}=a();let N=0,j;const{x:A,y:I}=ys(e),L=d==null?void 0:d.elementFromPoint(A,I),P=ly(f,L),D=y==null?void 0:y.getBoundingClientRect();if(!D||!P)return;let M,q=ys(e,D),W=!1,K=null,C=!1,z=null;const F=BM({nodes:S(),nodeId:r,handleId:t,handleType:P}),te=()=>{if(!w)return;const[Q,O]=WN(q,D);b({x:Q,y:O}),N=requestAnimationFrame(te)};u({connectionPosition:q,connectionStatus:null,connectionNodeId:r,connectionHandleId:t,connectionHandleType:P,connectionStartHandle:{nodeId:r,handleId:t,type:P},connectionEndHandle:null}),_==null||_(e,{nodeId:r,handleId:t,handleType:P});function Z(Q){const{transform:O}=a();q=ys(Q,D);const{handle:V,validHandleResult:ce}=FM(Q,d,Mv(q,O,!1,[1,1]),k,F,$=>oC($,g,r,t,o?"target":"source",c,d));if(j=V,W||(te(),W=!0),z=ce.handleDomNode,K=ce.connection,C=ce.isValid,u({connectionPosition:j&&C?tC({x:j.x,y:j.y},O):q,connectionStatus:UM(!!j,C),connectionEndHandle:ce.endHandle}),!j&&!C&&!z)return Hd(M);K.source!==K.target&&z&&(Hd(M),M=z,z.classList.add("connecting","react-flow__handle-connecting"),z.classList.toggle("valid",C),z.classList.toggle("react-flow__handle-valid",C))}function U(Q){var O,V;(j||z)&&K&&C&&(i==null||i(K)),(V=(O=a()).onConnectEnd)==null||V.call(O,Q),f&&(p==null||p(Q)),Hd(M),E(),cancelAnimationFrame(N),W=!1,C=!1,K=null,z=null,d.removeEventListener("mousemove",Z),d.removeEventListener("mouseup",U),d.removeEventListener("touchmove",Z),d.removeEventListener("touchend",U)}d.addEventListener("mousemove",Z),d.addEventListener("mouseup",U),d.addEventListener("touchmove",Z),d.addEventListener("touchend",U)}const Ox=()=>!0,HM=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),WM=(e,t,r)=>i=>{const{connectionStartHandle:o,connectionEndHandle:a,connectionClickStartHandle:u}=i;return{connecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.handleId)===t&&(o==null?void 0:o.type)===r||(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===r,clickConnecting:(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.handleId)===t&&(u==null?void 0:u.type)===r}},lC=R.forwardRef(({type:e="source",position:t=Re.Top,isValidConnection:r,isConnectable:i=!0,isConnectableStart:o=!0,isConnectableEnd:a=!0,id:u,onConnect:c,children:f,className:p,onMouseDown:d,onTouchStart:g,...y},w)=>{var D,M;const k=u||null,_=e==="target",b=Mt(),S=PM(),{connectOnClick:E,noPanClassName:N}=it(HM,It),{connecting:j,clickConnecting:A}=it(WM(S,k,e),It);S||(M=(D=b.getState()).onError)==null||M.call(D,"010",Br.error010());const I=q=>{const{defaultEdgeOptions:W,onConnect:K,hasDefaultEdges:C}=b.getState(),z={...W,...q};if(C){const{edges:F,setEdges:te}=b.getState();te(DM(z,F))}K==null||K(z),c==null||c(z)},L=q=>{if(!S)return;const W=XN(q);o&&(W&&q.button===0||!W)&&aC({event:q,handleId:k,nodeId:S,onConnect:I,isTarget:_,getState:b.getState,setState:b.setState,isValidConnection:r||b.getState().isValidConnection||Ox}),W?d==null||d(q):g==null||g(q)},P=q=>{const{onClickConnectStart:W,onClickConnectEnd:K,connectionClickStartHandle:C,connectionMode:z,isValidConnection:F}=b.getState();if(!S||!C&&!o)return;if(!C){W==null||W(q,{nodeId:S,handleId:k,handleType:e}),b.setState({connectionClickStartHandle:{nodeId:S,type:e,handleId:k}});return}const te=VN(q.target),Z=r||F||Ox,{connection:U,isValid:Q}=oC({nodeId:S,id:k,type:e},z,C.nodeId,C.handleId||null,C.type,Z,te);Q&&I(U),K==null||K(q),b.setState({connectionClickStartHandle:null})};return ue.createElement("div",{"data-handleid":k,"data-nodeid":S,"data-handlepos":t,"data-id":`${S}-${k}-${e}`,className:zt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",N,p,{source:!_,target:_,connectable:i,connectablestart:o,connectableend:a,connecting:A,connectionindicator:i&&(o&&!j||a&&j)}]),onMouseDown:L,onTouchStart:L,onClick:E?P:void 0,ref:w,...y},f)});lC.displayName="Handle";var uo=R.memo(lC);const uC=({data:e,isConnectable:t,targetPosition:r=Re.Top,sourcePosition:i=Re.Bottom})=>ue.createElement(ue.Fragment,null,ue.createElement(uo,{type:"target",position:r,isConnectable:t}),e==null?void 0:e.label,ue.createElement(uo,{type:"source",position:i,isConnectable:t}));uC.displayName="DefaultNode";var Ov=R.memo(uC);const cC=({data:e,isConnectable:t,sourcePosition:r=Re.Bottom})=>ue.createElement(ue.Fragment,null,e==null?void 0:e.label,ue.createElement(uo,{type:"source",position:r,isConnectable:t}));cC.displayName="InputNode";var dC=R.memo(cC);const fC=({data:e,isConnectable:t,targetPosition:r=Re.Top})=>ue.createElement(ue.Fragment,null,ue.createElement(uo,{type:"target",position:r,isConnectable:t}),e==null?void 0:e.label);fC.displayName="OutputNode";var hC=R.memo(fC);const uy=()=>null;uy.displayName="GroupNode";const VM=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),ru=e=>e.id;function GM(e,t){return It(e.selectedNodes.map(ru),t.selectedNodes.map(ru))&&It(e.selectedEdges.map(ru),t.selectedEdges.map(ru))}const pC=R.memo(({onSelectionChange:e})=>{const t=Mt(),{selectedNodes:r,selectedEdges:i}=it(VM,GM);return R.useEffect(()=>{const o={nodes:r,edges:i};e==null||e(o),t.getState().onSelectionChange.forEach(a=>a(o))},[r,i,e]),null});pC.displayName="SelectionListener";const YM=e=>!!e.onSelectionChange;function KM({onSelectionChange:e}){const t=it(YM);return e||t?ue.createElement(pC,{onSelectionChange:e}):null}const XM=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 Gi(e,t){R.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Ge(e,t,r){R.useEffect(()=>{typeof t<"u"&&r({[e]:t})},[t])}const QM=({nodes:e,edges:t,defaultNodes:r,defaultEdges:i,onConnect:o,onConnectStart:a,onConnectEnd:u,onClickConnectStart:c,onClickConnectEnd:f,nodesDraggable:p,nodesConnectable:d,nodesFocusable:g,edgesFocusable:y,edgesUpdatable:w,elevateNodesOnSelect:k,minZoom:_,maxZoom:b,nodeExtent:S,onNodesChange:E,onEdgesChange:N,elementsSelectable:j,connectionMode:A,snapGrid:I,snapToGrid:L,translateExtent:P,connectOnClick:D,defaultEdgeOptions:M,fitView:q,fitViewOptions:W,onNodesDelete:K,onEdgesDelete:C,onNodeDrag:z,onNodeDragStart:F,onNodeDragStop:te,onSelectionDrag:Z,onSelectionDragStart:U,onSelectionDragStop:Q,noPanClassName:O,nodeOrigin:V,rfId:ce,autoPanOnConnect:$,autoPanOnNodeDrag:G,onError:ee,connectionRadius:ie,isValidConnection:de,nodeDragThreshold:pe})=>{const{setNodes:ne,setEdges:Pe,setDefaultNodesAndEdges:He,setMinZoom:ze,setMaxZoom:Oe,setTranslateExtent:_e,setNodeExtent:Qe,reset:ye}=it(XM,It),we=Mt();return R.useEffect(()=>{const qe=i==null?void 0:i.map(dt=>({...dt,...M}));return He(r,qe),()=>{ye()}},[]),Ge("defaultEdgeOptions",M,we.setState),Ge("connectionMode",A,we.setState),Ge("onConnect",o,we.setState),Ge("onConnectStart",a,we.setState),Ge("onConnectEnd",u,we.setState),Ge("onClickConnectStart",c,we.setState),Ge("onClickConnectEnd",f,we.setState),Ge("nodesDraggable",p,we.setState),Ge("nodesConnectable",d,we.setState),Ge("nodesFocusable",g,we.setState),Ge("edgesFocusable",y,we.setState),Ge("edgesUpdatable",w,we.setState),Ge("elementsSelectable",j,we.setState),Ge("elevateNodesOnSelect",k,we.setState),Ge("snapToGrid",L,we.setState),Ge("snapGrid",I,we.setState),Ge("onNodesChange",E,we.setState),Ge("onEdgesChange",N,we.setState),Ge("connectOnClick",D,we.setState),Ge("fitViewOnInit",q,we.setState),Ge("fitViewOnInitOptions",W,we.setState),Ge("onNodesDelete",K,we.setState),Ge("onEdgesDelete",C,we.setState),Ge("onNodeDrag",z,we.setState),Ge("onNodeDragStart",F,we.setState),Ge("onNodeDragStop",te,we.setState),Ge("onSelectionDrag",Z,we.setState),Ge("onSelectionDragStart",U,we.setState),Ge("onSelectionDragStop",Q,we.setState),Ge("noPanClassName",O,we.setState),Ge("nodeOrigin",V,we.setState),Ge("rfId",ce,we.setState),Ge("autoPanOnConnect",$,we.setState),Ge("autoPanOnNodeDrag",G,we.setState),Ge("onError",ee,we.setState),Ge("connectionRadius",ie,we.setState),Ge("isValidConnection",de,we.setState),Ge("nodeDragThreshold",pe,we.setState),Gi(e,ne),Gi(t,Pe),Gi(_,ze),Gi(b,Oe),Gi(P,_e),Gi(S,Qe),null},Px={display:"none"},ZM={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},mC="react-flow__node-desc",gC="react-flow__edge-desc",JM="react-flow__aria-live",eO=e=>e.ariaLiveMessage;function tO({rfId:e}){const t=it(eO);return ue.createElement("div",{id:`${JM}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:ZM},t)}function nO({rfId:e,disableKeyboardA11y:t}){return ue.createElement(ue.Fragment,null,ue.createElement("div",{id:`${mC}-${e}`,style:Px},"Press enter or space to select a node.",!t&&"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:`${gC}-${e}`,style:Px},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&ue.createElement(tO,{rfId:e}))}var Ea=(e=null,t={actInsideInputWithModifier:!0})=>{const[r,i]=R.useState(!1),o=R.useRef(!1),a=R.useRef(new Set([])),[u,c]=R.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(g=>typeof g=="string").map(g=>g.split("+")),d=p.reduce((g,y)=>g.concat(...y),[]);return[p,d]}return[[],[]]},[e]);return R.useEffect(()=>{const f=typeof document<"u"?document:null,p=(t==null?void 0:t.target)||f;if(e!==null){const d=w=>{if(o.current=w.ctrlKey||w.metaKey||w.shiftKey,(!o.current||o.current&&!t.actInsideInputWithModifier)&&Rv(w))return!1;const _=$x(w.code,c);a.current.add(w[_]),Lx(u,a.current,!1)&&(w.preventDefault(),i(!0))},g=w=>{if((!o.current||o.current&&!t.actInsideInputWithModifier)&&Rv(w))return!1;const _=$x(w.code,c);Lx(u,a.current,!0)?(i(!1),a.current.clear()):a.current.delete(w[_]),w.key==="Meta"&&a.current.clear(),o.current=!1},y=()=>{a.current.clear(),i(!1)};return p==null||p.addEventListener("keydown",d),p==null||p.addEventListener("keyup",g),window.addEventListener("blur",y),()=>{p==null||p.removeEventListener("keydown",d),p==null||p.removeEventListener("keyup",g),window.removeEventListener("blur",y)}}},[e,i]),r};function Lx(e,t,r){return e.filter(i=>r||i.length===t.size).some(i=>i.every(o=>t.has(o)))}function $x(e,t){return t.includes(e)?"code":"key"}function vC(e,t,r,i){var c,f;const o=e.parentNode||e.parentId;if(!o)return r;const a=t.get(o),u=Js(a,i);return vC(a,t,{x:(r.x??0)+u.x,y:(r.y??0)+u.y,z:(((c=a[St])==null?void 0:c.z)??0)>(r.z??0)?((f=a[St])==null?void 0:f.z)??0:r.z??0},i)}function yC(e,t,r){e.forEach(i=>{var a;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:f}=vC(i,e,{...i.position,z:((a=i[St])==null?void 0:a.z)??0},t);i.positionAbsolute={x:u,y:c},i[St].z=f,r!=null&&r[i.id]&&(i[St].isParent=!0)}})}function Wd(e,t,r,i){const o=new Map,a={},u=i?1e3:0;return e.forEach(c=>{var w;const f=(qn(c.zIndex)?c.zIndex:0)+(c.selected?u:0),p=t.get(c.id),d={...c,positionAbsolute:{x:c.position.x,y:c.position.y}},g=c.parentNode||c.parentId;g&&(a[g]=!0);const y=(p==null?void 0:p.type)&&(p==null?void 0:p.type)!==c.type;Object.defineProperty(d,St,{enumerable:!1,value:{handleBounds:y||(w=p==null?void 0:p[St])==null?void 0:w.handleBounds,z:f}}),o.set(c.id,d)}),yC(o,r,a),o}function wC(e,t={}){const{getNodes:r,width:i,height:o,minZoom:a,maxZoom:u,d3Zoom:c,d3Selection:f,fitViewOnInitDone:p,fitViewOnInit:d,nodeOrigin:g}=e(),y=t.initial&&!p&&d;if(c&&f&&(y||!t.initial)){const k=r().filter(b=>{var E;const S=t.includeHiddenNodes?b.width&&b.height:!b.hidden;return(E=t.nodes)!=null&&E.length?S&&t.nodes.some(N=>N.id===b.id):S}),_=k.every(b=>b.width&&b.height);if(k.length>0&&_){const b=zu(k,g),{x:S,y:E,zoom:N}=sC(b,i,o,t.minZoom??a,t.maxZoom??u,t.padding??.1),j=Fr.translate(S,E).scale(N);return typeof t.duration=="number"&&t.duration>0?c.transform(Ks(f,t.duration),j):c.transform(f,j),!0}}return!1}function rO(e,t){return e.forEach(r=>{const i=t.get(r.id);i&&t.set(i.id,{...i,[St]:i[St],selected:r.selected})}),new Map(t)}function sO(e,t){return t.map(r=>{const i=e.find(o=>o.id===r.id);return i&&(r.selected=i.selected),r})}function su({changedNodes:e,changedEdges:t,get:r,set:i}){const{nodeInternals:o,edges:a,onNodesChange:u,onEdgesChange:c,hasDefaultNodes:f,hasDefaultEdges:p}=r();e!=null&&e.length&&(f&&i({nodeInternals:rO(e,o)}),u==null||u(e)),t!=null&&t.length&&(p&&i({edges:sO(t,a)}),c==null||c(t))}const Yi=()=>{},iO={zoomIn:Yi,zoomOut:Yi,zoomTo:Yi,getZoom:()=>1,setViewport:Yi,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Yi,fitBounds:Yi,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},oO=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),aO=()=>{const e=Mt(),{d3Zoom:t,d3Selection:r}=it(oO,It);return R.useMemo(()=>r&&t?{zoomIn:o=>t.scaleBy(Ks(r,o==null?void 0:o.duration),1.2),zoomOut:o=>t.scaleBy(Ks(r,o==null?void 0:o.duration),1/1.2),zoomTo:(o,a)=>t.scaleTo(Ks(r,a==null?void 0:a.duration),o),getZoom:()=>e.getState().transform[2],setViewport:(o,a)=>{const[u,c,f]=e.getState().transform,p=Fr.translate(o.x??u,o.y??c).scale(o.zoom??f);t.transform(Ks(r,a==null?void 0:a.duration),p)},getViewport:()=>{const[o,a,u]=e.getState().transform;return{x:o,y:a,zoom:u}},fitView:o=>wC(e.getState,o),setCenter:(o,a,u)=>{const{width:c,height:f,maxZoom:p}=e.getState(),d=typeof(u==null?void 0:u.zoom)<"u"?u.zoom:p,g=c/2-o*d,y=f/2-a*d,w=Fr.translate(g,y).scale(d);t.transform(Ks(r,u==null?void 0:u.duration),w)},fitBounds:(o,a)=>{const{width:u,height:c,minZoom:f,maxZoom:p}=e.getState(),{x:d,y:g,zoom:y}=sC(o,u,c,f,p,(a==null?void 0:a.padding)??.1),w=Fr.translate(d,g).scale(y);t.transform(Ks(r,a==null?void 0:a.duration),w)},project:o=>{const{transform:a,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"),Mv(o,a,u,c)},screenToFlowPosition:o=>{const{transform:a,snapToGrid:u,snapGrid:c,domNode:f}=e.getState();if(!f)return o;const{x:p,y:d}=f.getBoundingClientRect(),g={x:o.x-p,y:o.y-d};return Mv(g,a,u,c)},flowToScreenPosition:o=>{const{transform:a,domNode:u}=e.getState();if(!u)return o;const{x:c,y:f}=u.getBoundingClientRect(),p=tC(o,a);return{x:p.x+c,y:p.y+f}},viewportInitialized:!0}:iO,[t,r])};function Ma(){const e=aO(),t=Mt(),r=R.useCallback(()=>t.getState().getNodes().map(_=>({..._})),[]),i=R.useCallback(_=>t.getState().nodeInternals.get(_),[]),o=R.useCallback(()=>{const{edges:_=[]}=t.getState();return _.map(b=>({...b}))},[]),a=R.useCallback(_=>{const{edges:b=[]}=t.getState();return b.find(S=>S.id===_)},[]),u=R.useCallback(_=>{const{getNodes:b,setNodes:S,hasDefaultNodes:E,onNodesChange:N}=t.getState(),j=b(),A=typeof _=="function"?_(j):_;if(E)S(A);else if(N){const I=A.length===0?j.map(L=>({type:"remove",id:L.id})):A.map(L=>({item:L,type:"reset"}));N(I)}},[]),c=R.useCallback(_=>{const{edges:b=[],setEdges:S,hasDefaultEdges:E,onEdgesChange:N}=t.getState(),j=typeof _=="function"?_(b):_;if(E)S(j);else if(N){const A=j.length===0?b.map(I=>({type:"remove",id:I.id})):j.map(I=>({item:I,type:"reset"}));N(A)}},[]),f=R.useCallback(_=>{const b=Array.isArray(_)?_:[_],{getNodes:S,setNodes:E,hasDefaultNodes:N,onNodesChange:j}=t.getState();if(N){const I=[...S(),...b];E(I)}else if(j){const A=b.map(I=>({item:I,type:"add"}));j(A)}},[]),p=R.useCallback(_=>{const b=Array.isArray(_)?_:[_],{edges:S=[],setEdges:E,hasDefaultEdges:N,onEdgesChange:j}=t.getState();if(N)E([...S,...b]);else if(j){const A=b.map(I=>({item:I,type:"add"}));j(A)}},[]),d=R.useCallback(()=>{const{getNodes:_,edges:b=[],transform:S}=t.getState(),[E,N,j]=S;return{nodes:_().map(A=>({...A})),edges:b.map(A=>({...A})),viewport:{x:E,y:N,zoom:j}}},[]),g=R.useCallback(({nodes:_,edges:b})=>{const{nodeInternals:S,getNodes:E,edges:N,hasDefaultNodes:j,hasDefaultEdges:A,onNodesDelete:I,onEdgesDelete:L,onNodesChange:P,onEdgesChange:D}=t.getState(),M=(_||[]).map(z=>z.id),q=(b||[]).map(z=>z.id),W=E().reduce((z,F)=>{const te=F.parentNode||F.parentId,Z=!M.includes(F.id)&&te&&z.find(Q=>Q.id===te);return(typeof F.deletable=="boolean"?F.deletable:!0)&&(M.includes(F.id)||Z)&&z.push(F),z},[]),K=N.filter(z=>typeof z.deletable=="boolean"?z.deletable:!0),C=K.filter(z=>q.includes(z.id));if(W||C){const z=rC(W,K),F=[...C,...z],te=F.reduce((Z,U)=>(Z.includes(U.id)||Z.push(U.id),Z),[]);if((A||j)&&(A&&t.setState({edges:N.filter(Z=>!te.includes(Z.id))}),j&&(W.forEach(Z=>{S.delete(Z.id)}),t.setState({nodeInternals:new Map(S)}))),te.length>0&&(L==null||L(F),D&&D(te.map(Z=>({id:Z,type:"remove"})))),W.length>0&&(I==null||I(W),P)){const Z=W.map(U=>({id:U.id,type:"remove"}));P(Z)}}},[]),y=R.useCallback(_=>{const b=CM(_),S=b?null:t.getState().nodeInternals.get(_.id);return!b&&!S?[null,null,b]:[b?_:jx(S),S,b]},[]),w=R.useCallback((_,b=!0,S)=>{const[E,N,j]=y(_);return E?(S||t.getState().getNodes()).filter(A=>{if(!j&&(A.id===N.id||!A.positionAbsolute))return!1;const I=jx(A),L=Tv(I,E);return b&&L>0||L>=E.width*E.height}):[]},[]),k=R.useCallback((_,b,S=!0)=>{const[E]=y(_);if(!E)return!1;const N=Tv(E,b);return S&&N>0||N>=E.width*E.height},[]);return R.useMemo(()=>({...e,getNodes:r,getNode:i,getEdges:o,getEdge:a,setNodes:u,setEdges:c,addNodes:f,addEdges:p,toObject:d,deleteElements:g,getIntersectingNodes:w,isNodeIntersecting:k}),[e,r,i,o,a,u,c,f,p,d,g,w,k])}const lO={actInsideInputWithModifier:!1};var uO=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const r=Mt(),{deleteElements:i}=Ma(),o=Ea(e,lO),a=Ea(t);R.useEffect(()=>{if(o){const{edges:u,getNodes:c}=r.getState(),f=c().filter(d=>d.selected),p=u.filter(d=>d.selected);i({nodes:f,edges:p}),r.setState({nodesSelectionActive:!1})}},[o]),R.useEffect(()=>{r.setState({multiSelectionActive:a})},[a])};function cO(e){const t=Mt();R.useEffect(()=>{let r;const i=()=>{var a,u;if(!e.current)return;const o=ny(e.current);(o.height===0||o.width===0)&&((u=(a=t.getState()).onError)==null||u.call(a,"004",Br.error004())),t.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 cy={position:"absolute",width:"100%",height:"100%",top:0,left:0},dO=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,iu=e=>({x:e.x,y:e.y,zoom:e.k}),Ki=(e,t)=>e.target.closest(`.${t}`),qx=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Dx=e=>{const t=e.ctrlKey&&Nu()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},fO=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),hO=({onMove:e,onMoveStart:t,onMoveEnd:r,onPaneContextMenu:i,zoomOnScroll:o=!0,zoomOnPinch:a=!0,panOnScroll:u=!1,panOnScrollSpeed:c=.5,panOnScrollMode:f=Qs.Free,zoomOnDoubleClick:p=!0,elementsSelectable:d,panOnDrag:g=!0,defaultViewport:y,translateExtent:w,minZoom:k,maxZoom:_,zoomActivationKeyCode:b,preventScrolling:S=!0,children:E,noWheelClassName:N,noPanClassName:j})=>{const A=R.useRef(),I=Mt(),L=R.useRef(!1),P=R.useRef(!1),D=R.useRef(null),M=R.useRef({x:0,y:0,zoom:0}),{d3Zoom:q,d3Selection:W,d3ZoomHandler:K,userSelectionActive:C}=it(fO,It),z=Ea(b),F=R.useRef(0),te=R.useRef(!1),Z=R.useRef();return cO(D),R.useEffect(()=>{if(D.current){const U=D.current.getBoundingClientRect(),Q=UN().scaleExtent([k,_]).translateExtent(w),O=$n(D.current).call(Q),V=Fr.translate(y.x,y.y).scale(lo(y.zoom,k,_)),ce=[[0,0],[U.width,U.height]],$=Q.constrain()(V,ce,w);Q.transform(O,$),Q.wheelDelta(Dx),I.setState({d3Zoom:Q,d3Selection:O,d3ZoomHandler:O.on("wheel.zoom"),transform:[$.x,$.y,$.k],domNode:D.current.closest(".react-flow")})}},[]),R.useEffect(()=>{W&&q&&(u&&!z&&!C?W.on("wheel.zoom",U=>{if(Ki(U,N))return!1;U.preventDefault(),U.stopImmediatePropagation();const Q=W.property("__zoom").k||1;if(U.ctrlKey&&a){const de=er(U),pe=Dx(U),ne=Q*Math.pow(2,pe);q.scaleTo(W,ne,de,U);return}const O=U.deltaMode===1?20:1;let V=f===Qs.Vertical?0:U.deltaX*O,ce=f===Qs.Horizontal?0:U.deltaY*O;!Nu()&&U.shiftKey&&f!==Qs.Vertical&&(V=U.deltaY*O,ce=0),q.translateBy(W,-(V/Q)*c,-(ce/Q)*c,{internal:!0});const $=iu(W.property("__zoom")),{onViewportChangeStart:G,onViewportChange:ee,onViewportChangeEnd:ie}=I.getState();clearTimeout(Z.current),te.current||(te.current=!0,t==null||t(U,$),G==null||G($)),te.current&&(e==null||e(U,$),ee==null||ee($),Z.current=setTimeout(()=>{r==null||r(U,$),ie==null||ie($),te.current=!1},150))},{passive:!1}):typeof K<"u"&&W.on("wheel.zoom",function(U,Q){if(!S&&U.type==="wheel"&&!U.ctrlKey||Ki(U,N))return null;U.preventDefault(),K.call(this,U,Q)},{passive:!1}))},[C,u,f,W,q,K,z,a,S,N,t,e,r]),R.useEffect(()=>{q&&q.on("start",U=>{var V,ce;if(!U.sourceEvent||U.sourceEvent.internal)return null;F.current=(V=U.sourceEvent)==null?void 0:V.button;const{onViewportChangeStart:Q}=I.getState(),O=iu(U.transform);L.current=!0,M.current=O,((ce=U.sourceEvent)==null?void 0:ce.type)==="mousedown"&&I.setState({paneDragging:!0}),Q==null||Q(O),t==null||t(U.sourceEvent,O)})},[q,t]),R.useEffect(()=>{q&&(C&&!L.current?q.on("zoom",null):C||q.on("zoom",U=>{var O;const{onViewportChange:Q}=I.getState();if(I.setState({transform:[U.transform.x,U.transform.y,U.transform.k]}),P.current=!!(i&&qx(g,F.current??0)),(e||Q)&&!((O=U.sourceEvent)!=null&&O.internal)){const V=iu(U.transform);Q==null||Q(V),e==null||e(U.sourceEvent,V)}}))},[C,q,e,g,i]),R.useEffect(()=>{q&&q.on("end",U=>{if(!U.sourceEvent||U.sourceEvent.internal)return null;const{onViewportChangeEnd:Q}=I.getState();if(L.current=!1,I.setState({paneDragging:!1}),i&&qx(g,F.current??0)&&!P.current&&i(U.sourceEvent),P.current=!1,(r||Q)&&dO(M.current,U.transform)){const O=iu(U.transform);M.current=O,clearTimeout(A.current),A.current=setTimeout(()=>{Q==null||Q(O),r==null||r(U.sourceEvent,O)},u?150:0)}})},[q,u,g,r,i]),R.useEffect(()=>{q&&q.filter(U=>{const Q=z||o,O=a&&U.ctrlKey;if((g===!0||Array.isArray(g)&&g.includes(1))&&U.button===1&&U.type==="mousedown"&&(Ki(U,"react-flow__node")||Ki(U,"react-flow__edge")))return!0;if(!g&&!Q&&!u&&!p&&!a||C||!p&&U.type==="dblclick"||Ki(U,N)&&U.type==="wheel"||Ki(U,j)&&(U.type!=="wheel"||u&&U.type==="wheel"&&!z)||!a&&U.ctrlKey&&U.type==="wheel"||!Q&&!u&&!O&&U.type==="wheel"||!g&&(U.type==="mousedown"||U.type==="touchstart")||Array.isArray(g)&&!g.includes(U.button)&&U.type==="mousedown")return!1;const V=Array.isArray(g)&&g.includes(U.button)||!U.button||U.button<=1;return(!U.ctrlKey||U.type==="wheel")&&V})},[C,q,o,a,u,p,g,d,z]),ue.createElement("div",{className:"react-flow__renderer",ref:D,style:cy},E)},pO=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function mO(){const{userSelectionActive:e,userSelectionRect:t}=it(pO,It);return e&&t?ue.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function Fx(e,t){const r=t.parentNode||t.parentId,i=e.find(o=>o.id===r);if(i){const o=t.position.x+t.width-i.width,a=t.position.y+t.height-i.height;if(o>0||a>0||t.position.x<0||t.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),a>0&&(i.style.height+=a),t.position.x<0){const u=Math.abs(t.position.x);i.position.x=i.position.x-u,i.style.width+=u,t.position.x=0}if(t.position.y<0){const u=Math.abs(t.position.y);i.position.y=i.position.y-u,i.style.height+=u,t.position.y=0}i.width=i.style.width,i.height=i.style.height}}}function gO(e,t){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 t.reduce((i,o)=>{const a=e.filter(c=>c.id===o.id);if(a.length===0)return i.push(o),i;const u={...o};for(const c of a)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&&Fx(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&&Fx(i,u);break}case"remove":return i}return i.push(u),i},r)}function vO(e,t){return gO(e,t)}const gs=(e,t)=>({id:e,type:"select",selected:t});function eo(e,t){return e.reduce((r,i)=>{const o=t.includes(i.id);return!i.selected&&o?(i.selected=!0,r.push(gs(i.id,!0))):i.selected&&!o&&(i.selected=!1,r.push(gs(i.id,!1))),r},[])}const Vd=(e,t)=>r=>{r.target===t.current&&(e==null||e(r))},yO=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),xC=R.memo(({isSelecting:e,selectionMode:t=ka.Full,panOnDrag:r,onSelectionStart:i,onSelectionEnd:o,onPaneClick:a,onPaneContextMenu:u,onPaneScroll:c,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:d,children:g})=>{const y=R.useRef(null),w=Mt(),k=R.useRef(0),_=R.useRef(0),b=R.useRef(),{userSelectionActive:S,elementsSelectable:E,dragging:N}=it(yO,It),j=()=>{w.setState({userSelectionActive:!1,userSelectionRect:null}),k.current=0,_.current=0},A=K=>{a==null||a(K),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},I=K=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){K.preventDefault();return}u==null||u(K)},L=c?K=>c(K):void 0,P=K=>{const{resetSelectedElements:C,domNode:z}=w.getState();if(b.current=z==null?void 0:z.getBoundingClientRect(),!E||!e||K.button!==0||K.target!==y.current||!b.current)return;const{x:F,y:te}=ys(K,b.current);C(),w.setState({userSelectionRect:{width:0,height:0,startX:F,startY:te,x:F,y:te}}),i==null||i(K)},D=K=>{const{userSelectionRect:C,nodeInternals:z,edges:F,transform:te,onNodesChange:Z,onEdgesChange:U,nodeOrigin:Q,getNodes:O}=w.getState();if(!e||!b.current||!C)return;w.setState({userSelectionActive:!0,nodesSelectionActive:!1});const V=ys(K,b.current),ce=C.startX??0,$=C.startY??0,G={...C,x:V.x<ce?V.x:ce,y:V.y<$?V.y:$,width:Math.abs(V.x-ce),height:Math.abs(V.y-$)},ee=O(),ie=nC(z,G,te,t===ka.Partial,!0,Q),de=rC(ie,F).map(ne=>ne.id),pe=ie.map(ne=>ne.id);if(k.current!==pe.length){k.current=pe.length;const ne=eo(ee,pe);ne.length&&(Z==null||Z(ne))}if(_.current!==de.length){_.current=de.length;const ne=eo(F,de);ne.length&&(U==null||U(ne))}w.setState({userSelectionRect:G})},M=K=>{if(K.button!==0)return;const{userSelectionRect:C}=w.getState();!S&&C&&K.target===y.current&&(A==null||A(K)),w.setState({nodesSelectionActive:k.current>0}),j(),o==null||o(K)},q=K=>{S&&(w.setState({nodesSelectionActive:k.current>0}),o==null||o(K)),j()},W=E&&(e||S);return ue.createElement("div",{className:zt(["react-flow__pane",{dragging:N,selection:e}]),onClick:W?void 0:Vd(A,y),onContextMenu:Vd(I,y),onWheel:Vd(L,y),onMouseEnter:W?void 0:f,onMouseDown:W?P:void 0,onMouseMove:W?D:p,onMouseUp:W?M:void 0,onMouseLeave:W?q:d,ref:y,style:cy},g,ue.createElement(mO,null))});xC.displayName="Pane";function _C(e,t){const r=e.parentNode||e.parentId;if(!r)return!1;const i=t.get(r);return i?i.selected?!0:_C(i,t):!1}function zx(e,t,r){let i=e;do{if(i!=null&&i.matches(t))return!0;if(i===r.current)return!1;i=i.parentElement}while(i);return!1}function wO(e,t,r,i){return Array.from(e.values()).filter(o=>(o.selected||o.id===i)&&(!o.parentNode||o.parentId||!_C(o,e))&&(o.draggable||t&&typeof o.draggable>"u")).map(o=>{var a,u;return{id:o.id,position:o.position||{x:0,y:0},positionAbsolute:o.positionAbsolute||{x:0,y:0},distance:{x:r.x-(((a=o.positionAbsolute)==null?void 0:a.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 xO(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function bC(e,t,r,i,o=[0,0],a){const u=xO(e,e.extent||i);let c=u;const f=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(f&&e.width&&e.height){const g=r.get(f),{x:y,y:w}=Js(g,o).positionAbsolute;c=g&&qn(y)&&qn(w)&&qn(g.width)&&qn(g.height)?[[y+e.width*o[0],w+e.height*o[1]],[y+g.width-e.width+e.width*o[0],w+g.height-e.height+e.height*o[1]]]:c}else a==null||a("005",Br.error005()),c=u;else if(e.extent&&f&&e.extent!=="parent"){const g=r.get(f),{x:y,y:w}=Js(g,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(f){const g=r.get(f);p=Js(g,o).positionAbsolute}const d=c&&c!=="parent"?ry(t,c):t;return{position:{x:d.x-p.x,y:d.y-p.y},positionAbsolute:d}}function Gd({nodeId:e,dragItems:t,nodeInternals:r}){const i=t.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,t,r,i)=>{const o=t.querySelectorAll(e);if(!o||!o.length)return null;const a=Array.from(o),u=t.getBoundingClientRect(),c={x:u.width*i[0],y:u.height*i[1]};return a.map(f=>{const p=f.getBoundingClientRect();return{id:f.getAttribute("data-handleid"),position:f.getAttribute("data-handlepos"),x:(p.left-u.left-c.x)/r,y:(p.top-u.top-c.y)/r,...ny(f)}})};function aa(e,t,r){return r===void 0?r:i=>{const o=t().nodeInternals.get(e);o&&r(i,{...o})}}function Pv({id:e,store:t,unselect:r=!1,nodeRef:i}){const{addSelectedNodes:o,unselectNodesAndEdges:a,multiSelectionActive:u,nodeInternals:c,onError:f}=t.getState(),p=c.get(e);if(!p){f==null||f("012",Br.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(r||p.selected&&u)&&(a({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var d;return(d=i==null?void 0:i.current)==null?void 0:d.blur()})):o([e])}function _O(){const e=Mt();return R.useCallback(({sourceEvent:r})=>{const{transform:i,snapGrid:o,snapToGrid:a}=e.getState(),u=r.touches?r.touches[0].clientX:r.clientX,c=r.touches?r.touches[0].clientY:r.clientY,f={x:(u-i[0])/i[2],y:(c-i[1])/i[2]};return{xSnapped:a?o[0]*Math.round(f.x/o[0]):f.x,ySnapped:a?o[1]*Math.round(f.y/o[1]):f.y,...f}},[])}function Yd(e){return(t,r,i)=>e==null?void 0:e(t,i)}function SC({nodeRef:e,disabled:t=!1,noDragClassName:r,handleSelector:i,nodeId:o,isSelectable:a,selectNodesOnDrag:u}){const c=Mt(),[f,p]=R.useState(!1),d=R.useRef([]),g=R.useRef({x:null,y:null}),y=R.useRef(0),w=R.useRef(null),k=R.useRef({x:0,y:0}),_=R.useRef(null),b=R.useRef(!1),S=R.useRef(!1),E=R.useRef(!1),N=_O();return R.useEffect(()=>{if(e!=null&&e.current){const j=$n(e.current),A=({x:P,y:D})=>{const{nodeInternals:M,onNodeDrag:q,onSelectionDrag:W,updateNodePositions:K,nodeExtent:C,snapGrid:z,snapToGrid:F,nodeOrigin:te,onError:Z}=c.getState();g.current={x:P,y:D};let U=!1,Q={x:0,y:0,x2:0,y2:0};if(d.current.length>1&&C){const V=zu(d.current,te);Q=Sa(V)}if(d.current=d.current.map(V=>{const ce={x:P-V.distance.x,y:D-V.distance.y};F&&(ce.x=z[0]*Math.round(ce.x/z[0]),ce.y=z[1]*Math.round(ce.y/z[1]));const $=[[C[0][0],C[0][1]],[C[1][0],C[1][1]]];d.current.length>1&&C&&!V.extent&&($[0][0]=V.positionAbsolute.x-Q.x+C[0][0],$[1][0]=V.positionAbsolute.x+(V.width??0)-Q.x2+C[1][0],$[0][1]=V.positionAbsolute.y-Q.y+C[0][1],$[1][1]=V.positionAbsolute.y+(V.height??0)-Q.y2+C[1][1]);const G=bC(V,ce,M,$,te,Z);return U=U||V.position.x!==G.position.x||V.position.y!==G.position.y,V.position=G.position,V.positionAbsolute=G.positionAbsolute,V}),!U)return;K(d.current,!0,!0),p(!0);const O=o?q:Yd(W);if(O&&_.current){const[V,ce]=Gd({nodeId:o,dragItems:d.current,nodeInternals:M});O(_.current,V,ce)}},I=()=>{if(!w.current)return;const[P,D]=WN(k.current,w.current);if(P!==0||D!==0){const{transform:M,panBy:q}=c.getState();g.current.x=(g.current.x??0)-P/M[2],g.current.y=(g.current.y??0)-D/M[2],q({x:P,y:D})&&A(g.current)}y.current=requestAnimationFrame(I)},L=P=>{var te;const{nodeInternals:D,multiSelectionActive:M,nodesDraggable:q,unselectNodesAndEdges:W,onNodeDragStart:K,onSelectionDragStart:C}=c.getState();S.current=!0;const z=o?K:Yd(C);(!u||!a)&&!M&&o&&((te=D.get(o))!=null&&te.selected||W()),o&&a&&u&&Pv({id:o,store:c,nodeRef:e});const F=N(P);if(g.current=F,d.current=wO(D,q,F,o),z&&d.current){const[Z,U]=Gd({nodeId:o,dragItems:d.current,nodeInternals:D});z(P.sourceEvent,Z,U)}};if(t)j.on(".drag",null);else{const P=R2().on("start",D=>{const{domNode:M,nodeDragThreshold:q}=c.getState();q===0&&L(D),E.current=!1;const W=N(D);g.current=W,w.current=(M==null?void 0:M.getBoundingClientRect())||null,k.current=ys(D.sourceEvent,w.current)}).on("drag",D=>{var K,C;const M=N(D),{autoPanOnNodeDrag:q,nodeDragThreshold:W}=c.getState();if(D.sourceEvent.type==="touchmove"&&D.sourceEvent.touches.length>1&&(E.current=!0),!E.current){if(!b.current&&S.current&&q&&(b.current=!0,I()),!S.current){const z=M.xSnapped-(((K=g==null?void 0:g.current)==null?void 0:K.x)??0),F=M.ySnapped-(((C=g==null?void 0:g.current)==null?void 0:C.y)??0);Math.sqrt(z*z+F*F)>W&&L(D)}(g.current.x!==M.xSnapped||g.current.y!==M.ySnapped)&&d.current&&S.current&&(_.current=D.sourceEvent,k.current=ys(D.sourceEvent,w.current),A(M))}}).on("end",D=>{if(!(!S.current||E.current)&&(p(!1),b.current=!1,S.current=!1,cancelAnimationFrame(y.current),d.current)){const{updateNodePositions:M,nodeInternals:q,onNodeDragStop:W,onSelectionDragStop:K}=c.getState(),C=o?W:Yd(K);if(M(d.current,!1,!1),C){const[z,F]=Gd({nodeId:o,dragItems:d.current,nodeInternals:q});C(D.sourceEvent,z,F)}}}).filter(D=>{const M=D.target;return!D.button&&(!r||!zx(M,`.${r}`,e))&&(!i||zx(M,i,e))});return j.call(P),()=>{j.on(".drag",null)}}}},[e,t,r,i,a,c,o,u,N]),f}function kC(){const e=Mt();return R.useCallback(r=>{const{nodeInternals:i,nodeExtent:o,updateNodePositions:a,getNodes:u,snapToGrid:c,snapGrid:f,onError:p,nodesDraggable:d}=e.getState(),g=u().filter(E=>E.selected&&(E.draggable||d&&typeof E.draggable>"u")),y=c?f[0]:5,w=c?f[1]:5,k=r.isShiftPressed?4:1,_=r.x*y*k,b=r.y*w*k,S=g.map(E=>{if(E.positionAbsolute){const N={x:E.positionAbsolute.x+_,y:E.positionAbsolute.y+b};c&&(N.x=f[0]*Math.round(N.x/f[0]),N.y=f[1]*Math.round(N.y/f[1]));const{positionAbsolute:j,position:A}=bC(E,N,i,o,void 0,p);E.position=A,E.positionAbsolute=j}return E});a(S,!0,!1)},[])}const so={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var la=e=>{const t=({id:r,type:i,data:o,xPos:a,yPos:u,xPosOrigin:c,yPosOrigin:f,selected:p,onClick:d,onMouseEnter:g,onMouseMove:y,onMouseLeave:w,onContextMenu:k,onDoubleClick:_,style:b,className:S,isDraggable:E,isSelectable:N,isConnectable:j,isFocusable:A,selectNodesOnDrag:I,sourcePosition:L,targetPosition:P,hidden:D,resizeObserver:M,dragHandle:q,zIndex:W,isParent:K,noDragClassName:C,noPanClassName:z,initialized:F,disableKeyboardA11y:te,ariaLabel:Z,rfId:U,hasHandleBounds:Q})=>{const O=Mt(),V=R.useRef(null),ce=R.useRef(null),$=R.useRef(L),G=R.useRef(P),ee=R.useRef(i),ie=N||E||d||g||y||w,de=kC(),pe=aa(r,O.getState,g),ne=aa(r,O.getState,y),Pe=aa(r,O.getState,w),He=aa(r,O.getState,k),ze=aa(r,O.getState,_),Oe=ye=>{const{nodeDragThreshold:we}=O.getState();if(N&&(!I||!E||we>0)&&Pv({id:r,store:O,nodeRef:V}),d){const qe=O.getState().nodeInternals.get(r);qe&&d(ye,{...qe})}},_e=ye=>{if(!Rv(ye)&&!te)if(KN.includes(ye.key)&&N){const we=ye.key==="Escape";Pv({id:r,store:O,unselect:we,nodeRef:V})}else E&&p&&Object.prototype.hasOwnProperty.call(so,ye.key)&&(O.setState({ariaLiveMessage:`Moved selected node ${ye.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~a}, y: ${~~u}`}),de({x:so[ye.key].x,y:so[ye.key].y,isShiftPressed:ye.shiftKey}))};R.useEffect(()=>()=>{ce.current&&(M==null||M.unobserve(ce.current),ce.current=null)},[]),R.useEffect(()=>{if(V.current&&!D){const ye=V.current;(!F||!Q||ce.current!==ye)&&(ce.current&&(M==null||M.unobserve(ce.current)),M==null||M.observe(ye),ce.current=ye)}},[D,F,Q]),R.useEffect(()=>{const ye=ee.current!==i,we=$.current!==L,qe=G.current!==P;V.current&&(ye||we||qe)&&(ye&&(ee.current=i),we&&($.current=L),qe&&(G.current=P),O.getState().updateNodeDimensions([{id:r,nodeElement:V.current,forceUpdate:!0}]))},[r,i,L,P]);const Qe=SC({nodeRef:V,disabled:D||!E,noDragClassName:C,handleSelector:q,nodeId:r,isSelectable:N,selectNodesOnDrag:I});return D?null:ue.createElement("div",{className:zt(["react-flow__node",`react-flow__node-${i}`,{[z]:E},S,{selected:p,selectable:N,parent:K,dragging:Qe}]),ref:V,style:{zIndex:W,transform:`translate(${c}px,${f}px)`,pointerEvents:ie?"all":"none",visibility:F?"visible":"hidden",...b},"data-id":r,"data-testid":`rf__node-${r}`,onMouseEnter:pe,onMouseMove:ne,onMouseLeave:Pe,onContextMenu:He,onClick:Oe,onDoubleClick:ze,onKeyDown:A?_e:void 0,tabIndex:A?0:void 0,role:A?"button":void 0,"aria-describedby":te?void 0:`${mC}-${U}`,"aria-label":Z},ue.createElement(OM,{value:r},ue.createElement(e,{id:r,data:o,type:i,xPos:a,yPos:u,selected:p,isConnectable:j,sourcePosition:L,targetPosition:P,dragging:Qe,dragHandle:q,zIndex:W})))};return t.displayName="NodeWrapper",R.memo(t)};const bO=e=>{const t=e.getNodes().filter(r=>r.selected);return{...zu(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function SO({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:r}){const i=Mt(),{width:o,height:a,x:u,y:c,transformString:f,userSelectionActive:p}=it(bO,It),d=kC(),g=R.useRef(null);if(R.useEffect(()=>{var k;r||(k=g.current)==null||k.focus({preventScroll:!0})},[r]),SC({nodeRef:g}),p||!o||!a)return null;const y=e?k=>{const _=i.getState().getNodes().filter(b=>b.selected);e(k,_)}:void 0,w=k=>{Object.prototype.hasOwnProperty.call(so,k.key)&&d({x:so[k.key].x,y:so[k.key].y,isShiftPressed:k.shiftKey})};return ue.createElement("div",{className:zt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:f}},ue.createElement("div",{ref:g,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:r?void 0:-1,onKeyDown:r?void 0:w,style:{width:o,height:a,top:c,left:u}}))}var kO=R.memo(SO);const EO=e=>e.nodesSelectionActive,EC=({children:e,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:o,onPaneContextMenu:a,onPaneScroll:u,deleteKeyCode:c,onMove:f,onMoveStart:p,onMoveEnd:d,selectionKeyCode:g,selectionOnDrag:y,selectionMode:w,onSelectionStart:k,onSelectionEnd:_,multiSelectionKeyCode:b,panActivationKeyCode:S,zoomActivationKeyCode:E,elementsSelectable:N,zoomOnScroll:j,zoomOnPinch:A,panOnScroll:I,panOnScrollSpeed:L,panOnScrollMode:P,zoomOnDoubleClick:D,panOnDrag:M,defaultViewport:q,translateExtent:W,minZoom:K,maxZoom:C,preventScrolling:z,onSelectionContextMenu:F,noWheelClassName:te,noPanClassName:Z,disableKeyboardA11y:U})=>{const Q=it(EO),O=Ea(g),V=Ea(S),ce=V||M,$=V||I,G=O||y&&ce!==!0;return uO({deleteKeyCode:c,multiSelectionKeyCode:b}),ue.createElement(hO,{onMove:f,onMoveStart:p,onMoveEnd:d,onPaneContextMenu:a,elementsSelectable:N,zoomOnScroll:j,zoomOnPinch:A,panOnScroll:$,panOnScrollSpeed:L,panOnScrollMode:P,zoomOnDoubleClick:D,panOnDrag:!O&&ce,defaultViewport:q,translateExtent:W,minZoom:K,maxZoom:C,zoomActivationKeyCode:E,preventScrolling:z,noWheelClassName:te,noPanClassName:Z},ue.createElement(xC,{onSelectionStart:k,onSelectionEnd:_,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:o,onPaneContextMenu:a,onPaneScroll:u,panOnDrag:ce,isSelecting:!!G,selectionMode:w},e,Q&&ue.createElement(kO,{onSelectionContextMenu:F,noPanClassName:Z,disableKeyboardA11y:U})))};EC.displayName="FlowRenderer";var NO=R.memo(EC);function CO(e){return it(R.useCallback(r=>e?nC(r.nodeInternals,{x:0,y:0,width:r.width,height:r.height},r.transform,!0):r.getNodes(),[e]))}function jO(e){const t={input:la(e.input||dC),default:la(e.default||Ov),output:la(e.output||hC),group:la(e.group||uy)},r={},i=Object.keys(e).filter(o=>!["input","default","output","group"].includes(o)).reduce((o,a)=>(o[a]=la(e[a]||Ov),o),r);return{...t,...i}}const TO=({x:e,y:t,width:r,height:i,origin:o})=>!r||!i?{x:e,y:t}:o[0]<0||o[1]<0||o[0]>1||o[1]>1?{x:e,y:t}:{x:e-r*o[0],y:t-i*o[1]},RO=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),NC=e=>{const{nodesDraggable:t,nodesConnectable:r,nodesFocusable:i,elementsSelectable:o,updateNodeDimensions:a,onError:u}=it(RO,It),c=CO(e.onlyRenderVisibleElements),f=R.useRef(),p=R.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const d=new ResizeObserver(g=>{const y=g.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));a(y)});return f.current=d,d},[]);return R.useEffect(()=>()=>{var d;(d=f==null?void 0:f.current)==null||d.disconnect()},[]),ue.createElement("div",{className:"react-flow__nodes",style:cy},c.map(d=>{var A,I,L;let g=d.type||"default";e.nodeTypes[g]||(u==null||u("003",Br.error003(g)),g="default");const y=e.nodeTypes[g]||e.nodeTypes.default,w=!!(d.draggable||t&&typeof d.draggable>"u"),k=!!(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?ry(d.positionAbsolute,e.nodeExtent):d.positionAbsolute,E=(S==null?void 0:S.x)??0,N=(S==null?void 0:S.y)??0,j=TO({x:E,y:N,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:g,data:d.data,sourcePosition:d.sourcePosition||Re.Bottom,targetPosition:d.targetPosition||Re.Top,hidden:d.hidden,xPos:E,yPos:N,xPosOrigin:j.x,yPosOrigin:j.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:k,isConnectable:_,isFocusable:b,resizeObserver:p,dragHandle:d.dragHandle,zIndex:((A=d[St])==null?void 0:A.z)??0,isParent:!!((I=d[St])!=null&&I.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!d.width&&!!d.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:d.ariaLabel,hasHandleBounds:!!((L=d[St])!=null&&L.handleBounds)})}))};NC.displayName="NodeRenderer";var AO=R.memo(NC);const IO=(e,t,r)=>r===Re.Left?e-t:r===Re.Right?e+t:e,MO=(e,t,r)=>r===Re.Top?e-t:r===Re.Bottom?e+t:e,Ux="react-flow__edgeupdater",Hx=({position:e,centerX:t,centerY:r,radius:i=10,onMouseDown:o,onMouseEnter:a,onMouseOut:u,type:c})=>ue.createElement("circle",{onMouseDown:o,onMouseEnter:a,onMouseOut:u,className:zt([Ux,`${Ux}-${c}`]),cx:IO(t,i,e),cy:MO(r,i,e),r:i,stroke:"transparent",fill:"transparent"}),OO=()=>!0;var Xi=e=>{const t=({id:r,className:i,type:o,data:a,onClick:u,onEdgeDoubleClick:c,selected:f,animated:p,label:d,labelStyle:g,labelShowBg:y,labelBgStyle:w,labelBgPadding:k,labelBgBorderRadius:_,style:b,source:S,target:E,sourceX:N,sourceY:j,targetX:A,targetY:I,sourcePosition:L,targetPosition:P,elementsSelectable:D,hidden:M,sourceHandleId:q,targetHandleId:W,onContextMenu:K,onMouseEnter:C,onMouseMove:z,onMouseLeave:F,reconnectRadius:te,onReconnect:Z,onReconnectStart:U,onReconnectEnd:Q,markerEnd:O,markerStart:V,rfId:ce,ariaLabel:$,isFocusable:G,isReconnectable:ee,pathOptions:ie,interactionWidth:de,disableKeyboardA11y:pe})=>{const ne=R.useRef(null),[Pe,He]=R.useState(!1),[ze,Oe]=R.useState(!1),_e=Mt(),Qe=R.useMemo(()=>`url('#${Iv(V,ce)}')`,[V,ce]),ye=R.useMemo(()=>`url('#${Iv(O,ce)}')`,[O,ce]);if(M)return null;const we=Fe=>{var ut;const{edges:Ze,addSelectedEdges:lt,unselectNodesAndEdges:ke,multiSelectionActive:rt}=_e.getState(),tt=Ze.find(zn=>zn.id===r);tt&&(D&&(_e.setState({nodesSelectionActive:!1}),tt.selected&&rt?(ke({nodes:[],edges:[tt]}),(ut=ne.current)==null||ut.blur()):lt([r])),u&&u(Fe,tt))},qe=oa(r,_e.getState,c),dt=oa(r,_e.getState,K),Ae=oa(r,_e.getState,C),ot=oa(r,_e.getState,z),We=oa(r,_e.getState,F),Ye=(Fe,Ze)=>{if(Fe.button!==0)return;const{edges:lt,isValidConnection:ke}=_e.getState(),rt=Ze?E:S,tt=(Ze?W:q)||null,ut=Ze?"target":"source",zn=ke||OO,_r=Ze,Sn=lt.find(kn=>kn.id===r);Oe(!0),U==null||U(Fe,Sn,ut);const mn=kn=>{Oe(!1),Q==null||Q(kn,Sn,ut)};aC({event:Fe,handleId:tt,nodeId:rt,onConnect:kn=>Z==null?void 0:Z(Sn,kn),isTarget:_r,getState:_e.getState,setState:_e.setState,isValidConnection:zn,edgeUpdaterType:ut,onReconnectEnd:mn})},pt=Fe=>Ye(Fe,!0),_t=Fe=>Ye(Fe,!1),se=()=>He(!0),$e=()=>He(!1),De=!D&&!u,Te=Fe=>{var Ze;if(!pe&&KN.includes(Fe.key)&&D){const{unselectNodesAndEdges:lt,addSelectedEdges:ke,edges:rt}=_e.getState();Fe.key==="Escape"?((Ze=ne.current)==null||Ze.blur(),lt({edges:[rt.find(ut=>ut.id===r)]})):ke([r])}};return ue.createElement("g",{className:zt(["react-flow__edge",`react-flow__edge-${o}`,i,{selected:f,animated:p,inactive:De,updating:Pe}]),onClick:we,onDoubleClick:qe,onContextMenu:dt,onMouseEnter:Ae,onMouseMove:ot,onMouseLeave:We,onKeyDown:G?Te:void 0,tabIndex:G?0:void 0,role:G?"button":"img","data-testid":`rf__edge-${r}`,"aria-label":$===null?void 0:$||`Edge from ${S} to ${E}`,"aria-describedby":G?`${gC}-${ce}`:void 0,ref:ne},!ze&&ue.createElement(e,{id:r,source:S,target:E,selected:f,animated:p,label:d,labelStyle:g,labelShowBg:y,labelBgStyle:w,labelBgPadding:k,labelBgBorderRadius:_,data:a,style:b,sourceX:N,sourceY:j,targetX:A,targetY:I,sourcePosition:L,targetPosition:P,sourceHandleId:q,targetHandleId:W,markerStart:Qe,markerEnd:ye,pathOptions:ie,interactionWidth:de}),ee&&ue.createElement(ue.Fragment,null,(ee==="source"||ee===!0)&&ue.createElement(Hx,{position:L,centerX:N,centerY:j,radius:te,onMouseDown:pt,onMouseEnter:se,onMouseOut:$e,type:"source"}),(ee==="target"||ee===!0)&&ue.createElement(Hx,{position:P,centerX:A,centerY:I,radius:te,onMouseDown:_t,onMouseEnter:se,onMouseOut:$e,type:"target"})))};return t.displayName="EdgeWrapper",R.memo(t)};function PO(e){const t={default:Xi(e.default||ju),straight:Xi(e.bezier||oy),step:Xi(e.step||iy),smoothstep:Xi(e.step||Fu),simplebezier:Xi(e.simplebezier||sy)},r={},i=Object.keys(e).filter(o=>!["default","bezier"].includes(o)).reduce((o,a)=>(o[a]=Xi(e[a]||ju),o),r);return{...t,...i}}function Wx(e,t,r=null){const i=((r==null?void 0:r.x)||0)+t.x,o=((r==null?void 0:r.y)||0)+t.y,a=(r==null?void 0:r.width)||t.width,u=(r==null?void 0:r.height)||t.height;switch(e){case Re.Top:return{x:i+a/2,y:o};case Re.Right:return{x:i+a,y:o+u/2};case Re.Bottom:return{x:i+a/2,y:o+u};case Re.Left:return{x:i,y:o+u/2}}}function Vx(e,t){return e?e.length===1||!t?e[0]:t&&e.find(r=>r.id===t)||null:null}const LO=(e,t,r,i,o,a)=>{const u=Wx(r,e,t),c=Wx(a,i,o);return{sourceX:u.x,sourceY:u.y,targetX:c.x,targetY:c.y}};function $O({sourcePos:e,targetPos:t,sourceWidth:r,sourceHeight:i,targetWidth:o,targetHeight:a,width:u,height:c,transform:f}){const p={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+r,t.x+o),y2:Math.max(e.y+i,t.y+a)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const d=Sa({x:(0-f[0])/f[2],y:(0-f[1])/f[2],width:u/f[2],height:c/f[2]}),g=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(g*y)>0}function Gx(e){var i,o,a,u,c;const t=((i=e==null?void 0:e[St])==null?void 0:i.handleBounds)||null,r=t&&(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((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.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},t,!!r]}const qO=[{level:0,isMaxLevel:!0,edges:[]}];function DO(e,t,r=!1){let i=-1;const o=e.reduce((u,c)=>{var d,g;const f=qn(c.zIndex);let p=f?c.zIndex:0;if(r){const y=t.get(c.target),w=t.get(c.source),k=c.selected||(y==null?void 0:y.selected)||(w==null?void 0:w.selected),_=Math.max(((d=w==null?void 0:w[St])==null?void 0:d.z)||0,((g=y==null?void 0:y[St])==null?void 0:g.z)||0,1e3);p=(f?c.zIndex:0)+(k?_:0)}return u[p]?u[p].push(c):u[p]=[c],i=p>i?p:i,u},{}),a=Object.entries(o).map(([u,c])=>{const f=+u;return{edges:c,level:f,isMaxLevel:f===i}});return a.length===0?qO:a}function FO(e,t,r){const i=it(R.useCallback(o=>e?o.edges.filter(a=>{const u=t.get(a.source),c=t.get(a.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)&&$O({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,t]));return DO(i,t,r)}const zO=({color:e="none",strokeWidth:t=1})=>ue.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),BO=({color:e="none",strokeWidth:t=1})=>ue.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),Yx={[Cu.Arrow]:zO,[Cu.ArrowClosed]:BO};function UO(e){const t=Mt();return R.useMemo(()=>{var o,a;return Object.prototype.hasOwnProperty.call(Yx,e)?Yx[e]:((a=(o=t.getState()).onError)==null||a.call(o,"009",Br.error009(e)),null)},[e])}const HO=({id:e,type:t,color:r,width:i=12.5,height:o=12.5,markerUnits:a="strokeWidth",strokeWidth:u,orient:c="auto-start-reverse"})=>{const f=UO(t);return f?ue.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${i}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:c,refX:"0",refY:"0"},ue.createElement(f,{color:r,strokeWidth:u})):null},WO=({defaultColor:e,rfId:t})=>r=>{const i=[];return r.edges.reduce((o,a)=>([a.markerStart,a.markerEnd].forEach(u=>{if(u&&typeof u=="object"){const c=Iv(u,t);i.includes(c)||(o.push({id:c,color:u.color||e,...u}),i.push(c))}}),o),[]).sort((o,a)=>o.id.localeCompare(a.id))},CC=({defaultColor:e,rfId:t})=>{const r=it(R.useCallback(WO({defaultColor:e,rfId:t}),[e,t]),(i,o)=>!(i.length!==o.length||i.some((a,u)=>a.id!==o[u].id)));return ue.createElement("defs",null,r.map(i=>ue.createElement(HO,{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})))};CC.displayName="MarkerDefinitions";var VO=R.memo(CC);const GO=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}),jC=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:r,rfId:i,edgeTypes:o,noPanClassName:a,onEdgeContextMenu:u,onEdgeMouseEnter:c,onEdgeMouseMove:f,onEdgeMouseLeave:p,onEdgeClick:d,onEdgeDoubleClick:g,onReconnect:y,onReconnectStart:w,onReconnectEnd:k,reconnectRadius:_,children:b,disableKeyboardA11y:S})=>{const{edgesFocusable:E,edgesUpdatable:N,elementsSelectable:j,width:A,height:I,connectionMode:L,nodeInternals:P,onError:D}=it(GO,It),M=FO(t,P,r);return A?ue.createElement(ue.Fragment,null,M.map(({level:q,edges:W,isMaxLevel:K})=>ue.createElement("svg",{key:q,style:{zIndex:q},width:A,height:I,className:"react-flow__edges react-flow__container"},K&&ue.createElement(VO,{defaultColor:e,rfId:i}),ue.createElement("g",null,W.map(C=>{const[z,F,te]=Gx(P.get(C.source)),[Z,U,Q]=Gx(P.get(C.target));if(!te||!Q)return null;let O=C.type||"default";o[O]||(D==null||D("011",Br.error011(O)),O="default");const V=o[O]||o.default,ce=L===ti.Strict?U.target:(U.target??[]).concat(U.source??[]),$=Vx(F.source,C.sourceHandle),G=Vx(ce,C.targetHandle),ee=($==null?void 0:$.position)||Re.Bottom,ie=(G==null?void 0:G.position)||Re.Top,de=!!(C.focusable||E&&typeof C.focusable>"u"),pe=C.reconnectable||C.updatable,ne=typeof y<"u"&&(pe||N&&typeof pe>"u");if(!$||!G)return D==null||D("008",Br.error008($,C)),null;const{sourceX:Pe,sourceY:He,targetX:ze,targetY:Oe}=LO(z,$,ee,Z,G,ie);return ue.createElement(V,{key:C.id,id:C.id,className:zt([C.className,a]),type:O,data:C.data,selected:!!C.selected,animated:!!C.animated,hidden:!!C.hidden,label:C.label,labelStyle:C.labelStyle,labelShowBg:C.labelShowBg,labelBgStyle:C.labelBgStyle,labelBgPadding:C.labelBgPadding,labelBgBorderRadius:C.labelBgBorderRadius,style:C.style,source:C.source,target:C.target,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle,markerEnd:C.markerEnd,markerStart:C.markerStart,sourceX:Pe,sourceY:He,targetX:ze,targetY:Oe,sourcePosition:ee,targetPosition:ie,elementsSelectable:j,onContextMenu:u,onMouseEnter:c,onMouseMove:f,onMouseLeave:p,onClick:d,onEdgeDoubleClick:g,onReconnect:y,onReconnectStart:w,onReconnectEnd:k,reconnectRadius:_,rfId:i,ariaLabel:C.ariaLabel,isFocusable:de,isReconnectable:ne,pathOptions:"pathOptions"in C?C.pathOptions:void 0,interactionWidth:C.interactionWidth,disableKeyboardA11y:S})})))),b):null};jC.displayName="EdgeRenderer";var YO=R.memo(jC);const KO=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function XO({children:e}){const t=it(KO);return ue.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function QO(e){const t=Ma(),r=R.useRef(!1);R.useEffect(()=>{!r.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),r.current=!0)},[e,t.viewportInitialized])}const ZO={[Re.Left]:Re.Right,[Re.Right]:Re.Left,[Re.Top]:Re.Bottom,[Re.Bottom]:Re.Top},TC=({nodeId:e,handleType:t,style:r,type:i=vs.Bezier,CustomComponent:o,connectionStatus:a})=>{var I,L,P;const{fromNode:u,handleId:c,toX:f,toY:p,connectionMode:d}=it(R.useCallback(D=>({fromNode:D.nodeInternals.get(e),handleId:D.connectionHandleId,toX:(D.connectionPosition.x-D.transform[0])/D.transform[2],toY:(D.connectionPosition.y-D.transform[1])/D.transform[2],connectionMode:D.connectionMode}),[e]),It),g=(I=u==null?void 0:u[St])==null?void 0:I.handleBounds;let y=g==null?void 0:g[t];if(d===ti.Loose&&(y=y||(g==null?void 0:g[t==="source"?"target":"source"])),!u||!y)return null;const w=c?y.find(D=>D.id===c):y[0],k=w?w.x+w.width/2:(u.width??0)/2,_=w?w.y+w.height/2:u.height??0,b=(((L=u.positionAbsolute)==null?void 0:L.x)??0)+k,S=(((P=u.positionAbsolute)==null?void 0:P.y)??0)+_,E=w==null?void 0:w.position,N=E?ZO[E]:null;if(!E||!N)return null;if(o)return ue.createElement(o,{connectionLineType:i,connectionLineStyle:r,fromNode:u,fromHandle:w,fromX:b,fromY:S,toX:f,toY:p,fromPosition:E,toPosition:N,connectionStatus:a});let j="";const A={sourceX:b,sourceY:S,sourcePosition:E,targetX:f,targetY:p,targetPosition:N};return i===vs.Bezier?[j]=eC(A):i===vs.Step?[j]=Av({...A,borderRadius:0}):i===vs.SmoothStep?[j]=Av(A):i===vs.SimpleBezier?[j]=JN(A):j=`M${b},${S} ${f},${p}`,ue.createElement("path",{d:j,fill:"none",className:"react-flow__connection-path",style:r})};TC.displayName="ConnectionLine";const JO=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function eP({containerStyle:e,style:t,type:r,component:i}){const{nodeId:o,handleType:a,nodesConnectable:u,width:c,height:f,connectionStatus:p}=it(JO,It);return!(o&&a&&c&&u)?null:ue.createElement("svg",{style:e,width:c,height:f,className:"react-flow__edges react-flow__connectionline react-flow__container"},ue.createElement("g",{className:zt(["react-flow__connection",p])},ue.createElement(TC,{nodeId:o,handleType:a,style:t,type:r,CustomComponent:i,connectionStatus:p})))}function Kx(e,t){return R.useRef(null),Mt(),R.useMemo(()=>t(e),[e])}const RC=({nodeTypes:e,edgeTypes:t,onMove:r,onMoveStart:i,onMoveEnd:o,onInit:a,onNodeClick:u,onEdgeClick:c,onNodeDoubleClick:f,onEdgeDoubleClick:p,onNodeMouseEnter:d,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:w,onSelectionContextMenu:k,onSelectionStart:_,onSelectionEnd:b,connectionLineType:S,connectionLineStyle:E,connectionLineComponent:N,connectionLineContainerStyle:j,selectionKeyCode:A,selectionOnDrag:I,selectionMode:L,multiSelectionKeyCode:P,panActivationKeyCode:D,zoomActivationKeyCode:M,deleteKeyCode:q,onlyRenderVisibleElements:W,elementsSelectable:K,selectNodesOnDrag:C,defaultViewport:z,translateExtent:F,minZoom:te,maxZoom:Z,preventScrolling:U,defaultMarkerColor:Q,zoomOnScroll:O,zoomOnPinch:V,panOnScroll:ce,panOnScrollSpeed:$,panOnScrollMode:G,zoomOnDoubleClick:ee,panOnDrag:ie,onPaneClick:de,onPaneMouseEnter:pe,onPaneMouseMove:ne,onPaneMouseLeave:Pe,onPaneScroll:He,onPaneContextMenu:ze,onEdgeContextMenu:Oe,onEdgeMouseEnter:_e,onEdgeMouseMove:Qe,onEdgeMouseLeave:ye,onReconnect:we,onReconnectStart:qe,onReconnectEnd:dt,reconnectRadius:Ae,noDragClassName:ot,noWheelClassName:We,noPanClassName:Ye,elevateEdgesOnSelect:pt,disableKeyboardA11y:_t,nodeOrigin:se,nodeExtent:$e,rfId:De})=>{const Te=Kx(e,jO),Fe=Kx(t,PO);return QO(a),ue.createElement(NO,{onPaneClick:de,onPaneMouseEnter:pe,onPaneMouseMove:ne,onPaneMouseLeave:Pe,onPaneContextMenu:ze,onPaneScroll:He,deleteKeyCode:q,selectionKeyCode:A,selectionOnDrag:I,selectionMode:L,onSelectionStart:_,onSelectionEnd:b,multiSelectionKeyCode:P,panActivationKeyCode:D,zoomActivationKeyCode:M,elementsSelectable:K,onMove:r,onMoveStart:i,onMoveEnd:o,zoomOnScroll:O,zoomOnPinch:V,zoomOnDoubleClick:ee,panOnScroll:ce,panOnScrollSpeed:$,panOnScrollMode:G,panOnDrag:ie,defaultViewport:z,translateExtent:F,minZoom:te,maxZoom:Z,onSelectionContextMenu:k,preventScrolling:U,noDragClassName:ot,noWheelClassName:We,noPanClassName:Ye,disableKeyboardA11y:_t},ue.createElement(XO,null,ue.createElement(YO,{edgeTypes:Fe,onEdgeClick:c,onEdgeDoubleClick:p,onlyRenderVisibleElements:W,onEdgeContextMenu:Oe,onEdgeMouseEnter:_e,onEdgeMouseMove:Qe,onEdgeMouseLeave:ye,onReconnect:we,onReconnectStart:qe,onReconnectEnd:dt,reconnectRadius:Ae,defaultMarkerColor:Q,noPanClassName:Ye,elevateEdgesOnSelect:!!pt,disableKeyboardA11y:_t,rfId:De},ue.createElement(eP,{style:E,type:S,component:N,containerStyle:j})),ue.createElement("div",{className:"react-flow__edgelabel-renderer"}),ue.createElement(AO,{nodeTypes:Te,onNodeClick:u,onNodeDoubleClick:f,onNodeMouseEnter:d,onNodeMouseMove:g,onNodeMouseLeave:y,onNodeContextMenu:w,selectNodesOnDrag:C,onlyRenderVisibleElements:W,noPanClassName:Ye,noDragClassName:ot,disableKeyboardA11y:_t,nodeOrigin:se,nodeExtent:$e,rfId:De})))};RC.displayName="GraphView";var tP=R.memo(RC);const Lv=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ps={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:Lv,nodeExtent:Lv,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:ti.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:jM,isValidConnection:void 0},nP=()=>BR((e,t)=>({...ps,setNodes:r=>{const{nodeInternals:i,nodeOrigin:o,elevateNodesOnSelect:a}=t();e({nodeInternals:Wd(r,i,o,a)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:r=>{const{defaultEdgeOptions:i={}}=t();e({edges:r.map(o=>({...i,...o}))})},setDefaultNodesAndEdges:(r,i)=>{const o=typeof r<"u",a=typeof i<"u",u=o?Wd(r,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:u,edges:a?i:[],hasDefaultNodes:o,hasDefaultEdges:a})},updateNodeDimensions:r=>{const{onNodesChange:i,nodeInternals:o,fitViewOnInit:a,fitViewOnInitDone:u,fitViewOnInitOptions:c,domNode:f,nodeOrigin:p}=t(),d=f==null?void 0:f.querySelector(".react-flow__viewport");if(!d)return;const g=window.getComputedStyle(d),{m22:y}=new window.DOMMatrixReadOnly(g.transform),w=r.reduce((_,b)=>{const S=o.get(b.id);if(S!=null&&S.hidden)o.set(S.id,{...S,[St]:{...S[St],handleBounds:void 0}});else if(S){const E=ny(b.nodeElement);!!(E.width&&E.height&&(S.width!==E.width||S.height!==E.height||b.forceUpdate))&&(o.set(S.id,{...S,[St]:{...S[St],handleBounds:{source:Bx(".source",b.nodeElement,y,p),target:Bx(".target",b.nodeElement,y,p)}},...E}),_.push({id:S.id,type:"dimensions",dimensions:E}))}return _},[]);yC(o,p);const k=u||a&&!u&&wC(t,{initial:!0,...c});e({nodeInternals:new Map(o),fitViewOnInitDone:k}),(w==null?void 0:w.length)>0&&(i==null||i(w))},updateNodePositions:(r,i=!0,o=!1)=>{const{triggerNodeChanges:a}=t(),u=r.map(c=>{const f={id:c.id,type:"position",dragging:o};return i&&(f.positionAbsolute=c.positionAbsolute,f.position=c.position),f});a(u)},triggerNodeChanges:r=>{const{onNodesChange:i,nodeInternals:o,hasDefaultNodes:a,nodeOrigin:u,getNodes:c,elevateNodesOnSelect:f}=t();if(r!=null&&r.length){if(a){const p=vO(r,c()),d=Wd(p,o,u,f);e({nodeInternals:d})}i==null||i(r)}},addSelectedNodes:r=>{const{multiSelectionActive:i,edges:o,getNodes:a}=t();let u,c=null;i?u=r.map(f=>gs(f,!0)):(u=eo(a(),r),c=eo(o,[])),su({changedNodes:u,changedEdges:c,get:t,set:e})},addSelectedEdges:r=>{const{multiSelectionActive:i,edges:o,getNodes:a}=t();let u,c=null;i?u=r.map(f=>gs(f,!0)):(u=eo(o,r),c=eo(a(),[])),su({changedNodes:c,changedEdges:u,get:t,set:e})},unselectNodesAndEdges:({nodes:r,edges:i}={})=>{const{edges:o,getNodes:a}=t(),u=r||a(),c=i||o,f=u.map(d=>(d.selected=!1,gs(d.id,!1))),p=c.map(d=>gs(d.id,!1));su({changedNodes:f,changedEdges:p,get:t,set:e})},setMinZoom:r=>{const{d3Zoom:i,maxZoom:o}=t();i==null||i.scaleExtent([r,o]),e({minZoom:r})},setMaxZoom:r=>{const{d3Zoom:i,minZoom:o}=t();i==null||i.scaleExtent([o,r]),e({maxZoom:r})},setTranslateExtent:r=>{var i;(i=t().d3Zoom)==null||i.translateExtent(r),e({translateExtent:r})},resetSelectedElements:()=>{const{edges:r,getNodes:i}=t(),a=i().filter(c=>c.selected).map(c=>gs(c.id,!1)),u=r.filter(c=>c.selected).map(c=>gs(c.id,!1));su({changedNodes:a,changedEdges:u,get:t,set:e})},setNodeExtent:r=>{const{nodeInternals:i}=t();i.forEach(o=>{o.positionAbsolute=ry(o.position,r)}),e({nodeExtent:r,nodeInternals:new Map(i)})},panBy:r=>{const{transform:i,width:o,height:a,d3Zoom:u,d3Selection:c,translateExtent:f}=t();if(!u||!c||!r.x&&!r.y)return!1;const p=Fr.translate(i[0]+r.x,i[1]+r.y).scale(i[2]),d=[[0,0],[o,a]],g=u==null?void 0:u.constrain()(p,d,f);return u.transform(c,g),i[0]!==g.x||i[1]!==g.y||i[2]!==g.k},cancelConnection:()=>e({connectionNodeId:ps.connectionNodeId,connectionHandleId:ps.connectionHandleId,connectionHandleType:ps.connectionHandleType,connectionStatus:ps.connectionStatus,connectionStartHandle:ps.connectionStartHandle,connectionEndHandle:ps.connectionEndHandle}),reset:()=>e({...ps})}),Object.is),dy=({children:e})=>{const t=R.useRef(null);return t.current||(t.current=nP()),ue.createElement(_M,{value:t.current},e)};dy.displayName="ReactFlowProvider";const AC=({children:e})=>R.useContext(Du)?ue.createElement(ue.Fragment,null,e):ue.createElement(dy,null,e);AC.displayName="ReactFlowWrapper";const rP={input:dC,default:Ov,output:hC,group:uy},sP={default:ju,straight:oy,step:iy,smoothstep:Fu,simplebezier:sy},iP=[0,0],oP=[15,15],aP={x:0,y:0,zoom:1},lP={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},IC=R.forwardRef(({nodes:e,edges:t,defaultNodes:r,defaultEdges:i,className:o,nodeTypes:a=rP,edgeTypes:u=sP,onNodeClick:c,onEdgeClick:f,onInit:p,onMove:d,onMoveStart:g,onMoveEnd:y,onConnect:w,onConnectStart:k,onConnectEnd:_,onClickConnectStart:b,onClickConnectEnd:S,onNodeMouseEnter:E,onNodeMouseMove:N,onNodeMouseLeave:j,onNodeContextMenu:A,onNodeDoubleClick:I,onNodeDragStart:L,onNodeDrag:P,onNodeDragStop:D,onNodesDelete:M,onEdgesDelete:q,onSelectionChange:W,onSelectionDragStart:K,onSelectionDrag:C,onSelectionDragStop:z,onSelectionContextMenu:F,onSelectionStart:te,onSelectionEnd:Z,connectionMode:U=ti.Strict,connectionLineType:Q=vs.Bezier,connectionLineStyle:O,connectionLineComponent:V,connectionLineContainerStyle:ce,deleteKeyCode:$="Backspace",selectionKeyCode:G="Shift",selectionOnDrag:ee=!1,selectionMode:ie=ka.Full,panActivationKeyCode:de="Space",multiSelectionKeyCode:pe=Nu()?"Meta":"Control",zoomActivationKeyCode:ne=Nu()?"Meta":"Control",snapToGrid:Pe=!1,snapGrid:He=oP,onlyRenderVisibleElements:ze=!1,selectNodesOnDrag:Oe=!0,nodesDraggable:_e,nodesConnectable:Qe,nodesFocusable:ye,nodeOrigin:we=iP,edgesFocusable:qe,edgesUpdatable:dt,elementsSelectable:Ae,defaultViewport:ot=aP,minZoom:We=.5,maxZoom:Ye=2,translateExtent:pt=Lv,preventScrolling:_t=!0,nodeExtent:se,defaultMarkerColor:$e="#b1b1b7",zoomOnScroll:De=!0,zoomOnPinch:Te=!0,panOnScroll:Fe=!1,panOnScrollSpeed:Ze=.5,panOnScrollMode:lt=Qs.Free,zoomOnDoubleClick:ke=!0,panOnDrag:rt=!0,onPaneClick:tt,onPaneMouseEnter:ut,onPaneMouseMove:zn,onPaneMouseLeave:_r,onPaneScroll:Sn,onPaneContextMenu:mn,children:gn,onEdgeContextMenu:kn,onEdgeDoubleClick:_s,onEdgeMouseEnter:bs,onEdgeMouseMove:li,onEdgeMouseLeave:Ss,onEdgeUpdate:Bn,onEdgeUpdateStart:ui,onEdgeUpdateEnd:or,onReconnect:ar,onReconnectStart:En,onReconnectEnd:wo,reconnectRadius:Un=10,edgeUpdaterRadius:mt=10,onNodesChange:Wr,onEdgesChange:Hn,noDragClassName:xo="nodrag",noWheelClassName:_o="nowheel",noPanClassName:Nn="nopan",fitView:en=!1,fitViewOptions:ci,connectOnClick:di=!0,attributionPosition:fi,proOptions:ks,defaultEdgeOptions:Wn,elevateNodesOnSelect:Es=!0,elevateEdgesOnSelect:Ns=!1,disableKeyboardA11y:br=!1,autoPanOnConnect:hi=!0,autoPanOnNodeDrag:at=!0,connectionRadius:qt=20,isValidConnection:lr,onError:Sr,style:kr,id:pi,nodeDragThreshold:ur,...Er},Gt)=>{const Cs=pi||"1";return ue.createElement("div",{...Er,style:{...kr,...lP},ref:Gt,className:zt(["react-flow",o]),"data-testid":"rf__wrapper",id:pi},ue.createElement(AC,null,ue.createElement(tP,{onInit:p,onMove:d,onMoveStart:g,onMoveEnd:y,onNodeClick:c,onEdgeClick:f,onNodeMouseEnter:E,onNodeMouseMove:N,onNodeMouseLeave:j,onNodeContextMenu:A,onNodeDoubleClick:I,nodeTypes:a,edgeTypes:u,connectionLineType:Q,connectionLineStyle:O,connectionLineComponent:V,connectionLineContainerStyle:ce,selectionKeyCode:G,selectionOnDrag:ee,selectionMode:ie,deleteKeyCode:$,multiSelectionKeyCode:pe,panActivationKeyCode:de,zoomActivationKeyCode:ne,onlyRenderVisibleElements:ze,selectNodesOnDrag:Oe,defaultViewport:ot,translateExtent:pt,minZoom:We,maxZoom:Ye,preventScrolling:_t,zoomOnScroll:De,zoomOnPinch:Te,zoomOnDoubleClick:ke,panOnScroll:Fe,panOnScrollSpeed:Ze,panOnScrollMode:lt,panOnDrag:rt,onPaneClick:tt,onPaneMouseEnter:ut,onPaneMouseMove:zn,onPaneMouseLeave:_r,onPaneScroll:Sn,onPaneContextMenu:mn,onSelectionContextMenu:F,onSelectionStart:te,onSelectionEnd:Z,onEdgeContextMenu:kn,onEdgeDoubleClick:_s,onEdgeMouseEnter:bs,onEdgeMouseMove:li,onEdgeMouseLeave:Ss,onReconnect:ar??Bn,onReconnectStart:En??ui,onReconnectEnd:wo??or,reconnectRadius:Un??mt,defaultMarkerColor:$e,noDragClassName:xo,noWheelClassName:_o,noPanClassName:Nn,elevateEdgesOnSelect:Ns,rfId:Cs,disableKeyboardA11y:br,nodeOrigin:we,nodeExtent:se}),ue.createElement(QM,{nodes:e,edges:t,defaultNodes:r,defaultEdges:i,onConnect:w,onConnectStart:k,onConnectEnd:_,onClickConnectStart:b,onClickConnectEnd:S,nodesDraggable:_e,nodesConnectable:Qe,nodesFocusable:ye,edgesFocusable:qe,edgesUpdatable:dt,elementsSelectable:Ae,elevateNodesOnSelect:Es,minZoom:We,maxZoom:Ye,nodeExtent:se,onNodesChange:Wr,onEdgesChange:Hn,snapToGrid:Pe,snapGrid:He,connectionMode:U,translateExtent:pt,connectOnClick:di,defaultEdgeOptions:Wn,fitView:en,fitViewOptions:ci,onNodesDelete:M,onEdgesDelete:q,onNodeDragStart:L,onNodeDrag:P,onNodeDragStop:D,onSelectionDrag:C,onSelectionDragStart:K,onSelectionDragStop:z,noPanClassName:Nn,nodeOrigin:we,rfId:Cs,autoPanOnConnect:hi,autoPanOnNodeDrag:at,onError:Sr,connectionRadius:qt,isValidConnection:lr,nodeDragThreshold:ur}),ue.createElement(KM,{onSelectionChange:W}),gn,ue.createElement(SM,{proOptions:ks,position:fi}),ue.createElement(nO,{rfId:Cs,disableKeyboardA11y:br})))});IC.displayName="ReactFlow";const uP=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function MC(){return it(uP,It)}const OC=({id:e,x:t,y:r,width:i,height:o,style:a,color:u,strokeColor:c,strokeWidth:f,className:p,borderRadius:d,shapeRendering:g,onClick:y,selected:w})=>{const{background:k,backgroundColor:_}=a||{},b=u||k||_;return ue.createElement("rect",{className:zt(["react-flow__minimap-node",{selected:w},p]),x:t,y:r,rx:d,ry:d,width:i,height:o,fill:b,stroke:c,strokeWidth:f,shapeRendering:g,onClick:y?S=>y(S,e):void 0})};OC.displayName="MiniMapNode";var cP=R.memo(OC);const dP=e=>e.nodeOrigin,fP=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),Kd=e=>e instanceof Function?e:()=>e;function hP({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:o=2,nodeComponent:a=cP,onClick:u}){const c=it(fP,It),f=it(dP),p=Kd(t),d=Kd(e),g=Kd(r),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return ue.createElement(ue.Fragment,null,c.map(w=>{const{x:k,y:_}=Js(w,f).positionAbsolute;return ue.createElement(a,{key:w.id,x:k,y:_,width:w.width,height:w.height,style:w.style,selected:w.selected,className:g(w),color:p(w),borderRadius:i,strokeColor:d(w),strokeWidth:o,shapeRendering:y,onClick:u,id:w.id})}))}var pP=R.memo(hP);const mP=200,gP=150,vP=e=>{const t=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:t.length>0?NM(zu(t,e.nodeOrigin),r):r,rfId:e.rfId}},yP="react-flow__minimap-desc";function PC({style:e,className:t,nodeStrokeColor:r="transparent",nodeColor:i="#e2e2e2",nodeClassName:o="",nodeBorderRadius:a=5,nodeStrokeWidth:u=2,nodeComponent:c,maskColor:f="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:d=1,position:g="bottom-right",onClick:y,onNodeClick:w,pannable:k=!1,zoomable:_=!1,ariaLabel:b="React Flow mini map",inversePan:S=!1,zoomStep:E=10,offsetScale:N=5}){const j=Mt(),A=R.useRef(null),{boundingRect:I,viewBB:L,rfId:P}=it(vP,It),D=(e==null?void 0:e.width)??mP,M=(e==null?void 0:e.height)??gP,q=I.width/D,W=I.height/M,K=Math.max(q,W),C=K*D,z=K*M,F=N*K,te=I.x-(C-I.width)/2-F,Z=I.y-(z-I.height)/2-F,U=C+F*2,Q=z+F*2,O=`${yP}-${P}`,V=R.useRef(0);V.current=K,R.useEffect(()=>{if(A.current){const G=$n(A.current),ee=pe=>{const{transform:ne,d3Selection:Pe,d3Zoom:He}=j.getState();if(pe.sourceEvent.type!=="wheel"||!Pe||!He)return;const ze=-pe.sourceEvent.deltaY*(pe.sourceEvent.deltaMode===1?.05:pe.sourceEvent.deltaMode?1:.002)*E,Oe=ne[2]*Math.pow(2,ze);He.scaleTo(Pe,Oe)},ie=pe=>{const{transform:ne,d3Selection:Pe,d3Zoom:He,translateExtent:ze,width:Oe,height:_e}=j.getState();if(pe.sourceEvent.type!=="mousemove"||!Pe||!He)return;const Qe=V.current*Math.max(1,ne[2])*(S?-1:1),ye={x:ne[0]-pe.sourceEvent.movementX*Qe,y:ne[1]-pe.sourceEvent.movementY*Qe},we=[[0,0],[Oe,_e]],qe=Fr.translate(ye.x,ye.y).scale(ne[2]),dt=He.constrain()(qe,we,ze);He.transform(Pe,dt)},de=UN().on("zoom",k?ie:null).on("zoom.wheel",_?ee:null);return G.call(de),()=>{G.on("zoom",null)}}},[k,_,S,E]);const ce=y?G=>{const ee=er(G);y(G,{x:ee[0],y:ee[1]})}:void 0,$=w?(G,ee)=>{const ie=j.getState().nodeInternals.get(ee);w(G,ie)}:void 0;return ue.createElement(ty,{position:g,style:e,className:zt(["react-flow__minimap",t]),"data-testid":"rf__minimap"},ue.createElement("svg",{width:D,height:M,viewBox:`${te} ${Z} ${U} ${Q}`,role:"img","aria-labelledby":O,ref:A,onClick:ce},b&&ue.createElement("title",{id:O},b),ue.createElement(pP,{onClick:$,nodeColor:i,nodeStrokeColor:r,nodeBorderRadius:a,nodeClassName:o,nodeStrokeWidth:u,nodeComponent:c}),ue.createElement("path",{className:"react-flow__minimap-mask",d:`M${te-F},${Z-F}h${U+F*2}v${Q+F*2}h${-U-F*2}z
|
|
57
|
+
M${L.x},${L.y}h${L.width}v${L.height}h${-L.width}z`,fill:f,fillRule:"evenodd",stroke:p,strokeWidth:d,pointerEvents:"none"})))}PC.displayName="MiniMap";var wP=R.memo(PC);function xP(){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 _P(){return ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},ue.createElement("path",{d:"M0 0h32v4.2H0z"}))}function bP(){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 SP(){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 kP(){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 vr=({children:e,className:t,...r})=>ue.createElement("button",{type:"button",className:zt(["react-flow__controls-button",t]),...r},e);vr.displayName="ControlButton";const EP=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),LC=({style:e,showZoom:t=!0,showFitView:r=!0,showInteractive:i=!0,fitViewOptions:o,onZoomIn:a,onZoomOut:u,onFitView:c,onInteractiveChange:f,className:p,children:d,position:g="bottom-left"})=>{const y=Mt(),[w,k]=R.useState(!1),{isInteractive:_,minZoomReached:b,maxZoomReached:S}=it(EP,It),{zoomIn:E,zoomOut:N,fitView:j}=Ma();if(R.useEffect(()=>{k(!0)},[]),!w)return null;const A=()=>{E(),a==null||a()},I=()=>{N(),u==null||u()},L=()=>{j(o),c==null||c()},P=()=>{y.setState({nodesDraggable:!_,nodesConnectable:!_,elementsSelectable:!_}),f==null||f(!_)};return ue.createElement(ty,{className:zt(["react-flow__controls",p]),position:g,style:e,"data-testid":"rf__controls"},t&&ue.createElement(ue.Fragment,null,ue.createElement(vr,{onClick:A,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:S},ue.createElement(xP,null)),ue.createElement(vr,{onClick:I,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:b},ue.createElement(_P,null))),r&&ue.createElement(vr,{className:"react-flow__controls-fitview",onClick:L,title:"fit view","aria-label":"fit view"},ue.createElement(bP,null)),i&&ue.createElement(vr,{className:"react-flow__controls-interactive",onClick:P,title:"toggle interactivity","aria-label":"toggle interactivity"},_?ue.createElement(kP,null):ue.createElement(SP,null)),d)};LC.displayName="Controls";var NP=R.memo(LC),nr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(nr||(nr={}));function CP({color:e,dimensions:t,lineWidth:r}){return ue.createElement("path",{stroke:e,strokeWidth:r,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function jP({color:e,radius:t}){return ue.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const TP={[nr.Dots]:"#91919a",[nr.Lines]:"#eee",[nr.Cross]:"#e2e2e2"},RP={[nr.Dots]:1,[nr.Lines]:1,[nr.Cross]:6},AP=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function $C({id:e,variant:t=nr.Dots,gap:r=20,size:i,lineWidth:o=1,offset:a=2,color:u,style:c,className:f}){const p=R.useRef(null),{transform:d,patternId:g}=it(AP,It),y=u||TP[t],w=i||RP[t],k=t===nr.Dots,_=t===nr.Cross,b=Array.isArray(r)?r:[r,r],S=[b[0]*d[2]||1,b[1]*d[2]||1],E=w*d[2],N=_?[E,E]:S,j=k?[E/a,E/a]:[N[0]/a,N[1]/a];return ue.createElement("svg",{className:zt(["react-flow__background",f]),style:{...c,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},ue.createElement("pattern",{id:g+e,x:d[0]%S[0],y:d[1]%S[1],width:S[0],height:S[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${j[0]},-${j[1]})`},k?ue.createElement(jP,{color:y,radius:E/a}):ue.createElement(CP,{dimensions:N,color:y,lineWidth:o})),ue.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${g+e})`}))}$C.displayName="Background";var IP=R.memo($C);const MP=["us-gov","global","apac","us","eu","jp","au"],OP=new RegExp(`^(?:(?:${MP.join("|")})\\.)?anthropic\\.`,"i");function Bu(e){return e.replace(OP,"")}function qC(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreateTokens:0}}function DC(e){const t=e.cache_creation,r=t&&typeof t=="object"?t: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 FC(e,t=0){if(!e||typeof e!="object"||t>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),...DC(r)};for(const i of Object.values(r)){const o=FC(i,t+1);if(o)return o}return null}function PP(e,t){e.inputTokens+=t.inputTokens,e.outputTokens+=t.outputTokens,e.cacheReadTokens+=t.cacheReadTokens,e.cacheCreateTokens+=t.cacheCreateTokens,(t.cacheCreate1hTokens!==void 0||t.cacheCreate5mTokens!==void 0)&&(e.cacheCreate1hTokens=(e.cacheCreate1hTokens??0)+(t.cacheCreate1hTokens??0),e.cacheCreate5mTokens=(e.cacheCreate5mTokens??0)+(t.cacheCreate5mTokens??0))}const LP=/^(?:claude[-_]|gpt[-_]|o\d|codex[-_])/i;function zC(e,t=0){if(!e||typeof e!="object"||t>6)return null;const r=e;if(typeof r.model=="string"&&LP.test(Bu(r.model)))return r.model;for(const i of Object.values(r)){const o=zC(i,t+1);if(o)return o}return null}function $v(){return{agents:new Map,toolIndex:new Map,toolOwner:new Map,activeSubagentStack:new Map,lastSeq:0,seqEpoch:null,totalEvents:0}}function ws(e){if(!e)return;const t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t[t.length-1]}function Xx(){return{msgsUser:0,msgsAssistant:0,toolUses:0,toolResults:0,systemReminders:0,currentContextTokens:0,memoryFiles:[]}}function Oa(e,t){return`${e}::${t}`}function Tu(e){return e.agent_type??e.subagent_type??"subagent"}function va(e){return e.agent_id?e.agent_id:e.parent_tool_use_id?e.parent_tool_use_id:null}function to(e,t,r,i){const o=t;let a=e.agents.get(o);return a||(a={id:o,sessionId:t,label:"session",kind:"root",state:"active",startedAt:r,lastEventAt:r,tools:[],prompts:[],toolCount:0,childCount:0,synthetic:i,usage:qC()},e.agents.set(o,a),a)}function BC(e,t,r,i){const o=Oa(t,r),a=e.agents.get(o);if(!a)return null;!a.cwd&&i.cwd&&(a.cwd=i.cwd,a.cwdBasename=ws(i.cwd));const u=Tu(i);return u&&(a.label==="subagent"||!a.label)&&(a.label=u),a}function Qx(e,t,r){const i=t.session_id??"unknown",o=va(t);if(o){const f=BC(e,i,o,t);if(f)return f}const a=e.activeSubagentStack.get(i),u=a&&a.length>0?a[a.length-1]:null;if(u){const f=e.agents.get(Oa(i,u));if(f)return!f.cwd&&t.cwd&&(f.cwd=t.cwd,f.cwdBasename=ws(t.cwd)),f}const c=to(e,i,r,!1);return c.synthetic&&(c.synthetic=!1,c.startedAt=r),!c.cwd&&t.cwd&&(c.cwd=t.cwd,c.cwdBasename=ws(t.cwd)),c.label==="session"&&t.cwd&&(c.label=ws(t.cwd)??"session"),c}function $P(e,t,r,i,o){const a=Oa(t,r),u=to(e,t,o,!0);let c=e.agents.get(a);if(c){!c.cwd&&i.cwd&&(c.cwd=i.cwd,c.cwdBasename=ws(i.cwd));const f=Tu(i);return f&&(c.label==="subagent"||!c.label)&&(c.label=f),c}return c={id:a,sessionId:t,label:Tu(i),kind:"subagent",parentId:u.id,state:"active",startedAt:o,tools:[],prompts:[],cwd:i.cwd,cwdBasename:ws(i.cwd),toolCount:0,childCount:0,usage:qC()},e.agents.set(a,c),u.childCount+=1,c}function qP(e,t,r){const i=e.activeSubagentStack.get(t)??[];i.includes(r)||(i.push(r),e.activeSubagentStack.set(t,i))}function DP(e,t,r){const i=e.activeSubagentStack.get(t);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(t)}}function ou(e,t=80){if(e==null)return"";if(typeof e=="string")return e.length>t?e.slice(0,t-1)+"…":e;try{const r=JSON.stringify(e);return r.length>t?r.slice(0,t-1)+"…":r}catch{return String(e)}}const Zx=200,FP=25;function zP(e,t){const r=t.tools;if(r.length>Zx){const i=r.splice(0,r.length-Zx);for(const o of i)e.toolIndex.get(o.id)===o&&(e.toolIndex.delete(o.id),e.toolOwner.delete(o.id))}for(let i=r.length-FP-1;i>=0;i--){const o=r[i];if(o.trimmed)break;o.input=void 0,o.response=void 0,o.trimmed=!0}}function BP(e,t,r){const i=e.toolIndex.get(r);if(i)return i;for(let o=t.tools.length-1;o>=0;o--)if(t.tools[o].id===r)return t.tools[o];return null}const Jx=2e3;function UP(e,t,r){for(let i=e.prompts.length-1;i>=0;i--){const o=e.prompts[i];if(o.at<t-Jx)return!1;if(o.text===r&&o.at<=t+Jx)return!0}return!1}function UC(e,t){for(const r of t.tools)e.toolIndex.get(r.id)===r&&e.toolIndex.delete(r.id),e.toolOwner.get(r.id)===t.id&&e.toolOwner.delete(r.id)}function HP(e,t,r,i){if(e.agents.size<=r)return!1;const o=p=>p.state==="done"&&p.endedAt!=null&&t-p.endedAt>i,a=[],u=new Map;for(const[p,d]of e.agents){if(d.parentId!=null){const g=u.get(d.parentId);g?g.push(p):u.set(d.parentId,[p])}o(d)&&a.push({id:p,endedAt:d.endedAt})}if(a.length===0)return!1;a.sort((p,d)=>p.endedAt-d.endedAt);let c=0;const f=p=>{const d=e.agents.get(p);d&&(UC(e,d),e.agents.delete(p),c++)};for(const p of a){if(e.agents.size<=r)break;if(!e.agents.has(p.id))continue;const d=(u.get(p.id)??[]).map(g=>e.agents.get(g)).filter(g=>g!=null);if(!d.some(g=>!o(g))){for(const g of d)f(g.id);f(p.id)}}return c>0}function WP(e,t,r,i){const o=new Map;for(const[p,d]of e.agents){let g=o.get(d.sessionId);g||(g={ids:[],endedAt:0,live:!1,closed:!1},o.set(d.sessionId,g)),g.ids.push(p),d.kind==="root"&&d.closedAt!=null&&(g.closed=!0),d.state==="done"&&d.endedAt!=null?g.endedAt=Math.max(g.endedAt,d.endedAt):g.live=!0}const a=[...o.values()].filter(p=>!p.live&&p.endedAt>0&&t-p.endedAt>i).sort((p,d)=>p.closed===d.closed?p.endedAt-d.endedAt:p.closed?-1:1);let c=[...o.values()].filter(p=>!p.live).length-r;if(c<=0)return!1;let f=!1;for(const p of a){if(c<=0)break;for(const d of p.ids){const g=e.agents.get(d);g&&UC(e,g),e.agents.delete(d)}c--,f=!0}return f}function VP(e,t,r){let i=!1;for(const o of e.agents.values()){if(o.provider==="codex")continue;const a=e.agents.get(o.sessionId),u=(a==null?void 0:a.lastEventAt)??(a==null?void 0:a.startedAt);for(const c of o.tools){const f=Math.max(c.startedAt,u??c.startedAt);c.endedAt==null&&t-f>r&&(c.endedAt=f,c.ok=!1,c.errorPreview="session ended before this call returned",e.toolIndex.delete(c.id),e.toolOwner.delete(c.id),i=!0)}}return i}const e1=90*6e4;function GP(e,t,r){let i=!1;for(const o of e.agents.values()){if(o.kind!=="root")continue;const a=o.lastEventAt??o.startedAt;if(!(t-a<=r)){o.waiting&&(o.waiting=null,i=!0),o.closedAt==null&&(o.closedAt=a),o.state==="active"&&(o.state="done",o.endedAt=a,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=a,i=!0);e.activeSubagentStack.delete(o.sessionId)}}return i}function YP(e){return e==="permission_prompt"?"permission":e==="idle_prompt"?"idle":null}const KP=new Set(["Notification","ModelObserved","ContextObserved","UsageObserved","SessionNamed"]);function XP(e,t){let r=null;for(const i of e.toolIndex.values()){const o=i.agentId?e.agents.get(i.agentId):void 0;!o||o.sessionId!==t||(!r||i.startedAt>r.startedAt)&&(r=i)}return r==null?void 0:r.explicitSubagentId}function QP(e,t,r,i,o){const a=r==="permission"?XP(e,t):void 0;return a?{kind:r,message:i,since:o,subagentId:a}:{kind:r,message:i,since:o}}function ZP(e,t,r){if(e.kind!=="permission")return!0;const i=va(t);return i==null?!0:e.subagentId!=null&&Oa(r,i)===e.subagentId}function t1(e,t){const r=t.epoch??null;if(r!==null&&r!==e.seqEpoch)e.seqEpoch=r,e.lastSeq=0;else if(t.seq<=e.lastSeq)return e;const i=t.payload??{},o=t.receivedAt,a=i.hook_event_name??"Unknown";if(a==="__clear")return{...$v(),lastSeq:t.seq,seqEpoch:e.seqEpoch};e.totalEvents+=1,e.lastSeq=t.seq;const u=i.session_id??"unknown";if(!KP.has(a)){const d=e.agents.get(u);d!=null&&d.waiting&&ZP(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,c.closedAt=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(typeof i.approval_policy=="string"&&i.approval_policy){const d=e.agents.get(u);d&&(d.approvalPolicy=i.approval_policy)}if(typeof i.context_tokens=="number"&&i.context_tokens>=0){const d=e.agents.get(u);d&&(d.context={...d.context??Xx(),currentContextTokens:i.context_tokens})}if(a==="ModelObserved"){const d=typeof i.model=="string"?i.model:null;if(d){const y=e.agents.get(u);y&&(y.model=d)}const g=i.subagentModels;if(g&&typeof g=="object")for(const[y,w]of Object.entries(g)){if(typeof w!="string")continue;const k=`${u}::${y}`,_=e.agents.get(k);_&&(_.model=w)}return e}if(a==="ContextObserved"){const d=i.context??null;if(d){const g=e.agents.get(u);if(g){const y=g.context??Xx(),w=(_,b)=>typeof d[_]=="number"?d[_]:b,k=Array.isArray(d.memoryFiles)?d.memoryFiles:Array.isArray(d.claudeMdFiles)?d.claudeMdFiles:null;g.context={msgsUser:w("msgsUser",y.msgsUser),msgsAssistant:w("msgsAssistant",y.msgsAssistant),toolUses:w("toolUses",y.toolUses),toolResults:w("toolResults",y.toolResults),systemReminders:w("systemReminders",y.systemReminders),currentContextTokens:w("currentContextTokens",y.currentContextTokens),memoryFiles:k??y.memoryFiles}}}return e}if(a==="SessionNamed"){const d=e.agents.get(u);if(d){const g=typeof i.sessionName=="string"?i.sessionName.trim():"",y=typeof i.sessionTitle=="string"?i.sessionTitle.trim():"";g&&(d.sessionName=g),y&&(d.sessionTitle=y);const w=d.sessionName??"";d.sessionTitle&&w&&d.sessionTitle.toLowerCase()===w.toLowerCase()&&(d.sessionTitle=void 0)}return e}if(a==="UsageObserved"){const d=i.usage??null;if(d){const g=e.agents.get(u);if(g){g.usage.inputTokens=Number(d.input_tokens??0),g.usage.outputTokens=Number(d.output_tokens??0),g.usage.cacheReadTokens=Number(d.cache_read_input_tokens??d.cached_input_tokens??0),g.usage.cacheCreateTokens=Number(d.cache_creation_input_tokens??d.cache_write_input_tokens??0);const y=DC(d);g.usage.cacheCreate1hTokens=y.cacheCreate1hTokens,g.usage.cacheCreate5mTokens=y.cacheCreate5mTokens,typeof d.reasoning_output_tokens=="number"&&(g.usage.reasoningOutputTokens=Number(d.reasoning_output_tokens))}}return e}const f=Qx(e,i,o);f.provider||(f.provider=i.provider==="codex"?"codex":"claude");const p=zC(i);switch(p&&(f.model=p),a){case"SessionStart":{const d=to(e,u,o,!1);d.synthetic=!1,d.state="active",d.closedAt=void 0,d.startedAt=d.startedAt||o,!d.cwd&&i.cwd&&(d.cwd=i.cwd,d.cwdBasename=ws(i.cwd)),d.label==="session"&&i.cwd&&(d.label=ws(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=to(e,u,o,!1);d.state="active",d.endedAt=void 0,d.closedAt=void 0,d.exitAt=void 0;const g=Qx(e,i,o);g.state="active",g.exitAt=void 0,g.endedAt=void 0;const y=(typeof i.prompt=="string"?i.prompt:typeof i.message=="string"?i.message:"")??"";y&&!UP(g,o,y)&&(g.prompts.push({at:o,text:y}),g.firstPrompt||(g.firstPrompt=ou(y,120)));break}case"PreToolUse":{const d=i.tool_use_id?BP(e,f,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=ou(i.tool_input));break}const g=i.tool_use_id??`${f.id}:${f.toolCount}`,y=va(i),w={id:g,name:i.tool_name??"?",input:i.tool_input,inputPreview:ou(i.tool_input),agentId:f.id,explicitSubagentId:y?Oa(u,y):void 0,startedAt:o};f.tools.push(w),f.toolCount+=1,f.state="active",e.toolIndex.set(g,w),e.toolOwner.set(g,f.id),zP(e,f);break}case"PostToolUse":case"PostToolUseFailure":{const d=i.tool_use_id;if(!d)break;let g=e.toolIndex.get(d),y=!1;if(!g)for(const _ of e.agents.values()){const b=_.tools.find(S=>S.id===d);if(b){g=b,y=!0;break}}if(!g||g.outcomeApplied)break;g.outcomeApplied=!0,g.endedAt=o,g.ok=a==="PostToolUse",g.trimmed||(g.response=i.tool_response),a==="PostToolUseFailure"?g.errorPreview=ou(i.tool_response):y&&(g.errorPreview=void 0);const w=FC(i.tool_response);w&&(g.usage=w),e.toolIndex.delete(d);const k=e.toolOwner.get(d)??g.agentId;if(e.toolOwner.delete(d),k&&w){const _=e.agents.get(k);_&&PP(_.usage,w)}break}case"SubagentStart":{const d=va(i);if(!d)break;const g=$P(e,u,d,i,o);g.state="active",g.startedAt=g.startedAt||o,g.exitAt=void 0,g.endedAt=void 0;const y=Tu(i);y&&(g.label=y),qP(e,u,d);break}case"SubagentStop":{const d=va(i);if(!d)break;const g=BC(e,u,d,i);if(!g)break;g.state="done",g.endedAt=o,DP(e,u,d);break}case"Stop":case"SessionEnd":{const d=to(e,u,o,!1);d.state="done",d.endedAt=o,a==="SessionEnd"&&(d.closedAt=o),e.activeSubagentStack.delete(u);break}case"Notification":{const d=YP(i.notification_type);if(!d)break;const g=to(e,u,o,!1),y=typeof i.message=="string"?i.message:"",w=g.waiting;g.waiting=w&&w.kind===d&&w.message===y?{...w,since:Math.min(w.since,o)}:QP(e,u,d,y,o);break}}return e}function fy(e){let t=5381;for(let r=0;r<e.length;r++)t=(t<<5)+t^e.charCodeAt(r);return Math.abs(t)%360}const JP=Date.UTC(2026,8,1);function eL(e){return e<JP?{input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4}:{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}}const tL=[{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:eL},{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:/^gpt[-_]5[-_.]1[-_]codex[-_]mini/i,rates:{input:.25,output:2,cacheRead:.025,cacheWrite:0}},{match:/^gpt[-_]5[-_.]1(?!\d)/i,rates:{input:1.25,output:10,cacheRead:.125,cacheWrite:0}},{match:/^gpt[-_]5[-_]pro\b/i,rates:{input:15,output:120,cacheRead:15,cacheWrite:0}},{match:/^gpt[-_]5[-_]mini/i,rates:{input:.25,output:2,cacheRead:.025,cacheWrite:0}},{match:/^gpt[-_]5[-_]nano/i,rates:{input:.05,output:.4,cacheRead:.005,cacheWrite:0}},{match:/^gpt[-_]5(?![-_.]\d)/i,rates:{input:1.25,output:10,cacheRead:.125,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 nL(e){return e?/^(?:gpt[-_]|codex[-_]|o\d)/i.test(e):!1}function co(e,t=Date.now()){if(!e)return null;const r=Bu(e);for(const i of tL)if(i.match.test(r))return typeof i.rates=="function"?i.rates(t):i.rates;return null}function HC(e,t){const r=Math.max(0,e.cacheCreate1hTokens??0),i=Math.max(0,e.cacheCreate5mTokens??0),o=Math.max(0,e.cacheCreateTokens-r-i),a=i+o,u=t.cacheWrite1h??t.cacheWrite;return{tokens5m:a,tokens1h:r,usd5m:a*t.cacheWrite/1e6,usd1h:r*u/1e6}}function WC(e,t,r=Date.now()){if(!nL(t))return e.inputTokens;const i=co(t,r),o=((i==null?void 0:i.cacheWrite)??0)>0?Math.max(0,e.cacheCreateTokens):0;return Math.max(0,e.inputTokens-e.cacheReadTokens-o)}function hn(e,t,r=Date.now()){const i=co(t,r);if(!i)return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0};const o=WC(e,t,r)*i.input/1e6,a=e.outputTokens*i.output/1e6,u=e.cacheReadTokens*i.cacheRead/1e6,c=HC(e,i),f=c.usd5m+c.usd1h;return{input:o,output:a,cacheRead:u,cacheWrite:f,total:o+a+u+f}}const n1=2e5,rL=1e6,sL=[/\[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],iL=[{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 oL(e){if(!e)return n1;const t=Bu(e);for(const r of sL)if(r.test(t))return rL;for(const r of iL)if(r.match.test(t))return r.window;return n1}function VC(e,t){return typeof e=="number"&&e>0?e:oL(t)}const yu="not priced";function Xe(e){if(e<=0)return"—";if(e<.005)return"<1¢";if(e<1){const t=(e*100).toFixed(e<.1?1:0);if(Number(t)<100)return`${t}¢`}return e<100?`$${e.toFixed(2)}`:e<1e4?`$${e.toFixed(0)}`:`$${(e/1e3).toFixed(1)}k`}function Ru(e,t){if(e<=0||t<10)return null;const r=e/t,i=r*60;return i>=.01?`${Xe(i)}/min`:`${Xe(r*3600)}/hr`}const aL=new Set(["untrusted","on-request","on-failure"]);function lL(e){return typeof e!="string"||!e?null:aL.has(e)?!0:e==="never"?!1:null}function uL(e){if(e.provider!=="codex"||e.kind!=="root"||e.waiting||e.state!=="active")return null;const t=lL(e.approvalPolicy);return t===!1?null:{label:"approvals not visible",detail:`${t===!0?`This session's approval policy is "${e.approvalPolicy}", so Codex can stop and ask you to approve a command.`:"This session's approval policy has not been read yet, so it may be able to stop and ask you to approve a command."}
|
|
58
|
+
|
|
59
|
+
Codex writes no approval request to its rollout files, which are the only thing this deck can read — so when it does ask, this card, the sidebar, the topbar count, the tab title and the favicon will all stay silent. Check the terminal.`}}function r1(e){return e[0].toUpperCase()+e.slice(1).toLowerCase()}function ni(e){const t=Bu(e).replace(/[-_]\d{8}(?!\d)/,""),r=t.match(/^claude[-_](opus|sonnet|haiku|fable|mythos)[-_](\d+(?:[-_.]\d+)*)/i);if(r){const o=r1(r[1]),a=r[2].replace(/[-_]/g,".");return`${o} ${a}`}const i=t.match(/^gpt[-_](\d+(?:[-_.]\d+)*)((?:[-_][A-Za-z0-9.]+)*)$/i);if(i){const o=i[1].replace(/[-_]/g,"."),a=i[2].split(/[-_]/).filter(Boolean).map(r1);return[`GPT-${o}`,...a].join(" ")}return e}function At(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 Au(e,t,r){const i=(t??r)-e;if(i<1e3)return`${Math.max(0,i)}ms`;const o=Math.floor(i/1e3);if(o<60)return`${o}s`;const a=Math.floor(o/60),u=o%60;return`${a}m ${String(u).padStart(2,"0")}s`}function GC(e,t){if(e.endedAt==null)return t;const r=e.endedAt-e.startedAt;return r<1e3?`${r}ms`:`${(r/1e3).toFixed(2)}s`}function YC(e,t){const r=typeof e=="string"?e.trim():"",i=typeof t=="string"?t.trim():"";return{face:r||i||void 0,tooltip:i||r||void 0}}const cL=1;function dL(){const e=[];let t=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 a={dismiss:i,layer:o,seq:t++};return e.push(a),()=>{const u=e.indexOf(a);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 Iu=dL();function fL(e){return e.overlayOpen?"dismiss":e.typing?"blur":"clear-selection"}function s1(e){return String(e.tagName??"").toUpperCase()==="BODY"}function hL(e,t){return!e||!e.isConnected||s1(e)?!1:t==null||s1(t)}const i1="a[href], button, input, select, textarea, [tabindex]";function pL(e){return!e||e.disabled||e.rendered===!1?!1:(e.tabIndex??0)>=0}function mL(e){if(!e||!e.overflowing||e.hasFocusable)return!1;const t=String(e.overflow??"").toLowerCase();return t==="auto"||t==="scroll"}function gL({count:e,index:t,shiftKey:r}){return e<=0?{kind:"hold"}:t<0||t>=e?{kind:"focus",index:r?e-1:0}:!r&&t===e-1?{kind:"focus",index:0}:r&&t===0?{kind:"focus",index:e-1}:{kind:"allow"}}function KC(e){return e.ctrlKey||e.metaKey||e.altKey}const vL=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]),yL=new Set(["INPUT","TEXTAREA","SELECT","OPTION","BUTTON","SUMMARY","A"]),wL=new Set(["button","checkbox","combobox","link","listbox","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]);function XC(e){return typeof e.tagName=="string"?e.tagName.toUpperCase():""}function hy(e){if(!e)return!1;if(e.isContentEditable)return!0;const t=XC(e);return t==="TEXTAREA"?!0:t!=="INPUT"?!1:!vL.has(String(e.type??"text").toLowerCase())}function xL(e){if(!e)return!1;if(hy(e)||yL.has(XC(e)))return!0;const t=typeof e.role=="string"?e.role.trim().toLowerCase():"";return t!==""&&t.split(/\s+/).some(r=>wL.has(r))}function QC(e){return e?Array.from(e.querySelectorAll("*")).filter(t=>{if(t.matches(i1))return pL({disabled:t.disabled,tabIndex:t.tabIndex,rendered:t.getClientRects().length>0});const r=t.scrollHeight>t.clientHeight;return r&&mL({overflowing:r,overflow:getComputedStyle(t).overflowY,hasFocusable:t.querySelector(i1)!=null})}):[]}function _L(e,t){const r=QC(e);if(!t||!e.contains(t)||r.includes(t))return r;const i=r.findIndex(o=>(t.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return i===-1?[...r,t]:[...r.slice(0,i),t,...r.slice(i)]}function ri(e,t={}){const{focusRef:r,layer:i}=t,o=R.useRef(null),a=R.useRef(e);a.current=e;const u=R.useRef(null);u.current===null&&(u.current=()=>a.current());const c=u.current;return R.useEffect(()=>Iu.push(c,i),[c,i]),R.useEffect(()=>{var p;const f=document.activeElement;return(p=(r==null?void 0:r.current)??QC(o.current)[0])==null||p.focus(),()=>{hL(f,document.activeElement)&&f.focus()}},[]),R.useEffect(()=>{const f=p=>{var _;if(p.key!=="Tab"||KC(p))return;const d=o.current;if(!d)return;const g=document.activeElement;if(!(g!=null&&d.contains(g))&&!Iu.isTop(c))return;const w=_L(d,g),k=gL({count:w.length,index:g?w.indexOf(g):-1,shiftKey:p.shiftKey});k.kind!=="allow"&&(p.preventDefault(),k.kind==="focus"&&((_=w[k.index])==null||_.focus()))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[c]),o}function bL(e){return e==="codex"?{subtitle:"reported by the Codex CLI — as of its most recent request",windowScope:"last request",compositionCounted:!1,compositionUncounted:"Not counted for Codex — the deck reconstructs the session from its rollout file and skips whatever was written before it attached, so a message and tool-call breakdown here would be short by an unknown amount. The window figure above is the CLI's own and is unaffected.",memoryHeading:"AGENTS.md files in scope",memoryEmpty:"No AGENTS.md files found on the path from cwd to the filesystem root, or in $CODEX_HOME."}:{subtitle:"approximation — CC's /context isn't hook-exposed",windowScope:"current turn",compositionCounted:!0,compositionUncounted:"",memoryHeading:"CLAUDE.md files in scope",memoryEmpty:"No CLAUDE.md files found on the path from cwd to ~/.claude."}}function Ln(e){return e.toLocaleString()}function SL(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}const kL=60;function EL(e,t=kL){if(e.length<=t)return e;const r=e.slice(e.length-(t-1)),i=r.search(/[/\\]/);return"…"+(i===-1?r:r.slice(i))}function NL({agent:e,onClose:t}){var y;const r=R.useRef(null),i=ri(t,{focusRef:r}),o=e.context,a=e.usage,u=(o==null?void 0:o.currentContextTokens)??0,c=VC(e.contextWindow,e.model),f=Math.min(100,u/c*100),p=hn(a,e.model),d=a.inputTokens+a.cacheReadTokens+a.cacheCreateTokens,g=bL(e.provider);return m.jsx("div",{className:"ctx-modal-backdrop",onClick:t,role:"presentation",children:m.jsxs("div",{ref:i,className:"ctx-modal",onClick:w=>w.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Context breakdown",children:[m.jsxs("header",{className:"ctx-modal-head",children:[m.jsxs("div",{children:[m.jsxs("div",{className:"ctx-modal-title",children:["Context · ",e.label]}),m.jsx("div",{className:"ctx-modal-sub",children:g.subtitle})]}),m.jsx("button",{type:"button",ref:r,className:"glyph-btn ctx-modal-close",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),m.jsxs("section",{className:"ctx-window-row",children:[m.jsx("div",{className:"ctx-window-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(f),children:m.jsx("div",{className:"ctx-window-fill",style:{width:`${f}%`}})}),m.jsxs("div",{className:"ctx-window-meta",children:[m.jsxs("span",{className:"ctx-window-pct",children:[f.toFixed(1),"%"]}),m.jsxs("span",{children:[Ln(u)," / ",Ln(c)," tok (",g.windowScope,")"]})]})]}),m.jsx("h3",{className:"ctx-section-title",children:"Cumulative usage · whole session"}),m.jsxs("div",{className:"ctx-grid",children:[m.jsx(Jn,{label:"input tokens",val:Ln(a.inputTokens)}),m.jsx(Jn,{label:"output tokens",val:Ln(a.outputTokens)}),m.jsx(Jn,{label:"cache reads",val:Ln(a.cacheReadTokens)}),m.jsx(Jn,{label:"cache writes",val:Ln(a.cacheCreateTokens)}),m.jsx(Jn,{label:"cumulative total",val:Ln(d)}),m.jsx(Jn,{label:"estimated cost",val:Xe(p.total),accent:!0})]}),m.jsx("h3",{className:"ctx-section-title",children:"Transcript composition"}),g.compositionCounted?m.jsxs("div",{className:"ctx-grid",children:[m.jsx(Jn,{label:"user messages",val:Ln((o==null?void 0:o.msgsUser)??0)}),m.jsx(Jn,{label:"assistant messages",val:Ln((o==null?void 0:o.msgsAssistant)??0)}),m.jsx(Jn,{label:"tool uses",val:Ln((o==null?void 0:o.toolUses)??0)}),m.jsx(Jn,{label:"tool results",val:Ln((o==null?void 0:o.toolResults)??0)}),m.jsx(Jn,{label:"system-reminders",val:Ln((o==null?void 0:o.systemReminders)??0)})]}):m.jsx("div",{className:"ctx-empty",children:g.compositionUncounted}),m.jsx("h3",{className:"ctx-section-title",children:g.memoryHeading}),(((y=o==null?void 0:o.memoryFiles)==null?void 0:y.length)??0)===0?m.jsx("div",{className:"ctx-empty",children:g.memoryEmpty}):m.jsx("ul",{className:"ctx-md-list",children:o.memoryFiles.map(w=>m.jsxs("li",{children:[m.jsx("span",{className:"ctx-md-path",title:w.path,children:EL(w.path)}),m.jsx("span",{className:"ctx-md-size",children:SL(w.bytes)})]},w.path))})]})})}function Jn({label:e,val:t,accent:r}){return m.jsxs("div",{className:`ctx-row${r?" accent":""}`,children:[m.jsx("span",{className:"ctx-row-label",children:e}),m.jsx("span",{className:"ctx-row-val",children:t})]})}function CL({currentContextTokens:e,modelId:t,contextWindow:r,size:i=26,onClick:o,title:a}){const u=VC(r,t),c=Math.min(1,e/u),f=i/2-3,p=i/2,d=2*Math.PI*f,g=d*c,y=c>.9?"var(--err)":c>.7?"var(--inflight)":"var(--accent)";return m.jsx("button",{type:"button",className:"ctx-donut",onClick:o,title:a??`context: ${e.toLocaleString()} / ${u.toLocaleString()} (${(c*100).toFixed(1)}%)`,"aria-label":"Show context breakdown",children:m.jsxs("svg",{width:i,height:i,viewBox:`0 0 ${i} ${i}`,children:[m.jsx("circle",{cx:p,cy:p,r:f,stroke:"var(--line)",strokeWidth:"2.5",fill:"none"}),m.jsx("circle",{cx:p,cy:p,r:f,stroke:y,strokeWidth:"2.5",fill:"none",strokeDasharray:`${g} ${d-g}`,strokeDashoffset:d/4,strokeLinecap:"round",style:{transition:"var(--ctx-arc-transition)"}}),m.jsx("text",{x:p,y:p+3,textAnchor:"middle",fontSize:"8",fill:"var(--text)",fontWeight:"600",children:Math.round(c*100)})]})})}function o1(e,t){const r=co(t);if(!r)return`model: ${t}
|
|
60
|
+
no published rate in this build — the tokens are counted, the dollars are not`;const i=d=>d.toLocaleString(),o=d=>`$${d}/MTok`,a=hn(e,t),u=HC(e,r),c=u.tokens1h>0?[`cache w5m${i(u.tokens5m).padStart(14)} × ${o(r.cacheWrite).padEnd(11)} = ${Xe(u.usd5m)}`,`cache w1h${i(u.tokens1h).padStart(14)} × ${o(r.cacheWrite1h??r.cacheWrite).padEnd(11)} = ${Xe(u.usd1h)}`]:[`cache w ${i(u.tokens5m).padStart(14)} × ${o(r.cacheWrite).padEnd(11)} = ${Xe(u.usd5m)}`],f=WC(e,t),p=f===e.inputTokens?"input":"uncached";return[`model: ${t}`,`${p.padEnd(9)}${i(f).padStart(14)} × ${o(r.input).padEnd(11)} = ${Xe(a.input)}`,`output ${i(e.outputTokens).padStart(14)} × ${o(r.output).padEnd(11)} = ${Xe(a.output)}`,`cache r ${i(e.cacheReadTokens).padStart(14)} × ${o(r.cacheRead).padEnd(11)} = ${Xe(a.cacheRead)}`,...c,"─────────────────────────────────────────",`total = ${Xe(a.total)}`].join(`
|
|
61
|
+
`)}function jL({data:e,selected:t}){var d;const r=e.now??Date.now(),i=["agent-node",`state-${e.state}`,e.synthetic?"synthetic":"",t?"selected":""].filter(Boolean).join(" "),o=e.tools.filter(g=>!g.endedAt).length,a=fy(e.sessionId),u=((d=e.context)==null?void 0:d.currentContextTokens)??0,c=e.kind==="root"&&u>0,f=e.sessionTitle?e.cwd?`${e.cwd}
|
|
62
|
+
${e.sessionTitle}`:e.sessionTitle:e.cwd,p=YC(e.sessionName,e.sessionTitle);return m.jsxs("div",{className:i,style:{"--session-hue":a},children:[m.jsx("span",{className:"accent-stripe"}),m.jsx(uo,{type:"target",position:Re.Left,style:{background:"transparent",border:"none"}}),m.jsxs("div",{className:"head",children:[m.jsxs("div",{className:"title",children:[m.jsx(TL,{state:e.state}),m.jsx("span",{className:"label",title:f,children:e.label}),e.synthetic&&m.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"})]}),m.jsxs("div",{className:"head-right",children:[c&&e.onOpenContext&&m.jsx(CL,{currentContextTokens:u,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)}),m.jsx("div",{className:"time",title:`Started ${new Date(e.startedAt).toLocaleTimeString()}`,children:Au(e.startedAt,e.endedAt,r)})]})]}),m.jsxs("div",{className:"sub",children:[e.kind==="root"?"session":"subagent",e.childCount>0&&m.jsxs("span",{className:"spawn-badge",title:`${e.childCount} subagents spawned`,children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"?` · ${e.cwdBasename}`:"",e.model?m.jsx("span",{className:"model-chip",title:e.model,children:ni(e.model)}):e.provider==="codex"?m.jsx("span",{className:"model-chip",title:"OpenAI Codex — no model reported yet",children:"Codex"}):null]}),e.kind==="root"&&p.face&&m.jsx("div",{className:"session-name",title:p.tooltip,children:p.face}),e.waiting&&m.jsx(AL,{waiting:e.waiting,now:r}),(()=>{const g=uL(e);return g?m.jsxs("div",{className:"approval-blind-row",title:g.detail,children:[m.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),m.jsx("span",{className:"approval-blind-said",children:g.label})]}):null})(),e.tools.length>0&&m.jsx(IL,{tools:e.tools,now:r}),m.jsxs("div",{className:"meta",children:[m.jsxs("span",{children:[m.jsx("b",{children:e.toolCount})," tools"]}),o>0&&m.jsxs("span",{className:"inflight-meta",children:[m.jsx("b",{children:o})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&m.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:[m.jsx("b",{children:At(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),e.model&&(()=>{if(!co(e.model))return e.usage.inputTokens+e.usage.outputTokens<=0?null:m.jsx("span",{className:"cost-unpriced",title:o1(e.usage,e.model),children:yu});const y=hn(e.usage,e.model);if(y.total<=0)return null;const w=Math.max(0,((e.endedAt??r)-e.startedAt)/1e3),k=e.state==="active"?Ru(y.total,w):null,_=o1(e.usage,e.model)+(k?`
|
|
63
|
+
burn: ${k}`:"");return m.jsxs("span",{className:"cost-meta",title:_,children:[m.jsx("b",{children:Xe(y.total)}),k&&m.jsx("span",{className:"cost-rate",children:k})]})})()]}),m.jsx(uo,{type:"source",position:Re.Right,style:{background:"transparent",border:"none"}})]})}function py(e){return e==="active"?"live":e==="done"?"done":"err"}function TL({state:e}){return m.jsx("span",{className:`state-pill state-${e}`,children:py(e)})}function Uu(e){return e.message?e.message:e.kind==="permission"?"Needs your permission":"Waiting for your input"}function RL(e){return e.kind==="permission"?Uu(e):"Your turn"}function AL({waiting:e,now:t}){const r=e.kind==="permission",i=Uu(e);return m.jsxs("div",{className:r?"waiting-row permission":"waiting-row idle",title:`${i}
|
|
64
|
+
Blocked for ${Au(e.since,void 0,t)} — the answer goes in the terminal, not here.`,children:[r?m.jsx("span",{className:"ap-pulse","aria-hidden":!0}):m.jsx("span",{className:"waiting-dot","aria-hidden":!0}),m.jsx("span",{className:"waiting-said",children:RL(e)}),m.jsx("b",{children:Au(e.since,void 0,t)})]})}function IL({tools:e,now:t}){const a=new Array(24).fill(0);let u=0;for(const y of e){const w=t-y.startedAt;if(w<0||w>=6e4)continue;const k=23-Math.floor(w/2500);k>=0&&k<24&&(a[k]+=1,u+=1)}const c=Math.max(1,...a),f=132,p=14,d=f/24,g=c/(2500/1e3);return m.jsxs("div",{className:"tool-spark-row",title:`${u} tool calls in last 60s · peak ${g.toFixed(1)}/s`,children:[m.jsx("svg",{className:"tool-spark",width:f,height:p,viewBox:`0 0 ${f} ${p}`,"aria-hidden":!0,children:a.map((y,w)=>{const k=y===0?1.5:Math.max(1.5,y/c*p),_=w===23&&y>0,S=`tool-spark-bar${y>0?" active":""}${_?" latest":""}`;return m.jsx("rect",{x:w*d+.4,y:p-k,width:Math.max(.5,d-1),height:k,rx:.8,className:S},w)})}),m.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function a1(e){if(e==null)return"(none)";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function ML({tool:e,onClose:t}){const r=ri(t),i=e.endedAt==null?"inflight":e.ok===!1?"err":"done";return m.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:m.jsxs("div",{ref:r,className:"modal",onClick:o=>o.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[m.jsxs("header",{className:"modal-head",children:[m.jsxs("div",{className:"modal-title",children:[m.jsx("span",{className:`status-dot ${i}`,"aria-hidden":!0}),m.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),m.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),m.jsxs("div",{className:"modal-actions",children:[m.jsx("span",{className:"modal-dur",children:GC(e,"in-flight…")}),m.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),m.jsxs("section",{className:"modal-body",children:[e.trimmed&&m.jsx("div",{className:"modal-section",children:m.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),m.jsxs("div",{className:"modal-section",children:[m.jsx("h4",{children:"Input"}),m.jsx("pre",{children:a1(e.input??e.inputPreview)})]}),m.jsxs("div",{className:"modal-section",children:[m.jsxs("h4",{children:["Response ",i==="err"&&m.jsx("span",{className:"err-tag",children:"error"})]}),m.jsx("pre",{children:e.endedAt==null?"(waiting…)":a1(e.response??e.errorPreview)})]})]})]})})}const au=18,l1=26,OL=12;function PL(e){return LL(e.nodeInternals.values())}function LL(e){const t=new Map;for(const o of e){if(o.type!=="agent")continue;const a=o.data;if(!(a!=null&&a.sessionId)||a.exitAt!=null||o.width==null||o.height==null)continue;const u=o.position.x,c=o.position.y,f=u+o.width,p=c+o.height,d=t.get(a.sessionId);d?(d.minX=Math.min(d.minX,u),d.minY=Math.min(d.minY,c),d.maxX=Math.max(d.maxX,f),d.maxY=Math.max(d.maxY,p),a.kind==="root"&&(d.label=c1(a)??d.label),a.kind==="root"&&(d.name=d1(a))):t.set(a.sessionId,{minX:u,minY:c,maxX:f,maxY:p,label:c1(a)??a.sessionId,name:d1(a)})}const r=new Map;for(const o of t.values())r.set(o.label,(r.get(o.label)??0)+1);const i=[];for(const[o,a]of t){const u=(r.get(a.label)??0)>1;i.push({sessionId:o,...FL(a.label,a.name,o,u),x:a.minX-au,y:a.minY-au-l1,w:a.maxX-a.minX+au*2,h:a.maxY-a.minY+au*2+l1})}return i}const qv=" · ",$L=32,qL=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function u1(e){return qL.test(e)?2:1}function DL(e,t=$L){const r=[...e];let i=0;for(const u of r)i+=u1(u);if(i<=t)return e;const o=[];let a=0;for(const u of r){const c=u1(u);if(a+c>t-1)break;o.push(u),a+=c}for(;o.length&&/[\s\-_.:/]/.test(o[o.length-1]);)o.pop();return`${o.join("")}…`}function FL(e,t,r,i){const o=(t==null?void 0:t.trim())??"",a=i?zL(r):void 0,u=[e,o||void 0,a].filter(Boolean);return{label:e,name:o?DL(o):void 0,shortId:a,fullLabel:u.join(qv)}}function zL(e){const t=e.match(/[a-zA-Z0-9]{4}/);return t?t[0]:e.slice(0,4)}function c1(e){if(e.kind==="root")return e.label}function d1(e){if(e.kind==="root")return YC(e.sessionName,e.sessionTitle).face}function BL(){const{x:e,y:t,zoom:r}=MC(),i=Ma(),o=it(PL,UL);if(o.length<=1)return null;const a=c=>{try{const f=i.getNodes().filter(p=>{const d=p.data;return(d==null?void 0:d.sessionId)===c});if(f.length===0)return;i.fitView({padding:.3,duration:500,nodes:f})}catch{}},u={transform:`translate(${e}px, ${t}px) scale(${r})`};return m.jsx("div",{className:"session-clusters",style:u,children:o.map(c=>{const f=fy(c.sessionId),p={position:"absolute",left:c.x,top:c.y,width:c.w,height:c.h,"--session-hue":f},d={position:"absolute",left:c.x+16,top:c.y-OL,transform:`scale(${Math.min(1,r)/(r||1)})`,transformOrigin:"left top","--session-hue":f};return m.jsxs(ue.Fragment,{children:[m.jsx("div",{className:"cluster-card",style:p,"aria-hidden":!0}),m.jsxs("button",{type:"button",className:"cluster-label",style:d,title:`Fit view to ${c.fullLabel}
|
|
65
|
+
drag the wrapper to move the whole session`,onClick:()=>a(c.sessionId),children:[c.label,c.name?m.jsxs(m.Fragment,{children:[qv,m.jsx("span",{className:"cluster-label-name",children:c.name})]}):null,c.shortId?qv+c.shortId:null]})]},c.sessionId)})})}function UL(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){const i=e[r],o=t[r];if(i.sessionId!==o.sessionId||i.label!==o.label||i.name!==o.name||i.shortId!==o.shortId||i.fullLabel!==o.fullLabel||i.x!==o.x||i.y!==o.y||i.w!==o.w||i.h!==o.h)return!1}return!0}function HL({data:e}){return m.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}const Pa={exec:{category:"shell",emoji:"⚡",label:"Shell",shell:!0},shell:{category:"shell",emoji:"⚡",label:"Shell",shell:!0},exec_command:{category:"shell",emoji:"⚡",label:"Shell",shell:!0},shell_command:{category:"shell",emoji:"⚡",label:"Shell",shell:!0},write_stdin:{category:"shell",emoji:"💻",label:"stdin",shell:!0},wait:{category:"shell",emoji:"⏳",label:"wait",shell:!0},apply_patch:{category:"file",emoji:"🩹",label:"Edit"},update_plan:{category:"task",emoji:"📋",label:"Plan"},run:{category:"web",emoji:"🌐",label:"Web"}},WL=Object.fromEntries(Object.entries(Pa).map(([e,t])=>[e,t.category])),VL=Object.fromEntries(Object.entries(Pa).map(([e,t])=>[e,t.emoji])),GL=Object.fromEntries(Object.entries(Pa).map(([e,t])=>[e,t.label])),YL=new Set(Object.keys(Pa)),KL=new Set(Object.entries(Pa).filter(([,e])=>e.shell).map(([e])=>e)),f1={Read:"file",Write:"file",Edit:"file",MultiEdit:"file",Glob:"file",Grep:"file",LS:"file",NotebookEdit:"file",Bash:"shell",PowerShell:"shell",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",...WL};function ZC(e){return e.startsWith("mcp__")?"mcp":Object.hasOwn(f1,e)?f1[e]:"other"}const XL=/\btools\.exec_command\s*\(\s*\{[^{}]*?\bcmd\s*:\s*(["'`])((?:\\.|(?!\1)[^\\])*)\1/,QL=/\btools\.([A-Za-z_$][\w$]*)\s*\(/;function ZL(e){if(typeof e!="string"||!e)return null;const t=XL.exec(e);if(t){const i=JL(t[2]);if(i.trim())return i}const r=QL.exec(e);return r?r[1]:null}function JL(e){return e.replace(/\\(["'`\\nrt])/g,(t,r)=>r==="n"?`
|
|
66
|
+
`:r==="r"?"\r":r==="t"?" ":r)}const JC=600,e$=4,t$=36,Dv=16,n$=60,r$=6,h1=220,p1=96,s$=28,m1={Read:"📖",Write:"💾",Edit:"✏️",MultiEdit:"🔧",Glob:"🗺️",Grep:"🔎",Bash:"⚡",PowerShell:"💻",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:"📡",...VL};function g1(e){return e.startsWith("mcp__")?"🔌":Object.hasOwn(m1,e)?m1[e]:"✨"}const v1={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 ej(e){if(!e)return null;let t=e.trim();if(!t)return null;const r=t.match(/^(?:bash|sh|zsh|fish|powershell|pwsh)(?:\.exe)?\s+(?:-c|-Command|-NoProfile|-NonInteractive|\s)+["']([^"']+)["']/i);if(r)return ej(r[1]);for(;;){const a=t.match(/^([A-Z_][A-Z0-9_]*=\S*)\s+/);if(!a)break;t=t.slice(a[0].length)}t=t.replace(/^sudo(?:\s+-\S+)*\s+/,""),t=t.replace(/^(?:time|nohup|xargs)\s+/,"");const i=t.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 i$(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;const t=e;if(typeof t.script=="string"){const r=ZL(t.script);if(r)return r}if(typeof t.cmd=="string")return t.cmd;if(typeof t.command=="string")return t.command;if(Array.isArray(t.command)&&t.command.every(r=>typeof r=="string")){const r=t.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 t.script=="string"?t.script:null}const o$=new Set(["Bash","PowerShell",...KL]),a$=YL;function l$(e,t){return a$.has(e)||e.startsWith("mcp__")?Math.max(p1,34+t.length*7.5):p1}function u$(e,t){if(!o$.has(e))return null;const r=i$(t);if(!r)return null;const i=ej(r);return i?{emoji:Object.hasOwn(v1,i)?v1[i]:"⚙️",label:i,category:"shell",detail:r}:null}const c$=new Set(["Read","Write","Edit","MultiEdit","NotebookEdit","LS","Glob","apply_patch"]),y1={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:"🗄️"},w1={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 d$(e){const r=e.replace(/\\/g,"/").replace(/\/+$/,""),i=r.lastIndexOf("/");return i>=0?r.slice(i+1):r}function f$(e){const t=e.toLowerCase();if(Object.hasOwn(w1,t))return w1[t];if(t.startsWith("dockerfile."))return"🐳";if(/\.(test|spec)\.[a-z]+$/.test(t))return"🧪";const r=t.lastIndexOf(".");if(r>0&&r<t.length-1){const i=t.slice(r+1);if(Object.hasOwn(y1,i))return y1[i]}return"📄"}function h$(e,t){if(!t||typeof t!="object")return null;const r=t;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 p$(e,t){if(!c$.has(e))return null;const r=h$(e,t);if(!r)return null;const i=d$(r);return i?{emoji:e==="LS"?"📂":f$(i),label:i,category:"file",detail:r}:null}const x1={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 my(e){if(!e.startsWith("mcp__"))return null;const t=e.slice(5),r=t.indexOf("__");return r<=0?{server:t,method:""}:{server:t.slice(0,r),method:t.slice(r+2)}}function m$(e){let t=5381;for(let r=0;r<e.length;r++)t=(t<<5)+t^e.charCodeAt(r);return Math.abs(t)%360}function tj(e){const t=e.toLowerCase();return Object.hasOwn(x1,t)?x1[t]:void 0}function g$(e,t){const r=my(e);if(!r)return null;const{server:i,method:o}=r;if(!o)return null;const a=tj(i);return{emoji:(a==null?void 0:a.emoji)??"🔌",label:o,category:"mcp",detail:a?`${a.name} · ${o}`:`${i} · ${o}`}}function v$(e,t){return u$(e,t)??p$(e,t)??g$(e)}const _1=GL;function nj(e){const t=my(e);if(t){const i=tj(t.server);return i?{emoji:i.emoji,label:i.name}:{emoji:"🔌",label:t.server,hue:m$(t.server)}}const r=Object.hasOwn(_1,e)?_1[e]:"";return r?{emoji:g1(e),label:r}:{emoji:g1(e),label:e}}function y$(e){let t=null,r="";for(const i of e){const o=my(i);if(o){if(!o.server)return null;if(t===null)t=o.server,r=i;else if(o.server!==t)return null}}return t===null?null:nj(r)}function w$(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function x$(e,t,r){if(r==null)return 1;const i=t-r;return i<0?1:Math.max(0,1-i/JC)}function _$(e,t){const r=[],i=new Set;for(let o=e.length-1;o>=0&&r.length<t;o--){const a=e[o];i.has(a.id)||(i.add(a.id),r.push(a))}return r.reverse()}function b$(e,t,r,i,o,a){const u=[];for(const c of e.values()){if(!t.has(c.id)||c.exitAt!=null&&a-c.exitAt>JC)continue;const f=i.get(c.id)??r.get(c.id);if(!f)continue;const p=_$(c.tools,e$);if(p.length===0)continue;const d=c.exitAt??null,g=o.get(c.id),y=Math.max((g==null?void 0:g.width)??h1,h1),w=(g==null?void 0:g.height)??130,k=f.x,_=f.y,b=k+y,S=_+w/2;p.forEach((E,N)=>{const j=N*t$,A=k+y+n$,I=_+r$+j,L=x$(E,a,d),P=E.inputPreview??"",D=w$(E),M=L<.999,q=nj(E.name);u.push({id:`${c.id}::${E.id}`,toolId:E.id,agentId:c.id,toolName:E.name,name:q.label,emoji:q.emoji,status:D,category:ZC(E.name),mcpHue:q.hue,inputPreview:P,fade:L,fading:M,worldX:A,worldY:I,anchorX:b,anchorY:S,spawnDx:b-A,spawnDy:S-(I+Dv)});const W=v$(E.name,E.input);if(W){const K=l$(E.name,q.label),C=A+K+s$,z=I,F=A+K,te=I+Dv;u.push({id:`sub:${c.id}::${E.id}`,toolId:E.id,agentId:c.id,toolName:E.name,name:W.label,emoji:W.emoji,isSub:!0,status:D,category:W.category,inputPreview:W.detail??P,fade:L,fading:M,worldX:C,worldY:z,anchorX:F,anchorY:te,spawnDx:F-C,spawnDy:0})}})}return u}function S$({agents:e,visibleAgentIds:t,positions:r,pinned:i,measured:o,spotlight:a,hiddenCategories:u,now:c,onOpenTool:f}){const p=b$(e,t,r,i,o,c),d=u&&u.size>0?p.filter(g=>!u.has(g.category)):p;return m.jsx(k$,{bursts:d,spotlight:a,onOpenTool:f})}function k$({bursts:e,spotlight:t,onOpenTool:r}){const{x:i,y:o,zoom:a}=MC();return m.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,children:[m.jsx("svg",{className:"tool-bursts-svg",children:e.map(u=>{const c=u.anchorX*a+i,f=u.anchorY*a+o,p=(u.worldX+6)*a+i,d=(u.worldY+Dv)*a+o,g=c+(p-c)*.55,y=t!=null&&!t.has(u.agentId),w=u.fade*(y?.14:1);return m.jsx("path",{d:`M ${c} ${f} Q ${g} ${f}, ${p} ${d}`,className:`tool-conn status-${u.status}${u.fading?" fading":""}`,opacity:w},`l:${u.id}`)})}),e.map(u=>{const c=u.worldX*a+i,f=u.worldY*a+o,p={left:`${c}px`,top:`${f}px`,transform:`scale(${a})`,transformOrigin:"left top","--spawn-dx":`${u.spawnDx}px`,"--spawn-dy":`${u.spawnDy}px`},d=u.isSub?`${u.toolName} · ${u.name}`:u.toolName,g=u.inputPreview?`${d} · ${u.inputPreview}`:d,y=r!=null,w=u.mcpHue!=null?{"--mcp-hue":u.mcpHue}:{},_=t!=null&&!t.has(u.agentId)?" dim":"";return m.jsx("div",{className:"tool-burst-wrap",style:p,children:m.jsxs("div",{className:`tool-burst cat-${u.category}${u.mcpHue!=null?" mcp-hue":""} status-${u.status}${u.fading?" fading":""}${y?" clickable":""}${u.isSub?" sub":""}${_}`,style:w,title:g,onClick:y?()=>r(u.toolId):void 0,children:[m.jsx("span",{className:"tb-emoji",children:u.emoji}),m.jsx("span",{className:"tb-name",children:u.name}),u.status==="inflight"&&m.jsx("span",{className:"tb-spin"}),u.status==="done"&&m.jsx("span",{className:"tb-mark done",children:"✓"}),u.status==="err"&&m.jsx("span",{className:"tb-mark err",children:"×"})]})},u.id)})]})}function gy({cost:e,size:t="md"}){const r=e.total;if(r<=0)return null;const i=(a,u,c)=>{if(a<=0)return null;const f=a/r*100;return m.jsx("span",{className:`cb-seg ${u}`,style:{width:`${f}%`},title:`${c}: ${Xe(a)} (${f.toFixed(0)}%)`},u)},o=t==="lg";return m.jsxs("div",{className:o?"cost-bar cost-bar-lg":"cost-bar",role:"img","aria-label":"Cost breakdown",children:[i(e.input,"cb-input","input"),i(e.output,"cb-output","output"),i(e.cacheRead,"cb-cache-r","cache read"),i(e.cacheWrite,"cb-cache-w","cache write")]})}function E$({state:e,sessionId:t,onClose:r}){const i=R.useMemo(()=>N$(e,t),[e,t]),o=R.useRef(null),a=ri(r,{focusRef:o});return i?m.jsx("div",{className:"modal-backdrop",onClick:r,role:"presentation",children:m.jsxs("div",{ref:a,className:"modal session-summary",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[m.jsxs("div",{className:"modal-head",children:[m.jsxs("div",{className:"modal-title",children:[m.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),m.jsx("span",{id:"ss-title",className:"modal-tool-name",title:i.cwd??i.sessionId,children:i.label}),m.jsxs("span",{className:"modal-tool-id",children:["· ",i.sessionId.slice(0,8)]})]}),m.jsxs("div",{className:"modal-actions",children:[m.jsx("span",{className:"modal-dur",title:"Total wall time",children:i.durationLabel}),m.jsx("button",{type:"button",ref:o,className:"glyph-btn",onClick:r,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),m.jsxs("div",{className:"modal-body",children:[m.jsxs("section",{className:"ss-hero",children:[m.jsxs("div",{className:"ss-hero-left",children:[m.jsx("div",{className:"ss-cost-label",children:"total spend"}),m.jsx("div",{className:"ss-cost",children:Xe(i.cost.total)}),i.modelChips.length>0&&m.jsx("div",{className:"ss-models",children:i.modelChips.map(u=>m.jsx("span",{className:"model-chip",title:u,children:ni(u)},u))})]}),m.jsx("div",{className:"ss-hero-right",children:i.cost.total>0&&m.jsxs(m.Fragment,{children:[m.jsx(gy,{cost:i.cost,size:"lg"}),m.jsxs("div",{className:"ss-cost-legend",children:[m.jsxs("span",{className:"ssl ssl-in",children:["input ",m.jsx("b",{children:Xe(i.cost.input)})]}),m.jsxs("span",{className:"ssl ssl-out",children:["output ",m.jsx("b",{children:Xe(i.cost.output)})]}),m.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",m.jsx("b",{children:Xe(i.cost.cacheRead)})]}),m.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",m.jsx("b",{children:Xe(i.cost.cacheWrite)})]})]})]})})]}),m.jsxs("section",{className:"ss-stats",children:[m.jsx(Qi,{label:"agents",value:i.agentCount}),m.jsx(Qi,{label:"subagents",value:i.subagentCount}),m.jsx(Qi,{label:"tool calls",value:i.toolCount}),m.jsx(Qi,{label:"prompts",value:i.promptCount}),m.jsx(Qi,{label:"tokens",value:i.tokensSum.toLocaleString()}),i.errCount>0&&m.jsx(Qi,{label:"errors",value:i.errCount,tone:"err"})]}),i.topTools.length>0&&m.jsxs("section",{className:"modal-section",children:[m.jsx("h4",{children:"Most-used tools"}),m.jsx("div",{className:"ss-top-tools",children:i.topTools.map(([u,c])=>m.jsxs("div",{className:"ss-tt",children:[m.jsx("span",{className:"ss-tt-name",children:u}),m.jsx("span",{className:"ss-tt-bar",children:m.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${c/i.topTools[0][1]*100}%`}})}),m.jsx("span",{className:"ss-tt-count",children:c})]},u))})]}),i.firstPrompt&&m.jsxs("section",{className:"modal-section",children:[m.jsx("h4",{children:"Opening prompt"}),m.jsx("div",{className:"ss-prompt",children:i.firstPrompt})]})]})]})}):null}function Qi({label:e,value:t,tone:r}){return m.jsxs("div",{className:`ss-stat${r?` tone-${r}`:""}`,children:[m.jsx("div",{className:"ss-stat-value",children:t}),m.jsx("div",{className:"ss-stat-label",children:e})]})}function N$(e,t){const r=e.agents.get(t);if(!r)return null;const i=[];for(const N of e.agents.values())N.sessionId===t&&i.push(N);if(i.length===0)return null;const o={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},a=new Set,u=new Map;let c=0,f=0,p=0,d=0,g=0,y,w=1/0,k=0;for(const N of i){const j=hn(N.usage,N.model);o.input+=j.input,o.output+=j.output,o.cacheRead+=j.cacheRead,o.cacheWrite+=j.cacheWrite,o.total+=j.total,N.model&&a.add(N.model),N.kind==="subagent"&&g++,f+=N.prompts.length,!y&&N.prompts.length>0&&(y=N.prompts[0].text),p+=N.usage.inputTokens+N.usage.outputTokens,c+=N.toolCount,w=Math.min(w,N.startedAt),k=Math.max(k,N.endedAt??Date.now());for(const A of N.tools)u.set(A.name,(u.get(A.name)??0)+1),A.ok===!1&&d++}const _=Math.max(0,k-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`,E=Array.from(u.entries()).sort((N,j)=>j[1]-N[1]).slice(0,5);return{sessionId:t,label:r.label||r.cwdBasename||"session",cwd:r.cwd,durationLabel:S,cost:o,modelChips:Array.from(a),agentCount:i.length,subagentCount:g,toolCount:c,promptCount:f,tokensSum:p,errCount:d,topTools:E,firstPrompt:y}}function vy(e){return(e==null?void 0:e.kind)==="permission"}function C$(e){const t=[];for(const r of e)r.kind==="root"&&vy(r.waiting)&&t.push({id:r.id,label:r.label,waiting:r.waiting});return t.sort((r,i)=>r.waiting.since-i.waiting.since)}function j$(e){const t=new Set;for(const r of e)r.state==="active"&&t.add(r.sessionId);return t.size}function b1(e){return e.waiting?vy(e.waiting)?0:1:e.state==="active"?2:3}function T$(e,t){const r=[];for(const i of e.agents.values()){if(i.kind!=="root")continue;let o=i.toolCount,a=hn(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,a+=hn(c.usage,c.model).total;const f=c.endedAt??c.startedAt;f>u&&(u=f)}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:a,startedAt:i.startedAt,lastActivity:u})}return r.sort((i,o)=>{const a=b1(i),u=b1(o);return a!==u?a-u:i.waiting&&o.waiting?i.waiting.since-o.waiting.since:o.lastActivity-i.lastActivity}),r}function S1(e,t,r){const i=(t??r)-e;if(i<1e3)return"<1s";const o=Math.floor(i/1e3);if(o<60)return`${o}s`;const a=Math.floor(o/60);return a<60?`${a}m`:`${Math.floor(a/60)}h ${a%60}m`}function R$({state:e,now:t,selectedIds:r,onSelect:i,onClose:o}){const a=R.useMemo(()=>T$(e),[e,e.lastSeq,t]),u=a.filter(f=>f.state==="active").length,c=a.filter(f=>vy(f.waiting)).length;return m.jsxs("aside",{className:"session-list",id:"session-list","aria-label":"Sessions",children:[m.jsxs("div",{className:"sl-header",children:[m.jsxs("h2",{children:["Sessions ",m.jsx("span",{className:"sl-count",children:a.length})]}),c>0&&m.jsxs("span",{className:"sl-waiting-count",children:[c," waiting"]}),u>0&&m.jsxs("span",{className:"sl-live-count",children:[u," live"]}),m.jsx("button",{className:"glyph-btn sl-close",onClick:o,title:"Hide sidebar (L)","aria-label":"Hide session list",children:"‹"})]}),m.jsxs("div",{className:"sl-rows",children:[a.length===0&&m.jsx("div",{className:"sl-empty",children:"No sessions yet."}),a.map(f=>{const p=r.has(f.sessionId);return m.jsxs("button",{type:"button",className:`sl-row state-${f.state}${p?" selected":""}`,onClick:()=>i(f.sessionId),title:`Focus ${f.label}`,children:[m.jsx("span",{className:`sl-dot state-${f.state}`,"aria-hidden":!0}),m.jsx("span",{className:"vis-hidden",children:py(f.state)}),m.jsxs("div",{className:"sl-row-body",children:[m.jsxs("div",{className:"sl-row-head",children:[m.jsx("span",{className:"sl-label",children:f.label}),f.modelId&&m.jsx("span",{className:"model-chip",title:f.modelId,children:ni(f.modelId)})]}),m.jsxs("div",{className:"sl-row-meta",children:[m.jsxs("span",{title:"tool calls",children:[m.jsx("b",{children:f.toolCount})," tools"]}),f.cost>0&&m.jsx("span",{className:"sl-cost",title:"total spend",children:m.jsx("b",{children:Xe(f.cost)})}),f.waiting?m.jsxs("span",{className:"sl-waiting",title:`${Uu(f.waiting)}
|
|
67
|
+
Blocked since ${new Date(f.waiting.since).toLocaleTimeString()} · started ${new Date(f.startedAt).toLocaleString()}`,children:["waiting ",S1(f.waiting.since,void 0,t)]}):m.jsx("span",{className:"sl-elapsed",title:`Started ${new Date(f.startedAt).toLocaleString()}`,children:S1(f.startedAt,f.state==="active"?void 0:f.lastActivity,t)})]})]})]},f.sessionId)})]})]})}const Vt="ccdeck";function rj(e){const t=Math.max(0,e);return t<60?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function Fv(e){return rj(Math.floor(e/1e3))}function sj(e,t){const r=e-t;if(r<=0)return null;const i=Math.floor(r/86400),o=Math.floor(r%86400/3600),a=Math.floor(r%3600/60);return i>0?`${i}d ${o}h`:o>0?`${o}h ${a}m`:`${a}m`}function A$(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function I$(e,t,r){const i=new Date(e),o=Fv(t-e);return{label:A$(i,new Date(t))?o:`${o} · ${i.toLocaleDateString(r,{month:"short",day:"numeric"})}`,title:i.toLocaleString(r,{dateStyle:"medium",timeStyle:"medium"})}}function k1(e,t){if(!e)return null;const r=t-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 M$(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"}const Xd="__unknown__";function O$(e,t,r,i){const o=Math.max(0,t-i),a=Math.max(0,r-o);if(a<120)return null;const u=Math.min(100,a/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 f=100-e,p=a>0?e/a:0,d=p>0?f/p:1/0,g={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);g.runsOutIn=y>0?`${y}h ${w}m`:`${w}m`}return g}return{label:`${Math.round(-c)}% reserve`,color:"var(--ok)",expectedPct:u,isDeficit:!1}}function Ys({pct:e,label:t,reset:r,resetAt:i,windowSec:o,limitReached:a,nowSec:u}){const c=Math.min(100,Math.max(0,e)),p=a||c>=90?"var(--err)":c>=70?"var(--warn)":"var(--accent)",d=c===0?"< 1%":`${c}%`,g=c===0?2:c,y=i?sj(i,u):null,w=i&&o?O$(c,i,o,u):null;return m.jsxs("div",{className:"qb-row",children:[m.jsxs("div",{className:"qb-meta",children:[m.jsxs("span",{className:"qb-label",children:[t,a&&m.jsx("span",{className:"qb-limit-badge",title:"Rate limit reached",children:"⛔"})]}),m.jsx("span",{className:"qb-pct",style:{color:p},children:d})]}),m.jsxs("div",{className:"qb-track",children:[m.jsx("div",{className:"qb-fill",style:{width:`${g}%`,background:p,opacity:c===0?.4:1}}),w&&m.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`})]}),m.jsxs("div",{className:"qb-reset-row",children:[y?m.jsxs("span",{className:"qb-reset",children:["resets in ",y]}):r?m.jsxs("span",{className:"qb-reset",children:["resets ",r]}):null,w&&m.jsx("span",{className:"qb-pace",style:{color:w.color},children:w.runsOutIn?`runs out in ${w.runsOutIn}`:w.label})]})]})}const P$=6e4;function L$(e){const[t,r]=R.useState(null),[i,o]=R.useState(!1),a=R.useRef(null),u=async(f=!1)=>{f&&o(!0);try{const d=await fetch(f?"/api/quota?refresh=1":"/api/quota");d.ok&&r(await d.json())}catch{}finally{f&&o(!1)}};return R.useEffect(()=>{if(e)return u(!0),a.current=window.setInterval(()=>u(!1),P$),()=>{a.current!=null&&window.clearInterval(a.current)}},[e]),{quota:t,loading:i,refresh:()=>{e&&u(!0)}}}function $$(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 ij=6e4;function q$(e){const[t,r]=R.useState(null),[i,o]=R.useState(!1),a=R.useRef(null),u=async(f=!1)=>{f&&o(!0);try{const d=await fetch(f?"/api/codex-quota?refresh=1":"/api/codex-quota");d.ok&&r(await d.json())}catch{}finally{f&&o(!1)}};return R.useEffect(()=>{if(e)return u(!0),a.current=window.setInterval(()=>u(!1),ij),()=>{a.current!=null&&window.clearInterval(a.current)}},[e]),{data:t,loading:i,refresh:()=>{e&&u(!0)}}}function D$(e){const[t,r]=R.useState(null),i=R.useRef(null),o=async()=>{try{const a=await fetch("/api/codex-usage");a.ok&&r(await a.json())}catch{}};return R.useEffect(()=>{if(e)return o(),i.current=window.setInterval(o,ij),()=>{i.current!=null&&window.clearInterval(i.current)}},[e]),{data:t}}function F$({state:e,now:t,providers:r,onClose:i}){var W,K;const{quota:o,loading:a,refresh:u}=L$(r.claude),{data:c,loading:f,refresh:p}=q$(r.codex),{data:d}=D$(r.codex),[g,y]=R.useState(()=>Math.floor(Date.now()/1e3));R.useEffect(()=>{const C=window.setInterval(()=>y(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(C)},[]);const{byModel:w,totalCost:k,totalTokens:_,burnRate:b}=R.useMemo(()=>{const C=new Map,z={total:0,input:0,output:0,cacheRead:0,cacheWrite:0};let F=0,te=0,Z=0,U=0;for(const $ of e.agents.values()){const G=$.model??Xd,ee=hn($.usage,$.model),ie=C.get(G);ie?(ie.inputTokens+=$.usage.inputTokens,ie.outputTokens+=$.usage.outputTokens,ie.cacheReadTokens+=$.usage.cacheReadTokens,ie.cacheCreateTokens+=$.usage.cacheCreateTokens,ie.cost.total+=ee.total,ie.cost.input+=ee.input,ie.cost.output+=ee.output,ie.cost.cacheRead+=ee.cacheRead,ie.cost.cacheWrite+=ee.cacheWrite,ie.agentCount++):C.set(G,{model:G,inputTokens:$.usage.inputTokens,outputTokens:$.usage.outputTokens,cacheReadTokens:$.usage.cacheReadTokens,cacheCreateTokens:$.usage.cacheCreateTokens,cost:{...ee},agentCount:1,priced:co($.model)!=null}),z.total+=ee.total,z.input+=ee.input,z.output+=ee.output,z.cacheRead+=ee.cacheRead,z.cacheWrite+=ee.cacheWrite,F+=$.usage.inputTokens,te+=$.usage.outputTokens,Z+=$.usage.cacheReadTokens,U+=$.usage.cacheCreateTokens}const Q=Array.from(C.values()).sort(($,G)=>G.cost.total-$.cost.total||G.inputTokens+G.outputTokens-($.inputTokens+$.outputTokens));let O=0,V=0;for(const $ of e.agents.values()){if($.state!=="active")continue;const G=hn($.usage,$.model);O+=G.total,V=Math.max(V,(($.endedAt??t)-$.startedAt)/1e3)}const ce=V>0?Ru(O,V):null;return{byModel:Q,totalCost:z,totalTokens:{in:F,out:te,cacheR:Z,cacheC:U},burnRate:ce}},[e,e.lastSeq,t]),S=R.useMemo(()=>{const C=[],z=F=>co(F.model)==null?F.usage.inputTokens+F.usage.outputTokens:0;for(const F of e.agents.values()){if(F.kind!=="root")continue;let te=hn(F.usage,F.model).total,Z=F.usage.inputTokens,U=F.usage.outputTokens,Q=z(F);for(const O of e.agents.values())O.sessionId!==F.sessionId||O.kind==="root"||(te+=hn(O.usage,O.model).total,Z+=O.usage.inputTokens,U+=O.usage.outputTokens,Q+=z(O));C.push({sessionId:F.sessionId,label:F.label||F.cwdBasename||"session",state:F.state,cost:te,inputTokens:Z,outputTokens:U,unpricedTokens:Q})}return C.sort((F,te)=>te.cost-F.cost||te.inputTokens+te.outputTokens-(F.inputTokens+F.outputTokens)).slice(0,12)},[e,e.lastSeq]),E=k.total>0,N=_.in+_.out,j=w.filter(C=>C.cost.total>0||C.inputTokens+C.outputTokens>0),A=S.filter(C=>C.cost>0||C.inputTokens+C.outputTokens>0),I=j.some(C=>!C.priced),L=a||f,P=k1(o==null?void 0:o.fetchedAt,g),D=k1(c==null?void 0:c.fetchedAt,g),M=()=>{u(),p()},q=r.claude&&r.codex?"Refresh Claude + Codex quota":r.codex?"Refresh Codex quota":"Refresh Claude quota";return m.jsxs("aside",{className:"usage-panel",id:"usage-panel","aria-label":"Usage",children:[m.jsxs("div",{className:"up-header",children:[m.jsx("h2",{children:"Usage"}),b&&m.jsx("span",{className:"up-rate",children:b}),m.jsxs("div",{className:"up-header-right",children:[(r.claude||r.codex)&&m.jsx("button",{type:"button",className:"glyph-btn up-refresh-btn",onClick:M,disabled:L,"aria-label":q,title:q,children:L?"…":"↻"}),m.jsx("button",{type:"button",className:"glyph-btn up-close",onClick:i,"aria-label":"Close usage panel",title:"Close (U)",children:"×"})]})]}),r.claude&&m.jsxs("section",{className:"up-section up-quota-section",children:[m.jsxs("h3",{className:"up-section-title",children:["Claude quota",P&&!a&&m.jsx("span",{className:"up-section-age",title:M$(o==null?void 0:o.source),children:P})]}),o!=null&&o.ok?m.jsxs("div",{className:"up-quota-bars",children:[o.session5hPct!=null&&m.jsx(Ys,{label:"5-hour window",pct:o.session5hPct,reset:o.session5hReset,resetAt:o.session5hResetAt,windowSec:o.session5hWindowSec,nowSec:g}),o.week7dPct!=null&&m.jsx(Ys,{label:"7-day window",pct:o.week7dPct,reset:o.week7dReset,resetAt:o.week7dResetAt,windowSec:o.week7dWindowSec,nowSec:g}),o.weekSonnetPct!=null&&m.jsx(Ys,{label:"Sonnet (7d)",pct:o.weekSonnetPct,nowSec:g}),o.weekOpusPct!=null&&m.jsx(Ys,{label:"Opus (7d)",pct:o.weekOpusPct,nowSec:g})]}):(o==null?void 0:o.ok)===!1?m.jsxs("div",{className:"up-quota-na",children:[m.jsx("span",{children:"Quota unavailable."}),m.jsxs("span",{className:"up-quota-hint",children:["Run ",m.jsx("code",{children:"/usage"})," in a claude session, then click ↻"]})]}):m.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"})]}),r.codex&&m.jsxs("section",{className:"up-section up-quota-section",children:[m.jsxs("h3",{className:"up-section-title",children:["Codex quota",(c==null?void 0:c.ok)&&c.planLabel&&m.jsx("span",{className:"up-plan-badge",children:c.planLabel}),D&&!f&&m.jsx("span",{className:"up-section-age",title:"Fetched from the Codex usage endpoint",children:D})]}),c!=null&&c.ok?m.jsxs("div",{className:"up-quota-bars",children:[(W=c.windows)==null?void 0:W.map(C=>m.jsx(Ys,{label:C.label,pct:C.pct,reset:C.reset??void 0,resetAt:C.resetAt??void 0,windowSec:C.windowSec??void 0,limitReached:c.limitReached&&C.pct>=100,nowSec:g},C.id)),(K=c.extraWindows)==null?void 0:K.map(C=>m.jsx(Ys,{label:C.label,pct:C.pct,reset:C.reset??void 0,resetAt:C.resetAt??void 0,windowSec:C.windowSec??void 0,nowSec:g},C.id)),c.creditLimit&&m.jsx(Ys,{label:`spend cap · $${Math.round(c.creditLimit.used)} of $${Math.round(c.creditLimit.limit)}`,pct:c.creditLimit.usedPct,reset:c.creditLimit.reset??void 0,resetAt:c.creditLimit.resetAt??void 0,limitReached:c.spendControlReached,nowSec:g}),c.creditsBalance&&!c.creditsUnlimited&&m.jsxs("div",{className:"up-quota-sub up-credits",children:["credits: $",c.creditsBalance,c.overageReached&&" · overage limit reached"]}),c.creditsUnlimited&&m.jsx("div",{className:"up-quota-sub up-credits",children:"credits: unlimited"}),c.resetCredits&&c.resetCredits.availableCount>0&&m.jsxs("div",{className:"up-quota-sub up-reset-credits",title:`Redeem in the Codex CLI or ChatGPT — ${Vt} only reports them`,children:[c.resetCredits.availableCount," rate-limit reset",c.resetCredits.availableCount!==1?"s":""," available",c.resetCredits.nextExpiryAt&&` · expires ${new Date(c.resetCredits.nextExpiryAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`]}),c.promo&&m.jsx("div",{className:"up-quota-sub",children:c.promo}),c.partial&&m.jsx("div",{className:"up-quota-sub up-quota-hint",children:"Partial data — OpenAI returned limits this build doesn't recognise."})]}):(c==null?void 0:c.ok)===!1?m.jsxs("div",{className:"up-quota-na",children:[m.jsx("span",{children:"Quota unavailable."}),m.jsx("span",{className:"up-quota-hint",children:$$(c.reason)})]}):m.jsx("div",{className:"up-quota-na up-quota-loading",children:"Checking…"}),(d==null?void 0:d.ok)&&d.window7d&&d.window7d.sessionCount>0&&m.jsxs("div",{className:"up-quota-sub",title:`Counted from the rollout files under CODEX_HOME — no network, no account${d.window5h?`
|
|
68
|
+
last 5h: ${At(d.window5h.totalTokens)} tokens · ${d.window5h.sessionCount} session${d.window5h.sessionCount!==1?"s":""}`:""}`,children:[At(d.window7d.totalTokens)," tokens · ",d.window7d.sessionCount," session",d.window7d.sessionCount!==1?"s":""," (7d)"]})]}),N>0?m.jsxs(m.Fragment,{children:[E&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"up-total",children:[m.jsx("span",{className:"up-total-value",children:Xe(k.total)}),m.jsx("span",{className:"up-total-label",children:"total spend"})]}),m.jsx(gy,{cost:k})]}),m.jsxs("div",{className:"up-tokens-row",children:[m.jsxs("span",{className:"up-tok",children:[m.jsx("span",{className:"up-k",children:"in"}),At(_.in)]}),m.jsxs("span",{className:"up-tok",children:[m.jsx("span",{className:"up-k",children:"out"}),At(_.out)]}),_.cacheR>0&&m.jsxs("span",{className:"up-tok",children:[m.jsx("span",{className:"up-k",children:"cache r"}),At(_.cacheR)]}),_.cacheC>0&&m.jsxs("span",{className:"up-tok",children:[m.jsx("span",{className:"up-k",children:"cache c"}),At(_.cacheC)]})]}),j.length>0&&m.jsxs("section",{className:"up-section",children:[m.jsx("h3",{className:"up-section-title",children:"By model"}),m.jsxs("table",{className:"up-table",children:[m.jsx("thead",{children:m.jsxs("tr",{children:[m.jsx("th",{children:"Model"}),m.jsx("th",{children:"Tokens"}),m.jsx("th",{children:"Cost"})]})}),m.jsx("tbody",{children:j.map(C=>m.jsxs("tr",{children:[m.jsx("td",{className:"up-model-name",title:C.model===Xd?"no model reported yet":C.model,children:C.model===Xd?"unknown":ni(C.model)}),m.jsx("td",{className:"up-num",children:At(C.inputTokens+C.outputTokens)}),C.priced?m.jsx("td",{className:"up-num up-cost-val",children:Xe(C.cost.total)}):m.jsx("td",{className:"up-num up-unpriced",children:yu})]},C.model))})]})]}),A.length>0&&m.jsxs("section",{className:"up-section",children:[m.jsx("h3",{className:"up-section-title",children:"By session"}),m.jsx("div",{className:"up-sessions",children:A.map(C=>m.jsxs("div",{className:"up-session-row",children:[m.jsx("span",{className:`sl-dot state-${C.state}`,"aria-hidden":!0}),m.jsx("span",{className:"vis-hidden",children:py(C.state)}),m.jsx("span",{className:"up-session-label",children:C.label}),m.jsx("span",{className:"up-session-tokens",children:At(C.inputTokens+C.outputTokens)}),C.cost>0?m.jsxs("span",{className:"up-session-cost",title:C.unpricedTokens>0?`${At(C.unpricedTokens)} tokens in this session are on an unpriced model, so this is a floor`:void 0,children:[Xe(C.cost),C.unpricedTokens>0?"+":""]}):m.jsx("span",{className:"up-session-cost up-unpriced",children:yu})]},C.sessionId))})]}),I&&m.jsxs("div",{className:"up-hint",children:["“",yu,"” means this build holds no published rate for that model — those tokens are counted above and their dollars are not."]})]}):m.jsxs("div",{className:"up-empty",children:["No usage data yet.",m.jsx("br",{}),"Start a Claude Code or Codex session."]})]})}const z$="1",E1="agent-dag.schema",B$=["agent-dag.layout","agent-dag.viewport"];function yy(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}}function U$(e,t=z$){let r=null;try{r=e.getItem(E1)}catch{return[]}if(r===t)return[];const i=[];if(r!==null)for(const o of B$)try{e.getItem(o)!==null&&(e.removeItem(o),i.push(o))}catch{}try{e.setItem(E1,t)}catch{}return i}const H$=3e3,W$=4e3,Qd=20,ua=36,Zi=8,oj="agent-dag.systemPanelOpen";function V$(){return yy(oj)==="1"}function G$(e){if(!(typeof window>"u"))try{window.localStorage.setItem(oj,e?"1":"0")}catch{}}function Na(e){return e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} KB`}function Y$(e){const t=Math.floor(e/86400),r=Math.floor(e%86400/3600),i=Math.floor(e%3600/60);return t>0?`${t}d ${r}h`:r>0?`${r}h ${i}m`:`${i}m`}function K$(){const[e,t]=R.useState(null),r=R.useRef(null);return R.useEffect(()=>{let i=!0;const o=async()=>{if(document.visibilityState!=="hidden")try{const f=await fetch("/api/system");if(!f.ok)return;const p=await f.json();i&&(p!=null&&p.ok)&&t(p)}catch{}},a=()=>{r.current==null&&(o(),r.current=window.setInterval(o,H$))},u=()=>{r.current!=null&&(window.clearInterval(r.current),r.current=null)},c=()=>{if(document.visibilityState==="hidden"){u();return}a(),o()};return a(),document.addEventListener("visibilitychange",c),()=>{i=!1,u(),document.removeEventListener("visibilitychange",c)}},[]),e}function X$(e){const[t,r]=R.useState(null);return R.useEffect(()=>{let i=!0;const o=async()=>{if(document.visibilityState!=="hidden")try{const u=await fetch("/api/system/processes");if(!u.ok)return;const c=await u.json();i&&(c!=null&&c.ok)&&r(c.procs??[])}catch{}};o();const a=window.setInterval(o,W$);return()=>{i=!1,window.clearInterval(a)}},[e]),t}function Q$({usageOpen:e=!1}){const t=K$(),[r,i]=R.useState(V$);R.useEffect(()=>{G$(r)},[r]);const o=R.useRef(null);if(!t||t.cpu==null||!t.memory)return m.jsx("span",{className:"sysmeter idle",title:"Sampling this machine…",children:m.jsx("span",{className:"sm-box","aria-hidden":!0,children:m.jsxs("span",{className:"sm-graphic",children:[m.jsx("svg",{className:"sm-spark",width:ua,height:Zi,viewBox:`0 0 ${ua} ${Zi}`}),m.jsx("span",{className:"sm-ram"})]})})});const{cpu:a,cpuHistory:u,cores:c,memory:f,loadavg:p}=t,d=f.usedPct>=90,g=u.slice(-Qd),y=Qd-g.length,w=ua/Qd,k=[`CPU ${a.toFixed(0)}% of ${c} cores`,p?`load ${p[0]} · ${p[1]} · ${p[2]} (1m · 5m · 15m)`:null,`Memory ${Na(f.total-f.available)} of ${Na(f.total)} used`,"","Click for detail. This machine, not this session."].filter(_=>_!==null).join(`
|
|
69
|
+
`);return m.jsxs("span",{className:"sysmeter-wrap",children:[m.jsxs("button",{type:"button",ref:o,className:"sysmeter",title:k,"aria-label":"Toggle machine detail","aria-expanded":r,"aria-controls":r?"system-panel":void 0,onClick:()=>i(_=>!_),children:[m.jsxs("span",{className:"sm-box","aria-hidden":!0,children:[m.jsxs("span",{className:"sm-graphic",children:[m.jsx("svg",{className:"sm-spark",width:ua,height:Zi,viewBox:`0 0 ${ua} ${Zi}`,children:g.map((_,b)=>{const S=y+b,E=Math.max(1,_/100*Zi),N=.32+.68*((b+1)/g.length);return m.jsx("rect",{x:S*w,y:Zi-E,width:Math.max(.8,w-.7),height:E,rx:.5,fill:"var(--accent)",opacity:N},S)})}),m.jsx("span",{className:"sm-ram",children:m.jsx("span",{className:`sm-ram-fill${d?" warn":""}`,style:{transform:`scaleX(${Math.max(2,f.usedPct)/100})`}})})]}),m.jsxs("span",{className:"sm-read",children:[m.jsx("b",{children:a.toFixed(0)}),m.jsx("i",{children:"·"}),m.jsx("b",{children:f.usedPct.toFixed(0)})]})]}),m.jsxs("span",{className:"sm-sr",children:["CPU ",a.toFixed(0)," percent, memory ",f.usedPct.toFixed(0)," percent used"]})]}),r&&m.jsx(Z$,{sys:t,usageOpen:e,onClose:()=>{var _;i(!1),(_=o.current)==null||_.focus()}})]})}function Z$({sys:e,usageOpen:t,onClose:r}){const i=X$(!0),{memory:o,swap:a,perCore:u,loadavg:c,cores:f,uptimeSec:p,platform:d}=e,g=o?o.total-o.available:0,y=d==="win32"?"Commit":"Swap",w=a&&a.total>0?a.used/a.total*100:0;return m.jsxs("aside",{className:`sysdetail${t?" shifted":""}`,id:"system-panel","aria-label":"Machine detail",children:[m.jsxs("div",{className:"sd-head",children:[m.jsx("span",{className:"sd-title",children:"This machine"}),m.jsxs("span",{className:"sd-sub",children:["up ",Y$(p)," · ",f," cores"]}),m.jsx("button",{type:"button",className:"glyph-btn sd-close",onClick:r,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]}),u&&u.length>0&&m.jsxs("div",{className:"sd-section",role:"group","aria-label":"Cores",children:[m.jsx("div",{className:"sd-h","aria-hidden":!0,children:"Cores"}),m.jsx("div",{className:"sd-cores",style:{"--n":u.length},children:u.map((k,_)=>m.jsx("span",{className:"sd-core",title:`core ${_+1}: ${k}%`,children:m.jsx("span",{className:"sd-core-fill",style:{transform:`scaleY(${Math.max(2,k)/100})`}})},_))})]}),m.jsxs("div",{className:"sd-section",role:"group","aria-label":"Memory",children:[m.jsx("div",{className:"sd-h","aria-hidden":!0,children:"Memory"}),o&&m.jsx(N1,{label:"Physical",used:g,total:o.total,pct:o.usedPct,note:`${Na(o.available)} available`}),a&&a.total>0&&m.jsx(N1,{label:y,used:a.used,total:a.total,pct:w,note:w>=50?"paging to disk":void 0})]}),c&&m.jsxs("div",{className:"sd-section",role:"group","aria-label":"Load average",children:[m.jsx("div",{className:"sd-h","aria-hidden":!0,children:"Load average"}),m.jsx("div",{className:"sd-load",children:c.map((k,_)=>m.jsxs("span",{className:`sd-load-item${k>f?" over":""}`,children:[m.jsx("b",{children:k.toFixed(2)}),m.jsx("span",{children:["1m","5m","15m"][_]})]},_))}),m.jsx("div",{className:"sd-note",children:c[0]>f?`${(c[0]/f).toFixed(1)}× more work queued than cores to run it`:`within ${f} cores`})]}),m.jsxs("div",{className:"sd-section",role:"group","aria-label":"Busiest processes",children:[m.jsx("div",{className:"sd-h","aria-hidden":!0,children:"Busiest processes"}),i==null?m.jsx("div",{className:"sd-note",children:"reading…"}):i.length===0?m.jsx("div",{className:"sd-note",children:"Could not read the process list on this platform."}):m.jsxs("table",{className:"sd-procs",children:[m.jsx("thead",{children:m.jsxs("tr",{children:[m.jsx("th",{children:"cpu"}),m.jsx("th",{children:"mem"}),m.jsx("th",{children:"process"})]})}),m.jsx("tbody",{children:i.map(k=>m.jsxs("tr",{children:[m.jsx("td",{className:"sd-num",children:k.cpu==null?"—":k.cpu.toFixed(0)}),m.jsx("td",{className:"sd-num sd-dim",children:k.mem.toFixed(1)}),m.jsx("td",{className:"sd-proc-name",title:`pid ${k.pid}`,children:k.name})]},k.pid))})]})]})]})}function N1({label:e,used:t,total:r,pct:i,note:o}){const a=i>=90;return m.jsxs("div",{className:"sd-row",children:[m.jsxs("div",{className:"sd-row-head",children:[m.jsx("span",{className:"sd-row-label",children:e}),m.jsxs("span",{className:"sd-row-val",children:[m.jsx("b",{children:Na(t)})," of ",Na(r)]})]}),m.jsx("span",{className:"sd-track",children:m.jsx("span",{className:`sd-fill${a?" warn":""}`,style:{transform:`scaleX(${Math.max(1,Math.min(100,i))/100})`}})}),o&&m.jsx("div",{className:"sd-note",children:o})]})}const C1=18,J$=1100,Ji=(e,t)=>{const r=Math.sin(e*12.9898+t*78.233)*43758.5453;return r-Math.floor(r)},e3=Array.from({length:C1},(e,t)=>{const r=-72+144*t/(C1-1)+(Ji(t,1)-.5)*9,i=(r-90)*(Math.PI/180),o=(54+32*Math.cos(r*Math.PI/180))*(.74+Ji(t,2)*.52);return{dx:Math.cos(i)*o,dy:Math.sin(i)*o,rot:(t%2?1:-1)*(100+Ji(t,3)*260),delay:Math.round(Ji(t,4)*90),dur:760+Math.round(Ji(t,5)*260),scale:.8+Ji(t,6)*.45,hue:t%4,round:t%3===0}});function j1({anchor:e,lifetimeMs:t=J$}){var a;const[r,i]=R.useState(null),o=typeof window<"u"&&((a=window.matchMedia)==null?void 0:a.call(window,"(prefers-reduced-motion: reduce)").matches);return R.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 f=window.setTimeout(()=>i(null),t);return()=>window.clearTimeout(f)},[e,t,o]),o||!r?null:xM.createPortal(m.jsx("div",{className:"confetti",style:{left:`${r.x}px`,top:`${r.y}px`},"aria-hidden":!0,children:e3.map((u,c)=>m.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 aj=new Set(["awaiting_url","awaiting_code","registering"]);function t3(e){return e!=null&&aj.has(e)}function lj(e){return e!=null&&e!=="done"&&!aj.has(e)}const n3="the sign-in ended before it finished — the deck restarted, or it was cancelled in another tab",r3="the sign-in did not complete";function s3({state:e,serverError:t,localError:r}){const i=e==="idle";return{title:i?"Sign-in ended":"Sign-in failed",message:r||t||(i?n3:r3)}}const i3="done";function o3(){let e=!1;return{shouldAnnounce(t){return t!==i3?(e=!1,!1):e?!1:(e=!0,!0)}}}function wy(e,t){return t&&Object.hasOwn(e,t)?e[t]:void 0}const a3={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 ${Vt}`,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"},l3={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"},u3=`claude-swap could not read the login keychain — start ${Vt} from a Terminal window rather than a background service`;function zv(e,t){if((e==null?void 0:e.reason)!=="no_cswap"&&/keychain/i.test(fo(e)))return u3;const r=wy(l3,e==null?void 0:e.reason);return r||(e==null?void 0:e.reason)||t}function fo(e){return((e==null?void 0:e.output)||(e==null?void 0:e.detail)||(e==null?void 0:e.error)||"").trim()}const c3={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 so it is on this deck's PATH",bad_override:"AGENTS_DECK_CCUSAGE names a file that is not there — correct it to the full path of your ccusage, or unset it to let the deck find its own",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"},d3="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 f3(e){return/\bnpx\b/i.test(e)&&/(command not found|not found|not recognized|ENOENT)/i.test(e)}const h3="ccusage could not be started — the deck launched npx and Node could not load the npm script it points at. An older deck asked cmd.exe for a bare npx.cmd, which made the shim look for that script under the deck's working directory instead of beside itself; update the deck and reopen this modal",p3="ccusage could not be started — the copy npx fetched will not load: Node could not resolve a file inside it. That copy is in npx's own cache, which the deck never rewrites, so clear it with `npm cache clean --force` and reopen this modal",m3=e=>/\b(?:ERR_)?MODULE_NOT_FOUND\b|cannot find (?:module|package)/i.test(e),g3=/node_modules[\\/]npm[\\/]bin[\\/]|\bnpm-prefix\.js\b|\bnp[mx][-.][\w.-]*cli\.js\b/i,v3=/[\\/]_npx[\\/]/i,y3=`the copy of ccusage ${Vt} installed for itself`;function w3(e){const t=String((e==null?void 0:e.install)??"").replace(/\s+/g," ").trim();return t.length>240?`${t.slice(0,239)}…`:t}function x3(e,t){const r=_3(e,t),i=w3(e);switch(e==null?void 0:e.stage){case"npx":return i?`ccusage failed on both of its paths. The managed install failed first — ${i} — and the deck then fell back to npx, where ${ca(r)}`:`there is no managed copy of ccusage on this machine, and the npx fallback failed: ${ca(r)}`;case"managed":return`${y3} failed to run: ${ca(r)}`;case"path":return e.bin?`the ccusage this deck found at ${e.bin} failed to run: ${ca(r)}`:`the ccusage this deck found on your PATH failed to run: ${ca(r)}`;default:return r}}const ca=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e;function _3(e,t){const r=fo(e);if(m3(r)){if(v3.test(r))return p3;if(g3.test(r))return h3}if(f3(r))return d3;const i=wy(c3,e==null?void 0:e.reason);return i||(e==null?void 0:e.reason)||t}function wu(e,t){if(e!=null&&e.detail)return e.detail;if(e!=null&&e.error&&lj(e.state))return e.error;const r=wy(a3,e==null?void 0:e.reason);return r||(e!=null&&e.error?e.error:(e==null?void 0:e.reason)||t)}const b3=1500;async function lu(e){return(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json().catch(()=>null)}const Bv=ue.forwardRef((e,t)=>m.jsxs("svg",{className:"aa-mark",viewBox:"0 0 44 44","aria-hidden":!0,ref:t,children:[m.jsx("circle",{className:"aa-mark-ring",cx:"22",cy:"22",r:"20"}),m.jsx("path",{className:"aa-mark-tick",d:"M13.5 22.5 L19.5 28.5 L31 17"})]}));Bv.displayName="SuccessMark";function S3({onClose:e,onChanged:t}){const[r,i]=R.useState("login"),[o,a]=R.useState(null),[u,c]=R.useState(""),[f,p]=R.useState(""),[d,g]=R.useState(!1),[y,w]=R.useState(null),[k,_]=R.useState(null),b=R.useRef(!1),S=R.useRef(null),E=R.useRef(null),N=R.useRef(null),j=R.useRef(null),A=R.useCallback(()=>{b.current&&lu({action:"login-cancel"}).catch(()=>{}),e()},[e]),I=ri(A,{focusRef:N}),L=R.useCallback(async()=>{g(!0),w(null),b.current=!0;const z=await lu({action:"login"}).catch(()=>null);if(g(!1),!(z!=null&&z.ok)){w(wu(z,"could not start the sign-in"));return}a(z)},[]);R.useEffect(()=>{if(!t3(o==null?void 0:o.state))return;const z=window.setInterval(async()=>{try{const F=await fetch("/api/claude-accounts/login");F.ok&&a(await F.json())}catch{}},b3);return()=>window.clearInterval(z)},[o]);const P=R.useRef(t);P.current=t;const D=R.useRef(o3());R.useEffect(()=>{var z;(o==null?void 0:o.state)==="awaiting_code"&&((z=S.current)==null||z.focus()),D.current.shouldAnnounce(o==null?void 0:o.state)&&P.current()},[o==null?void 0:o.state]),R.useEffect(()=>{var z;r==="paste"&&((z=E.current)==null||z.focus())},[r]);const M=R.useCallback(async()=>{var F;g(!0),w(null);const z=await lu({action:"login-code",code:u}).catch(()=>null);if(g(!1),!(z!=null&&z.ok)){w(wu(z,"the code was not accepted")),z!=null&&z.state&&a(z),(F=S.current)==null||F.select();return}c(""),a(z)},[u,o]),q=R.useCallback(async()=>{g(!0),w(null);const z=await lu({action:"import",blob:f}).catch(()=>null);if(g(!1),!(z!=null&&z.ok)){w(wu(z,"the import failed"));return}p(""),_({added:z.added===!0,num:z.num??null,email:z.email??null}),t()},[f,t]),W=(o==null?void 0:o.state)==="done"?o.account:null,K=lj(o==null?void 0:o.state)||!!(y&&b.current&&!d),C=s3({state:o==null?void 0:o.state,serverError:o==null?void 0:o.error,localError:y});return m.jsx("div",{className:"modal-backdrop",onClick:A,role:"presentation",children:m.jsxs("div",{ref:I,className:"modal aa-modal",onClick:z=>z.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Add a Claude account",children:[m.jsxs("header",{className:"modal-head",children:[m.jsx("div",{className:"modal-title",children:m.jsxs("span",{className:"aa-tabs",role:"tablist",children:[m.jsx("button",{type:"button",role:"tab","aria-selected":r==="login",className:`aa-tab${r==="login"?" on":""}`,onClick:()=>i("login"),children:"Sign in"}),m.jsx("button",{type:"button",role:"tab","aria-selected":r==="paste",className:`aa-tab${r==="paste"?" on":""}`,onClick:()=>i("paste"),children:"Paste a share"})]})}),m.jsx("div",{className:"modal-actions",children:m.jsx("button",{type:"button",className:"glyph-btn",onClick:A,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),m.jsx("section",{className:"modal-body aa-body",children:r==="login"?W?m.jsxs("div",{className:"aa-done",children:[m.jsx(Bv,{ref:j}),m.jsx(j1,{anchor:j}),m.jsx("h4",{children:W.added?`Account ${W.num} added`:"Credentials refreshed"}),m.jsxs("p",{className:"aa-note",children:[m.jsx("strong",{children:W.email}),W.added?" is in the rotation. The account you were using is still active.":" was already managed, so its stored credentials were replaced."]}),m.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"?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"aa-step",children:[m.jsx("h4",{children:"1 · Approve in the browser"}),m.jsx("p",{className:"aa-note",children:"A tab should have opened. If not, use this link:"}),m.jsx("a",{className:"aa-link",href:o.url??"#",target:"_blank",rel:"noreferrer noopener",children:o.url})]}),m.jsxs("div",{className:"aa-step",children:[m.jsx("h4",{children:"2 · Paste the code it gives you"}),m.jsxs("div",{className:"aa-field",children:[m.jsx("input",{ref:S,type:"text",value:u,onChange:z=>c(z.target.value),onKeyDown:z=>{z.key==="Enter"&&u.trim()&&!d&&M()},placeholder:"paste the code here",spellCheck:!1,autoComplete:"off","aria-label":"Sign-in code",disabled:o.state==="registering"}),m.jsx("button",{type:"button",className:"btn primary",disabled:d||!u.trim()||o.state==="registering",onClick:M,children:o.state==="registering"?"registering…":"Continue"})]}),(y||o.error)&&m.jsx("p",{className:"aa-err",children:y??o.error}),m.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."})]})]}):K?m.jsxs("div",{className:"aa-step",children:[m.jsx("h4",{children:C.title}),m.jsx("p",{className:"aa-err",children:C.message}),m.jsx("button",{type:"button",className:"btn",onClick:()=>{b.current=!1,a(null),w(null),L()},children:"Try again"})]}):d||b.current?m.jsx("div",{className:"aa-step",children:m.jsx("p",{className:"aa-note",children:"Asking the claude CLI for a sign-in link…"})}):m.jsxs("div",{className:"aa-step aa-primer",children:[m.jsx("h4",{children:"Sign in to Anthropic"}),m.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."}),m.jsx("div",{className:"aa-actions",children:m.jsx("button",{type:"button",ref:N,className:"btn primary",onClick:L,disabled:d,children:"Open the sign-in page"})})]}):k?m.jsxs("div",{className:"aa-done",children:[m.jsx(Bv,{ref:j}),k.added&&m.jsx(j1,{anchor:j}),m.jsx("h4",{children:k.added?`Account ${k.num} imported`:"Already here"}),m.jsx("p",{className:"aa-note",children:k.added?m.jsxs(m.Fragment,{children:[k.email?m.jsx("strong",{children:k.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."}),m.jsxs("div",{className:"aa-actions",children:[m.jsx("button",{type:"button",className:"btn primary",onClick:e,children:"Done"}),m.jsx("button",{type:"button",className:"btn",onClick:()=>_(null),children:"Import another"})]})]}):m.jsxs("div",{className:"aa-step",children:[m.jsx("h4",{children:"Paste an account shared from another deck"}),m.jsxs("div",{className:"aa-field",children:[m.jsx("input",{ref:E,type:"text",value:f,onChange:z=>p(z.target.value),onKeyDown:z=>{z.key==="Enter"&&f.trim()&&!d&&q()},placeholder:"ccdeck1:…",spellCheck:!1,autoComplete:"off","aria-label":"Shared account"}),m.jsx("button",{type:"button",className:"btn primary",disabled:d||!f.trim(),onClick:q,children:d?"importing…":"Import"})]}),y&&m.jsx("p",{className:"aa-err",children:y}),m.jsxs("p",{className:"aa-note",children:["Use ",m.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 k3(e,t){const r=new Set(e),i=e.length?Math.max(...e):0;return[...new Set([...e,i+1])].sort((o,a)=>o-a).map(o=>{const a=o===t?"here":r.has(o)?"swap":"free";return{slot:o,kind:a,label:a==="here"?`slot ${o}`:`slot ${o} · ${a}`}})}function E3(e,t,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!==t;return{menuFor:e.menuFor===t?i:o&&e.menuFor===i?t:e.menuFor,confirmRemove:null,shareFor:null,swapNote:o?{at:i,displaced:t}:null}}function N3(e,t,r){return t!=null&&e.some(i=>i.slot===t)?t:r}function C3(e,t,r){var o;const i=((o=e.find(a=>a.slot===t))==null?void 0:o.kind)??"here";return i==="swap"?{label:"swap",done:"swapped",sends:!0,swaps:!0,title:`Send this account to slot ${t}. That slot is taken, so the two accounts trade places and the one standing there moves to slot ${r}.`}:i==="free"?{label:"move",done:"moved",sends:!0,swaps:!1,title:`Send this account to slot ${t}. That slot is empty, so no other account moves.`}:{label:"move",done:"here",sends:!1,swaps:!1,title:`This account already holds slot ${r}.`}}function j3(e,t){return{label:"save",done:"saved",sends:e!==t,swaps:!1,title:`Switch the active account out once it passes ${e}% of its limit.`}}function T1(e){return typeof e.id=="string"&&e.id.startsWith("scoped-")}function R1(e){const t=e.filter(c=>!T1(c)),r=e.filter(c=>T1(c)),i=t.length?t:r,o=t.length?r:[],a=i.reduce((c,f)=>c&&c.pct>=f.pct?c:f,null);let u=null;for(const c of o)a&&c.pct<=a.pct||(!u||c.pct>u.pct)&&(u=c);return{shown:i,rest:o,fuller:u,peak:u??a}}function T3(e,t,r){return e<1?null:t?"fewer":r?`${r.label} ${Math.round(r.pct)}%`:`${e} more`}function R3(e,t,r,i){const o=e==null?"No usage has been collected for this account yet.":`${Math.round(e)}% left on ${t??"the window that runs out first"}, which is the one that runs out first.`,a=r===1?"the other window":`the other ${r} windows`;return`${o} ${i?"Hide":"Show"} ${a}.`}function A3(e,t){return{disabled:e!=null&&e!==t,busy:e===t}}function I3(e){return e==null}function M3(e){return[...e==null?[]:[`#ap-more-${e}`],".accounts-panel .ap-refresh"]}function O3(e){return e==null||e==="BODY"||e==="HTML"}const P3=64;function L3(e,t){const r=e.trim();return{alias:r,commit:r!==(t??"").trim()}}const $3=Object.freeze({text:"couldn't reach the deck server",reload:!0});async function A1(e){return e.ok?{ok:!0,status:e.status,body:null}:{ok:!1,status:e.status,body:await e.json().catch(()=>null)}}function q3(e){const t=e.find(i=>!i.ok);if(!t)return null;const r=fo(t.body);return{text:zv(t.body,`the deck server answered ${t.status}`),...r?{raw:r}:{},reload:!0}}function I1(e,t){return t?e!=null&&e.reload&&e.text===t.text&&e.raw===t.raw?e:t:e!=null&&e.reload?null:e}const M1=15e3,D3=8e3,Zd=1800,F3=3e4,z3=[70,80,85,90,95];function O1(e,t){return rj(t-Math.floor(e/1e3))}function B3(e,t){if(!e)return"";const r=Math.floor(e/1e3)-t;return r<=0?" · due":r<60?` · next in ${r}s`:` · next in ${Math.round(r/60)}m`}function U3(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 P1({lane:e,nowSec:t}){const r=Math.min(100,Math.max(0,e.pct)),i=r>=90?"var(--err)":r>=70?"var(--warn)":"var(--accent)",o=e.resetAt?sj(e.resetAt,t):null;return m.jsxs("div",{className:"ap-lane",children:[m.jsx("span",{className:"ap-lane-label",children:e.label}),m.jsx("div",{className:"ap-lane-track",children:m.jsx("div",{className:"ap-lane-fill",style:{width:`${r===0?1.5:r}%`,background:i,opacity:r===0?.4:1}})}),m.jsxs("span",{className:"ap-lane-pct",style:{color:i},children:[r,"%"]}),m.jsx("span",{className:"ap-lane-reset",children:o?`resets ${o}`:""})]})}async function H3(e){var r;let t=!1;try{t=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{t=!1}if(t)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(),t=document.execCommand("copy"),i.remove()}catch{t=!1}return t}function W3(e,t){const r=Math.round(e/1e3)-t;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 V3({onClose:e}){var We,Ye,pt,_t;const[t,r]=R.useState(null),[i,o]=R.useState(null),[a,u]=R.useState(null),[c,f]=R.useState(!1),[p,d]=R.useState(null),[g,y]=R.useState(()=>Math.floor(Date.now()/1e3)),w=R.useRef(null),[k,_]=R.useState(null),[b,S]=R.useState(!1),[E,N]=R.useState(""),[j,A]=R.useState(null),[I,L]=R.useState(null),[P,D]=R.useState(null),[M,q]=R.useState(!1),[W,K]=R.useState(null),[C,z]=R.useState(null),[F,te]=R.useState(null),[Z,U]=R.useState(null),[Q,O]=R.useState(!1),[V,ce]=R.useState([]),$=R.useRef(null),G=R.useCallback(se=>I3($.current)?($.current=se,u(se),!0):!1,[]),ee=R.useCallback(()=>{$.current=null,u(null)},[]),ie=(se,$e=!1)=>{const De=A3(a,se);return{disabled:De.disabled,"aria-busy":De.busy||$e}},de=R.useCallback(se=>{window.requestAnimationFrame(()=>{var $e;if(O3((($e=document.activeElement)==null?void 0:$e.tagName)??null))for(const De of M3(se)){const Te=document.querySelector(De);if(Te){Te.focus();return}}})},[]),pe=R.useCallback(async(se=!1)=>{se&&f(!0);const $e=new AbortController,De=window.setTimeout(()=>$e.abort(),F3);try{const[Te,Fe]=await Promise.all([fetch(`/api/claude-accounts${se?"?refresh=1":""}`,{signal:$e.signal}),fetch("/api/cswap-auto",{signal:$e.signal})]);Te.ok&&r(await Te.json()),Fe.ok&&o(await Fe.json());const Ze=q3([await A1(Te),await A1(Fe)]);d(lt=>I1(lt,Ze))}catch{d(Te=>I1(Te,$3))}finally{window.clearTimeout(De),se&&f(!1)}},[]),ne=R.useCallback(async(se,$e)=>{if(!G($e))return null;d(null);try{const Te=await(await fetch("/api/cswap-auto",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(se)})).json().catch(()=>null);return Te!=null&&Te.ok||d({text:zv(Te,"command failed"),raw:fo(Te)}),Te}catch{return d({text:"server unreachable"}),null}finally{ee()}},[G,ee]),Pe=R.useCallback(async(se,$e)=>{if(!G($e))return null;d(null);try{const Te=await(await fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(se)})).json().catch(()=>null);return Te!=null&&Te.ok||d({text:wu(Te,"command failed")}),Te}catch{return d({text:"server unreachable"}),null}finally{ee()}},[G,ee]);R.useEffect(()=>(pe(!0),w.current=window.setInterval(()=>pe(!1),M1),()=>{w.current!=null&&window.clearInterval(w.current)}),[pe]),R.useEffect(()=>{const se=window.setInterval(()=>y(Math.floor(Date.now()/1e3)),3e4);return()=>window.clearInterval(se)},[]);const He=((We=i==null?void 0:i.settings["autoswitch.threshold"])==null?void 0:We.value)??"90",ze=Z??He,Oe=j3(ze,He),_e=(Ye=t==null?void 0:t.accounts)==null?void 0:Ye.find(se=>se.active),Qe=((pt=R1((_e==null?void 0:_e.lanes)??[]).peak)==null?void 0:pt.pct)??null,ye=Qe!=null&&Qe>=Number(He)-15,we=async se=>{if(G(`switch-${se}`)){d(null);try{const De=await(await fetch("/api/claude-accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:se})})).json().catch(()=>null);De!=null&&De.ok||d({text:zv(De,"the switch failed"),raw:fo(De)}),await pe(!0)}catch{d({text:"server unreachable"})}finally{ee(),de(se)}}},qe=async(se,$e)=>{const{commit:De,alias:Te}=L3(E,$e);if(De){const Fe=await Pe({action:"alias",account:se,alias:Te},`alias-${se}`);if(await pe(!0),!(Fe!=null&&Fe.ok))return;N(Te)}A(se),window.setTimeout(()=>A(Fe=>Fe===se?null:Fe),Zd)},dt=async(se,$e)=>{const De=await Pe({action:"move",account:se,slot:$e},`move-${se}`),Te=E3({menuFor:k,shareFor:(P==null?void 0:P.num)??null},se,De);if(await pe(!0),Te){_(Te.menuFor),L(Te.confirmRemove),Te.shareFor==null&&(D(null),q(!1)),K(Te.swapNote);const Fe=Te.swapNote;Fe&&window.setTimeout(()=>K(Ze=>Ze===Fe?null:Ze),D3),z(null),de(Te.menuFor)}return De},Ae=async(se,$e,De)=>{if(De.sends){const Te=await dt(se,$e);if(!(Te!=null&&Te.ok))return}te(se),window.setTimeout(()=>te(Te=>Te===se?null:Te),Zd)},ot=async(se,$e)=>{if($e.sends){const De=await ne({action:"setting",key:"autoswitch.threshold",value:se},"threshold");if(await pe(!0),!(De!=null&&De.ok))return;U(null)}O(!0),window.setTimeout(()=>O(!1),Zd)};return m.jsxs("aside",{className:"accounts-panel",id:"accounts-panel","aria-label":"Claude accounts",children:[m.jsxs("div",{className:"ap-header",children:[m.jsx("h2",{children:"Accounts"}),m.jsxs("div",{className:"ap-header-right",children:[m.jsx("button",{type:"button",className:"glyph-btn ap-add",onClick:()=>S(!0),"aria-label":"Add an account",title:"Sign in to another Claude account, or paste one shared from another deck",children:"+"}),m.jsx("button",{type:"button",className:"glyph-btn ap-refresh",onClick:()=>pe(!0),...ie("reload",c),"aria-label":"Reload accounts",title:"Reload from claude-swap",children:c?"…":"↻"}),m.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close accounts panel",title:"Close (A)",children:"×"})]})]}),t==null?p?m.jsxs("div",{className:"ap-empty",role:"alert",children:[m.jsx("span",{title:p.raw||void 0,children:p.text}),m.jsxs("span",{className:"ap-hint",children:["No accounts have arrived, so there is nothing to show yet. The panel keeps trying every ",M1/1e3," seconds."]}),m.jsx("button",{type:"button",className:"ap-fix",disabled:c,onClick:()=>pe(!0),children:c?"trying…":"try again"})]}):m.jsx("div",{className:"ap-empty",children:"Checking…"}):t.ok?m.jsxs(m.Fragment,{children:[(_t=t.accounts)==null?void 0:_t.map(se=>{const{shown:$e,rest:De,fuller:Te,peak:Fe}=R1(se.lanes),Ze=V.includes(se.num),lt=T3(De.length,Ze,Te);return m.jsxs("div",{className:`ap-account${se.active?" active":""}`,children:[m.jsxs("div",{className:"ap-account-head",children:[m.jsx("span",{className:"ap-num",children:se.num}),se.alias&&m.jsx("span",{className:"ap-alias",title:se.alias,children:se.alias}),m.jsx("span",{className:"ap-email",title:se.email??void 0,children:se.email}),m.jsx("button",{type:"button",id:`ap-more-${se.num}`,className:`ap-more${k===se.num?" on":""}`,"aria-label":`Manage account ${se.num}`,"aria-expanded":k===se.num,"aria-controls":k===se.num?`ap-manage-${se.num}`:void 0,title:"Share, rename, move, remove",onClick:()=>{_(k===se.num?null:se.num),N(se.alias??""),L(null),D(null),q(!1),K(null),A(null),z(null),te(null)},children:"⋯"}),se.active&&m.jsx("span",{className:"ap-badge-active",children:"active"}),se.disabled&&m.jsx("span",{className:"ap-badge-held",children:"held out"}),!se.active&&!se.disabled&&m.jsx("button",{type:"button",className:"ap-manage-btn ap-switch",...ie(`switch-${se.num}`),onClick:()=>we(se.num),title:`Switch to ${se.alias??se.email}`,children:a===`switch-${se.num}`?"…":"switch"})]}),m.jsx("div",{className:"ap-lanes",id:`ap-lanes-${se.num}`,children:$e.length?m.jsxs(m.Fragment,{children:[$e.map(ke=>m.jsx(P1,{lane:ke,nowSec:g},ke.id)),Ze&&De.map(ke=>m.jsx(P1,{lane:ke,nowSec:g},ke.id))]}):m.jsx("div",{className:"ap-hint",children:"No usage recorded yet."})}),m.jsxs("div",{className:"ap-meta",children:[se.error&&(()=>{const ke=U3(se.error);return m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"ap-err",title:ke.hint,children:ke.text}),ke.fixable&&m.jsx("button",{type:"button",className:"ap-fix",onClick:()=>S(!0),title:"Open the sign-in dialog. Signing in as this account replaces its stored login in place.",children:"sign in again"})]})})(),lt&&m.jsx("button",{type:"button",className:"ap-lanes-more","aria-expanded":Ze,"aria-controls":`ap-lanes-${se.num}`,title:R3(se.headroom,(Fe==null?void 0:Fe.label)??null,De.length,Ze),onClick:()=>ce(ke=>ke.includes(se.num)?ke.filter(rt=>rt!==se.num):[...ke,se.num]),children:lt}),(((i==null?void 0:i.enabled)||(i==null?void 0:i.external))&&!se.active||se.disabled)&&m.jsx("button",{type:"button",className:"ap-rotate",...ie(`rot-${se.num}`),onClick:()=>ne({action:"account",account:se.num,enabled:se.disabled},`rot-${se.num}`).then(()=>pe(!0)),title:se.disabled?"Return this account to auto-rotation":"Hold this account out of auto-rotation",children:se.disabled?"put back":"hold out"}),se.fetchedAt?m.jsxs("span",{className:`ap-age${se.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 ",O1(se.fetchedAt,g),B3(se.nextAt,g)]}):m.jsx("span",{className:"ap-age ap-stale",title:"claude-swap has not read this account yet",children:"never collected"})]}),k===se.num&&m.jsxs("div",{className:"ap-manage",id:`ap-manage-${se.num}`,role:"group","aria-label":`Manage account ${se.num}`,children:[m.jsxs("div",{className:"ap-manage-name",children:[m.jsx("label",{className:"vis-hidden",htmlFor:`ap-alias-${se.num}`,children:"Alias"}),m.jsx("input",{id:`ap-alias-${se.num}`,className:"ap-manage-input",type:"text",value:E,onChange:ke=>N(ke.target.value),onKeyDown:ke=>{ke.key==="Enter"&&qe(se.num,se.alias)},maxLength:P3,placeholder:"e.g. work",spellCheck:!1,autoFocus:!0}),m.jsx("button",{type:"button",className:"ap-manage-btn",...ie(`alias-${se.num}`),onClick:()=>qe(se.num,se.alias),title:"A short name to show instead of the email",children:j===se.num?"saved":"save"})]}),(()=>{const ke=k3((t.accounts??[]).map(ut=>ut.num),se.num),rt=N3(ke,C,se.num),tt=C3(ke,rt,se.num);return m.jsxs("div",{className:"ap-manage-slot",children:[m.jsx("label",{className:"vis-hidden",htmlFor:`ap-slot-${se.num}`,children:"Slot"}),m.jsx("span",{className:"ap-field",children:m.jsx("select",{id:`ap-slot-${se.num}`,value:String(rt),...ie(`move-${se.num}`),onChange:ut=>z(Number(ut.target.value)),children:ke.map(ut=>m.jsx("option",{value:ut.slot,children:ut.label},ut.slot))})}),m.jsx("button",{type:"button",className:"ap-manage-btn",...ie(`move-${se.num}`),title:tt.title,onClick:()=>Ae(se.num,rt,tt),children:F===se.num?tt.done:tt.label})]})})(),m.jsxs("div",{className:"ap-manage-acts",children:[m.jsx("button",{type:"button",className:"ap-manage-btn",...ie(`share-${se.num}`),title:`Copy this account to another ${Vt}. 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()=>{q(!1);const ke=await Pe({action:"share",account:se.num},`share-${se.num}`);ke!=null&&ke.ok&&D({num:se.num,blob:ke.blob,expiresAt:ke.expiresAt})},children:"share"}),m.jsx("button",{type:"button",className:`ap-manage-btn danger${I===se.num?" armed":""}`,...ie(`rm-${se.num}`),title:I===se.num?"This deletes the stored credentials for this account":"Remove this account from claude-swap",onClick:()=>{if(I!==se.num){L(se.num),window.setTimeout(()=>L(ke=>ke===se.num?null:ke),4e3);return}L(null),Pe({action:"remove",account:se.num},`rm-${se.num}`).then(()=>{_(null),pe(!0),de(null)})},children:I===se.num?"confirm":"remove"})]}),(W==null?void 0:W.at)===se.num&&(()=>{var tt;const ke=(tt=t.accounts)==null?void 0:tt.find(ut=>ut.num===W.displaced),rt=(ke==null?void 0:ke.alias)??(ke==null?void 0:ke.email)??"the account that was there";return m.jsxs("span",{className:"ap-manage-hint ap-manage-swap",title:`Slot ${W.at} was taken, so the two accounts traded places: ${rt} now holds slot ${W.displaced}.`,children:["swapped with slot ",W.displaced]})})(),(P==null?void 0:P.num)===se.num&&(()=>{const ke=W3(P.expiresAt,g),rt=ke.tone==="gone";return m.jsxs("div",{className:`ap-share${rt?" expired":""}`,children:[m.jsx("code",{className:"ap-share-blob",children:P.blob}),m.jsxs("div",{className:"ap-share-foot",children:[m.jsx("button",{type:"button",className:"ap-manage-btn",...ie(`share-${se.num}`),onClick:async()=>{if(rt){q(!1);const tt=await Pe({action:"share",account:se.num},`share-${se.num}`);tt!=null&&tt.ok&&D({num:se.num,blob:tt.blob,expiresAt:tt.expiresAt});return}await H3(P.blob)&&(q(!0),window.setTimeout(()=>q(!1),1800))},children:rt?"make a new share":M?"copied":"copy"}),m.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:[m.jsx("span",{className:"ap-share-warn",children:"this is the password"})," · ",m.jsx("span",{className:`ap-share-expiry ${ke.tone}`,children:ke.text})]})]})]})})()]})]},se.num)}),(i==null?void 0:i.ok)&&m.jsxs("div",{className:"ap-auto",children:[m.jsxs("div",{className:"ap-auto-head",children:[m.jsx("h3",{className:"ap-auto-title",children:"Auto-switch"}),m.jsxs("span",{className:"ap-auto-ctl",children:[Qe!=null&&m.jsxs("span",{className:`ap-auto-now${ye?" near":""}`,children:[Math.round(Qe),"%"]}),m.jsx("span",{className:"ap-field",title:"Switch once the active account passes this much of its limit",children:m.jsx("select",{"aria-label":"Switch threshold",value:ze,...ie("threshold"),onChange:se=>U(se.target.value),children:z3.map(se=>m.jsxs("option",{value:se,children:[se,"%"]},se))})}),m.jsx("button",{type:"button",className:"ap-manage-btn",...ie("threshold"),title:Oe.title,onClick:()=>ot(ze,Oe),children:Q?Oe.done:Oe.label}),m.jsxs("button",{type:"button",className:`ap-auto-state${i.enabled?" live":""}`,role:"switch","aria-checked":i.enabled,...ie("enable"),onClick:()=>ne({action:"enable",enabled:!i.enabled},"enable").then(()=>pe(!0)),title:i.enabled?"Stop switching accounts automatically":"Switch accounts automatically when the active one nears its limit",children:[m.jsx("i",{className:i.enabled?"ap-pulse":"ap-dot","aria-hidden":!0}),i.enabled?"on":"off"]})]})]}),i.external&&m.jsxs("p",{className:"ap-auto-note",children:[m.jsx("i",{className:"ap-pulse","aria-hidden":!0})," A ",m.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&&m.jsx("div",{className:"ap-auto-foot",children:m.jsxs("span",{className:"ap-auto-result",children:["checked ",O1(i.lastTick.at,g)]})})]}),p&&m.jsxs("div",{className:"ap-failure",role:"alert",children:[m.jsx("span",{className:"ap-failure-text",title:p.raw||void 0,children:p.text}),m.jsx("button",{type:"button",className:"ap-failure-x",onClick:()=>d(null),"aria-label":"Dismiss this message",title:"Dismiss",children:"×"})]}),m.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:"These numbers only update while this panel is open."})]}):m.jsx("div",{className:"ap-empty",children:t.reason==="no_cswap"?m.jsxs(m.Fragment,{children:[m.jsx("span",{children:"claude-swap isn't installed."}),m.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."}),t.hint&&m.jsx("code",{className:"ap-cmd",children:t.hint}),m.jsxs("span",{className:"ap-hint",children:["Then add an account with the ",m.jsx("strong",{children:"+"})," button above."]})]}):t.reason==="no_accounts"?m.jsxs(m.Fragment,{children:[m.jsx("span",{children:"No accounts added yet."}),m.jsxs("span",{className:"ap-hint",children:["claude-swap is installed but has nothing in its store. Use the ",m.jsx("strong",{children:"+"})," above to sign one in, or to paste one shared from another deck."]})]}):m.jsxs(m.Fragment,{children:[m.jsx("span",{children:"Couldn't read the account store."}),m.jsxs("span",{className:"ap-hint",children:["claude-swap is installed, but its store could not be read",t.reason?` (${t.reason})`:"","."]})]})}),b&&m.jsx(S3,{onClose:()=>S(!1),onChanged:()=>pe(!0)})]})}const G3=3e4;function Y3({bundle:e,running:t,lastTried:r}){return!t||e===t?!1:r!==t}function K3({bundle:e,running:t,pending:r,lastTried:i}){return t?Y3({bundle:e,running:t,lastTried:i})?"reload":r==null||r&&r!==t?"wait":"confirm":"wait"}function X3(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function Q3({asked:e,reported:t}){return t?t!==e:!1}function Z3(e){const t=e.thresholdMs??G3;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>=t}}function J3({agentCount:e,onConfirm:t,onCancel:r}){const i=R.useRef(null),o=ri(r,{focusRef:i,layer:cL}),a=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 m.jsx("div",{className:"modal-backdrop",onClick:r,role:"presentation",children:m.jsxs("div",{ref:o,className:"modal clear-confirm",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[m.jsxs("header",{className:"modal-head",children:[m.jsxs("div",{className:"modal-title",children:[m.jsx("span",{className:"status-dot err","aria-hidden":!0}),m.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),m.jsx("div",{className:"modal-actions",children:m.jsx("button",{type:"button",className:"glyph-btn",onClick:r,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),m.jsxs("section",{className:"modal-body",children:[m.jsxs("p",{className:"modal-note",children:[a," — the file a restarted deck replays to rebuild what you see. Layout, pins and selection go with it. This cannot be undone."]}),m.jsxs("div",{className:"cc-actions",children:[m.jsx("button",{type:"button",ref:i,className:"btn",onClick:r,children:"Cancel"}),m.jsx("button",{type:"button",className:"btn danger",onClick:t,children:"Clear everything"})]})]})]})})}const eq="One-key shortcuts run when nothing on the page has focus. A focused control keeps its own keys — this sheet included, which takes the keyboard while it is open — so Esc is the way back to the canvas.",tq=[{title:"Canvas",rows:[{cap:"Space",action:"pause or resume the stream",binds:[" "]},{cap:"J",action:"next agent",binds:["j","J"]},{cap:"K",action:"previous agent",binds:["k","K"]},{cap:"F",action:"fit every agent on screen",binds:["f","F"]},{cap:"R",action:"re-arrange the canvas and drop the pins",binds:["r","R"]},{cap:"C",action:"clear the canvas and the event log — asks first",binds:["c","C"]}]},{title:"Panels and dialogs",rows:[{cap:"U",action:"usage panel",binds:["u","U"]},{cap:"L",action:"session list",binds:["l","L"]},{cap:"H",action:"usage history",binds:["h","H"]},{cap:"A",action:"Claude accounts, where Claude Code is installed",binds:["a","A"]},{cap:"?",action:"this sheet",binds:["?"]}]},{title:"Settings",rows:[{cap:"M",action:"finish sound on or off, on Claude Code turns",binds:["m","M"]},{cap:"Shift + M",action:"put your own sound hooks back, when the switch has parked them",binds:["m","M"]},{cap:"T",action:"light or dark theme",binds:["t","T"]}]},{title:"Focus and selection",rows:[{cap:"Tab",action:"reach the agent cards",binds:[]},{cap:"Enter",action:"select the focused card",binds:["Enter"]},{cap:"Shift + Enter",action:"add the focused card to the selection",binds:["Enter"]},{cap:"Esc",action:"close what is open, deselect, release focus",binds:["Escape"]}]},{title:"Mouse",rows:[{cap:"drag",action:"move a node, and pin it where you dropped it",binds:[]},{cap:"shift-click",action:"add an agent to the selection",binds:[]},{cap:"shift-click",action:"on the sound switch: put your own sound hooks back",binds:[]}]}];function nq({onClose:e}){const t=ri(e);return m.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:m.jsxs("div",{ref:t,className:"modal key-help",onClick:r=>r.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[m.jsxs("header",{className:"modal-head",children:[m.jsx("div",{className:"modal-title",children:m.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),m.jsx("div",{className:"modal-actions",children:m.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),m.jsxs("section",{className:"modal-body",children:[m.jsx("p",{className:"modal-note",children:eq}),m.jsx("div",{className:"shortcuts",children:tq.map(r=>m.jsxs(R.Fragment,{children:[m.jsx("h3",{className:"kh-group",children:r.title}),r.rows.map(i=>m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:i.cap}),m.jsx("span",{children:i.action})]},`${r.title}:${i.cap}:${i.action}`))]},r.title))})]})]})})}function rq(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function sq(e){return e.slice().sort((t,r)=>t.y-r.y||t.x-r.x)}function iq(e,t,r){var u;if(e.length===0)return null;const i=sq(e),o=t?i.findIndex(c=>c.id===t):-1,a=o===-1?r===1?0:i.length-1:(o+r+i.length)%i.length;return((u=i[a])==null?void 0:u.id)??null}const oq=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape","Delete","Backspace"]);function aq(e,t){return t==null?{kind:"deck",nodeId:null}:e.key==="Enter"||e.key===" "?{kind:"activate",nodeId:t,additive:e.shiftKey}:oq.has(e.key)?{kind:"node",nodeId:t}:{kind:"deck",nodeId:t}}const lq=new Set(["","BODY","HTML","#DOCUMENT"]);function uq(e){return!e||hy(e)?!1:!lq.has(String(e.tagName??"").toUpperCase())}function uu(e,t){if(t.size!==0)for(const r of Array.from(e.keys()))t.has(r)||e.delete(r)}function cq(e){const t=new Set;for(const r of e)t.add(r.id),t.add(`group:${r.sessionId}`);return t}function uj(e,t,r){return!t.has(e)||r.has(e)}function dq(e,t,r,i){return!t.has(e)&&uj(e,r,i)}function fq(e,t,r){const i={x:0,y:0};return t.set(e,i),r.add(e),i}function hq(e,t,r,i){r.set(e,t),i.delete(e)}const pq=40,mq=120;function gq(e,t){let r=null,i=0,o=Number.NEGATIVE_INFINITY;const a=()=>{r=null,o=t.now(),e()},u=()=>{r!=null&&(t.clearTimeout(r),r=null)},c=(f,p,d)=>{if(r!=null){if(i<=f)return;u()}const g=Math.min(d,Math.max(0,f-p));i=f,r=t.setTimeout(a,g)};return{live(f=pq){const p=t.now(),d=Math.max(o+f,p);if(d<=p){u(),a();return}c(d,p,f)},replay(f=mq){u(),i=t.now()+f,r=t.setTimeout(a,f)},flush(){u(),a()},cancel(){u()}}}function vq(){let e=!1,t=[];return{get paused(){return e},get size(){return t.length},accept(r){return e?(t.push(r),!1):!0},setPaused(r){if(e=r,r||t.length===0)return[];const i=t;return t=[],i}}}const cj="agent-dag.theme";function yq(e){return e==="light"?"light":"dark"}function wq(){return yq(yy(cj))}function xq({waiting:e,running:t}){return{title:e>0?`(${e}) ${Vt}`:Vt,icon:e>0?"waiting":t>0?"running":"idle"}}const Jd={waiting:"#c97d12",running:"#2a90d4",idle:"#7e828c"};function ef(e,t){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">${t==="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"/>`+(t==="running"?`<circle cx="16" cy="16" r="5" fill="${e}"/>`:"")}</svg>`}const _q=Object.freeze({waiting:`data:image/svg+xml,${encodeURIComponent(ef(Jd.waiting,"waiting"))}`,running:`data:image/svg+xml,${encodeURIComponent(ef(Jd.running,"running"))}`,idle:`data:image/svg+xml,${encodeURIComponent(ef(Jd.idle,"idle"))}`}),bq="No sessions are waiting for you.";function Sq(e){if(e.length===0)return"";const[t,...r]=e;if(r.length===0)return`${t.label} is waiting for your permission.`;const i=`${r.length} more session${r.length===1?"":"s"}`;return`${t.label} and ${i} are waiting for your permission.`}function kq(e,t){return t!==""?t:e===""?"":bq}function Eq(){let e=0;return{begin(){const t=++e;return()=>t===e},cancel(){e++}}}function Nq(e,t=new Date){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-(e-1))).toISOString().slice(0,10).replace(/-/g,"")}function Cq(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 jq(e){return e.claude&&e.codex?"Claude Code and Codex":e.claude?"Claude Code":e.codex?"Codex":null}const L1={claude:"Claude Code",codex:"Codex",opencode:"OpenCode",openclaw:"OpenClaw",copilot:"GitHub Copilot",pi:"pi-agent"};function xy(e){const t=e.toLowerCase();return Object.hasOwn(L1,t)?L1[t]:t?t[0].toUpperCase()+t.slice(1):""}function Tq(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function Rq(e,t=[]){const r=t.length?Tq(t.map(xy)):jq(e);return r?`via ccusage · local ${r} logs`:"via ccusage · local agent logs"}function Aq(e){const t=e.claude?{provider:"claude",watching:!0,spans:[{text:"Claude Code sends its events through a hook in "},{text:"~/.claude/settings.json",code:!0},{text:" — or in "},{text:"$CLAUDE_CONFIG_DIR/settings.json",code:!0},{text:" when you have that set — which the deck installs on first run."}]}:{provider:"claude",watching:!1,spans:[{text:"Claude Code capture is off: no Claude Code was found on this machine, or the deck was started with "},{text:"--no-claude",code:!0},{text:"."}]},r=e.codex?{provider:"codex",watching:!0,spans:[{text:"Codex installs nothing and needs no trust prompt — the deck reads "},{text:"~/.codex/sessions/",code:!0},{text:" itself, so an empty canvas means no rollout has been written there yet, or that "},{text:"$CODEX_HOME",code:!0},{text:" points at a different tree."}]}:{provider:"codex",watching:!1,spans:[{text:"Codex capture is off: no "},{text:"~/.codex/",code:!0},{text:" was found — set "},{text:"$CODEX_HOME",code:!0},{text:" if yours lives elsewhere — or the deck was started with "},{text:"--no-codex",code:!0},{text:"."}]};return[t,r]}function Iq(e,t){const r=t.on?"Sound on turn finish: on — click to remove the hook (M)":"Sound on turn finish: off — click to add a Stop hook (M)",i=e.codex?`
|
|
70
|
+
|
|
71
|
+
Claude Code turns only. The sound is a Stop hook Claude Code runs itself when a turn ends; the deck installs nothing for Codex and reads its rollout files after the fact, so Codex turns finish in silence.`:"",o=t.clash>0?`
|
|
72
|
+
|
|
73
|
+
${t.clash} sound hook${t.clash>1?"s":""} of your own in settings.json also run${t.clash>1?"":"s"} here.`:"",a=t.parked>0?`
|
|
74
|
+
|
|
75
|
+
${t.parked} of your own sound hook${t.parked>1?"s were":" was"} set aside so this switch actually controls the sound. Nothing was deleted — shift-click to put ${t.parked>1?"them":"it"} back (Shift+M does the same).`:"";return r+i+o+a}function dj(e){const t=new Map;for(const r of e)for(const i of r.agents??[]){if(!i||typeof i.agent!="string"||i.agent==="")continue;const o=t.get(i.agent)??{id:i.agent,cost:0,tokens:0};o.cost+=Number.isFinite(i.totalCost)?i.totalCost:0,o.tokens+=Number.isFinite(i.totalTokens)?i.totalTokens:0,t.set(i.agent,o)}return[...t.values()].sort((r,i)=>i.cost-r.cost||r.id.localeCompare(i.id))}function Mq(e){const t=dj([{agents:e}]);return t.length<2?null:t.map(r=>`${xy(r.id)} ${Xe(r.cost)}`).join(" · ")}function $1(e){switch(e.toLowerCase()){case"claude":return"#c4b5fd";case"codex":return"#fdba74";case"gemini":return"#a5b4fc";case"copilot":return"#86efac";default:return"#94a3b8"}}function Oq(e,t){if(!(t>0)||!(e>0))return"0%";const r=e/t*100;return r<.1?"<0.1%":`${r.toFixed(1)}%`}function cu(e){const t=e.toLowerCase();return t.includes("opus")?"#c4b5fd":t.includes("sonnet")?"#7dd3fc":t.includes("haiku")?"#86efac":t.includes("gpt-5")||t.includes("gpt5")?"#fcd34d":t.includes("gpt")?"#fca5a5":t.includes("gemini")?"#a5b4fc":t.includes("codex")?"#fdba74":"#94a3b8"}const Pq=[7,14,30,90];function Lq(e){const[t,r]=R.useState(null),[i,o]=R.useState(!1),a=R.useRef(Eq()).current,u=(c=!1)=>{const f=a.begin(),p=e;o(!0);const g=`/api/ccusage?since=${Nq(p)}${c?"&refresh=1":""}`;fetch(g).then(y=>y.json()).then(y=>{f()&&r({range:p,resp:y})}).catch(()=>{f()&&r({range:p,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{f()&&o(!1)})};return R.useEffect(()=>(u(!1),()=>a.cancel()),[e]),{landed:t,loading:i,reload:()=>u(!0)}}function $q({onClose:e,providers:t}){var L;const[r,i]=R.useState(30),[o,a]=R.useState(null),{landed:u,loading:c,reload:f}=Lq(r),p=R.useRef(null),d=ri(e,{focusRef:p}),g=Cq({loading:c,want:r,answer:u&&{range:u.range,ok:u.resp.ok===!0,days:((L=u.resp.days)==null?void 0:L.length)??0}}),y=g.phase==="chart"?u.resp.days??[]:[],w=R.useMemo(()=>y.reduce((P,D)=>Math.max(P,D.totalCost),0),[y]),{totalCost:k,totalTok:_,inOut:b,cacheRead:S,modelCosts:E}=R.useMemo(()=>{let P=0,D=0,M=0,q=0;const W=new Map;for(const K of y){P+=K.totalCost,D+=K.totalTokens,M+=K.inputTokens+K.outputTokens,q+=K.cacheReadTokens;for(const C of K.modelBreakdowns)W.set(C.modelName,(W.get(C.modelName)??0)+C.cost)}return{totalCost:P,totalTok:D,inOut:M,cacheRead:q,modelCosts:W}},[y]),N=R.useMemo(()=>Array.from(E.entries()).sort((P,D)=>D[1]-P[1]),[E]),j=R.useMemo(()=>dj(y),[y]),A=j.length>1,I=o?y.find(P=>P.period===o)??null:null;return m.jsx("div",{className:"uh-backdrop",onClick:e,role:"presentation",children:m.jsxs("div",{ref:d,className:"uh-modal",onClick:P=>P.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Usage history",children:[m.jsxs("header",{className:"uh-head",children:[m.jsxs("div",{className:"uh-titlewrap",children:[m.jsx("div",{className:"uh-title",children:"Usage history"}),m.jsx("div",{className:"uh-sub",children:Rq(t,j.map(P=>P.id))})]}),m.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:Pq.map(P=>m.jsxs("button",{type:"button","aria-pressed":r===P,className:`uh-range-btn${r===P?" on":""}`,onClick:()=>{i(P),a(null)},children:[P,"d"]},P))}),m.jsx("button",{className:"glyph-btn uh-reload",onClick:f,disabled:c,title:"Re-run ccusage","aria-label":"Reload",children:c?"…":"↻"}),m.jsx("button",{ref:p,className:"glyph-btn uh-close",onClick:e,"aria-label":"Close",children:"×"})]}),g.phase==="busy"?m.jsx("div",{className:"uh-status","aria-busy":"true",children:u?"running ccusage…":"running ccusage… (first run downloads the package)"}):g.phase==="error"?m.jsxs("div",{className:"uh-status uh-err",title:fo(u.resp)||void 0,children:[x3(u.resp,"ccusage did not report usage"),m.jsx("div",{children:m.jsx("button",{className:"btn uh-retry",onClick:f,disabled:c,children:c?"trying…":"Try again"})})]}):g.phase==="empty"?m.jsx("div",{className:`uh-status${g.stale?" uh-stale":""}`,"aria-busy":g.stale||void 0,children:"no usage in this range"}):m.jsxs("div",{className:g.stale?"uh-stale":void 0,"aria-busy":g.stale||void 0,children:[m.jsxs("div",{className:"uh-totals",children:[m.jsx(du,{label:"total cost",val:Xe(k),accent:!0}),m.jsx(du,{label:"tokens",val:At(_)}),m.jsx(du,{label:"input+output",val:At(b)}),m.jsx(du,{label:"cache reads",val:At(S)})]}),A&&m.jsxs("div",{className:"uh-agents",role:"group","aria-label":"Cost by CLI",children:[m.jsx("div",{className:"uh-agent-bar","aria-hidden":"true",children:j.map(P=>m.jsx("span",{className:"uh-agent-seg",style:{width:`${k>0?P.cost/k*100:0}%`,background:$1(P.id)}},P.id))}),m.jsx("div",{className:"uh-agent-keys",children:j.map(P=>m.jsxs("span",{className:"uh-agent-key",title:`${P.id} · ${At(P.tokens)} tokens`,children:[m.jsx("span",{className:"uh-legend-dot",style:{background:$1(P.id)}}),xy(P.id),m.jsx("span",{className:"uh-agent-cost",children:Xe(P.cost)}),m.jsx("span",{className:"uh-agent-share",children:Oq(P.cost,k)})]},P.id))})]}),m.jsx("div",{className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:y.map(P=>{const D=w>0?P.totalCost/w*100:0,M=P.period===o,q=`${P.period}, ${Xe(P.totalCost)}`;return m.jsxs("button",{className:`uh-bar-col${M?" sel":""}`,onClick:()=>a(M?null:P.period),"aria-pressed":M,"aria-label":q,title:`${P.period} · ${Xe(P.totalCost)}`,style:{flexBasis:`${100/y.length}%`},children:[m.jsx("div",{className:"uh-bar",style:{height:`${Math.max(D,P.totalCost>0?2:0)}%`},children:P.modelBreakdowns.slice().sort((W,K)=>K.cost-W.cost).map(W=>{const K=P.totalCost>0?W.cost/P.totalCost*100:0;return m.jsx("div",{className:"uh-bar-seg",style:{height:`${K}%`,background:cu(W.modelName)}},W.modelName)})}),m.jsx("span",{className:"uh-bar-label",children:P.period.slice(5)})]},P.period)})}),m.jsx("div",{className:"uh-legend",children:N.map(([P,D])=>m.jsxs("span",{className:"uh-legend-item",title:P,children:[m.jsx("span",{className:"uh-legend-dot",style:{background:cu(P)}}),ni(P)," ",m.jsx("span",{className:"uh-legend-cost",children:Xe(D)})]},P))}),I&&m.jsxs("div",{className:"uh-detail",children:[m.jsxs("div",{className:"uh-detail-head",children:[m.jsx("span",{className:"uh-detail-date",children:I.period}),m.jsx("span",{className:"uh-detail-cost",children:Xe(I.totalCost)}),(()=>{var M,q;const D=Mq(I.agents)??((q=(M=I.metadata)==null?void 0:M.agents)!=null&&q.length?I.metadata.agents.join(" · "):null);return D?m.jsx("span",{className:"uh-detail-agents",title:D,children:D}):null})()]}),m.jsxs("div",{className:"uh-detail-mini",children:[m.jsx(fu,{label:"input",val:At(I.inputTokens)}),m.jsx(fu,{label:"output",val:At(I.outputTokens)}),m.jsx(fu,{label:"cache write",val:At(I.cacheCreationTokens)}),m.jsx(fu,{label:"cache read",val:At(I.cacheReadTokens)})]}),m.jsx("div",{className:"uh-detail-models",children:I.modelBreakdowns.slice().sort((P,D)=>D.cost-P.cost).map(P=>{const D=I.totalCost>0?P.cost/I.totalCost*100:0;return m.jsxs("div",{className:"uh-model-row",title:P.modelName,children:[m.jsxs("span",{className:"uh-model-name",children:[m.jsx("span",{className:"uh-legend-dot",style:{background:cu(P.modelName)}}),m.jsx("span",{className:"uh-model-label",children:ni(P.modelName)})]}),m.jsx("span",{className:"uh-model-bar",children:m.jsx("span",{className:"uh-model-bar-fill",style:{width:`${D}%`,background:cu(P.modelName)}})}),m.jsx("span",{className:"uh-model-cost",children:Xe(P.cost)})]},P.modelName)})})]})]})]})})}function du({label:e,val:t,accent:r}){return m.jsxs("div",{className:"uh-stat",children:[m.jsx("span",{className:`uh-stat-val${r?" accent":""}`,children:t}),m.jsx("span",{className:"uh-stat-label",children:e})]})}function fu({label:e,val:t}){return m.jsxs("div",{className:"uh-ministat",children:[m.jsx("span",{className:"uh-ministat-val",children:t}),m.jsx("span",{className:"uh-ministat-label",children:e})]})}function _y(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 tf,q1;function qq(){if(q1)return tf;q1=1;function e(){this.__data__=[],this.size=0}return tf=e,tf}var nf,D1;function po(){if(D1)return nf;D1=1;function e(t,r){return t===r||t!==t&&r!==r}return nf=e,nf}var rf,F1;function Hu(){if(F1)return rf;F1=1;var e=po();function t(r,i){for(var o=r.length;o--;)if(e(r[o][0],i))return o;return-1}return rf=t,rf}var sf,z1;function Dq(){if(z1)return sf;z1=1;var e=Hu(),t=Array.prototype,r=t.splice;function i(o){var a=this.__data__,u=e(a,o);if(u<0)return!1;var c=a.length-1;return u==c?a.pop():r.call(a,u,1),--this.size,!0}return sf=i,sf}var of,B1;function Fq(){if(B1)return of;B1=1;var e=Hu();function t(r){var i=this.__data__,o=e(i,r);return o<0?void 0:i[o][1]}return of=t,of}var af,U1;function zq(){if(U1)return af;U1=1;var e=Hu();function t(r){return e(this.__data__,r)>-1}return af=t,af}var lf,H1;function Bq(){if(H1)return lf;H1=1;var e=Hu();function t(r,i){var o=this.__data__,a=e(o,r);return a<0?(++this.size,o.push([r,i])):o[a][1]=i,this}return lf=t,lf}var uf,W1;function Wu(){if(W1)return uf;W1=1;var e=qq(),t=Dq(),r=Fq(),i=zq(),o=Bq();function a(u){var c=-1,f=u==null?0:u.length;for(this.clear();++c<f;){var p=u[c];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=i,a.prototype.set=o,uf=a,uf}var cf,V1;function Uq(){if(V1)return cf;V1=1;var e=Wu();function t(){this.__data__=new e,this.size=0}return cf=t,cf}var df,G1;function Hq(){if(G1)return df;G1=1;function e(t){var r=this.__data__,i=r.delete(t);return this.size=r.size,i}return df=e,df}var ff,Y1;function Wq(){if(Y1)return ff;Y1=1;function e(t){return this.__data__.get(t)}return ff=e,ff}var hf,K1;function Vq(){if(K1)return hf;K1=1;function e(t){return this.__data__.has(t)}return hf=e,hf}var pf,X1;function fj(){if(X1)return pf;X1=1;var e=typeof Kl=="object"&&Kl&&Kl.Object===Object&&Kl;return pf=e,pf}var mf,Q1;function ir(){if(Q1)return mf;Q1=1;var e=fj(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return mf=r,mf}var gf,Z1;function mo(){if(Z1)return gf;Z1=1;var e=ir(),t=e.Symbol;return gf=t,gf}var vf,J1;function Gq(){if(J1)return vf;J1=1;var e=mo(),t=Object.prototype,r=t.hasOwnProperty,i=t.toString,o=e?e.toStringTag:void 0;function a(u){var c=r.call(u,o),f=u[o];try{u[o]=void 0;var p=!0}catch{}var d=i.call(u);return p&&(c?u[o]=f:delete u[o]),d}return vf=a,vf}var yf,e_;function Yq(){if(e_)return yf;e_=1;var e=Object.prototype,t=e.toString;function r(i){return t.call(i)}return yf=r,yf}var wf,t_;function si(){if(t_)return wf;t_=1;var e=mo(),t=Gq(),r=Yq(),i="[object Null]",o="[object Undefined]",a=e?e.toStringTag:void 0;function u(c){return c==null?c===void 0?o:i:a&&a in Object(c)?t(c):r(c)}return wf=u,wf}var xf,n_;function Dn(){if(n_)return xf;n_=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return xf=e,xf}var _f,r_;function La(){if(r_)return _f;r_=1;var e=si(),t=Dn(),r="[object AsyncFunction]",i="[object Function]",o="[object GeneratorFunction]",a="[object Proxy]";function u(c){if(!t(c))return!1;var f=e(c);return f==i||f==o||f==r||f==a}return _f=u,_f}var bf,s_;function Kq(){if(s_)return bf;s_=1;var e=ir(),t=e["__core-js_shared__"];return bf=t,bf}var Sf,i_;function Xq(){if(i_)return Sf;i_=1;var e=Kq(),t=(function(){var i=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""})();function r(i){return!!t&&t in i}return Sf=r,Sf}var kf,o_;function hj(){if(o_)return kf;o_=1;var e=Function.prototype,t=e.toString;function r(i){if(i!=null){try{return t.call(i)}catch{}try{return i+""}catch{}}return""}return kf=r,kf}var Ef,a_;function Qq(){if(a_)return Ef;a_=1;var e=La(),t=Xq(),r=Dn(),i=hj(),o=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,f=u.toString,p=c.hasOwnProperty,d=RegExp("^"+f.call(p).replace(o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function g(y){if(!r(y)||t(y))return!1;var w=e(y)?d:a;return w.test(i(y))}return Ef=g,Ef}var Nf,l_;function Zq(){if(l_)return Nf;l_=1;function e(t,r){return t==null?void 0:t[r]}return Nf=e,Nf}var Cf,u_;function ii(){if(u_)return Cf;u_=1;var e=Qq(),t=Zq();function r(i,o){var a=t(i,o);return e(a)?a:void 0}return Cf=r,Cf}var jf,c_;function by(){if(c_)return jf;c_=1;var e=ii(),t=ir(),r=e(t,"Map");return jf=r,jf}var Tf,d_;function Vu(){if(d_)return Tf;d_=1;var e=ii(),t=e(Object,"create");return Tf=t,Tf}var Rf,f_;function Jq(){if(f_)return Rf;f_=1;var e=Vu();function t(){this.__data__=e?e(null):{},this.size=0}return Rf=t,Rf}var Af,h_;function e4(){if(h_)return Af;h_=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return Af=e,Af}var If,p_;function t4(){if(p_)return If;p_=1;var e=Vu(),t="__lodash_hash_undefined__",r=Object.prototype,i=r.hasOwnProperty;function o(a){var u=this.__data__;if(e){var c=u[a];return c===t?void 0:c}return i.call(u,a)?u[a]:void 0}return If=o,If}var Mf,m_;function n4(){if(m_)return Mf;m_=1;var e=Vu(),t=Object.prototype,r=t.hasOwnProperty;function i(o){var a=this.__data__;return e?a[o]!==void 0:r.call(a,o)}return Mf=i,Mf}var Of,g_;function r4(){if(g_)return Of;g_=1;var e=Vu(),t="__lodash_hash_undefined__";function r(i,o){var a=this.__data__;return this.size+=this.has(i)?0:1,a[i]=e&&o===void 0?t:o,this}return Of=r,Of}var Pf,v_;function s4(){if(v_)return Pf;v_=1;var e=Jq(),t=e4(),r=t4(),i=n4(),o=r4();function a(u){var c=-1,f=u==null?0:u.length;for(this.clear();++c<f;){var p=u[c];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=i,a.prototype.set=o,Pf=a,Pf}var Lf,y_;function i4(){if(y_)return Lf;y_=1;var e=s4(),t=Wu(),r=by();function i(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Lf=i,Lf}var $f,w_;function o4(){if(w_)return $f;w_=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return $f=e,$f}var qf,x_;function Gu(){if(x_)return qf;x_=1;var e=o4();function t(r,i){var o=r.__data__;return e(i)?o[typeof i=="string"?"string":"hash"]:o.map}return qf=t,qf}var Df,__;function a4(){if(__)return Df;__=1;var e=Gu();function t(r){var i=e(this,r).delete(r);return this.size-=i?1:0,i}return Df=t,Df}var Ff,b_;function l4(){if(b_)return Ff;b_=1;var e=Gu();function t(r){return e(this,r).get(r)}return Ff=t,Ff}var zf,S_;function u4(){if(S_)return zf;S_=1;var e=Gu();function t(r){return e(this,r).has(r)}return zf=t,zf}var Bf,k_;function c4(){if(k_)return Bf;k_=1;var e=Gu();function t(r,i){var o=e(this,r),a=o.size;return o.set(r,i),this.size+=o.size==a?0:1,this}return Bf=t,Bf}var Uf,E_;function Sy(){if(E_)return Uf;E_=1;var e=i4(),t=a4(),r=l4(),i=u4(),o=c4();function a(u){var c=-1,f=u==null?0:u.length;for(this.clear();++c<f;){var p=u[c];this.set(p[0],p[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=i,a.prototype.set=o,Uf=a,Uf}var Hf,N_;function d4(){if(N_)return Hf;N_=1;var e=Wu(),t=by(),r=Sy(),i=200;function o(a,u){var c=this.__data__;if(c instanceof e){var f=c.__data__;if(!t||f.length<i-1)return f.push([a,u]),this.size=++c.size,this;c=this.__data__=new r(f)}return c.set(a,u),this.size=c.size,this}return Hf=o,Hf}var Wf,C_;function Yu(){if(C_)return Wf;C_=1;var e=Wu(),t=Uq(),r=Hq(),i=Wq(),o=Vq(),a=d4();function u(c){var f=this.__data__=new e(c);this.size=f.size}return u.prototype.clear=t,u.prototype.delete=r,u.prototype.get=i,u.prototype.has=o,u.prototype.set=a,Wf=u,Wf}var Vf,j_;function ky(){if(j_)return Vf;j_=1;function e(t,r){for(var i=-1,o=t==null?0:t.length;++i<o&&r(t[i],i,t)!==!1;);return t}return Vf=e,Vf}var Gf,T_;function pj(){if(T_)return Gf;T_=1;var e=ii(),t=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return Gf=t,Gf}var Yf,R_;function Ku(){if(R_)return Yf;R_=1;var e=pj();function t(r,i,o){i=="__proto__"&&e?e(r,i,{configurable:!0,enumerable:!0,value:o,writable:!0}):r[i]=o}return Yf=t,Yf}var Kf,A_;function Xu(){if(A_)return Kf;A_=1;var e=Ku(),t=po(),r=Object.prototype,i=r.hasOwnProperty;function o(a,u,c){var f=a[u];(!(i.call(a,u)&&t(f,c))||c===void 0&&!(u in a))&&e(a,u,c)}return Kf=o,Kf}var Xf,I_;function $a(){if(I_)return Xf;I_=1;var e=Xu(),t=Ku();function r(i,o,a,u){var c=!a;a||(a={});for(var f=-1,p=o.length;++f<p;){var d=o[f],g=u?u(a[d],i[d],d,a,i):void 0;g===void 0&&(g=i[d]),c?t(a,d,g):e(a,d,g)}return a}return Xf=r,Xf}var Qf,M_;function f4(){if(M_)return Qf;M_=1;function e(t,r){for(var i=-1,o=Array(t);++i<t;)o[i]=r(i);return o}return Qf=e,Qf}var Zf,O_;function xr(){if(O_)return Zf;O_=1;function e(t){return t!=null&&typeof t=="object"}return Zf=e,Zf}var Jf,P_;function h4(){if(P_)return Jf;P_=1;var e=si(),t=xr(),r="[object Arguments]";function i(o){return t(o)&&e(o)==r}return Jf=i,Jf}var eh,L_;function qa(){if(L_)return eh;L_=1;var e=h4(),t=xr(),r=Object.prototype,i=r.hasOwnProperty,o=r.propertyIsEnumerable,a=e((function(){return arguments})())?e:function(u){return t(u)&&i.call(u,"callee")&&!o.call(u,"callee")};return eh=a,eh}var th,$_;function Ct(){if($_)return th;$_=1;var e=Array.isArray;return th=e,th}var pa={exports:{}},nh,q_;function p4(){if(q_)return nh;q_=1;function e(){return!1}return nh=e,nh}pa.exports;var D_;function go(){return D_||(D_=1,(function(e,t){var r=ir(),i=p4(),o=t&&!t.nodeType&&t,a=o&&!0&&e&&!e.nodeType&&e,u=a&&a.exports===o,c=u?r.Buffer:void 0,f=c?c.isBuffer:void 0,p=f||i;e.exports=p})(pa,pa.exports)),pa.exports}var rh,F_;function Qu(){if(F_)return rh;F_=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function r(i,o){var a=typeof i;return o=o??e,!!o&&(a=="number"||a!="symbol"&&t.test(i))&&i>-1&&i%1==0&&i<o}return rh=r,rh}var sh,z_;function Ey(){if(z_)return sh;z_=1;var e=9007199254740991;function t(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return sh=t,sh}var ih,B_;function m4(){if(B_)return ih;B_=1;var e=si(),t=Ey(),r=xr(),i="[object Arguments]",o="[object Array]",a="[object Boolean]",u="[object Date]",c="[object Error]",f="[object Function]",p="[object Map]",d="[object Number]",g="[object Object]",y="[object RegExp]",w="[object Set]",k="[object String]",_="[object WeakMap]",b="[object ArrayBuffer]",S="[object DataView]",E="[object Float32Array]",N="[object Float64Array]",j="[object Int8Array]",A="[object Int16Array]",I="[object Int32Array]",L="[object Uint8Array]",P="[object Uint8ClampedArray]",D="[object Uint16Array]",M="[object Uint32Array]",q={};q[E]=q[N]=q[j]=q[A]=q[I]=q[L]=q[P]=q[D]=q[M]=!0,q[i]=q[o]=q[b]=q[a]=q[S]=q[u]=q[c]=q[f]=q[p]=q[d]=q[g]=q[y]=q[w]=q[k]=q[_]=!1;function W(K){return r(K)&&t(K.length)&&!!q[e(K)]}return ih=W,ih}var oh,U_;function Zu(){if(U_)return oh;U_=1;function e(t){return function(r){return t(r)}}return oh=e,oh}var ma={exports:{}};ma.exports;var H_;function Ny(){return H_||(H_=1,(function(e,t){var r=fj(),i=t&&!t.nodeType&&t,o=i&&!0&&e&&!e.nodeType&&e,a=o&&o.exports===i,u=a&&r.process,c=(function(){try{var f=o&&o.require&&o.require("util").types;return f||u&&u.binding&&u.binding("util")}catch{}})();e.exports=c})(ma,ma.exports)),ma.exports}var ah,W_;function Da(){if(W_)return ah;W_=1;var e=m4(),t=Zu(),r=Ny(),i=r&&r.isTypedArray,o=i?t(i):e;return ah=o,ah}var lh,V_;function mj(){if(V_)return lh;V_=1;var e=f4(),t=qa(),r=Ct(),i=go(),o=Qu(),a=Da(),u=Object.prototype,c=u.hasOwnProperty;function f(p,d){var g=r(p),y=!g&&t(p),w=!g&&!y&&i(p),k=!g&&!y&&!w&&a(p),_=g||y||w||k,b=_?e(p.length,String):[],S=b.length;for(var E in p)(d||c.call(p,E))&&!(_&&(E=="length"||w&&(E=="offset"||E=="parent")||k&&(E=="buffer"||E=="byteLength"||E=="byteOffset")||o(E,S)))&&b.push(E);return b}return lh=f,lh}var uh,G_;function Ju(){if(G_)return uh;G_=1;var e=Object.prototype;function t(r){var i=r&&r.constructor,o=typeof i=="function"&&i.prototype||e;return r===o}return uh=t,uh}var ch,Y_;function gj(){if(Y_)return ch;Y_=1;function e(t,r){return function(i){return t(r(i))}}return ch=e,ch}var dh,K_;function g4(){if(K_)return dh;K_=1;var e=gj(),t=e(Object.keys,Object);return dh=t,dh}var fh,X_;function Cy(){if(X_)return fh;X_=1;var e=Ju(),t=g4(),r=Object.prototype,i=r.hasOwnProperty;function o(a){if(!e(a))return t(a);var u=[];for(var c in Object(a))i.call(a,c)&&c!="constructor"&&u.push(c);return u}return fh=o,fh}var hh,Q_;function Ur(){if(Q_)return hh;Q_=1;var e=La(),t=Ey();function r(i){return i!=null&&t(i.length)&&!e(i)}return hh=r,hh}var ph,Z_;function xs(){if(Z_)return ph;Z_=1;var e=mj(),t=Cy(),r=Ur();function i(o){return r(o)?e(o):t(o)}return ph=i,ph}var mh,J_;function v4(){if(J_)return mh;J_=1;var e=$a(),t=xs();function r(i,o){return i&&e(o,t(o),i)}return mh=r,mh}var gh,eb;function y4(){if(eb)return gh;eb=1;function e(t){var r=[];if(t!=null)for(var i in Object(t))r.push(i);return r}return gh=e,gh}var vh,tb;function w4(){if(tb)return vh;tb=1;var e=Dn(),t=Ju(),r=y4(),i=Object.prototype,o=i.hasOwnProperty;function a(u){if(!e(u))return r(u);var c=t(u),f=[];for(var p in u)p=="constructor"&&(c||!o.call(u,p))||f.push(p);return f}return vh=a,vh}var yh,nb;function oi(){if(nb)return yh;nb=1;var e=mj(),t=w4(),r=Ur();function i(o){return r(o)?e(o,!0):t(o)}return yh=i,yh}var wh,rb;function x4(){if(rb)return wh;rb=1;var e=$a(),t=oi();function r(i,o){return i&&e(o,t(o),i)}return wh=r,wh}var ga={exports:{}};ga.exports;var sb;function vj(){return sb||(sb=1,(function(e,t){var r=ir(),i=t&&!t.nodeType&&t,o=i&&!0&&e&&!e.nodeType&&e,a=o&&o.exports===i,u=a?r.Buffer:void 0,c=u?u.allocUnsafe:void 0;function f(p,d){if(d)return p.slice();var g=p.length,y=c?c(g):new p.constructor(g);return p.copy(y),y}e.exports=f})(ga,ga.exports)),ga.exports}var xh,ib;function yj(){if(ib)return xh;ib=1;function e(t,r){var i=-1,o=t.length;for(r||(r=Array(o));++i<o;)r[i]=t[i];return r}return xh=e,xh}var _h,ob;function wj(){if(ob)return _h;ob=1;function e(t,r){for(var i=-1,o=t==null?0:t.length,a=0,u=[];++i<o;){var c=t[i];r(c,i,t)&&(u[a++]=c)}return u}return _h=e,_h}var bh,ab;function xj(){if(ab)return bh;ab=1;function e(){return[]}return bh=e,bh}var Sh,lb;function jy(){if(lb)return Sh;lb=1;var e=wj(),t=xj(),r=Object.prototype,i=r.propertyIsEnumerable,o=Object.getOwnPropertySymbols,a=o?function(u){return u==null?[]:(u=Object(u),e(o(u),function(c){return i.call(u,c)}))}:t;return Sh=a,Sh}var kh,ub;function _4(){if(ub)return kh;ub=1;var e=$a(),t=jy();function r(i,o){return e(i,t(i),o)}return kh=r,kh}var Eh,cb;function Ty(){if(cb)return Eh;cb=1;function e(t,r){for(var i=-1,o=r.length,a=t.length;++i<o;)t[a+i]=r[i];return t}return Eh=e,Eh}var Nh,db;function ec(){if(db)return Nh;db=1;var e=gj(),t=e(Object.getPrototypeOf,Object);return Nh=t,Nh}var Ch,fb;function _j(){if(fb)return Ch;fb=1;var e=Ty(),t=ec(),r=jy(),i=xj(),o=Object.getOwnPropertySymbols,a=o?function(u){for(var c=[];u;)e(c,r(u)),u=t(u);return c}:i;return Ch=a,Ch}var jh,hb;function b4(){if(hb)return jh;hb=1;var e=$a(),t=_j();function r(i,o){return e(i,t(i),o)}return jh=r,jh}var Th,pb;function bj(){if(pb)return Th;pb=1;var e=Ty(),t=Ct();function r(i,o,a){var u=o(i);return t(i)?u:e(u,a(i))}return Th=r,Th}var Rh,mb;function Sj(){if(mb)return Rh;mb=1;var e=bj(),t=jy(),r=xs();function i(o){return e(o,r,t)}return Rh=i,Rh}var Ah,gb;function S4(){if(gb)return Ah;gb=1;var e=bj(),t=_j(),r=oi();function i(o){return e(o,r,t)}return Ah=i,Ah}var Ih,vb;function k4(){if(vb)return Ih;vb=1;var e=ii(),t=ir(),r=e(t,"DataView");return Ih=r,Ih}var Mh,yb;function E4(){if(yb)return Mh;yb=1;var e=ii(),t=ir(),r=e(t,"Promise");return Mh=r,Mh}var Oh,wb;function kj(){if(wb)return Oh;wb=1;var e=ii(),t=ir(),r=e(t,"Set");return Oh=r,Oh}var Ph,xb;function N4(){if(xb)return Ph;xb=1;var e=ii(),t=ir(),r=e(t,"WeakMap");return Ph=r,Ph}var Lh,_b;function vo(){if(_b)return Lh;_b=1;var e=k4(),t=by(),r=E4(),i=kj(),o=N4(),a=si(),u=hj(),c="[object Map]",f="[object Object]",p="[object Promise]",d="[object Set]",g="[object WeakMap]",y="[object DataView]",w=u(e),k=u(t),_=u(r),b=u(i),S=u(o),E=a;return(e&&E(new e(new ArrayBuffer(1)))!=y||t&&E(new t)!=c||r&&E(r.resolve())!=p||i&&E(new i)!=d||o&&E(new o)!=g)&&(E=function(N){var j=a(N),A=j==f?N.constructor:void 0,I=A?u(A):"";if(I)switch(I){case w:return y;case k:return c;case _:return p;case b:return d;case S:return g}return j}),Lh=E,Lh}var $h,bb;function C4(){if(bb)return $h;bb=1;var e=Object.prototype,t=e.hasOwnProperty;function r(i){var o=i.length,a=new i.constructor(o);return o&&typeof i[0]=="string"&&t.call(i,"index")&&(a.index=i.index,a.input=i.input),a}return $h=r,$h}var qh,Sb;function Ej(){if(Sb)return qh;Sb=1;var e=ir(),t=e.Uint8Array;return qh=t,qh}var Dh,kb;function Ry(){if(kb)return Dh;kb=1;var e=Ej();function t(r){var i=new r.constructor(r.byteLength);return new e(i).set(new e(r)),i}return Dh=t,Dh}var Fh,Eb;function j4(){if(Eb)return Fh;Eb=1;var e=Ry();function t(r,i){var o=i?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.byteLength)}return Fh=t,Fh}var zh,Nb;function T4(){if(Nb)return zh;Nb=1;var e=/\w*$/;function t(r){var i=new r.constructor(r.source,e.exec(r));return i.lastIndex=r.lastIndex,i}return zh=t,zh}var Bh,Cb;function R4(){if(Cb)return Bh;Cb=1;var e=mo(),t=e?e.prototype:void 0,r=t?t.valueOf:void 0;function i(o){return r?Object(r.call(o)):{}}return Bh=i,Bh}var Uh,jb;function Nj(){if(jb)return Uh;jb=1;var e=Ry();function t(r,i){var o=i?e(r.buffer):r.buffer;return new r.constructor(o,r.byteOffset,r.length)}return Uh=t,Uh}var Hh,Tb;function A4(){if(Tb)return Hh;Tb=1;var e=Ry(),t=j4(),r=T4(),i=R4(),o=Nj(),a="[object Boolean]",u="[object Date]",c="[object Map]",f="[object Number]",p="[object RegExp]",d="[object Set]",g="[object String]",y="[object Symbol]",w="[object ArrayBuffer]",k="[object DataView]",_="[object Float32Array]",b="[object Float64Array]",S="[object Int8Array]",E="[object Int16Array]",N="[object Int32Array]",j="[object Uint8Array]",A="[object Uint8ClampedArray]",I="[object Uint16Array]",L="[object Uint32Array]";function P(D,M,q){var W=D.constructor;switch(M){case w:return e(D);case a:case u:return new W(+D);case k:return t(D,q);case _:case b:case S:case E:case N:case j:case A:case I:case L:return o(D,q);case c:return new W;case f:case g:return new W(D);case p:return r(D);case d:return new W;case y:return i(D)}}return Hh=P,Hh}var Wh,Rb;function Cj(){if(Rb)return Wh;Rb=1;var e=Dn(),t=Object.create,r=(function(){function i(){}return function(o){if(!e(o))return{};if(t)return t(o);i.prototype=o;var a=new i;return i.prototype=void 0,a}})();return Wh=r,Wh}var Vh,Ab;function jj(){if(Ab)return Vh;Ab=1;var e=Cj(),t=ec(),r=Ju();function i(o){return typeof o.constructor=="function"&&!r(o)?e(t(o)):{}}return Vh=i,Vh}var Gh,Ib;function I4(){if(Ib)return Gh;Ib=1;var e=vo(),t=xr(),r="[object Map]";function i(o){return t(o)&&e(o)==r}return Gh=i,Gh}var Yh,Mb;function M4(){if(Mb)return Yh;Mb=1;var e=I4(),t=Zu(),r=Ny(),i=r&&r.isMap,o=i?t(i):e;return Yh=o,Yh}var Kh,Ob;function O4(){if(Ob)return Kh;Ob=1;var e=vo(),t=xr(),r="[object Set]";function i(o){return t(o)&&e(o)==r}return Kh=i,Kh}var Xh,Pb;function P4(){if(Pb)return Xh;Pb=1;var e=O4(),t=Zu(),r=Ny(),i=r&&r.isSet,o=i?t(i):e;return Xh=o,Xh}var Qh,Lb;function Tj(){if(Lb)return Qh;Lb=1;var e=Yu(),t=ky(),r=Xu(),i=v4(),o=x4(),a=vj(),u=yj(),c=_4(),f=b4(),p=Sj(),d=S4(),g=vo(),y=C4(),w=A4(),k=jj(),_=Ct(),b=go(),S=M4(),E=Dn(),N=P4(),j=xs(),A=oi(),I=1,L=2,P=4,D="[object Arguments]",M="[object Array]",q="[object Boolean]",W="[object Date]",K="[object Error]",C="[object Function]",z="[object GeneratorFunction]",F="[object Map]",te="[object Number]",Z="[object Object]",U="[object RegExp]",Q="[object Set]",O="[object String]",V="[object Symbol]",ce="[object WeakMap]",$="[object ArrayBuffer]",G="[object DataView]",ee="[object Float32Array]",ie="[object Float64Array]",de="[object Int8Array]",pe="[object Int16Array]",ne="[object Int32Array]",Pe="[object Uint8Array]",He="[object Uint8ClampedArray]",ze="[object Uint16Array]",Oe="[object Uint32Array]",_e={};_e[D]=_e[M]=_e[$]=_e[G]=_e[q]=_e[W]=_e[ee]=_e[ie]=_e[de]=_e[pe]=_e[ne]=_e[F]=_e[te]=_e[Z]=_e[U]=_e[Q]=_e[O]=_e[V]=_e[Pe]=_e[He]=_e[ze]=_e[Oe]=!0,_e[K]=_e[C]=_e[ce]=!1;function Qe(ye,we,qe,dt,Ae,ot){var We,Ye=we&I,pt=we&L,_t=we&P;if(qe&&(We=Ae?qe(ye,dt,Ae,ot):qe(ye)),We!==void 0)return We;if(!E(ye))return ye;var se=_(ye);if(se){if(We=y(ye),!Ye)return u(ye,We)}else{var $e=g(ye),De=$e==C||$e==z;if(b(ye))return a(ye,Ye);if($e==Z||$e==D||De&&!Ae){if(We=pt||De?{}:k(ye),!Ye)return pt?f(ye,o(We,ye)):c(ye,i(We,ye))}else{if(!_e[$e])return Ae?ye:{};We=w(ye,$e,Ye)}}ot||(ot=new e);var Te=ot.get(ye);if(Te)return Te;ot.set(ye,We),N(ye)?ye.forEach(function(lt){We.add(Qe(lt,we,qe,lt,ye,ot))}):S(ye)&&ye.forEach(function(lt,ke){We.set(ke,Qe(lt,we,qe,ke,ye,ot))});var Fe=_t?pt?d:p:pt?A:j,Ze=se?void 0:Fe(ye);return t(Ze||ye,function(lt,ke){Ze&&(ke=lt,lt=ye[ke]),r(We,ke,Qe(lt,we,qe,ke,ye,ot))}),We}return Qh=Qe,Qh}var Zh,$b;function L4(){if($b)return Zh;$b=1;var e=Tj(),t=4;function r(i){return e(i,t)}return Zh=r,Zh}var Jh,qb;function Ay(){if(qb)return Jh;qb=1;function e(t){return function(){return t}}return Jh=e,Jh}var ep,Db;function $4(){if(Db)return ep;Db=1;function e(t){return function(r,i,o){for(var a=-1,u=Object(r),c=o(r),f=c.length;f--;){var p=c[t?f:++a];if(i(u[p],p,u)===!1)break}return r}}return ep=e,ep}var tp,Fb;function Iy(){if(Fb)return tp;Fb=1;var e=$4(),t=e();return tp=t,tp}var np,zb;function My(){if(zb)return np;zb=1;var e=Iy(),t=xs();function r(i,o){return i&&e(i,o,t)}return np=r,np}var rp,Bb;function q4(){if(Bb)return rp;Bb=1;var e=Ur();function t(r,i){return function(o,a){if(o==null)return o;if(!e(o))return r(o,a);for(var u=o.length,c=i?u:-1,f=Object(o);(i?c--:++c<u)&&a(f[c],c,f)!==!1;);return o}}return rp=t,rp}var sp,Ub;function tc(){if(Ub)return sp;Ub=1;var e=My(),t=q4(),r=t(e);return sp=r,sp}var ip,Hb;function ai(){if(Hb)return ip;Hb=1;function e(t){return t}return ip=e,ip}var op,Wb;function Rj(){if(Wb)return op;Wb=1;var e=ai();function t(r){return typeof r=="function"?r:e}return op=t,op}var ap,Vb;function Aj(){if(Vb)return ap;Vb=1;var e=ky(),t=tc(),r=Rj(),i=Ct();function o(a,u){var c=i(a)?e:t;return c(a,r(u))}return ap=o,ap}var lp,Gb;function Ij(){return Gb||(Gb=1,lp=Aj()),lp}var up,Yb;function D4(){if(Yb)return up;Yb=1;var e=tc();function t(r,i){var o=[];return e(r,function(a,u,c){i(a,u,c)&&o.push(a)}),o}return up=t,up}var cp,Kb;function F4(){if(Kb)return cp;Kb=1;var e="__lodash_hash_undefined__";function t(r){return this.__data__.set(r,e),this}return cp=t,cp}var dp,Xb;function z4(){if(Xb)return dp;Xb=1;function e(t){return this.__data__.has(t)}return dp=e,dp}var fp,Qb;function Mj(){if(Qb)return fp;Qb=1;var e=Sy(),t=F4(),r=z4();function i(o){var a=-1,u=o==null?0:o.length;for(this.__data__=new e;++a<u;)this.add(o[a])}return i.prototype.add=i.prototype.push=t,i.prototype.has=r,fp=i,fp}var hp,Zb;function B4(){if(Zb)return hp;Zb=1;function e(t,r){for(var i=-1,o=t==null?0:t.length;++i<o;)if(r(t[i],i,t))return!0;return!1}return hp=e,hp}var pp,Jb;function Oj(){if(Jb)return pp;Jb=1;function e(t,r){return t.has(r)}return pp=e,pp}var mp,eS;function Pj(){if(eS)return mp;eS=1;var e=Mj(),t=B4(),r=Oj(),i=1,o=2;function a(u,c,f,p,d,g){var y=f&i,w=u.length,k=c.length;if(w!=k&&!(y&&k>w))return!1;var _=g.get(u),b=g.get(c);if(_&&b)return _==c&&b==u;var S=-1,E=!0,N=f&o?new e:void 0;for(g.set(u,c),g.set(c,u);++S<w;){var j=u[S],A=c[S];if(p)var I=y?p(A,j,S,c,u,g):p(j,A,S,u,c,g);if(I!==void 0){if(I)continue;E=!1;break}if(N){if(!t(c,function(L,P){if(!r(N,P)&&(j===L||d(j,L,f,p,g)))return N.push(P)})){E=!1;break}}else if(!(j===A||d(j,A,f,p,g))){E=!1;break}}return g.delete(u),g.delete(c),E}return mp=a,mp}var gp,tS;function U4(){if(tS)return gp;tS=1;function e(t){var r=-1,i=Array(t.size);return t.forEach(function(o,a){i[++r]=[a,o]}),i}return gp=e,gp}var vp,nS;function Oy(){if(nS)return vp;nS=1;function e(t){var r=-1,i=Array(t.size);return t.forEach(function(o){i[++r]=o}),i}return vp=e,vp}var yp,rS;function H4(){if(rS)return yp;rS=1;var e=mo(),t=Ej(),r=po(),i=Pj(),o=U4(),a=Oy(),u=1,c=2,f="[object Boolean]",p="[object Date]",d="[object Error]",g="[object Map]",y="[object Number]",w="[object RegExp]",k="[object Set]",_="[object String]",b="[object Symbol]",S="[object ArrayBuffer]",E="[object DataView]",N=e?e.prototype:void 0,j=N?N.valueOf:void 0;function A(I,L,P,D,M,q,W){switch(P){case E:if(I.byteLength!=L.byteLength||I.byteOffset!=L.byteOffset)return!1;I=I.buffer,L=L.buffer;case S:return!(I.byteLength!=L.byteLength||!q(new t(I),new t(L)));case f:case p:case y:return r(+I,+L);case d:return I.name==L.name&&I.message==L.message;case w:case _:return I==L+"";case g:var K=o;case k:var C=D&u;if(K||(K=a),I.size!=L.size&&!C)return!1;var z=W.get(I);if(z)return z==L;D|=c,W.set(I,L);var F=i(K(I),K(L),D,M,q,W);return W.delete(I),F;case b:if(j)return j.call(I)==j.call(L)}return!1}return yp=A,yp}var wp,sS;function W4(){if(sS)return wp;sS=1;var e=Sj(),t=1,r=Object.prototype,i=r.hasOwnProperty;function o(a,u,c,f,p,d){var g=c&t,y=e(a),w=y.length,k=e(u),_=k.length;if(w!=_&&!g)return!1;for(var b=w;b--;){var S=y[b];if(!(g?S in u:i.call(u,S)))return!1}var E=d.get(a),N=d.get(u);if(E&&N)return E==u&&N==a;var j=!0;d.set(a,u),d.set(u,a);for(var A=g;++b<w;){S=y[b];var I=a[S],L=u[S];if(f)var P=g?f(L,I,S,u,a,d):f(I,L,S,a,u,d);if(!(P===void 0?I===L||p(I,L,c,f,d):P)){j=!1;break}A||(A=S=="constructor")}if(j&&!A){var D=a.constructor,M=u.constructor;D!=M&&"constructor"in a&&"constructor"in u&&!(typeof D=="function"&&D instanceof D&&typeof M=="function"&&M instanceof M)&&(j=!1)}return d.delete(a),d.delete(u),j}return wp=o,wp}var xp,iS;function V4(){if(iS)return xp;iS=1;var e=Yu(),t=Pj(),r=H4(),i=W4(),o=vo(),a=Ct(),u=go(),c=Da(),f=1,p="[object Arguments]",d="[object Array]",g="[object Object]",y=Object.prototype,w=y.hasOwnProperty;function k(_,b,S,E,N,j){var A=a(_),I=a(b),L=A?d:o(_),P=I?d:o(b);L=L==p?g:L,P=P==p?g:P;var D=L==g,M=P==g,q=L==P;if(q&&u(_)){if(!u(b))return!1;A=!0,D=!1}if(q&&!D)return j||(j=new e),A||c(_)?t(_,b,S,E,N,j):r(_,b,L,S,E,N,j);if(!(S&f)){var W=D&&w.call(_,"__wrapped__"),K=M&&w.call(b,"__wrapped__");if(W||K){var C=W?_.value():_,z=K?b.value():b;return j||(j=new e),N(C,z,S,E,j)}}return q?(j||(j=new e),i(_,b,S,E,N,j)):!1}return xp=k,xp}var _p,oS;function Lj(){if(oS)return _p;oS=1;var e=V4(),t=xr();function r(i,o,a,u,c){return i===o?!0:i==null||o==null||!t(i)&&!t(o)?i!==i&&o!==o:e(i,o,a,u,r,c)}return _p=r,_p}var bp,aS;function G4(){if(aS)return bp;aS=1;var e=Yu(),t=Lj(),r=1,i=2;function o(a,u,c,f){var p=c.length,d=p,g=!f;if(a==null)return!d;for(a=Object(a);p--;){var y=c[p];if(g&&y[2]?y[1]!==a[y[0]]:!(y[0]in a))return!1}for(;++p<d;){y=c[p];var w=y[0],k=a[w],_=y[1];if(g&&y[2]){if(k===void 0&&!(w in a))return!1}else{var b=new e;if(f)var S=f(k,_,w,a,u,b);if(!(S===void 0?t(_,k,r|i,f,b):S))return!1}}return!0}return bp=o,bp}var Sp,lS;function $j(){if(lS)return Sp;lS=1;var e=Dn();function t(r){return r===r&&!e(r)}return Sp=t,Sp}var kp,uS;function Y4(){if(uS)return kp;uS=1;var e=$j(),t=xs();function r(i){for(var o=t(i),a=o.length;a--;){var u=o[a],c=i[u];o[a]=[u,c,e(c)]}return o}return kp=r,kp}var Ep,cS;function qj(){if(cS)return Ep;cS=1;function e(t,r){return function(i){return i==null?!1:i[t]===r&&(r!==void 0||t in Object(i))}}return Ep=e,Ep}var Np,dS;function K4(){if(dS)return Np;dS=1;var e=G4(),t=Y4(),r=qj();function i(o){var a=t(o);return a.length==1&&a[0][2]?r(a[0][0],a[0][1]):function(u){return u===o||e(u,o,a)}}return Np=i,Np}var Cp,fS;function yo(){if(fS)return Cp;fS=1;var e=si(),t=xr(),r="[object Symbol]";function i(o){return typeof o=="symbol"||t(o)&&e(o)==r}return Cp=i,Cp}var jp,hS;function Py(){if(hS)return jp;hS=1;var e=Ct(),t=yo(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,i=/^\w*$/;function o(a,u){if(e(a))return!1;var c=typeof a;return c=="number"||c=="symbol"||c=="boolean"||a==null||t(a)?!0:i.test(a)||!r.test(a)||u!=null&&a in Object(u)}return jp=o,jp}var Tp,pS;function X4(){if(pS)return Tp;pS=1;var e=Sy(),t="Expected a function";function r(i,o){if(typeof i!="function"||o!=null&&typeof o!="function")throw new TypeError(t);var a=function(){var u=arguments,c=o?o.apply(this,u):u[0],f=a.cache;if(f.has(c))return f.get(c);var p=i.apply(this,u);return a.cache=f.set(c,p)||f,p};return a.cache=new(r.Cache||e),a}return r.Cache=e,Tp=r,Tp}var Rp,mS;function Q4(){if(mS)return Rp;mS=1;var e=X4(),t=500;function r(i){var o=e(i,function(u){return a.size===t&&a.clear(),u}),a=o.cache;return o}return Rp=r,Rp}var Ap,gS;function Z4(){if(gS)return Ap;gS=1;var e=Q4(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,i=e(function(o){var a=[];return o.charCodeAt(0)===46&&a.push(""),o.replace(t,function(u,c,f,p){a.push(f?p.replace(r,"$1"):c||u)}),a});return Ap=i,Ap}var Ip,vS;function nc(){if(vS)return Ip;vS=1;function e(t,r){for(var i=-1,o=t==null?0:t.length,a=Array(o);++i<o;)a[i]=r(t[i],i,t);return a}return Ip=e,Ip}var Mp,yS;function J4(){if(yS)return Mp;yS=1;var e=mo(),t=nc(),r=Ct(),i=yo(),o=e?e.prototype:void 0,a=o?o.toString:void 0;function u(c){if(typeof c=="string")return c;if(r(c))return t(c,u)+"";if(i(c))return a?a.call(c):"";var f=c+"";return f=="0"&&1/c==-1/0?"-0":f}return Mp=u,Mp}var Op,wS;function Dj(){if(wS)return Op;wS=1;var e=J4();function t(r){return r==null?"":e(r)}return Op=t,Op}var Pp,xS;function rc(){if(xS)return Pp;xS=1;var e=Ct(),t=Py(),r=Z4(),i=Dj();function o(a,u){return e(a)?a:t(a,u)?[a]:r(i(a))}return Pp=o,Pp}var Lp,_S;function Fa(){if(_S)return Lp;_S=1;var e=yo();function t(r){if(typeof r=="string"||e(r))return r;var i=r+"";return i=="0"&&1/r==-1/0?"-0":i}return Lp=t,Lp}var $p,bS;function sc(){if(bS)return $p;bS=1;var e=rc(),t=Fa();function r(i,o){o=e(o,i);for(var a=0,u=o.length;i!=null&&a<u;)i=i[t(o[a++])];return a&&a==u?i:void 0}return $p=r,$p}var qp,SS;function eD(){if(SS)return qp;SS=1;var e=sc();function t(r,i,o){var a=r==null?void 0:e(r,i);return a===void 0?o:a}return qp=t,qp}var Dp,kS;function tD(){if(kS)return Dp;kS=1;function e(t,r){return t!=null&&r in Object(t)}return Dp=e,Dp}var Fp,ES;function Fj(){if(ES)return Fp;ES=1;var e=rc(),t=qa(),r=Ct(),i=Qu(),o=Ey(),a=Fa();function u(c,f,p){f=e(f,c);for(var d=-1,g=f.length,y=!1;++d<g;){var w=a(f[d]);if(!(y=c!=null&&p(c,w)))break;c=c[w]}return y||++d!=g?y:(g=c==null?0:c.length,!!g&&o(g)&&i(w,g)&&(r(c)||t(c)))}return Fp=u,Fp}var zp,NS;function zj(){if(NS)return zp;NS=1;var e=tD(),t=Fj();function r(i,o){return i!=null&&t(i,o,e)}return zp=r,zp}var Bp,CS;function nD(){if(CS)return Bp;CS=1;var e=Lj(),t=eD(),r=zj(),i=Py(),o=$j(),a=qj(),u=Fa(),c=1,f=2;function p(d,g){return i(d)&&o(g)?a(u(d),g):function(y){var w=t(y,d);return w===void 0&&w===g?r(y,d):e(g,w,c|f)}}return Bp=p,Bp}var Up,jS;function Bj(){if(jS)return Up;jS=1;function e(t){return function(r){return r==null?void 0:r[t]}}return Up=e,Up}var Hp,TS;function rD(){if(TS)return Hp;TS=1;var e=sc();function t(r){return function(i){return e(i,r)}}return Hp=t,Hp}var Wp,RS;function sD(){if(RS)return Wp;RS=1;var e=Bj(),t=rD(),r=Py(),i=Fa();function o(a){return r(a)?e(i(a)):t(a)}return Wp=o,Wp}var Vp,AS;function Hr(){if(AS)return Vp;AS=1;var e=K4(),t=nD(),r=ai(),i=Ct(),o=sD();function a(u){return typeof u=="function"?u:u==null?r:typeof u=="object"?i(u)?t(u[0],u[1]):e(u):o(u)}return Vp=a,Vp}var Gp,IS;function Uj(){if(IS)return Gp;IS=1;var e=wj(),t=D4(),r=Hr(),i=Ct();function o(a,u){var c=i(a)?e:t;return c(a,r(u,3))}return Gp=o,Gp}var Yp,MS;function iD(){if(MS)return Yp;MS=1;var e=Object.prototype,t=e.hasOwnProperty;function r(i,o){return i!=null&&t.call(i,o)}return Yp=r,Yp}var Kp,OS;function Hj(){if(OS)return Kp;OS=1;var e=iD(),t=Fj();function r(i,o){return i!=null&&t(i,o,e)}return Kp=r,Kp}var Xp,PS;function oD(){if(PS)return Xp;PS=1;var e=Cy(),t=vo(),r=qa(),i=Ct(),o=Ur(),a=go(),u=Ju(),c=Da(),f="[object Map]",p="[object Set]",d=Object.prototype,g=d.hasOwnProperty;function y(w){if(w==null)return!0;if(o(w)&&(i(w)||typeof w=="string"||typeof w.splice=="function"||a(w)||c(w)||r(w)))return!w.length;var k=t(w);if(k==f||k==p)return!w.size;if(u(w))return!e(w).length;for(var _ in w)if(g.call(w,_))return!1;return!0}return Xp=y,Xp}var Qp,LS;function Wj(){if(LS)return Qp;LS=1;function e(t){return t===void 0}return Qp=e,Qp}var Zp,$S;function Vj(){if($S)return Zp;$S=1;var e=tc(),t=Ur();function r(i,o){var a=-1,u=t(i)?Array(i.length):[];return e(i,function(c,f,p){u[++a]=o(c,f,p)}),u}return Zp=r,Zp}var Jp,qS;function Gj(){if(qS)return Jp;qS=1;var e=nc(),t=Hr(),r=Vj(),i=Ct();function o(a,u){var c=i(a)?e:r;return c(a,t(u,3))}return Jp=o,Jp}var em,DS;function aD(){if(DS)return em;DS=1;function e(t,r,i,o){var a=-1,u=t==null?0:t.length;for(o&&u&&(i=t[++a]);++a<u;)i=r(i,t[a],a,t);return i}return em=e,em}var tm,FS;function lD(){if(FS)return tm;FS=1;function e(t,r,i,o,a){return a(t,function(u,c,f){i=o?(o=!1,u):r(i,u,c,f)}),i}return tm=e,tm}var nm,zS;function Yj(){if(zS)return nm;zS=1;var e=aD(),t=tc(),r=Hr(),i=lD(),o=Ct();function a(u,c,f){var p=o(u)?e:i,d=arguments.length<3;return p(u,r(c,4),f,d,t)}return nm=a,nm}var rm,BS;function uD(){if(BS)return rm;BS=1;var e=si(),t=Ct(),r=xr(),i="[object String]";function o(a){return typeof a=="string"||!t(a)&&r(a)&&e(a)==i}return rm=o,rm}var sm,US;function cD(){if(US)return sm;US=1;var e=Bj(),t=e("length");return sm=t,sm}var im,HS;function dD(){if(HS)return im;HS=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",o=t+r+i,a="\\ufe0e\\ufe0f",u="\\u200d",c=RegExp("["+u+e+o+a+"]");function f(p){return c.test(p)}return im=f,im}var om,WS;function fD(){if(WS)return om;WS=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",i="\\u20d0-\\u20ff",o=t+r+i,a="\\ufe0e\\ufe0f",u="["+e+"]",c="["+o+"]",f="\\ud83c[\\udffb-\\udfff]",p="(?:"+c+"|"+f+")",d="[^"+e+"]",g="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",k=p+"?",_="["+a+"]?",b="(?:"+w+"(?:"+[d,g,y].join("|")+")"+_+k+")*",S=_+k+b,E="(?:"+[d+c+"?",c,g,y,u].join("|")+")",N=RegExp(f+"(?="+f+")|"+E+S,"g");function j(A){for(var I=N.lastIndex=0;N.test(A);)++I;return I}return om=j,om}var am,VS;function hD(){if(VS)return am;VS=1;var e=cD(),t=dD(),r=fD();function i(o){return t(o)?r(o):e(o)}return am=i,am}var lm,GS;function pD(){if(GS)return lm;GS=1;var e=Cy(),t=vo(),r=Ur(),i=uD(),o=hD(),a="[object Map]",u="[object Set]";function c(f){if(f==null)return 0;if(r(f))return i(f)?o(f):f.length;var p=t(f);return p==a||p==u?f.size:e(f).length}return lm=c,lm}var um,YS;function mD(){if(YS)return um;YS=1;var e=ky(),t=Cj(),r=My(),i=Hr(),o=ec(),a=Ct(),u=go(),c=La(),f=Dn(),p=Da();function d(g,y,w){var k=a(g),_=k||u(g)||p(g);if(y=i(y,4),w==null){var b=g&&g.constructor;_?w=k?new b:[]:f(g)?w=c(b)?t(o(g)):{}:w={}}return(_?e:r)(g,function(S,E,N){return y(w,S,E,N)}),w}return um=d,um}var cm,KS;function gD(){if(KS)return cm;KS=1;var e=mo(),t=qa(),r=Ct(),i=e?e.isConcatSpreadable:void 0;function o(a){return r(a)||t(a)||!!(i&&a&&a[i])}return cm=o,cm}var dm,XS;function Ly(){if(XS)return dm;XS=1;var e=Ty(),t=gD();function r(i,o,a,u,c){var f=-1,p=i.length;for(a||(a=t),c||(c=[]);++f<p;){var d=i[f];o>0&&a(d)?o>1?r(d,o-1,a,u,c):e(c,d):u||(c[c.length]=d)}return c}return dm=r,dm}var fm,QS;function vD(){if(QS)return fm;QS=1;function e(t,r,i){switch(i.length){case 0:return t.call(r);case 1:return t.call(r,i[0]);case 2:return t.call(r,i[0],i[1]);case 3:return t.call(r,i[0],i[1],i[2])}return t.apply(r,i)}return fm=e,fm}var hm,ZS;function Kj(){if(ZS)return hm;ZS=1;var e=vD(),t=Math.max;function r(i,o,a){return o=t(o===void 0?i.length-1:o,0),function(){for(var u=arguments,c=-1,f=t(u.length-o,0),p=Array(f);++c<f;)p[c]=u[o+c];c=-1;for(var d=Array(o+1);++c<o;)d[c]=u[c];return d[o]=a(p),e(i,this,d)}}return hm=r,hm}var pm,JS;function yD(){if(JS)return pm;JS=1;var e=Ay(),t=pj(),r=ai(),i=t?function(o,a){return t(o,"toString",{configurable:!0,enumerable:!1,value:e(a),writable:!0})}:r;return pm=i,pm}var mm,ek;function wD(){if(ek)return mm;ek=1;var e=800,t=16,r=Date.now;function i(o){var a=0,u=0;return function(){var c=r(),f=t-(c-u);if(u=c,f>0){if(++a>=e)return arguments[0]}else a=0;return o.apply(void 0,arguments)}}return mm=i,mm}var gm,tk;function Xj(){if(tk)return gm;tk=1;var e=yD(),t=wD(),r=t(e);return gm=r,gm}var vm,nk;function ic(){if(nk)return vm;nk=1;var e=ai(),t=Kj(),r=Xj();function i(o,a){return r(t(o,a,e),o+"")}return vm=i,vm}var ym,rk;function Qj(){if(rk)return ym;rk=1;function e(t,r,i,o){for(var a=t.length,u=i+(o?1:-1);o?u--:++u<a;)if(r(t[u],u,t))return u;return-1}return ym=e,ym}var wm,sk;function xD(){if(sk)return wm;sk=1;function e(t){return t!==t}return wm=e,wm}var xm,ik;function _D(){if(ik)return xm;ik=1;function e(t,r,i){for(var o=i-1,a=t.length;++o<a;)if(t[o]===r)return o;return-1}return xm=e,xm}var _m,ok;function bD(){if(ok)return _m;ok=1;var e=Qj(),t=xD(),r=_D();function i(o,a,u){return a===a?r(o,a,u):e(o,t,u)}return _m=i,_m}var bm,ak;function SD(){if(ak)return bm;ak=1;var e=bD();function t(r,i){var o=r==null?0:r.length;return!!o&&e(r,i,0)>-1}return bm=t,bm}var Sm,lk;function kD(){if(lk)return Sm;lk=1;function e(t,r,i){for(var o=-1,a=t==null?0:t.length;++o<a;)if(i(r,t[o]))return!0;return!1}return Sm=e,Sm}var km,uk;function ED(){if(uk)return km;uk=1;function e(){}return km=e,km}var Em,ck;function ND(){if(ck)return Em;ck=1;var e=kj(),t=ED(),r=Oy(),i=1/0,o=e&&1/r(new e([,-0]))[1]==i?function(a){return new e(a)}:t;return Em=o,Em}var Nm,dk;function CD(){if(dk)return Nm;dk=1;var e=Mj(),t=SD(),r=kD(),i=Oj(),o=ND(),a=Oy(),u=200;function c(f,p,d){var g=-1,y=t,w=f.length,k=!0,_=[],b=_;if(d)k=!1,y=r;else if(w>=u){var S=p?null:o(f);if(S)return a(S);k=!1,y=i,b=new e}else b=p?[]:_;e:for(;++g<w;){var E=f[g],N=p?p(E):E;if(E=d||E!==0?E:0,k&&N===N){for(var j=b.length;j--;)if(b[j]===N)continue e;p&&b.push(N),_.push(E)}else y(b,N,d)||(b!==_&&b.push(N),_.push(E))}return _}return Nm=c,Nm}var Cm,fk;function Zj(){if(fk)return Cm;fk=1;var e=Ur(),t=xr();function r(i){return t(i)&&e(i)}return Cm=r,Cm}var jm,hk;function jD(){if(hk)return jm;hk=1;var e=Ly(),t=ic(),r=CD(),i=Zj(),o=t(function(a){return r(e(a,1,i,!0))});return jm=o,jm}var Tm,pk;function TD(){if(pk)return Tm;pk=1;var e=nc();function t(r,i){return e(i,function(o){return r[o]})}return Tm=t,Tm}var Rm,mk;function Jj(){if(mk)return Rm;mk=1;var e=TD(),t=xs();function r(i){return i==null?[]:e(i,t(i))}return Rm=r,Rm}var Am,gk;function Fn(){if(gk)return Am;gk=1;var e;if(typeof _y=="function")try{e={clone:L4(),constant:Ay(),each:Ij(),filter:Uj(),has:Hj(),isArray:Ct(),isEmpty:oD(),isFunction:La(),isUndefined:Wj(),keys:xs(),map:Gj(),reduce:Yj(),size:pD(),transform:mD(),union:jD(),values:Jj()}}catch{}return e||(e=window._),Am=e,Am}var Im,vk;function $y(){if(vk)return Im;vk=1;var e=Fn();Im=o;var t="\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(g){return e.isEmpty(d._in[g])})},o.prototype.sinks=function(){var d=this;return e.filter(this.nodes(),function(g){return e.isEmpty(d._out[g])})},o.prototype.setNodes=function(d,g){var y=arguments,w=this;return e.each(d,function(k){y.length>1?w.setNode(k,g):w.setNode(k)}),this},o.prototype.setNode=function(d,g){return e.has(this._nodes,d)?(arguments.length>1&&(this._nodes[d]=g),this):(this._nodes[d]=arguments.length>1?g: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 g=this;if(e.has(this._nodes,d)){var y=function(w){g.removeEdge(g._edgeObjs[w])};delete this._nodes[d],this._isCompound&&(this._removeFromParentsChildList(d),delete this._parent[d],e.each(this.children(d),function(w){g.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,g){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(g))g=r;else{g+="";for(var y=g;!e.isUndefined(y);y=this.parent(y))if(y===d)throw new Error("Setting "+g+" as parent of "+d+" would create a cycle");this.setNode(g)}return this.setNode(d),this._removeFromParentsChildList(d),this._parent[d]=g,this._children[g][d]=!0,this},o.prototype._removeFromParentsChildList=function(d){delete this._children[this._parent[d]][d]},o.prototype.parent=function(d){if(this._isCompound){var g=this._parent[d];if(g!==r)return g}},o.prototype.children=function(d){if(e.isUndefined(d)&&(d=r),this._isCompound){var g=this._children[d];if(g)return e.keys(g)}else{if(d===r)return this.nodes();if(this.hasNode(d))return[]}},o.prototype.predecessors=function(d){var g=this._preds[d];if(g)return e.keys(g)},o.prototype.successors=function(d){var g=this._sucs[d];if(g)return e.keys(g)},o.prototype.neighbors=function(d){var g=this.predecessors(d);if(g)return e.union(g,this.successors(d))},o.prototype.isLeaf=function(d){var g;return this.isDirected()?g=this.successors(d):g=this.neighbors(d),g.length===0},o.prototype.filterNodes=function(d){var g=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});g.setGraph(this.graph());var y=this;e.each(this._nodes,function(_,b){d(b)&&g.setNode(b,_)}),e.each(this._edgeObjs,function(_){g.hasNode(_.v)&&g.hasNode(_.w)&&g.setEdge(_,y.edge(_))});var w={};function k(_){var b=y.parent(_);return b===void 0||g.hasNode(b)?(w[_]=b,b):b in w?w[b]:k(b)}return this._isCompound&&e.each(g.nodes(),function(_){g.setParent(_,k(_))}),g},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,g){var y=this,w=arguments;return e.reduce(d,function(k,_){return w.length>1?y.setEdge(k,_,g):y.setEdge(k,_),_}),this},o.prototype.setEdge=function(){var d,g,y,w,k=!1,_=arguments[0];typeof _=="object"&&_!==null&&"v"in _?(d=_.v,g=_.w,y=_.name,arguments.length===2&&(w=arguments[1],k=!0)):(d=_,g=arguments[1],y=arguments[3],arguments.length>2&&(w=arguments[2],k=!0)),d=""+d,g=""+g,e.isUndefined(y)||(y=""+y);var b=c(this._isDirected,d,g,y);if(e.has(this._edgeLabels,b))return k&&(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(g),this._edgeLabels[b]=k?w:this._defaultEdgeLabelFn(d,g,y);var S=f(this._isDirected,d,g,y);return d=S.v,g=S.w,Object.freeze(S),this._edgeObjs[b]=S,a(this._preds[g],d),a(this._sucs[d],g),this._in[g][b]=S,this._out[d][b]=S,this._edgeCount++,this},o.prototype.edge=function(d,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,g,y);return this._edgeLabels[w]},o.prototype.hasEdge=function(d,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,g,y);return e.has(this._edgeLabels,w)},o.prototype.removeEdge=function(d,g,y){var w=arguments.length===1?p(this._isDirected,arguments[0]):c(this._isDirected,d,g,y),k=this._edgeObjs[w];return k&&(d=k.v,g=k.w,delete this._edgeLabels[w],delete this._edgeObjs[w],u(this._preds[g],d),u(this._sucs[d],g),delete this._in[g][w],delete this._out[d][w],this._edgeCount--),this},o.prototype.inEdges=function(d,g){var y=this._in[d];if(y){var w=e.values(y);return g?e.filter(w,function(k){return k.v===g}):w}},o.prototype.outEdges=function(d,g){var y=this._out[d];if(y){var w=e.values(y);return g?e.filter(w,function(k){return k.w===g}):w}},o.prototype.nodeEdges=function(d,g){var y=this.inEdges(d,g);if(y)return y.concat(this.outEdges(d,g))};function a(d,g){d[g]?d[g]++:d[g]=1}function u(d,g){--d[g]||delete d[g]}function c(d,g,y,w){var k=""+g,_=""+y;if(!d&&k>_){var b=k;k=_,_=b}return k+i+_+i+(e.isUndefined(w)?t:w)}function f(d,g,y,w){var k=""+g,_=""+y;if(!d&&k>_){var b=k;k=_,_=b}var S={v:k,w:_};return w&&(S.name=w),S}function p(d,g){return c(d,g.v,g.w,g.name)}return Im}var Mm,yk;function RD(){return yk||(yk=1,Mm="2.1.8"),Mm}var Om,wk;function AD(){return wk||(wk=1,Om={Graph:$y(),version:RD()}),Om}var Pm,xk;function ID(){if(xk)return Pm;xk=1;var e=Fn(),t=$y();Pm={write:r,read:a};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 f=u.node(c),p=u.parent(c),d={v:c};return e.isUndefined(f)||(d.value=f),e.isUndefined(p)||(d.parent=p),d})}function o(u){return e.map(u.edges(),function(c){var f=u.edge(c),p={v:c.v,w:c.w};return e.isUndefined(c.name)||(p.name=c.name),e.isUndefined(f)||(p.value=f),p})}function a(u){var c=new t(u.options).setGraph(u.value);return e.each(u.nodes,function(f){c.setNode(f.v,f.value),f.parent&&c.setParent(f.v,f.parent)}),e.each(u.edges,function(f){c.setEdge({v:f.v,w:f.w,name:f.name},f.value)}),c}return Pm}var Lm,_k;function MD(){if(_k)return Lm;_k=1;var e=Fn();Lm=t;function t(r){var i={},o=[],a;function u(c){e.has(i,c)||(i[c]=!0,a.push(c),e.each(r.successors(c),u),e.each(r.predecessors(c),u))}return e.each(r.nodes(),function(c){a=[],u(c),a.length&&o.push(a)}),o}return Lm}var $m,bk;function eT(){if(bk)return $m;bk=1;var e=Fn();$m=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(r){return r.key})},t.prototype.has=function(r){return e.has(this._keyIndices,r)},t.prototype.priority=function(r){var i=this._keyIndices[r];if(i!==void 0)return this._arr[i].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(r,i){var o=this._keyIndices;if(r=String(r),!e.has(o,r)){var a=this._arr,u=a.length;return o[r]=u,a.push({key:r,priority:i}),this._decrease(u),!0}return!1},t.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},t.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)},t.prototype._heapify=function(r){var i=this._arr,o=2*r,a=o+1,u=r;o<i.length&&(u=i[o].priority<i[u].priority?o:u,a<i.length&&(u=i[a].priority<i[u].priority?a:u),u!==r&&(this._swap(r,u),this._heapify(u)))},t.prototype._decrease=function(r){for(var i=this._arr,o=i[r].priority,a;r!==0&&(a=r>>1,!(i[a].priority<o));)this._swap(r,a),r=a},t.prototype._swap=function(r,i){var o=this._arr,a=this._keyIndices,u=o[r],c=o[i];o[r]=c,o[i]=u,a[c.key]=r,a[u.key]=i},$m}var qm,Sk;function tT(){if(Sk)return qm;Sk=1;var e=Fn(),t=eT();qm=i;var r=e.constant(1);function i(a,u,c,f){return o(a,String(u),c||r,f||function(p){return a.outEdges(p)})}function o(a,u,c,f){var p={},d=new t,g,y,w=function(k){var _=k.v!==g?k.v:k.w,b=p[_],S=c(k),E=y.distance+S;if(S<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+k+" Weight: "+S);E<b.distance&&(b.distance=E,b.predecessor=g,d.decrease(_,E))};for(a.nodes().forEach(function(k){var _=k===u?0:Number.POSITIVE_INFINITY;p[k]={distance:_},d.add(k,_)});d.size()>0&&(g=d.removeMin(),y=p[g],y.distance!==Number.POSITIVE_INFINITY);)f(g).forEach(w);return p}return qm}var Dm,kk;function OD(){if(kk)return Dm;kk=1;var e=tT(),t=Fn();Dm=r;function r(i,o,a){return t.transform(i.nodes(),function(u,c){u[c]=e(i,c,o,a)},{})}return Dm}var Fm,Ek;function nT(){if(Ek)return Fm;Ek=1;var e=Fn();Fm=t;function t(r){var i=0,o=[],a={},u=[];function c(f){var p=a[f]={onStack:!0,lowlink:i,index:i++};if(o.push(f),r.successors(f).forEach(function(y){e.has(a,y)?a[y].onStack&&(p.lowlink=Math.min(p.lowlink,a[y].index)):(c(y),p.lowlink=Math.min(p.lowlink,a[y].lowlink))}),p.lowlink===p.index){var d=[],g;do g=o.pop(),a[g].onStack=!1,d.push(g);while(f!==g);u.push(d)}}return r.nodes().forEach(function(f){e.has(a,f)||c(f)}),u}return Fm}var zm,Nk;function PD(){if(Nk)return zm;Nk=1;var e=Fn(),t=nT();zm=r;function r(i){return e.filter(t(i),function(o){return o.length>1||o.length===1&&i.hasEdge(o[0],o[0])})}return zm}var Bm,Ck;function LD(){if(Ck)return Bm;Ck=1;var e=Fn();Bm=r;var t=e.constant(1);function r(o,a,u){return i(o,a||t,u||function(c){return o.outEdges(c)})}function i(o,a,u){var c={},f=o.nodes();return f.forEach(function(p){c[p]={},c[p][p]={distance:0},f.forEach(function(d){p!==d&&(c[p][d]={distance:Number.POSITIVE_INFINITY})}),u(p).forEach(function(d){var g=d.v===p?d.w:d.v,y=a(d);c[p][g]={distance:y,predecessor:p}})}),f.forEach(function(p){var d=c[p];f.forEach(function(g){var y=c[g];f.forEach(function(w){var k=y[p],_=d[w],b=y[w],S=k.distance+_.distance;S<b.distance&&(b.distance=S,b.predecessor=_.predecessor)})})}),c}return Bm}var Um,jk;function rT(){if(jk)return Um;jk=1;var e=Fn();Um=t,t.CycleException=r;function t(i){var o={},a={},u=[];function c(f){if(e.has(a,f))throw new r;e.has(o,f)||(a[f]=!0,o[f]=!0,e.each(i.predecessors(f),c),delete a[f],u.push(f))}if(e.each(i.sinks(),c),e.size(o)!==i.nodeCount())throw new r;return u}function r(){}return r.prototype=new Error,Um}var Hm,Tk;function $D(){if(Tk)return Hm;Tk=1;var e=rT();Hm=t;function t(r){try{e(r)}catch(i){if(i instanceof e.CycleException)return!1;throw i}return!0}return Hm}var Wm,Rk;function sT(){if(Rk)return Wm;Rk=1;var e=Fn();Wm=t;function t(i,o,a){e.isArray(o)||(o=[o]);var u=(i.isDirected()?i.successors:i.neighbors).bind(i),c=[],f={};return e.each(o,function(p){if(!i.hasNode(p))throw new Error("Graph does not have node: "+p);r(i,p,a==="post",f,u,c)}),c}function r(i,o,a,u,c,f){e.has(u,o)||(u[o]=!0,a||f.push(o),e.each(c(o),function(p){r(i,p,a,u,c,f)}),a&&f.push(o))}return Wm}var Vm,Ak;function qD(){if(Ak)return Vm;Ak=1;var e=sT();Vm=t;function t(r,i){return e(r,i,"post")}return Vm}var Gm,Ik;function DD(){if(Ik)return Gm;Ik=1;var e=sT();Gm=t;function t(r,i){return e(r,i,"pre")}return Gm}var Ym,Mk;function FD(){if(Mk)return Ym;Mk=1;var e=Fn(),t=$y(),r=eT();Ym=i;function i(o,a){var u=new t,c={},f=new r,p;function d(y){var w=y.v===p?y.w:y.v,k=f.priority(w);if(k!==void 0){var _=a(y);_<k&&(c[w]=p,f.decrease(w,_))}}if(o.nodeCount()===0)return u;e.each(o.nodes(),function(y){f.add(y,Number.POSITIVE_INFINITY),u.setNode(y)}),f.decrease(o.nodes()[0],0);for(var g=!1;f.size()>0;){if(p=f.removeMin(),e.has(c,p))u.setEdge(p,c[p]);else{if(g)throw new Error("Input graph is not connected: "+o);g=!0}o.nodeEdges(p).forEach(d)}return u}return Ym}var Km,Ok;function zD(){return Ok||(Ok=1,Km={components:MD(),dijkstra:tT(),dijkstraAll:OD(),findCycles:PD(),floydWarshall:LD(),isAcyclic:$D(),postorder:qD(),preorder:DD(),prim:FD(),tarjan:nT(),topsort:rT()}),Km}var Xm,Pk;function BD(){if(Pk)return Xm;Pk=1;var e=AD();return Xm={Graph:e.Graph,json:ID(),alg:zD(),version:e.version},Xm}var Qm,Lk;function rr(){if(Lk)return Qm;Lk=1;var e;if(typeof _y=="function")try{e=BD()}catch{}return e||(e=window.graphlib),Qm=e,Qm}var Zm,$k;function UD(){if($k)return Zm;$k=1;var e=Tj(),t=1,r=4;function i(o){return e(o,t|r)}return Zm=i,Zm}var Jm,qk;function oc(){if(qk)return Jm;qk=1;var e=po(),t=Ur(),r=Qu(),i=Dn();function o(a,u,c){if(!i(c))return!1;var f=typeof u;return(f=="number"?t(c)&&r(u,c.length):f=="string"&&u in c)?e(c[u],a):!1}return Jm=o,Jm}var eg,Dk;function HD(){if(Dk)return eg;Dk=1;var e=ic(),t=po(),r=oc(),i=oi(),o=Object.prototype,a=o.hasOwnProperty,u=e(function(c,f){c=Object(c);var p=-1,d=f.length,g=d>2?f[2]:void 0;for(g&&r(f[0],f[1],g)&&(d=1);++p<d;)for(var y=f[p],w=i(y),k=-1,_=w.length;++k<_;){var b=w[k],S=c[b];(S===void 0||t(S,o[b])&&!a.call(c,b))&&(c[b]=y[b])}return c});return eg=u,eg}var tg,Fk;function WD(){if(Fk)return tg;Fk=1;var e=Hr(),t=Ur(),r=xs();function i(o){return function(a,u,c){var f=Object(a);if(!t(a)){var p=e(u,3);a=r(a),u=function(g){return p(f[g],g,f)}}var d=o(a,u,c);return d>-1?f[p?a[d]:d]:void 0}}return tg=i,tg}var ng,zk;function VD(){if(zk)return ng;zk=1;var e=/\s/;function t(r){for(var i=r.length;i--&&e.test(r.charAt(i)););return i}return ng=t,ng}var rg,Bk;function GD(){if(Bk)return rg;Bk=1;var e=VD(),t=/^\s+/;function r(i){return i&&i.slice(0,e(i)+1).replace(t,"")}return rg=r,rg}var sg,Uk;function YD(){if(Uk)return sg;Uk=1;var e=GD(),t=Dn(),r=yo(),i=NaN,o=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt;function f(p){if(typeof p=="number")return p;if(r(p))return i;if(t(p)){var d=typeof p.valueOf=="function"?p.valueOf():p;p=t(d)?d+"":d}if(typeof p!="string")return p===0?p:+p;p=e(p);var g=a.test(p);return g||u.test(p)?c(p.slice(2),g?2:8):o.test(p)?i:+p}return sg=f,sg}var ig,Hk;function iT(){if(Hk)return ig;Hk=1;var e=YD(),t=1/0,r=17976931348623157e292;function i(o){if(!o)return o===0?o:0;if(o=e(o),o===t||o===-t){var a=o<0?-1:1;return a*r}return o===o?o:0}return ig=i,ig}var og,Wk;function KD(){if(Wk)return og;Wk=1;var e=iT();function t(r){var i=e(r),o=i%1;return i===i?o?i-o:i:0}return og=t,og}var ag,Vk;function XD(){if(Vk)return ag;Vk=1;var e=Qj(),t=Hr(),r=KD(),i=Math.max;function o(a,u,c){var f=a==null?0:a.length;if(!f)return-1;var p=c==null?0:r(c);return p<0&&(p=i(f+p,0)),e(a,t(u,3),p)}return ag=o,ag}var lg,Gk;function QD(){if(Gk)return lg;Gk=1;var e=WD(),t=XD(),r=e(t);return lg=r,lg}var ug,Yk;function oT(){if(Yk)return ug;Yk=1;var e=Ly();function t(r){var i=r==null?0:r.length;return i?e(r,1):[]}return ug=t,ug}var cg,Kk;function ZD(){if(Kk)return cg;Kk=1;var e=Iy(),t=Rj(),r=oi();function i(o,a){return o==null?o:e(o,t(a),r)}return cg=i,cg}var dg,Xk;function JD(){if(Xk)return dg;Xk=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return dg=e,dg}var fg,Qk;function e5(){if(Qk)return fg;Qk=1;var e=Ku(),t=My(),r=Hr();function i(o,a){var u={};return a=r(a,3),t(o,function(c,f,p){e(u,f,a(c,f,p))}),u}return fg=i,fg}var hg,Zk;function qy(){if(Zk)return hg;Zk=1;var e=yo();function t(r,i,o){for(var a=-1,u=r.length;++a<u;){var c=r[a],f=i(c);if(f!=null&&(p===void 0?f===f&&!e(f):o(f,p)))var p=f,d=c}return d}return hg=t,hg}var pg,Jk;function t5(){if(Jk)return pg;Jk=1;function e(t,r){return t>r}return pg=e,pg}var mg,eE;function n5(){if(eE)return mg;eE=1;var e=qy(),t=t5(),r=ai();function i(o){return o&&o.length?e(o,r,t):void 0}return mg=i,mg}var gg,tE;function aT(){if(tE)return gg;tE=1;var e=Ku(),t=po();function r(i,o,a){(a!==void 0&&!t(i[o],a)||a===void 0&&!(o in i))&&e(i,o,a)}return gg=r,gg}var vg,nE;function r5(){if(nE)return vg;nE=1;var e=si(),t=ec(),r=xr(),i="[object Object]",o=Function.prototype,a=Object.prototype,u=o.toString,c=a.hasOwnProperty,f=u.call(Object);function p(d){if(!r(d)||e(d)!=i)return!1;var g=t(d);if(g===null)return!0;var y=c.call(g,"constructor")&&g.constructor;return typeof y=="function"&&y instanceof y&&u.call(y)==f}return vg=p,vg}var yg,rE;function lT(){if(rE)return yg;rE=1;function e(t,r){if(!(r==="constructor"&&typeof t[r]=="function")&&r!="__proto__")return t[r]}return yg=e,yg}var wg,sE;function s5(){if(sE)return wg;sE=1;var e=$a(),t=oi();function r(i){return e(i,t(i))}return wg=r,wg}var xg,iE;function i5(){if(iE)return xg;iE=1;var e=aT(),t=vj(),r=Nj(),i=yj(),o=jj(),a=qa(),u=Ct(),c=Zj(),f=go(),p=La(),d=Dn(),g=r5(),y=Da(),w=lT(),k=s5();function _(b,S,E,N,j,A,I){var L=w(b,E),P=w(S,E),D=I.get(P);if(D){e(b,E,D);return}var M=A?A(L,P,E+"",b,S,I):void 0,q=M===void 0;if(q){var W=u(P),K=!W&&f(P),C=!W&&!K&&y(P);M=P,W||K||C?u(L)?M=L:c(L)?M=i(L):K?(q=!1,M=t(P,!0)):C?(q=!1,M=r(P,!0)):M=[]:g(P)||a(P)?(M=L,a(L)?M=k(L):(!d(L)||p(L))&&(M=o(P))):q=!1}q&&(I.set(P,M),j(M,P,N,A,I),I.delete(P)),e(b,E,M)}return xg=_,xg}var _g,oE;function o5(){if(oE)return _g;oE=1;var e=Yu(),t=aT(),r=Iy(),i=i5(),o=Dn(),a=oi(),u=lT();function c(f,p,d,g,y){f!==p&&r(p,function(w,k){if(y||(y=new e),o(w))i(f,p,k,d,c,g,y);else{var _=g?g(u(f,k),w,k+"",f,p,y):void 0;_===void 0&&(_=w),t(f,k,_)}},a)}return _g=c,_g}var bg,aE;function a5(){if(aE)return bg;aE=1;var e=ic(),t=oc();function r(i){return e(function(o,a){var u=-1,c=a.length,f=c>1?a[c-1]:void 0,p=c>2?a[2]:void 0;for(f=i.length>3&&typeof f=="function"?(c--,f):void 0,p&&t(a[0],a[1],p)&&(f=c<3?void 0:f,c=1),o=Object(o);++u<c;){var d=a[u];d&&i(o,d,u,f)}return o})}return bg=r,bg}var Sg,lE;function l5(){if(lE)return Sg;lE=1;var e=o5(),t=a5(),r=t(function(i,o,a){e(i,o,a)});return Sg=r,Sg}var kg,uE;function uT(){if(uE)return kg;uE=1;function e(t,r){return t<r}return kg=e,kg}var Eg,cE;function u5(){if(cE)return Eg;cE=1;var e=qy(),t=uT(),r=ai();function i(o){return o&&o.length?e(o,r,t):void 0}return Eg=i,Eg}var Ng,dE;function c5(){if(dE)return Ng;dE=1;var e=qy(),t=Hr(),r=uT();function i(o,a){return o&&o.length?e(o,t(a,2),r):void 0}return Ng=i,Ng}var Cg,fE;function d5(){if(fE)return Cg;fE=1;var e=ir(),t=function(){return e.Date.now()};return Cg=t,Cg}var jg,hE;function f5(){if(hE)return jg;hE=1;var e=Xu(),t=rc(),r=Qu(),i=Dn(),o=Fa();function a(u,c,f,p){if(!i(u))return u;c=t(c,u);for(var d=-1,g=c.length,y=g-1,w=u;w!=null&&++d<g;){var k=o(c[d]),_=f;if(k==="__proto__"||k==="constructor"||k==="prototype")return u;if(d!=y){var b=w[k];_=p?p(b,k,w):void 0,_===void 0&&(_=i(b)?b:r(c[d+1])?[]:{})}e(w,k,_),w=w[k]}return u}return jg=a,jg}var Tg,pE;function h5(){if(pE)return Tg;pE=1;var e=sc(),t=f5(),r=rc();function i(o,a,u){for(var c=-1,f=a.length,p={};++c<f;){var d=a[c],g=e(o,d);u(g,d)&&t(p,r(d,o),g)}return p}return Tg=i,Tg}var Rg,mE;function p5(){if(mE)return Rg;mE=1;var e=h5(),t=zj();function r(i,o){return e(i,o,function(a,u){return t(i,u)})}return Rg=r,Rg}var Ag,gE;function m5(){if(gE)return Ag;gE=1;var e=oT(),t=Kj(),r=Xj();function i(o){return r(t(o,void 0,e),o+"")}return Ag=i,Ag}var Ig,vE;function g5(){if(vE)return Ig;vE=1;var e=p5(),t=m5(),r=t(function(i,o){return i==null?{}:e(i,o)});return Ig=r,Ig}var Mg,yE;function v5(){if(yE)return Mg;yE=1;var e=Math.ceil,t=Math.max;function r(i,o,a,u){for(var c=-1,f=t(e((o-i)/(a||1)),0),p=Array(f);f--;)p[u?f:++c]=i,i+=a;return p}return Mg=r,Mg}var Og,wE;function y5(){if(wE)return Og;wE=1;var e=v5(),t=oc(),r=iT();function i(o){return function(a,u,c){return c&&typeof c!="number"&&t(a,u,c)&&(u=c=void 0),a=r(a),u===void 0?(u=a,a=0):u=r(u),c=c===void 0?a<u?1:-1:r(c),e(a,u,c,o)}}return Og=i,Og}var Pg,xE;function w5(){if(xE)return Pg;xE=1;var e=y5(),t=e();return Pg=t,Pg}var Lg,_E;function x5(){if(_E)return Lg;_E=1;function e(t,r){var i=t.length;for(t.sort(r);i--;)t[i]=t[i].value;return t}return Lg=e,Lg}var $g,bE;function _5(){if(bE)return $g;bE=1;var e=yo();function t(r,i){if(r!==i){var o=r!==void 0,a=r===null,u=r===r,c=e(r),f=i!==void 0,p=i===null,d=i===i,g=e(i);if(!p&&!g&&!c&&r>i||c&&f&&d&&!p&&!g||a&&f&&d||!o&&d||!u)return 1;if(!a&&!c&&!g&&r<i||g&&o&&u&&!a&&!c||p&&o&&u||!f&&u||!d)return-1}return 0}return $g=t,$g}var qg,SE;function b5(){if(SE)return qg;SE=1;var e=_5();function t(r,i,o){for(var a=-1,u=r.criteria,c=i.criteria,f=u.length,p=o.length;++a<f;){var d=e(u[a],c[a]);if(d){if(a>=p)return d;var g=o[a];return d*(g=="desc"?-1:1)}}return r.index-i.index}return qg=t,qg}var Dg,kE;function S5(){if(kE)return Dg;kE=1;var e=nc(),t=sc(),r=Hr(),i=Vj(),o=x5(),a=Zu(),u=b5(),c=ai(),f=Ct();function p(d,g,y){g.length?g=e(g,function(_){return f(_)?function(b){return t(b,_.length===1?_[0]:_)}:_}):g=[c];var w=-1;g=e(g,a(r));var k=i(d,function(_,b,S){var E=e(g,function(N){return N(_)});return{criteria:E,index:++w,value:_}});return o(k,function(_,b){return u(_,b,y)})}return Dg=p,Dg}var Fg,EE;function k5(){if(EE)return Fg;EE=1;var e=Ly(),t=S5(),r=ic(),i=oc(),o=r(function(a,u){if(a==null)return[];var c=u.length;return c>1&&i(a,u[0],u[1])?u=[]:c>2&&i(u[0],u[1],u[2])&&(u=[u[0]]),t(a,e(u,1),[])});return Fg=o,Fg}var zg,NE;function E5(){if(NE)return zg;NE=1;var e=Dj(),t=0;function r(i){var o=++t;return e(i)+o}return zg=r,zg}var Bg,CE;function N5(){if(CE)return Bg;CE=1;function e(t,r,i){for(var o=-1,a=t.length,u=r.length,c={};++o<a;){var f=o<u?r[o]:void 0;i(c,t[o],f)}return c}return Bg=e,Bg}var Ug,jE;function C5(){if(jE)return Ug;jE=1;var e=Xu(),t=N5();function r(i,o){return t(i||[],o||[],e)}return Ug=r,Ug}var Hg,TE;function yt(){if(TE)return Hg;TE=1;var e;if(typeof _y=="function")try{e={cloneDeep:UD(),constant:Ay(),defaults:HD(),each:Ij(),filter:Uj(),find:QD(),flatten:oT(),forEach:Aj(),forIn:ZD(),has:Hj(),isUndefined:Wj(),last:JD(),map:Gj(),mapValues:e5(),max:n5(),merge:l5(),min:u5(),minBy:c5(),now:d5(),pick:g5(),range:w5(),reduce:Yj(),sortBy:k5(),uniqueId:E5(),values:Jj(),zipObject:C5()}}catch{}return e||(e=window._),Hg=e,Hg}var Wg,RE;function j5(){if(RE)return Wg;RE=1,Wg=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 t(o),o},e.prototype.enqueue=function(i){var o=this._sentinel;i._prev&&i._next&&t(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,a=o._prev;a!==o;)i.push(JSON.stringify(a,r)),a=a._prev;return"["+i.join(", ")+"]"};function t(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 Wg}var Vg,AE;function T5(){if(AE)return Vg;AE=1;var e=yt(),t=rr().Graph,r=j5();Vg=o;var i=e.constant(1);function o(p,d){if(p.nodeCount()<=1)return[];var g=c(p,d||i),y=a(g.graph,g.buckets,g.zeroIdx);return e.flatten(e.map(y,function(w){return p.outEdges(w.v,w.w)}),!0)}function a(p,d,g){for(var y=[],w=d[d.length-1],k=d[0],_;p.nodeCount();){for(;_=k.dequeue();)u(p,d,g,_);for(;_=w.dequeue();)u(p,d,g,_);if(p.nodeCount()){for(var b=d.length-2;b>0;--b)if(_=d[b].dequeue(),_){y=y.concat(u(p,d,g,_,!0));break}}}return y}function u(p,d,g,y,w){var k=w?[]:void 0;return e.forEach(p.inEdges(y.v),function(_){var b=p.edge(_),S=p.node(_.v);w&&k.push({v:_.v,w:_.w}),S.out-=b,f(d,g,S)}),e.forEach(p.outEdges(y.v),function(_){var b=p.edge(_),S=_.w,E=p.node(S);E.in-=b,f(d,g,E)}),p.removeNode(y.v),k}function c(p,d){var g=new t,y=0,w=0;e.forEach(p.nodes(),function(b){g.setNode(b,{v:b,in:0,out:0})}),e.forEach(p.edges(),function(b){var S=g.edge(b.v,b.w)||0,E=d(b),N=S+E;g.setEdge(b.v,b.w,N),w=Math.max(w,g.node(b.v).out+=E),y=Math.max(y,g.node(b.w).in+=E)});var k=e.range(w+y+3).map(function(){return new r}),_=y+1;return e.forEach(g.nodes(),function(b){f(k,_,g.node(b))}),{graph:g,buckets:k,zeroIdx:_}}function f(p,d,g){g.out?g.in?p[g.out-g.in+d].enqueue(g):p[p.length-1].enqueue(g):p[0].enqueue(g)}return Vg}var Gg,IE;function R5(){if(IE)return Gg;IE=1;var e=yt(),t=T5();Gg={run:r,undo:o};function r(a){var u=a.graph().acyclicer==="greedy"?t(a,c(a)):i(a);e.forEach(u,function(f){var p=a.edge(f);a.removeEdge(f),p.forwardName=f.name,p.reversed=!0,a.setEdge(f.w,f.v,p,e.uniqueId("rev"))});function c(f){return function(p){return f.edge(p).weight}}}function i(a){var u=[],c={},f={};function p(d){e.has(f,d)||(f[d]=!0,c[d]=!0,e.forEach(a.outEdges(d),function(g){e.has(c,g.w)?u.push(g):p(g.w)}),delete c[d])}return e.forEach(a.nodes(),p),u}function o(a){e.forEach(a.edges(),function(u){var c=a.edge(u);if(c.reversed){a.removeEdge(u);var f=c.forwardName;delete c.reversed,delete c.forwardName,a.setEdge(u.w,u.v,c,f)}})}return Gg}var Yg,ME;function pn(){if(ME)return Yg;ME=1;var e=yt(),t=rr().Graph;Yg={addDummyNode:r,simplify:i,asNonCompoundGraph:o,successorWeights:a,predecessorWeights:u,intersectRect:c,buildLayerMatrix:f,normalizeRanks:p,removeEmptyRanks:d,addBorderNode:g,maxRank:y,partition:w,time:k,notime:_};function r(b,S,E,N){var j;do j=e.uniqueId(N);while(b.hasNode(j));return E.dummy=S,b.setNode(j,E),j}function i(b){var S=new t().setGraph(b.graph());return e.forEach(b.nodes(),function(E){S.setNode(E,b.node(E))}),e.forEach(b.edges(),function(E){var N=S.edge(E.v,E.w)||{weight:0,minlen:1},j=b.edge(E);S.setEdge(E.v,E.w,{weight:N.weight+j.weight,minlen:Math.max(N.minlen,j.minlen)})}),S}function o(b){var S=new t({multigraph:b.isMultigraph()}).setGraph(b.graph());return e.forEach(b.nodes(),function(E){b.children(E).length||S.setNode(E,b.node(E))}),e.forEach(b.edges(),function(E){S.setEdge(E,b.edge(E))}),S}function a(b){var S=e.map(b.nodes(),function(E){var N={};return e.forEach(b.outEdges(E),function(j){N[j.w]=(N[j.w]||0)+b.edge(j).weight}),N});return e.zipObject(b.nodes(),S)}function u(b){var S=e.map(b.nodes(),function(E){var N={};return e.forEach(b.inEdges(E),function(j){N[j.v]=(N[j.v]||0)+b.edge(j).weight}),N});return e.zipObject(b.nodes(),S)}function c(b,S){var E=b.x,N=b.y,j=S.x-E,A=S.y-N,I=b.width/2,L=b.height/2;if(!j&&!A)throw new Error("Not possible to find intersection inside of the rectangle");var P,D;return Math.abs(A)*I>Math.abs(j)*L?(A<0&&(L=-L),P=L*j/A,D=L):(j<0&&(I=-I),P=I,D=I*A/j),{x:E+P,y:N+D}}function f(b){var S=e.map(e.range(y(b)+1),function(){return[]});return e.forEach(b.nodes(),function(E){var N=b.node(E),j=N.rank;e.isUndefined(j)||(S[j][N.order]=E)}),S}function p(b){var S=e.min(e.map(b.nodes(),function(E){return b.node(E).rank}));e.forEach(b.nodes(),function(E){var N=b.node(E);e.has(N,"rank")&&(N.rank-=S)})}function d(b){var S=e.min(e.map(b.nodes(),function(A){return b.node(A).rank})),E=[];e.forEach(b.nodes(),function(A){var I=b.node(A).rank-S;E[I]||(E[I]=[]),E[I].push(A)});var N=0,j=b.graph().nodeRankFactor;e.forEach(E,function(A,I){e.isUndefined(A)&&I%j!==0?--N:N&&e.forEach(A,function(L){b.node(L).rank+=N})})}function g(b,S,E,N){var j={width:0,height:0};return arguments.length>=4&&(j.rank=E,j.order=N),r(b,"border",j,S)}function y(b){return e.max(e.map(b.nodes(),function(S){var E=b.node(S).rank;if(!e.isUndefined(E))return E}))}function w(b,S){var E={lhs:[],rhs:[]};return e.forEach(b,function(N){S(N)?E.lhs.push(N):E.rhs.push(N)}),E}function k(b,S){var E=e.now();try{return S()}finally{console.log(b+" time: "+(e.now()-E)+"ms")}}function _(b,S){return S()}return Yg}var Kg,OE;function A5(){if(OE)return Kg;OE=1;var e=yt(),t=pn();Kg={run:r,undo:o};function r(a){a.graph().dummyChains=[],e.forEach(a.edges(),function(u){i(a,u)})}function i(a,u){var c=u.v,f=a.node(c).rank,p=u.w,d=a.node(p).rank,g=u.name,y=a.edge(u),w=y.labelRank;if(d!==f+1){a.removeEdge(u);var k,_,b;for(b=0,++f;f<d;++b,++f)y.points=[],_={width:0,height:0,edgeLabel:y,edgeObj:u,rank:f},k=t.addDummyNode(a,"edge",_,"_d"),f===w&&(_.width=y.width,_.height=y.height,_.dummy="edge-label",_.labelpos=y.labelpos),a.setEdge(c,k,{weight:y.weight},g),b===0&&a.graph().dummyChains.push(k),c=k;a.setEdge(c,p,{weight:y.weight},g)}}function o(a){e.forEach(a.graph().dummyChains,function(u){var c=a.node(u),f=c.edgeLabel,p;for(a.setEdge(c.edgeObj,f);c.dummy;)p=a.successors(u)[0],a.removeNode(u),f.points.push({x:c.x,y:c.y}),c.dummy==="edge-label"&&(f.x=c.x,f.y=c.y,f.width=c.width,f.height=c.height),u=p,c=a.node(u)})}return Kg}var Xg,PE;function Mu(){if(PE)return Xg;PE=1;var e=yt();Xg={longestPath:t,slack:r};function t(i){var o={};function a(u){var c=i.node(u);if(e.has(o,u))return c.rank;o[u]=!0;var f=e.min(e.map(i.outEdges(u),function(p){return a(p.w)-i.edge(p).minlen}));return(f===Number.POSITIVE_INFINITY||f===void 0||f===null)&&(f=0),c.rank=f}e.forEach(i.sources(),a)}function r(i,o){return i.node(o.w).rank-i.node(o.v).rank-i.edge(o).minlen}return Xg}var Qg,LE;function cT(){if(LE)return Qg;LE=1;var e=yt(),t=rr().Graph,r=Mu().slack;Qg=i;function i(c){var f=new t({directed:!1}),p=c.nodes()[0],d=c.nodeCount();f.setNode(p,{});for(var g,y;o(f,c)<d;)g=a(f,c),y=f.hasNode(g.v)?r(c,g):-r(c,g),u(f,c,y);return f}function o(c,f){function p(d){e.forEach(f.nodeEdges(d),function(g){var y=g.v,w=d===y?g.w:y;!c.hasNode(w)&&!r(f,g)&&(c.setNode(w,{}),c.setEdge(d,w,{}),p(w))})}return e.forEach(c.nodes(),p),c.nodeCount()}function a(c,f){return e.minBy(f.edges(),function(p){if(c.hasNode(p.v)!==c.hasNode(p.w))return r(f,p)})}function u(c,f,p){e.forEach(c.nodes(),function(d){f.node(d).rank+=p})}return Qg}var Zg,$E;function I5(){if($E)return Zg;$E=1;var e=yt(),t=cT(),r=Mu().slack,i=Mu().longestPath,o=rr().alg.preorder,a=rr().alg.postorder,u=pn().simplify;Zg=c,c.initLowLimValues=g,c.initCutValues=f,c.calcCutValue=d,c.leaveEdge=w,c.enterEdge=k,c.exchangeEdges=_;function c(N){N=u(N),i(N);var j=t(N);g(j),f(j,N);for(var A,I;A=w(j);)I=k(j,N,A),_(j,N,A,I)}function f(N,j){var A=a(N,N.nodes());A=A.slice(0,A.length-1),e.forEach(A,function(I){p(N,j,I)})}function p(N,j,A){var I=N.node(A),L=I.parent;N.edge(A,L).cutvalue=d(N,j,A)}function d(N,j,A){var I=N.node(A),L=I.parent,P=!0,D=j.edge(A,L),M=0;return D||(P=!1,D=j.edge(L,A)),M=D.weight,e.forEach(j.nodeEdges(A),function(q){var W=q.v===A,K=W?q.w:q.v;if(K!==L){var C=W===P,z=j.edge(q).weight;if(M+=C?z:-z,S(N,A,K)){var F=N.edge(A,K).cutvalue;M+=C?-F:F}}}),M}function g(N,j){arguments.length<2&&(j=N.nodes()[0]),y(N,{},1,j)}function y(N,j,A,I,L){var P=A,D=N.node(I);return j[I]=!0,e.forEach(N.neighbors(I),function(M){e.has(j,M)||(A=y(N,j,A,M,I))}),D.low=P,D.lim=A++,L?D.parent=L:delete D.parent,A}function w(N){return e.find(N.edges(),function(j){return N.edge(j).cutvalue<0})}function k(N,j,A){var I=A.v,L=A.w;j.hasEdge(I,L)||(I=A.w,L=A.v);var P=N.node(I),D=N.node(L),M=P,q=!1;P.lim>D.lim&&(M=D,q=!0);var W=e.filter(j.edges(),function(K){return q===E(N,N.node(K.v),M)&&q!==E(N,N.node(K.w),M)});return e.minBy(W,function(K){return r(j,K)})}function _(N,j,A,I){var L=A.v,P=A.w;N.removeEdge(L,P),N.setEdge(I.v,I.w,{}),g(N),f(N,j),b(N,j)}function b(N,j){var A=e.find(N.nodes(),function(L){return!j.node(L).parent}),I=o(N,A);I=I.slice(1),e.forEach(I,function(L){var P=N.node(L).parent,D=j.edge(L,P),M=!1;D||(D=j.edge(P,L),M=!0),j.node(L).rank=j.node(P).rank+(M?D.minlen:-D.minlen)})}function S(N,j,A){return N.hasEdge(j,A)}function E(N,j,A){return A.low<=j.lim&&j.lim<=A.lim}return Zg}var Jg,qE;function M5(){if(qE)return Jg;qE=1;var e=Mu(),t=e.longestPath,r=cT(),i=I5();Jg=o;function o(f){switch(f.graph().ranker){case"network-simplex":c(f);break;case"tight-tree":u(f);break;case"longest-path":a(f);break;default:c(f)}}var a=t;function u(f){t(f),r(f)}function c(f){i(f)}return Jg}var ev,DE;function O5(){if(DE)return ev;DE=1;var e=yt();ev=t;function t(o){var a=i(o);e.forEach(o.graph().dummyChains,function(u){for(var c=o.node(u),f=c.edgeObj,p=r(o,a,f.v,f.w),d=p.path,g=p.lca,y=0,w=d[y],k=!0;u!==f.w;){if(c=o.node(u),k){for(;(w=d[y])!==g&&o.node(w).maxRank<c.rank;)y++;w===g&&(k=!1)}if(!k){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,a,u,c){var f=[],p=[],d=Math.min(a[u].low,a[c].low),g=Math.max(a[u].lim,a[c].lim),y,w;y=u;do y=o.parent(y),f.push(y);while(y&&(a[y].low>d||g>a[y].lim));for(w=y,y=c;(y=o.parent(y))!==w;)p.push(y);return{path:f.concat(p.reverse()),lca:w}}function i(o){var a={},u=0;function c(f){var p=u;e.forEach(o.children(f),c),a[f]={low:p,lim:u++}}return e.forEach(o.children(),c),a}return ev}var tv,FE;function P5(){if(FE)return tv;FE=1;var e=yt(),t=pn();tv={run:r,cleanup:u};function r(c){var f=t.addDummyNode(c,"root",{},"_root"),p=o(c),d=e.max(e.values(p))-1,g=2*d+1;c.graph().nestingRoot=f,e.forEach(c.edges(),function(w){c.edge(w).minlen*=g});var y=a(c)+1;e.forEach(c.children(),function(w){i(c,f,g,y,d,p,w)}),c.graph().nodeRankFactor=g}function i(c,f,p,d,g,y,w){var k=c.children(w);if(!k.length){w!==f&&c.setEdge(f,w,{weight:0,minlen:p});return}var _=t.addBorderNode(c,"_bt"),b=t.addBorderNode(c,"_bb"),S=c.node(w);c.setParent(_,w),S.borderTop=_,c.setParent(b,w),S.borderBottom=b,e.forEach(k,function(E){i(c,f,p,d,g,y,E);var N=c.node(E),j=N.borderTop?N.borderTop:E,A=N.borderBottom?N.borderBottom:E,I=N.borderTop?d:2*d,L=j!==A?1:g-y[w]+1;c.setEdge(_,j,{weight:I,minlen:L,nestingEdge:!0}),c.setEdge(A,b,{weight:I,minlen:L,nestingEdge:!0})}),c.parent(w)||c.setEdge(f,_,{weight:0,minlen:g+y[w]})}function o(c){var f={};function p(d,g){var y=c.children(d);y&&y.length&&e.forEach(y,function(w){p(w,g+1)}),f[d]=g}return e.forEach(c.children(),function(d){p(d,1)}),f}function a(c){return e.reduce(c.edges(),function(f,p){return f+c.edge(p).weight},0)}function u(c){var f=c.graph();c.removeNode(f.nestingRoot),delete f.nestingRoot,e.forEach(c.edges(),function(p){var d=c.edge(p);d.nestingEdge&&c.removeEdge(p)})}return tv}var nv,zE;function L5(){if(zE)return nv;zE=1;var e=yt(),t=pn();nv=r;function r(o){function a(u){var c=o.children(u),f=o.node(u);if(c.length&&e.forEach(c,a),e.has(f,"minRank")){f.borderLeft=[],f.borderRight=[];for(var p=f.minRank,d=f.maxRank+1;p<d;++p)i(o,"borderLeft","_bl",u,f,p),i(o,"borderRight","_br",u,f,p)}}e.forEach(o.children(),a)}function i(o,a,u,c,f,p){var d={width:0,height:0,rank:p,borderType:a},g=f[a][p-1],y=t.addDummyNode(o,"border",d,u);f[a][p]=y,o.setParent(y,c),g&&o.setEdge(g,y,{weight:1})}return nv}var rv,BE;function $5(){if(BE)return rv;BE=1;var e=yt();rv={adjust:t,undo:r};function t(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")&&a(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 a(p){e.forEach(p.nodes(),function(d){u(p.node(d))}),e.forEach(p.edges(),function(d){var g=p.edge(d);e.forEach(g.points,u),e.has(g,"y")&&u(g)})}function u(p){p.y=-p.y}function c(p){e.forEach(p.nodes(),function(d){f(p.node(d))}),e.forEach(p.edges(),function(d){var g=p.edge(d);e.forEach(g.points,f),e.has(g,"x")&&f(g)})}function f(p){var d=p.x;p.x=p.y,p.y=d}return rv}var sv,UE;function q5(){if(UE)return sv;UE=1;var e=yt();sv=t;function t(r){var i={},o=e.filter(r.nodes(),function(p){return!r.children(p).length}),a=e.max(e.map(o,function(p){return r.node(p).rank})),u=e.map(e.range(a+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 f=e.sortBy(o,function(p){return r.node(p).rank});return e.forEach(f,c),u}return sv}var iv,HE;function D5(){if(HE)return iv;HE=1;var e=yt();iv=t;function t(i,o){for(var a=0,u=1;u<o.length;++u)a+=r(i,o[u-1],o[u]);return a}function r(i,o,a){for(var u=e.zipObject(a,e.map(a,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),f=1;f<a.length;)f<<=1;var p=2*f-1;f-=1;var d=e.map(new Array(p),function(){return 0}),g=0;return e.forEach(c.forEach(function(y){var w=y.pos+f;d[w]+=y.weight;for(var k=0;w>0;)w%2&&(k+=d[w+1]),w=w-1>>1,d[w]+=y.weight;g+=y.weight*k})),g}return iv}var ov,WE;function F5(){if(WE)return ov;WE=1;var e=yt();ov=t;function t(r,i){return e.map(i,function(o){var a=r.inEdges(o);if(a.length){var u=e.reduce(a,function(c,f){var p=r.edge(f),d=r.node(f.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 ov}var av,VE;function z5(){if(VE)return av;VE=1;var e=yt();av=t;function t(o,a){var u={};e.forEach(o,function(f,p){var d=u[f.v]={indegree:0,in:[],out:[],vs:[f.v],i:p};e.isUndefined(f.barycenter)||(d.barycenter=f.barycenter,d.weight=f.weight)}),e.forEach(a.edges(),function(f){var p=u[f.v],d=u[f.w];!e.isUndefined(p)&&!e.isUndefined(d)&&(d.indegree++,p.out.push(u[f.w]))});var c=e.filter(u,function(f){return!f.indegree});return r(c)}function r(o){var a=[];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 f=o.pop();a.push(f),e.forEach(f.in.reverse(),u(f)),e.forEach(f.out,c(f))}return e.map(e.filter(a,function(p){return!p.merged}),function(p){return e.pick(p,["vs","i","barycenter","weight"])})}function i(o,a){var u=0,c=0;o.weight&&(u+=o.barycenter*o.weight,c+=o.weight),a.weight&&(u+=a.barycenter*a.weight,c+=a.weight),o.vs=a.vs.concat(o.vs),o.barycenter=u/c,o.weight=c,o.i=Math.min(a.i,o.i),a.merged=!0}return av}var lv,GE;function B5(){if(GE)return lv;GE=1;var e=yt(),t=pn();lv=r;function r(a,u){var c=t.partition(a,function(_){return e.has(_,"barycenter")}),f=c.lhs,p=e.sortBy(c.rhs,function(_){return-_.i}),d=[],g=0,y=0,w=0;f.sort(o(!!u)),w=i(d,p,w),e.forEach(f,function(_){w+=_.vs.length,d.push(_.vs),g+=_.barycenter*_.weight,y+=_.weight,w=i(d,p,w)});var k={vs:e.flatten(d,!0)};return y&&(k.barycenter=g/y,k.weight=y),k}function i(a,u,c){for(var f;u.length&&(f=e.last(u)).i<=c;)u.pop(),a.push(f.vs),c++;return c}function o(a){return function(u,c){return u.barycenter<c.barycenter?-1:u.barycenter>c.barycenter?1:a?c.i-u.i:u.i-c.i}}return lv}var uv,YE;function U5(){if(YE)return uv;YE=1;var e=yt(),t=F5(),r=z5(),i=B5();uv=o;function o(c,f,p,d){var g=c.children(f),y=c.node(f),w=y?y.borderLeft:void 0,k=y?y.borderRight:void 0,_={};w&&(g=e.filter(g,function(A){return A!==w&&A!==k}));var b=t(c,g);e.forEach(b,function(A){if(c.children(A.v).length){var I=o(c,A.v,p,d);_[A.v]=I,e.has(I,"barycenter")&&u(A,I)}});var S=r(b,p);a(S,_);var E=i(S,d);if(w&&(E.vs=e.flatten([w,E.vs,k],!0),c.predecessors(w).length)){var N=c.node(c.predecessors(w)[0]),j=c.node(c.predecessors(k)[0]);e.has(E,"barycenter")||(E.barycenter=0,E.weight=0),E.barycenter=(E.barycenter*E.weight+N.order+j.order)/(E.weight+2),E.weight+=2}return E}function a(c,f){e.forEach(c,function(p){p.vs=e.flatten(p.vs.map(function(d){return f[d]?f[d].vs:d}),!0)})}function u(c,f){e.isUndefined(c.barycenter)?(c.barycenter=f.barycenter,c.weight=f.weight):(c.barycenter=(c.barycenter*c.weight+f.barycenter*f.weight)/(c.weight+f.weight),c.weight+=f.weight)}return uv}var cv,KE;function H5(){if(KE)return cv;KE=1;var e=yt(),t=rr().Graph;cv=r;function r(o,a,u){var c=i(o),f=new t({compound:!0}).setGraph({root:c}).setDefaultNodeLabel(function(p){return o.node(p)});return e.forEach(o.nodes(),function(p){var d=o.node(p),g=o.parent(p);(d.rank===a||d.minRank<=a&&a<=d.maxRank)&&(f.setNode(p),f.setParent(p,g||c),e.forEach(o[u](p),function(y){var w=y.v===p?y.w:y.v,k=f.edge(w,p),_=e.isUndefined(k)?0:k.weight;f.setEdge(w,p,{weight:o.edge(y).weight+_})}),e.has(d,"minRank")&&f.setNode(p,{borderLeft:d.borderLeft[a],borderRight:d.borderRight[a]}))}),f}function i(o){for(var a;o.hasNode(a=e.uniqueId("_root")););return a}return cv}var dv,XE;function W5(){if(XE)return dv;XE=1;var e=yt();dv=t;function t(r,i,o){var a={},u;e.forEach(o,function(c){for(var f=r.parent(c),p,d;f;){if(p=r.parent(f),p?(d=a[p],a[p]=f):(d=u,u=f),d&&d!==f){i.setEdge(d,f);return}f=p}})}return dv}var fv,QE;function V5(){if(QE)return fv;QE=1;var e=yt(),t=q5(),r=D5(),i=U5(),o=H5(),a=W5(),u=rr().Graph,c=pn();fv=f;function f(y){var w=c.maxRank(y),k=p(y,e.range(1,w+1),"inEdges"),_=p(y,e.range(w-1,-1,-1),"outEdges"),b=t(y);g(y,b);for(var S=Number.POSITIVE_INFINITY,E,N=0,j=0;j<4;++N,++j){d(N%2?k:_,N%4>=2),b=c.buildLayerMatrix(y);var A=r(y,b);A<S&&(j=0,E=e.cloneDeep(b),S=A)}g(y,E)}function p(y,w,k){return e.map(w,function(_){return o(y,_,k)})}function d(y,w){var k=new u;e.forEach(y,function(_){var b=_.graph().root,S=i(_,b,k,w);e.forEach(S.vs,function(E,N){_.node(E).order=N}),a(_,k,S.vs)})}function g(y,w){e.forEach(w,function(k){e.forEach(k,function(_,b){y.node(_).order=b})})}return fv}var hv,ZE;function G5(){if(ZE)return hv;ZE=1;var e=yt(),t=rr().Graph,r=pn();hv={positionX:k,findType1Conflicts:i,findType2Conflicts:o,addConflict:u,hasConflict:c,verticalAlignment:f,horizontalCompaction:p,alignCoordinates:y,findSmallestWidthAlignment:g,balance:w};function i(S,E){var N={};function j(A,I){var L=0,P=0,D=A.length,M=e.last(I);return e.forEach(I,function(q,W){var K=a(S,q),C=K?S.node(K).order:D;(K||q===M)&&(e.forEach(I.slice(P,W+1),function(z){e.forEach(S.predecessors(z),function(F){var te=S.node(F),Z=te.order;(Z<L||C<Z)&&!(te.dummy&&S.node(z).dummy)&&u(N,F,z)})}),P=W+1,L=C)}),I}return e.reduce(E,j),N}function o(S,E){var N={};function j(I,L,P,D,M){var q;e.forEach(e.range(L,P),function(W){q=I[W],S.node(q).dummy&&e.forEach(S.predecessors(q),function(K){var C=S.node(K);C.dummy&&(C.order<D||C.order>M)&&u(N,K,q)})})}function A(I,L){var P=-1,D,M=0;return e.forEach(L,function(q,W){if(S.node(q).dummy==="border"){var K=S.predecessors(q);K.length&&(D=S.node(K[0]).order,j(L,M,W,P,D),M=W,P=D)}j(L,M,L.length,D,I.length)}),L}return e.reduce(E,A),N}function a(S,E){if(S.node(E).dummy)return e.find(S.predecessors(E),function(N){return S.node(N).dummy})}function u(S,E,N){if(E>N){var j=E;E=N,N=j}var A=S[E];A||(S[E]=A={}),A[N]=!0}function c(S,E,N){if(E>N){var j=E;E=N,N=j}return e.has(S[E],N)}function f(S,E,N,j){var A={},I={},L={};return e.forEach(E,function(P){e.forEach(P,function(D,M){A[D]=D,I[D]=D,L[D]=M})}),e.forEach(E,function(P){var D=-1;e.forEach(P,function(M){var q=j(M);if(q.length){q=e.sortBy(q,function(F){return L[F]});for(var W=(q.length-1)/2,K=Math.floor(W),C=Math.ceil(W);K<=C;++K){var z=q[K];I[M]===M&&D<L[z]&&!c(N,M,z)&&(I[z]=M,I[M]=A[M]=A[z],D=L[z])}}})}),{root:A,align:I}}function p(S,E,N,j,A){var I={},L=d(S,E,N,A),P=A?"borderLeft":"borderRight";function D(W,K){for(var C=L.nodes(),z=C.pop(),F={};z;)F[z]?W(z):(F[z]=!0,C.push(z),C=C.concat(K(z))),z=C.pop()}function M(W){I[W]=L.inEdges(W).reduce(function(K,C){return Math.max(K,I[C.v]+L.edge(C))},0)}function q(W){var K=L.outEdges(W).reduce(function(z,F){return Math.min(z,I[F.w]-L.edge(F))},Number.POSITIVE_INFINITY),C=S.node(W);K!==Number.POSITIVE_INFINITY&&C.borderType!==P&&(I[W]=Math.max(I[W],K))}return D(M,L.predecessors.bind(L)),D(q,L.successors.bind(L)),e.forEach(j,function(W){I[W]=I[N[W]]}),I}function d(S,E,N,j){var A=new t,I=S.graph(),L=_(I.nodesep,I.edgesep,j);return e.forEach(E,function(P){var D;e.forEach(P,function(M){var q=N[M];if(A.setNode(q),D){var W=N[D],K=A.edge(W,q);A.setEdge(W,q,Math.max(L(S,M,D),K||0))}D=M})}),A}function g(S,E){return e.minBy(e.values(E),function(N){var j=Number.NEGATIVE_INFINITY,A=Number.POSITIVE_INFINITY;return e.forIn(N,function(I,L){var P=b(S,L)/2;j=Math.max(I+P,j),A=Math.min(I-P,A)}),j-A})}function y(S,E){var N=e.values(E),j=e.min(N),A=e.max(N);e.forEach(["u","d"],function(I){e.forEach(["l","r"],function(L){var P=I+L,D=S[P],M;if(D!==E){var q=e.values(D);M=L==="l"?j-e.min(q):A-e.max(q),M&&(S[P]=e.mapValues(D,function(W){return W+M}))}})})}function w(S,E){return e.mapValues(S.ul,function(N,j){if(E)return S[E.toLowerCase()][j];var A=e.sortBy(e.map(S,j));return(A[1]+A[2])/2})}function k(S){var E=r.buildLayerMatrix(S),N=e.merge(i(S,E),o(S,E)),j={},A;e.forEach(["u","d"],function(L){A=L==="u"?E:e.values(E).reverse(),e.forEach(["l","r"],function(P){P==="r"&&(A=e.map(A,function(W){return e.values(W).reverse()}));var D=(L==="u"?S.predecessors:S.successors).bind(S),M=f(S,A,N,D),q=p(S,A,M.root,M.align,P==="r");P==="r"&&(q=e.mapValues(q,function(W){return-W})),j[L+P]=q})});var I=g(S,j);return y(j,I),w(j,S.graph().align)}function _(S,E,N){return function(j,A,I){var L=j.node(A),P=j.node(I),D=0,M;if(D+=L.width/2,e.has(L,"labelpos"))switch(L.labelpos.toLowerCase()){case"l":M=-L.width/2;break;case"r":M=L.width/2;break}if(M&&(D+=N?M:-M),M=0,D+=(L.dummy?E:S)/2,D+=(P.dummy?E:S)/2,D+=P.width/2,e.has(P,"labelpos"))switch(P.labelpos.toLowerCase()){case"l":M=P.width/2;break;case"r":M=-P.width/2;break}return M&&(D+=N?M:-M),M=0,D}}function b(S,E){return S.node(E).width}return hv}var pv,JE;function Y5(){if(JE)return pv;JE=1;var e=yt(),t=pn(),r=G5().positionX;pv=i;function i(a){a=t.asNonCompoundGraph(a),o(a),e.forEach(r(a),function(u,c){a.node(c).x=u})}function o(a){var u=t.buildLayerMatrix(a),c=a.graph().ranksep,f=0;e.forEach(u,function(p){var d=e.max(e.map(p,function(g){return a.node(g).height}));e.forEach(p,function(g){a.node(g).y=f+d/2}),f+=d+c})}return pv}var mv,eN;function K5(){if(eN)return mv;eN=1;var e=yt(),t=R5(),r=A5(),i=M5(),o=pn().normalizeRanks,a=O5(),u=pn().removeEmptyRanks,c=P5(),f=L5(),p=$5(),d=V5(),g=Y5(),y=pn(),w=rr().Graph;mv=k;function k($,G){var ee=G&&G.debugTiming?y.time:y.notime;ee("layout",function(){var ie=ee(" buildLayoutGraph",function(){return D($)});ee(" runLayout",function(){_(ie,ee)}),ee(" updateInputGraph",function(){b($,ie)})})}function _($,G){G(" makeSpaceForEdgeLabels",function(){M($)}),G(" removeSelfEdges",function(){U($)}),G(" acyclic",function(){t.run($)}),G(" nestingGraph.run",function(){c.run($)}),G(" rank",function(){i(y.asNonCompoundGraph($))}),G(" injectEdgeLabelProxies",function(){q($)}),G(" removeEmptyRanks",function(){u($)}),G(" nestingGraph.cleanup",function(){c.cleanup($)}),G(" normalizeRanks",function(){o($)}),G(" assignRankMinMax",function(){W($)}),G(" removeEdgeLabelProxies",function(){K($)}),G(" normalize.run",function(){r.run($)}),G(" parentDummyChains",function(){a($)}),G(" addBorderSegments",function(){f($)}),G(" order",function(){d($)}),G(" insertSelfEdges",function(){Q($)}),G(" adjustCoordinateSystem",function(){p.adjust($)}),G(" position",function(){g($)}),G(" positionSelfEdges",function(){O($)}),G(" removeBorderNodes",function(){Z($)}),G(" normalize.undo",function(){r.undo($)}),G(" fixupEdgeLabelCoords",function(){F($)}),G(" undoCoordinateSystem",function(){p.undo($)}),G(" translateGraph",function(){C($)}),G(" assignNodeIntersects",function(){z($)}),G(" reversePoints",function(){te($)}),G(" acyclic.undo",function(){t.undo($)})}function b($,G){e.forEach($.nodes(),function(ee){var ie=$.node(ee),de=G.node(ee);ie&&(ie.x=de.x,ie.y=de.y,G.children(ee).length&&(ie.width=de.width,ie.height=de.height))}),e.forEach($.edges(),function(ee){var ie=$.edge(ee),de=G.edge(ee);ie.points=de.points,e.has(de,"x")&&(ie.x=de.x,ie.y=de.y)}),$.graph().width=G.graph().width,$.graph().height=G.graph().height}var S=["nodesep","edgesep","ranksep","marginx","marginy"],E={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},N=["acyclicer","ranker","rankdir","align"],j=["width","height"],A={width:0,height:0},I=["minlen","weight","width","height","labeloffset"],L={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},P=["labelpos"];function D($){var G=new w({multigraph:!0,compound:!0}),ee=ce($.graph());return G.setGraph(e.merge({},E,V(ee,S),e.pick(ee,N))),e.forEach($.nodes(),function(ie){var de=ce($.node(ie));G.setNode(ie,e.defaults(V(de,j),A)),G.setParent(ie,$.parent(ie))}),e.forEach($.edges(),function(ie){var de=ce($.edge(ie));G.setEdge(ie,e.merge({},L,V(de,I),e.pick(de,P)))}),G}function M($){var G=$.graph();G.ranksep/=2,e.forEach($.edges(),function(ee){var ie=$.edge(ee);ie.minlen*=2,ie.labelpos.toLowerCase()!=="c"&&(G.rankdir==="TB"||G.rankdir==="BT"?ie.width+=ie.labeloffset:ie.height+=ie.labeloffset)})}function q($){e.forEach($.edges(),function(G){var ee=$.edge(G);if(ee.width&&ee.height){var ie=$.node(G.v),de=$.node(G.w),pe={rank:(de.rank-ie.rank)/2+ie.rank,e:G};y.addDummyNode($,"edge-proxy",pe,"_ep")}})}function W($){var G=0;e.forEach($.nodes(),function(ee){var ie=$.node(ee);ie.borderTop&&(ie.minRank=$.node(ie.borderTop).rank,ie.maxRank=$.node(ie.borderBottom).rank,G=e.max(G,ie.maxRank))}),$.graph().maxRank=G}function K($){e.forEach($.nodes(),function(G){var ee=$.node(G);ee.dummy==="edge-proxy"&&($.edge(ee.e).labelRank=ee.rank,$.removeNode(G))})}function C($){var G=Number.POSITIVE_INFINITY,ee=0,ie=Number.POSITIVE_INFINITY,de=0,pe=$.graph(),ne=pe.marginx||0,Pe=pe.marginy||0;function He(ze){var Oe=ze.x,_e=ze.y,Qe=ze.width,ye=ze.height;G=Math.min(G,Oe-Qe/2),ee=Math.max(ee,Oe+Qe/2),ie=Math.min(ie,_e-ye/2),de=Math.max(de,_e+ye/2)}e.forEach($.nodes(),function(ze){He($.node(ze))}),e.forEach($.edges(),function(ze){var Oe=$.edge(ze);e.has(Oe,"x")&&He(Oe)}),G-=ne,ie-=Pe,e.forEach($.nodes(),function(ze){var Oe=$.node(ze);Oe.x-=G,Oe.y-=ie}),e.forEach($.edges(),function(ze){var Oe=$.edge(ze);e.forEach(Oe.points,function(_e){_e.x-=G,_e.y-=ie}),e.has(Oe,"x")&&(Oe.x-=G),e.has(Oe,"y")&&(Oe.y-=ie)}),pe.width=ee-G+ne,pe.height=de-ie+Pe}function z($){e.forEach($.edges(),function(G){var ee=$.edge(G),ie=$.node(G.v),de=$.node(G.w),pe,ne;ee.points?(pe=ee.points[0],ne=ee.points[ee.points.length-1]):(ee.points=[],pe=de,ne=ie),ee.points.unshift(y.intersectRect(ie,pe)),ee.points.push(y.intersectRect(de,ne))})}function F($){e.forEach($.edges(),function(G){var ee=$.edge(G);if(e.has(ee,"x"))switch((ee.labelpos==="l"||ee.labelpos==="r")&&(ee.width-=ee.labeloffset),ee.labelpos){case"l":ee.x-=ee.width/2+ee.labeloffset;break;case"r":ee.x+=ee.width/2+ee.labeloffset;break}})}function te($){e.forEach($.edges(),function(G){var ee=$.edge(G);ee.reversed&&ee.points.reverse()})}function Z($){e.forEach($.nodes(),function(G){if($.children(G).length){var ee=$.node(G),ie=$.node(ee.borderTop),de=$.node(ee.borderBottom),pe=$.node(e.last(ee.borderLeft)),ne=$.node(e.last(ee.borderRight));ee.width=Math.abs(ne.x-pe.x),ee.height=Math.abs(de.y-ie.y),ee.x=pe.x+ee.width/2,ee.y=ie.y+ee.height/2}}),e.forEach($.nodes(),function(G){$.node(G).dummy==="border"&&$.removeNode(G)})}function U($){e.forEach($.edges(),function(G){if(G.v===G.w){var ee=$.node(G.v);ee.selfEdges||(ee.selfEdges=[]),ee.selfEdges.push({e:G,label:$.edge(G)}),$.removeEdge(G)}})}function Q($){var G=y.buildLayerMatrix($);e.forEach(G,function(ee){var ie=0;e.forEach(ee,function(de,pe){var ne=$.node(de);ne.order=pe+ie,e.forEach(ne.selfEdges,function(Pe){y.addDummyNode($,"selfedge",{width:Pe.label.width,height:Pe.label.height,rank:ne.rank,order:pe+ ++ie,e:Pe.e,label:Pe.label},"_se")}),delete ne.selfEdges})})}function O($){e.forEach($.nodes(),function(G){var ee=$.node(G);if(ee.dummy==="selfedge"){var ie=$.node(ee.e.v),de=ie.x+ie.width/2,pe=ie.y,ne=ee.x-de,Pe=ie.height/2;$.setEdge(ee.e,ee.label),$.removeNode(G),ee.label.points=[{x:de+2*ne/3,y:pe-Pe},{x:de+5*ne/6,y:pe-Pe},{x:de+ne,y:pe},{x:de+5*ne/6,y:pe+Pe},{x:de+2*ne/3,y:pe+Pe}],ee.label.x=ee.x,ee.label.y=ee.y}})}function V($,G){return e.mapValues(e.pick($,G),Number)}function ce($){var G={};return e.forEach($,function(ee,ie){G[ie.toLowerCase()]=ee}),G}return mv}var gv,tN;function X5(){if(tN)return gv;tN=1;var e=yt(),t=pn(),r=rr().Graph;gv={debugOrdering:i};function i(o){var a=t.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(a,function(c,f){var p="layer"+f;u.setNode(p,{rank:"same"}),e.reduce(c,function(d,g){return u.setEdge(d,g,{style:"invis"}),g})}),u}return gv}var vv,nN;function Q5(){return nN||(nN=1,vv="0.8.5"),vv}var yv,rN;function Z5(){return rN||(rN=1,yv={graphlib:rr(),layout:K5(),debug:X5(),util:{time:pn().time,notime:pn().notime},version:Q5()}),yv}var J5=Z5();const sN=Yv(J5),ho=240,Ou=130,io=74,ac=72,iN=io+ac;function eF(e,t){var i;let r=ho;for(const o of e)r=Math.max(r,((i=t.get(o.id))==null?void 0:i.width)??ho);return r}const dT=420,tF=2;function Ca(e){var r;return((r=e.data)==null?void 0:r.sessionId)??"_default"}function nF(e,t){return((t==null?void 0:t.get(e))??0)>0?dT:0}function rF(e,t){const r=(t==null?void 0:t.get(e))??0;return r>0?6+r*36:0}function ja(e,t,r){const i=t.get(e);return{w:((i==null?void 0:i.width)??ho)+nF(e,r),h:Math.max((i==null?void 0:i.height)??Ou,rF(e,r))}}function sF(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}function iF(e,t,r,i,o,a){const u=new sN.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)),f=new Set(c);for(const S of c){const{w:E,h:N}=ja(S,i,a);u.setNode(S,{width:E,height:N})}for(const S of t)f.has(S.source)&&f.has(S.target)&&u.setEdge(S.source,S.target);sN.layout(u);const p=new Map;let d=1/0,g=1/0,y=-1/0,w=-1/0;for(const S of c){const E=u.node(S);if(!E)continue;const N=i.get(S),j=(N==null?void 0:N.width)??ho,A=(N==null?void 0:N.height)??Ou,I=ja(S,i,a),L=E.x-I.w/2,P=E.y-I.h/2;p.set(S,{x:L,y:P}),L<d&&(d=L),P<g&&(g=P),L+j>y&&(y=L+j),P+A>w&&(w=P+A)}if(Number.isFinite(d)&&Number.isFinite(g))for(const[S,E]of p)p.set(S,{x:E.x-d,y:E.y-g});const k=Number.isFinite(y)?y-d:0,_=Number.isFinite(w)?w-g:0;let b=null;for(const S of e){const E=o.get(S);if(!E)continue;const N=i.get(S),j=(N==null?void 0:N.width)??ho,A=(N==null?void 0:N.height)??Ou;b=b===null?{minX:E.x,minY:E.y,maxX:E.x+j,maxY:E.y+A}:{minX:Math.min(b.minX,E.x),minY:Math.min(b.minY,E.y),maxX:Math.max(b.maxX,E.x+j),maxY:Math.max(b.maxY,E.y+A)}}return{positions:p,width:k,height:_,pinnedBox:b}}function oF(e,t,r={}){const i=r.direction??"LR",o=r.pinned??new Map,a=r.measured??new Map,u=r.lanes,c=new Map;for(const S of e){const E=Ca(S),N=c.get(E);N?N.push(S.id):c.set(E,[S.id])}const p=Array.from(c.keys()).sort().map(S=>({sid:S,...iF(c.get(S),t,i,a,o,u)})),d=eF(e,a),g=r.availableHeight&&r.availableHeight>0?r.availableHeight:Number.POSITIVE_INFINITY,y=S=>{const E=[[]];let N=0;for(const j of p)E.length<S&&N>0&&N+j.height>g&&(E.push([]),N=0),E[E.length-1].push(j),N+=j.height+iN;return E},w=S=>S.reduce((E,N)=>Math.max(E,N.width),0)+dT;let k=y(r.availableWidth?tF:1);k.length>1&&k.reduce((E,N)=>E+w(N),0)+d*(k.length-1)>(r.availableWidth??0)&&(k=y(1));const _=new Map;let b=0;for(const S of k){const E=w(S);let N=0;for(const{positions:j,height:A,pinnedBox:I}of S){for(const[P,D]of j)_.set(P,{x:D.x+b,y:D.y+N});let L=N+A;I&&I.maxY>L&&I.minX<b+E&&b<I.maxX&&(L=I.maxY),N=L+iN}b+=E+d}return e.map(S=>{const E=o.get(S.id);if(E)return{...S,position:E};const N=_.get(S.id);return N?{...S,position:N}:S})}function aF(e,t,r,i,o){const u=io+ac,c=60,f=w=>ja(w,i,o),p=new Map(e.map(w=>[w.id,Ca(w)])),d=[],g=e.map(w=>({id:w.id,pos:r.get(w.id)??t.get(w.id)})).filter(w=>w.pos!=null).sort((w,k)=>w.pos.y-k.pos.y||w.pos.x-k.pos.x||w.id.localeCompare(k.id)),y=[];for(const{id:w,pos:k}of g){const{w:_,h:b}=f(w),S=p.get(w)??"_default";if(r.has(w)){d.push({x:k.x,y:k.y,w:_,h:b,sid:S});continue}let E=k.y;for(let N=0;N<d.length+1;N++){const j=d.find(A=>{const I=A.sid===S?24:c,L=A.sid===S?24:u;return k.x<A.x+A.w+I&&A.x<k.x+_+I&&E<A.y+A.h+L&&A.y<E+b+L});if(!j)break;E=j.y+j.h+(j.sid===S?24:u)}E!==k.y&&(t.set(w,{x:k.x,y:E}),y.push(w)),d.push({x:k.x,y:E,w:_,h:b,sid:S})}return y}function lF(e,t,r,i,o,a){const u=_=>ja(_,i,a),c=_=>r.get(_)??t.get(_),f=new Map;for(const _ of e){if(!c(_.id))continue;const b=Ca(_),S=f.get(b);S?S.push(_):f.set(b,[_])}const p=new Set;for(const[_,b]of f)b.every(S=>o.has(S.id)&&!r.has(S.id))&&p.add(_);const d=new Map,g=[];for(const _ of e){const b=c(_.id);if(!b)continue;const{w:S,h:E}=u(_.id),N=Ca(_);p.has(N)?(d.get(N)??d.set(N,[]).get(N)).push(_):g.push({x:b.x,y:b.y,w:S,h:E})}if(d.size===0)return[];const y=io+ac,w=(_,b,S,E)=>g.some(N=>_<N.x+N.w+io&&N.x<_+S+io&&b<N.y+N.h+y&&N.y<b+E+y),k=[];for(const _ of[...d.keys()].sort()){const b=d.get(_);let S=1/0,E=1/0,N=-1/0,j=-1/0;for(const q of b){const W=c(q.id),{w:K,h:C}=u(q.id);S=Math.min(S,W.x),E=Math.min(E,W.y),N=Math.max(N,W.x+K),j=Math.max(j,W.y+C)}const A=N-S,I=j-E,L=[...new Set(g.map(q=>Math.round(q.x)))].sort((q,W)=>q-W),P=L.length?L:[S],D=[0,...g.map(q=>q.y+q.h+y)].sort((q,W)=>q-W);let M=null;e:for(const q of P)for(const W of D){if(W>=E)break;if(!w(q,W,A,I)){M={x:q,y:W};break e}}if(M){const q=M.x-S,W=M.y-E;for(const K of b){const C=c(K.id);t.set(K.id,{x:C.x+q,y:C.y+W})}k.push(_)}for(const q of b){const W=c(q.id),{w:K,h:C}=u(q.id);g.push({x:W.x,y:W.y,w:K,h:C})}}return k}function uF(e,t,r,i,o,a=!1,u){const p=io+ac+1,d=8,g=1.75,y=200,w=.7,k=.01,_=M=>ja(M,i,u),b=M=>r.get(M)??t.get(M),S=new Map;for(const M of e){if(!b(M.id))continue;const q=Ca(M),W=S.get(q);W?W.push(M):S.set(q,[M])}const E=[],N=new Set,j=new Set,A=o.size===0;for(const M of[...S.keys()].sort()){const q=S.get(M);let W=1/0,K=1/0,C=-1/0,z=-1/0,F=!1;for(const Q of q){const O=b(Q.id),{w:V,h:ce}=_(Q.id);W=Math.min(W,O.x),K=Math.min(K,O.y),C=Math.max(C,O.x+V),z=Math.max(z,O.y+ce),r.has(Q.id)&&(F=!0)}const te=C-W,Z=z-K;j.add(M);const U=o.get(M);U&&(te>U.w+d||Z>U.h+d)&&N.add(M),o.set(M,{w:te,h:Z}),E.push({sid:M,members:q.map(Q=>Q.id),x:W,y:K,w:te,h:Z,anchored:F,mass:1})}for(const M of[...o.keys()])j.has(M)||o.delete(M);if(a||A)return[];let I=!1;for(let M=0;M<E.length&&!I;M++)for(let q=M+1;q<E.length;q++){const W=E[M],K=E[q];if(!(W.anchored&&K.anchored)&&Math.abs(W.x+W.w/2-(K.x+K.w/2))<(W.w+K.w)/2+61&&Math.abs(W.y+W.h/2-(K.y+K.h/2))<(W.h+K.h)/2+p){I=!0;break}}if(N.size===0&&!I)return[];if(N.size>0)for(const M of E)N.has(M.sid)&&(M.mass=8);else for(const M of E)M.mass=Math.max(1,M.w*M.h/(ho*Ou));const L=new Map(E.map(M=>[M.sid,M.x])),P=new Map(E.map(M=>[M.sid,M.y]));for(let M=0;M<y;M++){const q=new Map,W=new Map;let K=0;for(let C=0;C<E.length;C++)for(let z=C+1;z<E.length;z++){const F=E[C],te=E[z];if(F.anchored&&te.anchored)continue;const Z=F.x+F.w/2,U=F.y+F.h/2,Q=te.x+te.w/2,O=te.y+te.h/2,V=(F.w+te.w)/2+61-Math.abs(Z-Q),ce=(F.h+te.h)/2+p-Math.abs(U-O);if(V<=0||ce<=0)continue;const $=(We,Ye)=>!We.anchored&&!(Ye<0&&We.x<=0),G=(We,Ye)=>!We.anchored&&!(Ye<0&&We.y<=0),ee=(We,Ye,pt)=>{const _t=We===Ye,se=_t?F.sid<te.sid?-1:1:Math.sign(We-Ye);return pt(F,se)||pt(te,-se)?se:_t&&(pt(F,-se)||pt(te,se))?-se:0},ie=ee(Z,Q,$),de=ee(U,O,G),pe=ie!==0,ne=de!==0;if(!pe&&!ne)continue;const Pe=pe&&(!ne||V*g<ce),[He,ze,Oe,_e]=Pe?[ie,V,q,$]:[de,ce,W,G],Qe=_e(F,He),ye=_e(te,-He),we=F.mass,qe=te.mass,dt=Qe?ye?qe/(we+qe):1:0,Ae=ye?Qe?we/(we+qe):1:0,ot=ze*w;Oe.set(F.sid,(Oe.get(F.sid)??0)+He*ot*dt),Oe.set(te.sid,(Oe.get(te.sid)??0)-He*ot*Ae),K+=ot}for(const C of E)C.anchored||(C.x=Math.max(0,C.x+(q.get(C.sid)??0)),C.y=Math.max(0,C.y+(W.get(C.sid)??0)));if(K<k)break}const D=[];for(const M of E){const q=M.x-L.get(M.sid),W=M.y-P.get(M.sid);if(!(Math.abs(q)<1&&Math.abs(W)<1)){for(const K of M.members){if(r.has(K))continue;const C=t.get(K);C&&t.set(K,{x:C.x+q,y:C.y+W})}D.push(M.sid)}}return D}const cF=600;function Uv(e,t){return!(e.exitAt!=null&&t-e.exitAt>cF||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3)}function dF(e,t){const r=new Set;for(const i of e.agents.values())Uv(i,t)&&r.add(i.id);return r}function fF(e,t,r=0){return e.right+r>t.left&&e.left-r<t.right&&e.bottom+r>t.top&&e.top-r<t.bottom}function hF(e,t,r=0){if(!e)return!1;for(const i of t)if(fF(e,i,r))return!0;return!1}const fT="sessionGroup";function pF(e,t){var i;if(e.type===fT)return"transparent";const r=(i=e.data)==null?void 0:i.state;return t(r==="err"?"--err":r==="active"?"--inflight":"--ok")}const mF="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1).";function gF(e){if(e.checkDisabled)return mF;if(e.checking)return"Asking npm for the newest release…";const t=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`${t}${r} · re-checked periodically · click to check npm now`}function vF(e){const t=`Version v${e.running}`;return e.checkDisabled?`${t}, update checks are off`:e.checking?`${t}, checking npm for a newer release`:`${t}, check npm for a newer release`}function yF(e){const t=e.kind==="restart"?`v${e.to} is installed and waiting for a restart`:`v${e.to} is available on npm`;return`Version v${e.from}, ${t} — ${e.open?"hide":"show"} the notice`}function wF(e){if(e==null)return{kind:"unknown",lead:"No data yet. Start a Claude Code or Codex session — it appears here as soon as the deck sees its first event.",workspace:null,tail:""};const t=e.trim();return t===""?{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:t,tail:" — start one there, or restart it without --workspace/--scope to watch the whole machine."}}const Hv={kind:"assumed",claude:!0,codex:!0};function xF(e){if(!e||typeof e!="object")return Hv;const t=e.providers;if(!t||typeof t!="object")return Hv;const r=t;return{kind:"reported",claude:r.claude!==!1,codex:r.codex!==!1}}function hT(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const Wv=99;function _F(e){const t=Math.max(0,Math.floor(e));return t>Wv?`${Wv}+`:String(t)}const bF="Pause the canvas";function SF(e){return e.paused?e.held<=0?"Nothing has arrived since you paused. Resume to follow the canvas again (Space)":`${hT(e.held)} arrived while paused and will be applied in order when you resume (Space)`:"Pause live updates — events keep arriving and are applied when you resume (Space)"}function kF(e){return e.connected||!e.paused?null:"The canvas is paused as well — Space resumes it, but nothing new arrives until the stream is back."}const EF=e=>e>0?`paused · ${_F(e)}`:"paused";function NF(e){return e.connected?e.paused?{tone:"paused",label:EF(e.held),widest:`paused · ${Wv}+`,title:e.held>0?`Connected — ${hT(e.held)} held until you resume (Space)`:"Connected — updates held until you resume (Space)"}:{tone:"live",label:"live",widest:"live",title:"Receiving events"}:{tone:"dead",label:"offline",widest:"offline",title:e.paused?"SSE disconnected — and the canvas is paused, so resuming will not bring events back until it reconnects":"SSE disconnected"}}function da(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}const CF={agent:jL,sessionGroup:HL},pT="react-flow__node";function oN(e){var t,r;return!!e&&((r=(t=e.classList)==null?void 0:t.contains)==null?void 0:r.call(t,pT))===!0}function jF(e){try{const t=document.querySelector(`.${pT}[data-id="${CSS.escape(e)}"]`);t==null||t.focus({preventScroll:!0})}catch{}}const TF=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(","),RF=420,hu=18,AF=200,IF=5*6e4,MF=6,OF=2*6e4,Dy="agent-dag.layout",Fy="agent-dag.viewport",mT="agent-dag.summariesDismissed",gT="agent-dag.sessionListOpen",vT="agent-dag.detailOpen",yT="agent-dag.usagePanelOpen",aN="agent-dag.accountsPanelOpen",lN="agent-dag.versionNoticeDismissed",uN="agent-dag.oldNameNoticeDismissed",PF=15*6e4,wv={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:"},cN="agent-dag.autoRestart",dN="agent-dag.bundleReloadedFor";function LF(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(gT)==="1"}catch{return!1}}function $F(e){if(!(typeof window>"u"))try{window.localStorage.setItem(gT,e?"1":"0")}catch{}}function qF(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(vT)==="1"}catch{return!1}}function DF(e){if(!(typeof window>"u"))try{window.localStorage.setItem(vT,e?"1":"0")}catch{}}function FF(){const e=yy(yT);return e===null?!0:e==="1"}function zF(e){if(!(typeof window>"u"))try{window.localStorage.setItem(yT,e?"1":"0")}catch{}}function BF(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(mT);if(!e)return new Set;const t=JSON.parse(e);return new Set(Array.isArray(t)?t.filter(r=>typeof r=="string"):[])}catch{return new Set}}function fN(e){if(!(typeof window>"u"))try{const t=Array.from(e),r=t.length>200?t.slice(-200):t;window.localStorage.setItem(mT,JSON.stringify(r))}catch{}}function UF(){const e={positions:[],pins:[]};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(Dy);if(!t)return e;const r=JSON.parse(t);if(!("v"in r)){const o=Object.entries(r).filter(([,a])=>a&&typeof a.x=="number"&&typeof a.y=="number");return{positions:o,pins:o.map(([a])=>a)}}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 xv(e,t){if(!(typeof window>"u"))try{const r={};for(const[i,o]of e)r[i]=o;for(const[i,o]of t)r[i]=o;window.localStorage.setItem(Dy,JSON.stringify({v:2,positions:r,pins:Array.from(t.keys())}))}catch{}}function HF(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Fy);if(!e)return null;const t=JSON.parse(e);return typeof(t==null?void 0:t.x)!="number"||typeof(t==null?void 0:t.y)!="number"||typeof(t==null?void 0:t.zoom)!="number"?null:t}catch{return null}}function WF(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Fy,JSON.stringify(e))}catch{}}function hN(){if(!(typeof window>"u")){try{window.localStorage.removeItem(Dy)}catch{}try{window.localStorage.removeItem(Fy)}catch{}}}function VF(e,t){const r=e.agents.get(t);if(!r)return;const i=[];for(const d of e.agents.values())d.sessionId===t&&i.push(d);const o={schemaVersion:1,exportedAt:new Date().toISOString(),sessionId:t,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(g=>({id:g.id,name:g.name,inputPreview:g.inputPreview,startedAt:g.startedAt,endedAt:g.endedAt,ok:g.ok,errorPreview:g.errorPreview,usage:g.usage}))}))},a=JSON.stringify(o,null,2),u=new Blob([a],{type:"application/json"}),c=URL.createObjectURL(u),f=document.createElement("a"),p=(r.label||"session").replace(/[^a-z0-9._-]/gi,"_");f.href=c,f.download=`${Vt}-${p}-${t.slice(0,8)}.json`,document.body.appendChild(f),f.click(),document.body.removeChild(f),setTimeout(()=>URL.revokeObjectURL(c),1e3)}const Vv={file:"📁",shell:"⚡",web:"🌐",agent:"🤖",task:"📋",plan:"🧭",mcp:"🔌",other:"✨"},Gv={file:"file",shell:"shell",web:"web",agent:"agent",task:"task",plan:"plan",mcp:"mcp",other:"other"},wT=ZC;function GF(e,t){if(!t)return null;const r=new Set([t]);let i=t;for(;i;){const a=e.agents.get(i);if(!(a!=null&&a.parentId)||r.has(a.parentId))break;r.add(a.parentId),i=a.parentId}let o=!0;for(;o;){o=!1;for(const a of e.agents.values())a.parentId&&r.has(a.parentId)&&!r.has(a.id)&&(r.add(a.id),o=!0)}return r}function YF(e,t,r,i,o,a,u,c,f,p,d,g,y,w,k,_,b,S){const E=[],N=[];for(const M of e.agents.values()){if(!b.has(M.id))continue;const q=M.exitAt!=null,W=_!=null&&!_.has(M.id),K=[q?"rf-exiting":"",W?"rf-spotlit-out":""].filter(Boolean).join(" ")||void 0,C=a.get(M.id);if(E.push({id:M.id,type:"agent",position:{x:0,y:0},data:{...M,now:t,onOpenContext:S},className:K,...C?{width:C.width,height:C.height}:null}),M.parentId&&b.has(M.parentId)){const z=fy(M.sessionId),F=q,te=k.size>0&&(k.has(M.id)||k.has(M.parentId)),Z=_!=null&&!_.has(M.id)&&!_.has(M.parentId),U=M.state==="active"?2:1.5,Q=te?U+1.5:U,O=F?.2:Z?.12:1,V=["sess-edge",M.state==="active"?"sess-live":"sess-idle",F?"rf-edge-exiting":"",te?"rf-edge-selected":""].filter(Boolean).join(" ");N.push({id:`e:${M.parentId}->${M.id}`,source:M.parentId,target:M.id,animated:(M.state==="active"||te)&&!F,type:"smoothstep",style:{"--session-hue":z,strokeWidth:Q,opacity:O,transition:"var(--edge-transition)"},className:V})}}const j=new Map;for(const M of e.agents.values())M.tools.length>0&&j.set(M.id,Math.min(4,M.tools.length));const A=`${y}#lanes:${sF(j)}`,I=E.filter(M=>dq(M.id,o,d,g));if(I.length>0||A!==w.current){if(I.length>0){const M=oF(E,N,{direction:"LR",pinned:o,measured:a,availableWidth:r,availableHeight:i,lanes:j});for(const q of M)uj(q.id,d,g)&&hq(q.id,q.position,d,g);lF(E,d,o,a,new Set(I.map(q=>q.id)),j)}aF(E,d,o,a,j),w.current=A}const L=uF(E,d,o,a,u,!f||p,j);L.length>0&&c(L),uu(d,e.agents),uu(g,e.agents),uu(o,e.agents),uu(a,cq(e.agents.values()));const P=[];let D=!1;for(const M of E){let q=o.get(M.id)??d.get(M.id);q||(q=fq(M.id,d,g),D=!0),P.push({...M,position:q})}return D&&(w.current=""),{nodes:P,edges:N}}function KF(){return m.jsx(dy,{children:m.jsx(XF,{})})}function XF(){var Za,Ja,el,tl;const e=Ma(),t=R.useRef($v()),[,r]=R.useState(0),i=R.useCallback(()=>r(H=>H+1),[]),[o,a]=R.useState(()=>new Set),[u,c]=R.useState(null),[f,p]=R.useState(null),d=R.useCallback((H,X)=>{a(le=>{if(!X)return new Set([H]);const fe=new Set(le);return fe.has(H)?fe.delete(H):fe.add(H),fe}),c(le=>X&&le===H?le:H)},[]),g=R.useCallback(()=>{a(new Set),c(null)},[]),[y,w]=R.useState(null),[k,_]=R.useState(null),b=R.useCallback(H=>_(H),[]),[S,E]=R.useState(!1),[N,j]=R.useState(!1),A=R.useRef(BF()),[I,L]=R.useState(LF);R.useEffect(()=>{$F(I)},[I]);const[P,D]=R.useState(qF);R.useEffect(()=>{DF(P)},[P]);const[M,q]=R.useState(FF);R.useEffect(()=>{zF(M)},[M]);const[W,K]=R.useState(()=>{try{const H=window.localStorage.getItem(aN);return H===null?!0:H==="1"}catch{return!0}});R.useEffect(()=>{try{window.localStorage.setItem(aN,W?"1":"0")}catch{}},[W]);const[C,z]=R.useState(null),[F,te]=R.useState(!1),[Z,U]=R.useState(0),[Q,O]=R.useState(0);R.useEffect(()=>{fetch("/api/sound-hook").then(H=>H.ok?H.json():null).then(H=>{H!=null&&H.ok&&(z(H.enabled===!0),U((H.foreign??[]).filter(X=>X.worksHere).length),O(typeof H.parked=="number"?H.parked:0))}).catch(()=>{})},[]);const V=R.useCallback(async()=>{te(!0);try{const X=await(await fetch("/api/sound-hook",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:!C})})).json().catch(()=>null);X!=null&&X.ok&&z(X.enabled===!0),fetch("/api/sound-hook").then(le=>le.ok?le.json():null).then(le=>{le!=null&&le.ok&&(U((le.foreign??[]).filter(fe=>fe.worksHere).length),O(typeof le.parked=="number"?le.parked:0))}).catch(()=>{})}catch{}finally{te(!1)}},[C]),ce=R.useCallback(()=>{te(!0),fetch("/api/sound-hook",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"restore"})}).then(()=>fetch("/api/sound-hook")).then(H=>H.ok?H.json():null).then(H=>{H!=null&&H.ok&&(z(H.enabled===!0),O(H.parked??0))}).catch(()=>{}).finally(()=>te(!1))},[]),$=R.useRef(Q);$.current=Q;const G=R.useCallback(H=>{if(H&&$.current>0){ce();return}V()},[ce,V]),ee=R.useRef(G);ee.current=G;const ie=R.useRef(C);ie.current=C;const[de,pe]=R.useState(!1),[ne,Pe]=R.useState(null),[He,ze]=R.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(lN)??""}catch{return""}}),[Oe,_e]=R.useState(!1),Qe=R.useRef(0),[ye,we]=R.useState(!1),qe=R.useCallback((H=!1)=>{H&&(Qe.current=Date.now(),we(!0)),fetch(H?"/api/version?refresh=1":"/api/version").then(X=>X.ok?X.json():null).then(X=>{X&&Pe(X)}).catch(()=>{}).finally(()=>{H&&we(!1)})},[]),dt=R.useCallback(()=>{qe(Date.now()-Qe.current>=PF)},[qe]);R.useEffect(()=>{qe();const H=window.setInterval(dt,5*6e4),X=()=>{document.visibilityState==="visible"&&dt()};return document.addEventListener("visibilitychange",X),()=>{window.clearInterval(H),document.removeEventListener("visibilitychange",X)}},[qe,dt]),R.useEffect(()=>{de&&qe()},[de,qe]);const Ae=(ne==null?void 0:ne.notice)??null,[ot,We]=R.useState(null),[Ye,pt]=R.useState(Hv);R.useEffect(()=>{let H=!1;return fetch("/api/health").then(X=>X.ok?X.json():null).then(X=>{H||(pt(xF(X)),!(!X||typeof X.workspace!="string")&&We(X.workspace))}).catch(()=>{}),()=>{H=!0}},[de]);const _t=R.useRef(Ye);_t.current=Ye;const se=Ae?`${Ae.kind}:${Ae.to}`:"",$e=Ae!=null&&He!==se,De=R.useCallback(()=>{if(!Ae)return;const H=He===se?"":se;ze(H);try{window.localStorage.setItem(lN,H)}catch{}},[Ae,se,He]),[Te,Fe]=R.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(uN)??""}catch{return""}}),Ze=ne!=null&&ne.invokedAs&&ne.invokedAs!==Vt?ne.invokedAs:null,lt=Ze!=null&&Te!==Ze,ke=R.useCallback(()=>{if(Ze){Fe(Ze);try{window.localStorage.setItem(uN,Ze)}catch{}}},[Ze]),rt=((Za=ne==null?void 0:ne.upgrade)==null?void 0:Za.state)??"idle",tt=X3(ne==null?void 0:ne.upgrade),ut=R.useCallback(async()=>{try{await fetch("/api/upgrade",{method:"POST"})}catch{}qe()},[qe]);R.useEffect(()=>{if(rt!=="running")return;const H=window.setInterval(qe,3e3);return()=>window.clearInterval(H)},[rt,qe]);const zn=R.useCallback(async()=>{var le;const H=ne==null?void 0:ne.command;if(!H)return;let X=!1;try{X=await Promise.race([((le=navigator.clipboard)==null?void 0:le.writeText(H).then(()=>!0))??Promise.resolve(!1),new Promise(fe=>window.setTimeout(()=>fe(!1),500))])}catch{X=!1}if(!X)try{const fe=document.createElement("textarea");fe.value=H,fe.setAttribute("readonly",""),fe.style.cssText="position:fixed;top:0;left:0;opacity:0",document.body.appendChild(fe),fe.select(),X=document.execCommand("copy"),fe.remove()}catch{X=!1}X&&(_e(!0),window.setTimeout(()=>_e(!1),1600))},[ne==null?void 0:ne.command]),_r=R.useCallback(()=>{L(H=>(H||K(!1),!H))},[]),Sn=R.useCallback(()=>{K(H=>(H||L(!1),!H))},[]),[mn,gn]=R.useState(!1),[kn,_s]=R.useState(0),bs=R.useRef(null),[li,Ss]=R.useState(!1),Bn=R.useRef(null),[ui,or]=R.useState(0),ar=R.useRef(vq()),[En,wo]=R.useState(!1),Un=R.useCallback(()=>{const H=ar.current,X=H.setPaused(!H.paused);for(const le of X)t.current=t1(t.current,le);wo(H.paused)},[]),[mt,Wr]=R.useState(Date.now()),[Hn,xo]=R.useState(()=>{if(typeof window>"u")return!0;try{return window.localStorage.getItem(cN)!=="0"}catch{return!0}}),_o=R.useCallback(()=>{xo(H=>{const X=!H;try{window.localStorage.setItem(cN,X?"1":"0")}catch{}return X})},[]),[Nn,en]=R.useState(!1),[ci,di]=R.useState("restart"),[fi,ks]=R.useState(null),Wn=R.useRef(!1),Es=R.useRef(null),Ns=R.useRef(0),br=R.useCallback(async H=>{if(Wn.current)return;const X=(H==null?void 0:H.upgrade)===!0;Wn.current=!0,Es.current=tt;const le=++Ns.current;di(X?"npx":"restart"),en(!0);try{window.sessionStorage.setItem("agent-dag.restartPending",(Ae==null?void 0:Ae.to)??"")}catch{}try{await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({upgrade:X})})}catch{}window.setTimeout(()=>{if(Ns.current===le&&Wn.current){Wn.current=!1,en(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},X?18e4:3e4)},[Ae==null?void 0:Ae.to,tt]),hi=R.useRef(null);R.useEffect(()=>{let H=!1;for(const le of t.current.agents.values())if(le.state==="active"){H=!0;break}const X=Z3({enabled:Hn,kind:Ae==null?void 0:Ae.kind,canRestart:(ne==null?void 0:ne.canRestart)===!0,busy:H,idleSince:hi.current,now:mt});hi.current=X.idleSince,X.restart&&br()},[Hn,Ae==null?void 0:Ae.kind,ne==null?void 0:ne.canRestart,mt,br]),R.useEffect(()=>{const H=ne==null?void 0:ne.running;let X=null,le=null;try{X=window.sessionStorage.getItem("agent-dag.restartPending"),le=window.sessionStorage.getItem(dN)}catch{return}const fe=K3({bundle:"1.43.0",running:H,pending:X,lastTried:le});if(fe==="reload"){try{window.sessionStorage.setItem(dN,H??"")}catch{return}window.location.reload();return}if(fe!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}Wn.current=!1,en(!1),ks(H??null);const Ee=window.setTimeout(()=>ks(null),6e3);return()=>window.clearTimeout(Ee)},[ne==null?void 0:ne.running]),R.useEffect(()=>{if(Nn&&Q3({asked:Es.current,reported:tt})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}Wn.current=!1,en(!1)}},[Nn,tt]);const at=R.useRef(UF()).current;R.useRef(!1);const qt=R.useRef(new Map(at.positions.filter(([H])=>at.pins.includes(H)))),lr=R.useRef(null),Sr=R.useState(()=>HF())[0],[kr,pi]=R.useState(()=>new Set),[ur,Er]=R.useState(wq),[Gt,Cs]=R.useState(!1);R.useEffect(()=>{document.documentElement.dataset.theme=ur;try{window.localStorage.setItem(cj,ur)}catch{}},[ur]),R.useEffect(()=>{if(!Sr)return;const H=window.setTimeout(()=>{try{e.setViewport(Sr,{duration:0})}catch{}},60);return()=>window.clearTimeout(H)},[e,Sr]);const tn=R.useRef(!0);R.useEffect(()=>{const H=new EventSource("/events"),X=gq(i,{now:()=>Date.now(),setTimeout:(le,fe)=>window.setTimeout(le,fe),clearTimeout:le=>window.clearTimeout(le)});return H.addEventListener("open",()=>{pe(!0),Cs(!0)}),H.addEventListener("error",()=>pe(!1)),H.addEventListener("replay-end",()=>{tn.current=!1,X.flush()}),H.addEventListener("hook",le=>{try{const fe=JSON.parse(le.data);if(!ar.current.accept(fe))return;t.current=t1(t.current,fe),fe.replay===!0||tn.current||Date.now()-fe.receivedAt>3e4?X.replay():X.live()}catch{}}),()=>{H.close(),X.cancel()}},[i]),R.useEffect(()=>{const H=setInterval(()=>{const X=Date.now();Wr(X);let le=VP(t.current,X,e1);GP(t.current,X,e1)&&(le=!0),HP(t.current,X,AF,IF)&&(le=!0),WP(t.current,X,MF,OF)&&(le=!0),le&&i()},250);return()=>clearInterval(H)},[i]);const bo=R.useRef(null),Vr=R.useRef(0),lc=420,Yt=R.useCallback((H=500)=>{try{const je=document.querySelector(".canvas-wrap"),Be=Array.from(document.querySelectorAll(".react-flow__node")).filter(Et=>Et.offsetWidth>0);if(!je||Be.length===0)return;const Je=je.getBoundingClientRect(),st=e.getViewport();if(!Number.isFinite(st.zoom)||st.zoom<=0)return;const Ue=Et=>(Et-Je.left-st.x)/st.zoom,gt=Et=>(Et-Je.top-st.y)/st.zoom,Tn=Be.map(Et=>Et.getBoundingClientRect()),Os=Math.min(...Tn.map(Et=>Ue(Et.left))),Ao=Math.max(...Tn.map(Et=>Ue(Et.right))),Ps=Math.min(...Tn.map(Et=>gt(Et.top))),Io=Math.max(...Tn.map(Et=>gt(Et.bottom))),nl=Ao-Os,Jr=Io-Ps;if(!(nl>0&&Jr>0))return;const Qt=Math.max(.2,Math.min(1,(Je.width-160)/(nl+lc)*.86,(Je.height-160)/Jr*.86));e.setViewport({x:80-Os*Qt,y:Math.max(80,(Je.height-Jr*Qt)/2)-Ps*Qt,zoom:Qt},{duration:H}),Vr.current=Date.now(),window.setTimeout(()=>{try{const Et={x:80-Os*Qt,y:Math.max(80,(Je.height-Jr*Qt)/2)-Ps*Qt,zoom:Qt},Mo=e.getViewport();(Math.abs(Mo.zoom-Qt)>.01||Math.abs(Mo.x-Et.x)>2)&&e.setViewport(Et,{duration:0})}catch{}},H+60)}catch{}},[e]),Gr=R.useRef(""),Nr=R.useRef(null),js=R.useRef(0),mi=R.useCallback(()=>{js.current=Date.now()},[]),So="agent-dag.autoFitDisabled",Vn=R.useRef((()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(So)==="1"}catch{return!1}})()),[ko,gi]=R.useState(Vn.current),Yr=R.useCallback(()=>{if(!Vn.current){Vn.current=!0,gi(!0);try{window.localStorage.setItem(So,"1")}catch{}}},[]),uc=R.useCallback(()=>{Vn.current=!1,gi(!1);try{window.localStorage.removeItem(So)}catch{}Yt(400)},[e,Yt]);R.useEffect(()=>{const H=setInterval(()=>{if(Vn.current||Date.now()-js.current<800)return;const X=t.current,le=Date.now(),fe=[];for(const Ue of X.agents.values())Uv(Ue,le)&&fe.push({id:Ue.id});if(fe.length===0)return;const Ee=e.getViewport(),je=window.innerWidth-360,Be=window.innerHeight-52;let Je=!1,st=!1;for(const{id:Ue}of fe){const gt=Ke.current.get(Ue),Tn=qt.current.get(Ue)??Kt.current.get(Ue);if(!gt||!Tn)continue;st=!0;const Os=Tn.x*Ee.zoom+Ee.x,Ao=Tn.y*Ee.zoom+Ee.y,Ps=(Tn.x+gt.width)*Ee.zoom+Ee.x,Io=(Tn.y+gt.height)*Ee.zoom+Ee.y;if(Ps>0&&Os<je&&Io>0&&Ao<Be){Je=!0;break}}st&&!Je&&Yt(600)},1500);return()=>clearInterval(H)},[e]);const Ts=R.useRef(!1),Ke=R.useRef(new Map),Eo=R.useRef(0),za=R.useCallback(H=>{const X=Ke.current;let le=!1;for(const fe of H.nodeInternals.values()){const Ee=fe.width,je=fe.height;if(Ee==null||je==null)continue;const Be=X.get(fe.id);Be?(Math.abs(Be.height-je)>4||Math.abs(Be.width-Ee)>4)&&(X.set(fe.id,{width:Ee,height:je}),le=!0):(X.set(fe.id,{width:Ee,height:je}),le=!0)}return le&&(Eo.current+=1),Eo.current},[]),vi=it(za),[No,Ba]=R.useState(0);R.useEffect(()=>{let H=0;const X=()=>{const fe=Ke.current;let Ee=!1;for(const je of document.querySelectorAll(".react-flow__node[data-id]")){const Be=je.getAttribute("data-id");if(!Be)continue;const Je=je.offsetWidth,st=je.offsetHeight;if(!Je||!st)continue;const Ue=fe.get(Be);(!Ue||Math.abs(Ue.width-Je)>4||Math.abs(Ue.height-st)>4)&&(fe.set(Be,{width:Je,height:st}),Ee=!0)}Ee&&Ba(je=>je+1)};if(Ts.current)return;let le=0;return document.visibilityState==="hidden"?le=window.setTimeout(X,32):H=requestAnimationFrame(X),()=>{cancelAnimationFrame(H),window.clearTimeout(le)}});const Kt=R.useRef(new Map(at.positions)),Co=R.useRef(new Set),Kr=R.useRef(""),Xt=R.useMemo(()=>{const H=[];for(const X of t.current.agents.values())Uv(X,mt)&&H.push(X.id+(X.parentId?`>${X.parentId}`:""));return H.sort(),`${H.join("|")}#sv${vi}.${No}`},[t.current,t.current.lastSeq,mt,vi,No]),nn=R.useRef(null);R.useEffect(()=>(nn.current!=null&&window.clearTimeout(nn.current),nn.current=window.setTimeout(()=>{xv(Kt.current,qt.current)},1500),()=>{nn.current!=null&&window.clearTimeout(nn.current)}),[Xt]),R.useEffect(()=>{if(Gr.current===Xt)return;const H=Gr.current;if(Gr.current=Xt,!H||Vn.current)return;Date.now()-Vr.current>1200&&Yt(400),bo.current&&window.clearTimeout(bo.current),bo.current=window.setTimeout(()=>{Vn.current||Yt(500)},280)},[Xt,e,Yt]);const Cn=R.useMemo(()=>{if(o.size===0)return null;const H=new Set;for(const X of o){const le=GF(t.current,X);if(le)for(const fe of le)H.add(fe)}return H.size>0?H:null},[t.current,t.current.lastSeq,o]),Cr=R.useMemo(()=>dF(t.current,mt),[t.current,t.current.lastSeq,mt]),Xr=R.useRef(null),[vn,Ua]=R.useState({w:0,h:0});R.useEffect(()=>{const H=Xr.current;if(!H||typeof ResizeObserver>"u")return;const X=new ResizeObserver(le=>{var Ee;const fe=(Ee=le[0])==null?void 0:Ee.contentRect;fe&&Ua(je=>Math.abs(je.w-fe.width)>40||Math.abs(je.h-fe.height)>40?{w:fe.width,h:fe.height}:je)});return X.observe(H),Ua({w:H.clientWidth,h:H.clientHeight}),()=>X.disconnect()},[]);const Ha=R.useCallback(H=>{var le,fe;const X=H.target;!(X!=null&&X.closest)||X.closest(TF)!==H.currentTarget||(H.preventDefault(),(fe=(le=document.activeElement)==null?void 0:le.blur)==null||fe.call(le))},[]),Rs=R.useRef(new Map),[Wa,Va]=R.useState(!1);R.useEffect(()=>{const H=window.setTimeout(()=>Va(!0),2500);return()=>window.clearTimeout(H)},[]);const[yi,wi]=R.useState(!1),cr=R.useRef(null),[jr,Qr]=R.useState(!1),Zr=R.useCallback(()=>{cr.current&&(window.clearTimeout(cr.current),cr.current=null),wi(!1)},[]),xi=R.useCallback(H=>{H.length!==0&&queueMicrotask(()=>{wi(!0),cr.current&&window.clearTimeout(cr.current),cr.current=window.setTimeout(()=>wi(!1),RF+80)})},[]);R.useEffect(()=>()=>{cr.current&&window.clearTimeout(cr.current)},[]);const Ga=vn.w>0?vn.w*.92:0,Ya=vn.h>0?vn.h:0,{nodes:jn,edges:_i}=R.useMemo(()=>YF(t.current,mt,Ga,Ya,qt.current,Ke.current,Rs.current,xi,Wa,jr,Kt.current,Co.current,Xt,Kr,o,Cn,Cr,b),[t.current,t.current.lastSeq,mt,Ga,Ya,Wa,jr,Xt,o,Cn,Cr,b,kn]),bi=R.useMemo(()=>{const H=new Map;for(const le of jn){const fe=le.data;if(!(fe!=null&&fe.sessionId)||fe.exitAt!=null)continue;const Ee=le.width,je=le.height;if(Ee==null||je==null)continue;const Be=le.position.x,Je=le.position.y,st=Be+Ee,Ue=Je+je,gt=H.get(fe.sessionId);gt?(gt.minX=Math.min(gt.minX,Be),gt.minY=Math.min(gt.minY,Je),gt.maxX=Math.max(gt.maxX,st),gt.maxY=Math.max(gt.maxY,Ue)):H.set(fe.sessionId,{minX:Be,minY:Je,maxX:st,maxY:Ue})}const X=[];for(const[le,fe]of H){const Ee=fe.maxX-fe.minX+hu*2,je=fe.maxY-fe.minY+hu*2;X.push({id:`group:${le}`,type:fT,position:{x:fe.minX-hu,y:fe.minY-hu},data:{sessionId:le,w:Ee,h:je},width:Ee,height:je,style:{width:Ee,height:je},zIndex:-1,draggable:!0,selectable:!1,focusable:!1,deletable:!1,connectable:!1})}return X},[jn,mt]),Ka=R.useMemo(()=>{const H=[...bi,...jn],X=Bn.current;return!X||X.size===0?H:H.map(le=>{const fe=X.get(le.id);return fe?{...le,position:fe}:le})},[bi,jn,ui]),yn=R.useMemo(()=>{const H=new Set;for(const X of t.current.agents.values())for(const le of X.tools)H.add(wT(le.name));return Object.keys(Vv).filter(X=>H.has(X))},[t.current,t.current.lastSeq]);R.useEffect(()=>{if(yn.length<=1){Ss(!1);return}let H=0;const X=()=>{const le=bs.current;if(le&&!document.hidden){const fe=le.getBoundingClientRect(),Ee=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(Be=>Be.getBoundingClientRect()),je=hF(fe,Ee,8);Ss(Be=>Be===je?Be:je)}H=window.setTimeout(X,300)};return X(),()=>window.clearTimeout(H)},[yn.length]);const jo=R.useCallback(H=>{pi(X=>{const le=new Set(X);return le.has(H)?le.delete(H):le.add(H),le})},[]),jt=u?t.current.agents.get(u):null,Si=f?Array.from(t.current.agents.values()).flatMap(H=>H.tools).find(H=>H.id===f)??null:null,As=R.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}t.current=$v(),qt.current.clear(),Ke.current.clear(),Kt.current.clear(),Kr.current="",hN(),g(),i()},[i,g]),Is=R.useRef(S);Is.current=S;const To=R.useRef(!1);To.current=Si!=null||mn||k!=null||y!=null||N;const Ot=R.useCallback(H=>{const X=rq(H,{confirmOpen:Is.current,modalOpen:To.current});X==="confirm"?E(!0):X==="clear"&&(E(!1),As())},[As]),dr=R.useCallback(()=>{qt.current.clear(),Kt.current.clear(),Kr.current="",hN(),i(),window.setTimeout(()=>Yt(500),80)},[i,e,Yt]),ki=R.useCallback(()=>Yt(500),[Yt]),fr=R.useRef(jn);fr.current=jn;const Xa=R.useRef(u);Xa.current=u;const Ms=R.useCallback(H=>{const X=fr.current,le=iq(X.map(je=>({id:je.id,x:je.position.x,y:je.position.y})),Xa.current,H),fe=le?X.find(je=>je.id===le):void 0;if(!fe)return;const Ee=oN(document.activeElement);d(fe.id,!1),window.setTimeout(()=>{try{e.fitView({padding:.35,duration:350,nodes:[fe]})}catch{}Vr.current=Date.now(),Ee&&jF(fe.id)},30)},[d,e]),Ei=R.useCallback(H=>{d(H,!1),window.setTimeout(()=>{try{const X=fr.current.find(le=>le.id===H);X&&e.fitView({padding:.3,duration:500,nodes:[X]}),Vr.current=Date.now()}catch{}},60)},[d,e]);R.useEffect(()=>{const H=X=>{var Je,st;const le=X.target,fe={tagName:le==null?void 0:le.tagName,isContentEditable:le==null?void 0:le.isContentEditable,role:(Je=le==null?void 0:le.getAttribute)==null?void 0:Je.call(le,"role"),type:le==null?void 0:le.type};if(X.key==="Escape"){const Ue=fL({overlayOpen:Iu.depth()>0,typing:hy(fe)});Ue==="dismiss"?Iu.dismissTop():Ue==="blur"?le==null||le.blur():(uq(fe)&&(le==null||le.blur()),g());return}if(KC(X))return;const Ee=oN(le)?(st=le==null?void 0:le.getAttribute)==null?void 0:st.call(le,"data-id"):null,je=Ee&&fr.current.some(Ue=>Ue.id===Ee)?Ee:null,Be=aq(X,je);if(Be.kind==="activate"){X.preventDefault(),d(Be.nodeId,Be.additive);return}Be.kind!=="node"&&(Be.nodeId==null&&xL(fe)||(X.key===" "&&(X.preventDefault(),Un()),(X.key==="c"||X.key==="C")&&Ot("shortcut"),(X.key==="r"||X.key==="R")&&dr(),(X.key==="f"||X.key==="F")&&ki(),(X.key==="l"||X.key==="L")&&_r(),(X.key==="h"||X.key==="H")&&gn(Ue=>!Ue),(X.key==="u"||X.key==="U")&&q(Ue=>!Ue),(X.key==="a"||X.key==="A")&&_t.current.claude&&Sn(),(X.key==="j"||X.key==="J")&&Ms(1),(X.key==="k"||X.key==="K")&&Ms(-1),(X.key==="t"||X.key==="T")&&Er(Ue=>Ue==="dark"?"light":"dark"),(X.key==="m"||X.key==="M")&&_t.current.claude&&ie.current!==null&&ee.current(X.shiftKey),X.key==="?"&&j(Ue=>!Ue)))};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[Ot,dr,ki,g,d,Ms,Un]);const Tr=t.current.agents.size,rn=R.useMemo(()=>C$(t.current.agents.values()),[t.current,t.current.lastSeq]),Ro=R.useMemo(()=>j$(t.current.agents.values()),[t.current,t.current.lastSeq]),Qa=R.useRef(null);R.useEffect(()=>{const H=xq({waiting:rn.length,running:Ro}),X=Qa.current;if(Qa.current=H,(X==null?void 0:X.title)!==H.title&&(document.title=H.title),(X==null?void 0:X.icon)!==H.icon){const le=document.querySelector('link[rel="icon"]');le&&(le.href=_q[H.icon])}},[rn.length,Ro]);const[cc,dc]=R.useState(""),Ni=Sq(rn);R.useEffect(()=>{dc(H=>kq(H,Ni))},[Ni]);const sn=R.useMemo(()=>{let H=0,X=0,le=0,fe=0,Ee=0,je=0,Be=0,Je=0,st=0;for(const Ue of t.current.agents.values()){H+=Ue.usage.inputTokens,X+=Ue.usage.outputTokens,le+=Ue.usage.cacheReadTokens,fe+=Ue.usage.cacheCreateTokens;const gt=hn(Ue.usage,Ue.model);Ee+=gt.total,je+=gt.input,Be+=gt.output,Je+=gt.cacheRead,st+=gt.cacheWrite}return{inT:H,outT:X,cacheR:le,cacheC:fe,sum:H+X,cost:{total:Ee,input:je,output:Be,cacheRead:Je,cacheWrite:st}}},[t.current,t.current.lastSeq]);return m.jsxs("div",{className:"app",children:[m.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),m.jsxs("header",{className:"topbar",children:[m.jsxs("div",{className:"readout",children:[m.jsxs("div",{className:"brand",children:[m.jsx("span",{className:"logo"}),m.jsx("h1",{children:Vt}),Ae?m.jsxs("button",{type:"button",className:"v stale",onClick:De,"aria-label":yF({...Ae,open:$e}),title:Ae.kind==="restart"?`Running v${Ae.from}; v${Ae.to} is installed on disk. Restart to pick it up.`:`Running v${Ae.from}; v${Ae.to} is on npm.`,children:["v",Ae.from,m.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const H={running:(ne==null?void 0:ne.running)??"1.43.0",latest:ne==null?void 0:ne.latest,latestPending:ne==null?void 0:ne.latestPending,checkedAgo:ne!=null&&ne.checkedAt?Fv(mt-ne.checkedAt):null,checkDisabled:ne==null?void 0:ne.checkDisabled,checking:ye};return m.jsxs("button",{type:"button",className:ye?"v checking":"v",onClick:()=>qe(!0),"aria-busy":ye||void 0,"aria-label":vF(H),title:gF(H),children:["v",H.running]})})()]}),m.jsxs("span",{className:"status",children:[(()=>{const H=NF({connected:de,paused:En,held:ar.current.size});return m.jsx("span",{className:`pill ${H.tone}`,title:H.title,children:m.jsxs("span",{className:"pill-box",children:[m.jsx("span",{className:"pill-widest","aria-hidden":!0,children:H.widest}),m.jsx("span",{className:"pill-label",children:H.label})]})})})(),m.jsx(Q$,{usageOpen:M}),sn.sum>0&&m.jsxs("span",{className:"stat",title:`in:${sn.inT.toLocaleString()} out:${sn.outT.toLocaleString()} cache-r:${sn.cacheR.toLocaleString()} cache-c:${sn.cacheC.toLocaleString()}`,children:[m.jsx("span",{className:"count",children:At(sn.sum)}),m.jsx("span",{className:"lbl",children:"tokens"})]}),sn.cost.total>0&&(()=>{let H=0,X=0;for(const Ee of t.current.agents.values()){if(Ee.state!=="active")continue;const je=hn(Ee.usage,Ee.model);H+=je.total,X=Math.max(X,((Ee.endedAt??mt)-Ee.startedAt)/1e3)}const le=X>0?Ru(H,X):null,fe=`input ${Xe(sn.cost.input)} + output ${Xe(sn.cost.output)} + cache r ${Xe(sn.cost.cacheRead)} + cache w ${Xe(sn.cost.cacheWrite)}${le?`
|
|
76
|
+
active burn: ${le}`:""}`;return m.jsxs("span",{className:"stat",title:fe,children:[m.jsx("span",{className:"count",children:Xe(sn.cost.total)}),m.jsxs("span",{className:"lbl",children:["cost",le?` · ${le}`:""]})]})})()]}),m.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:cc}),rn.length>0&&m.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>Ei(rn[0].id),title:`Blocked waiting for you — click to go to the one that has been stuck longest:
|
|
77
|
+
${rn.map(H=>` ${H.label}: ${Uu(H.waiting)} (${Fv(mt-H.waiting.since)})`).join(`
|
|
78
|
+
`)}`,"aria-label":`${rn.length} session${rn.length===1?"":"s"} waiting for you`,children:[m.jsx("span",{className:"ap-pulse","aria-hidden":!0}),m.jsx("b",{children:rn.length})," waiting"]})]}),jt&&(()=>{const H=hn(jt.usage,jt.model),X=Math.max(0,((jt.endedAt??mt)-jt.startedAt)/1e3),le=jt.state==="active"?Ru(H.total,X):null,fe=o.size-1;return m.jsxs("button",{type:"button",className:"selected-ribbon",title:`Fit view to ${jt.label}`,onClick:()=>{try{const Ee=jn.find(je=>je.id===jt.id);Ee&&e.fitView({padding:.35,duration:500,nodes:[Ee]}),Vr.current=Date.now()}catch{}},children:[m.jsx("span",{className:`state-pill state-${jt.state}`,children:jt.state==="active"?"live":jt.state}),m.jsx("span",{className:"selected-label",children:jt.label}),H.total>0&&m.jsxs("span",{className:"selected-cost",children:[Xe(H.total),le?m.jsxs("span",{className:"selected-rate",children:[" · ",le]}):null]}),fe>0&&m.jsxs("span",{className:"selected-extra",children:["+",fe]}),m.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:Ee=>{Ee.stopPropagation(),g()},children:"×"})]})})(),m.jsxs("div",{className:"actions",children:[m.jsxs("div",{className:"action-run",children:[m.jsx("button",{className:"btn icon-btn",onClick:()=>q(H=>!H),title:`${M?"Hide":"Show"} usage panel (U)`,"aria-label":"Toggle usage panel","aria-expanded":M,"aria-controls":M?"usage-panel":void 0,children:"$"}),Ye.claude&&m.jsx("button",{className:"btn icon-btn",onClick:Sn,title:`${W?"Hide":"Show"} accounts (A)`,"aria-label":"Toggle accounts panel","aria-expanded":W,"aria-controls":W?"accounts-panel":void 0,children:m.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:[m.jsx("circle",{cx:"7",cy:"4.6",r:"2.4"}),m.jsx("path",{d:"M2.4 12c0-2.3 2.1-3.7 4.6-3.7s4.6 1.4 4.6 3.7"})]})}),m.jsx("button",{className:"btn icon-btn",onClick:()=>gn(H=>!H),title:"Usage history — ccusage (H)","aria-label":"Open usage history","aria-haspopup":"dialog",children:m.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":!0,children:[m.jsx("line",{x1:"3",y1:"11.5",x2:"3",y2:"7"}),m.jsx("line",{x1:"7",y1:"11.5",x2:"7",y2:"3"}),m.jsx("line",{x1:"11",y1:"11.5",x2:"11",y2:"8.5"})]})})]}),m.jsxs("div",{className:"action-run",children:[Ye.claude&&C!==null&&m.jsx("button",{className:"btn icon-btn",onClick:H=>G(H.shiftKey),disabled:F,title:Iq(Ye,{on:C,clash:Z,parked:Q}),"aria-label":"Toggle Claude Code finish sound","aria-pressed":C,children:m.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:[m.jsx("path",{d:"M3.2 5.2h2L7.8 3v8L5.2 8.8h-2z"}),C?m.jsxs(m.Fragment,{children:[m.jsx("path",{d:"M9.8 5.4a2.4 2.4 0 0 1 0 3.2"}),m.jsx("path",{d:"M11.3 3.9a4.6 4.6 0 0 1 0 6.2"})]}):m.jsxs(m.Fragment,{children:[m.jsx("path",{d:"M10 5.6l2.6 2.8"}),m.jsx("path",{d:"M12.6 5.6L10 8.4"})]})]})}),m.jsx("button",{className:"btn icon-btn",onClick:()=>Er(H=>H==="dark"?"light":"dark"),title:`Switch to ${ur==="dark"?"light":"dark"} mode (T)`,"aria-label":"Toggle theme",children:ur==="dark"?"☀":"☾"})]})]})]}),fi?m.jsxs("div",{className:"ver-banner done",role:"status",children:[m.jsx("span",{className:"ver-dot"}),m.jsxs("strong",{children:["Restarted — now running v",fi,"."]}),m.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):Gt&&!de?m.jsxs("div",{className:"conn-banner",role:"alert",children:[m.jsx("span",{className:"conn-dot"}),Nn?ci==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${Vt}…`:(()=>{const H=kF({connected:de,paused:En});return m.jsxs(m.Fragment,{children:[`Lost connection to the ${Vt} server. Reconnecting…`,H&&m.jsx("span",{className:"conn-sub",children:H})]})})()]}):$e&&Ae?m.jsxs("div",{className:`ver-banner ${Ae.kind}`,role:"status",children:[m.jsx("span",{className:"ver-dot"}),Ae.kind==="restart"?m.jsxs(m.Fragment,{children:[m.jsxs("strong",{children:["v",Ae.to," is installed — this deck still runs v",Ae.from,"."]}),ne!=null&&ne.canRestart?m.jsxs(m.Fragment,{children:[m.jsx("button",{type:"button",className:"ver-act",onClick:()=>br(),disabled:Nn,title:"Stop this process and bring it back on the same port. The canvas replays from the event log.",children:Nn?"restarting…":"Restart now"}),m.jsxs("button",{type:"button",className:`ver-auto${Hn?" on":""}`,role:"switch","aria-checked":Hn,onClick:_o,title:Hn?"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:[m.jsx("i",{"aria-hidden":!0}),"auto when idle"]})]}):m.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."})]}):m.jsxs(m.Fragment,{children:[m.jsxs("strong",{children:[Vt," v",Ae.to," is out — you are on v",Ae.from,"."]}),(ne==null?void 0:ne.upgradeMode)==="install"&&rt!=="failed"&&m.jsx("button",{type:"button",className:"ver-act",onClick:ut,disabled:rt==="running"||rt==="done",title:`Runs ${((Ja=ne==null?void 0:ne.upgrade)==null?void 0:Ja.command)??(ne==null?void 0:ne.command)??"npm i -g"} here, then restarts once nothing is running.`,children:rt==="running"?"installing…":rt==="done"?"installed":"Update now"}),(ne==null?void 0:ne.upgradeMode)==="npx"&&(ne==null?void 0:ne.canRestart)&&m.jsx("button",{type:"button",className:"ver-act",onClick:()=>br({upgrade:!0}),disabled:Nn,title:`Runs ${ne==null?void 0:ne.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:Nn?"fetching…":rt==="failed"?"Retry update":"Update & restart"}),rt==="failed"?m.jsxs("span",{className:"ver-sub fail",title:((el=ne==null?void 0:ne.upgrade)==null?void 0:el.error)??"",children:[(ne==null?void 0:ne.upgradeMode)==="npx"?"update failed":"install failed",": ",((tl=ne==null?void 0:ne.upgrade)==null?void 0:tl.error)??"unknown error"," — run it yourself:"]}):(ne==null?void 0:ne.upgradeMode)==="npx"?m.jsx("span",{className:"ver-sub",children:ne!=null&&ne.canRestart?"npx cannot upgrade in place, so the deck re-runs:":wv.npx}):ne!=null&&ne.upgradeBlocked?m.jsx("span",{className:"ver-sub",children:Object.hasOwn(wv,ne.upgradeBlocked)?wv[ne.upgradeBlocked]:"cannot install from here"}):null,m.jsxs("button",{type:"button",className:"ver-cmd",onClick:zn,title:"Copy to clipboard",children:[m.jsx("code",{children:ne==null?void 0:ne.command}),m.jsx("span",{className:"ver-cmd-hint",children:Oe?"copied":"copy"})]})]}),m.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:De,children:"×"})]}):lt&&Ze?m.jsxs("div",{className:"ver-banner",role:"status",children:[m.jsx("span",{className:"ver-dot"}),m.jsxs("strong",{children:[Ze," still works — the deck is called ",Vt," now."]}),ne!=null&&ne.renameFix?m.jsx("span",{className:"ver-sub",children:ne.renameFix}):null,m.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:ke,children:"×"})]}):null,M&&m.jsx(F$,{state:t.current,now:mt,providers:Ye,onClose:()=>q(!1)}),W&&Ye.claude&&m.jsx(V3,{onClose:()=>K(!1)}),I&&m.jsx(R$,{state:t.current,now:mt,selectedIds:o,onSelect:Ei,onClose:()=>L(!1)}),m.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${yi?" bubbling":""}${jr?" dragging-any":""}`,ref:Xr,onMouseDownCapture:Ha,children:[Tr===0&&m.jsx(QF,{live:de,everConnected:Gt,providers:Ye}),yn.length>1&&m.jsx("div",{ref:bs,className:`cat-filter-bar${li?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:yn.map(H=>{const X=kr.has(H);return m.jsxs("button",{type:"button",className:`cat-filter${X?" off":""}`,onClick:()=>jo(H),"aria-pressed":!X,title:`${X?"Show":"Hide"} ${Gv[H]} tools`,children:[m.jsx("span",{className:"cat-emoji",children:Vv[H]}),m.jsx("span",{className:"cat-name",children:Gv[H]})]},H)})}),m.jsxs(IC,{nodes:Ka,edges:_i,nodeTypes:CF,fitView:!Sr,fitViewOptions:{padding:.25,duration:400},minZoom:.2,maxZoom:1.6,panOnScroll:!0,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,onNodeClick:(H,X)=>{if(X.type==="sessionGroup"){g();return}d(X.id,H.shiftKey)},onPaneClick:()=>g(),onMoveStart:()=>{Date.now()-Vr.current<1200||Yr()},onMove:(H,X)=>{mi(),Nr.current&&window.clearTimeout(Nr.current),Nr.current=window.setTimeout(()=>WF(X),250)},onNodeDragStart:(H,X)=>{var le;if(Zr(),Ts.current=!0,Bn.current=new Map,Qr(!0),mi(),Yr(),X.type==="sessionGroup"){const fe=(le=X.data)==null?void 0:le.sessionId,Ee=new Map;if(fe)for(const je of jn){const Be=je.data;(Be==null?void 0:Be.sessionId)===fe&&Ee.set(je.id,{x:je.position.x,y:je.position.y})}lr.current={start:{x:X.position.x,y:X.position.y},members:Ee};return}qt.current.set(X.id,{x:X.position.x,y:X.position.y})},onNodeDrag:(H,X)=>{var le;if(mi(),X.type==="sessionGroup"){const fe=lr.current;if(!fe)return;const Ee=X.position.x-fe.start.x,je=X.position.y-fe.start.y;for(const[Je,st]of fe.members){const Ue={x:st.x+Ee,y:st.y+je};qt.current.set(Je,Ue),Kt.current.set(Je,Ue)}const Be=Bn.current;if(Be){for(const[Je,st]of fe.members)Be.set(Je,{x:st.x+Ee,y:st.y+je});Be.set(X.id,{x:X.position.x,y:X.position.y})}or(Je=>Je+1);return}qt.current.set(X.id,{x:X.position.x,y:X.position.y}),Kt.current.set(X.id,{x:X.position.x,y:X.position.y}),(le=Bn.current)==null||le.set(X.id,{x:X.position.x,y:X.position.y}),or(fe=>fe+1)},onNodeDragStop:(H,X)=>{if(mi(),Ts.current=!1,Bn.current=null,Qr(!1),_s(le=>le+1),X.type==="sessionGroup"){const le=lr.current;if(le){const fe=X.position.x-le.start.x,Ee=X.position.y-le.start.y;for(const[je,Be]of le.members){const Je={x:Be.x+fe,y:Be.y+Ee};qt.current.set(je,Je),Kt.current.set(je,Je)}}lr.current=null,xv(Kt.current,qt.current),_s(fe=>fe+1);return}qt.current.set(X.id,{x:X.position.x,y:X.position.y}),Kt.current.set(X.id,{x:X.position.x,y:X.position.y}),xv(Kt.current,qt.current)},children:[m.jsx(IP,{gap:28,size:1,color:da("--grid-line")}),m.jsx(BL,{}),m.jsx(S$,{agents:t.current.agents,visibleAgentIds:Cr,positions:Kt.current,pinned:qt.current,measured:Ke.current,spotlight:Cn,hiddenCategories:kr,now:mt,onOpenTool:p}),m.jsxs(NP,{showInteractive:!1,children:[m.jsx(vr,{onClick:uc,title:ko?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view",style:ko?{color:"var(--accent)"}:void 0,children:m.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[m.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),m.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),m.jsx(vr,{onClick:Un,title:SF({paused:En,held:ar.current.size}),"aria-label":bF,"aria-pressed":En,children:m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:m.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),m.jsx(vr,{onClick:dr,title:"Auto-arrange — clear pins (R)","aria-label":"Re-arrange the canvas",children:m.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[m.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),m.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),m.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),m.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),m.jsx(vr,{onClick:()=>Ot("button"),title:"Clear the canvas and the server's event log — asks first (C)","aria-label":"Clear the canvas",children:m.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[m.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),m.jsx("path",{d:"M9 6.2V4.4a1.6 1.6 0 0 1 1.6-1.6h2.8a1.6 1.6 0 0 1 1.6 1.6v1.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),m.jsx("path",{d:"M17.4 6.4 16.7 20a2 2 0 0 1-2 1.9H9.3a2 2 0 0 1-2-1.9L6.6 6.4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),m.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),m.jsx(vr,{onClick:()=>j(H=>!H),title:"Keyboard shortcuts (?)","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:m.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[m.jsx("path",{d:"M8.6 8.4a3.5 3.5 0 1 1 4.6 3.35c-.85.3-1.2 1-1.2 1.85v1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),m.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]}),m.jsx(wP,{zoomable:!0,pannable:!0,nodeColor:H=>pF(H,da),nodeStrokeWidth:2,maskColor:da("--minimap-mask"),style:{background:da("--panel"),border:`1px solid ${da("--line")}`,borderRadius:8}})]})]}),P?m.jsxs("aside",{className:"detail","aria-label":"Detail",children:[m.jsx("button",{type:"button",className:"glyph-btn detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:()=>D(!1),children:"×"}),jt?m.jsx(ez,{agent:jt,now:mt,onOpenTool:p,onShowSummary:H=>{A.current.has(H)&&(A.current.delete(H),fN(A.current)),w(H)},onExportSession:H=>VF(t.current,H)}):m.jsx(JF,{count:Tr,workspace:ot})]}):m.jsx("button",{type:"button",className:"detail-reopen",title:"Show detail panel","aria-label":"Show detail panel",onClick:()=>D(!0),children:"‹"}),Si&&m.jsx(ML,{tool:Si,onClose:()=>p(null)}),mn&&m.jsx($q,{providers:Ye,onClose:()=>gn(!1)}),k&&(()=>{const H=t.current.agents.get(k);return H?m.jsx(NL,{agent:H,onClose:()=>_(null)}):null})(),y&&m.jsx(E$,{state:t.current,sessionId:y,onClose:()=>{A.current.add(y),fN(A.current),w(null)}}),N&&m.jsx(nq,{onClose:()=>j(!1)}),S&&m.jsx(J3,{agentCount:Tr,onConfirm:()=>Ot("confirmation"),onCancel:()=>E(!1)})]})}function QF({live:e,everConnected:t,providers:r}){const i=!e;return m.jsxs("div",{className:"empty-hero",children:[m.jsxs("div",{className:"orbit-stack","aria-hidden":!0,children:[m.jsx("div",{className:"core"}),m.jsxs("div",{className:"orbit r1",children:[m.jsx("span",{className:"dot"}),m.jsx("span",{className:"dot b"})]}),m.jsxs("div",{className:"orbit r2",children:[m.jsx("span",{className:"dot"}),m.jsx("span",{className:"dot b"})]}),m.jsxs("div",{className:"orbit r3",children:[m.jsx("span",{className:"dot"}),m.jsx("span",{className:"dot b"})]})]}),i?m.jsxs(m.Fragment,{children:[m.jsx("h2",{children:t?"Disconnected from server":"Server unreachable"}),m.jsxs("p",{children:["The browser cannot reach ",m.jsx("code",{children:"/events"}),". Check that",m.jsx("code",{children:Vt})," is still running in your terminal, then this page will resume automatically."]})]}):ZF(r)]})}function ZF(e){return m.jsxs(m.Fragment,{children:[m.jsx("h2",{children:"Waiting for Claude Code or Codex"}),m.jsxs("p",{children:["Run ",m.jsx("code",{children:"claude"})," or ",m.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."]}),m.jsxs("p",{className:"hint-row",children:["Not seeing anything? Make sure ",m.jsx("code",{children:Vt})," is running."]}),Aq(e).map(t=>m.jsx("p",{className:"hint-row",children:t.spans.map((r,i)=>r.code?m.jsx("code",{children:r.text},i):m.jsx("span",{children:r.text},i))},t.provider))]})}function JF({count:e,workspace:t}){const r=wF(t);return m.jsxs(m.Fragment,{children:[m.jsx("h2",{children:"Detail"}),e===0?m.jsxs("div",{className:"hint",children:[r.lead,r.workspace!==null&&m.jsxs(m.Fragment,{children:[" ",m.jsx("code",{children:r.workspace}),r.tail]})]}):m.jsx("div",{className:"empty",children:"Click an agent to see its tools."}),m.jsx("h3",{style:{marginTop:4},children:"Shortcuts"}),m.jsxs("div",{className:"shortcuts",children:[m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"?"}),m.jsx("span",{children:"all shortcuts"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"drag"}),m.jsx("span",{children:"move a node"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"tab"}),m.jsx("span",{children:"reach the cards"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"enter"}),m.jsx("span",{children:"select the focused card"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"space"}),m.jsx("span",{children:"pause / resume"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"J"}),m.jsx("span",{children:"next agent"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"K"}),m.jsx("span",{children:"previous agent"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"R"}),m.jsx("span",{children:"re-arrange"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"F"}),m.jsx("span",{children:"fit view"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"L"}),m.jsx("span",{children:"session list"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"H"}),m.jsx("span",{children:"usage history"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"U"}),m.jsx("span",{children:"usage panel"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"C"}),m.jsx("span",{children:"clear canvas"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"T"}),m.jsx("span",{children:"toggle theme"})]}),m.jsxs("div",{className:"sc",children:[m.jsx("kbd",{children:"Esc"}),m.jsx("span",{children:"deselect, release focus"})]})]})]})}function ez({agent:e,now:t,onOpenTool:r,onShowSummary:i,onExportSession:o}){const a=Au(e.startedAt,e.endedAt,t),u=hn(e.usage,e.model),c=u.total>0,f=e.usage.inputTokens+e.usage.outputTokens,p=new Map;for(const k of e.tools){const _=wT(k.name);p.set(_,(p.get(_)??0)+1)}const d=e.tools.filter(k=>k.ok===!1).length,g=e.tools.filter(k=>!k.endedAt).length,y=Array.from(p.entries()).sort((k,_)=>_[1]-k[1]),w=p.has("mcp")?y$(e.tools.map(k=>k.name)):null;return m.jsxs(m.Fragment,{children:[m.jsxs("header",{className:"detail-hero",children:[m.jsxs("div",{className:"hero-line",children:[m.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),m.jsx("h2",{className:"hero-title",title:e.cwd??e.label,children:e.label})]}),m.jsxs("div",{className:"hero-meta",children:[m.jsx("span",{className:"hero-meta-item",children:e.kind}),m.jsx("span",{className:"hero-sep",children:"·"}),m.jsx("span",{className:"hero-meta-item",title:`started ${new Date(e.startedAt).toLocaleString()}`,children:a}),e.model&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"hero-sep",children:"·"}),m.jsx("span",{className:"model-chip",title:e.model,children:ni(e.model)})]})]}),c&&m.jsxs("div",{className:"hero-cost",children:[m.jsxs("div",{className:"hero-cost-headline",children:[m.jsx("span",{className:"hero-cost-value",children:Xe(u.total)}),m.jsx("span",{className:"hero-cost-label",children:"spend"})]}),m.jsx(gy,{cost:u})]}),m.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&i&&m.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&&m.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&&m.jsxs("section",{className:"detail-section",children:[m.jsx("h3",{children:"Activity"}),m.jsxs("div",{className:"activity-row",children:[m.jsxs("div",{className:"activity-counters",children:[m.jsxs("span",{className:"ac-item",children:[m.jsx("b",{children:e.toolCount})," calls"]}),g>0&&m.jsxs("span",{className:"ac-item ac-live",children:[m.jsx("b",{children:g})," live"]}),d>0&&m.jsxs("span",{className:"ac-item ac-err",children:[m.jsx("b",{children:d})," err"]})]}),m.jsx("div",{className:"cat-strip",children:y.map(([k,_])=>{const b=k==="mcp"?w:null,S=b==null?void 0:b.hue,E=`${_} ${Gv[k]} call${_===1?"":"s"}`;return m.jsxs("span",{className:`cat-chip cat-${k}${S!=null?" mcp-hue":""}`,style:S!=null?{"--mcp-hue":S}:void 0,title:b?`${E}, all to ${b.label}`:E,children:[m.jsx("span",{className:"cat-emoji",children:Vv[k]}),m.jsx("span",{className:"cat-count",children:_}),b&&m.jsx("span",{className:"cat-server",children:b.label})]},k)})})]})]}),f>0&&m.jsxs("section",{className:"detail-section",children:[m.jsx("h3",{children:"Tokens"}),m.jsxs("div",{className:"tokens-grid",children:[m.jsxs("div",{children:[m.jsx("span",{className:"k",children:"in"}),m.jsx("b",{children:e.usage.inputTokens.toLocaleString()})]}),m.jsxs("div",{children:[m.jsx("span",{className:"k",children:"out"}),m.jsx("b",{children:e.usage.outputTokens.toLocaleString()})]}),m.jsxs("div",{children:[m.jsx("span",{className:"k",children:"cache r"}),m.jsx("b",{children:e.usage.cacheReadTokens.toLocaleString()})]}),m.jsxs("div",{children:[m.jsx("span",{className:"k",children:"cache c"}),m.jsx("b",{children:e.usage.cacheCreateTokens.toLocaleString()})]})]})]}),m.jsxs("section",{className:"detail-section",children:[m.jsx("h3",{children:"Identity"}),m.jsxs("div",{children:[e.cwd&&m.jsxs("div",{className:"row",children:[m.jsx("span",{className:"k",children:"cwd"}),m.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),m.jsxs("div",{className:"row",children:[m.jsx("span",{className:"k",children:"session"}),m.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&m.jsxs("div",{className:"row",children:[m.jsx("span",{className:"k",children:"parent"}),m.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&m.jsxs("section",{className:"detail-section",children:[m.jsxs("h3",{children:["Prompts ",m.jsx("span",{className:"section-count",children:e.prompts.length})]}),m.jsx("div",{className:"prompts",children:e.prompts.slice().reverse().map((k,_)=>{const b=I$(k.at,t);return m.jsxs("div",{className:"prompt-entry",children:[m.jsx("div",{className:"prompt-time",title:b.title,children:b.label}),m.jsx("div",{className:"prompt-text",children:k.text})]},_)})})]}),m.jsxs("section",{className:"detail-section",children:[m.jsxs("h3",{children:["Tool calls ",m.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&m.jsx("div",{className:"empty",children:"No tool calls yet."}),m.jsx("div",{children:e.tools.slice().reverse().map(k=>m.jsx(nz,{t:k,onClick:()=>r(k.id)},k.id))})]})]})}const tz={inflight:"in-flight",done:"done",err:"error"};function nz({t:e,onClick:t}){const r=e.endedAt==null?"inflight":e.ok===!1?"err":"done",i=GC(e,"…");return m.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:t,children:[m.jsxs("span",{className:"name",children:[m.jsx("span",{className:`status-dot ${r}`,"aria-hidden":!0}),m.jsx("span",{className:"vis-hidden",children:tz[r]}),e.name]}),m.jsx("span",{style:{color:"var(--muted)"},children:i})]})}try{U$(window.localStorage)}catch{}const rz=RR.createRoot(document.getElementById("root"));rz.render(m.jsx(KF,{}));
|